@slidev/client 0.46.3 → 0.47.1
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/App.vue +0 -1
- package/internals/Play.vue +1 -0
- package/internals/SlideContainer.vue +13 -1
- package/internals/SlidesShow.vue +1 -0
- package/package.json +9 -10
- package/setup/codemirror.ts +1 -1
- package/setup/main.ts +2 -2
- package/styles/code.css +17 -28
- package/styles/shiki-twoslash.css +24 -0
- package/styles/vars.css +7 -2
- package/windi.config.ts +0 -86
package/App.vue
CHANGED
package/internals/Play.vue
CHANGED
|
@@ -48,6 +48,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
|
|
|
48
48
|
:style="{ background: 'var(--slidev-slide-container-background, black)' }"
|
|
49
49
|
:width="isPrintMode ? windowSize.width.value : undefined"
|
|
50
50
|
:scale="slideScale"
|
|
51
|
+
:is-main="true"
|
|
51
52
|
@pointerdown="onClick"
|
|
52
53
|
>
|
|
53
54
|
<template #default>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useElementSize } from '@vueuse/core'
|
|
2
|
+
import { useElementSize, useStyleTag } from '@vueuse/core'
|
|
3
3
|
import { computed, provide, ref, watchEffect } from 'vue'
|
|
4
4
|
import { configs, slideAspect, slideHeight, slideWidth } from '../env'
|
|
5
5
|
import { injectionSlideScale } from '../constants'
|
|
@@ -15,6 +15,10 @@ const props = defineProps({
|
|
|
15
15
|
scale: {
|
|
16
16
|
type: [Number, String],
|
|
17
17
|
},
|
|
18
|
+
isMain: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
18
22
|
})
|
|
19
23
|
|
|
20
24
|
const root = ref<HTMLDivElement>()
|
|
@@ -52,6 +56,14 @@ const className = computed(() => ({
|
|
|
52
56
|
'select-none': !configs.selectable,
|
|
53
57
|
}))
|
|
54
58
|
|
|
59
|
+
if (props.isMain) {
|
|
60
|
+
useStyleTag(computed(() => `
|
|
61
|
+
:root {
|
|
62
|
+
--slidev-slide-scale: ${scale.value};
|
|
63
|
+
}
|
|
64
|
+
`))
|
|
65
|
+
}
|
|
66
|
+
|
|
55
67
|
provide(injectionSlideScale, scale as any)
|
|
56
68
|
</script>
|
|
57
69
|
|
package/internals/SlidesShow.vue
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.1",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@antfu/utils": "^0.7.7",
|
|
23
|
+
"@shikijs/vitepress-twoslash": "^1.0.0-beta.3",
|
|
23
24
|
"@unhead/vue": "^1.8.10",
|
|
24
|
-
"@unocss/reset": "^0.58.
|
|
25
|
+
"@unocss/reset": "^0.58.4",
|
|
25
26
|
"@vueuse/core": "^10.7.2",
|
|
26
27
|
"@vueuse/math": "^10.7.2",
|
|
27
28
|
"@vueuse/motion": "^2.0.0",
|
|
@@ -29,24 +30,22 @@
|
|
|
29
30
|
"defu": "^6.1.4",
|
|
30
31
|
"drauu": "^0.3.7",
|
|
31
32
|
"file-saver": "^2.0.5",
|
|
33
|
+
"floating-vue": "^5.2.2",
|
|
32
34
|
"fuse.js": "^7.0.0",
|
|
33
35
|
"js-base64": "^3.7.6",
|
|
34
36
|
"js-yaml": "^4.1.0",
|
|
35
37
|
"katex": "^0.16.9",
|
|
36
|
-
"mermaid": "^10.
|
|
38
|
+
"mermaid": "^10.8.0",
|
|
37
39
|
"monaco-editor": "^0.37.1",
|
|
38
|
-
"nanoid": "^5.0.
|
|
40
|
+
"nanoid": "^5.0.5",
|
|
39
41
|
"prettier": "^3.2.4",
|
|
40
42
|
"recordrtc": "^5.6.2",
|
|
41
43
|
"resolve": "^1.22.8",
|
|
42
|
-
"unocss": "^0.58.
|
|
43
|
-
"vite-plugin-windicss": "^1.9.3",
|
|
44
|
+
"unocss": "^0.58.4",
|
|
44
45
|
"vue": "^3.4.15",
|
|
45
46
|
"vue-router": "^4.2.5",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"@slidev/parser": "0.46.3",
|
|
49
|
-
"@slidev/types": "0.46.3"
|
|
47
|
+
"@slidev/parser": "0.47.1",
|
|
48
|
+
"@slidev/types": "0.47.1"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
51
|
"vite": "^5.0.12"
|
package/setup/codemirror.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref, WritableComputedRef } from 'vue'
|
|
2
2
|
import { watch } from 'vue'
|
|
3
|
-
import CodeMirror from 'codemirror'
|
|
3
|
+
import * as CodeMirror from 'codemirror'
|
|
4
4
|
import 'codemirror/mode/javascript/javascript'
|
|
5
5
|
import 'codemirror/mode/css/css'
|
|
6
6
|
import 'codemirror/mode/markdown/markdown'
|
package/setup/main.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { AppContext } from '@slidev/types'
|
|
4
4
|
import { MotionPlugin } from '@vueuse/motion'
|
|
5
|
-
import
|
|
5
|
+
import TwoSlashFloatingVue from '@shikijs/vitepress-twoslash/client'
|
|
6
6
|
|
|
7
7
|
export default function setupMain(context: AppContext) {
|
|
8
8
|
function setMaxHeight() {
|
|
@@ -14,7 +14,7 @@ export default function setupMain(context: AppContext) {
|
|
|
14
14
|
window.addEventListener('resize', setMaxHeight)
|
|
15
15
|
|
|
16
16
|
context.app.use(MotionPlugin)
|
|
17
|
-
context.app.use(
|
|
17
|
+
context.app.use(TwoSlashFloatingVue as any)
|
|
18
18
|
|
|
19
19
|
// @ts-expect-error inject in runtime
|
|
20
20
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
package/styles/code.css
CHANGED
|
@@ -3,48 +3,24 @@ html.dark:root {
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
/* Shiki */
|
|
6
|
-
html.dark .shiki
|
|
7
|
-
display: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
html:not(.dark) .shiki-dark {
|
|
11
|
-
display: none;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.shiki-container {
|
|
15
|
-
@apply relative flex flex-col;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.shiki-container > .shiki {
|
|
19
|
-
@apply h-full;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* Shikiji */
|
|
23
|
-
html.dark .shikiji {
|
|
6
|
+
html.dark .shiki {
|
|
24
7
|
color: var(--shiki-dark, inherit);
|
|
25
|
-
background: var(--shiki-dark-bg, inherit);
|
|
26
8
|
--twoslash-popup-bg: var(--shiki-dark-bg, inherit);
|
|
27
9
|
}
|
|
28
10
|
|
|
29
|
-
html.dark .
|
|
11
|
+
html.dark .shiki span {
|
|
30
12
|
color: var(--shiki-dark);
|
|
31
13
|
}
|
|
32
14
|
|
|
33
|
-
html:not(.dark) .
|
|
15
|
+
html:not(.dark) .shiki {
|
|
34
16
|
color: var(--shiki-light, inherit);
|
|
35
|
-
background: var(--shiki-light-bg, inherit);
|
|
36
17
|
--twoslash-popup-bg: var(--shiki-light-bg, inherit);
|
|
37
18
|
}
|
|
38
19
|
|
|
39
|
-
html:not(.dark) .
|
|
20
|
+
html:not(.dark) .shiki span {
|
|
40
21
|
color: var(--shiki-light);
|
|
41
22
|
}
|
|
42
23
|
|
|
43
|
-
.shikiji.twoslash {
|
|
44
|
-
/* Do not set overflow so the hover popover can be displayed */
|
|
45
|
-
overflow: inherit;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
24
|
.twoslash-meta-line.twoslash-popover-line {
|
|
49
25
|
margin-top: -10px;
|
|
50
26
|
}
|
|
@@ -64,6 +40,7 @@ html:not(.dark) .shikiji span {
|
|
|
64
40
|
font-size: var(--slidev-code-font-size) !important;
|
|
65
41
|
line-height: var(--slidev-code-line-height) !important;
|
|
66
42
|
border-radius: var(--slidev-code-radius) !important;
|
|
43
|
+
background: var(--slidev-code-background);
|
|
67
44
|
overflow: auto;
|
|
68
45
|
}
|
|
69
46
|
|
|
@@ -85,6 +62,18 @@ html:not(.dark) .shikiji span {
|
|
|
85
62
|
@apply w-4 mr-6 inline-block text-right text-gray-400 dark:text-gray-600;
|
|
86
63
|
}
|
|
87
64
|
|
|
65
|
+
/* Inline Code */
|
|
66
|
+
.slidev-layout :not(pre) > code {
|
|
67
|
+
font-size: 0.9em;
|
|
68
|
+
background: var(--slidev-code-background);
|
|
69
|
+
border-radius: var(--slidev-code-radius);
|
|
70
|
+
@apply font-light py-0.5 px-1.5;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.slidev-layout :not(pre) > code:before {
|
|
74
|
+
margin-right: -0.08em;
|
|
75
|
+
}
|
|
76
|
+
|
|
88
77
|
/* Revert CSS reset for KaTex */
|
|
89
78
|
.katex,
|
|
90
79
|
.katex :after,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--twoslash-popup-bg: var(--slidev-code-background);
|
|
3
|
+
--twoslash-popup-color: var(--slidev-code-foreground);
|
|
4
|
+
--twoslash-docs-color: inherit;
|
|
5
|
+
--twoslash-docs-font: inherit;
|
|
6
|
+
--twoslash-code-font: theme('fontFamily.mono');
|
|
7
|
+
--twoslash-underline-color: #8888;
|
|
8
|
+
--twoslash-border-color: #8888;
|
|
9
|
+
--twoslash-cursor-color: var(--slidev-theme-primary);
|
|
10
|
+
--twoslash-matched-color: var(--slidev-theme-primary);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.twoslash-popup-container {
|
|
14
|
+
font-size: calc(13px * var(--slidev-slide-scale, 1));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.twoslash-popup-container .twoslash-popup-code {
|
|
18
|
+
font-size: 0.85em;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.twoslash-floating .twoslash-popup-docs-tags .twoslash-popup-docs-tag-name {
|
|
22
|
+
color: inherit;
|
|
23
|
+
opacity: 0.5;
|
|
24
|
+
}
|
package/styles/vars.css
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--slidev-code-background:
|
|
2
|
+
--slidev-code-background: #f5f5f5;
|
|
3
|
+
--slidev-code-foreground: #1b1b1b;
|
|
3
4
|
--slidev-code-font-family: theme('fontFamily.mono');
|
|
4
5
|
--slidev-code-padding: 8px;
|
|
5
6
|
--slidev-code-font-size: 12px;
|
|
@@ -8,7 +9,11 @@
|
|
|
8
9
|
--slidev-code-margin: 4px 0;
|
|
9
10
|
|
|
10
11
|
--slidev-transition-duration: 0.5s;
|
|
11
|
-
|
|
12
12
|
--slidev-slide-container-background: black;
|
|
13
13
|
--slidev-controls-foreground: white;
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
html.dark {
|
|
17
|
+
--slidev-code-background: #1b1b1b;
|
|
18
|
+
--slidev-code-foreground: #eee;
|
|
19
|
+
}
|
package/windi.config.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { isTruthy } from '@antfu/utils'
|
|
4
|
-
import { DefaultExtractor, defineConfig } from 'vite-plugin-windicss'
|
|
5
|
-
import typography from 'windicss/plugin/typography'
|
|
6
|
-
|
|
7
|
-
export default defineConfig({
|
|
8
|
-
extract: {
|
|
9
|
-
include: [
|
|
10
|
-
resolve(process.cwd(), '**/*.{vue,ts,tsx,js,jsx,md}'),
|
|
11
|
-
// @slidev/client/**/*.{vue,ts}
|
|
12
|
-
resolve(__dirname, '**/*.{vue,ts}'),
|
|
13
|
-
],
|
|
14
|
-
exclude: [
|
|
15
|
-
'.git',
|
|
16
|
-
'dist',
|
|
17
|
-
resolve(process.cwd(), '.git'),
|
|
18
|
-
resolve(process.cwd(), 'dist'),
|
|
19
|
-
// @slidev/client/node_modules
|
|
20
|
-
resolve(__dirname, 'node_modules'),
|
|
21
|
-
resolve(__dirname, 'windi.config.ts'),
|
|
22
|
-
],
|
|
23
|
-
extractors: [
|
|
24
|
-
{
|
|
25
|
-
extensions: ['md'],
|
|
26
|
-
extractor(code, id) {
|
|
27
|
-
const data = DefaultExtractor(code, id)
|
|
28
|
-
|
|
29
|
-
const frontmatterClasses = Array.from(code.matchAll(/^class:\s+(.*)$/gm)).flatMap(i => i[1].split(/[\s'"`]/g)).filter(isTruthy)
|
|
30
|
-
const classes = [
|
|
31
|
-
...data.classes || [],
|
|
32
|
-
...frontmatterClasses,
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
...data,
|
|
37
|
-
classes,
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
plugins: [
|
|
44
|
-
// @ts-expect-error casing
|
|
45
|
-
typography,
|
|
46
|
-
],
|
|
47
|
-
safelist: [
|
|
48
|
-
'!opacity-0',
|
|
49
|
-
],
|
|
50
|
-
shortcuts: {
|
|
51
|
-
'bg-main': 'bg-white text-[#181818] dark:(bg-[#121212] text-[#ddd])',
|
|
52
|
-
'bg-active': 'bg-gray-400/10',
|
|
53
|
-
'border-main': 'border-gray-400/20',
|
|
54
|
-
'abs-tl': 'absolute top-0 left-0',
|
|
55
|
-
'abs-tr': 'absolute top-0 right-0',
|
|
56
|
-
'abs-b': 'absolute bottom-0 left-0 right-0',
|
|
57
|
-
'abs-bl': 'absolute bottom-0 left-0',
|
|
58
|
-
'abs-br': 'absolute bottom-0 right-0',
|
|
59
|
-
},
|
|
60
|
-
attributify: true,
|
|
61
|
-
darkMode: 'class',
|
|
62
|
-
preflight: {
|
|
63
|
-
includeAll: true,
|
|
64
|
-
},
|
|
65
|
-
theme: {
|
|
66
|
-
extend: {
|
|
67
|
-
typography: {
|
|
68
|
-
DEFAULT: {
|
|
69
|
-
css: {
|
|
70
|
-
color: 'inherit',
|
|
71
|
-
a: { color: 'inherit' },
|
|
72
|
-
b: { color: 'inherit' },
|
|
73
|
-
code: { color: 'inherit' },
|
|
74
|
-
strong: { color: 'inherit' },
|
|
75
|
-
em: { color: 'inherit' },
|
|
76
|
-
h1: { color: 'inherit' },
|
|
77
|
-
h2: { color: 'inherit' },
|
|
78
|
-
h3: { color: 'inherit' },
|
|
79
|
-
h4: { color: 'inherit' },
|
|
80
|
-
blockquote: { color: 'inherit' },
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
})
|