@slidev/client 0.40.10 → 0.40.12

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.
@@ -81,7 +81,7 @@ onMounted(() => {
81
81
  line.classList.toggle('dishonored', !highlighted)
82
82
  })
83
83
  if (props.maxHeight) {
84
- const highlightedEls = Array.from(target.querySelectorAll('.line.highlighted'))
84
+ const highlightedEls = Array.from(target.querySelectorAll('.line.highlighted')) as HTMLElement[]
85
85
  const height = highlightedEls.reduce((acc, el) => el.offsetHeight + acc, 0)
86
86
  if (height > el.value.offsetHeight) {
87
87
  highlightedEls[0].scrollIntoView({ behavior: 'smooth', block: 'start' })
@@ -25,7 +25,7 @@ const props = defineProps<{
25
25
  }>()
26
26
 
27
27
  const vm = getCurrentInstance()
28
- const el = ref<HTMLDivElement>()
28
+ const el = ref<ShadowRoot>()
29
29
  const html = ref('')
30
30
 
31
31
  watchEffect(async (onCleanup) => {
@@ -10,7 +10,6 @@ Usage:
10
10
  import { computed } from 'vue'
11
11
  import { toArray } from '@antfu/utils'
12
12
  import type { TocItem } from '@slidev/types'
13
- // @ts-expect-error virtual module
14
13
  import Titles from '/@slidev/titles.md'
15
14
 
16
15
  const props = withDefaults(defineProps<{
@@ -82,7 +82,7 @@ export default defineComponent({
82
82
  const directive = idx % this.every === 0 ? click : after
83
83
  let vNode
84
84
  let childCount = 0
85
- if (depth < this.depth && Array.isArray(i.children)) {
85
+ if (depth < +this.depth && Array.isArray(i.children)) {
86
86
  const [vNodes, total] = mapSubList(i.children, depth)
87
87
  vNode = h(i, {}, [vNodes])
88
88
  childCount = total
@@ -83,7 +83,8 @@ watchEffect(() => {
83
83
  class="pointer-events-none"
84
84
  >
85
85
  <SlideWrapper
86
- :is="route?.component"
86
+ :is="route.component"
87
+ v-if="route?.component"
87
88
  :clicks-disabled="true"
88
89
  :class="getSlideClass(route)"
89
90
  :route="route"
@@ -8,7 +8,7 @@ const size = useLocalStorage('slidev-webcam-size', Math.round(Math.min(window.in
8
8
  const position = useLocalStorage('slidev-webcam-pos', {
9
9
  x: window.innerWidth - size.value - 30,
10
10
  y: window.innerHeight - size.value - 30,
11
- }, undefined, { deep: true })
11
+ }, { deep: true })
12
12
 
13
13
  const frame = ref<HTMLDivElement | undefined>()
14
14
  const handler = ref<HTMLDivElement | undefined>()
@@ -17,7 +17,7 @@ const scaleInvertPercent = computed(() => `${(1 / (props.scale || 1)) * 100}%`)
17
17
  :src="url"
18
18
  :style="scale ? { transform: `scale(${scale})`, transformOrigin: 'top left' } : {}"
19
19
  />
20
- <div class="slidev-layout default" :class="props.class">
20
+ <div class="slidev-layout default" v-bind="$attrs">
21
21
  <slot />
22
22
  </div>
23
23
  </div>
@@ -11,7 +11,7 @@ const scaleInvertPercent = computed(() => `${(1 / (props.scale || 1)) * 100}%`)
11
11
 
12
12
  <template>
13
13
  <div class="grid grid-cols-2 w-full h-full">
14
- <div class="slidev-layout default" :class="props.class">
14
+ <div class="slidev-layout default" v-bind="$attrs">
15
15
  <slot />
16
16
  </div>
17
17
  <div relative :style="{ width: scaleInvertPercent, height: scaleInvertPercent }">
package/logic/nav.ts CHANGED
@@ -2,7 +2,7 @@ import type { Ref, TransitionGroupProps } from 'vue'
2
2
  import type { RouteRecordRaw } from 'vue-router'
3
3
  import { computed, nextTick, ref, watch } from 'vue'
4
4
  import type { TocItem } from '@slidev/types'
5
- import { SwipeDirection, isString, timestamp, usePointerSwipe } from '@vueuse/core'
5
+ import { timestamp, usePointerSwipe } from '@vueuse/core'
6
6
  import { rawRoutes, router } from '../routes'
7
7
  import { configs } from '../env'
8
8
  import { useRouteQuery } from './route'
@@ -147,13 +147,13 @@ export function useSwipeControls(root: Ref<HTMLElement | undefined>) {
147
147
  const x = Math.abs(distanceX.value)
148
148
  const y = Math.abs(distanceY.value)
149
149
  if (x / window.innerWidth > 0.3 || x > 100) {
150
- if (direction.value === SwipeDirection.LEFT)
150
+ if (direction.value === 'left')
151
151
  next()
152
152
  else
153
153
  prev()
154
154
  }
155
155
  else if (y / window.innerHeight > 0.4 || y > 200) {
156
- if (direction.value === SwipeDirection.DOWN)
156
+ if (direction.value === 'down')
157
157
  prevSlide()
158
158
  else
159
159
  nextSlide()
@@ -165,7 +165,7 @@ export function useSwipeControls(root: Ref<HTMLElement | undefined>) {
165
165
  export async function downloadPDF() {
166
166
  const { saveAs } = await import('file-saver')
167
167
  saveAs(
168
- isString(configs.download)
168
+ typeof configs.download === 'string'
169
169
  ? configs.download
170
170
  : configs.exportFilename
171
171
  ? `${configs.exportFilename}.pdf`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.40.10",
3
+ "version": "0.40.12",
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.2",
19
- "@unocss/reset": "^0.51.0",
20
- "@vueuse/core": "^9.13.0",
21
- "@vueuse/head": "^1.1.23",
22
- "@vueuse/math": "^9.13.0",
19
+ "@unocss/reset": "^0.51.4",
20
+ "@vueuse/core": "^10.0.2",
21
+ "@vueuse/head": "^1.1.26",
22
+ "@vueuse/math": "^10.0.2",
23
23
  "@vueuse/motion": "^2.0.0-beta.27",
24
24
  "codemirror": "^5.65.5",
25
25
  "defu": "^6.1.2",
@@ -28,23 +28,23 @@
28
28
  "fuse.js": "^6.6.2",
29
29
  "js-base64": "^3.7.5",
30
30
  "js-yaml": "^4.1.0",
31
- "katex": "^0.16.4",
31
+ "katex": "^0.16.6",
32
32
  "mermaid": "^10.1.0",
33
33
  "monaco-editor": "^0.37.1",
34
34
  "nanoid": "^4.0.2",
35
35
  "prettier": "^2.8.7",
36
36
  "recordrtc": "^5.6.2",
37
37
  "resolve": "^1.22.2",
38
- "unocss": "^0.51.0",
38
+ "unocss": "^0.51.4",
39
39
  "vite-plugin-windicss": "^1.8.10",
40
40
  "vue": "^3.2.47",
41
41
  "vue-router": "^4.1.6",
42
42
  "vue-starport": "^0.3.0",
43
43
  "windicss": "^3.5.6",
44
- "@slidev/parser": "0.40.10",
45
- "@slidev/types": "0.40.10"
44
+ "@slidev/parser": "0.40.12",
45
+ "@slidev/types": "0.40.12"
46
46
  },
47
47
  "devDependencies": {
48
- "vite": "^4.2.1"
48
+ "vite": "^4.2.2"
49
49
  }
50
50
  }
package/setup/monaco.ts CHANGED
@@ -2,6 +2,7 @@ import { getCurrentInstance, onMounted } from 'vue'
2
2
  import * as monaco from 'monaco-editor'
3
3
  import { createSingletonPromise } from '@antfu/utils'
4
4
  import type { MonacoSetupReturn } from '@slidev/types'
5
+
5
6
  /* __imports__ */
6
7
 
7
8
  const setup = createSingletonPromise(async () => {
@@ -31,7 +32,6 @@ const setup = createSingletonPromise(async () => {
31
32
  import('monaco-editor/esm/vs/language/typescript/ts.worker?worker'),
32
33
  ])
33
34
 
34
- // @ts-expect-error global config for monaca
35
35
  window.MonacoEnvironment = {
36
36
  getWorker(_: any, label: string) {
37
37
  if (label === 'json')