@gradio/model3d 0.12.2 → 0.13.0-beta.3

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,11 +1,49 @@
1
1
  # @gradio/model3d
2
2
 
3
- ## 0.12.2
3
+ ## 0.13.0-beta.3
4
+
5
+ ### Dependency updates
6
+
7
+ - @gradio/upload@0.13.0-beta.3
8
+ - @gradio/client@1.6.0-beta.3
9
+
10
+ ## 0.13.0-beta.2
11
+
12
+ ### Features
13
+
14
+ - [#9339](https://github.com/gradio-app/gradio/pull/9339) [`4c8c6f2`](https://github.com/gradio-app/gradio/commit/4c8c6f2fe603081941c5fdc43f48a0632b9f31ad) - Ssr part 2. Thanks @pngwn!
15
+ - [#9250](https://github.com/gradio-app/gradio/pull/9250) [`350b0a5`](https://github.com/gradio-app/gradio/commit/350b0a5cafb9176f914f62e7c90de51d4352cc77) - Improve Icon Button consistency. Thanks @hannahblair!
16
+ - [#9253](https://github.com/gradio-app/gradio/pull/9253) [`99648ec`](https://github.com/gradio-app/gradio/commit/99648ec7c4443e74799941e47b0015ac9ca581e1) - Adds ability to block event trigger when file is uploading. Thanks @dawoodkhan82!
17
+ - [#9377](https://github.com/gradio-app/gradio/pull/9377) [`618e9fe`](https://github.com/gradio-app/gradio/commit/618e9fe941744cef4a4a06eb7840763c64b15e32) - Update babylon.js to `v7` for `gr.Model3D`. Thanks @abidlabs!
18
+
19
+ ### Dependency updates
20
+
21
+ - @gradio/atoms@0.9.0-beta.2
22
+ - @gradio/upload@0.13.0-beta.2
23
+ - @gradio/wasm@0.14.0-beta.2
24
+ - @gradio/client@1.6.0-beta.2
25
+ - @gradio/icons@0.8.0-beta.2
26
+ - @gradio/statustracker@0.8.0-beta.2
27
+ - @gradio/utils@0.7.0-beta.2
28
+
29
+ ## 0.12.2-beta.1
4
30
 
5
31
  ### Features
6
32
 
7
33
  - [#9187](https://github.com/gradio-app/gradio/pull/9187) [`5bf00b7`](https://github.com/gradio-app/gradio/commit/5bf00b7524ebf399b48719120a49d15bb21bd65c) - make all component SSR compatible. Thanks @pngwn!
8
34
 
35
+ ### Dependency updates
36
+
37
+ - @gradio/atoms@0.8.1-beta.1
38
+ - @gradio/icons@0.8.0-beta.1
39
+ - @gradio/statustracker@0.8.0-beta.1
40
+ - @gradio/utils@0.7.0-beta.1
41
+ - @gradio/client@1.6.0-beta.1
42
+ - @gradio/upload@0.12.4-beta.1
43
+ - @gradio/wasm@0.13.1-beta.1
44
+
45
+ ## 0.12.2
46
+
9
47
  ### Fixes
10
48
 
11
49
  - [#9163](https://github.com/gradio-app/gradio/pull/9163) [`2b6cbf2`](https://github.com/gradio-app/gradio/commit/2b6cbf25908e42cf027324e54ef2cc0baad11a91) - fix exports and generate types. Thanks @pngwn!
package/Index.svelte CHANGED
@@ -31,6 +31,10 @@
31
31
  export let gradio: Gradio;
32
32
  export let height: number | undefined = undefined;
33
33
  export let zoom_speed = 1;
34
+ export let input_ready: boolean;
35
+ let uploading = false;
36
+ $: input_ready = !uploading;
37
+ export let has_change_history = false;
34
38
 
35
39
  // alpha, beta, radius
36
40
  export let camera_position: [number | null, number | null, number | null] = [
@@ -74,6 +78,7 @@
74
78
  {show_label}
75
79
  {camera_position}
76
80
  {zoom_speed}
81
+ {has_change_history}
77
82
  />
78
83
  {:else}
79
84
  <!-- Not ideal but some bugs to work out before we can
@@ -113,9 +118,13 @@
113
118
  {value}
114
119
  {camera_position}
115
120
  {zoom_speed}
121
+ bind:uploading
116
122
  on:change={({ detail }) => (value = detail)}
117
123
  on:drag={({ detail }) => (dragging = detail)}
118
- on:change={({ detail }) => gradio.dispatch("change", detail)}
124
+ on:change={({ detail }) => {
125
+ gradio.dispatch("change", detail);
126
+ has_change_history = true;
127
+ }}
119
128
  on:clear={() => {
120
129
  value = null;
121
130
  gradio.dispatch("clear");
@@ -131,8 +140,8 @@
131
140
  }}
132
141
  i18n={gradio.i18n}
133
142
  max_file_size={gradio.max_file_size}
134
- upload={gradio.client.upload}
135
- stream_handler={gradio.client.stream}
143
+ upload={(...args) => gradio.client.upload(...args)}
144
+ stream_handler={(...args) => gradio.client.stream(...args)}
136
145
  >
137
146
  <UploadText i18n={gradio.i18n} type="file" />
138
147
  </Model3DUpload>
package/dist/Index.svelte CHANGED
@@ -24,6 +24,11 @@ export let min_width = void 0;
24
24
  export let gradio;
25
25
  export let height = void 0;
26
26
  export let zoom_speed = 1;
27
+ export let input_ready;
28
+ let uploading = false;
29
+ $:
30
+ input_ready = !uploading;
31
+ export let has_change_history = false;
27
32
  export let camera_position = [
28
33
  null,
29
34
  null,
@@ -64,6 +69,7 @@ const is_browser = typeof window !== "undefined";
64
69
  {show_label}
65
70
  {camera_position}
66
71
  {zoom_speed}
72
+ {has_change_history}
67
73
  />
68
74
  {:else}
69
75
  <!-- Not ideal but some bugs to work out before we can
@@ -103,9 +109,13 @@ const is_browser = typeof window !== "undefined";
103
109
  {value}
104
110
  {camera_position}
105
111
  {zoom_speed}
112
+ bind:uploading
106
113
  on:change={({ detail }) => (value = detail)}
107
114
  on:drag={({ detail }) => (dragging = detail)}
108
- on:change={({ detail }) => gradio.dispatch("change", detail)}
115
+ on:change={({ detail }) => {
116
+ gradio.dispatch("change", detail);
117
+ has_change_history = true;
118
+ }}
109
119
  on:clear={() => {
110
120
  value = null;
111
121
  gradio.dispatch("clear");
@@ -121,8 +131,8 @@ const is_browser = typeof window !== "undefined";
121
131
  }}
122
132
  i18n={gradio.i18n}
123
133
  max_file_size={gradio.max_file_size}
124
- upload={gradio.client.upload}
125
- stream_handler={gradio.client.stream}
134
+ upload={(...args) => gradio.client.upload(...args)}
135
+ stream_handler={(...args) => gradio.client.stream(...args)}
126
136
  >
127
137
  <UploadText i18n={gradio.i18n} type="file" />
128
138
  </Model3DUpload>
@@ -23,6 +23,8 @@ declare const __propDef: {
23
23
  gradio: Gradio;
24
24
  height?: number | undefined;
25
25
  zoom_speed?: number | undefined;
26
+ input_ready: boolean;
27
+ has_change_history?: boolean | undefined;
26
28
  camera_position?: [number | null, number | null, number | null] | undefined;
27
29
  interactive: boolean;
28
30
  };
@@ -1,4 +1,4 @@
1
- <script>import { BlockLabel, IconButton } from "@gradio/atoms";
1
+ <script>import { BlockLabel, IconButton, IconButtonWrapper } from "@gradio/atoms";
2
2
  import { File, Download, Undo } from "@gradio/icons";
3
3
  import { dequal } from "dequal";
4
4
  export let value;
@@ -14,6 +14,7 @@ export let camera_position = [
14
14
  null,
15
15
  null
16
16
  ];
17
+ export let has_change_history = false;
17
18
  let current_settings = { camera_position, zoom_speed, pan_speed };
18
19
  let use_3dgs = false;
19
20
  let Canvas3DGSComponent;
@@ -59,10 +60,15 @@ let resolved_url;
59
60
  />
60
61
  {#if value}
61
62
  <div class="model3D">
62
- <div class="buttons">
63
+ <IconButtonWrapper>
63
64
  {#if !use_3dgs}
64
65
  <!-- Canvas3DGS doesn't implement the undo method (reset_camera_position) -->
65
- <IconButton Icon={Undo} label="Undo" on:click={() => handle_undo()} />
66
+ <IconButton
67
+ Icon={Undo}
68
+ label="Undo"
69
+ on:click={() => handle_undo()}
70
+ disabled={!has_change_history}
71
+ />
66
72
  {/if}
67
73
  <a
68
74
  href={resolved_url}
@@ -71,7 +77,7 @@ let resolved_url;
71
77
  >
72
78
  <IconButton Icon={Download} label={i18n("common.download")} />
73
79
  </a>
74
- </div>
80
+ </IconButtonWrapper>
75
81
 
76
82
  {#if use_3dgs}
77
83
  <svelte:component
@@ -112,13 +118,4 @@ let resolved_url;
112
118
  object-fit: contain;
113
119
  overflow: hidden;
114
120
  }
115
- .buttons {
116
- display: flex;
117
- position: absolute;
118
- top: var(--size-2);
119
- right: var(--size-2);
120
- justify-content: flex-end;
121
- gap: var(--spacing-sm);
122
- z-index: var(--layer-5);
123
- }
124
121
  </style>
@@ -12,6 +12,7 @@ declare const __propDef: {
12
12
  zoom_speed?: number | undefined;
13
13
  pan_speed?: number | undefined;
14
14
  camera_position?: [number | null, number | null, number | null] | undefined;
15
+ has_change_history?: boolean | undefined;
15
16
  };
16
17
  events: {
17
18
  [evt: string]: CustomEvent<any>;
@@ -12,6 +12,7 @@ export let i18n;
12
12
  export let zoom_speed = 1;
13
13
  export let pan_speed = 1;
14
14
  export let max_file_size = null;
15
+ export let uploading = false;
15
16
  export let camera_position = [
16
17
  null,
17
18
  null,
@@ -78,6 +79,7 @@ $:
78
79
  {max_file_size}
79
80
  filetype={[".stl", ".obj", ".gltf", ".glb", "model/obj", ".splat", ".ply"]}
80
81
  bind:dragging
82
+ bind:uploading
81
83
  on:error
82
84
  >
83
85
  <slot />
@@ -89,7 +91,6 @@ $:
89
91
  on:clear={handle_clear}
90
92
  {i18n}
91
93
  on:undo={handle_undo}
92
- absolute
93
94
  />
94
95
 
95
96
  {#if use_3dgs}
@@ -13,6 +13,7 @@ declare const __propDef: {
13
13
  zoom_speed?: number | undefined;
14
14
  pan_speed?: number | undefined;
15
15
  max_file_size?: (number | null) | undefined;
16
+ uploading?: boolean | undefined;
16
17
  camera_position?: [number | null, number | null, number | null] | undefined;
17
18
  upload: Client["upload"];
18
19
  stream_handler: Client["stream"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/model3d",
3
- "version": "0.12.2",
3
+ "version": "0.13.0-beta.3",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -8,17 +8,17 @@
8
8
  "private": false,
9
9
  "dependencies": {
10
10
  "@types/babylon": "^6.16.6",
11
- "babylonjs": "^4.2.1",
12
- "babylonjs-loaders": "^4.2.1",
11
+ "babylonjs": "^7.25.1",
12
+ "babylonjs-loaders": "^7.25.1",
13
13
  "dequal": "^2.0.2",
14
14
  "gsplat": "^1.0.5",
15
- "@gradio/atoms": "^0.8.1",
16
- "@gradio/icons": "^0.7.2",
17
- "@gradio/client": "^1.5.2",
18
- "@gradio/statustracker": "^0.7.6",
19
- "@gradio/upload": "^0.12.4",
20
- "@gradio/utils": "^0.6.1",
21
- "@gradio/wasm": "^0.13.1"
15
+ "@gradio/atoms": "^0.9.0-beta.2",
16
+ "@gradio/client": "^1.6.0-beta.3",
17
+ "@gradio/statustracker": "^0.8.0-beta.2",
18
+ "@gradio/upload": "^0.13.0-beta.3",
19
+ "@gradio/wasm": "^0.14.0-beta.2",
20
+ "@gradio/utils": "^0.7.0-beta.2",
21
+ "@gradio/icons": "^0.8.0-beta.2"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@gradio/preview": "^0.11.1"
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { FileData } from "@gradio/client";
3
- import { BlockLabel, IconButton } from "@gradio/atoms";
3
+ import { BlockLabel, IconButton, IconButtonWrapper } from "@gradio/atoms";
4
4
  import { File, Download, Undo } from "@gradio/icons";
5
5
  import type { I18nFormatter } from "@gradio/utils";
6
6
  import { dequal } from "dequal";
@@ -21,6 +21,7 @@
21
21
  null,
22
22
  null
23
23
  ];
24
+ export let has_change_history = false;
24
25
 
25
26
  let current_settings = { camera_position, zoom_speed, pan_speed };
26
27
 
@@ -74,10 +75,15 @@
74
75
  />
75
76
  {#if value}
76
77
  <div class="model3D">
77
- <div class="buttons">
78
+ <IconButtonWrapper>
78
79
  {#if !use_3dgs}
79
80
  <!-- Canvas3DGS doesn't implement the undo method (reset_camera_position) -->
80
- <IconButton Icon={Undo} label="Undo" on:click={() => handle_undo()} />
81
+ <IconButton
82
+ Icon={Undo}
83
+ label="Undo"
84
+ on:click={() => handle_undo()}
85
+ disabled={!has_change_history}
86
+ />
81
87
  {/if}
82
88
  <a
83
89
  href={resolved_url}
@@ -86,7 +92,7 @@
86
92
  >
87
93
  <IconButton Icon={Download} label={i18n("common.download")} />
88
94
  </a>
89
- </div>
95
+ </IconButtonWrapper>
90
96
 
91
97
  {#if use_3dgs}
92
98
  <svelte:component
@@ -127,13 +133,4 @@
127
133
  object-fit: contain;
128
134
  overflow: hidden;
129
135
  }
130
- .buttons {
131
- display: flex;
132
- position: absolute;
133
- top: var(--size-2);
134
- right: var(--size-2);
135
- justify-content: flex-end;
136
- gap: var(--spacing-sm);
137
- z-index: var(--layer-5);
138
- }
139
136
  </style>
@@ -18,6 +18,7 @@
18
18
  export let zoom_speed = 1;
19
19
  export let pan_speed = 1;
20
20
  export let max_file_size: number | null = null;
21
+ export let uploading = false;
21
22
 
22
23
  // alpha, beta, radius
23
24
  export let camera_position: [number | null, number | null, number | null] = [
@@ -96,6 +97,7 @@
96
97
  {max_file_size}
97
98
  filetype={[".stl", ".obj", ".gltf", ".glb", "model/obj", ".splat", ".ply"]}
98
99
  bind:dragging
100
+ bind:uploading
99
101
  on:error
100
102
  >
101
103
  <slot />
@@ -107,7 +109,6 @@
107
109
  on:clear={handle_clear}
108
110
  {i18n}
109
111
  on:undo={handle_undo}
110
- absolute
111
112
  />
112
113
 
113
114
  {#if use_3dgs}