@gradio/image 0.23.1 → 0.24.0-dev.2
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 +42 -0
- package/Image.test.ts +3 -3
- package/Index.svelte +106 -137
- package/dist/Example.svelte +7 -4
- package/dist/Example.svelte.d.ts +20 -18
- package/dist/Index.svelte +148 -148
- package/dist/Index.svelte.d.ts +3 -178
- package/dist/shared/Image.svelte +19 -2
- package/dist/shared/Image.svelte.d.ts +24 -19
- package/dist/shared/ImagePreview.svelte +54 -37
- package/dist/shared/ImagePreview.svelte.d.ts +33 -32
- package/dist/shared/ImageUploader.svelte +185 -138
- package/dist/shared/ImageUploader.svelte.d.ts +59 -49
- package/dist/shared/Webcam.svelte +264 -228
- package/dist/shared/Webcam.svelte.d.ts +42 -41
- package/dist/shared/WebcamPermissions.svelte +7 -3
- package/dist/shared/WebcamPermissions.svelte.d.ts +18 -16
- package/dist/shared/types.d.ts +30 -0
- package/package.json +11 -11
- package/shared/Image.svelte +18 -9
- package/shared/ImagePreview.svelte +12 -8
- package/shared/ImageUploader.svelte +9 -6
- package/shared/Webcam.svelte +6 -30
- package/shared/types.ts +33 -0
package/dist/Index.svelte
CHANGED
|
@@ -1,121 +1,107 @@
|
|
|
1
1
|
<svelte:options accessors={true} />
|
|
2
2
|
|
|
3
|
-
<script context="module"
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
3
|
+
<script context="module" lang="ts">
|
|
4
|
+
export { default as Webcam } from "./shared/Webcam.svelte";
|
|
5
|
+
export { default as BaseImageUploader } from "./shared/ImageUploader.svelte";
|
|
6
|
+
export { default as BaseStaticImage } from "./shared/ImagePreview.svelte";
|
|
7
|
+
export { default as BaseExample } from "./Example.svelte";
|
|
8
|
+
export { default as BaseImage } from "./shared/Image.svelte";
|
|
8
9
|
</script>
|
|
9
10
|
|
|
10
|
-
<script
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
} else if (drag_event.type === "dragleave") {
|
|
83
|
-
dragging = false;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const handle_drop = (event) => {
|
|
87
|
-
if (interactive) {
|
|
88
|
-
const drop_event = event;
|
|
89
|
-
drop_event.preventDefault();
|
|
90
|
-
drop_event.stopPropagation();
|
|
91
|
-
dragging = false;
|
|
92
|
-
if (upload_component) {
|
|
93
|
-
upload_component.loadFilesFromDrop(drop_event);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { tick } from "svelte";
|
|
13
|
+
import { Gradio } from "@gradio/utils";
|
|
14
|
+
import StaticImage from "./shared/ImagePreview.svelte";
|
|
15
|
+
import ImageUploader from "./shared/ImageUploader.svelte";
|
|
16
|
+
import { Block, Empty, UploadText } from "@gradio/atoms";
|
|
17
|
+
import { Image } from "@gradio/icons";
|
|
18
|
+
import { StatusTracker } from "@gradio/statustracker";
|
|
19
|
+
import type { ImageProps, ImageEvents } from "./shared/types";
|
|
20
|
+
|
|
21
|
+
let stream_data = { value: null };
|
|
22
|
+
let upload_promise = $state<Promise<any>>();
|
|
23
|
+
class ImageGradio extends Gradio<ImageEvents, ImageProps> {
|
|
24
|
+
async get_data() {
|
|
25
|
+
if (upload_promise) {
|
|
26
|
+
await upload_promise;
|
|
27
|
+
await tick();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const data = await super.get_data();
|
|
31
|
+
if (props.props.streaming) {
|
|
32
|
+
data.value = stream_data.value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const props = $props();
|
|
40
|
+
const gradio = new ImageGradio(props);
|
|
41
|
+
|
|
42
|
+
let fullscreen = $state(false);
|
|
43
|
+
let dragging = $state(false);
|
|
44
|
+
let active_source = $derived.by(() =>
|
|
45
|
+
gradio.props.sources ? gradio.props.sources[0] : null
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
let upload_component: ImageUploader;
|
|
49
|
+
const handle_drag_event = (event: Event): void => {
|
|
50
|
+
const drag_event = event as DragEvent;
|
|
51
|
+
drag_event.preventDefault();
|
|
52
|
+
drag_event.stopPropagation();
|
|
53
|
+
if (drag_event.type === "dragenter" || drag_event.type === "dragover") {
|
|
54
|
+
dragging = true;
|
|
55
|
+
} else if (drag_event.type === "dragleave") {
|
|
56
|
+
dragging = false;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handle_drop = (event: Event): void => {
|
|
61
|
+
if (gradio.shared.interactive) {
|
|
62
|
+
const drop_event = event as DragEvent;
|
|
63
|
+
drop_event.preventDefault();
|
|
64
|
+
drop_event.stopPropagation();
|
|
65
|
+
dragging = false;
|
|
66
|
+
|
|
67
|
+
if (upload_component) {
|
|
68
|
+
upload_component.loadFilesFromDrop(drop_event);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
let old_value = $state(gradio.props.value);
|
|
74
|
+
|
|
75
|
+
$effect(() => {
|
|
76
|
+
if (old_value != gradio.props.value) {
|
|
77
|
+
old_value = gradio.props.value;
|
|
78
|
+
gradio.dispatch("change");
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
let status = $derived(gradio?.shared?.loading_status.stream_state);
|
|
97
83
|
</script>
|
|
98
84
|
|
|
99
|
-
{#if !interactive}
|
|
85
|
+
{#if !gradio.shared.interactive}
|
|
100
86
|
<Block
|
|
101
|
-
{visible}
|
|
87
|
+
visible={gradio.shared.visible}
|
|
102
88
|
variant={"solid"}
|
|
103
89
|
border_mode={dragging ? "focus" : "base"}
|
|
104
90
|
padding={false}
|
|
105
|
-
{elem_id}
|
|
106
|
-
{elem_classes}
|
|
107
|
-
height={height || undefined}
|
|
108
|
-
{width}
|
|
91
|
+
elem_id={gradio.shared.elem_id}
|
|
92
|
+
elem_classes={gradio.shared.elem_classes}
|
|
93
|
+
height={gradio.props.height || undefined}
|
|
94
|
+
width={gradio.props.width}
|
|
109
95
|
allow_overflow={false}
|
|
110
|
-
{container}
|
|
111
|
-
{scale}
|
|
112
|
-
{min_width}
|
|
96
|
+
container={gradio.shared.container}
|
|
97
|
+
scale{gradio.shared.scale}
|
|
98
|
+
min_width={gradio.shared.min_width}
|
|
113
99
|
bind:fullscreen
|
|
114
100
|
>
|
|
115
101
|
<StatusTracker
|
|
116
|
-
autoscroll={gradio.autoscroll}
|
|
102
|
+
autoscroll={gradio.shared.autoscroll}
|
|
117
103
|
i18n={gradio.i18n}
|
|
118
|
-
{...loading_status}
|
|
104
|
+
{...gradio.shared.loading_status}
|
|
119
105
|
/>
|
|
120
106
|
<StaticImage
|
|
121
107
|
on:select={({ detail }) => gradio.dispatch("select", detail)}
|
|
@@ -125,89 +111,103 @@ const handle_drop = (event) => {
|
|
|
125
111
|
fullscreen = detail;
|
|
126
112
|
}}
|
|
127
113
|
{fullscreen}
|
|
128
|
-
{value}
|
|
129
|
-
{label}
|
|
130
|
-
{show_label}
|
|
131
|
-
{
|
|
132
|
-
selectable={_selectable}
|
|
133
|
-
{show_share_button}
|
|
114
|
+
value={gradio.props.value}
|
|
115
|
+
label={gradio.shared.label}
|
|
116
|
+
show_label={gradio.shared.show_label}
|
|
117
|
+
selectable={gradio.props._selectable}
|
|
134
118
|
i18n={gradio.i18n}
|
|
135
|
-
{
|
|
119
|
+
buttons={gradio.props.buttons}
|
|
136
120
|
/>
|
|
137
121
|
</Block>
|
|
138
122
|
{:else}
|
|
139
123
|
<Block
|
|
140
|
-
{visible}
|
|
141
|
-
variant={value === null ? "dashed" : "solid"}
|
|
124
|
+
visible={gradio.shared.visible}
|
|
125
|
+
variant={gradio.props.value === null ? "dashed" : "solid"}
|
|
142
126
|
border_mode={dragging ? "focus" : "base"}
|
|
143
127
|
padding={false}
|
|
144
|
-
{elem_id}
|
|
145
|
-
{elem_classes}
|
|
146
|
-
height={height || undefined}
|
|
147
|
-
{width}
|
|
128
|
+
elem_id={gradio.shared.elem_id}
|
|
129
|
+
elem_classes={gradio.shared.elem_classes}
|
|
130
|
+
height={gradio.props.height || undefined}
|
|
131
|
+
width={gradio.props.width}
|
|
148
132
|
allow_overflow={false}
|
|
149
|
-
{container}
|
|
150
|
-
{scale}
|
|
151
|
-
{min_width}
|
|
133
|
+
container={gradio.shared.container}
|
|
134
|
+
scale={gradio.shared.scale}
|
|
135
|
+
min_width={gradio.shared.min_width}
|
|
152
136
|
bind:fullscreen
|
|
153
137
|
on:dragenter={handle_drag_event}
|
|
154
138
|
on:dragleave={handle_drag_event}
|
|
155
139
|
on:dragover={handle_drag_event}
|
|
156
140
|
on:drop={handle_drop}
|
|
157
141
|
>
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
142
|
+
{#if gradio.shared.loading_status.type === "output"}
|
|
143
|
+
<StatusTracker
|
|
144
|
+
autoscroll={gradio.shared.autoscroll}
|
|
145
|
+
i18n={gradio.i18n}
|
|
146
|
+
{...gradio.shared.loading_status}
|
|
147
|
+
on:clear_status={() =>
|
|
148
|
+
gradio.dispatch("clear_status", gradio.shared.loading_status)}
|
|
149
|
+
/>
|
|
150
|
+
{/if}
|
|
165
151
|
<ImageUploader
|
|
152
|
+
bind:upload_promise
|
|
166
153
|
bind:this={upload_component}
|
|
167
|
-
bind:uploading
|
|
168
154
|
bind:active_source
|
|
169
|
-
bind:value
|
|
155
|
+
bind:value={gradio.props.value}
|
|
170
156
|
bind:dragging
|
|
171
|
-
selectable={_selectable}
|
|
172
|
-
{root}
|
|
173
|
-
{sources}
|
|
157
|
+
selectable={gradio.props._selectable}
|
|
158
|
+
root={gradio.shared.root}
|
|
159
|
+
sources={gradio.props.sources}
|
|
174
160
|
{fullscreen}
|
|
161
|
+
show_fullscreen_button={gradio.props.buttons === null
|
|
162
|
+
? true
|
|
163
|
+
: gradio.props.buttons.includes("fullscreen")}
|
|
175
164
|
on:edit={() => gradio.dispatch("edit")}
|
|
176
165
|
on:clear={() => {
|
|
177
166
|
fullscreen = false;
|
|
178
167
|
gradio.dispatch("clear");
|
|
168
|
+
gradio.dispatch("input");
|
|
169
|
+
}}
|
|
170
|
+
on:stream={({ detail }) => {
|
|
171
|
+
stream_data = detail;
|
|
172
|
+
gradio.dispatch("stream", detail);
|
|
179
173
|
}}
|
|
180
|
-
on:stream={({ detail }) => gradio.dispatch("stream", detail)}
|
|
181
174
|
on:drag={({ detail }) => (dragging = detail)}
|
|
182
|
-
on:upload={() =>
|
|
175
|
+
on:upload={() => {
|
|
176
|
+
gradio.dispatch("upload");
|
|
177
|
+
gradio.dispatch("input");
|
|
178
|
+
}}
|
|
183
179
|
on:select={({ detail }) => gradio.dispatch("select", detail)}
|
|
184
180
|
on:share={({ detail }) => gradio.dispatch("share", detail)}
|
|
185
181
|
on:error={({ detail }) => {
|
|
186
|
-
loading_status =
|
|
187
|
-
loading_status.status = "error";
|
|
182
|
+
gradio.shared.loading_status.status = "error";
|
|
188
183
|
gradio.dispatch("error", detail);
|
|
189
184
|
}}
|
|
190
185
|
on:close_stream={() => {
|
|
191
|
-
gradio.dispatch("close_stream"
|
|
186
|
+
gradio.dispatch("close_stream");
|
|
192
187
|
}}
|
|
193
188
|
on:fullscreen={({ detail }) => {
|
|
194
189
|
fullscreen = detail;
|
|
195
190
|
}}
|
|
196
|
-
{label}
|
|
197
|
-
{show_label}
|
|
198
|
-
{pending
|
|
199
|
-
|
|
200
|
-
{
|
|
201
|
-
{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
max_file_size={gradio.max_file_size}
|
|
191
|
+
label={gradio.shared.label}
|
|
192
|
+
show_label={gradio.shared.show_label}
|
|
193
|
+
pending={gradio.shared.loading_status?.status === "pending" ||
|
|
194
|
+
gradio.shared.loading_status?.status === "streaming"}
|
|
195
|
+
streaming={gradio.props.streaming}
|
|
196
|
+
webcam_options={gradio.props.webcam_options}
|
|
197
|
+
stream_every={gradio.props.stream_every}
|
|
198
|
+
time_limit={gradio.shared.loading_status?.time_limit}
|
|
199
|
+
max_file_size={gradio.shared.max_file_size}
|
|
205
200
|
i18n={gradio.i18n}
|
|
206
|
-
upload={(...args) => gradio.client.upload(...args)}
|
|
207
|
-
stream_handler={gradio.client?.stream}
|
|
201
|
+
upload={(...args) => gradio.shared.client.upload(...args)}
|
|
202
|
+
stream_handler={gradio.shared.client?.stream}
|
|
203
|
+
stream_state={status}
|
|
208
204
|
>
|
|
209
205
|
{#if active_source === "upload" || !active_source}
|
|
210
|
-
<UploadText
|
|
206
|
+
<UploadText
|
|
207
|
+
i18n={gradio.i18n}
|
|
208
|
+
type="image"
|
|
209
|
+
placeholder={gradio.props.placeholder}
|
|
210
|
+
/>
|
|
211
211
|
{:else if active_source === "clipboard"}
|
|
212
212
|
<UploadText i18n={gradio.i18n} type="clipboard" mode="short" />
|
|
213
213
|
{:else}
|
package/dist/Index.svelte.d.ts
CHANGED
|
@@ -1,183 +1,8 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
export { default as Webcam } from "./shared/Webcam.svelte";
|
|
3
2
|
export { default as BaseImageUploader } from "./shared/ImageUploader.svelte";
|
|
4
3
|
export { default as BaseStaticImage } from "./shared/ImagePreview.svelte";
|
|
5
4
|
export { default as BaseExample } from "./Example.svelte";
|
|
6
5
|
export { default as BaseImage } from "./shared/Image.svelte";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import type { LoadingStatus } from "@gradio/statustracker";
|
|
11
|
-
declare const __propDef: {
|
|
12
|
-
props: {
|
|
13
|
-
modify_stream_state?: (state: "open" | "closed" | "waiting") => void;
|
|
14
|
-
get_stream_state?: () => void;
|
|
15
|
-
set_time_limit: (arg0: number) => void;
|
|
16
|
-
value_is_output?: boolean;
|
|
17
|
-
elem_id?: string;
|
|
18
|
-
elem_classes?: string[];
|
|
19
|
-
visible?: boolean | "hidden";
|
|
20
|
-
value?: null | FileData;
|
|
21
|
-
label: string;
|
|
22
|
-
show_label: boolean;
|
|
23
|
-
show_download_button: boolean;
|
|
24
|
-
root: string;
|
|
25
|
-
height: number | undefined;
|
|
26
|
-
width: number | undefined;
|
|
27
|
-
stream_every: number;
|
|
28
|
-
_selectable?: boolean;
|
|
29
|
-
container?: boolean;
|
|
30
|
-
scale?: number | null;
|
|
31
|
-
min_width?: number | undefined;
|
|
32
|
-
loading_status: LoadingStatus;
|
|
33
|
-
show_share_button?: boolean;
|
|
34
|
-
sources?: ("clipboard" | "webcam" | "upload")[];
|
|
35
|
-
interactive: boolean;
|
|
36
|
-
streaming: boolean;
|
|
37
|
-
pending: boolean;
|
|
38
|
-
placeholder?: string | undefined;
|
|
39
|
-
show_fullscreen_button: boolean;
|
|
40
|
-
input_ready: boolean;
|
|
41
|
-
webcam_options: WebcamOptions;
|
|
42
|
-
gradio: Gradio<{
|
|
43
|
-
input: never;
|
|
44
|
-
change: never;
|
|
45
|
-
error: string;
|
|
46
|
-
edit: never;
|
|
47
|
-
stream: ValueData;
|
|
48
|
-
drag: never;
|
|
49
|
-
upload: never;
|
|
50
|
-
clear: never;
|
|
51
|
-
select: SelectData;
|
|
52
|
-
share: ShareData;
|
|
53
|
-
clear_status: LoadingStatus;
|
|
54
|
-
close_stream: string;
|
|
55
|
-
}>;
|
|
56
|
-
};
|
|
57
|
-
events: {
|
|
58
|
-
[evt: string]: CustomEvent<any>;
|
|
59
|
-
};
|
|
60
|
-
slots: {};
|
|
61
|
-
exports?: {} | undefined;
|
|
62
|
-
bindings?: string | undefined;
|
|
63
|
-
};
|
|
64
|
-
export type IndexProps = typeof __propDef.props;
|
|
65
|
-
export type IndexEvents = typeof __propDef.events;
|
|
66
|
-
export type IndexSlots = typeof __propDef.slots;
|
|
67
|
-
export default class Index extends SvelteComponent<IndexProps, IndexEvents, IndexSlots> {
|
|
68
|
-
get modify_stream_state(): (state: "open" | "closed" | "waiting") => void;
|
|
69
|
-
get get_stream_state(): () => void;
|
|
70
|
-
get undefined(): any;
|
|
71
|
-
/**accessor*/
|
|
72
|
-
set undefined(_: any);
|
|
73
|
-
get set_time_limit(): (arg0: number) => void;
|
|
74
|
-
/**accessor*/
|
|
75
|
-
set set_time_limit(_: (arg0: number) => void);
|
|
76
|
-
get value_is_output(): boolean | undefined;
|
|
77
|
-
/**accessor*/
|
|
78
|
-
set value_is_output(_: boolean | undefined);
|
|
79
|
-
get elem_id(): string | undefined;
|
|
80
|
-
/**accessor*/
|
|
81
|
-
set elem_id(_: string | undefined);
|
|
82
|
-
get elem_classes(): string[] | undefined;
|
|
83
|
-
/**accessor*/
|
|
84
|
-
set elem_classes(_: string[] | undefined);
|
|
85
|
-
get visible(): boolean | "hidden" | undefined;
|
|
86
|
-
/**accessor*/
|
|
87
|
-
set visible(_: boolean | "hidden" | undefined);
|
|
88
|
-
get value(): any;
|
|
89
|
-
/**accessor*/
|
|
90
|
-
set value(_: any);
|
|
91
|
-
get label(): string;
|
|
92
|
-
/**accessor*/
|
|
93
|
-
set label(_: string);
|
|
94
|
-
get show_label(): boolean;
|
|
95
|
-
/**accessor*/
|
|
96
|
-
set show_label(_: boolean);
|
|
97
|
-
get show_download_button(): boolean;
|
|
98
|
-
/**accessor*/
|
|
99
|
-
set show_download_button(_: boolean);
|
|
100
|
-
get root(): string;
|
|
101
|
-
/**accessor*/
|
|
102
|
-
set root(_: string);
|
|
103
|
-
get height(): number | undefined;
|
|
104
|
-
/**accessor*/
|
|
105
|
-
set height(_: number | undefined);
|
|
106
|
-
get width(): number | undefined;
|
|
107
|
-
/**accessor*/
|
|
108
|
-
set width(_: number | undefined);
|
|
109
|
-
get stream_every(): number;
|
|
110
|
-
/**accessor*/
|
|
111
|
-
set stream_every(_: number);
|
|
112
|
-
get _selectable(): boolean | undefined;
|
|
113
|
-
/**accessor*/
|
|
114
|
-
set _selectable(_: boolean | undefined);
|
|
115
|
-
get container(): boolean | undefined;
|
|
116
|
-
/**accessor*/
|
|
117
|
-
set container(_: boolean | undefined);
|
|
118
|
-
get scale(): number | null | undefined;
|
|
119
|
-
/**accessor*/
|
|
120
|
-
set scale(_: number | null | undefined);
|
|
121
|
-
get min_width(): number | undefined;
|
|
122
|
-
/**accessor*/
|
|
123
|
-
set min_width(_: number | undefined);
|
|
124
|
-
get loading_status(): LoadingStatus;
|
|
125
|
-
/**accessor*/
|
|
126
|
-
set loading_status(_: LoadingStatus);
|
|
127
|
-
get show_share_button(): boolean | undefined;
|
|
128
|
-
/**accessor*/
|
|
129
|
-
set show_share_button(_: boolean | undefined);
|
|
130
|
-
get sources(): ("clipboard" | "upload" | "webcam")[] | undefined;
|
|
131
|
-
/**accessor*/
|
|
132
|
-
set sources(_: ("clipboard" | "upload" | "webcam")[] | undefined);
|
|
133
|
-
get interactive(): boolean;
|
|
134
|
-
/**accessor*/
|
|
135
|
-
set interactive(_: boolean);
|
|
136
|
-
get streaming(): boolean;
|
|
137
|
-
/**accessor*/
|
|
138
|
-
set streaming(_: boolean);
|
|
139
|
-
get pending(): boolean;
|
|
140
|
-
/**accessor*/
|
|
141
|
-
set pending(_: boolean);
|
|
142
|
-
get placeholder(): string | undefined;
|
|
143
|
-
/**accessor*/
|
|
144
|
-
set placeholder(_: string | undefined);
|
|
145
|
-
get show_fullscreen_button(): boolean;
|
|
146
|
-
/**accessor*/
|
|
147
|
-
set show_fullscreen_button(_: boolean);
|
|
148
|
-
get input_ready(): boolean;
|
|
149
|
-
/**accessor*/
|
|
150
|
-
set input_ready(_: boolean);
|
|
151
|
-
get webcam_options(): WebcamOptions;
|
|
152
|
-
/**accessor*/
|
|
153
|
-
set webcam_options(_: WebcamOptions);
|
|
154
|
-
get gradio(): Gradio<{
|
|
155
|
-
input: never;
|
|
156
|
-
change: never;
|
|
157
|
-
error: string;
|
|
158
|
-
edit: never;
|
|
159
|
-
stream: ValueData;
|
|
160
|
-
drag: never;
|
|
161
|
-
upload: never;
|
|
162
|
-
clear: never;
|
|
163
|
-
select: SelectData;
|
|
164
|
-
share: ShareData;
|
|
165
|
-
clear_status: LoadingStatus;
|
|
166
|
-
close_stream: string;
|
|
167
|
-
}>;
|
|
168
|
-
/**accessor*/
|
|
169
|
-
set gradio(_: Gradio<{
|
|
170
|
-
input: never;
|
|
171
|
-
change: never;
|
|
172
|
-
error: string;
|
|
173
|
-
edit: never;
|
|
174
|
-
stream: ValueData;
|
|
175
|
-
drag: never;
|
|
176
|
-
upload: never;
|
|
177
|
-
clear: never;
|
|
178
|
-
select: SelectData;
|
|
179
|
-
share: ShareData;
|
|
180
|
-
clear_status: LoadingStatus;
|
|
181
|
-
close_stream: string;
|
|
182
|
-
}>);
|
|
183
|
-
}
|
|
6
|
+
declare const Index: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type Index = ReturnType<typeof Index>;
|
|
8
|
+
export default Index;
|
package/dist/shared/Image.svelte
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let {
|
|
3
|
+
src,
|
|
4
|
+
restProps,
|
|
5
|
+
data_testid,
|
|
6
|
+
class_names
|
|
7
|
+
}: {
|
|
8
|
+
src: string;
|
|
9
|
+
restProps: object;
|
|
10
|
+
data_testid: string;
|
|
11
|
+
class_names: string[];
|
|
12
|
+
} = $props();
|
|
2
13
|
</script>
|
|
3
14
|
|
|
4
15
|
<!-- svelte-ignore a11y-missing-attribute -->
|
|
5
|
-
<img
|
|
16
|
+
<img
|
|
17
|
+
{src}
|
|
18
|
+
class={(class_names || []).join(" ")}
|
|
19
|
+
data-testid={data_testid}
|
|
20
|
+
{...restProps}
|
|
21
|
+
on:load
|
|
22
|
+
/>
|
|
6
23
|
|
|
7
24
|
<style>
|
|
8
25
|
img {
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
events: {
|
|
8
|
-
load: Event;
|
|
9
|
-
} & {
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {};
|
|
13
|
-
exports?: {} | undefined;
|
|
14
|
-
bindings?: string | undefined;
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
src: string;
|
|
3
|
+
restProps: object;
|
|
4
|
+
data_testid: string;
|
|
5
|
+
class_names: string[];
|
|
15
6
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
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> {
|
|
8
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
9
|
+
$$bindings?: Bindings;
|
|
10
|
+
} & Exports;
|
|
11
|
+
(internal: unknown, props: Props & {
|
|
12
|
+
$$events?: Events;
|
|
13
|
+
$$slots?: Slots;
|
|
14
|
+
}): Exports & {
|
|
15
|
+
$set?: any;
|
|
16
|
+
$on?: any;
|
|
17
|
+
};
|
|
18
|
+
z_$$bindings?: Bindings;
|
|
20
19
|
}
|
|
21
|
-
|
|
20
|
+
declare const Image: $$__sveltets_2_IsomorphicComponent<$$ComponentProps, {
|
|
21
|
+
load: Event;
|
|
22
|
+
} & {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
}, {}, {}, "">;
|
|
25
|
+
type Image = InstanceType<typeof Image>;
|
|
26
|
+
export default Image;
|