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 | {
14 type: "open";
15 src?: string;
16 text?: string;
17 truncated?: boolean;
18 sizeBytes?: number;
19 delimiter: "," | "\t" | null;
20 }
21 | { type: "page"; index: number }
22 | { type: "copy" };
23export type TextPreviewResult =
24 | {
25 type: "meta";
26 count: number;
27 columns: number;
28 columnsTruncated: boolean;
29 complete: boolean;
30 sizeBytes?: number;
31 }
32 | { type: "page"; index: number; rows: string[][] }
33 | { type: "copy"; text: string }
34 | ({ type: "error"; operation: TextPreviewRequest["type"] } & PreviewFailure);