Spaces:
Paused
Paused
Download src/lib/components/Portal.svelte from maksym-work/chat_ui: direct link, hf CLI and curl.
- Browser
- Download file 449 Bytes
-
https://huggingface.co/spaces/maksym-work/chat_ui/resolve/main/src/lib/components/Portal.svelte
- Command line
-
hf download hf://spaces/maksym-work/chat_ui/src/lib/components/Portal.svelte
-
curl -L -o Portal.svelte https://huggingface.co/spaces/maksym-work/chat_ui/resolve/main/src/lib/components/Portal.svelte
449 Bytes
| <script lang="ts"> | |
| import { onMount, onDestroy } from "svelte"; | |
| interface Props { | |
| children?: import("svelte").Snippet; | |
| } | |
| let { children }: Props = $props(); | |
| let el: HTMLElement | undefined = $state(); | |
| onMount(() => { | |
| el?.ownerDocument.body.appendChild(el); | |
| }); | |
| onDestroy(() => { | |
| if (el?.parentNode) { | |
| el.parentNode.removeChild(el); | |
| } | |
| }); | |
| </script> | |
| <div bind:this={el} class="contents" hidden> | |
| {@render children?.()} | |
| </div> | |