You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d347606
Browse filesBrowse the repository at this point in the historyBrowse files
feat(masthead): navigation built from the documentation manifests
The masthead's navigation is scoped to the app being viewed: Library, the
app's name, then that app's own entries from its kb-docs.json `pages` —
a page without a `section` as a link, a section as a dropdown of its
pages, placed where its first page falls in `order`. A publisher adds a
page to the menu without a knowledge base change, and the bar does not
grow with the number of apps: the catalog is the way between them. The
model is built once per resolved registry (src/utils/navigation.js) and
shares route derivation with apps.js, so every menu link resolves to a
built page.
Tablet first: below 1024px a compact bar (Library, current app, and a
Menu button for an app with manifest pages) opens a popover sheet of the
app's pages; from 1024px a wrapping bar with <details> dropdowns. Both
work without script; masthead-nav.js adds Escape, outside-click and
edge-flip to the dropdowns, taking the real window from event.view
because reframed reports its iframe's document as the masthead's
ownerDocument. The current page carries aria-current="page", the app and
section holding it aria-current="true".
The brand wordmark on app pages moves out of flow into the left gutter,
shown from 90rem where the gutter holds it: as a flex item it took its
width out of the centred column and moved every link away from where it
sits on the catalog.
The vendored docs-example fixture gains a third app, `handbook`, with a
two-section manifest, so the app-scoped menu and exclusive dropdowns are
exercised and visible in a local build.
Closes#111
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-`src/layouts/Base.astro` — The one document shell: head (opening with the cascade layer order), `<ClientRouter />`, and a body that opens with the knowledge base CSS inlined (`?inline` import; carries the self-hosted Inter faces) followed by the shadow-DOM compat styles
76
76
-`src/utils/css-layers.js` — The cascade-layer contract: `LAYER_ORDER` and `layerSubAppCss()`, which wraps a sub-app stylesheet in the `kb-app` layer. Used by the layout, the build and `transform.js`
77
-
-`src/components/Masthead.astro` — Persistent Knowledge base header + Library/current-app sub-nav (all pages, both modes)
77
+
-`src/components/Masthead.astro` — Persistent Knowledge base header + the navigation (all pages, both modes), scoped to the app being viewed: Library, the current app, then that app's manifest `pages` — a page without a `section` as a link, a section as a dropdown of its pages (`NavPages.astro`). The catalog is the only way between apps, so the bar does not grow with the registry. From 1024px a bar that wraps; below it a compact bar (Library, current app, Menu — only for an app with `pages`) whose Menu button opens a popover sheet of the app's pages. Works without script; `src/scripts/masthead-nav.js` only adds Escape/outside-click/edge-flip to the bar's `<details>` dropdowns — and, embedded, learns the real window from `event.view`, because reframed reports its iframe's document as the masthead's `ownerDocument` and root node. Its `<script>` sits inside the masthead: Astro renders a component script in place, and the masthead's next sibling must be the sub-app content
78
+
-`src/utils/navigation.js` — The masthead's model, built once per resolved registry (`navigationFor`), never passed through `getStaticPaths` props. `pageRelDir()`/`routeHref()` are shared with `apps.js`, so a menu link cannot point where no route was built
78
79
-`src/components/AppCard.astro`, `src/components/AppIcon.astro` — Catalog card and its icon
79
80
-`src/templates/shadow-compat.js` — Shadow-DOM design-token styles, injected into the body by the layout
80
81
-`src/scripts/embedded-transitions.js` — Loaded by the layout; inert standalone. Inside a web fragment it runs Astro's view transition on the host document (the iframe's is never painted) and replaces Astro's swap with one that targets reframed's `wf-html`/`wf-head`/`wf-body`, because the default swap nests a new `wf-html` per navigation and leaks every stylesheet. Its head diff never moves a reused node: on a pierced page a `<link>` already moved once by reframed's portal falls out of the applied stylesheets when moved again. It also imports the fetched head and body into the host document before swapping them in: reframed routes a script into its iframe only through host-realm DOM methods, and the router's page is parsed in the iframe, so Astro's `script.replaceWith()` re-run would otherwise execute every swapped-in sub-app script in the host window
@@ -101,7 +102,7 @@ The registry file is `apps.json` by default; `KB_REGISTRY` points the build at a
101
102
102
103
### Two Modes
103
104
104
-
Both modes render the same document: the masthead (`Masthead.astro`) — branding plus the Library / current-app sub-navigation — on every page, and nothing else chrome-like. There is no fixed top bar and no app switcher; the masthead is the navigation.
105
+
Both modes render the same document: the masthead (`Masthead.astro`) — branding plus navigation to the Library and, inside an app, that app's manifest pages — on every page, and nothing else chrome-like. There is no fixed top bar; the masthead is the navigation.
105
106
106
107
**Non-headless** (standalone): Plain knowledge base pages. Navigation is Astro's `<ClientRouter />` (view transitions).
107
108
@@ -144,8 +145,9 @@ Apps registered in `apps.json` must comply with:
Copy file name to clipboardExpand all lines: contract/ARTIFACT.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,10 +83,10 @@ title derived from the document.
83
83
84
84
| Field | Required | Rules |
85
85
|---|---|---|
86
-
|`title`| ✅ | 1–128 characters. Shown in navigation. |
86
+
|`title`| ✅ | 1–128 characters. Shown in the masthead while the app is viewed, after the app's name. |
87
87
|`path`| ✅ | Path to the HTML file, relative to `<slug>/`. Must exist in the archive. |
88
88
|`order`| ✅ | Integer ≥ 0. Lower sorts higher. |
89
-
|`section`| ☐ | ≤ 64 characters. Group heading to display above this page. |
89
+
|`section`| ☐ | ≤ 64 characters. Groups this page under one masthead dropdown of that name, placed where its first page falls; without it the page is a masthead link of its own. |
0 commit comments