@prismicio/vue 5.3.0-pr.86.915aa0e → 5.3.0-pr.88.ee9acb6
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/PrismicRichText/PrismicRichText.vue.d.cts +12 -36
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts.map +1 -1
- package/dist/PrismicRichText/types.d.cts +3 -3
- package/dist/PrismicRichText/types.d.cts.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue.d.cts.map +1 -1
- package/dist/PrismicTable/types.d.cts +1 -2
- package/dist/PrismicTable/types.d.cts.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.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 +12 -36
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +39 -22
- 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 +39 -22
- 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 +6 -26
- 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 +6 -26
- 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 +7 -48
- 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 +7 -48
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/types.d.ts +3 -3
- 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.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +42 -14
- 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 +42 -14
- 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 +13 -10
- 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 +14 -11
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicTable/types.d.ts +1 -2
- package/dist/src/PrismicTable/types.d.ts.map +1 -1
- package/dist/src/types.cjs +9 -0
- package/dist/src/types.cjs.map +1 -0
- package/dist/src/types.d.ts +3 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +8 -0
- package/dist/src/types.js.map +1 -0
- package/dist/types.d.cts +3 -2
- package/dist/types.d.cts.map +1 -1
- package/package.json +1 -1
- package/src/PrismicRichText/PrismicRichText.vue +62 -43
- package/src/PrismicRichText/PrismicRichTextDefaultComponent.vue +38 -22
- package/src/PrismicRichText/PrismicRichTextSerialize.vue +5 -51
- package/src/PrismicRichText/types.ts +17 -13
- package/src/PrismicTable/PrismicTable.vue +39 -12
- package/src/PrismicTable/PrismicTableDefaultComponents.ts +14 -8
- package/src/PrismicTable/PrismicTableRow.vue +17 -24
- package/src/PrismicTable/types.ts +14 -11
- package/src/types.ts +31 -1
- package/src/lib/Wrapper.vue +0 -22
|
@@ -13,18 +13,6 @@ type PrismicRichTextProps = {
|
|
|
13
13
|
* The Prismic rich text or title field to render.
|
|
14
14
|
*/
|
|
15
15
|
field: RichTextField | null | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* An object that maps a rich text block type to a Vue component.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* ```javascript
|
|
22
|
-
* {
|
|
23
|
-
* heading1: Heading1,
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
components?: VueRichTextSerializer;
|
|
28
16
|
/**
|
|
29
17
|
* A link resolver function used to resolve link when not using the route
|
|
30
18
|
* resolver parameter with `@prismicio/client`.
|
|
@@ -35,17 +23,17 @@ type PrismicRichTextProps = {
|
|
|
35
23
|
*/
|
|
36
24
|
linkResolver?: LinkResolverFunction;
|
|
37
25
|
/**
|
|
38
|
-
*
|
|
26
|
+
* An object that maps a rich text block type to a Vue component.
|
|
39
27
|
*
|
|
40
|
-
* @
|
|
41
|
-
*/
|
|
42
|
-
internalLinkComponent?: ComponentOrTagName;
|
|
43
|
-
/**
|
|
44
|
-
* The Vue component rendered for links when the URL is external.
|
|
28
|
+
* @example
|
|
45
29
|
*
|
|
46
|
-
*
|
|
30
|
+
* ```javascript
|
|
31
|
+
* {
|
|
32
|
+
* heading1: Heading1,
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
47
35
|
*/
|
|
48
|
-
|
|
36
|
+
components?: VueRichTextSerializer;
|
|
49
37
|
/**
|
|
50
38
|
* The value to be rendered when the field is empty. If a fallback is not
|
|
51
39
|
* given, `null` (nothing) will be rendered.
|
|
@@ -56,17 +44,11 @@ declare const __VLS_export: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
|
56
44
|
field: {
|
|
57
45
|
type: PropType<PrismicRichTextProps["field"]>;
|
|
58
46
|
};
|
|
59
|
-
components: {
|
|
60
|
-
type: PropType<PrismicRichTextProps["components"]>;
|
|
61
|
-
};
|
|
62
47
|
linkResolver: {
|
|
63
48
|
type: PropType<PrismicRichTextProps["linkResolver"]>;
|
|
64
49
|
};
|
|
65
|
-
|
|
66
|
-
type: PropType<PrismicRichTextProps["
|
|
67
|
-
};
|
|
68
|
-
externalLinkComponent: {
|
|
69
|
-
type: PropType<PrismicRichTextProps["externalLinkComponent"]>;
|
|
50
|
+
components: {
|
|
51
|
+
type: PropType<PrismicRichTextProps["components"]>;
|
|
70
52
|
};
|
|
71
53
|
fallback: {
|
|
72
54
|
type: PropType<PrismicRichTextProps["fallback"]>;
|
|
@@ -75,17 +57,11 @@ declare const __VLS_export: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
|
75
57
|
field: {
|
|
76
58
|
type: PropType<PrismicRichTextProps["field"]>;
|
|
77
59
|
};
|
|
78
|
-
components: {
|
|
79
|
-
type: PropType<PrismicRichTextProps["components"]>;
|
|
80
|
-
};
|
|
81
60
|
linkResolver: {
|
|
82
61
|
type: PropType<PrismicRichTextProps["linkResolver"]>;
|
|
83
62
|
};
|
|
84
|
-
|
|
85
|
-
type: PropType<PrismicRichTextProps["
|
|
86
|
-
};
|
|
87
|
-
externalLinkComponent: {
|
|
88
|
-
type: PropType<PrismicRichTextProps["externalLinkComponent"]>;
|
|
63
|
+
components: {
|
|
64
|
+
type: PropType<PrismicRichTextProps["components"]>;
|
|
89
65
|
};
|
|
90
66
|
fallback: {
|
|
91
67
|
type: PropType<PrismicRichTextProps["fallback"]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicRichText.vue.d.cts","names":[],"sources":["../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PrismicRichText.vue.d.cts","names":[],"sources":["../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;AA4JY,KAAA,oBAAA,GAAoB;EAIxB;;;EA6BI,KAAA,EA7BJ,aA6BI,GAAA,IAAA,GAAA,SAAA;EAAkB;AAC7B;;;;;;;EA4HE,YAAA,CAAA,EAhJa,oBAgJb;EADmC;;;;;;;;;;;EACnC,UAAA,CAAA,EAnIW,qBAmIX;EADmC;;;;aA5H1B;;cAgHN,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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RTAnyNode, RichTextNodeType } from "@prismicio/client";
|
|
1
|
+
import { VueComponent } from "../types.cjs";
|
|
2
|
+
import { LinkResolverFunction, RTAnyNode, RichTextNodeType } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/PrismicRichText/types.d.ts
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ type RichTextComponentProps<TRTNode extends RTAnyNode = RTAnyNode> = {
|
|
|
21
21
|
*
|
|
22
22
|
* @typeParam TRTNode - The type of rich text node(s) this component handles
|
|
23
23
|
*/
|
|
24
|
-
type VueRichTextComponent<TRTNode extends RTAnyNode = RTAnyNode> =
|
|
24
|
+
type VueRichTextComponent<TRTNode extends RTAnyNode = RTAnyNode> = VueComponent<RichTextComponentProps<TRTNode>>;
|
|
25
25
|
/**
|
|
26
26
|
* A shorthand definition for {@link VueRichTextSerializer} component types.
|
|
27
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/PrismicRichText/types.ts"],"sourcesContent":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/PrismicRichText/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAcA;;;;AACC,KADW,qBAAA,GAAwB,OACnC,CAAA,MAAA,CAAA,MAAA,OAAoB,gBAApB,EAAsC,oBAAtC,GAA6D,YAA7D,CAAA,CAAA;;;AAMD;AAAmD,KAAvC,sBAAuC,CAAA,gBAAA,SAAA,GAAY,SAAZ,CAAA,GAAA;EAAY,IAAA,EACxD,OADwD;CACxD;;AACN;;;;KAOI,oBACJ,CAAA,gBADyC,SACzC,GADqD,SACrD,CAAA,GADkE,YAClE,CAAA,sBAAA,CAAuB,OAAvB,CAAA,CAAA;;;AAMD;KAAY,YAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTable.vue.d.cts","names":[],"sources":["../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PrismicTable.vue.d.cts","names":[],"sources":["../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;AA4HY,KAAA,iBAAA,GAAiB;EAIrB;;;EAmBI,KAAA,EAnBJ,UAmBI,GAAA,SAAA;EAAkB;AAC7B;;;;;;;;;;EAiJiB,UAAA,CAAA,EAxJJ,kBAwJI,GAxJiB,qBAwJjB;EAAA;;;;aAlJN;;cAkJN,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,5 +1,5 @@
|
|
|
1
|
+
import { VueComponent } from "../types.cjs";
|
|
1
2
|
import { VueShorthand } from "../PrismicRichText/types.cjs";
|
|
2
|
-
import { DefineComponent, FunctionalComponent, defineAsyncComponent } from "vue";
|
|
3
3
|
import { TableField, TableFieldBody, TableFieldBodyRow, TableFieldDataCell, TableFieldHead, TableFieldHeadRow, TableFieldHeaderCell } from "@prismicio/client";
|
|
4
4
|
|
|
5
5
|
//#region src/PrismicTable/types.d.ts
|
|
@@ -30,7 +30,6 @@ type VueTableComponents = {
|
|
|
30
30
|
cell: TableFieldDataCell;
|
|
31
31
|
}> | VueShorthand;
|
|
32
32
|
};
|
|
33
|
-
type VueComponent<TProps> = ReturnType<typeof defineAsyncComponent> | DefineComponent<TProps> | FunctionalComponent<TProps>;
|
|
34
33
|
//#endregion
|
|
35
34
|
export { VueTableComponents };
|
|
36
35
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/PrismicTable/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/PrismicTable/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;;;;AAE8B,KAFlB,kBAAA,GAEkB;EAArB,KAAA,CAAA,EADA,YACA,CAAA;IAAyC,KAAA,EADnB,UACmB,CAAA,QAAA,CAAA;EACpB,CAAA,CAAA,GAF2B,YAE3B;EAArB,KAAA,CAAA,EADA,YACA,CAAA;IAAyC,IAAA,EADpB,cACoB;EAE1B,CAAA,CAAA,GAH0B,YAG1B;EAAoB,KAAA,CAAA,EAFnC,YAEmC,CAAA;IAAxC,IAAA,EAF0B,cAE1B;EACA,CAAA,CAAA,GAH8C,YAG9C;EACuB,EAAA,CAAA,EAFvB,YAEuB,CAAA;IAArB,GAAA,EAFkB,iBAElB,GAFsC,iBAEtC;EAA+C,CAAA,CAAA,GADjD,YACiD;EAC1B,EAAA,CAAA,EADrB,YACqB,CAAA;IAArB,IAAA,EADqB,oBACrB;EAA6C,CAAA,CAAA,GADE,YACF;EAAY,EAAA,CAAA,EAAzD,YAAyD,CAAA;UAApC;OAAwB"}
|
package/dist/package.cjs
CHANGED
package/dist/package.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.cjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"@prismicio/vue\",\n\t\"version\": \"5.3.0-pr.
|
|
1
|
+
{"version":3,"file":"package.cjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"@prismicio/vue\",\n\t\"version\": \"5.3.0-pr.88.ee9acb6\",\n\t\"description\": \"Vue plugin, components, and composables to fetch and present Prismic content\",\n\t\"keywords\": [\n\t\t\"typescript\",\n\t\t\"prismic\",\n\t\t\"vue\",\n\t\t\"plugin\"\n\t],\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"ssh://git@github.com/prismicio/prismic-vue.git\"\n\t},\n\t\"license\": \"Apache-2.0\",\n\t\"author\": \"Prismic <contact@prismic.io> (https://prismic.io)\",\n\t\"sideEffects\": false,\n\t\"type\": \"module\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"require\": \"./dist/index.cjs\",\n\t\t\t\"import\": \"./dist/index.js\"\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"main\": \"./dist/index.cjs\",\n\t\"module\": \"./dist/index.js\",\n\t\"types\": \"./dist/index.d.cts\",\n\t\"files\": [\n\t\t\"./dist\",\n\t\t\"./src\"\n\t],\n\t\"scripts\": {\n\t\t\"build\": \"tsdown\",\n\t\t\"dev\": \"tsdown --watch\",\n\t\t\"format\": \"prettier --write .\",\n\t\t\"playground:build\": \"vite build playground\",\n\t\t\"playground:dev\": \"vite playground\",\n\t\t\"prepare\": \"npm run build\",\n\t\t\"lint\": \"oxlint --deny-warnings\",\n\t\t\"types\": \"vue-tsc --noEmit\",\n\t\t\"unit\": \"vitest run --coverage\",\n\t\t\"unit:watch\": \"vitest watch\",\n\t\t\"test\": \"npm run lint && npm run types && npm run unit && npm run build\"\n\t},\n\t\"dependencies\": {\n\t\t\"esm-env\": \"^1.2.2\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@prismicio/client\": \"^7.21.0\",\n\t\t\"@prismicio/mock\": \"^0.7.1\",\n\t\t\"@trivago/prettier-plugin-sort-imports\": \"^6.0.0\",\n\t\t\"@types/jsdom-global\": \"^3.0.7\",\n\t\t\"@vitejs/plugin-vue\": \"^6.0.2\",\n\t\t\"@vitest/coverage-v8\": \"^4.0.15\",\n\t\t\"@vue/test-utils\": \"^2.4.6\",\n\t\t\"jsdom\": \"^27.3.0\",\n\t\t\"jsdom-global\": \"^3.0.2\",\n\t\t\"oxlint\": \"1.32.0\",\n\t\t\"prettier\": \"^3.7.4\",\n\t\t\"prettier-plugin-jsdoc\": \"^1.8.0\",\n\t\t\"tsdown\": \"0.17.2\",\n\t\t\"typescript\": \"^5.9.3\",\n\t\t\"vite\": \"^7.2.7\",\n\t\t\"vitest\": \"^4.0.15\",\n\t\t\"vue\": \"^3.5.25\",\n\t\t\"vue-router\": \"^4.6.3\",\n\t\t\"vue-tsc\": \"^3.1.8\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@prismicio/client\": \"^7\",\n\t\t\"vue\": \"^3\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=20\"\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t}\n}\n"],"mappings":";;cAEY"}
|
package/dist/package.js
CHANGED
package/dist/package.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"@prismicio/vue\",\n\t\"version\": \"5.3.0-pr.
|
|
1
|
+
{"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n\t\"name\": \"@prismicio/vue\",\n\t\"version\": \"5.3.0-pr.88.ee9acb6\",\n\t\"description\": \"Vue plugin, components, and composables to fetch and present Prismic content\",\n\t\"keywords\": [\n\t\t\"typescript\",\n\t\t\"prismic\",\n\t\t\"vue\",\n\t\t\"plugin\"\n\t],\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"ssh://git@github.com/prismicio/prismic-vue.git\"\n\t},\n\t\"license\": \"Apache-2.0\",\n\t\"author\": \"Prismic <contact@prismic.io> (https://prismic.io)\",\n\t\"sideEffects\": false,\n\t\"type\": \"module\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"require\": \"./dist/index.cjs\",\n\t\t\t\"import\": \"./dist/index.js\"\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"main\": \"./dist/index.cjs\",\n\t\"module\": \"./dist/index.js\",\n\t\"types\": \"./dist/index.d.cts\",\n\t\"files\": [\n\t\t\"./dist\",\n\t\t\"./src\"\n\t],\n\t\"scripts\": {\n\t\t\"build\": \"tsdown\",\n\t\t\"dev\": \"tsdown --watch\",\n\t\t\"format\": \"prettier --write .\",\n\t\t\"playground:build\": \"vite build playground\",\n\t\t\"playground:dev\": \"vite playground\",\n\t\t\"prepare\": \"npm run build\",\n\t\t\"lint\": \"oxlint --deny-warnings\",\n\t\t\"types\": \"vue-tsc --noEmit\",\n\t\t\"unit\": \"vitest run --coverage\",\n\t\t\"unit:watch\": \"vitest watch\",\n\t\t\"test\": \"npm run lint && npm run types && npm run unit && npm run build\"\n\t},\n\t\"dependencies\": {\n\t\t\"esm-env\": \"^1.2.2\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@prismicio/client\": \"^7.21.0\",\n\t\t\"@prismicio/mock\": \"^0.7.1\",\n\t\t\"@trivago/prettier-plugin-sort-imports\": \"^6.0.0\",\n\t\t\"@types/jsdom-global\": \"^3.0.7\",\n\t\t\"@vitejs/plugin-vue\": \"^6.0.2\",\n\t\t\"@vitest/coverage-v8\": \"^4.0.15\",\n\t\t\"@vue/test-utils\": \"^2.4.6\",\n\t\t\"jsdom\": \"^27.3.0\",\n\t\t\"jsdom-global\": \"^3.0.2\",\n\t\t\"oxlint\": \"1.32.0\",\n\t\t\"prettier\": \"^3.7.4\",\n\t\t\"prettier-plugin-jsdoc\": \"^1.8.0\",\n\t\t\"tsdown\": \"0.17.2\",\n\t\t\"typescript\": \"^5.9.3\",\n\t\t\"vite\": \"^7.2.7\",\n\t\t\"vitest\": \"^4.0.15\",\n\t\t\"vue\": \"^3.5.25\",\n\t\t\"vue-router\": \"^4.6.3\",\n\t\t\"vue-tsc\": \"^3.1.8\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@prismicio/client\": \"^7\",\n\t\t\"vue\": \"^3\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=20\"\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t}\n}\n"],"mappings":";cAEY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicRichText.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n\
|
|
1
|
+
{"version":3,"file":"PrismicRichText.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport { type ComponentOrTagName, isVueComponent } from \"../types\"\nimport type {\n\tInternalVueRichTextComponent,\n\tVueRichTextSerializer,\n\tVueShorthand,\n} from \"./types\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/**\n * Props for `<PrismicRichText />`.\n */\nexport type PrismicRichTextProps = {\n\t/**\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 object that maps a rich text block type to a Vue component.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueRichTextSerializer\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` (nothing) will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = props.components?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tprops: {\n\t\t\tlinkResolver: props.linkResolver,\n\t\t\tshorthand: maybeComponentOrShorthand as VueShorthand,\n\t\t},\n\t}\n}\n\nconst internalComponents = computed<InternalVueRichTextComponent>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicRichText.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n\
|
|
1
|
+
{"version":3,"file":"PrismicRichText.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport { type ComponentOrTagName, isVueComponent } from \"../types\"\nimport type {\n\tInternalVueRichTextComponent,\n\tVueRichTextSerializer,\n\tVueShorthand,\n} from \"./types\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/**\n * Props for `<PrismicRichText />`.\n */\nexport type PrismicRichTextProps = {\n\t/**\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 object that maps a rich text block type to a Vue component.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueRichTextSerializer\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` (nothing) will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = props.components?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tprops: {\n\t\t\tlinkResolver: props.linkResolver,\n\t\t\tshorthand: maybeComponentOrShorthand as VueShorthand,\n\t\t},\n\t}\n}\n\nconst internalComponents = computed<InternalVueRichTextComponent>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":""}
|
|
@@ -13,18 +13,6 @@ type PrismicRichTextProps = {
|
|
|
13
13
|
* The Prismic rich text or title field to render.
|
|
14
14
|
*/
|
|
15
15
|
field: RichTextField | null | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* An object that maps a rich text block type to a Vue component.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* ```javascript
|
|
22
|
-
* {
|
|
23
|
-
* heading1: Heading1,
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
components?: VueRichTextSerializer;
|
|
28
16
|
/**
|
|
29
17
|
* A link resolver function used to resolve link when not using the route
|
|
30
18
|
* resolver parameter with `@prismicio/client`.
|
|
@@ -35,17 +23,17 @@ type PrismicRichTextProps = {
|
|
|
35
23
|
*/
|
|
36
24
|
linkResolver?: LinkResolverFunction;
|
|
37
25
|
/**
|
|
38
|
-
*
|
|
26
|
+
* An object that maps a rich text block type to a Vue component.
|
|
39
27
|
*
|
|
40
|
-
* @
|
|
41
|
-
*/
|
|
42
|
-
internalLinkComponent?: ComponentOrTagName;
|
|
43
|
-
/**
|
|
44
|
-
* The Vue component rendered for links when the URL is external.
|
|
28
|
+
* @example
|
|
45
29
|
*
|
|
46
|
-
*
|
|
30
|
+
* ```javascript
|
|
31
|
+
* {
|
|
32
|
+
* heading1: Heading1,
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
47
35
|
*/
|
|
48
|
-
|
|
36
|
+
components?: VueRichTextSerializer;
|
|
49
37
|
/**
|
|
50
38
|
* The value to be rendered when the field is empty. If a fallback is not
|
|
51
39
|
* given, `null` (nothing) will be rendered.
|
|
@@ -56,17 +44,11 @@ declare const __VLS_export: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
|
56
44
|
field: {
|
|
57
45
|
type: PropType<PrismicRichTextProps["field"]>;
|
|
58
46
|
};
|
|
59
|
-
components: {
|
|
60
|
-
type: PropType<PrismicRichTextProps["components"]>;
|
|
61
|
-
};
|
|
62
47
|
linkResolver: {
|
|
63
48
|
type: PropType<PrismicRichTextProps["linkResolver"]>;
|
|
64
49
|
};
|
|
65
|
-
|
|
66
|
-
type: PropType<PrismicRichTextProps["
|
|
67
|
-
};
|
|
68
|
-
externalLinkComponent: {
|
|
69
|
-
type: PropType<PrismicRichTextProps["externalLinkComponent"]>;
|
|
50
|
+
components: {
|
|
51
|
+
type: PropType<PrismicRichTextProps["components"]>;
|
|
70
52
|
};
|
|
71
53
|
fallback: {
|
|
72
54
|
type: PropType<PrismicRichTextProps["fallback"]>;
|
|
@@ -75,17 +57,11 @@ declare const __VLS_export: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
|
75
57
|
field: {
|
|
76
58
|
type: PropType<PrismicRichTextProps["field"]>;
|
|
77
59
|
};
|
|
78
|
-
components: {
|
|
79
|
-
type: PropType<PrismicRichTextProps["components"]>;
|
|
80
|
-
};
|
|
81
60
|
linkResolver: {
|
|
82
61
|
type: PropType<PrismicRichTextProps["linkResolver"]>;
|
|
83
62
|
};
|
|
84
|
-
|
|
85
|
-
type: PropType<PrismicRichTextProps["
|
|
86
|
-
};
|
|
87
|
-
externalLinkComponent: {
|
|
88
|
-
type: PropType<PrismicRichTextProps["externalLinkComponent"]>;
|
|
63
|
+
components: {
|
|
64
|
+
type: PropType<PrismicRichTextProps["components"]>;
|
|
89
65
|
};
|
|
90
66
|
fallback: {
|
|
91
67
|
type: PropType<PrismicRichTextProps["fallback"]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicRichText.vue.d.ts","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PrismicRichText.vue.d.ts","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;AA4JY,KAAA,oBAAA,GAAoB;EAIxB;;;EA6BI,KAAA,EA7BJ,aA6BI,GAAA,IAAA,GAAA,SAAA;EAAkB;AAC7B;;;;;;;EA4HE,YAAA,CAAA,EAhJa,oBAgJb;EADmC;;;;;;;;;;;EACnC,UAAA,CAAA,EAnIW,qBAmIX;EADmC;;;;aA5H1B;;cAgHN,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,3 +1,5 @@
|
|
|
1
|
+
const require_types = require('../types.cjs');
|
|
2
|
+
const require_PrismicRichTextDefaultComponent = require('./PrismicRichTextDefaultComponent.cjs');
|
|
1
3
|
const require_PrismicRichTextSerialize = require('./PrismicRichTextSerialize.cjs');
|
|
2
4
|
let vue = require("vue");
|
|
3
5
|
let __prismicio_client_richtext = require("@prismicio/client/richtext");
|
|
@@ -8,18 +10,8 @@ var PrismicRichText_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
8
10
|
__name: "PrismicRichText",
|
|
9
11
|
props: {
|
|
10
12
|
field: { type: Array },
|
|
11
|
-
components: { type: Object },
|
|
12
13
|
linkResolver: { type: Function },
|
|
13
|
-
|
|
14
|
-
String,
|
|
15
|
-
Object,
|
|
16
|
-
Function
|
|
17
|
-
] },
|
|
18
|
-
externalLinkComponent: { type: [
|
|
19
|
-
String,
|
|
20
|
-
Object,
|
|
21
|
-
Function
|
|
22
|
-
] },
|
|
14
|
+
components: { type: Object },
|
|
23
15
|
fallback: { type: [
|
|
24
16
|
String,
|
|
25
17
|
Object,
|
|
@@ -31,21 +23,46 @@ var PrismicRichText_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
31
23
|
const children = (0, vue.computed)(() => {
|
|
32
24
|
return (0, __prismicio_client_richtext.asTree)(props.field || []).children;
|
|
33
25
|
});
|
|
26
|
+
function getInternalComponent(type) {
|
|
27
|
+
const maybeComponentOrShorthand = props.components?.[type];
|
|
28
|
+
if (require_types.isVueComponent(maybeComponentOrShorthand)) return { is: maybeComponentOrShorthand };
|
|
29
|
+
return {
|
|
30
|
+
is: require_PrismicRichTextDefaultComponent.default,
|
|
31
|
+
props: {
|
|
32
|
+
linkResolver: props.linkResolver,
|
|
33
|
+
shorthand: maybeComponentOrShorthand
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const internalComponents = (0, vue.computed)(() => {
|
|
38
|
+
return {
|
|
39
|
+
heading1: getInternalComponent("heading1"),
|
|
40
|
+
heading2: getInternalComponent("heading2"),
|
|
41
|
+
heading3: getInternalComponent("heading3"),
|
|
42
|
+
heading4: getInternalComponent("heading4"),
|
|
43
|
+
heading5: getInternalComponent("heading5"),
|
|
44
|
+
heading6: getInternalComponent("heading6"),
|
|
45
|
+
paragraph: getInternalComponent("paragraph"),
|
|
46
|
+
preformatted: getInternalComponent("preformatted"),
|
|
47
|
+
strong: getInternalComponent("strong"),
|
|
48
|
+
em: getInternalComponent("em"),
|
|
49
|
+
"list-item": getInternalComponent("listItem"),
|
|
50
|
+
"o-list-item": getInternalComponent("oListItem"),
|
|
51
|
+
"group-list-item": getInternalComponent("list"),
|
|
52
|
+
"group-o-list-item": getInternalComponent("oList"),
|
|
53
|
+
image: getInternalComponent("image"),
|
|
54
|
+
embed: getInternalComponent("embed"),
|
|
55
|
+
hyperlink: getInternalComponent("hyperlink"),
|
|
56
|
+
label: getInternalComponent("label"),
|
|
57
|
+
span: getInternalComponent("span")
|
|
58
|
+
};
|
|
59
|
+
});
|
|
34
60
|
return (_ctx, _cache) => {
|
|
35
61
|
return children.value.length ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_PrismicRichTextSerialize.default, {
|
|
36
62
|
key: 0,
|
|
37
63
|
children: children.value,
|
|
38
|
-
components:
|
|
39
|
-
|
|
40
|
-
"internal-link-component": __props.internalLinkComponent,
|
|
41
|
-
"external-link-component": __props.externalLinkComponent
|
|
42
|
-
}, null, 8, [
|
|
43
|
-
"children",
|
|
44
|
-
"components",
|
|
45
|
-
"link-resolver",
|
|
46
|
-
"internal-link-component",
|
|
47
|
-
"external-link-component"
|
|
48
|
-
])) : __props.fallback ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.fallback), { key: 1 })) : (0, vue.createCommentVNode)("v-if", true);
|
|
64
|
+
"internal-components": internalComponents.value
|
|
65
|
+
}, null, 8, ["children", "internal-components"])) : __props.fallback ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.fallback), { key: 1 })) : (0, vue.createCommentVNode)("v-if", true);
|
|
49
66
|
};
|
|
50
67
|
}
|
|
51
68
|
});
|
package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n\
|
|
1
|
+
{"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport { type ComponentOrTagName, isVueComponent } from \"../types\"\nimport type {\n\tInternalVueRichTextComponent,\n\tVueRichTextSerializer,\n\tVueShorthand,\n} from \"./types\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/**\n * Props for `<PrismicRichText />`.\n */\nexport type PrismicRichTextProps = {\n\t/**\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 object that maps a rich text block type to a Vue component.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueRichTextSerializer\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` (nothing) will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = props.components?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tprops: {\n\t\t\tlinkResolver: props.linkResolver,\n\t\t\tshorthand: maybeComponentOrShorthand as VueShorthand,\n\t\t},\n\t}\n}\n\nconst internalComponents = computed<InternalVueRichTextComponent>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EA6DA,MAAM,QAAQ;EAkBd,MAAM,mCAA0B;AAC/B,kDAAc,MAAM,SAAS,EAAE,CAAC,CAAC;IACjC;EAED,SAAS,qBAAqB,MAAqC;GAClE,MAAM,4BAA4B,MAAM,aAAa;AAErD,OAAI,6BAAe,0BAA0B,CAC5C,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI;IACJ,OAAO;KACN,cAAc,MAAM;KACpB,WAAW;KACX;IACF;;EAGD,MAAM,6CAAkE;AACvE,UAAO;IACN,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,WAAW,qBAAqB,YAAY;IAC5C,cAAc,qBAAqB,eAAe;IAClD,QAAQ,qBAAqB,SAAS;IACtC,IAAI,qBAAqB,KAAK;IAC9B,aAAa,qBAAqB,WAAW;IAC7C,eAAe,qBAAqB,YAAY;IAChD,mBAAmB,qBAAqB,OAAO;IAC/C,qBAAqB,qBAAqB,QAAQ;IAClD,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,WAAW,qBAAqB,YAAY;IAC5C,OAAO,qBAAqB,QAAQ;IACpC,MAAM,qBAAqB,OAAO;IACnC;IACA;;UAKO,SAAA,MAAS,qDAGd,0CAAA;;IAFA,UAAU,SAAA;IACV,uBAAqB,mBAAA;uDAED,QAAA,wFAAe,QAAA,SAAQ,EAAA,EAAA,KAAA,GAAA,CAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isVueComponent } from "../types.js";
|
|
2
|
+
import PrismicRichTextDefaultComponent_default from "./PrismicRichTextDefaultComponent.js";
|
|
1
3
|
import PrismicRichTextSerialize_default from "./PrismicRichTextSerialize.js";
|
|
2
4
|
import { computed, createBlock, createCommentVNode, defineComponent, openBlock, resolveDynamicComponent } from "vue";
|
|
3
5
|
import { asTree } from "@prismicio/client/richtext";
|
|
@@ -8,18 +10,8 @@ var PrismicRichText_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
8
10
|
__name: "PrismicRichText",
|
|
9
11
|
props: {
|
|
10
12
|
field: { type: Array },
|
|
11
|
-
components: { type: Object },
|
|
12
13
|
linkResolver: { type: Function },
|
|
13
|
-
|
|
14
|
-
String,
|
|
15
|
-
Object,
|
|
16
|
-
Function
|
|
17
|
-
] },
|
|
18
|
-
externalLinkComponent: { type: [
|
|
19
|
-
String,
|
|
20
|
-
Object,
|
|
21
|
-
Function
|
|
22
|
-
] },
|
|
14
|
+
components: { type: Object },
|
|
23
15
|
fallback: { type: [
|
|
24
16
|
String,
|
|
25
17
|
Object,
|
|
@@ -31,21 +23,46 @@ var PrismicRichText_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
31
23
|
const children = computed(() => {
|
|
32
24
|
return asTree(props.field || []).children;
|
|
33
25
|
});
|
|
26
|
+
function getInternalComponent(type) {
|
|
27
|
+
const maybeComponentOrShorthand = props.components?.[type];
|
|
28
|
+
if (isVueComponent(maybeComponentOrShorthand)) return { is: maybeComponentOrShorthand };
|
|
29
|
+
return {
|
|
30
|
+
is: PrismicRichTextDefaultComponent_default,
|
|
31
|
+
props: {
|
|
32
|
+
linkResolver: props.linkResolver,
|
|
33
|
+
shorthand: maybeComponentOrShorthand
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const internalComponents = computed(() => {
|
|
38
|
+
return {
|
|
39
|
+
heading1: getInternalComponent("heading1"),
|
|
40
|
+
heading2: getInternalComponent("heading2"),
|
|
41
|
+
heading3: getInternalComponent("heading3"),
|
|
42
|
+
heading4: getInternalComponent("heading4"),
|
|
43
|
+
heading5: getInternalComponent("heading5"),
|
|
44
|
+
heading6: getInternalComponent("heading6"),
|
|
45
|
+
paragraph: getInternalComponent("paragraph"),
|
|
46
|
+
preformatted: getInternalComponent("preformatted"),
|
|
47
|
+
strong: getInternalComponent("strong"),
|
|
48
|
+
em: getInternalComponent("em"),
|
|
49
|
+
"list-item": getInternalComponent("listItem"),
|
|
50
|
+
"o-list-item": getInternalComponent("oListItem"),
|
|
51
|
+
"group-list-item": getInternalComponent("list"),
|
|
52
|
+
"group-o-list-item": getInternalComponent("oList"),
|
|
53
|
+
image: getInternalComponent("image"),
|
|
54
|
+
embed: getInternalComponent("embed"),
|
|
55
|
+
hyperlink: getInternalComponent("hyperlink"),
|
|
56
|
+
label: getInternalComponent("label"),
|
|
57
|
+
span: getInternalComponent("span")
|
|
58
|
+
};
|
|
59
|
+
});
|
|
34
60
|
return (_ctx, _cache) => {
|
|
35
61
|
return children.value.length ? (openBlock(), createBlock(PrismicRichTextSerialize_default, {
|
|
36
62
|
key: 0,
|
|
37
63
|
children: children.value,
|
|
38
|
-
components:
|
|
39
|
-
|
|
40
|
-
"internal-link-component": __props.internalLinkComponent,
|
|
41
|
-
"external-link-component": __props.externalLinkComponent
|
|
42
|
-
}, null, 8, [
|
|
43
|
-
"children",
|
|
44
|
-
"components",
|
|
45
|
-
"link-resolver",
|
|
46
|
-
"internal-link-component",
|
|
47
|
-
"external-link-component"
|
|
48
|
-
])) : __props.fallback ? (openBlock(), createBlock(resolveDynamicComponent(__props.fallback), { key: 1 })) : createCommentVNode("v-if", true);
|
|
64
|
+
"internal-components": internalComponents.value
|
|
65
|
+
}, null, 8, ["children", "internal-components"])) : __props.fallback ? (openBlock(), createBlock(resolveDynamicComponent(__props.fallback), { key: 1 })) : createCommentVNode("v-if", true);
|
|
49
66
|
};
|
|
50
67
|
}
|
|
51
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n\
|
|
1
|
+
{"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport { type ComponentOrTagName, isVueComponent } from \"../types\"\nimport type {\n\tInternalVueRichTextComponent,\n\tVueRichTextSerializer,\n\tVueShorthand,\n} from \"./types\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/**\n * Props for `<PrismicRichText />`.\n */\nexport type PrismicRichTextProps = {\n\t/**\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 object that maps a rich text block type to a Vue component.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueRichTextSerializer\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` (nothing) will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = props.components?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tprops: {\n\t\t\tlinkResolver: props.linkResolver,\n\t\t\tshorthand: maybeComponentOrShorthand as VueShorthand,\n\t\t},\n\t}\n}\n\nconst internalComponents = computed<InternalVueRichTextComponent>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EA6DA,MAAM,QAAQ;EAkBd,MAAM,WAAW,eAAe;AAC/B,UAAO,OAAO,MAAM,SAAS,EAAE,CAAC,CAAC;IACjC;EAED,SAAS,qBAAqB,MAAqC;GAClE,MAAM,4BAA4B,MAAM,aAAa;AAErD,OAAI,eAAe,0BAA0B,CAC5C,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI;IACJ,OAAO;KACN,cAAc,MAAM;KACpB,WAAW;KACX;IACF;;EAGD,MAAM,qBAAqB,eAA6C;AACvE,UAAO;IACN,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,WAAW,qBAAqB,YAAY;IAC5C,cAAc,qBAAqB,eAAe;IAClD,QAAQ,qBAAqB,SAAS;IACtC,IAAI,qBAAqB,KAAK;IAC9B,aAAa,qBAAqB,WAAW;IAC7C,eAAe,qBAAqB,YAAY;IAChD,mBAAmB,qBAAqB,OAAO;IAC/C,qBAAqB,qBAAqB,QAAQ;IAClD,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,WAAW,qBAAqB,YAAY;IAC5C,OAAO,qBAAqB,QAAQ;IACpC,MAAM,qBAAqB,OAAO;IACnC;IACA;;UAKO,SAAA,MAAS,uBADhB,YAIE,kCAAA;;IAFA,UAAU,SAAA;IACV,uBAAqB,mBAAA;uDAED,QAAA,yBAAtB,YAAiD,wBAAZ,QAAA,SAAQ,EAAA,EAAA,KAAA,GAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicRichTextDefaultComponent.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type {
|
|
1
|
+
{"version":3,"file":"PrismicRichTextDefaultComponent.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { RichTextComponentProps, VueShorthand } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: VueShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" && props.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\n\nconst dir = computed(() => {\n\treturn \"direction\" in props.node && props.node.direction === \"rtl\"\n\t\t? \"rtl\"\n\t\t: undefined\n})\n</script>\n\n<template>\n\t<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ol>\n\t<p class=\"block-img\" v-else-if=\"node.type === 'image'\">\n\t\t<PrismicLink v-if=\"node.linkTo\" :field=\"node.linkTo\"\n\t\t\t><PrismicImage :field=\"node\"\n\t\t/></PrismicLink>\n\t\t<PrismicImage v-else :field=\"node\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\n\t<PrismicLink\n\t\tv-else-if=\"node.type === 'hyperlink'\"\n\t\t:field=\"node.data\"\n\t\t:link-resolver=\"linkResolver\"\n\t\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\n\t\t><slot\n\t/></span>\n\t<template v-else v-for=\"(line, index) in node.text.split('\\n')\" :key=\"line\"\n\t\t><br v-if=\"index > 0\" />{{ line }}</template\n\t>\n</template>\n"],"mappings":""}
|