@deepseek-ai/dsh-experimental-client-ui-forge 0.2.2-alpha.3 → 0.2.2-rc.2

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.
Files changed (272) hide show
  1. package/README.i18n.yaml +8 -8
  2. package/README.md +41 -14
  3. package/README.zh.md +40 -13
  4. package/lib/client.js +13 -11800
  5. package/lib/client.js.map +1 -0
  6. package/lib/index.js +1340 -115
  7. package/lib/typert.host.js +1715 -212
  8. package/lib/typert.remote-client.d.ts +42 -5
  9. package/lib/typert.remote-client.d.ts.map +1 -0
  10. package/lib/typert.remote-client.js +1523 -244
  11. package/lib/types/client/ActionToast.d.ts.map +1 -0
  12. package/lib/types/client/ActionToast.js.map +1 -0
  13. package/lib/types/client/BaseMenu.d.ts +30 -0
  14. package/lib/types/client/BaseMenu.d.ts.map +1 -0
  15. package/lib/types/client/BaseMenu.js.map +1 -0
  16. package/lib/types/client/ChangeRequestCard.d.ts +9 -5
  17. package/lib/types/client/ChangeRequestCard.d.ts.map +1 -0
  18. package/lib/types/client/ChangeRequestCard.js.map +1 -0
  19. package/lib/types/client/ChangeRequestOverview.d.ts +124 -0
  20. package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -0
  21. package/lib/types/client/ChangeRequestOverview.js.map +1 -0
  22. package/lib/types/client/ChangedFiles.d.ts +2 -0
  23. package/lib/types/client/ChangedFiles.d.ts.map +1 -0
  24. package/lib/types/client/ChangedFiles.js.map +1 -0
  25. package/lib/types/client/ChangesTab.d.ts +30 -5
  26. package/lib/types/client/ChangesTab.d.ts.map +1 -0
  27. package/lib/types/client/ChangesTab.js.map +1 -0
  28. package/lib/types/client/ChangesTabTitle.d.ts.map +1 -0
  29. package/lib/types/client/ChangesTabTitle.js.map +1 -0
  30. package/lib/types/client/CommitMenu.d.ts +41 -0
  31. package/lib/types/client/CommitMenu.d.ts.map +1 -0
  32. package/lib/types/client/CommitMenu.js.map +1 -0
  33. package/lib/types/client/DiffFile.d.ts +47 -15
  34. package/lib/types/client/DiffFile.d.ts.map +1 -0
  35. package/lib/types/client/DiffFile.js.map +1 -0
  36. package/lib/types/client/FileLabel.d.ts.map +1 -0
  37. package/lib/types/client/FileLabel.js.map +1 -0
  38. package/lib/types/client/FileTreePane.d.ts +4 -2
  39. package/lib/types/client/FileTreePane.d.ts.map +1 -0
  40. package/lib/types/client/FileTreePane.js.map +1 -0
  41. package/lib/types/client/ForgeTab.d.ts +9 -1
  42. package/lib/types/client/ForgeTab.d.ts.map +1 -0
  43. package/lib/types/client/ForgeTab.js.map +1 -0
  44. package/lib/types/client/ForgeTabTitle.d.ts.map +1 -0
  45. package/lib/types/client/ForgeTabTitle.js.map +1 -0
  46. package/lib/types/client/HeaderButton.d.ts.map +1 -0
  47. package/lib/types/client/HeaderButton.js.map +1 -0
  48. package/lib/types/client/LocalChangesCard.d.ts.map +1 -0
  49. package/lib/types/client/LocalChangesCard.js.map +1 -0
  50. package/lib/types/client/RefreshGlyph.d.ts.map +1 -0
  51. package/lib/types/client/RefreshGlyph.js.map +1 -0
  52. package/lib/types/client/ReviewComposer.d.ts +20 -6
  53. package/lib/types/client/ReviewComposer.d.ts.map +1 -0
  54. package/lib/types/client/ReviewComposer.js.map +1 -0
  55. package/lib/types/client/ReviewControls.d.ts +79 -0
  56. package/lib/types/client/ReviewControls.d.ts.map +1 -0
  57. package/lib/types/client/ReviewControls.js.map +1 -0
  58. package/lib/types/client/ReviewThread.d.ts +4 -4
  59. package/lib/types/client/ReviewThread.d.ts.map +1 -0
  60. package/lib/types/client/ReviewThread.js.map +1 -0
  61. package/lib/types/client/ReviewThreads.d.ts +108 -0
  62. package/lib/types/client/ReviewThreads.d.ts.map +1 -0
  63. package/lib/types/client/ReviewThreads.js.map +1 -0
  64. package/lib/types/client/SessionHoverForge.d.ts.map +1 -0
  65. package/lib/types/client/SessionHoverForge.js.map +1 -0
  66. package/lib/types/client/SessionRowForge.d.ts +1 -1
  67. package/lib/types/client/SessionRowForge.d.ts.map +1 -0
  68. package/lib/types/client/SessionRowForge.js.map +1 -0
  69. package/lib/types/client/SubmitReview.d.ts +12 -4
  70. package/lib/types/client/SubmitReview.d.ts.map +1 -0
  71. package/lib/types/client/SubmitReview.js.map +1 -0
  72. package/lib/types/client/ThreadList.d.ts +43 -0
  73. package/lib/types/client/ThreadList.d.ts.map +1 -0
  74. package/lib/types/client/ThreadList.js.map +1 -0
  75. package/lib/types/client/ViewOptionsMenu.d.ts +31 -0
  76. package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -0
  77. package/lib/types/client/ViewOptionsMenu.js.map +1 -0
  78. package/lib/types/client/WorktreeProgress.d.ts.map +1 -0
  79. package/lib/types/client/WorktreeProgress.js.map +1 -0
  80. package/lib/types/client/WorktreeSettings.d.ts +12 -0
  81. package/lib/types/client/WorktreeSettings.d.ts.map +1 -0
  82. package/lib/types/client/WorktreeSettings.js.map +1 -0
  83. package/lib/types/client/WorktreeToggle.d.ts.map +1 -0
  84. package/lib/types/client/WorktreeToggle.js.map +1 -0
  85. package/lib/types/client/changes-address.d.ts.map +1 -0
  86. package/lib/types/client/changes-address.js.map +1 -0
  87. package/lib/types/client/changes-store.d.ts +20 -5
  88. package/lib/types/client/changes-store.d.ts.map +1 -0
  89. package/lib/types/client/changes-store.js.map +1 -0
  90. package/lib/types/client/checkout.d.ts.map +1 -0
  91. package/lib/types/client/checkout.js.map +1 -0
  92. package/lib/types/client/code-selection.d.ts.map +1 -0
  93. package/lib/types/client/code-selection.js.map +1 -0
  94. package/lib/types/client/diff-rows.d.ts.map +1 -0
  95. package/lib/types/client/diff-rows.js.map +1 -0
  96. package/lib/types/client/file-tree.d.ts.map +1 -0
  97. package/lib/types/client/file-tree.js.map +1 -0
  98. package/lib/types/client/format.d.ts.map +1 -0
  99. package/lib/types/client/format.js.map +1 -0
  100. package/lib/types/client/glyphs.d.ts +4 -2
  101. package/lib/types/client/glyphs.d.ts.map +1 -0
  102. package/lib/types/client/glyphs.js.map +1 -0
  103. package/lib/types/client/host-viewed.d.ts +84 -0
  104. package/lib/types/client/host-viewed.d.ts.map +1 -0
  105. package/lib/types/client/host-viewed.js.map +1 -0
  106. package/lib/types/client/index.d.ts.map +1 -0
  107. package/lib/types/client/index.js.map +1 -0
  108. package/lib/types/client/locales.d.ts +175 -3
  109. package/lib/types/client/locales.d.ts.map +1 -0
  110. package/lib/types/client/locales.js.map +1 -0
  111. package/lib/types/client/menu-search.d.ts +10 -0
  112. package/lib/types/client/menu-search.d.ts.map +1 -0
  113. package/lib/types/client/menu-search.js.map +1 -0
  114. package/lib/types/client/mount.d.ts +4 -0
  115. package/lib/types/client/mount.d.ts.map +1 -0
  116. package/lib/types/client/mount.js.map +1 -0
  117. package/lib/types/client/review-queue.d.ts +5 -8
  118. package/lib/types/client/review-queue.d.ts.map +1 -0
  119. package/lib/types/client/review-queue.js.map +1 -0
  120. package/lib/types/client/review-threads.d.ts +108 -0
  121. package/lib/types/client/review-threads.d.ts.map +1 -0
  122. package/lib/types/client/review-threads.js.map +1 -0
  123. package/lib/types/client/review.d.ts +31 -4
  124. package/lib/types/client/review.d.ts.map +1 -0
  125. package/lib/types/client/review.js.map +1 -0
  126. package/lib/types/client/section-reach.d.ts +26 -0
  127. package/lib/types/client/section-reach.d.ts.map +1 -0
  128. package/lib/types/client/section-reach.js.map +1 -0
  129. package/lib/types/client/session-list.d.ts.map +1 -0
  130. package/lib/types/client/session-list.js.map +1 -0
  131. package/lib/types/client/source.d.ts.map +1 -0
  132. package/lib/types/client/source.js.map +1 -0
  133. package/lib/types/client/status.d.ts.map +1 -0
  134. package/lib/types/client/status.js.map +1 -0
  135. package/lib/types/client/thread-state.d.ts +68 -0
  136. package/lib/types/client/thread-state.d.ts.map +1 -0
  137. package/lib/types/client/thread-state.js.map +1 -0
  138. package/lib/types/client/toolbar-fold.d.ts +19 -0
  139. package/lib/types/client/toolbar-fold.d.ts.map +1 -0
  140. package/lib/types/client/toolbar-fold.js.map +1 -0
  141. package/lib/types/client/viewed-files.d.ts +70 -0
  142. package/lib/types/client/viewed-files.d.ts.map +1 -0
  143. package/lib/types/client/viewed-files.js.map +1 -0
  144. package/lib/types/client/worktree-settings-form.d.ts +32 -0
  145. package/lib/types/client/worktree-settings-form.d.ts.map +1 -0
  146. package/lib/types/client/worktree-settings-form.js.map +1 -0
  147. package/lib/types/commit-range.d.ts +17 -0
  148. package/lib/types/commit-range.d.ts.map +1 -0
  149. package/lib/types/commit-range.js.map +1 -0
  150. package/lib/types/diff.d.ts +10 -2
  151. package/lib/types/diff.d.ts.map +1 -0
  152. package/lib/types/diff.js.map +1 -0
  153. package/lib/types/git.d.ts.map +1 -0
  154. package/lib/types/git.js.map +1 -0
  155. package/lib/types/index.d.ts +194 -14
  156. package/lib/types/index.d.ts.map +1 -0
  157. package/lib/types/index.js.map +1 -0
  158. package/lib/types/layers.d.ts +66 -0
  159. package/lib/types/layers.d.ts.map +1 -0
  160. package/lib/types/layers.js.map +1 -0
  161. package/lib/types/local-diff.d.ts +54 -6
  162. package/lib/types/local-diff.d.ts.map +1 -0
  163. package/lib/types/local-diff.js.map +1 -0
  164. package/lib/types/panel.d.ts.map +1 -0
  165. package/lib/types/panel.js.map +1 -0
  166. package/lib/types/parse.d.ts +16 -0
  167. package/lib/types/parse.d.ts.map +1 -0
  168. package/lib/types/parse.js.map +1 -0
  169. package/lib/types/patch-cache.d.ts +12 -7
  170. package/lib/types/patch-cache.d.ts.map +1 -0
  171. package/lib/types/patch-cache.js.map +1 -0
  172. package/lib/types/review-cache.d.ts +54 -0
  173. package/lib/types/review-cache.d.ts.map +1 -0
  174. package/lib/types/review-cache.js.map +1 -0
  175. package/lib/types/states.d.ts.map +1 -0
  176. package/lib/types/states.js.map +1 -0
  177. package/lib/types/types.d.ts +113 -11
  178. package/lib/types/types.d.ts.map +1 -0
  179. package/lib/types/types.js.map +1 -0
  180. package/lib/types/wildmatch.d.ts +14 -0
  181. package/lib/types/wildmatch.d.ts.map +1 -0
  182. package/lib/types/wildmatch.js.map +1 -0
  183. package/lib/types/worktree.d.ts +8 -6
  184. package/lib/types/worktree.d.ts.map +1 -0
  185. package/lib/types/worktree.js.map +1 -0
  186. package/package.json +59 -49
  187. package/src/client/ActionToast.tsx +38 -0
  188. package/src/client/BaseMenu.module.css +153 -0
  189. package/src/client/BaseMenu.tsx +180 -0
  190. package/src/client/ChangeRequestCard.tsx +439 -0
  191. package/src/client/ChangeRequestOverview.module.css +196 -0
  192. package/src/client/ChangeRequestOverview.tsx +620 -0
  193. package/src/client/ChangedFiles.module.css +26 -0
  194. package/src/client/ChangedFiles.tsx +144 -0
  195. package/src/client/ChangesTab.module.css +984 -0
  196. package/src/client/ChangesTab.tsx +1288 -0
  197. package/src/client/ChangesTabTitle.tsx +28 -0
  198. package/src/client/CommitMenu.module.css +139 -0
  199. package/src/client/CommitMenu.tsx +186 -0
  200. package/src/client/DiffFile.tsx +621 -0
  201. package/src/client/FileLabel.module.css +53 -0
  202. package/src/client/FileLabel.tsx +66 -0
  203. package/src/client/FileTreePane.module.css +10 -0
  204. package/src/client/FileTreePane.tsx +79 -0
  205. package/src/client/ForgeTab.module.css +627 -0
  206. package/src/client/ForgeTab.tsx +263 -0
  207. package/src/client/ForgeTabTitle.tsx +21 -0
  208. package/src/client/HeaderButton.module.css +29 -0
  209. package/src/client/HeaderButton.tsx +68 -0
  210. package/src/client/LocalChangesCard.tsx +83 -0
  211. package/src/client/RefreshGlyph.module.css +22 -0
  212. package/src/client/RefreshGlyph.tsx +35 -0
  213. package/src/client/ReviewComposer.module.css +37 -0
  214. package/src/client/ReviewComposer.tsx +128 -0
  215. package/src/client/ReviewControls.module.css +162 -0
  216. package/src/client/ReviewControls.tsx +191 -0
  217. package/src/client/ReviewThread.tsx +96 -0
  218. package/src/client/ReviewThreads.module.css +326 -0
  219. package/src/client/ReviewThreads.tsx +443 -0
  220. package/src/client/SessionHoverForge.tsx +72 -0
  221. package/src/client/SessionList.module.css +85 -0
  222. package/src/client/SessionRowForge.tsx +86 -0
  223. package/src/client/SubmitReview.module.css +26 -0
  224. package/src/client/SubmitReview.tsx +95 -0
  225. package/src/client/ThreadList.module.css +218 -0
  226. package/src/client/ThreadList.tsx +165 -0
  227. package/src/client/ViewOptionsMenu.tsx +79 -0
  228. package/src/client/WorktreeProgress.module.css +226 -0
  229. package/src/client/WorktreeProgress.tsx +280 -0
  230. package/src/client/WorktreeSettings.module.css +29 -0
  231. package/src/client/WorktreeSettings.tsx +42 -0
  232. package/src/client/WorktreeToggle.module.css +132 -0
  233. package/src/client/WorktreeToggle.tsx +165 -0
  234. package/src/client/changes-address.ts +110 -0
  235. package/src/client/changes-store.ts +155 -0
  236. package/src/client/checkout.ts +75 -0
  237. package/src/client/code-selection.ts +53 -0
  238. package/src/client/diff-rows.ts +199 -0
  239. package/src/client/file-tree.ts +86 -0
  240. package/src/client/format.ts +37 -0
  241. package/src/client/glyphs.tsx +151 -0
  242. package/src/client/host-viewed.ts +195 -0
  243. package/src/client/index.ts +31 -0
  244. package/src/client/locales.ts +3446 -0
  245. package/src/client/menu-search.ts +16 -0
  246. package/src/client/mount.ts +439 -0
  247. package/src/client/review-queue.ts +256 -0
  248. package/src/client/review-threads.ts +204 -0
  249. package/src/client/review.ts +120 -0
  250. package/src/client/section-reach.ts +61 -0
  251. package/src/client/session-list.ts +79 -0
  252. package/src/client/source.ts +274 -0
  253. package/src/client/status.ts +171 -0
  254. package/src/client/thread-state.ts +127 -0
  255. package/src/client/toolbar-fold.ts +70 -0
  256. package/src/client/viewed-files.ts +178 -0
  257. package/src/client/worktree-settings-form.ts +43 -0
  258. package/src/commit-range.ts +27 -0
  259. package/src/css-modules.d.ts +5 -0
  260. package/src/diff.ts +162 -0
  261. package/src/git.ts +293 -0
  262. package/src/index.ts +1162 -0
  263. package/src/layers.ts +163 -0
  264. package/src/local-diff.ts +438 -0
  265. package/src/panel.ts +422 -0
  266. package/src/parse.ts +137 -0
  267. package/src/patch-cache.ts +73 -0
  268. package/src/review-cache.ts +98 -0
  269. package/src/states.ts +350 -0
  270. package/src/types.ts +504 -0
  271. package/src/wildmatch.ts +121 -0
  272. package/src/worktree.ts +576 -0
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Session row icons after the time label: a branch glyph while the Session
3
+ * works in the worktree the panel created for it, and the state glyph of its
4
+ * most urgent change request. Glyphs of open change requests stay in the
5
+ * row's subdued color with their checks filling the head branch end; merged and closed ones keep
6
+ * their state color.
7
+ */
8
+
9
+ import type { ReactNode } from 'react'
10
+ import { IconBranchOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
11
+ import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
12
+ // Type-only: pulls the ui-workspace SlotMap merge (the Session row seats).
13
+ import type {} from '@deepseek-ai/dsh-client-ui-workspace/client'
14
+ import type { ChecksRollup } from '@deepseek-ai/dsh-experimental-forge/types'
15
+ import { ChangeRequestGlyph } from './glyphs.tsx'
16
+ import type { ForgePanelKey, NS } from './locales.ts'
17
+ import { useSessionForgeFacts, type SessionListChangeRequest, type SessionListInjected } from './session-list.ts'
18
+ import { TONE_LABEL } from './status.ts'
19
+ import css from './SessionList.module.css'
20
+
21
+ type Translate = PropsLocale<typeof NS>['t']
22
+
23
+ /** Copy of each checks outcome a row and its hover card name. */
24
+ export const CHECKS_LABEL: Record<Exclude<ChecksRollup, 'none'>, ForgePanelKey> = {
25
+ pending: 'change.ci.running',
26
+ success: 'change.ci.passed',
27
+ failure: 'change.ci.failedUnlisted',
28
+ }
29
+
30
+ /**
31
+ * The checks outcome a row shows for a change request: none for a merged,
32
+ * closed, or not yet polled one.
33
+ * @param entry - the change request.
34
+ * @returns the outcome.
35
+ */
36
+ export function rowChecks(entry: SessionListChangeRequest): ChecksRollup {
37
+ if (entry.state === undefined || entry.tone === 'merged' || entry.tone === 'closed') return 'none'
38
+ return entry.state.checksRollup
39
+ }
40
+
41
+ /**
42
+ * Name a change request's state and checks, as one line.
43
+ * @param entry - the change request.
44
+ * @param t - forge panel copy.
45
+ * @returns the line.
46
+ */
47
+ export function stateLine(entry: SessionListChangeRequest, t: Translate): string {
48
+ const state = t(TONE_LABEL[entry.tone])
49
+ const checks = rowChecks(entry)
50
+ return checks === 'none' ? state : t('list.stateChecks', { state, checks: t(CHECKS_LABEL[checks]) })
51
+ }
52
+
53
+ /** Full props of the row icons. */
54
+ export type SessionRowForgeProps =
55
+ PropsRuntime<'sidebar.session.row.trailing'> & PropsLocale<typeof NS> & InjectFace<SessionListInjected>
56
+
57
+ /**
58
+ * Render a Session row's forge icons.
59
+ * @param props - the row's Session, the shared hooks, and copy.
60
+ * @returns the icons, or nothing for a Session without a worktree or change requests.
61
+ */
62
+ export function SessionRowForge({ sessionId, useSessions, useStates, t }: SessionRowForgeProps): ReactNode {
63
+ const facts = useSessionForgeFacts(useSessions, useStates, sessionId)
64
+ const top = facts.changeRequests[0]
65
+ const checks = top === undefined ? 'none' : rowChecks(top)
66
+ return (
67
+ <>
68
+ {facts.worktree !== null && (
69
+ <span className={css.icon} role="img" aria-label={t('list.worktree')} data-forge-row-worktree="">
70
+ <IconBranchOutlineRegular size={13} />
71
+ </span>
72
+ )}
73
+ {top !== undefined && (
74
+ <span
75
+ className={css.icon}
76
+ role="img"
77
+ aria-label={t('change.stateAria', { state: stateLine(top, t) })}
78
+ data-forge-row-change={top.tone}
79
+ >
80
+ <ChangeRequestGlyph tone={top.tone} tinted={top.tone === 'merged' || top.tone === 'closed'} size={14}
81
+ checks={checks === 'none' ? undefined : checks} />
82
+ </span>
83
+ )}
84
+ </>
85
+ )
86
+ }
@@ -0,0 +1,26 @@
1
+ /* Review submission follows the settings dialogs' field and footer spacing. */
2
+ .modal { width: min(520px, 100%); max-height: 100%; }
3
+ .content { min-height: 0; overflow-y: auto; }
4
+ .form { display: flex; flex-direction: column; gap: 16px; min-width: 0; font: var(--dsw-font-xs-13); font-family: Inter, var(--dsw-font-family); }
5
+ .count { color: var(--dsw-alias-label-secondary); }
6
+ .input { min-height: 112px; }
7
+ .summary { display: flex; flex-direction: column; gap: 8px; }
8
+ .hint { color: var(--dsw-alias-label-secondary); }
9
+ .decisions { display: flex; flex-wrap: wrap; gap: 8px 20px; }
10
+ .decisions label { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; color: var(--dsw-alias-label-primary); cursor: pointer; }
11
+ .decisions input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--dsw-alias-brand-primary); cursor: inherit; }
12
+ .decisions input:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: 2px; }
13
+ .decisions label:has(input:disabled) { cursor: default; opacity: 0.5; }
14
+ .error { color: var(--dsw-alias-state-error-primary); overflow-wrap: anywhere; }
15
+ .reconcile { display: flex; flex-wrap: wrap; gap: 8px; }
16
+ .discard { margin-inline-end: auto; }
17
+ .confirm {
18
+ display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px;
19
+ border: 0.5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-md);
20
+ /* An elevated surface inside the scrolling dialog body, so anything that scrolls in it takes the l2 thumb pair
21
+ (see ui-theme styles/scrollbar.css for the rebinding contract). */
22
+ --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);
23
+ --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);
24
+ background: var(--dsw-alias-bg-layer-2);
25
+ }
26
+ .confirmText { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
@@ -0,0 +1,95 @@
1
+ /** Centered review submission with a summary, decision, and pending-comment count, and the discarding of a pending review. */
2
+
3
+ import { useId, useState, useSyncExternalStore, type ReactNode } from 'react'
4
+ import clsx from 'clsx'
5
+ import { Button, Modal } from '@deepseek-ai/dsh-client-ui-primitives'
6
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
7
+ import type { ForgePendingReview } from '@deepseek-ai/dsh-experimental-forge/types'
8
+ import type { ReviewQueue } from './review-queue.ts'
9
+ import type { NS } from './locales.ts'
10
+ import css from './SubmitReview.module.css'
11
+ import reviewCss from './ReviewComposer.module.css'
12
+
13
+ /**
14
+ * Submit a review independently of the diff scroll position; comments remain at their code locations. With a pending
15
+ * review on the code host, the review holds its comments, and comment drafts kept in the browser must leave first.
16
+ * @param props - durable queue, current head, the pending review, submission outcome, and modal actions.
17
+ * @returns a portalled modal with keyboard focus ownership.
18
+ */
19
+ export function SubmitReview({
20
+ queue, url, headSha, pending, own, busy, error, submit, discard, close, check, reconcile, t,
21
+ }: PropsLocale<typeof NS> & {
22
+ readonly queue: ReviewQueue
23
+ readonly url: string
24
+ readonly headSha: string
25
+ /** The signed-in user's pending review on the code host, or null without one. */
26
+ readonly pending: ForgePendingReview | null
27
+ /** Whether the signed-in user authored the change request, which the code host lets them only comment on. */
28
+ readonly own: boolean
29
+ readonly busy: boolean
30
+ readonly error: string | null
31
+ readonly submit: () => void
32
+ /** Discard the pending review, or undefined without one. */
33
+ readonly discard: (() => void) | undefined
34
+ readonly close: () => void
35
+ readonly check: () => void
36
+ readonly reconcile: () => void
37
+ }): ReactNode {
38
+ const state = useSyncExternalStore(queue.subscribe, queue.getSnapshot)
39
+ const [confirming, setConfirming] = useState(false)
40
+ const name = useId()
41
+ const summaryHint = `${name}-summary-hint`
42
+ const requiresSummary = state.event === 'request-changes'
43
+ const locked = busy || state.uncertain !== null
44
+ // A decision kept from another change request stays chosen until the reader picks Comment.
45
+ const refused = own && state.event !== 'comment'
46
+ const count = pending?.comments ?? state.comments.length
47
+ // Drafts kept in the browser join only a review published without a pending one on the code host.
48
+ const blocked = pending !== null && state.comments.length > 0
49
+ const stale = pending === null
50
+ && state.comments.some(item => item.source.kind !== 'change' || item.source.url !== url || item.source.headSha !== headSha)
51
+ const empty = (pending === null && state.comments.some(item => item.comment.body.trim() === ''))
52
+ || (requiresSummary && state.body.trim() === '')
53
+ || (state.event === 'comment' && state.body.trim() === '' && count === 0)
54
+ const notice = state.error !== null ? t(state.error === 'load' ? 'review.loadFailed' : 'review.saveFailed')
55
+ : blocked ? t('review.browserDrafts', { count: state.comments.length }) : stale ? t('review.stale') : error
56
+ return <Modal open onClose={close} title={t('review.submit')} closeLabel={t('review.close')}
57
+ className={clsx(css.modal)} contentClassName={clsx(css.content)}
58
+ footer={<>
59
+ {discard !== undefined && <Button variant="outline" className={clsx(css.discard)} disabled={locked || confirming}
60
+ onClick={() => { setConfirming(true) }}>{t('review.discard')}</Button>}
61
+ <Button variant="outline" onClick={close}>{t('review.cancel')}</Button>
62
+ <Button variant="primary" disabled={locked || confirming || blocked || stale || empty || refused || state.error !== null} onClick={submit}>
63
+ {t(busy && !confirming ? 'review.submitting' : 'review.submit')}
64
+ </Button>
65
+ </>}>
66
+ <div className={css.form}>
67
+ <div className={css.count}>{t('review.drafts', { count })}</div>
68
+ {discard !== undefined && confirming && <div className={css.confirm} role="group" aria-label={t('review.discard')}>
69
+ <span className={css.confirmText}>{t('review.discardConfirm', { count })}</span>
70
+ <Button size="sm" variant="outline" disabled={busy} onClick={() => { setConfirming(false) }}>{t('review.cancel')}</Button>
71
+ <Button size="sm" variant="primary" disabled={busy} onClick={discard}>{t(busy ? 'review.discarding' : 'review.discard')}</Button>
72
+ </div>}
73
+ <div className={css.summary}>
74
+ <textarea data-modal-autofocus className={clsx(reviewCss.input, css.input)} rows={4} disabled={locked} value={state.body}
75
+ aria-label={t('review.summary')} placeholder={t('review.summary')} required={requiresSummary}
76
+ aria-describedby={requiresSummary ? summaryHint : undefined}
77
+ onChange={(event) => { queue.summarize(event.target.value, state.event) }} />
78
+ <div id={summaryHint} className={css.hint} role="status">{requiresSummary ? t('review.summaryRequired') : ''}</div>
79
+ </div>
80
+ <div className={css.decisions}>
81
+ {(['comment', 'approve', 'request-changes'] as const).map(value => <label key={value}>
82
+ <input type="radio" name={name} value={value} checked={state.event === value} disabled={locked || (own && value !== 'comment')}
83
+ onChange={() => { queue.summarize(state.body, value) }} />
84
+ {t(value === 'comment' ? 'review.commentOnly' : value === 'approve' ? 'review.approve' : 'review.requestChanges')}
85
+ </label>)}
86
+ </div>
87
+ {own && <div className={css.hint}>{t('review.ownChangeRequest')}</div>}
88
+ {notice !== null && <div className={css.error} role="alert">{notice}</div>}
89
+ {state.uncertain !== null && !busy && <div className={css.reconcile}>
90
+ <Button size="sm" variant="outline" onClick={check}>{t('review.recheck')}</Button>
91
+ <Button size="sm" variant="outline" onClick={reconcile}>{t('review.confirmRetry')}</Button>
92
+ </div>}
93
+ </div>
94
+ </Modal>
95
+ }
@@ -0,0 +1,218 @@
1
+ /* The thread list docks at the end of the changes body in a view at least 1040px wide, which leaves the code about
2
+ 480px beside the file tree and the list; it floats over the files with a scrim behind it in a narrower view, and
3
+ takes the files' whole width below 480px. The queries name no container, since CSS Modules rename a container name
4
+ per file; the nearest inline-size container is the changes view. */
5
+ .scrim { display: none; }
6
+
7
+ .pane {
8
+ display: flex;
9
+ flex: none;
10
+ flex-direction: column;
11
+ box-sizing: border-box;
12
+ width: 320px;
13
+ min-height: 0;
14
+ border-inline-start: 0.5px solid var(--dsw-alias-border-l3);
15
+ background: var(--forge-changes-bg, var(--dsw-alias-bg-base));
16
+ color: var(--dsw-alias-label-primary);
17
+ font: var(--dsw-font-xs-13);
18
+ font-family: Inter, var(--dsw-font-family);
19
+ }
20
+
21
+ .pane:focus { outline: none; }
22
+
23
+ .header {
24
+ display: flex;
25
+ align-items: center;
26
+ gap: 6px;
27
+ min-height: 40px;
28
+ padding: 0 6px 0 12px;
29
+ }
30
+
31
+ .title { font-weight: 500; }
32
+
33
+ /* Takes the place of the title and the close button where the list covers the files' whole width. */
34
+ .back {
35
+ display: none;
36
+ align-items: center;
37
+ gap: 2px;
38
+ height: 28px;
39
+ padding: 0 8px 0 4px;
40
+ border: 0;
41
+ border-radius: var(--dsw-radius-sm);
42
+ background: transparent;
43
+ color: var(--dsw-alias-label-primary);
44
+ font: inherit;
45
+ cursor: pointer;
46
+ }
47
+
48
+ @media (hover: hover) {
49
+ .back:hover { background: var(--dsw-alias-interactive-bg-hover); }
50
+ }
51
+
52
+ .total {
53
+ padding: 0 6px;
54
+ border-radius: var(--dsw-radius-xs);
55
+ background: var(--dsw-alias-card-fill);
56
+ color: var(--dsw-alias-label-secondary);
57
+ font-size: 11px;
58
+ line-height: 18px;
59
+ }
60
+
61
+ .spacer { flex: 1; }
62
+
63
+ .close {
64
+ display: inline-flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ width: 28px;
68
+ height: 28px;
69
+ padding: 0;
70
+ border: 0;
71
+ border-radius: var(--dsw-radius-sm);
72
+ background: transparent;
73
+ color: var(--dsw-alias-label-secondary);
74
+ cursor: pointer;
75
+ }
76
+
77
+ @media (hover: hover) {
78
+ .close:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
79
+ }
80
+
81
+ .filters {
82
+ padding: 0 12px 10px;
83
+ border-bottom: 0.5px solid var(--dsw-alias-border-l3);
84
+ }
85
+
86
+ .rows {
87
+ flex: 1;
88
+ min-height: 0;
89
+ overflow-y: auto;
90
+ padding: 4px 6px;
91
+ }
92
+
93
+ .group + .group { margin-top: 6px; }
94
+
95
+ .path {
96
+ margin: 0;
97
+ padding: 8px 6px 4px;
98
+ font: inherit;
99
+ font-size: 12px;
100
+ font-weight: 500;
101
+ }
102
+
103
+ .item {
104
+ display: flex;
105
+ gap: 8px;
106
+ box-sizing: border-box;
107
+ width: 100%;
108
+ padding: 8px 6px;
109
+ border: 0;
110
+ border-radius: var(--dsw-radius-md);
111
+ background: transparent;
112
+ color: inherit;
113
+ font: inherit;
114
+ text-align: start;
115
+ cursor: pointer;
116
+ }
117
+
118
+ @media (hover: hover) {
119
+ .item:hover { background: var(--dsw-alias-interactive-bg-hover); }
120
+ }
121
+
122
+ .item:focus-visible {
123
+ outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
124
+ outline-offset: -1px;
125
+ }
126
+
127
+ .itemMain {
128
+ display: flex;
129
+ flex: 1;
130
+ flex-direction: column;
131
+ gap: 2px;
132
+ min-width: 0;
133
+ }
134
+
135
+ .meta { color: var(--dsw-alias-label-tertiary); font-size: 12px; }
136
+
137
+ .excerpt {
138
+ display: -webkit-box;
139
+ overflow: hidden;
140
+ -webkit-box-orient: vertical;
141
+ -webkit-line-clamp: 2;
142
+ overflow-wrap: anywhere;
143
+ }
144
+
145
+ .tags {
146
+ display: flex;
147
+ flex-wrap: wrap;
148
+ gap: 4px;
149
+ }
150
+
151
+ .tags:empty { display: none; }
152
+
153
+ .note {
154
+ padding: 24px 12px;
155
+ color: var(--dsw-alias-label-secondary);
156
+ text-align: center;
157
+ }
158
+
159
+ .footer {
160
+ padding: 10px 12px;
161
+ border-top: 0.5px solid var(--dsw-alias-border-l3);
162
+ color: var(--dsw-alias-label-secondary);
163
+ font-size: 12px;
164
+ }
165
+
166
+ .link {
167
+ display: inline-flex;
168
+ align-items: center;
169
+ gap: 2px;
170
+ padding: 0;
171
+ border: 0;
172
+ background: transparent;
173
+ color: var(--dsw-alias-state-business-primary);
174
+ font: inherit;
175
+ cursor: pointer;
176
+ }
177
+
178
+ @media (hover: hover) {
179
+ .link:hover { text-decoration: underline; }
180
+ }
181
+
182
+ /* Above the sticky file headers (z-index 2). */
183
+ @container (max-width: 1039px) {
184
+ .scrim {
185
+ position: absolute;
186
+ z-index: 3;
187
+ inset: 0;
188
+ display: block;
189
+ background: var(--dsw-alias-bg-mask-1);
190
+ }
191
+
192
+ .pane {
193
+ position: absolute;
194
+ z-index: 3;
195
+ inset-block: 0;
196
+ inset-inline-end: 0;
197
+ width: min(340px, calc(100% - 40px));
198
+ box-shadow: var(--dsw-elevation-panel);
199
+ }
200
+ }
201
+
202
+ @container (max-width: 479px) {
203
+ .scrim { display: none; }
204
+
205
+ .pane {
206
+ width: 100%;
207
+ border-inline-start: 0;
208
+ box-shadow: none;
209
+ }
210
+
211
+ .header { padding-inline-start: 6px; }
212
+
213
+ .back { display: inline-flex; }
214
+
215
+ .title,
216
+ .total,
217
+ .close { display: none; }
218
+ }
@@ -0,0 +1,165 @@
1
+ /**
2
+ * The thread list of a change request beside its changes: every thread grouped by file in file tree order, narrowed
3
+ * by whether it is resolved, each opening the place it shows at. A wide changes view docks the list beside the files;
4
+ * a narrower one floats it over them, and the narrowest gives it their whole width.
5
+ */
6
+
7
+ import { useLayoutEffect, useMemo, useRef, type KeyboardEvent, type ReactNode } from 'react'
8
+ import { IconChevronLeftOutlineRegular, IconCloseOutlineRegular, IconRightUpOutlineRegular, Tag, Tooltip } from '@deepseek-ai/dsh-client-ui-primitives'
9
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
10
+ import type { ForgeReviewThread } from '@deepseek-ai/dsh-experimental-forge/types'
11
+ import type { ForgeDiffFile } from '../types.ts'
12
+ import { FileLabel } from './FileLabel.tsx'
13
+ import { SegmentedChoice } from './ReviewControls.tsx'
14
+ import { Avatar } from './ReviewThreads.tsx'
15
+ import { anchorRange, inFileOrder, passesFilter, THREAD_FILTERS, type ThreadFilter, type ThreadPlace } from './review-threads.ts'
16
+ import type { NS } from './locales.ts'
17
+ import type { PlacedThread } from './thread-state.ts'
18
+ import css from './ThreadList.module.css'
19
+
20
+ type Translate = PropsLocale<typeof NS>['t']
21
+
22
+ /** Props of the thread list. */
23
+ export interface ThreadListProps extends PropsLocale<typeof NS> {
24
+ /** Every thread read, in host order, with where the current changes show it. */
25
+ readonly entries: readonly PlacedThread[]
26
+ /** Changed files in file tree order; threads on other paths follow them. */
27
+ readonly files: readonly ForgeDiffFile[]
28
+ /** Whether the host has more threads than were read. */
29
+ readonly truncated: boolean
30
+ /** Web page of the change request. */
31
+ readonly url: string
32
+ /** The active filter. */
33
+ readonly filter: ThreadFilter
34
+ /** Choose a filter. */
35
+ readonly choose: (filter: ThreadFilter) => void
36
+ /** Whether the reader just opened the list, so a list that covers the files takes the focus. */
37
+ readonly claim: boolean
38
+ /** Report that the list handled `claim`. */
39
+ readonly claimed: () => void
40
+ /** Open the place of a thread; `covering` says the list covers the files, so the owner closes it first. */
41
+ readonly open: (entry: PlacedThread, covering: boolean) => void
42
+ /** Open a URL outside the app. */
43
+ readonly openLink: (url: string) => void
44
+ /** Close the list at the reader's request. */
45
+ readonly close: () => void
46
+ }
47
+
48
+ function meta(thread: ForgeReviewThread, place: ThreadPlace, t: Translate): string {
49
+ const replies = thread.comments.length - 1
50
+ const parts: string[] = []
51
+ if (thread.subject === 'file') parts.push(t('thread.fileLevel'))
52
+ else if (place.kind === 'line') parts.push(anchorRange(place.side, place))
53
+ else if (thread.original !== null) {
54
+ parts.push(t('thread.originally', { range: anchorRange(thread.side, thread.original) }), t('thread.onCommit', { commit: thread.original.commit.slice(0, 7) }))
55
+ }
56
+ if (replies > 0) parts.push(t('thread.replies', { count: replies }))
57
+ return parts.join(' · ')
58
+ }
59
+
60
+ /** Whether the list floats over the files or takes their width, which its narrow-view styles decide. */
61
+ function covers(pane: HTMLElement | null): pane is HTMLElement {
62
+ return pane !== null && getComputedStyle(pane).position === 'absolute'
63
+ }
64
+
65
+ /**
66
+ * The first comment as one line of plain text: without raw HTML, strong, strikethrough, and code marks, quote or
67
+ * heading marks, and link targets.
68
+ */
69
+ function plainExcerpt(body: string): string {
70
+ return body.replace(/<[^>]*>/g, ' ').replace(/!?\[([^\]]*)\]\([^)]*\)/g, '$1').replace(/^\s*(?:#{1,6}|>)\s*/gm, '')
71
+ .replace(/\*\*|__|~~|`/g, '').replace(/\s+/g, ' ').trim()
72
+ }
73
+
74
+ function Item({ entry, open, t }: {
75
+ readonly entry: PlacedThread
76
+ readonly open: (entry: PlacedThread) => void
77
+ readonly t: Translate
78
+ }): ReactNode {
79
+ const { thread, place } = entry
80
+ const first = thread.comments[0]
81
+ return <button type="button" className={css.item} data-forge-thread-item={thread.id} onClick={() => { open(entry) }}>
82
+ <Avatar author={first?.author ?? null} size={22} />
83
+ <span className={css.itemMain}>
84
+ <span className={css.meta}>{meta(thread, place, t)}</span>
85
+ <span className={css.excerpt}>{plainExcerpt(first?.body ?? '')}</span>
86
+ <span className={css.tags}>
87
+ {place.kind === 'outdated' && <Tag tone="warning">{t('thread.outdatedTag')}</Tag>}
88
+ {place.kind === 'elsewhere' && <Tag tone="neutral">{t('thread.elsewhereTag')}</Tag>}
89
+ {thread.resolved && <Tag tone="success">{t('thread.filter.resolved')}</Tag>}
90
+ {first?.author?.bot === true && <Tag tone="outline">{t('thread.bot')}</Tag>}
91
+ </span>
92
+ </span>
93
+ </button>
94
+ }
95
+
96
+ /**
97
+ * Render the thread list.
98
+ * @param props - threads, their places, the file order, the filter, and the list's actions.
99
+ * @returns the list pane and the scrim behind it where it floats over the files.
100
+ */
101
+ export function ThreadList(props: ThreadListProps): ReactNode {
102
+ const { entries, files, filter, t } = props
103
+ const threads = useMemo(() => entries.map(entry => entry.thread), [entries])
104
+ const counts = useMemo(() => Object.fromEntries(THREAD_FILTERS.map(item => [item,
105
+ threads.filter(thread => passesFilter(thread, item)).length])) as Record<ThreadFilter, number>, [threads])
106
+ const groups = useMemo(() => {
107
+ const known = new Map(files.map((file, index) => [file.path, { file, index }]))
108
+ const byPath = new Map<string, PlacedThread[]>()
109
+ for (const entry of entries) {
110
+ if (!passesFilter(entry.thread, filter)) continue
111
+ const list = byPath.get(entry.thread.path)
112
+ if (list === undefined) byPath.set(entry.thread.path, [entry])
113
+ else list.push(entry)
114
+ }
115
+ const position = (path: string): number => known.get(path)?.index ?? files.length
116
+ return [...byPath].sort(([a], [b]) => position(a) - position(b) || a.localeCompare(b))
117
+ .map(([path, list]) => [path, inFileOrder(list, known.get(path)?.file)] as const)
118
+ }, [entries, files, filter])
119
+ const pane = useRef<HTMLElement>(null)
120
+ useLayoutEffect(() => {
121
+ if (!props.claim) return
122
+ props.claimed()
123
+ if (covers(pane.current)) pane.current.focus({ preventScroll: true })
124
+ }, [props.claim])
125
+ const escape = (event: KeyboardEvent<HTMLElement>): void => {
126
+ if (event.key !== 'Escape') return
127
+ event.preventDefault()
128
+ event.stopPropagation()
129
+ props.close()
130
+ }
131
+ const open = (entry: PlacedThread): void => { props.open(entry, covers(pane.current)) }
132
+ return <>
133
+ <div className={css.scrim} aria-hidden="true" onClick={props.close} />
134
+ <aside ref={pane} className={css.pane} tabIndex={-1} aria-label={t('thread.listAria', { count: threads.length })} data-forge-thread-list=""
135
+ onKeyDown={escape}>
136
+ <div className={css.header}>
137
+ <button type="button" className={css.back} onClick={props.close}><IconChevronLeftOutlineRegular size={14} />{t('thread.back')}</button>
138
+ <span className={css.title}>{t('thread.list')}</span>
139
+ <span className={css.total}>{threads.length}</span>
140
+ <span className={css.spacer} />
141
+ <Tooltip label={t('thread.close')} side="bottom">
142
+ <button type="button" className={css.close} aria-label={t('thread.close')} onClick={props.close}><IconCloseOutlineRegular size={14} /></button>
143
+ </Tooltip>
144
+ </div>
145
+ <div className={css.filters}>
146
+ <SegmentedChoice label={t('thread.filterAria')} value={filter} choose={props.choose}
147
+ segments={THREAD_FILTERS.map(item => ({ value: item, label: t(`thread.filter.${item}`), count: counts[item], disabledTip: null }))} />
148
+ </div>
149
+ <div className={css.rows}>
150
+ {threads.length === 0 ? <div className={css.note}>{t('thread.empty')}</div>
151
+ : groups.length === 0 ? <div className={css.note}>{t('thread.none')}</div>
152
+ : groups.map(([path, list]) => <section key={path} className={css.group} data-forge-thread-group={path}>
153
+ <h3 className={css.path}><FileLabel path={path} /></h3>
154
+ {list.map(entry => <Item key={entry.thread.id} entry={entry} open={open} t={t} />)}
155
+ </section>)}
156
+ </div>
157
+ <div className={css.footer}>
158
+ {props.truncated && <>{t('thread.truncated', { count: threads.length })}{' · '}</>}
159
+ <button type="button" className={css.link} onClick={() => { props.openLink(props.url) }}>
160
+ <IconRightUpOutlineRegular size={14} />{t('thread.openAll')}
161
+ </button>
162
+ </div>
163
+ </aside>
164
+ </>
165
+ }
@@ -0,0 +1,79 @@
1
+ /** The changes toolbar's More menu, which holds the view controls a narrow toolbar folds out of its row. */
2
+
3
+ import { useState, type ReactNode } from 'react'
4
+ import clsx from 'clsx'
5
+ import { IconEllipsisOutlineRegular, Menu, Tooltip, type MenuEntry } from '@deepseek-ai/dsh-client-ui-primitives'
6
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
7
+ import type { NS } from './locales.ts'
8
+ import { foldOf } from './toolbar-fold.ts'
9
+ import css from './ChangesTab.module.css'
10
+
11
+ /** Toolbar state and actions the menu repeats. */
12
+ export interface ViewOptions {
13
+ /** Whether any shown file is expanded, so the expansion row collapses them all. */
14
+ readonly anyExpanded: boolean
15
+ /** Whether any file shows, so the expansion row has files to change. */
16
+ readonly hasFiles: boolean
17
+ readonly toggleExpansion: () => void
18
+ readonly split: boolean
19
+ readonly toggleSplit: () => void
20
+ readonly wrap: boolean
21
+ readonly toggleWrap: () => void
22
+ /** Whether test files hide, or undefined when the toolbar offers no test switch. */
23
+ readonly hideTests: boolean | undefined
24
+ readonly toggleTests: () => void
25
+ readonly refresh: () => void
26
+ }
27
+
28
+ /**
29
+ * Render the More button and its menu, which lists the controls of the toolbar's fold level when it opens (see
30
+ * `observeToolbarFold`); the toolbar's styles hide the button while nothing folds.
31
+ * @param props - the toolbar state and actions, whether the owning tab is visible, and copy.
32
+ * @returns the button and its portalled menu.
33
+ */
34
+ export function ViewOptionsMenu({ options, visible, t }: PropsLocale<typeof NS> & {
35
+ readonly options: ViewOptions
36
+ readonly visible: boolean
37
+ }): ReactNode {
38
+ const [fold, setFold] = useState<number | null>(null)
39
+ const open = visible && fold !== null
40
+ const entries: MenuEntry[] = []
41
+ if (fold !== null) {
42
+ entries.push(
43
+ { id: 'expansion', label: t(options.anyExpanded ? 'diff.collapseAll' : 'diff.expandAll'), disabled: !options.hasFiles },
44
+ { id: 'split', label: t('diff.splitAria') },
45
+ { id: 'wrap', label: t('diff.wrapAria') },
46
+ )
47
+ if (fold >= 2 && options.hideTests !== undefined) entries.push({ type: 'separator', id: 'tests-separator' }, { id: 'tests', label: t('tests.hide') })
48
+ if (fold >= 3) entries.push({ type: 'separator', id: 'refresh-separator' }, { id: 'refresh', label: t('diff.refresh') })
49
+ }
50
+ const selected = [options.split && 'split', options.wrap && 'wrap', options.hideTests === true && 'tests'].filter(item => item !== false)
51
+ const run = (id: string): void => {
52
+ switch (id) {
53
+ case 'expansion': options.toggleExpansion(); break
54
+ case 'split': options.toggleSplit(); break
55
+ case 'wrap': options.toggleWrap(); break
56
+ case 'tests': options.toggleTests(); break
57
+ case 'refresh': options.refresh(); break
58
+ /* v8 ignore next -- the menu offers only the rows above */
59
+ default: break
60
+ }
61
+ }
62
+ return (
63
+ <Menu open={open} portal dense align="end" autoFocus items={entries} selectedIds={selected}
64
+ onClose={() => { setFold(null) }}
65
+ onSelect={(id) => {
66
+ setFold(null)
67
+ run(id)
68
+ }}
69
+ anchor={(
70
+ <Tooltip label={t('diff.moreOptions')} side="bottom">
71
+ <button type="button" className={clsx(css.tool, css.more)} aria-label={t('diff.moreOptions')}
72
+ aria-haspopup="menu" aria-expanded={open} data-forge-view-options=""
73
+ onClick={(event) => { setFold(fold === null ? foldOf(event.currentTarget) : null) }}>
74
+ <IconEllipsisOutlineRegular />
75
+ </button>
76
+ </Tooltip>
77
+ )} />
78
+ )
79
+ }