Open History to see the last commit
1import type { PreviewFailure } from "./previewFailure";
2export const LARGE_TEXT_MAX_BYTES = 256 * 1024 * 1024;
3export const LARGE_TEXT_MAX_ROWS = 5_000_000;
4export const LARGE_TEXT_MAX_COLUMNS = 1024;
5export const PREVIEW_PAGE_ROWS = 32;
6// Browsers stop laying out an element near 33.5M px. Rendered Markdown measured about 22 px per
7// source line, so files taller than this stay in the scaled plain viewer.
8export const RENDERED_MAX_LINES = 1_200_000;
9// Rendered Markdown and highlighted source hold the whole file on the main thread; larger files
10// use the worker-backed plain viewer.
11export const FULL_TEXT_MAX_BYTES = 64 * 1024 * 1024;
12export type TextPreviewRequest =
13 | { type: "open"; src?: string; text?: string; sizeBytes?: number; delimiter: "," | "\t" | null }
14 | { type: "page"; index: number }
15 | { type: "copy" };
16export type TextPreviewResult =
17 | {
18 type: "meta";
19 count: number;
20 columns: number;
21 columnsTruncated: boolean;
22 complete: boolean;
23 sizeBytes?: number;
24 }
25 | { type: "page"; index: number; rows: string[][] }
26 | { type: "copy"; text: string }
27 | ({ type: "error"; operation: TextPreviewRequest["type"] } & PreviewFailure);