@slidev/client 0.38.5 → 0.38.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.
@@ -49,7 +49,7 @@ const classes = computed(() => {
49
49
  </template>
50
50
 
51
51
  <style>
52
- .slidev-toc-item p {
52
+ .slidev-layout .slidev-toc-item p {
53
53
  margin: 0;
54
54
  }
55
55
  </style>
@@ -3,6 +3,7 @@ import { defineComponent, h, provide } from 'vue'
3
3
  import { injectionClicks, injectionClicksDisabled, injectionClicksElements, injectionOrderMap, injectionRoute, injectionSlideContext } from '../constants'
4
4
 
5
5
  export default defineComponent({
6
+ name: 'SlideWrapper',
6
7
  props: {
7
8
  clicks: {
8
9
  type: [Number, String],
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { shallowRef, watch } from 'vue'
2
+ import { computed, ref, shallowRef, watch } from 'vue'
3
3
  import { clicks, currentRoute, isPresenter, nextRoute, rawRoutes } from '../logic/nav'
4
4
  import { getSlideClass } from '../utils'
5
+ import { configs } from '../env'
5
6
  import SlideWrapper from './SlideWrapper'
6
7
  // @ts-expect-error virtual module
7
8
  import GlobalTop from '/@slidev/global-components/top'
@@ -22,6 +23,18 @@ watch(currentRoute, () => {
22
23
  const DrawingLayer = shallowRef<any>()
23
24
  if (__SLIDEV_FEATURE_DRAWINGS__ || __SLIDEV_FEATURE_DRAWINGS_PERSIST__)
24
25
  import('./DrawingLayer.vue').then(v => DrawingLayer.value = v.default)
26
+
27
+ const routes = computed(() => rawRoutes.filter(r => r.meta?.__preloaded || r === currentRoute.value))
28
+
29
+ const isLeaving = ref(false)
30
+ function onBeforeLeave() {
31
+ if (configs.pageTransition?.crossfade === false)
32
+ isLeaving.value = true
33
+ }
34
+ function onAfterLeave() {
35
+ if (configs.pageTransition?.crossfade === false)
36
+ isLeaving.value = false
37
+ }
25
38
  </script>
26
39
 
27
40
  <template>
@@ -29,18 +42,26 @@ if (__SLIDEV_FEATURE_DRAWINGS__ || __SLIDEV_FEATURE_DRAWINGS_PERSIST__)
29
42
  <GlobalBottom />
30
43
 
31
44
  <!-- Slides -->
32
- <template v-for="route of rawRoutes" :key="route.path">
33
- <SlideWrapper
34
- :is="route?.component"
35
- v-show="route === currentRoute"
36
- v-if="route.meta?.__preloaded || route === currentRoute"
37
- :clicks="route === currentRoute ? clicks : 0"
38
- :clicks-elements="route.meta?.__clicksElements || []"
39
- :clicks-disabled="false"
40
- :class="getSlideClass(route)"
41
- :route="route"
42
- :context="context"
43
- />
45
+ <template
46
+ v-for="route of routes"
47
+ :key="route.path"
48
+ >
49
+ <Transition
50
+ v-bind="configs.pageTransition"
51
+ @before-leave="onBeforeLeave()"
52
+ @after-leave="onAfterLeave()"
53
+ >
54
+ <SlideWrapper
55
+ :is="route?.component as any"
56
+ v-show="route === currentRoute && !isLeaving"
57
+ :clicks="route === currentRoute ? clicks : 0"
58
+ :clicks-elements="route.meta?.__clicksElements || []"
59
+ :clicks-disabled="false"
60
+ :class="getSlideClass(route)"
61
+ :route="route"
62
+ :context="context"
63
+ />
64
+ </Transition>
44
65
  </template>
45
66
 
46
67
  <!-- Global Top -->
package/logic/drawings.ts CHANGED
@@ -76,6 +76,7 @@ export function loadCanvas(page?: number) {
76
76
  drauu.load(data)
77
77
  else
78
78
  drauu.clear()
79
+ updateState()
79
80
  disableDump = false
80
81
  }
81
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.38.5",
3
+ "version": "0.38.7",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -40,8 +40,8 @@
40
40
  "vue-router": "^4.1.6",
41
41
  "vue-starport": "^0.3.0",
42
42
  "windicss": "^3.5.6",
43
- "@slidev/parser": "0.38.5",
44
- "@slidev/types": "0.38.5"
43
+ "@slidev/parser": "0.38.7",
44
+ "@slidev/types": "0.38.7"
45
45
  },
46
46
  "devDependencies": {
47
47
  "vite": "^4.0.4"