@gradio/core 1.0.0-dev.0 → 1.0.0-dev.3
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 +79 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/src/Blocks.svelte +518 -1001
- package/dist/src/Blocks.svelte.d.ts +31 -45
- package/dist/src/Embed.svelte +82 -55
- package/dist/src/Embed.svelte.d.ts +39 -30
- package/dist/src/Login.svelte +33 -29
- package/dist/src/Login.svelte.d.ts +21 -19
- package/dist/src/MountComponents.svelte +19 -25
- package/dist/src/MountComponents.svelte.d.ts +5 -28
- package/dist/src/{init.d.ts → _init.d.ts} +5 -4
- package/dist/src/{init.js → _init.js} +31 -108
- package/dist/src/api_docs/ApiBanner.svelte +12 -8
- package/dist/src/api_docs/ApiBanner.svelte.d.ts +22 -20
- package/dist/src/api_docs/ApiDocs.svelte +337 -245
- package/dist/src/api_docs/ApiDocs.svelte.d.ts +26 -24
- package/dist/src/api_docs/ApiRecorder.svelte +9 -3
- package/dist/src/api_docs/ApiRecorder.svelte.d.ts +19 -17
- package/dist/src/api_docs/CodeSnippet.svelte +60 -30
- package/dist/src/api_docs/CodeSnippet.svelte.d.ts +27 -24
- package/dist/src/api_docs/CopyButton.svelte +69 -13
- package/dist/src/api_docs/CopyButton.svelte.d.ts +18 -16
- package/dist/src/api_docs/CopyMarkdown.svelte +734 -0
- package/dist/src/api_docs/CopyMarkdown.svelte.d.ts +37 -0
- package/dist/src/api_docs/EndpointDetail.svelte +8 -6
- package/dist/src/api_docs/EndpointDetail.svelte.d.ts +20 -18
- package/dist/src/api_docs/IconArrowUpRight.svelte +34 -0
- package/dist/src/api_docs/IconArrowUpRight.svelte.d.ts +20 -0
- package/dist/src/api_docs/IconCaret.svelte +39 -0
- package/dist/src/api_docs/IconCaret.svelte.d.ts +20 -0
- package/dist/src/api_docs/IconHuggingChat.svelte +62 -0
- package/dist/src/api_docs/IconHuggingChat.svelte.d.ts +20 -0
- package/dist/src/api_docs/InputPayload.svelte +17 -11
- package/dist/src/api_docs/InputPayload.svelte.d.ts +25 -23
- package/dist/src/api_docs/InstallSnippet.svelte +9 -6
- package/dist/src/api_docs/InstallSnippet.svelte.d.ts +18 -16
- package/dist/src/api_docs/MCPSnippet.svelte +119 -99
- package/dist/src/api_docs/MCPSnippet.svelte.d.ts +59 -58
- package/dist/src/api_docs/NoApi.svelte +7 -4
- package/dist/src/api_docs/NoApi.svelte.d.ts +20 -18
- package/dist/src/api_docs/ParametersSnippet.svelte +8 -6
- package/dist/src/api_docs/ParametersSnippet.svelte.d.ts +21 -19
- package/dist/src/api_docs/RecordingSnippet.svelte +124 -110
- package/dist/src/api_docs/RecordingSnippet.svelte.d.ts +24 -22
- package/dist/src/api_docs/ResponseSnippet.svelte +7 -5
- package/dist/src/api_docs/ResponseSnippet.svelte.d.ts +21 -19
- package/dist/src/api_docs/Settings.svelte +73 -62
- package/dist/src/api_docs/Settings.svelte.d.ts +25 -23
- package/dist/src/api_docs/SettingsBanner.svelte +11 -8
- package/dist/src/api_docs/SettingsBanner.svelte.d.ts +20 -18
- package/dist/src/api_docs/TryButton.svelte +5 -3
- package/dist/src/api_docs/TryButton.svelte.d.ts +19 -17
- package/dist/src/api_docs/img/IconCheck.svelte +33 -0
- package/dist/src/api_docs/img/IconCheck.svelte.d.ts +26 -0
- package/dist/src/api_docs/img/IconCopy.svelte +40 -0
- package/dist/src/api_docs/img/IconCopy.svelte.d.ts +26 -0
- package/dist/src/api_docs/img/clear.svelte.d.ts +22 -21
- package/dist/src/dependency.d.ts +142 -0
- package/dist/src/dependency.js +653 -0
- package/dist/src/init.svelte.d.ts +78 -0
- package/dist/src/init.svelte.js +469 -0
- package/dist/src/init_utils.d.ts +32 -0
- package/dist/src/init_utils.js +73 -0
- package/dist/src/lang/en.json +10 -1
- package/dist/src/lang/get_lang_names.js +0 -3
- package/dist/src/lang/ru.json +10 -1
- package/dist/src/stores.d.ts +0 -21
- package/dist/src/stories/I18nMultiLanguageTestComponent.svelte +5 -3
- package/dist/src/stories/I18nMultiLanguageTestComponent.svelte.d.ts +16 -14
- package/dist/src/stories/I18nTestSetup.svelte +14 -10
- package/dist/src/stories/I18nTestSetup.svelte.d.ts +18 -16
- package/dist/src/types.d.ts +30 -26
- package/index.ts +1 -1
- package/package.json +59 -59
- package/src/Blocks.svelte +344 -1063
- package/src/MountComponents.svelte +17 -27
- package/src/{init.ts → _init.ts} +49 -126
- package/src/api_docs/ApiDocs.svelte +65 -60
- package/src/api_docs/ApiRecorder.svelte +3 -0
- package/src/api_docs/CodeSnippet.svelte +20 -5
- package/src/api_docs/CopyButton.svelte +61 -7
- package/src/api_docs/CopyMarkdown.svelte +734 -0
- package/src/api_docs/IconArrowUpRight.svelte +34 -0
- package/src/api_docs/IconCaret.svelte +39 -0
- package/src/api_docs/IconHuggingChat.svelte +62 -0
- package/src/api_docs/MCPSnippet.svelte +24 -46
- package/src/api_docs/ParametersSnippet.svelte +1 -1
- package/src/api_docs/ResponseSnippet.svelte +1 -1
- package/src/api_docs/Settings.svelte +11 -11
- package/src/api_docs/img/IconCheck.svelte +33 -0
- package/src/api_docs/img/IconCopy.svelte +40 -0
- package/src/dependency.ts +880 -0
- package/src/init.svelte.ts +717 -0
- package/src/init_utils.ts +99 -0
- package/src/lang/en.json +10 -1
- package/src/lang/get_lang_names.js +0 -3
- package/src/lang/ru.json +10 -1
- package/src/stores.ts +22 -22
- package/src/types.ts +54 -43
- package/dist/src/Render.svelte +0 -105
- package/dist/src/Render.svelte.d.ts +0 -31
- package/dist/src/RenderComponent.svelte +0 -72
- package/dist/src/RenderComponent.svelte.d.ts +0 -33
- package/src/Render.svelte +0 -126
- package/src/RenderComponent.svelte +0 -91
|
@@ -1,113 +1,127 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export let
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
let
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Dependency, Payload } from "../types";
|
|
3
|
+
import CopyButton from "./CopyButton.svelte";
|
|
4
|
+
import { Block } from "@gradio/atoms";
|
|
5
|
+
import { represent_value } from "./utils";
|
|
6
|
+
import { onMount, tick } from "svelte";
|
|
7
|
+
|
|
8
|
+
export let dependencies: Dependency[];
|
|
9
|
+
export let short_root: string;
|
|
10
|
+
export let root: string;
|
|
11
|
+
export let api_prefix = "";
|
|
12
|
+
export let current_language: "python" | "javascript" | "bash" | "mcp";
|
|
13
|
+
export let username: string | null;
|
|
14
|
+
|
|
15
|
+
let python_code: HTMLElement;
|
|
16
|
+
let python_code_text: string;
|
|
17
|
+
let js_code: HTMLElement;
|
|
18
|
+
let bash_code: HTMLElement;
|
|
19
|
+
|
|
20
|
+
export let api_calls: Payload[] = [];
|
|
21
|
+
|
|
22
|
+
async function get_info(): Promise<{
|
|
23
|
+
named_endpoints: any;
|
|
24
|
+
unnamed_endpoints: any;
|
|
25
|
+
}> {
|
|
26
|
+
let response = await fetch(
|
|
27
|
+
root.replace(/\/$/, "") + api_prefix + "/info/?all_endpoints=true"
|
|
28
|
+
);
|
|
29
|
+
let data = await response.json();
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let endpoints_info: any;
|
|
34
|
+
let py_zipped: { call: string; api_name: string }[] = [];
|
|
35
|
+
let js_zipped: { call: string; api_name: string }[] = [];
|
|
36
|
+
let bash_zipped: { call: string; api_name: string }[] = [];
|
|
37
|
+
|
|
38
|
+
function format_api_call(call: Payload, lang: "py" | "js" | "bash"): string {
|
|
39
|
+
const api_name = `/${dependencies[call.fn_index].api_name}`;
|
|
40
|
+
// If an input is undefined (distinct from null) then it corresponds to a State component.
|
|
41
|
+
let call_data_excluding_state = call.data.filter(
|
|
42
|
+
(d) => typeof d !== "undefined"
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const params = call_data_excluding_state
|
|
46
|
+
.map((param, index) => {
|
|
47
|
+
if (endpoints_info[api_name]) {
|
|
48
|
+
const param_info = endpoints_info[api_name].parameters[index];
|
|
49
|
+
if (!param_info) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const param_name = param_info.parameter_name;
|
|
53
|
+
const python_type = param_info.python_type.type;
|
|
54
|
+
if (lang === "py") {
|
|
55
|
+
return ` ${param_name}=${represent_value(
|
|
56
|
+
param as string,
|
|
57
|
+
python_type,
|
|
58
|
+
"py"
|
|
59
|
+
)}`;
|
|
60
|
+
} else if (lang === "js") {
|
|
61
|
+
return ` ${param_name}: ${represent_value(
|
|
62
|
+
param as string,
|
|
63
|
+
python_type,
|
|
64
|
+
"js"
|
|
65
|
+
)}`;
|
|
66
|
+
} else if (lang === "bash") {
|
|
67
|
+
return ` ${represent_value(
|
|
68
|
+
param as string,
|
|
69
|
+
python_type,
|
|
70
|
+
"bash"
|
|
71
|
+
)}`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return ` ${represent_value(param as string, undefined, lang)}`;
|
|
75
|
+
})
|
|
76
|
+
.filter((d) => typeof d !== "undefined")
|
|
77
|
+
.join(",\n");
|
|
78
|
+
if (params) {
|
|
79
|
+
if (lang === "py") {
|
|
80
|
+
return `${params},\n`;
|
|
81
|
+
} else if (lang === "js") {
|
|
82
|
+
return `{\n${params},\n}`;
|
|
83
|
+
} else if (lang === "bash") {
|
|
84
|
+
return `\n${params}\n`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (lang === "py") {
|
|
88
|
+
return "";
|
|
89
|
+
}
|
|
90
|
+
return "\n";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
onMount(async () => {
|
|
94
|
+
const data = await get_info();
|
|
95
|
+
endpoints_info = data["named_endpoints"];
|
|
96
|
+
let py_api_calls: string[] = api_calls.map((call) =>
|
|
97
|
+
format_api_call(call, "py")
|
|
98
|
+
);
|
|
99
|
+
let js_api_calls: string[] = api_calls.map((call) =>
|
|
100
|
+
format_api_call(call, "js")
|
|
101
|
+
);
|
|
102
|
+
let bash_api_calls: string[] = api_calls.map((call) =>
|
|
103
|
+
format_api_call(call, "bash")
|
|
104
|
+
);
|
|
105
|
+
let api_names: string[] = api_calls.map(
|
|
106
|
+
(call) => dependencies[call.fn_index].api_name || ""
|
|
107
|
+
);
|
|
108
|
+
py_zipped = py_api_calls.map((call, index) => ({
|
|
109
|
+
call,
|
|
110
|
+
api_name: api_names[index]
|
|
111
|
+
}));
|
|
112
|
+
js_zipped = js_api_calls.map((call, index) => ({
|
|
113
|
+
call,
|
|
114
|
+
api_name: api_names[index]
|
|
115
|
+
}));
|
|
116
|
+
bash_zipped = bash_api_calls.map((call, index) => ({
|
|
117
|
+
call,
|
|
118
|
+
api_name: api_names[index]
|
|
119
|
+
}));
|
|
120
|
+
|
|
121
|
+
await tick();
|
|
122
|
+
|
|
123
|
+
python_code_text = python_code.innerText;
|
|
124
|
+
});
|
|
111
125
|
</script>
|
|
112
126
|
|
|
113
127
|
<div class="container">
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { Dependency, Payload } from "../types";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
};
|
|
16
|
-
slots: {};
|
|
17
|
-
exports?: {} | undefined;
|
|
18
|
-
bindings?: string | undefined;
|
|
19
|
-
};
|
|
20
|
-
export type RecordingSnippetProps = typeof __propDef.props;
|
|
21
|
-
export type RecordingSnippetEvents = typeof __propDef.events;
|
|
22
|
-
export type RecordingSnippetSlots = typeof __propDef.slots;
|
|
23
|
-
export default class RecordingSnippet extends SvelteComponent<RecordingSnippetProps, RecordingSnippetEvents, RecordingSnippetSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
24
14
|
}
|
|
25
|
-
|
|
15
|
+
declare const RecordingSnippet: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
dependencies: Dependency[];
|
|
17
|
+
short_root: string;
|
|
18
|
+
root: string;
|
|
19
|
+
api_prefix?: string;
|
|
20
|
+
current_language: "python" | "javascript" | "bash" | "mcp";
|
|
21
|
+
username: string | null;
|
|
22
|
+
api_calls?: Payload[];
|
|
23
|
+
}, {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
}, {}, {}, string>;
|
|
26
|
+
type RecordingSnippet = InstanceType<typeof RecordingSnippet>;
|
|
27
|
+
export default RecordingSnippet;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export let
|
|
5
|
-
export let
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Loader } from "@gradio/statustracker";
|
|
3
|
+
|
|
4
|
+
export let is_running: boolean;
|
|
5
|
+
export let endpoint_returns: any;
|
|
6
|
+
export let js_returns: any;
|
|
7
|
+
export let current_language: "python" | "javascript" | "bash" | "mcp";
|
|
6
8
|
</script>
|
|
7
9
|
|
|
8
10
|
<h4>
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
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> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
8
11
|
};
|
|
9
|
-
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {};
|
|
13
|
-
exports?: {} | undefined;
|
|
14
|
-
bindings?: string | undefined;
|
|
15
|
-
};
|
|
16
|
-
export type ResponseSnippetProps = typeof __propDef.props;
|
|
17
|
-
export type ResponseSnippetEvents = typeof __propDef.events;
|
|
18
|
-
export type ResponseSnippetSlots = typeof __propDef.slots;
|
|
19
|
-
export default class ResponseSnippet extends SvelteComponent<ResponseSnippetProps, ResponseSnippetEvents, ResponseSnippetSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
20
13
|
}
|
|
21
|
-
|
|
14
|
+
declare const ResponseSnippet: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
is_running: boolean;
|
|
16
|
+
endpoint_returns: any;
|
|
17
|
+
js_returns: any;
|
|
18
|
+
current_language: "python" | "javascript" | "bash" | "mcp";
|
|
19
|
+
}, {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
}, {}, {}, string>;
|
|
22
|
+
type ResponseSnippet = InstanceType<typeof ResponseSnippet>;
|
|
23
|
+
export default ResponseSnippet;
|
|
@@ -1,65 +1,76 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import { onMount } from "svelte";
|
|
4
|
+
import SettingsBanner from "./SettingsBanner.svelte";
|
|
5
|
+
import { BaseDropdown as Dropdown } from "@gradio/dropdown";
|
|
6
|
+
import { BaseCheckbox as Checkbox } from "@gradio/checkbox";
|
|
7
|
+
import { language_choices, changeLocale } from "../i18n";
|
|
8
|
+
import { locale, _ } from "svelte-i18n";
|
|
9
|
+
import record from "./img/record.svg";
|
|
10
|
+
import { createEventDispatcher } from "svelte";
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
root,
|
|
14
|
+
space_id,
|
|
15
|
+
pwa_enabled,
|
|
16
|
+
allow_zoom = $bindable(),
|
|
17
|
+
allow_video_trim = $bindable()
|
|
18
|
+
} = $props();
|
|
19
|
+
|
|
20
|
+
const dispatch = createEventDispatcher();
|
|
21
|
+
if (root === "") {
|
|
22
|
+
root = location.protocol + "//" + location.host + location.pathname;
|
|
23
|
+
}
|
|
24
|
+
if (!root.endsWith("/")) {
|
|
25
|
+
root += "/";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function setTheme(theme: "light" | "dark" | "system") {
|
|
29
|
+
const url = new URL(window.location.href);
|
|
30
|
+
if (theme === "system") {
|
|
31
|
+
url.searchParams.delete("__theme");
|
|
32
|
+
current_theme = "system";
|
|
33
|
+
} else {
|
|
34
|
+
url.searchParams.set("__theme", theme);
|
|
35
|
+
current_theme = theme;
|
|
36
|
+
}
|
|
37
|
+
window.location.href = url.toString();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
onMount(() => {
|
|
41
|
+
// document.body.style.overflow = "hidden";
|
|
42
|
+
if ("parentIFrame" in window) {
|
|
43
|
+
window.parentIFrame?.scrollTo(0, 0);
|
|
44
|
+
}
|
|
45
|
+
const url = new URL(window.location.href);
|
|
46
|
+
const theme = url.searchParams.get("__theme");
|
|
47
|
+
current_theme = (theme as "light" | "dark" | "system") || "system";
|
|
48
|
+
return () => {
|
|
49
|
+
document.body.style.overflow = "auto";
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
let current_locale: string = $state("en");
|
|
54
|
+
let current_theme: "light" | "dark" | "system" = $state("system");
|
|
55
|
+
|
|
56
|
+
locale.subscribe((value) => {
|
|
57
|
+
if (value) {
|
|
58
|
+
current_locale = value;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
function handleLanguageChange(e: CustomEvent): void {
|
|
63
|
+
const new_locale = e.detail;
|
|
64
|
+
changeLocale(new_locale);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function handleZoomChange(e: CustomEvent): void {
|
|
68
|
+
allow_zoom = e.detail;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function handleVideoTrimChange(e: CustomEvent): void {
|
|
72
|
+
allow_video_trim = e.detail;
|
|
73
|
+
}
|
|
63
74
|
</script>
|
|
64
75
|
|
|
65
76
|
<div class="banner-wrap">
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
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> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
9
11
|
};
|
|
10
|
-
|
|
11
|
-
close: CustomEvent<any>;
|
|
12
|
-
start_recording: CustomEvent<any>;
|
|
13
|
-
} & {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
};
|
|
16
|
-
slots: {};
|
|
17
|
-
exports?: {} | undefined;
|
|
18
|
-
bindings?: string | undefined;
|
|
19
|
-
};
|
|
20
|
-
export type SettingsProps = typeof __propDef.props;
|
|
21
|
-
export type SettingsEvents = typeof __propDef.events;
|
|
22
|
-
export type SettingsSlots = typeof __propDef.slots;
|
|
23
|
-
export default class Settings extends SvelteComponent<SettingsProps, SettingsEvents, SettingsSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
24
13
|
}
|
|
25
|
-
|
|
14
|
+
declare const Settings: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
root: any;
|
|
16
|
+
space_id: any;
|
|
17
|
+
pwa_enabled: any;
|
|
18
|
+
allow_zoom?: any;
|
|
19
|
+
allow_video_trim?: any;
|
|
20
|
+
}, {
|
|
21
|
+
close: CustomEvent<any>;
|
|
22
|
+
start_recording: CustomEvent<any>;
|
|
23
|
+
} & {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
}, {}, {}, "allow_zoom" | "allow_video_trim">;
|
|
26
|
+
type Settings = InstanceType<typeof Settings>;
|
|
27
|
+
export default Settings;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import { _ } from "svelte-i18n";
|
|
4
|
+
import settings_logo from "./img/settings-logo.svg";
|
|
5
|
+
import Clear from "./img/clear.svelte";
|
|
6
|
+
import { setupi18n } from "../i18n";
|
|
7
|
+
|
|
8
|
+
export let root: string;
|
|
9
|
+
|
|
10
|
+
const dispatch = createEventDispatcher();
|
|
11
|
+
setupi18n();
|
|
9
12
|
</script>
|
|
10
13
|
|
|
11
14
|
<h2>
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
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> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
5
11
|
};
|
|
6
|
-
|
|
7
|
-
close: CustomEvent<any>;
|
|
8
|
-
} & {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
exports?: {} | undefined;
|
|
13
|
-
bindings?: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
export type SettingsBannerProps = typeof __propDef.props;
|
|
16
|
-
export type SettingsBannerEvents = typeof __propDef.events;
|
|
17
|
-
export type SettingsBannerSlots = typeof __propDef.slots;
|
|
18
|
-
export default class SettingsBanner extends SvelteComponent<SettingsBannerProps, SettingsBannerEvents, SettingsBannerSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
19
13
|
}
|
|
20
|
-
|
|
14
|
+
declare const SettingsBanner: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
root: string;
|
|
16
|
+
}, {
|
|
17
|
+
close: CustomEvent<any>;
|
|
18
|
+
} & {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
}, {}, {}, string>;
|
|
21
|
+
type SettingsBanner = InstanceType<typeof SettingsBanner>;
|
|
22
|
+
export default SettingsBanner;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { BaseButton } from "@gradio/button";
|
|
3
|
+
|
|
4
|
+
export let dependency_index: number;
|
|
5
|
+
export let run: (id: number) => Promise<void>;
|
|
4
6
|
</script>
|
|
5
7
|
|
|
6
8
|
<span class="space" />
|