@hyperframes/studio 0.8.28 → 0.8.29

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 +1 @@
1
- import{g as P}from"./index-O3ilbgfR.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
1
+ import{g as P}from"./index-CAyl2GL2.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-O3ilbgfR.js";/*!
1
+ import{n as Qi}from"./index-CAyl2GL2.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
package/dist/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>HyperFrames Studio</title>
8
- <script type="module" crossorigin src="/assets/index-O3ilbgfR.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-CAyl2GL2.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DnRfAiK2.css">
10
10
  </head>
11
11
  <body>
package/dist/index.js CHANGED
@@ -74843,6 +74843,8 @@ function useExternalFileChangeCoordinator({
74843
74843
  const lastEventIdentityRef = useRef133(null);
74844
74844
  const blockedRef = useRef133(blocked);
74845
74845
  const snapshotWriteTailRef = useRef133(Promise.resolve());
74846
+ const drainingRef = useRef133(false);
74847
+ const pendingPayloadRef = useRef133(null);
74846
74848
  blockedRef.current = blocked;
74847
74849
  useEffect106(() => {
74848
74850
  mountedRef.current = true;
@@ -74910,32 +74912,11 @@ function useExternalFileChangeCoordinator({
74910
74912
  );
74911
74913
  await next;
74912
74914
  }, []);
74913
- const processChange = useCallback125(
74915
+ const drainOnePending = useCallback125(
74914
74916
  // fallow-ignore-next-line complexity
74915
- async (payload, allowDuplicate = false) => {
74917
+ async (payload) => {
74916
74918
  const path = readStudioFileChangePath(payload);
74917
- if (!path || !projectId) return;
74918
- const pendingTimelinePaths = pendingTimelineEditPathRef.current;
74919
- pendingTimelinePaths.delete(path);
74920
- const content = readFileChangeContent(payload);
74921
- const token = readFileChangeWriteToken(payload);
74922
- logReload("file-change", { path, token: token ?? null, hasContent: content != null });
74923
- const identity = eventIdentity(path, payload);
74924
- if (!allowDuplicate && identity != null && identity === lastEventIdentityRef.current) {
74925
- logReload("suppressed", { path, why: "duplicate event" });
74926
- return;
74927
- }
74928
- lastEventIdentityRef.current = identity;
74929
- const ownWriteToken = consumeStudioWriteToken(token);
74930
- const ownContentEcho = content != null && isSelfWriteEcho(path, content);
74931
- if (ownWriteToken || ownContentEcho) {
74932
- onAcceptedPersistedFileChange(path);
74933
- logReload("suppressed", {
74934
- path,
74935
- why: ownWriteToken ? "own write token" : "own content echo"
74936
- });
74937
- return;
74938
- }
74919
+ if (!path) return;
74939
74920
  const generation = ++generationRef.current;
74940
74921
  const result = await drainPendingChanges();
74941
74922
  if (!mountedRef.current || generation !== generationRef.current) return;
@@ -74957,6 +74938,7 @@ function useExternalFileChangeCoordinator({
74957
74938
  reloadAcceptedGeneration(path);
74958
74939
  return;
74959
74940
  }
74941
+ const content = readFileChangeContent(payload);
74960
74942
  if (result.status === "failed") {
74961
74943
  const candidate = getPendingCandidate?.();
74962
74944
  const studioContent = candidate?.path === path ? candidate.content : null;
@@ -75011,9 +74993,8 @@ function useExternalFileChangeCoordinator({
75011
74993
  setBlocked({ status: "conflict", generation, error: result.error, payload });
75012
74994
  },
75013
74995
  [
75014
- projectId,
75015
- pendingTimelineEditPathRef,
75016
74996
  drainPendingChanges,
74997
+ projectId,
75017
74998
  deleteConflictSnapshot,
75018
74999
  getPendingCandidate,
75019
75000
  persistConflictSnapshot,
@@ -75023,6 +75004,50 @@ function useExternalFileChangeCoordinator({
75023
75004
  onAcceptedPersistedFileChange
75024
75005
  ]
75025
75006
  );
75007
+ const startDrainLoop = useCallback125(async () => {
75008
+ if (drainingRef.current) return;
75009
+ drainingRef.current = true;
75010
+ try {
75011
+ while (mountedRef.current) {
75012
+ const pending2 = pendingPayloadRef.current;
75013
+ if (!pending2) break;
75014
+ pendingPayloadRef.current = null;
75015
+ await drainOnePending(pending2.payload);
75016
+ }
75017
+ } finally {
75018
+ drainingRef.current = false;
75019
+ }
75020
+ }, [drainOnePending]);
75021
+ const processChange = useCallback125(
75022
+ // fallow-ignore-next-line complexity
75023
+ (payload) => {
75024
+ const path = readStudioFileChangePath(payload);
75025
+ if (!path || !projectId) return;
75026
+ pendingTimelineEditPathRef.current.delete(path);
75027
+ const content = readFileChangeContent(payload);
75028
+ const token = readFileChangeWriteToken(payload);
75029
+ logReload("file-change", { path, token: token ?? null, hasContent: content != null });
75030
+ const identity = eventIdentity(path, payload);
75031
+ if (identity != null && identity === lastEventIdentityRef.current) {
75032
+ logReload("suppressed", { path, why: "duplicate event" });
75033
+ return;
75034
+ }
75035
+ lastEventIdentityRef.current = identity;
75036
+ const ownWriteToken = consumeStudioWriteToken(token);
75037
+ const ownContentEcho = content != null && isSelfWriteEcho(path, content);
75038
+ if (ownWriteToken || ownContentEcho) {
75039
+ onAcceptedPersistedFileChange(path);
75040
+ logReload("suppressed", {
75041
+ path,
75042
+ why: ownWriteToken ? "own write token" : "own content echo"
75043
+ });
75044
+ return;
75045
+ }
75046
+ pendingPayloadRef.current = { payload };
75047
+ void startDrainLoop();
75048
+ },
75049
+ [projectId, pendingTimelineEditPathRef, startDrainLoop, onAcceptedPersistedFileChange]
75050
+ );
75026
75051
  useEffect106(() => {
75027
75052
  const handler = (payload) => processChange(payload);
75028
75053
  const adapter = testHotAdapter();
@@ -75043,7 +75068,7 @@ function useExternalFileChangeCoordinator({
75043
75068
  if (!current || current.status === "conflict" || current.recovered) return;
75044
75069
  resetSaveQueues?.();
75045
75070
  lastEventIdentityRef.current = null;
75046
- await processChange(current.payload, true);
75071
+ processChange(current.payload);
75047
75072
  }, [processChange, resetSaveQueues]);
75048
75073
  const useExternalFile = useCallback125(
75049
75074
  // fallow-ignore-next-line complexity