Open dummdidumm opened 3 years ago
Not directly an issue with Svelte itself, but...
If this gets merged and lets you apply undefined
to a transition:
it could possibly mean this will be solved as well:
https://github.com/testing-library/svelte-testing-library/issues/206 Where the only workaround I found was to explicitly create two different elements - one for testing and one for real use.
{#if import.meta.env.VITEST}
<div data-testid="alert" role="alert">
....
</div>
{:else}
<div
data-testid="alert"
role="alert"
transition:fly
>
....
</div>
{/if}
notice the transition can only be applied if not in VITEST env, if any kind of transition: directive is applied the tests will fail
This would still be really nice, actions are super-powerful but weirdly static compared to how reactive the rest of svelte is currently.
It would be great if we could also have an imperative transition API as an escape hatch for advanced use cases. I would really like to have manual control over:
Now these framework features are exclusive to transitions. Having an explicit API would open many possibilities for library authors.
Describe the problem
Svelte encourages reactivity at many levels, but when it comes to actions, transitions, or animations, it's rather static:
Describe the proposed solution
Support swapping out directives
Alternatives considered
Workaround code involving
#if
sImportance
nice to have