feat: 位置兼容模式支持自定义下移距离(齿轮弹窗数字输入)

titleBarStripPx 新偏好(0–120px,默认 40):侧边栏按钮与内容的下移量改为
CSS 变量 --dsh-title-bar-strip 驱动,Sidebar shell 随 prefs 写入。设置页
「常规」的位置兼容模式行在开启时显示齿轮小图标,弹窗内用数字行设置下移
距离(复用 FeatureSettingsRows 行控件与提交钳制)。
This commit is contained in:
Menghuan1918 committed 2026-08-15 15:46:56 +08:00
1 parent 648ff27b5f
commit 8ad1766390
14 files changed
+204 -28

No files matched your search

+19 -7
View File
@@ -172,15 +172,27 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
// window's top-right corner, OVER the web content. When the user enables
// the pref, the body attribute lets sidebar.module.css drop the toggle
// cluster below the strip and push the right panel's content below it.
// The attribute rides the snapshot's prefs, so flipping the setting
// re-renders and re-applies immediately; the cleanup removes it on
// unmount/boundary swap so a crashed sidebar never leaves it behind.
// The strip height is user-tunable (titleBarStripPx) and rides a CSS
// variable so the rules stay declarative. The attribute rides the
// snapshot's prefs, so flipping the setting re-renders and re-applies
// immediately; the cleanup removes both on unmount/boundary swap so a
// crashed sidebar never leaves them behind.
const titleBarCompat = snapshot.prefs.titleBarCompat
const titleBarStrip = snapshot.prefs.titleBarStripPx
useEffect(() => {
if (titleBarCompat) document.body.setAttribute('data-dsh-title-bar-compat', '')
else document.body.removeAttribute('data-dsh-title-bar-compat')
return () => { document.body.removeAttribute('data-dsh-title-bar-compat') }
}, [titleBarCompat])
const root = document.documentElement
if (titleBarCompat) {
document.body.setAttribute('data-dsh-title-bar-compat', '')
root.style.setProperty('--dsh-title-bar-strip', `${titleBarStrip}px`)
} else {
document.body.removeAttribute('data-dsh-title-bar-compat')
root.style.removeProperty('--dsh-title-bar-strip')
}
return () => {
document.body.removeAttribute('data-dsh-title-bar-compat')
root.style.removeProperty('--dsh-title-bar-strip')
}
}, [titleBarCompat, titleBarStrip])
/**
* Bottom-panel merge on narrow viewports: whenever a session is current