@gradio/model3d 0.15.1-dev.0 → 0.15.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 +40 -0
- package/Index.svelte +113 -99
- package/dist/Example.svelte +4 -3
- package/dist/Example.svelte.d.ts +20 -18
- package/dist/Index.svelte +125 -101
- package/dist/Index.svelte.d.ts +3 -39
- package/dist/shared/Canvas3D.svelte +107 -86
- package/dist/shared/Canvas3D.svelte.d.ts +28 -25
- package/dist/shared/Canvas3DGS.svelte +99 -80
- package/dist/shared/Canvas3DGS.svelte.d.ts +20 -18
- package/dist/shared/Model3D.svelte +66 -51
- package/dist/shared/Model3D.svelte.d.ts +27 -25
- package/dist/shared/Model3DUpload.svelte +89 -67
- package/dist/shared/Model3DUpload.svelte.d.ts +47 -37
- package/dist/types.d.ts +19 -0
- package/dist/types.js +1 -0
- package/package.json +19 -14
- package/shared/Canvas3D.svelte +1 -1
- package/shared/Model3DUpload.svelte +3 -1
- package/types.ts +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,44 @@
|
|
|
1
1
|
# @gradio/model3d
|
|
2
|
+
## 0.15.1
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
- [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Clear Error statuses
|
|
7
|
+
- [#12438](https://github.com/gradio-app/gradio/pull/12438) [`25ffc03`](https://github.com/gradio-app/gradio/commit/25ffc0398f8feb43d817c02b2ab970c16de6d797) - Svelte5 migration and bugfix
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
- @gradio/atoms@0.19.0
|
|
12
|
+
- @gradio/client@2.0.0
|
|
13
|
+
- @gradio/icons@0.15.0
|
|
14
|
+
- @gradio/statustracker@0.12.0
|
|
15
|
+
- @gradio/upload@0.17.2
|
|
16
|
+
- @gradio/utils@0.10.3
|
|
17
|
+
|
|
18
|
+
## 0.15.1-dev.2
|
|
19
|
+
|
|
20
|
+
### Dependency updates
|
|
21
|
+
|
|
22
|
+
- @gradio/atoms@0.19.0-dev.1
|
|
23
|
+
- @gradio/client@2.0.0-dev.2
|
|
24
|
+
- @gradio/statustracker@0.12.0-dev.1
|
|
25
|
+
- @gradio/upload@0.17.2-dev.2
|
|
26
|
+
|
|
27
|
+
## 0.15.1-dev.1
|
|
28
|
+
|
|
29
|
+
### Dependency updates
|
|
30
|
+
|
|
31
|
+
- @gradio/atoms@0.18.2-dev.0
|
|
32
|
+
- @gradio/upload@0.17.2-dev.1
|
|
33
|
+
- @gradio/utils@0.10.3-dev.0
|
|
34
|
+
- @gradio/statustracker@0.12.0-dev.0
|
|
35
|
+
- @gradio/icons@0.15.0-dev.0
|
|
36
|
+
|
|
37
|
+
## 0.15.1-dev.0
|
|
38
|
+
|
|
39
|
+
### Dependency updates
|
|
40
|
+
|
|
41
|
+
- @gradio/client@2.0.0-dev.1
|
|
2
42
|
|
|
3
43
|
## 0.15.1-dev.0
|
|
4
44
|
|
package/Index.svelte
CHANGED
|
@@ -5,143 +5,157 @@
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
|
+
import { tick } from "svelte";
|
|
9
|
+
import type { Model3DProps, Model3DEvents } from "./types";
|
|
8
10
|
import type { FileData } from "@gradio/client";
|
|
11
|
+
import { Gradio } from "@gradio/utils";
|
|
9
12
|
import Model3D from "./shared/Model3D.svelte";
|
|
10
13
|
import Model3DUpload from "./shared/Model3DUpload.svelte";
|
|
11
14
|
import { BlockLabel, Block, Empty, UploadText } from "@gradio/atoms";
|
|
12
15
|
import { File } from "@gradio/icons";
|
|
13
|
-
|
|
14
16
|
import { StatusTracker } from "@gradio/statustracker";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
export let has_change_history = false;
|
|
38
|
-
|
|
39
|
-
// alpha, beta, radius
|
|
40
|
-
export let camera_position: [number | null, number | null, number | null] = [
|
|
41
|
-
null,
|
|
42
|
-
null,
|
|
43
|
-
null
|
|
44
|
-
];
|
|
45
|
-
export let interactive: boolean;
|
|
46
|
-
|
|
47
|
-
let dragging = false;
|
|
17
|
+
|
|
18
|
+
class Model3dGradio extends Gradio<Model3DEvents, Model3DProps> {
|
|
19
|
+
async get_data() {
|
|
20
|
+
if (upload_promise) {
|
|
21
|
+
await upload_promise;
|
|
22
|
+
await tick();
|
|
23
|
+
}
|
|
24
|
+
const data = await super.get_data();
|
|
25
|
+
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const props = $props();
|
|
31
|
+
const gradio = new Model3dGradio(props);
|
|
32
|
+
|
|
33
|
+
let old_value = $state(gradio.props.value);
|
|
34
|
+
let uploading = $state(false);
|
|
35
|
+
let dragging = $state(false);
|
|
36
|
+
let has_change_history = $state(false);
|
|
37
|
+
let upload_promise = $state<Promise<any>>();
|
|
38
|
+
|
|
48
39
|
const is_browser = typeof window !== "undefined";
|
|
40
|
+
|
|
41
|
+
$effect(() => {
|
|
42
|
+
if (old_value !== gradio.props.value) {
|
|
43
|
+
old_value = gradio.props.value;
|
|
44
|
+
gradio.dispatch("change");
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
function handle_change(detail: FileData | null) {
|
|
49
|
+
gradio.props.value = detail;
|
|
50
|
+
gradio.dispatch("change", detail);
|
|
51
|
+
has_change_history = true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function handle_drag(detail: boolean) {
|
|
55
|
+
dragging = detail;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function handle_clear() {
|
|
59
|
+
gradio.props.value = null;
|
|
60
|
+
gradio.dispatch("clear");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function handle_load(detail: FileData) {
|
|
64
|
+
gradio.props.value = detail;
|
|
65
|
+
gradio.dispatch("upload");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function handle_error(detail: string) {
|
|
69
|
+
if (gradio.shared.loading_status)
|
|
70
|
+
gradio.shared.loading_status.status = "error";
|
|
71
|
+
gradio.dispatch("error", detail);
|
|
72
|
+
}
|
|
49
73
|
</script>
|
|
50
74
|
|
|
51
|
-
{#if !interactive}
|
|
75
|
+
{#if !gradio.shared.interactive}
|
|
52
76
|
<Block
|
|
53
|
-
{visible}
|
|
54
|
-
variant={value === null ? "dashed" : "solid"}
|
|
77
|
+
visible={gradio.shared.visible}
|
|
78
|
+
variant={gradio.props.value === null ? "dashed" : "solid"}
|
|
55
79
|
border_mode={dragging ? "focus" : "base"}
|
|
56
80
|
padding={false}
|
|
57
|
-
{elem_id}
|
|
58
|
-
{elem_classes}
|
|
59
|
-
{container}
|
|
60
|
-
{scale}
|
|
61
|
-
{min_width}
|
|
62
|
-
{height}
|
|
81
|
+
elem_id={gradio.shared.elem_id}
|
|
82
|
+
elem_classes={gradio.shared.elem_classes}
|
|
83
|
+
container={gradio.shared.container}
|
|
84
|
+
scale={gradio.shared.scale}
|
|
85
|
+
min_width={gradio.shared.min_width}
|
|
86
|
+
height={gradio.props.height}
|
|
63
87
|
>
|
|
64
88
|
<StatusTracker
|
|
65
|
-
autoscroll={gradio.autoscroll}
|
|
89
|
+
autoscroll={gradio.shared.autoscroll}
|
|
66
90
|
i18n={gradio.i18n}
|
|
67
|
-
{...loading_status}
|
|
68
|
-
|
|
91
|
+
{...gradio.shared.loading_status}
|
|
92
|
+
on_clear_status={() =>
|
|
93
|
+
gradio.dispatch("clear_status", gradio.shared.loading_status)}
|
|
69
94
|
/>
|
|
70
95
|
|
|
71
|
-
{#if value && is_browser}
|
|
96
|
+
{#if gradio.props.value && is_browser}
|
|
72
97
|
<Model3D
|
|
73
|
-
{value}
|
|
98
|
+
value={gradio.props.value}
|
|
74
99
|
i18n={gradio.i18n}
|
|
75
|
-
{display_mode}
|
|
76
|
-
{clear_color}
|
|
77
|
-
{label}
|
|
78
|
-
{show_label}
|
|
79
|
-
{camera_position}
|
|
80
|
-
{zoom_speed}
|
|
100
|
+
display_mode={gradio.props.display_mode}
|
|
101
|
+
clear_color={gradio.props.clear_color}
|
|
102
|
+
label={gradio.shared.label}
|
|
103
|
+
show_label={gradio.shared.show_label}
|
|
104
|
+
camera_position={gradio.props.camera_position}
|
|
105
|
+
zoom_speed={gradio.props.zoom_speed}
|
|
81
106
|
{has_change_history}
|
|
82
107
|
/>
|
|
83
108
|
{:else}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
109
|
+
<BlockLabel
|
|
110
|
+
show_label={gradio.shared.show_label}
|
|
111
|
+
Icon={File}
|
|
112
|
+
label={gradio.shared.label || "3D Model"}
|
|
113
|
+
/>
|
|
88
114
|
|
|
89
115
|
<Empty unpadded_box={true} size="large"><File /></Empty>
|
|
90
116
|
{/if}
|
|
91
117
|
</Block>
|
|
92
118
|
{:else}
|
|
93
119
|
<Block
|
|
94
|
-
{visible}
|
|
95
|
-
variant={value === null ? "dashed" : "solid"}
|
|
120
|
+
visible={gradio.shared.visible}
|
|
121
|
+
variant={gradio.props.value === null ? "dashed" : "solid"}
|
|
96
122
|
border_mode={dragging ? "focus" : "base"}
|
|
97
123
|
padding={false}
|
|
98
|
-
{elem_id}
|
|
99
|
-
{elem_classes}
|
|
100
|
-
{container}
|
|
101
|
-
{scale}
|
|
102
|
-
{min_width}
|
|
103
|
-
{height}
|
|
124
|
+
elem_id={gradio.shared.elem_id}
|
|
125
|
+
elem_classes={gradio.shared.elem_classes}
|
|
126
|
+
container={gradio.shared.container}
|
|
127
|
+
scale={gradio.shared.scale}
|
|
128
|
+
min_width={gradio.shared.min_width}
|
|
129
|
+
height={gradio.props.height}
|
|
104
130
|
>
|
|
105
131
|
<StatusTracker
|
|
106
|
-
autoscroll={gradio.autoscroll}
|
|
132
|
+
autoscroll={gradio.shared.autoscroll}
|
|
107
133
|
i18n={gradio.i18n}
|
|
108
|
-
{...loading_status}
|
|
109
|
-
|
|
134
|
+
{...gradio.shared.loading_status}
|
|
135
|
+
on_clear_status={() =>
|
|
136
|
+
gradio.dispatch("clear_status", gradio.shared.loading_status)}
|
|
110
137
|
/>
|
|
111
138
|
|
|
112
139
|
<Model3DUpload
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
{
|
|
116
|
-
{
|
|
117
|
-
{
|
|
118
|
-
{
|
|
119
|
-
{
|
|
120
|
-
{
|
|
140
|
+
bind:upload_promise
|
|
141
|
+
label={gradio.shared.label}
|
|
142
|
+
show_label={gradio.shared.show_label}
|
|
143
|
+
root={gradio.shared.root}
|
|
144
|
+
display_mode={gradio.props.display_mode}
|
|
145
|
+
clear_color={gradio.props.clear_color}
|
|
146
|
+
value={gradio.props.value}
|
|
147
|
+
camera_position={gradio.props.camera_position}
|
|
148
|
+
zoom_speed={gradio.props.zoom_speed}
|
|
121
149
|
bind:uploading
|
|
122
|
-
on:change={({ detail }) => (
|
|
123
|
-
on:drag={({ detail }) => (
|
|
124
|
-
on:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}}
|
|
128
|
-
on:clear={() => {
|
|
129
|
-
value = null;
|
|
130
|
-
gradio.dispatch("clear");
|
|
131
|
-
}}
|
|
132
|
-
on:load={({ detail }) => {
|
|
133
|
-
value = detail;
|
|
134
|
-
gradio.dispatch("upload");
|
|
135
|
-
}}
|
|
136
|
-
on:error={({ detail }) => {
|
|
137
|
-
loading_status = loading_status || {};
|
|
138
|
-
loading_status.status = "error";
|
|
139
|
-
gradio.dispatch("error", detail);
|
|
140
|
-
}}
|
|
150
|
+
on:change={({ detail }) => handle_change(detail)}
|
|
151
|
+
on:drag={({ detail }) => handle_drag(detail)}
|
|
152
|
+
on:clear={handle_clear}
|
|
153
|
+
on:load={({ detail }) => handle_load(detail)}
|
|
154
|
+
on:error={({ detail }) => handle_error(detail)}
|
|
141
155
|
i18n={gradio.i18n}
|
|
142
|
-
max_file_size={gradio.max_file_size}
|
|
143
|
-
upload={(...args) => gradio.client.upload(...args)}
|
|
144
|
-
stream_handler={(...args) => gradio.client.stream(...args)}
|
|
156
|
+
max_file_size={gradio.shared.max_file_size}
|
|
157
|
+
upload={(...args) => gradio.shared.client.upload(...args)}
|
|
158
|
+
stream_handler={(...args) => gradio.shared.client.stream(...args)}
|
|
145
159
|
>
|
|
146
160
|
<UploadText i18n={gradio.i18n} type="file" />
|
|
147
161
|
</Model3DUpload>
|
package/dist/Example.svelte
CHANGED
package/dist/Example.svelte.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
7
11
|
};
|
|
8
|
-
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
exports?: {} | undefined;
|
|
13
|
-
bindings?: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
export type ExampleProps = typeof __propDef.props;
|
|
16
|
-
export type ExampleEvents = typeof __propDef.events;
|
|
17
|
-
export type ExampleSlots = typeof __propDef.slots;
|
|
18
|
-
export default class Example extends SvelteComponent<ExampleProps, ExampleEvents, ExampleSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
19
13
|
}
|
|
20
|
-
|
|
14
|
+
declare const Example: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
value: string | null;
|
|
16
|
+
type: "gallery" | "table";
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
}, {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
}, {}, {}, string>;
|
|
21
|
+
type Example = InstanceType<typeof Example>;
|
|
22
|
+
export default Example;
|
package/dist/Index.svelte
CHANGED
|
@@ -1,137 +1,161 @@
|
|
|
1
|
-
<script context="module"
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export { default as BaseModel3D } from "./shared/Model3D.svelte";
|
|
3
|
+
export { default as BaseModel3DUpload } from "./shared/Model3DUpload.svelte";
|
|
4
|
+
export { default as BaseExample } from "./Example.svelte";
|
|
4
5
|
</script>
|
|
5
6
|
|
|
6
|
-
<script
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const is_browser = typeof window !== "undefined";
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { tick } from "svelte";
|
|
9
|
+
import type { Model3DProps, Model3DEvents } from "./types";
|
|
10
|
+
import type { FileData } from "@gradio/client";
|
|
11
|
+
import { Gradio } from "@gradio/utils";
|
|
12
|
+
import Model3D from "./shared/Model3D.svelte";
|
|
13
|
+
import Model3DUpload from "./shared/Model3DUpload.svelte";
|
|
14
|
+
import { BlockLabel, Block, Empty, UploadText } from "@gradio/atoms";
|
|
15
|
+
import { File } from "@gradio/icons";
|
|
16
|
+
import { StatusTracker } from "@gradio/statustracker";
|
|
17
|
+
|
|
18
|
+
class Model3dGradio extends Gradio<Model3DEvents, Model3DProps> {
|
|
19
|
+
async get_data() {
|
|
20
|
+
if (upload_promise) {
|
|
21
|
+
await upload_promise;
|
|
22
|
+
await tick();
|
|
23
|
+
}
|
|
24
|
+
const data = await super.get_data();
|
|
25
|
+
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const props = $props();
|
|
31
|
+
const gradio = new Model3dGradio(props);
|
|
32
|
+
|
|
33
|
+
let old_value = $state(gradio.props.value);
|
|
34
|
+
let uploading = $state(false);
|
|
35
|
+
let dragging = $state(false);
|
|
36
|
+
let has_change_history = $state(false);
|
|
37
|
+
let upload_promise = $state<Promise<any>>();
|
|
38
|
+
|
|
39
|
+
const is_browser = typeof window !== "undefined";
|
|
40
|
+
|
|
41
|
+
$effect(() => {
|
|
42
|
+
if (old_value !== gradio.props.value) {
|
|
43
|
+
old_value = gradio.props.value;
|
|
44
|
+
gradio.dispatch("change");
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
function handle_change(detail: FileData | null) {
|
|
49
|
+
gradio.props.value = detail;
|
|
50
|
+
gradio.dispatch("change", detail);
|
|
51
|
+
has_change_history = true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function handle_drag(detail: boolean) {
|
|
55
|
+
dragging = detail;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function handle_clear() {
|
|
59
|
+
gradio.props.value = null;
|
|
60
|
+
gradio.dispatch("clear");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function handle_load(detail: FileData) {
|
|
64
|
+
gradio.props.value = detail;
|
|
65
|
+
gradio.dispatch("upload");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function handle_error(detail: string) {
|
|
69
|
+
if (gradio.shared.loading_status)
|
|
70
|
+
gradio.shared.loading_status.status = "error";
|
|
71
|
+
gradio.dispatch("error", detail);
|
|
72
|
+
}
|
|
39
73
|
</script>
|
|
40
74
|
|
|
41
|
-
{#if !interactive}
|
|
75
|
+
{#if !gradio.shared.interactive}
|
|
42
76
|
<Block
|
|
43
|
-
{visible}
|
|
44
|
-
variant={value === null ? "dashed" : "solid"}
|
|
77
|
+
visible={gradio.shared.visible}
|
|
78
|
+
variant={gradio.props.value === null ? "dashed" : "solid"}
|
|
45
79
|
border_mode={dragging ? "focus" : "base"}
|
|
46
80
|
padding={false}
|
|
47
|
-
{elem_id}
|
|
48
|
-
{elem_classes}
|
|
49
|
-
{container}
|
|
50
|
-
{scale}
|
|
51
|
-
{min_width}
|
|
52
|
-
{height}
|
|
81
|
+
elem_id={gradio.shared.elem_id}
|
|
82
|
+
elem_classes={gradio.shared.elem_classes}
|
|
83
|
+
container={gradio.shared.container}
|
|
84
|
+
scale={gradio.shared.scale}
|
|
85
|
+
min_width={gradio.shared.min_width}
|
|
86
|
+
height={gradio.props.height}
|
|
53
87
|
>
|
|
54
88
|
<StatusTracker
|
|
55
|
-
autoscroll={gradio.autoscroll}
|
|
89
|
+
autoscroll={gradio.shared.autoscroll}
|
|
56
90
|
i18n={gradio.i18n}
|
|
57
|
-
{...loading_status}
|
|
58
|
-
|
|
91
|
+
{...gradio.shared.loading_status}
|
|
92
|
+
on_clear_status={() =>
|
|
93
|
+
gradio.dispatch("clear_status", gradio.shared.loading_status)}
|
|
59
94
|
/>
|
|
60
95
|
|
|
61
|
-
{#if value && is_browser}
|
|
96
|
+
{#if gradio.props.value && is_browser}
|
|
62
97
|
<Model3D
|
|
63
|
-
{value}
|
|
98
|
+
value={gradio.props.value}
|
|
64
99
|
i18n={gradio.i18n}
|
|
65
|
-
{display_mode}
|
|
66
|
-
{clear_color}
|
|
67
|
-
{label}
|
|
68
|
-
{show_label}
|
|
69
|
-
{camera_position}
|
|
70
|
-
{zoom_speed}
|
|
100
|
+
display_mode={gradio.props.display_mode}
|
|
101
|
+
clear_color={gradio.props.clear_color}
|
|
102
|
+
label={gradio.shared.label}
|
|
103
|
+
show_label={gradio.shared.show_label}
|
|
104
|
+
camera_position={gradio.props.camera_position}
|
|
105
|
+
zoom_speed={gradio.props.zoom_speed}
|
|
71
106
|
{has_change_history}
|
|
72
107
|
/>
|
|
73
108
|
{:else}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
109
|
+
<BlockLabel
|
|
110
|
+
show_label={gradio.shared.show_label}
|
|
111
|
+
Icon={File}
|
|
112
|
+
label={gradio.shared.label || "3D Model"}
|
|
113
|
+
/>
|
|
78
114
|
|
|
79
115
|
<Empty unpadded_box={true} size="large"><File /></Empty>
|
|
80
116
|
{/if}
|
|
81
117
|
</Block>
|
|
82
118
|
{:else}
|
|
83
119
|
<Block
|
|
84
|
-
{visible}
|
|
85
|
-
variant={value === null ? "dashed" : "solid"}
|
|
120
|
+
visible={gradio.shared.visible}
|
|
121
|
+
variant={gradio.props.value === null ? "dashed" : "solid"}
|
|
86
122
|
border_mode={dragging ? "focus" : "base"}
|
|
87
123
|
padding={false}
|
|
88
|
-
{elem_id}
|
|
89
|
-
{elem_classes}
|
|
90
|
-
{container}
|
|
91
|
-
{scale}
|
|
92
|
-
{min_width}
|
|
93
|
-
{height}
|
|
124
|
+
elem_id={gradio.shared.elem_id}
|
|
125
|
+
elem_classes={gradio.shared.elem_classes}
|
|
126
|
+
container={gradio.shared.container}
|
|
127
|
+
scale={gradio.shared.scale}
|
|
128
|
+
min_width={gradio.shared.min_width}
|
|
129
|
+
height={gradio.props.height}
|
|
94
130
|
>
|
|
95
131
|
<StatusTracker
|
|
96
|
-
autoscroll={gradio.autoscroll}
|
|
132
|
+
autoscroll={gradio.shared.autoscroll}
|
|
97
133
|
i18n={gradio.i18n}
|
|
98
|
-
{...loading_status}
|
|
99
|
-
|
|
134
|
+
{...gradio.shared.loading_status}
|
|
135
|
+
on_clear_status={() =>
|
|
136
|
+
gradio.dispatch("clear_status", gradio.shared.loading_status)}
|
|
100
137
|
/>
|
|
101
138
|
|
|
102
139
|
<Model3DUpload
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
{
|
|
106
|
-
{
|
|
107
|
-
{
|
|
108
|
-
{
|
|
109
|
-
{
|
|
110
|
-
{
|
|
140
|
+
bind:upload_promise
|
|
141
|
+
label={gradio.shared.label}
|
|
142
|
+
show_label={gradio.shared.show_label}
|
|
143
|
+
root={gradio.shared.root}
|
|
144
|
+
display_mode={gradio.props.display_mode}
|
|
145
|
+
clear_color={gradio.props.clear_color}
|
|
146
|
+
value={gradio.props.value}
|
|
147
|
+
camera_position={gradio.props.camera_position}
|
|
148
|
+
zoom_speed={gradio.props.zoom_speed}
|
|
111
149
|
bind:uploading
|
|
112
|
-
on:change={({ detail }) => (
|
|
113
|
-
on:drag={({ detail }) => (
|
|
114
|
-
on:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}}
|
|
118
|
-
on:clear={() => {
|
|
119
|
-
value = null;
|
|
120
|
-
gradio.dispatch("clear");
|
|
121
|
-
}}
|
|
122
|
-
on:load={({ detail }) => {
|
|
123
|
-
value = detail;
|
|
124
|
-
gradio.dispatch("upload");
|
|
125
|
-
}}
|
|
126
|
-
on:error={({ detail }) => {
|
|
127
|
-
loading_status = loading_status || {};
|
|
128
|
-
loading_status.status = "error";
|
|
129
|
-
gradio.dispatch("error", detail);
|
|
130
|
-
}}
|
|
150
|
+
on:change={({ detail }) => handle_change(detail)}
|
|
151
|
+
on:drag={({ detail }) => handle_drag(detail)}
|
|
152
|
+
on:clear={handle_clear}
|
|
153
|
+
on:load={({ detail }) => handle_load(detail)}
|
|
154
|
+
on:error={({ detail }) => handle_error(detail)}
|
|
131
155
|
i18n={gradio.i18n}
|
|
132
|
-
max_file_size={gradio.max_file_size}
|
|
133
|
-
upload={(...args) => gradio.client.upload(...args)}
|
|
134
|
-
stream_handler={(...args) => gradio.client.stream(...args)}
|
|
156
|
+
max_file_size={gradio.shared.max_file_size}
|
|
157
|
+
upload={(...args) => gradio.shared.client.upload(...args)}
|
|
158
|
+
stream_handler={(...args) => gradio.shared.client.stream(...args)}
|
|
135
159
|
>
|
|
136
160
|
<UploadText i18n={gradio.i18n} type="file" />
|
|
137
161
|
</Model3DUpload>
|
package/dist/Index.svelte.d.ts
CHANGED
|
@@ -1,42 +1,6 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
export { default as BaseModel3D } from "./shared/Model3D.svelte";
|
|
3
2
|
export { default as BaseModel3DUpload } from "./shared/Model3DUpload.svelte";
|
|
4
3
|
export { default as BaseExample } from "./Example.svelte";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
declare const __propDef: {
|
|
9
|
-
props: {
|
|
10
|
-
elem_id?: string;
|
|
11
|
-
elem_classes?: string[];
|
|
12
|
-
visible?: boolean | "hidden";
|
|
13
|
-
value?: null | FileData;
|
|
14
|
-
root: string;
|
|
15
|
-
display_mode?: "solid" | "point_cloud" | "wireframe";
|
|
16
|
-
clear_color: [number, number, number, number];
|
|
17
|
-
loading_status: LoadingStatus;
|
|
18
|
-
label: string;
|
|
19
|
-
show_label: boolean;
|
|
20
|
-
container?: boolean;
|
|
21
|
-
scale?: number | null;
|
|
22
|
-
min_width?: number | undefined;
|
|
23
|
-
gradio: Gradio;
|
|
24
|
-
height?: number | undefined;
|
|
25
|
-
zoom_speed?: number;
|
|
26
|
-
input_ready: boolean;
|
|
27
|
-
has_change_history?: boolean;
|
|
28
|
-
camera_position?: [number | null, number | null, number | null];
|
|
29
|
-
interactive: boolean;
|
|
30
|
-
};
|
|
31
|
-
events: {
|
|
32
|
-
[evt: string]: CustomEvent<any>;
|
|
33
|
-
};
|
|
34
|
-
slots: {};
|
|
35
|
-
exports?: {} | undefined;
|
|
36
|
-
bindings?: string | undefined;
|
|
37
|
-
};
|
|
38
|
-
export type IndexProps = typeof __propDef.props;
|
|
39
|
-
export type IndexEvents = typeof __propDef.events;
|
|
40
|
-
export type IndexSlots = typeof __propDef.slots;
|
|
41
|
-
export default class Index extends SvelteComponent<IndexProps, IndexEvents, IndexSlots> {
|
|
42
|
-
}
|
|
4
|
+
declare const Index: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
+
type Index = ReturnType<typeof Index>;
|
|
6
|
+
export default Index;
|