logisheets-runtime 1.7.1 → 1.9.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/README.md +88 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# logisheets-runtime
|
|
2
|
+
|
|
3
|
+
A **headless LogiSheets spreadsheet runtime for Node** — the Node counterpart of
|
|
4
|
+
the browser app. It wires the engine-neutral logic in
|
|
5
|
+
[`logisheets-core`](https://www.npmjs.com/package/logisheets-core) to the Node
|
|
6
|
+
WASM engine, so you can read, manipulate, and write real `.xlsx` files on the
|
|
7
|
+
server with no browser and no UI.
|
|
8
|
+
|
|
9
|
+
A single `SpreadsheetRuntime` owns many open workbooks at once; every operation
|
|
10
|
+
runs against a specific `Workbook` handle. All workbook logic comes from
|
|
11
|
+
`logisheets-core`'s `WorkbookOps` — the runtime only adapts the synchronous Node
|
|
12
|
+
`handle()` entry point into the async `Client` that layer expects.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install logisheets-runtime
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
It pulls in `logisheets` (the Node WASM engine) and `logisheets-core`. ESM-only;
|
|
21
|
+
requires a recent Node with WASM support.
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import {SpreadsheetRuntime} from 'logisheets-runtime'
|
|
27
|
+
|
|
28
|
+
const rt = new SpreadsheetRuntime()
|
|
29
|
+
|
|
30
|
+
// Open workbooks from disk, from bytes, or create empty ones.
|
|
31
|
+
const wb1 = await rt.loadWorkbook('a.xlsx')
|
|
32
|
+
const wb2 = rt.createWorkbook()
|
|
33
|
+
|
|
34
|
+
// Drive edits through the shared core operation layer.
|
|
35
|
+
await wb1.ops.inputCell(0, 0, 0, 'Hello') // sheet 0, cell A1
|
|
36
|
+
await wb1.ops.createSheet(1, 'Summary')
|
|
37
|
+
|
|
38
|
+
// Read evaluated values straight off the handle.
|
|
39
|
+
const v = wb1.getValue(0, 0, 0)
|
|
40
|
+
|
|
41
|
+
// Undo / redo history is per workbook.
|
|
42
|
+
await wb1.undo()
|
|
43
|
+
await wb1.redo()
|
|
44
|
+
|
|
45
|
+
// Release engine resources when done.
|
|
46
|
+
rt.close(wb1)
|
|
47
|
+
rt.closeAll()
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## `SpreadsheetRuntime`
|
|
51
|
+
|
|
52
|
+
| Member | Description |
|
|
53
|
+
|--------|-------------|
|
|
54
|
+
| `createWorkbook()` | Create a new empty workbook |
|
|
55
|
+
| `loadWorkbook(path)` | Load a `.xlsx` from disk (dedups by absolute path) |
|
|
56
|
+
| `loadWorkbookFromBytes(bytes, name, path?)` | Load a `.xlsx` from raw bytes in memory |
|
|
57
|
+
| `workbooks` | All currently open workbooks |
|
|
58
|
+
| `close(wb)` / `closeAll()` | Release engine resources |
|
|
59
|
+
|
|
60
|
+
## `Workbook`
|
|
61
|
+
|
|
62
|
+
Obtain one from the runtime, then run every operation against it so the target
|
|
63
|
+
workbook is always explicit.
|
|
64
|
+
|
|
65
|
+
| Member | Description |
|
|
66
|
+
|--------|-------------|
|
|
67
|
+
| `id` | The workbook's engine id |
|
|
68
|
+
| `ops` | The shared `WorkbookOps` (cell input, sheets, blocks, styles, …) bound to this workbook |
|
|
69
|
+
| `client` | Raw async `Client` — escape hatch for engine calls not yet on `ops` |
|
|
70
|
+
| `getValue(sheetIdx, row, col)` | Read a single evaluated cell value |
|
|
71
|
+
| `undo()` / `redo()` | Step the history; returns whether anything changed |
|
|
72
|
+
| `cleanHistory()` | Drop history, keeping current state as baseline |
|
|
73
|
+
| `discardChanges()` | Revert every change back to the current baseline |
|
|
74
|
+
|
|
75
|
+
## Beyond a single process
|
|
76
|
+
|
|
77
|
+
Everything below is exported from the top-level `logisheets-runtime` entry
|
|
78
|
+
(alongside the full re-exported `logisheets-core` surface), so you import it all
|
|
79
|
+
from one place:
|
|
80
|
+
|
|
81
|
+
- **RPC** — a JSON-RPC server for issuing operations against the runtime.
|
|
82
|
+
- **Crafts** — headlessly reconstruct the crafts a workbook depends on.
|
|
83
|
+
- **Watcher** — hot-(re)load workbooks from `wb_*.json` descriptors.
|
|
84
|
+
- **Enterprise** — register with the control panel and pull crafts from the enterprise registry.
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT — part of the [LogiSheets](https://github.com/logisky/LogiSheets) project.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "logisheets-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Headless LogiSheets spreadsheet runtime for Node — logisheets-core wired to the Node WASM engine. The Node counterpart of the browser app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"author": "Jeremy He",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"logisheets": "^1.
|
|
22
|
-
"logisheets-core": "^1.
|
|
21
|
+
"logisheets": "^1.9.0",
|
|
22
|
+
"logisheets-core": "^1.9.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"typescript": "^5.5.0",
|
|
26
|
-
"vitest": "
|
|
26
|
+
"vitest": "3.2.6"
|
|
27
27
|
}
|
|
28
28
|
}
|