feat(studio): layers panel and marquee read an opaque preview over its channel (#7639)

* feat(studio): layers panel and marquee read an opaque preview over its channel

The runtime answers a new layers request with the Layers walk: each layer's
handle, depth, child count, z-index and kind, by the rules Studio walks a
scriptable frame with, which move to core. On an opaque frame the Layers
panel lists, selects and drills in from it, and the marquee measures its
candidates over the channel and selects from their descriptions. An opaque
selection maps to a timeline clip known only by its clip id, so a marquee's
picks survive the timeline sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(studio): opaque preview hover, layers drill-in, marquee paging and delete path

Review follow-ups for the opaque-preview Layers panel and marquee:

- Delete on an opaque selection runs the DOM delete again. The clip-id match
  that lets a selection find a row known only by its clip id is now opt-in
  (`clipIdScope`), passed only by selection sync and the Layers seek, never by
  delete or group commits, which need a patch target that row lacks. A row
  with no file reads as in the open composition, as the forward lookup does.
- The runtime's `layers` reports a drill-in group it no longer has
  (`missingGroup`) and lists nothing, so the panel leaves the drill-in after a
  reload as the same-origin branch does, rather than list the whole page.
- `layers` takes an `offset`, and the marquee pages through every layer, so
  elements past one reply's 2,048 cap still band-select.
- A Layers refresh that lands while an opaque read is in flight runs once more
  when it settles, instead of being dropped.
- A hover resolved for a pointer move that a leave or newer move superseded is
  dropped.
- `pointer-targets` reads the hit stack once per request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(core): keep the layers paging test inside the Windows runner's timeout

The paging test walked the 2,051-layer page three times with every row
mapped, which ran past 5 s on windows-latest. It now maps only the last
page's rows and has its own 20 s timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
James Russo
2026-11-13 07:48:32 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent ff687fed99
commit be67089a80
31 changed files with 1210 additions and 80 deletions
+27 -4
View File
@@ -133,14 +133,30 @@ export type ElementMatchSelection = Pick<
| "sourceFile"
| "compositionSrc"
| "isCompositionHost"
>;
> &
Partial<Pick<DomEditSelection, "handle">>;
function matchesByClipId(
selection: ElementMatchSelection,
element: TimelineElement,
file: string,
value: string | undefined,
clipIdScope: string | undefined,
) {
if (!clipIdScope || !selection.handle) return false;
if (element.domId || element.hfId || element.selector) return false;
return element.id === value && (element.sourceFile || clipIdScope) === file;
}
function matchesByDomId(
selection: ElementMatchSelection,
element: TimelineElement,
selectionSourceFile: string,
clipIdScope?: string,
): boolean {
if (!selection.id) return false;
if (matchesByClipId(selection, element, selectionSourceFile, selection.id, clipIdScope))
return true;
return (
element.domId === selection.id && (element.sourceFile || "index.html") === selectionSourceFile
);
@@ -150,8 +166,11 @@ function matchesByHfId(
selection: ElementMatchSelection,
element: TimelineElement,
selectionSourceFile: string,
clipIdScope?: string,
): boolean {
if (!selection.hfId) return false;
if (matchesByClipId(selection, element, selectionSourceFile, selection.hfId, clipIdScope))
return true;
return (
element.hfId === selection.hfId && (element.sourceFile || "index.html") === selectionSourceFile
);
@@ -174,9 +193,11 @@ function matchesBySelector(selection: ElementMatchSelection, element: TimelineEl
);
}
/** `clipIdScope` matches opaque picks to clip-id-only rows, which have no patch target: select/seek only. */
export function findMatchingTimelineElementId(
selection: ElementMatchSelection,
elements: TimelineElement[],
clipIdScope?: string,
): string | null {
const selectionSourceFile = selection.sourceFile || "index.html";
// Priority matters, not just "any of the three": a composition-host
@@ -191,7 +212,7 @@ export function findMatchingTimelineElementId(
// first; only fall back to the coarser compositionSrc-only match when
// none of them identifies a specific element.
const byId = selection.id
? elements.find((el) => matchesByDomId(selection, el, selectionSourceFile))
? elements.find((el) => matchesByDomId(selection, el, selectionSourceFile, clipIdScope))
: undefined;
if (byId) return byId.key ?? byId.id;
@@ -199,7 +220,7 @@ export function findMatchingTimelineElementId(
// whether it has a real DOM id — the only correlator for an element like
// an ungroup child that has neither an authored id nor a selector.
const byHfId = selection.hfId
? elements.find((el) => matchesByHfId(selection, el, selectionSourceFile))
? elements.find((el) => matchesByHfId(selection, el, selectionSourceFile, clipIdScope))
: undefined;
if (byHfId) return byHfId.key ?? byHfId.id;
@@ -267,9 +288,11 @@ export function resolveTimelineIdForSelection(
selection: DomEditSelection,
elements: TimelineElement[],
activeCompPath: string | null,
byClipId = false,
): string | null {
const clipIdScope = byClipId ? activeCompPath || "index.html" : undefined;
return (
findMatchingTimelineElementId(selection, elements) ??
findMatchingTimelineElementId(selection, elements, clipIdScope) ??
findTimelineIdByAncestor(
selection.element,
elements,