UNPKG

vuepress-theme-hope

Version:

A light vuepress theme with tons of features

65 lines 2.7 kB
import { hasGlobalComponent } from "@vuepress/helper/client"; import { computed, defineComponent, h, resolveComponent } from "vue"; import { usePageFrontmatter, withBase } from "vuepress/client"; import { RenderDefault } from "vuepress-shared/client"; import BreadCrumb from "@theme-hope/components/BreadCrumb"; import MarkdownContent from "@theme-hope/components/MarkdownContent"; import PageNav from "@theme-hope/components/PageNav"; import PageTitle from "@theme-hope/components/PageTitle"; import { useThemeLocaleData } from "@theme-hope/composables/index"; import PageMeta from "@theme-hope/modules/info/components/PageMeta"; import TOC from "@theme-hope/modules/info/components/TOC"; import { useDarkMode } from "@theme-hope/modules/outlook/composables/index"; import "../styles/normal-page.scss"; export default defineComponent({ name: "NormalPage", slots: Object, setup(_props, { slots }) { const frontmatter = usePageFrontmatter(); const { isDarkMode } = useDarkMode(); const themeLocale = useThemeLocaleData(); const tocEnable = computed(() => frontmatter.value.toc ?? themeLocale.value.toc ?? true); const headerLevels = computed(() => [ 2, (frontmatter.value.headerDepth ?? themeLocale.value.headerDepth ?? 2) + 1, ]); return () => h("main", { id: "main-content", class: "vp-page" }, h(hasGlobalComponent("LocalEncrypt") ? resolveComponent("LocalEncrypt") : RenderDefault, () => [ slots.top?.(), frontmatter.value.cover ? h("div", { class: "page-cover" }, h("img", { src: withBase(frontmatter.value.cover), alt: "", "no-view": "", })) : null, h(BreadCrumb), h(PageTitle), tocEnable.value ? h(TOC, { options: { levels: headerLevels.value, ignore: [".vp-badge"], }, }, { before: slots.tocBefore, after: slots.tocAfter, }) : null, h(MarkdownContent, {}, { before: slots.contentBefore, after: slots.contentAfter, }), h(PageMeta), h(PageNav), hasGlobalComponent("CommentService") ? h(resolveComponent("CommentService"), { darkmode: isDarkMode.value, }) : null, slots.bottom?.(), ])); }, }); //# sourceMappingURL=NormalPage.js.map