@slidev/types 51.6.1 → 51.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,51 +1,54 @@
1
- import { ComputedRef, MaybeRefOrGetter, Component, App, Ref } from 'vue';
2
- import { Arrayable, Awaitable, ArgumentsType } from '@antfu/utils';
3
- import { CodeToHastOptions, HighlighterGeneric, CodeToHastOptionsCommon, BuiltinLanguage, CodeOptionsThemes, BuiltinTheme, CodeOptionsMeta, Highlighter, LanguageInput } from 'shiki';
4
- import { RouteMeta, RouteComponent, Router, RouteRecordRaw } from 'vue-router';
5
- import YAML from 'yaml';
6
- import { MarkdownItShikiOptions } from '@shikijs/markdown-it';
7
- import { KatexOptions } from 'katex';
8
- import { MermaidConfig } from 'mermaid';
9
- import * as monaco from 'monaco-editor';
10
- import { VitePluginConfig } from 'unocss/vite';
11
- import { Plugin } from 'vite';
12
- import MagicString from 'magic-string-stack';
13
- import Vue from '@vitejs/plugin-vue';
14
- import VueJsx from '@vitejs/plugin-vue-jsx';
15
- import Icons from 'unplugin-icons/vite';
16
- import Components from 'unplugin-vue-components/vite';
17
- import Markdown from 'unplugin-vue-markdown/vite';
18
- import { ViteInspectOptions } from 'vite-plugin-inspect';
19
- import RemoteAssets from 'vite-plugin-remote-assets';
20
- import { ViteStaticCopyOptions } from 'vite-plugin-static-copy';
21
- import ServerRef from 'vite-plugin-vue-server-ref';
1
+ import { App, Component, ComputedRef, MaybeRefOrGetter, Ref } from "vue";
2
+ import { ArgumentsType, Arrayable, Awaitable } from "@antfu/utils";
3
+ import { BuiltinLanguage, BuiltinTheme, CodeOptionsMeta, CodeOptionsThemes, CodeToHastOptions, CodeToHastOptionsCommon, Highlighter, HighlighterGeneric, LanguageInput } from "shiki";
4
+ import { RouteComponent, RouteMeta, RouteRecordRaw, Router } from "vue-router";
5
+ import YAML from "yaml";
6
+ import { MarkdownItShikiOptions } from "@shikijs/markdown-it";
7
+ import { KatexOptions } from "katex";
8
+ import { MermaidConfig } from "mermaid";
9
+ import * as monaco from "monaco-editor";
10
+ import { VitePluginConfig } from "unocss/vite";
11
+ import { Plugin } from "vite";
12
+ import MagicString from "magic-string-stack";
13
+ import Vue from "@vitejs/plugin-vue";
14
+ import VueJsx from "@vitejs/plugin-vue-jsx";
15
+ import Icons from "unplugin-icons/vite";
16
+ import Components from "unplugin-vue-components/vite";
17
+ import Markdown from "unplugin-vue-markdown/vite";
18
+ import { ViteInspectOptions } from "vite-plugin-inspect";
19
+ import RemoteAssets from "vite-plugin-remote-assets";
20
+ import { ViteStaticCopyOptions } from "vite-plugin-static-copy";
21
+ import ServerRef from "vite-plugin-vue-server-ref";
22
22
 
23
+ //#region src/cli.d.ts
23
24
  interface CommonArgs {
24
- entry: string;
25
- theme?: string;
25
+ entry: string;
26
+ theme?: string;
26
27
  }
27
28
  interface ExportArgs extends CommonArgs {
28
- 'output'?: string;
29
- 'format'?: string;
30
- 'timeout'?: number;
31
- 'wait'?: number;
32
- 'wait-until'?: string;
33
- 'range'?: string;
34
- 'dark'?: boolean;
35
- 'with-clicks'?: boolean;
36
- 'executable-path'?: string;
37
- 'with-toc'?: boolean;
38
- 'per-slide'?: boolean;
39
- 'scale'?: number;
40
- 'omit-background'?: boolean;
29
+ 'output'?: string;
30
+ 'format'?: string;
31
+ 'timeout'?: number;
32
+ 'wait'?: number;
33
+ 'wait-until'?: string;
34
+ 'range'?: string;
35
+ 'dark'?: boolean;
36
+ 'with-clicks'?: boolean;
37
+ 'executable-path'?: string;
38
+ 'with-toc'?: boolean;
39
+ 'per-slide'?: boolean;
40
+ 'scale'?: number;
41
+ 'omit-background'?: boolean;
41
42
  }
42
43
  interface BuildArgs extends ExportArgs {
43
- out: string;
44
- base?: string;
45
- download?: boolean;
46
- inspect: boolean;
44
+ out: string;
45
+ base?: string;
46
+ download?: boolean;
47
+ inspect: boolean;
47
48
  }
48
49
 
50
+ //#endregion
51
+ //#region src/clicks.d.ts
49
52
  type RawSingleAtValue = null | undefined | boolean | string | number;
50
53
  type RawRangeAtValue = null | undefined | false | [string | number, string | number];
51
54
  type RawAtValue = RawSingleAtValue | RawRangeAtValue;
@@ -54,98 +57,100 @@ type NormalizedRangeClickValue = [number, number] | [number, string] | [string,
54
57
  type NormalizedAtValue = NormalizedSingleClickValue | NormalizedRangeClickValue;
55
58
  type ClicksElement = Element | string;
56
59
  interface ClicksInfo {
57
- /**
58
- * The absolute start click num
59
- */
60
- start: number;
61
- /**
62
- * The absolute end click num
63
- */
64
- end: number;
65
- /**
66
- * The required total click num
67
- */
68
- max: number;
69
- /**
70
- * The delta for relative clicks
71
- */
72
- delta: number;
73
- /**
74
- * currentClicks - start
75
- */
76
- currentOffset: ComputedRef<number>;
77
- /**
78
- * currentOffset === 0
79
- */
80
- isCurrent: ComputedRef<boolean>;
81
- /**
82
- * Computed ref of whether the click is active
83
- */
84
- isActive: ComputedRef<boolean>;
60
+ /**
61
+ * The absolute start click num
62
+ */
63
+ start: number;
64
+ /**
65
+ * The absolute end click num
66
+ */
67
+ end: number;
68
+ /**
69
+ * The required total click num
70
+ */
71
+ max: number;
72
+ /**
73
+ * The delta for relative clicks
74
+ */
75
+ delta: number;
76
+ /**
77
+ * currentClicks - start
78
+ */
79
+ currentOffset: ComputedRef<number>;
80
+ /**
81
+ * currentOffset === 0
82
+ */
83
+ isCurrent: ComputedRef<boolean>;
84
+ /**
85
+ * Computed ref of whether the click is active
86
+ */
87
+ isActive: ComputedRef<boolean>;
85
88
  }
86
89
  interface ClicksContext {
87
- current: number;
88
- readonly clicksStart: number;
89
- readonly relativeSizeMap: Map<ClicksElement, number>;
90
- readonly maxMap: Map<ClicksElement, number>;
91
- calculateSince: (at: RawSingleAtValue, size?: number) => ClicksInfo | null;
92
- calculateRange: (at: RawRangeAtValue) => ClicksInfo | null;
93
- calculate: (at: RawAtValue) => ClicksInfo | null;
94
- register: (el: ClicksElement, info: Pick<ClicksInfo, 'delta' | 'max'> | null) => void;
95
- unregister: (el: ClicksElement) => void;
96
- readonly isMounted: boolean;
97
- setup: () => void;
98
- readonly currentOffset: number;
99
- readonly total: number;
90
+ current: number;
91
+ readonly clicksStart: number;
92
+ readonly relativeSizeMap: Map<ClicksElement, number>;
93
+ readonly maxMap: Map<ClicksElement, number>;
94
+ calculateSince: (at: RawSingleAtValue, size?: number) => ClicksInfo | null;
95
+ calculateRange: (at: RawRangeAtValue) => ClicksInfo | null;
96
+ calculate: (at: RawAtValue) => ClicksInfo | null;
97
+ register: (el: ClicksElement, info: Pick<ClicksInfo, 'delta' | 'max'> | null) => void;
98
+ unregister: (el: ClicksElement) => void;
99
+ readonly isMounted: boolean;
100
+ setup: () => void;
101
+ readonly currentOffset: number;
102
+ readonly total: number;
100
103
  }
101
104
 
105
+ //#endregion
106
+ //#region src/code-runner.d.ts
102
107
  interface CodeRunnerContext {
103
- /**
104
- * Options passed to runner via the `runnerOptions` prop.
105
- */
106
- options: Record<string, unknown>;
107
- /**
108
- * Highlight code with shiki.
109
- */
110
- highlight: (code: string, lang: string, options?: Partial<CodeToHastOptions>) => string;
111
- /**
112
- * Use (other) code runner to run code.
113
- */
114
- run: (code: string, lang: string) => Promise<CodeRunnerOutputs>;
108
+ /**
109
+ * Options passed to runner via the `runnerOptions` prop.
110
+ */
111
+ options: Record<string, unknown>;
112
+ /**
113
+ * Highlight code with shiki.
114
+ */
115
+ highlight: (code: string, lang: string, options?: Partial<CodeToHastOptions>) => string;
116
+ /**
117
+ * Use (other) code runner to run code.
118
+ */
119
+ run: (code: string, lang: string) => Promise<CodeRunnerOutputs>;
115
120
  }
116
121
  interface CodeRunnerOutputHtml {
117
- /**
118
- * The HTML to be rendered.
119
- *
120
- * Slidev does NOT sanitize the HTML for you - make sure it's from trusted sources or sanitize it before passing it in
121
- */
122
- html: string;
122
+ /**
123
+ * The HTML to be rendered.
124
+ *
125
+ * Slidev does NOT sanitize the HTML for you - make sure it's from trusted sources or sanitize it before passing it in
126
+ */
127
+ html: string;
123
128
  }
124
129
  interface CodeRunnerOutputDom {
125
- /**
126
- * The DOM element to be rendered.
127
- */
128
- element: HTMLElement;
130
+ /**
131
+ * The DOM element to be rendered.
132
+ */
133
+ element: HTMLElement;
129
134
  }
130
135
  interface CodeRunnerOutputError {
131
- /**
132
- * The error message to be displayed.
133
- */
134
- error: string;
136
+ /**
137
+ * The error message to be displayed.
138
+ */
139
+ error: string;
135
140
  }
136
141
  interface CodeRunnerOutputText {
137
- /**
138
- * The text to be displayed.
139
- */
140
- text: string;
141
- /**
142
- * The class to be applied to the text.
143
- */
144
- class?: string;
145
- /**
146
- * The language to be highlighted.
147
- */
148
- highlightLang?: string;
142
+ /**
143
+ * The text to be displayed.
144
+ */
145
+ text: string;
146
+ /**
147
+ * The class to be applied to the text.
148
+ */
149
+ class?: string;
150
+ /**
151
+ * The language to be highlighted.
152
+ */
153
+ highlightLang?: string;
149
154
  }
150
155
  type CodeRunnerOutputTextArray = CodeRunnerOutputText[];
151
156
  type CodeRunnerOutput = CodeRunnerOutputHtml | CodeRunnerOutputError | CodeRunnerOutputText | CodeRunnerOutputTextArray | CodeRunnerOutputDom;
@@ -153,797 +158,796 @@ type CodeRunnerOutputs = MaybeRefOrGetter<Arrayable<CodeRunnerOutput>>;
153
158
  type CodeRunner = (code: string, ctx: CodeRunnerContext) => Awaitable<CodeRunnerOutputs>;
154
159
  type CodeRunnerProviders = Record<string, CodeRunner>;
155
160
 
161
+ //#endregion
162
+ //#region src/builtin-layouts.d.ts
156
163
  type BuiltinLayouts = '404' | 'center' | 'cover' | 'default' | 'end' | 'error' | 'fact' | 'full' | 'iframe-left' | 'iframe-right' | 'iframe' | 'image-left' | 'image-right' | 'image' | 'intro' | 'none' | 'quote' | 'section' | 'statement' | 'two-cols-header' | 'two-cols';
157
164
 
165
+ //#endregion
166
+ //#region src/types.d.ts
158
167
  type FrontmatterStyle = 'frontmatter' | 'yaml';
159
168
  interface SlideInfoBase {
160
- revision: string;
161
- frontmatter: Record<string, any>;
162
- content: string;
163
- frontmatterRaw?: string;
164
- note?: string;
165
- title?: string;
166
- level?: number;
169
+ revision: string;
170
+ frontmatter: Record<string, any>;
171
+ content: string;
172
+ frontmatterRaw?: string;
173
+ note?: string;
174
+ title?: string;
175
+ level?: number;
167
176
  }
168
177
  interface SourceSlideInfo extends SlideInfoBase {
169
- /**
170
- * The filepath of the markdown file
171
- */
172
- filepath: string;
173
- /**
174
- * The index of the slide in the markdown file
175
- */
176
- index: number;
177
- /**
178
- * The range of the slide in the markdown file
179
- */
180
- start: number;
181
- contentStart: number;
182
- end: number;
183
- raw: string;
184
- /**
185
- * Raw content before being processed by preparsers (if any)
186
- */
187
- contentRaw: string;
188
- /**
189
- * Slides import by this slide.
190
- */
191
- imports?: SourceSlideInfo[];
192
- frontmatterDoc?: YAML.Document;
193
- frontmatterStyle?: FrontmatterStyle;
178
+ /**
179
+ * The filepath of the markdown file
180
+ */
181
+ filepath: string;
182
+ /**
183
+ * The index of the slide in the markdown file
184
+ */
185
+ index: number;
186
+ /**
187
+ * The range of the slide in the markdown file
188
+ */
189
+ start: number;
190
+ contentStart: number;
191
+ end: number;
192
+ raw: string;
193
+ /**
194
+ * Raw content before being processed by preparsers (if any)
195
+ */
196
+ contentRaw: string;
197
+ /**
198
+ * Slides import by this slide.
199
+ */
200
+ imports?: SourceSlideInfo[];
201
+ frontmatterDoc?: YAML.Document;
202
+ frontmatterStyle?: FrontmatterStyle;
194
203
  }
195
204
  interface SlideInfo extends SlideInfoBase {
196
- /**
197
- * The index of the slide in the presentation
198
- */
199
- index: number;
200
- /**
201
- * The importers of this slide. `[]` if this slide is the entry markdown file
202
- */
203
- importChain?: SourceSlideInfo[];
204
- /**
205
- * The source slide where the content is from
206
- */
207
- source: SourceSlideInfo;
208
- noteHTML?: string;
205
+ /**
206
+ * The index of the slide in the presentation
207
+ */
208
+ index: number;
209
+ /**
210
+ * The importers of this slide. `[]` if this slide is the entry markdown file
211
+ */
212
+ importChain?: SourceSlideInfo[];
213
+ /**
214
+ * The source slide where the content is from
215
+ */
216
+ source: SourceSlideInfo;
217
+ noteHTML?: string;
209
218
  }
210
219
  /**
211
220
  * Editable fields for a slide
212
221
  */
213
222
  type SlidePatch = Partial<Pick<SlideInfoBase, 'content' | 'note' | 'frontmatterRaw'>> & {
214
- skipHmr?: boolean;
215
- /**
216
- * The frontmatter patch (only the changed fields)
217
- * `null` to remove a field
218
- */
219
- frontmatter?: Record<string, any>;
223
+ skipHmr?: boolean;
224
+ /**
225
+ * The frontmatter patch (only the changed fields)
226
+ * `null` to remove a field
227
+ */
228
+ frontmatter?: Record<string, any>;
220
229
  };
221
230
  /**
222
231
  * Metadata for "slidev" field in themes' package.json
223
232
  */
224
233
  interface SlidevThemeMeta {
225
- defaults?: Partial<SlidevConfig>;
226
- colorSchema?: 'dark' | 'light' | 'both';
227
- highlighter?: 'shiki';
234
+ defaults?: Partial<SlidevConfig>;
235
+ colorSchema?: 'dark' | 'light' | 'both';
236
+ highlighter?: 'shiki';
228
237
  }
229
238
  type SlidevThemeConfig = Record<string, string | number>;
230
239
  interface SlidevDetectedFeatures {
231
- katex: boolean;
232
- /**
233
- * `false` or referenced module specifiers
234
- */
235
- monaco: false | {
236
- types: string[];
237
- deps: string[];
238
- };
239
- tweet: boolean;
240
- mermaid: boolean;
240
+ katex: boolean;
241
+ /**
242
+ * `false` or referenced module specifiers
243
+ */
244
+ monaco: false | {
245
+ types: string[];
246
+ deps: string[];
247
+ };
248
+ tweet: boolean;
249
+ mermaid: boolean;
241
250
  }
242
251
  interface SlidevMarkdown {
243
- filepath: string;
244
- raw: string;
245
- /**
246
- * All slides in this markdown file
247
- */
248
- slides: SourceSlideInfo[];
249
- errors?: {
250
- row: number;
251
- message: string;
252
- }[];
252
+ filepath: string;
253
+ raw: string;
254
+ /**
255
+ * All slides in this markdown file
256
+ */
257
+ slides: SourceSlideInfo[];
258
+ errors?: {
259
+ row: number;
260
+ message: string;
261
+ }[];
253
262
  }
254
263
  interface SlidevData {
255
- /**
256
- * Slides that should be rendered (disabled slides excluded)
257
- */
258
- slides: SlideInfo[];
259
- entry: SlidevMarkdown;
260
- config: SlidevConfig;
261
- headmatter: Record<string, unknown>;
262
- features: SlidevDetectedFeatures;
263
- themeMeta?: SlidevThemeMeta;
264
- markdownFiles: Record<string, SlidevMarkdown>;
265
- /**
266
- * From watched files to indexes of slides that must be reloaded regardless of the loaded content
267
- */
268
- watchFiles: Record<string, Set<number>>;
264
+ /**
265
+ * Slides that should be rendered (disabled slides excluded)
266
+ */
267
+ slides: SlideInfo[];
268
+ entry: SlidevMarkdown;
269
+ config: SlidevConfig;
270
+ headmatter: Record<string, unknown>;
271
+ features: SlidevDetectedFeatures;
272
+ themeMeta?: SlidevThemeMeta;
273
+ markdownFiles: Record<string, SlidevMarkdown>;
274
+ /**
275
+ * From watched files to indexes of slides that must be reloaded regardless of the loaded content
276
+ */
277
+ watchFiles: Record<string, Set<number>>;
269
278
  }
270
279
  interface SlidevPreparserExtension {
271
- name?: string;
272
- transformRawLines?: (lines: string[]) => Promise<void> | void;
273
- transformSlide?: (content: string, frontmatter: any) => Promise<string | undefined>;
274
- transformNote?: (note: string | undefined, frontmatter: any) => Promise<string | undefined>;
280
+ name?: string;
281
+ transformRawLines?: (lines: string[]) => Promise<void> | void;
282
+ transformSlide?: (content: string, frontmatter: any) => Promise<string | undefined>;
283
+ transformNote?: (note: string | undefined, frontmatter: any) => Promise<string | undefined>;
275
284
  }
276
285
  type PreparserExtensionLoader = (headmatter: Record<string, unknown>, filepath: string, mode?: string) => Promise<SlidevPreparserExtension[]>;
277
286
  type RenderContext = 'none' | 'slide' | 'overview' | 'presenter' | 'previewNext';
278
287
  interface SlideRoute {
279
- no: number;
280
- meta: RouteMeta & Required<Pick<RouteMeta, 'slide'>>;
281
- /**
282
- * load the slide component itself
283
- */
284
- load: () => Promise<{
285
- default: RouteComponent;
286
- }>;
287
- /**
288
- * Wrapped async component
289
- */
290
- component: Component;
288
+ no: number;
289
+ meta: RouteMeta & Required<Pick<RouteMeta, 'slide'>>;
290
+ /**
291
+ * load the slide component itself
292
+ */
293
+ load: () => Promise<{
294
+ default: RouteComponent;
295
+ }>;
296
+ /**
297
+ * Wrapped async component
298
+ */
299
+ component: Component;
291
300
  }
292
301
 
302
+ //#endregion
303
+ //#region src/frontmatter.d.ts
293
304
  interface Headmatter extends HeadmatterConfig, Omit<Frontmatter, 'title'> {
294
- /**
295
- * Default frontmatter options applied to all slides
296
- */
297
- defaults?: Frontmatter;
305
+ /**
306
+ * Default frontmatter options applied to all slides
307
+ */
308
+ defaults?: Frontmatter;
298
309
  }
299
310
  interface HeadmatterConfig extends TransitionOptions {
300
- /**
301
- * Title of the slides
302
- */
303
- title?: string;
304
- /**
305
- * String template to compose title
306
- *
307
- * @example "%s - Slidev" - to suffix " - Slidev" to all pages
308
- * @default '%s - Slidev'
309
- */
310
- titleTemplate?: string;
311
- /**
312
- * Theme to use for the slides
313
- *
314
- * See https://sli.dev/guide/theme-addon#use-theme
315
- * @default 'default'
316
- */
317
- theme?: string;
318
- /**
319
- * List of Slidev addons
320
- *
321
- * @default []
322
- */
323
- addons?: string[];
324
- /**
325
- * Download remote assets in local using vite-plugin-remote-assets
326
- *
327
- * @default false
328
- */
329
- remoteAssets?: boolean | 'dev' | 'build';
330
- /**
331
- * Show a download button in the SPA build,
332
- * could also be a link to custom pdf
333
- *
334
- * @default false
335
- */
336
- download?: boolean | string;
337
- /**
338
- * Show a copy button in code blocks
339
- *
340
- * @default true
341
- */
342
- codeCopy?: boolean;
343
- /**
344
- * The author of the slides
345
- */
346
- author?: string;
347
- /**
348
- * Information shows on the built SPA
349
- * Can be a markdown string
350
- *
351
- * @default false
352
- */
353
- info?: string | boolean;
354
- /**
355
- * Prefer highlighter
356
- *
357
- * See https://sli.dev/custom/config-highlighter.html
358
- * @default shiki
359
- */
360
- highlighter?: 'shiki';
361
- /**
362
- * Enable Twoslash
363
- *
364
- * @default true
365
- */
366
- twoslash?: boolean | 'dev' | 'build';
367
- /**
368
- * Show line numbers in code blocks
369
- *
370
- * @default false
371
- */
372
- lineNumbers?: boolean;
373
- /**
374
- * Force slides color schema
375
- *
376
- * @default 'auto'
377
- */
378
- colorSchema?: 'dark' | 'light' | 'all' | 'auto';
379
- /**
380
- * Router mode for vue-router
381
- *
382
- * @default 'history'
383
- */
384
- routerMode?: 'hash' | 'history';
385
- /**
386
- * Aspect ratio for slides
387
- * should be like `16/9` or `1:1`
388
- *
389
- * @default '16/9'
390
- */
391
- aspectRatio?: number | string;
392
- /**
393
- * The actual width for slides canvas.
394
- * unit in px.
395
- *
396
- * @default '980'
397
- */
398
- canvasWidth?: number;
399
- /**
400
- * Controls whether texts in slides are selectable
401
- *
402
- * @default true
403
- */
404
- selectable?: boolean;
405
- /**
406
- * Configure for themes, will inject intro root styles as
407
- * `--slidev-theme-x` for attribute `x`
408
- *
409
- * This allows themes to have customization options in frontmatter
410
- * Refer to themes' document for options avaliable
411
- *
412
- * @default {}
413
- */
414
- themeConfig?: SlidevThemeConfig;
415
- /**
416
- * Configure fonts for the slides and app
417
- *
418
- * @default {}
419
- */
420
- fonts?: FontOptions;
421
- /**
422
- * Configure the icon for app
423
- *
424
- * @default 'https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png'
425
- */
426
- favicon?: string;
427
- /**
428
- * Options for drawings
429
- *
430
- * @default {}
431
- */
432
- drawings?: DrawingsOptions;
433
- /**
434
- * URL of PlantUML server used to render diagrams
435
- *
436
- * @default https://www.plantuml.com/plantuml
437
- */
438
- plantUmlServer?: string;
439
- /**
440
- * Enable slides recording
441
- *
442
- * @default 'dev'
443
- */
444
- record?: boolean | 'dev' | 'build';
445
- /**
446
- * Expose the server to inbound requests (listen to `0.0.0.0`)
447
- *
448
- * Pass a string to set the password for accessing presenter mode.
449
- *
450
- * @default false
451
- */
452
- remote?: string | boolean;
453
- /**
454
- * Engine for Atomic CSS
455
- *
456
- * See https://unocss.dev/
457
- * @deprecated
458
- * @default 'unocss'
459
- */
460
- css?: 'unocss';
461
- /**
462
- * Enable presenter mode
463
- *
464
- * @default true
465
- */
466
- presenter?: boolean | 'dev' | 'build';
467
- /**
468
- * Enable browser exporter
469
- *
470
- * @default 'dev'
471
- */
472
- browserExporter?: boolean | 'dev' | 'build';
473
- /**
474
- * Attributes to apply to the HTML element
475
- *
476
- * @default {}
477
- */
478
- htmlAttrs?: Record<string, string>;
479
- /**
480
- * Suppport MDC syntax
481
- *
482
- * See https://github.com/antfu/markdown-it-mdc
483
- *
484
- * See https://content.nuxtjs.org/guide/writing/mdc
485
- *
486
- * @default false
487
- */
488
- mdc?: boolean;
489
- /**
490
- * Enable built-in editor
491
- *
492
- * @default true
493
- */
494
- editor?: boolean;
495
- /**
496
- * Enable context menu
497
- *
498
- * @default true
499
- */
500
- contextMenu?: boolean | 'dev' | 'build' | null;
501
- /**
502
- * Enable wake lock
503
- */
504
- wakeLock?: boolean | 'dev' | 'build';
505
- /**
506
- * Force the filename used when exporting the presentation.
507
- * The extension, e.g. .pdf, gets automatically added.
508
- *
509
- * @default ''
510
- */
511
- exportFilename?: string | null;
512
- /**
513
- * Enable Monaco
514
- *
515
- * See https://sli.dev/custom/config-monaco.html
516
- * @default true
517
- */
518
- monaco?: boolean | 'dev' | 'build';
519
- /**
520
- * Where to load monaco types from
521
- *
522
- * - `cdn` - load from CDN with `@typescript/ata`
523
- * - `local` - load from local node_modules
524
- *
525
- * @default 'local'
526
- */
527
- monacoTypesSource?: 'cdn' | 'local' | 'none';
528
- /**
529
- * Additional node packages to load as monaco types
530
- *
531
- * @default []
532
- */
533
- monacoTypesAdditionalPackages?: string[];
534
- /**
535
- * Packages to ignore when loading monaco types
536
- *
537
- * @default []
538
- */
539
- monacoTypesIgnorePackages?: string[];
540
- /**
541
- * Additional local modules to load as dependencies of monaco runnable
542
- *
543
- * @default []
544
- */
545
- monacoRunAdditionalDeps?: string[];
546
- /**
547
- * Seo meta tags settings
548
- *
549
- * @default {}
550
- */
551
- seoMeta?: SeoMeta;
311
+ /**
312
+ * Title of the slides
313
+ */
314
+ title?: string;
315
+ /**
316
+ * String template to compose title
317
+ *
318
+ * @example "%s - Slidev" - to suffix " - Slidev" to all pages
319
+ * @default '%s - Slidev'
320
+ */
321
+ titleTemplate?: string;
322
+ /**
323
+ * Theme to use for the slides
324
+ *
325
+ * See https://sli.dev/guide/theme-addon#use-theme
326
+ * @default 'default'
327
+ */
328
+ theme?: string;
329
+ /**
330
+ * List of Slidev addons
331
+ *
332
+ * @default []
333
+ */
334
+ addons?: string[];
335
+ /**
336
+ * Download remote assets in local using vite-plugin-remote-assets
337
+ *
338
+ * @default false
339
+ */
340
+ remoteAssets?: boolean | 'dev' | 'build';
341
+ /**
342
+ * Show a download button in the SPA build,
343
+ * could also be a link to custom pdf
344
+ *
345
+ * @default false
346
+ */
347
+ download?: boolean | string;
348
+ /**
349
+ * Show a copy button in code blocks
350
+ *
351
+ * @default true
352
+ */
353
+ codeCopy?: boolean;
354
+ /**
355
+ * The author of the slides
356
+ */
357
+ author?: string;
358
+ /**
359
+ * Information shows on the built SPA
360
+ * Can be a markdown string
361
+ *
362
+ * @default false
363
+ */
364
+ info?: string | boolean;
365
+ /**
366
+ * Prefer highlighter
367
+ *
368
+ * See https://sli.dev/custom/config-highlighter.html
369
+ * @default shiki
370
+ */
371
+ highlighter?: 'shiki';
372
+ /**
373
+ * Enable Twoslash
374
+ *
375
+ * @default true
376
+ */
377
+ twoslash?: boolean | 'dev' | 'build';
378
+ /**
379
+ * Show line numbers in code blocks
380
+ *
381
+ * @default false
382
+ */
383
+ lineNumbers?: boolean;
384
+ /**
385
+ * Force slides color schema
386
+ *
387
+ * @default 'auto'
388
+ */
389
+ colorSchema?: 'dark' | 'light' | 'all' | 'auto';
390
+ /**
391
+ * Router mode for vue-router
392
+ *
393
+ * @default 'history'
394
+ */
395
+ routerMode?: 'hash' | 'history';
396
+ /**
397
+ * Aspect ratio for slides
398
+ * should be like `16/9` or `1:1`
399
+ *
400
+ * @default '16/9'
401
+ */
402
+ aspectRatio?: number | string;
403
+ /**
404
+ * The actual width for slides canvas.
405
+ * unit in px.
406
+ *
407
+ * @default '980'
408
+ */
409
+ canvasWidth?: number;
410
+ /**
411
+ * Controls whether texts in slides are selectable
412
+ *
413
+ * @default true
414
+ */
415
+ selectable?: boolean;
416
+ /**
417
+ * Configure for themes, will inject intro root styles as
418
+ * `--slidev-theme-x` for attribute `x`
419
+ *
420
+ * This allows themes to have customization options in frontmatter
421
+ * Refer to themes' document for options avaliable
422
+ *
423
+ * @default {}
424
+ */
425
+ themeConfig?: SlidevThemeConfig;
426
+ /**
427
+ * Configure fonts for the slides and app
428
+ *
429
+ * @default {}
430
+ */
431
+ fonts?: FontOptions;
432
+ /**
433
+ * Configure the icon for app
434
+ *
435
+ * @default 'https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png'
436
+ */
437
+ favicon?: string;
438
+ /**
439
+ * Options for drawings
440
+ *
441
+ * @default {}
442
+ */
443
+ drawings?: DrawingsOptions;
444
+ /**
445
+ * URL of PlantUML server used to render diagrams
446
+ *
447
+ * @default https://www.plantuml.com/plantuml
448
+ */
449
+ plantUmlServer?: string;
450
+ /**
451
+ * Enable slides recording
452
+ *
453
+ * @default 'dev'
454
+ */
455
+ record?: boolean | 'dev' | 'build';
456
+ /**
457
+ * Expose the server to inbound requests (listen to `0.0.0.0`)
458
+ *
459
+ * Pass a string to set the password for accessing presenter mode.
460
+ *
461
+ * @default false
462
+ */
463
+ remote?: string | boolean;
464
+ /**
465
+ * Engine for Atomic CSS
466
+ *
467
+ * See https://unocss.dev/
468
+ * @deprecated
469
+ * @default 'unocss'
470
+ */
471
+ css?: 'unocss';
472
+ /**
473
+ * Enable presenter mode
474
+ *
475
+ * @default true
476
+ */
477
+ presenter?: boolean | 'dev' | 'build';
478
+ /**
479
+ * Enable browser exporter
480
+ *
481
+ * @default 'dev'
482
+ */
483
+ browserExporter?: boolean | 'dev' | 'build';
484
+ /**
485
+ * Attributes to apply to the HTML element
486
+ *
487
+ * @default {}
488
+ */
489
+ htmlAttrs?: Record<string, string>;
490
+ /**
491
+ * Suppport MDC syntax
492
+ *
493
+ * See https://github.com/antfu/markdown-it-mdc
494
+ *
495
+ * See https://content.nuxtjs.org/guide/writing/mdc
496
+ *
497
+ * @default false
498
+ */
499
+ mdc?: boolean;
500
+ /**
501
+ * Enable built-in editor
502
+ *
503
+ * @default true
504
+ */
505
+ editor?: boolean;
506
+ /**
507
+ * Enable context menu
508
+ *
509
+ * @default true
510
+ */
511
+ contextMenu?: boolean | 'dev' | 'build' | null;
512
+ /**
513
+ * Enable wake lock
514
+ */
515
+ wakeLock?: boolean | 'dev' | 'build';
516
+ /**
517
+ * Force the filename used when exporting the presentation.
518
+ * The extension, e.g. .pdf, gets automatically added.
519
+ *
520
+ * @default ''
521
+ */
522
+ exportFilename?: string | null;
523
+ /**
524
+ * Enable Monaco
525
+ *
526
+ * See https://sli.dev/custom/config-monaco.html
527
+ * @default true
528
+ */
529
+ monaco?: boolean | 'dev' | 'build';
530
+ /**
531
+ * Where to load monaco types from
532
+ *
533
+ * - `cdn` - load from CDN with `@typescript/ata`
534
+ * - `local` - load from local node_modules
535
+ *
536
+ * @default 'local'
537
+ */
538
+ monacoTypesSource?: 'cdn' | 'local' | 'none';
539
+ /**
540
+ * Additional node packages to load as monaco types
541
+ *
542
+ * @default []
543
+ */
544
+ monacoTypesAdditionalPackages?: string[];
545
+ /**
546
+ * Packages to ignore when loading monaco types
547
+ *
548
+ * @default []
549
+ */
550
+ monacoTypesIgnorePackages?: string[];
551
+ /**
552
+ * Additional local modules to load as dependencies of monaco runnable
553
+ *
554
+ * @default []
555
+ */
556
+ monacoRunAdditionalDeps?: string[];
557
+ /**
558
+ * Seo meta tags settings
559
+ *
560
+ * @default {}
561
+ */
562
+ seoMeta?: SeoMeta;
552
563
  }
553
564
  interface Frontmatter extends TransitionOptions {
554
- /**
555
- * Slide layout to use
556
- *
557
- * Default to 'cover' for the first slide, 'default' for the rest
558
- */
559
- layout?: BuiltinLayouts | string;
560
- /**
561
- * Custom class added to the slide root element
562
- */
563
- class?: string | string[] | Record<string, unknown>;
564
- /**
565
- * Manually specified the total clicks needed to this slide
566
- *
567
- * When not specified, the clicks will be calculated by the usage of v-clicks
568
- *
569
- * See https://sli.dev/guide/animations
570
- */
571
- clicks?: number;
572
- /**
573
- * Manually specified the total clicks needed to this slide to start
574
- *
575
- * @default 0
576
- */
577
- clicksStart?: number;
578
- /**
579
- * Preload the slide when the previous slide is active
580
- * @default true
581
- */
582
- preload?: boolean;
583
- /**
584
- * Completely hide and disable the slide
585
- */
586
- hide?: boolean;
587
- /**
588
- * Same as `hide`, completely hide and disable the slide
589
- */
590
- disabled?: boolean;
591
- /**
592
- * Hide the slide for the `<Toc>` components
593
- *
594
- * See https://sli.dev/builtin/components#toc
595
- */
596
- hideInToc?: boolean;
597
- /**
598
- * Override the title for the `<TitleRenderer>` and `<Toc>` components
599
- * Only if `title` has also been declared
600
- */
601
- title?: string;
602
- /**
603
- * Override the title level for the `<TitleRenderer>` and `<Toc>` components
604
- * Only if `title` has also been declared
605
- */
606
- level?: number;
607
- /**
608
- * Create a route alias that can be used in the URL or with the `<Link>` component
609
- */
610
- routeAlias?: string;
611
- /**
612
- * Custom zoom level for the slide
613
- * @default 1
614
- */
615
- zoom?: number;
616
- /**
617
- * Store the positions of draggable elements
618
- * Normally you don't need to set this manually
619
- *
620
- * See https://sli.dev/features/draggable
621
- */
622
- dragPos?: Record<string, string>;
623
- /**
624
- * Includes a markdown file
625
- *
626
- * See https://sli.dev/guide/syntax.html#importing-slides
627
- */
628
- src?: string;
565
+ /**
566
+ * Slide layout to use
567
+ *
568
+ * Default to 'cover' for the first slide, 'default' for the rest
569
+ */
570
+ layout?: BuiltinLayouts | string;
571
+ /**
572
+ * Custom class added to the slide root element
573
+ */
574
+ class?: string | string[] | Record<string, unknown>;
575
+ /**
576
+ * Manually specified the total clicks needed to this slide
577
+ *
578
+ * When not specified, the clicks will be calculated by the usage of v-clicks
579
+ *
580
+ * See https://sli.dev/guide/animations
581
+ */
582
+ clicks?: number;
583
+ /**
584
+ * Manually specified the total clicks needed to this slide to start
585
+ *
586
+ * @default 0
587
+ */
588
+ clicksStart?: number;
589
+ /**
590
+ * Preload the slide when the previous slide is active
591
+ * @default true
592
+ */
593
+ preload?: boolean;
594
+ /**
595
+ * Completely hide and disable the slide
596
+ */
597
+ hide?: boolean;
598
+ /**
599
+ * Same as `hide`, completely hide and disable the slide
600
+ */
601
+ disabled?: boolean;
602
+ /**
603
+ * Hide the slide for the `<Toc>` components
604
+ *
605
+ * See https://sli.dev/builtin/components#toc
606
+ */
607
+ hideInToc?: boolean;
608
+ /**
609
+ * Override the title for the `<TitleRenderer>` and `<Toc>` components
610
+ * Only if `title` has also been declared
611
+ */
612
+ title?: string;
613
+ /**
614
+ * Override the title level for the `<TitleRenderer>` and `<Toc>` components
615
+ * Only if `title` has also been declared
616
+ */
617
+ level?: number;
618
+ /**
619
+ * Create a route alias that can be used in the URL or with the `<Link>` component
620
+ */
621
+ routeAlias?: string;
622
+ /**
623
+ * Custom zoom level for the slide
624
+ * @default 1
625
+ */
626
+ zoom?: number;
627
+ /**
628
+ * Store the positions of draggable elements
629
+ * Normally you don't need to set this manually
630
+ *
631
+ * See https://sli.dev/features/draggable
632
+ */
633
+ dragPos?: Record<string, string>;
634
+ /**
635
+ * Includes a markdown file
636
+ *
637
+ * See https://sli.dev/guide/syntax.html#importing-slides
638
+ */
639
+ src?: string;
629
640
  }
630
641
  interface DrawingsOptions {
631
- /**
632
- * Persist the drawings to disk
633
- * Passing string to specify the directory (default to `.slidev/drawings`)
634
- *
635
- * @default false
636
- */
637
- persist?: boolean | string;
638
- /**
639
- * @default true
640
- */
641
- enabled?: boolean | 'dev' | 'build';
642
- /**
643
- * Only allow drawing from presenter mode
644
- *
645
- * @default false
646
- */
647
- presenterOnly?: boolean;
648
- /**
649
- * Sync drawing for all instances
650
- *
651
- * @default true
652
- */
653
- syncAll?: boolean;
642
+ /**
643
+ * Persist the drawings to disk
644
+ * Passing string to specify the directory (default to `.slidev/drawings`)
645
+ *
646
+ * @default false
647
+ */
648
+ persist?: boolean | string;
649
+ /**
650
+ * @default true
651
+ */
652
+ enabled?: boolean | 'dev' | 'build';
653
+ /**
654
+ * Only allow drawing from presenter mode
655
+ *
656
+ * @default false
657
+ */
658
+ presenterOnly?: boolean;
659
+ /**
660
+ * Sync drawing for all instances
661
+ *
662
+ * @default true
663
+ */
664
+ syncAll?: boolean;
654
665
  }
655
666
  interface FontOptions {
656
- /**
657
- * Sans serif fonts (default fonts for most text)
658
- */
659
- sans?: string | string[];
660
- /**
661
- * Serif fonts
662
- */
663
- serif?: string | string[];
664
- /**
665
- * Monospace fonts, for code blocks and etc.
666
- */
667
- mono?: string | string[];
668
- /**
669
- * Load webfonts for custom CSS (does not apply anywhere by default)
670
- */
671
- custom?: string | string[];
672
- /**
673
- * Weights for fonts
674
- *
675
- * @default [200, 400, 600]
676
- */
677
- weights?: string | (string | number)[];
678
- /**
679
- * Import italic fonts
680
- *
681
- * @default false
682
- */
683
- italic?: boolean;
684
- /**
685
- * @default 'google'
686
- */
687
- provider?: 'none' | 'google' | 'coollabs';
688
- /**
689
- * Specify web fonts names, will detect from `sans`, `mono`, `serif` if not provided
690
- */
691
- webfonts?: string[];
692
- /**
693
- * Specify local fonts names, be excluded from webfonts
694
- */
695
- local?: string[];
696
- /**
697
- * Use fonts fallback
698
- *
699
- * @default true
700
- */
701
- fallbacks?: boolean;
667
+ /**
668
+ * Sans serif fonts (default fonts for most text)
669
+ */
670
+ sans?: string | string[];
671
+ /**
672
+ * Serif fonts
673
+ */
674
+ serif?: string | string[];
675
+ /**
676
+ * Monospace fonts, for code blocks and etc.
677
+ */
678
+ mono?: string | string[];
679
+ /**
680
+ * Load webfonts for custom CSS (does not apply anywhere by default)
681
+ */
682
+ custom?: string | string[];
683
+ /**
684
+ * Weights for fonts
685
+ *
686
+ * @default [200, 400, 600]
687
+ */
688
+ weights?: string | (string | number)[];
689
+ /**
690
+ * Import italic fonts
691
+ *
692
+ * @default false
693
+ */
694
+ italic?: boolean;
695
+ /**
696
+ * @default 'google'
697
+ */
698
+ provider?: 'none' | 'google' | 'coollabs';
699
+ /**
700
+ * Specify web fonts names, will detect from `sans`, `mono`, `serif` if not provided
701
+ */
702
+ webfonts?: string[];
703
+ /**
704
+ * Specify local fonts names, be excluded from webfonts
705
+ */
706
+ local?: string[];
707
+ /**
708
+ * Use fonts fallback
709
+ *
710
+ * @default true
711
+ */
712
+ fallbacks?: boolean;
702
713
  }
703
714
  type BuiltinSlideTransition = 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'fade' | 'zoom' | 'none';
704
715
  interface TransitionOptions {
705
- /**
706
- * Page transition, powered by Vue's `<TransitionGroup/>`
707
- *
708
- * Built-in transitions:
709
- * - fade
710
- * - fade-out
711
- * - slide-left
712
- * - slide-right
713
- * - slide-up
714
- * - slide-down
715
- *
716
- * See https://sli.dev/guide/animations.html#pages-transitions
717
- *
718
- * See https://vuejs.org/guide/built-ins/transition.html
719
- */
720
- transition?: BuiltinSlideTransition | string | TransitionGroupProps | null;
716
+ /**
717
+ * Page transition, powered by Vue's `<TransitionGroup/>`
718
+ *
719
+ * Built-in transitions:
720
+ * - fade
721
+ * - fade-out
722
+ * - slide-left
723
+ * - slide-right
724
+ * - slide-up
725
+ * - slide-down
726
+ *
727
+ * See https://sli.dev/guide/animations.html#pages-transitions
728
+ *
729
+ * See https://vuejs.org/guide/built-ins/transition.html
730
+ */
731
+ transition?: BuiltinSlideTransition | string | TransitionGroupProps | null;
721
732
  }
722
733
  interface TransitionGroupProps {
723
- appear?: boolean;
724
- persisted?: boolean;
725
- tag?: string;
726
- moveClass?: string;
727
- css?: boolean;
728
- duration?: number | {
729
- enter: number;
730
- leave: number;
731
- };
732
- enterFromClass?: string;
733
- enterActiveClass?: string;
734
- enterToClass?: string;
735
- appearFromClass?: string;
736
- appearActiveClass?: string;
737
- appearToClass?: string;
738
- leaveFromClass?: string;
739
- leaveActiveClass?: string;
740
- leaveToClass?: string;
734
+ appear?: boolean;
735
+ persisted?: boolean;
736
+ tag?: string;
737
+ moveClass?: string;
738
+ css?: boolean;
739
+ duration?: number | {
740
+ enter: number;
741
+ leave: number;
742
+ };
743
+ enterFromClass?: string;
744
+ enterActiveClass?: string;
745
+ enterToClass?: string;
746
+ appearFromClass?: string;
747
+ appearActiveClass?: string;
748
+ appearToClass?: string;
749
+ leaveFromClass?: string;
750
+ leaveActiveClass?: string;
751
+ leaveToClass?: string;
741
752
  }
742
753
  /**
743
754
  * The following type should map to unhead MataFlat type
744
755
  */
745
756
  interface SeoMeta {
746
- ogTitle?: string;
747
- ogDescription?: string;
748
- ogImage?: string;
749
- ogUrl?: string;
750
- twitterCard?: 'summary' | 'summary_large_image' | 'app' | 'player';
751
- twitterSite?: string;
752
- twitterTitle?: string;
753
- twitterDescription?: string;
754
- twitterImage?: string;
755
- twitterUrl?: string;
756
- }
757
-
757
+ ogTitle?: string;
758
+ ogDescription?: string;
759
+ ogImage?: string;
760
+ ogUrl?: string;
761
+ twitterCard?: 'summary' | 'summary_large_image' | 'app' | 'player';
762
+ twitterSite?: string;
763
+ twitterTitle?: string;
764
+ twitterDescription?: string;
765
+ twitterImage?: string;
766
+ twitterUrl?: string;
767
+ } //#endregion
768
+ //#region src/config.d.ts
758
769
  interface ResolvedSlidevConfigSub {
759
- export: ResolvedExportOptions;
760
- drawings: ResolvedDrawingsOptions;
761
- fonts: ResolvedFontOptions;
762
- aspectRatio: number;
763
- }
764
- interface SlidevConfig extends Omit<Required<HeadmatterConfig>, keyof ResolvedSlidevConfigSub>, ResolvedSlidevConfigSub {
770
+ export: ResolvedExportOptions;
771
+ drawings: ResolvedDrawingsOptions;
772
+ fonts: ResolvedFontOptions;
773
+ aspectRatio: number;
765
774
  }
775
+ interface SlidevConfig extends Omit<Required<HeadmatterConfig>, keyof ResolvedSlidevConfigSub>, ResolvedSlidevConfigSub {}
766
776
  interface ResolvedFontOptions {
767
- sans: string[];
768
- mono: string[];
769
- serif: string[];
770
- weights: string[];
771
- italic: boolean;
772
- provider: 'none' | 'google' | 'coollabs';
773
- webfonts: string[];
774
- local: string[];
777
+ sans: string[];
778
+ mono: string[];
779
+ serif: string[];
780
+ weights: string[];
781
+ italic: boolean;
782
+ provider: 'none' | 'google' | 'coollabs';
783
+ webfonts: string[];
784
+ local: string[];
775
785
  }
776
786
  interface ResolvedDrawingsOptions {
777
- persist: string | false;
778
- enabled: boolean | 'dev' | 'build';
779
- presenterOnly: boolean;
780
- syncAll: boolean;
787
+ persist: string | false;
788
+ enabled: boolean | 'dev' | 'build';
789
+ presenterOnly: boolean;
790
+ syncAll: boolean;
781
791
  }
782
792
  interface ResolvedExportOptions extends Omit<ExportArgs, 'entry' | 'theme'> {
783
- withClicks?: boolean;
784
- executablePath?: string;
785
- withToc?: boolean;
793
+ withClicks?: boolean;
794
+ executablePath?: string;
795
+ withToc?: boolean;
786
796
  }
787
797
 
798
+ //#endregion
799
+ //#region src/context-menu.d.ts
788
800
  type ContextMenuOption = {
789
- action: () => void;
790
- disabled?: boolean;
801
+ action: () => void;
802
+ disabled?: boolean;
791
803
  } & ({
792
- small?: false;
793
- icon?: Component | string;
794
- label: string | Component;
804
+ small?: false;
805
+ icon?: Component | string;
806
+ label: string | Component;
795
807
  } | {
796
- small: true;
797
- icon: Component | string;
798
- label: string;
808
+ small: true;
809
+ icon: Component | string;
810
+ label: string;
799
811
  });
800
812
  type ContextMenuItem = ContextMenuOption | 'separator';
801
813
 
802
- declare module 'vite' {
803
- interface CustomEventMap {
804
- 'slidev:update-slide': {
805
- no: number;
806
- data: SlideInfo;
807
- };
808
- 'slidev:update-note': {
809
- no: number;
810
- note: string;
811
- noteHTML: string;
812
- };
813
- }
814
- }
815
-
814
+ //#endregion
815
+ //#region src/options.d.ts
816
816
  interface RootsInfo {
817
- cliRoot: string;
818
- clientRoot: string;
819
- userRoot: string;
820
- userPkgJson: Record<string, any>;
821
- userWorkspaceRoot: string;
817
+ cliRoot: string;
818
+ clientRoot: string;
819
+ userRoot: string;
820
+ userPkgJson: Record<string, any>;
821
+ userWorkspaceRoot: string;
822
822
  }
823
823
  interface SlidevEntryOptions {
824
- /**
825
- * Markdown entry
826
- */
827
- entry: string;
828
- /**
829
- * Theme id
830
- */
831
- theme?: string;
832
- /**
833
- * Remote password
834
- */
835
- remote?: string;
836
- /**
837
- * Enable inspect plugin
838
- */
839
- inspect?: boolean;
840
- /**
841
- * Build with --download option
842
- */
843
- download?: boolean;
844
- /**
845
- * Base URL in dev or build mode
846
- */
847
- base?: string;
824
+ /**
825
+ * Markdown entry
826
+ */
827
+ entry: string;
828
+ /**
829
+ * Theme id
830
+ */
831
+ theme?: string;
832
+ /**
833
+ * Remote password
834
+ */
835
+ remote?: string;
836
+ /**
837
+ * Enable inspect plugin
838
+ */
839
+ inspect?: boolean;
840
+ /**
841
+ * Build with --download option
842
+ */
843
+ download?: boolean;
844
+ /**
845
+ * Base URL in dev or build mode
846
+ */
847
+ base?: string;
848
848
  }
849
849
  interface ResolvedSlidevOptions extends RootsInfo, SlidevEntryOptions {
850
- data: SlidevData;
851
- themeRaw: string;
852
- themeRoots: string[];
853
- addonRoots: string[];
854
- /**
855
- * =`[...themeRoots, ...addonRoots, userRoot]` (`clientRoot` excluded)
856
- */
857
- roots: string[];
858
- mode: 'dev' | 'build' | 'export';
859
- utils: ResolvedSlidevUtils;
850
+ data: SlidevData;
851
+ themeRaw: string;
852
+ themeRoots: string[];
853
+ addonRoots: string[];
854
+ /**
855
+ * =`[...themeRoots, ...addonRoots, userRoot]` (`clientRoot` excluded)
856
+ */
857
+ roots: string[];
858
+ mode: 'dev' | 'build' | 'export';
859
+ utils: ResolvedSlidevUtils;
860
860
  }
861
861
  interface ResolvedSlidevUtils {
862
- shiki: HighlighterGeneric<any, any>;
863
- shikiOptions: MarkdownItShikiOptions;
864
- katexOptions: KatexOptions | null;
865
- indexHtml: string;
866
- define: Record<string, string>;
867
- iconsResolvePath: string[];
868
- isMonacoTypesIgnored: (pkg: string) => boolean;
869
- getLayouts: () => Record<string, string>;
862
+ shiki: HighlighterGeneric<any, any>;
863
+ shikiOptions: MarkdownItShikiOptions;
864
+ katexOptions: KatexOptions | null;
865
+ indexHtml: string;
866
+ define: Record<string, string>;
867
+ iconsResolvePath: string[];
868
+ isMonacoTypesIgnored: (pkg: string) => boolean;
869
+ getLayouts: () => Record<string, string>;
870
870
  }
871
871
  interface SlidevServerOptions {
872
- /**
873
- * @returns `false` if server should be restarted
874
- */
875
- loadData?: (loadedSource: Record<string, string>) => Promise<SlidevData | false>;
872
+ /**
873
+ * @returns `false` if server should be restarted
874
+ */
875
+ loadData?: (loadedSource: Record<string, string>) => Promise<SlidevData | false>;
876
876
  }
877
877
 
878
+ //#endregion
879
+ //#region src/transform.d.ts
878
880
  interface MarkdownTransformContext {
879
- /**
880
- * The magic string instance for the current markdown content
881
- */
882
- s: MagicString;
883
- /**
884
- * The slide info of the current slide
885
- */
886
- slide: SlideInfo;
887
- /**
888
- * Resolved Slidev options
889
- */
890
- options: ResolvedSlidevOptions;
881
+ /**
882
+ * The magic string instance for the current markdown content
883
+ */
884
+ s: MagicString;
885
+ /**
886
+ * The slide info of the current slide
887
+ */
888
+ slide: SlideInfo;
889
+ /**
890
+ * Resolved Slidev options
891
+ */
892
+ options: ResolvedSlidevOptions;
891
893
  }
892
894
  type MarkdownTransformer = (ctx: MarkdownTransformContext) => Awaitable<void>;
893
895
 
896
+ //#endregion
897
+ //#region src/setups.d.ts
894
898
  interface AppContext {
895
- app: App;
896
- router: Router;
899
+ app: App;
900
+ router: Router;
897
901
  }
898
902
  interface MonacoSetupReturn {
899
- editorOptions?: monaco.editor.IEditorOptions;
903
+ editorOptions?: monaco.editor.IEditorOptions;
900
904
  }
901
905
  interface NavOperations {
902
- next: () => void;
903
- prev: () => Promise<void>;
904
- nextSlide: () => void;
905
- prevSlide: () => Promise<void>;
906
- go: (index: number) => void;
907
- goFirst: () => void;
908
- goLast: () => void;
909
- downloadPDF: () => Promise<void>;
910
- toggleDark: () => void;
911
- toggleOverview: () => void;
912
- toggleDrawing: () => void;
913
- escapeOverview: () => void;
914
- showGotoDialog: () => void;
906
+ next: () => void;
907
+ prev: () => Promise<void>;
908
+ nextSlide: () => void;
909
+ prevSlide: () => Promise<void>;
910
+ go: (index: number) => void;
911
+ goFirst: () => void;
912
+ goLast: () => void;
913
+ downloadPDF: () => Promise<void>;
914
+ toggleDark: () => void;
915
+ toggleOverview: () => void;
916
+ toggleDrawing: () => void;
917
+ escapeOverview: () => void;
918
+ showGotoDialog: () => void;
915
919
  }
916
920
  interface ShortcutOptions {
917
- key: string | Ref<boolean>;
918
- fn?: () => void;
919
- autoRepeat?: boolean;
920
- name?: string;
921
+ key: string | Ref<boolean>;
922
+ fn?: () => void;
923
+ autoRepeat?: boolean;
924
+ name?: string;
921
925
  }
922
926
  interface ShikiContext {
923
- /**
924
- * @deprecated Pass directly the theme name it's supported by Shiki.
925
- * For custom themes, load it manually via `JSON.parse(fs.readFileSync(path, 'utf-8'))` and pass the raw JSON object instead.
926
- */
927
- loadTheme: (path: string) => Promise<any>;
927
+ /**
928
+ * @deprecated Pass directly the theme name it's supported by Shiki.
929
+ * For custom themes, load it manually via `JSON.parse(fs.readFileSync(path, 'utf-8'))` and pass the raw JSON object instead.
930
+ */
931
+ loadTheme: (path: string) => Promise<any>;
928
932
  }
929
933
  type ShikiSetupReturn = Partial<Omit<CodeToHastOptionsCommon<BuiltinLanguage>, 'lang'> & CodeOptionsThemes<BuiltinTheme> & CodeOptionsMeta & {
930
- setup: (highlighter: Highlighter) => Awaitable<void>;
931
- langs: (LanguageInput | BuiltinLanguage)[];
934
+ setup: (highlighter: Highlighter) => Awaitable<void>;
935
+ langs: (LanguageInput | BuiltinLanguage)[];
932
936
  }>;
933
937
  interface TransformersSetupReturn {
934
- pre: (MarkdownTransformer | false)[];
935
- preCodeblock: (MarkdownTransformer | false)[];
936
- postCodeblock: (MarkdownTransformer | false)[];
937
- post: (MarkdownTransformer | false)[];
938
+ pre: (MarkdownTransformer | false)[];
939
+ preCodeblock: (MarkdownTransformer | false)[];
940
+ postCodeblock: (MarkdownTransformer | false)[];
941
+ post: (MarkdownTransformer | false)[];
938
942
  }
939
943
  type ShikiSetup = (shiki: ShikiContext) => Awaitable<ShikiSetupReturn | void>;
940
944
  type KatexSetup = () => Awaitable<Partial<KatexOptions> | void>;
941
945
  type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | void>;
942
946
  type TransformersSetup = () => Awaitable<Partial<TransformersSetupReturn>>;
943
947
  type PreparserSetup = (context: {
944
- filepath: string;
945
- headmatter: Record<string, unknown>;
946
- mode?: string;
948
+ filepath: string;
949
+ headmatter: Record<string, unknown>;
950
+ mode?: string;
947
951
  }) => Awaitable<SlidevPreparserExtension[]>;
948
952
  type VitePluginsSetup = (options: ResolvedSlidevOptions) => Awaitable<Plugin[]>;
949
953
  type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn | void>;
@@ -969,40 +973,45 @@ declare const defineVitePluginsSetup: (fn: VitePluginsSetup) => VitePluginsSetup
969
973
  declare const defineCodeRunnersSetup: (fn: CodeRunnersSetup) => CodeRunnersSetup;
970
974
  declare const defineContextMenuSetup: (fn: ContextMenuSetup) => ContextMenuSetup;
971
975
 
976
+ //#endregion
977
+ //#region src/toc.d.ts
972
978
  interface TocItem {
973
- no: number;
974
- active?: boolean;
975
- activeParent?: boolean;
976
- children: TocItem[];
977
- hasActiveParent?: boolean;
978
- level: number;
979
- titleLevel: number;
980
- path: string;
981
- hideInToc?: boolean;
982
- title?: string;
979
+ no: number;
980
+ active?: boolean;
981
+ activeParent?: boolean;
982
+ children: TocItem[];
983
+ hasActiveParent?: boolean;
984
+ level: number;
985
+ titleLevel: number;
986
+ path: string;
987
+ hideInToc?: boolean;
988
+ title?: string;
983
989
  }
984
990
 
991
+ //#endregion
992
+ //#region src/vite.d.ts
985
993
  interface SlidevPluginOptions {
986
- vue?: ArgumentsType<typeof Vue>[0];
987
- vuejsx?: ArgumentsType<typeof VueJsx>[0];
988
- markdown?: ArgumentsType<typeof Markdown>[0];
989
- components?: ArgumentsType<typeof Components>[0];
990
- icons?: ArgumentsType<typeof Icons>[0];
991
- remoteAssets?: ArgumentsType<typeof RemoteAssets>[0];
992
- serverRef?: ArgumentsType<typeof ServerRef>[0];
993
- unocss?: VitePluginConfig;
994
- staticCopy?: ViteStaticCopyOptions;
995
- inspect?: ViteInspectOptions;
994
+ vue?: ArgumentsType<typeof Vue>[0];
995
+ vuejsx?: ArgumentsType<typeof VueJsx>[0];
996
+ markdown?: ArgumentsType<typeof Markdown>[0];
997
+ components?: ArgumentsType<typeof Components>[0];
998
+ icons?: ArgumentsType<typeof Icons>[0];
999
+ remoteAssets?: ArgumentsType<typeof RemoteAssets>[0];
1000
+ serverRef?: ArgumentsType<typeof ServerRef>[0];
1001
+ unocss?: VitePluginConfig;
1002
+ staticCopy?: ViteStaticCopyOptions;
1003
+ inspect?: ViteInspectOptions;
996
1004
  }
997
1005
  declare module 'vite' {
998
- interface UserConfig {
999
- /**
1000
- * Custom internal plugin options for Slidev (advanced)
1001
- *
1002
- * See https://github.com/slidevjs/slidev/blob/main/packages/slidev/node/options.ts#L50
1003
- */
1004
- slidev?: SlidevPluginOptions;
1005
- }
1006
+ interface UserConfig {
1007
+ /**
1008
+ * Custom internal plugin options for Slidev (advanced)
1009
+ *
1010
+ * See https://github.com/slidevjs/slidev/blob/main/packages/slidev/node/options.ts#L50
1011
+ */
1012
+ slidev?: SlidevPluginOptions;
1013
+ }
1006
1014
  }
1007
1015
 
1008
- export { type AppContext, type AppSetup, type BuildArgs, type BuiltinSlideTransition, type ClicksContext, type ClicksElement, type ClicksInfo, type CodeRunner, type CodeRunnerContext, type CodeRunnerOutput, type CodeRunnerOutputDom, type CodeRunnerOutputError, type CodeRunnerOutputHtml, type CodeRunnerOutputText, type CodeRunnerOutputTextArray, type CodeRunnerOutputs, type CodeRunnerProviders, type CodeRunnersSetup, type CommonArgs, type ContextMenuItem, type ContextMenuSetup, type DrawingsOptions, type ExportArgs, type FontOptions, type Frontmatter, type FrontmatterStyle, type Headmatter, type HeadmatterConfig, type KatexSetup, type MarkdownTransformContext, type MarkdownTransformer, type MermaidSetup, type MonacoSetup, type MonacoSetupReturn, type NavOperations, type NormalizedAtValue, type NormalizedRangeClickValue, type NormalizedSingleClickValue, type PreparserExtensionLoader, type PreparserSetup, type RawAtValue, type RawRangeAtValue, type RawSingleAtValue, type RenderContext, type ResolvedDrawingsOptions, type ResolvedExportOptions, type ResolvedFontOptions, type ResolvedSlidevConfigSub, type ResolvedSlidevOptions, type ResolvedSlidevUtils, type RootSetup, type RootsInfo, type RoutesSetup, type SeoMeta, type ShikiContext, type ShikiSetup, type ShikiSetupReturn, type ShortcutOptions, type ShortcutsSetup, type SlideInfo, type SlideInfoBase, type SlidePatch, type SlideRoute, type SlidevConfig, type SlidevData, type SlidevDetectedFeatures, type SlidevEntryOptions, type SlidevMarkdown, type SlidevPluginOptions, type SlidevPreparserExtension, type SlidevServerOptions, type SlidevThemeConfig, type SlidevThemeMeta, type SourceSlideInfo, type TocItem, type TransformersSetup, type TransformersSetupReturn, type TransitionGroupProps, type TransitionOptions, type UnoSetup, type VitePluginsSetup, defineAppSetup, defineCodeRunnersSetup, defineContextMenuSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineRootSetup, defineRoutesSetup, defineShikiSetup, defineShortcutsSetup, defineTransformersSetup, defineUnoSetup, defineVitePluginsSetup };
1016
+ //#endregion
1017
+ export { AppContext, AppSetup, BuildArgs, BuiltinSlideTransition, ClicksContext, ClicksElement, ClicksInfo, CodeRunner, CodeRunnerContext, CodeRunnerOutput, CodeRunnerOutputDom, CodeRunnerOutputError, CodeRunnerOutputHtml, CodeRunnerOutputText, CodeRunnerOutputTextArray, CodeRunnerOutputs, CodeRunnerProviders, CodeRunnersSetup, CommonArgs, ContextMenuItem, ContextMenuSetup, DrawingsOptions, ExportArgs, FontOptions, Frontmatter, FrontmatterStyle, Headmatter, HeadmatterConfig, KatexSetup, MarkdownTransformContext, MarkdownTransformer, MermaidSetup, MonacoSetup, MonacoSetupReturn, NavOperations, NormalizedAtValue, NormalizedRangeClickValue, NormalizedSingleClickValue, PreparserExtensionLoader, PreparserSetup, RawAtValue, RawRangeAtValue, RawSingleAtValue, RenderContext, ResolvedDrawingsOptions, ResolvedExportOptions, ResolvedFontOptions, ResolvedSlidevConfigSub, ResolvedSlidevOptions, ResolvedSlidevUtils, RootSetup, RootsInfo, RoutesSetup, SeoMeta, ShikiContext, ShikiSetup, ShikiSetupReturn, ShortcutOptions, ShortcutsSetup, SlideInfo, SlideInfoBase, SlidePatch, SlideRoute, SlidevConfig, SlidevData, SlidevDetectedFeatures, SlidevEntryOptions, SlidevMarkdown, SlidevPluginOptions, SlidevPreparserExtension, SlidevServerOptions, SlidevThemeConfig, SlidevThemeMeta, SourceSlideInfo, TocItem, TransformersSetup, TransformersSetupReturn, TransitionGroupProps, TransitionOptions, UnoSetup, VitePluginsSetup, defineAppSetup, defineCodeRunnersSetup, defineContextMenuSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineRootSetup, defineRoutesSetup, defineShikiSetup, defineShortcutsSetup, defineTransformersSetup, defineUnoSetup, defineVitePluginsSetup };