@slidev/types 0.49.0-beta.3 → 0.49.0-beta.5

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
@@ -118,3 +118,8 @@ declare module '#slidev/styles' {
118
118
  declare module '#slidev/monaco-types' {
119
119
  // side-effects only
120
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
@@ -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[];
@@ -467,8 +479,10 @@ type PreparserExtensionLoader = (headmatter?: Record<string, unknown>, filepath?
467
479
  type RenderContext = 'none' | 'slide' | 'overview' | 'presenter' | 'previewNext';
468
480
  interface SlideRoute {
469
481
  no: number;
470
- meta: RouteMeta;
471
- component: () => Promise<RouteComponent>;
482
+ meta: RouteMeta & Required<Pick<RouteMeta, 'slide'>>;
483
+ component: () => Promise<{
484
+ default: RouteComponent;
485
+ }>;
472
486
  }
473
487
  type LoadedSnippets = Record<string, string>;
474
488
 
@@ -481,10 +495,6 @@ interface CodeRunnerContext {
481
495
  * Highlight code with shiki.
482
496
  */
483
497
  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
498
  /**
489
499
  * Use (other) code runner to run code.
490
500
  */
@@ -705,14 +715,17 @@ declare module 'vite' {
705
715
 
706
716
  interface MarkdownTransformContext {
707
717
  s: MagicString;
708
- ignores: [number, number][];
709
- isIgnored: (index: number) => boolean;
718
+ id: string;
719
+ options: ResolvedSlidevOptions;
710
720
  }
721
+ type MarkdownTransformer = (ctx: MarkdownTransformContext) => void;
711
722
 
712
- type RawAtValue = undefined | boolean | string | number | [string | number, string | number];
713
- type NormalizedSinceClickValue = number | string;
714
- type NormalizedRangeClickValue = [number, number] | [number, string] | [string, number] | [string, string];
715
- type NormalizedAtValue = NormalizedSinceClickValue | NormalizedRangeClickValue | null;
723
+ type RawSingleAtValue = null | undefined | boolean | string | number;
724
+ type RawRangeAtValue = null | undefined | false | [string | number, string | number];
725
+ type RawAtValue = RawSingleAtValue | RawRangeAtValue;
726
+ type NormalizedSingleClickValue = number | string | null;
727
+ type NormalizedRangeClickValue = [number, number] | [number, string] | [string, number] | [string, string] | [string | number, string | number] | null;
728
+ type NormalizedAtValue = NormalizedSingleClickValue | NormalizedRangeClickValue;
716
729
  type ClicksElement = Element | string;
717
730
  interface ClicksInfo {
718
731
  /**
@@ -732,7 +745,11 @@ interface ClicksInfo {
732
745
  */
733
746
  delta: number;
734
747
  /**
735
- * Computed ref of whether the click is exactly matched
748
+ * currentClicks - start
749
+ */
750
+ currentOffset: ComputedRef<number>;
751
+ /**
752
+ * currentOffset === 0
736
753
  */
737
754
  isCurrent: ComputedRef<boolean>;
738
755
  /**
@@ -745,14 +762,14 @@ interface ClicksContext {
745
762
  readonly clicksStart: number;
746
763
  readonly relativeOffsets: Map<ClicksElement, number>;
747
764
  readonly maxMap: Map<ClicksElement, number>;
748
- calculateSince: (at: NormalizedSinceClickValue, size?: number) => ClicksInfo;
749
- calculateRange: (at: NormalizedRangeClickValue) => ClicksInfo;
750
- calculate: (at: NormalizedAtValue) => ClicksInfo | null;
751
- register: (el: ClicksElement, info: Pick<ClicksInfo, 'delta' | 'max'>) => void;
765
+ calculateSince: (at: RawSingleAtValue, size?: number) => ClicksInfo | null;
766
+ calculateRange: (at: RawRangeAtValue) => ClicksInfo | null;
767
+ calculate: (at: RawAtValue) => ClicksInfo | null;
768
+ register: (el: ClicksElement, info: Pick<ClicksInfo, 'delta' | 'max'> | null) => void;
752
769
  unregister: (el: ClicksElement) => void;
753
770
  onMounted: () => void;
754
771
  readonly currentOffset: number;
755
772
  readonly total: number;
756
773
  }
757
774
 
758
- 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 RoutesSetup, 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, defineRootSetup, defineRoutesSetup, defineShikiSetup, defineShortcutsSetup, defineUnoSetup };
775
+ 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 NormalizedSingleClickValue, type PreparserExtensionLoader, type PreparserSetup, type RawAtValue, type RawRangeAtValue, type RawSingleAtValue, 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/types",
3
- "version": "0.49.0-beta.3",
3
+ "version": "0.49.0-beta.5",
4
4
  "description": "Shared types declarations for Slidev",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -28,15 +28,15 @@
28
28
  "@vitejs/plugin-vue-jsx": "^3.1.0",
29
29
  "katex": "^0.16.10",
30
30
  "mermaid": "^10.9.0",
31
- "monaco-editor": "^0.47.0",
32
- "shiki": "^1.3.0",
33
- "unocss": "^0.59.2",
34
- "unplugin-icons": "^0.18.5",
35
- "unplugin-vue-markdown": "^0.26.0",
31
+ "monaco-editor": "^0.48.0",
32
+ "shiki": "^1.4.0",
33
+ "unocss": "^0.59.4",
34
+ "unplugin-icons": "^0.19.0",
35
+ "unplugin-vue-markdown": "^0.26.2",
36
36
  "vite-plugin-remote-assets": "^0.4.1",
37
37
  "vite-plugin-vue-server-ref": "^0.4.2",
38
- "vue": "^3.4.21",
39
- "vue-router": "^4.3.0"
38
+ "vue": "^3.4.26",
39
+ "vue-router": "^4.3.2"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsup src/index.ts",