Upload folder using huggingface_hub
Browse files
6.2.0/atoms/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/atoms",
|
| 3 |
-
"version": "0.
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"main": "src/index.ts",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/atoms",
|
| 3 |
+
"version": "0.20.0",
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"main": "src/index.ts",
|
6.2.0/atoms/src/CustomButton.svelte
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import type { CustomButton } from "@gradio/utils";
|
| 3 |
+
|
| 4 |
+
export let button: CustomButton;
|
| 5 |
+
export let on_click: (id: number) => void;
|
| 6 |
+
</script>
|
| 7 |
+
|
| 8 |
+
<button
|
| 9 |
+
class="custom-button"
|
| 10 |
+
on:click={() => on_click(button.id)}
|
| 11 |
+
title={button.value || ""}
|
| 12 |
+
aria-label={button.value || "Custom action"}
|
| 13 |
+
>
|
| 14 |
+
{#if button.value}
|
| 15 |
+
<span class="custom-button-label">{button.value}</span>
|
| 16 |
+
{/if}
|
| 17 |
+
</button>
|
| 18 |
+
|
| 19 |
+
<style>
|
| 20 |
+
.custom-button {
|
| 21 |
+
display: flex;
|
| 22 |
+
align-items: center;
|
| 23 |
+
justify-content: center;
|
| 24 |
+
gap: var(--size-1);
|
| 25 |
+
height: var(--size-6);
|
| 26 |
+
padding: var(--size-1) var(--size-2);
|
| 27 |
+
border: none;
|
| 28 |
+
border-radius: var(--radius-sm);
|
| 29 |
+
background: transparent;
|
| 30 |
+
color: var(--block-title-text-color);
|
| 31 |
+
cursor: pointer;
|
| 32 |
+
transition: all 0.2s;
|
| 33 |
+
font-size: var(--text-sm);
|
| 34 |
+
margin-left: var(--size-1);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.custom-button:hover {
|
| 38 |
+
background: var(--background-fill-secondary);
|
| 39 |
+
color: var(--body-text-color);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.custom-button-label {
|
| 43 |
+
white-space: nowrap;
|
| 44 |
+
}
|
| 45 |
+
</style>
|
6.2.0/atoms/src/IconButtonWrapper.svelte
CHANGED
|
@@ -1,13 +1,32 @@
|
|
| 1 |
-
<script>
|
|
|
|
|
|
|
|
|
|
| 2 |
export let top_panel = true;
|
| 3 |
export let display_top_corner = false;
|
| 4 |
export let show_background = true;
|
|
|
|
|
|
|
| 5 |
</script>
|
| 6 |
|
| 7 |
<div
|
| 8 |
class={`icon-button-wrapper ${top_panel ? "top-panel" : ""} ${display_top_corner ? "display-top-corner" : "hide-top-corner"} ${!show_background ? "no-background" : ""}`}
|
| 9 |
>
|
| 10 |
<slot></slot>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
</div>
|
| 12 |
|
| 13 |
<style>
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import CustomButton from "./CustomButton.svelte";
|
| 3 |
+
import type { CustomButton as CustomButtonType } from "@gradio/utils";
|
| 4 |
+
|
| 5 |
export let top_panel = true;
|
| 6 |
export let display_top_corner = false;
|
| 7 |
export let show_background = true;
|
| 8 |
+
export let buttons: (string | CustomButtonType)[] | null = null;
|
| 9 |
+
export let on_custom_button_click: ((id: number) => void) | null = null;
|
| 10 |
</script>
|
| 11 |
|
| 12 |
<div
|
| 13 |
class={`icon-button-wrapper ${top_panel ? "top-panel" : ""} ${display_top_corner ? "display-top-corner" : "hide-top-corner"} ${!show_background ? "no-background" : ""}`}
|
| 14 |
>
|
| 15 |
<slot></slot>
|
| 16 |
+
{#if buttons}
|
| 17 |
+
{#each buttons as btn}
|
| 18 |
+
{#if typeof btn !== "string"}
|
| 19 |
+
<CustomButton
|
| 20 |
+
button={btn}
|
| 21 |
+
on_click={(id) => {
|
| 22 |
+
if (on_custom_button_click) {
|
| 23 |
+
on_custom_button_click(id);
|
| 24 |
+
}
|
| 25 |
+
}}
|
| 26 |
+
/>
|
| 27 |
+
{/if}
|
| 28 |
+
{/each}
|
| 29 |
+
{/if}
|
| 30 |
</div>
|
| 31 |
|
| 32 |
<style>
|
6.2.0/atoms/src/index.ts
CHANGED
|
@@ -11,5 +11,6 @@ export { default as Toolbar } from "./Toolbar.svelte";
|
|
| 11 |
export { default as SelectSource } from "./SelectSource.svelte";
|
| 12 |
export { default as IconButtonWrapper } from "./IconButtonWrapper.svelte";
|
| 13 |
export { default as FullscreenButton } from "./FullscreenButton.svelte";
|
|
|
|
| 14 |
|
| 15 |
export const BLOCK_KEY = {};
|
|
|
|
| 11 |
export { default as SelectSource } from "./SelectSource.svelte";
|
| 12 |
export { default as IconButtonWrapper } from "./IconButtonWrapper.svelte";
|
| 13 |
export { default as FullscreenButton } from "./FullscreenButton.svelte";
|
| 14 |
+
export { default as CustomButton } from "./CustomButton.svelte";
|
| 15 |
|
| 16 |
export const BLOCK_KEY = {};
|