import { OFFICE_KERNEL_PROTOCOL_VERSION } from './office-kernel-version'; export type { OfficeKernelSpreadsheetCalculatedCell, OfficeKernelSpreadsheetCalculationIssue, OfficeKernelSpreadsheetCalculationRequest, OfficeKernelSpreadsheetCalculationResult, OfficeKernelSpreadsheetCoordinate, OfficeKernelSpreadsheetError, OfficeKernelSpreadsheetInputCell, OfficeKernelSpreadsheetInputSheet, OfficeKernelSpreadsheetInputTable, OfficeKernelSpreadsheetSessionCalculationRequest, OfficeKernelSpreadsheetSessionCalculationResult, OfficeKernelSpreadsheetSessionCalculationScope, OfficeKernelSpreadsheetSessionCalculationStats, OfficeKernelSpreadsheetSessionCellChange, OfficeKernelSpreadsheetSessionUpdate, OfficeKernelSpreadsheetValue, } from './office-kernel-spreadsheet-protocol'; export { OFFICE_KERNEL_PROTOCOL_VERSION }; import type { OfficeKernelSpreadsheetCalculationRequest, OfficeKernelSpreadsheetCalculationResult, OfficeKernelSpreadsheetSessionCalculationRequest, OfficeKernelSpreadsheetSessionCalculationResult } from './office-kernel-spreadsheet-protocol'; export type OfficeKernelEngine = 'wasm' | 'javascript'; export interface OfficeKernelPageMetrics { width: number; height: number; marginTop: number; marginRight: number; marginBottom: number; marginLeft: number; /** Visual header region overlaid inside marginTop; it does not reduce body height. */ headerHeight: number; /** Visual footer region overlaid inside marginBottom; it does not reduce body height. */ footerHeight: number; pageGap: number; } export interface OfficeKernelPageStyle { id: string; page: OfficeKernelPageMetrics; } export interface OfficeKernelLayoutBlock { id: string; height: number; pageStyleId?: string; breakBefore?: boolean; breakAfter?: boolean; keepTogether?: boolean; keepWithNext?: boolean; flowId?: string; flowIndex?: number; flowCount?: number; minimumFragmentsPerPage?: number; repeatHeaderCount?: number; repeatHeaderHeight?: number; } export interface OfficeKernelLayoutRequest { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'layout'; requestId: number; revision: number; documentRevision: number; startPageIndex: number; page: OfficeKernelPageMetrics; pageStyles?: OfficeKernelPageStyle[]; blocks: OfficeKernelLayoutBlock[]; } export interface OfficeKernelLayoutPlacement { blockId: string; y: number; height: number; overflow: boolean; } export interface OfficeKernelLayoutPage { index: number; page: OfficeKernelPageMetrics; usedHeight: number; availableHeight: number; placements: OfficeKernelLayoutPlacement[]; } export interface OfficeKernelLayoutBreak { beforeBlockId: string; pageIndex: number; spacerHeight: number; remainingBodyHeight: number; } export interface OfficeKernelLayoutResult { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'layoutResult'; requestId: number; revision: number; documentRevision: number; startPageIndex: number; engine: OfficeKernelEngine; pages: OfficeKernelLayoutPage[]; breaks: OfficeKernelLayoutBreak[]; } export type OfficeKernelPresentationAlignment = 'bottom' | 'center' | 'left' | 'middle' | 'right' | 'top'; export interface OfficeKernelPresentationGeometryElement { id: string; x: number; y: number; width: number; height: number; } export type OfficeKernelPresentationTransformMode = 'move' | 'resize'; export type OfficeKernelPresentationGeometryOperation = { type: 'alignToSlide'; alignment: OfficeKernelPresentationAlignment; } | { type: 'snapElement'; movingElementId: string; mode: OfficeKernelPresentationTransformMode; thresholdX: number; thresholdY: number; }; export interface OfficeKernelPresentationSnapGuide { axis: 'x' | 'y'; position: number; source: 'element' | 'slide'; targetId?: string; } export interface OfficeKernelPresentationGeometryRequest { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'presentationGeometry'; requestId: number; revision: number; documentRevision: number; operation: OfficeKernelPresentationGeometryOperation; elements: OfficeKernelPresentationGeometryElement[]; } export interface OfficeKernelPresentationGeometryResult { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'presentationGeometryResult'; requestId: number; revision: number; documentRevision: number; engine: OfficeKernelEngine; elements: OfficeKernelPresentationGeometryElement[]; guides: OfficeKernelPresentationSnapGuide[]; } export type OfficeKernelTextDirection = 'auto' | 'ltr' | 'rtl'; export type OfficeKernelTextWhiteSpace = 'breakSpaces' | 'normal'; export type OfficeKernelTextTabAlignment = 'center' | 'decimal' | 'left' | 'right'; export interface OfficeKernelTextTabStop { position: number; alignment: OfficeKernelTextTabAlignment; } export interface OfficeKernelTextTabLayout { origin: number; firstLineIndent: number; defaultInterval: number; stops: OfficeKernelTextTabStop[]; } export interface OfficeKernelTextLayoutRun { startUtf16: number; endUtf16: number; fontId: string; fallbackFontIds?: string[]; fontSize: number; lineHeight: number; language?: string; letterSpacing?: number; ligatures?: boolean; kerning?: boolean; } export interface OfficeKernelTextLayoutParagraph { id: string; text: string; runs: OfficeKernelTextLayoutRun[]; maxWidth: number; firstLineMaxWidth?: number; direction?: OfficeKernelTextDirection; whiteSpace?: OfficeKernelTextWhiteSpace; tabLayout?: OfficeKernelTextTabLayout; } export interface OfficeKernelTextLayoutRequest { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'textLayout'; requestId: number; revision: number; documentRevision: number; paragraphs: OfficeKernelTextLayoutParagraph[]; } export interface OfficeKernelTextLayoutLine { startUtf16: number; endUtf16: number; width: number; ascent: number; descent: number; height: number; hardBreak: boolean; } export interface OfficeKernelTextLayoutParagraphResult { id: string; glyphCount: number; fallbackGlyphCount: number; missingGlyphCount: number; lines: OfficeKernelTextLayoutLine[]; } export interface OfficeKernelTextLayoutResult { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'textLayoutResult'; requestId: number; revision: number; documentRevision: number; engine: OfficeKernelEngine; layouts: OfficeKernelTextLayoutParagraphResult[]; unsupportedParagraphIds: string[]; } export interface OfficeKernelFontSource { id: string; url: string; } export interface OfficeKernelErrorDetail { code: string; message: string; } export interface OfficeKernelErrorResponse { protocol: typeof OFFICE_KERNEL_PROTOCOL_VERSION; kind: 'error'; requestId: number; revision: number; documentRevision: number; engine: OfficeKernelEngine; error: OfficeKernelErrorDetail; } export type OfficeKernelResponse = OfficeKernelLayoutResult | OfficeKernelPresentationGeometryResult | OfficeKernelSpreadsheetCalculationResult | OfficeKernelSpreadsheetSessionCalculationResult | OfficeKernelTextLayoutResult | OfficeKernelErrorResponse; export type OfficeKernelWorkerRequest = { kind: 'initialize'; wasmUrl?: string; fonts?: OfficeKernelFontSource[]; } | { kind: 'layout'; request: OfficeKernelLayoutRequest; } | { kind: 'presentationGeometry'; request: OfficeKernelPresentationGeometryRequest; } | { kind: 'textLayout'; request: OfficeKernelTextLayoutRequest; } | { kind: 'spreadsheetCalculation'; request: OfficeKernelSpreadsheetCalculationRequest; } | { kind: 'spreadsheetSessionCalculation'; request: OfficeKernelSpreadsheetSessionCalculationRequest; } | { kind: 'cancel'; requestId: number; }; export interface OfficeKernelWorkerResponse { kind: 'response'; response: OfficeKernelResponse; } export declare function isOfficeKernelResponse(value: unknown): value is OfficeKernelResponse;