diff --git a/scripts/build-api-docs.mjs b/scripts/build-api-docs.mjs index 3f3e9bf..fefd3e8 100644 --- a/scripts/build-api-docs.mjs +++ b/scripts/build-api-docs.mjs @@ -420,89 +420,14 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon .sch > summary { grid-template-columns: minmax(0, 1fr) auto; } .sch .ep-sum { grid-column: 1 / -1; } -/* --------------------------------------------------- contents drawer (rail) - The chapter rail is closed by default. Below 980px it is the hamburger sheet - the whole site uses; from 980px up a quiet "Contents" pill opens it as a - drawer over the left edge, with a close button inside. The .toc-btn / - .rail-close / body.contents-open classes are the reusable pattern. */ -.toc-btn { display: none; } -@media (min-width: 980px) { - .toc-btn { - position: fixed; left: 18px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 62; - display: inline-flex; align-items: center; gap: 8px; - padding: 10px 17px 10px 15px; border-radius: 999px; cursor: pointer; - background: rgba(23, 24, 27, .85); - backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); - border: 1px solid var(--hair); color: var(--fg-2); - font-size: 13.5px; font-weight: 500; letter-spacing: -.01em; - transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease); - } - .toc-btn:hover { color: var(--fg); border-color: rgba(255, 255, 255, .25); background: rgba(32, 33, 37, .92); } - .toc-btn svg { width: 15px; height: 15px; } - - body.topnav .side { - display: block; position: fixed; left: 0; right: auto; top: 0; bottom: 0; z-index: 80; - width: min(320px, 86vw); max-height: none; - padding: 58px 24px calc(34px + env(safe-area-inset-bottom)) calc(26px + env(safe-area-inset-left)); - background: #0a0b0c; border-right: 1px solid var(--hair-soft); border-bottom: 0; - overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; - box-shadow: 40px 0 80px rgba(0, 0, 0, .5); - transform: translateX(-102%); visibility: hidden; opacity: 1; pointer-events: auto; - transition: transform .32s var(--ease), visibility .32s; - } - body.topnav.contents-open .side { transform: none; visibility: visible; } - body.contents-open::after { - content: ""; position: fixed; inset: 0; z-index: 75; - background: rgba(0, 0, 0, .55); - backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); - opacity: 1; pointer-events: auto; - } - .rail-close { - position: absolute; top: 14px; right: 12px; width: 34px; height: 34px; - display: flex; align-items: center; justify-content: center; - border-radius: 9px; color: var(--fg-3); cursor: pointer; - transition: color .2s var(--ease), background-color .2s var(--ease); - } - .rail-close:hover { color: var(--fg); background: rgba(255, 255, 255, .06); } - .rail-close svg { width: 15px; height: 15px; } -} -@media (max-width: 979.98px) { .rail-close { display: none; } } -/* Self-sufficiency: with the rail closed the page never reserves rail space. */ -@media (min-width: 1300px) { body.topnav { padding-left: 0; } } -@media (prefers-reduced-motion: reduce) { body.topnav .side { transition-duration: .01ms; } } +/* The header, the navigation sheet and the contents drawer belong to the site, not + to this page: .navsheet, .toc-btn, .side and .rail-close live in styles.css and + site.js and behave identically here, on the docs page and on the home page. This + file deliberately adds nothing of its own to them — one implementation is the + only way the two rail pages can feel like the same rail. */ ` const js = ` -/* Contents drawer (>=980px; below that the hamburger sheet in site.js owns the rail). */ -;(() => { - const body = document.body - const btn = document.querySelector('.toc-btn') - const menu = document.getElementById('menu') - if (!btn || !menu) return - const set = open => { - body.classList.toggle('contents-open', open) - btn.setAttribute('aria-expanded', String(open)) - body.style.overflow = open ? 'hidden' : '' - } - btn.addEventListener('click', e => { e.stopPropagation(); set(!body.classList.contains('contents-open')) }) - menu.querySelector('.rail-close')?.addEventListener('click', () => set(false)) - document.addEventListener('click', e => { - if (!body.classList.contains('contents-open')) return - if (e.target.closest('#menu') || e.target.closest('.toc-btn')) return - set(false) - }) - menu.addEventListener('click', e => { if (e.target.closest('a')) set(false) }) - document.addEventListener('keydown', e => { if (e.key === 'Escape') set(false) }) - addEventListener('resize', () => { - if (innerWidth < 980) set(false) - else { - // crossing up: make sure a hamburger-opened sheet doesn't linger - body.classList.remove('menu-open'); menu.classList.remove('open') - if (!body.classList.contains('contents-open')) body.style.overflow = '' - } - }) -})() - /* Jumping to an anchor inside a collapsed card opens the card — and re-aligns, since the browser scrolled to where the target was while it was still collapsed. */ ;(() => { @@ -555,7 +480,7 @@ const html = ` - + @@ -572,37 +497,58 @@ const html = ` Features Screenshots Demo - Docs - API - About + Docs + API + About GitLab Discord Download - - -