@gradio/core 1.1.0 → 1.1.1

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,27 @@
1
1
  # @gradio/core
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Features
6
+
7
+ - [#12677](https://github.com/gradio-app/gradio/pull/12677) [`6f37743`](https://github.com/gradio-app/gradio/commit/6f377433e4c64f1d962eef0f9eff74676c72032b) - Make check for active page in navbar robust. Thanks @abidlabs!
8
+
9
+ ### Fixes
10
+
11
+ - [#12681](https://github.com/gradio-app/gradio/pull/12681) [`ba46c2d`](https://github.com/gradio-app/gradio/commit/ba46c2df1405c11e495304af8f91acfdf69d0b18) - Migrate Button to Svelte 5. Thanks @freddyaboulton!
12
+ - [#12625](https://github.com/gradio-app/gradio/pull/12625) [`7fb79d4`](https://github.com/gradio-app/gradio/commit/7fb79d45bdc3597bf6b095ff64c420939257fba9) - Fix bug where tabs don't work inside gr.render. Thanks @freddyaboulton!
13
+
14
+ ### Dependency updates
15
+
16
+ - @gradio/utils@0.11.1
17
+ - @gradio/button@0.6.2
18
+ - @gradio/client@2.0.2
19
+ - @gradio/column@0.3.1
20
+ - @gradio/theme@0.6.0
21
+ - @gradio/gallery@0.16.1
22
+ - @gradio/plot@0.10.1
23
+ - @gradio/video@0.20.0
24
+
3
25
  ## 1.1.0
4
26
 
5
27
  ### Features
@@ -47,6 +47,20 @@
47
47
  $: show_navbar =
48
48
  pages.length > 1 && (navbar === null || navbar.visible !== false);
49
49
 
50
+ function normalize_path(path: string): string {
51
+ // Remove query parameters, hash fragments, and leading/trailing slashes from the path
52
+ let normalized = path.split("?")[0].split("#")[0];
53
+ normalized = normalized.replace(/^\/+|\/+$/g, "");
54
+ return normalized;
55
+ }
56
+
57
+ function is_active_route(route: string, current: string): boolean {
58
+ if (route.startsWith("http://") || route.startsWith("https://")) {
59
+ return false;
60
+ }
61
+ return normalize_path(route) === normalize_path(current);
62
+ }
63
+
50
64
  $: effective_pages = (() => {
51
65
  let visible_pages = pages.filter(([route, label, show], index) => {
52
66
  if (index === 0 && route === "") {
@@ -100,7 +114,7 @@
100
114
  href={route.startsWith("http://") || route.startsWith("https://")
101
115
  ? route
102
116
  : `${root}/${route}`}
103
- class:active={route === current_page}
117
+ class:active={is_active_route(route, current_page)}
104
118
  data-sveltekit-reload
105
119
  target={route.startsWith("http://") || route.startsWith("https://")
106
120
  ? "_blank"
@@ -72,7 +72,7 @@
72
72
  </Block>
73
73
  </BaseForm>
74
74
 
75
- <BaseButton size="lg" variant="primary" on:click={submit}
75
+ <BaseButton size="lg" variant="primary" onclick={submit}
76
76
  >{i18n("login.login")}</BaseButton
77
77
  >
78
78
  </BaseColumn>
@@ -26,7 +26,7 @@
26
26
  size="sm"
27
27
  variant="secondary"
28
28
  elem_id="start-api-recorder"
29
- on:click={() => dispatch("close", { api_recorder_visible: true })}
29
+ onclick={() => dispatch("close", { api_recorder_visible: true })}
30
30
  >
31
31
  <div class="loading-dot self-baseline"></div>
32
32
  <p class="self-baseline btn-text">API Recorder</p>
@@ -60,7 +60,7 @@
60
60
  </Block>
61
61
 
62
62
  <span class="space" />
63
- <BaseButton variant="primary" on:click={run.bind(null, dependency_index)}>
63
+ <BaseButton variant="primary" onclick={run.bind(null, dependency_index)}>
64
64
  Try It Out
65
65
  </BaseButton>
66
66
 
@@ -6,7 +6,7 @@
6
6
  </script>
7
7
 
8
8
  <span class="space" />
9
- <BaseButton variant="primary" on:click={run.bind(null, dependency_index)}>
9
+ <BaseButton variant="primary" onclick={run.bind(null, dependency_index)}>
10
10
  Try It Out
11
11
  </BaseButton>
12
12
 
@@ -229,10 +229,12 @@ export class AppTree {
229
229
  map.set(comp.id, comp);
230
230
  return map;
231
231
  }, new Map());
232
- const subtree = this.traverse(layout, (node) => {
232
+ const _subtree = this.traverse(layout, (node) => {
233
233
  const new_node = this.create_node(node, component_map, false, this.reactive_formatter);
234
234
  return new_node;
235
235
  });
236
+ gather_initial_tabs(_subtree, this.initial_tabs);
237
+ const subtree = this.traverse(_subtree, (node) => apply_initial_tabs(node, this.initial_tabs));
236
238
  const n = find_node_by_id(this.root, subtree.id);
237
239
  if (!n) {
238
240
  throw new Error("Rerender failed: root node not found in current tree");
package/package.json CHANGED
@@ -1,67 +1,67 @@
1
1
  {
2
2
  "name": "@gradio/core",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
+ "@gradio/accordion": "^0.5.28",
6
7
  "@gradio/annotatedimage": "^0.11.0",
7
8
  "@gradio/atoms": "^0.20.0",
8
- "@gradio/browserstate": "^0.3.4",
9
- "@gradio/accordion": "^0.5.27",
10
- "@gradio/box": "^0.2.27",
9
+ "@gradio/button": "^0.6.2",
11
10
  "@gradio/audio": "^0.22.0",
12
- "@gradio/button": "^0.6.1",
13
- "@gradio/chatbot": "^0.29.0",
11
+ "@gradio/box": "^0.2.27",
12
+ "@gradio/chatbot": "^0.29.1",
14
13
  "@gradio/checkbox": "^0.6.0",
15
- "@gradio/checkboxgroup": "^0.9.0",
16
- "@gradio/client": "^2.0.1",
14
+ "@gradio/browserstate": "^0.3.5",
15
+ "@gradio/client": "^2.0.2",
17
16
  "@gradio/code": "^0.17.0",
18
- "@gradio/colorpicker": "^0.5.2",
19
- "@gradio/column": "^0.3.0",
17
+ "@gradio/column": "^0.3.1",
18
+ "@gradio/checkboxgroup": "^0.9.0",
20
19
  "@gradio/dataframe": "^0.21.2",
20
+ "@gradio/colorpicker": "^0.5.3",
21
21
  "@gradio/dataset": "^0.5.1",
22
22
  "@gradio/datetime": "^0.4.0",
23
- "@gradio/downloadbutton": "^0.4.15",
23
+ "@gradio/downloadbutton": "^0.4.16",
24
+ "@gradio/dropdown": "^0.11.1",
24
25
  "@gradio/fallback": "^0.4.31",
25
- "@gradio/dropdown": "^0.11.0",
26
- "@gradio/file": "^0.14.0",
27
- "@gradio/gallery": "^0.16.0",
28
26
  "@gradio/fileexplorer": "^0.6.0",
29
- "@gradio/form": "^0.2.28",
30
- "@gradio/highlightedtext": "^0.10.0",
27
+ "@gradio/file": "^0.14.0",
31
28
  "@gradio/group": "^0.3.1",
29
+ "@gradio/highlightedtext": "^0.10.1",
30
+ "@gradio/form": "^0.2.28",
31
+ "@gradio/html": "^0.9.0",
32
32
  "@gradio/icons": "^0.15.0",
33
33
  "@gradio/image": "^0.25.0",
34
- "@gradio/imageeditor": "^0.18.3",
35
- "@gradio/html": "^0.9.0",
34
+ "@gradio/gallery": "^0.16.1",
36
35
  "@gradio/imageslider": "^0.4.0",
37
- "@gradio/json": "^0.6.0",
36
+ "@gradio/imageeditor": "^0.18.3",
38
37
  "@gradio/label": "^0.6.0",
39
- "@gradio/markdown": "^0.13.24",
40
- "@gradio/model3d": "^0.16.0",
41
- "@gradio/multimodaltextbox": "^0.11.2",
42
- "@gradio/nativeplot": "^0.9.2",
43
- "@gradio/paramviewer": "^0.9.1",
44
- "@gradio/plot": "^0.10.0",
38
+ "@gradio/json": "^0.6.0",
39
+ "@gradio/model3d": "^0.16.1",
40
+ "@gradio/markdown": "^0.13.25",
41
+ "@gradio/multimodaltextbox": "^0.11.3",
42
+ "@gradio/nativeplot": "^0.9.3",
45
43
  "@gradio/number": "^0.8.0",
44
+ "@gradio/plot": "^0.10.1",
45
+ "@gradio/paramviewer": "^0.9.1",
46
46
  "@gradio/radio": "^0.9.0",
47
- "@gradio/sidebar": "^0.1.25",
48
47
  "@gradio/row": "^0.3.0",
48
+ "@gradio/sidebar": "^0.2.0",
49
49
  "@gradio/simpledropdown": "^0.3.31",
50
50
  "@gradio/simpleimage": "^0.9.2",
51
- "@gradio/slider": "^0.7.2",
52
- "@gradio/simpletextbox": "^0.3.32",
51
+ "@gradio/simpletextbox": "^0.3.33",
53
52
  "@gradio/state": "^0.2.1",
53
+ "@gradio/tabitem": "^0.6.4",
54
+ "@gradio/slider": "^0.7.2",
54
55
  "@gradio/statustracker": "^0.12.1",
56
+ "@gradio/textbox": "^0.13.1",
55
57
  "@gradio/tabs": "^0.5.4",
56
- "@gradio/tabitem": "^0.6.4",
57
- "@gradio/theme": "^0.5.0",
58
+ "@gradio/theme": "^0.6.0",
58
59
  "@gradio/timer": "^0.4.7",
59
- "@gradio/textbox": "^0.13.0",
60
60
  "@gradio/upload": "^0.17.3",
61
- "@gradio/utils": "^0.11.0",
62
- "@gradio/uploadbutton": "^0.9.15",
61
+ "@gradio/uploadbutton": "^0.9.16",
63
62
  "@gradio/vibeeditor": "^0.3.2",
64
- "@gradio/video": "^0.19.0"
63
+ "@gradio/utils": "^0.11.1",
64
+ "@gradio/video": "^0.20.0"
65
65
  },
66
66
  "msw": {
67
67
  "workerDirectory": "public"
package/src/Embed.svelte CHANGED
@@ -47,6 +47,20 @@
47
47
  $: show_navbar =
48
48
  pages.length > 1 && (navbar === null || navbar.visible !== false);
49
49
 
50
+ function normalize_path(path: string): string {
51
+ // Remove query parameters, hash fragments, and leading/trailing slashes from the path
52
+ let normalized = path.split("?")[0].split("#")[0];
53
+ normalized = normalized.replace(/^\/+|\/+$/g, "");
54
+ return normalized;
55
+ }
56
+
57
+ function is_active_route(route: string, current: string): boolean {
58
+ if (route.startsWith("http://") || route.startsWith("https://")) {
59
+ return false;
60
+ }
61
+ return normalize_path(route) === normalize_path(current);
62
+ }
63
+
50
64
  $: effective_pages = (() => {
51
65
  let visible_pages = pages.filter(([route, label, show], index) => {
52
66
  if (index === 0 && route === "") {
@@ -100,7 +114,7 @@
100
114
  href={route.startsWith("http://") || route.startsWith("https://")
101
115
  ? route
102
116
  : `${root}/${route}`}
103
- class:active={route === current_page}
117
+ class:active={is_active_route(route, current_page)}
104
118
  data-sveltekit-reload
105
119
  target={route.startsWith("http://") || route.startsWith("https://")
106
120
  ? "_blank"
package/src/Login.svelte CHANGED
@@ -72,7 +72,7 @@
72
72
  </Block>
73
73
  </BaseForm>
74
74
 
75
- <BaseButton size="lg" variant="primary" on:click={submit}
75
+ <BaseButton size="lg" variant="primary" onclick={submit}
76
76
  >{i18n("login.login")}</BaseButton
77
77
  >
78
78
  </BaseColumn>
@@ -26,7 +26,7 @@
26
26
  size="sm"
27
27
  variant="secondary"
28
28
  elem_id="start-api-recorder"
29
- on:click={() => dispatch("close", { api_recorder_visible: true })}
29
+ onclick={() => dispatch("close", { api_recorder_visible: true })}
30
30
  >
31
31
  <div class="loading-dot self-baseline"></div>
32
32
  <p class="self-baseline btn-text">API Recorder</p>
@@ -60,7 +60,7 @@
60
60
  </Block>
61
61
 
62
62
  <span class="space" />
63
- <BaseButton variant="primary" on:click={run.bind(null, dependency_index)}>
63
+ <BaseButton variant="primary" onclick={run.bind(null, dependency_index)}>
64
64
  Try It Out
65
65
  </BaseButton>
66
66
 
@@ -6,7 +6,7 @@
6
6
  </script>
7
7
 
8
8
  <span class="space" />
9
- <BaseButton variant="primary" on:click={run.bind(null, dependency_index)}>
9
+ <BaseButton variant="primary" onclick={run.bind(null, dependency_index)}>
10
10
  Try It Out
11
11
  </BaseButton>
12
12
 
@@ -365,7 +365,7 @@ export class AppTree {
365
365
  map.set(comp.id, comp);
366
366
  return map;
367
367
  }, new Map<number, ComponentMeta>());
368
- const subtree = this.traverse(layout, (node) => {
368
+ const _subtree = this.traverse(layout, (node) => {
369
369
  const new_node = this.create_node(
370
370
  node,
371
371
  component_map,
@@ -374,7 +374,10 @@ export class AppTree {
374
374
  );
375
375
  return new_node;
376
376
  });
377
-
377
+ gather_initial_tabs(_subtree, this.initial_tabs);
378
+ const subtree = this.traverse(_subtree, (node) =>
379
+ apply_initial_tabs(node, this.initial_tabs)
380
+ );
378
381
  const n = find_node_by_id(this.root!, subtree.id);
379
382
 
380
383
  if (!n) {