@slidev/client 51.7.0 → 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.
@@ -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
- computed(() => Math.max(toValue(currentInit), clicksStart)),
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 = enabled
104
- ? (e) => {
105
- emit('markerDblclick', e, clicks)
106
- if (e.defaultPrevented)
107
- return
108
- props.clicksContext!.current = clicks
109
- e.stopPropagation()
110
- e.stopImmediatePropagation()
111
- }
112
- : null
113
- marker.onclick = enabled
114
- ? (e) => {
115
- emit('markerClick', e, clicks)
116
- }
117
- : null
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.7.0",
4
+ "version": "51.7.1",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -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/parser": "51.7.0",
65
- "@slidev/types": "51.7.0"
64
+ "@slidev/parser": "51.7.1",
65
+ "@slidev/types": "51.7.1"
66
66
  },
67
67
  "devDependencies": {
68
68
  "vite": "^6.3.5"