@slidev/client 0.38.5 → 0.38.8

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>
package/builtin/Tweet.vue CHANGED
@@ -58,7 +58,7 @@ else {
58
58
 
59
59
  <template>
60
60
  <Transform :scale="scale || 1">
61
- <div ref="tweet" class="tweet" :data-waitfor="tweetNotFound ? '' : 'iframe'">
61
+ <div ref="tweet" class="tweet">
62
62
  <div v-if="!loaded || tweetNotFound" class="w-30 h-30 my-10px bg-gray-400 bg-opacity-10 rounded-lg flex opacity-50">
63
63
  <div class="m-auto animate-pulse text-4xl">
64
64
  <carbon:logo-twitter />
@@ -9,6 +9,7 @@ import Controls from './Controls.vue'
9
9
  import SlideContainer from './SlideContainer.vue'
10
10
  import NavControls from './NavControls.vue'
11
11
  import SlidesShow from './SlidesShow.vue'
12
+ import PrintStyle from './PrintStyle.vue'
12
13
 
13
14
  registerShortcuts()
14
15
 
@@ -40,6 +41,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
40
41
  </script>
41
42
 
42
43
  <template>
44
+ <PrintStyle v-if="isPrintMode" />
43
45
  <div id="page-root" ref="root" class="grid grid-cols-[1fr_max-content]" :style="themeVars">
44
46
  <SlideContainer
45
47
  class="w-full h-full"
@@ -1,15 +1,10 @@
1
1
  <script setup lang="ts">
2
- import type { Slots } from 'vue'
3
- import { h, watchEffect } from 'vue'
2
+ import { watchEffect } from 'vue'
4
3
  import { windowSize } from '../state'
5
4
  import { isPrintMode } from '../logic/nav'
6
- import { slideHeight, slideWidth, themeVars } from '../env'
5
+ import { themeVars } from '../env'
7
6
  import PrintContainer from './PrintContainer.vue'
8
-
9
- function vStyle<Props>(props: Props, { slots }: { slots: Slots }) {
10
- if (slots.default)
11
- return h('style', slots.default())
12
- }
7
+ import PrintStyle from './PrintStyle.vue'
13
8
 
14
9
  watchEffect(() => {
15
10
  if (isPrintMode)
@@ -20,9 +15,7 @@ watchEffect(() => {
20
15
  </script>
21
16
 
22
17
  <template>
23
- <vStyle>
24
- @page { size: {{ slideWidth }}px {{ slideHeight }}px; margin: 0px; }
25
- </vStyle>
18
+ <PrintStyle v-if="isPrintMode" />
26
19
  <div id="page-root" class="grid grid-cols-[1fr_max-content]" :style="themeVars">
27
20
  <PrintContainer
28
21
  class="w-full h-full"
@@ -50,7 +50,7 @@ provide(injectionSlideScale, scale)
50
50
  @apply bg-main;
51
51
  }
52
52
 
53
- .slide-container {
53
+ .print-slide-container {
54
54
  @apply relative overflow-hidden break-after-page;
55
55
  }
56
56
  </style>
@@ -45,7 +45,7 @@ provide(injectionSlidevContext, reactive({
45
45
  </script>
46
46
 
47
47
  <template>
48
- <div :id="id" class="slide-container" :style="style">
48
+ <div :id="id" class="print-slide-container" :style="style">
49
49
  <GlobalBottom />
50
50
 
51
51
  <SlideWrapper
@@ -0,0 +1,16 @@
1
+ <script setup lang="ts">
2
+ import type { Slots } from 'vue'
3
+ import { h } from 'vue'
4
+ import { slideHeight, slideWidth } from '../env'
5
+
6
+ function vStyle<Props>(props: Props, { slots }: { slots: Slots }) {
7
+ if (slots.default)
8
+ return h('style', slots.default())
9
+ }
10
+ </script>
11
+
12
+ <template>
13
+ <vStyle>
14
+ @page { size: {{ slideWidth }}px {{ slideHeight }}px; margin: 0px; }
15
+ </vStyle>
16
+ </template>
@@ -3,6 +3,7 @@ import { useElementSize } from '@vueuse/core'
3
3
  import { computed, provide, ref, watchEffect } from 'vue'
4
4
  import { configs, slideAspect, slideHeight, slideWidth } from '../env'
5
5
  import { injectionSlideScale } from '../constants'
6
+ import { isPrintMode } from '../logic/nav'
6
7
 
7
8
  const props = defineProps({
8
9
  width: {
@@ -34,7 +35,7 @@ if (props.width) {
34
35
  const screenAspect = computed(() => width.value / height.value)
35
36
 
36
37
  const scale = computed(() => {
37
- if (props.scale)
38
+ if (props.scale && !isPrintMode.value)
38
39
  return props.scale
39
40
  if (screenAspect.value < slideAspect)
40
41
  return width.value / slideWidth
@@ -66,7 +67,7 @@ provide(injectionSlideScale, scale)
66
67
 
67
68
  <style lang="postcss">
68
69
  #slide-container {
69
- @apply relative overflow-hidden;
70
+ @apply relative overflow-hidden break-after-page;
70
71
  }
71
72
 
72
73
  #slide-content {
@@ -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.8",
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.8",
44
+ "@slidev/types": "0.38.8"
45
45
  },
46
46
  "devDependencies": {
47
47
  "vite": "^4.0.4"