|
7 | 7 | import type { |
8 | 8 | ComponentMeta, |
9 | 9 | Dependency as IDependency, |
10 | | - LayoutNode |
| 10 | + LayoutNode, |
11 | 11 | } from "./types"; |
12 | 12 | import type { ThemeMode, Payload } from "./types"; |
13 | 13 | import { Toast } from "@gradio/statustracker"; |
|
58 | 58 | render_complete = false, |
59 | 59 | ready = $bindable(false), |
60 | 60 | reload_count = $bindable(0), |
61 | | - add_new_message = $bindable() |
| 61 | + add_new_message = $bindable(), |
62 | 62 | }: { |
63 | 63 | root: string; |
64 | 64 | components: ComponentMeta[]; |
|
101 | 101 | function gradio_event_dispatcher( |
102 | 102 | id: number, |
103 | 103 | event: string, |
104 | | - data: unknown |
| 104 | + data: unknown, |
105 | 105 | ): void { |
106 | 106 | if (event === "share") { |
107 | 107 | const { title, description } = data as ShareData; |
|
123 | 123 | app_tree.update_state( |
124 | 124 | id, |
125 | 125 | { |
126 | | - loading_status: {} |
| 126 | + loading_status: {}, |
127 | 127 | }, |
128 | | - false |
| 128 | + false, |
129 | 129 | ); |
130 | 130 | dep_manager.clear_loading_status(id); |
131 | 131 | // TODO: the loading_status store should handle this via a method |
|
148 | 148 | type: "event", |
149 | 149 | event_name: event, |
150 | 150 | target_id: id, |
151 | | - event_data: data |
| 151 | + event_data: data, |
152 | 152 | }); |
153 | 153 | } |
154 | 154 | } |
|
164 | 164 | api_prefix, |
165 | 165 | max_file_size, |
166 | 166 | autoscroll, |
167 | | - fill_height |
| 167 | + fill_height, |
168 | 168 | }, |
169 | 169 | app, |
170 | 170 | $reactive_formatter, |
171 | | - gradio_event_dispatcher |
| 171 | + gradio_event_dispatcher, |
172 | 172 | ); |
173 | 173 |
|
174 | 174 | function dispatch_to_target( |
175 | 175 | target_id: number, |
176 | 176 | event: string, |
177 | | - data: unknown |
| 177 | + data: unknown, |
178 | 178 | ): void { |
179 | 179 | dep_manager.dispatch({ |
180 | 180 | type: "event", |
181 | 181 | event_name: event, |
182 | 182 | target_id: target_id, |
183 | | - event_data: data |
| 183 | + event_data: data, |
184 | 184 | }); |
185 | 185 | } |
186 | 186 |
|
|
206 | 206 | type: "error", |
207 | 207 | id: _error_id, |
208 | 208 | duration: null, |
209 | | - visible: true |
| 209 | + visible: true, |
210 | 210 | }); |
211 | 211 |
|
212 | 212 | reconnect_interval = setInterval(async () => { |
|
232 | 232 | app_tree.rerender.bind(app_tree), |
233 | 233 | new_message, |
234 | 234 | add_to_api_calls, |
235 | | - handle_connection_lost |
| 235 | + handle_connection_lost, |
236 | 236 | ); |
237 | 237 |
|
238 | 238 | $effect(() => { |
|
245 | 245 | api_prefix, |
246 | 246 | max_file_size, |
247 | 247 | autoscroll, |
248 | | - fill_height |
| 248 | + fill_height, |
249 | 249 | }); |
250 | 250 | dep_manager.reload( |
251 | 251 | dependencies, |
252 | 252 | app_tree.update_state.bind(app_tree), |
253 | 253 | app_tree.get_state.bind(app_tree), |
254 | 254 | app_tree.rerender.bind(app_tree), |
255 | | - app |
| 255 | + app, |
256 | 256 | ); |
257 | 257 | }); |
258 | 258 | }); |
|
261 | 261 |
|
262 | 262 | // export let |
263 | 263 | let api_docs_visible = $derived( |
264 | | - search_params.get("view") === "api" && footer_links.includes("api") |
| 264 | + search_params.get("view") === "api" && footer_links.includes("api"), |
265 | 265 | ); |
266 | 266 | let settings_visible = $derived(search_params.get("view") === "settings"); |
267 | 267 | let api_recorder_visible = $derived( |
268 | | - search_params.get("view") === "api-recorder" && footer_links.includes("api") |
| 268 | + search_params.get("view") === "api-recorder" && |
| 269 | + footer_links.includes("api"), |
269 | 270 | ); |
270 | 271 | let allow_zoom = true; |
271 | 272 | let allow_video_trim = true; |
|
344 | 345 | fn_index: number, |
345 | 346 | type: ToastMessage["type"], |
346 | 347 | duration: number | null = 10, |
347 | | - visible = false |
| 348 | + visible = false, |
348 | 349 | ): void { |
349 | 350 | if (!visible) return; |
350 | 351 | messages.push({ |
|
354 | 355 | type, |
355 | 356 | id: ++_error_id, |
356 | 357 | duration, |
357 | | - visible |
| 358 | + visible, |
358 | 359 | }); |
359 | 360 | } |
360 | 361 |
|
|
366 | 367 |
|
367 | 368 | const DUPLICATE_MESSAGE = $reactive_formatter("blocks.long_requests_queue"); |
368 | 369 | const MOBILE_QUEUE_WARNING = $reactive_formatter( |
369 | | - "blocks.connection_can_break" |
| 370 | + "blocks.connection_can_break", |
370 | 371 | ); |
371 | 372 | const LOST_CONNECTION_MESSAGE = |
372 | 373 | "Connection to the server was lost. Attempting reconnection..."; |
|
376 | 377 | const SESSION_NOT_FOUND_MESSAGE = |
377 | 378 | "Session not found - this is likely because the machine you were connected to has changed. <a href=''>Refresh the page</a> to continue."; |
378 | 379 | const WAITING_FOR_INPUTS_MESSAGE = $reactive_formatter( |
379 | | - "blocks.waiting_for_inputs" |
| 380 | + "blocks.waiting_for_inputs", |
380 | 381 | ); |
381 | 382 | const SHOW_DUPLICATE_MESSAGE_ON_ETA = 15; |
382 | 383 | const SHOW_MOBILE_QUEUE_WARNING_ON_ETA = 10; |
|
417 | 418 | onMount(() => { |
418 | 419 | is_mobile_device = |
419 | 420 | /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( |
420 | | - navigator.userAgent |
| 421 | + navigator.userAgent, |
421 | 422 | ); |
422 | 423 |
|
423 | 424 | if ("parentIFrame" in window) { |
|
430 | 431 | mut.observe(root_container, { |
431 | 432 | childList: true, |
432 | 433 | subtree: true, |
433 | | - attributes: true |
| 434 | + attributes: true, |
434 | 435 | }); |
435 | 436 | res.observe(root_container); |
436 | 437 |
|
|
464 | 465 | {/if} |
465 | 466 | </svelte:head> |
466 | 467 |
|
467 | | -<div class="wrap" style:min-height={app_mode ? "100%" : "auto"}> |
| 468 | +<div |
| 469 | + class="wrap" |
| 470 | + style:min-height={app_mode && !fill_height ? "100%" : "auto"} |
| 471 | + style:height={app_mode && fill_height ? "100%" : "auto"} |
| 472 | +> |
468 | 473 | <main |
469 | 474 | class="contain" |
470 | 475 | style:flex-grow={app_mode ? "1" : "auto"} |
|
0 commit comments