@laoyuehanni/dsh-git-worktree 0.4.8 → 0.4.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 +5 -2
- package/README.zh.md +5 -2
- package/lib/client.js +2393 -205
- package/lib/git.d.ts +58 -11
- package/lib/git.js +197 -17
- package/lib/graph-preview/asciidoc-xKuVlNk6.js +5 -0
- package/lib/graph-preview/bat-Dx8nnxXE.js +5 -0
- package/lib/graph-preview/bibtex-BzgdqG3s.js +5 -0
- package/lib/graph-preview/c-BGpbtv2-.js +8 -0
- package/lib/graph-preview/clojure-DDsQ0FaV.js +5 -0
- package/lib/graph-preview/cmake-DPsCB_V6.js +5 -0
- package/lib/graph-preview/cpp-CBYrHpV9.js +27 -0
- package/lib/graph-preview/csharp-CFKaLbHg.js +5 -0
- package/lib/graph-preview/css-C6zsnaz5.js +8 -0
- package/lib/graph-preview/csv-DqIVFkK7.js +5 -0
- package/lib/graph-preview/dart-C6DUdjib.js +5 -0
- package/lib/graph-preview/diff-Blb4MjsC.js +5 -0
- package/lib/graph-preview/dotenv-Dkdv7Sm2.js +5 -0
- package/lib/graph-preview/elixir-D0Gskj1z.js +8 -0
- package/lib/graph-preview/erlang-BJwlUj8s.js +8 -0
- package/lib/graph-preview/fish-D7qAeWQz.js +5 -0
- package/lib/graph-preview/fsharp-MCvH12ek.js +8 -0
- package/lib/graph-preview/go-aXtTCanQ.js +5 -0
- package/lib/graph-preview/graphql-DBbDUzBC.js +19 -0
- package/lib/graph-preview/groovy-Bw2Ku4bU.js +5 -0
- package/lib/graph-preview/haskell-CfGsE1Cf.js +5 -0
- package/lib/graph-preview/hcl-DHg_Osgo.js +5 -0
- package/lib/graph-preview/html-DwZ-9Aol.js +15 -0
- package/lib/graph-preview/html-derivative-CdrGiVx_.js +8 -0
- package/lib/graph-preview/http-B769neBI.js +16 -0
- package/lib/graph-preview/ini-C24lZfdM.js +5 -0
- package/lib/graph-preview/java-B6HH4GJL.js +8 -0
- package/lib/graph-preview/javascript-BXA9Hfas.js +5 -0
- package/lib/graph-preview/julia--d6L9eAJ.js +19 -0
- package/lib/graph-preview/kotlin-BHE8CoV9.js +5 -0
- package/lib/graph-preview/latex-BsyjE6iS.js +12 -0
- package/lib/graph-preview/less-BzbdhFUi.js +5 -0
- package/lib/graph-preview/log-Dad54gsi.js +5 -0
- package/lib/graph-preview/lua-DL6V31K-.js +10 -0
- package/lib/graph-preview/make-B2ukzWs3.js +5 -0
- package/lib/graph-preview/markdown-CkmxmzqY.js +5 -0
- package/lib/graph-preview/mdx-BK9ZufRc.js +5 -0
- package/lib/graph-preview/nix-BRl3YduB.js +9 -0
- package/lib/graph-preview/perl-DJHPR3L5.js +19 -0
- package/lib/graph-preview/php-B74oGaLi.js +21 -0
- package/lib/graph-preview/powershell-DvOBVZPr.js +5 -0
- package/lib/graph-preview/preview.js +79431 -0
- package/lib/graph-preview/proto-ClkOcAW0.js +5 -0
- package/lib/graph-preview/python-BjnOIxPe.js +5 -0
- package/lib/graph-preview/r-BSNufAtJ.js +8 -0
- package/lib/graph-preview/rst-CDCHc-qO.js +25 -0
- package/lib/graph-preview/ruby-Dx4dTqam.js +40 -0
- package/lib/graph-preview/rust-COBzcmTx.js +5 -0
- package/lib/graph-preview/scala-pMGZAs9j.js +5 -0
- package/lib/graph-preview/scss-D2N2uO1z.js +8 -0
- package/lib/graph-preview/sql-DBa5L-Wg.js +8 -0
- package/lib/graph-preview/svelte-DQXUqa3J.js +18 -0
- package/lib/graph-preview/swift-DWmMn3lF.js +5 -0
- package/lib/graph-preview/system-verilog-DW0KSMVO.js +5 -0
- package/lib/graph-preview/toml-B7BHZIqX.js +5 -0
- package/lib/graph-preview/vb-eGVhCUXq.js +5 -0
- package/lib/graph-preview/verilog-Ma7yBE30.js +5 -0
- package/lib/graph-preview/vue-k6e1qQTO.js +32 -0
- package/lib/graph-preview/xml-DUa-g8pJ.js +10 -0
- package/lib/graph-preview/yaml-B81N8prR.js +5 -0
- package/lib/history.d.ts +7 -0
- package/lib/history.js +79 -0
- package/lib/index.js +28 -4
- package/lib/progress.d.ts +60 -0
- package/lib/progress.js +122 -0
- package/lib/push.d.ts +27 -0
- package/lib/push.js +215 -0
- package/lib/routes.d.ts +48 -6
- package/lib/routes.js +149 -7
- package/lib/stream.d.ts +33 -0
- package/lib/stream.js +54 -0
- package/lib/wire.d.ts +131 -2
- package/lib/wire.js +18 -2
- package/package.json +12 -10
package/lib/client.js
CHANGED
|
@@ -59,6 +59,9 @@ window.__ModuleLoader__.load({
|
|
|
59
59
|
/** GET ROUTE_PREFIX/head?path=<absolute dir> — checked-out branch only.
|
|
60
60
|
* A file read of HEAD, not a git process. */
|
|
61
61
|
const ROUTE_HEAD = `${ROUTE_PREFIX}/head`;
|
|
62
|
+
/** Read-only POSTs: bounded history and one commit's full message/summary. */
|
|
63
|
+
const ROUTE_HISTORY = `${ROUTE_PREFIX}/history`;
|
|
64
|
+
const ROUTE_COMMIT = `${ROUTE_PREFIX}/commit`;
|
|
62
65
|
/** POST ROUTE_PREFIX/worktree — create-or-reuse a worktree for a branch. */
|
|
63
66
|
const ROUTE_WORKTREE = `${ROUTE_PREFIX}/worktree`;
|
|
64
67
|
/** POST ROUTE_PREFIX/switch — in-place branch switch of the main checkout. */
|
|
@@ -72,10 +75,21 @@ window.__ModuleLoader__.load({
|
|
|
72
75
|
/** POST ROUTE_PREFIX/branch-delete — delete a LOCAL branch (`-d`, merged
|
|
73
76
|
* only; git refuses the rest). */
|
|
74
77
|
const ROUTE_BRANCH_DELETE = `${ROUTE_PREFIX}/branch-delete`;
|
|
75
|
-
/** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune).
|
|
78
|
+
/** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune).
|
|
79
|
+
* Streams {@link SyncFrame} lines (NDJSON) so a long transfer can show progress. */
|
|
76
80
|
const ROUTE_FETCH = `${ROUTE_PREFIX}/fetch`;
|
|
77
|
-
/** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream.
|
|
81
|
+
/** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream.
|
|
82
|
+
* Streams {@link SyncFrame} lines (NDJSON), like {@link ROUTE_FETCH}. */
|
|
78
83
|
const ROUTE_UPDATE = `${ROUTE_PREFIX}/update`;
|
|
84
|
+
/** POST push-plan — resolve the selected branch's push destination. */
|
|
85
|
+
const ROUTE_PUSH_PLAN = `${ROUTE_PREFIX}/push-plan`;
|
|
86
|
+
/** POST push-preview — inspect one explicit destination without pushing. */
|
|
87
|
+
const ROUTE_PUSH_PREVIEW = `${ROUTE_PREFIX}/push-preview`;
|
|
88
|
+
/** POST push — push one explicit local branch. Streams {@link SyncFrame}
|
|
89
|
+
* lines (NDJSON), like {@link ROUTE_FETCH}; the `done` body is a
|
|
90
|
+
* {@link PushResult}. A cancel (499) kills `git push`; the remote only moves
|
|
91
|
+
* a ref once the whole pack has arrived, so a stopped transfer changes nothing. */
|
|
92
|
+
const ROUTE_PUSH = `${ROUTE_PREFIX}/push`;
|
|
79
93
|
/** POST ROUTE_PREFIX/inspect — pre-delete facts for one worktree directory. */
|
|
80
94
|
const ROUTE_INSPECT = `${ROUTE_PREFIX}/inspect`;
|
|
81
95
|
/** POST ROUTE_PREFIX/remove — delete one linked worktree (git registration + folder). */
|
|
@@ -90,6 +104,28 @@ window.__ModuleLoader__.load({
|
|
|
90
104
|
const ROUTE_PURGE = `${ROUTE_PREFIX}/purge`;
|
|
91
105
|
//#endregion
|
|
92
106
|
//#region src/client/api.ts
|
|
107
|
+
/** Read-only history requests can be cancelled when the user browses another branch. */
|
|
108
|
+
async function graphRead(url, body, signal) {
|
|
109
|
+
try {
|
|
110
|
+
return await readEnvelope(await fetch(url, {
|
|
111
|
+
method: "POST",
|
|
112
|
+
headers: { "content-type": "application/json" },
|
|
113
|
+
body: JSON.stringify(body),
|
|
114
|
+
signal,
|
|
115
|
+
cache: "no-store"
|
|
116
|
+
}));
|
|
117
|
+
} catch (cause) {
|
|
118
|
+
return {
|
|
119
|
+
ok: false,
|
|
120
|
+
error: cause instanceof Error ? cause.message : String(cause)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const fetchHistory = (body, signal) => graphRead(ROUTE_HISTORY, body, signal);
|
|
125
|
+
const fetchCommit = (repoPath, oid, signal) => graphRead(ROUTE_COMMIT, {
|
|
126
|
+
repoPath,
|
|
127
|
+
oid
|
|
128
|
+
}, signal);
|
|
93
129
|
/** POST one JSON body and parse the uniform envelope. */
|
|
94
130
|
async function post(url, body) {
|
|
95
131
|
return send("POST", url, body);
|
|
@@ -97,26 +133,94 @@ window.__ModuleLoader__.load({
|
|
|
97
133
|
/** Send one JSON body with any method and parse the uniform envelope. */
|
|
98
134
|
async function send(method, url, body) {
|
|
99
135
|
try {
|
|
100
|
-
|
|
136
|
+
return await readEnvelope(await fetch(url, {
|
|
101
137
|
method,
|
|
102
138
|
headers: { "content-type": "application/json" },
|
|
103
139
|
body: JSON.stringify(body)
|
|
140
|
+
}));
|
|
141
|
+
} catch (cause) {
|
|
142
|
+
return {
|
|
143
|
+
ok: false,
|
|
144
|
+
error: cause instanceof Error ? cause.message : String(cause)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** Parse one whole-body JSON response into the uniform envelope. */
|
|
149
|
+
async function readEnvelope(response) {
|
|
150
|
+
let payload;
|
|
151
|
+
try {
|
|
152
|
+
payload = await response.json();
|
|
153
|
+
} catch {
|
|
154
|
+
return {
|
|
155
|
+
ok: false,
|
|
156
|
+
error: `HTTP ${String(response.status)}`
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (!response.ok) return {
|
|
160
|
+
ok: false,
|
|
161
|
+
error: payload.error ?? `HTTP ${String(response.status)}`
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
...payload,
|
|
165
|
+
ok: true
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/** The text a stream cut short (host restart, dropped connection) reports. */
|
|
169
|
+
const STREAM_CUT = "Connection closed before the operation finished";
|
|
170
|
+
/**
|
|
171
|
+
* POST one JSON body to a streamed route (NDJSON of {@link SyncFrame}s) and
|
|
172
|
+
* resolve with what the route would have answered in one piece, taken from
|
|
173
|
+
* the closing `done` frame. A response that is not a stream — a body-level
|
|
174
|
+
* 400, or a host build that predates streaming and answers plain JSON — is
|
|
175
|
+
* read as the ordinary envelope, so both ends upgrade independently.
|
|
176
|
+
* @param url - the streamed route.
|
|
177
|
+
* @param body - JSON request body.
|
|
178
|
+
* @param live - progress listener and cancellation signal.
|
|
179
|
+
*/
|
|
180
|
+
async function postStream(url, body, live = {}) {
|
|
181
|
+
try {
|
|
182
|
+
const response = await fetch(url, {
|
|
183
|
+
method: "POST",
|
|
184
|
+
headers: { "content-type": "application/json" },
|
|
185
|
+
body: JSON.stringify(body),
|
|
186
|
+
...live.signal === void 0 ? {} : { signal: live.signal }
|
|
104
187
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
188
|
+
if (response.body === null || !(response.headers.get("content-type") ?? "").includes("application/x-ndjson")) return await readEnvelope(response);
|
|
189
|
+
const reader = response.body.getReader();
|
|
190
|
+
const decoder = new TextDecoder();
|
|
191
|
+
let pending = "";
|
|
192
|
+
const closing = {};
|
|
193
|
+
const take = (line) => {
|
|
194
|
+
if (line.trim() === "") return;
|
|
195
|
+
let frame;
|
|
196
|
+
try {
|
|
197
|
+
frame = JSON.parse(line);
|
|
198
|
+
} catch {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (frame.type === "done") closing.frame = frame;
|
|
202
|
+
else live.onEvent?.(frame);
|
|
203
|
+
};
|
|
204
|
+
for (;;) {
|
|
205
|
+
const chunk = await reader.read();
|
|
206
|
+
if (chunk.done) break;
|
|
207
|
+
pending += decoder.decode(chunk.value, { stream: true });
|
|
208
|
+
const lines = pending.split("\n");
|
|
209
|
+
pending = lines.pop() ?? "";
|
|
210
|
+
lines.forEach(take);
|
|
113
211
|
}
|
|
114
|
-
|
|
212
|
+
take(pending + decoder.decode());
|
|
213
|
+
const done = closing.frame;
|
|
214
|
+
if (done === void 0) return {
|
|
115
215
|
ok: false,
|
|
116
|
-
error:
|
|
216
|
+
error: STREAM_CUT
|
|
217
|
+
};
|
|
218
|
+
if (done.status < 200 || done.status >= 300) return {
|
|
219
|
+
ok: false,
|
|
220
|
+
error: done.body?.error ?? `HTTP ${String(done.status)}`
|
|
117
221
|
};
|
|
118
222
|
return {
|
|
119
|
-
...
|
|
223
|
+
...done.body,
|
|
120
224
|
ok: true
|
|
121
225
|
};
|
|
122
226
|
} catch (cause) {
|
|
@@ -263,17 +367,37 @@ window.__ModuleLoader__.load({
|
|
|
263
367
|
/**
|
|
264
368
|
* Sync remote-tracking refs (fetch every remote + prune) for the repository.
|
|
265
369
|
* @param repoPath - absolute directory inside the repository.
|
|
370
|
+
* @param live - progress listener and cancellation signal.
|
|
266
371
|
*/
|
|
267
|
-
function requestFetch(repoPath) {
|
|
268
|
-
return
|
|
372
|
+
function requestFetch(repoPath, live) {
|
|
373
|
+
return postStream(ROUTE_FETCH, { repoPath }, live);
|
|
269
374
|
}
|
|
270
375
|
/**
|
|
271
376
|
* Update the CURRENT checkout: fetch every remote, then fast-forward the
|
|
272
377
|
* checked-out branch to its upstream.
|
|
273
378
|
* @param repoPath - absolute directory whose checked-out branch is updated.
|
|
379
|
+
* @param live - progress listener and cancellation signal.
|
|
274
380
|
*/
|
|
275
|
-
function requestUpdate(repoPath) {
|
|
276
|
-
return
|
|
381
|
+
function requestUpdate(repoPath, live) {
|
|
382
|
+
return postStream(ROUTE_UPDATE, { repoPath }, live);
|
|
383
|
+
}
|
|
384
|
+
function requestPushPlan(repoPath, branch) {
|
|
385
|
+
return post(ROUTE_PUSH_PLAN, {
|
|
386
|
+
repoPath,
|
|
387
|
+
branch
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
function requestPushPreview(body) {
|
|
391
|
+
return post(ROUTE_PUSH_PREVIEW, body);
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Push one branch: streamed, so a long upload reports git's progress and can
|
|
395
|
+
* be cancelled by aborting.
|
|
396
|
+
* @param body - what to push and where.
|
|
397
|
+
* @param live - progress listener and cancellation signal.
|
|
398
|
+
*/
|
|
399
|
+
function requestPush(body, live) {
|
|
400
|
+
return postStream(ROUTE_PUSH, body, live);
|
|
277
401
|
}
|
|
278
402
|
/**
|
|
279
403
|
* Pre-delete facts for one worktree directory: the uncommitted-file count
|
|
@@ -456,6 +580,697 @@ window.__ModuleLoader__.load({
|
|
|
456
580
|
};
|
|
457
581
|
}
|
|
458
582
|
//#endregion
|
|
583
|
+
//#region src/client/push-error.ts
|
|
584
|
+
/** Ordered: the most specific cause wins when several markers appear. */
|
|
585
|
+
const MARKERS$1 = [
|
|
586
|
+
["stale", /\(stale info\)/i],
|
|
587
|
+
["hook", /\bpre-push hook\b/i],
|
|
588
|
+
["refused", /\[remote rejected\]|remote: error: |pre-receive hook declined|protected branch/i],
|
|
589
|
+
["behind", /\((?:non-fast-forward|fetch first)\)|\bnon-fast-forward\b|\bfetch first\b|tip of your current branch is behind/i],
|
|
590
|
+
["auth", /authentication failed|could not read (?:username|password)|terminal prompts disabled|permission denied \(publickey|host key verification failed|access denied|invalid credentials/i]
|
|
591
|
+
];
|
|
592
|
+
/** git's trailer on a rejected push. It names no rule and no hook. */
|
|
593
|
+
const PUSH_TRAILER = /^error: failed to push some refs\b/i;
|
|
594
|
+
/**
|
|
595
|
+
* What git itself said, without the `git <args…> failed (exit N): ` preamble.
|
|
596
|
+
*
|
|
597
|
+
* The push command line (`-c remote.x.mirror=false push --porcelain …`) is
|
|
598
|
+
* long and pushes the remote's own wording (the one line that names a
|
|
599
|
+
* protected branch or a failing hook) out of a short scrolling box. The
|
|
600
|
+
* trailer `error: failed to push some refs to '<url>'` is dropped once any
|
|
601
|
+
* other line says why; a failure that is only that trailer keeps it.
|
|
602
|
+
* @param raw - the error text returned by the push route.
|
|
603
|
+
* @returns git's output, or `raw` unchanged when it is not a git failure.
|
|
604
|
+
*/
|
|
605
|
+
function gitOutput(raw) {
|
|
606
|
+
const output = /^git [\s\S]*?failed \(exit \d+\):\s*([\s\S]*)$/.exec(raw)?.[1];
|
|
607
|
+
const text = output === void 0 || output === "" ? raw : output;
|
|
608
|
+
const lines = text.split(/\r?\n/);
|
|
609
|
+
const kept = lines.filter((line) => !PUSH_TRAILER.test(line.trim()));
|
|
610
|
+
if (kept.length === lines.length || kept.every((line) => line.trim() === "")) return text;
|
|
611
|
+
return kept.join("\n").replace(/^\n+|\n+$/g, "");
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Whether git's own text is worth showing beneath the explanation.
|
|
615
|
+
*
|
|
616
|
+
* `behind` and `stale` are fully explained by one sentence that also names the
|
|
617
|
+
* next step; git's side of it is only `hint: … git pull …` boilerplate. A
|
|
618
|
+
* refusal or credential failure is different: the remote's wording names the
|
|
619
|
+
* rule, hook or host that said no, which no fixed sentence can.
|
|
620
|
+
* @param kind - a recognised cause.
|
|
621
|
+
* @returns true when the text adds information.
|
|
622
|
+
*/
|
|
623
|
+
function showsGitOutput(kind) {
|
|
624
|
+
return kind !== "behind" && kind !== "stale";
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Classify a push failure.
|
|
628
|
+
* @param raw - the error text returned by the push route.
|
|
629
|
+
* @returns the recognised cause, or null for anything else (shown verbatim).
|
|
630
|
+
*/
|
|
631
|
+
function classifyPushFailure(raw) {
|
|
632
|
+
for (const [kind, pattern] of MARKERS$1) if (pattern.test(raw)) return kind;
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\PushDialog.module.css?inline
|
|
637
|
+
const css$5 = ".dialog_1212074589 {\n width: min(420px, 100%);\n max-height: 100%;\n gap: 0;\n padding: 0;\n overflow: visible;\n border-radius: var(--dsw-radius-xl, 20px);\n font-size: 13px;\n line-height: 20px;\n}\n.header_1212074589 { display: flex; align-items: center; gap: 8px; padding: 14px 12px 10px 16px; }\n.header_1212074589 h2 { flex: 1; min-width: 0; margin: 0; font-size: 15px; line-height: 24px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.header_1212074589 h2 span { color: var(--dsw-alias-label-secondary); font-weight: 400; }\n.close_1212074589, .refresh_1212074589 { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--dsw-radius-sm); background: transparent; color: var(--dsw-alias-label-tertiary); cursor: pointer; }\n.close_1212074589:hover:not(:disabled), .refresh_1212074589:hover:not(:disabled), .textButton_1212074589:hover:not(:disabled), .scope_1212074589:hover:not(:disabled), .editorClose_1212074589:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.body_1212074589 { padding: 0 12px; min-height: 0; }\n.mapping_1212074589 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 34px; padding: 3px 10px; border-radius: var(--dsw-radius-md); background: var(--dsw-alias-interactive-bg-hover); }\n.mapping_1212074589 > svg { flex: none; color: var(--dsw-alias-label-secondary); }\n/* The branch being pushed may be long; give it up to half the row (the target keeps its own cap). */\n.source_1212074589 { min-width: 0; max-width: min(200px, 50%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.arrow_1212074589 { color: var(--dsw-alias-label-tertiary); }\n.destination_1212074589 { display: inline-flex; align-items: center; gap: 3px; min-width: 0; max-width: 100%; }\n.remote_1212074589 { color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }\n.textButton_1212074589, .scope_1212074589 { display: inline-flex; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: var(--dsw-radius-xs); padding: 2px 4px; background: transparent; color: var(--dsw-alias-link); font: inherit; cursor: pointer; max-width: 100%; }\n.chevron_1212074589 { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }\n.targetWrap_1212074589 { position: relative; min-width: 0; max-width: 180px; }\n.targetName_1212074589 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.badge_1212074589 { font-size: 11px; line-height: 18px; padding: 0 5px; border-radius: var(--dsw-radius-xs); background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-secondary); }\n.editor_1212074589 { position: absolute; z-index: 5; top: calc(100% + 5px); left: 0; width: 200px; max-width: calc(100vw - 64px); padding: 10px; border: .5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-lg); background: var(--dsw-alias-bg-layer-2); box-shadow: var(--dsw-elevation-prominent); }\n/* Near the dialog's right edge the editor lines up with the name's right edge instead. */\n.editorEnd_1212074589 { left: auto; right: 0; }\n.editorHead_1212074589 { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 5px; }\n.editor_1212074589 label { display: block; font-size: 11px; color: var(--dsw-alias-label-tertiary); }\n.editorClose_1212074589 { display: grid; place-items: center; width: 20px; height: 20px; flex: none; margin: -3px -4px 0 0; padding: 0; border: 0; border-radius: var(--dsw-radius-xs); background: transparent; color: var(--dsw-alias-label-tertiary); cursor: pointer; }\n.editor_1212074589 input { box-sizing: border-box; width: 100%; padding: 5px 7px; font: inherit; border: .5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }\n.editor_1212074589 input[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n.commits_1212074589 { padding: 8px 10px 12px; min-height: 96px; }\n.count_1212074589 { font-size: 11px; color: var(--dsw-alias-label-tertiary); margin-bottom: 6px; }\n.previewStatus_1212074589 { margin-left: 8px; }\n.list_1212074589 { list-style: none; margin: 0; padding: 0 5px 0 0; max-height: min(168px, 28vh); overflow-y: auto; overscroll-behavior: contain; }\n.list_1212074589 li { display: flex; align-items: center; gap: 8px; min-height: 28px; }\n.list_1212074589 svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--dsw-alias-label-tertiary); stroke-width: 1.5; }\n.list_1212074589 li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.empty_1212074589 { display: grid; place-items: center; min-height: 60px; margin: 0; font-size: 12px; color: var(--dsw-alias-label-tertiary); }\n.hint_1212074589 { margin: 6px 0 0; font-size: 11px; line-height: 17px; color: var(--dsw-alias-label-tertiary); }\n.error_1212074589 { max-height: 120px; margin-bottom: 8px; overflow: auto; font-size: 12px; color: var(--dsw-alias-state-error-primary); overflow-wrap: anywhere; }\n/* A recognised cause leads in plain words; git's own text stays below it, quieter. */\n.errorSummary_1212074589 { margin: 0 0 4px; font-weight: 500; }\n.errorSummary_1212074589:last-child { margin-bottom: 0; }\n.errorDetail_1212074589 { max-height: 64px; overflow: auto; font-size: 11px; line-height: 16px; white-space: pre-wrap; color: var(--dsw-alias-label-secondary); }\n.footer_1212074589 { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 0 16px; padding: 12px 0 14px; border-top: .5px solid var(--dsw-alias-border-l2); }\n.tagOptions_1212074589 { display: flex; align-items: center; gap: 4px; min-width: 0; }\n.checkbox_1212074589 { display: flex; align-items: center; gap: 7px; font-size: 12px; white-space: nowrap; color: var(--dsw-alias-label-secondary); cursor: pointer; }\n.checkbox_1212074589 input { appearance: none; margin: 0; width: 14px; height: 14px; border: 1px solid var(--dsw-alias-label-tertiary); border-radius: var(--dsw-radius-xs); display: grid; place-content: center; cursor: pointer; }\n.checkbox_1212074589 input:checked { background: var(--dsw-alias-button-primary-fill); border-color: var(--dsw-alias-button-primary-fill); }\n.checkbox_1212074589 input:checked::after { content: ''; width: 6px; height: 3px; border: solid var(--dsw-alias-label-primary-foreground); border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg) translateY(-1px); }\n.scope_1212074589 { color: var(--dsw-alias-label-secondary); font-size: 12px; }\n.actions_1212074589 { display: flex; align-items: center; gap: 4px; margin-left: auto; }\n.split_1212074589 { display: flex; border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-button-primary-fill); color: var(--dsw-alias-label-primary-foreground); }\n.push_1212074589, .splitArrow_1212074589 { height: 28px; padding: 0 10px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; white-space: nowrap; cursor: pointer; }\n.push_1212074589 { min-width: 56px; border-radius: var(--dsw-radius-sm) 0 0 var(--dsw-radius-sm); }\n.splitArrow_1212074589 { position: relative; display: grid; place-items: center; width: 27px; padding: 0; border-radius: 0 var(--dsw-radius-sm) var(--dsw-radius-sm) 0; }\n.splitArrow_1212074589::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; border-left: 1px solid currentColor; opacity: .18; }\n.push_1212074589:hover:not(:disabled), .splitArrow_1212074589:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-active); }\n.dialog_1212074589 button:disabled, .dialog_1212074589 input:disabled { opacity: .4; cursor: not-allowed; }\n/* Keyboard focus ring, spelled out like the plugin's other dialogs rather\n * than left to the host's global reset. */\n.close_1212074589:focus-visible, .refresh_1212074589:focus-visible, .textButton_1212074589:focus-visible, .scope_1212074589:focus-visible, .editorClose_1212074589:focus-visible,\n.push_1212074589:focus-visible, .splitArrow_1212074589:focus-visible, .checkbox_1212074589 input:focus-visible, .list_1212074589:focus-visible, .editor_1212074589 input:focus-visible {\n outline: 2px solid var(--dsw-alias-brand-primary);\n outline-offset: -2px;\n}\n@media (max-height: 450px) { .list_1212074589 { max-height: 70px; } .header_1212074589 { padding-top: 8px; padding-bottom: 6px; } .commits_1212074589 { min-height: 65px; } .footer_1212074589 { padding-block: 8px; } }\n";
|
|
638
|
+
const tagId$5 = "@laoyuehanni/dsh-git-worktree/PushDialog.module.css";
|
|
639
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$5 + "\"]") === null) {
|
|
640
|
+
const tag = document.createElement("style");
|
|
641
|
+
tag.dataset.plugin = "@laoyuehanni/dsh-git-worktree";
|
|
642
|
+
tag.dataset.pluginCss = tagId$5;
|
|
643
|
+
tag.textContent = css$5;
|
|
644
|
+
document.head.appendChild(tag);
|
|
645
|
+
}
|
|
646
|
+
var PushDialog_module_default = {
|
|
647
|
+
"dialog": "dialog_1212074589",
|
|
648
|
+
"header": "header_1212074589",
|
|
649
|
+
"close": "close_1212074589",
|
|
650
|
+
"refresh": "refresh_1212074589",
|
|
651
|
+
"textButton": "textButton_1212074589",
|
|
652
|
+
"scope": "scope_1212074589",
|
|
653
|
+
"editorClose": "editorClose_1212074589",
|
|
654
|
+
"body": "body_1212074589",
|
|
655
|
+
"mapping": "mapping_1212074589",
|
|
656
|
+
"source": "source_1212074589",
|
|
657
|
+
"arrow": "arrow_1212074589",
|
|
658
|
+
"destination": "destination_1212074589",
|
|
659
|
+
"remote": "remote_1212074589",
|
|
660
|
+
"chevron": "chevron_1212074589",
|
|
661
|
+
"targetWrap": "targetWrap_1212074589",
|
|
662
|
+
"targetName": "targetName_1212074589",
|
|
663
|
+
"badge": "badge_1212074589",
|
|
664
|
+
"editor": "editor_1212074589",
|
|
665
|
+
"editorEnd": "editorEnd_1212074589",
|
|
666
|
+
"editorHead": "editorHead_1212074589",
|
|
667
|
+
"commits": "commits_1212074589",
|
|
668
|
+
"count": "count_1212074589",
|
|
669
|
+
"previewStatus": "previewStatus_1212074589",
|
|
670
|
+
"list": "list_1212074589",
|
|
671
|
+
"empty": "empty_1212074589",
|
|
672
|
+
"hint": "hint_1212074589",
|
|
673
|
+
"error": "error_1212074589",
|
|
674
|
+
"errorSummary": "errorSummary_1212074589",
|
|
675
|
+
"errorDetail": "errorDetail_1212074589",
|
|
676
|
+
"footer": "footer_1212074589",
|
|
677
|
+
"tagOptions": "tagOptions_1212074589",
|
|
678
|
+
"checkbox": "checkbox_1212074589",
|
|
679
|
+
"actions": "actions_1212074589",
|
|
680
|
+
"split": "split_1212074589",
|
|
681
|
+
"push": "push_1212074589",
|
|
682
|
+
"splitArrow": "splitArrow_1212074589"
|
|
683
|
+
};
|
|
684
|
+
//#endregion
|
|
685
|
+
//#region src/client/PushDialog.tsx
|
|
686
|
+
const FAILURE_KEYS = {
|
|
687
|
+
behind: "pushFailBehind",
|
|
688
|
+
stale: "pushFailStale",
|
|
689
|
+
hook: "pushFailHook",
|
|
690
|
+
refused: "pushFailRefused",
|
|
691
|
+
auth: "pushFailAuth"
|
|
692
|
+
};
|
|
693
|
+
function Chevron() {
|
|
694
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
695
|
+
"aria-hidden": "true",
|
|
696
|
+
viewBox: "0 0 16 16",
|
|
697
|
+
className: PushDialog_module_default.chevron,
|
|
698
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m4 6 4 4 4-4" })
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* The host Modal closes on a click of its mask, the same command as Escape.
|
|
703
|
+
* For a review in progress that is too easy to hit: one stray click beside
|
|
704
|
+
* the window would throw away the destination, the preview and any edit.
|
|
705
|
+
* This swallows only that click, found as the element right before the
|
|
706
|
+
* dialog card; Escape, the close button and Cancel still close. If the host
|
|
707
|
+
* ever changes its markup the mask simply closes the window again.
|
|
708
|
+
* @param event - the click, seen in the capture phase before the host does.
|
|
709
|
+
* @param anchor - any element inside the dialog card.
|
|
710
|
+
* @returns whether the click was on the mask and has been swallowed.
|
|
711
|
+
*/
|
|
712
|
+
function swallowMaskClick(event, anchor) {
|
|
713
|
+
const mask = anchor?.closest("[role=\"dialog\"]")?.previousElementSibling;
|
|
714
|
+
if (mask === void 0 || mask === null || event.target !== mask) return false;
|
|
715
|
+
event.stopPropagation();
|
|
716
|
+
return true;
|
|
717
|
+
}
|
|
718
|
+
/** Compact push review: the branch/target and footer stay outside the scrolling list. */
|
|
719
|
+
function PushDialog({ repoPath, repoName, branch, branchInfo, busy, resume, t, onClose, onPush }) {
|
|
720
|
+
const [plan, setPlan] = (0, react.useState)(null);
|
|
721
|
+
const [planError, setPlanError] = (0, react.useState)(null);
|
|
722
|
+
const [destination, setDestination] = (0, react.useState)(null);
|
|
723
|
+
const [previewState, setPreviewState] = (0, react.useState)(null);
|
|
724
|
+
const [localState, setLocalState] = (0, react.useState)(null);
|
|
725
|
+
const [retry, setRetry] = (0, react.useState)(0);
|
|
726
|
+
const [planRetry, setPlanRetry] = (0, react.useState)(0);
|
|
727
|
+
const [menu, setMenu] = (0, react.useState)(null);
|
|
728
|
+
const [editing, setEditing] = (0, react.useState)(false);
|
|
729
|
+
const [alignEnd, setAlignEnd] = (0, react.useState)(false);
|
|
730
|
+
const [draft, setDraft] = (0, react.useState)("");
|
|
731
|
+
const [tags, setTags] = (0, react.useState)(resume !== void 0 && resume.tags !== "none");
|
|
732
|
+
const [scope, setScope] = (0, react.useState)(resume?.tags === "follow" ? "follow" : "all");
|
|
733
|
+
const [pushError, setPushError] = (0, react.useState)(resume?.error ?? null);
|
|
734
|
+
const [sending, setSending] = (0, react.useState)(false);
|
|
735
|
+
const sendingRef = (0, react.useRef)(false);
|
|
736
|
+
/** The destination of the failed push, applied once, when the first plan
|
|
737
|
+
* arrives; every later plan (a refresh) is the repository's own again. */
|
|
738
|
+
const resumeDestination = (0, react.useRef)(resume === void 0 ? void 0 : {
|
|
739
|
+
remote: resume.remote,
|
|
740
|
+
target: resume.target
|
|
741
|
+
});
|
|
742
|
+
/** A destination whose local snapshot is already on screen: the next
|
|
743
|
+
* preview round for exactly that destination skips re-reading it. */
|
|
744
|
+
const keepLocalFor = (0, react.useRef)(null);
|
|
745
|
+
const anchor = (0, react.useRef)(null);
|
|
746
|
+
const mapping = (0, react.useRef)(null);
|
|
747
|
+
const editor = (0, react.useRef)(null);
|
|
748
|
+
const input = (0, react.useRef)(null);
|
|
749
|
+
const targetButton = (0, react.useRef)(null);
|
|
750
|
+
(0, react.useEffect)(() => {
|
|
751
|
+
let active = true;
|
|
752
|
+
setPlanError(null);
|
|
753
|
+
requestPushPlan(repoPath, branch).then((result) => {
|
|
754
|
+
if (!active) return;
|
|
755
|
+
if (!result.ok) {
|
|
756
|
+
setPlanError(result.error);
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
const planned = {
|
|
760
|
+
remote: result.remote,
|
|
761
|
+
target: result.target
|
|
762
|
+
};
|
|
763
|
+
const resumed = resumeDestination.current;
|
|
764
|
+
resumeDestination.current = void 0;
|
|
765
|
+
const next = resumed !== void 0 && result.remotes.includes(resumed.remote) && (resumed.remote !== planned.remote || resumed.target !== planned.target) ? resumed : planned;
|
|
766
|
+
setPlan(result);
|
|
767
|
+
if (result.local !== void 0 && next === planned) {
|
|
768
|
+
keepLocalFor.current = next;
|
|
769
|
+
setLocalState({
|
|
770
|
+
destination: next,
|
|
771
|
+
data: result.local
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
setDestination(next);
|
|
775
|
+
});
|
|
776
|
+
return () => {
|
|
777
|
+
active = false;
|
|
778
|
+
};
|
|
779
|
+
}, [
|
|
780
|
+
repoPath,
|
|
781
|
+
branch,
|
|
782
|
+
planRetry
|
|
783
|
+
]);
|
|
784
|
+
(0, react.useEffect)(() => {
|
|
785
|
+
if (destination === null) return;
|
|
786
|
+
let active = true;
|
|
787
|
+
setPreviewState({ destination });
|
|
788
|
+
if (keepLocalFor.current === destination) keepLocalFor.current = null;
|
|
789
|
+
else {
|
|
790
|
+
setLocalState(null);
|
|
791
|
+
requestPushPreview({
|
|
792
|
+
repoPath,
|
|
793
|
+
branch,
|
|
794
|
+
...destination,
|
|
795
|
+
localOnly: true
|
|
796
|
+
}).then((result) => {
|
|
797
|
+
if (active && result.ok) setLocalState({
|
|
798
|
+
destination,
|
|
799
|
+
data: result
|
|
800
|
+
});
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
requestPushPreview({
|
|
804
|
+
repoPath,
|
|
805
|
+
branch,
|
|
806
|
+
...destination
|
|
807
|
+
}).then((result) => {
|
|
808
|
+
if (!active) return;
|
|
809
|
+
setPreviewState(result.ok ? {
|
|
810
|
+
destination,
|
|
811
|
+
data: result
|
|
812
|
+
} : {
|
|
813
|
+
destination,
|
|
814
|
+
error: result.error
|
|
815
|
+
});
|
|
816
|
+
});
|
|
817
|
+
return () => {
|
|
818
|
+
active = false;
|
|
819
|
+
};
|
|
820
|
+
}, [
|
|
821
|
+
repoPath,
|
|
822
|
+
branch,
|
|
823
|
+
destination,
|
|
824
|
+
retry
|
|
825
|
+
]);
|
|
826
|
+
(0, react.useEffect)(() => {
|
|
827
|
+
if (!editing) return;
|
|
828
|
+
input.current?.focus();
|
|
829
|
+
input.current?.select();
|
|
830
|
+
}, [editing]);
|
|
831
|
+
(0, react.useLayoutEffect)(() => {
|
|
832
|
+
if (!editing) {
|
|
833
|
+
setAlignEnd(false);
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
const box = editor.current?.getBoundingClientRect();
|
|
837
|
+
const bound = mapping.current?.getBoundingClientRect();
|
|
838
|
+
if (box !== void 0 && bound !== void 0) setAlignEnd(box.right > bound.right + .5);
|
|
839
|
+
}, [editing]);
|
|
840
|
+
(0, react.useEffect)(() => {
|
|
841
|
+
const onClick = (event) => {
|
|
842
|
+
swallowMaskClick(event, anchor.current);
|
|
843
|
+
};
|
|
844
|
+
window.addEventListener("click", onClick, true);
|
|
845
|
+
return () => {
|
|
846
|
+
window.removeEventListener("click", onClick, true);
|
|
847
|
+
};
|
|
848
|
+
}, []);
|
|
849
|
+
const current = previewState?.destination === destination ? previewState : null;
|
|
850
|
+
const preview = current?.data;
|
|
851
|
+
const displayPreview = preview ?? (localState?.destination === destination ? localState.data : void 0);
|
|
852
|
+
const knownTotal = branchInfo?.kind === "local" && branchInfo.name === branch && branchInfo.upstream !== void 0 && !branchInfo.upstreamGone && (destination === null || branchInfo.upstream === `${destination.remote}/${destination.target}`) ? branchInfo.ahead ?? 0 : void 0;
|
|
853
|
+
const checking = destination !== null && preview === void 0 && current?.error === void 0 && planError === null;
|
|
854
|
+
const disabled = busy || sending;
|
|
855
|
+
const error = pushError ?? current?.error ?? planError;
|
|
856
|
+
const failure = error === null ? null : classifyPushFailure(error);
|
|
857
|
+
const canPush = !disabled && !editing && preview !== void 0 && destination !== null;
|
|
858
|
+
const nothingToPush = preview !== void 0 && preview.targetOid !== null && preview.total === 0 && !tags;
|
|
859
|
+
const pushTitle = !canPush && checking ? t("pushCheckingRemote") : nothingToPush ? t("pushEmpty") : void 0;
|
|
860
|
+
const draftIssue = branchNameIssue(draft.trim());
|
|
861
|
+
const commits = (n) => t(n === 1 ? "pushCommitCount.one" : "pushCommitCount.other", { n });
|
|
862
|
+
const close = () => {
|
|
863
|
+
if (!disabled && !sendingRef.current) onClose();
|
|
864
|
+
};
|
|
865
|
+
const refresh = () => {
|
|
866
|
+
if (disabled) return;
|
|
867
|
+
setPushError(null);
|
|
868
|
+
setPreviewState(null);
|
|
869
|
+
setLocalState(null);
|
|
870
|
+
keepLocalFor.current = null;
|
|
871
|
+
if (plan === null) setPlanRetry((value) => value + 1);
|
|
872
|
+
else setRetry((value) => value + 1);
|
|
873
|
+
};
|
|
874
|
+
/** A new object re-reads the destination from the remote, so an unchanged
|
|
875
|
+
* choice (same remote re-picked, same name re-applied) must not make one. */
|
|
876
|
+
const changeDestination = (next) => {
|
|
877
|
+
if (destination !== null && destination.remote === next.remote && destination.target === next.target) return;
|
|
878
|
+
setPushError(null);
|
|
879
|
+
setDestination(next);
|
|
880
|
+
};
|
|
881
|
+
const applyTarget = () => {
|
|
882
|
+
const target = draft.trim();
|
|
883
|
+
if (destination === null || branchNameIssue(target) !== null) return;
|
|
884
|
+
changeDestination({
|
|
885
|
+
...destination,
|
|
886
|
+
target
|
|
887
|
+
});
|
|
888
|
+
setEditing(false);
|
|
889
|
+
targetButton.current?.focus();
|
|
890
|
+
};
|
|
891
|
+
const closeEditor = () => {
|
|
892
|
+
setEditing(false);
|
|
893
|
+
targetButton.current?.focus();
|
|
894
|
+
};
|
|
895
|
+
const submit = async (force) => {
|
|
896
|
+
if (!canPush || sendingRef.current || preview === void 0 || destination === null) return;
|
|
897
|
+
sendingRef.current = true;
|
|
898
|
+
setSending(true);
|
|
899
|
+
setMenu(null);
|
|
900
|
+
setPushError(null);
|
|
901
|
+
try {
|
|
902
|
+
const failed = await onPush({
|
|
903
|
+
...destination,
|
|
904
|
+
tags: tags ? scope : "none",
|
|
905
|
+
force,
|
|
906
|
+
sourceOid: preview.sourceOid,
|
|
907
|
+
...force ? { expectedTarget: preview.targetOid ?? "" } : {}
|
|
908
|
+
});
|
|
909
|
+
if (failed !== void 0) {
|
|
910
|
+
setPushError(failed);
|
|
911
|
+
if (classifyPushFailure(failed) !== "auth") {
|
|
912
|
+
keepLocalFor.current = destination;
|
|
913
|
+
setRetry((value) => value + 1);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
} catch (cause) {
|
|
917
|
+
setPushError(cause instanceof Error ? cause.message : String(cause));
|
|
918
|
+
} finally {
|
|
919
|
+
sendingRef.current = false;
|
|
920
|
+
setSending(false);
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
924
|
+
open: true,
|
|
925
|
+
headless: true,
|
|
926
|
+
title: `${t("pushTitle")} · ${repoName}`,
|
|
927
|
+
onClose: close,
|
|
928
|
+
className: PushDialog_module_default.dialog ?? "",
|
|
929
|
+
onKeyDownCapture: (event) => {
|
|
930
|
+
if (event.key === "Escape" && editing) {
|
|
931
|
+
event.preventDefault();
|
|
932
|
+
event.stopPropagation();
|
|
933
|
+
closeEditor();
|
|
934
|
+
}
|
|
935
|
+
},
|
|
936
|
+
children: [
|
|
937
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
938
|
+
className: PushDialog_module_default.header,
|
|
939
|
+
ref: anchor,
|
|
940
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", { children: [
|
|
941
|
+
t("pushTitle"),
|
|
942
|
+
" ",
|
|
943
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: ["· ", repoName] })
|
|
944
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
945
|
+
type: "button",
|
|
946
|
+
className: PushDialog_module_default.close,
|
|
947
|
+
"aria-label": t("close"),
|
|
948
|
+
disabled,
|
|
949
|
+
onClick: close,
|
|
950
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 14 })
|
|
951
|
+
})]
|
|
952
|
+
}),
|
|
953
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
954
|
+
className: PushDialog_module_default.body,
|
|
955
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
956
|
+
className: PushDialog_module_default.mapping,
|
|
957
|
+
ref: mapping,
|
|
958
|
+
children: [
|
|
959
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { size: 14 }),
|
|
960
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
961
|
+
className: PushDialog_module_default.source,
|
|
962
|
+
title: branch,
|
|
963
|
+
children: branch
|
|
964
|
+
}),
|
|
965
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
966
|
+
className: PushDialog_module_default.arrow,
|
|
967
|
+
children: "→"
|
|
968
|
+
}),
|
|
969
|
+
destination !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
970
|
+
className: PushDialog_module_default.destination,
|
|
971
|
+
children: [
|
|
972
|
+
plan !== null && plan.remotes.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
973
|
+
open: menu === "remote",
|
|
974
|
+
dense: true,
|
|
975
|
+
portal: true,
|
|
976
|
+
autoFocus: true,
|
|
977
|
+
onClose: () => {
|
|
978
|
+
setMenu(null);
|
|
979
|
+
},
|
|
980
|
+
selectedId: destination.remote,
|
|
981
|
+
items: plan.remotes.map((remote) => ({
|
|
982
|
+
id: remote,
|
|
983
|
+
label: remote
|
|
984
|
+
})),
|
|
985
|
+
onSelect: (remote) => {
|
|
986
|
+
setMenu(null);
|
|
987
|
+
changeDestination({
|
|
988
|
+
...destination,
|
|
989
|
+
remote
|
|
990
|
+
});
|
|
991
|
+
},
|
|
992
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
993
|
+
type: "button",
|
|
994
|
+
className: PushDialog_module_default.textButton,
|
|
995
|
+
disabled: disabled || editing,
|
|
996
|
+
"aria-haspopup": "menu",
|
|
997
|
+
"aria-expanded": menu === "remote",
|
|
998
|
+
onClick: () => {
|
|
999
|
+
setMenu(menu === "remote" ? null : "remote");
|
|
1000
|
+
},
|
|
1001
|
+
children: [destination.remote, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {})]
|
|
1002
|
+
})
|
|
1003
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1004
|
+
className: PushDialog_module_default.remote,
|
|
1005
|
+
children: destination.remote
|
|
1006
|
+
}),
|
|
1007
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1008
|
+
className: PushDialog_module_default.arrow,
|
|
1009
|
+
children: ":"
|
|
1010
|
+
}),
|
|
1011
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1012
|
+
className: PushDialog_module_default.targetWrap,
|
|
1013
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1014
|
+
type: "button",
|
|
1015
|
+
ref: targetButton,
|
|
1016
|
+
className: PushDialog_module_default.textButton,
|
|
1017
|
+
disabled,
|
|
1018
|
+
title: t("pushEditTarget"),
|
|
1019
|
+
"aria-haspopup": "dialog",
|
|
1020
|
+
"aria-expanded": editing,
|
|
1021
|
+
onClick: () => {
|
|
1022
|
+
setMenu(null);
|
|
1023
|
+
setDraft(destination.target);
|
|
1024
|
+
setEditing((value) => !value);
|
|
1025
|
+
},
|
|
1026
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1027
|
+
className: PushDialog_module_default.targetName,
|
|
1028
|
+
title: destination.target,
|
|
1029
|
+
children: destination.target
|
|
1030
|
+
})
|
|
1031
|
+
}), editing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1032
|
+
className: `${PushDialog_module_default.editor} ${alignEnd ? PushDialog_module_default.editorEnd : ""}`,
|
|
1033
|
+
ref: editor,
|
|
1034
|
+
role: "dialog",
|
|
1035
|
+
"aria-label": t("pushEditTarget"),
|
|
1036
|
+
children: [
|
|
1037
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1038
|
+
className: PushDialog_module_default.editorHead,
|
|
1039
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1040
|
+
htmlFor: "git-worktree-push-target",
|
|
1041
|
+
children: t("pushBranch")
|
|
1042
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1043
|
+
type: "button",
|
|
1044
|
+
className: PushDialog_module_default.editorClose,
|
|
1045
|
+
"aria-label": t("pushEditTargetClose"),
|
|
1046
|
+
title: t("pushEditTargetClose"),
|
|
1047
|
+
onClick: closeEditor,
|
|
1048
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 12 })
|
|
1049
|
+
})]
|
|
1050
|
+
}),
|
|
1051
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1052
|
+
id: "git-worktree-push-target",
|
|
1053
|
+
ref: input,
|
|
1054
|
+
value: draft,
|
|
1055
|
+
spellCheck: false,
|
|
1056
|
+
autoComplete: "off",
|
|
1057
|
+
"aria-invalid": draftIssue !== null && draftIssue !== "empty",
|
|
1058
|
+
onChange: (event) => {
|
|
1059
|
+
setDraft(event.target.value);
|
|
1060
|
+
},
|
|
1061
|
+
onKeyDown: (event) => {
|
|
1062
|
+
if (event.key !== "Enter" || event.nativeEvent.isComposing) return;
|
|
1063
|
+
event.preventDefault();
|
|
1064
|
+
event.stopPropagation();
|
|
1065
|
+
applyTarget();
|
|
1066
|
+
}
|
|
1067
|
+
}),
|
|
1068
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1069
|
+
className: PushDialog_module_default.hint,
|
|
1070
|
+
children: draftIssue === null || draftIssue === "empty" ? t("pushApplyEnter") : t("menuNewBranchBad")
|
|
1071
|
+
})
|
|
1072
|
+
]
|
|
1073
|
+
})]
|
|
1074
|
+
})
|
|
1075
|
+
]
|
|
1076
|
+
}),
|
|
1077
|
+
preview?.targetOid === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1078
|
+
className: PushDialog_module_default.badge,
|
|
1079
|
+
children: t("pushNew")
|
|
1080
|
+
})
|
|
1081
|
+
]
|
|
1082
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1083
|
+
className: PushDialog_module_default.commits,
|
|
1084
|
+
"aria-busy": displayPreview === void 0 && error === null,
|
|
1085
|
+
children: [
|
|
1086
|
+
displayPreview === void 0 && knownTotal !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1087
|
+
className: PushDialog_module_default.count,
|
|
1088
|
+
children: [destination === null ? t(knownTotal === 1 ? "aheadTitle.one" : "aheadTitle.other", { n: knownTotal }) : commits(knownTotal), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1089
|
+
className: PushDialog_module_default.previewStatus,
|
|
1090
|
+
role: "status",
|
|
1091
|
+
children: t(error === null ? "pushReadingCommits" : "pushLocalUnverified")
|
|
1092
|
+
})]
|
|
1093
|
+
}),
|
|
1094
|
+
displayPreview === void 0 && knownTotal === void 0 && error === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1095
|
+
className: PushDialog_module_default.empty,
|
|
1096
|
+
role: "status",
|
|
1097
|
+
children: t(checking ? "pushCheckingRemote" : "pushPlanning")
|
|
1098
|
+
}),
|
|
1099
|
+
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1100
|
+
className: PushDialog_module_default.error,
|
|
1101
|
+
role: "alert",
|
|
1102
|
+
children: [failure !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1103
|
+
className: PushDialog_module_default.errorSummary,
|
|
1104
|
+
children: t(FAILURE_KEYS[failure])
|
|
1105
|
+
}), (failure === null || showsGitOutput(failure)) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1106
|
+
className: failure === null ? void 0 : PushDialog_module_default.errorDetail,
|
|
1107
|
+
children: gitOutput(error)
|
|
1108
|
+
})]
|
|
1109
|
+
}),
|
|
1110
|
+
displayPreview !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1111
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1112
|
+
className: PushDialog_module_default.count,
|
|
1113
|
+
children: [commits(displayPreview.total), preview === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1114
|
+
className: PushDialog_module_default.previewStatus,
|
|
1115
|
+
role: "status",
|
|
1116
|
+
children: t(checking ? "pushLocalChecking" : "pushLocalUnverified")
|
|
1117
|
+
})]
|
|
1118
|
+
}),
|
|
1119
|
+
displayPreview.commits.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1120
|
+
className: PushDialog_module_default.empty,
|
|
1121
|
+
children: t(preview === void 0 ? "pushLocalEmpty" : preview.targetOid === null ? "pushNewEmpty" : "pushEmpty")
|
|
1122
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1123
|
+
className: PushDialog_module_default.list,
|
|
1124
|
+
tabIndex: 0,
|
|
1125
|
+
"aria-label": t("pushCommitList"),
|
|
1126
|
+
children: displayPreview.commits.map((commit) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1127
|
+
viewBox: "0 0 16 16",
|
|
1128
|
+
"aria-hidden": "true",
|
|
1129
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M1 8h4m6 0h4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
1130
|
+
cx: "8",
|
|
1131
|
+
cy: "8",
|
|
1132
|
+
r: "3"
|
|
1133
|
+
})]
|
|
1134
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1135
|
+
title: commit.subject,
|
|
1136
|
+
children: commit.subject
|
|
1137
|
+
})] }, commit.oid))
|
|
1138
|
+
}),
|
|
1139
|
+
displayPreview.truncated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1140
|
+
className: PushDialog_module_default.hint,
|
|
1141
|
+
children: t("pushTruncated", { n: displayPreview.commits.length })
|
|
1142
|
+
})
|
|
1143
|
+
] })
|
|
1144
|
+
]
|
|
1145
|
+
})]
|
|
1146
|
+
}),
|
|
1147
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
1148
|
+
className: PushDialog_module_default.footer,
|
|
1149
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1150
|
+
className: PushDialog_module_default.tagOptions,
|
|
1151
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
1152
|
+
className: PushDialog_module_default.checkbox,
|
|
1153
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1154
|
+
type: "checkbox",
|
|
1155
|
+
checked: tags,
|
|
1156
|
+
disabled,
|
|
1157
|
+
onChange: (event) => {
|
|
1158
|
+
setTags(event.target.checked);
|
|
1159
|
+
}
|
|
1160
|
+
}), t("pushTags")]
|
|
1161
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
1162
|
+
open: menu === "tags",
|
|
1163
|
+
dense: true,
|
|
1164
|
+
portal: true,
|
|
1165
|
+
autoFocus: true,
|
|
1166
|
+
side: "top",
|
|
1167
|
+
selectedId: scope,
|
|
1168
|
+
onClose: () => {
|
|
1169
|
+
setMenu(null);
|
|
1170
|
+
},
|
|
1171
|
+
items: [{
|
|
1172
|
+
id: "all",
|
|
1173
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1174
|
+
title: t("pushTagsAllHint"),
|
|
1175
|
+
children: t("pushTagsAll")
|
|
1176
|
+
})
|
|
1177
|
+
}, {
|
|
1178
|
+
id: "follow",
|
|
1179
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1180
|
+
title: t("pushTagsFollowHint"),
|
|
1181
|
+
children: t("pushTagsFollow")
|
|
1182
|
+
})
|
|
1183
|
+
}],
|
|
1184
|
+
onSelect: (id) => {
|
|
1185
|
+
setScope(id);
|
|
1186
|
+
setMenu(null);
|
|
1187
|
+
},
|
|
1188
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1189
|
+
type: "button",
|
|
1190
|
+
className: PushDialog_module_default.scope,
|
|
1191
|
+
disabled: disabled || !tags,
|
|
1192
|
+
"aria-haspopup": "menu",
|
|
1193
|
+
"aria-expanded": menu === "tags",
|
|
1194
|
+
title: t(scope === "all" ? "pushTagsAllHint" : "pushTagsFollowHint"),
|
|
1195
|
+
onClick: () => {
|
|
1196
|
+
setMenu(menu === "tags" ? null : "tags");
|
|
1197
|
+
},
|
|
1198
|
+
children: [t(scope === "all" ? "pushTagsAll" : "pushTagsFollow"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {})]
|
|
1199
|
+
})
|
|
1200
|
+
})]
|
|
1201
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1202
|
+
className: PushDialog_module_default.actions,
|
|
1203
|
+
children: [
|
|
1204
|
+
(error !== null || plan !== null) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1205
|
+
type: "button",
|
|
1206
|
+
className: PushDialog_module_default.refresh,
|
|
1207
|
+
disabled: disabled || editing,
|
|
1208
|
+
title: t("pushRefresh"),
|
|
1209
|
+
"aria-label": t("pushRefresh"),
|
|
1210
|
+
onClick: refresh,
|
|
1211
|
+
children: "↻"
|
|
1212
|
+
}),
|
|
1213
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1214
|
+
size: "sm",
|
|
1215
|
+
variant: "ghost",
|
|
1216
|
+
disabled,
|
|
1217
|
+
onClick: close,
|
|
1218
|
+
children: t("actionCancel")
|
|
1219
|
+
}),
|
|
1220
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
1221
|
+
open: menu === "push",
|
|
1222
|
+
dense: true,
|
|
1223
|
+
portal: true,
|
|
1224
|
+
autoFocus: true,
|
|
1225
|
+
side: "top",
|
|
1226
|
+
align: "end",
|
|
1227
|
+
onClose: () => {
|
|
1228
|
+
setMenu(null);
|
|
1229
|
+
},
|
|
1230
|
+
items: [{
|
|
1231
|
+
id: "force",
|
|
1232
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1233
|
+
title: t("pushForceHint"),
|
|
1234
|
+
children: t("pushForce")
|
|
1235
|
+
}),
|
|
1236
|
+
disabled: !canPush
|
|
1237
|
+
}],
|
|
1238
|
+
onSelect: () => {
|
|
1239
|
+
submit(true);
|
|
1240
|
+
},
|
|
1241
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1242
|
+
className: PushDialog_module_default.split,
|
|
1243
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1244
|
+
type: "button",
|
|
1245
|
+
className: PushDialog_module_default.push,
|
|
1246
|
+
"data-modal-autofocus": true,
|
|
1247
|
+
disabled: !canPush || nothingToPush,
|
|
1248
|
+
...pushTitle === void 0 ? {} : { title: pushTitle },
|
|
1249
|
+
onClick: () => {
|
|
1250
|
+
submit(false);
|
|
1251
|
+
},
|
|
1252
|
+
children: t(disabled ? "pushBusy" : "ctxPush")
|
|
1253
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1254
|
+
type: "button",
|
|
1255
|
+
className: PushDialog_module_default.splitArrow,
|
|
1256
|
+
disabled: !canPush,
|
|
1257
|
+
"aria-label": t("pushOptions"),
|
|
1258
|
+
"aria-haspopup": "menu",
|
|
1259
|
+
"aria-expanded": menu === "push",
|
|
1260
|
+
onClick: () => {
|
|
1261
|
+
setMenu(menu === "push" ? null : "push");
|
|
1262
|
+
},
|
|
1263
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {})
|
|
1264
|
+
})]
|
|
1265
|
+
})
|
|
1266
|
+
})
|
|
1267
|
+
]
|
|
1268
|
+
})]
|
|
1269
|
+
})
|
|
1270
|
+
]
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
//#endregion
|
|
459
1274
|
//#region src/client/branch-tree.ts
|
|
460
1275
|
/** Segment order: natural (so `v2` precedes `v10`) and case-blind. */
|
|
461
1276
|
const segCmp = (a, b) => a.localeCompare(b, void 0, {
|
|
@@ -574,6 +1389,53 @@ window.__ModuleLoader__.load({
|
|
|
574
1389
|
}
|
|
575
1390
|
return set;
|
|
576
1391
|
}
|
|
1392
|
+
/**
|
|
1393
|
+
* @param row - the row being rendered.
|
|
1394
|
+
* @param hasRemotes - whether the repository has any remote at all; without
|
|
1395
|
+
* one every branch would read "unpublished", which is noise, not news.
|
|
1396
|
+
* @returns the marks to show, or null for none.
|
|
1397
|
+
*/
|
|
1398
|
+
function syncMark(row, hasRemotes) {
|
|
1399
|
+
if (row.kind === "remote") return null;
|
|
1400
|
+
if (row.upstreamGone === true) return {
|
|
1401
|
+
kind: "gone",
|
|
1402
|
+
upstream: row.upstream ?? ""
|
|
1403
|
+
};
|
|
1404
|
+
const outgoing = row.upstream === void 0 ? hasRemotes ? "unpublished" : null : (row.ahead ?? 0) > 0 ? row.ahead ?? 0 : null;
|
|
1405
|
+
const incoming = (row.behind ?? 0) > 0 ? row.behind ?? 0 : null;
|
|
1406
|
+
return outgoing === null && incoming === null ? null : {
|
|
1407
|
+
kind: "diverged",
|
|
1408
|
+
outgoing,
|
|
1409
|
+
incoming
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Whether the repository has any remote, judged from the branch list the
|
|
1414
|
+
* status call already carries (a remote-tracking ref, or a local branch that
|
|
1415
|
+
* names an upstream). No extra git process: `/status` stays as cheap as ever.
|
|
1416
|
+
* A remote added but never fetched and not yet tracked by anything reads as
|
|
1417
|
+
* "none" until its first fetch or push — the context-menu Push is unaffected.
|
|
1418
|
+
* @param branches - every branch entry of the repository, local and remote.
|
|
1419
|
+
* @returns true when at least one remote is evident.
|
|
1420
|
+
*/
|
|
1421
|
+
function repoHasRemotes(branches) {
|
|
1422
|
+
return branches.some((branch) => branch.kind === "remote" || branch.upstream !== void 0);
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* The remote-facing verbs a branch row's context menu offers. Where each one
|
|
1426
|
+
* sits in the menu is the menu's call (Update directly above Push, both ahead
|
|
1427
|
+
* of the rename/delete block); this only says which are available.
|
|
1428
|
+
* Push needs no checkout, so every local and worktree row has it; Update is
|
|
1429
|
+
* fetch + fast-forward of the CURRENT checkout only, and only when there is
|
|
1430
|
+
* a live upstream to fast-forward to.
|
|
1431
|
+
* @param row - the right-clicked row.
|
|
1432
|
+
* @param currentBranch - the branch this session's directory has checked out.
|
|
1433
|
+
* @returns the verb ids, empty for a remote row.
|
|
1434
|
+
*/
|
|
1435
|
+
function syncActions(row, currentBranch) {
|
|
1436
|
+
if (row.kind === "remote") return [];
|
|
1437
|
+
return row.name === currentBranch && row.upstream !== void 0 && row.upstreamGone !== true ? ["push", "update"] : ["push"];
|
|
1438
|
+
}
|
|
577
1439
|
//#endregion
|
|
578
1440
|
//#region src/client/branch-keyboard.ts
|
|
579
1441
|
/** Check if the event represents a context-menu trigger (ContextMenu key or Shift+F10). */
|
|
@@ -640,14 +1502,556 @@ window.__ModuleLoader__.load({
|
|
|
640
1502
|
return "ignored";
|
|
641
1503
|
}
|
|
642
1504
|
//#endregion
|
|
1505
|
+
//#region src/client/commit-graph.ts
|
|
1506
|
+
/** Keep the selection inside the filtered rows, without scanning per row. */
|
|
1507
|
+
function filterCommits(commits, query, author, selected) {
|
|
1508
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
1509
|
+
const visible = [];
|
|
1510
|
+
let matchingSelection = null;
|
|
1511
|
+
for (const [index, item] of commits.entries()) {
|
|
1512
|
+
if (author && item.author !== author) continue;
|
|
1513
|
+
if (needle && !`${item.subject} ${item.oid}`.toLocaleLowerCase().includes(needle)) continue;
|
|
1514
|
+
visible.push({
|
|
1515
|
+
item,
|
|
1516
|
+
index
|
|
1517
|
+
});
|
|
1518
|
+
if (item.oid === selected) matchingSelection = selected;
|
|
1519
|
+
}
|
|
1520
|
+
return {
|
|
1521
|
+
visible,
|
|
1522
|
+
selected: matchingSelection ?? visible[0]?.item.oid ?? null
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
/** Allocate lanes over the entire loaded prefix, so appending a page never
|
|
1526
|
+
* changes earlier nodes. Missing parents continue to the page boundary. */
|
|
1527
|
+
function layoutCommits(commits) {
|
|
1528
|
+
const active = [];
|
|
1529
|
+
let lanes = 1;
|
|
1530
|
+
const rows = [];
|
|
1531
|
+
for (const item of commits) {
|
|
1532
|
+
let lane = active.indexOf(item.oid);
|
|
1533
|
+
const incoming = lane !== -1;
|
|
1534
|
+
if (lane === -1) {
|
|
1535
|
+
lane = active.indexOf(null);
|
|
1536
|
+
if (lane === -1) lane = active.length;
|
|
1537
|
+
active[lane] = item.oid;
|
|
1538
|
+
}
|
|
1539
|
+
const before = [...active];
|
|
1540
|
+
active[lane] = null;
|
|
1541
|
+
const edges = [];
|
|
1542
|
+
for (const parent of new Set(item.parents)) {
|
|
1543
|
+
let target = active.indexOf(parent);
|
|
1544
|
+
if (target === -1) {
|
|
1545
|
+
target = active.indexOf(null);
|
|
1546
|
+
if (target === -1) target = active.length;
|
|
1547
|
+
active[target] = parent;
|
|
1548
|
+
}
|
|
1549
|
+
edges.push({
|
|
1550
|
+
from: lane,
|
|
1551
|
+
to: target,
|
|
1552
|
+
parent: true
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
for (let i = 0; i < before.length; i++) {
|
|
1556
|
+
const oid = before[i];
|
|
1557
|
+
if (oid !== null && oid !== void 0 && oid !== item.oid) edges.push({
|
|
1558
|
+
from: i,
|
|
1559
|
+
to: active.indexOf(oid),
|
|
1560
|
+
parent: false
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
lanes = Math.max(lanes, active.length, before.length);
|
|
1564
|
+
while (active.length && active.at(-1) === null) active.pop();
|
|
1565
|
+
rows.push({
|
|
1566
|
+
lane,
|
|
1567
|
+
incoming,
|
|
1568
|
+
edges
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
return {
|
|
1572
|
+
rows,
|
|
1573
|
+
lanes
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
//#endregion
|
|
1577
|
+
//#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\CommitGraph.module.css?inline
|
|
1578
|
+
const css$4 = ".panel_431118584 {\n display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; min-height: 0;\n border-left: .5px solid color-mix(in srgb, currentColor 12%, transparent);\n font-size: 12px; color: var(--dsw-alias-label-primary, #303238);\n}\n.heading_431118584 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px 8px 12px; flex-shrink: 0; }\n.branch_431118584 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; min-width: 0; flex: 0 1 auto; }\n.loaded_431118584 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--dsw-alias-label-tertiary, #929499); font-size: 11px; }\n.heading_431118584 > .iconButton_431118584:first-of-type { margin-left: auto; }\n.iconButton_431118584 { display: grid; place-items: center; border: 0; background: transparent; color: inherit; width: 22px; height: 22px; padding: 0; border-radius: 6px; cursor: pointer; font-size: 14px; flex-shrink: 0; }\n.closeIcon_431118584 { stroke-width: 1.8px; stroke-linecap: round; }\n.iconButton_431118584:hover, .textButton_431118584:hover { background: color-mix(in srgb, currentColor 7%, transparent); }\n.iconButton_431118584:disabled, .textButton_431118584:disabled { opacity: .4; cursor: default; }\n.search_431118584, .authorFilter_431118584 { box-sizing: border-box; min-width: 0; height: 30px; border: 0; border-radius: 7px; background: color-mix(in srgb, currentColor 5%, transparent); color: inherit; padding: 5px 8px; font: inherit; }\n.search_431118584 { width: 150px; flex: 0 1 150px; }\n.authorFilter_431118584 { width: 108px; flex: 0 1 108px; cursor: pointer; }\n.authorFilter_431118584 option { background: var(--dsw-alias-surface-raised, #303238); color: var(--dsw-alias-label-primary, #ededee); }\n.search_431118584:focus-visible, .authorFilter_431118584:focus-visible { outline: 1px solid var(--dsw-alias-label-primary-bluish, #4186f0); }\n.search_431118584::placeholder { color: var(--dsw-alias-label-tertiary, #929499); }\n.columns_431118584 { display: flex; align-items: center; gap: 8px; height: 25px; padding: 0 14px 0 8px; color: var(--dsw-alias-label-tertiary, #929499); font-size: 11px; flex-shrink: 0; }\n.columns_431118584 > span:first-child { flex: 0 0 auto; }\n.columns_431118584 > span:nth-child(2) { flex: 1; }\n.columns_431118584 > span:nth-child(3) { width: 70px; }\n.columns_431118584 > span:last-child { width: 99px; }\n.list_431118584 { flex: 1 1 0%; min-height: 58px; overflow: auto; padding: 0 6px; scrollbar-width: thin; }\n.row_431118584 { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 7px 0 2px; border: 0; border-radius: 7px; background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; }\n.row_431118584:hover { background: color-mix(in srgb, currentColor 5%, transparent); }\n.selected_431118584, .selected_431118584:hover { background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #4186f0) 14%, transparent); }\n.row_431118584:focus-visible { outline: 1px solid var(--dsw-alias-label-primary-bluish, #4186f0); outline-offset: -1px; }\n.graph_431118584 { flex-shrink: 0; overflow: visible; }\n.graph_431118584 path { fill: none; stroke-width: 1.5px; }\n.subject_431118584 { flex: 1 1 auto; min-width: 40px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.author_431118584 { flex: 0 0 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary, #75787e); font-size: 11px; }\n.date_431118584 { flex: 0 0 44px; color: var(--dsw-alias-label-secondary, #75787e); font-size: 11px; }\n.hash_431118584 { flex: 0 0 47px; font-size: 10px; color: var(--dsw-alias-label-tertiary, #929499); }\n.state_431118584 { padding: 16px; color: var(--dsw-alias-label-secondary, #75787e); overflow-wrap: anywhere; }\n.footer_431118584 { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 13px; min-height: 27px; color: var(--dsw-alias-label-tertiary, #929499); font-size: 11px; flex-shrink: 0; }\n.error_431118584 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-error, #c86464); }\n.textButton_431118584 { border: 0; background: transparent; padding: 4px 5px; border-radius: 5px; color: var(--dsw-alias-label-primary-bluish, #4186f0); font: inherit; font-size: 11px; cursor: pointer; align-self: flex-start; flex-shrink: 0; }\n.detailHost_431118584 { display: flex; flex: 0 0 auto; min-height: 0; max-height: min(316px, 44%); }\n.detail_431118584 { box-sizing: border-box; display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; padding: 12px 16px 10px; border-top: .5px solid color-mix(in srgb, currentColor 12%, transparent); }\n.detailTitle_431118584 { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }\n.meta_431118584 { display: flex; flex-wrap: wrap; gap: 5px 12px; color: var(--dsw-alias-label-tertiary, #929499); font-size: 10px; padding: 6px 0; flex-shrink: 0; }\n.messageScroll_431118584 { min-height: 0; overflow: hidden; }\n.message_431118584 { margin: 2px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary, #75787e); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n.expanded_431118584 .messageScroll_431118584 { overflow: auto; scrollbar-width: thin; }\n.expanded_431118584 .message_431118584 { display: block; -webkit-line-clamp: unset; }\n.files_431118584 { display: flex; align-items: center; gap: 9px; color: var(--dsw-alias-label-tertiary, #929499); font-size: 10px; padding-top: 7px; flex-shrink: 0; white-space: nowrap; }\n.fileName_431118584 { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }\n.added_431118584 { color: #529a77; }\n.removed_431118584 { color: #c66c72; }\n@media (max-width: 900px) {\n .author_431118584, .hash_431118584, .columns_431118584 > span:nth-child(3) { display: none; }\n .columns_431118584 > span:last-child { width: 44px; }\n}\n@media (max-height: 600px) {\n .detail_431118584 { padding: 7px 12px; }\n .meta_431118584 { padding: 3px 0; }\n}\n";
|
|
1579
|
+
const tagId$4 = "@laoyuehanni/dsh-git-worktree/CommitGraph.module.css";
|
|
1580
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$4 + "\"]") === null) {
|
|
1581
|
+
const tag = document.createElement("style");
|
|
1582
|
+
tag.dataset.plugin = "@laoyuehanni/dsh-git-worktree";
|
|
1583
|
+
tag.dataset.pluginCss = tagId$4;
|
|
1584
|
+
tag.textContent = css$4;
|
|
1585
|
+
document.head.appendChild(tag);
|
|
1586
|
+
}
|
|
1587
|
+
var CommitGraph_module_default = {
|
|
1588
|
+
"panel": "panel_431118584",
|
|
1589
|
+
"heading": "heading_431118584",
|
|
1590
|
+
"branch": "branch_431118584",
|
|
1591
|
+
"loaded": "loaded_431118584",
|
|
1592
|
+
"iconButton": "iconButton_431118584",
|
|
1593
|
+
"closeIcon": "closeIcon_431118584",
|
|
1594
|
+
"textButton": "textButton_431118584",
|
|
1595
|
+
"search": "search_431118584",
|
|
1596
|
+
"authorFilter": "authorFilter_431118584",
|
|
1597
|
+
"columns": "columns_431118584",
|
|
1598
|
+
"list": "list_431118584",
|
|
1599
|
+
"row": "row_431118584",
|
|
1600
|
+
"selected": "selected_431118584",
|
|
1601
|
+
"graph": "graph_431118584",
|
|
1602
|
+
"subject": "subject_431118584",
|
|
1603
|
+
"author": "author_431118584",
|
|
1604
|
+
"date": "date_431118584",
|
|
1605
|
+
"hash": "hash_431118584",
|
|
1606
|
+
"state": "state_431118584",
|
|
1607
|
+
"footer": "footer_431118584",
|
|
1608
|
+
"error": "error_431118584",
|
|
1609
|
+
"detailHost": "detailHost_431118584",
|
|
1610
|
+
"detail": "detail_431118584",
|
|
1611
|
+
"detailTitle": "detailTitle_431118584",
|
|
1612
|
+
"meta": "meta_431118584",
|
|
1613
|
+
"messageScroll": "messageScroll_431118584",
|
|
1614
|
+
"message": "message_431118584",
|
|
1615
|
+
"expanded": "expanded_431118584",
|
|
1616
|
+
"files": "files_431118584",
|
|
1617
|
+
"fileName": "fileName_431118584",
|
|
1618
|
+
"added": "added_431118584",
|
|
1619
|
+
"removed": "removed_431118584"
|
|
1620
|
+
};
|
|
1621
|
+
//#endregion
|
|
1622
|
+
//#region src/client/CommitGraph.tsx
|
|
1623
|
+
const colors = [
|
|
1624
|
+
"#5c91cc",
|
|
1625
|
+
"#ac88d1",
|
|
1626
|
+
"#56a895",
|
|
1627
|
+
"#cf9b61",
|
|
1628
|
+
"#ce7d91",
|
|
1629
|
+
"#7c9daa"
|
|
1630
|
+
];
|
|
1631
|
+
const x = (lane) => 12 + lane * 12;
|
|
1632
|
+
const color = (lane) => colors[lane % colors.length] ?? colors[0] ?? "#5c91cc";
|
|
1633
|
+
function GraphNode({ row, width, filtered }) {
|
|
1634
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1635
|
+
className: CommitGraph_module_default.graph,
|
|
1636
|
+
width,
|
|
1637
|
+
height: 36,
|
|
1638
|
+
"aria-hidden": "true",
|
|
1639
|
+
children: [!filtered && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [row.incoming && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1640
|
+
d: `M${x(row.lane)} 0V18`,
|
|
1641
|
+
stroke: color(row.lane)
|
|
1642
|
+
}), row.edges.map((edge, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1643
|
+
stroke: color(edge.parent ? edge.to : edge.from),
|
|
1644
|
+
d: edge.parent ? `M${x(edge.from)} 18C${x(edge.from)} 29 ${x(edge.to)} 25 ${x(edge.to)} 36` : `M${x(edge.from)} 0C${x(edge.from)} 18 ${x(edge.to)} 18 ${x(edge.to)} 36`
|
|
1645
|
+
}, i))] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
1646
|
+
cx: x(filtered ? 0 : row.lane),
|
|
1647
|
+
cy: 18,
|
|
1648
|
+
r: 3.6,
|
|
1649
|
+
fill: color(row.lane)
|
|
1650
|
+
})]
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
function Detail({ detail, t }) {
|
|
1654
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
1655
|
+
const [overflows, setOverflows] = (0, react.useState)(false);
|
|
1656
|
+
const messageRef = (0, react.useRef)(null);
|
|
1657
|
+
(0, react.useLayoutEffect)(() => {
|
|
1658
|
+
const el = messageRef.current;
|
|
1659
|
+
if (!el) return;
|
|
1660
|
+
const measure = () => {
|
|
1661
|
+
if (!expanded) setOverflows(el.scrollHeight > el.clientHeight + 1);
|
|
1662
|
+
};
|
|
1663
|
+
measure();
|
|
1664
|
+
const observer = new ResizeObserver(measure);
|
|
1665
|
+
observer.observe(el);
|
|
1666
|
+
return () => observer.disconnect();
|
|
1667
|
+
}, [detail.body, expanded]);
|
|
1668
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1669
|
+
className: `${CommitGraph_module_default.detail} ${expanded ? CommitGraph_module_default.expanded : ""}`,
|
|
1670
|
+
"aria-label": t("graphDetail"),
|
|
1671
|
+
children: [
|
|
1672
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1673
|
+
className: CommitGraph_module_default.detailTitle,
|
|
1674
|
+
title: detail.subject,
|
|
1675
|
+
children: detail.subject
|
|
1676
|
+
}),
|
|
1677
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1678
|
+
className: CommitGraph_module_default.meta,
|
|
1679
|
+
children: [
|
|
1680
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: detail.author }),
|
|
1681
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
|
|
1682
|
+
dateTime: detail.date,
|
|
1683
|
+
children: new Date(detail.date).toLocaleString()
|
|
1684
|
+
}),
|
|
1685
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
1686
|
+
title: detail.oid,
|
|
1687
|
+
children: detail.oid.slice(0, 8)
|
|
1688
|
+
})
|
|
1689
|
+
]
|
|
1690
|
+
}),
|
|
1691
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1692
|
+
className: CommitGraph_module_default.messageScroll,
|
|
1693
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1694
|
+
ref: messageRef,
|
|
1695
|
+
className: CommitGraph_module_default.message,
|
|
1696
|
+
children: detail.body || t("graphNoBody")
|
|
1697
|
+
})
|
|
1698
|
+
}),
|
|
1699
|
+
(overflows || expanded) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1700
|
+
type: "button",
|
|
1701
|
+
className: CommitGraph_module_default.textButton,
|
|
1702
|
+
"aria-expanded": expanded,
|
|
1703
|
+
onClick: () => setExpanded((value) => !value),
|
|
1704
|
+
children: t(expanded ? "graphCollapseBody" : "graphExpandBody")
|
|
1705
|
+
}),
|
|
1706
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1707
|
+
className: CommitGraph_module_default.files,
|
|
1708
|
+
title: detail.firstFile ?? "",
|
|
1709
|
+
children: [
|
|
1710
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1711
|
+
className: CommitGraph_module_default.fileName,
|
|
1712
|
+
children: detail.firstFile ?? t("graphNoFiles")
|
|
1713
|
+
}),
|
|
1714
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("graphFiles", { count: detail.files }) }),
|
|
1715
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1716
|
+
className: CommitGraph_module_default.added,
|
|
1717
|
+
children: ["+", detail.added]
|
|
1718
|
+
}),
|
|
1719
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1720
|
+
className: CommitGraph_module_default.removed,
|
|
1721
|
+
children: ["−", detail.removed]
|
|
1722
|
+
}),
|
|
1723
|
+
detail.binaryFiles > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("graphBinary", { count: detail.binaryFiles }) })
|
|
1724
|
+
]
|
|
1725
|
+
})
|
|
1726
|
+
]
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
/** One branch browser. The owner keys by repository + ref: old async responses
|
|
1730
|
+
* can never replace a different branch's history or selected commit. */
|
|
1731
|
+
function CommitGraph({ repoPath, branchRef, branch, onClose, escapeRef, t }) {
|
|
1732
|
+
const [history, setHistory] = (0, react.useState)(null);
|
|
1733
|
+
const [error, setError] = (0, react.useState)("");
|
|
1734
|
+
const [loading, setLoading] = (0, react.useState)(true);
|
|
1735
|
+
const [revision, setRevision] = (0, react.useState)(0);
|
|
1736
|
+
const [selected, setSelected] = (0, react.useState)(null);
|
|
1737
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
1738
|
+
const [author, setAuthor] = (0, react.useState)("");
|
|
1739
|
+
const [detail, setDetail] = (0, react.useState)(null);
|
|
1740
|
+
const [detailError, setDetailError] = (0, react.useState)("");
|
|
1741
|
+
const [detailRevision, setDetailRevision] = (0, react.useState)(0);
|
|
1742
|
+
const moreRequest = (0, react.useRef)(null);
|
|
1743
|
+
const listRef = (0, react.useRef)(null);
|
|
1744
|
+
const detailHost = (0, react.useRef)(null);
|
|
1745
|
+
const commits = history?.commits ?? [];
|
|
1746
|
+
const graph = (0, react.useMemo)(() => layoutCommits(commits), [commits]);
|
|
1747
|
+
const { visible, selected: selectedOid } = (0, react.useMemo)(() => filterCommits(commits, query, author, selected), [
|
|
1748
|
+
commits,
|
|
1749
|
+
query,
|
|
1750
|
+
author,
|
|
1751
|
+
selected
|
|
1752
|
+
]);
|
|
1753
|
+
const authors = [...new Set(commits.map((item) => item.author))].sort((a, b) => a.localeCompare(b));
|
|
1754
|
+
const filtered = !!query.trim() || !!author;
|
|
1755
|
+
const graphWidth = filtered ? 30 : Math.max(42, graph.lanes * 12 + 14);
|
|
1756
|
+
(0, react.useEffect)(() => {
|
|
1757
|
+
const controller = new AbortController();
|
|
1758
|
+
moreRequest.current?.abort();
|
|
1759
|
+
setHistory(null);
|
|
1760
|
+
setError("");
|
|
1761
|
+
setLoading(true);
|
|
1762
|
+
setSelected(null);
|
|
1763
|
+
setDetail(null);
|
|
1764
|
+
fetchHistory({
|
|
1765
|
+
repoPath,
|
|
1766
|
+
ref: branchRef
|
|
1767
|
+
}, controller.signal).then((result) => {
|
|
1768
|
+
if (controller.signal.aborted) return;
|
|
1769
|
+
setLoading(false);
|
|
1770
|
+
if (result.ok) {
|
|
1771
|
+
setHistory(result);
|
|
1772
|
+
setSelected(result.commits[0]?.oid ?? null);
|
|
1773
|
+
} else setError(result.error);
|
|
1774
|
+
});
|
|
1775
|
+
return () => {
|
|
1776
|
+
controller.abort();
|
|
1777
|
+
moreRequest.current?.abort();
|
|
1778
|
+
};
|
|
1779
|
+
}, [
|
|
1780
|
+
repoPath,
|
|
1781
|
+
branchRef,
|
|
1782
|
+
revision
|
|
1783
|
+
]);
|
|
1784
|
+
(0, react.useEffect)(() => {
|
|
1785
|
+
const controller = new AbortController();
|
|
1786
|
+
setDetail(null);
|
|
1787
|
+
setDetailError("");
|
|
1788
|
+
if (selectedOid !== null) fetchCommit(repoPath, selectedOid, controller.signal).then((result) => {
|
|
1789
|
+
if (controller.signal.aborted) return;
|
|
1790
|
+
if (result.ok) setDetail(result);
|
|
1791
|
+
else setDetailError(result.error);
|
|
1792
|
+
});
|
|
1793
|
+
return () => controller.abort();
|
|
1794
|
+
}, [
|
|
1795
|
+
repoPath,
|
|
1796
|
+
selectedOid,
|
|
1797
|
+
detailRevision
|
|
1798
|
+
]);
|
|
1799
|
+
(0, react.useEffect)(() => {
|
|
1800
|
+
const handler = () => {
|
|
1801
|
+
if (query) {
|
|
1802
|
+
setQuery("");
|
|
1803
|
+
return true;
|
|
1804
|
+
}
|
|
1805
|
+
if (author) {
|
|
1806
|
+
setAuthor("");
|
|
1807
|
+
return true;
|
|
1808
|
+
}
|
|
1809
|
+
const button = detailHost.current?.querySelector("button[aria-expanded=\"true\"]");
|
|
1810
|
+
if (button) {
|
|
1811
|
+
button.click();
|
|
1812
|
+
return true;
|
|
1813
|
+
}
|
|
1814
|
+
return false;
|
|
1815
|
+
};
|
|
1816
|
+
escapeRef.current = handler;
|
|
1817
|
+
return () => {
|
|
1818
|
+
if (escapeRef.current === handler) escapeRef.current = null;
|
|
1819
|
+
};
|
|
1820
|
+
}, [
|
|
1821
|
+
escapeRef,
|
|
1822
|
+
query,
|
|
1823
|
+
author
|
|
1824
|
+
]);
|
|
1825
|
+
const loadMore = async () => {
|
|
1826
|
+
if (loading || history?.next == null || !history.tip) return;
|
|
1827
|
+
moreRequest.current?.abort();
|
|
1828
|
+
const controller = new AbortController();
|
|
1829
|
+
moreRequest.current = controller;
|
|
1830
|
+
setLoading(true);
|
|
1831
|
+
setError("");
|
|
1832
|
+
const result = await fetchHistory({
|
|
1833
|
+
repoPath,
|
|
1834
|
+
ref: branchRef,
|
|
1835
|
+
tip: history.tip,
|
|
1836
|
+
offset: String(history.next)
|
|
1837
|
+
}, controller.signal);
|
|
1838
|
+
if (controller.signal.aborted) return;
|
|
1839
|
+
setLoading(false);
|
|
1840
|
+
if (result.ok) setHistory({
|
|
1841
|
+
...result,
|
|
1842
|
+
commits: [...history.commits, ...result.commits]
|
|
1843
|
+
});
|
|
1844
|
+
else setError(result.error);
|
|
1845
|
+
};
|
|
1846
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1847
|
+
className: CommitGraph_module_default.panel,
|
|
1848
|
+
"data-commit-history": "",
|
|
1849
|
+
role: "region",
|
|
1850
|
+
"aria-label": t("graphTitle"),
|
|
1851
|
+
children: [
|
|
1852
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1853
|
+
className: CommitGraph_module_default.heading,
|
|
1854
|
+
children: [
|
|
1855
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1856
|
+
className: CommitGraph_module_default.branch,
|
|
1857
|
+
title: branch,
|
|
1858
|
+
children: branch
|
|
1859
|
+
}),
|
|
1860
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
1861
|
+
className: CommitGraph_module_default.authorFilter,
|
|
1862
|
+
"aria-label": t("graphAuthorFilter"),
|
|
1863
|
+
value: author,
|
|
1864
|
+
onChange: (event) => setAuthor(event.target.value),
|
|
1865
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1866
|
+
value: "",
|
|
1867
|
+
children: t("graphAllAuthors")
|
|
1868
|
+
}), authors.map((name) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1869
|
+
value: name,
|
|
1870
|
+
children: name
|
|
1871
|
+
}, name))]
|
|
1872
|
+
}),
|
|
1873
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1874
|
+
className: CommitGraph_module_default.search,
|
|
1875
|
+
value: query,
|
|
1876
|
+
onChange: (event) => setQuery(event.target.value),
|
|
1877
|
+
placeholder: t("graphSearchPlaceholder"),
|
|
1878
|
+
"aria-label": t("graphSearch"),
|
|
1879
|
+
spellCheck: false
|
|
1880
|
+
}),
|
|
1881
|
+
history && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1882
|
+
className: CommitGraph_module_default.loaded,
|
|
1883
|
+
title: t("graphLoaded", { count: commits.length }),
|
|
1884
|
+
children: t("graphLoaded", { count: commits.length })
|
|
1885
|
+
}),
|
|
1886
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1887
|
+
type: "button",
|
|
1888
|
+
className: CommitGraph_module_default.iconButton,
|
|
1889
|
+
title: t("graphRefresh"),
|
|
1890
|
+
"aria-label": t("graphRefresh"),
|
|
1891
|
+
disabled: loading,
|
|
1892
|
+
onClick: () => setRevision((value) => value + 1),
|
|
1893
|
+
children: "↻"
|
|
1894
|
+
}),
|
|
1895
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1896
|
+
type: "button",
|
|
1897
|
+
className: CommitGraph_module_default.iconButton,
|
|
1898
|
+
title: t("graphCloseWindow"),
|
|
1899
|
+
"aria-label": t("graphCloseWindow"),
|
|
1900
|
+
onClick: onClose,
|
|
1901
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, {
|
|
1902
|
+
className: CommitGraph_module_default.closeIcon,
|
|
1903
|
+
size: 12
|
|
1904
|
+
})
|
|
1905
|
+
})
|
|
1906
|
+
]
|
|
1907
|
+
}),
|
|
1908
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1909
|
+
className: CommitGraph_module_default.columns,
|
|
1910
|
+
"aria-hidden": "true",
|
|
1911
|
+
children: [
|
|
1912
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1913
|
+
style: { width: graphWidth },
|
|
1914
|
+
children: t("graphColumn")
|
|
1915
|
+
}),
|
|
1916
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("graphCommit") }),
|
|
1917
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("graphAuthor") }),
|
|
1918
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("graphDate") })
|
|
1919
|
+
]
|
|
1920
|
+
}),
|
|
1921
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1922
|
+
ref: listRef,
|
|
1923
|
+
className: CommitGraph_module_default.list,
|
|
1924
|
+
role: "listbox",
|
|
1925
|
+
"aria-label": t("graphCommits"),
|
|
1926
|
+
"aria-busy": loading,
|
|
1927
|
+
onKeyDown: (event) => {
|
|
1928
|
+
if (![
|
|
1929
|
+
"ArrowDown",
|
|
1930
|
+
"ArrowUp",
|
|
1931
|
+
"Home",
|
|
1932
|
+
"End"
|
|
1933
|
+
].includes(event.key) || !visible.length) return;
|
|
1934
|
+
event.preventDefault();
|
|
1935
|
+
event.stopPropagation();
|
|
1936
|
+
const at = visible.findIndex(({ item }) => item.oid === selectedOid);
|
|
1937
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? visible.length - 1 : Math.max(0, Math.min(visible.length - 1, at + (event.key === "ArrowDown" ? 1 : -1)));
|
|
1938
|
+
const oid = visible[next]?.item.oid;
|
|
1939
|
+
if (oid) {
|
|
1940
|
+
setSelected(oid);
|
|
1941
|
+
const row = listRef.current?.querySelector(`[data-oid="${oid}"]`);
|
|
1942
|
+
row?.focus();
|
|
1943
|
+
row?.scrollIntoView({ block: "nearest" });
|
|
1944
|
+
}
|
|
1945
|
+
},
|
|
1946
|
+
children: [
|
|
1947
|
+
visible.map(({ item, index }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1948
|
+
type: "button",
|
|
1949
|
+
role: "option",
|
|
1950
|
+
"aria-selected": item.oid === selectedOid,
|
|
1951
|
+
"data-oid": item.oid,
|
|
1952
|
+
tabIndex: item.oid === selectedOid ? 0 : -1,
|
|
1953
|
+
className: `${CommitGraph_module_default.row} ${item.oid === selectedOid ? CommitGraph_module_default.selected : ""}`,
|
|
1954
|
+
onClick: () => setSelected(item.oid),
|
|
1955
|
+
children: [
|
|
1956
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GraphNode, {
|
|
1957
|
+
row: graph.rows[index] ?? {
|
|
1958
|
+
lane: 0,
|
|
1959
|
+
incoming: false,
|
|
1960
|
+
edges: []
|
|
1961
|
+
},
|
|
1962
|
+
width: graphWidth,
|
|
1963
|
+
filtered
|
|
1964
|
+
}),
|
|
1965
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1966
|
+
className: CommitGraph_module_default.subject,
|
|
1967
|
+
title: item.subject,
|
|
1968
|
+
children: item.subject
|
|
1969
|
+
}),
|
|
1970
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1971
|
+
className: CommitGraph_module_default.author,
|
|
1972
|
+
title: item.author,
|
|
1973
|
+
children: item.author
|
|
1974
|
+
}),
|
|
1975
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
|
|
1976
|
+
className: CommitGraph_module_default.date,
|
|
1977
|
+
title: item.date,
|
|
1978
|
+
dateTime: item.date,
|
|
1979
|
+
children: new Date(item.date).toLocaleDateString(void 0, {
|
|
1980
|
+
month: "2-digit",
|
|
1981
|
+
day: "2-digit"
|
|
1982
|
+
})
|
|
1983
|
+
}),
|
|
1984
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
1985
|
+
className: CommitGraph_module_default.hash,
|
|
1986
|
+
children: item.oid.slice(0, 7)
|
|
1987
|
+
})
|
|
1988
|
+
]
|
|
1989
|
+
}, item.oid)),
|
|
1990
|
+
!loading && !visible.length && !error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1991
|
+
className: CommitGraph_module_default.state,
|
|
1992
|
+
children: t(commits.length ? "graphNoMatches" : "graphEmpty")
|
|
1993
|
+
}),
|
|
1994
|
+
loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1995
|
+
className: CommitGraph_module_default.state,
|
|
1996
|
+
role: "status",
|
|
1997
|
+
children: t("graphLoading")
|
|
1998
|
+
})
|
|
1999
|
+
]
|
|
2000
|
+
}),
|
|
2001
|
+
(error || history?.next != null) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2002
|
+
className: CommitGraph_module_default.footer,
|
|
2003
|
+
children: [
|
|
2004
|
+
error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2005
|
+
className: CommitGraph_module_default.error,
|
|
2006
|
+
role: "alert",
|
|
2007
|
+
title: error,
|
|
2008
|
+
children: error
|
|
2009
|
+
}),
|
|
2010
|
+
error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2011
|
+
type: "button",
|
|
2012
|
+
className: CommitGraph_module_default.textButton,
|
|
2013
|
+
disabled: loading,
|
|
2014
|
+
onClick: () => history ? void loadMore() : setRevision((value) => value + 1),
|
|
2015
|
+
children: t("graphRetry")
|
|
2016
|
+
}),
|
|
2017
|
+
history?.next != null && !error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2018
|
+
type: "button",
|
|
2019
|
+
className: CommitGraph_module_default.textButton,
|
|
2020
|
+
disabled: loading,
|
|
2021
|
+
onClick: () => void loadMore(),
|
|
2022
|
+
children: t("graphMore")
|
|
2023
|
+
})
|
|
2024
|
+
]
|
|
2025
|
+
}),
|
|
2026
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2027
|
+
ref: detailHost,
|
|
2028
|
+
className: CommitGraph_module_default.detailHost,
|
|
2029
|
+
children: [detail && detail.oid === selectedOid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Detail, {
|
|
2030
|
+
detail,
|
|
2031
|
+
t
|
|
2032
|
+
}, detail.oid), selectedOid && detail?.oid !== selectedOid && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2033
|
+
className: CommitGraph_module_default.state,
|
|
2034
|
+
role: detailError ? "alert" : "status",
|
|
2035
|
+
children: [detailError || t("graphLoading"), detailError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2036
|
+
type: "button",
|
|
2037
|
+
className: CommitGraph_module_default.textButton,
|
|
2038
|
+
onClick: () => setDetailRevision((value) => value + 1),
|
|
2039
|
+
children: t("graphRetry")
|
|
2040
|
+
})]
|
|
2041
|
+
})]
|
|
2042
|
+
})
|
|
2043
|
+
]
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
//#endregion
|
|
643
2047
|
//#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\BranchChip.module.css?inline
|
|
644
|
-
const css$2 = "/* Branch chip row inside the composer tool row (conversation.input_2006230319.left_2006230319,\n * right of the mode chips). A single chip button: the branch picker (the\n * worktree toggle that used to share this dock is gone — worktree actions\n * live in the branch menu's right-click).\n *\n * Geometry mirrors the composer trigger chips in the DSH base (see\n * PermissionSelect / ModelSelect): 28px height, 13/20 medium-secondary\n * label, transparent fill, no outline — the dock stays at the same\n * visual weight as the surrounding chips (dsh-worktree select, standard\n * mode select, Workspace Write, MiniMax-M3 High). The corners stop short\n * of the base's full pill (24px) so the silhouette stays a chip rather\n * than a capsule, per the design brief. */\n\n/* Shared trigger geometry — copied 1:1 from the base composer triggers\n * (PermissionSelect .trigger_2006230319 / ModelSelect .trigger_2006230319). */\n.dock_2006230319 {\n display: inline-flex;\n align-items: stretch;\n height: 28px;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n min-height: 28px;\n overflow: hidden;\n}\n\n.chip_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 100%;\n padding: 0 8px 0 8px;\n border: none;\n border-radius: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n}\n\n.chip_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.branch_2006230319 {\n max-width: 16em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Confirm flyout: the second-level panel opening right of the branch\n * card (the base Menu's submenu posture: r20, elevation-prominent\n * hairline, --dsw-specific-menu with --dsw-menu-backdrop-filter — host 0.1.2 Menu card;\n * hosts without the token fall back to the old r12-era shadow-lv3). Width is content-driven — it follows\n * the longest line (for remote picks that is the subject line's branch\n * name) — floored at 168px (the Cancel/Confirm pair plus padding: short\n * branch names must not squeeze the buttons into wrapping \"切换中…\"\n * mid-word) and capped at 400px; BranchMenu also clamps it inline to the\n * room right of the card. Beyond the cap the lines wrap. border-box so\n * every width arm includes the card chrome. */\n.popCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n width: max-content;\n min-width: 168px;\n max-width: min(400px, 80vw);\n padding: 4px;\n border: 0;\n border-radius: 20px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n /* Elevation-prominent carries the hairline stroke; the lv3 fallback\n * keeps a shadow where the token does not exist. */\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.popAsk_2006230319 {\n margin: 0;\n padding: 6px 8px;\n font-size: 13px;\n line-height: 20px;\n color: inherit;\n /* Branch names are long unbroken tokens — plain wrapping would let them\n * overflow the capped card instead of breaking. */\n overflow-wrap: anywhere;\n}\n\n/* Remote confirm's name line: the branch itself, weight 500 like the leaf\n * rows — the subject the ask line refers to (\"该远程分支\"). A dedicated\n * line keeps the long unbroken token away from the sentence, so wraps\n * happen inside the name instead of shredding the Chinese around it. */\n.popSubject_2006230319 {\n margin: 0;\n padding: 0 8px 2px;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n color: inherit;\n overflow-wrap: anywhere;\n}\n\n/* The removal confirm's consequence lines (dirty/ahead/archived sessions):\n * subdued one-row facts under the ask, the dirty count alone in the warning\n * tone — mirroring the manager dialog's fact block. */\n.popDetails_2006230319 {\n padding: 0 8px 2px;\n}\n\n.popDetail_2006230319 {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-secondary, rgba(128, 128, 128, 0.9));\n overflow-wrap: anywhere;\n}\n\n.popDetailWarn_2006230319 {\n color: var(--dsw-alias-status-danger, #d5304f);\n}\n\n.popActions_2006230319 {\n display: flex;\n gap: 2px;\n padding: 2px;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * nowrap keeps labels like 切换中… from splitting mid-word when the flyout\n * is pinned to its minimum width by a short branch name. */\n.popActions_2006230319 button {\n flex: 1 1 0;\n height: 28px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.popActions_2006230319 button:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.popActions_2006230319 button:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n.popActions_2006230319 button:last-child {\n color: var(--dsw-alias-label-primary-bluish, #4186f0);\n font-weight: 500;\n}\n\n/* ── Branch picker popup (BranchMenu) ──────────────────────────────\n * Upward-opening card pinned above the chip, in the Menu's card chrome\n * (r20, elevation-prominent hairline, --dsw-specific-menu with\n * --dsw-menu-backdrop-filter — host Menu/PermissionSelect card;\n * hosts without the token fall back to shadow-lv3). Three owner requirements shape the geometry:\n *\n * 1. height cap: min(420px, 60vh) on the card, only the rows area\n * scrolls (.menuRows_2006230319) — heading and search stay pinned;\n * 2. the search field sits pinned at the card's bottom edge, directly\n * above the chip, with the scrolling rows above it;\n * 3. the card is CSS-`bottom`-pinned ~6px above the chip's top and so\n * grows entirely upward — it can never cover the composer or fill\n * the viewport, whatever the branch count.\n *\n * The inline `left`/`bottom` come from BranchMenu's placement pass; the\n * width is fixed here (design 360px — 320 tree + 40 tool strip — and\n * viewport-capped) so horizontal clamping stays deterministic without\n * measuring the card. */\n\n/* The portal lands directly under document.body_2006230319, outside the shell's\n * box-sizing reset — content-box default would add padding/border on top\n * of the declared width (360 became 370, and the width:100% children\n * padded 16px past the card's right clip, shearing off their rounded\n * corners). Every width-declared box in this popup opts back into\n * border-box: the card, the toolbar, the rows, and the search input. */\n.menuCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n display: flex;\n flex-direction: row;\n width: min(360px, calc(100vw - 24px));\n max-height: min(420px, 60vh);\n overflow: hidden;\n padding: 4px;\n border: 0;\n border-radius: 20px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n /* Same elevation card as .popCard_2006230319 (host 0.1.2 Menu); lv3 fallback\n * for hosts without the token. */\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n\n/* Left tool strip (IDEA branch-panel posture at popup scale): a narrow\n * column of icon-only buttons for actions that do not belong in the tree\n * — locate the checked-out branch, expand/collapse the whole tree.\n * Buttons stack from the BOTTOM up: the card's height shrinks when the\n * repo has few branches, so a top-anchored strip would drift around and\n * the buttons would sit far from the search bar; anchoring to the bottom\n * pins them at a stable spot (beside the search row) whatever the height. */\n.menuToolbar_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n gap: 2px;\n flex-shrink: 0;\n width: 32px;\n padding: 0 2px;\n margin-right: 4px;\n border-right: 0.5px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuToolButton_2006230319 {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n margin: 0 auto;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n}\n\n.menuToolButton_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuToolButton_2006230319:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* The sync tools while their action runs: a soft opacity pulse. The glyph\n * is a directional arrow, so the circular-refresh spin read as garbled\n * rotation — pulsing keeps the arrow legible while clearly \"live\", and the\n * button keeps full opacity (the usual disabled dim would read as broken\n * for an in-flight network operation). */\n.menuToolButtonRunning_2006230319 svg {\n animation: menuToolPulse 700ms ease-in-out infinite alternate;\n}\n\n.menuToolButtonRunning_2006230319:disabled {\n opacity: 1;\n cursor: progress;\n}\n\n@keyframes menuToolPulse {\n from { opacity: 1; }\n to { opacity: 0.25; }\n}\n\n/* The main column: heading + scrollable rows + pinned search. */\n.menuMain_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-width: 0;\n}\n\n/* Non-interactive group heading — the Menu label row's posture. */\n.menuHeading_2006230319 {\n padding: 6px 8px 4px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 0;\n}\n\n/* The only scrollable region: shrinks within the capped card so the\n * heading above and the search below stay visible while rows scroll. */\n.menuRows_2006230319 {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * Weight 500 mirrors the chip's branch label (the portal escapes the\n * composer's font context, so the match must be explicit — the inherited\n * body weight is 400 and reads visibly lighter than the chip beside it). */\n.menuRow_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside .menuRows_2006230319 */\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuRow_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The checked-out branch: a persistent tint a step above the resting rows\n * so it reads as \"you are here\" the moment the list scrolls it into view\n * (BranchMenu centers it on open) — the trailing check alone is easy to\n * miss from a distance. */\n.menuRowSelected_2006230319,\n.menuRowSelected_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, currentColor 10%, transparent);\n}\n\n/* IDEA-style selection: the clicked row gets a bluish fill, layering over\n * the HEAD tint when the same row is both — selection communicates intent,\n * the HEAD tint communicates position, and they coexist (IDEA 4.4). */\n.menuRowPicked_2006230319,\n.menuRowPicked_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #4186f0) 18%, transparent);\n}\n\n.menuRowLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Upstream divergence arrows (↑N/↓N) trailing a local branch row, before\n * the HEAD check: the count badge tone at a smaller size so a busy list\n * still reads the name first. Plain text arrows — no base-set icon pairs\n * a direction with a count. tabular-nums keeps ↑10 from nudging neighbors\n * as the digits tick. */\n.menuRowArrow_2006230319 {\n flex-shrink: 0;\n font-size: 11px;\n line-height: 20px;\n font-weight: 400;\n font-variant-numeric: tabular-nums;\n color: color-mix(in srgb, currentColor 55%, transparent);\n}\n\n/* Search hit highlight (IDEA): the matched substring gets a warm tint\n * behind it — theme-agnostic, legible in both light and dark cards. */\n.menuSearchMark_2006230319 {\n background: color-mix(in srgb, #b58900 38%, transparent);\n border-radius: 2px;\n}\n\n/* Tree group rows (folder headers) — BranchMenu's '/' prefix tree: the\n * same row geometry as .menuRow_2006230319, but labeled in the secondary tone so the\n * leaf rows pop, with a count badge and a chevron that turns on expand. */\n.menuGroup_2006230319 {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuGroup_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The two top-level section headers (local/remote branches) step ABOVE the\n * folder headers they contain: primary label tone like the leaf rows plus\n * a heavier weight, so the nav hierarchy reads group > row > folder — the\n * folder headers keep the secondary tone that alone would leave the\n * sections as the faintest (and most important) rows on the list. */\n.menuGroupTop_2006230319 {\n color: inherit;\n font-weight: 600;\n}\n\n.menuGroupLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.menuGroupChevron_2006230319 {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 12px;\n height: 12px;\n transition: transform 120ms ease;\n}\n\n.menuGroupChevronOpen_2006230319 {\n transform: rotate(90deg);\n}\n\n.menuGroupCount_2006230319 {\n flex-shrink: 0;\n font-size: 12px;\n line-height: 20px;\n font-weight: 400;\n color: color-mix(in srgb, currentColor 55%, transparent);\n}\n\n/* Zero-search-hit state: centered secondary line inside the rows area. */\n.menuEmpty_2006230319 {\n padding: 10px 8px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n text-align: center;\n}\n\n/* Bottom-pinned search field, separated from the rows by a hairline.\n * Borderless so it reads as part of the card, focus shown as the\n * standard hover tint rather than an outline. */\n.menuSearchWrap_2006230319 {\n flex-shrink: 0;\n margin-top: 2px;\n padding-top: 4px;\n border-top: 0.5px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuSearch_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside the wrap */\n width: 100%;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuRow_2006230319) — the portal\n * escapes the composer's font context and would inherit body's 400. */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuSearch_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuSearch_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* ── Create/rename flyouts (BranchMenu row context menu) ────────────\n * Open IN PLACE of the row menu (at its point, clamped) and hold the whole\n * flow in one panel: ask line, input, live hint, and the Cancel/confirm\n * pair — typing the name and pressing the button fires in one stroke, no\n * second confirm step. */\n\n/* The naming input inside the flyout: borderless, part of the card, focus\n * shown as the standard hover tint. Fixed width — the popCard is\n * max-content, so a percentage width would chase the input's own default\n * size instead of the design width. */\n.menuCreate_2006230319 {\n box-sizing: border-box;\n width: 248px;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuSearch_2006230319). */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuCreate_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuCreate_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuCreate_2006230319:disabled {\n opacity: 0.5;\n}\n\n/* The error line under the input — only rendered while the draft is\n * unacceptable with a non-empty reason; the input itself stays neutral,\n * the line carries the state. */\n.menuCreateHintBad_2006230319 {\n margin: 0;\n padding: 0 8px;\n font-size: 12px;\n line-height: 16px;\n color: var(--dsw-alias-label-error);\n}\n\n/* ── Row context menu (BranchMenu right-click) ─────────────────────\n * Cursor-anchored transient over the branch card: translucent menu chrome\n * (--dsw-specific-menu with --dsw-menu-backdrop-filter, elevation-prominent hairline,\n * lv3 fallback) at a smaller radius — r20 would round a launcher this\n * short into a pill, r12 keeps the corners proportionate to a handful of\n * rows (two on a worktree row, up to six plus a header on a branch row).\n * Width hugs the widest item\n * (shrink-to-fit, no design width) with a generous cap for safety —\n * a launcher reads better snug than stretched. Positioned once at open\n * and dismissed rather than re-placed when the page moves (see\n * BranchMenu's ctx placement pass); z-index one step above the popCard so\n * it never slides under the confirm flyout. */\n.ctxCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1001;\n width: max-content;\n max-width: 280px;\n padding: 4px;\n border: 0;\n border-radius: 12px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n/* The target row's name, above the verbs. Unlike the items this one holds\n * a branch name, so it is the one line allowed to hit the 280px cap and\n * ellipsize (the full name rides in a title). Secondary tone and no hover\n * affordance: it is a label, not a seventh item. */\n.ctxHeader_2006230319 {\n padding: 4px 8px 2px;\n font-size: 12px;\n line-height: 16px;\n color: var(--dsw-alias-label-secondary);\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n/* Menu-item rows: the .menuRow_2006230319 geometry at a hair lighter weight — a\n * launcher's labels read as commands, not data. nowrap: the labels are\n * fixed copy (no branch names), the 280px cap is unreachable by design. */\n.ctxItem_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n text-align: left;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.ctxItem_2006230319:hover,\n.ctxItem_2006230319:focus-visible {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The running-session withhold (worktree removal): a disabled item stays\n * visible — the reason it is missing lives on its hover title, and a verb\n * that appears and disappears with session state reads as a bug, not a\n * rule. No hover tint, no pointer; the label dims instead of vanishing. */\n.ctxItem_2006230319:disabled {\n cursor: default;\n opacity: 0.45;\n}\n\n.ctxItem_2006230319:disabled:hover {\n background: transparent;\n}\n\n/* The arrow-key walk lands here, so the focused item must read as strongly\n * as a hovered one — the tint above carries it, the default ring would sit\n * outside the 8px radius. */\n.ctxItem_2006230319:focus-visible {\n outline: none;\n}\n\n/* Leading glyph rides the label tone, a step quieter. */\n.ctxItem_2006230319 svg {\n flex-shrink: 0;\n opacity: 0.75;\n}\n\n.ctxItemLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n";
|
|
645
|
-
const tagId$
|
|
646
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$
|
|
2048
|
+
const css$3 = "/* Branch chip row inside the composer tool row (conversation.input_2006230319.left_2006230319,\n * right of the mode chips). A single chip button: the branch picker (the\n * worktree toggle that used to share this dock is gone — worktree actions\n * live in the branch menu's right-click).\n *\n * Geometry mirrors the composer trigger chips in the DSH base (see\n * PermissionSelect / ModelSelect): 28px height, 13/20 medium-secondary\n * label, transparent fill, no outline — the dock stays at the same\n * visual weight as the surrounding chips (dsh-worktree select, standard\n * mode select, Workspace Write, MiniMax-M3 High). The corners stop short\n * of the base's full pill (24px) so the silhouette stays a chip rather\n * than a capsule, per the design brief. */\n\n/* Shared trigger geometry — copied 1:1 from the base composer triggers\n * (PermissionSelect .trigger_2006230319 / ModelSelect .trigger_2006230319). */\n.dock_2006230319 {\n display: inline-flex;\n align-items: stretch;\n height: 28px;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n min-height: 28px;\n overflow: hidden;\n}\n\n.chip_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 100%;\n padding: 0 8px 0 8px;\n border: none;\n border-radius: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n}\n\n.chip_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.branch_2006230319 {\n max-width: 16em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Confirm flyout: the second-level panel opening right of the branch\n * card (the base Menu's submenu posture: r20, elevation-prominent\n * hairline, --dsw-specific-menu with --dsw-menu-backdrop-filter — host 0.1.2 Menu card;\n * hosts without the token fall back to the old r12-era shadow-lv3). Width is content-driven — it follows\n * the longest line (for remote picks that is the subject line's branch\n * name) — floored at 168px (the Cancel/Confirm pair plus padding: short\n * branch names must not squeeze the buttons into wrapping \"切换中…\"\n * mid-word) and capped at 400px; BranchMenu also clamps it inline to the\n * room right of the card. Beyond the cap the lines wrap. border-box so\n * every width arm includes the card chrome. */\n.popCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n width: max-content;\n min-width: 168px;\n max-width: min(400px, 80vw);\n padding: 4px;\n border: 0;\n border-radius: 20px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n /* Elevation-prominent carries the hairline stroke; the lv3 fallback\n * keeps a shadow where the token does not exist. */\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.popAsk_2006230319 {\n margin: 0;\n padding: 6px 8px;\n font-size: 13px;\n line-height: 20px;\n color: inherit;\n /* Branch names are long unbroken tokens — plain wrapping would let them\n * overflow the capped card instead of breaking. */\n overflow-wrap: anywhere;\n}\n\n/* Remote confirm's name line: the branch itself, weight 500 like the leaf\n * rows — the subject the ask line refers to (\"该远程分支\"). A dedicated\n * line keeps the long unbroken token away from the sentence, so wraps\n * happen inside the name instead of shredding the Chinese around it. */\n.popSubject_2006230319 {\n margin: 0;\n padding: 0 8px 2px;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n color: inherit;\n overflow-wrap: anywhere;\n}\n\n/* The removal confirm's consequence lines (dirty/ahead/archived sessions):\n * subdued one-row facts under the ask, the dirty count alone in the warning\n * tone — mirroring the manager dialog's fact block. */\n.popDetails_2006230319 {\n padding: 0 8px 2px;\n}\n\n.popDetail_2006230319 {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-secondary, rgba(128, 128, 128, 0.9));\n overflow-wrap: anywhere;\n}\n\n.popDetailWarn_2006230319 {\n color: var(--dsw-alias-status-danger, #d5304f);\n}\n\n.popActions_2006230319 {\n display: flex;\n gap: 2px;\n padding: 2px;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * nowrap keeps labels like 切换中… from splitting mid-word when the flyout\n * is pinned to its minimum width by a short branch name. */\n.popActions_2006230319 button {\n flex: 1 1 0;\n height: 28px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.popActions_2006230319 button:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.popActions_2006230319 button:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n.popActions_2006230319 button:last-child {\n color: var(--dsw-alias-label-primary-bluish, #4186f0);\n font-weight: 500;\n}\n\n/* ── Branch picker popup (BranchMenu) ──────────────────────────────\n * Upward-opening card pinned above the chip, in the Menu's card chrome\n * (r20, elevation-prominent hairline, --dsw-specific-menu with\n * --dsw-menu-backdrop-filter — host Menu/PermissionSelect card;\n * hosts without the token fall back to shadow-lv3). Three owner requirements shape the geometry:\n *\n * 1. height cap: min(420px, 60vh) on the card, only the rows area\n * scrolls (.menuRows_2006230319) — heading and search stay pinned;\n * 2. the search field sits pinned at the card's bottom edge, directly\n * above the chip, with the scrolling rows above it;\n * 3. the card is CSS-`bottom`-pinned ~6px above the chip's top and so\n * grows entirely upward — it can never cover the composer or fill\n * the viewport, whatever the branch count.\n *\n * The inline `left`/`bottom` come from BranchMenu's placement pass; the\n * width is fixed here (design 360px — 320 tree + 40 tool strip — and\n * viewport-capped) so horizontal clamping stays deterministic without\n * measuring the card. */\n\n/* The portal lands directly under document.body_2006230319, outside the shell's\n * box-sizing reset — content-box default would add padding/border on top\n * of the declared width (360 became 370, and the width:100% children\n * padded 16px past the card's right clip, shearing off their rounded\n * corners). Every width-declared box in this popup opts back into\n * border-box: the card, the toolbar, the rows, and the search input. */\n.menuCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1000;\n display: flex;\n flex-direction: row;\n width: min(360px, calc(100vw - 24px));\n max-height: min(420px, 60vh);\n overflow: hidden;\n padding: 4px;\n border: 0;\n border-radius: 20px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n /* Same elevation card as .popCard_2006230319 (host 0.1.2 Menu); lv3 fallback\n * for hosts without the token. */\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n}\n\n/* Left tool strip (IDEA branch-panel posture at popup scale): a narrow\n * column of icon-only buttons for actions that do not belong in the tree\n * — locate the checked-out branch, expand/collapse the whole tree.\n * Buttons stack from the BOTTOM up: the card's height shrinks when the\n * repo has few branches, so a top-anchored strip would drift around and\n * the buttons would sit far from the search bar; anchoring to the bottom\n * pins them at a stable spot (beside the search row) whatever the height. */\n.menuToolbar_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n gap: 2px;\n flex-shrink: 0;\n width: 32px;\n padding: 0 2px;\n margin-right: 4px;\n border-right: 0.5px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuToolButton_2006230319 {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n margin: 0 auto;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n}\n\n.menuToolButton_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuToolButton_2006230319:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* The sync tools while their action runs: a soft opacity pulse. The glyph\n * is a directional arrow, so the circular-refresh spin read as garbled\n * rotation — pulsing keeps the arrow legible while clearly \"live\", and the\n * button keeps full opacity (the usual disabled dim would read as broken\n * for an in-flight network operation). */\n.menuToolButtonRunning_2006230319 svg {\n animation: menuToolPulse 700ms ease-in-out infinite alternate;\n}\n\n.menuToolButtonRunning_2006230319:disabled {\n opacity: 1;\n cursor: progress;\n}\n\n@keyframes menuToolPulse {\n from { opacity: 1; }\n to { opacity: 0.25; }\n}\n\n/* The main column: heading + scrollable rows + pinned search. */\n.menuMain_2006230319 {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-width: 0;\n}\n\n/* Non-interactive group heading — the Menu label row's posture. */\n.menuHeading_2006230319 {\n padding: 6px 8px 4px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 0;\n}\n\n/* The only scrollable region: shrinks within the capped card so the\n * heading above and the search below stay visible while rows scroll. */\n.menuRows_2006230319 {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n}\n\n/* Menu-row-like buttons: transparent fill, hover tint, same 13px type.\n * Weight 500 mirrors the chip's branch label (the portal escapes the\n * composer's font context, so the match must be explicit — the inherited\n * body weight is 400 and reads visibly lighter than the chip beside it). */\n.menuRow_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside .menuRows_2006230319 */\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuRow_2006230319:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The checked-out branch: a persistent tint a step above the resting rows\n * so it reads as \"you are here\" the moment the list scrolls it into view\n * (BranchMenu centers it on open) — the trailing check alone is easy to\n * miss from a distance. */\n.menuRowSelected_2006230319,\n.menuRowSelected_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, currentColor 10%, transparent);\n}\n\n/* IDEA-style selection: the clicked row gets a bluish fill, layering over\n * the HEAD tint when the same row is both — selection communicates intent,\n * the HEAD tint communicates position, and they coexist (IDEA 4.4). */\n.menuRowPicked_2006230319,\n.menuRowPicked_2006230319:hover:not(:disabled) {\n background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #4186f0) 18%, transparent);\n}\n\n.menuRowLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* IDEA-style outgoing green / incoming blue marks, including unpublished refs. */\n.menuRowArrow_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n flex-shrink: 0;\n font-size: 11px;\n line-height: 20px;\n font-weight: 400;\n font-variant-numeric: tabular-nums;\n}\n\n/* Host state tokens first (they follow the active theme and keep text\n * contrast); IDEA's own hues remain the fallback where a token is absent. */\n.menuRowAhead_2006230319 { color: var(--dsw-alias-state-success-primary, #57965c); }\n.menuRowBehind_2006230319 { color: var(--dsw-alias-link, #589df6); }\n.menuRowGone_2006230319 { color: var(--dsw-alias-state-warn-primary, #b58900); }\n.menuRowOutgoing_2006230319 { display: inline-flex; transform: rotate(180deg); }\n\n/* Search hit highlight (IDEA): the matched substring gets a warm tint\n * behind it — theme-agnostic, legible in both light and dark cards. */\n.menuSearchMark_2006230319 {\n background: color-mix(in srgb, #b58900 38%, transparent);\n border-radius: 2px;\n}\n\n/* Tree group rows (folder headers) — BranchMenu's '/' prefix tree: the\n * same row geometry as .menuRow_2006230319, but labeled in the secondary tone so the\n * leaf rows pop, with a count badge and a chevron that turns on expand. */\n.menuGroup_2006230319 {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #81858c);\n font: inherit;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n cursor: pointer;\n}\n\n.menuGroup_2006230319:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The two top-level section headers (local/remote branches) step ABOVE the\n * folder headers they contain: primary label tone like the leaf rows plus\n * a heavier weight, so the nav hierarchy reads group > row > folder — the\n * folder headers keep the secondary tone that alone would leave the\n * sections as the faintest (and most important) rows on the list. */\n.menuGroupTop_2006230319 {\n color: inherit;\n font-weight: 600;\n}\n\n.menuGroupLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.menuGroupChevron_2006230319 {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 12px;\n height: 12px;\n transition: transform 120ms ease;\n}\n\n.menuGroupChevronOpen_2006230319 {\n transform: rotate(90deg);\n}\n\n.menuGroupCount_2006230319 {\n flex-shrink: 0;\n font-size: 12px;\n line-height: 20px;\n font-weight: 400;\n color: color-mix(in srgb, currentColor 55%, transparent);\n}\n\n/* Zero-search-hit state: centered secondary line inside the rows area. */\n.menuEmpty_2006230319 {\n padding: 10px 8px;\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary, #81858c);\n text-align: center;\n}\n\n/* Bottom-pinned search field, separated from the rows by a hairline.\n * Borderless so it reads as part of the card, focus shown as the\n * standard hover tint rather than an outline. */\n.menuSearchWrap_2006230319 {\n flex-shrink: 0;\n margin-top: 2px;\n padding-top: 4px;\n border-top: 0.5px solid color-mix(in srgb, currentColor 12%, transparent);\n}\n\n.menuSearch_2006230319 {\n box-sizing: border-box; /* width:100% + padding must stay inside the wrap */\n width: 100%;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuRow_2006230319) — the portal\n * escapes the composer's font context and would inherit body's 400. */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuSearch_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuSearch_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* ── Create/rename flyouts (BranchMenu row context menu) ────────────\n * Open IN PLACE of the row menu (at its point, clamped) and hold the whole\n * flow in one panel: ask line, input, live hint, and the Cancel/confirm\n * pair — typing the name and pressing the button fires in one stroke, no\n * second confirm step. */\n\n/* The naming input inside the flyout: borderless, part of the card, focus\n * shown as the standard hover tint. Fixed width — the popCard is\n * max-content, so a percentage width would chase the input's own default\n * size instead of the design width. */\n.menuCreate_2006230319 {\n box-sizing: border-box;\n width: 248px;\n height: 30px;\n padding: 0 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n /* Weight 500 mirrors the chip's branch label (see .menuSearch_2006230319). */\n font-weight: 500;\n line-height: 20px;\n}\n\n.menuCreate_2006230319::placeholder {\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n.menuCreate_2006230319:focus {\n outline: none;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n.menuCreate_2006230319:disabled {\n opacity: 0.5;\n}\n\n/* The error line under the input — only rendered while the draft is\n * unacceptable with a non-empty reason; the input itself stays neutral,\n * the line carries the state. */\n.menuCreateHintBad_2006230319 {\n margin: 0;\n padding: 0 8px;\n font-size: 12px;\n line-height: 16px;\n color: var(--dsw-alias-label-error);\n}\n\n/* ── Row context menu (BranchMenu right-click) ─────────────────────\n * Cursor-anchored transient over the branch card: translucent menu chrome\n * (--dsw-specific-menu with --dsw-menu-backdrop-filter, elevation-prominent hairline,\n * lv3 fallback) at a smaller radius — r20 would round a launcher this\n * short into a pill, r12 keeps the corners proportionate to a handful of\n * rows (two on a worktree row, up to six plus a header on a branch row).\n * Width hugs the widest item\n * (shrink-to-fit, no design width) with a generous cap for safety —\n * a launcher reads better snug than stretched. Positioned once at open\n * and dismissed rather than re-placed when the page moves (see\n * BranchMenu's ctx placement pass); z-index one step above the popCard so\n * it never slides under the confirm flyout. */\n.ctxCard_2006230319 {\n box-sizing: border-box;\n position: fixed;\n z-index: 1001;\n width: max-content;\n max-width: 280px;\n padding: 4px;\n border: 0;\n border-radius: 12px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n/* The target row's name, above the verbs. Unlike the items this one holds\n * a branch name, so it is the one line allowed to hit the 280px cap and\n * ellipsize (the full name rides in a title). Secondary tone and no hover\n * affordance: it is a label, not a seventh item. */\n.ctxHeader_2006230319 {\n padding: 4px 8px 2px;\n font-size: 12px;\n line-height: 16px;\n color: var(--dsw-alias-label-secondary);\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n/* Menu-item rows: the .menuRow_2006230319 geometry at a hair lighter weight — a\n * launcher's labels read as commands, not data. nowrap: the labels are\n * fixed copy (no branch names), the 280px cap is unreachable by design. */\n.ctxItem_2006230319 {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 28px;\n padding: 4px 8px;\n border: none;\n border-radius: 8px;\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 20px;\n text-align: left;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.ctxItem_2006230319:hover,\n.ctxItem_2006230319:focus-visible {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n}\n\n/* The running-session withhold (worktree removal): a disabled item stays\n * visible — the reason it is missing lives on its hover title, and a verb\n * that appears and disappears with session state reads as a bug, not a\n * rule. No hover tint, no pointer; the label dims instead of vanishing. */\n.ctxItem_2006230319:disabled {\n cursor: default;\n opacity: 0.45;\n}\n\n.ctxItem_2006230319:disabled:hover {\n background: transparent;\n}\n\n/* The arrow-key walk lands here, so the focused item must read as strongly\n * as a hovered one — the tint above carries it, the default ring would sit\n * outside the 8px radius. */\n.ctxItem_2006230319:focus-visible {\n outline: none;\n}\n\n/* Leading glyph rides the label tone, a step quieter. */\n.ctxItem_2006230319 svg {\n flex-shrink: 0;\n opacity: 0.75;\n}\n\n.ctxItemLabel_2006230319 {\n flex: 1 1 0;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.menuCard_2006230319.menuCardGraph_2006230319 {\n width: min(1060px, calc(100vw - 24px));\n height: 700px;\n}\n.menuCardGraph_2006230319 .menuMain_2006230319 { flex: 0 0 236px; }\n.menuToolActive_2006230319 { color: var(--dsw-alias-label-primary-bluish, #4186f0); background: color-mix(in srgb, var(--dsw-alias-label-primary-bluish, #4186f0) 12%, transparent); }\n@media (max-width: 800px) { .menuCardGraph_2006230319 .menuMain_2006230319 { flex-basis: 180px; } }\n@media (max-width: 560px) { .menuCardGraph_2006230319 .menuMain_2006230319 { flex-basis: 128px; } }\n";
|
|
2049
|
+
const tagId$3 = "@laoyuehanni/dsh-git-worktree/BranchChip.module.css";
|
|
2050
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$3 + "\"]") === null) {
|
|
647
2051
|
const tag = document.createElement("style");
|
|
648
2052
|
tag.dataset.plugin = "@laoyuehanni/dsh-git-worktree";
|
|
649
|
-
tag.dataset.pluginCss = tagId$
|
|
650
|
-
tag.textContent = css$
|
|
2053
|
+
tag.dataset.pluginCss = tagId$3;
|
|
2054
|
+
tag.textContent = css$3;
|
|
651
2055
|
document.head.appendChild(tag);
|
|
652
2056
|
}
|
|
653
2057
|
var BranchChip_module_default = {
|
|
@@ -677,6 +2081,10 @@ window.__ModuleLoader__.load({
|
|
|
677
2081
|
"menuRowPicked": "menuRowPicked_2006230319",
|
|
678
2082
|
"menuRowLabel": "menuRowLabel_2006230319",
|
|
679
2083
|
"menuRowArrow": "menuRowArrow_2006230319",
|
|
2084
|
+
"menuRowAhead": "menuRowAhead_2006230319",
|
|
2085
|
+
"menuRowBehind": "menuRowBehind_2006230319",
|
|
2086
|
+
"menuRowGone": "menuRowGone_2006230319",
|
|
2087
|
+
"menuRowOutgoing": "menuRowOutgoing_2006230319",
|
|
680
2088
|
"menuSearchMark": "menuSearchMark_2006230319",
|
|
681
2089
|
"menuGroup": "menuGroup_2006230319",
|
|
682
2090
|
"menuGroupTop": "menuGroupTop_2006230319",
|
|
@@ -692,7 +2100,9 @@ window.__ModuleLoader__.load({
|
|
|
692
2100
|
"ctxCard": "ctxCard_2006230319",
|
|
693
2101
|
"ctxHeader": "ctxHeader_2006230319",
|
|
694
2102
|
"ctxItem": "ctxItem_2006230319",
|
|
695
|
-
"ctxItemLabel": "ctxItemLabel_2006230319"
|
|
2103
|
+
"ctxItemLabel": "ctxItemLabel_2006230319",
|
|
2104
|
+
"menuCardGraph": "menuCardGraph_2006230319",
|
|
2105
|
+
"menuToolActive": "menuToolActive_2006230319"
|
|
696
2106
|
};
|
|
697
2107
|
//#endregion
|
|
698
2108
|
//#region src/client/BranchMenu.tsx
|
|
@@ -796,9 +2206,11 @@ window.__ModuleLoader__.load({
|
|
|
796
2206
|
* fast-forward) — the pairing is IDEA's dashed/solid synchronize/update
|
|
797
2207
|
* language. The base library has no such glyph, so both are drawn here,
|
|
798
2208
|
* local to the menu; the sync spin animation targets `svg` descendants of
|
|
799
|
-
* the tool button and applies to them unchanged.
|
|
2209
|
+
* the tool button and applies to them unchanged. `weight` is the stroke
|
|
2210
|
+
* width in viewBox units: the 12px row marks draw heavier than the 14–16px
|
|
2211
|
+
* tool icons so a thin diagonal stays legible at that size.
|
|
800
2212
|
*/
|
|
801
|
-
function FetchGlyph({ size = 16, dashed = true }) {
|
|
2213
|
+
function FetchGlyph({ size = 16, dashed = true, weight = 1.3 }) {
|
|
802
2214
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
803
2215
|
width: size,
|
|
804
2216
|
height: size,
|
|
@@ -808,18 +2220,20 @@ window.__ModuleLoader__.load({
|
|
|
808
2220
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
809
2221
|
d: "M13 3 L5.9 10.1",
|
|
810
2222
|
stroke: "currentColor",
|
|
811
|
-
strokeWidth:
|
|
2223
|
+
strokeWidth: weight,
|
|
812
2224
|
strokeLinecap: "round",
|
|
813
2225
|
strokeDasharray: dashed ? "2.4 1.6" : void 0
|
|
814
2226
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
815
2227
|
d: "M5 5.9 V11 H10.1",
|
|
816
2228
|
stroke: "currentColor",
|
|
817
|
-
strokeWidth:
|
|
2229
|
+
strokeWidth: weight,
|
|
818
2230
|
strokeLinecap: "round",
|
|
819
2231
|
strokeLinejoin: "round"
|
|
820
2232
|
})]
|
|
821
2233
|
});
|
|
822
2234
|
}
|
|
2235
|
+
/** Stroke weight of the 12px ahead/behind marks: same size as before, a heavier line. */
|
|
2236
|
+
const ROW_MARK_WEIGHT = 2.2;
|
|
823
2237
|
/** Viewport edge clearance, mirroring the base Menu portal margin. */
|
|
824
2238
|
const MARGIN = 12;
|
|
825
2239
|
/** Gap kept between the chip's top edge and the card's bottom edge. */
|
|
@@ -940,8 +2354,21 @@ window.__ModuleLoader__.load({
|
|
|
940
2354
|
* @param props - anchor, rows, confirm bundle, callbacks, and the class sheet.
|
|
941
2355
|
* @returns null while closed or unplaced; otherwise the portaled card (+flyout).
|
|
942
2356
|
*/
|
|
943
|
-
function BranchMenu({ open, anchorRef, rows, currentBranch, confirm, onSelect, canCreate, canAdopt, canWorktree, onWorktree, onCutWorktree, onRemoveWorktree, worktreeRemovalBlocked, onCreate, onRename, onDelete, busy, onFetch, fetchBusy, onUpdate, updateBusy, onClose, t }) {
|
|
2357
|
+
function BranchMenu({ open, repoPath, anchorRef, rows, currentBranch, confirm, onSelect, canCreate, canAdopt, canWorktree, onWorktree, onCutWorktree, onRemoveWorktree, worktreeRemovalBlocked, onCreate, onRename, onDelete, busy, onFetch, fetchBusy, onUpdate, onPush, hasRemotes, updateBusy, onClose, t }) {
|
|
944
2358
|
const cardRef = (0, react.useRef)(null);
|
|
2359
|
+
const [graphOpen, setGraphOpen] = (0, react.useState)(false);
|
|
2360
|
+
const graphOpenRef = (0, react.useRef)(graphOpen);
|
|
2361
|
+
graphOpenRef.current = graphOpen;
|
|
2362
|
+
const graphEscapeRef = (0, react.useRef)(null);
|
|
2363
|
+
const graphAnimationRef = (0, react.useRef)(null);
|
|
2364
|
+
const graphStartRectRef = (0, react.useRef)(null);
|
|
2365
|
+
const changeGraphOpen = (0, react.useCallback)((value) => {
|
|
2366
|
+
if (value === graphOpenRef.current) return;
|
|
2367
|
+
graphStartRectRef.current = cardRef.current?.getBoundingClientRect() ?? null;
|
|
2368
|
+
graphAnimationRef.current?.cancel();
|
|
2369
|
+
graphAnimationRef.current = null;
|
|
2370
|
+
setGraphOpen(value);
|
|
2371
|
+
}, []);
|
|
945
2372
|
const inputRef = (0, react.useRef)(null);
|
|
946
2373
|
/**
|
|
947
2374
|
* Search-field ref callback: focus the field the moment it mounts. The
|
|
@@ -1138,6 +2565,9 @@ window.__ModuleLoader__.load({
|
|
|
1138
2565
|
if (remote !== void 0) return remote;
|
|
1139
2566
|
return null;
|
|
1140
2567
|
};
|
|
2568
|
+
const browsingRow = selected === null ? null : findRow(selected);
|
|
2569
|
+
const browsingBranch = browsingRow?.kind === "remote" ? grouped.remoteNameMap.get(browsingRow.name) ?? browsingRow.name : browsingRow?.name ?? currentBranch;
|
|
2570
|
+
const browsingRef = browsingRow?.kind === "remote" ? `refs/remotes/${browsingBranch}` : browsingBranch && browsingBranch !== "HEAD" ? `refs/heads/${browsingBranch}` : "HEAD";
|
|
1141
2571
|
/** Every folder key that renders a header — the expand/collapse-all
|
|
1142
2572
|
* button's scope (group-prefixed, see groupKey). */
|
|
1143
2573
|
const folderPaths = (0, react.useMemo)(() => [...collectFolderPaths(localTree).map((p) => groupKey("local", p)), ...collectFolderPaths(remoteTree).map((p) => groupKey("remote", p))], [localTree, remoteTree]);
|
|
@@ -1181,8 +2611,12 @@ window.__ModuleLoader__.load({
|
|
|
1181
2611
|
setExpanded(many ? new Set([...chainExpanded(currentBranchRef.current)].map((p) => groupKey("local", p))) : /* @__PURE__ */ new Set([...localPaths, ...remotePaths]));
|
|
1182
2612
|
}, [open]);
|
|
1183
2613
|
(0, react.useEffect)(() => {
|
|
1184
|
-
if (selected !== null && !rows.some((r) => r.name === selected)) setSelected(null);
|
|
1185
|
-
}, [
|
|
2614
|
+
if (selected !== null && !rows.some((r) => r.name === selected) && !grouped.remoteNameMap.has(selected)) setSelected(null);
|
|
2615
|
+
}, [
|
|
2616
|
+
rows,
|
|
2617
|
+
selected,
|
|
2618
|
+
grouped.remoteNameMap
|
|
2619
|
+
]);
|
|
1186
2620
|
/** Toggle one folder header. */
|
|
1187
2621
|
const toggle = (path) => {
|
|
1188
2622
|
setExpanded((prev) => {
|
|
@@ -1198,26 +2632,89 @@ window.__ModuleLoader__.load({
|
|
|
1198
2632
|
setCtx(null);
|
|
1199
2633
|
return;
|
|
1200
2634
|
}
|
|
2635
|
+
let previousBounds = "";
|
|
1201
2636
|
const place = () => {
|
|
1202
2637
|
const anchor = anchorRef.current;
|
|
1203
2638
|
if (anchor === null) return;
|
|
1204
2639
|
const rect = anchor.getBoundingClientRect();
|
|
1205
2640
|
const vw = window.innerWidth;
|
|
1206
2641
|
const vh = window.innerHeight;
|
|
1207
|
-
const
|
|
2642
|
+
const bounds = anchor.closest("[data-composer-card]")?.getBoundingClientRect() ?? rect;
|
|
2643
|
+
const lowerEdge = Math.min(vh - MARGIN, bounds.top - GAP);
|
|
2644
|
+
const nextBounds = [
|
|
2645
|
+
vw,
|
|
2646
|
+
vh,
|
|
2647
|
+
bounds.left,
|
|
2648
|
+
bounds.top,
|
|
2649
|
+
bounds.width
|
|
2650
|
+
].join(":");
|
|
2651
|
+
if (nextBounds !== previousBounds) {
|
|
2652
|
+
graphAnimationRef.current?.cancel();
|
|
2653
|
+
graphAnimationRef.current = null;
|
|
2654
|
+
previousBounds = nextBounds;
|
|
2655
|
+
}
|
|
2656
|
+
if (graphOpen) {
|
|
2657
|
+
const width = Math.max(0, Math.min(1060, bounds.width, vw - 24));
|
|
2658
|
+
const height = Math.max(0, Math.min(700, lowerEdge - MARGIN));
|
|
2659
|
+
const left = Math.min(Math.max(bounds.left + (bounds.width - width) / 2, MARGIN), Math.max(MARGIN, vw - width - MARGIN));
|
|
2660
|
+
const bottomEdge = Math.min((vh + height) / 2, lowerEdge);
|
|
2661
|
+
setPos({
|
|
2662
|
+
left,
|
|
2663
|
+
width,
|
|
2664
|
+
height,
|
|
2665
|
+
bottom: vh - bottomEdge
|
|
2666
|
+
});
|
|
2667
|
+
return;
|
|
2668
|
+
}
|
|
2669
|
+
const width = CARD_WIDTH;
|
|
2670
|
+
const left = Math.min(Math.max(rect.left, MARGIN), Math.max(MARGIN, vw - width - MARGIN));
|
|
1208
2671
|
setPos({
|
|
1209
2672
|
left,
|
|
1210
|
-
bottom: vh -
|
|
2673
|
+
bottom: vh - lowerEdge
|
|
1211
2674
|
});
|
|
1212
2675
|
};
|
|
1213
2676
|
place();
|
|
2677
|
+
const observer = new ResizeObserver(place);
|
|
2678
|
+
const composer = anchorRef.current?.closest("[data-composer-card]");
|
|
2679
|
+
const conversation = anchorRef.current?.closest("[data-conversation-content]");
|
|
2680
|
+
if (composer) observer.observe(composer);
|
|
2681
|
+
if (conversation) observer.observe(conversation);
|
|
1214
2682
|
window.addEventListener("resize", place);
|
|
1215
2683
|
window.addEventListener("scroll", place, true);
|
|
1216
2684
|
return () => {
|
|
2685
|
+
observer.disconnect();
|
|
1217
2686
|
window.removeEventListener("resize", place);
|
|
1218
2687
|
window.removeEventListener("scroll", place, true);
|
|
1219
2688
|
};
|
|
1220
|
-
}, [
|
|
2689
|
+
}, [
|
|
2690
|
+
open,
|
|
2691
|
+
anchorRef,
|
|
2692
|
+
graphOpen
|
|
2693
|
+
]);
|
|
2694
|
+
(0, react.useLayoutEffect)(() => {
|
|
2695
|
+
const from = graphStartRectRef.current;
|
|
2696
|
+
graphStartRectRef.current = null;
|
|
2697
|
+
const card = cardRef.current;
|
|
2698
|
+
if (!open || !from || !card || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
2699
|
+
const to = card.getBoundingClientRect();
|
|
2700
|
+
const frame = (rect) => ({
|
|
2701
|
+
left: `${rect.left}px`,
|
|
2702
|
+
width: `${rect.width}px`,
|
|
2703
|
+
bottom: `${window.innerHeight - rect.bottom}px`,
|
|
2704
|
+
height: `${rect.height}px`,
|
|
2705
|
+
maxHeight: `${rect.height}px`
|
|
2706
|
+
});
|
|
2707
|
+
graphAnimationRef.current = card.animate([frame(from), frame(to)], {
|
|
2708
|
+
id: "dsh-branch-graph",
|
|
2709
|
+
duration: 220,
|
|
2710
|
+
easing: "ease"
|
|
2711
|
+
});
|
|
2712
|
+
}, [pos, open]);
|
|
2713
|
+
(0, react.useLayoutEffect)(() => () => {
|
|
2714
|
+
graphAnimationRef.current?.cancel();
|
|
2715
|
+
graphAnimationRef.current = null;
|
|
2716
|
+
graphStartRectRef.current = null;
|
|
2717
|
+
}, [open]);
|
|
1221
2718
|
const rowsRef = (0, react.useRef)(null);
|
|
1222
2719
|
const centerCurrentRow = (0, react.useCallback)((viewport) => {
|
|
1223
2720
|
const row = [...viewport.querySelectorAll("button[role=\"menuitem\"][data-branch]")].find((b) => (b.dataset.branch ?? "") === currentBranch);
|
|
@@ -1345,6 +2842,11 @@ window.__ModuleLoader__.load({
|
|
|
1345
2842
|
setRenaming(null);
|
|
1346
2843
|
return;
|
|
1347
2844
|
}
|
|
2845
|
+
if (graphOpenRef.current && graphEscapeRef.current?.()) {
|
|
2846
|
+
event.preventDefault();
|
|
2847
|
+
event.stopPropagation();
|
|
2848
|
+
return;
|
|
2849
|
+
}
|
|
1348
2850
|
if (queryRef.current.trim() !== "") {
|
|
1349
2851
|
setQuery("");
|
|
1350
2852
|
return;
|
|
@@ -1359,6 +2861,7 @@ window.__ModuleLoader__.load({
|
|
|
1359
2861
|
const card = cardRef.current;
|
|
1360
2862
|
const active = document.activeElement;
|
|
1361
2863
|
if (card === null || active === null || !card.contains(active)) return;
|
|
2864
|
+
if (active.closest("[data-commit-history]") !== null || active.closest("[role=\"toolbar\"]") !== null) return;
|
|
1362
2865
|
if (ctxStateRef.current !== null) return;
|
|
1363
2866
|
const leaves = [...card.querySelectorAll("button[role=\"menuitem\"][data-branch]")];
|
|
1364
2867
|
const isSearchInput = inputRef.current !== null && active === inputRef.current;
|
|
@@ -1401,7 +2904,8 @@ window.__ModuleLoader__.load({
|
|
|
1401
2904
|
},
|
|
1402
2905
|
onPick: (branch) => {
|
|
1403
2906
|
const el = leaves.find((b) => (b.dataset.branch ?? "") === branch) ?? buttonOf(branch);
|
|
1404
|
-
|
|
2907
|
+
if (graphOpenRef.current) setSelected(branch);
|
|
2908
|
+
else pickRef.current(el, branch);
|
|
1405
2909
|
},
|
|
1406
2910
|
onSelect: (branch) => {
|
|
1407
2911
|
setSelected(branch);
|
|
@@ -1515,24 +3019,50 @@ window.__ModuleLoader__.load({
|
|
|
1515
3019
|
if (name === selected) cls += ` ${BranchChip_module_default.menuRowPicked}`;
|
|
1516
3020
|
return cls;
|
|
1517
3021
|
};
|
|
1518
|
-
/**
|
|
1519
|
-
*
|
|
1520
|
-
*
|
|
1521
|
-
*
|
|
3022
|
+
/** IDEA colors and direction; what shows is decided by `syncMark` (an
|
|
3023
|
+
* unpublished branch gets an unnumbered green arrow, but only in a
|
|
3024
|
+
* repository that has a remote; a deleted upstream is a different,
|
|
3025
|
+
* explicitly warned state). */
|
|
1522
3026
|
const renderArrows = (row) => {
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
if (
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
}
|
|
1535
|
-
|
|
3027
|
+
const mark = row === null ? null : syncMark(row, hasRemotes);
|
|
3028
|
+
if (mark === null) return null;
|
|
3029
|
+
if (mark.kind === "gone") {
|
|
3030
|
+
const title = t("upstreamGoneTitle", { upstream: mark.upstream });
|
|
3031
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3032
|
+
className: `${BranchChip_module_default.menuRowArrow} ${BranchChip_module_default.menuRowGone}`,
|
|
3033
|
+
role: "img",
|
|
3034
|
+
"aria-label": title,
|
|
3035
|
+
title,
|
|
3036
|
+
children: "!"
|
|
3037
|
+
});
|
|
3038
|
+
}
|
|
3039
|
+
const { outgoing, incoming } = mark;
|
|
3040
|
+
const outgoingTitle = outgoing === null ? "" : outgoing === "unpublished" ? t("unpublishedTitle") : t(outgoing === 1 ? "aheadTitle.one" : "aheadTitle.other", { n: outgoing });
|
|
3041
|
+
const incomingTitle = incoming === null ? "" : t(incoming === 1 ? "behindTitle.one" : "behindTitle.other", { n: incoming });
|
|
3042
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [outgoing !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3043
|
+
className: `${BranchChip_module_default.menuRowArrow} ${BranchChip_module_default.menuRowAhead}`,
|
|
3044
|
+
role: "img",
|
|
3045
|
+
"aria-label": outgoingTitle,
|
|
3046
|
+
title: outgoingTitle,
|
|
3047
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3048
|
+
className: BranchChip_module_default.menuRowOutgoing,
|
|
3049
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, {
|
|
3050
|
+
size: 12,
|
|
3051
|
+
dashed: false,
|
|
3052
|
+
weight: ROW_MARK_WEIGHT
|
|
3053
|
+
})
|
|
3054
|
+
}), outgoing !== "unpublished" && outgoing]
|
|
3055
|
+
}), incoming !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3056
|
+
className: `${BranchChip_module_default.menuRowArrow} ${BranchChip_module_default.menuRowBehind}`,
|
|
3057
|
+
role: "img",
|
|
3058
|
+
"aria-label": incomingTitle,
|
|
3059
|
+
title: incomingTitle,
|
|
3060
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, {
|
|
3061
|
+
size: 12,
|
|
3062
|
+
dashed: false,
|
|
3063
|
+
weight: ROW_MARK_WEIGHT
|
|
3064
|
+
}), incoming]
|
|
3065
|
+
})] });
|
|
1536
3066
|
};
|
|
1537
3067
|
/** A row's click behavior: with a dialog open (delete confirm or a
|
|
1538
3068
|
* worktree pick), clicking a row re-picks it (the flyout re-anchors);
|
|
@@ -1541,7 +3071,10 @@ window.__ModuleLoader__.load({
|
|
|
1541
3071
|
* `el` is nullable like {@link pick}'s anchor: a row whose button is
|
|
1542
3072
|
* already unmounted still selects/picks, it just re-anchors nothing. */
|
|
1543
3073
|
const rowClick = (el, name) => {
|
|
1544
|
-
if (
|
|
3074
|
+
if (graphOpen) {
|
|
3075
|
+
confirmRef.current?.onCancel();
|
|
3076
|
+
setSelected(name);
|
|
3077
|
+
} else if (confirmOpen) pick(el, name);
|
|
1545
3078
|
else setSelected(name);
|
|
1546
3079
|
};
|
|
1547
3080
|
/** Shared row pointer wiring — the three render shapes (tree leaf, flat
|
|
@@ -1875,8 +3408,12 @@ window.__ModuleLoader__.load({
|
|
|
1875
3408
|
* 新建分支并创建工作树 (the owner's cutout dialog, name typed by hand,
|
|
1876
3409
|
* cut from THIS row); a started session drops them — its directory is
|
|
1877
3410
|
* fixed. Copy is client-only (WYSIWYG display names; a successful write
|
|
1878
|
-
* toasts the shared copied label).
|
|
1879
|
-
*
|
|
3411
|
+
* toasts the shared copied label). 推送, with 更新 (current branch with a
|
|
3412
|
+
* live upstream) directly above it, sits BETWEEN the verbs that check out
|
|
3413
|
+
* / create (签出 … 新建分支并创建工作树) and the ones that rewrite or delete
|
|
3414
|
+
* (重命名分支, 删除分支, 复制分支); on a worktree row the pair follows the
|
|
3415
|
+
* hop. The menu opens NEITHER select NOR pick — it launches, never
|
|
3416
|
+
* re-semantics. */
|
|
1880
3417
|
const ctxItems = [];
|
|
1881
3418
|
if (ctx !== null) {
|
|
1882
3419
|
const { row, name, x, y } = ctx;
|
|
@@ -1888,6 +3425,34 @@ window.__ModuleLoader__.load({
|
|
|
1888
3425
|
y
|
|
1889
3426
|
};
|
|
1890
3427
|
};
|
|
3428
|
+
const syncVerbs = row === null ? [] : syncActions(row, currentBranch);
|
|
3429
|
+
const addSync = () => {
|
|
3430
|
+
if (syncVerbs.includes("update")) ctxItems.push({
|
|
3431
|
+
id: "update",
|
|
3432
|
+
label: t("menuUpdate"),
|
|
3433
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, {
|
|
3434
|
+
size: 14,
|
|
3435
|
+
dashed: false
|
|
3436
|
+
}),
|
|
3437
|
+
run: () => {
|
|
3438
|
+
setCtx(null);
|
|
3439
|
+
onUpdate();
|
|
3440
|
+
}
|
|
3441
|
+
});
|
|
3442
|
+
if (!syncVerbs.includes("push")) return;
|
|
3443
|
+
ctxItems.push({
|
|
3444
|
+
id: "push",
|
|
3445
|
+
label: t("ctxPush"),
|
|
3446
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRightUpOutlineRegular, { size: 14 }),
|
|
3447
|
+
run: () => {
|
|
3448
|
+
confirmRef.current?.onCancel();
|
|
3449
|
+
setCreating(false);
|
|
3450
|
+
setRenaming(null);
|
|
3451
|
+
setCtx(null);
|
|
3452
|
+
onPush(name);
|
|
3453
|
+
}
|
|
3454
|
+
});
|
|
3455
|
+
};
|
|
1891
3456
|
const openCreate = (checkout) => {
|
|
1892
3457
|
confirmRef.current?.onCancel();
|
|
1893
3458
|
setRenaming(null);
|
|
@@ -1910,6 +3475,7 @@ window.__ModuleLoader__.load({
|
|
|
1910
3475
|
pick(buttonOf(name), name, true);
|
|
1911
3476
|
}
|
|
1912
3477
|
});
|
|
3478
|
+
addSync();
|
|
1913
3479
|
ctxItems.push({
|
|
1914
3480
|
id: "copy",
|
|
1915
3481
|
label: t("ctxCopyPath"),
|
|
@@ -1996,6 +3562,7 @@ window.__ModuleLoader__.load({
|
|
|
1996
3562
|
}
|
|
1997
3563
|
});
|
|
1998
3564
|
}
|
|
3565
|
+
addSync();
|
|
1999
3566
|
if (canCreate) {
|
|
2000
3567
|
if (row?.kind !== "remote") {
|
|
2001
3568
|
ctxItems.push({
|
|
@@ -2071,108 +3638,164 @@ window.__ModuleLoader__.load({
|
|
|
2071
3638
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
2072
3639
|
(0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2073
3640
|
ref: cardRef,
|
|
2074
|
-
className: BranchChip_module_default.menuCard
|
|
3641
|
+
className: `${BranchChip_module_default.menuCard} ${graphOpen ? BranchChip_module_default.menuCardGraph : ""}`,
|
|
2075
3642
|
style: {
|
|
2076
3643
|
left: pos.left,
|
|
2077
|
-
bottom: pos.bottom
|
|
3644
|
+
bottom: pos.bottom,
|
|
3645
|
+
width: graphOpen ? pos.width : void 0,
|
|
3646
|
+
height: graphOpen ? pos.height : void 0,
|
|
3647
|
+
maxHeight: graphOpen ? pos.height : `max(0px, min(420px, 60vh, calc(100dvh - ${pos.bottom + MARGIN}px)))`
|
|
2078
3648
|
},
|
|
2079
|
-
role: "menu",
|
|
3649
|
+
role: graphOpen ? "dialog" : "menu",
|
|
2080
3650
|
"aria-label": t("menuBranches"),
|
|
2081
|
-
children: [
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
disabled: busy || fetchBusy,
|
|
2100
|
-
onClick: () => {
|
|
2101
|
-
confirmRef.current?.onCancel();
|
|
2102
|
-
onUpdate();
|
|
2103
|
-
},
|
|
2104
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, { dashed: false })
|
|
2105
|
-
}),
|
|
2106
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2107
|
-
type: "button",
|
|
2108
|
-
className: fetchBusy ? `${BranchChip_module_default.menuToolButton} ${BranchChip_module_default.menuToolButtonRunning}` : BranchChip_module_default.menuToolButton,
|
|
2109
|
-
title: t("menuFetch"),
|
|
2110
|
-
"aria-label": t("menuFetch"),
|
|
2111
|
-
disabled: busy || updateBusy,
|
|
2112
|
-
onClick: () => {
|
|
2113
|
-
confirmRef.current?.onCancel();
|
|
2114
|
-
onFetch();
|
|
2115
|
-
},
|
|
2116
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, {})
|
|
2117
|
-
}),
|
|
2118
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2119
|
-
type: "button",
|
|
2120
|
-
className: BranchChip_module_default.menuToolButton,
|
|
2121
|
-
title: allExpanded ? t("menuCollapseAll") : t("menuExpandAll"),
|
|
2122
|
-
"aria-label": allExpanded ? t("menuCollapseAll") : t("menuExpandAll"),
|
|
2123
|
-
disabled: rows.length === 0 || needle !== "",
|
|
2124
|
-
onClick: toggleAll,
|
|
2125
|
-
children: allExpanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronUpOutlineRegular, { size: 14 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: 14 })
|
|
2126
|
-
})
|
|
2127
|
-
]
|
|
2128
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2129
|
-
className: BranchChip_module_default.menuMain,
|
|
2130
|
-
children: [
|
|
2131
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2132
|
-
className: BranchChip_module_default.menuHeading,
|
|
2133
|
-
children: t("menuBranches")
|
|
2134
|
-
}),
|
|
2135
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2136
|
-
className: BranchChip_module_default.menuRows,
|
|
2137
|
-
role: "presentation",
|
|
2138
|
-
ref: holdRowsCenter,
|
|
2139
|
-
children: [needle === "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
2140
|
-
grouped.localRows.length > 0 && renderGroupHeader(t("menuLocalBranches"), grouped.localRows.length, localGroupOpen, () => setLocalGroupOpen((value) => !value)),
|
|
2141
|
-
localGroupOpen && renderTree(localTree, 1, "local:"),
|
|
2142
|
-
pickableWorktreeRows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuWorktrees"), pickableWorktreeRows.length, worktreeGroupOpen, () => setWorktreeGroupOpen((value) => !value)), worktreeGroupOpen && pickableWorktreeRows.map((row) => renderFlatLeaf(row, "worktree:"))] }),
|
|
2143
|
-
grouped.remoteDisplayRows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuRemoteBranches"), grouped.remoteDisplayRows.length, remoteGroupOpen, () => setRemoteGroupOpen((value) => !value)), remoteGroupOpen && renderTree(remoteTree, 1, "remote:")] })
|
|
2144
|
-
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
2145
|
-
grouped.localRows.some((row) => row.name.toLowerCase().includes(needle)) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuLocalBranches"), searchLeafCount(localTree), true), renderSearch(localTree, 1, "local:")] }),
|
|
2146
|
-
pickableWorktreeRows.some((row) => row.name.toLowerCase().includes(needle)) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuWorktrees"), pickableWorktreeRows.filter((row) => row.name.toLowerCase().includes(needle)).length, true), pickableWorktreeRows.filter((row) => row.name.toLowerCase().includes(needle)).map((row) => renderFlatLeaf(row, "worktree:"))] }),
|
|
2147
|
-
grouped.remoteDisplayRows.some((row) => row.name.toLowerCase().includes(needle)) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuRemoteBranches"), searchLeafCount(remoteTree), true), renderSearch(remoteTree, 1, "remote:")] })
|
|
2148
|
-
] }), visible.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2149
|
-
className: BranchChip_module_default.menuEmpty,
|
|
2150
|
-
children: rows.length === 0 ? t("menuNoBranches") : t("menuNoMatches")
|
|
2151
|
-
})]
|
|
2152
|
-
}),
|
|
2153
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2154
|
-
className: BranchChip_module_default.menuSearchWrap,
|
|
2155
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2156
|
-
ref: holdSearchFocus,
|
|
2157
|
-
className: BranchChip_module_default.menuSearch,
|
|
2158
|
-
type: "text",
|
|
2159
|
-
value: query,
|
|
2160
|
-
placeholder: t("menuSearchPlaceholder"),
|
|
2161
|
-
"aria-label": t("menuSearchPlaceholder"),
|
|
2162
|
-
spellCheck: false,
|
|
2163
|
-
onChange: (event) => {
|
|
2164
|
-
setQuery(event.target.value);
|
|
3651
|
+
children: [
|
|
3652
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3653
|
+
className: BranchChip_module_default.menuToolbar,
|
|
3654
|
+
role: "toolbar",
|
|
3655
|
+
"aria-label": t("menuBranches"),
|
|
3656
|
+
children: [
|
|
3657
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3658
|
+
type: "button",
|
|
3659
|
+
className: `${BranchChip_module_default.menuToolButton} ${graphOpen ? BranchChip_module_default.menuToolActive : ""}`,
|
|
3660
|
+
title: t(graphOpen ? "graphToggleClose" : "graphToggleOpen"),
|
|
3661
|
+
"aria-label": t(graphOpen ? "graphToggleClose" : "graphToggleOpen"),
|
|
3662
|
+
"aria-pressed": graphOpen,
|
|
3663
|
+
onClick: () => {
|
|
3664
|
+
confirmRef.current?.onCancel();
|
|
3665
|
+
setCreating(false);
|
|
3666
|
+
setRenaming(null);
|
|
3667
|
+
setCtx(null);
|
|
3668
|
+
changeGraphOpen(!graphOpen);
|
|
2165
3669
|
},
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
3670
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
3671
|
+
width: "16",
|
|
3672
|
+
height: "16",
|
|
3673
|
+
viewBox: "0 0 16 16",
|
|
3674
|
+
fill: "none",
|
|
3675
|
+
stroke: "currentColor",
|
|
3676
|
+
strokeWidth: "1.4",
|
|
3677
|
+
"aria-hidden": "true",
|
|
3678
|
+
children: [
|
|
3679
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 4v8M12 4v2c0 3-8 1-8 5" }),
|
|
3680
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
3681
|
+
cx: "4",
|
|
3682
|
+
cy: "3",
|
|
3683
|
+
r: "1.8"
|
|
3684
|
+
}),
|
|
3685
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
3686
|
+
cx: "4",
|
|
3687
|
+
cy: "13",
|
|
3688
|
+
r: "1.8"
|
|
3689
|
+
}),
|
|
3690
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
3691
|
+
cx: "12",
|
|
3692
|
+
cy: "3",
|
|
3693
|
+
r: "1.8"
|
|
3694
|
+
})
|
|
3695
|
+
]
|
|
3696
|
+
})
|
|
3697
|
+
}),
|
|
3698
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3699
|
+
type: "button",
|
|
3700
|
+
className: BranchChip_module_default.menuToolButton,
|
|
3701
|
+
title: t("menuLocate"),
|
|
3702
|
+
"aria-label": t("menuLocate"),
|
|
3703
|
+
onClick: locateCurrent,
|
|
3704
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGoalOutlineRegular, { size: 16 })
|
|
3705
|
+
}),
|
|
3706
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3707
|
+
type: "button",
|
|
3708
|
+
className: updateBusy ? `${BranchChip_module_default.menuToolButton} ${BranchChip_module_default.menuToolButtonRunning}` : BranchChip_module_default.menuToolButton,
|
|
3709
|
+
title: t("menuUpdate"),
|
|
3710
|
+
"aria-label": t("menuUpdate"),
|
|
3711
|
+
disabled: busy || fetchBusy,
|
|
3712
|
+
onClick: () => {
|
|
3713
|
+
confirmRef.current?.onCancel();
|
|
3714
|
+
onUpdate();
|
|
3715
|
+
},
|
|
3716
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, { dashed: false })
|
|
3717
|
+
}),
|
|
3718
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3719
|
+
type: "button",
|
|
3720
|
+
className: fetchBusy ? `${BranchChip_module_default.menuToolButton} ${BranchChip_module_default.menuToolButtonRunning}` : BranchChip_module_default.menuToolButton,
|
|
3721
|
+
title: t("menuFetch"),
|
|
3722
|
+
"aria-label": t("menuFetch"),
|
|
3723
|
+
disabled: busy || updateBusy,
|
|
3724
|
+
onClick: () => {
|
|
3725
|
+
confirmRef.current?.onCancel();
|
|
3726
|
+
onFetch();
|
|
3727
|
+
},
|
|
3728
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchGlyph, {})
|
|
3729
|
+
}),
|
|
3730
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3731
|
+
type: "button",
|
|
3732
|
+
className: BranchChip_module_default.menuToolButton,
|
|
3733
|
+
title: allExpanded ? t("menuCollapseAll") : t("menuExpandAll"),
|
|
3734
|
+
"aria-label": allExpanded ? t("menuCollapseAll") : t("menuExpandAll"),
|
|
3735
|
+
disabled: rows.length === 0 || needle !== "",
|
|
3736
|
+
onClick: toggleAll,
|
|
3737
|
+
children: allExpanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronUpOutlineRegular, { size: 14 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: 14 })
|
|
3738
|
+
})
|
|
3739
|
+
]
|
|
3740
|
+
}),
|
|
3741
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3742
|
+
className: BranchChip_module_default.menuMain,
|
|
3743
|
+
children: [
|
|
3744
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3745
|
+
className: BranchChip_module_default.menuHeading,
|
|
3746
|
+
children: t("menuBranches")
|
|
3747
|
+
}),
|
|
3748
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3749
|
+
className: BranchChip_module_default.menuRows,
|
|
3750
|
+
role: "presentation",
|
|
3751
|
+
ref: holdRowsCenter,
|
|
3752
|
+
children: [needle === "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3753
|
+
grouped.localRows.length > 0 && renderGroupHeader(t("menuLocalBranches"), grouped.localRows.length, localGroupOpen, () => setLocalGroupOpen((value) => !value)),
|
|
3754
|
+
localGroupOpen && renderTree(localTree, 1, "local:"),
|
|
3755
|
+
pickableWorktreeRows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuWorktrees"), pickableWorktreeRows.length, worktreeGroupOpen, () => setWorktreeGroupOpen((value) => !value)), worktreeGroupOpen && pickableWorktreeRows.map((row) => renderFlatLeaf(row, "worktree:"))] }),
|
|
3756
|
+
grouped.remoteDisplayRows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuRemoteBranches"), grouped.remoteDisplayRows.length, remoteGroupOpen, () => setRemoteGroupOpen((value) => !value)), remoteGroupOpen && renderTree(remoteTree, 1, "remote:")] })
|
|
3757
|
+
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3758
|
+
grouped.localRows.some((row) => row.name.toLowerCase().includes(needle)) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuLocalBranches"), searchLeafCount(localTree), true), renderSearch(localTree, 1, "local:")] }),
|
|
3759
|
+
pickableWorktreeRows.some((row) => row.name.toLowerCase().includes(needle)) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuWorktrees"), pickableWorktreeRows.filter((row) => row.name.toLowerCase().includes(needle)).length, true), pickableWorktreeRows.filter((row) => row.name.toLowerCase().includes(needle)).map((row) => renderFlatLeaf(row, "worktree:"))] }),
|
|
3760
|
+
grouped.remoteDisplayRows.some((row) => row.name.toLowerCase().includes(needle)) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderGroupHeader(t("menuRemoteBranches"), searchLeafCount(remoteTree), true), renderSearch(remoteTree, 1, "remote:")] })
|
|
3761
|
+
] }), visible.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3762
|
+
className: BranchChip_module_default.menuEmpty,
|
|
3763
|
+
children: rows.length === 0 ? t("menuNoBranches") : t("menuNoMatches")
|
|
3764
|
+
})]
|
|
3765
|
+
}),
|
|
3766
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3767
|
+
className: BranchChip_module_default.menuSearchWrap,
|
|
3768
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3769
|
+
ref: holdSearchFocus,
|
|
3770
|
+
className: BranchChip_module_default.menuSearch,
|
|
3771
|
+
type: "text",
|
|
3772
|
+
value: query,
|
|
3773
|
+
placeholder: t("menuSearchPlaceholder"),
|
|
3774
|
+
"aria-label": t("menuSearchPlaceholder"),
|
|
3775
|
+
spellCheck: false,
|
|
3776
|
+
onChange: (event) => {
|
|
3777
|
+
setQuery(event.target.value);
|
|
3778
|
+
},
|
|
3779
|
+
onKeyDown: (event) => {
|
|
3780
|
+
if (event.key === "Enter" && !event.altKey) {
|
|
3781
|
+
event.preventDefault();
|
|
3782
|
+
if (graphOpen) setSelected(visible[0]?.name ?? null);
|
|
3783
|
+
else commitFirst();
|
|
3784
|
+
}
|
|
2170
3785
|
}
|
|
2171
|
-
}
|
|
3786
|
+
})
|
|
2172
3787
|
})
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
3788
|
+
]
|
|
3789
|
+
}),
|
|
3790
|
+
graphOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommitGraph, {
|
|
3791
|
+
repoPath,
|
|
3792
|
+
branchRef: browsingRef,
|
|
3793
|
+
branch: browsingBranch || "HEAD",
|
|
3794
|
+
escapeRef: graphEscapeRef,
|
|
3795
|
+
t,
|
|
3796
|
+
onClose
|
|
3797
|
+
}, `${repoPath}:${browsingRef}`)
|
|
3798
|
+
]
|
|
2176
3799
|
}), document.body),
|
|
2177
3800
|
confirm !== null && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2178
3801
|
ref: flyRef,
|
|
@@ -2361,7 +3984,7 @@ window.__ModuleLoader__.load({
|
|
|
2361
3984
|
type: "button",
|
|
2362
3985
|
role: "menuitem",
|
|
2363
3986
|
className: BranchChip_module_default.ctxItem,
|
|
2364
|
-
disabled: item.disabled,
|
|
3987
|
+
disabled: busy || item.disabled,
|
|
2365
3988
|
title: item.title,
|
|
2366
3989
|
onClick: item.run,
|
|
2367
3990
|
children: [item.icon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -2379,6 +4002,258 @@ window.__ModuleLoader__.load({
|
|
|
2379
4002
|
] });
|
|
2380
4003
|
}
|
|
2381
4004
|
//#endregion
|
|
4005
|
+
//#region src/client/sync-job.ts
|
|
4006
|
+
let jobs = [];
|
|
4007
|
+
let lastId = 0;
|
|
4008
|
+
const aborts = /* @__PURE__ */ new Map();
|
|
4009
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
4010
|
+
function publish(next) {
|
|
4011
|
+
jobs = next;
|
|
4012
|
+
for (const listener of [...listeners]) listener();
|
|
4013
|
+
}
|
|
4014
|
+
/**
|
|
4015
|
+
* The job running for a directory.
|
|
4016
|
+
* @param cwd - session directory; undefined has no job.
|
|
4017
|
+
*/
|
|
4018
|
+
function findSyncJob(cwd) {
|
|
4019
|
+
return cwd === void 0 ? void 0 : jobs.find((job) => job.cwd === cwd);
|
|
4020
|
+
}
|
|
4021
|
+
/**
|
|
4022
|
+
* Be told whenever any job starts, advances or ends.
|
|
4023
|
+
* @param listener - called after the store changed.
|
|
4024
|
+
* @returns the unsubscribe.
|
|
4025
|
+
*/
|
|
4026
|
+
function subscribeSyncJobs(listener) {
|
|
4027
|
+
listeners.add(listener);
|
|
4028
|
+
return () => {
|
|
4029
|
+
listeners.delete(listener);
|
|
4030
|
+
};
|
|
4031
|
+
}
|
|
4032
|
+
/**
|
|
4033
|
+
* Run one job for a directory. At most one job runs per directory.
|
|
4034
|
+
* @param cwd - session directory the job belongs to.
|
|
4035
|
+
* @param kind - which verb the card should say.
|
|
4036
|
+
* @param request - issues the streamed call with the live channel it is given.
|
|
4037
|
+
* @param subject - what the job is about, shown from the first moment.
|
|
4038
|
+
* @returns the outcome, or undefined when a job already runs for `cwd`
|
|
4039
|
+
* (nothing was started).
|
|
4040
|
+
*/
|
|
4041
|
+
async function runSyncJob(cwd, kind, request, subject = {}) {
|
|
4042
|
+
if (aborts.has(cwd)) return void 0;
|
|
4043
|
+
const controller = new AbortController();
|
|
4044
|
+
aborts.set(cwd, controller);
|
|
4045
|
+
const id = ++lastId;
|
|
4046
|
+
const identity = {
|
|
4047
|
+
id,
|
|
4048
|
+
kind,
|
|
4049
|
+
cwd,
|
|
4050
|
+
...subject.branch === void 0 ? {} : { branch: subject.branch }
|
|
4051
|
+
};
|
|
4052
|
+
publish([...jobs, {
|
|
4053
|
+
...identity,
|
|
4054
|
+
stage: "fetch",
|
|
4055
|
+
...subject.remote === void 0 ? {} : { remote: subject.remote }
|
|
4056
|
+
}]);
|
|
4057
|
+
const onEvent = (event) => {
|
|
4058
|
+
if (controller.signal.aborted) return;
|
|
4059
|
+
const before = jobs.find((job) => job.id === id);
|
|
4060
|
+
if (before === void 0) return;
|
|
4061
|
+
const remote = event.type === "progress" ? event.remote ?? before.remote : void 0;
|
|
4062
|
+
const next = event.type === "merge" ? {
|
|
4063
|
+
...identity,
|
|
4064
|
+
stage: "merge"
|
|
4065
|
+
} : {
|
|
4066
|
+
...identity,
|
|
4067
|
+
stage: "fetch",
|
|
4068
|
+
text: event.text,
|
|
4069
|
+
...event.percent === void 0 ? {} : { percent: event.percent },
|
|
4070
|
+
...remote === void 0 ? {} : { remote }
|
|
4071
|
+
};
|
|
4072
|
+
publish(jobs.map((job) => job.id === id ? next : job));
|
|
4073
|
+
};
|
|
4074
|
+
try {
|
|
4075
|
+
return {
|
|
4076
|
+
result: await request({
|
|
4077
|
+
signal: controller.signal,
|
|
4078
|
+
onEvent
|
|
4079
|
+
}),
|
|
4080
|
+
cancelled: controller.signal.aborted
|
|
4081
|
+
};
|
|
4082
|
+
} finally {
|
|
4083
|
+
aborts.delete(cwd);
|
|
4084
|
+
publish(jobs.filter((job) => job.id !== id));
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
/**
|
|
4088
|
+
* Cancel the job running for a directory: the connection closes and the host
|
|
4089
|
+
* kills git. A job already past fetching (the quick fast-forward) is left to
|
|
4090
|
+
* finish — stopping it half way would only add a state to explain.
|
|
4091
|
+
* @param cwd - session directory.
|
|
4092
|
+
*/
|
|
4093
|
+
function cancelSyncJob(cwd) {
|
|
4094
|
+
if (findSyncJob(cwd)?.stage === "merge") return;
|
|
4095
|
+
aborts.get(cwd)?.abort();
|
|
4096
|
+
}
|
|
4097
|
+
const pushFailures = /* @__PURE__ */ new Map();
|
|
4098
|
+
/**
|
|
4099
|
+
* Keep a failed push for a directory and tell the docks. The push window had
|
|
4100
|
+
* already closed (the card carried the push), so whichever dock is on that
|
|
4101
|
+
* directory — the one that started it, a later one, or one not yet mounted —
|
|
4102
|
+
* picks the failure up and reopens the window with git's reason.
|
|
4103
|
+
* @param cwd - session directory the push ran for.
|
|
4104
|
+
* @param failure - what was pushed and why it failed.
|
|
4105
|
+
*/
|
|
4106
|
+
function recordPushFailure(cwd, failure) {
|
|
4107
|
+
pushFailures.set(cwd, failure);
|
|
4108
|
+
for (const listener of [...listeners]) listener();
|
|
4109
|
+
}
|
|
4110
|
+
/**
|
|
4111
|
+
* Take the failed push waiting for a directory (it is forgotten once taken).
|
|
4112
|
+
* @param cwd - session directory; undefined has none.
|
|
4113
|
+
* @returns the failure, or undefined.
|
|
4114
|
+
*/
|
|
4115
|
+
function takePushFailure(cwd) {
|
|
4116
|
+
if (cwd === void 0) return void 0;
|
|
4117
|
+
const failure = pushFailures.get(cwd);
|
|
4118
|
+
pushFailures.delete(cwd);
|
|
4119
|
+
return failure;
|
|
4120
|
+
}
|
|
4121
|
+
//#endregion
|
|
4122
|
+
//#region src/client/update-error.ts
|
|
4123
|
+
/** Ordered: the most specific cause wins when several markers appear. */
|
|
4124
|
+
const MARKERS = [
|
|
4125
|
+
["diverged", /not possible to fast-forward|diverging branches can't be fast-forwarded/i],
|
|
4126
|
+
["dirty", /would be overwritten by merge|please commit your changes or stash them before you merge/i],
|
|
4127
|
+
["noUpstream", /no upstream configured|does not have (?:an |any )?upstream|no tracking information for the current branch/i]
|
|
4128
|
+
];
|
|
4129
|
+
/**
|
|
4130
|
+
* Classify an update failure.
|
|
4131
|
+
* @param raw - the error text returned by the update route.
|
|
4132
|
+
* @returns the recognised cause, or null when the toast should keep git's words.
|
|
4133
|
+
*/
|
|
4134
|
+
function explainUpdateFailure(raw) {
|
|
4135
|
+
for (const [kind, pattern] of MARKERS) if (pattern.test(raw)) return kind;
|
|
4136
|
+
return null;
|
|
4137
|
+
}
|
|
4138
|
+
/**
|
|
4139
|
+
* Git's own words for an update failure this toast does not name.
|
|
4140
|
+
*
|
|
4141
|
+
* Drops the `git <args> failed (exit N):` preamble and every `hint:` line.
|
|
4142
|
+
* A diverged update is nothing but those two, which is why a recognised
|
|
4143
|
+
* cause never calls this.
|
|
4144
|
+
* @param raw - the error text returned by the update route.
|
|
4145
|
+
* @returns the remaining text, or `raw` when stripping would leave nothing.
|
|
4146
|
+
*/
|
|
4147
|
+
function updateErrorText(raw) {
|
|
4148
|
+
const body = /^git [\s\S]*?failed \(exit \d+\):\s*([\s\S]*)$/.exec(raw)?.[1];
|
|
4149
|
+
const text = body === void 0 || body === "" ? raw : body;
|
|
4150
|
+
const kept = text.split(/\r?\n/).filter((line) => {
|
|
4151
|
+
const trimmed = line.trim();
|
|
4152
|
+
return trimmed !== "" && !/^hint:/i.test(trimmed);
|
|
4153
|
+
});
|
|
4154
|
+
return kept.length === 0 ? text : kept.join("\n");
|
|
4155
|
+
}
|
|
4156
|
+
//#endregion
|
|
4157
|
+
//#region \0git-worktree-css:D:\Code\dsh-worktree\src\client\SyncProgress.module.css?inline
|
|
4158
|
+
const css$2 = "/* The floating progress card of a running fetch/update.\n *\n * Fixed to the viewport and portalled out of the composer, so it can never\n * push or clip the layout it floats over. Only the card itself takes the\n * pointer; everything around it keeps working, which is the point — a\n * transfer that takes a minute must not hold the app hostage.\n *\n * Chrome is the branch menu card's recipe (r16 here: it is a small notice,\n * not a menu), so it reads as part of the same plugin in both themes. */\n.card_2133289399 {\n box-sizing: border-box;\n position: fixed;\n right: 20px;\n bottom: 84px;\n z-index: 1000;\n /* Wide enough for git's longest ordinary counter line on one row\n * (`Receiving objects: 66% (1340/2030), 120.80 MiB | 10.24 MiB/s`), which a\n * 300px card cut to `… | 1024.0…` from the tens of MiB on. */\n width: 380px;\n max-width: calc(100vw - 40px);\n padding: 10px 12px 12px;\n border-radius: 16px;\n background: var(--dsw-specific-menu, var(--dsw-alias-surface-raised, #ffffff));\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n box-shadow: var(--dsw-elevation-prominent, var(--dsw-shadow-lv3));\n color: var(--dsw-alias-label-primary, inherit);\n animation: syncCardIn 160ms ease-out;\n}\n\n.head_2133289399 {\n display: flex;\n align-items: center;\n gap: 8px;\n min-height: 22px;\n}\n\n.title_2133289399 {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.cancel_2133289399 {\n flex: none;\n display: grid;\n place-items: center;\n width: 22px;\n height: 22px;\n margin: 0 -4px 0 0;\n padding: 0;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-tertiary, #81858c);\n cursor: pointer;\n}\n\n.cancel_2133289399:hover {\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 8%, transparent));\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.cancel_2133289399:focus-visible {\n outline: 2px solid var(--dsw-alias-brand-primary, #4186f0);\n outline-offset: 1px;\n}\n\n/* The bar: a determinate fill follows git's own percentage; with none to\n * show (connecting, a phase git cannot size, the fast-forward) a short\n * segment sweeps instead of a bar frozen at some stale number. */\n.track_2133289399 {\n position: relative;\n height: 4px;\n margin: 8px 0 8px;\n overflow: hidden;\n border-radius: 2px;\n background: var(--dsw-alias-interactive-bg-hover, color-mix(in srgb, currentColor 10%, transparent));\n}\n\n.fill_2133289399 {\n height: 100%;\n border-radius: 2px;\n background: var(--dsw-alias-brand-primary, #4186f0);\n transition: width 150ms linear;\n}\n\n.indeterminate_2133289399 {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 40%;\n border-radius: 2px;\n background: var(--dsw-alias-brand-primary, #4186f0);\n animation: syncSweep 1.1s ease-in-out infinite;\n}\n\n/* git's line, verbatim: stage, counts and transfer speed in one row, the\n * way IDEA's task popup prints it. Tabular figures keep it from jittering. */\n.detail_2133289399 {\n overflow: hidden;\n font-size: 12px;\n line-height: 18px;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n text-overflow: ellipsis;\n color: var(--dsw-alias-label-secondary, #81858c);\n}\n\n@keyframes syncSweep {\n from { transform: translateX(-100%); }\n to { transform: translateX(250%); }\n}\n\n@keyframes syncCardIn {\n from { opacity: 0; transform: translateY(6px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .card_2133289399 { animation: none; }\n .fill_2133289399 { transition: none; }\n .indeterminate_2133289399 { width: 100%; opacity: 0.35; animation: none; }\n}\n";
|
|
4159
|
+
const tagId$2 = "@laoyuehanni/dsh-git-worktree/SyncProgress.module.css";
|
|
4160
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId$2 + "\"]") === null) {
|
|
4161
|
+
const tag = document.createElement("style");
|
|
4162
|
+
tag.dataset.plugin = "@laoyuehanni/dsh-git-worktree";
|
|
4163
|
+
tag.dataset.pluginCss = tagId$2;
|
|
4164
|
+
tag.textContent = css$2;
|
|
4165
|
+
document.head.appendChild(tag);
|
|
4166
|
+
}
|
|
4167
|
+
var SyncProgress_module_default = {
|
|
4168
|
+
"card": "card_2133289399",
|
|
4169
|
+
"head": "head_2133289399",
|
|
4170
|
+
"title": "title_2133289399",
|
|
4171
|
+
"cancel": "cancel_2133289399",
|
|
4172
|
+
"track": "track_2133289399",
|
|
4173
|
+
"fill": "fill_2133289399",
|
|
4174
|
+
"indeterminate": "indeterminate_2133289399",
|
|
4175
|
+
"detail": "detail_2133289399"
|
|
4176
|
+
};
|
|
4177
|
+
//#endregion
|
|
4178
|
+
//#region src/client/SyncProgress.tsx
|
|
4179
|
+
/**
|
|
4180
|
+
* SyncProgress: the floating card of a running fetch/update/push — IDEA's
|
|
4181
|
+
* background-task popup in this plugin's terms. Title says what is running,
|
|
4182
|
+
* the bar follows git's own percentage, the line under it is git's own
|
|
4183
|
+
* progress text (stage, counts, transfer speed), and × cancels the transfer.
|
|
4184
|
+
*
|
|
4185
|
+
* It is a non-modal notice: portalled to the body and fixed to the viewport,
|
|
4186
|
+
* so the composer, the menu and the rest of the app stay fully usable while
|
|
4187
|
+
* it is up. All the data comes from the {@link SyncJob} the store keeps; this
|
|
4188
|
+
* component owns nothing.
|
|
4189
|
+
*
|
|
4190
|
+
* @module git-worktree/client/SyncProgress
|
|
4191
|
+
*/
|
|
4192
|
+
/**
|
|
4193
|
+
* Decide what the card says for a job, as a pure function of its state.
|
|
4194
|
+
* @param job - the job, as the store holds it.
|
|
4195
|
+
* @param branch - the checked-out branch.
|
|
4196
|
+
* @param t - the plugin's translator.
|
|
4197
|
+
*/
|
|
4198
|
+
function describeSync(job, branch, t) {
|
|
4199
|
+
const verb = job.kind === "update" ? t("syncTitleUpdate", { branch }) : job.kind === "push" ? t("syncTitlePush", { branch: job.branch ?? branch }) : t("syncTitleFetch");
|
|
4200
|
+
const title = job.remote === void 0 ? verb : `${verb} · ${job.remote}`;
|
|
4201
|
+
if (job.stage === "merge") return {
|
|
4202
|
+
title,
|
|
4203
|
+
detail: t("syncMerging", { branch }),
|
|
4204
|
+
percent: void 0,
|
|
4205
|
+
cancellable: false
|
|
4206
|
+
};
|
|
4207
|
+
return {
|
|
4208
|
+
title,
|
|
4209
|
+
detail: job.text ?? t("syncConnecting"),
|
|
4210
|
+
percent: job.percent,
|
|
4211
|
+
cancellable: true
|
|
4212
|
+
};
|
|
4213
|
+
}
|
|
4214
|
+
/** The floating progress card. */
|
|
4215
|
+
function SyncProgress({ job, branch, t, onCancel }) {
|
|
4216
|
+
const { title, detail, percent, cancellable } = describeSync(job, branch, t);
|
|
4217
|
+
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4218
|
+
className: SyncProgress_module_default.card,
|
|
4219
|
+
role: "status",
|
|
4220
|
+
"aria-live": "polite",
|
|
4221
|
+
children: [
|
|
4222
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4223
|
+
className: SyncProgress_module_default.head,
|
|
4224
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4225
|
+
className: SyncProgress_module_default.title,
|
|
4226
|
+
title,
|
|
4227
|
+
children: title
|
|
4228
|
+
}), cancellable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4229
|
+
type: "button",
|
|
4230
|
+
className: SyncProgress_module_default.cancel,
|
|
4231
|
+
"aria-label": t("syncCancel"),
|
|
4232
|
+
title: t("syncCancel"),
|
|
4233
|
+
onClick: onCancel,
|
|
4234
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 12 })
|
|
4235
|
+
})]
|
|
4236
|
+
}),
|
|
4237
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4238
|
+
className: SyncProgress_module_default.track,
|
|
4239
|
+
role: "progressbar",
|
|
4240
|
+
"aria-valuemin": 0,
|
|
4241
|
+
"aria-valuemax": 100,
|
|
4242
|
+
...percent === void 0 ? {} : { "aria-valuenow": percent },
|
|
4243
|
+
children: percent === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: SyncProgress_module_default.indeterminate }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4244
|
+
className: SyncProgress_module_default.fill,
|
|
4245
|
+
style: { width: `${percent}%` }
|
|
4246
|
+
})
|
|
4247
|
+
}),
|
|
4248
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4249
|
+
className: SyncProgress_module_default.detail,
|
|
4250
|
+
title: detail,
|
|
4251
|
+
children: detail
|
|
4252
|
+
})
|
|
4253
|
+
]
|
|
4254
|
+
}), document.body);
|
|
4255
|
+
}
|
|
4256
|
+
//#endregion
|
|
2382
4257
|
//#region src/client/BranchChip.tsx
|
|
2383
4258
|
/**
|
|
2384
4259
|
* BranchChipDock: the composer tool-row entry (conversation.input.left, right
|
|
@@ -2401,8 +4276,10 @@ window.__ModuleLoader__.load({
|
|
|
2401
4276
|
* moving between worktrees is the point of having them. What also stays is
|
|
2402
4277
|
* the two tools that never move a checkout: fetch, and update-current — the
|
|
2403
4278
|
* update fast-forwards the session's OWN worktree, the fetch is
|
|
2404
|
-
* repository-wide metadata.
|
|
2405
|
-
*
|
|
4279
|
+
* repository-wide metadata. Both run as jobs in ./sync-job.ts and show a
|
|
4280
|
+
* floating, non-modal progress card with a cancel button (./SyncProgress.tsx).
|
|
4281
|
+
* Non-git directories and load failures render nothing. The confirm dialogs
|
|
4282
|
+
* and the error toast live here too.
|
|
2406
4283
|
*
|
|
2407
4284
|
* Checking the worktree toggle pops the cutout confirm dialog right away:
|
|
2408
4285
|
* confirming it cuts a NEW branch (`<current>-wt`, suffixes past taken
|
|
@@ -2441,6 +4318,13 @@ window.__ModuleLoader__.load({
|
|
|
2441
4318
|
* gains the main checkout row (see {@link buildLinkedWorktreeRows}); a
|
|
2442
4319
|
* started MAIN-checkout session drops the group — its directory is fixed.
|
|
2443
4320
|
*/
|
|
4321
|
+
/** The toast for an update failure the plugin can name. Each one says what
|
|
4322
|
+
* to do next; git's hint essay is not part of it. */
|
|
4323
|
+
const UPDATE_FAIL = {
|
|
4324
|
+
diverged: "updateFailDiverged",
|
|
4325
|
+
dirty: "updateFailDirty",
|
|
4326
|
+
noUpstream: "updateFailNoUpstream"
|
|
4327
|
+
};
|
|
2444
4328
|
/**
|
|
2445
4329
|
* Read the repository status for a directory; refetch on demand.
|
|
2446
4330
|
* @param cwd - absolute session directory.
|
|
@@ -2472,6 +4356,22 @@ window.__ModuleLoader__.load({
|
|
|
2472
4356
|
}, [cwd]);
|
|
2473
4357
|
return [state, load];
|
|
2474
4358
|
}
|
|
4359
|
+
/**
|
|
4360
|
+
* The fetch/update running for a directory, live. The job store outlives
|
|
4361
|
+
* this component (switching sessions unmounts the dock, a long transfer does
|
|
4362
|
+
* not stop), so the hook reads the store at render time — a held copy could
|
|
4363
|
+
* lag a render behind a directory change — and only subscribes to learn WHEN
|
|
4364
|
+
* to re-render.
|
|
4365
|
+
* @param cwd - absolute session directory.
|
|
4366
|
+
* @returns the running job, or undefined.
|
|
4367
|
+
*/
|
|
4368
|
+
function useSyncJob(cwd) {
|
|
4369
|
+
const [, redraw] = (0, react.useState)(0);
|
|
4370
|
+
(0, react.useEffect)(() => subscribeSyncJobs(() => {
|
|
4371
|
+
redraw((tick) => tick + 1);
|
|
4372
|
+
}), []);
|
|
4373
|
+
return findSyncJob(cwd);
|
|
4374
|
+
}
|
|
2475
4375
|
/** Longest branch name shown on the chip before ellipsizing (chars, … included). */
|
|
2476
4376
|
const BRANCH_DISPLAY_MAX = 25;
|
|
2477
4377
|
/** Viewport edge clearance and chip gap, mirroring BranchMenu's posture. */
|
|
@@ -2521,7 +4421,9 @@ window.__ModuleLoader__.load({
|
|
|
2521
4421
|
name: b.name,
|
|
2522
4422
|
kind: "local",
|
|
2523
4423
|
...b.ahead === void 0 ? {} : { ahead: b.ahead },
|
|
2524
|
-
...b.behind === void 0 ? {} : { behind: b.behind }
|
|
4424
|
+
...b.behind === void 0 ? {} : { behind: b.behind },
|
|
4425
|
+
...b.upstream === void 0 ? {} : { upstream: b.upstream },
|
|
4426
|
+
...b.upstreamGone === void 0 ? {} : { upstreamGone: b.upstreamGone }
|
|
2525
4427
|
})),
|
|
2526
4428
|
...branches.filter((b) => b.kind === "remote").map((b) => ({
|
|
2527
4429
|
name: b.name,
|
|
@@ -2535,7 +4437,9 @@ window.__ModuleLoader__.load({
|
|
|
2535
4437
|
kind: "worktree",
|
|
2536
4438
|
path: w.path,
|
|
2537
4439
|
...twin?.ahead === void 0 ? {} : { ahead: twin.ahead },
|
|
2538
|
-
...twin?.behind === void 0 ? {} : { behind: twin.behind }
|
|
4440
|
+
...twin?.behind === void 0 ? {} : { behind: twin.behind },
|
|
4441
|
+
...twin?.upstream === void 0 ? {} : { upstream: twin.upstream },
|
|
4442
|
+
...twin?.upstreamGone === void 0 ? {} : { upstreamGone: twin.upstreamGone }
|
|
2539
4443
|
}];
|
|
2540
4444
|
})
|
|
2541
4445
|
];
|
|
@@ -2571,7 +4475,9 @@ window.__ModuleLoader__.load({
|
|
|
2571
4475
|
name: current.name,
|
|
2572
4476
|
kind: "local",
|
|
2573
4477
|
...current.ahead === void 0 ? {} : { ahead: current.ahead },
|
|
2574
|
-
...current.behind === void 0 ? {} : { behind: current.behind }
|
|
4478
|
+
...current.behind === void 0 ? {} : { behind: current.behind },
|
|
4479
|
+
...current.upstream === void 0 ? {} : { upstream: current.upstream },
|
|
4480
|
+
...current.upstreamGone === void 0 ? {} : { upstreamGone: current.upstreamGone }
|
|
2575
4481
|
}], ...worktrees.flatMap((w) => {
|
|
2576
4482
|
if (w.branch === void 0 || w.branch === currentBranch) return [];
|
|
2577
4483
|
const twin = localMap.get(w.branch);
|
|
@@ -2581,7 +4487,9 @@ window.__ModuleLoader__.load({
|
|
|
2581
4487
|
path: w.path,
|
|
2582
4488
|
...w.main ? { mainWorktree: true } : {},
|
|
2583
4489
|
...twin?.ahead === void 0 ? {} : { ahead: twin.ahead },
|
|
2584
|
-
...twin?.behind === void 0 ? {} : { behind: twin.behind }
|
|
4490
|
+
...twin?.behind === void 0 ? {} : { behind: twin.behind },
|
|
4491
|
+
...twin?.upstream === void 0 ? {} : { upstream: twin.upstream },
|
|
4492
|
+
...twin?.upstreamGone === void 0 ? {} : { upstreamGone: twin.upstreamGone }
|
|
2585
4493
|
}];
|
|
2586
4494
|
})];
|
|
2587
4495
|
}
|
|
@@ -2711,19 +4619,18 @@ window.__ModuleLoader__.load({
|
|
|
2711
4619
|
const session = useSession((s) => s);
|
|
2712
4620
|
const cwd = summary?.cwd;
|
|
2713
4621
|
const [repo, refresh] = useRepoStatus(cwd);
|
|
4622
|
+
const syncJob = useSyncJob(cwd);
|
|
2714
4623
|
const [menuOpen, setMenuOpen] = (0, react.useState)(false);
|
|
2715
4624
|
const [confirm, setConfirm] = (0, react.useState)(null);
|
|
4625
|
+
const [pushBranch, setPushBranch] = (0, react.useState)(null);
|
|
4626
|
+
/** Set when the push window is coming back after a failed push. */
|
|
4627
|
+
const [pushResume, setPushResume] = (0, react.useState)(void 0);
|
|
2716
4628
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
2717
4629
|
/** Inspect facts of the staged worktree removal, keyed to its directory:
|
|
2718
4630
|
* a confirm staged for one path never shows another's facts, and a restage
|
|
2719
4631
|
* while a probe is in flight keeps showing the new path's loading line. */
|
|
2720
4632
|
const [removalPath, setRemovalPath] = (0, react.useState)(null);
|
|
2721
4633
|
const [removalFacts, setRemovalFacts] = (0, react.useState)(void 0);
|
|
2722
|
-
/** Which arrow is spinning: fetch and update are single-flight against
|
|
2723
|
-
* the SAME busyRef (mutually exclusive), but the spinning state must be
|
|
2724
|
-
* per-tool — one shared flag made both arrows rotate at once. */
|
|
2725
|
-
const [fetchBusy, setFetchBusy] = (0, react.useState)(false);
|
|
2726
|
-
const [updateBusy, setUpdateBusy] = (0, react.useState)(false);
|
|
2727
4634
|
/** Toasts wait their turn instead of overwriting each other. One flow
|
|
2728
4635
|
* can raise two in a row — a worktree creation whose fetch warned, then
|
|
2729
4636
|
* the auto-prune's report — and a single-slot state made the second
|
|
@@ -2741,6 +4648,12 @@ window.__ModuleLoader__.load({
|
|
|
2741
4648
|
}, []);
|
|
2742
4649
|
const chipRef = (0, react.useRef)(null);
|
|
2743
4650
|
const busyRef = (0, react.useRef)(false);
|
|
4651
|
+
const currentCwdRef = (0, react.useRef)(cwd);
|
|
4652
|
+
currentCwdRef.current = cwd;
|
|
4653
|
+
/** Is something already running that another git action must not overlap:
|
|
4654
|
+
* one of this dock's own actions, or a fetch/update the job store holds for
|
|
4655
|
+
* this directory (it outlives the dock, so a remounted dock still sees it). */
|
|
4656
|
+
const blocked = (0, react.useCallback)(() => busyRef.current || findSyncJob(currentCwdRef.current) !== void 0, []);
|
|
2744
4657
|
/** Branch the label is showing. The poll compares against this and does
|
|
2745
4658
|
* not refetch while it is still empty (the mount fetch owns that). */
|
|
2746
4659
|
const shownBranchRef = (0, react.useRef)(void 0);
|
|
@@ -2750,8 +4663,22 @@ window.__ModuleLoader__.load({
|
|
|
2750
4663
|
const pollRefreshRef = (0, react.useRef)(false);
|
|
2751
4664
|
(0, react.useEffect)(() => {
|
|
2752
4665
|
setConfirm(null);
|
|
4666
|
+
setPushBranch(null);
|
|
4667
|
+
setPushResume(void 0);
|
|
2753
4668
|
setMenuOpen(false);
|
|
2754
4669
|
}, [cwd]);
|
|
4670
|
+
(0, react.useEffect)(() => {
|
|
4671
|
+
const reopen = () => {
|
|
4672
|
+
const failure = takePushFailure(cwd);
|
|
4673
|
+
if (failure === void 0) return;
|
|
4674
|
+
setConfirm(null);
|
|
4675
|
+
setMenuOpen(false);
|
|
4676
|
+
setPushResume(failure);
|
|
4677
|
+
setPushBranch(failure.branch);
|
|
4678
|
+
};
|
|
4679
|
+
reopen();
|
|
4680
|
+
return subscribeSyncJobs(reopen);
|
|
4681
|
+
}, [cwd]);
|
|
2755
4682
|
(0, react.useEffect)(() => {
|
|
2756
4683
|
if (!session.blank) setConfirm(null);
|
|
2757
4684
|
}, [session.blank]);
|
|
@@ -2795,7 +4722,7 @@ window.__ModuleLoader__.load({
|
|
|
2795
4722
|
* menu's rule: 原地动作 leave the picker up), and `onSettled` — the
|
|
2796
4723
|
* flyout's success-only close hook — fires after both. */
|
|
2797
4724
|
const runGuarded = (0, react.useCallback)(async (action, keepOpen = false, onSettled) => {
|
|
2798
|
-
if (
|
|
4725
|
+
if (blocked()) return;
|
|
2799
4726
|
busyRef.current = true;
|
|
2800
4727
|
setBusy(true);
|
|
2801
4728
|
const failure = await action();
|
|
@@ -2808,7 +4735,7 @@ window.__ModuleLoader__.load({
|
|
|
2808
4735
|
setConfirm(null);
|
|
2809
4736
|
if (!keepOpen) setMenuOpen(false);
|
|
2810
4737
|
onSettled?.();
|
|
2811
|
-
}, [showError]);
|
|
4738
|
+
}, [blocked, showError]);
|
|
2812
4739
|
/** In-place switch flow: POST /switch, then refetch the status. */
|
|
2813
4740
|
const doSwitch = (0, react.useCallback)((branch, keepOpen = false) => runGuarded(async () => {
|
|
2814
4741
|
if (cwd === void 0) return "no session directory";
|
|
@@ -2906,30 +4833,34 @@ window.__ModuleLoader__.load({
|
|
|
2906
4833
|
/** Remote-sync flow: POST /fetch (fetch every remote + prune), then
|
|
2907
4834
|
* refetch the status. Deliberately NOT runGuarded: its success closes the
|
|
2908
4835
|
* menu, while the whole point of a sync is watching the refreshed branch
|
|
2909
|
-
* list in place.
|
|
2910
|
-
*
|
|
2911
|
-
*
|
|
2912
|
-
*
|
|
4836
|
+
* list in place. The run lives in the job store, not in this component:
|
|
4837
|
+
* the floating card shows its progress and cancels it, a remounted dock
|
|
4838
|
+
* still sees it, and while it runs the single-flight gate (`blocked`)
|
|
4839
|
+
* keeps every other git action out. A fetch has NO visible side effect
|
|
4840
|
+
* when the remote moved not — the card and the done toast ARE the
|
|
4841
|
+
* feedback. */
|
|
2913
4842
|
const doFetch = (0, react.useCallback)(async () => {
|
|
2914
|
-
if (
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
4843
|
+
if (cwd === void 0) {
|
|
4844
|
+
showError("no session directory");
|
|
4845
|
+
return;
|
|
4846
|
+
}
|
|
4847
|
+
if (blocked()) return;
|
|
4848
|
+
const outcome = await runSyncJob(cwd, "fetch", (live) => requestFetch(cwd, live));
|
|
4849
|
+
if (outcome === void 0 || currentCwdRef.current !== cwd) return;
|
|
4850
|
+
const { result, cancelled } = outcome;
|
|
4851
|
+
if (cancelled && !result.ok) {
|
|
4852
|
+
await refresh();
|
|
4853
|
+
pushToast(t("fetchCancelled"));
|
|
4854
|
+
return;
|
|
4855
|
+
}
|
|
4856
|
+
if (!result.ok) {
|
|
4857
|
+
showError(result.error);
|
|
2928
4858
|
return;
|
|
2929
4859
|
}
|
|
2930
4860
|
await refresh();
|
|
2931
4861
|
pushToast(t("fetchDone"));
|
|
2932
4862
|
}, [
|
|
4863
|
+
blocked,
|
|
2933
4864
|
cwd,
|
|
2934
4865
|
pushToast,
|
|
2935
4866
|
refresh,
|
|
@@ -2938,40 +4869,101 @@ window.__ModuleLoader__.load({
|
|
|
2938
4869
|
]);
|
|
2939
4870
|
/** Update-current-branch flow: POST /update (fetch every remote, then
|
|
2940
4871
|
* fast-forward the checked-out branch to its upstream), then refetch the
|
|
2941
|
-
* status in place — same keep-the-menu-open semantics as the
|
|
2942
|
-
* The toast tells the two apart: fast-forwarded vs already up
|
|
4872
|
+
* status in place — same job-store and keep-the-menu-open semantics as the
|
|
4873
|
+
* fetch sync. The toast tells the two apart: fast-forwarded vs already up
|
|
4874
|
+
* to date. */
|
|
2943
4875
|
const doUpdate = (0, react.useCallback)(async () => {
|
|
2944
|
-
if (
|
|
2945
|
-
busyRef.current = true;
|
|
2946
|
-
setBusy(true);
|
|
2947
|
-
setUpdateBusy(true);
|
|
2948
|
-
const result = cwd === void 0 ? void 0 : await requestUpdate(cwd);
|
|
2949
|
-
busyRef.current = false;
|
|
2950
|
-
setBusy(false);
|
|
2951
|
-
setUpdateBusy(false);
|
|
2952
|
-
if (result === void 0) {
|
|
4876
|
+
if (cwd === void 0) {
|
|
2953
4877
|
showError("no session directory");
|
|
2954
4878
|
return;
|
|
2955
4879
|
}
|
|
4880
|
+
if (blocked()) return;
|
|
4881
|
+
const outcome = await runSyncJob(cwd, "update", (live) => requestUpdate(cwd, live));
|
|
4882
|
+
if (outcome === void 0 || currentCwdRef.current !== cwd) return;
|
|
4883
|
+
const { result, cancelled } = outcome;
|
|
4884
|
+
if (cancelled && !result.ok) {
|
|
4885
|
+
await refresh();
|
|
4886
|
+
pushToast(t("updateCancelled"));
|
|
4887
|
+
return;
|
|
4888
|
+
}
|
|
2956
4889
|
if (!result.ok) {
|
|
2957
|
-
|
|
4890
|
+
const kind = explainUpdateFailure(result.error);
|
|
4891
|
+
if (kind !== null) pushToast(t(UPDATE_FAIL[kind]));
|
|
4892
|
+
else showError(updateErrorText(result.error));
|
|
2958
4893
|
return;
|
|
2959
4894
|
}
|
|
2960
4895
|
await refresh();
|
|
2961
4896
|
pushToast(result.updated ? t("updateDone", { branch: result.branch }) : t("updateUpToDate"));
|
|
2962
4897
|
}, [
|
|
4898
|
+
blocked,
|
|
2963
4899
|
cwd,
|
|
2964
4900
|
pushToast,
|
|
2965
4901
|
refresh,
|
|
2966
4902
|
showError,
|
|
2967
4903
|
t
|
|
2968
4904
|
]);
|
|
4905
|
+
/**
|
|
4906
|
+
* Push flow: the window hands the push over and closes; the push itself
|
|
4907
|
+
* runs in the job store behind the floating card (progress from git,
|
|
4908
|
+
* cancellable, the page stays usable) like a fetch or update. Success is a
|
|
4909
|
+
* toast. A failure is NOT: the reason belongs next to the choices that
|
|
4910
|
+
* produced it, so it is recorded and the window comes back (see the effect
|
|
4911
|
+
* that reopens it) — here, or in whichever dock is on this directory later.
|
|
4912
|
+
* @returns an error only when nothing could be started (the window then
|
|
4913
|
+
* stays open with it); otherwise undefined at once.
|
|
4914
|
+
*/
|
|
4915
|
+
const doPush = (0, react.useCallback)((body) => {
|
|
4916
|
+
if (blocked() || cwd === void 0) return Promise.resolve(t("pushBusy"));
|
|
4917
|
+
const remote = body.remote ?? "";
|
|
4918
|
+
const target = body.target ?? body.branch;
|
|
4919
|
+
const failure = (error) => ({
|
|
4920
|
+
branch: body.branch,
|
|
4921
|
+
remote,
|
|
4922
|
+
target,
|
|
4923
|
+
tags: body.tags ?? "none",
|
|
4924
|
+
error
|
|
4925
|
+
});
|
|
4926
|
+
setPushBranch(null);
|
|
4927
|
+
setPushResume(void 0);
|
|
4928
|
+
(async () => {
|
|
4929
|
+
const outcome = await runSyncJob(cwd, "push", (live) => requestPush({
|
|
4930
|
+
repoPath: cwd,
|
|
4931
|
+
...body
|
|
4932
|
+
}, live), {
|
|
4933
|
+
branch: body.branch,
|
|
4934
|
+
...remote === "" ? {} : { remote }
|
|
4935
|
+
});
|
|
4936
|
+
if (outcome === void 0) {
|
|
4937
|
+
recordPushFailure(cwd, failure(t("pushBusy")));
|
|
4938
|
+
return;
|
|
4939
|
+
}
|
|
4940
|
+
const { result, cancelled } = outcome;
|
|
4941
|
+
const stopped = cancelled && !result.ok;
|
|
4942
|
+
if (!result.ok && !stopped) recordPushFailure(cwd, failure(result.error));
|
|
4943
|
+
if (currentCwdRef.current !== cwd) return;
|
|
4944
|
+
await refresh();
|
|
4945
|
+
if (currentCwdRef.current !== cwd) return;
|
|
4946
|
+
if (stopped) pushToast(t("pushCancelled"));
|
|
4947
|
+
else if (result.ok) pushToast(t("pushDone", {
|
|
4948
|
+
branch: body.branch,
|
|
4949
|
+
remote: result.remote,
|
|
4950
|
+
target: result.target
|
|
4951
|
+
}));
|
|
4952
|
+
})();
|
|
4953
|
+
return Promise.resolve(void 0);
|
|
4954
|
+
}, [
|
|
4955
|
+
blocked,
|
|
4956
|
+
cwd,
|
|
4957
|
+
pushToast,
|
|
4958
|
+
refresh,
|
|
4959
|
+
t
|
|
4960
|
+
]);
|
|
2969
4961
|
/** Worktree-group flow: hop the session into the EXISTING worktree
|
|
2970
4962
|
* directory. No git action, no confirm — the row menu's hop IS the jump
|
|
2971
4963
|
* (a directory jump is reversible and touches nothing), and the owner's
|
|
2972
4964
|
* adoptWorktree registers the folder and opens a blank session there. */
|
|
2973
4965
|
const doAdoptWorktree = (0, react.useCallback)((path) => {
|
|
2974
|
-
if (
|
|
4966
|
+
if (blocked()) return;
|
|
2975
4967
|
busyRef.current = true;
|
|
2976
4968
|
setBusy(true);
|
|
2977
4969
|
adoptWorktree(path).then(() => {
|
|
@@ -2982,7 +4974,11 @@ window.__ModuleLoader__.load({
|
|
|
2982
4974
|
busyRef.current = false;
|
|
2983
4975
|
setBusy(false);
|
|
2984
4976
|
});
|
|
2985
|
-
}, [
|
|
4977
|
+
}, [
|
|
4978
|
+
adoptWorktree,
|
|
4979
|
+
blocked,
|
|
4980
|
+
showError
|
|
4981
|
+
]);
|
|
2986
4982
|
/** Worktree flow: POST /worktree (create-or-reuse, or cut out a new
|
|
2987
4983
|
* branch under an explicit name), register the directory, hop sessions.
|
|
2988
4984
|
* After the hop the lazy auto-prune fires (fire-and-forget — a slow
|
|
@@ -3088,6 +5084,7 @@ window.__ModuleLoader__.load({
|
|
|
3088
5084
|
if (!busy) setConfirm(null);
|
|
3089
5085
|
}
|
|
3090
5086
|
};
|
|
5087
|
+
const pushBranchInfo = facts.branches.find((entry) => entry.kind === "local" && entry.name === pushBranch);
|
|
3091
5088
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3092
5089
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3093
5090
|
className: BranchChip_module_default.dock,
|
|
@@ -3110,6 +5107,7 @@ window.__ModuleLoader__.load({
|
|
|
3110
5107
|
}),
|
|
3111
5108
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BranchMenu, {
|
|
3112
5109
|
open: menuOpen,
|
|
5110
|
+
repoPath: cwd ?? facts.repoRoot,
|
|
3113
5111
|
anchorRef: chipRef,
|
|
3114
5112
|
rows,
|
|
3115
5113
|
currentBranch: facts.currentBranch,
|
|
@@ -3133,7 +5131,7 @@ window.__ModuleLoader__.load({
|
|
|
3133
5131
|
},
|
|
3134
5132
|
onRemoveWorktree: stageRemoveWorktree,
|
|
3135
5133
|
worktreeRemovalBlocked: (path) => describeWorktreeRemoval(path).running,
|
|
3136
|
-
busy,
|
|
5134
|
+
busy: busy || syncJob !== void 0,
|
|
3137
5135
|
onCreate: (name, from, checkout, onSettled) => {
|
|
3138
5136
|
doCreateBranch(name, from, checkout, onSettled);
|
|
3139
5137
|
},
|
|
@@ -3149,11 +5147,19 @@ window.__ModuleLoader__.load({
|
|
|
3149
5147
|
onFetch: () => {
|
|
3150
5148
|
doFetch();
|
|
3151
5149
|
},
|
|
3152
|
-
fetchBusy,
|
|
5150
|
+
fetchBusy: syncJob?.kind === "fetch",
|
|
3153
5151
|
onUpdate: () => {
|
|
3154
5152
|
doUpdate();
|
|
3155
5153
|
},
|
|
3156
|
-
|
|
5154
|
+
hasRemotes: repoHasRemotes(facts.branches),
|
|
5155
|
+
onPush: (branch) => {
|
|
5156
|
+
if (blocked()) return;
|
|
5157
|
+
setConfirm(null);
|
|
5158
|
+
setMenuOpen(false);
|
|
5159
|
+
setPushResume(void 0);
|
|
5160
|
+
setPushBranch(branch);
|
|
5161
|
+
},
|
|
5162
|
+
updateBusy: syncJob?.kind === "update",
|
|
3157
5163
|
onSelect: (branch) => {
|
|
3158
5164
|
if (branch === facts.currentBranch) {
|
|
3159
5165
|
setMenuOpen(false);
|
|
@@ -3185,6 +5191,32 @@ window.__ModuleLoader__.load({
|
|
|
3185
5191
|
...isCutout && !cutoutValid ? { draftInvalid: true } : {},
|
|
3186
5192
|
...cutoutHint === void 0 ? {} : { draftHint: cutoutHint }
|
|
3187
5193
|
}),
|
|
5194
|
+
pushBranch !== null && cwd !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PushDialog, {
|
|
5195
|
+
repoPath: cwd,
|
|
5196
|
+
repoName: facts.repoName,
|
|
5197
|
+
branch: pushBranch,
|
|
5198
|
+
busy,
|
|
5199
|
+
t,
|
|
5200
|
+
...pushBranchInfo === void 0 ? {} : { branchInfo: pushBranchInfo },
|
|
5201
|
+
...pushResume === void 0 ? {} : { resume: pushResume },
|
|
5202
|
+
onClose: () => {
|
|
5203
|
+
if (busyRef.current) return;
|
|
5204
|
+
setPushBranch(null);
|
|
5205
|
+
setPushResume(void 0);
|
|
5206
|
+
},
|
|
5207
|
+
onPush: (options) => doPush({
|
|
5208
|
+
branch: pushBranch,
|
|
5209
|
+
...options
|
|
5210
|
+
})
|
|
5211
|
+
}, `${cwd}:${pushBranch}`),
|
|
5212
|
+
syncJob !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SyncProgress, {
|
|
5213
|
+
job: syncJob,
|
|
5214
|
+
branch: facts.currentBranch,
|
|
5215
|
+
t,
|
|
5216
|
+
onCancel: () => {
|
|
5217
|
+
cancelSyncJob(syncJob.cwd);
|
|
5218
|
+
}
|
|
5219
|
+
}),
|
|
3188
5220
|
toasts[0] !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
|
|
3189
5221
|
text: toasts[0].text,
|
|
3190
5222
|
onDone: () => {
|
|
@@ -4423,6 +6455,33 @@ window.__ModuleLoader__.load({
|
|
|
4423
6455
|
//#region src/client/locales.ts
|
|
4424
6456
|
/** English dictionary — complete by construction. */
|
|
4425
6457
|
const en = {
|
|
6458
|
+
graphTitle: "Commit graph",
|
|
6459
|
+
graphDetail: "Commit details",
|
|
6460
|
+
graphNoBody: "This commit has no body",
|
|
6461
|
+
graphExpandBody: "Expand body",
|
|
6462
|
+
graphCollapseBody: "Collapse body",
|
|
6463
|
+
graphNoFiles: "No file changes",
|
|
6464
|
+
graphFiles: "{count} files",
|
|
6465
|
+
graphBinary: "{count} binary files",
|
|
6466
|
+
graphRefresh: "Refresh history",
|
|
6467
|
+
graphCloseWindow: "Close popup",
|
|
6468
|
+
graphToggleOpen: "Open graph",
|
|
6469
|
+
graphToggleClose: "Close graph",
|
|
6470
|
+
graphSearch: "Search",
|
|
6471
|
+
graphSearchPlaceholder: "Text or hash",
|
|
6472
|
+
graphAuthorFilter: "Filter by author",
|
|
6473
|
+
graphAllAuthors: "All authors",
|
|
6474
|
+
graphColumn: "Graph",
|
|
6475
|
+
graphCommit: "Commit",
|
|
6476
|
+
graphAuthor: "Author",
|
|
6477
|
+
graphDate: "Date",
|
|
6478
|
+
graphCommits: "Commit history",
|
|
6479
|
+
graphNoMatches: "No matching commits",
|
|
6480
|
+
graphEmpty: "No commits on this branch",
|
|
6481
|
+
graphLoading: "Loading commits…",
|
|
6482
|
+
graphLoaded: "{count} commits loaded",
|
|
6483
|
+
graphRetry: "Retry",
|
|
6484
|
+
graphMore: "Load more",
|
|
4426
6485
|
menuBranches: "Branches",
|
|
4427
6486
|
menuLocalBranches: "Local branches",
|
|
4428
6487
|
menuWorktrees: "Worktrees",
|
|
@@ -4437,7 +6496,7 @@ window.__ModuleLoader__.load({
|
|
|
4437
6496
|
menuNewBranchBad: "Git will not accept this name",
|
|
4438
6497
|
menuNewBranchExists: "A branch with this name already exists",
|
|
4439
6498
|
menuFetch: "Fetch",
|
|
4440
|
-
menuUpdate: "Update
|
|
6499
|
+
menuUpdate: "Update",
|
|
4441
6500
|
ctxCheckout: "Check out",
|
|
4442
6501
|
ctxHop: "Go to this worktree",
|
|
4443
6502
|
ctxWorktree: "Create worktree",
|
|
@@ -4459,8 +6518,59 @@ window.__ModuleLoader__.load({
|
|
|
4459
6518
|
fetchDone: "Remote branches synced",
|
|
4460
6519
|
updateDone: "{branch} fast-forwarded to its upstream",
|
|
4461
6520
|
updateUpToDate: "Already up to date",
|
|
4462
|
-
|
|
4463
|
-
|
|
6521
|
+
updateFailDiverged: "The branch has diverged. Merge or rebase its upstream first.",
|
|
6522
|
+
updateFailDirty: "Uncommitted changes would be overwritten by the fast-forward. Commit or stash them, then update again.",
|
|
6523
|
+
updateFailNoUpstream: "This branch has no upstream to update from. Push it and set an upstream first.",
|
|
6524
|
+
syncTitleFetch: "Fetching remote branches",
|
|
6525
|
+
syncTitleUpdate: "Updating {branch}",
|
|
6526
|
+
syncTitlePush: "Pushing {branch}",
|
|
6527
|
+
syncConnecting: "Connecting to the remote…",
|
|
6528
|
+
syncMerging: "Fast-forwarding {branch}…",
|
|
6529
|
+
syncCancel: "Cancel",
|
|
6530
|
+
fetchCancelled: "Fetch cancelled",
|
|
6531
|
+
updateCancelled: "Update cancelled",
|
|
6532
|
+
pushCancelled: "Push cancelled",
|
|
6533
|
+
"aheadTitle.one": "{n} commit ahead of upstream",
|
|
6534
|
+
"aheadTitle.other": "{n} commits ahead of upstream",
|
|
6535
|
+
"behindTitle.one": "{n} commit behind upstream",
|
|
6536
|
+
"behindTitle.other": "{n} commits behind upstream",
|
|
6537
|
+
unpublishedTitle: "Not pushed — no upstream configured",
|
|
6538
|
+
upstreamGoneTitle: "Upstream {upstream} no longer exists; choose a push destination",
|
|
6539
|
+
ctxPush: "Push",
|
|
6540
|
+
pushTitle: "Push",
|
|
6541
|
+
pushEditTarget: "Edit target branch",
|
|
6542
|
+
pushEditTargetClose: "Close without applying",
|
|
6543
|
+
pushApplyEnter: "Press Enter to apply",
|
|
6544
|
+
pushNew: "New",
|
|
6545
|
+
pushEmpty: "No commits to push",
|
|
6546
|
+
pushNewEmpty: "This branch will be created on the remote",
|
|
6547
|
+
"pushCommitCount.one": "{n} commit",
|
|
6548
|
+
"pushCommitCount.other": "{n} commits",
|
|
6549
|
+
pushFailBehind: "The remote branch has commits you do not have locally. Update the branch first, or use Force push to overwrite them.",
|
|
6550
|
+
pushFailStale: "The remote branch changed after the preview. The preview was refreshed; review it and push again.",
|
|
6551
|
+
pushFailHook: "A local pre-push hook refused this push. See the details below.",
|
|
6552
|
+
pushFailRefused: "The remote refused the update (for example a protected branch or a server-side hook). See the details below.",
|
|
6553
|
+
pushFailAuth: "Authentication failed. Check your Git credentials or SSH key; the plugin cannot prompt for a password.",
|
|
6554
|
+
pushCommitList: "Commits to push",
|
|
6555
|
+
pushTruncated: "Showing the first {n} commits",
|
|
6556
|
+
pushTags: "Push tags",
|
|
6557
|
+
pushTagsAll: "All",
|
|
6558
|
+
pushTagsFollow: "Follow commits",
|
|
6559
|
+
pushTagsAllHint: "Push all local Git tags, including tags unrelated to this branch",
|
|
6560
|
+
pushTagsFollowHint: "Push missing annotated tags reachable from the pushed history; excludes lightweight tags",
|
|
6561
|
+
pushForce: "Force push",
|
|
6562
|
+
pushForceHint: "Uses force-with-lease; refuses to overwrite remote changes made after preview",
|
|
6563
|
+
pushOptions: "Push options",
|
|
6564
|
+
pushRefresh: "Refresh push preview",
|
|
6565
|
+
pushBranch: "Remote branch name",
|
|
6566
|
+
pushPlanning: "Reading local commits…",
|
|
6567
|
+
pushCheckingRemote: "Checking remote destination…",
|
|
6568
|
+
pushLocalChecking: "Local preview · checking remote…",
|
|
6569
|
+
pushLocalUnverified: "Local preview · remote unverified",
|
|
6570
|
+
pushLocalEmpty: "No commits found in the local preview",
|
|
6571
|
+
pushReadingCommits: "Reading commit messages…",
|
|
6572
|
+
pushBusy: "Pushing…",
|
|
6573
|
+
pushDone: "{branch} pushed to {remote}/{target}",
|
|
4464
6574
|
worktreeAskNew: "Create a worktree from {branch}?",
|
|
4465
6575
|
worktreeAskRemote: "Create a worktree from this remote branch?",
|
|
4466
6576
|
worktreeAskReuse: "Switch to the {branch} worktree?",
|
|
@@ -4549,6 +6659,33 @@ window.__ModuleLoader__.load({
|
|
|
4549
6659
|
};
|
|
4550
6660
|
/** 中文词典。 */
|
|
4551
6661
|
const zh = {
|
|
6662
|
+
graphTitle: "提交图谱",
|
|
6663
|
+
graphDetail: "提交详情",
|
|
6664
|
+
graphNoBody: "此提交没有正文",
|
|
6665
|
+
graphExpandBody: "展开正文",
|
|
6666
|
+
graphCollapseBody: "收起正文",
|
|
6667
|
+
graphNoFiles: "无文件变更",
|
|
6668
|
+
graphFiles: "{count} 个文件",
|
|
6669
|
+
graphBinary: "{count} 个二进制文件",
|
|
6670
|
+
graphRefresh: "刷新提交历史",
|
|
6671
|
+
graphCloseWindow: "关闭弹出的窗",
|
|
6672
|
+
graphToggleOpen: "打开图谱",
|
|
6673
|
+
graphToggleClose: "关闭图谱",
|
|
6674
|
+
graphSearch: "搜索",
|
|
6675
|
+
graphSearchPlaceholder: "文本或哈希",
|
|
6676
|
+
graphAuthorFilter: "作者筛选",
|
|
6677
|
+
graphAllAuthors: "全部作者",
|
|
6678
|
+
graphColumn: "图谱",
|
|
6679
|
+
graphCommit: "提交",
|
|
6680
|
+
graphAuthor: "作者",
|
|
6681
|
+
graphDate: "日期",
|
|
6682
|
+
graphCommits: "提交历史",
|
|
6683
|
+
graphNoMatches: "没有匹配的提交",
|
|
6684
|
+
graphEmpty: "此分支暂无提交",
|
|
6685
|
+
graphLoading: "正在读取提交…",
|
|
6686
|
+
graphLoaded: "已加载 {count} 条提交",
|
|
6687
|
+
graphRetry: "重试",
|
|
6688
|
+
graphMore: "加载更多",
|
|
4552
6689
|
menuBranches: "分支",
|
|
4553
6690
|
menuLocalBranches: "本地分支",
|
|
4554
6691
|
menuWorktrees: "工作树",
|
|
@@ -4563,7 +6700,7 @@ window.__ModuleLoader__.load({
|
|
|
4563
6700
|
menuNewBranchBad: "Git 不接受该名称",
|
|
4564
6701
|
menuNewBranchExists: "同名分支已存在",
|
|
4565
6702
|
menuFetch: "提取",
|
|
4566
|
-
menuUpdate: "
|
|
6703
|
+
menuUpdate: "更新",
|
|
4567
6704
|
ctxCheckout: "签出",
|
|
4568
6705
|
ctxHop: "跳到此工作树",
|
|
4569
6706
|
ctxWorktree: "创建工作树",
|
|
@@ -4585,8 +6722,59 @@ window.__ModuleLoader__.load({
|
|
|
4585
6722
|
fetchDone: "远程分支已同步",
|
|
4586
6723
|
updateDone: "{branch} 已快进到远程最新",
|
|
4587
6724
|
updateUpToDate: "已是最新",
|
|
4588
|
-
|
|
4589
|
-
|
|
6725
|
+
updateFailDiverged: "分支已分叉,请先合并或变基上游。",
|
|
6726
|
+
updateFailDirty: "工作区有未提交的改动,快进会覆盖它们。请先提交或暂存这些改动,再更新。",
|
|
6727
|
+
updateFailNoUpstream: "当前分支没有可用的上游,无法更新。请先推送并设置上游。",
|
|
6728
|
+
syncTitleFetch: "正在提取远程分支",
|
|
6729
|
+
syncTitleUpdate: "正在更新 {branch}",
|
|
6730
|
+
syncTitlePush: "正在推送 {branch}",
|
|
6731
|
+
syncConnecting: "正在连接远程…",
|
|
6732
|
+
syncMerging: "正在快进 {branch}…",
|
|
6733
|
+
syncCancel: "取消",
|
|
6734
|
+
fetchCancelled: "已取消提取",
|
|
6735
|
+
updateCancelled: "已取消更新",
|
|
6736
|
+
pushCancelled: "已取消推送",
|
|
6737
|
+
"aheadTitle.one": "领先上游 {n} 个提交",
|
|
6738
|
+
"aheadTitle.other": "领先上游 {n} 个提交",
|
|
6739
|
+
"behindTitle.one": "落后上游 {n} 个提交",
|
|
6740
|
+
"behindTitle.other": "落后上游 {n} 个提交",
|
|
6741
|
+
unpublishedTitle: "尚未推送:未配置上游分支",
|
|
6742
|
+
upstreamGoneTitle: "上游 {upstream} 已失效,请重新选择推送目标",
|
|
6743
|
+
ctxPush: "推送",
|
|
6744
|
+
pushTitle: "推送",
|
|
6745
|
+
pushEditTarget: "修改目标分支",
|
|
6746
|
+
pushEditTargetClose: "关闭且不应用",
|
|
6747
|
+
pushApplyEnter: "按 Enter 应用",
|
|
6748
|
+
pushNew: "新建",
|
|
6749
|
+
pushEmpty: "没有待推送的提交",
|
|
6750
|
+
pushNewEmpty: "将在远程新建此分支",
|
|
6751
|
+
"pushCommitCount.one": "{n} 个提交",
|
|
6752
|
+
"pushCommitCount.other": "{n} 个提交",
|
|
6753
|
+
pushFailBehind: "远程分支有本地没有的提交。请先更新该分支,或使用“强制推送”覆盖它们。",
|
|
6754
|
+
pushFailStale: "预览之后远程分支又有更新,预览已刷新。请确认后重新推送。",
|
|
6755
|
+
pushFailHook: "本地的 pre-push 钩子拒绝了这次推送。详情见下方。",
|
|
6756
|
+
pushFailRefused: "远程拒绝了本次更新(例如受保护分支或服务端钩子)。详情见下方。",
|
|
6757
|
+
pushFailAuth: "认证失败。请检查 Git 凭据或 SSH 密钥;插件无法弹出密码输入。",
|
|
6758
|
+
pushCommitList: "待推送提交列表",
|
|
6759
|
+
pushTruncated: "仅显示前 {n} 条提交",
|
|
6760
|
+
pushTags: "推送标记",
|
|
6761
|
+
pushTagsAll: "所有",
|
|
6762
|
+
pushTagsFollow: "跟随提交",
|
|
6763
|
+
pushTagsAllHint: "推送所有本地 Git 标记,包括与当前分支无关的标记",
|
|
6764
|
+
pushTagsFollowHint: "仅推送远程缺少、且指向本次推送提交历史的附注标记,不含轻量标记",
|
|
6765
|
+
pushForce: "强制推送",
|
|
6766
|
+
pushForceHint: "使用 force-with-lease;远程在预览后有更新时拒绝覆盖",
|
|
6767
|
+
pushOptions: "推送选项",
|
|
6768
|
+
pushRefresh: "刷新推送预览",
|
|
6769
|
+
pushBranch: "远程分支名称",
|
|
6770
|
+
pushPlanning: "正在读取本地提交…",
|
|
6771
|
+
pushCheckingRemote: "正在校验远程目标…",
|
|
6772
|
+
pushLocalChecking: "本地预览 · 正在校验远程…",
|
|
6773
|
+
pushLocalUnverified: "本地预览 · 远程尚未校验",
|
|
6774
|
+
pushLocalEmpty: "本地预览暂无待推送提交",
|
|
6775
|
+
pushReadingCommits: "正在读取提交消息…",
|
|
6776
|
+
pushBusy: "正在推送…",
|
|
6777
|
+
pushDone: "已将 {branch} 推送到 {remote}/{target}",
|
|
4590
6778
|
worktreeAskNew: "是否从 {branch} 新建工作树?",
|
|
4591
6779
|
worktreeAskRemote: "从该远程分支新建工作树?",
|
|
4592
6780
|
worktreeAskReuse: "是否切到 {branch} 工作树?",
|