This commit is contained in:
morgan
2026-03-13 19:23:37 +03:00
parent 8917f1631f
commit cc7403191a
5113 changed files with 168404 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { MotionValue, transformProps, acceleratedValues } from 'motion-dom';
class WillChangeMotionValue extends MotionValue {
constructor() {
super(...arguments);
this.isEnabled = false;
}
add(name) {
if (transformProps.has(name) || acceleratedValues.has(name)) {
this.isEnabled = true;
this.update();
}
}
update() {
this.set(this.isEnabled ? "transform" : "auto");
}
}
export { WillChangeMotionValue };
//# sourceMappingURL=WillChangeMotionValue.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"WillChangeMotionValue.mjs","sources":["../../../../src/value/use-will-change/WillChangeMotionValue.ts"],"sourcesContent":["import {\n acceleratedValues,\n MotionValue,\n transformProps,\n type WillChange,\n} from \"motion-dom\"\n\nexport class WillChangeMotionValue\n extends MotionValue<string>\n implements WillChange\n{\n private isEnabled = false\n\n add(name: string) {\n if (transformProps.has(name) || acceleratedValues.has(name)) {\n this.isEnabled = true\n this.update()\n }\n }\n\n private update() {\n this.set(this.isEnabled ? \"transform\" : \"auto\")\n }\n}\n"],"names":[],"mappings":";;AAOM,MAAO,qBACT,SAAQ,WAAmB,CAAA;AAD/B,IAAA,WAAA,GAAA;;QAIY,IAAA,CAAA,SAAS,GAAG,KAAK;IAY7B;AAVI,IAAA,GAAG,CAAC,IAAY,EAAA;AACZ,QAAA,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AACzD,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI;YACrB,IAAI,CAAC,MAAM,EAAE;QACjB;IACJ;IAEQ,MAAM,GAAA;AACV,QAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;IACnD;AACH;;;;"}