@hyperframes/studio 0.9.50 → 0.9.52
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-DHIxqu8A.js → hyperframes-player-D7LhzIg1.js} +1 -1
- package/dist/assets/{index-CefNftWO.js → index-CQ7o0CBU.js} +1 -1
- package/dist/assets/{index-CU24FmKd.css → index-CRiuMxyq.css} +1 -1
- package/dist/assets/{index-CuCj-ntQ.js → index-D3WxJaqm.js} +5 -5
- package/dist/assets/{pausedVideoDecoder-Dy-s5uPt.js → pausedVideoDecoder-BVUmBgn0.js} +1 -1
- package/dist/{chunk-67DSVBEI.js → chunk-F6EHWNZU.js} +1 -1
- package/dist/{chunk-ZNUWV4FN.js → chunk-G6FJSL7X.js} +16 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.html +2 -2
- package/dist/index.js +4 -2
- package/dist/player.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/ui.d.ts +3 -1
- package/dist/ui.js +3 -1
- package/package.json +8 -8
- package/src/components/ui/Menu.test.tsx +5 -3
- package/src/components/ui/Menu.tsx +8 -5
- package/src/components/ui/index.ts +1 -0
- package/src/ui.ts +1 -0
|
@@ -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-CQ7o0CBU.js";import{l as X}from"./index-D3WxJaqm.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};
|
|
@@ -302,8 +302,8 @@ var popupSurface = cn(
|
|
|
302
302
|
);
|
|
303
303
|
var POPUP_LAYER = "z-200";
|
|
304
304
|
var menuPopup = cn(popupSurface, "min-w-36 p-1 shadow-menu");
|
|
305
|
-
var
|
|
306
|
-
"flex cursor-default select-none items-center justify-between gap-6 rounded-[calc(var(--radius-lg)
|
|
305
|
+
var menuItemBase = cn(
|
|
306
|
+
"flex cursor-default select-none items-center justify-between gap-6 rounded-[calc(var(--radius-lg)-4px)] 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",
|
|
@@ -385,16 +385,23 @@ function MenuShortcut({ className, ...props }) {
|
|
|
385
385
|
);
|
|
386
386
|
}
|
|
387
387
|
function MenuItem({ shortcut, tone, className, children, ...props }) {
|
|
388
|
-
return /* @__PURE__ */ jsxs4(
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
388
|
+
return /* @__PURE__ */ jsxs4(
|
|
389
|
+
BaseMenu.Item,
|
|
390
|
+
{
|
|
391
|
+
className: cn(menuItemBase, tone === "danger" && itemDanger, className),
|
|
392
|
+
...props,
|
|
393
|
+
children: [
|
|
394
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", children }),
|
|
395
|
+
shortcut ? /* @__PURE__ */ jsx6(MenuShortcut, { children: shortcut }) : null
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
);
|
|
392
399
|
}
|
|
393
400
|
function MenuRadioGroup(props) {
|
|
394
401
|
return /* @__PURE__ */ jsx6(BaseMenu.RadioGroup, { ...props });
|
|
395
402
|
}
|
|
396
403
|
function MenuRadioItem({ className, children, ...props }) {
|
|
397
|
-
return /* @__PURE__ */ jsxs4(BaseMenu.RadioItem, { className: cn(
|
|
404
|
+
return /* @__PURE__ */ jsxs4(BaseMenu.RadioItem, { className: cn(menuItemBase, className), ...props, children: [
|
|
398
405
|
/* @__PURE__ */ jsx6("span", { className: "truncate", children }),
|
|
399
406
|
/* @__PURE__ */ jsx6("span", { className: "flex size-3 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx6(BaseMenu.RadioItemIndicator, { className: "size-1.5 rounded-full bg-accent" }) })
|
|
400
407
|
] });
|
|
@@ -404,7 +411,7 @@ function MenuCheckboxItem({
|
|
|
404
411
|
children,
|
|
405
412
|
...props
|
|
406
413
|
}) {
|
|
407
|
-
return /* @__PURE__ */ jsxs4(BaseMenu.CheckboxItem, { className: cn(
|
|
414
|
+
return /* @__PURE__ */ jsxs4(BaseMenu.CheckboxItem, { className: cn(menuItemBase, className), ...props, children: [
|
|
408
415
|
/* @__PURE__ */ jsx6("span", { className: "truncate", children }),
|
|
409
416
|
/* @__PURE__ */ jsx6("span", { className: "flex size-3 shrink-0 items-center justify-center text-accent-ink", children: /* @__PURE__ */ jsx6(BaseMenu.CheckboxItemIndicator, { children: "\u2713" }) })
|
|
410
417
|
] });
|
|
@@ -969,6 +976,7 @@ export {
|
|
|
969
976
|
HyperframesMark,
|
|
970
977
|
HyperframesLoader,
|
|
971
978
|
popupSurface,
|
|
979
|
+
menuItemBase,
|
|
972
980
|
Menu,
|
|
973
981
|
ContextMenu,
|
|
974
982
|
MenuShortcut,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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';
|
|
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, menuItemBase, 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
4
|
import { RuntimeTimelineClipIdentity, PlaybackHeldBy, HyperframePickerElementInfo } from '@hyperframes/core';
|
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-D3WxJaqm.js"></script>
|
|
18
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CRiuMxyq.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<div data-hf-id="hf-aph5" id="root"></div>
|
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ import {
|
|
|
89
89
|
whileScriptWrites,
|
|
90
90
|
writeStudioUiPreferences,
|
|
91
91
|
zoomToSelectedClips
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-F6EHWNZU.js";
|
|
93
93
|
import {
|
|
94
94
|
Button,
|
|
95
95
|
ContextMenu,
|
|
@@ -120,8 +120,9 @@ import {
|
|
|
120
120
|
cn,
|
|
121
121
|
fieldBase,
|
|
122
122
|
fieldText,
|
|
123
|
+
menuItemBase,
|
|
123
124
|
popupSurface
|
|
124
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-G6FJSL7X.js";
|
|
125
126
|
import {
|
|
126
127
|
DEFAULT_STUDIO_KEYS,
|
|
127
128
|
comboClashKey,
|
|
@@ -104794,6 +104795,7 @@ export {
|
|
|
104794
104795
|
getStudioKeys,
|
|
104795
104796
|
liveTime,
|
|
104796
104797
|
matchCombo,
|
|
104798
|
+
menuItemBase,
|
|
104797
104799
|
mergeStyleIntoTag,
|
|
104798
104800
|
openAudioGainDialog,
|
|
104799
104801
|
parseCombo,
|