Skip to content

Commit

Permalink
perf: update transition-default Tailwind util to only target common…
Browse files Browse the repository at this point in the history
…, animatable properties (#8797)

**Related Issue:** #8571 

## Summary

This updates the `transition-default` to explicitly list common,
animatable properties to the following:

* `background-color`
* `block-size`
* `border-color`
* `box-shadow`
* `color`
* `inset-block-end`
* `inset-block-start`
* `inset-inline-end`
* `inset-inline-start`
* `inset-size`
* `opacity`
* `outline-color`
* `transform`

This should improve rendering performance by omitting other props that
are unintentionally being animated (see
https://vallek.github.io/animatable-css/#anim).
  • Loading branch information
jcfranco committed Feb 29, 2024
1 parent 17ede29 commit f4d016b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/calcite-components/calcite-preset.ts
Expand Up @@ -280,7 +280,9 @@ export default {
"outline-offset": invert("-2px", "--calcite-offset-invert-focus"),
},
".transition-default": {
transition: "all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s",
transition:
// we explicitly list these properties to avoid animating properties that are not intended to be animated and that might affect performance
"background-color, block-size, border-color, box-shadow, color, inset-block-end, inset-block-start, inset-inline-end, inset-inline-start inset-size, opacity, outline-color, transform var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s",
},
};
addUtilities(newUtilities);
Expand Down

0 comments on commit f4d016b

Please sign in to comment.