@sheetwrite/corefunction
Mount a grid over a validated, non-dirty snapshot. The grid owns and disposes
the hydrated store just like one created through createGrid.
- Package
@sheetwrite/core- Source
packages/core/src/persistence.ts#L48
Declaration
function createGridFromSnapshot( host: HTMLElement, snapshot: unknown, options?: SnapshotGridOptionstype SnapshotGridOptions = Omit<
GridOptions,
"workbook" | "data"
> & { snapshotResourceLimits?: Partial<SnapshotResourceLimits> };type SnapshotGridOptions = Omit<
GridOptions,
"workbook" | "data"
> & { snapshotResourceLimits?: Partial<SnapshotResourceLimits> };type SnapshotGridOptions = Omit<
GridOptions,
"workbook" | "data"
> & {
snapshotResourceLimits?: Partial<SnapshotResourceLimits>;
};Grid creation options accepted when hydrating a validated snapshot.API reference →,): Gridinterface Grid {
readonly store: Store;
readonly actions: GridActions;
setActiveSheet(id: SheetId): void;
scrollToCell(addr: CellAddress): void;
getCellAtPoint(
clientX: number,
clientY: number,
): CellAddress | null;
getActiveSheet(): SheetId;
getCellInput(row: number, col: number): CellInputSnapshot | null;
getSelection(): Selection | null;
setSelection(sel: Selection | null): void;
setTheme(theme: Partial<Theme>): void;
replaceTheme(theme: Partial<Theme> | undefined): void;
// … 106 more lines — see the API reference
}interface Grid {
readonly store: Store;
readonly actions: GridActions;
setActiveSheet(id: SheetId): void;
scrollToCell(addr: CellAddress): void;
getCellAtPoint(
clientX: number,
clientY: number,
): CellAddress | null;
getActiveSheet(): SheetId;
getCellInput(row: number, col: number): CellInputSnapshot | null;
getSelection(): Selection | null;
setSelection(sel: Selection | null): void;
setTheme(theme: Partial<Theme>): void;
replaceTheme(theme: Partial<Theme> | undefined): void;
// … 106 more lines — see the API reference
}interface Grid {
readonly store: Store;
readonly actions: GridActions;
setActiveSheet(
id: SheetId,
): void;
scrollToCell(
addr: CellAddress,
): void;
getCellAtPoint(
clientX: number,
clientY: number,
): CellAddress | null;
getActiveSheet(): SheetId;
getCellInput(
row: number,
col: number,
): CellInputSnapshot | null;
getSelection(): Selection | null;
// … 229 more lines — see the API reference
}Imperative grid handle for document commands, events, rendering, and teardown.API reference →