@slidev/types 0.49.17 → 0.49.19
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 +310 -180
- package/dist/index.mjs +2 -0
- package/package.json +6 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { RouteMeta, RouteComponent, Router, RouteRecordRaw } from 'vue-router';
|
|
2
2
|
import YAML from 'yaml';
|
|
3
|
-
import {
|
|
3
|
+
import { Component, MaybeRefOrGetter, App, Ref, ComputedRef } from 'vue';
|
|
4
4
|
import { Arrayable, Awaitable, ArgumentsType } from '@antfu/utils';
|
|
5
5
|
import * as monaco from 'monaco-editor';
|
|
6
6
|
import { KatexOptions } from 'katex';
|
|
7
7
|
import { CodeToHastOptions, CodeToHastOptionsCommon, BuiltinLanguage, CodeOptionsThemes, BuiltinTheme, CodeOptionsMeta, Highlighter, LanguageInput } from 'shiki';
|
|
8
8
|
import { VitePluginConfig } from 'unocss/vite';
|
|
9
9
|
import { MermaidConfig } from 'mermaid';
|
|
10
|
+
import MagicString from 'magic-string-stack';
|
|
11
|
+
import { MarkdownItShikiOptions } from '@shikijs/markdown-it/index.mjs';
|
|
12
|
+
import { HighlighterGeneric } from 'shiki/types.mjs';
|
|
10
13
|
import Vue from '@vitejs/plugin-vue';
|
|
11
14
|
import VueJsx from '@vitejs/plugin-vue-jsx';
|
|
12
15
|
import Icons from 'unplugin-icons/vite';
|
|
@@ -14,7 +17,8 @@ import Components from 'unplugin-vue-components/vite';
|
|
|
14
17
|
import Markdown from 'unplugin-vue-markdown/vite';
|
|
15
18
|
import RemoteAssets from 'vite-plugin-remote-assets';
|
|
16
19
|
import ServerRef from 'vite-plugin-vue-server-ref';
|
|
17
|
-
import
|
|
20
|
+
import { ViteStaticCopyOptions } from 'vite-plugin-static-copy';
|
|
21
|
+
import { Options } from 'vite-plugin-inspect';
|
|
18
22
|
|
|
19
23
|
interface CommonArgs {
|
|
20
24
|
entry: string;
|
|
@@ -41,152 +45,116 @@ interface BuildArgs extends ExportArgs {
|
|
|
41
45
|
inspect: boolean;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
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';
|
|
49
|
+
|
|
50
|
+
interface Headmatter extends HeadmatterConfig, Frontmatter {
|
|
51
|
+
/**
|
|
52
|
+
* Default frontmatter options applied to all slides
|
|
53
|
+
*/
|
|
54
|
+
defaults?: Frontmatter;
|
|
55
|
+
}
|
|
56
|
+
interface HeadmatterConfig extends TransitionOptions {
|
|
57
|
+
/**
|
|
58
|
+
* Title of the slides
|
|
59
|
+
*/
|
|
60
|
+
title?: string;
|
|
46
61
|
/**
|
|
47
62
|
* String template to compose title
|
|
48
63
|
*
|
|
49
64
|
* @example "%s - Slidev" - to suffix " - Slidev" to all pages
|
|
50
65
|
* @default '%s - Slidev'
|
|
51
66
|
*/
|
|
52
|
-
titleTemplate
|
|
67
|
+
titleTemplate?: string;
|
|
53
68
|
/**
|
|
54
69
|
* Theme to use for the slides
|
|
55
70
|
*
|
|
56
|
-
*
|
|
71
|
+
* See https://sli.dev/themes/use.html
|
|
57
72
|
* @default 'default'
|
|
58
73
|
*/
|
|
59
|
-
theme
|
|
74
|
+
theme?: string;
|
|
60
75
|
/**
|
|
61
76
|
* List of Slidev addons
|
|
62
77
|
*
|
|
63
78
|
* @default []
|
|
64
79
|
*/
|
|
65
|
-
addons
|
|
80
|
+
addons?: string[];
|
|
66
81
|
/**
|
|
67
82
|
* Download remote assets in local using vite-plugin-remote-assets
|
|
68
83
|
*
|
|
69
84
|
* @default false
|
|
70
85
|
*/
|
|
71
|
-
remoteAssets
|
|
72
|
-
/**
|
|
73
|
-
* Enable Monaco
|
|
74
|
-
*
|
|
75
|
-
* @see https://sli.dev/custom/config-monaco.html
|
|
76
|
-
* @default true
|
|
77
|
-
*/
|
|
78
|
-
monaco: boolean | 'dev' | 'build';
|
|
79
|
-
/**
|
|
80
|
-
* Where to load monaco types from
|
|
81
|
-
*
|
|
82
|
-
* - `cdn` - load from CDN with `@typescript/ata`
|
|
83
|
-
* - `local` - load from local node_modules
|
|
84
|
-
*
|
|
85
|
-
* @default 'local'
|
|
86
|
-
*/
|
|
87
|
-
monacoTypesSource: 'cdn' | 'local' | 'none';
|
|
88
|
-
/**
|
|
89
|
-
* Additional node packages to load as monaco types
|
|
90
|
-
*
|
|
91
|
-
* @default []
|
|
92
|
-
*/
|
|
93
|
-
monacoTypesAdditionalPackages: string[];
|
|
94
|
-
/**
|
|
95
|
-
* Packages to ignore when loading monaco types
|
|
96
|
-
*
|
|
97
|
-
* @default []
|
|
98
|
-
*/
|
|
99
|
-
monacoTypesIgnorePackages: string[];
|
|
100
|
-
/**
|
|
101
|
-
* Additional local modules to load as dependencies of monaco runnable
|
|
102
|
-
*
|
|
103
|
-
* @default []
|
|
104
|
-
*/
|
|
105
|
-
monacoRunAdditionalDeps: string[];
|
|
86
|
+
remoteAssets?: boolean | 'dev' | 'build';
|
|
106
87
|
/**
|
|
107
88
|
* Show a download button in the SPA build,
|
|
108
89
|
* could also be a link to custom pdf
|
|
109
90
|
*
|
|
110
91
|
* @default false
|
|
111
92
|
*/
|
|
112
|
-
download
|
|
113
|
-
/**
|
|
114
|
-
* Options for export
|
|
115
|
-
*
|
|
116
|
-
* @default {}
|
|
117
|
-
*/
|
|
118
|
-
export: ResolvedExportOptions;
|
|
93
|
+
download?: boolean | string;
|
|
119
94
|
/**
|
|
120
95
|
* Show a copy button in code blocks
|
|
121
96
|
*
|
|
122
97
|
* @default true
|
|
123
98
|
*/
|
|
124
|
-
codeCopy
|
|
99
|
+
codeCopy?: boolean;
|
|
125
100
|
/**
|
|
126
101
|
* Information shows on the built SPA
|
|
127
102
|
* Can be a markdown string
|
|
128
103
|
*
|
|
129
104
|
* @default false
|
|
130
105
|
*/
|
|
131
|
-
info
|
|
106
|
+
info?: string | boolean;
|
|
132
107
|
/**
|
|
133
108
|
* Prefer highlighter
|
|
134
109
|
*
|
|
135
|
-
*
|
|
110
|
+
* See https://sli.dev/custom/config-highlighter.html
|
|
136
111
|
* @default shiki
|
|
137
112
|
*/
|
|
138
|
-
highlighter
|
|
113
|
+
highlighter?: 'shiki' | 'prism';
|
|
139
114
|
/**
|
|
140
115
|
* Enable Twoslash
|
|
141
116
|
*
|
|
142
117
|
* @default true
|
|
143
118
|
*/
|
|
144
|
-
twoslash
|
|
119
|
+
twoslash?: boolean | 'dev' | 'build';
|
|
145
120
|
/**
|
|
146
121
|
* Show line numbers in code blocks
|
|
147
122
|
*
|
|
148
123
|
* @default false
|
|
149
124
|
*/
|
|
150
|
-
lineNumbers
|
|
125
|
+
lineNumbers?: boolean;
|
|
151
126
|
/**
|
|
152
127
|
* Force slides color schema
|
|
153
128
|
*
|
|
154
129
|
* @default 'auto'
|
|
155
130
|
*/
|
|
156
|
-
colorSchema
|
|
131
|
+
colorSchema?: 'dark' | 'light' | 'all' | 'auto';
|
|
157
132
|
/**
|
|
158
133
|
* Router mode for vue-router
|
|
159
134
|
*
|
|
160
135
|
* @default 'history'
|
|
161
136
|
*/
|
|
162
|
-
routerMode
|
|
137
|
+
routerMode?: 'hash' | 'history';
|
|
163
138
|
/**
|
|
164
139
|
* Aspect ratio for slides
|
|
165
140
|
* should be like `16/9` or `1:1`
|
|
166
141
|
*
|
|
167
142
|
* @default '16/9'
|
|
168
143
|
*/
|
|
169
|
-
aspectRatio
|
|
144
|
+
aspectRatio?: number;
|
|
170
145
|
/**
|
|
171
146
|
* The actual width for slides canvas.
|
|
172
147
|
* unit in px.
|
|
173
148
|
*
|
|
174
149
|
* @default '980'
|
|
175
150
|
*/
|
|
176
|
-
canvasWidth
|
|
177
|
-
/**
|
|
178
|
-
* Force the filename used when exporting the presentation.
|
|
179
|
-
* The extension, e.g. .pdf, gets automatically added.
|
|
180
|
-
*
|
|
181
|
-
* @default ''
|
|
182
|
-
*/
|
|
183
|
-
exportFilename: string | null;
|
|
151
|
+
canvasWidth?: number;
|
|
184
152
|
/**
|
|
185
153
|
* Controls whether texts in slides are selectable
|
|
186
154
|
*
|
|
187
155
|
* @default true
|
|
188
156
|
*/
|
|
189
|
-
selectable
|
|
157
|
+
selectable?: boolean;
|
|
190
158
|
/**
|
|
191
159
|
* Configure for themes, will inject intro root styles as
|
|
192
160
|
* `--slidev-theme-x` for attribute `x`
|
|
@@ -196,37 +164,37 @@ interface SlidevConfig {
|
|
|
196
164
|
*
|
|
197
165
|
* @default {}
|
|
198
166
|
*/
|
|
199
|
-
themeConfig
|
|
167
|
+
themeConfig?: SlidevThemeConfig;
|
|
200
168
|
/**
|
|
201
169
|
* Configure fonts for the slides and app
|
|
202
170
|
*
|
|
203
171
|
* @default {}
|
|
204
172
|
*/
|
|
205
|
-
fonts
|
|
173
|
+
fonts?: FontOptions;
|
|
206
174
|
/**
|
|
207
175
|
* Configure the icon for app
|
|
208
176
|
*
|
|
209
177
|
* @default 'https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png'
|
|
210
178
|
*/
|
|
211
|
-
favicon
|
|
179
|
+
favicon?: string;
|
|
212
180
|
/**
|
|
213
181
|
* Options for drawings
|
|
214
182
|
*
|
|
215
183
|
* @default {}
|
|
216
184
|
*/
|
|
217
|
-
drawings
|
|
185
|
+
drawings?: DrawingsOptions;
|
|
218
186
|
/**
|
|
219
187
|
* URL of PlantUML server used to render diagrams
|
|
220
188
|
*
|
|
221
189
|
* @default https://www.plantuml.com/plantuml
|
|
222
190
|
*/
|
|
223
|
-
plantUmlServer
|
|
191
|
+
plantUmlServer?: string;
|
|
224
192
|
/**
|
|
225
193
|
* Enable slides recording
|
|
226
194
|
*
|
|
227
195
|
* @default 'dev'
|
|
228
196
|
*/
|
|
229
|
-
record
|
|
197
|
+
record?: boolean | 'dev' | 'build';
|
|
230
198
|
/**
|
|
231
199
|
* Expose the server to inbound requests (listen to `0.0.0.0`)
|
|
232
200
|
*
|
|
@@ -238,44 +206,30 @@ interface SlidevConfig {
|
|
|
238
206
|
/**
|
|
239
207
|
* Engine for Atomic CSS
|
|
240
208
|
*
|
|
241
|
-
*
|
|
209
|
+
* See https://unocss.dev/
|
|
242
210
|
* @deprecated
|
|
243
211
|
* @default 'unocss'
|
|
244
212
|
*/
|
|
245
|
-
css
|
|
213
|
+
css?: 'unocss';
|
|
246
214
|
/**
|
|
247
215
|
* Enable presenter mode
|
|
248
216
|
*
|
|
249
217
|
* @default true
|
|
250
218
|
*/
|
|
251
|
-
presenter
|
|
219
|
+
presenter?: boolean | 'dev' | 'build';
|
|
252
220
|
/**
|
|
253
221
|
* Attributes to apply to the HTML element
|
|
254
222
|
*
|
|
255
223
|
* @default {}
|
|
256
224
|
*/
|
|
257
|
-
htmlAttrs
|
|
225
|
+
htmlAttrs?: Record<string, string>;
|
|
258
226
|
/**
|
|
259
|
-
*
|
|
227
|
+
* Suppport MDC syntax
|
|
260
228
|
*
|
|
261
|
-
*
|
|
262
|
-
* - fade
|
|
263
|
-
* - fade-out
|
|
264
|
-
* - slide-left
|
|
265
|
-
* - slide-right
|
|
266
|
-
* - slide-up
|
|
267
|
-
* - slide-down
|
|
229
|
+
* See https://github.com/antfu/markdown-it-mdc
|
|
268
230
|
*
|
|
269
|
-
*
|
|
270
|
-
* @see https://vuejs.org/guide/built-ins/transition.html
|
|
271
|
-
*/
|
|
272
|
-
transition?: BuiltinSlideTransition | string | TransitionGroupProps;
|
|
273
|
-
/**
|
|
274
|
-
* Suppport MDC syntax
|
|
231
|
+
* See https://content.nuxtjs.org/guide/writing/mdc
|
|
275
232
|
*
|
|
276
|
-
* @see https://github.com/antfu/markdown-it-mdc
|
|
277
|
-
* @see https://content.nuxtjs.org/guide/writing/mdc
|
|
278
|
-
* @experimental
|
|
279
233
|
* @default false
|
|
280
234
|
*/
|
|
281
235
|
mdc?: boolean;
|
|
@@ -284,17 +238,155 @@ interface SlidevConfig {
|
|
|
284
238
|
*
|
|
285
239
|
* @default true
|
|
286
240
|
*/
|
|
287
|
-
editor
|
|
241
|
+
editor?: boolean;
|
|
288
242
|
/**
|
|
289
243
|
* Enable context menu
|
|
290
244
|
*
|
|
291
245
|
* @default true
|
|
292
246
|
*/
|
|
293
|
-
contextMenu
|
|
247
|
+
contextMenu?: boolean | 'dev' | 'build' | null;
|
|
294
248
|
/**
|
|
295
249
|
* Enable wake lock
|
|
296
250
|
*/
|
|
297
|
-
wakeLock
|
|
251
|
+
wakeLock?: boolean | 'dev' | 'build';
|
|
252
|
+
/**
|
|
253
|
+
* Force the filename used when exporting the presentation.
|
|
254
|
+
* The extension, e.g. .pdf, gets automatically added.
|
|
255
|
+
*
|
|
256
|
+
* @default ''
|
|
257
|
+
*/
|
|
258
|
+
exportFilename?: string | null;
|
|
259
|
+
/**
|
|
260
|
+
* Enable Monaco
|
|
261
|
+
*
|
|
262
|
+
* See https://sli.dev/custom/config-monaco.html
|
|
263
|
+
* @default true
|
|
264
|
+
*/
|
|
265
|
+
monaco?: boolean | 'dev' | 'build';
|
|
266
|
+
/**
|
|
267
|
+
* Where to load monaco types from
|
|
268
|
+
*
|
|
269
|
+
* - `cdn` - load from CDN with `@typescript/ata`
|
|
270
|
+
* - `local` - load from local node_modules
|
|
271
|
+
*
|
|
272
|
+
* @default 'local'
|
|
273
|
+
*/
|
|
274
|
+
monacoTypesSource?: 'cdn' | 'local' | 'none';
|
|
275
|
+
/**
|
|
276
|
+
* Additional node packages to load as monaco types
|
|
277
|
+
*
|
|
278
|
+
* @default []
|
|
279
|
+
*/
|
|
280
|
+
monacoTypesAdditionalPackages?: string[];
|
|
281
|
+
/**
|
|
282
|
+
* Packages to ignore when loading monaco types
|
|
283
|
+
*
|
|
284
|
+
* @default []
|
|
285
|
+
*/
|
|
286
|
+
monacoTypesIgnorePackages?: string[];
|
|
287
|
+
/**
|
|
288
|
+
* Additional local modules to load as dependencies of monaco runnable
|
|
289
|
+
*
|
|
290
|
+
* @default []
|
|
291
|
+
*/
|
|
292
|
+
monacoRunAdditionalDeps?: string[];
|
|
293
|
+
}
|
|
294
|
+
interface Frontmatter extends TransitionOptions {
|
|
295
|
+
/**
|
|
296
|
+
* Slide layout to use
|
|
297
|
+
*
|
|
298
|
+
* Default to 'cover' for the first slide, 'default' for the rest
|
|
299
|
+
*/
|
|
300
|
+
layout?: BuiltinLayouts | string;
|
|
301
|
+
/**
|
|
302
|
+
* Custom class added to the slide root element
|
|
303
|
+
*/
|
|
304
|
+
class?: string | string[] | Record<string, unknown>;
|
|
305
|
+
/**
|
|
306
|
+
* Manually specified the total clicks needed to this slide
|
|
307
|
+
*
|
|
308
|
+
* When not specified, the clicks will be calculated by the usage of v-clicks
|
|
309
|
+
*
|
|
310
|
+
* See https://sli.dev/guide/animations
|
|
311
|
+
*/
|
|
312
|
+
clicks?: number;
|
|
313
|
+
/**
|
|
314
|
+
* Manually specified the total clicks needed to this slide to start
|
|
315
|
+
*
|
|
316
|
+
* @default 0
|
|
317
|
+
*/
|
|
318
|
+
clicksStart?: number;
|
|
319
|
+
/**
|
|
320
|
+
* Preload the slide when the previous slide is active
|
|
321
|
+
* @default true
|
|
322
|
+
*/
|
|
323
|
+
preload?: boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Completely hide and disable the slide
|
|
326
|
+
*/
|
|
327
|
+
hide?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Same as `hide`, completely hide and disable the slide
|
|
330
|
+
*/
|
|
331
|
+
disabled?: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* hide the slide for the `<Toc>` components
|
|
334
|
+
*
|
|
335
|
+
* See https://sli.dev/builtin/components#toc
|
|
336
|
+
*/
|
|
337
|
+
hideInToc?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Override the title level for the <TitleRenderer> and <Toc> components
|
|
340
|
+
* Only if `title` has also been declared
|
|
341
|
+
*/
|
|
342
|
+
level?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Create a route alias that can be used in the URL or with the <Link> component
|
|
345
|
+
*/
|
|
346
|
+
routeAlias?: string;
|
|
347
|
+
/**
|
|
348
|
+
* Custom zoom level for the slide
|
|
349
|
+
* @default 1
|
|
350
|
+
*/
|
|
351
|
+
zoom?: number;
|
|
352
|
+
/**
|
|
353
|
+
* Store the positions of draggable elements
|
|
354
|
+
* Normally you don't need to set this manually
|
|
355
|
+
*
|
|
356
|
+
* See https://sli.dev/features/draggable
|
|
357
|
+
*/
|
|
358
|
+
dragPos?: Record<string, string>[];
|
|
359
|
+
/**
|
|
360
|
+
* Includes a markdown file
|
|
361
|
+
*
|
|
362
|
+
* See https://sli.dev/guide/syntax.html#importing-slides
|
|
363
|
+
*/
|
|
364
|
+
src?: string;
|
|
365
|
+
}
|
|
366
|
+
interface DrawingsOptions {
|
|
367
|
+
/**
|
|
368
|
+
* Persist the drawings to disk
|
|
369
|
+
* Passing string to specify the directory (default to `.slidev/drawings`)
|
|
370
|
+
*
|
|
371
|
+
* @default false
|
|
372
|
+
*/
|
|
373
|
+
persist?: boolean | string;
|
|
374
|
+
/**
|
|
375
|
+
* @default true
|
|
376
|
+
*/
|
|
377
|
+
enabled?: boolean | 'dev' | 'build';
|
|
378
|
+
/**
|
|
379
|
+
* Only allow drawing from presenter mode
|
|
380
|
+
*
|
|
381
|
+
* @default false
|
|
382
|
+
*/
|
|
383
|
+
presenterOnly?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Sync drawing for all instances
|
|
386
|
+
*
|
|
387
|
+
* @default true
|
|
388
|
+
*/
|
|
389
|
+
syncAll?: boolean;
|
|
298
390
|
}
|
|
299
391
|
interface FontOptions {
|
|
300
392
|
/**
|
|
@@ -344,30 +436,52 @@ interface FontOptions {
|
|
|
344
436
|
*/
|
|
345
437
|
fallbacks?: boolean;
|
|
346
438
|
}
|
|
347
|
-
|
|
439
|
+
type BuiltinSlideTransition = 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'fade' | 'zoom' | 'none';
|
|
440
|
+
interface TransitionOptions {
|
|
348
441
|
/**
|
|
349
|
-
*
|
|
350
|
-
* Passing string to specify the directory (default to `.slidev/drawings`)
|
|
442
|
+
* Page transition, powered by Vue's `<TransitionGroup/>`
|
|
351
443
|
*
|
|
352
|
-
*
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
*
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Only allow drawing from presenter mode
|
|
444
|
+
* Built-in transitions:
|
|
445
|
+
* - fade
|
|
446
|
+
* - fade-out
|
|
447
|
+
* - slide-left
|
|
448
|
+
* - slide-right
|
|
449
|
+
* - slide-up
|
|
450
|
+
* - slide-down
|
|
361
451
|
*
|
|
362
|
-
*
|
|
363
|
-
*/
|
|
364
|
-
presenterOnly?: boolean;
|
|
365
|
-
/**
|
|
366
|
-
* Sync drawing for all instances
|
|
452
|
+
* See https://sli.dev/guide/animations.html#pages-transitions
|
|
367
453
|
*
|
|
368
|
-
*
|
|
454
|
+
* See https://vuejs.org/guide/built-ins/transition.html
|
|
369
455
|
*/
|
|
370
|
-
|
|
456
|
+
transition?: BuiltinSlideTransition | string | TransitionGroupProps | null;
|
|
457
|
+
}
|
|
458
|
+
interface TransitionGroupProps {
|
|
459
|
+
appear?: boolean;
|
|
460
|
+
persisted?: boolean;
|
|
461
|
+
tag?: string;
|
|
462
|
+
moveClass?: string;
|
|
463
|
+
css?: boolean;
|
|
464
|
+
duration?: number | {
|
|
465
|
+
enter: number;
|
|
466
|
+
leave: number;
|
|
467
|
+
};
|
|
468
|
+
enterFromClass?: string;
|
|
469
|
+
enterActiveClass?: string;
|
|
470
|
+
enterToClass?: string;
|
|
471
|
+
appearFromClass?: string;
|
|
472
|
+
appearActiveClass?: string;
|
|
473
|
+
appearToClass?: string;
|
|
474
|
+
leaveFromClass?: string;
|
|
475
|
+
leaveActiveClass?: string;
|
|
476
|
+
leaveToClass?: string;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
interface ResolvedSlidevConfigSub {
|
|
480
|
+
export: ResolvedExportOptions;
|
|
481
|
+
drawings: ResolvedDrawingsOptions;
|
|
482
|
+
fonts: ResolvedFontOptions;
|
|
483
|
+
}
|
|
484
|
+
interface SlidevConfig extends Omit<Required<HeadmatterConfig>, keyof ResolvedSlidevConfigSub>, ResolvedSlidevConfigSub {
|
|
371
485
|
}
|
|
372
486
|
interface ResolvedFontOptions {
|
|
373
487
|
sans: string[];
|
|
@@ -390,7 +504,6 @@ interface ResolvedExportOptions extends Omit<ExportArgs, 'entry' | 'theme'> {
|
|
|
390
504
|
executablePath?: string;
|
|
391
505
|
withToc?: boolean;
|
|
392
506
|
}
|
|
393
|
-
type BuiltinSlideTransition = 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'fade' | 'zoom' | 'none';
|
|
394
507
|
|
|
395
508
|
type FrontmatterStyle = 'frontmatter' | 'yaml';
|
|
396
509
|
interface SlideInfoBase {
|
|
@@ -588,6 +701,72 @@ type ContextMenuOption = {
|
|
|
588
701
|
});
|
|
589
702
|
type ContextMenuItem = ContextMenuOption | 'separator';
|
|
590
703
|
|
|
704
|
+
interface RootsInfo {
|
|
705
|
+
cliRoot: string;
|
|
706
|
+
clientRoot: string;
|
|
707
|
+
userRoot: string;
|
|
708
|
+
userPkgJson: Record<string, any>;
|
|
709
|
+
userWorkspaceRoot: string;
|
|
710
|
+
}
|
|
711
|
+
interface SlidevEntryOptions {
|
|
712
|
+
/**
|
|
713
|
+
* Markdown entry
|
|
714
|
+
*/
|
|
715
|
+
entry: string;
|
|
716
|
+
/**
|
|
717
|
+
* Theme id
|
|
718
|
+
*/
|
|
719
|
+
theme?: string;
|
|
720
|
+
/**
|
|
721
|
+
* Remote password
|
|
722
|
+
*/
|
|
723
|
+
remote?: string;
|
|
724
|
+
/**
|
|
725
|
+
* Enable inspect plugin
|
|
726
|
+
*/
|
|
727
|
+
inspect?: boolean;
|
|
728
|
+
}
|
|
729
|
+
interface ResolvedSlidevOptions extends RootsInfo, SlidevEntryOptions {
|
|
730
|
+
data: SlidevData;
|
|
731
|
+
themeRaw: string;
|
|
732
|
+
themeRoots: string[];
|
|
733
|
+
addonRoots: string[];
|
|
734
|
+
/**
|
|
735
|
+
* =`[...themeRoots, ...addonRoots, userRoot]` (`clientRoot` excluded)
|
|
736
|
+
*/
|
|
737
|
+
roots: string[];
|
|
738
|
+
mode: 'dev' | 'build' | 'export';
|
|
739
|
+
utils: ResolvedSlidevUtils;
|
|
740
|
+
}
|
|
741
|
+
interface ResolvedSlidevUtils {
|
|
742
|
+
shiki: HighlighterGeneric<any, any>;
|
|
743
|
+
shikiOptions: MarkdownItShikiOptions;
|
|
744
|
+
isMonacoTypesIgnored: (pkg: string) => boolean;
|
|
745
|
+
getLayouts: () => Record<string, string>;
|
|
746
|
+
}
|
|
747
|
+
interface SlidevServerOptions {
|
|
748
|
+
/**
|
|
749
|
+
* @returns `false` if server should be restarted
|
|
750
|
+
*/
|
|
751
|
+
loadData?: () => Promise<SlidevData | false>;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
interface MarkdownTransformContext {
|
|
755
|
+
/**
|
|
756
|
+
* The magic string instance for the current markdown content
|
|
757
|
+
*/
|
|
758
|
+
s: MagicString;
|
|
759
|
+
/**
|
|
760
|
+
* The slide info of the current slide
|
|
761
|
+
*/
|
|
762
|
+
slide: SlideInfo;
|
|
763
|
+
/**
|
|
764
|
+
* Resolved Slidev options
|
|
765
|
+
*/
|
|
766
|
+
options: ResolvedSlidevOptions;
|
|
767
|
+
}
|
|
768
|
+
type MarkdownTransformer = (ctx: MarkdownTransformContext) => void;
|
|
769
|
+
|
|
591
770
|
interface AppContext {
|
|
592
771
|
app: App;
|
|
593
772
|
router: Router;
|
|
@@ -627,14 +806,21 @@ type ShikiSetupReturn = Partial<Omit<CodeToHastOptionsCommon<BuiltinLanguage>, '
|
|
|
627
806
|
setup: (highlighter: Highlighter) => Awaitable<void>;
|
|
628
807
|
langs: (LanguageInput | BuiltinLanguage)[];
|
|
629
808
|
}>;
|
|
809
|
+
interface TransformersSetupReturn {
|
|
810
|
+
pre: (MarkdownTransformer | false)[];
|
|
811
|
+
preCodeblock: (MarkdownTransformer | false)[];
|
|
812
|
+
postCodeblock: (MarkdownTransformer | false)[];
|
|
813
|
+
post: (MarkdownTransformer | false)[];
|
|
814
|
+
}
|
|
630
815
|
type ShikiSetup = (shiki: ShikiContext) => Awaitable<ShikiSetupReturn | void>;
|
|
631
816
|
type KatexSetup = () => Awaitable<Partial<KatexOptions> | void>;
|
|
632
817
|
type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | void>;
|
|
818
|
+
type TransformersSetup = () => Awaitable<Partial<TransformersSetupReturn>>;
|
|
633
819
|
type PreparserSetup = (context: {
|
|
634
820
|
filepath: string;
|
|
635
821
|
headmatter: Record<string, unknown>;
|
|
636
822
|
mode?: string;
|
|
637
|
-
}) => SlidevPreparserExtension[]
|
|
823
|
+
}) => Awaitable<SlidevPreparserExtension[]>;
|
|
638
824
|
type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn | void>;
|
|
639
825
|
type AppSetup = (context: AppContext) => Awaitable<void>;
|
|
640
826
|
type RootSetup = () => Awaitable<void>;
|
|
@@ -652,6 +838,7 @@ declare const defineRoutesSetup: (fn: RoutesSetup) => RoutesSetup;
|
|
|
652
838
|
declare const defineMermaidSetup: (fn: MermaidSetup) => MermaidSetup;
|
|
653
839
|
declare const defineKatexSetup: (fn: KatexSetup) => KatexSetup;
|
|
654
840
|
declare const defineShortcutsSetup: (fn: ShortcutsSetup) => ShortcutsSetup;
|
|
841
|
+
declare const defineTransformersSetup: (fn: TransformersSetup) => TransformersSetup;
|
|
655
842
|
declare const definePreparserSetup: (fn: PreparserSetup) => PreparserSetup;
|
|
656
843
|
declare const defineCodeRunnersSetup: (fn: CodeRunnersSetup) => CodeRunnersSetup;
|
|
657
844
|
declare const defineContextMenuSetup: (fn: ContextMenuSetup) => ContextMenuSetup;
|
|
@@ -683,58 +870,6 @@ declare module 'vite' {
|
|
|
683
870
|
}
|
|
684
871
|
}
|
|
685
872
|
|
|
686
|
-
interface RootsInfo {
|
|
687
|
-
cliRoot: string;
|
|
688
|
-
clientRoot: string;
|
|
689
|
-
userRoot: string;
|
|
690
|
-
userPkgJson: Record<string, any>;
|
|
691
|
-
userWorkspaceRoot: string;
|
|
692
|
-
}
|
|
693
|
-
interface SlidevEntryOptions {
|
|
694
|
-
/**
|
|
695
|
-
* Markdown entry
|
|
696
|
-
*/
|
|
697
|
-
entry: string;
|
|
698
|
-
/**
|
|
699
|
-
* Theme id
|
|
700
|
-
*/
|
|
701
|
-
theme?: string;
|
|
702
|
-
/**
|
|
703
|
-
* Remote password
|
|
704
|
-
*/
|
|
705
|
-
remote?: string;
|
|
706
|
-
/**
|
|
707
|
-
* Enable inspect plugin
|
|
708
|
-
*/
|
|
709
|
-
inspect?: boolean;
|
|
710
|
-
}
|
|
711
|
-
interface ResolvedSlidevOptions extends RootsInfo {
|
|
712
|
-
data: SlidevData;
|
|
713
|
-
entry: string;
|
|
714
|
-
themeRaw: string;
|
|
715
|
-
theme: string;
|
|
716
|
-
themeRoots: string[];
|
|
717
|
-
addonRoots: string[];
|
|
718
|
-
/**
|
|
719
|
-
* =`[...themeRoots, ...addonRoots, userRoot]` (`clientRoot` excluded)
|
|
720
|
-
*/
|
|
721
|
-
roots: string[];
|
|
722
|
-
mode: 'dev' | 'build' | 'export';
|
|
723
|
-
remote?: string;
|
|
724
|
-
inspect?: boolean;
|
|
725
|
-
utils: ResolvedSlidevUtils;
|
|
726
|
-
}
|
|
727
|
-
interface ResolvedSlidevUtils {
|
|
728
|
-
isMonacoTypesIgnored: (pkg: string) => boolean;
|
|
729
|
-
getLayouts: () => Promise<Record<string, string>>;
|
|
730
|
-
}
|
|
731
|
-
interface SlidevServerOptions {
|
|
732
|
-
/**
|
|
733
|
-
* @returns `false` if server should be restarted
|
|
734
|
-
*/
|
|
735
|
-
loadData?: () => Promise<SlidevData | false>;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
873
|
interface SlidevPluginOptions {
|
|
739
874
|
vue?: ArgumentsType<typeof Vue>[0];
|
|
740
875
|
vuejsx?: ArgumentsType<typeof VueJsx>[0];
|
|
@@ -744,25 +879,20 @@ interface SlidevPluginOptions {
|
|
|
744
879
|
remoteAssets?: ArgumentsType<typeof RemoteAssets>[0];
|
|
745
880
|
serverRef?: ArgumentsType<typeof ServerRef>[0];
|
|
746
881
|
unocss?: VitePluginConfig;
|
|
882
|
+
staticCopy?: ViteStaticCopyOptions;
|
|
883
|
+
inspect?: Options;
|
|
747
884
|
}
|
|
748
885
|
declare module 'vite' {
|
|
749
886
|
interface UserConfig {
|
|
750
887
|
/**
|
|
751
888
|
* Custom internal plugin options for Slidev (advanced)
|
|
752
889
|
*
|
|
753
|
-
*
|
|
890
|
+
* See https://github.com/slidevjs/slidev/blob/main/packages/slidev/node/options.ts#L50
|
|
754
891
|
*/
|
|
755
892
|
slidev?: SlidevPluginOptions;
|
|
756
893
|
}
|
|
757
894
|
}
|
|
758
895
|
|
|
759
|
-
interface MarkdownTransformContext {
|
|
760
|
-
s: MagicString;
|
|
761
|
-
id: string;
|
|
762
|
-
options: ResolvedSlidevOptions;
|
|
763
|
-
}
|
|
764
|
-
type MarkdownTransformer = (ctx: MarkdownTransformContext) => void;
|
|
765
|
-
|
|
766
896
|
type RawSingleAtValue = null | undefined | boolean | string | number;
|
|
767
897
|
type RawRangeAtValue = null | undefined | false | [string | number, string | number];
|
|
768
898
|
type RawAtValue = RawSingleAtValue | RawRangeAtValue;
|
|
@@ -816,4 +946,4 @@ interface ClicksContext {
|
|
|
816
946
|
readonly total: number;
|
|
817
947
|
}
|
|
818
948
|
|
|
819
|
-
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 FrontmatterStyle, type KatexSetup, type LoadedSnippets, 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 ResolvedSlidevOptions, type ResolvedSlidevUtils, type RootSetup, type RootsInfo, type RoutesSetup, 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 UnoSetup, defineAppSetup, defineCodeRunnersSetup, defineContextMenuSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineRootSetup, defineRoutesSetup, defineShikiSetup, defineShortcutsSetup, defineUnoSetup };
|
|
949
|
+
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 LoadedSnippets, 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 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, defineAppSetup, defineCodeRunnersSetup, defineContextMenuSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineRootSetup, defineRoutesSetup, defineShikiSetup, defineShortcutsSetup, defineTransformersSetup, defineUnoSetup };
|
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ var defineRoutesSetup = defineSetup;
|
|
|
11
11
|
var defineMermaidSetup = defineSetup;
|
|
12
12
|
var defineKatexSetup = defineSetup;
|
|
13
13
|
var defineShortcutsSetup = defineSetup;
|
|
14
|
+
var defineTransformersSetup = defineSetup;
|
|
14
15
|
var definePreparserSetup = defineSetup;
|
|
15
16
|
var defineCodeRunnersSetup = defineSetup;
|
|
16
17
|
var defineContextMenuSetup = defineSetup;
|
|
@@ -26,5 +27,6 @@ export {
|
|
|
26
27
|
defineRoutesSetup,
|
|
27
28
|
defineShikiSetup,
|
|
28
29
|
defineShortcutsSetup,
|
|
30
|
+
defineTransformersSetup,
|
|
29
31
|
defineUnoSetup
|
|
30
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/types",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.19",
|
|
4
4
|
"description": "Shared types declarations for Slidev",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,18 +24,21 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@antfu/utils": "^0.7.10",
|
|
27
|
+
"@shikijs/markdown-it": "^1.10.3",
|
|
27
28
|
"@vitejs/plugin-vue": "^5.0.5",
|
|
28
29
|
"@vitejs/plugin-vue-jsx": "^4.0.0",
|
|
29
30
|
"katex": "^0.16.11",
|
|
30
31
|
"mermaid": "^10.9.1",
|
|
31
32
|
"monaco-editor": "^0.50.0",
|
|
32
33
|
"shiki": "^1.10.3",
|
|
33
|
-
"unocss": "^0.61.
|
|
34
|
+
"unocss": "^0.61.5",
|
|
34
35
|
"unplugin-icons": "^0.19.0",
|
|
35
36
|
"unplugin-vue-markdown": "^0.26.2",
|
|
37
|
+
"vite-plugin-inspect": "^0.8.5",
|
|
36
38
|
"vite-plugin-remote-assets": "^0.5.0",
|
|
39
|
+
"vite-plugin-static-copy": "^1.0.6",
|
|
37
40
|
"vite-plugin-vue-server-ref": "^0.4.2",
|
|
38
|
-
"vue": "^3.4.
|
|
41
|
+
"vue": "^3.4.33",
|
|
39
42
|
"vue-router": "^4.4.0"
|
|
40
43
|
},
|
|
41
44
|
"scripts": {
|