@hyperframes/studio 0.9.66 → 0.9.67
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-VGx6ow_e.js → hyperframes-player-DHYu0XuV.js} +1 -1
- package/dist/assets/{index-B8Xt_Oyw.js → index-BBKHfua5.js} +128 -128
- package/dist/assets/{index-BH18TdX9.js → index-DqND4rHq.js} +1 -1
- package/dist/assets/{pausedVideoDecoder-Bx3fGNkU.js → pausedVideoDecoder-B1FNXBMe.js} +1 -1
- package/dist/{chunk-ESTBKVCB.js → chunk-LR3VT3EF.js} +12 -0
- package/dist/index.html +1 -1
- package/dist/index.js +42 -19
- package/dist/player.js +1 -1
- package/package.json +8 -8
- package/src/components/editor/gsapLivePreview.sealed.test.ts +35 -0
- package/src/components/editor/gsapLivePreview.ts +6 -2
- package/src/hooks/gsapMutationClient.test.ts +32 -0
- package/src/hooks/gsapMutationClient.ts +6 -3
- package/src/hooks/timelineTimingSync.test.ts +1 -1
- package/src/hooks/useFreezeFrame.test.ts +3 -2
- package/src/hooks/useFreezeFrame.ts +2 -2
- package/src/hooks/useGroupCommits.ts +7 -2
- package/src/player/hooks/usePreviewFirstFrameTelemetry.sealed.test.ts +43 -0
- package/src/player/hooks/usePreviewFirstFrameTelemetry.ts +11 -7
- package/src/player/hooks/useTimelineSyncCallbacks.sealed.test.ts +37 -2
- package/src/player/hooks/useTimelineSyncCallbacks.ts +21 -11
- package/src/player/lib/previewChannel.ts +12 -0
- package/src/utils/studioSaveDiagnostics.ts +2 -0
|
@@ -15,7 +15,7 @@ import type { PlaybackAdapter, IframeWindow } from "../lib/playbackTypes";
|
|
|
15
15
|
import { readTimelineDurationFromDocument } from "../lib/timelineDOM";
|
|
16
16
|
import { buildMissingCompositionElements } from "../lib/timelineIframeHelpers";
|
|
17
17
|
import { acceptedRuntimeMessageFps } from "../lib/runtimeProtocol";
|
|
18
|
-
import { previewDocumentCopy, previewFrameOpaque } from "../lib/previewChannel";
|
|
18
|
+
import { previewClipParents, previewDocumentCopy, previewFrameOpaque } from "../lib/previewChannel";
|
|
19
19
|
import { useLinkedClipPreferences } from "../../utils/linkedClipPreferences";
|
|
20
20
|
import {
|
|
21
21
|
buildTimelineElementsFromClips,
|
|
@@ -153,6 +153,15 @@ export function resolveTimelineTotalDuration(input: {
|
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/** A same-origin frame's clip tree, read in place; a frame that refuses the read has none. */
|
|
157
|
+
function openClipParents(iframe: HTMLIFrameElement | null): Map<string, string> {
|
|
158
|
+
try {
|
|
159
|
+
return clipTreeParentMap(iframe?.contentWindow ?? null);
|
|
160
|
+
} catch {
|
|
161
|
+
return new Map();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
156
165
|
export function useTimelineSyncCallbacks({
|
|
157
166
|
iframeRef,
|
|
158
167
|
probeIntervalRef,
|
|
@@ -173,14 +182,13 @@ export function useTimelineSyncCallbacks({
|
|
|
173
182
|
}: UseTimelineSyncCallbacksParams) {
|
|
174
183
|
// Convert a runtime timeline message (from iframe postMessage) into TimelineElements
|
|
175
184
|
const applyTimelineMessage = useCallback(
|
|
176
|
-
(data: RuntimeTimelineMessage, iframeDoc: Document | null) => {
|
|
185
|
+
(data: RuntimeTimelineMessage, iframeDoc: Document | null, parentMap: Map<string, string>) => {
|
|
177
186
|
// Show root-level clips: no parentCompositionId, OR parent is a "phantom wrapper"
|
|
178
187
|
const clipCompositionIds = new Set(data.clips.map((c) => c.compositionId).filter(Boolean));
|
|
179
188
|
const filtered = data.clips.filter(
|
|
180
189
|
(clip) => !clip.parentCompositionId || !clipCompositionIds.has(clip.parentCompositionId),
|
|
181
190
|
);
|
|
182
191
|
try {
|
|
183
|
-
const parentMap = clipTreeParentMap(iframeRef.current?.contentWindow ?? null);
|
|
184
192
|
const domClipChildren = collectSubCompositionDomChildren(iframeDoc, data.clips, parentMap);
|
|
185
193
|
usePlayerStore.getState().setClipParentMap(parentMap);
|
|
186
194
|
usePlayerStore.getState().setDomClipChildren(domClipChildren);
|
|
@@ -188,7 +196,7 @@ export function useTimelineSyncCallbacks({
|
|
|
188
196
|
.getState()
|
|
189
197
|
.setSubCompositionHostState(collectSubCompositionHostState(iframeDoc, data.clips));
|
|
190
198
|
} catch {
|
|
191
|
-
//
|
|
199
|
+
// A document the walk cannot read leaves the maps empty.
|
|
192
200
|
}
|
|
193
201
|
|
|
194
202
|
const els = buildTimelineElementsFromClips(filtered, iframeDoc);
|
|
@@ -211,7 +219,7 @@ export function useTimelineSyncCallbacks({
|
|
|
211
219
|
syncTimelineElements,
|
|
212
220
|
);
|
|
213
221
|
},
|
|
214
|
-
[
|
|
222
|
+
[syncTimelineElements],
|
|
215
223
|
);
|
|
216
224
|
|
|
217
225
|
const timelineReads = useRef(0);
|
|
@@ -222,14 +230,16 @@ export function useTimelineSyncCallbacks({
|
|
|
222
230
|
const iframe = iframeRef.current;
|
|
223
231
|
const read = ++timelineReads.current;
|
|
224
232
|
if (!iframe || !previewFrameOpaque(iframe)) {
|
|
225
|
-
applyTimelineMessage(data, safeContentDocument(iframe));
|
|
233
|
+
applyTimelineMessage(data, safeContentDocument(iframe), openClipParents(iframe));
|
|
226
234
|
return;
|
|
227
235
|
}
|
|
228
|
-
// A sealed frame's rows bind to
|
|
229
|
-
void previewDocumentCopy(iframe).then(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
236
|
+
// A sealed frame's rows bind to its document copy and clip tree from the editing port; the newest read wins.
|
|
237
|
+
void Promise.all([previewDocumentCopy(iframe), previewClipParents(iframe)]).then(
|
|
238
|
+
([doc, parents]) => {
|
|
239
|
+
if (read === timelineReads.current && iframeRef.current === iframe)
|
|
240
|
+
applyTimelineMessage(data, doc, parents);
|
|
241
|
+
},
|
|
242
|
+
);
|
|
233
243
|
},
|
|
234
244
|
[iframeRef, applyTimelineMessage],
|
|
235
245
|
);
|
|
@@ -106,6 +106,18 @@ export async function previewClipManifest(iframe: HTMLIFrameElement): Promise<Cl
|
|
|
106
106
|
return manifest as ClipManifest;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
export async function previewClipParents(iframe: HTMLIFrameElement): Promise<Map<string, string>> {
|
|
110
|
+
const snapshot = await previewRequest(iframe, "runtime-snapshot", {});
|
|
111
|
+
const pairs: unknown = snapshot?.clipParents;
|
|
112
|
+
const parents = new Map<string, string>();
|
|
113
|
+
if (!Array.isArray(pairs)) return parents;
|
|
114
|
+
for (const pair of pairs) {
|
|
115
|
+
if (Array.isArray(pair) && typeof pair[0] === "string" && typeof pair[1] === "string")
|
|
116
|
+
parents.set(pair[0], pair[1]);
|
|
117
|
+
}
|
|
118
|
+
return parents;
|
|
119
|
+
}
|
|
120
|
+
|
|
109
121
|
export async function previewConsoleErrors(
|
|
110
122
|
iframe: HTMLIFrameElement,
|
|
111
123
|
from: number,
|
|
@@ -262,6 +262,8 @@ function heldFileMessage(body: string, path: string | undefined): string | null
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
export const withStatus = (words: string, response: Response) => `${words} (${response.status})`;
|
|
266
|
+
|
|
265
267
|
export async function heldFileWordsOf(response: Response, path: string): Promise<string | null> {
|
|
266
268
|
return heldFileMessage(
|
|
267
269
|
await response
|