adf0d17497
publish / version_or_publish (push) Has been cancelled
storybook-build / changes (push) Has been cancelled
storybook-build / :storybook-build (push) Has been cancelled
Sync Gradio Skills to Hugging Face / sync-skills (push) Has been cancelled
functional / changes (push) Has been cancelled
functional / build-frontend (push) Has been cancelled
functional / functional-test-SSR=false (push) Has been cancelled
functional / functional-reload (push) Has been cancelled
js / changes (push) Has been cancelled
js / js-test (push) Has been cancelled
docs-build / changes (push) Has been cancelled
docs-build / docs-build (push) Has been cancelled
docs-build / website-build (push) Has been cancelled
functional / functional-test-SSR=true (push) Has been cancelled
hygiene / hygiene-test (push) Has been cancelled
python / changes (push) Has been cancelled
python / build (push) Has been cancelled
python / test-ubuntu-latest-flaky (push) Has been cancelled
python / test-ubuntu-latest-not-flaky (push) Has been cancelled
python / test-windows-latest-flaky (push) Has been cancelled
python / test-windows-latest-not-flaky (push) Has been cancelled
73 lines
1.2 KiB
Svelte
73 lines
1.2 KiB
Svelte
<script lang="ts">
|
|
import JSON from "./shared/JSON.svelte";
|
|
|
|
let {
|
|
value,
|
|
theme_mode = "system" as "system" | "light" | "dark",
|
|
type,
|
|
selected = false
|
|
}: {
|
|
value: any;
|
|
theme_mode?: "system" | "light" | "dark";
|
|
type: "gallery" | "table";
|
|
selected?: boolean;
|
|
} = $props();
|
|
|
|
let show_indices = $state(false);
|
|
let label_height = $state(0);
|
|
</script>
|
|
|
|
<div
|
|
class="container"
|
|
class:table={type === "table"}
|
|
class:gallery={type === "gallery"}
|
|
class:selected
|
|
class:border={value}
|
|
>
|
|
{#if value}
|
|
<JSON
|
|
{value}
|
|
open={true}
|
|
{theme_mode}
|
|
{show_indices}
|
|
{label_height}
|
|
interactive={false}
|
|
show_copy_button={false}
|
|
/>
|
|
{/if}
|
|
</div>
|
|
|
|
<style>
|
|
.container :global(img) {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.container.selected {
|
|
border-color: var(--border-color-accent);
|
|
}
|
|
.border.table {
|
|
border: 1px solid var(--border-color-primary);
|
|
}
|
|
|
|
.container.table {
|
|
margin: 0 auto;
|
|
border-radius: var(--radius-lg);
|
|
overflow: hidden;
|
|
width: 100%;
|
|
height: 100%;
|
|
max-width: var(--size-40);
|
|
max-height: var(--size-20);
|
|
object-fit: cover;
|
|
}
|
|
|
|
.container.gallery {
|
|
width: 100%;
|
|
max-width: 100%;
|
|
object-fit: cover;
|
|
max-width: var(--size-40);
|
|
max-height: var(--size-20);
|
|
overflow: hidden;
|
|
}
|
|
</style>
|