@hyperframes/studio 0.9.61 → 0.9.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{hyperframes-player-Cm0hYGm2.js → hyperframes-player-mSF_GvRs.js} +1 -1
- package/dist/assets/{index-BGrNWeLK.js → index-CVmmHGol.js} +168 -168
- package/dist/assets/{index-REqr_dLu.js → index-DN167Uqf.js} +1 -1
- package/dist/assets/{pausedVideoDecoder-DqLDSq8J.js → pausedVideoDecoder-C8rhpGPx.js} +1 -1
- package/dist/{chunk-UM4CLD4M.js → chunk-OJLNM6V5.js} +1 -1
- package/dist/{chunk-3KCEIESB.js → chunk-VDDEXNVX.js} +11 -1
- package/dist/{chunk-OOGQ5KCC.js → chunk-YQ3ZAXXY.js} +8 -27
- package/dist/{domEditingLayers-IHYA42AJ.js → domEditingLayers-YYHWRNF4.js} +2 -2
- package/dist/index.html +1 -1
- package/dist/index.js +1163 -1000
- package/dist/player.js +2 -2
- package/package.json +8 -8
- package/src/components/nle/AudioMeterStrip.tsx +63 -2
- package/src/components/nle/audioSealedPreview.test.ts +254 -0
- package/src/components/nle/zLaneGesture.test.ts +67 -0
- package/src/components/nle/zLaneGesture.ts +4 -0
- package/src/hooks/timelineAudioGroupCreate.ts +57 -7
- package/src/hooks/timelineAudioGroupVolume.ts +110 -34
- package/src/main.tsx +14 -11
- package/src/player/components/Timeline.newTrack.test.tsx +106 -0
- package/src/player/components/TimelineLanes.tsx +4 -2
- package/src/player/components/TimelineTrackHeader.tsx +12 -4
- package/src/player/components/clipMenuAudioItems.tsx +46 -3
- package/src/player/components/timelineRowKeys.test.ts +28 -0
- package/src/player/components/timelineRowKeys.ts +27 -0
- package/src/player/hooks/useTimelineSyncCallbacks.sealed.test.ts +98 -0
- package/src/player/hooks/useTimelineSyncCallbacks.ts +23 -8
- package/src/player/lib/playbackTypes.ts +0 -2
- package/src/player/lib/previewChannel.ts +10 -0
- package/src/player/lib/timelineElementHelpers.ts +7 -42
- package/src/player/lib/timelineIframeHelpers.test.ts +18 -137
- package/src/player/lib/timelineIframeHelpers.ts +15 -94
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Input as V,ALL_FORMATS as G,UrlSource as K,VideoSampleSink as Q}from"./index-
|
|
1
|
+
import{Input as V,ALL_FORMATS as G,UrlSource as K,VideoSampleSink as Q}from"./index-DN167Uqf.js";import{l as X}from"./index-CVmmHGol.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};
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
querySelectorAllSafely,
|
|
19
19
|
studioApiFetch,
|
|
20
20
|
withSelectorIndexPass
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-YQ3ZAXXY.js";
|
|
22
22
|
|
|
23
23
|
// src/components/editor/domEditingLayers.ts
|
|
24
24
|
import { isClipHiddenByRuntime, PREVIEW_ONLY_ATTRS } from "@hyperframes/core/studio-preview-mark";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
buildProjectApiPath,
|
|
6
6
|
splitTimelineElementKey,
|
|
7
7
|
studioApiFetch
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YQ3ZAXXY.js";
|
|
9
9
|
|
|
10
10
|
// src/player/lib/time.ts
|
|
11
11
|
var STUDIO_PREVIEW_FPS = 30;
|
|
@@ -1207,6 +1207,15 @@ async function previewComputedStyles(iframe, target, properties) {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
return read;
|
|
1209
1209
|
}
|
|
1210
|
+
async function previewDocumentCopy(iframe) {
|
|
1211
|
+
const reply = await previewRequest(iframe, "document-markup", {});
|
|
1212
|
+
if (typeof reply?.html !== "string" || typeof reply.baseURI !== "string") return null;
|
|
1213
|
+
const doc = new DOMParser().parseFromString(reply.html, "text/html");
|
|
1214
|
+
const base = doc.createElement("base");
|
|
1215
|
+
base.setAttribute("href", reply.baseURI);
|
|
1216
|
+
doc.head.prepend(base);
|
|
1217
|
+
return doc;
|
|
1218
|
+
}
|
|
1210
1219
|
|
|
1211
1220
|
// src/utils/studioFileVersion.ts
|
|
1212
1221
|
var WRITE_TOKEN_TTL_MS = 5 * 6e4;
|
|
@@ -2588,6 +2597,7 @@ export {
|
|
|
2588
2597
|
previewClipManifest,
|
|
2589
2598
|
previewConsoleErrors,
|
|
2590
2599
|
previewComputedStyles,
|
|
2600
|
+
previewDocumentCopy,
|
|
2591
2601
|
announcePreviewDocumentLoaded,
|
|
2592
2602
|
onPreviewDocumentLoaded,
|
|
2593
2603
|
onPreviewContentReplaced,
|
|
@@ -437,6 +437,12 @@ function sameTimelineText(a, b) {
|
|
|
437
437
|
return a.value === b.value && a.fontFamily === b.fontFamily && a.fontWeight === b.fontWeight && a.color === b.color && a.background === b.background;
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
+
// src/player/lib/timelineElementHelpers.ts
|
|
441
|
+
import {
|
|
442
|
+
previewElementFinder,
|
|
443
|
+
previewElementSourceFile as getTimelineElementSourceFile
|
|
444
|
+
} from "@hyperframes/core/studio-preview-mark";
|
|
445
|
+
|
|
440
446
|
// src/player/lib/playbackAdapter.ts
|
|
441
447
|
function isFinitePositive(value) {
|
|
442
448
|
return Number.isFinite(value) && value > 0;
|
|
@@ -749,10 +755,6 @@ function getTimelineElementSelector(el) {
|
|
|
749
755
|
}
|
|
750
756
|
return void 0;
|
|
751
757
|
}
|
|
752
|
-
function getTimelineElementSourceFile(el) {
|
|
753
|
-
const ownerRoot = el.parentElement?.closest("[data-composition-id]");
|
|
754
|
-
return ownerRoot?.getAttribute("data-composition-file") ?? ownerRoot?.getAttribute("data-composition-src") ?? void 0;
|
|
755
|
-
}
|
|
756
758
|
function getTimelineElementSelectorIndex(doc, el, selector) {
|
|
757
759
|
return getSourceScopedSelectorIndex(
|
|
758
760
|
doc,
|
|
@@ -849,27 +851,6 @@ function findInClipScope(doc, clip, selectors) {
|
|
|
849
851
|
}
|
|
850
852
|
return lone;
|
|
851
853
|
}
|
|
852
|
-
function previewElementFinder(doc, selector = "[data-hf-id], [id]") {
|
|
853
|
-
const byKey = /* @__PURE__ */ new Map();
|
|
854
|
-
const add = (key, node) => {
|
|
855
|
-
const nodes = byKey.get(key);
|
|
856
|
-
if (nodes) nodes.push(node);
|
|
857
|
-
else byKey.set(key, [node]);
|
|
858
|
-
};
|
|
859
|
-
for (const node of doc.querySelectorAll(selector)) {
|
|
860
|
-
const hfId = node.getAttribute("data-hf-id");
|
|
861
|
-
const id = node.getAttribute("id");
|
|
862
|
-
if (hfId) add(`hf:${hfId}`, node);
|
|
863
|
-
if (id) add(`id:${id}`, node);
|
|
864
|
-
}
|
|
865
|
-
return (target) => {
|
|
866
|
-
const matches = [
|
|
867
|
-
...target.hfId && byKey.get(`hf:${target.hfId}`) || [],
|
|
868
|
-
...byKey.get(`id:${target.domId ?? target.id}`) ?? []
|
|
869
|
-
];
|
|
870
|
-
return matches.find((node) => getTimelineElementSourceFile(node) === target.sourceFile) ?? matches[0] ?? null;
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
854
|
function findClipElementById(doc, clip) {
|
|
874
855
|
if (!clip.id) return null;
|
|
875
856
|
const first = doc.getElementById(clip.id);
|
|
@@ -1096,6 +1077,8 @@ export {
|
|
|
1096
1077
|
wrapTimeline,
|
|
1097
1078
|
parseStoredVolume,
|
|
1098
1079
|
elementVolume,
|
|
1080
|
+
previewElementFinder,
|
|
1081
|
+
getTimelineElementSourceFile,
|
|
1099
1082
|
LAYER_REVEAL_PRIOR_Z_ATTR,
|
|
1100
1083
|
LAYER_REVEAL_PRIOR_POSITION_ATTR,
|
|
1101
1084
|
readLayerRevealPriorZ,
|
|
@@ -1111,7 +1094,6 @@ export {
|
|
|
1111
1094
|
applyMediaMetadataFromElement,
|
|
1112
1095
|
getTimelineElementDisplayLabel,
|
|
1113
1096
|
getTimelineElementSelector,
|
|
1114
|
-
getTimelineElementSourceFile,
|
|
1115
1097
|
getTimelineElementSelectorIndex,
|
|
1116
1098
|
buildTimelineElementKey,
|
|
1117
1099
|
splitTimelineElementKey,
|
|
@@ -1120,7 +1102,6 @@ export {
|
|
|
1120
1102
|
runtimeAudioId,
|
|
1121
1103
|
deriveTimelineStoreKey,
|
|
1122
1104
|
deriveTimelineStoreKeyForDomId,
|
|
1123
|
-
previewElementFinder,
|
|
1124
1105
|
findClipElementById,
|
|
1125
1106
|
createTimelineDomNodeResolver,
|
|
1126
1107
|
isSdkFamilyEnabled,
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
resolveDomEditCapabilities,
|
|
21
21
|
resolveDomEditSelection,
|
|
22
22
|
serializeDomEditTextFields
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-OJLNM6V5.js";
|
|
24
|
+
import "./chunk-YQ3ZAXXY.js";
|
|
25
25
|
import "./chunk-MLKGABMK.js";
|
|
26
26
|
export {
|
|
27
27
|
buildDefaultDomEditTextField,
|
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-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-CVmmHGol.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/assets/index-CRiuMxyq.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|