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>
25 lines
893 B
JavaScript
25 lines
893 B
JavaScript
import { resolveVariantFromProps } from './resolve-variants.mjs';
|
|
|
|
/**
|
|
* Creates an object containing the latest state of every MotionValue on a VisualElement
|
|
*/
|
|
function getCurrent(visualElement) {
|
|
const current = {};
|
|
visualElement.values.forEach((value, key) => (current[key] = value.get()));
|
|
return current;
|
|
}
|
|
/**
|
|
* Creates an object containing the latest velocity of every MotionValue on a VisualElement
|
|
*/
|
|
function getVelocity(visualElement) {
|
|
const velocity = {};
|
|
visualElement.values.forEach((value, key) => (velocity[key] = value.getVelocity()));
|
|
return velocity;
|
|
}
|
|
function resolveVariant(visualElement, definition, custom) {
|
|
const props = visualElement.getProps();
|
|
return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, getCurrent(visualElement), getVelocity(visualElement));
|
|
}
|
|
|
|
export { resolveVariant };
|