@aiti-ai/aiti-git-review 0.2.9 → 0.2.10
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/README.md +14 -22
- package/README.zh-CN.md +31 -0
- package/client/src/entry.tsx +3 -3
- package/client/src/review-app.tsx +31 -9
- package/dev-pack.mjs +16 -3
- package/dist/aiti-git-review-client.mjs +422 -52
- package/index.ts +10 -3
- package/package.json +4 -4
- package/tools/build-client.mjs +2 -1
package/README.md
CHANGED
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
# @aiti-ai/aiti-git-review
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Dedicated to reviewing uncommitted changes — Monaco diff workspace (side-by-side/merged/new-only/outline) + line-level annotations (must/suggest/question) + anchor flag-line re-mapping (stays valid while editing mid-review) + summary final-review checklist + AI pre-review (aiti_review_* tools injected only into review sessions, zero tools day-to-day)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
English · [简体中文](./README.zh-CN.md)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## About aiti
|
|
8
8
|
|
|
9
9
|
This package is part of the **aiti** ecosystem — a personal AI development workbench powered by [pi](https://pi.dev): **aiti-agent** (a self-hosted web workbench built on the open-source [pi-web](https://github.com/aiti-ai/pi-web)) plus debug injection into mainstream dev tools (aiti-devtools) and a rich extension system.
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
11
|
+
- Workbench (aiti-agent, built on pi-web): <https://github.com/aiti-ai/pi-web>
|
|
12
|
+
- Ecosystem monorepo: <https://github.com/aiti-ai/aiti-ai>
|
|
13
|
+
- Site: <https://aiti.pw>
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Category: Developer tools · Tags: `git` · `review` · `diff` · `monaco` · `annotation` · `pre-review`
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Install
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Bundled with **aiti-agent** (`@aiti-ai/pi-web`) — enable it from the in-app extension manager (ExtMan / App Center).
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Manual install: place this package at `~/.pi/web/extensions/aiti-git-review/` and reload pi-web.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Documentation
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# 部署到 ~/.pi/web/extensions/aiti-git-review/ 后 reload
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## 文档 · Documentation
|
|
32
|
-
|
|
33
|
-
- 中文完整文档(aiti-docs): <https://aiti.pw/extensions/aiti-git-review.html>
|
|
34
|
-
- English docs: <https://aiti.pw/en/extensions/aiti-git-review.html>
|
|
35
|
-
- 扩展注册表 / registry: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
25
|
+
- Documentation (English): <https://aiti.pw/en/extensions/aiti-git-review.html>
|
|
26
|
+
- 文档(中文): <https://aiti.pw/extensions/aiti-git-review.html>
|
|
27
|
+
- Extension registry: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
36
28
|
|
|
37
29
|
## License
|
|
38
30
|
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @aiti-ai/aiti-git-review
|
|
2
|
+
|
|
3
|
+
> 专职审核未提交变更 —— Monaco diff 工作区(并排/合并/纯新/大纲)+ 行级标注(必须/建议/疑问)+ anchor 标志行重映射(边审边改不失效)+ 汇总终审清单 + AI 预审(aiti_review_* 工具只注入评审会话,日常零工具)
|
|
4
|
+
|
|
5
|
+
[English](./README.md) · 简体中文
|
|
6
|
+
|
|
7
|
+
## 关于 aiti
|
|
8
|
+
|
|
9
|
+
本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/pi-web) 构建,浏览器为主操作面)+ 各开发工具内的调试注入(aiti-devtools)+ 丰富的扩展体系。
|
|
10
|
+
|
|
11
|
+
- 工作台(aiti-agent,基于 pi-web): <https://github.com/aiti-ai/pi-web>
|
|
12
|
+
- 生态仓库: <https://github.com/aiti-ai/aiti-ai>
|
|
13
|
+
- 官网: <https://aiti.pw>
|
|
14
|
+
|
|
15
|
+
分类: 开发工具 · tags: `git` · `review` · `diff` · `monaco` · `annotation` · `pre-review`
|
|
16
|
+
|
|
17
|
+
## 安装
|
|
18
|
+
|
|
19
|
+
随 **aiti-agent**(`@aiti-ai/pi-web`)捆绑发行——在工作台内的扩展管理器(ExtMan / 应用中心)启用即可。
|
|
20
|
+
|
|
21
|
+
手动安装:把本包放到 `~/.pi/web/extensions/aiti-git-review/` 后 reload。
|
|
22
|
+
|
|
23
|
+
## 文档
|
|
24
|
+
|
|
25
|
+
- 中文文档: <https://aiti.pw/extensions/aiti-git-review.html>
|
|
26
|
+
- Documentation (English): <https://aiti.pw/en/extensions/aiti-git-review.html>
|
|
27
|
+
- 扩展注册表: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
28
|
+
|
|
29
|
+
## 许可证
|
|
30
|
+
|
|
31
|
+
MIT
|
package/client/src/entry.tsx
CHANGED
|
@@ -24,8 +24,8 @@ export default function register(ctx: Record<string, any>) {
|
|
|
24
24
|
ctx.registerItems?.("toolbar", [{
|
|
25
25
|
id: "aiti-git-review-open",
|
|
26
26
|
meta: {
|
|
27
|
-
label: "
|
|
28
|
-
title: "
|
|
27
|
+
label: "i18n:gr.app.label",
|
|
28
|
+
title: "i18n:gr.app.title",
|
|
29
29
|
icon: "icons/eye.svg",
|
|
30
30
|
onClick: () => openFromToolbar(),
|
|
31
31
|
},
|
|
@@ -33,7 +33,7 @@ export default function register(ctx: Record<string, any>) {
|
|
|
33
33
|
ctx.registerItems?.("pages", [{ id: "aiti-git-review-page", render: ReviewWork }]);
|
|
34
34
|
// aiti-float dock v0.5.0(§1.1 审查 tab):右栏停靠 face——与 pages face 经状态机互斥 gate
|
|
35
35
|
// ⚠ 注册 raw itemId,宿主自动拼 extId:itemId = itemKey——必须与状态机 key "aiti-git-review:workspace" 一致
|
|
36
|
-
ctx.registerItems?.("rightFileDock", [{ id: "workspace", render: DockReviewWork, meta: { title: "
|
|
36
|
+
ctx.registerItems?.("rightFileDock", [{ id: "workspace", render: DockReviewWork, meta: { title: "i18n:gr.workspace.label" } }]);
|
|
37
37
|
|
|
38
38
|
// ── 全局打开兜底(ReviewWork 挂载前的早期调用只记状态) ──
|
|
39
39
|
(window as any).__aitiGitReviewOpen = (opts: any) => { G.open = opts || {}; };
|
|
@@ -64,6 +64,17 @@ export function ReviewApp({ onClose, init, onExitToList }: {
|
|
|
64
64
|
const [err, setErr] = useState("");
|
|
65
65
|
// 视图:小屏默认「合并」(并排在窄屏不可读);用户手动选过后不再跟随断点切换
|
|
66
66
|
const [view, setView] = useState(() => (window.matchMedia(SMALL_MQ).matches ? "inline" : "side"));
|
|
67
|
+
// Outline is navigation, not a render mode: it can be toggled on any view.
|
|
68
|
+
const [outlineOpen, setOutlineOpen] = useState<boolean>(() => {
|
|
69
|
+
try { return localStorage.getItem("aiti-git-review.outline") === "1"; } catch { return false; }
|
|
70
|
+
});
|
|
71
|
+
const toggleOutline = () => {
|
|
72
|
+
setOutlineOpen((on) => {
|
|
73
|
+
const next = !on;
|
|
74
|
+
try { localStorage.setItem("aiti-git-review.outline", next ? "1" : "0"); } catch { /* ignore */ }
|
|
75
|
+
return next;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
67
78
|
const viewTouchedRef = useRef(false);
|
|
68
79
|
const setViewUser = (v: string) => { viewTouchedRef.current = true; setView(v); };
|
|
69
80
|
// 加注模式:点 diff 行加注。触屏无右键 → 小屏默认开;桌面默认关(右键可用)
|
|
@@ -135,7 +146,7 @@ export function ReviewApp({ onClose, init, onExitToList }: {
|
|
|
135
146
|
const widthBucketRef = useRef(widthBucket);
|
|
136
147
|
|
|
137
148
|
function restoreConfig(cfg: any, bucket: number | null, markTouched?: boolean) {
|
|
138
|
-
setView(cfg.view || "inline");
|
|
149
|
+
setView(cfg.view === "outline" ? "inline" : (cfg.view || "inline"));
|
|
139
150
|
viewTouchedRef.current = true; // 已恢复用户配置 → 不再跟随断点自动切换
|
|
140
151
|
setShowFiles(cfg.showFiles !== false);
|
|
141
152
|
setShowDiff(cfg.showDiff !== false);
|
|
@@ -906,12 +917,13 @@ export function ReviewApp({ onClose, init, onExitToList }: {
|
|
|
906
917
|
if (backStops.length) setAnnoStop(backStops.length - 1);
|
|
907
918
|
}
|
|
908
919
|
}
|
|
909
|
-
//
|
|
920
|
+
// Outline jump: dispatch to the modified side (diff) or the single editor (current view).
|
|
910
921
|
function jumpToHunk(hk: any) {
|
|
911
922
|
if (!hk) return;
|
|
912
|
-
const line = hk.newStart || 1;
|
|
923
|
+
const line = Math.max(1, hk.newStart || 1);
|
|
913
924
|
const ed = (containerRef.current as any) && (containerRef.current as any)._aitiGrEd;
|
|
914
|
-
|
|
925
|
+
const target = ed && ed.getModifiedEditor ? ed.getModifiedEditor() : ed;
|
|
926
|
+
try { target && target.revealPositionInCenter ? target.revealPositionInCenter({ lineNumber: line, column: 1 }, true) : null; } catch {}
|
|
915
927
|
}
|
|
916
928
|
// ── 键盘快捷键(M4):▸ F7/Shift+F7 上下条 diff 变更;▸ Alt+↑/↓ 跨文件导航;▸ Esc 关闭标注气泡 ──
|
|
917
929
|
useEffect(() => {
|
|
@@ -1014,9 +1026,17 @@ export function ReviewApp({ onClose, init, onExitToList }: {
|
|
|
1014
1026
|
<option key="side" value="side">并排</option>
|
|
1015
1027
|
<option key="inline" value="inline">合并</option>
|
|
1016
1028
|
<option key="current" value="current">纯新</option>
|
|
1017
|
-
<option key="outline" value="outline">大纲</option>
|
|
1018
1029
|
</select>
|
|
1019
1030
|
)}
|
|
1031
|
+
{(isMobile ? mobilePane === "diff" : showDiff) && diff && (
|
|
1032
|
+
<button
|
|
1033
|
+
onClick={toggleOutline}
|
|
1034
|
+
aria-pressed={outlineOpen}
|
|
1035
|
+
title={(outlineOpen ? "隐藏变更大纲" : "显示变更大纲") + "(" + hunks.length + " 个变更区)"}
|
|
1036
|
+
style={{ ...segBtn, fontSize: 13, lineHeight: 1, padding: "3px 7px", height: 26,
|
|
1037
|
+
background: outlineOpen ? "rgba(37,99,235,.10)" : "var(--bg,#fff)", color: "var(--text,#333)" }}
|
|
1038
|
+
>☰</button>
|
|
1039
|
+
)}
|
|
1020
1040
|
{/* ↩ 标记回滚(trace 专属):点击=标记/取消标记(不执行);提交时按开关执行或打包给 AI */}
|
|
1021
1041
|
{isTrace && (
|
|
1022
1042
|
<button
|
|
@@ -1133,10 +1153,12 @@ export function ReviewApp({ onClose, init, onExitToList }: {
|
|
|
1133
1153
|
无变更行(纯新/删除文件)
|
|
1134
1154
|
</div>
|
|
1135
1155
|
)}
|
|
1136
|
-
{
|
|
1137
|
-
<div style={{ position: "absolute", top: 6,
|
|
1138
|
-
<div style={{ fontSize: 11, fontWeight: 700, color: "var(--text-dim,#888)", padding: "4px 6px" }}>
|
|
1139
|
-
{"大纲 · " + hunks.length + " 个变更区"}
|
|
1156
|
+
{outlineOpen && diff && (
|
|
1157
|
+
<div style={{ position: "absolute", top: 6, right: 6, bottom: 6, width: "min(240px, 45vw)", overflowY: "auto", background: "var(--bg,#fff)", border: "1px solid var(--border,#ddd)", borderRadius: 8, boxShadow: "0 4px 16px rgba(0,0,0,.12)", zIndex: 20, padding: 6 }}>
|
|
1158
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 6, fontSize: 11, fontWeight: 700, color: "var(--text-dim,#888)", padding: "4px 6px" }}>
|
|
1159
|
+
<span>{"大纲 · " + hunks.length + " 个变更区"}</span>
|
|
1160
|
+
<button onClick={toggleOutline} title="隐藏变更大纲"
|
|
1161
|
+
style={{ border: "none", background: "transparent", cursor: "pointer", color: "var(--text-dim,#888)", fontSize: 12, lineHeight: 1, padding: 2 }}>✕</button>
|
|
1140
1162
|
</div>
|
|
1141
1163
|
{hunks.length === 0 && <div style={{ color: "var(--text-muted,#999)", fontSize: 12, padding: 8 }}>纯新增/删除文件无 hunk(整文件变更)</div>}
|
|
1142
1164
|
{hunks.map((hk, i) => (
|
package/dev-pack.mjs
CHANGED
|
@@ -77,7 +77,7 @@ export function agentsMdTemplate(extId) {
|
|
|
77
77
|
|
|
78
78
|
/** 默认 tools/build.mjs(esbuild 单包零配置;扩展自带 tools/build.mjs 则不走到这里)。 */
|
|
79
79
|
function buildMjsTemplate(extId, extRoot, clientOut, entryRel) {
|
|
80
|
-
|
|
80
|
+
// No hardcoded checkout path: candidates are resolved at run time (see repoCandidates below).
|
|
81
81
|
return `/**
|
|
82
82
|
* ${extId} · 现场构建入口(dev-pack 默认模板,esbuild 单包零配置)
|
|
83
83
|
* 用法:node tools/build.mjs
|
|
@@ -96,12 +96,25 @@ const entryRel = ${JSON.stringify(entryRel || "")};
|
|
|
96
96
|
|
|
97
97
|
// esbuild 解析:部署目录 node_modules → 源码仓 node_modules(本机开发场景)→ PATH 上的 esbuild → npm exec 现拉。
|
|
98
98
|
// 注意:node_modules/esbuild/bin/esbuild 是原生二进制(ELF/Mach-O),必须直接执行(不能当 JS 跑)。
|
|
99
|
+
// Checkout roots are discovered by walking up from the extension dir (a root has node_modules/),
|
|
100
|
+
// plus AITI_REPO_ROOT when set — no machine-specific absolute paths baked into generated files.
|
|
101
|
+
function repoCandidates() {
|
|
102
|
+
const out = [];
|
|
103
|
+
if (process.env.AITI_REPO_ROOT) out.push(process.env.AITI_REPO_ROOT.split(pathSep).join("/") + "/node_modules/esbuild/bin/esbuild");
|
|
104
|
+
let d = extRoot;
|
|
105
|
+
for (let i = 0; i < 8; i++) {
|
|
106
|
+
out.push(d.split(pathSep).join("/") + "/node_modules/esbuild/bin/esbuild");
|
|
107
|
+
const up = dirname(d);
|
|
108
|
+
if (up === d) break;
|
|
109
|
+
d = up;
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
99
113
|
function findEsbuild() {
|
|
100
114
|
const home = (process.env.HOME || process.env.USERPROFILE || "").split(pathSep).join("/");
|
|
101
115
|
const candidates = [
|
|
102
116
|
extRoot + "/node_modules/esbuild/bin/esbuild",
|
|
103
|
-
|
|
104
|
-
"C:/workspace/aiti-ai/node_modules/esbuild/bin/esbuild", // windows dev box(源码在 D 盘)
|
|
117
|
+
...repoCandidates(),
|
|
105
118
|
];
|
|
106
119
|
for (const c of candidates) {
|
|
107
120
|
if (!existsSync(c)) continue;
|
|
@@ -52,6 +52,8 @@ function t$1(key, params) {
|
|
|
52
52
|
return typeof fn === "function" ? fn(key, params) : key;
|
|
53
53
|
}
|
|
54
54
|
function isFixedContainingBlock(cs) {
|
|
55
|
+
const zoomValue = parseFloat(cs.zoom || "");
|
|
56
|
+
if (Number.isFinite(zoomValue) && zoomValue !== 1) return true;
|
|
55
57
|
if (cs.transform !== "none" || cs.perspective !== "none" || cs.filter !== "none") return true;
|
|
56
58
|
if (/transform|perspective|filter/.test(cs.willChange || "")) return true;
|
|
57
59
|
const c2 = cs.contain;
|
|
@@ -71,6 +73,19 @@ function fixedOrigin(el) {
|
|
|
71
73
|
}
|
|
72
74
|
return { x: 0, y: 0 };
|
|
73
75
|
}
|
|
76
|
+
function zoomFactorOf(el) {
|
|
77
|
+
let z = 1;
|
|
78
|
+
let n = el.parentElement;
|
|
79
|
+
while (n && n !== document.documentElement) {
|
|
80
|
+
try {
|
|
81
|
+
const zoomValue = parseFloat(getComputedStyle(n).zoom || "");
|
|
82
|
+
if (Number.isFinite(zoomValue) && zoomValue > 0 && zoomValue !== 1) z *= zoomValue;
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
n = n.parentElement;
|
|
86
|
+
}
|
|
87
|
+
return z;
|
|
88
|
+
}
|
|
74
89
|
function clampToViewport(left, top, width, height, pad = 8) {
|
|
75
90
|
const vw = window.innerWidth;
|
|
76
91
|
const vh = window.innerHeight;
|
|
@@ -81,6 +96,7 @@ function clampToViewport(left, top, width, height, pad = 8) {
|
|
|
81
96
|
}
|
|
82
97
|
const P = (d) => ({ tag: "path", attrs: { d } });
|
|
83
98
|
const R = (x, y, width, height, rx = 2) => ({ tag: "rect", attrs: { x, y, width, height, rx } });
|
|
99
|
+
const thin = (n) => ({ ...n, attrs: { ...n.attrs, "stroke-width": 1.5 } });
|
|
84
100
|
const DOCK_ICON_NODES = {
|
|
85
101
|
/** 浮窗:圆角框 + 标题栏 + 圆点(app-window;用户 2026-09-15 定稿 C)。 */
|
|
86
102
|
float: [
|
|
@@ -114,6 +130,12 @@ const DOCK_ICON_NODES = {
|
|
|
114
130
|
],
|
|
115
131
|
/** 关闭:×(lucide x;⋮ 区块操作「关闭」)。 */
|
|
116
132
|
x: [P("M18 6 6 18"), P("m6 6 12 12")],
|
|
133
|
+
/** 取消钉住态:图钉 + 斜删除线(lucide pin-off;移动行钉住钮已钉态,与 MiPin 同语义族)。 */
|
|
134
|
+
"pin-off": [
|
|
135
|
+
{ tag: "line", attrs: { x1: 12, y1: 17, x2: 12, y2: 22 } },
|
|
136
|
+
P("M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16h14v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"),
|
|
137
|
+
{ tag: "line", attrs: { x1: 2, y1: 2, x2: 22, y2: 22 } }
|
|
138
|
+
],
|
|
117
139
|
/** 移除本实例:垃圾桶(lucide trash;多实例区块 ⋮「移除本实例」,与 aiti-folder MiTrash 同形)。 */
|
|
118
140
|
trash: [
|
|
119
141
|
{ tag: "polyline", attrs: { points: "3 6 5 6 21 6" } },
|
|
@@ -126,6 +148,89 @@ const DOCK_ICON_NODES = {
|
|
|
126
148
|
P("M5 11V5h6"),
|
|
127
149
|
P("M19 13v6h-6"),
|
|
128
150
|
P("M5 5l14 14")
|
|
151
|
+
],
|
|
152
|
+
/* ── Block semantic icons (collapsed-header icons; lucide line style) ── */
|
|
153
|
+
/** Projects block (session-manager projects): the aiti-ai logo as line art (chosen by
|
|
154
|
+
* the user 2026-11-26 from the icon candidates preview; prototype = aiti-docs
|
|
155
|
+
* docs/.vuepress/public/logo.svg). Three brand elements: large-rounded square (the
|
|
156
|
+
* gradient tile) + geometric letter a (circle + stem) + top-right spark (from the
|
|
157
|
+
* logo's yellow dot). Visual weight kept on par with the folder/file glyph family:
|
|
158
|
+
* the spark dot is stroked, not filled (a filled node reads much heavier at 13px),
|
|
159
|
+
* and the letter circle stays small so line density matches single-outline glyphs. */
|
|
160
|
+
"aiti-ai-logo": [
|
|
161
|
+
thin(R(3, 3, 18, 18, 4)),
|
|
162
|
+
thin({ tag: "circle", attrs: { cx: 10, cy: 14, r: 2.8 } }),
|
|
163
|
+
thin(P("M12.8 11.2v5.6")),
|
|
164
|
+
thin({ tag: "circle", attrs: { cx: 16.8, cy: 7.2, r: 1.2 } }),
|
|
165
|
+
thin(P("m18.8 5.3 1.5-1.6")),
|
|
166
|
+
thin(P("m19.2 8.2 2.1-.4"))
|
|
167
|
+
],
|
|
168
|
+
/** Folder block (aiti-folder faces): single folder (lucide folder). */
|
|
169
|
+
folder: [
|
|
170
|
+
P("M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z")
|
|
171
|
+
],
|
|
172
|
+
/** Scheduled tasks block (aiti-ai-schedule tasks): clock (lucide clock). */
|
|
173
|
+
clock: [
|
|
174
|
+
{ tag: "circle", attrs: { cx: 12, cy: 12, r: 10 } },
|
|
175
|
+
{ tag: "polyline", attrs: { points: "12 6 12 12 16 14" } }
|
|
176
|
+
],
|
|
177
|
+
/** Subagent fleet block (aiti-subagents fleet): robot (lucide bot). */
|
|
178
|
+
bot: [
|
|
179
|
+
P("M12 8V4H8"),
|
|
180
|
+
R(4, 8, 16, 12),
|
|
181
|
+
P("M2 14h2"),
|
|
182
|
+
P("M20 14h2"),
|
|
183
|
+
P("M15 13v2"),
|
|
184
|
+
P("M9 13v2")
|
|
185
|
+
],
|
|
186
|
+
/** Prompt library block (aiti-prompts panel): bookshelf lines (lucide library). */
|
|
187
|
+
library: [
|
|
188
|
+
P("m16 6 4 14"),
|
|
189
|
+
P("M12 6v14"),
|
|
190
|
+
P("M8 8v12"),
|
|
191
|
+
P("M4 4v16")
|
|
192
|
+
],
|
|
193
|
+
/** Model availability block (aiti-model-check panel): shield + check (lucide shield-check). */
|
|
194
|
+
"shield-check": [
|
|
195
|
+
P("M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"),
|
|
196
|
+
P("m9 12 2 2 4-4")
|
|
197
|
+
],
|
|
198
|
+
/** Watch paths block (aiti-git-trace watch): branch (lucide git-branch). */
|
|
199
|
+
"git-branch": [
|
|
200
|
+
{ tag: "line", attrs: { x1: 6, y1: 3, x2: 6, y2: 15 } },
|
|
201
|
+
{ tag: "circle", attrs: { cx: 18, cy: 6, r: 3 } },
|
|
202
|
+
{ tag: "circle", attrs: { cx: 6, cy: 18, r: 3 } },
|
|
203
|
+
P("M18 9a9 9 0 0 1-9 9")
|
|
204
|
+
],
|
|
205
|
+
/** Timeline block (aiti-git-trace timeline): clock + counterclockwise arrow (lucide history). */
|
|
206
|
+
history: [
|
|
207
|
+
P("M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"),
|
|
208
|
+
P("M3 3v5h5"),
|
|
209
|
+
P("M12 7v5l4 2")
|
|
210
|
+
],
|
|
211
|
+
/** File panel block (aiti-editor file faces): document (lucide file). */
|
|
212
|
+
file: [
|
|
213
|
+
P("M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"),
|
|
214
|
+
P("M14 2v4a2 2 0 0 0 2 2h4")
|
|
215
|
+
],
|
|
216
|
+
/** ACP management block (aiti-acp-agent manage): plug (lucide plug). */
|
|
217
|
+
plug: [
|
|
218
|
+
P("M12 22v-5"),
|
|
219
|
+
P("M9 8V2"),
|
|
220
|
+
P("M15 8V2"),
|
|
221
|
+
P("M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z")
|
|
222
|
+
],
|
|
223
|
+
/** Speech recognition block (aiti-ai-input asr): microphone (lucide mic). */
|
|
224
|
+
mic: [
|
|
225
|
+
P("M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"),
|
|
226
|
+
P("M19 10v2a7 7 0 0 1-14 0v-2"),
|
|
227
|
+
{ tag: "line", attrs: { x1: 12, y1: 19, x2: 12, y2: 22 } }
|
|
228
|
+
],
|
|
229
|
+
/** Dock demo block (demo): 3D box (lucide box). */
|
|
230
|
+
box: [
|
|
231
|
+
P("M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"),
|
|
232
|
+
P("m3.3 7 8.7 5 8.7-5"),
|
|
233
|
+
P("M12 22V12")
|
|
129
234
|
]
|
|
130
235
|
};
|
|
131
236
|
function dockIconOfZone(zone) {
|
|
@@ -161,6 +266,13 @@ const DOCK_ICON_SVG_ROOT_PROPS = {
|
|
|
161
266
|
strokeLinecap: "round",
|
|
162
267
|
strokeLinejoin: "round"
|
|
163
268
|
};
|
|
269
|
+
function dockIconReactAttrs(attrs) {
|
|
270
|
+
const out = {};
|
|
271
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
272
|
+
out[!k.includes("-") || k.startsWith("aria-") || k.startsWith("data-") ? k : k.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase())] = v;
|
|
273
|
+
}
|
|
274
|
+
return out;
|
|
275
|
+
}
|
|
164
276
|
function sidebarZoneOf(itemKey) {
|
|
165
277
|
return `sidebar:${itemKey}`;
|
|
166
278
|
}
|
|
@@ -188,6 +300,14 @@ function writeBlockCollapsed(blockKey, collapsed) {
|
|
|
188
300
|
} catch {
|
|
189
301
|
}
|
|
190
302
|
}
|
|
303
|
+
const SIDEBAR_DISMISS_PREFIX = "pi:sidebar-dock:dismissed:";
|
|
304
|
+
function writeBlockDismissed(blockKey, dismissed) {
|
|
305
|
+
try {
|
|
306
|
+
if (dismissed) localStorage.setItem(SIDEBAR_DISMISS_PREFIX + blockKey, "1");
|
|
307
|
+
else localStorage.removeItem(SIDEBAR_DISMISS_PREFIX + blockKey);
|
|
308
|
+
} catch {
|
|
309
|
+
}
|
|
310
|
+
}
|
|
191
311
|
const FLOAT_INSTALLED_EVENT = "piwe-float-installed";
|
|
192
312
|
const DOCK_HEADER_PENDING_TTL = 1e4;
|
|
193
313
|
function actionSig(list) {
|
|
@@ -196,7 +316,7 @@ function actionSig(list) {
|
|
|
196
316
|
}
|
|
197
317
|
function menuSig(list) {
|
|
198
318
|
if (!list) return "";
|
|
199
|
-
return list.map((m) => m.kind === "item" ? `i:${m.id ?? m.label}:${m.label}:${m.hint ?? ""}:${m.active ? 1 : 0}:${m.alwaysRun ? 1 : 0}:${m.disabled ? 1 : 0}` : m.kind === "head" ? `h:${m.label}` : "s").join("§");
|
|
319
|
+
return list.map((m) => m.kind === "item" ? `i:${m.id ?? m.label}:${m.label}:${m.hint ?? ""}:${m.active ? 1 : 0}:${m.alwaysRun ? 1 : 0}:${m.disabled ? 1 : 0}` : m.kind === "head" ? `h:${m.label}` : m.kind === "iconsRow" ? `r:${m.label ?? ""}:${m.items.map((i) => i.key).join(",")}` : m.kind === "moveRow" ? "mv-row" : "s").join("§");
|
|
200
320
|
}
|
|
201
321
|
function stateSig(s) {
|
|
202
322
|
try {
|
|
@@ -407,8 +527,10 @@ function localPresent(k, mode, opts) {
|
|
|
407
527
|
next = zone ? `docked:${zone}` : "floating";
|
|
408
528
|
}
|
|
409
529
|
} else if (mode === "float") next = "floating";
|
|
410
|
-
else if (mode === "close")
|
|
411
|
-
|
|
530
|
+
else if (mode === "close") {
|
|
531
|
+
next = "closed";
|
|
532
|
+
writeBlockDismissed(k, true);
|
|
533
|
+
} else if (mode.startsWith("dock:")) {
|
|
412
534
|
const zone = mode.slice(5);
|
|
413
535
|
try {
|
|
414
536
|
localStorage.setItem(DOCKPREF_KEY(k), zone);
|
|
@@ -416,6 +538,7 @@ function localPresent(k, mode, opts) {
|
|
|
416
538
|
}
|
|
417
539
|
next = `docked:${zone}`;
|
|
418
540
|
}
|
|
541
|
+
if (next !== "closed" && isSidebarDockState(next)) writeBlockDismissed(k, false);
|
|
419
542
|
if (next === prev) {
|
|
420
543
|
if (prev.startsWith("docked:")) {
|
|
421
544
|
try {
|
|
@@ -554,9 +677,24 @@ if (typeof window !== "undefined") {
|
|
|
554
677
|
} catch {
|
|
555
678
|
}
|
|
556
679
|
}
|
|
680
|
+
const DOCK_WORDS = {
|
|
681
|
+
newWindow: { "zh-CN": "新窗口打开", en: "Open in new window" },
|
|
682
|
+
float: { "zh-CN": "浮窗", en: "Float" },
|
|
683
|
+
zoneSidebar: { "zh-CN": "左栏 · 区块", en: "Left · blocks" },
|
|
684
|
+
zoneRight: { "zh-CN": "右栏 · 面板", en: "Right · panels" }
|
|
685
|
+
};
|
|
686
|
+
function dockWord(key) {
|
|
687
|
+
let loc = "en";
|
|
688
|
+
try {
|
|
689
|
+
loc = window.localStorage.getItem("pi-locale") || "en";
|
|
690
|
+
} catch {
|
|
691
|
+
}
|
|
692
|
+
const w = DOCK_WORDS[key];
|
|
693
|
+
return w[loc === "zh-CN" ? "zh-CN" : "en"] ?? w.en;
|
|
694
|
+
}
|
|
557
695
|
const DOCK_ZONE_LABELS = {
|
|
558
|
-
"sidebar-explorer": "
|
|
559
|
-
"right-panel": "
|
|
696
|
+
"sidebar-explorer": dockWord("zoneSidebar"),
|
|
697
|
+
"right-panel": dockWord("zoneRight")
|
|
560
698
|
};
|
|
561
699
|
function positionMenuItems(k, zones, defaultZone, cur) {
|
|
562
700
|
const hasSidebar = zones.some((z) => z === "sidebar-explorer" || z.startsWith("sidebar:"));
|
|
@@ -590,8 +728,8 @@ function positionMenuItems(k, zones, defaultZone, cur) {
|
|
|
590
728
|
function positionMenuModel(k, zones, defaultZone, cur, opts) {
|
|
591
729
|
const newWindow = opts?.onNewWindow ?? dockWindowOpenerOf(k);
|
|
592
730
|
return [
|
|
593
|
-
...newWindow ? [{ key: "new-window", icon: "new-window", label: "
|
|
594
|
-
{ key: "float", icon: "float", label: "
|
|
731
|
+
...newWindow ? [{ key: "new-window", icon: "new-window", label: dockWord("newWindow"), run: newWindow }] : [],
|
|
732
|
+
{ key: "float", icon: "float", label: dockWord("float"), active: cur === "floating", run: () => undockToFloat(k) },
|
|
595
733
|
...positionMenuItems(k, zones, defaultZone, cur)
|
|
596
734
|
];
|
|
597
735
|
}
|
|
@@ -687,13 +825,83 @@ function useGate(itemKey, face) {
|
|
|
687
825
|
if (face === "float") return state === "floating";
|
|
688
826
|
return state === `docked:${face.dock}`;
|
|
689
827
|
}
|
|
828
|
+
const DOCK_MENU_WORDS = {
|
|
829
|
+
expand: { "zh-CN": "展开", en: "Expand" },
|
|
830
|
+
collapse: { "zh-CN": "折叠", en: "Collapse" },
|
|
831
|
+
block: { "zh-CN": "区块", en: "Block" },
|
|
832
|
+
position: { "zh-CN": "切换停靠位置", en: "Change dock position" },
|
|
833
|
+
actions: { "zh-CN": "区块操作", en: "Block actions" },
|
|
834
|
+
move: { "zh-CN": "移动", en: "Move" },
|
|
835
|
+
pin: { "zh-CN": "钉住", en: "Pin" },
|
|
836
|
+
unpin: { "zh-CN": "取消钉住", en: "Unpin" },
|
|
837
|
+
moveUp: { "zh-CN": "上移", en: "Move up" },
|
|
838
|
+
moveDown: { "zh-CN": "下移", en: "Move down" },
|
|
839
|
+
tools: { "zh-CN": "工具", en: "Tools" },
|
|
840
|
+
removeInstance: { "zh-CN": "移除本实例", en: "Remove this instance" },
|
|
841
|
+
close: { "zh-CN": "关闭", en: "Close" },
|
|
842
|
+
zones: { "zh-CN": "停靠方位", en: "Dock zones" },
|
|
843
|
+
defaultSuffix: { "zh-CN": "(默认)", en: " (default)" }
|
|
844
|
+
};
|
|
845
|
+
function menuWord(key) {
|
|
846
|
+
let loc = "en";
|
|
847
|
+
try {
|
|
848
|
+
loc = window.localStorage.getItem("pi-locale") || "en";
|
|
849
|
+
} catch {
|
|
850
|
+
}
|
|
851
|
+
const w = DOCK_MENU_WORDS[key];
|
|
852
|
+
return w[loc === "zh-CN" ? "zh-CN" : "en"] ?? w.en;
|
|
853
|
+
}
|
|
690
854
|
function dockIconEl(name, size = 16) {
|
|
691
855
|
return createElement(
|
|
692
856
|
"svg",
|
|
693
857
|
{ width: size, height: size, ...DOCK_ICON_SVG_ROOT_PROPS, "aria-hidden": "true" },
|
|
694
|
-
...DOCK_ICON_NODES[name].map((n, i) => createElement(n.tag, { key: i, ...n.attrs }))
|
|
858
|
+
...DOCK_ICON_NODES[name].map((n, i) => createElement(n.tag, { key: i, ...dockIconReactAttrs(n.attrs) }))
|
|
695
859
|
);
|
|
696
860
|
}
|
|
861
|
+
function maskedIconSpan(url, size) {
|
|
862
|
+
return createElement("span", { "aria-hidden": "true", style: {
|
|
863
|
+
display: "inline-block",
|
|
864
|
+
width: size,
|
|
865
|
+
height: size,
|
|
866
|
+
flexShrink: 0,
|
|
867
|
+
background: "currentColor",
|
|
868
|
+
WebkitMaskImage: `url("${url}")`,
|
|
869
|
+
maskImage: `url("${url}")`,
|
|
870
|
+
WebkitMaskRepeat: "no-repeat",
|
|
871
|
+
maskRepeat: "no-repeat",
|
|
872
|
+
WebkitMaskPosition: "center",
|
|
873
|
+
maskPosition: "center",
|
|
874
|
+
WebkitMaskSize: "contain",
|
|
875
|
+
maskSize: "contain"
|
|
876
|
+
} });
|
|
877
|
+
}
|
|
878
|
+
function dockIconFromDecl(icon, size = 13) {
|
|
879
|
+
if (icon == null) return null;
|
|
880
|
+
if (typeof icon === "object") {
|
|
881
|
+
const o = icon;
|
|
882
|
+
if (typeof o.svg === "string") {
|
|
883
|
+
return createElement("svg", {
|
|
884
|
+
width: size,
|
|
885
|
+
height: size,
|
|
886
|
+
viewBox: "0 0 24 24",
|
|
887
|
+
fill: "none",
|
|
888
|
+
stroke: "currentColor",
|
|
889
|
+
strokeWidth: 2,
|
|
890
|
+
strokeLinecap: "round",
|
|
891
|
+
strokeLinejoin: "round",
|
|
892
|
+
"aria-hidden": "true",
|
|
893
|
+
dangerouslySetInnerHTML: { __html: o.svg }
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
if (typeof o.url === "string") return maskedIconSpan(o.url, size);
|
|
897
|
+
return null;
|
|
898
|
+
}
|
|
899
|
+
if (typeof icon !== "string" || !icon) return null;
|
|
900
|
+
if (/^https?:\/\//.test(icon)) return maskedIconSpan(icon, size);
|
|
901
|
+
if (DOCK_ICON_NODES[icon]) return dockIconEl(icon, size);
|
|
902
|
+
if (icon.endsWith(".svg")) return null;
|
|
903
|
+
return createElement("span", { style: { fontSize: size, lineHeight: 1 } }, icon);
|
|
904
|
+
}
|
|
697
905
|
function headerStore() {
|
|
698
906
|
const api2 = floatApi();
|
|
699
907
|
const svc = api2?.dockHeader;
|
|
@@ -767,7 +975,8 @@ function DockBody(props) {
|
|
|
767
975
|
if (m.height > below && above > below) top = b.top - gap - m.height;
|
|
768
976
|
const c2 = clampToViewport(b.right - m.width, top, m.width, m.height, pad);
|
|
769
977
|
const o = fixedOrigin(menuEl);
|
|
770
|
-
const
|
|
978
|
+
const z = zoomFactorOf(menuEl);
|
|
979
|
+
const next = { left: (c2.left - o.x) / z, top: (c2.top - o.y) / z };
|
|
771
980
|
setMenuPos((cur) => cur && cur.left === next.left && cur.top === next.top ? cur : next);
|
|
772
981
|
}, [menu, menuEl]);
|
|
773
982
|
useEffect(() => {
|
|
@@ -778,8 +987,23 @@ function DockBody(props) {
|
|
|
778
987
|
if (t2 && menu.anchor?.contains(t2)) return;
|
|
779
988
|
setMenu(null);
|
|
780
989
|
};
|
|
990
|
+
let anchorTop = null;
|
|
991
|
+
let anchorLeft = null;
|
|
992
|
+
try {
|
|
993
|
+
const a = menu.anchor?.getBoundingClientRect?.();
|
|
994
|
+
if (a) {
|
|
995
|
+
anchorTop = a.top;
|
|
996
|
+
anchorLeft = a.left;
|
|
997
|
+
}
|
|
998
|
+
} catch {
|
|
999
|
+
}
|
|
781
1000
|
const onScroll = (e) => {
|
|
782
1001
|
if (menuEl && e.target instanceof Node && menuEl.contains(e.target)) return;
|
|
1002
|
+
try {
|
|
1003
|
+
const a = menu.anchor?.getBoundingClientRect?.();
|
|
1004
|
+
if (a && anchorTop !== null && anchorLeft !== null && Math.abs(a.top - anchorTop) < 4 && Math.abs(a.left - anchorLeft) < 4) return;
|
|
1005
|
+
} catch {
|
|
1006
|
+
}
|
|
783
1007
|
setMenu(null);
|
|
784
1008
|
};
|
|
785
1009
|
document.addEventListener("mousedown", onDown);
|
|
@@ -862,42 +1086,63 @@ function DockBody(props) {
|
|
|
862
1086
|
);
|
|
863
1087
|
const buildMainMenu = () => {
|
|
864
1088
|
const out = [];
|
|
1089
|
+
const sortable = kind !== "reserved";
|
|
1090
|
+
const buildMoveRow = () => ({
|
|
1091
|
+
type: "icons",
|
|
1092
|
+
label: menuWord("move"),
|
|
1093
|
+
icon: dockIconEl("move-diagonal-2", 13),
|
|
1094
|
+
items: [
|
|
1095
|
+
...props.moveRowPin ? [{
|
|
1096
|
+
key: "pin",
|
|
1097
|
+
icon: props.moveRowPin.isPinned() ? "pin-off" : "pin",
|
|
1098
|
+
label: props.moveRowPin.isPinned() ? menuWord("unpin") : menuWord("pin"),
|
|
1099
|
+
run: () => props.moveRowPin.toggle()
|
|
1100
|
+
}] : [],
|
|
1101
|
+
{ key: "move-up", icon: "chevron-up", label: menuWord("moveUp"), run: () => requestBlockMove(blockKey, -1) },
|
|
1102
|
+
{ key: "move-down", icon: "chevron-down", label: menuWord("moveDown"), run: () => requestBlockMove(blockKey, 1) }
|
|
1103
|
+
]
|
|
1104
|
+
});
|
|
865
1105
|
if (overflowActions.length > 0) {
|
|
866
|
-
out.push({ type: "head", label: "
|
|
1106
|
+
out.push({ type: "head", label: menuWord("tools") });
|
|
867
1107
|
for (const a of overflowActions) out.push({ type: "item", label: a.title, icon: a.icon, badge: a.badge, active: a.active, alwaysRun: true, disabled: a.disabled, run: a.onClick });
|
|
868
1108
|
}
|
|
869
1109
|
if (storeData.menuItems && storeData.menuItems.length > 0) {
|
|
870
1110
|
if (out.length > 0) out.push({ type: "sep" });
|
|
1111
|
+
let moveRowInserted = false;
|
|
871
1112
|
for (const m of storeData.menuItems) {
|
|
1113
|
+
if (m.kind === "moveRow" && sortable && !moveRowInserted) {
|
|
1114
|
+
moveRowInserted = true;
|
|
1115
|
+
out.push(buildMoveRow());
|
|
1116
|
+
continue;
|
|
1117
|
+
}
|
|
872
1118
|
if (m.kind === "head") out.push({ type: "head", label: m.label });
|
|
873
1119
|
else if (m.kind === "sep") out.push({ type: "sep" });
|
|
1120
|
+
else if (m.kind === "iconsRow") out.push({ type: "icons", label: m.label, items: m.items });
|
|
874
1121
|
else out.push({ type: "item", label: m.label, icon: m.icon, hint: m.hint, active: m.active, alwaysRun: m.alwaysRun, disabled: m.disabled, run: m.run });
|
|
875
1122
|
}
|
|
1123
|
+
if (chrome === "section" && sortable && !moveRowInserted) out.push(buildMoveRow());
|
|
876
1124
|
}
|
|
877
1125
|
const ops = [];
|
|
878
|
-
if (chrome === "section") {
|
|
879
|
-
ops.push(
|
|
880
|
-
{ key: "move-up", icon: "chevron-up", label: "上移", run: () => requestBlockMove(blockKey, -1) },
|
|
881
|
-
{ key: "move-down", icon: "chevron-down", label: "下移", run: () => requestBlockMove(blockKey, 1) }
|
|
882
|
-
] });
|
|
1126
|
+
if (chrome === "section" && sortable && !(storeData.menuItems || []).some((m) => m.kind === "moveRow")) {
|
|
1127
|
+
ops.push(buildMoveRow());
|
|
883
1128
|
}
|
|
884
1129
|
if (kind === "reserved" && typeof props.onRemove === "function") {
|
|
885
|
-
ops.push({ type: "item", label: "
|
|
1130
|
+
ops.push({ type: "item", label: menuWord("removeInstance"), icon: dockIconEl("trash", 13), run: () => props.onRemove() });
|
|
886
1131
|
}
|
|
887
1132
|
if (Array.isArray(props.extraMenuItems)) {
|
|
888
1133
|
for (const m of props.extraMenuItems) ops.push({ type: "item", label: m.label, icon: m.icon, hint: m.hint, active: m.active, alwaysRun: m.alwaysRun, run: m.run });
|
|
889
1134
|
}
|
|
890
|
-
if (kind === "dockable" && chrome === "section") {
|
|
891
|
-
ops.push({ type: "item", label: "
|
|
1135
|
+
if (kind === "dockable" && chrome === "section" && props.hideCloseItem !== true) {
|
|
1136
|
+
ops.push({ type: "item", label: menuWord("close"), icon: dockIconEl("x", 13), run: () => props.onClose ? props.onClose() : closePanel(itemKey) });
|
|
892
1137
|
}
|
|
893
1138
|
if (ops.length > 0) {
|
|
894
1139
|
if (out.length > 0) out.push({ type: "sep" });
|
|
895
|
-
out.push({ type: "head", label: "
|
|
1140
|
+
out.push({ type: "head", label: menuWord("block") });
|
|
896
1141
|
out.push(...ops);
|
|
897
1142
|
}
|
|
898
1143
|
return out;
|
|
899
1144
|
};
|
|
900
|
-
const positionRows = menu?.kind === "position" ? [{ type: "icons", label: "
|
|
1145
|
+
const positionRows = menu?.kind === "position" ? [{ type: "icons", label: menuWord("zones"), items: positionMenuModel(itemKey, allZones, defaultZone, state, { onNewWindow: props.onNewWindow }) }] : [];
|
|
901
1146
|
const menuRows = menu?.kind === "position" ? positionRows : menu?.kind === "main" ? buildMainMenu() : [];
|
|
902
1147
|
const renderMenuRow = (it, i) => {
|
|
903
1148
|
if (it.type === "sep") return createElement("div", { key: `sep-${i}`, style: { height: 1, background: "var(--border, #444)", margin: "3px 4px", opacity: 0.7, flexShrink: 0 } });
|
|
@@ -940,7 +1185,7 @@ function DockBody(props) {
|
|
|
940
1185
|
},
|
|
941
1186
|
...it.items.map((x, j) => {
|
|
942
1187
|
const isRadio = x.active === true || x.active === false;
|
|
943
|
-
const tip = x.isDefault ? `${x.label}
|
|
1188
|
+
const tip = x.isDefault ? `${x.label}${menuWord("defaultSuffix")}` : x.label;
|
|
944
1189
|
return createElement(
|
|
945
1190
|
"button",
|
|
946
1191
|
{
|
|
@@ -984,7 +1229,7 @@ function DockBody(props) {
|
|
|
984
1229
|
}
|
|
985
1230
|
}
|
|
986
1231
|
},
|
|
987
|
-
dockIconEl(x.icon, 16),
|
|
1232
|
+
typeof x.icon === "string" ? dockIconEl(x.icon, 16) : x.icon,
|
|
988
1233
|
x.isDefault ? createElement("span", { key: "dot", "data-ext-dock-icon-default": "1", style: { position: "absolute", top: 3, right: 3, width: 4, height: 4, borderRadius: "50%", background: "var(--accent, #2563eb)", pointerEvents: "none" } }) : null
|
|
989
1234
|
);
|
|
990
1235
|
})
|
|
@@ -1052,7 +1297,16 @@ function DockBody(props) {
|
|
|
1052
1297
|
// 首帧离屏(布局期测量后落位,绘制前同步无闪烁)
|
|
1053
1298
|
...menuPos ? { left: menuPos.left, top: menuPos.top } : { left: -99999, top: -99999 }
|
|
1054
1299
|
},
|
|
1055
|
-
|
|
1300
|
+
// hover 关闭仅限真 hover 设备(2026-11-15 小屏反馈「菜单经常自己关掉」):手机上手指
|
|
1301
|
+
// 滑动浏览菜单项时浏览器合成 mouse 事件(touchmove 目标变化 → 合成 mouseleave),
|
|
1302
|
+
// 无条件关闭等于「一滑就关」;触屏(hover:none)忽略 mouseleave,改由外点/滚动关闭。
|
|
1303
|
+
onMouseLeave: () => {
|
|
1304
|
+
try {
|
|
1305
|
+
if (!window.matchMedia("(hover: hover) and (pointer: fine)").matches) return;
|
|
1306
|
+
} catch {
|
|
1307
|
+
}
|
|
1308
|
+
setMenu(null);
|
|
1309
|
+
}
|
|
1056
1310
|
}, menuRows.map(renderMenuRow)) : null;
|
|
1057
1311
|
const toggleCollapsed = () => setCollapsed(!collapsed);
|
|
1058
1312
|
const onDragStart = (e) => {
|
|
@@ -1099,9 +1353,9 @@ function DockBody(props) {
|
|
|
1099
1353
|
if (e.target && typeof e.target.closest === "function" && e.target.closest("button")) return;
|
|
1100
1354
|
toggleCollapsed();
|
|
1101
1355
|
} };
|
|
1102
|
-
if (chrome === "section") {
|
|
1356
|
+
if (chrome === "section" && kind !== "reserved") {
|
|
1103
1357
|
headerProps.draggable = true;
|
|
1104
|
-
headerProps.title = "拖动排序";
|
|
1358
|
+
headerProps.title = props.headerHint ?? "拖动排序";
|
|
1105
1359
|
headerProps.onDragStart = onDragStart;
|
|
1106
1360
|
headerProps.onDragOver = (e) => {
|
|
1107
1361
|
if (isDockDrag(e) && dragKey !== blockKey) {
|
|
@@ -1122,8 +1376,16 @@ function DockBody(props) {
|
|
|
1122
1376
|
dragKey = null;
|
|
1123
1377
|
document.querySelectorAll(".pi-dock-drop-before, .pi-dock-drop-after").forEach((el) => el.classList.remove("pi-dock-drop-before", "pi-dock-drop-after"));
|
|
1124
1378
|
};
|
|
1379
|
+
} else if (chrome === "section" && props.headerHint) {
|
|
1380
|
+
headerProps.title = props.headerHint;
|
|
1125
1381
|
}
|
|
1126
|
-
const
|
|
1382
|
+
const iconNode = dockIconFromDecl(props.icon, 13);
|
|
1383
|
+
const titleNode = createElement(
|
|
1384
|
+
"span",
|
|
1385
|
+
{ style: { minWidth: 0, flex: "0 1 auto", display: "inline-flex", alignItems: "center", gap: 5 } },
|
|
1386
|
+
iconNode,
|
|
1387
|
+
props.renderTitle ? props.renderTitle() : createElement("span", { style: { fontSize: 13, fontWeight: 500, color: "var(--text, #222)", flex: "0 1 auto", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", minWidth: 0 } }, title ?? "")
|
|
1388
|
+
);
|
|
1127
1389
|
const keepAlive = collapsed && storeData.hasCommands;
|
|
1128
1390
|
return createElement(
|
|
1129
1391
|
"div",
|
|
@@ -1146,8 +1408,8 @@ function DockBody(props) {
|
|
|
1146
1408
|
"button",
|
|
1147
1409
|
{
|
|
1148
1410
|
type: "button",
|
|
1149
|
-
title: collapsed ? "
|
|
1150
|
-
"aria-label": (title ?? "
|
|
1411
|
+
title: collapsed ? menuWord("expand") : menuWord("collapse"),
|
|
1412
|
+
"aria-label": (title ?? menuWord("block")) + (collapsed ? " " + menuWord("expand") : " " + menuWord("collapse")),
|
|
1151
1413
|
"aria-expanded": collapsed ? "false" : "true",
|
|
1152
1414
|
style: { ...btnBase2, display: "flex", alignItems: "center" },
|
|
1153
1415
|
onClick: toggleCollapsed
|
|
@@ -1178,8 +1440,8 @@ function DockBody(props) {
|
|
|
1178
1440
|
createElement("button", {
|
|
1179
1441
|
ref: setPosBtnEl,
|
|
1180
1442
|
type: "button",
|
|
1181
|
-
title: "
|
|
1182
|
-
"aria-label": "
|
|
1443
|
+
title: menuWord("position"),
|
|
1444
|
+
"aria-label": menuWord("position"),
|
|
1183
1445
|
"aria-haspopup": "menu",
|
|
1184
1446
|
"aria-expanded": menu?.kind === "position" ? "true" : "false",
|
|
1185
1447
|
style: { ...btnBase2, fontSize: 12 },
|
|
@@ -1199,8 +1461,8 @@ function DockBody(props) {
|
|
|
1199
1461
|
createElement("button", {
|
|
1200
1462
|
ref: setMenuBtnEl,
|
|
1201
1463
|
type: "button",
|
|
1202
|
-
title: "
|
|
1203
|
-
"aria-label": "
|
|
1464
|
+
title: menuWord("actions"),
|
|
1465
|
+
"aria-label": menuWord("actions"),
|
|
1204
1466
|
"aria-haspopup": "menu",
|
|
1205
1467
|
"aria-expanded": menu?.kind === "main" ? "true" : "false",
|
|
1206
1468
|
style: { ...btnBase2, fontSize: 12, fontWeight: 700 },
|
|
@@ -1419,7 +1681,7 @@ function hunksForSelection(hunks, start, end, side) {
|
|
|
1419
1681
|
});
|
|
1420
1682
|
return out;
|
|
1421
1683
|
}
|
|
1422
|
-
const Z_BASE =
|
|
1684
|
+
const Z_BASE = 2147483600;
|
|
1423
1685
|
const V = {
|
|
1424
1686
|
panel: "var(--bg-panel, #1c1c20)",
|
|
1425
1687
|
hover: "var(--bg-hover, #2a2a30)",
|
|
@@ -1500,10 +1762,30 @@ function drain() {
|
|
|
1500
1762
|
drain();
|
|
1501
1763
|
}
|
|
1502
1764
|
}
|
|
1765
|
+
function canUseTopLayer() {
|
|
1766
|
+
try {
|
|
1767
|
+
const probe = document.createElement("dialog");
|
|
1768
|
+
return !!probe && typeof probe.showModal === "function";
|
|
1769
|
+
} catch {
|
|
1770
|
+
return false;
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
const BACKDROP_STYLE_ID = "ui-dialogs-backdrop";
|
|
1774
|
+
function ensureBackdropStyle() {
|
|
1775
|
+
try {
|
|
1776
|
+
if (document.getElementById(BACKDROP_STYLE_ID)) return;
|
|
1777
|
+
const st = document.createElement("style");
|
|
1778
|
+
st.id = BACKDROP_STYLE_ID;
|
|
1779
|
+
st.textContent = "[data-ui-dialog-overlay]::backdrop{background:transparent;}";
|
|
1780
|
+
(document.head || document.body).appendChild(st);
|
|
1781
|
+
} catch {
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1503
1784
|
function mount() {
|
|
1504
|
-
const
|
|
1785
|
+
const modal = canUseTopLayer();
|
|
1786
|
+
const overlay2 = document.createElement(modal ? "dialog" : "div");
|
|
1505
1787
|
overlay2.setAttribute("data-ui-dialog-overlay", "1");
|
|
1506
|
-
overlay2.style.cssText = "position:fixed;inset:0;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;
|
|
1788
|
+
overlay2.style.cssText = "position:fixed;inset:0;margin:0;border:0;padding:20px;width:auto;height:auto;max-width:none;max-height:none;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;z-index:" + Z_BASE + ";";
|
|
1507
1789
|
const panel2 = document.createElement("div");
|
|
1508
1790
|
panel2.setAttribute("data-ext-float", "1");
|
|
1509
1791
|
panel2.setAttribute("data-ext-float-w", "440");
|
|
@@ -1516,6 +1798,13 @@ function mount() {
|
|
|
1516
1798
|
panel2.style.cssText = "width:440px;max-width:100%;border-radius:12px;background:" + V.panel + ";border:1px solid " + V.border + ";color:" + V.text + ";font-family:inherit;font-size:13px;box-shadow:0 20px 60px rgba(0,0,0,0.35);outline:none;overflow:hidden;";
|
|
1517
1799
|
overlay2.appendChild(panel2);
|
|
1518
1800
|
document.body.appendChild(overlay2);
|
|
1801
|
+
if (modal) {
|
|
1802
|
+
ensureBackdropStyle();
|
|
1803
|
+
try {
|
|
1804
|
+
overlay2.showModal();
|
|
1805
|
+
} catch {
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1519
1808
|
return { overlay: overlay2, panel: panel2 };
|
|
1520
1809
|
}
|
|
1521
1810
|
function buildBody(panel2, spec, finish) {
|
|
@@ -1531,7 +1820,7 @@ function buildBody(panel2, spec, finish) {
|
|
|
1531
1820
|
head.appendChild(icon);
|
|
1532
1821
|
const titleEl = document.createElement("div");
|
|
1533
1822
|
titleEl.style.cssText = "flex:1;min-width:0;font-size:15px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;";
|
|
1534
|
-
titleEl.textContent = o.title || (spec.kind === "confirm" ? o.danger ? "危险操作确认" : "确认操作" : spec.kind === "prompt" ? "输入" : "提示");
|
|
1823
|
+
titleEl.textContent = o.title || (spec.kind === "confirm" ? o.danger ? "危险操作确认" : "确认操作" : spec.kind === "prompt" ? "输入" : spec.kind === "choice" ? "请选择" : "提示");
|
|
1535
1824
|
head.appendChild(titleEl);
|
|
1536
1825
|
panel2.appendChild(head);
|
|
1537
1826
|
if (o.message) {
|
|
@@ -1580,11 +1869,17 @@ function buildBody(panel2, spec, finish) {
|
|
|
1580
1869
|
foot.appendChild(b);
|
|
1581
1870
|
return b;
|
|
1582
1871
|
};
|
|
1583
|
-
if (spec.kind === "
|
|
1872
|
+
if (spec.kind === "choice") {
|
|
1873
|
+
const items = Array.isArray(o.choices) ? o.choices : [];
|
|
1874
|
+
for (const item of items) {
|
|
1875
|
+
mk(item.label || item.id, item.tone === "primary", item.tone === "danger", () => finish(item.id));
|
|
1876
|
+
}
|
|
1877
|
+
if (items.length === 0) finish(o.cancelId ?? null);
|
|
1878
|
+
} else if (spec.kind === "alert") {
|
|
1584
1879
|
const ok = mk(o.confirmText || "确定", true, false, () => finish(void 0));
|
|
1585
1880
|
ok.__primary = true;
|
|
1586
1881
|
} else {
|
|
1587
|
-
mk(o.cancelText || "取消", false, false, () => finish(spec.kind === "prompt" ? null : false));
|
|
1882
|
+
mk(o.cancelText || "取消", false, false, () => finish(spec.kind === "prompt" ? null : spec.kind === "choice" ? o.cancelId ?? null : false));
|
|
1588
1883
|
const ok = mk(o.confirmText || (spec.kind === "confirm" && o.danger ? "确认执行" : "确定"), true, !!(spec.kind === "confirm" && o.danger), () => finish(spec.kind === "prompt" ? input && o.required && !input.value.trim() ? void 0 : input.value : true));
|
|
1589
1884
|
ok.__primary = true;
|
|
1590
1885
|
}
|
|
@@ -1592,7 +1887,7 @@ function buildBody(panel2, spec, finish) {
|
|
|
1592
1887
|
panel2.addEventListener("keydown", (e) => {
|
|
1593
1888
|
if (e.key === "Escape") {
|
|
1594
1889
|
e.stopPropagation();
|
|
1595
|
-
finish(spec.kind === "prompt" ? null : spec.kind === "confirm" ? false : void 0);
|
|
1890
|
+
finish(spec.kind === "prompt" || spec.kind === "choice" ? null : spec.kind === "confirm" ? false : void 0);
|
|
1596
1891
|
} else if (e.key === "Enter" && !(e.target instanceof HTMLButtonElement)) {
|
|
1597
1892
|
e.preventDefault();
|
|
1598
1893
|
(foot.querySelector("button") ? Array.from(foot.querySelectorAll("button")).at(-1) : null)?.click();
|
|
@@ -1608,6 +1903,10 @@ function showDialog(spec, done) {
|
|
|
1608
1903
|
if (settled) return;
|
|
1609
1904
|
settled = true;
|
|
1610
1905
|
spec.resolve(v);
|
|
1906
|
+
try {
|
|
1907
|
+
overlay2.close?.();
|
|
1908
|
+
} catch {
|
|
1909
|
+
}
|
|
1611
1910
|
try {
|
|
1612
1911
|
overlay2.remove();
|
|
1613
1912
|
} catch {
|
|
@@ -1618,6 +1917,16 @@ function showDialog(spec, done) {
|
|
|
1618
1917
|
}
|
|
1619
1918
|
setTimeout(done, 0);
|
|
1620
1919
|
};
|
|
1920
|
+
try {
|
|
1921
|
+
overlay2.addEventListener?.("cancel", (e) => {
|
|
1922
|
+
try {
|
|
1923
|
+
e?.preventDefault?.();
|
|
1924
|
+
} catch {
|
|
1925
|
+
}
|
|
1926
|
+
finish(spec.kind === "prompt" || spec.kind === "choice" ? null : spec.kind === "confirm" ? false : void 0);
|
|
1927
|
+
});
|
|
1928
|
+
} catch {
|
|
1929
|
+
}
|
|
1621
1930
|
const input = buildBody(panel2, spec, finish);
|
|
1622
1931
|
setTimeout(() => {
|
|
1623
1932
|
try {
|
|
@@ -1725,6 +2034,11 @@ const COMPONENT_DICT = {
|
|
|
1725
2034
|
"sidebar.filterProjects": "Filter projects…",
|
|
1726
2035
|
"sidebar.noMatchingProjects": "No matching projects",
|
|
1727
2036
|
"sidebar.useDefaultDirectory": "Use default directory",
|
|
2037
|
+
"files.showIgnored": "Show ignored items",
|
|
2038
|
+
"files.hideIgnored": "Hide ignored items",
|
|
2039
|
+
"files.pin": "Pin",
|
|
2040
|
+
"files.ignoredGitInternalTip": "{path} (internal git metadata, hidden by default)",
|
|
2041
|
+
"files.ignoredByRulesTip": "{path} (ignored by .gitignore/.aitignore)",
|
|
1728
2042
|
"git.branchPanelTitle": "Branch panel (branch / tag / stash)",
|
|
1729
2043
|
"git.pushTitle": "Push commits",
|
|
1730
2044
|
"git.pullTitle": "Pull (ff-only)",
|
|
@@ -1762,7 +2076,9 @@ const COMPONENT_DICT = {
|
|
|
1762
2076
|
"git.stageTitle": "Stage",
|
|
1763
2077
|
"git.unstageTitle": "Unstage",
|
|
1764
2078
|
"git.discardTitle": "Discard changes",
|
|
1765
|
-
|
|
2079
|
+
// 已跟踪文件(引擎 discard = checkout 恢复到上次提交;untracked 由客户端分流到回收站,走下方专属文案)
|
|
2080
|
+
"git.discardConfirm": "Discard ALL uncommitted changes of {path}? (tracked files restore to the last commit)",
|
|
2081
|
+
"git.discardUntrackedConfirm": "Move the untracked file to the trash? (restorable from the trash)",
|
|
1766
2082
|
"git.diffTitle": "View diff (git-review)",
|
|
1767
2083
|
"git.changesToggle": "Toggle changed-files section",
|
|
1768
2084
|
"git.planRetry": "Retry remaining groups"
|
|
@@ -1779,6 +2095,11 @@ const COMPONENT_DICT = {
|
|
|
1779
2095
|
"sidebar.filterProjects": "筛选项目…",
|
|
1780
2096
|
"sidebar.noMatchingProjects": "没有匹配的项目",
|
|
1781
2097
|
"sidebar.useDefaultDirectory": "使用默认目录",
|
|
2098
|
+
"files.showIgnored": "显示忽略项",
|
|
2099
|
+
"files.hideIgnored": "隐藏被忽略项",
|
|
2100
|
+
"files.pin": "钉住",
|
|
2101
|
+
"files.ignoredGitInternalTip": "{path}(git 仓库内部,默认隐藏)",
|
|
2102
|
+
"files.ignoredByRulesTip": "{path}(已被 .gitignore/.aitignore 忽略)",
|
|
1782
2103
|
"git.branchPanelTitle": "分支面板(分支 / tag / stash)",
|
|
1783
2104
|
"git.pushTitle": "推送提交",
|
|
1784
2105
|
"git.pullTitle": "拉取(ff-only)",
|
|
@@ -1816,7 +2137,9 @@ const COMPONENT_DICT = {
|
|
|
1816
2137
|
"git.stageTitle": "暂存",
|
|
1817
2138
|
"git.unstageTitle": "取消暂存",
|
|
1818
2139
|
"git.discardTitle": "丢弃变更",
|
|
1819
|
-
|
|
2140
|
+
// 已跟踪文件(引擎 discard = checkout 恢复到上次提交;untracked 由客户端分流到回收站,走下方专属文案)
|
|
2141
|
+
"git.discardConfirm": "丢弃 {path} 的全部未提交改动?(已跟踪文件将恢复到上次提交)",
|
|
2142
|
+
"git.discardUntrackedConfirm": "将未跟踪文件移入回收站?(可在回收站还原)",
|
|
1820
2143
|
"git.diffTitle": "查看 diff(git-review)",
|
|
1821
2144
|
"git.changesToggle": "开/合变更文件区",
|
|
1822
2145
|
"git.planRetry": "重试剩余组"
|
|
@@ -1956,7 +2279,8 @@ function WorkspaceDropdown({ selected, onSelect, onClose, align = "left", showUs
|
|
|
1956
2279
|
if (m.height > below && above > below) top = a.top - gap - m.height;
|
|
1957
2280
|
const c2 = clampToViewport(left, top, m.width, m.height, pad);
|
|
1958
2281
|
const o = fixedOrigin(el);
|
|
1959
|
-
const
|
|
2282
|
+
const z = zoomFactorOf(el);
|
|
2283
|
+
const next = { left: (c2.left - o.x) / z, top: (c2.top - o.y) / z, width: m.width };
|
|
1960
2284
|
setPos((cur) => cur && cur.left === next.left && cur.top === next.top && cur.width === next.width ? cur : next);
|
|
1961
2285
|
});
|
|
1962
2286
|
useEffect(() => {
|
|
@@ -3015,6 +3339,23 @@ function ReviewApp({ onClose, init, onExitToList }) {
|
|
|
3015
3339
|
const [busy, setBusy] = useState(true);
|
|
3016
3340
|
const [err, setErr] = useState("");
|
|
3017
3341
|
const [view, setView] = useState(() => window.matchMedia(SMALL_MQ).matches ? "inline" : "side");
|
|
3342
|
+
const [outlineOpen, setOutlineOpen] = useState(() => {
|
|
3343
|
+
try {
|
|
3344
|
+
return localStorage.getItem("aiti-git-review.outline") === "1";
|
|
3345
|
+
} catch {
|
|
3346
|
+
return false;
|
|
3347
|
+
}
|
|
3348
|
+
});
|
|
3349
|
+
const toggleOutline = () => {
|
|
3350
|
+
setOutlineOpen((on) => {
|
|
3351
|
+
const next = !on;
|
|
3352
|
+
try {
|
|
3353
|
+
localStorage.setItem("aiti-git-review.outline", next ? "1" : "0");
|
|
3354
|
+
} catch {
|
|
3355
|
+
}
|
|
3356
|
+
return next;
|
|
3357
|
+
});
|
|
3358
|
+
};
|
|
3018
3359
|
const viewTouchedRef = useRef(false);
|
|
3019
3360
|
const setViewUser = (v) => {
|
|
3020
3361
|
viewTouchedRef.current = true;
|
|
@@ -3077,7 +3418,7 @@ function ReviewApp({ onClose, init, onExitToList }) {
|
|
|
3077
3418
|
const showPanelRef = useRef(showPanel);
|
|
3078
3419
|
const widthBucketRef = useRef(widthBucket);
|
|
3079
3420
|
function restoreConfig(cfg, bucket, markTouched) {
|
|
3080
|
-
setView(cfg.view || "inline");
|
|
3421
|
+
setView(cfg.view === "outline" ? "inline" : cfg.view || "inline");
|
|
3081
3422
|
viewTouchedRef.current = true;
|
|
3082
3423
|
setShowFiles(cfg.showFiles !== false);
|
|
3083
3424
|
setShowDiff(cfg.showDiff !== false);
|
|
@@ -3945,10 +4286,11 @@ function ReviewApp({ onClose, init, onExitToList }) {
|
|
|
3945
4286
|
}
|
|
3946
4287
|
function jumpToHunk(hk) {
|
|
3947
4288
|
if (!hk) return;
|
|
3948
|
-
const line = hk.newStart || 1;
|
|
4289
|
+
const line = Math.max(1, hk.newStart || 1);
|
|
3949
4290
|
const ed = containerRef.current && containerRef.current._aitiGrEd;
|
|
4291
|
+
const target = ed && ed.getModifiedEditor ? ed.getModifiedEditor() : ed;
|
|
3950
4292
|
try {
|
|
3951
|
-
|
|
4293
|
+
target && target.revealPositionInCenter ? target.revealPositionInCenter({ lineNumber: line, column: 1 }, true) : null;
|
|
3952
4294
|
} catch {
|
|
3953
4295
|
}
|
|
3954
4296
|
}
|
|
@@ -4048,11 +4390,28 @@ function ReviewApp({ onClose, init, onExitToList }) {
|
|
|
4048
4390
|
children: [
|
|
4049
4391
|
/* @__PURE__ */ jsx("option", { value: "side", children: "并排" }, "side"),
|
|
4050
4392
|
/* @__PURE__ */ jsx("option", { value: "inline", children: "合并" }, "inline"),
|
|
4051
|
-
/* @__PURE__ */ jsx("option", { value: "current", children: "纯新" }, "current")
|
|
4052
|
-
/* @__PURE__ */ jsx("option", { value: "outline", children: "大纲" }, "outline")
|
|
4393
|
+
/* @__PURE__ */ jsx("option", { value: "current", children: "纯新" }, "current")
|
|
4053
4394
|
]
|
|
4054
4395
|
}
|
|
4055
4396
|
),
|
|
4397
|
+
(isMobile ? mobilePane === "diff" : showDiff) && diff && /* @__PURE__ */ jsx(
|
|
4398
|
+
"button",
|
|
4399
|
+
{
|
|
4400
|
+
onClick: toggleOutline,
|
|
4401
|
+
"aria-pressed": outlineOpen,
|
|
4402
|
+
title: (outlineOpen ? "隐藏变更大纲" : "显示变更大纲") + "(" + hunks.length + " 个变更区)",
|
|
4403
|
+
style: {
|
|
4404
|
+
...segBtn,
|
|
4405
|
+
fontSize: 13,
|
|
4406
|
+
lineHeight: 1,
|
|
4407
|
+
padding: "3px 7px",
|
|
4408
|
+
height: 26,
|
|
4409
|
+
background: outlineOpen ? "rgba(37,99,235,.10)" : "var(--bg,#fff)",
|
|
4410
|
+
color: "var(--text,#333)"
|
|
4411
|
+
},
|
|
4412
|
+
children: "☰"
|
|
4413
|
+
}
|
|
4414
|
+
),
|
|
4056
4415
|
isTrace && /* @__PURE__ */ jsx(
|
|
4057
4416
|
"button",
|
|
4058
4417
|
{
|
|
@@ -4202,8 +4561,19 @@ function ReviewApp({ onClose, init, onExitToList }) {
|
|
|
4202
4561
|
!diff && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", color: "var(--text-muted,#888)", fontSize: 13 }, children: curFile ? "加载 diff…" : "选择左侧文件查看变更" }),
|
|
4203
4562
|
diff && !edReady && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", color: "var(--text-muted,#888)", fontSize: 13, background: "var(--bg,#fff)", zIndex: 10 }, children: "正在加载编辑器…(首次稍慢)" }),
|
|
4204
4563
|
hunks.length === 0 && diff && /* @__PURE__ */ jsx("div", { style: { position: "absolute", top: 8, right: 8, color: "var(--warn, #f59e0b)", fontSize: 11, background: "var(--bg,#fff)", padding: "2px 8px", borderRadius: 6, border: "1px solid var(--border)" }, children: "无变更行(纯新/删除文件)" }),
|
|
4205
|
-
|
|
4206
|
-
/* @__PURE__ */
|
|
4564
|
+
outlineOpen && diff && /* @__PURE__ */ jsxs("div", { style: { position: "absolute", top: 6, right: 6, bottom: 6, width: "min(240px, 45vw)", overflowY: "auto", background: "var(--bg,#fff)", border: "1px solid var(--border,#ddd)", borderRadius: 8, boxShadow: "0 4px 16px rgba(0,0,0,.12)", zIndex: 20, padding: 6 }, children: [
|
|
4565
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 6, fontSize: 11, fontWeight: 700, color: "var(--text-dim,#888)", padding: "4px 6px" }, children: [
|
|
4566
|
+
/* @__PURE__ */ jsx("span", { children: "大纲 · " + hunks.length + " 个变更区" }),
|
|
4567
|
+
/* @__PURE__ */ jsx(
|
|
4568
|
+
"button",
|
|
4569
|
+
{
|
|
4570
|
+
onClick: toggleOutline,
|
|
4571
|
+
title: "隐藏变更大纲",
|
|
4572
|
+
style: { border: "none", background: "transparent", cursor: "pointer", color: "var(--text-dim,#888)", fontSize: 12, lineHeight: 1, padding: 2 },
|
|
4573
|
+
children: "✕"
|
|
4574
|
+
}
|
|
4575
|
+
)
|
|
4576
|
+
] }),
|
|
4207
4577
|
hunks.length === 0 && /* @__PURE__ */ jsx("div", { style: { color: "var(--text-muted,#999)", fontSize: 12, padding: 8 }, children: "纯新增/删除文件无 hunk(整文件变更)" }),
|
|
4208
4578
|
hunks.map((hk, i) => /* @__PURE__ */ jsxs(
|
|
4209
4579
|
"div",
|
|
@@ -4734,14 +5104,14 @@ function register(ctx) {
|
|
|
4734
5104
|
ctx.registerItems?.("toolbar", [{
|
|
4735
5105
|
id: "aiti-git-review-open",
|
|
4736
5106
|
meta: {
|
|
4737
|
-
label: "
|
|
4738
|
-
title: "
|
|
5107
|
+
label: "i18n:gr.app.label",
|
|
5108
|
+
title: "i18n:gr.app.title",
|
|
4739
5109
|
icon: "icons/eye.svg",
|
|
4740
5110
|
onClick: () => openFromToolbar()
|
|
4741
5111
|
}
|
|
4742
5112
|
}]);
|
|
4743
5113
|
ctx.registerItems?.("pages", [{ id: "aiti-git-review-page", render: ReviewWork }]);
|
|
4744
|
-
ctx.registerItems?.("rightFileDock", [{ id: "workspace", render: DockReviewWork, meta: { title: "
|
|
5114
|
+
ctx.registerItems?.("rightFileDock", [{ id: "workspace", render: DockReviewWork, meta: { title: "i18n:gr.workspace.label" } }]);
|
|
4745
5115
|
window.__aitiGitReviewOpen = (opts) => {
|
|
4746
5116
|
G.open = opts || {};
|
|
4747
5117
|
};
|
package/index.ts
CHANGED
|
@@ -718,7 +718,6 @@ function restoreBindings() {
|
|
|
718
718
|
export default {
|
|
719
719
|
id: "aiti-git-review",
|
|
720
720
|
name: "Git 代码审核",
|
|
721
|
-
version: "0.2.0",
|
|
722
721
|
icon: "icon.svg",
|
|
723
722
|
client: "dist/aiti-git-review-client.mjs",
|
|
724
723
|
|
|
@@ -732,12 +731,17 @@ export default {
|
|
|
732
731
|
ui: {
|
|
733
732
|
clientImmediately: false, // [懒加载 v2] M1 已同步生产,懒化重启用
|
|
734
733
|
toolbar: [
|
|
735
|
-
{ id: "aiti-git-review-open", label: "
|
|
734
|
+
{ id: "aiti-git-review-open", label: "i18n:gr.app.label", title: "i18n:gr.app.title", icon: "icons/eye.svg" },
|
|
736
735
|
],
|
|
737
736
|
dialogs: [{ id: "aiti-git-review-dialog", label: "aiti-git-review" }],
|
|
738
|
-
rightFileDock: [{ id: "workspace", label: "
|
|
737
|
+
rightFileDock: [{ id: "workspace", label: "i18n:gr.workspace.label" }],
|
|
739
738
|
i18n: {
|
|
740
739
|
en: {
|
|
740
|
+
"ext.displayName": "Git Review",
|
|
741
|
+
"ext.description": "Lists review-task changesets (files + status) for AI familiarization. Param: taskId (defaults to the session-bound task).",
|
|
742
|
+
"gr.app.label": "Review",
|
|
743
|
+
"gr.app.title": "aiti-git-review: review changes (uncommitted / baseline / two-ref diff)",
|
|
744
|
+
"gr.workspace.label": "Review",
|
|
741
745
|
"gr.title": "Git Code Review",
|
|
742
746
|
"gr.picker.new": "New review",
|
|
743
747
|
"gr.picker.selectFiles": "Select files",
|
|
@@ -781,6 +785,9 @@ export default {
|
|
|
781
785
|
"gr.tabs.summary": "Summary",
|
|
782
786
|
},
|
|
783
787
|
"zh-CN": {
|
|
788
|
+
"ext.displayName": "Git 代码审核", "gr.app.label": "审核",
|
|
789
|
+
"gr.app.title": "aiti-git-review:审核变更(未提交 / 指定基线 / 两版本对比)",
|
|
790
|
+
"gr.workspace.label": "审查",
|
|
784
791
|
"gr.title": "Git 代码审核",
|
|
785
792
|
"gr.picker.new": "新建审查",
|
|
786
793
|
"gr.picker.selectFiles": "选文件",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiti-ai/aiti-git-review",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Dedicated to reviewing uncommitted changes — Monaco diff workspace (side-by-side/merged/new-only/outline) + line-level annotations (must/suggest/question) + anchor flag-line re-mapping (stays valid while editing mid-review) + summary final-review ",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build:client": "vite build --config vite.config.ts",
|
|
8
8
|
"watch": "vite build --watch --config vite.config.ts",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"aitiExtProtocol": "1.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aiti-ai/ext-shared": "^0.1.
|
|
22
|
+
"@aiti-ai/ext-shared": "^0.1.12"
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
|
-
"contentHash": "
|
|
25
|
+
"contentHash": "4375a3317c9213b1",
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
28
|
"url": "git+https://github.com/aiti-ai/aiti-ai.git",
|
package/tools/build-client.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* 用法:node tools/build-client.mjs (或 npm run watch 自动重建)
|
|
7
7
|
*/
|
|
8
8
|
import { spawnSync } from "node:child_process";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
9
10
|
import { resolve } from "node:path";
|
|
10
11
|
import { fileURLToPath } from "node:url";
|
|
11
12
|
import { existsSync } from "node:fs";
|
|
@@ -13,7 +14,7 @@ import { existsSync } from "node:fs";
|
|
|
13
14
|
const root = resolve(fileURLToPath(new URL("..", import.meta.url)));
|
|
14
15
|
|
|
15
16
|
const viteJs = resolve(root, "node_modules", "vite", "bin", "vite.js");
|
|
16
|
-
const viteBin = existsSync(viteJs) ? viteJs : "vite";
|
|
17
|
+
const viteBin = existsSync(viteJs) ? viteJs : resolve(createRequire(import.meta.url).resolve("vite/package.json"), "..", "bin", "vite.js");
|
|
17
18
|
|
|
18
19
|
const r = spawnSync(process.execPath, [viteBin, "build", "--config", resolve(root, "vite.config.ts")], {
|
|
19
20
|
cwd: root,
|