prep: replace $$props.class with props

This commit is contained in:
Xylight committed 2024-10-23 19:55:20 -07:00
1 parent 3ca72662ca
commit 0718c8e0c6
69 files changed
+383 -214

No files matched your search

+25 -22
View File
@@ -1,34 +1,37 @@
<script lang="ts">
import { browser } from '$app/environment'
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
// 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 }>()
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')
})
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()
})
onDestroy(() => {
portal.remove()
})
let clazz: string = ''
export { clazz as class }
</script>
<div class="portal-initial-mount-point">
<div bind:this={slottedElements} class="portal-content {$$props.class || ''}">
<slot />
</div>
<div bind:this={slottedElements} class="portal-content {clazz || ''}">
<slot />
</div>
</div>
<style>
.portal-initial-mount-point {
display: none;
}
.portal-initial-mount-point {
display: none;
}
</style>