@gradio/gallery 0.9.0 → 0.10.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 +37 -0
- package/Index.svelte +3 -0
- package/package.json +10 -10
- package/shared/Gallery.svelte +5 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @gradio/gallery
|
|
2
2
|
|
|
3
|
+
## 0.10.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/image@0.11.1
|
|
16
|
+
- @gradio/upload@0.10.1
|
|
17
|
+
- @gradio/file@0.7.1
|
|
18
|
+
|
|
19
|
+
## 0.10.0
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
- [#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!
|
|
24
|
+
- [#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!
|
|
25
|
+
|
|
26
|
+
### Fixes
|
|
27
|
+
|
|
28
|
+
- [#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!
|
|
29
|
+
|
|
30
|
+
### Dependency updates
|
|
31
|
+
|
|
32
|
+
- @gradio/atoms@0.7.2
|
|
33
|
+
- @gradio/client@0.18.0
|
|
34
|
+
- @gradio/upload@0.10.0
|
|
35
|
+
- @gradio/utils@0.4.1
|
|
36
|
+
- @gradio/statustracker@0.5.1
|
|
37
|
+
- @gradio/image@0.11.0
|
|
38
|
+
- @gradio/file@0.7.0
|
|
39
|
+
|
|
3
40
|
## 0.9.0
|
|
4
41
|
|
|
5
42
|
### Highlights
|
package/Index.svelte
CHANGED
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
file_count={"multiple"}
|
|
78
78
|
file_types={["image"]}
|
|
79
79
|
i18n={gradio.i18n}
|
|
80
|
+
upload={gradio.client.upload}
|
|
81
|
+
stream_handler={gradio.client.stream}
|
|
80
82
|
on:upload={(e) => {
|
|
81
83
|
const files = Array.isArray(e.detail) ? e.detail : [e.detail];
|
|
82
84
|
value = files.map((x) => ({ image: x, caption: null }));
|
|
@@ -110,6 +112,7 @@
|
|
|
110
112
|
{show_share_button}
|
|
111
113
|
{show_download_button}
|
|
112
114
|
i18n={gradio.i18n}
|
|
115
|
+
_fetch={gradio.client.fetch}
|
|
113
116
|
/>
|
|
114
117
|
{/if}
|
|
115
118
|
</Block>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/gallery",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Gradio UI packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
"private": false,
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"dequal": "^2.0.2",
|
|
11
|
-
"@gradio/atoms": "^0.7.
|
|
12
|
-
"@gradio/client": "^0.
|
|
13
|
-
"@gradio/
|
|
14
|
-
"@gradio/
|
|
15
|
-
"@gradio/
|
|
16
|
-
"@gradio/upload": "^0.
|
|
17
|
-
"@gradio/
|
|
18
|
-
"@gradio/
|
|
11
|
+
"@gradio/atoms": "^0.7.3",
|
|
12
|
+
"@gradio/client": "^0.19.0",
|
|
13
|
+
"@gradio/icons": "^0.4.1",
|
|
14
|
+
"@gradio/statustracker": "^0.5.2",
|
|
15
|
+
"@gradio/image": "^0.11.1",
|
|
16
|
+
"@gradio/upload": "^0.10.1",
|
|
17
|
+
"@gradio/file": "^0.7.1",
|
|
18
|
+
"@gradio/utils": "^0.4.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@gradio/preview": "^0.
|
|
21
|
+
"@gradio/preview": "^0.9.0"
|
|
22
22
|
},
|
|
23
23
|
"main": "./Index.svelte",
|
|
24
24
|
"main_changeset": true,
|
package/shared/Gallery.svelte
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { SelectData } from "@gradio/utils";
|
|
5
5
|
import { Image } from "@gradio/image/shared";
|
|
6
6
|
import { dequal } from "dequal";
|
|
7
|
-
import { createEventDispatcher
|
|
7
|
+
import { createEventDispatcher } from "svelte";
|
|
8
8
|
import { tick } from "svelte";
|
|
9
9
|
|
|
10
10
|
import { Download, Image as ImageIcon } from "@gradio/icons";
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
export let i18n: I18nFormatter;
|
|
32
32
|
export let selected_index: number | null = null;
|
|
33
33
|
export let interactive: boolean;
|
|
34
|
+
export let _fetch: typeof fetch;
|
|
34
35
|
|
|
35
36
|
const dispatch = createEventDispatcher<{
|
|
36
37
|
change: undefined;
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
: value.map((data) => ({
|
|
50
51
|
image: data.image as FileData,
|
|
51
52
|
caption: data.caption
|
|
52
|
-
|
|
53
|
+
}));
|
|
53
54
|
|
|
54
55
|
let prev_value: GalleryData | null = value;
|
|
55
56
|
if (selected_index == null && preview && value?.length) {
|
|
@@ -159,18 +160,16 @@
|
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
162
|
|
|
162
|
-
let client_height = 0;
|
|
163
163
|
let window_height = 0;
|
|
164
164
|
|
|
165
165
|
// Unlike `gr.Image()`, images specified via remote URLs are not cached in the server
|
|
166
166
|
// and their remote URLs are directly passed to the client as `value[].image.url`.
|
|
167
167
|
// The `download` attribute of the <a> tag doesn't work for remote URLs (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download),
|
|
168
168
|
// so we need to download the image via JS as below.
|
|
169
|
-
const fetch_implementation = getContext<typeof fetch>("fetch_implementation");
|
|
170
169
|
async function download(file_url: string, name: string): Promise<void> {
|
|
171
170
|
let response;
|
|
172
171
|
try {
|
|
173
|
-
response = await
|
|
172
|
+
response = await _fetch(file_url);
|
|
174
173
|
} catch (error) {
|
|
175
174
|
if (error instanceof TypeError) {
|
|
176
175
|
// If CORS is not allowed (https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#checking_that_the_fetch_was_successful),
|
|
@@ -279,11 +278,7 @@
|
|
|
279
278
|
</button>
|
|
280
279
|
{/if}
|
|
281
280
|
|
|
282
|
-
<div
|
|
283
|
-
bind:clientHeight={client_height}
|
|
284
|
-
class="grid-wrap"
|
|
285
|
-
class:fixed-height={!height || height == "auto"}
|
|
286
|
-
>
|
|
281
|
+
<div class="grid-wrap" class:fixed-height={!height || height == "auto"}>
|
|
287
282
|
<div
|
|
288
283
|
class="grid-container"
|
|
289
284
|
style="--grid-cols:{columns}; --grid-rows:{rows}; --object-fit: {object_fit}; height: {height};"
|