gradio-pr-bot commited on
Commit
4acf8b9
·
verified ·
1 Parent(s): 6728a29

Upload folder using huggingface_hub

Browse files
6.0.0-dev.4/multimodaltextbox/Example.svelte ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { onMount } from "svelte";
3
+ import { Image } from "@gradio/image/shared";
4
+ import { Video } from "@gradio/video/shared";
5
+ import type { FileData } from "@gradio/client";
6
+
7
+ export let value: { text: string; files: FileData[] } = {
8
+ text: "",
9
+ files: []
10
+ };
11
+ export let type: "gallery" | "table";
12
+ export let selected = false;
13
+
14
+ let size: number;
15
+ let el: HTMLDivElement;
16
+
17
+ function set_styles(element: HTMLElement, el_width: number): void {
18
+ element.style.setProperty(
19
+ "--local-text-width",
20
+ `${el_width && el_width < 150 ? el_width : 200}px`
21
+ );
22
+ element.style.whiteSpace = "unset";
23
+ }
24
+
25
+ onMount(() => {
26
+ set_styles(el, size);
27
+ });
28
+ </script>
29
+
30
+ <div
31
+ class="container"
32
+ bind:clientWidth={size}
33
+ bind:this={el}
34
+ class:table={type === "table"}
35
+ class:gallery={type === "gallery"}
36
+ class:selected
37
+ class:border={value}
38
+ >
39
+ <p>{value.text ? value.text : ""}</p>
40
+ {#each value.files as file}
41
+ {#if file.mime_type && file.mime_type.includes("image")}
42
+ <Image src={file.url} alt="" />
43
+ {:else if file.mime_type && file.mime_type.includes("video")}
44
+ <Video src={file.url} alt="" loop={true} is_stream={false} />
45
+ {:else if file.mime_type && file.mime_type.includes("audio")}
46
+ <audio src={file.url} controls />
47
+ {:else}
48
+ {file.orig_name}
49
+ {/if}
50
+ {/each}
51
+ </div>
52
+
53
+ <style>
54
+ .gallery {
55
+ padding: var(--size-1) var(--size-2);
56
+ display: flex;
57
+ align-items: center;
58
+ gap: 20px;
59
+ overflow-x: auto;
60
+ }
61
+
62
+ div {
63
+ overflow: hidden;
64
+ min-width: var(--local-text-width);
65
+ white-space: nowrap;
66
+ }
67
+
68
+ .container :global(img),
69
+ .container :global(video) {
70
+ object-fit: contain;
71
+ width: 100px;
72
+ height: 100px;
73
+ }
74
+
75
+ .container.selected {
76
+ border-color: var(--border-color-accent);
77
+ }
78
+ .border.table {
79
+ border: 2px solid var(--border-color-primary);
80
+ }
81
+
82
+ .container.table {
83
+ margin: 0 auto;
84
+ border-radius: var(--radius-lg);
85
+ overflow-x: auto;
86
+ width: max-content;
87
+ height: max-content;
88
+ object-fit: cover;
89
+ padding: var(--size-2);
90
+ }
91
+
92
+ .container.gallery {
93
+ object-fit: cover;
94
+ }
95
+
96
+ div > :global(p) {
97
+ font-size: var(--text-lg);
98
+ white-space: normal;
99
+ }
100
+ </style>
6.0.0-dev.4/multimodaltextbox/Index.svelte ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svelte:options accessors={true} />
2
+
3
+ <script context="module" lang="ts">
4
+ export { default as BaseMultimodalTextbox } from "./shared/MultimodalTextbox.svelte";
5
+ export { default as BaseExample } from "./Example.svelte";
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import { Gradio, type SelectData } from "@gradio/utils";
10
+ import MultimodalTextbox from "./shared/MultimodalTextbox.svelte";
11
+ import { Block } from "@gradio/atoms";
12
+ import { StatusTracker } from "@gradio/statustracker";
13
+ import { onMount, tick } from "svelte";
14
+ import type { WaveformOptions } from "../audio/shared/types";
15
+ import type {
16
+ MultimodalTextboxProps,
17
+ MultimodalTextboxEvents
18
+ } from "./types";
19
+
20
+ let upload_promise = $state<Promise<any>>();
21
+
22
+ class MultimodalTextboxGradio extends Gradio<
23
+ MultimodalTextboxEvents,
24
+ MultimodalTextboxProps
25
+ > {
26
+ async get_data() {
27
+ if (upload_promise) {
28
+ await upload_promise;
29
+ await tick();
30
+ }
31
+ const data = await super.get_data();
32
+
33
+ return data;
34
+ }
35
+ }
36
+
37
+ let props = $props();
38
+ const gradio = new MultimodalTextboxGradio(props);
39
+
40
+ const value = $derived(gradio.props.value || { text: "", files: [] });
41
+
42
+ let dragging: boolean;
43
+ let active_source: "microphone" | null = null;
44
+
45
+ let color_accent = "darkorange";
46
+
47
+ const waveform_settings = {
48
+ height: 50,
49
+ barWidth: 2,
50
+ barGap: 3,
51
+ cursorWidth: 2,
52
+ cursorColor: "#ddd5e9",
53
+ autoplay: false,
54
+ barRadius: 10,
55
+ dragToSeek: true,
56
+ normalize: true,
57
+ minPxPerSec: 20,
58
+ waveColor: "",
59
+ progressColor: "",
60
+ mediaControls: false as boolean | undefined,
61
+ sampleRate: 44100
62
+ };
63
+
64
+ onMount(() => {
65
+ color_accent = getComputedStyle(document?.documentElement).getPropertyValue(
66
+ "--color-accent"
67
+ );
68
+ set_trim_region_colour();
69
+ waveform_settings.waveColor =
70
+ gradio.props?.waveform_options?.waveform_color || "#9ca3af";
71
+ waveform_settings.progressColor =
72
+ gradio.props?.waveform_options?.waveform_progress_color || color_accent;
73
+ waveform_settings.mediaControls =
74
+ gradio.props?.waveform_options?.show_controls;
75
+ waveform_settings.sampleRate =
76
+ gradio.props?.waveform_options?.sample_rate || 44100;
77
+ });
78
+
79
+ const trim_region_settings = {
80
+ color: gradio.props?.waveform_options?.trim_region_color,
81
+ drag: true,
82
+ resize: true
83
+ };
84
+
85
+ function set_trim_region_colour(): void {
86
+ document.documentElement.style.setProperty(
87
+ "--trim-region-color",
88
+ trim_region_settings.color || color_accent
89
+ );
90
+ }
91
+
92
+ // Create const references to the callbacks so that afterUpdate in child is not called on every prop change
93
+ // in the DOM. See https://github.com/gradio-app/gradio/issues/11933
94
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
95
+ const upload_fn = (...args: Parameters<typeof gradio.shared.client.upload>) =>
96
+ gradio.shared.client.upload(...args);
97
+ const i18n = (s: string | null | undefined): string => gradio.i18n(s);
98
+ const stream_handler_fn = (
99
+ ...args: Parameters<typeof gradio.shared.client.stream>
100
+ ): EventSource => gradio.shared.client.stream(...args);
101
+
102
+ let sources_string = $derived(
103
+ gradio.props.sources.join(",") as
104
+ | "upload"
105
+ | "upload,microphone"
106
+ | "microphone"
107
+ | "microphone,upload"
108
+ );
109
+
110
+ let file_types_string = $derived.by(
111
+ () => (gradio.props.file_types || []).join(",") || null
112
+ );
113
+ </script>
114
+
115
+ <Block
116
+ visible={gradio.shared.visible}
117
+ elem_id={gradio.shared.elem_id}
118
+ elem_classes={[...(gradio.shared.elem_classes || []), "multimodal-textbox"]}
119
+ scale={gradio.shared.scale}
120
+ min_width={gradio.shared.min_width}
121
+ allow_overflow={false}
122
+ padding={false}
123
+ border_mode={dragging ? "focus" : "base"}
124
+ >
125
+ {#if gradio.shared.loading_status}
126
+ <StatusTracker
127
+ autoscroll={gradio.shared.autoscroll}
128
+ i18n={gradio.i18n}
129
+ {...gradio.shared.loading_status}
130
+ on:clear_status={() =>
131
+ gradio.dispatch("clear_status", gradio.shared.loading_status)}
132
+ />
133
+ {/if}
134
+
135
+ <MultimodalTextbox
136
+ bind:upload_promise
137
+ {value}
138
+ value_is_output
139
+ bind:dragging
140
+ bind:active_source
141
+ {file_types_string}
142
+ root={gradio.shared.root}
143
+ label={gradio.shared.label || "MultimodalTextbox"}
144
+ info={gradio.props.info}
145
+ show_label={gradio.shared.show_label}
146
+ lines={gradio.props.lines}
147
+ rtl={gradio.props.rtl}
148
+ text_align={gradio.props.text_align}
149
+ waveform_settings={waveform_settings as WaveformOptions}
150
+ {i18n}
151
+ max_lines={!gradio.props.max_lines
152
+ ? gradio.props.lines + 1
153
+ : gradio.props.max_lines}
154
+ placeholder={gradio.props.placeholder}
155
+ submit_btn={gradio.props.submit_btn}
156
+ stop_btn={gradio.props.stop_btn}
157
+ autofocus={gradio.props.autofocus}
158
+ autoscroll={gradio.shared.autoscroll}
159
+ file_count={gradio.props.file_count}
160
+ {sources_string}
161
+ max_file_size={gradio.shared.max_file_size}
162
+ on:change={(e) => (
163
+ (gradio.props.value = e.detail),
164
+ gradio.dispatch("change", gradio.props.value)
165
+ )}
166
+ on:input={() => gradio.dispatch("input")}
167
+ on:submit={() => gradio.dispatch("submit")}
168
+ on:stop={() => gradio.dispatch("stop")}
169
+ on:blur={() => gradio.dispatch("blur")}
170
+ on:select={(e) => gradio.dispatch("select", e.detail)}
171
+ on:focus={() => gradio.dispatch("focus")}
172
+ on:error={({ detail }) => {
173
+ gradio.dispatch("error", detail);
174
+ }}
175
+ on:start_recording={() => gradio.dispatch("start_recording")}
176
+ on:pause_recording={() => gradio.dispatch("pause_recording")}
177
+ on:stop_recording={() => gradio.dispatch("stop_recording")}
178
+ on:upload={(e) => gradio.dispatch("upload", e.detail)}
179
+ on:clear={() => gradio.dispatch("clear")}
180
+ disabled={!gradio.shared.interactive}
181
+ upload={upload_fn}
182
+ stream_handler={stream_handler_fn}
183
+ max_plain_text_length={gradio.props.max_plain_text_length}
184
+ html_attributes={gradio.props.html_attributes}
185
+ />
186
+ </Block>
6.0.0-dev.4/multimodaltextbox/package.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@gradio/multimodaltextbox",
3
+ "version": "0.11.0-dev.1",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "private": false,
9
+ "main_changeset": true,
10
+ "main": "Index.svelte",
11
+ "exports": {
12
+ ".": {
13
+ "gradio": "./Index.svelte",
14
+ "svelte": "./dist/Index.svelte",
15
+ "types": "./dist/Index.svelte.d.ts"
16
+ },
17
+ "./example": {
18
+ "gradio": "./Example.svelte",
19
+ "svelte": "./dist/Example.svelte",
20
+ "types": "./dist/Example.svelte.d.ts"
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
24
+ "dependencies": {
25
+ "@gradio/atoms": "workspace:^",
26
+ "@gradio/icons": "workspace:^",
27
+ "@gradio/statustracker": "workspace:^",
28
+ "@gradio/utils": "workspace:^",
29
+ "@gradio/upload": "workspace:^",
30
+ "@gradio/image": "workspace:^",
31
+ "@gradio/video": "workspace:^",
32
+ "@gradio/client": "workspace:^",
33
+ "@gradio/audio": "workspace:^"
34
+ },
35
+ "devDependencies": {
36
+ "@gradio/preview": "workspace:^"
37
+ },
38
+ "peerDependencies": {
39
+ "svelte": "^5.43.4"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/gradio-app/gradio.git",
44
+ "directory": "js/multimodaltextbox"
45
+ }
46
+ }
6.0.0-dev.4/multimodaltextbox/shared/MultimodalTextbox.svelte ADDED
@@ -0,0 +1,843 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import {
3
+ onMount,
4
+ beforeUpdate,
5
+ afterUpdate,
6
+ createEventDispatcher,
7
+ tick
8
+ } from "svelte";
9
+ import { text_area_resize, resize } from "../shared/utils";
10
+ import { BlockTitle } from "@gradio/atoms";
11
+ import { Upload } from "@gradio/upload";
12
+ import { Image } from "@gradio/image/shared";
13
+ import type { I18nFormatter } from "js/core/src/gradio_helper";
14
+ import type { FileData, Client } from "@gradio/client";
15
+ import type { WaveformOptions } from "@gradio/audio";
16
+ import {
17
+ Clear,
18
+ File,
19
+ Music,
20
+ Paperclip,
21
+ Video,
22
+ ArrowUp,
23
+ Square,
24
+ Microphone
25
+ } from "@gradio/icons";
26
+ import type { SelectData } from "@gradio/utils";
27
+ import { BaseInteractiveAudio as InteractiveAudio } from "@gradio/audio";
28
+ import type { InputHTMLAttributes } from "./types";
29
+
30
+ export let value: { text: string; files: FileData[] } = {
31
+ text: "",
32
+ files: []
33
+ };
34
+
35
+ export let value_is_output = false;
36
+ export let lines = 1;
37
+ export let i18n: I18nFormatter;
38
+ export let placeholder = "Type here...";
39
+ export let disabled = false;
40
+ export let label: string;
41
+ export let info: string | undefined = undefined;
42
+ export let show_label = true;
43
+ export let max_lines: number;
44
+ export let submit_btn: string | boolean | null = null;
45
+ export let stop_btn: string | boolean | null = null;
46
+ export let rtl = false;
47
+ export let autofocus = false;
48
+ export let text_align: "left" | "right" | undefined = undefined;
49
+ export let autoscroll = true;
50
+ export let root: string;
51
+ export let file_types_string: string | null = null;
52
+ export let max_file_size: number | null = null;
53
+ export let upload: Client["upload"];
54
+ export let stream_handler: Client["stream"];
55
+ export let file_count: "single" | "multiple" | "directory" = "multiple";
56
+ export let max_plain_text_length = 1000;
57
+ export let waveform_settings: Record<string, any>;
58
+ export let waveform_options: WaveformOptions = {
59
+ show_recording_waveform: true
60
+ };
61
+ export let sources_string:
62
+ | "upload"
63
+ | "upload,microphone"
64
+ | "microphone"
65
+ | "microphone,upload" = "upload";
66
+ export let active_source: "microphone" | null = null;
67
+ export let html_attributes: InputHTMLAttributes | null = null;
68
+ export let upload_promise: Promise<any> | null = null;
69
+
70
+ let upload_component: Upload;
71
+ let el: HTMLTextAreaElement | HTMLInputElement;
72
+ let can_scroll: boolean;
73
+ let previous_scroll_top = 0;
74
+ let user_has_scrolled_up = false;
75
+ export let dragging = false;
76
+ let uploading = false;
77
+ // value can be null in multimodalchatinterface when loading a deep link
78
+ let oldValue = value?.text ?? "";
79
+ let recording = false;
80
+
81
+ $: sources = sources_string
82
+ .split(",")
83
+ .map((s) => s.trim())
84
+ .filter((s) => s === "upload" || s === "microphone") as (
85
+ | "upload"
86
+ | "microphone"
87
+ )[];
88
+ $: file_types = file_types_string
89
+ ? file_types_string.split(",").map((s) => s.trim())
90
+ : null;
91
+ $: dispatch("drag", dragging);
92
+ $: show_upload =
93
+ sources &&
94
+ sources.includes("upload") &&
95
+ !(file_count === "single" && value.files.length > 0);
96
+ let mic_audio: FileData | null = null;
97
+
98
+ let full_container: HTMLDivElement;
99
+
100
+ $: if (oldValue !== value.text) {
101
+ dispatch("change", value);
102
+ oldValue = value.text;
103
+ }
104
+
105
+ $: if (value === null) value = { text: "", files: [] };
106
+ $: (value, el && lines !== max_lines && resize(el, lines, max_lines));
107
+
108
+ const dispatch = createEventDispatcher<{
109
+ change: typeof value;
110
+ submit: undefined;
111
+ stop: undefined;
112
+ blur: undefined;
113
+ select: SelectData;
114
+ input: undefined;
115
+ focus: undefined;
116
+ drag: boolean;
117
+ upload: FileData[] | FileData;
118
+ clear: undefined;
119
+ load: FileData[] | FileData;
120
+ error: string;
121
+ start_recording: undefined;
122
+ pause_recording: undefined;
123
+ stop_recording: undefined;
124
+ }>();
125
+
126
+ beforeUpdate(() => {
127
+ can_scroll = el && el.offsetHeight + el.scrollTop > el.scrollHeight - 100;
128
+ });
129
+
130
+ const scroll = (): void => {
131
+ if (can_scroll && autoscroll && !user_has_scrolled_up) {
132
+ el.scrollTo(0, el.scrollHeight);
133
+ }
134
+ };
135
+
136
+ async function handle_change(): Promise<void> {
137
+ dispatch("change", value);
138
+ if (!value_is_output) {
139
+ dispatch("input");
140
+ }
141
+ }
142
+
143
+ onMount(() => {
144
+ if (autofocus && el !== null) {
145
+ el.focus();
146
+ }
147
+ });
148
+
149
+ const after_update = (): void => {
150
+ if (can_scroll && autoscroll) {
151
+ scroll();
152
+ }
153
+ if (autofocus && el) {
154
+ el.focus();
155
+ }
156
+ };
157
+
158
+ afterUpdate(after_update);
159
+
160
+ function handle_select(event: Event): void {
161
+ const target: HTMLTextAreaElement | HTMLInputElement = event.target as
162
+ | HTMLTextAreaElement
163
+ | HTMLInputElement;
164
+ const text = target.value;
165
+ const index: [number, number] = [
166
+ target.selectionStart as number,
167
+ target.selectionEnd as number
168
+ ];
169
+ dispatch("select", { value: text.substring(...index), index: index });
170
+ }
171
+
172
+ async function handle_keypress(e: KeyboardEvent): Promise<void> {
173
+ if (e.key === "Enter" && e.shiftKey && lines > 1) {
174
+ e.preventDefault();
175
+ await tick();
176
+ dispatch("submit");
177
+ } else if (
178
+ e.key === "Enter" &&
179
+ !e.shiftKey &&
180
+ lines === 1 &&
181
+ max_lines >= 1
182
+ ) {
183
+ e.preventDefault();
184
+ await tick();
185
+ dispatch("submit");
186
+ active_source = null;
187
+ add_mic_audio_to_files();
188
+ }
189
+ }
190
+
191
+ function handle_scroll(event: Event): void {
192
+ const target = event.target as HTMLElement;
193
+ const current_scroll_top = target.scrollTop;
194
+ if (current_scroll_top < previous_scroll_top) {
195
+ user_has_scrolled_up = true;
196
+ }
197
+ previous_scroll_top = current_scroll_top;
198
+
199
+ const max_scroll_top = target.scrollHeight - target.clientHeight;
200
+ const user_has_scrolled_to_bottom = current_scroll_top >= max_scroll_top;
201
+ if (user_has_scrolled_to_bottom) {
202
+ user_has_scrolled_up = false;
203
+ }
204
+ }
205
+
206
+ async function handle_upload({
207
+ detail
208
+ }: CustomEvent<FileData>): Promise<void> {
209
+ handle_change();
210
+ if (Array.isArray(detail)) {
211
+ for (let file of detail) {
212
+ value.files.push(file);
213
+ }
214
+ value = value;
215
+ } else {
216
+ value.files.push(detail);
217
+ value = value;
218
+ }
219
+ await tick();
220
+ dispatch("change", value);
221
+ dispatch("upload", detail);
222
+ }
223
+
224
+ function remove_thumbnail(event: MouseEvent, index: number): void {
225
+ handle_change();
226
+ event.stopPropagation();
227
+ value.files.splice(index, 1);
228
+ value = value;
229
+ }
230
+
231
+ function handle_upload_click(): void {
232
+ upload_component.open_upload();
233
+ }
234
+
235
+ function handle_stop(): void {
236
+ dispatch("stop");
237
+ }
238
+
239
+ function add_mic_audio_to_files(): void {
240
+ if (mic_audio) {
241
+ value.files.push(mic_audio);
242
+ value = value;
243
+ mic_audio = null;
244
+ }
245
+ }
246
+
247
+ function handle_submit(): void {
248
+ dispatch("submit");
249
+ active_source = null;
250
+ add_mic_audio_to_files();
251
+ }
252
+
253
+ async function handle_paste(event: ClipboardEvent): Promise<void> {
254
+ if (!event.clipboardData) return;
255
+ const items = event.clipboardData.items;
256
+ const text = event.clipboardData.getData("text");
257
+
258
+ if (text && text.length > max_plain_text_length) {
259
+ event.preventDefault();
260
+ const file = new window.File([text], "pasted_text.txt", {
261
+ type: "text/plain",
262
+ lastModified: Date.now()
263
+ });
264
+ if (upload_component) {
265
+ upload_component.load_files([file]);
266
+ }
267
+ return;
268
+ }
269
+
270
+ for (let index in items) {
271
+ const item = items[index];
272
+ if (item.kind === "file" && item.type.includes("image")) {
273
+ const blob = item.getAsFile();
274
+ if (blob) upload_component.load_files([blob]);
275
+ }
276
+ }
277
+ }
278
+
279
+ function handle_dragenter(event: DragEvent): void {
280
+ event.preventDefault();
281
+ dragging = true;
282
+ }
283
+
284
+ function handle_dragleave(event: DragEvent): void {
285
+ event.preventDefault();
286
+ const rect = full_container.getBoundingClientRect();
287
+ const { clientX, clientY } = event;
288
+ if (
289
+ clientX <= rect.left ||
290
+ clientX >= rect.right ||
291
+ clientY <= rect.top ||
292
+ clientY >= rect.bottom
293
+ ) {
294
+ dragging = false;
295
+ }
296
+ }
297
+
298
+ function handle_drop(event: DragEvent): void {
299
+ event.preventDefault();
300
+ dragging = false;
301
+ if (event.dataTransfer && event.dataTransfer.files) {
302
+ const files = Array.from(event.dataTransfer.files);
303
+
304
+ if (file_types) {
305
+ const valid_files = files.filter((file) => {
306
+ return file_types.some((type) => {
307
+ if (type.startsWith(".")) {
308
+ return file.name.toLowerCase().endsWith(type.toLowerCase());
309
+ }
310
+ return file.type.match(new RegExp(type.replace("*", ".*")));
311
+ });
312
+ });
313
+
314
+ const invalid_files = files.length - valid_files.length;
315
+ if (invalid_files > 0) {
316
+ dispatch(
317
+ "error",
318
+ `${invalid_files} file(s) were rejected. Accepted formats: ${file_types.join(", ")}`
319
+ );
320
+ }
321
+
322
+ if (valid_files.length > 0) {
323
+ upload_component.load_files(valid_files);
324
+ }
325
+ } else {
326
+ upload_component.load_files(files);
327
+ }
328
+ }
329
+ }
330
+ </script>
331
+
332
+ <div
333
+ class="full-container"
334
+ class:dragging
335
+ bind:this={full_container}
336
+ on:dragenter={handle_dragenter}
337
+ on:dragleave={handle_dragleave}
338
+ on:dragover|preventDefault
339
+ on:drop={handle_drop}
340
+ role="group"
341
+ aria-label="Multimedia input field"
342
+ >
343
+ <BlockTitle {show_label} {info} {rtl}>{label}</BlockTitle>
344
+ <div class="input-container">
345
+ {#if sources && sources.includes("microphone") && active_source === "microphone"}
346
+ <InteractiveAudio
347
+ on:change={({ detail }) => {
348
+ if (detail !== null) {
349
+ mic_audio = detail;
350
+ }
351
+ }}
352
+ on:clear={() => {
353
+ active_source = null;
354
+ }}
355
+ on:start_recording={() => dispatch("start_recording")}
356
+ on:pause_recording={() => dispatch("pause_recording")}
357
+ on:stop_recording={() => dispatch("stop_recording")}
358
+ sources={["microphone"]}
359
+ class_name="compact-audio"
360
+ {recording}
361
+ {waveform_settings}
362
+ {waveform_options}
363
+ {i18n}
364
+ {active_source}
365
+ {upload}
366
+ {stream_handler}
367
+ stream_every={1}
368
+ editable={true}
369
+ {label}
370
+ {root}
371
+ loop={false}
372
+ show_label={false}
373
+ buttons={[]}
374
+ dragging={false}
375
+ />
376
+ {/if}
377
+ {#if show_upload}
378
+ <Upload
379
+ bind:upload_promise
380
+ bind:this={upload_component}
381
+ on:load={handle_upload}
382
+ {file_count}
383
+ filetype={file_types}
384
+ {root}
385
+ {max_file_size}
386
+ bind:dragging
387
+ bind:uploading
388
+ show_progress={false}
389
+ disable_click={true}
390
+ on:error
391
+ hidden={true}
392
+ {upload}
393
+ {stream_handler}
394
+ />
395
+ {/if}
396
+
397
+ <div
398
+ class="input-wrapper"
399
+ class:has-files={value.files.length > 0 || uploading}
400
+ >
401
+ {#if value.files.length > 0 || uploading || show_upload}
402
+ <div
403
+ class="thumbnails"
404
+ aria-label="Uploaded files"
405
+ data-testid="container_el"
406
+ >
407
+ {#if show_upload}
408
+ <button
409
+ data-testid="upload-button"
410
+ class="upload-button mobile-thumbnail-add"
411
+ {disabled}
412
+ on:click={handle_upload_click}
413
+ aria-label="Upload a file"
414
+ >
415
+ <Paperclip />
416
+ </button>
417
+ {/if}
418
+ {#each value.files as file, index}
419
+ <span
420
+ class="thumbnail-wrapper"
421
+ role="listitem"
422
+ aria-label="File thumbnail"
423
+ >
424
+ <div class="thumbnail-item thumbnail-small">
425
+ {#if file.mime_type && file.mime_type.includes("image")}
426
+ <Image
427
+ src={file.url}
428
+ restProps={{
429
+ title: null,
430
+ alt: "",
431
+ loading: "lazy",
432
+ class: "thumbnail-image"
433
+ }}
434
+ />
435
+ {:else if file.mime_type && file.mime_type.includes("audio")}
436
+ <Music />
437
+ {:else if file.mime_type && file.mime_type.includes("video")}
438
+ <Video />
439
+ {:else}
440
+ <File />
441
+ {/if}
442
+ <button
443
+ class="delete-button"
444
+ on:click={(event) => remove_thumbnail(event, index)}
445
+ aria-label="Remove file"
446
+ >
447
+ <Clear />
448
+ </button>
449
+ </div>
450
+ </span>
451
+ {/each}
452
+ {#if uploading}
453
+ <div class="loader" role="status" aria-label="Uploading"></div>
454
+ {/if}
455
+ </div>
456
+ {/if}
457
+
458
+ <div class="input-row">
459
+ <textarea
460
+ data-testid="textbox"
461
+ use:text_area_resize={{
462
+ text: value.text,
463
+ lines: lines,
464
+ max_lines: max_lines
465
+ }}
466
+ class:no-label={!show_label}
467
+ dir={rtl ? "rtl" : "ltr"}
468
+ bind:value={value.text}
469
+ bind:this={el}
470
+ {placeholder}
471
+ rows={lines}
472
+ {disabled}
473
+ on:keypress={handle_keypress}
474
+ on:blur
475
+ on:select={handle_select}
476
+ on:focus
477
+ on:scroll={handle_scroll}
478
+ on:paste={handle_paste}
479
+ style={text_align ? "text-align: " + text_align : ""}
480
+ autocapitalize={html_attributes?.autocapitalize}
481
+ autocorrect={html_attributes?.autocorrect}
482
+ spellcheck={html_attributes?.spellcheck}
483
+ autocomplete={html_attributes?.autocomplete}
484
+ tabindex={html_attributes?.tabindex}
485
+ enterkeyhint={html_attributes?.enterkeyhint}
486
+ lang={html_attributes?.lang}
487
+ />
488
+
489
+ {#if sources && sources.includes("microphone")}
490
+ <button
491
+ data-testid="microphone-button"
492
+ class="microphone-button"
493
+ class:recording
494
+ {disabled}
495
+ on:click={() => {
496
+ active_source =
497
+ active_source !== "microphone" ? "microphone" : null;
498
+ }}
499
+ aria-label="Record audio"
500
+ >
501
+ <Microphone />
502
+ </button>
503
+ {/if}
504
+
505
+ {#if submit_btn}
506
+ <button
507
+ class="submit-button"
508
+ class:padded-button={submit_btn !== true}
509
+ {disabled}
510
+ on:click={handle_submit}
511
+ aria-label="Submit"
512
+ >
513
+ {#if submit_btn === true}
514
+ <ArrowUp />
515
+ {:else}
516
+ {submit_btn}
517
+ {/if}
518
+ </button>
519
+ {/if}
520
+ {#if stop_btn}
521
+ <button
522
+ class="stop-button"
523
+ class:padded-button={stop_btn !== true}
524
+ on:click={handle_stop}
525
+ aria-label="Stop"
526
+ >
527
+ {#if stop_btn === true}
528
+ <Square fill={"none"} stroke_width={2.5} />
529
+ {:else}
530
+ {stop_btn}
531
+ {/if}
532
+ </button>
533
+ {/if}
534
+ </div>
535
+ </div>
536
+ </div>
537
+ </div>
538
+
539
+ <style>
540
+ .full-container {
541
+ width: 100%;
542
+ position: relative;
543
+ padding: var(--block-padding);
544
+ border: 1px solid transparent;
545
+ }
546
+
547
+ .full-container.dragging {
548
+ border-color: var(--color-accent);
549
+ border-radius: calc(var(--radius-sm) - var(--size-px));
550
+ }
551
+
552
+ .full-container.dragging::after {
553
+ content: "";
554
+ position: absolute;
555
+ inset: 0;
556
+ pointer-events: none;
557
+ }
558
+
559
+ .input-container {
560
+ display: flex;
561
+ position: relative;
562
+ flex-direction: column;
563
+ gap: 0;
564
+ }
565
+
566
+ .input-wrapper {
567
+ display: flex;
568
+ position: relative;
569
+ flex-direction: column;
570
+ gap: 0;
571
+ background: var(--block-background-fill);
572
+ border-radius: var(--radius-xl);
573
+ padding: var(--spacing-sm);
574
+ align-items: flex-start;
575
+ min-height: auto;
576
+ }
577
+
578
+ .input-wrapper.has-files {
579
+ padding-top: var(--spacing-xs);
580
+ }
581
+
582
+ .input-row {
583
+ display: flex;
584
+ align-items: flex-end;
585
+ gap: var(--spacing-sm);
586
+ width: 100%;
587
+ }
588
+
589
+ .thumbnails {
590
+ display: flex;
591
+ align-items: center;
592
+ gap: var(--spacing-sm);
593
+ padding: var(--spacing-xs) 0;
594
+ margin-bottom: var(--spacing-xs);
595
+ overflow-x: auto;
596
+ overflow-y: hidden;
597
+ scrollbar-width: none;
598
+ -ms-overflow-style: none;
599
+ flex-wrap: nowrap;
600
+ -webkit-overflow-scrolling: touch;
601
+ scroll-behavior: smooth;
602
+ overflow-y: scroll;
603
+ width: 100%;
604
+ }
605
+
606
+ .thumbnails::-webkit-scrollbar,
607
+ .thumbnails::-webkit-scrollbar-track,
608
+ .thumbnails::-webkit-scrollbar-thumb {
609
+ display: none;
610
+ }
611
+
612
+ .thumbnails :global(img) {
613
+ width: var(--size-full);
614
+ height: var(--size-full);
615
+ object-fit: cover;
616
+ border-radius: var(--radius-md);
617
+ }
618
+
619
+ .thumbnail-wrapper {
620
+ position: relative;
621
+ flex-shrink: 0;
622
+ }
623
+
624
+ .thumbnail-item {
625
+ position: relative;
626
+ display: flex;
627
+ justify-content: center;
628
+ align-items: center;
629
+ border: var(--size-px) solid var(--border-color-primary);
630
+ border-radius: var(--radius-md);
631
+ background: var(--background-fill-secondary);
632
+ width: var(--size-full);
633
+ height: var(--size-full);
634
+ cursor: default;
635
+ padding: 0;
636
+ }
637
+
638
+ .thumbnail-small {
639
+ width: var(--size-10);
640
+ height: var(--size-10);
641
+ }
642
+
643
+ .thumbnail-item :global(svg) {
644
+ width: var(--size-5);
645
+ height: var(--size-5);
646
+ }
647
+
648
+ .delete-button {
649
+ position: absolute;
650
+ inset: 0;
651
+ display: flex;
652
+ justify-content: center;
653
+ align-items: center;
654
+ color: var(--button-primary-text-color);
655
+ background: rgba(0, 0, 0, 0.6);
656
+ backdrop-filter: var(--blur-xs);
657
+ border-radius: var(--radius-md);
658
+ padding: 0;
659
+ z-index: var(--layer-1);
660
+ opacity: 0;
661
+ transition: opacity 0.1s var(--easing-standard);
662
+ }
663
+
664
+ .delete-button:hover {
665
+ background: rgba(0, 0, 0, 0.8);
666
+ }
667
+
668
+ .delete-button :global(svg) {
669
+ width: var(--size-5);
670
+ height: var(--size-5);
671
+ }
672
+
673
+ .thumbnail-item:hover .delete-button {
674
+ opacity: 1;
675
+ }
676
+
677
+ textarea {
678
+ flex-grow: 1;
679
+ outline: none !important;
680
+ background: transparent;
681
+ padding: 0;
682
+ color: var(--body-text-color);
683
+ font-weight: var(--input-text-weight);
684
+ font-size: var(--input-text-size);
685
+ border: none;
686
+ margin: 0;
687
+ resize: none;
688
+ position: relative;
689
+ z-index: var(--layer-1);
690
+ text-align: left;
691
+ min-height: var(--size-9);
692
+ }
693
+
694
+ textarea:disabled {
695
+ -webkit-opacity: 1;
696
+ opacity: 1;
697
+ }
698
+
699
+ textarea::placeholder {
700
+ color: var(--input-placeholder-color);
701
+ }
702
+
703
+ textarea[dir="rtl"] {
704
+ text-align: right;
705
+ }
706
+
707
+ textarea[dir="rtl"] ~ .submit-button {
708
+ order: -1;
709
+ }
710
+
711
+ textarea[dir="rtl"] ~ .submit-button :global(svg) {
712
+ transform: scaleX(-1);
713
+ }
714
+
715
+ .mobile-thumbnail-add,
716
+ .microphone-button {
717
+ color: var(--body-text-color);
718
+ cursor: pointer;
719
+ padding: var(--spacing-sm);
720
+ display: flex;
721
+ justify-content: center;
722
+ align-items: center;
723
+ flex-shrink: 0;
724
+ border-radius: var(--radius-md);
725
+ transition:
726
+ background 0.2s var(--easing-standard),
727
+ border-color 0.2s var(--easing-standard);
728
+ }
729
+
730
+ .mobile-thumbnail-add {
731
+ width: var(--size-10);
732
+ height: var(--size-10);
733
+ }
734
+
735
+ .microphone-button {
736
+ width: var(--size-9);
737
+ height: var(--size-9);
738
+ }
739
+
740
+ .mobile-thumbnail-add:hover:not(:disabled),
741
+ .microphone-button:hover:not(:disabled) {
742
+ background: var(--button-secondary-background-fill-hover);
743
+ border-color: var(--border-color-primary);
744
+ }
745
+
746
+ .mobile-thumbnail-add:disabled,
747
+ .microphone-button:disabled {
748
+ opacity: 0.5;
749
+ cursor: not-allowed;
750
+ }
751
+
752
+ .mobile-thumbnail-add :global(svg),
753
+ .microphone-button :global(svg) {
754
+ width: var(--size-5);
755
+ height: var(--size-5);
756
+ }
757
+
758
+ .submit-button,
759
+ .stop-button {
760
+ border: var(--size-px) solid var(--border-color-primary);
761
+ background: var(--button-secondary-background-fill);
762
+ cursor: pointer;
763
+ display: flex;
764
+ justify-content: center;
765
+ align-items: center;
766
+ flex-shrink: 0;
767
+ width: var(--size-9);
768
+ height: var(--size-9);
769
+ border-radius: var(--radius-md);
770
+ z-index: var(--layer-1);
771
+ transition:
772
+ background 0.2s var(--easing-standard),
773
+ border-color 0.2s var(--easing-standard);
774
+ }
775
+
776
+ .submit-button:hover:not(:disabled),
777
+ .stop-button:hover:not(:disabled) {
778
+ background: var(--button-secondary-background-fill-hover);
779
+ }
780
+
781
+ .submit-button:active:not(:disabled),
782
+ .stop-button:active:not(:disabled) {
783
+ box-shadow: var(--button-shadow-active);
784
+ }
785
+
786
+ .submit-button:disabled,
787
+ .stop-button:disabled {
788
+ cursor: not-allowed;
789
+ }
790
+
791
+ .submit-button :global(svg),
792
+ .stop-button :global(svg) {
793
+ width: var(--size-5);
794
+ height: var(--size-5);
795
+ }
796
+
797
+ .padded-button {
798
+ padding: 0 var(--spacing-lg);
799
+ width: auto;
800
+ border-radius: var(--radius-xl);
801
+ }
802
+
803
+ .loader {
804
+ display: flex;
805
+ justify-content: center;
806
+ align-items: center;
807
+ position: relative;
808
+ border: var(--size-1) solid var(--border-color-primary);
809
+ border-top-color: var(--color-accent);
810
+ border-radius: var(--radius-100);
811
+ width: var(--size-5);
812
+ height: var(--size-5);
813
+ animation: spin 1s linear infinite;
814
+ flex-shrink: 0;
815
+ }
816
+
817
+ @keyframes spin {
818
+ to {
819
+ transform: rotate(360deg);
820
+ }
821
+ }
822
+
823
+ @media (max-width: 768px) {
824
+ .input-wrapper {
825
+ padding: var(--spacing-xs);
826
+ }
827
+
828
+ .thumbnails {
829
+ padding: var(--spacing-xs) 0;
830
+ margin-bottom: var(--spacing-md);
831
+ }
832
+
833
+ .thumbnail-small,
834
+ .mobile-thumbnail-add {
835
+ width: var(--size-9);
836
+ height: var(--size-9);
837
+ }
838
+
839
+ .thumbnail-item:active .delete-button {
840
+ opacity: 1;
841
+ }
842
+ }
843
+ </style>
6.0.0-dev.4/multimodaltextbox/shared/types.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export type { InputHTMLAttributes } from "../../textbox/shared/types";
6.0.0-dev.4/multimodaltextbox/shared/utils.ts ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { tick } from "svelte";
2
+
3
+ interface Value {
4
+ lines: number;
5
+ max_lines: number;
6
+ text: string;
7
+ }
8
+
9
+ export async function resize(
10
+ target: HTMLTextAreaElement | HTMLInputElement,
11
+ lines: number,
12
+ max_lines: number
13
+ ): Promise<void> {
14
+ await tick();
15
+ if (lines === max_lines) return;
16
+
17
+ const computed_styles = window.getComputedStyle(target);
18
+ const padding_top = parseFloat(computed_styles.paddingTop);
19
+ const padding_bottom = parseFloat(computed_styles.paddingBottom);
20
+ const line_height = parseFloat(computed_styles.lineHeight);
21
+
22
+ let max =
23
+ max_lines === undefined
24
+ ? false
25
+ : padding_top + padding_bottom + line_height * max_lines;
26
+ let min = padding_top + padding_bottom + lines * line_height;
27
+
28
+ target.style.height = "1px";
29
+
30
+ let scroll_height;
31
+ if (max && target.scrollHeight > max) {
32
+ scroll_height = max;
33
+ } else if (target.scrollHeight < min) {
34
+ scroll_height = min;
35
+ } else {
36
+ scroll_height = target.scrollHeight;
37
+ }
38
+
39
+ target.style.height = `${scroll_height}px`;
40
+ }
41
+
42
+ export function text_area_resize(
43
+ _el: HTMLTextAreaElement,
44
+ _value: Value
45
+ ): any | undefined {
46
+ if (_value.lines === _value.max_lines) return;
47
+ _el.style.overflowY = "scroll";
48
+
49
+ function handle_input(event: Event): void {
50
+ resize(event.target as HTMLTextAreaElement, _value.lines, _value.max_lines);
51
+ }
52
+ _el.addEventListener("input", handle_input);
53
+
54
+ if (!_value.text.trim()) return;
55
+ resize(_el, _value.lines, _value.max_lines);
56
+
57
+ return {
58
+ destroy: () => _el.removeEventListener("input", handle_input)
59
+ };
60
+ }
6.0.0-dev.4/multimodaltextbox/types.ts ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { FileData } from "@gradio/client";
2
+ import type { SelectData } from "@gradio/utils";
3
+ import type { LoadingStatus } from "@gradio/statustracker";
4
+ import type { InputHTMLAttributes } from "./shared/types";
5
+ import type { WaveformOptions } from "js/audio/shared/types";
6
+
7
+ export interface MultimodalTextboxEvents {
8
+ change: { text: string; files: FileData[] };
9
+ submit: never;
10
+ stop: never;
11
+ blur: never;
12
+ select: SelectData;
13
+ input: never;
14
+ focus: never;
15
+ error: string;
16
+ clear_status: LoadingStatus;
17
+ start_recording: never;
18
+ pause_recording: never;
19
+ stop_recording: never;
20
+ upload: FileData[] | FileData;
21
+ clear: undefined;
22
+ }
23
+
24
+ export interface MultimodalTextboxProps {
25
+ value: { text: string; files: FileData[] };
26
+ file_types: string[] | null;
27
+ lines: number;
28
+ placeholder: string;
29
+ info: string | undefined;
30
+ max_lines: number;
31
+ submit_btn: string | boolean | null;
32
+ stop_btn: string | boolean | null;
33
+ value_is_output: boolean;
34
+ rtl: boolean;
35
+ text_align: "left" | "right" | undefined;
36
+ autofocus: boolean;
37
+ file_count: "single" | "multiple" | "directory";
38
+ max_plain_text_length: number;
39
+ sources: ("microphone" | "upload")[];
40
+ waveform_options: WaveformOptions;
41
+ html_attributes: InputHTMLAttributes | null;
42
+ }