vzcode 0.87.0 → 0.89.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 +2 -20
- package/dist/assets/{index-DubfLBmh.js → index-C4h28erw.js} +57 -57
- package/dist/assets/{index-B4X7yIz8.js → index-pzvwg1lq.js} +58 -58
- package/dist/assets/{worker-DHoGVnSk.js → worker-BIf7QrAH.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +13 -13
- package/src/client/Icons/QuestionMarkSVG.tsx +18 -0
- package/src/client/Icons/index.tsx +1 -0
- package/src/client/SplitPaneResizeContext.tsx +1 -1
- package/src/client/VZCodeContext.tsx +11 -0
- package/src/client/VZKeyboardShortcutsDoc.tsx +121 -0
- package/src/client/VZLeft.tsx +4 -0
- package/src/client/VZSettings.tsx +41 -51
- package/src/client/VZSidebar/CreateDirModal.tsx +14 -2
- package/src/client/VZSidebar/CreateFileModal.tsx +14 -2
- package/src/client/VZSidebar/index.tsx +49 -36
- package/src/client/index.ts +1 -0
- package/src/client/useActions.ts +16 -0
- package/src/client/vzReducer/createInitialState.ts +1 -0
- package/src/client/vzReducer/index.ts +5 -0
- package/src/client/vzReducer/setIsDocOpenReducer.ts +9 -0
- package/src/client/featureFlags.js +0 -4
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useCallback,
|
|
3
|
-
useContext,
|
|
4
|
-
useEffect,
|
|
5
|
-
useMemo,
|
|
6
|
-
} from 'react';
|
|
1
|
+
import { useCallback, useContext, useMemo } from 'react';
|
|
7
2
|
import {
|
|
8
3
|
FileId,
|
|
9
4
|
FileTree,
|
|
@@ -12,9 +7,15 @@ import {
|
|
|
12
7
|
import { Tooltip, OverlayTrigger } from '../bootstrap';
|
|
13
8
|
import { getFileTree } from '../getFileTree';
|
|
14
9
|
import { sortFileTree } from '../sortFileTree';
|
|
15
|
-
import { disableSettings } from '../featureFlags';
|
|
16
10
|
import { SplitPaneResizeContext } from '../SplitPaneResizeContext';
|
|
17
|
-
import { BugSVG, GearSVG, NewSVG
|
|
11
|
+
import { BugSVG, GearSVG, NewSVG } from '../Icons';
|
|
12
|
+
import {
|
|
13
|
+
BugSVG,
|
|
14
|
+
GearSVG,
|
|
15
|
+
NewSVG,
|
|
16
|
+
FileSVG,
|
|
17
|
+
QuestionMarkSVG,
|
|
18
|
+
} from '../Icons';
|
|
18
19
|
import { Listing } from './Listing';
|
|
19
20
|
import { VZCodeContext } from '../VZCodeContext';
|
|
20
21
|
import { useDragAndDrop } from './useDragAndDrop';
|
|
@@ -29,24 +30,20 @@ export const VZSidebar = ({
|
|
|
29
30
|
createFileTooltipText = 'New File',
|
|
30
31
|
createDirTooltipText = 'New Directory',
|
|
31
32
|
openSettingsTooltipText = 'Open Settings',
|
|
33
|
+
openKeyboardShortcuts = 'Keyboard Shortcuts',
|
|
32
34
|
reportBugTooltipText = 'Report Bug',
|
|
33
35
|
}: {
|
|
34
36
|
createFileTooltipText?: string;
|
|
35
37
|
createDirTooltipText?: string;
|
|
36
38
|
openSettingsTooltipText?: string;
|
|
37
39
|
reportBugTooltipText?: string;
|
|
40
|
+
openKeyboardShortcuts?: string;
|
|
38
41
|
}) => {
|
|
39
42
|
const {
|
|
40
43
|
files,
|
|
41
|
-
renameFile,
|
|
42
|
-
deleteFile,
|
|
43
|
-
renameDirectory,
|
|
44
|
-
deleteDirectory,
|
|
45
|
-
activeFileId,
|
|
46
44
|
openTab,
|
|
47
45
|
setIsSettingsOpen,
|
|
48
|
-
|
|
49
|
-
toggleDirectory,
|
|
46
|
+
setIsDocOpen,
|
|
50
47
|
handleOpenCreateFileModal,
|
|
51
48
|
handleOpenCreateDirModal,
|
|
52
49
|
connected,
|
|
@@ -56,7 +53,9 @@ export const VZSidebar = ({
|
|
|
56
53
|
() => (files ? sortFileTree(getFileTree(files)) : null),
|
|
57
54
|
[files],
|
|
58
55
|
);
|
|
59
|
-
|
|
56
|
+
const handleQuestionMarkClick = useCallback(() => {
|
|
57
|
+
setIsDocOpen(true);
|
|
58
|
+
}, []);
|
|
60
59
|
const handleSettingsClick = useCallback(() => {
|
|
61
60
|
setIsSettingsOpen(true);
|
|
62
61
|
}, []);
|
|
@@ -106,12 +105,26 @@ export const VZSidebar = ({
|
|
|
106
105
|
>
|
|
107
106
|
<div className="files">
|
|
108
107
|
<div className="full-box">
|
|
109
|
-
<div className="sidebar-section-hint">
|
|
110
|
-
Project Files
|
|
111
|
-
</div>
|
|
108
|
+
<div className="sidebar-section-hint">Files</div>
|
|
112
109
|
<div className="sidebar-section-buttons">
|
|
113
110
|
<OverlayTrigger
|
|
114
|
-
placement="
|
|
111
|
+
placement="right"
|
|
112
|
+
overlay={
|
|
113
|
+
<Tooltip id="open-keyboard-shortcuts">
|
|
114
|
+
{openKeyboardShortcuts}
|
|
115
|
+
</Tooltip>
|
|
116
|
+
}
|
|
117
|
+
>
|
|
118
|
+
<i
|
|
119
|
+
onClick={handleQuestionMarkClick}
|
|
120
|
+
className="icon-button icon-button-dark"
|
|
121
|
+
>
|
|
122
|
+
<QuestionMarkSVG />
|
|
123
|
+
</i>
|
|
124
|
+
</OverlayTrigger>
|
|
125
|
+
|
|
126
|
+
<OverlayTrigger
|
|
127
|
+
placement="right"
|
|
115
128
|
overlay={
|
|
116
129
|
<Tooltip id="report-bug-tooltip">
|
|
117
130
|
{reportBugTooltipText}
|
|
@@ -128,23 +141,23 @@ export const VZSidebar = ({
|
|
|
128
141
|
</i>
|
|
129
142
|
</a>
|
|
130
143
|
</OverlayTrigger>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
144
|
+
|
|
145
|
+
<OverlayTrigger
|
|
146
|
+
placement="left"
|
|
147
|
+
overlay={
|
|
148
|
+
<Tooltip id="open-settings-tooltip">
|
|
149
|
+
{openSettingsTooltipText}
|
|
150
|
+
</Tooltip>
|
|
151
|
+
}
|
|
152
|
+
>
|
|
153
|
+
<i
|
|
154
|
+
onClick={handleSettingsClick}
|
|
155
|
+
className="icon-button icon-button-dark"
|
|
139
156
|
>
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
<GearSVG />
|
|
145
|
-
</i>
|
|
146
|
-
</OverlayTrigger>
|
|
147
|
-
)}
|
|
157
|
+
<GearSVG />
|
|
158
|
+
</i>
|
|
159
|
+
</OverlayTrigger>
|
|
160
|
+
|
|
148
161
|
<OverlayTrigger
|
|
149
162
|
placement="left"
|
|
150
163
|
overlay={
|
package/src/client/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type { EditorCache } from './useEditorCache';
|
|
|
4
4
|
export { VZCodeProvider } from './VZCodeContext';
|
|
5
5
|
export { VZSidebar } from './VZSidebar';
|
|
6
6
|
export { VZSettings } from './VZSettings';
|
|
7
|
+
export { VZKeyboardShortcutsDoc } from './VZKeyboardShortcutsDoc';
|
|
7
8
|
export { VZResizer } from './VZResizer';
|
|
8
9
|
export { VZLeft } from './VZLeft';
|
|
9
10
|
export { VZMiddle } from './VZMiddle';
|
package/src/client/useActions.ts
CHANGED
|
@@ -68,10 +68,24 @@ export const useActions = (
|
|
|
68
68
|
[dispatch],
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
+
const setIsDocOpen = useCallback(
|
|
72
|
+
(value: boolean) => {
|
|
73
|
+
dispatch({
|
|
74
|
+
type: 'set_is_doc_open',
|
|
75
|
+
value: value,
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
[dispatch],
|
|
79
|
+
);
|
|
80
|
+
|
|
71
81
|
const closeSettings = useCallback(() => {
|
|
72
82
|
setIsSettingsOpen(false);
|
|
73
83
|
}, [setIsSettingsOpen]);
|
|
74
84
|
|
|
85
|
+
const closeDoc = useCallback(() => {
|
|
86
|
+
setIsDocOpen(false);
|
|
87
|
+
}, [setIsDocOpen]);
|
|
88
|
+
|
|
75
89
|
const editorNoLongerWantsFocus = useCallback(() => {
|
|
76
90
|
dispatch({
|
|
77
91
|
type: 'editor_no_longer_wants_focus',
|
|
@@ -96,7 +110,9 @@ export const useActions = (
|
|
|
96
110
|
closeTabs,
|
|
97
111
|
setTheme,
|
|
98
112
|
setIsSettingsOpen,
|
|
113
|
+
setIsDocOpen,
|
|
99
114
|
closeSettings,
|
|
115
|
+
closeDoc,
|
|
100
116
|
editorNoLongerWantsFocus,
|
|
101
117
|
setUsername,
|
|
102
118
|
};
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
setActiveFileRightReducer,
|
|
9
9
|
} from './setActiveFileLeftRightReducer';
|
|
10
10
|
import { setIsSettingsOpenReducer } from './setIsSettingsOpenReducer';
|
|
11
|
+
import { setIsDocOpenReducer } from './setIsDocOpenReducer';
|
|
11
12
|
import { setThemeReducer } from './setThemeReducer';
|
|
12
13
|
import { editorNoLongerWantsFocusReducer } from './editorNoLongerWantsFocusReducer';
|
|
13
14
|
import { setUsernameReducer } from './setUsernameReducer';
|
|
@@ -29,6 +30,8 @@ export type VZState = {
|
|
|
29
30
|
// True to show the settings modal.
|
|
30
31
|
isSettingsOpen: boolean;
|
|
31
32
|
|
|
33
|
+
isDocOpen: boolean;
|
|
34
|
+
|
|
32
35
|
// True if the editor should focus on the next render.
|
|
33
36
|
editorWantsFocus: boolean;
|
|
34
37
|
|
|
@@ -68,6 +71,7 @@ export type VZAction =
|
|
|
68
71
|
// `set_is_settings_open`
|
|
69
72
|
// * Sets whether the settings modal is open.
|
|
70
73
|
| { type: 'set_is_settings_open'; value: boolean }
|
|
74
|
+
| { type: 'set_is_doc_open'; value: boolean }
|
|
71
75
|
|
|
72
76
|
// `editor_no_longer_wants_focus`
|
|
73
77
|
// * Sets `editorWantsFocus` to `false`.
|
|
@@ -104,6 +108,7 @@ const reducers = [
|
|
|
104
108
|
closeTabsReducer,
|
|
105
109
|
setThemeReducer,
|
|
106
110
|
setIsSettingsOpenReducer,
|
|
111
|
+
setIsDocOpenReducer,
|
|
107
112
|
editorNoLongerWantsFocusReducer,
|
|
108
113
|
setUsernameReducer,
|
|
109
114
|
];
|