docs.ts
typescript
sha256:8e05daa29ba6702b4a2380a16d690ba31cc099d69c5c859bc6e6f16a0e945f99
Merge 'fix/deploy-memory-limits-and-log-group' into 'dev' —…
Human
10 days ago
| 1 | /** |
| 2 | * docs.ts — scroll-spy sidebar for all Muse developer docs pages. |
| 3 | * |
| 4 | * Observes .devdocs-section[id] elements and marks the matching |
| 5 | * .devdocs-nav-link--sub link active as sections scroll into view. |
| 6 | * |
| 7 | * Registered for every docs-* page key in app.ts. |
| 8 | */ |
| 9 | |
| 10 | function initScrollSpy(): void { |
| 11 | const links = document.querySelectorAll<Element>('.devdocs-nav-link--sub'); |
| 12 | if (!links.length) return; |
| 13 | const observer = new IntersectionObserver( |
| 14 | (entries) => { |
| 15 | entries.forEach((e) => { |
| 16 | if (e.isIntersecting) { |
| 17 | links.forEach((l) => l.classList.remove('devdocs-nav-link--active')); |
| 18 | const target = document.querySelector( |
| 19 | `.devdocs-nav-link--sub[href="#${e.target.id}"]` |
| 20 | ); |
| 21 | if (target) target.classList.add('devdocs-nav-link--active'); |
| 22 | } |
| 23 | }); |
| 24 | }, |
| 25 | { rootMargin: '-20% 0px -70% 0px' } |
| 26 | ); |
| 27 | document.querySelectorAll('.devdocs-section[id]').forEach((s) => observer.observe(s)); |
| 28 | } |
| 29 | |
| 30 | export function initDocs(): void { |
| 31 | initScrollSpy(); |
| 32 | } |
File History
3 commits
sha256:8e05daa29ba6702b4a2380a16d690ba31cc099d69c5c859bc6e6f16a0e945f99
Merge 'fix/deploy-memory-limits-and-log-group' into 'dev' —…
Human
10 days ago
sha256:3fadb0439bba9451b89229676971c0d4a40900dec7810e9d5f8791b8d950d505
fix: install.sh version from latest published tarball, not …
Sonnet 4.6
minor
⚠
101 days ago
sha256:763eb2cb8675073b84c19345b27586d2ed939a9aee97c5479b69f502f1a70eff
fix(tests): update test suite to match current implementation
Sonnet 4.6
patch
123 days ago