Repository navigation
[Proposal] 把侧栏列宽暴露给 shell.overlay 的占用方 #7791
xswt442-cmd
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
/### 背景
shell.overlay的契约把它定义为"frame 级浮层:位于所有列之上、在各列滚动容器之外",并明确它是"你自己的 frame 级表面的加法座位"(新增 id 加在内置条目旁边,而不是替换它们)。因此把徽标、状态胶囊或一组浮起的小控件放在这里是推荐做法。然而,问题在于:这个座位不提供任何几何信息,而它恰恰是覆盖在列之上的那一层。
现状(
dsh-v0.1.7-rc.2)shell.overlay的 standard props 不包含布局或列宽;ctx.layout(ILayout)只暴露面板选择、导航与右侧栏上报,没有列宽;sidebar座位的占用方。于是,想让浮层精确贴在侧栏右侧(
left = 侧栏宽 + 16)的占用方只能自行测量 DOM:这样做有三个具体问题:
firstElementChild属于 frame 的内部结构,重构后会静默失效。建议
frame 已经为同类需求发布布局变量:
shell.leading座位挂载期间会发布--dsh-frame-leading-clearance(该座位所占的 inline inset,自 frame 左缘量起)。同样的方式可以覆盖列宽,以下任一方案即可,且都只涉及读取:--dsh-frame-sidebar-width(折叠或隐藏时可以是 0 或 rail 宽度)。占用方零成本读取,与现有两个变量共用同一套机制。shell.overlay增加一个只读布局 share,例如useColumns(): { sidebar, center, rightbar, viewport };或让ILayout暴露解析后的列宽。我并不请求控制布局的能力,只需要只读几何。如果两者暂时都不考虑,另一个可接受的替代方案是在
docs/subsystems/slots.md中说明浮层占用方应如何获取 frame 几何:目前这两个变量在docs/下没有任何引用,只能从源码发现,结果是每个插件各自测量 DOM,并在窄窗口上以相同方式出错。代码位置(
dsh-v0.1.7-rc.2)shell.leading的几何说明:packages/client/ui-layout/src/client/index.ts(约 88-113 行;inject在 143 行)SidebarOwnerProps { collapsed, width }(约 121-127 行);packages/client/ui-layout/src/client/AppFrame.tsx约 242-245 行的renderSlot('sidebar', { collapsed, width: cols.sidebar })ILayout的完整接口(不含列宽):packages/client/ui-layout/src/client/service.ts28-54 行packages/client/ui-layout/src/client/AppFrame.module.css94 行、166 与 175 行--dsh-frame-*引用:docs/subsystems/slots.md(座位树中出现shell.overlay)lay)相关讨论
详见#4070 ,4070 请求"参与布局、预留宽度"的第三方面板,本讨论项并不要求直接参与布局,只请求 frame 已经解算出的列宽。
All reactions