Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm not sure if this adds too much complexity to the library, but, for my uses, I didn't want a 'hidden' class added to the end of every leave transition. This would allow the library to be used for simple animations that don't result in visibility changes. I went through a couple iterations with the goal of preserving the same invocation syntax, except now it checks for two additional data attributes.
This PR adds
data-transition-enter-final
anddata-transition-leave-final
. These classes get added at the end of their respective directions, and get removed at the beginning of their opposition directions. It preserves thehidden
default by adding a defaultdata-transition-leave-final
attribute ofhidden
.enter()
andleave()
now track their last status by settings adata-transitioned
attribute, rather than the presence of css classes. With the presence of potential multipletransition-leave-final
classes, checking the transitioned status would be complicated. I thought leveraging another data attribute would be more precise and consistent.I understand if this is more complicated than you want to make the library, but I wanted to at least make a PR in case you found it valuable to add this extra flexibility. Javascript is not my primary language so also completely happy to make syntax changes if you like the functionality but not the look!