@slidev/types 0.48.0-beta.2 → 0.48.0-beta.21
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/client.d.ts +62 -3
- package/dist/index.d.mts +89 -35
- package/package.json +1 -1
package/client.d.ts
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// Types for virtual modules
|
|
2
|
+
// `#slidev/*` is an alias for `/@slidev/*`, because TS will consider `/@slidev/*` as an absolute path that we can't override
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
declare module '#slidev/configs' {
|
|
5
|
+
import type { SlidevConfig } from '@slidev/types'
|
|
6
|
+
|
|
7
|
+
const configs: SlidevConfig
|
|
8
|
+
export default configs
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module '#slidev/global-components/top' {
|
|
12
|
+
import type { ComponentOptions } from 'vue'
|
|
13
|
+
|
|
14
|
+
const component: ComponentOptions
|
|
15
|
+
export default component
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare module '#slidev/global-components/bottom' {
|
|
19
|
+
import type { ComponentOptions } from 'vue'
|
|
20
|
+
|
|
21
|
+
const component: ComponentOptions
|
|
22
|
+
export default component
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare module '#slidev/slides' {
|
|
26
|
+
import type { ShallowRef } from 'vue'
|
|
27
|
+
import type { SlideRoute } from '@slidev/types'
|
|
28
|
+
|
|
29
|
+
const slides: ShallowRef<SlideRoute[]>
|
|
30
|
+
export { slides }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare module '#slidev/titles.md' {
|
|
34
|
+
import type { ComponentOptions } from 'vue'
|
|
35
|
+
|
|
36
|
+
const component: ComponentOptions
|
|
37
|
+
export default component
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare module '#slidev/custom-nav-controls' {
|
|
41
|
+
import type { ComponentOptions } from 'vue'
|
|
42
|
+
|
|
43
|
+
const component: ComponentOptions
|
|
44
|
+
export default component
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare module '#slidev/shiki' {
|
|
48
|
+
import type { ShikiHighlighterCore } from 'shiki/core'
|
|
49
|
+
import type { BundledLanguage, BundledTheme } from 'shiki'
|
|
50
|
+
|
|
51
|
+
export { shikiToMonaco } from '@shikijs/monaco'
|
|
52
|
+
|
|
53
|
+
export const langs: BundledLanguage[]
|
|
54
|
+
export const themes: BundledTheme | Record<string, BundledTheme>
|
|
55
|
+
export const shiki: Promise<ShikiHighlighterCore>
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare module '#slidev/styles' {
|
|
59
|
+
// side-effects only
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare module '#slidev/monaco-types' {
|
|
63
|
+
// side-effects only
|
|
5
64
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComputedRef } from '@vue/reactivity';
|
|
2
|
+
import { RouteMeta, RouteComponent, Router } from 'vue-router';
|
|
2
3
|
import { TransitionGroupProps, App, Ref } from 'vue';
|
|
3
4
|
import { Awaitable } from '@antfu/utils';
|
|
4
5
|
import * as monaco from 'monaco-editor';
|
|
5
|
-
import { Router } from 'vue-router';
|
|
6
6
|
import mermaid from 'mermaid';
|
|
7
7
|
import { KatexOptions } from 'katex';
|
|
8
8
|
import { CodeToHastOptions, Highlighter } from 'shiki';
|
|
@@ -13,16 +13,16 @@ interface CommonArgs {
|
|
|
13
13
|
theme?: string;
|
|
14
14
|
}
|
|
15
15
|
interface ExportArgs extends CommonArgs {
|
|
16
|
-
output?: string;
|
|
17
|
-
format?: string;
|
|
18
|
-
timeout?: number;
|
|
19
|
-
range?: string;
|
|
20
|
-
dark?: boolean;
|
|
16
|
+
'output'?: string;
|
|
17
|
+
'format'?: string;
|
|
18
|
+
'timeout'?: number;
|
|
19
|
+
'range'?: string;
|
|
20
|
+
'dark'?: boolean;
|
|
21
21
|
'with-clicks'?: boolean;
|
|
22
22
|
'executable-path'?: string;
|
|
23
23
|
'with-toc'?: boolean;
|
|
24
24
|
'per-slide'?: boolean;
|
|
25
|
-
scale?: number;
|
|
25
|
+
'scale'?: number;
|
|
26
26
|
}
|
|
27
27
|
interface BuildArgs extends ExportArgs {
|
|
28
28
|
watch: boolean;
|
|
@@ -67,6 +67,21 @@ interface SlidevConfig {
|
|
|
67
67
|
* @default 'dev'
|
|
68
68
|
*/
|
|
69
69
|
monaco: boolean | 'dev' | 'build';
|
|
70
|
+
/**
|
|
71
|
+
* Where to load monaco types from
|
|
72
|
+
*
|
|
73
|
+
* - `cdn` - load from CDN with `@typescript/ata`
|
|
74
|
+
* - `local` - load from local node_modules
|
|
75
|
+
*
|
|
76
|
+
* @default 'local'
|
|
77
|
+
*/
|
|
78
|
+
monacoTypesSource: 'cdn' | 'local' | 'none';
|
|
79
|
+
/**
|
|
80
|
+
* Additional node packages to load as monaco types
|
|
81
|
+
*
|
|
82
|
+
* @default []
|
|
83
|
+
*/
|
|
84
|
+
monacoTypesAdditionalPackages: string[];
|
|
70
85
|
/**
|
|
71
86
|
* Show a download button in the SPA build,
|
|
72
87
|
* could also be a link to custom pdf
|
|
@@ -341,29 +356,43 @@ type BuiltinSlideTransition = 'slide-up' | 'slide-down' | 'slide-left' | 'slide-
|
|
|
341
356
|
|
|
342
357
|
type FrontmatterStyle = 'frontmatter' | 'yaml';
|
|
343
358
|
interface SlideInfoBase {
|
|
344
|
-
|
|
359
|
+
frontmatter: Record<string, any>;
|
|
345
360
|
content: string;
|
|
346
361
|
note?: string;
|
|
347
|
-
frontmatter: Record<string, any>;
|
|
348
|
-
frontmatterRaw?: string;
|
|
349
|
-
frontmatterStyle?: FrontmatterStyle;
|
|
350
362
|
title?: string;
|
|
351
363
|
level?: number;
|
|
352
364
|
}
|
|
353
|
-
interface
|
|
365
|
+
interface SourceSlideInfo extends SlideInfoBase {
|
|
366
|
+
/**
|
|
367
|
+
* The filepath of the markdown file
|
|
368
|
+
*/
|
|
369
|
+
filepath: string;
|
|
370
|
+
/**
|
|
371
|
+
* The index of the slide in the markdown file
|
|
372
|
+
*/
|
|
354
373
|
index: number;
|
|
374
|
+
/**
|
|
375
|
+
* The range of the slide in the markdown file
|
|
376
|
+
*/
|
|
355
377
|
start: number;
|
|
356
378
|
end: number;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}
|
|
361
|
-
interface SlideInfoWithPath extends SlideInfo {
|
|
362
|
-
filepath: string;
|
|
379
|
+
raw: string;
|
|
380
|
+
frontmatterRaw?: string;
|
|
381
|
+
frontmatterStyle?: FrontmatterStyle;
|
|
363
382
|
}
|
|
364
|
-
interface
|
|
365
|
-
|
|
383
|
+
interface SlideInfo extends SlideInfoBase {
|
|
384
|
+
/**
|
|
385
|
+
* The index of the slide in the presentation
|
|
386
|
+
*/
|
|
387
|
+
index: number;
|
|
388
|
+
source: SourceSlideInfo;
|
|
389
|
+
snippetsUsed?: LoadedSnippets;
|
|
390
|
+
noteHTML?: string;
|
|
366
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* Editable fields for a slide
|
|
394
|
+
*/
|
|
395
|
+
type SlidePatch = Partial<Pick<SlideInfoBase, 'content' | 'note'>>;
|
|
367
396
|
/**
|
|
368
397
|
* Metadata for "slidev" field in themes' package.json
|
|
369
398
|
*/
|
|
@@ -380,24 +409,38 @@ interface SlidevFeatureFlags {
|
|
|
380
409
|
mermaid: boolean;
|
|
381
410
|
}
|
|
382
411
|
interface SlidevMarkdown {
|
|
383
|
-
|
|
412
|
+
filepath: string;
|
|
384
413
|
raw: string;
|
|
414
|
+
/**
|
|
415
|
+
* All slides in this markdown file
|
|
416
|
+
*/
|
|
417
|
+
slides: SourceSlideInfo[];
|
|
418
|
+
}
|
|
419
|
+
interface SlidevData {
|
|
420
|
+
/**
|
|
421
|
+
* Slides that should be rendered (disabled slides excluded)
|
|
422
|
+
*/
|
|
423
|
+
slides: SlideInfo[];
|
|
424
|
+
entry: SlidevMarkdown;
|
|
385
425
|
config: SlidevConfig;
|
|
386
|
-
features: SlidevFeatureFlags;
|
|
387
426
|
headmatter: Record<string, unknown>;
|
|
388
|
-
|
|
389
|
-
entries?: string[];
|
|
427
|
+
features: SlidevFeatureFlags;
|
|
390
428
|
themeMeta?: SlidevThemeMeta;
|
|
391
|
-
|
|
429
|
+
markdownFiles: Record<string, SlidevMarkdown>;
|
|
430
|
+
watchFiles: string[];
|
|
392
431
|
}
|
|
393
432
|
interface SlidevPreparserExtension {
|
|
394
433
|
name: string;
|
|
395
434
|
transformRawLines?: (lines: string[]) => Promise<void> | void;
|
|
396
435
|
transformSlide?: (content: string, frontmatter: any) => Promise<string | undefined>;
|
|
397
436
|
}
|
|
398
|
-
type PreparserExtensionLoader = (headmatter?: Record<string, unknown>, filepath?: string) => Promise<SlidevPreparserExtension[]>;
|
|
399
|
-
type
|
|
400
|
-
|
|
437
|
+
type PreparserExtensionLoader = (headmatter?: Record<string, unknown>, filepath?: string, mode?: string) => Promise<SlidevPreparserExtension[]>;
|
|
438
|
+
type RenderContext = 'none' | 'slide' | 'overview' | 'presenter' | 'previewNext';
|
|
439
|
+
interface SlideRoute {
|
|
440
|
+
no: number;
|
|
441
|
+
meta: RouteMeta;
|
|
442
|
+
component: () => Promise<RouteComponent>;
|
|
443
|
+
}
|
|
401
444
|
type LoadedSnippets = Record<string, string>;
|
|
402
445
|
type ClicksElement = Element | string;
|
|
403
446
|
type ClicksRelativeEls = Map<ClicksElement, number>;
|
|
@@ -439,8 +482,8 @@ interface ClicksInfo {
|
|
|
439
482
|
type ResolvedClicksInfo = Required<ClicksInfo>;
|
|
440
483
|
type ClicksMap = Map<ClicksElement, ClicksInfo>;
|
|
441
484
|
interface ClicksContext {
|
|
485
|
+
current: number;
|
|
442
486
|
readonly disabled: boolean;
|
|
443
|
-
readonly current: number;
|
|
444
487
|
readonly relativeOffsets: ClicksRelativeEls;
|
|
445
488
|
readonly map: ClicksMap;
|
|
446
489
|
resolve: (at: string | number, size?: number) => {
|
|
@@ -459,10 +502,6 @@ interface AppContext {
|
|
|
459
502
|
router: Router;
|
|
460
503
|
}
|
|
461
504
|
interface MonacoSetupReturn {
|
|
462
|
-
theme?: {
|
|
463
|
-
light?: string;
|
|
464
|
-
dark?: string;
|
|
465
|
-
};
|
|
466
505
|
editorOptions?: monaco.editor.IEditorOptions;
|
|
467
506
|
}
|
|
468
507
|
type MermaidOptions = (typeof mermaid.initialize) extends (a: infer A) => any ? A : never;
|
|
@@ -501,7 +540,7 @@ type ShikiSetup = (shiki: ShikiContext) => Awaitable<ShikiSetupReturn | void>;
|
|
|
501
540
|
type KatexSetup = () => Awaitable<Partial<KatexOptions> | void>;
|
|
502
541
|
type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | void>;
|
|
503
542
|
type PreparserSetup = (filepath: string) => SlidevPreparserExtension;
|
|
504
|
-
type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn>;
|
|
543
|
+
type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn | void>;
|
|
505
544
|
type AppSetup = (context: AppContext) => Awaitable<void>;
|
|
506
545
|
type MermaidSetup = () => Partial<MermaidOptions> | void;
|
|
507
546
|
type ShortcutsSetup = (nav: NavOperations, defaultShortcuts: ShortcutOptions[]) => Array<ShortcutOptions>;
|
|
@@ -515,6 +554,7 @@ declare function defineShortcutsSetup(fn: ShortcutsSetup): ShortcutsSetup;
|
|
|
515
554
|
declare function definePreparserSetup(fn: PreparserSetup): PreparserSetup;
|
|
516
555
|
|
|
517
556
|
interface TocItem {
|
|
557
|
+
no: number;
|
|
518
558
|
active?: boolean;
|
|
519
559
|
activeParent?: boolean;
|
|
520
560
|
children: TocItem[];
|
|
@@ -525,4 +565,18 @@ interface TocItem {
|
|
|
525
565
|
title?: string;
|
|
526
566
|
}
|
|
527
567
|
|
|
528
|
-
|
|
568
|
+
declare module 'vite' {
|
|
569
|
+
interface CustomEventMap {
|
|
570
|
+
'slidev:update-slide': {
|
|
571
|
+
id: number;
|
|
572
|
+
data: SlideInfo;
|
|
573
|
+
};
|
|
574
|
+
'slidev:update-note': {
|
|
575
|
+
id: number;
|
|
576
|
+
note: string;
|
|
577
|
+
noteHTML: string;
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
export { type AppContext, type AppSetup, type BuildArgs, type BuiltinSlideTransition, type ClicksContext, type ClicksElement, type ClicksInfo, type ClicksMap, type ClicksRelativeEls, type CommonArgs, type DrawingsOptions, type ExportArgs, type FontOptions, type FrontmatterStyle, type KatexSetup, type LoadedSnippets, type MermaidOptions, type MermaidSetup, type MonacoSetup, type MonacoSetupReturn, type NavOperations, type PreparserExtensionLoader, type PreparserSetup, type RenderContext, type ResolvedClicksInfo, type ResolvedDrawingsOptions, type ResolvedExportOptions, type ResolvedFontOptions, type ShikiContext, type ShikiSetup, type ShikiSetupReturn, type ShortcutOptions, type ShortcutsSetup, type SlideInfo, type SlideInfoBase, type SlidePatch, type SlideRoute, type SlidevConfig, type SlidevData, type SlidevFeatureFlags, type SlidevMarkdown, type SlidevPreparserExtension, type SlidevThemeConfig, type SlidevThemeMeta, type SourceSlideInfo, type TocItem, type UnoSetup, defineAppSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineShikiSetup, defineShortcutsSetup, defineUnoSetup };
|