@slidev/client 0.42.5 → 0.42.7
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/builtin/Toc.vue +1 -1
- package/env.ts +8 -0
- package/internals/Goto.vue +3 -2
- package/internals/SlideContainer.vue +1 -1
- package/internals/SlideWrapper.ts +7 -5
- package/layoutHelper.ts +2 -2
- package/layouts/image-left.vue +5 -1
- package/layouts/image-right.vue +5 -1
- package/layouts/image.vue +5 -1
- package/logic/shortcuts.ts +1 -1
- package/package.json +15 -15
- package/setup/codemirror.ts +1 -1
- package/setup/prettier.ts +4 -8
- package/shim.d.ts +2 -0
- package/windi.config.ts +1 -0
package/builtin/Toc.vue
CHANGED
package/env.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { SlidevConfig } from '@slidev/types'
|
|
2
|
+
import type { UnwrapNestedRefs } from 'vue'
|
|
2
3
|
import { computed } from 'vue'
|
|
3
4
|
import { objectMap } from '@antfu/utils'
|
|
4
5
|
|
|
5
6
|
// @ts-expect-error missing types
|
|
6
7
|
import _configs from '/@slidev/configs'
|
|
8
|
+
import type { SlidevContext } from './modules/context'
|
|
7
9
|
|
|
8
10
|
export const configs = _configs as SlidevConfig
|
|
9
11
|
export const slideAspect = configs.aspectRatio ?? (16 / 9)
|
|
@@ -15,3 +17,9 @@ export const slideHeight = Math.ceil(slideWidth / slideAspect)
|
|
|
15
17
|
export const themeVars = computed(() => {
|
|
16
18
|
return objectMap(configs.themeConfig || {}, (k, v) => [`--slidev-theme-${k}`, v])
|
|
17
19
|
})
|
|
20
|
+
|
|
21
|
+
declare module 'vue' {
|
|
22
|
+
interface ComponentCustomProperties {
|
|
23
|
+
$slidev: UnwrapNestedRefs<SlidevContext>
|
|
24
|
+
}
|
|
25
|
+
}
|
package/internals/Goto.vue
CHANGED
|
@@ -3,6 +3,7 @@ import { computed, ref, watch } from 'vue'
|
|
|
3
3
|
import Fuse from 'fuse.js'
|
|
4
4
|
import { go, rawRoutes } from '../logic/nav'
|
|
5
5
|
import { activeElement, showGotoDialog } from '../state'
|
|
6
|
+
import Titles from '/@slidev/titles.md'
|
|
6
7
|
|
|
7
8
|
const container = ref<HTMLDivElement>()
|
|
8
9
|
const input = ref<HTMLInputElement>()
|
|
@@ -153,12 +154,12 @@ watch(activeElement, () => {
|
|
|
153
154
|
items-center
|
|
154
155
|
:border="index === 0 ? '' : 't main'"
|
|
155
156
|
:class="selectedIndex === index ? 'bg-active op100' : 'op80'"
|
|
156
|
-
@click.stop="select(item.no)"
|
|
157
|
+
@click.stop.prevent="select(item.no)"
|
|
157
158
|
>
|
|
158
159
|
<div w-4 text-right op50 text-sm>
|
|
159
160
|
{{ item.no }}
|
|
160
161
|
</div>
|
|
161
|
-
|
|
162
|
+
<Titles :no="item.no" />
|
|
162
163
|
</li>
|
|
163
164
|
</ul>
|
|
164
165
|
</div>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useVModel } from '@vueuse/core'
|
|
2
|
+
import type { Ref } from 'vue'
|
|
2
3
|
import { defineComponent, h, provide } from 'vue'
|
|
4
|
+
import type { RenderContext } from '@slidev/types'
|
|
3
5
|
import { injectionClicks, injectionClicksDisabled, injectionClicksElements, injectionOrderMap, injectionRoute, injectionSlideContext } from '../constants'
|
|
4
6
|
|
|
5
7
|
export default defineComponent({
|
|
@@ -42,12 +44,12 @@ export default defineComponent({
|
|
|
42
44
|
|
|
43
45
|
clicksElements.value.length = 0
|
|
44
46
|
|
|
45
|
-
provide(injectionRoute, props.route)
|
|
46
|
-
provide(injectionSlideContext, props.context)
|
|
47
|
-
provide(injectionClicks, clicks)
|
|
47
|
+
provide(injectionRoute, props.route as any)
|
|
48
|
+
provide(injectionSlideContext, props.context as RenderContext)
|
|
49
|
+
provide(injectionClicks, clicks as Ref<number>)
|
|
48
50
|
provide(injectionClicksDisabled, clicksDisabled)
|
|
49
|
-
provide(injectionClicksElements, clicksElements)
|
|
50
|
-
provide(injectionOrderMap, clicksOrderMap)
|
|
51
|
+
provide(injectionClicksElements, clicksElements as any)
|
|
52
|
+
provide(injectionOrderMap, clicksOrderMap as any)
|
|
51
53
|
},
|
|
52
54
|
render() {
|
|
53
55
|
if (this.$props.is)
|
package/layoutHelper.ts
CHANGED
|
@@ -9,7 +9,7 @@ export function resolveAssetUrl(url: string) {
|
|
|
9
9
|
return url
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function handleBackground(background?: string, dim = false): CSSProperties {
|
|
12
|
+
export function handleBackground(background?: string, dim = false, backgroundSize = 'cover'): CSSProperties {
|
|
13
13
|
const isColor = background && (background[0] === '#' || background.startsWith('rgb'))
|
|
14
14
|
|
|
15
15
|
const style = {
|
|
@@ -28,7 +28,7 @@ export function handleBackground(background?: string, dim = false): CSSPropertie
|
|
|
28
28
|
: undefined,
|
|
29
29
|
backgroundRepeat: 'no-repeat',
|
|
30
30
|
backgroundPosition: 'center',
|
|
31
|
-
backgroundSize
|
|
31
|
+
backgroundSize,
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (!style.background)
|
package/layouts/image-left.vue
CHANGED
|
@@ -9,9 +9,13 @@ const props = defineProps({
|
|
|
9
9
|
class: {
|
|
10
10
|
type: String,
|
|
11
11
|
},
|
|
12
|
+
backgroundSize: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'cover',
|
|
15
|
+
},
|
|
12
16
|
})
|
|
13
17
|
|
|
14
|
-
const style = computed(() => handleBackground(props.image))
|
|
18
|
+
const style = computed(() => handleBackground(props.image, false, props.backgroundSize))
|
|
15
19
|
</script>
|
|
16
20
|
|
|
17
21
|
<template>
|
package/layouts/image-right.vue
CHANGED
|
@@ -9,9 +9,13 @@ const props = defineProps({
|
|
|
9
9
|
class: {
|
|
10
10
|
type: String,
|
|
11
11
|
},
|
|
12
|
+
backgroundSize: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'cover',
|
|
15
|
+
},
|
|
12
16
|
})
|
|
13
17
|
|
|
14
|
-
const style = computed(() => handleBackground(props.image))
|
|
18
|
+
const style = computed(() => handleBackground(props.image, false, props.backgroundSize))
|
|
15
19
|
</script>
|
|
16
20
|
|
|
17
21
|
<template>
|
package/layouts/image.vue
CHANGED
|
@@ -6,9 +6,13 @@ const props = defineProps({
|
|
|
6
6
|
image: {
|
|
7
7
|
type: String,
|
|
8
8
|
},
|
|
9
|
+
backgroundSize: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'cover',
|
|
12
|
+
},
|
|
9
13
|
})
|
|
10
14
|
|
|
11
|
-
const style = computed(() => handleBackground(props.image))
|
|
15
|
+
const style = computed(() => handleBackground(props.image, false, props.backgroundSize))
|
|
12
16
|
</script>
|
|
13
17
|
|
|
14
18
|
<template>
|
package/logic/shortcuts.ts
CHANGED
|
@@ -44,7 +44,7 @@ export function strokeShortcut(key: KeyFilter, fn: Fn) {
|
|
|
44
44
|
export function registerShortcuts() {
|
|
45
45
|
const allShortcuts = setupShortcuts()
|
|
46
46
|
|
|
47
|
-
const shortcuts = new Map<string | Ref<
|
|
47
|
+
const shortcuts = new Map<string | Ref<boolean>, ShortcutOptions>(
|
|
48
48
|
allShortcuts.map((options: ShortcutOptions) => [options.key, options]),
|
|
49
49
|
)
|
|
50
50
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.7",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,36 +15,36 @@
|
|
|
15
15
|
"node": ">=14.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@antfu/utils": "^0.7.
|
|
19
|
-
"@unocss/reset": "^0.
|
|
20
|
-
"@vueuse/core": "^10.
|
|
18
|
+
"@antfu/utils": "^0.7.5",
|
|
19
|
+
"@unocss/reset": "^0.54.1",
|
|
20
|
+
"@vueuse/core": "^10.3.0",
|
|
21
21
|
"@vueuse/head": "^1.1.26",
|
|
22
|
-
"@vueuse/math": "^10.
|
|
22
|
+
"@vueuse/math": "^10.3.0",
|
|
23
23
|
"@vueuse/motion": "^2.0.0",
|
|
24
24
|
"codemirror": "^5.65.5",
|
|
25
25
|
"defu": "^6.1.2",
|
|
26
|
-
"drauu": "^0.3.
|
|
26
|
+
"drauu": "^0.3.3",
|
|
27
27
|
"file-saver": "^2.0.5",
|
|
28
28
|
"fuse.js": "^6.6.2",
|
|
29
29
|
"js-base64": "^3.7.5",
|
|
30
30
|
"js-yaml": "^4.1.0",
|
|
31
|
-
"katex": "^0.16.
|
|
32
|
-
"mermaid": "^10.
|
|
31
|
+
"katex": "^0.16.8",
|
|
32
|
+
"mermaid": "^10.3.0",
|
|
33
33
|
"monaco-editor": "^0.37.1",
|
|
34
34
|
"nanoid": "^4.0.2",
|
|
35
|
-
"prettier": "^
|
|
35
|
+
"prettier": "^3.0.1",
|
|
36
36
|
"recordrtc": "^5.6.2",
|
|
37
|
-
"resolve": "^1.22.
|
|
38
|
-
"unocss": "^0.
|
|
37
|
+
"resolve": "^1.22.4",
|
|
38
|
+
"unocss": "^0.54.1",
|
|
39
39
|
"vite-plugin-windicss": "^1.9.0",
|
|
40
40
|
"vue": "^3.3.4",
|
|
41
|
-
"vue-router": "^4.2.
|
|
41
|
+
"vue-router": "^4.2.4",
|
|
42
42
|
"vue-starport": "^0.3.0",
|
|
43
43
|
"windicss": "^3.5.6",
|
|
44
|
-
"@slidev/parser": "0.42.
|
|
45
|
-
"@slidev/types": "0.42.
|
|
44
|
+
"@slidev/parser": "0.42.7",
|
|
45
|
+
"@slidev/types": "0.42.7"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"vite": "^4.
|
|
48
|
+
"vite": "^4.4.8"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/setup/codemirror.ts
CHANGED
|
@@ -38,7 +38,7 @@ export async function useCodeMirror(
|
|
|
38
38
|
if (v !== cm.getValue()) {
|
|
39
39
|
skip = true
|
|
40
40
|
const selections = cm.listSelections()
|
|
41
|
-
cm.replaceRange(v, cm.posFromIndex(0), cm.posFromIndex(
|
|
41
|
+
cm.replaceRange(v, cm.posFromIndex(0), cm.posFromIndex(Number.POSITIVE_INFINITY))
|
|
42
42
|
cm.setSelections(selections)
|
|
43
43
|
}
|
|
44
44
|
},
|
package/setup/prettier.ts
CHANGED
|
@@ -10,24 +10,20 @@ export async function formatCode(code: string, lang: string) {
|
|
|
10
10
|
case 'typescript':
|
|
11
11
|
parser = 'typescript'
|
|
12
12
|
plugins = [
|
|
13
|
-
|
|
14
|
-
(await import('prettier/
|
|
15
|
-
// @ts-expect-error missing types
|
|
16
|
-
(await import('prettier/esm/parser-typescript')).default,
|
|
13
|
+
(await import('prettier/plugins/babel')).default,
|
|
14
|
+
(await import('prettier/plugins/typescript')).default,
|
|
17
15
|
]
|
|
18
16
|
break
|
|
19
17
|
case 'html':
|
|
20
18
|
parser = 'html'
|
|
21
19
|
plugins = [
|
|
22
|
-
|
|
23
|
-
(await import('prettier/esm/parser-html')).default,
|
|
20
|
+
(await import('prettier/plugins/html')).default,
|
|
24
21
|
]
|
|
25
22
|
break
|
|
26
23
|
default:
|
|
27
24
|
parser = 'babel'
|
|
28
25
|
plugins = [
|
|
29
|
-
|
|
30
|
-
(await import('prettier/esm/parser-babel')).default,
|
|
26
|
+
(await import('prettier/plugins/babel')).default,
|
|
31
27
|
]
|
|
32
28
|
}
|
|
33
29
|
|
package/shim.d.ts
CHANGED
package/windi.config.ts
CHANGED