@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.
@@ -1788,12 +1788,12 @@ function removeKeyframeFromScript(script, animationId, percentage) {
1788
1788
  return ms.toString();
1789
1789
  }
1790
1790
  function moveKeyframeInScript(script, animationId, fromPercentage, toPercentage) {
1791
- const located = locateWithKeyframes(script, animationId);
1791
+ const located = ensureKeyframesNode(script, animationId);
1792
1792
  if (!located) return script;
1793
- const { kfNode } = located;
1793
+ const { script: src, kfNode } = located;
1794
1794
  const match = findKfPropByPct(kfNode, fromPercentage);
1795
- if (!match) return script;
1796
- if (Math.abs(fromPercentage - toPercentage) < MOVE_NOOP_EPSILON_PCT) return script;
1795
+ if (!match) return src;
1796
+ if (Math.abs(fromPercentage - toPercentage) < MOVE_NOOP_EPSILON_PCT) return src;
1797
1797
  const dest = findKfPropByPct(kfNode, toPercentage);
1798
1798
  const collision = dest && dest.prop !== match.prop ? dest : null;
1799
1799
  const entries = [];
@@ -1802,19 +1802,19 @@ function moveKeyframeInScript(script, animationId, fromPercentage, toPercentage)
1802
1802
  if (collision && prop === collision.prop) continue;
1803
1803
  const pct = percentageFromKey(propKeyName2(prop) ?? "");
1804
1804
  if (Number.isNaN(pct)) continue;
1805
- entries.push({ pct, record: valueNodeToRecord(prop.value, script) });
1805
+ entries.push({ pct, record: valueNodeToRecord(prop.value, src) });
1806
1806
  }
1807
- entries.push({ pct: toPercentage, record: valueNodeToRecord(match.prop.value, script) });
1807
+ entries.push({ pct: toPercentage, record: valueNodeToRecord(match.prop.value, src) });
1808
1808
  entries.sort((a, b) => a.pct - b.pct);
1809
1809
  const body = entries.map((e) => `${JSON.stringify(`${e.pct}%`)}: ${recordToCode(e.record)}`).join(", ");
1810
- const ms = new MagicString(script);
1810
+ const ms = new MagicString(src);
1811
1811
  ms.overwrite(kfNode.start, kfNode.end, `{ ${body} }`);
1812
1812
  return ms.toString();
1813
1813
  }
1814
1814
  function resizeKeyframedTweenInScript(script, animationId, newPosition, newDuration, pctRemap) {
1815
- const located = locateWithKeyframes(script, animationId);
1815
+ const located = ensureKeyframesNode(script, animationId);
1816
1816
  if (!located) return script;
1817
- const { target, kfNode } = located;
1817
+ const { script: src, target, kfNode } = located;
1818
1818
  const edits = [];
1819
1819
  const seen = /* @__PURE__ */ new Set();
1820
1820
  for (const { from, to } of pctRemap) {
@@ -1823,7 +1823,7 @@ function resizeKeyframedTweenInScript(script, animationId, newPosition, newDurat
1823
1823
  seen.add(match.prop.key);
1824
1824
  edits.push({ keyNode: match.prop.key, to });
1825
1825
  }
1826
- const ms = new MagicString(script);
1826
+ const ms = new MagicString(src);
1827
1827
  for (const { keyNode, to } of edits) {
1828
1828
  ms.overwrite(keyNode.start, keyNode.end, JSON.stringify(`${to}%`));
1829
1829
  }