@deepseek-ai/dsh-experimental-client-ui-forge 0.2.2-rc.5 → 0.2.3-alpha.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 (334) hide show
  1. package/README.i18n.yaml +12 -12
  2. package/README.md +47 -30
  3. package/README.zh.md +47 -30
  4. package/lib/client.js +18 -8
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +2444 -406
  7. package/lib/typert.host.js +3433 -950
  8. package/lib/typert.remote-client.d.ts +89 -14
  9. package/lib/typert.remote-client.d.ts.map +1 -1
  10. package/lib/typert.remote-client.js +3155 -978
  11. package/lib/types/branch-name.d.ts +30 -0
  12. package/lib/types/branch-name.d.ts.map +1 -0
  13. package/lib/types/branch-name.js.map +1 -0
  14. package/lib/types/client/AttentionIndicator.d.ts +22 -0
  15. package/lib/types/client/AttentionIndicator.d.ts.map +1 -0
  16. package/lib/types/client/AttentionIndicator.js.map +1 -0
  17. package/lib/types/client/BaseMenu.d.ts.map +1 -1
  18. package/lib/types/client/BaseMenu.js.map +1 -1
  19. package/lib/types/client/ChangeRequestCard.d.ts +87 -9
  20. package/lib/types/client/ChangeRequestCard.d.ts.map +1 -1
  21. package/lib/types/client/ChangeRequestCard.js.map +1 -1
  22. package/lib/types/client/ChangeRequestOverview.d.ts +126 -10
  23. package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -1
  24. package/lib/types/client/ChangeRequestOverview.js.map +1 -1
  25. package/lib/types/client/ChangeRequestsSection.d.ts +76 -0
  26. package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -0
  27. package/lib/types/client/ChangeRequestsSection.js.map +1 -0
  28. package/lib/types/client/ChangedFiles.d.ts +6 -2
  29. package/lib/types/client/ChangedFiles.d.ts.map +1 -1
  30. package/lib/types/client/ChangedFiles.js.map +1 -1
  31. package/lib/types/client/ChangesLoading.d.ts +14 -0
  32. package/lib/types/client/ChangesLoading.d.ts.map +1 -0
  33. package/lib/types/client/ChangesLoading.js.map +1 -0
  34. package/lib/types/client/ChangesTab.d.ts +62 -14
  35. package/lib/types/client/ChangesTab.d.ts.map +1 -1
  36. package/lib/types/client/ChangesTab.js.map +1 -1
  37. package/lib/types/client/ChangesTabTitle.js.map +1 -1
  38. package/lib/types/client/DiffFile.d.ts +23 -4
  39. package/lib/types/client/DiffFile.d.ts.map +1 -1
  40. package/lib/types/client/DiffFile.js.map +1 -1
  41. package/lib/types/client/EnvironmentRows.d.ts +79 -0
  42. package/lib/types/client/EnvironmentRows.d.ts.map +1 -0
  43. package/lib/types/client/EnvironmentRows.js.map +1 -0
  44. package/lib/types/client/FileTreePane.d.ts +5 -2
  45. package/lib/types/client/FileTreePane.d.ts.map +1 -1
  46. package/lib/types/client/FileTreePane.js.map +1 -1
  47. package/lib/types/client/LensFilter.d.ts +50 -0
  48. package/lib/types/client/LensFilter.d.ts.map +1 -0
  49. package/lib/types/client/LensFilter.js.map +1 -0
  50. package/lib/types/client/ReasonButton.d.ts +15 -0
  51. package/lib/types/client/ReasonButton.d.ts.map +1 -0
  52. package/lib/types/client/ReasonButton.js.map +1 -0
  53. package/lib/types/client/ReviewComposer.d.ts +11 -4
  54. package/lib/types/client/ReviewComposer.d.ts.map +1 -1
  55. package/lib/types/client/ReviewComposer.js.map +1 -1
  56. package/lib/types/client/ReviewControls.d.ts +18 -7
  57. package/lib/types/client/ReviewControls.d.ts.map +1 -1
  58. package/lib/types/client/ReviewControls.js.map +1 -1
  59. package/lib/types/client/ReviewThread.d.ts +3 -1
  60. package/lib/types/client/ReviewThread.d.ts.map +1 -1
  61. package/lib/types/client/ReviewThread.js.map +1 -1
  62. package/lib/types/client/ReviewThreads.d.ts +32 -2
  63. package/lib/types/client/ReviewThreads.d.ts.map +1 -1
  64. package/lib/types/client/ReviewThreads.js.map +1 -1
  65. package/lib/types/client/SessionHoverForge.d.ts.map +1 -1
  66. package/lib/types/client/SessionHoverForge.js.map +1 -1
  67. package/lib/types/client/SubmitReview.d.ts +4 -4
  68. package/lib/types/client/SubmitReview.d.ts.map +1 -1
  69. package/lib/types/client/SubmitReview.js.map +1 -1
  70. package/lib/types/client/ThreadList.js.map +1 -1
  71. package/lib/types/client/ViewOptionsMenu.d.ts +7 -1
  72. package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -1
  73. package/lib/types/client/ViewOptionsMenu.js.map +1 -1
  74. package/lib/types/client/WorktreeNameDialog.d.ts +38 -0
  75. package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -0
  76. package/lib/types/client/WorktreeNameDialog.js.map +1 -0
  77. package/lib/types/client/WorktreeProgress.d.ts +14 -3
  78. package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
  79. package/lib/types/client/WorktreeProgress.js.map +1 -1
  80. package/lib/types/client/WorktreeToggle.d.ts +22 -15
  81. package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
  82. package/lib/types/client/WorktreeToggle.js.map +1 -1
  83. package/lib/types/client/action-notices.d.ts +25 -0
  84. package/lib/types/client/action-notices.d.ts.map +1 -0
  85. package/lib/types/client/action-notices.js.map +1 -0
  86. package/lib/types/client/annotations.d.ts +41 -0
  87. package/lib/types/client/annotations.d.ts.map +1 -0
  88. package/lib/types/client/annotations.js.map +1 -0
  89. package/lib/types/client/branch-search.d.ts +38 -0
  90. package/lib/types/client/branch-search.d.ts.map +1 -0
  91. package/lib/types/client/branch-search.js.map +1 -0
  92. package/lib/types/client/change-requests-store.d.ts +25 -0
  93. package/lib/types/client/change-requests-store.d.ts.map +1 -0
  94. package/lib/types/client/change-requests-store.js.map +1 -0
  95. package/lib/types/client/changes-address.d.ts +3 -1
  96. package/lib/types/client/changes-address.d.ts.map +1 -1
  97. package/lib/types/client/changes-address.js.map +1 -1
  98. package/lib/types/client/changes-service.d.ts +119 -0
  99. package/lib/types/client/changes-service.d.ts.map +1 -0
  100. package/lib/types/client/changes-service.js.map +1 -0
  101. package/lib/types/client/changes-store.d.ts +6 -2
  102. package/lib/types/client/changes-store.d.ts.map +1 -1
  103. package/lib/types/client/changes-store.js.map +1 -1
  104. package/lib/types/client/checkout.d.ts.map +1 -1
  105. package/lib/types/client/checkout.js.map +1 -1
  106. package/lib/types/client/diff-rows.d.ts +49 -7
  107. package/lib/types/client/diff-rows.d.ts.map +1 -1
  108. package/lib/types/client/diff-rows.js.map +1 -1
  109. package/lib/types/client/file-tree.d.ts +7 -0
  110. package/lib/types/client/file-tree.d.ts.map +1 -1
  111. package/lib/types/client/file-tree.js.map +1 -1
  112. package/lib/types/client/forge-copy.d.ts +29 -0
  113. package/lib/types/client/forge-copy.d.ts.map +1 -0
  114. package/lib/types/client/forge-copy.js.map +1 -0
  115. package/lib/types/client/format.d.ts +8 -0
  116. package/lib/types/client/format.d.ts.map +1 -1
  117. package/lib/types/client/format.js.map +1 -1
  118. package/lib/types/client/glyphs.d.ts +3 -3
  119. package/lib/types/client/glyphs.d.ts.map +1 -1
  120. package/lib/types/client/glyphs.js.map +1 -1
  121. package/lib/types/client/highlight-context.d.ts +73 -0
  122. package/lib/types/client/highlight-context.d.ts.map +1 -0
  123. package/lib/types/client/highlight-context.js.map +1 -0
  124. package/lib/types/client/index.d.ts +9 -5
  125. package/lib/types/client/index.d.ts.map +1 -1
  126. package/lib/types/client/index.js.map +1 -1
  127. package/lib/types/client/lens-filter.d.ts +69 -0
  128. package/lib/types/client/lens-filter.d.ts.map +1 -0
  129. package/lib/types/client/lens-filter.js.map +1 -0
  130. package/lib/types/client/locales.d.ts +188 -36
  131. package/lib/types/client/locales.d.ts.map +1 -1
  132. package/lib/types/client/locales.js.map +1 -1
  133. package/lib/types/client/mount.d.ts +0 -4
  134. package/lib/types/client/mount.d.ts.map +1 -1
  135. package/lib/types/client/mount.js.map +1 -1
  136. package/lib/types/client/review-page/ReviewChat.d.ts +112 -0
  137. package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -0
  138. package/lib/types/client/review-page/ReviewChat.js.map +1 -0
  139. package/lib/types/client/review-page/ReviewDetail.d.ts +56 -0
  140. package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -0
  141. package/lib/types/client/review-page/ReviewDetail.js.map +1 -0
  142. package/lib/types/client/review-page/ReviewLabels.d.ts +32 -0
  143. package/lib/types/client/review-page/ReviewLabels.d.ts.map +1 -0
  144. package/lib/types/client/review-page/ReviewLabels.js.map +1 -0
  145. package/lib/types/client/review-page/ReviewList.d.ts +68 -0
  146. package/lib/types/client/review-page/ReviewList.d.ts.map +1 -0
  147. package/lib/types/client/review-page/ReviewList.js.map +1 -0
  148. package/lib/types/client/review-page/ReviewNav.d.ts +28 -0
  149. package/lib/types/client/review-page/ReviewNav.d.ts.map +1 -0
  150. package/lib/types/client/review-page/ReviewNav.js.map +1 -0
  151. package/lib/types/client/review-page/ReviewPage.d.ts +61 -0
  152. package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -0
  153. package/lib/types/client/review-page/ReviewPage.js.map +1 -0
  154. package/lib/types/client/review-page/ReviewStatus.d.ts +37 -0
  155. package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -0
  156. package/lib/types/client/review-page/ReviewStatus.js.map +1 -0
  157. package/lib/types/client/review-page/host-stream.d.ts +24 -0
  158. package/lib/types/client/review-page/host-stream.d.ts.map +1 -0
  159. package/lib/types/client/review-page/host-stream.js.map +1 -0
  160. package/lib/types/client/review-page/review-lists.d.ts +116 -0
  161. package/lib/types/client/review-page/review-lists.d.ts.map +1 -0
  162. package/lib/types/client/review-page/review-lists.js.map +1 -0
  163. package/lib/types/client/review-page/review-mount.d.ts +50 -0
  164. package/lib/types/client/review-page/review-mount.d.ts.map +1 -0
  165. package/lib/types/client/review-page/review-mount.js.map +1 -0
  166. package/lib/types/client/review-page/review-store.d.ts +79 -0
  167. package/lib/types/client/review-page/review-store.d.ts.map +1 -0
  168. package/lib/types/client/review-page/review-store.js.map +1 -0
  169. package/lib/types/client/review-queue.d.ts +19 -0
  170. package/lib/types/client/review-queue.d.ts.map +1 -1
  171. package/lib/types/client/review-queue.js.map +1 -1
  172. package/lib/types/client/review-threads.d.ts +0 -8
  173. package/lib/types/client/review-threads.d.ts.map +1 -1
  174. package/lib/types/client/review-threads.js.map +1 -1
  175. package/lib/types/client/review.d.ts +18 -0
  176. package/lib/types/client/review.d.ts.map +1 -1
  177. package/lib/types/client/review.js.map +1 -1
  178. package/lib/types/client/slots.d.ts +114 -0
  179. package/lib/types/client/slots.d.ts.map +1 -0
  180. package/lib/types/client/slots.js.map +1 -0
  181. package/lib/types/client/source.d.ts +29 -23
  182. package/lib/types/client/source.d.ts.map +1 -1
  183. package/lib/types/client/source.js.map +1 -1
  184. package/lib/types/client/status.d.ts +13 -2
  185. package/lib/types/client/status.d.ts.map +1 -1
  186. package/lib/types/client/status.js.map +1 -1
  187. package/lib/types/git.d.ts +4 -15
  188. package/lib/types/git.d.ts.map +1 -1
  189. package/lib/types/git.js.map +1 -1
  190. package/lib/types/index.d.ts +346 -28
  191. package/lib/types/index.d.ts.map +1 -1
  192. package/lib/types/index.js.map +1 -1
  193. package/lib/types/lens-version.d.ts +14 -0
  194. package/lib/types/lens-version.d.ts.map +1 -0
  195. package/lib/types/lens-version.js.map +1 -0
  196. package/lib/types/lenses.d.ts +122 -0
  197. package/lib/types/lenses.d.ts.map +1 -0
  198. package/lib/types/lenses.js.map +1 -0
  199. package/lib/types/local-diff.d.ts +16 -0
  200. package/lib/types/local-diff.d.ts.map +1 -1
  201. package/lib/types/local-diff.js.map +1 -1
  202. package/lib/types/panel.d.ts +59 -8
  203. package/lib/types/panel.d.ts.map +1 -1
  204. package/lib/types/panel.js.map +1 -1
  205. package/lib/types/parse.d.ts +24 -8
  206. package/lib/types/parse.d.ts.map +1 -1
  207. package/lib/types/parse.js.map +1 -1
  208. package/lib/types/review-cache.d.ts +29 -19
  209. package/lib/types/review-cache.d.ts.map +1 -1
  210. package/lib/types/review-cache.js.map +1 -1
  211. package/lib/types/states.d.ts +11 -7
  212. package/lib/types/states.d.ts.map +1 -1
  213. package/lib/types/states.js.map +1 -1
  214. package/lib/types/types.d.ts +266 -20
  215. package/lib/types/types.d.ts.map +1 -1
  216. package/lib/types/viewer-lists.d.ts +113 -0
  217. package/lib/types/viewer-lists.d.ts.map +1 -0
  218. package/lib/types/viewer-lists.js.map +1 -0
  219. package/lib/types/worktree.d.ts +20 -11
  220. package/lib/types/worktree.d.ts.map +1 -1
  221. package/lib/types/worktree.js.map +1 -1
  222. package/locale/de.json +1 -1
  223. package/locale/en.json +1 -1
  224. package/locale/es.json +1 -1
  225. package/locale/fr.json +1 -1
  226. package/locale/ja.json +1 -1
  227. package/locale/pt.json +1 -1
  228. package/locale/ru.json +1 -1
  229. package/locale/zh.json +1 -1
  230. package/package.json +61 -52
  231. package/src/branch-name.ts +74 -0
  232. package/src/client/AttentionIndicator.tsx +37 -0
  233. package/src/client/BaseMenu.module.css +0 -20
  234. package/src/client/BaseMenu.tsx +9 -52
  235. package/src/client/ChangeRequestCard.tsx +276 -131
  236. package/src/client/ChangeRequestOverview.module.css +1 -1
  237. package/src/client/ChangeRequestOverview.tsx +183 -67
  238. package/src/client/ChangeRequestsSection.tsx +234 -0
  239. package/src/client/ChangedFiles.module.css +5 -1
  240. package/src/client/ChangedFiles.tsx +72 -36
  241. package/src/client/ChangesLoading.module.css +110 -0
  242. package/src/client/ChangesLoading.tsx +69 -0
  243. package/src/client/ChangesTab.module.css +83 -114
  244. package/src/client/ChangesTab.tsx +331 -100
  245. package/src/client/ChangesTabTitle.tsx +3 -3
  246. package/src/client/DiffFile.tsx +241 -45
  247. package/src/client/EnvironmentRows.tsx +263 -0
  248. package/src/client/FileLabel.tsx +1 -1
  249. package/src/client/FileTreePane.tsx +11 -6
  250. package/src/client/{ForgeTab.module.css → Forge.module.css} +130 -275
  251. package/src/client/LensFilter.module.css +87 -0
  252. package/src/client/LensFilter.tsx +105 -0
  253. package/src/client/ReasonButton.tsx +23 -0
  254. package/src/client/ReviewComposer.module.css +2 -8
  255. package/src/client/ReviewComposer.tsx +27 -8
  256. package/src/client/ReviewControls.module.css +39 -0
  257. package/src/client/ReviewControls.tsx +71 -15
  258. package/src/client/ReviewThread.tsx +55 -30
  259. package/src/client/ReviewThreads.module.css +24 -0
  260. package/src/client/ReviewThreads.tsx +56 -21
  261. package/src/client/SessionHoverForge.tsx +2 -1
  262. package/src/client/SubmitReview.tsx +11 -8
  263. package/src/client/ThreadList.tsx +1 -1
  264. package/src/client/ViewOptionsMenu.tsx +19 -4
  265. package/src/client/WorktreeNameDialog.module.css +53 -0
  266. package/src/client/WorktreeNameDialog.tsx +93 -0
  267. package/src/client/WorktreeProgress.tsx +100 -35
  268. package/src/client/WorktreeToggle.module.css +121 -5
  269. package/src/client/WorktreeToggle.tsx +178 -61
  270. package/src/client/action-notices.ts +38 -0
  271. package/src/client/annotations.ts +105 -0
  272. package/src/client/branch-search.tsx +77 -0
  273. package/src/client/change-requests-store.ts +50 -0
  274. package/src/client/changes-address.ts +3 -1
  275. package/src/client/changes-service.ts +173 -0
  276. package/src/client/changes-store.ts +103 -91
  277. package/src/client/checkout.ts +2 -1
  278. package/src/client/diff-rows.ts +100 -16
  279. package/src/client/file-tree.ts +29 -0
  280. package/src/client/forge-copy.ts +49 -0
  281. package/src/client/format.ts +14 -0
  282. package/src/client/glyphs.tsx +12 -13
  283. package/src/client/highlight-context.ts +213 -0
  284. package/src/client/index.ts +20 -5
  285. package/src/client/lens-filter.ts +136 -0
  286. package/src/client/locales.ts +1504 -288
  287. package/src/client/mount.ts +228 -109
  288. package/src/client/review-page/ReviewChat.tsx +311 -0
  289. package/src/client/review-page/ReviewDetail.tsx +331 -0
  290. package/src/client/review-page/ReviewLabels.tsx +94 -0
  291. package/src/client/review-page/ReviewList.tsx +461 -0
  292. package/src/client/review-page/ReviewNav.tsx +47 -0
  293. package/src/client/review-page/ReviewPage.module.css +946 -0
  294. package/src/client/review-page/ReviewPage.tsx +287 -0
  295. package/src/client/review-page/ReviewStatus.tsx +259 -0
  296. package/src/client/review-page/host-stream.ts +63 -0
  297. package/src/client/review-page/review-lists.ts +207 -0
  298. package/src/client/review-page/review-mount.ts +228 -0
  299. package/src/client/review-page/review-store.ts +94 -0
  300. package/src/client/review-queue.ts +30 -0
  301. package/src/client/review-threads.ts +0 -12
  302. package/src/client/review.ts +27 -0
  303. package/src/client/slots.ts +92 -0
  304. package/src/client/source.ts +67 -43
  305. package/src/client/status.ts +16 -4
  306. package/src/git.ts +16 -38
  307. package/src/index.ts +900 -152
  308. package/src/lens-version.ts +27 -0
  309. package/src/lenses.ts +284 -0
  310. package/src/local-diff.ts +48 -1
  311. package/src/panel.ts +123 -28
  312. package/src/parse.ts +86 -10
  313. package/src/review-cache.ts +57 -37
  314. package/src/states.ts +38 -18
  315. package/src/types.ts +267 -21
  316. package/src/viewer-lists.ts +375 -0
  317. package/src/worktree.ts +64 -34
  318. package/lib/types/client/ForgeTab.d.ts +0 -65
  319. package/lib/types/client/ForgeTab.d.ts.map +0 -1
  320. package/lib/types/client/ForgeTab.js.map +0 -1
  321. package/lib/types/client/ForgeTabTitle.d.ts +0 -11
  322. package/lib/types/client/ForgeTabTitle.d.ts.map +0 -1
  323. package/lib/types/client/ForgeTabTitle.js.map +0 -1
  324. package/lib/types/client/HeaderButton.d.ts +0 -27
  325. package/lib/types/client/HeaderButton.d.ts.map +0 -1
  326. package/lib/types/client/HeaderButton.js.map +0 -1
  327. package/lib/types/client/LocalChangesCard.d.ts +0 -29
  328. package/lib/types/client/LocalChangesCard.d.ts.map +0 -1
  329. package/lib/types/client/LocalChangesCard.js.map +0 -1
  330. package/src/client/ForgeTab.tsx +0 -263
  331. package/src/client/ForgeTabTitle.tsx +0 -21
  332. package/src/client/HeaderButton.module.css +0 -29
  333. package/src/client/HeaderButton.tsx +0 -68
  334. package/src/client/LocalChangesCard.tsx +0 -83
@@ -1,17 +1,22 @@
1
1
  /**
2
- * One change request as a card: its title links to the host, a one-line
3
- * summary shows while collapsed, and while expanded one sentence per fact
4
- * (checks, review, merge state, the changed lines, which open its changes, and
5
- * the linked issues) above the ready-for-review or merge action.
2
+ * One change request as a compact card of the Session panel: one line with
3
+ * the state glyph, the title, the number, and the checks outcome, which opens
4
+ * the changes view, and, while expanded, one row per fact (checks, review,
5
+ * merge state, the changed lines, which open its changes too, and the linked
6
+ * issues) above the merge action. Opening on the host, copying, viewing
7
+ * changes, marking a draft ready, and removing live in the card's actions
8
+ * menu, which shows on hover or focus as on the panel's other rows.
6
9
  */
7
10
 
8
- import { useId, useState, type ReactNode } from 'react'
11
+ import { useId, useState, type MouseEvent, type ReactNode } from 'react'
9
12
  import clsx from 'clsx'
10
13
  import {
11
- Button, IconChevronDownOutlineRegular, IconCloseOutlineRegular, IconCopyOutlineRegular, IconListPenOutlineRegular,
12
- IconRightUpOutlineRegular, IconTriangleRightFillRegular, Menu, MenuItemButton, StateDot, Tooltip,
13
- type MenuEntry,
14
+ Button, HoverCard, IconCheckCircleOutlineRegular, IconChevronDownOutlineRegular, IconCloseOutlineRegular, IconCopyOutlineRegular,
15
+ IconEllipsisOutlineRegular, IconFilesDiffOutlineRegular, IconRightUpOutlineRegular, IconTriangleRightFillRegular, Menu,
16
+ MenuItemButton, StateDot, Tooltip,
17
+ type MenuEntry, type MenuItem, type StateDotState,
14
18
  } from '@deepseek-ai/dsh-client-ui-primitives'
19
+ import type { PanelDetailsProps } from '@deepseek-ai/dsh-client-ui-session-panel/client'
15
20
  import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
16
21
  import type {
17
22
  ChangeRequestSnapshot, CheckState, ChecksRollup, ForgeFailure, MergeMethod, MergeRequest,
@@ -21,8 +26,9 @@ import { ChecksRow, IssuesRow, MergeRow, ReviewRow, RowParts, ThreadGlyph, type
21
26
  import { formatAgo } from './format.ts'
22
27
  import { ChangeRequestGlyph, CheckGlyph } from './glyphs.tsx'
23
28
  import type { ForgePanelKey, NS } from './locales.ts'
24
- import { ciSummary, flagOf, numberOf, TONE_LABEL, toneOf } from './status.ts'
25
- import css from './ForgeTab.module.css'
29
+ import type { ForgeChangeRequestCardActionsProps } from './slots.ts'
30
+ import { ciSummary, flagOf, numberOf, TONE_LABEL, toneOf, type ChangeRequestEntry, type ChangeRequestTone } from './status.ts'
31
+ import css from './Forge.module.css'
26
32
 
27
33
  type Translate = PropsLocale<typeof NS>['t']
28
34
 
@@ -38,15 +44,21 @@ export interface ChangeRequestActions extends OverviewActions {
38
44
  /** Read the status again after a failed read. */
39
45
  readonly retry: () => void
40
46
  /** Remove the change request from its Session. */
41
- readonly remove?: ((entry: ForgePanelChangeRequest) => void) | undefined
47
+ readonly remove?: ((entry: ChangeRequestEntry) => void) | undefined
42
48
  /** Mark a draft ready for review; settles once the outcome is reported. */
43
- readonly markReady?: ((entry: ForgePanelChangeRequest) => Promise<void>) | undefined
49
+ readonly markReady?: ((entry: ChangeRequestEntry) => Promise<void>) | undefined
44
50
  /** Merge the change request as `request` describes; settles once the outcome is reported. */
45
- readonly merge?: ((entry: ForgePanelChangeRequest, request: MergeRequest) => Promise<void>) | undefined
51
+ readonly merge?: ((entry: ChangeRequestEntry, request: MergeRequest) => Promise<void>) | undefined
46
52
  /** Load complete check details independently of polling; cancellation follows the open list. */
47
53
  readonly readChecks?: ((url: string, headSha: string, signal: AbortSignal) => Promise<ChangeRequestSnapshot>) | undefined
48
54
  /** Open the changes view of the change request. */
49
- readonly viewChanges?: ((entry: ForgePanelChangeRequest) => void) | undefined
55
+ readonly viewChanges?: ((entry: ChangeRequestEntry) => void) | undefined
56
+ /** Draw the icon buttons plugins add to the card's head through `forge.change-request.card.actions`. */
57
+ readonly renderActions?: ((owner: ForgeChangeRequestCardActionsProps) => ReactNode) | undefined
58
+ /**
59
+ * Draw the content of the card's hover card, as the Session panel's rows do. A surface without it shows none.
60
+ */
61
+ readonly renderDetails?: ((details: PanelDetailsProps) => ReactNode) | undefined
50
62
  }
51
63
 
52
64
  /** Props of one change request card. */
@@ -77,6 +89,7 @@ const REVIEW: Record<ChangeRequestSnapshot['reviewDecision'], ForgePanelKey> = {
77
89
  const FAILURE: Record<ForgeFailure['code'], ForgePanelKey> = {
78
90
  'not-found': 'change.failure.notFound',
79
91
  'unauthenticated': 'change.failure.unauthenticated',
92
+ 'rate-limited': 'change.failure.rateLimited',
80
93
  'too-large': 'change.failure.unavailable',
81
94
  'stale': 'change.failure.unavailable',
82
95
  'unsupported': 'change.failure.unavailable',
@@ -110,11 +123,13 @@ function DiffSize({ snapshot, locale }: { readonly snapshot: ChangeRequestSnapsh
110
123
  }
111
124
 
112
125
  /**
113
- * The changed lines with the unresolved review thread count, as a row that opens the changes view when the provider
114
- * serves the change request.
126
+ * Render the changed lines with the unresolved review thread count, as a row that opens the changes view when the
127
+ * provider serves the change request.
128
+ * @param props - the change request, its snapshot, how the row names it, the actions, the number locale, and copy.
129
+ * @returns the row.
115
130
  */
116
- function ChangesRow({ entry, snapshot, name, actions, locale, t }: {
117
- readonly entry: ForgePanelChangeRequest
131
+ export function ChangesRow({ entry, snapshot, name, actions, locale, t }: {
132
+ readonly entry: ChangeRequestEntry
118
133
  readonly snapshot: ChangeRequestSnapshot
119
134
  readonly name: string
120
135
  readonly actions: ChangeRequestActions
@@ -126,7 +141,7 @@ function ChangesRow({ entry, snapshot, name, actions, locale, t }: {
126
141
  const threads = snapshot.unresolvedThreads > 0 || snapshot.threadsTruncated ? threadCount(snapshot, locale) : undefined
127
142
  const threadsText = threads === undefined ? undefined : t('change.threads', { count: threads })
128
143
  const trailing = threadsText === undefined ? undefined : (
129
- <Tooltip label={threadsText} side="top">
144
+ <Tooltip label={threadsText} side="top" delayMs={500}>
130
145
  <span className={css.threads} data-forge-threads={threads} aria-hidden="true"><ThreadGlyph size={14} />{threads}</span>
131
146
  </Tooltip>
132
147
  )
@@ -134,7 +149,7 @@ function ChangesRow({ entry, snapshot, name, actions, locale, t }: {
134
149
  // The count shows only a number, so the threads are named in full for assistive technology.
135
150
  const parts = (
136
151
  <>
137
- <RowParts label={t('change.row.changes')} icon={<IconListPenOutlineRegular size={16} />}
152
+ <RowParts label={t('change.row.changes')} icon={<IconFilesDiffOutlineRegular size={16} />}
138
153
  value={<DiffSize snapshot={snapshot} locale={locale} />} trailing={trailing} opens={opens} />
139
154
  {threadsText !== undefined && <span id={described} className={css.visuallyHidden}>{threadsText}</span>}
140
155
  </>
@@ -164,39 +179,51 @@ function finished(snapshot: ChangeRequestSnapshot, now: number, t: Translate): s
164
179
  return ago === undefined ? state : t('time.finished', { state, time: ago })
165
180
  }
166
181
 
167
- /** Collapsed status after the number: checks and the most urgent flag, the merge or close time, or a read in progress. */
168
- function Summary({ snapshot, now, t }: {
169
- readonly snapshot: ChangeRequestSnapshot | null
170
- readonly now: number
171
- readonly t: Translate
172
- }): ReactNode {
173
- if (snapshot === null) return <StateDot state="ongoing" size={11} />
174
- if (snapshot.state !== 'open') {
175
- return <span className={css.finished} data-tone={snapshot.state}>{finished(snapshot, now, t)}</span>
176
- }
182
+ /**
183
+ * The checks outcome after the number: a spinner before the first read, the combined outcome of an open change
184
+ * request that has checks, and nothing for a finished one, whose glyph already says how it ended.
185
+ */
186
+ function Mark({ snapshot }: { readonly snapshot: ChangeRequestSnapshot | null }): ReactNode {
187
+ if (snapshot === null) return <StateDot state="ongoing" size={12} />
188
+ if (snapshot.state !== 'open') return null
189
+ const ci = ciSummary(snapshot)
190
+ if (ci.kind === 'none') return null
191
+ return <CheckGlyph state={ci.kind === 'cancelled' ? 'cancelled' : ROLLUP[snapshot.checksRollup]} size={12} />
192
+ }
193
+
194
+ /**
195
+ * The status in words: the checks and the most urgent flag of an open change request, or the merge or close time.
196
+ * The card's line shows it as glyphs, so assistive technology and the hover card read it here.
197
+ * @param snapshot - change request status.
198
+ * @param now - current epoch milliseconds for the relative time.
199
+ * @param t - copy.
200
+ * @returns the status text.
201
+ */
202
+ function statusText(snapshot: ChangeRequestSnapshot, now: number, t: Translate): string {
203
+ if (snapshot.state !== 'open') return finished(snapshot, now, t)
177
204
  const ci = ciSummary(snapshot)
205
+ const checks = ci.kind === 'failed'
206
+ ? ci.count > 0 ? t('change.ci.failed', { count: ci.count }) : t('change.ci.failedUnlisted')
207
+ : ci.kind === 'cancelled' ? t('change.ci.cancelled', { count: ci.count }) : t(`change.ci.${ci.kind}`)
178
208
  const flag = flagOf(snapshot)
179
- return (
180
- <>
181
- <span className={css.ci} data-tone={ci.kind === 'failed' ? 'error' : undefined}>
182
- {ci.kind !== 'none' && <CheckGlyph state={ci.kind === 'cancelled' ? 'cancelled' : ROLLUP[snapshot.checksRollup]} size={12} />}
183
- {ci.kind === 'failed'
184
- ? ci.count > 0 ? t('change.ci.failed', { count: ci.count }) : t('change.ci.failedUnlisted')
185
- : ci.kind === 'cancelled' ? t('change.ci.cancelled', { count: ci.count }) : t(`change.ci.${ci.kind}`)}
186
- </span>
187
- {flag !== undefined && <span className={css.flag} data-flag={flag}>{t(`change.flag.${flag}`)}</span>}
188
- </>
189
- )
209
+ return flag === undefined ? checks : `${checks} · ${t(`change.flag.${flag}`)}`
190
210
  }
191
211
 
192
- /** Expanded identity after the number: draft state and the head and base branches. */
193
- function Target({ snapshot, t }: { readonly snapshot: ChangeRequestSnapshot; readonly t: Translate }): ReactNode {
194
- return (
195
- <>
196
- {snapshot.state === 'open' && snapshot.draft && <span>{t('change.state.draft')}</span>}
197
- <span className={css.ellipsis}>{`${snapshot.headBranch} → ${snapshot.baseBranch}`}</span>
198
- </>
199
- )
212
+ /** The state dot of the hover card: red for what needs the user, and a spinner while the checks run. */
213
+ function dotOf(tone: ChangeRequestTone, snapshot: ChangeRequestSnapshot): StateDotState {
214
+ if (tone === 'blocked') return 'error'
215
+ if (snapshot.state !== 'open') return snapshot.state === 'merged' ? 'done' : 'idle'
216
+ return snapshot.checksRollup === 'pending' ? 'ongoing' : snapshot.checksRollup === 'success' ? 'done' : 'idle'
217
+ }
218
+
219
+ /** The hover card's line under the title: the number, draft state, and the head and base branches. */
220
+ function identity(number: number | null, snapshot: ChangeRequestSnapshot | null, t: Translate): string[] {
221
+ const parts = [
222
+ ...number === null ? [] : [t('change.number', { number })],
223
+ ...snapshot?.state === 'open' && snapshot.draft ? [t('change.state.draft')] : [],
224
+ ...snapshot === null ? [] : [`${snapshot.headBranch} → ${snapshot.baseBranch}`],
225
+ ]
226
+ return parts.length === 0 ? [] : [parts.join(' · ')]
200
227
  }
201
228
 
202
229
  /** The merge button and its menu: a title row, one row per method with the chosen one checked, and the confirmation. */
@@ -269,12 +296,22 @@ function MergeMenu({ snapshot, name, usual, busy, onMerge, t }: {
269
296
  )
270
297
  }
271
298
 
272
- /** The footer with the action of an open change request: mark a draft ready, or merge one the host would merge now. */
273
- function Primary({ entry, snapshot, name, actions, t }: {
274
- readonly entry: ForgePanelChangeRequest
299
+ /**
300
+ * Render the merge action of an open change request the host would merge now.
301
+ * @param props.entry - the change request.
302
+ * @param props.snapshot - its latest snapshot.
303
+ * @param props.name - how menus name it.
304
+ * @param props.actions - the actions the surface offers.
305
+ * @param props.className - class of the wrapper, the card footer's by default.
306
+ * @param props.t - forge panel copy.
307
+ * @returns the action, or null when the host would not merge now or the surface does not offer it.
308
+ */
309
+ export function ChangeRequestPrimary({ entry, snapshot, name, actions, className = css.footer, t }: {
310
+ readonly entry: ChangeRequestEntry
275
311
  readonly snapshot: ChangeRequestSnapshot
276
312
  readonly name: string
277
313
  readonly actions: ChangeRequestActions
314
+ readonly className?: string | undefined
278
315
  readonly t: Translate
279
316
  }): ReactNode {
280
317
  // One request at a time: the action stays disabled until the previous one settles.
@@ -283,22 +320,12 @@ function Primary({ entry, snapshot, name, actions, t }: {
283
320
  setBusy(true)
284
321
  void action().finally(() => { setBusy(false) })
285
322
  }
286
- const { markReady, merge } = actions
287
- if (snapshot.state !== 'open') return null
288
- if (snapshot.draft) {
289
- if (markReady === undefined) return null
290
- return (
291
- <div className={css.footer}>
292
- <Button size="sm" variant="outline" className={css.primaryAction} disabled={busy} onClick={() => { run(() => markReady(entry)) }}>
293
- {t('change.markReady')}
294
- </Button>
295
- </div>
296
- )
297
- }
323
+ const { merge } = actions
324
+ if (snapshot.state !== 'open' || snapshot.draft) return null
298
325
  const [usual] = snapshot.mergeMethods
299
326
  if (!snapshot.mergeReady || usual === undefined || merge === undefined) return null
300
327
  return (
301
- <div className={css.footer}>
328
+ <div className={className}>
302
329
  <MergeMenu
303
330
  snapshot={snapshot}
304
331
  name={name}
@@ -311,8 +338,135 @@ function Primary({ entry, snapshot, name, actions, t }: {
311
338
  )
312
339
  }
313
340
 
314
- function Details({ entry, snapshot, name, now, actions, locale, t }: {
341
+ /**
342
+ * The card's actions menu: view the changes of a served change request, open
343
+ * on the host, copy the link, mark an open draft ready, and remove the binding.
344
+ */
345
+ function CardMenu({ entry, snapshot, name, url, actions, t }: {
315
346
  readonly entry: ForgePanelChangeRequest
347
+ readonly snapshot: ChangeRequestSnapshot | null
348
+ readonly name: string
349
+ readonly url: string
350
+ readonly actions: ChangeRequestActions
351
+ readonly t: Translate
352
+ }): ReactNode {
353
+ const [open, setOpen] = useState(false)
354
+ // One ready request at a time: the item stays disabled until the previous one settles.
355
+ const [busy, setBusy] = useState(false)
356
+ const { remove, markReady, viewChanges } = actions
357
+ const ready = markReady !== undefined && snapshot?.state === 'open' && snapshot.draft
358
+ ? () => {
359
+ setBusy(true)
360
+ void markReady(entry).finally(() => { setBusy(false) })
361
+ }
362
+ : undefined
363
+ // Each item carries the action it runs, so a selection never reaches another item's action.
364
+ const choices: { readonly item: MenuItem; readonly run: () => void }[] = [
365
+ ...viewChanges !== undefined && snapshot !== null && entry.ref !== null ? [{
366
+ item: { id: 'changes', label: t('change.viewChanges'), icon: <IconFilesDiffOutlineRegular size={14} /> },
367
+ run: () => { viewChanges(entry) },
368
+ }] : [],
369
+ { item: { id: 'open', label: t('change.view'), icon: <IconRightUpOutlineRegular size={14} /> }, run: () => { actions.openLink(url) } },
370
+ { item: { id: 'copy', label: t('change.copy'), icon: <IconCopyOutlineRegular size={14} /> }, run: () => { actions.copyLink(url) } },
371
+ ...ready === undefined ? [] : [{
372
+ item: { id: 'ready', label: t('change.markReady'), icon: <IconCheckCircleOutlineRegular size={14} />, disabled: busy },
373
+ run: ready,
374
+ }],
375
+ ...remove === undefined ? [] : [{
376
+ item: { id: 'remove', label: t('change.remove'), icon: <IconCloseOutlineRegular size={14} />, danger: true },
377
+ run: () => { remove(entry) },
378
+ }],
379
+ ]
380
+ // Removing sits apart from the other actions.
381
+ const items: MenuEntry[] = choices.flatMap(({ item }) => item.id === 'remove'
382
+ ? [{ type: 'separator' as const, id: 'remove-separator' }, item] : [item])
383
+ const select = (id: string): void => {
384
+ setOpen(false)
385
+ for (const choice of choices) if (choice.item.id === id) choice.run()
386
+ }
387
+ return (
388
+ <Menu
389
+ open={open}
390
+ onClose={() => { setOpen(false) }}
391
+ portal
392
+ align="end"
393
+ anchor={(
394
+ <button
395
+ type="button"
396
+ aria-label={t('change.actions', { name })}
397
+ aria-haspopup="menu"
398
+ aria-expanded={open}
399
+ onClick={() => { setOpen(!open) }}
400
+ >
401
+ <IconEllipsisOutlineRegular size={16} />
402
+ </button>
403
+ )}
404
+ items={items}
405
+ onSelect={select}
406
+ />
407
+ )
408
+ }
409
+
410
+ /**
411
+ * Render the merged or closed fact of a finished change request with its time.
412
+ * @param props - the snapshot, current epoch milliseconds for the relative time, and copy.
413
+ * @returns the row.
414
+ */
415
+ export function FinishedRow({ snapshot, now, t }: {
416
+ readonly snapshot: ChangeRequestSnapshot
417
+ readonly now: number
418
+ readonly t: Translate
419
+ }): ReactNode {
420
+ return (
421
+ <div className={css.row}>
422
+ <RowParts label={undefined} icon={<ChangeRequestGlyph tone={snapshot.state} tinted={false} size={16} />}
423
+ value={finished(snapshot, now, t)} tone={snapshot.state} opens={false} />
424
+ </div>
425
+ )
426
+ }
427
+
428
+ /**
429
+ * The aggregate review outcome of an open change request in words, with its tone.
430
+ * @param snapshot - the snapshot.
431
+ * @param t - forge panel copy.
432
+ * @returns the outcome and its tone.
433
+ */
434
+ export function reviewOutcome(
435
+ snapshot: ChangeRequestSnapshot, t: Translate,
436
+ ): { readonly value: string; readonly tone: string | undefined } {
437
+ return {
438
+ value: t(REVIEW[snapshot.reviewDecision]),
439
+ tone: snapshot.reviewDecision === 'changes-requested' ? 'error' : snapshot.reviewDecision === 'approved' ? 'success' : undefined,
440
+ }
441
+ }
442
+
443
+ /**
444
+ * Render the merge state of an open change request: whether it conflicts with its base, and the branch update.
445
+ * @param props - the change request, its snapshot, the update action, and copy.
446
+ * @returns the row.
447
+ */
448
+ export function MergeStateRow({ entry, snapshot, updateBranch, t }: {
449
+ readonly entry: ChangeRequestEntry
450
+ readonly snapshot: ChangeRequestSnapshot
451
+ readonly updateBranch: ChangeRequestActions['updateBranch']
452
+ readonly t: Translate
453
+ }): ReactNode {
454
+ const merge = snapshot.mergeability === 'mergeable'
455
+ ? t('change.merge.mergeable')
456
+ : snapshot.mergeability === 'conflicting' ? t('change.merge.conflicting', { base: snapshot.baseBranch }) : t('change.merge.unknown')
457
+ return (
458
+ <MergeRow entry={entry} snapshot={snapshot} value={merge} updateBranch={updateBranch}
459
+ icon={<ChangeRequestGlyph tone="merged" tinted={false} size={16} />}
460
+ tone={snapshot.mergeability === 'conflicting' ? 'error' : undefined} t={t} />
461
+ )
462
+ }
463
+
464
+ /**
465
+ * The facts of a change request one row each: the merged or closed state, or the checks, review, and merge state;
466
+ * the changed lines; and the linked issues.
467
+ */
468
+ function Details({ entry, snapshot, name, now, actions, locale, t }: {
469
+ readonly entry: ChangeRequestEntry
316
470
  readonly snapshot: ChangeRequestSnapshot
317
471
  readonly name: string
318
472
  readonly now: number
@@ -324,28 +478,19 @@ function Details({ entry, snapshot, name, now, actions, locale, t }: {
324
478
  if (snapshot.state !== 'open') {
325
479
  return (
326
480
  <div className={css.rows}>
327
- <div className={css.row}>
328
- <RowParts label={undefined} icon={<ChangeRequestGlyph tone={snapshot.state} tinted={false} size={16} />}
329
- value={finished(snapshot, now, t)} tone={snapshot.state} opens={false} />
330
- </div>
481
+ <FinishedRow snapshot={snapshot} now={now} t={t} />
331
482
  {changes}
332
483
  </div>
333
484
  )
334
485
  }
335
- const review = t(REVIEW[snapshot.reviewDecision])
336
- const reviewTone = snapshot.reviewDecision === 'changes-requested' ? 'error' : snapshot.reviewDecision === 'approved' ? 'success' : undefined
337
- const merge = snapshot.mergeability === 'mergeable'
338
- ? t('change.merge.mergeable')
339
- : snapshot.mergeability === 'conflicting' ? t('change.merge.conflicting', { base: snapshot.baseBranch }) : t('change.merge.unknown')
486
+ const review = reviewOutcome(snapshot, t)
340
487
  return (
341
488
  <div className={css.rows}>
342
489
  <ChecksRow key={snapshot.headSha} entry={entry} snapshot={snapshot} openLink={actions.openLink} readChecks={actions.readChecks}
343
490
  rerunChecks={actions.rerunChecks} t={t} />
344
- <ReviewRow entry={entry} snapshot={snapshot} tone={reviewTone} openLink={actions.openLink} value={review}
491
+ <ReviewRow entry={entry} snapshot={snapshot} tone={review.tone} openLink={actions.openLink} value={review.value}
345
492
  requestReviews={actions.requestReviews} reviewerCandidates={actions.reviewerCandidates} t={t} />
346
- <MergeRow entry={entry} snapshot={snapshot} value={merge} updateBranch={actions.updateBranch}
347
- icon={<ChangeRequestGlyph tone="merged" tinted={false} size={16} />}
348
- tone={snapshot.mergeability === 'conflicting' ? 'error' : undefined} t={t} />
493
+ <MergeStateRow entry={entry} snapshot={snapshot} updateBranch={actions.updateBranch} t={t} />
349
494
  {changes}
350
495
  <IssuesRow snapshot={snapshot} openLink={actions.openLink} t={t} />
351
496
  </div>
@@ -353,7 +498,10 @@ function Details({ entry, snapshot, name, now, actions, locale, t }: {
353
498
  }
354
499
 
355
500
  /**
356
- * Render one change request.
501
+ * Render one change request. A press on the card's line opens the changes view of a change request a provider serves
502
+ * and has read; with the platform's modifier key or the middle button, and for any other change request, it opens
503
+ * the host's page. The line shows its status as glyphs and, while collapsed, reads it in words to assistive
504
+ * technology, which the expanded rows do otherwise; the hover card names the full title, the branches, and that status.
357
505
  * @param props - change request, expansion, current time, actions, and copy.
358
506
  * @returns the card.
359
507
  */
@@ -365,63 +513,60 @@ export function ChangeRequestCard({ entry, expanded, onToggle, now, actions, loc
365
513
  const notice = entry.ref === null ? 'change.unserved' : failure === undefined ? undefined : FAILURE[failure.code]
366
514
  const tone = toneOf(snapshot)
367
515
  const name = number === null ? snapshot?.title ?? url : t('change.number', { number })
368
- // A notice replaces the collapsed summary, so a failed read never shows its stale status beside it.
369
- const meta = expanded
370
- ? snapshot === null ? null : <Target snapshot={snapshot} t={t} />
371
- : notice === undefined ? <Summary snapshot={snapshot} now={now} t={t} /> : null
372
- const { remove } = actions
373
- return (
374
- <li className={css.change} data-forge-change={entry.url} data-expanded={expanded ? '' : undefined}>
375
- <div className={css.changeHead}>
376
- <ChangeRequestGlyph tone={tone} size={16} label={t('change.stateAria', { state: t(TONE_LABEL[tone]) })} />
377
- <div className={css.headText}>
378
- <a
379
- className={css.changeTitle}
380
- href={url}
381
- target="_blank"
382
- rel="noreferrer"
383
- onClick={(event) => {
384
- event.preventDefault()
385
- actions.openLink(url)
386
- }}
387
- >
388
- {snapshot?.title ?? url.replace(/^https?:\/\//i, '')}
389
- </a>
390
- {(number !== null || meta !== null) && (
391
- <div className={css.meta}>
392
- {number !== null && <span>{t('change.number', { number })}</span>}
393
- {number !== null && meta !== null && <span aria-hidden="true">·</span>}
394
- {meta}
395
- </div>
396
- )}
397
- </div>
398
- <Tooltip label={t('change.view')} side="top">
399
- <button type="button" className={css.iconButton} aria-label={t('change.view')} onClick={() => { actions.openLink(url) }}>
400
- <IconRightUpOutlineRegular size={14} />
401
- </button>
402
- </Tooltip>
403
- <Tooltip label={t('change.copy')} side="top">
404
- <button type="button" className={css.iconButton} aria-label={t('change.copy')} onClick={() => { actions.copyLink(url) }}>
405
- <IconCopyOutlineRegular size={14} />
406
- </button>
407
- </Tooltip>
408
- {remove !== undefined && (
409
- <Tooltip label={t('change.remove')} side="top">
410
- <button type="button" className={css.iconButton} aria-label={t('change.removeAria', { name })} onClick={() => { remove(entry) }}>
411
- <IconCloseOutlineRegular size={14} />
412
- </button>
413
- </Tooltip>
414
- )}
516
+ const title = snapshot?.title ?? url.replace(/^https?:\/\//i, '')
517
+ // A notice replaces the status, so a failed read never reads its stale status beside it.
518
+ const status: PanelDetailsProps['status'] = notice !== undefined
519
+ ? { state: 'warning', label: t(notice) }
520
+ : snapshot === null ? undefined : { state: dotOf(tone, snapshot), label: statusText(snapshot, now, t) }
521
+ const viewChanges = snapshot !== null && entry.ref !== null ? actions.viewChanges : undefined
522
+ const open = (event: MouseEvent): void => {
523
+ if (viewChanges === undefined || event.metaKey || event.ctrlKey) actions.openLink(url)
524
+ else viewChanges(entry)
525
+ }
526
+ const head = (
527
+ <div className={css.changeHead} data-session-panel-row="">
528
+ <button
529
+ type="button"
530
+ data-row-part="body"
531
+ data-forge-opens={viewChanges === undefined ? 'link' : 'changes'}
532
+ onClick={open}
533
+ onAuxClick={(event) => { if (event.button === 1) actions.openLink(url) }}
534
+ >
535
+ <span data-row-part="icon">
536
+ <ChangeRequestGlyph tone={tone} size={16} label={t('change.stateAria', { state: t(TONE_LABEL[tone]) })} />
537
+ </span>
538
+ <span data-row-part="content">{title}</span>
539
+ </button>
540
+ <span data-row-part="trailing" className={css.status}>
541
+ {number !== null && <span className={css.number}>{t('change.number', { number })}</span>}
542
+ {notice === undefined && <Mark snapshot={snapshot} />}
543
+ {!expanded && notice === undefined && status !== undefined && <span className={css.visuallyHidden}>{status.label}</span>}
544
+ {actions.renderActions?.({ url: entry.url, ref: entry.ref, headSha: snapshot?.headSha ?? null, state: snapshot?.state ?? null })}
545
+ </span>
546
+ <span data-row-part="menu">
547
+ <CardMenu entry={entry} snapshot={snapshot} name={name} url={url} actions={actions} t={t} />
548
+ </span>
549
+ <span data-row-part="trailing" className={css.end}>
415
550
  <button
416
551
  type="button"
417
- className={css.iconButton}
552
+ className={css.expand}
418
553
  aria-expanded={expanded}
419
554
  aria-label={t(expanded ? 'change.collapse' : 'change.expand', { name })}
420
555
  onClick={onToggle}
421
556
  >
422
- <IconChevronDownOutlineRegular size={12} className={clsx(css.chevron, expanded && css.chevronOpen)} />
557
+ <IconChevronDownOutlineRegular size={14} className={clsx(css.chevron, expanded && css.chevronOpen)} />
423
558
  </button>
424
- </div>
559
+ </span>
560
+ </div>
561
+ )
562
+ const details = actions.renderDetails?.({
563
+ title,
564
+ lines: identity(number, snapshot, t),
565
+ ...status === undefined ? {} : { status },
566
+ })
567
+ return (
568
+ <li className={css.change} data-forge-change={entry.url} data-expanded={expanded ? '' : undefined}>
569
+ {details === undefined ? head : <HoverCard grouped anchor={head} content={details} />}
425
570
  {notice !== undefined && (
426
571
  <div className={css.notice}>
427
572
  <span>{t(notice)}</span>
@@ -433,7 +578,7 @@ export function ChangeRequestCard({ entry, expanded, onToggle, now, actions, loc
433
578
  {expanded && snapshot !== null && (
434
579
  <Details entry={entry} snapshot={snapshot} name={name} now={now} actions={actions} locale={locale} t={t} />
435
580
  )}
436
- {expanded && snapshot !== null && <Primary entry={entry} snapshot={snapshot} name={name} actions={actions} t={t} />}
581
+ {expanded && snapshot !== null && <ChangeRequestPrimary entry={entry} snapshot={snapshot} name={name} actions={actions} t={t} />}
437
582
  </li>
438
583
  )
439
584
  }
@@ -18,7 +18,7 @@
18
18
  }
19
19
 
20
20
  .avatars > .avatar {
21
- box-shadow: 0 0 0 1.5px var(--dsw-alias-bg-layer-1);
21
+ box-shadow: 0 0 0 1.5px var(--forge-card-surface, var(--dsw-alias-bg-layer-1));
22
22
  }
23
23
 
24
24
  .moreCount {