feat: 状态胶囊升级——顶栏紧凑状态条 + 点击展开宿主渲染详情弹层(StatusItem.icon/detail:分组/行/徽标/行内深链)
This commit is contained in:
@@ -4,17 +4,47 @@
|
||||
|
||||
## 1. 状态胶囊(TitleBar 顶部)
|
||||
|
||||
轻量状态提示,点击可深链跳转:
|
||||
顶栏胶囊是**紧凑状态条**,点击行为三档:
|
||||
|
||||
```js
|
||||
// ① 纯展示
|
||||
api.ui.setStatusItem('conn', { text: '已连接 · 3 任务' })
|
||||
|
||||
// ② 点击深链
|
||||
api.ui.setStatusItem('conn', {
|
||||
text: '已连接 · 3 任务',
|
||||
tone: 'accent', // default | accent | warn | danger
|
||||
openView: { view: 'my-plugin' } // 点击跳到插件整页视图(可省略)
|
||||
icon: '<svg .../>', // 可选,12px 线条风
|
||||
openView: { view: 'my-plugin' } // 点击跳到插件整页视图
|
||||
})
|
||||
api.ui.removeStatusItem('conn')
|
||||
|
||||
// ③ 点击展开详情弹层(声明了 detail 时优先于 openView)
|
||||
api.ui.setStatusItem('tasks', {
|
||||
text: '任务 2/5',
|
||||
tone: 'accent',
|
||||
detail: {
|
||||
title: '任务概览', // 缺省用胶囊文本
|
||||
sections: [
|
||||
{
|
||||
title: '进行中', // 分组标题可省略
|
||||
rows: [
|
||||
{ label: '构建索引', detail: '已完成 60%', trailing: '2/5', tone: 'accent' },
|
||||
{ label: '清理临时文件' }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
rows: [{ label: '打开任务面板', openView: { view: 'my-plugin' } }] // 行点击深链
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
api.ui.removeStatusItem('tasks')
|
||||
```
|
||||
|
||||
弹层由宿主统一渲染(分组标题 / 行 / 右侧徽标 / 深链),样式与宿主一致——插件只提交
|
||||
数据;点击弹层外部或 Esc 关闭;dispose 时宿主自动清理本插件全部条目。
|
||||
|
||||
## 2. 工具栏按钮(输入区工具行)
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user