@motionone/svelte
Advanced tools
Comparing version 10.13.2 to 10.14.0
@@ -550,2 +550,4 @@ function noop$1() { } | ||
const isString = (value) => typeof value === "string"; | ||
const time = { | ||
@@ -754,8 +756,6 @@ ms: (seconds) => seconds * 1000, | ||
if (isEasingGenerator(easing)) { | ||
const custom = easing.createAnimation(keyframes, () => "0", true); | ||
const custom = easing.createAnimation(keyframes); | ||
easing = custom.easing; | ||
if (custom.keyframes !== undefined) | ||
keyframes = custom.keyframes; | ||
if (custom.duration !== undefined) | ||
initialDuration = custom.duration; | ||
keyframes = custom.keyframes || keyframes; | ||
initialDuration = custom.duration || initialDuration; | ||
} | ||
@@ -1011,2 +1011,14 @@ this.repeat = repeat; | ||
function getUnitConverter(keyframes, definition) { | ||
var _a; | ||
let toUnit = (definition === null || definition === void 0 ? void 0 : definition.toDefaultUnit) || noopReturn; | ||
const finalKeyframe = keyframes[keyframes.length - 1]; | ||
if (isString(finalKeyframe)) { | ||
const unit = ((_a = finalKeyframe.match(/(-?[\d.]+)([a-z%]*)/)) === null || _a === void 0 ? void 0 : _a[2]) || ""; | ||
if (unit) | ||
toUnit = (value) => value + unit; | ||
} | ||
return toUnit; | ||
} | ||
function getDevToolsRecord() { | ||
@@ -1053,9 +1065,11 @@ return window.__MOTION_DEV_TOOLS_RECORD; | ||
let keyframes = hydrateKeyframes(keyframesList(keyframesDefinition), readInitialValue); | ||
/** | ||
* Detect unit type of keyframes. | ||
*/ | ||
const toUnit = getUnitConverter(keyframes, definition); | ||
if (isEasingGenerator(easing)) { | ||
const custom = easing.createAnimation(keyframes, readInitialValue, valueIsTransform, name, motionValue); | ||
const custom = easing.createAnimation(keyframes, key !== "opacity", readInitialValue, name, motionValue); | ||
easing = custom.easing; | ||
if (custom.keyframes !== undefined) | ||
keyframes = custom.keyframes; | ||
if (custom.duration !== undefined) | ||
duration = custom.duration; | ||
keyframes = custom.keyframes || keyframes; | ||
duration = custom.duration || duration; | ||
} | ||
@@ -1170,8 +1184,5 @@ /** | ||
} | ||
const render = (latest) => { | ||
if (definition) | ||
latest = definition.toDefaultUnit(latest); | ||
style.set(element, name, latest); | ||
}; | ||
animation = new Animation(render, keyframes, Object.assign(Object.assign({}, options), { duration, | ||
animation = new Animation((latest) => { | ||
style.set(element, name, toUnit ? toUnit(latest) : latest); | ||
}, keyframes, Object.assign(Object.assign({}, options), { duration, | ||
easing })); | ||
@@ -1178,0 +1189,0 @@ } |
{ | ||
"name": "@motionone/svelte", | ||
"version": "10.13.2", | ||
"version": "10.14.0", | ||
"description": "A tiny, performant animation library for Svelte", | ||
@@ -17,3 +17,3 @@ "author": "Matt Perry", | ||
"dependencies": { | ||
"@motionone/dom": "^10.13.2", | ||
"@motionone/dom": "^10.14.0", | ||
"tslib": "^2.3.1" | ||
@@ -34,3 +34,3 @@ }, | ||
}, | ||
"gitHead": "a33ab88400c8aac4a6755cda6f93c24563d9ddc5" | ||
"gitHead": "4c59ce9e5539899722427bd00f857dc80f29fc09" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262374
1767
Updated@motionone/dom@^10.14.0