@docsector/docsector-reader 0.11.0 → 0.12.0
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/README.md +1 -1
- package/bin/docsector.js +1 -1
- package/package.json +1 -1
- package/src/components/DPageAnchor.vue +36 -2
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ Transform Markdown content into beautiful, navigable documentation sites — wit
|
|
|
38
38
|
- 🚨 **GitHub-Style Alerts** — Native support for `[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, and `[!CAUTION]`
|
|
39
39
|
- 🌍 **Internationalization (i18n)** — Multi-language support with HJSON locale files and per-page translations
|
|
40
40
|
- 🌗 **Dark/Light Mode** — Automatic theme switching with Quasar Dark Plugin
|
|
41
|
-
- 🔗 **Anchor Navigation** — Right-side Table of Contents tree with scroll tracking
|
|
41
|
+
- 🔗 **Anchor Navigation** — Right-side Table of Contents tree with scroll tracking and auto-scroll to active section
|
|
42
42
|
- 🔎 **Search** — Menu search across all documentation content and tags
|
|
43
43
|
- 📱 **Responsive** — Mobile-friendly with collapsible sidebar and drawers
|
|
44
44
|
- 🏷️ **Status Badges** — Mark pages as `done`, `draft`, or `empty` with visual indicators
|
package/bin/docsector.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docsector/docsector-reader",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "A documentation rendering engine built with Vue 3, Quasar v2 and Vite. Transform Markdown into beautiful, navigable documentation sites.",
|
|
5
5
|
"productName": "Docsector Reader",
|
|
6
6
|
"author": "Rodrigo de Araujo Vieira",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, onMounted, onBeforeUnmount } from 'vue'
|
|
2
|
+
import { computed, ref, watch, onMounted, onBeforeUnmount } from 'vue'
|
|
3
3
|
import { useStore } from 'vuex'
|
|
4
|
-
import { useQuasar } from 'quasar'
|
|
4
|
+
import { useQuasar, scroll as quasarScroll } from 'quasar'
|
|
5
5
|
import { useRoute } from "vue-router";
|
|
6
6
|
|
|
7
7
|
import useNavigator from '../composables/useNavigator'
|
|
@@ -11,6 +11,8 @@ const $q = useQuasar()
|
|
|
11
11
|
const route = useRoute()
|
|
12
12
|
const { navigate, anchor, selected: navigatorSelected } = useNavigator()
|
|
13
13
|
|
|
14
|
+
const scrolling = ref(null)
|
|
15
|
+
|
|
14
16
|
const nodes = computed(() => store.getters['page/nodes'])
|
|
15
17
|
const expanded = computed({
|
|
16
18
|
get() {
|
|
@@ -45,6 +47,34 @@ const stylize = computed(() => {
|
|
|
45
47
|
}
|
|
46
48
|
})
|
|
47
49
|
|
|
50
|
+
const scrollToActiveAnchor = () => {
|
|
51
|
+
if (scrolling.value) {
|
|
52
|
+
clearTimeout(scrolling.value)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
scrolling.value = setTimeout(() => {
|
|
56
|
+
const anchorEl = document.getElementById('anchor')
|
|
57
|
+
if (anchorEl) {
|
|
58
|
+
const activeNode = anchorEl.querySelector('.q-tree__node--selected')
|
|
59
|
+
if (activeNode && typeof activeNode === 'object') {
|
|
60
|
+
const target = quasarScroll.getScrollTarget(activeNode)
|
|
61
|
+
const offsetTop = activeNode.offsetTop
|
|
62
|
+
const innerHeightBy2 = window.innerHeight / 2
|
|
63
|
+
const offset = offsetTop - innerHeightBy2
|
|
64
|
+
|
|
65
|
+
if (offset > 0) {
|
|
66
|
+
quasarScroll.setVerticalScrollPosition(target, offset, 300)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
scrolling.value = null
|
|
71
|
+
}, 300)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
watch(selected, () => {
|
|
75
|
+
scrollToActiveAnchor()
|
|
76
|
+
})
|
|
77
|
+
|
|
48
78
|
onMounted(() => {
|
|
49
79
|
store.commit('layout/setMetaToggle', true)
|
|
50
80
|
|
|
@@ -61,6 +91,10 @@ onMounted(() => {
|
|
|
61
91
|
})
|
|
62
92
|
|
|
63
93
|
onBeforeUnmount(() => {
|
|
94
|
+
if (scrolling.value) {
|
|
95
|
+
clearTimeout(scrolling.value)
|
|
96
|
+
}
|
|
97
|
+
|
|
64
98
|
store.commit('layout/setMetaToggle', false)
|
|
65
99
|
|
|
66
100
|
store.commit('page/resetAnchor')
|