@truecalc/core 2.0.1 → 3.0.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@truecalc/core",
3
3
  "type": "module",
4
4
  "description": "Spreadsheet formula engine for the browser — Google Sheets–compatible formula evaluator compiled to WebAssembly",
5
- "version": "2.0.1",
5
+ "version": "3.0.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -31,6 +31,11 @@ export interface FunctionInfo {
31
31
  description: string;
32
32
  }
33
33
 
34
+ export interface TranslateResult {
35
+ formula?: string;
36
+ error?: string;
37
+ }
38
+
34
39
  export interface ValidateResult {
35
40
  valid: boolean;
36
41
  error?: string;
@@ -75,6 +80,15 @@ export function evaluate(formula: string, variables: any): EvalResult;
75
80
  */
76
81
  export function list_functions(): FunctionInfo[];
77
82
 
83
+ /**
84
+ * Shift every relative cell/range reference in `formula` by `(d_row, d_col)`
85
+ * — the fill / copy-paste reference-adjustment transform. `$`-absolute axes
86
+ * are left unchanged; an out-of-bounds corner becomes literal `#REF!`.
87
+ *
88
+ * Sheets flavor only (issue #709 v1); Excel support is a follow-up.
89
+ */
90
+ export function translate_formula(formula: string, d_row: number, d_col: number): TranslateResult;
91
+
78
92
  /**
79
93
  * Validate a formula string without evaluating it.
80
94
  *
package/truecalc_wasm.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./truecalc_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
 
7
7
  export {
8
- Engine, createEngine, evaluate, list_functions, validate
8
+ Engine, createEngine, evaluate, list_functions, translate_formula, validate
9
9
  } from "./truecalc_wasm_bg.js";
@@ -98,6 +98,24 @@ export function list_functions() {
98
98
  }
99
99
  }
100
100
 
101
+ /**
102
+ * Shift every relative cell/range reference in `formula` by `(d_row, d_col)`
103
+ * — the fill / copy-paste reference-adjustment transform. `$`-absolute axes
104
+ * are left unchanged; an out-of-bounds corner becomes literal `#REF!`.
105
+ *
106
+ * Sheets flavor only (issue #709 v1); Excel support is a follow-up.
107
+ * @param {string} formula
108
+ * @param {number} d_row
109
+ * @param {number} d_col
110
+ * @returns {TranslateResult}
111
+ */
112
+ export function translate_formula(formula, d_row, d_col) {
113
+ const ptr0 = passStringToWasm0(formula, wasm.__wbindgen_export, wasm.__wbindgen_export2);
114
+ const len0 = WASM_VECTOR_LEN;
115
+ const ret = wasm.translate_formula(ptr0, len0, d_row, d_col);
116
+ return takeObject(ret);
117
+ }
118
+
101
119
  /**
102
120
  * Validate a formula string without evaluating it.
103
121
  *
Binary file