@hyperframes/studio 0.9.21 → 0.9.23
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/codec-DYZ1sJnW.js +314 -0
- package/dist/assets/{hyperframes-player-DqxUNa9H.js → hyperframes-player-BOxJo7Nx.js} +1 -1
- package/dist/assets/{index-Cq43Ovkf.js → index-Ccf4_r8m.js} +120 -119
- package/dist/assets/index-DKEq8iSv.js +150 -0
- package/dist/assets/{index-Bgfyny02.css → index-dsfjBidg.css} +1 -1
- package/dist/assets/pausedVideoDecoder-B65VVvs_.js +1 -0
- package/dist/{chunk-3EAFE522.js → chunk-45KKBU63.js} +1 -1
- package/dist/chunk-4SPHDECE.js +165 -0
- package/dist/{chunk-OGIOFEC7.js → chunk-63DH4LRB.js} +13 -2
- package/dist/{chunk-7HZGKFFU.js → chunk-J3VJE463.js} +1 -1
- package/dist/{chunk-NUS5R2HO.js → chunk-LRTUWOR4.js} +12 -2
- package/dist/{domEditingLayers-7Z6J4UOK.js → domEditingLayers-7Q56QAU5.js} +2 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.html +2 -2
- package/dist/index.js +105 -196
- package/dist/pausedVideoDecoder-W2SVMXDS.js +404 -0
- package/dist/player.js +3 -3
- package/dist/styles.css +1 -1
- package/dist/ui.js +1 -1
- package/package.json +9 -9
- package/src/components/editor/domEditingDom.preview.test.ts +75 -0
- package/src/components/editor/domEditingDom.ts +19 -2
- package/src/components/nle/NLEContext.tsx +4 -1
- package/src/components/ui/Menu.test.tsx +8 -0
- package/src/components/ui/Menu.tsx +1 -1
- package/src/hooks/useElementPicker.test.ts +13 -0
- package/src/hooks/useElementPicker.ts +3 -2
- package/src/player/components/PlayerControls.test.tsx +1 -1
- package/src/player/components/PlayerControls.tsx +1 -1
- package/src/player/components/PreviewSeekBar.test.tsx +42 -0
- package/src/player/components/PreviewSeekBar.tsx +20 -3
- package/src/player/hooks/usePlaybackKeyboard.test.ts +1 -1
- package/src/player/hooks/usePlaybackKeyboard.ts +2 -1
- package/src/player/hooks/useTimelinePlayer.ts +3 -1
- package/src/player/lib/mediaFetch.test.ts +3 -4
- package/src/player/lib/pausedVideoDecoder.test.ts +717 -0
- package/src/player/lib/pausedVideoDecoder.ts +439 -0
- package/src/player/lib/pausedVideoProvider.test.ts +53 -0
- package/src/player/lib/pausedVideoProvider.ts +54 -0
- package/src/player/lib/playbackTypes.ts +8 -2
- package/src/player/lib/previewVideoTime.test.ts +38 -0
- package/src/player/lib/previewVideoTime.ts +39 -0
- package/src/player/store/previewQualitySlice.test.ts +27 -0
- package/src/player/store/previewQualitySlice.ts +12 -0
- package/src/utils/authoredSource.test.ts +11 -0
- package/src/utils/authoredSource.ts +2 -0
- package/dist/assets/index-CFUJyYA1.js +0 -531
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as V}from"./index-Ccf4_r8m.js";import{bw as G,bN as K,cH as Q,bE as X}from"./codec-DYZ1sJnW.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};
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
querySelectorAllSafely,
|
|
20
20
|
studioApiFetch,
|
|
21
21
|
withSelectorIndexPass
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-63DH4LRB.js";
|
|
23
23
|
|
|
24
24
|
// src/components/editor/domEditingLayers.ts
|
|
25
25
|
import { isClipHiddenByRuntime, PREVIEW_ONLY_ATTRS } from "@hyperframes/core/studio-preview-mark";
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// src/player/lib/mediaFetch.ts
|
|
2
|
+
var describe = (reader, status, code, retries) => `${reader} range fetch failed: ${status === null ? `network ${code}` : `HTTP ${status}`} after ${retries} retries`;
|
|
3
|
+
var MediaFetchError = class extends Error {
|
|
4
|
+
constructor(reader, status, code, start = null) {
|
|
5
|
+
super(describe(reader, status, code, 0));
|
|
6
|
+
this.reader = reader;
|
|
7
|
+
this.status = status;
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.start = start;
|
|
10
|
+
}
|
|
11
|
+
reader;
|
|
12
|
+
status;
|
|
13
|
+
code;
|
|
14
|
+
start;
|
|
15
|
+
name = "MediaFetchError";
|
|
16
|
+
retries = 0;
|
|
17
|
+
setRetries(retries) {
|
|
18
|
+
this.retries = retries;
|
|
19
|
+
this.message = describe(this.reader, this.status, this.code, retries);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var MAX_RETRIES = 2;
|
|
23
|
+
var SILENT_BODY_STALL_MS = 8e3;
|
|
24
|
+
var THUMBNAIL_RANGE_BYTES = 512 * 1024;
|
|
25
|
+
var POOLED_READER_CACHE_BYTES = 16 * 1024 * 1024;
|
|
26
|
+
var rangeStart = (init, closed) => (closed ? /^bytes=(\d+)-\d*$/ : /^bytes=(\d+)-$/).exec(
|
|
27
|
+
new Headers(init?.headers).get("Range") ?? ""
|
|
28
|
+
)?.[1];
|
|
29
|
+
function boundedRange(init) {
|
|
30
|
+
const start = rangeStart(init, false);
|
|
31
|
+
if (start === void 0) return init;
|
|
32
|
+
const headers = new Headers(init?.headers);
|
|
33
|
+
headers.set("Range", `bytes=${start}-${Number(start) + THUMBNAIL_RANGE_BYTES - 1}`);
|
|
34
|
+
return { ...init, headers };
|
|
35
|
+
}
|
|
36
|
+
function rangesReadable(init, response) {
|
|
37
|
+
const asked = rangeStart(init, true);
|
|
38
|
+
const shown = /^bytes (\d+)-\d+\/\d+$/.exec(response.headers.get("Content-Range") ?? "")?.[1];
|
|
39
|
+
return response.status === 206 && asked !== void 0 && shown === asked;
|
|
40
|
+
}
|
|
41
|
+
var isAbort = (error) => error?.name === "AbortError";
|
|
42
|
+
function networkCode(error) {
|
|
43
|
+
const cause = error?.cause;
|
|
44
|
+
if (typeof cause?.code === "string") return cause.code;
|
|
45
|
+
const name = error?.name;
|
|
46
|
+
return typeof name === "string" ? name : "unknown";
|
|
47
|
+
}
|
|
48
|
+
var typedFailure = (reader, error, start) => isAbort(error) ? error : new MediaFetchError(reader, null, networkCode(error), start);
|
|
49
|
+
function watchedRequest(reader, parents, end) {
|
|
50
|
+
const controller = new AbortController();
|
|
51
|
+
let stalled = false;
|
|
52
|
+
let timer;
|
|
53
|
+
const unlinks = parents.map((parent) => {
|
|
54
|
+
const follow = () => controller.abort(parent.reason);
|
|
55
|
+
parent.addEventListener("abort", follow, { once: true });
|
|
56
|
+
return () => parent.removeEventListener("abort", follow);
|
|
57
|
+
});
|
|
58
|
+
const done = () => {
|
|
59
|
+
clearTimeout(timer);
|
|
60
|
+
for (const unlink of unlinks.splice(0)) unlink();
|
|
61
|
+
};
|
|
62
|
+
controller.signal.addEventListener("abort", done, { once: true });
|
|
63
|
+
for (const parent of parents) if (parent.aborted) controller.abort(parent.reason);
|
|
64
|
+
const wait = (pending) => {
|
|
65
|
+
if (reader !== "thumbnail") return pending;
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
timer = setTimeout(() => {
|
|
68
|
+
stalled = true;
|
|
69
|
+
const reason = new DOMException(`No bytes for ${SILENT_BODY_STALL_MS} ms`, "TimeoutError");
|
|
70
|
+
reject(reason);
|
|
71
|
+
controller.abort(reason);
|
|
72
|
+
}, SILENT_BODY_STALL_MS);
|
|
73
|
+
void pending.then(resolve, reject).finally(() => clearTimeout(timer));
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const failure = (error, start) => stalled ? new MediaFetchError(reader, null, "stalled", start) : typedFailure(reader, error, start);
|
|
77
|
+
return { signal: controller.signal, wait, done, failure, end };
|
|
78
|
+
}
|
|
79
|
+
function typedBody(body, start, request) {
|
|
80
|
+
const source = body.getReader();
|
|
81
|
+
const stopped = () => request.end?.atTarget?.aborted && request.end.ended(start);
|
|
82
|
+
request.signal.addEventListener("abort", stopped, { once: true });
|
|
83
|
+
return new ReadableStream({
|
|
84
|
+
async pull(controller) {
|
|
85
|
+
try {
|
|
86
|
+
const { done, value } = await request.wait(source.read());
|
|
87
|
+
if (!done) return controller.enqueue(value);
|
|
88
|
+
request.done();
|
|
89
|
+
request.end?.ended(start);
|
|
90
|
+
controller.close();
|
|
91
|
+
} catch (error) {
|
|
92
|
+
request.done();
|
|
93
|
+
controller.error(request.failure(error, start));
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
cancel: (reason) => {
|
|
97
|
+
request.done();
|
|
98
|
+
return source.cancel(reason);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
async function typedFetch(reader, input, sent, asked, request) {
|
|
103
|
+
let response;
|
|
104
|
+
try {
|
|
105
|
+
response = await fetch(input, { ...sent, signal: request.signal });
|
|
106
|
+
} catch (error) {
|
|
107
|
+
request.done();
|
|
108
|
+
throw request.failure(error, asked);
|
|
109
|
+
}
|
|
110
|
+
if (response.ok) return response;
|
|
111
|
+
request.done();
|
|
112
|
+
throw new MediaFetchError(reader, response.status, null, asked);
|
|
113
|
+
}
|
|
114
|
+
function typedResponse(response, asked, request) {
|
|
115
|
+
if (!response.body) {
|
|
116
|
+
request.done();
|
|
117
|
+
return response;
|
|
118
|
+
}
|
|
119
|
+
const { status, statusText, headers } = response;
|
|
120
|
+
const body = typedBody(response.body, status === 206 ? asked : 0, request);
|
|
121
|
+
return new Response(body, { status, statusText, headers });
|
|
122
|
+
}
|
|
123
|
+
function mediaUrlSourceOptions(reader) {
|
|
124
|
+
const failuresByStart = /* @__PURE__ */ new Map();
|
|
125
|
+
const inFlightReads = new AbortController();
|
|
126
|
+
let ranges = reader === "thumbnail" ? "unknown" : "hidden";
|
|
127
|
+
let etag;
|
|
128
|
+
const noteEtag = (response) => void (etag ??= response.headers.get("ETag") ?? void 0);
|
|
129
|
+
const fetchFn = async (input, init) => {
|
|
130
|
+
const sent = ranges === "readable" ? boundedRange(init) : init;
|
|
131
|
+
const asked = Number(rangeStart(sent, true) ?? 0);
|
|
132
|
+
const request = watchedRequest(
|
|
133
|
+
reader,
|
|
134
|
+
init?.signal ? [inFlightReads.signal, init.signal] : [inFlightReads.signal],
|
|
135
|
+
{ ended: (start) => failuresByStart.delete(start), atTarget: init?.signal }
|
|
136
|
+
);
|
|
137
|
+
const response = await typedFetch(reader, input, sent ?? {}, asked, request);
|
|
138
|
+
if (ranges !== "hidden") ranges = rangesReadable(sent, response) ? "readable" : "hidden";
|
|
139
|
+
noteEtag(response);
|
|
140
|
+
return typedResponse(response, asked, request);
|
|
141
|
+
};
|
|
142
|
+
const getRetryDelay = (_previousAttempts, error) => {
|
|
143
|
+
const start = error instanceof MediaFetchError ? error.start : null;
|
|
144
|
+
const failed = failuresByStart.get(start) ?? 0;
|
|
145
|
+
const clientError = error instanceof MediaFetchError && error.status !== null && error.status < 500;
|
|
146
|
+
if (error instanceof MediaFetchError) error.setRetries(failed);
|
|
147
|
+
if (clientError || failed >= MAX_RETRIES) return null;
|
|
148
|
+
failuresByStart.set(start, failed + 1);
|
|
149
|
+
return 0.5 * (failed + 1);
|
|
150
|
+
};
|
|
151
|
+
const cancelReads = () => inFlightReads.abort(new DOMException("Media reads cancelled", "AbortError"));
|
|
152
|
+
const etagOf = () => etag;
|
|
153
|
+
if (reader === "probe") return { fetchFn, getRetryDelay, cancelReads, etagOf };
|
|
154
|
+
return { fetchFn, getRetryDelay, cancelReads, etagOf, maxCacheSize: POOLED_READER_CACHE_BYTES };
|
|
155
|
+
}
|
|
156
|
+
function reportMediaFetchFailure(error) {
|
|
157
|
+
if (!(error instanceof MediaFetchError)) return;
|
|
158
|
+
console.warn(`[Studio] ${error.message}`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export {
|
|
162
|
+
MediaFetchError,
|
|
163
|
+
mediaUrlSourceOptions,
|
|
164
|
+
reportMediaFetchFailure
|
|
165
|
+
};
|
|
@@ -45,6 +45,10 @@ function getSourceScopedSelectorIndex(doc, el, selector, sourceFile, resolveSour
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// src/components/editor/domEditingDom.ts
|
|
48
|
+
import {
|
|
49
|
+
PREVIEW_VIDEO_FRAME_ATTR,
|
|
50
|
+
PREVIEW_VIDEO_CANVAS_ATTR
|
|
51
|
+
} from "@hyperframes/core/studio-preview-mark";
|
|
48
52
|
import { COLOR_GRADING_SOURCE_HIDDEN_ATTR } from "@hyperframes/core/color-grading";
|
|
49
53
|
|
|
50
54
|
// src/components/editor/domEditingTypes.ts
|
|
@@ -105,10 +109,16 @@ function isTextBearingTag(tagName) {
|
|
|
105
109
|
function isEditableTextLeaf(el) {
|
|
106
110
|
return isTextBearingTag(el.tagName.toLowerCase()) && el.children.length === 0;
|
|
107
111
|
}
|
|
112
|
+
function getLogicalOpacity(el, computed) {
|
|
113
|
+
const overlay = el.previousElementSibling;
|
|
114
|
+
if (el.hasAttribute(PREVIEW_VIDEO_FRAME_ATTR) && overlay?.localName === "canvas" && overlay.hasAttribute(PREVIEW_VIDEO_CANVAS_ATTR))
|
|
115
|
+
return el.ownerDocument.defaultView?.getComputedStyle(overlay).opacity ?? computed.opacity;
|
|
116
|
+
return computed.opacity;
|
|
117
|
+
}
|
|
108
118
|
function elementRendersItself(win, el) {
|
|
109
119
|
const computed = win.getComputedStyle(el);
|
|
110
120
|
if (computed.display === "none" || computed.visibility === "hidden") return false;
|
|
111
|
-
const opacity = Number.parseFloat(computed
|
|
121
|
+
const opacity = Number.parseFloat(getLogicalOpacity(el, computed));
|
|
112
122
|
return !(Number.isFinite(opacity) && opacity <= 0.01 && !el.hasAttribute(COLOR_GRADING_SOURCE_HIDDEN_ATTR));
|
|
113
123
|
}
|
|
114
124
|
function isElementVisibleThroughAncestors(el, memo) {
|
|
@@ -136,7 +146,7 @@ function getCuratedComputedStyles(el) {
|
|
|
136
146
|
const computed = el.ownerDocument.defaultView?.getComputedStyle(el);
|
|
137
147
|
if (!computed) return styles;
|
|
138
148
|
for (const prop of CURATED_STYLE_PROPERTIES) {
|
|
139
|
-
const value = computed.getPropertyValue(prop);
|
|
149
|
+
const value = prop === "opacity" ? getLogicalOpacity(el, computed) : computed.getPropertyValue(prop);
|
|
140
150
|
if (value) styles[prop] = value;
|
|
141
151
|
}
|
|
142
152
|
return styles;
|
|
@@ -1144,6 +1154,7 @@ export {
|
|
|
1144
1154
|
withSelectorIndexPass,
|
|
1145
1155
|
isHtmlElement,
|
|
1146
1156
|
isEditableTextLeaf,
|
|
1157
|
+
getLogicalOpacity,
|
|
1147
1158
|
isElementVisibleThroughAncestors,
|
|
1148
1159
|
getCuratedComputedStyles,
|
|
1149
1160
|
getInlineStyles,
|
|
@@ -303,7 +303,7 @@ var popupSurface = cn(
|
|
|
303
303
|
var POPUP_LAYER = "z-200";
|
|
304
304
|
var menuPopup = cn(popupSurface, "min-w-36 p-1 shadow-menu");
|
|
305
305
|
var itemBase = cn(
|
|
306
|
-
"flex cursor-default select-none items-center justify-between gap-6 rounded-
|
|
306
|
+
"flex cursor-default select-none items-center justify-between gap-6 rounded-[calc(var(--radius-lg)+6px)] px-2 py-1.5",
|
|
307
307
|
"text-step-11 whitespace-nowrap text-text-1",
|
|
308
308
|
"outline-hidden transition-colors ease-out-quint duration-hover",
|
|
309
309
|
"data-[highlighted]:bg-hover data-[highlighted]:text-text-0",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HyperframesLoader
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J3VJE463.js";
|
|
4
4
|
import {
|
|
5
5
|
buildProjectApiPath,
|
|
6
6
|
splitTimelineElementKey,
|
|
7
7
|
studioApiFetch
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-63DH4LRB.js";
|
|
9
9
|
|
|
10
10
|
// src/player/lib/time.ts
|
|
11
11
|
var STUDIO_PREVIEW_FPS = 30;
|
|
@@ -587,6 +587,15 @@ function parsePreviewCopies(value) {
|
|
|
587
587
|
var optionalNumber = (n) => typeof n === "number" ? n : void 0;
|
|
588
588
|
var CLOCK_SOURCES = ["audio", "webaudio", "monotonic"];
|
|
589
589
|
var optionalClock = (clock) => CLOCK_SOURCES.find((known) => known === clock);
|
|
590
|
+
function parseHeldBy(value) {
|
|
591
|
+
if (value === null) return null;
|
|
592
|
+
if (typeof value !== "object") return void 0;
|
|
593
|
+
const { kind, readyState, networkState, fetchMs } = value;
|
|
594
|
+
if (kind !== "audio" && kind !== "video") return void 0;
|
|
595
|
+
if (typeof readyState !== "number" || typeof networkState !== "number") return void 0;
|
|
596
|
+
if (typeof fetchMs !== "number" && fetchMs !== null) return void 0;
|
|
597
|
+
return { kind, readyState, networkState, fetchMs };
|
|
598
|
+
}
|
|
590
599
|
function parsePlaybackHealth(value) {
|
|
591
600
|
if (typeof value !== "object" || value === null) return null;
|
|
592
601
|
const extra = value;
|
|
@@ -605,6 +614,7 @@ function parsePlaybackHealth(value) {
|
|
|
605
614
|
gapP50Ms: optionalNumber(extra.gapP50Ms),
|
|
606
615
|
gapP95Ms: optionalNumber(extra.gapP95Ms),
|
|
607
616
|
clockSource: optionalClock(extra.clockSource),
|
|
617
|
+
heldBy: parseHeldBy(extra.heldBy),
|
|
608
618
|
mode: "play"
|
|
609
619
|
};
|
|
610
620
|
}
|
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
resolveDomEditCapabilities,
|
|
20
20
|
resolveDomEditSelection,
|
|
21
21
|
serializeDomEditTextFields
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-45KKBU63.js";
|
|
23
|
+
import "./chunk-63DH4LRB.js";
|
|
24
24
|
import "./chunk-MLKGABMK.js";
|
|
25
25
|
export {
|
|
26
26
|
buildDefaultDomEditTextField,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Button, ButtonSize, ButtonVariant, ContextMenu, HyperframesLoader, HyperframesLoaderProps, HyperframesLogo, IconButton, Input, InputProps, Menu, MenuItem, MenuItemTone, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, NumberField, NumberFieldProps, Popover, PopupPreviewState, PreviewState, Select, SelectOption, SelectProps, Slider, SliderProps, Tab, TabPanel, Tabs, TabsList, Toggle, ToggleProps, Tooltip, buttonBase, buttonSizes, buttonVariants, cn, fieldBase, fieldText, popupSurface } from './ui.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { RefObject, MutableRefObject, ReactNode, DragEventHandler, ComponentProps, RefCallback, MouseEvent, CSSProperties, UIEvent, PointerEvent } from 'react';
|
|
4
|
-
import { RuntimeTimelineClipIdentity, HyperframePickerElementInfo } from '@hyperframes/core';
|
|
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
7
|
import { Composition } from '@hyperframes/sdk';
|
|
@@ -125,7 +125,9 @@ declare const DEFAULT_SHORTCUT_SECTIONS: readonly ShortcutSection[];
|
|
|
125
125
|
|
|
126
126
|
interface PlayerControlsProps {
|
|
127
127
|
onTogglePlay: () => void;
|
|
128
|
-
onSeek: (time: number
|
|
128
|
+
onSeek: (time: number, options?: {
|
|
129
|
+
settled?: boolean;
|
|
130
|
+
}) => void;
|
|
129
131
|
disabled?: boolean;
|
|
130
132
|
isFullscreen?: boolean;
|
|
131
133
|
onToggleFullscreen?: () => void;
|
|
@@ -355,6 +357,7 @@ interface PlaybackHealth {
|
|
|
355
357
|
gapP50Ms?: number;
|
|
356
358
|
gapP95Ms?: number;
|
|
357
359
|
clockSource?: "audio" | "webaudio" | "monotonic";
|
|
360
|
+
heldBy?: PlaybackHeldBy | null;
|
|
358
361
|
mode: "play";
|
|
359
362
|
}
|
|
360
363
|
/** What the preview holds, counts and classes only, filled when asked for. */
|
|
@@ -2115,6 +2118,7 @@ declare function useTimelinePlayer({ onShadowPromoted, onPreviewReloadFailed, }?
|
|
|
2115
2118
|
seek: (time: number, options?: {
|
|
2116
2119
|
keepPlaying?: boolean;
|
|
2117
2120
|
follow?: boolean;
|
|
2121
|
+
settled?: boolean;
|
|
2118
2122
|
}) => boolean;
|
|
2119
2123
|
onIframeLoad: (context?: number) => void;
|
|
2120
2124
|
refreshPlayer: () => void;
|
|
@@ -2285,6 +2289,7 @@ interface NLEContextValue {
|
|
|
2285
2289
|
seek: (time: number, options?: {
|
|
2286
2290
|
keepPlaying?: boolean;
|
|
2287
2291
|
follow?: boolean;
|
|
2292
|
+
settled?: boolean;
|
|
2288
2293
|
}) => boolean;
|
|
2289
2294
|
refreshPlayer: () => void;
|
|
2290
2295
|
onIframeLoad: () => void;
|
package/dist/index.html
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
document.documentElement.dataset.theme = "paper";
|
|
15
15
|
}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
18
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-Ccf4_r8m.js"></script>
|
|
18
|
+
<link rel="stylesheet" crossorigin href="/assets/index-dsfjBidg.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<div data-hf-id="hf-aph5" id="root"></div>
|