vmware-archive / clarity

Clarity is a scalable, accessible, customizable, open source design system built with web components. Works with any JavaScript framework, built for enterprises, and designed to be inclusive.
http://clarity.design
MIT License
6.42k stars 761 forks source link

feat(core): clean up clarity motion decorator #6513

Closed mathisscott closed 2 years ago

mathisscott commented 2 years ago

Signed-off-by: Scott Mathis smathis@vmware.com

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

Initially, the scope of work was to convert the @animate class decorator into a Reactive Controller. As development got underway, it became clear that a reactive controller would not meet our needs.

The decorator needed access to props. Reactive controllers don't get those. The decorator also needed to interject itself in the updated lifecycle loop. Specifically, at a point in time prior to the component running its own updated callbacks. The reactive controller can't do that either.

That said, we learned somethings from the datagrid work and I was able to clean up the animate decorator and eliminate the need for the implements Animatable step – removing the Animatable interface entirely.

I also added some guards and moved a couple of things around (moving the _animations config to the instance instead of (errantly on my part) the constructor. Anecdotally, this seemed to improve performance (slightly).

Does this PR introduce a breaking change?

vmwclabot commented 2 years ago

@mathisscott, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <john.doe@email.org> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.