Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(panel): 底部 footer 槽多条目逐条成行,不再并排挤压(fixes #533)

hairyf9aed45b2a841
diff --git a/packages/dsh-tauri-panel/PROTOCOL.md b/packages/dsh-tauri-panel/PROTOCOL.md
index d6e685c4..431ab53b 100644
--- a/packages/dsh-tauri-panel/PROTOCOL.md
+++ b/packages/dsh-tauri-panel/PROTOCOL.md
@@ -295,3 +295,22 @@ ctx.layout.selectPanel('my-entry') // null = 回到会话
`useSessions` 取当前会话。
- 选中面板时会话整体卸载(布局按 `entryKey` 只渲染一个 `main` cell);`selectPanel(null)`
回到会话且不切换 Session。
+
+## 7. 克隆侧栏的官方槽布局:`sidebar.footer.action` 逐条成行(#533)
+
+官方侧栏壳把 `sidebar.footer.action`(`list` / `root`,版本门槛见第 4 节)渲染进
+`footArea > footerActions`,而官方 CSS 对 `footerActions` 只声明 `display:flex`
+(方向取默认 `row`):多个插件同时向该槽注册条目时会被并排塞进同一行互相挤压,
+整行内容(如 `width:100%` 的用量/余额 badge)被同排条目压扁。
+
+克隆侧栏(`src/client/components/sidebar.cssr.ts` 的 `e('footer-actions')`)显式
+排成 `flex-direction: column` + `align-items: stretch`:
+
+- 每个注册条目**各占一行**、自上而下堆叠并撑满侧栏内容宽,与下方
+ `sidebar.settings`(`settings-area` 的块级堆叠)一致;
+- 折叠 rail 态收缩为内容宽(`width:auto`)并横向居中。轮换到列方向后,rail 的
+ 居中语义由 cross 轴的 `align-items:center` 承担——官方镜像里的
+ `justify-content:center` 在列方向只剩纵向语义、无高度可居中,已随之替换。
+
+第三方条目请按「整行条目」设计:需要占满行宽的控件直接用 `width:100%`;
+不要依赖与相邻条目并排——那是官方 CSS 默认 `row` 的产物,克隆侧栏不再提供。
diff --git a/packages/dsh-tauri-panel/src/client/components/sidebar.cssr.test.ts b/packages/dsh-tauri-panel/src/client/components/sidebar.cssr.test.ts
index dad0638c..e34f8897 100644
--- a/packages/dsh-tauri-panel/src/client/components/sidebar.cssr.test.ts
+++ b/packages/dsh-tauri-panel/src/client/components/sidebar.cssr.test.ts
@@ -50,3 +50,35 @@ describe('sidebar.cssr panel-list(官方全局面板清单容器)', () => {
)
})
})
+
+describe('sidebar.cssr footer-actions(回归:footer.action 槽多条目堆叠为列,issue #533)', () => {
+ const sidebarCss = sidebarStyle.render()
+
+ it('基态排成列:sidebar.footer.action(kind:list)的多个条目各占一行,不再并排挤压', () => {
+ const rule = /\.dshp-panel \.dshp-panel__footer-actions\s*\{[^}]*\}/
+ const body = sidebarCss.match(rule)?.[0] ?? ''
+ // 缺 flex-direction 时 flex 容器默认 row —— 正是 #533 的根因。
+ expect(body).toContain('flex-direction: column')
+ expect(body).toContain('display: flex')
+ // stretch 令条目撑满行宽,等价于下方 settings-area 里块级子元素的默认行为
+ // (整行 badge 的 width:100% 不再被同排条目压扁)。
+ expect(body).toContain('align-items: stretch')
+ expect(body).toContain('width: 100%')
+ })
+
+ it('折叠 rail 态把横向居中换到 cross 轴:收缩为内容宽 + alignItems 居中,纵向语义的 justifyContent 不再残留', () => {
+ const rule = /\.dshp-panel\.dshp-panel--collapsed \.dshp-panel__footer-actions\s*\{[^}]*\}/
+ const body = sidebarCss.match(rule)?.[0] ?? ''
+ expect(body).toContain('width: auto')
+ expect(body).toContain('align-items: center')
+ expect(body).not.toContain('justify-content: center')
+ })
+
+ it('折叠态的 settings-area 居中语义保持原样(仍是 row + justifyContent,未被 #533 改动波及)', () => {
+ const rule = /\.dshp-panel\.dshp-panel--collapsed \.dshp-panel__settings-area\s*\{[^}]*\}/
+ const body = sidebarCss.match(rule)?.[0] ?? ''
+ expect(body).toContain('justify-content: center')
+ expect(body).toContain('width: auto')
+ expect(body).not.toContain('align-items')
+ })
+})
diff --git a/packages/dsh-tauri-panel/src/client/components/sidebar.cssr.ts b/packages/dsh-tauri-panel/src/client/components/sidebar.cssr.ts
index d4ae3a2c..3af40df6 100644
--- a/packages/dsh-tauri-panel/src/client/components/sidebar.cssr.ts
+++ b/packages/dsh-tauri-panel/src/client/components/sidebar.cssr.ts
@@ -165,10 +165,17 @@ export default b('panel', {
flex: 'none',
display: 'flex',
}),
+ // 官方 footerActions 只声明了 display:flex(方向取默认 row),而它承载的
+ // sidebar.footer.action 是 kind:list —— 同时装了多个注册条目的插件时,条目会被
+ // 并排塞进同一行互相挤压(整行 badge 的 width:100% 被压扁,见 issue #533)。
+ // 这里显式排成列:每个条目各占一行、自上而下堆叠,与下方 settings-area 的块级
+ // 堆叠保持一致(stretch 让条目撑满行宽,等价于块级子元素的默认行为)。
e('footer-actions', {
flex: 'none',
width: '100%',
minWidth: 0,
+ flexDirection: 'column',
+ alignItems: 'stretch',
display: 'flex',
}),
e('settings-area', {
@@ -207,7 +214,11 @@ export default b('panel', {
}),
c('& .dshp-panel__region-area', { marginLeft: 0, marginRight: 0, padding: 0 }),
c('& .dshp-panel__foot-area', { alignItems: 'center' }),
- c('& .dshp-panel__settings-area, & .dshp-panel__footer-actions', { justifyContent: 'center', width: 'auto', display: 'flex' }),
+ c('& .dshp-panel__settings-area', { justifyContent: 'center', width: 'auto', display: 'flex' }),
+ // footer-actions 基态已是列(见上),官方镜像里的 justifyContent:center 在列
+ // 方向只剩纵向语义且无高度可居中 → 等效失效。rail 态的「居中」因此必须换到
+ // cross 轴用 alignItems:条目收缩为内容宽并横向居中,不再被 stretch 撑开。
+ c('& .dshp-panel__footer-actions', { alignItems: 'center', width: 'auto', display: 'flex' }),
]),
m('wide', [
c('&', { width: 'var(--dshp-width)' }),