@slidev/types 0.48.0-beta.24 → 0.48.0-beta.25

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 CHANGED
@@ -30,7 +30,7 @@ declare module '#slidev/slides' {
30
30
  export { slides }
31
31
  }
32
32
 
33
- declare module '#slidev/titles.md' {
33
+ declare module '#slidev/title-renderer' {
34
34
  import type { ComponentOptions } from 'vue'
35
35
 
36
36
  const component: ComponentOptions
@@ -55,6 +55,48 @@ declare module '#slidev/shiki' {
55
55
  export const shiki: Promise<ShikiHighlighterCore>
56
56
  }
57
57
 
58
+ declare module '#slidev/setups/monaco' {
59
+ import type { MonacoSetup } from '@slidev/types'
60
+
61
+ const setups: MonacoSetup[]
62
+ export default setups
63
+ }
64
+
65
+ declare module '#slidev/setups/code-runners' {
66
+ import type { CodeRunnersSetup } from '@slidev/types'
67
+
68
+ const setups: CodeRunnersSetup[]
69
+ export default setups
70
+ }
71
+
72
+ declare module '#slidev/setups/mermaid' {
73
+ import type { MermaidSetup } from '@slidev/types'
74
+
75
+ const setups: MermaidSetup[]
76
+ export default setups
77
+ }
78
+
79
+ declare module '#slidev/setups/main' {
80
+ import type { AppSetup } from '@slidev/types'
81
+
82
+ const setups: AppSetup[]
83
+ export default setups
84
+ }
85
+
86
+ declare module '#slidev/setups/root' {
87
+ import type { RootSetup } from '@slidev/types'
88
+
89
+ const setups: RootSetup[]
90
+ export default setups
91
+ }
92
+
93
+ declare module '#slidev/setups/shortcuts' {
94
+ import type { ShortcutsSetup } from '@slidev/types'
95
+
96
+ const setups: ShortcutsSetup[]
97
+ export default setups
98
+ }
99
+
58
100
  declare module '#slidev/styles' {
59
101
  // side-effects only
60
102
  }
package/dist/index.d.mts CHANGED
@@ -1,12 +1,18 @@
1
- import { ComputedRef } from '@vue/reactivity';
1
+ import { TransitionGroupProps, ComputedRef, App, Ref } from 'vue';
2
2
  import { RouteMeta, RouteComponent, Router } from 'vue-router';
3
- import { TransitionGroupProps, App, Ref } from 'vue';
4
- import { Arrayable, Awaitable } from '@antfu/utils';
3
+ import { Arrayable, Awaitable, ArgumentsType } from '@antfu/utils';
5
4
  import * as monaco from 'monaco-editor';
6
5
  import mermaid from 'mermaid';
7
6
  import { KatexOptions } from 'katex';
8
- import { CodeToHastOptions, Highlighter } from 'shiki';
7
+ import { CodeToHastOptions, CodeToHastOptionsCommon, BuiltinLanguage, CodeOptionsThemes, BuiltinTheme, CodeOptionsMeta, Highlighter, LanguageInput } from 'shiki';
9
8
  import { VitePluginConfig } from 'unocss/vite';
9
+ import Vue from '@vitejs/plugin-vue';
10
+ import VueJsx from '@vitejs/plugin-vue-jsx';
11
+ import Icons from 'unplugin-icons/vite';
12
+ import Components from 'unplugin-vue-components/vite';
13
+ import Markdown from 'unplugin-vue-markdown/vite';
14
+ import RemoteAssets from 'vite-plugin-remote-assets';
15
+ import ServerRef from 'vite-plugin-vue-server-ref';
10
16
 
11
17
  interface CommonArgs {
12
18
  entry: string;
@@ -499,8 +505,17 @@ interface ClicksContext {
499
505
  }
500
506
 
501
507
  interface CodeRunnerContext {
508
+ /**
509
+ * Options passed to runner via the `runnerOptions` prop.
510
+ */
502
511
  options: Record<string, unknown>;
512
+ /**
513
+ * Highlight code with shiki.
514
+ */
503
515
  highlight: (code: string, lang: string, options?: Partial<CodeToHastOptions>) => Promise<string>;
516
+ /**
517
+ * Use (other) code runner to run code.
518
+ */
504
519
  run: (code: string, lang: string) => Promise<CodeRunnerOutputs>;
505
520
  }
506
521
  interface CodeRunnerOutputHtml {
@@ -579,8 +594,9 @@ interface ShikiContext {
579
594
  */
580
595
  loadTheme: (path: string) => Promise<any>;
581
596
  }
582
- type ShikiSetupReturn = Partial<CodeToHastOptions> & {
597
+ type ShikiSetupReturn = Partial<Omit<CodeToHastOptionsCommon<BuiltinLanguage>, 'lang'>> & CodeOptionsThemes<BuiltinTheme> & CodeOptionsMeta & {
583
598
  setup?: (highlighter: Highlighter) => Awaitable<void>;
599
+ langs?: (LanguageInput | BuiltinLanguage)[];
584
600
  };
585
601
  type ShikiSetup = (shiki: ShikiContext) => Awaitable<ShikiSetupReturn | void>;
586
602
  type KatexSetup = () => Awaitable<Partial<KatexOptions> | void>;
@@ -588,6 +604,7 @@ type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | void>;
588
604
  type PreparserSetup = (filepath: string) => SlidevPreparserExtension;
589
605
  type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn | void>;
590
606
  type AppSetup = (context: AppContext) => Awaitable<void>;
607
+ type RootSetup = () => Awaitable<void>;
591
608
  type MermaidSetup = () => Partial<MermaidOptions> | void;
592
609
  type ShortcutsSetup = (nav: NavOperations, defaultShortcuts: ShortcutOptions[]) => Array<ShortcutOptions>;
593
610
  type CodeRunnersSetup = (runners: CodeRunnerProviders) => Awaitable<CodeRunnerProviders | void>;
@@ -627,4 +644,74 @@ declare module 'vite' {
627
644
  }
628
645
  }
629
646
 
630
- export { type AppContext, type AppSetup, type BuildArgs, type BuiltinSlideTransition, type ClicksContext, type ClicksElement, type ClicksInfo, type ClicksMap, type ClicksRelativeEls, 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 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, defineCodeRunnersSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineShikiSetup, defineShortcutsSetup, defineUnoSetup };
647
+ interface RootsInfo {
648
+ cliRoot: string;
649
+ clientRoot: string;
650
+ userRoot: string;
651
+ userPkgJson: Record<string, any>;
652
+ userWorkspaceRoot: string;
653
+ }
654
+ interface SlidevEntryOptions {
655
+ /**
656
+ * Markdown entry
657
+ *
658
+ * @default 'slides.md'
659
+ */
660
+ entry?: string;
661
+ /**
662
+ * Theme id
663
+ */
664
+ theme?: string;
665
+ /**
666
+ * Remote password
667
+ */
668
+ remote?: string;
669
+ /**
670
+ * Enable inspect plugin
671
+ */
672
+ inspect?: boolean;
673
+ }
674
+ interface ResolvedSlidevOptions extends RootsInfo {
675
+ data: SlidevData;
676
+ entry: string;
677
+ themeRaw: string;
678
+ theme: string;
679
+ themeRoots: string[];
680
+ addonRoots: string[];
681
+ /**
682
+ * =`[...themeRoots, ...addonRoots, userRoot]` (`clientRoot` excluded)
683
+ */
684
+ roots: string[];
685
+ mode: 'dev' | 'build' | 'export';
686
+ remote?: string;
687
+ inspect?: boolean;
688
+ }
689
+ interface SlidevServerOptions {
690
+ /**
691
+ * @returns `false` if server should be restarted
692
+ */
693
+ loadData?: () => Promise<SlidevData | false>;
694
+ }
695
+
696
+ interface SlidevPluginOptions extends SlidevEntryOptions {
697
+ vue?: ArgumentsType<typeof Vue>[0];
698
+ vuejsx?: ArgumentsType<typeof VueJsx>[0];
699
+ markdown?: ArgumentsType<typeof Markdown>[0];
700
+ components?: ArgumentsType<typeof Components>[0];
701
+ icons?: ArgumentsType<typeof Icons>[0];
702
+ remoteAssets?: ArgumentsType<typeof RemoteAssets>[0];
703
+ serverRef?: ArgumentsType<typeof ServerRef>[0];
704
+ unocss?: VitePluginConfig;
705
+ }
706
+ declare module 'vite' {
707
+ interface UserConfig {
708
+ /**
709
+ * Custom internal plugin options for Slidev (advanced)
710
+ *
711
+ * @see https://github.com/slidevjs/slidev/blob/main/packages/slidev/node/options.ts#L50
712
+ */
713
+ slidev?: SlidevPluginOptions;
714
+ }
715
+ }
716
+
717
+ export { type AppContext, type AppSetup, type BuildArgs, type BuiltinSlideTransition, type ClicksContext, type ClicksElement, type ClicksInfo, type ClicksMap, type ClicksRelativeEls, 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 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 ResolvedSlidevOptions, type RootSetup, type RootsInfo, type ShikiContext, type ShikiSetup, type ShikiSetupReturn, type ShortcutOptions, type ShortcutsSetup, type SlideInfo, type SlideInfoBase, type SlidePatch, type SlideRoute, type SlidevConfig, type SlidevData, type SlidevEntryOptions, type SlidevFeatureFlags, type SlidevMarkdown, type SlidevPluginOptions, type SlidevPreparserExtension, type SlidevServerOptions, type SlidevThemeConfig, type SlidevThemeMeta, type SourceSlideInfo, type TocItem, type UnoSetup, defineAppSetup, defineCodeRunnersSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineShikiSetup, defineShortcutsSetup, defineUnoSetup };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/types",
3
- "version": "0.48.0-beta.24",
3
+ "version": "0.48.0-beta.25",
4
4
  "description": "Shared types declarations for Slidev",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -22,6 +22,22 @@
22
22
  "engines": {
23
23
  "node": ">=18.0.0"
24
24
  },
25
+ "dependencies": {
26
+ "@antfu/utils": "^0.7.7",
27
+ "@vitejs/plugin-vue": "^5.0.4",
28
+ "@vitejs/plugin-vue-jsx": "^3.1.0",
29
+ "katex": "^0.16.9",
30
+ "mermaid": "^10.9.0",
31
+ "monaco-editor": "^0.46.0",
32
+ "shiki": "^1.1.7",
33
+ "unocss": "^0.58.5",
34
+ "unplugin-icons": "^0.18.5",
35
+ "unplugin-vue-markdown": "^0.26.0",
36
+ "vite-plugin-remote-assets": "^0.4.1",
37
+ "vite-plugin-vue-server-ref": "^0.4.2",
38
+ "vue": "^3.4.21",
39
+ "vue-router": "^4.3.0"
40
+ },
25
41
  "scripts": {
26
42
  "build": "tsup src/index.ts",
27
43
  "dev": "nr build --watch"