|
|
|
// types shared between server and client
|
|
|
|
import type { SSRContext } from 'vue/server-renderer'
|
|
|
|
export type { DefaultTheme } from './default-theme.js'
|
|
|
|
|
|
|
|
export type Awaitable<T> = T | PromiseLike<T>
|
|
|
|
|
|
|
|
export interface PageData {
|
|
|
|
relativePath: string
|
|
|
|
title: string
|
|
|
|
titleTemplate?: string | boolean
|
|
|
|
description: string
|
|
|
|
headers: Header[]
|
|
|
|
frontmatter: Record<string, any>
|
|
|
|
lastUpdated?: number
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Header {
|
|
|
|
/**
|
|
|
|
* The level of the header
|
|
|
|
*
|
|
|
|
* `1` to `6` for `<h1>` to `<h6>`
|
|
|
|
*/
|
|
|
|
level: number
|
|
|
|
/**
|
|
|
|
* The title of the header
|
|
|
|
*/
|
|
|
|
title: string
|
|
|
|
/**
|
|
|
|
* The slug of the header
|
|
|
|
*
|
|
|
|
* Typically the `id` attr of the header anchor
|
|
|
|
*/
|
|
|
|
slug: string
|
|
|
|
/**
|
|
|
|
* Link of the header
|
|
|
|
*
|
|
|
|
* Typically using `#${slug}` as the anchor hash
|
|
|
|
*/
|
|
|
|
link: string
|
|
|
|
/**
|
|
|
|
* The children of the header
|
|
|
|
*/
|
|
|
|
children: Header[]
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface SiteData<ThemeConfig = any> {
|
|
|
|
base: string
|
|
|
|
cleanUrls?: boolean
|
|
|
|
lang: string
|
|
|
|
dir: string
|
|
|
|
title: string
|
|
|
|
titleTemplate?: string | boolean
|
|
|
|
description: string
|
|
|
|
head: HeadConfig[]
|
|
|
|
appearance: boolean | 'dark'
|
|
|
|
themeConfig: ThemeConfig
|
|
|
|
scrollOffset: number | string
|
|
|
|
locales: LocaleConfig<ThemeConfig>
|
|
|
|
localeIndex?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type HeadConfig =
|
|
|
|
| [string, Record<string, string>]
|
|
|
|
| [string, Record<string, string>, string]
|
|
|
|
|
|
|
|
export interface PageDataPayload {
|
|
|
|
path: string
|
|
|
|
pageData: PageData
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface SSGContext extends SSRContext {
|
|
|
|
content: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface LocaleSpecificConfig<ThemeConfig = any> {
|
|
|
|
lang?: string
|
|
|
|
dir?: string
|
|
|
|
title?: string
|
|
|
|
titleTemplate?: string | boolean
|
|
|
|
description?: string
|
|
|
|
head?: HeadConfig[]
|
|
|
|
themeConfig?: ThemeConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
export type LocaleConfig<ThemeConfig = any> = Record<
|
|
|
|
string,
|
|
|
|
LocaleSpecificConfig<ThemeConfig> & { label: string; link?: string }
|
|
|
|
>
|