I'm trying to animate this list of Widgets. Of course I can't just animate:flip a component, Svelte needs a DOM element.
<!-- invalid -->
{#each widgets as widget (widget.id)}
<Widget {...widget} animate:flip/>
{/each}
I normally would have solved it with a simple container div:
<!-- does not apply to my situation -->
{#each widgets as widget (widget.id)}
<div animate:flip>
<Widget {...widget} />
</div>
{/each}
However, as I'm using a CSS Grid around the #each, I need Widget to be the immediate child. I can't wrap it in anything. How can I solve this? Is there any way to pass animate:flip to the Widget component and handling it there?
Here is a REPL of what I'm trying to achieve. I'm unable to get the same behaviour when each row (containing three cells) is a Component.