@rowsncolumns/rnc-yrs-store 0.19.5 → 0.20.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.
@@ -146,6 +146,15 @@ export class SpreadsheetEngine {
146
146
  * (`{"includeNotes":bool,"citationsAsNotes":bool}`, camelCase, fields optional).
147
147
  */
148
148
  exportXlsxWithOptions(options_json: string): Uint8Array;
149
+ /**
150
+ * A version of `documentFacets()`: a counter that only grows and moves whenever the facets
151
+ * may have changed — a local command or a remote merge writing conditional formats,
152
+ * validations, names, tables, citations, filters, objects, sheets or the workbook record, a
153
+ * filter's hidden rows re-deriving, the conditional-format preview. While it reads the same
154
+ * as last time, `documentFacets()` returns the same JSON, so a host re-reads the facets only
155
+ * when it moved. (It can move without a change; it never stays put across one.)
156
+ */
157
+ facetVersion(): number;
149
158
  /**
150
159
  * Off-window search: coordinates of every matching cell on `sheet_id` (JSON `SheetCoordinate[]`,
151
160
  * row-major). The windowed UI calls this so next/prev can navigate to matches outside the loaded
@@ -325,6 +334,12 @@ export class SpreadsheetEngine {
325
334
  * The workbook's Scenario Manager records as a `SheetScenarios[]` JSON.
326
335
  */
327
336
  scenarios(): string;
337
+ /**
338
+ * The windows the host draws, JSON `[{sheetId, startRow, startCol, endRow, endCol}]` (1-based,
339
+ * inclusive — the `readWindow` shape; the buffered viewport plus frozen bands, say). `[]`
340
+ * clears them (commits whole again). Takes effect from the next commit.
341
+ */
342
+ setCommitWindows(windows_json: string): void;
328
343
  /**
329
344
  * Create stable-ids (v5) documents with this engine; off by default. On, a document it creates
330
345
  * starts as v5 — its first edit or import on a fresh engine, or a loaded document that holds no
@@ -338,6 +353,16 @@ export class SpreadsheetEngine {
338
353
  * `undefined` restores the default `Local` clock). Returns `false` for an offset outside ±24h.
339
354
  */
340
355
  setTimezoneOffsetMinutes(minutes?: number | null): boolean;
356
+ /**
357
+ * Declare that the host renders WINDOWED. On, and once the host has said what it draws
358
+ * (`setCommitWindows`), every commit (`applyCommand`, `undo`, `redo`, `syncRemote`,
359
+ * `flushRemoteDirty`, the loads) carries only the changed cells inside those windows on its
360
+ * per-cell channels (`changes`, `styleChanges`, `derivedFormatChanges`, `validations`,
361
+ * `noteChanges`), and `omittedCells` counts the rest; `takeOmittedCells()` hands them over.
362
+ * Every other channel is whole. Windowed with no windows set, commits stay whole — so turning
363
+ * it on alone changes nothing. Off by default.
364
+ */
365
+ setWindowed(on: boolean): void;
341
366
  /**
342
367
  * Where the workbook lives, for `CELL("filename")` — `{directory}[{fileName}]{sheet}`, so the
343
368
  * `MID(CELL("filename"),FIND("]",…)+1,…)` sheet-name idiom works — and `INFO("directory")`.
@@ -404,6 +429,14 @@ export class SpreadsheetEngine {
404
429
  * coordinate-array JSON. See [`CollabSpreadsheetEngine::take_capped_formulas_json`].
405
430
  */
406
431
  takeCappedFormulas(): string;
432
+ /**
433
+ * The per-cell entries the LAST commit left out because they fall outside the windows, JSON
434
+ * `{changes, styleChanges, derivedFormatChanges, validations, noteChanges}` in the commit's own
435
+ * shapes (every channel empty when it left none out). Taking them clears them, and the next
436
+ * commit replaces them — a reader that needs every changed cell (an agent replay) takes them
437
+ * right after the commit whose `omittedCells` was non-zero.
438
+ */
439
+ takeOmittedCells(): string;
407
440
  /**
408
441
  * Drain the merged v1 update produced by local edits since the last call (empty = nothing).
409
442
  */
@@ -486,6 +519,7 @@ export interface InitOutput {
486
519
  readonly spreadsheetengine_exportCsv: (a: number, b: number) => [number, number];
487
520
  readonly spreadsheetengine_exportXlsx: (a: number) => [number, number, number, number];
488
521
  readonly spreadsheetengine_exportXlsxWithOptions: (a: number, b: number, c: number) => [number, number, number, number];
522
+ readonly spreadsheetengine_facetVersion: (a: number) => number;
489
523
  readonly spreadsheetengine_filterColors: (a: number, b: number, c: number, d: number, e: number) => [number, number];
490
524
  readonly spreadsheetengine_findAll: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
491
525
  readonly spreadsheetengine_findAllBounded: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
@@ -516,8 +550,10 @@ export interface InitOutput {
516
550
  readonly spreadsheetengine_redoDepth: (a: number) => number;
517
551
  readonly spreadsheetengine_registerCustomFunction: (a: number, b: number, c: number) => void;
518
552
  readonly spreadsheetengine_scenarios: (a: number) => [number, number];
553
+ readonly spreadsheetengine_setCommitWindows: (a: number, b: number, c: number) => [number, number];
519
554
  readonly spreadsheetengine_setStableIds: (a: number, b: number) => [number, number, number];
520
555
  readonly spreadsheetengine_setTimezoneOffsetMinutes: (a: number, b: number) => number;
556
+ readonly spreadsheetengine_setWindowed: (a: number, b: number) => void;
521
557
  readonly spreadsheetengine_setWorkbookIdentity: (a: number, b: number, c: number, d: number, e: number) => void;
522
558
  readonly spreadsheetengine_sheetDataVersion: (a: number) => [number, number];
523
559
  readonly spreadsheetengine_sheetExtents: (a: number) => [number, number];
@@ -528,6 +564,7 @@ export interface InitOutput {
528
564
  readonly spreadsheetengine_styleLogStats: (a: number) => [number, number];
529
565
  readonly spreadsheetengine_syncRemote: (a: number) => [number, number];
530
566
  readonly spreadsheetengine_takeCappedFormulas: (a: number) => [number, number];
567
+ readonly spreadsheetengine_takeOmittedCells: (a: number) => [number, number];
531
568
  readonly spreadsheetengine_takePendingUpdates: (a: number) => [number, number];
532
569
  readonly spreadsheetengine_undo: (a: number) => [number, number];
533
570
  readonly spreadsheetengine_undoDepth: (a: number) => number;
@@ -538,13 +575,13 @@ export interface InitOutput {
538
575
  readonly yrssheetdoc_new: () => number;
539
576
  readonly yrssheetdoc_setCell: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
540
577
  readonly spreadsheetengine_stateAsUpdate: (a: number) => [number, number];
578
+ readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
541
579
  readonly spreadsheetengine_columnIds: (a: number, b: number) => [number, number];
542
580
  readonly spreadsheetengine_parseStableCellKey: (a: number, b: number, c: number) => [number, number];
543
- readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
544
- readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
545
- readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
546
581
  readonly spreadsheetengine_resolveAnchor: (a: number, b: number, c: number) => [number, number, number, number];
582
+ readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
547
583
  readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
584
+ readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
548
585
  readonly spreadsheetengine_transformRange: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
549
586
  readonly transformRangeThroughOps: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
550
587
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -481,6 +481,19 @@ export class SpreadsheetEngine {
481
481
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
482
482
  return v2;
483
483
  }
484
+ /**
485
+ * A version of `documentFacets()`: a counter that only grows and moves whenever the facets
486
+ * may have changed — a local command or a remote merge writing conditional formats,
487
+ * validations, names, tables, citations, filters, objects, sheets or the workbook record, a
488
+ * filter's hidden rows re-deriving, the conditional-format preview. While it reads the same
489
+ * as last time, `documentFacets()` returns the same JSON, so a host re-reads the facets only
490
+ * when it moved. (It can move without a change; it never stays put across one.)
491
+ * @returns {number}
492
+ */
493
+ facetVersion() {
494
+ const ret = wasm.spreadsheetengine_facetVersion(this.__wbg_ptr);
495
+ return ret;
496
+ }
484
497
  /**
485
498
  * Off-window search: coordinates of every matching cell on `sheet_id` (JSON `SheetCoordinate[]`,
486
499
  * row-major). The windowed UI calls this so next/prev can navigate to matches outside the loaded
@@ -1139,6 +1152,20 @@ export class SpreadsheetEngine {
1139
1152
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1140
1153
  }
1141
1154
  }
1155
+ /**
1156
+ * The windows the host draws, JSON `[{sheetId, startRow, startCol, endRow, endCol}]` (1-based,
1157
+ * inclusive — the `readWindow` shape; the buffered viewport plus frozen bands, say). `[]`
1158
+ * clears them (commits whole again). Takes effect from the next commit.
1159
+ * @param {string} windows_json
1160
+ */
1161
+ setCommitWindows(windows_json) {
1162
+ const ptr0 = passStringToWasm0(windows_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1163
+ const len0 = WASM_VECTOR_LEN;
1164
+ const ret = wasm.spreadsheetengine_setCommitWindows(this.__wbg_ptr, ptr0, len0);
1165
+ if (ret[1]) {
1166
+ throw takeFromExternrefTable0(ret[0]);
1167
+ }
1168
+ }
1142
1169
  /**
1143
1170
  * Create stable-ids (v5) documents with this engine; off by default. On, a document it creates
1144
1171
  * starts as v5 — its first edit or import on a fresh engine, or a loaded document that holds no
@@ -1165,6 +1192,19 @@ export class SpreadsheetEngine {
1165
1192
  const ret = wasm.spreadsheetengine_setTimezoneOffsetMinutes(this.__wbg_ptr, isLikeNone(minutes) ? Number.MAX_SAFE_INTEGER : (minutes) >> 0);
1166
1193
  return ret !== 0;
1167
1194
  }
1195
+ /**
1196
+ * Declare that the host renders WINDOWED. On, and once the host has said what it draws
1197
+ * (`setCommitWindows`), every commit (`applyCommand`, `undo`, `redo`, `syncRemote`,
1198
+ * `flushRemoteDirty`, the loads) carries only the changed cells inside those windows on its
1199
+ * per-cell channels (`changes`, `styleChanges`, `derivedFormatChanges`, `validations`,
1200
+ * `noteChanges`), and `omittedCells` counts the rest; `takeOmittedCells()` hands them over.
1201
+ * Every other channel is whole. Windowed with no windows set, commits stay whole — so turning
1202
+ * it on alone changes nothing. Off by default.
1203
+ * @param {boolean} on
1204
+ */
1205
+ setWindowed(on) {
1206
+ wasm.spreadsheetengine_setWindowed(this.__wbg_ptr, on);
1207
+ }
1168
1208
  /**
1169
1209
  * Where the workbook lives, for `CELL("filename")` — `{directory}[{fileName}]{sheet}`, so the
1170
1210
  * `MID(CELL("filename"),FIND("]",…)+1,…)` sheet-name idiom works — and `INFO("directory")`.
@@ -1373,6 +1413,26 @@ export class SpreadsheetEngine {
1373
1413
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1374
1414
  }
1375
1415
  }
1416
+ /**
1417
+ * The per-cell entries the LAST commit left out because they fall outside the windows, JSON
1418
+ * `{changes, styleChanges, derivedFormatChanges, validations, noteChanges}` in the commit's own
1419
+ * shapes (every channel empty when it left none out). Taking them clears them, and the next
1420
+ * commit replaces them — a reader that needs every changed cell (an agent replay) takes them
1421
+ * right after the commit whose `omittedCells` was non-zero.
1422
+ * @returns {string}
1423
+ */
1424
+ takeOmittedCells() {
1425
+ let deferred1_0;
1426
+ let deferred1_1;
1427
+ try {
1428
+ const ret = wasm.spreadsheetengine_takeOmittedCells(this.__wbg_ptr);
1429
+ deferred1_0 = ret[0];
1430
+ deferred1_1 = ret[1];
1431
+ return getStringFromWasm0(ret[0], ret[1]);
1432
+ } finally {
1433
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1434
+ }
1435
+ }
1376
1436
  /**
1377
1437
  * Drain the merged v1 update produced by local edits since the last call (empty = nothing).
1378
1438
  * @returns {Uint8Array}
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/rnc-yrs-store",
3
- "version": "0.19.5",
3
+ "version": "0.20.1",
4
4
  "author": "Vinay M",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "description": "Document-backed Rust→WASM spreadsheet calc engine (yrs/CRDT, canonical sheetDataV3). Ships the `SpreadsheetEngine` (a `Store<YrsStore>`): applyCommand / undo / redo / canUndo + the Yjs collaboration surface (applyUpdate / takePendingUpdates / loadFromUpdate / stateAsUpdate) the Keryx update-pump binds to. This is the 1,000,000-row engine the demo-app ships today — previously vendored, now a versioned package. The PREBUILT wasm is included (consumers need NO Rust/wasm toolchain); the glue's default init REQUIRES an explicit `module_or_path` — pass the URL of the served `rnc_yrs_store_bg.wasm` (webpack/Turbopack statically resolve a bundled `new URL`, which would 404 from this package, so the inline-default branch is intentionally a throw).",