MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / handleReorderElements

Function handleReorderElements

packages/sdk/src/engine/mutate.ts:732–747  ·  view source on GitHub ↗
(
  parsed: ParsedDocument,
  entries: Array<{ target: HfId; zIndex: number }>,
)

Source from the content-addressed store, hash-verified

730}
731
732function handleReorderElements(
733 parsed: ParsedDocument,
734 entries: Array<{ target: HfId; zIndex: number }>,
735): MutationResult {
736 const result: MutationResult = { forward: [], inverse: [] };
737 // Last write wins per target — a duplicated target collapses to one zIndex
738 // patch instead of emitting redundant same-path patches in one dispatch.
739 const lastByTarget = new Map<HfId, number>();
740 for (const { target, zIndex } of entries) lastByTarget.set(target, zIndex);
741 for (const [target, zIndex] of lastByTarget) {
742 const sub = handleSetStyle(parsed, [target], { zIndex: String(zIndex) });
743 result.forward.push(...sub.forward);
744 result.inverse.push(...sub.inverse);
745 }
746 return result;
747}
748
749// fallow-ignore-next-line complexity
750function handleSetCompositionMetadata(

Callers 1

applyOpFunction · 0.85

Calls 2

handleSetStyleFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected