@gradio/annotatedimage 0.9.30 → 0.10.1-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,42 @@
1
1
  # @gradio/annotatedimage
2
2
 
3
+ ## 0.10.1-dev.0
4
+
5
+ ### Dependency updates
6
+
7
+ - @gradio/upload@0.17.2-dev.0
8
+ - @gradio/client@2.0.0-dev.0
9
+
10
+ ## 0.10.0
11
+
12
+ ### Dependency updates
13
+
14
+ - @gradio/client@1.19.1
15
+
16
+ ## 0.10.0
17
+
18
+ ### Dependency updates
19
+
20
+ - @gradio/upload@0.17.1
21
+ - @gradio/atoms@0.18.1
22
+
23
+ ## 0.10.0
24
+
25
+ ### Features
26
+
27
+ - [#11858](https://github.com/gradio-app/gradio/pull/11858) [`3f8ea13`](https://github.com/gradio-app/gradio/commit/3f8ea13a8ca92abf0ad34392e403a449fda3c6c2) - remove lite. Thanks @pngwn!
28
+
29
+ ### Fixes
30
+
31
+ - [#11784](https://github.com/gradio-app/gradio/pull/11784) [`d9dd3f5`](https://github.com/gradio-app/gradio/commit/d9dd3f54b7fb34cf7118e549d39fc63937ca3489) - Add "hidden" option to component's `visible` kwarg to render but visually hide the component. Thanks @pngwn!
32
+
33
+ ### Dependency updates
34
+
35
+ - @gradio/statustracker@0.11.1
36
+ - @gradio/atoms@0.18.0
37
+ - @gradio/client@1.19.0
38
+ - @gradio/upload@0.17.0
39
+
3
40
  ## 0.9.30
4
41
 
5
42
  ### Dependency updates
package/Index.svelte CHANGED
@@ -1,7 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Gradio, SelectData } from "@gradio/utils";
3
3
 
4
- import { onMount } from "svelte";
5
4
  import {
6
5
  Block,
7
6
  BlockLabel,
@@ -9,15 +8,14 @@
9
8
  IconButtonWrapper,
10
9
  FullscreenButton
11
10
  } from "@gradio/atoms";
12
- import { Image, Maximize, Minimize } from "@gradio/icons";
11
+ import { Image } from "@gradio/icons";
13
12
  import { StatusTracker } from "@gradio/statustracker";
14
13
  import type { LoadingStatus } from "@gradio/statustracker";
15
14
  import { type FileData } from "@gradio/client";
16
- import { resolve_wasm_src } from "@gradio/wasm/svelte";
17
15
 
18
16
  export let elem_id = "";
19
17
  export let elem_classes: string[] = [];
20
- export let visible = true;
18
+ export let visible: boolean | "hidden" = true;
21
19
  export let value: {
22
20
  image: FileData;
23
21
  annotations: { image: FileData; label: string }[] | [];
@@ -45,7 +43,7 @@
45
43
  export let min_width: number | undefined = undefined;
46
44
  let active: string | null = null;
47
45
  export let loading_status: LoadingStatus;
48
- export let show_fullscreen_button = true;
46
+ export let buttons: string[] | null = null;
49
47
 
50
48
  let image_container: HTMLElement;
51
49
  let fullscreen = false;
@@ -68,42 +66,6 @@
68
66
  }))
69
67
  };
70
68
  _value = normalized_value;
71
-
72
- // In normal (non-Wasm) Gradio, the `<img>` element should be rendered with the passed values immediately
73
- // without waiting for `resolve_wasm_src()` to resolve.
74
- // If it waits, a blank image is displayed until the async task finishes
75
- // and it leads to undesirable flickering.
76
- // So set `_value` immediately above, and update it with the resolved values below later.
77
- const image_url_promise = resolve_wasm_src(normalized_value.image.url);
78
- const annotation_urls_promise = Promise.all(
79
- normalized_value.annotations.map((ann) =>
80
- resolve_wasm_src(ann.image.url)
81
- )
82
- );
83
- const current_promise = Promise.all([
84
- image_url_promise,
85
- annotation_urls_promise
86
- ]);
87
- latest_promise = current_promise;
88
- current_promise.then(([image_url, annotation_urls]) => {
89
- if (latest_promise !== current_promise) {
90
- return;
91
- }
92
- const async_resolved_value: typeof _value = {
93
- image: {
94
- ...normalized_value.image,
95
- url: image_url ?? undefined
96
- },
97
- annotations: normalized_value.annotations.map((ann, i) => ({
98
- ...ann,
99
- image: {
100
- ...ann.image,
101
- url: annotation_urls[i] ?? undefined
102
- }
103
- }))
104
- };
105
- _value = async_resolved_value;
106
- });
107
69
  } else {
108
70
  _value = null;
109
71
  }
@@ -153,7 +115,7 @@
153
115
  {:else}
154
116
  <div class="image-container" bind:this={image_container}>
155
117
  <IconButtonWrapper>
156
- {#if show_fullscreen_button}
118
+ {#if buttons?.includes("fullscreen") ?? true}
157
119
  <FullscreenButton
158
120
  {fullscreen}
159
121
  on:fullscreen={({ detail }) => {
package/dist/Index.svelte CHANGED
@@ -1,15 +1,13 @@
1
- <script>import { onMount } from "svelte";
2
- import {
1
+ <script>import {
3
2
  Block,
4
3
  BlockLabel,
5
4
  Empty,
6
5
  IconButtonWrapper,
7
6
  FullscreenButton
8
7
  } from "@gradio/atoms";
9
- import { Image, Maximize, Minimize } from "@gradio/icons";
8
+ import { Image } from "@gradio/icons";
10
9
  import { StatusTracker } from "@gradio/statustracker";
11
10
  import {} from "@gradio/client";
12
- import { resolve_wasm_src } from "@gradio/wasm/svelte";
13
11
  export let elem_id = "";
14
12
  export let elem_classes = [];
15
13
  export let visible = true;
@@ -28,7 +26,7 @@ export let scale = null;
28
26
  export let min_width = void 0;
29
27
  let active = null;
30
28
  export let loading_status;
31
- export let show_fullscreen_button = true;
29
+ export let buttons = null;
32
30
  let image_container;
33
31
  let fullscreen = false;
34
32
  let latest_promise = null;
@@ -46,36 +44,6 @@ $: {
46
44
  }))
47
45
  };
48
46
  _value = normalized_value;
49
- const image_url_promise = resolve_wasm_src(normalized_value.image.url);
50
- const annotation_urls_promise = Promise.all(
51
- normalized_value.annotations.map(
52
- (ann) => resolve_wasm_src(ann.image.url)
53
- )
54
- );
55
- const current_promise = Promise.all([
56
- image_url_promise,
57
- annotation_urls_promise
58
- ]);
59
- latest_promise = current_promise;
60
- current_promise.then(([image_url, annotation_urls]) => {
61
- if (latest_promise !== current_promise) {
62
- return;
63
- }
64
- const async_resolved_value = {
65
- image: {
66
- ...normalized_value.image,
67
- url: image_url ?? void 0
68
- },
69
- annotations: normalized_value.annotations.map((ann, i) => ({
70
- ...ann,
71
- image: {
72
- ...ann.image,
73
- url: annotation_urls[i] ?? void 0
74
- }
75
- }))
76
- };
77
- _value = async_resolved_value;
78
- });
79
47
  } else {
80
48
  _value = null;
81
49
  }
@@ -124,7 +92,7 @@ function handle_click(i, value2) {
124
92
  {:else}
125
93
  <div class="image-container" bind:this={image_container}>
126
94
  <IconButtonWrapper>
127
- {#if show_fullscreen_button}
95
+ {#if buttons?.includes("fullscreen") ?? true}
128
96
  <FullscreenButton
129
97
  {fullscreen}
130
98
  on:fullscreen={({ detail }) => {
@@ -6,7 +6,7 @@ declare const __propDef: {
6
6
  props: {
7
7
  elem_id?: string;
8
8
  elem_classes?: string[];
9
- visible?: boolean;
9
+ visible?: boolean | "hidden";
10
10
  value?: {
11
11
  image: FileData;
12
12
  annotations: {
@@ -28,7 +28,7 @@ declare const __propDef: {
28
28
  scale?: number | null;
29
29
  min_width?: number | undefined;
30
30
  loading_status: LoadingStatus;
31
- show_fullscreen_button?: boolean;
31
+ buttons?: string[] | null;
32
32
  };
33
33
  events: {
34
34
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/annotatedimage",
3
- "version": "0.9.30",
3
+ "version": "0.10.1-dev.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -22,13 +22,12 @@
22
22
  "svelte": "^4.0.0"
23
23
  },
24
24
  "dependencies": {
25
- "@gradio/atoms": "^0.17.0",
26
- "@gradio/icons": "^0.14.0",
27
- "@gradio/upload": "^0.16.17",
25
+ "@gradio/atoms": "^0.18.1",
26
+ "@gradio/statustracker": "^0.11.1",
27
+ "@gradio/upload": "^0.17.2-dev.0",
28
28
  "@gradio/utils": "^0.10.2",
29
- "@gradio/statustracker": "^0.11.0",
30
- "@gradio/client": "^1.18.0",
31
- "@gradio/wasm": "^0.18.1"
29
+ "@gradio/icons": "^0.14.0",
30
+ "@gradio/client": "^2.0.0-dev.0"
32
31
  },
33
32
  "repository": {
34
33
  "type": "git",