@gradio/uploadbutton 0.3.5 → 0.4.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/CHANGELOG.md +7 -1
- package/package.json +5 -5
- package/shared/UploadButton.svelte +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @gradio/uploadbutton
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- [#6897](https://github.com/gradio-app/gradio/pull/6897) [`fb9c6ca`](https://github.com/gradio-app/gradio/commit/fb9c6cacd7ca4598c000f1f97d7d39a8c4463519) - Lite: Chatbot. Thanks [@whitphx](https://github.com/whitphx)!
|
|
8
|
+
|
|
3
9
|
## 0.3.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -252,4 +258,4 @@ Thanks [@pngwn](https://github.com/pngwn)!
|
|
|
252
258
|
- Updated dependencies [[`61129052`](https://github.com/gradio-app/gradio/commit/61129052ed1391a75c825c891d57fa0ad6c09fc8), [`667875b2`](https://github.com/gradio-app/gradio/commit/667875b2441753e74d25bd9d3c8adedd8ede11cd), [`67265a58`](https://github.com/gradio-app/gradio/commit/67265a58027ef1f9e4c0eb849a532f72eaebde48), [`8b4eb8ca`](https://github.com/gradio-app/gradio/commit/8b4eb8cac9ea07bde31b44e2006ca2b7b5f4de36), [`37caa2e0`](https://github.com/gradio-app/gradio/commit/37caa2e0fe95d6cab8beb174580fb557904f137f)]:
|
|
253
259
|
- @gradio/client@0.2.0
|
|
254
260
|
- @gradio/upload@0.0.3
|
|
255
|
-
- @gradio/button@0.1.0
|
|
261
|
+
- @gradio/button@0.1.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/uploadbutton",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Gradio UI packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"main": "./Index.svelte",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@gradio/
|
|
17
|
-
"@gradio/
|
|
18
|
-
"@gradio/
|
|
19
|
-
"@gradio/
|
|
16
|
+
"@gradio/button": "^0.2.15",
|
|
17
|
+
"@gradio/client": "^0.10.0",
|
|
18
|
+
"@gradio/upload": "^0.5.8",
|
|
19
|
+
"@gradio/utils": "^0.2.0"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { tick, createEventDispatcher } from "svelte";
|
|
2
|
+
import { tick, createEventDispatcher, getContext } from "svelte";
|
|
3
3
|
import { BaseButton } from "@gradio/button";
|
|
4
4
|
import {
|
|
5
5
|
upload,
|
|
6
6
|
prepare_files,
|
|
7
7
|
type FileData,
|
|
8
|
-
get_fetchable_url_or_file
|
|
8
|
+
get_fetchable_url_or_file,
|
|
9
|
+
type upload_files
|
|
9
10
|
} from "@gradio/client";
|
|
10
11
|
|
|
11
12
|
export let elem_id = "";
|
|
@@ -27,6 +28,9 @@
|
|
|
27
28
|
|
|
28
29
|
const dispatch = createEventDispatcher();
|
|
29
30
|
|
|
31
|
+
// Needed for wasm support
|
|
32
|
+
const upload_fn = getContext<typeof upload_files>("upload_files");
|
|
33
|
+
|
|
30
34
|
let hidden_upload: HTMLInputElement;
|
|
31
35
|
let accept_file_types: string | null;
|
|
32
36
|
|
|
@@ -58,9 +62,9 @@
|
|
|
58
62
|
let all_file_data = await prepare_files(_files);
|
|
59
63
|
await tick();
|
|
60
64
|
|
|
61
|
-
all_file_data = (
|
|
62
|
-
(
|
|
63
|
-
) as FileData[];
|
|
65
|
+
all_file_data = (
|
|
66
|
+
await upload(all_file_data, root, undefined, upload_fn)
|
|
67
|
+
)?.filter((x) => x !== null) as FileData[];
|
|
64
68
|
value = file_count === "single" ? all_file_data?.[0] : all_file_data;
|
|
65
69
|
dispatch("change", value);
|
|
66
70
|
dispatch("upload", value);
|