@slidev/client 52.2.3 → 52.2.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/ShikiMagicMove.vue +38 -1
- package/internals/NoteDisplay.vue +3 -3
- package/package.json +11 -11
- package/styles/index.css +5 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { KeyedTokensInfo } from 'shiki-magic-move/types'
|
|
3
3
|
import type { PropType } from 'vue'
|
|
4
4
|
import { sleep } from '@antfu/utils'
|
|
5
|
+
import { useClipboard } from '@vueuse/core'
|
|
5
6
|
import lz from 'lz-string'
|
|
6
7
|
import { ShikiMagicMovePrecompiled } from 'shiki-magic-move/vue'
|
|
7
8
|
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
@@ -43,6 +44,33 @@ const id = makeId()
|
|
|
43
44
|
const stepIndex = ref(0)
|
|
44
45
|
const container = ref<HTMLElement>()
|
|
45
46
|
|
|
47
|
+
const showCopyButton = computed(() => {
|
|
48
|
+
if (!configs.codeCopy)
|
|
49
|
+
return false
|
|
50
|
+
|
|
51
|
+
const magicCopy = configs.magicMoveCopy
|
|
52
|
+
if (!magicCopy)
|
|
53
|
+
return false
|
|
54
|
+
|
|
55
|
+
if (magicCopy === true || magicCopy === 'always')
|
|
56
|
+
return true
|
|
57
|
+
|
|
58
|
+
if (magicCopy === 'final')
|
|
59
|
+
return stepIndex.value === steps.length - 1
|
|
60
|
+
|
|
61
|
+
return false
|
|
62
|
+
})
|
|
63
|
+
const { copied, copy } = useClipboard()
|
|
64
|
+
|
|
65
|
+
function copyCode() {
|
|
66
|
+
// Use the code property directly from KeyedTokensInfo
|
|
67
|
+
const currentStep = steps[stepIndex.value]
|
|
68
|
+
if (!currentStep || !currentStep.code)
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
copy(currentStep.code.trim())
|
|
72
|
+
}
|
|
73
|
+
|
|
46
74
|
// Normalized the ranges, to at least have one range
|
|
47
75
|
const ranges = computed(() => props.stepRanges.map(i => i.length ? i : ['all']))
|
|
48
76
|
|
|
@@ -116,7 +144,7 @@ onMounted(() => {
|
|
|
116
144
|
</script>
|
|
117
145
|
|
|
118
146
|
<template>
|
|
119
|
-
<div ref="container" class="slidev-code-wrapper slidev-code-magic-move relative">
|
|
147
|
+
<div ref="container" class="slidev-code-wrapper slidev-code-magic-move relative group">
|
|
120
148
|
<div v-if="title" class="slidev-code-block-title">
|
|
121
149
|
<TitleIcon :title="title" />
|
|
122
150
|
<div class="leading-1em">
|
|
@@ -135,6 +163,15 @@ onMounted(() => {
|
|
|
135
163
|
stagger: 1,
|
|
136
164
|
}"
|
|
137
165
|
/>
|
|
166
|
+
<button
|
|
167
|
+
v-if="showCopyButton"
|
|
168
|
+
class="slidev-code-copy absolute right-0 transition opacity-0 group-hover:opacity-20 hover:!opacity-100"
|
|
169
|
+
:class="title ? 'top-10' : 'top-0'"
|
|
170
|
+
:title="copied ? 'Copied' : 'Copy'" @click="copyCode()"
|
|
171
|
+
>
|
|
172
|
+
<ph-check-circle v-if="copied" class="p-2 w-8 h-8" />
|
|
173
|
+
<ph-clipboard v-else class="p-2 w-8 h-8" />
|
|
174
|
+
</button>
|
|
138
175
|
</div>
|
|
139
176
|
</template>
|
|
140
177
|
|
|
@@ -148,20 +148,20 @@ watchEffect(() => {
|
|
|
148
148
|
<div
|
|
149
149
|
v-if="noteHtml"
|
|
150
150
|
ref="noteDisplay"
|
|
151
|
-
class="prose overflow-auto outline-none slidev-note"
|
|
151
|
+
class="prose dark:prose-invert overflow-auto outline-none slidev-note"
|
|
152
152
|
:class="[props.class, withClicks ? 'slidev-note-with-clicks' : '']"
|
|
153
153
|
v-html="noteHtml"
|
|
154
154
|
/>
|
|
155
155
|
<div
|
|
156
156
|
v-else-if="note"
|
|
157
|
-
class="prose overflow-auto outline-none slidev-note"
|
|
157
|
+
class="prose dark:prose-invert overflow-auto outline-none slidev-note"
|
|
158
158
|
:class="props.class"
|
|
159
159
|
>
|
|
160
160
|
<p v-text="note" />
|
|
161
161
|
</div>
|
|
162
162
|
<div
|
|
163
163
|
v-else
|
|
164
|
-
class="prose overflow-auto outline-none opacity-50 italic select-none slidev-note"
|
|
164
|
+
class="prose dark:prose-invert overflow-auto outline-none opacity-50 italic select-none slidev-note"
|
|
165
165
|
:class="props.class"
|
|
166
166
|
>
|
|
167
167
|
<p v-text="props.placeholder || 'No notes.'" />
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "52.2.
|
|
4
|
+
"version": "52.2.5",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"node": ">=18.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@antfu/utils": "^9.
|
|
31
|
+
"@antfu/utils": "^9.3.0",
|
|
32
32
|
"@iconify-json/carbon": "^1.2.13",
|
|
33
33
|
"@iconify-json/ph": "^1.2.2",
|
|
34
34
|
"@iconify-json/svg-spinners": "^1.2.4",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@slidev/rough-notation": "^0.1.0",
|
|
39
39
|
"@typescript/ata": "^0.9.8",
|
|
40
40
|
"@unhead/vue": "^2.0.17",
|
|
41
|
-
"@unocss/reset": "^66.5.
|
|
41
|
+
"@unocss/reset": "^66.5.2",
|
|
42
42
|
"@vueuse/core": "^13.9.0",
|
|
43
43
|
"@vueuse/math": "^13.9.0",
|
|
44
44
|
"@vueuse/motion": "^3.0.3",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"file-saver": "^2.0.5",
|
|
47
47
|
"floating-vue": "^5.2.2",
|
|
48
48
|
"fuse.js": "^7.1.0",
|
|
49
|
-
"katex": "^0.16.
|
|
49
|
+
"katex": "^0.16.23",
|
|
50
50
|
"lz-string": "^1.5.0",
|
|
51
51
|
"mermaid": "^11.12.0",
|
|
52
52
|
"monaco-editor": "^0.53.0",
|
|
@@ -55,16 +55,16 @@
|
|
|
55
55
|
"prettier": "^3.6.2",
|
|
56
56
|
"recordrtc": "^5.6.2",
|
|
57
57
|
"shiki": "^3.13.0",
|
|
58
|
-
"shiki-magic-move": "^1.
|
|
59
|
-
"typescript": "^5.9.
|
|
60
|
-
"unocss": "^66.5.
|
|
61
|
-
"vue": "^3.5.
|
|
58
|
+
"shiki-magic-move": "^1.2.0",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"unocss": "^66.5.2",
|
|
61
|
+
"vue": "^3.5.22",
|
|
62
62
|
"vue-router": "^4.5.1",
|
|
63
63
|
"yaml": "^2.8.1",
|
|
64
|
-
"@slidev/parser": "52.2.
|
|
65
|
-
"@slidev/types": "52.2.
|
|
64
|
+
"@slidev/parser": "52.2.5",
|
|
65
|
+
"@slidev/types": "52.2.5"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"vite": "^7.1.
|
|
68
|
+
"vite": "^7.1.9"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/styles/index.css
CHANGED