--- /** * The `Sidebar` slot (also the mobile drawer's nav, which defaults to it): a * Fumadocs-style content-source selector, then Blume's own nav tree scoped to * the active source (`sources.ts`). * * The selector is a `
` with Blume's `data-blume-dropdown` light * dismiss (outside press, Escape, focus leaving), like its own NavSelector. */ import Icon from "blume/components/Icon.astro"; import { withMountedBase } from "blume/components/islands/base-path.ts"; import NavTree from "blume/components/layout/NavTree.astro"; import type { UIStrings } from "blume/core/i18n-ui.ts"; import { isUnderPath } from "blume/core/navigation.ts"; import type { NavNode } from "blume/core/types.ts"; import { SOURCES } from "../sources.ts"; interface Props { items: NavNode[]; currentRoute: string; strings?: UIStrings["nav"]; ids?: Map; fragmentBase?: string; } const { items, currentRoute, ...tree } = Astro.props; const active = SOURCES.filter((s) => isUnderPath(currentRoute, s.path)).sort( (a, b) => b.path.length - a.path.length, )[0] ?? SOURCES[0]!; const claims = (node: NavNode, path: string) => { const at = node.kind === "page" ? node.route : node.path; return at !== undefined && isUnderPath(at, path); }; // The root source keeps every node no other source claims; any other source // shows its folder's children, as if that folder were the content root. const scoped = active.path === "/" ? items.filter( (node) => !SOURCES.some((s) => s.path !== "/" && claims(node, s.path)), ) : items.flatMap((node) => node.kind === "group" && node.path === active.path ? node.children : [], ); ---
{active.label}