fix: prevent asset conflicts between React and Grid.js versions

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>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

View File

@@ -0,0 +1,2 @@
import { Action, GestureHandlers, UserGestureConfig } from '@use-gesture/core/types';
export declare function createUseGesture(actions: Action[]): <Config extends UserGestureConfig = UserGestureConfig>(_handlers: GestureHandlers, _config?: Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => import("./types.js").ReactDOMAttributes;

View File

@@ -0,0 +1,11 @@
export { useDrag } from "./useDrag.js";
export { usePinch } from "./usePinch.js";
export { useWheel } from "./useWheel.js";
export { useScroll } from "./useScroll.js";
export { useMove } from "./useMove.js";
export { useHover } from "./useHover.js";
export { useGesture } from "./useGesture.js";
export { createUseGesture } from "./createUseGesture.js";
export * from '@use-gesture/core/utils';
export * from '@use-gesture/core/actions';
export * from '@use-gesture/core/types';

View File

@@ -0,0 +1,5 @@
/// <reference types="react" />
import { DOMHandlers } from '@use-gesture/core/types';
export type ReactDOMAttributes = {
[Key in keyof DOMHandlers]: React.DOMAttributes<EventTarget>[Key];
};

View File

@@ -0,0 +1,8 @@
import { EventTypes, Handler, UserDragConfig } from '@use-gesture/core/types';
/**
* Drag hook.
*
* @param {Handler<'drag'>} handler - the function fired every time the drag gesture updates
* @param {UserDragConfig} config - the config object including generic options and drag options
*/
export declare function useDrag<EventType = EventTypes['drag'], Config extends UserDragConfig = UserDragConfig>(handler: Handler<'drag', EventType>, config?: Config): Config["target"] extends object ? void : (...args: any[]) => import("./types.js").ReactDOMAttributes;

View File

@@ -0,0 +1,10 @@
import { GestureHandlers, UserGestureConfig, EventTypes, AnyHandlerEventTypes } from '@use-gesture/core/types';
/**
* @public
*
* The most complete gesture hook, allowing support for multiple gestures.
*
* @param {GestureHandlers} handlers - an object with on[Gesture] keys containg gesture handlers
* @param {UserGestureConfig} config - the full config object
*/
export declare function useGesture<HandlerTypes extends AnyHandlerEventTypes = EventTypes, Config extends UserGestureConfig = UserGestureConfig>(handlers: GestureHandlers<HandlerTypes>, config?: Config): Config["target"] extends object ? void : (...args: any[]) => import("./types.js").ReactDOMAttributes;

View File

@@ -0,0 +1,8 @@
import { EventTypes, UserHoverConfig, Handler } from '@use-gesture/core/types';
/**
* Hover hook.
*
* @param {Handler<'hover'>} handler - the function fired every time the hover gesture updates
* @param {UserHoverConfig} config - the config object including generic options and hover options
*/
export declare function useHover<EventType = EventTypes['hover'], Config extends UserHoverConfig = UserHoverConfig>(handler: Handler<'hover', EventType>, config?: Config): Config["target"] extends object ? void : (...args: any[]) => import("./types.js").ReactDOMAttributes;

View File

@@ -0,0 +1,8 @@
import { UserMoveConfig, Handler, EventTypes } from '@use-gesture/core/types';
/**
* Move hook.
*
* @param {Handler<'move'>} handler - the function fired every time the move gesture updates
* @param {UserMoveConfig} config - the config object including generic options and move options
*/
export declare function useMove<EventType = EventTypes['move'], Config extends UserMoveConfig = UserMoveConfig>(handler: Handler<'move', EventType>, config?: Config): Config["target"] extends object ? void : (...args: any[]) => import("./types.js").ReactDOMAttributes;

View File

@@ -0,0 +1,8 @@
import { UserPinchConfig, Handler, EventTypes } from '@use-gesture/core/types';
/**
* Pinch hook.
*
* @param {Handler<'pinch'>} handler - the function fired every time the pinch gesture updates
* @param {UserPinchConfig} config - the config object including generic options and pinch options
*/
export declare function usePinch<EventType = EventTypes['pinch'], Config extends UserPinchConfig = UserPinchConfig>(handler: Handler<'pinch', EventType>, config?: Config): Config["target"] extends object ? void : (...args: any[]) => import("./types.js").ReactDOMAttributes;

View File

@@ -0,0 +1,8 @@
import { UserScrollConfig, Handler, EventTypes } from '@use-gesture/core/types';
/**
* Scroll hook.
*
* @param {Handler<'scroll'>} handler - the function fired every time the scroll gesture updates
* @param {UserScrollConfig} config - the config object including generic options and scroll options
*/
export declare function useScroll<EventType = EventTypes['scroll'], Config extends UserScrollConfig = UserScrollConfig>(handler: Handler<'scroll', EventType>, config?: Config): Config["target"] extends object ? void : (...args: any[]) => import("./types.js").ReactDOMAttributes;

View File

@@ -0,0 +1,8 @@
import { UserWheelConfig, Handler, EventTypes } from '@use-gesture/core/types';
/**
* Wheel hook.
*
* @param {Handler<'wheel'>} handler - the function fired every time the wheel gesture updates
* @param {UserWheelConfig} config - the config object including generic options and wheel options
*/
export declare function useWheel<EventType = EventTypes['wheel'], Config extends UserWheelConfig = UserWheelConfig>(handler: Handler<'wheel', EventType>, config?: Config): Config["target"] extends object ? void : (...args: any[]) => import("./types.js").ReactDOMAttributes;

View File

@@ -0,0 +1,2 @@
export * from "./declarations/src/index";
//# sourceMappingURL=use-gesture-react.cjs.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"use-gesture-react.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}

View File

@@ -0,0 +1,113 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var actions = require('@use-gesture/core/actions');
var React = require('react');
var core = require('@use-gesture/core');
var utils = require('@use-gesture/core/utils');
var types = require('@use-gesture/core/types');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefault(React);
function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) {
const ctrl = React__default["default"].useMemo(() => new core.Controller(handlers), []);
ctrl.applyHandlers(handlers, nativeHandlers);
ctrl.applyConfig(config, gestureKey);
React__default["default"].useEffect(ctrl.effect.bind(ctrl));
React__default["default"].useEffect(() => {
return ctrl.clean.bind(ctrl);
}, []);
if (config.target === undefined) {
return ctrl.bind.bind(ctrl);
}
return undefined;
}
function useDrag(handler, config) {
actions.registerAction(actions.dragAction);
return useRecognizers({
drag: handler
}, config || {}, 'drag');
}
function usePinch(handler, config) {
actions.registerAction(actions.pinchAction);
return useRecognizers({
pinch: handler
}, config || {}, 'pinch');
}
function useWheel(handler, config) {
actions.registerAction(actions.wheelAction);
return useRecognizers({
wheel: handler
}, config || {}, 'wheel');
}
function useScroll(handler, config) {
actions.registerAction(actions.scrollAction);
return useRecognizers({
scroll: handler
}, config || {}, 'scroll');
}
function useMove(handler, config) {
actions.registerAction(actions.moveAction);
return useRecognizers({
move: handler
}, config || {}, 'move');
}
function useHover(handler, config) {
actions.registerAction(actions.hoverAction);
return useRecognizers({
hover: handler
}, config || {}, 'hover');
}
function createUseGesture(actions$1) {
actions$1.forEach(actions.registerAction);
return function useGesture(_handlers, _config) {
const {
handlers,
nativeHandlers,
config
} = core.parseMergedHandlers(_handlers, _config || {});
return useRecognizers(handlers, config, undefined, nativeHandlers);
};
}
function useGesture(handlers, config) {
const hook = createUseGesture([actions.dragAction, actions.pinchAction, actions.scrollAction, actions.wheelAction, actions.moveAction, actions.hoverAction]);
return hook(handlers, config || {});
}
exports.createUseGesture = createUseGesture;
exports.useDrag = useDrag;
exports.useGesture = useGesture;
exports.useHover = useHover;
exports.useMove = useMove;
exports.usePinch = usePinch;
exports.useScroll = useScroll;
exports.useWheel = useWheel;
Object.keys(actions).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return actions[k]; }
});
});
Object.keys(utils).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return utils[k]; }
});
});
Object.keys(types).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return types[k]; }
});
});

View File

@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === "production") {
module.exports = require("./use-gesture-react.cjs.prod.js");
} else {
module.exports = require("./use-gesture-react.cjs.dev.js");
}

View File

@@ -0,0 +1,113 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var actions = require('@use-gesture/core/actions');
var React = require('react');
var core = require('@use-gesture/core');
var utils = require('@use-gesture/core/utils');
var types = require('@use-gesture/core/types');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefault(React);
function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) {
const ctrl = React__default["default"].useMemo(() => new core.Controller(handlers), []);
ctrl.applyHandlers(handlers, nativeHandlers);
ctrl.applyConfig(config, gestureKey);
React__default["default"].useEffect(ctrl.effect.bind(ctrl));
React__default["default"].useEffect(() => {
return ctrl.clean.bind(ctrl);
}, []);
if (config.target === undefined) {
return ctrl.bind.bind(ctrl);
}
return undefined;
}
function useDrag(handler, config) {
actions.registerAction(actions.dragAction);
return useRecognizers({
drag: handler
}, config || {}, 'drag');
}
function usePinch(handler, config) {
actions.registerAction(actions.pinchAction);
return useRecognizers({
pinch: handler
}, config || {}, 'pinch');
}
function useWheel(handler, config) {
actions.registerAction(actions.wheelAction);
return useRecognizers({
wheel: handler
}, config || {}, 'wheel');
}
function useScroll(handler, config) {
actions.registerAction(actions.scrollAction);
return useRecognizers({
scroll: handler
}, config || {}, 'scroll');
}
function useMove(handler, config) {
actions.registerAction(actions.moveAction);
return useRecognizers({
move: handler
}, config || {}, 'move');
}
function useHover(handler, config) {
actions.registerAction(actions.hoverAction);
return useRecognizers({
hover: handler
}, config || {}, 'hover');
}
function createUseGesture(actions$1) {
actions$1.forEach(actions.registerAction);
return function useGesture(_handlers, _config) {
const {
handlers,
nativeHandlers,
config
} = core.parseMergedHandlers(_handlers, _config || {});
return useRecognizers(handlers, config, undefined, nativeHandlers);
};
}
function useGesture(handlers, config) {
const hook = createUseGesture([actions.dragAction, actions.pinchAction, actions.scrollAction, actions.wheelAction, actions.moveAction, actions.hoverAction]);
return hook(handlers, config || {});
}
exports.createUseGesture = createUseGesture;
exports.useDrag = useDrag;
exports.useGesture = useGesture;
exports.useHover = useHover;
exports.useMove = useMove;
exports.usePinch = usePinch;
exports.useScroll = useScroll;
exports.useWheel = useWheel;
Object.keys(actions).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return actions[k]; }
});
});
Object.keys(utils).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return utils[k]; }
});
});
Object.keys(types).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return types[k]; }
});
});

View File

@@ -0,0 +1,81 @@
import { registerAction, dragAction, pinchAction, wheelAction, scrollAction, moveAction, hoverAction } from '@use-gesture/core/actions';
export * from '@use-gesture/core/actions';
import React from 'react';
import { Controller, parseMergedHandlers } from '@use-gesture/core';
export * from '@use-gesture/core/utils';
export * from '@use-gesture/core/types';
function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) {
const ctrl = React.useMemo(() => new Controller(handlers), []);
ctrl.applyHandlers(handlers, nativeHandlers);
ctrl.applyConfig(config, gestureKey);
React.useEffect(ctrl.effect.bind(ctrl));
React.useEffect(() => {
return ctrl.clean.bind(ctrl);
}, []);
if (config.target === undefined) {
return ctrl.bind.bind(ctrl);
}
return undefined;
}
function useDrag(handler, config) {
registerAction(dragAction);
return useRecognizers({
drag: handler
}, config || {}, 'drag');
}
function usePinch(handler, config) {
registerAction(pinchAction);
return useRecognizers({
pinch: handler
}, config || {}, 'pinch');
}
function useWheel(handler, config) {
registerAction(wheelAction);
return useRecognizers({
wheel: handler
}, config || {}, 'wheel');
}
function useScroll(handler, config) {
registerAction(scrollAction);
return useRecognizers({
scroll: handler
}, config || {}, 'scroll');
}
function useMove(handler, config) {
registerAction(moveAction);
return useRecognizers({
move: handler
}, config || {}, 'move');
}
function useHover(handler, config) {
registerAction(hoverAction);
return useRecognizers({
hover: handler
}, config || {}, 'hover');
}
function createUseGesture(actions) {
actions.forEach(registerAction);
return function useGesture(_handlers, _config) {
const {
handlers,
nativeHandlers,
config
} = parseMergedHandlers(_handlers, _config || {});
return useRecognizers(handlers, config, undefined, nativeHandlers);
};
}
function useGesture(handlers, config) {
const hook = createUseGesture([dragAction, pinchAction, scrollAction, wheelAction, moveAction, hoverAction]);
return hook(handlers, config || {});
}
export { createUseGesture, useDrag, useGesture, useHover, useMove, usePinch, useScroll, useWheel };