@gradio/upload 0.17.0 → 0.17.2-dev.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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @gradio/upload
2
2
 
3
+ ## 0.17.2-dev.0
4
+
5
+ ### Dependency updates
6
+
7
+ - @gradio/client@2.0.0-dev.0
8
+
9
+ ## 0.17.1
10
+
11
+ ### Dependency updates
12
+
13
+ - @gradio/client@1.19.1
14
+
15
+ ## 0.17.1
16
+
17
+ ### Fixes
18
+
19
+ - [#11969](https://github.com/gradio-app/gradio/pull/11969) [`c8f7909`](https://github.com/gradio-app/gradio/commit/c8f79090ede3b071a8d9620a885350b6ee5a8926) - Show UploadProgress for Webcam Uploads. Thanks @freddyaboulton!
20
+
21
+ ### Dependency updates
22
+
23
+ - @gradio/atoms@0.18.1
24
+
3
25
  ## 0.17.0
4
26
 
5
27
  ### Features
@@ -84,15 +84,17 @@ export function paste_clipboard() {
84
84
  export function open_file_upload() {
85
85
  _open_file_upload();
86
86
  }
87
- async function handle_upload(file_data2) {
87
+ async function handle_upload(file_data2, upload_id2) {
88
88
  await tick();
89
- upload_id = Math.random().toString(36).substring(2, 15);
89
+ if (!upload_id2) {
90
+ upload_id2 = Math.random().toString(36).substring(2, 15);
91
+ }
90
92
  uploading = true;
91
93
  try {
92
94
  const _file_data = await upload(
93
95
  file_data2,
94
96
  root,
95
- upload_id,
97
+ upload_id2,
96
98
  max_file_size ?? Infinity
97
99
  );
98
100
  dispatch("load", file_count === "single" ? _file_data?.[0] : _file_data);
@@ -121,7 +123,7 @@ function is_valid_mimetype(file_accept, uploaded_file_extension, uploaded_file_t
121
123
  return type.endsWith("/*") && uploaded_file_type.startsWith(category + "/");
122
124
  });
123
125
  }
124
- export async function load_files(files) {
126
+ export async function load_files(files, upload_id2) {
125
127
  if (!files.length) {
126
128
  return;
127
129
  }
@@ -144,7 +146,7 @@ export async function load_files(files) {
144
146
  }
145
147
  }
146
148
  file_data = await prepare_files(_files);
147
- return await handle_upload(file_data);
149
+ return await handle_upload(file_data, upload_id2);
148
150
  }
149
151
  function is_valid_file(file) {
150
152
  if (!filetype) return true;
@@ -24,7 +24,7 @@ declare const __propDef: {
24
24
  open_upload?: () => void;
25
25
  paste_clipboard?: () => void;
26
26
  open_file_upload?: () => void;
27
- load_files?: (files: File[] | Blob[]) => Promise<(FileData | null)[] | void>;
27
+ load_files?: (files: File[] | Blob[], upload_id?: string) => Promise<(FileData | null)[] | void>;
28
28
  load_files_from_drop?: (e: DragEvent) => Promise<void>;
29
29
  };
30
30
  events: {
@@ -46,7 +46,7 @@ export default class Upload extends SvelteComponent<UploadProps, UploadEvents, U
46
46
  get open_upload(): () => void;
47
47
  get paste_clipboard(): () => void;
48
48
  get open_file_upload(): () => void;
49
- get load_files(): (files: File[] | Blob[]) => Promise<(FileData | null)[] | void>;
49
+ get load_files(): (files: File[] | Blob[], upload_id?: string) => Promise<(FileData | null)[] | void>;
50
50
  get load_files_from_drop(): (e: DragEvent) => Promise<void>;
51
51
  }
52
52
  export {};
@@ -1,3 +1,4 @@
1
1
  export { default as Upload } from "./Upload.svelte";
2
2
  export { default as ModifyUpload } from "./ModifyUpload.svelte";
3
+ export { default as UploadProgress } from "./UploadProgress.svelte";
3
4
  export { create_drag } from "./utils";
package/dist/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as Upload } from "./Upload.svelte";
2
2
  export { default as ModifyUpload } from "./ModifyUpload.svelte";
3
+ export { default as UploadProgress } from "./UploadProgress.svelte";
3
4
  export { create_drag } from "./utils";
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@gradio/upload",
3
- "version": "0.17.0",
3
+ "version": "0.17.2-dev.0",
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.18.1",
10
11
  "@gradio/icons": "^0.14.0",
11
- "@gradio/client": "^1.19.0",
12
- "@gradio/atoms": "^0.18.0",
12
+ "@gradio/client": "^2.0.0-dev.0",
13
13
  "@gradio/utils": "^0.10.2"
14
14
  },
15
15
  "main_changeset": true,
package/src/Upload.svelte CHANGED
@@ -96,10 +96,13 @@
96
96
  }
97
97
 
98
98
  async function handle_upload(
99
- file_data: FileData[]
99
+ file_data: FileData[],
100
+ upload_id?: string
100
101
  ): Promise<(FileData | null)[]> {
101
102
  await tick();
102
- upload_id = Math.random().toString(36).substring(2, 15);
103
+ if (!upload_id) {
104
+ upload_id = Math.random().toString(36).substring(2, 15);
105
+ }
103
106
  uploading = true;
104
107
  try {
105
108
  const _file_data = await upload(
@@ -153,7 +156,8 @@
153
156
  }
154
157
 
155
158
  export async function load_files(
156
- files: File[] | Blob[]
159
+ files: File[] | Blob[],
160
+ upload_id?: string
157
161
  ): Promise<(FileData | null)[] | void> {
158
162
  if (!files.length) {
159
163
  return;
@@ -181,7 +185,7 @@
181
185
  }
182
186
 
183
187
  file_data = await prepare_files(_files);
184
- return await handle_upload(file_data);
188
+ return await handle_upload(file_data, upload_id);
185
189
  }
186
190
 
187
191
  function is_valid_file(file: File): boolean {
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as Upload } from "./Upload.svelte";
2
2
  export { default as ModifyUpload } from "./ModifyUpload.svelte";
3
+ export { default as UploadProgress } from "./UploadProgress.svelte";
3
4
  export { create_drag } from "./utils";