@slidev/client 0.50.0-beta.5 → 0.50.0-beta.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/TocList.vue +4 -1
- package/composables/useTimer.ts +20 -0
- package/composables/useViewTransition.ts +1 -2
- package/logic/utils.ts +0 -23
- package/package.json +16 -16
- package/pages/presenter.vue +18 -19
package/builtin/TocList.vue
CHANGED
|
@@ -11,6 +11,7 @@ import type { TocItem } from '@slidev/types'
|
|
|
11
11
|
import TitleRenderer from '#slidev/title-renderer'
|
|
12
12
|
import { toArray } from '@antfu/utils'
|
|
13
13
|
import { computed } from 'vue'
|
|
14
|
+
import { useNav } from '../composables/useNav'
|
|
14
15
|
|
|
15
16
|
const props = withDefaults(defineProps<{
|
|
16
17
|
level: number
|
|
@@ -20,6 +21,8 @@ const props = withDefaults(defineProps<{
|
|
|
20
21
|
listClass?: string | string[]
|
|
21
22
|
}>(), { level: 1 })
|
|
22
23
|
|
|
24
|
+
const { isPresenter } = useNav()
|
|
25
|
+
|
|
23
26
|
const classes = computed(() => {
|
|
24
27
|
return [
|
|
25
28
|
...toArray(props.listClass || []),
|
|
@@ -47,7 +50,7 @@ const styles = computed(() => {
|
|
|
47
50
|
:key="item.path" class="slidev-toc-item"
|
|
48
51
|
:class="[{ 'slidev-toc-item-active': item.active }, { 'slidev-toc-item-parent-active': item.activeParent }]"
|
|
49
52
|
>
|
|
50
|
-
<Link :to="item.path">
|
|
53
|
+
<Link :to="isPresenter ? `/presenter${item.path}` : item.path">
|
|
51
54
|
<TitleRenderer :no="item.no" />
|
|
52
55
|
</Link>
|
|
53
56
|
<TocList
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useInterval } from '@vueuse/core'
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
export function useTimer() {
|
|
5
|
+
const { counter, isActive, reset, pause, resume } = useInterval(1000, { controls: true })
|
|
6
|
+
|
|
7
|
+
const timer = computed(() => {
|
|
8
|
+
const passed = counter.value
|
|
9
|
+
const sec = Math.floor(passed % 60).toString().padStart(2, '0')
|
|
10
|
+
const min = Math.floor(passed / 60).toString().padStart(2, '0')
|
|
11
|
+
return `${min}:${sec}`
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
timer,
|
|
16
|
+
isTimerAvctive: isActive,
|
|
17
|
+
resetTimer: reset,
|
|
18
|
+
toggleTimer: () => (isActive.value ? pause() : resume()),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -17,7 +17,7 @@ export function useViewTransition() {
|
|
|
17
17
|
const toMeta = getSlide(to.params.no as string)?.meta
|
|
18
18
|
const fromNo = fromMeta?.slide?.no
|
|
19
19
|
const toNo = toMeta?.slide?.no
|
|
20
|
-
const transitionType = fromNo != null && toNo != null
|
|
20
|
+
const transitionType = fromNo != null && toNo != null && fromNo !== toNo
|
|
21
21
|
&& ((fromNo < toNo ? fromMeta?.transition : toMeta?.transition) ?? configs.transition)
|
|
22
22
|
if (transitionType !== 'view-transition') {
|
|
23
23
|
isViewTransition.value = false
|
|
@@ -41,7 +41,6 @@ export function useViewTransition() {
|
|
|
41
41
|
|
|
42
42
|
// Wait for `TransitionGroup` to become normal `div`
|
|
43
43
|
setTimeout(() => {
|
|
44
|
-
// @ts-expect-error missing types
|
|
45
44
|
document.startViewTransition(() => {
|
|
46
45
|
changeRoute()
|
|
47
46
|
return promise
|
package/logic/utils.ts
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
import { parseRangeString } from '@slidev/parser/core'
|
|
2
|
-
import { useTimestamp } from '@vueuse/core'
|
|
3
|
-
import { computed, ref } from 'vue'
|
|
4
|
-
|
|
5
|
-
export function useTimer() {
|
|
6
|
-
const tsStart = ref(Date.now())
|
|
7
|
-
const now = useTimestamp({
|
|
8
|
-
interval: 1000,
|
|
9
|
-
})
|
|
10
|
-
const timer = computed(() => {
|
|
11
|
-
const passed = (now.value - tsStart.value) / 1000
|
|
12
|
-
const sec = Math.floor(passed % 60).toString().padStart(2, '0')
|
|
13
|
-
const min = Math.floor(passed / 60).toString().padStart(2, '0')
|
|
14
|
-
return `${min}:${sec}`
|
|
15
|
-
})
|
|
16
|
-
function resetTimer() {
|
|
17
|
-
tsStart.value = now.value
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
timer,
|
|
22
|
-
resetTimer,
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
2
|
|
|
26
3
|
export function makeId(length = 5) {
|
|
27
4
|
const result = []
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.50.0-beta.
|
|
4
|
+
"version": "0.50.0-beta.7",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
6
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@antfu/utils": "^0.7.10",
|
|
32
|
-
"@iconify-json/carbon": "^1.2.
|
|
32
|
+
"@iconify-json/carbon": "^1.2.4",
|
|
33
33
|
"@iconify-json/ph": "^1.2.1",
|
|
34
34
|
"@iconify-json/svg-spinners": "^1.2.1",
|
|
35
|
-
"@shikijs/monaco": "^1.
|
|
36
|
-
"@shikijs/vitepress-twoslash": "^1.
|
|
35
|
+
"@shikijs/monaco": "^1.23.1",
|
|
36
|
+
"@shikijs/vitepress-twoslash": "^1.23.1",
|
|
37
37
|
"@slidev/rough-notation": "^0.1.0",
|
|
38
38
|
"@typescript/ata": "^0.9.7",
|
|
39
|
-
"@unhead/vue": "^1.11.
|
|
40
|
-
"@unocss/reset": "^0.
|
|
41
|
-
"@vueuse/core": "^11.
|
|
42
|
-
"@vueuse/math": "^11.
|
|
39
|
+
"@unhead/vue": "^1.11.11",
|
|
40
|
+
"@unocss/reset": "^0.64.1",
|
|
41
|
+
"@vueuse/core": "^11.2.0",
|
|
42
|
+
"@vueuse/math": "^11.2.0",
|
|
43
43
|
"@vueuse/motion": "^2.2.6",
|
|
44
44
|
"drauu": "^0.4.1",
|
|
45
45
|
"file-saver": "^2.0.5",
|
|
@@ -48,21 +48,21 @@
|
|
|
48
48
|
"html-to-image": "^1.11.11",
|
|
49
49
|
"katex": "^0.16.11",
|
|
50
50
|
"lz-string": "^1.5.0",
|
|
51
|
-
"mermaid": "^11.
|
|
52
|
-
"monaco-editor": "
|
|
51
|
+
"mermaid": "^11.4.0",
|
|
52
|
+
"monaco-editor": "0.51.0",
|
|
53
53
|
"prettier": "^3.3.3",
|
|
54
54
|
"recordrtc": "^5.6.2",
|
|
55
|
-
"shiki": "^1.
|
|
55
|
+
"shiki": "^1.23.1",
|
|
56
56
|
"shiki-magic-move": "^0.5.0",
|
|
57
57
|
"typescript": "^5.6.3",
|
|
58
|
-
"unocss": "^0.
|
|
59
|
-
"vue": "^3.5.
|
|
58
|
+
"unocss": "^0.64.1",
|
|
59
|
+
"vue": "^3.5.13",
|
|
60
60
|
"vue-router": "^4.4.5",
|
|
61
61
|
"yaml": "^2.6.0",
|
|
62
|
-
"@slidev/parser": "0.50.0-beta.
|
|
63
|
-
"@slidev/types": "0.50.0-beta.
|
|
62
|
+
"@slidev/parser": "0.50.0-beta.7",
|
|
63
|
+
"@slidev/types": "0.50.0-beta.7"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"vite": "^5.4.
|
|
66
|
+
"vite": "^5.4.11"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/pages/presenter.vue
CHANGED
|
@@ -6,6 +6,7 @@ import { createFixedClicks } from '../composables/useClicks'
|
|
|
6
6
|
import { useDrawings } from '../composables/useDrawings'
|
|
7
7
|
import { useNav } from '../composables/useNav'
|
|
8
8
|
import { useSwipeControls } from '../composables/useSwipeControls'
|
|
9
|
+
import { useTimer } from '../composables/useTimer'
|
|
9
10
|
import { useWakeLock } from '../composables/useWakeLock'
|
|
10
11
|
import { slidesTitle } from '../env'
|
|
11
12
|
import ClicksSlider from '../internals/ClicksSlider.vue'
|
|
@@ -22,7 +23,6 @@ import SlidesShow from '../internals/SlidesShow.vue'
|
|
|
22
23
|
import SlideWrapper from '../internals/SlideWrapper.vue'
|
|
23
24
|
import { onContextMenu } from '../logic/contextMenu'
|
|
24
25
|
import { registerShortcuts } from '../logic/shortcuts'
|
|
25
|
-
import { useTimer } from '../logic/utils'
|
|
26
26
|
import { decreasePresenterFontSize, increasePresenterFontSize, presenterLayout, presenterNotesFontSize, showEditor, showPresenterCursor } from '../state'
|
|
27
27
|
import { sharedState } from '../state/shared'
|
|
28
28
|
|
|
@@ -49,7 +49,7 @@ useHead({ title: `Presenter - ${slidesTitle}` })
|
|
|
49
49
|
|
|
50
50
|
const notesEditing = ref(false)
|
|
51
51
|
|
|
52
|
-
const { timer, resetTimer } = useTimer()
|
|
52
|
+
const { timer, isTimerAvctive, resetTimer, toggleTimer } = useTimer()
|
|
53
53
|
|
|
54
54
|
const clicksCtxMap = computed(() => slides.value.map(route => createFixedClicks(route)))
|
|
55
55
|
const nextFrame = computed(() => {
|
|
@@ -184,16 +184,22 @@ onMounted(() => {
|
|
|
184
184
|
<div class="grid-section bottom flex">
|
|
185
185
|
<NavControls :persist="true" />
|
|
186
186
|
<div flex-auto />
|
|
187
|
-
<div
|
|
188
|
-
class="
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
187
|
+
<div class="group flex items-center justify-center pl-4 select-none">
|
|
188
|
+
<div class="w-22px cursor-pointer">
|
|
189
|
+
<carbon:time class="group-hover:hidden text-xl" />
|
|
190
|
+
<div class="group-not-hover:hidden flex flex-col items-center">
|
|
191
|
+
<div class="relative op-80 hover:op-100" @click="toggleTimer">
|
|
192
|
+
<carbon:pause v-if="isTimerAvctive" class="text-lg" />
|
|
193
|
+
<carbon:play v-else />
|
|
194
|
+
</div>
|
|
195
|
+
<div class="op-80 hover:op-100" @click="resetTimer">
|
|
196
|
+
<carbon:renew />
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
<div class="text-2xl px-3 my-auto tabular-nums">
|
|
201
|
+
{{ timer }}
|
|
202
|
+
</div>
|
|
197
203
|
</div>
|
|
198
204
|
</div>
|
|
199
205
|
<DrawingControls v-if="__SLIDEV_FEATURE_DRAWINGS__" />
|
|
@@ -215,13 +221,6 @@ onMounted(() => {
|
|
|
215
221
|
--slidev-controls-foreground: current;
|
|
216
222
|
}
|
|
217
223
|
|
|
218
|
-
.timer-btn:hover > :first-child {
|
|
219
|
-
opacity: 0;
|
|
220
|
-
}
|
|
221
|
-
.timer-btn:hover > :last-child {
|
|
222
|
-
opacity: 1;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
224
|
.grid-container {
|
|
226
225
|
--uno: bg-gray/20;
|
|
227
226
|
height: 100%;
|