blume 0.6.4 → 0.6.5

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.
@@ -60,7 +60,7 @@ navigation: {
60
60
  ```
61
61
 
62
62
  - **`flat`** (default) — a non-collapsible header with its pages listed beneath. Pages that aren't in any group always list first, above the group sections, so they can't be mistaken for a group's children.
63
- - **`group`** — a collapsible `<details>` disclosure per group. Pair it with `collapsed` in [folder meta](/docs/content/meta) to set the initial state; a group containing the current page always starts open.
63
+ - **`group`** — a collapsible `<details>` disclosure per group. Groups start collapsed by default; a group containing the current page always starts open, so only the section you're in is expanded. Set `collapsed: false` in [folder meta](/docs/content/meta) to force a group open regardless.
64
64
  - **`page`** — each group is a single row that, when clicked, slides the sidebar into a sub-panel showing only that group's items, with a back arrow at the top. The panel is route-aware, so landing directly on a page inside the group opens straight to it.
65
65
 
66
66
  :::tip
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blume",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Documentation that's fast, AI-ready, and zero-config.",
5
5
  "keywords": [
6
6
  "astro",
@@ -218,7 +218,9 @@ const initialId =
218
218
  // `group`: a collapsible `<details>` disclosure.
219
219
  if (display === "group") {
220
220
  const active = hasActivePage(item);
221
- const open = depth === 0 || active || item.collapsed === false;
221
+ // Default every group closed; open only those on the active path (so
222
+ // the current page's ancestors stay expanded) or forced open via meta.
223
+ const open = active || item.collapsed === false;
222
224
  return (
223
225
  <li class={spacing}>
224
226
  <details class="group" open={open}>
@@ -184,16 +184,20 @@ const sortNodes = (nodes: MutableNode[]): void => {
184
184
  };
185
185
 
186
186
  /**
187
- * In flat display a group renders as a plain section header, so a loose page
188
- * sorted after a group would visually read as that group's last child. Hoist
189
- * pages above groups at every level (relative order otherwise preserved).
187
+ * Hoist loose pages above groups so root-level pages read as top-level entries
188
+ * rather than a group's trailing children (relative order otherwise preserved).
189
+ * All display modes hoist the root level. Flat additionally recurses into every
190
+ * group: there a group renders as a plain section header, so a loose page sorted
191
+ * after a group would visually read as that group's last child.
190
192
  */
191
- const hoistPages = (nodes: MutableNode[]): void => {
193
+ const hoistPages = (nodes: MutableNode[], recurse: boolean): void => {
192
194
  const pages = nodes.filter((node) => node.kind === "page");
193
195
  const groups = nodes.filter((node) => node.kind === "group");
194
196
  nodes.splice(0, nodes.length, ...pages, ...groups);
195
- for (const group of groups) {
196
- hoistPages(group.children);
197
+ if (recurse) {
198
+ for (const group of groups) {
199
+ hoistPages(group.children, recurse);
200
+ }
197
201
  }
198
202
  };
199
203
 
@@ -280,9 +284,7 @@ const buildFileSystemSidebar = (
280
284
 
281
285
  applyFolderMeta(root, folderMeta, sharedMeta, metaPrefix);
282
286
  sortNodes(root.children);
283
- if (display === "flat") {
284
- hoistPages(root.children);
285
- }
287
+ hoistPages(root.children, display === "flat");
286
288
  return root.children.map((child) => toNavNode(child, display));
287
289
  };
288
290