@slidev/types 0.49.29 → 0.50.0-beta.10
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 +3 -3
- package/dist/index.d.mts +277 -264
- package/package.json +15 -15
package/client.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ declare module '#slidev/global-layers' {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
declare module '#slidev/slides' {
|
|
22
|
-
import type { ShallowRef } from 'vue'
|
|
23
22
|
import type { SlideRoute } from '@slidev/types'
|
|
23
|
+
import type { ShallowRef } from 'vue'
|
|
24
24
|
|
|
25
25
|
const slides: ShallowRef<SlideRoute[]>
|
|
26
26
|
export { slides }
|
|
@@ -41,12 +41,12 @@ declare module '#slidev/custom-nav-controls' {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
declare module '#slidev/shiki' {
|
|
44
|
-
import type { ShikiHighlighterCore } from 'shiki/core'
|
|
45
44
|
import type { BundledLanguage, BundledTheme, CodeToHastOptions } from 'shiki'
|
|
45
|
+
import type { ShikiHighlighterCore } from 'shiki/core'
|
|
46
46
|
|
|
47
47
|
export { shikiToMonaco } from '@shikijs/monaco'
|
|
48
48
|
|
|
49
|
-
export const
|
|
49
|
+
export const languages: BundledLanguage[]
|
|
50
50
|
export const themes: BundledTheme | Record<string, BundledTheme>
|
|
51
51
|
export const shiki: Promise<ShikiHighlighterCore>
|
|
52
52
|
export function getHighlighter(): Promise<(code: string, lang: string, options?: Partial<CodeToHastOptions>) => string>
|
package/dist/index.d.mts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter, Component, App, Ref } from 'vue';
|
|
2
|
+
import { Arrayable, Awaitable, ArgumentsType } from '@antfu/utils';
|
|
3
|
+
import { CodeToHastOptions, CodeToHastOptionsCommon, BuiltinLanguage, CodeOptionsThemes, BuiltinTheme, CodeOptionsMeta, Highlighter, LanguageInput } from 'shiki';
|
|
1
4
|
import { RouteMeta, RouteComponent, Router, RouteRecordRaw } from 'vue-router';
|
|
2
5
|
import YAML from 'yaml';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import * as monaco from 'monaco-editor';
|
|
6
|
+
import { MarkdownItShikiOptions } from '@shikijs/markdown-it/index.mjs';
|
|
7
|
+
import { HighlighterGeneric } from 'shiki/types.mjs';
|
|
6
8
|
import { KatexOptions } from 'katex';
|
|
7
|
-
import { CodeToHastOptions, CodeToHastOptionsCommon, BuiltinLanguage, CodeOptionsThemes, BuiltinTheme, CodeOptionsMeta, Highlighter, LanguageInput } from 'shiki';
|
|
8
|
-
import { VitePluginConfig } from 'unocss/vite';
|
|
9
9
|
import { MermaidConfig } from 'mermaid';
|
|
10
|
+
import * as monaco from 'monaco-editor';
|
|
11
|
+
import { VitePluginConfig } from 'unocss/vite';
|
|
10
12
|
import MagicString from 'magic-string-stack';
|
|
11
|
-
import { MarkdownItShikiOptions } from '@shikijs/markdown-it/index.mjs';
|
|
12
|
-
import { HighlighterGeneric } from 'shiki/types.mjs';
|
|
13
13
|
import Vue from '@vitejs/plugin-vue';
|
|
14
14
|
import VueJsx from '@vitejs/plugin-vue-jsx';
|
|
15
15
|
import Icons from 'unplugin-icons/vite';
|
|
16
16
|
import Components from 'unplugin-vue-components/vite';
|
|
17
17
|
import Markdown from 'unplugin-vue-markdown/vite';
|
|
18
|
+
import { ViteInspectOptions } from 'vite-plugin-inspect';
|
|
18
19
|
import RemoteAssets from 'vite-plugin-remote-assets';
|
|
19
|
-
import ServerRef from 'vite-plugin-vue-server-ref';
|
|
20
20
|
import { ViteStaticCopyOptions } from 'vite-plugin-static-copy';
|
|
21
|
-
import
|
|
21
|
+
import ServerRef from 'vite-plugin-vue-server-ref';
|
|
22
22
|
|
|
23
23
|
interface CommonArgs {
|
|
24
24
|
entry: string;
|
|
@@ -46,8 +46,245 @@ interface BuildArgs extends ExportArgs {
|
|
|
46
46
|
inspect: boolean;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
type RawSingleAtValue = null | undefined | boolean | string | number;
|
|
50
|
+
type RawRangeAtValue = null | undefined | false | [string | number, string | number];
|
|
51
|
+
type RawAtValue = RawSingleAtValue | RawRangeAtValue;
|
|
52
|
+
type NormalizedSingleClickValue = number | string | null;
|
|
53
|
+
type NormalizedRangeClickValue = [number, number] | [number, string] | [string, number] | [string, string] | [string | number, string | number] | null;
|
|
54
|
+
type NormalizedAtValue = NormalizedSingleClickValue | NormalizedRangeClickValue;
|
|
55
|
+
type ClicksElement = Element | string;
|
|
56
|
+
interface ClicksInfo {
|
|
57
|
+
/**
|
|
58
|
+
* The absolute start click num
|
|
59
|
+
*/
|
|
60
|
+
start: number;
|
|
61
|
+
/**
|
|
62
|
+
* The absolute end click num
|
|
63
|
+
*/
|
|
64
|
+
end: number;
|
|
65
|
+
/**
|
|
66
|
+
* The required total click num
|
|
67
|
+
*/
|
|
68
|
+
max: number;
|
|
69
|
+
/**
|
|
70
|
+
* The delta for relative clicks
|
|
71
|
+
*/
|
|
72
|
+
delta: number;
|
|
73
|
+
/**
|
|
74
|
+
* currentClicks - start
|
|
75
|
+
*/
|
|
76
|
+
currentOffset: ComputedRef<number>;
|
|
77
|
+
/**
|
|
78
|
+
* currentOffset === 0
|
|
79
|
+
*/
|
|
80
|
+
isCurrent: ComputedRef<boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* Computed ref of whether the click is active
|
|
83
|
+
*/
|
|
84
|
+
isActive: ComputedRef<boolean>;
|
|
85
|
+
}
|
|
86
|
+
interface ClicksContext {
|
|
87
|
+
current: number;
|
|
88
|
+
readonly clicksStart: number;
|
|
89
|
+
readonly relativeSizeMap: Map<ClicksElement, number>;
|
|
90
|
+
readonly maxMap: Map<ClicksElement, number>;
|
|
91
|
+
calculateSince: (at: RawSingleAtValue, size?: number) => ClicksInfo | null;
|
|
92
|
+
calculateRange: (at: RawRangeAtValue) => ClicksInfo | null;
|
|
93
|
+
calculate: (at: RawAtValue) => ClicksInfo | null;
|
|
94
|
+
register: (el: ClicksElement, info: Pick<ClicksInfo, 'delta' | 'max'> | null) => void;
|
|
95
|
+
unregister: (el: ClicksElement) => void;
|
|
96
|
+
readonly isMounted: boolean;
|
|
97
|
+
setup: () => void;
|
|
98
|
+
readonly currentOffset: number;
|
|
99
|
+
readonly total: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface CodeRunnerContext {
|
|
103
|
+
/**
|
|
104
|
+
* Options passed to runner via the `runnerOptions` prop.
|
|
105
|
+
*/
|
|
106
|
+
options: Record<string, unknown>;
|
|
107
|
+
/**
|
|
108
|
+
* Highlight code with shiki.
|
|
109
|
+
*/
|
|
110
|
+
highlight: (code: string, lang: string, options?: Partial<CodeToHastOptions>) => string;
|
|
111
|
+
/**
|
|
112
|
+
* Use (other) code runner to run code.
|
|
113
|
+
*/
|
|
114
|
+
run: (code: string, lang: string) => Promise<CodeRunnerOutputs>;
|
|
115
|
+
}
|
|
116
|
+
interface CodeRunnerOutputHtml {
|
|
117
|
+
/**
|
|
118
|
+
* The HTML to be rendered.
|
|
119
|
+
*
|
|
120
|
+
* Slidev does NOT sanitize the HTML for you - make sure it's from trusted sources or sanitize it before passing it in
|
|
121
|
+
*/
|
|
122
|
+
html: string;
|
|
123
|
+
}
|
|
124
|
+
interface CodeRunnerOutputDom {
|
|
125
|
+
/**
|
|
126
|
+
* The DOM element to be rendered.
|
|
127
|
+
*/
|
|
128
|
+
element: HTMLElement;
|
|
129
|
+
}
|
|
130
|
+
interface CodeRunnerOutputError {
|
|
131
|
+
/**
|
|
132
|
+
* The error message to be displayed.
|
|
133
|
+
*/
|
|
134
|
+
error: string;
|
|
135
|
+
}
|
|
136
|
+
interface CodeRunnerOutputText {
|
|
137
|
+
/**
|
|
138
|
+
* The text to be displayed.
|
|
139
|
+
*/
|
|
140
|
+
text: string;
|
|
141
|
+
/**
|
|
142
|
+
* The class to be applied to the text.
|
|
143
|
+
*/
|
|
144
|
+
class?: string;
|
|
145
|
+
/**
|
|
146
|
+
* The language to be highlighted.
|
|
147
|
+
*/
|
|
148
|
+
highlightLang?: string;
|
|
149
|
+
}
|
|
150
|
+
type CodeRunnerOutputTextArray = CodeRunnerOutputText[];
|
|
151
|
+
type CodeRunnerOutput = CodeRunnerOutputHtml | CodeRunnerOutputError | CodeRunnerOutputText | CodeRunnerOutputTextArray | CodeRunnerOutputDom;
|
|
152
|
+
type CodeRunnerOutputs = MaybeRefOrGetter<Arrayable<CodeRunnerOutput>>;
|
|
153
|
+
type CodeRunner = (code: string, ctx: CodeRunnerContext) => Awaitable<CodeRunnerOutputs>;
|
|
154
|
+
type CodeRunnerProviders = Record<string, CodeRunner>;
|
|
155
|
+
|
|
49
156
|
type BuiltinLayouts = '404' | 'center' | 'cover' | 'default' | 'end' | 'error' | 'fact' | 'full' | 'iframe-left' | 'iframe-right' | 'iframe' | 'image-left' | 'image-right' | 'image' | 'intro' | 'none' | 'quote' | 'section' | 'statement' | 'two-cols-header' | 'two-cols';
|
|
50
157
|
|
|
158
|
+
type FrontmatterStyle = 'frontmatter' | 'yaml';
|
|
159
|
+
interface SlideInfoBase {
|
|
160
|
+
revision: string;
|
|
161
|
+
frontmatter: Record<string, any>;
|
|
162
|
+
content: string;
|
|
163
|
+
frontmatterRaw?: string;
|
|
164
|
+
note?: string;
|
|
165
|
+
title?: string;
|
|
166
|
+
level?: number;
|
|
167
|
+
}
|
|
168
|
+
interface SourceSlideInfo extends SlideInfoBase {
|
|
169
|
+
/**
|
|
170
|
+
* The filepath of the markdown file
|
|
171
|
+
*/
|
|
172
|
+
filepath: string;
|
|
173
|
+
/**
|
|
174
|
+
* The index of the slide in the markdown file
|
|
175
|
+
*/
|
|
176
|
+
index: number;
|
|
177
|
+
/**
|
|
178
|
+
* The range of the slide in the markdown file
|
|
179
|
+
*/
|
|
180
|
+
start: number;
|
|
181
|
+
contentStart: number;
|
|
182
|
+
end: number;
|
|
183
|
+
raw: string;
|
|
184
|
+
/**
|
|
185
|
+
* Slides import by this slide.
|
|
186
|
+
*/
|
|
187
|
+
imports?: SourceSlideInfo[];
|
|
188
|
+
frontmatterDoc?: YAML.Document;
|
|
189
|
+
frontmatterStyle?: FrontmatterStyle;
|
|
190
|
+
}
|
|
191
|
+
interface SlideInfo extends SlideInfoBase {
|
|
192
|
+
/**
|
|
193
|
+
* The index of the slide in the presentation
|
|
194
|
+
*/
|
|
195
|
+
index: number;
|
|
196
|
+
/**
|
|
197
|
+
* The importers of this slide. `[]` if this slide is the entry markdown file
|
|
198
|
+
*/
|
|
199
|
+
importChain?: SourceSlideInfo[];
|
|
200
|
+
/**
|
|
201
|
+
* The source slide where the content is from
|
|
202
|
+
*/
|
|
203
|
+
source: SourceSlideInfo;
|
|
204
|
+
noteHTML?: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Editable fields for a slide
|
|
208
|
+
*/
|
|
209
|
+
type SlidePatch = Partial<Pick<SlideInfoBase, 'content' | 'note' | 'frontmatterRaw'>> & {
|
|
210
|
+
skipHmr?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* The frontmatter patch (only the changed fields)
|
|
213
|
+
* `null` to remove a field
|
|
214
|
+
*/
|
|
215
|
+
frontmatter?: Record<string, any>;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Metadata for "slidev" field in themes' package.json
|
|
219
|
+
*/
|
|
220
|
+
interface SlidevThemeMeta {
|
|
221
|
+
defaults?: Partial<SlidevConfig>;
|
|
222
|
+
colorSchema?: 'dark' | 'light' | 'both';
|
|
223
|
+
highlighter?: 'shiki';
|
|
224
|
+
}
|
|
225
|
+
type SlidevThemeConfig = Record<string, string | number>;
|
|
226
|
+
interface SlidevDetectedFeatures {
|
|
227
|
+
katex: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* `false` or referenced module specifiers
|
|
230
|
+
*/
|
|
231
|
+
monaco: false | {
|
|
232
|
+
types: string[];
|
|
233
|
+
deps: string[];
|
|
234
|
+
};
|
|
235
|
+
tweet: boolean;
|
|
236
|
+
mermaid: boolean;
|
|
237
|
+
}
|
|
238
|
+
interface SlidevMarkdown {
|
|
239
|
+
filepath: string;
|
|
240
|
+
raw: string;
|
|
241
|
+
/**
|
|
242
|
+
* All slides in this markdown file
|
|
243
|
+
*/
|
|
244
|
+
slides: SourceSlideInfo[];
|
|
245
|
+
errors?: {
|
|
246
|
+
row: number;
|
|
247
|
+
message: string;
|
|
248
|
+
}[];
|
|
249
|
+
}
|
|
250
|
+
interface SlidevData {
|
|
251
|
+
/**
|
|
252
|
+
* Slides that should be rendered (disabled slides excluded)
|
|
253
|
+
*/
|
|
254
|
+
slides: SlideInfo[];
|
|
255
|
+
entry: SlidevMarkdown;
|
|
256
|
+
config: SlidevConfig;
|
|
257
|
+
headmatter: Record<string, unknown>;
|
|
258
|
+
features: SlidevDetectedFeatures;
|
|
259
|
+
themeMeta?: SlidevThemeMeta;
|
|
260
|
+
markdownFiles: Record<string, SlidevMarkdown>;
|
|
261
|
+
/**
|
|
262
|
+
* From watched files to indexes of slides that must be reloaded regardless of the loaded content
|
|
263
|
+
*/
|
|
264
|
+
watchFiles: Record<string, Set<number>>;
|
|
265
|
+
}
|
|
266
|
+
interface SlidevPreparserExtension {
|
|
267
|
+
name?: string;
|
|
268
|
+
transformRawLines?: (lines: string[]) => Promise<void> | void;
|
|
269
|
+
transformSlide?: (content: string, frontmatter: any) => Promise<string | undefined>;
|
|
270
|
+
}
|
|
271
|
+
type PreparserExtensionLoader = (headmatter: Record<string, unknown>, filepath: string, mode?: string) => Promise<SlidevPreparserExtension[]>;
|
|
272
|
+
type RenderContext = 'none' | 'slide' | 'overview' | 'presenter' | 'previewNext';
|
|
273
|
+
interface SlideRoute {
|
|
274
|
+
no: number;
|
|
275
|
+
meta: RouteMeta & Required<Pick<RouteMeta, 'slide'>>;
|
|
276
|
+
/**
|
|
277
|
+
* load the slide component itself
|
|
278
|
+
*/
|
|
279
|
+
load: () => Promise<{
|
|
280
|
+
default: RouteComponent;
|
|
281
|
+
}>;
|
|
282
|
+
/**
|
|
283
|
+
* Wrapped async component
|
|
284
|
+
*/
|
|
285
|
+
component: Component;
|
|
286
|
+
}
|
|
287
|
+
|
|
51
288
|
interface Headmatter extends HeadmatterConfig, Frontmatter {
|
|
52
289
|
/**
|
|
53
290
|
* Default frontmatter options applied to all slides
|
|
@@ -69,7 +306,7 @@ interface HeadmatterConfig extends TransitionOptions {
|
|
|
69
306
|
/**
|
|
70
307
|
* Theme to use for the slides
|
|
71
308
|
*
|
|
72
|
-
* See https://sli.dev/
|
|
309
|
+
* See https://sli.dev/guide/theme-addon#use-theme
|
|
73
310
|
* @default 'default'
|
|
74
311
|
*/
|
|
75
312
|
theme?: string;
|
|
@@ -111,7 +348,7 @@ interface HeadmatterConfig extends TransitionOptions {
|
|
|
111
348
|
* See https://sli.dev/custom/config-highlighter.html
|
|
112
349
|
* @default shiki
|
|
113
350
|
*/
|
|
114
|
-
highlighter?: 'shiki'
|
|
351
|
+
highlighter?: 'shiki';
|
|
115
352
|
/**
|
|
116
353
|
* Enable Twoslash
|
|
117
354
|
*
|
|
@@ -257,6 +494,13 @@ interface HeadmatterConfig extends TransitionOptions {
|
|
|
257
494
|
* @default ''
|
|
258
495
|
*/
|
|
259
496
|
exportFilename?: string | null;
|
|
497
|
+
/**
|
|
498
|
+
* Use image snapshot for quick overview
|
|
499
|
+
*
|
|
500
|
+
* @experimental
|
|
501
|
+
* @default false
|
|
502
|
+
*/
|
|
503
|
+
overviewSnapshots?: boolean;
|
|
260
504
|
/**
|
|
261
505
|
* Enable Monaco
|
|
262
506
|
*
|
|
@@ -506,203 +750,34 @@ interface ResolvedExportOptions extends Omit<ExportArgs, 'entry' | 'theme'> {
|
|
|
506
750
|
withToc?: boolean;
|
|
507
751
|
}
|
|
508
752
|
|
|
509
|
-
type FrontmatterStyle = 'frontmatter' | 'yaml';
|
|
510
|
-
interface SlideInfoBase {
|
|
511
|
-
frontmatter: Record<string, any>;
|
|
512
|
-
content: string;
|
|
513
|
-
frontmatterRaw?: string;
|
|
514
|
-
note?: string;
|
|
515
|
-
title?: string;
|
|
516
|
-
level?: number;
|
|
517
|
-
}
|
|
518
|
-
interface SourceSlideInfo extends SlideInfoBase {
|
|
519
|
-
/**
|
|
520
|
-
* The filepath of the markdown file
|
|
521
|
-
*/
|
|
522
|
-
filepath: string;
|
|
523
|
-
/**
|
|
524
|
-
* The index of the slide in the markdown file
|
|
525
|
-
*/
|
|
526
|
-
index: number;
|
|
527
|
-
/**
|
|
528
|
-
* The range of the slide in the markdown file
|
|
529
|
-
*/
|
|
530
|
-
start: number;
|
|
531
|
-
contentStart: number;
|
|
532
|
-
end: number;
|
|
533
|
-
raw: string;
|
|
534
|
-
/**
|
|
535
|
-
* Slides import by this slide.
|
|
536
|
-
*/
|
|
537
|
-
imports?: SourceSlideInfo[];
|
|
538
|
-
frontmatterDoc?: YAML.Document;
|
|
539
|
-
frontmatterStyle?: FrontmatterStyle;
|
|
540
|
-
}
|
|
541
|
-
interface SlideInfo extends SlideInfoBase {
|
|
542
|
-
/**
|
|
543
|
-
* The index of the slide in the presentation
|
|
544
|
-
*/
|
|
545
|
-
index: number;
|
|
546
|
-
/**
|
|
547
|
-
* The importers of this slide. `[]` if this slide is the entry markdown file
|
|
548
|
-
*/
|
|
549
|
-
importChain?: SourceSlideInfo[];
|
|
550
|
-
/**
|
|
551
|
-
* The source slide where the content is from
|
|
552
|
-
*/
|
|
553
|
-
source: SourceSlideInfo;
|
|
554
|
-
noteHTML?: string;
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* Editable fields for a slide
|
|
558
|
-
*/
|
|
559
|
-
type SlidePatch = Partial<Pick<SlideInfoBase, 'content' | 'note' | 'frontmatterRaw'>> & {
|
|
560
|
-
skipHmr?: boolean;
|
|
561
|
-
/**
|
|
562
|
-
* The frontmatter patch (only the changed fields)
|
|
563
|
-
* `null` to remove a field
|
|
564
|
-
*/
|
|
565
|
-
frontmatter?: Record<string, any>;
|
|
566
|
-
};
|
|
567
|
-
/**
|
|
568
|
-
* Metadata for "slidev" field in themes' package.json
|
|
569
|
-
*/
|
|
570
|
-
interface SlidevThemeMeta {
|
|
571
|
-
defaults?: Partial<SlidevConfig>;
|
|
572
|
-
colorSchema?: 'dark' | 'light' | 'both';
|
|
573
|
-
highlighter?: 'prism' | 'shiki' | 'both';
|
|
574
|
-
}
|
|
575
|
-
type SlidevThemeConfig = Record<string, string | number>;
|
|
576
|
-
interface SlidevDetectedFeatures {
|
|
577
|
-
katex: boolean;
|
|
578
|
-
/**
|
|
579
|
-
* `false` or referenced module specifiers
|
|
580
|
-
*/
|
|
581
|
-
monaco: false | {
|
|
582
|
-
types: string[];
|
|
583
|
-
deps: string[];
|
|
584
|
-
};
|
|
585
|
-
tweet: boolean;
|
|
586
|
-
mermaid: boolean;
|
|
587
|
-
}
|
|
588
|
-
interface SlidevMarkdown {
|
|
589
|
-
filepath: string;
|
|
590
|
-
raw: string;
|
|
591
|
-
/**
|
|
592
|
-
* All slides in this markdown file
|
|
593
|
-
*/
|
|
594
|
-
slides: SourceSlideInfo[];
|
|
595
|
-
errors?: {
|
|
596
|
-
row: number;
|
|
597
|
-
message: string;
|
|
598
|
-
}[];
|
|
599
|
-
}
|
|
600
|
-
interface SlidevData {
|
|
601
|
-
/**
|
|
602
|
-
* Slides that should be rendered (disabled slides excluded)
|
|
603
|
-
*/
|
|
604
|
-
slides: SlideInfo[];
|
|
605
|
-
entry: SlidevMarkdown;
|
|
606
|
-
config: SlidevConfig;
|
|
607
|
-
headmatter: Record<string, unknown>;
|
|
608
|
-
features: SlidevDetectedFeatures;
|
|
609
|
-
themeMeta?: SlidevThemeMeta;
|
|
610
|
-
markdownFiles: Record<string, SlidevMarkdown>;
|
|
611
|
-
/**
|
|
612
|
-
* From watched files to indexes of slides that must be reloaded regardless of the loaded content
|
|
613
|
-
*/
|
|
614
|
-
watchFiles: Record<string, Set<number>>;
|
|
615
|
-
}
|
|
616
|
-
interface SlidevPreparserExtension {
|
|
617
|
-
name?: string;
|
|
618
|
-
transformRawLines?: (lines: string[]) => Promise<void> | void;
|
|
619
|
-
transformSlide?: (content: string, frontmatter: any) => Promise<string | undefined>;
|
|
620
|
-
}
|
|
621
|
-
type PreparserExtensionLoader = (headmatter: Record<string, unknown>, filepath: string, mode?: string) => Promise<SlidevPreparserExtension[]>;
|
|
622
|
-
type RenderContext = 'none' | 'slide' | 'overview' | 'presenter' | 'previewNext';
|
|
623
|
-
interface SlideRoute {
|
|
624
|
-
no: number;
|
|
625
|
-
meta: RouteMeta & Required<Pick<RouteMeta, 'slide'>>;
|
|
626
|
-
/**
|
|
627
|
-
* load the slide component itself
|
|
628
|
-
*/
|
|
629
|
-
load: () => Promise<{
|
|
630
|
-
default: RouteComponent;
|
|
631
|
-
}>;
|
|
632
|
-
/**
|
|
633
|
-
* Wrapped async component
|
|
634
|
-
*/
|
|
635
|
-
component: Component;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
interface CodeRunnerContext {
|
|
639
|
-
/**
|
|
640
|
-
* Options passed to runner via the `runnerOptions` prop.
|
|
641
|
-
*/
|
|
642
|
-
options: Record<string, unknown>;
|
|
643
|
-
/**
|
|
644
|
-
* Highlight code with shiki.
|
|
645
|
-
*/
|
|
646
|
-
highlight: (code: string, lang: string, options?: Partial<CodeToHastOptions>) => string;
|
|
647
|
-
/**
|
|
648
|
-
* Use (other) code runner to run code.
|
|
649
|
-
*/
|
|
650
|
-
run: (code: string, lang: string) => Promise<CodeRunnerOutputs>;
|
|
651
|
-
}
|
|
652
|
-
interface CodeRunnerOutputHtml {
|
|
653
|
-
/**
|
|
654
|
-
* The HTML to be rendered.
|
|
655
|
-
*
|
|
656
|
-
* Slidev does NOT sanitize the HTML for you - make sure it's from trusted sources or sanitize it before passing it in
|
|
657
|
-
*/
|
|
658
|
-
html: string;
|
|
659
|
-
}
|
|
660
|
-
interface CodeRunnerOutputDom {
|
|
661
|
-
/**
|
|
662
|
-
* The DOM element to be rendered.
|
|
663
|
-
*/
|
|
664
|
-
element: HTMLElement;
|
|
665
|
-
}
|
|
666
|
-
interface CodeRunnerOutputError {
|
|
667
|
-
/**
|
|
668
|
-
* The error message to be displayed.
|
|
669
|
-
*/
|
|
670
|
-
error: string;
|
|
671
|
-
}
|
|
672
|
-
interface CodeRunnerOutputText {
|
|
673
|
-
/**
|
|
674
|
-
* The text to be displayed.
|
|
675
|
-
*/
|
|
676
|
-
text: string;
|
|
677
|
-
/**
|
|
678
|
-
* The class to be applied to the text.
|
|
679
|
-
*/
|
|
680
|
-
class?: string;
|
|
681
|
-
/**
|
|
682
|
-
* The language to be highlighted.
|
|
683
|
-
*/
|
|
684
|
-
highlightLang?: string;
|
|
685
|
-
}
|
|
686
|
-
type CodeRunnerOutputTextArray = CodeRunnerOutputText[];
|
|
687
|
-
type CodeRunnerOutput = CodeRunnerOutputHtml | CodeRunnerOutputError | CodeRunnerOutputText | CodeRunnerOutputTextArray | CodeRunnerOutputDom;
|
|
688
|
-
type CodeRunnerOutputs = MaybeRefOrGetter<Arrayable<CodeRunnerOutput>>;
|
|
689
|
-
type CodeRunner = (code: string, ctx: CodeRunnerContext) => Awaitable<CodeRunnerOutputs>;
|
|
690
|
-
type CodeRunnerProviders = Record<string, CodeRunner>;
|
|
691
|
-
|
|
692
753
|
type ContextMenuOption = {
|
|
693
754
|
action: () => void;
|
|
694
755
|
disabled?: boolean;
|
|
695
756
|
} & ({
|
|
696
757
|
small?: false;
|
|
697
|
-
icon?: Component;
|
|
758
|
+
icon?: Component | string;
|
|
698
759
|
label: string | Component;
|
|
699
760
|
} | {
|
|
700
761
|
small: true;
|
|
701
|
-
icon: Component;
|
|
762
|
+
icon: Component | string;
|
|
702
763
|
label: string;
|
|
703
764
|
});
|
|
704
765
|
type ContextMenuItem = ContextMenuOption | 'separator';
|
|
705
766
|
|
|
767
|
+
declare module 'vite' {
|
|
768
|
+
interface CustomEventMap {
|
|
769
|
+
'slidev:update-slide': {
|
|
770
|
+
no: number;
|
|
771
|
+
data: SlideInfo;
|
|
772
|
+
};
|
|
773
|
+
'slidev:update-note': {
|
|
774
|
+
no: number;
|
|
775
|
+
note: string;
|
|
776
|
+
noteHTML: string;
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
706
781
|
interface RootsInfo {
|
|
707
782
|
cliRoot: string;
|
|
708
783
|
clientRoot: string;
|
|
@@ -727,6 +802,10 @@ interface SlidevEntryOptions {
|
|
|
727
802
|
* Enable inspect plugin
|
|
728
803
|
*/
|
|
729
804
|
inspect?: boolean;
|
|
805
|
+
/**
|
|
806
|
+
* Build with --download option
|
|
807
|
+
*/
|
|
808
|
+
download?: boolean;
|
|
730
809
|
}
|
|
731
810
|
interface ResolvedSlidevOptions extends RootsInfo, SlidevEntryOptions {
|
|
732
811
|
data: SlidevData;
|
|
@@ -744,6 +823,7 @@ interface ResolvedSlidevUtils {
|
|
|
744
823
|
shiki: HighlighterGeneric<any, any>;
|
|
745
824
|
shikiOptions: MarkdownItShikiOptions;
|
|
746
825
|
indexHtml: string;
|
|
826
|
+
define: Record<string, string>;
|
|
747
827
|
iconsResolvePath: string[];
|
|
748
828
|
isMonacoTypesIgnored: (pkg: string) => boolean;
|
|
749
829
|
getLayouts: () => Record<string, string>;
|
|
@@ -860,20 +940,6 @@ interface TocItem {
|
|
|
860
940
|
title?: string;
|
|
861
941
|
}
|
|
862
942
|
|
|
863
|
-
declare module 'vite' {
|
|
864
|
-
interface CustomEventMap {
|
|
865
|
-
'slidev:update-slide': {
|
|
866
|
-
no: number;
|
|
867
|
-
data: SlideInfo;
|
|
868
|
-
};
|
|
869
|
-
'slidev:update-note': {
|
|
870
|
-
no: number;
|
|
871
|
-
note: string;
|
|
872
|
-
noteHTML: string;
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
|
|
877
943
|
interface SlidevPluginOptions {
|
|
878
944
|
vue?: ArgumentsType<typeof Vue>[0];
|
|
879
945
|
vuejsx?: ArgumentsType<typeof VueJsx>[0];
|
|
@@ -884,7 +950,7 @@ interface SlidevPluginOptions {
|
|
|
884
950
|
serverRef?: ArgumentsType<typeof ServerRef>[0];
|
|
885
951
|
unocss?: VitePluginConfig;
|
|
886
952
|
staticCopy?: ViteStaticCopyOptions;
|
|
887
|
-
inspect?:
|
|
953
|
+
inspect?: ViteInspectOptions;
|
|
888
954
|
}
|
|
889
955
|
declare module 'vite' {
|
|
890
956
|
interface UserConfig {
|
|
@@ -897,57 +963,4 @@ declare module 'vite' {
|
|
|
897
963
|
}
|
|
898
964
|
}
|
|
899
965
|
|
|
900
|
-
type RawSingleAtValue = null | undefined | boolean | string | number;
|
|
901
|
-
type RawRangeAtValue = null | undefined | false | [string | number, string | number];
|
|
902
|
-
type RawAtValue = RawSingleAtValue | RawRangeAtValue;
|
|
903
|
-
type NormalizedSingleClickValue = number | string | null;
|
|
904
|
-
type NormalizedRangeClickValue = [number, number] | [number, string] | [string, number] | [string, string] | [string | number, string | number] | null;
|
|
905
|
-
type NormalizedAtValue = NormalizedSingleClickValue | NormalizedRangeClickValue;
|
|
906
|
-
type ClicksElement = Element | string;
|
|
907
|
-
interface ClicksInfo {
|
|
908
|
-
/**
|
|
909
|
-
* The absolute start click num
|
|
910
|
-
*/
|
|
911
|
-
start: number;
|
|
912
|
-
/**
|
|
913
|
-
* The absolute end click num
|
|
914
|
-
*/
|
|
915
|
-
end: number;
|
|
916
|
-
/**
|
|
917
|
-
* The required total click num
|
|
918
|
-
*/
|
|
919
|
-
max: number;
|
|
920
|
-
/**
|
|
921
|
-
* The delta for relative clicks
|
|
922
|
-
*/
|
|
923
|
-
delta: number;
|
|
924
|
-
/**
|
|
925
|
-
* currentClicks - start
|
|
926
|
-
*/
|
|
927
|
-
currentOffset: ComputedRef<number>;
|
|
928
|
-
/**
|
|
929
|
-
* currentOffset === 0
|
|
930
|
-
*/
|
|
931
|
-
isCurrent: ComputedRef<boolean>;
|
|
932
|
-
/**
|
|
933
|
-
* Computed ref of whether the click is active
|
|
934
|
-
*/
|
|
935
|
-
isActive: ComputedRef<boolean>;
|
|
936
|
-
}
|
|
937
|
-
interface ClicksContext {
|
|
938
|
-
current: number;
|
|
939
|
-
readonly clicksStart: number;
|
|
940
|
-
readonly relativeSizeMap: Map<ClicksElement, number>;
|
|
941
|
-
readonly maxMap: Map<ClicksElement, number>;
|
|
942
|
-
calculateSince: (at: RawSingleAtValue, size?: number) => ClicksInfo | null;
|
|
943
|
-
calculateRange: (at: RawRangeAtValue) => ClicksInfo | null;
|
|
944
|
-
calculate: (at: RawAtValue) => ClicksInfo | null;
|
|
945
|
-
register: (el: ClicksElement, info: Pick<ClicksInfo, 'delta' | 'max'> | null) => void;
|
|
946
|
-
unregister: (el: ClicksElement) => void;
|
|
947
|
-
readonly isMounted: boolean;
|
|
948
|
-
setup: () => void;
|
|
949
|
-
readonly currentOffset: number;
|
|
950
|
-
readonly total: number;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
966
|
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 Frontmatter, type FrontmatterStyle, type Headmatter, type HeadmatterConfig, type KatexSetup, type MarkdownTransformContext, type MarkdownTransformer, 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 ResolvedSlidevConfigSub, type ResolvedSlidevOptions, type ResolvedSlidevUtils, 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 TransformersSetup, type TransformersSetupReturn, type TransitionGroupProps, type TransitionOptions, type UnoSetup, defineAppSetup, defineCodeRunnersSetup, defineContextMenuSetup, defineKatexSetup, defineMermaidSetup, defineMonacoSetup, definePreparserSetup, defineRootSetup, defineRoutesSetup, defineShikiSetup, defineShortcutsSetup, defineTransformersSetup, defineUnoSetup };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0-beta.10",
|
|
4
4
|
"description": "Shared types declarations for Slidev",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,22 +24,22 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@antfu/utils": "^0.7.10",
|
|
27
|
-
"@shikijs/markdown-it": "^1.
|
|
28
|
-
"@vitejs/plugin-vue": "^5.1
|
|
29
|
-
"@vitejs/plugin-vue-jsx": "^4.
|
|
27
|
+
"@shikijs/markdown-it": "^1.24.0",
|
|
28
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
29
|
+
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
|
30
30
|
"katex": "^0.16.11",
|
|
31
|
-
"mermaid": "^11.
|
|
32
|
-
"monaco-editor": "
|
|
33
|
-
"shiki": "^1.
|
|
34
|
-
"unocss": "^0.
|
|
35
|
-
"unplugin-icons": "^0.
|
|
36
|
-
"unplugin-vue-markdown": "^0.
|
|
37
|
-
"vite-plugin-inspect": "^0.
|
|
38
|
-
"vite-plugin-remote-assets": "^0.
|
|
39
|
-
"vite-plugin-static-copy": "^
|
|
31
|
+
"mermaid": "^11.4.1",
|
|
32
|
+
"monaco-editor": "0.51.0",
|
|
33
|
+
"shiki": "^1.24.0",
|
|
34
|
+
"unocss": "^0.65.0",
|
|
35
|
+
"unplugin-icons": "^0.20.2",
|
|
36
|
+
"unplugin-vue-markdown": "^0.27.1",
|
|
37
|
+
"vite-plugin-inspect": "^0.10.2",
|
|
38
|
+
"vite-plugin-remote-assets": "^0.6.0",
|
|
39
|
+
"vite-plugin-static-copy": "^2.2.0",
|
|
40
40
|
"vite-plugin-vue-server-ref": "^0.4.2",
|
|
41
|
-
"vue": "^3.
|
|
42
|
-
"vue-router": "^4.
|
|
41
|
+
"vue": "^3.5.13",
|
|
42
|
+
"vue-router": "^4.5.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsup src/index.ts",
|