@gradio/image 0.10.0 → 0.11.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,39 @@
1
1
  # @gradio/image
2
2
 
3
+ ## 0.11.1
4
+
5
+ ### Fixes
6
+
7
+ - [#8252](https://github.com/gradio-app/gradio/pull/8252) [`22df61a`](https://github.com/gradio-app/gradio/commit/22df61a26adf8023f6dd49c051979990e8d3879a) - Client node fix. Thanks @pngwn!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/atoms@0.7.3
12
+ - @gradio/statustracker@0.5.2
13
+ - @gradio/client@0.19.0
14
+ - @gradio/icons@0.4.1
15
+ - @gradio/upload@0.10.1
16
+
17
+ ## 0.11.0
18
+
19
+ ### Features
20
+
21
+ - [#8121](https://github.com/gradio-app/gradio/pull/8121) [`f5b710c`](https://github.com/gradio-app/gradio/commit/f5b710c919b0ce604ea955f0d5f4faa91095ca4a) - chore(deps): update dependency eslint to v9. Thanks @renovate!
22
+ - [#8209](https://github.com/gradio-app/gradio/pull/8209) [`b9afe93`](https://github.com/gradio-app/gradio/commit/b9afe93915401df5bd6737c89395c2477acfa585) - Rename `eventSource_Factory` and `fetch_implementation`. Thanks @hannahblair!
23
+
24
+ ### Fixes
25
+
26
+ - [#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!
27
+
28
+ ### Dependency updates
29
+
30
+ - @gradio/atoms@0.7.2
31
+ - @gradio/client@0.18.0
32
+ - @gradio/upload@0.10.0
33
+ - @gradio/utils@0.4.1
34
+ - @gradio/wasm@0.10.1
35
+ - @gradio/statustracker@0.5.1
36
+
3
37
  ## 0.10.0
4
38
 
5
39
  ### Highlights
package/Index.svelte CHANGED
@@ -156,6 +156,8 @@
156
156
  {mirror_webcam}
157
157
  max_file_size={gradio.max_file_size}
158
158
  i18n={gradio.i18n}
159
+ upload={gradio.client.upload}
160
+ stream_handler={gradio.client.stream}
159
161
  >
160
162
  {#if active_source === "upload" || !active_source}
161
163
  <UploadText i18n={gradio.i18n} type="image" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/image",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -10,16 +10,16 @@
10
10
  "cropperjs": "^1.5.12",
11
11
  "lazy-brush": "^1.0.1",
12
12
  "resize-observer-polyfill": "^1.5.1",
13
- "@gradio/client": "^0.17.0",
14
- "@gradio/atoms": "^0.7.1",
15
- "@gradio/upload": "^0.9.0",
16
- "@gradio/utils": "^0.4.0",
17
- "@gradio/wasm": "^0.10.0",
18
- "@gradio/icons": "^0.4.0",
19
- "@gradio/statustracker": "^0.5.0"
13
+ "@gradio/atoms": "^0.7.3",
14
+ "@gradio/icons": "^0.4.1",
15
+ "@gradio/client": "^0.19.0",
16
+ "@gradio/upload": "^0.10.1",
17
+ "@gradio/statustracker": "^0.5.2",
18
+ "@gradio/wasm": "^0.10.1",
19
+ "@gradio/utils": "^0.4.1"
20
20
  },
21
21
  "devDependencies": {
22
- "@gradio/preview": "^0.8.0"
22
+ "@gradio/preview": "^0.9.0"
23
23
  },
24
24
  "main_changeset": true,
25
25
  "main": "./Index.svelte",
@@ -7,7 +7,7 @@
7
7
  import Webcam from "./Webcam.svelte";
8
8
 
9
9
  import { Upload } from "@gradio/upload";
10
- import type { FileData } from "@gradio/client";
10
+ import type { FileData, Client } from "@gradio/client";
11
11
  import ClearImage from "./ClearImage.svelte";
12
12
  import { SelectSource } from "@gradio/atoms";
13
13
  import Image from "./Image.svelte";
@@ -26,8 +26,10 @@
26
26
  export let root: string;
27
27
  export let i18n: I18nFormatter;
28
28
  export let max_file_size: number | null = null;
29
+ export let upload: Client["upload"];
30
+ export let stream_handler: Client["stream"];
29
31
 
30
- let upload: Upload;
32
+ let upload_input: Upload;
31
33
  let uploading = false;
32
34
  export let active_source: source_type = null;
33
35
 
@@ -44,7 +46,9 @@
44
46
 
45
47
  async function handle_save(img_blob: Blob | any): Promise<void> {
46
48
  pending = true;
47
- const f = await upload.load_files([new File([img_blob], `webcam.png`)]);
49
+ const f = await upload_input.load_files([
50
+ new File([img_blob], `webcam.png`)
51
+ ]);
48
52
 
49
53
  value = f?.[0] || null;
50
54
 
@@ -86,7 +90,7 @@
86
90
  ): Promise<void> {
87
91
  switch (source) {
88
92
  case "clipboard":
89
- upload.paste_clipboard();
93
+ upload_input.paste_clipboard();
90
94
  break;
91
95
  default:
92
96
  break;
@@ -108,7 +112,7 @@
108
112
  <div class="upload-container">
109
113
  <Upload
110
114
  hidden={value !== null || active_source === "webcam"}
111
- bind:this={upload}
115
+ bind:this={upload_input}
112
116
  bind:uploading
113
117
  bind:dragging
114
118
  filetype={active_source === "clipboard" ? "clipboard" : "image/*"}
@@ -117,6 +121,8 @@
117
121
  {root}
118
122
  {max_file_size}
119
123
  disable_click={!sources.includes("upload")}
124
+ {upload}
125
+ {stream_handler}
120
126
  >
121
127
  {#if value === null}
122
128
  <slot />
@@ -135,6 +141,7 @@
135
141
  mode="image"
136
142
  include_audio={false}
137
143
  {i18n}
144
+ {upload}
138
145
  />
139
146
  {:else if value !== null && !streaming}
140
147
  <!-- svelte-ignore a11y-click-events-have-key-events-->
@@ -2,8 +2,7 @@
2
2
  import { createEventDispatcher, onMount } from "svelte";
3
3
  import { Camera, Circle, Square, DropdownArrow } from "@gradio/icons";
4
4
  import type { I18nFormatter } from "@gradio/utils";
5
- import type { FileData } from "@gradio/client";
6
- import { prepare_files, upload } from "@gradio/client";
5
+ import { type FileData, type Client, prepare_files } from "@gradio/client";
7
6
  import WebcamPermissions from "./WebcamPermissions.svelte";
8
7
  import { fade } from "svelte/transition";
9
8
  import {
@@ -25,6 +24,7 @@
25
24
  export let mirror_webcam: boolean;
26
25
  export let include_audio: boolean;
27
26
  export let i18n: I18nFormatter;
27
+ export let upload: Client["upload"];
28
28
 
29
29
  const dispatch = createEventDispatcher<{
30
30
  stream: undefined;
@@ -70,7 +70,7 @@
70
70
 
71
71
  selected_device = used_devices
72
72
  ? devices.find((device) => device.deviceId === used_devices) ||
73
- available_video_devices[0]
73
+ available_video_devices[0]
74
74
  : available_video_devices[0];
75
75
  });
76
76