feat(site-builder): menus that follow pages, with dropdowns

- utils/nav-links.ts: shared NavLink type (source/pageId/children),
  pageHref, buildPageLinks, mergeLinks, adoptPageLinks, rewriteHeaderLinks
- PageData.nav {show, parentId, label} + updatePageNav; a nav-sync effect in
  PageProvider materialises page-following links into the stored header
  (or the live header nodes while it is being edited); string/identity
  guards keep it a no-op when nothing changed
- Navbar/Menu: followPages prop (default false; the default header seed is
  true), one-level dropdowns (hover/focus-within + inline click toggle,
  indented in the hamburger layout), hover/CTA colours default to the
  primary token
- NavStylePanel: Follow pages toggle (adopts matching manual links, keeps
  custom text as the page's menu label), read-only page rows with Hide from
  menu, sub-link editor for manual links, LinkPicker records pageId
- Page Settings: Show in menu / Menu label / Nest under; Pages panel badge
- useWhpApi: nav passes through pages_craft_state on save and load

Legacy navs (no followPages) are never rewritten.

Refs #53

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-10-07 12:03:16 -07:00
1 parent 8860349c9b
commit 52477bff45
18 files changed
+1439 -97

No files matched your search

+79
View File
@@ -2557,3 +2557,82 @@ body {
}
.palette-dot:first-child { margin-left: 0; }
/* #53 menus that follow pages: read-only page-link rows, sub-link editor,
page-settings Menu section, hidden-from-menu badge */
.nav-page-link {
display: flex;
align-items: center;
gap: 6px;
padding: 6px;
background: var(--color-bg-elevated);
border: 1px dashed var(--color-border);
border-radius: var(--radius-sm);
color: var(--color-text);
font-size: 11px;
}
.nav-page-link--child { margin: 4px 0 0 16px; }
.nav-page-link > .fa { color: var(--color-text-muted); font-size: 10px; }
.nav-page-link__label {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.nav-page-link__source { font-size: 10px; color: var(--color-text-muted); }
.nav-page-link__hide {
padding: 2px 6px;
background: none;
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
color: var(--color-text-muted);
cursor: pointer;
font-size: 10px;
}
.nav-page-link__hide:hover { color: var(--color-text); border-color: var(--color-text-muted); }
.nav-sublinks {
display: flex;
flex-direction: column;
gap: 4px;
margin-left: 12px;
padding-left: 8px;
border-left: 2px solid var(--color-border);
}
.nav-sublink { display: flex; flex-direction: column; gap: 3px; }
.nav-sublink-add {
padding: 4px;
background: none;
border: 1px dashed var(--color-border);
border-radius: var(--radius-sm);
color: var(--color-text-muted);
cursor: pointer;
font-size: 10px;
}
.nav-sublink-add:hover { color: var(--color-text); }
.page-menu-settings {
display: flex;
flex-direction: column;
gap: 10px;
margin: 0;
padding: 12px;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
}
.page-menu-settings > legend { padding: 0 4px; margin-bottom: 0; }
.page-menu-hidden-badge { font-size: 10px; color: var(--color-text-muted); flex-shrink: 0; }