Feat v0.4.6 sidebar restructure
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Successful in 5s
CI/CD / test-go-pg (pull_request) Successful in 2m33s
CI/CD / test-sqlite (pull_request) Successful in 2m58s
CI/CD / build-and-deploy (pull_request) Successful in 1m16s

Restructure the notes sidebar with a two-tab header (Notes / Outline)
and relocate the document outline from the editor-side panel into the
sidebar's Outline tab with active heading tracking.

- Add SidebarTabs component with Notes/Outline tabs; Outline disabled
  when no note is selected
- Add SidebarOutline component with nested heading hierarchy
  (H1→H2→H3), depth indentation, and click-to-scroll
- Add RAF-throttled scroll listener for active heading highlighting
  based on scroll position (preview getBoundingClientRect / CM6 viewport)
- Lift headings, scrollToHeading, and activeHeadingIdx state to NotesApp
  via EditorPane callback props
- Remove old DocumentOutline component and .doc-outline CSS
- Auto-reset to Notes tab when active note is deleted
- Bump notes package to v0.7.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 21:16:31 +00:00
parent 6fbac0a33f
commit d5984f4762
6 changed files with 240 additions and 111 deletions

View File

@@ -632,57 +632,79 @@
font-size: 11px;
}
/* ── Document Outline ─────────────────────── */
.doc-outline {
width: 200px;
min-width: 160px;
border-left: 1px solid var(--border);
background: var(--bg-raised);
overflow-y: auto;
/* ── Sidebar Tabs ────────────────────────── */
.sidebar-tabs {
display: flex;
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.doc-outline__header {
font-size: 11px;
font-weight: 600;
.sidebar-tabs__tab {
flex: 1;
padding: 10px 14px;
font-size: 13px;
font-weight: 500;
color: var(--text-2);
text-transform: uppercase;
letter-spacing: 0.5px;
padding: 8px 10px;
display: flex;
align-items: center;
gap: 6px;
background: none;
border: none;
border-bottom: 2px solid transparent;
cursor: pointer;
user-select: none;
border-bottom: 1px solid var(--border);
transition: var(--transition);
text-align: center;
font-family: var(--font);
}
.doc-outline__toggle {
font-size: 9px;
color: var(--text-2);
}
.doc-outline__count {
.sidebar-tabs__tab:hover {
color: var(--text);
background: var(--bg-hover);
color: var(--text-2);
font-size: 10px;
padding: 0 6px;
border-radius: 8px;
line-height: 16px;
}
.doc-outline__item {
padding: 4px 10px;
font-size: 12px;
.sidebar-tabs__tab--active {
color: var(--text);
border-bottom-color: var(--accent);
}
.sidebar-tabs__tab--disabled {
color: var(--text-3);
cursor: default;
opacity: 0.5;
}
.sidebar-tabs__tab--disabled:hover {
background: none;
color: var(--text-3);
}
/* ── Sidebar Outline ─────────────────────── */
.sidebar-outline {
flex: 1;
overflow-y: auto;
padding: 8px 0;
}
.sidebar-outline__empty {
padding: 40px 16px;
text-align: center;
color: var(--text-3);
font-size: 13px;
}
.sidebar-outline__item {
padding: 5px 12px;
font-size: 13px;
color: var(--text-2);
cursor: pointer;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
transition: var(--transition);
border-radius: var(--radius);
margin: 1px 6px;
}
.doc-outline__item:hover {
.sidebar-outline__item:hover {
background: var(--bg-hover);
color: var(--text);
}
.doc-outline__item--h1 { font-weight: 600; color: var(--text); }
.doc-outline__item--h2 { font-weight: 500; }
.sidebar-outline__item--active {
background: var(--bg-active);
color: var(--text);
font-weight: 500;
}
.sidebar-outline__item--h1 { font-weight: 600; color: var(--text); }
.sidebar-outline__item--h2 { font-weight: 500; }
/* ── Responsive ──────────────────────────── */
@media (max-width: 700px) {
@@ -691,5 +713,4 @@
.folder-tree { max-height: 30vh; }
.notes-editor__body--split { grid-template-columns: 1fr; }
.notes-editor__body--split .notes-preview { display: none; }
.doc-outline { display: none; }
}