till download files, everything works

This commit is contained in:
dimitar committed 2024-11-01 22:13:14 +01:00
1 parent ce893a4185
commit ed1a580b09
6050 files changed
+768543 -177

No files matched your search

@@ -0,0 +1,22 @@
import { MotionValue } from '../index.mjs';
import { getWillChangeName } from './get-will-change-name.mjs';
import { addUniqueItem } from '../../utils/array.mjs';
class WillChangeMotionValue extends MotionValue {
constructor() {
super(...arguments);
this.values = [];
}
add(name) {
const styleName = getWillChangeName(name);
if (styleName) {
addUniqueItem(this.values, styleName);
this.update();
}
}
update() {
this.set(this.values.length ? this.values.join(", ") : "auto");
}
}
export { WillChangeMotionValue };
@@ -0,0 +1,14 @@
import { isWillChangeMotionValue } from './is.mjs';
function addValueToWillChange(visualElement, key) {
const willChange = visualElement.getValue("willChange");
/**
* It could be that a user has set willChange to a regular MotionValue,
* in which case we can't add the value to it.
*/
if (isWillChangeMotionValue(willChange)) {
return willChange.add(key);
}
}
export { addValueToWillChange };
@@ -0,0 +1,14 @@
import { acceleratedValues } from '../../animation/animators/utils/accelerated-values.mjs';
import { camelToDash } from '../../render/dom/utils/camel-to-dash.mjs';
import { transformProps } from '../../render/html/utils/transform.mjs';
function getWillChangeName(name) {
if (transformProps.has(name)) {
return "transform";
}
else if (acceleratedValues.has(name)) {
return camelToDash(name);
}
}
export { getWillChangeName };
+8
View File
@@ -0,0 +1,8 @@
import { useConstant } from '../../utils/use-constant.mjs';
import { WillChangeMotionValue } from './WillChangeMotionValue.mjs';
function useWillChange() {
return useConstant(() => new WillChangeMotionValue("auto"));
}
export { useWillChange };
+7
View File
@@ -0,0 +1,7 @@
import { isMotionValue } from '../utils/is-motion-value.mjs';
function isWillChangeMotionValue(value) {
return Boolean(isMotionValue(value) && value.add);
}
export { isWillChangeMotionValue };