@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.
- package/README.md +6 -0
- package/dist/{ExportDialog-MEUISWZX.js → ExportDialog-7LDIXJZ3.js} +3 -2
- package/dist/{ExportToolbarControls-D2YDWOXW.js → ExportToolbarControls-GHAOJMH6.js} +147 -12
- package/dist/ExportToolbarControls-GHAOJMH6.js.map +1 -0
- package/dist/{GitToolbarControl-LMIR4R7I.js → GitToolbarControl-GNMRVKWQ.js} +62 -43
- package/dist/GitToolbarControl-GNMRVKWQ.js.map +1 -0
- package/dist/{GitUI-KGF5MSNV.js → GitUI-VHOBQY43.js} +225 -140
- package/dist/GitUI-VHOBQY43.js.map +1 -0
- package/dist/ShareDialog-63ENBEDZ.js +213 -0
- package/dist/ShareDialog-63ENBEDZ.js.map +1 -0
- package/dist/chunk-57ZJJOC5.js +89 -0
- package/dist/chunk-57ZJJOC5.js.map +1 -0
- package/dist/chunk-FEWQUQML.js +256 -0
- package/dist/chunk-FEWQUQML.js.map +1 -0
- package/dist/chunk-FMGTHSTX.js +110 -0
- package/dist/chunk-FMGTHSTX.js.map +1 -0
- package/dist/chunk-UNYZQXWR.js +324 -0
- package/dist/chunk-UNYZQXWR.js.map +1 -0
- package/dist/editor.d.ts +5 -4
- package/dist/editor.js +8 -69
- package/dist/editor.js.map +1 -1
- package/dist/export/index.d.ts +7 -1
- package/dist/export/index.js +2 -1
- package/dist/index.d.ts +346 -21
- package/dist/index.js +6169 -20
- package/dist/index.js.map +1 -1
- package/dist/settings/index.d.ts +9 -1
- package/dist/settings/index.js +6 -4
- package/package.json +18 -13
- package/src/styles/docblocks.css +537 -26
- package/dist/AppMenu/AppMenu.d.ts +0 -53
- package/dist/AppMenu/AppMenu.d.ts.map +0 -1
- package/dist/AppMenu/AppMenu.js +0 -67
- package/dist/AppMenu/AppMenu.js.map +0 -1
- package/dist/AppMenu/index.d.ts +0 -3
- package/dist/AppMenu/index.d.ts.map +0 -1
- package/dist/AppMenu/index.js +0 -2
- package/dist/AppMenu/index.js.map +0 -1
- package/dist/DocBlocksShell/DocBlocksShell.d.ts +0 -49
- package/dist/DocBlocksShell/DocBlocksShell.d.ts.map +0 -1
- package/dist/DocBlocksShell/DocBlocksShell.js +0 -2730
- package/dist/DocBlocksShell/DocBlocksShell.js.map +0 -1
- package/dist/DocBlocksShell/LazyEditorShell.d.ts +0 -3
- package/dist/DocBlocksShell/LazyEditorShell.d.ts.map +0 -1
- package/dist/DocBlocksShell/LazyEditorShell.js +0 -3
- package/dist/DocBlocksShell/LazyEditorShell.js.map +0 -1
- package/dist/DocBlocksShell/UpdateAvailableNotice.d.ts +0 -13
- package/dist/DocBlocksShell/UpdateAvailableNotice.d.ts.map +0 -1
- package/dist/DocBlocksShell/UpdateAvailableNotice.js +0 -16
- package/dist/DocBlocksShell/UpdateAvailableNotice.js.map +0 -1
- package/dist/DocBlocksShell/document-title.d.ts +0 -3
- package/dist/DocBlocksShell/document-title.d.ts.map +0 -1
- package/dist/DocBlocksShell/document-title.js +0 -17
- package/dist/DocBlocksShell/document-title.js.map +0 -1
- package/dist/DocBlocksShell/index.d.ts +0 -3
- package/dist/DocBlocksShell/index.d.ts.map +0 -1
- package/dist/DocBlocksShell/index.js +0 -2
- package/dist/DocBlocksShell/index.js.map +0 -1
- package/dist/DocBlocksShell/workspace-authority-barrier.d.ts +0 -14
- package/dist/DocBlocksShell/workspace-authority-barrier.d.ts.map +0 -1
- package/dist/DocBlocksShell/workspace-authority-barrier.js +0 -23
- package/dist/DocBlocksShell/workspace-authority-barrier.js.map +0 -1
- package/dist/Export/DeferredExportToolbarControls.d.ts +0 -5
- package/dist/Export/DeferredExportToolbarControls.d.ts.map +0 -1
- package/dist/Export/DeferredExportToolbarControls.js +0 -10
- package/dist/Export/DeferredExportToolbarControls.js.map +0 -1
- package/dist/Export/ExportDialog.d.ts +0 -25
- package/dist/Export/ExportDialog.d.ts.map +0 -1
- package/dist/Export/ExportDialog.js +0 -160
- package/dist/Export/ExportDialog.js.map +0 -1
- package/dist/Export/ExportToolbarControls.d.ts +0 -37
- package/dist/Export/ExportToolbarControls.d.ts.map +0 -1
- package/dist/Export/ExportToolbarControls.js +0 -285
- package/dist/Export/ExportToolbarControls.js.map +0 -1
- package/dist/Export/export-destination.d.ts +0 -3
- package/dist/Export/export-destination.d.ts.map +0 -1
- package/dist/Export/export-destination.js +0 -32
- package/dist/Export/export-destination.js.map +0 -1
- package/dist/Export/export-options.d.ts +0 -53
- package/dist/Export/export-options.d.ts.map +0 -1
- package/dist/Export/export-options.js +0 -49
- package/dist/Export/export-options.js.map +0 -1
- package/dist/Export/index.d.ts +0 -10
- package/dist/Export/index.d.ts.map +0 -1
- package/dist/Export/index.js +0 -6
- package/dist/Export/index.js.map +0 -1
- package/dist/Export/public-api.d.ts +0 -12
- package/dist/Export/public-api.d.ts.map +0 -1
- package/dist/Export/public-api.js +0 -9
- package/dist/Export/public-api.js.map +0 -1
- package/dist/Export/run-export.d.ts +0 -10
- package/dist/Export/run-export.d.ts.map +0 -1
- package/dist/Export/run-export.js +0 -313
- package/dist/Export/run-export.js.map +0 -1
- package/dist/Export/transform-summaries.d.ts +0 -7
- package/dist/Export/transform-summaries.d.ts.map +0 -1
- package/dist/Export/transform-summaries.js +0 -6
- package/dist/Export/transform-summaries.js.map +0 -1
- package/dist/ExportToolbarControls-D2YDWOXW.js.map +0 -1
- package/dist/FileExplorer/FileExplorer.d.ts +0 -43
- package/dist/FileExplorer/FileExplorer.d.ts.map +0 -1
- package/dist/FileExplorer/FileExplorer.js +0 -315
- package/dist/FileExplorer/FileExplorer.js.map +0 -1
- package/dist/FileExplorer/FileTreeNode.d.ts +0 -39
- package/dist/FileExplorer/FileTreeNode.d.ts.map +0 -1
- package/dist/FileExplorer/FileTreeNode.js +0 -131
- package/dist/FileExplorer/FileTreeNode.js.map +0 -1
- package/dist/FileExplorer/index.d.ts +0 -6
- package/dist/FileExplorer/index.d.ts.map +0 -1
- package/dist/FileExplorer/index.js +0 -4
- package/dist/FileExplorer/index.js.map +0 -1
- package/dist/FileExplorer/useFileTree.d.ts +0 -37
- package/dist/FileExplorer/useFileTree.d.ts.map +0 -1
- package/dist/FileExplorer/useFileTree.js +0 -284
- package/dist/FileExplorer/useFileTree.js.map +0 -1
- package/dist/Git/GitAuthGuidanceDialog.d.ts +0 -18
- package/dist/Git/GitAuthGuidanceDialog.d.ts.map +0 -1
- package/dist/Git/GitAuthGuidanceDialog.js +0 -27
- package/dist/Git/GitAuthGuidanceDialog.js.map +0 -1
- package/dist/Git/GitBranchesDialog.d.ts +0 -13
- package/dist/Git/GitBranchesDialog.d.ts.map +0 -1
- package/dist/Git/GitBranchesDialog.js +0 -59
- package/dist/Git/GitBranchesDialog.js.map +0 -1
- package/dist/Git/GitCloneDialog.d.ts +0 -14
- package/dist/Git/GitCloneDialog.d.ts.map +0 -1
- package/dist/Git/GitCloneDialog.js +0 -79
- package/dist/Git/GitCloneDialog.js.map +0 -1
- package/dist/Git/GitCommitDialog.d.ts +0 -12
- package/dist/Git/GitCommitDialog.d.ts.map +0 -1
- package/dist/Git/GitCommitDialog.js +0 -38
- package/dist/Git/GitCommitDialog.js.map +0 -1
- package/dist/Git/GitConflictsDialog.d.ts +0 -12
- package/dist/Git/GitConflictsDialog.d.ts.map +0 -1
- package/dist/Git/GitConflictsDialog.js +0 -17
- package/dist/Git/GitConflictsDialog.js.map +0 -1
- package/dist/Git/GitContext.d.ts +0 -89
- package/dist/Git/GitContext.d.ts.map +0 -1
- package/dist/Git/GitContext.js +0 -15
- package/dist/Git/GitContext.js.map +0 -1
- package/dist/Git/GitDiffDialog.d.ts +0 -20
- package/dist/Git/GitDiffDialog.d.ts.map +0 -1
- package/dist/Git/GitDiffDialog.js +0 -100
- package/dist/Git/GitDiffDialog.js.map +0 -1
- package/dist/Git/GitDiffView.d.ts +0 -23
- package/dist/Git/GitDiffView.d.ts.map +0 -1
- package/dist/Git/GitDiffView.js +0 -77
- package/dist/Git/GitDiffView.js.map +0 -1
- package/dist/Git/GitHistoryDialog.d.ts +0 -15
- package/dist/Git/GitHistoryDialog.d.ts.map +0 -1
- package/dist/Git/GitHistoryDialog.js +0 -107
- package/dist/Git/GitHistoryDialog.js.map +0 -1
- package/dist/Git/GitStatusBar.d.ts +0 -8
- package/dist/Git/GitStatusBar.d.ts.map +0 -1
- package/dist/Git/GitStatusBar.js +0 -49
- package/dist/Git/GitStatusBar.js.map +0 -1
- package/dist/Git/GitToolbarControl.d.ts +0 -15
- package/dist/Git/GitToolbarControl.d.ts.map +0 -1
- package/dist/Git/GitToolbarControl.js +0 -51
- package/dist/Git/GitToolbarControl.js.map +0 -1
- package/dist/Git/GitUI.d.ts +0 -14
- package/dist/Git/GitUI.d.ts.map +0 -1
- package/dist/Git/GitUI.js +0 -21
- package/dist/Git/GitUI.js.map +0 -1
- package/dist/Git/commit-selection.d.ts +0 -22
- package/dist/Git/commit-selection.d.ts.map +0 -1
- package/dist/Git/commit-selection.js +0 -47
- package/dist/Git/commit-selection.js.map +0 -1
- package/dist/Git/git-clone-utils.d.ts +0 -8
- package/dist/Git/git-clone-utils.d.ts.map +0 -1
- package/dist/Git/git-clone-utils.js +0 -26
- package/dist/Git/git-clone-utils.js.map +0 -1
- package/dist/Git/git-status.d.ts +0 -24
- package/dist/Git/git-status.d.ts.map +0 -1
- package/dist/Git/git-status.js +0 -105
- package/dist/Git/git-status.js.map +0 -1
- package/dist/Git/useGit.d.ts +0 -15
- package/dist/Git/useGit.d.ts.map +0 -1
- package/dist/Git/useGit.js +0 -206
- package/dist/Git/useGit.js.map +0 -1
- package/dist/Git/useGitStatus.d.ts +0 -17
- package/dist/Git/useGitStatus.d.ts.map +0 -1
- package/dist/Git/useGitStatus.js +0 -63
- package/dist/Git/useGitStatus.js.map +0 -1
- package/dist/GitToolbarControl-LMIR4R7I.js.map +0 -1
- package/dist/GitUI-KGF5MSNV.js.map +0 -1
- package/dist/Settings/Settings.d.ts +0 -23
- package/dist/Settings/Settings.d.ts.map +0 -1
- package/dist/Settings/Settings.js +0 -22
- package/dist/Settings/Settings.js.map +0 -1
- package/dist/Settings/public-api.d.ts +0 -3
- package/dist/Settings/public-api.d.ts.map +0 -1
- package/dist/Settings/public-api.js +0 -2
- package/dist/Settings/public-api.js.map +0 -1
- package/dist/WorkspacePicker/WorkspacePicker.d.ts +0 -22
- package/dist/WorkspacePicker/WorkspacePicker.d.ts.map +0 -1
- package/dist/WorkspacePicker/WorkspacePicker.js +0 -74
- package/dist/WorkspacePicker/WorkspacePicker.js.map +0 -1
- package/dist/WorkspacePicker/WorkspaceSettingsButton.d.ts +0 -11
- package/dist/WorkspacePicker/WorkspaceSettingsButton.d.ts.map +0 -1
- package/dist/WorkspacePicker/WorkspaceSettingsButton.js +0 -27
- package/dist/WorkspacePicker/WorkspaceSettingsButton.js.map +0 -1
- package/dist/WorkspacePicker/WorkspaceSettingsDialog.d.ts +0 -20
- package/dist/WorkspacePicker/WorkspaceSettingsDialog.d.ts.map +0 -1
- package/dist/WorkspacePicker/WorkspaceSettingsDialog.js +0 -36
- package/dist/WorkspacePicker/WorkspaceSettingsDialog.js.map +0 -1
- package/dist/WorkspacePicker/index.d.ts +0 -3
- package/dist/WorkspacePicker/index.d.ts.map +0 -1
- package/dist/WorkspacePicker/index.js +0 -2
- package/dist/WorkspacePicker/index.js.map +0 -1
- package/dist/chunk-3SAXDU2U.js +0 -157
- package/dist/chunk-3SAXDU2U.js.map +0 -1
- package/dist/chunk-AOVTHZU7.js +0 -321
- package/dist/chunk-AOVTHZU7.js.map +0 -1
- package/dist/chunk-GSNZSCIK.js +0 -55
- package/dist/chunk-GSNZSCIK.js.map +0 -1
- package/dist/components/Dialog.d.ts +0 -22
- package/dist/components/Dialog.d.ts.map +0 -1
- package/dist/components/Dialog.js +0 -33
- package/dist/components/Dialog.js.map +0 -1
- package/dist/editor.d.ts.map +0 -1
- package/dist/hooks/index.d.ts +0 -3
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useDocumentSession.d.ts +0 -16
- package/dist/hooks/useDocumentSession.d.ts.map +0 -1
- package/dist/hooks/useDocumentSession.js +0 -18
- package/dist/hooks/useDocumentSession.js.map +0 -1
- package/dist/icons.d.ts +0 -12
- package/dist/icons.d.ts.map +0 -1
- package/dist/icons.js +0 -28
- package/dist/icons.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/preferences/theme.d.ts +0 -18
- package/dist/preferences/theme.d.ts.map +0 -1
- package/dist/preferences/theme.js +0 -63
- package/dist/preferences/theme.js.map +0 -1
- package/dist/preferences/versioning.d.ts +0 -27
- package/dist/preferences/versioning.d.ts.map +0 -1
- package/dist/preferences/versioning.js +0 -62
- package/dist/preferences/versioning.js.map +0 -1
- package/dist/provider-lease.d.ts +0 -10
- package/dist/provider-lease.d.ts.map +0 -1
- package/dist/provider-lease.js +0 -42
- package/dist/provider-lease.js.map +0 -1
- package/src/AppMenu/AppMenu.tsx +0 -334
- package/src/AppMenu/index.ts +0 -2
- package/src/DocBlocksShell/DocBlocksShell.tsx +0 -3398
- package/src/DocBlocksShell/LazyEditorShell.ts +0 -2
- package/src/DocBlocksShell/UpdateAvailableNotice.tsx +0 -60
- package/src/DocBlocksShell/document-title.ts +0 -19
- package/src/DocBlocksShell/index.ts +0 -2
- package/src/DocBlocksShell/workspace-authority-barrier.ts +0 -26
- package/src/Export/DeferredExportToolbarControls.tsx +0 -23
- package/src/Export/ExportDialog.tsx +0 -437
- package/src/Export/ExportToolbarControls.tsx +0 -511
- package/src/Export/export-destination.ts +0 -30
- package/src/Export/export-options.ts +0 -99
- package/src/Export/index.ts +0 -19
- package/src/Export/public-api.ts +0 -17
- package/src/Export/run-export.ts +0 -374
- package/src/Export/transform-summaries.ts +0 -14
- package/src/FileExplorer/FileExplorer.tsx +0 -528
- package/src/FileExplorer/FileTreeNode.tsx +0 -306
- package/src/FileExplorer/index.ts +0 -5
- package/src/FileExplorer/useFileTree.ts +0 -352
- package/src/Git/GitAuthGuidanceDialog.tsx +0 -84
- package/src/Git/GitBranchesDialog.tsx +0 -144
- package/src/Git/GitCloneDialog.tsx +0 -200
- package/src/Git/GitCommitDialog.tsx +0 -119
- package/src/Git/GitConflictsDialog.tsx +0 -62
- package/src/Git/GitContext.tsx +0 -88
- package/src/Git/GitDiffDialog.tsx +0 -147
- package/src/Git/GitDiffView.tsx +0 -105
- package/src/Git/GitHistoryDialog.tsx +0 -195
- package/src/Git/GitStatusBar.tsx +0 -157
- package/src/Git/GitToolbarControl.tsx +0 -123
- package/src/Git/GitUI.tsx +0 -68
- package/src/Git/commit-selection.ts +0 -63
- package/src/Git/git-clone-utils.ts +0 -23
- package/src/Git/git-status.ts +0 -113
- package/src/Git/useGit.ts +0 -279
- package/src/Git/useGitStatus.ts +0 -78
- package/src/Settings/Settings.tsx +0 -118
- package/src/Settings/public-api.ts +0 -8
- package/src/WorkspacePicker/WorkspacePicker.tsx +0 -191
- package/src/WorkspacePicker/WorkspaceSettingsButton.tsx +0 -88
- package/src/WorkspacePicker/WorkspaceSettingsDialog.tsx +0 -121
- package/src/WorkspacePicker/index.ts +0 -2
- package/src/components/Dialog.tsx +0 -81
- package/src/editor.ts +0 -72
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useDocumentSession.ts +0 -37
- package/src/icons.tsx +0 -48
- package/src/index.ts +0 -61
- package/src/preferences/theme.ts +0 -67
- package/src/preferences/versioning.ts +0 -69
- package/src/provider-lease.ts +0 -52
- package/src/types/pwa-dom.d.ts +0 -31
- /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-
|
|
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(
|
|
31
|
-
|
|
32
|
-
|
|
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(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
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
|
-
|
|
175
|
-
|
|
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
|
|
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
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
return
|
|
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
|
|
187
|
-
const
|
|
221
|
+
function setAllOverrides(selection, value) {
|
|
222
|
+
const next = /* @__PURE__ */ new Map();
|
|
188
223
|
for (const key of selection.included.keys()) {
|
|
189
|
-
|
|
224
|
+
if (!selection.locked.has(key)) next.set(key, value);
|
|
190
225
|
}
|
|
191
|
-
return
|
|
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 [
|
|
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 =
|
|
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
|
-
|
|
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: () =>
|
|
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
|
|
268
|
-
const checked =
|
|
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
|
-
|
|
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(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
|
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 =
|
|
569
|
-
const editorRef =
|
|
570
|
-
const modelsRef =
|
|
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
|
|
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
|
|
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
|
-
|
|
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 =
|
|
814
|
-
const urlInputRef =
|
|
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-
|
|
1133
|
+
//# sourceMappingURL=GitUI-VHOBQY43.js.map
|