@gradio/image 0.8.0 → 0.9.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 +6 -0
- package/Index.svelte +9 -7
- package/package.json +4 -4
- package/shared/ImagePreview.svelte +1 -1
- package/shared/ImageUploader.svelte +2 -4
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# @gradio/image
|
2
2
|
|
3
|
+
## 0.9.0
|
4
|
+
|
5
|
+
### Features
|
6
|
+
|
7
|
+
- [#7183](https://github.com/gradio-app/gradio/pull/7183) [`49d9c48`](https://github.com/gradio-app/gradio/commit/49d9c48537aa706bf72628e3640389470138bdc6) - [WIP] Refactor file normalization to be in the backend and remove it from the frontend of each component. Thanks [@abidlabs](https://github.com/abidlabs)!
|
8
|
+
|
3
9
|
## 0.8.0
|
4
10
|
|
5
11
|
### Features
|
package/Index.svelte
CHANGED
@@ -18,7 +18,6 @@
|
|
18
18
|
import { StatusTracker } from "@gradio/statustracker";
|
19
19
|
import type { FileData } from "@gradio/client";
|
20
20
|
import type { LoadingStatus } from "@gradio/statustracker";
|
21
|
-
import { normalise_file } from "@gradio/client";
|
22
21
|
|
23
22
|
type sources = "upload" | "webcam" | "clipboard" | null;
|
24
23
|
|
@@ -26,12 +25,11 @@
|
|
26
25
|
export let elem_classes: string[] = [];
|
27
26
|
export let visible = true;
|
28
27
|
export let value: null | FileData = null;
|
29
|
-
|
28
|
+
let old_value: null | FileData = null;
|
30
29
|
export let label: string;
|
31
30
|
export let show_label: boolean;
|
32
31
|
export let show_download_button: boolean;
|
33
32
|
export let root: string;
|
34
|
-
export let proxy_url: null | string;
|
35
33
|
|
36
34
|
export let height: number | undefined;
|
37
35
|
export let width: number | undefined;
|
@@ -64,8 +62,12 @@
|
|
64
62
|
share: ShareData;
|
65
63
|
}>;
|
66
64
|
|
67
|
-
$:
|
68
|
-
|
65
|
+
$: {
|
66
|
+
if (JSON.stringify(value) !== JSON.stringify(old_value)) {
|
67
|
+
old_value = value;
|
68
|
+
gradio.dispatch("change");
|
69
|
+
}
|
70
|
+
}
|
69
71
|
|
70
72
|
let dragging: boolean;
|
71
73
|
let active_source: sources = null;
|
@@ -95,7 +97,7 @@
|
|
95
97
|
on:select={({ detail }) => gradio.dispatch("select", detail)}
|
96
98
|
on:share={({ detail }) => gradio.dispatch("share", detail)}
|
97
99
|
on:error={({ detail }) => gradio.dispatch("error", detail)}
|
98
|
-
value
|
100
|
+
{value}
|
99
101
|
{label}
|
100
102
|
{show_label}
|
101
103
|
{show_download_button}
|
@@ -107,7 +109,7 @@
|
|
107
109
|
{:else}
|
108
110
|
<Block
|
109
111
|
{visible}
|
110
|
-
variant={
|
112
|
+
variant={value === null ? "dashed" : "solid"}
|
111
113
|
border_mode={dragging ? "focus" : "base"}
|
112
114
|
padding={false}
|
113
115
|
{elem_id}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/image",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.9.0",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
6
|
"author": "",
|
@@ -11,11 +11,11 @@
|
|
11
11
|
"lazy-brush": "^1.0.1",
|
12
12
|
"resize-observer-polyfill": "^1.5.1",
|
13
13
|
"@gradio/atoms": "^0.5.1",
|
14
|
-
"@gradio/client": "^0.11.0",
|
15
|
-
"@gradio/icons": "^0.3.2",
|
16
14
|
"@gradio/statustracker": "^0.4.5",
|
15
|
+
"@gradio/icons": "^0.3.2",
|
16
|
+
"@gradio/upload": "^0.7.2",
|
17
17
|
"@gradio/wasm": "^0.6.0",
|
18
|
-
"@gradio/
|
18
|
+
"@gradio/client": "^0.12.0",
|
19
19
|
"@gradio/utils": "^0.2.2"
|
20
20
|
},
|
21
21
|
"main_changeset": true,
|
@@ -9,7 +9,7 @@
|
|
9
9
|
import { DownloadLink } from "@gradio/wasm/svelte";
|
10
10
|
|
11
11
|
import { Image as ImageIcon } from "@gradio/icons";
|
12
|
-
import { type FileData
|
12
|
+
import { type FileData } from "@gradio/client";
|
13
13
|
import type { I18nFormatter } from "@gradio/utils";
|
14
14
|
|
15
15
|
export let value: null | FileData;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
import Webcam from "./Webcam.svelte";
|
8
8
|
|
9
9
|
import { Upload } from "@gradio/upload";
|
10
|
-
import {
|
10
|
+
import type { FileData } from "@gradio/client";
|
11
11
|
import ClearImage from "./ClearImage.svelte";
|
12
12
|
import { SelectSource } from "@gradio/atoms";
|
13
13
|
import Image from "./Image.svelte";
|
@@ -31,7 +31,7 @@
|
|
31
31
|
export let active_source: source_type = null;
|
32
32
|
|
33
33
|
function handle_upload({ detail }: CustomEvent<FileData>): void {
|
34
|
-
value =
|
34
|
+
value = detail;
|
35
35
|
dispatch("upload");
|
36
36
|
}
|
37
37
|
|
@@ -56,8 +56,6 @@
|
|
56
56
|
$: active_streaming = streaming && active_source === "webcam";
|
57
57
|
$: if (uploading && !active_streaming) value = null;
|
58
58
|
|
59
|
-
$: value && !value.url && (value = normalise_file(value, root, null));
|
60
|
-
|
61
59
|
const dispatch = createEventDispatcher<{
|
62
60
|
change?: never;
|
63
61
|
stream?: never;
|