dsh-git-scm 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -37
- package/lib/client.js +1180 -202
- package/lib/client.js.map +1 -1
- package/lib/host/git.d.ts +43 -0
- package/lib/host/types.d.ts +2 -0
- package/lib/index.js +213 -7
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -61,8 +61,14 @@
|
|
|
61
61
|
"action.refresh": "Refresh",
|
|
62
62
|
"action.fetch": "Fetch",
|
|
63
63
|
"action.pull": "Pull",
|
|
64
|
+
"action.pullRebase": "Pull (Rebase)",
|
|
64
65
|
"action.pullBranch": "Pull {name}",
|
|
65
66
|
"action.push": "Push",
|
|
67
|
+
"action.pushTo": "Push To",
|
|
68
|
+
"action.forcePush": "Force Push",
|
|
69
|
+
"action.fetchFrom": "Fetch From",
|
|
70
|
+
"action.moreSync": "More fetch, pull, and push actions",
|
|
71
|
+
"action.publish": "Publish",
|
|
66
72
|
"action.publishBranch": "Publish Branch",
|
|
67
73
|
"action.generateMessage": "Generate commit message",
|
|
68
74
|
"action.improveMessage": "Improve commit message",
|
|
@@ -123,7 +129,19 @@
|
|
|
123
129
|
"commit.more": "More commit actions",
|
|
124
130
|
"commit.all": "Commit all changes",
|
|
125
131
|
"commit.undo": "Undo last commit",
|
|
132
|
+
"commit.tracked": "Commit Tracked",
|
|
133
|
+
"commit.amendTracked": "Amend Tracked",
|
|
134
|
+
"commit.trackedHint": "Stages the tracked changes, then commits",
|
|
135
|
+
"commit.amendHint": "Rewrites the last commit",
|
|
136
|
+
"commit.amendNote": "This updates your most recent commit",
|
|
137
|
+
"commit.noMessage": "Write a commit message first",
|
|
138
|
+
"commit.nothingToCommit": "Nothing to commit",
|
|
139
|
+
"commit.resolveConflicts": "Resolve the conflicts before committing",
|
|
126
140
|
"commit.abort": "Abort {operation}",
|
|
141
|
+
"sync.fetch": "Fetch updates from the remote",
|
|
142
|
+
"sync.pull": "Pull the remote commits into this branch",
|
|
143
|
+
"sync.push": "Push the committed changes to the remote",
|
|
144
|
+
"sync.publish": "Publish this branch to a remote",
|
|
127
145
|
"pending.cherry-pick": "A cherry pick is in progress",
|
|
128
146
|
"pending.revert": "A revert is in progress",
|
|
129
147
|
"pending.merge": "A merge is in progress",
|
|
@@ -169,6 +187,7 @@
|
|
|
169
187
|
"menu.createBranchFrom": "Create branch from commit…",
|
|
170
188
|
"menu.copyRemoteUrl": "Copy remote URL",
|
|
171
189
|
"menu.fetchRemote": "Fetch this remote",
|
|
190
|
+
"menu.fetchAll": "All remotes",
|
|
172
191
|
"menu.collapse": "Collapse",
|
|
173
192
|
"menu.applyStash": "Apply stash",
|
|
174
193
|
"menu.popStash": "Pop stash",
|
|
@@ -197,6 +216,7 @@
|
|
|
197
216
|
"confirm.dropAllStashes": "Drop every stash? This cannot be undone.",
|
|
198
217
|
"confirm.deleteTag": "Delete tag {name}?",
|
|
199
218
|
"confirm.undoCommit": "Undo the last commit, keeping its changes staged?",
|
|
219
|
+
"confirm.forcePush": "Force push the current branch? This overwrites the remote branch when the lease allows it.",
|
|
200
220
|
"confirm.abort": "Abort the {operation} in progress?",
|
|
201
221
|
"confirm.submit": "Confirm",
|
|
202
222
|
"confirm.cancel": "Cancel",
|
|
@@ -215,6 +235,8 @@
|
|
|
215
235
|
"diff.resize": "Drag to resize the comparison",
|
|
216
236
|
"diff.unchanged": "{n} unchanged lines",
|
|
217
237
|
"diff.expand": "Expand",
|
|
238
|
+
"diff.collapsePanel": "Collapse comparison pane",
|
|
239
|
+
"diff.expandPanel": "Expand comparison pane",
|
|
218
240
|
"diff.searchPlaceholder": "Find in comparison",
|
|
219
241
|
"diff.nextMatch": "Next match",
|
|
220
242
|
"diff.previousMatch": "Previous match",
|
|
@@ -239,6 +261,37 @@
|
|
|
239
261
|
"branch.picker.empty": "No matching branch",
|
|
240
262
|
"group.changes": "Changes",
|
|
241
263
|
"group.repositories": "Git repositories",
|
|
264
|
+
"section.worktrees": "Worktrees",
|
|
265
|
+
"empty.worktrees": "No linked worktrees",
|
|
266
|
+
"action.createWorktree": "New Worktree",
|
|
267
|
+
"action.removeWorktree": "Remove worktree",
|
|
268
|
+
"action.forceRemoveWorktree": "Force Remove",
|
|
269
|
+
"action.switchWorktree": "Switch to this worktree",
|
|
270
|
+
"action.pruneWorktrees": "Prune missing worktrees",
|
|
271
|
+
"action.copyWorktreePath": "Copy worktree path",
|
|
272
|
+
"worktree.mainCheckout": "Main checkout",
|
|
273
|
+
"worktree.detached": "Detached HEAD",
|
|
274
|
+
"worktree.bare": "Bare repository",
|
|
275
|
+
"worktree.locked": "Locked",
|
|
276
|
+
"worktree.lockedReason": "Locked: {reason}",
|
|
277
|
+
"worktree.prunable": "Missing",
|
|
278
|
+
"worktree.current": "This Session works here",
|
|
279
|
+
"worktree.switchTooltip": "{path} — click to move this Session here",
|
|
280
|
+
"worktree.dialogTitle": "New Worktree",
|
|
281
|
+
"worktree.branchField": "Branch name",
|
|
282
|
+
"worktree.branchPlaceholder": "feature/my-task",
|
|
283
|
+
"worktree.directoryPreview": "Worktree directory: .agents/worktrees/{slug}",
|
|
284
|
+
"worktree.baseNote": "The branch starts at {base}; an existing local branch is checked out instead.",
|
|
285
|
+
"worktree.create": "Create Worktree",
|
|
286
|
+
"worktree.branchRequired": "Enter a branch name",
|
|
287
|
+
"confirm.switchWorktree": "Move this Session into the worktree {name}? The Git panel and the Session working directory will follow.",
|
|
288
|
+
"confirm.removeWorktree": "Remove the worktree {name}? Its directory is deleted; committed work stays on its branch.",
|
|
289
|
+
"confirm.forceRemoveWorktree": "Remove the worktree {name} even though it has uncommitted changes? Those changes are lost.",
|
|
290
|
+
"toast.worktreeCreated": "Created worktree {name}",
|
|
291
|
+
"toast.worktreeRemoved": "Removed worktree {name}",
|
|
292
|
+
"toast.worktreeSwitched": "This Session now works in {name}",
|
|
293
|
+
"toast.worktreeRemoveFailed": "Could not remove the worktree",
|
|
294
|
+
"toast.worktreesPruned": "Pruned missing worktrees",
|
|
242
295
|
"confirm.discardAll": "Discard every working-tree change? This cannot be undone.",
|
|
243
296
|
"diff.stashLabel": "Stash entry",
|
|
244
297
|
"empty.changes": "No changes",
|
|
@@ -261,6 +314,7 @@
|
|
|
261
314
|
"toast.pulledBranch": "Pulled {name} — {n} commits",
|
|
262
315
|
"toast.pulledBranchCurrent": "Pulled {name} — already up to date",
|
|
263
316
|
"toast.pushed": "Pushed",
|
|
317
|
+
"toast.forcePushed": "Force pushed",
|
|
264
318
|
"toast.published": "Published {branch}",
|
|
265
319
|
"toast.generateFailed": "Could not generate a commit message",
|
|
266
320
|
"toast.initialized": "Initialized the Git repository",
|
|
@@ -349,8 +403,14 @@
|
|
|
349
403
|
"action.refresh": "刷新",
|
|
350
404
|
"action.fetch": "抓取",
|
|
351
405
|
"action.pull": "拉取",
|
|
406
|
+
"action.pullRebase": "拉取(变基)",
|
|
352
407
|
"action.pullBranch": "拉取 {name}",
|
|
353
408
|
"action.push": "推送",
|
|
409
|
+
"action.pushTo": "推送到远程",
|
|
410
|
+
"action.forcePush": "强制推送",
|
|
411
|
+
"action.fetchFrom": "从远程抓取",
|
|
412
|
+
"action.moreSync": "更多抓取、拉取和推送操作",
|
|
413
|
+
"action.publish": "发布",
|
|
354
414
|
"action.publishBranch": "发布 Branch",
|
|
355
415
|
"action.generateMessage": "生成提交信息",
|
|
356
416
|
"action.improveMessage": "优化提交信息",
|
|
@@ -411,7 +471,19 @@
|
|
|
411
471
|
"commit.more": "更多提交操作",
|
|
412
472
|
"commit.all": "提交全部更改",
|
|
413
473
|
"commit.undo": "撤消上次提交",
|
|
474
|
+
"commit.tracked": "提交已跟踪更改",
|
|
475
|
+
"commit.amendTracked": "修正已跟踪更改",
|
|
476
|
+
"commit.trackedHint": "先暂存所有已跟踪更改,再提交",
|
|
477
|
+
"commit.amendHint": "重写上一次提交",
|
|
478
|
+
"commit.amendNote": "将更新最近一次提交",
|
|
479
|
+
"commit.noMessage": "请先填写提交信息",
|
|
480
|
+
"commit.nothingToCommit": "没有可提交的更改",
|
|
481
|
+
"commit.resolveConflicts": "请先解决冲突再提交",
|
|
414
482
|
"commit.abort": "中止{operation}",
|
|
483
|
+
"sync.fetch": "从远程抓取更新",
|
|
484
|
+
"sync.pull": "把远程提交拉取到当前分支",
|
|
485
|
+
"sync.push": "把已提交的更改推送到远程",
|
|
486
|
+
"sync.publish": "把当前分支发布到远程",
|
|
415
487
|
"pending.cherry-pick": "正在进行 Cherry Pick",
|
|
416
488
|
"pending.revert": "正在进行 Revert",
|
|
417
489
|
"pending.merge": "正在进行合并",
|
|
@@ -457,6 +529,7 @@
|
|
|
457
529
|
"menu.createBranchFrom": "从该提交创建分支…",
|
|
458
530
|
"menu.copyRemoteUrl": "复制远程地址",
|
|
459
531
|
"menu.fetchRemote": "抓取该远程",
|
|
532
|
+
"menu.fetchAll": "所有远程",
|
|
460
533
|
"menu.collapse": "收起",
|
|
461
534
|
"menu.applyStash": "应用储藏",
|
|
462
535
|
"menu.popStash": "弹出储藏",
|
|
@@ -485,6 +558,7 @@
|
|
|
485
558
|
"confirm.dropAllStashes": "删除所有储藏?此操作无法撤销。",
|
|
486
559
|
"confirm.deleteTag": "删除标签 {name}?",
|
|
487
560
|
"confirm.undoCommit": "撤消上次提交并保留其更改为暂存状态?",
|
|
561
|
+
"confirm.forcePush": "强制推送当前分支?在 lease 允许时会覆盖远程分支。",
|
|
488
562
|
"confirm.abort": "中止正在进行的 {operation}?",
|
|
489
563
|
"confirm.submit": "确定",
|
|
490
564
|
"confirm.cancel": "取消",
|
|
@@ -503,6 +577,8 @@
|
|
|
503
577
|
"diff.resize": "拖动调整对比区域高度",
|
|
504
578
|
"diff.unchanged": "{n} 行未更改",
|
|
505
579
|
"diff.expand": "展开",
|
|
580
|
+
"diff.collapsePanel": "收起对比面板",
|
|
581
|
+
"diff.expandPanel": "展开对比面板",
|
|
506
582
|
"diff.searchPlaceholder": "在对比中查找",
|
|
507
583
|
"diff.nextMatch": "下一个匹配",
|
|
508
584
|
"diff.previousMatch": "上一个匹配",
|
|
@@ -527,6 +603,37 @@
|
|
|
527
603
|
"branch.picker.empty": "没有匹配的分支",
|
|
528
604
|
"group.changes": "更改",
|
|
529
605
|
"group.repositories": "Git 仓库",
|
|
606
|
+
"section.worktrees": "工作树",
|
|
607
|
+
"empty.worktrees": "没有链接工作树",
|
|
608
|
+
"action.createWorktree": "新建工作树",
|
|
609
|
+
"action.removeWorktree": "删除工作树",
|
|
610
|
+
"action.forceRemoveWorktree": "强制删除",
|
|
611
|
+
"action.switchWorktree": "切换到该工作树",
|
|
612
|
+
"action.pruneWorktrees": "清理失效的工作树",
|
|
613
|
+
"action.copyWorktreePath": "复制工作树路径",
|
|
614
|
+
"worktree.mainCheckout": "主检出",
|
|
615
|
+
"worktree.detached": "分离头指针",
|
|
616
|
+
"worktree.bare": "裸仓库",
|
|
617
|
+
"worktree.locked": "已锁定",
|
|
618
|
+
"worktree.lockedReason": "已锁定:{reason}",
|
|
619
|
+
"worktree.prunable": "目录缺失",
|
|
620
|
+
"worktree.current": "当前会话在此工作",
|
|
621
|
+
"worktree.switchTooltip": "{path} — 点击把当前会话切换到这里",
|
|
622
|
+
"worktree.dialogTitle": "新建工作树",
|
|
623
|
+
"worktree.branchField": "分支名",
|
|
624
|
+
"worktree.branchPlaceholder": "feature/my-task",
|
|
625
|
+
"worktree.directoryPreview": "工作树目录:.agents/worktrees/{slug}",
|
|
626
|
+
"worktree.baseNote": "新分支从 {base} 创建;若该分支已存在则直接检出。",
|
|
627
|
+
"worktree.create": "创建工作树",
|
|
628
|
+
"worktree.branchRequired": "请填写分支名",
|
|
629
|
+
"confirm.switchWorktree": "把当前会话切换到工作树 {name}?Git 面板和会话工作目录都会跟随切换。",
|
|
630
|
+
"confirm.removeWorktree": "删除工作树 {name}?其目录会被删除,已提交的内容仍保留在对应分支上。",
|
|
631
|
+
"confirm.forceRemoveWorktree": "工作树 {name} 有未提交的更改,仍要强制删除吗?这些更改将丢失。",
|
|
632
|
+
"toast.worktreeCreated": "已创建工作树 {name}",
|
|
633
|
+
"toast.worktreeRemoved": "已删除工作树 {name}",
|
|
634
|
+
"toast.worktreeSwitched": "当前会话已切换到 {name}",
|
|
635
|
+
"toast.worktreeRemoveFailed": "删除工作树失败",
|
|
636
|
+
"toast.worktreesPruned": "已清理失效的工作树",
|
|
530
637
|
"confirm.discardAll": "放弃所有工作区更改?此操作无法撤销。",
|
|
531
638
|
"diff.stashLabel": "储藏条目",
|
|
532
639
|
"empty.changes": "没有更改",
|
|
@@ -549,6 +656,7 @@
|
|
|
549
656
|
"toast.pulledBranch": "已拉取 {name} — {n} 个提交",
|
|
550
657
|
"toast.pulledBranchCurrent": "已拉取 {name} — 已是最新",
|
|
551
658
|
"toast.pushed": "已推送",
|
|
659
|
+
"toast.forcePushed": "已强制推送",
|
|
552
660
|
"toast.published": "已发布分支 {branch}",
|
|
553
661
|
"toast.generateFailed": "生成提交信息失败",
|
|
554
662
|
"toast.initialized": "已初始化 Git 仓库",
|
|
@@ -620,15 +728,6 @@
|
|
|
620
728
|
}
|
|
621
729
|
.dgscm-repo-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
622
730
|
.dgscm-repo-glyph { display: inline-flex; flex: none; color: var(--dsw-alias-label-secondary); }
|
|
623
|
-
.dgscm-repo-name {
|
|
624
|
-
min-width: 0;
|
|
625
|
-
overflow: hidden;
|
|
626
|
-
font-size: 13px;
|
|
627
|
-
font-weight: 600;
|
|
628
|
-
line-height: 20px;
|
|
629
|
-
text-overflow: ellipsis;
|
|
630
|
-
white-space: nowrap;
|
|
631
|
-
}
|
|
632
731
|
.dgscm-branch-chip {
|
|
633
732
|
display: inline-flex;
|
|
634
733
|
flex: 0 1 auto;
|
|
@@ -689,8 +788,11 @@
|
|
|
689
788
|
white-space: nowrap;
|
|
690
789
|
}
|
|
691
790
|
.dgscm-top-actions { display: flex; flex: none; align-items: center; gap: 2px; margin-left: auto; }
|
|
791
|
+
.dgscm-sync-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
792
|
+
.dgscm-sync-actions { display: flex; flex: none; align-items: center; gap: 1px; margin-left: auto; }
|
|
692
793
|
.dgscm-sync {
|
|
693
794
|
display: flex;
|
|
795
|
+
flex: 1 1 auto;
|
|
694
796
|
align-items: center;
|
|
695
797
|
gap: 6px;
|
|
696
798
|
min-width: 0;
|
|
@@ -777,16 +879,14 @@
|
|
|
777
879
|
.dgscm-textarea::placeholder { color: var(--dsw-alias-label-tertiary); }
|
|
778
880
|
.dgscm-textarea:focus { border-color: var(--dsw-alias-brand-primary); }
|
|
779
881
|
.dgscm-commit-row { display: flex; align-items: center; gap: 8px; }
|
|
780
|
-
.dgscm-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
color: var(--dsw-alias-label-secondary);
|
|
882
|
+
.dgscm-commit-note {
|
|
883
|
+
min-width: 0;
|
|
884
|
+
overflow: hidden;
|
|
885
|
+
color: var(--dsw-alias-label-tertiary);
|
|
785
886
|
font-size: 11px;
|
|
786
|
-
|
|
787
|
-
|
|
887
|
+
text-overflow: ellipsis;
|
|
888
|
+
white-space: nowrap;
|
|
788
889
|
}
|
|
789
|
-
.dgscm-check input { margin: 0; accent-color: var(--dsw-alias-brand-primary); }
|
|
790
890
|
|
|
791
891
|
.dgscm-button {
|
|
792
892
|
display: inline-flex;
|
|
@@ -820,66 +920,112 @@
|
|
|
820
920
|
.dgscm-button--quiet:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
|
|
821
921
|
.dgscm-button:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
822
922
|
.dgscm-commit-actions { display: flex; align-items: center; gap: 0; margin-left: auto; }
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
.dgscm-split-
|
|
923
|
+
|
|
924
|
+
/* The Zed-style split control: one quiet pill whose left segment performs the
|
|
925
|
+
default action and whose chevron opens the rest. The header's sync control
|
|
926
|
+
and the commit action reuse the same surface so they read as one family;
|
|
927
|
+
each modifier only changes the geometry. The fill is the dimmed primary
|
|
928
|
+
surface, so the pill sits quieter than a full primary button. */
|
|
929
|
+
.dgscm-split-button,
|
|
930
|
+
.dgscm-sync-control {
|
|
830
931
|
display: inline-flex;
|
|
831
932
|
flex: none;
|
|
933
|
+
align-items: stretch;
|
|
934
|
+
height: 24px;
|
|
935
|
+
overflow: hidden;
|
|
936
|
+
border-radius: var(--dsw-radius-sm, 8px);
|
|
937
|
+
background: var(--dsw-alias-button-primary-dimmed, var(--dsw-alias-bg-layer-2));
|
|
938
|
+
color: var(--dsw-alias-label-primary);
|
|
939
|
+
}
|
|
940
|
+
.dgscm-split-button--commit { height: 28px; }
|
|
941
|
+
.dgscm-split-main,
|
|
942
|
+
.dgscm-sync-primary {
|
|
943
|
+
display: inline-flex;
|
|
832
944
|
align-items: center;
|
|
833
945
|
justify-content: center;
|
|
834
|
-
|
|
835
|
-
|
|
946
|
+
gap: 5px;
|
|
947
|
+
min-width: 0;
|
|
948
|
+
padding: 0 8px;
|
|
949
|
+
border: none;
|
|
950
|
+
background: transparent;
|
|
951
|
+
color: inherit;
|
|
952
|
+
font: inherit;
|
|
953
|
+
font-size: 11px;
|
|
954
|
+
font-weight: 500;
|
|
955
|
+
line-height: 18px;
|
|
956
|
+
white-space: nowrap;
|
|
957
|
+
cursor: pointer;
|
|
958
|
+
}
|
|
959
|
+
.dgscm-split-button--commit .dgscm-split-main { min-width: 88px; padding: 0 12px; font-size: 12px; }
|
|
960
|
+
.dgscm-sync-text { letter-spacing: 0.01em; }
|
|
961
|
+
.dgscm-sync-count {
|
|
962
|
+
display: inline-flex;
|
|
963
|
+
align-items: center;
|
|
964
|
+
color: var(--dsw-alias-label-secondary);
|
|
965
|
+
font-family: var(--ds-font-family-code, ui-monospace, Menlo, monospace);
|
|
966
|
+
font-size: 10px;
|
|
967
|
+
line-height: 1;
|
|
968
|
+
}
|
|
969
|
+
/* The pill counts sit on the dimmed fill rather than the darker sidebar, so
|
|
970
|
+
mixing in the label colour keeps them legible (the sync row repeats the
|
|
971
|
+
same counts on the darker surface). */
|
|
972
|
+
.dgscm-sync-count--ahead { color: color-mix(in srgb, var(--dsw-alias-state-success-primary) 78%, var(--dsw-alias-label-primary)); }
|
|
973
|
+
.dgscm-sync-count--behind { color: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 78%, var(--dsw-alias-label-primary)); }
|
|
974
|
+
.dgscm-split-toggle,
|
|
975
|
+
.dgscm-sync-toggle {
|
|
976
|
+
display: inline-flex;
|
|
977
|
+
flex: none;
|
|
978
|
+
align-items: center;
|
|
979
|
+
justify-content: center;
|
|
980
|
+
width: 20px;
|
|
836
981
|
padding: 0;
|
|
837
982
|
border: none;
|
|
838
983
|
border-left: 1px solid color-mix(in srgb, var(--dsw-alias-label-primary) 20%, transparent);
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
color: var(--dsw-alias-label-primary);
|
|
984
|
+
background: transparent;
|
|
985
|
+
color: var(--dsw-alias-label-secondary);
|
|
842
986
|
cursor: pointer;
|
|
843
987
|
}
|
|
844
|
-
.dgscm-commit-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
color: var(--dsw-alias-label-primary);
|
|
850
|
-
font-size: 12px;
|
|
851
|
-
line-height: 18px;
|
|
852
|
-
font-weight: 500;
|
|
853
|
-
min-width: 76px;
|
|
854
|
-
}
|
|
855
|
-
/* Hover: one subtle step of the label colour mixed into the dimmed fill, which
|
|
856
|
-
lightens it on the dark theme and darkens it on the light theme, so the step
|
|
857
|
-
stays theme-correct instead of jumping to the bright primary hover. */
|
|
988
|
+
.dgscm-split-button--commit .dgscm-split-toggle { width: 26px; }
|
|
989
|
+
.dgscm-split-toggle svg,
|
|
990
|
+
.dgscm-sync-toggle svg { pointer-events: none; }
|
|
991
|
+
/* Hover steps the shared pill fill with the label colour, so the light theme
|
|
992
|
+
darkens and the dark theme lightens by the same rule. */
|
|
858
993
|
@media (hover: hover) {
|
|
859
|
-
.dgscm-
|
|
860
|
-
.dgscm-split-
|
|
994
|
+
.dgscm-split-main:hover:not(:disabled),
|
|
995
|
+
.dgscm-split-toggle:hover:not(:disabled),
|
|
996
|
+
.dgscm-sync-primary:hover:not(:disabled),
|
|
997
|
+
.dgscm-sync-toggle:hover:not(:disabled) {
|
|
861
998
|
background: color-mix(in srgb, var(--dsw-alias-button-primary-dimmed, var(--dsw-alias-bg-layer-2)) 88%, var(--dsw-alias-label-primary));
|
|
862
999
|
}
|
|
863
1000
|
}
|
|
864
1001
|
/* Pressed: DSH defines no separate pressed token for primary buttons, so the
|
|
865
1002
|
pressed state deliberately keeps the hover fill instead of inventing one. */
|
|
866
|
-
.dgscm-
|
|
867
|
-
.dgscm-split-
|
|
1003
|
+
.dgscm-split-main:active:not(:disabled),
|
|
1004
|
+
.dgscm-split-toggle:active:not(:disabled),
|
|
1005
|
+
.dgscm-sync-primary:active:not(:disabled),
|
|
1006
|
+
.dgscm-sync-toggle:active:not(:disabled) {
|
|
868
1007
|
background: color-mix(in srgb, var(--dsw-alias-button-primary-dimmed, var(--dsw-alias-bg-layer-2)) 88%, var(--dsw-alias-label-primary));
|
|
869
1008
|
}
|
|
870
|
-
/* Focus: the host focus-ring tokens
|
|
871
|
-
|
|
872
|
-
.dgscm-
|
|
873
|
-
.dgscm-split-
|
|
1009
|
+
/* Focus: the host focus-ring tokens, inset so the ring follows the segment
|
|
1010
|
+
instead of bleeding past the pill's rounded outline. */
|
|
1011
|
+
.dgscm-split-main:focus-visible,
|
|
1012
|
+
.dgscm-split-toggle:focus-visible,
|
|
1013
|
+
.dgscm-sync-primary:focus-visible,
|
|
1014
|
+
.dgscm-sync-toggle:focus-visible {
|
|
874
1015
|
outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
|
|
875
|
-
outline-offset:
|
|
1016
|
+
outline-offset: -2px;
|
|
876
1017
|
}
|
|
877
|
-
/* Disabled: host parity (dimmed, not-allowed), scoped to the
|
|
878
|
-
.dgscm-
|
|
879
|
-
.dgscm-split-
|
|
1018
|
+
/* Disabled: host parity (dimmed, not-allowed), scoped to the split segments. */
|
|
1019
|
+
.dgscm-split-main:disabled,
|
|
1020
|
+
.dgscm-split-toggle:disabled,
|
|
1021
|
+
.dgscm-sync-primary:disabled,
|
|
1022
|
+
.dgscm-sync-toggle:disabled {
|
|
880
1023
|
opacity: 0.4;
|
|
881
1024
|
cursor: not-allowed;
|
|
882
1025
|
}
|
|
1026
|
+
/* A remote operation or commit in progress spins the glyph in place. */
|
|
1027
|
+
.dgscm-sync-primary[aria-busy='true'] svg,
|
|
1028
|
+
.dgscm-split-main[aria-busy='true'] svg { animation: dgscm-spin 900ms linear infinite; }
|
|
883
1029
|
|
|
884
1030
|
.dgscm-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding-bottom: 16px; }
|
|
885
1031
|
|
|
@@ -1020,6 +1166,45 @@
|
|
|
1020
1166
|
.dgscm-branch-flag { display: inline-flex; align-items: center; color: var(--dsw-alias-label-tertiary); }
|
|
1021
1167
|
.dgscm-branch-flag--unpublished { color: var(--dsw-alias-state-success-primary); font-family: var(--ds-font-family-code, ui-monospace, Menlo, monospace); font-size: 10px; font-weight: 700; }
|
|
1022
1168
|
.dgscm-branch-flag--current { color: var(--dsw-alias-label-secondary); }
|
|
1169
|
+
/* Worktree rows: the folder glyph is a checkout, a missing directory is an
|
|
1170
|
+
error tone, a locked worktree says so in the warn tone. */
|
|
1171
|
+
.dgscm-row-glyph--worktree { color: var(--dsw-alias-brand-primary); }
|
|
1172
|
+
.dgscm-row-note--warn { color: var(--dsw-alias-state-warn-primary); }
|
|
1173
|
+
.dgscm-row--prunable .dgscm-row-name { color: var(--dsw-alias-label-tertiary); }
|
|
1174
|
+
/* Keep the branch name whole: the relative directory suffix shrinks first. */
|
|
1175
|
+
.dgscm-row--worktree .dgscm-row-dir { flex-shrink: 999; }
|
|
1176
|
+
/* The remote name stays whole; a long URL ellipsizes against it. */
|
|
1177
|
+
.dgscm-row--remote .dgscm-row-name { flex-shrink: 0; }
|
|
1178
|
+
.dgscm-row--remote .dgscm-row-dir { flex-shrink: 999; }
|
|
1179
|
+
/* The branch name is the row's identity: the upstream path gives up its width
|
|
1180
|
+
first, so a short name like "main" never collapses to "m...". */
|
|
1181
|
+
.dgscm-row--branch .dgscm-row-dir { flex-shrink: 999; }
|
|
1182
|
+
/* The name is never squeezed by flex rounding: it keeps its natural width
|
|
1183
|
+
while the row fits, the upstream path and relative date yield first, and only
|
|
1184
|
+
a name wider than the space the row can give it ellipsizes on one line. The
|
|
1185
|
+
cap leaves room for the chevron, glyph, tracking counts, hover actions and
|
|
1186
|
+
status flag. */
|
|
1187
|
+
.dgscm-row--branch .dgscm-row-name {
|
|
1188
|
+
flex-shrink: 0;
|
|
1189
|
+
max-width: calc(100% - 170px);
|
|
1190
|
+
min-width: 0;
|
|
1191
|
+
overflow: hidden;
|
|
1192
|
+
text-overflow: ellipsis;
|
|
1193
|
+
white-space: nowrap;
|
|
1194
|
+
}
|
|
1195
|
+
.dgscm-row--branch .dgscm-row-end .dgscm-row-note {
|
|
1196
|
+
flex-shrink: 999;
|
|
1197
|
+
min-width: 0;
|
|
1198
|
+
overflow: hidden;
|
|
1199
|
+
}
|
|
1200
|
+
.dgscm-worktree-flag--missing { display: inline-flex; flex: none; color: var(--dsw-alias-state-error-primary); }
|
|
1201
|
+
.dgscm-badge--worktree {
|
|
1202
|
+
background: color-mix(in srgb, var(--dsw-alias-brand-primary) 14%, transparent);
|
|
1203
|
+
color: var(--dsw-alias-brand-primary);
|
|
1204
|
+
}
|
|
1205
|
+
/* A linked checkout is marked by a glyph badge: the word would push the branch
|
|
1206
|
+
chip out of the header at common sidebar widths. */
|
|
1207
|
+
.dgscm-badge--icon { height: 18px; padding: 0 4px; }
|
|
1023
1208
|
.dgscm-row-chevron { display: inline-flex; flex: none; width: 14px; justify-content: center; }
|
|
1024
1209
|
.dgscm-row-mark {
|
|
1025
1210
|
display: inline-flex;
|
|
@@ -1044,6 +1229,18 @@
|
|
|
1044
1229
|
the suffix absorbs the shortage first, and the name only truncates once it
|
|
1045
1230
|
is gone. */
|
|
1046
1231
|
.dgscm-row--file .dgscm-row-dir { flex-shrink: 999; }
|
|
1232
|
+
/* The file name is never squeezed by flex rounding: it keeps its natural width
|
|
1233
|
+
while the row fits, the directory suffix yields first, and only a name wider
|
|
1234
|
+
than the space the row can give it ellipsizes on one line. The cap leaves
|
|
1235
|
+
room for the glyph, the gaps, the hover actions and the status mark. */
|
|
1236
|
+
.dgscm-row--file .dgscm-row-name {
|
|
1237
|
+
flex-shrink: 0;
|
|
1238
|
+
max-width: calc(100% - 115px);
|
|
1239
|
+
min-width: 0;
|
|
1240
|
+
overflow: hidden;
|
|
1241
|
+
text-overflow: ellipsis;
|
|
1242
|
+
white-space: nowrap;
|
|
1243
|
+
}
|
|
1047
1244
|
/* Change tree: file rows pad past the folder chevron so a file glyph lines up
|
|
1048
1245
|
with a folder glyph at the same depth. */
|
|
1049
1246
|
.dgscm-row--dir { cursor: pointer; }
|
|
@@ -1312,6 +1509,31 @@
|
|
|
1312
1509
|
text-overflow: ellipsis;
|
|
1313
1510
|
white-space: nowrap;
|
|
1314
1511
|
}
|
|
1512
|
+
/* The title is the comparison's disclosure control: clicking it folds the body. */
|
|
1513
|
+
.dgscm-diff-title {
|
|
1514
|
+
display: flex;
|
|
1515
|
+
flex: 1 1 auto;
|
|
1516
|
+
align-items: center;
|
|
1517
|
+
gap: 3px;
|
|
1518
|
+
min-width: 0;
|
|
1519
|
+
height: 26px;
|
|
1520
|
+
padding: 0 4px 0 2px;
|
|
1521
|
+
border: none;
|
|
1522
|
+
border-radius: 4px;
|
|
1523
|
+
background: transparent;
|
|
1524
|
+
color: inherit;
|
|
1525
|
+
font: inherit;
|
|
1526
|
+
text-align: left;
|
|
1527
|
+
cursor: pointer;
|
|
1528
|
+
}
|
|
1529
|
+
.dgscm-diff-title:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
1530
|
+
.dgscm-diff-title:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--dsw-alias-brand-primary); }
|
|
1531
|
+
.dgscm-diff-title .dgscm-diff-path { padding-left: 0; }
|
|
1532
|
+
.dgscm-diff-head--collapsed { border-bottom: none; }
|
|
1533
|
+
/* The collapsed pane hides the body instead of unmounting it, so its scroll
|
|
1534
|
+
position and expanded context runs survive a fold. */
|
|
1535
|
+
.dgscm-diffpane--collapsed .dgscm-diff-body { display: none; }
|
|
1536
|
+
.dgscm-diffpane--collapsed .dgscm-diff-search { display: none; }
|
|
1315
1537
|
.dgscm-diff-stats { display: flex; flex: none; align-items: center; gap: 5px; font-family: var(--ds-font-family-code, ui-monospace, Menlo, monospace); font-size: 11px; }
|
|
1316
1538
|
.dgscm-diff-added { color: var(--dsw-alias-state-success-primary); }
|
|
1317
1539
|
.dgscm-diff-deleted { color: var(--dsw-alias-state-error-primary); }
|
|
@@ -1666,9 +1888,19 @@
|
|
|
1666
1888
|
.dgscm-native-label { display: none; }
|
|
1667
1889
|
}
|
|
1668
1890
|
|
|
1891
|
+
@container dgscm (max-width: 380px) {
|
|
1892
|
+
/* The linked-checkout glyph yields to the repo name and branch chip in
|
|
1893
|
+
narrow panels; the Worktrees section still marks the current checkout. */
|
|
1894
|
+
.dgscm-badge--worktree { display: none; }
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1669
1897
|
@container dgscm (max-width: 340px) {
|
|
1670
|
-
.dgscm-repo-name { max-width: 40%; }
|
|
1671
1898
|
.dgscm-row-meta { display: none; }
|
|
1899
|
+
/* Below 340px the header keeps only the essentials: the pill drops its
|
|
1900
|
+
counts (the sync row repeats them) and the branch chip drops its publish
|
|
1901
|
+
button, which the pill's own Publish primary already covers. */
|
|
1902
|
+
.dgscm-sync-count { display: none; }
|
|
1903
|
+
.dgscm-branch-publish { display: none; }
|
|
1672
1904
|
}
|
|
1673
1905
|
|
|
1674
1906
|
/* Publish call to action: the dimmed primary surface, full width, while the
|
|
@@ -1706,7 +1938,9 @@
|
|
|
1706
1938
|
overflow: hidden;
|
|
1707
1939
|
border: 0.5px solid var(--dsw-alias-border-l2);
|
|
1708
1940
|
border-radius: 6px;
|
|
1709
|
-
|
|
1941
|
+
/* Opaque, not the translucent menu surface: the tip floats over the panel
|
|
1942
|
+
header, where a transparent fill let the underlying toolbar show through. */
|
|
1943
|
+
background: var(--dsw-alias-bg-layer-2, var(--dsw-menu-surface-fill, var(--dsw-alias-bg-overlay)));
|
|
1710
1944
|
box-shadow: var(--dsw-elevation-prominent, 0 3px 8px rgba(0, 0, 0, 0.2));
|
|
1711
1945
|
color: var(--dsw-alias-label-primary);
|
|
1712
1946
|
font-size: 11px;
|
|
@@ -1717,6 +1951,18 @@
|
|
|
1717
1951
|
pointer-events: none;
|
|
1718
1952
|
}
|
|
1719
1953
|
|
|
1954
|
+
/* The New Worktree dialog: branch field plus the derived pool directory. */
|
|
1955
|
+
.dgscm-worktree-dialog { max-width: 400px; }
|
|
1956
|
+
.dgscm-worktree-dialog .dgscm-modal-note { margin-bottom: 10px; }
|
|
1957
|
+
.dgscm-worktree-preview {
|
|
1958
|
+
margin-bottom: 6px;
|
|
1959
|
+
color: var(--dsw-alias-label-secondary);
|
|
1960
|
+
font-family: var(--ds-font-family-code, ui-monospace, Menlo, monospace);
|
|
1961
|
+
font-size: 11px;
|
|
1962
|
+
line-height: 16px;
|
|
1963
|
+
overflow-wrap: anywhere;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1720
1966
|
/* The GitHub publish dialog: repository name then one row per destination. */
|
|
1721
1967
|
.dgscm-publish-dialog { width: min(420px, 100%); }
|
|
1722
1968
|
.dgscm-publish-dialog .dgscm-modal-card { max-width: 420px; }
|
|
@@ -1768,6 +2014,22 @@
|
|
|
1768
2014
|
/* The message field carries its own model control in the corner. */
|
|
1769
2015
|
.dgscm-message { position: relative; display: flex; }
|
|
1770
2016
|
.dgscm-message .dgscm-textarea { flex: 1 1 auto; padding-right: 36px; }
|
|
2017
|
+
/* The commit hint wraps in a narrow panel; this hidden twin measures the
|
|
2018
|
+
wrapped hint (same font and text width as the field) so the field can grow
|
|
2019
|
+
before the placeholder is painted. */
|
|
2020
|
+
.dgscm-message-measure {
|
|
2021
|
+
position: absolute;
|
|
2022
|
+
top: 0;
|
|
2023
|
+
left: 10px;
|
|
2024
|
+
right: 37px;
|
|
2025
|
+
visibility: hidden;
|
|
2026
|
+
pointer-events: none;
|
|
2027
|
+
font: inherit;
|
|
2028
|
+
font-size: 12px;
|
|
2029
|
+
line-height: 17px;
|
|
2030
|
+
white-space: normal;
|
|
2031
|
+
overflow-wrap: anywhere;
|
|
2032
|
+
}
|
|
1771
2033
|
.dgscm-generate {
|
|
1772
2034
|
position: absolute;
|
|
1773
2035
|
top: 5px;
|
|
@@ -1972,6 +2234,16 @@
|
|
|
1972
2234
|
function TrashIcon(props) {
|
|
1973
2235
|
return h(Glyph, props, h("path", { d: "M2.8 4.4h10.4" }), h("path", { d: "M6.4 4.4V3a.8.8 0 0 1 .8-.8h1.6a.8.8 0 0 1 .8.8v1.4" }), h("path", { d: "M4.2 4.4l.6 8.1a.9.9 0 0 0 .9.8h4.6a.9.9 0 0 0 .9-.8l.6-8.1" }));
|
|
1974
2236
|
}
|
|
2237
|
+
/** Lock glyph, for a locked worktree. */
|
|
2238
|
+
function LockIcon(props) {
|
|
2239
|
+
return h(Glyph, props, h("rect", {
|
|
2240
|
+
x: 3.6,
|
|
2241
|
+
y: 7.2,
|
|
2242
|
+
width: 8.8,
|
|
2243
|
+
height: 6.2,
|
|
2244
|
+
rx: 1.2
|
|
2245
|
+
}), h("path", { d: "M5.6 7.2V5.4a2.4 2.4 0 0 1 4.8 0v1.8" }));
|
|
2246
|
+
}
|
|
1975
2247
|
/** Chevron glyph; rotation shows the disclosure state. */
|
|
1976
2248
|
function ChevronIcon({ open = false, size = 12, ...rest }) {
|
|
1977
2249
|
return h("span", { className: `dgscm-chevron${open ? " dgscm-chevron--open" : ""}` }, h(Glyph, {
|
|
@@ -2150,6 +2422,7 @@
|
|
|
2150
2422
|
DockBottomIcon,
|
|
2151
2423
|
DockRightIcon,
|
|
2152
2424
|
SearchIcon,
|
|
2425
|
+
LockIcon,
|
|
2153
2426
|
HistoryIcon,
|
|
2154
2427
|
CaretIcon,
|
|
2155
2428
|
SpinnerIcon
|
|
@@ -2300,8 +2573,16 @@
|
|
|
2300
2573
|
publishGithub: "action.publishBranch",
|
|
2301
2574
|
commit: "commit.submit",
|
|
2302
2575
|
cherryPick: "toast.cherryPicked",
|
|
2303
|
-
revert: "toast.reverted"
|
|
2576
|
+
revert: "toast.reverted",
|
|
2577
|
+
worktreeAdd: "action.createWorktree",
|
|
2578
|
+
worktreeRemove: "action.removeWorktree",
|
|
2579
|
+
worktreePrune: "action.pruneWorktrees",
|
|
2580
|
+
switchWorktree: "action.switchWorktree"
|
|
2304
2581
|
};
|
|
2582
|
+
/** Directory slug the host gives a branch inside the repository's worktree pool. */
|
|
2583
|
+
function worktreeSlugOf(branch) {
|
|
2584
|
+
return String(branch ?? "").trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^[-.]+|[-.]+$/g, "");
|
|
2585
|
+
}
|
|
2305
2586
|
/** Build the `dsh-resource://file/session/…` address of one Session-relative file. */
|
|
2306
2587
|
function fileAddressOf(sessionId, path) {
|
|
2307
2588
|
const encode = (segment) => encodeURIComponent(segment).replace(/%3A/gi, ":");
|
|
@@ -2336,6 +2617,8 @@
|
|
|
2336
2617
|
var PREVIEW_WIDTH_MIN = 280;
|
|
2337
2618
|
/** Narrowest left column allowed when the preview is docked to the right. */
|
|
2338
2619
|
var PREVIEW_WIDTH_RESERVED = 300;
|
|
2620
|
+
/** Panel width below which the comparison docks below the list and starts collapsed. */
|
|
2621
|
+
var PREVIEW_NARROW_WIDTH = 580;
|
|
2339
2622
|
/** Read the stored dock side. */
|
|
2340
2623
|
function readPreviewLayout() {
|
|
2341
2624
|
try {
|
|
@@ -2449,6 +2732,26 @@
|
|
|
2449
2732
|
localStorage.setItem(COMMIT_RULES_KEY, JSON.stringify(rules));
|
|
2450
2733
|
} catch {}
|
|
2451
2734
|
}
|
|
2735
|
+
/** Unified-diff header lines that only repeat what the comparison's own head shows. */
|
|
2736
|
+
var DIFF_HEADER_NOISE = [
|
|
2737
|
+
"diff --git ",
|
|
2738
|
+
"index ",
|
|
2739
|
+
"--- ",
|
|
2740
|
+
"+++ ",
|
|
2741
|
+
"similarity index ",
|
|
2742
|
+
"dissimilarity index "
|
|
2743
|
+
];
|
|
2744
|
+
/**
|
|
2745
|
+
* Whether one pre-hunk line can be hidden: paths, blob hashes and rename
|
|
2746
|
+
* similarity all repeat the comparison head or the change list, so showing
|
|
2747
|
+
* them only costs rows. Meaningful header lines (new/deleted file, mode
|
|
2748
|
+
* change, rename/copy endpoints, "no newline") are still rendered.
|
|
2749
|
+
* @param {string} line - a unified-diff header line.
|
|
2750
|
+
* @returns {boolean} whether the line is redundant plumbing.
|
|
2751
|
+
*/
|
|
2752
|
+
function isDiffHeaderNoise(line) {
|
|
2753
|
+
return DIFF_HEADER_NOISE.some((prefix) => line.startsWith(prefix));
|
|
2754
|
+
}
|
|
2452
2755
|
/**
|
|
2453
2756
|
* Parse one unified patch into renderable rows with old/new line numbers.
|
|
2454
2757
|
* @param {string} text - the patch text.
|
|
@@ -2477,7 +2780,7 @@
|
|
|
2477
2780
|
continue;
|
|
2478
2781
|
}
|
|
2479
2782
|
if (!inHunk) {
|
|
2480
|
-
if (line.length > 0) rows.push({
|
|
2783
|
+
if (line.length > 0 && !isDiffHeaderNoise(line)) rows.push({
|
|
2481
2784
|
type: "meta",
|
|
2482
2785
|
text: line
|
|
2483
2786
|
});
|
|
@@ -3025,7 +3328,7 @@
|
|
|
3025
3328
|
const nameTone = isLocal ? behind > 0 ? "unpulled" : unpublished ? "unpushed" : null : null;
|
|
3026
3329
|
const date = relativeTime(branch.date, t);
|
|
3027
3330
|
return h("div", {
|
|
3028
|
-
className: `dgscm-row dgscm-row--clickable${branch.current === true ? " dgscm-row--current" : ""}`,
|
|
3331
|
+
className: `dgscm-row dgscm-row--clickable dgscm-row--branch${branch.current === true ? " dgscm-row--current" : ""}`,
|
|
3029
3332
|
style: indent(depth),
|
|
3030
3333
|
role: "button",
|
|
3031
3334
|
tabIndex: 0,
|
|
@@ -3056,6 +3359,47 @@
|
|
|
3056
3359
|
}, "▲+") : null, branch.current === true ? h("span", { className: "dgscm-branch-flag dgscm-branch-flag--current" }, h(CheckIcon, { size: 12 })) : null), date === "" ? null : h("span", { className: "dgscm-row-note" }, `· ${date}`)));
|
|
3057
3360
|
}
|
|
3058
3361
|
/**
|
|
3362
|
+
* One worktree row: checkout directory, branch (or detached HEAD), state, and
|
|
3363
|
+
* its menu. Clicking a non-current checkout asks to move the Session there.
|
|
3364
|
+
* @param {object} props - the worktree, path label, handlers, and copy.
|
|
3365
|
+
* @returns {object} the row.
|
|
3366
|
+
*/
|
|
3367
|
+
function WorktreeRow({ worktree, pathLabel, t, onSwitch, onMenu, onContextMenu }) {
|
|
3368
|
+
const current = worktree.current === true;
|
|
3369
|
+
const missing = worktree.prunable === true;
|
|
3370
|
+
const name = worktree.branch !== null && worktree.branch !== void 0 ? worktree.branch : worktree.detached === true ? `${t("worktree.detached")} ${worktree.head ?? ""}`.trim() : worktree.bare === true ? t("worktree.bare") : worktree.name;
|
|
3371
|
+
const activate = () => {
|
|
3372
|
+
if (current || missing) return;
|
|
3373
|
+
onSwitch(worktree);
|
|
3374
|
+
};
|
|
3375
|
+
return h("div", {
|
|
3376
|
+
className: `dgscm-row dgscm-row--clickable dgscm-row--worktree${current ? " dgscm-row--current" : ""}${missing ? " dgscm-row--prunable" : ""}`,
|
|
3377
|
+
role: "button",
|
|
3378
|
+
tabIndex: 0,
|
|
3379
|
+
title: current ? `${worktree.path} — ${t("worktree.current")}` : t("worktree.switchTooltip", { path: worktree.path }),
|
|
3380
|
+
onClick: activate,
|
|
3381
|
+
onKeyDown: activateOnKey(activate),
|
|
3382
|
+
onContextMenu
|
|
3383
|
+
}, h("span", {
|
|
3384
|
+
className: "dgscm-row-chevron",
|
|
3385
|
+
"aria-hidden": "true"
|
|
3386
|
+
}), h("span", { className: "dgscm-row-glyph dgscm-row-glyph--worktree" }, h(FolderIcon, { size: 13 })), h("span", { className: `dgscm-row-name${current ? " dgscm-row-name--current" : ""}` }, name), h("span", { className: "dgscm-row-dir" }, pathLabel), worktree.locked === true ? h("span", {
|
|
3387
|
+
className: "dgscm-row-note dgscm-row-note--warn",
|
|
3388
|
+
title: worktree.lockReason === null || worktree.lockReason === void 0 ? t("worktree.locked") : t("worktree.lockedReason", { reason: worktree.lockReason })
|
|
3389
|
+
}, t("worktree.locked")) : null, h("div", {
|
|
3390
|
+
className: "dgscm-row-actions",
|
|
3391
|
+
onClick: (event) => {
|
|
3392
|
+
event.stopPropagation();
|
|
3393
|
+
}
|
|
3394
|
+
}, h(IconButton, {
|
|
3395
|
+
label: t("action.more"),
|
|
3396
|
+
onClick: onMenu
|
|
3397
|
+
}, h(MoreIcon, { size: 13 }))), h("span", { className: "dgscm-row-end" }, missing ? h("span", {
|
|
3398
|
+
className: "dgscm-worktree-flag dgscm-worktree-flag--missing",
|
|
3399
|
+
title: worktree.pruneReason === null || worktree.pruneReason === void 0 ? t("worktree.prunable") : worktree.pruneReason
|
|
3400
|
+
}, h(WarnIcon, { size: 12 })) : null, current ? h("span", { className: "dgscm-branch-flag dgscm-branch-flag--current" }, h(CheckIcon, { size: 12 })) : null));
|
|
3401
|
+
}
|
|
3402
|
+
/**
|
|
3059
3403
|
* One commit row: disclosure, hash, subject, and author/time.
|
|
3060
3404
|
* @param {object} props - the commit, depth, disclosure state, handlers, and copy.
|
|
3061
3405
|
* @returns {object} the row.
|
|
@@ -3100,7 +3444,7 @@
|
|
|
3100
3444
|
*/
|
|
3101
3445
|
function RemoteRow({ remote, branchCount, open, t, onToggle, onContextMenu }) {
|
|
3102
3446
|
return h("div", {
|
|
3103
|
-
className: "dgscm-row dgscm-row--clickable",
|
|
3447
|
+
className: "dgscm-row dgscm-row--clickable dgscm-row--remote",
|
|
3104
3448
|
role: "button",
|
|
3105
3449
|
tabIndex: 0,
|
|
3106
3450
|
title: remote.url,
|
|
@@ -3234,14 +3578,14 @@
|
|
|
3234
3578
|
* @param {object} props - the loaded history, dock controls, and copy.
|
|
3235
3579
|
* @returns {object} the history pane.
|
|
3236
3580
|
*/
|
|
3237
|
-
function HistoryPane({ state, layout, onLayout, maximized, onMaximize, onClose, onOpenCommit, t }) {
|
|
3581
|
+
function HistoryPane({ state, layout, layoutFixed = false, onLayout, maximized, onMaximize, onClose, onOpenCommit, t }) {
|
|
3238
3582
|
return h("div", { className: "dgscm-history" }, h("div", { className: "dgscm-diff-head" }, h(IconButton, {
|
|
3239
3583
|
label: t("diff.close"),
|
|
3240
3584
|
onClick: onClose
|
|
3241
3585
|
}, h(CloseIcon, { size: 14 })), h("span", { className: "dgscm-badge dgscm-badge--brand" }, t("history.badge")), h("span", {
|
|
3242
3586
|
className: "dgscm-diff-path",
|
|
3243
3587
|
title: state.path
|
|
3244
|
-
}, state.path), h("span", { className: "dgscm-diff-stats" }, state.phase === "ready" ? String(state.commits.length) : ""), h(IconButton, {
|
|
3588
|
+
}, state.path), h("span", { className: "dgscm-diff-stats" }, state.phase === "ready" ? String(state.commits.length) : ""), layoutFixed ? null : h(IconButton, {
|
|
3245
3589
|
label: layout === "right" ? t("action.dockBottom") : t("action.dockRight"),
|
|
3246
3590
|
onClick: () => onLayout(layout === "right" ? "bottom" : "right")
|
|
3247
3591
|
}, layout === "right" ? h(DockBottomIcon, { size: 14 }) : h(DockRightIcon, { size: 14 })), h(IconButton, {
|
|
@@ -3264,7 +3608,7 @@
|
|
|
3264
3608
|
* @param {object} props - the loaded review, dock controls, and copy.
|
|
3265
3609
|
* @returns {object} the commit review pane.
|
|
3266
3610
|
*/
|
|
3267
|
-
function ReviewPane({ review, layout, onLayout, maximized, onMaximize, onClose, onOpenFile, t }) {
|
|
3611
|
+
function ReviewPane({ review, layout, layoutFixed = false, onLayout, maximized, onMaximize, onClose, onOpenFile, t }) {
|
|
3268
3612
|
const [query, setQuery] = useState("");
|
|
3269
3613
|
const [filterOpen, setFilterOpen] = useState(false);
|
|
3270
3614
|
const filterRef = useRef(null);
|
|
@@ -3285,7 +3629,7 @@
|
|
|
3285
3629
|
setFilterOpen((current) => !current);
|
|
3286
3630
|
if (filterOpen) setQuery("");
|
|
3287
3631
|
}
|
|
3288
|
-
}, h(SearchIcon, { size: 14 })), h(IconButton, {
|
|
3632
|
+
}, h(SearchIcon, { size: 14 })), layoutFixed ? null : h(IconButton, {
|
|
3289
3633
|
label: layout === "right" ? t("action.dockBottom") : t("action.dockRight"),
|
|
3290
3634
|
onClick: () => onLayout(layout === "right" ? "bottom" : "right")
|
|
3291
3635
|
}, layout === "right" ? h(DockBottomIcon, { size: 14 }) : h(DockRightIcon, { size: 14 })), h(IconButton, {
|
|
@@ -3433,6 +3777,57 @@
|
|
|
3433
3777
|
}, prompt.submitLabel))));
|
|
3434
3778
|
}
|
|
3435
3779
|
/**
|
|
3780
|
+
* The New Worktree dialog: branch name plus the directory the host will use.
|
|
3781
|
+
* @param {object} props - dialog state, base branch, handlers, and copy.
|
|
3782
|
+
* @returns {object} the overlay.
|
|
3783
|
+
*/
|
|
3784
|
+
function WorktreeDialog({ state, base, onChange, onCancel, onSubmit, t }) {
|
|
3785
|
+
const inputRef = useRef(null);
|
|
3786
|
+
useEffect(() => {
|
|
3787
|
+
inputRef.current?.focus();
|
|
3788
|
+
}, []);
|
|
3789
|
+
useEffect(() => {
|
|
3790
|
+
const onKeyDown = (event) => {
|
|
3791
|
+
if (event.key === "Escape" && !state.submitting) onCancel();
|
|
3792
|
+
};
|
|
3793
|
+
window.addEventListener("keydown", onKeyDown);
|
|
3794
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
3795
|
+
}, [onCancel, state.submitting]);
|
|
3796
|
+
const slug = worktreeSlugOf(state.branch);
|
|
3797
|
+
return h("div", {
|
|
3798
|
+
className: "dgscm-modal",
|
|
3799
|
+
onClick: state.submitting ? void 0 : onCancel
|
|
3800
|
+
}, h("div", {
|
|
3801
|
+
className: "dgscm-modal-card dgscm-worktree-dialog",
|
|
3802
|
+
role: "dialog",
|
|
3803
|
+
"aria-modal": "true",
|
|
3804
|
+
onClick: (event) => event.stopPropagation(),
|
|
3805
|
+
onKeyDown: (event) => {
|
|
3806
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
3807
|
+
event.preventDefault();
|
|
3808
|
+
if (!state.submitting && slug.length > 0) onSubmit();
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
}, h("div", { className: "dgscm-modal-title" }, t("worktree.dialogTitle")), h("div", { className: "dgscm-modal-field" }, h("label", { className: "dgscm-modal-label" }, t("worktree.branchField")), h("input", {
|
|
3812
|
+
ref: inputRef,
|
|
3813
|
+
className: "dgscm-input",
|
|
3814
|
+
value: state.branch,
|
|
3815
|
+
placeholder: t("worktree.branchPlaceholder"),
|
|
3816
|
+
disabled: state.submitting,
|
|
3817
|
+
onChange: (event) => onChange(event.target.value)
|
|
3818
|
+
})), slug.length === 0 ? null : h("div", { className: "dgscm-worktree-preview" }, t("worktree.directoryPreview", { slug })), h("div", { className: "dgscm-modal-note" }, t("worktree.baseNote", { base })), state.error === null || state.error === void 0 ? null : h("div", { className: "dgscm-modal-error" }, state.error), h("div", { className: "dgscm-modal-actions" }, h("button", {
|
|
3819
|
+
type: "button",
|
|
3820
|
+
className: "dgscm-button dgscm-button--quiet",
|
|
3821
|
+
disabled: state.submitting,
|
|
3822
|
+
onClick: onCancel
|
|
3823
|
+
}, t("prompt.cancel")), h("button", {
|
|
3824
|
+
type: "button",
|
|
3825
|
+
className: "dgscm-button dgscm-button--primary",
|
|
3826
|
+
disabled: state.submitting || slug.length === 0,
|
|
3827
|
+
onClick: () => onSubmit()
|
|
3828
|
+
}, state.submitting ? t("toast.busy") : t("worktree.create")))));
|
|
3829
|
+
}
|
|
3830
|
+
/**
|
|
3436
3831
|
* The GitHub publish dialog: repository name plus private and public choices.
|
|
3437
3832
|
* @param {object} props - dialog state, rename/publish/cancel handlers, and copy.
|
|
3438
3833
|
* @returns {object} the overlay.
|
|
@@ -3495,11 +3890,13 @@
|
|
|
3495
3890
|
* longer than the collapse threshold render as an expandable marker, the way
|
|
3496
3891
|
* the host's own review views fold context, and every row carries the old and
|
|
3497
3892
|
* new line numbers it names. The search box walks every match in the visible
|
|
3498
|
-
* rows and scrolls the current one into view.
|
|
3499
|
-
*
|
|
3893
|
+
* rows and scrolls the current one into view. The title row is a disclosure
|
|
3894
|
+
* control that folds the body; a narrow column starts folded and a fullscreen
|
|
3895
|
+
* Sidebar opens it docked right.
|
|
3896
|
+
* @param {object} props - the opened view, display mode, dock controls, collapse state, and copy.
|
|
3500
3897
|
* @returns {object} the comparison pane.
|
|
3501
3898
|
*/
|
|
3502
|
-
function DiffPane({ view, mode, onMode, onClose, onMaximize, maximized, layout, onLayout, onBack, backLabel, searchSignal = 0, t }) {
|
|
3899
|
+
function DiffPane({ view, mode, onMode, onClose, onMaximize, maximized, layout, layoutFixed = false, onLayout, onBack, backLabel, searchSignal = 0, collapsed = false, onToggleCollapsed, t }) {
|
|
3503
3900
|
const [expanded, setExpanded] = useState(() => /* @__PURE__ */ new Set());
|
|
3504
3901
|
const [wrap, setWrap] = useState(readDiffWrap);
|
|
3505
3902
|
const [searchOpen, setSearchOpen] = useState(false);
|
|
@@ -3618,6 +4015,9 @@
|
|
|
3618
4015
|
setQuery("");
|
|
3619
4016
|
setActiveMatch(0);
|
|
3620
4017
|
};
|
|
4018
|
+
useEffect(() => {
|
|
4019
|
+
if (collapsed) closeSearch();
|
|
4020
|
+
}, [collapsed]);
|
|
3621
4021
|
/** Render one line with the query's matches highlighted. */
|
|
3622
4022
|
const highlighted = (entryKey, text) => {
|
|
3623
4023
|
const found = matches.length === 0 ? [] : matches.filter((match) => match.key === entryKey);
|
|
@@ -3683,16 +4083,25 @@
|
|
|
3683
4083
|
index: activeMatch + 1,
|
|
3684
4084
|
total: matches.length
|
|
3685
4085
|
});
|
|
3686
|
-
return h("div", { className: "dgscm-diff" }, h("div", { className: "dgscm-diff-head" }, onBack === void 0 ? null : h(IconButton, {
|
|
4086
|
+
return h("div", { className: "dgscm-diff" }, h("div", { className: `dgscm-diff-head${collapsed ? " dgscm-diff-head--collapsed" : ""}` }, onBack === void 0 ? null : h(IconButton, {
|
|
3687
4087
|
label: backLabel,
|
|
3688
4088
|
onClick: onBack
|
|
3689
4089
|
}, h(BackIcon, { size: 14 })), h(IconButton, {
|
|
3690
4090
|
label: t("diff.close"),
|
|
3691
4091
|
onClick: onClose
|
|
3692
|
-
}, h(CloseIcon, { size: 14 })), view.source.kind === "commit" ? h("span", { className: "dgscm-badge dgscm-badge--brand" }, t("diff.commitLabel", { short: view.source.short ?? "" })) : null, view.source.kind === "stash" ? h("span", { className: "dgscm-badge dgscm-badge--brand" }, `stash@{${view.source.index}}`) : null, h("
|
|
4092
|
+
}, h(CloseIcon, { size: 14 })), view.source.kind === "commit" ? h("span", { className: "dgscm-badge dgscm-badge--brand" }, t("diff.commitLabel", { short: view.source.short ?? "" })) : null, view.source.kind === "stash" ? h("span", { className: "dgscm-badge dgscm-badge--brand" }, `stash@{${view.source.index}}`) : null, h("button", {
|
|
4093
|
+
type: "button",
|
|
4094
|
+
className: "dgscm-diff-title",
|
|
4095
|
+
"aria-expanded": collapsed ? "false" : "true",
|
|
4096
|
+
title: collapsed ? t("diff.expandPanel") : t("diff.collapsePanel"),
|
|
4097
|
+
onClick: onToggleCollapsed
|
|
4098
|
+
}, h(ChevronIcon, {
|
|
4099
|
+
open: !collapsed,
|
|
4100
|
+
size: 12
|
|
4101
|
+
}), h("span", {
|
|
3693
4102
|
className: "dgscm-diff-path",
|
|
3694
4103
|
title: view.path
|
|
3695
|
-
}, view.path), diff !== null && diff !== void 0 ? h("span", { className: "dgscm-diff-stats" }, h("span", { className: "dgscm-diff-added" }, `+${diff.added}`), h("span", { className: "dgscm-diff-deleted" }, `−${diff.deleted}`)) : null, h(IconButton, {
|
|
4104
|
+
}, view.path)), diff !== null && diff !== void 0 ? h("span", { className: "dgscm-diff-stats" }, h("span", { className: "dgscm-diff-added" }, `+${diff.added}`), h("span", { className: "dgscm-diff-deleted" }, `−${diff.deleted}`)) : null, collapsed ? null : h(React.Fragment, null, h(IconButton, {
|
|
3696
4105
|
label: `${t("action.search")} (${searchKey})`,
|
|
3697
4106
|
onClick: () => searchOpen ? closeSearch() : setSearchOpen(true)
|
|
3698
4107
|
}, h(SearchIcon, { size: 14 })), h(IconButton, {
|
|
@@ -3702,13 +4111,13 @@
|
|
|
3702
4111
|
label: wrap ? t("diff.wrapOff") : t("diff.wrapOn"),
|
|
3703
4112
|
pressed: wrap,
|
|
3704
4113
|
onClick: toggleWrap
|
|
3705
|
-
}, h(WrapIcon, { size: 14 })), h(IconButton, {
|
|
4114
|
+
}, h(WrapIcon, { size: 14 })), layoutFixed ? null : h(IconButton, {
|
|
3706
4115
|
label: layout === "right" ? t("action.dockBottom") : t("action.dockRight"),
|
|
3707
4116
|
onClick: () => onLayout(layout === "right" ? "bottom" : "right")
|
|
3708
4117
|
}, layout === "right" ? h(DockBottomIcon, { size: 14 }) : h(DockRightIcon, { size: 14 })), h(IconButton, {
|
|
3709
4118
|
label: maximized ? t("diff.restore") : t("diff.maximize"),
|
|
3710
4119
|
onClick: onMaximize
|
|
3711
|
-
}, maximized ? h(RestoreIcon, { size: 14 }) : h(MaximizeIcon, { size: 14 }))), searchOpen ? h("div", { className: "dgscm-diff-search" }, h("input", {
|
|
4120
|
+
}, maximized ? h(RestoreIcon, { size: 14 }) : h(MaximizeIcon, { size: 14 })))), h(React.Fragment, null, searchOpen ? h("div", { className: "dgscm-diff-search" }, h("input", {
|
|
3712
4121
|
ref: searchRef,
|
|
3713
4122
|
className: "dgscm-diff-search-input",
|
|
3714
4123
|
value: query,
|
|
@@ -3748,7 +4157,7 @@
|
|
|
3748
4157
|
}, view.loading === true ? h("div", { className: "dgscm-diff-note" }, t("diff.loading")) : null, view.error !== null && view.error !== void 0 ? h("div", {
|
|
3749
4158
|
className: "dgscm-diff-note",
|
|
3750
4159
|
style: { color: "var(--dsw-alias-state-error-primary)" }
|
|
3751
|
-
}, view.error) : null, view.loading !== true && view.error === null && diff !== null && diff !== void 0 ? h(React.Fragment, null, diff.binary === true ? h("div", { className: "dgscm-diff-note" }, t("diff.binary")) : null, diff.tooLarge === true ? h("div", { className: "dgscm-diff-note" }, t("diff.tooLarge")) : null, diff.binary !== true && rows.length === 0 ? h("div", { className: "dgscm-diff-note" }, t("diff.empty")) : null, diff.binary !== true ? mode === "split" ? pairs.map((pair, index) => splitRow(pair, `pair-${index}`)) : rows.map((row, index) => unifiedRow(row, `row-${index}`)) : null, truncated ? h("div", { className: "dgscm-diff-note" }, t("diff.tooLarge")) : null) : null));
|
|
4160
|
+
}, view.error) : null, view.loading !== true && view.error === null && diff !== null && diff !== void 0 ? h(React.Fragment, null, diff.binary === true ? h("div", { className: "dgscm-diff-note" }, t("diff.binary")) : null, diff.tooLarge === true ? h("div", { className: "dgscm-diff-note" }, t("diff.tooLarge")) : null, diff.binary !== true && rows.length === 0 ? h("div", { className: "dgscm-diff-note" }, t("diff.empty")) : null, diff.binary !== true ? mode === "split" ? pairs.map((pair, index) => splitRow(pair, `pair-${index}`)) : rows.map((row, index) => unifiedRow(row, `row-${index}`)) : null, truncated ? h("div", { className: "dgscm-diff-note" }, t("diff.tooLarge")) : null) : null)));
|
|
3752
4161
|
}
|
|
3753
4162
|
/**
|
|
3754
4163
|
* The right-Sidebar source-control page.
|
|
@@ -3756,7 +4165,9 @@
|
|
|
3756
4165
|
* @returns {object} the panel.
|
|
3757
4166
|
*/
|
|
3758
4167
|
function ScmPanel({ sessionId, t, openFile, localeId, useTabInfo }) {
|
|
3759
|
-
const
|
|
4168
|
+
const tabInfo = typeof useTabInfo === "function" ? useTabInfo() : void 0;
|
|
4169
|
+
const tabActions = tabInfo?.tab?.actions;
|
|
4170
|
+
const sidebarFullscreen = tabInfo?.sidebar?.fullscreen === true;
|
|
3760
4171
|
const [phase, setPhase] = useState("loading");
|
|
3761
4172
|
const [summary, setSummary] = useState(null);
|
|
3762
4173
|
const [failure, setFailure] = useState(null);
|
|
@@ -3773,6 +4184,7 @@
|
|
|
3773
4184
|
groupRepositories: true,
|
|
3774
4185
|
staged: true,
|
|
3775
4186
|
changes: true,
|
|
4187
|
+
worktrees: true,
|
|
3776
4188
|
branches: true,
|
|
3777
4189
|
remotes: false,
|
|
3778
4190
|
stashes: false,
|
|
@@ -3792,9 +4204,12 @@
|
|
|
3792
4204
|
const [dragging, setDragging] = useState(false);
|
|
3793
4205
|
const [previewLayout, setPreviewLayout] = useState(readPreviewLayout);
|
|
3794
4206
|
const [previewWidth, setPreviewWidth] = useState(readPreviewWidth);
|
|
4207
|
+
const [comparisonCollapsed, setComparisonCollapsed] = useState(false);
|
|
4208
|
+
const [narrowPreview, setNarrowPreview] = useState(false);
|
|
3795
4209
|
const [branchPicker, setBranchPicker] = useState(null);
|
|
3796
4210
|
const [tip, setTip] = useState(null);
|
|
3797
4211
|
const [githubPublish, setGithubPublish] = useState(null);
|
|
4212
|
+
const [worktreeDialog, setWorktreeDialog] = useState(null);
|
|
3798
4213
|
const [generating, setGenerating] = useState(false);
|
|
3799
4214
|
const [commitRules, setCommitRules] = useState(readCommitRules);
|
|
3800
4215
|
const [initializing, setInitializing] = useState(false);
|
|
@@ -3803,6 +4218,11 @@
|
|
|
3803
4218
|
const [review, setReview] = useState(null);
|
|
3804
4219
|
const [searchSignal, setSearchSignal] = useState(0);
|
|
3805
4220
|
const [refreshing, setRefreshing] = useState(false);
|
|
4221
|
+
const messageHint = summary?.repo?.branch == null ? t("commit.placeholderDetached") : t("commit.placeholder", { branch: summary.repo.branch });
|
|
4222
|
+
const autoLayout = sidebarFullscreen && !narrowPreview ? "right" : narrowPreview ? "bottom" : previewLayout;
|
|
4223
|
+
const collapsedPane = comparisonCollapsed && view !== null;
|
|
4224
|
+
const paneLayout = collapsedPane ? "bottom" : autoLayout;
|
|
4225
|
+
const layoutFixed = sidebarFullscreen || narrowPreview;
|
|
3806
4226
|
const loadSeq = useRef(0);
|
|
3807
4227
|
const busyRef = useRef(false);
|
|
3808
4228
|
const nodesRef = useRef(nodes);
|
|
@@ -3814,10 +4234,15 @@
|
|
|
3814
4234
|
const heightRef = useRef(diffHeight);
|
|
3815
4235
|
const widthRef = useRef(previewWidth);
|
|
3816
4236
|
const messageRef = useRef(null);
|
|
4237
|
+
const hintRef = useRef(null);
|
|
3817
4238
|
const generateHoldRef = useRef(null);
|
|
3818
4239
|
const generateLongPressRef = useRef(false);
|
|
3819
4240
|
const commitRulesRef = useRef(commitRules);
|
|
3820
4241
|
const amendBackupRef = useRef(null);
|
|
4242
|
+
const menuAnchorRef = useRef({
|
|
4243
|
+
x: 0,
|
|
4244
|
+
y: 0
|
|
4245
|
+
});
|
|
3821
4246
|
useEffect(() => {
|
|
3822
4247
|
nodesRef.current = nodes;
|
|
3823
4248
|
}, [nodes]);
|
|
@@ -3830,6 +4255,26 @@
|
|
|
3830
4255
|
useEffect(() => {
|
|
3831
4256
|
commitRulesRef.current = commitRules;
|
|
3832
4257
|
}, [commitRules]);
|
|
4258
|
+
useEffect(() => {
|
|
4259
|
+
const node = rootRef.current;
|
|
4260
|
+
if (node === null) return void 0;
|
|
4261
|
+
const measure = () => {
|
|
4262
|
+
const width = node.clientWidth;
|
|
4263
|
+
if (width > 0) setNarrowPreview(width < PREVIEW_NARROW_WIDTH);
|
|
4264
|
+
};
|
|
4265
|
+
measure();
|
|
4266
|
+
if (typeof ResizeObserver === "function") {
|
|
4267
|
+
const observer = new ResizeObserver(measure);
|
|
4268
|
+
observer.observe(node);
|
|
4269
|
+
return () => observer.disconnect();
|
|
4270
|
+
}
|
|
4271
|
+
window.addEventListener("resize", measure);
|
|
4272
|
+
return () => window.removeEventListener("resize", measure);
|
|
4273
|
+
}, [phase]);
|
|
4274
|
+
useEffect(() => {
|
|
4275
|
+
if (narrowPreview) setComparisonCollapsed(true);
|
|
4276
|
+
else if (sidebarFullscreen) setComparisonCollapsed(false);
|
|
4277
|
+
}, [narrowPreview, sidebarFullscreen]);
|
|
3833
4278
|
useEffect(() => {
|
|
3834
4279
|
if (phase !== "ready" || !publishAfterInit) return void 0;
|
|
3835
4280
|
setPublishAfterInit(false);
|
|
@@ -3894,9 +4339,11 @@
|
|
|
3894
4339
|
});
|
|
3895
4340
|
setHistory(null);
|
|
3896
4341
|
setReview(null);
|
|
4342
|
+
setComparisonCollapsed(false);
|
|
3897
4343
|
setBranchPicker(null);
|
|
3898
4344
|
setTip(null);
|
|
3899
4345
|
setGithubPublish(null);
|
|
4346
|
+
setWorktreeDialog(null);
|
|
3900
4347
|
setGenerating(false);
|
|
3901
4348
|
setInitializing(false);
|
|
3902
4349
|
setPublishAfterInit(false);
|
|
@@ -3906,14 +4353,36 @@
|
|
|
3906
4353
|
loadSeq.current += 1;
|
|
3907
4354
|
};
|
|
3908
4355
|
}, [sessionId, load]);
|
|
3909
|
-
|
|
4356
|
+
const sizeMessage = useCallback(() => {
|
|
3910
4357
|
const node = messageRef.current;
|
|
3911
4358
|
if (node === null) return;
|
|
3912
4359
|
if (typeof node.scrollHeight !== "number") return;
|
|
4360
|
+
const hint = hintRef.current;
|
|
3913
4361
|
node.style.height = "auto";
|
|
3914
|
-
const
|
|
3915
|
-
|
|
3916
|
-
|
|
4362
|
+
const hintHeight = hint === null ? 0 : hint.scrollHeight + 16;
|
|
4363
|
+
const needed = Math.max(node.scrollHeight + 2, hintHeight, 34);
|
|
4364
|
+
node.style.height = `${Math.min(needed, 118)}px`;
|
|
4365
|
+
}, [
|
|
4366
|
+
message,
|
|
4367
|
+
messageHint,
|
|
4368
|
+
phase
|
|
4369
|
+
]);
|
|
4370
|
+
useEffect(() => {
|
|
4371
|
+
sizeMessage();
|
|
4372
|
+
}, [sizeMessage]);
|
|
4373
|
+
useEffect(() => {
|
|
4374
|
+
const host = messageRef.current?.parentElement ?? null;
|
|
4375
|
+
if (host === null || typeof ResizeObserver !== "function") return void 0;
|
|
4376
|
+
let lastWidth = 0;
|
|
4377
|
+
const observer = new ResizeObserver((entries) => {
|
|
4378
|
+
const width = entries?.[0]?.contentRect?.width ?? 0;
|
|
4379
|
+
if (Math.abs(width - lastWidth) < .5) return;
|
|
4380
|
+
lastWidth = width;
|
|
4381
|
+
sizeMessage();
|
|
4382
|
+
});
|
|
4383
|
+
observer.observe(host);
|
|
4384
|
+
return () => observer.disconnect();
|
|
4385
|
+
}, [sizeMessage]);
|
|
3917
4386
|
useEffect(() => {
|
|
3918
4387
|
if (phase !== "ready") return void 0;
|
|
3919
4388
|
const timer = setInterval(() => {
|
|
@@ -3939,22 +4408,23 @@
|
|
|
3939
4408
|
const focused = document.activeElement;
|
|
3940
4409
|
if (!(focused !== null && focused !== void 0 && root.contains(focused)) && !pointerInsideRef.current) return;
|
|
3941
4410
|
event.preventDefault();
|
|
4411
|
+
if (collapsedPane) setComparisonCollapsed(false);
|
|
3942
4412
|
setSearchSignal((current) => current + 1);
|
|
3943
4413
|
};
|
|
3944
4414
|
document.addEventListener("keydown", onKeyDown);
|
|
3945
4415
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
3946
|
-
}, [view]);
|
|
4416
|
+
}, [view, collapsedPane]);
|
|
3947
4417
|
useEffect(() => {
|
|
3948
4418
|
if (!dragging) return void 0;
|
|
3949
4419
|
const previousCursor = document.body.style.cursor;
|
|
3950
4420
|
const previousSelect = document.body.style.userSelect;
|
|
3951
|
-
document.body.style.cursor =
|
|
4421
|
+
document.body.style.cursor = paneLayout === "right" ? "col-resize" : "row-resize";
|
|
3952
4422
|
document.body.style.userSelect = "none";
|
|
3953
4423
|
return () => {
|
|
3954
4424
|
document.body.style.cursor = previousCursor;
|
|
3955
4425
|
document.body.style.userSelect = previousSelect;
|
|
3956
4426
|
};
|
|
3957
|
-
}, [dragging,
|
|
4427
|
+
}, [dragging, paneLayout]);
|
|
3958
4428
|
useEffect(() => {
|
|
3959
4429
|
if (notice === null || notice.action !== void 0) return void 0;
|
|
3960
4430
|
const timer = setTimeout(() => setNotice(null), notice.tone === "error" ? 9e3 : 3500);
|
|
@@ -4184,14 +4654,40 @@
|
|
|
4184
4654
|
anchor: null
|
|
4185
4655
|
});
|
|
4186
4656
|
}, []);
|
|
4187
|
-
/** Open the context menu at the pointer. */
|
|
4657
|
+
/** Open the context menu at the pointer; remembers the anchor for its submenus. */
|
|
4188
4658
|
const openMenu = useCallback((event, items) => {
|
|
4189
|
-
event
|
|
4190
|
-
event
|
|
4659
|
+
event?.preventDefault?.();
|
|
4660
|
+
event?.stopPropagation?.();
|
|
4661
|
+
const position = {
|
|
4662
|
+
x: event?.clientX ?? 0,
|
|
4663
|
+
y: event?.clientY ?? 0
|
|
4664
|
+
};
|
|
4665
|
+
menuAnchorRef.current = position;
|
|
4666
|
+
setMenu({
|
|
4667
|
+
...position,
|
|
4668
|
+
items: items.filter((item) => item !== void 0)
|
|
4669
|
+
});
|
|
4670
|
+
}, []);
|
|
4671
|
+
/** Open a menu at an already measured anchor, replacing the one on screen. */
|
|
4672
|
+
const openMenuAt = useCallback((position, items) => {
|
|
4191
4673
|
setMenu({
|
|
4192
|
-
x:
|
|
4193
|
-
y:
|
|
4194
|
-
items: items.filter((item) => item !== void 0
|
|
4674
|
+
x: position.x,
|
|
4675
|
+
y: position.y,
|
|
4676
|
+
items: items.filter((item) => item !== void 0)
|
|
4677
|
+
});
|
|
4678
|
+
}, []);
|
|
4679
|
+
/** Open a menu directly under one control, the way a split button's chevron does. */
|
|
4680
|
+
const openMenuBelow = useCallback((element, items) => {
|
|
4681
|
+
const rect = typeof element?.getBoundingClientRect === "function" ? element.getBoundingClientRect() : null;
|
|
4682
|
+
const position = rect === null ? menuAnchorRef.current : {
|
|
4683
|
+
x: rect.left,
|
|
4684
|
+
y: rect.bottom + 2
|
|
4685
|
+
};
|
|
4686
|
+
menuAnchorRef.current = position;
|
|
4687
|
+
setMenu({
|
|
4688
|
+
x: position.x,
|
|
4689
|
+
y: position.y,
|
|
4690
|
+
items: items.filter((item) => item !== void 0)
|
|
4195
4691
|
});
|
|
4196
4692
|
}, []);
|
|
4197
4693
|
/** Open one working-tree file's diff. */
|
|
@@ -4559,6 +5055,42 @@
|
|
|
4559
5055
|
run,
|
|
4560
5056
|
t
|
|
4561
5057
|
]);
|
|
5058
|
+
/**
|
|
5059
|
+
* The commit button's action: with nothing staged it stages the tracked
|
|
5060
|
+
* changes first (the Zed "Commit Tracked" behavior), then commits them.
|
|
5061
|
+
* @returns {Promise<void>} settles after the attempt.
|
|
5062
|
+
*/
|
|
5063
|
+
const commitTracked = useCallback(async () => {
|
|
5064
|
+
if (message.trim().length === 0) {
|
|
5065
|
+
setNotice({
|
|
5066
|
+
tone: "error",
|
|
5067
|
+
title: t("toast.failed"),
|
|
5068
|
+
detail: t("commit.noMessage")
|
|
5069
|
+
});
|
|
5070
|
+
return;
|
|
5071
|
+
}
|
|
5072
|
+
const snapshot = summary?.changes ?? {};
|
|
5073
|
+
if ((Array.isArray(snapshot.conflicted) ? snapshot.conflicted : []).length > 0) {
|
|
5074
|
+
setNotice({
|
|
5075
|
+
tone: "error",
|
|
5076
|
+
title: t("toast.failed"),
|
|
5077
|
+
detail: t("commit.resolveConflicts")
|
|
5078
|
+
});
|
|
5079
|
+
return;
|
|
5080
|
+
}
|
|
5081
|
+
const staged = Array.isArray(snapshot.staged) ? snapshot.staged : [];
|
|
5082
|
+
const tracked = Array.isArray(snapshot.unstaged) ? snapshot.unstaged : [];
|
|
5083
|
+
if (staged.length === 0 && tracked.length > 0) {
|
|
5084
|
+
if (!await run("stage", { paths: tracked.map((file) => file.path) }, null)) return;
|
|
5085
|
+
}
|
|
5086
|
+
await commit(false);
|
|
5087
|
+
}, [
|
|
5088
|
+
message,
|
|
5089
|
+
summary,
|
|
5090
|
+
run,
|
|
5091
|
+
commit,
|
|
5092
|
+
t
|
|
5093
|
+
]);
|
|
4562
5094
|
/** Initialize a repository in the Session directory, then let the panel read it. */
|
|
4563
5095
|
const initializeRepository = async () => {
|
|
4564
5096
|
if (initializing) return;
|
|
@@ -4666,11 +5198,13 @@
|
|
|
4666
5198
|
const staged = changes.staged ?? [];
|
|
4667
5199
|
const unstaged = changes.unstaged ?? [];
|
|
4668
5200
|
const untracked = changes.untracked ?? [];
|
|
5201
|
+
const conflicted = changes.conflicted ?? [];
|
|
4669
5202
|
const workingChanges = [
|
|
4670
|
-
...
|
|
5203
|
+
...conflicted,
|
|
4671
5204
|
...unstaged,
|
|
4672
5205
|
...untracked
|
|
4673
5206
|
];
|
|
5207
|
+
const trackedChanges = unstaged;
|
|
4674
5208
|
const branches = summary.branches ?? {
|
|
4675
5209
|
local: [],
|
|
4676
5210
|
remote: []
|
|
@@ -4681,9 +5215,37 @@
|
|
|
4681
5215
|
const working = busy !== null;
|
|
4682
5216
|
const pending = repo.pending ?? null;
|
|
4683
5217
|
const pendingLabel = pending === null ? "" : t(`pending.${pending}`);
|
|
4684
|
-
const canCommit = message.trim().length > 0 && !working && (staged.length > 0 || amend && repo.head !== null);
|
|
5218
|
+
const canCommit = message.trim().length > 0 && !working && conflicted.length === 0 && (staged.length > 0 || trackedChanges.length > 0 || amend && repo.head !== null);
|
|
4685
5219
|
/** Whether the current branch has never been pushed and can be published. */
|
|
4686
5220
|
const unpublished = repo.detached !== true && repo.unborn !== true && repo.upstream === null;
|
|
5221
|
+
/** Registered worktrees of the repository, the main checkout first. */
|
|
5222
|
+
const worktrees = Array.isArray(summary.worktrees) ? summary.worktrees : [];
|
|
5223
|
+
const currentWorktree = worktrees.find((entry) => entry.current === true) ?? null;
|
|
5224
|
+
/** Display name of one worktree: its branch, detached HEAD, or bare state. */
|
|
5225
|
+
const worktreeLabel = (worktree) => worktree.branch !== null && worktree.branch !== void 0 ? worktree.branch : worktree.detached === true ? `${t("worktree.detached")} ${worktree.head ?? ""}`.trim() : worktree.bare === true ? t("worktree.bare") : worktree.name;
|
|
5226
|
+
/** Compact directory label of one worktree, relative to this checkout when nested. */
|
|
5227
|
+
const worktreePathLabel = (worktree) => {
|
|
5228
|
+
if (worktree.main === true) return t("worktree.mainCheckout");
|
|
5229
|
+
const path = String(worktree.path ?? "").replace(/\\/g, "/");
|
|
5230
|
+
const rootPath = String(repo.root ?? "").replace(/\\/g, "/");
|
|
5231
|
+
if (path.startsWith(`${rootPath}/`)) return path.slice(rootPath.length + 1);
|
|
5232
|
+
return path.split("/").filter((part) => part.length > 0).slice(-2).join("/");
|
|
5233
|
+
};
|
|
5234
|
+
/** The commit action's label: what a click will actually do. */
|
|
5235
|
+
const commitLabel = () => {
|
|
5236
|
+
if (amend) return staged.length > 0 || trackedChanges.length === 0 ? t("commit.amend") : t("commit.amendTracked");
|
|
5237
|
+
if (staged.length > 0) return t("commit.submit");
|
|
5238
|
+
return trackedChanges.length > 0 ? t("commit.tracked") : t("commit.submit");
|
|
5239
|
+
};
|
|
5240
|
+
/** Why the commit action is disabled, or what it will do when enabled. */
|
|
5241
|
+
const commitTitle = () => {
|
|
5242
|
+
if (conflicted.length > 0) return t("commit.resolveConflicts");
|
|
5243
|
+
if (message.trim().length === 0) return t("commit.noMessage");
|
|
5244
|
+
if (staged.length === 0 && trackedChanges.length === 0 && !(amend && repo.head !== null)) return t("commit.nothingToCommit");
|
|
5245
|
+
if (working) return t("toast.busy");
|
|
5246
|
+
if (amend) return t("commit.amendHint");
|
|
5247
|
+
return staged.length > 0 ? t("commit.submit") : t("commit.trackedHint");
|
|
5248
|
+
};
|
|
4687
5249
|
/** Show one hover tip anchored above the element it describes. */
|
|
4688
5250
|
const showTip = (event, text) => {
|
|
4689
5251
|
const rect = event?.currentTarget?.getBoundingClientRect?.();
|
|
@@ -4798,6 +5360,218 @@
|
|
|
4798
5360
|
}
|
|
4799
5361
|
await run("publish", {}, t("toast.published", { branch: repo.branch }));
|
|
4800
5362
|
};
|
|
5363
|
+
/** Open the New Worktree dialog. */
|
|
5364
|
+
const openWorktreeDialog = () => {
|
|
5365
|
+
if (working) return;
|
|
5366
|
+
setWorktreeDialog({
|
|
5367
|
+
branch: "",
|
|
5368
|
+
error: null,
|
|
5369
|
+
submitting: false
|
|
5370
|
+
});
|
|
5371
|
+
};
|
|
5372
|
+
/** Keep the New Worktree dialog's branch field and error in step with typing. */
|
|
5373
|
+
const updateWorktreeBranch = (value) => {
|
|
5374
|
+
setWorktreeDialog((current) => current === null ? null : {
|
|
5375
|
+
...current,
|
|
5376
|
+
branch: value,
|
|
5377
|
+
error: null
|
|
5378
|
+
});
|
|
5379
|
+
};
|
|
5380
|
+
/** Create one worktree, then offer to move this Session into it. */
|
|
5381
|
+
const createWorktree = async () => {
|
|
5382
|
+
const state = worktreeDialog;
|
|
5383
|
+
if (state === null || state.submitting === true || busyRef.current) return;
|
|
5384
|
+
const branch = state.branch.trim();
|
|
5385
|
+
if (branch.length === 0) {
|
|
5386
|
+
setWorktreeDialog({
|
|
5387
|
+
...state,
|
|
5388
|
+
error: t("worktree.branchRequired")
|
|
5389
|
+
});
|
|
5390
|
+
return;
|
|
5391
|
+
}
|
|
5392
|
+
busyRef.current = true;
|
|
5393
|
+
setWorktreeDialog({
|
|
5394
|
+
...state,
|
|
5395
|
+
submitting: true,
|
|
5396
|
+
error: null
|
|
5397
|
+
});
|
|
5398
|
+
setBusy({ operation: "worktreeAdd" });
|
|
5399
|
+
try {
|
|
5400
|
+
const data = await callGit(sessionId, "action", {
|
|
5401
|
+
operation: "worktreeAdd",
|
|
5402
|
+
branch
|
|
5403
|
+
});
|
|
5404
|
+
const createdPath = typeof data?.worktreePath === "string" ? data.worktreePath : null;
|
|
5405
|
+
const createdBranch = typeof data?.branch === "string" ? data.branch : branch;
|
|
5406
|
+
setWorktreeDialog(null);
|
|
5407
|
+
const created = {
|
|
5408
|
+
path: createdPath,
|
|
5409
|
+
branch: createdBranch,
|
|
5410
|
+
name: createdBranch,
|
|
5411
|
+
current: false
|
|
5412
|
+
};
|
|
5413
|
+
setNotice({
|
|
5414
|
+
tone: "success",
|
|
5415
|
+
title: t("toast.worktreeCreated", { name: createdBranch }),
|
|
5416
|
+
...createdPath === null ? {} : { action: {
|
|
5417
|
+
label: t("action.switchWorktree"),
|
|
5418
|
+
run: () => {
|
|
5419
|
+
switchToWorktree(created);
|
|
5420
|
+
}
|
|
5421
|
+
} }
|
|
5422
|
+
});
|
|
5423
|
+
await load();
|
|
5424
|
+
} catch (error) {
|
|
5425
|
+
const detail = failureText(error, t);
|
|
5426
|
+
setWorktreeDialog((current) => current === null ? null : {
|
|
5427
|
+
...current,
|
|
5428
|
+
submitting: false,
|
|
5429
|
+
error: detail
|
|
5430
|
+
});
|
|
5431
|
+
} finally {
|
|
5432
|
+
busyRef.current = false;
|
|
5433
|
+
setBusy(null);
|
|
5434
|
+
}
|
|
5435
|
+
};
|
|
5436
|
+
/** Move this Session's working directory into one registered worktree. */
|
|
5437
|
+
const switchToWorktree = async (worktree) => {
|
|
5438
|
+
if (busyRef.current) return;
|
|
5439
|
+
busyRef.current = true;
|
|
5440
|
+
setBusy({ operation: "switchWorktree" });
|
|
5441
|
+
try {
|
|
5442
|
+
await callGit(sessionId, "action", {
|
|
5443
|
+
operation: "switchWorktree",
|
|
5444
|
+
path: worktree.path
|
|
5445
|
+
});
|
|
5446
|
+
setNotice({
|
|
5447
|
+
tone: "success",
|
|
5448
|
+
title: t("toast.worktreeSwitched", { name: worktreeLabel(worktree) })
|
|
5449
|
+
});
|
|
5450
|
+
setView(null);
|
|
5451
|
+
setReview(null);
|
|
5452
|
+
setHistory(null);
|
|
5453
|
+
setNodes({});
|
|
5454
|
+
setSelection({
|
|
5455
|
+
group: null,
|
|
5456
|
+
paths: [],
|
|
5457
|
+
anchor: null
|
|
5458
|
+
});
|
|
5459
|
+
setMessage("");
|
|
5460
|
+
setAmend(false);
|
|
5461
|
+
amendBackupRef.current = null;
|
|
5462
|
+
await load();
|
|
5463
|
+
} catch (error) {
|
|
5464
|
+
setNotice({
|
|
5465
|
+
tone: "error",
|
|
5466
|
+
title: t("toast.failed"),
|
|
5467
|
+
detail: failureText(error, t)
|
|
5468
|
+
});
|
|
5469
|
+
} finally {
|
|
5470
|
+
busyRef.current = false;
|
|
5471
|
+
setBusy(null);
|
|
5472
|
+
}
|
|
5473
|
+
};
|
|
5474
|
+
/** Ask before moving this Session into another checkout. */
|
|
5475
|
+
const requestSwitchWorktree = (worktree) => {
|
|
5476
|
+
ask(t("confirm.switchWorktree", { name: worktreeLabel(worktree) }), () => {
|
|
5477
|
+
setConfirm(null);
|
|
5478
|
+
switchToWorktree(worktree);
|
|
5479
|
+
});
|
|
5480
|
+
};
|
|
5481
|
+
/**
|
|
5482
|
+
* Remove one linked worktree. A dirty checkout is refused first; the failure
|
|
5483
|
+
* notice then offers the explicit force path so uncommitted work is lost only
|
|
5484
|
+
* after a second confirmation.
|
|
5485
|
+
*/
|
|
5486
|
+
const removeWorktree = async (worktree, force = false) => {
|
|
5487
|
+
if (busyRef.current) return;
|
|
5488
|
+
busyRef.current = true;
|
|
5489
|
+
setBusy({ operation: "worktreeRemove" });
|
|
5490
|
+
try {
|
|
5491
|
+
await callGit(sessionId, "action", {
|
|
5492
|
+
operation: "worktreeRemove",
|
|
5493
|
+
path: worktree.path,
|
|
5494
|
+
...force ? { force: true } : {}
|
|
5495
|
+
});
|
|
5496
|
+
setNotice({
|
|
5497
|
+
tone: "success",
|
|
5498
|
+
title: t("toast.worktreeRemoved", { name: worktreeLabel(worktree) })
|
|
5499
|
+
});
|
|
5500
|
+
await load();
|
|
5501
|
+
} catch (error) {
|
|
5502
|
+
setNotice({
|
|
5503
|
+
tone: "error",
|
|
5504
|
+
title: t("toast.worktreeRemoveFailed"),
|
|
5505
|
+
detail: failureText(error, t),
|
|
5506
|
+
...force ? {} : { action: {
|
|
5507
|
+
label: t("action.forceRemoveWorktree"),
|
|
5508
|
+
run: () => ask(t("confirm.forceRemoveWorktree", { name: worktreeLabel(worktree) }), () => {
|
|
5509
|
+
setConfirm(null);
|
|
5510
|
+
removeWorktree(worktree, true);
|
|
5511
|
+
})
|
|
5512
|
+
} }
|
|
5513
|
+
});
|
|
5514
|
+
} finally {
|
|
5515
|
+
busyRef.current = false;
|
|
5516
|
+
setBusy(null);
|
|
5517
|
+
}
|
|
5518
|
+
};
|
|
5519
|
+
/** Ask before deleting one linked worktree. */
|
|
5520
|
+
const requestRemoveWorktree = (worktree) => {
|
|
5521
|
+
ask(t("confirm.removeWorktree", { name: worktreeLabel(worktree) }), () => {
|
|
5522
|
+
setConfirm(null);
|
|
5523
|
+
removeWorktree(worktree, false);
|
|
5524
|
+
});
|
|
5525
|
+
};
|
|
5526
|
+
/** Worktree section actions: create a checkout, prune registrations whose directories are gone. */
|
|
5527
|
+
const worktreeAddMenuItems = () => [
|
|
5528
|
+
{
|
|
5529
|
+
label: t("action.createWorktree"),
|
|
5530
|
+
icon: h(PlusIcon, { size: 14 }),
|
|
5531
|
+
disabled: working || repo.unborn === true,
|
|
5532
|
+
run: openWorktreeDialog
|
|
5533
|
+
},
|
|
5534
|
+
null,
|
|
5535
|
+
{
|
|
5536
|
+
label: t("action.pruneWorktrees"),
|
|
5537
|
+
icon: h(TrashIcon, { size: 14 }),
|
|
5538
|
+
disabled: working || !worktrees.some((entry) => entry.prunable === true),
|
|
5539
|
+
run: () => {
|
|
5540
|
+
run("worktreePrune", {}, t("toast.worktreesPruned"));
|
|
5541
|
+
}
|
|
5542
|
+
}
|
|
5543
|
+
];
|
|
5544
|
+
/** One worktree row's menu: move here, copy the path, and remove or prune it. */
|
|
5545
|
+
const worktreeMenuItems = (worktree) => [
|
|
5546
|
+
{
|
|
5547
|
+
label: t("action.switchWorktree"),
|
|
5548
|
+
icon: h(BranchIcon, { size: 14 }),
|
|
5549
|
+
disabled: working || worktree.current === true || worktree.prunable === true,
|
|
5550
|
+
run: () => requestSwitchWorktree(worktree)
|
|
5551
|
+
},
|
|
5552
|
+
{
|
|
5553
|
+
label: t("action.copyWorktreePath"),
|
|
5554
|
+
icon: h(CopyIcon, { size: 14 }),
|
|
5555
|
+
run: () => {
|
|
5556
|
+
copy(worktree.path);
|
|
5557
|
+
}
|
|
5558
|
+
},
|
|
5559
|
+
null,
|
|
5560
|
+
worktree.prunable === true ? {
|
|
5561
|
+
label: t("action.pruneWorktrees"),
|
|
5562
|
+
icon: h(TrashIcon, { size: 14 }),
|
|
5563
|
+
disabled: working,
|
|
5564
|
+
run: () => {
|
|
5565
|
+
run("worktreePrune", {}, t("toast.worktreesPruned"));
|
|
5566
|
+
}
|
|
5567
|
+
} : {
|
|
5568
|
+
label: t("action.removeWorktree"),
|
|
5569
|
+
icon: h(TrashIcon, { size: 14 }),
|
|
5570
|
+
danger: true,
|
|
5571
|
+
disabled: working || worktree.current === true || worktree.main === true || worktree.bare === true,
|
|
5572
|
+
run: () => requestRemoveWorktree(worktree)
|
|
5573
|
+
}
|
|
5574
|
+
];
|
|
4801
5575
|
/**
|
|
4802
5576
|
* Items of the sparkle control's hold menu: language and message style.
|
|
4803
5577
|
* @param {object} rules - the rules the menu reflects.
|
|
@@ -4968,7 +5742,7 @@
|
|
|
4968
5742
|
/** Track the divider while the pointer is down. */
|
|
4969
5743
|
const moveResize = (event) => {
|
|
4970
5744
|
if (dragRef.current === null) return;
|
|
4971
|
-
if (
|
|
5745
|
+
if (paneLayout === "right") {
|
|
4972
5746
|
const next = clampPaneWidth(dragRef.current.startWidth - (event.clientX - dragRef.current.startX));
|
|
4973
5747
|
widthRef.current = next;
|
|
4974
5748
|
setDiffMaximized(false);
|
|
@@ -4983,7 +5757,7 @@
|
|
|
4983
5757
|
/** Restore the default size of the active dock. */
|
|
4984
5758
|
const resetResize = () => {
|
|
4985
5759
|
setDiffMaximized(false);
|
|
4986
|
-
if (
|
|
5760
|
+
if (paneLayout === "right") {
|
|
4987
5761
|
const next = clampPaneWidth(PREVIEW_WIDTH_DEFAULT);
|
|
4988
5762
|
widthRef.current = next;
|
|
4989
5763
|
setPreviewWidth(next);
|
|
@@ -5000,7 +5774,7 @@
|
|
|
5000
5774
|
if (dragRef.current === null) return;
|
|
5001
5775
|
dragRef.current = null;
|
|
5002
5776
|
setDragging(false);
|
|
5003
|
-
if (
|
|
5777
|
+
if (paneLayout === "right") storePreviewWidth(widthRef.current);
|
|
5004
5778
|
else storeDiffHeight(heightRef.current);
|
|
5005
5779
|
};
|
|
5006
5780
|
/** Switch the preview between the bottom and right docks. */
|
|
@@ -5099,32 +5873,245 @@
|
|
|
5099
5873
|
setConfirm(null);
|
|
5100
5874
|
run("undoCommit", {}, t("toast.undone"));
|
|
5101
5875
|
})
|
|
5102
|
-
}
|
|
5103
|
-
|
|
5104
|
-
|
|
5876
|
+
}
|
|
5877
|
+
];
|
|
5878
|
+
/** Label, glyph, counts, and click action of the sync control's primary segment. */
|
|
5879
|
+
const syncPrimary = () => {
|
|
5880
|
+
const remoteOperation = working && [
|
|
5881
|
+
"fetch",
|
|
5882
|
+
"pull",
|
|
5883
|
+
"push",
|
|
5884
|
+
"publish",
|
|
5885
|
+
"publishGithub"
|
|
5886
|
+
].includes(busy?.operation);
|
|
5887
|
+
if (unpublished) return {
|
|
5888
|
+
label: t("action.publish"),
|
|
5889
|
+
icon: CloudUploadIcon,
|
|
5890
|
+
title: t("sync.publish"),
|
|
5891
|
+
busy: working && [
|
|
5892
|
+
"publish",
|
|
5893
|
+
"publishGithub",
|
|
5894
|
+
"push"
|
|
5895
|
+
].includes(busy?.operation),
|
|
5896
|
+
disabled: working,
|
|
5897
|
+
counts: [],
|
|
5898
|
+
run: () => {
|
|
5899
|
+
publish(true);
|
|
5900
|
+
}
|
|
5901
|
+
};
|
|
5902
|
+
if (repo.detached === true || repo.unborn === true) return {
|
|
5105
5903
|
label: t("action.fetch"),
|
|
5106
|
-
icon:
|
|
5904
|
+
icon: FetchIcon,
|
|
5905
|
+
title: t("sync.fetch"),
|
|
5906
|
+
busy: remoteOperation,
|
|
5107
5907
|
disabled: working,
|
|
5908
|
+
counts: [],
|
|
5108
5909
|
run: () => {
|
|
5109
5910
|
run("fetch", { all: true }, fetchSuccess);
|
|
5110
5911
|
}
|
|
5111
|
-
}
|
|
5912
|
+
};
|
|
5913
|
+
if (repo.behind > 0) {
|
|
5914
|
+
const counts = [{
|
|
5915
|
+
tone: "behind",
|
|
5916
|
+
text: `↓${repo.behind}`
|
|
5917
|
+
}];
|
|
5918
|
+
if (repo.ahead > 0) counts.push({
|
|
5919
|
+
tone: "ahead",
|
|
5920
|
+
text: `↑${repo.ahead}`
|
|
5921
|
+
});
|
|
5922
|
+
return {
|
|
5923
|
+
label: t("action.pull"),
|
|
5924
|
+
icon: PullIcon,
|
|
5925
|
+
title: t("sync.pull"),
|
|
5926
|
+
busy: working && busy?.operation === "pull",
|
|
5927
|
+
disabled: working,
|
|
5928
|
+
counts,
|
|
5929
|
+
run: () => {
|
|
5930
|
+
run("pull", {}, t("toast.pulled"));
|
|
5931
|
+
}
|
|
5932
|
+
};
|
|
5933
|
+
}
|
|
5934
|
+
if (repo.ahead > 0) return {
|
|
5935
|
+
label: t("action.push"),
|
|
5936
|
+
icon: PushIcon,
|
|
5937
|
+
title: t("sync.push"),
|
|
5938
|
+
busy: working && busy?.operation === "push",
|
|
5939
|
+
disabled: working,
|
|
5940
|
+
counts: [{
|
|
5941
|
+
tone: "ahead",
|
|
5942
|
+
text: `↑${repo.ahead}`
|
|
5943
|
+
}],
|
|
5944
|
+
run: () => {
|
|
5945
|
+
run("push", {}, t("toast.pushed"));
|
|
5946
|
+
}
|
|
5947
|
+
};
|
|
5948
|
+
return {
|
|
5949
|
+
label: t("action.fetch"),
|
|
5950
|
+
icon: FetchIcon,
|
|
5951
|
+
title: t("sync.fetch"),
|
|
5952
|
+
busy: remoteOperation,
|
|
5953
|
+
disabled: working,
|
|
5954
|
+
counts: [],
|
|
5955
|
+
run: () => {
|
|
5956
|
+
run("fetch", { all: true }, fetchSuccess);
|
|
5957
|
+
}
|
|
5958
|
+
};
|
|
5959
|
+
};
|
|
5960
|
+
/** The remotes a Fetch From or Push To submenu can target. */
|
|
5961
|
+
const remoteTargets = () => remotes.map((remote) => remote.name);
|
|
5962
|
+
/** Submenu: fetch one named remote, or all of them when there is a choice. */
|
|
5963
|
+
const openFetchFromMenu = () => {
|
|
5964
|
+
const names = remoteTargets();
|
|
5965
|
+
const items = [{ heading: t("section.remotes") }, ...names.map((name) => ({
|
|
5966
|
+
label: name,
|
|
5967
|
+
icon: h(RemoteIcon, { size: 14 }),
|
|
5968
|
+
run: () => {
|
|
5969
|
+
run("fetch", { remote: name }, fetchSuccess);
|
|
5970
|
+
}
|
|
5971
|
+
}))];
|
|
5972
|
+
if (names.length > 1) items.push(null, {
|
|
5973
|
+
label: t("menu.fetchAll"),
|
|
5974
|
+
icon: h(FetchIcon, { size: 14 }),
|
|
5975
|
+
run: () => {
|
|
5976
|
+
run("fetch", { all: true }, fetchSuccess);
|
|
5977
|
+
}
|
|
5978
|
+
});
|
|
5979
|
+
openMenuAt(menuAnchorRef.current, items);
|
|
5980
|
+
};
|
|
5981
|
+
/** Submenu: push the current branch to one named remote. */
|
|
5982
|
+
const openPushToMenu = () => {
|
|
5983
|
+
openMenuAt(menuAnchorRef.current, [{ heading: t("section.remotes") }, ...remoteTargets().map((name) => ({
|
|
5984
|
+
label: name,
|
|
5985
|
+
icon: h(RemoteIcon, { size: 14 }),
|
|
5986
|
+
run: () => {
|
|
5987
|
+
if (repo.upstream === null) run("push", {
|
|
5988
|
+
setUpstream: true,
|
|
5989
|
+
remote: name
|
|
5990
|
+
}, t("toast.published", { branch: repo.branch }));
|
|
5991
|
+
else run("push", { remote: name }, t("toast.pushed"));
|
|
5992
|
+
}
|
|
5993
|
+
}))]);
|
|
5994
|
+
};
|
|
5995
|
+
/** The remote commands behind the sync control's chevron. */
|
|
5996
|
+
const syncMenuItems = () => {
|
|
5997
|
+
const noRemote = remotes.length === 0;
|
|
5998
|
+
const noUpstream = repo.upstream === null;
|
|
5999
|
+
const noBranch = repo.detached === true || repo.unborn === true;
|
|
6000
|
+
return [
|
|
6001
|
+
{
|
|
6002
|
+
label: t("action.fetch"),
|
|
6003
|
+
disabled: working,
|
|
6004
|
+
run: () => {
|
|
6005
|
+
run("fetch", { all: true }, fetchSuccess);
|
|
6006
|
+
}
|
|
6007
|
+
},
|
|
6008
|
+
{
|
|
6009
|
+
label: t("action.fetchFrom"),
|
|
6010
|
+
disabled: working || noRemote,
|
|
6011
|
+
run: openFetchFromMenu
|
|
6012
|
+
},
|
|
6013
|
+
{
|
|
6014
|
+
label: t("action.pull"),
|
|
6015
|
+
disabled: working || noBranch || noUpstream,
|
|
6016
|
+
run: () => {
|
|
6017
|
+
run("pull", {}, t("toast.pulled"));
|
|
6018
|
+
}
|
|
6019
|
+
},
|
|
6020
|
+
{
|
|
6021
|
+
label: t("action.pullRebase"),
|
|
6022
|
+
disabled: working || noBranch || noUpstream,
|
|
6023
|
+
run: () => {
|
|
6024
|
+
run("pull", { rebase: true }, t("toast.pulled"));
|
|
6025
|
+
}
|
|
6026
|
+
},
|
|
6027
|
+
null,
|
|
6028
|
+
{
|
|
6029
|
+
label: t("action.push"),
|
|
6030
|
+
disabled: working || noBranch || noUpstream || noRemote,
|
|
6031
|
+
run: () => {
|
|
6032
|
+
run("push", {}, t("toast.pushed"));
|
|
6033
|
+
}
|
|
6034
|
+
},
|
|
6035
|
+
{
|
|
6036
|
+
label: t("action.pushTo"),
|
|
6037
|
+
disabled: working || noBranch || noRemote,
|
|
6038
|
+
run: openPushToMenu
|
|
6039
|
+
},
|
|
6040
|
+
{
|
|
6041
|
+
label: t("action.forcePush"),
|
|
6042
|
+
disabled: working || noBranch || noUpstream || noRemote,
|
|
6043
|
+
run: () => ask(t("confirm.forcePush"), () => {
|
|
6044
|
+
setConfirm(null);
|
|
6045
|
+
run("push", { forceWithLease: true }, t("toast.forcePushed"));
|
|
6046
|
+
})
|
|
6047
|
+
}
|
|
6048
|
+
];
|
|
6049
|
+
};
|
|
6050
|
+
/** The Zed-style split control: a state-driven primary action and its menu. */
|
|
6051
|
+
const syncControl = () => {
|
|
6052
|
+
const primary = syncPrimary();
|
|
6053
|
+
const PrimaryIcon = primary.icon;
|
|
6054
|
+
return h("div", { className: "dgscm-sync-control" }, h("button", {
|
|
6055
|
+
type: "button",
|
|
6056
|
+
className: "dgscm-sync-primary",
|
|
6057
|
+
title: primary.title,
|
|
6058
|
+
"aria-label": primary.label,
|
|
6059
|
+
"aria-busy": primary.busy ? "true" : void 0,
|
|
6060
|
+
disabled: primary.disabled,
|
|
6061
|
+
onClick: (event) => {
|
|
6062
|
+
event.stopPropagation();
|
|
6063
|
+
if (primary.disabled) return;
|
|
6064
|
+
primary.run();
|
|
6065
|
+
}
|
|
6066
|
+
}, primary.busy ? h(SpinnerIcon, { size: 13 }) : h(PrimaryIcon, { size: 13 }), h("span", { className: "dgscm-sync-text" }, primary.label), primary.counts.map((entry) => h("span", {
|
|
6067
|
+
key: entry.tone,
|
|
6068
|
+
className: `dgscm-sync-count dgscm-sync-count--${entry.tone}`
|
|
6069
|
+
}, entry.text))), h("button", {
|
|
6070
|
+
type: "button",
|
|
6071
|
+
className: "dgscm-sync-toggle",
|
|
6072
|
+
title: t("action.moreSync"),
|
|
6073
|
+
"aria-label": t("action.moreSync"),
|
|
6074
|
+
disabled: working,
|
|
6075
|
+
onClick: (event) => {
|
|
6076
|
+
event.stopPropagation();
|
|
6077
|
+
openMenuBelow(event.currentTarget, syncMenuItems());
|
|
6078
|
+
}
|
|
6079
|
+
}, h(CaretIcon, { size: 12 })));
|
|
6080
|
+
};
|
|
6081
|
+
/** Options behind the commit split button's chevron. */
|
|
6082
|
+
const commitMenuItems = () => [
|
|
5112
6083
|
{
|
|
5113
|
-
label: t("action.
|
|
5114
|
-
icon: h(
|
|
5115
|
-
disabled: working ||
|
|
6084
|
+
label: message.trim().length > 0 ? t("action.improveMessage") : t("action.generateMessage"),
|
|
6085
|
+
icon: h(SparkleIcon, { size: 14 }),
|
|
6086
|
+
disabled: working || generating,
|
|
5116
6087
|
run: () => {
|
|
5117
|
-
|
|
6088
|
+
generateMessage();
|
|
5118
6089
|
}
|
|
5119
6090
|
},
|
|
6091
|
+
null,
|
|
5120
6092
|
{
|
|
5121
|
-
label:
|
|
5122
|
-
|
|
5123
|
-
disabled: working || repo.
|
|
6093
|
+
label: t("commit.amend"),
|
|
6094
|
+
checked: amend,
|
|
6095
|
+
disabled: working || repo.head === null,
|
|
6096
|
+
run: () => toggleAmend(!amend)
|
|
6097
|
+
},
|
|
6098
|
+
null,
|
|
6099
|
+
{
|
|
6100
|
+
label: t("commit.all"),
|
|
6101
|
+
icon: h(CommitIcon, { size: 14 }),
|
|
6102
|
+
disabled: working || message.trim().length === 0,
|
|
5124
6103
|
run: () => {
|
|
5125
|
-
|
|
5126
|
-
else run("push", {}, t("toast.pushed"));
|
|
6104
|
+
commit(true);
|
|
5127
6105
|
}
|
|
6106
|
+
},
|
|
6107
|
+
{
|
|
6108
|
+
label: t("commit.undo"),
|
|
6109
|
+
icon: h(DiscardIcon, { size: 14 }),
|
|
6110
|
+
disabled: working || repo.head === null || pending !== null,
|
|
6111
|
+
run: () => ask(t("confirm.undoCommit"), () => {
|
|
6112
|
+
setConfirm(null);
|
|
6113
|
+
run("undoCommit", {}, t("toast.undone"));
|
|
6114
|
+
})
|
|
5128
6115
|
}
|
|
5129
6116
|
];
|
|
5130
6117
|
/** Header controls of the staged section: the selection command joins the bulk command. */
|
|
@@ -5738,15 +6725,19 @@
|
|
|
5738
6725
|
return rows;
|
|
5739
6726
|
};
|
|
5740
6727
|
return h("div", {
|
|
5741
|
-
className: `dgscm-root${
|
|
6728
|
+
className: `dgscm-root${paneLayout === "right" ? " dgscm-root--row" : ""}`,
|
|
5742
6729
|
ref: attachRoot
|
|
5743
|
-
}, h("div", { className: "dgscm-main" }, h("div", { className: "dgscm-top" }, h("div", { className: "dgscm-repo-row" }, h(
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
6730
|
+
}, h("div", { className: "dgscm-main" }, h("div", { className: "dgscm-top" }, h("div", { className: "dgscm-repo-row" }, h("span", {
|
|
6731
|
+
className: "dgscm-repo-glyph",
|
|
6732
|
+
role: "img",
|
|
6733
|
+
"aria-label": repo.name,
|
|
6734
|
+
title: repo.name
|
|
6735
|
+
}, h(RepoIcon, { size: 15 })), repo.isWorktree === true ? h("span", {
|
|
6736
|
+
className: "dgscm-badge dgscm-badge--worktree dgscm-badge--icon",
|
|
6737
|
+
title: currentWorktree === null ? repo.root : `${t("repo.worktree")} — ${currentWorktree.path}`,
|
|
6738
|
+
"aria-label": t("repo.worktree"),
|
|
6739
|
+
role: "img"
|
|
6740
|
+
}, h(FolderIcon, { size: 12 })) : null, repo.detached === true ? h("span", { className: "dgscm-badge" }, repo.head === null ? "HEAD" : repo.head.short) : h("span", { className: "dgscm-branch-chip" }, h("button", {
|
|
5750
6741
|
ref: chipRef,
|
|
5751
6742
|
type: "button",
|
|
5752
6743
|
className: "dgscm-branch-chip-name",
|
|
@@ -5787,36 +6778,7 @@
|
|
|
5787
6778
|
reloadOpenNodes();
|
|
5788
6779
|
});
|
|
5789
6780
|
}
|
|
5790
|
-
}, h(RefreshIcon, { size: 15 })), h(
|
|
5791
|
-
label: t("action.fetch"),
|
|
5792
|
-
disabled: working,
|
|
5793
|
-
busy: busy?.operation === "fetch",
|
|
5794
|
-
onClick: () => {
|
|
5795
|
-
run("fetch", { all: true }, fetchSuccess);
|
|
5796
|
-
}
|
|
5797
|
-
}, h(FetchIcon, { size: 15 })), h(IconButton, {
|
|
5798
|
-
label: t("action.pull"),
|
|
5799
|
-
disabled: working || repo.upstream === null || repo.detached === true,
|
|
5800
|
-
busy: busy?.operation === "pull",
|
|
5801
|
-
onClick: () => {
|
|
5802
|
-
run("pull", {}, t("toast.pulled"));
|
|
5803
|
-
}
|
|
5804
|
-
}, h(PullIcon, { size: 15 })), h(IconButton, {
|
|
5805
|
-
label: unpublished ? t("action.publishBranch") : t("action.push"),
|
|
5806
|
-
disabled: working || repo.detached === true || repo.unborn === true,
|
|
5807
|
-
busy: busy?.operation === "push" || busy?.operation === "publish" || busy?.operation === "publishGithub",
|
|
5808
|
-
onClick: () => {
|
|
5809
|
-
if (unpublished) publish();
|
|
5810
|
-
else run("push", {}, t("toast.pushed"));
|
|
5811
|
-
}
|
|
5812
|
-
}, h(unpublished ? CloudUploadIcon : PushIcon, { size: 15 })), h(IconButton, {
|
|
5813
|
-
label: changeView === "tree" ? t("action.viewList") : t("action.viewTree"),
|
|
5814
|
-
onClick: toggleChangeView
|
|
5815
|
-
}, h(changeView === "tree" ? RowsIcon : TreeIcon, { size: 15 })), h(IconButton, {
|
|
5816
|
-
label: t("action.moreChanges"),
|
|
5817
|
-
disabled: working,
|
|
5818
|
-
onClick: (event) => openMenu(event, changesMoreMenuItems())
|
|
5819
|
-
}, h(MoreIcon, { size: 15 })))), working ? h("div", { className: "dgscm-sync" }, h("span", { className: "dgscm-sync-label" }, `${t(BUSY_LABEL[busy.operation] ?? "toast.busy")}…`)) : h("div", { className: "dgscm-sync" }, repo.detached === true ? h("span", { className: "dgscm-sync-label" }, t("repo.detached", { commit: repo.head === null ? "" : repo.head.short })) : repo.upstream === null ? h("span", { className: "dgscm-sync-label" }, t("repo.noUpstream")) : h(React.Fragment, null, repo.ahead > 0 ? h("span", {
|
|
6781
|
+
}, h(RefreshIcon, { size: 15 })), syncControl())), h("div", { className: "dgscm-sync-row" }, working ? h("div", { className: "dgscm-sync" }, h("span", { className: "dgscm-sync-label" }, `${t(BUSY_LABEL[busy.operation] ?? "toast.busy")}…`)) : h("div", { className: "dgscm-sync" }, repo.detached === true ? h("span", { className: "dgscm-sync-label" }, t("repo.detached", { commit: repo.head === null ? "" : repo.head.short })) : repo.upstream === null ? h("span", { className: "dgscm-sync-label" }, t("repo.noUpstream")) : h(React.Fragment, null, repo.ahead > 0 ? h("span", {
|
|
5820
6782
|
className: "dgscm-count dgscm-count--ahead",
|
|
5821
6783
|
title: t("ahead.label", { n: repo.ahead })
|
|
5822
6784
|
}, h(PushIcon, { size: 11 }), String(repo.ahead)) : null, repo.behind > 0 ? h("span", {
|
|
@@ -5825,7 +6787,14 @@
|
|
|
5825
6787
|
}, h(PullIcon, { size: 11 }), String(repo.behind)) : null, h("span", {
|
|
5826
6788
|
className: "dgscm-sync-label",
|
|
5827
6789
|
title: repo.upstream
|
|
5828
|
-
}, repo.ahead === 0 && repo.behind === 0 ? t("repo.synced", { upstream: repo.upstream }) : repo.upstream)), h("span", { className: "dgscm-sep" }, "·"), h("span", { className: "dgscm-sync-label" }, repo.lastFetchAt === null || repo.lastFetchAt === void 0 ? t("repo.neverFetched") : t("repo.fetched", { time: relativeTime(repo.lastFetchAt, t) })))
|
|
6790
|
+
}, repo.ahead === 0 && repo.behind === 0 ? t("repo.synced", { upstream: repo.upstream }) : repo.upstream)), h("span", { className: "dgscm-sep" }, "·"), h("span", { className: "dgscm-sync-label" }, repo.lastFetchAt === null || repo.lastFetchAt === void 0 ? t("repo.neverFetched") : t("repo.fetched", { time: relativeTime(repo.lastFetchAt, t) }))), h("div", { className: "dgscm-sync-actions" }, h(IconButton, {
|
|
6791
|
+
label: changeView === "tree" ? t("action.viewList") : t("action.viewTree"),
|
|
6792
|
+
onClick: toggleChangeView
|
|
6793
|
+
}, h(changeView === "tree" ? RowsIcon : TreeIcon, { size: 14 })), h(IconButton, {
|
|
6794
|
+
label: t("action.moreChanges"),
|
|
6795
|
+
disabled: working,
|
|
6796
|
+
onClick: (event) => openMenu(event, changesMoreMenuItems())
|
|
6797
|
+
}, h(MoreIcon, { size: 14 }))))), pending === null ? null : h("div", { className: "dgscm-banner" }, h("span", { className: "dgscm-banner-glyph" }, h(WarnIcon, { size: 13 })), h("span", { className: "dgscm-banner-text" }, pendingLabel), h("button", {
|
|
5829
6798
|
type: "button",
|
|
5830
6799
|
className: "dgscm-link-button dgscm-link-button--primary dgscm-banner-action",
|
|
5831
6800
|
disabled: working,
|
|
@@ -5838,16 +6807,20 @@
|
|
|
5838
6807
|
className: "dgscm-textarea",
|
|
5839
6808
|
rows: 1,
|
|
5840
6809
|
value: message,
|
|
5841
|
-
placeholder:
|
|
6810
|
+
placeholder: messageHint,
|
|
5842
6811
|
disabled: working,
|
|
5843
6812
|
onChange: (event) => setMessage(event.target.value),
|
|
5844
6813
|
onKeyDown: (event) => {
|
|
5845
6814
|
if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
|
|
5846
6815
|
event.preventDefault();
|
|
5847
|
-
|
|
6816
|
+
commitTracked();
|
|
5848
6817
|
}
|
|
5849
6818
|
}
|
|
5850
|
-
}), h("
|
|
6819
|
+
}), message.length === 0 ? h("span", {
|
|
6820
|
+
ref: hintRef,
|
|
6821
|
+
className: "dgscm-message-measure",
|
|
6822
|
+
"aria-hidden": "true"
|
|
6823
|
+
}, messageHint) : null, h("button", {
|
|
5851
6824
|
type: "button",
|
|
5852
6825
|
className: `dgscm-generate${generating ? " dgscm-generate--busy" : ""}`,
|
|
5853
6826
|
title: generating ? t("commit.generating") : `${message.trim().length > 0 ? t("action.improveMessage") : t("action.generateMessage")} · ${t("commit.rulesHint")}`,
|
|
@@ -5895,57 +6868,26 @@
|
|
|
5895
6868
|
onClick: () => {
|
|
5896
6869
|
publish(true);
|
|
5897
6870
|
}
|
|
5898
|
-
}, h(CloudUploadIcon, { size: 15 }), t("action.publishBranch")) : h(React.Fragment, null, h("
|
|
5899
|
-
className: "dgscm-check",
|
|
5900
|
-
title: t("commit.amend")
|
|
5901
|
-
}, h("input", {
|
|
5902
|
-
type: "checkbox",
|
|
5903
|
-
checked: amend,
|
|
5904
|
-
disabled: working || repo.head === null,
|
|
5905
|
-
onChange: (event) => toggleAmend(event.target.checked)
|
|
5906
|
-
}), h("span", null, t("commit.amend"))), h("div", { className: "dgscm-commit-actions" }, h("button", {
|
|
6871
|
+
}, h(CloudUploadIcon, { size: 15 }), t("action.publishBranch")) : h(React.Fragment, null, amend && !working ? h("span", { className: "dgscm-commit-note" }, t("commit.amendNote")) : null, h("div", { className: "dgscm-commit-actions" }, h("div", { className: "dgscm-split-button dgscm-split-button--commit" }, h("button", {
|
|
5907
6872
|
type: "button",
|
|
5908
|
-
className: "dgscm-
|
|
6873
|
+
className: "dgscm-split-main dgscm-commit-submit",
|
|
5909
6874
|
disabled: !canCommit,
|
|
5910
|
-
title:
|
|
6875
|
+
title: commitTitle(),
|
|
6876
|
+
"aria-busy": busy?.operation === "commit" ? "true" : void 0,
|
|
5911
6877
|
onClick: () => {
|
|
5912
|
-
|
|
6878
|
+
commitTracked();
|
|
5913
6879
|
}
|
|
5914
|
-
}, busy?.operation === "commit" ?
|
|
6880
|
+
}, busy?.operation === "commit" ? h(SpinnerIcon, { size: 13 }) : null, h("span", null, commitLabel())), h("button", {
|
|
5915
6881
|
type: "button",
|
|
5916
|
-
className: "dgscm-split-more",
|
|
6882
|
+
className: "dgscm-split-toggle dgscm-commit-more",
|
|
5917
6883
|
title: t("commit.more"),
|
|
5918
6884
|
"aria-label": t("commit.more"),
|
|
5919
|
-
disabled: working
|
|
5920
|
-
onClick: (event) =>
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
run: () => {
|
|
5926
|
-
generateMessage();
|
|
5927
|
-
}
|
|
5928
|
-
},
|
|
5929
|
-
null,
|
|
5930
|
-
{
|
|
5931
|
-
label: t("commit.all"),
|
|
5932
|
-
icon: h(CommitIcon, { size: 14 }),
|
|
5933
|
-
disabled: working,
|
|
5934
|
-
run: () => {
|
|
5935
|
-
commit(true);
|
|
5936
|
-
}
|
|
5937
|
-
},
|
|
5938
|
-
{
|
|
5939
|
-
label: t("commit.undo"),
|
|
5940
|
-
icon: h(DiscardIcon, { size: 14 }),
|
|
5941
|
-
disabled: working || repo.head === null || pending !== null,
|
|
5942
|
-
run: () => ask(t("confirm.undoCommit"), () => {
|
|
5943
|
-
setConfirm(null);
|
|
5944
|
-
run("undoCommit", {}, t("toast.undone"));
|
|
5945
|
-
})
|
|
5946
|
-
}
|
|
5947
|
-
])
|
|
5948
|
-
}, h("span", { className: "dgscm-chevron dgscm-chevron--open" }, h(ChevronIcon, { open: true }))))))), h("div", {
|
|
6885
|
+
disabled: working,
|
|
6886
|
+
onClick: (event) => {
|
|
6887
|
+
event.stopPropagation();
|
|
6888
|
+
openMenuBelow(event.currentTarget, commitMenuItems());
|
|
6889
|
+
}
|
|
6890
|
+
}, h(CaretIcon, { size: 12 }))))))), h("div", {
|
|
5949
6891
|
className: "dgscm-scroll",
|
|
5950
6892
|
onClick: clearSelectionOnBlank
|
|
5951
6893
|
}, staged.length === 0 ? null : h(Section, {
|
|
@@ -5970,6 +6912,26 @@
|
|
|
5970
6912
|
open: sections.groupRepositories,
|
|
5971
6913
|
onToggle: () => toggleSection("groupRepositories")
|
|
5972
6914
|
}, h(Section, {
|
|
6915
|
+
id: "worktrees",
|
|
6916
|
+
title: t("section.worktrees"),
|
|
6917
|
+
count: worktrees.length,
|
|
6918
|
+
open: sections.worktrees,
|
|
6919
|
+
onToggle: () => toggleSection("worktrees"),
|
|
6920
|
+
glyph: h(FolderIcon, { size: 13 }),
|
|
6921
|
+
actions: h(IconButton, {
|
|
6922
|
+
label: t("action.createWorktree"),
|
|
6923
|
+
disabled: working || repo.unborn === true,
|
|
6924
|
+
onClick: (event) => openMenu(event, worktreeAddMenuItems())
|
|
6925
|
+
}, h(PlusIcon, { size: 13 }))
|
|
6926
|
+
}, worktrees.length === 0 ? h("div", { className: "dgscm-section-note" }, t("empty.worktrees")) : worktrees.map((worktree) => h(WorktreeRow, {
|
|
6927
|
+
key: `worktree:${worktree.path}`,
|
|
6928
|
+
worktree,
|
|
6929
|
+
pathLabel: worktreePathLabel(worktree),
|
|
6930
|
+
t,
|
|
6931
|
+
onSwitch: requestSwitchWorktree,
|
|
6932
|
+
onMenu: (event) => openMenu(event, worktreeMenuItems(worktree)),
|
|
6933
|
+
onContextMenu: (event) => openMenu(event, worktreeMenuItems(worktree))
|
|
6934
|
+
}))), h(Section, {
|
|
5973
6935
|
id: "branches",
|
|
5974
6936
|
title: t("section.branches"),
|
|
5975
6937
|
count: branches.local.length,
|
|
@@ -6088,10 +7050,10 @@
|
|
|
6088
7050
|
})
|
|
6089
7051
|
}
|
|
6090
7052
|
])
|
|
6091
|
-
})))))), previewOpen ? h(React.Fragment, null, h("div", {
|
|
6092
|
-
className: `dgscm-divider${
|
|
7053
|
+
})))))), previewOpen ? h(React.Fragment, null, collapsedPane ? null : h("div", {
|
|
7054
|
+
className: `dgscm-divider${paneLayout === "right" ? " dgscm-divider--vertical" : ""}${dragging ? " dgscm-divider--active" : ""}`,
|
|
6093
7055
|
role: "separator",
|
|
6094
|
-
"aria-orientation":
|
|
7056
|
+
"aria-orientation": paneLayout === "right" ? "vertical" : "horizontal",
|
|
6095
7057
|
"aria-label": t("diff.resize"),
|
|
6096
7058
|
title: t("diff.resize"),
|
|
6097
7059
|
onPointerDown: startResize,
|
|
@@ -6100,9 +7062,9 @@
|
|
|
6100
7062
|
onPointerCancel: endResize,
|
|
6101
7063
|
onDoubleClick: resetResize
|
|
6102
7064
|
}), h("div", {
|
|
6103
|
-
className: `dgscm-diffpane${
|
|
6104
|
-
style:
|
|
6105
|
-
},
|
|
7065
|
+
className: `dgscm-diffpane${paneLayout === "right" ? " dgscm-diffpane--right" : ""}${collapsedPane ? " dgscm-diffpane--collapsed" : ""}`,
|
|
7066
|
+
style: paneLayout === "right" ? { width: `${paneWidth}px` } : collapsedPane ? void 0 : { height: `${paneHeight}px` }
|
|
7067
|
+
}, paneLayout === "right" ? h("div", {
|
|
6106
7068
|
className: "dgscm-resize-edge",
|
|
6107
7069
|
"aria-hidden": true,
|
|
6108
7070
|
onPointerDown: startResize,
|
|
@@ -6119,14 +7081,18 @@
|
|
|
6119
7081
|
onMaximize: () => setDiffMaximized((current) => !current),
|
|
6120
7082
|
maximized: diffMaximized,
|
|
6121
7083
|
searchSignal,
|
|
6122
|
-
layout:
|
|
7084
|
+
layout: paneLayout,
|
|
7085
|
+
layoutFixed,
|
|
7086
|
+
collapsed: collapsedPane,
|
|
7087
|
+
onToggleCollapsed: () => setComparisonCollapsed((current) => !current),
|
|
6123
7088
|
onLayout: switchLayout,
|
|
6124
7089
|
onBack: view.fromHistory === true && history !== null ? backToHistory : view.fromReview === true && review !== null ? () => setView(null) : void 0,
|
|
6125
7090
|
backLabel: view.fromHistory === true ? t("history.back") : t("review.back"),
|
|
6126
7091
|
t
|
|
6127
7092
|
}) : review !== null ? h(ReviewPane, {
|
|
6128
7093
|
review,
|
|
6129
|
-
layout:
|
|
7094
|
+
layout: paneLayout,
|
|
7095
|
+
layoutFixed,
|
|
6130
7096
|
onLayout: switchLayout,
|
|
6131
7097
|
maximized: diffMaximized,
|
|
6132
7098
|
onMaximize: () => setDiffMaximized((current) => !current),
|
|
@@ -6137,7 +7103,8 @@
|
|
|
6137
7103
|
t
|
|
6138
7104
|
}) : h(HistoryPane, {
|
|
6139
7105
|
state: history,
|
|
6140
|
-
layout:
|
|
7106
|
+
layout: paneLayout,
|
|
7107
|
+
layoutFixed,
|
|
6141
7108
|
onLayout: switchLayout,
|
|
6142
7109
|
maximized: diffMaximized,
|
|
6143
7110
|
onMaximize: () => setDiffMaximized((current) => !current),
|
|
@@ -6160,6 +7127,17 @@
|
|
|
6160
7127
|
prompt,
|
|
6161
7128
|
onCancel: () => setPrompt(null),
|
|
6162
7129
|
t
|
|
7130
|
+
}), worktreeDialog === null ? null : h(WorktreeDialog, {
|
|
7131
|
+
state: worktreeDialog,
|
|
7132
|
+
base: repo.branch === null || repo.branch === void 0 ? "HEAD" : repo.branch,
|
|
7133
|
+
onChange: updateWorktreeBranch,
|
|
7134
|
+
onCancel: () => {
|
|
7135
|
+
if (worktreeDialog.submitting !== true) setWorktreeDialog(null);
|
|
7136
|
+
},
|
|
7137
|
+
onSubmit: () => {
|
|
7138
|
+
createWorktree();
|
|
7139
|
+
},
|
|
7140
|
+
t
|
|
6163
7141
|
}), menu === null ? null : h(ContextMenu, {
|
|
6164
7142
|
menu,
|
|
6165
7143
|
onClose: () => {
|