@hyperframes/studio 0.8.227 → 0.8.229

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/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-DoXOJGW5.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-CrRO-B3w.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-RUPGNyct.css">
19
19
  </head>
20
20
  <body>
package/dist/index.js CHANGED
@@ -10965,6 +10965,7 @@ function useTimelineClipDrag({
10965
10965
  const [resizingClip, setResizingClipState] = useState8(null);
10966
10966
  const resizingClipRef = useRef13(null);
10967
10967
  const publishResizingClip = useCallback8((next) => {
10968
+ if (next) markTimelineMotion();
10968
10969
  resizingClipRef.current = next;
10969
10970
  setResizingClipState(next);
10970
10971
  }, []);
@@ -28998,6 +28999,27 @@ function useVideoThumbnailSnapshot(poster, rich, media) {
28998
28999
  const shownSnapshot = useThumbnailLease(shown3.media === media ? shown3.request : null);
28999
29000
  return selectThumbnailSnapshot(posterSnapshot, richSnapshot, shownSnapshot);
29000
29001
  }
29002
+ function useRangeHeldDuringTrim(props) {
29003
+ const {
29004
+ videoSrc,
29005
+ sourceStart,
29006
+ sourceRangeDuration,
29007
+ duration,
29008
+ projectId,
29009
+ sessionEpoch,
29010
+ priority
29011
+ } = props;
29012
+ const range = useValueAtRest(
29013
+ useMemo36(
29014
+ () => ({ sourceStart, sourceRangeDuration, duration }),
29015
+ [duration, sourceRangeDuration, sourceStart]
29016
+ )
29017
+ );
29018
+ return useMemo36(
29019
+ () => ({ videoSrc, ...range, projectId, sessionEpoch, priority }),
29020
+ [priority, projectId, range, sessionEpoch, videoSrc]
29021
+ );
29022
+ }
29001
29023
  var VideoThumbnail = memo22(function VideoThumbnail2({
29002
29024
  videoSrc,
29003
29025
  label,
@@ -29015,18 +29037,15 @@ var VideoThumbnail = memo22(function VideoThumbnail2({
29015
29037
  computeThumbnailStrip(container.width, 16 / 9, container.height).frameCount
29016
29038
  )
29017
29039
  );
29018
- const requestProps = useMemo36(
29019
- () => ({
29020
- videoSrc,
29021
- sourceStart,
29022
- sourceRangeDuration,
29023
- duration,
29024
- projectId,
29025
- sessionEpoch,
29026
- priority
29027
- }),
29028
- [duration, priority, projectId, sessionEpoch, sourceRangeDuration, sourceStart, videoSrc]
29029
- );
29040
+ const requestProps = useRangeHeldDuringTrim({
29041
+ videoSrc,
29042
+ sourceStart,
29043
+ sourceRangeDuration,
29044
+ duration,
29045
+ projectId,
29046
+ sessionEpoch,
29047
+ priority
29048
+ });
29030
29049
  const posterRequest = useMemo36(
29031
29050
  () => createVideoThumbnailRequest(requestProps, 1, false),
29032
29051
  [requestProps]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio",
3
- "version": "0.8.227",
3
+ "version": "0.8.229",
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/parsers": "0.8.227",
64
- "@hyperframes/core": "0.8.227",
65
- "@hyperframes/player": "0.8.227",
66
- "@hyperframes/studio-server": "0.8.227",
67
- "@hyperframes/sdk": "0.8.227",
68
- "@hyperframes/shader-transitions": "0.8.227"
63
+ "@hyperframes/core": "0.8.229",
64
+ "@hyperframes/parsers": "0.8.229",
65
+ "@hyperframes/sdk": "0.8.229",
66
+ "@hyperframes/shader-transitions": "0.8.229",
67
+ "@hyperframes/studio-server": "0.8.229",
68
+ "@hyperframes/player": "0.8.229"
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.227"
85
+ "@hyperframes/producer": "0.8.229"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "react": "19",
@@ -452,3 +452,62 @@ describe("VideoThumbnail during a zoom", () => {
452
452
  );
453
453
  });
454
454
  });
455
+
456
+ describe("VideoThumbnail during a trim", () => {
457
+ beforeEach(() => {
458
+ vi.useFakeTimers({
459
+ toFake: ["setTimeout", "clearTimeout", "requestAnimationFrame", "cancelAnimationFrame"],
460
+ });
461
+ vi.mocked(decodeVideoThumbnail).mockResolvedValue({
462
+ value: { kind: "filmstrip", urls: ["blob:a", "blob:b"], aspect: 16 / 9 },
463
+ weight: 256,
464
+ });
465
+ });
466
+ afterEach(() => {
467
+ vi.useRealTimers();
468
+ });
469
+
470
+ const trimmed = (duration: number, sourceStart: number) => (
471
+ <VideoThumbnail
472
+ videoSrc="/api/projects/p/preview/assets/clip.mp4"
473
+ label=""
474
+ labelColor="#fff"
475
+ projectId="p"
476
+ sessionEpoch={1}
477
+ duration={duration}
478
+ sourceStart={sourceStart}
479
+ sourceRangeDuration={duration}
480
+ />
481
+ );
482
+
483
+ it("keeps its strip through every move of a trim and decodes the new range once at rest", async () => {
484
+ Object.defineProperty(host, "clientWidth", { configurable: true, value: 440 });
485
+ Object.defineProperty(host, "clientHeight", { configurable: true, value: 40 });
486
+ const root = harness.mount(host);
487
+ await act(async () => {
488
+ root.render(trimmed(10, 0));
489
+ await Promise.resolve();
490
+ });
491
+ vi.mocked(decodeVideoThumbnail).mockClear();
492
+ for (const [duration, start] of [
493
+ [9.5, 0.5],
494
+ [9, 1],
495
+ [8.5, 1.5],
496
+ ] as const) {
497
+ await act(async () => {
498
+ markTimelineMotion();
499
+ root.render(trimmed(duration, start));
500
+ await Promise.resolve();
501
+ });
502
+ }
503
+ expect(decodeVideoThumbnail).not.toHaveBeenCalled();
504
+ await act(async () => {
505
+ vi.runOnlyPendingTimers();
506
+ await Promise.resolve();
507
+ });
508
+ const ranges = vi
509
+ .mocked(decodeVideoThumbnail)
510
+ .mock.calls.map(([r]) => [r.sourceStart, r.sourceRangeDuration]);
511
+ expect(new Set(ranges.map((r) => r.join()))).toEqual(new Set(["1.5,8.5"]));
512
+ });
513
+ });
@@ -104,6 +104,33 @@ function useVideoThumbnailSnapshot(
104
104
  return selectThumbnailSnapshot(posterSnapshot, richSnapshot, shownSnapshot);
105
105
  }
106
106
 
107
+ function useRangeHeldDuringTrim(
108
+ props: Required<
109
+ Pick<VideoThumbnailProps, "videoSrc" | "duration" | "projectId" | "sessionEpoch" | "priority">
110
+ > &
111
+ Pick<VideoThumbnailProps, "sourceStart" | "sourceRangeDuration">,
112
+ ) {
113
+ const {
114
+ videoSrc,
115
+ sourceStart,
116
+ sourceRangeDuration,
117
+ duration,
118
+ projectId,
119
+ sessionEpoch,
120
+ priority,
121
+ } = props;
122
+ const range = useValueAtRest(
123
+ useMemo(
124
+ () => ({ sourceStart, sourceRangeDuration, duration }),
125
+ [duration, sourceRangeDuration, sourceStart],
126
+ ),
127
+ );
128
+ return useMemo(
129
+ () => ({ videoSrc, ...range, projectId, sessionEpoch, priority }),
130
+ [priority, projectId, range, sessionEpoch, videoSrc],
131
+ );
132
+ }
133
+
107
134
  /** Sparse, bounded video frames supplied by the shared thumbnail scheduler. */
108
135
  export const VideoThumbnail = memo(function VideoThumbnail({
109
136
  videoSrc,
@@ -122,18 +149,15 @@ export const VideoThumbnail = memo(function VideoThumbnail({
122
149
  computeThumbnailStrip(container.width, 16 / 9, container.height).frameCount,
123
150
  ),
124
151
  );
125
- const requestProps = useMemo(
126
- () => ({
127
- videoSrc,
128
- sourceStart,
129
- sourceRangeDuration,
130
- duration,
131
- projectId,
132
- sessionEpoch,
133
- priority,
134
- }),
135
- [duration, priority, projectId, sessionEpoch, sourceRangeDuration, sourceStart, videoSrc],
136
- );
152
+ const requestProps = useRangeHeldDuringTrim({
153
+ videoSrc,
154
+ sourceStart,
155
+ sourceRangeDuration,
156
+ duration,
157
+ projectId,
158
+ sessionEpoch,
159
+ priority,
160
+ });
137
161
  const posterRequest = useMemo(
138
162
  () => createVideoThumbnailRequest(requestProps, 1, false),
139
163
  [requestProps],
@@ -8,6 +8,7 @@ import { usePreviewFrameStore } from "../store/previewFrameStore";
8
8
  import type { BlockedClipState, DraggedClipState, ResizingClipState } from "./useTimelineClipDrag";
9
9
  import { useTimelineClipDrag } from "./useTimelineClipDrag";
10
10
  import { mountReactHarness } from "../../hooks/domSelectionTestHarness";
11
+ import { isTimelineMoving, TIMELINE_REST_MS } from "./timelineMotion";
11
12
 
12
13
  (globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
13
14
 
@@ -25,6 +26,7 @@ function el(id: string, over: Partial<TimelineElement> = {}): TimelineElement {
25
26
  }
26
27
 
27
28
  afterEach(() => {
29
+ vi.useRealTimers();
28
30
  document.body.innerHTML = "";
29
31
  usePlayerStore.getState().reset();
30
32
  usePreviewFrameStore.setState({ time: null });
@@ -222,6 +224,20 @@ describe("useTimelineClipDrag — single-clip resize (unchanged path)", () => {
222
224
  h.unmount();
223
225
  });
224
226
 
227
+ it("marks the timeline as moving on every trim move, so thumbnails hold their range", () => {
228
+ vi.useFakeTimers();
229
+ const a = el("a", { start: 0, duration: 2 });
230
+ const h = renderResizeHarness([a], []);
231
+ h.startResize(a, "end");
232
+ act(() => vi.advanceTimersByTime(TIMELINE_REST_MS));
233
+ expect(isTimelineMoving()).toBe(false);
234
+
235
+ h.movePointer(50);
236
+
237
+ expect(isTimelineMoving()).toBe(true);
238
+ h.unmount();
239
+ });
240
+
225
241
  it("does not let an older rejected resize roll back a newer optimistic gesture", async () => {
226
242
  const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
227
243
  const a = el("a", { start: 0, duration: 2 });
@@ -1,5 +1,6 @@
1
1
  import { useRef, useState, useCallback, useMemo, useEffect } from "react";
2
2
  import { useMountEffect } from "../../hooks/useMountEffect";
3
+ import { markTimelineMotion } from "./timelineMotion";
3
4
  import {
4
5
  applyTimelineAutoScrollStep,
5
6
  resolveTimelineAutoScrollLoopAction,
@@ -201,6 +202,7 @@ export function useTimelineClipDrag({
201
202
  const [resizingClip, setResizingClipState] = useState<ResizingClipState | null>(null);
202
203
  const resizingClipRef = useRef<ResizingClipState | null>(null);
203
204
  const publishResizingClip = useCallback((next: ResizingClipState | null) => {
205
+ if (next) markTimelineMotion();
204
206
  resizingClipRef.current = next;
205
207
  setResizingClipState(next);
206
208
  }, []);