@slidev/client 0.47.4 → 0.47.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.
package/builtin/VClick.ts CHANGED
@@ -4,7 +4,8 @@
4
4
  * Learn more: https://sli.dev/guide/animations.html#click-animations
5
5
  */
6
6
 
7
- import { createVNode, defineComponent } from 'vue'
7
+ import type { PropType, VNode } from 'vue'
8
+ import { Text, defineComponent, h } from 'vue'
8
9
  import VClicks from './VClicks'
9
10
 
10
11
  export default defineComponent({
@@ -21,9 +22,13 @@ export default defineComponent({
21
22
  type: Boolean,
22
23
  default: false,
23
24
  },
25
+ wrapText: {
26
+ type: Function as PropType<(text: VNode) => VNode>,
27
+ default: (text: VNode) => h('span', text),
28
+ },
24
29
  },
25
30
  render() {
26
- return createVNode(
31
+ return h(
27
32
  VClicks,
28
33
  {
29
34
  every: 99999,
@@ -31,7 +36,14 @@ export default defineComponent({
31
36
  hide: this.hide,
32
37
  fade: this.fade,
33
38
  },
34
- { default: this.$slots.default },
39
+ {
40
+ default: () =>
41
+ this.$slots.default?.().map(v =>
42
+ v.type === Text
43
+ ? this.wrapText(v)
44
+ : v,
45
+ ),
46
+ },
35
47
  )
36
48
  },
37
49
  })
package/logic/note.ts CHANGED
@@ -40,6 +40,10 @@ export function useSlideInfo(id: number | undefined): UseSlideInfo {
40
40
  if (payload.id === id)
41
41
  info.value = payload.data
42
42
  })
43
+ import.meta.hot?.on('slidev-update-note', (payload) => {
44
+ if (payload.id === id && info.value.note.trim() !== payload.note.trim())
45
+ info.value = { ...info.value, ...payload }
46
+ })
43
47
  }
44
48
 
45
49
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.47.4",
3
+ "version": "0.47.5",
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.7",
23
- "@iconify-json/carbon": "^1.1.28",
23
+ "@iconify-json/carbon": "^1.1.30",
24
24
  "@iconify-json/ph": "^1.1.11",
25
- "@shikijs/vitepress-twoslash": "^1.0.0-beta.5",
25
+ "@shikijs/vitepress-twoslash": "^1.1.1",
26
26
  "@unhead/vue": "^1.8.10",
27
27
  "@unocss/reset": "^0.58.5",
28
28
  "@vueuse/core": "^10.7.2",
@@ -44,12 +44,12 @@
44
44
  "recordrtc": "^5.6.2",
45
45
  "resolve": "^1.22.8",
46
46
  "unocss": "^0.58.5",
47
- "vue": "^3.4.15",
47
+ "vue": "^3.4.18",
48
48
  "vue-router": "^4.2.5",
49
- "@slidev/parser": "0.47.4",
50
- "@slidev/types": "0.47.4"
49
+ "@slidev/parser": "0.47.5",
50
+ "@slidev/types": "0.47.5"
51
51
  },
52
52
  "devDependencies": {
53
- "vite": "^5.0.12"
53
+ "vite": "^5.1.1"
54
54
  }
55
55
  }
@@ -1,6 +1,6 @@
1
1
  import type { Ref, WritableComputedRef } from 'vue'
2
2
  import { watch } from 'vue'
3
- import * as CodeMirror from 'codemirror'
3
+ import * as _CodeMirror from 'codemirror'
4
4
  import 'codemirror/mode/javascript/javascript'
5
5
  import 'codemirror/mode/css/css'
6
6
  import 'codemirror/mode/markdown/markdown'
@@ -9,6 +9,10 @@ import 'codemirror/mode/htmlmixed/htmlmixed'
9
9
  import 'codemirror/addon/display/placeholder'
10
10
  import 'codemirror/lib/codemirror.css'
11
11
 
12
+ // eslint-disable-next-line ts/ban-ts-comment
13
+ // @ts-expect-error
14
+ const CodeMirror: typeof _CodeMirror = _CodeMirror.fromTextArea ? _CodeMirror : globalThis.CodeMirror
15
+
12
16
  export async function useCodeMirror(
13
17
  textarea: Ref<HTMLTextAreaElement | null | undefined>,
14
18
  input: Ref<string> | WritableComputedRef<string>,