@pixerate/editor 0.22.0 → 0.24.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 +175 -2
- package/THIRD_PARTY_NOTICES.md +139 -0
- package/dist/agent/index.cjs +87 -111
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +70 -211
- package/dist/agent/index.d.ts +70 -211
- package/dist/agent/index.js +78 -102
- package/dist/agent/index.js.map +1 -1
- package/dist/arrangeShortcuts-B8O3f8-P.d.cts +184 -0
- package/dist/arrangeShortcuts-sLlD2rSX.d.ts +184 -0
- package/dist/canvas/index.cjs +2075 -86
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +608 -186
- package/dist/canvas/index.d.ts +608 -186
- package/dist/canvas/index.js +2060 -71
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-26BVFKHU.cjs +453 -0
- package/dist/chunk-26BVFKHU.cjs.map +1 -0
- package/dist/chunk-2H7ZHPEJ.js +762 -0
- package/dist/chunk-2H7ZHPEJ.js.map +1 -0
- package/dist/{chunk-DENSCKFC.js → chunk-3CN2WD3X.js} +1730 -189
- package/dist/chunk-3CN2WD3X.js.map +1 -0
- package/dist/{chunk-JJDLPEWL.js → chunk-3LV6RRPH.js} +2 -2
- package/dist/{chunk-MJZBNWG7.js → chunk-5S3Z4PPF.js} +78 -557
- package/dist/chunk-5S3Z4PPF.js.map +1 -0
- package/dist/chunk-664LQYFJ.js +115 -0
- package/dist/chunk-664LQYFJ.js.map +1 -0
- package/dist/chunk-7DWMJCAT.js +453 -0
- package/dist/chunk-7DWMJCAT.js.map +1 -0
- package/dist/chunk-ARRTP33I.js +101 -0
- package/dist/chunk-ARRTP33I.js.map +1 -0
- package/dist/chunk-CPOKFNBG.cjs +101 -0
- package/dist/chunk-CPOKFNBG.cjs.map +1 -0
- package/dist/{chunk-AA4ZEVCC.cjs → chunk-D27YFC46.cjs} +101 -580
- package/dist/chunk-D27YFC46.cjs.map +1 -0
- package/dist/chunk-D6FH2YAX.cjs +131 -0
- package/dist/chunk-D6FH2YAX.cjs.map +1 -0
- package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
- package/dist/chunk-FD4LPFAE.cjs.map +1 -0
- package/dist/chunk-FODNLX5N.js +749 -0
- package/dist/chunk-FODNLX5N.js.map +1 -0
- package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
- package/dist/chunk-FPENXAEJ.js.map +1 -0
- package/dist/chunk-G2I4QJOT.cjs +762 -0
- package/dist/chunk-G2I4QJOT.cjs.map +1 -0
- package/dist/chunk-HLIMTC6N.js +1 -0
- package/dist/chunk-HLIMTC6N.js.map +1 -0
- package/dist/{chunk-QGHGJ56O.js → chunk-ITBSKI26.js} +1483 -19
- package/dist/chunk-ITBSKI26.js.map +1 -0
- package/dist/{chunk-6M3BCTBD.cjs → chunk-MA2F5KHF.cjs} +470 -242
- package/dist/chunk-MA2F5KHF.cjs.map +1 -0
- package/dist/{chunk-SAZRENEZ.cjs → chunk-MCSJFWAO.cjs} +1733 -192
- package/dist/chunk-MCSJFWAO.cjs.map +1 -0
- package/dist/chunk-MKA3AHLV.cjs +256 -0
- package/dist/chunk-MKA3AHLV.cjs.map +1 -0
- package/dist/chunk-OLZJXL4R.cjs +749 -0
- package/dist/chunk-OLZJXL4R.cjs.map +1 -0
- package/dist/chunk-OXSV64JX.js +689 -0
- package/dist/chunk-OXSV64JX.js.map +1 -0
- package/dist/chunk-P3RQ5UJE.cjs +689 -0
- package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
- package/dist/chunk-P6ODPZ4W.js +256 -0
- package/dist/chunk-P6ODPZ4W.js.map +1 -0
- package/dist/chunk-PGNZKFQS.js +685 -0
- package/dist/chunk-PGNZKFQS.js.map +1 -0
- package/dist/chunk-PL4JB3BF.cjs +1 -0
- package/dist/chunk-PL4JB3BF.cjs.map +1 -0
- package/dist/{chunk-GVSMRPHB.cjs → chunk-SBCZ6RN5.cjs} +1568 -104
- package/dist/chunk-SBCZ6RN5.cjs.map +1 -0
- package/dist/{chunk-CL37JGFW.cjs → chunk-SML64VJG.cjs} +4 -4
- package/dist/{chunk-CL37JGFW.cjs.map → chunk-SML64VJG.cjs.map} +1 -1
- package/dist/chunk-TNNJXF46.cjs +115 -0
- package/dist/chunk-TNNJXF46.cjs.map +1 -0
- package/dist/chunk-U5HZSFCS.js +131 -0
- package/dist/chunk-U5HZSFCS.js.map +1 -0
- package/dist/{chunk-RU52I7QO.js → chunk-U5KWZU4X.js} +388 -160
- package/dist/chunk-U5KWZU4X.js.map +1 -0
- package/dist/chunk-XNORY7M6.cjs +685 -0
- package/dist/chunk-XNORY7M6.cjs.map +1 -0
- package/dist/commands/index.cjs +860 -0
- package/dist/commands/index.cjs.map +1 -0
- package/dist/commands/index.d.cts +244 -0
- package/dist/commands/index.d.ts +244 -0
- package/dist/commands/index.js +860 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/comment-store-BEMgVlAA.d.cts +135 -0
- package/dist/comment-store-BEMgVlAA.d.ts +135 -0
- package/dist/compare/index.cjs +15 -0
- package/dist/compare/index.cjs.map +1 -0
- package/dist/compare/index.d.cts +58 -0
- package/dist/compare/index.d.ts +58 -0
- package/dist/compare/index.js +15 -0
- package/dist/compare/index.js.map +1 -0
- package/dist/{controller-B7GIybc4.d.cts → controller-BhLLAoi8.d.cts} +119 -5
- package/dist/{controller-B7GIybc4.d.ts → controller-BhLLAoi8.d.ts} +119 -5
- package/dist/documents-BQjzJNe2.d.ts +76 -0
- package/dist/documents-KRTPhvst.d.cts +76 -0
- package/dist/extensions/index.cjs +53 -5
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +7 -3
- package/dist/extensions/index.d.ts +7 -3
- package/dist/extensions/index.js +52 -4
- package/dist/generation/index.cjs +1373 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +554 -0
- package/dist/generation/index.d.ts +554 -0
- package/dist/generation/index.js +1373 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/grammar/index.cjs +48 -3
- package/dist/grammar/index.cjs.map +1 -1
- package/dist/grammar/index.d.cts +322 -100
- package/dist/grammar/index.d.ts +322 -100
- package/dist/grammar/index.js +54 -9
- package/dist/history/index.cjs +12 -2
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +211 -7
- package/dist/history/index.d.ts +211 -7
- package/dist/history/index.js +13 -3
- package/dist/image-editor/index.cjs +2244 -38
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +742 -4
- package/dist/image-editor/index.d.ts +742 -4
- package/dist/image-editor/index.js +2222 -16
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{index-CCr_z9kF.d.cts → index-BhJBSm2d.d.cts} +370 -4
- package/dist/{index-Ck6ajwXh.d.ts → index-fJrlkJCd.d.ts} +370 -4
- package/dist/index.cjs +193 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -48
- package/dist/index.d.ts +17 -48
- package/dist/index.js +198 -103
- package/dist/index.js.map +1 -1
- package/dist/migrate-iTlm3a8h.d.cts +112 -0
- package/dist/migrate-iTlm3a8h.d.ts +112 -0
- package/dist/persistence/index.cjs +676 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +347 -0
- package/dist/persistence/index.d.ts +347 -0
- package/dist/persistence/index.js +676 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/registry-BDe-vlv3.d.ts +171 -0
- package/dist/registry-D32LpIc4.d.cts +354 -0
- package/dist/registry-DnzpgY27.d.cts +171 -0
- package/dist/registry-evKTP4ls.d.ts +354 -0
- package/dist/schema-DYDGdYL9.d.cts +41 -0
- package/dist/schema-DYDGdYL9.d.ts +41 -0
- package/dist/serializers/index.cjs +4 -3
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +2 -1
- package/dist/serializers/index.d.ts +2 -1
- package/dist/serializers/index.js +3 -2
- package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
- package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
- package/dist/spreadsheet/index.cjs +53 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +247 -18
- package/dist/spreadsheet/index.d.ts +247 -18
- package/dist/spreadsheet/index.js +58 -8
- package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
- package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
- package/dist/{track-changes-BSF58RK0.d.cts → track-changes-BK5sVf4_.d.cts} +18 -136
- package/dist/{track-changes-BSF58RK0.d.ts → track-changes-CDjCrwKe.d.ts} +18 -136
- package/dist/{types-CJ4U-HHI.d.ts → types-DX4Mh4SL.d.cts} +1 -1
- package/dist/{types-CJ4U-HHI.d.cts → types-DX4Mh4SL.d.ts} +1 -1
- package/dist/types-GT5a5YAX.d.cts +86 -0
- package/dist/types-GT5a5YAX.d.ts +86 -0
- package/package.json +23 -2
- package/dist/chunk-2TWGLC5K.cjs +0 -262
- package/dist/chunk-2TWGLC5K.cjs.map +0 -1
- package/dist/chunk-4SUNJZWB.cjs.map +0 -1
- package/dist/chunk-6M3BCTBD.cjs.map +0 -1
- package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
- package/dist/chunk-AXV2ZW34.cjs +0 -118
- package/dist/chunk-AXV2ZW34.cjs.map +0 -1
- package/dist/chunk-B2ZRLN4S.js +0 -118
- package/dist/chunk-B2ZRLN4S.js.map +0 -1
- package/dist/chunk-DENSCKFC.js.map +0 -1
- package/dist/chunk-GVSMRPHB.cjs.map +0 -1
- package/dist/chunk-KAADNAPF.js +0 -262
- package/dist/chunk-KAADNAPF.js.map +0 -1
- package/dist/chunk-MJZBNWG7.js.map +0 -1
- package/dist/chunk-OYXSKQFR.js.map +0 -1
- package/dist/chunk-QGHGJ56O.js.map +0 -1
- package/dist/chunk-RU52I7QO.js.map +0 -1
- package/dist/chunk-SAZRENEZ.cjs.map +0 -1
- package/dist/types-BZgcDsC5.d.cts +0 -42
- package/dist/types-BZgcDsC5.d.ts +0 -42
- /package/dist/{chunk-JJDLPEWL.js.map → chunk-3LV6RRPH.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ASTNode, r as FormulaErrorCode, v as FormulaRange, G as GroupAggregate, O as SortDirection, e as CellRange, d as CellPosition, p as FilterRule, S as SpreadsheetController } from '../controller-
|
|
2
|
-
export { B as BinaryOpNode, C as CellCoordinate,
|
|
1
|
+
import { A as ASTNode, r as FormulaErrorCode, v as FormulaRange, a as CellData, c as CellFormat, G as GroupAggregate, O as SortDirection, e as CellRange, d as CellPosition, p as FilterRule, S as SpreadsheetController } from '../controller-BhLLAoi8.js';
|
|
2
|
+
export { B as BinaryOpNode, C as CellCoordinate, b as CellDep, f as CellRefNode, g as CellValueReader, h as ColumnBinding, i as ColumnType, j as CsvExportOptions, k as CsvImportOptions, D as DEFAULT_COLUMN_WIDTH, l as DEFAULT_ROW_HEIGHT, m as DataSourceBinder, n as DependencyGraph, E as EvaluationContext, F as FORMULA_ERRORS, o as FilterOperator, q as FormulaDiagnostic, s as FormulaEvaluationResult, t as FormulaEvaluator, u as FormulaParser, w as FormulaToken, x as FormulaTokenType, y as FunctionCallNode, z as GroupSummary, L as LiteralNode, M as MAX_FORMULA_ARRAY_SIZE, N as NameNode, H as NewFilterRule, P as ParsedSpreadsheetClipboard, I as PropertyRefNode, R as RangeNode, J as RowType, K as SPREADSHEET_CLIPBOARD_MIME, Q as SortKey, T as SpillRefNode, U as SpreadsheetCellSpan, V as SpreadsheetClipboardCell, W as SpreadsheetClipboardData, X as SpreadsheetClipboardPayload, Y as SpreadsheetClipboardSource, Z as SpreadsheetColumn, _ as SpreadsheetControllerOptions, $ as SpreadsheetDataSource, a0 as SpreadsheetDataSourceField, a1 as SpreadsheetDocument, a2 as SpreadsheetFilterState, a3 as SpreadsheetGrouping, a4 as SpreadsheetRow, a5 as SpreadsheetRowGroup, a6 as SpreadsheetRowSection, a7 as SpreadsheetSpill, a8 as SpreadsheetTableSettings, a9 as SpreadsheetViewColumn, aa as SpreadsheetViewModel, ab as SpreadsheetViewRow, ac as StructuralChange, ad as UnaryOpNode, ae as WHOLE_COLUMN_END_ROW, af as buildSpreadsheetView, ag as colNameToIndex, ah as columnDependencyKey, ai as compareNumbers, aj as compareValues, ak as computeRowGroups, al as createSpreadsheetClipboardData, am as describeFormulaError, an as extractCellDependencies, ao as getRowSection, ap as getTableSections, aq as indexToColName, ar as isFormulaError, as as mapFormulaReferences, at as numberToText, au as offsetFormulaReferences, av as parseCellReference, aw as parseFormula, ax as parseHtmlTable, ay as parseRange, az as readSpreadsheetClipboard, aA as rebaseClipboardRows, aB as remapFormulaReferences, aC as rowPassesFilters, aD as serializeHtmlTable, aE as shiftFormulaReferences, aF as sortCompareValues, aG as tokenizeFormula } from '../controller-BhLLAoi8.js';
|
|
3
3
|
import { I as ImportAdapterRegistry, c as ImportAdapter, h as ImportInput, a as ImportOutcome } from '../registry-GJI4gToU.js';
|
|
4
4
|
|
|
5
5
|
type FormulaFunctionCategory = 'math' | 'statistical' | 'logical' | 'text' | 'lookup' | 'date' | 'information';
|
|
@@ -202,24 +202,234 @@ declare function wildcardToRegExp(pattern: string): RegExp;
|
|
|
202
202
|
* Parses a criterion as used by SUMIF, COUNTIFS etc.:
|
|
203
203
|
* - a number or boolean matches equal values (`5` matches 5 and the text "5");
|
|
204
204
|
* - text may start with `=`, `<>`, `<`, `<=`, `>` or `>=`. Numeric operands
|
|
205
|
-
*
|
|
205
|
+
* (typed-input rules: `">1,000"`, `"<50%"`, `">$5"`) compare numbers; date
|
|
206
|
+
* operands (`">=3/1/2026"`, `"<2026-03-01"`) compare ISO dates (and serial
|
|
207
|
+
* numbers) chronologically; text operands compare text case-insensitively;
|
|
206
208
|
* - `=`/`<>` text operands and plain text support `*` and `?` wildcards;
|
|
207
209
|
* - `""` and `"="` match blank cells, `"<>"` matches non-blank cells.
|
|
208
210
|
* Error values in the data never match.
|
|
209
211
|
*/
|
|
210
212
|
declare function parseCriteria(criterion: unknown): FormulaCriteriaPredicate;
|
|
211
213
|
|
|
214
|
+
/** Number format code parsing: sections, bracket tags and tokens. */
|
|
215
|
+
/** Colour from a `[Red]` or `[ColorN]` section tag (`color1`…`color56` = palette index). */
|
|
216
|
+
type NumberFormatColor = 'black' | 'blue' | 'cyan' | 'green' | 'magenta' | 'red' | 'white' | 'yellow' | `color${number}`;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The General format squeezed into `maxChars` characters, as Excel shows it
|
|
220
|
+
* in a narrow column: fewer decimals, then scientific notation; `null` when
|
|
221
|
+
* even that does not fit (the caller paints `####`).
|
|
222
|
+
*/
|
|
223
|
+
declare function formatGeneralFit(n: number, maxChars: number): string | null;
|
|
224
|
+
|
|
225
|
+
/** Built-in number formats (ECMA-376 §18.8.30, en-US). */
|
|
212
226
|
/**
|
|
213
|
-
*
|
|
214
|
-
* -
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
227
|
+
* Built-in format code for an id (0–49, en-US), e.g. 14 → `m/d/yyyy`.
|
|
228
|
+
* Locale-specific ids (23–36) and unknown ids return undefined.
|
|
229
|
+
*/
|
|
230
|
+
declare function builtinNumberFormat(id: number): string | undefined;
|
|
231
|
+
/** Id of a built-in format code. Matching ignores case and backslash escapes. */
|
|
232
|
+
declare function builtinNumberFormatId(code: string): number | undefined;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Longest number format code, in characters, that is parsed (Excel's own
|
|
236
|
+
* limit). A longer code displays its value as General and makes `TEXT`
|
|
237
|
+
* return `#VALUE!`. The cap also bounds work that scales with the code.
|
|
238
|
+
*/
|
|
239
|
+
declare const MAX_NUMBER_FORMAT_CODE_CHARS = 255;
|
|
240
|
+
/** Best guess at the ribbon's number-format category. */
|
|
241
|
+
type NumberFormatKind = 'general' | 'number' | 'currency' | 'accounting' | 'date' | 'time' | 'percentage' | 'fraction' | 'scientific' | 'text'
|
|
242
|
+
/** Zip codes, phone numbers, social security numbers. */
|
|
243
|
+
| 'special' | 'custom';
|
|
244
|
+
/** A value formatted with a number format, ready to paint. */
|
|
245
|
+
interface FormattedNumberValue {
|
|
246
|
+
text: string;
|
|
247
|
+
/** Colour from a `[Red]` / `[ColorN]` tag of the section used. */
|
|
248
|
+
color?: NumberFormatColor;
|
|
249
|
+
/**
|
|
250
|
+
* Repeat-fill character from `*x` and its position (UTF-16 index) in
|
|
251
|
+
* `text`; a renderer may repeat it to fill the cell width.
|
|
252
|
+
*/
|
|
253
|
+
fill?: {
|
|
254
|
+
char: string;
|
|
255
|
+
index: number;
|
|
256
|
+
};
|
|
257
|
+
/** True for numbers (right-aligned by default); text, booleans and errors are false. */
|
|
258
|
+
numeric: boolean;
|
|
259
|
+
}
|
|
260
|
+
/** A parsed number format code. Parsing never fails: malformed parts become literal text. */
|
|
261
|
+
declare class NumberFormat {
|
|
262
|
+
readonly code: string;
|
|
263
|
+
private readonly general;
|
|
264
|
+
private readonly sections;
|
|
265
|
+
/** Sections that apply to numbers (a trailing text section is excluded). */
|
|
266
|
+
private readonly numSections;
|
|
267
|
+
/** Index of the section that applies to text, if any. */
|
|
268
|
+
private readonly textSection;
|
|
269
|
+
private constructor();
|
|
270
|
+
/**
|
|
271
|
+
* Parses a format code. Never throws: unknown or malformed parts degrade to
|
|
272
|
+
* literal text, and a code longer than 255 characters degrades to General.
|
|
273
|
+
*/
|
|
274
|
+
static parse(code: string): NumberFormat;
|
|
275
|
+
/** `parse` without the 255-character cap (for tests that reach renderer edge cases). */
|
|
276
|
+
static parseUncapped(code: string): NumberFormat;
|
|
277
|
+
/** Like `parse`, but remembers recently parsed codes (bounded), so formatting many values parses a code once. */
|
|
278
|
+
static parseCached(code: string): NumberFormat;
|
|
279
|
+
static general(): NumberFormat;
|
|
280
|
+
isGeneral(): boolean;
|
|
281
|
+
private numberSections;
|
|
282
|
+
/** True when the code contains date or time tokens. */
|
|
283
|
+
isDate(): boolean;
|
|
284
|
+
isPercent(): boolean;
|
|
285
|
+
/** True for a pure text format such as `@`. */
|
|
286
|
+
isText(): boolean;
|
|
287
|
+
/** Best guess at the format category. */
|
|
288
|
+
kind(): NumberFormatKind;
|
|
289
|
+
/**
|
|
290
|
+
* Picks the number section for `v`, and whether the minus sign is dropped
|
|
291
|
+
* (a negative section shows the absolute value). Null means General.
|
|
292
|
+
*/
|
|
293
|
+
private select;
|
|
294
|
+
/**
|
|
295
|
+
* Formats a number. `overflow` is true when the value can't be shown (a
|
|
296
|
+
* date out of range, painted as `########`).
|
|
297
|
+
*/
|
|
298
|
+
formatNumber(n: number): FormattedNumberValue & {
|
|
299
|
+
overflow: boolean;
|
|
300
|
+
};
|
|
301
|
+
/** Formats text through the text section (`@`), or returns it unchanged. */
|
|
302
|
+
formatText(text: string): FormattedNumberValue;
|
|
303
|
+
/**
|
|
304
|
+
* Formats a cell value: numbers through the number sections, ISO date text
|
|
305
|
+
* (`2026-03-04`, `2026-03-04 18:00:00`) and `Date`s as serial numbers, other
|
|
306
|
+
* text through the text section; booleans show TRUE/FALSE and error values
|
|
307
|
+
* themselves.
|
|
308
|
+
*/
|
|
309
|
+
format(value: unknown): FormattedNumberValue;
|
|
310
|
+
}
|
|
311
|
+
/** Empties the parse cache used by `NumberFormat.parseCached` (mainly for tests). */
|
|
312
|
+
declare function clearNumberFormatCache(): void;
|
|
313
|
+
/**
|
|
314
|
+
* 1900-system serial number of a date value: ISO date text (with an optional
|
|
315
|
+
* time) or a `Date` (its local date and time). Null for anything else.
|
|
316
|
+
*/
|
|
317
|
+
declare function dateValueToSerial(value: unknown): number | null;
|
|
318
|
+
/** Formats a cell value with a format code (see `NumberFormat.format`). */
|
|
319
|
+
declare function formatNumberFormatValue(value: unknown, code: string): FormattedNumberValue;
|
|
320
|
+
/**
|
|
321
|
+
* The `TEXT()` worksheet function: formats a value with a format code.
|
|
322
|
+
* Blanks count as 0; numeric and date text (`"5"`, `"3/4/2026"`,
|
|
323
|
+
* `"2026-03-04"`) is converted to a number first; other text and booleans
|
|
324
|
+
* (as TRUE/FALSE) go through the text section, or are returned as is.
|
|
325
|
+
* Errors: the value's own error, `#VALUE!` for a code over 255 characters or
|
|
326
|
+
* a date out of range, `#NUM!` for a non-finite number.
|
|
327
|
+
*/
|
|
328
|
+
declare function formatTextFunction(value: unknown, code: string): {
|
|
329
|
+
text: string;
|
|
330
|
+
} | {
|
|
331
|
+
error: string;
|
|
332
|
+
};
|
|
333
|
+
/** CSS colour for a format colour (`red` → `#FF0000`, `color10` → `#008000`). */
|
|
334
|
+
declare function numberFormatColorToCss(color: NumberFormatColor): string;
|
|
335
|
+
|
|
336
|
+
type DisplayCell = Pick<CellData, 'value' | 'error' | 'numberFormat' | 'format'>;
|
|
337
|
+
/**
|
|
338
|
+
* How a cell is shown: its error, or its value formatted with its number
|
|
339
|
+
* format code (`numberFormat`: set explicitly, inherited from the column, or
|
|
340
|
+
* chosen for typed input, e.g. `"$"#,##0.00` for `$1,200.50`). Numbers in a
|
|
341
|
+
* cell with a `currency` / `percentage` / `date` `CellFormat` but no code use
|
|
342
|
+
* that kind's code. Without a code (General), numbers use up to 15
|
|
343
|
+
* significant digits and booleans show as TRUE/FALSE.
|
|
344
|
+
*
|
|
345
|
+
* `numeric` is true for numbers (and dates shown through a date format):
|
|
346
|
+
* grids right-align those. `color` comes from a `[Red]` / `[ColorN]` tag.
|
|
347
|
+
*/
|
|
348
|
+
declare function formatCellForDisplay(cell: DisplayCell | null | undefined): FormattedNumberValue;
|
|
349
|
+
/** The text a cell shows (see `formatCellForDisplay`). Used by grids, CSV export and the clipboard. */
|
|
350
|
+
declare function formatCellDisplay(cell: DisplayCell | null | undefined): string;
|
|
351
|
+
/**
|
|
352
|
+
* Formats a value with a number format code, as `TEXT()` does (see
|
|
353
|
+
* `formatTextFunction`). Null when the value can't be shown with that code
|
|
354
|
+
* (a date out of range, a code over 255 characters, an error value).
|
|
220
355
|
*/
|
|
221
356
|
declare function formatValueWithCode(value: unknown, format: string): string | null;
|
|
222
357
|
|
|
358
|
+
/**
|
|
359
|
+
* Parsing what people type into a cell (and numeric text in formulas).
|
|
360
|
+
*
|
|
361
|
+
* Recognises numbers with thousands separators, percentages, currency,
|
|
362
|
+
* scientific notation, fractions (`1 1/2`), dates (`3/4/2026`, `2026-03-04`,
|
|
363
|
+
* `4-Mar-2026`, `Mar 4, 2026`), times (`10:30`, `10:30:15 PM`) and
|
|
364
|
+
* date-times. Locale: en-US (month/day/year).
|
|
365
|
+
*
|
|
366
|
+
* Representation: our engine keeps dates as ISO text (`2026-03-04`, or
|
|
367
|
+
* `2026-03-04 18:00:00` with a time), so a typed date becomes ISO text, not a
|
|
368
|
+
* serial number. A time typed on its own (`12:00`) has no date to anchor ISO
|
|
369
|
+
* text to, so it becomes a fraction of a day (0.5), as in Excel.
|
|
370
|
+
*/
|
|
371
|
+
|
|
372
|
+
/** Kind of automatic number format chosen for typed input. */
|
|
373
|
+
type CellInputFormatKind = 'number' | 'currency' | 'percentage' | 'date' | 'time';
|
|
374
|
+
interface ParsedCellInput {
|
|
375
|
+
/** The typed value: number, boolean, ISO date text, error code or text. `''` for empty input. */
|
|
376
|
+
value: string | number | boolean;
|
|
377
|
+
type: 'empty' | 'text' | 'number' | 'boolean' | 'error' | 'date';
|
|
378
|
+
/**
|
|
379
|
+
* Number format code Excel would apply automatically (e.g. `"$"#,##0.00`,
|
|
380
|
+
* `0%`, `#,##0`, `m/d/yyyy`, `h:mm`), or undefined for General.
|
|
381
|
+
*/
|
|
382
|
+
numberFormat?: string;
|
|
383
|
+
/** What kind of format that is, if any. */
|
|
384
|
+
formatKind?: CellInputFormatKind;
|
|
385
|
+
/** `formatKind` mapped onto `CellFormat` (times have no `CellFormat` and map to undefined). */
|
|
386
|
+
cellFormat?: CellFormat;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Excel 1900-system serial for a date (1 = 1900-01-01, 60 = the fictitious
|
|
390
|
+
* 1900-02-29). Month and day overflow roll over like `DATE()`; years 0–1899
|
|
391
|
+
* are added to 1900. Null before the epoch or after 9999-12-31.
|
|
392
|
+
*/
|
|
393
|
+
declare function serialFromYmd(year: number, month: number, day: number): number | null;
|
|
394
|
+
/**
|
|
395
|
+
* Interprets typed cell input (not formulas). Text that isn't a number,
|
|
396
|
+
* date, time, boolean or error stays text; a leading apostrophe forces text.
|
|
397
|
+
*/
|
|
398
|
+
declare function parseCellInput(input: string): ParsedCellInput;
|
|
399
|
+
/**
|
|
400
|
+
* Numeric text as arithmetic coerces it ("1,000", "50%", "$3", "1/2/2020",
|
|
401
|
+
* "10:00"); dates become 1900-system serial numbers. Null when it isn't numeric.
|
|
402
|
+
*/
|
|
403
|
+
declare function parseNumberText(text: string): number | null;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Common number formats offered by the "Format cells" menu, and the mapping
|
|
407
|
+
* between format codes and the coarser `CellFormat` kinds.
|
|
408
|
+
*/
|
|
409
|
+
|
|
410
|
+
interface NumberFormatPreset {
|
|
411
|
+
id: 'general' | 'number' | 'currency' | 'percent' | 'date' | 'time';
|
|
412
|
+
label: string;
|
|
413
|
+
code: string;
|
|
414
|
+
}
|
|
415
|
+
/** Presets of the "Format cells" menu (en-US). */
|
|
416
|
+
declare const NUMBER_FORMAT_PRESETS: readonly NumberFormatPreset[];
|
|
417
|
+
/**
|
|
418
|
+
* Format code for a `CellFormat` kind, used to display numbers in cells that
|
|
419
|
+
* have a kind but no format code: `currency` → `"$"#,##0.00`, `percentage` →
|
|
420
|
+
* `0%`, `date` → `m/d/yyyy`. Other kinds (`number`, `text` — the default of
|
|
421
|
+
* new columns —, `badge`, `status`, `assignee`) display as General (undefined).
|
|
422
|
+
*/
|
|
423
|
+
declare function numberFormatForCellFormat(format: CellFormat | undefined): string | undefined;
|
|
424
|
+
/**
|
|
425
|
+
* `CellFormat` kind matching a format code (`"$"#,##0.00` → `currency`,
|
|
426
|
+
* `0%` → `percentage`, `m/d/yyyy` → `date`, `0.00` → `number`, `@` → `text`);
|
|
427
|
+
* undefined for General, times and custom codes.
|
|
428
|
+
*/
|
|
429
|
+
declare function cellFormatForNumberFormat(code: string): CellFormat | undefined;
|
|
430
|
+
/** True for an empty or `General` code. */
|
|
431
|
+
declare const isGeneralNumberFormat: (code: string | undefined) => boolean;
|
|
432
|
+
|
|
223
433
|
/**
|
|
224
434
|
* RFC 4180 CSV (and other delimiter-separated values) parsing and
|
|
225
435
|
* serialization.
|
|
@@ -288,9 +498,11 @@ declare function isBlankValue(value: unknown): boolean;
|
|
|
288
498
|
/** The numeric value of a number or numeric string, or null. */
|
|
289
499
|
declare function toNumber(value: unknown): number | null;
|
|
290
500
|
/**
|
|
291
|
-
* Sort order for cell values: numbers (ascending)
|
|
292
|
-
*
|
|
293
|
-
*
|
|
501
|
+
* Sort order for cell values, as in Excel: numbers (ascending), then text,
|
|
502
|
+
* booleans and errors; `desc` reverses that order. Numbers compare at 15
|
|
503
|
+
* significant digits and ISO dates chronologically. Text uses a natural,
|
|
504
|
+
* case-insensitive order ("Item 2" before "Item 10"). Blanks always sort
|
|
505
|
+
* last, whatever the direction.
|
|
294
506
|
*/
|
|
295
507
|
declare function compareCellValues(a: unknown, b: unknown, direction?: SortDirection): number;
|
|
296
508
|
/** Whether a cell value passes one filter rule. */
|
|
@@ -308,8 +520,8 @@ declare function roundFloat(value: number): number;
|
|
|
308
520
|
* nearest-first) by `count` values, the way a fill handle does:
|
|
309
521
|
*
|
|
310
522
|
* - numbers: one value repeats; two or more continue their linear trend
|
|
311
|
-
* -
|
|
312
|
-
* continue their day or month step
|
|
523
|
+
* - dates (ISO `YYYY-MM-DD`, or typed like `3/4/2026`): one date counts up
|
|
524
|
+
* by a day; two or more continue their day or month step (as ISO dates)
|
|
313
525
|
* - text ending in a number ("Item 1"): the number counts up (or continues
|
|
314
526
|
* the step of several values with the same prefix/suffix)
|
|
315
527
|
* - anything else (or a mix) repeats the source cyclically
|
|
@@ -343,8 +555,25 @@ interface SpreadsheetMenuItem {
|
|
|
343
555
|
disabled?: boolean;
|
|
344
556
|
/** Draw a divider before this item. */
|
|
345
557
|
separatorBefore?: boolean;
|
|
346
|
-
|
|
558
|
+
/** The item is the current choice of its group (e.g. the cell's number format). */
|
|
559
|
+
checked?: boolean;
|
|
560
|
+
/**
|
|
561
|
+
* Ask for text before running (e.g. a custom number format code): the
|
|
562
|
+
* editor prompts with `label` and `defaultValue`, then calls `run(text)`;
|
|
563
|
+
* cancelling skips `run`.
|
|
564
|
+
*/
|
|
565
|
+
input?: {
|
|
566
|
+
label: string;
|
|
567
|
+
defaultValue?: string;
|
|
568
|
+
};
|
|
569
|
+
run: (input?: string) => void;
|
|
347
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* Runs a menu item the way the editors do: an item with `input` first asks
|
|
573
|
+
* for text with `ask` (default `window.prompt`) and is skipped when that is
|
|
574
|
+
* cancelled. Returns whether `run` was called.
|
|
575
|
+
*/
|
|
576
|
+
declare function runSpreadsheetMenuItem(item: SpreadsheetMenuItem, ask?: (label: string, defaultValue: string) => string | null | undefined): boolean;
|
|
348
577
|
/**
|
|
349
578
|
* Where to place a `position: fixed` menu opened at `point` so it stays inside
|
|
350
579
|
* the viewport: it flips to the left of / above the pointer when it would
|
|
@@ -379,7 +608,7 @@ declare function getSpreadsheetMenuItems(controller: SpreadsheetController, cell
|
|
|
379
608
|
* state syncing: the controller reports changes through `onDocumentChange`
|
|
380
609
|
* and `onSelectionChange`.
|
|
381
610
|
*/
|
|
382
|
-
declare const SPREADSHEET_TABLE_ACTIONS: readonly ["sortRows", "getFilterState", "setFilterRules", "addFilterRule", "updateFilterRule", "removeFilterRule", "clearFilters", "setFiltersEnabled", "toggleFilters", "setHeaderRowCount", "setFooterRowCount", "setHeaderColumnCount", "setFrozenRowCount", "setFrozenColumnCount", "hideRows", "unhideRows", "hideColumns", "unhideColumns", "unhideAll", "getMerges", "getMergeAt", "mergeCells", "unmergeCells", "autofill", "groupRowsBy", "ungroupRows", "setGroupSummary", "setGroupCollapsed", "toggleGroupCollapsed", "getGroups", "transposeRange", "exportToCsv", "importFromCsv", "copyToClipboardData", "pasteClipboardData"];
|
|
611
|
+
declare const SPREADSHEET_TABLE_ACTIONS: readonly ["sortRows", "getFilterState", "setFilterRules", "addFilterRule", "updateFilterRule", "removeFilterRule", "clearFilters", "setFiltersEnabled", "toggleFilters", "setHeaderRowCount", "setFooterRowCount", "setHeaderColumnCount", "setFrozenRowCount", "setFrozenColumnCount", "hideRows", "unhideRows", "hideColumns", "unhideColumns", "unhideAll", "getMerges", "getMergeAt", "mergeCells", "unmergeCells", "autofill", "groupRowsBy", "ungroupRows", "setGroupSummary", "setGroupCollapsed", "toggleGroupCollapsed", "getGroups", "transposeRange", "setCellNumberFormat", "setColumnNumberFormat", "exportToCsv", "importFromCsv", "copyToClipboardData", "pasteClipboardData"];
|
|
383
612
|
type SpreadsheetTableActionName = (typeof SPREADSHEET_TABLE_ACTIONS)[number];
|
|
384
613
|
type SpreadsheetTableActions = Pick<SpreadsheetController, SpreadsheetTableActionName>;
|
|
385
614
|
/** The table operations of `controller`, bound so they can be passed around. */
|
|
@@ -427,4 +656,4 @@ interface ImportFileIntoSpreadsheetOptions {
|
|
|
427
656
|
*/
|
|
428
657
|
declare function importFileIntoSpreadsheet(controller: SpreadsheetController, input: ImportInput, options: ImportFileIntoSpreadsheetOptions): Promise<ImportOutcome<SpreadsheetImport>>;
|
|
429
658
|
|
|
430
|
-
export { ASTNode, CellPosition, CellRange, type CsvParseOptions, type CsvSerializeOptions, type FillDirection, FilterRule, type FormulaActiveCall, type FormulaArgument, type FormulaArgumentSpec, type FormulaArgumentType, type FormulaCaretContext, type FormulaCriteriaPredicate, FormulaErrorCode, type FormulaFunctionCategory, type FormulaFunctionContext, type FormulaFunctionDefinition, type FormulaFunctionSuggestion, type FormulaHints, FormulaRange, type FormulaSignaturePart, GroupAggregate, type ImportFileIntoSpreadsheetOptions, SPREADSHEET_IMPORT_ADAPTERS, SPREADSHEET_TABLE_ACTIONS, SortDirection, SpreadsheetController, type SpreadsheetImport, type SpreadsheetImportAdapter, type SpreadsheetMenuItem, type SpreadsheetTableActionName, type SpreadsheetTableActions, aggregateValues, applyFormulaSuggestion, bindSpreadsheetTableActions, checkFormulaArgumentCount, clampMenuPosition, compareCellValues, computeFillTarget, csvImportAdapter, escapeCsvField, fillSeries, formatValueWithCode, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getSpreadsheetMenuItems, importFileIntoSpreadsheet, isBlankValue, isSingleCellRange, listFormulaFunctions, matchesFilterRule, normalizeRange, parseCriteria, parseCsv, parseTsv, rangeContains, rangeContainsRange, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, searchFormulaFunctions, serializeCsv, serializeTsv, toNumber, tsvImportAdapter, unregisterFormulaFunction, wildcardToRegExp };
|
|
659
|
+
export { ASTNode, CellData, CellFormat, type CellInputFormatKind, CellPosition, CellRange, type CsvParseOptions, type CsvSerializeOptions, type FillDirection, FilterRule, type FormattedNumberValue, type FormulaActiveCall, type FormulaArgument, type FormulaArgumentSpec, type FormulaArgumentType, type FormulaCaretContext, type FormulaCriteriaPredicate, FormulaErrorCode, type FormulaFunctionCategory, type FormulaFunctionContext, type FormulaFunctionDefinition, type FormulaFunctionSuggestion, type FormulaHints, FormulaRange, type FormulaSignaturePart, GroupAggregate, type ImportFileIntoSpreadsheetOptions, MAX_NUMBER_FORMAT_CODE_CHARS, NUMBER_FORMAT_PRESETS, NumberFormat, type NumberFormatColor, type NumberFormatKind, type NumberFormatPreset, type ParsedCellInput, SPREADSHEET_IMPORT_ADAPTERS, SPREADSHEET_TABLE_ACTIONS, SortDirection, SpreadsheetController, type SpreadsheetImport, type SpreadsheetImportAdapter, type SpreadsheetMenuItem, type SpreadsheetTableActionName, type SpreadsheetTableActions, aggregateValues, applyFormulaSuggestion, bindSpreadsheetTableActions, builtinNumberFormat, builtinNumberFormatId, cellFormatForNumberFormat, checkFormulaArgumentCount, clampMenuPosition, clearNumberFormatCache, compareCellValues, computeFillTarget, csvImportAdapter, dateValueToSerial, escapeCsvField, fillSeries, formatCellDisplay, formatCellForDisplay, formatGeneralFit, formatNumberFormatValue, formatTextFunction, formatValueWithCode, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getSpreadsheetMenuItems, importFileIntoSpreadsheet, isBlankValue, isGeneralNumberFormat, isSingleCellRange, listFormulaFunctions, matchesFilterRule, normalizeRange, numberFormatColorToCss, numberFormatForCellFormat, parseCellInput, parseCriteria, parseCsv, parseNumberText, parseTsv, rangeContains, rangeContainsRange, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, runSpreadsheetMenuItem, searchFormulaFunctions, serialFromYmd, serializeCsv, serializeTsv, toNumber, tsvImportAdapter, unregisterFormulaFunction, wildcardToRegExp };
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DEFAULT_ROW_HEIGHT,
|
|
4
4
|
DataSourceBinder,
|
|
5
5
|
DependencyGraph,
|
|
6
|
+
NUMBER_FORMAT_PRESETS,
|
|
6
7
|
SPREADSHEET_CLIPBOARD_MIME,
|
|
7
8
|
SPREADSHEET_IMPORT_ADAPTERS,
|
|
8
9
|
SPREADSHEET_TABLE_ACTIONS,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
applyFormulaSuggestion,
|
|
12
13
|
bindSpreadsheetTableActions,
|
|
13
14
|
buildSpreadsheetView,
|
|
15
|
+
cellFormatForNumberFormat,
|
|
14
16
|
clampMenuPosition,
|
|
15
17
|
columnDependencyKey,
|
|
16
18
|
compareCellValues,
|
|
@@ -18,9 +20,11 @@ import {
|
|
|
18
20
|
computeRowGroups,
|
|
19
21
|
createSpreadsheetClipboardData,
|
|
20
22
|
csvImportAdapter,
|
|
21
|
-
escapeCsvField,
|
|
22
23
|
extractCellDependencies,
|
|
23
24
|
fillSeries,
|
|
25
|
+
formatCellDisplay,
|
|
26
|
+
formatCellForDisplay,
|
|
27
|
+
formatValueWithCode,
|
|
24
28
|
getFillDirection,
|
|
25
29
|
getFormulaCaretContext,
|
|
26
30
|
getFormulaHints,
|
|
@@ -29,14 +33,14 @@ import {
|
|
|
29
33
|
getTableSections,
|
|
30
34
|
importFileIntoSpreadsheet,
|
|
31
35
|
isBlankValue,
|
|
36
|
+
isGeneralNumberFormat,
|
|
32
37
|
isSingleCellRange,
|
|
33
38
|
mapFormulaReferences,
|
|
34
39
|
matchesFilterRule,
|
|
35
40
|
normalizeRange,
|
|
41
|
+
numberFormatForCellFormat,
|
|
36
42
|
offsetFormulaReferences,
|
|
37
|
-
parseCsv,
|
|
38
43
|
parseHtmlTable,
|
|
39
|
-
parseTsv,
|
|
40
44
|
rangeContains,
|
|
41
45
|
rangeContainsRange,
|
|
42
46
|
rangesIntersect,
|
|
@@ -46,23 +50,39 @@ import {
|
|
|
46
50
|
remapFormulaReferences,
|
|
47
51
|
roundFloat,
|
|
48
52
|
rowPassesFilters,
|
|
49
|
-
|
|
53
|
+
runSpreadsheetMenuItem,
|
|
50
54
|
serializeHtmlTable,
|
|
51
|
-
serializeTsv,
|
|
52
55
|
shiftFormulaReferences,
|
|
53
56
|
toNumber,
|
|
54
57
|
tsvImportAdapter
|
|
55
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-U5KWZU4X.js";
|
|
59
|
+
import {
|
|
60
|
+
escapeCsvField,
|
|
61
|
+
parseCsv,
|
|
62
|
+
parseTsv,
|
|
63
|
+
serializeCsv,
|
|
64
|
+
serializeTsv
|
|
65
|
+
} from "../chunk-664LQYFJ.js";
|
|
56
66
|
import {
|
|
57
67
|
FORMULA_ERRORS,
|
|
58
68
|
FormulaEvaluator,
|
|
59
69
|
FormulaParser,
|
|
60
70
|
MAX_FORMULA_ARRAY_SIZE,
|
|
71
|
+
MAX_NUMBER_FORMAT_CODE_CHARS,
|
|
72
|
+
NumberFormat,
|
|
61
73
|
WHOLE_COLUMN_END_ROW,
|
|
74
|
+
builtinNumberFormat,
|
|
75
|
+
builtinNumberFormatId,
|
|
62
76
|
checkFormulaArgumentCount,
|
|
77
|
+
clearNumberFormatCache,
|
|
63
78
|
colNameToIndex,
|
|
79
|
+
compareNumbers,
|
|
80
|
+
compareValues,
|
|
81
|
+
dateValueToSerial,
|
|
64
82
|
describeFormulaError,
|
|
65
|
-
|
|
83
|
+
formatGeneralFit,
|
|
84
|
+
formatNumberFormatValue,
|
|
85
|
+
formatTextFunction,
|
|
66
86
|
getFormulaArgumentSpecIndex,
|
|
67
87
|
getFormulaFunction,
|
|
68
88
|
getFormulaSignature,
|
|
@@ -70,16 +90,22 @@ import {
|
|
|
70
90
|
indexToColName,
|
|
71
91
|
isFormulaError,
|
|
72
92
|
listFormulaFunctions,
|
|
93
|
+
numberFormatColorToCss,
|
|
94
|
+
numberToText,
|
|
95
|
+
parseCellInput,
|
|
73
96
|
parseCellReference,
|
|
74
97
|
parseCriteria,
|
|
75
98
|
parseFormula,
|
|
99
|
+
parseNumberText,
|
|
76
100
|
parseRange,
|
|
77
101
|
registerFormulaFunction,
|
|
78
102
|
searchFormulaFunctions,
|
|
103
|
+
serialFromYmd,
|
|
104
|
+
sortCompareValues,
|
|
79
105
|
tokenizeFormula,
|
|
80
106
|
unregisterFormulaFunction,
|
|
81
107
|
wildcardToRegExp
|
|
82
|
-
} from "../chunk-
|
|
108
|
+
} from "../chunk-3CN2WD3X.js";
|
|
83
109
|
export {
|
|
84
110
|
DEFAULT_COLUMN_WIDTH,
|
|
85
111
|
DEFAULT_ROW_HEIGHT,
|
|
@@ -89,6 +115,9 @@ export {
|
|
|
89
115
|
FormulaEvaluator,
|
|
90
116
|
FormulaParser,
|
|
91
117
|
MAX_FORMULA_ARRAY_SIZE,
|
|
118
|
+
MAX_NUMBER_FORMAT_CODE_CHARS,
|
|
119
|
+
NUMBER_FORMAT_PRESETS,
|
|
120
|
+
NumberFormat,
|
|
92
121
|
SPREADSHEET_CLIPBOARD_MIME,
|
|
93
122
|
SPREADSHEET_IMPORT_ADAPTERS,
|
|
94
123
|
SPREADSHEET_TABLE_ACTIONS,
|
|
@@ -98,19 +127,31 @@ export {
|
|
|
98
127
|
applyFormulaSuggestion,
|
|
99
128
|
bindSpreadsheetTableActions,
|
|
100
129
|
buildSpreadsheetView,
|
|
130
|
+
builtinNumberFormat,
|
|
131
|
+
builtinNumberFormatId,
|
|
132
|
+
cellFormatForNumberFormat,
|
|
101
133
|
checkFormulaArgumentCount,
|
|
102
134
|
clampMenuPosition,
|
|
135
|
+
clearNumberFormatCache,
|
|
103
136
|
colNameToIndex,
|
|
104
137
|
columnDependencyKey,
|
|
105
138
|
compareCellValues,
|
|
139
|
+
compareNumbers,
|
|
140
|
+
compareValues,
|
|
106
141
|
computeFillTarget,
|
|
107
142
|
computeRowGroups,
|
|
108
143
|
createSpreadsheetClipboardData,
|
|
109
144
|
csvImportAdapter,
|
|
145
|
+
dateValueToSerial,
|
|
110
146
|
describeFormulaError,
|
|
111
147
|
escapeCsvField,
|
|
112
148
|
extractCellDependencies,
|
|
113
149
|
fillSeries,
|
|
150
|
+
formatCellDisplay,
|
|
151
|
+
formatCellForDisplay,
|
|
152
|
+
formatGeneralFit,
|
|
153
|
+
formatNumberFormatValue,
|
|
154
|
+
formatTextFunction,
|
|
114
155
|
formatValueWithCode,
|
|
115
156
|
getFillDirection,
|
|
116
157
|
getFormulaArgumentSpecIndex,
|
|
@@ -126,17 +167,23 @@ export {
|
|
|
126
167
|
indexToColName,
|
|
127
168
|
isBlankValue,
|
|
128
169
|
isFormulaError,
|
|
170
|
+
isGeneralNumberFormat,
|
|
129
171
|
isSingleCellRange,
|
|
130
172
|
listFormulaFunctions,
|
|
131
173
|
mapFormulaReferences,
|
|
132
174
|
matchesFilterRule,
|
|
133
175
|
normalizeRange,
|
|
176
|
+
numberFormatColorToCss,
|
|
177
|
+
numberFormatForCellFormat,
|
|
178
|
+
numberToText,
|
|
134
179
|
offsetFormulaReferences,
|
|
180
|
+
parseCellInput,
|
|
135
181
|
parseCellReference,
|
|
136
182
|
parseCriteria,
|
|
137
183
|
parseCsv,
|
|
138
184
|
parseFormula,
|
|
139
185
|
parseHtmlTable,
|
|
186
|
+
parseNumberText,
|
|
140
187
|
parseRange,
|
|
141
188
|
parseTsv,
|
|
142
189
|
rangeContains,
|
|
@@ -149,11 +196,14 @@ export {
|
|
|
149
196
|
remapFormulaReferences,
|
|
150
197
|
roundFloat,
|
|
151
198
|
rowPassesFilters,
|
|
199
|
+
runSpreadsheetMenuItem,
|
|
152
200
|
searchFormulaFunctions,
|
|
201
|
+
serialFromYmd,
|
|
153
202
|
serializeCsv,
|
|
154
203
|
serializeHtmlTable,
|
|
155
204
|
serializeTsv,
|
|
156
205
|
shiftFormulaReferences,
|
|
206
|
+
sortCompareValues,
|
|
157
207
|
toNumber,
|
|
158
208
|
tokenizeFormula,
|
|
159
209
|
tsvImportAdapter,
|
|
@@ -33,11 +33,24 @@ interface Token {
|
|
|
33
33
|
description?: string;
|
|
34
34
|
/** Conditional tags only. */
|
|
35
35
|
conditional?: ConditionalKind;
|
|
36
|
+
/**
|
|
37
|
+
* Opening conditional tags written as a comparison (`{?amount>100}`,
|
|
38
|
+
* closed by `{/amount}`) only. `value` is then the variable name.
|
|
39
|
+
*/
|
|
40
|
+
comparison?: ConditionComparison;
|
|
41
|
+
}
|
|
42
|
+
/** Operators accepted in a comparison condition such as `{?amount>=100}`. */
|
|
43
|
+
type ComparisonOperator = "=" | "<>" | "<" | ">" | "<=" | ">=";
|
|
44
|
+
/** The comparison part of a conditional tag: `{?status=paid}` → `{ operator: "=", operand: "paid" }`. */
|
|
45
|
+
interface ConditionComparison {
|
|
46
|
+
operator: ComparisonOperator;
|
|
47
|
+
/** Right-hand side, unquoted. */
|
|
48
|
+
operand: string;
|
|
36
49
|
}
|
|
37
50
|
/** Values supplied for `{variable}` slots and `{?variable}` conditions. */
|
|
38
51
|
type PromptValue = string | number | boolean | null | undefined;
|
|
39
52
|
type PromptValues = Record<string, PromptValue>;
|
|
40
|
-
type PromptDiagnosticCode = "unclosed-section" | "unexpected-close";
|
|
53
|
+
type PromptDiagnosticCode = "unclosed-section" | "unexpected-close" | "invalid-condition";
|
|
41
54
|
/**
|
|
42
55
|
* A recoverable grammar problem. The offending tag is treated as literal text.
|
|
43
56
|
* Offsets are relative to the text that contained the tag: the input prompt,
|
|
@@ -73,4 +86,4 @@ interface ColorGradient {
|
|
|
73
86
|
to: string;
|
|
74
87
|
}
|
|
75
88
|
|
|
76
|
-
export { type ColorGradient as C, INSTRUCTION_REGEX as I, type
|
|
89
|
+
export { type ColorGradient as C, INSTRUCTION_REGEX as I, type PromptValues as P, type Template as T, VARIABLE_REGEX as V, type PromptDiagnostic as a, type Token as b, type ComparisonOperator as c, type ConditionComparison as d, type ConditionalKind as e, type PromptDiagnosticCode as f, type PromptValue as g, TEMPLATE_REGEX as h, type TemplateVersion as i, type TokenType as j, instructionRegex as k, templateRegex as t, variableRegex as v };
|
|
@@ -33,11 +33,24 @@ interface Token {
|
|
|
33
33
|
description?: string;
|
|
34
34
|
/** Conditional tags only. */
|
|
35
35
|
conditional?: ConditionalKind;
|
|
36
|
+
/**
|
|
37
|
+
* Opening conditional tags written as a comparison (`{?amount>100}`,
|
|
38
|
+
* closed by `{/amount}`) only. `value` is then the variable name.
|
|
39
|
+
*/
|
|
40
|
+
comparison?: ConditionComparison;
|
|
41
|
+
}
|
|
42
|
+
/** Operators accepted in a comparison condition such as `{?amount>=100}`. */
|
|
43
|
+
type ComparisonOperator = "=" | "<>" | "<" | ">" | "<=" | ">=";
|
|
44
|
+
/** The comparison part of a conditional tag: `{?status=paid}` → `{ operator: "=", operand: "paid" }`. */
|
|
45
|
+
interface ConditionComparison {
|
|
46
|
+
operator: ComparisonOperator;
|
|
47
|
+
/** Right-hand side, unquoted. */
|
|
48
|
+
operand: string;
|
|
36
49
|
}
|
|
37
50
|
/** Values supplied for `{variable}` slots and `{?variable}` conditions. */
|
|
38
51
|
type PromptValue = string | number | boolean | null | undefined;
|
|
39
52
|
type PromptValues = Record<string, PromptValue>;
|
|
40
|
-
type PromptDiagnosticCode = "unclosed-section" | "unexpected-close";
|
|
53
|
+
type PromptDiagnosticCode = "unclosed-section" | "unexpected-close" | "invalid-condition";
|
|
41
54
|
/**
|
|
42
55
|
* A recoverable grammar problem. The offending tag is treated as literal text.
|
|
43
56
|
* Offsets are relative to the text that contained the tag: the input prompt,
|
|
@@ -73,4 +86,4 @@ interface ColorGradient {
|
|
|
73
86
|
to: string;
|
|
74
87
|
}
|
|
75
88
|
|
|
76
|
-
export { type ColorGradient as C, INSTRUCTION_REGEX as I, type
|
|
89
|
+
export { type ColorGradient as C, INSTRUCTION_REGEX as I, type PromptValues as P, type Template as T, VARIABLE_REGEX as V, type PromptDiagnostic as a, type Token as b, type ComparisonOperator as c, type ConditionComparison as d, type ConditionalKind as e, type PromptDiagnosticCode as f, type PromptValue as g, TEMPLATE_REGEX as h, type TemplateVersion as i, type TokenType as j, instructionRegex as k, templateRegex as t, variableRegex as v };
|