vuepress-theme-plume
Version:
A Blog&Document Theme for VuePress 2.0
2,543 lines (2,542 loc) • 60.5 kB
TypeScript
import { LocaleConfig, LocaleData, Page, PageFrontmatter } from "vuepress";
import { MarkdownChartPluginOptions } from "@vuepress/plugin-markdown-chart";
import { MarkdownHintPluginOptions } from "@vuepress/plugin-markdown-hint";
import { MarkdownImagePluginOptions } from "@vuepress/plugin-markdown-image";
import { MarkdownIncludePluginOptions } from "@vuepress/plugin-markdown-include";
import { MarkdownMathPluginOptions } from "@vuepress/plugin-markdown-math";
import { MarkdownPowerPluginOptions } from "vuepress-plugin-md-power";
import { SearchPluginOptions } from "@vuepress-plume/plugin-search";
import { DocSearchOptions as DocSearchOptions$1, DocSearchPluginOptions } from "@vuepress/plugin-docsearch";
import * as THREE from "three";
import { CSSProperties } from "vue";
import { WatermarkPluginFrontmatter, WatermarkPluginOptions } from "@vuepress/plugin-watermark";
import { CommentPluginOptions } from "@vuepress/plugin-comment";
import { CopyCodePluginOptions } from "@vuepress/plugin-copy-code";
import { ChangelogOptions, ContributorsOptions, GitChangelogInfo as GitChangelog, GitContributorInfo as GitContributor, GitPluginPageData } from "@vuepress/plugin-git";
import { ReadingTime, ReadingTimePluginOptions } from "@vuepress/plugin-reading-time";
import { ReplaceAssetsPluginOptions } from "@vuepress/plugin-replace-assets";
import { ShikiPluginOptions } from "@vuepress/plugin-shiki";
import { CachePluginOptions } from "@vuepress/plugin-cache";
import { PhotoSwipePluginOptions } from "@vuepress/plugin-photo-swipe";
import { SeoPluginOptions } from "@vuepress/plugin-seo";
import { SitemapPluginOptions } from "@vuepress/plugin-sitemap";
//#region src/shared/common/base.d.ts
/**
* 图片
*/
type ThemeImage = string | {
src: string;
alt?: string;
width?: string | number;
height?: string | number;
} | {
dark: string;
light: string;
alt?: string;
width?: string | number;
height?: string | number;
};
/**
* 图标
*/
type ThemeIcon = string | {
svg: string;
};
/**
* 颜色
*/
type ThemeColor = string | {
light: string;
dark: string;
};
/**
* 页内 heading 导航栏
*/
type ThemeOutline = false | number | [number, number] | 'deep';
/**
* 徽章
*/
interface ThemeBadge {
text?: string;
type?: string;
color?: string;
bgColor?: string;
borderColor?: string;
}
type ThemeLightDark<T> = T | {
light?: T;
dark?: T;
};
//#endregion
//#region src/shared/common/social.d.ts
/**
* 社交链接
*/
interface SocialLink {
icon: SocialLinkIcon;
link: string;
ariaLabel?: string;
}
/**
* 社交链接图标
*/
type SocialLinkIcon = SocialLinkIconUnion | {
svg: string;
name?: string;
};
type SocialLinkIconUnion = 'discord' | 'telegram' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'mastodon' | 'npm' | 'slack' | 'twitter' | 'x' | 'youtube' | 'qq' | 'weibo' | 'bilibili' | 'gitlab' | 'docker' | 'juejin' | 'zhihu' | 'douban' | 'steam' | 'stackoverflow' | 'xbox';
//#endregion
//#region src/shared/features/autoFrontmatter.d.ts
type AutoFrontmatterData = Record<string, any>;
/**
* The context of the markdown file
*
* markdown 文件的上下文
*/
interface AutoFrontmatterContext {
/**
* The absolute path to the file
*
* 文件绝对路径
*/
filepath: string;
/**
* The relative path to the file
*
* 文件相对路径
*/
relativePath: string;
/**
* The markdown content of the file
*
* 文件 markdown 内容
*/
content: string;
}
/**
* The function to handle the frontmatter data
*
* 处理 frontmatter 数据的函数
*
* @example
* ```ts
* function transform(data, context) {
* data.foo ??= 'foo'
* return data
* }
* ```
*/
type AutoFrontmatterHandle<D extends AutoFrontmatterData = AutoFrontmatterData> = (data: D, context: AutoFrontmatterContext) => D | Promise<D>;
interface AutoFrontmatterRule {
/**
* File filter, matches the relative path of the file
*
* Uses [picomatch](https://github.com/micromatch/picomatch) for pattern matching
*
* 文件过滤器,匹配文件的相对路径
*
* 使用 [picomatch](https://github.com/micromatch/picomatch) 进行模式匹配
*/
filter: string[] | string | ((relativePath: string) => boolean);
/**
* The function to handle the frontmatter data
*
* 处理 frontmatter 数据的函数
*
* @example
* ```ts
* {
* handle: (data, context) => {
* data.foo ??= 'foo'
* return data
* }
* }
* ```
*/
handle: AutoFrontmatterHandle;
}
interface AutoFrontmatterOptions {
/**
* 是否自动生成 permalink
*
* @default true
*/
permalink?: boolean;
/**
* 是否自动生成 createTime
*
* 默认读取 文件创建时间,`createTime` 比 vuepress 默认的 `date` 时间更精准到秒
*/
createTime?: boolean;
/**
* 是否自动生成 title
*
* 默认读取文件名作为标题
*/
title?: boolean;
/**
* 自定义 frontmatter 生成函数
*
* - 你应该直接将新字段添加到 `data` 中
* - 如果返回全新的 `data` 对象,会覆盖之前的 frontmatter
* @param data 页面已存在的 frontmatter
* @param context 当前页面的上下文信息
* @param locale 当前语言路径
* @returns 返回处理后的 frontmatter
*
* @example
* ```ts
* {
* transform: (data, context, locale) => {
* data.foo ??= 'foo'
* return data
* }
* }
* ```
*/
transform?: <D extends AutoFrontmatterData = AutoFrontmatterData>(data: D, context: AutoFrontmatterContext, locale: string) => D | Promise<D>;
}
//#endregion
//#region src/shared/features/bulletin.d.ts
/**
* 公告栏配置
*/
type BulletinOptions<T extends Record<string, unknown> = Record<string, unknown>> = T & {
/**
* 公告位置
* @default 'top-right'
*/
layout?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
/**
* 是否显示渐变边框
*
* @default true
*/
border?: boolean;
/**
* 在哪些页面显示公告
*
* - `true` 表示所有页面
* - `false` 表示不显示
* - 传入一个函数,返回 `true` 时显示
*/
enablePage?: boolean | ((page: Page) => boolean);
/**
* 公告持续时间
*
* @default 'always'
*
* - `'session'` 表示在会话周期内关闭公告后不再显示,在新的会话周期重新显示,刷新页面不会重新显示
* - `'always'` 表示总是显示,关闭公告后刷新页面会重新显示
* - `'once'` 表示在仅在当前周期内显示,关闭公告后不再显示,新的会话和刷新页面都不会重新显示
*/
lifetime?: 'session' | 'always' | 'once';
/**
* 公告 ID
*
* 公告持续时间 需要根据 `id` 作为唯一标识
*/
id?: string;
/**
* 公告标题
*/
title?: string;
/**
* 公告内容
*
* 可以使用 markdown 语法 或者 使用 html 文本,
* 使用 markdown 时需要声明 `contentType` 为 `markdown`
*/
content?: string;
/**
* 公告内容 类型
*
* - `markdown` 表示使用 markdown 语法
* - `text` 表示使用 普通文本 (可以是 html 内容)
*
* @default 'text'
*/
contentType?: 'markdown' | 'text';
/**
* 传入一个 `markdown` 或 `html` 文件路径,并使用文件内容作为公告内容
*
* - 使用 `.md` 文件时,将会解析 markdown 语法
* - 使用 `.html` 文件时,只能包含公告内容,请不要使用 `<html>` `<body>` `<script>` 等标签。
*/
contentFile?: string;
};
//#endregion
//#region src/shared/features/posts.d.ts
interface PostsCategoryItem {
/**
* 分类 ID
*/
id: string;
/**
* 分类排序
*/
sort: number;
/**
* 分类名称
*/
name: string;
}
/**
* 文章封面图布局
*/
type PostsCoverLayout = 'left' | 'right' | 'odd-left' | 'odd-right' | 'top';
/**
* 文章封面图样式
*/
interface PostsCoverStyle {
/**
* 文章封面图的位置
*/
layout?: PostsCoverLayout;
/**
* 文章封面图的比例
*
* @default '4:3'
*/
ratio?: number | `${number}:${number}` | `${number}/${number}`;
/**
* 封面图的宽度, 仅在 layout 为 'left' 或 'right' 时生效
*
* @default 240
*/
width?: number;
/**
* 是否使用紧凑模式,紧凑模式下,封面图紧贴容器边缘
* @default false
*/
compact?: boolean;
}
/**
* 博客文章
*/
interface ThemePostsItem {
/**
* 文章标题
*/
title: string;
/**
* 文章摘要
*/
excerpt: string;
/**
* 文章路径
*/
path: string;
/**
* 文章标签
*/
tags?: string[];
/**
* 文章是否置顶,数字表示置顶的优先级
* @default false
*/
sticky?: boolean | number;
/**
* 文章所属分类
*/
categoryList?: PostsCategoryItem[];
/**
* 文章创建时间
*/
createTime: string;
/**
* 文章语言
*/
lang: string;
/**
* 文章是否加密
*/
encrypt?: boolean;
/**
* 文章封面图
*/
cover?: string;
/**
* 文章封面图样式
*/
coverStyle?: PostsCoverStyle;
/**
* 文章是否为草稿
*/
draft?: boolean;
}
/**
* 博客文章列表
*/
type ThemePosts = ThemePostsItem[];
//#endregion
//#region src/shared/features/profile.d.ts
/**
* 个人资料
*/
interface ProfileOptions {
/**
* @deprecated 弃用,使用 `avatar` 代替
* 头像链接
*/
url?: string;
/**
* 头像链接地址
*/
avatar?: string;
/**
* 名称
*/
name?: string;
/**
* 描述 / 简介 / 座右铭 / 签名
*/
description?: string;
/**
* 是否显示为圆形头像
*/
circle?: boolean;
/**
* 地理位置
*/
location?: string;
/**
* 组织,公司
*/
organization?: string;
/**
* 布局位置,左侧或者右侧
* @default 'right'
*/
layout?: 'left' | 'right';
}
//#endregion
//#region src/shared/features/sidebar.d.ts
type ThemeSidebar = 'auto' | (string | ThemeSidebarItem)[] | ThemeSidebarMulti;
type ThemeSidebarMulti = Record<string, 'auto' | (string | ThemeSidebarItem)[] | {
items: 'auto' | (string | ThemeSidebarItem)[];
prefix?: string;
}>;
interface ThemeSidebarItem {
/**
* 侧边栏文本
*/
text?: string;
/**
* 侧边栏链接
*/
link?: string;
/**
* 侧边栏图标
*/
icon?: ThemeIcon;
/**
* 侧边栏徽章
*/
badge?: string | ThemeBadge;
/**
* 次级侧边栏分组
*/
items?: 'auto' | (string | ThemeSidebarItem)[];
/**
* 如果未指定,组不可折叠。
*
* 如果为`true`,组可折叠,并默认折叠。
*
* 如果为`false`,组可折叠,但默认展开。
*/
collapsed?: boolean;
/**
* 当前分组的链接前缀
*/
prefix?: string;
/**
* @deprecated 使用 `prefix` 替代
*/
dir?: string;
rel?: string;
target?: string;
}
//#endregion
//#region src/shared/features/collection.d.ts
/**
* 文档集合
*
* 主题通过 集合的方式,聚合某个目录下的文章,作为一个独立的文档。
*
* @since 1.0.0-rc.165
*/
type ThemeCollections = ThemeCollectionItem[];
type ThemeCollectionItem = ThemePostCollection | ThemeDocCollection;
interface ThemeBaseCollection {
/**
* 文档集合类型
* - `post`: 文章列表(可用于 博客、专栏等)
* - `doc`: 文档(可用于 笔记、知识库等)
*/
type: 'post' | 'doc';
/**
* 文档集合目录,相对于源目录
*/
dir: string;
/**
* 当启用 autoFrontmatter 时,文档集合的链接前缀
* - `post` 类型,用于文章的自动生成链接前缀
* - `doc` 类型,用于文档中文章的自动生成链接前缀
* @default '/${dir}/'
*/
linkPrefix?: string;
/**
* 文档集合标题
*/
title: string;
/**
* 标签颜色主题
*
* @default 'colored'
*/
tagsTheme?: 'colored' | 'gray' | 'brand';
/**
* 自动生成文章的 frontmatter
*/
autoFrontmatter?: AutoFrontmatterOptions | false;
}
/**
* post 类型的文章集合
*/
interface ThemePostCollection extends ThemeBaseCollection {
type: 'post';
/**
* 通过 glob string 配置包含文件,
*
* 默认读取 `dir` 中的所有 `.md` 文件。
*
* @default - ['**\/*.md']
*/
include?: string[];
/**
* 通过 glob string 配置排除的文件
*
* @default - []
*/
exclude?: string[];
/**
* 分页
*/
pagination?: false | number | {
/**
* 每页显示的文章数量
* @default 15
*/
perPage?: number;
};
/**
* 文章列表页链接
*
* @default '/${dir}/'
*/
link?: string;
/**
* 是否启用文章列表页
* @default true
*/
postList?: boolean;
/**
* 是否启用标签页
* @default true
*/
tags?: boolean;
/**
* 自定义标签页链接
*
* @default '/${link}/tags/'
*/
tagsLink?: string;
/**
* 标签页文本
*/
tagsText?: string;
/**
* 是否启用归档页
* @default true
*/
archives?: boolean;
/**
* 自定义归档页链接
*
* @default '/${link}/archives/'
*/
archivesLink?: string;
/**
* 归档页文本
*/
archivesText?: string;
/**
* 是否启用分类功能
* - 启用后会生成分类页
* @default true
*/
categories?: boolean;
/**
* 自定义分类页链接
*
* @default '/${link}/categories/'
*/
categoriesLink?: string;
/**
* 分类页文本
*/
categoriesText?: string;
/**
* 分类页展开深度
*
* @default 'deep'
*/
categoriesExpand?: number | 'deep';
/**
* 文章分类列表转换函数,比如排除不需要的一级分类
* @param categories 分类列表
* @returns 返回一个新的分类列表
*/
categoriesTransform?: (categories: PostsCategoryItem[]) => PostsCategoryItem[];
/**
* 文章封面图
*
* 配置封面图的位置,支持 `'left'`、`'right'`、`'top'`、`'top-inside'`
*
* @default 'right'
*/
postCover?: PostsCoverLayout | PostsCoverStyle;
/**
* 个人信息配置
*/
profile?: ProfileOptions | false;
/**
* 社交账号配置
*/
social?: SocialLink[] | false;
}
/**
* 文档类型的文章集合
*/
interface ThemeDocCollection extends ThemeBaseCollection {
type: 'doc';
/**
* 侧边栏配置
*/
sidebar?: 'auto' | (string | ThemeSidebarItem)[];
/**
* 是否显示侧边栏滚动条
* @default true
*/
sidebarScrollbar?: boolean;
/**
* 侧边栏为 `auto` 时,是否默认折叠
* - `true`: 默认折叠
* - `false`: 默认不折叠
*
* @default false
*/
sidebarCollapsed?: boolean;
}
//#endregion
//#region src/shared/utils.d.ts
/**
* A literal type that supports custom further strings but preserves autocompletion in IDEs.
*
* @see [copied from issue](https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609)
*/
type LiteralUnion<Union extends Base, Base = string> = Union | (Base & {
zz_IGNORE_ME?: never;
});
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
type UnionToTuple<T> = UnionToIntersection<T extends any ? () => T : never> extends (() => infer R) ? [...UnionToTuple<Exclude<T, R>>, R] : [];
//#endregion
//#region src/shared/features/copyright.d.ts
/**
* 内置支持的版权协议
*/
type KnownCopyrightLicense = 'CC-BY-4.0' | 'CC-BY-SA-4.0' | 'CC-BY-NC-4.0' | 'CC-BY-NC-SA-4.0' | 'CC-BY-ND-4.0' | 'CC-BY-NC-ND-4.0' | 'CC0';
/**
* 文章版权协议
*
* @see https://creativecommons.org/licenses/
*/
type CopyrightLicense = LiteralUnion<KnownCopyrightLicense>;
/**
* 版权配置
*/
interface CopyrightOptions {
/**
* 版权信息
* @see https://creativecommons.org/share-your-work/cclicenses/
* @default 'CC-BY-4.0'
*/
license?: CopyrightLicense | {
name: string;
url: string;
};
/**
* 版权所有者
*/
author?: string | {
name: string;
url?: string;
};
/**
* 作品的创作方式
*/
creation?: 'original' | 'translate' | 'reprint';
}
//#endregion
//#region src/shared/features/encrypt.d.ts
interface EncryptOptions {
/**
* 是否启用全站加密
* @default false
*/
global?: boolean;
/**
* 超级权限密码, 该密码可以解密全站,以及任意加密的文章
*
*/
admin?: string | string[];
/**
* 文章密码, 可以通过 文章的 markdown 文件相对路径、页面访问路径、
* 目录路径 等,对 单个文章 或者 整个目录 进行 加密。
* 如果是以 `^` 开头,则被认为是类似于正则表达式进行匹配。
*
* @example
* ```json
* {
* "前端/基础/html.md": "123",
* "/article/23c44c/": ["456", "789"],
* "^/note/(note1|note2)/": "123"
* }
* ```
*/
rules?: {
[key: string]: string | string[];
};
}
//#endregion
//#region src/shared/features/latestUpdated.d.ts
interface LastUpdatedOptions {
/**
* Set options for last updated time formatting.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options
*
* @default
* { dateStyle: 'short', timeStyle: 'short' }
*/
formatOptions?: Intl.DateTimeFormatOptions & {
forceLocale?: boolean;
};
}
//#endregion
//#region src/shared/features/markdown.d.ts
interface MarkdownOptions extends MarkdownPowerPluginOptions, MarkdownChartPluginOptions, Pick<MarkdownHintPluginOptions, 'alert' | 'hint'> {
/**
* 已弃用
* @deprecated use `demo` instead
*/
oldDemo?: never;
/**
* markdown image enhance
*/
image?: false | MarkdownImagePluginOptions;
/**
* 在 markdown 中包含其他文件
*/
include?: false | MarkdownIncludePluginOptions;
/**
* markdown 数学公式
*/
math?: false | MarkdownMathPluginOptions;
}
//#endregion
//#region src/shared/features/navbar.d.ts
/**
* 导航项
*/
type ThemeNavItem = string | NavItemWithLink | NavItemWithChildren;
interface NavItemWithLink {
/**
* 导航文本
*/
text: string;
/**
* 导航链接
*/
link: string;
/**
* 导航图标
*/
icon?: ThemeIcon;
/**
* 徽章
*/
badge?: string | ThemeBadge;
/**
* 当前分组的页面前缀
*/
prefix?: never;
items?: never;
/**
* `activeMatch` is expected to be a regex string. We can't use actual
* RegExp object here because it isn't serializable
*
* `activeMatch` 应该是一个正则表达式字符串。我们不能在这里使用实际的
* RegExp 对象,因为它不可序列化
*/
activeMatch?: string;
rel?: string;
target?: string;
noIcon?: boolean;
}
interface NavItemChildren {
/**
* 下拉菜单的文本
*/
text?: string;
/**
*
* 当前分组的页面前缀
*/
prefix?: string;
/**
* 导航图标
*/
icon?: ThemeIcon;
/**
* 徽章
*/
badge?: string | ThemeBadge;
/**
* 导航栏下拉菜单
*/
items: (string | NavItemWithLink)[];
}
interface NavItemWithChildren {
text?: string;
/**
* 当前分组的页面前缀
*/
prefix?: string;
/**
* 导航图标
*/
icon?: ThemeIcon;
/**
* 徽章
*/
badge?: string | ThemeBadge;
/**
* 导航栏下拉菜单
*/
items: (string | NavItemChildren | NavItemWithLink)[];
/**
* `activeMatch` is expected to be a regex string. We can't use actual
* RegExp object here because it isn't serializable
*
* `activeMatch` 应为正则表达式字符串,但必须将其定义为字符串。
* 我们不能在这里使用实际的 RegExp 对象,因为它在构建期间不可序列化。
*/
activeMatch?: string;
}
//#endregion
//#region src/shared/features/notes.d.ts
/**
* @deprecated
*/
interface ThemeNoteListOptions {
/**
* 保存所有笔记的目录
* @default '/notes/'
*/
dir: string;
/**
* 所有笔记的默认链接前缀
* @default '/'
*/
link: string;
/**
* 笔记配置
*/
notes: ThemeNote[];
}
/**
* @deprecated
*/
interface ThemeNote {
/**
* 保存笔记的目录
*/
dir: string;
/**
* 当前笔记的链接前缀,将会与 `notes.link` 合并
*/
link: string;
/**
* 当前笔记名称
*/
text?: string;
/**
* 当前笔记的侧边栏配置
*/
sidebar?: 'auto' | (string | ThemeSidebarItem)[];
}
//#endregion
//#region src/shared/features/search.d.ts
interface SearchBaseOptions {
provider: 'local' | 'algolia';
}
interface LocalSearchOptions extends SearchBaseOptions, SearchPluginOptions {
provider: 'local';
}
interface DocSearchOptions extends SearchBaseOptions, DocSearchPluginOptions {
provider: 'algolia';
}
type SearchOptions = LocalSearchOptions | DocSearchOptions;
//#endregion
//#region src/shared/features/transition.d.ts
interface TransitionOptions {
/**
* 是否启用 页面间跳转过渡动画
* @default true
*/
page?: boolean;
/**
* 是否启用 博客文章列表过渡动画
* @default true
*/
postList?: boolean;
/**
* 是否启用 深色/浅色 模式切换过渡动画
* @default 'fade'
*/
appearance?: boolean | 'fade' | 'circle-clip' | 'horizontal-clip' | 'vertical-clip' | 'skew-clip' | 'blinds-vertical' | 'blinds-horizontal' | 'soft-blur-fade' | 'diamond-reveal';
}
//#endregion
//#region src/shared/locale.d.ts
/**
* 内置的多语言配置
*/
interface PresetLocale extends Record<CopyrightLicense, string> {}
interface ThemeLocale extends LocaleData {
/**
* 网站站点首页
*/
home?: string;
/**
* 网站站点logo
*/
logo?: string;
/**
* 深色模式下的网站站点logo
*/
logoDark?: string;
/**
* 是否启用深色模式切换按钮
*/
appearance?: boolean | 'dark' | 'force-dark';
/**
* 配置博主拥有者 个人资料
*
* 显示在博客右侧侧边栏
*/
profile?: ProfileOptions;
/**
* 社交账号配置
*/
social?: SocialLink[];
/**
* 导航栏配置
*
* 设置为 `false` 将会禁用导航栏
*/
navbar?: false | ThemeNavItem[];
/**
* 允许显示在导航栏的社交类型
* @default ['github', 'twitter', 'discord', 'facebook']
*/
navbarSocialInclude?: (SocialLinkIconUnion | (string & {
zz_IGNORE_ME?: never;
}))[];
/**
* 笔记配置, 笔记中的文章默认不会出现在首页文章列表
*
* 注:也可以将notes配置到navbar中
*
* @deprecated 使用 {@link collections} 代替
*/
notes?: never;
/**
* 侧边栏配置
*/
sidebar?: ThemeSidebarMulti;
/**
* 文章集合,当前支持 博客类型 或 文档类型
*/
collections?: ThemeCollections;
/**
* 是否显示侧边栏滚动条
* @default true
*/
sidebarScrollbar?: boolean;
/**
* 要显示的标题级别。
*
* 单个数字表示只显示该级别的标题。
*
* 如果传递的是一个元组,第一个数字是最小级别,第二个数字是最大级别。
*
* 'deep' 与 [2, 6] 相同,将显示从 <h2> 到 <h6> 的所有标题。
*
* @default [2, 3]
*/
outline?: ThemeOutline;
/**
* 是否显示侧边栏
*
* - `false` 表示禁用 右侧边栏
* - `true` 表示启用 右侧边栏
* - `'left` 表示将有侧边栏移动到文章内容左侧,sidebar 右侧
*
* @default true
*/
aside?: boolean | 'left';
/**
* 配置公告
*/
bulletin?: true | BulletinOptions;
/**
* 配置版权信息
* @default false
*/
copyright?: boolean | CopyrightLicense | CopyrightOptions;
/**
* 是否启用过渡动画效果
*
* @default true
*/
transition?: boolean | TransitionOptions;
/**
* "编辑此页" 的链接匹配模式
*
* @example ':repo/edit/:branch/:path'
*/
editLinkPattern?: string;
/**
* 是否显示上一页
*
* @default true
*/
prevPage?: boolean;
/**
* 是否显示下一页
*
* @default true
*/
nextPage?: boolean;
/**
* 是否显示外部链接图标
*
* @default true
*/
externalLinkIcon?: boolean;
/**
* 是否在文章页显示创建时间
*
* @default true
*/
createTime?: boolean | 'only-posts';
/**
* 页脚配置
*/
footer?: false | {
message?: string;
copyright?: string;
};
}
/**
* 已弃用的配置
*/
interface ThemeLocaleDeprecated {
/**
* @deprecated 弃用,使用 `profile` 代替
*/
avatar?: ProfileOptions;
}
/**
* 主题多语言文本配置
*/
interface ThemeLocaleText {
/**
* 深色模式切换按钮的文本
* @default 'Appearance'
*/
appearanceText?: string;
/**
* 切换到浅色模式提示文本
* @default 'Switch to light theme'
*/
lightModeSwitchTitle?: string;
/**
* 切换到深色模式的提示文本
* @default 'Switch to dark theme'
*/
darkModeSwitchTitle?: string;
/**
* 版权所有的文本
* @default 'Copyright'
*/
copyrightText?: string;
/**
* 版权归属者的文本
* @default 'Copyright Ownership:'
*/
copyrightAuthorText?: string;
/**
* 本文链接的文本
* @default 'This article link:'
*/
copyrightCreationOriginalText?: string;
/**
* 本文翻译链接的文本
* @default 'This article is translated from:'
*/
copyrightCreationTranslateText?: string;
/**
* 转载链接的文本
* @default 'This article is reprint from:'
*/
copyrightCreationReprintText?: string;
/**
* 许可证的文本
* @default 'License under:'
*/
copyrightLicenseText?: string;
/**
* 选择语言菜单 的文本。
* @default 'Languages'
*/
selectLanguageText?: string;
/**
* 选择语言菜单 的 `aria-label` 属性。
*/
selectLanguageAriaLabel?: string;
/**
* 语言名称
*
* 仅能在主题配置的 locales 的内部生效 。
* 它将被用作 locale 的语言名称,展示在 选择语言菜单 内。
*/
selectLanguageName?: string;
/**
* "编辑此页" 的文本
*
* @default "Edit this page"
*/
editLinkText?: string;
/**
* "最后更新时间" 的文本
*
* @default 'Last updated'
*/
lastUpdatedText?: string;
/**
* 贡献者的文本
* @default 'Contributors'
*/
contributorsText?: string;
/**
* 变更历史的文本
* @default 'Changelog'
*/
changelogText?: string;
/**
* 单次变更记录的时间文本
* @default 'On'
*/
changelogOnText?: string;
/**
* 查看完整的变更历史的文本
*
* @default 'View All Changelog'
*/
changelogButtonText?: string;
/**
* 移动设备下的导航栏中 菜单选项的文字。
*
* @default 'Menu'
*/
sidebarMenuLabel?: string;
/**
* 移动设备下的导航栏中返回顶部的文字。
*
* @default 'return to top'
*/
returnToTopLabel?: string;
/**
* 侧边栏 outline 文本
*
* @default 'On this page'
*/
outlineLabel?: string;
/**
* 上一页的文本
*
* @default 'Previous Page'
*/
prevPageLabel?: string;
/**
* 下一页的文本
*
* @default 'Next Page'
*/
nextPageLabel?: string;
/**
* 404 页面配置
*/
notFound?: {
code?: string | number;
title?: string;
quote?: string;
linkLabel?: string;
linkText?: string;
};
/**
* 页脚
*/
footer?: {
message?: string;
copyright?: string;
};
/**
* 首页文本,用于默认生成的导航栏、面包屑导航中
*/
homeText?: string;
/**
* 博客文本,用于默认生成的导航栏、面包屑导航中
*/
postsText?: string;
/**
* 标签文本,用于默认生成的导航栏、博客标签页中
*/
tagText?: string;
/**
* 归档文本,用于默认生成的导航栏、博客归档页中
*/
archiveText?: string;
/**
* 分类文本,用于默认生成的导航栏、博客分类页中
*/
categoryText?: string;
/**
* 博客总数文本,用于默认生成的导航栏、博客归档页中
* @default '{count} articles''
*/
archiveTotalText?: string;
/**
* 全站加密时的提示
*/
encryptGlobalText?: string;
/**
* 文章加密时的提示
*/
encryptPageText?: string;
/**
* 加密确认按钮文本
*/
encryptButtonText?: string;
/**
* 加密时输入框的 placeholder
*/
encryptPlaceholder?: string;
}
//#endregion
//#region src/shared/data.d.ts
type ThemeLocaleData = ThemeLocale & ThemeLocaleDeprecated & ThemeLocaleText;
/**
* 主题注入到 客户端的数据
*/
interface ThemeData extends ThemeBaseData, ThemeLocaleData {
/**
* 部署站点域名。
* 用于生成 sitemap、 seo等。
*
*/
hostname?: string;
/**
* 博客配置
* @deprecated
*/
blog?: never;
/**
* 文章链接前缀
*
* @default '/article/'
* @deprecated
*/
article?: string;
/**
* 是否显示 "编辑此页"
*
* @default true
*/
editLink?: boolean;
/**
* 最后更新时间
*
* @default { formatOptions: { dateStyle: 'short', timeStyle: 'short' } }
*/
lastUpdated?: false | LastUpdatedOptions;
/**
* 是否显示贡献者
*/
contributors?: boolean | {
mode?: 'inline' | 'block';
};
/**
* 是否显示页面更新日志
*/
changelog?: boolean;
/**
* 文档仓库配置, 用于生成 Edit this page 链接
*/
docsRepo?: string;
/**
* 文档仓库分支配置,用于生成 `Edit this page` 链接。
*/
docsBranch?: string;
/**
* 文档仓库目录配置,用于生成 `Edit this page` 链接。
*/
docsDir?: string;
}
interface ThemeBaseData extends ThemeLocaleData {
/**
* 多语言配置
*/
locales?: LocaleConfig<ThemeLocaleData>;
}
//#endregion
//#region src/shared/frontmatter/normal.d.ts
type ThemeNormalFrontmatter = PageFrontmatter<{
/**
* @deprecated
*
* 使用 pageLayout = 'home' 代替
*/
home?: boolean;
/**
* @deprecated
*
* 使用 pageLayout = 'friends' 代替
*/
friends?: boolean;
/**
* page layout
*/
pageLayout?: false | 'home' | 'posts' | 'doc' | 'custom' | 'page' | 'friends';
/**
* 自定义页面 class
*/
pageClass?: string;
/**
* 是否显示导航栏
*
* @default true
*/
navbar?: boolean;
/**
* 是否显示返回顶部按钮
*
* @default true
*/
backToTop?: boolean;
/**
* 是否显示向下箭头标志
*
* @default false
*/
signDown?: boolean;
/**
* 当前页面是否显示 外部链接图标
*
* @default true
*/
externalLinkIcon?: boolean;
/**
* @deprecated 使用 `externalLinkIcon` 代替
*/
externalLink?: boolean;
}>;
//#endregion
//#region src/shared/frontmatter/friends.d.ts
/**
* 友链
*/
interface FriendsItem {
/**
* 友链名称
*/
name: string;
/**
* 友链链接
*/
link: string;
/**
* 头像
*/
avatar?: string;
/**
* 友链描述
*/
desc?: string;
/**
* 所在地
*/
location?: string;
/**
* 所属组织
*/
organization?: string;
/**
* 社交链接
*/
socials?: SocialLink[];
/**
* 背景色
*/
backgroundColor?: ThemeColor;
/**
* 文本颜色
*/
color?: ThemeColor;
/**
* 名称颜色
*/
nameColor?: ThemeColor;
}
/**
* 友链分组
*/
interface FriendGroup {
/**
* 友链分组标题
*/
title?: string;
/**
* 友链分组描述
*/
desc?: string;
/**
* 友链列表
*/
list?: FriendsItem[];
}
/**
* 友情链接
*/
interface ThemeFriendsFrontmatter extends ThemeNormalFrontmatter {
/**
* 是否启用友链布局
* @deprecated
*/
friends: boolean;
/**
* 标题
*/
title?: string;
/**
* 描述
*/
description?: string;
/**
* markdown 内容位置
*/
contentPosition?: 'before' | 'after';
/**
* 友链列表
*/
list?: FriendsItem[];
/**
* 友链分组
*/
groups?: FriendGroup[];
}
//#endregion
//#region src/shared/frontmatter/homeHeroEffects.d.ts
type ThemeHomeHeroEffect = LiteralUnion<'tint-plate' | 'prism' | 'pixel-blast' | 'hyper-speed' | 'liquid-ether' | 'dot-grid' | 'iridescence' | 'orb' | 'beams' | 'lightning' | 'dark-veil'>;
type ThemeHomeHeroEffectConfig = ThemeHomeHeroTintPlate | ThemeHomeHeroPrism | ThemeHomeHeroPixelPixelBlast | Omit<ThemeHomeHeroHyperSpeed, 'onSpeedUp' | 'onSlowDown'> | ThemeHomeHeroLiquidEther | ThemeHomeHeroDotGrid | ThemeHomeHeroIridescence | ThemeHomeHeroOrb | ThemeHomeHeroBeams | ThemeHomeHeroLightning | ThemeHomeHeroDarkVeil;
type ThemeHomeHeroTintPlate = ThemeLightDark<{
rgb: string | number;
} | {
r: {
value: number;
offset: number;
};
g: {
value: number;
offset: number;
};
b: {
value: number;
offset: number;
};
}>;
interface ThemeHomeHeroPrism {
/**
* Apex height of the prism (world units)
* 棱柱的顶点高度(世界单位)
*/
height?: number;
/**
* Total base width across X/Z (world units).
* X/Z轴总基准宽度(世界单位)
*/
baseWidth?: number;
/**
* Animation mode: shader wobble, pointer hover tilt, or full 3D rotation.
* 动画模式:着色器摆动、指针悬停倾斜或完全三维旋转。
*/
animationType?: 'rotate' | 'hover' | '3drotate';
/**
* Glow/bleed intensity multiplier.
* 发光/溢出强度乘数。
*/
glow?: number;
/**
* Pixel offset within the canvas (x→right, y→down).
* 画布内的像素偏移(x→向右,y→向下)。
*/
offset?: {
x?: number;
y?: number;
};
/**
* Film-grain noise amount added to final color (0 disables).
* 最终颜色中添加的颗粒噪声量(0表示禁用)。
*/
noise?: number;
/**
* Whether the canvas has an alpha channel (transparent background).
* 画布是否具有Alpha通道(透明背景)。
*/
transparent?: boolean;
/**
* Overall screen-space scale of the prism (bigger = larger).
* 棱镜的整体屏幕空间比例(数值越大,显示尺寸越大)。
*/
scale?: number;
/**
* Hue rotation (radians) applied to final color.
* 色调旋转(弧度)应用于最终颜色。
*/
hueShift?: number;
/**
* Frequency of internal sine bands controlling color variation.
* 控制颜色变化的内部正弦带频率。
*/
colorFrequency?: number;
/**
* Sensitivity of hover tilt (pitch/yaw amplitude).
* 悬停倾斜(俯仰/偏航幅度)灵敏度。
*/
hoverStrength?: number;
/**
* Easing factor for hover (0..1, higher = snappier).
* 悬停缓动因子(0到1,数值越大响应越灵敏)。
*/
inertia?: number;
/**
* Extra bloom factor layered on top of glow.
* 在光泽之上叠加额外的绽放效果层次。
*/
bloom?: number;
/**
* Pause rendering when the element is not in the viewport.
* 当元素不在视口内时暂停渲染。
*/
suspendWhenOffscreen?: boolean;
/**
* Global time multiplier for animations (0=frozen, 1=normal).
* 动画全局时间倍率(0=冻结,1=正常)。
*/
timeScale?: number;
}
type ThemeHomeHeroPixelBlastVariant = 'square' | 'circle' | 'triangle' | 'diamond';
interface ThemeHomeHeroPixelPixelBlast {
/**
* Pixel shape variant
* 像素形状变体
*/
variant?: ThemeHomeHeroPixelBlastVariant;
/**
* Base pixel size (auto scaled for DPI).
* 基础像素尺寸(根据DPI自动缩放)。
*/
pixelSize?: number;
/**
* Pixel color.
* 像素颜色
*/
color?: string;
/**
* Additional CSS class.
* 附加CSS类
*/
className?: string;
/**
* Additional CSS style.
* 附加CSS样式
*/
style?: CSSProperties;
/**
* Enable antialiasing.
* 启用抗锯齿。
*/
antialias?: boolean;
/**
* Noise/pattern scale.
* 噪声/图案比例。
*/
patternScale?: number;
/**
* Pattern density adjustment.
* 图案密度调整。
*/
patternDensity?: number;
/**
* Enable liquid distortion effect.
* 启用液体扭曲效果。
*/
liquid?: boolean;
/**
* Liquid distortion strength.
* 液体扭曲强度。
*/
liquidStrength?: number;
/**
* Liquid touch brush radius scale.
* 液体触摸笔刷半径比例。
*/
liquidRadius?: number;
/**
* Random jitter applied to coverage.
* 应用于覆盖范围的随机抖动。
*/
pixelSizeJitter?: number;
/**
* Enable click ripple waves.
* 启用点击涟漪效果。
*/
enableRipples?: boolean;
/**
* Ripple intensity multiplier.
* 纹波强度乘数。
*/
rippleIntensityScale?: number;
/**
* Ripple ring thickness.
* 纹波环厚度。
*/
rippleThickness?: number;
/**
* Ripple propagation speed.
* 纹波传播速度。
*/
rippleSpeed?: number;
/**
* Liquid wobble frequency.
* 液体晃动频率。
*/
liquidWobbleSpeed?: number;
/**
* Enable auto-pausing when offscreen.
*
* 离屏时自动暂停
*/
autoPauseOffscreen?: boolean;
/**
* Animation time scale.
* 动画时间缩放比例。
*/
speed?: number;
/**
* Transparent background.
* 透明背景。
*/
transparent?: boolean;
/**
* Edge fade distance (0-1).
* 边缘淡入距离(0-1)。
*/
edgeFade?: number;
/**
* Post noise amount.
* 后处理噪声量。
*/
noiseAmount?: number;
backgroundImage?: ThemeLightDark<string>;
backgroundAttachment?: 'fixed' | 'local';
}
interface ThemeHomeHeroHyperSpeedDistortion {
uniforms: Record<string, {
value: unknown;
}>;
getDistortion: string;
getJS?: (progress: number, time: number) => THREE.Vector3;
}
interface ThemeHomeHeroHyperSpeedDistortions {
[key: string]: ThemeHomeHeroHyperSpeedDistortion;
}
interface ThemeHomeHeroHyperSpeedColors {
roadColor: number;
islandColor: number;
background: number;
shoulderLines: number;
brokenLines: number;
leftCars: number[];
rightCars: number[];
sticks: number;
}
interface ThemeHomeHeroHyperSpeed {
onSpeedUp?: (ev: MouseEvent) => void;
onSlowDown?: (ev: MouseEvent) => void;
distortion?: string | ThemeHomeHeroHyperSpeedDistortion;
length: number;
roadWidth: number;
islandWidth: number;
lanesPerRoad: number;
fov: number;
fovSpeedUp: number;
speedUp: number;
carLightsFade: number;
totalSideLightSticks: number;
lightPairsPerRoadWay: number;
shoulderLinesWidthPercentage: number;
brokenLinesWidthPercentage: number;
brokenLinesLengthPercentage: number;
lightStickWidth: [number, number];
lightStickHeight: [number, number];
movingAwaySpeed: [number, number];
movingCloserSpeed: [number, number];
carLightsLength: [number, number];
carLightsRadius: [number, number];
carWidthPercentage: [number, number];
carShiftX: [number, number];
carFloorSeparation: [number, number];
colors: ThemeHomeHeroHyperSpeedColors;
isHyper?: boolean;
}
interface ThemeHomeHeroLiquidEther {
/**
* Strength multiplier applied to mouse / touch movement when injecting velocity.
* 鼠标/触摸移动注入速度时的强度系数。
*/
mouseForce?: number;
/**
* Radius (in pixels at base resolution) of the force brush.
* 力刷半径(以基本分辨率的像素为单位)。
*/
cursorSize?: number;
/**
* Toggle iterative viscosity solve (smoother, thicker motion when enabled).
* 启用迭代性质量解决方案(更平滑,更粗糙的运动)。
*/
isViscous?: boolean;
/**
* Viscosity coefficient used when isViscous is true.
* 当 isViscous 为 true 时使用的粘性系数。
*/
viscous?: number;
/**
* Number of Gauss-Seidel iterations for viscosity (higher = smoother, slower).
* 粘性的高斯-塞德尔迭代次数(值越大 = 更平滑,更慢)。
*/
iterationsViscous?: number;
/**
* Number of pressure Poisson iterations to enforce incompressibility.
* 用于确保不可压缩性的压力泊松迭代次数。
*/
iterationsPoisson?: number;
/**
* Fixed simulation timestep used inside the advection / diffusion passes.
* 内部的对流/扩散迭代中使用固定的模拟时间步长。
*/
dt?: number;
/**
* Enable BFECC advection (error-compensated) for crisper flow; disable for slight performance gain.
* 启用 BFECC 传输(错误补偿)以获得更清晰的流动,禁用以获得稍微的性能提升。
*/
BFECC?: boolean;
/**
* Simulation texture scale relative to canvas size (lower = better performance, more blur).
* 相对于画布大小的仿真纹理缩放(值越小,更好的性能,更模糊)。
*/
resolution?: number;
/**
* If true, shows bounce boundaries (velocity clamped at edges).
* 如果为 true,显示弹跳边界(速度在边缘上限)。
*/
isBounce?: boolean;
/**
* Array of hex color stops used to build the velocity-to-color palette.
* 用于构建速度-颜色映射调色板的十六进制颜色停止点数组。
*/
colors?: string[];
/**
* Inline styles applied to the root container.
* 应用于根容器的内联样式。
*/
style?: Record<string, any>;
/**
* Optional class for the root container.
* 根容器的可选类。
*/
className?: string;
/**
* Enable idle auto-driving of the pointer when no user interaction.
* 启用无用户交互时的自动驾驶指针。
*/
autoDemo?: boolean;
/**
* Speed (normalized units/sec) for auto pointer motion.
* 自动指针运动的速度(标准化单位/秒)。
*/
autoSpeed?: number;
/**
* Multiplier applied to velocity delta while in auto mode.
* 在自动模式下应用于速度增量的乘数。
*/
autoIntensity?: number;
/**
* Seconds to interpolate from auto pointer to real cursor when user moves mouse.
* 在用户移动鼠标时从自动指针插值到实际光标的秒数。
*/
takeoverDuration?: number;
/**
* Milliseconds of inactivity before auto mode resumes.
* 在自动模式恢复之前的不活动时间(毫秒)。
*/
autoResumeDelay?: number;
/**
* Seconds to ramp auto movement speed from 0 to full after activation.
* 在激活后从 0 开始加速自动移动速度的秒数。
*/
autoRampDuration?: number;
}
interface ThemeHomeHeroDotGrid {
/**
* Size of each dot in pixels.
* 每个点的尺寸(像素)。
*/
dotSize?: number;
/**
* Gap between each dot in pixels.
* 每个点之间的间隙(像素)。
*/
gap?: number;
/**
* Base color of the dots.
* 点的基本颜色。
*/
baseColor?: string;
/**
* Color of dots when hovered or activated.
* 鼠标悬停或激活时点的颜色。
*/
activeColor?: string;
/**
* Radius around the mouse pointer within which dots react.
* 鼠标指针周围的半径,在此范围内点会响应。
*/
proximity?: number;
/**
* Mouse speed threshold to trigger inertia effect.
* 触发惯性效果的鼠标速度阈值。
*/
speedTrigger?: number;
/**
* Radius of the shockwave effect on click.
* 点击时的震动波半径。
*/
shockRadius?: number;
/**
* Strength of the shockwave effect on click.
* 点击时震动波的强度。
*/
shockStrength?: number;
/**
* Maximum speed for inertia calculation.
* 惯性计算的最大速度。
*/
maxSpeed?: number;
/**
* Resistance for the inertia effect.
* 惯性效果的阻力。
*/
resistance?: number;
/**
* Duration for dots to return to their original position after inertia.
* 惯性后点返回原始位置的持续时间。
*/
returnDuration?: number;
/**
* Additional CSS classes for the component.
* 为组件添加附加 CSS 类。
*/
className?: string;
/**
* Inline styles for the component.
* 为组件应用内联样式。
*/
style?: CSSProperties;
}
interface ThemeHomeHeroIridescence {
/**
* Base color as an array of RGB values (each between 0 and 1).
* 基色以RGB值数组形式表示(每个数值范围在0到1之间)。
*/
color?: ThemeLightDark<readonly [number, number, number]>;
/**
* Speed multiplier for the animation.
* 动画的速度乘数。
*/
speed?: number;
/**
* Amplitude for the mouse-driven effect.
* 鼠标驱动效果的振幅。
*/
amplitude?: number;
/**
* Enable or disable mouse interaction with the shader.
* 启用或禁用鼠标与着色器的交互。
*/
mouseReact?: boolean;
}
interface ThemeHomeHeroOrb {
/**
* The base hue for the orb (in degrees).
* 球的基本色调(度)。
*/
hue?: number;
/**
* Controls the intensity of the hover distortion effect.
* 控制悬停扭曲效果的强度。
*/
hoverIntensity?: number;
/**
* Toggle to enable or disable continuous rotation on hover.
* 启用或禁用悬停时的持续旋转。
*/
rotateOnHover?: boolean;
/**
* Force hover animations even when the orb is not actually hovered.
* 即使没有悬停,也强制启用悬停动画。
*/
forceHoverState?: boolean;
/**
* Additional CSS classes for the component.
* 为组件添加附加 CSS 类。
*/
className?: string;
}
interface ThemeHomeHeroBeams {
/**
* Width of each beam.
* 每个激光束的宽度。
*/
beamWidth?: number;
/**
* Height of each beam.
* 每个激光束的高度。
*/
beamHeight?: number;
/**
* Number of beams to display.
* 要显示的激光束数量。
*/
beamNumber?: number;
/**
* Color of the directional light.
* 方向光的颜色。
*/
lightColor?: ThemeLightDark<string>;
/**
* Speed of the animation.
* 动画的速度。
*/
speed?: number;
/**
* Intensity of the noise effect overlay.
* 噪音效果的强度。
*/
noiseIntensity?: number;
/**
* Scale of the noise pattern.
* 噪音模式的缩放比例。
*/
scale?: number;
/**
* Rotation of the entire beams system in degrees.
* 整个激光束系统的旋转角度(度)。
*/
rotation?: number;
}
interface ThemeHomeHeroLightning {
/**
* Hue of the lightning in degrees (0 to 360).
* 光束的色调(度)(0到360)。
*/
hue?: number;
/**
* Horizontal offset of the lightning in normalized units.
* 光束的水平偏移量(标准化单位)。
*/
xOffset?: number;
/**
* Animation speed multiplier for the lightning.
* 光束的动画速度乘数。
*/
speed?: number;
/**
* Brightness multiplier for the lightning.
* 光束的亮度乘数。
*/
intensity?: number;
/**
* Scale factor for the bolt size.
* 光束的缩放因子。
*/
size?: number;
}
interface ThemeHomeHeroDarkVeil {
/**
* Shifts the hue of the entire animation.
* 调整整个动画的色调。
*/
hueShift?: number;
/**
* Intensity of the noise/grain effect.
* 噪声/颗粒效果的强度。
*/
noiseIntensity?: number;
/**
* Intensity of the scanline effect.
* 扫描线效果的强度。
*/
scanlineIntensity?: number;
/**
* Speed of the animation.
* 动画速度。
*/
speed?: number;
/**
* Frequency of the scanlines.
* 扫描线的频率。
*/
scanlineFrequency?: number;
/**
* Amount of warp distortion applied to the effect.
* 应用于效果的扭曲变形量。
*/
warpAmount?: number;
/**
* Scale factor for the resolution.
* 分辨率缩放比例。
*/
resolutionScale?: number;
}
//#endregion
//#region src/shared/frontmatter/home.d.ts
interface ThemeHomeFrontmatter extends ThemeNormalFrontmatter, Omit<ThemeHomeBanner, 'type'> {
home?: true;
friends?: never;
config?: ThemeHomeConfig[];
}
type ThemeHomeConfig = ThemeHomeBanner | ThemeHomeTextImage | ThemeHomeFeatures | ThemeHomeProfile | ThemeHomeHero | ThemeHomePosts;
interface ThemeHomeConfigBase {
type: 'banner' | 'hero' | 'doc-hero' | 'text-image' | 'image-text' | 'features' | 'profile' | 'custom' | 'posts';
full?: boolean;
backgroundImage?: ThemeLightDark<string>;
backgroundAttachment?: 'fixed' | 'local';
onlyOnce?: boolean;
index: number;
}
interface ThemeHero {
name: string;
tagline?: string;
text?: string;
actions: ThemeHeroAction[];
}
interface ThemeHeroAction {
theme?: 'brand' | 'alt';
text: string;
link?: string;
target?: string;
rel?: string;
icon?: string;
suffixIcon?: string;
}
interface ThemeDocHero extends ThemeHero {
image?: ThemeImage;
}
interface ThemeHomeBanner extends Pick<ThemeHomeConfigBase, 'type' | 'onlyOnce' | 'full'> {
type: 'banner';
banner?: string;
bannerMask?: ThemeLightDark<number>;
hero: ThemeHero;
}
interface ThemeHomeHero extends ThemeHomeConfigBase {
type: 'hero';
hero: ThemeHero;
full?: boolean;
/** @deprecated use `effect` instead */
background?: LiteralUnion<'tint-plate'>;
/** @deprecated use `effectConfig` instead */
tintPlate?: ThemeHomeHeroTintPlate;
effect?: ThemeHomeHeroEffect;
effectConfig?: ThemeHomeHeroEffectConfig;
filter?: string;
forceDark?: boolean;
}
interface ThemeHomeDocHero extends ThemeHomeConfigBase {
type: 'doc-hero';
hero: ThemeDocHero;
}
interface ThemeHomeTextImage extends ThemeHomeConfigBase {
type: 'text-image' | 'image-text';
image: ThemeImage;
width?: number | string;
title?: string;
description?: string;
list: (string | {
title?: string;
description?: string;
})[];
}
interface ThemeHomeFeatures extends ThemeHomeConfigBase {
type: 'features';
title?: string;
description?: string;
features: ThemeHomeFeature[];
}
interface ThemeHomeFeature {
icon?: FeatureIcon;
title: string;
details?: string;
link?: string;
linkText?: string;
rel?: string;
target?: string;
}
type FeatureIcon = string | {
src: string;
alt?: string;
width?: string | number;
height?: string | number;
wrap?: boolean;
} | {
light: string;
dark: string;
alt?: string;
width?: string | number;
height?: string | number;
wrap?: boolean;
};
interface ThemeHomeProfile extends ThemeHomeConfigBase {
type: 'profile';
name?: string;
description?: string;
avatar?: ThemeImage;
circle?: boolean;
}
interface ThemeHomeCustom extends ThemeHomeConfigBase {
type: 'custom';
}
interface ThemeHomePosts extends ThemeHomeConfigBase {
type: 'posts';
collection?: string;
}
//#endregion
//#region src/shared/frontmatter/page.d.ts
interface ThemePageFrontmatter extends ThemeNormalFrontmatter {
home?: never;
friends?: never;
/**
* 是否开启评论
*/
comments?: boolean;
/**
* 是否显示编辑按钮
*/
editLink?: boolean;
/**
* 编辑链接模式
*/
editLinkPattern?: string;
/**
* 是否显示最近更新时间
*/
lastUpdated?: boolean;
/**
* 是否显示贡献者
*/
contributors?: boolean | string[];
/**
* 是否显示变更历史
*/
changelog?: boolean;
/**
* 上一篇
*/
prev?: string | NavItemWithLink;
/**
* 下一篇
*/
next?: string | NavItemWithLink;
/**
* 是否显示侧边栏,也可以强制指定当前页面显示哪个侧边栏
*/
sidebar?: string | false;
/**
* 是否显示页内侧边栏
*/
aside?: boolean | 'left';
/**
* 是否显示内容大纲,仅在页内侧边栏开启时生效
*/
outline?: ThemeOutline;
/**
* 是否显示阅读时间、字数
*/
readingTime?: boolean;
/**
* 水印配置
*/
watermark?: WatermarkPluginFrontmatter['watermark'] & {
fullPage?: boolean;
};
/**
* 用作 navbar 、 sidebar 的图标
* 支持 iconify 图标,直接使用 iconify name 即可自动加载
* 支持 本地、远程 svg 图标,直接使用 svg 的 url 即可
* 或直接传入 svg 字符串
*/
icon?: ThemeIcon;
/**
* 标题徽章
*/
badge?: string | ThemeBadge;
}
//#endregion
//#region src/shared/frontmatter/post.d.ts
interface ThemePostFrontmatter extends ThemePageFrontmatter {
/**
* 创建时间
*/
createTime?: string;
/**
* 文章标签
*/
tags?: string[];
/**
* 是否置顶
*/
sticky?: boolean | number;
/**
* 标记当前文章是否为博客文章
*
* `false` 时,从博客列表中排除
*
* @default true
*/
article?: boolean;
/**
* 标记当前文章是否为草稿状态,
* 草稿状态下的文章不会出现在博客列表中
*
* @default false
*/
draft?: boolean;
/**
* 文章封面图
*/
cover?: string;
/**
* 文章封面图样式
*/
coverStyle?: PostsCoverStyle;
/**
* 是否展示文章摘要,传入 string 时为自定义摘要,此时 `<!-- more -->` 无效
*/
excerpt?: boolean | string;
/**
* 版权信息
*/
copyright?: boolean | CopyrightLicense | CopyrightFrontmatter;
/**
* 文章加密密码
*/
password?: string | string[];
/**
* 文章加密密码提示文本
*/
passwordHint?: string;
}
interface CopyrightFrontmatter extends CopyrightOptions {
/**
* 作品的作者
*
* @default ''
*/
author?: string | {
name: string;
url?: string;
};
/**
* 作品的创作方式
* @default 'original'
*/
creation?: 'original' | 'translate' | 'reprint';
/**
* 原文地址,非 原创 作品时需要声明原文地址
* @default ''
*/
source?: string;
}
//#endregion
//#region src/shared/plugins.d.ts
interface ThemeBuiltinPlugins {
/**
* plugin-search 配置
*/
search?: false | Partial<SearchPluginOptions>;
/**
* plugin-docsearch 配置
*/
docsearch?: false | DocSearchOptions$1;
/**
* 代码块复制按钮配置
*/
copyCode?: false | CopyCodePluginOptions;
/**
* 代码高亮 配置
*/
shiki?: false | ShikiPluginOptions;
/**
* git 插件 配置
*/
git?: boolean;
/**
* 页面加载进度插件
*/
nprogress?: false;
/**
* 图片预览 插件
*/
photoSwipe?: false | PhotoSwipePluginOptions;
/**
* @deprecated 插件相关功能已迁移至其他官方插件,此插件已弃用
*/
markdownEnhance?: never;
/**
* 是否启用 `vuepress-plugin-md-power` 插件
*/
markdownPower?: false | MarkdownPowerPluginOptions;
/**
* 是否启用 `@vuepress/plugin-markdown-image` 插件
*
* @default false
* @see https://ecosystem.vuejs.press/zh/plugins/markdown/markdown-image.html
*/
markdownImage?: false | MarkdownImagePluginOptions;
/**
* 是否启用 `@vuepress/plugin-markdown-math` 插件
*
* @default { type: 'katex' }
* @see https://ecosystem.vuejs.press/zh/plugins/markdown/markdown-math.html
*/
markdownMath?: false | MarkdownMathPluginOptions;
/**
* 是否启用 `@vuepress/plugin-markdown-include` 插件
*
* @default true
*
* @see https://ecosystem.vuejs.press/zh/plugins/markdown/markdown-include.html
*/
markdownInclude?: boolean | MarkdownIncludePluginOptions;
/**
* 是否启用 `@vuepress/plugin-markdown-chart` 插件
*
* @default false
*
* @see https://ecosystem.vuejs.press/plugins/markdown/markdown-chart/
*/
markdownChart?: false | MarkdownChartPluginOptions;
/**
* 评论插件
*/
comment?: false | CommentPluginOptions;
/**
* 生成站点地图
*/
sitemap?: false | Omit<SitemapPluginOptions, 'hostname'> & {
hostname?: string;
};
/**
* SEO
*/
seo?: false | Omit<SeoPluginOptions, 'hostname'> & {
hostname?: string;
};
/**
* 缓存
*/
cache?: false | CachePluginOptions;
/**
* 阅读时间、字数统计
*/
readingTime?: false | ReadingTimePluginOptions;
/**
* 是否开启 水印
*/
watermark?: boolean | (WatermarkPluginOptions & {
fullPage?: boolean;
});
/**
* 资源链接替换
*/
replaceAssets?: false | ReplaceAssetsPluginOptions;
}
//#endregion
//#region src/shared/options.d.ts
/**
* 主题配置 (支持热更新)
*/
interface ThemeConfig extends ThemeBaseData {
/**
* 站点加密配置
*/
encrypt?: EncryptOptions;
/**
* 自动插入 frontmatter
*/
autoFrontmatter?: false | Omit<AutoFrontmatterOptions, 'frontmatter'>;
}
/**
* 主题全量配置
*/
interface ThemeOptions extends ThemeConfig, ThemeFeatureOptions, Omit<ThemeData, 'changelog' | 'contributors' | 'blog'> {
/**
* 主题内置插件配置
*
* 请勿将此配置与 [vuepress plugins](https://v2.vuepress.vuejs.org/zh/reference/config.html#plugins) 混淆
*/
plugins?: ThemeBuiltinPlugins;
}
/**
* 主题功能配置,此配置用于扁平化管理内置插件、功能
*/
interface ThemeFeatureOptions {
/**
* 是否启用编译缓存
*
* @default 'filesystem'
*/
cache?: false | 'memory' | 'filesystem';
/**
* 自定义主题配置文件路径
*/
configFile?: string;
/**
* 博客配置
*
* @deprecated 使用 {@link collections} 代替
*/
blog?: never;
/**
* 是否显示 "编辑此页"
*
* @default true
*/
editLink?: boolean;
/**
* 最后更新时间
*
* @default { formatOptions: { dateStyle: 'short', timeStyle: 'short' } }
*/
lastUpdated?: false | LastUpdatedOptions;
/**
* 贡献者配置
*/
contributors?: boolean | ContributorsOptions & {
mode?: 'inline' | 'block';
};
/**
* 页面变更记录配置
*/
changelog?: boolean | ChangelogOptions;
/**
* 站点搜索配置
*
* @default { provider: 'local' }
*/
search?: boolean | SearchOptions;
/**
* markdown 功能增强配置
*/
markdown?: MarkdownOptions;
/**
* 代码块高亮配置,主题使用 `shiki` 作为代码块高亮器
*/
codeHighlighter?: false | ShikiPluginOptions;
/**
* 评论配置
*/
comment?: false | CommentPluginOptions;
/**
* 水印配置
*/
watermark?: boolean | (WatermarkPluginOptions & {
fullPage?: boolean;
});
/**
* 阅读时间、字数统计
*/
readingTime?: false | ReadingTimePluginOptions;
/**
* 代码复制
*/
copyCode?: false | CopyCodePluginOptions;
/**
* 资源链接替换
*/
replaceAssets?: false | ReplaceAssetsPluginOptions;
}
//#endregion
//#region src/shared/pageData.d.ts
interface ThemePageData extends GitPluginPageData {
/**
* 博客文章分类列表
*/
categoryList?: PostsCategoryItem[];
/**
* 相对于根目录的文件路径
*/
filePathRelative: string | null;
/**
* 阅读时间
*/
readingTime?: ReadingTime;
/**
* 是否启用公告
*/
bulletin?: boolean;
}
//#endregion
export { AutoFrontmatterContext, AutoFrontmatterData, AutoFrontmatterHandle, AutoFrontmatterOptions, AutoFrontmatterRule, BulletinOptions, CopyrightFrontmatter, CopyrightLicense, CopyrightOptions, DocSearchOptions, EncryptOptions, FeatureIcon, FriendGroup, FriendsItem, type GitChangelog, type GitContributor, KnownCopyrightLicense, LastUpdatedOptions, LiteralUnion, LocalSearchOptions, MarkdownOptions, NavItemChildren, NavItemWithChildren, NavItemWithLink, PostsCategoryItem, PostsCoverLayout, PostsCoverStyle, PresetL