weasel API - v0.8.0
    Preparing search index...

    Interface ArrayAdapter<TNode, TPose>

    Combined adapter satisfying every narrow adapter the kit ships. Methods with no default implementation (e.g. commitInsert without createDefault) return null/[]/noop — sufficient to typecheck against InsertAdapter/AreaSelectAdapter, and the corresponding gesture hook simply produces no commit.

    interface ArrayAdapter<TNode extends { id: string }, TPose> {
        applyOps?(ops: Op[], label?: string): void;
        commitInsert?(
            bounds: { height: number; width: number; x: number; y: number },
        ): TNode | null;
        commitPaste?(
            clipboard: ClipboardSnapshot,
            offset: { dx: number; dy: number },
            ctx?: { dropPoint?: { worldX: number; worldY: number } },
        ): TNode[];
        findSnapTarget?(
            draggedId: string,
            worldX: number,
            worldY: number,
        ): SnapTarget<TPose> | null;
        getChildren?(id: string): string[];
        getLayout?(containerId: string): LayoutStrategy<TPose> | null;
        getNode(id: string): TNode | undefined;
        getNodes(): TNode[];
        getParent?(id: string): string | null;
        getPasteOffset?(clipboard: ClipboardSnapshot): { dx: number; dy: number };
        getPose(id: string): TPose;
        getSelection(): string[];
        hitTestArea?(
            rect: { height: number; width: number; x: number; y: number },
        ): string[];
        hitTestLasso?(
            polygon: readonly { x: number; y: number }[],
            mode: LassoHitMode,
        ): string[];
        insertNode(node: TNode): void;
        removeNode(id: string): void;
        setParent?(id: string, parentId: string | null): void;
        setPose(id: string, pose: TPose): void;
        setSelection(ids: string[]): void;
        snapshotSelection?(ids: string[]): ClipboardSnapshot;
    }

    Type Parameters

    • TNode extends { id: string }
    • TPose

    Hierarchy (View Summary)

    Index

    Methods

    • Materialize a new node from drag-rect bounds (drag-to-insert tools). Optional — hooks that don't drive insertion (e.g. useClone, read-only clipboard) won't call it, and sceneToAdapter only fills it in when options.commitInsert is supplied. Hooks that do call it (insert tools) document the requirement at their own surface.

      Parameters

      • bounds: { height: number; width: number; x: number; y: number }

      Returns TNode | null

    • Optional: direct children of id. When present (alongside the cascadeWorldPose option on useMove), dragging a node auto-cascades its descendants in the live overlay so structurally- grouped children visually follow the parent during the drag. No additional ops are generated — children's local poses don't change when the parent's local pose moves.

      Parameters

      • id: string

      Returns string[]

    • Optional. Required only by hierarchy-aware paths: layout-pass drop targeting (getLayout present), nested-hit collapse (pickTopMostHit), and group-pose composition. Flat scenes may omit.

      Parameters

      • id: string

      Returns string | null

    • Optional. Used only by reparent ops (e.g. drag-into-container drops via layout strategies). Flat scenes that never reparent may omit.

      Parameters

      • id: string
      • parentId: string | null

      Returns void