Advanced Svelte adapter props with inferred host row identity.
Members 39
workbook Live workbook schema adopted by the Grid.
data Eager values for the active sheet.
rowBridge Optional canonical-to-host row projection.
datasource Lazy visible-row provider.
datasourceStorage Datasource storage policy.
renderer Canvas or worker paint backend.
workerUrl Browser-fetchable worker module URL.
presentation Positional spreadsheet or semantic data-grid headers.
theme Live resolved-theme overrides.
readOnly Disables mutations, not navigation.
protectionResolver Client protected-range check.
protectionResolver?: GridOptions["protectionResolver"];
mutationPolicy Atomic or partial denial policy.
transactionResourceLimits Overrides inclusive operation-count and encoded-byte ceilings for every atomic mutation.
transactionResourceLimits?: GridOptions["transactionResourceLimits"];
hyperlinkActivation Controls link activation: emit an event, also navigate internally, or disable it.
hyperlinkActivation?: GridOptions["hyperlinkActivation"];
renderers Named custom cell renderers.
editors Named custom cell editors.
overscan Extra rows painted around the viewport.
minColumns Minimum column count with padding.
config Built-in UI control configuration.
height Host height as pixels or a CSS length.
height?: number | string;
fill Fills the parent's available size.
fallback Content shown until initialization succeeds.
grid Bindable live Grid, cleared on reset or unmount.
onGridChange Receives every committed Grid change, including its applied transaction.
onRowDelta Receives projected host-row effects when a row bridge is attached.
onSelectionChange Receives the current selection, or null after it is cleared.
onSelectionChange?: (selection: Selection | null) => void;
onViewportChange Receives visible row bounds and vertical scroll offset after scrolling.
onViewportChange?: (event: GridEvents["scroll"]) => void;
onEditBegin Fires when cell editing begins.
onEditBegin?: (event: GridEvents["edit-begin"]) => void;
onEditCommit Fires after an edit commits its parsed cell value.
onEditCommit?: (event: GridEvents["edit-commit"]) => void;
onSearch Receives refreshed search matches and active-match index.
onSearch?: (result: GridEvents["search"]) => void;
onActiveSheetChange Fires after the visible sheet changes.
onActiveSheetChange?: (event: GridEvents["active-sheet"]) => void;
onCommandStateChange Receives observable undo/redo and formatting command state.
onCommandStateChange?: (event: GridEvents["command-state-change"]) => void;
onMutationRejected Receives structured issues when a Grid mutation is rejected.
onMutationRejected?: (event: GridEvents["mutation-rejected"]) => void;
onRendererFallback Fires when worker rendering falls back to the main-thread canvas renderer.
onRendererFallback?: (event: GridEvents["renderer-fallback"]) => void;
onDatasourceError Receives failed datasource requests and their errors.
onDatasourceError?: (event: GridEvents["datasource-error"]) => void;
onExportError Receives failures from built-in XLSX export actions.
onExportError?: (event: GridEvents["export-error"]) => void;
onReady Fires after the adapter publishes a ready Grid generation.
onInitializationError Receives a WASM initialization failure while the adapter remains mounted.
wasmSource Explicit source passed to process-wide WASM initialization; concurrent initialization is first-source-wins.
wasmSource?: BufferSource | URL | string | Request | WebAssembly.Module;
Declaration
View full TypeScript declaration
export interface SheetwriteGridProps<
HTMLAttributes<HTMLDivElement>,
protectionResolver?: GridOptions["protectionResolver"]; transactionResourceLimits?: GridOptions["transactionResourceLimits"]; hyperlinkActivation?: GridOptions["hyperlinkActivation"]; height?: number | string;
onSelectionChange?: (selection: Selection | null) => void; onViewportChange?: (event: GridEvents["scroll"]) => void; onEditBegin?: (event: GridEvents["edit-begin"]) => void; onEditCommit?: (event: GridEvents["edit-commit"]) => void; onSearch?: (result: GridEvents["search"]) => void; onActiveSheetChange?: (event: GridEvents["active-sheet"]) => void; onCommandStateChange?: (event: GridEvents["command-state-change"]) => void; onMutationRejected?: (event: GridEvents["mutation-rejected"]) => void; onRendererFallback?: (event: GridEvents["renderer-fallback"]) => void; onDatasourceError?: (event: GridEvents["datasource-error"]) => void; onExportError?: (event: GridEvents["export-error"]) => void; wasmSource?: BufferSource | URL | string | Request | WebAssembly.Module;
Referenced by
Workspace packages depending on @sheetwrite/svelte
@sheetwrite/docs-startdependency
Public exports naming SheetwriteGridProps
interface GridOptions {
workbook: Workbook;
data?: ColumnarData;
datasource?: DataSource;
datasourceStorage?: DataSourceStorageOptions;
renderer?: "canvas" | "worker";
workerUrl?: string | URL;
presentation?: GridPresentation;
theme?: Partial<Theme>;
readOnly?: boolean;
hyperlinkActivation?:
"event-only" | "internal-navigation" | "disabled";
protectionResolver?: ProtectionResolver;
mutationPolicy?: MutationPolicyMode;
transactionResourceLimits?: Partial<TransactionResourceLimits>;
// … 6 more lines — see the API reference
}interface GridOptions {
workbook: Workbook;
data?: ColumnarData;
datasource?: DataSource;
datasourceStorage?: DataSourceStorageOptions;
renderer?: "canvas" | "worker";
workerUrl?: string | URL;
presentation?: GridPresentation;
theme?: Partial<Theme>;
readOnly?: boolean;
hyperlinkActivation?:
"event-only" | "internal-navigation" | "disabled";
protectionResolver?: ProtectionResolver;
mutationPolicy?: MutationPolicyMode;
transactionResourceLimits?: Partial<TransactionResourceLimits>;
// … 6 more lines — see the API reference
}interface GridOptions {
workbook: Workbook;
data?: ColumnarData;
datasource?: DataSource;
datasourceStorage?: DataSourceStorageOptions;
renderer?: "canvas" | "worker";
workerUrl?: string | URL;
presentation?: GridPresentation;
theme?: Partial<Theme>;
readOnly?: boolean;
hyperlinkActivation?:
| "event-only"
| "internal-navigation"
| "disabled";
protectionResolver?: ProtectionResolver;
mutationPolicy?: MutationPolicyMode;
transactionResourceLimits?: Partial<TransactionResourceLimits>;
renderers?: Record<
string,
// … 10 more lines — see the API reference
}Workbook, data, rendering, policy, and built-in UI options used to create a Grid. @example import type { GridOptions } from "@sheetwrite/core"; const options: GridOptions = { workbook: { activeSheet: "sheet1", sheets: [ { id: "sheet1", name: "Sheet 1", rowCount: 1, columns: [{ key: "name", header: "Name", type: "text", width: 120 }] }, ] }, data: { rowCount: 1, columns: { name: ["Ada"] } }, config: { toolbar: true, contextMenu: true, keyboard: true }, }; @see createGrid @see GridConfigAPI reference →class RowBridge {
constructor<
Id extends RowBridgeId = RowBridgeId,
Row extends Record<string, CellScalar> = Record<
string,
CellScalar
>,
>(options: RowBridgeOptions<Row, Id>);
columnKeys: (sheet?: SheetId) => readonly string[];
project: (
event: ChangeEvent,
requestedOperations?: readonly DocumentOp[],
transactionId?: string,
) => RowBridgeProjection<Id>;
reconcile: (
// … 4 more lines — see the API reference
}class RowBridge {
constructor<
Id extends RowBridgeId = RowBridgeId,
Row extends Record<string, CellScalar> = Record<
string,
CellScalar
>,
>(options: RowBridgeOptions<Row, Id>);
columnKeys: (sheet?: SheetId) => readonly string[];
project: (
event: ChangeEvent,
requestedOperations?: readonly DocumentOp[],
transactionId?: string,
) => RowBridgeProjection<Id>;
reconcile: (
// … 4 more lines — see the API reference
}class RowBridge {
constructor<
Id extends RowBridgeId =
RowBridgeId,
Row extends Record<
string,
CellScalar
> = Record<
string,
CellScalar
>,
>(
options: RowBridgeOptions<
Row,
Id
>,
);
columnKeys: (
sheet?: SheetId,
// … 13 more lines — see the API reference
}Projects canonical document transactions into host-owned row changes. The bridge only owns compact data-space identity arrays. It never writes to defaultRows, never renders, and never creates a second document store.API reference →interface Grid {
readonly store: Store;
readonly actions: GridActions;
getRuntimeResourceSnapshot(
operation: RuntimeResourceOperation,
phase: RuntimeResourcePhase,
runtime?: RuntimeMemoryObservation,
): RuntimeResourceSnapshot;
getCommandState(command: GridCommandName): GridCommandState;
setActiveSheet(id: SheetId): void;
scrollToCell(addr: CellAddress): void;
getCellAtPoint(
clientX: number,
clientY: number,
): CellAddress | null;
// … 122 more lines — see the API reference
}interface Grid {
readonly store: Store;
readonly actions: GridActions;
getRuntimeResourceSnapshot(
operation: RuntimeResourceOperation,
phase: RuntimeResourcePhase,
runtime?: RuntimeMemoryObservation,
): RuntimeResourceSnapshot;
getCommandState(command: GridCommandName): GridCommandState;
setActiveSheet(id: SheetId): void;
scrollToCell(addr: CellAddress): void;
getCellAtPoint(
clientX: number,
clientY: number,
): CellAddress | null;
// … 122 more lines — see the API reference
}interface Grid {
readonly store: Store;
readonly actions: GridActions;
getRuntimeResourceSnapshot(
operation: RuntimeResourceOperation,
phase: RuntimeResourcePhase,
runtime?: RuntimeMemoryObservation,
): RuntimeResourceSnapshot;
getCommandState(
command: GridCommandName,
): GridCommandState;
setActiveSheet(
id: SheetId,
): void;
scrollToCell(
addr: CellAddress,
): void;
getCellAtPoint(
clientX: number,
// … 259 more lines — see the API reference
}Imperative grid handle for document commands, events, rendering, and teardown. @example import type { Grid } from "@sheetwrite/core"; function updateTotal(grid: Grid) { const sheet = grid.getActiveSheet(); const result = grid.applyTransaction({ patches: [{ op: "set", addr: { sheet, row: 0, col: 0 }, value: { kind: "literal", value: 42 } }], }); if (result.status === "applied") grid.scrollToCell({ sheet, row: 0, col: 0 }); return grid.aggregate(0, "sum"); } @see createGrid @see Grid.applyTransactionAPI reference →interface ChangeEvent {
transaction: Transaction;
changes: CellChange[];
commitReason: CommitReason;
source: OperationSource;
epoch?: number;
}interface ChangeEvent {
transaction: Transaction;
changes: CellChange[];
commitReason: CommitReason;
source: OperationSource;
epoch?: number;
}interface ChangeEvent {
transaction: Transaction;
changes: CellChange[];
commitReason: CommitReason;
source: OperationSource;
epoch?: number;
}Payload of the change event; flows OUT for API submission/reconcile.API reference →type RowBridgeHandler<Id extends RowBridgeId = RowBridgeId> = (
projection: RowBridgeProjection<Id>,
) => void;type RowBridgeHandler<Id extends RowBridgeId = RowBridgeId> = (
projection: RowBridgeProjection<Id>,
) => void;type RowBridgeHandler<
Id extends RowBridgeId =
RowBridgeId,
> = (
projection: RowBridgeProjection<Id>,
) => void;Callback accepted by imperative and framework adapters.API reference →type Selection =
| { kind: "cell"; addr: CellAddress }
| { kind: "range"; range: Range }
| { kind: "row"; sheet: SheetId; row: number }
| { kind: "column"; sheet: SheetId; col: number }
| { kind: "multi"; ranges: Range[] };type Selection =
| { kind: "cell"; addr: CellAddress }
| { kind: "range"; range: Range }
| { kind: "row"; sheet: SheetId; row: number }
| { kind: "column"; sheet: SheetId; col: number }
| { kind: "multi"; ranges: Range[] };type Selection =
| {
kind: "cell";
addr: CellAddress;
}
| {
kind: "range";
range: Range;
}
| {
kind: "row";
sheet: SheetId;
row: number;
}
| {
kind: "column";
sheet: SheetId;
col: number;
}
// … 4 more lines — see the API reference
}Current cell, range, row, column, or multi-range selection.API reference →interface GridEvents {
change: ChangeEvent;
selection: { selection: Selection | null };
scroll: {
scrollTop: number;
firstRow: number;
lastRow: number;
scrollLeft: number;
firstVisibleColumn: number | null;
lastVisibleColumn: number | null;
};
"edit-begin": { addr: CellAddress };
"edit-commit": { addr: CellAddress; value: CellValue };
search: SearchResult;
"command-state-change": GridCommandStateChangeEvent;
// … 17 more lines — see the API reference
}interface GridEvents {
change: ChangeEvent;
selection: { selection: Selection | null };
scroll: {
scrollTop: number;
firstRow: number;
lastRow: number;
scrollLeft: number;
firstVisibleColumn: number | null;
lastVisibleColumn: number | null;
};
"edit-begin": { addr: CellAddress };
"edit-commit": { addr: CellAddress; value: CellValue };
search: SearchResult;
"command-state-change": GridCommandStateChangeEvent;
// … 17 more lines — see the API reference
}interface GridEvents {
change: ChangeEvent;
selection: {
selection: Selection | null;
};
scroll: {
scrollTop: number;
firstRow: number;
lastRow: number;
scrollLeft: number;
firstVisibleColumn:
number | null;
lastVisibleColumn:
number | null;
};
"edit-begin": {
addr: CellAddress;
};
"edit-commit": {
// … 31 more lines — see the API reference
}Payload map for events emitted by a Grid.API reference →interface GridReadyEvent {
grid: Grid;
generation: number;
reason: GridReadyReason;
}interface GridReadyEvent {
grid: Grid;
generation: number;
reason: GridReadyReason;
}interface GridReadyEvent {
grid: Grid;
generation: number;
reason: GridReadyReason;
}Grid handle, generation, and reason published after adapter initialization.API reference →class SheetwriteError
extends Error
implements SheetwriteErrorEnvelope
{
constructor(
code: SheetwriteErrorCode,
operation: SheetwriteErrorOperation,
message: string,
options?: SheetwriteErrorOptions,
);
code:
| "aborted"
| "batch-limit"
| "blocked"
| "buffer-byte-limit"
// … 78 more lines — see the API reference
}class SheetwriteError
extends Error
implements SheetwriteErrorEnvelope
{
constructor(
code: SheetwriteErrorCode,
operation: SheetwriteErrorOperation,
message: string,
options?: SheetwriteErrorOptions,
);
code:
| "aborted"
| "batch-limit"
| "blocked"
| "buffer-byte-limit"
// … 78 more lines — see the API reference
}class SheetwriteError
extends Error
implements
SheetwriteErrorEnvelope
{
constructor(
code: SheetwriteErrorCode,
operation: SheetwriteErrorOperation,
message: string,
options?: SheetwriteErrorOptions,
);
code:
| "aborted"
| "batch-limit"
| "blocked"
| "buffer-byte-limit"
| "buffer-count-limit"
| "buffer-operation-limit"
| "comment-failed"
// … 80 more lines — see the API reference
}Canonical envelope for thrown and callback-delivered Sheetwrite failures.API reference →type RowBridgeId = string | number;type RowBridgeId = string | number;type RowBridgeId =
string | number;A stable host identity for one data-space row.API reference →interface GridAdapterEventHandlers<
Id extends RowBridgeId = RowBridgeId,
> {
onGridChange?: (event: ChangeEvent) => void;
onRowDelta?: RowBridgeHandler<Id>;
onSelectionChange?: (selection: Selection | null) => void;
onViewportChange?: (event: GridEvents["scroll"]) => void;
onEditBegin?: (event: GridEvents["edit-begin"]) => void;
onEditCommit?: (event: GridEvents["edit-commit"]) => void;
onSearch?: (result: GridEvents["search"]) => void;
onActiveSheetChange?: (event: GridEvents["active-sheet"]) => void;
onCommandStateChange?: (
event: GridEvents["command-state-change"],
) => void;
onMutationRejected?: (
// … 12 more lines — see the API reference
}interface GridAdapterEventHandlers<
Id extends RowBridgeId = RowBridgeId,
> {
onGridChange?: (event: ChangeEvent) => void;
onRowDelta?: RowBridgeHandler<Id>;
onSelectionChange?: (selection: Selection | null) => void;
onViewportChange?: (event: GridEvents["scroll"]) => void;
onEditBegin?: (event: GridEvents["edit-begin"]) => void;
onEditCommit?: (event: GridEvents["edit-commit"]) => void;
onSearch?: (result: GridEvents["search"]) => void;
onActiveSheetChange?: (event: GridEvents["active-sheet"]) => void;
onCommandStateChange?: (
event: GridEvents["command-state-change"],
) => void;
onMutationRejected?: (
// … 12 more lines — see the API reference
}interface GridAdapterEventHandlers<
Id extends RowBridgeId =
RowBridgeId,
> {
onGridChange?: (
event: ChangeEvent,
) => void;
onRowDelta?: RowBridgeHandler<Id>;
onSelectionChange?: (
selection: Selection | null,
) => void;
onViewportChange?: (
event: GridEvents["scroll"],
) => void;
onEditBegin?: (
event: GridEvents["edit-begin"],
) => void;
onEditCommit?: (
event: GridEvents["edit-commit"],
// … 29 more lines — see the API reference
}Framework-neutral readiness, change, and error callbacks shared by adapters.API reference →