Skip to main content

Crate fc_grid

Crate fc_grid 

Source
Expand description

fc-grid — grid, cell, and selection model for Office-like surfaces.

§Why this is in Rust

Rendering is not the expensive part of a large grid; the browser is good at it, and virtualizing the DOM is a layout concern. The expensive part is the arithmetic around it: which cells intersect a scroll viewport, how a selection rectangle expands, how far a range extends past the last populated cell. Those are pure integer computations that run per frame during scroll and per keystroke during navigation – exactly the tight loops where JS overhead dominates.

§What is deliberately absent

Formulas. Spreadsheet formula evaluation is a dependency graph with cycle detection, error propagation, and locale-dependent number formats – tens of thousands of lines with a large external dependency. Folding that in would make this the largest module in the workspace and force every consumer of the selection model to download it. It belongs in a separate crate and a separate opt-in; see docs/WASM.md.

Rendering. This crate never touches the DOM. It answers “what should be visible”; the JS layer decides how.

Structs§

CellRange
A rectangular selection, always stored normalized: start is the top-left (row-major minimum) and end the bottom-right, whichever corner the user dragged from.
CellRef
A cell address. Row and column are zero-based.
Grid
A sparse grid of string cells.
Viewport
A scroll viewport in cell coordinates, with a render margin.