@prismicio/vue 5.3.0-canary.320f423 → 5.3.0-canary.553482e
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/PrismicImage.vue.d.cts +4 -4
- package/dist/PrismicLink.vue.d.cts +4 -4
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts +6 -10
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts.map +1 -1
- package/dist/PrismicRichText/types.d.cts +25 -26
- package/dist/PrismicRichText/types.d.cts.map +1 -1
- package/dist/PrismicTable/PrismicTable.vue.d.cts +2 -6
- package/dist/PrismicTable/PrismicTable.vue.d.cts.map +1 -1
- package/dist/PrismicTable/types.d.cts +7 -8
- package/dist/PrismicTable/types.d.cts.map +1 -1
- package/dist/PrismicText.vue.d.cts +2 -2
- package/dist/PrismicText.vue.d.cts.map +1 -1
- package/dist/SliceZone/SliceZone.vue.d.cts +2 -2
- package/dist/SliceZone/SliceZone.vue.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/PrismicImage.vue.d.ts +4 -4
- package/dist/src/PrismicLink.vue.d.ts +4 -4
- package/dist/src/PrismicLink.vue.d.ts.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 -10
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +2 -4
- 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 -4
- 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 +2 -2
- 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 +2 -2
- 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 +10 -4
- 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 +11 -5
- package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/types.d.ts +25 -26
- 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 +4 -8
- package/dist/src/PrismicTable/PrismicTable.vue.d.ts.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +8 -8
- 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 +8 -8
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs +12 -30
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.js +12 -30
- package/dist/src/PrismicTable/PrismicTableDefaultComponents.js.map +1 -1
- package/dist/src/PrismicTable/types.d.ts +7 -8
- package/dist/src/PrismicTable/types.d.ts.map +1 -1
- package/dist/src/PrismicText.vue.d.ts +2 -2
- package/dist/src/SliceZone/SliceZone.vue.d.ts +2 -2
- package/dist/src/types.cjs.map +1 -1
- package/dist/src/types.d.ts +11 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/types.d.cts +11 -1
- package/dist/types.d.cts.map +1 -1
- package/package.json +1 -3
- package/src/PrismicRichText/PrismicRichText.vue +13 -15
- package/src/PrismicRichText/PrismicRichTextDefaultComponent.vue +8 -4
- package/src/PrismicRichText/PrismicRichTextSerialize.vue +4 -3
- package/src/PrismicRichText/types.ts +57 -29
- package/src/PrismicTable/PrismicTable.vue +14 -18
- package/src/PrismicTable/PrismicTableDefaultComponents.ts +14 -39
- package/src/PrismicTable/types.ts +41 -23
- package/src/types.ts +13 -1
|
@@ -32,7 +32,7 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
32
32
|
shorthand: maybeComponentOrShorthand
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const internalTableComponents = computed(() => {
|
|
36
36
|
return {
|
|
37
37
|
table: getInternalComponent("table"),
|
|
38
38
|
thead: getInternalComponent("thead"),
|
|
@@ -43,22 +43,22 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
43
43
|
};
|
|
44
44
|
});
|
|
45
45
|
return (_ctx, _cache) => {
|
|
46
|
-
return unref(isFilled).table(__props.field) ? (openBlock(), createBlock(resolveDynamicComponent(
|
|
46
|
+
return unref(isFilled).table(__props.field) ? (openBlock(), createBlock(resolveDynamicComponent(internalTableComponents.value.table.is), mergeProps({
|
|
47
47
|
key: 0,
|
|
48
48
|
table: __props.field
|
|
49
49
|
}, {
|
|
50
50
|
..._ctx.$attrs,
|
|
51
|
-
...
|
|
51
|
+
...internalTableComponents.value.table.shorthand
|
|
52
52
|
}), {
|
|
53
|
-
default: withCtx(() => [__props.field.head ? (openBlock(), createBlock(resolveDynamicComponent(
|
|
53
|
+
default: withCtx(() => [__props.field.head ? (openBlock(), createBlock(resolveDynamicComponent(internalTableComponents.value.thead.is), mergeProps({
|
|
54
54
|
key: 0,
|
|
55
55
|
head: __props.field.head
|
|
56
|
-
},
|
|
56
|
+
}, internalTableComponents.value.thead.shorthand), {
|
|
57
57
|
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.field.head.rows, (row) => {
|
|
58
58
|
return openBlock(), createBlock(PrismicTableRow_default, {
|
|
59
59
|
key: row.key,
|
|
60
60
|
row,
|
|
61
|
-
internalTableComponents:
|
|
61
|
+
internalTableComponents: internalTableComponents.value,
|
|
62
62
|
components: __props.components
|
|
63
63
|
}, null, 8, [
|
|
64
64
|
"row",
|
|
@@ -67,12 +67,12 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
67
67
|
]);
|
|
68
68
|
}), 128))]),
|
|
69
69
|
_: 1
|
|
70
|
-
}, 16, ["head"])) : createCommentVNode("v-if", true), (openBlock(), createBlock(resolveDynamicComponent(
|
|
70
|
+
}, 16, ["head"])) : createCommentVNode("v-if", true), (openBlock(), createBlock(resolveDynamicComponent(internalTableComponents.value.tbody.is), mergeProps({ body: __props.field.body }, internalTableComponents.value.tbody.shorthand), {
|
|
71
71
|
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.field.body.rows, (row) => {
|
|
72
72
|
return openBlock(), createBlock(PrismicTableRow_default, {
|
|
73
73
|
key: row.key,
|
|
74
74
|
row,
|
|
75
|
-
internalTableComponents:
|
|
75
|
+
internalTableComponents: internalTableComponents.value,
|
|
76
76
|
components: __props.components
|
|
77
77
|
}, null, 8, [
|
|
78
78
|
"row",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTable.vue_vue_type_script_setup_true_lang.js","names":["$attrs"],"sources":["../../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { type TableField, isFilled } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type {
|
|
1
|
+
{"version":3,"file":"PrismicTable.vue_vue_type_script_setup_true_lang.js","names":["$attrs"],"sources":["../../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { type TableField, isFilled } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName, VueComponentShorthand } from \"../types\"\nimport { isVueComponent } from \"../types\"\nimport type { InternalVueTableComponents, VueTableComponents } from \"./types\"\n\nimport type { VueRichTextSerializer } from \"../PrismicRichText\"\n\nimport { defaultTableComponents } from \"./PrismicTableDefaultComponents\"\nimport PrismicTableRow from \"./PrismicTableRow.vue\"\n\n/** Props for `<PrismicTable />`. */\nexport type PrismicTableProps = {\n\t/** The Prismic table field to render. */\n\tfield: TableField | undefined\n\n\t/**\n\t * An object that maps a table block type to a Vue component or a shorthand\n\t * definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * table: Table,\n\t * thead: { class: 'bg-black text-white' },\n\t * th: { as: 'td', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueTableComponents & VueRichTextSerializer\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` (nothing) will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\nconst props = defineProps<PrismicTableProps>()\ndefineOptions({ name: \"PrismicTable\" })\n\nfunction getInternalComponent(type: keyof VueTableComponents) {\n\tconst maybeComponentOrShorthand = props.components?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: defaultTableComponents[type],\n\t\tshorthand: maybeComponentOrShorthand as VueComponentShorthand,\n\t}\n}\n\nconst internalTableComponents = computed<InternalVueTableComponents>(() => {\n\treturn {\n\t\ttable: getInternalComponent(\"table\"),\n\t\tthead: getInternalComponent(\"thead\"),\n\t\ttbody: getInternalComponent(\"tbody\"),\n\t\ttr: getInternalComponent(\"tr\"),\n\t\tth: getInternalComponent(\"th\"),\n\t\ttd: getInternalComponent(\"td\"),\n\t}\n})\n</script>\n\n<template>\n\t<component\n\t\tv-if=\"isFilled.table(field)\"\n\t\t:is=\"internalTableComponents.table.is\"\n\t\t:table=\"field\"\n\t\tv-bind=\"{ ...$attrs, ...internalTableComponents.table.shorthand }\"\n\t>\n\t\t<component\n\t\t\tv-if=\"field.head\"\n\t\t\t:is=\"internalTableComponents.thead.is\"\n\t\t\t:head=\"field.head\"\n\t\t\tv-bind=\"internalTableComponents.thead.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.head.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"internalTableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t\t<component\n\t\t\t:is=\"internalTableComponents.tbody.is\"\n\t\t\t:body=\"field.body\"\n\t\t\tv-bind=\"internalTableComponents.tbody.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.body.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"internalTableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t</component>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" v-bind=\"$attrs\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAyCA,MAAM,QAAQ;EAGd,SAAS,qBAAqB,MAAgC;GAC7D,MAAM,4BAA4B,MAAM,aAAa;AAErD,OAAI,eAAe,0BAA0B,CAC5C,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI,uBAAuB;IAC3B,WAAW;IACZ;;EAGD,MAAM,0BAA0B,eAA2C;AAC1E,UAAO;IACN,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,IAAI,qBAAqB,KAAK;IAC9B,IAAI,qBAAqB,KAAK;IAC9B,IAAI,qBAAqB,KAAK;IAC/B;IACA;;UAKO,MAAA,SAAQ,CAAC,MAAM,QAAA,MAAK,iBAD3B,YAiCY,wBA/BN,wBAAA,MAAwB,MAAM,GAAE,EAFtC,WAiCY;;IA9BV,OAAO,QAAA;;OACKA,KAAAA;IAAM,GAAK,wBAAA,MAAwB,MAAM;IAAS,CAAA,EAAA;2BAenD,CAZL,QAAA,MAAM,qBADb,YAaY,wBAXN,wBAAA,MAAwB,MAAM,GAAE,EAFtC,WAaY;;KAVV,MAAM,QAAA,MAAM;OACL,wBAAA,MAAwB,MAAM,UAAS,EAAA;4BAGhB,mBAD/B,mBAME,UAAA,MAAA,WALa,QAAA,MAAM,KAAK,OAAlB,QAAG;0BADX,YAME,yBAAA;OAJA,KAAK,IAAI;OACJ;OACL,yBAAyB,wBAAA;OACzB,YAAY,QAAA;;;;;;;;wEAGf,YAYY,wBAXN,wBAAA,MAAwB,MAAM,GAAE,EADtC,WAYY,EAVV,MAAM,QAAA,MAAM,QACL,wBAAA,MAAwB,MAAM,UAAS,EAAA;4BAGhB,mBAD/B,mBAME,UAAA,MAAA,WALa,QAAA,MAAM,KAAK,OAAlB,QAAG;0BADX,YAME,yBAAA;OAJA,KAAK,IAAI;OACJ;OACL,yBAAyB,wBAAA;OACzB,YAAY,QAAA;;;;;;;;;;wBAIM,QAAA,yBAAtB,YAAiE,wBAA5B,QAAA,SAAQ,EAAA,eAAA,WAAA,EAAA,KAAA,GAAA,EAAUA,KAAAA,OAAM,CAAA,EAAA,MAAA,GAAA"}
|
|
@@ -4,57 +4,39 @@ let vue = require("vue");
|
|
|
4
4
|
//#region src/PrismicTable/PrismicTableDefaultComponents.ts
|
|
5
5
|
const defaultTableComponents = {
|
|
6
6
|
table: (0, vue.defineComponent)({
|
|
7
|
-
props:
|
|
8
|
-
...require_getTableComponentProps.table(),
|
|
9
|
-
as: { type: String }
|
|
10
|
-
},
|
|
7
|
+
props: require_getTableComponentProps.table(),
|
|
11
8
|
setup(props, { attrs, slots }) {
|
|
12
|
-
return () => (0, vue.h)(
|
|
9
|
+
return () => (0, vue.h)("table", attrs, slots.default ? slots.default() : []);
|
|
13
10
|
}
|
|
14
11
|
}),
|
|
15
12
|
thead: (0, vue.defineComponent)({
|
|
16
|
-
props:
|
|
17
|
-
...require_getTableComponentProps.thead(),
|
|
18
|
-
as: { type: String }
|
|
19
|
-
},
|
|
13
|
+
props: require_getTableComponentProps.thead(),
|
|
20
14
|
setup(props, { attrs, slots }) {
|
|
21
|
-
return () => (0, vue.h)(
|
|
15
|
+
return () => (0, vue.h)("thead", attrs, slots.default ? slots.default() : []);
|
|
22
16
|
}
|
|
23
17
|
}),
|
|
24
18
|
tbody: (0, vue.defineComponent)({
|
|
25
|
-
props:
|
|
26
|
-
...require_getTableComponentProps.tbody(),
|
|
27
|
-
as: { type: String }
|
|
28
|
-
},
|
|
19
|
+
props: require_getTableComponentProps.tbody(),
|
|
29
20
|
setup(props, { attrs, slots }) {
|
|
30
|
-
return () => (0, vue.h)(
|
|
21
|
+
return () => (0, vue.h)("tbody", attrs, slots.default ? slots.default() : []);
|
|
31
22
|
}
|
|
32
23
|
}),
|
|
33
24
|
tr: (0, vue.defineComponent)({
|
|
34
|
-
props:
|
|
35
|
-
...require_getTableComponentProps.tr(),
|
|
36
|
-
as: { type: String }
|
|
37
|
-
},
|
|
25
|
+
props: require_getTableComponentProps.tr(),
|
|
38
26
|
setup(props, { attrs, slots }) {
|
|
39
|
-
return () => (0, vue.h)(
|
|
27
|
+
return () => (0, vue.h)("tr", attrs, slots.default ? slots.default() : []);
|
|
40
28
|
}
|
|
41
29
|
}),
|
|
42
30
|
th: (0, vue.defineComponent)({
|
|
43
|
-
props:
|
|
44
|
-
...require_getTableComponentProps.th(),
|
|
45
|
-
as: { type: String }
|
|
46
|
-
},
|
|
31
|
+
props: require_getTableComponentProps.th(),
|
|
47
32
|
setup(props, { attrs, slots }) {
|
|
48
|
-
return () => (0, vue.h)(
|
|
33
|
+
return () => (0, vue.h)("th", attrs, slots.default ? slots.default() : []);
|
|
49
34
|
}
|
|
50
35
|
}),
|
|
51
36
|
td: (0, vue.defineComponent)({
|
|
52
|
-
props:
|
|
53
|
-
...require_getTableComponentProps.td(),
|
|
54
|
-
as: { type: String }
|
|
55
|
-
},
|
|
37
|
+
props: require_getTableComponentProps.td(),
|
|
56
38
|
setup(props, { attrs, slots }) {
|
|
57
|
-
return () => (0, vue.h)(
|
|
39
|
+
return () => (0, vue.h)("td", attrs, slots.default ? slots.default() : []);
|
|
58
40
|
}
|
|
59
41
|
})
|
|
60
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTableDefaultComponents.cjs","names":["defaultTableComponents:
|
|
1
|
+
{"version":3,"file":"PrismicTableDefaultComponents.cjs","names":["defaultTableComponents: Required<VueTableComponents>"],"sources":["../../../src/PrismicTable/PrismicTableDefaultComponents.ts"],"sourcesContent":["import { defineComponent, h } from \"vue\"\n\nimport type { VueTableComponents } from \"./types\"\n\nimport * as getTableComponentProps from \"./getTableComponentProps\"\n\nexport const defaultTableComponents: Required<VueTableComponents> = {\n\ttable: defineComponent({\n\t\tprops: getTableComponentProps.table(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"table\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\tthead: defineComponent({\n\t\tprops: getTableComponentProps.thead(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"thead\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\ttbody: defineComponent({\n\t\tprops: getTableComponentProps.tbody(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"tbody\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\ttr: defineComponent({\n\t\tprops: getTableComponentProps.tr(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"tr\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\tth: defineComponent({\n\t\tprops: getTableComponentProps.th(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"th\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\ttd: defineComponent({\n\t\tprops: getTableComponentProps.td(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"td\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n}\n"],"mappings":";;;;AAMA,MAAaA,yBAAuD;CACnE,gCAAuB;EACtB,6CAAqC;EACrC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,2BAAe,SAAS,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAErE,CAAC;CACF,gCAAuB;EACtB,6CAAqC;EACrC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,2BAAe,SAAS,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAErE,CAAC;CACF,gCAAuB;EACtB,6CAAqC;EACrC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,2BAAe,SAAS,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAErE,CAAC;CACF,6BAAoB;EACnB,0CAAkC;EAClC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,2BAAe,MAAM,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAElE,CAAC;CACF,6BAAoB;EACnB,0CAAkC;EAClC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,2BAAe,MAAM,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAElE,CAAC;CACF,6BAAoB;EACnB,0CAAkC;EAClC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,2BAAe,MAAM,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAElE,CAAC;CACF"}
|
|
@@ -4,57 +4,39 @@ import { defineComponent, h } from "vue";
|
|
|
4
4
|
//#region src/PrismicTable/PrismicTableDefaultComponents.ts
|
|
5
5
|
const defaultTableComponents = {
|
|
6
6
|
table: defineComponent({
|
|
7
|
-
props:
|
|
8
|
-
...table(),
|
|
9
|
-
as: { type: String }
|
|
10
|
-
},
|
|
7
|
+
props: table(),
|
|
11
8
|
setup(props, { attrs, slots }) {
|
|
12
|
-
return () => h(
|
|
9
|
+
return () => h("table", attrs, slots.default ? slots.default() : []);
|
|
13
10
|
}
|
|
14
11
|
}),
|
|
15
12
|
thead: defineComponent({
|
|
16
|
-
props:
|
|
17
|
-
...thead(),
|
|
18
|
-
as: { type: String }
|
|
19
|
-
},
|
|
13
|
+
props: thead(),
|
|
20
14
|
setup(props, { attrs, slots }) {
|
|
21
|
-
return () => h(
|
|
15
|
+
return () => h("thead", attrs, slots.default ? slots.default() : []);
|
|
22
16
|
}
|
|
23
17
|
}),
|
|
24
18
|
tbody: defineComponent({
|
|
25
|
-
props:
|
|
26
|
-
...tbody(),
|
|
27
|
-
as: { type: String }
|
|
28
|
-
},
|
|
19
|
+
props: tbody(),
|
|
29
20
|
setup(props, { attrs, slots }) {
|
|
30
|
-
return () => h(
|
|
21
|
+
return () => h("tbody", attrs, slots.default ? slots.default() : []);
|
|
31
22
|
}
|
|
32
23
|
}),
|
|
33
24
|
tr: defineComponent({
|
|
34
|
-
props:
|
|
35
|
-
...tr(),
|
|
36
|
-
as: { type: String }
|
|
37
|
-
},
|
|
25
|
+
props: tr(),
|
|
38
26
|
setup(props, { attrs, slots }) {
|
|
39
|
-
return () => h(
|
|
27
|
+
return () => h("tr", attrs, slots.default ? slots.default() : []);
|
|
40
28
|
}
|
|
41
29
|
}),
|
|
42
30
|
th: defineComponent({
|
|
43
|
-
props:
|
|
44
|
-
...th(),
|
|
45
|
-
as: { type: String }
|
|
46
|
-
},
|
|
31
|
+
props: th(),
|
|
47
32
|
setup(props, { attrs, slots }) {
|
|
48
|
-
return () => h(
|
|
33
|
+
return () => h("th", attrs, slots.default ? slots.default() : []);
|
|
49
34
|
}
|
|
50
35
|
}),
|
|
51
36
|
td: defineComponent({
|
|
52
|
-
props:
|
|
53
|
-
...td(),
|
|
54
|
-
as: { type: String }
|
|
55
|
-
},
|
|
37
|
+
props: td(),
|
|
56
38
|
setup(props, { attrs, slots }) {
|
|
57
|
-
return () => h(
|
|
39
|
+
return () => h("td", attrs, slots.default ? slots.default() : []);
|
|
58
40
|
}
|
|
59
41
|
})
|
|
60
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTableDefaultComponents.js","names":["defaultTableComponents:
|
|
1
|
+
{"version":3,"file":"PrismicTableDefaultComponents.js","names":["defaultTableComponents: Required<VueTableComponents>","getTableComponentProps.table","getTableComponentProps.thead","getTableComponentProps.tbody","getTableComponentProps.tr","getTableComponentProps.th","getTableComponentProps.td"],"sources":["../../../src/PrismicTable/PrismicTableDefaultComponents.ts"],"sourcesContent":["import { defineComponent, h } from \"vue\"\n\nimport type { VueTableComponents } from \"./types\"\n\nimport * as getTableComponentProps from \"./getTableComponentProps\"\n\nexport const defaultTableComponents: Required<VueTableComponents> = {\n\ttable: defineComponent({\n\t\tprops: getTableComponentProps.table(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"table\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\tthead: defineComponent({\n\t\tprops: getTableComponentProps.thead(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"thead\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\ttbody: defineComponent({\n\t\tprops: getTableComponentProps.tbody(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"tbody\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\ttr: defineComponent({\n\t\tprops: getTableComponentProps.tr(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"tr\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\tth: defineComponent({\n\t\tprops: getTableComponentProps.th(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"th\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n\ttd: defineComponent({\n\t\tprops: getTableComponentProps.td(),\n\t\tsetup(props, { attrs, slots }) {\n\t\t\treturn () => h(\"td\", attrs, slots.default ? slots.default() : [])\n\t\t},\n\t}),\n}\n"],"mappings":";;;;AAMA,MAAaA,yBAAuD;CACnE,OAAO,gBAAgB;EACtB,OAAOC,OAA8B;EACrC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,gBAAa,EAAE,SAAS,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAErE,CAAC;CACF,OAAO,gBAAgB;EACtB,OAAOC,OAA8B;EACrC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,gBAAa,EAAE,SAAS,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAErE,CAAC;CACF,OAAO,gBAAgB;EACtB,OAAOC,OAA8B;EACrC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,gBAAa,EAAE,SAAS,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAErE,CAAC;CACF,IAAI,gBAAgB;EACnB,OAAOC,IAA2B;EAClC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,gBAAa,EAAE,MAAM,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAElE,CAAC;CACF,IAAI,gBAAgB;EACnB,OAAOC,IAA2B;EAClC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,gBAAa,EAAE,MAAM,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAElE,CAAC;CACF,IAAI,gBAAgB;EACnB,OAAOC,IAA2B;EAClC,MAAM,OAAO,EAAE,OAAO,SAAS;AAC9B,gBAAa,EAAE,MAAM,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,EAAE,CAAC;;EAElE,CAAC;CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { VueComponent } from "../types.js";
|
|
2
|
-
import { VueShorthand } from "../PrismicRichText/types.js";
|
|
1
|
+
import { VueComponent, VueComponentShorthand } from "../types.js";
|
|
3
2
|
import { TableField, TableFieldBody, TableFieldBodyRow, TableFieldDataCell, TableFieldHead, TableFieldHeadRow, TableFieldHeaderCell } from "@prismicio/client";
|
|
4
3
|
|
|
5
4
|
//#region src/PrismicTable/types.d.ts
|
|
@@ -13,22 +12,22 @@ import { TableField, TableFieldBody, TableFieldBodyRow, TableFieldDataCell, Tabl
|
|
|
13
12
|
type VueTableComponents = {
|
|
14
13
|
table?: VueComponent<{
|
|
15
14
|
table: TableField<"filled">;
|
|
16
|
-
}> |
|
|
15
|
+
}> | Omit<VueComponentShorthand, "as">;
|
|
17
16
|
thead?: VueComponent<{
|
|
18
17
|
head: TableFieldHead;
|
|
19
|
-
}> |
|
|
18
|
+
}> | Omit<VueComponentShorthand, "as">;
|
|
20
19
|
tbody?: VueComponent<{
|
|
21
20
|
body: TableFieldBody;
|
|
22
|
-
}> |
|
|
21
|
+
}> | Omit<VueComponentShorthand, "as">;
|
|
23
22
|
tr?: VueComponent<{
|
|
24
23
|
row: TableFieldBodyRow | TableFieldHeadRow;
|
|
25
|
-
}> |
|
|
24
|
+
}> | Omit<VueComponentShorthand, "as">;
|
|
26
25
|
th?: VueComponent<{
|
|
27
26
|
cell: TableFieldHeaderCell;
|
|
28
|
-
}> |
|
|
27
|
+
}> | Omit<VueComponentShorthand, "as">;
|
|
29
28
|
td?: VueComponent<{
|
|
30
29
|
cell: TableFieldDataCell;
|
|
31
|
-
}> |
|
|
30
|
+
}> | Omit<VueComponentShorthand, "as">;
|
|
32
31
|
};
|
|
33
32
|
//#endregion
|
|
34
33
|
export { VueTableComponents };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/PrismicTable/types.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/PrismicTable/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAkBA;;;;AAGI,KAHQ,kBAAA,GAGR;EAEqB,KAAA,CAAA,EAHrB,YAGqB,CAAA;IAArB,KAAA,EAHsB,UAGtB,CAAA,QAAA,CAAA;EACK,CAAA,CAAA,GAHL,IAGK,CAHA,qBAGA,EAAA,IAAA,CAAA;EAAL,KAAA,CAAA,EADA,YACA,CAAA;IAEqB,IAAA,EAHA,cAGA;EAArB,CAAA,CAAA,GAFA,IAEA,CAFK,qBAEL,EAAA,IAAA,CAAA;EACK,KAAA,CAAA,EADL,YACK,CAAA;IAAL,IAAA,EADqB,cACrB;EAEoB,CAAA,CAAA,GAFpB,IAEoB,CAFf,qBAEe,EAAA,IAAA,CAAA;EAAoB,EAAA,CAAA,EAAxC,YAAwC,CAAA;IAAxC,GAAA,EAAoB,iBAApB,GAAwC,iBAAxC;EACK,CAAA,CAAA,GAAL,IAAK,CAAA,qBAAA,EAAA,IAAA,CAAA;EAAL,EAAA,CAAA,EAEA,YAFA,CAAA;IAEqB,IAAA,EAAA,oBAAA;EAArB,CAAA,CAAA,GACA,IADA,CACK,qBADL,EAAA,IAAA,CAAA;EACK,EAAA,CAAA,EAEL,YAFK,CAAA;IAAL,IAAA,EAEqB,kBAFrB;EAEqB,CAAA,CAAA,GACrB,IADqB,CAChB,qBADgB,EAAA,IAAA,CAAA;CAArB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue11 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: vue11.DefineComponent<PrismicTextProps, {}, {}, {}, {}, vue11.ComponentOptionsMixin, vue11.ComponentOptionsMixin, {}, string, vue11.PublicProps, Readonly<PrismicTextProps> & Readonly<{}>, {}, {}, {}, {}, string, vue11.ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { PrismicTextProps, _default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SliceComponentType, SliceLike, SliceZoneComponents, SliceZoneLike } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue16 from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/SliceZone/SliceZone.vue.d.ts
|
|
5
5
|
|
|
@@ -22,7 +22,7 @@ type SliceZoneProps<TContext = unknown> = {
|
|
|
22
22
|
context?: TContext;
|
|
23
23
|
};
|
|
24
24
|
type __VLS_Props = SliceZoneProps;
|
|
25
|
-
declare const __VLS_export:
|
|
25
|
+
declare const __VLS_export: vue16.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue16.ComponentOptionsMixin, vue16.ComponentOptionsMixin, {}, string, vue16.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue16.ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
declare const _default: typeof __VLS_export;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { SliceZoneProps, _default };
|
package/dist/src/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n\tConcreteComponent,\n\tDefineComponent,\n\tFunctionalComponent,\n\tRaw,\n\tdefineAsyncComponent,\n} from \"vue\"\n\nexport type ComponentOrTagName =\n\t| string\n\t| ConcreteComponent\n\t| Raw<DefineComponent>\n\nexport type VueComponent<TProps> =\n\t// For reference within TypeScript files when `*.vue` type cannot be inferred\n\t// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any\n\t| DefineComponent<{}, {}, any>\n\t// Likewise, for reference with TypeScript files.\n\t| ReturnType<typeof defineAsyncComponent>\n\t| DefineComponent<TProps>\n\t| FunctionalComponent<TProps>\n\nexport const isVueComponent = <T>(\n\tcomponent: VueComponent<T> |
|
|
1
|
+
{"version":3,"file":"types.cjs","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n\tConcreteComponent,\n\tDefineComponent,\n\tFunctionalComponent,\n\tRaw,\n\tdefineAsyncComponent,\n} from \"vue\"\n\nexport type ComponentOrTagName =\n\t| string\n\t| ConcreteComponent\n\t| Raw<DefineComponent>\n\nexport type VueComponent<TProps> =\n\t// For reference within TypeScript files when `*.vue` type cannot be inferred\n\t// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any\n\t| DefineComponent<{}, {}, any>\n\t// Likewise, for reference with TypeScript files.\n\t| ReturnType<typeof defineAsyncComponent>\n\t| DefineComponent<TProps>\n\t| FunctionalComponent<TProps>\n\n/**\n * A shorthand definition for `<PrismicRichText />` and `<PrismicTable />`\n * component types.\n */\nexport type VueComponentShorthand = {\n\t/** The HTML element type rendered for this node type. */\n\tas?: string\n\n\t/** Other attributes to apply to the element type. */\n\t[Attribute: string]: string | boolean | null | undefined\n}\n\nexport const isVueComponent = <T>(\n\tcomponent: VueComponent<T> | VueComponentShorthand | undefined,\n): component is VueComponent<T> => {\n\treturn (\n\t\t!!component &&\n\t\t(typeof component === \"function\" ||\n\t\t\t(typeof component === \"object\" &&\n\t\t\t\t((\"render\" in component && typeof component.render === \"function\") ||\n\t\t\t\t\t(\"setup\" in component && typeof component.setup === \"function\") ||\n\t\t\t\t\t(\"__file\" in component && !!component.__file) ||\n\t\t\t\t\t(\"__name\" in component && !!component.__name) ||\n\t\t\t\t\t(\"props\" in component && typeof component.props === \"object\"))))\n\t)\n}\n"],"mappings":";;AAkCA,MAAa,kBACZ,cACkC;AAClC,QACC,CAAC,CAAC,cACD,OAAO,cAAc,cACpB,OAAO,cAAc,aACnB,YAAY,aAAa,OAAO,UAAU,WAAW,cACrD,WAAW,aAAa,OAAO,UAAU,UAAU,cACnD,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,WAAW,aAAa,OAAO,UAAU,UAAU"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -3,6 +3,16 @@ import { ConcreteComponent, DefineComponent, FunctionalComponent, Raw, defineAsy
|
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
type ComponentOrTagName = string | ConcreteComponent | Raw<DefineComponent>;
|
|
5
5
|
type VueComponent<TProps> = DefineComponent<{}, {}, any> | ReturnType<typeof defineAsyncComponent> | DefineComponent<TProps> | FunctionalComponent<TProps>;
|
|
6
|
+
/**
|
|
7
|
+
* A shorthand definition for `<PrismicRichText />` and `<PrismicTable />`
|
|
8
|
+
* component types.
|
|
9
|
+
*/
|
|
10
|
+
type VueComponentShorthand = {
|
|
11
|
+
/** The HTML element type rendered for this node type. */
|
|
12
|
+
as?: string;
|
|
13
|
+
/** Other attributes to apply to the element type. */
|
|
14
|
+
[Attribute: string]: string | boolean | null | undefined;
|
|
15
|
+
};
|
|
6
16
|
//#endregion
|
|
7
|
-
export { ComponentOrTagName, VueComponent };
|
|
17
|
+
export { ComponentOrTagName, VueComponent, VueComponentShorthand };
|
|
8
18
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"sourcesContent":[],"mappings":";;;KAQY,kBAAA,YAET,oBACA,IAAI;KAEK,uBAGT,+BAEA,kBAAkB,wBAClB,gBAAgB,UAChB,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"sourcesContent":[],"mappings":";;;KAQY,kBAAA,YAET,oBACA,IAAI;KAEK,uBAGT,+BAEA,kBAAkB,wBAClB,gBAAgB,UAChB,oBAAoB;AAZvB;;;;AAGM,KAeM,qBAAA,GAfN;EAEM;EAGT,EAAA,CAAA,EAAA,MAAA;EAEkB;EAAlB,CAAA,SAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,IAAA,GAAA,SAAA;CACgB"}
|
package/dist/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n\tConcreteComponent,\n\tDefineComponent,\n\tFunctionalComponent,\n\tRaw,\n\tdefineAsyncComponent,\n} from \"vue\"\n\nexport type ComponentOrTagName =\n\t| string\n\t| ConcreteComponent\n\t| Raw<DefineComponent>\n\nexport type VueComponent<TProps> =\n\t// For reference within TypeScript files when `*.vue` type cannot be inferred\n\t// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any\n\t| DefineComponent<{}, {}, any>\n\t// Likewise, for reference with TypeScript files.\n\t| ReturnType<typeof defineAsyncComponent>\n\t| DefineComponent<TProps>\n\t| FunctionalComponent<TProps>\n\nexport const isVueComponent = <T>(\n\tcomponent: VueComponent<T> |
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n\tConcreteComponent,\n\tDefineComponent,\n\tFunctionalComponent,\n\tRaw,\n\tdefineAsyncComponent,\n} from \"vue\"\n\nexport type ComponentOrTagName =\n\t| string\n\t| ConcreteComponent\n\t| Raw<DefineComponent>\n\nexport type VueComponent<TProps> =\n\t// For reference within TypeScript files when `*.vue` type cannot be inferred\n\t// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any\n\t| DefineComponent<{}, {}, any>\n\t// Likewise, for reference with TypeScript files.\n\t| ReturnType<typeof defineAsyncComponent>\n\t| DefineComponent<TProps>\n\t| FunctionalComponent<TProps>\n\n/**\n * A shorthand definition for `<PrismicRichText />` and `<PrismicTable />`\n * component types.\n */\nexport type VueComponentShorthand = {\n\t/** The HTML element type rendered for this node type. */\n\tas?: string\n\n\t/** Other attributes to apply to the element type. */\n\t[Attribute: string]: string | boolean | null | undefined\n}\n\nexport const isVueComponent = <T>(\n\tcomponent: VueComponent<T> | VueComponentShorthand | undefined,\n): component is VueComponent<T> => {\n\treturn (\n\t\t!!component &&\n\t\t(typeof component === \"function\" ||\n\t\t\t(typeof component === \"object\" &&\n\t\t\t\t((\"render\" in component && typeof component.render === \"function\") ||\n\t\t\t\t\t(\"setup\" in component && typeof component.setup === \"function\") ||\n\t\t\t\t\t(\"__file\" in component && !!component.__file) ||\n\t\t\t\t\t(\"__name\" in component && !!component.__name) ||\n\t\t\t\t\t(\"props\" in component && typeof component.props === \"object\"))))\n\t)\n}\n"],"mappings":";AAkCA,MAAa,kBACZ,cACkC;AAClC,QACC,CAAC,CAAC,cACD,OAAO,cAAc,cACpB,OAAO,cAAc,aACnB,YAAY,aAAa,OAAO,UAAU,WAAW,cACrD,WAAW,aAAa,OAAO,UAAU,UAAU,cACnD,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,WAAW,aAAa,OAAO,UAAU,UAAU"}
|
package/dist/types.d.cts
CHANGED
|
@@ -3,6 +3,16 @@ import { ConcreteComponent, DefineComponent, FunctionalComponent, Raw, defineAsy
|
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
type ComponentOrTagName = string | ConcreteComponent | Raw<DefineComponent>;
|
|
5
5
|
type VueComponent<TProps> = DefineComponent<{}, {}, any> | ReturnType<typeof defineAsyncComponent> | DefineComponent<TProps> | FunctionalComponent<TProps>;
|
|
6
|
+
/**
|
|
7
|
+
* A shorthand definition for `<PrismicRichText />` and `<PrismicTable />`
|
|
8
|
+
* component types.
|
|
9
|
+
*/
|
|
10
|
+
type VueComponentShorthand = {
|
|
11
|
+
/** The HTML element type rendered for this node type. */
|
|
12
|
+
as?: string;
|
|
13
|
+
/** Other attributes to apply to the element type. */
|
|
14
|
+
[Attribute: string]: string | boolean | null | undefined;
|
|
15
|
+
};
|
|
6
16
|
//#endregion
|
|
7
|
-
export { ComponentOrTagName, VueComponent };
|
|
17
|
+
export { ComponentOrTagName, VueComponent, VueComponentShorthand };
|
|
8
18
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAQY,kBAAA,YAET,oBACA,IAAI;KAEK,uBAGT,+BAEA,kBAAkB,wBAClB,gBAAgB,UAChB,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAQY,kBAAA,YAET,oBACA,IAAI;KAEK,uBAGT,+BAEA,kBAAkB,wBAClB,gBAAgB,UAChB,oBAAoB;AAZvB;;;;AAGM,KAeM,qBAAA,GAfN;EAEM;EAGT,EAAA,CAAA,EAAA,MAAA;EAEkB;EAAlB,CAAA,SAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,IAAA,GAAA,SAAA;CACgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/vue",
|
|
3
|
-
"version": "5.3.0-canary.
|
|
3
|
+
"version": "5.3.0-canary.553482e",
|
|
4
4
|
"description": "Vue plugin, components, and composables to fetch and present Prismic content",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -34,8 +34,6 @@
|
|
|
34
34
|
"build": "tsdown",
|
|
35
35
|
"dev": "tsdown --watch",
|
|
36
36
|
"format": "prettier --write .",
|
|
37
|
-
"playground:build": "vite build playground",
|
|
38
|
-
"playground:dev": "vite playground",
|
|
39
37
|
"prepare": "npm run build",
|
|
40
38
|
"lint": "oxlint --deny-warnings",
|
|
41
39
|
"types": "vue-tsc --noEmit",
|
|
@@ -8,23 +8,20 @@ import { asTree } from "@prismicio/client/richtext"
|
|
|
8
8
|
import type { PropType } from "vue"
|
|
9
9
|
import { computed } from "vue"
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import type { ComponentOrTagName, VueComponentShorthand } from "../types"
|
|
12
|
+
import { isVueComponent } from "../types"
|
|
12
13
|
import type {
|
|
13
|
-
|
|
14
|
+
InternalVueRichTextComponents,
|
|
15
|
+
VueRichTextComponent,
|
|
14
16
|
VueRichTextSerializer,
|
|
15
|
-
VueShorthand,
|
|
16
17
|
} from "./types"
|
|
17
18
|
|
|
18
19
|
import PrismicRichTextDefaultComponent from "./PrismicRichTextDefaultComponent.vue"
|
|
19
20
|
import PrismicRichTextSerialize from "./PrismicRichTextSerialize.vue"
|
|
20
21
|
|
|
21
|
-
/**
|
|
22
|
-
* Props for `<PrismicRichText />`.
|
|
23
|
-
*/
|
|
22
|
+
/** Props for `<PrismicRichText />`. */
|
|
24
23
|
export type PrismicRichTextProps = {
|
|
25
|
-
/**
|
|
26
|
-
* The Prismic rich text field to render.
|
|
27
|
-
*/
|
|
24
|
+
/** The Prismic rich text field to render. */
|
|
28
25
|
field: RichTextField | null | undefined
|
|
29
26
|
|
|
30
27
|
/**
|
|
@@ -86,7 +83,10 @@ const children = computed(() => {
|
|
|
86
83
|
})
|
|
87
84
|
|
|
88
85
|
function getInternalComponent(type: keyof typeof RichTextNodeType) {
|
|
89
|
-
const maybeComponentOrShorthand = props.components?.[type]
|
|
86
|
+
const maybeComponentOrShorthand = props.components?.[type] as
|
|
87
|
+
| VueRichTextComponent
|
|
88
|
+
| VueComponentShorthand
|
|
89
|
+
| undefined
|
|
90
90
|
|
|
91
91
|
if (isVueComponent(maybeComponentOrShorthand)) {
|
|
92
92
|
return { is: maybeComponentOrShorthand }
|
|
@@ -94,14 +94,12 @@ function getInternalComponent(type: keyof typeof RichTextNodeType) {
|
|
|
94
94
|
|
|
95
95
|
return {
|
|
96
96
|
is: PrismicRichTextDefaultComponent,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
shorthand: maybeComponentOrShorthand as VueShorthand,
|
|
100
|
-
},
|
|
97
|
+
linkResolver: props.linkResolver,
|
|
98
|
+
shorthand: maybeComponentOrShorthand,
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
|
|
104
|
-
const internalComponents = computed<
|
|
102
|
+
const internalComponents = computed<InternalVueRichTextComponents>(() => {
|
|
105
103
|
return {
|
|
106
104
|
heading1: getInternalComponent("heading1"),
|
|
107
105
|
heading2: getInternalComponent("heading2"),
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import type { LinkResolverFunction } from "@prismicio/client"
|
|
3
3
|
import { computed } from "vue"
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type { VueComponentShorthand } from "../types"
|
|
6
|
+
import type { RichTextComponentProps } from "./types"
|
|
6
7
|
|
|
7
8
|
import PrismicImage from "../PrismicImage.vue"
|
|
8
9
|
import PrismicLink from "../PrismicLink.vue"
|
|
@@ -10,13 +11,16 @@ import PrismicLink from "../PrismicLink.vue"
|
|
|
10
11
|
const props = defineProps<
|
|
11
12
|
RichTextComponentProps & {
|
|
12
13
|
linkResolver?: LinkResolverFunction
|
|
13
|
-
shorthand?:
|
|
14
|
+
shorthand?: VueComponentShorthand
|
|
14
15
|
}
|
|
15
16
|
>()
|
|
16
17
|
defineOptions({ name: "PrismicRichTextDefaultComponent" })
|
|
17
18
|
|
|
18
19
|
const as = computed(() => {
|
|
19
|
-
return props.node.type !== "image" &&
|
|
20
|
+
return props.node.type !== "image" &&
|
|
21
|
+
props.node.type !== "hyperlink" &&
|
|
22
|
+
props.node.type !== "label" &&
|
|
23
|
+
props.node.type !== "span"
|
|
20
24
|
? props.shorthand?.as
|
|
21
25
|
: undefined
|
|
22
26
|
})
|
|
@@ -74,7 +78,7 @@ const dir = computed(() => {
|
|
|
74
78
|
</ol>
|
|
75
79
|
<p class="block-img" v-else-if="node.type === 'image'">
|
|
76
80
|
<PrismicLink v-if="node.linkTo" :field="node.linkTo"
|
|
77
|
-
><PrismicImage :field="node"
|
|
81
|
+
><PrismicImage :field="node" v-bind="attrs"
|
|
78
82
|
/></PrismicLink>
|
|
79
83
|
<PrismicImage v-else :field="node" v-bind="attrs" />
|
|
80
84
|
</p>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import type { asTree } from "@prismicio/client/richtext"
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { InternalVueRichTextComponents } from "./types"
|
|
5
5
|
|
|
6
6
|
type PrismicRichTextSerializeProps = {
|
|
7
7
|
children: ReturnType<typeof asTree>["children"]
|
|
8
|
-
internalComponents:
|
|
8
|
+
internalComponents: InternalVueRichTextComponents
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const props = defineProps<PrismicRichTextSerializeProps>()
|
|
@@ -18,7 +18,8 @@ defineOptions({ name: "PrismicRichTextSerialize" })
|
|
|
18
18
|
:key="JSON.stringify(child)"
|
|
19
19
|
:is="internalComponents[child.type].is"
|
|
20
20
|
:node="child.node"
|
|
21
|
-
|
|
21
|
+
:link-resolver="internalComponents[child.type].linkResolver"
|
|
22
|
+
:shorthand="internalComponents[child.type].shorthand"
|
|
22
23
|
><PrismicRichTextSerialize
|
|
23
24
|
v-if="child.children.length"
|
|
24
25
|
:children="child.children"
|