@rokkit/app 1.0.0-next.145 → 1.0.0-next.146
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/package.json
CHANGED
|
@@ -60,7 +60,9 @@
|
|
|
60
60
|
const main = getContainer()
|
|
61
61
|
if (!el || !main) return
|
|
62
62
|
clearTimeout(scrollLockTimer)
|
|
63
|
-
scrollLockTimer = setTimeout(() => {
|
|
63
|
+
scrollLockTimer = setTimeout(() => {
|
|
64
|
+
scrollLockTimer = null
|
|
65
|
+
}, 1000)
|
|
64
66
|
main.scrollTo({ top: el.offsetTop - 16, behavior: 'smooth' })
|
|
65
67
|
}
|
|
66
68
|
|
|
@@ -95,18 +97,13 @@
|
|
|
95
97
|
scrollToHeading(id)
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
function handleClick(event) {
|
|
99
|
-
const btn = event.target.closest('[data-toc-item]')
|
|
100
|
-
if (!btn) return
|
|
101
|
-
const index = parseInt(btn.dataset.tocIndex ?? '0', 10)
|
|
102
|
-
focusedIndex = index
|
|
103
|
-
scrollToHeading(headings[index]?.id)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
100
|
onMount(() => {
|
|
107
101
|
scan()
|
|
108
102
|
observe()
|
|
109
|
-
return () => {
|
|
103
|
+
return () => {
|
|
104
|
+
observer?.disconnect()
|
|
105
|
+
clearTimeout(scrollLockTimer)
|
|
106
|
+
}
|
|
110
107
|
})
|
|
111
108
|
</script>
|
|
112
109
|
|
|
@@ -132,7 +129,11 @@
|
|
|
132
129
|
data-toc-focused={focusedIndex === i ? '' : undefined}
|
|
133
130
|
tabindex={focusedIndex === i ? 0 : -1}
|
|
134
131
|
onfocusin={() => (focusedIndex = i)}
|
|
135
|
-
onclick={() => {
|
|
132
|
+
onclick={() => {
|
|
133
|
+
focusedIndex = i
|
|
134
|
+
activeId = h.id
|
|
135
|
+
scrollToHeading(h.id)
|
|
136
|
+
}}
|
|
136
137
|
>
|
|
137
138
|
{h.text}
|
|
138
139
|
</button>
|