nx-kv 0.67.3 → 0.68.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/package.json +1 -1
- package/src/web/frontend/components/layout/vsc-crumbs-model.ts +232 -0
- package/src/web/frontend/components/layout/vsc-crumbs.css +88 -0
- package/src/web/frontend/components/layout/vsc-crumbs.tsx +99 -0
- package/src/web/frontend/components/sidebar/index.tsx +4 -2
- package/src/web/frontend/components/sidebar/ns-dialogs.tsx +9 -2
- package/src/web/frontend/components/sidebar/ns-manage-modal.tsx +80 -23
- package/src/web/frontend/components/sidebar/use-ns.ts +11 -1
- package/src/web/frontend/page/dir/task.tsx +14 -15
- package/src/web/frontend/page/settings/index.tsx +20 -0
- package/src/web/frontend/page/settings/style.css +24 -0
- package/src/web/frontend/styles-v2/sidebar.css +15 -0
- package/src/web/frontend/types.ts +2 -0
- package/src/web/public/assets/{composer-panel-CNHQT6LM.js → composer-panel-DvUN4WhE.js} +1 -1
- package/src/web/public/assets/{dag-D--zCQnc.js → dag-Bl0StA5e.js} +1 -1
- package/src/web/public/assets/{dir-BUHnfIMz.js → dir-BgkZkxiK.js} +1 -1
- package/src/web/public/assets/doc-CKbuO1Gj.js +6 -0
- package/src/web/public/assets/{group-hJw7aCS3.js → group-BkBWu0VU.js} +1 -1
- package/src/web/public/assets/index-BCtGuLkO.js +3 -0
- package/src/web/public/assets/{index-BruTRXSA.css → index-DeuU-ww6.css} +1 -1
- package/src/web/public/assets/{refs-Cp2bMHIB.js → refs-Bzf1kVpx.js} +1 -1
- package/src/web/public/assets/{repo-form-modal-DJMWkbA6.js → repo-form-modal-geOSTx9x.js} +1 -1
- package/src/web/public/assets/{repos-CwB-fsSw.js → repos-BbKWW4no.js} +1 -1
- package/src/web/public/assets/route-crumb-CqDySF_k.js +1 -0
- package/src/web/public/assets/{settings-CTsPHoTG.js → settings-Cy9N4Yuf.js} +1 -1
- package/src/web/public/assets/{settings-BWHjNegB.css → settings-d2ah_h6O.css} +1 -1
- package/src/web/public/assets/task-DQNhVFdJ.js +14 -0
- package/src/web/public/assets/task-Dcd2eA8B.css +1 -0
- package/src/web/public/assets/{task-ops-D3pxL8l5.js → task-ops-CdBj-EnL.js} +1 -1
- package/src/web/public/assets/{templates-MH1Mxml2.js → templates-B-xUIUa6.js} +3 -3
- package/src/web/public/index.html +5 -6
- package/src/web/public/assets/doc-z8eXM9dk.js +0 -6
- package/src/web/public/assets/index-GSk_7QV5.js +0 -3
- package/src/web/public/assets/list-search-DFvFY408.js +0 -1
- package/src/web/public/assets/route-crumb-BKq2jry0.js +0 -1
- package/src/web/public/assets/task-_XhRBJ8y.js +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,69 @@
|
|
|
2
2
|
|
|
3
3
|
本文件对外可见的变更。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。
|
|
4
4
|
|
|
5
|
+
## [0.68.1] - 2026-11-24 管理命名空间:搜索分区 + 成员增删
|
|
6
|
+
|
|
7
|
+
用户口径:「顶部增加搜索框,支持搜索ns。对于btn增加管理:支持管理该命名空间具体项目
|
|
8
|
+
的增删」。附图即「管理命名空间(分区)」弹窗——此前行操作只有 ↑↓ / 重命名 / 删除,
|
|
9
|
+
成员增删散在侧栏行菜单与分区头「+」里,管理弹窗里反而动不了成员。
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- 管理弹窗顶部**搜索框**:按名称 / id 过滤分区(大小写不敏感),带「N / M 个分区匹配」
|
|
14
|
+
计数;空态区分「没有分区」与「没有匹配」。
|
|
15
|
+
- 每行新增**成员**钮 → 行下展开该分区条目清单(分组/仓库 kind 标签 + 显示名 + 悬浮
|
|
16
|
+
× 移除),清单尾「+ 添加成员」复用既有成员选择弹窗(NsAddModal,带检索与多归属
|
|
17
|
+
标注)。移除走新增的 `removeItemFromNs(nsId, itemKey)`——按 items 键形直接摘出,
|
|
18
|
+
只动指定分区,登记与其它分区不受影响。
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- 重命名从 `window.prompt` 改走标准表单弹窗(重命名分区)——原生 prompt 违反面板
|
|
23
|
+
「alert/confirm/prompt 一律页内实现」红线,顺手修正;管理 → 重命名 / 添加成员
|
|
24
|
+
均按「先关后开」关闭管理弹窗再开目标弹窗。
|
|
25
|
+
|
|
26
|
+
### Verification
|
|
27
|
+
|
|
28
|
+
- 全量门禁通过:lint / typecheck / build / smoke / unit 1179/1179。
|
|
29
|
+
- Playwright 探针实测(独立 store + 注入 prefs,11 项断言全绿):搜索过滤与计数、
|
|
30
|
+
成员展开与 labelOf 名称、移除/添加后 localStorage items 落盘对账、重命名表单弹窗
|
|
31
|
+
预填值。截图目视布局正常。
|
|
32
|
+
- 本轮知识沉淀:ref `ref_37c7272803fa2c4b`「管理命名空间弹窗:顶部搜索分区 + 行内
|
|
33
|
+
成员增删 + 重命名走表单弹窗」。
|
|
34
|
+
|
|
35
|
+
## [0.68.0] - 2026-11-24 任务页 VS Code 式面包屑 + 路径复制偏好
|
|
36
|
+
|
|
37
|
+
用户口径:「希望 div.mdw-top 换成 vscode 的这种面包屑。不显示标题……点击某一个显示同级
|
|
38
|
+
的其余……对于这个路径添加一个悬浮可点击层,支持快速复制路径➕id,方便快速发给 agent」。
|
|
39
|
+
参考图是 VS Code 编辑器顶部的面包屑(段间 `>`,点段弹同级清单)。
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- **任务页顶条换 VS Code 式三段面包屑**:`命名空间 > 组/目录 > 任务`,点任一段弹
|
|
44
|
+
「同级的其余」下拉——ns 段=其余命名空间(点击切侧栏分区并落成员页);组段=同命名
|
|
45
|
+
空间下的其余目录;任务段=同队列其余任务(pending→plan→claimed→done 序,软删/迁出
|
|
46
|
+
过滤)。不在任何命名空间显示「未分组」。旧 `RouteBreadcrumb` 保留服务其余页面。
|
|
47
|
+
- **悬浮复制钮**:悬浮面包屑行 → 右侧淡入复制钮;内容按新设置项走。
|
|
48
|
+
- **设置 → 偏好 →「路径复制偏好」**(`prefs.copyPathStyle`,localStorage 即时落盘):
|
|
49
|
+
「原始路径」(默认,`<cwd> #<id>`)与「访问提示词」(任务定位 + `localtask show
|
|
50
|
+
--id N --cwd … --json` + `localtask get --cwd … --json` 三行,agent 拿到即可寻址)。
|
|
51
|
+
草稿没有任务号,两种偏好都退回原始路径。
|
|
52
|
+
|
|
53
|
+
### Changed
|
|
54
|
+
|
|
55
|
+
- 任务页不再显示标题行(mdw-title/mdw-path)——路径与任务号由面包屑本身体达;原
|
|
56
|
+
mdw-path 的两个信号(未保存 / 目录已不存在)下沉到顶条保留。文档页(doc-head)
|
|
57
|
+
的同构两行不动。
|
|
58
|
+
|
|
59
|
+
### Verification
|
|
60
|
+
|
|
61
|
+
- 新增单测 11 条(纯模型直测:三段解析/同级清单/复制载荷/组锚定/未分组),
|
|
62
|
+
全量门禁 lint / typecheck / build / smoke / unit 1179/1179 通过。
|
|
63
|
+
- Playwright 探针实测(独立 store + 隔离 repos DB + 注入 prefs,14 项断言全绿):
|
|
64
|
+
三段标签、三个段的同级下拉与跳转(ns 切分区、目录跳队列、任务跳 ?task=)、
|
|
65
|
+
悬浮出钮、raw/prompt 两种剪贴板载荷、设置面板两态切换与落盘。
|
|
66
|
+
- 本轮知识沉淀:ref `ref_4ef8f359493ae237`「任务页 VS Code 式面包屑」。
|
|
67
|
+
|
|
5
68
|
## [0.67.3] - 2026-11-24 设置浮窗默认尺寸提到 1295×857
|
|
6
69
|
|
|
7
70
|
用户口径:「当前设置页面大小过于小了……width: 1295px height: 857px 这个默认大小比较合适」。
|
package/package.json
CHANGED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// VS Code 式面包屑的数据模型(纯函数,单测直接吃——#254)。
|
|
2
|
+
//
|
|
3
|
+
// 三段:**命名空间 → 组/目录 → 任务**;点任一段弹「同级的其余」:
|
|
4
|
+
// · ns 段下拉 = 其余命名空间(点击 = 侧栏切过去 + 落到它的首个成员页)
|
|
5
|
+
// · 组段下拉 = 该命名空间下**其余**目录(队列);没有看板归属时本段就是目录本身
|
|
6
|
+
// · 任务段下拉 = 同队列**其余**任务(pending→plan→claimed→done 序)
|
|
7
|
+
//
|
|
8
|
+
// 数据口径(都不新增后端字段):
|
|
9
|
+
// · 命名空间 = prefs.namespaces(纯 UI 分区;items 键 'board:<id>' | '<仓库key>')
|
|
10
|
+
// · 组 = 队列所属仓库登记的看板(topic.repo.boards[0];组锚定路由用它自己解析到的看板)
|
|
11
|
+
// · 目录 = 一条本机队列(topic);cwd 取 topic.cwd(复制寻址用)
|
|
12
|
+
// · 未分组 = 不在任何 ns items 里的队列(伪分区,不进下拉的「其余」里)
|
|
13
|
+
import { findGroupTask } from '../../modules/board/board-view.js';
|
|
14
|
+
import type { AppRoute, BoardRow, LocalTask, LocalTopic, Prefs, RepoData } from '../../types.js';
|
|
15
|
+
|
|
16
|
+
// 兄弟模块类型桥:board-view 尚未类型化(与 crumbs.ts 同一款桥),按真实契约收窄。
|
|
17
|
+
const findGroupTaskBridge = findGroupTask as unknown as (
|
|
18
|
+
rows: LocalTopic[],
|
|
19
|
+
boards: BoardRow[],
|
|
20
|
+
groupKey: string | undefined,
|
|
21
|
+
taskId: string | number,
|
|
22
|
+
) => { board?: BoardRow | null; topic?: LocalTopic | null; taskRow?: LocalTask | null };
|
|
23
|
+
|
|
24
|
+
/** 同级下拉的一项:hash 直跳;nsId 特殊(先切侧栏命名空间再落它的首个成员页)。 */
|
|
25
|
+
export interface VscSibling {
|
|
26
|
+
label: string;
|
|
27
|
+
hash: string;
|
|
28
|
+
nsId?: string;
|
|
29
|
+
note?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 面包屑一段。 */
|
|
33
|
+
export interface VscSegment {
|
|
34
|
+
kind: 'ns' | 'owner' | 'task';
|
|
35
|
+
label: string;
|
|
36
|
+
siblings: VscSibling[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** vscTrailOf 的返回面(组件渲染 + 复制寻址都要用)。 */
|
|
40
|
+
export interface VscTrail {
|
|
41
|
+
segments: VscSegment[];
|
|
42
|
+
topicKey: string;
|
|
43
|
+
dirName: string;
|
|
44
|
+
cwd: string;
|
|
45
|
+
/** '' = 草稿(还没有任务号) */
|
|
46
|
+
taskId: string;
|
|
47
|
+
/** 组锚定路由的看板 id(#/group/<id>?task= 深链保持锚定) */
|
|
48
|
+
boardId: string;
|
|
49
|
+
isGroup: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const DRAFT_RE = /^draft/i;
|
|
53
|
+
|
|
54
|
+
/** 任务下拉里的状态后缀(pending 是默认态,不加后缀)。 */
|
|
55
|
+
function statusNote(t: LocalTask): string {
|
|
56
|
+
if (t.status === 'done') return '(已完成)';
|
|
57
|
+
if (t.status === 'claimed') return '(已领取)';
|
|
58
|
+
if (t.status === 'plan') return '(草稿)';
|
|
59
|
+
return '';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const STATUS_ORDER: Record<string, number> = { pending: 0, plan: 1, claimed: 2, done: 3 };
|
|
63
|
+
|
|
64
|
+
/** 同队列任务排序:状态序(pending 最前),done 内按完成时间倒序。 */
|
|
65
|
+
function sortTasks(list: LocalTask[]): LocalTask[] {
|
|
66
|
+
return [...list].sort((a, b) => {
|
|
67
|
+
const d = (STATUS_ORDER[String(a.status)] ?? 9) - (STATUS_ORDER[String(b.status)] ?? 9);
|
|
68
|
+
if (d !== 0) return d;
|
|
69
|
+
if (a.status === 'done' && b.status === 'done') {
|
|
70
|
+
return String(b.doneAt || '').localeCompare(String(a.doneAt || ''));
|
|
71
|
+
}
|
|
72
|
+
return 0;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** ns items → 可打开目录队列(board 成员展开 + 仓库直挂;按 topicKey 去重,保持 items 序)。 */
|
|
77
|
+
export function nsDirsOf(ns: { items?: string[] } | null | undefined, rows: LocalTopic[], boards: BoardRow[]): LocalTopic[] {
|
|
78
|
+
const topicByRepoKey = new Map<string, LocalTopic>();
|
|
79
|
+
for (const t of rows || []) {
|
|
80
|
+
const k = t && t.repo && t.repo.key ? String(t.repo.key) : '';
|
|
81
|
+
if (k && !topicByRepoKey.has(k)) topicByRepoKey.set(k, t);
|
|
82
|
+
}
|
|
83
|
+
const out: LocalTopic[] = [];
|
|
84
|
+
const seen = new Set<string>();
|
|
85
|
+
const push = (t: LocalTopic | undefined) => {
|
|
86
|
+
if (!t || !t.key || seen.has(t.key)) return;
|
|
87
|
+
seen.add(t.key);
|
|
88
|
+
out.push(t);
|
|
89
|
+
};
|
|
90
|
+
for (const k of (ns && Array.isArray(ns.items) ? ns.items : [])) {
|
|
91
|
+
if (k.startsWith('board:')) {
|
|
92
|
+
const b = boards.find((x) => x && x.id === k.slice(6));
|
|
93
|
+
for (const m of (b && Array.isArray(b.repos) ? b.repos : []) as Array<{ key?: string }>) {
|
|
94
|
+
if (m && m.key) push(topicByRepoKey.get(String(m.key)));
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
push(topicByRepoKey.get(k));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** 未分组队列 = 不落在任何 ns item 里的队列(nsDirsOf 的补集)。 */
|
|
104
|
+
function ungroupedDirs(rows: LocalTopic[], boards: BoardRow[], nsList: Array<{ items?: string[] }>): LocalTopic[] {
|
|
105
|
+
const claimed = new Set<string>();
|
|
106
|
+
for (const ns of nsList) {
|
|
107
|
+
for (const t of nsDirsOf(ns, rows, boards)) claimed.add(t.key);
|
|
108
|
+
}
|
|
109
|
+
return (rows || []).filter((t) => t && t.key && !claimed.has(t.key));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** 命名空间 → 落点路由:首个看板成员 → 组页;否则首个有队列的仓库 → 目录页;'' = 没有可落的。 */
|
|
113
|
+
export function nsFirstTargetOf(ns: { items?: string[] } | null | undefined, rows: LocalTopic[], boards: BoardRow[]): string {
|
|
114
|
+
for (const t of nsDirsOf(ns, rows, boards)) {
|
|
115
|
+
const b = t.repo && Array.isArray(t.repo.boards) ? t.repo.boards[0] : null;
|
|
116
|
+
if (b && b.id && boards.some((x) => x && x.id === b.id)) {
|
|
117
|
+
return '#/group/' + encodeURIComponent(String(b.id));
|
|
118
|
+
}
|
|
119
|
+
return '#/dir/' + encodeURIComponent(String(t.key));
|
|
120
|
+
}
|
|
121
|
+
return '';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 路由 → VS Code 式三段面包屑(含每段同级清单)。
|
|
126
|
+
* 非任务路由(无队列可锚定)返回 null——那些页面继续用旧 RouteBreadcrumb。
|
|
127
|
+
*/
|
|
128
|
+
export function vscTrailOf(
|
|
129
|
+
route: Partial<AppRoute> | null | undefined,
|
|
130
|
+
rows: LocalTopic[] = [],
|
|
131
|
+
repoData: Partial<RepoData> = {},
|
|
132
|
+
prefs: Partial<Prefs> = {}
|
|
133
|
+
): VscTrail | null {
|
|
134
|
+
if (!route || !route.view) return null;
|
|
135
|
+
const isGroup = route.view === 'group';
|
|
136
|
+
const isDir = route.view === 'dir';
|
|
137
|
+
if (!isGroup && !isDir) return null;
|
|
138
|
+
|
|
139
|
+
const boards = repoData.boards || [];
|
|
140
|
+
const nsList: Array<{ id: string; name?: string; items?: string[] }> = Array.isArray(prefs.namespaces)
|
|
141
|
+
? prefs.namespaces
|
|
142
|
+
: [];
|
|
143
|
+
|
|
144
|
+
// 定位当前队列 / 看板 / 任务(组锚定路由走 findGroupTask 同一套寻址)
|
|
145
|
+
let topic: LocalTopic | null | undefined = null;
|
|
146
|
+
let board: BoardRow | null = null;
|
|
147
|
+
let taskRow: LocalTask | null = null;
|
|
148
|
+
if (isGroup) {
|
|
149
|
+
const g = findGroupTaskBridge(rows, boards, route.key, route.task == null ? '' : route.task) || {};
|
|
150
|
+
board = g.board || null;
|
|
151
|
+
topic = g.topic || null;
|
|
152
|
+
taskRow = g.taskRow || null;
|
|
153
|
+
} else {
|
|
154
|
+
topic = (rows || []).find((r) => r && r.key === route.key) || null;
|
|
155
|
+
if (topic && route.task && !DRAFT_RE.test(String(route.task))) {
|
|
156
|
+
taskRow = (topic.tasks || []).find((t) => t && String(t.id) === String(route.task)) || null;
|
|
157
|
+
}
|
|
158
|
+
const rb = (topic && topic.repo && Array.isArray(topic.repo.boards) ? topic.repo.boards : []) as Array<{ id?: string }>;
|
|
159
|
+
if (rb.length && rb[0] && rb[0].id) {
|
|
160
|
+
board = boards.find((b) => b && b.id === rb[0]!.id) || null;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (!topic || !topic.key) return null; // 没有队列就没有路径可画(NotFound 页自己有提示)
|
|
164
|
+
|
|
165
|
+
const repoKey = topic.repo && topic.repo.key ? String(topic.repo.key) : '';
|
|
166
|
+
const isDraft = !route.task || DRAFT_RE.test(String(route.task));
|
|
167
|
+
const taskId = isDraft ? '' : String(route.task);
|
|
168
|
+
|
|
169
|
+
// 命名空间:items 命中 repoKey 或 'board:<boardId>'
|
|
170
|
+
const inNs = (ns: { items?: string[] }): boolean => {
|
|
171
|
+
const items = Array.isArray(ns.items) ? ns.items : [];
|
|
172
|
+
return items.includes(repoKey) || (!!board && items.includes('board:' + String(board.id)));
|
|
173
|
+
};
|
|
174
|
+
const ns = nsList.find(inNs) || null;
|
|
175
|
+
|
|
176
|
+
// ── 段 1:命名空间(下拉 = 其余 ns,点击先切侧栏再落成员页)──
|
|
177
|
+
const nsSiblings: VscSibling[] = nsList
|
|
178
|
+
.filter((n) => !ns || n.id !== ns.id)
|
|
179
|
+
.map((n) => ({ label: String(n.name || n.id), hash: '', nsId: n.id }));
|
|
180
|
+
|
|
181
|
+
// ── 段 2:组(无看板归属 = 目录本身);下拉 = 同命名空间的其余目录 ──
|
|
182
|
+
const dirs = ns ? nsDirsOf(ns, rows, boards) : ungroupedDirs(rows, boards, nsList);
|
|
183
|
+
const ownerSiblings: VscSibling[] = dirs
|
|
184
|
+
.filter((t) => t.key !== topic!.key)
|
|
185
|
+
.map((t) => ({ label: String(t.name || t.key), hash: '#/dir/' + encodeURIComponent(String(t.key)) }));
|
|
186
|
+
|
|
187
|
+
// ── 段 3:任务;下拉 = 同队列其余任务 ──
|
|
188
|
+
const taskSiblings: VscSibling[] = [];
|
|
189
|
+
if (route.task) {
|
|
190
|
+
const anchor = isGroup && board ? '#/group/' + encodeURIComponent(String(board.id)) : '#/dir/' + encodeURIComponent(String(topic.key));
|
|
191
|
+
const list = sortTasks(((topic.tasks || []) as LocalTask[]).filter(
|
|
192
|
+
(t) => t && !t.deletedAt && !t.migratedTo && String(t.id) !== taskId
|
|
193
|
+
));
|
|
194
|
+
for (const t of list.slice(0, 40)) {
|
|
195
|
+
taskSiblings.push({
|
|
196
|
+
label: '#' + String(t.id) + statusNote(t),
|
|
197
|
+
hash: anchor + '?task=' + encodeURIComponent(String(t.id)),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const segments: VscSegment[] = [
|
|
203
|
+
{ kind: 'ns', label: ns ? String(ns.name || ns.id) : '未分组', siblings: nsSiblings },
|
|
204
|
+
{ kind: 'owner', label: board ? String(board.name) : String(topic.name || topic.key), siblings: ownerSiblings },
|
|
205
|
+
];
|
|
206
|
+
if (route.task) {
|
|
207
|
+
const label = isDraft ? 'draft' : '#' + (taskRow ? String(taskRow.id) : taskId);
|
|
208
|
+
segments.push({ kind: 'task', label, siblings: taskSiblings });
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return {
|
|
212
|
+
segments,
|
|
213
|
+
topicKey: String(topic.key),
|
|
214
|
+
dirName: String(topic.name || topic.key),
|
|
215
|
+
cwd: String(topic.cwd || ''),
|
|
216
|
+
taskId,
|
|
217
|
+
boardId: board ? String(board.id) : '',
|
|
218
|
+
isGroup,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** 复制内容(#254 偏好两态)。draft 无任务号:两种偏好都退回原始路径。 */
|
|
223
|
+
export function copyPayloadOf(trail: VscTrail, style: 'raw' | 'prompt' | undefined): string {
|
|
224
|
+
const base = trail.cwd || trail.dirName;
|
|
225
|
+
const raw = base + (trail.taskId ? ' #' + trail.taskId : ' (draft)');
|
|
226
|
+
if (style !== 'prompt' || !trail.taskId) return raw;
|
|
227
|
+
return [
|
|
228
|
+
`任务 #${trail.taskId} 在队列「${trail.dirName}」(cwd:${base})`,
|
|
229
|
+
`查看:nx-kv localtask show --id ${trail.taskId} --cwd "${base}" --json`,
|
|
230
|
+
`领取处理:nx-kv localtask get --cwd "${base}" --json`,
|
|
231
|
+
].join('\n');
|
|
232
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* VS Code 式面包屑(任务页顶条,#254):贴 vscode 的紧凑路径条——
|
|
2
|
+
段间「>」、点段弹同级、悬浮整行在右侧亮出复制钮。 */
|
|
3
|
+
.vsc-crumbs {
|
|
4
|
+
flex: 1;
|
|
5
|
+
min-width: 0;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 8px;
|
|
9
|
+
}
|
|
10
|
+
.vsc-crumbs-path {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 1px;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
.vsc-crumb {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: 1px;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
}
|
|
23
|
+
.vsc-sep {
|
|
24
|
+
color: var(--mid, #838a93);
|
|
25
|
+
font-size: 11px;
|
|
26
|
+
padding: 0 4px;
|
|
27
|
+
user-select: none;
|
|
28
|
+
flex: none;
|
|
29
|
+
}
|
|
30
|
+
.vsc-crumb-t {
|
|
31
|
+
border: 0;
|
|
32
|
+
background: none;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
font: inherit;
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
color: var(--ink-2, #4b515a);
|
|
37
|
+
padding: 3px 6px;
|
|
38
|
+
border-radius: 5px;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
text-overflow: ellipsis;
|
|
42
|
+
min-width: 0;
|
|
43
|
+
}
|
|
44
|
+
.vsc-crumb-t:hover:not(:disabled) {
|
|
45
|
+
background: var(--soft, #f1f0ec);
|
|
46
|
+
color: var(--ink, #16181c);
|
|
47
|
+
}
|
|
48
|
+
.vsc-crumb-t:disabled {
|
|
49
|
+
cursor: default;
|
|
50
|
+
color: var(--ink-2, #4b515a);
|
|
51
|
+
}
|
|
52
|
+
/* 最后一段(当前位置)加重一档,与 vscode 的文件段同措 */
|
|
53
|
+
.vsc-crumb.is-cur .vsc-crumb-t {
|
|
54
|
+
color: var(--ink, #16181c);
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
}
|
|
57
|
+
/* 复制钮:平时隐身,悬浮整行(或键盘聚焦)才亮——「各个路径 hover 出现复制 btn」 */
|
|
58
|
+
.vsc-copy {
|
|
59
|
+
flex: none;
|
|
60
|
+
border: 0;
|
|
61
|
+
background: none;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
color: var(--mid, #838a93);
|
|
64
|
+
width: 24px;
|
|
65
|
+
height: 24px;
|
|
66
|
+
border-radius: 6px;
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
padding: 0;
|
|
71
|
+
opacity: 0;
|
|
72
|
+
transition: opacity 0.12s;
|
|
73
|
+
}
|
|
74
|
+
.vsc-crumbs:hover .vsc-copy,
|
|
75
|
+
.vsc-copy:focus-visible {
|
|
76
|
+
opacity: 1;
|
|
77
|
+
}
|
|
78
|
+
.vsc-copy:hover {
|
|
79
|
+
background: var(--soft, #f1f0ec);
|
|
80
|
+
color: var(--ink, #16181c);
|
|
81
|
+
}
|
|
82
|
+
/* 顶条上的遗留信号(原 mdw-path 行下沉到这里):未保存 / 目录已不存在 */
|
|
83
|
+
.mdw-top-note {
|
|
84
|
+
flex: none;
|
|
85
|
+
font-size: 11px;
|
|
86
|
+
color: #ba7517;
|
|
87
|
+
white-space: nowrap;
|
|
88
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// VS Code 式面包屑(任务页顶条,#254):段间「>」分隔、点段弹同级下拉、
|
|
2
|
+
// 悬浮整行出复制钮(内容跟设置 → 偏好 → 路径复制偏好走)。
|
|
3
|
+
// 旧 RouteBreadcrumb([ 目录 / #N ] 方括号式)继续服务其余页面;任务页只换这条。
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
|
+
import { useApp } from '../../app-context.jsx';
|
|
6
|
+
import { PopMenu } from '../popup/index.jsx';
|
|
7
|
+
import type { PopMenuItem } from '../popup/index.jsx';
|
|
8
|
+
import { Icon } from '../icons.jsx';
|
|
9
|
+
import { useToast } from '../toast/index.jsx';
|
|
10
|
+
import { copyPayloadOf, nsFirstTargetOf, vscTrailOf } from './vsc-crumbs-model.js';
|
|
11
|
+
import type { VscSegment, VscSibling } from './vsc-crumbs-model.js';
|
|
12
|
+
import './vsc-crumbs.css';
|
|
13
|
+
|
|
14
|
+
interface MenuState {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
items: Array<PopMenuItem | string>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function VscCrumbs() {
|
|
21
|
+
const app = useApp();
|
|
22
|
+
const toast = useToast();
|
|
23
|
+
const [menu, setMenu] = useState<MenuState | null>(null);
|
|
24
|
+
const trail = useMemo(
|
|
25
|
+
() => vscTrailOf(app.route, app.rows || [], app.repoData || {}, app.prefs || {}),
|
|
26
|
+
[app.route, app.rows, app.repoData, app.prefs]
|
|
27
|
+
);
|
|
28
|
+
if (!trail) return null;
|
|
29
|
+
|
|
30
|
+
const style = app.prefs && app.prefs.copyPathStyle === 'prompt' ? 'prompt' : 'raw';
|
|
31
|
+
|
|
32
|
+
const openSiblings = (seg: VscSegment, e: { clientX: number; clientY: number }) => {
|
|
33
|
+
if (!seg.siblings.length) return;
|
|
34
|
+
setMenu({
|
|
35
|
+
x: e.clientX,
|
|
36
|
+
y: e.clientY + 6,
|
|
37
|
+
items: seg.siblings.map((s: VscSibling) => ({
|
|
38
|
+
label: s.label,
|
|
39
|
+
icon: s.nsId ? 'flow' : undefined,
|
|
40
|
+
onClick: () => {
|
|
41
|
+
if (s.nsId) {
|
|
42
|
+
// 命名空间项:先切侧栏分区,再落它的首个成员页(看板 → 组页;否则 → 目录页)
|
|
43
|
+
app.patchPrefs?.({ focusNs: s.nsId });
|
|
44
|
+
const ns = ((app.prefs || {}).namespaces || []).find((n) => n.id === s.nsId);
|
|
45
|
+
const hash = nsFirstTargetOf(ns, app.rows || [], (app.repoData || {}).boards || []);
|
|
46
|
+
if (hash && app.onNavigate) app.onNavigate(hash);
|
|
47
|
+
else toast(`已切到「${s.label}」(还没有可打开的目录)`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (s.hash && app.onNavigate) app.onNavigate(s.hash);
|
|
51
|
+
},
|
|
52
|
+
})),
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const copy = async () => {
|
|
57
|
+
const text = copyPayloadOf(trail, style);
|
|
58
|
+
try {
|
|
59
|
+
await navigator.clipboard.writeText(text);
|
|
60
|
+
toast(style === 'prompt' ? '已复制访问提示词' : '已复制路径');
|
|
61
|
+
} catch {
|
|
62
|
+
toast('复制失败:剪贴板不可用');
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const copyTitle =
|
|
67
|
+
style === 'prompt'
|
|
68
|
+
? '复制访问提示词(CLI 指令 + 引导)——设置 → 偏好可切换为原始路径'
|
|
69
|
+
: '复制路径 + 任务号——设置 → 偏好可切换为访问提示词';
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div className="vsc-crumbs">
|
|
73
|
+
<nav className="vsc-crumbs-path" aria-label="当前位置">
|
|
74
|
+
{trail.segments.map((seg, i) => (
|
|
75
|
+
<span key={seg.kind} className={'vsc-crumb' + (i === trail.segments.length - 1 ? ' is-cur' : '')}>
|
|
76
|
+
{i > 0 && (
|
|
77
|
+
<span className="vsc-sep" aria-hidden>
|
|
78
|
+
>
|
|
79
|
+
</span>
|
|
80
|
+
)}
|
|
81
|
+
<button
|
|
82
|
+
type="button"
|
|
83
|
+
className="vsc-crumb-t"
|
|
84
|
+
disabled={!seg.siblings.length}
|
|
85
|
+
title={seg.siblings.length ? `显示「${seg.label}」的同级` : seg.label}
|
|
86
|
+
onClick={(e) => openSiblings(seg, e)}
|
|
87
|
+
>
|
|
88
|
+
{seg.label}
|
|
89
|
+
</button>
|
|
90
|
+
</span>
|
|
91
|
+
))}
|
|
92
|
+
</nav>
|
|
93
|
+
<button type="button" className="vsc-copy" title={copyTitle} aria-label={copyTitle} onClick={copy}>
|
|
94
|
+
<Icon name="copy" size={13} />
|
|
95
|
+
</button>
|
|
96
|
+
{menu && <PopMenu x={menu.x} y={menu.y} items={menu.items} onClose={() => setMenu(null)} />}
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -191,7 +191,7 @@ export default function Sidebar({
|
|
|
191
191
|
|
|
192
192
|
// #178:分区装配(操作 + 成员选择弹窗 + 候选)全部收在 use-sidebar-ns(纯显示态)
|
|
193
193
|
const nsOps = useSidebarNs({ patchPrefs, toast, dialog, setMenu, repos, boards, namespaces: prefs.namespaces });
|
|
194
|
-
const { nsForm, setNsForm, addFor, setAddFor, candidatesFor, manageOpen, setManageOpen, observeOpen, setObserveOpen, labelOf, setFocusNs, moveNs, removeNs, renameNs, newNsAndMove, addToNs, dropToCurrent, openNsMenu, toggleNsCollapse, moveToNs, removeFromNs } = nsOps;
|
|
194
|
+
const { nsForm, setNsForm, addFor, setAddFor, candidatesFor, manageOpen, setManageOpen, observeOpen, setObserveOpen, labelOf, setFocusNs, moveNs, removeNs, renameNs, newNsAndMove, addToNs, removeItemFromNs, dropToCurrent, openNsMenu, toggleNsCollapse, moveToNs, removeFromNs } = nsOps;
|
|
195
195
|
|
|
196
196
|
// 点击:看板 = 进组视图(成员仍在组面板里下拉选择,树里不铺成员仓库;
|
|
197
197
|
// 但 chevron 可展开**本组任务**子行,与仓库行的任务子行同构);
|
|
@@ -574,11 +574,13 @@ export default function Sidebar({
|
|
|
574
574
|
namespaces={prefs.namespaces || []}
|
|
575
575
|
focusNs={String((prefs as any).focusNs || '')}
|
|
576
576
|
onManageClose={() => setManageOpen(false)}
|
|
577
|
-
|
|
577
|
+
onEditNsName={(id, name) => { setManageOpen(false); setNsForm({ id, name }); }}
|
|
578
578
|
onMoveNs={(id, d) => moveNs(id, d)}
|
|
579
579
|
onRemoveNs={(id) => removeNs(id)}
|
|
580
580
|
onNewNs={() => setNsForm({ id: '', name: '' })}
|
|
581
581
|
onFocusNs={(id) => setFocusNs(id)}
|
|
582
|
+
onAddToNs={(id) => { setManageOpen(false); setAddFor(id); }}
|
|
583
|
+
onRemoveNsItem={(nsId, key) => { removeItemFromNs(nsId, key); toast('已从分区移除'); }}
|
|
582
584
|
observeOpen={observeOpen}
|
|
583
585
|
onObserveClose={() => setObserveOpen(false)}
|
|
584
586
|
labelOf={labelOf}
|
|
@@ -23,11 +23,15 @@ export interface NsDialogsProps {
|
|
|
23
23
|
namespaces: SidebarNs[];
|
|
24
24
|
focusNs?: string;
|
|
25
25
|
onManageClose: () => void;
|
|
26
|
-
|
|
26
|
+
/** #256:重命名改走标准表单弹窗(宿主负责关管理弹窗再开表单),不再用原生 prompt */
|
|
27
|
+
onEditNsName: (id: string, name: string) => void;
|
|
27
28
|
onMoveNs: (id: string, dir: -1 | 1) => void;
|
|
28
29
|
onRemoveNs: (id: string) => void;
|
|
29
30
|
onNewNs: () => void;
|
|
30
31
|
onFocusNs: (id: string) => void;
|
|
32
|
+
/** #256:管理弹窗内的成员增删(添加 = 关管理弹窗呼出成员选择;移除 = 只摘出该分区) */
|
|
33
|
+
onAddToNs: (id: string) => void;
|
|
34
|
+
onRemoveNsItem: (nsId: string, itemKey: string) => void;
|
|
31
35
|
/** #181:详情观察 */
|
|
32
36
|
observeOpen: boolean;
|
|
33
37
|
onObserveClose: () => void;
|
|
@@ -45,11 +49,14 @@ export default function NsDialogs(p: NsDialogsProps) {
|
|
|
45
49
|
namespaces={p.namespaces}
|
|
46
50
|
focusNs={p.focusNs}
|
|
47
51
|
onClose={p.onManageClose}
|
|
48
|
-
|
|
52
|
+
onEditName={p.onEditNsName}
|
|
49
53
|
onMove={p.onMoveNs}
|
|
50
54
|
onRemove={p.onRemoveNs}
|
|
51
55
|
onNew={() => { p.onManageClose(); p.onNewNs(); }}
|
|
52
56
|
onFocus={p.onFocusNs}
|
|
57
|
+
onAddItems={p.onAddToNs}
|
|
58
|
+
onRemoveItem={p.onRemoveNsItem}
|
|
59
|
+
labelOf={p.labelOf}
|
|
53
60
|
/>
|
|
54
61
|
) : null}
|
|
55
62
|
{p.observeOpen ? (
|