@slidev/client 0.49.8 → 0.49.9

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/logic/slides.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { SlideRoute } from '@slidev/types'
2
- import { pathPrefix } from '../env'
3
2
  import { slides } from '#slidev/slides'
4
3
 
5
4
  export { slides }
@@ -17,5 +16,5 @@ export function getSlidePath(
17
16
  if (typeof route === 'number' || typeof route === 'string')
18
17
  route = getSlide(route)!
19
18
  const no = route.meta.slide?.frontmatter.routeAlias ?? route.no
20
- return presenter ? `${pathPrefix}presenter/${no}` : `${pathPrefix}${no}`
19
+ return presenter ? `/presenter/${no}` : `/${no}`
21
20
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
3
  "type": "module",
4
- "version": "0.49.8",
4
+ "version": "0.49.9",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "antfu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -35,12 +35,12 @@
35
35
  "@shikijs/monaco": "^1.6.1",
36
36
  "@shikijs/vitepress-twoslash": "^1.6.1",
37
37
  "@slidev/rough-notation": "^0.1.0",
38
- "@typescript/ata": "^0.9.4",
38
+ "@typescript/ata": "^0.9.5",
39
39
  "@unhead/vue": "^1.9.11",
40
- "@unocss/reset": "^0.60.3",
40
+ "@unocss/reset": "^0.60.4",
41
41
  "@vueuse/core": "^10.10.0",
42
42
  "@vueuse/math": "^10.10.0",
43
- "@vueuse/motion": "^2.1.0",
43
+ "@vueuse/motion": "^2.2.3",
44
44
  "codemirror": "^5.65.16",
45
45
  "drauu": "^0.4.0",
46
46
  "file-saver": "^2.0.5",
@@ -50,17 +50,17 @@
50
50
  "lz-string": "^1.5.0",
51
51
  "mermaid": "^10.9.1",
52
52
  "monaco-editor": "^0.49.0",
53
- "prettier": "^3.2.5",
53
+ "prettier": "^3.3.0",
54
54
  "recordrtc": "^5.6.2",
55
55
  "shiki": "^1.6.1",
56
56
  "shiki-magic-move": "^0.4.2",
57
57
  "typescript": "^5.4.5",
58
- "unocss": "^0.60.3",
58
+ "unocss": "^0.60.4",
59
59
  "vue": "^3.4.27",
60
60
  "vue-router": "^4.3.2",
61
61
  "yaml": "^2.4.2",
62
- "@slidev/parser": "0.49.8",
63
- "@slidev/types": "0.49.8"
62
+ "@slidev/parser": "0.49.9",
63
+ "@slidev/types": "0.49.9"
64
64
  },
65
65
  "devDependencies": {
66
66
  "vite": "^5.2.12"
package/pages/404.vue ADDED
@@ -0,0 +1,46 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import { useRouter } from 'vue-router'
4
+ import { useNav } from '../composables/useNav'
5
+
6
+ const { currentRoute } = useRouter()
7
+ const { total } = useNav()
8
+
9
+ const guessedSlide = computed(() => {
10
+ const path = currentRoute.value.path
11
+ const match = path.match(/\d+/)
12
+ if (match) {
13
+ const slideNo = +match[0]
14
+ if (slideNo > 0 && slideNo <= total.value)
15
+ return slideNo
16
+ }
17
+ return null
18
+ })
19
+ </script>
20
+
21
+ <template>
22
+ <div class="grid justify-center pt-15%">
23
+ <div>
24
+ <h1 class="text-9xl font-bold">
25
+ 404
26
+ </h1>
27
+ <p class="text-2xl">
28
+ Page not found<code class="op-70">:{{ currentRoute.path }}</code>
29
+ </p>
30
+ <div class="mt-3 flex flex-col gap-2">
31
+ <RouterLink v-if="guessedSlide !== 1" to="/" class="page-link">
32
+ Go Home
33
+ </RouterLink>
34
+ <RouterLink v-if="guessedSlide" :to="`/${guessedSlide}`" class="page-link">
35
+ Go to Slide {{ guessedSlide }}
36
+ </RouterLink>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </template>
41
+
42
+ <style scoped lang="postcss">
43
+ .page-link {
44
+ @apply py-2 px-4 bg-gray/10 hover:bg-gray/20 rounded;
45
+ }
46
+ </style>
@@ -2,7 +2,7 @@
2
2
  import { computed, nextTick, onMounted, reactive, ref } from 'vue'
3
3
  import { useHead } from '@unhead/vue'
4
4
  import type { ClicksContext, SlideRoute } from '@slidev/types'
5
- import { slidesTitle } from '../env'
5
+ import { pathPrefix, slidesTitle } from '../env'
6
6
  import { getSlidePath } from '../logic/slides'
7
7
  import { createFixedClicks } from '../composables/useClicks'
8
8
  import { isColorSchemaConfigured, isDark, toggleDark } from '../logic/dark'
@@ -68,7 +68,7 @@ function checkActiveBlocks() {
68
68
  function openSlideInNewTab(path: string) {
69
69
  const a = document.createElement('a')
70
70
  a.target = '_blank'
71
- a.href = path
71
+ a.href = pathPrefix + path.slice(1)
72
72
  a.click()
73
73
  }
74
74
 
package/setup/routes.ts CHANGED
@@ -74,6 +74,11 @@ export default function setupRoutes() {
74
74
  path: '',
75
75
  redirect: { path: '/1' },
76
76
  },
77
+ {
78
+ path: '/:pathMatch(.*)*',
79
+ name: 'NotFound',
80
+ component: () => import('../pages/404.vue'),
81
+ },
77
82
  )
78
83
 
79
84
  return setups.reduce((routes, setup) => setup(routes), routes)