@prismicio/vue 5.3.0-pr.89.235a3d3 → 5.3.0-pr.89.35a9f76
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/README.md +8 -10
- package/dist/PrismicImage.vue.d.cts +4 -4
- package/dist/PrismicImage.vue.d.cts.map +1 -1
- package/dist/PrismicLink.vue.d.cts +4 -4
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts +6 -6
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts.map +1 -1
- package/dist/PrismicRichText/getRichTextComponentProps.d.cts +2 -2
- package/dist/PrismicRichText/getRichTextComponentProps.d.cts.map +1 -1
- package/dist/PrismicRichText/types.d.cts +24 -24
- package/dist/PrismicRichText/types.d.cts.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue.d.cts +5 -5
- package/dist/PrismicTable/PrismicTable.vue.d.cts.map +1 -1
- package/dist/PrismicTable/types.d.cts +15 -15
- package/dist/PrismicTable/types.d.cts.map +1 -1
- package/dist/PrismicText.vue.d.cts +2 -2
- package/dist/SliceZone/types.d.cts +2 -2
- package/dist/SliceZone/types.d.cts.map +1 -1
- package/dist/createPrismic.d.cts +15 -6
- package/dist/createPrismic.d.cts.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/src/PrismicImage.vue.d.ts +4 -4
- package/dist/src/PrismicImage.vue.d.ts.map +1 -1
- package/dist/src/PrismicLink.cjs.map +1 -1
- package/dist/src/PrismicLink.js.map +1 -1
- package/dist/src/PrismicLink.vue.d.ts +4 -4
- package/dist/src/PrismicLink.vue.d.ts.map +1 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts +6 -6
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/getRichTextComponentProps.cjs.map +1 -1
- package/dist/src/PrismicRichText/getRichTextComponentProps.d.ts +2 -2
- package/dist/src/PrismicRichText/getRichTextComponentProps.d.ts.map +1 -1
- package/dist/src/PrismicRichText/getRichTextComponentProps.js.map +1 -1
- package/dist/src/PrismicRichText/index.d.ts +1 -1
- package/dist/src/PrismicRichText/types.d.ts +24 -24
- package/dist/src/PrismicRichText/types.d.ts.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue.d.ts +5 -5
- package/dist/src/PrismicTable/PrismicTable.vue.d.ts.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicTable/index.d.ts +1 -1
- package/dist/src/PrismicTable/types.d.ts +15 -15
- package/dist/src/PrismicTable/types.d.ts.map +1 -1
- package/dist/src/PrismicText.vue.d.ts +2 -2
- package/dist/src/PrismicText.vue.d.ts.map +1 -1
- package/dist/src/SliceZone/SliceZone.vue.d.ts +2 -2
- package/dist/src/SliceZone/types.d.ts +2 -2
- package/dist/src/SliceZone/types.d.ts.map +1 -1
- package/dist/src/createPrismic.cjs.map +1 -1
- package/dist/src/createPrismic.d.ts +15 -6
- package/dist/src/createPrismic.d.ts.map +1 -1
- package/dist/src/createPrismic.js.map +1 -1
- package/dist/src/types.cjs +2 -2
- package/dist/src/types.cjs.map +1 -1
- package/dist/src/types.d.ts +3 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -2
- package/dist/src/types.js.map +1 -1
- package/dist/types.d.cts +3 -3
- package/dist/types.d.cts.map +1 -1
- package/package.json +1 -1
- package/src/PrismicLink.vue +1 -1
- package/src/PrismicRichText/PrismicRichText.vue +11 -11
- package/src/PrismicRichText/PrismicRichTextDefaultComponent.vue +4 -4
- package/src/PrismicRichText/PrismicRichTextSerialize.vue +2 -2
- package/src/PrismicRichText/getRichTextComponentProps.ts +3 -3
- package/src/PrismicRichText/index.ts +1 -1
- package/src/PrismicRichText/types.ts +29 -29
- package/src/PrismicTable/PrismicTable.vue +10 -10
- package/src/PrismicTable/PrismicTableDefaultComponents.ts +2 -2
- package/src/PrismicTable/PrismicTableRow.vue +4 -4
- package/src/PrismicTable/index.ts +1 -1
- package/src/PrismicTable/types.ts +27 -27
- package/src/SliceZone/types.ts +2 -2
- package/src/createPrismic.ts +16 -6
- package/src/index.ts +2 -5
- package/src/types.ts +7 -7
package/README.md
CHANGED
|
@@ -15,11 +15,11 @@ Replace all on all files (README.md, CONTRIBUTING.md, bug_report.md, package.jso
|
|
|
15
15
|
|
|
16
16
|
<!-- Replacing link to Prismic with [Prismic][prismic] is useful here -->
|
|
17
17
|
|
|
18
|
-
[Vue][vue] plugin, components, and composables to fetch and present [Prismic][prismic] content.
|
|
18
|
+
[Vue][vue-docs] plugin, components, and composables to fetch and present [Prismic][prismic] content.
|
|
19
19
|
|
|
20
|
-
- 📝 Display content from Prismic like [
|
|
21
|
-
- 🍡 Render Prismic [
|
|
22
|
-
- 🎣 Fetch Prismic content
|
|
20
|
+
- 📝 Display content from Prismic like [rich text][prismic-rich-text] and [link][prismic-link] fields.
|
|
21
|
+
- 🍡 Render Prismic [slice zones][prismic-slices] declaratively with Vue components.
|
|
22
|
+
- 🎣 Fetch Prismic content throughout your Vue application.
|
|
23
23
|
|
|
24
24
|
## Install
|
|
25
25
|
|
|
@@ -70,14 +70,12 @@ For more clarity on this project and its structure you can also check out the de
|
|
|
70
70
|
<!-- Replace link with a more useful one if available -->
|
|
71
71
|
|
|
72
72
|
[prismic-docs]: https://prismic.io/docs/technical-reference/prismicio-vue/v5
|
|
73
|
+
[vue-docs]: https://vuejs.org
|
|
73
74
|
[changelog]: ./CHANGELOG.md
|
|
74
75
|
[contributing]: ./CONTRIBUTING.md
|
|
75
|
-
[
|
|
76
|
-
[prismic-
|
|
77
|
-
[prismic-
|
|
78
|
-
[prismic-slices]: https://prismic.io/docs/core-concepts/slices
|
|
79
|
-
[vue-composition]: https://v3.vuejs.org/guide/composition-api-introduction.html
|
|
80
|
-
[vue-options]: https://v3.vuejs.org/guide/introduction.html
|
|
76
|
+
[prismic-rich-text]: https://prismic.io/docs/fields/rich-text
|
|
77
|
+
[prismic-link]: https://prismic.io/docs/fields/link
|
|
78
|
+
[prismic-slices]: https://prismic.io/docs/slices
|
|
81
79
|
|
|
82
80
|
<!-- Replace link with a more useful one if available -->
|
|
83
81
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue11 from "vue";
|
|
2
2
|
import { ImageField, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/PrismicImage.vue.d.ts
|
|
@@ -64,7 +64,7 @@ type PrismicImageProps = {
|
|
|
64
64
|
*/
|
|
65
65
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
66
66
|
});
|
|
67
|
-
declare const __VLS_export:
|
|
67
|
+
declare const __VLS_export: vue11.DefineComponent<({
|
|
68
68
|
/** The Prismic image field or thumbnail to render. */
|
|
69
69
|
field: ImageField | ImageField<string>;
|
|
70
70
|
/**
|
|
@@ -162,7 +162,7 @@ declare const __VLS_export: vue0.DefineComponent<({
|
|
|
162
162
|
* densities will be used: 1, 2, 3.
|
|
163
163
|
*/
|
|
164
164
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
165
|
-
}), {}, {}, {}, {},
|
|
165
|
+
}), {}, {}, {}, {}, vue11.ComponentOptionsMixin, vue11.ComponentOptionsMixin, {}, string, vue11.PublicProps, Readonly<({
|
|
166
166
|
/** The Prismic image field or thumbnail to render. */
|
|
167
167
|
field: ImageField | ImageField<string>;
|
|
168
168
|
/**
|
|
@@ -260,7 +260,7 @@ declare const __VLS_export: vue0.DefineComponent<({
|
|
|
260
260
|
* densities will be used: 1, 2, 3.
|
|
261
261
|
*/
|
|
262
262
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
263
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
263
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, vue11.ComponentProvideOptions, false, {}, any>;
|
|
264
264
|
declare const _default: typeof __VLS_export;
|
|
265
265
|
//#endregion
|
|
266
266
|
export { PrismicImageProps, _default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicImage.vue.d.cts","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":[],"mappings":";;;;;KAgNY,iBAAA;EAAA;EAEJ,KAAA,EAAA,UAAA,GAAa,UAAb,CAAA,MAAA,CAAA;EAAa;;;;;EAsDf,WAAA,CAAA,EA/CS,UA+CT,CAAA,OA/C2B,UA+C3B,CAAA,CAAA,CAAA,CAAA;EAekB;;;;AAIvB;;EAzEoB,GAAA,CAAA,EAAA,EAAA;EAOY;;;;;;;EAAA,WAAA,CAAA,EAAA,EAAA;EAAlB;;;;;;;EAPP;;;;;;EAsDF,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA;CAtDE,GAAA,CAAA;EAAa;;;;;;;;;;EAsMH,MAAA,CAAA,EAhJZ,WAgJY,CAhJA,UAgJA,CAAA,OAhJkB,kBAgJlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAAA,CAAA,GAAA,YAAA,GAAA,UAAA;EAAA,cAGsB,CAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"PrismicImage.vue.d.cts","names":[],"sources":["../src/PrismicImage.vue"],"sourcesContent":[],"mappings":";;;;;KAgNY,iBAAA;EAAA;EAEJ,KAAA,EAAA,UAAA,GAAa,UAAb,CAAA,MAAA,CAAA;EAAa;;;;;EAsDf,WAAA,CAAA,EA/CS,UA+CT,CAAA,OA/C2B,UA+C3B,CAAA,CAAA,CAAA,CAAA;EAekB;;;;AAIvB;;EAzEoB,GAAA,CAAA,EAAA,EAAA;EAOY;;;;;;;EAAA,WAAA,CAAA,EAAA,EAAA;EAAlB;;;;;;;EAPP;;;;;;EAsDF,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA;CAtDE,GAAA,CAAA;EAAa;;;;;;;;;;EAsMH,MAAA,CAAA,EAhJZ,WAgJY,CAhJA,UAgJA,CAAA,OAhJkB,kBAgJlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAAA,CAAA,GAAA,YAAA,GAAA,UAAA;EAAA,cAGsB,CAAA,EAAA,KAAA;;;;;;;;;kBArIlC,YACA,kBAAkB;;cAiIlB,oBAAY;;SAtMV,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA+C3B,YAAY,kBAAkB;;;;SAtD5B,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6D3B,YACA,kBAAkB;oBADP,KAAA,CAAA,qBAAA;;SApET,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA+C3B,YAAY,kBAAkB;;;;SAtD5B,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6D3B,YACA,kBAAkB;;cAiIN,iBAGU"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentOrTagName } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue16 from "vue";
|
|
3
3
|
import { AsLinkAttrsConfig, LinkField, LinkResolverFunction, PrismicDocument } from "@prismicio/client";
|
|
4
4
|
|
|
5
5
|
//#region src/PrismicLink.vue.d.ts
|
|
@@ -49,7 +49,7 @@ declare var __VLS_8: {};
|
|
|
49
49
|
type __VLS_Slots = {} & {
|
|
50
50
|
default?: (props: typeof __VLS_8) => any;
|
|
51
51
|
};
|
|
52
|
-
declare const __VLS_base:
|
|
52
|
+
declare const __VLS_base: vue16.DefineComponent<({
|
|
53
53
|
/**
|
|
54
54
|
* The link resolver used to resolve links.
|
|
55
55
|
*
|
|
@@ -121,7 +121,7 @@ declare const __VLS_base: vue11.DefineComponent<({
|
|
|
121
121
|
/** The Prismic document to render as a link. */
|
|
122
122
|
document: PrismicDocument;
|
|
123
123
|
field?: never;
|
|
124
|
-
}), {}, {}, {}, {},
|
|
124
|
+
}), {}, {}, {}, {}, vue16.ComponentOptionsMixin, vue16.ComponentOptionsMixin, {}, string, vue16.PublicProps, Readonly<({
|
|
125
125
|
/**
|
|
126
126
|
* The link resolver used to resolve links.
|
|
127
127
|
*
|
|
@@ -193,7 +193,7 @@ declare const __VLS_base: vue11.DefineComponent<({
|
|
|
193
193
|
/** The Prismic document to render as a link. */
|
|
194
194
|
document: PrismicDocument;
|
|
195
195
|
field?: never;
|
|
196
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
196
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, vue16.ComponentProvideOptions, false, {}, any>;
|
|
197
197
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
198
198
|
declare const _default: typeof __VLS_export;
|
|
199
199
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentOrTagName } from "../types.cjs";
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
2
|
+
import { RichTextComponents } from "./types.cjs";
|
|
3
|
+
import * as vue0 from "vue";
|
|
4
4
|
import { PropType } from "vue";
|
|
5
5
|
import { LinkResolverFunction, RichTextField } from "@prismicio/client";
|
|
6
6
|
|
|
@@ -33,14 +33,14 @@ type PrismicRichTextProps = {
|
|
|
33
33
|
* }
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
components?:
|
|
36
|
+
components?: RichTextComponents;
|
|
37
37
|
/**
|
|
38
38
|
* The value to be rendered when the field is empty. If a fallback is not
|
|
39
39
|
* given, `null` will be rendered.
|
|
40
40
|
*/
|
|
41
41
|
fallback?: ComponentOrTagName;
|
|
42
42
|
};
|
|
43
|
-
declare const __VLS_export:
|
|
43
|
+
declare const __VLS_export: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
44
44
|
field: {
|
|
45
45
|
type: PropType<PrismicRichTextProps["field"]>;
|
|
46
46
|
};
|
|
@@ -53,7 +53,7 @@ declare const __VLS_export: vue4.DefineComponent<vue4.ExtractPropTypes<{
|
|
|
53
53
|
fallback: {
|
|
54
54
|
type: PropType<PrismicRichTextProps["fallback"]>;
|
|
55
55
|
};
|
|
56
|
-
}>, {}, {}, {}, {},
|
|
56
|
+
}>, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<vue0.ExtractPropTypes<{
|
|
57
57
|
field: {
|
|
58
58
|
type: PropType<PrismicRichTextProps["field"]>;
|
|
59
59
|
};
|
|
@@ -66,7 +66,7 @@ declare const __VLS_export: vue4.DefineComponent<vue4.ExtractPropTypes<{
|
|
|
66
66
|
fallback: {
|
|
67
67
|
type: PropType<PrismicRichTextProps["fallback"]>;
|
|
68
68
|
};
|
|
69
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
69
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
|
|
70
70
|
declare const _default: typeof __VLS_export;
|
|
71
71
|
//#endregion
|
|
72
72
|
export { PrismicRichTextProps, _default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicRichText.vue.d.cts","names":[],"sources":["../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":[],"mappings":";;;;;;;;KAwKY,oBAAA;;EAAA,KAAA,EAEJ,aAFI,GAAoB,IAAA,GAAA,SAAA;EAExB;;;;;AAkCP;;;;EA6HmB,YAAA,CAAA,EApJJ,oBAoJI;EAGO;;;;;;;;;;;;;;EAIxB,UAAA,CAAA,EA3IW,
|
|
1
|
+
{"version":3,"file":"PrismicRichText.vue.d.cts","names":[],"sources":["../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":[],"mappings":";;;;;;;;KAwKY,oBAAA;;EAAA,KAAA,EAEJ,aAFI,GAAoB,IAAA,GAAA,SAAA;EAExB;;;;;AAkCP;;;;EA6HmB,YAAA,CAAA,EApJJ,oBAoJI;EAGO;;;;;;;;;;;;;;EAIxB,UAAA,CAAA,EA3IW,kBA2IX;EADmC;;;;aApI1B;;cAwHN,YAAY,OAAA,eAAA,CAY4B,IAAA,CAZ5B,gBAAA,CAAA;EAAA,KAAA,EAAA;UAGU,SAAS;;;UAGjB,SAAS;;;UAGX,SAAS;;;UAGW,SACnC;;oBAbe,IAAA,CAAA,qBAAA,qEAY4B,IAAA,CAAA;;UATlB,SAAS;;;UAGjB,SAAS;;;UAGX,SAAS;;;UAGW,SACnC;;;cAbe,iBAkBU"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RichTextComponentProps } from "./types.cjs";
|
|
2
2
|
import { PropType } from "vue";
|
|
3
3
|
import { RTAnyNode } from "@prismicio/client";
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ import { RTAnyNode } from "@prismicio/client";
|
|
|
12
12
|
*/
|
|
13
13
|
type DefineComponentRichTextComponentProps<TRTNode extends RTAnyNode = RTAnyNode> = {
|
|
14
14
|
node: {
|
|
15
|
-
type: PropType<
|
|
15
|
+
type: PropType<RichTextComponentProps<TRTNode>["node"]>;
|
|
16
16
|
required: true;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRichTextComponentProps.d.cts","names":[],"sources":["../../src/PrismicRichText/getRichTextComponentProps.ts"],"sourcesContent":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"getRichTextComponentProps.d.cts","names":[],"sources":["../../src/PrismicRichText/getRichTextComponentProps.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAGqD;;;;KAQhD,qCAIY,CAAA,gBAHA,SAGA,GAHY,SAGZ,CAAA,GAAA;EAAT,IAAA,EAAA;IAAQ,IAAA,EAAR,QAAQ,CAAC,sBAAD,CAAwB,OAAxB,CAAA,CAAA,MAAA,CAAA,CAAA;IAmCH,QAAA,EAAA,IAAA;EAA6C,CAAA;CAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAFK,4CAA6C,0BAElD,YACL,sCACF,QAAQ;QAAmB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component, ComponentShorthand } from "../types.cjs";
|
|
2
2
|
import { LinkResolverFunction, RTAnyNode, RTEmNode, RTEmbedNode, RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node, RTImageNode, RTLabelNode, RTLinkNode, RTListItemNode, RTListNode, RTOListItemNode, RTOListNode, RTParagraphNode, RTPreformattedNode, RTSpanNode, RTStrongNode } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/PrismicRichText/types.d.ts
|
|
@@ -9,29 +9,29 @@ import { LinkResolverFunction, RTAnyNode, RTEmNode, RTEmbedNode, RTHeading1Node,
|
|
|
9
9
|
*
|
|
10
10
|
* @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/rich-text}
|
|
11
11
|
*/
|
|
12
|
-
type
|
|
13
|
-
heading1?:
|
|
14
|
-
heading2?:
|
|
15
|
-
heading3?:
|
|
16
|
-
heading4?:
|
|
17
|
-
heading5?:
|
|
18
|
-
heading6?:
|
|
19
|
-
paragraph?:
|
|
20
|
-
preformatted?:
|
|
21
|
-
strong?:
|
|
22
|
-
em?:
|
|
23
|
-
listItem?:
|
|
24
|
-
oListItem?:
|
|
25
|
-
list?:
|
|
26
|
-
oList?:
|
|
27
|
-
image?:
|
|
28
|
-
embed?:
|
|
29
|
-
hyperlink?:
|
|
30
|
-
label?:
|
|
31
|
-
span?:
|
|
12
|
+
type RichTextComponents = {
|
|
13
|
+
heading1?: RichTextComponent<RTHeading1Node> | ComponentShorthand;
|
|
14
|
+
heading2?: RichTextComponent<RTHeading2Node> | ComponentShorthand;
|
|
15
|
+
heading3?: RichTextComponent<RTHeading3Node> | ComponentShorthand;
|
|
16
|
+
heading4?: RichTextComponent<RTHeading4Node> | ComponentShorthand;
|
|
17
|
+
heading5?: RichTextComponent<RTHeading5Node> | ComponentShorthand;
|
|
18
|
+
heading6?: RichTextComponent<RTHeading6Node> | ComponentShorthand;
|
|
19
|
+
paragraph?: RichTextComponent<RTParagraphNode> | ComponentShorthand;
|
|
20
|
+
preformatted?: RichTextComponent<RTPreformattedNode> | ComponentShorthand;
|
|
21
|
+
strong?: RichTextComponent<RTStrongNode> | ComponentShorthand;
|
|
22
|
+
em?: RichTextComponent<RTEmNode> | ComponentShorthand;
|
|
23
|
+
listItem?: RichTextComponent<RTListItemNode> | ComponentShorthand;
|
|
24
|
+
oListItem?: RichTextComponent<RTOListItemNode> | ComponentShorthand;
|
|
25
|
+
list?: RichTextComponent<RTListNode> | ComponentShorthand;
|
|
26
|
+
oList?: RichTextComponent<RTOListNode> | ComponentShorthand;
|
|
27
|
+
image?: RichTextComponent<RTImageNode> | Omit<ComponentShorthand, "as">;
|
|
28
|
+
embed?: RichTextComponent<RTEmbedNode> | ComponentShorthand;
|
|
29
|
+
hyperlink?: RichTextComponent<RTLinkNode> | Omit<ComponentShorthand, "as">;
|
|
30
|
+
label?: RichTextComponent<RTLabelNode> | Omit<ComponentShorthand, "as">;
|
|
31
|
+
span?: RichTextComponent<RTSpanNode>;
|
|
32
32
|
};
|
|
33
33
|
/** Props for a component rendering nodes from a Prismic rich text field. */
|
|
34
|
-
type
|
|
34
|
+
type RichTextComponentProps<TRTNode extends RTAnyNode = RTAnyNode> = {
|
|
35
35
|
node: TRTNode;
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
@@ -39,7 +39,7 @@ type VueRichTextComponentProps<TRTNode extends RTAnyNode = RTAnyNode> = {
|
|
|
39
39
|
*
|
|
40
40
|
* @typeParam TRTNode - The type of rich text node(s) this component handles
|
|
41
41
|
*/
|
|
42
|
-
type
|
|
42
|
+
type RichTextComponent<TRTNode extends RTAnyNode = RTAnyNode> = Component<RichTextComponentProps<TRTNode>>;
|
|
43
43
|
//#endregion
|
|
44
|
-
export {
|
|
44
|
+
export { RichTextComponentProps, RichTextComponents };
|
|
45
45
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/PrismicRichText/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAiCA;;;;
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/PrismicRichText/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAiCA;;;;AAE8B,KAFlB,kBAAA,GAEkB;EAAlB,QAAA,CAAA,EADA,iBACA,CADkB,cAClB,CAAA,GADoC,kBACpC;EAAoC,QAAA,CAAA,EAApC,iBAAoC,CAAlB,cAAkB,CAAA,GAAA,kBAAA;EAClB,QAAA,CAAA,EAAlB,iBAAkB,CAAA,cAAA,CAAA,GAAkB,kBAAlB;EAAlB,QAAA,CAAA,EACA,iBADA,CACkB,cADlB,CAAA,GACoC,kBADpC;EAAoC,QAAA,CAAA,EAEpC,iBAFoC,CAElB,cAFkB,CAAA,GAEA,kBAFA;EAClB,QAAA,CAAA,EAElB,iBAFkB,CAEA,cAFA,CAAA,GAEkB,kBAFlB;EAAlB,SAAA,CAAA,EAGC,iBAHD,CAGmB,eAHnB,CAAA,GAGsC,kBAHtC;EAAoC,YAAA,CAAA,EAK5C,iBAL4C,CAK1B,kBAL0B,CAAA,GAM5C,kBAN4C;EAClB,MAAA,CAAA,EAMpB,iBANoB,CAMF,YANE,CAAA,GAMc,kBANd;EAAlB,EAAA,CAAA,EAON,iBAPM,CAOY,QAPZ,CAAA,GAOwB,kBAPxB;EAAoC,QAAA,CAAA,EAQpC,iBARoC,CAQlB,cARkB,CAAA,GAQA,kBARA;EAClB,SAAA,CAAA,EAQjB,iBARiB,CAQC,eARD,CAAA,GAQoB,kBARpB;EAAlB,IAAA,CAAA,EASJ,iBATI,CASc,UATd,CAAA,GAS4B,kBAT5B;EAAoC,KAAA,CAAA,EAUvC,iBAVuC,CAUrB,WAVqB,CAAA,GAUN,kBAVM;EACjB,KAAA,CAAA,EAUtB,iBAVsB,CAUJ,WAVI,CAAA,GAUW,IAVX,CAUgB,kBAVhB,EAAA,IAAA,CAAA;EAAlB,KAAA,CAAA,EAWJ,iBAXI,CAWc,WAXd,CAAA,GAW6B,kBAX7B;EAAqC,SAAA,CAAA,EAa9C,iBAb8C,CAa5B,UAb4B,CAAA,GAc9C,IAd8C,CAczC,kBAdyC,EAAA,IAAA,CAAA;EAE5B,KAAA,CAAA,EAab,iBAba,CAaK,WAbL,CAAA,GAaoB,IAbpB,CAayB,kBAbzB,EAAA,IAAA,CAAA;EAAlB,IAAA,CAAA,EAcI,iBAdJ,CAcsB,UAdtB,CAAA;CACA;;AACM,KAgBE,sBAhBF,CAAA,gBAgByC,SAhBzC,GAgBqD,SAhBrD,CAAA,GAAA;EAAkC,IAAA,EAiBrC,OAjBqC;CACpB;;;;;;AAEO,KAsBnB,iBAtBmB,CAAA,gBAsBe,SAtBf,GAsB2B,SAtB3B,CAAA,GAuB9B,SAvB8B,CAuBpB,sBAvBoB,CAuBG,OAvBH,CAAA,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentOrTagName } from "../types.cjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import * as
|
|
2
|
+
import { RichTextComponents } from "../PrismicRichText/types.cjs";
|
|
3
|
+
import { TableComponents } from "./types.cjs";
|
|
4
|
+
import * as vue6 from "vue";
|
|
5
5
|
import { TableField } from "@prismicio/client";
|
|
6
6
|
|
|
7
7
|
//#region src/PrismicTable/PrismicTable.vue.d.ts
|
|
@@ -23,14 +23,14 @@ type PrismicTableProps = {
|
|
|
23
23
|
* }
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
components?:
|
|
26
|
+
components?: TableComponents & RichTextComponents;
|
|
27
27
|
/**
|
|
28
28
|
* The value to be rendered when the field is empty. If a fallback is not
|
|
29
29
|
* given, `null` (nothing) will be rendered.
|
|
30
30
|
*/
|
|
31
31
|
fallback?: ComponentOrTagName;
|
|
32
32
|
};
|
|
33
|
-
declare const __VLS_export:
|
|
33
|
+
declare const __VLS_export: vue6.DefineComponent<PrismicTableProps, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<PrismicTableProps> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
|
|
34
34
|
declare const _default: typeof __VLS_export;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { PrismicTableProps, _default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTable.vue.d.cts","names":[],"sources":["../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":[],"mappings":";;;;;;;;KAoIY,iBAAA;;EAAA,KAAA,EAEJ,UAFI,GAAiB,SAAA;EAErB;;;;;AAuBP;;;;;;;;;EA2JiB,UAAA,CAAA,EAlKJ,
|
|
1
|
+
{"version":3,"file":"PrismicTable.vue.d.cts","names":[],"sources":["../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":[],"mappings":";;;;;;;;KAoIY,iBAAA;;EAAA,KAAA,EAEJ,UAFI,GAAiB,SAAA;EAErB;;;;;AAuBP;;;;;;;;;EA2JiB,UAAA,CAAA,EAlKJ,eAkKI,GAlKc,kBAkKd;EAAA;AAAA;;;aA5JN;;cA4JN,cAAY,IAAA,CAAA,gBAAA,mCAAA,IAAA,CAAA,qBAAA,EAAA,IAAA,CAAA,qBAAA,cAAA,IAAA,CAAA,WAAA,EAAA,SAAA,qBAAA,sCAAA,IAAA,CAAA,uBAAA;cAAA,iBAGU"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component, ComponentShorthand } from "../types.cjs";
|
|
2
2
|
import { TableField, TableFieldBody, TableFieldBodyRow, TableFieldDataCell, TableFieldHead, TableFieldHeadRow, TableFieldHeaderCell } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/PrismicTable/types.d.ts
|
|
@@ -9,26 +9,26 @@ import { TableField, TableFieldBody, TableFieldBodyRow, TableFieldDataCell, Tabl
|
|
|
9
9
|
*
|
|
10
10
|
* @see Templating Table fields from Prismic {@link https://prismic.io/docs/table}
|
|
11
11
|
*/
|
|
12
|
-
type
|
|
13
|
-
table?:
|
|
12
|
+
type TableComponents = {
|
|
13
|
+
table?: Component<{
|
|
14
14
|
table: TableField<"filled">;
|
|
15
|
-
}> | Omit<
|
|
16
|
-
thead?:
|
|
15
|
+
}> | Omit<ComponentShorthand, "as">;
|
|
16
|
+
thead?: Component<{
|
|
17
17
|
head: TableFieldHead;
|
|
18
|
-
}> | Omit<
|
|
19
|
-
tbody?:
|
|
18
|
+
}> | Omit<ComponentShorthand, "as">;
|
|
19
|
+
tbody?: Component<{
|
|
20
20
|
body: TableFieldBody;
|
|
21
|
-
}> | Omit<
|
|
22
|
-
tr?:
|
|
21
|
+
}> | Omit<ComponentShorthand, "as">;
|
|
22
|
+
tr?: Component<{
|
|
23
23
|
row: TableFieldBodyRow | TableFieldHeadRow;
|
|
24
|
-
}> | Omit<
|
|
25
|
-
th?:
|
|
24
|
+
}> | Omit<ComponentShorthand, "as">;
|
|
25
|
+
th?: Component<{
|
|
26
26
|
cell: TableFieldHeaderCell;
|
|
27
|
-
}> | Omit<
|
|
28
|
-
td?:
|
|
27
|
+
}> | Omit<ComponentShorthand, "as">;
|
|
28
|
+
td?: Component<{
|
|
29
29
|
cell: TableFieldDataCell;
|
|
30
|
-
}> | Omit<
|
|
30
|
+
}> | Omit<ComponentShorthand, "as">;
|
|
31
31
|
};
|
|
32
32
|
//#endregion
|
|
33
|
-
export {
|
|
33
|
+
export { TableComponents };
|
|
34
34
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/PrismicTable/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAkBA;;;;AAGI,KAHQ,
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/PrismicTable/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAkBA;;;;AAGI,KAHQ,eAAA,GAGR;EAEkB,KAAA,CAAA,EAHlB,SAGkB,CAAA;IAAlB,KAAA,EAHmB,UAGnB,CAAA,QAAA,CAAA;EACK,CAAA,CAAA,GAHL,IAGK,CAHA,kBAGA,EAAA,IAAA,CAAA;EAAL,KAAA,CAAA,EADA,SACA,CAAA;IAEkB,IAAA,EAHA,cAGA;EAAlB,CAAA,CAAA,GAFA,IAEA,CAFK,kBAEL,EAAA,IAAA,CAAA;EACK,KAAA,CAAA,EADL,SACK,CAAA;IAAL,IAAA,EADkB,cAClB;EAEiB,CAAA,CAAA,GAFjB,IAEiB,CAFZ,kBAEY,EAAA,IAAA,CAAA;EAAoB,EAAA,CAAA,EAArC,SAAqC,CAAA;IAArC,GAAA,EAAiB,iBAAjB,GAAqC,iBAArC;EACK,CAAA,CAAA,GAAL,IAAK,CAAA,kBAAA,EAAA,IAAA,CAAA;EAAL,EAAA,CAAA,EAEA,SAFA,CAAA;IAEkB,IAAA,EAAA,oBAAA;EAAlB,CAAA,CAAA,GACA,IADA,CACK,kBADL,EAAA,IAAA,CAAA;EACK,EAAA,CAAA,EAEL,SAFK,CAAA;IAAL,IAAA,EAEkB,kBAFlB;EAEkB,CAAA,CAAA,GAClB,IADkB,CACb,kBADa,EAAA,IAAA,CAAA;CAAlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue21 from "vue";
|
|
2
2
|
import { RichTextField } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/PrismicText.vue.d.ts
|
|
@@ -18,7 +18,7 @@ type PrismicTextProps = {
|
|
|
18
18
|
*/
|
|
19
19
|
separator?: string;
|
|
20
20
|
};
|
|
21
|
-
declare const __VLS_export:
|
|
21
|
+
declare const __VLS_export: vue21.DefineComponent<PrismicTextProps, {}, {}, {}, {}, vue21.ComponentOptionsMixin, vue21.ComponentOptionsMixin, {}, string, vue21.PublicProps, Readonly<PrismicTextProps> & Readonly<{}>, {}, {}, {}, {}, string, vue21.ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { PrismicTextProps, _default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component } from "../types.cjs";
|
|
2
2
|
import { Slice } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/SliceZone/types.d.ts
|
|
@@ -80,7 +80,7 @@ type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknow
|
|
|
80
80
|
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
81
81
|
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
82
82
|
*/
|
|
83
|
-
type SliceComponentType<TSlice extends SliceLike = any, TContext = unknown> =
|
|
83
|
+
type SliceComponentType<TSlice extends SliceLike = any, TContext = unknown> = Component<SliceComponentProps<TSlice, TContext>>;
|
|
84
84
|
/**
|
|
85
85
|
* A record of Slice types mapped to Vue components. Each components will be
|
|
86
86
|
* rendered for each instance of their Slice type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/SliceZone/types.ts"],"sourcesContent":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/SliceZone/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAEyC;;;KAOpC,gBAA4D,CAAA,eAA5B,SAA4B,CAAA,GAAf,MAAe,SAAA,eAAA,GAC9D,MAD8D,CAAA,YAAA,CAAA,GAE9D,MAF8D,SAE/C,gBAF+C,GAG7D,MAH6D,CAAA,MAAA,CAAA,GAAA,KAAA;;;;;;AAYjE;AACO,KADK,eACL,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAD2D,IAC3D,CAAN,KAAM,CAAA,UAAA,CAAA,EAAA,IAAA,GAAA,YAAA,CAAA;;;;AAUP;AAaA;;AACG,KAdS,gBAcT,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAAA;EACiB,IAAA,EAdb,KAca,CAdP,UAcO,CAAA,CAAA,YAAA,CAAA;CAAjB;;AAoBH;;;;;AAWA;;;AAKQ,KAtCI,SAsCJ,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAAA,CArCL,eAqCK,CArCW,UAqCX,CAAA,GApCL,gBAoCK,CApCY,UAoCZ,CAAA,CAAA,GAAA;EAWN;;;;;;EAOgB,QAAA,CAAA,EAAA,IAAA;AASlB,CAAA;;;;;;;AAaA;;;AAciC,KAtErB,aAsEqB,CAAA,eAtEQ,SAsER,GAtEoB,SAsEpB,CAAA,GAAA,SArEvB,MAqEuB,EAAA;;;;;;;;;AAIT,KA/DZ,mBA+DY,CAAA,eA9DR,SA8DQ,GA9DI,SA8DJ,EAAA,WAAA,OAAA,CAAA,GAAA;EAAhB;EACH,KAAA,EA3DG,MA2DH;EAJA;EAAkB,KAAA,EAAA,MAAA;;UA7Cd,cACP,eAAe,mBAAmB,mBAAmB;;;;;WAO7C;;;;;;;;KASE,kCAEI,uCAEZ,UAAU,oBAAoB,QAAQ;;;;;;;;KAS9B,mCACI,YAAY,iDAaZ,iBAAiB,UAC5B,mBACA,QAAQ,QAAQ,UAAU,4BACvB,YACA,QAAQ,QAAQ,UAAU,aAC7B"}
|
package/dist/createPrismic.d.cts
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { ComponentOrTagName } from "./types.cjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { RichTextComponents } from "./PrismicRichText/types.cjs";
|
|
3
|
+
import { TableComponents } from "./PrismicTable/types.cjs";
|
|
4
4
|
import { App } from "vue";
|
|
5
|
-
import { CreateClient, isFilled } from "@prismicio/client";
|
|
5
|
+
import { CreateClient, LinkResolverFunction, isFilled } from "@prismicio/client";
|
|
6
6
|
|
|
7
7
|
//#region src/createPrismic.d.ts
|
|
8
8
|
/** Components configuration. */
|
|
9
9
|
type ComponentsConfig = {
|
|
10
|
+
/**
|
|
11
|
+
* The default link resolver used to resolve links.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
14
|
+
*/
|
|
15
|
+
linkResolver?: LinkResolverFunction;
|
|
10
16
|
/** The default component rendered for internal URLs. */
|
|
11
17
|
linkInternalComponent?: ComponentOrTagName;
|
|
12
18
|
/** The default component rendered for external URLs. */
|
|
13
19
|
linkExternalComponent?: ComponentOrTagName;
|
|
14
20
|
/**
|
|
15
|
-
* The default components or shorthand definitions for
|
|
16
|
-
*
|
|
21
|
+
* The default components or shorthand definitions for rich text and table
|
|
22
|
+
* components.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link https://prismic.io/docs/fields/rich-text}
|
|
25
|
+
* @see {@link https://prismic.io/docs/fields/table}
|
|
17
26
|
*/
|
|
18
|
-
defaultComponents?:
|
|
27
|
+
defaultComponents?: RichTextComponents & TableComponents;
|
|
19
28
|
};
|
|
20
29
|
/**
|
|
21
30
|
* Prismic Vue plugin interface accessible through `usePrismic()` and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPrismic.d.cts","names":[],"sources":["../src/createPrismic.ts"],"sourcesContent":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"createPrismic.d.cts","names":[],"sources":["../src/createPrismic.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAQqD,KAOhD,gBAAA,GAAgB;EAML;;;;;EAeyC,YAAA,CAAA,EAfzC,oBAeyC;EAO7C;EAEQ,qBAAA,CAAA,EArBK,kBAqBL;EAAX;EAGS,qBAAA,CAAA,EArBO,kBAqBP;EAGW;;;AAO7B;;;;EAKoC,iBAAA,CAAA,EA3Bf,kBA2Be,GA3BM,eA2BN;AAIpC,CAAA;AAoBA;AAEC;;;AAKwB,KAnDb,aAAA,GAmDa;EAAA;UAjDhB,WAAW;;mBAGF;;8BAGW;;iBAGb;;;KAIJ,mBAAA;;UAEH,WAAW;;qBAGA;;;cAIP,wBAAyB,wBAAsB;;;;;;;;;;cAoB/C,kBAAiB;;;;cAOlB"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RichTextComponentProps, RichTextComponents } from "./PrismicRichText/types.cjs";
|
|
2
2
|
import { PrismicRichTextProps, _default as _default$2 } from "./PrismicRichText/PrismicRichText.vue.cjs";
|
|
3
3
|
import { getRichTextComponentProps } from "./PrismicRichText/getRichTextComponentProps.cjs";
|
|
4
|
-
import {
|
|
4
|
+
import { TableComponents } from "./PrismicTable/types.cjs";
|
|
5
5
|
import { PrismicTableProps, _default as _default$3 } from "./PrismicTable/PrismicTable.vue.cjs";
|
|
6
6
|
import { getTableComponentProps_d_exports } from "./PrismicTable/getTableComponentProps.cjs";
|
|
7
7
|
import { PrismicImageProps, _default } from "./PrismicImage.vue.cjs";
|
|
@@ -13,4 +13,4 @@ import { TODOSliceComponent } from "./SliceZone/TODOSliceComponent.cjs";
|
|
|
13
13
|
import { getSliceComponentProps } from "./SliceZone/getSliceComponentProps.cjs";
|
|
14
14
|
import { defineSliceZoneComponents } from "./SliceZone/defineSliceZoneComponents.cjs";
|
|
15
15
|
import { PrismicPlugin, PrismicPluginConfig, createPrismic, usePrismic } from "./createPrismic.cjs";
|
|
16
|
-
export { _default as PrismicImage, type PrismicImageProps, _default$1 as PrismicLink, type PrismicLinkProps, type PrismicPlugin, type PrismicPluginConfig, _default$2 as PrismicRichText, type PrismicRichTextProps, _default$3 as PrismicTable, type PrismicTableProps, _default$4 as PrismicText, type PrismicTextProps, type SliceComponentProps, type SliceComponentType, type SliceLike, type SliceLikeGraphQL, type SliceLikeRestV2, _default$5 as SliceZone, type SliceZoneComponents, type SliceZoneLike, type SliceZoneProps, TODOSliceComponent, type
|
|
16
|
+
export { _default as PrismicImage, type PrismicImageProps, _default$1 as PrismicLink, type PrismicLinkProps, type PrismicPlugin, type PrismicPluginConfig, _default$2 as PrismicRichText, type PrismicRichTextProps, _default$3 as PrismicTable, type PrismicTableProps, _default$4 as PrismicText, type PrismicTextProps, type RichTextComponentProps, type RichTextComponents, type SliceComponentProps, type SliceComponentType, type SliceLike, type SliceLikeGraphQL, type SliceLikeRestV2, _default$5 as SliceZone, type SliceZoneComponents, type SliceZoneLike, type SliceZoneProps, TODOSliceComponent, type TableComponents, createPrismic, defineSliceZoneComponents, getRichTextComponentProps, getSliceComponentProps, getTableComponentProps_d_exports as getTableComponentProps, usePrismic };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RichTextComponentProps, RichTextComponents } from "./src/PrismicRichText/types.js";
|
|
2
2
|
import { PrismicRichTextProps, _default as _default$2 } from "./src/PrismicRichText/PrismicRichText.vue.js";
|
|
3
3
|
import { getRichTextComponentProps } from "./src/PrismicRichText/getRichTextComponentProps.js";
|
|
4
4
|
import "./src/PrismicRichText/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { TableComponents } from "./src/PrismicTable/types.js";
|
|
6
6
|
import { PrismicTableProps, _default as _default$3 } from "./src/PrismicTable/PrismicTable.vue.js";
|
|
7
7
|
import { getTableComponentProps_d_exports } from "./src/PrismicTable/getTableComponentProps.js";
|
|
8
8
|
import "./src/PrismicTable/index.js";
|
|
@@ -16,4 +16,4 @@ import { getSliceComponentProps } from "./src/SliceZone/getSliceComponentProps.j
|
|
|
16
16
|
import { defineSliceZoneComponents } from "./src/SliceZone/defineSliceZoneComponents.js";
|
|
17
17
|
import "./src/SliceZone/index.js";
|
|
18
18
|
import { PrismicPlugin, PrismicPluginConfig, createPrismic, usePrismic } from "./src/createPrismic.js";
|
|
19
|
-
export { _default as PrismicImage, type PrismicImageProps, _default$1 as PrismicLink, type PrismicLinkProps, type PrismicPlugin, type PrismicPluginConfig, _default$2 as PrismicRichText, type PrismicRichTextProps, _default$3 as PrismicTable, type PrismicTableProps, _default$4 as PrismicText, type PrismicTextProps, type SliceComponentProps, type SliceComponentType, type SliceLike, type SliceLikeGraphQL, type SliceLikeRestV2, _default$5 as SliceZone, type SliceZoneComponents, type SliceZoneLike, type SliceZoneProps, TODOSliceComponent, type
|
|
19
|
+
export { _default as PrismicImage, type PrismicImageProps, _default$1 as PrismicLink, type PrismicLinkProps, type PrismicPlugin, type PrismicPluginConfig, _default$2 as PrismicRichText, type PrismicRichTextProps, _default$3 as PrismicTable, type PrismicTableProps, _default$4 as PrismicText, type PrismicTextProps, type RichTextComponentProps, type RichTextComponents, type SliceComponentProps, type SliceComponentType, type SliceLike, type SliceLikeGraphQL, type SliceLikeRestV2, _default$5 as SliceZone, type SliceZoneComponents, type SliceZoneLike, type SliceZoneProps, TODOSliceComponent, type TableComponents, createPrismic, defineSliceZoneComponents, getRichTextComponentProps, getSliceComponentProps, getTableComponentProps_d_exports as getTableComponentProps, usePrismic };
|
package/dist/package.cjs
CHANGED
package/dist/package.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue16 from "vue";
|
|
2
2
|
import { ImageField, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/PrismicImage.vue.d.ts
|
|
@@ -64,7 +64,7 @@ type PrismicImageProps = {
|
|
|
64
64
|
*/
|
|
65
65
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
66
66
|
});
|
|
67
|
-
declare const __VLS_export:
|
|
67
|
+
declare const __VLS_export: vue16.DefineComponent<({
|
|
68
68
|
/** The Prismic image field or thumbnail to render. */
|
|
69
69
|
field: ImageField | ImageField<string>;
|
|
70
70
|
/**
|
|
@@ -162,7 +162,7 @@ declare const __VLS_export: vue9.DefineComponent<({
|
|
|
162
162
|
* densities will be used: 1, 2, 3.
|
|
163
163
|
*/
|
|
164
164
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
165
|
-
}), {}, {}, {}, {},
|
|
165
|
+
}), {}, {}, {}, {}, vue16.ComponentOptionsMixin, vue16.ComponentOptionsMixin, {}, string, vue16.PublicProps, Readonly<({
|
|
166
166
|
/** The Prismic image field or thumbnail to render. */
|
|
167
167
|
field: ImageField | ImageField<string>;
|
|
168
168
|
/**
|
|
@@ -260,7 +260,7 @@ declare const __VLS_export: vue9.DefineComponent<({
|
|
|
260
260
|
* densities will be used: 1, 2, 3.
|
|
261
261
|
*/
|
|
262
262
|
pixelDensities: NonNullable<Parameters<typeof asImagePixelDensitySrcSet>[1]>["pixelDensities"] | "defaults";
|
|
263
|
-
})> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
263
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, vue16.ComponentProvideOptions, false, {}, any>;
|
|
264
264
|
declare const _default: typeof __VLS_export;
|
|
265
265
|
//#endregion
|
|
266
266
|
export { PrismicImageProps, _default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicImage.vue.d.ts","names":[],"sources":["../../src/PrismicImage.vue"],"sourcesContent":[],"mappings":";;;;;KAgNY,iBAAA;EAAA;EAEJ,KAAA,EAAA,UAAA,GAAa,UAAb,CAAA,MAAA,CAAA;EAAa;;;;;EAsDf,WAAA,CAAA,EA/CS,UA+CT,CAAA,OA/C2B,UA+C3B,CAAA,CAAA,CAAA,CAAA;EAekB;;;;AAIvB;;EAzEoB,GAAA,CAAA,EAAA,EAAA;EAOY;;;;;;;EAAA,WAAA,CAAA,EAAA,EAAA;EAAlB;;;;;;;EAPP;;;;;;EAsDF,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA;CAtDE,GAAA,CAAA;EAAa;;;;;;;;;;EAsMH,MAAA,CAAA,EAhJZ,WAgJY,CAhJA,UAgJA,CAAA,OAhJkB,kBAgJlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAAA,CAAA,GAAA,YAAA,GAAA,UAAA;EAAA,cAGsB,CAAA,EAAA,KAAA;;;;;;;;;kBArIlC,YACA,kBAAkB;;cAiIlB,
|
|
1
|
+
{"version":3,"file":"PrismicImage.vue.d.ts","names":[],"sources":["../../src/PrismicImage.vue"],"sourcesContent":[],"mappings":";;;;;KAgNY,iBAAA;EAAA;EAEJ,KAAA,EAAA,UAAA,GAAa,UAAb,CAAA,MAAA,CAAA;EAAa;;;;;EAsDf,WAAA,CAAA,EA/CS,UA+CT,CAAA,OA/C2B,UA+C3B,CAAA,CAAA,CAAA,CAAA;EAekB;;;;AAIvB;;EAzEoB,GAAA,CAAA,EAAA,EAAA;EAOY;;;;;;;EAAA,WAAA,CAAA,EAAA,EAAA;EAAlB;;;;;;;EAPP;;;;;;EAsDF,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA;CAtDE,GAAA,CAAA;EAAa;;;;;;;;;;EAsMH,MAAA,CAAA,EAhJZ,WAgJY,CAhJA,UAgJA,CAAA,OAhJkB,kBAgJlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAAA,CAAA,GAAA,YAAA,GAAA,UAAA;EAAA,cAGsB,CAAA,EAAA,KAAA;;;;;;;;;kBArIlC,YACA,kBAAkB;;cAiIlB,oBAAY;;SAtMV,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA+C3B,YAAY,kBAAkB;;;;SAtD5B,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6D3B,YACA,kBAAkB;oBADP,KAAA,CAAA,qBAAA;;SApET,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA+C3B,YAAY,kBAAkB;;;;SAtD5B,aAAa;;;;;;gBAON,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6D3B,YACA,kBAAkB;;cAiIN,iBAGU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicLink.cjs","names":[],"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 \"./createPrismic\"\n\n/** The default component rendered for internal URLs. */\nconst defaultInternalComponent = \"router-link\"\n\n/** The default component rendered for external URLs. */\nconst defaultExternalComponent = \"a\"\n\n/** The default rel attribute rendered for external URLs. */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/** Props for `<PrismicLink />`. */\nexport type PrismicLinkProps = {\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * 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\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * The component rendered for internal URLs.\n\t *\n\t * If your app uses a client-side router that requires a special Link\n\t * component, provide the Link component to this prop.\n\t *\n\t * @defaultValue `<RouterLink>`\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The component rendered for external URLs.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/** The Prismic link field to render. */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/** The Prismic document to render as a link. */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { componentsConfig } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver,\n\t\trel(args) {\n\t\t\tif (props.rel) {\n\t\t\t\treturn typeof props.rel === \"function\" ? props.rel(args) : props.rel\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\tcomponentsConfig?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\tcomponentsConfig?.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"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"PrismicLink.cjs","names":[],"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 \"./createPrismic\"\n\n/** The default component rendered for internal URLs. */\nconst defaultInternalComponent = \"router-link\"\n\n/** The default component rendered for external URLs. */\nconst defaultExternalComponent = \"a\"\n\n/** The default rel attribute rendered for external URLs. */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/** Props for `<PrismicLink />`. */\nexport type PrismicLinkProps = {\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * 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\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * The component rendered for internal URLs.\n\t *\n\t * If your app uses a client-side router that requires a special Link\n\t * component, provide the Link component to this prop.\n\t *\n\t * @defaultValue `<RouterLink>`\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The component rendered for external URLs.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/** The Prismic link field to render. */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/** The Prismic document to render as a link. */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { componentsConfig } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver || componentsConfig?.linkResolver,\n\t\trel(args) {\n\t\t\tif (props.rel) {\n\t\t\t\treturn typeof props.rel === \"function\" ? props.rel(args) : props.rel\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\tcomponentsConfig?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\tcomponentsConfig?.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"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicLink.js","names":[],"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 \"./createPrismic\"\n\n/** The default component rendered for internal URLs. */\nconst defaultInternalComponent = \"router-link\"\n\n/** The default component rendered for external URLs. */\nconst defaultExternalComponent = \"a\"\n\n/** The default rel attribute rendered for external URLs. */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/** Props for `<PrismicLink />`. */\nexport type PrismicLinkProps = {\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * 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\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * The component rendered for internal URLs.\n\t *\n\t * If your app uses a client-side router that requires a special Link\n\t * component, provide the Link component to this prop.\n\t *\n\t * @defaultValue `<RouterLink>`\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The component rendered for external URLs.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/** The Prismic link field to render. */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/** The Prismic document to render as a link. */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { componentsConfig } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver,\n\t\trel(args) {\n\t\t\tif (props.rel) {\n\t\t\t\treturn typeof props.rel === \"function\" ? props.rel(args) : props.rel\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\tcomponentsConfig?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\tcomponentsConfig?.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"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"PrismicLink.js","names":[],"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 \"./createPrismic\"\n\n/** The default component rendered for internal URLs. */\nconst defaultInternalComponent = \"router-link\"\n\n/** The default component rendered for external URLs. */\nconst defaultExternalComponent = \"a\"\n\n/** The default rel attribute rendered for external URLs. */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/** Props for `<PrismicLink />`. */\nexport type PrismicLinkProps = {\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * 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\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * The component rendered for internal URLs.\n\t *\n\t * If your app uses a client-side router that requires a special Link\n\t * component, provide the Link component to this prop.\n\t *\n\t * @defaultValue `<RouterLink>`\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The component rendered for external URLs.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/** The Prismic link field to render. */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/** The Prismic document to render as a link. */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { componentsConfig } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver || componentsConfig?.linkResolver,\n\t\trel(args) {\n\t\t\tif (props.rel) {\n\t\t\t\treturn typeof props.rel === \"function\" ? props.rel(args) : props.rel\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\tcomponentsConfig?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\tcomponentsConfig?.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"],"mappings":""}
|