@troshab/slidev-theme-troshab 0.1.3 → 0.1.4
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/components/Stepper.vue +5 -5
- package/package.json +1 -1
package/components/Stepper.vue
CHANGED
|
@@ -74,7 +74,7 @@ const clicksContext = inject<Ref<ClicksContext>>('$$slidev-clicks-context', ref(
|
|
|
74
74
|
|
|
75
75
|
// --- Auto v-click registration (clicks mode) ---
|
|
76
76
|
const rootEl = ref<HTMLElement | null>(null)
|
|
77
|
-
const autoActiveStep = ref(
|
|
77
|
+
const autoActiveStep = ref(1)
|
|
78
78
|
const isAutoRegistered = ref(false)
|
|
79
79
|
|
|
80
80
|
onMounted(() => {
|
|
@@ -82,7 +82,7 @@ onMounted(() => {
|
|
|
82
82
|
const ctx = clicksContext.value
|
|
83
83
|
if (!ctx?.calculateSince || !rootEl.value) return
|
|
84
84
|
|
|
85
|
-
const size = normalizedItems.value.length -
|
|
85
|
+
const size = normalizedItems.value.length - 1
|
|
86
86
|
if (size <= 0) return
|
|
87
87
|
|
|
88
88
|
const info = ctx.calculateSince('+1', size)
|
|
@@ -97,7 +97,7 @@ onMounted(() => {
|
|
|
97
97
|
watchEffect(() => {
|
|
98
98
|
const active = isActiveRef.value
|
|
99
99
|
const offset = offsetRef.value
|
|
100
|
-
autoActiveStep.value = active ? Math.min(offset +
|
|
100
|
+
autoActiveStep.value = active ? Math.min(offset + 2, normalizedItems.value.length) : 1
|
|
101
101
|
})
|
|
102
102
|
})
|
|
103
103
|
|
|
@@ -113,7 +113,7 @@ const activeStep = computed(() => {
|
|
|
113
113
|
if (isAutoRegistered.value) return autoActiveStep.value
|
|
114
114
|
// Fallback: direct click count (non-Slidev contexts)
|
|
115
115
|
const clicks = clicksContext.value?.current ?? 0
|
|
116
|
-
return Math.min(clicks +
|
|
116
|
+
return Math.min(clicks + 1, normalizedItems.value.length)
|
|
117
117
|
}
|
|
118
118
|
return props.current
|
|
119
119
|
})
|
|
@@ -194,7 +194,7 @@ function isUpcoming(index: number) {
|
|
|
194
194
|
</template>
|
|
195
195
|
<!-- Number (numbers + arrows) -->
|
|
196
196
|
<template v-else-if="variant !== 'dots'">
|
|
197
|
-
{{ index +
|
|
197
|
+
{{ index + start }}
|
|
198
198
|
</template>
|
|
199
199
|
<!-- Dots: empty circle, no content -->
|
|
200
200
|
</div>
|
package/package.json
CHANGED