@hyperframes/parsers 0.7.25 → 0.7.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/gsapParser.js
CHANGED
|
@@ -1702,8 +1702,9 @@ function findKeyframePropByPct(kfNode, percentage) {
|
|
|
1702
1702
|
return null;
|
|
1703
1703
|
}
|
|
1704
1704
|
function buildKeyframeValueNode(properties, ease) {
|
|
1705
|
-
const
|
|
1706
|
-
|
|
1705
|
+
const effectiveEase = ease ?? (typeof properties.ease === "string" ? properties.ease : void 0);
|
|
1706
|
+
const entries = Object.entries(properties).filter(([k]) => k !== "ease").map(([k, v]) => `${safeJsKey(k)}: ${serializeValue(v)}`);
|
|
1707
|
+
if (effectiveEase) entries.push(`ease: ${JSON.stringify(effectiveEase)}`);
|
|
1707
1708
|
return parseExpr(`{ ${entries.join(", ")} }`);
|
|
1708
1709
|
}
|
|
1709
1710
|
function locateAnimation(script, animationId) {
|
|
@@ -1922,7 +1923,7 @@ function removeKeyframeFromScript(script, animationId, percentage) {
|
|
|
1922
1923
|
function moveKeyframeInScript(script, animationId, fromPercentage, toPercentage) {
|
|
1923
1924
|
const loc = locateAnimationWithFallback(script, animationId);
|
|
1924
1925
|
if (!loc) return script;
|
|
1925
|
-
const kfNode = findKeyframesObjectNode(loc.target.call.varsArg);
|
|
1926
|
+
const kfNode = findKeyframesObjectNode(loc.target.call.varsArg) ?? convertArrayKeyframesToObjectNode(loc.target.call.varsArg);
|
|
1926
1927
|
if (!kfNode) return script;
|
|
1927
1928
|
const match = findKeyframePropByPct(kfNode, fromPercentage);
|
|
1928
1929
|
if (!match) return script;
|
|
@@ -1950,7 +1951,7 @@ function moveKeyframeInScript(script, animationId, fromPercentage, toPercentage)
|
|
|
1950
1951
|
function resizeKeyframedTweenInScript(script, animationId, newPosition, newDuration, pctRemap) {
|
|
1951
1952
|
const loc = locateAnimationWithFallback(script, animationId);
|
|
1952
1953
|
if (!loc) return script;
|
|
1953
|
-
const kfNode = findKeyframesObjectNode(loc.target.call.varsArg);
|
|
1954
|
+
const kfNode = findKeyframesObjectNode(loc.target.call.varsArg) ?? convertArrayKeyframesToObjectNode(loc.target.call.varsArg);
|
|
1954
1955
|
if (!kfNode) return script;
|
|
1955
1956
|
const seen = /* @__PURE__ */ new Set();
|
|
1956
1957
|
for (const { from, to } of pctRemap) {
|
|
@@ -2076,7 +2077,7 @@ function convertToKeyframesInScript(script, animationId, resolvedFromValues, set
|
|
|
2076
2077
|
function removeAllKeyframesFromScript(script, animationId) {
|
|
2077
2078
|
let loc = locateAnimationWithFallback(script, animationId);
|
|
2078
2079
|
if (!loc) return script;
|
|
2079
|
-
const kfNode = findKeyframesObjectNode(loc.target.call.varsArg);
|
|
2080
|
+
const kfNode = findKeyframesObjectNode(loc.target.call.varsArg) ?? convertArrayKeyframesToObjectNode(loc.target.call.varsArg);
|
|
2080
2081
|
if (!kfNode) return script;
|
|
2081
2082
|
const kfEntries = filterPercentageProps(kfNode).map((p) => ({ pct: percentageFromKey(propKeyName(p)), prop: p })).filter((e) => !Number.isNaN(e.pct)).sort((a, b) => a.pct - b.pct);
|
|
2082
2083
|
if (kfEntries.length === 0) return script;
|