(
parsed: ParsedDocument,
entries: Array<{ target: HfId; zIndex: number }>,
)
| 730 | } |
| 731 | |
| 732 | function 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 |
| 750 | function handleSetCompositionMetadata( |
no test coverage detected