@hyperframes/studio 0.8.199 → 0.8.201
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-BDtBfwof.js → hyperframes-player-BNeO6YSP.js} +1 -1
- package/dist/assets/{index-BFfBBQMu.js → index-CZWE0FI8.js} +162 -162
- package/dist/assets/{index--W_0fuR8.js → index-DiNYtcMK.js} +1 -1
- package/dist/{chunk-ORLUDHTU.js → chunk-J6T4KD7Y.js} +33 -0
- package/dist/index.html +1 -1
- package/dist/index.js +227 -110
- package/dist/player.js +1 -1
- package/package.json +8 -8
- package/src/components/TimelineToolbar.test.tsx +117 -3
- package/src/components/TimelineToolbar.tsx +32 -1
- package/src/components/panels/VariablesBindElement.test.tsx +105 -0
- package/src/components/panels/VariablesBindElement.tsx +2 -2
- package/src/components/panels/VariablesDeclarationForm.test.ts +106 -0
- package/src/components/panels/VariablesDeclarationForm.tsx +21 -3
- package/src/components/panels/VariablesValueControls.tsx +6 -0
- package/src/components/ui/VideoFrameThumbnail.test.tsx +9 -0
- package/src/components/ui/VideoFrameThumbnail.tsx +1 -3
- package/src/hooks/appHotkeysDispatch.ts +7 -0
- package/src/hooks/useAppHotkeys.test.ts +75 -0
- package/src/hooks/useDomSelection.ts +5 -1
- package/src/player/components/EditModal.test.tsx +34 -0
- package/src/player/components/EditModal.tsx +4 -2
- package/src/player/components/studioShortcuts.ts +3 -0
- package/src/player/components/timelineMotion.test.ts +13 -0
- package/src/player/components/timelineMotion.ts +12 -6
- package/src/player/components/timelineZoom.test.ts +48 -0
- package/src/player/components/timelineZoom.ts +55 -0
- package/src/player/components/timelineZoomInput.test.ts +27 -0
- package/src/player/components/timelineZoomInput.ts +55 -8
- package/src/player/hooks/timelineSyncHydration.test.ts +20 -0
- package/src/player/hooks/timelineSyncHydration.ts +13 -2
- package/src/player/lib/timelineIframeHelpers.test.ts +41 -0
- package/src/player/lib/timelineIframeHelpers.ts +5 -2
- package/src/utils/sceneHold.test.ts +29 -0
- package/src/utils/sceneHold.ts +21 -0
|
@@ -493,7 +493,7 @@ export function buildMissingCompositionElements(
|
|
|
493
493
|
const hosts = doc.querySelectorAll("[data-composition-id][data-start]");
|
|
494
494
|
const missing: TimelineElement[] = [];
|
|
495
495
|
|
|
496
|
-
|
|
496
|
+
let resolveEnd: ReturnType<typeof createReferenceEndResolver> | undefined;
|
|
497
497
|
const masterTime = createRuntimeStartTimeResolver({
|
|
498
498
|
timelineRegistry: iframeWin.__timelines,
|
|
499
499
|
includeAuthoredTimingAttrs: true,
|
|
@@ -505,6 +505,7 @@ export function buildMissingCompositionElements(
|
|
|
505
505
|
const compId = el.getAttribute("data-composition-id");
|
|
506
506
|
if (!compId || compId === rootCompId) continue;
|
|
507
507
|
if (existingIds.has(el.id) || existingIds.has(compId)) continue;
|
|
508
|
+
resolveEnd ??= createReferenceEndResolver(createTimedElementLookup(doc), iframeWin);
|
|
508
509
|
const entry = buildMissingCompositionEntry({
|
|
509
510
|
doc,
|
|
510
511
|
iframeWin,
|
|
@@ -518,7 +519,9 @@ export function buildMissingCompositionElements(
|
|
|
518
519
|
if (entry) missing.push(entry);
|
|
519
520
|
}
|
|
520
521
|
|
|
521
|
-
// Patch existing elements that are missing compositionSrc
|
|
522
|
+
// Patch existing elements that are missing compositionSrc; only a host carrying its source can supply one.
|
|
523
|
+
if (!doc.querySelector("[data-composition-src], [data-composition-file]"))
|
|
524
|
+
return { missing, updatedEls: currentEls as TimelineElement[], patched: false };
|
|
522
525
|
let patched = false;
|
|
523
526
|
const findHost = previewElementFinder(doc);
|
|
524
527
|
const updatedEls = (currentEls as TimelineElement[]).map((existing) => {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import type { TimelineElement } from "../player";
|
|
3
|
+
import { holdScenesOf } from "./sceneHold";
|
|
4
|
+
|
|
5
|
+
const previewWith = (hold?: (names: string[]) => Promise<void>) =>
|
|
6
|
+
({ contentWindow: { __hfHoldScenes: hold } }) as unknown as HTMLIFrameElement;
|
|
7
|
+
|
|
8
|
+
describe("holdScenesOf", () => {
|
|
9
|
+
it("has the preview mount the scenes holding the element, and releases them for no element", async () => {
|
|
10
|
+
const hold = vi.fn(async () => {});
|
|
11
|
+
const element = {
|
|
12
|
+
id: "word",
|
|
13
|
+
tag: "span",
|
|
14
|
+
start: 700,
|
|
15
|
+
duration: 1,
|
|
16
|
+
track: 0,
|
|
17
|
+
compositionAncestors: ["main", "s23"],
|
|
18
|
+
parentCompositionId: "s23",
|
|
19
|
+
} as TimelineElement;
|
|
20
|
+
await holdScenesOf(previewWith(hold), element);
|
|
21
|
+
await holdScenesOf(previewWith(hold), null);
|
|
22
|
+
expect(hold.mock.calls).toEqual([[["main", "s23", "s23"]], [[]]]);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("gives nothing to wait for in a preview that mounts every scene", () => {
|
|
26
|
+
expect(holdScenesOf(previewWith(), null)).toBeUndefined();
|
|
27
|
+
expect(holdScenesOf(null, null)).toBeUndefined();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TimelineElement } from "../player";
|
|
2
|
+
|
|
3
|
+
type SceneHoldingWindow = Window & { __hfHoldScenes?: (names: string[]) => Promise<void> };
|
|
4
|
+
|
|
5
|
+
/** Mounts the scenes holding a timeline element; undefined, so no wait, where the preview mounts every scene. */
|
|
6
|
+
export function holdScenesOf(
|
|
7
|
+
iframe: HTMLIFrameElement | null,
|
|
8
|
+
element: TimelineElement | null,
|
|
9
|
+
): Promise<void> | undefined {
|
|
10
|
+
let hold: SceneHoldingWindow["__hfHoldScenes"];
|
|
11
|
+
try {
|
|
12
|
+
hold = (iframe?.contentWindow as SceneHoldingWindow | null)?.__hfHoldScenes;
|
|
13
|
+
} catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
if (!hold) return undefined;
|
|
17
|
+
const names = element
|
|
18
|
+
? [...(element.compositionAncestors ?? []), element.parentCompositionId ?? ""]
|
|
19
|
+
: [];
|
|
20
|
+
return hold(names.filter(Boolean)).catch(() => {});
|
|
21
|
+
}
|