@slidev/client 0.42.4 → 0.42.5

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 @@ watch([container, value, containerSize.width, innerSize.width], async () => {
49
49
  if (!container.value || innerSize.width.value <= 0)
50
50
  return
51
51
  const ratio = containerSize.width.value / innerSize.width.value
52
- if (isNaN(ratio) || ratio <= 0)
52
+ if (Number.isNaN(ratio) || ratio <= 0)
53
53
  return
54
54
  let newSize = size.value * (containerSize.width.value / innerSize.width.value)
55
55
  if (newSize < props.min) {
@@ -53,8 +53,8 @@ watch(html, () => {
53
53
  watchEffect(() => {
54
54
  const svgEl = el.value?.children?.[0] as SVGElement | undefined
55
55
  if (svgEl && svgEl.hasAttribute('viewBox') && actualHeight.value == null) {
56
- const v = parseFloat(svgEl.getAttribute('viewBox')?.split(' ')[3] || '')
57
- actualHeight.value = isNaN(v) ? undefined : v
56
+ const v = Number.parseFloat(svgEl.getAttribute('viewBox')?.split(' ')[3] || '')
57
+ actualHeight.value = Number.isNaN(v) ? undefined : v
58
58
  }
59
59
  }, { flush: 'post' })
60
60
 
@@ -7,7 +7,7 @@
7
7
  import { toArray } from '@antfu/utils'
8
8
  import type { Directive, VNode, VNodeArrayChildren } from 'vue'
9
9
 
10
- import { defineComponent, h, isVNode, resolveDirective, withDirectives } from 'vue'
10
+ import { Comment, defineComponent, h, isVNode, resolveDirective, withDirectives } from 'vue'
11
11
 
12
12
  const listTags = ['ul', 'ol']
13
13
 
@@ -77,7 +77,7 @@ export default defineComponent({
77
77
  const mapChildren = (children: VNodeArrayChildren, depth = 1): [VNodeArrayChildren, number] => {
78
78
  let idx = 0
79
79
  const vNodes = children.map((i) => {
80
- if (!isVNode(i))
80
+ if (!isVNode(i) || i.type === Comment)
81
81
  return i
82
82
  const directive = idx % this.every === 0 ? click : after
83
83
  let vNode
@@ -10,7 +10,7 @@ export function useNav(route: ComputedRef<RouteRecordRaw | RouteLocationNormaliz
10
10
  const path = computed(() => route.value.path)
11
11
  const total = computed(() => rawRoutes.length)
12
12
 
13
- const currentPage = computed(() => parseInt(path.value.split(/\//g).slice(-1)[0]) || 1)
13
+ const currentPage = computed(() => Number.parseInt(path.value.split(/\//g).slice(-1)[0]) || 1)
14
14
  const currentPath = computed(() => getPath(currentPage.value))
15
15
  const currentRoute = computed(() => rawRoutes.find(i => i.path === `${currentPage.value}`))
16
16
  const currentSlideId = computed(() => currentRoute.value?.meta?.slide?.id)
package/logic/nav.ts CHANGED
@@ -35,7 +35,7 @@ export const queryClicks = useRouteQuery('clicks', '0')
35
35
  export const total = computed(() => rawRoutes.length)
36
36
  export const path = computed(() => route.value.path)
37
37
 
38
- export const currentPage = computed(() => parseInt(path.value.split(/\//g).slice(-1)[0]) || 1)
38
+ export const currentPage = computed(() => Number.parseInt(path.value.split(/\//g).slice(-1)[0]) || 1)
39
39
  export const currentPath = computed(() => getPath(currentPage.value))
40
40
  export const currentRoute = computed(() => rawRoutes.find(i => i.path === `${currentPage.value}`))
41
41
  export const currentSlideId = computed(() => currentRoute.value?.meta?.slide?.id)
@@ -55,7 +55,7 @@ export const clicks = computed<number>({
55
55
  if (isClicksDisabled.value)
56
56
  return 99999
57
57
  let clicks = +(queryClicks.value || 0)
58
- if (isNaN(clicks))
58
+ if (Number.isNaN(clicks))
59
59
  clicks = 0
60
60
  return clicks
61
61
  },
@@ -66,7 +66,7 @@ export const clicks = computed<number>({
66
66
 
67
67
  export const clicksTotal = computed(() => +(currentRoute.value?.meta?.clicks ?? clicksElements.value.length))
68
68
 
69
- export const hasNext = computed(() => currentPage.value < rawRoutes.length - 1 || clicks.value < clicksTotal.value)
69
+ export const hasNext = computed(() => currentPage.value < rawRoutes.length || clicks.value < clicksTotal.value)
70
70
  export const hasPrev = computed(() => currentPage.value > 1 || clicks.value > 0)
71
71
 
72
72
  export const rawTree = computed(() => rawRoutes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.42.4",
3
+ "version": "0.42.5",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -16,10 +16,10 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@antfu/utils": "^0.7.4",
19
- "@unocss/reset": "^0.53.0",
20
- "@vueuse/core": "^10.1.2",
19
+ "@unocss/reset": "^0.53.1",
20
+ "@vueuse/core": "^10.2.0",
21
21
  "@vueuse/head": "^1.1.26",
22
- "@vueuse/math": "^10.1.2",
22
+ "@vueuse/math": "^10.2.0",
23
23
  "@vueuse/motion": "^2.0.0",
24
24
  "codemirror": "^5.65.5",
25
25
  "defu": "^6.1.2",
@@ -29,20 +29,20 @@
29
29
  "js-base64": "^3.7.5",
30
30
  "js-yaml": "^4.1.0",
31
31
  "katex": "^0.16.7",
32
- "mermaid": "^10.2.2",
32
+ "mermaid": "^10.2.3",
33
33
  "monaco-editor": "^0.37.1",
34
34
  "nanoid": "^4.0.2",
35
35
  "prettier": "^2.8.8",
36
36
  "recordrtc": "^5.6.2",
37
37
  "resolve": "^1.22.2",
38
- "unocss": "^0.53.0",
38
+ "unocss": "^0.53.1",
39
39
  "vite-plugin-windicss": "^1.9.0",
40
40
  "vue": "^3.3.4",
41
41
  "vue-router": "^4.2.2",
42
42
  "vue-starport": "^0.3.0",
43
43
  "windicss": "^3.5.6",
44
- "@slidev/parser": "0.42.4",
45
- "@slidev/types": "0.42.4"
44
+ "@slidev/parser": "0.42.5",
45
+ "@slidev/types": "0.42.5"
46
46
  },
47
47
  "devDependencies": {
48
48
  "vite": "^4.3.9"
package/routes.ts CHANGED
@@ -5,7 +5,7 @@ import Play from './internals/Play.vue'
5
5
  import Print from './internals/Print.vue'
6
6
 
7
7
  // @ts-expect-error missing types
8
- import _rawRoutes from '/@slidev/routes'
8
+ import _rawRoutes, { redirects } from '/@slidev/routes'
9
9
 
10
10
  // @ts-expect-error missing types
11
11
  import _configs from '/@slidev/configs'
@@ -19,6 +19,7 @@ export const routes: RouteRecordRaw[] = [
19
19
  component: Play,
20
20
  children: [
21
21
  ...rawRoutes,
22
+ ...redirects,
22
23
  ],
23
24
  },
24
25
  { name: 'print', path: '/print', component: Print },