import { FlowBlock, Line, ParagraphBlock, ParagraphMeasure } from './index.js'; /** * Represents a ProseMirror position range for a line or fragment. */ export type LinePmRange = { pmStart?: number; pmEnd?: number; }; /** * Computes the ProseMirror position range covered by a single line. * * Iterates through the runs that comprise the line (from line.fromRun to line.toRun), * extracting PM positions and handling both text runs and atomic runs (images, breaks, etc.). * For text runs, accounts for partial line slices using fromChar and toChar offsets. * * @param block - The flow block containing the line (must be a paragraph block) * @param line - The line to compute the PM range for * @returns Object with pmStart and pmEnd properties, or empty object if block is not a paragraph * * @remarks * - Returns empty object {} if block.kind !== 'paragraph' * - Atomic runs are treated as single-position elements (pmEnd defaults to pmStart + 1) * - For text runs, uses character offsets to compute precise PM boundaries * - Handles first/last run slicing based on line.fromChar and line.toChar */ export declare function computeLinePmRange(block: FlowBlock, line: Line): LinePmRange; /** * Computes the ProseMirror position range covered by a fragment (a range of lines). * * Iterates through lines from fromLine to toLine (exclusive), computing the PM range * for each line and merging them into a single continuous range. * * @param block - The paragraph block containing the lines * @param lines - Array of lines from the paragraph measure * @param fromLine - Starting line index (inclusive) * @param toLine - Ending line index (exclusive) * @returns Object with pmStart and pmEnd properties representing the entire fragment range * * @remarks * - The fragment spans lines [fromLine, toLine) (toLine is exclusive) * - pmStart is taken from the first line with a valid pmStart * - pmEnd is continuously updated to the last valid pmEnd encountered * - Returns empty pmStart/pmEnd if no lines have valid PM ranges */ export declare function computeFragmentPmRange(block: ParagraphBlock, lines: ParagraphMeasure['lines'], fromLine: number, toLine: number): LinePmRange; //# sourceMappingURL=pm-range.d.ts.map