@prismicio/vue 5.3.0-pr.88.ee9acb6 → 5.3.0-pr.89.d0f4ac2
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 +15 -49
- package/dist/PrismicImage.vue.d.cts.map +1 -1
- package/dist/PrismicLink.vue.d.cts +57 -52
- package/dist/PrismicLink.vue.d.cts.map +1 -1
- package/dist/PrismicRichText/PrismicRichText.vue.d.cts +14 -14
- 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 +8 -9
- 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 -6
- package/dist/PrismicText.vue.d.cts.map +1 -1
- package/dist/SliceZone/SliceZone.vue.d.cts +3 -14
- package/dist/SliceZone/SliceZone.vue.d.cts.map +1 -1
- package/dist/SliceZone/types.d.cts +3 -9
- package/dist/SliceZone/types.d.cts.map +1 -1
- package/dist/createPrismic.d.cts +61 -0
- package/dist/createPrismic.d.cts.map +1 -0
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -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.cjs.map +1 -1
- package/dist/src/PrismicImage.js.map +1 -1
- package/dist/src/PrismicImage.vue.d.ts +15 -49
- package/dist/src/PrismicImage.vue.d.ts.map +1 -1
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicLink.cjs.map +1 -1
- package/dist/src/PrismicLink.js.map +1 -1
- package/dist/src/PrismicLink.vue.d.ts +57 -52
- package/dist/src/PrismicLink.vue.d.ts.map +1 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs +6 -10
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js +6 -10
- package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.cjs.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.js.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts +18 -18
- package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -1
- package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +11 -5
- 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 +11 -5
- 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/index.d.ts +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 +10 -11
- package/dist/src/PrismicTable/PrismicTable.vue.d.ts.map +1 -1
- package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +18 -10
- 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 +19 -11
- 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/PrismicTableRow.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.js.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/PrismicTable/index.d.ts +1 -0
- package/dist/src/PrismicTable/types.d.ts +7 -8
- package/dist/src/PrismicTable/types.d.ts.map +1 -1
- package/dist/src/PrismicText.cjs.map +1 -1
- package/dist/src/PrismicText.js.map +1 -1
- package/dist/src/PrismicText.vue.d.ts +2 -6
- package/dist/src/PrismicText.vue.d.ts.map +1 -1
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/SliceZone/SliceZone.cjs.map +1 -1
- package/dist/src/SliceZone/SliceZone.js.map +1 -1
- package/dist/src/SliceZone/SliceZone.vue.d.ts +3 -14
- package/dist/src/SliceZone/SliceZone.vue.d.ts.map +1 -1
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/src/SliceZone/types.d.ts +3 -9
- package/dist/src/SliceZone/types.d.ts.map +1 -1
- package/dist/src/createPrismic.cjs +33 -0
- package/dist/src/createPrismic.cjs.map +1 -0
- package/dist/src/createPrismic.d.ts +63 -0
- package/dist/src/createPrismic.d.ts.map +1 -0
- package/dist/src/createPrismic.js +32 -0
- package/dist/src/createPrismic.js.map +1 -0
- package/dist/src/lib/isInternalURL.cjs +2 -6
- package/dist/src/lib/isInternalURL.cjs.map +1 -1
- package/dist/src/lib/isInternalURL.js +2 -6
- package/dist/src/lib/isInternalURL.js.map +1 -1
- 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/PrismicImage.vue +5 -16
- package/src/PrismicLink.vue +26 -26
- package/src/PrismicRichText/PrismicRichText.vue +33 -23
- package/src/PrismicRichText/PrismicRichTextDefaultComponent.vue +8 -4
- package/src/PrismicRichText/PrismicRichTextSerialize.vue +4 -3
- package/src/PrismicRichText/index.ts +1 -1
- package/src/PrismicRichText/types.ts +57 -29
- package/src/PrismicTable/PrismicTable.vue +31 -23
- package/src/PrismicTable/PrismicTableDefaultComponents.ts +14 -39
- package/src/PrismicTable/PrismicTableRow.vue +2 -2
- package/src/PrismicTable/index.ts +2 -0
- package/src/PrismicTable/types.ts +41 -23
- package/src/PrismicText.vue +2 -6
- package/src/SliceZone/SliceZone.vue +3 -14
- package/src/SliceZone/types.ts +3 -9
- package/src/createPrismic.ts +86 -0
- package/src/index.ts +5 -1
- package/src/lib/isInternalURL.ts +2 -6
- package/src/types.ts +13 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_types = require('../types.cjs');
|
|
2
|
+
const require_createPrismic = require('../createPrismic.cjs');
|
|
2
3
|
const require_PrismicTableDefaultComponents = require('./PrismicTableDefaultComponents.cjs');
|
|
3
4
|
const require_PrismicTableRow = require('./PrismicTableRow.cjs');
|
|
4
5
|
let vue = require("vue");
|
|
@@ -24,15 +25,22 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (
|
|
|
24
25
|
},
|
|
25
26
|
setup(__props) {
|
|
26
27
|
const props = __props;
|
|
28
|
+
const { componentsConfig } = require_createPrismic.usePrismic();
|
|
29
|
+
const resolvedComponents = (0, vue.computed)(() => {
|
|
30
|
+
return {
|
|
31
|
+
...componentsConfig?.defaultComponents,
|
|
32
|
+
...props.components
|
|
33
|
+
};
|
|
34
|
+
});
|
|
27
35
|
function getInternalComponent(type) {
|
|
28
|
-
const maybeComponentOrShorthand =
|
|
36
|
+
const maybeComponentOrShorthand = resolvedComponents.value?.[type];
|
|
29
37
|
if (require_types.isVueComponent(maybeComponentOrShorthand)) return { is: maybeComponentOrShorthand };
|
|
30
38
|
return {
|
|
31
39
|
is: require_PrismicTableDefaultComponents.defaultTableComponents[type],
|
|
32
40
|
shorthand: maybeComponentOrShorthand
|
|
33
41
|
};
|
|
34
42
|
}
|
|
35
|
-
const
|
|
43
|
+
const internalTableComponents = (0, vue.computed)(() => {
|
|
36
44
|
return {
|
|
37
45
|
table: getInternalComponent("table"),
|
|
38
46
|
thead: getInternalComponent("thead"),
|
|
@@ -43,22 +51,22 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (
|
|
|
43
51
|
};
|
|
44
52
|
});
|
|
45
53
|
return (_ctx, _cache) => {
|
|
46
|
-
return (0, vue.unref)(__prismicio_client.isFilled).table(__props.field) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(
|
|
54
|
+
return (0, vue.unref)(__prismicio_client.isFilled).table(__props.field) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(internalTableComponents.value.table.is), (0, vue.mergeProps)({
|
|
47
55
|
key: 0,
|
|
48
56
|
table: __props.field
|
|
49
57
|
}, {
|
|
50
58
|
..._ctx.$attrs,
|
|
51
|
-
...
|
|
59
|
+
...internalTableComponents.value.table.shorthand
|
|
52
60
|
}), {
|
|
53
|
-
default: (0, vue.withCtx)(() => [__props.field.head ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(
|
|
61
|
+
default: (0, vue.withCtx)(() => [__props.field.head ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(internalTableComponents.value.thead.is), (0, vue.mergeProps)({
|
|
54
62
|
key: 0,
|
|
55
63
|
head: __props.field.head
|
|
56
|
-
},
|
|
64
|
+
}, internalTableComponents.value.thead.shorthand), {
|
|
57
65
|
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.field.head.rows, (row) => {
|
|
58
66
|
return (0, vue.openBlock)(), (0, vue.createBlock)(require_PrismicTableRow.default, {
|
|
59
67
|
key: row.key,
|
|
60
68
|
row,
|
|
61
|
-
internalTableComponents:
|
|
69
|
+
internalTableComponents: internalTableComponents.value,
|
|
62
70
|
components: __props.components
|
|
63
71
|
}, null, 8, [
|
|
64
72
|
"row",
|
|
@@ -67,12 +75,12 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (
|
|
|
67
75
|
]);
|
|
68
76
|
}), 128))]),
|
|
69
77
|
_: 1
|
|
70
|
-
}, 16, ["head"])) : (0, vue.createCommentVNode)("v-if", true), ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(
|
|
78
|
+
}, 16, ["head"])) : (0, vue.createCommentVNode)("v-if", true), ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(internalTableComponents.value.tbody.is), (0, vue.mergeProps)({ body: __props.field.body }, internalTableComponents.value.tbody.shorthand), {
|
|
71
79
|
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.field.body.rows, (row) => {
|
|
72
80
|
return (0, vue.openBlock)(), (0, vue.createBlock)(require_PrismicTableRow.default, {
|
|
73
81
|
key: row.key,
|
|
74
82
|
row,
|
|
75
|
-
internalTableComponents:
|
|
83
|
+
internalTableComponents: internalTableComponents.value,
|
|
76
84
|
components: __props.components
|
|
77
85
|
}, null, 8, [
|
|
78
86
|
"row",
|
|
@@ -83,7 +91,7 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (
|
|
|
83
91
|
_: 1
|
|
84
92
|
}, 16, ["body"]))]),
|
|
85
93
|
_: 1
|
|
86
|
-
}, 16, ["table"])) : __props.fallback ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.fallback), { key: 1 })) : (0, vue.createCommentVNode)("v-if", true);
|
|
94
|
+
}, 16, ["table"])) : __props.fallback ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.fallback), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, _ctx.$attrs)), null, 16)) : (0, vue.createCommentVNode)("v-if", true);
|
|
87
95
|
};
|
|
88
96
|
}
|
|
89
97
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTable.vue_vue_type_script_setup_true_lang.cjs","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.cjs","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 { VueRichTextComponents } from \"../PrismicRichText\"\nimport { usePrismic } from \"../createPrismic\"\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 & VueRichTextComponents\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\nconst { componentsConfig } = usePrismic()\n\nconst resolvedComponents = computed<VueTableComponents & VueRichTextComponents>(\n\t() => {\n\t\treturn { ...componentsConfig?.defaultComponents, ...props.components }\n\t},\n)\n\nfunction getInternalComponent(type: keyof VueTableComponents) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[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":";;;;;;;;;;;;;;;;;;;;;;;;;;EA0CA,MAAM,QAAQ;EAGd,MAAM,EAAE,qBAAqB,kCAAW;EAExC,MAAM,6CACC;AACL,UAAO;IAAE,GAAG,kBAAkB;IAAmB,GAAG,MAAM;IAAW;IAEvE;EAEA,SAAS,qBAAqB,MAAgC;GAC7D,MAAM,4BAA4B,mBAAmB,QAAQ;AAE7D,OAAI,6BAAe,0BAA0B,CAC5C,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI,6DAAuB;IAC3B,WAAW;IACZ;;EAGD,MAAM,kDAAqE;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;;yBAKO,4BAAQ,CAAC,MAAM,QAAA,MAAK,gFACrB,wBAAA,MAAwB,MAAM,GAAE,sBA+B1B;;IA9BV,OAAO,QAAA;;OACKA,KAAAA;IAAM,GAAK,wBAAA,MAAwB,MAAM;IAAS,CAAA,EAAA;oCAenD,CAZL,QAAA,MAAM,oFACP,wBAAA,MAAwB,MAAM,GAAE,sBAW1B;;KAVV,MAAM,QAAA,MAAM;OACL,wBAAA,MAAwB,MAAM,UAAS,EAAA;qCAGhB,wDAK7B,cAAA,0BALa,QAAA,MAAM,KAAK,OAAlB,QAAG;wDAKT,iCAAA;OAJA,KAAK,IAAI;OACJ;OACL,yBAAyB,wBAAA;OACzB,YAAY,QAAA;;;;;;;;gJAIT,wBAAA,MAAwB,MAAM,GAAE,sBAW1B,EAVV,MAAM,QAAA,MAAM,QACL,wBAAA,MAAwB,MAAM,UAAS,EAAA;qCAGhB,wDAK7B,cAAA,0BALa,QAAA,MAAM,KAAK,OAAlB,QAAG;wDAKT,iCAAA;OAJA,KAAK,IAAI;OACJ;OACL,yBAAyB,wBAAA;OACzB,YAAY,QAAA;;;;;;;;;;wBAIM,QAAA,wFAAe,QAAA,SAAQ,8CAAA,EAAA,KAAA,GAAA,EAAUA,KAAAA,OAAM,CAAA,EAAA,MAAA,GAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { isVueComponent } from "../types.js";
|
|
2
|
+
import { usePrismic } from "../createPrismic.js";
|
|
2
3
|
import { defaultTableComponents } from "./PrismicTableDefaultComponents.js";
|
|
3
4
|
import PrismicTableRow_default from "./PrismicTableRow.js";
|
|
4
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, defineComponent, mergeProps, openBlock, renderList, resolveDynamicComponent, unref, withCtx } from "vue";
|
|
5
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, defineComponent, mergeProps, normalizeProps, openBlock, renderList, resolveDynamicComponent, unref, withCtx } from "vue";
|
|
5
6
|
import { isFilled } from "@prismicio/client";
|
|
6
7
|
|
|
7
8
|
//#region src/PrismicTable/PrismicTable.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -24,15 +25,22 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
24
25
|
},
|
|
25
26
|
setup(__props) {
|
|
26
27
|
const props = __props;
|
|
28
|
+
const { componentsConfig } = usePrismic();
|
|
29
|
+
const resolvedComponents = computed(() => {
|
|
30
|
+
return {
|
|
31
|
+
...componentsConfig?.defaultComponents,
|
|
32
|
+
...props.components
|
|
33
|
+
};
|
|
34
|
+
});
|
|
27
35
|
function getInternalComponent(type) {
|
|
28
|
-
const maybeComponentOrShorthand =
|
|
36
|
+
const maybeComponentOrShorthand = resolvedComponents.value?.[type];
|
|
29
37
|
if (isVueComponent(maybeComponentOrShorthand)) return { is: maybeComponentOrShorthand };
|
|
30
38
|
return {
|
|
31
39
|
is: defaultTableComponents[type],
|
|
32
40
|
shorthand: maybeComponentOrShorthand
|
|
33
41
|
};
|
|
34
42
|
}
|
|
35
|
-
const
|
|
43
|
+
const internalTableComponents = computed(() => {
|
|
36
44
|
return {
|
|
37
45
|
table: getInternalComponent("table"),
|
|
38
46
|
thead: getInternalComponent("thead"),
|
|
@@ -43,22 +51,22 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
43
51
|
};
|
|
44
52
|
});
|
|
45
53
|
return (_ctx, _cache) => {
|
|
46
|
-
return unref(isFilled).table(__props.field) ? (openBlock(), createBlock(resolveDynamicComponent(
|
|
54
|
+
return unref(isFilled).table(__props.field) ? (openBlock(), createBlock(resolveDynamicComponent(internalTableComponents.value.table.is), mergeProps({
|
|
47
55
|
key: 0,
|
|
48
56
|
table: __props.field
|
|
49
57
|
}, {
|
|
50
58
|
..._ctx.$attrs,
|
|
51
|
-
...
|
|
59
|
+
...internalTableComponents.value.table.shorthand
|
|
52
60
|
}), {
|
|
53
|
-
default: withCtx(() => [__props.field.head ? (openBlock(), createBlock(resolveDynamicComponent(
|
|
61
|
+
default: withCtx(() => [__props.field.head ? (openBlock(), createBlock(resolveDynamicComponent(internalTableComponents.value.thead.is), mergeProps({
|
|
54
62
|
key: 0,
|
|
55
63
|
head: __props.field.head
|
|
56
|
-
},
|
|
64
|
+
}, internalTableComponents.value.thead.shorthand), {
|
|
57
65
|
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.field.head.rows, (row) => {
|
|
58
66
|
return openBlock(), createBlock(PrismicTableRow_default, {
|
|
59
67
|
key: row.key,
|
|
60
68
|
row,
|
|
61
|
-
internalTableComponents:
|
|
69
|
+
internalTableComponents: internalTableComponents.value,
|
|
62
70
|
components: __props.components
|
|
63
71
|
}, null, 8, [
|
|
64
72
|
"row",
|
|
@@ -67,12 +75,12 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
67
75
|
]);
|
|
68
76
|
}), 128))]),
|
|
69
77
|
_: 1
|
|
70
|
-
}, 16, ["head"])) : createCommentVNode("v-if", true), (openBlock(), createBlock(resolveDynamicComponent(
|
|
78
|
+
}, 16, ["head"])) : createCommentVNode("v-if", true), (openBlock(), createBlock(resolveDynamicComponent(internalTableComponents.value.tbody.is), mergeProps({ body: __props.field.body }, internalTableComponents.value.tbody.shorthand), {
|
|
71
79
|
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.field.body.rows, (row) => {
|
|
72
80
|
return openBlock(), createBlock(PrismicTableRow_default, {
|
|
73
81
|
key: row.key,
|
|
74
82
|
row,
|
|
75
|
-
internalTableComponents:
|
|
83
|
+
internalTableComponents: internalTableComponents.value,
|
|
76
84
|
components: __props.components
|
|
77
85
|
}, null, 8, [
|
|
78
86
|
"row",
|
|
@@ -83,7 +91,7 @@ var PrismicTable_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
83
91
|
_: 1
|
|
84
92
|
}, 16, ["body"]))]),
|
|
85
93
|
_: 1
|
|
86
|
-
}, 16, ["table"])) : __props.fallback ? (openBlock(), createBlock(resolveDynamicComponent(__props.fallback), { key: 1 })) : createCommentVNode("v-if", true);
|
|
94
|
+
}, 16, ["table"])) : __props.fallback ? (openBlock(), createBlock(resolveDynamicComponent(__props.fallback), normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)), null, 16)) : createCommentVNode("v-if", true);
|
|
87
95
|
};
|
|
88
96
|
}
|
|
89
97
|
});
|
|
@@ -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 { VueRichTextComponents } from \"../PrismicRichText\"\nimport { usePrismic } from \"../createPrismic\"\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 & VueRichTextComponents\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\nconst { componentsConfig } = usePrismic()\n\nconst resolvedComponents = computed<VueTableComponents & VueRichTextComponents>(\n\t() => {\n\t\treturn { ...componentsConfig?.defaultComponents, ...props.components }\n\t},\n)\n\nfunction getInternalComponent(type: keyof VueTableComponents) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[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":";;;;;;;;;;;;;;;;;;;;;;;;;;EA0CA,MAAM,QAAQ;EAGd,MAAM,EAAE,qBAAqB,YAAW;EAExC,MAAM,qBAAqB,eACpB;AACL,UAAO;IAAE,GAAG,kBAAkB;IAAmB,GAAG,MAAM;IAAW;IAEvE;EAEA,SAAS,qBAAqB,MAAgC;GAC7D,MAAM,4BAA4B,mBAAmB,QAAQ;AAE7D,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTableRow.cjs","names":[],"sources":["../../../src/PrismicTable/PrismicTableRow.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableFieldBodyRow, TableFieldHeadRow } from \"@prismicio/client\"\n\nimport type { InternalVueTableComponents } from \"./types\"\n\nimport type {
|
|
1
|
+
{"version":3,"file":"PrismicTableRow.cjs","names":[],"sources":["../../../src/PrismicTable/PrismicTableRow.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableFieldBodyRow, TableFieldHeadRow } from \"@prismicio/client\"\n\nimport type { InternalVueTableComponents } from \"./types\"\n\nimport type { VueRichTextComponents } from \"../PrismicRichText\"\nimport PrismicRichText from \"../PrismicRichText/PrismicRichText.vue\"\n\nexport type PrismicTableRowProps = {\n\trow: TableFieldHeadRow | TableFieldBodyRow\n\tinternalTableComponents: InternalVueTableComponents\n\tcomponents?: VueRichTextComponents\n}\n\nconst props = defineProps<PrismicTableRowProps>()\ndefineOptions({ name: \"PrismicTableRow\" })\n</script>\n\n<template>\n\t<component\n\t\t:is=\"internalTableComponents.tr.is\"\n\t\t:row=\"row\"\n\t\tv-bind=\"internalTableComponents.tr.shorthand\"\n\t>\n\t\t<template v-for=\"cell in row.cells\" :key=\"cell.key\">\n\t\t\t<component\n\t\t\t\tv-if=\"cell.type === 'header'\"\n\t\t\t\t:is=\"internalTableComponents.th.is\"\n\t\t\t\t:cell=\"cell\"\n\t\t\t\tv-bind=\"internalTableComponents.th.shorthand\"\n\t\t\t>\n\t\t\t\t<PrismicRichText :field=\"cell.content\" :components=\"components\" />\n\t\t\t</component>\n\t\t\t<component\n\t\t\t\tv-else\n\t\t\t\t:is=\"internalTableComponents.td.is\"\n\t\t\t\t:cell=\"cell\"\n\t\t\t\tv-bind=\"internalTableComponents.td.shorthand\"\n\t\t\t>\n\t\t\t\t<PrismicRichText :field=\"cell.content\" :components=\"components\" />\n\t\t\t</component>\n\t\t</template>\n\t</component>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTableRow.js","names":[],"sources":["../../../src/PrismicTable/PrismicTableRow.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableFieldBodyRow, TableFieldHeadRow } from \"@prismicio/client\"\n\nimport type { InternalVueTableComponents } from \"./types\"\n\nimport type {
|
|
1
|
+
{"version":3,"file":"PrismicTableRow.js","names":[],"sources":["../../../src/PrismicTable/PrismicTableRow.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableFieldBodyRow, TableFieldHeadRow } from \"@prismicio/client\"\n\nimport type { InternalVueTableComponents } from \"./types\"\n\nimport type { VueRichTextComponents } from \"../PrismicRichText\"\nimport PrismicRichText from \"../PrismicRichText/PrismicRichText.vue\"\n\nexport type PrismicTableRowProps = {\n\trow: TableFieldHeadRow | TableFieldBodyRow\n\tinternalTableComponents: InternalVueTableComponents\n\tcomponents?: VueRichTextComponents\n}\n\nconst props = defineProps<PrismicTableRowProps>()\ndefineOptions({ name: \"PrismicTableRow\" })\n</script>\n\n<template>\n\t<component\n\t\t:is=\"internalTableComponents.tr.is\"\n\t\t:row=\"row\"\n\t\tv-bind=\"internalTableComponents.tr.shorthand\"\n\t>\n\t\t<template v-for=\"cell in row.cells\" :key=\"cell.key\">\n\t\t\t<component\n\t\t\t\tv-if=\"cell.type === 'header'\"\n\t\t\t\t:is=\"internalTableComponents.th.is\"\n\t\t\t\t:cell=\"cell\"\n\t\t\t\tv-bind=\"internalTableComponents.th.shorthand\"\n\t\t\t>\n\t\t\t\t<PrismicRichText :field=\"cell.content\" :components=\"components\" />\n\t\t\t</component>\n\t\t\t<component\n\t\t\t\tv-else\n\t\t\t\t:is=\"internalTableComponents.td.is\"\n\t\t\t\t:cell=\"cell\"\n\t\t\t\tv-bind=\"internalTableComponents.td.shorthand\"\n\t\t\t>\n\t\t\t\t<PrismicRichText :field=\"cell.content\" :components=\"components\" />\n\t\t\t</component>\n\t\t</template>\n\t</component>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicTable/PrismicTableRow.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableFieldBodyRow, TableFieldHeadRow } from \"@prismicio/client\"\n\nimport type { InternalVueTableComponents } from \"./types\"\n\nimport type {
|
|
1
|
+
{"version":3,"file":"PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicTable/PrismicTableRow.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableFieldBodyRow, TableFieldHeadRow } from \"@prismicio/client\"\n\nimport type { InternalVueTableComponents } from \"./types\"\n\nimport type { VueRichTextComponents } from \"../PrismicRichText\"\nimport PrismicRichText from \"../PrismicRichText/PrismicRichText.vue\"\n\nexport type PrismicTableRowProps = {\n\trow: TableFieldHeadRow | TableFieldBodyRow\n\tinternalTableComponents: InternalVueTableComponents\n\tcomponents?: VueRichTextComponents\n}\n\nconst props = defineProps<PrismicTableRowProps>()\ndefineOptions({ name: \"PrismicTableRow\" })\n</script>\n\n<template>\n\t<component\n\t\t:is=\"internalTableComponents.tr.is\"\n\t\t:row=\"row\"\n\t\tv-bind=\"internalTableComponents.tr.shorthand\"\n\t>\n\t\t<template v-for=\"cell in row.cells\" :key=\"cell.key\">\n\t\t\t<component\n\t\t\t\tv-if=\"cell.type === 'header'\"\n\t\t\t\t:is=\"internalTableComponents.th.is\"\n\t\t\t\t:cell=\"cell\"\n\t\t\t\tv-bind=\"internalTableComponents.th.shorthand\"\n\t\t\t>\n\t\t\t\t<PrismicRichText :field=\"cell.content\" :components=\"components\" />\n\t\t\t</component>\n\t\t\t<component\n\t\t\t\tv-else\n\t\t\t\t:is=\"internalTableComponents.td.is\"\n\t\t\t\t:cell=\"cell\"\n\t\t\t\tv-bind=\"internalTableComponents.td.shorthand\"\n\t\t\t>\n\t\t\t\t<PrismicRichText :field=\"cell.content\" :components=\"components\" />\n\t\t\t</component>\n\t\t</template>\n\t</component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;sFAoBO,QAAA,wBAAwB,GAAG,GAAE,sBAsBvB,EArBV,KAAK,QAAA,KAAG,EACD,QAAA,wBAAwB,GAAG,UAAS,EAAA;oCAET,wDAiBxB,cAAA,0BAjBc,QAAA,IAAI,QAAZ,SAAI;mFAAqB,KAAK,QAEvC,KAAK,SAAI,wFACV,QAAA,wBAAwB,GAAG,GAAE,sBAKvB;;MAJJ;2BACC,QAAA,wBAAwB,GAAG,UAAS,EAAA;sCAEsB,sBAAA,iCAAA;OAAhD,OAAO,KAAK;OAAU,YAAY,QAAA;;;wGAI/C,QAAA,wBAAwB,GAAG,GAAE,sBAKvB;;MAJJ;2BACC,QAAA,wBAAwB,GAAG,UAAS,EAAA;sCAEsB,sBAAA,iCAAA;OAAhD,OAAO,KAAK;OAAU,YAAY,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicTableRow.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicTable/PrismicTableRow.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableFieldBodyRow, TableFieldHeadRow } from \"@prismicio/client\"\n\nimport type { InternalVueTableComponents } from \"./types\"\n\nimport type {
|
|
1
|
+
{"version":3,"file":"PrismicTableRow.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicTable/PrismicTableRow.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { TableFieldBodyRow, TableFieldHeadRow } from \"@prismicio/client\"\n\nimport type { InternalVueTableComponents } from \"./types\"\n\nimport type { VueRichTextComponents } from \"../PrismicRichText\"\nimport PrismicRichText from \"../PrismicRichText/PrismicRichText.vue\"\n\nexport type PrismicTableRowProps = {\n\trow: TableFieldHeadRow | TableFieldBodyRow\n\tinternalTableComponents: InternalVueTableComponents\n\tcomponents?: VueRichTextComponents\n}\n\nconst props = defineProps<PrismicTableRowProps>()\ndefineOptions({ name: \"PrismicTableRow\" })\n</script>\n\n<template>\n\t<component\n\t\t:is=\"internalTableComponents.tr.is\"\n\t\t:row=\"row\"\n\t\tv-bind=\"internalTableComponents.tr.shorthand\"\n\t>\n\t\t<template v-for=\"cell in row.cells\" :key=\"cell.key\">\n\t\t\t<component\n\t\t\t\tv-if=\"cell.type === 'header'\"\n\t\t\t\t:is=\"internalTableComponents.th.is\"\n\t\t\t\t:cell=\"cell\"\n\t\t\t\tv-bind=\"internalTableComponents.th.shorthand\"\n\t\t\t>\n\t\t\t\t<PrismicRichText :field=\"cell.content\" :components=\"components\" />\n\t\t\t</component>\n\t\t\t<component\n\t\t\t\tv-else\n\t\t\t\t:is=\"internalTableComponents.td.is\"\n\t\t\t\t:cell=\"cell\"\n\t\t\t\tv-bind=\"internalTableComponents.td.shorthand\"\n\t\t\t>\n\t\t\t\t<PrismicRichText :field=\"cell.content\" :components=\"components\" />\n\t\t\t</component>\n\t\t</template>\n\t</component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;uBAmBC,YAuBY,wBAtBN,QAAA,wBAAwB,GAAG,GAAE,EADnC,WAuBY,EArBV,KAAK,QAAA,KAAG,EACD,QAAA,wBAAwB,GAAG,UAAS,EAAA;2BAET,mBAAnC,mBAiBW,UAAA,MAAA,WAjBc,QAAA,IAAI,QAAZ,SAAI;6DAAqB,KAAK,QAEvC,KAAK,SAAI,yBADhB,YAOY,wBALN,QAAA,wBAAwB,GAAG,GAAE,EAFnC,WAOY;;MAJJ;2BACC,QAAA,wBAAwB,GAAG,UAAS,EAAA;6BAEsB,CAAlE,YAAkE,yBAAA;OAAhD,OAAO,KAAK;OAAU,YAAY,QAAA;;;yCAErD,YAOY,wBALN,QAAA,wBAAwB,GAAG,GAAE,EAFnC,WAOY;;MAJJ;2BACC,QAAA,wBAAwB,GAAG,UAAS,EAAA;6BAEsB,CAAlE,YAAkE,yBAAA;OAAhD,OAAO,KAAK;OAAU,YAAY,QAAA"}
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicText.cjs","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n
|
|
1
|
+
{"version":3,"file":"PrismicText.cjs","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicText />`. */\nexport type PrismicTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The string value to be rendered when the field is empty. If a fallback is\n\t * not given, `\"\"` (nothing) will be rendered.\n\t */\n\tfallback?: string\n\n\t/**\n\t * The separator used between blocks.\n\t *\n\t * @defaultValue `\" \"` (a whitespace)\n\t */\n\tseparator?: string\n}\n\nconst props = defineProps<PrismicTextProps>()\ndefineOptions({ name: \"PrismicText\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.field === \"string\") {\n\t\t\tthrow new Error(\n\t\t\t\t`[PrismicText] The \"field\" prop only accepts a Rich Text or title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(\n\t\t\t\t\t\"prismictext-works-only-with-rich-text-and-title-fields\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\t}, {})\n}\n</script>\n\n<template>\n\t{{ asText(field) || fallback || \"\" }}\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicText.js","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n
|
|
1
|
+
{"version":3,"file":"PrismicText.js","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicText />`. */\nexport type PrismicTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The string value to be rendered when the field is empty. If a fallback is\n\t * not given, `\"\"` (nothing) will be rendered.\n\t */\n\tfallback?: string\n\n\t/**\n\t * The separator used between blocks.\n\t *\n\t * @defaultValue `\" \"` (a whitespace)\n\t */\n\tseparator?: string\n}\n\nconst props = defineProps<PrismicTextProps>()\ndefineOptions({ name: \"PrismicText\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.field === \"string\") {\n\t\t\tthrow new Error(\n\t\t\t\t`[PrismicText] The \"field\" prop only accepts a Rich Text or title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(\n\t\t\t\t\t\"prismictext-works-only-with-rich-text-and-title-fields\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\t}, {})\n}\n</script>\n\n<template>\n\t{{ asText(field) || fallback || \"\" }}\n</template>\n"],"mappings":""}
|
|
@@ -2,13 +2,9 @@ import * as vue21 from "vue";
|
|
|
2
2
|
import { RichTextField } from "@prismicio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/PrismicText.vue.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Props for `<PrismicText />`.
|
|
7
|
-
*/
|
|
5
|
+
/** Props for `<PrismicText />`. */
|
|
8
6
|
type PrismicTextProps = {
|
|
9
|
-
/**
|
|
10
|
-
* The Prismic rich text field to render.
|
|
11
|
-
*/
|
|
7
|
+
/** The Prismic rich text field to render. */
|
|
12
8
|
field: RichTextField | null | undefined;
|
|
13
9
|
/**
|
|
14
10
|
* The string value to be rendered when the field is empty. If a fallback is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicText.vue.d.ts","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrismicText.vue.d.ts","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":[],"mappings":";;;;;KAwDY,gBAAA;;EAAA,KAAA,EAEJ,aAFoB,GAAA,IAAA,GAAA,SAEpB;EAmDF;;;;EAAY,QAAA,CAAA,EAAA,MAAA;EAAA;;;;;EAAA,SAAA,CAAA,EAAA,MAAA;AAAA,CAAA;cAAZ,cAAY,KAAA,CAAA,gBAAA,kCAAA,KAAA,CAAA,qBAAA,EAAA,KAAA,CAAA,qBAAA,cAAA,KAAA,CAAA,WAAA,EAAA,SAAA,oBAAA,sCAAA,KAAA,CAAA,uBAAA;cAAA,iBAGU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicText.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n
|
|
1
|
+
{"version":3,"file":"PrismicText.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicText />`. */\nexport type PrismicTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The string value to be rendered when the field is empty. If a fallback is\n\t * not given, `\"\"` (nothing) will be rendered.\n\t */\n\tfallback?: string\n\n\t/**\n\t * The separator used between blocks.\n\t *\n\t * @defaultValue `\" \"` (a whitespace)\n\t */\n\tseparator?: string\n}\n\nconst props = defineProps<PrismicTextProps>()\ndefineOptions({ name: \"PrismicText\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.field === \"string\") {\n\t\t\tthrow new Error(\n\t\t\t\t`[PrismicText] The \"field\" prop only accepts a Rich Text or title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(\n\t\t\t\t\t\"prismictext-works-only-with-rich-text-and-title-fields\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\t}, {})\n}\n</script>\n\n<template>\n\t{{ asText(field) || fallback || \"\" }}\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EA2BA,MAAM,QAAQ;AAGd,MAAI,YACH,4BAAkB;AACjB,OAAI,OAAO,MAAM,UAAU,SAC1B,OAAM,IAAI,MACT,oRAAoR,sBACnR,yDACA,GACF;KAEC,EAAE,CAAA;;kDAKF,0BAAM,CAAC,QAAA,MAAK,IAAK,QAAA,YAAQ,GAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicText.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n
|
|
1
|
+
{"version":3,"file":"PrismicText.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\n\n/** Props for `<PrismicText />`. */\nexport type PrismicTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The string value to be rendered when the field is empty. If a fallback is\n\t * not given, `\"\"` (nothing) will be rendered.\n\t */\n\tfallback?: string\n\n\t/**\n\t * The separator used between blocks.\n\t *\n\t * @defaultValue `\" \"` (a whitespace)\n\t */\n\tseparator?: string\n}\n\nconst props = defineProps<PrismicTextProps>()\ndefineOptions({ name: \"PrismicText\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.field === \"string\") {\n\t\t\tthrow new Error(\n\t\t\t\t`[PrismicText] The \"field\" prop only accepts a Rich Text or title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(\n\t\t\t\t\t\"prismictext-works-only-with-rich-text-and-title-fields\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\t}, {})\n}\n</script>\n\n<template>\n\t{{ asText(field) || fallback || \"\" }}\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EA2BA,MAAM,QAAQ;AAGd,MAAI,IACH,mBAAkB;AACjB,OAAI,OAAO,MAAM,UAAU,SAC1B,OAAM,IAAI,MACT,oRAAoR,OACnR,yDACA,GACF;KAEC,EAAE,CAAA;;0BAKF,MAAA,OAAM,CAAC,QAAA,MAAK,IAAK,QAAA,YAAQ,GAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceZone.cjs","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n} from \"./types\"\n\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\n\n/**\n * Props for `<SliceZone />`.\n *\n * @typeParam TContext - Arbitrary data made available to all Slice components\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t
|
|
1
|
+
{"version":3,"file":"SliceZone.cjs","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n} from \"./types\"\n\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\n\n/**\n * Props for `<SliceZone />`.\n *\n * @typeParam TContext - Arbitrary data made available to all Slice components\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t/** List of slice data from the slice zone. */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/** A record mapping slice types to React components. */\n\tcomponents?: SliceZoneComponents\n\n\t/**\n\t * The Vue component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/** Arbitrary data made available to all slice components. */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type =\n\t\t\t\"slice_type\" in slice ? (slice.slice_type as string) : slice.type\n\n\t\tconst key =\n\t\t\t\"id\" in slice && typeof slice.id === \"string\"\n\t\t\t\t? slice.id\n\t\t\t\t: `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\n\n\t\tif (!is) {\n\t\t\treturn { is: TODOSliceComponent, key, props: { slice } }\n\t\t}\n\n\t\tif (slice.__mapped) {\n\t\t\tconst { __mapped, ...mappedProps } = slice\n\n\t\t\treturn { is, key, props: mappedProps }\n\t\t}\n\n\t\treturn {\n\t\t\tis,\n\t\t\tkey,\n\t\t\tprops: {\n\t\t\t\tslice,\n\t\t\t\tindex,\n\t\t\t\tcontext: props.context,\n\t\t\t\tslices: props.slices,\n\t\t\t},\n\t\t}\n\t})\n})\n</script>\n\n<template>\n\t<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":""}
|