logisheets 1.8.0 → 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 CHANGED
@@ -1,15 +1,66 @@
1
- # LogiSheets
1
+ # logisheets
2
2
 
3
- ## What is LogiSheets?
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
- LogiSheets is a web-based spreadsheet application that seamlessly integrates with Excel and is crafted for expansion. Notably, it comes at no cost!
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
- You can utilize the Rust crate and Node package to efficiently read, perform operations, and write .xlsx files.
12
+ > **This package targets Node.** For the browser, use
13
+ > [`logisheets-web`](https://www.npmjs.com/package/logisheets-web).
8
14
 
9
- We are also working on a user interface to enable users to use spreadsheets directly in their web browsers.
15
+ ## Installation
10
16
 
11
- ## WARNING
17
+ ```bash
18
+ npm install logisheets
19
+ ```
12
20
 
13
- This version is specifically used for Node. If you are seeking a version compatible with web browsers, please see [`logisheets-web`](https://www.npmjs.com/package/logisheets-web).
21
+ ## Usage
14
22
 
15
- LogiSheets is currently in its **early development** stages. We welcome your feedback, issues, or pull requests!
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>;
@@ -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
  }
@@ -0,0 +1,4 @@
1
+ export interface BlockSortOrder {
2
+ isRow: boolean;
3
+ newOrder: readonly number[];
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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);
@@ -0,0 +1,6 @@
1
+ export interface GetBlockSortOrderParams {
2
+ sheetIdx: number;
3
+ blockId: number;
4
+ field: string;
5
+ asc: boolean;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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>;
@@ -6,3 +6,15 @@ export function handle(msg: any, book_id?: number | null): any;
6
6
  * Output: ActionAffect
7
7
  */
8
8
  export function input_async_result(id: number, result: any): any;
9
+ /**
10
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
11
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
12
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
13
+ * JavaScript `String(value)` representation, matching the previous behavior.
14
+ */
15
+ export function format_number(fmt: string, value: number): string;
16
+ /**
17
+ * Render a text value with an Excel number-format code (for the `@` text
18
+ * section). Falls back to the text itself on an unsupported format.
19
+ */
20
+ export function format_text(fmt: string, text: string): string;
@@ -2,26 +2,9 @@
2
2
  let imports = {};
3
3
  imports['__wbindgen_placeholder__'] = module.exports;
4
4
  let wasm;
5
- const { TextDecoder, TextEncoder } = require(`util`);
5
+ const { TextEncoder, TextDecoder } = require(`util`);
6
6
 
7
- function addToExternrefTable0(obj) {
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
  }
@@ -192,6 +192,62 @@ module.exports.input_async_result = function(id, result) {
192
192
  return ret;
193
193
  };
194
194
 
195
+ /**
196
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
197
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
198
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
199
+ * JavaScript `String(value)` representation, matching the previous behavior.
200
+ * @param {string} fmt
201
+ * @param {number} value
202
+ * @returns {string}
203
+ */
204
+ module.exports.format_number = function(fmt, value) {
205
+ let deferred2_0;
206
+ let deferred2_1;
207
+ try {
208
+ const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
+ const len0 = WASM_VECTOR_LEN;
210
+ const ret = wasm.format_number(ptr0, len0, value);
211
+ deferred2_0 = ret[0];
212
+ deferred2_1 = ret[1];
213
+ return getStringFromWasm0(ret[0], ret[1]);
214
+ } finally {
215
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
216
+ }
217
+ };
218
+
219
+ /**
220
+ * Render a text value with an Excel number-format code (for the `@` text
221
+ * section). Falls back to the text itself on an unsupported format.
222
+ * @param {string} fmt
223
+ * @param {string} text
224
+ * @returns {string}
225
+ */
226
+ module.exports.format_text = function(fmt, text) {
227
+ let deferred3_0;
228
+ let deferred3_1;
229
+ try {
230
+ const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
231
+ const len0 = WASM_VECTOR_LEN;
232
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
233
+ const len1 = WASM_VECTOR_LEN;
234
+ const ret = wasm.format_text(ptr0, len0, ptr1, len1);
235
+ deferred3_0 = ret[0];
236
+ deferred3_1 = ret[1];
237
+ return getStringFromWasm0(ret[0], ret[1]);
238
+ } finally {
239
+ wasm.__wbindgen_free(deferred3_0, deferred3_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.__wbindgen_export_2;
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);
@@ -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 __wbindgen_export_2: WebAssembly.Table;
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;
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "JeremyHe <yiliang.he@qq.com>"
5
5
  ],
6
- "version": "1.8.0",
6
+ "version": "1.9.0",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logisheets",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Read and write the xlsx files",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -6,3 +6,15 @@ export function handle(msg: any, book_id?: number | null): any;
6
6
  * Output: ActionAffect
7
7
  */
8
8
  export function input_async_result(id: number, result: any): any;
9
+ /**
10
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
11
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
12
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
13
+ * JavaScript `String(value)` representation, matching the previous behavior.
14
+ */
15
+ export function format_number(fmt: string, value: number): string;
16
+ /**
17
+ * Render a text value with an Excel number-format code (for the `@` text
18
+ * section). Falls back to the text itself on an unsupported format.
19
+ */
20
+ export function format_text(fmt: string, text: string): string;
@@ -2,26 +2,9 @@
2
2
  let imports = {};
3
3
  imports['__wbindgen_placeholder__'] = module.exports;
4
4
  let wasm;
5
- const { TextDecoder, TextEncoder } = require(`util`);
5
+ const { TextEncoder, TextDecoder } = require(`util`);
6
6
 
7
- function addToExternrefTable0(obj) {
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
  }
@@ -192,6 +192,62 @@ module.exports.input_async_result = function(id, result) {
192
192
  return ret;
193
193
  };
194
194
 
195
+ /**
196
+ * Render a number with an Excel number-format code, natively via `ssf-rs`
197
+ * (the Rust port of SheetJS `ssf`). Replaces the browser's old dependency on
198
+ * the `ssf` npm package. On an unsupported/invalid format it falls back to the
199
+ * JavaScript `String(value)` representation, matching the previous behavior.
200
+ * @param {string} fmt
201
+ * @param {number} value
202
+ * @returns {string}
203
+ */
204
+ module.exports.format_number = function(fmt, value) {
205
+ let deferred2_0;
206
+ let deferred2_1;
207
+ try {
208
+ const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
+ const len0 = WASM_VECTOR_LEN;
210
+ const ret = wasm.format_number(ptr0, len0, value);
211
+ deferred2_0 = ret[0];
212
+ deferred2_1 = ret[1];
213
+ return getStringFromWasm0(ret[0], ret[1]);
214
+ } finally {
215
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
216
+ }
217
+ };
218
+
219
+ /**
220
+ * Render a text value with an Excel number-format code (for the `@` text
221
+ * section). Falls back to the text itself on an unsupported format.
222
+ * @param {string} fmt
223
+ * @param {string} text
224
+ * @returns {string}
225
+ */
226
+ module.exports.format_text = function(fmt, text) {
227
+ let deferred3_0;
228
+ let deferred3_1;
229
+ try {
230
+ const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
231
+ const len0 = WASM_VECTOR_LEN;
232
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
233
+ const len1 = WASM_VECTOR_LEN;
234
+ const ret = wasm.format_text(ptr0, len0, ptr1, len1);
235
+ deferred3_0 = ret[0];
236
+ deferred3_1 = ret[1];
237
+ return getStringFromWasm0(ret[0], ret[1]);
238
+ } finally {
239
+ wasm.__wbindgen_free(deferred3_0, deferred3_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.__wbindgen_export_2;
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 __wbindgen_export_2: WebAssembly.Table;
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.8.0",
6
+ "version": "1.9.0",
7
7
  "files": [
8
8
  "logisheets_wasm_server_bg.wasm",
9
9
  "logisheets_wasm_server.js",