@pixerate/editor 0.25.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +30 -0
  2. package/THIRD_PARTY_NOTICES.md +11 -0
  3. package/dist/agent/index.cjs +174 -11
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +18 -4
  6. package/dist/agent/index.d.ts +18 -4
  7. package/dist/agent/index.js +167 -4
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/{arrangeShortcuts-B8O3f8-P.d.cts → arrange-BICutYPk.d.cts} +243 -29
  10. package/dist/{arrangeShortcuts-sLlD2rSX.d.ts → arrange-BICutYPk.d.ts} +243 -29
  11. package/dist/builtins-CdPcLwwF.d.cts +176 -0
  12. package/dist/builtins-Chj6zv_O.d.ts +176 -0
  13. package/dist/canvas/index.cjs +3917 -19
  14. package/dist/canvas/index.cjs.map +1 -1
  15. package/dist/canvas/index.d.cts +1232 -7
  16. package/dist/canvas/index.d.ts +1232 -7
  17. package/dist/canvas/index.js +3916 -18
  18. package/dist/canvas/index.js.map +1 -1
  19. package/dist/chunk-3CC7OPUQ.cjs +831 -0
  20. package/dist/chunk-3CC7OPUQ.cjs.map +1 -0
  21. package/dist/{chunk-7WISYZFO.cjs → chunk-66IMF6OD.cjs} +174 -67
  22. package/dist/chunk-66IMF6OD.cjs.map +1 -0
  23. package/dist/{chunk-AL6JMGWW.cjs → chunk-CS6NZWWA.cjs} +24 -24
  24. package/dist/{chunk-AL6JMGWW.cjs.map → chunk-CS6NZWWA.cjs.map} +1 -1
  25. package/dist/{chunk-C7P22VIP.cjs → chunk-EWCOFSCQ.cjs} +17 -6
  26. package/dist/chunk-EWCOFSCQ.cjs.map +1 -0
  27. package/dist/chunk-HDYMLS3X.cjs +409 -0
  28. package/dist/chunk-HDYMLS3X.cjs.map +1 -0
  29. package/dist/{chunk-V3CHHWOE.cjs → chunk-HNDSPZ5T.cjs} +4 -4
  30. package/dist/{chunk-V3CHHWOE.cjs.map → chunk-HNDSPZ5T.cjs.map} +1 -1
  31. package/dist/{chunk-X4N4WUKB.cjs → chunk-IFHKKVXH.cjs} +150 -38
  32. package/dist/chunk-IFHKKVXH.cjs.map +1 -0
  33. package/dist/chunk-KRGXUQ2Y.js +1696 -0
  34. package/dist/chunk-KRGXUQ2Y.js.map +1 -0
  35. package/dist/{chunk-PO6A6QQH.cjs → chunk-LN2POBHT.cjs} +742 -970
  36. package/dist/chunk-LN2POBHT.cjs.map +1 -0
  37. package/dist/chunk-MR2764X2.js +831 -0
  38. package/dist/chunk-MR2764X2.js.map +1 -0
  39. package/dist/{chunk-WSQKHXW7.cjs → chunk-NQF32I6Z.cjs} +1209 -457
  40. package/dist/chunk-NQF32I6Z.cjs.map +1 -0
  41. package/dist/{chunk-NAXVVS5I.js → chunk-QJSOZFCZ.js} +2 -2
  42. package/dist/{chunk-UAKDG62Z.js → chunk-SWE3NPOU.js} +116 -4
  43. package/dist/chunk-SWE3NPOU.js.map +1 -0
  44. package/dist/chunk-TXXNBDQX.cjs +1696 -0
  45. package/dist/chunk-TXXNBDQX.cjs.map +1 -0
  46. package/dist/chunk-UBCFIABU.js +409 -0
  47. package/dist/chunk-UBCFIABU.js.map +1 -0
  48. package/dist/{chunk-ECCCYKGL.js → chunk-UKI64KUD.js} +147 -40
  49. package/dist/chunk-UKI64KUD.js.map +1 -0
  50. package/dist/{chunk-QGYDWPRM.js → chunk-WON34HKM.js} +2 -2
  51. package/dist/{chunk-RR7F5GUM.js → chunk-X7HXL2SB.js} +941 -189
  52. package/dist/chunk-X7HXL2SB.js.map +1 -0
  53. package/dist/{chunk-IXHSYOVY.js → chunk-XQFHLT53.js} +638 -866
  54. package/dist/chunk-XQFHLT53.js.map +1 -0
  55. package/dist/{chunk-FH6F67DN.js → chunk-ZRNHGAQT.js} +17 -6
  56. package/dist/{chunk-FH6F67DN.js.map → chunk-ZRNHGAQT.js.map} +1 -1
  57. package/dist/commands/index.cjs +352 -4
  58. package/dist/commands/index.cjs.map +1 -1
  59. package/dist/commands/index.d.cts +37 -108
  60. package/dist/commands/index.d.ts +37 -108
  61. package/dist/commands/index.js +351 -3
  62. package/dist/commands/index.js.map +1 -1
  63. package/dist/compare/index.cjs +3 -3
  64. package/dist/compare/index.js +2 -2
  65. package/dist/{controller-BIJiNoVs.d.cts → controller-CxXGOEmy.d.cts} +209 -13
  66. package/dist/{controller-BIJiNoVs.d.ts → controller-CxXGOEmy.d.ts} +209 -13
  67. package/dist/export/index.cjs +36 -0
  68. package/dist/export/index.cjs.map +1 -0
  69. package/dist/export/index.d.cts +243 -0
  70. package/dist/export/index.d.ts +243 -0
  71. package/dist/export/index.js +36 -0
  72. package/dist/export/index.js.map +1 -0
  73. package/dist/extensions/index.cjs +54 -6
  74. package/dist/extensions/index.cjs.map +1 -1
  75. package/dist/extensions/index.d.cts +7 -2
  76. package/dist/extensions/index.d.ts +7 -2
  77. package/dist/extensions/index.js +59 -11
  78. package/dist/{index-7a6bHTLy.d.ts → index-B273Zllk.d.ts} +211 -207
  79. package/dist/{index-Csd5qI8u.d.cts → index-jcJwmBYt.d.cts} +211 -207
  80. package/dist/index.cjs +146 -32
  81. package/dist/index.cjs.map +1 -1
  82. package/dist/index.d.cts +50 -14
  83. package/dist/index.d.ts +50 -14
  84. package/dist/index.js +138 -24
  85. package/dist/index.js.map +1 -1
  86. package/dist/registry-CED5C0lA.d.cts +204 -0
  87. package/dist/registry-CED5C0lA.d.ts +204 -0
  88. package/dist/{registry-D32LpIc4.d.cts → registry-D0GADKc7.d.cts} +1 -1
  89. package/dist/{registry-evKTP4ls.d.ts → registry-DhVUZioj.d.ts} +1 -1
  90. package/dist/serializers/index.cjs +6 -4
  91. package/dist/serializers/index.cjs.map +1 -1
  92. package/dist/serializers/index.d.cts +15 -4
  93. package/dist/serializers/index.d.ts +15 -4
  94. package/dist/serializers/index.js +5 -3
  95. package/dist/spreadsheet/index.cjs +33 -3
  96. package/dist/spreadsheet/index.cjs.map +1 -1
  97. package/dist/spreadsheet/index.d.cts +106 -3
  98. package/dist/spreadsheet/index.d.ts +106 -3
  99. package/dist/spreadsheet/index.js +32 -2
  100. package/package.json +10 -1
  101. package/dist/chunk-7WISYZFO.cjs.map +0 -1
  102. package/dist/chunk-C7P22VIP.cjs.map +0 -1
  103. package/dist/chunk-ECCCYKGL.js.map +0 -1
  104. package/dist/chunk-IXHSYOVY.js.map +0 -1
  105. package/dist/chunk-PO6A6QQH.cjs.map +0 -1
  106. package/dist/chunk-RR7F5GUM.js.map +0 -1
  107. package/dist/chunk-UAKDG62Z.js.map +0 -1
  108. package/dist/chunk-WSQKHXW7.cjs.map +0 -1
  109. package/dist/chunk-X4N4WUKB.cjs.map +0 -1
  110. package/dist/types-DX4Mh4SL.d.cts +0 -217
  111. package/dist/types-DX4Mh4SL.d.ts +0 -217
  112. /package/dist/{chunk-NAXVVS5I.js.map → chunk-QJSOZFCZ.js.map} +0 -0
  113. /package/dist/{chunk-QGYDWPRM.js.map → chunk-WON34HKM.js.map} +0 -0
@@ -654,6 +654,11 @@ interface FormulaNameDefinition {
654
654
  /** A key identifying the name (for cycle detection), e.g. `Data!RATE`. Defaults to the name. */
655
655
  key?: string;
656
656
  }
657
+ /** Hints for `EvaluationContext.resolveRange`. */
658
+ interface RangeResolveOptions {
659
+ /** The values are only aggregated by a function that ignores blank cells. */
660
+ skipBlanks?: boolean;
661
+ }
657
662
  interface EvaluationContext {
658
663
  /**
659
664
  * Value of a cell. `sheet` is set for sheet-qualified references
@@ -665,8 +670,11 @@ interface EvaluationContext {
665
670
  * Values of a rectangular range, column by column (all rows of the first
666
671
  * column, then the next column). Lookup functions rely on this order.
667
672
  * `sheet` as in `resolveCell`; return an error code for a missing sheet.
673
+ * `options.skipBlanks` is a hint that the caller ignores blank cells
674
+ * (SUM, COUNT, AVERAGE, …): a resolver may then leave them out, so sparse
675
+ * ranges cost no array slots. Returning every value is always correct.
668
676
  */
669
- resolveRange?: (startCol: string, startRow: number, endCol: string, endRow: number, sheet?: string) => any[] | string;
677
+ resolveRange?: (startCol: string, startRow: number, endCol: string, endRow: number, sheet?: string, options?: RangeResolveOptions) => any[] | string;
670
678
  resolveProperty?: (property: string) => any;
671
679
  /**
672
680
  * The spilled array anchored at a cell, for `A1#` references: its shape and
@@ -760,6 +768,10 @@ declare class FormulaEvaluator {
760
768
  private evaluateRange;
761
769
  private callFunction;
762
770
  private finishCall;
771
+ /**
772
+ * Arguments evaluated on first use. With `skipBlanks` (the function ignores
773
+ * blank cells), range arguments may come back without their blanks.
774
+ */
763
775
  private lazyArguments;
764
776
  /**
765
777
  * Applies a scalar function element by element when it receives arrays
@@ -843,19 +855,107 @@ declare function extractNameDependencies(node: ASTNode): NameDep[];
843
855
  */
844
856
  declare const columnDependencyKey: (col: string) => string;
845
857
  declare function extractCellDependencies(node: ASTNode): CellDep[];
858
+ /**
859
+ * A reference a formula reads, without expanding ranges: a single cell or
860
+ * a rectangle (`A1:B9`; a whole column `A:A` runs to `WHOLE_COLUMN_END_ROW`).
861
+ * Columns are letters, rows are 1-based; ranges are normalised (start ≤ end).
862
+ */
863
+ type ReferenceDep = ({
864
+ kind: 'cell';
865
+ col: string;
866
+ row: number;
867
+ } & Pick<CellDep, 'sheet' | 'sheetEnd'>) | ({
868
+ kind: 'range';
869
+ startCol: string;
870
+ startRow: number;
871
+ endCol: string;
872
+ endRow: number;
873
+ } & Pick<CellDep, 'sheet' | 'sheetEnd'>);
874
+ /**
875
+ * The cells and ranges a formula reads, ranges kept whole (unlike
876
+ * `extractCellDependencies`, which lists every cell of a range). `A1#`
877
+ * depends on its anchor `A1`.
878
+ */
879
+ declare function extractReferenceDependencies(node: ASTNode): ReferenceDep[];
880
+ /**
881
+ * Dependency key of a rectangle (`A1:B9`, or `SHEET!A1:B9` with a sheet
882
+ * prefix), for `DependencyGraph.setCellDependencies`. The graph stores it as
883
+ * one range, however many cells it covers.
884
+ */
885
+ declare function rangeDependencyKey(startCol: string, startRow: number, endCol: string, endRow: number, sheetPrefix?: string): string;
886
+ interface IntervalEntry<T> {
887
+ r0: number;
888
+ r1: number;
889
+ id: string;
890
+ payload: T;
891
+ }
892
+ /**
893
+ * Row intervals `[r0, r1]` with payloads, answering "which intervals overlap
894
+ * rows `a..b`?" in O(log n + k). Entries are sorted by start, with an
895
+ * implicit segment tree of the largest end below each node, so a query only
896
+ * descends into subtrees holding a match. Removals mark entries dead;
897
+ * insertions wait in a small pending set. Both are merged in (on the next
898
+ * query) once either grows, so mutations cost O(log n) amortised.
899
+ */
900
+ declare class IntervalIndex<T> {
901
+ private items;
902
+ private dead;
903
+ private deadCount;
904
+ private maxEnd;
905
+ private leaves;
906
+ private position;
907
+ private pending;
908
+ /** Live entries. */
909
+ get size(): number;
910
+ /** Adds (or revives) the entry `id`. An id always names the same interval. */
911
+ insert(r0: number, r1: number, id: string, payload: T): void;
912
+ remove(id: string): void;
913
+ /** Merges pending insertions and drops dead entries when there are enough of them. */
914
+ private settle;
915
+ /** Calls `fn` for every live interval overlapping rows `a..b` (`r0 <= b && r1 >= a`). */
916
+ query(a: number, b: number, fn: (payload: T, entry: IntervalEntry<T>) => void): void;
917
+ private walk;
918
+ }
919
+ /** Sizes of the dependency index (see `DependencyGraph.getIndexStats`). */
920
+ interface DependencyIndexStats {
921
+ /** Cells with registered dependencies (formulas). */
922
+ formulas: number;
923
+ /** Single-cell edges (formula → cell it reads). */
924
+ cellEdges: number;
925
+ /** Range entries: one per range (per column for ranges up to 64 columns wide), however many cells it covers. */
926
+ rangeEntries: number;
927
+ /** Formulas that use a volatile function. */
928
+ volatile: number;
929
+ }
846
930
  declare class DependencyGraph {
847
- private dependencies;
848
- private dependents;
931
+ private nodes;
932
+ private cellDependents;
933
+ private rangeIndex;
934
+ private volatile;
849
935
  private spillDependencies;
850
936
  private spillDependents;
851
937
  private spillEdges;
852
- /**
853
- * Sets the cells `cellKey` depends on directly (keys such as `B2`, or a
854
- * column key from `columnDependencyKey`), replacing its previous
855
- * dependencies. Used by spreadsheets whose keys carry more than A1 text
856
- * (e.g. sheet-qualified keys); `setCellFormula` derives them from a formula.
938
+ private blockingEdges;
939
+ private parsed;
940
+ private parse;
941
+ private sheetIndex;
942
+ private removeNode;
943
+ /**
944
+ * Sets what `cellKey` depends on directly, replacing its previous
945
+ * dependencies. Keys are single cells (`B2`), rectangles (`A1:B9`) or
946
+ * whole columns (`A:`, see `columnDependencyKey`), each optionally
947
+ * sheet-qualified (`SHEET!A1:A9`). Ranges are stored whole in an interval
948
+ * index, never expanded cell by cell. `setCellFormula` derives the keys
949
+ * from a formula.
857
950
  */
858
951
  setCellDependencies(cellKey: string, dependencyKeys: Iterable<string>): void;
952
+ /**
953
+ * Marks `cellKey` as volatile (its formula uses NOW, RAND, …): it is
954
+ * recalculated by every plan made with `includeVolatile`, whatever changed.
955
+ */
956
+ setVolatile(cellKey: string, volatile: boolean): void;
957
+ /** Cells whose formulas are volatile. */
958
+ getVolatileKeys(): string[];
859
959
  setCellFormula(cellKey: string, formulaStr: string | null): void;
860
960
  /** Removes every registered formula and dependency. */
861
961
  clear(): void;
@@ -867,12 +967,34 @@ declare class DependencyGraph {
867
967
  * the anchor's edges.
868
968
  */
869
969
  setSpillEdges(anchorKey: string, spilledKeys: Iterable<string>, blockingKeys?: Iterable<string>): void;
970
+ /**
971
+ * Drops the edge from a spilled cell to the anchor whose values it holds,
972
+ * for a cell that just got input of its own: its value no longer comes
973
+ * from the anchor (which recalculates and becomes `#SPILL!`), and the
974
+ * stale edge could otherwise close a false cycle with the cell's new
975
+ * formula before the anchor is evaluated again.
976
+ */
977
+ detachSpilledCell(cellKey: string): void;
870
978
  /** The spilled cells registered for `anchorKey` by `setSpillEdges`. */
871
979
  getSpilledKeys(anchorKey: string): string[];
872
- /** Formula dependencies plus dynamic-array (spill) dependencies of a cell. */
980
+ /**
981
+ * What a cell depends on directly: single cells, ranges (as registered,
982
+ * e.g. `A1:A9` or `A:`, not expanded) and dynamic-array (spill) edges.
983
+ */
873
984
  getDependencies(cellKey: string): string[];
874
- /** Cells depending on `cellKey`, through formulas or spills. */
985
+ /**
986
+ * Whether the formula in `formulaKey` reads `cellKey` directly: as a cell,
987
+ * inside one of its ranges, or through a spill edge.
988
+ */
989
+ dependsOn(formulaKey: string, cellKey: string): boolean;
990
+ /**
991
+ * Formulas (and spilled cells) reading `cellKey` directly, through formulas
992
+ * or spills. Found in O(log n + k) through the range index.
993
+ */
875
994
  getDependents(cellKey: string): string[];
995
+ private collectDependents;
996
+ /** Sizes of the index: ranges count once (per column), not once per cell. */
997
+ getIndexStats(): DependencyIndexStats;
876
998
  /**
877
999
  * Detects if there is a cycle containing cellKey.
878
1000
  */
@@ -886,13 +1008,19 @@ declare class DependencyGraph {
886
1008
  };
887
1009
  /**
888
1010
  * Plans a recalculation over `cellKeys` (and, with `includeDependents`, every
889
- * cell that transitively depends on them). Returns the keys in evaluation
1011
+ * cell that transitively depends on them; with `includeVolatile`, every
1012
+ * volatile formula and its dependents too). Returns the keys in evaluation
890
1013
  * order (dependencies first) and the set of keys that are part of a cycle,
891
1014
  * which must be marked `#CYCLE!` instead of evaluated. Every member of a
892
1015
  * cycle is reported, not just the cell that closed it.
1016
+ *
1017
+ * Only the planned cells are ordered: a range a formula reads becomes one
1018
+ * node whose edges are the planned cells inside it (found by binary
1019
+ * search), so a range shared by many formulas is resolved once.
893
1020
  */
894
1021
  getEvaluationPlan(cellKeys: Iterable<string>, options?: {
895
1022
  includeDependents?: boolean;
1023
+ includeVolatile?: boolean;
896
1024
  }): {
897
1025
  order: string[];
898
1026
  cyclic: Set<string>;
@@ -1234,6 +1362,15 @@ interface SpreadsheetControllerOptions {
1234
1362
  */
1235
1363
  maxHistoryBytes?: number;
1236
1364
  }
1365
+ /** Work done by a recalculation (see `SpreadsheetController.getRecalculationStats`). */
1366
+ interface SpreadsheetRecalculationStats {
1367
+ /** Formulas evaluated. */
1368
+ evaluated: number;
1369
+ /** Cells in the evaluation plans: formulas, their dependents and spilled cells. */
1370
+ planned: number;
1371
+ /** Evaluation passes (another pass runs when spill ranges change). */
1372
+ passes: number;
1373
+ }
1237
1374
  /** A defined name as listed by `getNames()`. */
1238
1375
  interface SpreadsheetNameInfo extends SpreadsheetDefinedName {
1239
1376
  /** Name of the sheet a sheet-scoped name belongs to; unset for workbook scope. */
@@ -1273,6 +1410,9 @@ declare class SpreadsheetController {
1273
1410
  private evaluatingRowIndex;
1274
1411
  private evaluatingCell;
1275
1412
  private spillChanges;
1413
+ private recalcStats;
1414
+ private astCache;
1415
+ private rangeCache;
1276
1416
  /** The active sheet's document (the sheet the editor shows). */
1277
1417
  get document(): SpreadsheetDocument;
1278
1418
  set document(doc: SpreadsheetDocument);
@@ -1358,7 +1498,17 @@ declare class SpreadsheetController {
1358
1498
  private recomputeRowIndices;
1359
1499
  getColumn(colIdOrKey: string): SpreadsheetColumn | undefined;
1360
1500
  getRow(rowIdOrIndex: string | number): SpreadsheetRow | undefined;
1501
+ /** The row with this id on the current sheet (constant time, see `PositionCache`). */
1502
+ private findRow;
1503
+ /** The column with this id on the current sheet. */
1504
+ private findColumn;
1505
+ /** The column whose key is `key` (`A`, `B`, …): keys follow column positions. */
1506
+ private columnByKey;
1361
1507
  getCell(rowId: string, colId: string): CellData;
1508
+ /** `getCell` for a row and column already looked up. */
1509
+ private cellOf;
1510
+ /** A cell with no value of its own: derived (bound, column formula, blank), keeping an explicit number format. */
1511
+ private finishCell;
1362
1512
  /** Value of a cell with no stored data: bound record value, column formula, or blank. */
1363
1513
  private getDerivedCell;
1364
1514
  setCellValue(rowId: string, colId: string, raw: string): void;
@@ -1375,7 +1525,26 @@ declare class SpreadsheetController {
1375
1525
  * span) and, through defined names, the cells those names refer to.
1376
1526
  */
1377
1527
  private registerFormula;
1378
- /** Adds the qualified keys `ast` depends on, with unqualified references on `home`. */
1528
+ /**
1529
+ * Spill edges made stale by new input in `cellKey`: the edges of the array
1530
+ * it anchored (its new formula re-spills when evaluated; spill changes
1531
+ * are recalculated in a further pass) and, when it now holds input, its
1532
+ * edge to the anchor whose values it held. Left in place they can close
1533
+ * false cycles with the new formulas before the anchors are evaluated.
1534
+ */
1535
+ private dropStaleSpillEdges;
1536
+ /**
1537
+ * The parsed formula, shared by dependency registration and evaluation (so
1538
+ * a load parses each formula once). ASTs are never mutated.
1539
+ */
1540
+ private parseCached;
1541
+ /**
1542
+ * Adds the qualified keys `ast` depends on, with unqualified references on
1543
+ * `home`: cells, and ranges kept whole (`SHEETID!A1:A50000`), which the
1544
+ * graph indexes as intervals instead of one key per cell. Sets
1545
+ * `volatile.found` when a volatile function (NOW, RAND, …) is used,
1546
+ * directly or through a defined name.
1547
+ */
1379
1548
  private collectDependencies;
1380
1549
  /**
1381
1550
  * Recalculates `keys` (and, with `includeDependents`, their dependents) in
@@ -1385,12 +1554,31 @@ declare class SpreadsheetController {
1385
1554
  * another pass, until nothing changes.
1386
1555
  */
1387
1556
  private recalculateKeys;
1557
+ /**
1558
+ * Recalculates cells of the current sheet whose stored input changed (their
1559
+ * formulas already registered), with their dependents, in one plan.
1560
+ */
1561
+ private recalculateWrittenCells;
1562
+ /**
1563
+ * Work done by the last recalculation (an edit, paste, import, load or
1564
+ * full recalculation): formulas evaluated, cells planned (formulas, their
1565
+ * dependents and spilled cells) and passes (more than one when spill
1566
+ * ranges changed). Deterministic, unlike timings: use it to check that an
1567
+ * edit only recalculates what depends on it.
1568
+ */
1569
+ getRecalculationStats(): SpreadsheetRecalculationStats;
1388
1570
  /**
1389
1571
  * Rebuilds the dependency graph from scratch and recalculates every formula
1390
1572
  * in dependency order.
1391
1573
  */
1392
1574
  recalculateAll(): void;
1393
1575
  private runEvaluationPlan;
1576
+ /**
1577
+ * Drops cached ranges of `sheetId` that cover column `col` (whose cell was
1578
+ * just evaluated), or all of the sheet's when `col` is null (spilled
1579
+ * values moved or changed).
1580
+ */
1581
+ private invalidateRangeCache;
1394
1582
  private locateCellKey;
1395
1583
  private markCycle;
1396
1584
  private evalSingleCellByKey;
@@ -1415,6 +1603,11 @@ declare class SpreadsheetController {
1415
1603
  /** Whether `range` overlaps a spilled array (its anchor or spilled cells). */
1416
1604
  private intersectsSpill;
1417
1605
  private resolveCellByCoord;
1606
+ /**
1607
+ * Values of a range, column by column. With `skipBlanks` (functions that
1608
+ * ignore blank cells: SUM, COUNT, AVERAGE, …) blank cells are left out, so
1609
+ * a sparse column costs one lookup per row and no array slot.
1610
+ */
1418
1611
  private resolveRangeByCoords;
1419
1612
  private resolveCurrentRowProperty;
1420
1613
  selectCell(row: number, col: number, extendSelection?: boolean): void;
@@ -1735,6 +1928,9 @@ declare class SpreadsheetController {
1735
1928
  sheet?: string;
1736
1929
  }): FormulaEvaluationResult;
1737
1930
  private recordSnapshot;
1931
+ /** Records the stored state of one cell, for undoing a single-cell edit. */
1932
+ private recordCellSnapshot;
1933
+ private cellHistory;
1738
1934
  private recordWorkbookSnapshot;
1739
1935
  private pushUndo;
1740
1936
  /** Drops the oldest snapshots beyond `maxHistoryBytes`, always keeping the newest. */
@@ -1839,4 +2035,4 @@ declare class SpreadsheetController {
1839
2035
  isInvalidDataCircled(row: number, col: number): boolean;
1840
2036
  }
1841
2037
 
1842
- export { type GroupSummary as $, type ASTNode as A, type BinaryOpNode as B, type CellCoordinate as C, DEFAULT_COLUMN_WIDTH as D, type DataValidationResult as E, type DataValidationRule as F, type DataValidationSheet as G, type DataValidationType as H, DependencyGraph as I, type EvaluationContext as J, FORMULA_ERRORS as K, type FilterOperator as L, type FilterRule as M, type FormulaDiagnostic as N, type FormulaErrorCode as O, type FormulaEvaluationResult as P, FormulaEvaluator as Q, type FormulaNameDefinition as R, SpreadsheetController as S, FormulaParser as T, type FormulaRange as U, type FormulaReferenceFilter as V, type FormulaReferenceInfo as W, type FormulaToken as X, type FormulaTokenType as Y, type FunctionCallNode as Z, type GroupAggregate as _, type CellData as a, getTableSections as a$, type InvokeNode as a0, type LiteralNode as a1, MAX_FORMULA_ARRAY_SIZE as a2, type MissingNode as a3, type NameDep as a4, type NameNode as a5, type NewConditionalFormatRule as a6, type NewDataValidationRule as a7, type NewFilterRule as a8, type ParsedSpreadsheetClipboard as a9, type SpreadsheetRowSection as aA, type SpreadsheetSheetInfo as aB, type SpreadsheetSpill as aC, type SpreadsheetTableSettings as aD, type SpreadsheetValidationAction as aE, type SpreadsheetValidationPrompt as aF, type SpreadsheetViewColumn as aG, type SpreadsheetViewModel as aH, type SpreadsheetViewRow as aI, type SpreadsheetWorkbook as aJ, type StructuralChange as aK, type UnaryOpNode as aL, WHOLE_COLUMN_END_ROW as aM, buildSpreadsheetView as aN, colNameToIndex as aO, columnDependencyKey as aP, compareNumbers as aQ, compareValues as aR, computeRowGroups as aS, createSpreadsheetClipboardData as aT, deleteSheetInFormula as aU, describeFormulaError as aV, extractCellDependencies as aW, extractNameDependencies as aX, formatSheetPrefix as aY, formulaIdentifiers as aZ, getRowSection as a_, type PropertyRefNode as aa, type RangeNode as ab, type RowType as ac, SPREADSHEET_CLIPBOARD_MIME as ad, type SheetQualifier as ae, type SortDirection as af, type SortKey as ag, type SpillRefNode as ah, type SpreadsheetCellSpan as ai, type SpreadsheetClipboardCell as aj, type SpreadsheetClipboardData as ak, type SpreadsheetClipboardPayload as al, type SpreadsheetClipboardSource as am, type SpreadsheetColumn as an, type SpreadsheetCommitResult as ao, type SpreadsheetControllerOptions as ap, type SpreadsheetDataSource as aq, type SpreadsheetDataSourceField as ar, type SpreadsheetDefinedName as as, type SpreadsheetDocument as at, type SpreadsheetFilterState as au, type SpreadsheetGrouping as av, type SpreadsheetNameInfo as aw, type SpreadsheetNameScope as ax, type SpreadsheetRow as ay, type SpreadsheetRowGroup as az, type CellDep as b, indexToColName as b0, isFormulaError as b1, mapFormulaReferences as b2, numberToText as b3, offsetFormulaReferences as b4, parseCellReference as b5, parseFormula as b6, parseHtmlTable as b7, parseRange as b8, quoteSheetName as b9, readSpreadsheetClipboard as ba, rebaseClipboardRows as bb, remapFormulaReferences as bc, renameNameInFormula as bd, renameSheetInFormula as be, rowPassesFilters as bf, serializeHtmlTable as bg, sheetNameNeedsQuotes as bh, shiftFormulaReferences as bi, sortCompareValues as bj, tokenizeFormula as bk, type CellFormat as c, type CellPosition as d, type CellRange as e, type CellRefNode as f, type CellValueReader as g, type ColumnBinding as h, type ColumnType as i, type ConditionalCellFormat as j, type ConditionalFormatCondition as k, type ConditionalFormatIconSet as l, type ConditionalFormatOperator as m, type ConditionalFormatOverlay as n, type ConditionalFormatRule as o, type ConditionalFormatSheet as p, type ConditionalFormatStyle as q, type ConditionalFormatTimePeriod as r, type ConditionalFormatType as s, type ConditionalFormatValue as t, type CsvExportOptions as u, type CsvImportOptions as v, DEFAULT_ROW_HEIGHT as w, DataSourceBinder as x, type DataValidationErrorStyle as y, type DataValidationOperator as z };
2038
+ export { type GroupAggregate as $, type ASTNode as A, type BinaryOpNode as B, type CellCoordinate as C, DEFAULT_COLUMN_WIDTH as D, type DataValidationResult as E, type DataValidationRule as F, type DataValidationSheet as G, type DataValidationType as H, DependencyGraph as I, type DependencyIndexStats as J, type EvaluationContext as K, FORMULA_ERRORS as L, type FilterOperator as M, type FilterRule as N, type FormulaDiagnostic as O, type FormulaErrorCode as P, type FormulaEvaluationResult as Q, FormulaEvaluator as R, SpreadsheetController as S, type FormulaNameDefinition as T, FormulaParser as U, type FormulaRange as V, type FormulaReferenceFilter as W, type FormulaReferenceInfo as X, type FormulaToken as Y, type FormulaTokenType as Z, type FunctionCallNode as _, type CellData as a, extractCellDependencies as a$, type GroupSummary as a0, IntervalIndex as a1, type InvokeNode as a2, type LiteralNode as a3, MAX_FORMULA_ARRAY_SIZE as a4, type MissingNode as a5, type NameDep as a6, type NameNode as a7, type NewConditionalFormatRule as a8, type NewDataValidationRule as a9, type SpreadsheetNameInfo as aA, type SpreadsheetNameScope as aB, type SpreadsheetRecalculationStats as aC, type SpreadsheetRow as aD, type SpreadsheetRowGroup as aE, type SpreadsheetRowSection as aF, type SpreadsheetSheetInfo as aG, type SpreadsheetSpill as aH, type SpreadsheetTableSettings as aI, type SpreadsheetValidationAction as aJ, type SpreadsheetValidationPrompt as aK, type SpreadsheetViewColumn as aL, type SpreadsheetViewModel as aM, type SpreadsheetViewRow as aN, type SpreadsheetWorkbook as aO, type StructuralChange as aP, type UnaryOpNode as aQ, WHOLE_COLUMN_END_ROW as aR, buildSpreadsheetView as aS, colNameToIndex as aT, columnDependencyKey as aU, compareNumbers as aV, compareValues as aW, computeRowGroups as aX, createSpreadsheetClipboardData as aY, deleteSheetInFormula as aZ, describeFormulaError as a_, type NewFilterRule as aa, type ParsedSpreadsheetClipboard as ab, type PropertyRefNode as ac, type RangeNode as ad, type RangeResolveOptions as ae, type ReferenceDep as af, type RowType as ag, SPREADSHEET_CLIPBOARD_MIME as ah, type SheetQualifier as ai, type SortDirection as aj, type SortKey as ak, type SpillRefNode as al, type SpreadsheetCellSpan as am, type SpreadsheetClipboardCell as an, type SpreadsheetClipboardData as ao, type SpreadsheetClipboardPayload as ap, type SpreadsheetClipboardSource as aq, type SpreadsheetColumn as ar, type SpreadsheetCommitResult as as, type SpreadsheetControllerOptions as at, type SpreadsheetDataSource as au, type SpreadsheetDataSourceField as av, type SpreadsheetDefinedName as aw, type SpreadsheetDocument as ax, type SpreadsheetFilterState as ay, type SpreadsheetGrouping as az, type CellDep as b, extractNameDependencies as b0, extractReferenceDependencies as b1, formatSheetPrefix as b2, formulaIdentifiers as b3, getRowSection as b4, getTableSections as b5, indexToColName as b6, isFormulaError as b7, mapFormulaReferences as b8, numberToText as b9, offsetFormulaReferences as ba, parseCellReference as bb, parseFormula as bc, parseHtmlTable as bd, parseRange as be, quoteSheetName as bf, rangeDependencyKey as bg, readSpreadsheetClipboard as bh, rebaseClipboardRows as bi, remapFormulaReferences as bj, renameNameInFormula as bk, renameSheetInFormula as bl, rowPassesFilters as bm, serializeHtmlTable as bn, sheetNameNeedsQuotes as bo, shiftFormulaReferences as bp, sortCompareValues as bq, tokenizeFormula as br, type CellFormat as c, type CellPosition as d, type CellRange as e, type CellRefNode as f, type CellValueReader as g, type ColumnBinding as h, type ColumnType as i, type ConditionalCellFormat as j, type ConditionalFormatCondition as k, type ConditionalFormatIconSet as l, type ConditionalFormatOperator as m, type ConditionalFormatOverlay as n, type ConditionalFormatRule as o, type ConditionalFormatSheet as p, type ConditionalFormatStyle as q, type ConditionalFormatTimePeriod as r, type ConditionalFormatType as s, type ConditionalFormatValue as t, type CsvExportOptions as u, type CsvImportOptions as v, DEFAULT_ROW_HEIGHT as w, DataSourceBinder as x, type DataValidationErrorStyle as y, type DataValidationOperator as z };