hirsun-vuepress-theme-hope-plus
Version:
A light vuepress theme with tons of features and typewriter effect
1,049 lines (1,026 loc) • 64.5 kB
JavaScript
import { useSiteLocaleData, withBase, usePageData, usePageFrontmatter, useRouteLocale } from '@vuepress/client';
import { inject, provide, computed, toRef, defineComponent, h, ref, onMounted, watch, resolveComponent, shallowRef } from 'vue';
import { getAuthor, getCategory, getTag, getDate, entries, keys, VPLink, IconBase, Message, generateIndexFromHash, isAbsoluteUrl } from 'vuepress-shared/client';
import { icons } from '@temp/theme-hope/socialMedia';
import { b as useThemeData, a as useThemeLocaleData, u as usePure } from '../../themeData-51227756.js';
import { useBlogCategory, useBlogType } from 'vuepress-plugin-blog2/client';
import { a as ArticleInfoType, b as useNavigate, g as PageType, P as PageInfo, D as DropTransition, e as useWindowSize, S as SkipLink, C as CommonWrapper, H as HopeIcon, M as MarkdownContent, T as TOC } from '../../SkipLink-29f804a8.js';
import { useRoute, useRouter } from 'vue-router';
import { useReadingTimeLocaleConfig, getReadingTimeLocale } from 'vuepress-plugin-reading-time2/client';
import 'vuepress-shared/client/styles/message.scss';
import { isString, isLinkHttp } from '@vuepress/shared';
import defaultHeroBgImagePath from './assets/hero.jpg';
import '@vuepress/plugin-theme-data/client';
import '@vueuse/core';
import 'vuepress-shared/noopModule';
import '@vuepress/plugin-external-link-icon/client';
import '../../styles/variables.module.scss?module';
import '@temp/theme-hope/sidebar';
import 'balloon-css/balloon.css';
const categoryMapSymbol = Symbol.for("categoryMap");
const useCategoryMap = () => {
const categoryMap = inject(categoryMapSymbol);
if (!categoryMap)
throw new Error("useCategoryMap() is called without provider.");
return categoryMap;
};
const setupCategoryMap = () => {
const categoryMap = useBlogCategory("category");
provide(categoryMapSymbol, categoryMap);
};
const useBlogOptions = () => {
const themeData = useThemeData();
const themeLocale = useThemeLocaleData();
return computed(() => ({
...themeData.value.blog,
...themeLocale.value.blog
}));
};
const tagMapSymbol = Symbol.for("tagMap");
const useTagMap = () => {
const tagMap = inject(tagMapSymbol);
if (!tagMap)
throw new Error("useTagMap() is called without provider.");
return tagMap;
};
const setupTagMap = () => {
const tagMap = useBlogCategory("tag");
provide(tagMapSymbol, tagMap);
};
const useArticleAuthor = (info) => {
const themeLocale = useThemeLocaleData();
return computed(() => {
const { [ArticleInfoType.author]: author } = info.value;
if (author)
return getAuthor(author);
if (author === false)
return [];
return getAuthor(themeLocale.value.author, false);
});
};
const useArticleCategory = (info) => {
const categoryMap = useCategoryMap();
return computed(
() => getCategory(info.value[ArticleInfoType.category]).map((name) => ({
name,
path: categoryMap.value.map[name].path
}))
);
};
const useArticleTag = (info) => {
const tagMap = useTagMap();
return computed(
() => getTag(info.value[ArticleInfoType.tag]).map((name) => ({
name,
path: tagMap.value.map[name].path
}))
);
};
const useArticleDate = (info) => computed(() => {
const { [ArticleInfoType.date]: timestamp } = info.value;
return getDate(timestamp);
});
const useArticleInfo = (props) => {
const articleInfo = toRef(props, "info");
const blogOptions = useBlogOptions();
const author = useArticleAuthor(articleInfo);
const category = useArticleCategory(articleInfo);
const tag = useArticleTag(articleInfo);
const date = useArticleDate(articleInfo);
const readingTimeLocaleConfig = useReadingTimeLocaleConfig();
const info = computed(() => ({
author: author.value,
category: category.value,
date: date.value,
localizedDate: articleInfo.value[ArticleInfoType.localizedDate] || "",
tag: tag.value,
isOriginal: articleInfo.value[ArticleInfoType.isOriginal] || false,
readingTime: articleInfo.value[ArticleInfoType.readingTime] || null,
readingTimeLocale: articleInfo.value[ArticleInfoType.readingTime] && readingTimeLocaleConfig.value ? getReadingTimeLocale(
articleInfo.value[ArticleInfoType.readingTime],
readingTimeLocaleConfig.value
) : null,
pageview: props.path
}));
const items = computed(() => blogOptions.value.articleInfo);
return { info, items };
};
const articlesSymbol = Symbol(
__VUEPRESS_DEV__ ? "articles" : ""
);
const useArticles = () => {
const articles = inject(articlesSymbol);
if (!articles)
throw new Error("useArticles() is called without provider.");
return articles;
};
const setupArticles = () => {
const articles = useBlogType("article");
provide(articlesSymbol, articles);
};
const starsSymbol = Symbol(
__VUEPRESS_DEV__ ? "stars" : ""
);
const useStars = () => {
const stars = inject(starsSymbol);
if (!stars)
throw new Error("useStars() is called without provider.");
return stars;
};
const setupStars = () => {
const stars = useBlogType("star");
provide(starsSymbol, stars);
};
const timelinesSymbol = Symbol(
__VUEPRESS_DEV__ ? "timelines" : ""
);
const useTimelines = () => {
const timelines = inject(timelinesSymbol);
if (!timelines)
throw new Error("useTimelines() is called without provider.");
return timelines;
};
const setupTimelines = () => {
const timelines = useBlogType("timeline");
const timelineItems = computed(() => {
const timelineItems2 = [];
timelines.value.items.forEach(({ info, path }) => {
const date = getDate(info[ArticleInfoType.date]);
const year = date == null ? void 0 : date.getFullYear();
const month = date ? date.getMonth() + 1 : null;
const day = date == null ? void 0 : date.getDate();
if (year && month && day) {
if (!timelineItems2[0] || timelineItems2[0].year !== year)
timelineItems2.unshift({ year, items: [] });
timelineItems2[0].items.push({
date: `${month}/${day}`,
info,
path
});
}
});
return {
...timelines.value,
config: timelineItems2.reverse()
};
});
provide(timelinesSymbol, timelineItems);
};
const setupBlog = () => {
setupArticles();
setupCategoryMap();
setupStars();
setupTagMap();
setupTimelines();
};
var SocialMedia = defineComponent({
name: "SocialMedia",
setup() {
const blogOptions = useBlogOptions();
const isPure = usePure();
const mediaLinks = computed(() => {
const config = blogOptions.value.medias;
return config ? entries(config).map(([media, url]) => ({
name: media,
icon: icons[media],
url
})) : [];
});
return () => mediaLinks.value.length ? h(
"div",
{ class: "vp-social-medias" },
mediaLinks.value.map(
({ name, icon, url }) => h("a", {
class: "vp-social-media",
href: url,
rel: "noopener noreferrer",
target: "_blank",
"aria-label": name,
...isPure.value ? {} : { "data-balloon-pos": "up" },
innerHTML: icon
})
)
) : null;
}
});
var BloggerInfo = defineComponent({
name: "BloggerInfo",
setup() {
const blogOptions = useBlogOptions();
const siteLocale = useSiteLocaleData();
const themeLocale = useThemeLocaleData();
const articles = useArticles();
const categoryMap = useCategoryMap();
const tagMap = useTagMap();
const timelines = useTimelines();
const navigate = useNavigate();
const bloggerName = computed(
() => {
var _a;
return blogOptions.value.name || ((_a = getAuthor(themeLocale.value.author)[0]) == null ? void 0 : _a.name) || siteLocale.value.title;
}
);
const bloggerAvatar = computed(
() => blogOptions.value.avatar || themeLocale.value.logo
);
const locale = computed(() => themeLocale.value.blogLocales);
const intro = computed(() => blogOptions.value.intro);
return () => {
const { article, category, tag, timeline } = locale.value;
const countItems = [
[articles.value.path, articles.value.items.length, article],
[categoryMap.value.path, keys(categoryMap.value.map).length, category],
[tagMap.value.path, keys(tagMap.value.map).length, tag],
[timelines.value.path, timelines.value.items.length, timeline]
];
return h(
"div",
{
class: "vp-blogger-info",
vocab: "https://schema.org/",
typeof: "Person"
},
[
h(
"div",
{
class: "vp-blogger",
...intro.value ? {
style: { cursor: "pointer" },
"aria-label": locale.value.intro,
"data-balloon-pos": "down",
role: "navigation",
onClick: () => navigate(intro.value)
} : {}
},
[
bloggerAvatar.value ? h("img", {
class: [
"vp-blogger-avatar",
{ round: blogOptions.value.roundAvatar }
],
src: withBase(bloggerAvatar.value),
property: "image",
alt: "Blogger Avatar"
}) : null,
bloggerName.value ? h(
"div",
{ class: "vp-blogger-name", property: "name" },
bloggerName.value
) : null,
blogOptions.value.description ? h("div", {
class: "vp-blogger-description",
innerHTML: blogOptions.value.description
}) : null,
intro.value ? h("meta", { property: "url", content: withBase(intro.value) }) : null
]
),
h(
"div",
{ class: "vp-blog-counts" },
countItems.map(
([path, count, locale2]) => h(VPLink, { class: "vp-blog-count", to: path }, () => [
h("div", { class: "count" }, count),
h("div", locale2)
])
)
),
h(SocialMedia)
]
);
};
}
});
const CategoryIcon = () => h(
IconBase,
{ name: "category" },
() => h("path", {
d: "M148.41 106.992h282.176c22.263 0 40.31 18.048 40.31 40.31V429.48c0 22.263-18.047 40.31-40.31 40.31H148.41c-22.263 0-40.311-18.047-40.311-40.31V147.302c0-22.263 18.048-40.31 40.311-40.31zM147.556 553.478H429.73c22.263 0 40.311 18.048 40.311 40.31v282.176c0 22.263-18.048 40.312-40.31 40.312H147.555c-22.263 0-40.311-18.049-40.311-40.312V593.79c0-22.263 18.048-40.311 40.31-40.311zM593.927 106.992h282.176c22.263 0 40.31 18.048 40.31 40.31V429.48c0 22.263-18.047 40.31-40.31 40.31H593.927c-22.263 0-40.311-18.047-40.311-40.31V147.302c0-22.263 18.048-40.31 40.31-40.31zM730.22 920.502H623.926c-40.925 0-74.22-33.388-74.22-74.425V623.992c0-41.038 33.387-74.424 74.425-74.424h222.085c41.038 0 74.424 33.226 74.424 74.067v114.233c0 10.244-8.304 18.548-18.547 18.548s-18.548-8.304-18.548-18.548V623.635c0-20.388-16.746-36.974-37.33-36.974H624.13c-20.585 0-37.331 16.747-37.331 37.33v222.086c0 20.585 16.654 37.331 37.126 37.331H730.22c10.243 0 18.547 8.304 18.547 18.547 0 10.244-8.304 18.547-18.547 18.547z"
})
);
CategoryIcon.displayName = "CategoryIcon";
const TagIcon = () => h(
IconBase,
{ name: "tag" },
() => h("path", {
d: "M939.902 458.563L910.17 144.567c-1.507-16.272-14.465-29.13-30.737-30.737L565.438 84.098h-.402c-3.215 0-5.726 1.005-7.634 2.913l-470.39 470.39a10.004 10.004 0 000 14.164l365.423 365.424c1.909 1.908 4.42 2.913 7.132 2.913s5.223-1.005 7.132-2.913l470.39-470.39c2.01-2.11 3.014-5.023 2.813-8.036zm-240.067-72.121c-35.458 0-64.286-28.828-64.286-64.286s28.828-64.285 64.286-64.285 64.286 28.828 64.286 64.285-28.829 64.286-64.286 64.286z"
})
);
TagIcon.displayName = "TagIcon";
const TimelineIcon = () => h(
IconBase,
{ name: "timeline" },
() => h("path", {
d: "M511.997 70.568c-243.797 0-441.429 197.633-441.429 441.435 0 243.797 197.632 441.429 441.43 441.429S953.431 755.8 953.431 512.002c0-243.796-197.637-441.434-441.435-441.434zm150.158 609.093-15.605 15.61c-8.621 8.615-22.596 8.615-31.215 0L472.197 552.126c-4.95-4.944-4.34-14.888-4.34-24.677V247.14c0-12.19 9.882-22.07 22.07-22.07h22.07c12.19 0 22.07 9.882 22.07 22.07v273.218l128.088 128.088c8.62 8.62 8.62 22.595 0 31.215zm0 0"
})
);
TimelineIcon.displayName = "TimelineIcon";
const SlideIcon = () => h(
IconBase,
{ name: "slides" },
() => h("path", {
d: "M896 170.667v426.666a85.333 85.333 0 0 1-85.333 85.334h-256v61.184l192.597 115.584-43.861 73.13-148.736-89.173v95.275h-85.334v-95.318l-148.736 89.216-43.861-73.13 192.597-115.627v-61.141h-256A85.333 85.333 0 0 1 128 597.333V170.667H85.333V85.333h853.334v85.334H896zm-682.667 0v426.666h597.334V170.667H213.333zM426.667 512h-85.334V341.333h85.334V512zm128 0h-85.334V256h85.334v256zm128 0h-85.334V384h85.334v128z"
})
);
SlideIcon.displayName = "SlideIcon";
const StickyIcon = () => h(IconBase, { name: "sticky" }, () => [
h("path", {
d: "m381.3 733.8l-161.9 118c-5.9 4.5-13.2 6.6-20.1 6.6-8.7 0-17.7-3.4-24.3-10-12.2-12.2-13.9-31.3-3.5-45.2l144.5-195.5-113.6-112.9c-11.1-11.1-13.2-28.4-5.5-42 5.5-8.7 52.1-76.4 155.5-51 1.8 0.3 3.5 0.3 5.6 0.7 4.2 0.3 9 0.7 14.2 1.7 21.9 3.5 60.8-13.9 94.5-42.7 32.3-27.5 53.1-59.4 53.1-81.6 0-5.2 0-10.8-0.3-16-0.7-20.8-2.1-52.8 21.5-76.4 28.1-28.1 72.9-30.6 103.9-5.2 0.6 0.3 1 1 1.7 1.7 16.7 16.3 187.5 187.2 189.3 188.9 14.5 14.6 22.9 34.4 22.9 55.3 0 20.8-8 40.2-22.9 54.8-23.7 23.6-56 22.6-77.1 21.6-4.9 0-10.5-0.4-15.7-0.4-20.8 0-45.8 14.6-70.5 41.3-34.3 37.5-55.5 85.8-53.8 107.7 0.7 6.9 2.1 19.1 2.4 20.8 25 101.4-42.7 147.6-50.7 152.8-13.9 8.4-31.6 6.3-42.7-4.8l-112.1-112.2z"
})
]);
StickyIcon.displayName = "StickyIcon";
const ArticleIcon = () => h(
IconBase,
{ name: "article" },
() => h("path", {
d: "M853.333 938.667H170.667A42.667 42.667 0 0 1 128 896V128a42.667 42.667 0 0 1 42.667-42.667h682.666A42.667 42.667 0 0 1 896 128v768a42.667 42.667 0 0 1-42.667 42.667zm-42.666-85.334V170.667H213.333v682.666h597.334zM298.667 256h170.666v170.667H298.667V256zm0 256h426.666v85.333H298.667V512zm0 170.667h426.666V768H298.667v-85.333zm256-384h170.666V384H554.667v-85.333z"
})
);
ArticleIcon.displayName = "ArticleIcon";
const BookIcon = () => h(
IconBase,
{ name: "book" },
() => h("path", {
d: "M256 853.333h426.667A85.333 85.333 0 0 0 768 768V256a85.333 85.333 0 0 0-85.333-85.333H469.333a42.667 42.667 0 0 1 0-85.334h213.334A170.667 170.667 0 0 1 853.333 256v512a170.667 170.667 0 0 1-170.666 170.667H213.333A42.667 42.667 0 0 1 170.667 896V128a42.667 42.667 0 0 1 42.666-42.667h128A42.667 42.667 0 0 1 384 128v304.256l61.653-41.088a42.667 42.667 0 0 1 47.36 0l61.654 41.045V256A42.667 42.667 0 0 1 640 256v256a42.667 42.667 0 0 1-66.347 35.499l-104.32-69.547-104.32 69.547A42.667 42.667 0 0 1 298.667 512V170.667H256v682.666z"
})
);
BookIcon.displayName = "BookIcon";
const LinkIcon = () => h(
IconBase,
{ name: "link" },
() => h("path", {
d: "M460.8 584.533c17.067 17.067 17.067 42.667 0 59.734-17.067 17.066-42.667 17.066-59.733 0-85.334-85.334-85.334-217.6 0-302.934L554.667 192C640 110.933 776.533 110.933 857.6 196.267c81.067 81.066 81.067 213.333 0 294.4l-68.267 64c0-34.134-4.266-68.267-17.066-102.4l21.333-21.334c51.2-46.933 55.467-128 4.267-179.2s-128-55.466-179.2-4.266c-4.267 0-4.267 4.266-4.267 4.266L465.067 401.067c-51.2 51.2-51.2 132.266-4.267 183.466m123.733-183.466C601.6 384 627.2 384 644.267 401.067c85.333 85.333 85.333 217.6 0 302.933l-153.6 149.333C405.333 934.4 268.8 934.4 187.733 849.067c-81.066-81.067-81.066-213.334 0-294.4l68.267-64c0 34.133 4.267 72.533 17.067 102.4L251.733 614.4C204.8 665.6 204.8 746.667 256 793.6c51.2 46.933 123.733 46.933 174.933 0l149.334-149.333c51.2-51.2 51.2-128 0-179.2-12.8-17.067-17.067-46.934 4.266-64z"
})
);
LinkIcon.displayName = "LinkIcon";
const ProjectIcon = () => h(
IconBase,
{ name: "project" },
() => h("path", {
d: "M987.456 425.152H864V295.296a36.48 36.48 0 0 0-36.544-36.544h-360l-134.08-128.256A9.344 9.344 0 0 0 327.04 128H36.48A36.48 36.48 0 0 0 0 164.544v676.608a36.48 36.48 0 0 0 36.544 36.544h797.76a36.672 36.672 0 0 0 33.92-22.848L1021.44 475.52a36.48 36.48 0 0 0-33.92-50.304zM82.304 210.304h215.424l136.64 130.752h347.328v84.096H198.848A36.672 36.672 0 0 0 164.928 448L82.304 652.8V210.304zM808.32 795.456H108.544l118.08-292.608h699.904L808.32 795.52z"
})
);
ProjectIcon.displayName = "ProjectIcon";
const FriendIcon = () => h(
IconBase,
{ name: "friend" },
() => h("path", {
d: "M860.16 213.333A268.373 268.373 0 0 0 512 186.027a267.52 267.52 0 0 0-348.16 404.48L428.8 855.893a118.613 118.613 0 0 0 166.4 0l264.96-265.386a267.52 267.52 0 0 0 0-377.174zM800 531.627l-264.96 264.96a32.427 32.427 0 0 1-46.08 0L224 530.347a183.04 183.04 0 0 1 0-256 182.187 182.187 0 0 1 256 0 42.667 42.667 0 0 0 60.587 0 182.187 182.187 0 0 1 256 0 183.04 183.04 0 0 1 3.413 256z"
})
);
FriendIcon.displayName = "FriendIcon";
const SlideDownIcon = () => h(
IconBase,
{ name: "slide-down" },
() => h("path", {
d: "M108.775 312.23c13.553 0 27.106 3.734 39.153 11.806l375.205 250.338 363.641-252.808c32.587-21.624 76.499-12.83 98.123 19.757 21.685 32.467 12.95 76.56-19.576 98.184l-402.854 278.89c-23.733 15.901-54.694 15.962-78.547.12L69.501 442.097c-32.647-21.685-41.441-65.777-19.817-98.304 13.734-20.54 36.201-31.563 59.09-31.563Z"
})
);
SlideDownIcon.displayName = "SlideDownIcon";
const EmptyIcon = () => h("svg", {
xmlns: "http://www.w3.org/2000/svg",
// eslint-disable-next-line @typescript-eslint/naming-convention
"xmlns:xlink": "http://www.w3.org/1999/xlink",
class: "empty-icon",
viewBox: "0 0 1024 1024",
innerHTML: '<defs><linearGradient id="f" x1="512.342" y1="2266.13" x2="512.342" y2="666.063" gradientUnits="userSpaceOnUse"><stop offset=".919" stop-color="#e6e6e6" stop-opacity="0"/><stop offset="1" stop-color="#e6e6e6"/></linearGradient><linearGradient id="g" x1="528.912" y1="774" x2="388.088" y2="612" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ccc"/><stop offset="1" stop-color="#e6e6e6" stop-opacity="0"/></linearGradient><linearGradient id="h" x1="213.219" y1="721.704" x2="251.313" y2="683.61" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#d7d7d7"/><stop offset=".485" stop-color="#fafafa"/><stop offset="1" stop-color="#fafafa"/></linearGradient><linearGradient id="i" x1="724.813" y1="821.718" x2="768.656" y2="777.876" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ccc"/><stop offset="1" stop-color="#fafafa"/></linearGradient><linearGradient id="a" x1="513.493" y1="714.594" x2="471.007" y2="544.188" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#999"/><stop offset="1" stop-color="#ccc"/></linearGradient><linearGradient id="b" x1="440.156" y1="564.031" x2="508.594" y2="495.594" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ccc"/><stop offset="1" stop-color="#f0f0f0"/></linearGradient><linearGradient id="l" x1="660.988" y1="754.156" x2="608.637" y2="544.188" xlink:href="#a"/><linearGradient id="m" x1="479.188" y1="774.219" x2="649.782" y2="603.625" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b3b3b3"/><stop offset="1" stop-color="#e6e6e6"/></linearGradient><linearGradient id="n" x1="447.121" y1="774.219" x2="394.661" y2="563.813" xlink:href="#a"/><linearGradient id="o" x1="494" y1="597" x2="628" y2="463" xlink:href="#b"/><linearGradient id="d" x1="610.485" y1="604.938" x2="697.298" y2="518.125" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ccc"/><stop offset="1" stop-color="#fff"/></linearGradient><linearGradient id="p" x1="457.438" y1="619.25" x2="353.469" y2="619.25" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e6e6e6" stop-opacity="0"/><stop offset="1" stop-color="#e6e6e6"/></linearGradient><linearGradient id="q" x1="542.734" y1="674.25" x2="615.672" y2="601.313" xlink:href="#b"/><linearGradient id="c" x1="627.933" y1="358.938" x2="685.192" y2="422.531" gradientUnits="userSpaceOnUse"><stop offset=".4" stop-color="#e6e6e6" stop-opacity=".4"/><stop offset=".443" stop-color="#fff"/><stop offset=".6" stop-color="#ccc"/></linearGradient><linearGradient id="r" x1="618.547" y1="422.531" x2="681.547" y2="359.531" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e6e6e6"/><stop offset=".761" stop-color="#fff"/><stop offset="1" stop-color="#f0f0f0"/></linearGradient><linearGradient id="s" x1="625" y1="441.5" x2="697" y2="369.5" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ccc"/><stop offset=".761" stop-color="#fff"/><stop offset="1" stop-color="#f0f0f0"/></linearGradient><linearGradient id="t" x1="627.681" y1="361.438" x2="692.257" y2="433.156" xlink:href="#c"/><linearGradient id="u" x1="561.414" y1="735.438" x2="573.149" y2="688.375" xlink:href="#d"/><linearGradient id="v" x1="405" y1="485.875" x2="440" y2="450.875" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ccc"/><stop offset="1" stop-color="#fff" stop-opacity=".702"/></linearGradient><linearGradient id="w" x1="404.61" y1="486.906" x2="441.86" y2="449.656" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ccc"/><stop offset=".495" stop-color="#ccc" stop-opacity=".702"/><stop offset=".498" stop-color="#ccc"/><stop offset="1" stop-color="#fff" stop-opacity=".302"/></linearGradient><radialGradient id="e" cx="329.297" cy="647.578" r="8.172" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fafafa"/><stop offset="1.2" stop-color="#e6e6e6"/></radialGradient><radialGradient id="j" cx="802.297" cy="673.578" r="8.172" xlink:href="#e"/><radialGradient id="k" cx="774.844" cy="642.75" r="5.531" xlink:href="#e"/></defs><path d="M512.33 666.07c441.828 0 800 358.18 800 800.03s-358.172 800.02-800 800.02-800-358.18-800-800.02 358.17-800.03 800-800.03z" style="fill:url(#f);fill-rule:evenodd"/><path d="m272 694 242-82 131 119-188 43z" style="fill:url(#g);fill-rule:evenodd"/><path fill="#b3b3b3" fill-rule="evenodd" d="M232.391 723.534a2.4 2.4 0 0 1 2.4 2.4v17.725a2.4 2.4 0 0 1-4.8 0v-17.725a2.4 2.4 0 0 1 2.4-2.4z"/><path d="M232.255 676.559c10.33 0 17.067 15.408 18.7 28.493 1.619 12.942-2.372 23.694-18.7 23.694-16.878 0-20.213-10.733-18.7-23.694 1.633-14.061 8.37-28.493 18.7-28.493z" style="fill:url(#h);fill-rule:evenodd"/><path fill="#b3b3b3" fill-rule="evenodd" d="M745.853 826h.938a2.4 2.4 0 0 1 2.4 2.4v22.238a2.4 2.4 0 0 1-2.4 2.4h-.938a2.4 2.4 0 0 1-2.4-2.4V828.4a2.4 2.4 0 0 1 2.4-2.4z"/><path d="M746.727 830.3c-19.438 0-23.278-9.326-21.541-20.59a34.467 34.467 0 0 1 3.289-10.369 16.628 16.628 0 0 1 0-9.112c2.889-12.327 12.059-20.911 18.356-20.911 6.56 0 15.468 9.1 18.356 20.911a14.589 14.589 0 0 1-.335 9.217 34.36 34.36 0 0 1 3.419 10.264c1.861 11.243-2.735 20.59-21.544 20.59z" style="fill:url(#i);fill-rule:evenodd"/><path fill="#ccc" fill-rule="evenodd" d="M328.841 654.562a6.571 6.571 0 0 0-5.2-5.027q-4.107-.952-.034-2.045a6.571 6.571 0 0 0 5.027-5.2q.952-4.109 2.045-.035a6.569 6.569 0 0 0 5.2 5.027q4.109.954.035 2.045a6.569 6.569 0 0 0-5.027 5.2q-.955 4.108-2.046.035z"/><path d="M328.383 653.73a6.567 6.567 0 0 0-5.2-5.027q-4.109-.954-.035-2.045a6.568 6.568 0 0 0 5.027-5.2q.954-4.107 2.046-.034a6.568 6.568 0 0 0 5.2 5.027q4.107.952.035 2.045a6.568 6.568 0 0 0-5.027 5.2q-.954 4.104-2.046.034z" style="fill:url(#e);fill-rule:evenodd"/><path fill="#ccc" fill-rule="evenodd" d="M801.841 680.562a6.571 6.571 0 0 0-5.2-5.027q-4.107-.952-.034-2.045a6.571 6.571 0 0 0 5.027-5.2q.952-4.109 2.045-.035a6.569 6.569 0 0 0 5.2 5.027q4.108.954.035 2.045a6.569 6.569 0 0 0-5.027 5.2q-.955 4.108-2.046.035z"/><path d="M801.383 679.73a6.567 6.567 0 0 0-5.2-5.027q-4.108-.954-.035-2.045a6.568 6.568 0 0 0 5.027-5.2q.954-4.107 2.046-.034a6.568 6.568 0 0 0 5.2 5.027q4.107.952.035 2.045a6.568 6.568 0 0 0-5.027 5.2q-.954 4.104-2.046.034z" style="fill:url(#j);fill-rule:evenodd"/><path d="M774.21 646.9a4.446 4.446 0 0 0-3.517-3.4q-2.778-.643-.023-1.383a4.443 4.443 0 0 0 3.4-3.517q.645-2.778 1.383-.023a4.443 4.443 0 0 0 3.517 3.4q2.778.645.023 1.383a4.446 4.446 0 0 0-3.4 3.517q-.645 2.78-1.383.023z" style="fill:url(#k);fill-rule:evenodd"/><path d="m385.6 714.6.158-150.658L598.9 544.174l-.158 150.658z" style="fill:url(#a);fill-rule:evenodd"/><path d="m385.474 564.031 214.763-19.383-36.171-49.067-215.559 17.634z" style="fill:url(#b);fill-rule:evenodd"/><path d="m598.744 694.832.156-150.658 71.975 59.319-.158 150.658z" style="fill:url(#l);fill-rule:evenodd"/><path d="m457.064 774.209.158-150.658 214.691-19.914-.158 150.663z" style="fill:url(#m);fill-rule:evenodd"/><path d="m384.566 714.459.158-150.659 72.5 59.75-.158 150.658z" style="fill:url(#n);fill-rule:evenodd"/><path d="M494 640s75.357-58.4 42-83-38.887 1.663-37 14 53.847 12.465 54-26c.2-49.979 75-125 75-125" style="fill:none;stroke-width:3px;stroke-dasharray:12 6;stroke:url(#o);fill-rule:evenodd"/><path d="m670.275 604.939-72.041-59.9 38.476-26.909 72.86 58.159z" style="fill:url(#d);fill-rule:evenodd"/><path d="m425.5 674.383-72.042-59.9 31.109-50.347 72.86 58.16z" style="fill:url(#p);fill-rule:evenodd"/><path d="m487.918 674.235 214.482-22.57-31.1-50.346-215.309 20.833z" style="fill:url(#q);fill-rule:evenodd"/><path style="fill:#fff;fill-rule:evenodd" d="m697.363 358.927-69.58 62.511-12.035 1.082z"/><path d="m697.363 358.927-69.58 62.511-12.035 1.082z" style="fill:url(#c);fill-rule:evenodd"/><path d="M615.748 422.52 604 413l92.089-53.46" style="fill:url(#r);fill-rule:evenodd"/><path d="m625 432 12 18 60-89" style="fill:url(#s);fill-rule:evenodd"/><path d="m626.98 421.335-2.471 11.828 70.918-71.735" style="fill:#fff;fill-rule:evenodd"/><path d="m626.98 421.335-2.471 11.828 70.918-71.735" style="fill:url(#t);fill-rule:evenodd"/><path d="m494.814 735.44 21.293-2.1v-6.613l-13.4 1.319v-6.965l10.977-1.08v-6.613l-10.977 1.08v-6.084l12.917-1.27v-6.525l-20.808 2.047v32.8zM521 732.863l7.054-.694v-11.241a106.361 106.361 0 0 0-1.014-11.274l.176-.017 2.645 7.586 4.453 11.553 4.32-.425 4.408-12.424 2.733-8.116.177-.018a111.811 111.811 0 0 0-1.014 11.474v11.241l7.185-.707V697l-8.552.841-5.025 14.646c-.618 1.956-1.147 4.08-1.808 6.173l-.22.022c-.617-1.968-1.146-3.987-1.808-5.818l-5.2-13.639-8.508.837v32.8zm37.213-3.661 7.891-.776v-10.889l3.835-.377c6.922-.681 12.961-4.714 12.961-12.517 0-8.111-5.951-10.082-13.181-9.371l-11.504 1.128v32.8zm7.891-17.881v-9.478l3.218-.316c3.792-.373 5.908.565 5.908 3.871 0 3.218-1.852 5.208-5.687 5.585zM594 725.682l7.891-.777v-26.274l8.905-.876v-6.524l-25.657 2.524v6.524l8.861-.871v26.274zm27.991-2.754 7.847-.772v-11.594l9.919-22.18-8.244.811-2.733 7.542c-.925 2.56-1.807 4.939-2.733 7.587l-.176.018c-.926-2.466-1.764-4.676-2.645-7.058l-2.734-7-8.375.824 9.874 20.233v11.594z" style="fill:url(#u);fill-rule:evenodd"/><path fill="#ccc" fill-rule="evenodd" d="M408.938 457.309a17.5 17.5 0 0 0 21.374 26.725 17.5 17.5 0 1 1-16.306-30.955 17.442 17.442 0 0 0-5.068 4.23z"/><circle cx="422.5" cy="468.375" r="17.5" style="fill:url(#v)"/><path fill="#ccc" fill-rule="evenodd" d="M391.76 451.5c-2.358 4.419 9.827 15.52 27.215 24.8 15.131 8.071 29.212 12.1 34.166 10.093-4.191 2.772-18.943-1.24-34.86-9.73-17.388-9.275-29.573-20.376-27.215-24.8a2.96 2.96 0 0 1 1.585-1.3 2.606 2.606 0 0 0-.891.937z"/><path d="M418.975 476.29c-17.388-9.275-29.573-20.376-27.215-24.8s18.363-.484 35.751 8.791 29.572 20.376 27.215 24.8-18.364.483-35.751-8.791zm31.634 5.732c1.824-3.42-8.789-12.642-23.7-20.6s-28.486-11.633-30.31-8.213 8.789 12.642 23.7 20.6 28.486 11.633 30.31 8.213zm-36.645-29.008-2.775 1.452.032 1.751 28.637 14.183.266-4.559z" style="fill:url(#w);fill-rule:evenodd"/><g class="people"><path style="fill:#f8cfad;fill-rule:evenodd" d="m612.131 676.5 1.362 3.532 3.255-2.324-1.361-3.532zM629.131 665.5l1.362 3.532 3.255-2.324-1.361-3.532z"/><path style="fill:#141a33;fill-rule:evenodd" d="m617.764 678.184-3.162-.078a11.028 11.028 0 0 0-1.034 3.454c-.258 2.006-1.177 5-.449 5.367 1.5 2.659 4.118-.215 4.118-.215s2.187-2.848 1.925-5.265c-.106-.973-1.181-1.869-1.398-3.263zM633.781 665.855l3.019.945a11.008 11.008 0 0 1-.137 3.6c-.4 1.981-.179 4.166-.986 4.277-2.283 2.03-3.827-1.533-3.827-1.533s-1.473-2.456-.444-4.659c.412-.88 1.718-1.385 2.375-2.63z"/><path style="fill:#f0c5a8;fill-rule:evenodd" d="M599.935 592.534s10.293 9.761 11.95 7.564 3.536-3.463-6.758-13.65z"/><path style="fill:#f8cfad;fill-rule:evenodd" d="M611.3 596.361c1.674-1.105 11.5 7.048 14.5 11.774s-12.705-4.36-14.632-6.776-1.54-3.893.132-4.998z"/><path style="fill:#f8cfad;fill-rule:evenodd" d="M621.815 607.988s1.809 2.549 2.433 1.756 2.475-1.064 2.449-1.138.1-.819 1.288-2.331-3.8-3.632-5.81-.494a2.556 2.556 0 0 0-.36 2.207z"/><path fill="#232c57" fill-rule="evenodd" d="M598 617s14.968-5.618 17 7a150.235 150.235 0 0 1 2 22s12.666 11.836 16 19c0 0-4.753-1.629-4 2 0 0-18.132-14.647-19-19s-9.148-18.716-12-31z"/><path d="M589 622s14.968-5.618 17 7a150.235 150.235 0 0 1 2 22s4.666 17.836 8 25c0 0-4.753-1.629-4 2 0 0-10.132-20.647-11-25s-9.148-18.716-12-31z" style="fill:#292966;fill-rule:evenodd"/><path style="fill:#f0c5a8;fill-rule:evenodd" d="M585.626 597.7s-10.292 9.761-11.95 7.563-3.536-3.463 6.758-13.65z"/><path style="fill:#f8cfad;fill-rule:evenodd" d="M574.259 601.529c-1.675-1.105-11.5 7.049-14.5 11.774s12.7-4.36 14.631-6.775 1.543-3.894-.131-4.999z"/><path style="fill:#f0c5a8;fill-rule:evenodd" d="M591.715 577.752s-.606 1.681 1.48 3.716-3.615 5.307-4.645 2.85-.48-2.716-.48-2.716z"/><path style="fill:#f8cfad;fill-rule:evenodd" d="M583.527 574.123c-.839 1.043.491 3.873 1.453 5.449s2.749 2.833 3.364 2.428 4.088-2.657 4-4-.228-3.4-.228-3.4 2.562-1.641 2.154-2.916-2.916-.154-2.916-.154a15.853 15.853 0 0 0-.227-2.224c-.189-.929-6.887-1.445-7.827 2.6s.558 1.805.227 2.217z"/><path fill="#232c57" fill-rule="evenodd" d="M584.227 567.758c2.1-.885 7.2-3.684 10.125.318s.842 4.385.989 5.294-1.894 5.69-1.341 6.63-3.865.8-4.657-1.179-2.844-.539-2.227-1.224-1.3-4.456-2.916-2.154a9.252 9.252 0 0 0 .309-1.38c-.115.192.259-3.257-.673-1.32s-2.1 1.037-3.069.762-1.8-1.118-1.071-1.689c.023-.016 2.436-3.172 4.531-4.058z"/><path d="M589 585c-2.584-.47-10.055.362-13 13 0 0 1.9 3.349 5 4s6 21 6 21 24.016 11.06 27-3c-.07-13.826-8-21-8-21s5.829-3.2 5-6-8.016-10.153-11-10-6 0-6 0-2.416 2.47-5 2z" style="fill:#f6bb07;fill-rule:evenodd"/><path style="fill:#f8cfad;fill-rule:evenodd" d="M563.284 612.581s-.986 2.965-1.814 2.389-2.678-.3-2.675-.374-.333-.755-1.912-1.854 2.577-4.583 5.414-2.167a2.551 2.551 0 0 1 .987 2.006z"/></g>'
});
EmptyIcon.displayName = "EmptyIcon";
const LockIcon = () => h(
IconBase,
{ name: "lock" },
() => h("path", {
d: "M787.168 952.268H236.832c-30.395 0-55.033-24.638-55.033-55.033V429.45c0-30.395 24.638-55.034 55.033-55.034h82.55V264.35c0-106.38 86.238-192.618 192.618-192.618S704.618 157.97 704.618 264.35v110.066h82.55c30.395 0 55.033 24.639 55.033 55.034v467.785c0 30.395-24.639 55.033-55.033 55.033zM484.483 672.046v115.122h55.034V672.046c31.99-11.373 55.033-41.605 55.033-77.496 0-45.592-36.958-82.55-82.55-82.55s-82.55 36.958-82.55 82.55c0 35.89 23.042 66.123 55.033 77.496zM622.067 264.35c0-60.788-49.28-110.067-110.067-110.067s-110.067 49.28-110.067 110.067v110.066h220.135V264.35z"
})
);
LockIcon.displayName = "LockIcon";
var ArticleItem = defineComponent({
name: "ArticleItem",
props: {
/**
* Article information
*
* 文章信息
*/
info: {
type: Object,
required: true
},
/**
* Article path
*
* 文章路径
*/
path: { type: String, required: true }
},
slots: Object,
setup(props, { slots }) {
const articleInfo = toRef(props, "info");
const { info: pageInfo, items } = useArticleInfo(props);
return () => {
var _a, _b, _c;
const {
[ArticleInfoType.title]: title,
[ArticleInfoType.type]: type,
[ArticleInfoType.isEncrypted]: isEncrypted = false,
[ArticleInfoType.cover]: cover,
[ArticleInfoType.excerpt]: excerpt,
[ArticleInfoType.sticky]: sticky
} = articleInfo.value;
const info = pageInfo.value;
return h(
"div",
{ class: "vp-article-wrapper" },
h(
"article",
{
class: "vp-article-item",
vocab: "https://schema.org/",
typeof: "Article"
},
[
((_a = slots.cover) == null ? void 0 : _a.call(slots, { cover })) || (cover ? [
h("img", {
class: "vp-article-cover",
src: withBase(cover)
}),
h("meta", {
property: "image",
content: withBase(cover)
})
] : []),
sticky ? h(StickyIcon) : null,
h(
VPLink,
{ to: props.path },
() => {
var _a2;
return ((_a2 = slots.title) == null ? void 0 : _a2.call(slots, { title, isEncrypted, type })) || h("header", { class: "vp-article-title" }, [
isEncrypted ? h(LockIcon) : null,
type === PageType.slide ? h(SlideIcon) : null,
h("span", { property: "headline" }, title)
]);
}
),
((_b = slots.excerpt) == null ? void 0 : _b.call(slots, { excerpt })) || (excerpt ? h("div", {
class: "vp-article-excerpt",
innerHTML: excerpt
}) : null),
h("hr", { class: "vp-article-hr" }),
((_c = slots.info) == null ? void 0 : _c.call(slots, { info })) || h(PageInfo, {
info,
...items.value ? { items: items.value } : {}
})
]
)
);
};
}
});
var Pagination = defineComponent({
// eslint-disable-next-line vue/multi-word-component-names
name: "Pagination",
props: {
/**
* Number of total items
*
* 项目总数
*/
total: { type: Number, default: 10 },
/**
* Items per page
*
* 每页项目数
*/
perPage: { type: Number, default: 10 },
/**
* Current page number
*
* 当前页面
*/
current: { type: Number, default: 1 }
},
emits: ["updateCurrentPage"],
setup(props, { emit }) {
let message;
const themeLocale = useThemeLocaleData();
const input = ref("");
const locale = computed(() => themeLocale.value.paginationLocales);
const totalPages = computed(() => Math.ceil(props.total / props.perPage));
const enable = computed(
() => Boolean(totalPages.value) && totalPages.value !== 1
);
const displayLeftEllipsis = computed(() => {
if (totalPages.value < 7)
return false;
return props.current > 4;
});
const displayRightEllipsis = computed(() => {
if (totalPages.value < 7)
return false;
return props.current < totalPages.value - 3;
});
const indexes = computed(() => {
const { current: currentPage } = props;
let min = 1;
let max = totalPages.value;
const arr = [];
if (totalPages.value >= 7) {
if (currentPage <= 4 && currentPage < totalPages.value - 3) {
min = 1;
max = 5;
} else if (currentPage > 4 && currentPage >= totalPages.value - 3) {
max = totalPages.value;
min = totalPages.value - 4;
} else if (totalPages.value > 7) {
min = currentPage - 2;
max = currentPage + 2;
}
}
for (let i = min; i <= max; i++)
arr.push(i);
return arr;
});
const navigate = (page) => emit("updateCurrentPage", page);
const jumpPage = (index) => {
const pageNum = parseInt(index);
if (pageNum <= totalPages.value && pageNum > 0)
navigate(pageNum);
else
message.pop(
`<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M64 512a448 448 0 1 0 896 0 448 448 0 1 0-896 0Z" fill="#FA5151"/><path d="m557.3 512 113.1-113.1c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L512 466.7 398.9 353.6c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L466.7 512 353.6 625.1c-12.5 12.5-12.5 32.8 0 45.3 6.2 6.2 14.4 9.4 22.6 9.4s16.4-3.1 22.6-9.4L512 557.3l113.1 113.1c6.2 6.2 14.4 9.4 22.6 9.4s16.4-3.1 22.6-9.4c12.5-12.5 12.5-32.8 0-45.3L557.3 512z" fill="#FFF"/></svg>${locale.value.errorText.replace(
/\$page/g,
totalPages.value.toString()
)}`
);
};
onMounted(() => {
message = new Message();
});
return () => h(
"div",
{ class: "vp-pagination" },
enable.value ? h("div", { class: "vp-pagination-list" }, [
h("div", { class: "vp-pagination-number " }, [
// prev button
props.current > 1 ? h(
"div",
{
class: "prev",
role: "navigation",
unselectable: "on",
onClick: () => navigate(props.current - 1)
},
locale.value.prev
) : null,
// left ellipsis
displayLeftEllipsis.value ? [
h(
"div",
{
role: "navigation",
onClick: () => navigate(1)
},
1
),
h("div", { class: "ellipsis" }, "...")
] : null,
// numbers
indexes.value.map(
(num) => h(
"div",
{
key: num,
class: { active: props.current === num },
role: "navigation",
onClick: () => navigate(num)
},
num
)
),
// right ellipsis
displayRightEllipsis.value ? [
h("div", { class: "ellipsis" }, "..."),
h(
"div",
{
role: "navigation",
onClick: () => navigate(totalPages.value)
},
totalPages.value
)
] : null,
// next button
props.current < totalPages.value ? h(
"div",
{
class: "next",
role: "navigation",
unselectable: "on",
onClick: () => navigate(props.current + 1)
},
locale.value.next
) : null
]),
h("div", { class: "vp-pagination-nav" }, [
h(
"label",
{ for: "navigation-text" },
`${locale.value.navigate}: `
),
h("input", {
id: "navigation-text",
value: input.value,
onInput: ({ target }) => {
input.value = target.value;
},
onKeydown: (event) => {
if (event.key === "Enter") {
event.preventDefault();
jumpPage(input.value);
}
}
}),
h(
"button",
{
class: "vp-pagination-button",
role: "navigation",
title: locale.value.action,
onClick: () => jumpPage(input.value)
},
locale.value.action
)
])
]) : []
);
}
});
var ArticleList = defineComponent({
name: "ArticleList",
props: {
/**
* Articles
*
* 文章项目
*/
items: {
type: Array,
default: () => []
}
},
setup(props) {
const route = useRoute();
const router = useRouter();
const blogOptions = useBlogOptions();
const currentPage = ref(1);
const articlePerPage = computed(
() => blogOptions.value.articlePerPage || 10
);
const currentArticles = computed(
() => props.items.slice(
(currentPage.value - 1) * articlePerPage.value,
currentPage.value * articlePerPage.value
)
);
const updatePage = (page) => {
currentPage.value = page;
const query = { ...route.query };
if (query["page"] === page.toString() || page === 1 && !query["page"])
return;
if (page === 1)
delete query["page"];
else
query["page"] = page.toString();
void router.push({ path: route.path, query });
};
onMounted(() => {
const { page } = route.query;
updatePage(page ? Number(page) : 1);
if (SUPPORT_PAGEVIEW)
void import(
/* webpackChunkName: "pageview" */
'vuepress-plugin-comment2/pageview'
).then(({ updatePageview }) => {
updatePageview();
});
watch(currentPage, () => {
const distance = document.querySelector("#article-list").getBoundingClientRect().top + window.scrollY;
setTimeout(() => {
window.scrollTo(0, distance);
}, 100);
});
watch(
() => route.query,
({ page: page2 }) => {
updatePage(page2 ? Number(page2) : 1);
}
);
});
return () => h(
"div",
{ id: "article-list", class: "vp-article-list" },
currentArticles.value.length ? [
...currentArticles.value.map(
({ info, path }, index) => h(
DropTransition,
{ appear: true, delay: index * 0.04 },
() => h(ArticleItem, { key: path, info, path })
)
),
h(Pagination, {
current: currentPage.value,
perPage: articlePerPage.value,
total: props.items.length,
onUpdateCurrentPage: updatePage
})
] : h(EmptyIcon)
);
}
});
var CategoryList = defineComponent({
name: "CategoryList",
setup() {
const page = usePageData();
const categoryMap = useCategoryMap();
return () => h(
"ul",
{ class: "vp-category-list" },
entries(categoryMap.value.map).map(
([category, { path, items }]) => h(
"li",
{
class: [
"vp-category",
// TODO: magic number 9 is tricky here
`vp-category${generateIndexFromHash(category, 9)}`,
{ active: path === page.value.path }
]
},
h(VPLink, { to: path }, () => [
category,
h("span", { class: "count" }, items.length)
])
)
)
);
}
});
var TagList = defineComponent({
name: "TagList",
setup() {
const frontmatter = usePageFrontmatter();
const tagMap = useTagMap();
const isActive = (name) => {
var _a;
return name === ((_a = frontmatter.value.blog) == null ? void 0 : _a.name);
};
return () => h(
"ul",
{ class: "tag-list-wrapper" },
entries(tagMap.value.map).map(
([tag, { path, items }]) => h(
"li",
{
class: [
"tag",
// TODO: magic number 9 is tricky here
`tag${generateIndexFromHash(tag, 9)}`,
{ active: isActive(tag) }
]
},
h(VPLink, { to: path }, () => [
tag,
h("span", { class: "tag-num" }, items.length)
])
)
)
);
}
});
var TimelineList = defineComponent({
name: "TimelineList",
setup() {
const themeLocale = useThemeLocaleData();
const timelines = useTimelines();
const navigate = useNavigate();
const hint = computed(() => themeLocale.value.blogLocales.timeline);
return () => h("div", { class: "timeline-list-wrapper" }, [
h(
"div",
{
class: "timeline-list-title",
onClick: () => navigate(timelines.value.path)
},
[
h(TimelineIcon),
h("span", { class: "num" }, timelines.value.items.length),
hint.value
]
),
h("hr"),
h(
"div",
{ class: "timeline-content" },
h(
"ul",
{ class: "timeline-list" },
timelines.value.config.map(
({ year, items }, index) => h(
DropTransition,
{ appear: true, delay: 0.08 * (index + 1) },
() => h("li", [
h("h3", { class: "timeline-year" }, year),
h(
"ul",
{ class: "timeline-year-wrapper" },
items.map(
({ date, info, path }) => h("li", { class: "timeline-item" }, [
h("span", { class: "timeline-date" }, date),
h(
VPLink,
{ class: "timeline-title", to: path },
() => info[ArticleInfoType.title]
)
])
)
)
])
)
)
)
)
]);
}
});
var InfoList = defineComponent({
name: "InfoList",
setup() {
const themeLocale = useThemeLocaleData();
const articles = useArticles();
const categoryMap = useCategoryMap();
const categoryNumber = computed(() => keys(categoryMap.value.map).length);
const stars = useStars();
const tagMap = useTagMap();
const tagNumber = computed(() => keys(tagMap.value.map).length);
const navigate = useNavigate();
const active = ref("article");
const locale = computed(() => themeLocale.value.blogLocales);
const buttons = [
["article", ArticleIcon],
["category", CategoryIcon],
["tag", TagIcon],
["timeline", TimelineIcon]
];
return () => h("div", { class: "vp-blog-infos" }, [
h(
"div",
{ class: "vp-blog-type-switcher" },
buttons.map(
([key, icon]) => h(
"button",
{
type: "button",
class: "vp-blog-type-button",
onClick: () => {
active.value = key;
}
},
h(
"div",
{
class: ["icon-wrapper", { active: active.value === key }],
"aria-label": locale.value[key],
"data-balloon-pos": "up"
},
h(icon)
)
)
)
),
h(
DropTransition,
() => (
// article
active.value === "article" ? h("div", { class: "vp-sticky-article-wrapper" }, [
h(
"div",
{
class: "title",
onClick: () => navigate(articles.value.path)
},
[
h(ArticleIcon),
h("span", { class: "num" }, articles.value.items.length),
locale.value.article
]
),
h("hr"),
h(
"ul",
{ class: "vp-sticky-articles" },
stars.value.items.map(
({ info, path }, index) => h(
DropTransition,
{ appear: true, delay: 0.08 * (index + 1) },
() => h(
"li",
{ class: "vp-sticky-article" },
h(
VPLink,
{ to: path },
() => info[ArticleInfoType.title]
)
)
)
)
)
]) : active.value === "category" ? h("div", { class: "vp-category-wrapper" }, [
categoryNumber.value ? h(
"div",
{
class: "title",
onClick: () => navigate(categoryMap.value.path)
},
[
h(CategoryIcon),
h("span", { class: "num" }, categoryNumber.value),
locale.value.category
]
) : null,
h("hr"),
h(DropTransition, { delay: 0.04 }, () => h(CategoryList))
]) : active.value === "tag" ? h("div", { class: "vp-tag-wrapper" }, [
tagNumber.value ? h(
"div",
{
class: "title",
onClick: () => navigate(tagMap.value.path)
},
[
h(TagIcon),
h("span", { class: "num" }, tagNumber.value),
locale.value.tag
]
) : null,
h("hr"),
h(DropTransition, { delay: 0.04 }, () => h(TagList))
]) : h(DropTransition, () => h(TimelineList))
)
)
]);
}
});
var BlogWrapper = defineComponent({
name: "BlogWrapper",
slots: Object,
setup(_props, { slots }) {
const { isMobile } = useWindowSize();
return () => [
h(SkipLink),
h(
CommonWrapper,
{ noSidebar: true, noToc: true },
{
default: () => slots.default(),
navScreenBottom: () => h(BloggerInfo),
...isMobile.value ? { sidebar: () => h(InfoList) } : {}
}
)
];
}
});
const InfoPanel = () => h("aside", { class: "vp-blog-info-wrapper" }, [
h(DropTransition, () => h(BloggerInfo)),
h(DropTransition, { delay: 0.04 }, () => h(InfoList))
]);
InfoPanel.displayName = "InfoPanel";
var InfoPanel$1 = InfoPanel;
var BlogCategory = defineComponent({
name: "BlogPage",
components: {
CategoryList,
TagList
},
setup() {
const page = usePageData();
const frontmatter = usePageFrontmatter();
const categoryMap = useCategoryMap();
const tagMap = useTagMap();
const blogOptions = computed(
() => frontmatter.value.blog || {}
);
const componentName = computed(() => {
const { key = "" } = blogOptions.value;
return key === "category" ? "CategoryList" : key === "tag" ? "TagList" : null;
});
const items = computed(() => {
const { name = "", key = "" } = blogOptions.value;
return key === "category" ? name ? categoryMap.value.map[name].items : [] : key === "tag" ? name ? tagMap.value.map[name].items : [] : [];
});
return () => h(
BlogWrapper,
() => h(
"div",
{ class: "vp-page vp-blog" },
h("div", { cla