@gradio/image 0.5.4 → 0.6.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,17 @@
1
1
  # @gradio/image
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Features
6
+
7
+ - [#6133](https://github.com/gradio-app/gradio/pull/6133) [`f742d0e`](https://github.com/gradio-app/gradio/commit/f742d0e861c8e25c5d77d9102c9d50f94b0d3383) - Lite: Support AnnotatedImage on Wasm. Thanks [@whitphx](https://github.com/whitphx)!
8
+ - [#6931](https://github.com/gradio-app/gradio/pull/6931) [`6c863af`](https://github.com/gradio-app/gradio/commit/6c863af92fa9ceb5c638857eb22cc5ddb718d549) - Fix functional tests. Thanks [@aliabid94](https://github.com/aliabid94)!
9
+ - [#6897](https://github.com/gradio-app/gradio/pull/6897) [`fb9c6ca`](https://github.com/gradio-app/gradio/commit/fb9c6cacd7ca4598c000f1f97d7d39a8c4463519) - Lite: Chatbot. Thanks [@whitphx](https://github.com/whitphx)!
10
+
11
+ ### Fixes
12
+
13
+ - [#6942](https://github.com/gradio-app/gradio/pull/6942) [`b1b78c2`](https://github.com/gradio-app/gradio/commit/b1b78c2168e24fb65251a9b9b6cbc9382179a8ca) - Fix `.select` for `gr.Image`, `gr.CheckboxGroup`. Thanks [@abidlabs](https://github.com/abidlabs)!
14
+
3
15
  ## 0.5.4
4
16
 
5
17
  ### Fixes
package/Index.svelte CHANGED
@@ -65,7 +65,7 @@
65
65
  }>;
66
66
 
67
67
  $: url = _value?.url;
68
- $: url && gradio.dispatch("change");
68
+ $: url, gradio.dispatch("change");
69
69
 
70
70
  let dragging: boolean;
71
71
  let active_source: sources = null;
@@ -134,7 +134,6 @@
134
134
  on:edit={() => gradio.dispatch("edit")}
135
135
  on:clear={() => {
136
136
  gradio.dispatch("clear");
137
- gradio.dispatch("change");
138
137
  }}
139
138
  on:stream={() => gradio.dispatch("stream")}
140
139
  on:drag={({ detail }) => (dragging = detail)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/image",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -11,18 +11,19 @@
11
11
  "lazy-brush": "^1.0.1",
12
12
  "resize-observer-polyfill": "^1.5.1",
13
13
  "@gradio/atoms": "^0.4.1",
14
- "@gradio/client": "^0.9.4",
15
- "@gradio/icons": "^0.3.2",
16
- "@gradio/statustracker": "^0.4.3",
14
+ "@gradio/client": "^0.10.0",
17
15
  "@gradio/utils": "^0.2.0",
18
- "@gradio/upload": "^0.5.7",
19
- "@gradio/wasm": "^0.4.0"
16
+ "@gradio/upload": "^0.5.8",
17
+ "@gradio/statustracker": "^0.4.3",
18
+ "@gradio/wasm": "^0.4.1",
19
+ "@gradio/icons": "^0.3.2"
20
20
  },
21
21
  "main_changeset": true,
22
22
  "main": "./Index.svelte",
23
23
  "exports": {
24
24
  ".": "./Index.svelte",
25
25
  "./example": "./Example.svelte",
26
+ "./shared": "./shared/index.ts",
26
27
  "./package.json": "./package.json"
27
28
  }
28
29
  }
@@ -1,6 +1,9 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLImgAttributes } from "svelte/elements";
3
- type $$Props = HTMLImgAttributes;
3
+ interface Props extends HTMLImgAttributes {
4
+ "data-testid"?: string;
5
+ }
6
+ type $$Props = Props;
4
7
 
5
8
  import { resolve_wasm_src } from "@gradio/wasm/svelte";
6
9
 
@@ -15,7 +18,7 @@
15
18
  $: {
16
19
  // In normal (non-Wasm) Gradio, the `<img>` element should be rendered with the passed `src` props immediately
17
20
  // without waiting for `resolve_wasm_src()` to resolve.
18
- // If it waits, a black image is displayed until the async task finishes
21
+ // If it waits, a blank image is displayed until the async task finishes
19
22
  // and it leads to undesirable flickering.
20
23
  // So set `src` to `resolved_src` here.
21
24
  resolved_src = src;
@@ -0,0 +1 @@
1
+ export { default as Image } from "./Image.svelte";
package/shared/utils.ts CHANGED
@@ -1,7 +1,12 @@
1
1
  export const get_coordinates_of_clicked_image = (
2
2
  evt: MouseEvent
3
3
  ): [number, number] | null => {
4
- let image = evt.currentTarget as HTMLImageElement;
4
+ let image;
5
+ if (evt.currentTarget instanceof Element) {
6
+ image = evt.currentTarget.querySelector("img") as HTMLImageElement;
7
+ } else {
8
+ return [NaN, NaN];
9
+ }
5
10
 
6
11
  const imageRect = image.getBoundingClientRect();
7
12
  const xScale = image.naturalWidth / imageRect.width;