@hyperframes/studio 0.9.28-alpha.1 → 0.9.28-alpha.3
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-DqodFzhT.js → codec-tGzNehh-.js} +1 -1
- package/dist/assets/{hyperframes-player-D03oERxc.js → hyperframes-player-CZqZjTTG.js} +1 -1
- package/dist/assets/{index-Cq2w6U13.css → index-BJTCbv8z.css} +1 -1
- package/dist/assets/{index-9kcxLnm3.js → index-CPlYjedc.js} +1 -1
- package/dist/assets/{index-DuOvEv27.js → index-DnpxF2Ut.js} +128 -128
- package/dist/assets/{pausedVideoDecoder-pYFINB0c.js → pausedVideoDecoder-BrSGODzR.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/index.js +66 -34
- package/dist/styles.css +1 -1
- package/package.json +8 -8
- package/src/components/share/QuickShare.test.tsx +58 -1
- package/src/components/share/QuickShare.tsx +1 -0
- package/src/components/share/ShareAudience.tsx +32 -4
- package/src/components/share/useQuickShare.ts +25 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as V}from"./index-
|
|
1
|
+
import{l as V}from"./index-DnpxF2Ut.js";import{bw as G,bN as K,cH as Q,bE as X}from"./codec-tGzNehh-.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,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-DnpxF2Ut.js"></script>
|
|
18
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BJTCbv8z.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<div data-hf-id="hf-aph5" id="root"></div>
|
package/dist/index.js
CHANGED
|
@@ -91968,7 +91968,8 @@ function useQuickShare(token, beforeShare) {
|
|
|
91968
91968
|
const reconnectOnReturn = useRef172(false);
|
|
91969
91969
|
const [error, setError] = useState138(null);
|
|
91970
91970
|
const [errorCode, setErrorCode] = useState138(null);
|
|
91971
|
-
const
|
|
91971
|
+
const { copied, setCopied, acknowledgeCopy } = useCopyAcknowledgement();
|
|
91972
|
+
const [notice, setNotice] = useState138("");
|
|
91972
91973
|
const opened = useRef172(false);
|
|
91973
91974
|
const lifetime = useRef172(null);
|
|
91974
91975
|
const timer = useRef172(null);
|
|
@@ -91994,6 +91995,7 @@ function useQuickShare(token, beforeShare) {
|
|
|
91994
91995
|
const result = job.result;
|
|
91995
91996
|
if (result) setSnapshot((prior) => prior ? { ...prior, share: result, job } : prior);
|
|
91996
91997
|
await refresh2(signal, job.state === "failed");
|
|
91998
|
+
if (!signal.aborted) setNotice(completionNotice(job));
|
|
91997
91999
|
}
|
|
91998
92000
|
async function refresh2(signal, preserveSelection = false) {
|
|
91999
92001
|
setError(null);
|
|
@@ -92043,6 +92045,7 @@ function useQuickShare(token, beforeShare) {
|
|
|
92043
92045
|
setError(null);
|
|
92044
92046
|
setErrorCode(null);
|
|
92045
92047
|
setCopied(false);
|
|
92048
|
+
setNotice("");
|
|
92046
92049
|
setProgress("Preparing share\u2026");
|
|
92047
92050
|
try {
|
|
92048
92051
|
if (["share", "update"].includes(action.action)) await beforeShare?.();
|
|
@@ -92098,7 +92101,8 @@ function useQuickShare(token, beforeShare) {
|
|
|
92098
92101
|
async function copy(url) {
|
|
92099
92102
|
try {
|
|
92100
92103
|
await navigator.clipboard.writeText(url);
|
|
92101
|
-
|
|
92104
|
+
if (lifetime.current?.signal.aborted) return;
|
|
92105
|
+
acknowledgeCopy();
|
|
92102
92106
|
shareInteraction(token, { event: "share_link_copied", via: "copy" });
|
|
92103
92107
|
} catch {
|
|
92104
92108
|
setError("Couldn\u2019t copy. Open the shared page and copy its address.");
|
|
@@ -92113,11 +92117,28 @@ function useQuickShare(token, beforeShare) {
|
|
|
92113
92117
|
error,
|
|
92114
92118
|
errorCode,
|
|
92115
92119
|
copied,
|
|
92120
|
+
notice,
|
|
92116
92121
|
progress,
|
|
92117
92122
|
run,
|
|
92118
92123
|
copy
|
|
92119
92124
|
};
|
|
92120
92125
|
}
|
|
92126
|
+
function completionNotice(job) {
|
|
92127
|
+
if (job.state !== "done") return "";
|
|
92128
|
+
if (job.result?.upToDate) return "Already up to date.";
|
|
92129
|
+
return job.result?.updated ? "Shared version updated." : "";
|
|
92130
|
+
}
|
|
92131
|
+
function useCopyAcknowledgement() {
|
|
92132
|
+
const [copied, setCopied] = useState138(false);
|
|
92133
|
+
const timer = useRef172(void 0);
|
|
92134
|
+
useMountEffect(() => () => clearTimeout(timer.current));
|
|
92135
|
+
function acknowledgeCopy() {
|
|
92136
|
+
clearTimeout(timer.current);
|
|
92137
|
+
setCopied(true);
|
|
92138
|
+
timer.current = setTimeout(() => setCopied(false), 2e3);
|
|
92139
|
+
}
|
|
92140
|
+
return { copied, setCopied, acknowledgeCopy };
|
|
92141
|
+
}
|
|
92121
92142
|
|
|
92122
92143
|
// src/components/share/ShareAudience.tsx
|
|
92123
92144
|
import { CaretDown, Globe, Lock, Users, UserPlus } from "@phosphor-icons/react";
|
|
@@ -92134,7 +92155,7 @@ var AUDIENCES = {
|
|
|
92134
92155
|
detail: "People you add in Manage sharing",
|
|
92135
92156
|
icon: UserPlus
|
|
92136
92157
|
},
|
|
92137
|
-
private: { label: "Only you", detail: "
|
|
92158
|
+
private: { label: "Only you", detail: "Only you can access this share", icon: Lock }
|
|
92138
92159
|
};
|
|
92139
92160
|
function ShareAudience({
|
|
92140
92161
|
model,
|
|
@@ -92144,8 +92165,8 @@ function ShareAudience({
|
|
|
92144
92165
|
const Icon = selected?.icon ?? Lock;
|
|
92145
92166
|
const space = snapshot3.spaces.find((item) => item.id === model.spaceId);
|
|
92146
92167
|
const choices = ["public", "team", "invite"];
|
|
92147
|
-
if (snapshot3.share.
|
|
92148
|
-
return /* @__PURE__ */
|
|
92168
|
+
if (snapshot3.share.state !== "not_shared") choices.push("private");
|
|
92169
|
+
return /* @__PURE__ */ jsxs165(
|
|
92149
92170
|
Menu,
|
|
92150
92171
|
{
|
|
92151
92172
|
"aria-label": "Who can access",
|
|
@@ -92164,39 +92185,49 @@ function ShareAudience({
|
|
|
92164
92185
|
]
|
|
92165
92186
|
}
|
|
92166
92187
|
),
|
|
92167
|
-
children:
|
|
92168
|
-
|
|
92169
|
-
|
|
92170
|
-
|
|
92171
|
-
|
|
92172
|
-
|
|
92173
|
-
|
|
92174
|
-
|
|
92175
|
-
|
|
92176
|
-
|
|
92177
|
-
|
|
92178
|
-
|
|
92179
|
-
|
|
92180
|
-
|
|
92181
|
-
|
|
92182
|
-
|
|
92183
|
-
|
|
92184
|
-
|
|
92185
|
-
|
|
92186
|
-
/* @__PURE__ */ jsxs165("span", { className: "
|
|
92187
|
-
/* @__PURE__ */ jsx212("span", { className: "
|
|
92188
|
-
/* @__PURE__ */
|
|
92188
|
+
children: [
|
|
92189
|
+
/* @__PURE__ */ jsx212(
|
|
92190
|
+
MenuRadioGroup,
|
|
92191
|
+
{
|
|
92192
|
+
value: model.audience,
|
|
92193
|
+
onValueChange: (value) => {
|
|
92194
|
+
if (isAudience(value)) model.setAudience(value);
|
|
92195
|
+
},
|
|
92196
|
+
children: choices.map((value) => {
|
|
92197
|
+
const option = AUDIENCES[value];
|
|
92198
|
+
const OptionIcon = option.icon;
|
|
92199
|
+
const needsPro = requiresPro(space, value, snapshot3.share.audience);
|
|
92200
|
+
return /* @__PURE__ */ jsx212(
|
|
92201
|
+
MenuRadioItem,
|
|
92202
|
+
{
|
|
92203
|
+
value,
|
|
92204
|
+
closeOnClick: true,
|
|
92205
|
+
disabled: model.busy || !space?.audiences.includes(value) && value !== snapshot3.share.audience,
|
|
92206
|
+
className: "h-auto min-h-12 rounded-lg px-2 py-2 text-step-13",
|
|
92207
|
+
children: /* @__PURE__ */ jsxs165("span", { className: "flex items-center gap-2.5", children: [
|
|
92208
|
+
/* @__PURE__ */ jsx212("span", { className: "grid size-7 shrink-0 place-items-center rounded-full bg-press text-text-2", children: /* @__PURE__ */ jsx212(OptionIcon, { size: 15, "aria-hidden": "true" }) }),
|
|
92209
|
+
/* @__PURE__ */ jsxs165("span", { className: "min-w-0 leading-snug", children: [
|
|
92210
|
+
/* @__PURE__ */ jsxs165("span", { className: "flex items-center gap-2 font-semibold", children: [
|
|
92211
|
+
option.label,
|
|
92212
|
+
needsPro ? /* @__PURE__ */ jsx212("span", { className: "rounded bg-press px-1.5 py-0.5 text-step-10 font-semibold", children: "Pro" }) : null
|
|
92213
|
+
] }),
|
|
92214
|
+
/* @__PURE__ */ jsx212("span", { className: "block whitespace-normal text-step-11 text-text-3", children: needsPro ? "Upgrade to Pro to use this option" : option.detail })
|
|
92215
|
+
] })
|
|
92189
92216
|
] })
|
|
92190
|
-
|
|
92191
|
-
|
|
92192
|
-
|
|
92193
|
-
)
|
|
92194
|
-
}
|
|
92195
|
-
|
|
92196
|
-
|
|
92217
|
+
},
|
|
92218
|
+
value
|
|
92219
|
+
);
|
|
92220
|
+
})
|
|
92221
|
+
}
|
|
92222
|
+
),
|
|
92223
|
+
space?.plan === "free" && (!space.audiences.includes("team") || !space.audiences.includes("invite")) ? /* @__PURE__ */ jsx212("p", { className: "mx-2 mt-1 border-t border-border px-1 py-2 text-step-11 text-text-2", children: "Free includes anyone-with-the-link sharing. Upgrade to Pro for workspace and invite-only sharing." }) : null
|
|
92224
|
+
]
|
|
92197
92225
|
}
|
|
92198
92226
|
);
|
|
92199
92227
|
}
|
|
92228
|
+
function requiresPro(space, value, current2) {
|
|
92229
|
+
return space?.plan === "free" && !space.audiences.includes(value) && value !== current2 && (value === "team" || value === "invite");
|
|
92230
|
+
}
|
|
92200
92231
|
|
|
92201
92232
|
// src/components/share/QuickShareControls.tsx
|
|
92202
92233
|
import { Link as Link2, ArrowUpRight } from "@phosphor-icons/react";
|
|
@@ -92444,6 +92475,7 @@ function QuickShareContent({
|
|
|
92444
92475
|
progress,
|
|
92445
92476
|
" You can close this panel; keep Studio running."
|
|
92446
92477
|
] }) : null,
|
|
92478
|
+
model.notice ? /* @__PURE__ */ jsx214("p", { role: "status", children: model.notice }) : null,
|
|
92447
92479
|
/* @__PURE__ */ jsx214(ShareLogin, { model }),
|
|
92448
92480
|
error ? /* @__PURE__ */ jsx214("p", { role: "alert", className: "text-step-11 text-text-2", children: error }) : null,
|
|
92449
92481
|
/* @__PURE__ */ jsxs167("div", { className: "flex flex-wrap items-center gap-2 border-t border-border pt-3", children: [
|