@gradio/image 0.12.2 → 0.13.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,24 @@
1
1
  # @gradio/image
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Features
6
+
7
+ - [#8803](https://github.com/gradio-app/gradio/pull/8803) [`e1a4040`](https://github.com/gradio-app/gradio/commit/e1a404093cfaf9d8f2a92bc1d28fb6aa254848d1) - Ensure all upload components have consistent upload regions. Thanks @pngwn!
8
+
9
+ ### Fixes
10
+
11
+ - [#8836](https://github.com/gradio-app/gradio/pull/8836) [`7e8c829`](https://github.com/gradio-app/gradio/commit/7e8c829aad85d3d5a31a03f4f2e41483d1e6b53e) - Add `.input()` events to `gr.Audio` and `gr.Image`. Thanks @abidlabs!
12
+ - [#8852](https://github.com/gradio-app/gradio/pull/8852) [`16b8200`](https://github.com/gradio-app/gradio/commit/16b820038df43905447ab7623d39d91ceb0d6238) - Fix gr.Image height inconsistencies. Thanks @hannahblair!
13
+
14
+ ### Dependency updates
15
+
16
+ - @gradio/wasm@0.12.0
17
+ - @gradio/client@1.4.0
18
+ - @gradio/statustracker@0.7.2
19
+ - @gradio/upload@0.12.0
20
+ - @gradio/atoms@0.7.7
21
+
3
22
  ## 0.12.2
4
23
 
5
24
  ### Fixes
package/Index.svelte CHANGED
@@ -12,6 +12,7 @@
12
12
  import type { Gradio, SelectData } from "@gradio/utils";
13
13
  import StaticImage from "./shared/ImagePreview.svelte";
14
14
  import ImageUploader from "./shared/ImageUploader.svelte";
15
+ import { afterUpdate } from "svelte";
15
16
 
16
17
  import { Block, Empty, UploadText } from "@gradio/atoms";
17
18
  import { Image } from "@gradio/icons";
@@ -21,6 +22,7 @@
21
22
 
22
23
  type sources = "upload" | "webcam" | "clipboard" | null;
23
24
 
25
+ export let value_is_output = false;
24
26
  export let elem_id = "";
25
27
  export let elem_classes: string[] = [];
26
28
  export let visible = true;
@@ -51,6 +53,7 @@
51
53
  export let mirror_webcam: boolean;
52
54
 
53
55
  export let gradio: Gradio<{
56
+ input: never;
54
57
  change: never;
55
58
  error: string;
56
59
  edit: never;
@@ -67,8 +70,14 @@
67
70
  if (JSON.stringify(value) !== JSON.stringify(old_value)) {
68
71
  old_value = value;
69
72
  gradio.dispatch("change");
73
+ if (!value_is_output) {
74
+ gradio.dispatch("input");
75
+ }
70
76
  }
71
77
  }
78
+ afterUpdate(() => {
79
+ value_is_output = false;
80
+ });
72
81
 
73
82
  let dragging: boolean;
74
83
  let active_source: sources = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/image",
3
- "version": "0.12.2",
3
+ "version": "0.13.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -10,13 +10,13 @@
10
10
  "cropperjs": "^1.5.12",
11
11
  "lazy-brush": "^1.0.1",
12
12
  "resize-observer-polyfill": "^1.5.1",
13
- "@gradio/atoms": "^0.7.6",
14
- "@gradio/client": "^1.3.0",
13
+ "@gradio/atoms": "^0.7.7",
14
+ "@gradio/client": "^1.4.0",
15
15
  "@gradio/icons": "^0.6.0",
16
- "@gradio/statustracker": "^0.7.1",
16
+ "@gradio/statustracker": "^0.7.2",
17
+ "@gradio/upload": "^0.12.0",
17
18
  "@gradio/utils": "^0.5.1",
18
- "@gradio/upload": "^0.11.5",
19
- "@gradio/wasm": "^0.11.0"
19
+ "@gradio/wasm": "^0.12.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@gradio/preview": "^0.10.1"
@@ -69,6 +69,9 @@
69
69
  {/if}
70
70
 
71
71
  <style>
72
+ .image-container {
73
+ height: 100%;
74
+ }
72
75
  .image-container :global(img),
73
76
  button {
74
77
  width: var(--size-full);
@@ -109,7 +109,7 @@
109
109
  }}
110
110
  />
111
111
  {/if}
112
- <div class="upload-container">
112
+ <div class="upload-container" class:reduced-height={sources.length > 1}>
113
113
  <Upload
114
114
  hidden={value !== null || active_source === "webcam"}
115
115
  bind:this={upload_input}
@@ -165,7 +165,7 @@
165
165
  .image-frame :global(img) {
166
166
  width: var(--size-full);
167
167
  height: var(--size-full);
168
- object-fit: cover;
168
+ object-fit: contain;
169
169
  }
170
170
 
171
171
  .image-frame {
@@ -178,6 +178,11 @@
178
178
  height: 100%;
179
179
  flex-shrink: 1;
180
180
  max-height: 100%;
181
+ width: 100%;
182
+ }
183
+
184
+ .reduced-height {
185
+ height: calc(100% - var(--size-10));
181
186
  }
182
187
 
183
188
  .image-container {
@@ -233,7 +233,11 @@
233
233
  class:hide={!webcam_accessed}
234
234
  />
235
235
  {#if !webcam_accessed}
236
- <div in:fade={{ delay: 100, duration: 200 }} title="grant webcam access">
236
+ <div
237
+ in:fade={{ delay: 100, duration: 200 }}
238
+ title="grant webcam access"
239
+ style="height: 100%"
240
+ >
237
241
  <WebcamPermissions on:click={async () => access_webcam()} />
238
242
  </div>
239
243
  {:else}