@slidev/client 0.49.10 → 0.49.11
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/ShikiMagicMove.vue +7 -3
- package/composables/useDrawings.ts +4 -4
- package/composables/useWakeLock.ts +13 -0
- package/constants.ts +1 -0
- package/internals/SelectList.vue +3 -3
- package/internals/Settings.vue +18 -3
- package/package.json +3 -3
- package/pages/play.vue +3 -0
- package/pages/presenter.vue +3 -0
- package/state/drawings.ts +6 -2
- package/state/index.ts +1 -0
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { ShikiMagicMovePrecompiled } from 'shiki-magic-move/vue'
|
|
3
3
|
import type { KeyedTokensInfo } from 'shiki-magic-move/types'
|
|
4
4
|
import type { PropType } from 'vue'
|
|
5
|
-
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
5
|
+
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
6
6
|
import lz from 'lz-string'
|
|
7
|
+
import { sleep } from '@antfu/utils'
|
|
7
8
|
import { useSlideContext } from '../context'
|
|
8
9
|
import { makeId, updateCodeHighlightRange } from '../logic/utils'
|
|
9
10
|
import { useNav } from '../composables/useNav'
|
|
@@ -72,9 +73,12 @@ onMounted(() => {
|
|
|
72
73
|
}
|
|
73
74
|
currentClickSum += current.length || 1
|
|
74
75
|
}
|
|
75
|
-
stepIndex.value = step
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
nextTick(async () => {
|
|
78
|
+
stepIndex.value = step
|
|
79
|
+
|
|
80
|
+
await sleep(0)
|
|
81
|
+
|
|
78
82
|
const pre = container.value?.querySelector('.shiki') as HTMLElement
|
|
79
83
|
if (!pre)
|
|
80
84
|
return
|
|
@@ -2,7 +2,7 @@ import { computed, markRaw, nextTick, reactive, ref, watch } from 'vue'
|
|
|
2
2
|
import type { Brush, Options as DrauuOptions, DrawingMode } from 'drauu'
|
|
3
3
|
import { createDrauu } from 'drauu'
|
|
4
4
|
import { createSharedComposable, toReactive, useLocalStorage } from '@vueuse/core'
|
|
5
|
-
import { drawingState,
|
|
5
|
+
import { drawingState, onPatchDrawingState, patchDrawingState } from '../state/drawings'
|
|
6
6
|
import { configs } from '../env'
|
|
7
7
|
import { isInputting } from '../state'
|
|
8
8
|
import { useNav } from './useNav'
|
|
@@ -67,7 +67,7 @@ export const useDrawings = createSharedComposable(() => {
|
|
|
67
67
|
function clearDrauu() {
|
|
68
68
|
drauu.clear()
|
|
69
69
|
if (syncUp.value)
|
|
70
|
-
|
|
70
|
+
patchDrawingState(currentSlideNo.value, '')
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function updateState() {
|
|
@@ -93,11 +93,11 @@ export const useDrawings = createSharedComposable(() => {
|
|
|
93
93
|
const dump = drauu.dump()
|
|
94
94
|
const key = currentSlideNo.value
|
|
95
95
|
if ((drawingState[key] || '') !== dump && syncUp.value)
|
|
96
|
-
|
|
96
|
+
patchDrawingState(key, drauu.dump())
|
|
97
97
|
}
|
|
98
98
|
})
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
onPatchDrawingState((state) => {
|
|
101
101
|
disableDump = true
|
|
102
102
|
if (state[currentSlideNo.value] != null)
|
|
103
103
|
drauu.load(state[currentSlideNo.value] || '')
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useWakeLock as useVueUseWakeLock } from '@vueuse/core'
|
|
2
|
+
import { watchEffect } from 'vue'
|
|
3
|
+
import { wakeLockEnabled } from '../state'
|
|
4
|
+
|
|
5
|
+
export function useWakeLock() {
|
|
6
|
+
const { request, release } = useVueUseWakeLock()
|
|
7
|
+
|
|
8
|
+
watchEffect((onCleanup) => {
|
|
9
|
+
if (wakeLockEnabled.value)
|
|
10
|
+
request('screen')
|
|
11
|
+
onCleanup(release)
|
|
12
|
+
})
|
|
13
|
+
}
|
package/constants.ts
CHANGED
package/internals/SelectList.vue
CHANGED
|
@@ -5,7 +5,7 @@ import type { SelectionItem } from './types'
|
|
|
5
5
|
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
modelValue: {
|
|
8
|
-
type: [Object, String, Number] as PropType<any>,
|
|
8
|
+
type: [Object, String, Number, Boolean] as PropType<any>,
|
|
9
9
|
},
|
|
10
10
|
title: {
|
|
11
11
|
type: String,
|
|
@@ -43,7 +43,7 @@ const value = useVModel(props, 'modelValue', emit, { passive: true })
|
|
|
43
43
|
|
|
44
44
|
<style lang="postcss" scoped>
|
|
45
45
|
.select-list {
|
|
46
|
-
@apply
|
|
46
|
+
@apply my-2;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.item {
|
|
@@ -55,6 +55,6 @@ const value = useVModel(props, 'modelValue', emit, { passive: true })
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.title {
|
|
58
|
-
@apply text-xs uppercase opacity-50 tracking-widest px-7 py-1;
|
|
58
|
+
@apply text-xs uppercase opacity-50 tracking-widest px-7 py-1 select-none text-nowrap;
|
|
59
59
|
}
|
|
60
60
|
</style>
|
package/internals/Settings.vue
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { useWakeLock } from '@vueuse/core'
|
|
3
|
+
import { slideScale, wakeLockEnabled } from '../state'
|
|
3
4
|
import SelectList from './SelectList.vue'
|
|
4
5
|
import type { SelectionItem } from './types'
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
+
const scaleItems: SelectionItem<number>[] = [
|
|
7
8
|
{
|
|
8
9
|
display: 'Fit',
|
|
9
10
|
value: 0,
|
|
@@ -13,10 +14,24 @@ const items: SelectionItem<number>[] = [
|
|
|
13
14
|
value: 1,
|
|
14
15
|
},
|
|
15
16
|
]
|
|
17
|
+
|
|
18
|
+
const { isSupported } = useWakeLock()
|
|
19
|
+
|
|
20
|
+
const wakeLockItems: SelectionItem<boolean>[] = [
|
|
21
|
+
{
|
|
22
|
+
display: 'Enabled',
|
|
23
|
+
value: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
display: 'Disabled',
|
|
27
|
+
value: false,
|
|
28
|
+
},
|
|
29
|
+
]
|
|
16
30
|
</script>
|
|
17
31
|
|
|
18
32
|
<template>
|
|
19
33
|
<div class="text-sm select-none">
|
|
20
|
-
<SelectList v-model="slideScale" title="Scale" :items="
|
|
34
|
+
<SelectList v-model="slideScale" title="Scale" :items="scaleItems" />
|
|
35
|
+
<SelectList v-if="__SLIDEV_FEATURE_WAKE_LOCK__ && isSupported" v-model="wakeLockEnabled" title="Wake lock" :items="wakeLockItems" />
|
|
21
36
|
</div>
|
|
22
37
|
</template>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.11",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
6
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"vue": "^3.4.27",
|
|
60
60
|
"vue-router": "^4.3.2",
|
|
61
61
|
"yaml": "^2.4.2",
|
|
62
|
-
"@slidev/parser": "0.49.
|
|
63
|
-
"@slidev/types": "0.49.
|
|
62
|
+
"@slidev/parser": "0.49.11",
|
|
63
|
+
"@slidev/types": "0.49.11"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"vite": "^5.2.12"
|
package/pages/play.vue
CHANGED
|
@@ -10,6 +10,7 @@ import SlidesShow from '../internals/SlidesShow.vue'
|
|
|
10
10
|
import PrintStyle from '../internals/PrintStyle.vue'
|
|
11
11
|
import { onContextMenu } from '../logic/contextMenu'
|
|
12
12
|
import { useNav } from '../composables/useNav'
|
|
13
|
+
import { useWakeLock } from '../composables/useWakeLock'
|
|
13
14
|
import { useDrawings } from '../composables/useDrawings'
|
|
14
15
|
import PresenterMouse from '../internals/PresenterMouse.vue'
|
|
15
16
|
|
|
@@ -32,6 +33,8 @@ function onClick(e: MouseEvent) {
|
|
|
32
33
|
|
|
33
34
|
useSwipeControls(root)
|
|
34
35
|
registerShortcuts()
|
|
36
|
+
if (__SLIDEV_FEATURE_WAKE_LOCK__)
|
|
37
|
+
useWakeLock()
|
|
35
38
|
|
|
36
39
|
const persistNav = computed(() => isScreenVertical.value || showEditor.value)
|
|
37
40
|
|
package/pages/presenter.vue
CHANGED
|
@@ -24,11 +24,14 @@ import ClicksSlider from '../internals/ClicksSlider.vue'
|
|
|
24
24
|
import ContextMenu from '../internals/ContextMenu.vue'
|
|
25
25
|
import { useNav } from '../composables/useNav'
|
|
26
26
|
import { useDrawings } from '../composables/useDrawings'
|
|
27
|
+
import { useWakeLock } from '../composables/useWakeLock'
|
|
27
28
|
|
|
28
29
|
const main = ref<HTMLDivElement>()
|
|
29
30
|
|
|
30
31
|
registerShortcuts()
|
|
31
32
|
useSwipeControls(main)
|
|
33
|
+
if (__SLIDEV_FEATURE_WAKE_LOCK__)
|
|
34
|
+
useWakeLock()
|
|
32
35
|
|
|
33
36
|
const {
|
|
34
37
|
clicksContext,
|
package/state/drawings.ts
CHANGED
|
@@ -3,5 +3,9 @@ import { createSyncState } from './syncState'
|
|
|
3
3
|
|
|
4
4
|
export type DrawingsState = Record<number, string | undefined>
|
|
5
5
|
|
|
6
|
-
const {
|
|
7
|
-
|
|
6
|
+
export const {
|
|
7
|
+
init: initDrawingState,
|
|
8
|
+
onPatch: onPatchDrawingState,
|
|
9
|
+
patch: patchDrawingState,
|
|
10
|
+
state: drawingState,
|
|
11
|
+
} = createSyncState<DrawingsState>(serverDrawingState, serverDrawingState, __SLIDEV_FEATURE_DRAWINGS_PERSIST__)
|
package/state/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export const isOnFocus = computed(() => ['BUTTON', 'A'].includes(activeElement.v
|
|
|
25
25
|
export const currentCamera = useLocalStorage<string>('slidev-camera', 'default', { listenToStorageChanges: false })
|
|
26
26
|
export const currentMic = useLocalStorage<string>('slidev-mic', 'default', { listenToStorageChanges: false })
|
|
27
27
|
export const slideScale = useLocalStorage<number>('slidev-scale', 0)
|
|
28
|
+
export const wakeLockEnabled = useLocalStorage('slidev-wake-lock', true)
|
|
28
29
|
|
|
29
30
|
export const showPresenterCursor = useLocalStorage('slidev-presenter-cursor', true, { listenToStorageChanges: false })
|
|
30
31
|
export const showEditor = useLocalStorage('slidev-show-editor', false, { listenToStorageChanges: false })
|