Add TriggerV2

This commit is contained in:
Kwaroran
2025-02-15 21:29:37 +09:00
parent dffc5ee65e
commit d2fce340bb
14 changed files with 3087 additions and 38 deletions

View File

@@ -0,0 +1,24 @@
<script lang="ts">
import { getAllContexts, mount, unmount } from "svelte";
//@ts-ignore
import PortalConsumer from "./PortalConsumer.svelte";
interface Props {
target?: HTMLElement;
children: any;
}
const { target: target = document.body, children }:Props = $props();
const context = getAllContexts();
let instance;
$effect(() => {
instance = mount(PortalConsumer, { target, props: { children }, context })
return () => {
unmount(instance);
}
});
</script>

View File

@@ -0,0 +1,7 @@
<script lang="ts">
const { children } = $props();
</script>
{#if children}
{@render children()}
{/if}