/** * Pure document queries over the suggestion marks (no editor, no Velt). */ import type { Mark as PMMark, Node as PMNode } from '@tiptap/pm/model'; import type { FormatOp, SuggestionKind } from './types'; export interface MarkRange { from: number; to: number; /** The wrapper mark instance on this range. */ mark: PMMark; } export interface SuggestionRanges { wrapping: MarkRange[]; deletion: MarkRange[]; insertion: MarkRange[]; } /** One pending (not yet committed) cluster of edits by one author. */ export interface PendingCluster { pendingId: string; userId: string | null; formatOp: FormatOp | null; ranges: SuggestionRanges; } export declare const rangesByTargetId: (doc: PMNode, targetId: string) => SuggestionRanges; export declare const rangesByPendingId: (doc: PMNode, pendingId: string) => SuggestionRanges; /** Adjacent ranges merged (same wrapper instance kept from the first). */ export declare const mergeAdjacent: (ranges: MarkRange[]) => MarkRange[]; export declare const textOf: (doc: PMNode, ranges: MarkRange[]) => string; /** Every pending cluster, optionally only one author's. */ export declare const listPendingClusters: (doc: PMNode, userId?: string | null) => PendingCluster[]; /** Every committed target id in the document. */ export declare const listCommittedTargetIds: (doc: PMNode) => string[]; /** What a cluster proposes. */ export declare const kindOf: (ranges: SuggestionRanges, formatOp: FormatOp | null) => SuggestionKind | null; /** The pending text-edit cluster of `userId` touching `pos` (the character before or after), if any. Format suggestions are never joined. */ export declare const pendingClusterAt: (doc: PMNode, pos: number, userId: string, isFrozen: (pendingId: string) => boolean) => { pendingId: string; timestamp: number; } | null; /** * True when `[from, to)` touches any suggestion (pending or committed); an empty range counts when it * sits strictly inside one. */ export declare const touchesSuggestion: (doc: PMNode, from: number, to: number) => boolean; /** True when `[from, to)` touches text of a pending cluster that is being committed (frozen). */ export declare const overlapsFrozen: (doc: PMNode, from: number, to: number, frozen: ReadonlySet) => boolean; /** True when `[from, to)` touches a committed suggestion. */ export declare const overlapsCommitted: (doc: PMNode, from: number, to: number) => boolean;