scrape-motion-values.mjs 840 B

12345678910111213141516171819
  1. import { isMotionValue } from '../../../value/utils/is-motion-value.mjs';
  2. import { transformPropOrder } from '../../html/utils/keys-transform.mjs';
  3. import { scrapeMotionValuesFromProps as scrapeMotionValuesFromProps$1 } from '../../html/utils/scrape-motion-values.mjs';
  4. function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
  5. const newValues = scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
  6. for (const key in props) {
  7. if (isMotionValue(props[key]) ||
  8. isMotionValue(prevProps[key])) {
  9. const targetKey = transformPropOrder.indexOf(key) !== -1
  10. ? "attr" + key.charAt(0).toUpperCase() + key.substring(1)
  11. : key;
  12. newValues[targetKey] = props[key];
  13. }
  14. }
  15. return newValues;
  16. }
  17. export { scrapeMotionValuesFromProps };