feat(studio): timeline inline expansion + __clipTree runtime primitive

When a child element inside a sub-composition is selected, the timeline
replaces the parent scene clip with the deepest-level siblings. Deselect
or selecting outside collapses back. Expanded clips are fully editable —
move, resize, delete, and split — addressed by their real DOM id with
timeline time rebased onto the sub-comp they live in.

Runtime:
- New window.__clipTree API: a read-only hierarchical ClipNode tree
  (id/parentId/children + backing element) so Studio can derive
  parent/child relationships for inline expansion.

Studio:
- useExpandedTimelineElements derives the expanded view from
  selectedElementId + clipParentMap (pure useMemo, no useEffect).
  Each child rebases onto its immediate sub-comp host (start +
  sourceFile), so multi-level nesting targets the right file.
- NLELayout routes expanded-clip edits through the same handlers
  top-level clips use, in local coordinates — edits save to the
  sub-comp source and reflect via reloadPreview (no separate DOM-patch
  path). This is the canonical update; there is no reactive observer.
- findMatchingTimelineElementId resolves sub-comp children with no
  top-level element to `sourceFile#id`.
- Razor tool enabled by default; studio_razor_split analytics event
  fired on single and split-all.
- O(n²) isElementGsapTargeted extracted to gsapTargetCache.ts with a
  cached Set+WeakSet O(1) lookup.
This commit is contained in:
Miguel Ángel
2026-06-15 22:16:29 -04:00
committed by GitHub
parent 07030294e0
commit 8cbf4384e1
25 changed files with 843 additions and 126 deletions
+16 -1
View File
@@ -7,7 +7,12 @@ vi.mock("./client", () => ({
trackEvent: (...args: unknown[]) => trackEvent(...args),
}));
const { trackStudioSessionStart, trackStudioRenderStart } = await import("./events");
const {
trackStudioSessionStart,
trackStudioRenderStart,
trackStudioRazorSplit,
trackStudioExpandedClipEdit,
} = await import("./events");
describe("studio telemetry events", () => {
beforeEach(() => {
@@ -54,4 +59,14 @@ describe("studio telemetry events", () => {
composition: undefined,
});
});
it("trackStudioRazorSplit emits 'studio_razor_split' with mode and count", () => {
trackStudioRazorSplit({ mode: "all", count: 3 });
expect(trackEvent).toHaveBeenCalledWith("studio_razor_split", { mode: "all", count: 3 });
});
it("trackStudioExpandedClipEdit emits 'studio_expanded_clip_edit' with action", () => {
trackStudioExpandedClipEdit({ action: "resize" });
expect(trackEvent).toHaveBeenCalledWith("studio_expanded_clip_edit", { action: "resize" });
});
});
+15
View File
@@ -48,6 +48,21 @@ function getBrowserDoctorSummary(): string {
}
}
export function trackStudioRazorSplit(props: { mode: "single" | "all"; count: number }): void {
trackEvent("studio_razor_split", {
mode: props.mode,
count: props.count,
});
}
// Adoption signal for the inline timeline-expansion surface: edits applied to a
// sub-composition child clip while its parent scene is expanded.
export function trackStudioExpandedClipEdit(props: {
action: "move" | "resize" | "delete" | "split";
}): void {
trackEvent("studio_expanded_clip_edit", { action: props.action });
}
export function trackStudioFeedback(props: { rating: number; comment?: string }): void {
trackEvent("survey sent", {
$survey_id: "studio_experience",