mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
* 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>
67 lines
2.0 KiB
TypeScript
67 lines
2.0 KiB
TypeScript
import { elementZIndex } from "@hyperframes/core/runtime/editing-port";
|
|
import { readLayerRevealPriorZ } from "./timelineElementHelpers";
|
|
|
|
export interface StackingContextDescriptor {
|
|
parentCompositionId: string | null;
|
|
compositionAncestors: readonly string[];
|
|
stackingContextId?: string | null;
|
|
}
|
|
|
|
export interface ContextOrderItem extends StackingContextDescriptor {
|
|
zIndex: number;
|
|
}
|
|
|
|
// fallow-ignore-next-line complexity
|
|
export function getElementZIndex(element: HTMLElement): number {
|
|
try {
|
|
// An active Layers-panel reveal lift reports the element's TRUE z.
|
|
const prior = readLayerRevealPriorZ(element);
|
|
if (prior != null) return prior;
|
|
return elementZIndex(element);
|
|
} catch {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
export function resolveStackingContextKey(item: StackingContextDescriptor): string {
|
|
return item.stackingContextId ?? item.parentCompositionId ?? item.compositionAncestors[0] ?? "";
|
|
}
|
|
|
|
function resolveStackingContextDepth(item: StackingContextDescriptor): number {
|
|
const contextKey = resolveStackingContextKey(item);
|
|
if (!contextKey) return 0;
|
|
const index = item.compositionAncestors.indexOf(contextKey);
|
|
return index >= 0 ? index : 0;
|
|
}
|
|
|
|
export function resolveContextOrder<T extends ContextOrderItem>(items: readonly T[]): T[] {
|
|
if (items.length === 0) return [];
|
|
|
|
const groups = new Map<
|
|
string,
|
|
{ firstIndex: number; depth: number; entries: Array<{ item: T; index: number }> }
|
|
>();
|
|
|
|
items.forEach((item, index) => {
|
|
const key = resolveStackingContextKey(item);
|
|
const group = groups.get(key);
|
|
if (group) {
|
|
group.entries.push({ item, index });
|
|
return;
|
|
}
|
|
groups.set(key, {
|
|
firstIndex: index,
|
|
depth: resolveStackingContextDepth(item),
|
|
entries: [{ item, index }],
|
|
});
|
|
});
|
|
|
|
return [...groups.values()]
|
|
.sort((a, b) => a.depth - b.depth || a.firstIndex - b.firstIndex)
|
|
.flatMap((group) =>
|
|
group.entries
|
|
.sort((a, b) => b.item.zIndex - a.item.zIndex || a.index - b.index)
|
|
.map((entry) => entry.item),
|
|
);
|
|
}
|