@gui-chat-plugin/spreadsheet 4.2.0 → 4.2.1
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 +5 -1
- package/dist/core/calculationErrors.d.ts +17 -0
- package/dist/{core-CwIoDrlM.js → core-CTRlKL9k.js} +21 -21
- package/dist/core-Cf9Pxo_q.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/engine/blankOperands.d.ts +14 -0
- package/dist/engine/calculator.d.ts +7 -0
- package/dist/engine/evaluator.d.ts +3 -1
- package/dist/engine/functions/statistical.d.ts +11 -1
- package/dist/engine/logicalLiterals.d.ts +11 -0
- package/dist/engine/registry.d.ts +3 -3
- package/dist/engine/sheetReference.d.ts +14 -0
- package/dist/engine/wholeReferences.d.ts +19 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/{samples-DBNVoegC.js → samples-C5JjpxYJ.js} +1468 -1353
- package/dist/samples-UnTPgkyq.cjs +2 -0
- package/dist/vue.cjs +3 -3
- package/dist/vue.js +11 -11
- package/package.json +1 -1
- package/dist/core-DHWKHgsJ.cjs +0 -1
- package/dist/samples-DyQFcwBX.cjs +0 -2
package/README.md
CHANGED
|
@@ -123,6 +123,8 @@ Dates are serial numbers on the real calendar, as in LibreOffice and Google Shee
|
|
|
123
123
|
### Lookup & Reference
|
|
124
124
|
`HLOOKUP`, `INDEX`, `MATCH`, `VLOOKUP`, `XLOOKUP`
|
|
125
125
|
|
|
126
|
+
A range is written `A1:C10`, `Data!A1:C10` or `'My Sheet'!A1:C10`. A whole column (`A:A`, `B:D`) or a whole row (`1:1`) covers its sheet as far as the data reaches, which gives the same answers, since everything past the data is blank.
|
|
127
|
+
|
|
126
128
|
### Statistical
|
|
127
129
|
`AVERAGE`, `AVERAGEIF`, `AVERAGEIFS`, `CONFIDENCE.NORM`, `CONFIDENCE.T`, `CORREL`, `COUNT`, `COUNTA`, `COUNTIF`, `COUNTIFS`, `COVARIANCE.P`, `COVARIANCE.S`, `FORECAST`, `FORECAST.LINEAR`, `GEOMEAN`, `HARMEAN`, `INTERCEPT`, `KURT`, `LARGE`, `MAX`, `MAXIFS`, `MEDIAN`, `MIN`, `MINIFS`, `MODE`, `NORM.DIST`, `NORM.INV`, `NORM.S.DIST`, `NORM.S.INV`, `PEARSON`, `PERCENTILE`, `PERCENTILE.INC`, `PERCENTRANK`, `PERCENTRANK.INC`, `QUARTILE`, `QUARTILE.INC`, `RANK`, `RANK.EQ`, `RSQ`, `SKEW`, `SLOPE`, `SMALL`, `STANDARDIZE`, `STDEV`, `STDEV.P`, `STDEV.S`, `STDEVP`, `STEYX`, `SUM`, `SUMIF`, `SUMIFS`, `T.DIST`, `T.DIST.2T`, `T.DIST.RT`, `T.INV`, `T.INV.2T`, `T.TEST`, `TREND`, `TTEST`, `VAR`, `VAR.P`, `VAR.S`, `VARP`
|
|
128
130
|
|
|
@@ -148,9 +150,11 @@ A workbook can define functions of its own, for an analysis no built-in function
|
|
|
148
150
|
```
|
|
149
151
|
|
|
150
152
|
- A function body is JavaScript, run in [QuickJS](https://github.com/justjake/quickjs-emscripten) (WebAssembly) with no DOM, network, file system or timers, at most 50 ms per call, 2 s per calculation and 16 MB of memory. Each function has a global scope of its own.
|
|
151
|
-
- A range argument arrives as rows of cells (an array of arrays, a blank cell as `null`); a single cell and any other argument as its value. A whole column or row (`A:A`, `2:2`)
|
|
153
|
+
- A range argument arrives as rows of cells (an array of arrays, a blank cell as `null`); a single cell and any other argument as its value. A whole column or row (`A:A`, `2:2`) arrives as the range it covers in its sheet's data. An argument that is an error is passed on without calling the function.
|
|
152
154
|
- Return a number, text or `true`/`false`. A time-out or a non-finite number shows `#NUM!`; a thrown error or any other return value shows `#VALUE!`.
|
|
153
155
|
- A name is letters and digits, parts joined by dots, and cannot be a built-in function's. `presentSpreadsheet` says in its reply which definitions could not be used.
|
|
156
|
+
- `presentSpreadsheet`'s reply also lists formula cells that calculate to an error (a few, and how many in all), so an agent can fix a workbook before handing it over: the saved file holds formulas, not results.
|
|
157
|
+
- Each workbook's functions get a QuickJS instance of their own, so a failure in one (an abort while freeing a runtime that ran out of time) cannot affect another.
|
|
154
158
|
- QuickJS loads only for a workbook that defines functions. The View and `readCalculatedRange` load it themselves; a host calling `calculatedRange` directly passes the set from `loadCustomFunctions`.
|
|
155
159
|
|
|
156
160
|
## Development
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CustomFunctionSet } from "../engine/customFunctions";
|
|
2
|
+
import type { SpreadsheetSheet } from "./types";
|
|
3
|
+
/** How many erroring cells a reply names; the rest are counted. */
|
|
4
|
+
export declare const ERROR_SAMPLES = 5;
|
|
5
|
+
/** A formula is quoted up to this many characters, so the reply stays short whatever was written. */
|
|
6
|
+
export declare const FORMULA_QUOTE_LIMIT = 80;
|
|
7
|
+
export interface CalculationErrors {
|
|
8
|
+
count: number;
|
|
9
|
+
/** `Summary!B4 = #N/A (=FORECAST.LINEAR(B3,Data!H2:H37,Data!D2:D37))` */
|
|
10
|
+
samples: string[];
|
|
11
|
+
}
|
|
12
|
+
/** Every formula cell whose calculated value is an error, with `functions` visible. Read from the
|
|
13
|
+
* calculation before display formatting, where an error is an error VALUE: a formula that returns
|
|
14
|
+
* the text "#N/A" is not one. */
|
|
15
|
+
export declare function calculationErrors(sheets: SpreadsheetSheet[], functions?: CustomFunctionSet): CalculationErrors;
|
|
16
|
+
/** The sentence a reply carries about them, or "" when there are none. */
|
|
17
|
+
export declare function calculationErrorsNote({ count, samples }: CalculationErrors): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e,
|
|
1
|
+
import { C as e, b as t, c as n, f as r, l as i, o as a, p as o, s, u as c, v as l, y as u } from "./samples-C5JjpxYJ.js";
|
|
2
2
|
//#region src/core/rangeValues.ts
|
|
3
3
|
var d = 1e5, f = (e) => {
|
|
4
4
|
if (!e) return null;
|
|
@@ -6,13 +6,13 @@ var d = 1e5, f = (e) => {
|
|
|
6
6
|
return t.startsWith("'") && t.endsWith("'") ? t.slice(1, -1).replaceAll("''", "'") : t;
|
|
7
7
|
};
|
|
8
8
|
function p(e) {
|
|
9
|
-
let t = e.lastIndexOf("!"), n = e.slice(t + 1),
|
|
10
|
-
return !
|
|
11
|
-
sheetName: f(
|
|
12
|
-
startRow: Math.min(
|
|
13
|
-
endRow: Math.max(
|
|
14
|
-
startCol: Math.min(
|
|
15
|
-
endCol: Math.max(
|
|
9
|
+
let t = e.lastIndexOf("!"), n = e.slice(t + 1), i = r(n.includes(":") ? e : `${e}:${n}`);
|
|
10
|
+
return !i || !o((n.split(":")[0] ?? "").toUpperCase()) ? null : {
|
|
11
|
+
sheetName: f(i.sheetPrefix),
|
|
12
|
+
startRow: Math.min(i.startRow, i.endRow) - 1,
|
|
13
|
+
endRow: Math.max(i.startRow, i.endRow) - 1,
|
|
14
|
+
startCol: Math.min(i.startCol, i.endCol),
|
|
15
|
+
endCol: Math.max(i.startCol, i.endCol)
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
var m = /[ymdhs]/i, h = (t) => e(t) && typeof t.f == "string" && t.f !== "" && !m.test(t.f);
|
|
@@ -21,26 +21,26 @@ function g(e, t, n) {
|
|
|
21
21
|
}
|
|
22
22
|
var _ = (e) => ({
|
|
23
23
|
name: e.name,
|
|
24
|
-
data:
|
|
24
|
+
data: s(e.data)
|
|
25
25
|
}), v = ({ startRow: e, endRow: t }) => Array.from({ length: t - e + 1 }, (t, n) => e + n), y = ({ startCol: e, endCol: t }) => Array.from({ length: t - e + 1 }, (t, n) => e + n);
|
|
26
|
-
function b(e, t,
|
|
27
|
-
let
|
|
28
|
-
if (!
|
|
29
|
-
let s = (
|
|
26
|
+
function b(e, t, r = n) {
|
|
27
|
+
let o = p(t.trim());
|
|
28
|
+
if (!o) throw Error(`"${t}" is not a range such as Data!A1:C13`);
|
|
29
|
+
let s = (o.endRow - o.startRow + 1) * (o.endCol - o.startCol + 1);
|
|
30
30
|
if (s > 1e5) throw Error(`"${t}" has ${s} cells; the limit is ${d}`);
|
|
31
|
-
let c =
|
|
32
|
-
if (c < 0 || !l) throw Error(`the spreadsheet has no sheet named "${
|
|
33
|
-
let u = e.map(_), f = u[c] ?? _(l), { calculated: m, displayed: h } =
|
|
31
|
+
let c = o.sheetName === null ? 0 : e.findIndex((e) => e.name === o.sheetName), l = e[c];
|
|
32
|
+
if (c < 0 || !l) throw Error(`the spreadsheet has no sheet named "${o.sheetName ?? ""}"`);
|
|
33
|
+
let u = e.map(_), f = u[c] ?? _(l), { calculated: m, displayed: h } = i(r, () => ({
|
|
34
34
|
calculated: a(f, u, { skipFormatting: !0 }).data,
|
|
35
35
|
displayed: a(f, u).data
|
|
36
36
|
}));
|
|
37
|
-
return v(
|
|
37
|
+
return v(o).map((e) => y(o).map((t) => g(f.data[e]?.[t], x(m[e]?.[t]), x(h[e]?.[t]))));
|
|
38
38
|
}
|
|
39
39
|
var x = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? e : void 0;
|
|
40
|
-
async function S(e,
|
|
41
|
-
if (!u(
|
|
42
|
-
let i = l(JSON.parse(await e.read(n
|
|
43
|
-
if (!i) throw Error(`${
|
|
40
|
+
async function S(e, n, r) {
|
|
41
|
+
if (!u(n)) throw Error("path must be a .json file under artifacts/spreadsheets/");
|
|
42
|
+
let i = l(JSON.parse(await e.read(t(n))));
|
|
43
|
+
if (!i) throw Error(`${n} does not hold an array of sheets`);
|
|
44
44
|
let a = await c(i);
|
|
45
45
|
try {
|
|
46
46
|
return b(i, r, a);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./samples-UnTPgkyq.cjs");var t=1e5,n=e=>{if(!e)return null;let t=e.slice(0,-1);return t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1).replaceAll(`''`,`'`):t};function r(t){let r=t.lastIndexOf(`!`),i=t.slice(r+1),a=e.f(i.includes(`:`)?t:`${t}:${i}`);return!a||!e.p((i.split(`:`)[0]??``).toUpperCase())?null:{sheetName:n(a.sheetPrefix),startRow:Math.min(a.startRow,a.endRow)-1,endRow:Math.max(a.startRow,a.endRow)-1,startCol:Math.min(a.startCol,a.endCol),endCol:Math.max(a.startCol,a.endCol)}}var i=/[ymdhs]/i,a=t=>e.C(t)&&typeof t.f==`string`&&t.f!==``&&!i.test(t.f);function o(e,t,n){return n===void 0||n===``?null:typeof n==`number`?n:typeof t==`number`&&a(e)?t:typeof n==`boolean`?String(n).toUpperCase():n}var s=t=>({name:t.name,data:e.s(t.data)}),c=({startRow:e,endRow:t})=>Array.from({length:t-e+1},(t,n)=>e+n),l=({startCol:e,endCol:t})=>Array.from({length:t-e+1},(t,n)=>e+n);function u(n,i,a=e.c){let u=r(i.trim());if(!u)throw Error(`"${i}" is not a range such as Data!A1:C13`);let f=(u.endRow-u.startRow+1)*(u.endCol-u.startCol+1);if(f>1e5)throw Error(`"${i}" has ${f} cells; the limit is ${t}`);let p=u.sheetName===null?0:n.findIndex(e=>e.name===u.sheetName),m=n[p];if(p<0||!m)throw Error(`the spreadsheet has no sheet named "${u.sheetName??``}"`);let h=n.map(s),g=h[p]??s(m),{calculated:_,displayed:v}=e.l(a,()=>({calculated:e.o(g,h,{skipFormatting:!0}).data,displayed:e.o(g,h).data}));return c(u).map(e=>l(u).map(t=>o(g.data[e]?.[t],d(_[e]?.[t]),d(v[e]?.[t]))))}var d=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:void 0;async function f(t,n,r){if(!e.y(n))throw Error(`path must be a .json file under artifacts/spreadsheets/`);let i=e.v(JSON.parse(await t.read(e.b(n))));if(!i)throw Error(`${n} does not hold an array of sheets`);let a=await e.u(i);try{return u(i,r,a)}finally{a.dispose()}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-UnTPgkyq.cjs"),t=require("./core-Cf9Pxo_q.cjs");exports.MAX_RANGE_CELLS=t.t,exports.SYSTEM_PROMPT=e.w,exports.TOOL_DEFINITION=e.T,exports.TOOL_NAME=e.E,exports.calculatedRange=t.n,exports.executeSpreadsheet=e.n,exports.executeSpreadsheetDispatch=e.g,exports.isSpreadsheetArtifactPath=e.y,exports.isSpreadsheetDispatchArgs=e._,exports.pluginCore=e.r,exports.readCalculatedRange=t.r,exports.samples=e.t;
|
package/dist/core.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { E as e, T as t, _ as n, g as r,
|
|
2
|
-
import { n as l, r as u, t as d } from "./core-
|
|
1
|
+
import { E as e, T as t, _ as n, g as r, n as i, r as a, t as o, w as s, y as c } from "./samples-C5JjpxYJ.js";
|
|
2
|
+
import { n as l, r as u, t as d } from "./core-CTRlKL9k.js";
|
|
3
3
|
export { d as MAX_RANGE_CELLS, s as SYSTEM_PROMPT, t as TOOL_DEFINITION, e as TOOL_NAME, l as calculatedRange, i as executeSpreadsheet, r as executeSpreadsheetDispatch, c as isSpreadsheetArtifactPath, n as isSpreadsheetDispatchArgs, a as pluginCore, u as readCalculatedRange, o as samples };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A blank cell standing alone as one side of a comparison: Excel compares it as whatever the
|
|
3
|
+
* other side is — 0 beside a number, FALSE beside a logical value, "" beside text — where the
|
|
4
|
+
* substitution has already read it as 0.
|
|
5
|
+
*/
|
|
6
|
+
import type { CellValue } from "./types";
|
|
7
|
+
/** What a blank compares as beside `other`. */
|
|
8
|
+
export declare const blankBeside: (other: CellValue) => CellValue;
|
|
9
|
+
/**
|
|
10
|
+
* The comparison's values with each blank side read as `blankBeside` its left neighbour (the
|
|
11
|
+
* right one for the first side). In a chain the left neighbour of a later side is the result so
|
|
12
|
+
* far, a logical value; a neighbour that is blank too compares as it was read.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withBlankSides(values: readonly CellValue[], isBlankSide: readonly boolean[]): CellValue[];
|
|
@@ -8,6 +8,13 @@ export declare function normalizeData(data: any): SpreadsheetCell[][];
|
|
|
8
8
|
type SheetCalculateOptions = CalculateOptions & {
|
|
9
9
|
skipFormatting?: boolean;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Calculate formulas in a single sheet
|
|
13
|
+
*
|
|
14
|
+
* @param sheet - Sheet data to calculate
|
|
15
|
+
* @param allSheets - All sheets for cross-sheet references
|
|
16
|
+
* @returns Calculated sheet with formulas evaluated
|
|
17
|
+
*/
|
|
11
18
|
export declare function calculateSheet(sheet: SheetData, allSheets?: SheetData[], options?: SheetCalculateOptions): CalculatedSheet;
|
|
12
19
|
/**
|
|
13
20
|
* Calculate all sheets in a workbook
|
|
@@ -64,6 +64,8 @@ export declare function substituteCellRefs(expr: string, cellRefs: CellRefSpan[]
|
|
|
64
64
|
* @returns Array of argument strings
|
|
65
65
|
*/
|
|
66
66
|
export declare function parseFunctionArgs(argsStr: string): string[];
|
|
67
|
+
/** The reference an operand is, perhaps in brackets, or null when it is anything more. */
|
|
68
|
+
export declare function loneReference(operand: string): string | null;
|
|
67
69
|
/**
|
|
68
70
|
* Evaluate a formula string
|
|
69
71
|
*
|
|
@@ -81,4 +83,4 @@ export declare function parseFunctionArgs(argsStr: string): string[];
|
|
|
81
83
|
* @param context - Evaluation context with cell/range accessors
|
|
82
84
|
* @returns Evaluated result (number or string)
|
|
83
85
|
*/
|
|
84
|
-
export declare function evaluateFormula(
|
|
86
|
+
export declare function evaluateFormula(writtenFormula: string, context: EvaluatorContext): CellValue;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Statistical Functions
|
|
3
3
|
*/
|
|
4
|
-
import { type FunctionContext, type RangeGetter } from "../registry";
|
|
4
|
+
import { type FunctionContext, type FunctionHandler, type RangeGetter } from "../registry";
|
|
5
|
+
import { type SpreadsheetError } from "../spreadsheet-errors";
|
|
5
6
|
import type { CellValue } from "../types";
|
|
6
7
|
/** One value an argument contributed, tagged by where it came from. A range cell
|
|
7
8
|
* was already filtered by the range getter; a scalar is whatever the argument
|
|
@@ -11,5 +12,14 @@ interface ArgumentValue {
|
|
|
11
12
|
isScalar: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare const collectArgumentValues: (args: string[], context: FunctionContext, readRange: RangeGetter) => ArgumentValue[];
|
|
15
|
+
/** The numbers an aggregate reads from its arguments, or the first error among them in argument
|
|
16
|
+
* order — an error cell in a range, or an argument that evaluated to one — read in one pass, so
|
|
17
|
+
* no argument is read or evaluated twice. A range keeps only the cells that hold a number, as the
|
|
18
|
+
* numeric read does. */
|
|
19
|
+
export declare const collectNumbersOrError: (args: string[], context: FunctionContext) => number[] | SpreadsheetError;
|
|
20
|
+
/** The cells of a range read blank-aware that hold a number, as numbers — what the numeric read keeps. */
|
|
21
|
+
export declare const rangeNumbers: (values: CellValue[]) => number[];
|
|
22
|
+
/** The handler's rule over the numbers of its arguments, or the first error among them. */
|
|
23
|
+
export declare const overNumbers: (rule: (values: number[]) => CellValue) => FunctionHandler;
|
|
14
24
|
export declare const collectNumericValues: (args: string[], context: FunctionContext) => number[];
|
|
15
25
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The logical literals `TRUE` and `FALSE` written in a formula, in any case, as the boolean values
|
|
3
|
+
* a logical cell already renders as (`true` / `false`), so a written TRUE and a cell holding TRUE
|
|
4
|
+
* read alike. A function call (`TRUE()`), a sheet name (`TRUE!A1`) and text in quotes are left.
|
|
5
|
+
*/
|
|
6
|
+
export declare function logicalLiteralsAsBooleans(formula: string): string;
|
|
7
|
+
/** The boolean an expression is when it is nothing but one, or null. */
|
|
8
|
+
export declare function loneBoolean(expr: string): boolean | null;
|
|
9
|
+
/** An expression with its booleans as the numbers arithmetic reads them (TRUE is 1), when it holds
|
|
10
|
+
* no text that could contain the words. */
|
|
11
|
+
export declare function booleansAsNumbers(expr: string): string;
|
|
@@ -21,6 +21,8 @@ export interface FunctionContext {
|
|
|
21
21
|
/** How many cells of a range hold something, a formula's "" included (COUNTA). */
|
|
22
22
|
countFilledCells?: ((range: string) => number) | undefined;
|
|
23
23
|
evaluateFormula: (formula: string) => CellValue;
|
|
24
|
+
/** Whether an argument is nothing but a reference to a blank cell, which evaluating reads as 0. */
|
|
25
|
+
isBlankReference?: ((arg: string) => boolean) | undefined;
|
|
24
26
|
/** Read an ambiguous `01/02/2020` as day-first, as the sheet's own dates are. */
|
|
25
27
|
preferDDMMYYYY?: boolean | undefined;
|
|
26
28
|
}
|
|
@@ -92,9 +94,7 @@ export declare const isCallableName: (name: string) => boolean;
|
|
|
92
94
|
* in numericCoercion.parseNumericString, shared with the strict scalar read.
|
|
93
95
|
*/
|
|
94
96
|
export declare function toNumber(value: CellValue): number;
|
|
95
|
-
/**
|
|
96
|
-
* Helper function to convert a value to a string
|
|
97
|
-
*/
|
|
97
|
+
/** A value as text, as Excel writes it: a logical value is TRUE or FALSE. */
|
|
98
98
|
export declare function toString(value: CellValue): string;
|
|
99
99
|
/**
|
|
100
100
|
* Helper to parse criteria for conditional functions like COUNTIF, SUMIF
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the sheet out of a sheet-qualified reference: `Data!A1`, `'My Sheet'!A1:B2`, and a
|
|
3
|
+
* quoted name holding an apostrophe written twice, as Excel writes it (`'It''s'!A1` names It's).
|
|
4
|
+
*/
|
|
5
|
+
/** A reference split from the sheet it names. */
|
|
6
|
+
export interface SheetQualifiedReference {
|
|
7
|
+
sheetName: string;
|
|
8
|
+
ref: string;
|
|
9
|
+
}
|
|
10
|
+
/** The sheet a reference names and the reference within it, or null when it names no sheet. */
|
|
11
|
+
export declare function splitSheetReference(fullRef: string): SheetQualifiedReference | null;
|
|
12
|
+
/** The index just past the closing quote of the sheet name that opens at `start` (a `'`), a
|
|
13
|
+
* doubled `''` inside it read as part of the name; -1 when the name never closes. */
|
|
14
|
+
export declare function endOfQuotedSheetName(text: string, start: number): number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whole-column (`A:A`, `B:D`) and whole-row (`1:1`, `2:5`) references, rewritten as the bounded
|
|
3
|
+
* range they cover in their sheet: `A:A` becomes `A1:A<last row>`, `1:1` becomes
|
|
4
|
+
* `A1:<last column>1`. Everything past a sheet's data is blank, so the answers are Excel's, and
|
|
5
|
+
* every reader downstream (ranges, lookups, argument checks) sees an ordinary `A1:B2` range.
|
|
6
|
+
*/
|
|
7
|
+
/** How far a sheet's data reaches: the number of rows, and the longest row's length. */
|
|
8
|
+
export interface SheetExtent {
|
|
9
|
+
rows: number;
|
|
10
|
+
columns: number;
|
|
11
|
+
}
|
|
12
|
+
/** The extent of the sheet a reference names (`null` for the formula's own sheet), or null when there is no such sheet. */
|
|
13
|
+
export type ExtentOf = (sheetName: string | null) => SheetExtent | null;
|
|
14
|
+
/**
|
|
15
|
+
* The formula with every whole-column and whole-row reference bounded to its sheet's data. Text
|
|
16
|
+
* inside a string literal (`"A:A"`) is left as written. A reference to a sheet that does not
|
|
17
|
+
* exist is left as written too, so it fails as any reference to that sheet does.
|
|
18
|
+
*/
|
|
19
|
+
export declare function boundWholeReferences(formula: string, extentOf: ExtentOf): string;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-UnTPgkyq.cjs"),t=require("./core-Cf9Pxo_q.cjs");exports.MAX_RANGE_CELLS=t.t,exports.SYSTEM_PROMPT=e.w,exports.TOOL_DEFINITION=e.T,exports.TOOL_NAME=e.E,exports.calculatedRange=t.n,exports.executeSpreadsheet=e.n,exports.executeSpreadsheetDispatch=e.g,exports.isSpreadsheetArtifactPath=e.y,exports.isSpreadsheetDispatchArgs=e._,exports.pluginCore=e.r,exports.readCalculatedRange=t.r,exports.samples=e.t;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { E as e, T as t, _ as n, g as r,
|
|
2
|
-
import { n as l, r as u, t as d } from "./core-
|
|
1
|
+
import { E as e, T as t, _ as n, g as r, n as i, r as a, t as o, w as s, y as c } from "./samples-C5JjpxYJ.js";
|
|
2
|
+
import { n as l, r as u, t as d } from "./core-CTRlKL9k.js";
|
|
3
3
|
export { d as MAX_RANGE_CELLS, s as SYSTEM_PROMPT, t as TOOL_DEFINITION, e as TOOL_NAME, l as calculatedRange, i as executeSpreadsheet, r as executeSpreadsheetDispatch, c as isSpreadsheetArtifactPath, n as isSpreadsheetDispatchArgs, a as pluginCore, u as readCalculatedRange, o as samples };
|