definitions.mjs 801 B

12345678910111213141516171819202122232425262728
  1. const featureProps = {
  2. animation: [
  3. "animate",
  4. "variants",
  5. "whileHover",
  6. "whileTap",
  7. "exit",
  8. "whileInView",
  9. "whileFocus",
  10. "whileDrag",
  11. ],
  12. exit: ["exit"],
  13. drag: ["drag", "dragControls"],
  14. focus: ["whileFocus"],
  15. hover: ["whileHover", "onHoverStart", "onHoverEnd"],
  16. tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
  17. pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
  18. inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
  19. layout: ["layout", "layoutId"],
  20. };
  21. const featureDefinitions = {};
  22. for (const key in featureProps) {
  23. featureDefinitions[key] = {
  24. isEnabled: (props) => featureProps[key].some((name) => !!props[name]),
  25. };
  26. }
  27. export { featureDefinitions };