152 lines
4.3 KiB
JavaScript
152 lines
4.3 KiB
JavaScript
import { defineComponent, watch, useSlots, h, useSSRContext } from 'vue';
|
|
import _sfc_main$1 from './ContentRendererMarkdown-6936f2dc.mjs';
|
|
import 'destr';
|
|
import 'scule';
|
|
import 'property-information';
|
|
import '../server.mjs';
|
|
import 'ofetch';
|
|
import 'hookable';
|
|
import 'unctx';
|
|
import 'h3';
|
|
import '@unhead/ssr';
|
|
import 'unhead';
|
|
import '@unhead/shared';
|
|
import 'vue-router';
|
|
import 'ufo';
|
|
import '@intlify/core-base';
|
|
import 'cookie-es';
|
|
import 'is-https';
|
|
import 'anu-vue';
|
|
import 'vue/server-renderer';
|
|
import 'defu';
|
|
import '../../nitro/node-server.mjs';
|
|
import 'node-fetch-native/polyfill';
|
|
import 'node:http';
|
|
import 'node:https';
|
|
import 'unenv/runtime/fetch/index';
|
|
import 'klona';
|
|
import 'ohash';
|
|
import 'unstorage';
|
|
import 'unstorage/drivers/fs';
|
|
import 'unstorage/drivers/overlay';
|
|
import 'unstorage/drivers/memory';
|
|
import 'radix3';
|
|
import 'node:fs';
|
|
import 'node:url';
|
|
import 'pathe';
|
|
import '@intlify/bundle-utils';
|
|
import 'unified';
|
|
import 'mdast-util-to-string';
|
|
import 'micromark/lib/preprocess.js';
|
|
import 'micromark/lib/postprocess.js';
|
|
import 'unist-util-stringify-position';
|
|
import 'micromark-util-character';
|
|
import 'micromark-util-chunked';
|
|
import 'micromark-util-resolve-all';
|
|
import 'remark-emoji';
|
|
import 'rehype-slug';
|
|
import 'remark-squeeze-paragraphs';
|
|
import 'rehype-external-links';
|
|
import 'remark-gfm';
|
|
import 'rehype-sort-attribute-values';
|
|
import 'rehype-sort-attributes';
|
|
import 'rehype-raw';
|
|
import 'remark-mdc';
|
|
import 'remark-parse';
|
|
import 'remark-rehype';
|
|
import 'mdast-util-to-hast';
|
|
import 'detab';
|
|
import 'unist-builder';
|
|
import 'mdurl';
|
|
import 'slugify';
|
|
import 'unist-util-position';
|
|
import 'unist-util-visit';
|
|
import 'shiki-es';
|
|
import 'unenv/runtime/npm/consola';
|
|
import './preview-38d6e135.mjs';
|
|
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
name: "ContentRenderer",
|
|
props: {
|
|
/**
|
|
* The document to render.
|
|
*/
|
|
value: {
|
|
type: Object,
|
|
required: false,
|
|
default: () => ({})
|
|
},
|
|
/**
|
|
* Whether or not to render the excerpt.
|
|
* @default false
|
|
*/
|
|
excerpt: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
/**
|
|
* The tag to use for the renderer element if it is used.
|
|
* @default 'div'
|
|
*/
|
|
tag: {
|
|
type: String,
|
|
default: "div"
|
|
}
|
|
},
|
|
setup(props) {
|
|
watch(
|
|
() => props.excerpt,
|
|
(newExcerpt) => {
|
|
var _a, _b, _c;
|
|
if (newExcerpt && !((_a = props.value) == null ? void 0 : _a.excerpt)) {
|
|
console.warn(`No excerpt found for document content/${(_b = props == null ? void 0 : props.value) == null ? void 0 : _b._path}.${(_c = props == null ? void 0 : props.value) == null ? void 0 : _c._extension}!`);
|
|
console.warn("Make sure to use <!--more--> in your content if you want to use excerpt feature.");
|
|
}
|
|
},
|
|
{
|
|
immediate: true
|
|
}
|
|
);
|
|
},
|
|
/**
|
|
* Content empty fallback
|
|
* @slot empty
|
|
*/
|
|
render(ctx) {
|
|
var _a, _b, _c, _d;
|
|
const slots = useSlots();
|
|
const { value, excerpt, tag } = ctx;
|
|
if (!((_b = (_a = value == null ? void 0 : value.body) == null ? void 0 : _a.children) == null ? void 0 : _b.length) && (slots == null ? void 0 : slots.empty)) {
|
|
return slots.empty({ value, excerpt, tag, ...this.$attrs });
|
|
}
|
|
if (slots == null ? void 0 : slots.default) {
|
|
return slots.default({ value, excerpt, tag, ...this.$attrs });
|
|
}
|
|
if ((value == null ? void 0 : value._type) === "markdown" && ((_d = (_c = value == null ? void 0 : value.body) == null ? void 0 : _c.children) == null ? void 0 : _d.length)) {
|
|
return h(
|
|
_sfc_main$1,
|
|
{
|
|
value,
|
|
excerpt,
|
|
tag,
|
|
...this.$attrs
|
|
}
|
|
);
|
|
}
|
|
return h(
|
|
"pre",
|
|
null,
|
|
JSON.stringify({ message: "You should use slots with <ContentRenderer>", value, excerpt, tag }, null, 2)
|
|
);
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/.pnpm/@nuxt+content@2.6.0_rollup@2.79.1/node_modules/@nuxt/content/dist/runtime/components/ContentRenderer.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main as default };
|
|
//# sourceMappingURL=ContentRenderer-aa0632eb.mjs.map
|