vzcode 1.42.0 → 1.44.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/dist/assets/bindings_wasm_bg-CH5ekNIA.wasm +0 -0
- package/dist/assets/{buildWorker-B-vXZ9gA.js → buildWorker-CRLuRnCr.js} +100 -58
- package/dist/assets/{index-CP9o_hN5.css → index-Beqaj63x.css} +1 -1
- package/dist/assets/index-C46Hp5ym.js +340 -0
- package/dist/assets/worker-BeBZGG1n.js +136 -0
- package/dist/index.html +2 -2
- package/package.json +15 -15
- package/src/client/ImageViewer/index.tsx +91 -0
- package/src/client/ImageViewer/style.scss +41 -0
- package/src/client/VZCodeContext.tsx +27 -6
- package/src/client/VZMiddle.tsx +22 -7
- package/src/client/VZRight.tsx +6 -1
- package/src/client/VZSidebar/aiCopyPaste.ts +55 -0
- package/src/client/VZSidebar/index.tsx +18 -1
- package/src/client/VZSidebar/styles.scss +9 -0
- package/src/client/VZSidebar/useDragAndDrop.tsx +133 -8
- package/src/client/useRuntimeError.ts +32 -0
- package/src/client/utils/isImageFile.ts +12 -0
- package/dist/assets/bindings_wasm_bg-BQfW5T_2.wasm +0 -0
- package/dist/assets/index-kPLgjbcb.js +0 -329
- package/dist/assets/worker-CkHcCP1n.js +0 -136
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
// Custom hook to manage runtime error state
|
|
4
|
+
export const useRuntimeError = () => {
|
|
5
|
+
// State to hold the runtime error message
|
|
6
|
+
// `null` means no errors
|
|
7
|
+
// If this is a string, it's the
|
|
8
|
+
// error message from runtime execution.
|
|
9
|
+
const [runtimeError, setRuntimeError] = useState<
|
|
10
|
+
string | null
|
|
11
|
+
>(null);
|
|
12
|
+
|
|
13
|
+
// Callback function to handle runtime errors
|
|
14
|
+
// This will be passed to the createRuntime function
|
|
15
|
+
const handleRuntimeError = useCallback(
|
|
16
|
+
(formattedErrorMessage: string) => {
|
|
17
|
+
setRuntimeError(formattedErrorMessage);
|
|
18
|
+
},
|
|
19
|
+
[],
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
// Function to clear runtime errors
|
|
23
|
+
const clearRuntimeError = useCallback(() => {
|
|
24
|
+
setRuntimeError(null);
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
runtimeError,
|
|
29
|
+
handleRuntimeError,
|
|
30
|
+
clearRuntimeError,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility function to check if a file is an image based on its name.
|
|
3
|
+
* @param fileName - The name of the file (e.g., "image.png", "photo.jpg")
|
|
4
|
+
* @returns true if the file is an image, false otherwise
|
|
5
|
+
*/
|
|
6
|
+
export const isImageFile = (fileName: string): boolean => {
|
|
7
|
+
return (
|
|
8
|
+
fileName.match(
|
|
9
|
+
/\.(png|jpg|jpeg|gif|bmp|svg|webp)$/i,
|
|
10
|
+
) !== null
|
|
11
|
+
);
|
|
12
|
+
};
|
|
Binary file
|