-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
Copy pathshared.d.ts
203 lines (190 loc) · 4.26 KB
/
shared.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
// types shared between server and client
import type { UseDarkOptions } from '@vueuse/core'
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
/**
* differs from relativePath in case of path rewrites
* empty string if the page is virtual (e.g. 404 page)
*/
filePath: string
title: string
titleTemplate?: string | boolean
description: string
headers: Header[]
frontmatter: Record<string, any>
params?: Record<string, any>
isNotFound?: boolean
lastUpdated?: number
}
/**
* SFC block extracted from markdown
*/
export interface SfcBlock {
/**
* The type of the block
*/
type: string
/**
* The content, including open-tag and close-tag
*/
content: string
/**
* The content that stripped open-tag and close-tag off
*/
contentStripped: string
/**
* The open-tag
*/
tagOpen: string
/**
* The close-tag
*/
tagClose: string
}
export interface MarkdownSfcBlocks {
/**
* The `<template>` block
*/
template: SfcBlock | null
/**
* The common `<script>` block
*/
script: SfcBlock | null
/**
* The `<script setup>` block
*/
scriptSetup: SfcBlock | null
/**
* All `<script>` blocks.
*
* By default, SFC only allows one `<script>` block and one `<script setup>` block.
* However, some tools may support different types of `<script>`s, so we keep all of them here.
*/
scripts: SfcBlock[]
/**
* All `<style>` blocks.
*/
styles: SfcBlock[]
/**
* All custom blocks.
*/
customBlocks: SfcBlock[]
}
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'
| 'force-dark'
| (Omit<UseDarkOptions, 'initialValue'> & { initialValue?: 'dark' })
themeConfig: ThemeConfig
scrollOffset:
| number
| string
| string[]
| { selector: string | string[]; padding: number }
locales: LocaleConfig<ThemeConfig>
localeIndex?: string
contentProps?: Record<string, any>
router: {
prefetchLinks: boolean
}
}
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 }
>
// Manually declaring all properties as rollup-plugin-dts
// is unable to merge augmented module declarations
export interface MarkdownEnv {
/**
* The raw Markdown content without frontmatter
*/
content?: string
/**
* The excerpt that extracted by `@mdit-vue/plugin-frontmatter`
*
* - Would be the rendered HTML when `renderExcerpt` is enabled
* - Would be the raw Markdown when `renderExcerpt` is disabled
*/
excerpt?: string
/**
* The frontmatter that extracted by `@mdit-vue/plugin-frontmatter`
*/
frontmatter?: Record<string, unknown>
/**
* The headers that extracted by `@mdit-vue/plugin-headers`
*/
headers?: Header[]
/**
* SFC blocks that extracted by `@mdit-vue/plugin-sfc`
*/
sfcBlocks?: MarkdownSfcBlocks
/**
* The title that extracted by `@mdit-vue/plugin-title`
*/
title?: string
path: string
relativePath: string
cleanUrls: boolean
links?: string[]
includes?: string[]
realPath?: string
}