@gradio/upload 0.16.2 → 0.16.4

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,17 @@
1
1
  # @gradio/upload
2
2
 
3
+ ## 0.16.4
4
+
5
+ ### Fixes
6
+
7
+ - [#11098](https://github.com/gradio-app/gradio/pull/11098) [`49ad594`](https://github.com/gradio-app/gradio/commit/49ad5943eeab96b153f0b56fe8d42d755fe1e0f8) - Fix #10281: Dragging image replaces existing instead of opening new tab. Thanks @Martim-Rito!
8
+
9
+ ## 0.16.3
10
+
11
+ ### Dependency updates
12
+
13
+ - @gradio/atoms@0.16.0
14
+
3
15
  ## 0.16.2
4
16
 
5
17
  ### Dependency updates
@@ -190,6 +190,23 @@ async function load_files_from_upload(files) {
190
190
  dispatch("load", files_to_load);
191
191
  }
192
192
  }
193
+ export async function load_files_from_drop(e) {
194
+ dragging = false;
195
+ if (!e.dataTransfer?.files)
196
+ return;
197
+ const files_to_load = Array.from(e.dataTransfer.files).filter(
198
+ is_valid_file
199
+ );
200
+ if (format != "blob") {
201
+ await load_files(files_to_load);
202
+ } else {
203
+ if (file_count === "single") {
204
+ dispatch("load", files_to_load[0]);
205
+ return;
206
+ }
207
+ dispatch("load", files_to_load);
208
+ }
209
+ }
193
210
  </script>
194
211
 
195
212
  {#if filetype === "clipboard"}
@@ -25,6 +25,7 @@ declare const __propDef: {
25
25
  paste_clipboard?: (() => void) | undefined;
26
26
  open_file_upload?: (() => void) | undefined;
27
27
  load_files?: ((files: File[] | Blob[]) => Promise<(FileData | null)[] | void>) | undefined;
28
+ load_files_from_drop?: ((e: DragEvent) => Promise<void>) | undefined;
28
29
  };
29
30
  events: {
30
31
  load: CustomEvent<any>;
@@ -44,5 +45,6 @@ export default class Upload extends SvelteComponent<UploadProps, UploadEvents, U
44
45
  get paste_clipboard(): () => void;
45
46
  get open_file_upload(): () => void;
46
47
  get load_files(): (files: File[] | Blob[]) => Promise<(FileData | null)[] | void>;
48
+ get load_files_from_drop(): (e: DragEvent) => Promise<void>;
47
49
  }
48
50
  export {};
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@gradio/upload",
3
- "version": "0.16.2",
3
+ "version": "0.16.4",
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/utils": "^0.10.2",
11
- "@gradio/atoms": "^0.15.2",
10
+ "@gradio/atoms": "^0.16.0",
12
11
  "@gradio/icons": "^0.12.0",
13
- "@gradio/wasm": "^0.18.1",
14
- "@gradio/client": "^1.14.2"
12
+ "@gradio/utils": "^0.10.2",
13
+ "@gradio/client": "^1.14.2",
14
+ "@gradio/wasm": "^0.18.1"
15
15
  },
16
16
  "main_changeset": true,
17
17
  "exports": {
package/src/Upload.svelte CHANGED
@@ -240,6 +240,24 @@
240
240
  dispatch("load", files_to_load);
241
241
  }
242
242
  }
243
+
244
+ export async function load_files_from_drop(e: DragEvent): Promise<void> {
245
+ dragging = false;
246
+ if (!e.dataTransfer?.files) return;
247
+ const files_to_load = Array.from(e.dataTransfer.files).filter(
248
+ is_valid_file
249
+ );
250
+
251
+ if (format != "blob") {
252
+ await load_files(files_to_load);
253
+ } else {
254
+ if (file_count === "single") {
255
+ dispatch("load", files_to_load[0]);
256
+ return;
257
+ }
258
+ dispatch("load", files_to_load);
259
+ }
260
+ }
243
261
  </script>
244
262
 
245
263
  {#if filetype === "clipboard"}