@hyperframes/studio 0.8.205 → 0.8.207
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/assets/hyperframes-player-Cm5aBiKq.js +478 -0
- package/dist/assets/{index-dy6GQJn4.js → index-BF9YeBnC.js} +142 -142
- package/dist/assets/{index-C8hp9Y7c.js → index-BrqAmMRt.js} +1 -1
- package/dist/{chunk-Z5NKM57J.js → chunk-3EAFE522.js} +8 -4
- package/dist/{chunk-2YCKGJFD.js → chunk-HPIJDMWG.js} +5 -5
- package/dist/{chunk-T43DM7Q6.js → chunk-OGIOFEC7.js} +4 -2
- package/dist/{domEditingLayers-WMDSHU5P.js → domEditingLayers-7Z6J4UOK.js} +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.html +1 -1
- package/dist/index.js +235 -127
- package/dist/player.js +2 -2
- package/package.json +8 -8
- package/src/components/MediaPreview.test.tsx +69 -0
- package/src/components/MediaPreview.tsx +10 -5
- package/src/components/editor/domEditLayerWalkCache.test.ts +48 -0
- package/src/components/editor/domEditLayerWalkCache.ts +6 -0
- package/src/components/editor/domEditingLayers.ts +3 -2
- package/src/components/sidebar/PromptPreviewModal.test.tsx +22 -0
- package/src/components/sidebar/PromptPreviewModal.tsx +1 -0
- package/src/hooks/timelineEditingHelpers.test.ts +59 -0
- package/src/hooks/timelineEditingHelpers.ts +4 -5
- package/src/hooks/useGestureRecording.ts +5 -3
- package/src/player/components/PlayerControls.tsx +5 -2
- package/src/player/components/ShortcutsPanel.tsx +4 -2
- package/src/player/components/Timeline.test.ts +12 -0
- package/src/player/components/TimelineProvider.tsx +1 -0
- package/src/player/components/TimelineRuler.tsx +4 -7
- package/src/player/components/TimelineRulerPart.tsx +1 -0
- package/src/player/components/timelineClipDragPreview.test.ts +10 -0
- package/src/player/components/timelineClipDragPreview.ts +4 -5
- package/src/player/components/timelineRulerGeometry.ts +14 -3
- package/src/player/components/useTimelineClipDrag.ts +5 -2
- package/src/player/components/useTimelineProviderState.tsx +2 -1
- package/src/player/components/useTimelineTicks.ts +4 -1
- package/src/player/hooks/previewMessageRouter.test.ts +34 -0
- package/src/player/hooks/previewMessageRouter.ts +14 -3
- package/src/player/hooks/usePlaybackKeyboard.test.ts +19 -0
- package/src/player/hooks/usePlaybackKeyboard.ts +5 -2
- package/src/player/hooks/useShadowPreviewReload.ts +4 -1
- package/src/player/hooks/useTimelinePlayer.shadowReload.test.ts +21 -0
- package/src/player/lib/mediaFetch.test.ts +163 -0
- package/src/player/lib/mediaFetch.ts +98 -0
- package/src/player/lib/mediaProbe.test.ts +21 -1
- package/src/player/lib/mediaProbe.ts +4 -2
- package/src/player/lib/thumbnailVideoDecoder.test.ts +24 -1
- package/src/player/lib/thumbnailVideoDecoder.ts +3 -1
- package/src/player/lib/time.test.ts +13 -13
- package/src/player/lib/time.ts +4 -4
- package/src/utils/linkedClipPreferences.ts +2 -0
- package/src/utils/sourceScopedSelectorIndex.ts +5 -2
- package/dist/assets/hyperframes-player-DzdSmJdB.js +0 -478
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type ThumbnailLoadedResult,
|
|
5
5
|
type ThumbnailValue,
|
|
6
6
|
} from "./thumbnailScheduler";
|
|
7
|
+
import { mediaUrlSourceOptions, reportMediaFetchFailure } from "./mediaFetch";
|
|
7
8
|
|
|
8
9
|
export interface VideoThumbnailDecodeRequest {
|
|
9
10
|
source: string;
|
|
@@ -260,6 +261,7 @@ export async function decodeVideoThumbnail(
|
|
|
260
261
|
return await decodeMissingFrames(request, signal, budgets, keyOf, resources);
|
|
261
262
|
} catch (error) {
|
|
262
263
|
releaseDecodedResources(resources);
|
|
264
|
+
reportMediaFetchFailure(error);
|
|
263
265
|
throw error;
|
|
264
266
|
}
|
|
265
267
|
}
|
|
@@ -275,7 +277,7 @@ async function decodeMissingFrames(
|
|
|
275
277
|
throwIfAborted(signal);
|
|
276
278
|
|
|
277
279
|
const input = new mediabunny.Input({
|
|
278
|
-
source: new mediabunny.UrlSource(request.source),
|
|
280
|
+
source: new mediabunny.UrlSource(request.source, mediaUrlSourceOptions("thumbnail")),
|
|
279
281
|
formats: mediabunny.ALL_FORMATS,
|
|
280
282
|
});
|
|
281
283
|
try {
|
|
@@ -58,29 +58,29 @@ describe("formatTime", () => {
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
describe("frame helpers", () => {
|
|
61
|
-
it("converts seconds to frames at
|
|
62
|
-
expect(secondsToFrame(0)).toBe(0);
|
|
63
|
-
expect(secondsToFrame(1)).toBe(30);
|
|
64
|
-
expect(secondsToFrame(1.5)).toBe(45);
|
|
61
|
+
it("converts seconds to frames at 30 fps", () => {
|
|
62
|
+
expect(secondsToFrame(0, 30)).toBe(0);
|
|
63
|
+
expect(secondsToFrame(1, 30)).toBe(30);
|
|
64
|
+
expect(secondsToFrame(1.5, 30)).toBe(45);
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
it("converts frames to seconds at
|
|
68
|
-
expect(frameToSeconds(0)).toBe(0);
|
|
69
|
-
expect(frameToSeconds(30)).toBe(1);
|
|
70
|
-
expect(frameToSeconds(45)).toBe(1.5);
|
|
67
|
+
it("converts frames to seconds at 30 fps", () => {
|
|
68
|
+
expect(frameToSeconds(0, 30)).toBe(0);
|
|
69
|
+
expect(frameToSeconds(30, 30)).toBe(1);
|
|
70
|
+
expect(frameToSeconds(45, 30)).toBe(1.5);
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
it("formats current and total frame display", () => {
|
|
74
|
-
expect(formatFrameTime(1, 5)).toBe("30f / 150f");
|
|
74
|
+
expect(formatFrameTime(1, 5, 30)).toBe("30f / 150f");
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it("steps from a truncated runtime time by integer frame index", () => {
|
|
78
|
-
expect(stepFrameTime(0.0333333, 1)).toBe(2 / 30);
|
|
79
|
-
expect(stepFrameTime(0.0666666, 1)).toBe(3 / 30);
|
|
80
|
-
expect(stepFrameTime(0.0666666, -1)).toBe(1 / 30);
|
|
78
|
+
expect(stepFrameTime(0.0333333, 1, 30)).toBe(2 / 30);
|
|
79
|
+
expect(stepFrameTime(0.0666666, 1, 30)).toBe(3 / 30);
|
|
80
|
+
expect(stepFrameTime(0.0666666, -1, 30)).toBe(1 / 30);
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
it("clamps frame stepping at zero", () => {
|
|
84
|
-
expect(stepFrameTime(0, -1)).toBe(0);
|
|
84
|
+
expect(stepFrameTime(0, -1, 30)).toBe(0);
|
|
85
85
|
});
|
|
86
86
|
});
|
package/src/player/lib/time.ts
CHANGED
|
@@ -14,25 +14,25 @@ export function formatTime(time: number): string {
|
|
|
14
14
|
return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export function secondsToFrame(time: number, fps
|
|
17
|
+
export function secondsToFrame(time: number, fps: number): number {
|
|
18
18
|
if (!Number.isFinite(time) || time <= 0) return 0;
|
|
19
19
|
if (!Number.isFinite(fps) || fps <= 0) return 0;
|
|
20
20
|
return Math.round(time * fps);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export function frameToSeconds(frame: number, fps
|
|
23
|
+
export function frameToSeconds(frame: number, fps: number): number {
|
|
24
24
|
if (!Number.isFinite(frame) || frame <= 0) return 0;
|
|
25
25
|
if (!Number.isFinite(fps) || fps <= 0) return 0;
|
|
26
26
|
return frame / fps;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export function stepFrameTime(time: number, deltaFrames: number, fps
|
|
29
|
+
export function stepFrameTime(time: number, deltaFrames: number, fps: number): number {
|
|
30
30
|
const currentFrame = secondsToFrame(time, fps);
|
|
31
31
|
const nextFrame = Math.max(0, currentFrame + deltaFrames);
|
|
32
32
|
return frameToSeconds(nextFrame, fps);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export function formatFrameTime(time: number, duration: number, fps
|
|
35
|
+
export function formatFrameTime(time: number, duration: number, fps: number): string {
|
|
36
36
|
const currentFrame = secondsToFrame(time, fps);
|
|
37
37
|
const totalFrames = secondsToFrame(duration, fps);
|
|
38
38
|
return `${currentFrame}f / ${totalFrames}f`;
|
|
@@ -30,5 +30,7 @@ export const useLinkedClipPreferences = create<LinkedClipPreferences>((set) => (
|
|
|
30
30
|
},
|
|
31
31
|
}));
|
|
32
32
|
|
|
33
|
+
export const useCompositionFps = (): number => useLinkedClipPreferences((s) => s.compositionFps);
|
|
34
|
+
|
|
33
35
|
export const isLinkedSelectionOn = (): boolean =>
|
|
34
36
|
useLinkedClipPreferences.getState().linkedSelection;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
/** Every element matching one selector, mapped to the source file it belongs to
|
|
10
10
|
* and its occurrence index within that file. One document query fills it. */
|
|
11
11
|
type SelectorOccurrences = Map<Element, { scope: string; index: number }>;
|
|
12
|
+
export type KeptIndexes = Map<Document, Map<string, SelectorOccurrences>>;
|
|
12
13
|
|
|
13
14
|
interface SelectorIndexPass {
|
|
14
15
|
doc: Document;
|
|
@@ -33,9 +34,11 @@ let activePass: SelectorIndexPass | null = null;
|
|
|
33
34
|
* (the resolver may be a fresh closure per call, as long as it answers the
|
|
34
35
|
* same). Outside a pass the index is per-call, exactly as before.
|
|
35
36
|
*/
|
|
36
|
-
export function withSelectorIndexPass<T>(doc: Document, run: () => T): T {
|
|
37
|
+
export function withSelectorIndexPass<T>(doc: Document, run: () => T, kept?: KeptIndexes): T {
|
|
37
38
|
const previous = activePass;
|
|
38
|
-
|
|
39
|
+
const bySelector = kept?.get(doc) ?? new Map();
|
|
40
|
+
kept?.set(doc, bySelector);
|
|
41
|
+
activePass = { doc, bySelector };
|
|
39
42
|
try {
|
|
40
43
|
return run();
|
|
41
44
|
} finally {
|