@gradio/upload 0.7.3 → 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 CHANGED
@@ -1,5 +1,20 @@
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
+
9
+ ## 0.7.4
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`f191786`](https://github.com/gradio-app/gradio/commit/f1917867916647d383b8d7ce15e0c17f2abbdec1)]:
14
+ - @gradio/icons@0.3.3
15
+ - @gradio/atoms@0.5.3
16
+ - @gradio/upload@0.7.4
17
+
3
18
  ## 0.7.3
4
19
 
5
20
  ### Patch Changes
@@ -345,4 +360,4 @@ From the backend, streamed outputs are served from the `/stream/` endpoint inste
345
360
  ### Patch Changes
346
361
 
347
362
  - Updated dependencies []:
348
- - @gradio/atoms@0.0.2
363
+ - @gradio/atoms@0.0.2
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@gradio/upload",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "author": "",
8
8
  "license": "ISC",
9
9
  "dependencies": {
10
- "@gradio/atoms": "^0.5.2",
11
- "@gradio/icons": "^0.3.2",
12
- "@gradio/client": "^0.12.1",
13
- "@gradio/upload": "^0.7.3",
14
- "@gradio/utils": "^0.3.0",
15
- "@gradio/wasm": "^0.6.0"
10
+ "@gradio/atoms": "^0.5.3",
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
- $: if (filetype == null || typeof filetype === "string") {
31
- accept_file_types = filetype;
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((x) => {
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
  }