astro-theme-popular 0.9.0 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-theme-popular",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Popular: a warm, community-first Astro theme for meetups, clubs and fan communities. Ships as an Astro integration.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/scripts/toc.js CHANGED
@@ -13,8 +13,19 @@
13
13
  var el = document.getElementById(id);
14
14
  if (el) { map[id] = a; targets.push(el); }
15
15
  });
16
+ /* The sidebar has its own scrollbar when it outgrows the viewport, so
17
+ follow the reader: keep the highlighted entry in view. Done by hand
18
+ rather than with scrollIntoView, which would also scroll the page. */
19
+ function reveal(a) {
20
+ if (!a || toc.scrollHeight <= toc.clientHeight) return;
21
+ var box = toc.getBoundingClientRect();
22
+ var item = a.getBoundingClientRect();
23
+ if (item.top < box.top) toc.scrollTop -= box.top - item.top;
24
+ else if (item.bottom > box.bottom) toc.scrollTop += item.bottom - box.bottom;
25
+ }
16
26
  function setActive(id) {
17
27
  links.forEach(function (a) { a.classList.toggle("is-active", a === map[id]); });
28
+ reveal(map[id]);
18
29
  }
19
30
  var obs = new IntersectionObserver(function (entries) {
20
31
  entries.forEach(function (e) { if (e.isIntersecting) setActive(e.target.id); });
@@ -245,7 +245,13 @@ pre:hover .g-copy, .g-copy:focus-visible { opacity: 1; }
245
245
 
246
246
  /* ---------- Docs (handbook / runbooks) ---------- */
247
247
  .g-doc { display: grid; grid-template-columns: 260px 1fr; gap: var(--space-5); align-items: start; padding-block: var(--space-5) var(--space-6); }
248
- .g-doc-toc { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 0.15rem; }
248
+ /* The sidebar outgrows the viewport on a long page (every h2/h3 of the
249
+ current page nests under its entry). A sticky element taller than the
250
+ viewport cannot be scrolled to its end, so the entries below the fold,
251
+ including the links to the other docs pages, were unreachable without
252
+ scrolling through the whole article first. Cap it to the space under
253
+ the header and give it its own scrollbar. */
254
+ .g-doc-toc { position: sticky; top: 92px; max-height: calc(100vh - 92px - var(--space-4)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; display: flex; flex-direction: column; gap: 0.15rem; }
249
255
  .g-doc-toc__label { font-family: var(--font-display); font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.6rem; }
250
256
  .g-doc-toc a { display: block; padding: 0.4rem 0.7rem; border-radius: var(--radius-md); font-size: var(--text-sm); line-height: 1.3; color: var(--text-body); border-left: 3px solid transparent; }
251
257
  .g-doc-toc a:hover { color: var(--color-primary); }
@@ -306,7 +312,7 @@ pre:hover .g-copy, .g-copy:focus-visible { opacity: 1; }
306
312
  /* Narrow screens: the sidebar becomes a pill row of sibling doc pages.
307
313
  The column labels and per-heading anchors only make sense in a sticky
308
314
  sidebar; the headings they point to sit directly below anyway. */
309
- .g-doc-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 0.4rem; border-bottom: var(--border-width) solid var(--border-subtle); padding-bottom: 0.8rem; margin-bottom: 1rem; }
315
+ .g-doc-toc { position: static; max-height: none; overflow: visible; flex-direction: row; flex-wrap: wrap; gap: 0.4rem; border-bottom: var(--border-width) solid var(--border-subtle); padding-bottom: 0.8rem; margin-bottom: 1rem; }
310
316
  .g-doc-toc__label { display: none; }
311
317
  .g-doc-toc a[href^="#"] { display: none; }
312
318
  .g-doc-toc a { border: var(--border-width) solid var(--border-subtle); border-radius: var(--radius-pill); padding: 0.3rem 0.8rem; }