@gradio/annotatedimage 0.10.1-dev.2 → 0.11.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,41 @@
1
1
  # @gradio/annotatedimage
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Features
6
+
7
+ - [#12539](https://github.com/gradio-app/gradio/pull/12539) [`f1d83fa`](https://github.com/gradio-app/gradio/commit/f1d83fac3d6e4bad60cf896a026fa2d572f26073) - Add ability to add custom buttons to components. Thanks @abidlabs!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/atoms@0.20.0
12
+ - @gradio/utils@0.11.0
13
+ - @gradio/client@2.0.1
14
+ - @gradio/statustracker@0.12.1
15
+ - @gradio/upload@0.17.3
16
+
17
+ ## 0.10.1
18
+
19
+ ### Dependency updates
20
+
21
+ - @gradio/utils@0.10.4
22
+
23
+ ## 0.10.1
24
+
25
+ ### Features
26
+
27
+ - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Add back default values for labels
28
+ - [#12438](https://github.com/gradio-app/gradio/pull/12438) [`25ffc03`](https://github.com/gradio-app/gradio/commit/25ffc0398f8feb43d817c02b2ab970c16de6d797) - Svelte5 migration and bugfix
29
+
30
+ ### Dependencies
31
+
32
+ - @gradio/atoms@0.19.0
33
+ - @gradio/icons@0.15.0
34
+ - @gradio/statustracker@0.12.0
35
+ - @gradio/upload@0.17.2
36
+ - @gradio/utils@0.10.3
37
+ - @gradio/client@2.0.0
38
+
3
39
  ## 0.10.1-dev.2
4
40
 
5
41
  ### Dependency updates
package/Index.svelte CHANGED
@@ -6,6 +6,7 @@
6
6
  IconButtonWrapper,
7
7
  FullscreenButton
8
8
  } from "@gradio/atoms";
9
+ import type { CustomButton as CustomButtonType } from "@gradio/utils";
9
10
  import { Image } from "@gradio/icons";
10
11
  import { StatusTracker } from "@gradio/statustracker";
11
12
  import { Gradio } from "@gradio/utils";
@@ -70,8 +71,13 @@
70
71
  <Empty size="large" unpadded_box={true}><Image /></Empty>
71
72
  {:else}
72
73
  <div class="image-container" bind:this={image_container}>
73
- <IconButtonWrapper>
74
- {#if gradio.props.buttons.includes("fullscreen") ?? true}
74
+ <IconButtonWrapper
75
+ buttons={gradio.props.buttons || []}
76
+ on_custom_button_click={(id) => {
77
+ gradio.dispatch("custom_button_click", { id });
78
+ }}
79
+ >
80
+ {#if (gradio.props.buttons || []).some((btn) => typeof btn === "string" && btn === "fullscreen")}
75
81
  <FullscreenButton
76
82
  {fullscreen}
77
83
  on:fullscreen={({ detail }) => {
package/dist/Index.svelte CHANGED
@@ -6,6 +6,7 @@
6
6
  IconButtonWrapper,
7
7
  FullscreenButton
8
8
  } from "@gradio/atoms";
9
+ import type { CustomButton as CustomButtonType } from "@gradio/utils";
9
10
  import { Image } from "@gradio/icons";
10
11
  import { StatusTracker } from "@gradio/statustracker";
11
12
  import { Gradio } from "@gradio/utils";
@@ -70,8 +71,13 @@
70
71
  <Empty size="large" unpadded_box={true}><Image /></Empty>
71
72
  {:else}
72
73
  <div class="image-container" bind:this={image_container}>
73
- <IconButtonWrapper>
74
- {#if gradio.props.buttons.includes("fullscreen") ?? true}
74
+ <IconButtonWrapper
75
+ buttons={gradio.props.buttons || []}
76
+ on_custom_button_click={(id) => {
77
+ gradio.dispatch("custom_button_click", { id });
78
+ }}
79
+ >
80
+ {#if (gradio.props.buttons || []).some((btn) => typeof btn === "string" && btn === "fullscreen")}
75
81
  <FullscreenButton
76
82
  {fullscreen}
77
83
  on:fullscreen={({ detail }) => {
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { FileData } from "@gradio/client";
2
+ import type { CustomButton } from "@gradio/utils";
2
3
  export interface Annotation {
3
4
  image: FileData;
4
5
  label: string;
@@ -13,7 +14,7 @@ export interface AnnotatedImageProps {
13
14
  height: number | undefined;
14
15
  width: number | undefined;
15
16
  color_map: Record<string, string>;
16
- buttons: string[];
17
+ buttons: (string | CustomButton)[];
17
18
  }
18
19
  export interface AnnotatedImageEvents {
19
20
  change: never;
@@ -21,4 +22,7 @@ export interface AnnotatedImageEvents {
21
22
  index: number;
22
23
  value: string;
23
24
  };
25
+ custom_button_click: {
26
+ id: number;
27
+ };
24
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/annotatedimage",
3
- "version": "0.10.1-dev.2",
3
+ "version": "0.11.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -16,18 +16,18 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "devDependencies": {
19
- "@gradio/preview": "^0.15.0-dev.0"
19
+ "@gradio/preview": "^0.15.1"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "svelte": "^5.43.4"
23
23
  },
24
24
  "dependencies": {
25
- "@gradio/atoms": "^0.19.0-dev.1",
26
- "@gradio/utils": "^0.10.3-dev.0",
27
- "@gradio/statustracker": "^0.12.0-dev.1",
28
- "@gradio/icons": "^0.15.0-dev.0",
29
- "@gradio/client": "^2.0.0-dev.2",
30
- "@gradio/upload": "^0.17.2-dev.2"
25
+ "@gradio/atoms": "^0.20.0",
26
+ "@gradio/statustracker": "^0.12.1",
27
+ "@gradio/utils": "^0.11.0",
28
+ "@gradio/upload": "^0.17.3",
29
+ "@gradio/client": "^2.0.1",
30
+ "@gradio/icons": "^0.15.0"
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",
package/types.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { FileData } from "@gradio/client";
2
+ import type { CustomButton } from "@gradio/utils";
2
3
 
3
4
  export interface Annotation {
4
5
  image: FileData;
@@ -16,10 +17,11 @@ export interface AnnotatedImageProps {
16
17
  height: number | undefined;
17
18
  width: number | undefined;
18
19
  color_map: Record<string, string>;
19
- buttons: string[];
20
+ buttons: (string | CustomButton)[];
20
21
  }
21
22
 
22
23
  export interface AnnotatedImageEvents {
23
24
  change: never;
24
25
  select: { index: number; value: string };
26
+ custom_button_click: { id: number };
25
27
  }