@gradio/core 0.17.0 → 0.18.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 +34 -0
- package/dist/src/Blocks.svelte +74 -4
- package/dist/src/api_docs/ApiDocs.svelte +17 -17
- package/dist/src/api_docs/Settings.svelte +74 -1
- package/dist/src/api_docs/Settings.svelte.d.ts +3 -0
- package/dist/src/api_docs/img/record-stop.svg +1 -0
- package/dist/src/api_docs/img/record.svg +1 -0
- package/dist/src/init.js +7 -3
- package/dist/src/lang/en.json +4 -0
- package/dist/src/screen_recorder.d.ts +16 -0
- package/dist/src/screen_recorder.js +255 -0
- package/package.json +46 -46
- package/src/Blocks.svelte +85 -6
- package/src/api_docs/ApiDocs.svelte +18 -17
- package/src/api_docs/Settings.svelte +77 -1
- package/src/api_docs/img/record-stop.svg +1 -0
- package/src/api_docs/img/record.svg +1 -0
- package/src/init.ts +7 -6
- package/src/lang/en.json +4 -0
- package/src/screen_recorder.ts +361 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @gradio/core
|
|
2
2
|
|
|
3
|
+
## 0.18.1
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- [#11289](https://github.com/gradio-app/gradio/pull/11289) [`1b6bd1e`](https://github.com/gradio-app/gradio/commit/1b6bd1ee5a96541e88b5834784b9acd6bd344187) - Include default values in MCP docs. Thanks @abidlabs!
|
|
8
|
+
|
|
9
|
+
### Fixes
|
|
10
|
+
|
|
11
|
+
- [#11271](https://github.com/gradio-app/gradio/pull/11271) [`ab25fb9`](https://github.com/gradio-app/gradio/commit/ab25fb9adb4e0401a060cdd07c0985483075123c) - Ensure i18n setup is complete when rendering. Thanks @hannahblair!
|
|
12
|
+
|
|
13
|
+
### Dependency updates
|
|
14
|
+
|
|
15
|
+
- @gradio/statustracker@0.10.12
|
|
16
|
+
- @gradio/column@0.2.0
|
|
17
|
+
- @gradio/code@0.14.5
|
|
18
|
+
- @gradio/paramviewer@0.7.10
|
|
19
|
+
- @gradio/client@1.15.1
|
|
20
|
+
- @gradio/button@0.5.1
|
|
21
|
+
- @gradio/upload@0.16.6
|
|
22
|
+
- @gradio/image@0.22.7
|
|
23
|
+
- @gradio/gallery@0.15.20
|
|
24
|
+
- @gradio/plot@0.9.17
|
|
25
|
+
- @gradio/checkbox@0.4.22
|
|
26
|
+
- @gradio/file@0.12.19
|
|
27
|
+
- @gradio/video@0.14.15
|
|
28
|
+
- @gradio/textbox@0.10.12
|
|
29
|
+
|
|
30
|
+
## 0.18.0
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
- [#11224](https://github.com/gradio-app/gradio/pull/11224) [`834e92c`](https://github.com/gradio-app/gradio/commit/834e92c187f200665c78c344f0b38f5adede807b) - Fix re-rendering with key when setting a value to None. Thanks @aliabid94!
|
|
35
|
+
- [#10832](https://github.com/gradio-app/gradio/pull/10832) [`d457438`](https://github.com/gradio-app/gradio/commit/d4574381bdd12709183c3affe740fada82b8baea) - Screen recording. Thanks @dawoodkhan82!
|
|
36
|
+
|
|
3
37
|
## 0.17.0
|
|
4
38
|
|
|
5
39
|
### Features
|
package/dist/src/Blocks.svelte
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { tick, onMount } from "svelte";
|
|
2
2
|
import { _ } from "svelte-i18n";
|
|
3
3
|
import { Client } from "@gradio/client";
|
|
4
|
+
import { writable } from "svelte/store";
|
|
4
5
|
import { setupi18n } from "./i18n";
|
|
5
6
|
import { ApiDocs, ApiRecorder, Settings } from "./api_docs/";
|
|
6
7
|
import { Toast } from "@gradio/statustracker";
|
|
@@ -9,7 +10,9 @@ import { prefix_css } from "./css";
|
|
|
9
10
|
import logo from "./images/logo.svg";
|
|
10
11
|
import api_logo from "./api_docs/img/api-logo.svg";
|
|
11
12
|
import settings_logo from "./api_docs/img/settings-logo.svg";
|
|
13
|
+
import record_stop from "./api_docs/img/record-stop.svg";
|
|
12
14
|
import { create_components, AsyncFunction } from "./init";
|
|
15
|
+
import * as screen_recorder from "./screen_recorder";
|
|
13
16
|
export let root;
|
|
14
17
|
export let components;
|
|
15
18
|
export let layout;
|
|
@@ -33,7 +36,6 @@ export let api_prefix = "";
|
|
|
33
36
|
export let max_file_size = void 0;
|
|
34
37
|
export let initial_layout = void 0;
|
|
35
38
|
export let css = null;
|
|
36
|
-
setupi18n(app.config?.i18n_translations ?? void 0);
|
|
37
39
|
let {
|
|
38
40
|
layout: _layout,
|
|
39
41
|
targets,
|
|
@@ -74,6 +76,8 @@ export let search_params;
|
|
|
74
76
|
let api_docs_visible = search_params.get("view") === "api" && show_api;
|
|
75
77
|
let settings_visible = search_params.get("view") === "settings";
|
|
76
78
|
let api_recorder_visible = search_params.get("view") === "api-recorder" && show_api;
|
|
79
|
+
let allow_zoom = true;
|
|
80
|
+
let allow_video_trim = true;
|
|
77
81
|
function set_api_docs_visible(visible) {
|
|
78
82
|
api_recorder_visible = false;
|
|
79
83
|
api_docs_visible = visible;
|
|
@@ -99,6 +103,17 @@ let api_calls = [];
|
|
|
99
103
|
export let render_complete = false;
|
|
100
104
|
async function handle_update(data, fn_index) {
|
|
101
105
|
const dep = dependencies.find((dep2) => dep2.id === fn_index);
|
|
106
|
+
const input_type = components.find(
|
|
107
|
+
(comp) => comp.id === dep?.inputs[0]
|
|
108
|
+
)?.type;
|
|
109
|
+
if (allow_zoom && dep && input_type !== "dataset") {
|
|
110
|
+
if (dep && dep.inputs && dep.inputs.length > 0 && $is_screen_recording) {
|
|
111
|
+
screen_recorder.zoom(true, dep.inputs, 1);
|
|
112
|
+
}
|
|
113
|
+
if (dep && dep.outputs && dep.outputs.length > 0 && $is_screen_recording) {
|
|
114
|
+
screen_recorder.zoom(false, dep.outputs, 2);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
102
117
|
if (!dep) {
|
|
103
118
|
return;
|
|
104
119
|
}
|
|
@@ -285,6 +300,9 @@ async function trigger_api_call(dep_index, trigger_id = null, event_data = null)
|
|
|
285
300
|
}
|
|
286
301
|
}
|
|
287
302
|
async function make_prediction(payload2, streaming = false) {
|
|
303
|
+
if (allow_video_trim) {
|
|
304
|
+
screen_recorder.markRemoveSegmentStart();
|
|
305
|
+
}
|
|
288
306
|
if (api_recorder_visible) {
|
|
289
307
|
api_calls = [...api_calls, JSON.parse(JSON.stringify(payload2))];
|
|
290
308
|
}
|
|
@@ -472,6 +490,9 @@ async function trigger_api_call(dep_index, trigger_id = null, event_data = null)
|
|
|
472
490
|
});
|
|
473
491
|
}
|
|
474
492
|
}
|
|
493
|
+
if (allow_video_trim) {
|
|
494
|
+
screen_recorder.markRemoveSegmentEnd();
|
|
495
|
+
}
|
|
475
496
|
}
|
|
476
497
|
}
|
|
477
498
|
function trigger_share(title2, description) {
|
|
@@ -612,6 +633,7 @@ function set_status(statuses) {
|
|
|
612
633
|
function isCustomEvent(event) {
|
|
613
634
|
return "detail" in event;
|
|
614
635
|
}
|
|
636
|
+
let is_screen_recording = writable(false);
|
|
615
637
|
onMount(() => {
|
|
616
638
|
document.addEventListener("visibilitychange", function() {
|
|
617
639
|
if (document.visibilityState === "hidden") {
|
|
@@ -621,6 +643,26 @@ onMount(() => {
|
|
|
621
643
|
is_mobile_device = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
622
644
|
navigator.userAgent
|
|
623
645
|
);
|
|
646
|
+
screen_recorder.initialize(
|
|
647
|
+
root,
|
|
648
|
+
(title2, message, type) => {
|
|
649
|
+
add_new_message(title2, message, type);
|
|
650
|
+
},
|
|
651
|
+
(isRecording) => {
|
|
652
|
+
$is_screen_recording = isRecording;
|
|
653
|
+
}
|
|
654
|
+
);
|
|
655
|
+
});
|
|
656
|
+
function screen_recording() {
|
|
657
|
+
if ($is_screen_recording) {
|
|
658
|
+
screen_recorder.stopRecording();
|
|
659
|
+
} else {
|
|
660
|
+
screen_recorder.startRecording();
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
let i18n_ready = false;
|
|
664
|
+
setupi18n(app.config?.i18n_translations ?? void 0).then(() => {
|
|
665
|
+
i18n_ready = true;
|
|
624
666
|
});
|
|
625
667
|
</script>
|
|
626
668
|
|
|
@@ -635,7 +677,7 @@ onMount(() => {
|
|
|
635
677
|
|
|
636
678
|
<div class="wrap" style:min-height={app_mode ? "100%" : "auto"}>
|
|
637
679
|
<div class="contain" style:flex-grow={app_mode ? "1" : "auto"}>
|
|
638
|
-
{#if $_layout && app.config}
|
|
680
|
+
{#if $_layout && app.config && i18n_ready}
|
|
639
681
|
<MountComponents
|
|
640
682
|
rootNode={$_layout}
|
|
641
683
|
{root}
|
|
@@ -677,6 +719,17 @@ onMount(() => {
|
|
|
677
719
|
{$_("common.built_with_gradio")}
|
|
678
720
|
<img src={logo} alt={$_("common.logo")} />
|
|
679
721
|
</a>
|
|
722
|
+
<div class="divider" class:hidden={!$is_screen_recording}>·</div>
|
|
723
|
+
<button
|
|
724
|
+
class:hidden={!$is_screen_recording}
|
|
725
|
+
on:click={() => {
|
|
726
|
+
screen_recording();
|
|
727
|
+
}}
|
|
728
|
+
class="record"
|
|
729
|
+
>
|
|
730
|
+
{$_("common.stop_recording")}
|
|
731
|
+
<img src={record_stop} alt={$_("common.stop_recording")} />
|
|
732
|
+
</button>
|
|
680
733
|
<div class="divider">·</div>
|
|
681
734
|
<button
|
|
682
735
|
on:click={() => {
|
|
@@ -749,9 +802,14 @@ onMount(() => {
|
|
|
749
802
|
/>
|
|
750
803
|
<div class="api-docs-wrap">
|
|
751
804
|
<Settings
|
|
805
|
+
bind:allow_zoom
|
|
806
|
+
bind:allow_video_trim
|
|
752
807
|
on:close={(event) => {
|
|
753
808
|
set_settings_visible(false);
|
|
754
809
|
}}
|
|
810
|
+
on:start_recording={(event) => {
|
|
811
|
+
screen_recording();
|
|
812
|
+
}}
|
|
755
813
|
pwa_enabled={app.config.pwa}
|
|
756
814
|
{root}
|
|
757
815
|
{space_id}
|
|
@@ -791,7 +849,8 @@ onMount(() => {
|
|
|
791
849
|
}
|
|
792
850
|
|
|
793
851
|
.show-api,
|
|
794
|
-
.settings
|
|
852
|
+
.settings,
|
|
853
|
+
.record {
|
|
795
854
|
display: flex;
|
|
796
855
|
align-items: center;
|
|
797
856
|
}
|
|
@@ -811,13 +870,20 @@ onMount(() => {
|
|
|
811
870
|
width: var(--size-4);
|
|
812
871
|
}
|
|
813
872
|
|
|
873
|
+
.record img {
|
|
874
|
+
margin-right: var(--size-1);
|
|
875
|
+
margin-left: var(--size-1);
|
|
876
|
+
width: var(--size-3);
|
|
877
|
+
}
|
|
878
|
+
|
|
814
879
|
.built-with {
|
|
815
880
|
display: flex;
|
|
816
881
|
align-items: center;
|
|
817
882
|
}
|
|
818
883
|
|
|
819
884
|
.built-with:hover,
|
|
820
|
-
.settings:hover
|
|
885
|
+
.settings:hover,
|
|
886
|
+
.record:hover {
|
|
821
887
|
color: var(--body-text-color);
|
|
822
888
|
}
|
|
823
889
|
|
|
@@ -888,4 +954,8 @@ onMount(() => {
|
|
|
888
954
|
.show-api:hover {
|
|
889
955
|
color: var(--body-text-color);
|
|
890
956
|
}
|
|
957
|
+
|
|
958
|
+
.hidden {
|
|
959
|
+
display: none;
|
|
960
|
+
}
|
|
891
961
|
</style>
|
|
@@ -213,24 +213,24 @@ onMount(() => {
|
|
|
213
213
|
<div class="tool-content">
|
|
214
214
|
{#if Object.keys(tool.parameters).length > 0}
|
|
215
215
|
<div class="tool-parameters">
|
|
216
|
-
{#
|
|
217
|
-
|
|
218
|
-
<
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
</
|
|
229
|
-
|
|
230
|
-
{
|
|
231
|
-
<p>No parameters</p>
|
|
232
|
-
{/if}
|
|
216
|
+
{#each Object.entries(tool.parameters) as [name, param]}
|
|
217
|
+
<div class="parameter">
|
|
218
|
+
<code>{name}</code>
|
|
219
|
+
<span class="parameter-type">
|
|
220
|
+
({param.type}{param.default !== undefined
|
|
221
|
+
? `, default: ${JSON.stringify(param.default)}`
|
|
222
|
+
: ""})
|
|
223
|
+
</span>
|
|
224
|
+
<p class="parameter-description">
|
|
225
|
+
{param.description
|
|
226
|
+
? param.description
|
|
227
|
+
: "⚠︎ No description for this parameter in function docstring"}
|
|
228
|
+
</p>
|
|
229
|
+
</div>
|
|
230
|
+
{/each}
|
|
233
231
|
</div>
|
|
232
|
+
{:else}
|
|
233
|
+
<p>Takes no input parameters</p>
|
|
234
234
|
{/if}
|
|
235
235
|
</div>
|
|
236
236
|
{/if}
|
|
@@ -4,9 +4,13 @@ export let root;
|
|
|
4
4
|
export let space_id;
|
|
5
5
|
export let pwa_enabled;
|
|
6
6
|
import { BaseDropdown as Dropdown } from "@gradio/dropdown";
|
|
7
|
+
import { BaseCheckbox as Checkbox } from "@gradio/checkbox";
|
|
7
8
|
import { language_choices, changeLocale } from "../i18n";
|
|
8
9
|
import { locale, _ } from "svelte-i18n";
|
|
9
10
|
import { setupi18n } from "../i18n";
|
|
11
|
+
import record from "./img/record.svg";
|
|
12
|
+
import { createEventDispatcher } from "svelte";
|
|
13
|
+
const dispatch = createEventDispatcher();
|
|
10
14
|
if (root === "") {
|
|
11
15
|
root = location.protocol + "//" + location.host + location.pathname;
|
|
12
16
|
}
|
|
@@ -38,6 +42,8 @@ onMount(() => {
|
|
|
38
42
|
});
|
|
39
43
|
let current_locale;
|
|
40
44
|
let current_theme = "system";
|
|
45
|
+
export let allow_zoom = true;
|
|
46
|
+
export let allow_video_trim = true;
|
|
41
47
|
locale.subscribe((value) => {
|
|
42
48
|
if (value) {
|
|
43
49
|
current_locale = value;
|
|
@@ -47,6 +53,12 @@ function handleLanguageChange(e) {
|
|
|
47
53
|
const new_locale = e.detail;
|
|
48
54
|
changeLocale(new_locale);
|
|
49
55
|
}
|
|
56
|
+
function handleZoomChange(e) {
|
|
57
|
+
allow_zoom = e.detail;
|
|
58
|
+
}
|
|
59
|
+
function handleVideoTrimChange(e) {
|
|
60
|
+
allow_video_trim = e.detail;
|
|
61
|
+
}
|
|
50
62
|
setupi18n();
|
|
51
63
|
</script>
|
|
52
64
|
|
|
@@ -112,6 +124,44 @@ setupi18n();
|
|
|
112
124
|
{/if}
|
|
113
125
|
</p>
|
|
114
126
|
</div>
|
|
127
|
+
<div class="banner-wrap">
|
|
128
|
+
<h2>{$_("common.screen_studio")} <span class="beta-tag">beta</span></h2>
|
|
129
|
+
<p class="padded">
|
|
130
|
+
Screen Studio allows you to record your screen and generates a video of your
|
|
131
|
+
app with automatically adding zoom in and zoom out effects as well as
|
|
132
|
+
trimming the video to remove the prediction time.
|
|
133
|
+
<br /><br />
|
|
134
|
+
Start recording by clicking the <i>Start Recording</i> button below and then
|
|
135
|
+
sharing the current browser tab of your Gradio demo. Use your app as you
|
|
136
|
+
would normally to generate a prediction.
|
|
137
|
+
<br />
|
|
138
|
+
Stop recording by clicking the <i>Stop Recording</i> button in the footer of
|
|
139
|
+
the demo.
|
|
140
|
+
<br /><br />
|
|
141
|
+
<Checkbox
|
|
142
|
+
label="Include automatic zoom in/out"
|
|
143
|
+
interactive={true}
|
|
144
|
+
value={allow_zoom}
|
|
145
|
+
on:change={handleZoomChange}
|
|
146
|
+
/>
|
|
147
|
+
<Checkbox
|
|
148
|
+
label="Include automatic video trimming"
|
|
149
|
+
interactive={true}
|
|
150
|
+
value={allow_video_trim}
|
|
151
|
+
on:change={handleVideoTrimChange}
|
|
152
|
+
/>
|
|
153
|
+
</p>
|
|
154
|
+
<button
|
|
155
|
+
class="record-button"
|
|
156
|
+
on:click={() => {
|
|
157
|
+
dispatch("close");
|
|
158
|
+
dispatch("start_recording");
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
<img src={record} alt="Start Recording" />
|
|
162
|
+
Start Recording
|
|
163
|
+
</button>
|
|
164
|
+
</div>
|
|
115
165
|
|
|
116
166
|
<style>
|
|
117
167
|
.banner-wrap {
|
|
@@ -142,7 +192,8 @@ setupi18n();
|
|
|
142
192
|
margin-left: var(--size-2);
|
|
143
193
|
}
|
|
144
194
|
|
|
145
|
-
.theme-button
|
|
195
|
+
.theme-button,
|
|
196
|
+
.record-button {
|
|
146
197
|
display: flex;
|
|
147
198
|
align-items: center;
|
|
148
199
|
border: 1px solid var(--border-color-primary);
|
|
@@ -154,6 +205,15 @@ setupi18n();
|
|
|
154
205
|
cursor: pointer;
|
|
155
206
|
}
|
|
156
207
|
|
|
208
|
+
.record-button img {
|
|
209
|
+
margin-right: var(--size-1);
|
|
210
|
+
margin-left: var(--size-1);
|
|
211
|
+
width: var(--size-3);
|
|
212
|
+
}
|
|
213
|
+
.record-button:hover {
|
|
214
|
+
border-color: red;
|
|
215
|
+
}
|
|
216
|
+
|
|
157
217
|
.current-theme {
|
|
158
218
|
border: 1px solid var(--body-text-color-subdued);
|
|
159
219
|
color: var(--body-text-color);
|
|
@@ -173,4 +233,17 @@ setupi18n();
|
|
|
173
233
|
all: unset;
|
|
174
234
|
cursor: pointer;
|
|
175
235
|
}
|
|
236
|
+
|
|
237
|
+
.beta-tag {
|
|
238
|
+
position: relative;
|
|
239
|
+
top: -5px;
|
|
240
|
+
font-size: var(--text-xs);
|
|
241
|
+
background-color: var(--color-accent);
|
|
242
|
+
color: white;
|
|
243
|
+
padding: 2px 6px;
|
|
244
|
+
border-radius: 10px;
|
|
245
|
+
margin-left: 5px;
|
|
246
|
+
font-weight: normal;
|
|
247
|
+
text-transform: uppercase;
|
|
248
|
+
}
|
|
176
249
|
</style>
|
|
@@ -4,9 +4,12 @@ declare const __propDef: {
|
|
|
4
4
|
root: string;
|
|
5
5
|
space_id: string | null;
|
|
6
6
|
pwa_enabled: boolean | undefined;
|
|
7
|
+
allow_zoom?: boolean | undefined;
|
|
8
|
+
allow_video_trim?: boolean | undefined;
|
|
7
9
|
};
|
|
8
10
|
events: {
|
|
9
11
|
close: CustomEvent<any>;
|
|
12
|
+
start_recording: CustomEvent<any>;
|
|
10
13
|
} & {
|
|
11
14
|
[evt: string]: CustomEvent<any>;
|
|
12
15
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <title>record [#982]</title> <desc>Created with Sketch.</desc> <defs> </defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="Dribbble-Light-Preview" transform="translate(-380.000000, -3839.000000)" fill="#FF0000"> <g id="icons" transform="translate(56.000000, 160.000000)"> <path d="M338,3689 C338,3691.209 336.209,3693 334,3693 C331.791,3693 330,3691.209 330,3689 C330,3686.791 331.791,3685 334,3685 C336.209,3685 338,3686.791 338,3689 M334,3697 C329.589,3697 326,3693.411 326,3689 C326,3684.589 329.589,3681 334,3681 C338.411,3681 342,3684.589 342,3689 C342,3693.411 338.411,3697 334,3697 M334,3679 C328.477,3679 324,3683.477 324,3689 C324,3694.523 328.477,3699 334,3699 C339.523,3699 344,3694.523 344,3689 C344,3683.477 339.523,3679 334,3679" id="record-[#982]"> </path> </g> </g> </g> </g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <title>record [#982]</title> <desc>Created with Sketch.</desc> <defs> </defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="Dribbble-Light-Preview" transform="translate(-380.000000, -3839.000000)" fill="#808080"> <g id="icons" transform="translate(56.000000, 160.000000)"> <path d="M338,3689 C338,3691.209 336.209,3693 334,3693 C331.791,3693 330,3691.209 330,3689 C330,3686.791 331.791,3685 334,3685 C336.209,3685 338,3686.791 338,3689 M334,3697 C329.589,3697 326,3693.411 326,3689 C326,3684.589 329.589,3681 334,3681 C338.411,3681 342,3684.589 342,3689 C342,3693.411 338.411,3697 334,3697 M334,3679 C328.477,3679 324,3683.477 324,3689 C324,3694.523 328.477,3699 334,3699 C339.523,3699 344,3694.523 344,3689 C344,3683.477 339.523,3679 334,3679" id="record-[#982]"> </path> </g> </g> </g> </g></svg>
|
package/dist/src/init.js
CHANGED
|
@@ -80,10 +80,15 @@ export function create_components(initial_layout) {
|
|
|
80
80
|
* Rerender the layout when the config has been modified to attach new components
|
|
81
81
|
*/
|
|
82
82
|
function rerender_layout({ render_id, components, layout, root, dependencies }) {
|
|
83
|
+
components.forEach((c) => {
|
|
84
|
+
for (const prop in c.props) {
|
|
85
|
+
if (c.props[prop] === null) {
|
|
86
|
+
c.props[prop] = undefined;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
83
90
|
let replacement_components = [];
|
|
84
91
|
let new_components = [];
|
|
85
|
-
console.log("old_keys", keys_per_render_id[render_id]);
|
|
86
|
-
console.log("new_keys", components.map((c) => c.key));
|
|
87
92
|
components.forEach((c) => {
|
|
88
93
|
if (c.key == null || !keys_per_render_id[render_id]?.includes(c.key)) {
|
|
89
94
|
new_components.push(c);
|
|
@@ -92,7 +97,6 @@ export function create_components(initial_layout) {
|
|
|
92
97
|
replacement_components.push(c);
|
|
93
98
|
}
|
|
94
99
|
});
|
|
95
|
-
console.log(new_components.length, replacement_components.length);
|
|
96
100
|
let _constructor_map = preload_all_components(new_components, root);
|
|
97
101
|
_constructor_map.forEach((v, k) => {
|
|
98
102
|
constructor_map.set(k, v);
|
package/dist/src/lang/en.json
CHANGED
|
@@ -69,6 +69,10 @@
|
|
|
69
69
|
"language": "Language",
|
|
70
70
|
"display_theme": "Display Theme",
|
|
71
71
|
"pwa": "Progressive Web App",
|
|
72
|
+
"record": "Record",
|
|
73
|
+
"stop_recording": "Stop Recording",
|
|
74
|
+
"screen_studio": "Screen Studio",
|
|
75
|
+
"share_gradio_tab": "[Sharing] Gradio Tab",
|
|
72
76
|
"run": "Run"
|
|
73
77
|
},
|
|
74
78
|
"dataframe": {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ToastMessage } from "@gradio/statustracker";
|
|
2
|
+
export declare function initialize(rootPath: string, add_new_message: (title: string, message: string, type: ToastMessage["type"]) => void, recordingStateCallback?: (isRecording: boolean) => void): void;
|
|
3
|
+
export declare function startRecording(): Promise<void>;
|
|
4
|
+
export declare function stopRecording(): void;
|
|
5
|
+
export declare function isCurrentlyRecording(): boolean;
|
|
6
|
+
export declare function markRemoveSegmentStart(): void;
|
|
7
|
+
export declare function markRemoveSegmentEnd(): void;
|
|
8
|
+
export declare function clearRemoveSegment(): void;
|
|
9
|
+
export declare function addZoomEffect(is_input: boolean, params: {
|
|
10
|
+
boundingBox: {
|
|
11
|
+
topLeft: [number, number];
|
|
12
|
+
bottomRight: [number, number];
|
|
13
|
+
};
|
|
14
|
+
duration?: number;
|
|
15
|
+
}): void;
|
|
16
|
+
export declare function zoom(is_input: boolean, elements: number[], duration?: number): void;
|