@hyperframes/studio 0.9.45 → 0.9.47

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 (34) hide show
  1. package/dist/assets/{hyperframes-player-C7JtYIRD.js → hyperframes-player-DTdMXCCs.js} +1 -1
  2. package/dist/assets/{index-C7EGuz1n.js → index-CdtV6F8j.js} +121 -121
  3. package/dist/assets/index-DA5GM2Mj.js +469 -0
  4. package/dist/assets/pausedVideoDecoder-B4OsoiOL.js +1 -0
  5. package/dist/{chunk-FQ3VRKMC.js → chunk-5ZHKYODQ.js} +1 -0
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.html +1 -1
  8. package/dist/index.js +569 -534
  9. package/dist/{keys-CaWcxUST.d.ts → keys-B163OjLN.d.ts} +1 -0
  10. package/dist/keys.d.ts +1 -1
  11. package/dist/keys.js +1 -1
  12. package/package.json +9 -9
  13. package/src/captions/hooks/useCaptionSync.test.ts +45 -0
  14. package/src/captions/hooks/useCaptionSync.ts +8 -3
  15. package/src/hooks/gsapMutationClient.ts +6 -2
  16. package/src/hooks/useDomEditCommitsHelpers.test.ts +16 -0
  17. package/src/hooks/useDomEditCommitsHelpers.ts +3 -1
  18. package/src/hooks/useElementLifecycleOps.ts +1 -0
  19. package/src/hooks/useFreezeFrame.test.ts +9 -0
  20. package/src/hooks/useFreezeFrame.ts +3 -1
  21. package/src/hooks/useGroupCommits.ts +3 -0
  22. package/src/hooks/useTimelineDeleteOps.test.tsx +26 -0
  23. package/src/hooks/useTimelineDeleteOps.ts +3 -1
  24. package/src/player/components/ShortcutsPanel.test.tsx +75 -0
  25. package/src/player/components/ShortcutsPanel.tsx +20 -4
  26. package/src/player/components/studioKeyDefaults.ts +1 -0
  27. package/src/player/components/studioShortcuts.ts +1 -0
  28. package/src/player/lib/mediabunnyHevcSps.test.ts +169 -0
  29. package/src/utils/studioSaveDiagnostics.test.ts +10 -0
  30. package/src/utils/studioSaveDiagnostics.ts +10 -0
  31. package/src/utils/timelineCompositionInsert.ts +3 -1
  32. package/dist/assets/codec-DQ7n-U_9.js +0 -314
  33. package/dist/assets/index-CByWY7fK.js +0 -150
  34. package/dist/assets/pausedVideoDecoder-Bnvo9NIs.js +0 -1
@@ -0,0 +1 @@
1
+ import{Input as V,ALL_FORMATS as G,UrlSource as K,VideoSampleSink as Q}from"./index-DA5GM2Mj.js";import{l as X}from"./index-CdtV6F8j.js";const x=1e-5,k=1e-9,T=h=>!h.variableFrameRate&&(h.frameRate??0)>0;function Y(h,s){const{sourceLead:r,inputLead:l,timeResolution:d,frameRate:p=0}=s;if(!T(s))return Math.max(l,h-r+l)+k;const w=Math.max(0,Math.floor((h-r)*p+k)),f=l+w/p;return(d>0?Math.round(f*d)/d:f)+x}function J(h,s,r){const{frameRate:l=0,sourceLead:d,inputLead:p}=r,w=T(r)?Math.round((h-p)*l)/l+d:h-p+d,f=Math.min(s,w);return{timestamp:f,duration:Math.max(T(r)?1/l:0,s-f+x)}}const E=64*1024*1024,M=4,Z=.5,$=2e3;async function q(h,s){if(!h.transparent)return h.sink.getSample(s);let r=null;try{for await(const l of h.sink.samplesAtTimestamps([s]))r==null||r.close(),r=l;return r}catch(l){throw r==null||r.close(),l}}function ot(h){const s=new Map,r=new Map,l=new Map,d=new Map,p=new Map;let w=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(([i])=>e.endsWith(i)).sort(([i],[a])=>a.length-i.length)[0])==null?void 0:n[1]},b=(t=E)=>{for(const[e,o]of p){if(w<=t)break;e.pins>0||(p.delete(e),o.cache.delete(e.timestamp),w-=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),w-=o.bytes,o.image.close();t.cache.clear(),t.canvas.width=t.canvas.height=0})();return t.transparent?new Promise((o,n)=>{const i=setTimeout(()=>{t.cancelReads(),o()},$);e.then(o,n).finally(()=>clearTimeout(i))}):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&&(s.delete(t.key),v(t))},1e4))},D=async t=>{const e=X("thumbnail"),o=new V({source:new K(t,e),formats:G});l.set(o,e.cancelReads);try{const n=await o.getPrimaryVideoTrack();if(!n||f)throw new Error("Preview video unavailable");const[i,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()]),g=document.createElement("canvas");g.width=Math.max(1,Math.ceil(i));const z=F%180===0?m/S:S/m;return g.height=Math.max(1,Math.round(g.width/z)),{key:t,input:o,cancelReads:e.cancelReads,sink:new Q(n),canvas:g,rotation:F,flip:B,width:i,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 s){if(s.size<M)break;const e=r.get(t);e&&e.users===0&&![...e.cache.values()].some(o=>o.pins>0)&&(s.delete(t),v(e))}if(s.size>=M)throw new Error("Preview decoder budget reached")},L=async t=>{const e=t;if((d.get(e)??0)>performance.now())throw new Error("Preview decoder cooling down");let o=s.get(e);o||(I(),o=D(t),s.set(e,o)),s.delete(e),s.set(e,o);let n;try{n=await o}catch(i){throw s.get(e)===o&&(s.delete(e),d.set(e,performance.now()+5e3)),i}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 i=n.value;let a=!1;try{if(R(t,o),i.timestamp>e+1e-6)return null;if(a=i.timestamp+i.duration>e+1e-6,a)return i}finally{a||i.close()}}},A=(t,e)=>(e.pins++,p.delete(e),p.set(e,t),e),W=async(t,e,o,n,i)=>{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(i.aborted||f||t.disposed)throw u.close(),i.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(b(E-c.bytes),w+c.bytes>E)throw u.close(),new Error("Preview frame budget reached");return t.cache.set(c.timestamp,c),p.set(c,t),w+=c.bytes,c},U=(t,e,o)=>!t.transparent&&!o.variableFrameRate&&(o.frameRate??0)>0&&e>t.lastTime+1e-6&&e-t.lastTime<=Z,C=async(t,e,o,n)=>{R(t,n);const i=[...t.cache.values()].find(m=>e>=m.timestamp-1e-6&&e<m.timestamp+m.duration-1e-6);if(i)return A(t,i);const a=Y(e,o),u=U(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(()=>{})}},H=(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}},N=async(t,e)=>{e.throwIfAborted();const o=t.source;if(!o)throw new Error("Preview source unavailable");const n=await L(o);try{const i=H(t,n),a=n.tail.then(()=>C(n,t.time,i,e));n.tail=a.then(()=>{},()=>{});const u=await a;let c=!1;return b(),{source:u.image,timestamp:u.timestamp,duration:u.duration,width:n.width,height:n.height,release(){c||(c=!0,u.pins--,b(),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=>N(a,e))),n=o.find(a=>a.status==="rejected"),i=o.flatMap(a=>a.status==="fulfilled"?[a.value]:[]);if(n||f||e.aborted){for(const a of i)a.release();throw n?n.reason:new DOMException("Preview cancelled","AbortError")}return i},async suspend(){const t=[...s.values()].map(e=>e.then(v).catch(()=>{}));s.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 s.values())t.then(v).catch(()=>{});s.clear(),d.clear()}}}}export{ot as createPausedVideoDecoder};
@@ -96,6 +96,7 @@ var DEFAULT_STUDIO_KEYS = {
96
96
  snap: "s",
97
97
  grid: "g",
98
98
  timelineSnap: "n",
99
+ shortcuts: "?",
99
100
  playPause: "Space",
100
101
  frameBack: "ArrowLeft",
101
102
  frameForward: "ArrowRight",
package/dist/index.d.ts CHANGED
@@ -7,8 +7,8 @@ import { GsapAnimation as GsapAnimation$1, ArcPathSegment } from '@hyperframes/p
7
7
  import { EditingElementHandle, LayerKind } from '@hyperframes/core/runtime/editing-port';
8
8
  import { Composition } from '@hyperframes/sdk';
9
9
  import * as react_jsx_runtime from 'react/jsx-runtime';
10
- import { S as StudioKeys, a as StudioKeyAction } from './keys-CaWcxUST.js';
11
- export { C as Combo, D as DEFAULT_STUDIO_KEYS, f as formatCombo, m as matchCombo, p as parseCombo } from './keys-CaWcxUST.js';
10
+ import { S as StudioKeys, a as StudioKeyAction } from './keys-B163OjLN.js';
11
+ export { C as Combo, D as DEFAULT_STUDIO_KEYS, f as formatCombo, m as matchCombo, p as parseCombo } from './keys-B163OjLN.js';
12
12
  import * as zustand from 'zustand';
13
13
  import { StoreApi } from 'zustand';
14
14
  export { Player } from './player.js';
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-C7EGuz1n.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-CdtV6F8j.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-CU24FmKd.css">
19
19
  </head>
20
20
  <body>