CoolFace
Datasetpublic

gradio/frontend

sourceHugging Faceupdated 19h agoView on Hugging Face
1likes442kdownloads
Example.svelte31 linesDownload Raw Back to code
1<script lang="ts">2	interface Props {3		value: string | null;4		type: "gallery" | "table";5		selected?: boolean;6	}7 8	let { value, type, selected = false }: Props = $props();9 10	function truncate_text(text: string | null, max_length = 60): string {11		if (!text) return "";12		const str = String(text);13		if (str.length <= max_length) return str;14		return str.slice(0, max_length) + "...";15	}16</script>17 18<pre19	class:table={type === "table"}20	class:gallery={type === "gallery"}21	class:selected>{truncate_text(value)}</pre>22 23<style>24	pre {25		text-align: left;26	}27	.gallery {28		padding: var(--size-1) var(--size-2);29	}30</style>31