@hyperframes/studio 0.9.42 → 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.
@@ -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-CKqLGYc6.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-CKqLGYc6.js";import{n as wi}from"./index-DLyQ91Ek.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-DLyQ91Ek.js";import{bw as G,bN as K,cH as Q,bE as X}from"./codec-CKqLGYc6.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.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-DLyQ91Ek.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>
package/dist/index.js CHANGED
@@ -38379,7 +38379,8 @@ import {
38379
38379
  MAX_DESCRIBE_HANDLES,
38380
38380
  MAX_ELEMENT_ENTRIES,
38381
38381
  MAX_ELEMENT_VALUE,
38382
- MAX_GEOMETRY_CHILDREN
38382
+ MAX_GEOMETRY_CHILDREN,
38383
+ MAX_SNAP_TARGETS
38383
38384
  } from "@hyperframes/core/runtime/editing-port";
38384
38385
  var isFields = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
38385
38386
  var isHandle = (value) => typeof value === "string" && EDITING_ELEMENT_HANDLE.test(value);
@@ -38475,6 +38476,27 @@ async function previewGeometry(iframe, handles, children) {
38475
38476
  children: children && childrenOk ? boxes : null
38476
38477
  };
38477
38478
  }
38479
+ var isFlag = (value) => typeof value === "boolean";
38480
+ var isFiniteFields = (value, keys) => isFields(value) && keys.every((key2) => Number.isFinite(value[key2]));
38481
+ var readGestureStart = (value) => {
38482
+ if (!readGeometry(value) || !isFields(value)) return null;
38483
+ const { layout, move, gsap: gsap3 } = value;
38484
+ const valid = [
38485
+ isFiniteFields(layout, ["width", "height"]),
38486
+ move === null || isFiniteFields(move, ["a", "b", "c", "d"]),
38487
+ gsap3 === null || isFields(gsap3) && isFiniteFields(gsap3, ["x", "y"]) && isFlag(gsap3.moving)
38488
+ ];
38489
+ return valid.includes(false) ? null : value;
38490
+ };
38491
+ async function previewGestureStart(iframe, handles) {
38492
+ if (!handles.length || handles.length > MAX_DESCRIBE_HANDLES) return null;
38493
+ const reply = await previewRequest(iframe, "gesture-start", { handles: [...handles] });
38494
+ const elements = reply?.elements;
38495
+ const snap = reply?.snap;
38496
+ if (!Array.isArray(elements) || elements.length !== handles.length) return null;
38497
+ if (!Array.isArray(snap) || snap.length > MAX_SNAP_TARGETS || !snap.every(isBox)) return null;
38498
+ return { elements: elements.map(readGestureStart), snap };
38499
+ }
38478
38500
  var LAYER_KINDS = /* @__PURE__ */ new Set(["image", "video", "audio", "vector", "group", "text", "shape"]);
38479
38501
  var isLayer = (value) => isFields(value) && isHandle(value.handle) && isCount(value.depth) && isCount(value.childCount) && Number.isFinite(value.zIndex) && LAYER_KINDS.has(value.kind);
38480
38502
  async function previewLayers(iframe, group, offset = 0) {
@@ -38513,6 +38535,10 @@ function groupAwareRect(scale, geometry, oriented) {
38513
38535
  const union = resolveDomEditGroupOverlayRect(members);
38514
38536
  return union ? { ...union, editScaleX: rect.editScaleX, editScaleY: rect.editScaleY } : rect;
38515
38537
  }
38538
+ function flatVisibleRect(scale, box) {
38539
+ const rect = baseRect(scale, box);
38540
+ return { ...rect, ...hugRectForClipPath(rect, box.clipPath) };
38541
+ }
38516
38542
  function visibleRect(scale, box) {
38517
38543
  const rect = orientedRect(scale, box);
38518
38544
  return { ...rect, ...hugRectForClipPath(rect, box.clipPath) };
@@ -38539,12 +38565,6 @@ async function measurePreviewOverlay(iframe, overlayEl, targets) {
38539
38565
  hover: hovered && groupAwareRect(scale, hovered, true)
38540
38566
  };
38541
38567
  }
38542
- async function measurePreviewRects(iframe, overlayEl, handles) {
38543
- const reply = await previewGeometry(iframe, handles);
38544
- const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
38545
- if (!reply || !scale) return null;
38546
- return reply.elements.map((geometry) => geometry && groupAwareRect(scale, geometry, true));
38547
- }
38548
38568
  async function measurePreviewVisibleRects(iframe, overlayEl, handles) {
38549
38569
  const measured = [];
38550
38570
  for (let at = 0; at < handles.length; at += MAX_DESCRIBE_HANDLES2) {
@@ -38552,13 +38572,8 @@ async function measurePreviewVisibleRects(iframe, overlayEl, handles) {
38552
38572
  const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
38553
38573
  if (!reply || !scale) return null;
38554
38574
  for (const box of reply.elements) {
38555
- const rect = box && baseRect(scale, box);
38556
38575
  measured.push(
38557
- box && rect && {
38558
- rect: { ...rect, ...hugRectForClipPath(rect, box.clipPath) },
38559
- frame: box.rect,
38560
- visible: box.visible
38561
- }
38576
+ box && { rect: flatVisibleRect(scale, box), frame: box.rect, visible: box.visible }
38562
38577
  );
38563
38578
  }
38564
38579
  }
@@ -38780,6 +38795,7 @@ function readTranslatePxLeavingPercent(el) {
38780
38795
  return { x: px(x), y: px(y) };
38781
38796
  }
38782
38797
  var UNREADABLE_TRANSLATE = "Studio can't read this layer's translate. Move it in the Code tab.";
38798
+ var MOVING_LAYER_UNREADABLE = "This preview can't save a move of a layer its animation moves yet. Move it in the Code tab.";
38783
38799
  function formatTranslatePx(p) {
38784
38800
  return `${roundTo3(p.x)}px ${roundTo3(p.y)}px`;
38785
38801
  }
@@ -40815,14 +40831,15 @@ function resolveManualOffsetForPointerDelta(input) {
40815
40831
  };
40816
40832
  }
40817
40833
  function createManualOffsetDragMember(input) {
40818
- const plainTranslate = !!input.gesture && editsPlainCss(input.element, input.gesture === "resize" ? "resize" : "move");
40834
+ const { start, gesture } = input;
40835
+ const plainTranslate = start && gesture !== "resize" ? !start.gsap : !!gesture && editsPlainCss(input.element, gesture === "resize" ? "resize" : "move");
40819
40836
  const initialOffset = plainTranslate ? readTranslatePx(input.element) : readAppliedStudioPathOffset(input.element);
40820
40837
  if (!finitePoint(initialOffset))
40821
40838
  return { ok: false, reason: UNREADABLE_TRANSLATE, selection: input.selection };
40822
40839
  const win = input.element.ownerDocument.defaultView;
40823
40840
  const gsapX = !plainTranslate && win?.gsap?.getProperty?.(input.element, "x") || 0;
40824
40841
  const gsapY = !plainTranslate && win?.gsap?.getProperty?.(input.element, "y") || 0;
40825
- const baseGsap = { x: gsapX, y: gsapY };
40842
+ const baseGsap = start?.gsap ? { x: start.gsap.x, y: start.gsap.y } : { x: gsapX, y: gsapY };
40826
40843
  if (!plainTranslate) stampGestureBase(input.element, initialOffset, baseGsap);
40827
40844
  if (win?.__timelines) {
40828
40845
  const paused = [];
@@ -40866,7 +40883,7 @@ function createManualOffsetDragMember(input) {
40866
40883
  baseGsap,
40867
40884
  initialPathOffset,
40868
40885
  gestureToken,
40869
- screenToOffset: { a: w / scaleX, b: 0, c: 0, d: w / scaleY },
40886
+ screenToOffset: start?.screenToOffset ?? { a: w / scaleX, b: 0, c: 0, d: w / scaleY },
40870
40887
  originRect: input.rect
40871
40888
  }
40872
40889
  };
@@ -41152,6 +41169,9 @@ function readRotationBase(element, plain) {
41152
41169
  return gsapRotation + readStudioRotation(element).angle;
41153
41170
  }
41154
41171
 
41172
+ // src/components/editor/snapTargetCollection.ts
41173
+ import { snapCandidates } from "@hyperframes/core/runtime/editing-port";
41174
+
41155
41175
  // src/components/editor/snapEngine.ts
41156
41176
  var SNAP_THRESHOLD_PX = 6;
41157
41177
  var SNAP_ENGAGE_TRAVEL_PX = 4;
@@ -41449,30 +41469,20 @@ function readPositiveDimension2(value) {
41449
41469
  const parsed = Number.parseFloat(value);
41450
41470
  return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
41451
41471
  }
41452
- var IGNORED_TAGS = /* @__PURE__ */ new Set(["script", "style", "link", "meta", "base", "template", "br", "wbr"]);
41453
- function isHtmlElement7(node) {
41454
- return node.nodeType === 1;
41455
- }
41456
- function collectVisibleElements(root, excludeElements, maxItems) {
41457
- const result = [];
41458
- const visit = (el) => {
41459
- if (result.length >= maxItems) return;
41460
- for (const child of Array.from(el.children)) {
41461
- if (!isHtmlElement7(child)) continue;
41462
- if (IGNORED_TAGS.has(child.tagName.toLowerCase())) continue;
41463
- if (child.hasAttribute("data-composition-id")) continue;
41464
- if (excludeElements.has(child)) continue;
41465
- if (!isElementVisibleForOverlay(child)) continue;
41466
- result.push(child);
41467
- visit(child);
41468
- }
41469
- };
41470
- visit(root);
41471
- return result;
41472
+ function snapContextFromRects(composition, rects) {
41473
+ const prefs = readStudioUiPreferences();
41474
+ const entries = rects.flatMap((rect, i) => rect ? [{ rect, id: `snap-target-${i}` }] : []);
41475
+ const gridSpacing = prefs.gridSpacing ?? 50;
41476
+ const snapToGrid = prefs.snapToGrid ?? false;
41477
+ return {
41478
+ targets: extractSnapTargets(entries),
41479
+ compositionTarget: buildCompositionSnapTarget(composition),
41480
+ gridEdges: snapToGrid && gridSpacing > 0 ? buildGridSnapEdges(composition, gridSpacing, composition.editScaleX) : null,
41481
+ snapEnabled: prefs.snapEnabled ?? true
41482
+ };
41472
41483
  }
41473
41484
  function collectSnapContext(input) {
41474
- const prefs = readStudioUiPreferences();
41475
- const snapEnabled = prefs.snapEnabled ?? true;
41485
+ const snapEnabled = readStudioUiPreferences().snapEnabled ?? true;
41476
41486
  const doc = input.iframe.contentDocument;
41477
41487
  if (!doc) {
41478
41488
  return { targets: [], compositionTarget: null, gridEdges: null, snapEnabled };
@@ -41488,32 +41498,19 @@ function collectSnapContext(input) {
41488
41498
  }
41489
41499
  const iframeRect = input.iframe.getBoundingClientRect();
41490
41500
  const overlayRect = input.overlayEl.getBoundingClientRect();
41491
- const rootScaleX = iframeRect.width / rootWidth;
41492
- const rootScaleY = iframeRect.height / rootHeight;
41493
41501
  const compositionOverlayRect = {
41494
41502
  left: iframeRect.left - overlayRect.left,
41495
41503
  top: iframeRect.top - overlayRect.top,
41496
41504
  width: iframeRect.width,
41497
41505
  height: iframeRect.height,
41498
- editScaleX: rootScaleX,
41499
- editScaleY: rootScaleY
41506
+ editScaleX: iframeRect.width / rootWidth,
41507
+ editScaleY: iframeRect.height / rootHeight
41500
41508
  };
41501
- const compositionTarget = buildCompositionSnapTarget(compositionOverlayRect);
41502
- const MAX_SNAP_TARGETS = 80;
41503
- const elements = collectVisibleElements(root, input.excludeElements, MAX_SNAP_TARGETS);
41504
- const entries = [];
41505
- for (let i = 0; i < elements.length; i++) {
41506
- const rect = toVisibleOverlayRect(input.overlayEl, input.iframe, elements[i]);
41507
- if (rect) entries.push({ rect, id: `snap-target-${i}` });
41508
- }
41509
- const targets = extractSnapTargets(entries);
41510
- let gridEdges = null;
41511
- const gridSpacing = prefs.gridSpacing ?? 50;
41512
- const snapToGrid = prefs.snapToGrid ?? false;
41513
- if (snapToGrid && gridSpacing > 0) {
41514
- gridEdges = buildGridSnapEdges(compositionOverlayRect, gridSpacing, rootScaleX);
41515
- }
41516
- return { targets, compositionTarget, gridEdges, snapEnabled };
41509
+ const elements = snapCandidates(root, input.excludeElements);
41510
+ const rects = elements.map(
41511
+ (element) => toVisibleOverlayRect(input.overlayEl, input.iframe, element)
41512
+ );
41513
+ return snapContextFromRects(compositionOverlayRect, rects);
41517
41514
  }
41518
41515
  function buildExcludeElements(input) {
41519
41516
  const elements = /* @__PURE__ */ new Set();
@@ -41629,7 +41626,7 @@ function notifyBlockedPress(e, opts, selection) {
41629
41626
  if (e.button !== 0 || selection.capabilities.commitCheckPending) return;
41630
41627
  opts.onBlockedMoveRef.current(selection);
41631
41628
  }
41632
- function startGroupDrag(e, opts, at) {
41629
+ function startGroupDrag(e, opts, at, snap) {
41633
41630
  const items = opts.groupOverlayItemsRef.current;
41634
41631
  if (items.length <= 1) return false;
41635
41632
  const blockedSelection = items.find(
@@ -41641,6 +41638,13 @@ function startGroupDrag(e, opts, at) {
41641
41638
  notifyBlockedPress(e, opts, blockedSelection);
41642
41639
  return false;
41643
41640
  }
41641
+ const moving2 = items.find((item) => item.start?.gsap?.moving)?.selection;
41642
+ if (moving2) {
41643
+ e.preventDefault();
41644
+ e.stopPropagation();
41645
+ opts.onBlockedMoveRef.current(moving2, MOVING_LAYER_UNREADABLE);
41646
+ return false;
41647
+ }
41644
41648
  opts.onManualDragStartRef.current?.();
41645
41649
  const dragItems = filterNestedDomEditGroupItems(items);
41646
41650
  const members = [];
@@ -41651,7 +41655,8 @@ function startGroupDrag(e, opts, at) {
41651
41655
  element: item.element,
41652
41656
  rect: item.rect,
41653
41657
  gesture: "drag",
41654
- at
41658
+ at,
41659
+ start: item.start
41655
41660
  });
41656
41661
  if (!result.ok) {
41657
41662
  restoreManualOffsetDragMembers(members);
@@ -41681,14 +41686,14 @@ function startGroupDrag(e, opts, at) {
41681
41686
  });
41682
41687
  const overlayEl = opts.overlayRef.current;
41683
41688
  const iframe = opts.iframeRef.current;
41684
- const snapContext = overlayEl && iframe ? collectSnapContext({
41689
+ const snapContext = snap ?? (overlayEl && iframe ? collectSnapContext({
41685
41690
  overlayEl,
41686
41691
  iframe,
41687
41692
  excludeElements: buildExcludeElements({
41688
41693
  iframe,
41689
41694
  groupSelections: items.map((i) => i.selection)
41690
41695
  })
41691
- }) : void 0;
41696
+ }) : void 0);
41692
41697
  e.preventDefault();
41693
41698
  e.stopPropagation();
41694
41699
  e.currentTarget.setPointerCapture(e.pointerId);
@@ -41710,6 +41715,7 @@ function startGroupDrag(e, opts, at) {
41710
41715
  }
41711
41716
  function startGesture(kind, e, opts, options) {
41712
41717
  const at = options?.at;
41718
+ const start = options?.start;
41713
41719
  const sel = options?.selection ?? opts.selectionRef.current;
41714
41720
  const rect = options?.rect ?? opts.overlayRectRef.current;
41715
41721
  const box = opts.boxRef.current;
@@ -41723,8 +41729,8 @@ function startGesture(kind, e, opts, options) {
41723
41729
  if (kind === "resize" && (!Number.isFinite(rect.width) || !Number.isFinite(rect.height)))
41724
41730
  return false;
41725
41731
  const size = readStudioBoxSize(sel.element);
41726
- const layoutWidth = sel.element.offsetWidth;
41727
- const layoutHeight = sel.element.offsetHeight;
41732
+ const layoutWidth = start?.layout.width ?? sel.element.offsetWidth;
41733
+ const layoutHeight = start?.layout.height ?? sel.element.offsetHeight;
41728
41734
  const actualWidth = size.width > 0 ? size.width : layoutWidth > 0 ? layoutWidth : rect.width / rect.editScaleX;
41729
41735
  const actualHeight = size.height > 0 ? size.height : layoutHeight > 0 ? layoutHeight : rect.height / rect.editScaleY;
41730
41736
  const rawContentScaleX = rect.width / (rect.editScaleX * actualWidth);
@@ -41739,6 +41745,11 @@ function startGesture(kind, e, opts, options) {
41739
41745
  let manualEditDragToken;
41740
41746
  let pathOffsetMember;
41741
41747
  if (kind === "drag") {
41748
+ if (start?.gsap?.moving) {
41749
+ opts.onBlockedMoveRef.current(sel, MOVING_LAYER_UNREADABLE);
41750
+ e.preventDefault();
41751
+ return false;
41752
+ }
41742
41753
  opts.onManualDragStartRef.current?.();
41743
41754
  const result = createManualOffsetDragMember({
41744
41755
  key: selectionCacheKey(sel),
@@ -41746,7 +41757,8 @@ function startGesture(kind, e, opts, options) {
41746
41757
  element: sel.element,
41747
41758
  rect,
41748
41759
  gesture: "drag",
41749
- at
41760
+ at,
41761
+ start
41750
41762
  });
41751
41763
  if (!result.ok) {
41752
41764
  opts.onBlockedMoveRef.current(result.selection, result.reason);
@@ -41765,7 +41777,8 @@ function startGesture(kind, e, opts, options) {
41765
41777
  element: sel.element,
41766
41778
  rect,
41767
41779
  gesture: "resize",
41768
- at
41780
+ at,
41781
+ start
41769
41782
  });
41770
41783
  if (result.ok) {
41771
41784
  pathOffsetMember = result.member;
@@ -41796,7 +41809,7 @@ function startGesture(kind, e, opts, options) {
41796
41809
  const corners = elementCornerOverlayPoints(overlayEl, iframe, sel.element);
41797
41810
  if (corners) resizeFixedCenterStart = overlayCornersCentroid(corners);
41798
41811
  }
41799
- const snapContext = (kind === "drag" || kind === "resize") && overlayEl && iframe ? collectSnapContext({
41812
+ const snapContext = (kind === "drag" || kind === "resize") && overlayEl && iframe ? options?.snap ?? collectSnapContext({
41800
41813
  overlayEl,
41801
41814
  iframe,
41802
41815
  excludeElements: buildExcludeElements({ iframe, selection: sel })
@@ -41873,6 +41886,44 @@ function editMoment(stamp) {
41873
41886
  return stamp?.at ?? playheadMoment();
41874
41887
  }
41875
41888
 
41889
+ // src/components/editor/previewGestureStartRead.ts
41890
+ async function measurePreviewGestureStart(iframe, overlayEl, handles) {
41891
+ const reply = await previewGestureStart(iframe, handles);
41892
+ const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
41893
+ if (!reply || !scale) return null;
41894
+ const { iframeRect, overlayRect, rootScaleX: sx, rootScaleY: sy } = scale;
41895
+ const screenToOffset = (move) => move && invertManualOffsetDragMatrix({
41896
+ a: move.a * sx,
41897
+ b: move.b * sy,
41898
+ c: move.c * sx,
41899
+ d: move.d * sy
41900
+ });
41901
+ const composition = {
41902
+ left: iframeRect.left - overlayRect.left,
41903
+ top: iframeRect.top - overlayRect.top,
41904
+ width: iframeRect.width,
41905
+ height: iframeRect.height,
41906
+ editScaleX: sx,
41907
+ editScaleY: sy
41908
+ };
41909
+ return {
41910
+ elements: reply.elements.map(
41911
+ (start) => start && {
41912
+ rect: groupAwareRect(scale, start, true),
41913
+ start: {
41914
+ layout: start.layout,
41915
+ screenToOffset: screenToOffset(start.move),
41916
+ gsap: start.gsap
41917
+ }
41918
+ }
41919
+ ),
41920
+ snap: snapContextFromRects(
41921
+ composition,
41922
+ reply.snap.map((box) => flatVisibleRect(scale, box))
41923
+ )
41924
+ };
41925
+ }
41926
+
41876
41927
  // src/components/editor/previewGestureStarts.ts
41877
41928
  var MAX_SETTLED_WAIT_FRAMES = 60;
41878
41929
  var PRESS_WAIT_MAX_MS = 1e4;
@@ -41961,16 +42012,19 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
41961
42012
  );
41962
42013
  const handles = found.map((element) => element?.handle);
41963
42014
  if (!overlay || !handles.length || !handles.every(Boolean)) return null;
41964
- const rects = await measurePreviewRects(iframe, overlay, handles);
42015
+ const read2 = await measurePreviewGestureStart(iframe, overlay, handles);
41965
42016
  const shown3 = selections.flatMap((selection, i) => {
41966
- const rect = rects?.[i];
41967
- return rect ? [{ selection: { ...selection, handle: handles[i] }, rect }] : [];
42017
+ const element = read2?.elements[i];
42018
+ return element ? [{ selection: { ...selection, handle: handles[i] }, ...element }] : [];
41968
42019
  });
41969
- return shown3.length === selections.length ? shown3 : null;
42020
+ return read2 && shown3.length === selections.length ? { shown: shown3, snap: read2.snap } : null;
41970
42021
  };
41971
42022
  const startOnShownPreview = (e, pressed, start, draw = null, targets = () => []) => {
41972
42023
  const at = playheadMoment();
41973
- if (!isPreviewChanging() && !opts.waitingPressRef.current) return start(e, at, false);
42024
+ const iframe = opts.iframeRef.current;
42025
+ const channel = iframe && previewFrameOpaque(iframe) ? iframe : null;
42026
+ if (!channel && !isPreviewChanging() && !opts.waitingPressRef.current)
42027
+ return start(e, at, false);
41974
42028
  e.preventDefault();
41975
42029
  e.stopPropagation();
41976
42030
  e.currentTarget.setPointerCapture(e.pointerId);
@@ -42005,8 +42059,6 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
42005
42059
  settledFrames = settled ? settledFrames + 1 : 0;
42006
42060
  return elements.length;
42007
42061
  };
42008
- const iframe = opts.iframeRef.current;
42009
- const channel = iframe && previewFrameOpaque(iframe) ? iframe : null;
42010
42062
  let overChannel;
42011
42063
  let asked = false;
42012
42064
  const channelStep = (frame3) => {
@@ -42072,11 +42124,12 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
42072
42124
  (pressed, at, waited, overChannel) => {
42073
42125
  if (!waited) return startGroupDrag(pressed, opts, at);
42074
42126
  if (overChannel) {
42075
- const measured2 = items.map((item, i) => ({ ...item, ...overChannel[i] }));
42127
+ const measured2 = items.map((item, i) => ({ ...item, ...overChannel.shown[i] }));
42076
42128
  return startGroupDrag(
42077
42129
  pressed,
42078
42130
  { ...opts, groupOverlayItemsRef: { current: measured2 } },
42079
- at
42131
+ at,
42132
+ overChannel.snap
42080
42133
  );
42081
42134
  }
42082
42135
  const overlay = opts.overlayRef.current;
@@ -42118,13 +42171,15 @@ function createPreviewGestureStarts(opts, moveActiveGesture, releaseActiveGestur
42118
42171
  },
42119
42172
  (pressed, at, waited, overChannel) => {
42120
42173
  if (!waited) return startGesture(kind, pressed, opts, { ...options, at });
42121
- const shown3 = overChannel ? overChannel[0] : shownOnPage(target);
42174
+ const shown3 = overChannel ? overChannel.shown[0] : shownOnPage(target);
42122
42175
  return !!shown3 && startGesture(kind, pressed, opts, {
42123
42176
  selection: shown3.selection,
42124
42177
  rect: shown3.rect,
42125
42178
  resizeHandle: options?.resizeHandle,
42126
42179
  resizeCorner: options?.resizeCorner,
42127
- at
42180
+ at,
42181
+ start: shown3.start,
42182
+ snap: overChannel?.snap
42128
42183
  });
42129
42184
  },
42130
42185
  draw,
@@ -49648,7 +49703,7 @@ function keyframeCount(anim) {
49648
49703
  }
49649
49704
 
49650
49705
  // src/components/editor/MotionPathOverlay.tsx
49651
- import { isHtmlElement as isHtmlElement9 } from "@hyperframes/core/runtime/dom-realm";
49706
+ import { isHtmlElement as isHtmlElement8 } from "@hyperframes/core/runtime/dom-realm";
49652
49707
 
49653
49708
  // src/components/editor/MotionPathNode.tsx
49654
49709
  import { Fragment as Fragment33, jsx as jsx115, jsxs as jsxs80 } from "react/jsx-runtime";
@@ -50310,7 +50365,7 @@ function elementHome(el) {
50310
50365
 
50311
50366
  // src/components/editor/useMotionPathData.ts
50312
50367
  import { useEffect as useEffect64, useRef as useRef81, useState as useState60 } from "react";
50313
- import { isHtmlElement as isHtmlElement8 } from "@hyperframes/core/runtime/dom-realm";
50368
+ import { isHtmlElement as isHtmlElement7 } from "@hyperframes/core/runtime/dom-realm";
50314
50369
  function transformWDivisor(el) {
50315
50370
  const t2 = el.ownerDocument?.defaultView?.getComputedStyle(el).transform;
50316
50371
  if (!t2 || !t2.startsWith("matrix3d(")) return 1;
@@ -50366,7 +50421,7 @@ function useMotionPathData(iframeRef, selector) {
50366
50421
  target = el.contentDocument?.querySelector(selector) ?? null;
50367
50422
  } catch {
50368
50423
  }
50369
- const live = isHtmlElement8(target) ? target : null;
50424
+ const live = isHtmlElement7(target) ? target : null;
50370
50425
  const vis = live ? isElementVisibleForOverlay(live) : true;
50371
50426
  setVisibleInPreview((prev) => prev === vis ? prev : vis);
50372
50427
  if (live) {
@@ -50487,7 +50542,7 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
50487
50542
  return;
50488
50543
  }
50489
50544
  const live = frame3.contentDocument?.querySelector(createSelector);
50490
- if (!isHtmlElement9(live)) return;
50545
+ if (!isHtmlElement8(live)) return;
50491
50546
  e.stopPropagation();
50492
50547
  e.preventDefault();
50493
50548
  const sc = r.width / compW;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio",
3
- "version": "0.9.42",
3
+ "version": "0.9.43",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -64,12 +64,12 @@
64
64
  "dockview-react": "8.3.1",
65
65
  "gsap": "^3.13.0",
66
66
  "mediabunny": "^1.65.2",
67
- "@hyperframes/player": "0.9.42",
68
- "@hyperframes/parsers": "0.9.42",
69
- "@hyperframes/shader-transitions": "0.9.42",
70
- "@hyperframes/core": "0.9.42",
71
- "@hyperframes/studio-server": "0.9.42",
72
- "@hyperframes/sdk": "0.9.42"
67
+ "@hyperframes/core": "0.9.43",
68
+ "@hyperframes/parsers": "0.9.43",
69
+ "@hyperframes/player": "0.9.43",
70
+ "@hyperframes/shader-transitions": "0.9.43",
71
+ "@hyperframes/sdk": "0.9.43",
72
+ "@hyperframes/studio-server": "0.9.43"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@tailwindcss/vite": "^4.3.3",
@@ -86,7 +86,7 @@
86
86
  "vite": "^6.4.5",
87
87
  "vitest": "^4.1.12",
88
88
  "zustand": "^5.0.0",
89
- "@hyperframes/producer": "0.9.42"
89
+ "@hyperframes/producer": "0.9.43"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "react": "19",
@@ -15,6 +15,7 @@ import {
15
15
  type ElementTransformSnapshot,
16
16
  } from "@hyperframes/core/runtime/editing-port";
17
17
  import { type OverlayMeasurePass, readThroughPass } from "./domEditOverlayMeasurePass";
18
+ import type { PreviewGestureStart } from "./previewGestureStartRead";
18
19
 
19
20
  export const RESIZE_HANDLE_HIT_PX = 16;
20
21
 
@@ -40,6 +41,7 @@ export interface GroupOverlayItem {
40
41
  selection: DomEditSelection;
41
42
  element: HTMLElement;
42
43
  rect: OverlayRect;
44
+ start?: PreviewGestureStart;
43
45
  }
44
46
 
45
47
  export type ResolvedElementRef = {