-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
94 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte'; | ||
import { Portal, Limbo, teleport } from '$lib'; | ||
let component: HTMLElement; | ||
function send(label: string) { | ||
return () => { | ||
teleport(component, label); | ||
}; | ||
} | ||
onMount((): void => send('a')()); | ||
</script> | ||
|
||
<main> | ||
<Limbo bind:component> | ||
<input placeholder="Enter unkept state" /> | ||
</Limbo> | ||
<div class="container"> | ||
<h1>Container A</h1> | ||
<Portal key="a" {component} /> | ||
<button on:click={send('a')}>Move Component Here</button> | ||
</div> | ||
<div class="container"> | ||
<h1>Container B</h1> | ||
<Portal key="b" {component} /> | ||
<button on:click={send('b')}>Move Component Here</button> | ||
</div> | ||
</main> | ||
|
||
<style> | ||
.container { | ||
border: 1px solid black; | ||
margin: 1rem; | ||
padding: 1rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters