@docsector/docsector-reader 0.11.0 → 0.12.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/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
@@ -23,7 +23,7 @@ const packageRoot = resolve(__dirname, '..')
23
23
  const args = process.argv.slice(2)
24
24
  const command = args[0]
25
25
 
26
- const VERSION = '0.11.0'
26
+ const VERSION = '0.12.1'
27
27
 
28
28
  const HELP = `
29
29
  Docsector Reader v${VERSION}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docsector/docsector-reader",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
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,5 +1,5 @@
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
4
  import { useQuasar } from 'quasar'
5
5
  import { useRoute } from "vue-router";
@@ -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,27 @@ 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) {
60
+ activeNode.scrollIntoView({ behavior: 'smooth', block: 'center' })
61
+ }
62
+ }
63
+ scrolling.value = null
64
+ }, 300)
65
+ }
66
+
67
+ watch(selected, () => {
68
+ scrollToActiveAnchor()
69
+ })
70
+
48
71
  onMounted(() => {
49
72
  store.commit('layout/setMetaToggle', true)
50
73
 
@@ -61,6 +84,10 @@ onMounted(() => {
61
84
  })
62
85
 
63
86
  onBeforeUnmount(() => {
87
+ if (scrolling.value) {
88
+ clearTimeout(scrolling.value)
89
+ }
90
+
64
91
  store.commit('layout/setMetaToggle', false)
65
92
 
66
93
  store.commit('page/resetAnchor')