@prismicio/vue 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/PrismicEmbed.cjs +36 -0
- package/dist/components/PrismicEmbed.cjs.map +1 -0
- package/dist/components/PrismicEmbed.d.ts +63 -0
- package/dist/components/PrismicEmbed.js +36 -0
- package/dist/components/PrismicEmbed.js.map +1 -0
- package/dist/components/PrismicImage.cjs +122 -0
- package/dist/components/PrismicImage.cjs.map +1 -0
- package/dist/components/PrismicImage.d.ts +162 -0
- package/dist/components/PrismicImage.js +122 -0
- package/dist/components/PrismicImage.js.map +1 -0
- package/dist/components/PrismicLink.cjs +115 -0
- package/dist/components/PrismicLink.cjs.map +1 -0
- package/dist/components/PrismicLink.d.ts +191 -0
- package/dist/components/PrismicLink.js +115 -0
- package/dist/components/PrismicLink.js.map +1 -0
- package/dist/components/PrismicRichText.cjs +103 -0
- package/dist/components/PrismicRichText.cjs.map +1 -0
- package/dist/components/PrismicRichText.d.ts +139 -0
- package/dist/components/PrismicRichText.js +103 -0
- package/dist/components/PrismicRichText.js.map +1 -0
- package/dist/components/PrismicText.cjs +57 -0
- package/dist/components/PrismicText.cjs.map +1 -0
- package/dist/components/PrismicText.d.ts +117 -0
- package/dist/components/PrismicText.js +57 -0
- package/dist/components/PrismicText.js.map +1 -0
- package/dist/components/SliceZone.cjs +134 -0
- package/dist/components/SliceZone.cjs.map +1 -0
- package/dist/components/SliceZone.d.ts +359 -0
- package/dist/components/SliceZone.js +134 -0
- package/dist/components/SliceZone.js.map +1 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/composables.cjs +40 -0
- package/dist/composables.cjs.map +1 -0
- package/dist/composables.d.ts +366 -0
- package/dist/composables.js +40 -0
- package/dist/composables.js.map +1 -0
- package/dist/createPrismic.cjs +87 -0
- package/dist/createPrismic.cjs.map +1 -0
- package/dist/createPrismic.d.ts +12 -0
- package/dist/createPrismic.js +69 -0
- package/dist/createPrismic.js.map +1 -0
- package/dist/globalExtensions.d.ts +11 -0
- package/dist/index.cjs +46 -764
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -1439
- package/dist/index.js +45 -707
- package/dist/index.js.map +1 -1
- package/dist/injectionSymbols.cjs +5 -0
- package/dist/injectionSymbols.cjs.map +1 -0
- package/dist/injectionSymbols.d.ts +9 -0
- package/dist/injectionSymbols.js +5 -0
- package/dist/injectionSymbols.js.map +1 -0
- package/dist/lib/__PRODUCTION__.cjs +8 -0
- package/dist/lib/__PRODUCTION__.cjs.map +1 -0
- package/dist/lib/__PRODUCTION__.d.ts +7 -0
- package/dist/lib/__PRODUCTION__.js +8 -0
- package/dist/lib/__PRODUCTION__.js.map +1 -0
- package/dist/lib/getSlots.cjs +19 -0
- package/dist/lib/getSlots.cjs.map +1 -0
- package/dist/lib/getSlots.d.ts +14 -0
- package/dist/lib/getSlots.js +19 -0
- package/dist/lib/getSlots.js.map +1 -0
- package/dist/lib/isInternalURL.cjs +9 -0
- package/dist/lib/isInternalURL.cjs.map +1 -0
- package/dist/lib/isInternalURL.d.ts +8 -0
- package/dist/lib/isInternalURL.js +9 -0
- package/dist/lib/isInternalURL.js.map +1 -0
- package/dist/lib/simplyResolveComponent.cjs +8 -0
- package/dist/lib/simplyResolveComponent.cjs.map +1 -0
- package/dist/lib/simplyResolveComponent.d.ts +12 -0
- package/dist/lib/simplyResolveComponent.js +8 -0
- package/dist/lib/simplyResolveComponent.js.map +1 -0
- package/dist/types.d.ts +357 -0
- package/dist/usePrismic.cjs +9 -0
- package/dist/usePrismic.cjs.map +1 -0
- package/dist/usePrismic.d.ts +21 -0
- package/dist/usePrismic.js +9 -0
- package/dist/usePrismic.js.map +1 -0
- package/dist/useStatefulPrismicClientMethod.cjs +36 -0
- package/dist/useStatefulPrismicClientMethod.cjs.map +1 -0
- package/dist/useStatefulPrismicClientMethod.d.ts +64 -0
- package/dist/useStatefulPrismicClientMethod.js +36 -0
- package/dist/useStatefulPrismicClientMethod.js.map +1 -0
- package/package.json +22 -22
- package/src/components/PrismicImage.ts +2 -2
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const helpers = require("@prismicio/helpers");
|
|
5
|
+
const isInternalURL = require("../lib/isInternalURL.cjs");
|
|
6
|
+
const usePrismic = require("../usePrismic.cjs");
|
|
7
|
+
const simplyResolveComponent = require("../lib/simplyResolveComponent.cjs");
|
|
8
|
+
const getSlots = require("../lib/getSlots.cjs");
|
|
9
|
+
const defaultInternalComponent = "router-link";
|
|
10
|
+
const defaultExternalComponent = "a";
|
|
11
|
+
const defaultBlankTargetRelAttribute = "noopener noreferrer";
|
|
12
|
+
const usePrismicLink = (props) => {
|
|
13
|
+
const { options } = usePrismic.usePrismic();
|
|
14
|
+
const type = vue.computed(() => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const internalComponent = vue.unref(props.internalComponent) || ((_a = options.components) == null ? void 0 : _a.linkInternalComponent) || defaultInternalComponent;
|
|
17
|
+
const externalComponent = vue.unref(props.externalComponent) || ((_b = options.components) == null ? void 0 : _b.linkExternalComponent) || defaultExternalComponent;
|
|
18
|
+
return href.value && isInternalURL.isInternalURL(href.value) && !target.value ? internalComponent : externalComponent;
|
|
19
|
+
});
|
|
20
|
+
const href = vue.computed(() => {
|
|
21
|
+
const field = vue.unref(props.field);
|
|
22
|
+
const linkResolver = vue.unref(props.linkResolver) ?? options.linkResolver;
|
|
23
|
+
return helpers.asLink(field, linkResolver) ?? "";
|
|
24
|
+
});
|
|
25
|
+
const target = vue.computed(() => {
|
|
26
|
+
const field = vue.unref(props.field);
|
|
27
|
+
const target2 = vue.unref(props.target);
|
|
28
|
+
if (typeof target2 !== "undefined") {
|
|
29
|
+
return target2;
|
|
30
|
+
} else {
|
|
31
|
+
return field && "target" in field && field.target ? field.target : null;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const rel = vue.computed(() => {
|
|
35
|
+
var _a;
|
|
36
|
+
const rel2 = vue.unref(props.rel);
|
|
37
|
+
if (typeof rel2 !== "undefined") {
|
|
38
|
+
return rel2;
|
|
39
|
+
} else if (target.value === "_blank") {
|
|
40
|
+
const blankTargetRelAttribute = vue.unref(props.blankTargetRelAttribute);
|
|
41
|
+
if (typeof blankTargetRelAttribute !== "undefined") {
|
|
42
|
+
return blankTargetRelAttribute;
|
|
43
|
+
} else {
|
|
44
|
+
return typeof ((_a = options.components) == null ? void 0 : _a.linkBlankTargetRelAttribute) !== "undefined" ? options.components.linkBlankTargetRelAttribute : defaultBlankTargetRelAttribute;
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
type,
|
|
52
|
+
href,
|
|
53
|
+
target,
|
|
54
|
+
rel
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const PrismicLinkImpl = /* @__PURE__ */ vue.defineComponent({
|
|
58
|
+
name: "PrismicLink",
|
|
59
|
+
props: {
|
|
60
|
+
field: {
|
|
61
|
+
type: Object,
|
|
62
|
+
required: true
|
|
63
|
+
},
|
|
64
|
+
linkResolver: {
|
|
65
|
+
type: Function,
|
|
66
|
+
default: void 0,
|
|
67
|
+
required: false
|
|
68
|
+
},
|
|
69
|
+
target: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: void 0,
|
|
72
|
+
required: false
|
|
73
|
+
},
|
|
74
|
+
rel: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: void 0,
|
|
77
|
+
required: false
|
|
78
|
+
},
|
|
79
|
+
blankTargetRelAttribute: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: void 0,
|
|
82
|
+
required: false
|
|
83
|
+
},
|
|
84
|
+
internalComponent: {
|
|
85
|
+
type: [String, Object, Function],
|
|
86
|
+
default: void 0,
|
|
87
|
+
required: false
|
|
88
|
+
},
|
|
89
|
+
externalComponent: {
|
|
90
|
+
type: [String, Object, Function],
|
|
91
|
+
default: void 0,
|
|
92
|
+
required: false
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
setup(props, { slots }) {
|
|
96
|
+
if (!props.field) {
|
|
97
|
+
return () => null;
|
|
98
|
+
}
|
|
99
|
+
const { type, href, target, rel } = usePrismicLink(props);
|
|
100
|
+
return () => {
|
|
101
|
+
const parent = type.value === "a" ? "a" : simplyResolveComponent.simplyResolveComponent(type.value);
|
|
102
|
+
const computedSlots = getSlots.getSlots(parent, slots, vue.reactive({ href: href.value }));
|
|
103
|
+
if (typeof parent === "string") {
|
|
104
|
+
return vue.h(parent, { href: href.value, target: target.value, rel: rel.value }, computedSlots);
|
|
105
|
+
} else {
|
|
106
|
+
return vue.h(parent, { to: href.value }, computedSlots);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const PrismicLink = PrismicLinkImpl;
|
|
112
|
+
exports.PrismicLink = PrismicLink;
|
|
113
|
+
exports.PrismicLinkImpl = PrismicLinkImpl;
|
|
114
|
+
exports.usePrismicLink = usePrismicLink;
|
|
115
|
+
//# sourceMappingURL=PrismicLink.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicLink.cjs","sources":["../../../src/components/PrismicLink.ts"],"sourcesContent":["import {\n\tAllowedComponentProps,\n\tComponentCustomProps,\n\tdefineComponent,\n\th,\n\tPropType,\n\tVNodeProps,\n\tunref,\n\treactive,\n\tConcreteComponent,\n\tcomputed,\n\tComputedRef,\n} from \"vue\";\n\nimport { asLink, LinkResolverFunction } from \"@prismicio/helpers\";\nimport { LinkField, PrismicDocument } from \"@prismicio/types\";\n\nimport { isInternalURL } from \"../lib/isInternalURL\";\nimport { usePrismic } from \"../usePrismic\";\nimport { VueUseOptions } from \"../types\";\nimport { simplyResolveComponent } from \"../lib/simplyResolveComponent\";\nimport { getSlots } from \"../lib/getSlots\";\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 blank target URLs.\n */\nconst defaultBlankTargetRelAttribute = \"noopener noreferrer\";\n\n/**\n * Props for `<PrismicLink />`.\n */\nexport type PrismicLinkProps = {\n\t/**\n\t * The Prismic link field or document to render.\n\t */\n\tfield: LinkField | PrismicDocument;\n\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 * An explicit `target` attribute to apply to the rendered link.\n\t */\n\ttarget?: string | null;\n\n\t/**\n\t * An explicit `rel` attribute to apply to the rendered link.\n\t */\n\trel?: string | null;\n\n\t/**\n\t * Value of the `rel` attribute to use on links rendered with\n\t * `target=\"_blank\"`.\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `\"noopener noreferrer\"` otherwise.\n\t */\n\tblankTargetRelAttribute?: string | null;\n\n\t/**\n\t * An HTML tag name, a component, or a functional component used to render\n\t * 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 * @defaultValue The one provided to `@prismicio/vue` plugin if configured, {@link RouterLink} otherwise.\n\t */\n\tinternalComponent?: string | ConcreteComponent;\n\n\t/**\n\t * An HTML tag name, a component, or a functional component used to render\n\t * 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 * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `\"a\"` otherwise.\n\t */\n\texternalComponent?: string | ConcreteComponent;\n};\n\n/**\n * Options for {@link usePrismicLink}.\n */\nexport type UsePrismicLinkOptions = VueUseOptions<PrismicLinkProps>;\n\n/**\n * Return type of {@link usePrismicLink}.\n */\nexport type UsePrismicLinkReturnType = {\n\t/**\n\t * Suggested component to render for provided link field.\n\t */\n\ttype: ComputedRef<string | ConcreteComponent>;\n\n\t/**\n\t * Resolved anchor `href` value.\n\t */\n\thref: ComputedRef<string>;\n\n\t/**\n\t * Resolved anchor `target` value.\n\t */\n\ttarget: ComputedRef<string | null>;\n\n\t/**\n\t * Resolved anchor `rel` value.\n\t */\n\trel: ComputedRef<string | null>;\n};\n\n/**\n * A low level composable that returns resolved information about a Prismic link\n * field.\n *\n * @param props - {@link UsePrismicLinkOptions}\n *\n * @returns - Resolved link information {@link UsePrismicLinkReturnType}\n */\nexport const usePrismicLink = (\n\tprops: UsePrismicLinkOptions,\n): UsePrismicLinkReturnType => {\n\tconst { options } = usePrismic();\n\n\tconst type = computed(() => {\n\t\tconst internalComponent =\n\t\t\tunref(props.internalComponent) ||\n\t\t\toptions.components?.linkInternalComponent ||\n\t\t\tdefaultInternalComponent;\n\n\t\tconst externalComponent =\n\t\t\tunref(props.externalComponent) ||\n\t\t\toptions.components?.linkExternalComponent ||\n\t\t\tdefaultExternalComponent;\n\n\t\treturn href.value && isInternalURL(href.value) && !target.value\n\t\t\t? internalComponent\n\t\t\t: externalComponent;\n\t});\n\tconst href = computed(() => {\n\t\tconst field = unref(props.field);\n\t\tconst linkResolver = unref(props.linkResolver) ?? options.linkResolver;\n\n\t\treturn asLink(field, linkResolver) ?? \"\";\n\t});\n\tconst target = computed(() => {\n\t\tconst field = unref(props.field);\n\t\tconst target = unref(props.target);\n\n\t\tif (typeof target !== \"undefined\") {\n\t\t\treturn target;\n\t\t} else {\n\t\t\treturn field && \"target\" in field && field.target ? field.target : null;\n\t\t}\n\t});\n\tconst rel = computed(() => {\n\t\tconst rel = unref(props.rel);\n\n\t\tif (typeof rel !== \"undefined\") {\n\t\t\treturn rel;\n\t\t} else if (target.value === \"_blank\") {\n\t\t\tconst blankTargetRelAttribute = unref(props.blankTargetRelAttribute);\n\n\t\t\tif (typeof blankTargetRelAttribute !== \"undefined\") {\n\t\t\t\treturn blankTargetRelAttribute;\n\t\t\t} else {\n\t\t\t\treturn typeof options.components?.linkBlankTargetRelAttribute !==\n\t\t\t\t\t\"undefined\"\n\t\t\t\t\t? options.components.linkBlankTargetRelAttribute\n\t\t\t\t\t: defaultBlankTargetRelAttribute;\n\t\t\t}\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t});\n\n\treturn {\n\t\ttype,\n\t\thref,\n\t\ttarget,\n\t\trel,\n\t};\n};\n\n/**\n * `<PrismicLink />` implementation.\n *\n * @internal\n */\nexport const PrismicLinkImpl = /*#__PURE__*/ defineComponent({\n\tname: \"PrismicLink\",\n\tprops: {\n\t\tfield: {\n\t\t\ttype: Object as PropType<LinkField | PrismicDocument>,\n\t\t\trequired: true,\n\t\t},\n\t\tlinkResolver: {\n\t\t\ttype: Function as PropType<LinkResolverFunction>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\ttarget: {\n\t\t\ttype: String as PropType<string | null>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\trel: {\n\t\t\ttype: String as PropType<string | null>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tblankTargetRelAttribute: {\n\t\t\ttype: String as PropType<string | null>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tinternalComponent: {\n\t\t\ttype: [String, Object, Function] as PropType<string | ConcreteComponent>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\texternalComponent: {\n\t\t\ttype: [String, Object, Function] as PropType<string | ConcreteComponent>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\t// Prevent fatal if user didn't check for field, throws `Invalid prop` warn\n\t\tif (!props.field) {\n\t\t\treturn () => null;\n\t\t}\n\n\t\tconst { type, href, target, rel } = usePrismicLink(props);\n\n\t\treturn () => {\n\t\t\tconst parent =\n\t\t\t\ttype.value === \"a\" ? \"a\" : simplyResolveComponent(type.value);\n\t\t\tconst computedSlots = getSlots(\n\t\t\t\tparent,\n\t\t\t\tslots,\n\t\t\t\treactive({ href: href.value }),\n\t\t\t);\n\n\t\t\tif (typeof parent === \"string\") {\n\t\t\t\t// Fitting anchor tag interface\n\t\t\t\treturn h(\n\t\t\t\t\tparent,\n\t\t\t\t\t{ href: href.value, target: target.value, rel: rel.value },\n\t\t\t\t\tcomputedSlots,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Fitting Vue Router Link interface\n\t\t\t\treturn h(parent, { to: href.value }, computedSlots);\n\t\t\t}\n\t\t};\n\t},\n});\n\n// export the public type for h/tsx inference\n// also to avoid inline import() in generated d.ts files\n/**\n * Component to render a Prismic link field.\n *\n * @see Component props {@link PrismicLinkProps}\n * @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships}\n */\nexport const PrismicLink = PrismicLinkImpl as unknown as {\n\tnew (): {\n\t\t$props: AllowedComponentProps &\n\t\t\tComponentCustomProps &\n\t\t\tVNodeProps &\n\t\t\tPrismicLinkProps;\n\t};\n};\n"],"names":["usePrismic","computed","unref","isInternalURL","asLink","target","rel","defineComponent","simplyResolveComponent","getSlots","reactive","h"],"mappings":";;;;;;;;AA0BA,MAAM,2BAA2B;AAKjC,MAAM,2BAA2B;AAKjC,MAAM,iCAAiC;AA0G1B,MAAA,iBAAiB,CAC7B,UAC6B;AACvB,QAAA,EAAE,YAAYA,WAAAA;AAEd,QAAA,OAAOC,IAAAA,SAAS,MAAK;;AAC1B,UAAM,oBACLC,IAAM,MAAA,MA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;AACA,CAAA;AAUM,MAAM,cAAc;;;;"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { AllowedComponentProps, ComponentCustomProps, PropType, VNodeProps, ConcreteComponent, ComputedRef } from "vue";
|
|
2
|
+
import { LinkResolverFunction } from "@prismicio/helpers";
|
|
3
|
+
import { LinkField, PrismicDocument } from "@prismicio/types";
|
|
4
|
+
import { VueUseOptions } from "../types";
|
|
5
|
+
/**
|
|
6
|
+
* Props for `<PrismicLink />`.
|
|
7
|
+
*/
|
|
8
|
+
export type PrismicLinkProps = {
|
|
9
|
+
/**
|
|
10
|
+
* The Prismic link field or document to render.
|
|
11
|
+
*/
|
|
12
|
+
field: LinkField | PrismicDocument;
|
|
13
|
+
/**
|
|
14
|
+
* A link resolver function used to resolve links when not using the route
|
|
15
|
+
* resolver parameter with `@prismicio/client`.
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue The link resolver provided to `@prismicio/vue` plugin if configured.
|
|
18
|
+
*
|
|
19
|
+
* @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}
|
|
20
|
+
*/
|
|
21
|
+
linkResolver?: LinkResolverFunction;
|
|
22
|
+
/**
|
|
23
|
+
* An explicit `target` attribute to apply to the rendered link.
|
|
24
|
+
*/
|
|
25
|
+
target?: string | null;
|
|
26
|
+
/**
|
|
27
|
+
* An explicit `rel` attribute to apply to the rendered link.
|
|
28
|
+
*/
|
|
29
|
+
rel?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Value of the `rel` attribute to use on links rendered with
|
|
32
|
+
* `target="_blank"`.
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue The one provided to `@prismicio/vue` plugin if configured, `"noopener noreferrer"` otherwise.
|
|
35
|
+
*/
|
|
36
|
+
blankTargetRelAttribute?: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* An HTML tag name, a component, or a functional component used to render
|
|
39
|
+
* internal links.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
43
|
+
* `target`, and `rel` attributes).
|
|
44
|
+
* @remarks
|
|
45
|
+
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
46
|
+
* (`to` props).
|
|
47
|
+
* @defaultValue The one provided to `@prismicio/vue` plugin if configured, {@link RouterLink} otherwise.
|
|
48
|
+
*/
|
|
49
|
+
internalComponent?: string | ConcreteComponent;
|
|
50
|
+
/**
|
|
51
|
+
* An HTML tag name, a component, or a functional component used to render
|
|
52
|
+
* external links.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
56
|
+
* `target`, and `rel` attributes).
|
|
57
|
+
* @remarks
|
|
58
|
+
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
59
|
+
* (`to` props).
|
|
60
|
+
* @defaultValue The one provided to `@prismicio/vue` plugin if configured, `"a"` otherwise.
|
|
61
|
+
*/
|
|
62
|
+
externalComponent?: string | ConcreteComponent;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Options for {@link usePrismicLink}.
|
|
66
|
+
*/
|
|
67
|
+
export type UsePrismicLinkOptions = VueUseOptions<PrismicLinkProps>;
|
|
68
|
+
/**
|
|
69
|
+
* Return type of {@link usePrismicLink}.
|
|
70
|
+
*/
|
|
71
|
+
export type UsePrismicLinkReturnType = {
|
|
72
|
+
/**
|
|
73
|
+
* Suggested component to render for provided link field.
|
|
74
|
+
*/
|
|
75
|
+
type: ComputedRef<string | ConcreteComponent>;
|
|
76
|
+
/**
|
|
77
|
+
* Resolved anchor `href` value.
|
|
78
|
+
*/
|
|
79
|
+
href: ComputedRef<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Resolved anchor `target` value.
|
|
82
|
+
*/
|
|
83
|
+
target: ComputedRef<string | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Resolved anchor `rel` value.
|
|
86
|
+
*/
|
|
87
|
+
rel: ComputedRef<string | null>;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* A low level composable that returns resolved information about a Prismic link
|
|
91
|
+
* field.
|
|
92
|
+
*
|
|
93
|
+
* @param props - {@link UsePrismicLinkOptions}
|
|
94
|
+
*
|
|
95
|
+
* @returns - Resolved link information {@link UsePrismicLinkReturnType}
|
|
96
|
+
*/
|
|
97
|
+
export declare const usePrismicLink: (props: UsePrismicLinkOptions) => UsePrismicLinkReturnType;
|
|
98
|
+
/**
|
|
99
|
+
* `<PrismicLink />` implementation.
|
|
100
|
+
*
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
export declare const PrismicLinkImpl: import("vue").DefineComponent<{
|
|
104
|
+
field: {
|
|
105
|
+
type: PropType<import("@prismicio/types").FilledContentRelationshipField<string, string, unknown> | import("@prismicio/types").EmptyLinkField<"Any"> | import("@prismicio/types").FilledLinkToWebField | import("@prismicio/types").FilledLinkToMediaField | PrismicDocument<Record<string, any>, string, string>>;
|
|
106
|
+
required: true;
|
|
107
|
+
};
|
|
108
|
+
linkResolver: {
|
|
109
|
+
type: PropType<LinkResolverFunction<string>>;
|
|
110
|
+
default: undefined;
|
|
111
|
+
required: false;
|
|
112
|
+
};
|
|
113
|
+
target: {
|
|
114
|
+
type: PropType<string | null>;
|
|
115
|
+
default: undefined;
|
|
116
|
+
required: false;
|
|
117
|
+
};
|
|
118
|
+
rel: {
|
|
119
|
+
type: PropType<string | null>;
|
|
120
|
+
default: undefined;
|
|
121
|
+
required: false;
|
|
122
|
+
};
|
|
123
|
+
blankTargetRelAttribute: {
|
|
124
|
+
type: PropType<string | null>;
|
|
125
|
+
default: undefined;
|
|
126
|
+
required: false;
|
|
127
|
+
};
|
|
128
|
+
internalComponent: {
|
|
129
|
+
type: PropType<string | ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>;
|
|
130
|
+
default: undefined;
|
|
131
|
+
required: false;
|
|
132
|
+
};
|
|
133
|
+
externalComponent: {
|
|
134
|
+
type: PropType<string | ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>;
|
|
135
|
+
default: undefined;
|
|
136
|
+
required: false;
|
|
137
|
+
};
|
|
138
|
+
}, (() => null) | (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
139
|
+
[key: string]: any;
|
|
140
|
+
}>), unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
141
|
+
field: {
|
|
142
|
+
type: PropType<import("@prismicio/types").FilledContentRelationshipField<string, string, unknown> | import("@prismicio/types").EmptyLinkField<"Any"> | import("@prismicio/types").FilledLinkToWebField | import("@prismicio/types").FilledLinkToMediaField | PrismicDocument<Record<string, any>, string, string>>;
|
|
143
|
+
required: true;
|
|
144
|
+
};
|
|
145
|
+
linkResolver: {
|
|
146
|
+
type: PropType<LinkResolverFunction<string>>;
|
|
147
|
+
default: undefined;
|
|
148
|
+
required: false;
|
|
149
|
+
};
|
|
150
|
+
target: {
|
|
151
|
+
type: PropType<string | null>;
|
|
152
|
+
default: undefined;
|
|
153
|
+
required: false;
|
|
154
|
+
};
|
|
155
|
+
rel: {
|
|
156
|
+
type: PropType<string | null>;
|
|
157
|
+
default: undefined;
|
|
158
|
+
required: false;
|
|
159
|
+
};
|
|
160
|
+
blankTargetRelAttribute: {
|
|
161
|
+
type: PropType<string | null>;
|
|
162
|
+
default: undefined;
|
|
163
|
+
required: false;
|
|
164
|
+
};
|
|
165
|
+
internalComponent: {
|
|
166
|
+
type: PropType<string | ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>;
|
|
167
|
+
default: undefined;
|
|
168
|
+
required: false;
|
|
169
|
+
};
|
|
170
|
+
externalComponent: {
|
|
171
|
+
type: PropType<string | ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>;
|
|
172
|
+
default: undefined;
|
|
173
|
+
required: false;
|
|
174
|
+
};
|
|
175
|
+
}>>, {
|
|
176
|
+
target: string | null;
|
|
177
|
+
linkResolver: LinkResolverFunction<string>;
|
|
178
|
+
rel: string | null;
|
|
179
|
+
blankTargetRelAttribute: string | null;
|
|
180
|
+
internalComponent: string | ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
181
|
+
externalComponent: string | ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
182
|
+
}>;
|
|
183
|
+
/**
|
|
184
|
+
* Component to render a Prismic link field.
|
|
185
|
+
*
|
|
186
|
+
* @see Component props {@link PrismicLinkProps}
|
|
187
|
+
* @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships}
|
|
188
|
+
*/
|
|
189
|
+
export declare const PrismicLink: new () => {
|
|
190
|
+
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & PrismicLinkProps;
|
|
191
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { computed, unref, defineComponent, reactive, h } from "vue";
|
|
2
|
+
import { asLink } from "@prismicio/helpers";
|
|
3
|
+
import { isInternalURL } from "../lib/isInternalURL.js";
|
|
4
|
+
import { usePrismic } from "../usePrismic.js";
|
|
5
|
+
import { simplyResolveComponent } from "../lib/simplyResolveComponent.js";
|
|
6
|
+
import { getSlots } from "../lib/getSlots.js";
|
|
7
|
+
const defaultInternalComponent = "router-link";
|
|
8
|
+
const defaultExternalComponent = "a";
|
|
9
|
+
const defaultBlankTargetRelAttribute = "noopener noreferrer";
|
|
10
|
+
const usePrismicLink = (props) => {
|
|
11
|
+
const { options } = usePrismic();
|
|
12
|
+
const type = computed(() => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const internalComponent = unref(props.internalComponent) || ((_a = options.components) == null ? void 0 : _a.linkInternalComponent) || defaultInternalComponent;
|
|
15
|
+
const externalComponent = unref(props.externalComponent) || ((_b = options.components) == null ? void 0 : _b.linkExternalComponent) || defaultExternalComponent;
|
|
16
|
+
return href.value && isInternalURL(href.value) && !target.value ? internalComponent : externalComponent;
|
|
17
|
+
});
|
|
18
|
+
const href = computed(() => {
|
|
19
|
+
const field = unref(props.field);
|
|
20
|
+
const linkResolver = unref(props.linkResolver) ?? options.linkResolver;
|
|
21
|
+
return asLink(field, linkResolver) ?? "";
|
|
22
|
+
});
|
|
23
|
+
const target = computed(() => {
|
|
24
|
+
const field = unref(props.field);
|
|
25
|
+
const target2 = unref(props.target);
|
|
26
|
+
if (typeof target2 !== "undefined") {
|
|
27
|
+
return target2;
|
|
28
|
+
} else {
|
|
29
|
+
return field && "target" in field && field.target ? field.target : null;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const rel = computed(() => {
|
|
33
|
+
var _a;
|
|
34
|
+
const rel2 = unref(props.rel);
|
|
35
|
+
if (typeof rel2 !== "undefined") {
|
|
36
|
+
return rel2;
|
|
37
|
+
} else if (target.value === "_blank") {
|
|
38
|
+
const blankTargetRelAttribute = unref(props.blankTargetRelAttribute);
|
|
39
|
+
if (typeof blankTargetRelAttribute !== "undefined") {
|
|
40
|
+
return blankTargetRelAttribute;
|
|
41
|
+
} else {
|
|
42
|
+
return typeof ((_a = options.components) == null ? void 0 : _a.linkBlankTargetRelAttribute) !== "undefined" ? options.components.linkBlankTargetRelAttribute : defaultBlankTargetRelAttribute;
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
type,
|
|
50
|
+
href,
|
|
51
|
+
target,
|
|
52
|
+
rel
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const PrismicLinkImpl = /* @__PURE__ */ defineComponent({
|
|
56
|
+
name: "PrismicLink",
|
|
57
|
+
props: {
|
|
58
|
+
field: {
|
|
59
|
+
type: Object,
|
|
60
|
+
required: true
|
|
61
|
+
},
|
|
62
|
+
linkResolver: {
|
|
63
|
+
type: Function,
|
|
64
|
+
default: void 0,
|
|
65
|
+
required: false
|
|
66
|
+
},
|
|
67
|
+
target: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: void 0,
|
|
70
|
+
required: false
|
|
71
|
+
},
|
|
72
|
+
rel: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: void 0,
|
|
75
|
+
required: false
|
|
76
|
+
},
|
|
77
|
+
blankTargetRelAttribute: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: void 0,
|
|
80
|
+
required: false
|
|
81
|
+
},
|
|
82
|
+
internalComponent: {
|
|
83
|
+
type: [String, Object, Function],
|
|
84
|
+
default: void 0,
|
|
85
|
+
required: false
|
|
86
|
+
},
|
|
87
|
+
externalComponent: {
|
|
88
|
+
type: [String, Object, Function],
|
|
89
|
+
default: void 0,
|
|
90
|
+
required: false
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
setup(props, { slots }) {
|
|
94
|
+
if (!props.field) {
|
|
95
|
+
return () => null;
|
|
96
|
+
}
|
|
97
|
+
const { type, href, target, rel } = usePrismicLink(props);
|
|
98
|
+
return () => {
|
|
99
|
+
const parent = type.value === "a" ? "a" : simplyResolveComponent(type.value);
|
|
100
|
+
const computedSlots = getSlots(parent, slots, reactive({ href: href.value }));
|
|
101
|
+
if (typeof parent === "string") {
|
|
102
|
+
return h(parent, { href: href.value, target: target.value, rel: rel.value }, computedSlots);
|
|
103
|
+
} else {
|
|
104
|
+
return h(parent, { to: href.value }, computedSlots);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const PrismicLink = PrismicLinkImpl;
|
|
110
|
+
export {
|
|
111
|
+
PrismicLink,
|
|
112
|
+
PrismicLinkImpl,
|
|
113
|
+
usePrismicLink
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=PrismicLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicLink.js","sources":["../../../src/components/PrismicLink.ts"],"sourcesContent":["import {\n\tAllowedComponentProps,\n\tComponentCustomProps,\n\tdefineComponent,\n\th,\n\tPropType,\n\tVNodeProps,\n\tunref,\n\treactive,\n\tConcreteComponent,\n\tcomputed,\n\tComputedRef,\n} from \"vue\";\n\nimport { asLink, LinkResolverFunction } from \"@prismicio/helpers\";\nimport { LinkField, PrismicDocument } from \"@prismicio/types\";\n\nimport { isInternalURL } from \"../lib/isInternalURL\";\nimport { usePrismic } from \"../usePrismic\";\nimport { VueUseOptions } from \"../types\";\nimport { simplyResolveComponent } from \"../lib/simplyResolveComponent\";\nimport { getSlots } from \"../lib/getSlots\";\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 blank target URLs.\n */\nconst defaultBlankTargetRelAttribute = \"noopener noreferrer\";\n\n/**\n * Props for `<PrismicLink />`.\n */\nexport type PrismicLinkProps = {\n\t/**\n\t * The Prismic link field or document to render.\n\t */\n\tfield: LinkField | PrismicDocument;\n\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 * An explicit `target` attribute to apply to the rendered link.\n\t */\n\ttarget?: string | null;\n\n\t/**\n\t * An explicit `rel` attribute to apply to the rendered link.\n\t */\n\trel?: string | null;\n\n\t/**\n\t * Value of the `rel` attribute to use on links rendered with\n\t * `target=\"_blank\"`.\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `\"noopener noreferrer\"` otherwise.\n\t */\n\tblankTargetRelAttribute?: string | null;\n\n\t/**\n\t * An HTML tag name, a component, or a functional component used to render\n\t * 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 * @defaultValue The one provided to `@prismicio/vue` plugin if configured, {@link RouterLink} otherwise.\n\t */\n\tinternalComponent?: string | ConcreteComponent;\n\n\t/**\n\t * An HTML tag name, a component, or a functional component used to render\n\t * 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 * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `\"a\"` otherwise.\n\t */\n\texternalComponent?: string | ConcreteComponent;\n};\n\n/**\n * Options for {@link usePrismicLink}.\n */\nexport type UsePrismicLinkOptions = VueUseOptions<PrismicLinkProps>;\n\n/**\n * Return type of {@link usePrismicLink}.\n */\nexport type UsePrismicLinkReturnType = {\n\t/**\n\t * Suggested component to render for provided link field.\n\t */\n\ttype: ComputedRef<string | ConcreteComponent>;\n\n\t/**\n\t * Resolved anchor `href` value.\n\t */\n\thref: ComputedRef<string>;\n\n\t/**\n\t * Resolved anchor `target` value.\n\t */\n\ttarget: ComputedRef<string | null>;\n\n\t/**\n\t * Resolved anchor `rel` value.\n\t */\n\trel: ComputedRef<string | null>;\n};\n\n/**\n * A low level composable that returns resolved information about a Prismic link\n * field.\n *\n * @param props - {@link UsePrismicLinkOptions}\n *\n * @returns - Resolved link information {@link UsePrismicLinkReturnType}\n */\nexport const usePrismicLink = (\n\tprops: UsePrismicLinkOptions,\n): UsePrismicLinkReturnType => {\n\tconst { options } = usePrismic();\n\n\tconst type = computed(() => {\n\t\tconst internalComponent =\n\t\t\tunref(props.internalComponent) ||\n\t\t\toptions.components?.linkInternalComponent ||\n\t\t\tdefaultInternalComponent;\n\n\t\tconst externalComponent =\n\t\t\tunref(props.externalComponent) ||\n\t\t\toptions.components?.linkExternalComponent ||\n\t\t\tdefaultExternalComponent;\n\n\t\treturn href.value && isInternalURL(href.value) && !target.value\n\t\t\t? internalComponent\n\t\t\t: externalComponent;\n\t});\n\tconst href = computed(() => {\n\t\tconst field = unref(props.field);\n\t\tconst linkResolver = unref(props.linkResolver) ?? options.linkResolver;\n\n\t\treturn asLink(field, linkResolver) ?? \"\";\n\t});\n\tconst target = computed(() => {\n\t\tconst field = unref(props.field);\n\t\tconst target = unref(props.target);\n\n\t\tif (typeof target !== \"undefined\") {\n\t\t\treturn target;\n\t\t} else {\n\t\t\treturn field && \"target\" in field && field.target ? field.target : null;\n\t\t}\n\t});\n\tconst rel = computed(() => {\n\t\tconst rel = unref(props.rel);\n\n\t\tif (typeof rel !== \"undefined\") {\n\t\t\treturn rel;\n\t\t} else if (target.value === \"_blank\") {\n\t\t\tconst blankTargetRelAttribute = unref(props.blankTargetRelAttribute);\n\n\t\t\tif (typeof blankTargetRelAttribute !== \"undefined\") {\n\t\t\t\treturn blankTargetRelAttribute;\n\t\t\t} else {\n\t\t\t\treturn typeof options.components?.linkBlankTargetRelAttribute !==\n\t\t\t\t\t\"undefined\"\n\t\t\t\t\t? options.components.linkBlankTargetRelAttribute\n\t\t\t\t\t: defaultBlankTargetRelAttribute;\n\t\t\t}\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t});\n\n\treturn {\n\t\ttype,\n\t\thref,\n\t\ttarget,\n\t\trel,\n\t};\n};\n\n/**\n * `<PrismicLink />` implementation.\n *\n * @internal\n */\nexport const PrismicLinkImpl = /*#__PURE__*/ defineComponent({\n\tname: \"PrismicLink\",\n\tprops: {\n\t\tfield: {\n\t\t\ttype: Object as PropType<LinkField | PrismicDocument>,\n\t\t\trequired: true,\n\t\t},\n\t\tlinkResolver: {\n\t\t\ttype: Function as PropType<LinkResolverFunction>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\ttarget: {\n\t\t\ttype: String as PropType<string | null>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\trel: {\n\t\t\ttype: String as PropType<string | null>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tblankTargetRelAttribute: {\n\t\t\ttype: String as PropType<string | null>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tinternalComponent: {\n\t\t\ttype: [String, Object, Function] as PropType<string | ConcreteComponent>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\texternalComponent: {\n\t\t\ttype: [String, Object, Function] as PropType<string | ConcreteComponent>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\t// Prevent fatal if user didn't check for field, throws `Invalid prop` warn\n\t\tif (!props.field) {\n\t\t\treturn () => null;\n\t\t}\n\n\t\tconst { type, href, target, rel } = usePrismicLink(props);\n\n\t\treturn () => {\n\t\t\tconst parent =\n\t\t\t\ttype.value === \"a\" ? \"a\" : simplyResolveComponent(type.value);\n\t\t\tconst computedSlots = getSlots(\n\t\t\t\tparent,\n\t\t\t\tslots,\n\t\t\t\treactive({ href: href.value }),\n\t\t\t);\n\n\t\t\tif (typeof parent === \"string\") {\n\t\t\t\t// Fitting anchor tag interface\n\t\t\t\treturn h(\n\t\t\t\t\tparent,\n\t\t\t\t\t{ href: href.value, target: target.value, rel: rel.value },\n\t\t\t\t\tcomputedSlots,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Fitting Vue Router Link interface\n\t\t\t\treturn h(parent, { to: href.value }, computedSlots);\n\t\t\t}\n\t\t};\n\t},\n});\n\n// export the public type for h/tsx inference\n// also to avoid inline import() in generated d.ts files\n/**\n * Component to render a Prismic link field.\n *\n * @see Component props {@link PrismicLinkProps}\n * @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships}\n */\nexport const PrismicLink = PrismicLinkImpl as unknown as {\n\t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MAAM,KAAK,OAAO,QAAQ,OAAO,OAAO,KAAK,IAAI,SACnD,aAAa;AAAA,MAAA,OAER;AAEN,eAAO,EAAE,QAAQ,EAAE,IAAI,KAAK,MAAA,GAAS,aAAa;AAAA,MAClD;AAAA,IAAA;AAAA,EAEH;AACA,CAAA;AAUM,MAAM,cAAc;"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const vueRouter = require("vue-router");
|
|
5
|
+
const helpers = require("@prismicio/helpers");
|
|
6
|
+
const usePrismic = require("../usePrismic.cjs");
|
|
7
|
+
const simplyResolveComponent = require("../lib/simplyResolveComponent.cjs");
|
|
8
|
+
const isInternalURL = require("../lib/isInternalURL.cjs");
|
|
9
|
+
const defaultWrapper = "div";
|
|
10
|
+
const usePrismicRichText = (props) => {
|
|
11
|
+
const { options } = usePrismic.usePrismic();
|
|
12
|
+
const html = vue.computed(() => {
|
|
13
|
+
const field = vue.unref(props.field);
|
|
14
|
+
if (!helpers.isFilled.richText(field)) {
|
|
15
|
+
return vue.unref(props.fallback) ?? "";
|
|
16
|
+
}
|
|
17
|
+
const linkResolver = vue.unref(props.linkResolver) ?? options.linkResolver;
|
|
18
|
+
const htmlSerializer = vue.unref(props.htmlSerializer) ?? options.htmlSerializer;
|
|
19
|
+
return helpers.asHTML(vue.unref(field), linkResolver, htmlSerializer);
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
html
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const PrismicRichTextImpl = /* @__PURE__ */ vue.defineComponent({
|
|
26
|
+
name: "PrismicRichText",
|
|
27
|
+
props: {
|
|
28
|
+
field: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: void 0,
|
|
31
|
+
required: false
|
|
32
|
+
},
|
|
33
|
+
linkResolver: {
|
|
34
|
+
type: Function,
|
|
35
|
+
default: void 0,
|
|
36
|
+
required: false
|
|
37
|
+
},
|
|
38
|
+
htmlSerializer: {
|
|
39
|
+
type: [Function, Object],
|
|
40
|
+
default: void 0,
|
|
41
|
+
required: false
|
|
42
|
+
},
|
|
43
|
+
wrapper: {
|
|
44
|
+
type: [String, Object, Function],
|
|
45
|
+
default: void 0,
|
|
46
|
+
required: false
|
|
47
|
+
},
|
|
48
|
+
fallback: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: void 0,
|
|
51
|
+
required: false
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
setup(props) {
|
|
55
|
+
const { html } = usePrismicRichText(props);
|
|
56
|
+
const root = vue.ref(null);
|
|
57
|
+
const maybeRouter = vue.inject(vueRouter.routerKey, null);
|
|
58
|
+
if (maybeRouter) {
|
|
59
|
+
let links = [];
|
|
60
|
+
const navigate = function(event) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
maybeRouter.push(this.href);
|
|
63
|
+
};
|
|
64
|
+
const addListeners = () => {
|
|
65
|
+
const node = root.value && "$el" in root.value ? root.value.$el : root.value;
|
|
66
|
+
if (node && "querySelectorAll" in node) {
|
|
67
|
+
links = Array.from(node.querySelectorAll("a")).map((element) => {
|
|
68
|
+
const href = element.getAttribute("href");
|
|
69
|
+
if (href && isInternalURL.isInternalURL(href)) {
|
|
70
|
+
const listener = navigate.bind({ href });
|
|
71
|
+
element.addEventListener("click", listener);
|
|
72
|
+
return { element, listener };
|
|
73
|
+
} else {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}).filter((link) => link);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const removeListeners = () => {
|
|
80
|
+
links.forEach(({ element, listener }) => element.removeEventListener("click", listener));
|
|
81
|
+
links = [];
|
|
82
|
+
};
|
|
83
|
+
vue.watch(html, () => {
|
|
84
|
+
removeListeners();
|
|
85
|
+
vue.nextTick(addListeners);
|
|
86
|
+
}, { immediate: true });
|
|
87
|
+
vue.onBeforeUnmount(() => {
|
|
88
|
+
removeListeners();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return () => {
|
|
92
|
+
return vue.h(simplyResolveComponent.simplyResolveComponent(props.wrapper || defaultWrapper), {
|
|
93
|
+
innerHTML: html.value,
|
|
94
|
+
ref: root
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
const PrismicRichText = PrismicRichTextImpl;
|
|
100
|
+
exports.PrismicRichText = PrismicRichText;
|
|
101
|
+
exports.PrismicRichTextImpl = PrismicRichTextImpl;
|
|
102
|
+
exports.usePrismicRichText = usePrismicRichText;
|
|
103
|
+
//# sourceMappingURL=PrismicRichText.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismicRichText.cjs","sources":["../../../src/components/PrismicRichText.ts"],"sourcesContent":["import {\n\tAllowedComponentProps,\n\tComponent,\n\tComponentCustomProps,\n\tcomputed,\n\tComputedRef,\n\tConcreteComponent,\n\tdefineComponent,\n\th,\n\tinject,\n\tnextTick,\n\tonBeforeUnmount,\n\tPropType,\n\tref,\n\tunref,\n\tVNodeProps,\n\twatch,\n} from \"vue\";\nimport { routerKey } from \"vue-router\";\n\nimport {\n\tasHTML,\n\tHTMLFunctionSerializer,\n\tHTMLMapSerializer,\n\tisFilled,\n\tLinkResolverFunction,\n} from \"@prismicio/helpers\";\nimport { RichTextField } from \"@prismicio/types\";\n\nimport { VueUseOptions } from \"../types\";\nimport { usePrismic } from \"../usePrismic\";\nimport { simplyResolveComponent } from \"../lib/simplyResolveComponent\";\nimport { isInternalURL } from \"../lib/isInternalURL\";\n\n/**\n * The default component rendered to wrap the HTML output.\n */\nconst defaultWrapper = \"div\";\n\n/**\n * Props for `<PrismicRichText />`.\n */\nexport type PrismicRichTextProps = {\n\t/**\n\t * The Prismic rich text or title field to render.\n\t */\n\tfield: RichTextField | null | undefined;\n\n\t/**\n\t * A link resolver function used to resolve link 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 * An HTML serializer to customize the way rich text fields are rendered.\n\t *\n\t * @defaultValue The HTML serializer provided to `@prismicio/vue` plugin if configured.\n\t *\n\t * @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}\n\t */\n\thtmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;\n\n\t/**\n\t * An HTML tag name, a component, or a functional component used to wrap the\n\t * output.\n\t *\n\t * @defaultValue `\"div\"`\n\t */\n\twrapper?: string | ConcreteComponent;\n\n\t/**\n\t * The HTML value to be rendered when the field is empty. If a fallback is not\n\t * given, `\"\"` (nothing) will be rendered.\n\t */\n\tfallback?: string;\n};\n\n/**\n * Options for {@link usePrismicRichText}.\n */\nexport type UsePrismicRichTextOptions = VueUseOptions<\n\tOmit<PrismicRichTextProps, \"wrapper\">\n>;\n\n/**\n * Return type of {@link usePrismicRichText}.\n */\nexport type UsePrismicRichTextReturnType = {\n\t/**\n\t * Serialized rich text field as HTML.\n\t */\n\thtml: ComputedRef<string>;\n};\n\n/**\n * A low level composable that returns a serialized rich text field as HTML.\n *\n * @param props - {@link UsePrismicRichTextOptions}\n *\n * @returns - Serialized rich text field as HTML\n * {@link UsePrismicRichTextReturnType}\n */\nexport const usePrismicRichText = (\n\tprops: UsePrismicRichTextOptions,\n): UsePrismicRichTextReturnType => {\n\tconst { options } = usePrismic();\n\n\tconst html = computed(() => {\n\t\tconst field = unref(props.field);\n\n\t\tif (!isFilled.richText(field)) {\n\t\t\treturn unref(props.fallback) ?? \"\";\n\t\t}\n\n\t\tconst linkResolver = unref(props.linkResolver) ?? options.linkResolver;\n\t\tconst htmlSerializer =\n\t\t\tunref(props.htmlSerializer) ?? options.htmlSerializer;\n\n\t\treturn asHTML(unref(field), linkResolver, htmlSerializer);\n\t});\n\n\treturn {\n\t\thtml,\n\t};\n};\n\n/**\n * `<PrismicRichText />` implementation.\n *\n * @internal\n */\nexport const PrismicRichTextImpl = /*#__PURE__*/ defineComponent({\n\tname: \"PrismicRichText\",\n\tprops: {\n\t\tfield: {\n\t\t\ttype: Array as unknown as PropType<RichTextField | null | undefined>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tlinkResolver: {\n\t\t\ttype: Function as PropType<LinkResolverFunction>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\thtmlSerializer: {\n\t\t\ttype: [Function, Object] as PropType<\n\t\t\t\tHTMLFunctionSerializer | HTMLMapSerializer\n\t\t\t>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\twrapper: {\n\t\t\ttype: [String, Object, Function] as PropType<string | ConcreteComponent>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tfallback: {\n\t\t\ttype: String as PropType<string>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t},\n\tsetup(props) {\n\t\tconst { html } = usePrismicRichText(props);\n\n\t\tconst root = ref<HTMLElement | Comment | Component | null>(null);\n\n\t\tconst maybeRouter = inject(routerKey, null);\n\t\tif (maybeRouter) {\n\t\t\ttype InternalLink = {\n\t\t\t\telement: HTMLAnchorElement;\n\t\t\t\tlistener: EventListener;\n\t\t\t};\n\t\t\tlet links: InternalLink[] = [];\n\n\t\t\tconst navigate: EventListener = function (\n\t\t\t\tthis: { href: string },\n\t\t\t\tevent: Event,\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tmaybeRouter.push(this.href);\n\t\t\t};\n\n\t\t\tconst addListeners = () => {\n\t\t\t\tconst node: HTMLElement | Comment | null =\n\t\t\t\t\troot.value && \"$el\" in root.value ? root.value.$el : root.value;\n\t\t\t\tif (node && \"querySelectorAll\" in node) {\n\t\t\t\t\t// Get all internal link tags and add listeners on them\n\t\t\t\t\tlinks = Array.from(node.querySelectorAll(\"a\"))\n\t\t\t\t\t\t.map((element) => {\n\t\t\t\t\t\t\tconst href = element.getAttribute(\"href\");\n\n\t\t\t\t\t\t\tif (href && isInternalURL(href)) {\n\t\t\t\t\t\t\t\tconst listener = navigate.bind({ href });\n\t\t\t\t\t\t\t\telement.addEventListener(\"click\", listener);\n\n\t\t\t\t\t\t\t\treturn { element, listener };\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.filter((link): link is InternalLink => link as boolean);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst removeListeners = () => {\n\t\t\t\tlinks.forEach(({ element, listener }) =>\n\t\t\t\t\telement.removeEventListener(\"click\", listener),\n\t\t\t\t);\n\t\t\t\tlinks = [];\n\t\t\t};\n\n\t\t\twatch(\n\t\t\t\thtml,\n\t\t\t\t() => {\n\t\t\t\t\tremoveListeners();\n\t\t\t\t\tnextTick(addListeners);\n\t\t\t\t},\n\t\t\t\t{ immediate: true },\n\t\t\t);\n\n\t\t\tonBeforeUnmount(() => {\n\t\t\t\tremoveListeners();\n\t\t\t});\n\t\t}\n\n\t\treturn () => {\n\t\t\treturn h(simplyResolveComponent(props.wrapper || defaultWrapper), {\n\t\t\t\tinnerHTML: html.value,\n\t\t\t\tref: root,\n\t\t\t});\n\t\t};\n\t},\n});\n\n// export the public type for h/tsx inference\n// also to avoid inline import() in generated d.ts files\n/**\n * Component to render a Prismic rich text field as HTML.\n *\n * @see Component props {@link PrismicRichTextProps}\n * @see Templating rich text and title fields {@link https://prismic.io/docs/technologies/vue-template-content#rich-text-and-titles}\n */\nexport const PrismicRichText = PrismicRichTextImpl as unknown as {\n\tnew (): {\n\t\t$props: AllowedComponentProps &\n\t\t\tComponentCustomProps &\n\t\t\tVNodeProps &\n\t\t\tPrismicRichTextProps;\n\t};\n};\n"],"names":["usePrismic","computed","unref","isFilled","asHTML","defineComponent","ref","inject","routerKey","isInternalURL","watch","nextTick","onBeforeUnmount","h","simplyResolveComponent"],"mappings":";;;;;;;;AAqCA,MAAM,iBAAiB;AAsEV,MAAA,qBAAqB,CACjC,UACiC;AAC3B,QAAA,EAAE,YAAYA,WAAAA;AAEd,QAAA,OAAOC,IAAAA,SAAS,MAAK;AACpB,UAAA,QAAQC,IAAAA,MAAM,MAAM,KAAK;AAE/B,QAAI,CAACC,QAAA,SAAS,SAAS,KAAK,GAAG;AACvB,aAAAD,UAAM,MAAM,QAAQ,KAAK;AAAA,IAChC;AAED,UAAM,eAAeA,IAAAA,MAAM,MAAM,YAAY,KAAK,QAAQ;AAC1D,UAAM,iBACLA,IAAAA,MAAM,MAAM,cAAc,KAAK,QAAQ;AAExC,WAAOE,QAAAA,OAAOF,IAAAA,MAAM,KAAK,GAAG,cAAc,cAAc;AAAA,EAAA,CACxD;AAEM,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;AAOO,MAAM,sBAAoDG,oBAAAA,gBAAA;AAAA,EAChE,MAAM;AAAA,EACN,OAAO;AAAA,IACN,OAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACV;AAAA,IACD,cAAc;AAAA,MACb,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACV;AAAA,IACD,gBAAgB;AAAA,MACf,MAAM,CAAC,UAAU,MAAM;AAAA,MAGvB,SAAS;AAAA,MACT,UAAU;AAAA,IACV;AAAA,IACD,SAAS;AAAA,MACR,MAAM,CAAC,QAAQ,QAAQ,QAAQ;AAAA,MAC/B,SAAS;AAAA,MACT,UAAU;AAAA,IACV;AAAA,IACD,UAAU;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACV;AAAA,EACD;AAAA,EACD,MAAM,OAAK;AACV,UAAM,EAAE,KAAA,IAAS,mBAAmB,KAAK;AAEnC,UAAA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