logisheets 1.8.0 → 1.10.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 +59 -8
- package/dist/src/api/workbook.d.ts +14 -1
- package/dist/src/api/workbook.js +34 -0
- package/dist/src/bindings/block_sort_order.d.ts +4 -0
- package/dist/src/bindings/block_sort_order.js +2 -0
- package/dist/src/bindings/index.d.ts +2 -0
- package/dist/src/bindings/index.js +2 -0
- package/dist/src/bindings/rpc_get_block_sort_order_params.d.ts +6 -0
- package/dist/src/bindings/rpc_get_block_sort_order_params.js +2 -0
- package/dist/src/bindings/rpc_workbook_methods.d.ts +3 -0
- package/dist/wasm/logisheets_wasm_server.d.ts +12 -0
- package/dist/wasm/logisheets_wasm_server.js +83 -27
- package/dist/wasm/logisheets_wasm_server_bg.wasm +0 -0
- package/dist/wasm/logisheets_wasm_server_bg.wasm.d.ts +5 -3
- package/dist/wasm/package.json +2 -2
- package/package.json +1 -1
- package/wasm/logisheets_wasm_server.d.ts +12 -0
- package/wasm/logisheets_wasm_server.js +83 -27
- package/wasm/logisheets_wasm_server_bg.wasm +0 -0
- package/wasm/logisheets_wasm_server_bg.wasm.d.ts +5 -3
- package/wasm/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,15 +1,66 @@
|
|
|
1
|
-
#
|
|
1
|
+
# logisheets
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node.js bindings for **LogiSheets** — a spreadsheet engine written in Rust and
|
|
4
|
+
compiled to WebAssembly. It reads, manipulates, and writes real `.xlsx` files
|
|
5
|
+
(formulas, styles, and structure preserved) with no browser required.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Same workbook API as [`logisheets-web`](https://www.npmjs.com/package/logisheets-web),
|
|
8
|
+
targeting Node. For a higher-level headless runtime that manages many workbooks
|
|
9
|
+
and adds RPC / crafts / file-watching, see
|
|
10
|
+
[`logisheets-runtime`](https://www.npmjs.com/package/logisheets-runtime).
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
> **This package targets Node.** For the browser, use
|
|
13
|
+
> [`logisheets-web`](https://www.npmjs.com/package/logisheets-web).
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
## Installation
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
```bash
|
|
18
|
+
npm install logisheets
|
|
19
|
+
```
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
## Usage
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
```ts
|
|
24
|
+
import {readFileSync, writeFileSync} from 'node:fs'
|
|
25
|
+
import {Workbook, isErrorMessage} from 'logisheets'
|
|
26
|
+
|
|
27
|
+
// Load a workbook from an .xlsx file on disk.
|
|
28
|
+
const wb = new Workbook()
|
|
29
|
+
const buf = readFileSync('book.xlsx')
|
|
30
|
+
const code = wb.load(new Uint8Array(buf), 'book.xlsx') // 0 === success
|
|
31
|
+
|
|
32
|
+
// Read a cell.
|
|
33
|
+
const ws = wb.getWorksheet(0)
|
|
34
|
+
const cell = ws.getCellInfo(0, 0) // A1
|
|
35
|
+
if (!isErrorMessage(cell)) {
|
|
36
|
+
console.log(cell.value, cell.formula)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Edit via an (undoable) transaction.
|
|
40
|
+
wb.execTransaction({
|
|
41
|
+
payloads: [
|
|
42
|
+
{
|
|
43
|
+
type: 'cellInput',
|
|
44
|
+
value: {sheetIdx: 0, row: 0, col: 0, content: '=1+1'},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
undoable: true,
|
|
48
|
+
temp: false,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// Save back to .xlsx.
|
|
52
|
+
const saved = wb.save('') // { data: Uint8Array, code }
|
|
53
|
+
writeFileSync('out.xlsx', saved.data)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`Workbook` also exposes blocks, comments, checkpoints, formula display units,
|
|
57
|
+
undo/redo, and more. `Worksheet` provides the read surface (cells, dimensions,
|
|
58
|
+
merged cells, charts, data validation, dependents, …).
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
Full guides and API reference: **[docs.logisheets.com](https://docs.logisheets.com/)**.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MIT — part of the [LogiSheets](https://github.com/logisky/LogiSheets) project.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionEffect, BlockField, BlockInfo, FormulaDisplayInfo, ShadowCellInfo, SheetCellId, SheetInfo, SaveFileResult, AppData, CellInfo, CellCoordinateWithSheet, Transaction, GetBlockValuesParams, GetCellIdParams, GetShadowCellIdParams, GetShadowCellIdsParams, GetAvailableBlockIdParams, TempStatusDiff, BlockDataRow, CommentMention } from '../bindings';
|
|
1
|
+
import { ActionEffect, BlockField, BlockInfo, BlockSortOrder, GetBlockSortOrderParams, FormulaDisplayInfo, ShadowCellInfo, SheetCellId, SheetInfo, SaveFileResult, AppData, CellInfo, CellCoordinateWithSheet, Transaction, GetBlockValuesParams, GetCellIdParams, GetShadowCellIdParams, GetShadowCellIdsParams, GetAvailableBlockIdParams, TempStatusDiff, BlockDataRow, CommentMention } from '../bindings';
|
|
2
2
|
import { ColId, RowId } from '../types';
|
|
3
3
|
import { Worksheet } from './worksheet';
|
|
4
4
|
import { CustomFunc } from './calculator';
|
|
@@ -151,6 +151,19 @@ export declare class Workbook {
|
|
|
151
151
|
endRow: number;
|
|
152
152
|
endCol: number;
|
|
153
153
|
}): Result<ActionEffect>;
|
|
154
|
+
/**
|
|
155
|
+
* Read-only: compute the row/column order that sorts a block by one of
|
|
156
|
+
* its fields. The engine compares typed cell values (numbers numerically,
|
|
157
|
+
* text lexicographically, blanks last), so this is the reliable source of
|
|
158
|
+
* a sort order. Fails for random-schema blocks (no fields).
|
|
159
|
+
*/
|
|
160
|
+
getBlockSortOrder(params: GetBlockSortOrderParams): Result<BlockSortOrder>;
|
|
161
|
+
/**
|
|
162
|
+
* Sort a block's records by the named field and commit the reorder as a
|
|
163
|
+
* single (undoable) transaction. The engine computes the type-aware order;
|
|
164
|
+
* this just dispatches the resulting `reorderBlockLines` payload.
|
|
165
|
+
*/
|
|
166
|
+
sortBlock(sheetIdx: number, blockId: number, field: string, asc: boolean): Result<ActionEffect>;
|
|
154
167
|
getWorksheetById(id: number): Worksheet;
|
|
155
168
|
registryCustomFunc(customFunc: CustomFunc): void;
|
|
156
169
|
getShadowCellId(params: GetShadowCellIdParams): Result<number>;
|
package/dist/src/api/workbook.js
CHANGED
|
@@ -400,6 +400,40 @@ class Workbook {
|
|
|
400
400
|
temp: false,
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Read-only: compute the row/column order that sorts a block by one of
|
|
405
|
+
* its fields. The engine compares typed cell values (numbers numerically,
|
|
406
|
+
* text lexicographically, blanks last), so this is the reliable source of
|
|
407
|
+
* a sort order. Fails for random-schema blocks (no fields).
|
|
408
|
+
*/
|
|
409
|
+
getBlockSortOrder(params) {
|
|
410
|
+
return rpc('getBlockSortOrder', params, this._id);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Sort a block's records by the named field and commit the reorder as a
|
|
414
|
+
* single (undoable) transaction. The engine computes the type-aware order;
|
|
415
|
+
* this just dispatches the resulting `reorderBlockLines` payload.
|
|
416
|
+
*/
|
|
417
|
+
sortBlock(sheetIdx, blockId, field, asc) {
|
|
418
|
+
const order = this.getBlockSortOrder({ sheetIdx, blockId, field, asc });
|
|
419
|
+
if ((0, utils_1.isErrorMessage)(order))
|
|
420
|
+
return order;
|
|
421
|
+
return this.execTransaction({
|
|
422
|
+
payloads: [
|
|
423
|
+
{
|
|
424
|
+
type: 'reorderBlockLines',
|
|
425
|
+
value: {
|
|
426
|
+
sheetIdx,
|
|
427
|
+
blockId,
|
|
428
|
+
isRow: order.isRow,
|
|
429
|
+
newOrder: order.newOrder,
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
],
|
|
433
|
+
undoable: true,
|
|
434
|
+
temp: false,
|
|
435
|
+
});
|
|
436
|
+
}
|
|
403
437
|
getWorksheetById(id) {
|
|
404
438
|
return new worksheet_1.Worksheet(this._id, id, false);
|
|
405
439
|
}
|
|
@@ -22,6 +22,7 @@ export * from './block_schema_field_entry';
|
|
|
22
22
|
export * from './block_schema_key_entry';
|
|
23
23
|
export * from './block_schema_random_entry';
|
|
24
24
|
export * from './block_schema_type';
|
|
25
|
+
export * from './block_sort_order';
|
|
25
26
|
export * from './block_style_update';
|
|
26
27
|
export * from './border';
|
|
27
28
|
export * from './border_pr';
|
|
@@ -147,6 +148,7 @@ export * from './rpc_get_block_col_id_params';
|
|
|
147
148
|
export * from './rpc_get_block_display_window_params';
|
|
148
149
|
export * from './rpc_get_block_info_params';
|
|
149
150
|
export * from './rpc_get_block_row_id_params';
|
|
151
|
+
export * from './rpc_get_block_sort_order_params';
|
|
150
152
|
export * from './rpc_get_block_values_params';
|
|
151
153
|
export * from './rpc_get_cell_id_by_block_ref_params';
|
|
152
154
|
export * from './rpc_get_cell_id_params';
|
|
@@ -39,6 +39,7 @@ __exportStar(require("./block_schema_field_entry"), exports);
|
|
|
39
39
|
__exportStar(require("./block_schema_key_entry"), exports);
|
|
40
40
|
__exportStar(require("./block_schema_random_entry"), exports);
|
|
41
41
|
__exportStar(require("./block_schema_type"), exports);
|
|
42
|
+
__exportStar(require("./block_sort_order"), exports);
|
|
42
43
|
__exportStar(require("./block_style_update"), exports);
|
|
43
44
|
__exportStar(require("./border"), exports);
|
|
44
45
|
__exportStar(require("./border_pr"), exports);
|
|
@@ -164,6 +165,7 @@ __exportStar(require("./rpc_get_block_col_id_params"), exports);
|
|
|
164
165
|
__exportStar(require("./rpc_get_block_display_window_params"), exports);
|
|
165
166
|
__exportStar(require("./rpc_get_block_info_params"), exports);
|
|
166
167
|
__exportStar(require("./rpc_get_block_row_id_params"), exports);
|
|
168
|
+
__exportStar(require("./rpc_get_block_sort_order_params"), exports);
|
|
167
169
|
__exportStar(require("./rpc_get_block_values_params"), exports);
|
|
168
170
|
__exportStar(require("./rpc_get_cell_id_by_block_ref_params"), exports);
|
|
169
171
|
__exportStar(require("./rpc_get_cell_id_params"), exports);
|
|
@@ -6,6 +6,7 @@ import { BatchGetCellInfoByIdParams } from './rpc_batch_get_cell_info_by_id_para
|
|
|
6
6
|
import { BlockDataRow } from './block_data_row';
|
|
7
7
|
import { BlockField } from './block_field';
|
|
8
8
|
import { BlockInfo } from './block_info';
|
|
9
|
+
import { BlockSortOrder } from './block_sort_order';
|
|
9
10
|
import { CalcConditionParams } from './rpc_calc_condition_params';
|
|
10
11
|
import { CellCoordinateWithSheet } from './cell_coordinate_with_sheet';
|
|
11
12
|
import { CellImageInfo } from './cell_image_info';
|
|
@@ -30,6 +31,7 @@ import { GetBlockColIdParams } from './rpc_get_block_col_id_params';
|
|
|
30
31
|
import { GetBlockDisplayWindowParams } from './rpc_get_block_display_window_params';
|
|
31
32
|
import { GetBlockInfoParams } from './rpc_get_block_info_params';
|
|
32
33
|
import { GetBlockRowIdParams } from './rpc_get_block_row_id_params';
|
|
34
|
+
import { GetBlockSortOrderParams } from './rpc_get_block_sort_order_params';
|
|
33
35
|
import { GetBlockValuesParams } from './rpc_get_block_values_params';
|
|
34
36
|
import { GetCellIdByBlockRefParams } from './rpc_get_cell_id_by_block_ref_params';
|
|
35
37
|
import { GetCellIdParams } from './rpc_get_cell_id_params';
|
|
@@ -117,6 +119,7 @@ export interface WorkbookMethods {
|
|
|
117
119
|
getBlockRowId(params: GetBlockRowIdParams, bookId?: number): Promise<number | ErrorMessage>;
|
|
118
120
|
getBlockColId(params: GetBlockColIdParams, bookId?: number): Promise<number | ErrorMessage>;
|
|
119
121
|
getBlockValues(params: GetBlockValuesParams, bookId?: number): Promise<readonly string[] | ErrorMessage>;
|
|
122
|
+
getBlockSortOrder(params: GetBlockSortOrderParams, bookId?: number): Promise<BlockSortOrder | ErrorMessage>;
|
|
120
123
|
getAvailableBlockId(params: GetAvailableBlockIdParams, bookId?: number): Promise<number | ErrorMessage>;
|
|
121
124
|
getAllBlockFields(bookId?: number): Promise<readonly BlockField[] | ErrorMessage>;
|
|
122
125
|
getAllBlocks(params: GetAllBlocksParams, bookId?: number): Promise<readonly BlockInfo[] | ErrorMessage>;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export function handle(msg: any, book_id?: number | null): any;
|
|
4
|
+
/**
|
|
5
|
+
* Render a text value with an Excel number-format code (for the `@` text
|
|
6
|
+
* section). Falls back to the text itself on an unsupported format.
|
|
7
|
+
*/
|
|
8
|
+
export function format_text(fmt: string, text: string): string;
|
|
4
9
|
/**
|
|
5
10
|
* Input: AsyncFuncResult
|
|
6
11
|
* Output: ActionAffect
|
|
7
12
|
*/
|
|
8
13
|
export function input_async_result(id: number, result: any): any;
|
|
14
|
+
/**
|
|
15
|
+
* Render a number with an Excel number-format code, natively via `ssf-rs`
|
|
16
|
+
* (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
|
|
17
|
+
* the `ssf` npm package. On an unsupported/invalid format it falls back to the
|
|
18
|
+
* JavaScript `String(value)` representation, matching the previous behavior.
|
|
19
|
+
*/
|
|
20
|
+
export function format_number(fmt: string, value: number): string;
|
|
@@ -2,26 +2,9 @@
|
|
|
2
2
|
let imports = {};
|
|
3
3
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
4
|
let wasm;
|
|
5
|
-
const {
|
|
5
|
+
const { TextEncoder, TextDecoder } = require(`util`);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
const idx = wasm.__externref_table_alloc();
|
|
9
|
-
wasm.__wbindgen_export_2.set(idx, obj);
|
|
10
|
-
return idx;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function handleError(f, args) {
|
|
14
|
-
try {
|
|
15
|
-
return f.apply(this, args);
|
|
16
|
-
} catch (e) {
|
|
17
|
-
const idx = addToExternrefTable0(e);
|
|
18
|
-
wasm.__wbindgen_exn_store(idx);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
23
|
-
|
|
24
|
-
cachedTextDecoder.decode();
|
|
7
|
+
let WASM_VECTOR_LEN = 0;
|
|
25
8
|
|
|
26
9
|
let cachedUint8ArrayMemory0 = null;
|
|
27
10
|
|
|
@@ -32,13 +15,6 @@ function getUint8ArrayMemory0() {
|
|
|
32
15
|
return cachedUint8ArrayMemory0;
|
|
33
16
|
}
|
|
34
17
|
|
|
35
|
-
function getStringFromWasm0(ptr, len) {
|
|
36
|
-
ptr = ptr >>> 0;
|
|
37
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let WASM_VECTOR_LEN = 0;
|
|
41
|
-
|
|
42
18
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
43
19
|
|
|
44
20
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -102,6 +78,30 @@ function getDataViewMemory0() {
|
|
|
102
78
|
return cachedDataViewMemory0;
|
|
103
79
|
}
|
|
104
80
|
|
|
81
|
+
function addToExternrefTable0(obj) {
|
|
82
|
+
const idx = wasm.__externref_table_alloc();
|
|
83
|
+
wasm.__wbindgen_export_4.set(idx, obj);
|
|
84
|
+
return idx;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function handleError(f, args) {
|
|
88
|
+
try {
|
|
89
|
+
return f.apply(this, args);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
const idx = addToExternrefTable0(e);
|
|
92
|
+
wasm.__wbindgen_exn_store(idx);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
97
|
+
|
|
98
|
+
cachedTextDecoder.decode();
|
|
99
|
+
|
|
100
|
+
function getStringFromWasm0(ptr, len) {
|
|
101
|
+
ptr = ptr >>> 0;
|
|
102
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
105
|
function isLikeNone(x) {
|
|
106
106
|
return x === undefined || x === null;
|
|
107
107
|
}
|
|
@@ -180,6 +180,30 @@ module.exports.handle = function(msg, book_id) {
|
|
|
180
180
|
return ret;
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Render a text value with an Excel number-format code (for the `@` text
|
|
185
|
+
* section). Falls back to the text itself on an unsupported format.
|
|
186
|
+
* @param {string} fmt
|
|
187
|
+
* @param {string} text
|
|
188
|
+
* @returns {string}
|
|
189
|
+
*/
|
|
190
|
+
module.exports.format_text = function(fmt, text) {
|
|
191
|
+
let deferred3_0;
|
|
192
|
+
let deferred3_1;
|
|
193
|
+
try {
|
|
194
|
+
const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
195
|
+
const len0 = WASM_VECTOR_LEN;
|
|
196
|
+
const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
197
|
+
const len1 = WASM_VECTOR_LEN;
|
|
198
|
+
const ret = wasm.format_text(ptr0, len0, ptr1, len1);
|
|
199
|
+
deferred3_0 = ret[0];
|
|
200
|
+
deferred3_1 = ret[1];
|
|
201
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
202
|
+
} finally {
|
|
203
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
183
207
|
/**
|
|
184
208
|
* Input: AsyncFuncResult
|
|
185
209
|
* Output: ActionAffect
|
|
@@ -192,6 +216,38 @@ module.exports.input_async_result = function(id, result) {
|
|
|
192
216
|
return ret;
|
|
193
217
|
};
|
|
194
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Render a number with an Excel number-format code, natively via `ssf-rs`
|
|
221
|
+
* (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
|
|
222
|
+
* the `ssf` npm package. On an unsupported/invalid format it falls back to the
|
|
223
|
+
* JavaScript `String(value)` representation, matching the previous behavior.
|
|
224
|
+
* @param {string} fmt
|
|
225
|
+
* @param {number} value
|
|
226
|
+
* @returns {string}
|
|
227
|
+
*/
|
|
228
|
+
module.exports.format_number = function(fmt, value) {
|
|
229
|
+
let deferred2_0;
|
|
230
|
+
let deferred2_1;
|
|
231
|
+
try {
|
|
232
|
+
const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
233
|
+
const len0 = WASM_VECTOR_LEN;
|
|
234
|
+
const ret = wasm.format_number(ptr0, len0, value);
|
|
235
|
+
deferred2_0 = ret[0];
|
|
236
|
+
deferred2_1 = ret[1];
|
|
237
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
238
|
+
} finally {
|
|
239
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
module.exports.__wbg_String_eecc4a11987127d6 = function(arg0, arg1) {
|
|
244
|
+
const ret = String(arg1);
|
|
245
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
246
|
+
const len1 = WASM_VECTOR_LEN;
|
|
247
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
248
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
249
|
+
};
|
|
250
|
+
|
|
195
251
|
module.exports.__wbg_buffer_71667b1101df19da = function(arg0) {
|
|
196
252
|
const ret = arg0.buffer;
|
|
197
253
|
return ret;
|
|
@@ -490,7 +546,7 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
|
|
|
490
546
|
};
|
|
491
547
|
|
|
492
548
|
module.exports.__wbindgen_init_externref_table = function() {
|
|
493
|
-
const table = wasm.
|
|
549
|
+
const table = wasm.__wbindgen_export_4;
|
|
494
550
|
const offset = table.grow(4);
|
|
495
551
|
table.set(0, undefined);
|
|
496
552
|
table.set(offset + 0, undefined);
|
|
Binary file
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const handle: (a: any, b: number) => any;
|
|
5
|
+
export const format_number: (a: number, b: number, c: number) => [number, number];
|
|
6
|
+
export const format_text: (a: number, b: number, c: number, d: number) => [number, number];
|
|
5
7
|
export const input_async_result: (a: number, b: any) => any;
|
|
8
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
9
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
6
10
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
7
11
|
export const __externref_table_alloc: () => number;
|
|
8
|
-
export const
|
|
12
|
+
export const __wbindgen_export_4: WebAssembly.Table;
|
|
9
13
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
10
|
-
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
11
|
-
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
12
14
|
export const __wbindgen_start: () => void;
|
package/dist/wasm/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"collaborators": [
|
|
4
4
|
"JeremyHe <yiliang.he@qq.com>"
|
|
5
5
|
],
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.10.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"logisheets_wasm_server_bg.wasm",
|
|
9
9
|
"logisheets_wasm_server.js",
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
],
|
|
12
12
|
"main": "logisheets_wasm_server.js",
|
|
13
13
|
"types": "logisheets_wasm_server.d.ts"
|
|
14
|
-
}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export function handle(msg: any, book_id?: number | null): any;
|
|
4
|
+
/**
|
|
5
|
+
* Render a text value with an Excel number-format code (for the `@` text
|
|
6
|
+
* section). Falls back to the text itself on an unsupported format.
|
|
7
|
+
*/
|
|
8
|
+
export function format_text(fmt: string, text: string): string;
|
|
4
9
|
/**
|
|
5
10
|
* Input: AsyncFuncResult
|
|
6
11
|
* Output: ActionAffect
|
|
7
12
|
*/
|
|
8
13
|
export function input_async_result(id: number, result: any): any;
|
|
14
|
+
/**
|
|
15
|
+
* Render a number with an Excel number-format code, natively via `ssf-rs`
|
|
16
|
+
* (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
|
|
17
|
+
* the `ssf` npm package. On an unsupported/invalid format it falls back to the
|
|
18
|
+
* JavaScript `String(value)` representation, matching the previous behavior.
|
|
19
|
+
*/
|
|
20
|
+
export function format_number(fmt: string, value: number): string;
|
|
@@ -2,26 +2,9 @@
|
|
|
2
2
|
let imports = {};
|
|
3
3
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
4
|
let wasm;
|
|
5
|
-
const {
|
|
5
|
+
const { TextEncoder, TextDecoder } = require(`util`);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
const idx = wasm.__externref_table_alloc();
|
|
9
|
-
wasm.__wbindgen_export_2.set(idx, obj);
|
|
10
|
-
return idx;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function handleError(f, args) {
|
|
14
|
-
try {
|
|
15
|
-
return f.apply(this, args);
|
|
16
|
-
} catch (e) {
|
|
17
|
-
const idx = addToExternrefTable0(e);
|
|
18
|
-
wasm.__wbindgen_exn_store(idx);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
23
|
-
|
|
24
|
-
cachedTextDecoder.decode();
|
|
7
|
+
let WASM_VECTOR_LEN = 0;
|
|
25
8
|
|
|
26
9
|
let cachedUint8ArrayMemory0 = null;
|
|
27
10
|
|
|
@@ -32,13 +15,6 @@ function getUint8ArrayMemory0() {
|
|
|
32
15
|
return cachedUint8ArrayMemory0;
|
|
33
16
|
}
|
|
34
17
|
|
|
35
|
-
function getStringFromWasm0(ptr, len) {
|
|
36
|
-
ptr = ptr >>> 0;
|
|
37
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let WASM_VECTOR_LEN = 0;
|
|
41
|
-
|
|
42
18
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
43
19
|
|
|
44
20
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -102,6 +78,30 @@ function getDataViewMemory0() {
|
|
|
102
78
|
return cachedDataViewMemory0;
|
|
103
79
|
}
|
|
104
80
|
|
|
81
|
+
function addToExternrefTable0(obj) {
|
|
82
|
+
const idx = wasm.__externref_table_alloc();
|
|
83
|
+
wasm.__wbindgen_export_4.set(idx, obj);
|
|
84
|
+
return idx;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function handleError(f, args) {
|
|
88
|
+
try {
|
|
89
|
+
return f.apply(this, args);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
const idx = addToExternrefTable0(e);
|
|
92
|
+
wasm.__wbindgen_exn_store(idx);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
97
|
+
|
|
98
|
+
cachedTextDecoder.decode();
|
|
99
|
+
|
|
100
|
+
function getStringFromWasm0(ptr, len) {
|
|
101
|
+
ptr = ptr >>> 0;
|
|
102
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
105
|
function isLikeNone(x) {
|
|
106
106
|
return x === undefined || x === null;
|
|
107
107
|
}
|
|
@@ -180,6 +180,30 @@ module.exports.handle = function(msg, book_id) {
|
|
|
180
180
|
return ret;
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Render a text value with an Excel number-format code (for the `@` text
|
|
185
|
+
* section). Falls back to the text itself on an unsupported format.
|
|
186
|
+
* @param {string} fmt
|
|
187
|
+
* @param {string} text
|
|
188
|
+
* @returns {string}
|
|
189
|
+
*/
|
|
190
|
+
module.exports.format_text = function(fmt, text) {
|
|
191
|
+
let deferred3_0;
|
|
192
|
+
let deferred3_1;
|
|
193
|
+
try {
|
|
194
|
+
const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
195
|
+
const len0 = WASM_VECTOR_LEN;
|
|
196
|
+
const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
197
|
+
const len1 = WASM_VECTOR_LEN;
|
|
198
|
+
const ret = wasm.format_text(ptr0, len0, ptr1, len1);
|
|
199
|
+
deferred3_0 = ret[0];
|
|
200
|
+
deferred3_1 = ret[1];
|
|
201
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
202
|
+
} finally {
|
|
203
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
183
207
|
/**
|
|
184
208
|
* Input: AsyncFuncResult
|
|
185
209
|
* Output: ActionAffect
|
|
@@ -192,6 +216,38 @@ module.exports.input_async_result = function(id, result) {
|
|
|
192
216
|
return ret;
|
|
193
217
|
};
|
|
194
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Render a number with an Excel number-format code, natively via `ssf-rs`
|
|
221
|
+
* (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
|
|
222
|
+
* the `ssf` npm package. On an unsupported/invalid format it falls back to the
|
|
223
|
+
* JavaScript `String(value)` representation, matching the previous behavior.
|
|
224
|
+
* @param {string} fmt
|
|
225
|
+
* @param {number} value
|
|
226
|
+
* @returns {string}
|
|
227
|
+
*/
|
|
228
|
+
module.exports.format_number = function(fmt, value) {
|
|
229
|
+
let deferred2_0;
|
|
230
|
+
let deferred2_1;
|
|
231
|
+
try {
|
|
232
|
+
const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
233
|
+
const len0 = WASM_VECTOR_LEN;
|
|
234
|
+
const ret = wasm.format_number(ptr0, len0, value);
|
|
235
|
+
deferred2_0 = ret[0];
|
|
236
|
+
deferred2_1 = ret[1];
|
|
237
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
238
|
+
} finally {
|
|
239
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
module.exports.__wbg_String_eecc4a11987127d6 = function(arg0, arg1) {
|
|
244
|
+
const ret = String(arg1);
|
|
245
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
246
|
+
const len1 = WASM_VECTOR_LEN;
|
|
247
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
248
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
249
|
+
};
|
|
250
|
+
|
|
195
251
|
module.exports.__wbg_buffer_71667b1101df19da = function(arg0) {
|
|
196
252
|
const ret = arg0.buffer;
|
|
197
253
|
return ret;
|
|
@@ -490,7 +546,7 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
|
|
|
490
546
|
};
|
|
491
547
|
|
|
492
548
|
module.exports.__wbindgen_init_externref_table = function() {
|
|
493
|
-
const table = wasm.
|
|
549
|
+
const table = wasm.__wbindgen_export_4;
|
|
494
550
|
const offset = table.grow(4);
|
|
495
551
|
table.set(0, undefined);
|
|
496
552
|
table.set(offset + 0, undefined);
|
|
Binary file
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const handle: (a: any, b: number) => any;
|
|
5
|
+
export const format_number: (a: number, b: number, c: number) => [number, number];
|
|
6
|
+
export const format_text: (a: number, b: number, c: number, d: number) => [number, number];
|
|
5
7
|
export const input_async_result: (a: number, b: any) => any;
|
|
8
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
9
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
6
10
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
7
11
|
export const __externref_table_alloc: () => number;
|
|
8
|
-
export const
|
|
12
|
+
export const __wbindgen_export_4: WebAssembly.Table;
|
|
9
13
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
10
|
-
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
11
|
-
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
12
14
|
export const __wbindgen_start: () => void;
|
package/wasm/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"collaborators": [
|
|
4
4
|
"JeremyHe <yiliang.he@qq.com>"
|
|
5
5
|
],
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.10.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"logisheets_wasm_server_bg.wasm",
|
|
9
9
|
"logisheets_wasm_server.js",
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
],
|
|
12
12
|
"main": "logisheets_wasm_server.js",
|
|
13
13
|
"types": "logisheets_wasm_server.d.ts"
|
|
14
|
-
}
|
|
14
|
+
}
|