scrape-motion-values.mjs 688 B

12345678910111213141516171819
  1. import { isForcedMotionValue } from '../../../motion/utils/is-forced-motion-value.mjs';
  2. import { isMotionValue } from '../../../value/utils/is-motion-value.mjs';
  3. function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
  4. const { style } = props;
  5. const newValues = {};
  6. for (const key in style) {
  7. if (isMotionValue(style[key]) ||
  8. (prevProps.style &&
  9. isMotionValue(prevProps.style[key])) ||
  10. isForcedMotionValue(key, props) ||
  11. visualElement?.getValue(key)?.liveStyle !== undefined) {
  12. newValues[key] = style[key];
  13. }
  14. }
  15. return newValues;
  16. }
  17. export { scrapeMotionValuesFromProps };