@slidev/client 0.43.4 → 0.43.5
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/composables/hmr.ts +3 -0
- package/internals/SlidesShow.vue +11 -2
- package/logic/nav.ts +2 -0
- package/package.json +3 -3
package/internals/SlidesShow.vue
CHANGED
|
@@ -3,6 +3,7 @@ import { TransitionGroup, computed, shallowRef, watch } from 'vue'
|
|
|
3
3
|
import { clicks, currentRoute, isPresenter, nextRoute, rawRoutes, router, transition } from '../logic/nav'
|
|
4
4
|
import { getSlideClass } from '../utils'
|
|
5
5
|
import { useViewTransition } from '../composables/useViewTransition'
|
|
6
|
+
import { skipTransition } from '../composables/hmr'
|
|
6
7
|
import SlideWrapper from './SlideWrapper'
|
|
7
8
|
|
|
8
9
|
// @ts-expect-error virtual module
|
|
@@ -37,6 +38,12 @@ if (__SLIDEV_FEATURE_DRAWINGS__ || __SLIDEV_FEATURE_DRAWINGS_PERSIST__)
|
|
|
37
38
|
import('./DrawingLayer.vue').then(v => DrawingLayer.value = v.default)
|
|
38
39
|
|
|
39
40
|
const loadedRoutes = computed(() => rawRoutes.filter(r => r.meta?.__preloaded || r === currentRoute.value))
|
|
41
|
+
|
|
42
|
+
function onAfterLeave() {
|
|
43
|
+
// After transition, we disable it so HMR won't trigger it again
|
|
44
|
+
// We will turn it back on `nav.go` so the normal navigation would still work
|
|
45
|
+
skipTransition.value = true
|
|
46
|
+
}
|
|
40
47
|
</script>
|
|
41
48
|
|
|
42
49
|
<template>
|
|
@@ -46,8 +53,10 @@ const loadedRoutes = computed(() => rawRoutes.filter(r => r.meta?.__preloaded ||
|
|
|
46
53
|
<!-- Slides -->
|
|
47
54
|
<component
|
|
48
55
|
:is="hasViewTransition ? 'div' : TransitionGroup"
|
|
49
|
-
v-bind="transition"
|
|
50
|
-
id="slideshow"
|
|
56
|
+
v-bind="skipTransition ? {} : transition"
|
|
57
|
+
id="slideshow"
|
|
58
|
+
tag="div"
|
|
59
|
+
@after-leave="onAfterLeave"
|
|
51
60
|
>
|
|
52
61
|
<template v-for="route of loadedRoutes" :key="route.path">
|
|
53
62
|
<SlideWrapper
|
package/logic/nav.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { TocItem } from '@slidev/types'
|
|
|
5
5
|
import { timestamp, usePointerSwipe } from '@vueuse/core'
|
|
6
6
|
import { rawRoutes, router } from '../routes'
|
|
7
7
|
import { configs } from '../env'
|
|
8
|
+
import { skipTransition } from '../composables/hmr'
|
|
8
9
|
import { useRouteQuery } from './route'
|
|
9
10
|
import { isDrawing } from './drawings'
|
|
10
11
|
|
|
@@ -123,6 +124,7 @@ export function goLast() {
|
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
export function go(page: number | string, clicks?: number) {
|
|
127
|
+
skipTransition.value = false
|
|
126
128
|
return router.push({ path: getPath(page), query: { ...route.value.query, clicks } })
|
|
127
129
|
}
|
|
128
130
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.5",
|
|
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.2.4",
|
|
42
42
|
"vue-starport": "^0.4.0",
|
|
43
43
|
"windicss": "^3.5.6",
|
|
44
|
-
"@slidev/parser": "0.43.
|
|
45
|
-
"@slidev/types": "0.43.
|
|
44
|
+
"@slidev/parser": "0.43.5",
|
|
45
|
+
"@slidev/types": "0.43.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"vite": "^4.4.9"
|