From dc36e8135702cd19d9236ff9c11b42c0e0742e27 Mon Sep 17 00:00:00 2001 From: mrsibe Date: Thu, 24 Sep 2026 15:24:20 +0800 Subject: [PATCH 1/4] refactor(shell): express panel hierarchy with surfaces instead of shadows The three workspace panels (source / ask / notes), the settings dialog and the sidebar now sit on the ladder: sunken window chrome, base canvas between panels, raised content panels with a hairline, overlay only for floating layers. The panel trio of rounded-xl + border-0 + shadow-md is gone, as are the shadow-sm on the tab bar and the settings content panel. Settings gains a real hierarchy: the dialog is sunken, the nav rail is transparent on it, and the content panel is raised. Previously the rail and the panel were the same surface-base value, so the nav had no visual container. List rows (documents, notes, generated items) share one selected expression, bg-surface-selected with hover:bg-surface-hover, and their meta lines move to the tertiary text level. Row padding drops to px-2 py-2, the delete affordance also reveals on focus-visible, and timestamp/meta text stops competing with titles. Two latent bugs fixed on the way: - the sidebar menu button's outline variant wrapped an oklch() token in hsl(), which is invalid CSS, so the 1px outline never rendered. - TopNavigationBar cast a KeyboardEvent through 'as unknown as MouseEvent' to satisfy a handler that only calls stopPropagation(); the parameter is now typed SyntheticEvent and the cast is gone. Also makes bg-muted a recessed fill in dark mode (0.275, below surface-raised at 0.325), so nested containers read as inset in both colour schemes instead of flipping direction between them. --- DESIGN.md | 6 ++++-- src/renderer/src/assets/theme.css | 5 ++++- .../src/components/common/TopNavigationBar.tsx | 10 +++++----- .../src/components/layouts/DragHandle.tsx | 2 +- .../src/components/notebook/NotePanel.tsx | 4 ++-- .../src/components/notebook/NotebookLayout.tsx | 2 +- .../src/components/notebook/ProcessPanel.tsx | 4 ++-- .../src/components/notebook/SourcePanel.tsx | 14 +++++++------- .../src/components/notebook/item/ItemList.tsx | 16 ++++++++-------- .../src/components/notebook/note/NoteList.tsx | 10 ++++------ .../components/notebook/source/DocumentList.tsx | 6 +++--- .../src/components/settings/SettingItem.tsx | 2 +- .../components/settings/SettingsActionBar.tsx | 2 +- .../components/settings/SettingsContentPanel.tsx | 2 +- .../src/components/settings/SettingsDialog.tsx | 8 ++++---- src/renderer/src/components/ui/sidebar.tsx | 12 ++++++++---- 16 files changed, 56 insertions(+), 49 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 8b397e1..f751efe 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -61,8 +61,9 @@ Rules: - Adjacent surfaces must differ in lightness; two neighbours at the same value mean you are expressing hierarchy through a shadow, which is not allowed. - Inside a panel, nested containers (a bubble, an inline code block, an icon - tile) use `bg-muted` — a quiet opaque fill — not another surface step. Do not - nest `surface-raised` inside `surface-raised`. + tile) use `bg-muted` — a quiet opaque fill that is _recessed_ relative to + `surface-raised` in both colour schemes. Do not nest `surface-raised` inside + `surface-raised`. Legacy aliases kept for compatibility while pages migrate: `--background`, `--card`, `--popover`, `--sidebar`, `--accent`, @@ -132,6 +133,7 @@ Base rhythm is 4 / 8 / 12 / 16 (`gap-1,2,3,4`; `p-2,3,4,6`). Half steps | Input / Select trigger | `h-9` | `px-3` | | List row, compact | `h-8` | `px-2` | | List row, comfortable | `h-9` | `px-3` | +| List row, multi-line (title + meta) | — | `px-2 py-2`, `rounded-md` | | Sidebar nav item | `h-8` | `px-2` | | Card / panel body padding | — | `p-4` | | Dialog padding | — | `p-5` | diff --git a/src/renderer/src/assets/theme.css b/src/renderer/src/assets/theme.css index 8dfe8bc..89c7926 100644 --- a/src/renderer/src/assets/theme.css +++ b/src/renderer/src/assets/theme.css @@ -125,7 +125,10 @@ --surface-hover: oklch(0.9 0.01 262 / 0.06); --surface-selected: oklch(0.9 0.01 262 / 0.1); - --muted: oklch(0.3863 0.0235 265.6941); + /* --muted is a *recessed* fill: below surface-raised in both modes + (light 0.9551 vs 1.0, dark 0.275 vs 0.325) so a bubble, icon tile or + inline code block reads as inset instead of flipping direction. */ + --muted: oklch(0.275 0.014 260); --foreground: oklch(0.7621 0.0202 262.9873); --muted-foreground: oklch(0.68 0.02 262.9873); diff --git a/src/renderer/src/components/common/TopNavigationBar.tsx b/src/renderer/src/components/common/TopNavigationBar.tsx index c462c1b..3eef9b5 100644 --- a/src/renderer/src/components/common/TopNavigationBar.tsx +++ b/src/renderer/src/components/common/TopNavigationBar.tsx @@ -46,7 +46,7 @@ export default function TopNavigationBar({ } } - const handleCloseOpenedNotebook = (id: string, e: React.MouseEvent): void => { + const handleCloseOpenedNotebook = (id: string, e: React.SyntheticEvent): void => { e.stopPropagation() // 如果关闭的是当前笔记本,需要跳转 @@ -75,7 +75,7 @@ export default function TopNavigationBar({ return (
{/* macOS 左侧空白区域(留给窗口控制按钮) */} @@ -107,7 +107,7 @@ export default function TopNavigationBar({ {/* 首页标签 */} {t('home')} @@ -118,7 +118,7 @@ export default function TopNavigationBar({ {notebook.title} { if (e.key === 'Enter' || e.key === ' ') { - handleCloseOpenedNotebook(notebook.id, e as unknown as React.MouseEvent) + handleCloseOpenedNotebook(notebook.id, e) } }} className="ml-1 inline-flex items-center justify-center h-4 w-4 p-0.5 rounded hover:bg-destructive/20 hover:text-destructive transition-colors" diff --git a/src/renderer/src/components/layouts/DragHandle.tsx b/src/renderer/src/components/layouts/DragHandle.tsx index c5c70ec..858225f 100644 --- a/src/renderer/src/components/layouts/DragHandle.tsx +++ b/src/renderer/src/components/layouts/DragHandle.tsx @@ -7,7 +7,7 @@ export interface DragHandleProps { export default function DragHandle({ onMouseDown }: DragHandleProps): ReactElement { return (
diff --git a/src/renderer/src/components/notebook/NotePanel.tsx b/src/renderer/src/components/notebook/NotePanel.tsx index 2a90f65..93336ed 100644 --- a/src/renderer/src/components/notebook/NotePanel.tsx +++ b/src/renderer/src/components/notebook/NotePanel.tsx @@ -305,7 +305,7 @@ export default function NotePanel(): ReactElement { } return ( -
+
{isEditing && currentNote ? ( // 编辑器页面 - 使用 key 强制在切换笔记时重新挂载 + {t('creativeSpace')} } diff --git a/src/renderer/src/components/notebook/NotebookLayout.tsx b/src/renderer/src/components/notebook/NotebookLayout.tsx index faa6f83..4706803 100644 --- a/src/renderer/src/components/notebook/NotebookLayout.tsx +++ b/src/renderer/src/components/notebook/NotebookLayout.tsx @@ -69,7 +69,7 @@ export default function NotebookLayout(): ReactElement { }, []) return ( -
+
+ -
+
{/* 多行输入框 */}