import { CSSProperties } from "react" ; export function refreshElement ( el ) { el . offsetHeight ; } export function setElementTransforms ( el , props ) { Object . entries ( props ) . forEach ( ( [ key , val ] ) : void => { if ( key === "transform" ) { el . style . webkitTransform = val ; } el . style [ key ] = val ; } ) ; return el ; } export function prepareElementForAnimaton ( el , props ) { el . style . webkitBackfaceVisibility = "hidden" ; el . style . backfaceVisibility = "hidden" ; setElementTransforms ( el , props ) ; return el ; } export function resetElementTransition ( el ) { el . style . webkitTransition = "none" ; el . style . transition = "none" ; return el ; } export function getTransformCompatibilityString ( transition ) { let string = null ; if ( transition . indexOf ( "transform" ) !== - 1 && transition . indexOf ( "-webkit-transform" ) === - 1 ) { string = transition . replace ( "transform" , "-webkit-transform" ) ; } return string ; } export function setElementTransitions ( el , transitions ) { let transitionString = transitions . join ( "," ) ; let compatibilityString = getTransformCompatibilityString ( transitionString ) ; if ( compatibilityString ) { el . style . webkitTransition = compatibilityString ; } el . style . webkitTransition = transitionString ; if ( compatibilityString ) { el . style . transition = compatibilityString ; } el . style . transition = transitionString ; return el ; } export function resetCSSAndFireCallback ( dom , callback ? ) { dom . style . cssText = "" ; if ( typeof callback === "function" ) { callback ( ) ; } } export function clearElementAnimationsStyles ( el ) { el . style . display = "" ; el . style . opacity = "" ; el . style . transform = "" ; el . style . transition = "" ; el . style . webkitTransform = "" ; el . style . webkitTransition = "" ; el . style . zIndex = "" ; el . style . webkitBackfaceVisibility = "" ; el . style . backfaceVisibility = "" ; }