@hyperframes/studio 0.9.41 → 0.9.43

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 (61) hide show
  1. package/dist/assets/{codec-B_mpbc4w.js → codec-DHChmhF2.js} +1 -1
  2. package/dist/assets/{hyperframes-player-Dvi3I_mv.js → hyperframes-player-CdbweVDs.js} +1 -1
  3. package/dist/assets/{index-B5ExwsOp.js → index-CjWDrWWG.js} +166 -166
  4. package/dist/assets/{index-BrFm9Y5k.js → index-l-ti2dV8.js} +1 -1
  5. package/dist/assets/{pausedVideoDecoder-MHQ57yZ6.js → pausedVideoDecoder-xqOQ0ciK.js} +1 -1
  6. package/dist/index.d.ts +9 -1
  7. package/dist/index.html +1 -1
  8. package/dist/index.js +1380 -989
  9. package/package.json +10 -10
  10. package/src/components/editor/LayersPanel.opaque.test.ts +176 -0
  11. package/src/components/editor/LayersPanel.tsx +41 -10
  12. package/src/components/editor/domEditInlineText.ts +1 -16
  13. package/src/components/editor/domEditOverlayGeometry.ts +2 -0
  14. package/src/components/editor/domEditOverlayStartGesture.ts +31 -7
  15. package/src/components/editor/domEditingTypes.ts +7 -1
  16. package/src/components/editor/gestureUndoRevert.ts +18 -1
  17. package/src/components/editor/inlineTextStyleRange.fill.test.ts +129 -0
  18. package/src/components/editor/inlineTextStyleRange.test.ts +0 -82
  19. package/src/components/editor/layerKind.ts +2 -19
  20. package/src/components/editor/layersPanelSort.ts +2 -2
  21. package/src/components/editor/manualEdits.ts +1 -0
  22. package/src/components/editor/manualEditsSnapshot.ts +10 -0
  23. package/src/components/editor/manualOffsetDrag.test.ts +1 -1
  24. package/src/components/editor/manualOffsetDrag.ts +17 -6
  25. package/src/components/editor/marqueeCommit.ts +47 -4
  26. package/src/components/editor/plainTranslate.ts +37 -16
  27. package/src/components/editor/previewDrafts.test.ts +263 -0
  28. package/src/components/editor/previewDrafts.ts +73 -0
  29. package/src/components/editor/previewGestureStartRead.test.ts +279 -0
  30. package/src/components/editor/previewGestureStartRead.ts +67 -0
  31. package/src/components/editor/previewGestureStarts.ts +21 -15
  32. package/src/components/editor/previewLayers.test.ts +308 -0
  33. package/src/components/editor/previewLayers.ts +164 -0
  34. package/src/components/editor/previewOverlayRects.test.ts +62 -0
  35. package/src/components/editor/previewOverlayRects.ts +23 -8
  36. package/src/components/editor/previewPointerTargets.test.ts +68 -1
  37. package/src/components/editor/previewSelection.ts +55 -11
  38. package/src/components/editor/resizeDraft.ts +38 -0
  39. package/src/components/editor/snapTargetCollection.ts +26 -62
  40. package/src/components/editor/useDomEditOverlayGestures.ts +2 -2
  41. package/src/components/editor/useLayerDrag.ts +1 -1
  42. package/src/components/nle/NLEPreview.slowBoot.test.ts +0 -1
  43. package/src/hooks/domEditDeleteMembers.test.ts +7 -0
  44. package/src/hooks/domSelectionTimelineMirror.ts +3 -1
  45. package/src/hooks/timelineTimingSync.ts +4 -1
  46. package/src/hooks/useDomSelection.ts +2 -0
  47. package/src/hooks/useEditorSave.test.tsx +22 -1
  48. package/src/hooks/useEditorSave.ts +3 -1
  49. package/src/hooks/usePreviewInteraction.ts +4 -1
  50. package/src/hooks/useProjectFileWriter.ts +7 -3
  51. package/src/hooks/useTimelineSelectionPreviewSync.test.tsx +30 -0
  52. package/src/hooks/useTimelineSelectionPreviewSync.ts +7 -2
  53. package/src/player/lib/layerOrdering.ts +2 -11
  54. package/src/player/lib/previewElements.ts +68 -0
  55. package/src/test-setup.ts +2 -0
  56. package/src/utils/gsapSoftReload.ts +1 -1
  57. package/src/utils/studioFileHistory.ts +1 -1
  58. package/src/utils/studioHelpers.ts +27 -4
  59. package/src/utils/studioSaveDiagnostics.test.ts +34 -0
  60. package/src/utils/studioSaveDiagnostics.ts +35 -6
  61. package/src/utils/timelineCompositionInsert.ts +3 -1
@@ -1,4 +1,4 @@
1
- import{A as Ht,m as Ke,I as qt,v as le,p as Di,t as oe,b as Ni,a as m,w as Hi,B as we,F as yt,c as ce,d as K,e as Rt,f as Qe,r as vs,g as As,h as Ms,i as Is,j as qi,k as _e,l as Oi,s as Fs,n as $i,o as Bs,q as Be,u as gt,x as Ki,y as Rs,U as Ot,R as Ws,z as ve,C as Oe,D as Qi,V as $e,P as je,E as Gi,G as $t,T as Kt,M as Qt,H as zs,J as Us,K as Vs,L as Ls,N as Ds,O as ji,Q as Xi,S as Ns,W as Yi,X as Ee,Y as Hs,Z as qs,_ as Xe,$ as Os,a0 as $s,a1 as Ks,a2 as Qs,a3 as Gs,a4 as Zi,a5 as ft,a6 as Ji,a7 as es,a8 as ts,a9 as is,aa as ss,ab as js,ac as rs,ad as as,ae as Xs,af as ns,ag as Ys,ah as ht,ai as Jt,aj as bt,ak as Zs,al as w,am as ei,an as Js,ao as er,ap as tr,aq as Me,ar as ir,as as ti,at as Je,au as sr,av as rr,aw as ar,ax as nr,ay as or,az as ii,aA as cr,aB as ur,aC as Y,aD as dr,aE as si,aF as os,aG as ri,aH as cs,aI as us,aJ as _t,aK as Wt,aL as ai,aM as ni,aN as lr,aO as mr,aP as fr,aQ as hr,aR as pr,aS as lt,aT as gr,aU as wr,aV as Tr,aW as oi,aX as yr,aY as br,aZ as _r,a_ as ci,a$ as ui,b0 as di,b1 as Ne,b2 as li,b3 as kr,b4 as Sr,b5 as zt,b6 as et,b7 as tt,b8 as it,b9 as Cr,ba as mt,bb as xr,bc as be,bd as Ut,be as Vt,bf as st,bg as Re,bh as Fe,bi as ke,bj as Ue,bk as Ye,bl as Pr,bm as Ve,bn as We,bo as kt,bp as Er,bq as mi,br as vr,bs as Ar,bt as Lt,bu as Dt,bv as Mr,bw as Ir,bx as Fr,by as Br,bz as ze,bA as rt,bB as fi,bC as Rr,bD as hi,bE as pi,bF as gi,bG as Wr,bH as zr,bI as Ur,bJ as Vr,bK as Lr,bL as Dr}from"./codec-B_mpbc4w.js";import{bM as $n,bN as Kn,bO as Qn,bP as Gn,bQ as jn,bR as Xn,bS as Yn,bT as Zn,bU as Jn,bV as eo,bW as to,bX as io,bY as so,bZ as ro,b_ as ao,b$ as no,c0 as oo,c1 as co,c2 as uo,c3 as lo,c4 as mo,c5 as fo,c6 as ho,c7 as po,c8 as go,c9 as wo,ca as To,cb as yo,cc as bo,cd as _o,ce as ko,cf as So,cg as Co,ch as xo,ci as Po,cj as Eo,ck as vo,cl as Ao,cm as Mo,cn as Io,co as Fo,cp as Bo,cq as Ro,cr as Wo,cs as zo,ct as Uo,cu as Vo,cv as Lo,cw as Do,cx as No,cy as Ho,cz as qo,cA as Oo,cB as $o,cC as Ko,cD as Qo,cE as Go,cF as jo,cG as Xo,cH as Yo,cI as Zo,cJ as Jo,cK as ec,cL as tc,cM as ic,cN as sc,cO as rc,cP as ac,cQ as nc,cR as oc,cS as cc,cT as uc,cU as dc,cV as lc,cW as mc,cX as fc,cY as hc,cZ as pc,c_ as gc,c$ as wc,d0 as Tc,d1 as yc,d2 as bc,d3 as _c,d4 as kc,d5 as Sc,d6 as Cc,d7 as xc,d8 as Pc}from"./codec-B_mpbc4w.js";import{n as wi}from"./index-B5ExwsOp.js";/*!
1
+ import{A as Ht,m as Ke,I as qt,v as le,p as Di,t as oe,b as Ni,a as m,w as Hi,B as we,F as yt,c as ce,d as K,e as Rt,f as Qe,r as vs,g as As,h as Ms,i as Is,j as qi,k as _e,l as Oi,s as Fs,n as $i,o as Bs,q as Be,u as gt,x as Ki,y as Rs,U as Ot,R as Ws,z as ve,C as Oe,D as Qi,V as $e,P as je,E as Gi,G as $t,T as Kt,M as Qt,H as zs,J as Us,K as Vs,L as Ls,N as Ds,O as ji,Q as Xi,S as Ns,W as Yi,X as Ee,Y as Hs,Z as qs,_ as Xe,$ as Os,a0 as $s,a1 as Ks,a2 as Qs,a3 as Gs,a4 as Zi,a5 as ft,a6 as Ji,a7 as es,a8 as ts,a9 as is,aa as ss,ab as js,ac as rs,ad as as,ae as Xs,af as ns,ag as Ys,ah as ht,ai as Jt,aj as bt,ak as Zs,al as w,am as ei,an as Js,ao as er,ap as tr,aq as Me,ar as ir,as as ti,at as Je,au as sr,av as rr,aw as ar,ax as nr,ay as or,az as ii,aA as cr,aB as ur,aC as Y,aD as dr,aE as si,aF as os,aG as ri,aH as cs,aI as us,aJ as _t,aK as Wt,aL as ai,aM as ni,aN as lr,aO as mr,aP as fr,aQ as hr,aR as pr,aS as lt,aT as gr,aU as wr,aV as Tr,aW as oi,aX as yr,aY as br,aZ as _r,a_ as ci,a$ as ui,b0 as di,b1 as Ne,b2 as li,b3 as kr,b4 as Sr,b5 as zt,b6 as et,b7 as tt,b8 as it,b9 as Cr,ba as mt,bb as xr,bc as be,bd as Ut,be as Vt,bf as st,bg as Re,bh as Fe,bi as ke,bj as Ue,bk as Ye,bl as Pr,bm as Ve,bn as We,bo as kt,bp as Er,bq as mi,br as vr,bs as Ar,bt as Lt,bu as Dt,bv as Mr,bw as Ir,bx as Fr,by as Br,bz as ze,bA as rt,bB as fi,bC as Rr,bD as hi,bE as pi,bF as gi,bG as Wr,bH as zr,bI as Ur,bJ as Vr,bK as Lr,bL as Dr}from"./codec-DHChmhF2.js";import{bM as $n,bN as Kn,bO as Qn,bP as Gn,bQ as jn,bR as Xn,bS as Yn,bT as Zn,bU as Jn,bV as eo,bW as to,bX as io,bY as so,bZ as ro,b_ as ao,b$ as no,c0 as oo,c1 as co,c2 as uo,c3 as lo,c4 as mo,c5 as fo,c6 as ho,c7 as po,c8 as go,c9 as wo,ca as To,cb as yo,cc as bo,cd as _o,ce as ko,cf as So,cg as Co,ch as xo,ci as Po,cj as Eo,ck as vo,cl as Ao,cm as Mo,cn as Io,co as Fo,cp as Bo,cq as Ro,cr as Wo,cs as zo,ct as Uo,cu as Vo,cv as Lo,cw as Do,cx as No,cy as Ho,cz as qo,cA as Oo,cB as $o,cC as Ko,cD as Qo,cE as Go,cF as jo,cG as Xo,cH as Yo,cI as Zo,cJ as Jo,cK as ec,cL as tc,cM as ic,cN as sc,cO as rc,cP as ac,cQ as nc,cR as oc,cS as cc,cT as uc,cU as dc,cV as lc,cW as mc,cX as fc,cY as hc,cZ as pc,c_ as gc,c$ as wc,d0 as Tc,d1 as yc,d2 as bc,d3 as _c,d4 as kc,d5 as Sc,d6 as Cc,d7 as xc,d8 as Pc}from"./codec-DHChmhF2.js";import{n as wi}from"./index-CjWDrWWG.js";/*!
2
2
  * Copyright (c) 2026-present, Vanilagy and contributors
3
3
  *
4
4
  * This Source Code Form is subject to the terms of the Mozilla Public
@@ -1 +1 @@
1
- import{l as V}from"./index-B5ExwsOp.js";import{bw as G,bN as K,cH as Q,bE as X}from"./codec-B_mpbc4w.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-CjWDrWWG.js";import{bw as G,bN as K,cH as Q,bE as X}from"./codec-DHChmhF2.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.d.ts CHANGED
@@ -4,7 +4,7 @@ import { RefObject, MutableRefObject, ReactNode, DragEventHandler, ComponentProp
4
4
  import { RuntimeTimelineClipIdentity, PlaybackHeldBy, HyperframePickerElementInfo } from '@hyperframes/core';
5
5
  import { GsapAnimation, ParsedGsap, PropertyGroupName } from '@hyperframes/core/gsap-parser';
6
6
  import { GsapAnimation as GsapAnimation$1, ArcPathSegment } from '@hyperframes/parsers/gsap-parser';
7
- import { EditingElementHandle } from '@hyperframes/core/runtime/editing-port';
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
10
  import { S as StudioKeys, a as StudioKeyAction } from './keys-CaWcxUST.js';
@@ -810,6 +810,12 @@ interface DomEditLayerItem {
810
810
  selector?: string;
811
811
  selectorIndex?: number;
812
812
  sourceFile: string;
813
+ preview?: {
814
+ handle: string;
815
+ zIndex: number;
816
+ kind: LayerKind;
817
+ dataAttributes: Record<string, string>;
818
+ };
813
819
  }
814
820
  interface DomEditContextOptions {
815
821
  activeCompositionPath: string | null;
@@ -1007,8 +1013,10 @@ type TimelineMoveUpdates = Pick<TimelineElement, "start" | "track"> & {
1007
1013
  declare class StudioSaveHttpError extends Error {
1008
1014
  readonly statusCode: number;
1009
1015
  readonly alreadyToasted: boolean;
1016
+ readonly heldFile: boolean;
1010
1017
  constructor(message: string, statusCode: number, options?: {
1011
1018
  alreadyToasted?: boolean;
1019
+ heldFile?: boolean;
1012
1020
  });
1013
1021
  }
1014
1022
  declare class StudioFileConflictError extends StudioSaveHttpError {
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-B5ExwsOp.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-CjWDrWWG.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-4VGEAZyf.css">
19
19
  </head>
20
20
  <body>