@gradio/core 0.25.0 → 0.26.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,34 @@
1
1
  # @gradio/core
2
2
 
3
+ ## 0.26.0
4
+
5
+ ### Features
6
+
7
+ - [#11691](https://github.com/gradio-app/gradio/pull/11691) [`2605a99`](https://github.com/gradio-app/gradio/commit/2605a99bf29bebbbb0a97cc8e0015b5bf8d8e79b) - Add .failure() event listener for error handling. Thanks @elanehan!
8
+
9
+ ### Fixes
10
+
11
+ - [#11698](https://github.com/gradio-app/gradio/pull/11698) [`fc41f09`](https://github.com/gradio-app/gradio/commit/fc41f0950b7c427abcebdc9a113148a219d8f3f6) - Fix visibility changes in gr.render. Thanks @aliabid94!
12
+
13
+ ### Dependency updates
14
+
15
+ - @gradio/code@0.14.14
16
+ - @gradio/paramviewer@0.7.14
17
+ - @gradio/statustracker@0.10.16
18
+ - @gradio/video@0.14.24
19
+ - @gradio/atoms@0.16.4
20
+ - @gradio/column@0.2.1
21
+ - @gradio/client@1.17.0
22
+ - @gradio/upload@0.16.14
23
+ - @gradio/button@0.5.10
24
+ - @gradio/gallery@0.15.30
25
+ - @gradio/plot@0.9.21
26
+ - @gradio/checkbox@0.4.27
27
+ - @gradio/textbox@0.10.19
28
+ - @gradio/dropdown@0.10.1
29
+ - @gradio/file@0.12.27
30
+ - @gradio/image@0.22.16
31
+
3
32
  ## 0.25.0
4
33
 
5
34
  ### Features
@@ -562,7 +562,7 @@ async function trigger_api_call(dep_index, trigger_id = null, event_data = null)
562
562
  }
563
563
  if (status.stage === "complete") {
564
564
  dependencies.forEach(async (dep2) => {
565
- if (dep2.trigger_after === fn_index) {
565
+ if (dep2.trigger_after === fn_index && !dep2.trigger_only_on_failure) {
566
566
  wait_then_trigger_api_call(dep2.id, payload2.trigger_id);
567
567
  }
568
568
  });
@@ -591,7 +591,7 @@ async function trigger_api_call(dep_index, trigger_id = null, event_data = null)
591
591
  ];
592
592
  }
593
593
  dependencies.map(async (dep2) => {
594
- if (dep2.trigger_after === fn_index && !dep2.trigger_only_on_success) {
594
+ if (dep2.trigger_after === fn_index && (!dep2.trigger_only_on_success || dep2.trigger_only_on_failure)) {
595
595
  wait_then_trigger_api_call(dep2.id, payload2.trigger_id);
596
596
  }
597
597
  });
package/dist/src/init.js CHANGED
@@ -241,15 +241,15 @@ export function create_components({ initial_layout = undefined } = {
241
241
  * Load newly visible components after visibility changes
242
242
  * @param newly_visible_ids Set of component IDs that are now visible
243
243
  */
244
- async function load_newly_visible_components(newly_visible_ids) {
244
+ async function load_newly_visible_components(newly_visible_ids, components) {
245
245
  if (newly_visible_ids.size === 0)
246
246
  return;
247
- const components_to_load = _components.filter((c) => newly_visible_ids.has(c.id));
247
+ const components_to_load = components.filter((c) => newly_visible_ids.has(c.id));
248
248
  for (const component of components_to_load) {
249
249
  const constructor_key = component.component_class_id || component.type;
250
250
  // Only load if not already loaded
251
251
  if (!constructor_map.has(constructor_key)) {
252
- const { component: loadable_component, example_components } = get_component(component.type, component.component_class_id, current_root, _components);
252
+ const { component: loadable_component, example_components } = get_component(component.type, component.component_class_id, current_root, components);
253
253
  constructor_map.set(constructor_key, loadable_component);
254
254
  if (example_components) {
255
255
  for (const [name, example_component] of example_components) {
@@ -290,9 +290,12 @@ export function create_components({ initial_layout = undefined } = {
290
290
  function flush() {
291
291
  const had_visibility_changes = has_visibility_changes(pending_updates);
292
292
  let previous_visible_ids;
293
+ const all_components = _component_map
294
+ ? [..._component_map.values()]
295
+ : _components;
293
296
  // Capture current visibility state before applying updates
294
297
  if (had_visibility_changes && current_layout) {
295
- previous_visible_ids = determine_visible_components(current_layout, _components);
298
+ previous_visible_ids = determine_visible_components(current_layout, all_components);
296
299
  }
297
300
  layout_store.update((layout) => {
298
301
  for (let i = 0; i < pending_updates.length; i++) {
@@ -330,7 +333,7 @@ export function create_components({ initial_layout = undefined } = {
330
333
  // After applying updates, check if we need to load new components
331
334
  if (had_visibility_changes && current_layout && previous_visible_ids) {
332
335
  raf(async () => {
333
- const new_visible_ids = determine_visible_components(current_layout, _components);
336
+ const new_visible_ids = determine_visible_components(current_layout, all_components);
334
337
  const newly_visible_ids = new Set();
335
338
  // Find components that are now visible but weren't before
336
339
  for (const id of new_visible_ids) {
@@ -339,7 +342,7 @@ export function create_components({ initial_layout = undefined } = {
339
342
  }
340
343
  }
341
344
  // Load the newly visible components
342
- await load_newly_visible_components(newly_visible_ids);
345
+ await load_newly_visible_components(newly_visible_ids, all_components);
343
346
  // Trigger a layout update to render the newly loaded components
344
347
  if (newly_visible_ids.size > 0) {
345
348
  layout_store.update((layout) => layout);
@@ -62,6 +62,7 @@ export interface Dependency {
62
62
  pending_request?: boolean;
63
63
  trigger_after?: number;
64
64
  trigger_only_on_success?: boolean;
65
+ trigger_only_on_failure?: boolean;
65
66
  trigger_mode: "once" | "multiple" | "always_last";
66
67
  final_event: Payload | null;
67
68
  show_api: boolean;
package/package.json CHANGED
@@ -1,69 +1,69 @@
1
1
  {
2
2
  "name": "@gradio/core",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
- "@gradio/accordion": "^0.5.20",
7
- "@gradio/atoms": "^0.16.3",
8
- "@gradio/annotatedimage": "^0.9.27",
9
- "@gradio/box": "^0.2.21",
6
+ "@gradio/accordion": "^0.5.21",
7
+ "@gradio/annotatedimage": "^0.9.28",
8
+ "@gradio/audio": "^0.17.24",
9
+ "@gradio/box": "^0.2.22",
10
+ "@gradio/atoms": "^0.16.4",
10
11
  "@gradio/browserstate": "^0.3.2",
11
- "@gradio/audio": "^0.17.23",
12
- "@gradio/chatbot": "^0.26.20",
13
- "@gradio/button": "^0.5.9",
14
- "@gradio/checkboxgroup": "^0.6.25",
15
- "@gradio/checkbox": "^0.4.26",
16
- "@gradio/client": "^1.16.0",
17
- "@gradio/code": "^0.14.13",
18
- "@gradio/colorpicker": "^0.4.25",
12
+ "@gradio/button": "^0.5.10",
13
+ "@gradio/chatbot": "^0.26.21",
14
+ "@gradio/checkbox": "^0.4.27",
15
+ "@gradio/checkboxgroup": "^0.6.26",
16
+ "@gradio/client": "^1.17.0",
17
+ "@gradio/code": "^0.14.14",
18
+ "@gradio/colorpicker": "^0.4.26",
19
+ "@gradio/dataframe": "^0.18.7",
20
+ "@gradio/dataset": "^0.4.31",
19
21
  "@gradio/column": "^0.2.1",
20
- "@gradio/dataset": "^0.4.30",
21
- "@gradio/dataframe": "^0.18.5",
22
- "@gradio/downloadbutton": "^0.4.9",
23
- "@gradio/datetime": "^0.3.18",
24
- "@gradio/dropdown": "^0.10.0",
25
- "@gradio/file": "^0.12.26",
26
- "@gradio/fileexplorer": "^0.5.37",
27
- "@gradio/fallback": "^0.4.25",
28
- "@gradio/form": "^0.2.21",
29
- "@gradio/gallery": "^0.15.29",
22
+ "@gradio/datetime": "^0.3.19",
23
+ "@gradio/downloadbutton": "^0.4.10",
24
+ "@gradio/dropdown": "^0.10.1",
25
+ "@gradio/fallback": "^0.4.26",
26
+ "@gradio/file": "^0.12.27",
27
+ "@gradio/fileexplorer": "^0.5.38",
28
+ "@gradio/gallery": "^0.15.30",
29
+ "@gradio/form": "^0.2.22",
30
+ "@gradio/html": "^0.6.18",
30
31
  "@gradio/group": "^0.2.0",
31
- "@gradio/highlightedtext": "^0.9.8",
32
- "@gradio/html": "^0.6.17",
32
+ "@gradio/highlightedtext": "^0.9.9",
33
33
  "@gradio/icons": "^0.12.0",
34
- "@gradio/image": "^0.22.15",
35
- "@gradio/imageeditor": "^0.16.3",
36
- "@gradio/imageslider": "^0.2.11",
37
- "@gradio/label": "^0.5.17",
38
- "@gradio/multimodaltextbox": "^0.10.15",
39
- "@gradio/markdown": "^0.13.18",
40
- "@gradio/model3d": "^0.14.23",
41
- "@gradio/json": "^0.5.27",
42
- "@gradio/nativeplot": "^0.7.2",
43
- "@gradio/number": "^0.6.2",
44
- "@gradio/paramviewer": "^0.7.13",
45
- "@gradio/plot": "^0.9.20",
46
- "@gradio/radio": "^0.7.8",
34
+ "@gradio/image": "^0.22.16",
35
+ "@gradio/imageeditor": "^0.16.4",
36
+ "@gradio/imageslider": "^0.2.12",
37
+ "@gradio/label": "^0.5.18",
38
+ "@gradio/json": "^0.5.28",
39
+ "@gradio/model3d": "^0.14.24",
40
+ "@gradio/multimodaltextbox": "^0.10.16",
41
+ "@gradio/markdown": "^0.13.19",
42
+ "@gradio/number": "^0.6.3",
43
+ "@gradio/nativeplot": "^0.7.3",
44
+ "@gradio/plot": "^0.9.21",
45
+ "@gradio/paramviewer": "^0.7.14",
46
+ "@gradio/radio": "^0.7.9",
47
+ "@gradio/sidebar": "^0.1.19",
47
48
  "@gradio/row": "^0.2.1",
48
- "@gradio/sidebar": "^0.1.18",
49
- "@gradio/simpleimage": "^0.8.37",
50
- "@gradio/simpletextbox": "^0.3.26",
51
- "@gradio/simpledropdown": "^0.3.25",
52
- "@gradio/sketchbox": "^0.6.13",
53
- "@gradio/slider": "^0.6.14",
49
+ "@gradio/simpletextbox": "^0.3.27",
50
+ "@gradio/simpleimage": "^0.8.38",
51
+ "@gradio/slider": "^0.6.15",
52
+ "@gradio/sketchbox": "^0.6.14",
54
53
  "@gradio/state": "^0.1.2",
54
+ "@gradio/simpledropdown": "^0.3.26",
55
55
  "@gradio/tabitem": "^0.5.0",
56
56
  "@gradio/tabs": "^0.4.5",
57
- "@gradio/statustracker": "^0.10.15",
58
- "@gradio/textbox": "^0.10.18",
57
+ "@gradio/textbox": "^0.10.19",
58
+ "@gradio/statustracker": "^0.10.16",
59
59
  "@gradio/theme": "^0.4.0",
60
60
  "@gradio/timer": "^0.4.5",
61
+ "@gradio/upload": "^0.16.14",
61
62
  "@gradio/utils": "^0.10.2",
62
- "@gradio/vibeeditor": "^0.2.0",
63
- "@gradio/uploadbutton": "^0.9.9",
64
- "@gradio/video": "^0.14.23",
65
- "@gradio/upload": "^0.16.13",
66
- "@gradio/wasm": "^0.18.1"
63
+ "@gradio/uploadbutton": "^0.9.10",
64
+ "@gradio/wasm": "^0.18.1",
65
+ "@gradio/vibeeditor": "^0.2.1",
66
+ "@gradio/video": "^0.14.24"
67
67
  },
68
68
  "msw": {
69
69
  "workerDirectory": "public"
package/src/Blocks.svelte CHANGED
@@ -712,7 +712,10 @@
712
712
  }
713
713
  if (status.stage === "complete") {
714
714
  dependencies.forEach(async (dep) => {
715
- if (dep.trigger_after === fn_index) {
715
+ if (
716
+ dep.trigger_after === fn_index &&
717
+ !dep.trigger_only_on_failure
718
+ ) {
716
719
  wait_then_trigger_api_call(dep.id, payload.trigger_id);
717
720
  }
718
721
  });
@@ -747,7 +750,7 @@
747
750
  dependencies.map(async (dep) => {
748
751
  if (
749
752
  dep.trigger_after === fn_index &&
750
- !dep.trigger_only_on_success
753
+ (!dep.trigger_only_on_success || dep.trigger_only_on_failure)
751
754
  ) {
752
755
  wait_then_trigger_api_call(dep.id, payload.trigger_id);
753
756
  }
package/src/init.ts CHANGED
@@ -430,11 +430,12 @@ export function create_components(
430
430
  * @param newly_visible_ids Set of component IDs that are now visible
431
431
  */
432
432
  async function load_newly_visible_components(
433
- newly_visible_ids: Set<number>
433
+ newly_visible_ids: Set<number>,
434
+ components: ComponentMeta[]
434
435
  ): Promise<void> {
435
436
  if (newly_visible_ids.size === 0) return;
436
437
 
437
- const components_to_load = _components.filter((c) =>
438
+ const components_to_load = components.filter((c) =>
438
439
  newly_visible_ids.has(c.id)
439
440
  );
440
441
 
@@ -448,7 +449,7 @@ export function create_components(
448
449
  component.type,
449
450
  component.component_class_id,
450
451
  current_root,
451
- _components
452
+ components
452
453
  );
453
454
 
454
455
  constructor_map.set(constructor_key, loadable_component);
@@ -496,12 +497,15 @@ export function create_components(
496
497
  function flush(): void {
497
498
  const had_visibility_changes = has_visibility_changes(pending_updates);
498
499
  let previous_visible_ids: Set<number> | undefined;
500
+ const all_components = _component_map
501
+ ? [..._component_map.values()]
502
+ : _components;
499
503
 
500
504
  // Capture current visibility state before applying updates
501
505
  if (had_visibility_changes && current_layout) {
502
506
  previous_visible_ids = determine_visible_components(
503
507
  current_layout,
504
- _components
508
+ all_components
505
509
  );
506
510
  }
507
511
 
@@ -541,7 +545,7 @@ export function create_components(
541
545
  raf(async () => {
542
546
  const new_visible_ids = determine_visible_components(
543
547
  current_layout,
544
- _components
548
+ all_components
545
549
  );
546
550
  const newly_visible_ids = new Set<number>();
547
551
 
@@ -553,7 +557,7 @@ export function create_components(
553
557
  }
554
558
 
555
559
  // Load the newly visible components
556
- await load_newly_visible_components(newly_visible_ids);
560
+ await load_newly_visible_components(newly_visible_ids, all_components);
557
561
 
558
562
  // Trigger a layout update to render the newly loaded components
559
563
  if (newly_visible_ids.size > 0) {
package/src/types.ts CHANGED
@@ -67,6 +67,7 @@ export interface Dependency {
67
67
  pending_request?: boolean;
68
68
  trigger_after?: number;
69
69
  trigger_only_on_success?: boolean;
70
+ trigger_only_on_failure?: boolean;
70
71
  trigger_mode: "once" | "multiple" | "always_last";
71
72
  final_event: Payload | null;
72
73
  show_api: boolean;