@slidev/types 0.43.7 → 0.43.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/types",
3
- "version": "0.43.7",
3
+ "version": "0.43.9",
4
4
  "description": "Shared types declarations for Slidev",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
package/dist/index.d.ts DELETED
@@ -1,477 +0,0 @@
1
- import { TransitionGroupProps, App, Ref } from 'vue';
2
- import { Awaitable } from '@antfu/utils';
3
- import * as Shiki from 'shiki';
4
- import { IThemeRegistration, Theme, ILanguageRegistration, Lang, Highlighter } from 'shiki';
5
- import * as monaco from 'monaco-editor';
6
- import { Router } from 'vue-router';
7
- import mermaid from 'mermaid';
8
- import { KatexOptions } from 'katex';
9
- import { WindiCssOptions } from 'vite-plugin-windicss';
10
- import { VitePluginConfig } from 'unocss/vite';
11
-
12
- interface CommonArgs {
13
- entry: string;
14
- theme?: string;
15
- }
16
- interface ExportArgs extends CommonArgs {
17
- output?: string;
18
- format?: string;
19
- timeout?: number;
20
- range?: string;
21
- dark?: boolean;
22
- 'with-clicks'?: boolean;
23
- 'executable-path'?: string;
24
- 'with-toc'?: boolean;
25
- 'per-slide'?: boolean;
26
- }
27
- interface BuildArgs extends ExportArgs {
28
- watch: boolean;
29
- out: string;
30
- base?: string;
31
- download?: boolean;
32
- inspect: boolean;
33
- }
34
-
35
- interface SlidevConfig {
36
- title: string;
37
- /**
38
- * String template to compose title
39
- *
40
- * @example "%s - Slidev" - to suffix " - Slidev" to all pages
41
- * @default '%s - Slidev'
42
- */
43
- titleTemplate: string;
44
- /**
45
- * Theme to use for the slides
46
- *
47
- * @see https://sli.dev/themes/use.html
48
- * @default 'default'
49
- */
50
- theme: string;
51
- /**
52
- * List of Slidev addons
53
- *
54
- * @default []
55
- */
56
- addons: string[];
57
- /**
58
- * Download remote assets in local using vite-plugin-remote-assets
59
- *
60
- * @default false
61
- */
62
- remoteAssets: boolean | 'dev' | 'build';
63
- /**
64
- * Enable Monaco
65
- *
66
- * @see https://sli.dev/custom/config-monaco.html
67
- * @default 'dev'
68
- */
69
- monaco: boolean | 'dev' | 'build';
70
- /**
71
- * Show a download button in the SPA build,
72
- * could also be a link to custom pdf
73
- *
74
- * @default false
75
- */
76
- download: boolean | string;
77
- /**
78
- * Options for export
79
- *
80
- * @default {}
81
- */
82
- export: ResolvedExportOptions;
83
- /**
84
- * Show a copy button in code blocks
85
- *
86
- * @default true
87
- */
88
- codeCopy: boolean;
89
- /**
90
- * Information shows on the built SPA
91
- * Can be a markdown string
92
- *
93
- * @default false
94
- */
95
- info: string | boolean;
96
- /**
97
- * Prefer highlighter
98
- *
99
- * @see https://sli.dev/custom/highlighters.html
100
- * @default prism
101
- */
102
- highlighter: 'prism' | 'shiki';
103
- /**
104
- * Show line numbers in code blocks
105
- *
106
- * @default false
107
- */
108
- lineNumbers: boolean;
109
- /**
110
- * Force slides color schema
111
- *
112
- * @default 'auto'
113
- */
114
- colorSchema: 'dark' | 'light' | 'all' | 'auto';
115
- /**
116
- * Router mode for vue-router
117
- *
118
- * @default 'history'
119
- */
120
- routerMode: 'hash' | 'history';
121
- /**
122
- * Aspect ratio for slides
123
- * should be like `16/9` or `1:1`
124
- *
125
- * @default '16/9'
126
- */
127
- aspectRatio: number;
128
- /**
129
- * The actual width for slides canvas.
130
- * unit in px.
131
- *
132
- * @default '980'
133
- */
134
- canvasWidth: number;
135
- /**
136
- * Force the filename used when exporting the presentation.
137
- * The extension, e.g. .pdf, gets automatically added.
138
- *
139
- * @default ''
140
- */
141
- exportFilename: string | null;
142
- /**
143
- * Controls whether texts in slides are selectable
144
- *
145
- * @default true
146
- */
147
- selectable: boolean;
148
- /**
149
- * Configure for themes, will inject intro root styles as
150
- * `--slidev-theme-x` for attribute `x`
151
- *
152
- * This allows themes to have customization options in frontmatter
153
- * Refer to themes' document for options avaliable
154
- *
155
- * @default {}
156
- */
157
- themeConfig: SlidevThemeConfig;
158
- /**
159
- * Configure fonts for the slides and app
160
- *
161
- * @default {}
162
- */
163
- fonts: ResolvedFontOptions;
164
- /**
165
- * Configure the icon for app
166
- *
167
- * @default 'https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png'
168
- */
169
- favicon: string;
170
- /**
171
- * Options for drawings
172
- *
173
- * @default {}
174
- */
175
- drawings: ResolvedDrawingsOptions;
176
- /**
177
- * URL of PlantUML server used to render diagrams
178
- *
179
- * @default https://www.plantuml.com/plantuml
180
- */
181
- plantUmlServer: string;
182
- /**
183
- * Enable slides recording
184
- *
185
- * @default 'dev'
186
- */
187
- record: boolean | 'dev' | 'build';
188
- /**
189
- * Expose the server to inbound requests (listen to `0.0.0.0`)
190
- *
191
- * Pass a string to set the password for accessing presenter mode.
192
- *
193
- * @default false
194
- */
195
- remote?: string | boolean;
196
- /**
197
- * Engine for Atomic CSS
198
- *
199
- * @see https://unocss.dev/
200
- * @see https://windicss.org/
201
- * @default 'unocss'
202
- */
203
- css: 'unocss' | 'windicss' | 'none';
204
- /**
205
- * Enable presenter mode
206
- *
207
- * @default true
208
- */
209
- presenter: boolean | 'dev' | 'build';
210
- /**
211
- * Attributes to apply to the HTML element
212
- *
213
- * @default {}
214
- */
215
- htmlAttrs: Record<string, string>;
216
- /**
217
- * Page transition, powered by Vue's <TransitionGroup/>
218
- *
219
- * Built-in transitions:
220
- * - fade
221
- * - fade-out
222
- * - slide-left
223
- * - slide-right
224
- * - slide-up
225
- * - slide-down
226
- *
227
- * @see https://sli.dev/guide/animations.html#pages-transitions
228
- * @see https://vuejs.org/guide/built-ins/transition.html
229
- */
230
- transition?: BuiltinSlideTransition | string | TransitionGroupProps;
231
- /**
232
- * Suppport **experimental** MDC syntax
233
- *
234
- * @see https://github.com/antfu/markdown-it-mdc
235
- * @see https://content.nuxtjs.org/guide/writing/mdc
236
- * @experimental
237
- * @default false
238
- */
239
- mdc?: boolean;
240
- /**
241
- * Enable built-in editor
242
- *
243
- * @default true
244
- */
245
- editor: boolean;
246
- }
247
- interface FontOptions {
248
- /**
249
- * Sans serif fonts (default fonts for most text)
250
- */
251
- sans?: string | string[];
252
- /**
253
- * Serif fonts
254
- */
255
- serif?: string | string[];
256
- /**
257
- * Monospace fonts, for code blocks and etc.
258
- */
259
- mono?: string | string[];
260
- /**
261
- * Load webfonts for custom CSS (does not apply anywhere by default)
262
- */
263
- custom?: string | string[];
264
- /**
265
- * Weights for fonts
266
- *
267
- * @default [200, 400, 600]
268
- */
269
- weights?: string | (string | number)[];
270
- /**
271
- * Import italic fonts
272
- *
273
- * @default false
274
- */
275
- italic?: boolean;
276
- /**
277
- * @default 'google'
278
- */
279
- provider?: 'none' | 'google';
280
- /**
281
- * Specify web fonts names, will detect from `sans`, `mono`, `serif` if not provided
282
- */
283
- webfonts?: string[];
284
- /**
285
- * Specify local fonts names, be excluded from webfonts
286
- */
287
- local?: string[];
288
- /**
289
- * Use fonts fallback
290
- *
291
- * @default true
292
- */
293
- fallbacks?: boolean;
294
- }
295
- interface DrawingsOptions {
296
- /**
297
- * Persist the drawings to disk
298
- * Passing string to specify the directory (default to `.slidev/drawings`)
299
- *
300
- * @default false
301
- */
302
- persist?: boolean | string;
303
- /**
304
- * @default true
305
- */
306
- enabled?: boolean | 'dev' | 'build';
307
- /**
308
- * Only allow drawing from presenter mode
309
- *
310
- * @default false
311
- */
312
- presenterOnly?: boolean;
313
- /**
314
- * Sync drawing for all instances
315
- *
316
- * @default true
317
- */
318
- syncAll?: boolean;
319
- }
320
- interface ResolvedFontOptions {
321
- sans: string[];
322
- mono: string[];
323
- serif: string[];
324
- weights: string[];
325
- italic: boolean;
326
- provider: 'none' | 'google';
327
- webfonts: string[];
328
- local: string[];
329
- }
330
- interface ResolvedDrawingsOptions {
331
- persist: string | false;
332
- enabled: boolean | 'dev' | 'build';
333
- presenterOnly: boolean;
334
- syncAll: boolean;
335
- }
336
- interface ResolvedExportOptions extends Omit<ExportArgs, 'entry' | 'theme'> {
337
- withClicks?: boolean;
338
- executablePath?: string;
339
- withToc?: boolean;
340
- }
341
- type BuiltinSlideTransition = 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'fade' | 'zoom' | 'none';
342
-
343
- interface SlideInfoBase {
344
- raw: string;
345
- content: string;
346
- note?: string;
347
- frontmatter: Record<string, any>;
348
- title?: string;
349
- level?: number;
350
- }
351
- interface SlideInfo extends SlideInfoBase {
352
- index: number;
353
- start: number;
354
- end: number;
355
- inline?: SlideInfoBase;
356
- source?: SlideInfoWithPath;
357
- }
358
- interface SlideInfoWithPath extends SlideInfoBase {
359
- filepath: string;
360
- }
361
- interface SlideInfoExtended extends SlideInfo {
362
- noteHTML: string;
363
- }
364
- /**
365
- * Metadata for "slidev" field in themes' package.json
366
- */
367
- interface SlidevThemeMeta {
368
- defaults?: Partial<SlidevConfig>;
369
- colorSchema?: 'dark' | 'light' | 'both';
370
- highlighter?: 'prism' | 'shiki' | 'both';
371
- }
372
- type SlidevThemeConfig = Record<string, string | number>;
373
- interface SlidevFeatureFlags {
374
- katex: boolean;
375
- monaco: boolean;
376
- tweet: boolean;
377
- mermaid: boolean;
378
- }
379
- interface SlidevMarkdown {
380
- slides: SlideInfo[];
381
- raw: string;
382
- config: SlidevConfig;
383
- features: SlidevFeatureFlags;
384
- headmatter: Record<string, unknown>;
385
- filepath?: string;
386
- entries?: string[];
387
- themeMeta?: SlidevThemeMeta;
388
- }
389
- interface SlidevPreparserExtension {
390
- name: string;
391
- transformRawLines?(lines: string[]): Promise<void> | void;
392
- transformSlide?(content: string, frontmatter: any): Promise<string | undefined>;
393
- }
394
- type PreparserExtensionLoader = (headmatter?: Record<string, unknown>, filepath?: string) => Promise<SlidevPreparserExtension[]>;
395
- type PreparserExtensionFromHeadmatter = (headmatter: any, exts: SlidevPreparserExtension[], filepath?: string) => Promise<SlidevPreparserExtension[]>;
396
- type RenderContext = 'slide' | 'overview' | 'presenter' | 'previewNext';
397
-
398
- interface AppContext {
399
- app: App;
400
- router: Router;
401
- }
402
- interface ShikiDarkModeThemes {
403
- dark: IThemeRegistration | Theme;
404
- light: IThemeRegistration | Theme;
405
- }
406
- interface ShikiOptions {
407
- theme?: IThemeRegistration | ShikiDarkModeThemes | Theme;
408
- langs?: (ILanguageRegistration | Lang)[];
409
- highlighter?: Highlighter;
410
- }
411
- interface ResolvedShikiOptions extends ShikiOptions {
412
- themes: (IThemeRegistration | Theme)[];
413
- darkModeThemes?: {
414
- dark: Theme;
415
- light: Theme;
416
- };
417
- }
418
- interface MonacoSetupReturn {
419
- theme?: {
420
- light?: string;
421
- dark?: string;
422
- };
423
- editorOptions?: monaco.editor.IEditorOptions;
424
- }
425
- type MermaidOptions = (typeof mermaid.initialize) extends (a: infer A) => any ? A : never;
426
- interface NavOperations {
427
- next: () => void;
428
- prev: () => Promise<void>;
429
- nextSlide: () => void;
430
- prevSlide: () => Promise<void>;
431
- go: (index: number) => void;
432
- goFirst: () => void;
433
- goLast: () => void;
434
- downloadPDF: () => Promise<void>;
435
- toggleDark: () => void;
436
- toggleOverview: () => void;
437
- toggleDrawing: () => void;
438
- escapeOverview: () => void;
439
- showGotoDialog: () => void;
440
- }
441
- interface ShortcutOptions {
442
- key: string | Ref<boolean>;
443
- fn?: () => void;
444
- autoRepeat?: boolean;
445
- name?: string;
446
- }
447
- type ShikiSetup = (shiki: typeof Shiki) => Awaitable<ShikiOptions | undefined>;
448
- type KatexSetup = () => Awaitable<Partial<KatexOptions> | undefined>;
449
- type WindiSetup = () => Awaitable<Partial<WindiCssOptions> | undefined>;
450
- type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
451
- type PreparserSetup = (filepath: string) => SlidevPreparserExtension;
452
- type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn>;
453
- type AppSetup = (context: AppContext) => Awaitable<void>;
454
- type MermaidSetup = () => Partial<MermaidOptions> | undefined;
455
- type ShortcutsSetup = (nav: NavOperations, defaultShortcuts: ShortcutOptions[]) => Array<ShortcutOptions>;
456
- declare function defineShikiSetup(fn: ShikiSetup): ShikiSetup;
457
- declare function defineWindiSetup(fn: WindiSetup): WindiSetup;
458
- declare function defineUnoSetup(fn: UnoSetup): UnoSetup;
459
- declare function defineMonacoSetup(fn: MonacoSetup): MonacoSetup;
460
- declare function defineAppSetup(fn: AppSetup): AppSetup;
461
- declare function defineMermaidSetup(fn: MermaidSetup): MermaidSetup;
462
- declare function defineKatexSetup(fn: KatexSetup): KatexSetup;
463
- declare function defineShortcutsSetup(fn: ShortcutsSetup): ShortcutsSetup;
464
- declare function definePreparserSetup(fn: PreparserSetup): PreparserSetup;
465
-
466
- interface TocItem {
467
- active?: boolean;
468
- activeParent?: boolean;
469
- children: TocItem[];
470
- hasActiveParent?: boolean;
471
- level: number;
472
- path: string;
473
- hideInToc?: boolean;
474
- title?: string;
475
- }
476
-
477
- export { AppContext, AppSetup, BuildArgs, BuiltinSlideTransition, CommonArgs, DrawingsOptions, ExportArgs, FontOptions, KatexSetup, MermaidOptions, MermaidSetup, MonacoSetup, MonacoSetupReturn, NavOperations, PreparserExtensionFromHeadmatter, PreparserExtensionLoader, PreparserSetup, RenderContext, ResolvedDrawingsOptions, ResolvedExportOptions, ResolvedFontOptions, ResolvedShikiOptions, ShikiDarkModeThemes, ShikiOptions, ShikiSetup, ShortcutOptions, ShortcutsSetup, SlideInfo, SlideInfoBase, SlideInfoExtended, SlideInfoWithPath, SlidevConfig, SlidevFeatureFlags, SlidevMarkdown, SlidevPreparserExtension, SlidevThemeConfig, SlidevThemeMeta, TocItem, UnoSetup, WindiSetup, defineAppSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineShikiSetup, defineShortcutsSetup, defineUnoSetup, defineWindiSetup };
package/dist/index.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/setups.ts
2
- function defineShikiSetup(fn) {
3
- return fn;
4
- }
5
- function defineWindiSetup(fn) {
6
- return fn;
7
- }
8
- function defineUnoSetup(fn) {
9
- return fn;
10
- }
11
- function defineMonacoSetup(fn) {
12
- return fn;
13
- }
14
- function defineAppSetup(fn) {
15
- return fn;
16
- }
17
- function defineMermaidSetup(fn) {
18
- return fn;
19
- }
20
- function defineKatexSetup(fn) {
21
- return fn;
22
- }
23
- function defineShortcutsSetup(fn) {
24
- return fn;
25
- }
26
- function definePreparserSetup(fn) {
27
- return fn;
28
- }
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- exports.defineAppSetup = defineAppSetup; exports.defineKatexSetup = defineKatexSetup; exports.defineMermaidSetup = defineMermaidSetup; exports.defineMonacoSetup = defineMonacoSetup; exports.definePreparserSetup = definePreparserSetup; exports.defineShikiSetup = defineShikiSetup; exports.defineShortcutsSetup = defineShortcutsSetup; exports.defineUnoSetup = defineUnoSetup; exports.defineWindiSetup = defineWindiSetup;