-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte 5 Compatibility #133
Comments
I think you mean package @slidy/svelte...🤔 |
Thank you very much! Do you have any idea about the svelte:fragments ?
Is there a way to hide the The svelte migration tool converted from something like this
To something like this, and it works, however, it doesn't work with
|
Sorry, I don't understand you... can you explain in playground more detailed code? |
Hey, big fan of your library. I just wanted to give help out here with a new svelte 5 update changes. Svelte 4 let us do named slots like below where we use svelte:fragments. This is directly from you guys' docs: <Slidy>
<svelte:fragment slot="arrows">
<button data-step="-1"> Show the previous slide </button>
<button data-step="1"> Show the next slide </button>
</svelte:fragment>
</Slidy> But now in svelte 5 we no longer have Hope that helps! Happy coding. |
Tx @hiromon0125 it became clearer, but it's |
Thanks @Valexr and @hiromon0125 I don't have a REPL account, and saving the playground was challenging. Thanks for stepping in. Here is a comparison between slots in (Svelte 4) and Render in (Svelte 5).
|
The
I guess, somewhere in the the Slidy library https://github.com/Valexr/Slidy/blob/main/packages/svelte/src/components/Slidy/Slidy.svelte#L135C2-L158C7, the snippet will be rendered with |
Yeah I think @scart88's idea is correct. In terms of how to convert svelte 4 to svelte 5, we would just declare a snippet function for each "name" slot. <script>
let { arrow, arrows, default, navItem, overlay, thumbnail, children} = $props();
</script>
{#snippet counter()}
<output class="{classNames?.counter}">
{format(i18n.counter, index + 1, length)}
</output>
{/snippet}
{#snippet defaultChildren(item)}
{#if !background}
<Image src={getImgSrc(item)} {...item} />
{/if}
{/snippet}
<section>
{@render (overlay ?? counter)()}
<Core >
{#snippet children()} // This is core's children
{#each slides as item, i (item.id ?? getImgSrc(item) ?? i)}
{@const active = i === index}
<li>
{@render (children ?? defaultChildren)(item)}
</li>
{/each}
{/snippet}
</Core >
... more {@render snippetItem} stuff down here
</section> I am also still trying to understand all of the things that changed with this new version of svelte, so I could be wrong here. |
Looks like new major version of @slidy/svelte with 5 compatibility 🤔 |
@hiromon0125 & @scart88 if you have ideas, PR welcome. @EricRovell (core maintainer @slidy/svelte) can do this near NewYear holidays… |
I want to help because I'm a big fan of Slidy. However, I'm still learning Svelte, so I don't think I'm the best person to do it; however, I can try to see how I can help. I discovered a minor bug in Svelte 5. If the slide item content changes when (e.g., clicking on a button or changing an item in a select element), the slides shift similarly to the Is there a way to prevent or stop the slide from moving if a user interacts with a slide item? Thank you! |
I think it’s just reactivity depending in Slidy props… or if you interacting with wrapper section (it’s listening click event)… but for more constructive dialog, I ask you to create a playground. Auth in it for saving examples, just auth in GitHub third party app… it’s safe 🤓 |
Thanks! I just created a Playground If you click the "Check" button, I'm using an If the class name changes, it works as expected. However, it doesn't work if you use if/else to update content inside the slide item. Please let me know your thoughts. Thank you! |
Update: |
Fixed - check Playground |
Thank you so much for fixing this so quickly! |
Tx you for bug-report 👍🏻 |
Hey @Valexr
Is this library compatible with Svelte 5?
Thank you!
The text was updated successfully, but these errors were encountered: