Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
import { addPointerEvent } from '../events/add-pointer-event.mjs';
|
|
import { pipe } from '../utils/pipe.mjs';
|
|
import { isDragActive } from './drag/utils/lock.mjs';
|
|
import { Feature } from '../motion/features/Feature.mjs';
|
|
import { frame } from '../frameloop/frame.mjs';
|
|
|
|
function addHoverEvent(node, isActive) {
|
|
const eventName = "pointer" + (isActive ? "enter" : "leave");
|
|
const callbackName = "onHover" + (isActive ? "Start" : "End");
|
|
const handleEvent = (event, info) => {
|
|
if (event.pointerType === "touch" || isDragActive())
|
|
return;
|
|
const props = node.getProps();
|
|
if (node.animationState && props.whileHover) {
|
|
node.animationState.setActive("whileHover", isActive);
|
|
}
|
|
if (props[callbackName]) {
|
|
frame.update(() => props[callbackName](event, info));
|
|
}
|
|
};
|
|
return addPointerEvent(node.current, eventName, handleEvent, {
|
|
passive: !node.getProps()[callbackName],
|
|
});
|
|
}
|
|
class HoverGesture extends Feature {
|
|
mount() {
|
|
this.unmount = pipe(addHoverEvent(this.node, true), addHoverEvent(this.node, false));
|
|
}
|
|
unmount() { }
|
|
}
|
|
|
|
export { HoverGesture };
|