@open-artifact/sheets-core 0.11.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.
- package/package.json +3 -3
- package/src/agent/cell-links.d.ts +28 -0
- package/src/agent/cell-links.js +79 -0
- package/src/agent/charts.d.ts +18 -2
- package/src/agent/charts.js +121 -6
- package/src/agent/edits.d.ts +2 -0
- package/src/agent/edits.js +7 -1
- package/src/agent/index.d.ts +1 -0
- package/src/agent/index.js +1 -0
- package/src/agent/reads.d.ts +8 -2
- package/src/agent/reads.js +18 -6
- package/src/agent/workbook.d.ts +20 -1
- package/src/engine/client.d.ts +4 -1
- package/src/engine/client.js +4 -0
- package/src/engine/edits.d.ts +145 -3
- package/src/engine/ids.d.ts +8 -0
- package/src/engine/index.d.ts +1 -0
- package/src/engine/index.js +1 -0
- package/src/engine/ops.d.ts +90 -6
- package/src/engine/ops.js +1 -1
- package/src/engine/packed.d.ts +57 -0
- package/src/engine/packed.js +7 -0
- package/src/engine/reads.d.ts +83 -12
- package/src/engine/refusals.d.ts +43 -3
- package/src/engine/sync.d.ts +44 -4
- package/src/engine/utility.d.ts +2 -0
package/src/engine/refusals.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type OpRefusal = 'unreadableRequest' | 'unknownSheet' | 'unknownRow' | 'u
|
|
|
7
7
|
/** Undeleting what a load deleted: the load did not keep it. */
|
|
8
8
|
| 'deletedCellsNotLoaded' | 'numberNotFinite'
|
|
9
9
|
/** `load`, `apply`, `undo` or `replay` on a session that syncs. */
|
|
10
|
-
| 'syncInUse' | 'cellFormatSetTwice' | 'sheetSettingsSetTwice' | 'unknownDropdown' | 'dropdownSetTwice' | 'dropdownOptionIdInTwoDropdowns' | 'dropdownIdTaken' | 'dropdownOptionIdTaken' | 'dropdownInUse' | 'unknownGroup' | 'groupNamedTwice' | 'unknownConditionalFormat' | 'conditionalFormatNamedTwice' | 'viewNamedTwice' | 'viewInUse' | 'unknownView' | 'placementNamedTwice' | 'cellTableNamedTwice' | 'rangeAlreadyMerged' | 'rangeNotMerged' | 'unknownDropdownOption' | 'cellOfDropdownHoldsNoOption' | 'cellCoveredByMergedRange' | 'textTooLong' | 'formulaTooLong' | 'tooMuchThatNoCellShows' | 'idNotWellFormed' | 'editTooLarge' | 'tooManyCellsToEnterIn' | 'userIdNotWellFormed' | 'tooManyUsersInCell' | 'userLabelNotAllowed' | 'addressLinkedToTooLong' | 'addressLinkedToNotOfTheWeb' | 'richTextTooLarge' | 'rowNotNamedInTheWay';
|
|
10
|
+
| 'syncInUse' | 'cellFormatSetTwice' | 'sheetSettingsSetTwice' | 'unknownDropdown' | 'dropdownSetTwice' | 'dropdownOptionIdInTwoDropdowns' | 'dropdownIdTaken' | 'dropdownOptionIdTaken' | 'dropdownInUse' | 'unknownGroup' | 'groupNamedTwice' | 'unknownConditionalFormat' | 'conditionalFormatNamedTwice' | 'viewNamedTwice' | 'viewInUse' | 'unknownView' | 'namedViewNamedTwice' | 'placementNamedTwice' | 'cellTableNamedTwice' | 'rangeAlreadyMerged' | 'rangeNotMerged' | 'unknownDropdownOption' | 'cellOfDropdownHoldsNoOption' | 'cellCoveredByMergedRange' | 'textTooLong' | 'formulaTooLong' | 'tooMuchThatNoCellShows' | 'idNotWellFormed' | 'editTooLarge' | 'tooManyCellsToEnterIn' | 'userIdNotWellFormed' | 'tooManyUsersInCell' | 'userLabelNotAllowed' | 'addressLinkedToTooLong' | 'addressLinkedToNotOfTheWeb' | 'richTextTooLarge' | 'rowNotNamedInTheWay';
|
|
11
11
|
/** Why a reverse (`undo`) or a step taken back is refused. */
|
|
12
12
|
export type TakeBackRefusal =
|
|
13
13
|
/** The reverse does not apply to the workbook: it is not one. */
|
|
@@ -24,14 +24,54 @@ export type QueueRefusal =
|
|
|
24
24
|
| 'opIdInUse'
|
|
25
25
|
/** Rows, columns or sheets moved (by a move or a sort) among other edits of one request. */
|
|
26
26
|
| 'moveAmongSeveralEdits'
|
|
27
|
-
/** The edit would leave the workbook holding more cells than it may (
|
|
27
|
+
/** The edit would leave the workbook holding more cells than it may (500 000). */
|
|
28
28
|
| 'tooManyCells';
|
|
29
|
+
/**
|
|
30
|
+
* Why a pivot table edit (`insertPivotTable`, `changePivotTable`) is refused,
|
|
31
|
+
* besides an unknown sheet, row or column. `readValuesToFilterPivotTableBy`
|
|
32
|
+
* refuses with `pivotTableSourceHasNoHeader` and `pivotTableSourceHasNoRecords`.
|
|
33
|
+
*/
|
|
34
|
+
export type PivotTableRefusal =
|
|
35
|
+
/** The new sheet's name cannot be a sheet's. */
|
|
36
|
+
'sheetNameNotAllowed' | 'noPivotTableAtTheCell'
|
|
37
|
+
/** No table of the source sheet has its header on the source's header row. */
|
|
38
|
+
| 'pivotTableSourceHasNoHeader' | 'pivotTableColumnNotOfSource' | 'pivotTableWouldReadItself' | 'pivotTableWouldTouchATable'
|
|
39
|
+
/** A cell where the pivot table would go is not empty. */
|
|
40
|
+
| 'pivotTableCellsInTheWay'
|
|
41
|
+
/** It would spill past the sheet's last row or column. */
|
|
42
|
+
| 'tooManyRows' | 'tooManyColumns' | 'pivotTableFormulaInTheWay' | 'pivotTableWouldBeReadByAnother' | 'pivotTableTooLarge' | 'pivotTableWithColumnsTakesOneValue' | 'pivotTableSourceHasNoRecords' | 'pivotTableSourceHasSectionsOrSubtotals'
|
|
43
|
+
/** The source's records cannot be told apart (merged cells among them, or the header again). */
|
|
44
|
+
| 'pivotTableSourceRecordsNotClear' | 'pivotTableTotalNeedsNumbers' | 'pivotTablePeriodNeedsDates' | 'pivotTableFilterValueCannotBeWritten';
|
|
45
|
+
/** Why an edit is refused for an interactive view, or for a sheet that shows one. */
|
|
46
|
+
export type InteractiveRefusal =
|
|
47
|
+
/** No sheet shows the view as an interactive one. */
|
|
48
|
+
'unknownInteractive'
|
|
49
|
+
/** A cell written is not one the view keeps a value for. */
|
|
50
|
+
| 'cellIsNotTheInteractives'
|
|
51
|
+
/** A cell written holds more than a plain value. */
|
|
52
|
+
| 'cellHoldsMoreThanAValue' | 'valueDoesNotFitCell' | 'textTooLong'
|
|
53
|
+
/** Saving the inputs' values would make the view too large. */
|
|
54
|
+
| 'interactiveSavesTooMuch'
|
|
55
|
+
/** An edit would change the grid of a sheet that shows an interactive view. */
|
|
56
|
+
| 'sheetIsAnInteractive'
|
|
57
|
+
/** A placement would show an interactive view: a sheet shows one in place of its grid instead. */
|
|
58
|
+
| 'viewIsAnInteractive'
|
|
59
|
+
/** The sheet setting `interactive` names a view with no interactive element. */
|
|
60
|
+
| 'viewIsNoInteractive'
|
|
61
|
+
/** The sheet setting `interactive` set on a sheet that holds cells. */
|
|
62
|
+
| 'sheetForInteractiveIsNotEmpty';
|
|
63
|
+
/** Why `moveColumnsOfCells` is refused, besides an unknown sheet, row or column. */
|
|
64
|
+
export type MoveColumnsOfCellsRefusal =
|
|
65
|
+
/** A column moved, or the one to move after, is not among the cells. */
|
|
66
|
+
'movedColumnOutsideTheCells' | 'mergedRangeAmongMovedColumnsOfCells' | 'columnOutOfSightAmongMovedColumnsOfCells' | 'spilledValuesAmongMovedColumnsOfCells';
|
|
67
|
+
/** Why `saveNamedView` or `removeNamedView` is refused, besides an unknown sheet or column. */
|
|
68
|
+
export type NamedViewRefusal = 'nameOfNamedViewNotAllowed' | 'nameOfNamedViewTaken' | 'tooManyNamedViews' | 'unknownNamedView' | 'tooManyTestsInNamedView' | 'tooManyKeysInNamedView' | 'namedViewTooLarge' | 'valueInNamedViewNotAllowed';
|
|
29
69
|
/**
|
|
30
70
|
* Every refusal the engine is known to answer with. Edits and reads add
|
|
31
71
|
* refusals of their own (`unknownSheet`, `sheetNameTaken`, `noCellsToSort`, …);
|
|
32
72
|
* those are told as plain strings where their kinds are not listed here.
|
|
33
73
|
*/
|
|
34
|
-
export type Refusal = OpRefusal | TakeBackRefusal | QueueRefusal;
|
|
74
|
+
export type Refusal = OpRefusal | TakeBackRefusal | QueueRefusal | PivotTableRefusal | InteractiveRefusal | MoveColumnsOfCellsRefusal | NamedViewRefusal;
|
|
35
75
|
/** A refused request. */
|
|
36
76
|
export interface Refused<R extends string = string> {
|
|
37
77
|
kind: 'refused';
|
package/src/engine/sync.d.ts
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* `apply`, `undo`, `replay`, the reads and the history reads); from then on it
|
|
9
9
|
* syncs, and those four are refused (`syncInUse`).
|
|
10
10
|
*/
|
|
11
|
-
import type { CellAt, ColumnId, PlaceChanged, RowId, SheetId } from './ids.ts';
|
|
11
|
+
import type { CellAt, ColumnId, IdRun, PlaceChanged, RowId, SheetId } from './ids.ts';
|
|
12
12
|
import type { Op, RecordedEdit } from './ops.ts';
|
|
13
13
|
import type { Edit, OtherAnswerToAnEdit, TextThatNoCellShows } from './edits.ts';
|
|
14
|
+
import type { PackedReadKinds } from './packed.ts';
|
|
14
15
|
import type { CellContents, ReadKinds } from './reads.ts';
|
|
15
16
|
import type { Fault, Refused, StopReason } from './refusals.ts';
|
|
16
17
|
/** Operations loaded as the workbook's start: nothing they delete is kept to undelete. */
|
|
@@ -50,7 +51,10 @@ export type Changes = {
|
|
|
50
51
|
} | {
|
|
51
52
|
kind: 'inSheets';
|
|
52
53
|
sheets: SheetChanges[];
|
|
53
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Views whose inputs read cells changed, or have a sheet whose lines changed; and interactive
|
|
56
|
+
* views whose inputs have a sheet whose formats or widths changed.
|
|
57
|
+
*/
|
|
54
58
|
views?: string[];
|
|
55
59
|
isTimeZoneChanged?: true;
|
|
56
60
|
};
|
|
@@ -77,7 +81,7 @@ export type NextStep = null | {
|
|
|
77
81
|
kind: 'stop';
|
|
78
82
|
reason: StopReason;
|
|
79
83
|
}
|
|
80
|
-
/** Fetch the page of edits starting at a revision, and give it with `receiveLoadPage
|
|
84
|
+
/** Fetch the page of edits starting at a revision, and give it with `receiveLoadPage` (or `receiveLinesOfLoad`). */
|
|
81
85
|
| {
|
|
82
86
|
kind: 'fetchLoadPage';
|
|
83
87
|
from: number;
|
|
@@ -148,6 +152,21 @@ export interface ReceiveLoadPageRequest {
|
|
|
148
152
|
/** Where the next page starts; `null`: this is the last. */
|
|
149
153
|
next: number | null;
|
|
150
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* A page of the load written as lines of a snapshot (one JSON piece to a line)
|
|
157
|
+
* rather than as operations. The first page starts with the workbook's piece
|
|
158
|
+
* and the last ends with the end piece; a load is read one way or the other
|
|
159
|
+
* throughout, and a page that does not read stops the session (`unreadableLoad`).
|
|
160
|
+
*/
|
|
161
|
+
export interface ReceiveLinesOfLoadRequest {
|
|
162
|
+
kind: 'receiveLinesOfLoad';
|
|
163
|
+
from: number;
|
|
164
|
+
revision: number;
|
|
165
|
+
/** The format version of the load; the lines carry their own, so it is not read. */
|
|
166
|
+
v: number;
|
|
167
|
+
lines: string;
|
|
168
|
+
next: number | null;
|
|
169
|
+
}
|
|
151
170
|
/** An edit as the server streams it. */
|
|
152
171
|
export interface StreamedEdit {
|
|
153
172
|
/** Who made it, as the server tells. */
|
|
@@ -203,6 +222,23 @@ export interface QueueEditRequest {
|
|
|
203
222
|
timeZoneOfTheBrowser?: string | null;
|
|
204
223
|
editsBefore?: EditBefore[];
|
|
205
224
|
editsThatGoAlong?: EditAlong[];
|
|
225
|
+
/**
|
|
226
|
+
* The sheet whose columns the edit widens where they are too narrow for the
|
|
227
|
+
* numbers it gives a pattern (`formatCells` with a number format), as a part
|
|
228
|
+
* of the same edit. Undo and redo tell the cells formatted, not the widths.
|
|
229
|
+
*/
|
|
230
|
+
makesRoomForNumbersIn?: SheetId | null;
|
|
231
|
+
/**
|
|
232
|
+
* The order the person sees the sheet's rows in, when they have sorted them
|
|
233
|
+
* for themselves: fills, pastes and borders on that sheet are made in it.
|
|
234
|
+
* A row named twice is refused (`rowNamedTwice`), and so is a fill or paste
|
|
235
|
+
* that would move a formula reading another row by a relative row across the
|
|
236
|
+
* places the order changes (`formulaReadsAnotherRow`).
|
|
237
|
+
*/
|
|
238
|
+
ownRowOrder?: {
|
|
239
|
+
sheetId: SheetId;
|
|
240
|
+
rows: IdRun[];
|
|
241
|
+
} | null;
|
|
206
242
|
}
|
|
207
243
|
/** What became of an edit that goes along. */
|
|
208
244
|
export type WentAlong = {
|
|
@@ -344,7 +380,7 @@ export interface HistoryOfARowAnswer {
|
|
|
344
380
|
areEarlierLeftOut: boolean;
|
|
345
381
|
}
|
|
346
382
|
/** Each kind of session request, with what it takes and the answer it gets (refusals aside, where not listed). */
|
|
347
|
-
export interface SessionKinds extends ReadKinds {
|
|
383
|
+
export interface SessionKinds extends ReadKinds, PackedReadKinds {
|
|
348
384
|
load: {
|
|
349
385
|
request: LoadRequest;
|
|
350
386
|
answer: LoadedAnswer;
|
|
@@ -381,6 +417,10 @@ export interface SessionKinds extends ReadKinds {
|
|
|
381
417
|
request: ReceiveLoadPageRequest;
|
|
382
418
|
answer: SyncStateAnswer;
|
|
383
419
|
};
|
|
420
|
+
receiveLinesOfLoad: {
|
|
421
|
+
request: ReceiveLinesOfLoadRequest;
|
|
422
|
+
answer: SyncStateAnswer;
|
|
423
|
+
};
|
|
384
424
|
receiveStreamedEdit: {
|
|
385
425
|
request: ReceiveStreamedEditRequest;
|
|
386
426
|
answer: SyncStateAnswer;
|
package/src/engine/utility.d.ts
CHANGED
|
@@ -156,6 +156,8 @@ export interface SharedLimits {
|
|
|
156
156
|
largestOffsetOfAPlacementInPixels: number;
|
|
157
157
|
mostCheckboxesOfOneInsert: number;
|
|
158
158
|
mostEditsInAStep: number;
|
|
159
|
+
mostNamedViewsInASheet: number;
|
|
160
|
+
longestNameOfANamedViewInCharacters: number;
|
|
159
161
|
}
|
|
160
162
|
/** What chart code (SVG) may hold. */
|
|
161
163
|
export interface WhatChartCodeMayHold {
|