@slidev/client 0.48.0-beta.20 → 0.48.0-beta.22

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.
Files changed (49) hide show
  1. package/builtin/CodeBlockWrapper.vue +23 -25
  2. package/builtin/ShikiMagicMove.vue +63 -13
  3. package/builtin/SlidevVideo.vue +1 -1
  4. package/builtin/Toc.vue +1 -1
  5. package/builtin/TocList.vue +1 -1
  6. package/composables/useClicks.ts +16 -15
  7. package/composables/useContext.ts +4 -9
  8. package/composables/useNav.ts +182 -44
  9. package/composables/useSwipeControls.ts +40 -0
  10. package/composables/useTocTree.ts +63 -0
  11. package/constants.ts +2 -3
  12. package/context.ts +3 -6
  13. package/env.ts +4 -4
  14. package/internals/Goto.vue +2 -2
  15. package/internals/NavControls.vue +7 -5
  16. package/internals/NoteStatic.vue +1 -1
  17. package/internals/PrintContainer.vue +8 -7
  18. package/internals/PrintSlide.vue +6 -13
  19. package/internals/PrintSlideClick.vue +11 -13
  20. package/internals/QuickOverview.vue +10 -10
  21. package/internals/SideEditor.vue +3 -3
  22. package/internals/SlideContainer.vue +6 -6
  23. package/internals/SlideLoading.vue +19 -0
  24. package/internals/SlideWrapper.ts +12 -12
  25. package/internals/SlidesShow.vue +13 -10
  26. package/layouts/error.vue +5 -0
  27. package/logic/drawings.ts +7 -7
  28. package/logic/nav-state.ts +20 -0
  29. package/logic/nav.ts +49 -259
  30. package/logic/note.ts +2 -2
  31. package/logic/overview.ts +2 -2
  32. package/logic/route.ts +10 -1
  33. package/logic/slides.ts +19 -0
  34. package/logic/transition.ts +50 -0
  35. package/logic/utils.ts +24 -0
  36. package/modules/context.ts +7 -12
  37. package/package.json +8 -7
  38. package/pages/notes.vue +2 -3
  39. package/pages/overview.vue +19 -21
  40. package/pages/play.vue +2 -1
  41. package/pages/presenter/print.vue +2 -2
  42. package/pages/presenter.vue +15 -14
  43. package/routes.ts +6 -14
  44. package/setup/root.ts +6 -7
  45. package/setup/shortcuts.ts +2 -1
  46. package/shim-vue.d.ts +3 -0
  47. package/state/index.ts +1 -1
  48. package/styles/code.css +2 -2
  49. package/utils.ts +15 -2
package/logic/nav.ts CHANGED
@@ -1,44 +1,20 @@
1
- import type { Ref, TransitionGroupProps } from 'vue'
2
- import type { RouteRecordRaw } from 'vue-router'
3
- import { computed, nextTick, ref, watch } from 'vue'
4
- import type { TocItem } from '@slidev/types'
5
- import { timestamp, usePointerSwipe } from '@vueuse/core'
6
- import { rawRoutes, router } from '../routes'
7
- import { configs } from '../env'
8
- import { skipTransition } from '../composables/hmr'
1
+ import { computed, watch } from 'vue'
2
+ import { router } from '../routes'
9
3
  import { usePrimaryClicks } from '../composables/useClicks'
10
4
  import { CLICKS_MAX } from '../constants'
5
+ import { useNavBase } from '../composables/useNav'
11
6
  import { useRouteQuery } from './route'
12
- import { isDrawing } from './drawings'
7
+ import { currentRoute, currentSlideRoute, hasPrimarySlide } from './nav-state'
8
+ import { getSlide } from './slides'
13
9
 
14
- export { rawRoutes, router }
10
+ export * from './slides'
11
+ export * from './nav-state'
15
12
 
16
- // force update collected elements when the route is fully resolved
17
- export const routeForceRefresh = ref(0)
18
- nextTick(() => {
19
- router.afterEach(async () => {
20
- await nextTick()
21
- routeForceRefresh.value += 1
22
- })
23
- })
24
-
25
- export const navDirection = ref(0)
26
- export const clicksDirection = ref(0)
27
-
28
- export const route = computed(() => router.currentRoute.value)
29
-
30
- export const isPrintMode = computed(() => route.value.query.print !== undefined)
31
- export const isPrintWithClicks = computed(() => route.value.query.print === 'clicks')
32
- export const isEmbedded = computed(() => route.value.query.embedded !== undefined)
33
- export const isPresenter = computed(() => route.value.path.startsWith('/presenter'))
34
- export const isNotesViewer = computed(() => route.value.path.startsWith('/notes'))
35
- export const presenterPassword = computed(() => route.value.query.password)
36
- export const showPresenter = computed(() => !isPresenter.value && (!configs.remote || presenterPassword.value === configs.remote))
13
+ export const clicksContext = computed(() => usePrimaryClicks(currentSlideRoute.value))
37
14
 
38
15
  const queryClicksRaw = useRouteQuery('clicks', '0')
39
16
  export const queryClicks = computed({
40
17
  get() {
41
- // eslint-disable-next-line ts/no-use-before-define
42
18
  if (clicksContext.value.disabled)
43
19
  return CLICKS_MAX
44
20
  let v = +(queryClicksRaw.value || 0)
@@ -51,231 +27,45 @@ export const queryClicks = computed({
51
27
  },
52
28
  })
53
29
 
54
- export const total = computed(() => rawRoutes.length)
55
- export const path = computed(() => route.value.path)
56
-
57
- export const currentPage = computed(() => Number.parseInt(path.value.split(/\//g).slice(-1)[0]) || 1)
58
- export const currentPath = computed(() => getPath(currentPage.value))
59
- export const currentRoute = computed(() => rawRoutes.find(i => i.path === `${currentPage.value}`))
60
- export const currentSlideId = computed(() => currentRoute.value?.meta?.slide?.id)
61
- export const currentLayout = computed(() => currentRoute.value?.meta?.layout || (currentPage.value === 1 ? 'cover' : 'default'))
62
-
63
- export const nextRoute = computed(() => rawRoutes.find(i => i.path === `${Math.min(rawRoutes.length, currentPage.value + 1)}`))
64
- export const prevRoute = computed(() => rawRoutes.find(i => i.path === `${Math.max(1, currentPage.value - 1)}`))
65
-
66
- export const clicksContext = computed(() => usePrimaryClicks(currentRoute.value))
67
- export const clicks = computed(() => clicksContext.value.current)
68
- export const clicksTotal = computed(() => clicksContext.value.total)
69
-
70
- export const hasNext = computed(() => currentPage.value < rawRoutes.length || clicks.value < clicksTotal.value)
71
- export const hasPrev = computed(() => currentPage.value > 1 || clicks.value > 0)
72
-
73
- export const rawTree = computed(() => rawRoutes
74
- .filter((route: RouteRecordRaw) => route.meta?.slide?.title)
75
- .reduce((acc: TocItem[], route: RouteRecordRaw) => {
76
- addToTree(acc, route)
77
- return acc
78
- }, []))
79
- export const treeWithActiveStatuses = computed(() => getTreeWithActiveStatuses(rawTree.value, currentRoute.value))
80
- export const tree = computed(() => filterTree(treeWithActiveStatuses.value))
81
-
82
- export const transition = computed(() => getCurrentTransition(navDirection.value, currentRoute.value, prevRoute.value))
83
-
84
- watch(currentRoute, (next, prev) => {
85
- navDirection.value = Number(next?.path) - Number(prev?.path)
86
- })
87
-
88
- export async function next() {
89
- clicksDirection.value = 1
90
- if (clicksTotal.value <= queryClicks.value)
91
- await nextSlide()
92
- else
93
- queryClicks.value += 1
94
- }
95
-
96
- export async function prev() {
97
- clicksDirection.value = -1
98
- if (queryClicks.value <= 0)
99
- await prevSlide()
100
- else
101
- queryClicks.value -= 1
102
- }
103
-
104
- export function getPath(no: number | string) {
105
- return isPresenter.value ? `/presenter/${no}` : `/${no}`
106
- }
107
-
108
- export async function nextSlide() {
109
- clicksDirection.value = 1
110
- if (currentPage.value < rawRoutes.length)
111
- await go(currentPage.value + 1)
112
- }
113
-
114
- export async function prevSlide(lastClicks = true) {
115
- clicksDirection.value = -1
116
- const next = Math.max(1, currentPage.value - 1)
117
- await go(next)
118
- if (lastClicks && clicksTotal.value)
119
- router.replace({ query: { ...route.value.query, clicks: clicksTotal.value } })
120
- }
121
-
122
- export function goFirst() {
123
- return go(1)
124
- }
125
-
126
- export function goLast() {
127
- return go(total.value)
128
- }
129
-
130
- export function go(page: number | string, clicks?: number) {
131
- skipTransition.value = false
132
- return router.push({ path: getPath(page), query: { ...route.value.query, clicks } })
133
- }
134
-
135
- export function useSwipeControls(root: Ref<HTMLElement | undefined>) {
136
- const swipeBegin = ref(0)
137
- const { direction, distanceX, distanceY } = usePointerSwipe(root, {
138
- pointerTypes: ['touch'],
139
- onSwipeStart() {
140
- if (isDrawing.value)
141
- return
142
- swipeBegin.value = timestamp()
143
- },
144
- onSwipeEnd() {
145
- if (!swipeBegin.value)
146
- return
147
- if (isDrawing.value)
148
- return
149
-
150
- const x = Math.abs(distanceX.value)
151
- const y = Math.abs(distanceY.value)
152
- if (x / window.innerWidth > 0.3 || x > 75) {
153
- if (direction.value === 'left')
154
- next()
155
- else
156
- prev()
157
- }
158
- else if (y / window.innerHeight > 0.4 || y > 200) {
159
- if (direction.value === 'down')
160
- prevSlide()
161
- else
162
- nextSlide()
163
- }
164
- },
165
- })
166
- }
167
-
168
- export async function downloadPDF() {
169
- const { saveAs } = await import('file-saver')
170
- saveAs(
171
- typeof configs.download === 'string'
172
- ? configs.download
173
- : configs.exportFilename
174
- ? `${configs.exportFilename}.pdf`
175
- : `${import.meta.env.BASE_URL}slidev-exported.pdf`,
176
- `${configs.title}.pdf`,
177
- )
178
- }
179
-
180
- export async function openInEditor(url?: string) {
181
- if (url == null) {
182
- const slide = currentRoute.value?.meta?.slide
183
- if (!slide)
184
- return false
185
- url = `${slide.filepath}:${slide.start}`
186
- }
187
- await fetch(`/__open-in-editor?file=${encodeURIComponent(url)}`)
188
- return true
189
- }
190
-
191
- export function addToTree(tree: TocItem[], route: RouteRecordRaw, level = 1) {
192
- const titleLevel = route.meta?.slide?.level
193
- if (titleLevel && titleLevel > level && tree.length > 0) {
194
- addToTree(tree[tree.length - 1].children, route, level + 1)
195
- }
196
- else {
197
- tree.push({
198
- children: [],
199
- level,
200
- path: route.path,
201
- hideInToc: Boolean(route.meta?.slide?.frontmatter?.hideInToc),
202
- title: route.meta?.slide?.title,
203
- })
204
- }
205
- }
206
-
207
- export function getTreeWithActiveStatuses(
208
- tree: TocItem[],
209
- currentRoute?: RouteRecordRaw,
210
- hasActiveParent = false,
211
- parent?: TocItem,
212
- ): TocItem[] {
213
- return tree.map((item: TocItem) => {
214
- const clone = {
215
- ...item,
216
- active: item.path === currentRoute?.path,
217
- hasActiveParent,
30
+ export const {
31
+ slides,
32
+ total,
33
+ currentPath,
34
+ currentSlideNo,
35
+ currentPage,
36
+ currentLayout,
37
+ currentTransition,
38
+ clicksDirection,
39
+ nextRoute,
40
+ prevRoute,
41
+ clicks,
42
+ clicksTotal,
43
+ hasNext,
44
+ hasPrev,
45
+ tocTree,
46
+ navDirection,
47
+ openInEditor,
48
+ next,
49
+ prev,
50
+ go,
51
+ goLast,
52
+ goFirst,
53
+ nextSlide,
54
+ prevSlide,
55
+ } = useNavBase(
56
+ currentSlideRoute,
57
+ clicksContext,
58
+ queryClicks,
59
+ router,
60
+ )
61
+
62
+ watch(
63
+ [total, currentRoute],
64
+ async () => {
65
+ if (hasPrimarySlide.value && !getSlide(currentRoute.value.params.no as string)) {
66
+ // The current slide may has been removed. Redirect to the last slide.
67
+ await goLast()
218
68
  }
219
- if (clone.children.length > 0)
220
- clone.children = getTreeWithActiveStatuses(clone.children, currentRoute, clone.active || clone.hasActiveParent, clone)
221
- if (parent && (clone.active || clone.activeParent))
222
- parent.activeParent = true
223
- return clone
224
- })
225
- }
226
-
227
- export function filterTree(tree: TocItem[], level = 1): TocItem[] {
228
- return tree
229
- .filter((item: TocItem) => !item.hideInToc)
230
- .map((item: TocItem) => ({
231
- ...item,
232
- children: filterTree(item.children, level + 1),
233
- }))
234
- }
235
-
236
- const transitionResolveMap: Record<string, string | undefined> = {
237
- 'slide-left': 'slide-left | slide-right',
238
- 'slide-right': 'slide-right | slide-left',
239
- 'slide-up': 'slide-up | slide-down',
240
- 'slide-down': 'slide-down | slide-up',
241
- }
242
-
243
- export function resolveTransition(transition?: string | TransitionGroupProps, isBackward = false): TransitionGroupProps | undefined {
244
- if (!transition)
245
- return undefined
246
- if (typeof transition === 'string') {
247
- transition = {
248
- name: transition,
249
- }
250
- }
251
-
252
- if (!transition.name)
253
- return undefined
254
-
255
- let name = transition.name.includes('|')
256
- ? transition.name
257
- : (transitionResolveMap[transition.name] || transition.name)
258
-
259
- if (name.includes('|')) {
260
- const [forward, backward] = name.split('|').map(i => i.trim())
261
- name = isBackward ? backward : forward
262
- }
263
-
264
- if (!name)
265
- return undefined
266
-
267
- return {
268
- ...transition,
269
- name,
270
- }
271
- }
272
-
273
- export function getCurrentTransition(direction: number, currentRoute?: RouteRecordRaw, prevRoute?: RouteRecordRaw) {
274
- let transition = direction > 0
275
- ? prevRoute?.meta?.transition
276
- : currentRoute?.meta?.transition
277
- if (!transition)
278
- transition = configs.transition
279
-
280
- return resolveTransition(transition, direction < 0)
281
- }
69
+ },
70
+ { flush: 'pre', immediate: true },
71
+ )
package/logic/note.ts CHANGED
@@ -36,11 +36,11 @@ export function useSlideInfo(id: number | undefined): UseSlideInfo {
36
36
  }
37
37
 
38
38
  if (__DEV__) {
39
- import.meta.hot?.on('slidev-update', (payload) => {
39
+ import.meta.hot?.on('slidev:update-slide', (payload) => {
40
40
  if (payload.id === id)
41
41
  info.value = payload.data
42
42
  })
43
- import.meta.hot?.on('slidev-update-note', (payload) => {
43
+ import.meta.hot?.on('slidev:update-note', (payload) => {
44
44
  if (payload.id === id && info.value.note?.trim() !== payload.note?.trim())
45
45
  info.value = { ...info.value, ...payload }
46
46
  })
package/logic/overview.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { computed, ref } from 'vue'
2
- import { rawRoutes } from '../routes'
2
+ import { slides } from './nav'
3
3
 
4
4
  // To have same format(.value) as max, wrap it with ref.
5
5
  const min = ref(1)
6
- const max = computed(() => rawRoutes.length)
6
+ const max = computed(() => slides.value.length)
7
7
 
8
8
  export const currentOverviewPage = ref(0)
9
9
  export const overviewRowCount = ref(0)
package/logic/route.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { computed, nextTick, unref } from 'vue'
1
+ import { computed, nextTick, ref, unref } from 'vue'
2
2
  import { router } from '../routes'
3
3
 
4
4
  export function useRouteQuery<T extends string | string[]>(
@@ -24,3 +24,12 @@ export function useRouteQuery<T extends string | string[]>(
24
24
  },
25
25
  })
26
26
  }
27
+
28
+ // force update collected elements when the route is fully resolved
29
+ export const routeForceRefresh = ref(0)
30
+ nextTick(() => {
31
+ router.afterEach(async () => {
32
+ await nextTick()
33
+ routeForceRefresh.value += 1
34
+ })
35
+ })
@@ -0,0 +1,19 @@
1
+ import type { SlideRoute } from '@slidev/types'
2
+ import { router } from '../routes'
3
+ import { isPresenter } from './nav-state'
4
+ import { slides } from '#slidev/slides'
5
+
6
+ export { slides, router }
7
+
8
+ export function getSlide(no: number | string) {
9
+ return slides.value.find(
10
+ s => (s.no === +no || s.meta.slide?.frontmatter.routeAlias === no),
11
+ )
12
+ }
13
+
14
+ export function getSlidePath(route: SlideRoute | number | string, presenter = isPresenter.value) {
15
+ if (typeof route === 'number' || typeof route === 'string')
16
+ route = getSlide(route)!
17
+ const no = route.meta.slide?.frontmatter.routeAlias ?? route.no
18
+ return presenter ? `/presenter/${no}` : `/${no}`
19
+ }
@@ -0,0 +1,50 @@
1
+ import type { SlideRoute } from '@slidev/types'
2
+ import type { TransitionGroupProps } from 'vue'
3
+ import { configs } from '../env'
4
+
5
+ const transitionResolveMap: Record<string, string | undefined> = {
6
+ 'slide-left': 'slide-left | slide-right',
7
+ 'slide-right': 'slide-right | slide-left',
8
+ 'slide-up': 'slide-up | slide-down',
9
+ 'slide-down': 'slide-down | slide-up',
10
+ }
11
+
12
+ export function resolveTransition(transition?: string | TransitionGroupProps, isBackward = false): TransitionGroupProps | undefined {
13
+ if (!transition)
14
+ return undefined
15
+ if (typeof transition === 'string') {
16
+ transition = {
17
+ name: transition,
18
+ }
19
+ }
20
+
21
+ if (!transition.name)
22
+ return undefined
23
+
24
+ let name = transition.name.includes('|')
25
+ ? transition.name
26
+ : (transitionResolveMap[transition.name] || transition.name)
27
+
28
+ if (name.includes('|')) {
29
+ const [forward, backward] = name.split('|').map(i => i.trim())
30
+ name = isBackward ? backward : forward
31
+ }
32
+
33
+ if (!name)
34
+ return undefined
35
+
36
+ return {
37
+ ...transition,
38
+ name,
39
+ }
40
+ }
41
+
42
+ export function getCurrentTransition(direction: number, currentRoute?: SlideRoute, prevRoute?: SlideRoute) {
43
+ let transition = direction > 0
44
+ ? prevRoute?.meta?.transition
45
+ : currentRoute?.meta?.transition
46
+ if (!transition)
47
+ transition = configs.transition
48
+
49
+ return resolveTransition(transition, direction < 0)
50
+ }
package/logic/utils.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import { parseRangeString } from '@slidev/parser/core'
1
2
  import { useTimestamp } from '@vueuse/core'
2
3
  import { computed, ref } from 'vue'
4
+ import { CLASS_VCLICK_TARGET } from '../constants'
3
5
 
4
6
  export function useTimer() {
5
7
  const tsStart = ref(Date.now())
@@ -48,3 +50,25 @@ export function normalizeAtProp(at: string | number = '+1'): [isRelative: boolea
48
50
  n,
49
51
  ]
50
52
  }
53
+
54
+ export function updateCodeHighlightRange(
55
+ rangeStr: string,
56
+ linesCount: number,
57
+ startLine: number,
58
+ getTokenOfLine: (line: number) => Element[],
59
+ ) {
60
+ const highlights: number[] = parseRangeString(linesCount + startLine - 1, rangeStr)
61
+ for (let line = 0; line < linesCount; line++) {
62
+ const tokens = getTokenOfLine(line)
63
+ const isHighlighted = highlights.includes(line + startLine)
64
+ for (const token of tokens) {
65
+ token.classList.toggle(CLASS_VCLICK_TARGET, true)
66
+ token.classList.toggle('slidev-code-highlighted', isHighlighted)
67
+ token.classList.toggle('slidev-code-dishonored', !isHighlighted)
68
+
69
+ // for backward compatibility
70
+ token.classList.toggle('highlighted', isHighlighted)
71
+ token.classList.toggle('dishonored', !isHighlighted)
72
+ }
73
+ }
74
+ }
@@ -1,19 +1,13 @@
1
1
  import type { App } from 'vue'
2
- import { computed, reactive, ref } from 'vue'
3
- import type { RouteLocationNormalizedLoaded, RouteRecordRaw } from 'vue-router'
2
+ import { computed, reactive, ref, shallowRef } from 'vue'
4
3
  import type { ComputedRef } from '@vue/reactivity'
5
4
  import type { configs } from '../env'
6
5
  import * as nav from '../logic/nav'
7
- import { route } from '../logic/nav'
8
6
  import { isDark } from '../logic/dark'
9
- import { injectionCurrentPage, injectionRenderContext, injectionSlidevContext } from '../constants'
7
+ import { injectionClicksContext, injectionCurrentPage, injectionRenderContext, injectionSlidevContext } from '../constants'
10
8
  import { useContext } from '../composables/useContext'
11
-
12
- export type SlidevContextNavKey = 'path' | 'total' | 'clicksContext' | 'clicks' | 'clicksTotal' | 'currentPage' | 'currentPath' | 'currentRoute' | 'currentSlideId' | 'currentLayout' | 'nextRoute' | 'rawTree' | 'treeWithActiveStatuses' | 'tree' | 'downloadPDF' | 'next' | 'nextSlide' | 'openInEditor' | 'prev' | 'prevSlide' | 'rawRoutes' | 'go'
13
-
14
- export interface SlidevContextNav extends Pick<typeof nav, SlidevContextNavKey> {
15
- route: ComputedRef<RouteRecordRaw | RouteLocationNormalizedLoaded>
16
- }
9
+ import type { SlidevContextNav } from '../composables/useNav'
10
+ import { useFixedClicks } from '../composables/useClicks'
17
11
 
18
12
  export interface SlidevContext {
19
13
  nav: SlidevContextNav
@@ -24,10 +18,11 @@ export interface SlidevContext {
24
18
  export function createSlidevContext() {
25
19
  return {
26
20
  install(app: App) {
27
- const context = reactive(useContext(route))
21
+ const context = reactive(useContext())
28
22
  app.provide(injectionRenderContext, ref('none'))
29
23
  app.provide(injectionSlidevContext, context)
30
- app.provide(injectionCurrentPage, computed(() => context.nav.currentPage))
24
+ app.provide(injectionCurrentPage, computed(() => context.nav.currentSlideNo))
25
+ app.provide(injectionClicksContext, shallowRef(useFixedClicks()))
31
26
 
32
27
  // allows controls from postMessages
33
28
  if (__DEV__) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
3
  "type": "module",
4
- "version": "0.48.0-beta.20",
4
+ "version": "0.48.0-beta.22",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "antfu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -27,13 +27,14 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@antfu/utils": "^0.7.7",
30
- "@iconify-json/carbon": "^1.1.30",
30
+ "@iconify-json/carbon": "^1.1.31",
31
31
  "@iconify-json/ph": "^1.1.11",
32
+ "@iconify-json/svg-spinners": "^1.1.2",
32
33
  "@shikijs/monaco": "^1.1.7",
33
34
  "@shikijs/vitepress-twoslash": "^1.1.7",
34
35
  "@slidev/rough-notation": "^0.1.0",
35
36
  "@typescript/ata": "^0.9.4",
36
- "@unhead/vue": "^1.8.10",
37
+ "@unhead/vue": "^1.8.11",
37
38
  "@unocss/reset": "^0.58.5",
38
39
  "@vueuse/core": "^10.9.0",
39
40
  "@vueuse/math": "^10.9.0",
@@ -51,13 +52,13 @@
51
52
  "prettier": "^3.2.5",
52
53
  "recordrtc": "^5.6.2",
53
54
  "shiki": "^1.1.7",
54
- "shiki-magic-move": "^0.1.0",
55
+ "shiki-magic-move": "^0.3.0",
55
56
  "typescript": "^5.3.3",
56
57
  "unocss": "^0.58.5",
57
- "vue": "^3.4.20",
58
+ "vue": "^3.4.21",
58
59
  "vue-router": "^4.3.0",
59
- "@slidev/types": "0.48.0-beta.20",
60
- "@slidev/parser": "0.48.0-beta.20"
60
+ "@slidev/parser": "0.48.0-beta.22",
61
+ "@slidev/types": "0.48.0-beta.22"
61
62
  },
62
63
  "devDependencies": {
63
64
  "vite": "^5.1.4"
package/pages/notes.vue CHANGED
@@ -5,8 +5,7 @@ import { useLocalStorage } from '@vueuse/core'
5
5
  import { configs } from '../env'
6
6
  import { sharedState } from '../state/shared'
7
7
  import { fullscreen } from '../state'
8
- import { total } from '../logic/nav'
9
- import { rawRoutes } from '../routes'
8
+ import { slides, total } from '../logic/nav'
10
9
  import NoteDisplay from '../internals/NoteDisplay.vue'
11
10
  import IconButton from '../internals/IconButton.vue'
12
11
 
@@ -20,7 +19,7 @@ const { isFullscreen, toggle: toggleFullscreen } = fullscreen
20
19
  const scroller = ref<HTMLDivElement>()
21
20
  const fontSize = useLocalStorage('slidev-notes-font-size', 18)
22
21
  const pageNo = computed(() => sharedState.lastUpdate?.type === 'viewer' ? sharedState.viewerPage : sharedState.page)
23
- const currentRoute = computed(() => rawRoutes.find(i => i.path === `${pageNo.value}`))
22
+ const currentRoute = computed(() => slides.value.find(i => i.no === pageNo.value))
24
23
 
25
24
  watch(pageNo, () => {
26
25
  scroller.value?.scrollTo({ left: 0, top: 0, behavior: 'smooth' })