@gradio/dataset 0.5.6 → 0.5.8

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,26 @@
1
1
  # @gradio/dataset
2
2
 
3
+ ## 0.5.8
4
+
5
+ ### Features
6
+
7
+ - [#13231](https://github.com/gradio-app/gradio/pull/13231) [`89f7a09`](https://github.com/gradio-app/gradio/commit/89f7a096ceb947c97ac5dce9f8b8d62e1361ad7b) - Layout tests. Thanks @pngwn!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/atoms@0.23.1
12
+ - @gradio/client@2.2.0
13
+ - @gradio/textbox@0.13.8
14
+
15
+ ## 0.5.7
16
+
17
+ ### Dependency updates
18
+
19
+ - @gradio/utils@0.12.2
20
+ - @gradio/atoms@0.23.0
21
+ - @gradio/upload@0.17.8
22
+ - @gradio/textbox@0.13.7
23
+
3
24
  ## 0.5.6
4
25
 
5
26
  ### Fixes
package/Dataset.svelte CHANGED
@@ -110,7 +110,7 @@
110
110
  value: any;
111
111
  component: LoadingComponent;
112
112
  runtime: false | typeof import("svelte");
113
- }[][] = [];
113
+ }[][] = $state([]);
114
114
 
115
115
  async function get_component_meta(
116
116
  selected_samples_json: string
@@ -145,10 +145,39 @@
145
145
  let selected_samples_json = $derived(JSON.stringify(selected_samples || []));
146
146
  </script>
147
147
 
148
- {#await get_component_meta(selected_samples_json) then _}
148
+ {#await get_component_meta(selected_samples_json)}
149
149
  {#if gallery}
150
150
  <div class="gallery">
151
- {#each selected_samples as sample_row, i}
151
+ {#each selected_samples as sample_row, i (i)}
152
+ {#if sample_row[0] != null}
153
+ <button
154
+ class="gallery-item"
155
+ onclick={() => {
156
+ value = i + page * samples_per_page;
157
+ onclick({ index: value, value: sample_row });
158
+ onselect({ index: value, value: sample_row });
159
+ }}
160
+ onmouseenter={() => handle_mouseenter(i)}
161
+ onmouseleave={() => handle_mouseleave()}
162
+ >
163
+ {#if sample_labels}
164
+ <BaseExample
165
+ value={sample_row[0]}
166
+ selected={current_hover === i}
167
+ type="gallery"
168
+ />
169
+ {:else}
170
+ {sample_row[0]}
171
+ {/if}
172
+ </button>
173
+ {/if}
174
+ {/each}
175
+ </div>
176
+ {/if}
177
+ {:then _}
178
+ {#if gallery}
179
+ <div class="gallery">
180
+ {#each selected_samples as sample_row, i (i)}
152
181
  {#if sample_row[0] != null}
153
182
  <button
154
183
  class="gallery-item"
@@ -192,7 +221,7 @@
192
221
  <table tabindex="0" role="grid">
193
222
  <thead>
194
223
  <tr class="tr-head">
195
- {#each headers as header}
224
+ {#each headers as header (header)}
196
225
  <th>
197
226
  {header}
198
227
  </th>
@@ -200,7 +229,7 @@
200
229
  </tr>
201
230
  </thead>
202
231
  <tbody>
203
- {#each component_meta as sample_row, i}
232
+ {#each component_meta as sample_row, i (i)}
204
233
  <tr
205
234
  class="tr-body"
206
235
  onclick={() => {
@@ -214,7 +243,7 @@
214
243
  onmouseenter={() => handle_mouseenter(i)}
215
244
  onmouseleave={() => handle_mouseleave()}
216
245
  >
217
- {#each sample_row as { value, component, runtime }, j}
246
+ {#each sample_row as { value, component, runtime }, j (j)}
218
247
  {@const component_name = components[j]}
219
248
 
220
249
  {#if component_name !== undefined}
@@ -249,7 +278,7 @@
249
278
  {#if paginate}
250
279
  <div class="paginate">
251
280
  Pages:
252
- {#each visible_pages as visible_page}
281
+ {#each visible_pages as visible_page (visible_page)}
253
282
  {#if visible_page === -1}
254
283
  <div>...</div>
255
284
  {:else}
@@ -110,7 +110,7 @@
110
110
  value: any;
111
111
  component: LoadingComponent;
112
112
  runtime: false | typeof import("svelte");
113
- }[][] = [];
113
+ }[][] = $state([]);
114
114
 
115
115
  async function get_component_meta(
116
116
  selected_samples_json: string
@@ -145,10 +145,39 @@
145
145
  let selected_samples_json = $derived(JSON.stringify(selected_samples || []));
146
146
  </script>
147
147
 
148
- {#await get_component_meta(selected_samples_json) then _}
148
+ {#await get_component_meta(selected_samples_json)}
149
149
  {#if gallery}
150
150
  <div class="gallery">
151
- {#each selected_samples as sample_row, i}
151
+ {#each selected_samples as sample_row, i (i)}
152
+ {#if sample_row[0] != null}
153
+ <button
154
+ class="gallery-item"
155
+ onclick={() => {
156
+ value = i + page * samples_per_page;
157
+ onclick({ index: value, value: sample_row });
158
+ onselect({ index: value, value: sample_row });
159
+ }}
160
+ onmouseenter={() => handle_mouseenter(i)}
161
+ onmouseleave={() => handle_mouseleave()}
162
+ >
163
+ {#if sample_labels}
164
+ <BaseExample
165
+ value={sample_row[0]}
166
+ selected={current_hover === i}
167
+ type="gallery"
168
+ />
169
+ {:else}
170
+ {sample_row[0]}
171
+ {/if}
172
+ </button>
173
+ {/if}
174
+ {/each}
175
+ </div>
176
+ {/if}
177
+ {:then _}
178
+ {#if gallery}
179
+ <div class="gallery">
180
+ {#each selected_samples as sample_row, i (i)}
152
181
  {#if sample_row[0] != null}
153
182
  <button
154
183
  class="gallery-item"
@@ -192,7 +221,7 @@
192
221
  <table tabindex="0" role="grid">
193
222
  <thead>
194
223
  <tr class="tr-head">
195
- {#each headers as header}
224
+ {#each headers as header (header)}
196
225
  <th>
197
226
  {header}
198
227
  </th>
@@ -200,7 +229,7 @@
200
229
  </tr>
201
230
  </thead>
202
231
  <tbody>
203
- {#each component_meta as sample_row, i}
232
+ {#each component_meta as sample_row, i (i)}
204
233
  <tr
205
234
  class="tr-body"
206
235
  onclick={() => {
@@ -214,7 +243,7 @@
214
243
  onmouseenter={() => handle_mouseenter(i)}
215
244
  onmouseleave={() => handle_mouseleave()}
216
245
  >
217
- {#each sample_row as { value, component, runtime }, j}
246
+ {#each sample_row as { value, component, runtime }, j (j)}
218
247
  {@const component_name = components[j]}
219
248
 
220
249
  {#if component_name !== undefined}
@@ -249,7 +278,7 @@
249
278
  {#if paginate}
250
279
  <div class="paginate">
251
280
  Pages:
252
- {#each visible_pages as visible_page}
281
+ {#each visible_pages as visible_page (visible_page)}
253
282
  {#if visible_page === -1}
254
283
  <div>...</div>
255
284
  {:else}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/dataset",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -16,14 +16,14 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "dependencies": {
19
- "@gradio/client": "^2.1.0",
20
- "@gradio/utils": "^0.12.1",
21
- "@gradio/textbox": "^0.13.6",
22
- "@gradio/upload": "^0.17.7",
23
- "@gradio/atoms": "^0.22.2"
19
+ "@gradio/atoms": "^0.23.1",
20
+ "@gradio/client": "^2.2.0",
21
+ "@gradio/utils": "^0.12.2",
22
+ "@gradio/upload": "^0.17.8",
23
+ "@gradio/textbox": "^0.13.8"
24
24
  },
25
25
  "devDependencies": {
26
- "@gradio/preview": "^0.16.1"
26
+ "@gradio/preview": "^0.16.2"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "svelte": "^5.48.0"