Comments (8)
I think it would be fine to yield out the boolean value, the same way animated-value does it.
Otherwise you can say:
from ember-animated.
I just stumbled into the same issue. I was using animated-if
to display a modal dialog roughly like this:
I discovered Ed's solution before I found this issue here, but it's not really a good solution either. Example:
If you use a computed property based on the animated-if
predicate it would still fail.
Is there a solution to this other than using the as |data|
workaround? Would it be possible to stop DOM updates for removed sprites until they change their state to kept
again? I have a feeling that this would require significant changes to the library, but that would be the behavior that I expect from animated-if
.
from ember-animated.
from ember-animated.
Well, the more I think about it, there is probably a solution in the library itself. It would be interesting to try it.
We would use an AST transform to find all the paths inside the blocks that are passed to animator components, and rewrite them so they're wrapped in a (private) helper that we provide. The helper can freeze its output during critical times. It would probably have a rendering performance impact, though it's hard to guess if it's significant without trying it.
A more efficient variant would use Ember private API to implement the helper, so the helper has direct access to glimmer references, in which case we can probably make it very cheap. Because instead of rerunning our helper all over the place, we could just establish a reference that has the right updating behavior, and glimmer will know what to do with it.
from ember-animated.
can you elaborate on how that helper would look like?
from ember-animated.
It would be a class-based helper so it can control when it recomputes.
When nothing is animating, it would output its input. But when things are animating (which it would determined based on some subscription to the -ea-motion
service), it would keep outputting a constant value, even if its input changes, until the animation ends and then it recomputes to output its real input again.
The AST Transform may be annoying to get right because of the remaining ambiguity in curlies. We could consider making this new thing a glimmer-component-only feature, because I'm pretty sure the ambiguity isn't allowed there (you're required to access arguments via @
and I think you're required to access component properties via this.
). But the idea would be to rewrite all values (not component invocations or helper invocations, which is why there's an ambiguity issue) that appear inside the block passed to animated-if (and the other animators) like:
Since rendering always happens top-down, a change that causes animation will hit ancestors of the helper first, which can warn the helper via the service before the corresponding change comes down to the helper itself and tries to make it recompute.
The more performant version of the -ea-guard
helper would use private API to directly access the reference system. Instead of running each time its input changes and deciding which output to use, the first time it runs it would setup a glimmer reference that only invalidates when it's told to invalidate.
from ember-animated.
I checked and I was wrong about glimmer component. It still allows the ambiguous this
fallback.
Instead we could require people to use the (now default) template lint rule that requires explicit this
.
from ember-animated.
Meanwhile, supporting
would help in many cases, right?
or is it strictly the same as this?
from ember-animated.
Related Issues (20)
- [DOCS] Initial homepage for ember-animated has too much whitespace between lines HOT 1
- Embroider Compatibility: animated-container's dynamic Tag breaks build HOT 3
- Information on testing ember-animated in docs HOT 2
- Why do we need `assert-never` in `dependencies`? HOT 2
- Ember Global deprecation warning due to old version of ember-cli-babel in ember-animated HOT 2
- Consider public export of TransitionContext type HOT 1
- Attempted to resolve -element, which was expected to be a helper, but nothing was found HOT 5
- Embroider: ember-animated is trying to import from rsvp but that is not one of its explicit dependencies HOT 1
- 1.x breaks animated-outlet HOT 10
- TypeError: yield* (intermediate value)(intermediate value) is not iterable after removing IE11 from transpilation targets HOT 1
- `startTranslatedBy` and `endTranslatedBy` modify the initial and final bounds width/height
- AnimatedOrphans' documentation looks broken HOT 2
- Memory leak in emberAnimatedSingleton HOT 6
- Incompatibility with ember-element-helper v0.6.1 and Embroider optimized HOT 8
- Types are not resolveable with sufficiently new enough TypeScript
- Error after upgrade from `1.0.4` to `1.1.0` HOT 3
- Glint ember-animated/template-registry not found HOT 2
- v1.1.3 is missing type declarations HOT 4
- Documentation code examples rendering wrong
- App broken after upgrade from 2.0.0 to 2.0.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-animated.