Upload folder using huggingface_hub
Browse files- 6.23.0/dialogue/Dialogue.svelte +14 -14
- 6.23.0/dialogue/Example.svelte +9 -3
- 6.23.0/dialogue/Index.svelte +1 -3
- 6.23.0/dialogue/Switch.svelte +17 -12
6.23.0/dialogue/Dialogue.svelte
CHANGED
|
@@ -397,7 +397,7 @@
|
|
| 397 |
});
|
| 398 |
</script>
|
| 399 |
|
| 400 |
-
<svelte:window
|
| 401 |
|
| 402 |
<div class:container={gradio.shared.container}>
|
| 403 |
{#if gradio.shared.show_label && (buttons.some((btn) => typeof btn === "string" && btn === "copy") || buttons.some((btn) => typeof btn !== "string"))}
|
|
@@ -424,8 +424,8 @@
|
|
| 424 |
label="Plain Text"
|
| 425 |
bind:checked
|
| 426 |
disabled={is_formatting || is_unformatting}
|
| 427 |
-
|
| 428 |
-
if (!e.
|
| 429 |
is_unformatting = true;
|
| 430 |
try {
|
| 431 |
gradio.props.value = await gradio.shared.server.unformat({
|
|
@@ -472,8 +472,8 @@
|
|
| 472 |
class="speaker-column"
|
| 473 |
role="button"
|
| 474 |
tabindex="0"
|
| 475 |
-
|
| 476 |
-
|
| 477 |
>
|
| 478 |
{#if disabled}
|
| 479 |
<textarea
|
|
@@ -500,9 +500,9 @@
|
|
| 500 |
bind:value={line.text}
|
| 501 |
placeholder={gradio.props.placeholder}
|
| 502 |
{disabled}
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
if (event.key === "Escape" && showTagMenu) {
|
| 507 |
showTagMenu = false;
|
| 508 |
selectedOptionIndex = 0;
|
|
@@ -559,7 +559,7 @@
|
|
| 559 |
<button
|
| 560 |
class="add-button"
|
| 561 |
data-testid="dialogue-add-button-{i}"
|
| 562 |
-
|
| 563 |
aria-label="Add new line"
|
| 564 |
{disabled}
|
| 565 |
>
|
|
@@ -571,7 +571,7 @@
|
|
| 571 |
<button
|
| 572 |
class="delete-button"
|
| 573 |
data-testid="dialogue-delete-button-{i}"
|
| 574 |
-
|
| 575 |
aria-label="Remove current line"
|
| 576 |
{disabled}
|
| 577 |
>
|
|
@@ -595,12 +595,12 @@
|
|
| 595 |
placeholder={gradio.props.placeholder}
|
| 596 |
rows={5}
|
| 597 |
{disabled}
|
| 598 |
-
|
| 599 |
handle_input(event, 0);
|
| 600 |
gradio.props.value = textbox_value;
|
| 601 |
}}
|
| 602 |
-
|
| 603 |
-
|
| 604 |
if (event.key === "Escape" && showTagMenu) {
|
| 605 |
showTagMenu = false;
|
| 606 |
selectedOptionIndex = 0;
|
|
@@ -652,7 +652,7 @@
|
|
| 652 |
<button
|
| 653 |
class="submit-button"
|
| 654 |
data-testid="dialogue-submit-button"
|
| 655 |
-
|
| 656 |
{disabled}
|
| 657 |
>
|
| 658 |
{#if typeof gradio.props.submit_btn === "string"}
|
|
|
|
| 397 |
});
|
| 398 |
</script>
|
| 399 |
|
| 400 |
+
<svelte:window onclick={handle_click_outside} />
|
| 401 |
|
| 402 |
<div class:container={gradio.shared.container}>
|
| 403 |
{#if gradio.shared.show_label && (buttons.some((btn) => typeof btn === "string" && btn === "copy") || buttons.some((btn) => typeof btn !== "string"))}
|
|
|
|
| 424 |
label="Plain Text"
|
| 425 |
bind:checked
|
| 426 |
disabled={is_formatting || is_unformatting}
|
| 427 |
+
onclick={async (e) => {
|
| 428 |
+
if (!e.checked) {
|
| 429 |
is_unformatting = true;
|
| 430 |
try {
|
| 431 |
gradio.props.value = await gradio.shared.server.unformat({
|
|
|
|
| 472 |
class="speaker-column"
|
| 473 |
role="button"
|
| 474 |
tabindex="0"
|
| 475 |
+
onmouseenter={() => disabled && (hoveredSpeaker = line.speaker)}
|
| 476 |
+
onmouseleave={() => disabled && (hoveredSpeaker = null)}
|
| 477 |
>
|
| 478 |
{#if disabled}
|
| 479 |
<textarea
|
|
|
|
| 500 |
bind:value={line.text}
|
| 501 |
placeholder={gradio.props.placeholder}
|
| 502 |
{disabled}
|
| 503 |
+
oninput={(event) => handle_input(event, i)}
|
| 504 |
+
onfocus={(event) => handle_input(event, i)}
|
| 505 |
+
onkeydown={(event) => {
|
| 506 |
if (event.key === "Escape" && showTagMenu) {
|
| 507 |
showTagMenu = false;
|
| 508 |
selectedOptionIndex = 0;
|
|
|
|
| 559 |
<button
|
| 560 |
class="add-button"
|
| 561 |
data-testid="dialogue-add-button-{i}"
|
| 562 |
+
onclick={() => add_line(i)}
|
| 563 |
aria-label="Add new line"
|
| 564 |
{disabled}
|
| 565 |
>
|
|
|
|
| 571 |
<button
|
| 572 |
class="delete-button"
|
| 573 |
data-testid="dialogue-delete-button-{i}"
|
| 574 |
+
onclick={() => delete_line(i)}
|
| 575 |
aria-label="Remove current line"
|
| 576 |
{disabled}
|
| 577 |
>
|
|
|
|
| 595 |
placeholder={gradio.props.placeholder}
|
| 596 |
rows={5}
|
| 597 |
{disabled}
|
| 598 |
+
oninput={(event) => {
|
| 599 |
handle_input(event, 0);
|
| 600 |
gradio.props.value = textbox_value;
|
| 601 |
}}
|
| 602 |
+
onfocus={(event) => handle_input(event, 0)}
|
| 603 |
+
onkeydown={(event) => {
|
| 604 |
if (event.key === "Escape" && showTagMenu) {
|
| 605 |
showTagMenu = false;
|
| 606 |
selectedOptionIndex = 0;
|
|
|
|
| 652 |
<button
|
| 653 |
class="submit-button"
|
| 654 |
data-testid="dialogue-submit-button"
|
| 655 |
+
onclick={handle_submit}
|
| 656 |
{disabled}
|
| 657 |
>
|
| 658 |
{#if typeof gradio.props.submit_btn === "string"}
|
6.23.0/dialogue/Example.svelte
CHANGED
|
@@ -1,7 +1,13 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
</script>
|
| 6 |
|
| 7 |
<div
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
let {
|
| 3 |
+
value,
|
| 4 |
+
type,
|
| 5 |
+
selected = false
|
| 6 |
+
}: {
|
| 7 |
+
value: string;
|
| 8 |
+
type: "gallery" | "table";
|
| 9 |
+
selected?: boolean;
|
| 10 |
+
} = $props();
|
| 11 |
</script>
|
| 12 |
|
| 13 |
<div
|
6.23.0/dialogue/Index.svelte
CHANGED
|
@@ -1,6 +1,4 @@
|
|
| 1 |
-
<
|
| 2 |
-
|
| 3 |
-
<script context="module" lang="ts">
|
| 4 |
export { default as BaseDialogue } from "./Dialogue.svelte";
|
| 5 |
export { default as BaseExample } from "./Example.svelte";
|
| 6 |
</script>
|
|
|
|
| 1 |
+
<script module lang="ts">
|
|
|
|
|
|
|
| 2 |
export { default as BaseDialogue } from "./Dialogue.svelte";
|
| 3 |
export { default as BaseExample } from "./Example.svelte";
|
| 4 |
</script>
|
6.23.0/dialogue/Switch.svelte
CHANGED
|
@@ -1,18 +1,23 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
// based on https://svelte.dev/playground/d65a4e9f0ae74d1eb1b08d13e428af32?version=3.35.0
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
checked = state === "true" ? false : true;
|
| 15 |
-
|
| 16 |
}
|
| 17 |
</script>
|
| 18 |
|
|
@@ -20,7 +25,7 @@
|
|
| 20 |
<button
|
| 21 |
role="switch"
|
| 22 |
aria-checked={checked}
|
| 23 |
-
|
| 24 |
{disabled}
|
| 25 |
>
|
| 26 |
</button>
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
// based on https://svelte.dev/playground/d65a4e9f0ae74d1eb1b08d13e428af32?version=3.35.0
|
| 3 |
|
| 4 |
+
let {
|
| 5 |
+
label,
|
| 6 |
+
checked = $bindable(false),
|
| 7 |
+
disabled = false,
|
| 8 |
+
onclick
|
| 9 |
+
}: {
|
| 10 |
+
label: string;
|
| 11 |
+
checked?: boolean;
|
| 12 |
+
disabled?: boolean;
|
| 13 |
+
onclick?: (detail: { checked: boolean }) => void;
|
| 14 |
+
} = $props();
|
| 15 |
+
|
| 16 |
+
function handle_click(event: Event): void {
|
| 17 |
+
const target = event.target as HTMLElement | null;
|
| 18 |
+
const state = target?.getAttribute("aria-checked");
|
| 19 |
checked = state === "true" ? false : true;
|
| 20 |
+
onclick?.({ checked });
|
| 21 |
}
|
| 22 |
</script>
|
| 23 |
|
|
|
|
| 25 |
<button
|
| 26 |
role="switch"
|
| 27 |
aria-checked={checked}
|
| 28 |
+
onclick={handle_click}
|
| 29 |
{disabled}
|
| 30 |
>
|
| 31 |
</button>
|