@gradio/image 0.23.2-dev.0 → 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 +29 -0
- package/Index.svelte +105 -135
- package/dist/Example.svelte +7 -4
- package/dist/Example.svelte.d.ts +20 -18
- package/dist/Index.svelte +147 -146
- package/dist/Index.svelte.d.ts +3 -170
- package/dist/shared/Image.svelte +19 -2
- package/dist/shared/Image.svelte.d.ts +24 -19
- package/dist/shared/ImagePreview.svelte +51 -32
- package/dist/shared/ImagePreview.svelte.d.ts +33 -30
- 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 +8 -2
- package/shared/ImageUploader.svelte +9 -6
- package/shared/Webcam.svelte +6 -30
- package/shared/types.ts +33 -0
|
@@ -1,33 +1,47 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import Image from "
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export let
|
|
22
|
-
export let
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher, onMount } from "svelte";
|
|
3
|
+
import type { SelectData } from "@gradio/utils";
|
|
4
|
+
import { uploadToHuggingFace } from "@gradio/utils";
|
|
5
|
+
import {
|
|
6
|
+
BlockLabel,
|
|
7
|
+
Empty,
|
|
8
|
+
IconButton,
|
|
9
|
+
ShareButton,
|
|
10
|
+
IconButtonWrapper,
|
|
11
|
+
FullscreenButton,
|
|
12
|
+
DownloadLink
|
|
13
|
+
} from "@gradio/atoms";
|
|
14
|
+
import { Download, Image as ImageIcon } from "@gradio/icons";
|
|
15
|
+
import { get_coordinates_of_clicked_image } from "./utils";
|
|
16
|
+
import Image from "./Image.svelte";
|
|
17
|
+
|
|
18
|
+
import type { I18nFormatter } from "@gradio/utils";
|
|
19
|
+
import type { FileData } from "@gradio/client";
|
|
20
|
+
|
|
21
|
+
export let value: null | FileData;
|
|
22
|
+
export let label: string | undefined = undefined;
|
|
23
|
+
export let show_label: boolean;
|
|
24
|
+
export let buttons: string[] | null = null;
|
|
25
|
+
export let selectable = false;
|
|
26
|
+
export let i18n: I18nFormatter;
|
|
27
|
+
export let display_icon_button_wrapper_top_corner = false;
|
|
28
|
+
export let fullscreen = false;
|
|
29
|
+
export let show_button_background = true;
|
|
30
|
+
|
|
31
|
+
const dispatch = createEventDispatcher<{
|
|
32
|
+
change: string;
|
|
33
|
+
select: SelectData;
|
|
34
|
+
fullscreen: boolean;
|
|
35
|
+
}>();
|
|
36
|
+
|
|
37
|
+
const handle_click = (evt: MouseEvent): void => {
|
|
38
|
+
let coordinates = get_coordinates_of_clicked_image(evt);
|
|
39
|
+
if (coordinates) {
|
|
40
|
+
dispatch("select", { index: coordinates, value: null });
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
let image_container: HTMLElement;
|
|
31
45
|
</script>
|
|
32
46
|
|
|
33
47
|
<BlockLabel
|
|
@@ -35,12 +49,13 @@ let image_container;
|
|
|
35
49
|
Icon={ImageIcon}
|
|
36
50
|
label={!show_label ? "" : label || i18n("image.image")}
|
|
37
51
|
/>
|
|
38
|
-
{#if value
|
|
52
|
+
{#if value == null || !value?.url}
|
|
39
53
|
<Empty unpadded_box={true} size="large"><ImageIcon /></Empty>
|
|
40
54
|
{:else}
|
|
41
55
|
<div class="image-container" bind:this={image_container}>
|
|
42
56
|
<IconButtonWrapper
|
|
43
57
|
display_top_corner={display_icon_button_wrapper_top_corner}
|
|
58
|
+
show_background={show_button_background}
|
|
44
59
|
>
|
|
45
60
|
{#if buttons === null ? true : buttons.includes("fullscreen")}
|
|
46
61
|
<FullscreenButton {fullscreen} on:fullscreen />
|
|
@@ -67,7 +82,11 @@ let image_container;
|
|
|
67
82
|
</IconButtonWrapper>
|
|
68
83
|
<button on:click={handle_click}>
|
|
69
84
|
<div class:selectable class="image-frame">
|
|
70
|
-
<Image
|
|
85
|
+
<Image
|
|
86
|
+
src={value.url}
|
|
87
|
+
restProps={{ loading: "lazy", alt: "" }}
|
|
88
|
+
on:load
|
|
89
|
+
/>
|
|
71
90
|
</div>
|
|
72
91
|
</button>
|
|
73
92
|
</div>
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { SelectData } from "@gradio/utils";
|
|
3
2
|
import type { I18nFormatter } from "@gradio/utils";
|
|
4
3
|
import type { FileData } from "@gradio/client";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
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> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: Props & {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
15
14
|
};
|
|
16
|
-
|
|
17
|
-
fullscreen: CustomEvent<any>;
|
|
18
|
-
share: CustomEvent<import("@gradio/utils").ShareData>;
|
|
19
|
-
error: CustomEvent<string>;
|
|
20
|
-
load: Event;
|
|
21
|
-
change: CustomEvent<string>;
|
|
22
|
-
select: CustomEvent<SelectData>;
|
|
23
|
-
} & {
|
|
24
|
-
[evt: string]: CustomEvent<any>;
|
|
25
|
-
};
|
|
26
|
-
slots: {};
|
|
27
|
-
exports?: {} | undefined;
|
|
28
|
-
bindings?: string | undefined;
|
|
29
|
-
};
|
|
30
|
-
export type ImagePreviewProps = typeof __propDef.props;
|
|
31
|
-
export type ImagePreviewEvents = typeof __propDef.events;
|
|
32
|
-
export type ImagePreviewSlots = typeof __propDef.slots;
|
|
33
|
-
export default class ImagePreview extends SvelteComponent<ImagePreviewProps, ImagePreviewEvents, ImagePreviewSlots> {
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
34
16
|
}
|
|
35
|
-
|
|
17
|
+
declare const ImagePreview: $$__sveltets_2_IsomorphicComponent<{
|
|
18
|
+
value: null | FileData;
|
|
19
|
+
label?: string | undefined;
|
|
20
|
+
show_label: boolean;
|
|
21
|
+
buttons?: string[] | null;
|
|
22
|
+
selectable?: boolean;
|
|
23
|
+
i18n: I18nFormatter;
|
|
24
|
+
display_icon_button_wrapper_top_corner?: boolean;
|
|
25
|
+
fullscreen?: boolean;
|
|
26
|
+
show_button_background?: boolean;
|
|
27
|
+
}, {
|
|
28
|
+
fullscreen: CustomEvent<any>;
|
|
29
|
+
share: CustomEvent<import("@gradio/utils").ShareData>;
|
|
30
|
+
error: CustomEvent<string>;
|
|
31
|
+
load: Event;
|
|
32
|
+
change: CustomEvent<string>;
|
|
33
|
+
select: CustomEvent<SelectData>;
|
|
34
|
+
} & {
|
|
35
|
+
[evt: string]: CustomEvent<any>;
|
|
36
|
+
}, {}, {}, string>;
|
|
37
|
+
type ImagePreview = InstanceType<typeof ImagePreview>;
|
|
38
|
+
export default ImagePreview;
|
|
@@ -1,138 +1,184 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export let
|
|
21
|
-
export let
|
|
22
|
-
export let
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export let
|
|
27
|
-
export let
|
|
28
|
-
export let
|
|
29
|
-
export let
|
|
30
|
-
let
|
|
31
|
-
export let
|
|
32
|
-
export let
|
|
33
|
-
export let
|
|
34
|
-
let
|
|
35
|
-
let
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher, tick } from "svelte";
|
|
3
|
+
import { BlockLabel, IconButtonWrapper, IconButton } from "@gradio/atoms";
|
|
4
|
+
import { Clear, Image as ImageIcon } from "@gradio/icons";
|
|
5
|
+
import { FullscreenButton } from "@gradio/atoms";
|
|
6
|
+
import {
|
|
7
|
+
type SelectData,
|
|
8
|
+
type I18nFormatter,
|
|
9
|
+
type ValueData
|
|
10
|
+
} from "@gradio/utils";
|
|
11
|
+
import { get_coordinates_of_clicked_image } from "./utils";
|
|
12
|
+
import Webcam from "./Webcam.svelte";
|
|
13
|
+
|
|
14
|
+
import { Upload, UploadProgress } from "@gradio/upload";
|
|
15
|
+
import { FileData, type Client } from "@gradio/client";
|
|
16
|
+
import { SelectSource } from "@gradio/atoms";
|
|
17
|
+
import Image from "./Image.svelte";
|
|
18
|
+
import type { Base64File, WebcamOptions } from "./types";
|
|
19
|
+
|
|
20
|
+
export let value: null | FileData | Base64File = null;
|
|
21
|
+
export let label: string | undefined = undefined;
|
|
22
|
+
export let show_label: boolean;
|
|
23
|
+
|
|
24
|
+
type source_type = "upload" | "webcam" | "clipboard" | "microphone" | null;
|
|
25
|
+
|
|
26
|
+
export let sources: source_type[] = ["upload", "clipboard", "webcam"];
|
|
27
|
+
export let streaming = false;
|
|
28
|
+
export let pending = false;
|
|
29
|
+
export let webcam_options: WebcamOptions;
|
|
30
|
+
export let selectable = false;
|
|
31
|
+
export let root: string;
|
|
32
|
+
export let i18n: I18nFormatter;
|
|
33
|
+
export let max_file_size: number | null = null;
|
|
34
|
+
export let upload: Client["upload"];
|
|
35
|
+
export let stream_handler: Client["stream"];
|
|
36
|
+
export let stream_every: number;
|
|
37
|
+
export let time_limit: number;
|
|
38
|
+
export let show_fullscreen_button = true;
|
|
39
|
+
export let stream_state: "open" | "waiting" | "closed" = "closed";
|
|
40
|
+
export let upload_promise: Promise<any> | null = null;
|
|
41
|
+
|
|
42
|
+
let upload_input: Upload;
|
|
43
|
+
export let uploading = false;
|
|
44
|
+
export let active_source: source_type = null;
|
|
45
|
+
export let fullscreen = false;
|
|
46
|
+
|
|
47
|
+
let files: FileData[] = [];
|
|
48
|
+
let upload_id: string;
|
|
49
|
+
|
|
50
|
+
async function handle_upload({
|
|
51
|
+
detail
|
|
52
|
+
}: CustomEvent<FileData>): Promise<void> {
|
|
53
|
+
if (!streaming) {
|
|
54
|
+
if (detail.path?.toLowerCase().endsWith(".svg") && detail.url) {
|
|
55
|
+
const response = await fetch(detail.url);
|
|
56
|
+
const svgContent = await response.text();
|
|
57
|
+
value = {
|
|
58
|
+
...detail,
|
|
59
|
+
url: `data:image/svg+xml,${encodeURIComponent(svgContent)}`
|
|
60
|
+
};
|
|
61
|
+
} else {
|
|
62
|
+
value = detail;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
await tick();
|
|
66
|
+
dispatch("upload");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function handle_clear(): void {
|
|
71
|
+
value = null;
|
|
72
|
+
dispatch("clear");
|
|
73
|
+
dispatch("change", null);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function handle_remove_image_click(event: MouseEvent): void {
|
|
77
|
+
handle_clear();
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function handle_save(
|
|
82
|
+
img_blob: Blob | any,
|
|
83
|
+
event: "change" | "stream" | "upload"
|
|
84
|
+
): Promise<void> {
|
|
85
|
+
console.log("handle_save", { event, img_blob });
|
|
86
|
+
if (event === "stream") {
|
|
87
|
+
dispatch("stream", {
|
|
88
|
+
value: { url: img_blob } as Base64File,
|
|
89
|
+
is_value_data: true
|
|
90
|
+
});
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
upload_id = Math.random().toString(36).substring(2, 15);
|
|
94
|
+
const f_ = new File([img_blob], `image.${streaming ? "jpeg" : "png"}`);
|
|
95
|
+
files = [
|
|
96
|
+
new FileData({
|
|
97
|
+
path: f_.name,
|
|
98
|
+
orig_name: f_.name,
|
|
99
|
+
blob: f_,
|
|
100
|
+
size: f_.size,
|
|
101
|
+
mime_type: f_.type,
|
|
102
|
+
is_stream: false
|
|
103
|
+
})
|
|
104
|
+
];
|
|
105
|
+
pending = true;
|
|
106
|
+
const f = await upload_input.load_files([f_], upload_id);
|
|
107
|
+
console.log("uploaded file", f);
|
|
108
|
+
if (event === "change" || event === "upload") {
|
|
109
|
+
value = f?.[0] || null;
|
|
110
|
+
await tick();
|
|
111
|
+
dispatch("change");
|
|
112
|
+
}
|
|
113
|
+
pending = false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
$: active_streaming = streaming && active_source === "webcam";
|
|
117
|
+
$: if (uploading && !active_streaming) value = null;
|
|
118
|
+
|
|
119
|
+
const dispatch = createEventDispatcher<{
|
|
120
|
+
change?: never;
|
|
121
|
+
stream: ValueData;
|
|
122
|
+
clear?: never;
|
|
123
|
+
drag: boolean;
|
|
124
|
+
upload?: never;
|
|
125
|
+
select: SelectData;
|
|
126
|
+
end_stream: never;
|
|
127
|
+
}>();
|
|
128
|
+
|
|
129
|
+
export let dragging = false;
|
|
130
|
+
|
|
131
|
+
$: dispatch("drag", dragging);
|
|
132
|
+
|
|
133
|
+
function handle_click(evt: MouseEvent): void {
|
|
134
|
+
let coordinates = get_coordinates_of_clicked_image(evt);
|
|
135
|
+
if (coordinates) {
|
|
136
|
+
dispatch("select", { index: coordinates, value: null });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
$: if (!active_source && sources) {
|
|
141
|
+
active_source = sources[0];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function handle_select_source(
|
|
145
|
+
source: (typeof sources)[number]
|
|
146
|
+
): Promise<void> {
|
|
147
|
+
switch (source) {
|
|
148
|
+
case "clipboard":
|
|
149
|
+
upload_input.paste_clipboard();
|
|
150
|
+
break;
|
|
151
|
+
default:
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
let image_container: HTMLElement;
|
|
157
|
+
|
|
158
|
+
function on_drag_over(evt: DragEvent): void {
|
|
159
|
+
evt.preventDefault();
|
|
160
|
+
evt.stopPropagation();
|
|
161
|
+
if (evt.dataTransfer) {
|
|
162
|
+
evt.dataTransfer.dropEffect = "copy";
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
dragging = true;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async function on_drop(evt: DragEvent): Promise<void> {
|
|
169
|
+
evt.preventDefault();
|
|
170
|
+
evt.stopPropagation();
|
|
171
|
+
dragging = false;
|
|
172
|
+
|
|
173
|
+
if (value) {
|
|
174
|
+
handle_clear();
|
|
175
|
+
await tick();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
active_source = "upload";
|
|
179
|
+
await tick();
|
|
180
|
+
upload_input.load_files_from_drop(evt);
|
|
181
|
+
}
|
|
136
182
|
</script>
|
|
137
183
|
|
|
138
184
|
<BlockLabel {show_label} Icon={ImageIcon} label={label || "Image"} />
|
|
@@ -159,6 +205,7 @@ async function on_drop(evt) {
|
|
|
159
205
|
on:drop={on_drop}
|
|
160
206
|
>
|
|
161
207
|
<Upload
|
|
208
|
+
bind:upload_promise
|
|
162
209
|
hidden={value !== null || active_source === "webcam"}
|
|
163
210
|
bind:this={upload_input}
|
|
164
211
|
bind:uploading
|
|
@@ -189,6 +236,7 @@ async function on_drop(evt) {
|
|
|
189
236
|
on:drag
|
|
190
237
|
on:upload={(e) => handle_save(e.detail, "upload")}
|
|
191
238
|
on:close_stream
|
|
239
|
+
{stream_state}
|
|
192
240
|
mirror_webcam={webcam_options.mirror}
|
|
193
241
|
{stream_every}
|
|
194
242
|
{streaming}
|
|
@@ -196,15 +244,14 @@ async function on_drop(evt) {
|
|
|
196
244
|
include_audio={false}
|
|
197
245
|
{i18n}
|
|
198
246
|
{upload}
|
|
199
|
-
|
|
200
|
-
bind:set_time_limit
|
|
247
|
+
{time_limit}
|
|
201
248
|
webcam_constraints={webcam_options.constraints}
|
|
202
249
|
/>
|
|
203
250
|
{:else if value !== null && !streaming}
|
|
204
251
|
<!-- svelte-ignore a11y-click-events-have-key-events-->
|
|
205
252
|
<!-- svelte-ignore a11y-no-static-element-interactions-->
|
|
206
253
|
<div class:selectable class="image-frame" on:click={handle_click}>
|
|
207
|
-
<Image src={value.url}
|
|
254
|
+
<Image src={value.url} restProps={{ alt: value.alt_text }} />
|
|
208
255
|
</div>
|
|
209
256
|
{/if}
|
|
210
257
|
</div>
|
|
@@ -1,54 +1,64 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import { type SelectData, type I18nFormatter, type ValueData } from "@gradio/utils";
|
|
3
2
|
import { FileData, type Client } from "@gradio/client";
|
|
4
3
|
import type { Base64File, WebcamOptions } from "./types";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
root: string;
|
|
16
|
-
i18n: I18nFormatter;
|
|
17
|
-
max_file_size?: number | null;
|
|
18
|
-
upload: Client["upload"];
|
|
19
|
-
stream_handler: Client["stream"];
|
|
20
|
-
stream_every: number;
|
|
21
|
-
modify_stream: (state: "open" | "closed" | "waiting") => void;
|
|
22
|
-
set_time_limit: (arg0: number) => void;
|
|
23
|
-
show_fullscreen_button?: boolean;
|
|
24
|
-
uploading?: boolean;
|
|
25
|
-
active_source?: "clipboard" | "upload" | "microphone" | "webcam" | null;
|
|
26
|
-
fullscreen?: boolean;
|
|
27
|
-
dragging?: boolean;
|
|
4
|
+
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> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: Props & {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
28
14
|
};
|
|
29
|
-
|
|
30
|
-
fullscreen: CustomEvent<boolean>;
|
|
31
|
-
error: CustomEvent<any> | CustomEvent<string>;
|
|
32
|
-
drag: CustomEvent<any>;
|
|
33
|
-
close_stream: CustomEvent<undefined>;
|
|
34
|
-
change?: CustomEvent<undefined> | undefined;
|
|
35
|
-
stream: CustomEvent<ValueData>;
|
|
36
|
-
clear?: CustomEvent<undefined> | undefined;
|
|
37
|
-
upload?: CustomEvent<undefined> | undefined;
|
|
38
|
-
select: CustomEvent<SelectData>;
|
|
39
|
-
end_stream: CustomEvent<never>;
|
|
40
|
-
} & {
|
|
41
|
-
[evt: string]: CustomEvent<any>;
|
|
42
|
-
};
|
|
43
|
-
slots: {
|
|
44
|
-
default: {};
|
|
45
|
-
};
|
|
46
|
-
exports?: {} | undefined;
|
|
47
|
-
bindings?: string | undefined;
|
|
48
|
-
};
|
|
49
|
-
export type ImageUploaderProps = typeof __propDef.props;
|
|
50
|
-
export type ImageUploaderEvents = typeof __propDef.events;
|
|
51
|
-
export type ImageUploaderSlots = typeof __propDef.slots;
|
|
52
|
-
export default class ImageUploader extends SvelteComponent<ImageUploaderProps, ImageUploaderEvents, ImageUploaderSlots> {
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
53
16
|
}
|
|
54
|
-
|
|
17
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
18
|
+
default: any;
|
|
19
|
+
} ? Props extends Record<string, never> ? any : {
|
|
20
|
+
children?: any;
|
|
21
|
+
} : {});
|
|
22
|
+
declare const ImageUploader: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
23
|
+
value?: null | FileData | Base64File;
|
|
24
|
+
label?: string | undefined;
|
|
25
|
+
show_label: boolean;
|
|
26
|
+
sources?: ("upload" | "clipboard" | "microphone" | "webcam" | null)[];
|
|
27
|
+
streaming?: boolean;
|
|
28
|
+
pending?: boolean;
|
|
29
|
+
webcam_options: WebcamOptions;
|
|
30
|
+
selectable?: boolean;
|
|
31
|
+
root: string;
|
|
32
|
+
i18n: I18nFormatter;
|
|
33
|
+
max_file_size?: number | null;
|
|
34
|
+
upload: Client["upload"];
|
|
35
|
+
stream_handler: Client["stream"];
|
|
36
|
+
stream_every: number;
|
|
37
|
+
time_limit: number;
|
|
38
|
+
show_fullscreen_button?: boolean;
|
|
39
|
+
stream_state?: "open" | "waiting" | "closed";
|
|
40
|
+
upload_promise?: Promise<any> | null;
|
|
41
|
+
uploading?: boolean;
|
|
42
|
+
active_source?: "upload" | "clipboard" | "microphone" | "webcam" | null;
|
|
43
|
+
fullscreen?: boolean;
|
|
44
|
+
dragging?: boolean;
|
|
45
|
+
}, {
|
|
46
|
+
default: {};
|
|
47
|
+
}>, {
|
|
48
|
+
fullscreen: CustomEvent<boolean>;
|
|
49
|
+
error: CustomEvent<any> | CustomEvent<string>;
|
|
50
|
+
drag: CustomEvent<any>;
|
|
51
|
+
close_stream: CustomEvent<undefined>;
|
|
52
|
+
change?: CustomEvent<undefined> | undefined;
|
|
53
|
+
stream: CustomEvent<ValueData>;
|
|
54
|
+
clear?: CustomEvent<undefined> | undefined;
|
|
55
|
+
upload?: CustomEvent<undefined> | undefined;
|
|
56
|
+
select: CustomEvent<SelectData>;
|
|
57
|
+
end_stream: CustomEvent<never>;
|
|
58
|
+
} & {
|
|
59
|
+
[evt: string]: CustomEvent<any>;
|
|
60
|
+
}, {
|
|
61
|
+
default: {};
|
|
62
|
+
}, {}, string>;
|
|
63
|
+
type ImageUploader = InstanceType<typeof ImageUploader>;
|
|
64
|
+
export default ImageUploader;
|