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
Implement dynamic animations for all components #1322
Comments
Got it noted to check tonight! |
Personally I think having an option for a single value or an array pair works better than separate In/Out prop values. Having separate props for things that should be in pairs will lead to having an exhaustive amount of props on any component that needs fine tune control - akin to Tailwind CSS when you need dark/light/responsive properties, which entire libraries such as WindiCSS tried to fix. Related values should always stick together, imo. |
I was noodling this exact idea, so I think you've validated that for me. I'll adjust the proposal above to account for this. Revised as follows:
|
@endigo9740 List of Components & Utilities with what transitions and animations are applied to them currently. Components
Utilities
|
Imo, I would even go a step further: transition = {
in: [transition, {params}],
out: [transition, {params}]
} If the user doesn't include one, (...)spread the defaults And then to apply same transition to both in/out both: transition = [transition, {params}] |
@JustBarnt thanks, there's quite a few as I suspected. Thank you for detailing which specific transitions are used as well. This does highlight the fact that some components use multiple transitions, so we need to take that into consideration. @saturnonearth perhaps, but let me think about it a bit longer. I realize it's technically possible, but I could see some users being confused into thinking they always have to supply both in/out, even if we know that's not the case. Remember we're building for a wide audience, and things like this can trip up more folks than you might realize. |
@JustBarnt will not have time to resolve this, so this is open for anyone to jump on! Volunteers welcome! |
FYI I'm going to fold this request into this update: I'll go ahead and close out the original ticket in favor of handling this here. |
I would love to work on this issue. |
@Mahmoud-zino I'm typically away on weekends, if you don't mind let's sync on Discord on Monday (US central time) for this. I want to understand you understand the requirements and ensure I'm available if you have questions. Please and thanks! |
@endigo9740 yeah sure, sounds good. |
@Mahmoud-zino To update a couple points from the thread - I think we're keen to follow the pattern established by the action/actionParams props. The complexity here comes from the fact we have to handle both in and out animations. However, I like @saturnonearth suggestion here for the format: But rather than trying to bundle everything into a single prop, we implement something like this: export let transition = [transition, {params}];
export let transitionIn = transition;
export let transitionOut = transition; I know it's not as compact, but the reason for this is in most cases we match the same transition on in/out already. We may want to destructure these (the naming is merely a suggestion): const {tIn, tInParams} = transitionInData;
const {tOut, tOutParams} = transitionOutData; We will for sure want to ensure we're using the <div in:tIn={tInParams} out:tOut={tOutParams}> We'll also want to make sure to we set the same default transitions and param settings to match the current components. So if a component is using a fly for in/out with duration 200, make sure we match that as the defaults. |
@saturnonearth Reminder to revisit this animation when these changes above are implemented: |
Describe what feature you'd like. Pseudo-code, mockups, or screenshots of similar solutions are encouraged!
There will be multiple parts to this process:
duration
props as depreciated. Keep them for backwards compatibility for now, but they will no longer be used. Removing them would be a breaking change.https://github.com/skeletonlabs/skeleton/blob/dev/src/lib/components/Avatar/Avatar.svelte#L18
Per that last point, I believe transitions are functions, like actions. I also anticipate both the transition and it's params will need to be passed, like so:
transitionIn: [transition, {params}]
- handles the entry transition and params.transitionOut: [transition, {params}]
- handles the exit transition and params.I'm not opposed to the default
transitionX
props using the same canned Svelte animations they do currently. This would mean that users get the same "eye candy" out of the box they do now.I'd expect the default value for the param props would be an object containing only the duration value, as I believe this is the only standard key between all transitions:
export let transitionIn = [slide, { duration: 200 }];
If you have any questions about this please let me know.
What type of pull request would this be?
Enhancement
Any links to similar examples or other references we should review?
Here's how we handle passing an action/actionParams as part of the Avatar component:
https://github.com/skeletonlabs/skeleton/blob/dev/src/lib/components/Avatar/Avatar.svelte#L14
Here's Svelte's tutorial about the split in/out transition attributes:
https://svelte.dev/tutorial/in-and-out
Here's the Svelte tutorial about custom transitions. They are functions, similar to Actions:
https://svelte.dev/tutorial/custom-css-transitions
The text was updated successfully, but these errors were encountered: