import type { OfficeParserPlugin } from '../../core/parsingContracts'; import type { OfficeParseResourcePolicy } from '../../shared/resource/OfficeResourcePolicy'; import type { OfficeDocumentSession } from '../session'; import { type OfficeFormatMetadata, type PreviewKind } from './formatDefinitions'; import type { OfficeFileViewerPreviewHandle, OfficeFileViewerPreviewState } from './internalTypes'; import type { WorkerSourceClient } from './runtime/source/WorkerSourceClient'; import type { RuntimeContext, RuntimeSink } from './runtime/types'; import type { OfficeFormatSessionAdapterFactory } from './sessionAdapters/types'; import type { ParseProgress } from './types'; /** 格式解析器向统一运行时输出增量或完整结果的入口合同。 */ export type OfficeFormatParser = (file: File, context: RuntimeContext, sink: RuntimeSink) => Promise; /** 提前创建按需预览源时可使用的会话与事件接口。 */ export type OfficeSourcePreviewContext = { /** 持有取消信号并统一管理 Reader、Source 等资源的文档会话。 */ documentSession: OfficeDocumentSession; /** 向解析会话发送当前格式的加载进度。 */ emitProgress(progress: ParseProgress): void; /** 向界面发送已经可以展示的按需预览快照。 */ emitPartial(preview: OfficeFileViewerPreviewState): void; /** 当前解析会话采用的可选资源上限。 */ resourcePolicy?: OfficeParseResourcePolicy; /** 大 OOXML 文件需要在 Worker 长期持有 Reader 时使用的可选客户端。 */ workerSourceClient?: WorkerSourceClient; }; /** 在大文件满足按需加载条件时创建预览源,否则交回普通解析流程。 */ export type OfficeSourcePreviewFactory = (file: File, context: OfficeSourcePreviewContext) => Promise; /** 单种格式的稳定能力及其按需加载入口。 */ export type OfficeFormatDefinition = OfficeFormatMetadata & { /** 动态加载当前格式的主线程解析入口。 */ loadParser: () => Promise; /** 动态加载当前格式可选的大文件预览源工厂。 */ loadSourcePreviewFactory?: () => Promise; }; /** 返回目标格式的完整动态能力定义。 */ export declare function getOfficeFormatDefinition(kind: PreviewKind): OfficeFormatDefinition; /** 只加载当前文件格式对应的主线程解析入口。 */ export declare function loadOfficeFormatParser(kind: PreviewKind): Promise; /** 按需加载当前格式的大文件预览源工厂。 */ export declare function loadOfficeSourcePreviewFactory(kind: PreviewKind): Promise; /** 按具体格式所属的预览族加载内部会话组装适配器。 */ export declare function loadOfficeSessionAdapterFactory(kind: PreviewKind): Promise; /** 将内置格式定义转换为 Core 解析插件,解析实现仍延迟到真正调用时加载。 */ export declare function createOfficeBuiltInParserPlugin(kind: PreviewKind): OfficeParserPlugin;