Open History to see the last commit
1import type { OfficePreviewKind } from "@t3tools/shared/filePreview";
2
3export const OFFICE_PREVIEW_MAX_BYTES = 50 * 1024 * 1024;
4export const OFFICE_PREVIEW_MAX_ROWS = 250_000;
5export const OFFICE_PREVIEW_MAX_COLUMNS = 1024;
6
7export type OfficeWorkerRequest =
8 | { readonly type: "open"; readonly kind: OfficePreviewKind; readonly bytes: ArrayBuffer }
9 | { readonly type: "sheet-page"; readonly sheet: number; readonly index: number };
10
11export type NotebookCell = {
12 readonly kind: "markdown" | "code" | "raw";
13 readonly source: string;
14 readonly outputs: { readonly kind: "text" | "image" | "html"; readonly text: string }[];
15};
16
17export type OfficeWorkerResult =
18 | {
19 readonly type: "document";
20 readonly navigation: "page" | "slide" | "chapter";
21 readonly pages: { title: string; html: string }[];
22 }
23 | { readonly type: "notebook"; readonly language: string; readonly cells: NotebookCell[] }
24 | { readonly type: "error"; readonly message: string }
25 | {
26 readonly type: "docx" | "xlsx" | "pptx";
27 readonly bytes: ArrayBuffer;
28 readonly truncated: boolean;
29 }
30 | {
31 readonly type: "ods";
32 readonly sheets: {
33 name: string;
34 rows: string[][];
35 truncated: boolean;
36 rowCount: number;
37 columns: number;
38 }[];
39 }
40 | {
41 readonly type: "sheet-page";
42 readonly sheet: number;
43 readonly index: number;
44 readonly rows: string[][];
45 };