vzcode 0.71.0 → 0.73.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 +1 -1
- package/dist/assets/index-CpIQ8AoQ.css +1 -0
- package/dist/assets/index-DGGHVX25.js +147 -0
- package/dist/assets/worker-BCgDdjKY.js +400 -0
- package/dist/assets/{worker-DoodSOTA.js → worker-Cy8ajBgn.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +27 -27
- package/src/client/App/index.tsx +2 -0
- package/src/client/App/style.scss +6 -0
- package/src/client/App/useShareDB.ts +12 -0
- package/src/client/CodeEditor/style.scss +4 -0
- package/src/client/Fonts/fonts.ts +8 -0
- package/src/client/VZCodeContext.tsx +13 -0
- package/src/client/VZSettings.tsx +96 -7
- package/src/client/VZSidebar/DirectoryListing.tsx +13 -4
- package/src/client/VZSidebar/Item.tsx +4 -2
- package/src/client/VZSidebar/Listing.tsx +7 -0
- package/src/client/VZSidebar/index.tsx +16 -5
- package/src/client/VZSidebar/styles.scss +13 -11
- package/src/client/useFileCRUD.ts +42 -1
- package/src/client/useTypeScript/worker.ts +55 -33
- package/dist/assets/index-B4YHcAhs.css +0 -1
- package/dist/assets/index-HJAv0wn0.js +0 -147
- package/dist/assets/worker-D0nKlL79.js +0 -400
|
@@ -131,18 +131,20 @@
|
|
|
131
131
|
display: flex;
|
|
132
132
|
justify-content: space-between;
|
|
133
133
|
padding: 10px;
|
|
134
|
-
|
|
134
|
+
font-size: 12px;
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
.connection-status-indicator {
|
|
137
|
+
width: 16px;
|
|
138
|
+
height: 16px;
|
|
139
|
+
border-radius: 50%;
|
|
140
|
+
|
|
141
|
+
&.connected {
|
|
142
|
+
background-color: var(--vh-color-success-01);
|
|
143
|
+
}
|
|
141
144
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
background-color: #34eb52;
|
|
145
|
+
&.disconnected {
|
|
146
|
+
background-color: var(--vh-color-warning-01);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
147
149
|
}
|
|
148
150
|
}
|
|
@@ -54,7 +54,13 @@ export const useFileCRUD = ({
|
|
|
54
54
|
...document.files,
|
|
55
55
|
[fileId]: {
|
|
56
56
|
...document.files[fileId],
|
|
57
|
-
name:
|
|
57
|
+
name:
|
|
58
|
+
document.files[fileId].name.substring(
|
|
59
|
+
0,
|
|
60
|
+
document.files[fileId].name.lastIndexOf(
|
|
61
|
+
'/',
|
|
62
|
+
) + 1,
|
|
63
|
+
) + newName,
|
|
58
64
|
},
|
|
59
65
|
},
|
|
60
66
|
}));
|
|
@@ -62,6 +68,40 @@ export const useFileCRUD = ({
|
|
|
62
68
|
[submitOperation],
|
|
63
69
|
);
|
|
64
70
|
|
|
71
|
+
// Renames a directory
|
|
72
|
+
const renameDirectory = useCallback(
|
|
73
|
+
(
|
|
74
|
+
path: FileTreePath,
|
|
75
|
+
oldName: string,
|
|
76
|
+
newName: string,
|
|
77
|
+
) => {
|
|
78
|
+
submitOperation((document: VZCodeContent) => {
|
|
79
|
+
const updatedFiles = Object.keys(
|
|
80
|
+
document.files,
|
|
81
|
+
).reduce((acc, key) => {
|
|
82
|
+
const file = document.files[key];
|
|
83
|
+
const fileName = file.name;
|
|
84
|
+
if (fileName.includes(path)) {
|
|
85
|
+
const oldNamePos = fileName.indexOf(oldName);
|
|
86
|
+
const fileNewName =
|
|
87
|
+
fileName.substring(0, oldNamePos) +
|
|
88
|
+
newName +
|
|
89
|
+
fileName.substring(
|
|
90
|
+
oldNamePos + oldName.length,
|
|
91
|
+
);
|
|
92
|
+
acc[key] = { ...file, name: fileNewName };
|
|
93
|
+
} else {
|
|
94
|
+
acc[key] = file;
|
|
95
|
+
}
|
|
96
|
+
return acc;
|
|
97
|
+
}, {});
|
|
98
|
+
|
|
99
|
+
return { ...document, files: updatedFiles };
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
[submitOperation],
|
|
103
|
+
);
|
|
104
|
+
|
|
65
105
|
// Deletes a file
|
|
66
106
|
const deleteFile = useCallback(
|
|
67
107
|
(fileId: FileId) => {
|
|
@@ -98,6 +138,7 @@ export const useFileCRUD = ({
|
|
|
98
138
|
createFile,
|
|
99
139
|
renameFile,
|
|
100
140
|
deleteFile,
|
|
141
|
+
renameDirectory,
|
|
101
142
|
deleteDirectory,
|
|
102
143
|
};
|
|
103
144
|
};
|
|
@@ -16,7 +16,7 @@ const debug = false;
|
|
|
16
16
|
// to support TypeScript completions on non-TS files.
|
|
17
17
|
const getTSFileName = (fileName: string) => {
|
|
18
18
|
if (fileName.endsWith('.js')) {
|
|
19
|
-
return fileName.replace('.js', '.
|
|
19
|
+
return fileName.replace('.js', '.tsx');
|
|
20
20
|
}
|
|
21
21
|
if (fileName.endsWith('.jsx')) {
|
|
22
22
|
return fileName.replace('.jsx', '.tsx');
|
|
@@ -38,6 +38,21 @@ const initializeFileSystem = async () => {
|
|
|
38
38
|
}
|
|
39
39
|
const compilerOptions: ts.CompilerOptions = {
|
|
40
40
|
lib: ['dom', 'esnext'],
|
|
41
|
+
|
|
42
|
+
// Disable warnings around "Any type".
|
|
43
|
+
noImplicitAny: false,
|
|
44
|
+
|
|
45
|
+
// Disable warnings around "Implicit any in parameter".
|
|
46
|
+
noImplicitThis: false,
|
|
47
|
+
|
|
48
|
+
// Allow JavaScript files to be processed
|
|
49
|
+
allowJs: true,
|
|
50
|
+
|
|
51
|
+
// Disable type checking for JavaScript files
|
|
52
|
+
// checkJs: false,
|
|
53
|
+
|
|
54
|
+
// Skip type checking of declaration files
|
|
55
|
+
skipLibCheck: true,
|
|
41
56
|
};
|
|
42
57
|
|
|
43
58
|
// `true` breaks in a Web Worker because
|
|
@@ -219,39 +234,46 @@ onmessage = async ({ data }) => {
|
|
|
219
234
|
|
|
220
235
|
// Be less aggressive for non-TS files,
|
|
221
236
|
// e.g. files that end in .js or .jsx.
|
|
222
|
-
if (!isTS(fileName)) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
error.code !== LINT_ERROR_CODE_ANY_PARAM &&
|
|
251
|
-
error.code !== LINT_ERROR_CODE_ANY_TYPE &&
|
|
252
|
-
error.code !== LINT_ERROR_CODE_ANY_TYPE_KEYS,
|
|
253
|
-
);
|
|
237
|
+
// if (!isTS(fileName)) {
|
|
238
|
+
// This code is for errors like:
|
|
239
|
+
// "Binding element 'data' implicitly has an 'any' type."
|
|
240
|
+
const LINT_ERROR_CODE_ANY = 7031;
|
|
241
|
+
|
|
242
|
+
// This code is for errors like:
|
|
243
|
+
// "Parameter 'selection' implicitly has an 'any' type.""
|
|
244
|
+
const LINT_ERROR_CODE_ANY_PARAM = 7006;
|
|
245
|
+
|
|
246
|
+
// This code is for errors like:
|
|
247
|
+
// "Cannot find module 'd3' or its corresponding type declarations."
|
|
248
|
+
const LINT_ERROR_CODE_IMPORT = 2307;
|
|
249
|
+
|
|
250
|
+
// This code is for errors like:
|
|
251
|
+
// "Variable 'mic' implicitly has type 'any' in some locations where its type cannot be determined."
|
|
252
|
+
const LINT_ERROR_CODE_ANY_TYPE = 7034;
|
|
253
|
+
|
|
254
|
+
// "Element implicitly has an 'any' type because expression
|
|
255
|
+
// of type '"test"' can't be used to index type '{}'."
|
|
256
|
+
const LINT_ERROR_CODE_ANY_TYPE_KEYS = 7053;
|
|
257
|
+
|
|
258
|
+
// "Property 'id' does not exist on type { ... }"
|
|
259
|
+
// Happens on objects with dynamic keys.
|
|
260
|
+
// Not valid in TypeScript, but common in JavaScript.
|
|
261
|
+
const LINT_ERROR_CODE_NON_EXISTENT_PROPERTY = 2339;
|
|
262
|
+
|
|
263
|
+
if (debug) {
|
|
264
|
+
console.log(tsErrors);
|
|
254
265
|
}
|
|
266
|
+
tsErrors = tsErrors.filter(
|
|
267
|
+
(error: { code: number }) =>
|
|
268
|
+
error.code !== LINT_ERROR_CODE_ANY &&
|
|
269
|
+
error.code !== LINT_ERROR_CODE_IMPORT &&
|
|
270
|
+
error.code !== LINT_ERROR_CODE_ANY_PARAM &&
|
|
271
|
+
error.code !== LINT_ERROR_CODE_ANY_TYPE &&
|
|
272
|
+
error.code !== LINT_ERROR_CODE_ANY_TYPE_KEYS &&
|
|
273
|
+
error.code !==
|
|
274
|
+
LINT_ERROR_CODE_NON_EXISTENT_PROPERTY,
|
|
275
|
+
);
|
|
276
|
+
// }
|
|
255
277
|
tsErrors = convertToCodeMirrorDiagnostic(tsErrors);
|
|
256
278
|
}
|
|
257
279
|
|