Files
klz-cables.com/.pnpm-store/v10/files/f3/0c73feea1d241e65627f3e5b5beea1a0a051bd388b51e7ab3047548ad6552aafcacc90b08b666bb143319c5ac698b9f1b3f78d3306cb80047bd26ff13202eb
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

39 lines
1.4 KiB
Plaintext

import { warnOnce } from '../../utils/warn-once.mjs';
function createDOMMotionComponentProxy(componentFactory) {
if (typeof Proxy === "undefined") {
return componentFactory;
}
/**
* A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
* Rather than generating them anew every render.
*/
const componentCache = new Map();
const deprecatedFactoryFunction = (...args) => {
if (process.env.NODE_ENV !== "production") {
warnOnce(false, "motion() is deprecated. Use motion.create() instead.");
}
return componentFactory(...args);
};
return new Proxy(deprecatedFactoryFunction, {
/**
* Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
* The prop name is passed through as `key` and we can use that to generate a `motion`
* DOM component with that name.
*/
get: (_target, key) => {
if (key === "create")
return componentFactory;
/**
* If this element doesn't exist in the component cache, create it and cache.
*/
if (!componentCache.has(key)) {
componentCache.set(key, componentFactory(key));
}
return componentCache.get(key);
},
});
}
export { createDOMMotionComponentProxy };