@hyperframes/studio-server 0.7.54 → 0.7.55

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/index.js CHANGED
@@ -1193,6 +1193,7 @@ var HOLD_SYNC_MUTATION_TYPES = /* @__PURE__ */ new Set([
1193
1193
  // Time-shift / time-scale tweens, which can move a keyframed position tween's start
1194
1194
  // across t=0, flipping hold need; stale holds are not repositioned by these ops.
1195
1195
  "shift-positions",
1196
+ "shift-positions-batch",
1196
1197
  "scale-positions",
1197
1198
  // Retargets keyframed position tweens to a cloned element's selector; the old hold is
1198
1199
  // keyed to the prior selector, so holds must be rebuilt for the new target.
@@ -1446,6 +1447,14 @@ function executeGsapMutationAcorn(body, block, respond) {
1446
1447
  if (!targetSelector || !Number.isFinite(delta) || delta === 0) return block.scriptText;
1447
1448
  return shiftPositionsInScript(block.scriptText, targetSelector, delta);
1448
1449
  }
1450
+ case "shift-positions-batch": {
1451
+ let script = block.scriptText;
1452
+ for (const s of body.shifts) {
1453
+ if (!s.targetSelector || !Number.isFinite(s.delta) || s.delta === 0) continue;
1454
+ script = shiftPositionsInScript(script, s.targetSelector, s.delta);
1455
+ }
1456
+ return script;
1457
+ }
1449
1458
  case "scale-positions": {
1450
1459
  const { targetSelector, oldStart, oldDuration, newStart, newDuration } = body;
1451
1460
  if (!targetSelector || !Number.isFinite(oldStart) || !Number.isFinite(oldDuration) || !Number.isFinite(newStart) || !Number.isFinite(newDuration) || oldDuration <= 0 || newDuration <= 0)
@@ -1768,6 +1777,15 @@ async function executeGsapMutationRecast(body, block, respond) {
1768
1777
  const { shiftPositionsInScript: shiftPositionsInScript2 } = parser;
1769
1778
  return shiftPositionsInScript2(block.scriptText, targetSelector, delta);
1770
1779
  }
1780
+ case "shift-positions-batch": {
1781
+ const { shiftPositionsInScript: shiftPositionsInScript2 } = parser;
1782
+ let script = block.scriptText;
1783
+ for (const s of body.shifts) {
1784
+ if (!s.targetSelector || !Number.isFinite(s.delta) || s.delta === 0) continue;
1785
+ script = shiftPositionsInScript2(script, s.targetSelector, s.delta);
1786
+ }
1787
+ return script;
1788
+ }
1771
1789
  case "scale-positions": {
1772
1790
  const { targetSelector, oldStart, oldDuration, newStart, newDuration } = body;
1773
1791
  if (!targetSelector || !Number.isFinite(oldStart) || !Number.isFinite(oldDuration) || !Number.isFinite(newStart) || !Number.isFinite(newDuration) || oldDuration <= 0 || newDuration <= 0)
@@ -2177,6 +2195,9 @@ function registerFileRoutes(api, adapter) {
2177
2195
  if (unsafeFields.length > 0) {
2178
2196
  return rejectUnsafeMutationValues(c, unsafeFields);
2179
2197
  }
2198
+ if (body.type === "shift-positions-batch" && !Array.isArray(body.shifts)) {
2199
+ return c.json({ error: "shift-positions-batch requires a `shifts` array" }, 400);
2200
+ }
2180
2201
  let html = readFileSync3(res.absPath, "utf-8");
2181
2202
  let block = extractGsapScriptBlock(html);
2182
2203
  if (!block && (body.type === "add" || body.type === "add-with-keyframes")) {
@@ -2200,7 +2221,7 @@ ${bootstrap}`;
2200
2221
  }
2201
2222
  block = extractGsapScriptBlock(html);
2202
2223
  }
2203
- if (!block && (body.type === "shift-positions" || body.type === "scale-positions")) {
2224
+ if (!block && (body.type === "shift-positions" || body.type === "scale-positions" || body.type === "shift-positions-batch")) {
2204
2225
  return c.json({
2205
2226
  ok: true,
2206
2227
  changed: false,