Mission Control Dashboard - Initial implementation
This commit is contained in:
32
node_modules/motion-dom/dist/es/render/utils/setters.mjs
generated
vendored
Normal file
32
node_modules/motion-dom/dist/es/render/utils/setters.mjs
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { motionValue } from '../../value/index.mjs';
|
||||
import { resolveVariant } from './resolve-dynamic-variants.mjs';
|
||||
import { isKeyframesTarget } from './is-keyframes-target.mjs';
|
||||
|
||||
/**
|
||||
* Set VisualElement's MotionValue, creating a new MotionValue for it if
|
||||
* it doesn't exist.
|
||||
*/
|
||||
function setMotionValue(visualElement, key, value) {
|
||||
if (visualElement.hasValue(key)) {
|
||||
visualElement.getValue(key).set(value);
|
||||
}
|
||||
else {
|
||||
visualElement.addValue(key, motionValue(value));
|
||||
}
|
||||
}
|
||||
function resolveFinalValueInKeyframes(v) {
|
||||
// TODO maybe throw if v.length - 1 is placeholder token?
|
||||
return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
|
||||
}
|
||||
function setTarget(visualElement, definition) {
|
||||
const resolved = resolveVariant(visualElement, definition);
|
||||
let { transitionEnd = {}, transition = {}, ...target } = resolved || {};
|
||||
target = { ...target, ...transitionEnd };
|
||||
for (const key in target) {
|
||||
const value = resolveFinalValueInKeyframes(target[key]);
|
||||
setMotionValue(visualElement, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
export { setTarget };
|
||||
//# sourceMappingURL=setters.mjs.map
|
||||
Reference in New Issue
Block a user