@gradio/core 0.4.1 → 0.6.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 +71 -0
- package/dist/src/Blocks.svelte +74 -5
- package/dist/src/Login.svelte +2 -2
- package/dist/src/Render.svelte +1 -0
- package/dist/src/RenderComponent.svelte +4 -0
- package/dist/src/RenderComponent.svelte.d.ts +1 -0
- package/dist/src/api_docs/Settings.svelte +175 -0
- package/dist/src/api_docs/Settings.svelte.d.ts +20 -0
- package/dist/src/api_docs/SettingsBanner.svelte +71 -0
- package/dist/src/api_docs/SettingsBanner.svelte.d.ts +18 -0
- package/dist/src/api_docs/img/settings-logo.svg +8 -0
- package/dist/src/api_docs/index.d.ts +1 -0
- package/dist/src/api_docs/index.js +1 -0
- package/dist/src/i18n.d.ts +2 -0
- package/dist/src/i18n.js +16 -2
- package/dist/src/init.js +20 -13
- package/dist/src/lang/ar.json +117 -3
- package/dist/src/lang/ca.json +113 -2
- package/dist/src/lang/ckb.json +42 -20
- package/dist/src/lang/de.json +116 -2
- package/dist/src/lang/en.json +8 -1
- package/dist/src/lang/es.json +116 -3
- package/dist/src/lang/eu.json +122 -8
- package/dist/src/lang/fa.json +120 -6
- package/dist/src/lang/fi.json +52 -46
- package/dist/src/lang/fr.json +113 -13
- package/dist/src/lang/he.json +122 -8
- package/dist/src/lang/hi.json +123 -9
- package/dist/src/lang/ja.json +121 -7
- package/dist/src/lang/ko.json +123 -9
- package/dist/src/lang/lt.json +3 -1
- package/dist/src/lang/nb.json +130 -0
- package/dist/src/lang/nl.json +3 -1
- package/dist/src/lang/pl.json +121 -7
- package/dist/src/lang/pt-BR.json +1 -0
- package/dist/src/lang/pt.json +130 -0
- package/dist/src/lang/ro.json +130 -0
- package/dist/src/lang/ru.json +54 -42
- package/dist/src/lang/ta.json +1 -0
- package/dist/src/lang/tr.json +1 -0
- package/dist/src/lang/uk.json +3 -1
- package/dist/src/lang/ur.json +3 -1
- package/package.json +53 -53
- package/src/Blocks.svelte +77 -5
- package/src/Login.svelte +2 -2
- package/src/Render.svelte +1 -0
- package/src/RenderComponent.svelte +4 -0
- package/src/api_docs/Settings.svelte +183 -0
- package/src/api_docs/SettingsBanner.svelte +74 -0
- package/src/api_docs/img/settings-logo.svg +8 -0
- package/src/api_docs/index.ts +1 -0
- package/src/i18n.ts +25 -2
- package/src/init.ts +26 -12
- package/src/lang/ar.json +117 -3
- package/src/lang/ca.json +113 -2
- package/src/lang/ckb.json +42 -20
- package/src/lang/de.json +116 -2
- package/src/lang/en.json +8 -1
- package/src/lang/es.json +116 -3
- package/src/lang/eu.json +122 -8
- package/src/lang/fa.json +120 -6
- package/src/lang/fi.json +52 -46
- package/src/lang/fr.json +113 -13
- package/src/lang/he.json +122 -8
- package/src/lang/hi.json +123 -9
- package/src/lang/ja.json +121 -7
- package/src/lang/ko.json +123 -9
- package/src/lang/lt.json +3 -1
- package/src/lang/nb.json +130 -0
- package/src/lang/nl.json +3 -1
- package/src/lang/pl.json +121 -7
- package/src/lang/pt-BR.json +1 -0
- package/src/lang/pt.json +130 -0
- package/src/lang/ro.json +130 -0
- package/src/lang/ru.json +54 -42
- package/src/lang/ta.json +1 -0
- package/src/lang/tr.json +1 -0
- package/src/lang/uk.json +3 -1
- package/src/lang/ur.json +3 -1
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
export let elem_id: string;
|
|
18
18
|
export let elem_classes: string[];
|
|
19
19
|
export let _id: number;
|
|
20
|
+
export let visible: boolean;
|
|
20
21
|
|
|
21
22
|
const s = (id: number, p: string, v: any): CustomEvent =>
|
|
22
23
|
new CustomEvent("prop_change", { detail: { id, prop: p, value: v } });
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
const _component = wrap(component);
|
|
52
53
|
</script>
|
|
53
54
|
|
|
55
|
+
<!-- {#if visible} -->
|
|
54
56
|
<svelte:component
|
|
55
57
|
this={_component}
|
|
56
58
|
bind:this={instance}
|
|
@@ -59,9 +61,11 @@
|
|
|
59
61
|
{elem_id}
|
|
60
62
|
{elem_classes}
|
|
61
63
|
{target}
|
|
64
|
+
{visible}
|
|
62
65
|
{...$$restProps}
|
|
63
66
|
{theme_mode}
|
|
64
67
|
{root}
|
|
65
68
|
>
|
|
66
69
|
<slot />
|
|
67
70
|
</svelte:component>
|
|
71
|
+
<!-- {/if} -->
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import { onMount } from "svelte";
|
|
4
|
+
import SettingsBanner from "./SettingsBanner.svelte";
|
|
5
|
+
export let root: string;
|
|
6
|
+
export let space_id: string | null;
|
|
7
|
+
export let pwa_enabled: boolean | undefined;
|
|
8
|
+
import { BaseDropdown as Dropdown } from "@gradio/dropdown";
|
|
9
|
+
import { language_choices, changeLocale } from "../i18n";
|
|
10
|
+
import { locale, _ } from "svelte-i18n";
|
|
11
|
+
import { setupi18n } from "../i18n";
|
|
12
|
+
|
|
13
|
+
if (root === "") {
|
|
14
|
+
root = location.protocol + "//" + location.host + location.pathname;
|
|
15
|
+
}
|
|
16
|
+
if (!root.endsWith("/")) {
|
|
17
|
+
root += "/";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function setTheme(theme: "light" | "dark" | "system") {
|
|
21
|
+
const url = new URL(window.location.href);
|
|
22
|
+
if (theme === "system") {
|
|
23
|
+
url.searchParams.delete("__theme");
|
|
24
|
+
current_theme = "system";
|
|
25
|
+
} else {
|
|
26
|
+
url.searchParams.set("__theme", theme);
|
|
27
|
+
current_theme = theme;
|
|
28
|
+
}
|
|
29
|
+
window.location.href = url.toString();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onMount(() => {
|
|
33
|
+
document.body.style.overflow = "hidden";
|
|
34
|
+
if ("parentIFrame" in window) {
|
|
35
|
+
window.parentIFrame?.scrollTo(0, 0);
|
|
36
|
+
}
|
|
37
|
+
const url = new URL(window.location.href);
|
|
38
|
+
const theme = url.searchParams.get("__theme");
|
|
39
|
+
current_theme = (theme as "light" | "dark" | "system") || "system";
|
|
40
|
+
return () => {
|
|
41
|
+
document.body.style.overflow = "auto";
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
let current_locale: string;
|
|
46
|
+
let current_theme: "light" | "dark" | "system" = "system";
|
|
47
|
+
|
|
48
|
+
locale.subscribe((value) => {
|
|
49
|
+
if (value) {
|
|
50
|
+
current_locale = value;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
function handleLanguageChange(e: CustomEvent): void {
|
|
55
|
+
const new_locale = e.detail;
|
|
56
|
+
changeLocale(new_locale);
|
|
57
|
+
}
|
|
58
|
+
setupi18n();
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<div class="banner-wrap">
|
|
62
|
+
<SettingsBanner on:close {root} />
|
|
63
|
+
</div>
|
|
64
|
+
{#if space_id === null}
|
|
65
|
+
<!-- on Spaces, the theme is set in HF settings -->
|
|
66
|
+
<div class="banner-wrap">
|
|
67
|
+
<h2>{$_("common.display_theme")}</h2>
|
|
68
|
+
<p class="padded theme-buttons">
|
|
69
|
+
<li
|
|
70
|
+
class="theme-button {current_theme === 'light'
|
|
71
|
+
? 'current-theme'
|
|
72
|
+
: 'inactive-theme'}"
|
|
73
|
+
on:click={() => setTheme("light")}
|
|
74
|
+
>
|
|
75
|
+
<button>☀︎ Light</button>
|
|
76
|
+
</li>
|
|
77
|
+
<li
|
|
78
|
+
class="theme-button {current_theme === 'dark'
|
|
79
|
+
? 'current-theme'
|
|
80
|
+
: 'inactive-theme'}"
|
|
81
|
+
on:click={() => setTheme("dark")}
|
|
82
|
+
>
|
|
83
|
+
<button>⏾ Dark</button>
|
|
84
|
+
</li>
|
|
85
|
+
<li
|
|
86
|
+
class="theme-button {current_theme === 'system'
|
|
87
|
+
? 'current-theme'
|
|
88
|
+
: 'inactive-theme'}"
|
|
89
|
+
on:click={() => setTheme("system")}
|
|
90
|
+
>
|
|
91
|
+
<button>🖥︎ System</button>
|
|
92
|
+
</li>
|
|
93
|
+
</p>
|
|
94
|
+
</div>
|
|
95
|
+
{/if}
|
|
96
|
+
<div class="banner-wrap">
|
|
97
|
+
<h2>{$_("common.language")}</h2>
|
|
98
|
+
<p class="padded">
|
|
99
|
+
<Dropdown
|
|
100
|
+
label="Language"
|
|
101
|
+
choices={language_choices}
|
|
102
|
+
show_label={false}
|
|
103
|
+
{root}
|
|
104
|
+
value={current_locale}
|
|
105
|
+
on:change={handleLanguageChange}
|
|
106
|
+
/>
|
|
107
|
+
</p>
|
|
108
|
+
</div>
|
|
109
|
+
<div class="banner-wrap">
|
|
110
|
+
<h2>{$_("common.pwa")}</h2>
|
|
111
|
+
<p class="padded">
|
|
112
|
+
{#if pwa_enabled}
|
|
113
|
+
You can install this app as a Progressive Web App on your device. Visit <a
|
|
114
|
+
href={root}>{root}</a
|
|
115
|
+
> and click the install button in the URL address bar of your browser.
|
|
116
|
+
{:else}
|
|
117
|
+
Progressive Web App is not enabled for this app. To enable it, start your
|
|
118
|
+
Gradio app with <code>launch(pwa=True)</code>.
|
|
119
|
+
{/if}
|
|
120
|
+
</p>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<style>
|
|
124
|
+
.banner-wrap {
|
|
125
|
+
position: relative;
|
|
126
|
+
border-bottom: 1px solid var(--border-color-primary);
|
|
127
|
+
padding: var(--size-4) var(--size-6);
|
|
128
|
+
font-size: var(--text-md);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.banner-wrap h2 {
|
|
132
|
+
font-size: var(--text-xl);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
a {
|
|
136
|
+
text-decoration: underline;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
p.padded {
|
|
140
|
+
padding: 15px 0px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.theme-buttons {
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.theme-buttons > * + * {
|
|
149
|
+
margin-left: var(--size-2);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.theme-button {
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
border: 1px solid var(--border-color-primary);
|
|
156
|
+
border-radius: var(--radius-md);
|
|
157
|
+
padding: var(--size-2) var(--size-2-5);
|
|
158
|
+
line-height: 1;
|
|
159
|
+
user-select: none;
|
|
160
|
+
text-transform: capitalize;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.current-theme {
|
|
165
|
+
border: 1px solid var(--body-text-color-subdued);
|
|
166
|
+
color: var(--body-text-color);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.inactive-theme {
|
|
170
|
+
color: var(--body-text-color-subdued);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.inactive-theme:hover,
|
|
174
|
+
.inactive-theme:focus {
|
|
175
|
+
box-shadow: var(--shadow-drop);
|
|
176
|
+
color: var(--body-text-color);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.theme-button button {
|
|
180
|
+
all: unset;
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
}
|
|
183
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
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();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<h2>
|
|
15
|
+
<img src={settings_logo} alt="" />
|
|
16
|
+
<div class="title">
|
|
17
|
+
{$_("common.settings")}
|
|
18
|
+
<div class="url">
|
|
19
|
+
{root}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</h2>
|
|
23
|
+
|
|
24
|
+
<button on:click={() => dispatch("close")}>
|
|
25
|
+
<Clear />
|
|
26
|
+
</button>
|
|
27
|
+
|
|
28
|
+
<style>
|
|
29
|
+
h2 {
|
|
30
|
+
display: flex;
|
|
31
|
+
color: var(--body-text-color);
|
|
32
|
+
font-weight: var(--weight-semibold);
|
|
33
|
+
font-size: var(--text-xl);
|
|
34
|
+
gap: var(--size-3);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
h2 img {
|
|
38
|
+
width: var(--size-4);
|
|
39
|
+
display: inline-block;
|
|
40
|
+
margin-top: 0.1rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.url {
|
|
44
|
+
color: var(--color-accent);
|
|
45
|
+
font-weight: normal;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
button {
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: var(--size-5);
|
|
51
|
+
right: var(--size-6);
|
|
52
|
+
width: var(--size-4);
|
|
53
|
+
color: var(--body-text-color);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
button:hover {
|
|
57
|
+
color: var(--color-accent);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (--screen-md) {
|
|
61
|
+
button {
|
|
62
|
+
top: var(--size-6);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
h2 img {
|
|
66
|
+
width: var(--size-5);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
.title {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: row;
|
|
72
|
+
gap: 0.5rem;
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<!-- Outer gear teeth (gray) -->
|
|
3
|
+
<path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"
|
|
4
|
+
fill="#808080"/>
|
|
5
|
+
|
|
6
|
+
<!-- Inner circle (now gray) -->
|
|
7
|
+
<circle cx="12" cy="12" r="2.5" fill="#808080"/>
|
|
8
|
+
</svg>
|
package/src/api_docs/index.ts
CHANGED
package/src/i18n.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addMessages, init, getLocaleFromNavigator } from "svelte-i18n";
|
|
1
|
+
import { addMessages, init, getLocaleFromNavigator, locale } from "svelte-i18n";
|
|
2
2
|
|
|
3
3
|
const langs = import.meta.glob("./lang/*.json", {
|
|
4
4
|
eager: true
|
|
@@ -23,14 +23,37 @@ export function process_langs(): LangsRecord {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const processed_langs = process_langs();
|
|
26
|
+
const available_locales = Object.keys(processed_langs);
|
|
27
|
+
|
|
28
|
+
export const language_choices: [string, string][] = Object.entries(
|
|
29
|
+
processed_langs
|
|
30
|
+
).map(([code, data]) => [data._name || code, code]);
|
|
26
31
|
|
|
27
32
|
for (const lang in processed_langs) {
|
|
28
33
|
addMessages(lang, processed_langs[lang]);
|
|
29
34
|
}
|
|
30
35
|
|
|
36
|
+
let i18n_initialized = false;
|
|
37
|
+
|
|
31
38
|
export async function setupi18n(): Promise<void> {
|
|
39
|
+
if (i18n_initialized) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const browser_locale = getLocaleFromNavigator();
|
|
44
|
+
const initial_locale =
|
|
45
|
+
browser_locale && available_locales.includes(browser_locale)
|
|
46
|
+
? browser_locale
|
|
47
|
+
: "en";
|
|
48
|
+
|
|
32
49
|
await init({
|
|
33
50
|
fallbackLocale: "en",
|
|
34
|
-
initialLocale:
|
|
51
|
+
initialLocale: initial_locale
|
|
35
52
|
});
|
|
53
|
+
|
|
54
|
+
i18n_initialized = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function changeLocale(new_locale: string): void {
|
|
58
|
+
locale.set(new_locale);
|
|
36
59
|
}
|
package/src/init.ts
CHANGED
|
@@ -154,7 +154,7 @@ export function create_components(initial_layout: ComponentMeta | undefined): {
|
|
|
154
154
|
{} as { [id: number]: ComponentMeta }
|
|
155
155
|
);
|
|
156
156
|
|
|
157
|
-
await walk_layout(layout, root);
|
|
157
|
+
await walk_layout(layout, root, _components);
|
|
158
158
|
|
|
159
159
|
layout_store.set(_rootNode);
|
|
160
160
|
set_event_specific_args(dependencies);
|
|
@@ -230,7 +230,12 @@ export function create_components(initial_layout: ComponentMeta | undefined): {
|
|
|
230
230
|
] = instance_map[layout.id];
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
walk_layout(
|
|
233
|
+
walk_layout(
|
|
234
|
+
layout,
|
|
235
|
+
root,
|
|
236
|
+
_components.concat(components),
|
|
237
|
+
current_element.parent
|
|
238
|
+
).then(() => {
|
|
234
239
|
layout_store.set(_rootNode);
|
|
235
240
|
});
|
|
236
241
|
|
|
@@ -240,6 +245,7 @@ export function create_components(initial_layout: ComponentMeta | undefined): {
|
|
|
240
245
|
async function walk_layout(
|
|
241
246
|
node: LayoutNode,
|
|
242
247
|
root: string,
|
|
248
|
+
components: ComponentMeta[],
|
|
243
249
|
parent?: ComponentMeta
|
|
244
250
|
): Promise<ComponentMeta> {
|
|
245
251
|
const instance = instance_map[node.id];
|
|
@@ -254,7 +260,7 @@ export function create_components(initial_layout: ComponentMeta | undefined): {
|
|
|
254
260
|
instance.type,
|
|
255
261
|
instance.component_class_id,
|
|
256
262
|
root,
|
|
257
|
-
|
|
263
|
+
components,
|
|
258
264
|
instance.props.components
|
|
259
265
|
).example_components;
|
|
260
266
|
}
|
|
@@ -288,21 +294,21 @@ export function create_components(initial_layout: ComponentMeta | undefined): {
|
|
|
288
294
|
|
|
289
295
|
if (node.children) {
|
|
290
296
|
instance.children = await Promise.all(
|
|
291
|
-
node.children.map((v) => walk_layout(v, root, instance))
|
|
297
|
+
node.children.map((v) => walk_layout(v, root, components, instance))
|
|
292
298
|
);
|
|
293
299
|
}
|
|
294
300
|
|
|
295
301
|
if (instance.type === "tabs" && !instance.props.initial_tabs) {
|
|
296
302
|
const tab_items_props =
|
|
297
|
-
node.children?.map((c) => {
|
|
303
|
+
node.children?.map((c, i) => {
|
|
298
304
|
const instance = instance_map[c.id];
|
|
299
|
-
// console.log("tabs", JSON.stringify(instance.props, null, 2));
|
|
300
305
|
instance.props.id ??= c.id;
|
|
301
306
|
return {
|
|
302
307
|
type: instance.type,
|
|
303
308
|
props: {
|
|
304
309
|
...(instance.props as any),
|
|
305
|
-
id: instance.props.id
|
|
310
|
+
id: instance.props.id,
|
|
311
|
+
order: i
|
|
306
312
|
}
|
|
307
313
|
};
|
|
308
314
|
}) || [];
|
|
@@ -315,10 +321,18 @@ export function create_components(initial_layout: ComponentMeta | undefined): {
|
|
|
315
321
|
label: child.props.label,
|
|
316
322
|
id: child.props.id,
|
|
317
323
|
visible: child.props.visible,
|
|
318
|
-
interactive: child.props.interactive
|
|
324
|
+
interactive: child.props.interactive,
|
|
325
|
+
order: child.props.order
|
|
319
326
|
}));
|
|
320
327
|
}
|
|
321
328
|
|
|
329
|
+
if (instance.type === "tabs") {
|
|
330
|
+
node.children?.forEach((c, i) => {
|
|
331
|
+
const child = instance_map[c.id];
|
|
332
|
+
child.props.order = i;
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
|
|
322
336
|
return instance;
|
|
323
337
|
}
|
|
324
338
|
|
|
@@ -379,7 +393,7 @@ export function create_components(initial_layout: ComponentMeta | undefined): {
|
|
|
379
393
|
if (!comp) {
|
|
380
394
|
return null;
|
|
381
395
|
}
|
|
382
|
-
if (comp.instance
|
|
396
|
+
if (comp.instance?.get_value) {
|
|
383
397
|
return comp.instance.get_value() as Promise<any>;
|
|
384
398
|
}
|
|
385
399
|
return comp.props.value;
|
|
@@ -408,7 +422,7 @@ export function create_components(initial_layout: ComponentMeta | undefined): {
|
|
|
408
422
|
state: "open" | "closed" | "waiting"
|
|
409
423
|
): void {
|
|
410
424
|
const comp = _component_map.get(id);
|
|
411
|
-
if (comp && comp.instance
|
|
425
|
+
if (comp && comp.instance?.modify_stream_state) {
|
|
412
426
|
comp.instance.modify_stream_state(state);
|
|
413
427
|
}
|
|
414
428
|
}
|
|
@@ -417,14 +431,14 @@ export function create_components(initial_layout: ComponentMeta | undefined): {
|
|
|
417
431
|
id: number
|
|
418
432
|
): "open" | "closed" | "waiting" | "not_set" {
|
|
419
433
|
const comp = _component_map.get(id);
|
|
420
|
-
if (comp
|
|
434
|
+
if (comp?.instance?.get_stream_state)
|
|
421
435
|
return comp.instance.get_stream_state();
|
|
422
436
|
return "not_set";
|
|
423
437
|
}
|
|
424
438
|
|
|
425
439
|
function set_time_limit(id: number, time_limit: number | undefined): void {
|
|
426
440
|
const comp = _component_map.get(id);
|
|
427
|
-
if (comp
|
|
441
|
+
if (comp?.instance?.set_time_limit) {
|
|
428
442
|
comp.instance.set_time_limit(time_limit);
|
|
429
443
|
}
|
|
430
444
|
}
|
package/src/lang/ar.json
CHANGED
|
@@ -1,16 +1,130 @@
|
|
|
1
1
|
{
|
|
2
|
+
"_name": "العربية",
|
|
3
|
+
"3D_model": {
|
|
4
|
+
"3d_model": "نموذج ثلاثي الأبعاد"
|
|
5
|
+
},
|
|
6
|
+
"annotated_image": {
|
|
7
|
+
"annotated_image": "صورة مشروحة"
|
|
8
|
+
},
|
|
9
|
+
"audio": {
|
|
10
|
+
"allow_recording_access": "يرجى السماح بالوصول إلى الميكروفون للتسجيل",
|
|
11
|
+
"audio": "الصوت",
|
|
12
|
+
"record_from_microphone": "تسجيل من الميكروفون",
|
|
13
|
+
"stop_recording": "إيقاف التسجيل",
|
|
14
|
+
"no_device_support": "لا يمكن الوصول إلى أجهزة الوسائط. تأكد من أنك تعمل على مصدر آمن (https) أو localhost (أو قمت بتمرير شهادة SSL صالحة إلى ssl_verify)، وأنك سمحت للمتصفح بالوصول إلى جهازك.",
|
|
15
|
+
"stop": "إيقاف",
|
|
16
|
+
"resume": "استئناف",
|
|
17
|
+
"record": "تسجيل",
|
|
18
|
+
"no_microphone": "لم يتم العثور على ميكروفون",
|
|
19
|
+
"pause": "إيقاف مؤقت",
|
|
20
|
+
"play": "تشغيل",
|
|
21
|
+
"waiting": "جاري الانتظار"
|
|
22
|
+
},
|
|
23
|
+
"blocks": {
|
|
24
|
+
"connection_can_break": "على الهاتف المحمول، يمكن أن ينقطع الاتصال إذا تم تغيير التبويب أو دخل الجهاز في وضع السكون، مما يؤدي إلى فقدان موقعك في قائمة الانتظار.",
|
|
25
|
+
"long_requests_queue": "هناك قائمة انتظار طويلة من الطلبات المعلقة. قم بتكرار هذا الفضاء للتخطي.",
|
|
26
|
+
"lost_connection": "فقد الاتصال بسبب مغادرة الصفحة. إعادة الانضمام إلى قائمة الانتظار..."
|
|
27
|
+
},
|
|
28
|
+
"checkbox": {
|
|
29
|
+
"checkbox": "خانة اختيار",
|
|
30
|
+
"checkbox_group": "مجموعة خانات الاختيار"
|
|
31
|
+
},
|
|
32
|
+
"code": {
|
|
33
|
+
"code": "الكود"
|
|
34
|
+
},
|
|
35
|
+
"color_picker": {
|
|
36
|
+
"color_picker": "منتقي الألوان"
|
|
37
|
+
},
|
|
2
38
|
"common": {
|
|
39
|
+
"built_with": "بُني باستخدام",
|
|
3
40
|
"built_with_gradio": "تم الإنشاء بإستخدام Gradio",
|
|
4
41
|
"clear": "أمسح",
|
|
42
|
+
"download": "تحميل",
|
|
43
|
+
"edit": "تعديل",
|
|
44
|
+
"empty": "فارغ",
|
|
45
|
+
"error": "خطأ",
|
|
46
|
+
"hosted_on": "مستضاف على",
|
|
47
|
+
"loading": "جاري التحميل",
|
|
48
|
+
"logo": "شعار",
|
|
5
49
|
"or": "أو",
|
|
6
|
-
"
|
|
50
|
+
"remove": "إزالة",
|
|
51
|
+
"settings": "الإعدادات",
|
|
52
|
+
"share": "مشاركة",
|
|
53
|
+
"submit": "أرسل",
|
|
54
|
+
"undo": "تراجع",
|
|
55
|
+
"no_devices": "لم يتم العثور على أجهزة",
|
|
56
|
+
"language": "اللغة",
|
|
57
|
+
"display_theme": "مظهر العرض",
|
|
58
|
+
"pwa": "تطبيق ويب تقدمي"
|
|
59
|
+
},
|
|
60
|
+
"dataframe": {
|
|
61
|
+
"incorrect_format": "تنسيق غير صحيح، يتم دعم ملفات CSV و TSV فقط",
|
|
62
|
+
"new_column": "إضافة عمود",
|
|
63
|
+
"new_row": "صف جديد",
|
|
64
|
+
"add_row_above": "إضافة صف فوق",
|
|
65
|
+
"add_row_below": "إضافة صف تحت",
|
|
66
|
+
"add_column_left": "إضافة عمود لليسار",
|
|
67
|
+
"add_column_right": "إضافة عمود لليمين"
|
|
68
|
+
},
|
|
69
|
+
"dropdown": {
|
|
70
|
+
"dropdown": "قائمة منسدلة"
|
|
71
|
+
},
|
|
72
|
+
"errors": {
|
|
73
|
+
"build_error": "هناك خطأ في البناء",
|
|
74
|
+
"config_error": "هناك خطأ في التكوين",
|
|
75
|
+
"contact_page_author": "يرجى الاتصال بمؤلف الصفحة لإعلامه.",
|
|
76
|
+
"no_app_file": "لا يوجد ملف تطبيق",
|
|
77
|
+
"runtime_error": "هناك خطأ في وقت التشغيل",
|
|
78
|
+
"space_not_working": "\"المساحة لا تعمل لأن\" {0}",
|
|
79
|
+
"space_paused": "المساحة متوقفة مؤقتًا",
|
|
80
|
+
"use_via_api": "استخدم عبر API"
|
|
81
|
+
},
|
|
82
|
+
"file": {
|
|
83
|
+
"uploading": "جاري الرفع..."
|
|
84
|
+
},
|
|
85
|
+
"highlighted_text": {
|
|
86
|
+
"highlighted_text": "نص مميز"
|
|
87
|
+
},
|
|
88
|
+
"image": {
|
|
89
|
+
"allow_webcam_access": "يرجى السماح بالوصول إلى كاميرا الويب للتسجيل.",
|
|
90
|
+
"brush_color": "لون الفرشاة",
|
|
91
|
+
"brush_radius": "حجم الفرشاة",
|
|
92
|
+
"image": "صورة",
|
|
93
|
+
"remove_image": "إزالة الصورة",
|
|
94
|
+
"select_brush_color": "اختر لون الفرشاة",
|
|
95
|
+
"start_drawing": "ابدأ الرسم",
|
|
96
|
+
"use_brush": "استخدم الفرشاة"
|
|
97
|
+
},
|
|
98
|
+
"label": {
|
|
99
|
+
"label": "تسمية"
|
|
100
|
+
},
|
|
101
|
+
"login": {
|
|
102
|
+
"enable_cookies": "إذا كنت تزور مساحة HuggingFace في وضع التصفح المتخفي، يجب عليك تمكين ملفات تعريف الارتباط من الجهات الخارجية.",
|
|
103
|
+
"incorrect_credentials": "بيانات الاعتماد غير صحيحة",
|
|
104
|
+
"username": "اسم المستخدم",
|
|
105
|
+
"password": "كلمة المرور",
|
|
106
|
+
"login": "تسجيل الدخول"
|
|
107
|
+
},
|
|
108
|
+
"number": {
|
|
109
|
+
"number": "رقم"
|
|
110
|
+
},
|
|
111
|
+
"plot": {
|
|
112
|
+
"plot": "رسم بياني"
|
|
113
|
+
},
|
|
114
|
+
"radio": {
|
|
115
|
+
"radio": "زر راديو"
|
|
116
|
+
},
|
|
117
|
+
"slider": {
|
|
118
|
+
"slider": "شريط التمرير"
|
|
7
119
|
},
|
|
8
120
|
"upload_text": {
|
|
9
|
-
"click_to_upload": "
|
|
121
|
+
"click_to_upload": "انقر للتحميل",
|
|
10
122
|
"drop_audio": "أسقط الملف الصوتي هنا",
|
|
11
123
|
"drop_csv": "أسقط ملف البيانات هنا",
|
|
12
124
|
"drop_file": "أسقط الملف هنا",
|
|
13
125
|
"drop_image": "أسقط الصورة هنا",
|
|
14
|
-
"drop_video": "أسقط الفيديو هنا"
|
|
126
|
+
"drop_video": "أسقط الفيديو هنا",
|
|
127
|
+
"drop_gallery": "أسقط الوسائط هنا",
|
|
128
|
+
"paste_clipboard": "لصق من الحافظة"
|
|
15
129
|
}
|
|
16
130
|
}
|