@rowsncolumns/rnc-yrs-store 0.16.0 → 0.17.0
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.
- package/dist/rnc_yrs_store.d.ts +70 -26
- package/dist/rnc_yrs_store.js +173 -26
- package/dist/rnc_yrs_store_bg.wasm +0 -0
- package/package.json +1 -1
package/dist/rnc_yrs_store.d.ts
CHANGED
|
@@ -2,13 +2,19 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Thin wasm-bindgen shell over [`
|
|
6
|
-
*
|
|
5
|
+
* Thin wasm-bindgen shell over the engine router ([`DualEngine`]: the positional v3 store or the
|
|
6
|
+
* stable-ids v5 store, by document). Bytes cross as `Uint8Array` (`Vec<u8>`/`&[u8]`), results as
|
|
7
|
+
* JSON strings, so it builds for both wasm and native.
|
|
7
8
|
*/
|
|
8
9
|
export class SpreadsheetEngine {
|
|
9
10
|
free(): void;
|
|
10
11
|
[Symbol.dispose](): void;
|
|
11
12
|
addSheet(sheet_id: number, title: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Anchor a `GridRange` on `sheet_id`: an opaque string (base64 stable range) that
|
|
15
|
+
* `resolveAnchor` resolves later, on any replica, through any structural edit.
|
|
16
|
+
*/
|
|
17
|
+
anchorRange(sheet_id: number, range_json: string): string;
|
|
12
18
|
applyCommand(json: string): string;
|
|
13
19
|
/**
|
|
14
20
|
* `applyCommand` without write recording, undo history, or a `CommitResult` diff — and with
|
|
@@ -24,11 +30,7 @@ export class SpreadsheetEngine {
|
|
|
24
30
|
*/
|
|
25
31
|
applyUpdate(bytes: Uint8Array): void;
|
|
26
32
|
/**
|
|
27
|
-
* The legacy
|
|
28
|
-
* `{"range":{startRowIndex,endRowIndex,startColumnIndex,endColumnIndex},"formula":"=…"}`, or
|
|
29
|
-
* `null` — the same shape as `rnc-engine`'s `SpreadsheetEngine.arrayFormulaAt`, which the
|
|
30
|
-
* `@rowsncolumns/rnc-engine` wrapper feature-detects (formula-bar `{…}` display, re-entry
|
|
31
|
-
* range, part-of-array checks in the editor).
|
|
33
|
+
* The legacy (CSE) or dynamic array formula covering a cell, as JSON (`null` when none).
|
|
32
34
|
*/
|
|
33
35
|
arrayFormulaAt(sheet_id: number, row: number, col: number): string;
|
|
34
36
|
/**
|
|
@@ -36,12 +38,12 @@ export class SpreadsheetEngine {
|
|
|
36
38
|
*/
|
|
37
39
|
blockCacheStats(): string;
|
|
38
40
|
/**
|
|
39
|
-
* The workbook calculation mode: `
|
|
40
|
-
* `set-calculation-mode` command.
|
|
41
|
+
* The workbook's calculation mode: `automatic`, `automaticNoTables` or `manual`.
|
|
41
42
|
*/
|
|
42
43
|
calculationMode(): string;
|
|
43
44
|
/**
|
|
44
|
-
* Manual mode: formulas may be out of date
|
|
45
|
+
* Manual mode: an edit happened since the last F9, so formulas may be out of date (Excel
|
|
46
|
+
* shows "Calculate" in the status bar).
|
|
45
47
|
*/
|
|
46
48
|
calculationPending(): boolean;
|
|
47
49
|
canRedo(): boolean;
|
|
@@ -50,6 +52,10 @@ export class SpreadsheetEngine {
|
|
|
50
52
|
* Drop the entire undo/redo history (`SpreadsheetEngineLike.clearHistory`).
|
|
51
53
|
*/
|
|
52
54
|
clearHistory(): void;
|
|
55
|
+
/**
|
|
56
|
+
* JSON array of the sheet's column ids in grid order, as decimal strings.
|
|
57
|
+
*/
|
|
58
|
+
columnIds(sheet_id: number): string;
|
|
53
59
|
/**
|
|
54
60
|
* Fold the style log into a base, keeping the newest `keep_tail` buffers live (see
|
|
55
61
|
* `YrsStore::compact_style_log`). Meant for a host holding the workbook write lease (a server
|
|
@@ -58,15 +64,7 @@ export class SpreadsheetEngine {
|
|
|
58
64
|
*/
|
|
59
65
|
compactStyleLog(keep_tail: number): string;
|
|
60
66
|
/**
|
|
61
|
-
*
|
|
62
|
-
* row-major). The windowed UI calls this so next/prev can navigate to matches outside the loaded
|
|
63
|
-
* viewport. `ranges_json` = JSON `SheetRange[]` (empty = whole sheet); match-case/whole-word/regex.
|
|
64
|
-
* Distinct fill/font colors + CF icons in one column's body rows — JSON
|
|
65
|
-
* `{cellColors, fontColors, icons}`; the "Filter by color" picker on windowed hosts.
|
|
66
|
-
* Whole-range statistics of one conditional-format rule — JSON
|
|
67
|
-
* `{count,min,max,mean,stdDev,percentiles,ranks}` or `null`. Lets a windowed host resolve CF
|
|
68
|
-
* thresholds (data bars, colour scales, icon sets, top/bottom-N, averages) over the rule's full
|
|
69
|
-
* range instead of the loaded slice.
|
|
67
|
+
* Statistics for one conditional-format rule over the request's range, as JSON.
|
|
70
68
|
*/
|
|
71
69
|
conditionalFormatRuleStats(rule_id: string, request_json: string): string;
|
|
72
70
|
/**
|
|
@@ -74,7 +72,7 @@ export class SpreadsheetEngine {
|
|
|
74
72
|
* as JSON `Vec<Vec<String>>`. The host writes the grid into the sheet via a `change-batch` command
|
|
75
73
|
* so the values compute, persist, and collaborate through the normal engine path. Quoting,
|
|
76
74
|
* embedded newlines, and ragged rows are handled by the `csv` crate.
|
|
77
|
-
* RFC 4180 CSV of one sheet's merged view (blocks + hot plane,
|
|
75
|
+
* RFC 4180 CSV of one sheet's merged view (blocks + hot plane, at current positions). Formulas
|
|
78
76
|
* export their computed display value, like Excel/Sheets "Save as CSV". One streaming pass
|
|
79
77
|
* over the store — built to run in a Web Worker for million-row sheets.
|
|
80
78
|
* Excel-style Ctrl/Cmd+Arrow target. One of `d_row`/`d_col` is ±1, the other 0; returns
|
|
@@ -93,8 +91,7 @@ export class SpreadsheetEngine {
|
|
|
93
91
|
*/
|
|
94
92
|
dataRegion(sheet_id: number, row: number, col: number): string;
|
|
95
93
|
/**
|
|
96
|
-
* The workbook's What-If data tables as
|
|
97
|
-
* rowInputCell?, columnInputCell? }`, `range` being the body (`{=TABLE(row, column)}` cells).
|
|
94
|
+
* The workbook's What-If data tables as JSON.
|
|
98
95
|
*/
|
|
99
96
|
dataTables(): string;
|
|
100
97
|
/**
|
|
@@ -142,6 +139,13 @@ export class SpreadsheetEngine {
|
|
|
142
139
|
* (`{"includeNotes":bool,"citationsAsNotes":bool}`, camelCase, fields optional).
|
|
143
140
|
*/
|
|
144
141
|
exportXlsxWithOptions(options_json: string): Uint8Array;
|
|
142
|
+
/**
|
|
143
|
+
* Off-window search: coordinates of every matching cell on `sheet_id` (JSON `SheetCoordinate[]`,
|
|
144
|
+
* row-major). The windowed UI calls this so next/prev can navigate to matches outside the loaded
|
|
145
|
+
* viewport. `ranges_json` = JSON `SheetRange[]` (empty = whole sheet); match-case/whole-word/regex.
|
|
146
|
+
* Distinct fill/font colors + CF icons in one column's body rows — JSON
|
|
147
|
+
* `{cellColors, fontColors, icons}`; the "Filter by color" picker on windowed hosts.
|
|
148
|
+
*/
|
|
145
149
|
filterColors(sheet_id: number, col: number, start_row: number, end_row: number): string;
|
|
146
150
|
findAll(sheet_id: number, ranges_json: string, find: string, match_case: boolean, whole_word: boolean, use_regex: boolean): string;
|
|
147
151
|
/**
|
|
@@ -251,6 +255,11 @@ export class SpreadsheetEngine {
|
|
|
251
255
|
loadFromUpdateQuiet(bytes: Uint8Array): void;
|
|
252
256
|
constructor();
|
|
253
257
|
parseCsv(text: string): string;
|
|
258
|
+
/**
|
|
259
|
+
* JSON `{sheetId, row, col}` (1-based) of an `rncCells` / `rncNotes` key; `undefined` for a
|
|
260
|
+
* malformed key or an orphan (its row or column was deleted).
|
|
261
|
+
*/
|
|
262
|
+
parseStableCellKey(key: string): string | undefined;
|
|
254
263
|
/**
|
|
255
264
|
* PRECEDENTS of a cell as `{cells, ranges}` JSON (`SpreadsheetEngineLike.precedents`).
|
|
256
265
|
*/
|
|
@@ -289,11 +298,27 @@ export class SpreadsheetEngine {
|
|
|
289
298
|
*/
|
|
290
299
|
registerCustomFunction(name: string): void;
|
|
291
300
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
301
|
+
* JSON `{range: GridRange | null, status: "ok" | "gone" | "unknown"}` for an `anchorRange`
|
|
302
|
+
* anchor: `gone` once every row or column of it was deleted, `unknown` while its lines have
|
|
303
|
+
* not arrived on this replica; a malformed anchor is an `Err`.
|
|
304
|
+
*/
|
|
305
|
+
resolveAnchor(anchor: string): string;
|
|
306
|
+
/**
|
|
307
|
+
* JSON array of the sheet's row ids in grid order, as decimal strings.
|
|
308
|
+
*/
|
|
309
|
+
rowIds(sheet_id: number): string;
|
|
310
|
+
/**
|
|
311
|
+
* The workbook's Scenario Manager records as a `SheetScenarios[]` JSON.
|
|
295
312
|
*/
|
|
296
313
|
scenarios(): string;
|
|
314
|
+
/**
|
|
315
|
+
* Create stable-ids (v5) documents with this engine; off by default. On, a document it creates
|
|
316
|
+
* starts as v5 — its first edit or import on a fresh engine, or a loaded document that holds no
|
|
317
|
+
* data yet. A document that holds data is never converted (existing documents stay v3), and a
|
|
318
|
+
* v5 document always runs as v5, whatever the setting. Set it from the asset's chosen version,
|
|
319
|
+
* for everyone who opens the asset. `true` when the call made the open (blank) document v5.
|
|
320
|
+
*/
|
|
321
|
+
setStableIds(enabled: boolean): boolean;
|
|
297
322
|
/**
|
|
298
323
|
* Pin the evaluation timezone for `TODAY()` / `NOW()` as minutes east of UTC (`null` /
|
|
299
324
|
* `undefined` restores the default `Local` clock). Returns `false` for an offset outside ±24h.
|
|
@@ -307,6 +332,10 @@ export class SpreadsheetEngine {
|
|
|
307
332
|
* refreshes the cells that read it.
|
|
308
333
|
*/
|
|
309
334
|
setWorkbookIdentity(directory: string, file_name: string): void;
|
|
335
|
+
/**
|
|
336
|
+
* `"v5"` while the document runs on the stable-ids store, else `"v3"`.
|
|
337
|
+
*/
|
|
338
|
+
sheetDataVersion(): string;
|
|
310
339
|
/**
|
|
311
340
|
* Per-sheet 1-based data extents as JSON `[{"sheetId", "maxRow", "maxCol"}]`.
|
|
312
341
|
*/
|
|
@@ -335,6 +364,11 @@ export class SpreadsheetEngine {
|
|
|
335
364
|
* [`YrsStore::shift_log_frontier`]).
|
|
336
365
|
*/
|
|
337
366
|
shiftLogFrontier(): string;
|
|
367
|
+
/**
|
|
368
|
+
* The `rncCells` key (`"{sheetId}:{rowId}:{colId}"`) of 1-based `(row, col)`; `undefined`
|
|
369
|
+
* while the row or column is unnamed (past the sheet's named extent). Never names lines.
|
|
370
|
+
*/
|
|
371
|
+
stableCellKey(sheet_id: number, row: number, col: number): string | undefined;
|
|
338
372
|
stateAsUpdate(): Uint8Array;
|
|
339
373
|
/**
|
|
340
374
|
* JSON `{buffers, baseBuffers, bytes, seedEntries, styledCells}` — the style history a load
|
|
@@ -377,7 +411,9 @@ export class SpreadsheetEngine {
|
|
|
377
411
|
}
|
|
378
412
|
|
|
379
413
|
/**
|
|
380
|
-
* Minimal
|
|
414
|
+
* Minimal positional (`sheetDataV3`) sheet doc + yjs v1 transport — the R0 interop spike, kept
|
|
415
|
+
* for the fixture tooling that reads a room the way the engine reads it. It knows the v3 plane
|
|
416
|
+
* only: a v5 document's cells are in `rncCells` (`libs/rnc-yrs-store/docs/v5-document-encoding.md`).
|
|
381
417
|
*/
|
|
382
418
|
export class YrsSheetDoc {
|
|
383
419
|
free(): void;
|
|
@@ -459,8 +495,10 @@ export interface InitOutput {
|
|
|
459
495
|
readonly spreadsheetengine_redoDepth: (a: number) => number;
|
|
460
496
|
readonly spreadsheetengine_registerCustomFunction: (a: number, b: number, c: number) => void;
|
|
461
497
|
readonly spreadsheetengine_scenarios: (a: number) => [number, number];
|
|
498
|
+
readonly spreadsheetengine_setStableIds: (a: number, b: number) => [number, number, number];
|
|
462
499
|
readonly spreadsheetengine_setTimezoneOffsetMinutes: (a: number, b: number) => number;
|
|
463
500
|
readonly spreadsheetengine_setWorkbookIdentity: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
501
|
+
readonly spreadsheetengine_sheetDataVersion: (a: number) => [number, number];
|
|
464
502
|
readonly spreadsheetengine_sheetExtents: (a: number) => [number, number];
|
|
465
503
|
readonly spreadsheetengine_sheetIds: (a: number) => [number, number];
|
|
466
504
|
readonly spreadsheetengine_sheetStats: (a: number) => [number, number];
|
|
@@ -478,7 +516,13 @@ export interface InitOutput {
|
|
|
478
516
|
readonly yrssheetdoc_new: () => number;
|
|
479
517
|
readonly yrssheetdoc_setCell: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
480
518
|
readonly spreadsheetengine_stateAsUpdate: (a: number) => [number, number];
|
|
519
|
+
readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
520
|
+
readonly spreadsheetengine_columnIds: (a: number, b: number) => [number, number];
|
|
521
|
+
readonly spreadsheetengine_parseStableCellKey: (a: number, b: number, c: number) => [number, number];
|
|
522
|
+
readonly spreadsheetengine_resolveAnchor: (a: number, b: number, c: number) => [number, number, number, number];
|
|
523
|
+
readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
|
|
481
524
|
readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
|
|
525
|
+
readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
|
|
482
526
|
readonly spreadsheetengine_transformRange: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
483
527
|
readonly transformRangeThroughOps: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
484
528
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
package/dist/rnc_yrs_store.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* @ts-self-types="./rnc_yrs_store.d.ts" */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Thin wasm-bindgen shell over [`
|
|
5
|
-
*
|
|
4
|
+
* Thin wasm-bindgen shell over the engine router ([`DualEngine`]: the positional v3 store or the
|
|
5
|
+
* stable-ids v5 store, by document). Bytes cross as `Uint8Array` (`Vec<u8>`/`&[u8]`), results as
|
|
6
|
+
* JSON strings, so it builds for both wasm and native.
|
|
6
7
|
*/
|
|
7
8
|
export class SpreadsheetEngine {
|
|
8
9
|
__destroy_into_raw() {
|
|
@@ -24,6 +25,33 @@ export class SpreadsheetEngine {
|
|
|
24
25
|
const len0 = WASM_VECTOR_LEN;
|
|
25
26
|
wasm.spreadsheetengine_addSheet(this.__wbg_ptr, sheet_id, ptr0, len0);
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Anchor a `GridRange` on `sheet_id`: an opaque string (base64 stable range) that
|
|
30
|
+
* `resolveAnchor` resolves later, on any replica, through any structural edit.
|
|
31
|
+
* @param {number} sheet_id
|
|
32
|
+
* @param {string} range_json
|
|
33
|
+
* @returns {string}
|
|
34
|
+
*/
|
|
35
|
+
anchorRange(sheet_id, range_json) {
|
|
36
|
+
let deferred3_0;
|
|
37
|
+
let deferred3_1;
|
|
38
|
+
try {
|
|
39
|
+
const ptr0 = passStringToWasm0(range_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
40
|
+
const len0 = WASM_VECTOR_LEN;
|
|
41
|
+
const ret = wasm.spreadsheetengine_anchorRange(this.__wbg_ptr, sheet_id, ptr0, len0);
|
|
42
|
+
var ptr2 = ret[0];
|
|
43
|
+
var len2 = ret[1];
|
|
44
|
+
if (ret[3]) {
|
|
45
|
+
ptr2 = 0; len2 = 0;
|
|
46
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
47
|
+
}
|
|
48
|
+
deferred3_0 = ptr2;
|
|
49
|
+
deferred3_1 = len2;
|
|
50
|
+
return getStringFromWasm0(ptr2, len2);
|
|
51
|
+
} finally {
|
|
52
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
27
55
|
/**
|
|
28
56
|
* @param {string} json
|
|
29
57
|
* @returns {string}
|
|
@@ -78,11 +106,7 @@ export class SpreadsheetEngine {
|
|
|
78
106
|
}
|
|
79
107
|
}
|
|
80
108
|
/**
|
|
81
|
-
* The legacy
|
|
82
|
-
* `{"range":{startRowIndex,endRowIndex,startColumnIndex,endColumnIndex},"formula":"=…"}`, or
|
|
83
|
-
* `null` — the same shape as `rnc-engine`'s `SpreadsheetEngine.arrayFormulaAt`, which the
|
|
84
|
-
* `@rowsncolumns/rnc-engine` wrapper feature-detects (formula-bar `{…}` display, re-entry
|
|
85
|
-
* range, part-of-array checks in the editor).
|
|
109
|
+
* The legacy (CSE) or dynamic array formula covering a cell, as JSON (`null` when none).
|
|
86
110
|
* @param {number} sheet_id
|
|
87
111
|
* @param {number} row
|
|
88
112
|
* @param {number} col
|
|
@@ -117,8 +141,7 @@ export class SpreadsheetEngine {
|
|
|
117
141
|
}
|
|
118
142
|
}
|
|
119
143
|
/**
|
|
120
|
-
* The workbook calculation mode: `
|
|
121
|
-
* `set-calculation-mode` command.
|
|
144
|
+
* The workbook's calculation mode: `automatic`, `automaticNoTables` or `manual`.
|
|
122
145
|
* @returns {string}
|
|
123
146
|
*/
|
|
124
147
|
calculationMode() {
|
|
@@ -134,7 +157,8 @@ export class SpreadsheetEngine {
|
|
|
134
157
|
}
|
|
135
158
|
}
|
|
136
159
|
/**
|
|
137
|
-
* Manual mode: formulas may be out of date
|
|
160
|
+
* Manual mode: an edit happened since the last F9, so formulas may be out of date (Excel
|
|
161
|
+
* shows "Calculate" in the status bar).
|
|
138
162
|
* @returns {boolean}
|
|
139
163
|
*/
|
|
140
164
|
calculationPending() {
|
|
@@ -161,6 +185,23 @@ export class SpreadsheetEngine {
|
|
|
161
185
|
clearHistory() {
|
|
162
186
|
wasm.spreadsheetengine_clearHistory(this.__wbg_ptr);
|
|
163
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* JSON array of the sheet's column ids in grid order, as decimal strings.
|
|
190
|
+
* @param {number} sheet_id
|
|
191
|
+
* @returns {string}
|
|
192
|
+
*/
|
|
193
|
+
columnIds(sheet_id) {
|
|
194
|
+
let deferred1_0;
|
|
195
|
+
let deferred1_1;
|
|
196
|
+
try {
|
|
197
|
+
const ret = wasm.spreadsheetengine_columnIds(this.__wbg_ptr, sheet_id);
|
|
198
|
+
deferred1_0 = ret[0];
|
|
199
|
+
deferred1_1 = ret[1];
|
|
200
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
201
|
+
} finally {
|
|
202
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
164
205
|
/**
|
|
165
206
|
* Fold the style log into a base, keeping the newest `keep_tail` buffers live (see
|
|
166
207
|
* `YrsStore::compact_style_log`). Meant for a host holding the workbook write lease (a server
|
|
@@ -182,15 +223,7 @@ export class SpreadsheetEngine {
|
|
|
182
223
|
}
|
|
183
224
|
}
|
|
184
225
|
/**
|
|
185
|
-
*
|
|
186
|
-
* row-major). The windowed UI calls this so next/prev can navigate to matches outside the loaded
|
|
187
|
-
* viewport. `ranges_json` = JSON `SheetRange[]` (empty = whole sheet); match-case/whole-word/regex.
|
|
188
|
-
* Distinct fill/font colors + CF icons in one column's body rows — JSON
|
|
189
|
-
* `{cellColors, fontColors, icons}`; the "Filter by color" picker on windowed hosts.
|
|
190
|
-
* Whole-range statistics of one conditional-format rule — JSON
|
|
191
|
-
* `{count,min,max,mean,stdDev,percentiles,ranks}` or `null`. Lets a windowed host resolve CF
|
|
192
|
-
* thresholds (data bars, colour scales, icon sets, top/bottom-N, averages) over the rule's full
|
|
193
|
-
* range instead of the loaded slice.
|
|
226
|
+
* Statistics for one conditional-format rule over the request's range, as JSON.
|
|
194
227
|
* @param {string} rule_id
|
|
195
228
|
* @param {string} request_json
|
|
196
229
|
* @returns {string}
|
|
@@ -216,7 +249,7 @@ export class SpreadsheetEngine {
|
|
|
216
249
|
* as JSON `Vec<Vec<String>>`. The host writes the grid into the sheet via a `change-batch` command
|
|
217
250
|
* so the values compute, persist, and collaborate through the normal engine path. Quoting,
|
|
218
251
|
* embedded newlines, and ragged rows are handled by the `csv` crate.
|
|
219
|
-
* RFC 4180 CSV of one sheet's merged view (blocks + hot plane,
|
|
252
|
+
* RFC 4180 CSV of one sheet's merged view (blocks + hot plane, at current positions). Formulas
|
|
220
253
|
* export their computed display value, like Excel/Sheets "Save as CSV". One streaming pass
|
|
221
254
|
* over the store — built to run in a Web Worker for million-row sheets.
|
|
222
255
|
* Excel-style Ctrl/Cmd+Arrow target. One of `d_row`/`d_col` is ±1, the other 0; returns
|
|
@@ -260,8 +293,7 @@ export class SpreadsheetEngine {
|
|
|
260
293
|
}
|
|
261
294
|
}
|
|
262
295
|
/**
|
|
263
|
-
* The workbook's What-If data tables as
|
|
264
|
-
* rowInputCell?, columnInputCell? }`, `range` being the body (`{=TABLE(row, column)}` cells).
|
|
296
|
+
* The workbook's What-If data tables as JSON.
|
|
265
297
|
* @returns {string}
|
|
266
298
|
*/
|
|
267
299
|
dataTables() {
|
|
@@ -431,6 +463,11 @@ export class SpreadsheetEngine {
|
|
|
431
463
|
return v2;
|
|
432
464
|
}
|
|
433
465
|
/**
|
|
466
|
+
* Off-window search: coordinates of every matching cell on `sheet_id` (JSON `SheetCoordinate[]`,
|
|
467
|
+
* row-major). The windowed UI calls this so next/prev can navigate to matches outside the loaded
|
|
468
|
+
* viewport. `ranges_json` = JSON `SheetRange[]` (empty = whole sheet); match-case/whole-word/regex.
|
|
469
|
+
* Distinct fill/font colors + CF icons in one column's body rows — JSON
|
|
470
|
+
* `{cellColors, fontColors, icons}`; the "Filter by color" picker on windowed hosts.
|
|
434
471
|
* @param {number} sheet_id
|
|
435
472
|
* @param {number} col
|
|
436
473
|
* @param {number} start_row
|
|
@@ -851,6 +888,23 @@ export class SpreadsheetEngine {
|
|
|
851
888
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
852
889
|
}
|
|
853
890
|
}
|
|
891
|
+
/**
|
|
892
|
+
* JSON `{sheetId, row, col}` (1-based) of an `rncCells` / `rncNotes` key; `undefined` for a
|
|
893
|
+
* malformed key or an orphan (its row or column was deleted).
|
|
894
|
+
* @param {string} key
|
|
895
|
+
* @returns {string | undefined}
|
|
896
|
+
*/
|
|
897
|
+
parseStableCellKey(key) {
|
|
898
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
899
|
+
const len0 = WASM_VECTOR_LEN;
|
|
900
|
+
const ret = wasm.spreadsheetengine_parseStableCellKey(this.__wbg_ptr, ptr0, len0);
|
|
901
|
+
let v2;
|
|
902
|
+
if (ret[0] !== 0) {
|
|
903
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
904
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
905
|
+
}
|
|
906
|
+
return v2;
|
|
907
|
+
}
|
|
854
908
|
/**
|
|
855
909
|
* PRECEDENTS of a cell as `{cells, ranges}` JSON (`SpreadsheetEngineLike.precedents`).
|
|
856
910
|
* @param {number} sheet_id
|
|
@@ -988,9 +1042,51 @@ export class SpreadsheetEngine {
|
|
|
988
1042
|
wasm.spreadsheetengine_registerCustomFunction(this.__wbg_ptr, ptr0, len0);
|
|
989
1043
|
}
|
|
990
1044
|
/**
|
|
991
|
-
*
|
|
992
|
-
*
|
|
993
|
-
*
|
|
1045
|
+
* JSON `{range: GridRange | null, status: "ok" | "gone" | "unknown"}` for an `anchorRange`
|
|
1046
|
+
* anchor: `gone` once every row or column of it was deleted, `unknown` while its lines have
|
|
1047
|
+
* not arrived on this replica; a malformed anchor is an `Err`.
|
|
1048
|
+
* @param {string} anchor
|
|
1049
|
+
* @returns {string}
|
|
1050
|
+
*/
|
|
1051
|
+
resolveAnchor(anchor) {
|
|
1052
|
+
let deferred3_0;
|
|
1053
|
+
let deferred3_1;
|
|
1054
|
+
try {
|
|
1055
|
+
const ptr0 = passStringToWasm0(anchor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1056
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1057
|
+
const ret = wasm.spreadsheetengine_resolveAnchor(this.__wbg_ptr, ptr0, len0);
|
|
1058
|
+
var ptr2 = ret[0];
|
|
1059
|
+
var len2 = ret[1];
|
|
1060
|
+
if (ret[3]) {
|
|
1061
|
+
ptr2 = 0; len2 = 0;
|
|
1062
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1063
|
+
}
|
|
1064
|
+
deferred3_0 = ptr2;
|
|
1065
|
+
deferred3_1 = len2;
|
|
1066
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1067
|
+
} finally {
|
|
1068
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* JSON array of the sheet's row ids in grid order, as decimal strings.
|
|
1073
|
+
* @param {number} sheet_id
|
|
1074
|
+
* @returns {string}
|
|
1075
|
+
*/
|
|
1076
|
+
rowIds(sheet_id) {
|
|
1077
|
+
let deferred1_0;
|
|
1078
|
+
let deferred1_1;
|
|
1079
|
+
try {
|
|
1080
|
+
const ret = wasm.spreadsheetengine_rowIds(this.__wbg_ptr, sheet_id);
|
|
1081
|
+
deferred1_0 = ret[0];
|
|
1082
|
+
deferred1_1 = ret[1];
|
|
1083
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1084
|
+
} finally {
|
|
1085
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* The workbook's Scenario Manager records as a `SheetScenarios[]` JSON.
|
|
994
1090
|
* @returns {string}
|
|
995
1091
|
*/
|
|
996
1092
|
scenarios() {
|
|
@@ -1005,6 +1101,22 @@ export class SpreadsheetEngine {
|
|
|
1005
1101
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1006
1102
|
}
|
|
1007
1103
|
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Create stable-ids (v5) documents with this engine; off by default. On, a document it creates
|
|
1106
|
+
* starts as v5 — its first edit or import on a fresh engine, or a loaded document that holds no
|
|
1107
|
+
* data yet. A document that holds data is never converted (existing documents stay v3), and a
|
|
1108
|
+
* v5 document always runs as v5, whatever the setting. Set it from the asset's chosen version,
|
|
1109
|
+
* for everyone who opens the asset. `true` when the call made the open (blank) document v5.
|
|
1110
|
+
* @param {boolean} enabled
|
|
1111
|
+
* @returns {boolean}
|
|
1112
|
+
*/
|
|
1113
|
+
setStableIds(enabled) {
|
|
1114
|
+
const ret = wasm.spreadsheetengine_setStableIds(this.__wbg_ptr, enabled);
|
|
1115
|
+
if (ret[2]) {
|
|
1116
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1117
|
+
}
|
|
1118
|
+
return ret[0] !== 0;
|
|
1119
|
+
}
|
|
1008
1120
|
/**
|
|
1009
1121
|
* Pin the evaluation timezone for `TODAY()` / `NOW()` as minutes east of UTC (`null` /
|
|
1010
1122
|
* `undefined` restores the default `Local` clock). Returns `false` for an offset outside ±24h.
|
|
@@ -1031,6 +1143,22 @@ export class SpreadsheetEngine {
|
|
|
1031
1143
|
const len1 = WASM_VECTOR_LEN;
|
|
1032
1144
|
wasm.spreadsheetengine_setWorkbookIdentity(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1033
1145
|
}
|
|
1146
|
+
/**
|
|
1147
|
+
* `"v5"` while the document runs on the stable-ids store, else `"v3"`.
|
|
1148
|
+
* @returns {string}
|
|
1149
|
+
*/
|
|
1150
|
+
sheetDataVersion() {
|
|
1151
|
+
let deferred1_0;
|
|
1152
|
+
let deferred1_1;
|
|
1153
|
+
try {
|
|
1154
|
+
const ret = wasm.spreadsheetengine_sheetDataVersion(this.__wbg_ptr);
|
|
1155
|
+
deferred1_0 = ret[0];
|
|
1156
|
+
deferred1_1 = ret[1];
|
|
1157
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1158
|
+
} finally {
|
|
1159
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1034
1162
|
/**
|
|
1035
1163
|
* Per-sheet 1-based data extents as JSON `[{"sheetId", "maxRow", "maxCol"}]`.
|
|
1036
1164
|
* @returns {string}
|
|
@@ -1113,6 +1241,23 @@ export class SpreadsheetEngine {
|
|
|
1113
1241
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1114
1242
|
}
|
|
1115
1243
|
}
|
|
1244
|
+
/**
|
|
1245
|
+
* The `rncCells` key (`"{sheetId}:{rowId}:{colId}"`) of 1-based `(row, col)`; `undefined`
|
|
1246
|
+
* while the row or column is unnamed (past the sheet's named extent). Never names lines.
|
|
1247
|
+
* @param {number} sheet_id
|
|
1248
|
+
* @param {number} row
|
|
1249
|
+
* @param {number} col
|
|
1250
|
+
* @returns {string | undefined}
|
|
1251
|
+
*/
|
|
1252
|
+
stableCellKey(sheet_id, row, col) {
|
|
1253
|
+
const ret = wasm.spreadsheetengine_stableCellKey(this.__wbg_ptr, sheet_id, row, col);
|
|
1254
|
+
let v1;
|
|
1255
|
+
if (ret[0] !== 0) {
|
|
1256
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
1257
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1258
|
+
}
|
|
1259
|
+
return v1;
|
|
1260
|
+
}
|
|
1116
1261
|
/**
|
|
1117
1262
|
* @returns {Uint8Array}
|
|
1118
1263
|
*/
|
|
@@ -1267,7 +1412,9 @@ export class SpreadsheetEngine {
|
|
|
1267
1412
|
if (Symbol.dispose) SpreadsheetEngine.prototype[Symbol.dispose] = SpreadsheetEngine.prototype.free;
|
|
1268
1413
|
|
|
1269
1414
|
/**
|
|
1270
|
-
* Minimal
|
|
1415
|
+
* Minimal positional (`sheetDataV3`) sheet doc + yjs v1 transport — the R0 interop spike, kept
|
|
1416
|
+
* for the fixture tooling that reads a room the way the engine reads it. It knows the v3 plane
|
|
1417
|
+
* only: a v5 document's cells are in `rncCells` (`libs/rnc-yrs-store/docs/v5-document-encoding.md`).
|
|
1271
1418
|
*/
|
|
1272
1419
|
export class YrsSheetDoc {
|
|
1273
1420
|
__destroy_into_raw() {
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rowsncolumns/rnc-yrs-store",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
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).",
|