change is the committed transaction stream. ChangeEvent.source is local for user/API output that a host may persist and remote for already-persisted input that must not be enqueued again. Selection, search, renderer fallback, and other UI events remain observational.
Framework onGridChange/grid-change callbacks carry the same committed event. Adapter readiness is { grid, generation, reason }; reason distinguishes initial, input-reset, and renderer-reset. The imperative ref, exposed handle, or binding is assigned before readiness and cleared on replacement.
Stable failure envelope
Every consumer-visible initialization, datasource, renderer, export, persistence,
snapshot, synchronization, collaboration, CSV, and XLSX failure is a
SheetwriteError. Use code and operation for control flow; message is
diagnostic text and may become more specific. context contains
serialization-safe boundary details, retryable is present only when
Sheetwrite can determine it, and cause retains the original exception in the
current realm. toJSON() omits cause.
Initialization recovery
import { initSheetwritefunction initSheetwrite(source?: BufferSource | URL | string | Request | WebAssembly.Module): Promise<void>functioninitSheetwrite(source?:BufferSource|URL|string|Request|WebAssembly.Module,):Promise<void>functioninitSheetwrite(source?:|BufferSource|URL|string|Request|WebAssembly.Module,):Promise<void>Load the WASM data engine once. Must be awaited before createGrid.API reference →, isSheetwriteErrorfunction isSheetwriteError(value: unknown): value is SheetwriteErrorEnvelopefunctionisSheetwriteError(value:unknown,):valueisSheetwriteErrorEnvelopefunctionisSheetwriteError(value:unknown,):valueisSheetwriteErrorEnvelopeNarrow same-realm errors, cross-realm errors, and serialized failure envelopes.API reference → } from"@sheetwrite/core";
declareconstwasmUrl:URLinterface URLinterfaceURLinterfaceURLThe URL interface is used to parse, construct, normalize, and encode URL. MDN Reference;
declareconstcorrectedWasmUrl:URLinterface URLinterfaceURLinterfaceURLThe URL interface is used to parse, construct, normalize, and encode URL. MDN Reference;
// A failed source does not poison readiness. Retry with corrected input.
awaitinitSheetwritefunction initSheetwrite(source?: BufferSource | URL | string | Request | WebAssembly.Module): Promise<void>functioninitSheetwrite(source?:BufferSource|URL|string|Request|WebAssembly.Module,):Promise<void>functioninitSheetwrite(source?:|BufferSource|URL|string|Request|WebAssembly.Module,):Promise<void>Load the WASM data engine once. Must be awaited before createGrid.API reference →(correctedWasmUrlconst correctedWasmUrl: URLconstcorrectedWasmUrl:URLconstcorrectedWasmUrl:URL);
}
The guard also recognizes validated cross-realm and serialized envelopes. A
serialized envelope is structural; code that requires Error identity should
construct or receive a live SheetwriteError.
readonlysheetsheet: stringlet sheet:stringlet sheet:stringSheet identity used by the simple data-first adapter. Defaults to sheet1.API reference →:string;
readonlystartstart: numberlet start:numberlet start:numberZero-based workbook column index of the first key.API reference →:number;
readonlyendend: numberlet end:numberlet end:numberExclusive workbook column index after the last key.API reference →:number;
if (errorerror: SheetwriteErrorlet error:SheetwriteErrorlet error:SheetwriteErrorAPI reference →.retryableSheetwriteError.retryable?: boolean | undefinedinterfaceSheetwriteError {retryable?:boolean|undefined;}interfaceSheetwriteError {retryable?:boolean|undefined;}Present only when Sheetwrite can determine retryability from the boundary itself.API reference →!==false) {
Framework initialization callbacks and Grid operational events carry the same
class identity exported by @sheetwrite/core and @sheetwrite/core/adapter.
Normal mutation denials remain mutation-rejected results/events, and
incomplete paged queries retain their explicit capability/result contracts;
they are not converted into generic exceptions.
Typed error index
Start with SheetwriteError and
isSheetwriteError. Branch on the stable
code and operation fields; use the boundary-specific classes below only when
their structured fields are needed.
SnapshotValidationError rejects malformed workbooks before partial hydration. Inspect its path-qualified errors; fix or reject the source instead of retrying unchanged bytes.
SnapshotResourceError reports bounded workbook construction. Reduce the document or explicitly raise the named host-controlled ceiling.
DelimitedTextOptionsError rejects an invalid CSV/TSV ceiling before work starts. Correct the option; retrying the same configuration cannot succeed.
DelimitedTextResourceError and XlsxResourceError retain resource, limit, and actual. Reduce the input/output or explicitly change the applicable limit.
IncompleteDataError identifies datasource pages required by the operation. Load those pages or use a visible-window operation; do not treat unloaded cells as empty.
PersistenceError retains the host load/commit cause; its code distinguishes aborted work, invalid snapshots, resource limits, missing state, and rejected commits.
IndexedDbPendingCommitStorageError distinguishes unavailable, blocked, aborted, corrupt, and quota-limited browser storage.
SyncProtocolError rejects malformed or resource-violating remote input. Fix the producer; do not replay the same payload.
SyncPendingCapacityError rejects a new local transaction before it can exceed the durable queue ceiling. Drain or reconcile pending work before retrying.
Worker startup and capability failures switch to the canvas renderer and emit renderer-fallback; observe grid.rendererKind to report the active renderer, not the requested option.