@slidev/client 51.6.2 → 51.7.1
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/composables/useClicks.ts +6 -2
- package/internals/NoteDisplay.vue +18 -18
- package/package.json +5 -5
package/composables/useClicks.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClicksContext, NormalizedRangeClickValue, NormalizedSingleClickValue, RawAtValue, RawSingleAtValue, SlideRoute } from '@slidev/types'
|
|
2
2
|
import type { MaybeRefOrGetter, Ref } from 'vue'
|
|
3
3
|
import { clamp, sum } from '@antfu/utils'
|
|
4
|
-
import { computed, isReadonly, onMounted, onUnmounted, ref, shallowReactive, toValue } from 'vue'
|
|
4
|
+
import { computed, isReadonly, onMounted, onUnmounted, ref, shallowReactive, toValue, watch } from 'vue'
|
|
5
5
|
|
|
6
6
|
export function normalizeSingleAtValue(at: RawSingleAtValue): NormalizedSingleClickValue {
|
|
7
7
|
if (at === false || at === 'false')
|
|
@@ -164,8 +164,12 @@ export function createFixedClicks(
|
|
|
164
164
|
currentInit: MaybeRefOrGetter<number> = 0,
|
|
165
165
|
): ClicksContext {
|
|
166
166
|
const clicksStart = route?.meta.slide?.frontmatter.clicksStart ?? 0
|
|
167
|
+
const clicks = ref(Math.max(toValue(currentInit), clicksStart))
|
|
168
|
+
watch(() => toValue(currentInit), (v) => {
|
|
169
|
+
clicks.value = Math.max(v, clicksStart)
|
|
170
|
+
})
|
|
167
171
|
return createClicksContextBase(
|
|
168
|
-
|
|
172
|
+
clicks,
|
|
169
173
|
clicksStart,
|
|
170
174
|
route?.meta?.clicks,
|
|
171
175
|
)
|
|
@@ -23,12 +23,12 @@ const emit = defineEmits<{
|
|
|
23
23
|
(type: 'markerClick', e: MouseEvent, clicks: number): void
|
|
24
24
|
}>()
|
|
25
25
|
|
|
26
|
-
const withClicks = computed(() => props.clicksContext != null && props.noteHtml?.includes('slidev-note-click-mark'))
|
|
27
|
-
const noteDisplay = ref<HTMLElement | null>(null)
|
|
28
|
-
|
|
29
26
|
const CLASS_FADE = 'slidev-note-fade'
|
|
30
27
|
const CLASS_MARKER = 'slidev-note-click-mark'
|
|
31
28
|
|
|
29
|
+
const withClicks = computed(() => props.clicksContext != null && props.noteHtml?.includes(CLASS_MARKER))
|
|
30
|
+
const noteDisplay = ref<HTMLElement | null>(null)
|
|
31
|
+
|
|
32
32
|
function processNote() {
|
|
33
33
|
if (!noteDisplay.value || !withClicks.value)
|
|
34
34
|
return
|
|
@@ -100,21 +100,21 @@ function processNote() {
|
|
|
100
100
|
marker.classList.toggle(`${CLASS_MARKER}-active`, enabled && clicks === current)
|
|
101
101
|
marker.classList.toggle(`${CLASS_MARKER}-next`, enabled && clicks === current + 1)
|
|
102
102
|
marker.classList.toggle(`${CLASS_MARKER}-future`, enabled && clicks > current + 1)
|
|
103
|
-
marker.ondblclick =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
marker.onclick =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
marker.ondblclick = (e) => {
|
|
104
|
+
if (!enabled)
|
|
105
|
+
return
|
|
106
|
+
emit('markerDblclick', e, clicks)
|
|
107
|
+
if (e.defaultPrevented)
|
|
108
|
+
return
|
|
109
|
+
props.clicksContext!.current = clicks
|
|
110
|
+
e.stopPropagation()
|
|
111
|
+
e.stopImmediatePropagation()
|
|
112
|
+
}
|
|
113
|
+
marker.onclick = (e) => {
|
|
114
|
+
if (enabled) {
|
|
115
|
+
emit('markerClick', e, clicks)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
118
|
|
|
119
119
|
if (enabled && props.autoScroll && clicks === current)
|
|
120
120
|
marker.scrollIntoView({ block: 'center', behavior: 'smooth' })
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "51.
|
|
4
|
+
"version": "51.7.1",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@shikijs/vitepress-twoslash": "^3.4.2",
|
|
38
38
|
"@slidev/rough-notation": "^0.1.0",
|
|
39
39
|
"@typescript/ata": "^0.9.7",
|
|
40
|
-
"@unhead/vue": "^2.0.
|
|
40
|
+
"@unhead/vue": "^2.0.9",
|
|
41
41
|
"@unocss/reset": "^66.1.2",
|
|
42
42
|
"@vueuse/core": "^13.2.0",
|
|
43
43
|
"@vueuse/math": "^13.2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"katex": "^0.16.22",
|
|
50
50
|
"lz-string": "^1.5.0",
|
|
51
51
|
"mermaid": "^11.6.0",
|
|
52
|
-
"monaco-editor": "0.
|
|
52
|
+
"monaco-editor": "^0.52.2",
|
|
53
53
|
"nanotar": "^0.2.0",
|
|
54
54
|
"pptxgenjs": "^4.0.0",
|
|
55
55
|
"prettier": "^3.5.3",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"vue": "^3.5.14",
|
|
62
62
|
"vue-router": "^4.5.1",
|
|
63
63
|
"yaml": "^2.8.0",
|
|
64
|
-
"@slidev/
|
|
65
|
-
"@slidev/
|
|
64
|
+
"@slidev/parser": "51.7.1",
|
|
65
|
+
"@slidev/types": "51.7.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"vite": "^6.3.5"
|