@pixerate/editor 0.23.0 → 0.25.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.
Files changed (187) hide show
  1. package/README.md +167 -2
  2. package/THIRD_PARTY_NOTICES.md +80 -0
  3. package/dist/agent/index.cjs +10 -8
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +4 -3
  6. package/dist/agent/index.d.ts +4 -3
  7. package/dist/agent/index.js +4 -2
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/canvas/index.cjs +4437 -411
  10. package/dist/canvas/index.cjs.map +1 -1
  11. package/dist/canvas/index.d.cts +934 -4
  12. package/dist/canvas/index.d.ts +934 -4
  13. package/dist/canvas/index.js +4309 -283
  14. package/dist/canvas/index.js.map +1 -1
  15. package/dist/chunk-4BVP64JJ.cjs +1406 -0
  16. package/dist/chunk-4BVP64JJ.cjs.map +1 -0
  17. package/dist/chunk-664LQYFJ.js +115 -0
  18. package/dist/chunk-664LQYFJ.js.map +1 -0
  19. package/dist/chunk-7WISYZFO.cjs +740 -0
  20. package/dist/chunk-7WISYZFO.cjs.map +1 -0
  21. package/dist/chunk-AL6JMGWW.cjs +783 -0
  22. package/dist/chunk-AL6JMGWW.cjs.map +1 -0
  23. package/dist/chunk-BVP3TSLH.cjs +69 -0
  24. package/dist/chunk-BVP3TSLH.cjs.map +1 -0
  25. package/dist/{chunk-RIKBJLS2.cjs → chunk-C7P22VIP.cjs} +2001 -279
  26. package/dist/chunk-C7P22VIP.cjs.map +1 -0
  27. package/dist/chunk-D6FH2YAX.cjs +131 -0
  28. package/dist/chunk-D6FH2YAX.cjs.map +1 -0
  29. package/dist/chunk-ECCCYKGL.js +740 -0
  30. package/dist/chunk-ECCCYKGL.js.map +1 -0
  31. package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
  32. package/dist/chunk-FD4LPFAE.cjs.map +1 -0
  33. package/dist/{chunk-QBJ22YZR.js → chunk-FH6F67DN.js} +1999 -277
  34. package/dist/chunk-FH6F67DN.js.map +1 -0
  35. package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
  36. package/dist/chunk-FPENXAEJ.js.map +1 -0
  37. package/dist/chunk-HLIMTC6N.js +1 -0
  38. package/dist/chunk-HLIMTC6N.js.map +1 -0
  39. package/dist/chunk-HRMEDT2L.js +1406 -0
  40. package/dist/chunk-HRMEDT2L.js.map +1 -0
  41. package/dist/{chunk-QGHGJ56O.js → chunk-IXHSYOVY.js} +2518 -122
  42. package/dist/chunk-IXHSYOVY.js.map +1 -0
  43. package/dist/chunk-MKA3AHLV.cjs +256 -0
  44. package/dist/chunk-MKA3AHLV.cjs.map +1 -0
  45. package/dist/chunk-NAXVVS5I.js +783 -0
  46. package/dist/chunk-NAXVVS5I.js.map +1 -0
  47. package/dist/chunk-O5RYH2PG.js +69 -0
  48. package/dist/chunk-O5RYH2PG.js.map +1 -0
  49. package/dist/chunk-OXSV64JX.js +689 -0
  50. package/dist/chunk-OXSV64JX.js.map +1 -0
  51. package/dist/chunk-P3RQ5UJE.cjs +689 -0
  52. package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
  53. package/dist/chunk-P6ODPZ4W.js +256 -0
  54. package/dist/chunk-P6ODPZ4W.js.map +1 -0
  55. package/dist/chunk-PL4JB3BF.cjs +1 -0
  56. package/dist/chunk-PL4JB3BF.cjs.map +1 -0
  57. package/dist/{chunk-GVSMRPHB.cjs → chunk-PO6A6QQH.cjs} +2607 -211
  58. package/dist/chunk-PO6A6QQH.cjs.map +1 -0
  59. package/dist/{chunk-JJDLPEWL.js → chunk-QGYDWPRM.js} +2 -2
  60. package/dist/chunk-RR7F5GUM.js +5726 -0
  61. package/dist/chunk-RR7F5GUM.js.map +1 -0
  62. package/dist/chunk-TNNJXF46.cjs +115 -0
  63. package/dist/chunk-TNNJXF46.cjs.map +1 -0
  64. package/dist/chunk-U5HZSFCS.js +131 -0
  65. package/dist/chunk-U5HZSFCS.js.map +1 -0
  66. package/dist/{chunk-MJZBNWG7.js → chunk-UAKDG62Z.js} +309 -581
  67. package/dist/chunk-UAKDG62Z.js.map +1 -0
  68. package/dist/{chunk-CL37JGFW.cjs → chunk-V3CHHWOE.cjs} +4 -4
  69. package/dist/{chunk-CL37JGFW.cjs.map → chunk-V3CHHWOE.cjs.map} +1 -1
  70. package/dist/chunk-WSQKHXW7.cjs +5726 -0
  71. package/dist/chunk-WSQKHXW7.cjs.map +1 -0
  72. package/dist/{chunk-AA4ZEVCC.cjs → chunk-X4N4WUKB.cjs} +336 -608
  73. package/dist/chunk-X4N4WUKB.cjs.map +1 -0
  74. package/dist/commands/index.cjs +74 -1
  75. package/dist/commands/index.cjs.map +1 -1
  76. package/dist/commands/index.d.cts +38 -353
  77. package/dist/commands/index.d.ts +38 -353
  78. package/dist/commands/index.js +73 -0
  79. package/dist/commands/index.js.map +1 -1
  80. package/dist/comment-store-BEMgVlAA.d.cts +135 -0
  81. package/dist/comment-store-BEMgVlAA.d.ts +135 -0
  82. package/dist/compare/index.cjs +15 -0
  83. package/dist/compare/index.cjs.map +1 -0
  84. package/dist/compare/index.d.cts +58 -0
  85. package/dist/compare/index.d.ts +58 -0
  86. package/dist/compare/index.js +15 -0
  87. package/dist/compare/index.js.map +1 -0
  88. package/dist/controller-BIJiNoVs.d.cts +1842 -0
  89. package/dist/controller-BIJiNoVs.d.ts +1842 -0
  90. package/dist/documents-CHT1U5Vs.d.ts +86 -0
  91. package/dist/documents-Gp7wb0Me.d.cts +86 -0
  92. package/dist/extensions/index.cjs +100 -5
  93. package/dist/extensions/index.cjs.map +1 -1
  94. package/dist/extensions/index.d.cts +16 -4
  95. package/dist/extensions/index.d.ts +16 -4
  96. package/dist/extensions/index.js +100 -5
  97. package/dist/generation/index.cjs +2317 -0
  98. package/dist/generation/index.cjs.map +1 -0
  99. package/dist/generation/index.d.cts +1015 -0
  100. package/dist/generation/index.d.ts +1015 -0
  101. package/dist/generation/index.js +2317 -0
  102. package/dist/generation/index.js.map +1 -0
  103. package/dist/grammar/index.cjs +48 -3
  104. package/dist/grammar/index.cjs.map +1 -1
  105. package/dist/grammar/index.d.cts +322 -100
  106. package/dist/grammar/index.d.ts +322 -100
  107. package/dist/grammar/index.js +54 -9
  108. package/dist/image-editor/index.cjs +4392 -481
  109. package/dist/image-editor/index.cjs.map +1 -1
  110. package/dist/image-editor/index.d.cts +1249 -97
  111. package/dist/image-editor/index.d.ts +1249 -97
  112. package/dist/image-editor/index.js +4281 -370
  113. package/dist/image-editor/index.js.map +1 -1
  114. package/dist/index-7a6bHTLy.d.ts +1754 -0
  115. package/dist/index-Csd5qI8u.d.cts +1754 -0
  116. package/dist/index.cjs +1682 -99
  117. package/dist/index.cjs.map +1 -1
  118. package/dist/index.d.cts +118 -21
  119. package/dist/index.d.ts +118 -21
  120. package/dist/index.js +1630 -47
  121. package/dist/index.js.map +1 -1
  122. package/dist/mention-text-CDnCFd3c.d.cts +53 -0
  123. package/dist/mention-text-CDnCFd3c.d.ts +53 -0
  124. package/dist/migrate-iTlm3a8h.d.cts +112 -0
  125. package/dist/migrate-iTlm3a8h.d.ts +112 -0
  126. package/dist/model-C1zApQM8.d.cts +219 -0
  127. package/dist/model-C1zApQM8.d.ts +219 -0
  128. package/dist/persistence/index.cjs +676 -0
  129. package/dist/persistence/index.cjs.map +1 -0
  130. package/dist/persistence/index.d.cts +230 -0
  131. package/dist/persistence/index.d.ts +230 -0
  132. package/dist/persistence/index.js +676 -0
  133. package/dist/persistence/index.js.map +1 -0
  134. package/dist/{registry-D5-R90p0.d.cts → registry-BDe-vlv3.d.ts} +2 -40
  135. package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.cts} +12 -1
  136. package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.ts} +12 -1
  137. package/dist/registry-D32LpIc4.d.cts +354 -0
  138. package/dist/{registry-D5-R90p0.d.ts → registry-DnzpgY27.d.cts} +2 -40
  139. package/dist/registry-evKTP4ls.d.ts +354 -0
  140. package/dist/schema-DYDGdYL9.d.cts +41 -0
  141. package/dist/schema-DYDGdYL9.d.ts +41 -0
  142. package/dist/serializers/index.cjs +12 -3
  143. package/dist/serializers/index.cjs.map +1 -1
  144. package/dist/serializers/index.d.cts +40 -12
  145. package/dist/serializers/index.d.ts +40 -12
  146. package/dist/serializers/index.js +12 -3
  147. package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
  148. package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
  149. package/dist/spreadsheet/index.cjs +161 -3
  150. package/dist/spreadsheet/index.cjs.map +1 -1
  151. package/dist/spreadsheet/index.d.cts +611 -20
  152. package/dist/spreadsheet/index.d.ts +611 -20
  153. package/dist/spreadsheet/index.js +168 -10
  154. package/dist/storage-BpFfspHm.d.cts +120 -0
  155. package/dist/storage-BpFfspHm.d.ts +120 -0
  156. package/dist/tokens/index.cjs +115 -0
  157. package/dist/tokens/index.cjs.map +1 -0
  158. package/dist/tokens/index.d.cts +212 -0
  159. package/dist/tokens/index.d.ts +212 -0
  160. package/dist/tokens/index.js +115 -0
  161. package/dist/tokens/index.js.map +1 -0
  162. package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
  163. package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
  164. package/dist/{track-changes-BSF58RK0.d.cts → track-changes-D_VAPELi.d.cts} +110 -144
  165. package/dist/{track-changes-BSF58RK0.d.ts → track-changes-Db_fGEvx.d.ts} +110 -144
  166. package/package.json +21 -1
  167. package/dist/chunk-4SUNJZWB.cjs.map +0 -1
  168. package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
  169. package/dist/chunk-AXV2ZW34.cjs +0 -118
  170. package/dist/chunk-AXV2ZW34.cjs.map +0 -1
  171. package/dist/chunk-B2ZRLN4S.js +0 -118
  172. package/dist/chunk-B2ZRLN4S.js.map +0 -1
  173. package/dist/chunk-GVSMRPHB.cjs.map +0 -1
  174. package/dist/chunk-K3R5NG2D.js +0 -3100
  175. package/dist/chunk-K3R5NG2D.js.map +0 -1
  176. package/dist/chunk-MJZBNWG7.js.map +0 -1
  177. package/dist/chunk-OYXSKQFR.js.map +0 -1
  178. package/dist/chunk-QBJ22YZR.js.map +0 -1
  179. package/dist/chunk-QGHGJ56O.js.map +0 -1
  180. package/dist/chunk-RIKBJLS2.cjs.map +0 -1
  181. package/dist/chunk-XDMXXC4Z.cjs +0 -3100
  182. package/dist/chunk-XDMXXC4Z.cjs.map +0 -1
  183. package/dist/controller-pePCJLT1.d.cts +0 -959
  184. package/dist/controller-pePCJLT1.d.ts +0 -959
  185. package/dist/index-CCr_z9kF.d.cts +0 -899
  186. package/dist/index-Ck6ajwXh.d.ts +0 -899
  187. /package/dist/{chunk-JJDLPEWL.js.map → chunk-QGYDWPRM.js.map} +0 -0
@@ -1,6 +1,64 @@
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-pePCJLT1.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-pePCJLT1.js';
3
- import { I as ImportAdapterRegistry, c as ImportAdapter, h as ImportInput, a as ImportOutcome } from '../registry-GJI4gToU.js';
1
+ import { A as ASTNode, O as FormulaErrorCode, U as FormulaRange, a as CellData, c as CellFormat, p as ConditionalFormatSheet, n as ConditionalFormatOverlay, o as ConditionalFormatRule, j as ConditionalCellFormat, t as ConditionalFormatValue, l as ConditionalFormatIconSet, F as DataValidationRule, q as ConditionalFormatStyle, r as ConditionalFormatTimePeriod, e as CellRange, y as DataValidationErrorStyle, z as DataValidationOperator, H as DataValidationType, a6 as NewConditionalFormatRule, G as DataValidationSheet, d as CellPosition, E as DataValidationResult, _ as GroupAggregate, af as SortDirection, M as FilterRule, S as SpreadsheetController, as as SpreadsheetDefinedName, aK as StructuralChange } from '../controller-BIJiNoVs.js';
2
+ export { B as BinaryOpNode, C as CellCoordinate, b as CellDep, f as CellRefNode, g as CellValueReader, h as ColumnBinding, i as ColumnType, k as ConditionalFormatCondition, m as ConditionalFormatOperator, s as ConditionalFormatType, u as CsvExportOptions, v as CsvImportOptions, D as DEFAULT_COLUMN_WIDTH, w as DEFAULT_ROW_HEIGHT, x as DataSourceBinder, I as DependencyGraph, J as EvaluationContext, K as FORMULA_ERRORS, L as FilterOperator, N as FormulaDiagnostic, P as FormulaEvaluationResult, Q as FormulaEvaluator, R as FormulaNameDefinition, T as FormulaParser, V as FormulaReferenceFilter, W as FormulaReferenceInfo, X as FormulaToken, Y as FormulaTokenType, Z as FunctionCallNode, $ as GroupSummary, a0 as InvokeNode, a1 as LiteralNode, a2 as MAX_FORMULA_ARRAY_SIZE, a3 as MissingNode, a4 as NameDep, a5 as NameNode, a7 as NewDataValidationRule, a8 as NewFilterRule, a9 as ParsedSpreadsheetClipboard, aa as PropertyRefNode, ab as RangeNode, ac as RowType, ad as SPREADSHEET_CLIPBOARD_MIME, ae as SheetQualifier, ag as SortKey, ah as SpillRefNode, ai as SpreadsheetCellSpan, aj as SpreadsheetClipboardCell, ak as SpreadsheetClipboardData, al as SpreadsheetClipboardPayload, am as SpreadsheetClipboardSource, an as SpreadsheetColumn, ao as SpreadsheetCommitResult, ap as SpreadsheetControllerOptions, aq as SpreadsheetDataSource, ar as SpreadsheetDataSourceField, at as SpreadsheetDocument, au as SpreadsheetFilterState, av as SpreadsheetGrouping, aw as SpreadsheetNameInfo, ax as SpreadsheetNameScope, ay as SpreadsheetRow, az as SpreadsheetRowGroup, aA as SpreadsheetRowSection, aB as SpreadsheetSheetInfo, aC as SpreadsheetSpill, aD as SpreadsheetTableSettings, aE as SpreadsheetValidationAction, aF as SpreadsheetValidationPrompt, aG as SpreadsheetViewColumn, aH as SpreadsheetViewModel, aI as SpreadsheetViewRow, aJ as SpreadsheetWorkbook, aL as UnaryOpNode, aM as WHOLE_COLUMN_END_ROW, aN as buildSpreadsheetView, aO as colNameToIndex, aP as columnDependencyKey, aQ as compareNumbers, aR as compareValues, aS as computeRowGroups, aT as createSpreadsheetClipboardData, aU as deleteSheetInFormula, aV as describeFormulaError, aW as extractCellDependencies, aX as extractNameDependencies, aY as formatSheetPrefix, aZ as formulaIdentifiers, a_ as getRowSection, a$ as getTableSections, b0 as indexToColName, b1 as isFormulaError, b2 as mapFormulaReferences, b3 as numberToText, b4 as offsetFormulaReferences, b5 as parseCellReference, b6 as parseFormula, b7 as parseHtmlTable, b8 as parseRange, b9 as quoteSheetName, ba as readSpreadsheetClipboard, bb as rebaseClipboardRows, bc as remapFormulaReferences, bd as renameNameInFormula, be as renameSheetInFormula, bf as rowPassesFilters, bg as serializeHtmlTable, bh as sheetNameNeedsQuotes, bi as shiftFormulaReferences, bj as sortCompareValues, bk as tokenizeFormula } from '../controller-BIJiNoVs.js';
3
+ import { I as ImportAdapterRegistry, b as ImportAdapter, h as ImportInput, a as ImportOutcome } from '../registry-CEgwXED1.js';
4
+
5
+ /**
6
+ * LAMBDA values and the lexical environments of LET and LAMBDA variables.
7
+ */
8
+
9
+ /**
10
+ * Variables of one LET or LAMBDA call. Environments form a chain: a lambda
11
+ * keeps the environment it was created in (a closure), so its body sees the
12
+ * LET variables around its definition, not those of its caller.
13
+ */
14
+ interface FormulaEnvironment {
15
+ /** Upper-case variable name → value. */
16
+ readonly vars: Map<string, any>;
17
+ /** LAMBDA parameters whose argument was left out (for ISOMITTED). */
18
+ readonly omitted?: Set<string>;
19
+ readonly parent: FormulaEnvironment | null;
20
+ }
21
+ /**
22
+ * A function value created by `LAMBDA(params…, body)`, or a built-in function
23
+ * passed by name (`BYROW(A1:C3, SUM)`). Lambdas can be stored in LET
24
+ * variables and defined names and passed to MAP, REDUCE, SCAN, BYROW, BYCOL
25
+ * and MAKEARRAY; a cell whose result is an uncalled lambda shows `#CALC!`.
26
+ */
27
+ declare class FormulaLambda {
28
+ /** Upper-case parameter names. */
29
+ readonly params: readonly string[];
30
+ /** The calculation; null for a native (built-in) function. */
31
+ readonly body: ASTNode | null;
32
+ /** The environment the lambda was created in. */
33
+ readonly env: FormulaEnvironment | null;
34
+ /** The sheet unqualified references in the body refer to (a sheet-scoped name's sheet). */
35
+ readonly sheet?: string | undefined;
36
+ /** Implementation of a built-in function passed by name. */
37
+ readonly native?: ((args: any[]) => any) | undefined;
38
+ /** Display name, e.g. `SUM` or `LAMBDA`. */
39
+ readonly label: string;
40
+ constructor(
41
+ /** Upper-case parameter names. */
42
+ params: readonly string[],
43
+ /** The calculation; null for a native (built-in) function. */
44
+ body: ASTNode | null,
45
+ /** The environment the lambda was created in. */
46
+ env: FormulaEnvironment | null,
47
+ /** The sheet unqualified references in the body refer to (a sheet-scoped name's sheet). */
48
+ sheet?: string | undefined,
49
+ /** Implementation of a built-in function passed by name. */
50
+ native?: ((args: any[]) => any) | undefined,
51
+ /** Display name, e.g. `SUM` or `LAMBDA`. */
52
+ label?: string);
53
+ toString(): string;
54
+ }
55
+ declare const isFormulaLambda: (value: unknown) => value is FormulaLambda;
56
+ /**
57
+ * Deepest nesting of LAMBDA calls (recursion through named lambdas). Deeper
58
+ * calls return `#NUM!`, as in Excel. The JavaScript stack may run out first
59
+ * on small stacks; that is reported as `#NUM!` too.
60
+ */
61
+ declare const MAX_LAMBDA_DEPTH = 1000;
4
62
 
5
63
  type FormulaFunctionCategory = 'math' | 'statistical' | 'logical' | 'text' | 'lookup' | 'date' | 'information';
6
64
  /** What an argument expects. Used for documentation, hints and messages. */
@@ -158,6 +216,20 @@ interface FormulaFunctionSuggestion {
158
216
  signature: string;
159
217
  description: string;
160
218
  category: FormulaFunctionDefinition['category'];
219
+ /**
220
+ * `name` for a defined name (accepting it inserts the name as defined,
221
+ * followed by `(` only for a LAMBDA name); unset for functions.
222
+ */
223
+ kind?: 'name';
224
+ /** For a defined name: it holds a LAMBDA, so it is called like a function. */
225
+ isLambda?: boolean;
226
+ }
227
+ /** A defined name offered by autocomplete (see `SpreadsheetController.getNameSuggestions`). */
228
+ interface FormulaNameSuggestionSource {
229
+ name: string;
230
+ description?: string;
231
+ /** A LAMBDA name is called like a function. */
232
+ isLambda?: boolean;
161
233
  }
162
234
  interface FormulaActiveCall {
163
235
  name: string;
@@ -180,12 +252,17 @@ interface FormulaHints {
180
252
  /** Everything formula autocomplete UIs need for `input` with the caret at `caret`. */
181
253
  declare function getFormulaHints(input: string, caret?: number, options?: {
182
254
  limit?: number;
255
+ names?: readonly FormulaNameSuggestionSource[];
183
256
  }): FormulaHints;
184
257
  /**
185
258
  * Replaces the name prefix at the caret with `NAME(`, returning the new input
186
- * and caret position (just inside the parenthesis).
259
+ * and caret position (just inside the parenthesis). Given a defined-name
260
+ * suggestion (`kind: 'name'`), the name keeps its case and gets a `(` only
261
+ * when it holds a LAMBDA; `call: false` inserts any name without `(`.
187
262
  */
188
- declare function applyFormulaSuggestion(input: string, caret: number, name: string): {
263
+ declare function applyFormulaSuggestion(input: string, caret: number, suggestion: string | Pick<FormulaFunctionSuggestion, 'name' | 'kind' | 'isLambda'>, options?: {
264
+ call?: boolean;
265
+ }): {
189
266
  value: string;
190
267
  caret: number;
191
268
  };
@@ -211,21 +288,147 @@ declare function wildcardToRegExp(pattern: string): RegExp;
211
288
  */
212
289
  declare function parseCriteria(criterion: unknown): FormulaCriteriaPredicate;
213
290
 
291
+ /** Number format code parsing: sections, bracket tags and tokens. */
292
+ /** Colour from a `[Red]` or `[ColorN]` section tag (`color1`…`color56` = palette index). */
293
+ type NumberFormatColor = 'black' | 'blue' | 'cyan' | 'green' | 'magenta' | 'red' | 'white' | 'yellow' | `color${number}`;
294
+
295
+ /**
296
+ * The General format squeezed into `maxChars` characters, as Excel shows it
297
+ * in a narrow column: fewer decimals, then scientific notation; `null` when
298
+ * even that does not fit (the caller paints `####`).
299
+ */
300
+ declare function formatGeneralFit(n: number, maxChars: number): string | null;
301
+
302
+ /** Built-in number formats (ECMA-376 §18.8.30, en-US). */
303
+ /**
304
+ * Built-in format code for an id (0–49, en-US), e.g. 14 → `m/d/yyyy`.
305
+ * Locale-specific ids (23–36) and unknown ids return undefined.
306
+ */
307
+ declare function builtinNumberFormat(id: number): string | undefined;
308
+ /** Id of a built-in format code. Matching ignores case and backslash escapes. */
309
+ declare function builtinNumberFormatId(code: string): number | undefined;
310
+
311
+ /**
312
+ * Longest number format code, in characters, that is parsed (Excel's own
313
+ * limit). A longer code displays its value as General and makes `TEXT`
314
+ * return `#VALUE!`. The cap also bounds work that scales with the code.
315
+ */
316
+ declare const MAX_NUMBER_FORMAT_CODE_CHARS = 255;
317
+ /** Best guess at the ribbon's number-format category. */
318
+ type NumberFormatKind = 'general' | 'number' | 'currency' | 'accounting' | 'date' | 'time' | 'percentage' | 'fraction' | 'scientific' | 'text'
319
+ /** Zip codes, phone numbers, social security numbers. */
320
+ | 'special' | 'custom';
321
+ /** A value formatted with a number format, ready to paint. */
322
+ interface FormattedNumberValue {
323
+ text: string;
324
+ /** Colour from a `[Red]` / `[ColorN]` tag of the section used. */
325
+ color?: NumberFormatColor;
326
+ /**
327
+ * Repeat-fill character from `*x` and its position (UTF-16 index) in
328
+ * `text`; a renderer may repeat it to fill the cell width.
329
+ */
330
+ fill?: {
331
+ char: string;
332
+ index: number;
333
+ };
334
+ /** True for numbers (right-aligned by default); text, booleans and errors are false. */
335
+ numeric: boolean;
336
+ }
337
+ /** A parsed number format code. Parsing never fails: malformed parts become literal text. */
338
+ declare class NumberFormat {
339
+ readonly code: string;
340
+ private readonly general;
341
+ private readonly sections;
342
+ /** Sections that apply to numbers (a trailing text section is excluded). */
343
+ private readonly numSections;
344
+ /** Index of the section that applies to text, if any. */
345
+ private readonly textSection;
346
+ private constructor();
347
+ /**
348
+ * Parses a format code. Never throws: unknown or malformed parts degrade to
349
+ * literal text, and a code longer than 255 characters degrades to General.
350
+ */
351
+ static parse(code: string): NumberFormat;
352
+ /** `parse` without the 255-character cap (for tests that reach renderer edge cases). */
353
+ static parseUncapped(code: string): NumberFormat;
354
+ /** Like `parse`, but remembers recently parsed codes (bounded), so formatting many values parses a code once. */
355
+ static parseCached(code: string): NumberFormat;
356
+ static general(): NumberFormat;
357
+ isGeneral(): boolean;
358
+ private numberSections;
359
+ /** True when the code contains date or time tokens. */
360
+ isDate(): boolean;
361
+ isPercent(): boolean;
362
+ /** True for a pure text format such as `@`. */
363
+ isText(): boolean;
364
+ /** Best guess at the format category. */
365
+ kind(): NumberFormatKind;
366
+ /**
367
+ * Picks the number section for `v`, and whether the minus sign is dropped
368
+ * (a negative section shows the absolute value). Null means General.
369
+ */
370
+ private select;
371
+ /**
372
+ * Formats a number. `overflow` is true when the value can't be shown (a
373
+ * date out of range, painted as `########`).
374
+ */
375
+ formatNumber(n: number): FormattedNumberValue & {
376
+ overflow: boolean;
377
+ };
378
+ /** Formats text through the text section (`@`), or returns it unchanged. */
379
+ formatText(text: string): FormattedNumberValue;
380
+ /**
381
+ * Formats a cell value: numbers through the number sections, ISO date text
382
+ * (`2026-03-04`, `2026-03-04 18:00:00`) and `Date`s as serial numbers, other
383
+ * text through the text section; booleans show TRUE/FALSE and error values
384
+ * themselves.
385
+ */
386
+ format(value: unknown): FormattedNumberValue;
387
+ }
388
+ /** Empties the parse cache used by `NumberFormat.parseCached` (mainly for tests). */
389
+ declare function clearNumberFormatCache(): void;
390
+ /**
391
+ * 1900-system serial number of a date value: ISO date text (with an optional
392
+ * time) or a `Date` (its local date and time). Null for anything else.
393
+ */
394
+ declare function dateValueToSerial(value: unknown): number | null;
395
+ /** Formats a cell value with a format code (see `NumberFormat.format`). */
396
+ declare function formatNumberFormatValue(value: unknown, code: string): FormattedNumberValue;
397
+ /**
398
+ * The `TEXT()` worksheet function: formats a value with a format code.
399
+ * Blanks count as 0; numeric and date text (`"5"`, `"3/4/2026"`,
400
+ * `"2026-03-04"`) is converted to a number first; other text and booleans
401
+ * (as TRUE/FALSE) go through the text section, or are returned as is.
402
+ * Errors: the value's own error, `#VALUE!` for a code over 255 characters or
403
+ * a date out of range, `#NUM!` for a non-finite number.
404
+ */
405
+ declare function formatTextFunction(value: unknown, code: string): {
406
+ text: string;
407
+ } | {
408
+ error: string;
409
+ };
410
+ /** CSS colour for a format colour (`red` → `#FF0000`, `color10` → `#008000`). */
411
+ declare function numberFormatColorToCss(color: NumberFormatColor): string;
412
+
413
+ type DisplayCell = Pick<CellData, 'value' | 'error' | 'numberFormat' | 'format'>;
214
414
  /**
215
- * The text a cell shows: its error, or its value formatted with the number
216
- * format chosen for typed input (`numberFormat`, e.g. `"$"#,##0.00` for
217
- * `$1,200.50`, `0%` for `10%`, `m/d/yyyy` for `3/4/2026`). Other numbers use
218
- * up to 15 significant digits and booleans show as TRUE/FALSE.
415
+ * How a cell is shown: its error, or its value formatted with its number
416
+ * format code (`numberFormat`: set explicitly, inherited from the column, or
417
+ * chosen for typed input, e.g. `"$"#,##0.00` for `$1,200.50`). Numbers in a
418
+ * cell with a `currency` / `percentage` / `date` `CellFormat` but no code use
419
+ * that kind's code. Without a code (General), numbers use up to 15
420
+ * significant digits and booleans show as TRUE/FALSE.
421
+ *
422
+ * `numeric` is true for numbers (and dates shown through a date format):
423
+ * grids right-align those. `color` comes from a `[Red]` / `[ColorN]` tag.
219
424
  */
220
- declare function formatCellDisplay(cell: Pick<CellData, 'value' | 'error' | 'numberFormat'> | null | undefined): string;
425
+ declare function formatCellForDisplay(cell: DisplayCell | null | undefined): FormattedNumberValue;
426
+ /** The text a cell shows (see `formatCellForDisplay`). Used by grids, CSV export and the clipboard. */
427
+ declare function formatCellDisplay(cell: DisplayCell | null | undefined): string;
221
428
  /**
222
- * A subset of spreadsheet number format codes, as used by TEXT():
223
- * - numbers: `0`, `#`, `0.00`, `#,##0`, `#,##0.00`, `0%`, `0.0%`, `0.00E+00`,
224
- * literal prefixes/suffixes (`$#,##0.00`, `0.0 "kg"`), and
225
- * `positive;negative;zero` sections;
226
- * - dates and times: `yyyy yy mmmm mmm mm m dddd ddd dd d hh h mm ss AM/PM`
227
- * (`m`/`mm` after an hour or before seconds means minutes).
228
- * Text values are returned unchanged; unsupported codes are best effort.
429
+ * Formats a value with a number format code, as `TEXT()` does (see
430
+ * `formatTextFunction`). Null when the value can't be shown with that code
431
+ * (a date out of range, a code over 255 characters, an error value).
229
432
  */
230
433
  declare function formatValueWithCode(value: unknown, format: string): string | null;
231
434
 
@@ -276,6 +479,242 @@ declare function parseCellInput(input: string): ParsedCellInput;
276
479
  */
277
480
  declare function parseNumberText(text: string): number | null;
278
481
 
482
+ /**
483
+ * The number a value counts as for scales, bars, icons, top/bottom and
484
+ * averages: numbers, and dates (ISO text) as their serial number. Text,
485
+ * booleans, blanks and errors are not numbers.
486
+ */
487
+ declare function conditionalFormatNumber(value: unknown): number | null;
488
+ /** Blends two colours: `t` 0 is `a`, 1 is `b`. */
489
+ declare function blendConditionalFormatColors(a: string, b: string, t: number): string;
490
+ /** Excel's default icon thresholds: percent 0, 33, 67 for three icons. */
491
+ declare function defaultIconThresholds(set: string): ConditionalFormatValue[];
492
+ /** An overlay with no formatted cells. */
493
+ declare const EMPTY_CONDITIONAL_FORMAT_OVERLAY: ConditionalFormatOverlay;
494
+ /**
495
+ * Evaluates conditional formats and keeps what it needs to re-evaluate only
496
+ * the affected cells after an edit (`update`). Rules are applied in order
497
+ * (the first has the highest priority): every matching rule adds the parts
498
+ * of its style that higher-priority rules left unset, and a matching rule
499
+ * with `stopIfTrue` hides lower-priority rules. Colour scales, data bars and
500
+ * icon sets apply to numbers only and never stop other rules.
501
+ */
502
+ declare class ConditionalFormatEngine {
503
+ private sheet;
504
+ private cells;
505
+ private stats;
506
+ private rulesKey;
507
+ private current;
508
+ constructor(sheet: ConditionalFormatSheet);
509
+ /** Replaces the sheet accessor (e.g. after rows or columns were added). */
510
+ setSheet(sheet: ConditionalFormatSheet): void;
511
+ /** The last evaluated overlay. */
512
+ get overlay(): ConditionalFormatOverlay;
513
+ /** Evaluates every rule over every cell it applies to. */
514
+ evaluate(rules: ConditionalFormatRule[]): ConditionalFormatOverlay;
515
+ /**
516
+ * Re-evaluates after the values of `changed` cells changed (the edited
517
+ * cells and the formulas that depend on them). Rules that look at the whole
518
+ * range (scales, bars, icons, top/bottom, average, duplicates) are
519
+ * re-evaluated over their range when a changed cell is inside it; formula
520
+ * rules always are, since their formulas may read any cell; other rules
521
+ * only at the changed cells. Falls back to `evaluate` when the rules
522
+ * changed.
523
+ */
524
+ update(rules: ConditionalFormatRule[], changed: Iterable<{
525
+ row: number;
526
+ col: number;
527
+ }>): ConditionalFormatOverlay;
528
+ private statsFor;
529
+ private evalFormula;
530
+ private threshold;
531
+ /** The operand of a `cellIs` rule: a formula result, or typed input. */
532
+ private operand;
533
+ /** Combines every rule that applies to (row, col). */
534
+ computeLook(rules: ConditionalFormatRule[], row: number, col: number): ConditionalCellFormat | undefined;
535
+ /**
536
+ * Checks one rule: returns its style when it matches, 'look' when it set a
537
+ * scale fill, bar or icon on `out`, or null.
538
+ */
539
+ private matchRule;
540
+ }
541
+ /** Whether serial day `d` falls in `period` relative to `today`. */
542
+ declare function matchesTimePeriod(period: string, d: number, today: Date): boolean;
543
+ /** Evaluates `rules` over a sheet: the conditional look of every formatted cell. */
544
+ declare function evaluateConditionalFormats(sheet: ConditionalFormatSheet, rules: ConditionalFormatRule[]): ConditionalFormatOverlay;
545
+
546
+ /**
547
+ * Glyphs for conditional-format icon sets, so React and Svelte draw the same
548
+ * icons without image assets. Index 0 is the lowest icon.
549
+ */
550
+
551
+ interface ConditionalFormatIconGlyph {
552
+ /** Text glyph to draw. */
553
+ glyph: string;
554
+ /** CSS colour of the glyph. */
555
+ color: string;
556
+ /** Accessible name, e.g. "Up arrow". */
557
+ label: string;
558
+ }
559
+ /** Names of the built-in icon sets. */
560
+ declare const CONDITIONAL_FORMAT_ICON_SETS: ConditionalFormatIconSet[];
561
+ /** Number of icons in a set (`3Arrows` → 3), always 3 to 5. */
562
+ declare function conditionalFormatIconCount(set: string): number;
563
+ /** The glyph of icon `index` of `set` (unknown sets use traffic lights). */
564
+ declare function getConditionalFormatIcon(set: string, index: number): ConditionalFormatIconGlyph;
565
+
566
+ /**
567
+ * One-line descriptions of rules for the conditional formatting and data
568
+ * validation managers, shared by React and Svelte.
569
+ */
570
+
571
+ /** E.g. `Cell value > 100`, `Color scale (min → P50 → max)`, `Formula: =$B2>10`. */
572
+ declare function describeConditionalFormat(rule: ConditionalFormatRule): string;
573
+ /** E.g. `Whole number between 1 and 10`, `List: Low,Medium,High`, `Custom: =A1>0`. */
574
+ declare function describeDataValidation(rule: DataValidationRule): string;
575
+
576
+ /**
577
+ * Ready-made rules for the conditional formatting and data validation
578
+ * managers and the context menu, so React and Svelte offer the same choices.
579
+ */
580
+
581
+ /** Excel's highlight styles. */
582
+ declare const CONDITIONAL_FORMAT_STYLE_PRESETS: Array<{
583
+ id: string;
584
+ label: string;
585
+ style: ConditionalFormatStyle;
586
+ }>;
587
+ declare const DEFAULT_CONDITIONAL_FORMAT_STYLE: ConditionalFormatStyle;
588
+ type ConditionalFormatPresetKind = 'greaterThan' | 'lessThan' | 'between' | 'equal' | 'textContains' | 'dateOccurring' | 'duplicate' | 'unique' | 'top10' | 'bottom10' | 'aboveAverage' | 'belowAverage' | 'blanks' | 'errors' | 'formula' | 'colorScale2' | 'colorScale3' | 'dataBar' | 'iconSet';
589
+ /** Inputs a preset needs, besides the ranges. */
590
+ type ConditionalFormatPresetField = 'value' | 'value2' | 'text' | 'formula' | 'rank' | 'period' | 'iconSet' | 'color';
591
+ interface ConditionalFormatPresetInfo {
592
+ kind: ConditionalFormatPresetKind;
593
+ label: string;
594
+ fields: ConditionalFormatPresetField[];
595
+ /** Whether the rule takes a highlight style (scales, bars and icons don't). */
596
+ usesStyle: boolean;
597
+ }
598
+ declare const CONDITIONAL_FORMAT_PRESETS: ConditionalFormatPresetInfo[];
599
+ declare const CONDITIONAL_FORMAT_TIME_PERIODS: Array<{
600
+ period: ConditionalFormatTimePeriod;
601
+ label: string;
602
+ }>;
603
+ interface ConditionalFormatPresetInput {
604
+ kind: ConditionalFormatPresetKind;
605
+ ranges: CellRange[];
606
+ value?: string;
607
+ value2?: string;
608
+ text?: string;
609
+ formula?: string;
610
+ rank?: number;
611
+ period?: ConditionalFormatTimePeriod;
612
+ iconSet?: ConditionalFormatIconSet;
613
+ /** Data bar colour. */
614
+ color?: string;
615
+ /** Highlight style (default light red fill, dark red text). */
616
+ style?: ConditionalFormatStyle;
617
+ stopIfTrue?: boolean;
618
+ }
619
+ /** Builds a rule from a preset and its inputs. */
620
+ declare function createConditionalFormatRule(input: ConditionalFormatPresetInput): NewConditionalFormatRule;
621
+ declare const DATA_VALIDATION_TYPE_OPTIONS: Array<{
622
+ type: DataValidationType;
623
+ label: string;
624
+ }>;
625
+ declare const DATA_VALIDATION_OPERATOR_OPTIONS: Array<{
626
+ operator: DataValidationOperator;
627
+ label: string;
628
+ }>;
629
+ declare const DATA_VALIDATION_ERROR_STYLE_OPTIONS: Array<{
630
+ style: DataValidationErrorStyle;
631
+ label: string;
632
+ }>;
633
+
634
+ /**
635
+ * CSS for the conditional look of a cell, shared by the React and Svelte
636
+ * grids (React uses the objects, Svelte the `style` strings).
637
+ */
638
+
639
+ interface ConditionalFormatCss {
640
+ background?: string;
641
+ color?: string;
642
+ fontWeight?: string;
643
+ fontStyle?: string;
644
+ textDecoration?: string;
645
+ }
646
+ /**
647
+ * Black or white, whichever reads better on `fill` (`#rgb` / `#rrggbb`), or
648
+ * undefined for other colour syntaxes.
649
+ */
650
+ declare function conditionalFormatContrastColor(fill: string): string | undefined;
651
+ /**
652
+ * Fill, font colour and emphasis of a cell (no data bar or icon). A fill
653
+ * without a font colour of its own gets black or white text, so the value
654
+ * stays readable whatever the theme's text colour (Excel's fills assume
655
+ * dark text).
656
+ */
657
+ declare function getConditionalFormatCss(format: ConditionalCellFormat | undefined): ConditionalFormatCss;
658
+ /** The bar element of a data bar: absolutely placed from the cell's left edge. */
659
+ declare function getDataBarCss(bar: NonNullable<ConditionalCellFormat['dataBar']>): Record<string, string>;
660
+ /** `{ fontWeight: '700' }` → `font-weight: 700;` for `style` attributes. */
661
+ declare function conditionalFormatStyleString(css: Record<string, string | undefined> | ConditionalFormatCss): string;
662
+
663
+ /** Excel's message when a rule has no error message of its own. */
664
+ declare const DEFAULT_DATA_VALIDATION_MESSAGE = "This value doesn't match the data validation restrictions defined for this cell.";
665
+ declare const DEFAULT_DATA_VALIDATION_TITLE = "Invalid value";
666
+ /** The rule that applies to (row, col): the first one containing it. */
667
+ declare function findDataValidation(rules: DataValidationRule[] | undefined, row: number, col: number): DataValidationRule | undefined;
668
+ /**
669
+ * The items of a list rule: literal (`Low, Medium, High`, optionally in
670
+ * quotes) or read from a range or formula (`=$H$1:$H$5`), blanks skipped.
671
+ * Formulas are evaluated at the range's top-left cell.
672
+ */
673
+ declare function getValidationListValues(sheet: DataValidationSheet, rule: DataValidationRule): string[];
674
+ /**
675
+ * Checks `input` typed into (row, col) against the cell's rule. Typed input
676
+ * is parsed like a cell commit (`10%` is 0.1, `3/4/2026` a date); a formula
677
+ * is checked through its result. Custom and bound formulas are relative to
678
+ * the range's top-left cell and see the value being entered. Blank input is
679
+ * valid unless `ignoreBlank` is false; rules with `showErrorAlert: false`
680
+ * accept anything.
681
+ */
682
+ declare function validateCellInput(sheet: DataValidationSheet, rules: DataValidationRule[] | undefined, row: number, col: number, input: string): DataValidationResult;
683
+ /**
684
+ * Cells whose current value breaks their rule ("circle invalid data").
685
+ * Blank cells are skipped, as are `any` rules. Alerts being off does not
686
+ * matter here. Each cell is listed once, rule by rule, in row-major order.
687
+ */
688
+ declare function findInvalidCells(sheet: DataValidationSheet, rules: DataValidationRule[] | undefined): CellPosition[];
689
+
690
+ /**
691
+ * Common number formats offered by the "Format cells" menu, and the mapping
692
+ * between format codes and the coarser `CellFormat` kinds.
693
+ */
694
+
695
+ interface NumberFormatPreset {
696
+ id: 'general' | 'number' | 'currency' | 'percent' | 'date' | 'time';
697
+ label: string;
698
+ code: string;
699
+ }
700
+ /** Presets of the "Format cells" menu (en-US). */
701
+ declare const NUMBER_FORMAT_PRESETS: readonly NumberFormatPreset[];
702
+ /**
703
+ * Format code for a `CellFormat` kind, used to display numbers in cells that
704
+ * have a kind but no format code: `currency` → `"$"#,##0.00`, `percentage` →
705
+ * `0%`, `date` → `m/d/yyyy`. Other kinds (`number`, `text` — the default of
706
+ * new columns —, `badge`, `status`, `assignee`) display as General (undefined).
707
+ */
708
+ declare function numberFormatForCellFormat(format: CellFormat | undefined): string | undefined;
709
+ /**
710
+ * `CellFormat` kind matching a format code (`"$"#,##0.00` → `currency`,
711
+ * `0%` → `percentage`, `m/d/yyyy` → `date`, `0.00` → `number`, `@` → `text`);
712
+ * undefined for General, times and custom codes.
713
+ */
714
+ declare function cellFormatForNumberFormat(code: string): CellFormat | undefined;
715
+ /** True for an empty or `General` code. */
716
+ declare const isGeneralNumberFormat: (code: string | undefined) => boolean;
717
+
279
718
  /**
280
719
  * RFC 4180 CSV (and other delimiter-separated values) parsing and
281
720
  * serialization.
@@ -401,8 +840,35 @@ interface SpreadsheetMenuItem {
401
840
  disabled?: boolean;
402
841
  /** Draw a divider before this item. */
403
842
  separatorBefore?: boolean;
404
- run: () => void;
843
+ /** The item is the current choice of its group (e.g. the cell's number format). */
844
+ checked?: boolean;
845
+ /**
846
+ * Ask for text before running (e.g. a custom number format code): the
847
+ * editor prompts with `label` and `defaultValue`, then calls `run(text)`;
848
+ * cancelling skips `run`.
849
+ */
850
+ input?: {
851
+ label: string;
852
+ defaultValue?: string;
853
+ };
854
+ /** Ask the user to confirm before running (e.g. deleting a sheet); the message to show. */
855
+ confirm?: string;
856
+ /**
857
+ * Opens one of the editor's panels instead of running an action: the
858
+ * editors open it (`run` does nothing).
859
+ */
860
+ panel?: SpreadsheetPanelId;
861
+ run: (input?: string) => void;
405
862
  }
863
+ /** Panels the spreadsheet editors can open from the context menu. */
864
+ type SpreadsheetPanelId = 'conditionalFormatting' | 'dataValidation';
865
+ /**
866
+ * Runs a menu item the way the editors do: an item with `confirm` first asks
867
+ * for confirmation with `confirm` (default `window.confirm`), an item with
868
+ * `input` asks for text with `ask` (default `window.prompt`); either is
869
+ * skipped when cancelled. Returns whether `run` was called.
870
+ */
871
+ declare function runSpreadsheetMenuItem(item: SpreadsheetMenuItem, ask?: (label: string, defaultValue: string) => string | null | undefined, confirm?: (message: string) => boolean): boolean;
406
872
  /**
407
873
  * Where to place a `position: fixed` menu opened at `point` so it stays inside
408
874
  * the viewport: it flips to the left of / above the pointer when it would
@@ -437,7 +903,7 @@ declare function getSpreadsheetMenuItems(controller: SpreadsheetController, cell
437
903
  * state syncing: the controller reports changes through `onDocumentChange`
438
904
  * and `onSelectionChange`.
439
905
  */
440
- 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"];
906
+ 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", "getConditionalFormats", "addConditionalFormat", "updateConditionalFormat", "deleteConditionalFormat", "moveConditionalFormat", "clearConditionalFormats", "getConditionalFormatOverlay", "getConditionalFormat", "getDataValidations", "getDataValidationAt", "addDataValidation", "updateDataValidation", "deleteDataValidation", "clearDataValidation", "validateCellInput", "getValidationListValues", "findInvalidCells", "setInvalidDataCircles", "getInvalidDataCircles", "isInvalidDataCircled"];
441
907
  type SpreadsheetTableActionName = (typeof SPREADSHEET_TABLE_ACTIONS)[number];
442
908
  type SpreadsheetTableActions = Pick<SpreadsheetController, SpreadsheetTableActionName>;
443
909
  /** The table operations of `controller`, bound so they can be passed around. */
@@ -478,6 +944,8 @@ interface ImportFileIntoSpreadsheetOptions {
478
944
  /** Top-left cell to write to (0-based). Default A1. */
479
945
  startRow?: number;
480
946
  startCol?: number;
947
+ /** Sheet (id or name) to import into; default the active sheet. */
948
+ sheet?: string;
481
949
  }
482
950
  /**
483
951
  * Imports a CSV/TSV file (or any registered `spreadsheet` adapter that
@@ -485,4 +953,127 @@ interface ImportFileIntoSpreadsheetOptions {
485
953
  */
486
954
  declare function importFileIntoSpreadsheet(controller: SpreadsheetController, input: ImportInput, options: ImportFileIntoSpreadsheetOptions): Promise<ImportOutcome<SpreadsheetImport>>;
487
955
 
488
- export { ASTNode, CellData, CellFormat, type CellInputFormatKind, 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, type ParsedCellInput, 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, formatCellDisplay, formatValueWithCode, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getSpreadsheetMenuItems, importFileIntoSpreadsheet, isBlankValue, isSingleCellRange, listFormulaFunctions, matchesFilterRule, normalizeRange, parseCellInput, parseCriteria, parseCsv, parseNumberText, parseTsv, rangeContains, rangeContainsRange, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, searchFormulaFunctions, serialFromYmd, serializeCsv, serializeTsv, toNumber, tsvImportAdapter, unregisterFormulaFunction, wildcardToRegExp };
956
+ /**
957
+ * Workbook rules shared by the controller and the framework bindings: sheet
958
+ * and defined-name validation, and default sheet names.
959
+ */
960
+
961
+ /** Longest sheet name Excel accepts. */
962
+ declare const MAX_SHEET_NAME_LENGTH = 31;
963
+ /** Longest defined name Excel accepts. */
964
+ declare const MAX_DEFINED_NAME_LENGTH = 255;
965
+ /**
966
+ * Checks a sheet name like Excel: 1–31 characters, none of `: \ / ? * [ ]`,
967
+ * not starting or ending with `'`, not the reserved `History`, and not used
968
+ * by another sheet (case-insensitively). Returns why it is invalid, or null.
969
+ */
970
+ declare function validateSheetName(name: string, existingNames?: readonly string[]): string | null;
971
+ /** The first `Sheet N` not used by `existingNames`. */
972
+ declare function nextSheetName(existingNames: readonly string[], base?: string): string;
973
+ /**
974
+ * A name for a copy of the sheet `name`: `Name (2)`, `Name (3)`, …, shortened
975
+ * so the suffix fits in 31 characters.
976
+ */
977
+ declare function copySheetName(name: string, existingNames: readonly string[]): string;
978
+ /**
979
+ * Checks a defined name like Excel: starts with a letter, `_` or `\`;
980
+ * continues with letters, digits, `_`, `.`, `\` or `?`; at most 255
981
+ * characters; and must not look like a cell reference (`A1`, `TAX2024`), an
982
+ * R1C1 reference (`R1C1`, `R`, `C3`) or a boolean. Returns why it is invalid,
983
+ * or null.
984
+ */
985
+ declare function validateDefinedName(name: string): string | null;
986
+ /** Whether a defined name holds a LAMBDA (and so is called like a function). */
987
+ declare function isLambdaDefinition(definition: Pick<SpreadsheetDefinedName, 'refersTo'>): boolean;
988
+
989
+ /**
990
+ * Sheet-tab and Name Manager behaviour shared by the React and Svelte
991
+ * bindings: the tab context menu, drag-to-reorder targets and the rows a
992
+ * Name Manager panel lists.
993
+ */
994
+
995
+ /**
996
+ * Context-menu items for a sheet tab: insert, rename (asks for the name),
997
+ * duplicate, move left/right and delete (asks to confirm; disabled for the
998
+ * last sheet). Run them with `runSpreadsheetMenuItem`. A rename to an
999
+ * invalid name throws; pass `onError` to report it instead.
1000
+ */
1001
+ declare function getSheetTabMenuItems(controller: SpreadsheetController, sheetId: string, options?: {
1002
+ onError?: (message: string) => void;
1003
+ }): SpreadsheetMenuItem[];
1004
+ /**
1005
+ * The tab index a dragged tab should move to when dropped on the tab at
1006
+ * `targetIndex`: dropping on the left half of a tab places it before that
1007
+ * tab, on the right half after it.
1008
+ */
1009
+ declare function sheetDropIndex(fromIndex: number, targetIndex: number, dropAfter: boolean): number;
1010
+ /** A row of a Name Manager panel. */
1011
+ interface SpreadsheetNameRow {
1012
+ name: string;
1013
+ refersTo: string;
1014
+ /** `Workbook` or the sheet's name. */
1015
+ scopeLabel: string;
1016
+ /** Sheet id for a sheet-scoped name. */
1017
+ sheetId?: string;
1018
+ /** The name's current value, as displayed (`#REF!`, `[LAMBDA]`, `{3×1 array}`). */
1019
+ value: string;
1020
+ comment?: string;
1021
+ isLambda: boolean;
1022
+ }
1023
+ /** Every defined name with its scope and current value, sorted by name then scope. */
1024
+ declare function getNameManagerRows(controller: SpreadsheetController): SpreadsheetNameRow[];
1025
+
1026
+ /**
1027
+ * Range helpers shared by conditional formatting and data validation: rules
1028
+ * apply to a list of rectangular ranges ("applies to") that follow row and
1029
+ * column insertions/deletions, and can be cut out of a selection.
1030
+ *
1031
+ * Portions ported from gridcraft/crates/engine/src/cmd/sheet.rs and
1032
+ * gridcraft/crates/engine/src/cmd/data.rs (MIT OR Apache-2.0, © ArtCraft Team
1033
+ * and contributors). See THIRD_PARTY_NOTICES.md.
1034
+ */
1035
+
1036
+ /**
1037
+ * Adjusts one range for an inserted or deleted row/column, the way merges
1038
+ * and formula ranges move: ranges after the change shift, ranges across it
1039
+ * grow or shrink, and a range whose rows (or columns) are all deleted is
1040
+ * gone (null).
1041
+ */
1042
+ declare function adjustRangeForStructuralChange(range: CellRange, change: StructuralChange): CellRange | null;
1043
+ /** `adjustRangeForStructuralChange` over a list, dropping ranges that are gone. */
1044
+ declare function adjustRangesForStructuralChange(ranges: CellRange[], change: StructuralChange): CellRange[];
1045
+ /** The parts of `range` outside `cut` (up to four rectangles). */
1046
+ declare function subtractRange(range: CellRange, cut: CellRange): CellRange[];
1047
+ /** Removes the cells of `cut` from every range of the list. */
1048
+ declare function subtractRangeFromRanges(ranges: CellRange[], cut: CellRange): CellRange[];
1049
+ /** Whether any range of the list contains (row, col). */
1050
+ declare function rangesContain(ranges: CellRange[], row: number, col: number): boolean;
1051
+ /** The top-left cell of the first range: rule formulas are written for it. */
1052
+ declare function ruleAnchor(ranges: CellRange[]): {
1053
+ row: number;
1054
+ col: number;
1055
+ };
1056
+ /**
1057
+ * A rule formula written for `anchor`, as seen from (row, col): relative
1058
+ * references shift by the distance, `$` parts stay (Excel's conditional
1059
+ * formatting and validation formulas work this way). Returned with a
1060
+ * leading `=`.
1061
+ */
1062
+ declare function ruleFormulaAt(formula: string, anchor: {
1063
+ row: number;
1064
+ col: number;
1065
+ }, row: number, col: number): string;
1066
+ /**
1067
+ * Rewrites a rule formula after a row/column insertion or deletion so it
1068
+ * keeps pointing at the same cells. Keeps the caller's leading `=` (or its
1069
+ * absence).
1070
+ */
1071
+ declare function shiftRuleFormula(formula: string, change: StructuralChange): string;
1072
+ /** Every cell of a list of ranges, clamped to the sheet, each once, in row-major order per range. */
1073
+ declare function forEachRangeCell(ranges: CellRange[], rowCount: number, colCount: number, fn: (row: number, col: number) => void): void;
1074
+ /** A1 text of a list of ranges: `A1:B5, D2`. */
1075
+ declare function formatRuleRanges(ranges: CellRange[]): string;
1076
+ /** Parses `A1:B5, D2` (commas, semicolons or spaces between ranges; `$` ignored). Null when any part is not a cell or range. */
1077
+ declare function parseRuleRanges(text: string): CellRange[] | null;
1078
+
1079
+ export { ASTNode, CONDITIONAL_FORMAT_ICON_SETS, CONDITIONAL_FORMAT_PRESETS, CONDITIONAL_FORMAT_STYLE_PRESETS, CONDITIONAL_FORMAT_TIME_PERIODS, CellData, CellFormat, type CellInputFormatKind, CellPosition, CellRange, ConditionalCellFormat, type ConditionalFormatCss, ConditionalFormatEngine, type ConditionalFormatIconGlyph, ConditionalFormatIconSet, ConditionalFormatOverlay, type ConditionalFormatPresetField, type ConditionalFormatPresetInfo, type ConditionalFormatPresetInput, type ConditionalFormatPresetKind, ConditionalFormatRule, ConditionalFormatSheet, ConditionalFormatStyle, ConditionalFormatTimePeriod, ConditionalFormatValue, type CsvParseOptions, type CsvSerializeOptions, DATA_VALIDATION_ERROR_STYLE_OPTIONS, DATA_VALIDATION_OPERATOR_OPTIONS, DATA_VALIDATION_TYPE_OPTIONS, DEFAULT_CONDITIONAL_FORMAT_STYLE, DEFAULT_DATA_VALIDATION_MESSAGE, DEFAULT_DATA_VALIDATION_TITLE, DataValidationErrorStyle, DataValidationOperator, DataValidationResult, DataValidationRule, DataValidationSheet, DataValidationType, EMPTY_CONDITIONAL_FORMAT_OVERLAY, type FillDirection, FilterRule, type FormattedNumberValue, type FormulaActiveCall, type FormulaArgument, type FormulaArgumentSpec, type FormulaArgumentType, type FormulaCaretContext, type FormulaCriteriaPredicate, type FormulaEnvironment, FormulaErrorCode, type FormulaFunctionCategory, type FormulaFunctionContext, type FormulaFunctionDefinition, type FormulaFunctionSuggestion, type FormulaHints, FormulaLambda, type FormulaNameSuggestionSource, FormulaRange, type FormulaSignaturePart, GroupAggregate, type ImportFileIntoSpreadsheetOptions, MAX_DEFINED_NAME_LENGTH, MAX_LAMBDA_DEPTH, MAX_NUMBER_FORMAT_CODE_CHARS, MAX_SHEET_NAME_LENGTH, NUMBER_FORMAT_PRESETS, NewConditionalFormatRule, NumberFormat, type NumberFormatColor, type NumberFormatKind, type NumberFormatPreset, type ParsedCellInput, SPREADSHEET_IMPORT_ADAPTERS, SPREADSHEET_TABLE_ACTIONS, SortDirection, SpreadsheetController, SpreadsheetDefinedName, type SpreadsheetImport, type SpreadsheetImportAdapter, type SpreadsheetMenuItem, type SpreadsheetNameRow, type SpreadsheetPanelId, type SpreadsheetTableActionName, type SpreadsheetTableActions, StructuralChange, adjustRangeForStructuralChange, adjustRangesForStructuralChange, aggregateValues, applyFormulaSuggestion, bindSpreadsheetTableActions, blendConditionalFormatColors, builtinNumberFormat, builtinNumberFormatId, cellFormatForNumberFormat, checkFormulaArgumentCount, clampMenuPosition, clearNumberFormatCache, compareCellValues, computeFillTarget, conditionalFormatContrastColor, conditionalFormatIconCount, conditionalFormatNumber, conditionalFormatStyleString, copySheetName, createConditionalFormatRule, csvImportAdapter, dateValueToSerial, defaultIconThresholds, describeConditionalFormat, describeDataValidation, escapeCsvField, evaluateConditionalFormats, fillSeries, findDataValidation, findInvalidCells, forEachRangeCell, formatCellDisplay, formatCellForDisplay, formatGeneralFit, formatNumberFormatValue, formatRuleRanges, formatTextFunction, formatValueWithCode, getConditionalFormatCss, getConditionalFormatIcon, getDataBarCss, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getNameManagerRows, getSheetTabMenuItems, getSpreadsheetMenuItems, getValidationListValues, importFileIntoSpreadsheet, isBlankValue, isFormulaLambda, isGeneralNumberFormat, isLambdaDefinition, isSingleCellRange, listFormulaFunctions, matchesFilterRule, matchesTimePeriod, nextSheetName, normalizeRange, numberFormatColorToCss, numberFormatForCellFormat, parseCellInput, parseCriteria, parseCsv, parseNumberText, parseRuleRanges, parseTsv, rangeContains, rangeContainsRange, rangesContain, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, ruleAnchor, ruleFormulaAt, runSpreadsheetMenuItem, searchFormulaFunctions, serialFromYmd, serializeCsv, serializeTsv, sheetDropIndex, shiftRuleFormula, subtractRange, subtractRangeFromRanges, toNumber, tsvImportAdapter, unregisterFormulaFunction, validateCellInput, validateDefinedName, validateSheetName, wildcardToRegExp };