@hyperframes/studio 0.8.222 → 0.8.223

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-C8VIUiGz.js";/*!
1
+ import{n as Qi}from"./index-DD9KJoEr.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
@@ -599,6 +599,7 @@ function parsePlaybackHealth(value) {
599
599
  worstFrameMs,
600
600
  skippedShare: optionalNumber(extra.skippedShare),
601
601
  waitingShare: optionalNumber(extra.waitingShare),
602
+ frozenShare: optionalNumber(extra.frozenShare),
602
603
  gapP50Ms: optionalNumber(extra.gapP50Ms),
603
604
  gapP95Ms: optionalNumber(extra.gapP95Ms),
604
605
  mode: "play"
package/dist/index.d.ts CHANGED
@@ -262,6 +262,7 @@ interface PlaybackHealth {
262
262
  worstFrameMs: number;
263
263
  skippedShare?: number;
264
264
  waitingShare?: number;
265
+ frozenShare?: number;
265
266
  gapP50Ms?: number;
266
267
  gapP95Ms?: number;
267
268
  mode: "play";
package/dist/index.html CHANGED
@@ -14,7 +14,7 @@
14
14
  document.documentElement.dataset.theme = "paper";
15
15
  }
16
16
  </script>
17
- <script type="module" crossorigin src="/assets/index-C8VIUiGz.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-DD9KJoEr.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-RUPGNyct.css">
19
19
  </head>
20
20
  <body>
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ import {
54
54
  whenPreviewBooted,
55
55
  writeStudioUiPreferences,
56
56
  zoomToSelectedClips
57
- } from "./chunk-UNZTUFD7.js";
57
+ } from "./chunk-2PQ3U3LU.js";
58
58
  import {
59
59
  Button,
60
60
  ContextMenu,
@@ -14397,6 +14397,16 @@ import {
14397
14397
  useState as useState15
14398
14398
  } from "react";
14399
14399
 
14400
+ // src/utils/sameData.ts
14401
+ function sameData(a, b) {
14402
+ if (Object.is(a, b)) return true;
14403
+ if (!a || !b || typeof a !== "object" || typeof b !== "object") return false;
14404
+ if ("nodeType" in a || "nodeType" in b || Array.isArray(a) !== Array.isArray(b)) return false;
14405
+ const keys = Object.keys(a);
14406
+ if (keys.length !== Object.keys(b).length) return false;
14407
+ return keys.every((key2) => sameData(a[key2], b[key2]));
14408
+ }
14409
+
14400
14410
  // src/player/components/timelineFocusIdentity.ts
14401
14411
  function resolveTimelineFocusIdentity(elements, elementId2) {
14402
14412
  if (!elementId2) return null;
@@ -14511,6 +14521,7 @@ function getFocusedTimelineRowKey(target) {
14511
14521
  const rowKey = Number(value);
14512
14522
  return Number.isFinite(rowKey) ? rowKey : void 0;
14513
14523
  }
14524
+ var rowTops = (g) => [g.rowKeys, g.rowOffsets, g.padding.top];
14514
14525
  function useTimelineRowVirtualization({
14515
14526
  scrollRef,
14516
14527
  viewport: viewport2,
@@ -14583,7 +14594,7 @@ function useTimelineRowVirtualization({
14583
14594
  scroll.scrollTop = 0;
14584
14595
  syncScrollViewport(scroll);
14585
14596
  }
14586
- } else if (scroll && previousGeometry !== rowGeometry) {
14597
+ } else if (scroll && !sameData(rowTops(previousGeometry), rowTops(rowGeometry))) {
14587
14598
  const nextScrollTop = getTimelineScrollTopForGeometryChange(
14588
14599
  previousGeometry,
14589
14600
  rowGeometry,
@@ -15236,9 +15247,12 @@ import { memo as memo10 } from "react";
15236
15247
  import { useCallback as useCallback24, useRef as useRef28, useSyncExternalStore as useSyncExternalStore4 } from "react";
15237
15248
  function useSettledScrollLeft(scrollRef) {
15238
15249
  const scrollingRef = useRef28(false);
15250
+ const settledRef = useRef28(0);
15239
15251
  const subscribe2 = useCallback24(
15240
15252
  (onChange) => {
15241
15253
  const el = scrollRef.current;
15254
+ settledRef.current = el?.scrollLeft ?? 0;
15255
+ onChange();
15242
15256
  let settle;
15243
15257
  const onScroll = () => {
15244
15258
  if (!scrollingRef.current) {
@@ -15248,6 +15262,7 @@ function useSettledScrollLeft(scrollRef) {
15248
15262
  clearTimeout(settle);
15249
15263
  settle = setTimeout(() => {
15250
15264
  scrollingRef.current = false;
15265
+ settledRef.current = el?.scrollLeft ?? 0;
15251
15266
  onChange();
15252
15267
  }, TIMELINE_SCROLL_SETTLE_MS);
15253
15268
  };
@@ -15262,7 +15277,7 @@ function useSettledScrollLeft(scrollRef) {
15262
15277
  );
15263
15278
  return useSyncExternalStore4(
15264
15279
  subscribe2,
15265
- () => scrollingRef.current ? null : scrollRef.current?.scrollLeft ?? 0,
15280
+ () => scrollingRef.current ? null : settledRef.current,
15266
15281
  () => null
15267
15282
  );
15268
15283
  }
@@ -47018,16 +47033,6 @@ function TopologyLens({ iframeRef, activeCompositionPath }) {
47018
47033
  );
47019
47034
  }
47020
47035
 
47021
- // src/utils/sameData.ts
47022
- function sameData(a, b) {
47023
- if (Object.is(a, b)) return true;
47024
- if (!a || !b || typeof a !== "object" || typeof b !== "object") return false;
47025
- if ("nodeType" in a || "nodeType" in b || Array.isArray(a) !== Array.isArray(b)) return false;
47026
- const keys = Object.keys(a);
47027
- if (keys.length !== Object.keys(b).length) return false;
47028
- return keys.every((key2) => sameData(a[key2], b[key2]));
47029
- }
47030
-
47031
47036
  // src/hooks/gsapKeyframeCacheHelpers.ts
47032
47037
  function keepEqualEntries(before, draft) {
47033
47038
  for (const [key2, value] of draft) {
package/dist/player.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Player
3
- } from "./chunk-UNZTUFD7.js";
3
+ } from "./chunk-2PQ3U3LU.js";
4
4
  import "./chunk-7HZGKFFU.js";
5
5
  import "./chunk-OGIOFEC7.js";
6
6
  import "./chunk-MLKGABMK.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio",
3
- "version": "0.8.222",
3
+ "version": "0.8.223",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,12 +60,12 @@
60
60
  "dockview-react": "8.3.1",
61
61
  "gsap": "^3.13.0",
62
62
  "mediabunny": "^1.45.3",
63
- "@hyperframes/core": "0.8.222",
64
- "@hyperframes/parsers": "0.8.222",
65
- "@hyperframes/player": "0.8.222",
66
- "@hyperframes/sdk": "0.8.222",
67
- "@hyperframes/shader-transitions": "0.8.222",
68
- "@hyperframes/studio-server": "0.8.222"
63
+ "@hyperframes/core": "0.8.223",
64
+ "@hyperframes/player": "0.8.223",
65
+ "@hyperframes/sdk": "0.8.223",
66
+ "@hyperframes/shader-transitions": "0.8.223",
67
+ "@hyperframes/studio-server": "0.8.223",
68
+ "@hyperframes/parsers": "0.8.223"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@tailwindcss/vite": "^4.3.3",
@@ -82,7 +82,7 @@
82
82
  "vite": "^6.4.2",
83
83
  "vitest": "^4.1.11",
84
84
  "zustand": "^5.0.0",
85
- "@hyperframes/producer": "0.8.222"
85
+ "@hyperframes/producer": "0.8.223"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "react": "19",
@@ -0,0 +1,41 @@
1
+ // @vitest-environment happy-dom
2
+ import React, { act } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+ import { expect, it, vi } from "vitest";
5
+ import { useSettledScrollLeft } from "./useSettledScrollLeft";
6
+ import { TIMELINE_SCROLL_SETTLE_MS } from "./useTimelineScrollViewport";
7
+
8
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
9
+
10
+ // The ruler's label read scrollLeft on every commit while a long project settled, each read a layout of the whole
11
+ // timeline.
12
+ it("reads scrollLeft when a scroll settles, never on a render", () => {
13
+ vi.useFakeTimers();
14
+ const scroll = document.createElement("div");
15
+ let reads = 0;
16
+ let left = 120;
17
+ Object.defineProperty(scroll, "scrollLeft", { get: () => (reads++, left) });
18
+ const scrollRef = { current: scroll };
19
+ const seen: (number | null)[] = [];
20
+ function Probe({ tick }: { tick: number }) {
21
+ seen.push(useSettledScrollLeft(scrollRef));
22
+ return <i data-tick={tick} />;
23
+ }
24
+ const root = createRoot(document.createElement("div"));
25
+ try {
26
+ act(() => root.render(<Probe tick={0} />));
27
+ expect(seen.at(-1)).toBe(120);
28
+ reads = 0;
29
+ for (let tick = 1; tick <= 3; tick += 1) act(() => root.render(<Probe tick={tick} />));
30
+ expect(reads, "no layout read on a render").toBe(0);
31
+ left = 300;
32
+ act(() => void scroll.dispatchEvent(new Event("scroll")));
33
+ expect(seen.at(-1)).toBeNull();
34
+ act(() => void vi.advanceTimersByTime(TIMELINE_SCROLL_SETTLE_MS + 1));
35
+ expect(seen.at(-1)).toBe(300);
36
+ expect(reads, "one read when the scroll settles").toBe(1);
37
+ } finally {
38
+ act(() => root.unmount());
39
+ vi.useRealTimers();
40
+ }
41
+ });
@@ -6,9 +6,12 @@ import { TIMELINE_SCROLL_SETTLE_MS } from "./useTimelineScrollViewport";
6
6
  // on a large unvirtualized timeline.
7
7
  export function useSettledScrollLeft(scrollRef: RefObject<HTMLDivElement | null>): number | null {
8
8
  const scrollingRef = useRef(false);
9
+ const settledRef = useRef(0);
9
10
  const subscribe = useCallback(
10
11
  (onChange: () => void) => {
11
12
  const el = scrollRef.current;
13
+ settledRef.current = el?.scrollLeft ?? 0;
14
+ onChange();
12
15
  let settle: ReturnType<typeof setTimeout> | undefined;
13
16
  const onScroll = () => {
14
17
  if (!scrollingRef.current) {
@@ -18,6 +21,7 @@ export function useSettledScrollLeft(scrollRef: RefObject<HTMLDivElement | null>
18
21
  clearTimeout(settle);
19
22
  settle = setTimeout(() => {
20
23
  scrollingRef.current = false;
24
+ settledRef.current = el?.scrollLeft ?? 0;
21
25
  onChange();
22
26
  }, TIMELINE_SCROLL_SETTLE_MS);
23
27
  };
@@ -32,7 +36,7 @@ export function useSettledScrollLeft(scrollRef: RefObject<HTMLDivElement | null>
32
36
  );
33
37
  return useSyncExternalStore(
34
38
  subscribe,
35
- () => (scrollingRef.current ? null : (scrollRef.current?.scrollLeft ?? 0)),
39
+ () => (scrollingRef.current ? null : settledRef.current),
36
40
  () => null,
37
41
  );
38
42
  }
@@ -54,3 +54,48 @@ it("leaves the viewport still when a live preview lane is removed before the com
54
54
  expect(scroll.scrollTop).toBe(160);
55
55
  act(() => root.unmount());
56
56
  });
57
+
58
+ // A long project settling hands the rows a new geometry with the same rows on many commits; each scrollTop read
59
+ // forced a layout of every clip.
60
+ it("reads no scroll position for a new geometry that places every row where it was", () => {
61
+ const scroll = document.createElement("div");
62
+ let reads = 0;
63
+ let top = 160;
64
+ Object.defineProperty(scroll, "scrollTop", {
65
+ get: () => (reads++, top),
66
+ set: (value: number) => void (top = value),
67
+ });
68
+ const scrollRef = { current: scroll };
69
+ const root = createRoot(document.createElement("div"));
70
+ function Probe({ geometry }: { geometry: TimelineRowGeometry }) {
71
+ useTimelineRowVirtualization({
72
+ scrollRef,
73
+ rowGeometry: geometry,
74
+ sessionEpoch: 0,
75
+ viewport: {
76
+ scrollTop: 160,
77
+ scrollLeft: 0,
78
+ clientWidth: 800,
79
+ clientHeight: 200,
80
+ scrollWidth: 800,
81
+ scrollHeight: 600,
82
+ isScrolling: false,
83
+ },
84
+ elements: [],
85
+ selectedElementId: null,
86
+ lastScrollLeftRef: { current: 0 },
87
+ syncScrollViewport: () => {},
88
+ });
89
+ return null;
90
+ }
91
+ const rows = () => createTimelineRowGeometry([0, 1, 2], [48, 48, 48]);
92
+ act(() => root.render(<Probe geometry={rows()} />));
93
+ reads = 0;
94
+ for (let i = 0; i < 3; i += 1) act(() => root.render(<Probe geometry={rows()} />));
95
+ expect(reads, "no layout read for the same rows").toBe(0);
96
+ act(() =>
97
+ root.render(<Probe geometry={createTimelineRowGeometry([0, 9, 1, 2], [48, 48, 48, 48])} />),
98
+ );
99
+ expect(reads, "a row added still keeps the view anchored").toBeGreaterThan(0);
100
+ act(() => root.unmount());
101
+ });
@@ -8,6 +8,7 @@ import {
8
8
  type RefObject,
9
9
  } from "react";
10
10
  import type { TimelineElement } from "../store/playerStore";
11
+ import { sameData } from "../../utils/sameData";
11
12
  import { resolveTimelineFocusIdentity } from "./timelineFocusIdentity";
12
13
  import { getTimelineScrollTopForGeometryChange } from "./timelineViewportGeometry";
13
14
  import type { TimelineRowGeometry } from "./timelineLayout";
@@ -39,6 +40,8 @@ function getFocusedTimelineRowKey(target: EventTarget | null): number | undefine
39
40
  return Number.isFinite(rowKey) ? rowKey : undefined;
40
41
  }
41
42
 
43
+ const rowTops = (g: TimelineRowGeometry) => [g.rowKeys, g.rowOffsets, g.padding.top];
44
+
42
45
  export function useTimelineRowVirtualization({
43
46
  scrollRef,
44
47
  viewport,
@@ -116,7 +119,7 @@ export function useTimelineRowVirtualization({
116
119
  scroll.scrollTop = 0;
117
120
  syncScrollViewport(scroll);
118
121
  }
119
- } else if (scroll && previousGeometry !== rowGeometry) {
122
+ } else if (scroll && !sameData(rowTops(previousGeometry), rowTops(rowGeometry))) {
120
123
  const nextScrollTop = getTimelineScrollTopForGeometryChange(
121
124
  previousGeometry,
122
125
  rowGeometry,
@@ -97,6 +97,7 @@ describe("preview quality messages", () => {
97
97
  worstFrameMs: 90,
98
98
  skippedShare: 0.1,
99
99
  waitingShare: 0.4,
100
+ frozenShare: 0.2,
100
101
  gapP50Ms: 17,
101
102
  gapP95Ms: 66,
102
103
  mode: "play",
@@ -21,6 +21,7 @@ export interface PlaybackHealth {
21
21
  worstFrameMs: number;
22
22
  skippedShare?: number;
23
23
  waitingShare?: number;
24
+ frozenShare?: number;
24
25
  gapP50Ms?: number;
25
26
  gapP95Ms?: number;
26
27
  mode: "play";
@@ -129,6 +130,7 @@ export function parsePlaybackHealth(value: unknown): PlaybackHealth | null {
129
130
  worstFrameMs: worstFrameMs as number,
130
131
  skippedShare: optionalNumber(extra.skippedShare),
131
132
  waitingShare: optionalNumber(extra.waitingShare),
133
+ frozenShare: optionalNumber(extra.frozenShare),
132
134
  gapP50Ms: optionalNumber(extra.gapP50Ms),
133
135
  gapP95Ms: optionalNumber(extra.gapP95Ms),
134
136
  mode: "play",