@hyperframes/studio 0.9.56 → 0.9.59

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.
Files changed (39) hide show
  1. package/dist/assets/hyperframes-player-bya4hgms.js +573 -0
  2. package/dist/assets/{index-yuN1pZrv.js → index--dcfSUzI.js} +1 -1
  3. package/dist/assets/{index-CgyBYe2L.js → index-Bxh5lW0C.js} +178 -178
  4. package/dist/assets/{pausedVideoDecoder-DtvSF8bV.js → pausedVideoDecoder-BKym1jA6.js} +1 -1
  5. package/dist/index.d.ts +88 -3
  6. package/dist/index.html +1 -1
  7. package/dist/index.js +912 -814
  8. package/package.json +8 -8
  9. package/src/components/nle/NLEPreview.test.ts +35 -3
  10. package/src/components/nle/NLEPreview.tsx +5 -4
  11. package/src/hooks/gsapRuntimePatch.ts +2 -3
  12. package/src/hooks/gsapRuntimeReaders.test.ts +5 -40
  13. package/src/hooks/gsapRuntimeReaders.ts +3 -27
  14. package/src/hooks/useExternalFileChangeCoordinator.test.tsx +20 -0
  15. package/src/hooks/useExternalFileChangeCoordinator.ts +1 -1
  16. package/src/hooks/useMusicBeatAnalysis.test.tsx +131 -0
  17. package/src/hooks/useMusicBeatAnalysis.ts +51 -66
  18. package/src/hooks/useRenderClipContent.test.ts +21 -0
  19. package/src/hooks/useRenderClipContent.ts +3 -1
  20. package/src/index.ts +18 -0
  21. package/src/player/components/studioShortcuts.ts +3 -2
  22. package/src/player/hooks/timelinePlayerTestHarness.ts +2 -0
  23. package/src/player/hooks/timelineSyncHydration.test.ts +28 -2
  24. package/src/player/hooks/timelineSyncHydration.ts +3 -7
  25. package/src/player/hooks/usePlaybackKeyboard.test.ts +107 -2
  26. package/src/player/hooks/usePlaybackKeyboard.ts +38 -1
  27. package/src/player/hooks/useShadowPreviewReload.ts +131 -14
  28. package/src/player/hooks/useTimelinePlayer.reloadStill.test.ts +241 -0
  29. package/src/player/hooks/useTimelinePlayer.ts +13 -1
  30. package/src/player/hooks/useTimelineSyncCallbacks.ts +4 -0
  31. package/src/player/lib/previewElements.test.ts +4 -0
  32. package/src/player/lib/previewElements.ts +1 -0
  33. package/src/sealedPreviewExports.test.ts +21 -0
  34. package/src/utils/externalConflictStorage.test.ts +66 -14
  35. package/src/utils/externalConflictStorage.ts +36 -82
  36. package/src/utils/gsapSoftReload.ts +2 -14
  37. package/src/utils/timelineInspector.test.ts +49 -2
  38. package/src/utils/timelineInspector.ts +21 -2
  39. package/dist/assets/hyperframes-player-SRLbmEDB.js +0 -565
@@ -1,4 +1,3 @@
1
- import { COLOR_GRADING_SOURCE_HIDDEN_ATTR } from "@hyperframes/core/color-grading";
2
1
  import { parseGsapScript } from "@hyperframes/parsers/gsap-parser";
3
2
  import { GSAP_BASE_URL_META, motionPathPluginUrl } from "@hyperframes/core/gsap-cdn";
4
3
  import { findAuthoredElement } from "./authoredSource";
@@ -464,24 +463,13 @@ export function applySoftReload(
464
463
  s.cssText = css;
465
464
  restoreAuthoredStyle(s, findAuthoredStyle(el), targets.get(el)!);
466
465
  // The restored cssText carries RUNTIME opacity, not authored opacity:
467
- // a mid-flight tween's interpolated value, or the color-grading hide
468
- // (`opacity: 0 !important`). The re-run script's tweens re-initialize
466
+ // a mid-flight tween's interpolated value. The re-run script's tweens re-initialize
469
467
  // against it — a from() captures it as its END, a to() as its START —
470
468
  // turning the transient into the tween's permanent bound (dimmed or
471
469
  // invisible elements). Put the AUTHORED inline opacity back; the seek
472
470
  // below re-renders the correct animated value either way.
473
471
  const authored = readAuthoredOpacity(el);
474
- if (authored !== null) {
475
- applyAuthoredInlineOpacity(s, authored);
476
- } else if (
477
- el.hasAttribute(COLOR_GRADING_SOURCE_HIDDEN_ATTR) &&
478
- s.getPropertyValue("opacity") === "0" &&
479
- s.getPropertyPriority("opacity") === "important"
480
- ) {
481
- // Authored value unknown, but this is definitely the grading hide —
482
- // never let a from() capture 0; fall back to the CSS cascade.
483
- s.removeProperty("opacity");
484
- }
472
+ if (authored !== null) applyAuthoredInlineOpacity(s, authored);
485
473
  }
486
474
  }
487
475
  forgetLiveSets(targets);
@@ -5,7 +5,9 @@ import {
5
5
  isAudioDomElement,
6
6
  isAudioTimelineElement,
7
7
  isMusicSourceElement,
8
+ fitsBeatAnalysis,
8
9
  isMusicTrack,
10
+ MAX_BEAT_SOURCE_SECONDS,
9
11
  resolveBeatSourceTrack,
10
12
  } from "./timelineInspector";
11
13
  import type { TimelineElement } from "../player";
@@ -15,12 +17,28 @@ function el(
15
17
  overrides: Partial<
16
18
  Pick<
17
19
  TimelineElement,
18
- "tag" | "src" | "id" | "domId" | "timelineRole" | "duration" | "hasAudio" | "muted"
20
+ | "tag"
21
+ | "src"
22
+ | "id"
23
+ | "domId"
24
+ | "timelineRole"
25
+ | "duration"
26
+ | "sourceDuration"
27
+ | "hasAudio"
28
+ | "muted"
19
29
  >
20
30
  >,
21
31
  ): Pick<
22
32
  TimelineElement,
23
- "tag" | "src" | "id" | "domId" | "timelineRole" | "duration" | "hasAudio" | "muted"
33
+ | "tag"
34
+ | "src"
35
+ | "id"
36
+ | "domId"
37
+ | "timelineRole"
38
+ | "duration"
39
+ | "sourceDuration"
40
+ | "hasAudio"
41
+ | "muted"
24
42
  > {
25
43
  return {
26
44
  tag: "audio",
@@ -29,6 +47,7 @@ function el(
29
47
  domId: "el-1",
30
48
  timelineRole: undefined,
31
49
  duration: 10,
50
+ sourceDuration: 120,
32
51
  ...overrides,
33
52
  };
34
53
  }
@@ -127,6 +146,22 @@ describe("resolveBeatSourceTrack", () => {
127
146
  expect(resolveBeatSourceTrack([sfx, vo])).toBeNull();
128
147
  });
129
148
 
149
+ it("falls back to a song over a longer clip whose file's length is not known yet", () => {
150
+ const unread = el({ id: "unread", domId: "unread", duration: 300, sourceDuration: undefined });
151
+ const song = el({ id: "song", domId: "song", duration: 180, sourceDuration: 180 });
152
+ expect(resolveBeatSourceTrack([unread, song])!.element).toBe(song);
153
+ const looped = el({ id: "loop", domId: "loop", duration: 1200, sourceDuration: 180 });
154
+ expect(resolveBeatSourceTrack([looped])!.element).toBe(looped);
155
+ });
156
+
157
+ it("never falls back to a clip, or a clip's file, longer than a song", () => {
158
+ const talk = el({ id: "talk", domId: "talk", duration: 3720, sourceDuration: 3720 });
159
+ const excerpt = el({ id: "cut", domId: "cut", duration: 180, sourceDuration: 3720 });
160
+ expect(resolveBeatSourceTrack([talk, excerpt])).toBeNull();
161
+ const song = el({ id: "song", domId: "song", duration: 200, sourceDuration: 200 });
162
+ expect(resolveBeatSourceTrack([talk, song])!.element).toBe(song);
163
+ });
164
+
130
165
  it("returns isFallback=true for an untagged clip with a non-music id", () => {
131
166
  const clip = el({ id: "my_audio_file", domId: "my_audio_file", timelineRole: undefined });
132
167
  const result = resolveBeatSourceTrack([clip]);
@@ -184,3 +219,15 @@ describe("beat source from a video with sound", () => {
184
219
  expect(resolveBeatSourceTrack([short, long, muted])?.element).toBe(long);
185
220
  });
186
221
  });
222
+
223
+ describe("fitsBeatAnalysis", () => {
224
+ it("fits a file whose length is known and no longer than a song, however long its clip runs", () => {
225
+ expect(fitsBeatAnalysis({ sourceDuration: 180 })).toBe(true);
226
+ expect(fitsBeatAnalysis({ sourceDuration: MAX_BEAT_SOURCE_SECONDS })).toBe(true);
227
+ });
228
+
229
+ it("refuses a file past the cap and a file whose length is unknown", () => {
230
+ expect(fitsBeatAnalysis({ sourceDuration: 3720 })).toBe(false);
231
+ expect(fitsBeatAnalysis({})).toBe(false);
232
+ });
233
+ });
@@ -80,6 +80,16 @@ export function isMusicTrack(
80
80
  return MUSIC_ID_RE.test(id);
81
81
  }
82
82
 
83
+ /** Past a song's length a track is speech or a mix, and beat analysis decodes its whole file (62 min: 1.4 GB). */
84
+ export const MAX_BEAT_SOURCE_SECONDS = 15 * 60;
85
+
86
+ /** The decode reads the whole file, so a source fits once its file's length is known and within the cap. */
87
+ export function fitsBeatAnalysis({
88
+ sourceDuration,
89
+ }: Pick<TimelineElement, "sourceDuration">): boolean {
90
+ return sourceDuration != null && sourceDuration <= MAX_BEAT_SOURCE_SECONDS;
91
+ }
92
+
83
93
  /**
84
94
  * Resolve the best audio source for beat analysis. An explicitly tagged or
85
95
  * named music track wins; when none is present (e.g. an audio file dropped
@@ -94,18 +104,27 @@ export function isMusicTrack(
94
104
  export function resolveBeatSourceTrack(
95
105
  elements: readonly Pick<
96
106
  TimelineElement,
97
- "tag" | "src" | "id" | "domId" | "timelineRole" | "duration" | "hasAudio" | "muted"
107
+ | "tag"
108
+ | "src"
109
+ | "id"
110
+ | "domId"
111
+ | "timelineRole"
112
+ | "duration"
113
+ | "sourceDuration"
114
+ | "hasAudio"
115
+ | "muted"
98
116
  >[],
99
117
  ): { element: (typeof elements)[number]; isFallback: boolean } | null {
100
118
  const explicit = elements.find(isMusicTrack);
101
119
  if (explicit) return { element: explicit, isFallback: false };
102
120
 
103
121
  // Fallback: pick the longest audio clip (skipping explicitly non-music roles
104
- // like "sfx" or "voiceover" to avoid triggering beat analysis on those).
122
+ // like "sfx" or "voiceover", and anything longer than a song, so none is beat-analysed).
105
123
  let best: (typeof elements)[number] | null = null;
106
124
  for (const el of elements) {
107
125
  if (!isMusicSourceElement(el)) continue;
108
126
  if (el.timelineRole && el.timelineRole !== "music") continue;
127
+ if (!fitsBeatAnalysis(el)) continue;
109
128
  if (!best || el.duration > best.duration) best = el;
110
129
  }
111
130
  return best ? { element: best, isFallback: true } : null;