@rowsncolumns/rnc-yrs-store 0.8.138
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/LICENSE.md +100 -0
- package/README.md +110 -0
- package/dist/rnc_yrs_store.d.ts +365 -0
- package/dist/rnc_yrs_store.js +1323 -0
- package/dist/rnc_yrs_store_bg.wasm +0 -0
- package/package.json +29 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Rows n' Columns Commercial License Agreement
|
|
2
|
+
|
|
3
|
+
This Rows n' Columns Commercial License Agreement (the "Agreement") governs
|
|
4
|
+
the use of the Rows n' Columns software packages published under the
|
|
5
|
+
`@rowsncolumns` npm scope, including associated JavaScript, WebAssembly
|
|
6
|
+
binaries, stylesheets, type definitions and documentation (the "Software").
|
|
7
|
+
|
|
8
|
+
The Software is **not** open source. Downloading or installing the Software
|
|
9
|
+
from a public package registry does not grant any right to use it beyond the
|
|
10
|
+
evaluation use described below.
|
|
11
|
+
|
|
12
|
+
## 1. Definitions
|
|
13
|
+
|
|
14
|
+
- **"Licensor"** means Rows n' Columns (rowsncolumns.app).
|
|
15
|
+
- **"Licensee"** means the individual or legal entity identified in an Order.
|
|
16
|
+
- **"Order"** means a purchase of a license for the Software from Licensor,
|
|
17
|
+
identified by an order ID and associated with a License Key.
|
|
18
|
+
- **"License Key"** means the signed key issued by Licensor that identifies
|
|
19
|
+
the Licensee, license tier, and Update Window.
|
|
20
|
+
- **"Update Window"** means the period stated in the Order during which
|
|
21
|
+
Software versions released by Licensor are covered by the License Key.
|
|
22
|
+
|
|
23
|
+
## 2. License Grant
|
|
24
|
+
|
|
25
|
+
Subject to payment of the applicable fees and compliance with this Agreement,
|
|
26
|
+
Licensor grants Licensee a non-exclusive, non-transferable, worldwide license
|
|
27
|
+
to use, and to distribute in compiled form as an embedded component of
|
|
28
|
+
Licensee's own applications, any version of the Software released during the
|
|
29
|
+
Update Window, in accordance with the license tier stated in the Order.
|
|
30
|
+
|
|
31
|
+
This grant is perpetual for versions released during the Update Window:
|
|
32
|
+
Licensee may continue to use those versions after the Update Window ends.
|
|
33
|
+
Versions released after the Update Window ends require a new or renewed
|
|
34
|
+
Order.
|
|
35
|
+
|
|
36
|
+
## 3. Evaluation Use
|
|
37
|
+
|
|
38
|
+
The Software may be used without a License Key solely for internal
|
|
39
|
+
evaluation and development purposes. Evaluation use in production, or
|
|
40
|
+
removal or suppression of evaluation notices, is not permitted.
|
|
41
|
+
|
|
42
|
+
## 4. Restrictions
|
|
43
|
+
|
|
44
|
+
Except as expressly permitted by this Agreement or by applicable law that
|
|
45
|
+
cannot be contractually waived, Licensee shall not:
|
|
46
|
+
|
|
47
|
+
1. redistribute, resell, sublicense, or otherwise make the Software
|
|
48
|
+
available as a standalone product, library, or development component;
|
|
49
|
+
2. use the Software to build a product that competes with the Software;
|
|
50
|
+
3. remove, alter, or circumvent License Key validation, evaluation notices,
|
|
51
|
+
watermarks, or copyright notices in the Software;
|
|
52
|
+
4. share License Keys with any third party, or use a License Key outside
|
|
53
|
+
the scope of the tier stated in the Order;
|
|
54
|
+
5. reverse engineer, decompile, or disassemble the Software except to the
|
|
55
|
+
extent permitted by applicable law.
|
|
56
|
+
|
|
57
|
+
## 5. Ownership
|
|
58
|
+
|
|
59
|
+
The Software is licensed, not sold. Licensor and its licensors retain all
|
|
60
|
+
right, title, and interest in and to the Software, including all
|
|
61
|
+
intellectual property rights.
|
|
62
|
+
|
|
63
|
+
## 6. Third-Party Components
|
|
64
|
+
|
|
65
|
+
The Software may include third-party open-source components. Those
|
|
66
|
+
components remain governed by their own license terms, which are included
|
|
67
|
+
with the applicable component and are not limited by this Agreement.
|
|
68
|
+
|
|
69
|
+
## 7. Termination
|
|
70
|
+
|
|
71
|
+
This Agreement terminates automatically upon material breach by Licensee
|
|
72
|
+
that remains uncured 30 days after written notice. Upon termination,
|
|
73
|
+
Licensee must cease use and distribution of the Software, except that
|
|
74
|
+
end-user copies of Licensee applications already distributed in compliance
|
|
75
|
+
with this Agreement are unaffected.
|
|
76
|
+
|
|
77
|
+
## 8. Warranty Disclaimer
|
|
78
|
+
|
|
79
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
80
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
81
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
82
|
+
|
|
83
|
+
## 9. Limitation of Liability
|
|
84
|
+
|
|
85
|
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL LICENSOR BE LIABLE
|
|
86
|
+
FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES,
|
|
87
|
+
OR ANY LOSS OF PROFITS, DATA, OR GOODWILL, ARISING OUT OF OR RELATED TO THIS
|
|
88
|
+
AGREEMENT, AND LICENSOR'S AGGREGATE LIABILITY SHALL NOT EXCEED THE FEES PAID
|
|
89
|
+
BY LICENSEE IN THE TWELVE MONTHS PRECEDING THE CLAIM.
|
|
90
|
+
|
|
91
|
+
## 10. General
|
|
92
|
+
|
|
93
|
+
This Agreement constitutes the entire agreement between the parties
|
|
94
|
+
concerning the Software and supersedes any prior agreements. If any
|
|
95
|
+
provision is held unenforceable, the remainder remains in effect. Failure to
|
|
96
|
+
enforce a provision is not a waiver.
|
|
97
|
+
|
|
98
|
+
For licensing inquiries, visit <https://www.rowsncolumns.app/pricing>.
|
|
99
|
+
|
|
100
|
+
Copyright © Rows n' Columns. All rights reserved.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# vendored `rnc-yrs-store`
|
|
2
|
+
|
|
3
|
+
Self-built artifact of the **document-backed** Rust→WASM spreadsheet calc engine from
|
|
4
|
+
[`rowsncolumns/spreadsheet#168`](https://github.com/rowsncolumns/spreadsheet/pull/168).
|
|
5
|
+
This is the `rnc-yrs-store` crate's `SpreadsheetEngine`: a `Store<YrsStore>` whose authoritative
|
|
6
|
+
state lives in a `yrs` (yjs-compatible) CRDT document, written in the canonical `sheetDataV3`
|
|
7
|
+
encoding. It supersedes the earlier in-memory `rnc-wasm` preview build — it exposes the same
|
|
8
|
+
`addSheet` / `applyCommand` / `undo` / `redo` / `canUndo` / `canRedo` surface **plus** the
|
|
9
|
+
collaboration surface (`applyUpdate` / `takePendingUpdates` / `loadFromUpdate` / `stateAsUpdate`)
|
|
10
|
+
that the Keryx update-pump binds to.
|
|
11
|
+
|
|
12
|
+
The package (`@rowsncolumns/rnc-engine`) is not yet published to npm, so the engine is vendored here.
|
|
13
|
+
|
|
14
|
+
## Contents
|
|
15
|
+
|
|
16
|
+
| File | Role |
|
|
17
|
+
| ------------------------------------------------------ | ----------------------------------------------------------------------------------- |
|
|
18
|
+
| `rnc_yrs_store.js` | wasm-bindgen JS glue (the `SpreadsheetEngine` class + init). |
|
|
19
|
+
| `rnc_yrs_store.d.ts` | Types for the glue (referenced via `@ts-self-types`). |
|
|
20
|
+
| `../../../../../public/rnc-wasm/rnc_yrs_store_bg.wasm` | The compiled engine, served as a static asset at `/rnc-wasm/rnc_yrs_store_bg.wasm`. |
|
|
21
|
+
|
|
22
|
+
## How it was built
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# from a checkout of Athena-Intel/spreadsheet @ branch bgeils/rnc-lazy-filter-derivation
|
|
26
|
+
# (private mirror of rowsncolumns/spreadsheet, based on feat/yrs-store-converged)
|
|
27
|
+
cd rust
|
|
28
|
+
wasm-pack build crates/rnc-yrs-store --target web --out-dir pkg-web --release
|
|
29
|
+
# → pkg-web/rnc_yrs_store.js, pkg-web/rnc_yrs_store.d.ts, pkg-web/rnc_yrs_store_bg.wasm
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The fix branch bumps `rnc-engine`'s `formualizer-eval` dep to `0.7` (from 0.5.9) — which
|
|
33
|
+
resolves the cold structural-recalc hang — and routes structural ops (insert/delete row/column)
|
|
34
|
+
on the capture-less CRDT store through a geometry-only fast path instead of an O(cells)
|
|
35
|
+
whole-document snapshot. Together these take an insert on a dense 100k+-cell sheet from a
|
|
36
|
+
multi-second (or unbounded) hang to sub-second.
|
|
37
|
+
|
|
38
|
+
The `rnc-engine-collab-fixes` branch builds on that and adds a remote-collab fix:
|
|
39
|
+
`apply_remote_changes` now registers a sheet a peer introduced via the merged CRDT update before
|
|
40
|
+
projecting its cells, so a remotely-authored formula enters the calc engine (it previously rendered
|
|
41
|
+
from cached values but never recomputed when a precedent changed).
|
|
42
|
+
|
|
43
|
+
The `rnc-reload-facet-sync` branch extends `snapshot_commit` (the reproject/reload render) to emit
|
|
44
|
+
the document facet planes — charts, pivots, conditional-formats, data-validations, citations —
|
|
45
|
+
mirroring `load_document`, so a peer's facet edit renders on another client's reload instead of
|
|
46
|
+
being dropped.
|
|
47
|
+
|
|
48
|
+
The `rnc-remote-bulk-block-incremental` branch makes a remote peer's cold-plane block change ingest
|
|
49
|
+
INCREMENTALLY — `apply_remote_update` re-loads only the touched bands via `bulk_load_sheet_at`
|
|
50
|
+
instead of rebuilding the whole engine (geometry shifts and block removals still fall back to a full
|
|
51
|
+
rebuild).
|
|
52
|
+
|
|
53
|
+
The `rnc-capped-formulas-loading` branch surfaces formulas the engine drops at ingest because their
|
|
54
|
+
row exceeds the 1,048,576-row calc-graph cap (rows are packed into 20 bits): they accumulate on the
|
|
55
|
+
workbook and drain into `CommitResult.cappedFormulas` so the host can warn the user instead of
|
|
56
|
+
silently losing them.
|
|
57
|
+
|
|
58
|
+
The `rnc-lazy-filter-derivation` branch makes basic-filter row visibility LAZY: `apply_filter` no
|
|
59
|
+
longer writes a `hidden_by_filter` flag per body row (an O(rows) write that bloats the doc ~50 MB at
|
|
60
|
+
1M rows), it persists only the spec's `filterSpecs`. `read_window_commit` (the windowed tile read)
|
|
61
|
+
and `snapshot_commit` (the full projection) DERIVE `hidden_by_filter` for just the rows they emit,
|
|
62
|
+
from the stored spec — so a million-row filter costs only the rows actually read, and every client
|
|
63
|
+
recomputes the same visibility (no per-row CRDT flags). `delete_filter` just clears the spec.
|
|
64
|
+
Because filter apply/delete is now spec-only (zero body cells touched), the basic-filter commands
|
|
65
|
+
(`filter-table` / `create-basic-filter` / `delete-filter`) join the structural-fast path on the
|
|
66
|
+
capture-less store: they emit `full_resync_sheets` (the host refetches tiles and re-derives
|
|
67
|
+
visibility) and skip the O(cells) snapshot/diff that otherwise hung the worker when a filter was
|
|
68
|
+
applied to a million-row windowed doc. `snapshot_commit`'s full-projection derive is capped to a
|
|
69
|
+
non-windowed-scale body (windowed docs derive per tile), so a misrouted huge doc can't 1M-row hang.
|
|
70
|
+
The actual million-row filter "hang" was PER-ROW store reads in `read_window_commit`'s filter
|
|
71
|
+
branch: the value-filter derivation called `get_cell` per body row (~512/tile) and the dims merge
|
|
72
|
+
called `get_dimension` per row — each opens a yrs read transaction on the 1M doc, so ~512–1024
|
|
73
|
+
per-row reads/tile cost ~12s and the grid's stream of tile reads saturated the single worker
|
|
74
|
+
thread, leaving the filter command queued forever. Fixes: `read_window_commit` now (a) derives
|
|
75
|
+
visibility from the cells it ALREADY fetched via one `get_range` (passes a (row,col)->text map into
|
|
76
|
+
the filter's value path instead of per-row `get_cell`; a tile spans all columns so a miss = empty
|
|
77
|
+
cell), and (b) emits only the derived `hidden_by_filter` flag with no per-row dim reads (persisted
|
|
78
|
+
heights/hidden*by_user fold in from the initial windowed load), and (c) evaluates simple comparison
|
|
79
|
+
CONDITIONS (NUMBER*\_, TEXT\_\_, BLANK) directly in Rust against that same tile-cell text
|
|
80
|
+
(`condition_matches_text`) instead of `eval_formula_truthy` per row — the formula path loads a
|
|
81
|
+
calc-engine band per row it touches, so a million-row condition filter's full-doc scan otherwise
|
|
82
|
+
triggered ~hundreds of band loads (~seconds each). Aggregate/date/custom/list conditions (and the
|
|
83
|
+
full-projection path) still fall back to the formula engine. (Re-attaching a custom body-row height
|
|
84
|
+
under an active filter — one batched dim read — is a tracked follow-up.)
|
|
85
|
+
|
|
86
|
+
The `rnc-filter-ranges-on-commit` branch makes the host drive filter visibility from the engine's
|
|
87
|
+
COMPACT hidden-row ranges instead of a per-tile/per-row scan, fixing two ways the prior lazy approach
|
|
88
|
+
made a 1M filter feel broken. (1) `document_facets_json` exposes `hiddenRowRanges` per basic filter —
|
|
89
|
+
the contiguous `[start,end]` body rows the filter hides, from one filtered-column pass — read through a
|
|
90
|
+
per-sheet memo (`filter_ranges_cache`): computed on a miss, invalidated by `apply_command` only on a
|
|
91
|
+
filter command, a geometry shift, or an edit to a filtered column, and cleared on load / remote merge.
|
|
92
|
+
So the full scan runs ONCE per filter change, not on every facets refresh (which fires on every edit).
|
|
93
|
+
The host expands these ranges into the grid's `rowMetadata.hiddenByFilter` in one shot, so the grid has
|
|
94
|
+
the complete filtered layout without fetching every tile to learn it. (2) `row_visible_under_filter`
|
|
95
|
+
now treats an absent filtered cell as `""` and `condition_matches_text` coerces a blank cell to `0` for
|
|
96
|
+
`NUMBER_*` (matching the formula engine), so a sparse/blank column under a simple condition decides on
|
|
97
|
+
the fast path instead of a per-row `eval_formula_truthy` band load (which hung the worker). (Driving the
|
|
98
|
+
grid's native `visibleRowRanges` directly — bypassing the per-row overlay entirely — is a tracked
|
|
99
|
+
follow-up that needs a vendored-`CanvasGrid` change.)
|
|
100
|
+
|
|
101
|
+
## Local modification
|
|
102
|
+
|
|
103
|
+
`rnc_yrs_store.js` is generated, except for one deliberate edit: the default-init branch
|
|
104
|
+
`module_or_path = new URL('rnc_yrs_store_bg.wasm', import.meta.url)` is replaced with a
|
|
105
|
+
`throw`. webpack statically resolves `new URL(<literal>, import.meta.url)` at build
|
|
106
|
+
time and would fail to find the wasm from this `src/` location, so callers MUST pass
|
|
107
|
+
an explicit path. `use-rnc-engine.ts` passes the public URL (`/rnc-wasm/rnc_yrs_store_bg.wasm`).
|
|
108
|
+
|
|
109
|
+
This directory is excluded from Biome (see `olympus/biome.json`); do not hand-format it.
|
|
110
|
+
To refresh, re-run the build above, re-copy the three files, and re-apply the one edit.
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Thin wasm-bindgen shell over [`YDocEngine`]. Bytes cross as `Uint8Array` (`Vec<u8>`/`&[u8]`),
|
|
6
|
+
* results as JSON strings — matching `YrsSheetDoc`, so it builds for both wasm and native.
|
|
7
|
+
*/
|
|
8
|
+
export class SpreadsheetEngine {
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
addSheet(sheet_id: number, title: string): void;
|
|
12
|
+
applyCommand(json: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* `applyCommand` without write recording, undo history, or a `CommitResult` diff — and with
|
|
15
|
+
* `change-batch` eligible for the dense bulk path (>500k cells on an empty sheet land as
|
|
16
|
+
* column blocks). For hosts that discard the result, e.g. backend bulk ingestion.
|
|
17
|
+
*/
|
|
18
|
+
applyCommandQuiet(json: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Merge a remote v1 update into the CRDT doc (`CollabSync.applyUpdate`); follow with `syncRemote()`
|
|
21
|
+
* to project + render. Split out of the old apply+project+commit so `useSpreadsheetEngine`'s collab
|
|
22
|
+
* bridge can drive applyUpdate→syncRemote without projecting twice. (`apply_remote_update` on the
|
|
23
|
+
* inner engine still does both in one call for the older bespoke/worker path.)
|
|
24
|
+
*/
|
|
25
|
+
applyUpdate(bytes: Uint8Array): void;
|
|
26
|
+
/**
|
|
27
|
+
* Cold-block body cache diagnostics as JSON `{"hits", "misses", "bytes"}`.
|
|
28
|
+
*/
|
|
29
|
+
blockCacheStats(): string;
|
|
30
|
+
canRedo(): boolean;
|
|
31
|
+
canUndo(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Drop the entire undo/redo history (`SpreadsheetEngineLike.clearHistory`).
|
|
34
|
+
*/
|
|
35
|
+
clearHistory(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Parse CSV text into a row-major grid of cell strings using the fast Rust `csv` reader, returned
|
|
38
|
+
* as JSON `Vec<Vec<String>>`. The host writes the grid into the sheet via a `change-batch` command
|
|
39
|
+
* so the values compute, persist, and collaborate through the normal engine path. Quoting,
|
|
40
|
+
* embedded newlines, and ragged rows are handled by the `csv` crate.
|
|
41
|
+
* RFC 4180 CSV of one sheet's merged view (blocks + hot plane, geometry-aware). Formulas
|
|
42
|
+
* export their computed display value, like Excel/Sheets "Save as CSV". One streaming pass
|
|
43
|
+
* over the store — built to run in a Web Worker for million-row sheets.
|
|
44
|
+
* Excel-style Ctrl/Cmd+Arrow target. One of `d_row`/`d_col` is ±1, the other 0; returns
|
|
45
|
+
* the moved coordinate (row for vertical, column for horizontal), 1-based.
|
|
46
|
+
*/
|
|
47
|
+
dataEdge(sheet_id: number, row: number, col: number, d_row: number, d_col: number, limit: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* How many inbound updates are deferred on a causal gap (a dropped/reordered transport
|
|
50
|
+
* drain). Zero in a healthy stream; persistently non-zero means the host should run a
|
|
51
|
+
* state-vector diff exchange (`encodeStateVector`/`encodeDiffV1`) to fill the gap.
|
|
52
|
+
*/
|
|
53
|
+
deferredRemoteUpdates(): number;
|
|
54
|
+
/**
|
|
55
|
+
* DEPENDENTS of a cell as a coordinate-array JSON (`SpreadsheetEngineLike.dependents`).
|
|
56
|
+
*/
|
|
57
|
+
dependents(sheet_id: number, row: number, col: number): string;
|
|
58
|
+
/**
|
|
59
|
+
* Document-level facets JSON: basicFilters, conditionalFormats, dataValidations,
|
|
60
|
+
* citations, namedRanges, tables, embeds.
|
|
61
|
+
*/
|
|
62
|
+
documentFacets(): string;
|
|
63
|
+
/**
|
|
64
|
+
* The v1 diff the remote (by its state vector) is missing (`CollabSync.encodeDiffV1`) — apply the
|
|
65
|
+
* result to the transport `Y.Doc` to propagate this peer's local edits.
|
|
66
|
+
*/
|
|
67
|
+
encodeDiffV1(remote_state_vector: Uint8Array): Uint8Array;
|
|
68
|
+
/**
|
|
69
|
+
* Full document state as a v1 update (`CollabSync.encodeStateAsUpdate`) — the same bytes as
|
|
70
|
+
* `stateAsUpdate`, under the name `useSpreadsheetEngine`'s collab bridge calls.
|
|
71
|
+
*/
|
|
72
|
+
encodeStateAsUpdate(): Uint8Array;
|
|
73
|
+
/**
|
|
74
|
+
* This peer's Yjs state vector — what it has seen (`CollabSync.encodeStateVector`).
|
|
75
|
+
*/
|
|
76
|
+
encodeStateVector(): Uint8Array;
|
|
77
|
+
/**
|
|
78
|
+
* Scratch-evaluate a formula at a cell — `ExtendedValue` JSON or `"null"`. Read-only; powers
|
|
79
|
+
* the cell editor's live result preview (`onRequestCalculate`).
|
|
80
|
+
*/
|
|
81
|
+
evalFormula(sheet_id: number, row: number, col: number, formula: string): string;
|
|
82
|
+
exportCsv(sheet_id: number): string;
|
|
83
|
+
/**
|
|
84
|
+
* Export the whole workbook to in-memory XLSX bytes (a JS `Uint8Array`). The merged block+hot
|
|
85
|
+
* view of every sheet via the `rnc-export` writer; read-only, no recompute.
|
|
86
|
+
*/
|
|
87
|
+
exportXlsx(): Uint8Array;
|
|
88
|
+
/**
|
|
89
|
+
* [`exportXlsx`] with client export options JSON
|
|
90
|
+
* (`{"includeNotes":bool,"citationsAsNotes":bool}`, camelCase, fields optional).
|
|
91
|
+
*/
|
|
92
|
+
exportXlsxWithOptions(options_json: string): Uint8Array;
|
|
93
|
+
/**
|
|
94
|
+
* Off-window search: coordinates of every matching cell on `sheet_id` (JSON `SheetCoordinate[]`,
|
|
95
|
+
* row-major). The windowed UI calls this so next/prev can navigate to matches outside the loaded
|
|
96
|
+
* viewport. `ranges_json` = JSON `SheetRange[]` (empty = whole sheet); match-case/whole-word/regex.
|
|
97
|
+
* Distinct fill/font colors + CF icons in one column's body rows — JSON
|
|
98
|
+
* `{cellColors, fontColors, icons}`; the "Filter by color" picker on windowed hosts.
|
|
99
|
+
*/
|
|
100
|
+
filterColors(sheet_id: number, col: number, start_row: number, end_row: number): string;
|
|
101
|
+
findAll(sheet_id: number, ranges_json: string, find: string, match_case: boolean, whole_word: boolean, use_regex: boolean): string;
|
|
102
|
+
/**
|
|
103
|
+
* Stream CSV text into the sheet's dense column blocks anchored at `(start_row, start_col)`
|
|
104
|
+
* (1-based); returns the number of rows written. Designed to run in a Web Worker: one synchronous
|
|
105
|
+
* call ingests the whole file off the main thread, after which the host takes the pending update
|
|
106
|
+
* and applies it to the collaborative document.
|
|
107
|
+
*
|
|
108
|
+
* Unlike the prior path — which materialized the whole grid as a single `change-batch` `Value`
|
|
109
|
+
* (≈50M `Value` nodes for a 10M-row file, the wasm-heap OOM) — this routes each row straight into
|
|
110
|
+
* the dense bulk path (one block write per column·32k-row stripe), and SKIPS the calc engine for a
|
|
111
|
+
* literal-only CSV (no formulas), so a 10M-row import stays well under the wasm 4 GiB ceiling.
|
|
112
|
+
*/
|
|
113
|
+
importCsv(text: string, sheet_id: number, start_row: number, start_col: number): number;
|
|
114
|
+
/**
|
|
115
|
+
* Bulk-import an xlsx workbook; returns a JSON summary `[{sheetId, name, rows, cols}]`.
|
|
116
|
+
*/
|
|
117
|
+
importXlsx(bytes: Uint8Array): string;
|
|
118
|
+
/**
|
|
119
|
+
* Import exactly ONE sheet of the workbook — `sheet_id` is the positional (1-based) `sheetId`
|
|
120
|
+
* from [`listXlsxSheets`](Self::list_xlsx_sheets). Pass `finalize: false` on every call but the
|
|
121
|
+
* sequence's last: intermediate calls skip the whole-document recalc and the workbook-level
|
|
122
|
+
* facets (named ranges, slicers, pivots, calcPr, Power Query), which land on the `finalize`
|
|
123
|
+
* call together with the engine rebuild + recalc (or its over-cap skip — check
|
|
124
|
+
* [`lastImportRecalcSkipped`](Self::last_import_recalc_skipped) after finalizing). For a
|
|
125
|
+
* single-call import pass `finalize: true`. Returns `[{"sheetId": …, "name": …}]` for the
|
|
126
|
+
* imported sheet. See [`YDocEngine::import_xlsx_sheet`] for the full contract.
|
|
127
|
+
*/
|
|
128
|
+
importXlsxSheet(bytes: Uint8Array, sheet_id: number, finalize: boolean): string;
|
|
129
|
+
/**
|
|
130
|
+
* [`importXlsxSheet`](Self::import_xlsx_sheet) selecting the sheet by its display name
|
|
131
|
+
* (matched exactly against the workbook's `<sheet name=…>`).
|
|
132
|
+
*/
|
|
133
|
+
importXlsxSheetByName(bytes: Uint8Array, sheet_name: string, finalize: boolean): string;
|
|
134
|
+
/**
|
|
135
|
+
* Like [`SpreadsheetEngine::import_xlsx`] but for password-protected workbooks (ECMA-376 agile,
|
|
136
|
+
* standard AES, or RC4 CryptoAPI):
|
|
137
|
+
* decrypts with `password`, then runs the identical streaming import on the plaintext. A
|
|
138
|
+
* non-encrypted file imports directly (password ignored); a wrong password rejects with an error
|
|
139
|
+
* the UI can re-prompt on.
|
|
140
|
+
*/
|
|
141
|
+
importXlsxWithPassword(bytes: Uint8Array, password: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* Whether the bytes are an encrypted (OLE/CFB) workbook needing a password (vs a plain `.xlsx`).
|
|
144
|
+
*/
|
|
145
|
+
isEncryptedXlsx(bytes: Uint8Array): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Whether the last `importXlsx` skipped its post-import recalc (workbook past the recalc
|
|
148
|
+
* caps). See [`YDocEngine::last_import_recalc_skipped`].
|
|
149
|
+
*/
|
|
150
|
+
lastImportRecalcSkipped(): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Catalog the workbook's sheets WITHOUT ingesting any cells — JSON
|
|
153
|
+
* `[{sheetId, index, name, hidden}]` in tab order. The first step of the sheet-scoped import
|
|
154
|
+
* flow: list, then [`importXlsxSheet`](Self::import_xlsx_sheet) per sheet (in workbook order),
|
|
155
|
+
* draining `encodeDiffV1` between calls so each delta carries one sheet, not the workbook.
|
|
156
|
+
*/
|
|
157
|
+
listXlsxSheets(bytes: Uint8Array): string;
|
|
158
|
+
/**
|
|
159
|
+
* Hydrate the engine from an initial document JSON (`{ sheets, sheetData, styles }`); returns the
|
|
160
|
+
* full `CommitResult` JSON (`SpreadsheetEngineLike.loadDocument`).
|
|
161
|
+
*/
|
|
162
|
+
loadDocument(document_json: string): string;
|
|
163
|
+
/**
|
|
164
|
+
* Bulk-load a peer's full-state snapshot (`stateAsUpdate`) and rebuild the calc engine — the
|
|
165
|
+
* join/bootstrap path. Returns a `CommitResult` JSON of every loaded cell (render the restored
|
|
166
|
+
* document in one shot). Not echoed back to the transport.
|
|
167
|
+
*/
|
|
168
|
+
loadFromUpdate(bytes: Uint8Array): string;
|
|
169
|
+
/**
|
|
170
|
+
* Load a full-state snapshot WITHOUT building the render commit — for hosts that already have
|
|
171
|
+
* the render projection (engine hydration for editing, the bulk-import worker). Skipping the
|
|
172
|
+
* 500k-cell snapshot serialization saves seconds on huge documents.
|
|
173
|
+
*/
|
|
174
|
+
loadFromUpdateQuiet(bytes: Uint8Array): void;
|
|
175
|
+
constructor();
|
|
176
|
+
parseCsv(text: string): string;
|
|
177
|
+
/**
|
|
178
|
+
* PRECEDENTS of a cell as `{cells, ranges}` JSON (`SpreadsheetEngineLike.precedents`).
|
|
179
|
+
*/
|
|
180
|
+
precedents(sheet_id: number, row: number, col: number): string;
|
|
181
|
+
/**
|
|
182
|
+
* Remove the host-seeded default `Sheet1` (sheetId 1) when a collab merge showed the
|
|
183
|
+
* workbook's real sheets live under other ids — see [`YDocEngine::prune_dangling_default_seed`]
|
|
184
|
+
* for the contract. Call right after merging the collab doc, and ONLY when the persisted doc's
|
|
185
|
+
* sheet registry is non-empty and contains no `sheetId: 1`. Returns `true` when pruned.
|
|
186
|
+
*/
|
|
187
|
+
pruneDanglingDefaultSeed(): boolean;
|
|
188
|
+
readWindow(sheet_id: number, start_row: number, start_col: number, end_row: number, end_col: number): string;
|
|
189
|
+
/**
|
|
190
|
+
* A window's cells + effective styles as COMPACT JSON —
|
|
191
|
+
* `{"cells":[[row,col,cell],…],"styles":[[row,col,format],…]}` (1-based, inclusive). For
|
|
192
|
+
* snapshot/export tooling tiling a whole sheet: the same cell payload `readWindowCommit`
|
|
193
|
+
* carries, minus its render channels (per-tile filter-hidden derivation, row dims) and the
|
|
194
|
+
* per-cell change-wrapper objects — a fraction of the JSON to serialize and parse.
|
|
195
|
+
*/
|
|
196
|
+
readWindowCells(sheet_id: number, start_row: number, start_col: number, end_row: number, end_col: number): string;
|
|
197
|
+
/**
|
|
198
|
+
* A rectangular window of FULL cells + styles as `CommitResult` JSON, for windowed rendering
|
|
199
|
+
* of huge sheets (fold each tile with the same machinery as any other commit).
|
|
200
|
+
*/
|
|
201
|
+
readWindowCommit(sheet_id: number, start_row: number, start_col: number, end_row: number, end_col: number): string;
|
|
202
|
+
/**
|
|
203
|
+
* Force the full engine rebuild + recalc a capped import skipped. Can run minutes / trap on
|
|
204
|
+
* monster workbooks — callers must encode the doc state they need BEFORE calling, in a heap
|
|
205
|
+
* they can discard on failure. See [`YDocEngine::rebuild_and_recalc`].
|
|
206
|
+
*/
|
|
207
|
+
rebuildAndRecalc(): void;
|
|
208
|
+
redo(): string;
|
|
209
|
+
redoDepth(): number;
|
|
210
|
+
/**
|
|
211
|
+
* Register a host (JS) custom-function name (`SpreadsheetEngineLike.registerCustomFunction`).
|
|
212
|
+
*/
|
|
213
|
+
registerCustomFunction(name: string): void;
|
|
214
|
+
/**
|
|
215
|
+
* Per-sheet 1-based data extents as JSON `[{"sheetId", "maxRow", "maxCol"}]`.
|
|
216
|
+
*/
|
|
217
|
+
sheetExtents(): string;
|
|
218
|
+
/**
|
|
219
|
+
* The workbook's sheet ids in tab order (`SpreadsheetEngineLike.sheetIds()`).
|
|
220
|
+
*/
|
|
221
|
+
sheetIds(): Int32Array;
|
|
222
|
+
/**
|
|
223
|
+
* Per-sheet populated stats as JSON —
|
|
224
|
+
* `[{"sheetId","minRow","minCol","maxRow","maxCol","cellCount"}, …]`. `cellCount` counts
|
|
225
|
+
* POPULATED cells (not the dense extent product) and `minRow`/`minCol` complete the bounding
|
|
226
|
+
* box, so hosts can budget reads honestly on sparse sheets. Empty sheets report all-zeros.
|
|
227
|
+
* Presence-derived (block headers + hot-plane coords); cheap even on million-row sheets.
|
|
228
|
+
*/
|
|
229
|
+
sheetStats(): string;
|
|
230
|
+
/**
|
|
231
|
+
* The workbook's sheets in tab order as JSON `[{sheetId, title, index, hidden?, tabColor?}]` —
|
|
232
|
+
* the engine's authoritative sheet identity/order/titles. Mirrors `SpreadsheetEngineLike.sheets()`
|
|
233
|
+
* (see `@rowsncolumns/rnc-engine`) so the Option-B chrome reconciles its tab list after each commit.
|
|
234
|
+
*/
|
|
235
|
+
sheets(): string;
|
|
236
|
+
stateAsUpdate(): Uint8Array;
|
|
237
|
+
/**
|
|
238
|
+
* Project the cells touched by the preceding `applyUpdate` and return the `CommitResult` JSON
|
|
239
|
+
* (`CollabSync.syncRemote`).
|
|
240
|
+
*/
|
|
241
|
+
syncRemote(): string;
|
|
242
|
+
/**
|
|
243
|
+
* Drain the row-capped dropped formulas accumulated by bulk ingests/imports, as a
|
|
244
|
+
* coordinate-array JSON. See [`CollabSpreadsheetEngine::take_capped_formulas_json`].
|
|
245
|
+
*/
|
|
246
|
+
takeCappedFormulas(): string;
|
|
247
|
+
/**
|
|
248
|
+
* Drain the merged v1 update produced by local edits since the last call (empty = nothing).
|
|
249
|
+
*/
|
|
250
|
+
takePendingUpdates(): Uint8Array;
|
|
251
|
+
undo(): string;
|
|
252
|
+
/**
|
|
253
|
+
* Undo / redo stack depth (`SpreadsheetEngineLike.undoDepth` / `redoDepth`).
|
|
254
|
+
*/
|
|
255
|
+
undoDepth(): number;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Minimal yrs-backed sheet doc exposing the canonical `sheetDataV3` encoding + yjs v1 transport.
|
|
260
|
+
*/
|
|
261
|
+
export class YrsSheetDoc {
|
|
262
|
+
free(): void;
|
|
263
|
+
[Symbol.dispose](): void;
|
|
264
|
+
applyUpdate(update: Uint8Array): void;
|
|
265
|
+
encodeStateAsUpdate(): Uint8Array;
|
|
266
|
+
getCell(sheet_id: number, row: number, col: number): string | undefined;
|
|
267
|
+
constructor();
|
|
268
|
+
setCell(sheet_id: number, row: number, col: number, cell_json: string): void;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
272
|
+
|
|
273
|
+
export interface InitOutput {
|
|
274
|
+
readonly memory: WebAssembly.Memory;
|
|
275
|
+
readonly __wbg_yrssheetdoc_free: (a: number, b: number) => void;
|
|
276
|
+
readonly yrssheetdoc_new: () => number;
|
|
277
|
+
readonly yrssheetdoc_setCell: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
278
|
+
readonly yrssheetdoc_getCell: (a: number, b: number, c: number, d: number) => [number, number];
|
|
279
|
+
readonly yrssheetdoc_applyUpdate: (a: number, b: number, c: number) => [number, number];
|
|
280
|
+
readonly yrssheetdoc_encodeStateAsUpdate: (a: number) => [number, number];
|
|
281
|
+
readonly __wbg_spreadsheetengine_free: (a: number, b: number) => void;
|
|
282
|
+
readonly spreadsheetengine_new: () => number;
|
|
283
|
+
readonly spreadsheetengine_addSheet: (a: number, b: number, c: number, d: number) => void;
|
|
284
|
+
readonly spreadsheetengine_applyCommand: (a: number, b: number, c: number) => [number, number, number, number];
|
|
285
|
+
readonly spreadsheetengine_applyCommandQuiet: (a: number, b: number, c: number) => [number, number];
|
|
286
|
+
readonly spreadsheetengine_dataEdge: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
287
|
+
readonly spreadsheetengine_documentFacets: (a: number) => [number, number];
|
|
288
|
+
readonly spreadsheetengine_sheets: (a: number) => [number, number];
|
|
289
|
+
readonly spreadsheetengine_sheetIds: (a: number) => [number, number];
|
|
290
|
+
readonly spreadsheetengine_pruneDanglingDefaultSeed: (a: number) => number;
|
|
291
|
+
readonly spreadsheetengine_loadDocument: (a: number, b: number, c: number) => [number, number, number, number];
|
|
292
|
+
readonly spreadsheetengine_registerCustomFunction: (a: number, b: number, c: number) => void;
|
|
293
|
+
readonly spreadsheetengine_precedents: (a: number, b: number, c: number, d: number) => [number, number];
|
|
294
|
+
readonly spreadsheetengine_dependents: (a: number, b: number, c: number, d: number) => [number, number];
|
|
295
|
+
readonly spreadsheetengine_takeCappedFormulas: (a: number) => [number, number];
|
|
296
|
+
readonly spreadsheetengine_clearHistory: (a: number) => void;
|
|
297
|
+
readonly spreadsheetengine_undoDepth: (a: number) => number;
|
|
298
|
+
readonly spreadsheetengine_redoDepth: (a: number) => number;
|
|
299
|
+
readonly spreadsheetengine_importXlsx: (a: number, b: number, c: number) => [number, number, number, number];
|
|
300
|
+
readonly spreadsheetengine_importXlsxWithPassword: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
301
|
+
readonly spreadsheetengine_isEncryptedXlsx: (a: number, b: number, c: number) => number;
|
|
302
|
+
readonly spreadsheetengine_listXlsxSheets: (a: number, b: number, c: number) => [number, number, number, number];
|
|
303
|
+
readonly spreadsheetengine_importXlsxSheet: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
304
|
+
readonly spreadsheetengine_importXlsxSheetByName: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
305
|
+
readonly spreadsheetengine_lastImportRecalcSkipped: (a: number) => number;
|
|
306
|
+
readonly spreadsheetengine_rebuildAndRecalc: (a: number) => void;
|
|
307
|
+
readonly spreadsheetengine_exportCsv: (a: number, b: number) => [number, number];
|
|
308
|
+
readonly spreadsheetengine_exportXlsx: (a: number) => [number, number, number, number];
|
|
309
|
+
readonly spreadsheetengine_exportXlsxWithOptions: (a: number, b: number, c: number) => [number, number, number, number];
|
|
310
|
+
readonly spreadsheetengine_parseCsv: (a: number, b: number, c: number) => [number, number, number, number];
|
|
311
|
+
readonly spreadsheetengine_importCsv: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
312
|
+
readonly spreadsheetengine_undo: (a: number) => [number, number];
|
|
313
|
+
readonly spreadsheetengine_redo: (a: number) => [number, number];
|
|
314
|
+
readonly spreadsheetengine_canUndo: (a: number) => number;
|
|
315
|
+
readonly spreadsheetengine_canRedo: (a: number) => number;
|
|
316
|
+
readonly spreadsheetengine_readWindow: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
317
|
+
readonly spreadsheetengine_evalFormula: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
318
|
+
readonly spreadsheetengine_filterColors: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
319
|
+
readonly spreadsheetengine_findAll: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
320
|
+
readonly spreadsheetengine_readWindowCommit: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
321
|
+
readonly spreadsheetengine_readWindowCells: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
322
|
+
readonly spreadsheetengine_sheetExtents: (a: number) => [number, number];
|
|
323
|
+
readonly spreadsheetengine_sheetStats: (a: number) => [number, number];
|
|
324
|
+
readonly spreadsheetengine_blockCacheStats: (a: number) => [number, number];
|
|
325
|
+
readonly spreadsheetengine_applyUpdate: (a: number, b: number, c: number) => [number, number];
|
|
326
|
+
readonly spreadsheetengine_syncRemote: (a: number) => [number, number];
|
|
327
|
+
readonly spreadsheetengine_loadFromUpdate: (a: number, b: number, c: number) => [number, number, number, number];
|
|
328
|
+
readonly spreadsheetengine_loadFromUpdateQuiet: (a: number, b: number, c: number) => [number, number];
|
|
329
|
+
readonly spreadsheetengine_takePendingUpdates: (a: number) => [number, number];
|
|
330
|
+
readonly spreadsheetengine_encodeStateAsUpdate: (a: number) => [number, number];
|
|
331
|
+
readonly spreadsheetengine_encodeStateVector: (a: number) => [number, number];
|
|
332
|
+
readonly spreadsheetengine_encodeDiffV1: (a: number, b: number, c: number) => [number, number, number, number];
|
|
333
|
+
readonly spreadsheetengine_deferredRemoteUpdates: (a: number) => number;
|
|
334
|
+
readonly spreadsheetengine_stateAsUpdate: (a: number) => [number, number];
|
|
335
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
336
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
337
|
+
readonly __externref_table_alloc: () => number;
|
|
338
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
339
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
340
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
341
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
342
|
+
readonly __wbindgen_start: () => void;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
349
|
+
* a precompiled `WebAssembly.Module`.
|
|
350
|
+
*
|
|
351
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
352
|
+
*
|
|
353
|
+
* @returns {InitOutput}
|
|
354
|
+
*/
|
|
355
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
359
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
360
|
+
*
|
|
361
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
362
|
+
*
|
|
363
|
+
* @returns {Promise<InitOutput>}
|
|
364
|
+
*/
|
|
365
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|