import type { EditorPageItem, EditorSnapshot, ReorderBody } from "../api/types.js"; export type MoveTarget = { type: "root"; } | { type: "category"; categoryId: string; } | { type: "page"; parentPageId: string; }; export interface MovePageInput { pageId: string; target: MoveTarget; position?: number | "first" | "last"; detachChildren?: boolean; } export type ReorderScope = { type: "root"; } | { type: "category"; categoryId: string; } | { type: "page"; parentPageId: string; }; export interface ReorderItemsInput { scope: ReorderScope; itemIds: string[]; } /** Builds a ReorderBody that reflects the current order in the snapshot. */ export declare function snapshotToReorderBody(snap: EditorSnapshot): ReorderBody; /** * Locates a page in the snapshot, looking under categories first and falling back to rootPages. * Returns null when the id is unknown. */ export declare function findPage(snap: EditorSnapshot, pageId: string): EditorPageItem | null; /** * Builds a ReorderBody that moves a single page to a new slot. * * Behavior: * - target=root inserts the page into the root list at the given position. * - target=category inserts the page as a top-level page of that category. * - target=page inserts the page as a sub-page of an existing top-level page. The two-level limit means: * * the target parent must itself be top-level (not a sub-page) * * a page with its own children cannot be moved this way unless detachChildren is set, in which case * its current children are re-parented to the target parent's container (category or root) at the end. */ export declare function movePage(snap: EditorSnapshot, input: MovePageInput): ReorderBody; /** * Builds a ReorderBody that sets the exact order of items inside a single scope. * itemIds must be a permutation of the items currently in that scope. */ export declare function reorderItems(snap: EditorSnapshot, input: ReorderItemsInput): ReorderBody;