import { resolveVariantFromProps } from './resolve-variants.mjs'; /** * Creates an object containing the latest state of every MotionValue on a VisualElement */ function getCurrent(visualElement) { const current = {}; visualElement.values.forEach((value, key) => (current[key] = value.get())); return current; } /** * Creates an object containing the latest velocity of every MotionValue on a VisualElement */ function getVelocity(visualElement) { const velocity = {}; visualElement.values.forEach((value, key) => (velocity[key] = value.getVelocity())); return velocity; } function resolveVariant(visualElement, definition, custom) { const props = visualElement.getProps(); return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, getCurrent(visualElement), getVelocity(visualElement)); } export { resolveVariant };