|
29 | 29 | <button class="theme-toggle-icon" data-theme-toggle onclick="toggleTheme()" aria-label="Toggle theme" title="Toggle theme"></button> |
30 | 30 | </div> |
31 | 31 |
|
| 32 | + <a class="docs-repo-link" href="https://github.com/LinzLos/tiny-wire" target="_blank" rel="noopener">GitHub repo ↗</a> |
| 33 | +
|
32 | 34 | <nav class="docs-nav"> |
33 | 35 | <div class="docs-nav-group"> |
34 | 36 | <a class="docs-nav-group-label" href="index.html">Get started</a> |
|
96 | 98 | <a class="docs-nav-link" href="patterns.html#login">Login</a> |
97 | 99 | <a class="docs-nav-link" href="patterns.html#settings">Settings</a> |
98 | 100 | </div> |
99 | | -
|
100 | | - <div class="docs-nav-group"> |
101 | | - <a class="docs-nav-group-label" href="https://github.com/LinzLos/tiny-wire" target="_blank" rel="noopener">Source</a> |
102 | | - <a class="docs-nav-link" href="https://github.com/LinzLos/tiny-wire" target="_blank" rel="noopener">GitHub repo ↗</a> |
103 | | - </div> |
104 | 101 | </nav> |
105 | 102 |
|
106 | 103 | <div class="docs-theme-toggle"> |
|
172 | 169 | function setupActiveLinks() { |
173 | 170 | const page = location.pathname.split('/').pop() || 'index.html'; |
174 | 171 | const links = [...document.querySelectorAll(`.docs-nav-link[href*="${page}#"], .docs-nav-link[href^="#"]`)]; |
| 172 | + // the bare current-page link (e.g. Introduction) is the "top of page" sentinel |
| 173 | + const topLink = document.querySelector(`.docs-nav-link[href="${page}"]`); |
175 | 174 | const sections = []; |
176 | 175 | links.forEach(l => { |
177 | 176 | const hash = l.getAttribute('href').split('#')[1]; |
|
188 | 187 | if (el.offsetTop <= y) cur = el.id; |
189 | 188 | }); |
190 | 189 | links.forEach(l => l.classList.remove('active')); |
| 190 | + if (topLink) topLink.classList.remove('active'); |
191 | 191 | if (cur) { |
192 | 192 | const target = sections.find(s => s.el.id === cur); |
193 | 193 | if (target) target.link.classList.add('active'); |
| 194 | + } else if (topLink) { |
| 195 | + topLink.classList.add('active'); |
194 | 196 | } |
195 | 197 | } |
196 | 198 | window.addEventListener('scroll', update, { passive: true }); |
|
458 | 460 | function setupPageNav() { |
459 | 461 | const main = document.querySelector('.docs-main'); |
460 | 462 | if (!main) return; |
| 463 | + // PAGES = the docs pages in nav order — ONE stop per page. The pager is a |
| 464 | + // page-level device: it moves page → page only. In-page sections (e.g. |
| 465 | + // "What's in the repo", a section of index) are reached via the sidebar and |
| 466 | + // the on-page TOC, never the pager. Order MUST mirror the sidebar's page order. |
461 | 467 | const PAGES = [ |
462 | | - { file: 'index.html', title: 'Introduction' }, |
| 468 | + { file: 'index.html', title: 'Introduction' }, |
| 469 | + { file: 'audit.html', title: 'Audit & changelog' }, |
| 470 | + { file: 'a11y.html', title: 'A11y check' }, |
463 | 471 | { file: 'foundations.html', title: 'Foundations' }, |
464 | | - { file: 'components.html', title: 'Components' }, |
465 | | - { file: 'patterns.html', title: 'Patterns' }, |
466 | | - { file: 'audit.html', title: 'Audit & changelog' }, |
467 | | - { file: 'a11y.html', title: 'Accessibility check' }, |
| 472 | + { file: 'components.html', title: 'Components' }, |
| 473 | + { file: 'patterns.html', title: 'Patterns' }, |
468 | 474 | ]; |
469 | 475 | const here = (location.pathname.split('/').pop() || 'index.html'); |
470 | 476 | const i = PAGES.findIndex(p => p.file === here); |
|
0 commit comments