@gradio/dataset 0.5.9 → 0.7.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,36 @@
1
1
  # @gradio/dataset
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Features
6
+
7
+ - [#13526](https://github.com/gradio-app/gradio/pull/13526) [`53cb4ca`](https://github.com/gradio-app/gradio/commit/53cb4cae1ec3521e9170d12867253516413ba37a) - Run `pnpm lint` and `pnpm ts:check` on CI. Thanks @abidlabs!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/atoms@0.25.0
12
+ - @gradio/utils@0.13.0
13
+ - @gradio/client@2.3.0
14
+ - @gradio/upload@0.18.0
15
+ - @gradio/textbox@0.14.0
16
+
17
+ ## 0.6.0
18
+
19
+ ### Features
20
+
21
+ - [#13502](https://github.com/gradio-app/gradio/pull/13502) [`429faeb`](https://github.com/gradio-app/gradio/commit/429faeb643fb1afc1722c0f63fafa11603f2c87f) - Ensure every component dispatches a `change` event when its value changes. Thanks @abidlabs!
22
+
23
+ ### Dependency updates
24
+
25
+ - @gradio/client@2.2.2
26
+
27
+ ## 0.5.9
28
+
29
+ ### Dependency updates
30
+
31
+ - @gradio/client@2.2.1
32
+ - @gradio/upload@0.17.10
33
+
3
34
  ## 0.5.9
4
35
 
5
36
  ### Fixes
package/Dataset.svelte CHANGED
@@ -9,7 +9,7 @@
9
9
  import MountExample from "./MountExample.svelte";
10
10
 
11
11
  interface Props {
12
- components: string[];
12
+ components: { name: string; class_id: string }[];
13
13
  component_props: Record<string, any>[];
14
14
  load_component: load_component_type;
15
15
  headers: string[];
@@ -245,7 +245,7 @@
245
245
  onmouseleave={() => handle_mouseleave()}
246
246
  >
247
247
  {#each sample_row as { value, component, runtime }, j (j)}
248
- {@const component_name = components[j]}
248
+ {@const component_name = components[j]?.name}
249
249
 
250
250
  {#if component_name !== undefined}
251
251
  <td
package/Index.svelte CHANGED
@@ -9,6 +9,7 @@
9
9
  let props = $props();
10
10
 
11
11
  const gradio = new Gradio<DatasetEvents, DatasetProps>(props);
12
+ gradio.watch_for_change();
12
13
 
13
14
  // Need to mark samples as state, otherwise get_component_meta constantly triggers
14
15
  let samples = $derived(gradio.props.samples ?? []);
@@ -47,13 +48,13 @@
47
48
 
48
49
  <Dataset
49
50
  onclick={(d) => (
50
- (gradio.props.value = d.index),
51
- gradio.dispatch("click", gradio.props.value)
51
+ (gradio.props.value = Array.isArray(d.index) ? d.index[0] : d.index),
52
+ gradio.dispatch("click")
52
53
  )}
53
54
  onselect={(data) => gradio.dispatch("select", data)}
54
55
  load_component={gradio.shared.load_component}
55
- {samples}
56
56
  {...gradio.props}
57
+ {samples}
57
58
  />
58
59
  </Block>
59
60
 
@@ -8,7 +8,7 @@
8
8
  }
9
9
 
10
10
  let { component, runtime, ...rest }: Props = $props();
11
- let el: HTMLElement = $state(null);
11
+ let el: HTMLElement | null = $state(null);
12
12
 
13
13
  $effect(() => {
14
14
  if (!el || !component) return;
@@ -9,7 +9,7 @@
9
9
  import MountExample from "./MountExample.svelte";
10
10
 
11
11
  interface Props {
12
- components: string[];
12
+ components: { name: string; class_id: string }[];
13
13
  component_props: Record<string, any>[];
14
14
  load_component: load_component_type;
15
15
  headers: string[];
@@ -245,7 +245,7 @@
245
245
  onmouseleave={() => handle_mouseleave()}
246
246
  >
247
247
  {#each sample_row as { value, component, runtime }, j (j)}
248
- {@const component_name = components[j]}
248
+ {@const component_name = components[j]?.name}
249
249
 
250
250
  {#if component_name !== undefined}
251
251
  <td
@@ -1,7 +1,10 @@
1
1
  import type { SelectData } from "@gradio/utils";
2
2
  import type { load_component as load_component_type } from "@gradio/utils";
3
3
  interface Props {
4
- components: string[];
4
+ components: {
5
+ name: string;
6
+ class_id: string;
7
+ }[];
5
8
  component_props: Record<string, any>[];
6
9
  load_component: load_component_type;
7
10
  headers: string[];
package/dist/Index.svelte CHANGED
@@ -9,6 +9,7 @@
9
9
  let props = $props();
10
10
 
11
11
  const gradio = new Gradio<DatasetEvents, DatasetProps>(props);
12
+ gradio.watch_for_change();
12
13
 
13
14
  // Need to mark samples as state, otherwise get_component_meta constantly triggers
14
15
  let samples = $derived(gradio.props.samples ?? []);
@@ -47,13 +48,13 @@
47
48
 
48
49
  <Dataset
49
50
  onclick={(d) => (
50
- (gradio.props.value = d.index),
51
- gradio.dispatch("click", gradio.props.value)
51
+ (gradio.props.value = Array.isArray(d.index) ? d.index[0] : d.index),
52
+ gradio.dispatch("click")
52
53
  )}
53
54
  onselect={(data) => gradio.dispatch("select", data)}
54
55
  load_component={gradio.shared.load_component}
55
- {samples}
56
56
  {...gradio.props}
57
+ {samples}
57
58
  />
58
59
  </Block>
59
60
 
@@ -8,7 +8,7 @@
8
8
  }
9
9
 
10
10
  let { component, runtime, ...rest }: Props = $props();
11
- let el: HTMLElement = $state(null);
11
+ let el: HTMLElement | null = $state(null);
12
12
 
13
13
  $effect(() => {
14
14
  if (!el || !component) return;
package/dist/types.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import type { SelectData } from "@gradio/utils";
2
2
  export interface DatasetProps {
3
- components: string[];
3
+ components: {
4
+ name: string;
5
+ class_id: string;
6
+ }[];
4
7
  component_props: Record<string, any>[];
5
8
  headers: string[];
6
9
  samples: any[][] | null;
@@ -12,6 +15,7 @@ export interface DatasetProps {
12
15
  layout: "gallery" | "table" | null;
13
16
  }
14
17
  export interface DatasetEvents {
18
+ change: never;
15
19
  click: never;
16
20
  select: SelectData;
17
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/dataset",
3
- "version": "0.5.9",
3
+ "version": "0.7.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -16,11 +16,11 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "dependencies": {
19
- "@gradio/atoms": "^0.24.0",
20
- "@gradio/utils": "^0.12.2",
21
- "@gradio/client": "^2.2.0",
22
- "@gradio/textbox": "^0.13.9",
23
- "@gradio/upload": "^0.17.9"
19
+ "@gradio/atoms": "^0.25.0",
20
+ "@gradio/client": "^2.3.0",
21
+ "@gradio/textbox": "^0.14.0",
22
+ "@gradio/utils": "^0.13.0",
23
+ "@gradio/upload": "^0.18.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@gradio/preview": "^0.16.2"
package/types.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { SelectData } from "@gradio/utils";
2
2
 
3
3
  export interface DatasetProps {
4
- components: string[];
4
+ components: { name: string; class_id: string }[];
5
5
  component_props: Record<string, any>[];
6
6
  headers: string[];
7
7
  samples: any[][] | null;
@@ -15,6 +15,7 @@ export interface DatasetProps {
15
15
  }
16
16
 
17
17
  export interface DatasetEvents {
18
+ change: never;
18
19
  click: never;
19
20
  select: SelectData;
20
21
  }