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>
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import { useCombineMotionValues } from './use-combine-values.mjs';
|
|
import { isMotionValue } from './utils/is-motion-value.mjs';
|
|
|
|
/**
|
|
* Combine multiple motion values into a new one using a string template literal.
|
|
*
|
|
* ```jsx
|
|
* import {
|
|
* motion,
|
|
* useSpring,
|
|
* useMotionValue,
|
|
* useMotionTemplate
|
|
* } from "framer-motion"
|
|
*
|
|
* function Component() {
|
|
* const shadowX = useSpring(0)
|
|
* const shadowY = useMotionValue(0)
|
|
* const shadow = useMotionTemplate`drop-shadow(${shadowX}px ${shadowY}px 20px rgba(0,0,0,0.3))`
|
|
*
|
|
* return <motion.div style={{ filter: shadow }} />
|
|
* }
|
|
* ```
|
|
*
|
|
* @public
|
|
*/
|
|
function useMotionTemplate(fragments, ...values) {
|
|
/**
|
|
* Create a function that will build a string from the latest motion values.
|
|
*/
|
|
const numFragments = fragments.length;
|
|
function buildValue() {
|
|
let output = ``;
|
|
for (let i = 0; i < numFragments; i++) {
|
|
output += fragments[i];
|
|
const value = values[i];
|
|
if (value) {
|
|
output += isMotionValue(value) ? value.get() : value;
|
|
}
|
|
}
|
|
return output;
|
|
}
|
|
return useCombineMotionValues(values.filter(isMotionValue), buildValue);
|
|
}
|
|
|
|
export { useMotionTemplate };
|