import type { Editor } from '@tiptap/core'; import type { Node as ProseMirrorNode } from '@tiptap/pm/model'; export interface DocumentTextStatistics { characterCountWithSpaces: number; characterCountWithoutSpaces: number; paragraphCount: number; wordCount: number; } export declare function documentWordCount(value: string): number; /** * Counts a document once per immutable ProseMirror root. Selection, pagination, * and viewport transactions retain the same root and therefore stay O(1). */ export declare function documentTextStatistics(editor: Pick): DocumentTextStatistics; /** Keeps logical statistics unchanged across equal-size lazy hydration. */ export declare function transferDocumentTextStatistics(previous: ProseMirrorNode, next: ProseMirrorNode): void; /** * Applies text-only subtree deltas to an already cached document total. Large * lazy documents edit one hydrated chunk at a time, so recounting every * placeholder tape would make a local keystroke O(document size). */ export declare function transferChangedDocumentTextStatistics(previous: ProseMirrorNode, next: ProseMirrorNode, changes: readonly { after: ProseMirrorNode; before: ProseMirrorNode; }[]): boolean;