1
- import type { TransitionGroupProps } from 'vue'
2
1
import type { ExportArgs } from './cli'
3
- import type { SlidevThemeConfig } from './types '
2
+ import type { HeadmatterConfig } from './frontmatter '
4
3
5
- export interface Headmatter {
6
- /**
7
- * Title of the slides
8
- */
9
- title ?: string
10
- /**
11
- * String template to compose title
12
- *
13
- * @example "%s - Slidev" - to suffix " - Slidev" to all pages
14
- * @default '%s - Slidev'
15
- */
16
- titleTemplate ?: string
17
- /**
18
- * Theme to use for the slides
19
- *
20
- * @see https://sli.dev/themes/use.html
21
- * @default 'default'
22
- */
23
- theme ?: string
24
- /**
25
- * List of Slidev addons
26
- *
27
- * @default []
28
- */
29
- addons ?: string [ ]
30
- /**
31
- * Download remote assets in local using vite-plugin-remote-assets
32
- *
33
- * @default false
34
- */
35
- remoteAssets ?: boolean | 'dev' | 'build'
36
- /**
37
- * Show a download button in the SPA build,
38
- * could also be a link to custom pdf
39
- *
40
- * @default false
41
- */
42
- download ?: boolean | string
43
- /**
44
- * Show a copy button in code blocks
45
- *
46
- * @default true
47
- */
48
- codeCopy ?: boolean
49
- /**
50
- * Information shows on the built SPA
51
- * Can be a markdown string
52
- *
53
- * @default false
54
- */
55
- info ?: string | boolean
56
- /**
57
- * Prefer highlighter
58
- *
59
- * @see https://sli.dev/custom/config-highlighter.html
60
- * @default shiki
61
- */
62
- highlighter ?: 'shiki' | 'prism'
63
- /**
64
- * Enable Twoslash
65
- *
66
- * @default true
67
- */
68
- twoslash ?: boolean | 'dev' | 'build'
69
- /**
70
- * Show line numbers in code blocks
71
- *
72
- * @default false
73
- */
74
- lineNumbers ?: boolean
75
- /**
76
- * Force slides color schema
77
- *
78
- * @default 'auto'
79
- */
80
- colorSchema ?: 'dark' | 'light' | 'all' | 'auto'
81
- /**
82
- * Router mode for vue-router
83
- *
84
- * @default 'history'
85
- */
86
- routerMode ?: 'hash' | 'history'
87
- /**
88
- * Aspect ratio for slides
89
- * should be like `16/9` or `1:1`
90
- *
91
- * @default '16/9'
92
- */
93
- aspectRatio ?: number
94
- /**
95
- * The actual width for slides canvas.
96
- * unit in px.
97
- *
98
- * @default '980'
99
- */
100
- canvasWidth ?: number
101
- /**
102
- * Controls whether texts in slides are selectable
103
- *
104
- * @default true
105
- */
106
- selectable ?: boolean
107
- /**
108
- * Configure for themes, will inject intro root styles as
109
- * `--slidev-theme-x` for attribute `x`
110
- *
111
- * This allows themes to have customization options in frontmatter
112
- * Refer to themes' document for options avaliable
113
- *
114
- * @default {}
115
- */
116
- themeConfig ?: SlidevThemeConfig
117
- /**
118
- * Configure fonts for the slides and app
119
- *
120
- * @default {}
121
- */
122
- fonts ?: ResolvedFontOptions
123
- /**
124
- * Configure the icon for app
125
- *
126
- * @default 'https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png'
127
- */
128
- favicon ?: string
129
- /**
130
- * Options for drawings
131
- *
132
- * @default {}
133
- */
134
- drawings ?: ResolvedDrawingsOptions
135
- /**
136
- * URL of PlantUML server used to render diagrams
137
- *
138
- * @default https://www.plantuml.com/plantuml
139
- */
140
- plantUmlServer ?: string
141
- /**
142
- * Enable slides recording
143
- *
144
- * @default 'dev'
145
- */
146
- record ?: boolean | 'dev' | 'build'
147
- /**
148
- * Expose the server to inbound requests (listen to `0.0.0.0`)
149
- *
150
- * Pass a string to set the password for accessing presenter mode.
151
- *
152
- * @default false
153
- */
154
- remote ?: string | boolean
155
- /**
156
- * Engine for Atomic CSS
157
- *
158
- * @see https://unocss.dev/
159
- * @deprecated
160
- * @default 'unocss'
161
- */
162
- css ?: 'unocss'
163
- /**
164
- * Enable presenter mode
165
- *
166
- * @default true
167
- */
168
- presenter ?: boolean | 'dev' | 'build'
169
- /**
170
- * Attributes to apply to the HTML element
171
- *
172
- * @default {}
173
- */
174
- htmlAttrs ?: Record < string , string >
175
- /**
176
- * Page transition, powered by Vue's <TransitionGroup/>
177
- *
178
- * Built-in transitions:
179
- * - fade
180
- * - fade-out
181
- * - slide-left
182
- * - slide-right
183
- * - slide-up
184
- * - slide-down
185
- *
186
- * @see https://sli.dev/guide/animations.html#pages-transitions
187
- * @see https://vuejs.org/guide/built-ins/transition.html
188
- */
189
- transition ?: BuiltinSlideTransition | string | TransitionGroupProps | null
190
- /**
191
- * Suppport MDC syntax
192
- *
193
- * @see https://github.com/antfu/markdown-it-mdc
194
- * @see https://content.nuxtjs.org/guide/writing/mdc
195
- * @experimental
196
- * @default false
197
- */
198
- mdc ?: boolean
199
- /**
200
- * Enable built-in editor
201
- *
202
- * @default true
203
- */
204
- editor ?: boolean
205
- /**
206
- * Enable context menu
207
- *
208
- * @default true
209
- */
210
- contextMenu ?: boolean | 'dev' | 'build' | null
211
- /**
212
- * Enable wake lock
213
- */
214
- wakeLock ?: boolean | 'dev' | 'build'
215
- /**
216
- * Options for export
217
- *
218
- * @default {}
219
- */
220
- export ?: ResolvedExportOptions
221
- /**
222
- * Force the filename used when exporting the presentation.
223
- * The extension, e.g. .pdf, gets automatically added.
224
- *
225
- * @default ''
226
- */
227
- exportFilename ?: string | null
228
- /**
229
- * Enable Monaco
230
- *
231
- * @see https://sli.dev/custom/config-monaco.html
232
- * @default true
233
- */
234
- monaco ?: boolean | 'dev' | 'build'
235
- /**
236
- * Where to load monaco types from
237
- *
238
- * - `cdn` - load from CDN with `@typescript/ata`
239
- * - `local` - load from local node_modules
240
- *
241
- * @default 'local'
242
- */
243
- monacoTypesSource ?: 'cdn' | 'local' | 'none'
244
- /**
245
- * Additional node packages to load as monaco types
246
- *
247
- * @default []
248
- */
249
- monacoTypesAdditionalPackages ?: string [ ]
250
- /**
251
- * Packages to ignore when loading monaco types
252
- *
253
- * @default []
254
- */
255
- monacoTypesIgnorePackages ?: string [ ]
256
- /**
257
- * Additional local modules to load as dependencies of monaco runnable
258
- *
259
- * @default []
260
- */
261
- monacoRunAdditionalDeps ?: string [ ]
4
+ export interface ResolvedSlidevConfigSub {
5
+ export : ResolvedExportOptions
6
+ drawings : ResolvedDrawingsOptions
7
+ fonts : ResolvedFontOptions
262
8
}
263
9
264
- export interface SlidevConfig extends Required < Headmatter > {
265
- }
266
-
267
- export interface FontOptions {
268
- /**
269
- * Sans serif fonts (default fonts for most text)
270
- */
271
- sans ?: string | string [ ]
272
- /**
273
- * Serif fonts
274
- */
275
- serif ?: string | string [ ]
276
- /**
277
- * Monospace fonts, for code blocks and etc.
278
- */
279
- mono ?: string | string [ ]
280
- /**
281
- * Load webfonts for custom CSS (does not apply anywhere by default)
282
- */
283
- custom ?: string | string [ ]
284
- /**
285
- * Weights for fonts
286
- *
287
- * @default [200, 400, 600]
288
- */
289
- weights ?: string | ( string | number ) [ ]
290
- /**
291
- * Import italic fonts
292
- *
293
- * @default false
294
- */
295
- italic ?: boolean
296
- /**
297
- * @default 'google'
298
- */
299
- provider ?: 'none' | 'google'
300
- /**
301
- * Specify web fonts names, will detect from `sans`, `mono`, `serif` if not provided
302
- */
303
- webfonts ?: string [ ]
304
- /**
305
- * Specify local fonts names, be excluded from webfonts
306
- */
307
- local ?: string [ ]
308
- /**
309
- * Use fonts fallback
310
- *
311
- * @default true
312
- */
313
- fallbacks ?: boolean
314
- }
315
-
316
- export interface DrawingsOptions {
317
- /**
318
- * Persist the drawings to disk
319
- * Passing string to specify the directory (default to `.slidev/drawings`)
320
- *
321
- * @default false
322
- */
323
- persist ?: boolean | string
324
-
325
- /**
326
- * @default true
327
- */
328
- enabled ?: boolean | 'dev' | 'build'
329
-
330
- /**
331
- * Only allow drawing from presenter mode
332
- *
333
- * @default false
334
- */
335
- presenterOnly ?: boolean
336
-
337
- /**
338
- * Sync drawing for all instances
339
- *
340
- * @default true
341
- */
342
- syncAll ?: boolean
10
+ export interface SlidevConfig extends
11
+ Omit < Required < HeadmatterConfig > , keyof ResolvedSlidevConfigSub > ,
12
+ ResolvedSlidevConfigSub {
343
13
}
344
14
345
15
export interface ResolvedFontOptions {
@@ -365,5 +35,3 @@ export interface ResolvedExportOptions extends Omit<ExportArgs, 'entry' | 'theme
365
35
executablePath ?: string
366
36
withToc ?: boolean
367
37
}
368
-
369
- export type BuiltinSlideTransition = 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'fade' | 'zoom' | 'none'
0 commit comments