@hyperframes/parsers 0.7.62 → 0.7.64

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.
@@ -1405,7 +1405,13 @@ function addAnimationToScript(script, animation) {
1405
1405
  const id = `anim-${Date.now()}`;
1406
1406
  const statementCode = buildTweenStatementCode(parsed.timelineVar, animation);
1407
1407
  const newStatement = parseScript(statementCode).program.body[0];
1408
- insertAfterAnchor(parsed, newStatement);
1408
+ if (animation.method === "set" && animation.global) {
1409
+ const timeline = findTimelineDeclarationPath(parsed.ast, parsed.timelineVar);
1410
+ if (timeline) timeline.insertBefore(newStatement);
1411
+ else insertAfterAnchor(parsed, newStatement);
1412
+ } else {
1413
+ insertAfterAnchor(parsed, newStatement);
1414
+ }
1409
1415
  return { script: recast.print(parsed.ast).code, id };
1410
1416
  }
1411
1417
  function addAnimationWithKeyframesToScript(script, targetSelector, position, duration, keyframes, ease, easeEach) {