@slidev/client 0.43.13 → 0.43.15

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.
@@ -10,8 +10,17 @@ export function useViewTransition() {
10
10
 
11
11
  const supportViewTransition = typeof document !== 'undefined' && 'startViewTransition' in document
12
12
 
13
- router.beforeResolve((from, to) => {
14
- if (!(from.meta.transition === 'view-transition' || to.meta.transition === 'view-transition')) {
13
+ router.beforeResolve((to, from) => {
14
+ const fromNo = from.meta.slide?.no
15
+ const toNo = to.meta.slide?.no
16
+ if (
17
+ !(
18
+ fromNo !== undefined && toNo !== undefined && (
19
+ (from.meta.transition === 'view-transition' && fromNo < toNo)
20
+ || (to.meta.transition === 'view-transition' && toNo < fromNo)
21
+ )
22
+ )
23
+ ) {
15
24
  isViewTransition.value = false
16
25
  return
17
26
  }
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useHead } from '@vueuse/head'
2
+ import { useHead } from '@unhead/vue'
3
3
  import { computed, ref, watch } from 'vue'
4
4
  import { useLocalStorage } from '@vueuse/core'
5
5
  import { configs } from '../env'
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useHead } from '@vueuse/head'
2
+ import { useHead } from '@unhead/vue'
3
3
  import { computed, onMounted, reactive, ref, shallowRef, watch } from 'vue'
4
4
  import { useMouse, useWindowFocus } from '@vueuse/core'
5
5
  import { clicks, clicksTotal, currentPage, currentRoute, hasNext, nextRoute, total, useSwipeControls } from '../logic/nav'
@@ -141,7 +141,7 @@ onMounted(() => {
141
141
  <div v-if="__DEV__ && __SLIDEV_FEATURE_EDITOR__ && Editor && showEditor" class="grid-section note of-auto">
142
142
  <Editor />
143
143
  </div>
144
- <div v-else class="grid-section note grid grid-rows-[1fr_min-content]">
144
+ <div v-else class="grid-section note grid grid-rows-[1fr_min-content] overflow-hidden">
145
145
  <NoteEditor
146
146
  v-if="__DEV__"
147
147
  class="w-full max-w-full h-full overflow-auto p-2 lg:p-4"
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
3
  import { useStyleTag } from '@vueuse/core'
4
- import { useHead } from '@vueuse/head'
4
+ import { useHead } from '@unhead/vue'
5
5
  import { configs, themeVars } from '../env'
6
6
  import { rawRoutes, total } from '../logic/nav'
7
7
  import NoteDisplay from './NoteDisplay.vue'
@@ -8,6 +8,7 @@ import PrintSlideClick from './PrintSlideClick.vue'
8
8
  const props = defineProps<{ route: RouteRecordRaw }>()
9
9
 
10
10
  const clicksElements = ref(props.route.meta?.__clicksElements || [])
11
+ const clicks = computed(() => props.route.meta?.clicks ?? clicksElements.value.length)
11
12
 
12
13
  const route = computed(() => props.route)
13
14
  const nav = useNav(route)
@@ -16,6 +17,6 @@ const nav = useNav(route)
16
17
  <template>
17
18
  <PrintSlideClick v-model:clicks-elements="clicksElements" :clicks="0" :nav="nav" :route="route" />
18
19
  <template v-if="!isClicksDisabled">
19
- <PrintSlideClick v-for="i of (clicksElements.length)" :key="i" :clicks="i" :nav="nav" :route="route" />
20
+ <PrintSlideClick v-for="i of clicks" :key="i" :clicks="i" :nav="nav" :route="route" />
20
21
  </template>
21
22
  </template>
package/main.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createApp } from 'vue'
2
- import { createHead } from '@vueuse/head'
2
+ import { createHead } from '@unhead/vue'
3
3
  import App from './App.vue'
4
4
  import setupMain from './setup/main'
5
5
  import { router } from './routes'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.43.13",
3
+ "version": "0.43.15",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -20,9 +20,9 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@antfu/utils": "^0.7.6",
23
- "@unocss/reset": "^0.57.1",
23
+ "@unhead/vue": "^1.8.3",
24
+ "@unocss/reset": "^0.57.3",
24
25
  "@vueuse/core": "^10.5.0",
25
- "@vueuse/head": "^2.0.0",
26
26
  "@vueuse/math": "^10.5.0",
27
27
  "@vueuse/motion": "^2.0.0",
28
28
  "codemirror": "^5.65.5",
@@ -33,20 +33,20 @@
33
33
  "js-base64": "^3.7.5",
34
34
  "js-yaml": "^4.1.0",
35
35
  "katex": "^0.16.9",
36
- "mermaid": "^10.6.0",
36
+ "mermaid": "^10.6.1",
37
37
  "monaco-editor": "^0.37.1",
38
- "nanoid": "^5.0.2",
38
+ "nanoid": "^5.0.3",
39
39
  "prettier": "^3.0.3",
40
40
  "recordrtc": "^5.6.2",
41
41
  "resolve": "^1.22.8",
42
- "unocss": "^0.57.1",
42
+ "unocss": "^0.57.3",
43
43
  "vite-plugin-windicss": "^1.9.1",
44
- "vue": "^3.3.7",
44
+ "vue": "^3.3.8",
45
45
  "vue-router": "^4.2.5",
46
46
  "vue-starport": "^0.4.0",
47
47
  "windicss": "^3.5.6",
48
- "@slidev/types": "0.43.13",
49
- "@slidev/parser": "0.43.13"
48
+ "@slidev/parser": "0.43.15",
49
+ "@slidev/types": "0.43.15"
50
50
  },
51
51
  "devDependencies": {
52
52
  "vite": "^4.5.0"
package/routes.ts CHANGED
@@ -82,6 +82,7 @@ declare module 'vue-router' {
82
82
  class?: string
83
83
  clicks?: number
84
84
  transition?: string | TransitionGroupProps | undefined
85
+ preload?: boolean
85
86
 
86
87
  // slide info
87
88
  slide?: {
package/setup/root.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /* __imports__ */
2
2
  import { watch } from 'vue'
3
- import { useHead } from '@vueuse/head'
3
+ import { useHead } from '@unhead/vue'
4
4
  import { nanoid } from 'nanoid'
5
5
  import { configs } from '../env'
6
6
  import { initSharedState, onPatch, patch } from '../state/shared'
@@ -8,6 +8,7 @@ import { initDrawingState } from '../state/drawings'
8
8
  import { clicks, currentPage, getPath, isNotesViewer, isPresenter } from '../logic/nav'
9
9
  import { router } from '../routes'
10
10
  import { TRUST_ORIGINS } from '../constants'
11
+ import { skipTransition } from '../composables/hmr'
11
12
 
12
13
  export default function setupRoot() {
13
14
  // @ts-expect-error injected in runtime
@@ -58,6 +59,7 @@ export default function setupRoot() {
58
59
  if (!routePath.match(/^\/(\d+|presenter)\/?/))
59
60
  return
60
61
  if (state.lastUpdate?.type === 'presenter' && (+state.page !== +currentPage.value || +clicks.value !== +state.clicks)) {
62
+ skipTransition.value = false
61
63
  router.replace({
62
64
  path: getPath(state.page),
63
65
  query: {