Skip to content
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

Add a component scope to transitions #8850

Open
oodavid opened this issue Jun 26, 2023 · 1 comment
Open

Add a component scope to transitions #8850

oodavid opened this issue Jun 26, 2023 · 1 comment
Labels

Comments

@oodavid
Copy link

oodavid commented Jun 26, 2023

Describe the problem

It would be useful to have a component scope for transitions so that we can limit our transitions to the component.

This would let us be confident how a transition will behave without knowing anything about how the component is being used.

The issue with global scope is the behaviour depends on whether the component is inside a block or not.
With local scope, we cannot animate within nested blocks.

I've created a REPL playground:

https://svelte.dev/repl/30f6e9d08aa2466daab7eaa0f739076f?version=4.0.0

And recorded a short video explaining the idea / issue:

https://www.loom.com/share/a25fc70f3987474ea3fbe647e1716a10

Describe the proposed solution

Adding transition:slide|component that limits the scope of transitions to the current component.

Alternatives considered

None

Importance

would make my life easier

@oodavid
Copy link
Author

oodavid commented Jun 26, 2023

One of the best things about Svelte is having all component parts in a single file (ie: the script, HTML and style). Because of this, it might even make sense for component to be the default behaviour for transitions.

I know this has been a breaking change in 4.0.0, so I understand if there would be push-back against this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants