impr: merge mono-ui with photon (#455)

This commit is contained in:
Xylight authored and GitHub committed 2024-09-24 19:33:52 -07:00
1 parent 16075f72f2
commit 180d6fcc0d
40 files changed
+2024 -1

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
<script lang="ts">
import { browser } from '$app/environment'
// https://github.com/sveltejs/svelte/issues/3088#issuecomment-505785516
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
let slottedElements: HTMLDivElement, portal: HTMLDivElement
const dispatch = createEventDispatcher<{ mounted: void }>()
onMount(() => {
if (!browser) return
portal = document?.createElement('div')
if (portal) portal.className = 'portal-mount'
document?.body.appendChild(portal)
portal?.appendChild(slottedElements)
dispatch('mounted')
})
onDestroy(() => {
portal.remove()
})
</script>
<div class="portal-initial-mount-point">
<div bind:this={slottedElements} class="portal-content {$$props.class || ''}">
<slot />
</div>
</div>
<style>
.portal-initial-mount-point {
display: none;
}
</style>