-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the problem
I have encountered an issue when migrating from Svelte 4 to Svelte 5 where my application fails due to the removal of the svelte/internal module. Specifically, I was using create_in_transition from svelte/internal to implement custom page transitions in a mobile app.
Error Message:
Error: Your application, or one of its dependencies, imported from 'svelte/internal', which was a private module used by Svelte 4 components that no longer exists in Svelte 5. It is not intended to be public API. If you're a library author and you used 'svelte/internal' deliberately, please raise an issue on https://github.com/sveltejs/svelte/issues detailing your use case.
Code Snippet:
Here is the code I used in Svelte 4:
import { create_in_transition } from "svelte/internal";
let intro = create_in_transition(document.querySelector("#page-" + page), fly, {
x: previousPage < page ? -100 : 100,
duration: 250,
});
intro.start();
Use Case:
I am developing a mobile app where all pages are pre-rendered and fully loaded in the DOM. However, I still want smooth transitions between pages when the user navigates. In Svelte 4, I used the create_in_transition function from svelte/internal to manage these transitions based on the current and previous page.
Why Standard Transitions Won't Work:
I couldn't use Svelte’s standard transitions (e.g., the transition directive with if blocks) because standard transitions only trigger when elements are added or removed from the DOM. Using them with if implies that the pages would only be loaded when they are displayed, which isn't suitable for my use case. In my app, all pages are already in the DOM, and I want to transition between them without reloading or re-rendering content.
Describe the proposed solution
Could you please provide guidance on how to handle this use case in Svelte 5, or consider making create_in_transition or an equivalent API available? I understand that svelte/internal was not intended as a public API, but this functionality is crucial for my mobile app’s user experience.
Thank you for your attention!
Importance
would make my life easier