@slidev/types 0.49.0-beta.2 → 0.49.0-beta.4

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
@@ -97,6 +97,13 @@ declare module '#slidev/setups/shortcuts' {
97
97
  export default setups
98
98
  }
99
99
 
100
+ declare module '#slidev/setups/routes' {
101
+ import type { RoutesSetup } from '@slidev/types'
102
+
103
+ const setups: RoutesSetup[]
104
+ export default setups
105
+ }
106
+
100
107
  declare module '#slidev/setups/context-menu' {
101
108
  import type { ContextMenuSetup } from '@slidev/types'
102
109
 
@@ -111,3 +118,8 @@ declare module '#slidev/styles' {
111
118
  declare module '#slidev/monaco-types' {
112
119
  // side-effects only
113
120
  }
121
+
122
+ declare module '#slidev/monaco-run-deps' {
123
+ const modules: Recored<string, unknown>
124
+ export default modules
125
+ }
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { RouteMeta, RouteComponent, Router } from 'vue-router';
1
+ import { RouteMeta, RouteComponent, Router, RouteRecordRaw } from 'vue-router';
2
2
  import YAML from 'yaml';
3
3
  import { TransitionGroupProps, Component, App, Ref, ComputedRef } from 'vue';
4
4
  import { Arrayable, Awaitable, ArgumentsType } from '@antfu/utils';
@@ -14,7 +14,7 @@ import Components from 'unplugin-vue-components/vite';
14
14
  import Markdown from 'unplugin-vue-markdown/vite';
15
15
  import RemoteAssets from 'vite-plugin-remote-assets';
16
16
  import ServerRef from 'vite-plugin-vue-server-ref';
17
- import MagicString from 'magic-string';
17
+ import MagicString from 'magic-string-stack';
18
18
 
19
19
  interface CommonArgs {
20
20
  entry: string;
@@ -91,6 +91,12 @@ interface SlidevConfig {
91
91
  * @default []
92
92
  */
93
93
  monacoTypesAdditionalPackages: string[];
94
+ /**
95
+ * Additional local modules to load as dependencies of monaco runnable
96
+ *
97
+ * @default []
98
+ */
99
+ monacoRunAdditionalDeps: string[];
94
100
  /**
95
101
  * Show a download button in the SPA build,
96
102
  * could also be a link to custom pdf
@@ -123,7 +129,7 @@ interface SlidevConfig {
123
129
  * @see https://sli.dev/custom/highlighters.html
124
130
  * @default shiki
125
131
  */
126
- highlighter: 'prism' | 'shiki';
132
+ highlighter: 'shiki' | 'prism';
127
133
  /**
128
134
  * Enable Twoslash
129
135
  *
@@ -431,9 +437,15 @@ interface SlidevThemeMeta {
431
437
  highlighter?: 'prism' | 'shiki' | 'both';
432
438
  }
433
439
  type SlidevThemeConfig = Record<string, string | number>;
434
- interface SlidevFeatureFlags {
440
+ interface SlidevDetectedFeatures {
435
441
  katex: boolean;
436
- monaco: boolean;
442
+ /**
443
+ * `false` or referenced module specifiers
444
+ */
445
+ monaco: false | {
446
+ types: string[];
447
+ deps: string[];
448
+ };
437
449
  tweet: boolean;
438
450
  mermaid: boolean;
439
451
  }
@@ -453,7 +465,7 @@ interface SlidevData {
453
465
  entry: SlidevMarkdown;
454
466
  config: SlidevConfig;
455
467
  headmatter: Record<string, unknown>;
456
- features: SlidevFeatureFlags;
468
+ features: SlidevDetectedFeatures;
457
469
  themeMeta?: SlidevThemeMeta;
458
470
  markdownFiles: Record<string, SlidevMarkdown>;
459
471
  watchFiles: string[];
@@ -481,10 +493,6 @@ interface CodeRunnerContext {
481
493
  * Highlight code with shiki.
482
494
  */
483
495
  highlight: (code: string, lang: string, options?: Partial<CodeToHastOptions>) => Promise<string>;
484
- /**
485
- * Resolve the import path of a module.
486
- */
487
- resolveId: (specifer: string) => Promise<string | null>;
488
496
  /**
489
497
  * Use (other) code runner to run code.
490
498
  */
@@ -591,6 +599,7 @@ type PreparserSetup = (filepath: string) => SlidevPreparserExtension;
591
599
  type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn | void>;
592
600
  type AppSetup = (context: AppContext) => Awaitable<void>;
593
601
  type RootSetup = () => Awaitable<void>;
602
+ type RoutesSetup = (routes: RouteRecordRaw[]) => RouteRecordRaw[];
594
603
  type MermaidSetup = () => Partial<MermaidOptions> | void;
595
604
  type ShortcutsSetup = (nav: NavOperations, defaultShortcuts: ShortcutOptions[]) => Array<ShortcutOptions>;
596
605
  type CodeRunnersSetup = (runners: CodeRunnerProviders) => Awaitable<CodeRunnerProviders | void>;
@@ -599,6 +608,8 @@ declare const defineShikiSetup: (fn: ShikiSetup) => ShikiSetup;
599
608
  declare const defineUnoSetup: (fn: UnoSetup) => UnoSetup;
600
609
  declare const defineMonacoSetup: (fn: MonacoSetup) => MonacoSetup;
601
610
  declare const defineAppSetup: (fn: AppSetup) => AppSetup;
611
+ declare const defineRootSetup: (fn: RootSetup) => RootSetup;
612
+ declare const defineRoutesSetup: (fn: RoutesSetup) => RoutesSetup;
602
613
  declare const defineMermaidSetup: (fn: MermaidSetup) => MermaidSetup;
603
614
  declare const defineKatexSetup: (fn: KatexSetup) => KatexSetup;
604
615
  declare const defineShortcutsSetup: (fn: ShortcutsSetup) => ShortcutsSetup;
@@ -702,9 +713,10 @@ declare module 'vite' {
702
713
 
703
714
  interface MarkdownTransformContext {
704
715
  s: MagicString;
705
- ignores: [number, number][];
706
- isIgnored: (index: number) => boolean;
716
+ id: string;
717
+ options: ResolvedSlidevOptions;
707
718
  }
719
+ type MarkdownTransformer = (ctx: MarkdownTransformContext) => void;
708
720
 
709
721
  type RawAtValue = undefined | boolean | string | number | [string | number, string | number];
710
722
  type NormalizedSinceClickValue = number | string;
@@ -752,4 +764,4 @@ interface ClicksContext {
752
764
  readonly total: number;
753
765
  }
754
766
 
755
- 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 MermaidOptions, type MermaidSetup, type MonacoSetup, type MonacoSetupReturn, type NavOperations, type NormalizedAtValue, type NormalizedRangeClickValue, type NormalizedSinceClickValue, type PreparserExtensionLoader, type PreparserSetup, type RawAtValue, type RenderContext, 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, defineContextMenuSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineShikiSetup, defineShortcutsSetup, defineUnoSetup };
767
+ 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 MermaidOptions, type MermaidSetup, type MonacoSetup, type MonacoSetupReturn, type NavOperations, type NormalizedAtValue, type NormalizedRangeClickValue, type NormalizedSinceClickValue, type PreparserExtensionLoader, type PreparserSetup, type RawAtValue, type RenderContext, type ResolvedDrawingsOptions, type ResolvedExportOptions, type ResolvedFontOptions, type ResolvedSlidevOptions, 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 };
package/dist/index.mjs CHANGED
@@ -6,6 +6,8 @@ var defineShikiSetup = defineSetup;
6
6
  var defineUnoSetup = defineSetup;
7
7
  var defineMonacoSetup = defineSetup;
8
8
  var defineAppSetup = defineSetup;
9
+ var defineRootSetup = defineSetup;
10
+ var defineRoutesSetup = defineSetup;
9
11
  var defineMermaidSetup = defineSetup;
10
12
  var defineKatexSetup = defineSetup;
11
13
  var defineShortcutsSetup = defineSetup;
@@ -20,6 +22,8 @@ export {
20
22
  defineMermaidSetup,
21
23
  defineMonacoSetup,
22
24
  definePreparserSetup,
25
+ defineRootSetup,
26
+ defineRoutesSetup,
23
27
  defineShikiSetup,
24
28
  defineShortcutsSetup,
25
29
  defineUnoSetup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/types",
3
- "version": "0.49.0-beta.2",
3
+ "version": "0.49.0-beta.4",
4
4
  "description": "Shared types declarations for Slidev",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -30,12 +30,12 @@
30
30
  "mermaid": "^10.9.0",
31
31
  "monaco-editor": "^0.47.0",
32
32
  "shiki": "^1.3.0",
33
- "unocss": "^0.59.2",
33
+ "unocss": "^0.59.3",
34
34
  "unplugin-icons": "^0.18.5",
35
- "unplugin-vue-markdown": "^0.26.0",
35
+ "unplugin-vue-markdown": "^0.26.1",
36
36
  "vite-plugin-remote-assets": "^0.4.1",
37
37
  "vite-plugin-vue-server-ref": "^0.4.2",
38
- "vue": "^3.4.21",
38
+ "vue": "^3.4.22",
39
39
  "vue-router": "^4.3.0"
40
40
  },
41
41
  "scripts": {