import { Editor } from '@tiptap/react'; import { FloatingLayoutInvalidationFlag, FloatingCardLayoutInput } from './comment-floating-layout'; import { CommentFloatingCard } from './context/types'; export type AnchorType = 'draft' | 'thread' | 'suggestion-draft'; export interface CachedAnchorRect { top: number; height: number; scrollTop: number; containerTop: number; } export interface AnchorRecord { floatingCardId: string; anchorId: string; anchorType: AnchorType; elements: HTMLElement[]; pmPos: number | null; anchorVersion: number; cachedRect: CachedAnchorRect | null; lastSeenEditorRoot: HTMLElement | null; missingSinceDocVersion: number | null; missingSinceCycle: number | null; } export interface FloatingCardRuntimeState { floatingCardId: string; anchorPosition: number | null; anchorVersion: number; anchorTop: number | null; anchorHeight: number; height: number; isMeasured: boolean; isInViewport: boolean; translateY: number | null; lastCommittedTranslateY: number | null; lastCommittedVisible: boolean; needsTransformSync: boolean; invalidationFlags: FloatingLayoutInvalidationFlag; } export declare const FLOATING_VIEWPORT_BUFFER_MULTIPLIER = 1; export declare const getAnchorIdentity: (floatingCard: CommentFloatingCard) => { anchorId: string; anchorType: "draft"; } | { anchorId: string; anchorType: "suggestion-draft"; } | { anchorId: string; anchorType: "thread"; }; export declare const getAnchorElements: ({ editorRoot, anchorId, anchorType, }: { editorRoot: HTMLElement; anchorId: string; anchorType: AnchorType; }) => HTMLElement[]; export declare const getAnchorStartPos: (editor: Editor, elements: HTMLElement[]) => null; export declare const getEditorRoot: (editor: Editor) => HTMLElement | null; export declare const areAnchorElementsEqual: (previousElements: HTMLElement[], nextElements: HTMLElement[]) => boolean; export declare const isAnchorEntryValid: (entry: AnchorRecord, editorRoot: HTMLElement) => boolean; export declare const getCachedAnchorRect: ({ cachedRect, scrollTop, containerTop, }: { cachedRect: CachedAnchorRect; scrollTop: number; containerTop: number; }) => { top: number; height: number; }; export declare const getRect: ({ elements, viewportTop, viewportBottom, }: { elements: HTMLElement[]; viewportTop: number; viewportBottom: number; }) => { top: number; height: number; intersectsViewport: boolean; } | null; export declare const reconcileOrderedFloatingCardIds: ({ previousOrderedFloatingCardIds, nextFloatingCards, getPos, }: { previousOrderedFloatingCardIds: string[]; nextFloatingCards: CommentFloatingCard[]; getPos: (floatingCardId: string) => number | null; }) => { orderedFloatingCardIds: string[]; firstChangedIndex: number | null; }; export declare const areFloatingCardIdListsEqual: (a: string[], b: string[]) => boolean; export declare const toFloatingCardLayoutInput: (floatingCardState: FloatingCardRuntimeState) => FloatingCardLayoutInput;