romkor / svelte-portal

Svelte component for rendering outside the DOM of parent component
https://svelte.dev/repl/407576d4fa984cfb97dcdd3da98e833e
MIT License
444 stars 22 forks source link

chore: Support Svelte 5 and switch to SvelteKit library mode #182

Closed wobsoriano closed 1 month ago

wobsoriano commented 4 months ago

This PR refactors the codebase to use SvelteKit library mode when packaging the app. Removed the demo packages and moved the Vite demo as playground.

Vitest has been setup for unit testing the components. Super fast!

Updated peer deps as well to support Svelte 3-5.

Fixes https://github.com/romkor/svelte-portal/issues/180 and https://github.com/romkor/svelte-portal/issues/176

Razunter commented 3 months ago

Not caused by the PR, but this code causes element to be undefined in onMount with Svelte 5 and works fine with Svelte 4

<button>
use:portal={'body'}
bind:this={element}
...

UPD: https://github.com/sveltejs/svelte/pull/12679