Upload folder using huggingface_hub
Browse files- 6.2.0/dialogue/Dialogue.svelte +13 -7
- 6.2.0/dialogue/package.json +1 -1
- 6.2.0/dialogue/types.ts +4 -1
6.2.0/dialogue/Dialogue.svelte
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { onMount, tick } from "svelte";
|
| 3 |
import { BlockTitle, IconButton, IconButtonWrapper } from "@gradio/atoms";
|
|
|
|
| 4 |
import { Copy, Check, Send, Plus, Trash } from "@gradio/icons";
|
| 5 |
import { fade } from "svelte/transition";
|
| 6 |
import { BaseDropdown, BaseDropdownOptions } from "@gradio/dropdown";
|
|
@@ -39,6 +40,9 @@
|
|
| 39 |
});
|
| 40 |
|
| 41 |
let buttons = $derived(gradio.props.buttons || ["copy"]);
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
let old_value = $state(gradio.props.value);
|
| 44 |
|
|
@@ -402,13 +406,15 @@
|
|
| 402 |
<svelte:window on:click={handle_click_outside} />
|
| 403 |
|
| 404 |
<label class:container={gradio.shared.container}>
|
| 405 |
-
{#if gradio.shared.show_label && buttons.
|
| 406 |
-
<IconButtonWrapper>
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
|
|
|
|
|
|
| 412 |
</IconButtonWrapper>
|
| 413 |
{/if}
|
| 414 |
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { onMount, tick } from "svelte";
|
| 3 |
import { BlockTitle, IconButton, IconButtonWrapper } from "@gradio/atoms";
|
| 4 |
+
import type { CustomButton as CustomButtonType } from "@gradio/utils";
|
| 5 |
import { Copy, Check, Send, Plus, Trash } from "@gradio/icons";
|
| 6 |
import { fade } from "svelte/transition";
|
| 7 |
import { BaseDropdown, BaseDropdownOptions } from "@gradio/dropdown";
|
|
|
|
| 40 |
});
|
| 41 |
|
| 42 |
let buttons = $derived(gradio.props.buttons || ["copy"]);
|
| 43 |
+
let on_custom_button_click = (id: number) => {
|
| 44 |
+
gradio.dispatch("custom_button_click", { id });
|
| 45 |
+
};
|
| 46 |
|
| 47 |
let old_value = $state(gradio.props.value);
|
| 48 |
|
|
|
|
| 406 |
<svelte:window on:click={handle_click_outside} />
|
| 407 |
|
| 408 |
<label class:container={gradio.shared.container}>
|
| 409 |
+
{#if gradio.shared.show_label && (buttons.some((btn) => typeof btn === "string" && btn === "copy") || buttons.some((btn) => typeof btn !== "string"))}
|
| 410 |
+
<IconButtonWrapper {buttons} {on_custom_button_click}>
|
| 411 |
+
{#if buttons.some((btn) => typeof btn === "string" && btn === "copy")}
|
| 412 |
+
<IconButton
|
| 413 |
+
Icon={copied ? Check : Copy}
|
| 414 |
+
on:click={handle_copy}
|
| 415 |
+
label={copied ? "Copied" : "Copy"}
|
| 416 |
+
/>
|
| 417 |
+
{/if}
|
| 418 |
</IconButtonWrapper>
|
| 419 |
{/if}
|
| 420 |
|
6.2.0/dialogue/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/dialogue",
|
| 3 |
-
"version": "0.
|
| 4 |
"description": "Gradio dialogue component",
|
| 5 |
"type": "module",
|
| 6 |
"author": "Gradio",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/dialogue",
|
| 3 |
+
"version": "0.3.0",
|
| 4 |
"description": "Gradio dialogue component",
|
| 5 |
"type": "module",
|
| 6 |
"author": "Gradio",
|
6.2.0/dialogue/types.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
|
|
|
|
|
| 1 |
export interface DialogueProps {
|
| 2 |
value: { speaker: string; text: string }[] | string;
|
| 3 |
-
buttons: string[];
|
| 4 |
ui_mode: "dialogue" | "text" | "both";
|
| 5 |
max_lines: number;
|
| 6 |
tags: string[];
|
|
@@ -17,4 +19,5 @@ export interface DialogueEvents {
|
|
| 17 |
input: never;
|
| 18 |
submit: never;
|
| 19 |
clear_status: any;
|
|
|
|
| 20 |
}
|
|
|
|
| 1 |
+
import type { CustomButton } from "@gradio/utils";
|
| 2 |
+
|
| 3 |
export interface DialogueProps {
|
| 4 |
value: { speaker: string; text: string }[] | string;
|
| 5 |
+
buttons: (string | CustomButton)[];
|
| 6 |
ui_mode: "dialogue" | "text" | "both";
|
| 7 |
max_lines: number;
|
| 8 |
tags: string[];
|
|
|
|
| 19 |
input: never;
|
| 20 |
submit: never;
|
| 21 |
clear_status: any;
|
| 22 |
+
custom_button_click: { id: number };
|
| 23 |
}
|