import type { Editor } from '@tiptap/core'; import type { Node as ProseMirrorNode } from '@tiptap/pm/model'; import type { OfficeKernelLayoutResult, OfficeKernelPageMetrics } from '../../../kernel/office-kernel-protocol'; import type { WorkDocumentFieldContextResolver } from '../work-document-fields'; import { type WorkDocumentLayoutFont } from '../work-document-fonts'; import { type ResolvedDocumentPageChrome } from '../work-document-page-chrome'; import { type MeasuredDocumentLayoutBlock } from '../work-document-pagination'; import type { WorkDocumentSectionLayout } from '../work-types'; export interface DocumentPaginationResult { layout: OfficeKernelLayoutResult; blocks: MeasuredDocumentLayoutBlock[]; pageByBlockId: ReadonlyMap; pages: DocumentPaginationPageDescriptor[]; } export interface DocumentPaginationPageDescriptor { pageIndex: number; physicalPage: number; pageNumber: number; previewText: string; selectionPosition: number; sectionPage: number; sectionId: string; sectionIndex: number; layout: WorkDocumentSectionLayout; pageChrome: ResolvedDocumentPageChrome; page: OfficeKernelPageMetrics; } export interface DocumentPaginationPageDescriptorDerivation { pages: DocumentPaginationPageDescriptor[]; reusedPageCount: number; derivedPageCount: number; } export interface UseDocumentPaginationOptions { compositionRevision?: number; editor: Editor | null; documentRevision: number; enabled: boolean; isComposing?: () => boolean; layoutKey: string; page: OfficeKernelPageMetrics; selectionVersion: number; wasmUrl?: string; layoutFonts: readonly WorkDocumentLayoutFont[]; loadedLayoutFontIds: ReadonlySet; } export interface UseDocumentPaginationValue { currentPage: number | null; currentPageDescriptor: DocumentPaginationPageDescriptor | null; pageCount: number | null; pages: readonly DocumentPaginationPageDescriptor[]; paginating: boolean; resolveFieldContext: WorkDocumentFieldContextResolver | null; } export declare function useDocumentPagination({ compositionRevision, editor, documentRevision, enabled, isComposing, layoutKey, page, selectionVersion, wasmUrl, layoutFonts, loadedLayoutFontIds, }: UseDocumentPaginationOptions): UseDocumentPaginationValue; export declare function createDocumentFieldPaginationContextResolver(pagination: DocumentPaginationResult): WorkDocumentFieldContextResolver; export declare function documentResizeObservationPositions(blocks: readonly MeasuredDocumentLayoutBlock[]): ReadonlyMap; export declare function documentResizeObservationTargets(editorDom: HTMLElement, blocks: readonly MeasuredDocumentLayoutBlock[]): { observedBlockCount: number; positions: ReadonlyMap; scope: 'blocks' | 'document'; }; export declare function documentPaginationPageDescriptors(layout: OfficeKernelLayoutResult, blocks: readonly MeasuredDocumentLayoutBlock[], documentNode?: ProseMirrorNode): DocumentPaginationPageDescriptor[]; export declare function deriveDocumentPaginationPageDescriptors(layout: OfficeKernelLayoutResult, blocks: readonly MeasuredDocumentLayoutBlock[], documentNode?: ProseMirrorNode, previousPages?: readonly DocumentPaginationPageDescriptor[], requestedReusedPageCount?: number): DocumentPaginationPageDescriptorDerivation; export declare function pageForPosition(pagination: DocumentPaginationResult, position: number): number;