UNPKG

vuepress-theme-hope

Version:

A light vuepress theme with tons of features

56 lines 2.73 kB
import { hasGlobalComponent } from "@vuepress/helper/client"; import { computed, defineComponent, h, resolveComponent } from "vue"; import { usePageData, usePageFrontmatter } from "vuepress/client"; import { RenderDefault } from "vuepress-shared/client"; import CommonWrapper from "@theme-hope/components/CommonWrapper"; import HomePage from "@theme-hope/components/HomePage"; import NormalPage from "@theme-hope/components/NormalPage"; import PortfolioHome from "@theme-hope/components/PortfolioHome"; import SkipLink from "@theme-hope/components/SkipLink"; import { FadeInUpTransition } from "@theme-hope/components/transitions/index"; import { usePure, useThemeData, useThemeLocaleData, useWindowSize, } from "@theme-hope/composables/index"; export default defineComponent({ // eslint-disable-next-line vue/multi-word-component-names name: "Layout", slots: Object, setup(_props, { slots }) { const theme = useThemeData(); const themeLocale = useThemeLocaleData(); const page = usePageData(); const frontmatter = usePageFrontmatter(); const isPure = usePure(); const { isMobile } = useWindowSize(); const sidebarDisplay = computed(() => __VP_BLOG__ ? (themeLocale.value.blog?.sidebarDisplay ?? theme.value.blog?.sidebarDisplay ?? "mobile") : "none"); return () => [ h(SkipLink), h(CommonWrapper, {}, { default: () => slots.default?.() ?? (frontmatter.value.portfolio ? h(PortfolioHome) : frontmatter.value.home ? h(HomePage) : h(isPure.value ? RenderDefault : FadeInUpTransition, () => h(NormalPage, { key: page.value.path }, { top: slots.top, bottom: slots.bottom, contentBefore: slots.contentBefore, contentAfter: slots.contentAfter, tocBefore: slots.tocBefore, tocAfter: slots.tocAfter, }))), navScreenBottom: sidebarDisplay.value === "none" && hasGlobalComponent("BloggerInfo") ? () => h(resolveComponent("BloggerInfo")) : null, sidebar: !isMobile.value && sidebarDisplay.value === "always" && hasGlobalComponent("BloggerInfo") ? () => h(resolveComponent("BloggerInfo")) : null, }), ]; }, }); //# sourceMappingURL=Layout.js.map