import { Editor } from '../../core/Editor.js'; import { MatchContext, NodeAddress, Query, TextAddress, UnknownNodeDiagnostic } from '@superdoc/document-api'; import { BlockCandidate, BlockIndex } from '../helpers/node-address-resolver.js'; /** * Builds a snippet context for a text match, including surrounding text and highlight offsets. * * @param editor - The editor instance. * @param address - The address of the block containing the match. * @param matchFrom - Absolute document position of the match start. * @param matchTo - Absolute document position of the match end. * @param textRanges - Optional block-relative text ranges for the match. * @returns A {@link MatchContext} with snippet, highlight range, and text ranges. */ export declare function buildTextContext(editor: Editor, address: NodeAddress, matchFrom: number, matchTo: number, textRanges?: TextAddress[]): MatchContext; /** * Converts an absolute document range to a block-relative {@link TextAddress}. * * @param editor - The editor instance. * @param block - The block candidate containing the range. * @param range - Absolute document positions. * @returns A text address, or `undefined` if the range falls outside the block. */ export declare function toTextAddress(editor: Editor, block: BlockCandidate, range: { from: number; to: number; }): TextAddress | undefined; /** * Returns `true` if the selector targets a node type that exists as both block and inline * and no explicit `kind` is specified, requiring a dual-kind query. * * @param select - The query selector. */ export declare function shouldQueryBothKinds(select: Query['select']): boolean; /** * Sorts node addresses by their absolute document position (ascending). * Block addresses are ordered before inline addresses at the same position. * * @param editor - The editor instance. * @param index - Pre-built block index for position lookup. * @param addresses - The addresses to sort. * @returns A new sorted array. */ export declare function sortAddressesByPosition(editor: Editor, index: BlockIndex, addresses: NodeAddress[]): NodeAddress[]; /** * Walks the document and pushes diagnostics for block/inline nodes that are * not part of the stable Document API match set. * * @param editor - The editor instance. * @param index - Pre-built block index (used to resolve containing blocks for inline nodes). * @param diagnostics - Mutable array to push diagnostics into. */ export declare function collectUnknownNodeDiagnostics(editor: Editor, index: BlockIndex, diagnostics: UnknownNodeDiagnostic[]): void; /** * Returns `true` if the selector exclusively targets inline nodes. * * @param select - The query selector. */ export declare function isInlineQuery(select: Query['select']): boolean; //# sourceMappingURL=common.d.ts.map