@bendyline/docblocks-react 2.0.0 → 2.1.0

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 (300) hide show
  1. package/README.md +6 -0
  2. package/dist/{ExportDialog-MEUISWZX.js → ExportDialog-7LDIXJZ3.js} +3 -2
  3. package/dist/{ExportToolbarControls-D2YDWOXW.js → ExportToolbarControls-GHAOJMH6.js} +147 -12
  4. package/dist/ExportToolbarControls-GHAOJMH6.js.map +1 -0
  5. package/dist/{GitToolbarControl-LMIR4R7I.js → GitToolbarControl-GNMRVKWQ.js} +62 -43
  6. package/dist/GitToolbarControl-GNMRVKWQ.js.map +1 -0
  7. package/dist/{GitUI-KGF5MSNV.js → GitUI-VHOBQY43.js} +225 -140
  8. package/dist/GitUI-VHOBQY43.js.map +1 -0
  9. package/dist/ShareDialog-63ENBEDZ.js +213 -0
  10. package/dist/ShareDialog-63ENBEDZ.js.map +1 -0
  11. package/dist/chunk-57ZJJOC5.js +89 -0
  12. package/dist/chunk-57ZJJOC5.js.map +1 -0
  13. package/dist/chunk-FEWQUQML.js +256 -0
  14. package/dist/chunk-FEWQUQML.js.map +1 -0
  15. package/dist/chunk-FMGTHSTX.js +110 -0
  16. package/dist/chunk-FMGTHSTX.js.map +1 -0
  17. package/dist/chunk-UNYZQXWR.js +324 -0
  18. package/dist/chunk-UNYZQXWR.js.map +1 -0
  19. package/dist/editor.d.ts +5 -4
  20. package/dist/editor.js +8 -69
  21. package/dist/editor.js.map +1 -1
  22. package/dist/export/index.d.ts +7 -1
  23. package/dist/export/index.js +2 -1
  24. package/dist/index.d.ts +346 -21
  25. package/dist/index.js +6169 -20
  26. package/dist/index.js.map +1 -1
  27. package/dist/settings/index.d.ts +9 -1
  28. package/dist/settings/index.js +6 -4
  29. package/package.json +18 -13
  30. package/src/styles/docblocks.css +537 -26
  31. package/dist/AppMenu/AppMenu.d.ts +0 -53
  32. package/dist/AppMenu/AppMenu.d.ts.map +0 -1
  33. package/dist/AppMenu/AppMenu.js +0 -67
  34. package/dist/AppMenu/AppMenu.js.map +0 -1
  35. package/dist/AppMenu/index.d.ts +0 -3
  36. package/dist/AppMenu/index.d.ts.map +0 -1
  37. package/dist/AppMenu/index.js +0 -2
  38. package/dist/AppMenu/index.js.map +0 -1
  39. package/dist/DocBlocksShell/DocBlocksShell.d.ts +0 -49
  40. package/dist/DocBlocksShell/DocBlocksShell.d.ts.map +0 -1
  41. package/dist/DocBlocksShell/DocBlocksShell.js +0 -2730
  42. package/dist/DocBlocksShell/DocBlocksShell.js.map +0 -1
  43. package/dist/DocBlocksShell/LazyEditorShell.d.ts +0 -3
  44. package/dist/DocBlocksShell/LazyEditorShell.d.ts.map +0 -1
  45. package/dist/DocBlocksShell/LazyEditorShell.js +0 -3
  46. package/dist/DocBlocksShell/LazyEditorShell.js.map +0 -1
  47. package/dist/DocBlocksShell/UpdateAvailableNotice.d.ts +0 -13
  48. package/dist/DocBlocksShell/UpdateAvailableNotice.d.ts.map +0 -1
  49. package/dist/DocBlocksShell/UpdateAvailableNotice.js +0 -16
  50. package/dist/DocBlocksShell/UpdateAvailableNotice.js.map +0 -1
  51. package/dist/DocBlocksShell/document-title.d.ts +0 -3
  52. package/dist/DocBlocksShell/document-title.d.ts.map +0 -1
  53. package/dist/DocBlocksShell/document-title.js +0 -17
  54. package/dist/DocBlocksShell/document-title.js.map +0 -1
  55. package/dist/DocBlocksShell/index.d.ts +0 -3
  56. package/dist/DocBlocksShell/index.d.ts.map +0 -1
  57. package/dist/DocBlocksShell/index.js +0 -2
  58. package/dist/DocBlocksShell/index.js.map +0 -1
  59. package/dist/DocBlocksShell/workspace-authority-barrier.d.ts +0 -14
  60. package/dist/DocBlocksShell/workspace-authority-barrier.d.ts.map +0 -1
  61. package/dist/DocBlocksShell/workspace-authority-barrier.js +0 -23
  62. package/dist/DocBlocksShell/workspace-authority-barrier.js.map +0 -1
  63. package/dist/Export/DeferredExportToolbarControls.d.ts +0 -5
  64. package/dist/Export/DeferredExportToolbarControls.d.ts.map +0 -1
  65. package/dist/Export/DeferredExportToolbarControls.js +0 -10
  66. package/dist/Export/DeferredExportToolbarControls.js.map +0 -1
  67. package/dist/Export/ExportDialog.d.ts +0 -25
  68. package/dist/Export/ExportDialog.d.ts.map +0 -1
  69. package/dist/Export/ExportDialog.js +0 -160
  70. package/dist/Export/ExportDialog.js.map +0 -1
  71. package/dist/Export/ExportToolbarControls.d.ts +0 -37
  72. package/dist/Export/ExportToolbarControls.d.ts.map +0 -1
  73. package/dist/Export/ExportToolbarControls.js +0 -285
  74. package/dist/Export/ExportToolbarControls.js.map +0 -1
  75. package/dist/Export/export-destination.d.ts +0 -3
  76. package/dist/Export/export-destination.d.ts.map +0 -1
  77. package/dist/Export/export-destination.js +0 -32
  78. package/dist/Export/export-destination.js.map +0 -1
  79. package/dist/Export/export-options.d.ts +0 -53
  80. package/dist/Export/export-options.d.ts.map +0 -1
  81. package/dist/Export/export-options.js +0 -49
  82. package/dist/Export/export-options.js.map +0 -1
  83. package/dist/Export/index.d.ts +0 -10
  84. package/dist/Export/index.d.ts.map +0 -1
  85. package/dist/Export/index.js +0 -6
  86. package/dist/Export/index.js.map +0 -1
  87. package/dist/Export/public-api.d.ts +0 -12
  88. package/dist/Export/public-api.d.ts.map +0 -1
  89. package/dist/Export/public-api.js +0 -9
  90. package/dist/Export/public-api.js.map +0 -1
  91. package/dist/Export/run-export.d.ts +0 -10
  92. package/dist/Export/run-export.d.ts.map +0 -1
  93. package/dist/Export/run-export.js +0 -313
  94. package/dist/Export/run-export.js.map +0 -1
  95. package/dist/Export/transform-summaries.d.ts +0 -7
  96. package/dist/Export/transform-summaries.d.ts.map +0 -1
  97. package/dist/Export/transform-summaries.js +0 -6
  98. package/dist/Export/transform-summaries.js.map +0 -1
  99. package/dist/ExportToolbarControls-D2YDWOXW.js.map +0 -1
  100. package/dist/FileExplorer/FileExplorer.d.ts +0 -43
  101. package/dist/FileExplorer/FileExplorer.d.ts.map +0 -1
  102. package/dist/FileExplorer/FileExplorer.js +0 -315
  103. package/dist/FileExplorer/FileExplorer.js.map +0 -1
  104. package/dist/FileExplorer/FileTreeNode.d.ts +0 -39
  105. package/dist/FileExplorer/FileTreeNode.d.ts.map +0 -1
  106. package/dist/FileExplorer/FileTreeNode.js +0 -131
  107. package/dist/FileExplorer/FileTreeNode.js.map +0 -1
  108. package/dist/FileExplorer/index.d.ts +0 -6
  109. package/dist/FileExplorer/index.d.ts.map +0 -1
  110. package/dist/FileExplorer/index.js +0 -4
  111. package/dist/FileExplorer/index.js.map +0 -1
  112. package/dist/FileExplorer/useFileTree.d.ts +0 -37
  113. package/dist/FileExplorer/useFileTree.d.ts.map +0 -1
  114. package/dist/FileExplorer/useFileTree.js +0 -284
  115. package/dist/FileExplorer/useFileTree.js.map +0 -1
  116. package/dist/Git/GitAuthGuidanceDialog.d.ts +0 -18
  117. package/dist/Git/GitAuthGuidanceDialog.d.ts.map +0 -1
  118. package/dist/Git/GitAuthGuidanceDialog.js +0 -27
  119. package/dist/Git/GitAuthGuidanceDialog.js.map +0 -1
  120. package/dist/Git/GitBranchesDialog.d.ts +0 -13
  121. package/dist/Git/GitBranchesDialog.d.ts.map +0 -1
  122. package/dist/Git/GitBranchesDialog.js +0 -59
  123. package/dist/Git/GitBranchesDialog.js.map +0 -1
  124. package/dist/Git/GitCloneDialog.d.ts +0 -14
  125. package/dist/Git/GitCloneDialog.d.ts.map +0 -1
  126. package/dist/Git/GitCloneDialog.js +0 -79
  127. package/dist/Git/GitCloneDialog.js.map +0 -1
  128. package/dist/Git/GitCommitDialog.d.ts +0 -12
  129. package/dist/Git/GitCommitDialog.d.ts.map +0 -1
  130. package/dist/Git/GitCommitDialog.js +0 -38
  131. package/dist/Git/GitCommitDialog.js.map +0 -1
  132. package/dist/Git/GitConflictsDialog.d.ts +0 -12
  133. package/dist/Git/GitConflictsDialog.d.ts.map +0 -1
  134. package/dist/Git/GitConflictsDialog.js +0 -17
  135. package/dist/Git/GitConflictsDialog.js.map +0 -1
  136. package/dist/Git/GitContext.d.ts +0 -89
  137. package/dist/Git/GitContext.d.ts.map +0 -1
  138. package/dist/Git/GitContext.js +0 -15
  139. package/dist/Git/GitContext.js.map +0 -1
  140. package/dist/Git/GitDiffDialog.d.ts +0 -20
  141. package/dist/Git/GitDiffDialog.d.ts.map +0 -1
  142. package/dist/Git/GitDiffDialog.js +0 -100
  143. package/dist/Git/GitDiffDialog.js.map +0 -1
  144. package/dist/Git/GitDiffView.d.ts +0 -23
  145. package/dist/Git/GitDiffView.d.ts.map +0 -1
  146. package/dist/Git/GitDiffView.js +0 -77
  147. package/dist/Git/GitDiffView.js.map +0 -1
  148. package/dist/Git/GitHistoryDialog.d.ts +0 -15
  149. package/dist/Git/GitHistoryDialog.d.ts.map +0 -1
  150. package/dist/Git/GitHistoryDialog.js +0 -107
  151. package/dist/Git/GitHistoryDialog.js.map +0 -1
  152. package/dist/Git/GitStatusBar.d.ts +0 -8
  153. package/dist/Git/GitStatusBar.d.ts.map +0 -1
  154. package/dist/Git/GitStatusBar.js +0 -49
  155. package/dist/Git/GitStatusBar.js.map +0 -1
  156. package/dist/Git/GitToolbarControl.d.ts +0 -15
  157. package/dist/Git/GitToolbarControl.d.ts.map +0 -1
  158. package/dist/Git/GitToolbarControl.js +0 -51
  159. package/dist/Git/GitToolbarControl.js.map +0 -1
  160. package/dist/Git/GitUI.d.ts +0 -14
  161. package/dist/Git/GitUI.d.ts.map +0 -1
  162. package/dist/Git/GitUI.js +0 -21
  163. package/dist/Git/GitUI.js.map +0 -1
  164. package/dist/Git/commit-selection.d.ts +0 -22
  165. package/dist/Git/commit-selection.d.ts.map +0 -1
  166. package/dist/Git/commit-selection.js +0 -47
  167. package/dist/Git/commit-selection.js.map +0 -1
  168. package/dist/Git/git-clone-utils.d.ts +0 -8
  169. package/dist/Git/git-clone-utils.d.ts.map +0 -1
  170. package/dist/Git/git-clone-utils.js +0 -26
  171. package/dist/Git/git-clone-utils.js.map +0 -1
  172. package/dist/Git/git-status.d.ts +0 -24
  173. package/dist/Git/git-status.d.ts.map +0 -1
  174. package/dist/Git/git-status.js +0 -105
  175. package/dist/Git/git-status.js.map +0 -1
  176. package/dist/Git/useGit.d.ts +0 -15
  177. package/dist/Git/useGit.d.ts.map +0 -1
  178. package/dist/Git/useGit.js +0 -206
  179. package/dist/Git/useGit.js.map +0 -1
  180. package/dist/Git/useGitStatus.d.ts +0 -17
  181. package/dist/Git/useGitStatus.d.ts.map +0 -1
  182. package/dist/Git/useGitStatus.js +0 -63
  183. package/dist/Git/useGitStatus.js.map +0 -1
  184. package/dist/GitToolbarControl-LMIR4R7I.js.map +0 -1
  185. package/dist/GitUI-KGF5MSNV.js.map +0 -1
  186. package/dist/Settings/Settings.d.ts +0 -23
  187. package/dist/Settings/Settings.d.ts.map +0 -1
  188. package/dist/Settings/Settings.js +0 -22
  189. package/dist/Settings/Settings.js.map +0 -1
  190. package/dist/Settings/public-api.d.ts +0 -3
  191. package/dist/Settings/public-api.d.ts.map +0 -1
  192. package/dist/Settings/public-api.js +0 -2
  193. package/dist/Settings/public-api.js.map +0 -1
  194. package/dist/WorkspacePicker/WorkspacePicker.d.ts +0 -22
  195. package/dist/WorkspacePicker/WorkspacePicker.d.ts.map +0 -1
  196. package/dist/WorkspacePicker/WorkspacePicker.js +0 -74
  197. package/dist/WorkspacePicker/WorkspacePicker.js.map +0 -1
  198. package/dist/WorkspacePicker/WorkspaceSettingsButton.d.ts +0 -11
  199. package/dist/WorkspacePicker/WorkspaceSettingsButton.d.ts.map +0 -1
  200. package/dist/WorkspacePicker/WorkspaceSettingsButton.js +0 -27
  201. package/dist/WorkspacePicker/WorkspaceSettingsButton.js.map +0 -1
  202. package/dist/WorkspacePicker/WorkspaceSettingsDialog.d.ts +0 -20
  203. package/dist/WorkspacePicker/WorkspaceSettingsDialog.d.ts.map +0 -1
  204. package/dist/WorkspacePicker/WorkspaceSettingsDialog.js +0 -36
  205. package/dist/WorkspacePicker/WorkspaceSettingsDialog.js.map +0 -1
  206. package/dist/WorkspacePicker/index.d.ts +0 -3
  207. package/dist/WorkspacePicker/index.d.ts.map +0 -1
  208. package/dist/WorkspacePicker/index.js +0 -2
  209. package/dist/WorkspacePicker/index.js.map +0 -1
  210. package/dist/chunk-3SAXDU2U.js +0 -157
  211. package/dist/chunk-3SAXDU2U.js.map +0 -1
  212. package/dist/chunk-AOVTHZU7.js +0 -321
  213. package/dist/chunk-AOVTHZU7.js.map +0 -1
  214. package/dist/chunk-GSNZSCIK.js +0 -55
  215. package/dist/chunk-GSNZSCIK.js.map +0 -1
  216. package/dist/components/Dialog.d.ts +0 -22
  217. package/dist/components/Dialog.d.ts.map +0 -1
  218. package/dist/components/Dialog.js +0 -33
  219. package/dist/components/Dialog.js.map +0 -1
  220. package/dist/editor.d.ts.map +0 -1
  221. package/dist/hooks/index.d.ts +0 -3
  222. package/dist/hooks/index.d.ts.map +0 -1
  223. package/dist/hooks/index.js +0 -2
  224. package/dist/hooks/index.js.map +0 -1
  225. package/dist/hooks/useDocumentSession.d.ts +0 -16
  226. package/dist/hooks/useDocumentSession.d.ts.map +0 -1
  227. package/dist/hooks/useDocumentSession.js +0 -18
  228. package/dist/hooks/useDocumentSession.js.map +0 -1
  229. package/dist/icons.d.ts +0 -12
  230. package/dist/icons.d.ts.map +0 -1
  231. package/dist/icons.js +0 -28
  232. package/dist/icons.js.map +0 -1
  233. package/dist/index.d.ts.map +0 -1
  234. package/dist/preferences/theme.d.ts +0 -18
  235. package/dist/preferences/theme.d.ts.map +0 -1
  236. package/dist/preferences/theme.js +0 -63
  237. package/dist/preferences/theme.js.map +0 -1
  238. package/dist/preferences/versioning.d.ts +0 -27
  239. package/dist/preferences/versioning.d.ts.map +0 -1
  240. package/dist/preferences/versioning.js +0 -62
  241. package/dist/preferences/versioning.js.map +0 -1
  242. package/dist/provider-lease.d.ts +0 -10
  243. package/dist/provider-lease.d.ts.map +0 -1
  244. package/dist/provider-lease.js +0 -42
  245. package/dist/provider-lease.js.map +0 -1
  246. package/src/AppMenu/AppMenu.tsx +0 -334
  247. package/src/AppMenu/index.ts +0 -2
  248. package/src/DocBlocksShell/DocBlocksShell.tsx +0 -3398
  249. package/src/DocBlocksShell/LazyEditorShell.ts +0 -2
  250. package/src/DocBlocksShell/UpdateAvailableNotice.tsx +0 -60
  251. package/src/DocBlocksShell/document-title.ts +0 -19
  252. package/src/DocBlocksShell/index.ts +0 -2
  253. package/src/DocBlocksShell/workspace-authority-barrier.ts +0 -26
  254. package/src/Export/DeferredExportToolbarControls.tsx +0 -23
  255. package/src/Export/ExportDialog.tsx +0 -437
  256. package/src/Export/ExportToolbarControls.tsx +0 -511
  257. package/src/Export/export-destination.ts +0 -30
  258. package/src/Export/export-options.ts +0 -99
  259. package/src/Export/index.ts +0 -19
  260. package/src/Export/public-api.ts +0 -17
  261. package/src/Export/run-export.ts +0 -374
  262. package/src/Export/transform-summaries.ts +0 -14
  263. package/src/FileExplorer/FileExplorer.tsx +0 -528
  264. package/src/FileExplorer/FileTreeNode.tsx +0 -306
  265. package/src/FileExplorer/index.ts +0 -5
  266. package/src/FileExplorer/useFileTree.ts +0 -352
  267. package/src/Git/GitAuthGuidanceDialog.tsx +0 -84
  268. package/src/Git/GitBranchesDialog.tsx +0 -144
  269. package/src/Git/GitCloneDialog.tsx +0 -200
  270. package/src/Git/GitCommitDialog.tsx +0 -119
  271. package/src/Git/GitConflictsDialog.tsx +0 -62
  272. package/src/Git/GitContext.tsx +0 -88
  273. package/src/Git/GitDiffDialog.tsx +0 -147
  274. package/src/Git/GitDiffView.tsx +0 -105
  275. package/src/Git/GitHistoryDialog.tsx +0 -195
  276. package/src/Git/GitStatusBar.tsx +0 -157
  277. package/src/Git/GitToolbarControl.tsx +0 -123
  278. package/src/Git/GitUI.tsx +0 -68
  279. package/src/Git/commit-selection.ts +0 -63
  280. package/src/Git/git-clone-utils.ts +0 -23
  281. package/src/Git/git-status.ts +0 -113
  282. package/src/Git/useGit.ts +0 -279
  283. package/src/Git/useGitStatus.ts +0 -78
  284. package/src/Settings/Settings.tsx +0 -118
  285. package/src/Settings/public-api.ts +0 -8
  286. package/src/WorkspacePicker/WorkspacePicker.tsx +0 -191
  287. package/src/WorkspacePicker/WorkspaceSettingsButton.tsx +0 -88
  288. package/src/WorkspacePicker/WorkspaceSettingsDialog.tsx +0 -121
  289. package/src/WorkspacePicker/index.ts +0 -2
  290. package/src/components/Dialog.tsx +0 -81
  291. package/src/editor.ts +0 -72
  292. package/src/hooks/index.ts +0 -2
  293. package/src/hooks/useDocumentSession.ts +0 -37
  294. package/src/icons.tsx +0 -48
  295. package/src/index.ts +0 -61
  296. package/src/preferences/theme.ts +0 -67
  297. package/src/preferences/versioning.ts +0 -69
  298. package/src/provider-lease.ts +0 -52
  299. package/src/types/pwa-dom.d.ts +0 -31
  300. /package/dist/{ExportDialog-MEUISWZX.js.map → ExportDialog-7LDIXJZ3.js.map} +0 -0
@@ -1,3 +1,6 @@
1
+ import {
2
+ useMenuKeyboard
3
+ } from "./chunk-57ZJJOC5.js";
1
4
  import {
2
5
  BADGE_GLYPHS,
3
6
  BADGE_LABELS,
@@ -8,7 +11,7 @@ import {
8
11
  } from "./chunk-5A4KEWKT.js";
9
12
  import {
10
13
  Dialog
11
- } from "./chunk-GSNZSCIK.js";
14
+ } from "./chunk-FMGTHSTX.js";
12
15
 
13
16
  // src/Git/GitStatusBar.tsx
14
17
  import { useCallback, useEffect, useRef, useState } from "react";
@@ -17,6 +20,7 @@ function GitStatusBar() {
17
20
  const git = useGitContext();
18
21
  const [menuOpen, setMenuOpen] = useState(false);
19
22
  const rootRef = useRef(null);
23
+ const { menuRef, triggerRef, handleMenuKeyDown, handleTriggerKeyDown, closeMenu } = useMenuKeyboard(menuOpen, setMenuOpen);
20
24
  useEffect(() => {
21
25
  if (!menuOpen) return;
22
26
  const onPointerDown = (e) => {
@@ -27,10 +31,13 @@ function GitStatusBar() {
27
31
  document.addEventListener("pointerdown", onPointerDown);
28
32
  return () => document.removeEventListener("pointerdown", onPointerDown);
29
33
  }, [menuOpen]);
30
- const runItem = useCallback((action) => {
31
- setMenuOpen(false);
32
- action();
33
- }, []);
34
+ const runItem = useCallback(
35
+ (action) => {
36
+ closeMenu(false);
37
+ action();
38
+ },
39
+ [closeMenu]
40
+ );
34
41
  if (!git || !git.repo || !git.status) return null;
35
42
  const { status } = git;
36
43
  const branchLabel = status.detached ? "detached HEAD" : status.branch ?? "no branch";
@@ -47,9 +54,11 @@ function GitStatusBar() {
47
54
  /* @__PURE__ */ jsxs(
48
55
  "button",
49
56
  {
57
+ ref: triggerRef,
50
58
  type: "button",
51
59
  className: "db-git-statusbar-chip",
52
60
  onClick: () => setMenuOpen((open) => !open),
61
+ onKeyDown: handleTriggerKeyDown,
53
62
  "aria-haspopup": "menu",
54
63
  "aria-expanded": menuOpen,
55
64
  "aria-label": chipLabelParts.join(", "),
@@ -64,131 +73,160 @@ function GitStatusBar() {
64
73
  ]
65
74
  }
66
75
  ),
67
- menuOpen && /* @__PURE__ */ jsxs("div", { className: "db-git-menu", role: "menu", "aria-label": "Git actions", children: [
68
- /* @__PURE__ */ jsx(
69
- "button",
70
- {
71
- type: "button",
72
- role: "menuitem",
73
- className: "db-git-menu-item",
74
- disabled: status.changes.length === 0 && !merging,
75
- onClick: () => runItem(() => git.openDialog({ kind: "commit" })),
76
- children: merging ? "Commit merge\u2026" : "Commit\u2026"
77
- }
78
- ),
79
- /* @__PURE__ */ jsx(
80
- "button",
81
- {
82
- type: "button",
83
- role: "menuitem",
84
- className: "db-git-menu-item",
85
- disabled: git.busy !== null,
86
- onClick: () => runItem(() => void git.push()),
87
- children: status.upstream === null && !status.unborn ? "Publish branch" : "Push"
88
- }
89
- ),
90
- /* @__PURE__ */ jsx(
91
- "button",
92
- {
93
- type: "button",
94
- role: "menuitem",
95
- className: "db-git-menu-item",
96
- disabled: git.busy !== null,
97
- onClick: () => runItem(() => void git.pull()),
98
- children: "Pull"
99
- }
100
- ),
101
- /* @__PURE__ */ jsx(
102
- "button",
103
- {
104
- type: "button",
105
- role: "menuitem",
106
- className: "db-git-menu-item",
107
- disabled: git.busy !== null,
108
- onClick: () => runItem(() => void git.fetchRemote()),
109
- children: "Fetch"
110
- }
111
- ),
112
- /* @__PURE__ */ jsx("div", { className: "db-git-menu-divider", role: "separator" }),
113
- /* @__PURE__ */ jsx(
114
- "button",
115
- {
116
- type: "button",
117
- role: "menuitem",
118
- className: "db-git-menu-item",
119
- onClick: () => runItem(() => git.openDialog({ kind: "branches" })),
120
- children: "Branches\u2026"
121
- }
122
- ),
123
- /* @__PURE__ */ jsx(
124
- "button",
125
- {
126
- type: "button",
127
- role: "menuitem",
128
- className: "db-git-menu-item",
129
- onClick: () => runItem(() => git.openDialog({ kind: "history" })),
130
- children: "Commit history\u2026"
131
- }
132
- ),
133
- (git.remoteWeb || canCreatePr) && /* @__PURE__ */ jsx("div", { className: "db-git-menu-divider", role: "separator" }),
134
- git.remoteWeb && /* @__PURE__ */ jsxs(
135
- "button",
136
- {
137
- type: "button",
138
- role: "menuitem",
139
- className: "db-git-menu-item",
140
- onClick: () => runItem(() => git.openOnRemote()),
141
- children: [
142
- "Open on ",
143
- git.remoteWeb.host
144
- ]
145
- }
146
- ),
147
- canCreatePr && /* @__PURE__ */ jsx(
148
- "button",
149
- {
150
- type: "button",
151
- role: "menuitem",
152
- className: "db-git-menu-item",
153
- disabled: git.busy !== null,
154
- onClick: () => runItem(() => void git.createPullRequest()),
155
- children: "Create pull request"
156
- }
157
- )
158
- ] })
76
+ menuOpen && /* @__PURE__ */ jsxs(
77
+ "div",
78
+ {
79
+ ref: menuRef,
80
+ className: "db-git-menu",
81
+ role: "menu",
82
+ "aria-label": "Git actions",
83
+ onKeyDown: handleMenuKeyDown,
84
+ children: [
85
+ /* @__PURE__ */ jsx(
86
+ "button",
87
+ {
88
+ type: "button",
89
+ role: "menuitem",
90
+ tabIndex: -1,
91
+ className: "db-git-menu-item",
92
+ disabled: status.changes.length === 0 && !merging,
93
+ onClick: () => runItem(() => git.openDialog({ kind: "commit" })),
94
+ children: merging ? "Commit merge\u2026" : "Commit\u2026"
95
+ }
96
+ ),
97
+ /* @__PURE__ */ jsx(
98
+ "button",
99
+ {
100
+ type: "button",
101
+ role: "menuitem",
102
+ tabIndex: -1,
103
+ className: "db-git-menu-item",
104
+ disabled: git.busy !== null,
105
+ onClick: () => runItem(() => void git.push()),
106
+ children: status.upstream === null && !status.unborn ? "Publish branch" : "Push"
107
+ }
108
+ ),
109
+ /* @__PURE__ */ jsx(
110
+ "button",
111
+ {
112
+ type: "button",
113
+ role: "menuitem",
114
+ tabIndex: -1,
115
+ className: "db-git-menu-item",
116
+ disabled: git.busy !== null,
117
+ onClick: () => runItem(() => void git.pull()),
118
+ children: "Pull"
119
+ }
120
+ ),
121
+ /* @__PURE__ */ jsx(
122
+ "button",
123
+ {
124
+ type: "button",
125
+ role: "menuitem",
126
+ tabIndex: -1,
127
+ className: "db-git-menu-item",
128
+ disabled: git.busy !== null,
129
+ onClick: () => runItem(() => void git.fetchRemote()),
130
+ children: "Fetch"
131
+ }
132
+ ),
133
+ /* @__PURE__ */ jsx("div", { className: "db-git-menu-divider", role: "separator" }),
134
+ /* @__PURE__ */ jsx(
135
+ "button",
136
+ {
137
+ type: "button",
138
+ role: "menuitem",
139
+ tabIndex: -1,
140
+ className: "db-git-menu-item",
141
+ onClick: () => runItem(() => git.openDialog({ kind: "branches" })),
142
+ children: "Branches\u2026"
143
+ }
144
+ ),
145
+ /* @__PURE__ */ jsx(
146
+ "button",
147
+ {
148
+ type: "button",
149
+ role: "menuitem",
150
+ tabIndex: -1,
151
+ className: "db-git-menu-item",
152
+ onClick: () => runItem(() => git.openDialog({ kind: "history" })),
153
+ children: "Commit history\u2026"
154
+ }
155
+ ),
156
+ (git.remoteWeb || canCreatePr) && /* @__PURE__ */ jsx("div", { className: "db-git-menu-divider", role: "separator" }),
157
+ git.remoteWeb && /* @__PURE__ */ jsxs(
158
+ "button",
159
+ {
160
+ type: "button",
161
+ role: "menuitem",
162
+ tabIndex: -1,
163
+ className: "db-git-menu-item",
164
+ onClick: () => runItem(() => git.openOnRemote()),
165
+ children: [
166
+ "Open on ",
167
+ git.remoteWeb.host
168
+ ]
169
+ }
170
+ ),
171
+ canCreatePr && /* @__PURE__ */ jsx(
172
+ "button",
173
+ {
174
+ type: "button",
175
+ role: "menuitem",
176
+ tabIndex: -1,
177
+ className: "db-git-menu-item",
178
+ disabled: git.busy !== null,
179
+ onClick: () => runItem(() => void git.createPullRequest()),
180
+ children: "Create pull request"
181
+ }
182
+ )
183
+ ]
184
+ }
185
+ )
159
186
  ] });
160
187
  }
161
188
 
162
189
  // src/Git/GitCommitDialog.tsx
163
- import { useRef as useRef2, useState as useState2 } from "react";
190
+ import { useMemo, useRef as useRef2, useState as useState2 } from "react";
164
191
 
165
192
  // src/Git/commit-selection.ts
193
+ var INCLUDED_BY_DEFAULT = true;
166
194
  function normalise(path) {
167
195
  return path.startsWith("/") ? path : `/${path}`;
168
196
  }
169
- function initSelection(changes, merging) {
197
+ var NO_OVERRIDES = /* @__PURE__ */ new Map();
198
+ function resolveSelection(changes, wholeIndex, overrides = NO_OVERRIDES) {
170
199
  const included = /* @__PURE__ */ new Map();
171
200
  const locked = /* @__PURE__ */ new Set();
172
201
  for (const change of changes) {
173
202
  const path = normalise(change.path);
174
- included.set(path, true);
175
- if (merging && change.conflicted) locked.add(path);
203
+ if (wholeIndex) locked.add(path);
204
+ included.set(path, wholeIndex ? true : overrides.get(path) ?? INCLUDED_BY_DEFAULT);
176
205
  }
177
206
  return { included, locked };
178
207
  }
179
- function toggleSelection(selection, path) {
208
+ function isIncluded(selection, path) {
209
+ return selection.included.get(normalise(path)) ?? INCLUDED_BY_DEFAULT;
210
+ }
211
+ function isLocked(selection, path) {
212
+ return selection.locked.has(normalise(path));
213
+ }
214
+ function toggleOverride(overrides, selection, path) {
180
215
  const key = normalise(path);
181
- if (selection.locked.has(key)) return selection;
182
- const included = new Map(selection.included);
183
- included.set(key, !included.get(key));
184
- return { included, locked: selection.locked };
216
+ if (isLocked(selection, key)) return overrides;
217
+ const next = new Map(overrides);
218
+ next.set(key, !isIncluded(selection, key));
219
+ return next;
185
220
  }
186
- function setAllSelected(selection, value) {
187
- const included = /* @__PURE__ */ new Map();
221
+ function setAllOverrides(selection, value) {
222
+ const next = /* @__PURE__ */ new Map();
188
223
  for (const key of selection.included.keys()) {
189
- included.set(key, selection.locked.has(key) ? true : value);
224
+ if (!selection.locked.has(key)) next.set(key, value);
190
225
  }
191
- return { included, locked: selection.locked };
226
+ return next;
227
+ }
228
+ function allSelected(selection) {
229
+ return [...selection.included.values()].every(Boolean);
192
230
  }
193
231
  function selectedPaths(selection) {
194
232
  return [...selection.included.entries()].filter(([, on]) => on).map(([path]) => path);
@@ -199,20 +237,34 @@ function canCommit(message, selection) {
199
237
  function isMergeCommit(status) {
200
238
  return status?.operation === "merge";
201
239
  }
240
+ function commitsWholeIndex(status) {
241
+ return status !== null && status.operation !== null;
242
+ }
202
243
 
203
244
  // src/Git/GitCommitDialog.tsx
204
245
  import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
246
+ var OPERATION_LABELS = {
247
+ merge: "merge",
248
+ rebase: "rebase",
249
+ "cherry-pick": "cherry-pick",
250
+ revert: "revert",
251
+ bisect: "bisect"
252
+ };
205
253
  function GitCommitDialog({ onClose }) {
206
254
  const git = useGitContext();
207
255
  const status = git?.status ?? null;
208
256
  const merging = isMergeCommit(status);
257
+ const wholeIndex = commitsWholeIndex(status);
258
+ const changes = status?.changes;
209
259
  const [message, setMessage] = useState2("");
210
- const [selection, setSelection] = useState2(
211
- () => initSelection(status?.changes ?? [], merging)
212
- );
260
+ const [overrides, setOverrides] = useState2(NO_OVERRIDES);
213
261
  const messageRef = useRef2(null);
262
+ const selection = useMemo(
263
+ () => resolveSelection(changes ?? [], wholeIndex, overrides),
264
+ [changes, wholeIndex, overrides]
265
+ );
214
266
  if (!git || !status) return null;
215
- const allOn = [...selection.included.values()].every(Boolean);
267
+ const allOn = allSelected(selection);
216
268
  const commitDisabled = !canCommit(message, selection) || git.busy !== null;
217
269
  const handleCommit = async () => {
218
270
  const ok = await git.commit(message, selectedPaths(selection));
@@ -240,7 +292,14 @@ function GitCommitDialog({ onClose }) {
240
292
  )
241
293
  ] }),
242
294
  children: [
243
- merging && /* @__PURE__ */ jsx2("p", { className: "db-settings-hint", children: "You\u2019re completing a merge. Committing will conclude it." }),
295
+ wholeIndex && /* @__PURE__ */ jsxs2("p", { className: "db-settings-hint", children: [
296
+ merging ? "You\u2019re completing a merge. Committing will conclude it." : `A ${OPERATION_LABELS[status.operation ?? ""] ?? "git operation"} is in progress.`,
297
+ " ",
298
+ "Git records every change below in this commit \u2014 files cannot be left out until the",
299
+ " ",
300
+ merging ? "merge" : "operation",
301
+ " is finished."
302
+ ] }),
244
303
  /* @__PURE__ */ jsx2(
245
304
  "textarea",
246
305
  {
@@ -253,19 +312,19 @@ function GitCommitDialog({ onClose }) {
253
312
  rows: 3
254
313
  }
255
314
  ),
256
- /* @__PURE__ */ jsx2("div", { className: "db-git-form-row", children: /* @__PURE__ */ jsx2(
315
+ !wholeIndex && /* @__PURE__ */ jsx2("div", { className: "db-git-form-row", children: /* @__PURE__ */ jsx2(
257
316
  "button",
258
317
  {
259
318
  type: "button",
260
319
  className: "db-git-secondary-btn",
261
- onClick: () => setSelection((s) => setAllSelected(s, !allOn)),
320
+ onClick: () => setOverrides(setAllOverrides(selection, !allOn)),
262
321
  children: allOn ? "Select none" : "Select all"
263
322
  }
264
323
  ) }),
265
324
  /* @__PURE__ */ jsx2("ul", { className: "db-git-file-list", children: status.changes.map((change) => {
266
325
  const kind = badgeKindFor(change);
267
- const locked = selection.locked.has(change.path);
268
- const checked = locked || (selection.included.get(change.path) ?? true);
326
+ const locked = isLocked(selection, change.path);
327
+ const checked = isIncluded(selection, change.path);
269
328
  return /* @__PURE__ */ jsxs2("li", { className: "db-git-file-row", children: [
270
329
  /* @__PURE__ */ jsxs2("label", { children: [
271
330
  /* @__PURE__ */ jsx2(
@@ -274,7 +333,8 @@ function GitCommitDialog({ onClose }) {
274
333
  type: "checkbox",
275
334
  checked,
276
335
  disabled: locked,
277
- onChange: () => setSelection((s) => toggleSelection(s, change.path))
336
+ title: locked ? `Included automatically while the ${merging ? "merge" : "operation"} is in progress` : void 0,
337
+ onChange: () => setOverrides((o) => toggleOverride(o, selection, change.path))
278
338
  }
279
339
  ),
280
340
  /* @__PURE__ */ jsx2("span", { children: change.path.replace(/^\/+/, "") })
@@ -305,11 +365,19 @@ function GitBranchesDialog({
305
365
  useEffect2(() => {
306
366
  if (!gitApi || !repositoryId) return;
307
367
  let cancelled = false;
308
- void gitApi.listBranches(repositoryId).then((result) => {
309
- if (cancelled) return;
310
- if (result.ok) setBranches(result.value);
311
- else setLoadError(result.error.message || "Could not list branches");
312
- });
368
+ void gitApi.listBranches(repositoryId).then(
369
+ (result) => {
370
+ if (cancelled) return;
371
+ if (result.ok) setBranches(result.value);
372
+ else setLoadError(result.error.message || "Could not list branches");
373
+ },
374
+ // A rejected call (the host went away) left the dialog on
375
+ // "Loading branches…" forever. Fail visibly instead.
376
+ (error) => {
377
+ if (cancelled) return;
378
+ setLoadError(error instanceof Error ? error.message : "Could not list branches");
379
+ }
380
+ );
313
381
  return () => {
314
382
  cancelled = true;
315
383
  };
@@ -402,7 +470,7 @@ function GitBranchesDialog({
402
470
  }
403
471
 
404
472
  // src/Git/GitHistoryDialog.tsx
405
- import { useCallback as useCallback2, useEffect as useEffect3, useState as useState4 } from "react";
473
+ import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef4, useState as useState4 } from "react";
406
474
  import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
407
475
  var PAGE_SIZE = 50;
408
476
  function extraBody(body, subject) {
@@ -428,30 +496,39 @@ function GitHistoryDialog({ path, onClose }) {
428
496
  const [hasMore, setHasMore] = useState4(false);
429
497
  const [expandedSha, setExpandedSha] = useState4(null);
430
498
  const [details, setDetails] = useState4(/* @__PURE__ */ new Map());
499
+ const generationRef = useRef4(0);
431
500
  const loadPage = useCallback2(
432
501
  async (skip) => {
433
502
  if (!gitApi || !repositoryId) return;
503
+ const generation = generationRef.current;
504
+ const stale = () => generation !== generationRef.current;
434
505
  setLoading(true);
435
506
  setError(null);
436
507
  try {
437
508
  const result = await gitApi.log(repositoryId, { path, maxCount: PAGE_SIZE, skip });
509
+ if (stale()) return;
438
510
  if (!result.ok) {
439
511
  setError(result.error.message);
440
512
  return;
441
513
  }
442
514
  setEntries((prev) => skip === 0 ? result.value : [...prev, ...result.value]);
443
515
  setHasMore(result.value.length === PAGE_SIZE);
516
+ } catch (caught) {
517
+ if (stale()) return;
518
+ setError(caught instanceof Error ? caught.message : "Could not load history");
444
519
  } finally {
445
- setLoading(false);
520
+ if (!stale()) setLoading(false);
446
521
  }
447
522
  },
448
523
  [gitApi, repositoryId, path]
449
524
  );
450
525
  useEffect3(() => {
526
+ generationRef.current += 1;
451
527
  setEntries([]);
452
528
  setExpandedSha(null);
453
529
  setDetails(/* @__PURE__ */ new Map());
454
530
  setHasMore(false);
531
+ setLoading(false);
455
532
  void loadPage(0);
456
533
  }, [loadPage]);
457
534
  const handleRowClick = (sha) => {
@@ -461,13 +538,21 @@ function GitHistoryDialog({ path, onClose }) {
461
538
  }
462
539
  setExpandedSha(sha);
463
540
  if (!gitApi || !repositoryId || details.has(sha)) return;
464
- void gitApi.commitFiles(repositoryId, sha).then((result) => {
541
+ const generation = generationRef.current;
542
+ const record = (detail) => {
543
+ if (generation !== generationRef.current) return;
465
544
  setDetails((prev) => {
466
545
  const next = new Map(prev);
467
- next.set(sha, result.ok ? result.value : { error: result.error.message });
546
+ next.set(sha, detail);
468
547
  return next;
469
548
  });
470
- });
549
+ };
550
+ void gitApi.commitFiles(repositoryId, sha).then(
551
+ (result) => record(result.ok ? result.value : { error: result.error.message }),
552
+ (error2) => record({
553
+ error: error2 instanceof Error ? error2.message : "Could not load this commit"
554
+ })
555
+ );
471
556
  };
472
557
  if (!git) return null;
473
558
  const baseName = path ? path.replace(/^\/+/, "").split("/").pop() : null;
@@ -552,7 +637,7 @@ import { useEffect as useEffect5, useState as useState5 } from "react";
552
637
  import { getFileSystemProviderV2, parseWorkspacePath } from "@bendyline/docblocks/filesystem";
553
638
 
554
639
  // src/Git/GitDiffView.tsx
555
- import { useEffect as useEffect4, useRef as useRef4 } from "react";
640
+ import { useEffect as useEffect4, useRef as useRef5 } from "react";
556
641
  import {
557
642
  detectLanguageFromFileName,
558
643
  useMonacoLoader
@@ -565,9 +650,9 @@ function languageFor(fileName) {
565
650
  }
566
651
  function GitDiffView({ original, modified, fileName, theme, labels }) {
567
652
  const { monaco, ready } = useMonacoLoader();
568
- const hostRef = useRef4(null);
569
- const editorRef = useRef4(null);
570
- const modelsRef = useRef4(null);
653
+ const hostRef = useRef5(null);
654
+ const editorRef = useRef5(null);
655
+ const modelsRef = useRef5(null);
571
656
  const language = languageFor(fileName);
572
657
  useEffect4(() => {
573
658
  const host = hostRef.current;
@@ -711,7 +796,7 @@ function GitDiffDialog({ path, revision, onClose }) {
711
796
  }
712
797
 
713
798
  // src/Git/GitCloneDialog.tsx
714
- import { useEffect as useEffect6, useRef as useRef5, useState as useState6 } from "react";
799
+ import { useEffect as useEffect6, useRef as useRef6, useState as useState6 } from "react";
715
800
 
716
801
  // src/Git/git-clone-utils.ts
717
802
  function deriveCloneFolderName(url) {
@@ -734,7 +819,7 @@ function isLikelyGitUrl(url) {
734
819
  import { maybeGetDocBlocksHost } from "@bendyline/docblocks/host";
735
820
  import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
736
821
  var LEARN_MORE_URL = "https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git";
737
- var OPERATION_LABELS = {
822
+ var OPERATION_LABELS2 = {
738
823
  push: "push",
739
824
  pull: "pull",
740
825
  fetch: "fetch",
@@ -788,7 +873,7 @@ function GitAuthGuidanceDialog({
788
873
  children: [
789
874
  /* @__PURE__ */ jsxs7("p", { className: "db-settings-hint", children: [
790
875
  "Git could not authenticate with the remote while trying to ",
791
- OPERATION_LABELS[operation],
876
+ OPERATION_LABELS2[operation],
792
877
  "."
793
878
  ] }),
794
879
  /* @__PURE__ */ jsx7(GitCredentialGuidance, { detail })
@@ -810,8 +895,8 @@ function GitCloneDialog({
810
895
  const [progress, setProgress] = useState6(null);
811
896
  const [error, setError] = useState6(null);
812
897
  const [authDetail, setAuthDetail] = useState6(null);
813
- const handleRef = useRef5(null);
814
- const urlInputRef = useRef5(null);
898
+ const handleRef = useRef6(null);
899
+ const urlInputRef = useRef6(null);
815
900
  useEffect6(
816
901
  () => () => {
817
902
  handleRef.current?.cancel();
@@ -1045,4 +1130,4 @@ function GitUI({ onOpenFile, onWorkspaceCloned }) {
1045
1130
  export {
1046
1131
  GitUI
1047
1132
  };
1048
- //# sourceMappingURL=GitUI-KGF5MSNV.js.map
1133
+ //# sourceMappingURL=GitUI-VHOBQY43.js.map