16 lines
633 B
JavaScript
16 lines
633 B
JavaScript
|
import { resolveCSSVariables } from './css-variables-conversion.mjs';
|
||
|
import { unitConversion } from './unit-conversion.mjs';
|
||
|
|
||
|
/**
|
||
|
* Parse a DOM variant to make it animatable. This involves resolving CSS variables
|
||
|
* and ensuring animations like "20%" => "calc(50vw)" are performed in pixels.
|
||
|
*/
|
||
|
const parseDomVariant = (visualElement, target, origin, transitionEnd) => {
|
||
|
const resolved = resolveCSSVariables(visualElement, target, transitionEnd);
|
||
|
target = resolved.target;
|
||
|
transitionEnd = resolved.transitionEnd;
|
||
|
return unitConversion(visualElement, target, origin, transitionEnd);
|
||
|
};
|
||
|
|
||
|
export { parseDomVariant };
|