/** * Adjusts the relative references in a formula when it is copied or filled from * one cell to another — the behavior that makes `=A1+B1` become `=A2+B2` when * dragged down one row. * * Only **relative** components shift; `$`-anchored (absolute) rows/columns stay * put, exactly like Excel/Sheets. A reference pushed off the top/left edge * (negative index) collapses to a `#REF!` error literal, so the transposed * formula stays well-formed. * * Works on the AST (compile → transpose → serialize), so it reuses the same * parser/serializer as the rest of the engine and never manipulates source text * with fragile regexes. * * @packageDocumentation */ import { AstNode } from './parser/ast.types'; import type { ResolvedFormulaConfig } from './config/formula-config'; /** A copy/fill displacement in grid cells. */ export interface Offset { /** Rows to shift relative references by (positive = downward). */ readonly deltaRow: number; /** Columns to shift relative references by (positive = rightward). */ readonly deltaCol: number; } /** * Returns a new AST with every relative reference shifted by `offset`. * Absolute components are preserved; out-of-bounds shifts become `#REF!`. * * @param node - The AST to transpose. * @param offset - The row/column displacement. * @returns A new, shifted AST (the input is not mutated). */ export declare function transposeAst(node: AstNode, offset: Offset): AstNode; /** * Transposes a formula source string by `offset`, returning new source * (including the leading `=`). If the source fails to compile it is returned * unchanged — a copy should never corrupt an already-broken formula. * * @param source - The original formula source (with `=`). * @param offset - The row/column displacement. * @param config - Resolved engine configuration (for separators). * @returns The transposed source, or the original on compile failure. */ export declare function transposeFormula(source: string, offset: Offset, config: ResolvedFormulaConfig): string; //# sourceMappingURL=formula-transposer.d.ts.map