vuepress-theme-plume
Version:
A Blog&Document Theme for VuePress 2.0
1,062 lines (1,061 loc) • 35.6 kB
TypeScript
import { App, ComputedRef, InjectionKey, MaybeRef, MaybeRefOrGetter, Ref } from "vue";
import { PageDataRef, PageFrontmatterRef, PageLangRef, Router, SiteLocaleDataRef, useRoute, useRouter } from "vuepress/client";
import { BulletinOptions, CopyrightFrontmatter, GitContributor, NavItemWithLink, PresetLocale, ResolvedNavItem, ResolvedSidebarItem, ThemeBaseCollection, ThemeCollectionItem, ThemeData, ThemeDocCollection, ThemeFriendsFrontmatter, ThemeHomeFrontmatter, ThemeLocaleData, ThemeOutline, ThemePageData, ThemePageFrontmatter, ThemePostCollection, ThemePostFrontmatter, ThemePosts, ThemePostsItem, ThemeSidebar, ThemeSidebarItem, TransitionOptions } from "../../shared/index.js";
import { RouteParamValueRaw } from "vue-router";
//#region src/client/composables/bulletin.d.ts
declare function useBulletin<T extends Record<string, any> = Record<string, any>>(): ComputedRef<BulletinOptions & T | undefined>;
declare function useBulletinControl<T extends Record<string, any> = Record<string, any>>(): {
bulletin: ComputedRef<BulletinOptions & T | undefined>;
enableBulletin: ComputedRef<boolean>;
showBulletin: Ref<boolean>;
close: () => void;
};
//#endregion
//#region src/client/composables/collections.d.ts
/**
* Reference type for collections data.
* Maps locale paths to arrays of collection items.
*
* 集合数据的引用类型。
* 将语言环境路径映射到集合项数组。
*/
type CollectionsRef = Ref<Record<string, ThemeCollectionItem[]>>;
/**
* Reference type for a single collection item.
*
* 单个集合项的引用类型。
*/
type CollectionItemRef<T extends ThemeBaseCollection> = Ref<T | undefined>;
/**
* Global reference to all collections data.
*
* 所有集合数据的全局引用。
*/
declare const collectionsRef: CollectionsRef;
/**
* Global reference to the current collection item.
*
* 当前集合项的全局引用。
*/
declare const collectionItemRef: CollectionItemRef<ThemeBaseCollection>;
/**
* Use collections data.
* Returns the global collections reference.
*
* 获取集合数据。
* 返回全局集合引用。
*
* @returns Collections data reference / 集合数据引用
*/
declare const useCollections: () => CollectionsRef;
/**
* Use current collection item.
* Returns the current collection based on the page context.
*
* 获取当前集合项。
* 根据页面上下文返回当前集合。
*
* @template T - Collection type / 集合类型
* @returns Current collection item reference / 当前集合项引用
*/
declare const useCollection: <T extends ThemeBaseCollection = ThemeDocCollection>() => CollectionItemRef<T>;
/**
* Force update the current collection.
* Used to programmatically switch the active collection.
*
* 强制更新当前集合。
* 用于以编程方式切换活动集合。
*
* @param dir - Collection directory or true for first posts collection / 集合目录或 true 表示第一个文章集合
*/
declare function forceUpdateCollection(dir?: string | true): void;
/**
* Setup collection tracking.
* Automatically determines the current collection based on route and page path.
*
* 设置集合跟踪。
* 根据路由和页面路径自动确定当前集合。
*/
declare function setupCollection(): void;
//#endregion
//#region src/client/composables/contributors.d.ts
interface useContributorsResult {
mode: ComputedRef<'inline' | 'block'>;
contributors: ComputedRef<GitContributor[]>;
hasContributors: ComputedRef<boolean>;
}
declare function useContributors(): useContributorsResult;
//#endregion
//#region src/client/composables/copyright.d.ts
interface useCopyrightResult {
license: ComputedRef<License>;
author: ComputedRef<Exclude<CopyrightFrontmatter['author'], string>>;
hasCopyright: ComputedRef<boolean>;
creation: ComputedRef<CopyrightFrontmatter['creation']>;
creationText: ComputedRef<string>;
sourceUrl: ComputedRef<string | undefined>;
}
declare function useCopyright(copyright: ComputedRef<CopyrightFrontmatter>): useCopyrightResult;
interface License {
name: string;
url?: string;
icons?: string[];
}
//#endregion
//#region src/client/composables/css-var.d.ts
/**
* Get css variable
* @param prop css variable name
* @param initialValue
*/
declare function useCssVar(prop: MaybeRefOrGetter<string | null | undefined>, initialValue?: string): ComputedRef<string | null | undefined>;
//#endregion
//#region src/client/composables/dark-mode.d.ts
/**
* Dark mode reference type
*
* 暗黑模式引用类型
*/
type DarkModeRef = Ref<boolean>;
/**
* Injection key for dark mode
*
* 暗黑模式的注入键
*/
declare const darkModeSymbol: InjectionKey<DarkModeRef>;
/**
* Check if view transitions are enabled and supported
* Considers prefers-reduced-motion preference
*
* 检查视图过渡是否启用且受支持
* 考虑 prefers-reduced-motion 偏好设置
*
* @returns Whether transitions are enabled / 过渡是否启用
*/
declare function enableTransitions(): boolean;
/**
* Setup dark mode for the Vue application
* Configures dark mode based on theme settings and user preferences
*
* 为 Vue 应用设置暗黑模式
* 根据主题设置和用户偏好配置暗黑模式
*
* @param app - Vue application instance / Vue 应用实例
*/
declare function setupDarkMode(app: App): void;
/**
* Use dark mode
* Returns the dark mode reactive reference
*
* 获取暗黑模式状态
*
* @returns Dark mode reference / 暗黑模式引用
* @throws Error if called without provider / 如果没有提供者则抛出错误
*/
declare function useDarkMode(): DarkModeRef;
//#endregion
//#region src/client/composables/theme-data.d.ts
/**
* Theme data reference type
*
* 主题数据引用类型
*/
type ThemeDataRef<T extends ThemeData = ThemeData> = Ref<T>;
/**
* Theme locale data reference type
*
* 主题本地化数据引用类型
*/
type ThemeLocaleDataRef<T extends ThemeData = ThemeData> = ComputedRef<T>;
/**
* Injection key for theme locale data
*
* 主题本地化数据的注入键
*/
declare const themeLocaleDataSymbol: InjectionKey<ThemeLocaleDataRef>;
/**
* Theme data ref
* Global reference to the theme configuration data
*
* 主题数据引用
* 主题配置数据的全局引用
*/
declare const themeData: ThemeDataRef;
/**
* Use theme data
* Returns the global theme data reference
*
* 获取主题数据
* 返回全局主题数据引用
*
* @returns Theme data reference / 主题数据引用
*/
declare function useThemeData<T extends ThemeData = ThemeData>(): ThemeDataRef<T>;
/**
* Use theme locale data
* Returns the theme data for the current route's locale
*
* 获取当前路由对应的语言环境的主题数据
*
* @returns Theme locale data computed reference / 主题本地化数据计算引用
* @throws Error if called without provider / 如果没有提供者则抛出错误
*/
declare function useThemeLocaleData<T extends ThemeData = ThemeData>(): ThemeLocaleDataRef<T>;
/**
* Setup theme data for the Vue app
* Provides theme data and theme locale data to the application
*
* 为 Vue 应用设置主题数据
* 向应用程序提供主题数据和主题本地化数据
*
* @param app - Vue application instance / Vue 应用实例
*/
declare function setupThemeData(app: App): void;
//#endregion
//#region src/client/composables/data.d.ts
type FrontmatterType = 'home' | 'post' | 'friends' | 'page';
type FrontmatterCollectionType = 'post' | 'doc';
type Frontmatter<T extends FrontmatterType = 'page'> = T extends 'home' ? ThemeHomeFrontmatter : T extends 'post' ? ThemePostFrontmatter : T extends 'friends' ? ThemeFriendsFrontmatter : ThemePageFrontmatter;
interface Data<T extends FrontmatterType = 'page', C extends FrontmatterCollectionType = 'doc'> {
theme: ThemeLocaleDataRef<ThemeLocaleData>;
page: PageDataRef<ThemePageData>;
frontmatter: PageFrontmatterRef<Frontmatter<T> & Record<string, unknown>>;
lang: PageLangRef;
site: SiteLocaleDataRef;
isDark: Ref<boolean>;
collection: CollectionItemRef<C extends 'doc' ? ThemeDocCollection : ThemePostCollection>;
}
/**
* Use data
*
* 获取页面数据,包括主题配置、页面数据、frontmatter、语言、站点信息、暗黑模式和集合信息
*/
declare function useData<T extends FrontmatterType = 'page', C extends FrontmatterCollectionType = 'doc'>(): Data<T, C>;
//#endregion
//#region src/client/composables/edit-link.d.ts
declare function useEditLink(): ComputedRef<null | NavItemWithLink>;
//#endregion
//#region src/client/composables/encrypt-data.d.ts
/**
* Encrypt configuration tuple type
* Contains keys, rules, global flag, and admin passwords
*
* 加密配置元组类型
* 包含密钥、规则、全局标志和管理员密码
*/
type EncryptConfig = readonly [keys: string, rules: string, global: number, admin: string];
/**
* Encrypt data rule interface
* Defines a single encryption rule with matching pattern and passwords
*
* 加密数据规则接口
* 定义单个加密规则,包含匹配模式和密码
*/
interface EncryptDataRule {
/** Unique key for the rule / 规则的唯一键 */
key: string;
/** Match pattern for the rule / 规则的匹配模式 */
match: string;
/** Array of valid passwords / 有效密码数组 */
rules: string[];
}
/**
* Encrypt data interface
* Contains all encryption configuration and rules
*
* 加密数据接口
* 包含所有加密配置和规则
*/
interface EncryptData {
/** Whether global encryption is enabled / 是否启用全局加密 */
global: boolean;
/** Array of admin password hashes / 管理员密码哈希数组 */
admins: string[];
/** Array of match patterns / 匹配模式数组 */
matches: string[];
/** Array of encryption rules / 加密规则数组 */
ruleList: EncryptDataRule[];
}
/**
* Encrypt data reference type
*
* 加密数据引用类型
*/
type EncryptRef = Ref<EncryptData>;
/**
* Global encrypt data reference
*
* 全局加密数据引用
*/
declare const encrypt: EncryptRef;
/**
* Use encrypt data
* Returns the global encrypt data reference
*
* 获取加密数据
* 返回全局加密数据引用
*
* @returns Encrypt data reference / 加密数据引用
*/
declare function useEncryptData(): EncryptRef;
//#endregion
//#region src/client/composables/encrypt.d.ts
/**
* Encrypt interface
* Provides encryption-related reactive states and properties
*
* 加密接口
* 提供加密相关的响应式状态和属性
*/
interface Encrypt {
/** Whether the current page has encryption / 当前页面是否有加密 */
hasPageEncrypt: Ref<boolean>;
/** Whether global encryption is decrypted / 全局加密是否已解密 */
isGlobalDecrypted: Ref<boolean>;
/** Whether page encryption is decrypted / 页面加密是否已解密 */
isPageDecrypted: Ref<boolean>;
/** List of encryption rules for the current page / 当前页面的加密规则列表 */
hashList: Ref<EncryptDataRule[]>;
}
/**
* Injection key for encrypt functionality
*
* 加密功能的注入键
*/
declare const EncryptSymbol: InjectionKey<Encrypt>;
/**
* Setup encrypt functionality for the application
* Initializes encryption state and provides it to child components
*
* 为应用程序设置加密功能
* 初始化加密状态并提供给子组件
*/
declare function setupEncrypt(): void;
/**
* Use encrypt
* Returns the encryption state and properties
*
* 获取加密功能的状态和方法,包括全局解密、页面解密、密码验证等
*
* @returns Encrypt state and properties / 加密状态和属性
* @throws Error if called without setup / 如果没有设置则抛出错误
*/
declare function useEncrypt(): Encrypt;
/**
* Use encrypt compare
* Provides password verification functions for global and page encryption
*
* 密码比较功能,提供全局密码和页面密码的验证方法
*
* @returns Object with compareGlobal and comparePage functions / 包含 compareGlobal 和 comparePage 函数的对象
*/
declare function useEncryptCompare(): {
compareGlobal: (password: string) => Promise<boolean>;
comparePage: (password: string) => Promise<boolean>;
};
//#endregion
//#region src/client/composables/flyout.d.ts
/**
* Options for useFlyout composable.
*
* useFlyout 组合式函数的选项。
*/
interface UseFlyoutOptions {
/** Element to track focus for / 要跟踪焦点的元素 */
el: Ref<HTMLElement | undefined>;
/** Callback when element gains focus / 元素获得焦点时的回调 */
onFocus?: () => void;
/** Callback when element loses focus / 元素失去焦点时的回调 */
onBlur?: () => void;
}
/**
* Currently focused element reference.
* Shared across all flyout instances.
*
* 当前聚焦元素的引用。
* 在所有弹出框实例之间共享。
*/
declare const focusedElement: Ref<HTMLElement | undefined>;
/**
* Use flyout focus tracking.
* Tracks focus state for dropdown menus and flyout components.
*
* 弹出框焦点跟踪。
* 跟踪下拉菜单和弹出框组件的焦点状态。
*
* @param options - Flyout options / 弹出框选项
* @returns Readonly reference to focus state / 焦点状态的只读引用
*/
declare function useFlyout(options: UseFlyoutOptions): Readonly<Ref<boolean>>;
//#endregion
//#region src/client/composables/icons.d.ts
/**
* Raw icons data structure from internal data.
*
* 来自内部数据的原始图标数据结构。
*/
interface IconsRawData {
/** Collection names / 集合名称 */
co: string[];
/** Background icons by collection index / 按集合索引的背景图标 */
bg: Record<number, string[]>;
/** Mask icons by collection index / 按集合索引的遮罩图标 */
mask: Record<number, string[]>;
}
/**
* Processed icons data structure.
*
* 处理后的图标数据结构。
*/
interface IconsData {
/** List of background icons / 背景图标列表 */
bg: string[];
/** List of mask icons / 遮罩图标列表 */
mask: string[];
}
type IconsDataRef = Ref<IconsData>;
/**
* Use icons data.
* Returns the processed icons data reference.
*
* 获取图标数据。
* 返回处理后的图标数据引用。
*
* @returns Icons data reference / 图标数据引用
*/
declare const useIconsData: () => IconsDataRef;
/**
* Fallback mappings for old icon aliases.
* Maps legacy icon names to their current equivalents.
*
* 旧版本内置图标别名的后备映射。
* 将旧图标名称映射到当前等效名称。
*/
declare const socialFallbacks: Record<string, string>;
/**
* Resolve raw icons data to processed format.
* Converts indexed data to flat icon lists.
*
* 将原始图标数据解析为处理后的格式。
* 将索引数据转换为平面图标列表。
*
* @param data - Raw icons data / 原始图标数据
* @param data.co - Collection names / 集合名称
* @param data.bg - Background icons by collection index / 按集合索引的背景图标
* @param data.mask - Mask icons by collection index / 按集合索引的遮罩图标
* @returns Processed icons data / 处理后的图标数据
*/
declare function resolveIconsData({
co,
bg,
mask
}: IconsRawData): IconsData;
/**
* Normalize icon to CSS class name.
* Returns the appropriate class name based on icon type.
*
* 将图标规范化为 CSS 类名。
* 根据图标类型返回适当的类名。
*
* @param icon - Icon name in format "collection:name" / 格式为 "collection:name" 的图标名称
* @returns CSS class name or empty string if not found / CSS 类名,如果未找到则返回空字符串
*/
declare function normalizeIconClassname(icon: string): string;
//#endregion
//#region src/client/composables/internal-link.d.ts
interface InternalLink {
text: string;
link: string;
}
declare function useInternalLink(): {
home: ComputedRef<InternalLink>;
posts: ComputedRef<InternalLink | undefined>;
tags: ComputedRef<InternalLink | undefined>;
archive: ComputedRef<InternalLink | undefined>;
categories: ComputedRef<InternalLink | undefined>;
};
//#endregion
//#region src/client/composables/langs.d.ts
interface Lang {
text: string;
link: string;
}
interface UseLangOptions {
removeCurrent?: boolean;
}
interface UseLangResult {
localeLinks: ComputedRef<Lang[]>;
currentLang: ComputedRef<Lang>;
}
declare function useLangs({
removeCurrent
}?: UseLangOptions): UseLangResult;
//#endregion
//#region src/client/composables/latest-updated.d.ts
declare function useLastUpdated(): {
datetime: Ref<string>;
isoDatetime: ComputedRef<string | undefined>;
lastUpdatedText: ComputedRef<string>;
};
//#endregion
//#region src/client/composables/layout.d.ts
/**
* Use layout
*
* 获取当前页面布局相关信息,包括是否首页、是否有侧边栏、是否显示目录等
*/
declare function useLayout(): {
isHome: import("vue").ComputedRef<boolean>;
hasAside: import("vue").ComputedRef<boolean>;
hasSidebar: import("vue").ComputedRef<boolean>;
leftAside: import("vue").ComputedRef<boolean>;
hasLocalNav: import("vue").ComputedRef<boolean>;
isSidebarEnabled: import("vue").ComputedRef<boolean>;
isAsideEnabled: import("vue").ComputedRef<boolean>;
is960: import("vue").ShallowRef<boolean, boolean>;
is1280: import("vue").ShallowRef<boolean, boolean>;
};
declare function registerWatchers(): void;
//#endregion
//#region src/client/composables/link.d.ts
/**
* Link resolution result interface
* Provides information about the resolved link
*
* 链接解析结果接口
* 提供有关解析后链接的信息
*/
interface UseLinkResult {
/**
* Whether the link is external
* 是否为外部链接
*/
isExternal: ComputedRef<boolean>;
/**
* Whether the link uses an external protocol
* Does not include target="_blank" cases
* 是否使用外部链接协议
* 此项不包含 target="_blank" 的情况
*/
isExternalProtocol: ComputedRef<boolean>;
/**
* The resolved link URL
* 解析后的链接 URL
*/
link: ComputedRef<string | undefined>;
}
/**
* Use link
* Resolves and processes a link URL with smart handling of internal/external links
*
* 使用链接
* 解析并处理链接 URL,智能处理内部/外部链接
*
* @param href - Link URL or reference / 链接 URL 或引用
* @param target - Link target or reference / 链接目标或引用
* @returns Link resolution result / 链接解析结果
*/
declare function useLink(href: MaybeRefOrGetter<string | undefined>, target?: MaybeRefOrGetter<string | undefined>): UseLinkResult;
//#endregion
//#region src/client/composables/nav.d.ts
/**
* Use navbar data
* Returns the resolved navbar items based on theme configuration
*
* 获取导航栏数据
* 根据主题配置返回解析后的导航栏项目
*
* @returns Reactive reference to resolved navbar items / 解析后的导航栏项目的响应式引用
*/
declare function useNavbarData(): Ref<ResolvedNavItem[]>;
/**
* Navigation control return type
* Provides state and methods for mobile navigation menu
*
* 导航控制返回类型
* 提供移动端导航菜单的状态和方法
*/
interface UseNavReturn {
/** Whether the mobile screen menu is open / 移动端屏幕菜单是否打开 */
isScreenOpen: Ref<boolean>;
/** Open the mobile screen menu / 打开移动端屏幕菜单 */
openScreen: () => void;
/** Close the mobile screen menu / 关闭移动端屏幕菜单 */
closeScreen: () => void;
/** Toggle the mobile screen menu / 切换移动端屏幕菜单 */
toggleScreen: () => void;
}
/**
* Use nav
* Provides mobile navigation menu control functionality
*
* 导航栏状态控制,提供移动端导航菜单的打开、关闭和切换功能
*
* @returns Navigation control state and methods / 导航控制状态和方法
*/
declare function useNav(): UseNavReturn;
//#endregion
//#region src/client/composables/outline.d.ts
/**
* Header interface representing a page heading
*
* Header 接口表示页面标题
*/
interface Header {
/**
* The level of the header
* `1` to `6` for `<h1>` to `<h6>`
*
* 标题级别
* `1` 到 `6` 对应 `<h1>` 到 `<h6>`
*/
level: number;
/**
* The title of the header
*
* 标题文本
*/
title: string;
/**
* The slug of the header
* Typically the `id` attr of the header anchor
*
* 标题的 slug
* 通常是标题锚点的 `id` 属性
*/
slug: string;
/**
* Link of the header
* Typically using `#${slug}` as the anchor hash
*
* 标题链接
* 通常使用 `#${slug}` 作为锚点哈希
*/
link: string;
/**
* The children of the header
*
* 子标题
*/
children: Header[];
}
/**
* Menu item type for outline navigation
* Extends Header with element reference and additional properties
*
* 目录导航的菜单项类型
* 扩展 Header 并添加元素引用和额外属性
*/
type MenuItem = Omit<Header, 'slug' | 'children'> & {
/** Reference to the DOM element / DOM 元素引用 */element: HTMLHeadElement; /** Child menu items / 子菜单项 */
children?: MenuItem[]; /** Lowest level for outline display / 目录显示的最低级别 */
lowLevel?: number;
};
/**
* Setup headers for the current page
* Initializes header extraction based on frontmatter and theme configuration
*
* 为当前页面设置标题
* 根据 frontmatter 和主题配置初始化标题提取
*
* @returns Reference to the headers array / 标题数组的引用
*/
declare function setupHeaders(): Ref<MenuItem[]>;
/**
* Use headers
* Returns the reactive headers reference for the current page
*
* 获取当前页面的标题列表
*
* @returns Reactive reference to menu items / 菜单项的响应式引用
*/
declare function useHeaders(): Ref<MenuItem[]>;
/**
* Get headers from the page content
* Extracts and filters headings based on the outline configuration
*
* 从页面内容获取标题
* 根据目录配置提取和过滤标题
*
* @param range - Outline configuration for header levels / 标题级别的目录配置
* @returns Array of menu items representing headers / 表示标题的菜单项数组
*/
declare function getHeaders(range?: ThemeOutline): MenuItem[];
/**
* Resolve headers into a hierarchical structure
* Organizes flat headers into nested menu items based on levels
*
* 将标题解析为层次结构
* 根据级别将平面标题组织为嵌套菜单项
*
* @param headers - Flat array of menu items / 平面菜单项数组
* @param high - Minimum header level to include / 要包含的最小标题级别
* @returns Hierarchical array of menu items / 层次化的菜单项数组
*/
declare function resolveHeaders(headers: MenuItem[], high: number): MenuItem[];
/**
* Use active anchor
* Tracks scroll position and updates the active outline item
*
* 活跃锚点处理,监听滚动并更新目录中高亮的锚点
*
* @param container - Reference to the outline container / 目录容器的引用
* @param marker - Reference to the active marker element / 活动标记元素的引用
*/
declare function useActiveAnchor(container: Ref<HTMLElement | null>, marker: Ref<HTMLElement | null>): void;
//#endregion
//#region src/client/composables/page.d.ts
/**
* Use posts page data
*
* 获取文章页面数据,判断当前页面是否为文章类型或文章列表布局
*/
declare function usePostsPageData(): {
isPosts: ComputedRef<boolean>;
isPostsLayout: ComputedRef<boolean>;
};
//#endregion
//#region src/client/composables/posts-archives.d.ts
type ShortPostsItem = Pick<ThemePostsItem, 'title' | 'path' | 'createTime'>;
interface ArchiveItem {
title: string;
label: string;
list: ShortPostsItem[];
}
declare function useArchives(): {
archives: ComputedRef<ArchiveItem[]>;
};
//#endregion
//#region src/client/composables/posts-category.d.ts
interface CategoryItemWithPost {
type: 'post';
title: string;
path: string;
}
interface CategoryItem {
id: string;
type: 'category';
sort: number;
title: string;
items: (CategoryItem | CategoryItemWithPost)[];
}
type PostsCategory = (CategoryItem | CategoryItemWithPost)[];
declare function usePostsCategory(): {
categories: ComputedRef<PostsCategory>;
};
//#endregion
//#region src/client/composables/posts-data.d.ts
type PostsDataRef = Ref<Record<string, ThemePosts>>;
/**
* Posts data ref
*
* 文章数据引用,包含所有语言环境的文章列表
*/
declare const postsData: PostsDataRef;
/**
* Use posts data
*
* 获取文章数据
*/
declare function usePostsData(): PostsDataRef;
/**
* Use locale post list
*
* 获取当前语言环境的文章列表
*/
declare function useLocalePostList(): ComputedRef<ThemePosts>;
//#endregion
//#region src/client/composables/posts-extract.d.ts
interface PostsExtractLink {
link?: string;
text?: string;
total: number;
}
declare function usePostsExtract(): {
hasPostsExtract: ComputedRef<boolean>;
tags: ComputedRef<PostsExtractLink>;
archives: ComputedRef<PostsExtractLink>;
categories: ComputedRef<PostsExtractLink>;
};
//#endregion
//#region src/client/composables/posts-post-list.d.ts
/**
* Use post list control result
*
* 文章列表控制结果类型,包含分页相关的数据和方法
*/
interface UsePostListControlResult {
postList: ComputedRef<ThemePostsItem[]>;
page: Ref<number>;
totalPage: ComputedRef<number>;
pageRange: ComputedRef<{
value: number | string;
more?: true;
}[]>;
isLastPage: ComputedRef<boolean>;
isFirstPage: ComputedRef<boolean>;
isPaginationEnabled: ComputedRef<boolean>;
changePage: (page: number) => void;
}
/**
* Use post list control
*
* 文章列表控制,管理分页逻辑和文章列表数据
*/
declare function usePostListControl(homePage: Ref<boolean>): UsePostListControlResult;
//#endregion
//#region src/client/composables/posts-tags.d.ts
type ShortPostItem = Pick<ThemePostsItem, 'title' | 'path' | 'createTime'>;
/**
* Posts tag item
*
* 标签项,包含名称、数量和样式类名
*/
interface PostsTagItem {
name: string;
count: string | number;
className: string;
}
/**
* Use tags result
*
* 标签结果类型
*/
interface UseTagsResult {
tags: ComputedRef<PostsTagItem[]>;
currentTag: Ref<string>;
postList: ComputedRef<ShortPostItem[]>;
handleTagClick: (tag: string) => void;
}
/**
* Use tags
*
* 获取标签列表和当前选中的标签,处理标签相关逻辑
*/
declare function useTags(): UseTagsResult;
//#endregion
//#region src/client/composables/preset-locales.d.ts
interface PresetLocales {
[]: PresetLocale;
}
declare const presetLocales: PresetLocales;
declare function getPresetLocaleData(locale: string, name: keyof PresetLocale): string;
//#endregion
//#region src/client/composables/prev-next.d.ts
/**
* Use prev next result
*
* 上一页/下一页结果类型
*/
interface UsePrevNextResult {
prev: ComputedRef<NavItemWithLink | null>;
next: ComputedRef<NavItemWithLink | null>;
}
/**
* Use prev next
*
* 获取上一页和下一页链接
*/
declare function usePrevNext(): UsePrevNextResult;
//#endregion
//#region src/client/composables/route-query.d.ts
type RouteQueryValueRaw = RouteParamValueRaw | string[];
interface ReactiveRouteOptions {
/**
* Mode to update the router query, ref is also acceptable
*
* @default 'replace'
*/
mode?: MaybeRef<'replace' | 'push'>;
/**
* Route instance, use `useRoute()` if not given
*/
route?: ReturnType<typeof useRoute>;
/**
* Router instance, use `useRouter()` if not given
*/
router?: ReturnType<typeof useRouter>;
}
interface ReactiveRouteOptionsWithTransform<V, R> extends ReactiveRouteOptions {
/**
* Function to transform data before return
*/
transform?: (val: V) => R;
}
declare function useRouteQuery(name: string): Ref<null | string | string[]>;
declare function useRouteQuery<T extends RouteQueryValueRaw = RouteQueryValueRaw, K = T>(name: string, defaultValue?: MaybeRefOrGetter<T>, options?: ReactiveRouteOptionsWithTransform<T, K>): Ref<K>;
//#endregion
//#region src/client/composables/scroll-behavior.d.ts
declare function enhanceScrollBehavior(router: Router): void;
//#endregion
//#region src/client/composables/scroll-promise.d.ts
interface ScrollPromise {
wait: () => Promise<void> | null;
pending: () => void;
resolve: () => void;
}
declare const useScrollPromise: () => ScrollPromise;
//#endregion
//#region src/client/composables/sidebar-data.d.ts
/**
* Sidebar data type - maps locale paths to sidebar configurations.
*
* 侧边栏数据类型 - 将语言环境路径映射到侧边栏配置。
*/
type SidebarData = Record<string, ThemeSidebar>;
/**
* Reference type for sidebar data.
*
* 侧边栏数据的引用类型。
*/
type SidebarDataRef = Ref<SidebarData>;
/**
* Reference type for auto-generated directory sidebar.
*
* 自动生成目录侧边栏的引用类型。
*/
type AutoDirSidebarRef = Ref<ThemeSidebarItem[] | {
link: string;
items: ThemeSidebarItem[];
}>;
/**
* Reference type for auto-generated home data.
*
* 自动生成首页数据的引用类型。
*/
type AutoHomeDataRef = Ref<Record<string, string>>;
/**
* Global sidebar data reference.
*
* 全局侧边栏数据引用。
*/
declare const sidebarData: SidebarDataRef;
/**
* Auto-generated directory sidebar reference.
*
* 自动生成目录侧边栏引用。
*/
declare const autoDirSidebar: AutoDirSidebarRef;
/**
* Setup sidebar tracking.
* Automatically updates sidebar based on route and frontmatter changes.
*
* 设置侧边栏跟踪。
* 根据路由和 frontmatter 变化自动更新侧边栏。
*/
declare function setupSidebar(): void;
/**
* Use sidebar data.
* Returns the resolved sidebar items for the current page.
*
* 获取侧边栏数据。
* 返回当前页面的解析侧边栏项目。
*
* @returns Resolved sidebar items reference / 解析侧边栏项目引用
*/
declare function useSidebarData(): Ref<ResolvedSidebarItem[]>;
/**
* Get the sidebar configuration from sidebar options.
* Ensures correct sidebar config from MultiSideBarConfig with various path combinations.
* Returns empty array if no matching config is found.
*
* 从侧边栏选项获取侧边栏配置。
* 确保从 MultiSideBarConfig 获取正确的侧边栏配置,支持各种路径组合。
* 如果未找到匹配的配置,则返回空数组。
*
* @param routePath - Current route path / 当前路由路径
* @param routeLocal - Current route locale / 当前路由语言环境
* @returns Resolved sidebar items / 解析的侧边栏项目
*/
declare function getSidebar(routePath: string, routeLocal: string): ResolvedSidebarItem[];
/**
* Get or generate sidebar groups from the given sidebar items.
* Groups consecutive items without children into a single group.
*
* 从给定的侧边栏项目获取或生成侧边栏分组。
* 将没有子项目的连续项目分组到单个组中。
*
* @param sidebar - Flat array of sidebar items / 平面侧边栏项目数组
* @returns Grouped sidebar items / 分组的侧边栏项目
*/
declare function getSidebarGroups(sidebar: ResolvedSidebarItem[]): ResolvedSidebarItem[];
/**
* Get the first link from sidebar items.
* Recursively searches through nested items to find the first link.
*
* 从侧边栏项目获取第一个链接。
* 递归搜索嵌套项目以找到第一个链接。
*
* @param sidebar - Sidebar items to search / 要搜索的侧边栏项目
* @returns First link found or empty string / 找到的第一个链接或空字符串
*/
declare function getSidebarFirstLink(sidebar: ResolvedSidebarItem[]): string;
//#endregion
//#region src/client/composables/sidebar.d.ts
/**
* Check if the given sidebar item contains any active link.
*
* 检查给定的侧边栏项是否包含活动链接
*/
declare function hasActiveLink(path: string, items: ResolvedSidebarItem | ResolvedSidebarItem[]): boolean;
/**
* Use sidebar control
*
* 侧边栏控制,提供启用/禁用侧边栏和折叠/展开的控制函数
*/
declare function useSidebarControl(): {
isSidebarEnabled: Ref<boolean, boolean>;
enableSidebar: () => void;
disableSidebar: () => void;
toggleSidebarEnabled: () => void;
isSidebarCollapsed: Ref<boolean, boolean>;
toggleSidebarCollapse: (collapse?: boolean) => void;
};
/**
* Use sidebar
*
* 侧边栏数据,获取当前路由的侧边栏项目和分组
*/
declare function useSidebar(): {
sidebar: Ref<ResolvedSidebarItem[]>;
sidebarKey: ComputedRef<string>;
sidebarGroups: ComputedRef<ResolvedSidebarItem[]>;
};
/**
* Use close sidebar on escape
*
* a11y: 缓存打开侧边栏的元素(菜单按钮),当使用 Escape 关闭菜单时重新聚焦该按钮
*/
declare function useCloseSidebarOnEscape(): void;
/**
* Use sidebar item control
*
* 侧边栏项目控制,管理单个侧边栏项目的折叠状态、激活状态等
*/
declare function useSidebarItemControl(item: ComputedRef<ResolvedSidebarItem>): SidebarItemControl;
interface SidebarItemControl {
collapsed: Ref<boolean>;
collapsible: ComputedRef<boolean>;
isLink: ComputedRef<boolean>;
isActiveLink: Ref<boolean>;
hasActiveLink: ComputedRef<boolean>;
hasChildren: ComputedRef<boolean>;
toggle: () => void;
}
//#endregion
//#region src/client/composables/tag-colors.d.ts
type TagColors = Record<string, string>;
type TagColorsRef = Ref<TagColors>;
declare const useTagColors: () => TagColorsRef;
//#endregion
//#region src/client/composables/view-transition.d.ts
type TransitionMode = Exclude<TransitionOptions['appearance'], boolean>;
declare function resolveTransitionKeyframes(x: number, y: number, mode: TransitionMode, isDark: boolean): {
keyframes: PropertyIndexedKeyframes;
duration: number;
};
//#endregion
//#region src/client/composables/watermark.d.ts
declare function setupWatermark(): void;
//#endregion
export { AutoDirSidebarRef, AutoHomeDataRef, CategoryItem, CategoryItemWithPost, CollectionItemRef, CollectionsRef, Data, Encrypt, EncryptConfig, EncryptData, EncryptDataRule, EncryptRef, EncryptSymbol, Header, InternalLink, MenuItem, PostsCategory, PostsDataRef, ReactiveRouteOptions, ReactiveRouteOptionsWithTransform, RouteQueryValueRaw, ScrollPromise, ShortPostsItem, SidebarData, SidebarDataRef, SidebarItemControl, TagColors, TagColorsRef, ThemeDataRef, ThemeLocaleDataRef, UseNavReturn, autoDirSidebar, collectionItemRef, collectionsRef, darkModeSymbol, enableTransitions, encrypt, enhanceScrollBehavior, focusedElement, forceUpdateCollection, getHeaders, getPresetLocaleData, getSidebar, getSidebarFirstLink, getSidebarGroups, hasActiveLink, normalizeIconClassname, postsData, presetLocales, registerWatchers, resolveHeaders, resolveIconsData, resolveTransitionKeyframes, setupCollection, setupDarkMode, setupEncrypt, setupHeaders, setupSidebar, setupThemeData, setupWatermark, sidebarData, socialFallbacks, themeData, themeLocaleDataSymbol, useActiveAnchor, useArchives, useBulletin, useBulletinControl, useCloseSidebarOnEscape, useCollection, useCollections, useContributors, useCopyright, useCssVar, useDarkMode, useData, useEditLink, useEncrypt, useEncryptCompare, useEncryptData, useFlyout, useHeaders, useIconsData, useInternalLink, useLangs, useLastUpdated, useLayout, useLink, useLocalePostList, useNav, useNavbarData, usePostListControl, usePostsCategory, usePostsData, usePostsExtract, usePostsPageData, usePrevNext, useRouteQuery, useScrollPromise, useSidebar, useSidebarControl, useSidebarData, useSidebarItemControl, useTagColors, useTags, useThemeData, useThemeLocaleData };