29 lines
801 B
JavaScript
29 lines
801 B
JavaScript
|
const featureProps = {
|
||
|
animation: [
|
||
|
"animate",
|
||
|
"variants",
|
||
|
"whileHover",
|
||
|
"whileTap",
|
||
|
"exit",
|
||
|
"whileInView",
|
||
|
"whileFocus",
|
||
|
"whileDrag",
|
||
|
],
|
||
|
exit: ["exit"],
|
||
|
drag: ["drag", "dragControls"],
|
||
|
focus: ["whileFocus"],
|
||
|
hover: ["whileHover", "onHoverStart", "onHoverEnd"],
|
||
|
tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
|
||
|
pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
|
||
|
inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
|
||
|
layout: ["layout", "layoutId"],
|
||
|
};
|
||
|
const featureDefinitions = {};
|
||
|
for (const key in featureProps) {
|
||
|
featureDefinitions[key] = {
|
||
|
isEnabled: (props) => featureProps[key].some((name) => !!props[name]),
|
||
|
};
|
||
|
}
|
||
|
|
||
|
export { featureDefinitions };
|