Skip to content

feat(components): let applications set tree arrows, bar geometry and tooltip surface - #10

Merged
1lck merged 1 commit into
mainfrom
feat/1799-shared-controls
Nov 12, 2026
Merged

1lck merged 1 commit into
mainfrom
feat/1799-shared-controls

Conversation

@1lck

@1lck 1lck commented Nov 12, 2026

Copy link
Copy Markdown

这个 PR 做什么

Lithe 的 Viva 客户端要按 IDEA 的规格重做三处共享控件,Viva 原来把它们的几何和配色写死在组件里,应用侧无处落地。这次把三处改成“应用可以覆盖、留空用 Viva 自己的”:

能力 入口 可设项
树箭头 components.TreeDisclosure(经 ui.TreeState.Disclosure) 折叠/展开图标、图标尺寸、箭头列宽;ui 的行内边距跟着同一个列宽走
滚动条 components.ScrollBarStyle(ScrollArea.Bars) 轨道宽、hover 覆盖条宽、轨道内边距、最小滑块长;ScrollAreaGeometry 记录内边距,拖动换算用同一个值
提示框 gfx.TooltipStyle(Theme.Tooltip) 圆角、内边距、字号、背景、文字、边框粗细与颜色;箭头用同一圆角与填充色,边框画在主体之后,圆角仍归主体

三项都保持默认兼容:零值字段全部回退到 Viva 现有行为,因此不影响已有应用。

测试

  • components/tree_disclosure_test.go:自定义列宽移动行内容、默认仍是 24pt 列
  • components/scroll_area_bars_test.go:自定义轨道/内边距/最小滑块、默认几何不变
  • components/tooltip_style_test.go:自定义内边距与字号改变盒子高度、默认保持
  • cmd/viva/initfiles/AGENTS.md.txt 补 Tooltip 字段说明(ui 的指南校验要求列出每个主题字段)

go test ./components/ ./ui/ ./gfx/ 通过。go test ./... 里 cmd/viva 的打包/签名用例在本机会失败,报 “built for macOS 13.0 or later but min_system says 12.0”,在 lithe/main 上复跑同样失败,属本机 CGO 部署目标的环境问题,与本改动无关。

后续

  • 合并后按仓库约定同一修复分支向上游 vivaui/viva 提 PR。
  • 然后 Lithe 侧把 desktop/go.mod 的 replace 提到本 PR 的合并提交,接入这三项的调用。

…tooltip surface

Three surfaces that Viva painted with fixed geometry now take an application's own
values, each falling back to Viva's when unset:

- components.TreeDisclosure, through ui.TreeState.Disclosure: the collapsed and
  expanded icon, their size, and the width of the column before a branch's content.
  The ui keeps its row padding in step with the same slot.
- components.ScrollBarStyle, through ScrollArea.Bars: track width, hover overlay
  width, the inset from the track's edge and the least thumb length.
  ScrollAreaGeometry records the inset, so a drag on a thumb maps back with the value
  the area drew with.
- gfx.TooltipStyle, through Theme.Tooltip: radius, padding, text size, background,
  text and border. The arrow paints with the same radius and fill, and a border is a
  ring behind the body so the corners stay the body's.

Tests cover each option and its default, and the init guide lists the Tooltip field.

Co-Authored-By: AtomCode (deepseek-v4.1-flash) <noreply@atomgit.com>
@1lck
1lck marked this pull request as ready for review November 12, 2026 05:04
@1lck
1lck merged commit abd3dea into main Nov 12, 2026
1lck added a commit to 1lck/Lithe-IDEA that referenced this pull request Nov 12, 2026
viva 侧新增三项共享控件参数(Lithe-IDEA/Lithe-viva#10 与把 6 个 fork 补丁带回主线的 #11
已合并),本次把应用侧接上,并把 viva 固定提交提到新主线 b6d2059:

- 文件树改用 IDEA 自己的展开箭头(fileicons.TreeChevron 的 16pt 填充路径),行内槽宽
  保持 24pt,只有箭头图形变化。
- 悬停提示改用 IDEA 的表面:4pt 圆角、12/8 内边距、13pt 文字、明暗各自的背景/文字/
  1pt 边框。
- 终端滚动条改用与编辑器一致的 11pt 轨道 / 5pt 滑块。
- desktop/go.mod 的 replace 提到 v0.6.1-0.20261112050743-b6d2059e01b0,该提交同时带回
  IDE 依赖的 6 个 fork 补丁(SetTitle、OnFocusLost、MenuAt、Markdown 图片、红绿灯居中、
  MenuItems.Beside),它们此前只在 fix/list-follow-end 线上。

矩阵三条记为部分实现,并写明剩余:工作台列表/树的滚动条仍在 viva 内部 ScrollArea,ui
层尚未透出该参数。

验证:workbench 包 130.7s 通过;termview 包通过;矩阵 217 条与 i18n 生成一致性通过。

Co-Authored-By: AtomCode (deepseek-v4.1-flash) <noreply@atomgit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant