hyperframes 0.7.54 → 0.7.55

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,4 +1,4 @@
1
- import{n as Qi}from"./index-pRhCpGPz.js";/*!
1
+ import{n as Qi}from"./index-BRwkMj0w.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
@@ -1 +1 @@
1
- import{g as P}from"./index-pRhCpGPz.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-BRwkMj0w.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-pRhCpGPz.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BRwkMj0w.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-Dq7FEg0K.css">
10
10
  </head>
11
11
  <body>
@@ -1330,6 +1330,18 @@ function readStorage(storage) {
1330
1330
  if (typeof parsed.snapToGrid === "boolean") {
1331
1331
  preferences.snapToGrid = parsed.snapToGrid;
1332
1332
  }
1333
+ if (typeof parsed.timelineSnapEnabled === "boolean") {
1334
+ preferences.timelineSnapEnabled = parsed.timelineSnapEnabled;
1335
+ }
1336
+ if (parsed.timeDisplayMode === "time" || parsed.timeDisplayMode === "frame") {
1337
+ preferences.timeDisplayMode = parsed.timeDisplayMode;
1338
+ }
1339
+ if (parsed.timelineZoomMode === "fit" || parsed.timelineZoomMode === "manual") {
1340
+ preferences.timelineZoomMode = parsed.timelineZoomMode;
1341
+ }
1342
+ if (typeof parsed.timelineManualZoomPercent === "number" && Number.isFinite(parsed.timelineManualZoomPercent)) {
1343
+ preferences.timelineManualZoomPercent = parsed.timelineManualZoomPercent;
1344
+ }
1333
1345
  return preferences;
1334
1346
  } catch {
1335
1347
  return {};
@@ -5252,6 +5264,8 @@ function getPinchTimelineZoomPercent(deltaY, zoomMode, manualZoomPercent) {
5252
5264
  if (!Number.isFinite(deltaY) || deltaY === 0) return current;
5253
5265
  return clampTimelineZoomPercent(current * Math.exp(-deltaY * PINCH_ZOOM_SENSITIVITY));
5254
5266
  }
5267
+ var LOG_MIN = Math.log(MIN_TIMELINE_ZOOM_PERCENT);
5268
+ var LOG_MAX = Math.log(MAX_TIMELINE_ZOOM_PERCENT);
5255
5269
 
5256
5270
  // src/player/components/useTimelinePlayhead.ts
5257
5271
  function useTimelinePlayhead({
@@ -10446,6 +10460,26 @@ function usePlaybackKeyboard({
10446
10460
 
10447
10461
  // src/player/hooks/useTimelineSyncCallbacks.ts
10448
10462
  import { useCallback as useCallback19 } from "react";
10463
+ function revealIframe(iframe) {
10464
+ if (iframe && iframe.style.visibility === "hidden") {
10465
+ iframe.style.visibility = "";
10466
+ }
10467
+ }
10468
+ function resolveReloadSeekTime(input) {
10469
+ const target = input.pendingSeek ?? input.requestedSeek ?? input.storeCurrentTime;
10470
+ if (!Number.isFinite(target) || target <= 0) return 0;
10471
+ if (!Number.isFinite(input.duration) || input.duration <= 0) return target;
10472
+ return Math.min(target, input.duration);
10473
+ }
10474
+ function sanitizeDurationSeconds(value) {
10475
+ return Number.isFinite(value) && value > 0 && value < 7200 ? value : 0;
10476
+ }
10477
+ function resolveTimelineTotalDuration(input) {
10478
+ return Math.max(
10479
+ sanitizeDurationSeconds(input.manifestDurationSeconds),
10480
+ sanitizeDurationSeconds(input.authoredRootDurationSeconds)
10481
+ );
10482
+ }
10449
10483
  function useTimelineSyncCallbacks({
10450
10484
  iframeRef,
10451
10485
  probeIntervalRef,
@@ -10533,7 +10567,10 @@ function useTimelineSyncCallbacks({
10533
10567
  });
10534
10568
  });
10535
10569
  const rawDuration = data.durationInFrames / 30;
10536
- const newDuration = Number.isFinite(rawDuration) && rawDuration < 7200 ? rawDuration : 0;
10570
+ const newDuration = resolveTimelineTotalDuration({
10571
+ manifestDurationSeconds: rawDuration,
10572
+ authoredRootDurationSeconds: readTimelineDurationFromDocument(iframeDoc)
10573
+ });
10537
10574
  const effectiveDuration = newDuration > 0 ? newDuration : usePlayerStore.getState().duration;
10538
10575
  const clampedEls = effectiveDuration > 0 ? els.filter((element) => element.start < effectiveDuration).map((element) => ({
10539
10576
  ...element,
@@ -10576,11 +10613,18 @@ function useTimelineSyncCallbacks({
10576
10613
  if (!adapter || adapter.getDuration() <= 0) return false;
10577
10614
  adapter.pause();
10578
10615
  const storeSeek = usePlayerStore.getState().requestedSeekTime;
10579
- const seekTo = pendingSeekRef.current ?? storeSeek;
10616
+ const startTime = resolveReloadSeekTime({
10617
+ pendingSeek: pendingSeekRef.current,
10618
+ requestedSeek: storeSeek,
10619
+ storeCurrentTime: usePlayerStore.getState().currentTime,
10620
+ duration: adapter.getDuration()
10621
+ });
10580
10622
  pendingSeekRef.current = null;
10581
10623
  if (storeSeek != null) usePlayerStore.getState().clearSeekRequest();
10582
- const startTime = seekTo != null ? Math.min(seekTo, adapter.getDuration()) : 0;
10624
+ const guardTime = startTime > 1e-3 ? Math.max(0, startTime - 1e-3) : 1e-3;
10625
+ adapter.seek(guardTime);
10583
10626
  adapter.seek(startTime);
10627
+ revealIframe(iframeRef.current);
10584
10628
  liveTime.notify(startTime);
10585
10629
  const adapterDur = adapter.getDuration();
10586
10630
  if (Number.isFinite(adapterDur) && adapterDur > 0 && adapterDur < 7200 && adapterDur !== usePlayerStore.getState().duration) {
@@ -10670,6 +10714,7 @@ function useTimelineSyncCallbacks({
10670
10714
  trySettle();
10671
10715
  }
10672
10716
  window.removeEventListener("message", onMessage);
10717
+ revealIframe(iframeRef.current);
10673
10718
  }, 5e3);
10674
10719
  }, [initializeAdapter, iframeRef, probeIntervalRef, applyPreviewAudioState]);
10675
10720
  const processTimelineMessageRef = { current: processTimelineMessage };