@betteroffice/xlsx 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -192
- package/dist/asyncReplica-DuZEFXjI.d.ts +253 -0
- package/dist/chunk-DIDVDN7H.js +1 -0
- package/dist/chunk-HJJEOLPD.js +1 -0
- package/dist/chunk-JGTBRHCP.js +1 -0
- package/dist/chunk-K7TMSGNA.js +1 -0
- package/dist/chunk-SXM2HKJL.js +4 -0
- package/dist/collaboration.d.ts +19 -2
- package/dist/collaboration.js +1 -1
- package/dist/editPeer-DN6JDr8Z.d.ts +1906 -0
- package/dist/generated/xlsx_wasm_bg.wasm +0 -0
- package/dist/headless.d.ts +9 -290
- package/dist/headless.js +1 -1
- package/dist/index.d.ts +6 -908
- package/dist/index.js +4 -1
- package/dist/types-DdoEoFSX.d.ts +350 -0
- package/dist/worker.d.ts +25 -0
- package/dist/worker.js +1 -0
- package/dist/xlsxSessionWorker.d.ts +2 -0
- package/dist/xlsxSessionWorker.mjs +1 -0
- package/package.json +13 -3
- package/dist/chunk-E6PJOEEH.js +0 -4
- package/dist/types-C24EBcAP.d.ts +0 -91
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export { B as BorderPatch, a as BorderPreset, b as BorderStyle, C as CalculationStatus, c as CapturedBorderEdge, d as CapturedBorderStyle, e as CapturedCellFormat, f as CapturedColor, g as CapturedFill, h as CapturedFormat, i as CellEdit, j as CellInputEdit, k as CellPoint, l as CellPosition, m as ChartEdit, n as ChartInfo, o as ChartMutation, p as ChartSeriesInfo, q as ChartSeriesName, r as ConditionalFormatInfo, s as ConditionalFormatOp, t as ConditionalFormatRuleInput, D as DifferentialFormatInput, u as DisplayListProfile, v as DisplayTooLargeError, E as EditProfile, w as EditResult, x as EditSuccess, y as ExportCompletion, z as ExportDiagnostic, A as ExportSeverity, H as HistoryState, F as HorizontalAlignment, M as MarkdownAnchor, G as MergedRange, N as NumberFormat, I as NumberFormatMutation, O as OpenWorkbookOptions, J as OpenWorkbookSessionOptions, K as OperationFailure, L as OperationRefusal, P as PrintMetrics, Q as ProfiledDisplayList, R as ProfiledEditResult, S as Proposal, T as ProposalCell, U as ProposalEdit, V as RangeStylePatch, W as SelectionFormatting, X as SheetInfo, Y as StaleProposalError, Z as StaleProposalTarget, _ as StyleProperty, $ as TextWrapping, a0 as ValidationSuccess, a1 as VerticalAlignment, a2 as Viewport, a3 as WasmInitInput, a4 as WorkbookCalculationContext, a5 as WorkbookCellGeometry, a6 as WorkbookCellInputs, a7 as WorkbookEditPeerFailedError, a8 as WorkbookEditSession, a9 as WorkbookFrame, aa as WorkbookFrameOptions, ab as WorkbookHandle, ac as WorkbookHyperlink, ad as WorkbookInitialPaint, ae as WorkbookInitialPaintRequest, af as WorkbookPeerHydrationError, ag as WorkbookPngUnavailableError, ah as WorkbookRecoveryReplayError, ai as WorkbookSession, aj as WorkbookSessionEvents, ak as WorkbookSessionMethods, al as WorkbookSessionOpenOptions, am as WorkbookSessionOpenReply, an as WorkbookSessionRecovery, ao as WorkbookSessionState, ap as WorkbookSheetSummary, aq as WorkbookSheetView, ar as WorkbookUpdateInfo, as as WorkbookUpdateListener, at as WorkbookUpdateOrigin, au as XlsxAnchor, av as XlsxAutoFilterOp, aw as XlsxCellAddress, ax as XlsxCellGuard, ay as XlsxCellPosition, az as XlsxCellRead, aA as XlsxCellValue, aB as XlsxDefinedName, aC as XlsxDefinedNameOp, aD as XlsxDefinedNamesRequest, aE as XlsxDefinedNamesResult, aF as XlsxEditCalculation, aG as XlsxEditFailure, aH as XlsxEditFailureCode, aI as XlsxEditHistory, aJ as XlsxEditOperation, aK as XlsxEditPreview, aL as XlsxEditReceipt, aM as XlsxEditRefusal, aN as XlsxEditRequest, aO as XlsxEditResult, aP as XlsxEditSource, aQ as XlsxEditStep, aR as XlsxErrorValue, aS as XlsxExportCell, aT as XlsxExportDefinedName, aU as XlsxExportDiagnostic, aV as XlsxExportDiagnosticCode, aW as XlsxExportFailure, aX as XlsxExportFailureCode, aY as XlsxExportHyperlink, aZ as XlsxExportMerge, a_ as XlsxExportObject, a$ as XlsxExportOptions, b0 as XlsxExportResult, b1 as XlsxExportScope, b2 as XlsxExportSheet, b3 as XlsxExportTable, b4 as XlsxExportValue, b5 as XlsxFindMatch, b6 as XlsxFindRequest, b7 as XlsxFindResult, b8 as XlsxFormulaResult, b9 as XlsxMarkdownContent, ba as XlsxMarkdownOptions, bb as XlsxObjectKind, bc as XlsxRangeAddress, bd as XlsxRangeRead, be as XlsxRangeTarget, bf as XlsxReadCalculation, bg as XlsxReadRequest, bh as XlsxReadResult, bi as XlsxSheetEntry, bj as XlsxSheetIdentity, bk as XlsxSourcePart, bl as XlsxStructuredContent, bm as XlsxTextMatch, bn as XlsxTextSearchOptions, bo as XlsxValidationResult, bp as createWorkbookEditSession, bq as exportXlsxMarkdown, br as exportXlsxStructured, bs as getDisplayListCellLimit, bt as initWasm, bu as isPngExportAvailable, bv as isProposalsAvailable, bw as isWasmAvailable, bx as openWorkbook, by as openWorkbookSession, bz as renderXlsxMarkdown, bA as wasmVersion, bB as workbookSessionRecovery } from './editPeer-DN6JDr8Z.js';
|
|
2
|
+
import { D as DisplayList } from './types-DdoEoFSX.js';
|
|
3
|
+
export { C as CellAddr, a as CellRange, b as ChartA11yAttrs, c as ChartRegion, d as Direction, e as DrawCmd, F as FillRectCmd, G as GeometryPathCommand, f as GridMeta, H as HyperlinkRegion, K as KeyInput, L as LineCmd, M as MoveOpts, P as PathCmd, g as PathStroke, h as PatternFillCmd, i as PatternType, R as Rect, S as Selection, j as SelectionAction, k as SelectionData, l as SelectionHidden, m as SelectionLimits, n as SelectionMerges, T as TextAlign, o as TextCmd, p as TextWrap } from './types-DdoEoFSX.js';
|
|
4
|
+
export { A11yCell, A11yChart, A11yColumnHeader, A11yGrid, A11yRow, A11yStrings, CellInput, HyperlinkDestination, TrackOffsets, ViewportState, VisibleCells, VisibleRange, buildA11yGrid, cellAtPoint, cellCount, cellRect, chartRegionAtPoint, clampScroll, extendTo, fromTsv, hyperlinkAtCell, moveFocus, normalizeRange, parseHyperlinkLocation, rangeContains, rangeRect, safeExternalHyperlink, selectionAt, selectionKeyReducer, toTsv, totalExtent, trackCount, uniformOffsets, visibleCells, visibleRange } from './headless.js';
|
|
5
|
+
import './asyncReplica-DuZEFXjI.js';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Canvas2D backend for the display list — the browser paint target.
|
|
@@ -21,908 +23,4 @@ declare function paintDisplayList(ctx: CanvasRenderingContext2D, dl: DisplayList
|
|
|
21
23
|
y: number;
|
|
22
24
|
}): void;
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Result envelopes shared by the formats' host edit APIs. Targets, steps, receipts and failure
|
|
28
|
-
* codes stay format-owned; these shapes only fix how every format reports success and refusal.
|
|
29
|
-
*/
|
|
30
|
-
/** Why a host operation was refused, as data. The document is unchanged. */
|
|
31
|
-
interface OperationFailure<Code extends string, Target> {
|
|
32
|
-
code: Code;
|
|
33
|
-
/** The request step that failed, when one did. */
|
|
34
|
-
stepIndex?: number;
|
|
35
|
-
/** The earlier step an `overlapping-steps` failure conflicts with. */
|
|
36
|
-
conflictingStepIndex?: number;
|
|
37
|
-
/** The failing step's target as requested or resolved. */
|
|
38
|
-
target?: Target;
|
|
39
|
-
message: string;
|
|
40
|
-
}
|
|
41
|
-
/** A policy refusal carrying the version the document is still at. */
|
|
42
|
-
interface OperationRefusal<Failure> {
|
|
43
|
-
ok: false;
|
|
44
|
-
version: string;
|
|
45
|
-
failure: Failure;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* An accepted edit request. `applied` is false when every step was a no-op; the version then
|
|
49
|
-
* stays `baseVersion` and no history or change notification was produced.
|
|
50
|
-
*/
|
|
51
|
-
interface EditSuccess<Receipt> {
|
|
52
|
-
ok: true;
|
|
53
|
-
baseVersion: string;
|
|
54
|
-
version: string;
|
|
55
|
-
applied: boolean;
|
|
56
|
-
/** One receipt per request step, in request order. */
|
|
57
|
-
receipts: Receipt[];
|
|
58
|
-
}
|
|
59
|
-
/** A validated edit request. Validation reserves nothing and cannot be committed later. */
|
|
60
|
-
interface ValidationSuccess<Preview> {
|
|
61
|
-
ok: true;
|
|
62
|
-
baseVersion: string;
|
|
63
|
-
wouldApply: boolean;
|
|
64
|
-
previews: Preview[];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Versioned reads and version-checked edit batches over one workbook. Every shape here is plain
|
|
69
|
-
* JSON; the semantics live in Rust.
|
|
70
|
-
*
|
|
71
|
-
* Rows and columns are zero-based and ranges inclusive. Sheet ids come from the current catalog:
|
|
72
|
-
* `sheet:{index}` standalone, the replica's sheet keys in collaboration. Versions and sheet ids
|
|
73
|
-
* are session-scoped; neither survives save and reopen. Standalone ids are positional, so each is
|
|
74
|
-
* valid only for the version it was read at.
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
/** Provenance only: it neither grants permission nor selects history. */
|
|
78
|
-
type XlsxEditSource = 'host' | 'agent';
|
|
79
|
-
/**
|
|
80
|
-
* `separate`: exactly one undo step. `none`: no undo step, existing entries kept; standalone
|
|
81
|
-
* undo replays inverse operations, so undoing an older step that wrote the same cell still
|
|
82
|
-
* overwrites it.
|
|
83
|
-
*
|
|
84
|
-
* @experimental `none` only: its interaction with standalone undo may change in a minor release.
|
|
85
|
-
*/
|
|
86
|
-
type XlsxEditHistory = 'separate' | 'none';
|
|
87
|
-
interface XlsxCellPosition {
|
|
88
|
-
row: number;
|
|
89
|
-
col: number;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* An A1 cell or `A1:B2` range (`$` allowed), or zero-based corners. Sheet-qualified, union,
|
|
93
|
-
* whole-row/column and named references are refused.
|
|
94
|
-
*/
|
|
95
|
-
type XlsxRangeAddress = {
|
|
96
|
-
kind: 'a1';
|
|
97
|
-
a1: string;
|
|
98
|
-
} | {
|
|
99
|
-
kind: 'rowCol';
|
|
100
|
-
start: XlsxCellPosition;
|
|
101
|
-
end: XlsxCellPosition;
|
|
102
|
-
};
|
|
103
|
-
interface XlsxRangeTarget {
|
|
104
|
-
sheetId: string;
|
|
105
|
-
range: XlsxRangeAddress;
|
|
106
|
-
}
|
|
107
|
-
/** One cell in canonical form. */
|
|
108
|
-
interface XlsxCellAddress {
|
|
109
|
-
sheetId: string;
|
|
110
|
-
row: number;
|
|
111
|
-
col: number;
|
|
112
|
-
a1: string;
|
|
113
|
-
}
|
|
114
|
-
type XlsxErrorValue = '#DIV/0!' | '#N/A' | '#NAME?' | '#NULL!' | '#NUM!' | '#REF!' | '#VALUE!' | '#SPILL!' | '#CALC!';
|
|
115
|
-
type XlsxCellValue = {
|
|
116
|
-
kind: 'empty';
|
|
117
|
-
} | {
|
|
118
|
-
kind: 'number';
|
|
119
|
-
value: number;
|
|
120
|
-
} | {
|
|
121
|
-
kind: 'text';
|
|
122
|
-
value: string;
|
|
123
|
-
} | {
|
|
124
|
-
kind: 'bool';
|
|
125
|
-
value: boolean;
|
|
126
|
-
} | {
|
|
127
|
-
kind: 'error';
|
|
128
|
-
value: XlsxErrorValue;
|
|
129
|
-
};
|
|
130
|
-
/** Conditions on a cell's pre-batch state; an absent field imposes none. */
|
|
131
|
-
interface XlsxCellGuard {
|
|
132
|
-
/** The stored value, a formula's current result included. */
|
|
133
|
-
value?: XlsxCellValue;
|
|
134
|
-
/** Formula source without the leading `=`; `null` asserts there is no formula. */
|
|
135
|
-
formula?: string | null;
|
|
136
|
-
/** The exact text the engine formats the cell as. */
|
|
137
|
-
displayText?: string;
|
|
138
|
-
}
|
|
139
|
-
/** Matrices are row-major and exactly the target's shape. */
|
|
140
|
-
type XlsxEditOperation = {
|
|
141
|
-
/** What a user would type, parsed against each cell's current number format. */
|
|
142
|
-
op: 'setCellInputs';
|
|
143
|
-
target: XlsxRangeTarget;
|
|
144
|
-
inputs: string[][];
|
|
145
|
-
} | {
|
|
146
|
-
/** Formula source without the leading `=`, stored as a formula whatever the format. */
|
|
147
|
-
op: 'setFormulas';
|
|
148
|
-
target: XlsxRangeTarget;
|
|
149
|
-
formulas: string[][];
|
|
150
|
-
} | {
|
|
151
|
-
/** Relative mutations resolve against each cell's current format. */
|
|
152
|
-
op: 'setNumberFormat';
|
|
153
|
-
target: XlsxRangeTarget;
|
|
154
|
-
format: NumberFormatMutation;
|
|
155
|
-
} | {
|
|
156
|
-
op: 'patchStyle';
|
|
157
|
-
target: XlsxRangeTarget;
|
|
158
|
-
patch: RangeStylePatch;
|
|
159
|
-
};
|
|
160
|
-
type XlsxEditStep = XlsxEditOperation & {
|
|
161
|
-
expect?: {
|
|
162
|
-
cells: XlsxCellGuard[][];
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
/** Requests above 16 MiB and results above 64 MiB are refused with `limit-exceeded`. */
|
|
166
|
-
interface XlsxEditRequest {
|
|
167
|
-
/** The version the targets were read at; a changed workbook refuses with `stale-version`. */
|
|
168
|
-
expectVersion: string;
|
|
169
|
-
/** Defaults to `host`. */
|
|
170
|
-
source?: XlsxEditSource;
|
|
171
|
-
/** Defaults to `separate`. */
|
|
172
|
-
history?: XlsxEditHistory;
|
|
173
|
-
/** Without `nowSerial`, volatile functions such as NOW() have no clock. */
|
|
174
|
-
calculation?: {
|
|
175
|
-
nowSerial?: number;
|
|
176
|
-
};
|
|
177
|
-
steps: readonly XlsxEditStep[];
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* `locked-target` covers any write to merged-cell followers, array-formula cells and protected
|
|
181
|
-
* sheets. `read-only` comes only from an editor that does not accept edits.
|
|
182
|
-
*/
|
|
183
|
-
type XlsxEditFailureCode = 'stale-version' | 'missing-target' | 'content-mismatch' | 'overlapping-steps' | 'locked-target' | 'read-only' | 'unsupported' | 'invalid-step' | 'limit-exceeded';
|
|
184
|
-
type XlsxEditFailure = OperationFailure<XlsxEditFailureCode, XlsxRangeTarget>;
|
|
185
|
-
type XlsxEditRefusal = OperationRefusal<XlsxEditFailure>;
|
|
186
|
-
interface XlsxEditReceipt {
|
|
187
|
-
stepIndex: number;
|
|
188
|
-
changed: boolean;
|
|
189
|
-
target: XlsxRangeTarget;
|
|
190
|
-
/** Row-major. */
|
|
191
|
-
changedCells: XlsxCellAddress[];
|
|
192
|
-
}
|
|
193
|
-
/** What one step would do; it cannot be committed later. */
|
|
194
|
-
interface XlsxEditPreview {
|
|
195
|
-
stepIndex: number;
|
|
196
|
-
target: XlsxRangeTarget;
|
|
197
|
-
wouldChange: boolean;
|
|
198
|
-
changedCellCount: number;
|
|
199
|
-
}
|
|
200
|
-
interface XlsxEditCalculation {
|
|
201
|
-
/** Dependents whose value moved. */
|
|
202
|
-
changed: XlsxCellAddress[];
|
|
203
|
-
cycleCells: XlsxCellAddress[];
|
|
204
|
-
limitedCells: XlsxCellAddress[];
|
|
205
|
-
/** Whether a list stopped at 10,000 cells. */
|
|
206
|
-
truncated: boolean;
|
|
207
|
-
}
|
|
208
|
-
type XlsxEditResult = (EditSuccess<XlsxEditReceipt> & {
|
|
209
|
-
source: XlsxEditSource;
|
|
210
|
-
/** Sheets the batch or its recalculation changed, as ids in sheet order. */
|
|
211
|
-
changedSheets: string[];
|
|
212
|
-
calculation: XlsxEditCalculation;
|
|
213
|
-
}) | XlsxEditRefusal;
|
|
214
|
-
type XlsxValidationResult = ValidationSuccess<XlsxEditPreview> | XlsxEditRefusal;
|
|
215
|
-
interface XlsxReadRequest {
|
|
216
|
-
/** Empty reads only the sheet catalog. */
|
|
217
|
-
ranges: readonly XlsxRangeTarget[];
|
|
218
|
-
}
|
|
219
|
-
interface XlsxSheetEntry {
|
|
220
|
-
sheetId: string;
|
|
221
|
-
name: string;
|
|
222
|
-
/** False for sheets batches refuse to write: non-worksheets and protected worksheets. */
|
|
223
|
-
editable: boolean;
|
|
224
|
-
}
|
|
225
|
-
interface XlsxCellRead {
|
|
226
|
-
a1: string;
|
|
227
|
-
value: XlsxCellValue;
|
|
228
|
-
formula: string | null;
|
|
229
|
-
displayText: string;
|
|
230
|
-
}
|
|
231
|
-
interface XlsxRangeRead {
|
|
232
|
-
target: XlsxRangeTarget;
|
|
233
|
-
/** Row-major. */
|
|
234
|
-
cells: XlsxCellRead[][];
|
|
235
|
-
}
|
|
236
|
-
interface XlsxReadCalculation {
|
|
237
|
-
cycleCells: XlsxCellAddress[];
|
|
238
|
-
limitedCells: XlsxCellAddress[];
|
|
239
|
-
/** Whether a list stopped at 10,000 cells. */
|
|
240
|
-
truncated: boolean;
|
|
241
|
-
}
|
|
242
|
-
type XlsxReadResult = {
|
|
243
|
-
ok: true;
|
|
244
|
-
version: string;
|
|
245
|
-
sheets: XlsxSheetEntry[];
|
|
246
|
-
ranges: XlsxRangeRead[];
|
|
247
|
-
calculation: XlsxReadCalculation;
|
|
248
|
-
} | XlsxEditRefusal;
|
|
249
|
-
/** An exact, case-sensitive substring search over display text. */
|
|
250
|
-
interface XlsxFindRequest {
|
|
251
|
-
text: string;
|
|
252
|
-
/** Defaults to every sheet. */
|
|
253
|
-
sheetIds?: readonly string[];
|
|
254
|
-
/** Defaults to 100; at most 10,000. */
|
|
255
|
-
limit?: number;
|
|
256
|
-
}
|
|
257
|
-
interface XlsxFindMatch {
|
|
258
|
-
cell: XlsxCellAddress;
|
|
259
|
-
/** The cell's whole display text. */
|
|
260
|
-
text: string;
|
|
261
|
-
}
|
|
262
|
-
type XlsxFindResult = {
|
|
263
|
-
ok: true;
|
|
264
|
-
version: string;
|
|
265
|
-
matches: XlsxFindMatch[];
|
|
266
|
-
truncated: boolean;
|
|
267
|
-
} | XlsxEditRefusal;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Shapes shared by the formats' read-only structured exports. Content trees, anchors, story or
|
|
271
|
-
* sheet selectors, diagnostic codes and limits stay format-owned; these only fix how every format
|
|
272
|
-
* reports diagnostics, truncation and Markdown markers.
|
|
273
|
-
*/
|
|
274
|
-
type ExportSeverity = 'info' | 'warning' | 'error';
|
|
275
|
-
/** Something an export omitted or could not represent, anchored where it applies. */
|
|
276
|
-
interface ExportDiagnostic<Code extends string, Anchor> {
|
|
277
|
-
code: Code;
|
|
278
|
-
severity: ExportSeverity;
|
|
279
|
-
anchor: Anchor | null;
|
|
280
|
-
message: string;
|
|
281
|
-
}
|
|
282
|
-
/** Whether an export stopped at its limits before the end of the content. */
|
|
283
|
-
interface ExportCompletion {
|
|
284
|
-
truncated: boolean;
|
|
285
|
-
}
|
|
286
|
-
/** A Markdown marker comment and the anchor of the content it precedes. */
|
|
287
|
-
interface MarkdownAnchor<Anchor> {
|
|
288
|
-
marker: string;
|
|
289
|
-
anchor: Anchor;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Read-only structured export of workbook content and its Markdown projection. Every shape
|
|
294
|
-
* here is plain JSON; the walker, limits and Markdown renderer live in Rust.
|
|
295
|
-
*
|
|
296
|
-
* Export never recalculates: formula results are the stored values (`calculation.policy:
|
|
297
|
-
* 'asStored'`, `freshness: 'unverified'`). Anchors name positions by sheet id, index and name
|
|
298
|
-
* and A1 in the exported version or snapshot; none follows later row, column or sheet edits.
|
|
299
|
-
*/
|
|
300
|
-
|
|
301
|
-
/** A zero-based sheet index and at most one rectangular A1 range, defaulting to the used range. */
|
|
302
|
-
interface XlsxExportScope {
|
|
303
|
-
sheet: number;
|
|
304
|
-
range?: string;
|
|
305
|
-
}
|
|
306
|
-
/** Hidden sheets, rows, columns and names are excluded unless asked for. */
|
|
307
|
-
interface XlsxExportOptions {
|
|
308
|
-
/** Defaults to every sheet. Unions, whole rows or columns and sheet-qualified ranges refuse. */
|
|
309
|
-
scope?: readonly XlsxExportScope[];
|
|
310
|
-
includeHiddenSheets?: boolean;
|
|
311
|
-
includeHiddenRows?: boolean;
|
|
312
|
-
includeHiddenColumns?: boolean;
|
|
313
|
-
/** Defaults to `true`. */
|
|
314
|
-
includeDefinedNames?: boolean;
|
|
315
|
-
includeHiddenNames?: boolean;
|
|
316
|
-
/** Stored cells, 1 to 1,000,000; defaults to 100,000. */
|
|
317
|
-
maxCells?: number;
|
|
318
|
-
/** Compact UTF-8 JSON bytes of the content, at most 16 MiB; defaults to 8 MiB. */
|
|
319
|
-
maxBytes?: number;
|
|
320
|
-
}
|
|
321
|
-
/** Empty grid positions count toward `maxCells`. */
|
|
322
|
-
interface XlsxMarkdownOptions {
|
|
323
|
-
/** Grid rows per sheet; defaults to 200. */
|
|
324
|
-
maxRows?: number;
|
|
325
|
-
/** Grid columns per sheet; defaults to 50. */
|
|
326
|
-
maxColumns?: number;
|
|
327
|
-
/** Grid positions across all sheets; defaults to 10,000. */
|
|
328
|
-
maxCells?: number;
|
|
329
|
-
/** UTF-8 bytes of Markdown; defaults to 8 MiB. */
|
|
330
|
-
maxBytes?: number;
|
|
331
|
-
}
|
|
332
|
-
/** A sheet by the id edit batches take and, descriptively, its current position and name. */
|
|
333
|
-
interface XlsxSheetIdentity {
|
|
334
|
-
/** The exporting session's catalog id; `sheet:{index}` for bytes. */
|
|
335
|
-
sheetId: string;
|
|
336
|
-
index: number;
|
|
337
|
-
name: string;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* A `cell` or `range` anchor's `{ sheetId: sheet.sheetId, range: { kind: 'a1', a1 } }` is its
|
|
341
|
-
* `XlsxRangeTarget` at the exported version.
|
|
342
|
-
*/
|
|
343
|
-
type XlsxAnchor = {
|
|
344
|
-
kind: 'sheet';
|
|
345
|
-
sheet: XlsxSheetIdentity;
|
|
346
|
-
} | {
|
|
347
|
-
kind: 'cell';
|
|
348
|
-
sheet: XlsxSheetIdentity;
|
|
349
|
-
a1: string;
|
|
350
|
-
} | {
|
|
351
|
-
kind: 'range';
|
|
352
|
-
sheet: XlsxSheetIdentity;
|
|
353
|
-
a1: string;
|
|
354
|
-
} | {
|
|
355
|
-
kind: 'definedName';
|
|
356
|
-
name: string;
|
|
357
|
-
localSheet: XlsxSheetIdentity | null;
|
|
358
|
-
/** Position in the workbook's defined-name list. */
|
|
359
|
-
ordinal: number;
|
|
360
|
-
} | {
|
|
361
|
-
kind: 'sourcePart';
|
|
362
|
-
part: string;
|
|
363
|
-
partSha256: string;
|
|
364
|
-
path: number[];
|
|
365
|
-
};
|
|
366
|
-
/** Retained source XML: part, SHA-256 of its bytes, element-child ordinals from its root. */
|
|
367
|
-
interface XlsxSourcePart {
|
|
368
|
-
part: string;
|
|
369
|
-
partSha256: string;
|
|
370
|
-
path: number[];
|
|
371
|
-
}
|
|
372
|
-
type XlsxExportDiagnosticCode = 'hidden-content-excluded' | 'visibility-unknown' | 'unsupported-sheet' | 'unsupported-content' | 'object-placeholder' | 'unreadable-object' | 'provenance-unavailable' | 'comments-omitted' | 'rich-text-omitted' | 'formatting-approximate' | 'formula-cache-unverified' | 'formula-result-missing' | 'calculation-failure' | 'value-unavailable' | 'truncated' | 'markdown-lossy';
|
|
373
|
-
type XlsxExportDiagnostic = ExportDiagnostic<XlsxExportDiagnosticCode, XlsxAnchor>;
|
|
374
|
-
/** A cell value; `unavailable` stands for one JSON cannot carry, such as a non-finite number. */
|
|
375
|
-
type XlsxExportValue = XlsxCellValue | {
|
|
376
|
-
kind: 'unavailable';
|
|
377
|
-
reason: string;
|
|
378
|
-
};
|
|
379
|
-
/**
|
|
380
|
-
* `unverified`: a result is stored, not checked. `missing`: none is stored, and the value is the
|
|
381
|
-
* engine's placeholder. `uncertain`: presence cannot be established, as once anything has
|
|
382
|
-
* calculated since a file that stored none was read. `cycle` and `limited`: what the last
|
|
383
|
-
* calculation reported.
|
|
384
|
-
*/
|
|
385
|
-
type XlsxFormulaResult = 'unverified' | 'missing' | 'uncertain' | 'cycle' | 'limited';
|
|
386
|
-
interface XlsxExportCell {
|
|
387
|
-
id: string;
|
|
388
|
-
anchor: XlsxAnchor;
|
|
389
|
-
value: XlsxExportValue;
|
|
390
|
-
/** Without the leading `=`. */
|
|
391
|
-
formula: string | null;
|
|
392
|
-
/** The engine's formatting of the value, without column-width clipping or overflow. */
|
|
393
|
-
displayText: string;
|
|
394
|
-
numberFormat: string;
|
|
395
|
-
/** `null` for cells without a formula. */
|
|
396
|
-
formulaResult: XlsxFormulaResult | null;
|
|
397
|
-
merge: {
|
|
398
|
-
range: string;
|
|
399
|
-
origin: boolean;
|
|
400
|
-
} | null;
|
|
401
|
-
}
|
|
402
|
-
interface XlsxExportMerge {
|
|
403
|
-
id: string;
|
|
404
|
-
anchor: XlsxAnchor;
|
|
405
|
-
/** Whether the merge extends past the selected range. */
|
|
406
|
-
clipped: boolean;
|
|
407
|
-
}
|
|
408
|
-
/** A ListObject. */
|
|
409
|
-
interface XlsxExportTable {
|
|
410
|
-
id: string;
|
|
411
|
-
anchor: XlsxAnchor;
|
|
412
|
-
name: string;
|
|
413
|
-
headerRows: number;
|
|
414
|
-
totalsRows: number;
|
|
415
|
-
columns: string[];
|
|
416
|
-
clipped: boolean;
|
|
417
|
-
}
|
|
418
|
-
interface XlsxExportHyperlink {
|
|
419
|
-
id: string;
|
|
420
|
-
anchor: XlsxAnchor;
|
|
421
|
-
externalTarget: string | null;
|
|
422
|
-
location: string | null;
|
|
423
|
-
tooltip: string | null;
|
|
424
|
-
display: string | null;
|
|
425
|
-
clipped: boolean;
|
|
426
|
-
}
|
|
427
|
-
type XlsxObjectKind = 'chart' | 'picture' | 'shape' | 'group' | 'connector' | 'diagram' | 'graphicFrame' | 'contentPart' | 'unknown';
|
|
428
|
-
/** A drawing object as a placeholder: no chart data, image bytes or shape text. */
|
|
429
|
-
interface XlsxExportObject {
|
|
430
|
-
id: string;
|
|
431
|
-
kind: XlsxObjectKind;
|
|
432
|
-
/** The cells holding its corners; `null` when its grid position is unknown. */
|
|
433
|
-
anchor: XlsxAnchor | null;
|
|
434
|
-
name: string | null;
|
|
435
|
-
altText: string | null;
|
|
436
|
-
title: string | null;
|
|
437
|
-
hidden: boolean;
|
|
438
|
-
/** The chart or image part. */
|
|
439
|
-
part: string | null;
|
|
440
|
-
source: XlsxSourcePart | null;
|
|
441
|
-
}
|
|
442
|
-
interface XlsxExportDefinedName {
|
|
443
|
-
id: string;
|
|
444
|
-
anchor: XlsxAnchor;
|
|
445
|
-
name: string;
|
|
446
|
-
formula: string;
|
|
447
|
-
hidden: boolean;
|
|
448
|
-
localSheet: XlsxSheetIdentity | null;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* One sheet. `truncated` means export stopped inside it: its lists are complete in the order
|
|
452
|
-
* hidden spans, merges, tables, hyperlinks, objects, cells, up to where it stopped.
|
|
453
|
-
*/
|
|
454
|
-
interface XlsxExportSheet extends ExportCompletion {
|
|
455
|
-
id: string;
|
|
456
|
-
anchor: XlsxAnchor;
|
|
457
|
-
kind: 'worksheet' | 'chartsheet' | 'dialogsheet' | 'macrosheet' | 'other';
|
|
458
|
-
visibility: 'visible' | 'hidden' | 'veryHidden' | 'unknown';
|
|
459
|
-
/** Stored cells and hyperlinks; drawings, merges and tables do not extend it. */
|
|
460
|
-
usedRange: string | null;
|
|
461
|
-
selectedRange: string | null;
|
|
462
|
-
/** Hidden row spans such as `"5:7"` inside the selected range, exported or not. */
|
|
463
|
-
hiddenRows: string[];
|
|
464
|
-
/** Hidden column spans such as `"C:D"` inside the selected range, exported or not. */
|
|
465
|
-
hiddenColumns: string[];
|
|
466
|
-
merges: XlsxExportMerge[];
|
|
467
|
-
tables: XlsxExportTable[];
|
|
468
|
-
hyperlinks: XlsxExportHyperlink[];
|
|
469
|
-
objects: XlsxExportObject[];
|
|
470
|
-
/** Stored cells in row-major order, styled empty cells included. */
|
|
471
|
-
cells: XlsxExportCell[];
|
|
472
|
-
source: XlsxSourcePart | null;
|
|
473
|
-
}
|
|
474
|
-
interface XlsxStructuredContent extends ExportCompletion {
|
|
475
|
-
schemaVersion: 1;
|
|
476
|
-
/** `session` for a live export, `snapshot` for bytes. */
|
|
477
|
-
anchorScope: 'session' | 'snapshot';
|
|
478
|
-
dateSystem: '1900' | '1904';
|
|
479
|
-
calculation: {
|
|
480
|
-
policy: 'asStored';
|
|
481
|
-
freshness: 'unverified';
|
|
482
|
-
};
|
|
483
|
-
included: {
|
|
484
|
-
hiddenSheets: boolean;
|
|
485
|
-
hiddenRows: boolean;
|
|
486
|
-
hiddenColumns: boolean;
|
|
487
|
-
definedNames: boolean;
|
|
488
|
-
hiddenNames: boolean;
|
|
489
|
-
};
|
|
490
|
-
sheets: XlsxExportSheet[];
|
|
491
|
-
definedNames: XlsxExportDefinedName[];
|
|
492
|
-
diagnostics: XlsxExportDiagnostic[];
|
|
493
|
-
}
|
|
494
|
-
interface XlsxMarkdownContent extends ExportCompletion {
|
|
495
|
-
markdown: string;
|
|
496
|
-
/** One per `<!-- xlsx-export:N -->` marker, in order. */
|
|
497
|
-
anchors: MarkdownAnchor<XlsxAnchor>[];
|
|
498
|
-
/** The structured export's diagnostics, then what Markdown lost. */
|
|
499
|
-
diagnostics: XlsxExportDiagnostic[];
|
|
500
|
-
}
|
|
501
|
-
type XlsxExportFailureCode = 'invalid-options' | 'invalid-scope' | 'limit-exceeded';
|
|
502
|
-
interface XlsxExportFailure {
|
|
503
|
-
code: XlsxExportFailureCode;
|
|
504
|
-
/** The sheet a scope failure names, else `null`. */
|
|
505
|
-
target: XlsxAnchor | null;
|
|
506
|
-
message: string;
|
|
507
|
-
}
|
|
508
|
-
type XlsxExportResult<T> = {
|
|
509
|
-
ok: true;
|
|
510
|
-
version: string;
|
|
511
|
-
content: T;
|
|
512
|
-
} | OperationRefusal<XlsxExportFailure>;
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Wasm loader for the xlsx-wasm core.
|
|
516
|
-
*
|
|
517
|
-
* Call {@link initWasm} once before opening workbooks. The default browser path
|
|
518
|
-
* streams the packaged wasm asset; non-fetch environments can pass bytes or a
|
|
519
|
-
* precompiled module. Callers never see the JSON-string boundary.
|
|
520
|
-
*/
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* A scrolled window into a sheet. `x`/`y` are content-pixel offsets into the
|
|
524
|
-
* non-frozen body. Mirrors the Rust `Viewport`.
|
|
525
|
-
*/
|
|
526
|
-
interface Viewport {
|
|
527
|
-
x: number;
|
|
528
|
-
y: number;
|
|
529
|
-
width: number;
|
|
530
|
-
height: number;
|
|
531
|
-
}
|
|
532
|
-
interface PrintMetrics {
|
|
533
|
-
dpi: number;
|
|
534
|
-
maxDigitWidth: number;
|
|
535
|
-
defaultRowHeightPt: number;
|
|
536
|
-
defaultColumnWidth?: number;
|
|
537
|
-
fontSizePt: number;
|
|
538
|
-
fontFamily: string;
|
|
539
|
-
fontAscent: number;
|
|
540
|
-
fontDescent: number;
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Chrome-facing sheet metadata: stable IDs, tab names, active index, and the
|
|
544
|
-
* scrollable content extent of the active sheet. Mirrors the Rust `SheetInfo`.
|
|
545
|
-
*/
|
|
546
|
-
interface SheetInfo {
|
|
547
|
-
sheetIds: string[];
|
|
548
|
-
sheetNames: string[];
|
|
549
|
-
activeSheet: number;
|
|
550
|
-
contentWidth: number;
|
|
551
|
-
contentHeight: number;
|
|
552
|
-
frozenRows: number;
|
|
553
|
-
frozenCols: number;
|
|
554
|
-
initialScrollX: number;
|
|
555
|
-
initialScrollY: number;
|
|
556
|
-
}
|
|
557
|
-
interface CellPosition {
|
|
558
|
-
x: number;
|
|
559
|
-
y: number;
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Result of any mutating call: whether it changed the workbook and the
|
|
563
|
-
* (possibly grown) sheet metadata. Mirrors the Rust `EditResult`.
|
|
564
|
-
*
|
|
565
|
-
* `changed` lists the a1 addresses (on the active sheet) of *other* cells whose
|
|
566
|
-
* displayed value moved as a fallout of the edit — the dependents the recalc
|
|
567
|
-
* pass recomputed. It excludes the directly edited cell(s) and is omitted by
|
|
568
|
-
* cores built before the recalc engine, so treat it as additive.
|
|
569
|
-
*/
|
|
570
|
-
interface EditResult {
|
|
571
|
-
applied: boolean;
|
|
572
|
-
sheetInfo: SheetInfo;
|
|
573
|
-
changed?: string[];
|
|
574
|
-
limitedCells?: string[];
|
|
575
|
-
}
|
|
576
|
-
/** Facade stage latencies of one profiled mutation, in ms. */
|
|
577
|
-
interface EditProfile {
|
|
578
|
-
validateMs: number;
|
|
579
|
-
applyMs: number;
|
|
580
|
-
recalcMs: number;
|
|
581
|
-
resultMs: number;
|
|
582
|
-
}
|
|
583
|
-
interface ProfiledEditResult extends EditResult {
|
|
584
|
-
profile: EditProfile;
|
|
585
|
-
}
|
|
586
|
-
interface DisplayListProfile {
|
|
587
|
-
buildMs: number;
|
|
588
|
-
encodeMs: number;
|
|
589
|
-
}
|
|
590
|
-
interface ProfiledDisplayList {
|
|
591
|
-
displayList: DisplayList;
|
|
592
|
-
profile: DisplayListProfile;
|
|
593
|
-
}
|
|
594
|
-
interface CalculationStatus {
|
|
595
|
-
limitedCells: string[];
|
|
596
|
-
}
|
|
597
|
-
type NumberFormat = 'automatic' | 'plainText' | 'number' | 'percent' | 'scientific' | 'currency' | 'date' | 'time' | 'custom';
|
|
598
|
-
type BorderPreset = 'all' | 'inner' | 'horizontal' | 'vertical' | 'outer' | 'left' | 'top' | 'right' | 'bottom' | 'none';
|
|
599
|
-
type BorderStyle = 'solid' | 'dashed' | 'dotted' | 'double';
|
|
600
|
-
type HorizontalAlignment = 'left' | 'center' | 'right';
|
|
601
|
-
type VerticalAlignment = 'top' | 'middle' | 'bottom';
|
|
602
|
-
type TextWrapping = 'overflow' | 'wrap' | 'clip';
|
|
603
|
-
type StyleProperty = 'bold' | 'italic' | 'strikethrough' | 'fontFamily' | 'fontSize' | 'textColor' | 'fillColor' | 'borders' | 'horizontalAlignment' | 'verticalAlignment' | 'textWrapping';
|
|
604
|
-
interface BorderPatch {
|
|
605
|
-
preset?: BorderPreset;
|
|
606
|
-
style?: BorderStyle;
|
|
607
|
-
color?: string;
|
|
608
|
-
}
|
|
609
|
-
interface RangeStylePatch {
|
|
610
|
-
bold?: boolean;
|
|
611
|
-
italic?: boolean;
|
|
612
|
-
strikethrough?: boolean;
|
|
613
|
-
fontFamily?: string;
|
|
614
|
-
fontSize?: number;
|
|
615
|
-
textColor?: string;
|
|
616
|
-
fillColor?: string;
|
|
617
|
-
border?: BorderPatch;
|
|
618
|
-
horizontalAlignment?: HorizontalAlignment;
|
|
619
|
-
verticalAlignment?: VerticalAlignment;
|
|
620
|
-
textWrapping?: TextWrapping;
|
|
621
|
-
clear?: StyleProperty[];
|
|
622
|
-
}
|
|
623
|
-
type NumberFormatMutation = Exclude<NumberFormat, 'custom'> | 'increaseDecimal' | 'decreaseDecimal' | {
|
|
624
|
-
type: 'custom';
|
|
625
|
-
pattern: string;
|
|
626
|
-
};
|
|
627
|
-
interface SelectionFormatting {
|
|
628
|
-
numberFormat?: NumberFormat;
|
|
629
|
-
numberFormatPattern?: string;
|
|
630
|
-
fontFamily?: string;
|
|
631
|
-
fontSize?: number;
|
|
632
|
-
bold?: boolean;
|
|
633
|
-
italic?: boolean;
|
|
634
|
-
strikethrough?: boolean;
|
|
635
|
-
textColor?: string;
|
|
636
|
-
fillColor?: string;
|
|
637
|
-
borderPreset?: BorderPreset;
|
|
638
|
-
borderStyle?: BorderStyle;
|
|
639
|
-
borderColor?: string;
|
|
640
|
-
horizontalAlignment?: HorizontalAlignment;
|
|
641
|
-
verticalAlignment?: VerticalAlignment;
|
|
642
|
-
textWrapping?: TextWrapping;
|
|
643
|
-
}
|
|
644
|
-
interface CapturedFormat {
|
|
645
|
-
rows: number;
|
|
646
|
-
columns: number;
|
|
647
|
-
formats: unknown[];
|
|
648
|
-
}
|
|
649
|
-
interface CellPoint {
|
|
650
|
-
row: number;
|
|
651
|
-
col: number;
|
|
652
|
-
}
|
|
653
|
-
interface MergedRange {
|
|
654
|
-
start: CellPoint;
|
|
655
|
-
end: CellPoint;
|
|
656
|
-
}
|
|
657
|
-
interface HistoryState {
|
|
658
|
-
canUndo: boolean;
|
|
659
|
-
canRedo: boolean;
|
|
660
|
-
undoDepth: number;
|
|
661
|
-
redoDepth: number;
|
|
662
|
-
}
|
|
663
|
-
type WorkbookUpdateOrigin = CollaborationUpdateOrigin;
|
|
664
|
-
type WorkbookUpdateListener = (update: Uint8Array, origin: WorkbookUpdateOrigin) => void;
|
|
665
|
-
interface OpenWorkbookOptions {
|
|
666
|
-
/** Open a Yrs-backed replica that can accept peer updates. */
|
|
667
|
-
collaborative?: boolean;
|
|
668
|
-
/** Peer-unique positive safe integer. Generated securely when omitted. */
|
|
669
|
-
clientId?: number;
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* The editable view of one cell: A1 address, the exact string the user would
|
|
673
|
-
* edit (formulas as `=...`, guarded literals with a leading `'`), and whether
|
|
674
|
-
* that string is a formula. Mirrors the Rust `CellEdit`.
|
|
675
|
-
*/
|
|
676
|
-
interface CellEdit {
|
|
677
|
-
a1: string;
|
|
678
|
-
input: string;
|
|
679
|
-
isFormula: boolean;
|
|
680
|
-
}
|
|
681
|
-
interface XlsxTextSearchOptions {
|
|
682
|
-
/** Defaults to false. */
|
|
683
|
-
caseSensitive?: boolean;
|
|
684
|
-
/** Maximum matches; defaults to 1000. */
|
|
685
|
-
limit?: number;
|
|
686
|
-
}
|
|
687
|
-
/** Zero-based sheet, row, and column. */
|
|
688
|
-
interface XlsxTextMatch {
|
|
689
|
-
sheet: number;
|
|
690
|
-
sheetId: string;
|
|
691
|
-
sheetName: string;
|
|
692
|
-
row: number;
|
|
693
|
-
col: number;
|
|
694
|
-
a1: string;
|
|
695
|
-
/** Formatted display text. */
|
|
696
|
-
text: string;
|
|
697
|
-
}
|
|
698
|
-
/** One cell of a batch edit: target coordinates plus the raw user input. */
|
|
699
|
-
interface CellInputEdit {
|
|
700
|
-
row: number;
|
|
701
|
-
col: number;
|
|
702
|
-
input: string;
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
|
-
* One edit inside a proposal. Same shape as {@link CellInputEdit} plus the
|
|
706
|
-
* sheet index — a proposal's cells carry their own sheet on the wire, so it
|
|
707
|
-
* can span sheets rather than being pinned to the active one.
|
|
708
|
-
*/
|
|
709
|
-
interface ProposalEdit extends CellInputEdit {
|
|
710
|
-
sheet: number;
|
|
711
|
-
numberFormat?: NumberFormatMutation;
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* One cell of a pending proposal: where it lands and the *formatted display
|
|
715
|
-
* texts* before/after applying it. `oldText`/`newText` are what the grid shows,
|
|
716
|
-
* not the raw input — the ghost decoration paints `newText` directly. Mirrors
|
|
717
|
-
* the Rust proposal cell.
|
|
718
|
-
*/
|
|
719
|
-
interface ProposalCell {
|
|
720
|
-
sheet: number;
|
|
721
|
-
row: number;
|
|
722
|
-
col: number;
|
|
723
|
-
a1: string;
|
|
724
|
-
oldText: string;
|
|
725
|
-
newText: string;
|
|
726
|
-
}
|
|
727
|
-
/**
|
|
728
|
-
* A pending, un-applied set of cell changes an agent has staged for human
|
|
729
|
-
* review. `note` is the agent's rationale (may be null); `cells` are the
|
|
730
|
-
* per-cell before/after previews. Applying it is one undo step.
|
|
731
|
-
*/
|
|
732
|
-
interface Proposal {
|
|
733
|
-
id: string;
|
|
734
|
-
agentId: string;
|
|
735
|
-
note: string | null;
|
|
736
|
-
cells: ProposalCell[];
|
|
737
|
-
}
|
|
738
|
-
/** A drifted proposal cell: its sheet index and catalog id beside the coordinates. */
|
|
739
|
-
interface StaleProposalTarget extends XlsxCellAddress {
|
|
740
|
-
sheet: number;
|
|
741
|
-
}
|
|
742
|
-
/**
|
|
743
|
-
* Thrown by {@link WorkbookHandle.acceptProposal} when the workbook changed
|
|
744
|
-
* under a proposal since it was staged (an edit touched one of its base cells)
|
|
745
|
-
* and `force` was not set. `cells` are the a1 addresses that moved, so the UI
|
|
746
|
-
* can name them and offer a force-apply; `targets` also carry each one's sheet.
|
|
747
|
-
*/
|
|
748
|
-
declare class StaleProposalError extends Error {
|
|
749
|
-
readonly cells: string[];
|
|
750
|
-
readonly targets: StaleProposalTarget[];
|
|
751
|
-
constructor(cells: string[], targets?: StaleProposalTarget[]);
|
|
752
|
-
}
|
|
753
|
-
/**
|
|
754
|
-
* A typed handle over an open workbook, hiding the wasm object and its JSON
|
|
755
|
-
* boundary. Call {@link WorkbookHandle.dispose} to free the wasm memory.
|
|
756
|
-
*/
|
|
757
|
-
interface WorkbookHandle extends CollaborationReplica {
|
|
758
|
-
readonly clientId: number;
|
|
759
|
-
/** Available in both modes; encodes this handle's current Yrs state vector. */
|
|
760
|
-
encodeStateVector(): Uint8Array;
|
|
761
|
-
/** Available in both modes; pass a peer vector to encode only the missing state. */
|
|
762
|
-
encodeStateAsUpdate(remoteStateVector?: Uint8Array): Uint8Array;
|
|
763
|
-
/** Apply a peer update. Standalone handles throw the Rust `NotCollaborative` error. */
|
|
764
|
-
applyUpdate(update: Uint8Array): EditResult;
|
|
765
|
-
/** Observe owned update bytes from local commits and accepted remote updates. */
|
|
766
|
-
onUpdate(listener: WorkbookUpdateListener): () => void;
|
|
767
|
-
sheetInfo(): SheetInfo;
|
|
768
|
-
calculationStatus(): CalculationStatus;
|
|
769
|
-
displayList(viewport: Viewport): DisplayList;
|
|
770
|
-
/** `displayList` with build and encode time measured inside the core. */
|
|
771
|
-
displayListProfiled(viewport: Viewport): ProfiledDisplayList;
|
|
772
|
-
printDisplayList(sheet: number, range: string, metrics: PrintMetrics, gridlines: boolean): DisplayList;
|
|
773
|
-
/**
|
|
774
|
-
* the chart under a viewport-local point on the active sheet, or `null`,
|
|
775
|
-
* resolved against the current model from the same anchor geometry the
|
|
776
|
-
* display list is built from. the returned `label` is always empty: a hit
|
|
777
|
-
* test resolves anchors only and never reads a chart part.
|
|
778
|
-
*
|
|
779
|
-
* this answers for the model as it is now. chrome painting a frame should
|
|
780
|
-
* hit-test that frame's own `charts` with `chartRegionAtPoint` instead, or a
|
|
781
|
-
* mutation the canvas has not drawn yet will move the answer off the pixels.
|
|
782
|
-
*/
|
|
783
|
-
chartAtPoint(viewport: Viewport, x: number, y: number): ChartRegion | null;
|
|
784
|
-
/**
|
|
785
|
-
* slide the chart frame `chart` names — a {@link ChartRegion} id — by a
|
|
786
|
-
* content-pixel delta, clamped to the grid, as one undo step. the new anchor
|
|
787
|
-
* is written back on save. throws for a chart pinned to the sheet by an
|
|
788
|
-
* absolute anchor.
|
|
789
|
-
*/
|
|
790
|
-
moveChart(sheet: number, chart: string, dx: number, dy: number): EditResult;
|
|
791
|
-
setActiveSheet(index: number): void;
|
|
792
|
-
/**
|
|
793
|
-
* apply one user input to a cell (parses number/bool/formula/text) and
|
|
794
|
-
* recalc its transitive dependents. one undo step; moved dependents come back
|
|
795
|
-
* in `EditResult.changed`.
|
|
796
|
-
*/
|
|
797
|
-
editCell(sheet: number, row: number, col: number, input: string): EditResult;
|
|
798
|
-
/** `editCell` with the facade's stage timings attached. */
|
|
799
|
-
editCellProfiled(sheet: number, row: number, col: number, input: string): ProfiledEditResult;
|
|
800
|
-
/** apply a batch of inputs (paste path) as one undo step; dependents recalc. */
|
|
801
|
-
editCells(sheet: number, edits: CellInputEdit[]): EditResult;
|
|
802
|
-
/** raw op-list escape hatch for structural ops (insert/delete rows, merges…). */
|
|
803
|
-
applyOps(ops: unknown[]): EditResult;
|
|
804
|
-
/** `applyOps` with the facade's stage timings attached. */
|
|
805
|
-
applyOpsProfiled(ops: unknown[]): ProfiledEditResult;
|
|
806
|
-
undo(): EditResult;
|
|
807
|
-
redo(): EditResult;
|
|
808
|
-
/** the editable view of one cell (formula bar / in-cell editor prefill). */
|
|
809
|
-
cell(sheet: number, row: number, col: number): CellEdit;
|
|
810
|
-
/** Searches formatted text in sheet and row order. */
|
|
811
|
-
searchText(query: string, options?: XlsxTextSearchOptions): XlsxTextMatch[];
|
|
812
|
-
cellPosition(sheet: number, row: number, col: number): CellPosition;
|
|
813
|
-
/** row-major editable views for a range, e.g. "A1:C3" (clipboard copy). */
|
|
814
|
-
rangeCells(sheet: number, range: string): CellEdit[][];
|
|
815
|
-
patchRangeStyle(sheet: number, range: string, patch: RangeStylePatch): EditResult;
|
|
816
|
-
setNumberFormat(sheet: number, range: string, format: NumberFormatMutation): EditResult;
|
|
817
|
-
selectionFormatting(sheet: number, range: string): SelectionFormatting;
|
|
818
|
-
captureFormat(sheet: number, range: string): CapturedFormat;
|
|
819
|
-
applyFormat(sheet: number, range: string, format: CapturedFormat): EditResult;
|
|
820
|
-
mergedRanges(sheet: number, range: string): MergedRange[];
|
|
821
|
-
historyState(): HistoryState;
|
|
822
|
-
/**
|
|
823
|
-
* render the current sheet viewport to png bytes via the native raster
|
|
824
|
-
* backend — the same display list the canvas paints, rasterized server-side.
|
|
825
|
-
* throws if the embedded wasm was built without png export (the `raster`
|
|
826
|
-
* cargo feature); guard with {@link isPngExportAvailable}.
|
|
827
|
-
*/
|
|
828
|
-
renderPng(viewport: Viewport): Uint8Array;
|
|
829
|
-
/**
|
|
830
|
-
* render an a1 range (default: the used range) at an optional scale to png.
|
|
831
|
-
* dimensions are capped wasm-side; same availability guard as renderPng.
|
|
832
|
-
*/
|
|
833
|
-
renderRangePng(opts?: {
|
|
834
|
-
range?: string;
|
|
835
|
-
scale?: number;
|
|
836
|
-
}): Uint8Array;
|
|
837
|
-
/** serialize the workbook back to .xlsx bytes. */
|
|
838
|
-
save(): Uint8Array;
|
|
839
|
-
/**
|
|
840
|
-
* stage an agent's proposed edits for human review without applying them.
|
|
841
|
-
* returns the {@link Proposal} with per-cell formatted before/after previews.
|
|
842
|
-
* throws if the embedded wasm predates proposals; guard with
|
|
843
|
-
* {@link WorkbookHandle.isProposalsAvailable}.
|
|
844
|
-
*/
|
|
845
|
-
propose(agentId: string, note: string | null, edits: ProposalEdit[]): Proposal;
|
|
846
|
-
/** every pending proposal, oldest first. empty when none or unsupported. */
|
|
847
|
-
listProposals(): Proposal[];
|
|
848
|
-
/**
|
|
849
|
-
* apply a pending proposal as one undo step and recalc dependents. throws
|
|
850
|
-
* {@link StaleProposalError} when the base changed since it was staged and
|
|
851
|
-
* `force` is not set; pass `{ force: true }` to apply anyway.
|
|
852
|
-
*/
|
|
853
|
-
acceptProposal(id: string, opts?: {
|
|
854
|
-
force?: boolean;
|
|
855
|
-
}): EditResult & {
|
|
856
|
-
proposalId: string;
|
|
857
|
-
};
|
|
858
|
-
/** drop a pending proposal without applying it; false when the id was unknown. */
|
|
859
|
-
rejectProposal(id: string): boolean;
|
|
860
|
-
/** whether the embedded wasm core was built with the proposals api. */
|
|
861
|
-
isProposalsAvailable(): boolean;
|
|
862
|
-
/**
|
|
863
|
-
* The session-scoped version of the committed workbook. Committed edits, peer updates, undo,
|
|
864
|
-
* redo and a recalculation that changes values or what an export reports about results move
|
|
865
|
-
* it; selection, the active sheet and proposals do not.
|
|
866
|
-
*/
|
|
867
|
-
version(): string;
|
|
868
|
-
/** Cells with the version they were read at; empty `ranges` reads the sheet catalog. */
|
|
869
|
-
readCells(request: XlsxReadRequest): XlsxReadResult;
|
|
870
|
-
/** Exact, case-sensitive search over display text, one match per cell. */
|
|
871
|
-
findText(request: XlsxFindRequest): XlsxFindResult;
|
|
872
|
-
/** Resolves, stages and rehearses a batch like `applyEdits`, changing nothing. */
|
|
873
|
-
validateEdits(request: XlsxEditRequest): XlsxValidationResult;
|
|
874
|
-
/**
|
|
875
|
-
* Applies every step as one committed, recalculated change, or refuses with nothing changed.
|
|
876
|
-
* Update listeners run once, after the call returns. Malformed requests throw.
|
|
877
|
-
*/
|
|
878
|
-
applyEdits(request: XlsxEditRequest): XlsxEditResult;
|
|
879
|
-
/**
|
|
880
|
-
* Exports the committed workbook with the version it was read at: sparse cells with values,
|
|
881
|
-
* formulas and display text, plus sheet metadata and diagnostics. Nothing is recalculated,
|
|
882
|
-
* flushed or published. Options it cannot honor refuse; malformed ones throw.
|
|
883
|
-
*/
|
|
884
|
-
exportStructured(options?: XlsxExportOptions): XlsxExportResult<XlsxStructuredContent>;
|
|
885
|
-
/** {@link WorkbookHandle.exportStructured} rendered as Markdown from the same read. */
|
|
886
|
-
exportMarkdown(options?: XlsxExportOptions, markdownOptions?: XlsxMarkdownOptions): XlsxExportResult<XlsxMarkdownContent>;
|
|
887
|
-
dispose(): void;
|
|
888
|
-
}
|
|
889
|
-
type WasmInitInput = InitInput | Promise<InitInput>;
|
|
890
|
-
/** Initialize the workbook engine. Concurrent calls share the same attempt. */
|
|
891
|
-
declare function initWasm(input?: WasmInitInput): Promise<void>;
|
|
892
|
-
/**
|
|
893
|
-
* Whether this environment exposes the WebAssembly runtime required by the core.
|
|
894
|
-
*/
|
|
895
|
-
declare function isWasmAvailable(): boolean;
|
|
896
|
-
/**
|
|
897
|
-
* Whether the embedded wasm core was built with png export (the `raster` cargo
|
|
898
|
-
* feature). The wasm-bindgen method only exists on the class when compiled in,
|
|
899
|
-
* so chrome can disable an export control instead of calling and catching.
|
|
900
|
-
*/
|
|
901
|
-
declare function isPngExportAvailable(): boolean;
|
|
902
|
-
/**
|
|
903
|
-
* Whether the embedded wasm core exposes the proposals api (propose / accept /
|
|
904
|
-
* reject / list). The methods only exist on the class when compiled in, so the
|
|
905
|
-
* UI can hide proposal chrome and degrade gracefully against an older module.
|
|
906
|
-
*/
|
|
907
|
-
declare function isProposalsAvailable(): boolean;
|
|
908
|
-
/**
|
|
909
|
-
* Open a workbook from raw `.xlsx` bytes, initializing the core if needed.
|
|
910
|
-
* Throws an `Error` if the bytes are not a readable workbook.
|
|
911
|
-
*/
|
|
912
|
-
declare function openWorkbook(bytes: Uint8Array, options?: OpenWorkbookOptions): WorkbookHandle;
|
|
913
|
-
/**
|
|
914
|
-
* Exports `.xlsx` bytes as read, initializing the core if needed. Formula results are the
|
|
915
|
-
* stored ones: nothing is recalculated and no clock is read, so the same bytes and options
|
|
916
|
-
* always give the same content. Unreadable bytes and unusable options reject.
|
|
917
|
-
*/
|
|
918
|
-
declare function exportXlsxStructured(bytes: Uint8Array, options?: XlsxExportOptions): Promise<XlsxStructuredContent>;
|
|
919
|
-
/** {@link exportXlsxStructured} rendered as Markdown. */
|
|
920
|
-
declare function exportXlsxMarkdown(bytes: Uint8Array, options?: XlsxExportOptions, markdownOptions?: XlsxMarkdownOptions): Promise<XlsxMarkdownContent>;
|
|
921
|
-
/** Renders structured content as Markdown; content that does not validate rejects. */
|
|
922
|
-
declare function renderXlsxMarkdown(content: XlsxStructuredContent, options?: XlsxMarkdownOptions): Promise<XlsxMarkdownContent>;
|
|
923
|
-
/**
|
|
924
|
-
* The crate version string, for asserting wasm/js parity.
|
|
925
|
-
*/
|
|
926
|
-
declare function wasmVersion(): string;
|
|
927
|
-
|
|
928
|
-
export { type BorderPatch, type BorderPreset, type BorderStyle, type CalculationStatus, type CapturedFormat, type CellEdit, type CellInputEdit, type CellPoint, type CellPosition, ChartRegion, DisplayList, type DisplayListProfile, type EditProfile, type EditResult, type EditSuccess, type ExportCompletion, type ExportDiagnostic, type ExportSeverity, type HistoryState, type HorizontalAlignment, type MarkdownAnchor, type MergedRange, type NumberFormat, type NumberFormatMutation, type OpenWorkbookOptions, type OperationFailure, type OperationRefusal, type PrintMetrics, type ProfiledDisplayList, type ProfiledEditResult, type Proposal, type ProposalCell, type ProposalEdit, type RangeStylePatch, type SelectionFormatting, type SheetInfo, StaleProposalError, type StaleProposalTarget, type StyleProperty, type TextWrapping, type ValidationSuccess, type VerticalAlignment, type Viewport, type WasmInitInput, type WorkbookHandle, type WorkbookUpdateListener, type WorkbookUpdateOrigin, type XlsxAnchor, type XlsxCellAddress, type XlsxCellGuard, type XlsxCellPosition, type XlsxCellRead, type XlsxCellValue, type XlsxEditCalculation, type XlsxEditFailure, type XlsxEditFailureCode, type XlsxEditHistory, type XlsxEditOperation, type XlsxEditPreview, type XlsxEditReceipt, type XlsxEditRefusal, type XlsxEditRequest, type XlsxEditResult, type XlsxEditSource, type XlsxEditStep, type XlsxErrorValue, type XlsxExportCell, type XlsxExportDefinedName, type XlsxExportDiagnostic, type XlsxExportDiagnosticCode, type XlsxExportFailure, type XlsxExportFailureCode, type XlsxExportHyperlink, type XlsxExportMerge, type XlsxExportObject, type XlsxExportOptions, type XlsxExportResult, type XlsxExportScope, type XlsxExportSheet, type XlsxExportTable, type XlsxExportValue, type XlsxFindMatch, type XlsxFindRequest, type XlsxFindResult, type XlsxFormulaResult, type XlsxMarkdownContent, type XlsxMarkdownOptions, type XlsxObjectKind, type XlsxRangeAddress, type XlsxRangeRead, type XlsxRangeTarget, type XlsxReadCalculation, type XlsxReadRequest, type XlsxReadResult, type XlsxSheetEntry, type XlsxSheetIdentity, type XlsxSourcePart, type XlsxStructuredContent, type XlsxTextMatch, type XlsxTextSearchOptions, type XlsxValidationResult, exportXlsxMarkdown, exportXlsxStructured, initWasm, isPngExportAvailable, isProposalsAvailable, isWasmAvailable, openWorkbook, paintDisplayList, renderXlsxMarkdown, wasmVersion };
|
|
26
|
+
export { DisplayList, paintDisplayList };
|