@gradio/core 1.0.0-dev.0 → 1.0.0
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 +110 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/src/Blocks.svelte +534 -1001
- package/dist/src/Blocks.svelte.d.ts +32 -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 +356 -247
- package/dist/src/api_docs/ApiDocs.svelte.d.ts +27 -24
- package/dist/src/api_docs/ApiRecorder.svelte +6 -3
- package/dist/src/api_docs/ApiRecorder.svelte.d.ts +19 -17
- package/dist/src/api_docs/CodeSnippet.svelte +122 -48
- package/dist/src/api_docs/CodeSnippet.svelte.d.ts +29 -25
- 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 +81 -23
- package/dist/src/api_docs/EndpointDetail.svelte.d.ts +23 -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 +139 -126
- package/dist/src/api_docs/MCPSnippet.svelte.d.ts +60 -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/PercentileChart.svelte +125 -0
- package/dist/src/api_docs/PercentileChart.svelte.d.ts +22 -0
- 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 +145 -0
- package/dist/src/dependency.js +668 -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 +31 -26
- package/index.ts +1 -1
- package/package.json +62 -63
- package/src/Blocks.svelte +360 -1063
- package/src/MountComponents.svelte +17 -27
- package/src/{init.ts → _init.ts} +49 -126
- package/src/api_docs/ApiDocs.svelte +84 -62
- package/src/api_docs/CodeSnippet.svelte +83 -24
- package/src/api_docs/CopyButton.svelte +61 -7
- package/src/api_docs/CopyMarkdown.svelte +734 -0
- package/src/api_docs/EndpointDetail.svelte +73 -17
- 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 +44 -73
- package/src/api_docs/ParametersSnippet.svelte +1 -1
- package/src/api_docs/PercentileChart.svelte +125 -0
- 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 +909 -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 +55 -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
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { format_latency } from "./utils";
|
|
3
|
+
|
|
4
|
+
export let p50: number;
|
|
5
|
+
export let p90: number;
|
|
6
|
+
export let p99: number;
|
|
7
|
+
|
|
8
|
+
$: max_latency = Math.max(p50, p90, p99);
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class="tooltip-chart">
|
|
12
|
+
<div class="tooltip-arrow"></div>
|
|
13
|
+
<div class="chart-bars">
|
|
14
|
+
<div class="chart-bar-container">
|
|
15
|
+
<div class="chart-bar-label">p50</div>
|
|
16
|
+
<div class="chart-bar-wrapper">
|
|
17
|
+
<div
|
|
18
|
+
class="chart-bar"
|
|
19
|
+
style="width: {(p50 / max_latency) * 100}%"
|
|
20
|
+
></div>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="chart-bar-value">{format_latency(p50)}</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="chart-bar-container">
|
|
25
|
+
<div class="chart-bar-label">p90</div>
|
|
26
|
+
<div class="chart-bar-wrapper">
|
|
27
|
+
<div
|
|
28
|
+
class="chart-bar"
|
|
29
|
+
style="width: {(p90 / max_latency) * 100}%"
|
|
30
|
+
></div>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="chart-bar-value">{format_latency(p90)}</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="chart-bar-container">
|
|
35
|
+
<div class="chart-bar-label">p99</div>
|
|
36
|
+
<div class="chart-bar-wrapper">
|
|
37
|
+
<div
|
|
38
|
+
class="chart-bar"
|
|
39
|
+
style="width: {(p99 / max_latency) * 100}%"
|
|
40
|
+
></div>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="chart-bar-value">{format_latency(p99)}</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<style>
|
|
48
|
+
.tooltip-chart {
|
|
49
|
+
background: var(--background-fill-primary);
|
|
50
|
+
border: 1px solid var(--border-color-primary);
|
|
51
|
+
border-radius: var(--radius-md);
|
|
52
|
+
padding: var(--size-3);
|
|
53
|
+
box-shadow: var(--shadow-drop-lg);
|
|
54
|
+
min-width: 200px;
|
|
55
|
+
position: relative;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.tooltip-arrow {
|
|
59
|
+
position: absolute;
|
|
60
|
+
bottom: -8px;
|
|
61
|
+
left: 50%;
|
|
62
|
+
transform: translateX(-50%);
|
|
63
|
+
width: 0;
|
|
64
|
+
height: 0;
|
|
65
|
+
border-left: 8px solid transparent;
|
|
66
|
+
border-right: 8px solid transparent;
|
|
67
|
+
border-top: 8px solid var(--border-color-primary);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.tooltip-arrow::after {
|
|
71
|
+
content: "";
|
|
72
|
+
position: absolute;
|
|
73
|
+
bottom: 1px;
|
|
74
|
+
left: 50%;
|
|
75
|
+
transform: translateX(-50%);
|
|
76
|
+
width: 0;
|
|
77
|
+
height: 0;
|
|
78
|
+
border-left: 7px solid transparent;
|
|
79
|
+
border-right: 7px solid transparent;
|
|
80
|
+
border-top: 7px solid var(--background-fill-primary);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.chart-bars {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
gap: var(--size-2);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.chart-bar-container {
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
gap: var(--size-2);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.chart-bar-label {
|
|
96
|
+
font-size: var(--text-sm);
|
|
97
|
+
font-weight: var(--weight-semibold);
|
|
98
|
+
color: var(--body-text-color);
|
|
99
|
+
min-width: 30px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.chart-bar-wrapper {
|
|
103
|
+
flex: 1;
|
|
104
|
+
height: 16px;
|
|
105
|
+
background: var(--background-fill-secondary);
|
|
106
|
+
border-radius: var(--radius-sm);
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
position: relative;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.chart-bar {
|
|
112
|
+
height: 100%;
|
|
113
|
+
background: var(--color-accent);
|
|
114
|
+
border-radius: var(--radius-sm);
|
|
115
|
+
transition: width 0.3s ease;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.chart-bar-value {
|
|
119
|
+
font-size: var(--text-sm);
|
|
120
|
+
color: var(--body-text-color);
|
|
121
|
+
min-width: 50px;
|
|
122
|
+
text-align: right;
|
|
123
|
+
font-family: var(--font-mono);
|
|
124
|
+
}
|
|
125
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const PercentileChart: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
p50: number;
|
|
16
|
+
p90: number;
|
|
17
|
+
p99: number;
|
|
18
|
+
}, {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
}, {}, {}, string>;
|
|
21
|
+
type PercentileChart = InstanceType<typeof PercentileChart>;
|
|
22
|
+
export default PercentileChart;
|
|
@@ -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">
|