@slidev/client 0.40.11 → 0.40.13
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/CodeBlockWrapper.vue +1 -1
- package/builtin/Mermaid.vue +1 -1
- package/builtin/TocList.vue +0 -1
- package/builtin/VClicks.ts +1 -1
- package/internals/SlidesOverview.vue +2 -1
- package/internals/WebCamera.vue +1 -1
- package/layouts/iframe-left.vue +1 -1
- package/layouts/iframe-right.vue +1 -1
- package/logic/nav.ts +4 -4
- package/package.json +3 -3
- package/setup/monaco.ts +1 -1
- package/setup/root.ts +6 -3
- package/state/syncState.ts +6 -5
|
@@ -81,7 +81,7 @@ onMounted(() => {
|
|
|
81
81
|
line.classList.toggle('dishonored', !highlighted)
|
|
82
82
|
})
|
|
83
83
|
if (props.maxHeight) {
|
|
84
|
-
const highlightedEls = Array.from(target.querySelectorAll('.line.highlighted'))
|
|
84
|
+
const highlightedEls = Array.from(target.querySelectorAll('.line.highlighted')) as HTMLElement[]
|
|
85
85
|
const height = highlightedEls.reduce((acc, el) => el.offsetHeight + acc, 0)
|
|
86
86
|
if (height > el.value.offsetHeight) {
|
|
87
87
|
highlightedEls[0].scrollIntoView({ behavior: 'smooth', block: 'start' })
|
package/builtin/Mermaid.vue
CHANGED
package/builtin/TocList.vue
CHANGED
package/builtin/VClicks.ts
CHANGED
|
@@ -82,7 +82,7 @@ export default defineComponent({
|
|
|
82
82
|
const directive = idx % this.every === 0 ? click : after
|
|
83
83
|
let vNode
|
|
84
84
|
let childCount = 0
|
|
85
|
-
if (depth < this.depth && Array.isArray(i.children)) {
|
|
85
|
+
if (depth < +this.depth && Array.isArray(i.children)) {
|
|
86
86
|
const [vNodes, total] = mapSubList(i.children, depth)
|
|
87
87
|
vNode = h(i, {}, [vNodes])
|
|
88
88
|
childCount = total
|
package/internals/WebCamera.vue
CHANGED
|
@@ -8,7 +8,7 @@ const size = useLocalStorage('slidev-webcam-size', Math.round(Math.min(window.in
|
|
|
8
8
|
const position = useLocalStorage('slidev-webcam-pos', {
|
|
9
9
|
x: window.innerWidth - size.value - 30,
|
|
10
10
|
y: window.innerHeight - size.value - 30,
|
|
11
|
-
},
|
|
11
|
+
}, { deep: true })
|
|
12
12
|
|
|
13
13
|
const frame = ref<HTMLDivElement | undefined>()
|
|
14
14
|
const handler = ref<HTMLDivElement | undefined>()
|
package/layouts/iframe-left.vue
CHANGED
|
@@ -17,7 +17,7 @@ const scaleInvertPercent = computed(() => `${(1 / (props.scale || 1)) * 100}%`)
|
|
|
17
17
|
:src="url"
|
|
18
18
|
:style="scale ? { transform: `scale(${scale})`, transformOrigin: 'top left' } : {}"
|
|
19
19
|
/>
|
|
20
|
-
<div class="slidev-layout default"
|
|
20
|
+
<div class="slidev-layout default" v-bind="$attrs">
|
|
21
21
|
<slot />
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
package/layouts/iframe-right.vue
CHANGED
|
@@ -11,7 +11,7 @@ const scaleInvertPercent = computed(() => `${(1 / (props.scale || 1)) * 100}%`)
|
|
|
11
11
|
|
|
12
12
|
<template>
|
|
13
13
|
<div class="grid grid-cols-2 w-full h-full">
|
|
14
|
-
<div class="slidev-layout default"
|
|
14
|
+
<div class="slidev-layout default" v-bind="$attrs">
|
|
15
15
|
<slot />
|
|
16
16
|
</div>
|
|
17
17
|
<div relative :style="{ width: scaleInvertPercent, height: scaleInvertPercent }">
|
package/logic/nav.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Ref, TransitionGroupProps } from 'vue'
|
|
|
2
2
|
import type { RouteRecordRaw } from 'vue-router'
|
|
3
3
|
import { computed, nextTick, ref, watch } from 'vue'
|
|
4
4
|
import type { TocItem } from '@slidev/types'
|
|
5
|
-
import {
|
|
5
|
+
import { timestamp, usePointerSwipe } from '@vueuse/core'
|
|
6
6
|
import { rawRoutes, router } from '../routes'
|
|
7
7
|
import { configs } from '../env'
|
|
8
8
|
import { useRouteQuery } from './route'
|
|
@@ -147,13 +147,13 @@ export function useSwipeControls(root: Ref<HTMLElement | undefined>) {
|
|
|
147
147
|
const x = Math.abs(distanceX.value)
|
|
148
148
|
const y = Math.abs(distanceY.value)
|
|
149
149
|
if (x / window.innerWidth > 0.3 || x > 100) {
|
|
150
|
-
if (direction.value ===
|
|
150
|
+
if (direction.value === 'left')
|
|
151
151
|
next()
|
|
152
152
|
else
|
|
153
153
|
prev()
|
|
154
154
|
}
|
|
155
155
|
else if (y / window.innerHeight > 0.4 || y > 200) {
|
|
156
|
-
if (direction.value ===
|
|
156
|
+
if (direction.value === 'down')
|
|
157
157
|
prevSlide()
|
|
158
158
|
else
|
|
159
159
|
nextSlide()
|
|
@@ -165,7 +165,7 @@ export function useSwipeControls(root: Ref<HTMLElement | undefined>) {
|
|
|
165
165
|
export async function downloadPDF() {
|
|
166
166
|
const { saveAs } = await import('file-saver')
|
|
167
167
|
saveAs(
|
|
168
|
-
|
|
168
|
+
typeof configs.download === 'string'
|
|
169
169
|
? configs.download
|
|
170
170
|
: configs.exportFilename
|
|
171
171
|
? `${configs.exportFilename}.pdf`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.13",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"vue-router": "^4.1.6",
|
|
42
42
|
"vue-starport": "^0.3.0",
|
|
43
43
|
"windicss": "^3.5.6",
|
|
44
|
-
"@slidev/parser": "0.40.
|
|
45
|
-
"@slidev/types": "0.40.
|
|
44
|
+
"@slidev/parser": "0.40.13",
|
|
45
|
+
"@slidev/types": "0.40.13"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"vite": "^4.2.2"
|
package/setup/monaco.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { getCurrentInstance, onMounted } from 'vue'
|
|
|
2
2
|
import * as monaco from 'monaco-editor'
|
|
3
3
|
import { createSingletonPromise } from '@antfu/utils'
|
|
4
4
|
import type { MonacoSetupReturn } from '@slidev/types'
|
|
5
|
+
|
|
5
6
|
/* __imports__ */
|
|
6
7
|
|
|
7
8
|
const setup = createSingletonPromise(async () => {
|
|
@@ -31,7 +32,6 @@ const setup = createSingletonPromise(async () => {
|
|
|
31
32
|
import('monaco-editor/esm/vs/language/typescript/ts.worker?worker'),
|
|
32
33
|
])
|
|
33
34
|
|
|
34
|
-
// @ts-expect-error global config for monaca
|
|
35
35
|
window.MonacoEnvironment = {
|
|
36
36
|
getWorker(_: any, label: string) {
|
|
37
37
|
if (label === 'json')
|
package/setup/root.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* __imports__ */
|
|
2
2
|
import { watch } from 'vue'
|
|
3
|
-
import { useHead
|
|
3
|
+
import { useHead } from '@vueuse/head'
|
|
4
4
|
import { nanoid } from 'nanoid'
|
|
5
5
|
import { configs } from '../env'
|
|
6
6
|
import { initSharedState, onPatch, patch } from '../state/shared'
|
|
@@ -17,8 +17,10 @@ export default function setupRoot() {
|
|
|
17
17
|
/* __injections__ */
|
|
18
18
|
|
|
19
19
|
const title = configs.titleTemplate.replace('%s', configs.title || 'Slidev')
|
|
20
|
-
useHead({
|
|
21
|
-
|
|
20
|
+
useHead({
|
|
21
|
+
title,
|
|
22
|
+
htmlAttrs: configs.htmlAttrs,
|
|
23
|
+
})
|
|
22
24
|
initSharedState(`${title} - shared`)
|
|
23
25
|
initDrawingState(`${title} - drawings`)
|
|
24
26
|
|
|
@@ -41,6 +43,7 @@ export default function setupRoot() {
|
|
|
41
43
|
patch('viewerPage', +currentPage.value)
|
|
42
44
|
patch('viewerClicks', clicks.value)
|
|
43
45
|
}
|
|
46
|
+
|
|
44
47
|
patch('lastUpdate', {
|
|
45
48
|
id,
|
|
46
49
|
type: isPresenter.value ? 'presenter' : 'viewer',
|
package/state/syncState.ts
CHANGED
|
@@ -7,7 +7,7 @@ export function createSyncState<State extends object>(serverState: State, defaul
|
|
|
7
7
|
let patchingTimeout: NodeJS.Timeout
|
|
8
8
|
let updatingTimeout: NodeJS.Timeout
|
|
9
9
|
|
|
10
|
-
const state =
|
|
10
|
+
const state = __SLIDEV_HAS_SERVER__
|
|
11
11
|
? reactive<State>(serverState) as State
|
|
12
12
|
: reactive<State>(defaultState) as State
|
|
13
13
|
|
|
@@ -37,11 +37,11 @@ export function createSyncState<State extends object>(serverState: State, defaul
|
|
|
37
37
|
|
|
38
38
|
function init(channelKey: string) {
|
|
39
39
|
let stateChannel: BroadcastChannel
|
|
40
|
-
if (!
|
|
40
|
+
if (!__SLIDEV_HAS_SERVER__ && !persist) {
|
|
41
41
|
stateChannel = new BroadcastChannel(channelKey)
|
|
42
42
|
stateChannel.addEventListener('message', (event: MessageEvent<Partial<State>>) => onUpdate(event.data))
|
|
43
43
|
}
|
|
44
|
-
else if (!
|
|
44
|
+
else if (!__SLIDEV_HAS_SERVER__ && persist) {
|
|
45
45
|
window.addEventListener('storage', (event) => {
|
|
46
46
|
if (event && event.key === channelKey && event.newValue)
|
|
47
47
|
onUpdate(JSON.parse(event.newValue) as Partial<State>)
|
|
@@ -57,8 +57,9 @@ export function createSyncState<State extends object>(serverState: State, defaul
|
|
|
57
57
|
onPatchCallbacks.forEach((fn: (state: State) => void) => fn(state))
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
watch(state, onStateChanged, { deep: true })
|
|
61
|
-
|
|
60
|
+
watch(state, onStateChanged, { deep: true, flush: 'sync' })
|
|
61
|
+
|
|
62
|
+
if (!__SLIDEV_HAS_SERVER__ && persist) {
|
|
62
63
|
const serialzedState = window.localStorage.getItem(channelKey)
|
|
63
64
|
if (serialzedState)
|
|
64
65
|
onUpdate(JSON.parse(serialzedState) as Partial<State>)
|