-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Transitions fix #4742
Transitions fix #4742
Conversation
Thank you so much for this PR, but please avoid adding unrelated changes, and in particular please never commit style changes even if you think they're uncontroversial. I really don't want to reject this PR, it represents a lot of important work, but there's simply no world in which it can be merged in its current state. A number of the changes are things that already exist in some form (e.g. Is it possible to break this up into PRs that focus on individual issues? I tried to look at it locally just now to see if I could start isolating parts of it, but even that's difficult because the style changes and TypeScript additions have caused a number of merge conflicts. |
The PR is still a draft so it's really not meant to be merged as is, I implemented changes optimistically and put it up for feedback, there are still things to do, docs to write and tests to pass I resolved conflicts and rolled back
Ah yes I forgot to write about that,
Css and about every easing library out there does have a default easing function, I don't think it's a big deal adding an alias for it.
I just don't think breaking changes for
Could you list them ? I'm not sure there is as many unrelated changes as it looks like A performant solution required a rewrite of each of those, and this PR would make Svelte the most performant runtime animation library by far, at least that I know of. Next on my list was to implement framer's "motion magic", gestures and dragging into svelte, but that's just not doable without the new spring API |
@pushkine I'm afraid we can't comment on a PR with 300+ file changes. There's just nowhere to start. Please either undo all the style changes, as Rich suggested, or do something to break it up into manageable pieces—multiple PRs or whatever. I think we're all in agreement that some of these changes overall would probably be fantastic, but it's a complete non-starter with the unwieldy size. Please undo all unnecessary prettier, eslint, and other style changes as a starting point so we can move any other discussion along. |
@arxpoetica |
Implements https://twitter.com/pushkine_/status/1254903272374231042
Resolves #4344
Fixes #4732
Fixes #4842
Fixes #4794
Fixes #4787
Fixes #4784
Fixes #4831
Changelog
Package
css-tree
andperiscopic
as they break the compiler.Rollup config
__VERSION__
as a global & replace that instead of the quoted version of itTests
ts-mocha
,esm
@types/jsdom
,@types/puppeteer
tiny-glob
Compiler
legacy
compile option as it was only used once in the whole thingEach
Providing an alternate compiler path specifically for array literals ( i.e. arrays with the fewest amount of items ) is just not worth the amount of additional code and potential bugs
Animations / Transitions
strategy
: new parameter"reverse"
(default) |"mirror"
.Defines the way transition easing is computed
reverse
always eases from 0 to 1 no matter the direction,mirror
goes from 0 to 1 on intro and 1 to 0 on outroRuntime
svelte/internal
svelte/easing
easeIn
,easeOut
,easeInOut
as aliases ofquartIn
,quartOut
,quartInOut
cubicBezier
svelte/store
svelte/motion
. Everything is internal, no changes.BREAKING CHANGES
svelte/motion
Rewrote everything
Springs
damping
now ranges from0.1 to 20
,stiffness
now rangesfrom 10 to 200
,soft
andhard
are not a thing anymoremass
: new parameter, scales the equation uniformly, see graphing for reference.soft
: new parameter, forces the spring to match a critically damped oscillation, i.e. gently transitions without oscillating..setImmediate
: new method, sets value immediately, sets velocity to 0..onRest
: new method, the passed callback is called every time the spring settles, returns an unsubscriber..set
: does not return a Promise anymore, returns a thenable instead. Effectively what this means is that you cannot use.catch
on it, everything else works like a Promise would.Tweens
tweened
does not interpolate between dates automatically anymore..setImmediate
: new method, sets value immediately..onRest
: new method, the passed callback is called every time the tween settles, returns an unsubscriber..set
: does not return a Promise anymore, returns a thenable instead. Effectively what this means is that you cannot use.catch
on it, everything else works like a Promise would.New packages
[rolled back]
svelte/environmentEnvironment checks & variables are slowly stacking up and as a front-end framework it only makes sense to expose them
globals
is_browser
: simplewindow
checkframerate
: milliseconds per frame, used in css keyframe generation as well as insvelte/motion
now
:performance.now
orDate.now
depending on the environmentis_iframe
: true when run inside an iframe.is_cors
: true when run inside a cross domain iframe, used inadd_resize_listener
internally.has_Symbol
: true when the environment supports Symbols. Used in a dev check internally.set_framerate
,set_raf
,set_now
svelte/interpolate
New package for tween interpolation.
numbers
: interpolate between numbers.strings
: interpolate between strings of constant shape with variable numbers.dates
: interpolate between dates.svelte.dev/examples
Animations
Springs
Easing Visualizer
What's left
Every test is passing except for a few ones whose folder name has
.skip
in it. All are seemingly unrelated to the changes, I failed every attempt to fix them, but they are legitimate. Need to write a bunch of tests too, waiting for feedback