hyperframes 0.8.25 → 0.8.26

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-DSk_ALFr.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-D5yni1t6.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};
@@ -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-DSk_ALFr.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-D5yni1t6.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DnRfAiK2.css">
10
10
  </head>
11
11
  <body>
@@ -24943,6 +24943,11 @@ function resolveReloadSeekTime(input) {
24943
24943
  if (!Number.isFinite(input.duration) || input.duration <= 0) return target;
24944
24944
  return Math.min(target, input.duration);
24945
24945
  }
24946
+ function reseekPreviewAtTime(preview, time) {
24947
+ const target = Number.isFinite(time) && time > 0 ? time : 0;
24948
+ preview.seek(target > 1e-3 ? Math.max(0, target - 1e-3) : 1e-3);
24949
+ preview.seek(target);
24950
+ }
24946
24951
  function seekAdapterToRestorePoint(adapter, pendingSeekRef) {
24947
24952
  const storeSeek = usePlayerStore.getState().requestedSeekTime;
24948
24953
  const startTime = resolveReloadSeekTime({
@@ -24953,8 +24958,7 @@ function seekAdapterToRestorePoint(adapter, pendingSeekRef) {
24953
24958
  });
24954
24959
  pendingSeekRef.current = null;
24955
24960
  if (storeSeek != null) usePlayerStore.getState().clearSeekRequest();
24956
- adapter.seek(startTime > 1e-3 ? Math.max(0, startTime - 1e-3) : 1e-3);
24957
- adapter.seek(startTime);
24961
+ reseekPreviewAtTime(adapter, startTime);
24958
24962
  return startTime;
24959
24963
  }
24960
24964
  function syncAdapterDuration(adapter, setDuration) {
@@ -66837,11 +66841,9 @@ function patchLiveHiddenState(iframe, elements, hidden, activeCompPath) {
66837
66841
  }
66838
66842
  }
66839
66843
  function reseekPreviewRuntime(iframe) {
66840
- try {
66841
- const win = iframe?.contentWindow ?? null;
66842
- win?.__player?.seek?.(usePlayerStore.getState().currentTime);
66843
- } catch {
66844
- }
66844
+ const store = usePlayerStore.getState();
66845
+ if (applySoftReloadFinalization(iframe, store.currentTime)) return;
66846
+ reseekPreviewAtTime({ seek: store.requestSeek }, store.currentTime);
66845
66847
  }
66846
66848
  function groupElementsByTargetPath(elements, activeCompPath) {
66847
66849
  const byPath = /* @__PURE__ */ new Map();
@@ -70364,6 +70366,10 @@ function useDomEditCommits({
70364
70366
  const pid = expectedProjectId;
70365
70367
  if (options?.shouldSave && !options.shouldSave()) return;
70366
70368
  const targetPath = selection.sourceFile || activeCompPath || "index.html";
70369
+ const completePersistence = (result, changed) => {
70370
+ if (options?.skipRefresh && changed) reseekPreviewRuntime(previewIframeRef.current);
70371
+ return result;
70372
+ };
70367
70373
  const readResponse = await fetch(
70368
70374
  `/api/projects/${pid}/files/${encodeURIComponent(targetPath)}`
70369
70375
  );
@@ -70397,7 +70403,10 @@ function useDomEditCommits({
70397
70403
  });
70398
70404
  if (cutover.status === "failed") throw cutover.error;
70399
70405
  if (cutover.status === "committed") {
70400
- return { sourceFile: targetPath, version: cutover.version, changed: true };
70406
+ return completePersistence(
70407
+ { sourceFile: targetPath, version: cutover.version, changed: true },
70408
+ true
70409
+ );
70401
70410
  }
70402
70411
  }
70403
70412
  domEditSaveTimestampRef.current = Date.now();
@@ -70431,7 +70440,10 @@ function useDomEditCommits({
70431
70440
  throw new DomEditPersistUnresolvableError(targetPath);
70432
70441
  }
70433
70442
  warnDomEditPersistNoOp(selection, operations);
70434
- return typeof patchData.path === "string" && typeof patchData.version === "string" ? { sourceFile: patchData.path, version: patchData.version, changed: false } : void 0;
70443
+ return completePersistence(
70444
+ typeof patchData.path === "string" && typeof patchData.version === "string" ? { sourceFile: patchData.path, version: patchData.version, changed: false } : void 0,
70445
+ false
70446
+ );
70435
70447
  }
70436
70448
  const patchedContent = typeof patchData.content === "string" ? patchData.content : originalContent;
70437
70449
  let finalContent = patchedContent;
@@ -70460,7 +70472,10 @@ function useDomEditCommits({
70460
70472
  if (!options?.skipRefresh) {
70461
70473
  reloadPreview();
70462
70474
  }
70463
- return finalContent === patchedContent && typeof patchData.path === "string" && typeof patchData.version === "string" ? { sourceFile: patchData.path, version: patchData.version, changed: true } : void 0;
70475
+ return completePersistence(
70476
+ finalContent === patchedContent && typeof patchData.path === "string" && typeof patchData.version === "string" ? { sourceFile: patchData.path, version: patchData.version, changed: true } : void 0,
70477
+ true
70478
+ );
70464
70479
  },
70465
70480
  [
70466
70481
  activeCompPath,
@@ -70471,7 +70486,8 @@ function useDomEditCommits({
70471
70486
  reloadPreview,
70472
70487
  showToast,
70473
70488
  forceReloadSdkSession,
70474
- onTrySdkPersist
70489
+ onTrySdkPersist,
70490
+ previewIframeRef
70475
70491
  ]
70476
70492
  );
70477
70493
  const persistDomEditOperations = useCallback108(