@gradio/upload 0.7.4 → 0.7.5
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/CHANGELOG.md +7 -1
- package/package.json +6 -6
- package/src/Upload.svelte +17 -9
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# @gradio/upload
|
2
2
|
|
3
|
+
## 0.7.5
|
4
|
+
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
- [#7559](https://github.com/gradio-app/gradio/pull/7559) [`26356a6`](https://github.com/gradio-app/gradio/commit/26356a623c4196f48ca236d973a597831743cdb8) - Fixes: Invalid file_type breaks drag and drop. Thanks [@dawoodkhan82](https://github.com/dawoodkhan82)!
|
8
|
+
|
3
9
|
## 0.7.4
|
4
10
|
|
5
11
|
### Patch Changes
|
@@ -354,4 +360,4 @@ From the backend, streamed outputs are served from the `/stream/` endpoint inste
|
|
354
360
|
### Patch Changes
|
355
361
|
|
356
362
|
- Updated dependencies []:
|
357
|
-
- @gradio/atoms@0.0.2
|
363
|
+
- @gradio/atoms@0.0.2
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/upload",
|
3
|
-
"version": "0.7.
|
3
|
+
"version": "0.7.5",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
6
|
"main": "src/index.ts",
|
@@ -8,11 +8,11 @@
|
|
8
8
|
"license": "ISC",
|
9
9
|
"dependencies": {
|
10
10
|
"@gradio/atoms": "^0.5.3",
|
11
|
-
"@gradio/client": "^0.12.
|
12
|
-
"@gradio/upload": "^0.7.
|
13
|
-
"@gradio/
|
14
|
-
"@gradio/wasm": "^0.
|
15
|
-
"@gradio/
|
11
|
+
"@gradio/client": "^0.12.2",
|
12
|
+
"@gradio/upload": "^0.7.5",
|
13
|
+
"@gradio/icons": "^0.3.3",
|
14
|
+
"@gradio/wasm": "^0.7.0",
|
15
|
+
"@gradio/utils": "^0.3.0"
|
16
16
|
},
|
17
17
|
"main_changeset": true,
|
18
18
|
"exports": {
|
package/src/Upload.svelte
CHANGED
@@ -25,19 +25,27 @@
|
|
25
25
|
const upload_fn = getContext<typeof upload_files>("upload_files");
|
26
26
|
|
27
27
|
let hidden_upload: HTMLInputElement;
|
28
|
-
|
29
28
|
const dispatch = createEventDispatcher();
|
30
|
-
|
31
|
-
|
29
|
+
const validFileTypes = ["image", "video", "audio", "text", "file"];
|
30
|
+
const processFileType = (type: string): string => {
|
31
|
+
if (type.startsWith(".")) {
|
32
|
+
return type;
|
33
|
+
}
|
34
|
+
if (validFileTypes.includes(type)) {
|
35
|
+
return type + "/*";
|
36
|
+
}
|
37
|
+
return "." + type;
|
38
|
+
};
|
39
|
+
|
40
|
+
$: if (filetype == null) {
|
41
|
+
accept_file_types = null;
|
42
|
+
} else if (typeof filetype === "string") {
|
43
|
+
accept_file_types = processFileType(filetype);
|
32
44
|
} else {
|
33
|
-
filetype = filetype.map(
|
34
|
-
if (x.startsWith(".")) {
|
35
|
-
return x;
|
36
|
-
}
|
37
|
-
return x + "/*";
|
38
|
-
});
|
45
|
+
filetype = filetype.map(processFileType);
|
39
46
|
accept_file_types = filetype.join(", ");
|
40
47
|
}
|
48
|
+
|
41
49
|
function updateDragging(): void {
|
42
50
|
dragging = !dragging;
|
43
51
|
}
|