@hyperframes/studio 0.9.36 → 0.9.38

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.
Files changed (28) hide show
  1. package/dist/assets/{codec-6d9YaMSK.js → codec-Dz2VdhdD.js} +1 -1
  2. package/dist/assets/{hyperframes-player-DJLMOnOs.js → hyperframes-player-BkaWdGLq.js} +1 -1
  3. package/dist/assets/{index-VQ5wXIdS.js → index-DONaC7VF.js} +1 -1
  4. package/dist/assets/{index-CGiNbBjR.js → index-DsNxqAwr.js} +164 -164
  5. package/dist/assets/{pausedVideoDecoder-CU-7ph_q.js → pausedVideoDecoder-BGN2jKrN.js} +1 -1
  6. package/dist/index.html +1 -1
  7. package/dist/index.js +58 -59
  8. package/package.json +8 -8
  9. package/src/components/editor/propertyPanelFlatMediaSection.test.tsx +7 -36
  10. package/src/components/editor/propertyPanelFlatMediaSection.tsx +9 -32
  11. package/src/components/editor/useVolumeAutomation.test.tsx +0 -69
  12. package/src/components/editor/useVolumeAutomation.ts +0 -4
  13. package/src/hooks/gsapScriptCommitTypes.ts +2 -6
  14. package/src/hooks/timelineEditingHelpers.test.ts +39 -0
  15. package/src/hooks/timelineEditingHelpers.ts +13 -0
  16. package/src/hooks/useDomEditCommits.ts +4 -9
  17. package/src/hooks/useDomEditPersist.ts +2 -12
  18. package/src/hooks/useGsapScriptCommits.test.tsx +21 -0
  19. package/src/hooks/useGsapScriptCommits.ts +7 -3
  20. package/src/player/components/Player.test.ts +15 -0
  21. package/src/player/components/Player.tsx +4 -4
  22. package/src/player/components/audioGainApply.test.ts +13 -0
  23. package/src/player/components/audioGainApply.ts +0 -3
  24. package/src/player/hooks/timelinePlayerTestHarness.ts +1 -0
  25. package/src/player/hooks/useShadowPreviewReload.ts +20 -5
  26. package/src/player/hooks/useTimelinePlayer.shadowReload.test.ts +46 -0
  27. package/src/utils/studioFileHistory.test.ts +29 -1
  28. package/src/utils/studioFileHistory.ts +24 -1
@@ -1 +1 @@
1
- import{l as V}from"./index-CGiNbBjR.js";import{bw as G,bN as K,cH as Q,bE as X}from"./codec-6d9YaMSK.js";const x=1e-5,k=1e-9,T=h=>!h.variableFrameRate&&(h.frameRate??0)>0;function Y(h,i){const{sourceLead:r,inputLead:l,timeResolution:w,frameRate:p=0}=i;if(!T(i))return Math.max(l,h-r+l)+k;const d=Math.max(0,Math.floor((h-r)*p+k)),f=l+d/p;return(w>0?Math.round(f*w)/w:f)+x}function J(h,i,r){const{frameRate:l=0,sourceLead:w,inputLead:p}=r,d=T(r)?Math.round((h-p)*l)/l+w:h-p+w,f=Math.min(i,d);return{timestamp:f,duration:Math.max(T(r)?1/l:0,i-f+x)}}const E=64*1024*1024,M=4,Z=.5,$=2e3;async function q(h,i){if(!h.transparent)return h.sink.getSample(i);let r=null;try{for await(const l of h.sink.samplesAtTimestamps([i]))r==null||r.close(),r=l;return r}catch(l){throw r==null||r.close(),l}}function ot(h){const i=new Map,r=new Map,l=new Map,w=new Map,p=new Map;let d=0,f=!1;const _=t=>{var o,n;let e=new URL(t,location.href).pathname;try{e=decodeURIComponent(e)}catch{}return(n=Object.entries(((o=h.contentWindow)==null?void 0:o.__HF_MEDIA_SOURCE_FACTS__)??{}).filter(([s])=>e.endsWith(s)).sort(([s],[a])=>a.length-s.length)[0])==null?void 0:n[1]},g=(t=E)=>{for(const[e,o]of p){if(d<=t)break;e.pins>0||(p.delete(e),o.cache.delete(e.timestamp),d-=e.bytes,e.image.close())}},v=async t=>{if(t.disposed)return;t.disposed=!0,clearTimeout(t.idleTimer),r.get(t.key)===t&&r.delete(t.key);const e=(async()=>{t.transparent&&await t.tail,t.cancelReads(),t.input.dispose(),await y(t).catch(()=>{});for(const o of t.cache.values())p.delete(o),d-=o.bytes,o.image.close();t.cache.clear(),t.canvas.width=t.canvas.height=0})();return t.transparent?new Promise((o,n)=>{const s=setTimeout(()=>{t.cancelReads(),o()},$);e.then(o,n).finally(()=>clearTimeout(s))}):e},P=t=>{clearTimeout(t.idleTimer),!(t.disposed||t.users>0||[...t.cache.values()].some(e=>e.pins>0))&&(t.idleTimer=setTimeout(()=>{t.users>0||[...t.cache.values()].some(e=>e.pins>0)||r.get(t.key)===t&&(i.delete(t.key),v(t))},1e4))},D=async t=>{const e=V("thumbnail"),o=new G({source:new Q(t,e),formats:K});l.set(o,e.cancelReads);try{const n=await o.getPrimaryVideoTrack();if(!n||f)throw new Error("Preview video unavailable");const[s,a,u,c,m,S,F,B,j]=await Promise.all([n.getDisplayWidth(),n.getDisplayHeight(),n.getFirstTimestamp(),n.getTimeResolution(),n.getSquarePixelWidth(),n.getSquarePixelHeight(),n.getRotation(),n.getFlip(),n.canBeTransparent()]),b=document.createElement("canvas");b.width=Math.max(1,Math.ceil(s));const z=F%180===0?m/S:S/m;return b.height=Math.max(1,Math.round(b.width/z)),{key:t,input:o,cancelReads:e.cancelReads,sink:new X(n),canvas:b,rotation:F,flip:B,width:s,height:a,lead:u,ticks:c,transparent:j,tail:Promise.resolve(),iterator:null,iteratorEnd:0,lastTime:-1/0,cache:new Map,users:0,disposed:!1}}catch(n){throw o.dispose(),e.cancelReads(),n}finally{l.delete(o)}},I=()=>{for(const[t]of i){if(i.size<M)break;const e=r.get(t);e&&e.users===0&&![...e.cache.values()].some(o=>o.pins>0)&&(i.delete(t),v(e))}if(i.size>=M)throw new Error("Preview decoder budget reached")},L=async t=>{const e=t;if((w.get(e)??0)>performance.now())throw new Error("Preview decoder cooling down");let o=i.get(e);o||(I(),o=D(t),i.set(e,o)),i.delete(e),i.set(e,o);let n;try{n=await o}catch(s){throw i.get(e)===o&&(i.delete(e),w.set(e,performance.now()+5e3)),s}if(f||n.disposed)throw new DOMException("Preview disposed","AbortError");return r.set(e,n),n.users++,clearTimeout(n.idleTimer),n},y=async t=>{const e=t.iterator;t.iterator=null,await(e==null?void 0:e.return())},R=(t,e)=>{if(e.throwIfAborted(),f||t.disposed)throw new Error("Preview disposed")},O=async(t,e,o)=>{for(t.iterator||(t.iteratorEnd=e+8,t.iterator=t.sink.samples(e,t.iteratorEnd));;){R(t,o);const n=await t.iterator.next();if(n.done)return null;const s=n.value;let a=!1;try{if(R(t,o),s.timestamp>e+1e-6)return null;if(a=s.timestamp+s.duration>e+1e-6,a)return s}finally{a||s.close()}}},A=(t,e)=>(e.pins++,p.delete(e),p.set(e,t),e),W=async(t,e,o,n,s)=>{const a=t.canvas.getContext("2d",{alpha:!0});if(!a)throw new Error("Preview canvas unavailable");a.clearRect(0,0,t.canvas.width,t.canvas.height),a.imageSmoothingQuality="high",e.drawWithFit(a,{fit:"fill",rotation:t.rotation,flip:t.flip});const u=await createImageBitmap(t.canvas);if(s.aborted||f||t.disposed)throw u.close(),s.throwIfAborted(),new Error("Preview disposed");const c={image:u,...J(e.timestamp,o,n),bytes:u.width*u.height*4,pins:1},m=t.cache.get(c.timestamp);if(m)return m.duration=Math.max(m.duration,c.duration),u.close(),A(t,m);if(g(E-c.bytes),d+c.bytes>E)throw u.close(),new Error("Preview frame budget reached");return t.cache.set(c.timestamp,c),p.set(c,t),d+=c.bytes,c},H=(t,e,o)=>!t.transparent&&!o.variableFrameRate&&(o.frameRate??0)>0&&e>t.lastTime+1e-6&&e-t.lastTime<=Z,N=async(t,e,o,n)=>{R(t,n);const s=[...t.cache.values()].find(m=>e>=m.timestamp-1e-6&&e<m.timestamp+m.duration-1e-6);if(s)return A(t,s);const a=Y(e,o),u=H(t,e,o);let c=null;try{if((!u||a>=t.iteratorEnd)&&await y(t),c=u?await O(t,a,n):null,c||(await y(t),c=await q(t,a)),!c)throw new Error("No preview frame at requested time");return R(t,n),t.lastTime=e,await W(t,c,e,o,n)}finally{c==null||c.close(),(n.aborted||f)&&await y(t).catch(()=>{})}},U=(t,e)=>{const o=_(t.source);return{frameRate:o==null?void 0:o.frameRate,variableFrameRate:o==null?void 0:o.variableFrameRate,sourceLead:e.lead,inputLead:e.lead,timeResolution:e.ticks}},C=async(t,e)=>{e.throwIfAborted();const o=t.source;if(!o)throw new Error("Preview source unavailable");const n=await L(o);try{const s=U(t,n),a=n.tail.then(()=>N(n,t.time,s,e));n.tail=a.then(()=>{},()=>{});const u=await a;let c=!1;return g(),{source:u.image,timestamp:u.timestamp,duration:u.duration,width:n.width,height:n.height,release(){c||(c=!0,u.pins--,g(),P(n))}}}finally{n.users--,P(n)}};return{async decode(t,e){if(f)throw new DOMException("Preview disposed","AbortError");if(new Set(t.map(({source:a})=>a)).size>M)throw new Error("Preview decoder budget reached");const o=await Promise.allSettled(t.map(a=>C(a,e))),n=o.find(a=>a.status==="rejected"),s=o.flatMap(a=>a.status==="fulfilled"?[a.value]:[]);if(n||f||e.aborted){for(const a of s)a.release();throw n?n.reason:new DOMException("Preview cancelled","AbortError")}return s},async suspend(){const t=[...i.values()].map(e=>e.then(v).catch(()=>{}));i.clear();for(const[e,o]of l)o(),e.dispose();await Promise.all(t)},dispose(){if(!f){f=!0;for(const[t,e]of l)e(),t.dispose();for(const t of i.values())t.then(v).catch(()=>{});i.clear(),w.clear()}}}}export{ot as createPausedVideoDecoder};
1
+ import{l as V}from"./index-DsNxqAwr.js";import{bw as G,bN as K,cH as Q,bE as X}from"./codec-Dz2VdhdD.js";const x=1e-5,k=1e-9,T=h=>!h.variableFrameRate&&(h.frameRate??0)>0;function Y(h,i){const{sourceLead:r,inputLead:l,timeResolution:w,frameRate:p=0}=i;if(!T(i))return Math.max(l,h-r+l)+k;const d=Math.max(0,Math.floor((h-r)*p+k)),f=l+d/p;return(w>0?Math.round(f*w)/w:f)+x}function J(h,i,r){const{frameRate:l=0,sourceLead:w,inputLead:p}=r,d=T(r)?Math.round((h-p)*l)/l+w:h-p+w,f=Math.min(i,d);return{timestamp:f,duration:Math.max(T(r)?1/l:0,i-f+x)}}const E=64*1024*1024,M=4,Z=.5,$=2e3;async function q(h,i){if(!h.transparent)return h.sink.getSample(i);let r=null;try{for await(const l of h.sink.samplesAtTimestamps([i]))r==null||r.close(),r=l;return r}catch(l){throw r==null||r.close(),l}}function ot(h){const i=new Map,r=new Map,l=new Map,w=new Map,p=new Map;let d=0,f=!1;const _=t=>{var o,n;let e=new URL(t,location.href).pathname;try{e=decodeURIComponent(e)}catch{}return(n=Object.entries(((o=h.contentWindow)==null?void 0:o.__HF_MEDIA_SOURCE_FACTS__)??{}).filter(([s])=>e.endsWith(s)).sort(([s],[a])=>a.length-s.length)[0])==null?void 0:n[1]},g=(t=E)=>{for(const[e,o]of p){if(d<=t)break;e.pins>0||(p.delete(e),o.cache.delete(e.timestamp),d-=e.bytes,e.image.close())}},v=async t=>{if(t.disposed)return;t.disposed=!0,clearTimeout(t.idleTimer),r.get(t.key)===t&&r.delete(t.key);const e=(async()=>{t.transparent&&await t.tail,t.cancelReads(),t.input.dispose(),await y(t).catch(()=>{});for(const o of t.cache.values())p.delete(o),d-=o.bytes,o.image.close();t.cache.clear(),t.canvas.width=t.canvas.height=0})();return t.transparent?new Promise((o,n)=>{const s=setTimeout(()=>{t.cancelReads(),o()},$);e.then(o,n).finally(()=>clearTimeout(s))}):e},P=t=>{clearTimeout(t.idleTimer),!(t.disposed||t.users>0||[...t.cache.values()].some(e=>e.pins>0))&&(t.idleTimer=setTimeout(()=>{t.users>0||[...t.cache.values()].some(e=>e.pins>0)||r.get(t.key)===t&&(i.delete(t.key),v(t))},1e4))},D=async t=>{const e=V("thumbnail"),o=new G({source:new Q(t,e),formats:K});l.set(o,e.cancelReads);try{const n=await o.getPrimaryVideoTrack();if(!n||f)throw new Error("Preview video unavailable");const[s,a,u,c,m,S,F,B,j]=await Promise.all([n.getDisplayWidth(),n.getDisplayHeight(),n.getFirstTimestamp(),n.getTimeResolution(),n.getSquarePixelWidth(),n.getSquarePixelHeight(),n.getRotation(),n.getFlip(),n.canBeTransparent()]),b=document.createElement("canvas");b.width=Math.max(1,Math.ceil(s));const z=F%180===0?m/S:S/m;return b.height=Math.max(1,Math.round(b.width/z)),{key:t,input:o,cancelReads:e.cancelReads,sink:new X(n),canvas:b,rotation:F,flip:B,width:s,height:a,lead:u,ticks:c,transparent:j,tail:Promise.resolve(),iterator:null,iteratorEnd:0,lastTime:-1/0,cache:new Map,users:0,disposed:!1}}catch(n){throw o.dispose(),e.cancelReads(),n}finally{l.delete(o)}},I=()=>{for(const[t]of i){if(i.size<M)break;const e=r.get(t);e&&e.users===0&&![...e.cache.values()].some(o=>o.pins>0)&&(i.delete(t),v(e))}if(i.size>=M)throw new Error("Preview decoder budget reached")},L=async t=>{const e=t;if((w.get(e)??0)>performance.now())throw new Error("Preview decoder cooling down");let o=i.get(e);o||(I(),o=D(t),i.set(e,o)),i.delete(e),i.set(e,o);let n;try{n=await o}catch(s){throw i.get(e)===o&&(i.delete(e),w.set(e,performance.now()+5e3)),s}if(f||n.disposed)throw new DOMException("Preview disposed","AbortError");return r.set(e,n),n.users++,clearTimeout(n.idleTimer),n},y=async t=>{const e=t.iterator;t.iterator=null,await(e==null?void 0:e.return())},R=(t,e)=>{if(e.throwIfAborted(),f||t.disposed)throw new Error("Preview disposed")},O=async(t,e,o)=>{for(t.iterator||(t.iteratorEnd=e+8,t.iterator=t.sink.samples(e,t.iteratorEnd));;){R(t,o);const n=await t.iterator.next();if(n.done)return null;const s=n.value;let a=!1;try{if(R(t,o),s.timestamp>e+1e-6)return null;if(a=s.timestamp+s.duration>e+1e-6,a)return s}finally{a||s.close()}}},A=(t,e)=>(e.pins++,p.delete(e),p.set(e,t),e),W=async(t,e,o,n,s)=>{const a=t.canvas.getContext("2d",{alpha:!0});if(!a)throw new Error("Preview canvas unavailable");a.clearRect(0,0,t.canvas.width,t.canvas.height),a.imageSmoothingQuality="high",e.drawWithFit(a,{fit:"fill",rotation:t.rotation,flip:t.flip});const u=await createImageBitmap(t.canvas);if(s.aborted||f||t.disposed)throw u.close(),s.throwIfAborted(),new Error("Preview disposed");const c={image:u,...J(e.timestamp,o,n),bytes:u.width*u.height*4,pins:1},m=t.cache.get(c.timestamp);if(m)return m.duration=Math.max(m.duration,c.duration),u.close(),A(t,m);if(g(E-c.bytes),d+c.bytes>E)throw u.close(),new Error("Preview frame budget reached");return t.cache.set(c.timestamp,c),p.set(c,t),d+=c.bytes,c},H=(t,e,o)=>!t.transparent&&!o.variableFrameRate&&(o.frameRate??0)>0&&e>t.lastTime+1e-6&&e-t.lastTime<=Z,N=async(t,e,o,n)=>{R(t,n);const s=[...t.cache.values()].find(m=>e>=m.timestamp-1e-6&&e<m.timestamp+m.duration-1e-6);if(s)return A(t,s);const a=Y(e,o),u=H(t,e,o);let c=null;try{if((!u||a>=t.iteratorEnd)&&await y(t),c=u?await O(t,a,n):null,c||(await y(t),c=await q(t,a)),!c)throw new Error("No preview frame at requested time");return R(t,n),t.lastTime=e,await W(t,c,e,o,n)}finally{c==null||c.close(),(n.aborted||f)&&await y(t).catch(()=>{})}},U=(t,e)=>{const o=_(t.source);return{frameRate:o==null?void 0:o.frameRate,variableFrameRate:o==null?void 0:o.variableFrameRate,sourceLead:e.lead,inputLead:e.lead,timeResolution:e.ticks}},C=async(t,e)=>{e.throwIfAborted();const o=t.source;if(!o)throw new Error("Preview source unavailable");const n=await L(o);try{const s=U(t,n),a=n.tail.then(()=>N(n,t.time,s,e));n.tail=a.then(()=>{},()=>{});const u=await a;let c=!1;return g(),{source:u.image,timestamp:u.timestamp,duration:u.duration,width:n.width,height:n.height,release(){c||(c=!0,u.pins--,g(),P(n))}}}finally{n.users--,P(n)}};return{async decode(t,e){if(f)throw new DOMException("Preview disposed","AbortError");if(new Set(t.map(({source:a})=>a)).size>M)throw new Error("Preview decoder budget reached");const o=await Promise.allSettled(t.map(a=>C(a,e))),n=o.find(a=>a.status==="rejected"),s=o.flatMap(a=>a.status==="fulfilled"?[a.value]:[]);if(n||f||e.aborted){for(const a of s)a.release();throw n?n.reason:new DOMException("Preview cancelled","AbortError")}return s},async suspend(){const t=[...i.values()].map(e=>e.then(v).catch(()=>{}));i.clear();for(const[e,o]of l)o(),e.dispose();await Promise.all(t)},dispose(){if(!f){f=!0;for(const[t,e]of l)e(),t.dispose();for(const t of i.values())t.then(v).catch(()=>{});i.clear(),w.clear()}}}}export{ot as createPausedVideoDecoder};
package/dist/index.html CHANGED
@@ -14,7 +14,7 @@
14
14
  document.documentElement.dataset.theme = "paper";
15
15
  }
16
16
  </script>
17
- <script type="module" crossorigin src="/assets/index-CGiNbBjR.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-DsNxqAwr.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-BJTCbv8z.css">
19
19
  </head>
20
20
  <body>
package/dist/index.js CHANGED
@@ -17416,6 +17416,16 @@ function serializeStudioFileMutations(writer, targetPaths, task) {
17416
17416
  }
17417
17417
 
17418
17418
  // src/utils/studioFileHistory.ts
17419
+ function editContextTarget(file, target) {
17420
+ return {
17421
+ file,
17422
+ ...target.id && { id: target.id },
17423
+ ...target.hfId && { hfId: target.hfId },
17424
+ ...target.selector && { selector: target.selector },
17425
+ ...target.selectorIndex !== void 0 && { selectorIndex: target.selectorIndex },
17426
+ ...target.label && { name: target.label }
17427
+ };
17428
+ }
17419
17429
  async function readProjectFileContent(pid, path) {
17420
17430
  const response = await studioApiFetch(
17421
17431
  buildProjectApiPath(pid, `/files/${encodeURIComponent(path)}`)
@@ -17453,6 +17463,7 @@ async function saveServerRewriteWithHistory(input) {
17453
17463
  }
17454
17464
  async function writeProjectFilesWithHistoryInQueue({
17455
17465
  label,
17466
+ targets,
17456
17467
  coalesceKey,
17457
17468
  coalesceMs,
17458
17469
  files,
@@ -17477,7 +17488,13 @@ async function writeProjectFilesWithHistoryInQueue({
17477
17488
  await writeFile(path, snapshots[path].after, diskContent?.[path] ?? snapshots[path].before);
17478
17489
  writtenPaths.push(path);
17479
17490
  }
17480
- await recordEdit({ label, coalesceKey, coalesceMs, files: snapshots });
17491
+ await recordEdit({
17492
+ label,
17493
+ coalesceKey,
17494
+ coalesceMs,
17495
+ ...targets?.length && { targets },
17496
+ files: snapshots
17497
+ });
17481
17498
  } catch (error) {
17482
17499
  try {
17483
17500
  for (const path of writtenPaths.reverse()) {
@@ -18718,6 +18735,10 @@ function buildPatchTarget(element) {
18718
18735
  }
18719
18736
  return null;
18720
18737
  }
18738
+ function timelineEditTarget(path, element) {
18739
+ const patchTarget = buildPatchTarget(element);
18740
+ return patchTarget && editContextTarget(path, { ...patchTarget, label: element.label });
18741
+ }
18721
18742
  function findTimelineElementInIframe(iframe, element, activeCompositionPath = null) {
18722
18743
  try {
18723
18744
  const doc = iframe?.contentDocument;
@@ -18854,6 +18875,7 @@ async function persistTimelineEdit(input) {
18854
18875
  await saveProjectFilesWithHistory({
18855
18876
  projectId: input.projectId,
18856
18877
  label: input.label,
18878
+ targets: [editContextTarget(targetPath, { ...patchTarget, label: input.element.label })],
18857
18879
  coalesceKey: input.coalesceKey,
18858
18880
  coalesceMs: input.coalesceMs,
18859
18881
  files: {
@@ -18917,6 +18939,10 @@ async function persistTimelineBatchEdit(input) {
18917
18939
  await saveProjectFilesWithHistory({
18918
18940
  projectId: input.projectId,
18919
18941
  label: input.label,
18942
+ targets: input.changes.flatMap((change) => {
18943
+ const path = change.element.sourceFile || input.activeCompPath || "index.html";
18944
+ return timelineEditTarget(path, change.element) ?? [];
18945
+ }),
18920
18946
  coalesceKey: input.coalesceKey,
18921
18947
  coalesceMs: input.coalesceMs,
18922
18948
  files: Object.fromEntries([...changesByPath.keys()].map((path) => [path, buildFile(path)])),
@@ -25360,9 +25386,6 @@ async function requestNormalizePlan(projectId, el, fetchImpl = studioApiFetch) {
25360
25386
  // src/player/components/audioGainApply.ts
25361
25387
  var AUDIO_GAIN_LABEL = "Audio Gain";
25362
25388
  async function writeClipGains(edits, writers, label = AUDIO_GAIN_LABEL) {
25363
- if (edits.some(({ element }) => volumeLaneOwnsGain(element))) {
25364
- throw new Error(VOLUME_LANE_REFUSAL);
25365
- }
25366
25389
  const values = edits.map(({ element, gain }) => ({ element, value: formatAudioGain(gain) }));
25367
25390
  if (values.length > 1 && writers.onSetElementsAttributeQuiet) {
25368
25391
  throwUnlessSaved(await writers.onSetElementsAttributeQuiet(values, "data-volume", label));
@@ -31911,6 +31934,7 @@ function useShadowPreviewReload({
31911
31934
  const readyTimerRef = useRef49(void 0);
31912
31935
  const budgetsSpentRef = useRef49(0);
31913
31936
  const budgetGenRef = useRef49(null);
31937
+ const shadowFrameLeftPageRef = useRef49(false);
31914
31938
  const cancelPendingLoadRef = useRef49(() => {
31915
31939
  });
31916
31940
  const stopHoldRef = useRef49(() => {
@@ -31927,6 +31951,7 @@ function useShadowPreviewReload({
31927
31951
  const stopPendingShadow = useCallback40(() => {
31928
31952
  clearTimeout(readyTimerRef.current);
31929
31953
  budgetGenRef.current = null;
31954
+ shadowFrameLeftPageRef.current = false;
31930
31955
  cancelPendingLoadRef.current();
31931
31956
  stopHoldRef.current();
31932
31957
  pendingCommitRef.current = null;
@@ -32078,13 +32103,10 @@ function useShadowPreviewReload({
32078
32103
  },
32079
32104
  [promoteWhenReady]
32080
32105
  );
32081
- const setShadowIframeNode = useCallback40((node) => {
32082
- shadowIframeRef.current = node;
32083
- }, []);
32084
32106
  const armReadyTimer = useCallback40(
32085
32107
  (gen) => {
32086
32108
  clearTimeout(readyTimerRef.current);
32087
- if (isDocumentHidden()) return;
32109
+ if (isDocumentHidden() || shadowFrameLeftPageRef.current) return;
32088
32110
  let drew = false;
32089
32111
  let starved = false;
32090
32112
  requestAnimationFrame(() => {
@@ -32098,6 +32120,12 @@ function useShadowPreviewReload({
32098
32120
  logReload("shadow-starved", { gen });
32099
32121
  return;
32100
32122
  }
32123
+ const frame3 = shadowIframeRef.current;
32124
+ if (frame3 && !frame3.isConnected) {
32125
+ shadowFrameLeftPageRef.current = true;
32126
+ logReload("shadow-detached", { gen });
32127
+ return;
32128
+ }
32101
32129
  budgetsSpentRef.current += 1;
32102
32130
  if (budgetsSpentRef.current < SHADOW_READY_BUDGETS) {
32103
32131
  logReload("shadow-slow", { budgetsSpent: budgetsSpentRef.current });
@@ -32111,6 +32139,16 @@ function useShadowPreviewReload({
32111
32139
  );
32112
32140
  const armReadyTimerRef = useRef49(armReadyTimer);
32113
32141
  armReadyTimerRef.current = armReadyTimer;
32142
+ const setShadowIframeNode = useCallback40((node) => {
32143
+ shadowIframeRef.current = node;
32144
+ const gen = budgetGenRef.current;
32145
+ if (!node || !shadowFrameLeftPageRef.current || gen == null || gen !== shadowGenRef.current)
32146
+ return;
32147
+ shadowFrameLeftPageRef.current = false;
32148
+ budgetsSpentRef.current = 0;
32149
+ logReload("shadow-reattached", { gen });
32150
+ armReadyTimerRef.current(gen);
32151
+ }, []);
32114
32152
  const beginShadowReload = useCallback40(
32115
32153
  (url) => {
32116
32154
  retry.started();
@@ -68681,10 +68719,8 @@ function useVolumeAutomation(element, currentTime, onSetAttributeQuiet, linkedSp
68681
68719
  );
68682
68720
  return {
68683
68721
  volumeAutomated: volume.automated,
68684
- automatedVolumeValue: volume.automatedValue,
68685
68722
  onAutomateVolume: volume.onAutomate,
68686
68723
  onRemoveVolumeAutomation: volume.onRemoveAutomation,
68687
- onCommitVolumeAt: volume.onCommitAt,
68688
68724
  rate: {
68689
68725
  ...rate,
68690
68726
  canApplyPreset: elDuration > 0,
@@ -68845,8 +68881,6 @@ function FlatMediaSection({
68845
68881
  volumeAutomated,
68846
68882
  onAutomateVolume,
68847
68883
  onRemoveVolumeAutomation,
68848
- onCommitVolumeAt,
68849
- automatedVolumeValue,
68850
68884
  rate
68851
68885
  }) {
68852
68886
  const track2 = useTrackDesignInput();
@@ -68856,7 +68890,6 @@ function FlatMediaSection({
68856
68890
  const isVisualMedia = isVideo || isImage;
68857
68891
  const el = element.element;
68858
68892
  const gain = parseNumericValue(element.dataAttributes.volume ?? "") ?? 1;
68859
- const volume = volumeAutomated && automatedVolumeValue !== void 0 ? automatedVolumeValue : 1;
68860
68893
  const { mediaStart, mediaStartAttr } = readClipInPoint(element.dataAttributes);
68861
68894
  const constantRate = Number.parseFloat(element.dataAttributes["playback-rate"] ?? "1") || 1;
68862
68895
  const playbackRate = rate?.automated && rate.automatedValue !== void 0 ? rate.automatedValue : constantRate;
@@ -68990,25 +69023,6 @@ function FlatMediaSection({
68990
69023
  ] })
68991
69024
  ] }),
68992
69025
  (isVideo || isAudio) && /* @__PURE__ */ jsxs139(Fragment48, { children: [
68993
- /* @__PURE__ */ jsx184(
68994
- FlatSlider,
68995
- {
68996
- label: "Gain",
68997
- value: audioGainToFaderPosition3(gain),
68998
- min: AUDIO_GAIN_FADER_MIN3,
68999
- max: AUDIO_GAIN_FADER_MAX3,
69000
- tier: gain === 1 ? "default" : "explicitCustom",
69001
- displayValue: audioGainToText3(gain),
69002
- centerTick: true,
69003
- onCommit: (next) => void onSetAttribute("volume", formatAudioGain4(audioFaderPositionToGain3(next))),
69004
- onCommitText: (text3) => {
69005
- const next = parseGainInput(text3);
69006
- if (next === null) return false;
69007
- void onSetAttribute("volume", formatAudioGain4(next));
69008
- return true;
69009
- }
69010
- }
69011
- ),
69012
69026
  /* @__PURE__ */ jsxs139(
69013
69027
  "div",
69014
69028
  {
@@ -69019,17 +69033,17 @@ function FlatMediaSection({
69019
69033
  FlatSlider,
69020
69034
  {
69021
69035
  label: "Volume",
69022
- value: audioGainToFaderPosition3(volume),
69036
+ value: audioGainToFaderPosition3(gain),
69023
69037
  min: AUDIO_GAIN_FADER_MIN3,
69024
69038
  max: AUDIO_GAIN_FADER_MAX3,
69025
- tier: volume === 1 ? "default" : "explicitCustom",
69026
- displayValue: audioGainToText3(volume),
69039
+ tier: gain === 1 ? "default" : "explicitCustom",
69040
+ displayValue: audioGainToText3(gain),
69027
69041
  centerTick: true,
69028
- onCommit: (next) => onCommitVolumeAt?.(audioFaderPositionToGain3(next)),
69042
+ onCommit: (next) => void onSetAttribute("volume", formatAudioGain4(audioFaderPositionToGain3(next))),
69029
69043
  onCommitText: (text3) => {
69030
69044
  const next = parseGainInput(text3);
69031
69045
  if (next === null) return false;
69032
- onCommitVolumeAt?.(next);
69046
+ void onSetAttribute("volume", formatAudioGain4(next));
69033
69047
  return true;
69034
69048
  }
69035
69049
  }
@@ -82522,17 +82536,7 @@ function useDomEditPersist({
82522
82536
  const finalContent2 = prepared.content;
82523
82537
  await editHistory.recordEdit({
82524
82538
  ...history2,
82525
- targets: [
82526
- {
82527
- file: targetPath,
82528
- ...selection.id && { id: selection.id },
82529
- ...selection.hfId && { hfId: selection.hfId },
82530
- ...selection.selector && { selector: selection.selector },
82531
- ...selection.selectorIndex !== void 0 && {
82532
- selectorIndex: selection.selectorIndex
82533
- }
82534
- }
82535
- ],
82539
+ targets: [editContextTarget(targetPath, selection)],
82536
82540
  files: { [targetPath]: { before: originalContent, after: finalContent2 } }
82537
82541
  });
82538
82542
  return { patchData: patchData2, patchedContent: patchedContent2, finalContent: finalContent2 };
@@ -83797,15 +83801,9 @@ function useDomEditCommits({
83797
83801
  coalesceMs: options.coalesceMs,
83798
83802
  files,
83799
83803
  targets: batches.filter((batch) => Object.hasOwn(files, batch.sourceFile)).flatMap(
83800
- (batch) => batch.patches.map(({ target }) => ({
83801
- file: batch.sourceFile,
83802
- ...target.id && { id: target.id },
83803
- ...target.hfId && { hfId: target.hfId },
83804
- ...target.selector && { selector: target.selector },
83805
- ...target.selectorIndex !== void 0 && {
83806
- selectorIndex: target.selectorIndex
83807
- }
83808
- }))
83804
+ (batch) => batch.patches.map(
83805
+ ({ target }) => editContextTarget(batch.sourceFile, target)
83806
+ )
83809
83807
  )
83810
83808
  });
83811
83809
  }
@@ -85343,12 +85341,13 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
85343
85341
  const activeCompPathRef = useRef154(activeCompPath);
85344
85342
  activeCompPathRef.current = activeCompPath;
85345
85343
  const serializerRef = useRef154(createKeyedSerializer());
85346
- const recordMutationEdit = useCallback143(async (targetPath, result, options) => {
85344
+ const recordMutationEdit = useCallback143(async (targetPath, selection, result, options) => {
85347
85345
  if (result.before == null || result.after == null) return;
85348
85346
  await editHistory.recordEdit({
85349
85347
  label: options.label,
85350
85348
  coalesceKey: options.coalesceKey,
85351
85349
  coalesceMs: options.coalesceMs,
85350
+ targets: [editContextTarget(targetPath, selection)],
85352
85351
  files: { [targetPath]: { before: result.before, after: result.after } }
85353
85352
  });
85354
85353
  }, [editHistory]);
@@ -85366,7 +85365,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
85366
85365
  }
85367
85366
  return;
85368
85367
  }
85369
- await recordMutationEdit(targetPath, result, options);
85368
+ await recordMutationEdit(targetPath, selection, result, options);
85370
85369
  const nestedFiles = await settleNestedReads(
85371
85370
  result.scriptText ? readNestedFiles(
85372
85371
  previewIframeRef.current,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio",
3
- "version": "0.9.36",
3
+ "version": "0.9.38",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,12 +60,12 @@
60
60
  "dockview-react": "8.3.1",
61
61
  "gsap": "^3.13.0",
62
62
  "mediabunny": "^1.65.2",
63
- "@hyperframes/parsers": "0.9.36",
64
- "@hyperframes/player": "0.9.36",
65
- "@hyperframes/shader-transitions": "0.9.36",
66
- "@hyperframes/studio-server": "0.9.36",
67
- "@hyperframes/sdk": "0.9.36",
68
- "@hyperframes/core": "0.9.36"
63
+ "@hyperframes/core": "0.9.38",
64
+ "@hyperframes/player": "0.9.38",
65
+ "@hyperframes/parsers": "0.9.38",
66
+ "@hyperframes/sdk": "0.9.38",
67
+ "@hyperframes/shader-transitions": "0.9.38",
68
+ "@hyperframes/studio-server": "0.9.38"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@tailwindcss/vite": "^4.3.3",
@@ -82,7 +82,7 @@
82
82
  "vite": "^6.4.2",
83
83
  "vitest": "^4.1.11",
84
84
  "zustand": "^5.0.0",
85
- "@hyperframes/producer": "0.9.36"
85
+ "@hyperframes/producer": "0.9.38"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "react": "19",
@@ -9,7 +9,6 @@ import type { DomEditSelection } from "./domEditing";
9
9
  import type { PatchOperation } from "../../utils/sourcePatcher";
10
10
  import { formatTimingValue } from "./propertyPanelHelpers";
11
11
  import { readMediaOffsetSeconds } from "@hyperframes/parsers/media-duration";
12
- import { audioGainToFaderPosition } from "@hyperframes/core/audio-gain";
13
12
 
14
13
  (globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
15
14
 
@@ -183,7 +182,7 @@ describe("FlatMediaSection — volume/rate/media-start", () => {
183
182
  />,
184
183
  );
185
184
  });
186
- const volumeTrack = host.querySelector('[data-flat-slider-track="true"][aria-label="Gain"]')!;
185
+ const volumeTrack = host.querySelector('[data-flat-slider-track="true"][aria-label="Volume"]')!;
187
186
  Object.defineProperty(volumeTrack, "getBoundingClientRect", {
188
187
  value: () => ({ left: 0, width: 100, top: 0, height: 2, right: 100, bottom: 2 }),
189
188
  });
@@ -198,38 +197,10 @@ describe("FlatMediaSection — volume/rate/media-start", () => {
198
197
  act(() => root.unmount());
199
198
  });
200
199
 
201
- it("shows the clip's gain and its lane's level as two sliders", () => {
202
- const element = makeVideoElement({ dataAttributes: { volume: "0.5" } });
203
- const host = document.createElement("div");
204
- document.body.append(host);
205
- const root = createRoot(host);
206
- act(() => {
207
- root.render(
208
- <FlatMediaSection
209
- projectDir={null}
210
- element={element}
211
- styles={{}}
212
- onSetStyle={vi.fn()}
213
- onSetAttribute={vi.fn()}
214
- onSetHtmlAttribute={vi.fn()}
215
- onSetAttributeBatch={vi.fn()}
216
- volumeAutomated
217
- automatedVolumeValue={0.25}
218
- />,
219
- );
220
- });
221
- const [gain, volume] = host.querySelectorAll('[data-flat-slider-track="true"]');
222
- expect(labelsOf(host).slice(0, 2)).toEqual(["Gain", "Volume"]);
223
- expect(gain?.getAttribute("aria-valuenow")).toBe(String(audioGainToFaderPosition(0.5)));
224
- expect(volume?.getAttribute("aria-valuenow")).toBe(String(audioGainToFaderPosition(0.25)));
225
- act(() => root.unmount());
226
- });
227
-
228
200
  it.each([true, false])(
229
- "writes Volume through the lane, never data-volume (automated: %s)",
201
+ "Volume sets the whole clip's gain and never writes a keyframe (fade: %s)",
230
202
  (automated) => {
231
203
  const onSetAttribute = vi.fn();
232
- const onCommitVolumeAt = vi.fn();
233
204
  const element = makeVideoElement({ dataAttributes: { volume: "1" } });
234
205
  const host = document.createElement("div");
235
206
  document.body.append(host);
@@ -245,10 +216,12 @@ describe("FlatMediaSection — volume/rate/media-start", () => {
245
216
  onSetHtmlAttribute={vi.fn()}
246
217
  onSetAttributeBatch={vi.fn()}
247
218
  volumeAutomated={automated}
248
- onCommitVolumeAt={onCommitVolumeAt}
249
219
  />,
250
220
  );
251
221
  });
222
+ expect(labelsOf(host).filter((label) => label === "Volume" || label === "Gain")).toEqual([
223
+ "Volume",
224
+ ]);
252
225
  const volumeTrack = host.querySelector(
253
226
  '[data-flat-slider-track="true"][aria-label="Volume"]',
254
227
  )!;
@@ -259,9 +232,7 @@ describe("FlatMediaSection — volume/rate/media-start", () => {
259
232
  volumeTrack.dispatchEvent(new MouseEvent("pointerdown", { bubbles: true, clientX: 100 }));
260
233
  volumeTrack.dispatchEvent(new MouseEvent("pointerup", { bubbles: true, clientX: 100 }));
261
234
  });
262
- expect(onCommitVolumeAt).toHaveBeenCalledTimes(1);
263
- expect(onCommitVolumeAt.mock.calls[0][0]).toBeCloseTo(3.981072, 6);
264
- expect(onSetAttribute).not.toHaveBeenCalledWith("volume", expect.anything());
235
+ expect(onSetAttribute).toHaveBeenCalledWith("volume", "3.981072");
265
236
  act(() => root.unmount());
266
237
  },
267
238
  );
@@ -500,7 +471,7 @@ describe("FlatMediaSection — audio clips", () => {
500
471
  it("shows Fade in / Fade out rows for audio, and for video only when it carries audio", () => {
501
472
  const audio = renderWithRate(makeAudioElement());
502
473
  expect(labelsOf(audio.host)).toEqual(
503
- expect.arrayContaining(["Gain", "Volume", "Speed", "Media start", "Fade in", "Fade out"]),
474
+ expect.arrayContaining(["Volume", "Speed", "Media start", "Fade in", "Fade out"]),
504
475
  );
505
476
  act(() => audio.root.unmount());
506
477
 
@@ -52,8 +52,6 @@ export function FlatMediaSection({
52
52
  volumeAutomated,
53
53
  onAutomateVolume,
54
54
  onRemoveVolumeAutomation,
55
- onCommitVolumeAt,
56
- automatedVolumeValue,
57
55
  rate,
58
56
  }: {
59
57
  projectId?: string | null;
@@ -64,12 +62,10 @@ export function FlatMediaSection({
64
62
  onSetAttribute: (attr: string, value: string) => void | Promise<void>;
65
63
  onSetHtmlAttribute: (attr: string, value: string | null) => void | Promise<void>;
66
64
  onSetAttributeBatch: CommitDomAttributeBatch;
67
- /** A volume lane in the timeline drives the level; the Volume slider writes a keyframe. */
65
+ /** A volume lane in the timeline shapes the level over the clip; the Volume slider offsets all of it. */
68
66
  volumeAutomated?: boolean;
69
67
  onAutomateVolume?: () => void;
70
68
  onRemoveVolumeAutomation?: () => void;
71
- onCommitVolumeAt?: (v: number) => void;
72
- automatedVolumeValue?: number;
73
69
  /** Speed lane binding and presets; absent outside the Studio panel. */
74
70
  rate?: RateBinding;
75
71
  onRemoveBackground?: (
@@ -88,10 +84,7 @@ export function FlatMediaSection({
88
84
  const isVisualMedia = isVideo || isImage;
89
85
  const el = element.element;
90
86
 
91
- // Gain is `data-volume`, ahead of the effects; Volume is the lane's level at the
92
- // playhead, unity without one. What plays is gain times level, as in an editor.
93
87
  const gain = parseNumericValue(element.dataAttributes.volume ?? "") ?? 1;
94
- const volume = volumeAutomated && automatedVolumeValue !== undefined ? automatedVolumeValue : 1;
95
88
  const { mediaStart, mediaStartAttr } = readClipInPoint(element.dataAttributes);
96
89
  const constantRate = Number.parseFloat(element.dataAttributes["playback-rate"] ?? "1") || 1;
97
90
  const playbackRate =
@@ -242,25 +235,7 @@ export function FlatMediaSection({
242
235
  )}
243
236
  {(isVideo || isAudio) && (
244
237
  <>
245
- <FlatSlider
246
- label="Gain"
247
- value={audioGainToFaderPosition(gain)}
248
- min={AUDIO_GAIN_FADER_MIN}
249
- max={AUDIO_GAIN_FADER_MAX}
250
- tier={gain === 1 ? "default" : "explicitCustom"}
251
- displayValue={audioGainToText(gain)}
252
- centerTick
253
- onCommit={(next) =>
254
- void onSetAttribute("volume", formatAudioGain(audioFaderPositionToGain(next)))
255
- }
256
- onCommitText={(text) => {
257
- const next = parseGainInput(text);
258
- if (next === null) return false;
259
- void onSetAttribute("volume", formatAudioGain(next));
260
- return true;
261
- }}
262
- />
263
- {/* A commit writes a keyframe at the playhead, starting a lane when there is none. */}
238
+ {/* Volume is the whole clip's level (`data-volume`); a fade or keyframes ride on top of it. */}
264
239
  <div
265
240
  className="hf-volume-row flex items-center gap-1"
266
241
  data-volume-automated={volumeAutomated ? "" : undefined}
@@ -268,17 +243,19 @@ export function FlatMediaSection({
268
243
  <div className="min-w-0 flex-1">
269
244
  <FlatSlider
270
245
  label="Volume"
271
- value={audioGainToFaderPosition(volume)}
246
+ value={audioGainToFaderPosition(gain)}
272
247
  min={AUDIO_GAIN_FADER_MIN}
273
248
  max={AUDIO_GAIN_FADER_MAX}
274
- tier={volume === 1 ? "default" : "explicitCustom"}
275
- displayValue={audioGainToText(volume)}
249
+ tier={gain === 1 ? "default" : "explicitCustom"}
250
+ displayValue={audioGainToText(gain)}
276
251
  centerTick
277
- onCommit={(next) => onCommitVolumeAt?.(audioFaderPositionToGain(next))}
252
+ onCommit={(next) =>
253
+ void onSetAttribute("volume", formatAudioGain(audioFaderPositionToGain(next)))
254
+ }
278
255
  onCommitText={(text) => {
279
256
  const next = parseGainInput(text);
280
257
  if (next === null) return false;
281
- onCommitVolumeAt?.(next);
258
+ void onSetAttribute("volume", formatAudioGain(next));
282
259
  return true;
283
260
  }}
284
261
  />
@@ -35,11 +35,6 @@ const volumeLane = (v: number) =>
35
35
  const writtenAutomation = (onSetAttributeQuiet: ReturnType<typeof vi.fn>) =>
36
36
  JSON.parse(String(onSetAttributeQuiet.mock.calls[0][1]));
37
37
 
38
- const writtenVolumePoints = (onSetAttributeQuiet: ReturnType<typeof vi.fn>) =>
39
- writtenAutomation(onSetAttributeQuiet).lanes.find(
40
- (l: { target: string }) => l.target === "volume",
41
- ).points;
42
-
43
38
  describe("useVolumeAutomation", () => {
44
39
  it("reports an unautomated track", () => {
45
40
  expect(bind({ volume: "0.55" }).binding.volumeAutomated).toBe(false);
@@ -103,70 +98,6 @@ describe("useVolumeAutomation", () => {
103
98
  expect(onSetAttributeQuiet).toHaveBeenCalledWith("data-automation", null);
104
99
  });
105
100
 
106
- it("writes a keyframe at the playhead instead of the flat attribute", () => {
107
- // The slider used to be disabled while automated; this is what replaces
108
- // that: a commit lands in the envelope, not on `data-volume`.
109
- const { binding, onSetAttributeQuiet } = bind(
110
- { volume: "0.4", automation: volumeLane(0.2), start: "0", duration: "10" },
111
- 5,
112
- );
113
- act(() => binding.onCommitVolumeAt(0.7));
114
- expect(writtenVolumePoints(onSetAttributeQuiet)).toEqual([
115
- { t: 0, v: 0.2 },
116
- { t: 5, v: 0.7 },
117
- ]);
118
- });
119
-
120
- it("clamps the playhead to the clip's own span, not the composition's", () => {
121
- // A playhead past the clip's end must still land the keyframe at the
122
- // clip's own last instant, not off the end of its automation lane.
123
- const { binding, onSetAttributeQuiet } = bind(
124
- { volume: "0.4", automation: volumeLane(0.2), start: "10", duration: "4" },
125
- 50,
126
- );
127
- act(() => binding.onCommitVolumeAt(0.9));
128
- expect(writtenVolumePoints(onSetAttributeQuiet)).toEqual([
129
- { t: 0, v: 0.2 },
130
- { t: 4, v: 0.9 },
131
- ]);
132
- });
133
-
134
- it("moves the existing point instead of stacking a new one when committing near it", () => {
135
- const { binding, onSetAttributeQuiet } = bind(
136
- { volume: "0.4", automation: volumeLane(0.2), start: "0", duration: "10" },
137
- 0,
138
- );
139
- act(() => binding.onCommitVolumeAt(0.9));
140
- expect(writtenVolumePoints(onSetAttributeQuiet)).toEqual([{ t: 0, v: 0.9 }]);
141
- });
142
-
143
- it("reports the envelope's own value at the playhead, not the static attribute", () => {
144
- const { binding } = bind(
145
- { volume: "0.4", automation: volumeLane(0.2), start: "0", duration: "10" },
146
- 0,
147
- );
148
- expect(binding.automatedVolumeValue).toBe(0.2);
149
- });
150
-
151
- it("translates to clip-local time, not composition time, for a clip that starts mid-timeline", () => {
152
- // start=10 keeps this inside the clip's own duration either way, so the
153
- // duration clamp can't mask a missing `currentTime - elStart` subtraction
154
- // the way start=0 cases elsewhere in this file do.
155
- const { binding, onSetAttributeQuiet } = bind(
156
- { volume: "0.4", automation: volumeLane(0.2), start: "10", duration: "20" },
157
- 15,
158
- );
159
- act(() => binding.onCommitVolumeAt(0.9));
160
- expect(writtenVolumePoints(onSetAttributeQuiet)).toEqual([
161
- { t: 0, v: 0.2 },
162
- { t: 5, v: 0.9 },
163
- ]);
164
- });
165
-
166
- it("reports no automated value when the track is not automated", () => {
167
- expect(bind({ volume: "0.4" }).binding.automatedVolumeValue).toBeUndefined();
168
- });
169
-
170
101
  it("reads an unreadable attribute as no automation", () => {
171
102
  expect(bind({ volume: "0.55", automation: "{not json" }).binding.volumeAutomated).toBe(false);
172
103
  });
@@ -49,8 +49,6 @@ export interface VolumeAutomationBinding {
49
49
  volumeAutomated: boolean;
50
50
  onAutomateVolume: () => void;
51
51
  onRemoveVolumeAutomation: () => void;
52
- onCommitVolumeAt: (v: number) => void;
53
- automatedVolumeValue: number | undefined;
54
52
  /** Speed: the `rate` lane, plus the CapCut-style presets that seed it. */
55
53
  rate: RateBinding;
56
54
  }
@@ -118,10 +116,8 @@ export function useVolumeAutomation(
118
116
  );
119
117
  return {
120
118
  volumeAutomated: volume.automated,
121
- automatedVolumeValue: volume.automatedValue,
122
119
  onAutomateVolume: volume.onAutomate,
123
120
  onRemoveVolumeAutomation: volume.onRemoveAutomation,
124
- onCommitVolumeAt: volume.onCommitAt,
125
121
  rate: {
126
122
  ...rate,
127
123
  canApplyPreset: elDuration > 0,
@@ -5,6 +5,7 @@ import type { PublishSdkSession } from "../utils/sdkCutover";
5
5
  import type { StudioEditInFlight } from "../utils/studioPendingEdits";
6
6
  import type { RuntimeTweenChange } from "./gsapRuntimePatch";
7
7
  import type { KeyframeUsageAction } from "../utils/keyframeUsage";
8
+ import type { RecordEditInput } from "../utils/studioFileHistory";
8
9
 
9
10
  /** The file a selection's GSAP write goes to. */
10
11
  export function gsapWriteFile(
@@ -108,12 +109,7 @@ export interface GsapScriptCommitsParams {
108
109
  activeCompPath: string | null;
109
110
  previewIframeRef: React.RefObject<HTMLIFrameElement | null>;
110
111
  editHistory: {
111
- recordEdit: (entry: {
112
- label: string;
113
- coalesceKey?: string;
114
- coalesceMs?: number;
115
- files: Record<string, { before: string; after: string }>;
116
- }) => Promise<void>;
112
+ recordEdit: (entry: RecordEditInput) => Promise<void>;
117
113
  };
118
114
  reloadPreview: () => void;
119
115
  onCacheInvalidate: () => void;