@gradio/uploadbutton 0.6.0 → 0.6.1

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,18 @@
1
1
  # @gradio/uploadbutton
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Fixes
6
+
7
+ - [#8179](https://github.com/gradio-app/gradio/pull/8179) [`6a218b4`](https://github.com/gradio-app/gradio/commit/6a218b4148095aaa0c58d8c20973ba01c8764fc2) - rework upload to be a class method + pass client into each component. Thanks @pngwn!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/client@0.18.0
12
+ - @gradio/upload@0.10.0
13
+ - @gradio/utils@0.4.1
14
+ - @gradio/button@0.2.33
15
+
3
16
  ## 0.6.0
4
17
 
5
18
  ### Highlights
package/Index.svelte CHANGED
@@ -61,6 +61,7 @@
61
61
  on:error={({ detail }) => {
62
62
  gradio.dispatch("error", detail);
63
63
  }}
64
+ upload={gradio.client.upload}
64
65
  >
65
66
  {label ? gradio.i18n(label) : ""}
66
67
  </UploadButton>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/uploadbutton",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -13,12 +13,12 @@
13
13
  },
14
14
  "main": "./Index.svelte",
15
15
  "dependencies": {
16
- "@gradio/button": "^0.2.32",
17
- "@gradio/client": "^0.17.0",
18
- "@gradio/upload": "^0.9.0",
19
- "@gradio/utils": "^0.4.0"
16
+ "@gradio/button": "^0.2.33",
17
+ "@gradio/client": "^0.18.0",
18
+ "@gradio/utils": "^0.4.1",
19
+ "@gradio/upload": "^0.10.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@gradio/preview": "^0.8.0"
22
+ "@gradio/preview": "^0.9.0"
23
23
  }
24
24
  }
@@ -1,12 +1,7 @@
1
1
  <script lang="ts">
2
- import { tick, createEventDispatcher, getContext } from "svelte";
2
+ import { tick, createEventDispatcher } from "svelte";
3
3
  import { BaseButton } from "@gradio/button";
4
- import {
5
- upload,
6
- prepare_files,
7
- type FileData,
8
- type upload_files
9
- } from "@gradio/client";
4
+ import { prepare_files, type FileData, type Client } from "@gradio/client";
10
5
 
11
6
  export let elem_id = "";
12
7
  export let elem_classes: string[] = [];
@@ -23,12 +18,10 @@
23
18
  export let variant: "primary" | "secondary" | "stop" = "secondary";
24
19
  export let disabled = false;
25
20
  export let max_file_size: number | null = null;
21
+ export let upload: Client["upload"];
26
22
 
27
23
  const dispatch = createEventDispatcher();
28
24
 
29
- // Needed for wasm support
30
- const upload_fn = getContext<typeof upload_files>("upload_files");
31
-
32
25
  let hidden_upload: HTMLInputElement;
33
26
  let accept_file_types: string | null;
34
27
 
@@ -63,13 +56,7 @@
63
56
 
64
57
  try {
65
58
  all_file_data = (
66
- await upload(
67
- all_file_data,
68
- root,
69
- undefined,
70
- max_file_size ?? Infinity,
71
- upload_fn
72
- )
59
+ await upload(all_file_data, root, undefined, max_file_size ?? Infinity)
73
60
  )?.filter((x) => x !== null) as FileData[];
74
61
  } catch (e) {
75
62
  dispatch("error", (e as Error).message);