tabulark 0.0.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/README.md +316 -128
- package/THIRD_PARTY_NOTICES.md +37 -0
- package/dist/adapters.d.ts +62 -0
- package/dist/arrow.d.ts +3 -0
- package/dist/arrow.js +2 -0
- package/dist/arrow.js.map +7 -0
- package/dist/client.d.ts +145 -0
- package/dist/errors.d.ts +25 -0
- package/dist/excel.d.ts +3 -0
- package/dist/excel.js +2 -0
- package/dist/excel.js.map +7 -0
- package/dist/experimental.d.ts +13 -0
- package/dist/experimental.js +2 -0
- package/dist/experimental.js.map +7 -0
- package/dist/http.d.ts +65 -0
- package/dist/http.js +2 -0
- package/dist/http.js.map +7 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +7 -0
- package/dist/model.d.ts +392 -0
- package/dist/official-adapter-manifest.d.ts +31 -0
- package/dist/parquet.d.ts +3 -0
- package/dist/parquet.js +2 -0
- package/dist/parquet.js.map +7 -0
- package/dist/protocol.d.ts +54 -0
- package/dist/range-cache.d.ts +47 -0
- package/dist/range-source.d.ts +64 -0
- package/dist/rpc-client.d.ts +31 -0
- package/dist/source.d.ts +13 -0
- package/dist/view/accessible-grid.d.ts +36 -0
- package/dist/view/canvas-painter.d.ts +91 -0
- package/dist/view/canvas-table-view-public.d.ts +64 -0
- package/dist/view/canvas-table-view.d.ts +40 -0
- package/dist/view/controller.d.ts +34 -0
- package/dist/view/layout.d.ts +34 -0
- package/dist/view/selection.d.ts +7 -0
- package/dist/view/types.d.ts +184 -0
- package/dist/wasm/arrow/tabulark_arrow.d.ts +153 -0
- package/dist/wasm/arrow/tabulark_arrow.js +883 -0
- package/dist/wasm/arrow/tabulark_arrow_bg.wasm +0 -0
- package/dist/wasm/arrow/tabulark_arrow_bg.wasm.d.ts +30 -0
- package/dist/wasm/delimited/tabulark_delimited.d.ts +157 -0
- package/dist/wasm/delimited/tabulark_delimited.js +952 -0
- package/dist/wasm/delimited/tabulark_delimited_bg.wasm +0 -0
- package/dist/wasm/delimited/tabulark_delimited_bg.wasm.d.ts +31 -0
- package/dist/wasm/excel/tabulark_excel.d.ts +146 -0
- package/dist/wasm/excel/tabulark_excel.js +876 -0
- package/dist/wasm/excel/tabulark_excel_bg.wasm +0 -0
- package/dist/wasm/excel/tabulark_excel_bg.wasm.d.ts +30 -0
- package/dist/wasm/parquet/tabulark_parquet.d.ts +146 -0
- package/dist/wasm/parquet/tabulark_parquet.js +872 -0
- package/dist/wasm/parquet/tabulark_parquet_bg.wasm +0 -0
- package/dist/wasm/parquet/tabulark_parquet_bg.wasm.d.ts +30 -0
- package/dist/worker/blob-source-accessor.d.ts +10 -0
- package/dist/worker/source-accessor.d.ts +76 -0
- package/dist/worker/wasm-adapter.d.ts +58 -0
- package/dist/worker/worker-errors.d.ts +9 -0
- package/dist/worker-range-source.d.ts +1 -0
- package/dist/worker-range-source.js +2 -0
- package/dist/worker-range-source.js.map +7 -0
- package/dist/worker.d.ts +1 -0
- package/dist/worker.js +2 -0
- package/dist/worker.js.map +7 -0
- package/package.json +62 -12
- package/js/index.d.ts +0 -18
- package/js/index.js +0 -26
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface AccessibleGridColumn {
|
|
2
|
+
readonly index: number;
|
|
3
|
+
readonly name: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AccessibleGridCell {
|
|
6
|
+
readonly rowIndex: number;
|
|
7
|
+
readonly columnIndex: number;
|
|
8
|
+
readonly value: string | null | undefined;
|
|
9
|
+
readonly selected: boolean;
|
|
10
|
+
readonly active: boolean;
|
|
11
|
+
readonly rowSpan?: number;
|
|
12
|
+
readonly columnSpan?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface AccessibleGridRow {
|
|
15
|
+
readonly index: number;
|
|
16
|
+
readonly cells: readonly AccessibleGridCell[];
|
|
17
|
+
}
|
|
18
|
+
export interface AccessibleGridSnapshot {
|
|
19
|
+
readonly label: string;
|
|
20
|
+
readonly exactRowCount?: number;
|
|
21
|
+
readonly columnCount: number;
|
|
22
|
+
readonly columns: readonly AccessibleGridColumn[];
|
|
23
|
+
readonly rows: readonly AccessibleGridRow[];
|
|
24
|
+
readonly busy: boolean;
|
|
25
|
+
readonly status?: string;
|
|
26
|
+
}
|
|
27
|
+
/** A viewport-bounded semantic counterpart to the visual Canvas table. */
|
|
28
|
+
export declare class AccessibleViewportGrid {
|
|
29
|
+
#private;
|
|
30
|
+
readonly element: HTMLDivElement;
|
|
31
|
+
readonly statusElement: HTMLDivElement;
|
|
32
|
+
constructor(ownerDocument: Document, label?: string);
|
|
33
|
+
update(snapshot: AccessibleGridSnapshot): void;
|
|
34
|
+
focus(options?: FocusOptions): void;
|
|
35
|
+
destroy(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { MergedCellRegion, PresentationStyle } from "../model.js";
|
|
2
|
+
export interface CanvasPaintColumn {
|
|
3
|
+
readonly index: number;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
/** Viewport-relative x coordinate, including the pinned row gutter offset. */
|
|
6
|
+
readonly x: number;
|
|
7
|
+
readonly width: number;
|
|
8
|
+
readonly frozen?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface CanvasPaintCell {
|
|
11
|
+
readonly columnIndex: number;
|
|
12
|
+
readonly value: string | null | undefined;
|
|
13
|
+
readonly style?: PresentationStyle;
|
|
14
|
+
/** The cell is painted by its merge anchor rather than its own grid slot. */
|
|
15
|
+
readonly coveredByMerge?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface CanvasPaintRow {
|
|
18
|
+
readonly index: number;
|
|
19
|
+
/** Viewport-relative y coordinate, including the pinned header offset. */
|
|
20
|
+
readonly y: number;
|
|
21
|
+
readonly height: number;
|
|
22
|
+
readonly frozen?: boolean;
|
|
23
|
+
readonly cells: readonly CanvasPaintCell[];
|
|
24
|
+
}
|
|
25
|
+
export interface CanvasPaintMergedCell {
|
|
26
|
+
readonly region: Readonly<MergedCellRegion>;
|
|
27
|
+
readonly x: number;
|
|
28
|
+
readonly y: number;
|
|
29
|
+
readonly width: number;
|
|
30
|
+
readonly height: number;
|
|
31
|
+
readonly value: string | null | undefined;
|
|
32
|
+
readonly style?: PresentationStyle;
|
|
33
|
+
/** A pane-clipped continuation; only the anchor fragment paints the value. */
|
|
34
|
+
readonly continuation?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface CanvasPaintSelection {
|
|
37
|
+
readonly rowStart: number;
|
|
38
|
+
/** Exclusive table row bound. */
|
|
39
|
+
readonly rowEnd: number;
|
|
40
|
+
readonly columnStart: number;
|
|
41
|
+
/** Exclusive table column bound. */
|
|
42
|
+
readonly columnEnd: number;
|
|
43
|
+
}
|
|
44
|
+
export interface CanvasPaintActiveCell {
|
|
45
|
+
readonly rowIndex: number;
|
|
46
|
+
readonly columnIndex: number;
|
|
47
|
+
}
|
|
48
|
+
export interface CanvasPaintSnapshot {
|
|
49
|
+
readonly width: number;
|
|
50
|
+
readonly height: number;
|
|
51
|
+
readonly headerHeight: number;
|
|
52
|
+
readonly rowGutterWidth: number;
|
|
53
|
+
readonly columns: readonly CanvasPaintColumn[];
|
|
54
|
+
readonly rows: readonly CanvasPaintRow[];
|
|
55
|
+
readonly mergedCells?: readonly CanvasPaintMergedCell[];
|
|
56
|
+
readonly selection?: CanvasPaintSelection;
|
|
57
|
+
readonly activeCell?: CanvasPaintActiveCell;
|
|
58
|
+
readonly busy: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface CanvasTableTheme {
|
|
61
|
+
readonly background: string;
|
|
62
|
+
readonly foreground: string;
|
|
63
|
+
readonly mutedForeground: string;
|
|
64
|
+
readonly headerBackground: string;
|
|
65
|
+
readonly headerForeground: string;
|
|
66
|
+
readonly alternateRowBackground: string;
|
|
67
|
+
readonly gridLine: string;
|
|
68
|
+
readonly selectionBackground: string;
|
|
69
|
+
readonly selectionBorder: string;
|
|
70
|
+
readonly activeCellBorder: string;
|
|
71
|
+
readonly loadingBackground: string;
|
|
72
|
+
readonly font: string;
|
|
73
|
+
readonly headerFont: string;
|
|
74
|
+
}
|
|
75
|
+
export declare const DEFAULT_CANVAS_TABLE_THEME: Readonly<CanvasTableTheme>;
|
|
76
|
+
/** Resolves author-independent system colors for Windows High Contrast and other forced palettes. */
|
|
77
|
+
export declare function forcedColorsCanvasTableTheme(base?: Readonly<CanvasTableTheme>): Readonly<CanvasTableTheme>;
|
|
78
|
+
/** Paints one viewport frame and keeps the backing store device-pixel aware. */
|
|
79
|
+
export declare class CanvasTablePainter {
|
|
80
|
+
#private;
|
|
81
|
+
readonly canvas: HTMLCanvasElement;
|
|
82
|
+
constructor(canvas: HTMLCanvasElement, options?: {
|
|
83
|
+
readonly theme?: Partial<CanvasTableTheme>;
|
|
84
|
+
readonly maxDevicePixelRatio?: number;
|
|
85
|
+
readonly forcedColors?: boolean;
|
|
86
|
+
});
|
|
87
|
+
setTheme(theme: Readonly<CanvasTableTheme>, options?: {
|
|
88
|
+
readonly forcedColors?: boolean;
|
|
89
|
+
}): void;
|
|
90
|
+
paint(snapshot: CanvasPaintSnapshot): void;
|
|
91
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { TableHandle } from "../client.js";
|
|
2
|
+
/** Stable, high-level sizing and cache controls for the Canvas table view. */
|
|
3
|
+
export interface CanvasTableViewControllerOptions {
|
|
4
|
+
readonly rowHeight?: number;
|
|
5
|
+
readonly headerHeight?: number;
|
|
6
|
+
readonly rowHeaderWidth?: number;
|
|
7
|
+
readonly columnWidth?: number;
|
|
8
|
+
readonly minColumnWidth?: number;
|
|
9
|
+
readonly maxColumnWidth?: number;
|
|
10
|
+
readonly columnWidths?: Readonly<Record<string, number>>;
|
|
11
|
+
readonly scrollPixelLimit?: number;
|
|
12
|
+
readonly overscanRows?: number;
|
|
13
|
+
readonly overscanColumns?: number;
|
|
14
|
+
/** Hard bound for decoded render/cache cells. */
|
|
15
|
+
readonly maxWindowCells?: number;
|
|
16
|
+
}
|
|
17
|
+
/** Stable theme tokens accepted by the high-level Canvas table view. */
|
|
18
|
+
export interface CanvasTableViewTheme {
|
|
19
|
+
readonly background: string;
|
|
20
|
+
readonly foreground: string;
|
|
21
|
+
readonly mutedForeground: string;
|
|
22
|
+
readonly headerBackground: string;
|
|
23
|
+
readonly headerForeground: string;
|
|
24
|
+
readonly alternateRowBackground: string;
|
|
25
|
+
readonly gridLine: string;
|
|
26
|
+
readonly selectionBackground: string;
|
|
27
|
+
readonly selectionBorder: string;
|
|
28
|
+
readonly activeCellBorder: string;
|
|
29
|
+
readonly loadingBackground: string;
|
|
30
|
+
readonly font: string;
|
|
31
|
+
readonly headerFont: string;
|
|
32
|
+
}
|
|
33
|
+
/** Stable options for mounting a Canvas preview from a logical table handle. */
|
|
34
|
+
export interface CanvasTableViewOptions {
|
|
35
|
+
readonly container: HTMLElement;
|
|
36
|
+
readonly table: TableHandle;
|
|
37
|
+
readonly controllerOptions?: CanvasTableViewControllerOptions;
|
|
38
|
+
/**
|
|
39
|
+
* Selects the table palette. `light` is the compatibility default;
|
|
40
|
+
* `auto` follows the browser's `prefers-color-scheme` media query.
|
|
41
|
+
* Forced-colors mode always takes precedence over this setting.
|
|
42
|
+
*/
|
|
43
|
+
readonly colorScheme?: "auto" | "light" | "dark";
|
|
44
|
+
/**
|
|
45
|
+
* Applies static spreadsheet presentation metadata when available.
|
|
46
|
+
* Workbook colors never override the system palette in forced-colors mode.
|
|
47
|
+
*/
|
|
48
|
+
readonly presentation?: "auto" | "ignore";
|
|
49
|
+
readonly ariaLabel?: string;
|
|
50
|
+
readonly theme?: Partial<CanvasTableViewTheme>;
|
|
51
|
+
readonly maxDevicePixelRatio?: number;
|
|
52
|
+
/** Testable clipboard seam; navigator.clipboard.writeText is used by default. */
|
|
53
|
+
readonly writeClipboard?: (text: string) => Promise<void> | void;
|
|
54
|
+
readonly onError?: (error: unknown) => void;
|
|
55
|
+
}
|
|
56
|
+
/** Stable lifecycle surface for a mounted Canvas table view. */
|
|
57
|
+
export interface CanvasTableView {
|
|
58
|
+
readonly element: HTMLDivElement;
|
|
59
|
+
focus(options?: FocusOptions): void;
|
|
60
|
+
destroy(): void;
|
|
61
|
+
dispose(): void;
|
|
62
|
+
}
|
|
63
|
+
/** Mounts an accessible, viewport-driven Canvas preview. */
|
|
64
|
+
export declare function createCanvasTableView(options: CanvasTableViewOptions): CanvasTableView;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { TableHandle } from "../client.js";
|
|
2
|
+
import { type CanvasTableTheme } from "./canvas-painter.js";
|
|
3
|
+
import { type TableViewController } from "./controller.js";
|
|
4
|
+
import type { TableControllerOptions } from "./types.js";
|
|
5
|
+
type CanvasColorScheme = "auto" | "light" | "dark";
|
|
6
|
+
export interface CanvasTableViewOptions {
|
|
7
|
+
readonly container: HTMLElement;
|
|
8
|
+
/** Provide either a table or a preconfigured controller, never both. */
|
|
9
|
+
readonly table?: TableHandle;
|
|
10
|
+
/** Provide either a controller or a table, never both. */
|
|
11
|
+
readonly controller?: TableViewController;
|
|
12
|
+
readonly controllerOptions?: TableControllerOptions;
|
|
13
|
+
/**
|
|
14
|
+
* Selects the table palette. `light` is the compatibility default;
|
|
15
|
+
* `auto` follows the browser's `prefers-color-scheme` media query.
|
|
16
|
+
* Forced-colors mode always takes precedence over this setting.
|
|
17
|
+
*/
|
|
18
|
+
readonly colorScheme?: CanvasColorScheme;
|
|
19
|
+
/**
|
|
20
|
+
* Applies static spreadsheet sizing metadata when a TableHandle provides it.
|
|
21
|
+
* Workbook colors never override the system palette in forced-colors mode.
|
|
22
|
+
*/
|
|
23
|
+
readonly presentation?: "auto" | "ignore";
|
|
24
|
+
readonly ariaLabel?: string;
|
|
25
|
+
readonly theme?: Partial<CanvasTableTheme>;
|
|
26
|
+
readonly maxDevicePixelRatio?: number;
|
|
27
|
+
/** Testable clipboard seam; navigator.clipboard.writeText is used by default. */
|
|
28
|
+
readonly writeClipboard?: (text: string) => Promise<void> | void;
|
|
29
|
+
readonly onError?: (error: unknown) => void;
|
|
30
|
+
}
|
|
31
|
+
export interface CanvasTableView {
|
|
32
|
+
readonly element: HTMLDivElement;
|
|
33
|
+
readonly controller: TableViewController;
|
|
34
|
+
focus(options?: FocusOptions): void;
|
|
35
|
+
destroy(): void;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
}
|
|
38
|
+
/** Mounts an accessible, viewport-driven Canvas preview. */
|
|
39
|
+
export declare function createCanvasTableView(options: CanvasTableViewOptions): CanvasTableView;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TableHandle, Unsubscribe } from "../client.js";
|
|
2
|
+
import { type MergedCellRegion, type SpreadsheetPresentation } from "../model.js";
|
|
3
|
+
import { type CellLoadState, type CellPosition, type HitTestResult, type MoveActiveCellOptions, type NavigationCommand, type PixelRect, type SetActiveCellOptions, type TableControllerOptions, type TableSelection, type TableViewSnapshot, type ViewportUpdate } from "./types.js";
|
|
4
|
+
export interface TableViewController {
|
|
5
|
+
readonly metadata: TableHandle["metadata"];
|
|
6
|
+
readonly columnWidths: readonly number[];
|
|
7
|
+
readonly minColumnWidth: number;
|
|
8
|
+
readonly maxColumnWidth: number;
|
|
9
|
+
getSnapshot(): Readonly<TableViewSnapshot>;
|
|
10
|
+
subscribe(listener: (snapshot: Readonly<TableViewSnapshot>) => void): Unsubscribe;
|
|
11
|
+
updateViewport(viewport: ViewportUpdate): void;
|
|
12
|
+
setActiveCell(cell: CellPosition, options?: SetActiveCellOptions): void;
|
|
13
|
+
extendSelection(cell: CellPosition, options?: Omit<SetActiveCellOptions, "extendSelection">): void;
|
|
14
|
+
setSelection(anchor: CellPosition, focus?: CellPosition): void;
|
|
15
|
+
clearSelection(): void;
|
|
16
|
+
moveActive(command: NavigationCommand, options?: MoveActiveCellOptions): void;
|
|
17
|
+
ensureCellVisible(cell: CellPosition): void;
|
|
18
|
+
ensureColumnVisible(columnIndex: number): void;
|
|
19
|
+
resizeColumn(columnIndex: number, width: number): void;
|
|
20
|
+
autosizeColumn(columnIndex: number, measuredWidth: number): void;
|
|
21
|
+
/** Applies validated static worksheet geometry in one controller generation. */
|
|
22
|
+
applySpreadsheetPresentation(presentation: SpreadsheetPresentation): void;
|
|
23
|
+
/** Updates merge interaction geometry for the currently loaded presentation window. */
|
|
24
|
+
setMergedCells(regions: readonly MergedCellRegion[]): void;
|
|
25
|
+
hitTest(x: number, y: number, resizeHandleWidth?: number): HitTestResult;
|
|
26
|
+
cellRect(cell: CellPosition): Readonly<PixelRect>;
|
|
27
|
+
selectionRect(selection?: TableSelection | null): Readonly<PixelRect> | null;
|
|
28
|
+
getCell(rowIndex: number, columnIndex: number): CellLoadState;
|
|
29
|
+
copySelection(options?: {
|
|
30
|
+
readonly signal?: AbortSignal;
|
|
31
|
+
}): Promise<string>;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare function createTableController(table: TableHandle, options?: TableControllerOptions): TableViewController;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PresentationAxisEntry, TableMetadata } from "../model.js";
|
|
2
|
+
import { type GridRange, type HitTestResult, type PixelRect, type ScrollAxisLayout, type SparseAxisGeometry, type TableLayout, type ViewportUpdate } from "./types.js";
|
|
3
|
+
export interface LayoutOptions {
|
|
4
|
+
readonly rowHeight?: number;
|
|
5
|
+
readonly headerHeight?: number;
|
|
6
|
+
readonly rowHeaderWidth?: number;
|
|
7
|
+
readonly scrollPixelLimit?: number;
|
|
8
|
+
readonly overscanRows?: number;
|
|
9
|
+
readonly overscanColumns?: number;
|
|
10
|
+
readonly rowEntries?: readonly PresentationAxisEntry[];
|
|
11
|
+
readonly hiddenColumns?: readonly boolean[];
|
|
12
|
+
readonly frozenRows?: number;
|
|
13
|
+
readonly frozenColumns?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function createTableLayout(metadata: Readonly<TableMetadata>, columnWidths: readonly number[], viewport: ViewportUpdate, options?: LayoutOptions): Readonly<TableLayout>;
|
|
16
|
+
export declare function createScrollAxis(logicalContentSize: number, logicalViewportSize: number, physicalOffset: number, pixelLimit?: number): Readonly<ScrollAxisLayout>;
|
|
17
|
+
export declare function logicalToPhysicalOffset(axis: ScrollAxisLayout, logicalOffset: number): number;
|
|
18
|
+
export declare function physicalToLogicalOffset(axis: ScrollAxisLayout, physicalOffset: number): number;
|
|
19
|
+
export declare function hitTest(layout: TableLayout, x: number, y: number, _columnWidths: readonly number[], resizeHandleWidth?: number): HitTestResult;
|
|
20
|
+
export declare function cellRect(layout: TableLayout, _columnWidths: readonly number[], rowIndex: number, columnIndex: number): Readonly<PixelRect>;
|
|
21
|
+
export declare function columnHeaderRect(layout: TableLayout, _columnWidths: readonly number[], columnIndex: number): Readonly<PixelRect>;
|
|
22
|
+
export declare function rowHeaderRect(layout: TableLayout, rowIndex: number): Readonly<PixelRect>;
|
|
23
|
+
export declare function selectionRect(layout: TableLayout, _columnWidths: readonly number[], range: GridRange): Readonly<PixelRect> | null;
|
|
24
|
+
export declare function columnOffsets(columnWidths: readonly number[]): readonly number[];
|
|
25
|
+
export declare function extentValue(extent: TableMetadata["extent"]["rows"]): number;
|
|
26
|
+
/** Builds a compact sparse axis without allocating one entry per worksheet row. */
|
|
27
|
+
export declare function createSparseAxisGeometry(count: number, defaultSize: number, entries?: readonly PresentationAxisEntry[]): Readonly<SparseAxisGeometry>;
|
|
28
|
+
/** Logical offset at the start of an axis index. */
|
|
29
|
+
export declare function axisPosition(geometry: SparseAxisGeometry, index: number): number;
|
|
30
|
+
/** Effective axis extent, zero when a row/column is hidden. */
|
|
31
|
+
export declare function axisSize(geometry: SparseAxisGeometry, index: number): number;
|
|
32
|
+
/** Finds the visible axis index containing a logical pixel offset. */
|
|
33
|
+
export declare function axisIndexAtOffset(geometry: SparseAxisGeometry, offset: number): number | null;
|
|
34
|
+
export declare function nextVisibleAxisIndex(geometry: SparseAxisGeometry, from: number, direction?: -1 | 1): number | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CellPosition, GridRange, NavigationCommand, TableSelection } from "./types.js";
|
|
2
|
+
export declare function createSelection(anchor: CellPosition, focus?: CellPosition): Readonly<TableSelection>;
|
|
3
|
+
export declare function selectionRange(anchor: CellPosition, focus: CellPosition): Readonly<GridRange>;
|
|
4
|
+
export declare function containsCell(range: GridRange, cell: CellPosition): boolean;
|
|
5
|
+
export declare function clampCell(cell: CellPosition, rowCount: number, columnCount: number): Readonly<CellPosition> | null;
|
|
6
|
+
export declare function moveCell(cell: CellPosition, command: NavigationCommand, rowCount: number, columnCount: number, pageRowCount: number): Readonly<CellPosition> | null;
|
|
7
|
+
export declare function assertCellPosition(value: CellPosition, name: string): void;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { TableMetadata } from "../model.js";
|
|
2
|
+
export declare const DEFAULT_ROW_HEIGHT = 28;
|
|
3
|
+
export declare const DEFAULT_HEADER_HEIGHT = 36;
|
|
4
|
+
export declare const DEFAULT_ROW_HEADER_WIDTH = 64;
|
|
5
|
+
export declare const DEFAULT_COLUMN_WIDTH = 160;
|
|
6
|
+
export declare const DEFAULT_MIN_COLUMN_WIDTH = 64;
|
|
7
|
+
export declare const DEFAULT_MAX_COLUMN_WIDTH = 640;
|
|
8
|
+
export declare const DEFAULT_SCROLL_PIXEL_LIMIT = 16000000;
|
|
9
|
+
export declare const DEFAULT_OVERSCAN_ROWS = 8;
|
|
10
|
+
export declare const DEFAULT_OVERSCAN_COLUMNS = 1;
|
|
11
|
+
/** A zero-based table coordinate. */
|
|
12
|
+
export interface CellPosition {
|
|
13
|
+
readonly rowIndex: number;
|
|
14
|
+
readonly columnIndex: number;
|
|
15
|
+
}
|
|
16
|
+
/** A zero-based, half-open rectangular table range. */
|
|
17
|
+
export interface GridRange {
|
|
18
|
+
readonly rowStart: number;
|
|
19
|
+
readonly rowEnd: number;
|
|
20
|
+
readonly columnStart: number;
|
|
21
|
+
readonly columnEnd: number;
|
|
22
|
+
}
|
|
23
|
+
export interface TableSelection {
|
|
24
|
+
readonly anchor: Readonly<CellPosition>;
|
|
25
|
+
readonly focus: Readonly<CellPosition>;
|
|
26
|
+
readonly range: Readonly<GridRange>;
|
|
27
|
+
}
|
|
28
|
+
export interface PixelRect {
|
|
29
|
+
readonly x: number;
|
|
30
|
+
readonly y: number;
|
|
31
|
+
readonly width: number;
|
|
32
|
+
readonly height: number;
|
|
33
|
+
}
|
|
34
|
+
export interface IndexRange {
|
|
35
|
+
readonly start: number;
|
|
36
|
+
readonly end: number;
|
|
37
|
+
}
|
|
38
|
+
export interface ScrollAxisLayout {
|
|
39
|
+
readonly logicalContentSize: number;
|
|
40
|
+
readonly logicalViewportSize: number;
|
|
41
|
+
readonly logicalOffset: number;
|
|
42
|
+
readonly logicalMaxOffset: number;
|
|
43
|
+
readonly physicalContentSize: number;
|
|
44
|
+
readonly physicalOffset: number;
|
|
45
|
+
readonly physicalMaxOffset: number;
|
|
46
|
+
readonly compressed: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface VisibleColumn {
|
|
49
|
+
readonly index: number;
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly name: string;
|
|
52
|
+
/** Viewport-relative left edge in CSS pixels. */
|
|
53
|
+
readonly x: number;
|
|
54
|
+
readonly width: number;
|
|
55
|
+
/** True when the column is pinned at the workbook's frozen boundary. */
|
|
56
|
+
readonly frozen: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface VisibleRow {
|
|
59
|
+
readonly index: number;
|
|
60
|
+
/** Viewport-relative top edge in CSS pixels. */
|
|
61
|
+
readonly y: number;
|
|
62
|
+
readonly height: number;
|
|
63
|
+
/** True when the row is pinned at the workbook's frozen boundary. */
|
|
64
|
+
readonly frozen: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface SparseAxisOverride {
|
|
67
|
+
readonly index: number;
|
|
68
|
+
readonly size: number;
|
|
69
|
+
/** Cumulative size delta through and including this override. */
|
|
70
|
+
readonly cumulativeDelta: number;
|
|
71
|
+
}
|
|
72
|
+
/** Compact geometry for a potentially million-row spreadsheet axis. */
|
|
73
|
+
export interface SparseAxisGeometry {
|
|
74
|
+
readonly count: number;
|
|
75
|
+
readonly defaultSize: number;
|
|
76
|
+
readonly contentSize: number;
|
|
77
|
+
readonly overrides: readonly Readonly<SparseAxisOverride>[];
|
|
78
|
+
}
|
|
79
|
+
export interface TableLayout {
|
|
80
|
+
readonly width: number;
|
|
81
|
+
readonly height: number;
|
|
82
|
+
readonly devicePixelRatio: number;
|
|
83
|
+
readonly rowHeight: number;
|
|
84
|
+
readonly headerHeight: number;
|
|
85
|
+
readonly rowHeaderWidth: number;
|
|
86
|
+
readonly bodyWidth: number;
|
|
87
|
+
readonly bodyHeight: number;
|
|
88
|
+
readonly rowCount: number;
|
|
89
|
+
readonly columnCount: number;
|
|
90
|
+
readonly rows: Readonly<{
|
|
91
|
+
readonly visible: Readonly<IndexRange>;
|
|
92
|
+
readonly overscan: Readonly<IndexRange>;
|
|
93
|
+
}>;
|
|
94
|
+
readonly columns: Readonly<{
|
|
95
|
+
readonly visible: Readonly<IndexRange>;
|
|
96
|
+
readonly overscan: Readonly<IndexRange>;
|
|
97
|
+
}>;
|
|
98
|
+
readonly visibleColumns: readonly Readonly<VisibleColumn>[];
|
|
99
|
+
readonly overscanColumns: readonly Readonly<VisibleColumn>[];
|
|
100
|
+
readonly visibleRows: readonly Readonly<VisibleRow>[];
|
|
101
|
+
readonly overscanRows: readonly Readonly<VisibleRow>[];
|
|
102
|
+
/** Effective widths use zero for workbook-hidden columns. */
|
|
103
|
+
readonly effectiveColumnWidths: readonly number[];
|
|
104
|
+
readonly rowGeometry: Readonly<SparseAxisGeometry>;
|
|
105
|
+
readonly frozenRowCount: number;
|
|
106
|
+
readonly frozenColumnCount: number;
|
|
107
|
+
readonly frozenRowExtent: number;
|
|
108
|
+
readonly frozenColumnExtent: number;
|
|
109
|
+
/** Frozen segments are loaded separately when the scroll window is distant. */
|
|
110
|
+
readonly frozenRowRange: Readonly<IndexRange>;
|
|
111
|
+
readonly frozenColumnRange: Readonly<IndexRange>;
|
|
112
|
+
readonly horizontal: Readonly<ScrollAxisLayout>;
|
|
113
|
+
readonly vertical: Readonly<ScrollAxisLayout>;
|
|
114
|
+
/** Spacer dimensions for a native scroll host, including sticky headers. */
|
|
115
|
+
readonly spacerWidth: number;
|
|
116
|
+
readonly spacerHeight: number;
|
|
117
|
+
}
|
|
118
|
+
export type HitTestResult = Readonly<{
|
|
119
|
+
kind: "outside";
|
|
120
|
+
}> | Readonly<{
|
|
121
|
+
kind: "corner";
|
|
122
|
+
}> | Readonly<{
|
|
123
|
+
kind: "column-header";
|
|
124
|
+
columnIndex: number;
|
|
125
|
+
}> | Readonly<{
|
|
126
|
+
kind: "column-resize";
|
|
127
|
+
columnIndex: number;
|
|
128
|
+
boundaryX: number;
|
|
129
|
+
}> | Readonly<{
|
|
130
|
+
kind: "row-header";
|
|
131
|
+
rowIndex: number;
|
|
132
|
+
}> | Readonly<{
|
|
133
|
+
kind: "cell";
|
|
134
|
+
rowIndex: number;
|
|
135
|
+
columnIndex: number;
|
|
136
|
+
}>;
|
|
137
|
+
export type CellLoadState = Readonly<{
|
|
138
|
+
status: "loading";
|
|
139
|
+
}> | Readonly<{
|
|
140
|
+
status: "unavailable";
|
|
141
|
+
}> | Readonly<{
|
|
142
|
+
status: "loaded";
|
|
143
|
+
value: string | null;
|
|
144
|
+
}>;
|
|
145
|
+
export type TableViewStatus = "loading" | "ready" | "error" | "closed";
|
|
146
|
+
export interface TableViewSnapshot {
|
|
147
|
+
readonly generation: number;
|
|
148
|
+
readonly status: TableViewStatus;
|
|
149
|
+
readonly metadata: Readonly<TableMetadata>;
|
|
150
|
+
readonly layout: Readonly<TableLayout>;
|
|
151
|
+
readonly activeCell: Readonly<CellPosition> | null;
|
|
152
|
+
readonly selection: Readonly<TableSelection> | null;
|
|
153
|
+
readonly error?: unknown;
|
|
154
|
+
}
|
|
155
|
+
export interface ViewportUpdate {
|
|
156
|
+
readonly width: number;
|
|
157
|
+
readonly height: number;
|
|
158
|
+
/** Native scroll-host offset in CSS pixels. */
|
|
159
|
+
readonly scrollLeft: number;
|
|
160
|
+
/** Native scroll-host offset in CSS pixels. */
|
|
161
|
+
readonly scrollTop: number;
|
|
162
|
+
readonly devicePixelRatio?: number;
|
|
163
|
+
}
|
|
164
|
+
export interface TableControllerOptions {
|
|
165
|
+
readonly rowHeight?: number;
|
|
166
|
+
readonly headerHeight?: number;
|
|
167
|
+
readonly rowHeaderWidth?: number;
|
|
168
|
+
readonly columnWidth?: number;
|
|
169
|
+
readonly minColumnWidth?: number;
|
|
170
|
+
readonly maxColumnWidth?: number;
|
|
171
|
+
readonly columnWidths?: Readonly<Record<string, number>>;
|
|
172
|
+
readonly scrollPixelLimit?: number;
|
|
173
|
+
readonly overscanRows?: number;
|
|
174
|
+
readonly overscanColumns?: number;
|
|
175
|
+
/** Hard bound for decoded render/cache cells. */
|
|
176
|
+
readonly maxWindowCells?: number;
|
|
177
|
+
}
|
|
178
|
+
export type NavigationCommand = "left" | "right" | "up" | "down" | "page-up" | "page-down" | "row-start" | "row-end" | "table-start" | "table-end";
|
|
179
|
+
export interface SetActiveCellOptions {
|
|
180
|
+
readonly extendSelection?: boolean;
|
|
181
|
+
readonly scrollIntoView?: boolean;
|
|
182
|
+
}
|
|
183
|
+
export interface MoveActiveCellOptions extends SetActiveCellOptions {
|
|
184
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Dedicated Arrow IPC runtime artifact implementing adapter ABI v3.
|
|
5
|
+
*/
|
|
6
|
+
export class WasmRuntime {
|
|
7
|
+
free(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the frozen official adapter ID.
|
|
10
|
+
*/
|
|
11
|
+
adapterId(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Begins an open without copying the full source into WebAssembly.
|
|
14
|
+
*
|
|
15
|
+
* IPC Files request only their trailer, footer, and batched dictionary/
|
|
16
|
+
* record metadata here.
|
|
17
|
+
* IPC Streams request bounded sequential chunks.
|
|
18
|
+
*/
|
|
19
|
+
beginOpen(options: any, source_length: number): any;
|
|
20
|
+
/**
|
|
21
|
+
* Starts a range read. Streams complete from retained decoded batches;
|
|
22
|
+
* Files request only dictionaries and intersecting record blocks.
|
|
23
|
+
*/
|
|
24
|
+
beginRead(table_handle: number, request: any): any;
|
|
25
|
+
/**
|
|
26
|
+
* Opens the source's single logical table.
|
|
27
|
+
*/
|
|
28
|
+
openTable(source_handle: number, table_id: string): any;
|
|
29
|
+
/**
|
|
30
|
+
* Idempotently closes one table and its in-flight reads.
|
|
31
|
+
*/
|
|
32
|
+
closeTable(table_handle: number): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Idempotently closes one source, its tables, and all child reads.
|
|
35
|
+
*/
|
|
36
|
+
closeSource(source_handle: number): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Returns no static presentation for Arrow IPC tables.
|
|
39
|
+
*/
|
|
40
|
+
presentation(table_handle: number): any;
|
|
41
|
+
/**
|
|
42
|
+
* Starts and synchronously completes a metadata operation.
|
|
43
|
+
*/
|
|
44
|
+
beginMetadata(table_handle: number): any;
|
|
45
|
+
/**
|
|
46
|
+
* Starts and synchronously completes an open-table operation using the
|
|
47
|
+
* common ABI-v3 step envelope.
|
|
48
|
+
*/
|
|
49
|
+
beginOpenTable(source_handle: number, table_id: string): any;
|
|
50
|
+
/**
|
|
51
|
+
* Cancels and releases a pending adapter operation.
|
|
52
|
+
*/
|
|
53
|
+
cancelOperation(operation_handle: number): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the Worker protocol version.
|
|
56
|
+
*/
|
|
57
|
+
protocolVersion(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the private adapter-owned resource ledger snapshot.
|
|
60
|
+
*/
|
|
61
|
+
resourceSnapshot(): any;
|
|
62
|
+
/**
|
|
63
|
+
* Starts and synchronously completes a static-presentation operation.
|
|
64
|
+
*/
|
|
65
|
+
beginPresentation(table_handle: number): any;
|
|
66
|
+
/**
|
|
67
|
+
* Supplies one complete revision-matched source result set and advances
|
|
68
|
+
* an open or File range-read operation.
|
|
69
|
+
*/
|
|
70
|
+
continueOperation(operation_handle: number, operation_revision: number, results: Array<any>): any;
|
|
71
|
+
/**
|
|
72
|
+
* Returns the official adapter ABI version.
|
|
73
|
+
*/
|
|
74
|
+
adapterApiVersion(): number;
|
|
75
|
+
/**
|
|
76
|
+
* Returns typed-buffer layout version one.
|
|
77
|
+
*/
|
|
78
|
+
batchLayoutVersion(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Returns no range presentation for Arrow IPC tables.
|
|
81
|
+
*/
|
|
82
|
+
readPresentationRange(table_handle: number, request: any): any;
|
|
83
|
+
/**
|
|
84
|
+
* Starts and synchronously completes a range-presentation operation.
|
|
85
|
+
*/
|
|
86
|
+
beginPresentationRange(table_handle: number, request: any): any;
|
|
87
|
+
/**
|
|
88
|
+
* Creates an empty Arrow adapter runtime.
|
|
89
|
+
*/
|
|
90
|
+
constructor(config: any);
|
|
91
|
+
/**
|
|
92
|
+
* Returns the latest table metadata.
|
|
93
|
+
*/
|
|
94
|
+
metadata(table_handle: number): any;
|
|
95
|
+
/**
|
|
96
|
+
* Releases all operations, tables, and sources.
|
|
97
|
+
*/
|
|
98
|
+
shutdown(): void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
102
|
+
|
|
103
|
+
export interface InitOutput {
|
|
104
|
+
readonly memory: WebAssembly.Memory;
|
|
105
|
+
readonly __wbg_wasmruntime_free: (a: number, b: number) => void;
|
|
106
|
+
readonly wasmruntime_adapterApiVersion: (a: number) => number;
|
|
107
|
+
readonly wasmruntime_adapterId: (a: number, b: number) => void;
|
|
108
|
+
readonly wasmruntime_batchLayoutVersion: (a: number) => number;
|
|
109
|
+
readonly wasmruntime_beginMetadata: (a: number, b: number, c: number) => void;
|
|
110
|
+
readonly wasmruntime_beginOpen: (a: number, b: number, c: number, d: number) => void;
|
|
111
|
+
readonly wasmruntime_beginOpenTable: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
112
|
+
readonly wasmruntime_beginPresentation: (a: number, b: number, c: number) => void;
|
|
113
|
+
readonly wasmruntime_beginPresentationRange: (a: number, b: number, c: number, d: number) => void;
|
|
114
|
+
readonly wasmruntime_beginRead: (a: number, b: number, c: number, d: number) => void;
|
|
115
|
+
readonly wasmruntime_cancelOperation: (a: number, b: number) => number;
|
|
116
|
+
readonly wasmruntime_closeSource: (a: number, b: number) => number;
|
|
117
|
+
readonly wasmruntime_closeTable: (a: number, b: number) => number;
|
|
118
|
+
readonly wasmruntime_continueOperation: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
119
|
+
readonly wasmruntime_metadata: (a: number, b: number, c: number) => void;
|
|
120
|
+
readonly wasmruntime_new: (a: number, b: number) => void;
|
|
121
|
+
readonly wasmruntime_openTable: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
122
|
+
readonly wasmruntime_presentation: (a: number, b: number, c: number) => void;
|
|
123
|
+
readonly wasmruntime_protocolVersion: (a: number) => number;
|
|
124
|
+
readonly wasmruntime_readPresentationRange: (a: number, b: number, c: number, d: number) => void;
|
|
125
|
+
readonly wasmruntime_resourceSnapshot: (a: number, b: number) => void;
|
|
126
|
+
readonly wasmruntime_shutdown: (a: number) => void;
|
|
127
|
+
readonly __wbindgen_export_0: (a: number, b: number) => number;
|
|
128
|
+
readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
|
|
129
|
+
readonly __wbindgen_export_2: (a: number) => void;
|
|
130
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
131
|
+
readonly __wbindgen_export_3: (a: number, b: number, c: number) => void;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
135
|
+
/**
|
|
136
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
137
|
+
* a precompiled `WebAssembly.Module`.
|
|
138
|
+
*
|
|
139
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
140
|
+
*
|
|
141
|
+
* @returns {InitOutput}
|
|
142
|
+
*/
|
|
143
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
147
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
148
|
+
*
|
|
149
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
150
|
+
*
|
|
151
|
+
* @returns {Promise<InitOutput>}
|
|
152
|
+
*/
|
|
153
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|