@open-artifact/sheets-core 0.10.0 → 0.12.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.
@@ -10,8 +10,8 @@
10
10
  * `count` is at least 1.
11
11
  */
12
12
  import type { CellAt, CellBlock, ColumnId, IdRun, RangeCorners, RowId, SheetId } from './ids.ts';
13
- import type { Border, CellFormat, CellTable, Color, Effect, Embed, InputOfAWidget, ListLine, Mark, OffsetOfAPlacement, SheetSettings } from './ops.ts';
14
- import type { ColumnReading } from './utility.ts';
13
+ import type { Border, CellFormat, CellTable, Color, Effect, Embed, InputOfAWidget, InteractiveValue, ListLine, Mark, NamedView, OffsetOfAPlacement, SheetSettings } from './ops.ts';
14
+ import type { ColumnReading, ErrorValue } from './utility.ts';
15
15
  /** Cells between two corners of a sheet, the corners in any order. */
16
16
  export interface CellsBetween {
17
17
  sheetId: SheetId;
@@ -488,6 +488,20 @@ export type TableEdit =
488
488
  direction: SortDirection;
489
489
  thenBy?: FurtherKey[];
490
490
  }
491
+ /**
492
+ * The columns from `oneColumn` to `otherColumn` of the cells between two
493
+ * corners, moved after another column of those cells (`null`: first). The
494
+ * cells' formats, conditional formats, views and named views go with them,
495
+ * and their widths too where `widthsGoAlong`.
496
+ */
497
+ | {
498
+ kind: 'moveColumnsOfCells';
499
+ cells: CellsBetween;
500
+ oneColumn: ColumnId;
501
+ otherColumn: ColumnId;
502
+ afterColumn: ColumnId | null;
503
+ widthsGoAlong: boolean;
504
+ }
491
505
  /** `isAskedFor`: whether the person asked for the table, not the page guessing it. */
492
506
  | {
493
507
  kind: 'declareCellTable';
@@ -637,12 +651,140 @@ export type ObjectEdit =
637
651
  newNode: string;
638
652
  newName?: string | null;
639
653
  };
654
+ export type NamedViewEdit =
655
+ /** A named view saved over the one of an id, or as a new one (`null`). */
656
+ {
657
+ kind: 'saveNamedView';
658
+ sheetId: SheetId;
659
+ namedViewId: string | null;
660
+ namedView: NamedView;
661
+ } | {
662
+ kind: 'removeNamedView';
663
+ sheetId: SheetId;
664
+ namedViewId: string;
665
+ };
666
+ /** The table a pivot table reads: the sheet and the row of its header. */
667
+ export interface PivotTableSource {
668
+ sheetId: SheetId;
669
+ headerRow: RowId;
670
+ }
671
+ /** A span of time dates are grouped by. */
672
+ export type PivotPeriod = 'day' | 'month' | 'quarter' | 'year';
673
+ export type PivotOrder = 'ascending' | 'descending';
674
+ /** How the values of a column are totalled. `shareOfTotal` sums them as a share of the whole. */
675
+ export type PivotTotal = 'sum' | 'count' | 'distinctCount' | 'average' | 'min' | 'max' | 'shareOfTotal';
676
+ /** Whether a filter keeps the records whose value is listed, or the others. */
677
+ export type PivotKeeps = 'oneOf' | 'noneOf';
678
+ /** A value a filter lists. */
679
+ export type PivotWrittenValue = {
680
+ kind: 'number';
681
+ value: number;
682
+ } | {
683
+ kind: 'text';
684
+ value: string;
685
+ } | {
686
+ kind: 'boolean';
687
+ value: boolean;
688
+ } | {
689
+ kind: 'error';
690
+ value: ErrorValue;
691
+ };
692
+ /** A column of the source the rows (or columns) are grouped by, by date where `by` is a period. */
693
+ export interface PivotAxis {
694
+ column: ColumnId;
695
+ by: PivotPeriod | null;
696
+ order: PivotOrder;
697
+ /** `null`: the column's header. */
698
+ name: string | null;
699
+ }
700
+ /** A column of the source totalled, and the order the groups take by its totals (`null`: by their axes alone). */
701
+ export interface PivotMeasure {
702
+ column: ColumnId;
703
+ total: PivotTotal;
704
+ order: PivotOrder | null;
705
+ name: string | null;
706
+ }
707
+ /**
708
+ * The values a filter lists: written in the pivot table (`null`: blank), or
709
+ * the ones a cell holds.
710
+ */
711
+ export type PivotListed = {
712
+ kind: 'written';
713
+ values: (PivotWrittenValue | null)[];
714
+ } | {
715
+ kind: 'inACell';
716
+ sheetId: SheetId;
717
+ cell: CellAt;
718
+ };
719
+ export interface PivotFilter {
720
+ column: ColumnId;
721
+ keeps: PivotKeeps;
722
+ listed: PivotListed;
723
+ }
724
+ /**
725
+ * What a pivot table shows. It takes at least one value; with `columns` it
726
+ * takes just one. A written filter lists at least one value.
727
+ */
728
+ export interface PivotTable {
729
+ source: PivotTableSource;
730
+ rows: PivotAxis[];
731
+ columns: PivotAxis | null;
732
+ values: PivotMeasure[];
733
+ filters: PivotFilter[];
734
+ }
735
+ /** Where a new pivot table goes: a new sheet after one (`null` or left out: first), or a cell. */
736
+ export type PlaceOfAPivotTable = {
737
+ kind: 'newSheet';
738
+ afterSheet?: SheetId | null;
739
+ name: string;
740
+ } | {
741
+ kind: 'cell';
742
+ sheetId: SheetId;
743
+ cell: CellAt;
744
+ };
745
+ export type PivotTableEdit = {
746
+ kind: 'insertPivotTable';
747
+ place: PlaceOfAPivotTable;
748
+ pivotTable: PivotTable;
749
+ }
750
+ /** The pivot table at a cell, changed to show something else. */
751
+ | {
752
+ kind: 'changePivotTable';
753
+ sheetId: SheetId;
754
+ cell: CellAt;
755
+ pivotTable: PivotTable;
756
+ };
757
+ /**
758
+ * A value an interactive view writes to a cell of one of its inputs, the cell
759
+ * by its row and column within the input's range (from 0). `null` empties it.
760
+ */
761
+ export interface CellWrittenFromAnInteractive {
762
+ input: string;
763
+ row: number;
764
+ column: number;
765
+ value: InteractiveValue | null;
766
+ }
767
+ export type InteractiveEdit = {
768
+ kind: 'writeFromInteractive';
769
+ viewId: string;
770
+ cells: CellWrittenFromAnInteractive[];
771
+ }
772
+ /** The cells of the view's inputs, written back with the values it keeps. */
773
+ | {
774
+ kind: 'resetInteractive';
775
+ viewId: string;
776
+ }
777
+ /** The values of the view's inputs, kept as the ones a reset writes back. */
778
+ | {
779
+ kind: 'saveDefaultsOfInteractive';
780
+ viewId: string;
781
+ };
640
782
  /**
641
783
  * An edit `queueEdit` takes. The session also routes `adoptTimeZone`, but
642
784
  * never reads one: it adopts the browser's time zone itself
643
785
  * (`timeZoneOfTheBrowser`), so that kind is not an edit a page sends.
644
786
  */
645
- export type Edit = SheetEdit | CellEdit | ClipboardEdit | FormatEdit | LineEdit | TableEdit | ObjectEdit;
787
+ export type Edit = SheetEdit | CellEdit | ClipboardEdit | FormatEdit | LineEdit | TableEdit | ObjectEdit | NamedViewEdit | PivotTableEdit | InteractiveEdit;
646
788
  export type EditKind = Edit['kind'];
647
789
  export type EditOf<K extends EditKind> = Extract<Edit, {
648
790
  kind: K;
@@ -23,6 +23,14 @@ export interface IdRun {
23
23
  first: number;
24
24
  count: number;
25
25
  }
26
+ /**
27
+ * The ids of one base as runs of `[first, count]`, rising and apart. Operations
28
+ * write a sheet's rows so (each base once) when there are many runs of them.
29
+ */
30
+ export interface RunsOfABase {
31
+ base: string;
32
+ runs: [first: number, count: number][];
33
+ }
26
34
  /** A cell by its row and column ids. */
27
35
  export interface CellAt {
28
36
  r: RowId;
@@ -3,6 +3,7 @@ export * from './ids.ts';
3
3
  export * from './ops.ts';
4
4
  export * from './edits.ts';
5
5
  export * from './reads.ts';
6
+ export * from './packed.ts';
6
7
  export * from './utility.ts';
7
8
  export * from './sync.ts';
8
9
  export * from './refusals.ts';
@@ -3,6 +3,7 @@ export * from "./ids.js";
3
3
  export * from "./ops.js";
4
4
  export * from "./edits.js";
5
5
  export * from "./reads.js";
6
+ export * from "./packed.js";
6
7
  export * from "./utility.js";
7
8
  export * from "./sync.js";
8
9
  export * from "./refusals.js";
@@ -7,7 +7,9 @@
7
7
  * whole request unreadable. A field typed `T | null` must be written (as
8
8
  * `null` where there is none); an optional one may be left out.
9
9
  */
10
- import type { CellAt, ColumnId, IdRun, RangeCorners, RangeOnASheet, RowId, SheetId } from './ids.ts';
10
+ import type { SortDirection } from './edits.ts';
11
+ import type { CellAt, ColumnId, IdRun, RangeCorners, RangeOnASheet, RowId, RunsOfABase, SheetId } from './ids.ts';
12
+ import type { Filter } from './reads.ts';
11
13
  /** One end of a reference: a cell, its row and its column each fixed (`$`) or not. */
12
14
  export interface CellPoint {
13
15
  r: RowId;
@@ -198,6 +200,10 @@ export interface NumberFormat {
198
200
  /** A number format pattern (`#,##0.00`, `yyyy-mm-dd`, `General`). */
199
201
  pattern: string;
200
202
  }
203
+ /** How a format writes the wrapping of a cell's text: as a flag, or by name (overflowing, wrapped, clipped at the edge). */
204
+ export type WrapWritten = boolean | 'overflow' | 'wrap' | 'clip';
205
+ /** The wrapping of a cell's text as it is kept: wrapped or not, or clipped at the cell's edge. */
206
+ export type Wrap = boolean | 'clip';
201
207
  /**
202
208
  * A cell's format, as set and read back. Set, only the properties written
203
209
  * change; a property set to its default is taken away. Defaults: General, a
@@ -209,7 +215,7 @@ export interface CellFormat {
209
215
  alignment?: {
210
216
  horizontal?: HorizontalAlignment;
211
217
  vertical?: VerticalAlignment;
212
- wrap?: boolean;
218
+ wrap?: WrapWritten;
213
219
  };
214
220
  fillColor?: Color;
215
221
  cellControl?: CellControl;
@@ -231,7 +237,7 @@ export interface CellFormat {
231
237
  }
232
238
  /** Cells to format: every row by every column, and the format they take. */
233
239
  export interface CellsToFormat {
234
- rows: IdRun[];
240
+ rows: IdRun[] | RunsOfABase[];
235
241
  columns: IdRun[];
236
242
  format: CellFormat;
237
243
  }
@@ -253,6 +259,12 @@ export interface SheetSettings {
253
259
  lastFrozenRow?: RowId | null;
254
260
  lastFrozenColumn?: ColumnId | null;
255
261
  areGridlinesHidden?: boolean;
262
+ /**
263
+ * The interactive view (a view id) the sheet shows in place of its grid
264
+ * (`null`: none). Set only on an empty sheet, to a view with an interactive
265
+ * element; while it is set, edits to the sheet's grid are refused.
266
+ */
267
+ interactive?: string | null;
256
268
  }
257
269
  export interface SheetToSet {
258
270
  sheetId: SheetId;
@@ -462,11 +474,44 @@ export interface InputOfAWidget {
462
474
  name: string;
463
475
  range: RangeOnASheet;
464
476
  }
477
+ /** A value an interactive element writes to a cell of one of its inputs. */
478
+ export type InteractiveValue = {
479
+ kind: 'number';
480
+ value: number;
481
+ } | {
482
+ kind: 'text';
483
+ value: string;
484
+ } | {
485
+ kind: 'boolean';
486
+ value: boolean;
487
+ };
488
+ /** A cell of an input and the value saved for it (`null`: empty). */
489
+ export interface InteractiveCell {
490
+ r: RowId;
491
+ c: ColumnId;
492
+ value: InteractiveValue | null;
493
+ }
494
+ /** The values an interactive element keeps for one of its inputs, which a reset writes back. */
495
+ export interface InteractiveWrite {
496
+ /** The name of one of the element's inputs. */
497
+ input: string;
498
+ saved: InteractiveCell[];
499
+ }
500
+ /**
501
+ * An element of a view. A widget reads its inputs; an interactive element also
502
+ * writes to them, and keeps the values its inputs were saved with.
503
+ */
465
504
  export type ViewElement = {
466
505
  kind: 'widget';
467
506
  elementId: string;
468
507
  embed: Embed;
469
508
  inputs: InputOfAWidget[];
509
+ } | {
510
+ kind: 'interactive';
511
+ elementId: string;
512
+ embed: Embed;
513
+ inputs: InputOfAWidget[];
514
+ writes: InteractiveWrite[];
470
515
  };
471
516
  /** A view: its name and what it shows. Kept as written: its ranges do not follow rows that move. */
472
517
  export interface View {
@@ -519,6 +564,36 @@ export interface SheetName {
519
564
  sheetId: SheetId;
520
565
  name: string;
521
566
  }
567
+ /** A filter and a sort a sheet keeps under a name. It outlives the cell table it was made for. */
568
+ export interface NamedView {
569
+ name: string;
570
+ cellTableId: string;
571
+ filter: Filter | null;
572
+ sortBy: {
573
+ c: ColumnId;
574
+ direction: SortDirection;
575
+ }[];
576
+ }
577
+ /** `null` removes the named view. */
578
+ export interface NamedViewToSet {
579
+ namedViewId: string;
580
+ namedView: NamedView | null;
581
+ }
582
+ /**
583
+ * Rows put in an order among themselves. `order` is base 64 (`A`–`Z`, `a`–`z`,
584
+ * `0`–`9`, `-`, `_`), each index in as many digits as the largest needs: the
585
+ * `k`th place the rows take gets the row at index `order[k]` of `ids`. A rising
586
+ * run is written as its first index, `+` and how many follow.
587
+ */
588
+ export interface RowsInOrder {
589
+ ids: RunsOfABase[];
590
+ order: string;
591
+ }
592
+ /** A key of the sort that put the rows in order. */
593
+ export interface SortedBy {
594
+ c: ColumnId;
595
+ direction: SortDirection;
596
+ }
522
597
  /** Every operation, by `kind`. Lists in an operation are never empty, and runs never of no ids. */
523
598
  export type Op = {
524
599
  kind: 'insertSheet';
@@ -548,7 +623,7 @@ export type Op = {
548
623
  } | {
549
624
  kind: 'deleteRows';
550
625
  sheetId: SheetId;
551
- rows: IdRun[];
626
+ rows: IdRun[] | RunsOfABase[];
552
627
  } | {
553
628
  kind: 'deleteColumns';
554
629
  sheetId: SheetId;
@@ -556,7 +631,7 @@ export type Op = {
556
631
  } | {
557
632
  kind: 'undeleteRows';
558
633
  sheetId: SheetId;
559
- rows: IdRun[];
634
+ rows: IdRun[] | RunsOfABase[];
560
635
  } | {
561
636
  kind: 'undeleteColumns';
562
637
  sheetId: SheetId;
@@ -640,10 +715,19 @@ export type Op = {
640
715
  kind: 'setCellTables';
641
716
  sheetId: SheetId;
642
717
  cellTables: CellTableToSet[];
718
+ } | {
719
+ kind: 'setNamedViews';
720
+ sheetId: SheetId;
721
+ namedViews: NamedViewToSet[];
643
722
  } | {
644
723
  kind: 'moveRows';
645
724
  sheetId: SheetId;
646
725
  moves: RowMove[];
726
+ } | {
727
+ kind: 'reorderRows';
728
+ sheetId: SheetId;
729
+ rows: RowsInOrder;
730
+ sortedBy: SortedBy[];
647
731
  } | {
648
732
  kind: 'moveColumns';
649
733
  sheetId: SheetId;
@@ -660,7 +744,7 @@ export type OpOf<K extends OpKind> = Extract<Op, {
660
744
  /** The oldest version of the operations' format the engine reads. */
661
745
  export declare const OLDEST_FORMAT_VERSION = 17;
662
746
  /** The newest version of the operations' format the engine writes. */
663
- export declare const NEWEST_FORMAT_VERSION = 39;
747
+ export declare const NEWEST_FORMAT_VERSION = 47;
664
748
  /**
665
749
  * An edit as recorded for the server: the version of the format its operations
666
750
  * are written in, the revision it was made on, and the operations.
package/src/engine/ops.js CHANGED
@@ -10,4 +10,4 @@
10
10
  /** The oldest version of the operations' format the engine reads. */
11
11
  export const OLDEST_FORMAT_VERSION = 17;
12
12
  /** The newest version of the operations' format the engine writes. */
13
- export const NEWEST_FORMAT_VERSION = 39;
13
+ export const NEWEST_FORMAT_VERSION = 47;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Reads whose cells come apart from their JSON: the answer names blocks of
3
+ * cells by index, and the blocks reach the caller's `take` (see
4
+ * `EngineClient.requestWithCells`). Everything else in the answer is as the
5
+ * plain read tells it.
6
+ */
7
+ import type { ColumnId, RowId, SheetId } from './ids.ts';
8
+ import type { SheetLayoutContents, SpilledCell, WorkbookContents } from './reads.ts';
9
+ /** A block of cells, by the order this answer's blocks were taken in (from 0). */
10
+ export type CellBlockIndex = number;
11
+ /** A sheet as `readWorkbook` tells it, its cells in blocks. */
12
+ export interface SheetContentsWithCellsPacked extends SheetLayoutContents {
13
+ cells: CellBlockIndex[];
14
+ }
15
+ /** The workbook as `readWorkbook` tells it, each sheet's cells in blocks. */
16
+ export interface WorkbookContentsWithCellsPacked extends Omit<WorkbookContents, 'kind' | 'sheets'> {
17
+ kind: 'workbookContentsWithCellsPacked';
18
+ sheets: SheetContentsWithCellsPacked[];
19
+ }
20
+ export interface ReadWorkbookWithCellsPackedRequest {
21
+ kind: 'readWorkbookWithCellsPacked';
22
+ }
23
+ /**
24
+ * Some cells of a sheet, in blocks: those in the rows named (`null`: every row)
25
+ * and between two columns, either way round (`null`: every column).
26
+ */
27
+ export interface ReadRowsWithCellsPackedRequest {
28
+ kind: 'readRowsWithCellsPacked';
29
+ sheetId: SheetId;
30
+ /** Rows the sheet does not have are passed over. */
31
+ rows: RowId[] | null;
32
+ columns: [ColumnId, ColumnId] | {
33
+ oneColumn: ColumnId;
34
+ otherColumn: ColumnId;
35
+ } | null;
36
+ }
37
+ /** The cells read, in blocks, row by row, and what spills into them. */
38
+ export interface RowsWithCellsPackedAnswer {
39
+ kind: 'rowsWithCellsPacked';
40
+ cells: CellBlockIndex[];
41
+ spilledCells?: SpilledCell[];
42
+ }
43
+ /** Each packed read's request and the answer it gets when it is not refused. */
44
+ export interface PackedReadKinds {
45
+ readWorkbookWithCellsPacked: {
46
+ request: ReadWorkbookWithCellsPackedRequest;
47
+ answer: WorkbookContentsWithCellsPacked;
48
+ };
49
+ readRowsWithCellsPacked: {
50
+ request: ReadRowsWithCellsPackedRequest;
51
+ answer: RowsWithCellsPackedAnswer;
52
+ };
53
+ }
54
+ export type PackedReadKind = keyof PackedReadKinds;
55
+ export type PackedReadRequest = {
56
+ [K in PackedReadKind]: PackedReadKinds[K]['request'];
57
+ }[PackedReadKind];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Reads whose cells come apart from their JSON: the answer names blocks of
3
+ * cells by index, and the blocks reach the caller's `take` (see
4
+ * `EngineClient.requestWithCells`). Everything else in the answer is as the
5
+ * plain read tells it.
6
+ */
7
+ export {};
@@ -9,8 +9,8 @@
9
9
  * `readConditionalFormatsAsAgentIsTold` count days from the session's clock.
10
10
  */
11
11
  import type { CellAt, ColumnId, IdRun, RangeCorners, RowId, SheetId } from './ids.ts';
12
- import type { Border, CellCondition, CellControl, CellFormat, CellTable, Color, ConditionalFormat, DropdownOption, Effect, EndsOfGroup, HorizontalAlignment, Input, Placement, StoredFormula, Underline, VerticalAlignment, View } from './ops.ts';
13
- import type { CellsBetween, FurtherKey, SortDirection, TableIntoSheet } from './edits.ts';
12
+ import type { Border, CellCondition, CellControl, CellFormat, CellTable, Color, ConditionalFormat, DropdownOption, Effect, EndsOfGroup, HorizontalAlignment, Input, NamedView, Placement, StoredFormula, Underline, VerticalAlignment, View, Wrap } from './ops.ts';
13
+ import type { CellsBetween, FurtherKey, PivotKeeps, PivotTable, PivotTableSource, PivotWrittenValue, SortDirection, TableIntoSheet } from './edits.ts';
14
14
  import type { ErrorValue } from './utility.ts';
15
15
  /** An error as a cell holds it, by its text. */
16
16
  export type CellErrorText = ErrorValue;
@@ -28,10 +28,12 @@ export type ValueContents = {
28
28
  kind: 'error';
29
29
  value: CellErrorText;
30
30
  };
31
- /** The color a number format's section gives the text it shows. */
31
+ /** A color a number format's section names (`[Red]`), in lowercase. */
32
+ export type NamedFormatColor = 'black' | 'blue' | 'cyan' | 'green' | 'magenta' | 'red' | 'white' | 'yellow';
33
+ /** The color a number format's section gives the text it shows: named, or by its number (`[Color12]`, 1 to 56). */
32
34
  export type ShownColor = {
33
35
  kind: 'named';
34
- name: string;
36
+ name: NamedFormatColor;
35
37
  } | {
36
38
  kind: 'indexed';
37
39
  index: number;
@@ -155,12 +157,19 @@ export interface CellTableContents {
155
157
  cellTable: CellTable;
156
158
  liveCellTable: CellTable;
157
159
  }
160
+ /** A named view a sheet keeps, by its id (`nvw_…`). */
161
+ export interface NamedViewContents {
162
+ namedViewId: string;
163
+ namedView: NamedView;
164
+ }
158
165
  /** What a sheet holds besides its cells; each list is left out when empty. */
159
166
  export interface SheetLayoutContents {
160
167
  sheetId: SheetId;
161
168
  name: string;
162
169
  rows: IdRun[];
163
170
  columns: IdRun[];
171
+ /** The interactive view (a view id) the sheet shows in place of its grid. */
172
+ interactive?: string;
164
173
  mergedRanges?: MergedRangeContents[];
165
174
  columnWidths?: ColumnWidthContents[];
166
175
  rowHeights?: RowHeightContents[];
@@ -174,6 +183,7 @@ export interface SheetLayoutContents {
174
183
  conditionalFormats?: ConditionalFormatContents[];
175
184
  placements?: PlacementContents[];
176
185
  cellTables?: CellTableContents[];
186
+ namedViews?: NamedViewContents[];
177
187
  spilledCells?: SpilledCell[];
178
188
  }
179
189
  /** A sheet as the workbook tells it: its cells in order, row by row. */
@@ -427,7 +437,7 @@ export interface SharedCellFormat {
427
437
  alignment: {
428
438
  horizontal: HorizontalAlignment | null;
429
439
  vertical: VerticalAlignment | null;
430
- wrap: boolean | null;
440
+ wrap: Wrap | null;
431
441
  };
432
442
  fillColor: Color | null;
433
443
  cellControl: CellControl | null;
@@ -470,8 +480,8 @@ export interface TimeZoneAnswer {
470
480
  export type KindOfAColumn = 'number' | 'currency' | 'percent' | 'date' | 'fewWords' | 'checkbox' | 'text';
471
481
  /** A column of the records around some cells, counted. */
472
482
  export interface ColumnOfRecords {
473
- /** The column's id (letters, as the agent is told). */
474
- c: string | null;
483
+ /** The column's id (letters, as the agent is told). Every column of the records lies in the sheet, so it has one. */
484
+ c: string;
475
485
  name: string | null;
476
486
  kind: KindOfAColumn;
477
487
  filled: number;
@@ -508,7 +518,9 @@ export interface ConditionalFormatSuggestionsAnswer {
508
518
  isWidenedToColumn: boolean;
509
519
  suggestions: ConditionalFormatSuggestion[];
510
520
  ruleToStartFrom: RuleInIds;
521
+ /** The table around the cells: all of it, its records, and their columns. */
511
522
  table: {
523
+ cells: RangeCorners;
512
524
  records: RangeCorners;
513
525
  columns: ColumnOfRecords[];
514
526
  };
@@ -545,9 +557,11 @@ export interface ProblemOfARule {
545
557
  export type RulesRead = {
546
558
  kind: 'notAList';
547
559
  refusal: string;
548
- } | {
560
+ }
561
+ /** Every rule read: a list with a rule that cannot be read is told as `notRules`. */
562
+ | {
549
563
  kind: 'rules';
550
- rules: (RuleInIds | null)[];
564
+ rules: RuleInIds[];
551
565
  } | {
552
566
  kind: 'notRules';
553
567
  problems: ProblemOfARule[];
@@ -654,6 +668,10 @@ export interface InputsOfViewAnswer {
654
668
  elementId: string;
655
669
  inputs: InputRead[];
656
670
  }[];
671
+ /** An interactive view only: a reset would change some cell of its inputs. */
672
+ canBeReset?: true;
673
+ /** An interactive view only: its inputs hold values other than the ones it keeps. */
674
+ hasDefaultsToSave?: true;
657
675
  }
658
676
  /** The part rows of a table's body play. */
659
677
  export type RoleOfRows = 'record' | 'spacer' | 'section' | 'subtotal' | 'headerAgain';
@@ -678,12 +696,14 @@ export interface TableInIds {
678
696
  }
679
697
  /** A column of a table: its name and the kind of what it holds. */
680
698
  export interface ColumnOfATable {
681
- c: ColumnId | null;
699
+ /** Every column of a table lies in the sheet, so it has an id. */
700
+ c: ColumnId;
682
701
  name: string | null;
683
702
  kind: KindOfAColumn;
684
703
  }
685
704
  /** A table guessed, with its columns. */
686
705
  export interface TableWithColumns {
706
+ basis: BasisOfATable;
687
707
  table: TableInIds;
688
708
  columns: ColumnOfATable[];
689
709
  }
@@ -876,6 +896,41 @@ export interface ValuesOfFilteredColumnAnswer {
876
896
  values: ValueOfAFilteredColumn[];
877
897
  areMoreLeftOut: boolean;
878
898
  }
899
+ /** The pivot table at a cell: the one whose formula is in the cell, or whose values spill over it. */
900
+ export interface ReadPivotTableAtRequest {
901
+ kind: 'readPivotTableAt';
902
+ sheetId: SheetId;
903
+ cell: CellAt;
904
+ }
905
+ /** A pivot table found at a cell. */
906
+ export interface PivotTableRead {
907
+ /** The cell that holds its formula. */
908
+ cell: CellAt;
909
+ /** `null`: the formula does not read as a pivot table. */
910
+ pivotTable: PivotTable | null;
911
+ /** The table of the sheet it reads (`null`: none is found under its header row). */
912
+ table: TableOfASheet | null;
913
+ /** Whether each source column it reads ends at the table's last record, or runs on with no end. */
914
+ readsJustTheRecords: boolean;
915
+ }
916
+ export interface PivotTableAtAnswer {
917
+ kind: 'pivotTableAt';
918
+ /** `null`: no pivot table at the cell. */
919
+ read: PivotTableRead | null;
920
+ }
921
+ /**
922
+ * The values a column of a pivot table's source holds, in order, each with
923
+ * whether a filter that keeps (or leaves out) the listed ones keeps it. With
924
+ * nothing listed, every value is kept.
925
+ */
926
+ export interface ReadValuesToFilterPivotTableByRequest {
927
+ kind: 'readValuesToFilterPivotTableBy';
928
+ source: PivotTableSource;
929
+ c: ColumnId;
930
+ keeps: PivotKeeps;
931
+ /** `null`: blank. */
932
+ listed: (PivotWrittenValue | null)[];
933
+ }
879
934
  /** The rows a `sortRows` of the same fields would order, in its order. */
880
935
  export interface ReadRowsInSortedOrderRequest {
881
936
  kind: 'readRowsInSortedOrder';
@@ -936,13 +991,21 @@ export interface ReadXlsxFileRequest {
936
991
  nameOfTheSheetOfOptions: string;
937
992
  /** By hue, then shade: `#` and six lower-case hex digits, every hue with every shade. */
938
993
  rgbOfStandardColors: Record<string, Record<string, string>>;
994
+ /**
995
+ * The charts by their views, each with a description as the agent or the server gave it, unchecked. The engine reads
996
+ * it strictly: one that is not a `ChartDescription` leaves its chart out, as `descriptionNotReadable`.
997
+ */
939
998
  charts?: {
940
999
  viewId: string;
941
- description: ChartDescription;
1000
+ description: unknown;
942
1001
  }[];
943
1002
  }
944
1003
  /** What the file does not carry over. */
945
- export type NotCarriedOver = 'formulasWrittenAsValues' | 'randomNumbersThatStay' | 'users' | 'linksOfPartsOfTexts' | 'linksOfSomeCells' | 'listsInTexts' | 'checkboxes' | 'colorsOfDropdownOptions' | 'sheetNames' | 'looksOfSomeBlankCells' | 'sizesOfTheLargestRowsAndColumns' | 'conditionalFormats' | 'placedViews' | 'looksOfCharts';
1004
+ export type NotCarriedOver = 'formulasWrittenAsValues' | 'randomNumbersThatStay' | 'users' | 'linksOfPartsOfTexts' | 'linksOfSomeCells' | 'listsInTexts' | 'checkboxes' | 'colorsOfDropdownOptions' | 'sheetNames' | 'looksOfSomeBlankCells' | 'sizesOfTheLargestRowsAndColumns' | 'conditionalFormats' | 'placedViews' | 'looksOfCharts'
1005
+ /** A sheet that shows an interactive view is written as its cells. */
1006
+ | 'interactives'
1007
+ /** Saved views; the engine does not report them yet. */
1008
+ | 'namedViews';
946
1009
  /** Why a placed view is not a chart in the file. */
947
1010
  export type WhyAChartIsLeftOut = 'notAChart' | 'notDescribed' | 'descriptionNotReadable' | 'worksOutItsNumbersInCode' | 'noSuchKind' | 'inputTooLarge' | 'unknownInput' | 'inputHoldsNothing' | 'tableHoldsNoCategoryOrNoSeries' | 'categoriesLieApart' | 'listIsNotOneRowOrColumn' | 'noSeriesHoldsANumber' | 'severalSeriesInAPie' | 'categoriesOfAScatterHoldNoNumber' | 'tooManySeries' | 'tooManyPoints' | 'tooManyPointsInAllCharts';
948
1011
  /** The file's parts, each its path in the zip and its XML. */
@@ -1084,6 +1147,14 @@ export interface ReadKinds {
1084
1147
  request: ReadTablesOfSheetRequest;
1085
1148
  answer: TablesOfSheetAnswer;
1086
1149
  };
1150
+ readPivotTableAt: {
1151
+ request: ReadPivotTableAtRequest;
1152
+ answer: PivotTableAtAnswer;
1153
+ };
1154
+ readValuesToFilterPivotTableBy: {
1155
+ request: ReadValuesToFilterPivotTableByRequest;
1156
+ answer: ValuesOfFilteredColumnAnswer;
1157
+ };
1087
1158
  readXlsxFile: {
1088
1159
  request: ReadXlsxFileRequest;
1089
1160
  answer: XlsxFileAnswer;