@betteroffice/xlsx 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSES/MIT-ruzstd.txt +21 -0
  2. package/LICENSES/MIT-twox-hash.txt +21 -0
  3. package/LICENSES/MIT-wuff.txt +20 -0
  4. package/README.md +45 -10
  5. package/dist/chunk-3HDY7PGX.js +1 -0
  6. package/dist/chunk-4YUSZI3G.js +2 -0
  7. package/dist/chunk-6OSHYRMV.js +1 -0
  8. package/dist/chunk-AZDGFDN2.js +1 -0
  9. package/dist/chunk-B5K4E4KI.js +1 -0
  10. package/dist/chunk-E4HKBJOP.js +7 -0
  11. package/dist/chunk-FEO7P5TH.js +1 -0
  12. package/dist/chunk-GHET7GIK.js +1 -0
  13. package/dist/chunk-JABP2QRG.js +1 -0
  14. package/dist/chunk-K2GIAESV.js +2 -0
  15. package/dist/chunk-KNQOCV7P.js +1 -0
  16. package/dist/chunk-OUNTNO7R.js +1 -0
  17. package/dist/chunk-QUHWI3QK.js +1 -0
  18. package/dist/chunk-S6UYP4BX.js +1 -0
  19. package/dist/chunk-T4GUPT57.js +1 -0
  20. package/dist/chunk-VJDPZ75R.js +1 -0
  21. package/dist/chunk-X5HR6GJB.js +4 -0
  22. package/dist/collaboration.js +1 -1
  23. package/dist/{editPeer-DN6JDr8Z.d.ts → editPeer-CVhOkqsr.d.ts} +732 -365
  24. package/dist/generated/preflight/xlsx_preflight_bg.wasm +0 -0
  25. package/dist/generated/xlsx_wasm_bg.wasm +0 -0
  26. package/dist/generated/xlsx_wasm_lean_bg.wasm +0 -0
  27. package/dist/headless.d.ts +8 -2
  28. package/dist/headless.js +1 -1
  29. package/dist/index.d.ts +27 -5
  30. package/dist/index.js +1 -4
  31. package/dist/sessionWorker.missing.d.ts +3 -0
  32. package/dist/sessionWorker.missing.js +1 -0
  33. package/dist/sessionWorker.node.d.ts +3 -0
  34. package/dist/sessionWorker.node.js +1 -0
  35. package/dist/{types-DdoEoFSX.d.ts → types-BXjmeL2E.d.ts} +71 -3
  36. package/dist/wasm-preflight.d.ts +26 -0
  37. package/dist/wasm-preflight.js +1 -0
  38. package/dist/worker.d.ts +3 -3
  39. package/dist/worker.js +1 -1
  40. package/dist/xlsxSessionWorker.mjs +7 -1
  41. package/dist/xlsxSessionWorker.node.mjs +1 -0
  42. package/dist/xlsxWorkerStart.d.ts +11 -0
  43. package/dist/xlsxWorkerStart.js +1 -0
  44. package/package.json +20 -6
  45. package/dist/chunk-DIDVDN7H.js +0 -1
  46. package/dist/chunk-HJJEOLPD.js +0 -1
  47. package/dist/chunk-JGTBRHCP.js +0 -1
  48. package/dist/chunk-K7TMSGNA.js +0 -1
  49. package/dist/chunk-SXM2HKJL.js +0 -4
  50. /package/dist/{xlsxSessionWorker.d.ts → xlsxSessionWorker.node.d.ts} +0 -0
@@ -1,25 +1,6 @@
1
- import { i as PatternType, D as DisplayList, c as ChartRegion, R as Rect, d as Direction, k as SelectionData } from './types-DdoEoFSX.js';
1
+ import { j as PatternType, D as DisplayList, c as ChartRegion, R as Rect, d as Direction, l as SelectionData } from './types-BXjmeL2E.js';
2
2
  import { C as CollaborationReplica, u as CollaborationUpdateOrigin, P as PipeCommandPayload, g as AwarenessCursor, m as AsyncReplicaAdapter } from './asyncReplica-DuZEFXjI.js';
3
3
 
4
- /** Format-owned, structured-cloneable methods. */
5
- type SessionMethods = Record<string, (...args: any[]) => unknown>;
6
- type Promisified<M extends SessionMethods> = {
7
- [K in keyof M]: (...args: Parameters<M[K]>) => Promise<Awaited<ReturnType<M[K]>>>;
8
- };
9
- interface SessionState {
10
- format: string;
11
- stage: 'preview' | 'ready';
12
- version: number;
13
- dirty: boolean;
14
- }
15
- type SessionFailureCode = 'crash' | 'trap' | 'out-of-memory' | 'message' | 'silence' | 'disposed';
16
- /** A terminal session failure. */
17
- declare class SessionFailure extends Error {
18
- readonly code: SessionFailureCode;
19
- readonly diagnostics?: string | undefined;
20
- constructor(code: SessionFailureCode, message: string, diagnostics?: string | undefined);
21
- }
22
-
23
4
  interface ChartSeriesInfo {
24
5
  index: number;
25
6
  name: string | null;
@@ -42,6 +23,17 @@ interface ChartInfo {
42
23
  richTitle: boolean;
43
24
  series: ChartSeriesInfo[];
44
25
  }
26
+ /**
27
+ * How far each edge of a chart frame moves, in content pixels: a positive
28
+ * value moves the left or right edge right and the top or bottom edge down.
29
+ * The engine computes the new anchor and clamps the result to the grid.
30
+ */
31
+ interface ChartResizeEdges {
32
+ left: number;
33
+ top: number;
34
+ right: number;
35
+ bottom: number;
36
+ }
45
37
  type ChartSeriesName = {
46
38
  text: string;
47
39
  } | {
@@ -90,10 +82,56 @@ interface XlsxDefinedNamesResult {
90
82
  items: XlsxDefinedName[];
91
83
  total: number;
92
84
  nextOffset: number | null;
85
+ /**
86
+ * Present while the whole table is over the engine's size limit, which
87
+ * collaborators can reach together. Adding to it is refused, deleting always
88
+ * works, and it still saves, but BetterOffice reopens such a file only once
89
+ * the table is back under the limit.
90
+ */
91
+ overLimit?: true;
93
92
  }
94
93
 
95
94
  type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
96
95
 
96
+ type FontDecoder = (bytes: ArrayBuffer | Uint8Array, options: {
97
+ codec: string;
98
+ dict?: ArrayBuffer | Uint8Array;
99
+ maxOutput?: number;
100
+ }) => Promise<{
101
+ font: ArrayBuffer;
102
+ payload?: ArrayBuffer;
103
+ }>;
104
+ type FontDecodeResult = Awaited<ReturnType<FontDecoder>>;
105
+ type FontDecoderMethods = {
106
+ decodeFontFace(bytes: ArrayBuffer, options: Parameters<FontDecoder>[1], wasm?: ArrayBuffer | WebAssembly.Module): FontDecodeResult;
107
+ };
108
+
109
+ /**
110
+ * `unwritable-reference`: the document holds a reference with a character XML 1.0 cannot carry, which the
111
+ * part cannot be written with, so the save kept the part as the file wrote it. `unrewritable-formula`: the part
112
+ * holds a formula, kept as the file wrote it, that a sheet rename could not rewrite, so it was kept unrenamed.
113
+ * New codes may be added; handle a code you do not know as a generic warning.
114
+ */
115
+ type SaveWarningCode = 'unwritable-reference' | 'unrewritable-formula';
116
+ /** A part a save wrote differently from what the document holds, and why. */
117
+ interface SaveWarning {
118
+ /** Stable, to match on. */
119
+ code: SaveWarningCode;
120
+ /** The package part, such as `xl/charts/chart1.xml`. */
121
+ part: string;
122
+ /** What inside the part, such as `chart`. */
123
+ element?: string;
124
+ /** The sheet the part belongs to, in a workbook. */
125
+ sheet?: string;
126
+ /** A sentence for people; not stable, match on `code`. */
127
+ message: string;
128
+ }
129
+ /** The saved bytes and the warnings the save carries; `warnings` is empty on an ordinary save. */
130
+ interface SaveResult {
131
+ bytes: Uint8Array;
132
+ warnings: SaveWarning[];
133
+ }
134
+
97
135
  /**
98
136
  * Result envelopes shared by the formats' host edit APIs. Targets, steps, receipts and failure
99
137
  * codes stay format-owned; these shapes only fix how every format reports success and refusal.
@@ -135,216 +173,6 @@ interface ValidationSuccess<Preview> {
135
173
  previews: Preview[];
136
174
  }
137
175
 
138
- /**
139
- * Versioned reads and version-checked edit batches over one workbook. Every shape here is plain
140
- * JSON; the semantics live in Rust.
141
- *
142
- * Rows and columns are zero-based and ranges inclusive. Sheet ids come from the current catalog:
143
- * `sheet:{index}` standalone, the replica's sheet keys in collaboration. Versions and sheet ids
144
- * are session-scoped; neither survives save and reopen. Standalone ids are positional, so each is
145
- * valid only for the version it was read at.
146
- */
147
-
148
- /** Provenance only: it neither grants permission nor selects history. */
149
- type XlsxEditSource = 'host' | 'agent';
150
- /**
151
- * `separate`: exactly one undo step. `none`: no undo step, existing entries kept; standalone
152
- * undo replays inverse operations, so undoing an older step that wrote the same cell still
153
- * overwrites it.
154
- *
155
- * @experimental `none` only: its interaction with standalone undo may change in a minor release.
156
- */
157
- type XlsxEditHistory = 'separate' | 'none';
158
- interface XlsxCellPosition {
159
- row: number;
160
- col: number;
161
- }
162
- /**
163
- * An A1 cell or `A1:B2` range (`$` allowed), or zero-based corners. Sheet-qualified, union,
164
- * whole-row/column and named references are refused.
165
- */
166
- type XlsxRangeAddress = {
167
- kind: 'a1';
168
- a1: string;
169
- } | {
170
- kind: 'rowCol';
171
- start: XlsxCellPosition;
172
- end: XlsxCellPosition;
173
- };
174
- interface XlsxRangeTarget {
175
- sheetId: string;
176
- range: XlsxRangeAddress;
177
- }
178
- /** One cell in canonical form. */
179
- interface XlsxCellAddress {
180
- sheetId: string;
181
- row: number;
182
- col: number;
183
- a1: string;
184
- }
185
- type XlsxErrorValue = '#DIV/0!' | '#N/A' | '#NAME?' | '#NULL!' | '#NUM!' | '#REF!' | '#VALUE!' | '#SPILL!' | '#CALC!';
186
- type XlsxCellValue = {
187
- kind: 'empty';
188
- } | {
189
- kind: 'number';
190
- value: number;
191
- } | {
192
- kind: 'text';
193
- value: string;
194
- } | {
195
- kind: 'bool';
196
- value: boolean;
197
- } | {
198
- kind: 'error';
199
- value: XlsxErrorValue;
200
- };
201
- /** Conditions on a cell's pre-batch state; an absent field imposes none. */
202
- interface XlsxCellGuard {
203
- /** The stored value, a formula's current result included. */
204
- value?: XlsxCellValue;
205
- /** Formula source without the leading `=`; `null` asserts there is no formula. */
206
- formula?: string | null;
207
- /** The exact text the engine formats the cell as. */
208
- displayText?: string;
209
- }
210
- /** Matrices are row-major and exactly the target's shape. */
211
- type XlsxEditOperation = {
212
- /** What a user would type, parsed against each cell's current number format. */
213
- op: 'setCellInputs';
214
- target: XlsxRangeTarget;
215
- inputs: string[][];
216
- } | {
217
- op: 'setCellValues';
218
- target: XlsxRangeTarget;
219
- values: XlsxCellValue[][];
220
- } | {
221
- /** Formula source without the leading `=`, stored as a formula whatever the format. */
222
- op: 'setFormulas';
223
- target: XlsxRangeTarget;
224
- formulas: string[][];
225
- } | {
226
- /** Relative mutations resolve against each cell's current format. */
227
- op: 'setNumberFormat';
228
- target: XlsxRangeTarget;
229
- format: NumberFormatMutation;
230
- } | {
231
- op: 'patchStyle';
232
- target: XlsxRangeTarget;
233
- patch: RangeStylePatch;
234
- };
235
- type XlsxEditStep = XlsxEditOperation & {
236
- expect?: {
237
- cells: XlsxCellGuard[][];
238
- };
239
- };
240
- /** Requests above 16 MiB and results above 64 MiB are refused with `limit-exceeded`. */
241
- interface XlsxEditRequest {
242
- /** The version the targets were read at; a changed workbook refuses with `stale-version`. */
243
- expectVersion: string;
244
- /** Defaults to `host`. */
245
- source?: XlsxEditSource;
246
- /** Defaults to `separate`. */
247
- history?: XlsxEditHistory;
248
- /** Overrides the handle clock for this request; without either clock, NOW() has no clock. */
249
- calculation?: {
250
- nowSerial?: number;
251
- };
252
- steps: readonly XlsxEditStep[];
253
- }
254
- /**
255
- * `locked-target` covers any write to merged-cell followers, array-formula cells and locked
256
- * cells of protected sheets, and formats on protected sheets that do not allow formatting cells.
257
- * `read-only` comes only from an editor that does not accept edits.
258
- */
259
- type XlsxEditFailureCode = 'stale-version' | 'missing-target' | 'content-mismatch' | 'overlapping-steps' | 'locked-target' | 'read-only' | 'unsupported' | 'invalid-step' | 'limit-exceeded';
260
- type XlsxEditFailure = OperationFailure<XlsxEditFailureCode, XlsxRangeTarget>;
261
- type XlsxEditRefusal = OperationRefusal<XlsxEditFailure>;
262
- interface XlsxEditReceipt {
263
- stepIndex: number;
264
- changed: boolean;
265
- target: XlsxRangeTarget;
266
- /** Row-major. */
267
- changedCells: XlsxCellAddress[];
268
- }
269
- /** What one step would do; it cannot be committed later. */
270
- interface XlsxEditPreview {
271
- stepIndex: number;
272
- target: XlsxRangeTarget;
273
- wouldChange: boolean;
274
- changedCellCount: number;
275
- }
276
- interface XlsxEditCalculation {
277
- /** Dependents whose value moved. */
278
- changed: XlsxCellAddress[];
279
- cycleCells: XlsxCellAddress[];
280
- limitedCells: XlsxCellAddress[];
281
- /** Whether a list stopped at 10,000 cells. */
282
- truncated: boolean;
283
- }
284
- type XlsxEditResult = (EditSuccess<XlsxEditReceipt> & {
285
- source: XlsxEditSource;
286
- /** Sheets the batch or its recalculation changed, as ids in sheet order. */
287
- changedSheets: string[];
288
- calculation: XlsxEditCalculation;
289
- }) | XlsxEditRefusal;
290
- type XlsxValidationResult = ValidationSuccess<XlsxEditPreview> | XlsxEditRefusal;
291
- interface XlsxReadRequest {
292
- /** Empty reads only the sheet catalog. */
293
- ranges: readonly XlsxRangeTarget[];
294
- }
295
- interface XlsxSheetEntry {
296
- sheetId: string;
297
- name: string;
298
- /**
299
- * False for non-worksheets, which batches refuse to write, and protected worksheets, which take
300
- * content only in unlocked cells and formats only when they allow formatting cells.
301
- */
302
- editable: boolean;
303
- }
304
- interface XlsxCellRead {
305
- a1: string;
306
- value: XlsxCellValue;
307
- formula: string | null;
308
- displayText: string;
309
- }
310
- interface XlsxRangeRead {
311
- target: XlsxRangeTarget;
312
- /** Row-major. */
313
- cells: XlsxCellRead[][];
314
- }
315
- interface XlsxReadCalculation {
316
- cycleCells: XlsxCellAddress[];
317
- limitedCells: XlsxCellAddress[];
318
- /** Whether a list stopped at 10,000 cells. */
319
- truncated: boolean;
320
- }
321
- type XlsxReadResult = {
322
- ok: true;
323
- version: string;
324
- sheets: XlsxSheetEntry[];
325
- ranges: XlsxRangeRead[];
326
- calculation: XlsxReadCalculation;
327
- } | XlsxEditRefusal;
328
- /** An exact, case-sensitive substring search over display text. */
329
- interface XlsxFindRequest {
330
- text: string;
331
- /** Defaults to every sheet. */
332
- sheetIds?: readonly string[];
333
- /** Defaults to 100; at most 10,000. */
334
- limit?: number;
335
- }
336
- interface XlsxFindMatch {
337
- cell: XlsxCellAddress;
338
- /** The cell's whole display text. */
339
- text: string;
340
- }
341
- type XlsxFindResult = {
342
- ok: true;
343
- version: string;
344
- matches: XlsxFindMatch[];
345
- truncated: boolean;
346
- } | XlsxEditRefusal;
347
-
348
176
  /**
349
177
  * Shapes shared by the formats' read-only structured exports. Content trees, anchors, story or
350
178
  * sheet selectors, diagnostic codes and limits stay format-owned; these only fix how every format
@@ -478,117 +306,427 @@ interface XlsxExportCell {
478
306
  origin: boolean;
479
307
  } | null;
480
308
  }
481
- interface XlsxExportMerge {
482
- id: string;
483
- anchor: XlsxAnchor;
484
- /** Whether the merge extends past the selected range. */
485
- clipped: boolean;
309
+ interface XlsxExportMerge {
310
+ id: string;
311
+ anchor: XlsxAnchor;
312
+ /** Whether the merge extends past the selected range. */
313
+ clipped: boolean;
314
+ }
315
+ /** A ListObject. */
316
+ interface XlsxExportTable {
317
+ id: string;
318
+ anchor: XlsxAnchor;
319
+ name: string;
320
+ headerRows: number;
321
+ totalsRows: number;
322
+ columns: string[];
323
+ clipped: boolean;
324
+ }
325
+ interface XlsxExportHyperlink {
326
+ id: string;
327
+ anchor: XlsxAnchor;
328
+ externalTarget: string | null;
329
+ location: string | null;
330
+ tooltip: string | null;
331
+ display: string | null;
332
+ clipped: boolean;
333
+ }
334
+ type XlsxObjectKind = 'chart' | 'picture' | 'shape' | 'group' | 'connector' | 'diagram' | 'graphicFrame' | 'contentPart' | 'unknown';
335
+ /** A drawing object as a placeholder: no chart data, image bytes or shape text. */
336
+ interface XlsxExportObject {
337
+ id: string;
338
+ kind: XlsxObjectKind;
339
+ /** The cells holding its corners; `null` when its grid position is unknown. */
340
+ anchor: XlsxAnchor | null;
341
+ name: string | null;
342
+ altText: string | null;
343
+ title: string | null;
344
+ hidden: boolean;
345
+ /** The chart or image part. */
346
+ part: string | null;
347
+ source: XlsxSourcePart | null;
348
+ }
349
+ interface XlsxExportDefinedName {
350
+ id: string;
351
+ anchor: XlsxAnchor;
352
+ name: string;
353
+ formula: string;
354
+ hidden: boolean;
355
+ localSheet: XlsxSheetIdentity | null;
356
+ }
357
+ type XlsxSheetVisibility = 'visible' | 'hidden' | 'veryHidden' | 'unknown';
358
+ /**
359
+ * One sheet. `truncated` means export stopped inside it: its lists are complete in the order
360
+ * hidden spans, merges, tables, hyperlinks, objects, cells, up to where it stopped.
361
+ */
362
+ interface XlsxExportSheet extends ExportCompletion {
363
+ id: string;
364
+ anchor: XlsxAnchor;
365
+ kind: 'worksheet' | 'chartsheet' | 'dialogsheet' | 'macrosheet' | 'other';
366
+ visibility: XlsxSheetVisibility;
367
+ /** Stored cells and hyperlinks; drawings, merges and tables do not extend it. */
368
+ usedRange: string | null;
369
+ selectedRange: string | null;
370
+ /** Hidden row spans such as `"5:7"` inside the selected range, exported or not. */
371
+ hiddenRows: string[];
372
+ /** Hidden column spans such as `"C:D"` inside the selected range, exported or not. */
373
+ hiddenColumns: string[];
374
+ merges: XlsxExportMerge[];
375
+ tables: XlsxExportTable[];
376
+ hyperlinks: XlsxExportHyperlink[];
377
+ objects: XlsxExportObject[];
378
+ /** Stored cells in row-major order, styled empty cells included. */
379
+ cells: XlsxExportCell[];
380
+ source: XlsxSourcePart | null;
381
+ }
382
+ interface XlsxStructuredContent extends ExportCompletion {
383
+ schemaVersion: 1;
384
+ /** `session` for a live export, `snapshot` for bytes. */
385
+ anchorScope: 'session' | 'snapshot';
386
+ dateSystem: '1900' | '1904';
387
+ calculation: {
388
+ policy: 'asStored';
389
+ freshness: 'unverified';
390
+ };
391
+ included: {
392
+ hiddenSheets: boolean;
393
+ hiddenRows: boolean;
394
+ hiddenColumns: boolean;
395
+ definedNames: boolean;
396
+ hiddenNames: boolean;
397
+ };
398
+ sheets: XlsxExportSheet[];
399
+ definedNames: XlsxExportDefinedName[];
400
+ diagnostics: XlsxExportDiagnostic[];
401
+ }
402
+ interface XlsxMarkdownContent extends ExportCompletion {
403
+ markdown: string;
404
+ /** One per `<!-- xlsx-export:N -->` marker, in order. */
405
+ anchors: MarkdownAnchor<XlsxAnchor>[];
406
+ /** The structured export's diagnostics, then what Markdown lost. */
407
+ diagnostics: XlsxExportDiagnostic[];
408
+ }
409
+ type XlsxExportFailureCode = 'invalid-options' | 'invalid-scope' | 'limit-exceeded';
410
+ interface XlsxExportFailure {
411
+ code: XlsxExportFailureCode;
412
+ /** The sheet a scope failure names, else `null`. */
413
+ target: XlsxAnchor | null;
414
+ message: string;
415
+ }
416
+ type XlsxExportResult<T> = {
417
+ ok: true;
418
+ version: string;
419
+ content: T;
420
+ } | OperationRefusal<XlsxExportFailure>;
421
+
422
+ /**
423
+ * Versioned reads and version-checked edit batches over one workbook. Every shape here is plain
424
+ * JSON; the semantics live in Rust.
425
+ *
426
+ * Rows and columns are zero-based and ranges inclusive. Sheet ids come from the current catalog:
427
+ * `sheet:{index}` standalone, the replica's sheet keys in collaboration. Versions and sheet ids
428
+ * are session-scoped; neither survives save and reopen. Standalone ids are positional, so each is
429
+ * valid only for the version it was read at.
430
+ */
431
+
432
+ /** Provenance only: it neither grants permission nor selects history. */
433
+ type XlsxEditSource = 'host' | 'agent';
434
+ /**
435
+ * `separate`: exactly one undo step. `none`: no undo step, existing entries kept; standalone
436
+ * undo replays inverse operations, so undoing an older step that wrote the same cell still
437
+ * overwrites it.
438
+ *
439
+ * @experimental `none` only: its interaction with standalone undo may change in a minor release.
440
+ */
441
+ type XlsxEditHistory = 'separate' | 'none';
442
+ interface XlsxCellPosition {
443
+ row: number;
444
+ col: number;
445
+ }
446
+ /**
447
+ * An A1 cell or `A1:B2` range (`$` allowed), or zero-based corners. Sheet-qualified, union,
448
+ * whole-row/column and named references are refused.
449
+ */
450
+ type XlsxRangeAddress$1 = {
451
+ kind: 'a1';
452
+ a1: string;
453
+ } | {
454
+ kind: 'rowCol';
455
+ start: XlsxCellPosition;
456
+ end: XlsxCellPosition;
457
+ };
458
+ interface XlsxRangeTarget {
459
+ sheetId: string;
460
+ range: XlsxRangeAddress$1;
461
+ }
462
+ /** One cell in canonical form. */
463
+ interface XlsxCellAddress {
464
+ sheetId: string;
465
+ row: number;
466
+ col: number;
467
+ a1: string;
468
+ }
469
+ type XlsxErrorValue = '#DIV/0!' | '#N/A' | '#NAME?' | '#NULL!' | '#NUM!' | '#REF!' | '#VALUE!' | '#SPILL!' | '#CALC!';
470
+ type XlsxCellValue = {
471
+ kind: 'empty';
472
+ } | {
473
+ kind: 'number';
474
+ value: number;
475
+ } | {
476
+ kind: 'text';
477
+ value: string;
478
+ } | {
479
+ kind: 'bool';
480
+ value: boolean;
481
+ } | {
482
+ kind: 'error';
483
+ value: XlsxErrorValue;
484
+ };
485
+ /** Conditions on a cell's pre-batch state; an absent field imposes none. */
486
+ interface XlsxCellGuard {
487
+ /** The stored value, a formula's current result included. */
488
+ value?: XlsxCellValue;
489
+ /** Formula source without the leading `=`; `null` asserts there is no formula. */
490
+ formula?: string | null;
491
+ /** The exact text the engine formats the cell as. */
492
+ displayText?: string;
493
+ }
494
+ /** Matrices are row-major and exactly the target's shape. */
495
+ type XlsxEditOperation = {
496
+ /** What a user would type, parsed against each cell's current number format. */
497
+ op: 'setCellInputs';
498
+ target: XlsxRangeTarget;
499
+ inputs: string[][];
500
+ } | {
501
+ op: 'setCellValues';
502
+ target: XlsxRangeTarget;
503
+ values: XlsxCellValue[][];
504
+ } | {
505
+ /** Formula source without the leading `=`, stored as a formula whatever the format. */
506
+ op: 'setFormulas';
507
+ target: XlsxRangeTarget;
508
+ formulas: string[][];
509
+ } | {
510
+ /** Relative mutations resolve against each cell's current format. */
511
+ op: 'setNumberFormat';
512
+ target: XlsxRangeTarget;
513
+ format: NumberFormatMutation;
514
+ } | {
515
+ op: 'patchStyle';
516
+ target: XlsxRangeTarget;
517
+ patch: RangeStylePatch;
518
+ } | {
519
+ /**
520
+ * Literal replacement in each cell's entered text inside `target`, case-insensitive
521
+ * unless `matchCase`; the result is entered as if typed, as `setCellInputs` does.
522
+ *
523
+ * `values` reports formula cells as skipped; `formulas` rewrites them too. Dates,
524
+ * booleans, errors, merged-follower, array-filled and locked cells are skipped; a rich
525
+ * text cell or an entry that would not parse is refused alone while the rest applies.
526
+ * Limit exhaustion refuses the whole batch. It takes no `expect` guards.
527
+ */
528
+ op: 'replaceText';
529
+ target: XlsxRangeTarget;
530
+ query: string;
531
+ replacement: string;
532
+ /** Match only a cell whose whole searched text equals `query`. */
533
+ entireCell?: boolean;
534
+ /** Defaults to `values`. */
535
+ lookIn?: 'values' | 'formulas';
536
+ /** Match letter case exactly. */
537
+ matchCase?: boolean;
538
+ /** Defaults to `sheet`. `workbook` skips a hidden, very hidden or non-worksheet target. */
539
+ within?: 'sheet' | 'workbook';
540
+ };
541
+ type XlsxEditStep = XlsxEditOperation & {
542
+ expect?: {
543
+ cells: XlsxCellGuard[][];
544
+ };
545
+ };
546
+ /** Requests above 16 MiB and results above 64 MiB are refused with `limit-exceeded`. */
547
+ interface XlsxEditRequest {
548
+ /** The version the targets were read at; a changed workbook refuses with `stale-version`. */
549
+ expectVersion: string;
550
+ /** Defaults to `host`. */
551
+ source?: XlsxEditSource;
552
+ /** Defaults to `separate`. */
553
+ history?: XlsxEditHistory;
554
+ /** Overrides the handle clock for this request; without either clock, NOW() has no clock. */
555
+ calculation?: {
556
+ /** Current local date and time as a 1900 date-system serial (days since 1899-12-30), also in 1904 workbooks. */
557
+ nowSerial?: number;
558
+ };
559
+ steps: readonly XlsxEditStep[];
560
+ }
561
+ /**
562
+ * `locked-target` covers any write to merged-cell followers, array-formula cells and locked
563
+ * cells of protected sheets, and formats on protected sheets that do not allow formatting cells.
564
+ * `read-only` comes only from an editor that does not accept edits.
565
+ */
566
+ type XlsxEditFailureCode = 'stale-version' | 'missing-target' | 'content-mismatch' | 'overlapping-steps' | 'locked-target' | 'read-only' | 'unsupported' | 'invalid-step' | 'limit-exceeded';
567
+ type XlsxEditFailure = OperationFailure<XlsxEditFailureCode, XlsxRangeTarget>;
568
+ type XlsxEditRefusal = OperationRefusal<XlsxEditFailure>;
569
+ /** Counts for one `replaceText` step; omitted for other operations. */
570
+ interface XlsxReplaceStats {
571
+ /** Cells whose searched text matched, including cells that could not be rewritten. */
572
+ matched: number;
573
+ /** Cells whose stored input changed. */
574
+ replaced: number;
575
+ /** Formula results that matched in `values` mode; their formulas are untouched. */
576
+ skippedFormulas: number;
577
+ /** Matches on merged followers, array fills or locked cells of a protected sheet. */
578
+ skippedLocked: number;
579
+ /** Dates, booleans and errors whose displayed or entered text matched; they are untouched. */
580
+ skippedValues?: number;
581
+ /** A1 references of the first skipped values, at most 10,000. */
582
+ skippedCells?: string[];
583
+ /** Matched cells left unchanged because their new entry cannot be stored, at most 10,000. */
584
+ refusedCells?: {
585
+ cell: string;
586
+ reason: string;
587
+ }[];
588
+ /** Every refused cell, including those past the `refusedCells` cap. */
589
+ refused?: number;
590
+ }
591
+ interface XlsxEditReceipt {
592
+ stepIndex: number;
593
+ changed: boolean;
594
+ target: XlsxRangeTarget;
595
+ /** Row-major. */
596
+ changedCells: XlsxCellAddress[];
597
+ replace?: XlsxReplaceStats;
598
+ }
599
+ /** What one step would do; it cannot be committed later. */
600
+ interface XlsxEditPreview {
601
+ stepIndex: number;
602
+ target: XlsxRangeTarget;
603
+ wouldChange: boolean;
604
+ changedCellCount: number;
605
+ replace?: XlsxReplaceStats;
486
606
  }
487
- /** A ListObject. */
488
- interface XlsxExportTable {
489
- id: string;
490
- anchor: XlsxAnchor;
491
- name: string;
492
- headerRows: number;
493
- totalsRows: number;
494
- columns: string[];
495
- clipped: boolean;
607
+ interface XlsxEditCalculation {
608
+ /** Dependents whose value moved. */
609
+ changed: XlsxCellAddress[];
610
+ cycleCells: XlsxCellAddress[];
611
+ limitedCells: XlsxCellAddress[];
612
+ /** Whether a list stopped at 10,000 cells. */
613
+ truncated: boolean;
496
614
  }
497
- interface XlsxExportHyperlink {
498
- id: string;
499
- anchor: XlsxAnchor;
500
- externalTarget: string | null;
501
- location: string | null;
502
- tooltip: string | null;
503
- display: string | null;
504
- clipped: boolean;
615
+ type XlsxEditResult = (EditSuccess<XlsxEditReceipt> & {
616
+ source: XlsxEditSource;
617
+ /** Sheets the batch or its recalculation changed, as ids in sheet order. */
618
+ changedSheets: string[];
619
+ calculation: XlsxEditCalculation;
620
+ }) | XlsxEditRefusal;
621
+ type XlsxValidationResult = ValidationSuccess<XlsxEditPreview> | XlsxEditRefusal;
622
+ interface XlsxReadRequest {
623
+ /** Empty reads only the sheet catalog. */
624
+ ranges: readonly XlsxRangeTarget[];
505
625
  }
506
- type XlsxObjectKind = 'chart' | 'picture' | 'shape' | 'group' | 'connector' | 'diagram' | 'graphicFrame' | 'contentPart' | 'unknown';
507
- /** A drawing object as a placeholder: no chart data, image bytes or shape text. */
508
- interface XlsxExportObject {
509
- id: string;
510
- kind: XlsxObjectKind;
511
- /** The cells holding its corners; `null` when its grid position is unknown. */
512
- anchor: XlsxAnchor | null;
513
- name: string | null;
514
- altText: string | null;
515
- title: string | null;
516
- hidden: boolean;
517
- /** The chart or image part. */
518
- part: string | null;
519
- source: XlsxSourcePart | null;
626
+ /** Stored text with xstring escapes decoded; printable sections use dialog field tokens and normalized line breaks. */
627
+ interface XlsxHeaderFooterText {
628
+ raw: string;
629
+ left: string;
630
+ center: string;
631
+ right: string;
632
+ }
633
+ /** Absent or empty header and footer parts are null. */
634
+ interface XlsxHeaderFooterPair {
635
+ header: XlsxHeaderFooterText | null;
636
+ footer: XlsxHeaderFooterText | null;
637
+ }
638
+ /** Printable variants; even and first are null unless their respective flags are enabled. */
639
+ interface XlsxSheetHeaderFooter {
640
+ differentFirst: boolean;
641
+ differentOddEven: boolean;
642
+ scaleWithDoc: boolean;
643
+ alignWithMargins: boolean;
644
+ odd: XlsxHeaderFooterPair;
645
+ even: XlsxHeaderFooterPair | null;
646
+ first: XlsxHeaderFooterPair | null;
520
647
  }
521
- interface XlsxExportDefinedName {
522
- id: string;
523
- anchor: XlsxAnchor;
648
+ interface XlsxSheetEntry {
649
+ /** Null means known absent or empty; omitted means source facts are unknown. */
650
+ headerFooter?: XlsxSheetHeaderFooter | null;
651
+ visibility?: XlsxSheetVisibility;
652
+ /** The source part's sheet type; `worksheet` for sheets without a source. */
653
+ kind?: 'worksheet' | 'chartsheet' | 'dialogsheet' | 'macrosheet' | 'other';
654
+ sheetId: string;
524
655
  name: string;
525
- formula: string;
526
- hidden: boolean;
527
- localSheet: XlsxSheetIdentity | null;
656
+ /**
657
+ * False for non-worksheets, which batches refuse to write, and protected worksheets, which take
658
+ * content only in unlocked cells and formats only when they allow formatting cells.
659
+ */
660
+ editable: boolean;
661
+ }
662
+ interface XlsxCellRead {
663
+ a1: string;
664
+ value: XlsxCellValue;
665
+ formula: string | null;
666
+ displayText: string;
667
+ }
668
+ interface XlsxRangeRead {
669
+ target: XlsxRangeTarget;
670
+ /** Row-major. */
671
+ cells: XlsxCellRead[][];
528
672
  }
529
673
  /**
530
- * One sheet. `truncated` means export stopped inside it: its lists are complete in the order
531
- * hidden spans, merges, tables, hyperlinks, objects, cells, up to where it stopped.
674
+ * A formula cell the engine could not compute: it keeps Excel's saved value.
675
+ * When the file saved none, an uncomputable function leaves it blank, an
676
+ * unknown function shows what the engine answered (`#NAME?`, or what a handler
677
+ * like `IFERROR` made of it), and an engine gap alone shows its error.
532
678
  */
533
- interface XlsxExportSheet extends ExportCompletion {
534
- id: string;
535
- anchor: XlsxAnchor;
536
- kind: 'worksheet' | 'chartsheet' | 'dialogsheet' | 'macrosheet' | 'other';
537
- visibility: 'visible' | 'hidden' | 'veryHidden' | 'unknown';
538
- /** Stored cells and hyperlinks; drawings, merges and tables do not extend it. */
539
- usedRange: string | null;
540
- selectedRange: string | null;
541
- /** Hidden row spans such as `"5:7"` inside the selected range, exported or not. */
542
- hiddenRows: string[];
543
- /** Hidden column spans such as `"C:D"` inside the selected range, exported or not. */
544
- hiddenColumns: string[];
545
- merges: XlsxExportMerge[];
546
- tables: XlsxExportTable[];
547
- hyperlinks: XlsxExportHyperlink[];
548
- objects: XlsxExportObject[];
549
- /** Stored cells in row-major order, styled empty cells included. */
550
- cells: XlsxExportCell[];
551
- source: XlsxSourcePart | null;
679
+ interface XlsxUnevaluatedCell extends XlsxCellAddress {
680
+ /** Functions involved, sorted: uncomputable ones (`WEBSERVICE`, `RTD`, an add-in) and names the engine does not know (a VBA function, a typo); empty when only engine gaps were. */
681
+ functions: string[];
552
682
  }
553
- interface XlsxStructuredContent extends ExportCompletion {
554
- schemaVersion: 1;
555
- /** `session` for a live export, `snapshot` for bytes. */
556
- anchorScope: 'session' | 'snapshot';
557
- dateSystem: '1900' | '1904';
558
- calculation: {
559
- policy: 'asStored';
560
- freshness: 'unverified';
561
- };
562
- included: {
563
- hiddenSheets: boolean;
564
- hiddenRows: boolean;
565
- hiddenColumns: boolean;
566
- definedNames: boolean;
567
- hiddenNames: boolean;
568
- };
569
- sheets: XlsxExportSheet[];
570
- definedNames: XlsxExportDefinedName[];
571
- diagnostics: XlsxExportDiagnostic[];
683
+ interface XlsxReadCalculation {
684
+ cycleCells: XlsxCellAddress[];
685
+ limitedCells: XlsxCellAddress[];
686
+ /** Formula cells the engine could not compute; omitted by cores built before the list. */
687
+ unevaluatedCells?: XlsxUnevaluatedCell[];
688
+ /** Whether a list stopped at 10,000 cells. */
689
+ truncated: boolean;
572
690
  }
573
- interface XlsxMarkdownContent extends ExportCompletion {
574
- markdown: string;
575
- /** One per `<!-- xlsx-export:N -->` marker, in order. */
576
- anchors: MarkdownAnchor<XlsxAnchor>[];
577
- /** The structured export's diagnostics, then what Markdown lost. */
578
- diagnostics: XlsxExportDiagnostic[];
691
+ type XlsxReadResult = {
692
+ ok: true;
693
+ version: string;
694
+ sheets: XlsxSheetEntry[];
695
+ ranges: XlsxRangeRead[];
696
+ calculation: XlsxReadCalculation;
697
+ } | XlsxEditRefusal;
698
+ /** A literal substring search over display text, case-insensitive unless `matchCase`. */
699
+ interface XlsxFindRequest {
700
+ text: string;
701
+ /** Defaults to every sheet. */
702
+ sheetIds?: readonly string[];
703
+ /** Restricts the search to one rectangle. Takes precedence over `sheetIds`. */
704
+ range?: XlsxRangeTarget;
705
+ /**
706
+ * Omit or pass `values` to search the display text of every stored cell; `formulas`
707
+ * searches the entered text the formula bar shows, which is what `replaceText` edits.
708
+ */
709
+ lookIn?: 'values' | 'formulas';
710
+ /** Match only cells whose whole searched text equals `text`. */
711
+ entireCell?: boolean;
712
+ /** Match letter case exactly. */
713
+ matchCase?: boolean;
714
+ /** Defaults to 100; at most 10,000. */
715
+ limit?: number;
579
716
  }
580
- type XlsxExportFailureCode = 'invalid-options' | 'invalid-scope' | 'limit-exceeded';
581
- interface XlsxExportFailure {
582
- code: XlsxExportFailureCode;
583
- /** The sheet a scope failure names, else `null`. */
584
- target: XlsxAnchor | null;
585
- message: string;
717
+ interface XlsxFindMatch {
718
+ cell: XlsxCellAddress;
719
+ /** The cell's whole display text. */
720
+ text: string;
586
721
  }
587
- type XlsxExportResult<T> = {
722
+ type XlsxFindResult = {
588
723
  ok: true;
589
724
  version: string;
590
- content: T;
591
- } | OperationRefusal<XlsxExportFailure>;
725
+ matches: XlsxFindMatch[];
726
+ truncated: boolean;
727
+ } | XlsxEditRefusal;
728
+
729
+ declare const decodeFontFace: FontDecoder;
592
730
 
593
731
  /**
594
732
  * A scrolled window into a sheet. `x`/`y` are content-pixel offsets into the
@@ -672,6 +810,20 @@ interface CalculationStatus {
672
810
  limitedCells: string[];
673
811
  /** The last recalculation ran out of its budget; the cells it could not evaluate keep their saved values. */
674
812
  budgetExhausted?: boolean;
813
+ /** Formula cells the engine could not compute, at most 10,000; omitted by cores built before the list. */
814
+ unevaluatedCells?: UnevaluatedCellStatus[];
815
+ }
816
+ /**
817
+ * A formula cell the engine could not compute: it keeps Excel's saved value.
818
+ * When the file saved none, an uncomputable function leaves it blank, an
819
+ * unknown function shows what the engine answered (`#NAME?`, or what a handler
820
+ * like `IFERROR` made of it), and an engine gap alone shows its error.
821
+ */
822
+ interface UnevaluatedCellStatus {
823
+ /** The cell, qualified by its sheet when that is not the active one. */
824
+ address: string;
825
+ /** Functions involved, sorted: uncomputable ones (`WEBSERVICE`, `RTD`, an add-in) and names the engine does not know (a VBA function, a typo); empty when only engine gaps were. */
826
+ functions: string[];
675
827
  }
676
828
  type NumberFormat = 'automatic' | 'plainText' | 'number' | 'percent' | 'scientific' | 'currency' | 'date' | 'time' | 'custom';
677
829
  type BorderPreset = 'all' | 'inner' | 'horizontal' | 'vertical' | 'outer' | 'left' | 'top' | 'right' | 'bottom' | 'none';
@@ -758,6 +910,7 @@ interface CapturedCellFormat {
758
910
  bold?: boolean;
759
911
  italic?: boolean;
760
912
  underline?: boolean;
913
+ underline_style?: 'double' | 'singleAccounting' | 'doubleAccounting';
761
914
  strike?: boolean;
762
915
  color?: CapturedColor | null;
763
916
  };
@@ -848,6 +1001,7 @@ interface WorkbookUpdateInfo {
848
1001
  }
849
1002
  type WorkbookUpdateListener = (update: Uint8Array, origin: WorkbookUpdateOrigin, info: WorkbookUpdateInfo) => void;
850
1003
  interface WorkbookCalculationContext {
1004
+ /** Current local date and time as a 1900 date-system serial (days since 1899-12-30), also in 1904 workbooks. */
851
1005
  nowSerial: number;
852
1006
  randSeed: number;
853
1007
  }
@@ -857,6 +1011,12 @@ interface OpenWorkbookOptions {
857
1011
  /** Peer-unique positive safe integer. Generated securely when omitted. */
858
1012
  clientId?: number;
859
1013
  calculation?: WorkbookCalculationContext;
1014
+ /**
1015
+ * `'stale'` shows the results the file cached, recalculating every formula only when one has
1016
+ * no cached result or `calcPr` asks for a full calculation on load. Edits still recalculate
1017
+ * what they reach. Defaults to `'all'`. Unavailable for collaborative workbooks.
1018
+ */
1019
+ recalculate?: 'all' | 'stale';
860
1020
  }
861
1021
  /**
862
1022
  * The editable view of one cell: A1 address, the exact string the user would
@@ -869,6 +1029,15 @@ interface CellEdit {
869
1029
  isFormula: boolean;
870
1030
  isArrayFormula?: boolean;
871
1031
  }
1032
+ /**
1033
+ * Options for a direct cell or format write. `protectedSheets: 'allow'` writes locked cells,
1034
+ * formats and chart moves and resizes on protected sheets, as edit batches' opt-in does; the protection
1035
+ * itself is kept. The default `'refuse'` throws like Excel. `'allow'` throws on a collaborative
1036
+ * workbook, and any other value throws as an invalid request.
1037
+ */
1038
+ interface XlsxWriteOptions {
1039
+ protectedSheets?: 'refuse' | 'allow';
1040
+ }
872
1041
  interface XlsxTextSearchOptions {
873
1042
  /** Defaults to false. */
874
1043
  caseSensitive?: boolean;
@@ -915,6 +1084,7 @@ interface ProposalCell {
915
1084
  a1: string;
916
1085
  oldText: string;
917
1086
  newText: string;
1087
+ stale?: boolean;
918
1088
  }
919
1089
  /**
920
1090
  * A pending, un-applied set of cell changes an agent has staged for human
@@ -926,6 +1096,12 @@ interface Proposal {
926
1096
  agentId: string;
927
1097
  note: string | null;
928
1098
  cells: ProposalCell[];
1099
+ /**
1100
+ * A1 addresses of the cells whose target moved, the same strings as
1101
+ * {@link StaleProposalError.cells}. A changed dependency only shows at accept.
1102
+ */
1103
+ staleTargets?: string[];
1104
+ forceBlocked?: boolean;
929
1105
  }
930
1106
  /** A drifted proposal cell: its sheet index and catalog id beside the coordinates. */
931
1107
  interface StaleProposalTarget extends XlsxCellAddress {
@@ -969,6 +1145,12 @@ interface WorkbookHandle extends CollaborationReplica {
969
1145
  /** Metadata for `sheet`, with that index in `activeSheet`; leaves the workbook unchanged. */
970
1146
  sheetInfoFor(sheet: number): SheetInfo;
971
1147
  calculationStatus(): CalculationStatus;
1148
+ /**
1149
+ * Recalculate every formula with the handle's calculation context (or the host clock).
1150
+ * The next `save()` writes the recalculated values; a formula the engine cannot evaluate
1151
+ * keeps the result the file stored.
1152
+ */
1153
+ recalculate(): CalculationStatus;
972
1154
  /** Clamps tracks to the grid and truncates oversized frames at the scroll origin. */
973
1155
  displayList(viewport: Viewport): DisplayList;
974
1156
  /** `displayList` with build and encode time measured inside the core. */
@@ -985,24 +1167,45 @@ interface WorkbookHandle extends CollaborationReplica {
985
1167
  * mutation the canvas has not drawn yet will move the answer off the pixels.
986
1168
  */
987
1169
  chartAtPoint(viewport: Viewport, x: number, y: number): ChartRegion | null;
1170
+ /**
1171
+ * the encoded bytes (PNG, JPEG, GIF, ...) of the image an `image` draw
1172
+ * command names by `assetId`. throws for a part no picture draws.
1173
+ */
1174
+ mediaBytes(assetId: string): Uint8Array;
988
1175
  /**
989
1176
  * slide the chart frame `chart` names — a {@link ChartRegion} id — by a
990
1177
  * content-pixel delta, clamped to the grid, as one undo step. the new anchor
991
1178
  * is written back on save. throws for a chart pinned to the sheet by an
992
1179
  * absolute anchor.
993
1180
  */
994
- moveChart(sheet: number, chart: string, dx: number, dy: number): EditResult;
1181
+ moveChart(sheet: number, chart: string, dx: number, dy: number, options?: XlsxWriteOptions): EditResult;
1182
+ /**
1183
+ * move the edges of the chart frame `chart` names — a {@link ChartRegion} id
1184
+ * — by content-pixel deltas, clamped to the grid and a 1x1px minimum, as one
1185
+ * undo step. the new two-cell anchor is written back on save. throws for a
1186
+ * chart pinned by an absolute anchor or held by a one-cell extent, neither of
1187
+ * which a save can rewrite.
1188
+ */
1189
+ resizeChart(sheet: number, chart: string, edges: ChartResizeEdges, options?: XlsxWriteOptions): EditResult;
995
1190
  setActiveSheet(index: number): void;
996
1191
  /**
997
1192
  * apply one user input to a cell (parses number/bool/formula/text) and
998
1193
  * recalc its transitive dependents. one undo step; moved dependents come back
999
1194
  * in `EditResult.changed`.
1000
1195
  */
1001
- editCell(sheet: number, row: number, col: number, input: string): EditResult;
1196
+ editCell(sheet: number, row: number, col: number, input: string, options?: XlsxWriteOptions): EditResult;
1002
1197
  /** `editCell` with the facade's stage timings attached. */
1003
1198
  editCellProfiled(sheet: number, row: number, col: number, input: string): ProfiledEditResult;
1004
1199
  /** apply a batch of inputs (paste path) as one undo step; dependents recalc. */
1005
- editCells(sheet: number, edits: CellInputEdit[]): EditResult;
1200
+ editCells(sheet: number, edits: CellInputEdit[], options?: XlsxWriteOptions): EditResult;
1201
+ /**
1202
+ * Fill copies `source` over the complete rectangle `destination` as one undo
1203
+ * step. `destination` includes the source and must start at its top-left
1204
+ * corner; values and styles are copied, formulas are translated with `$`
1205
+ * preserved. Array formulas, merged cells, tables, and charts anchored in
1206
+ * either rectangle are refused without changing the workbook.
1207
+ */
1208
+ fillRange(sheet: number, source: string, destination: string): EditResult;
1006
1209
  /** Move a range within one sheet and rewrite references in one native undo step. */
1007
1210
  moveRange(sheet: number, source: string, destination: string): EditResult;
1008
1211
  setHyperlink(sheet: number, hyperlink: WorkbookHyperlink): EditResult;
@@ -1026,31 +1229,36 @@ interface WorkbookHandle extends CollaborationReplica {
1026
1229
  selectionData(sheet: number, row: number, col: number, direction?: Direction | 'usedRange' | 'rowEnd' | 'merge'): SelectionData;
1027
1230
  /** row-major editable views for a range, e.g. "A1:C3" (clipboard copy). */
1028
1231
  rangeCells(sheet: number, range: string): CellEdit[][];
1029
- patchRangeStyle(sheet: number, range: string, patch: RangeStylePatch): EditResult;
1030
- setNumberFormat(sheet: number, range: string, format: NumberFormatMutation): EditResult;
1232
+ patchRangeStyle(sheet: number, range: string, patch: RangeStylePatch, options?: XlsxWriteOptions): EditResult;
1233
+ setNumberFormat(sheet: number, range: string, format: NumberFormatMutation, options?: XlsxWriteOptions): EditResult;
1031
1234
  selectionFormatting(sheet: number, range: string): SelectionFormatting;
1032
1235
  captureFormat(sheet: number, range: string): CapturedFormat;
1033
- applyFormat(sheet: number, range: string, format: CapturedFormat): EditResult;
1236
+ applyFormat(sheet: number, range: string, format: CapturedFormat, options?: XlsxWriteOptions): EditResult;
1034
1237
  mergedRanges(sheet: number, range: string): MergedRange[];
1035
1238
  visibleMergedRanges(sheet: number, viewport: Viewport): MergedRange[];
1036
1239
  historyState(): HistoryState;
1037
1240
  /**
1038
- * render the current sheet viewport to png bytes via the native raster
1039
- * backend — the same display list the canvas paints, rasterized server-side.
1040
- * throws if the embedded wasm was built without png export (the `raster`
1041
- * cargo feature); guard with {@link isPngExportAvailable}.
1241
+ * Draws a viewport or a cell range of a sheet as PNG bytes, with the
1242
+ * editor's painter on a canvas. Rejects with `PngExportError` rather than
1243
+ * paint a substitute font, and where no canvas exists names
1244
+ * `@betteroffice/xlsx-native`.
1245
+ */
1246
+ renderPng(target: XlsxPngTarget, options?: XlsxPngOptions): Promise<Uint8Array>;
1247
+ /**
1248
+ * The fonts `renderPng` would paint for the same target. The editors use it to forward the faces they paint with; not public until every format has it.
1249
+ * @internal
1042
1250
  */
1043
- renderPng(viewport: Viewport): Uint8Array;
1251
+ renderPngFonts(target: XlsxPngTarget, options?: XlsxPngOptions): XlsxPngFont[];
1044
1252
  /**
1045
- * render an a1 range (default: the used range) at an optional scale to png.
1046
- * dimensions are capped wasm-side; same availability guard as renderPng.
1253
+ * serialize the workbook back to .xlsx bytes. each save warning is also emitted as a Node process
1254
+ * warning with code `BETTEROFFICE_SAVE_WARNING`; {@link WorkbookHandle.saveWithWarnings} returns them.
1047
1255
  */
1048
- renderRangePng(opts?: {
1049
- range?: string;
1050
- scale?: number;
1051
- }): Uint8Array;
1052
- /** serialize the workbook back to .xlsx bytes. */
1053
1256
  save(): Uint8Array;
1257
+ /**
1258
+ * serialize the workbook back to .xlsx bytes, with a warning for every part the save wrote differently
1259
+ * from what the workbook holds; none on an ordinary save.
1260
+ */
1261
+ saveWithWarnings(): SaveResult;
1054
1262
  /**
1055
1263
  * stage an agent's proposed edits for human review without applying them.
1056
1264
  * returns the {@link Proposal} with per-cell formatted before/after previews.
@@ -1060,6 +1268,11 @@ interface WorkbookHandle extends CollaborationReplica {
1060
1268
  propose(agentId: string, note: string | null, edits: ProposalEdit[]): Proposal;
1061
1269
  /** every pending proposal, oldest first. empty when none or unsupported. */
1062
1270
  listProposals(): Proposal[];
1271
+ /** The pending state or the last decision made through this handle. */
1272
+ getProposalStatus(id: string): 'pending' | 'accepted' | 'rejected' | undefined;
1273
+ isProposalStale(id: string): boolean;
1274
+ /** Observe proposals created or decided through this handle. */
1275
+ onProposalChange(listener: (proposals: Proposal[]) => void): () => void;
1063
1276
  /**
1064
1277
  * apply a pending proposal as one undo step and recalc dependents. throws
1065
1278
  * {@link StaleProposalError} when the base changed since it was staged and
@@ -1083,7 +1296,7 @@ interface WorkbookHandle extends CollaborationReplica {
1083
1296
  listDefinedNames(request?: XlsxDefinedNamesRequest): XlsxDefinedNamesResult;
1084
1297
  /** Cells with the version they were read at; empty `ranges` reads the sheet catalog. */
1085
1298
  readCells(request: XlsxReadRequest): XlsxReadResult;
1086
- /** Exact, case-sensitive search over display text, one match per cell. */
1299
+ /** Literal search over display text, one match per cell; ignores case unless `matchCase`. */
1087
1300
  findText(request: XlsxFindRequest): XlsxFindResult;
1088
1301
  /** Resolves, stages and rehearses a batch like `applyEdits`, changing nothing. */
1089
1302
  validateEdits(request: XlsxEditRequest): XlsxValidationResult;
@@ -1103,8 +1316,15 @@ interface WorkbookHandle extends CollaborationReplica {
1103
1316
  dispose(): void;
1104
1317
  }
1105
1318
  type WasmInitInput = InitInput | Promise<InitInput>;
1319
+ interface WasmInitOptions {
1320
+ /**
1321
+ * `false` loads the smaller core without peer snapshots or standalone
1322
+ * {@link renderXlsxMarkdown}; `exportMarkdown` on a workbook still works.
1323
+ */
1324
+ png?: boolean;
1325
+ }
1106
1326
  /** Initialize the workbook engine. Concurrent calls share the same attempt. */
1107
- declare function initWasm(input?: WasmInitInput): Promise<void>;
1327
+ declare function initWasm(input?: WasmInitInput, options?: WasmInitOptions): Promise<void>;
1108
1328
  /** Maximum counted cells per frame, including boundary and frozen tracks; call after `initWasm`. */
1109
1329
  declare function getDisplayListCellLimit(): number;
1110
1330
  /**
@@ -1112,9 +1332,8 @@ declare function getDisplayListCellLimit(): number;
1112
1332
  */
1113
1333
  declare function isWasmAvailable(): boolean;
1114
1334
  /**
1115
- * Whether the embedded wasm core was built with png export (the `raster` cargo
1116
- * feature). The wasm-bindgen method only exists on the class when compiled in,
1117
- * so chrome can disable an export control instead of calling and catching.
1335
+ * Whether `renderPng` can draw here through a canvas or the native engine.
1336
+ * Callers can disable an export control instead of calling and catching.
1118
1337
  */
1119
1338
  declare function isPngExportAvailable(): boolean;
1120
1339
  /**
@@ -1128,6 +1347,21 @@ declare function isProposalsAvailable(): boolean;
1128
1347
  * Throws an `Error` if the bytes are not a readable workbook.
1129
1348
  */
1130
1349
  declare function openWorkbook(bytes: Uint8Array, options?: OpenWorkbookOptions): WorkbookHandle;
1350
+ /**
1351
+ * @internal Formulas, without their `=`, moved from one cell to another as a paste moves them, by
1352
+ * the engine of `handle`; per item the moved formula, or why a paste would refuse it.
1353
+ */
1354
+ declare function translateFormulasOn(handle: WorkbookHandle, items: readonly {
1355
+ formula: string;
1356
+ from: CellPoint;
1357
+ to: CellPoint;
1358
+ }[]): ({
1359
+ ok: true;
1360
+ formula: string;
1361
+ } | {
1362
+ ok: false;
1363
+ error: string;
1364
+ })[];
1131
1365
  /**
1132
1366
  * Exports `.xlsx` bytes as read, initializing the core if needed. Formula results are the
1133
1367
  * stored ones: nothing is recalculated and no clock is read, so the same bytes and options
@@ -1143,6 +1377,96 @@ declare function renderXlsxMarkdown(content: XlsxStructuredContent, options?: Xl
1143
1377
  */
1144
1378
  declare function wasmVersion(): string;
1145
1379
 
1380
+ /** A sheet by zero-based index or by tab name. */
1381
+ type XlsxSheetRef = number | string;
1382
+ /** A cell range as an A1 string, an A1 object, or zero-based row and column corners. */
1383
+ type XlsxRangeAddress = string | {
1384
+ kind: 'a1';
1385
+ a1: string;
1386
+ } | {
1387
+ kind: 'rowCol';
1388
+ start: {
1389
+ row: number;
1390
+ col: number;
1391
+ };
1392
+ end: {
1393
+ row: number;
1394
+ col: number;
1395
+ };
1396
+ };
1397
+ /**
1398
+ * What `renderPng` draws: a viewport of a sheet, or a cell range of it.
1399
+ * `range: 'used'` draws the sheet's used range as the engine finds it at call time.
1400
+ */
1401
+ type XlsxPngTarget = {
1402
+ sheet: number | string;
1403
+ viewport: Viewport;
1404
+ } | {
1405
+ sheet: number | string;
1406
+ range: XlsxRangeAddress | 'used';
1407
+ };
1408
+ /** A font face an export paints with, the same shape as `VsdxFontFace`. */
1409
+ interface XlsxFontFace {
1410
+ family: string;
1411
+ bold?: boolean;
1412
+ italic?: boolean;
1413
+ bytes: Uint8Array;
1414
+ }
1415
+ /**
1416
+ * A family and style a PNG export paints, for callers that supply faces.
1417
+ * @internal
1418
+ */
1419
+ interface XlsxPngFont {
1420
+ family: string;
1421
+ bold: boolean;
1422
+ italic: boolean;
1423
+ }
1424
+ interface XlsxPngOptions {
1425
+ /** Device pixels per sheet pixel. Defaults to 1. */
1426
+ scale?: number;
1427
+ /** Largest PNG width in pixels; a wider target is cut at its right edge. */
1428
+ maxWidth?: number;
1429
+ /** Largest PNG height in pixels; a taller target is cut at its bottom edge. */
1430
+ maxHeight?: number;
1431
+ signal?: AbortSignal;
1432
+ /**
1433
+ * Faces to paint the sheet's fonts with, matched by family and style. Each
1434
+ * export installs them under private names and drops them afterwards; one
1435
+ * that fails to load rejects with `PngExportError` `font-unavailable`. The
1436
+ * editors pass the faces they paint with. Without this option the export
1437
+ * loads the bundled faces `@betteroffice/xlsx-native` draws the sheet's fonts
1438
+ * with, and rejects if one fails to load. A list, even an empty one, replaces
1439
+ * them: a family it does not cover is painted with the engine's built-in
1440
+ * substitute.
1441
+ */
1442
+ fonts?: ReadonlyArray<XlsxFontFace>;
1443
+ }
1444
+
1445
+ /** Format-owned, structured-cloneable methods. */
1446
+ type SessionMethods = Record<string, (...args: any[]) => unknown>;
1447
+ type Promisified<M extends SessionMethods> = {
1448
+ [K in keyof M]: (...args: Parameters<M[K]>) => Promise<Awaited<ReturnType<M[K]>>>;
1449
+ };
1450
+ interface SessionState {
1451
+ format: string;
1452
+ stage: 'preview' | 'ready';
1453
+ version: number;
1454
+ dirty: boolean;
1455
+ }
1456
+ type SessionFailureCode = 'crash' | 'trap' | 'out-of-memory' | 'message' | 'silence' | 'disposed';
1457
+ /** A terminal session failure. */
1458
+ declare class SessionFailure extends Error {
1459
+ readonly code: SessionFailureCode;
1460
+ readonly diagnostics?: string | undefined;
1461
+ constructor(code: SessionFailureCode, message: string, diagnostics?: string | undefined);
1462
+ }
1463
+
1464
+ /** @internal */
1465
+ interface FontCdnConfiguration {
1466
+ baseUrl: string | false;
1467
+ timeoutMs: number;
1468
+ }
1469
+
1146
1470
  /** @internal */
1147
1471
  type BaseRefusal = 'read-only' | 'stale' | 'superseded' | 'not-ready' | 'busy' | 'disposed' | 'invalid-payload' | 'unsupported' | 'dependency-refused' | 'unknown-outcome';
1148
1472
  /** @internal */
@@ -1235,6 +1559,7 @@ type CommandAck$1<S, E, F> = {
1235
1559
  version: number;
1236
1560
  outcomes: CommandOutcome[];
1237
1561
  selection?: S;
1562
+ cause?: 'remote';
1238
1563
  editState?: E;
1239
1564
  frame?: FrameEnvelope<F>;
1240
1565
  revisions?: {
@@ -1268,6 +1593,8 @@ type CommandLane = 'input' | 'collab' | 'background';
1268
1593
  type SubmitOptions<X> = {
1269
1594
  lane?: CommandLane;
1270
1595
  after?: CommandTicket;
1596
+ /** Keep this command unsent until its dependency settles. */
1597
+ waitForAfter?: boolean;
1271
1598
  expectVersion?: boolean;
1272
1599
  inputTime?: number;
1273
1600
  lastInputTime?: number;
@@ -1307,6 +1634,7 @@ type EditSessionState<S, E> = {
1307
1634
  throughSeq: number;
1308
1635
  presentedThroughSeq: number;
1309
1636
  selection: S | undefined;
1637
+ selectionCause?: 'remote';
1310
1638
  editState: E | undefined;
1311
1639
  };
1312
1640
  /** @internal Shared asynchronous editor contract for worker and legacy backends. */
@@ -1401,6 +1729,7 @@ type WorkerEditSessionOptions<O, P, S, E, F, X, Q extends QueryTable = {}> = {
1401
1729
  declare const WORKBOOK_REPLAY_MUTATORS: {
1402
1730
  editCell: true;
1403
1731
  editCells: true;
1732
+ fillRange: true;
1404
1733
  applyEdits: true;
1405
1734
  applyOps: true;
1406
1735
  propose: true;
@@ -1410,16 +1739,21 @@ declare const WORKBOOK_REPLAY_MUTATORS: {
1410
1739
  setNumberFormat: true;
1411
1740
  applyFormat: true;
1412
1741
  moveChart: true;
1742
+ resizeChart: true;
1413
1743
  moveRange: true;
1414
1744
  undo: true;
1415
1745
  redo: true;
1416
1746
  setActiveSheet: true;
1417
1747
  };
1418
1748
  type WorkbookReplayMethod = keyof typeof WORKBOOK_REPLAY_MUTATORS;
1749
+ type DirectWriteMethod = 'editCell' | 'editCells' | 'patchRangeStyle' | 'setNumberFormat' | 'applyFormat' | 'moveChart' | 'resizeChart';
1750
+ type WithoutLast<P extends unknown[]> = P extends [...infer Head, unknown] ? Head : P;
1751
+ /** Replayed arguments; a direct write's trailing `XlsxWriteOptions` never replays. */
1752
+ type WorkbookReplayArgs<K extends WorkbookReplayMethod> = K extends DirectWriteMethod ? WithoutLast<Required<Parameters<WorkbookHandle[K]>>> : Parameters<WorkbookHandle[K]>;
1419
1753
  type WorkbookReplayOp = {
1420
1754
  [K in WorkbookReplayMethod]: {
1421
1755
  method: K;
1422
- args: Parameters<WorkbookHandle[K]>;
1756
+ args: WorkbookReplayArgs<K>;
1423
1757
  };
1424
1758
  }[WorkbookReplayMethod] & {
1425
1759
  calculation?: WorkbookCalculationContext;
@@ -1531,6 +1865,7 @@ type WorkbookCommandPayload<K extends WorkbookCommandKind> = K extends WorkbookR
1531
1865
  updates?: Uint8Array[];
1532
1866
  } : {
1533
1867
  readOnly: boolean;
1868
+ allowHostProposals?: boolean;
1534
1869
  };
1535
1870
  interface WorkbookCommandFrameRequest {
1536
1871
  sheet: number;
@@ -1605,6 +1940,9 @@ type WorkbookCommandTicket = Omit<CommandTicket, 'ack'> & {
1605
1940
  type WorkbookSubmitOptions<X = unknown> = SubmitOptions<X>;
1606
1941
  type WorkbookEchoHooks<X = unknown> = EchoHooks<X, WorkbookCommandFrame>;
1607
1942
 
1943
+ /** PNG options a session call carries; an abort signal stays on the caller's side. */
1944
+ type WorkbookPngOptions = Omit<XlsxPngOptions, 'signal'>;
1945
+
1608
1946
  /** @experimental */
1609
1947
  declare class WorkbookPngUnavailableError extends Error {
1610
1948
  readonly code = "png-unavailable";
@@ -1657,6 +1995,9 @@ type WorkbookWireFrame = Omit<WorkbookFrame, 'displayList'> & {
1657
1995
  */
1658
1996
  interface WorkbookSessionOpenOptions extends OpenWorkbookOptions {
1659
1997
  wasm?: ArrayBuffer | WebAssembly.Module;
1998
+ /** @internal */
1999
+ fontCdn?: FontCdnConfiguration;
2000
+ png?: boolean;
1660
2001
  initialViewport?: WorkbookInitialPaintRequest;
1661
2002
  includeEditState?: boolean;
1662
2003
  initialUpdate?: Uint8Array;
@@ -1727,9 +2068,10 @@ interface WorkbookSessionEvents {
1727
2068
  * Workbook RPC methods; engine version tokens remain strings.
1728
2069
  * @experimental
1729
2070
  */
1730
- type WorkbookSessionMethods = {
2071
+ type WorkbookSessionMethods = FontDecoderMethods & {
1731
2072
  open(bytes: ArrayBuffer, options?: WorkbookSessionOpenOptions): WorkbookSessionOpenReply;
1732
- openRecovery(checkpoint: Checkpoint, options?: Pick<WorkbookSessionOpenOptions, 'wasm'>): WorkbookSessionOpenReply;
2073
+ /** Checkpoints are only restorable by the same engine version and codec. */
2074
+ openRecovery(checkpoint: Checkpoint, options?: Pick<WorkbookSessionOpenOptions, 'wasm' | 'png' | 'fontCdn'>): WorkbookSessionOpenReply;
1733
2075
  version(): string;
1734
2076
  collaborationStateVector(): Uint8Array;
1735
2077
  collaborationStateAsUpdate(remoteStateVector?: Uint8Array): Uint8Array;
@@ -1740,25 +2082,43 @@ type WorkbookSessionMethods = {
1740
2082
  applyEdits(request: XlsxEditRequest): XlsxEditResult;
1741
2083
  command(command: WorkbookCommand): WorkbookWireAck;
1742
2084
  edit(command: WorkbookSharedCommand): WorkbookSharedWireAck;
2085
+ /** Checkpoints are only restorable by the same engine version and codec. */
1743
2086
  checkpoint(preserveHistory?: boolean): WorkbookCheckpoint;
1744
2087
  commandFrame(request?: WorkbookCommandFrameRequest): FrameEnvelope<WorkbookCommandWireFrame> | undefined;
1745
2088
  frame(viewport: Viewport, options?: WorkbookFrameOptions): WorkbookWireFrame;
1746
2089
  sheetView(sheet: number): WorkbookSheetView;
1747
2090
  cellGeometry(sheet: number, row: number, col: number): WorkbookCellGeometry;
1748
2091
  cellInputs(sheet: number, range: string): WorkbookCellInputs;
2092
+ /** @internal Formulas, without their `=`, moved between cells as a paste moves them. */
2093
+ translateFormulas(items: readonly {
2094
+ formula: string;
2095
+ from: CellPoint;
2096
+ to: CellPoint;
2097
+ }[]): ({
2098
+ ok: true;
2099
+ formula: string;
2100
+ } | {
2101
+ ok: false;
2102
+ error: string;
2103
+ })[];
1749
2104
  selectionData(sheet: number, row: number, col: number, direction?: Direction | 'usedRange' | 'rowEnd' | 'merge'): SelectionData;
1750
2105
  captureFormat(sheet: number, range: string): CapturedFormat;
1751
2106
  sheets(): WorkbookSheetSummary[];
1752
2107
  calculationStatus(): CalculationStatus;
1753
- renderPng(viewport: Viewport, options?: WorkbookFrameOptions): ArrayBuffer;
1754
- renderRangePng(options?: {
1755
- range?: string;
1756
- scale?: number;
1757
- }, frameOptions?: WorkbookFrameOptions): ArrayBuffer;
2108
+ renderPng(target: XlsxPngTarget, options?: WorkbookPngOptions): ArrayBuffer;
2109
+ /**
2110
+ * The fonts `renderPng` would paint for the same target. The editors use it to forward the faces they paint with; not public until every format has it.
2111
+ * @internal
2112
+ */
2113
+ renderPngFonts(target: XlsxPngTarget, options?: WorkbookPngOptions): XlsxPngFont[];
1758
2114
  exportStructured(options?: XlsxExportOptions): XlsxExportResult<XlsxStructuredContent>;
1759
2115
  exportMarkdown(options?: XlsxExportOptions, markdownOptions?: XlsxMarkdownOptions): XlsxExportResult<XlsxMarkdownContent>;
1760
2116
  printDisplayList(sheet: number, range: string, metrics: PrintMetrics, gridlines: boolean): ArrayBuffer;
1761
2117
  save(): ArrayBuffer;
2118
+ saveWithWarnings(): {
2119
+ bytes: ArrayBuffer;
2120
+ warnings: SaveWarning[];
2121
+ };
1762
2122
  dispose(): void;
1763
2123
  };
1764
2124
 
@@ -1792,6 +2152,7 @@ declare function createWorkbookEditSession<X = unknown>(options: Omit<SessionOpt
1792
2152
  interface OpenWorkbookSessionOptions extends OpenWorkbookOptions {
1793
2153
  worker?: () => Worker;
1794
2154
  wasm?: ArrayBuffer | WebAssembly.Module;
2155
+ png?: boolean;
1795
2156
  /** Retain source bytes and a compiled module for edit peer hydration. */
1796
2157
  retainPeerHydration?: boolean;
1797
2158
  /** Aborting closes the session worker while the open is still in flight. */
@@ -1821,12 +2182,9 @@ interface WorkbookSession {
1821
2182
  onAck(listener: (ack: WorkbookAck) => void): () => void;
1822
2183
  markPresented(frame: WorkbookCommandFrame | Pick<WorkbookCommandFrame, 'session' | 'incarnation' | 'coversThroughSeq'>): boolean;
1823
2184
  whenPresented(seq: number): Promise<void>;
1824
- readonly call: Promisified<Omit<WorkbookSessionMethods, 'open' | 'openRecovery' | 'dispose' | 'frame' | 'command' | 'edit' | 'checkpoint' | 'commandFrame' | 'renderPng' | 'renderRangePng' | 'printDisplayList'>> & {
1825
- renderPng(viewport: Viewport, options?: WorkbookFrameOptions): Promise<Uint8Array>;
1826
- renderRangePng(options?: {
1827
- range?: string;
1828
- scale?: number;
1829
- }, frameOptions?: WorkbookFrameOptions): Promise<Uint8Array>;
2185
+ readonly call: Promisified<Omit<WorkbookSessionMethods, 'open' | 'openRecovery' | 'dispose' | 'frame' | 'command' | 'edit' | 'checkpoint' | 'commandFrame' | 'decodeFontFace' | 'renderPng' | 'printDisplayList'>> & {
2186
+ decodeFontFace: FontDecoder;
2187
+ renderPng(target: XlsxPngTarget, options?: XlsxPngOptions): Promise<Uint8Array>;
1830
2188
  printDisplayList(...args: Parameters<WorkbookHandle['printDisplayList']>): Promise<ReturnType<WorkbookHandle['printDisplayList']>>;
1831
2189
  command(command: WorkbookCommand): Promise<WorkbookAck>;
1832
2190
  /**
@@ -1835,7 +2193,10 @@ interface WorkbookSession {
1835
2193
  */
1836
2194
  frame(viewport: Viewport, options?: WorkbookFrameOptions): Promise<WorkbookFrame>;
1837
2195
  };
2196
+ /** saved bytes; each save warning is also emitted as a Node process warning on this thread. */
1838
2197
  save(): Promise<Uint8Array>;
2198
+ /** saved bytes with a warning for every part the save wrote differently from what the workbook holds. */
2199
+ saveWithWarnings(): Promise<SaveResult>;
1839
2200
  on<K extends keyof WorkbookSessionEvents>(name: K, listener: (payload: WorkbookSessionEvents[K]) => void): () => void;
1840
2201
  onFailure(listener: (failure: SessionFailure) => void): () => void;
1841
2202
  readonly failure: SessionFailure | undefined;
@@ -1867,6 +2228,12 @@ interface WorkbookSessionRecovery {
1867
2228
  /** @experimental */
1868
2229
  declare const workbookSessionRecovery: WeakMap<WorkbookSession, WorkbookSessionRecovery>;
1869
2230
 
2231
+ type PngExportCode = 'canvas-unavailable' | 'canvas-too-large' | 'font-unavailable' | 'picture-unavailable';
2232
+ declare class PngExportError extends Error {
2233
+ readonly code: PngExportCode;
2234
+ constructor(code: PngExportCode, message: string);
2235
+ }
2236
+
1870
2237
  type WorkbookPeerHydrationErrorCode = 'mutation-outside-replay' | 'version-mismatch' | 'missing-hydration' | 'missing-module';
1871
2238
  declare class WorkbookPeerHydrationError extends Error {
1872
2239
  readonly code: WorkbookPeerHydrationErrorCode;
@@ -1903,4 +2270,4 @@ declare class WorkbookEditPeerFailedError extends Error {
1903
2270
  /** @internal */
1904
2271
  declare function createWorkbookEditPeer(options: WorkbookEditPeerOptions): WorkbookEditPeer;
1905
2272
 
1906
- export { type TextWrapping as $, type ExportSeverity as A, type BorderPatch as B, type CalculationStatus as C, type DifferentialFormatInput as D, type EditProfile as E, type HorizontalAlignment as F, type MergedRange as G, type HistoryState as H, type NumberFormatMutation as I, type OpenWorkbookSessionOptions as J, type OperationFailure as K, type OperationRefusal as L, type MarkdownAnchor as M, type NumberFormat as N, type OpenWorkbookOptions as O, type PrintMetrics as P, type ProfiledDisplayList as Q, type ProfiledEditResult as R, type Proposal as S, type ProposalCell as T, type ProposalEdit as U, type RangeStylePatch as V, type SelectionFormatting as W, type SheetInfo as X, StaleProposalError as Y, type StaleProposalTarget as Z, type StyleProperty as _, type BorderPreset as a, type XlsxExportOptions as a$, type ValidationSuccess as a0, type VerticalAlignment as a1, type Viewport as a2, type WasmInitInput as a3, type WorkbookCalculationContext as a4, type WorkbookCellGeometry as a5, type WorkbookCellInputs as a6, WorkbookEditPeerFailedError as a7, type WorkbookEditSession as a8, type WorkbookFrame as a9, type XlsxCellValue as aA, type XlsxDefinedName as aB, type XlsxDefinedNameOp as aC, type XlsxDefinedNamesRequest as aD, type XlsxDefinedNamesResult as aE, type XlsxEditCalculation as aF, type XlsxEditFailure as aG, type XlsxEditFailureCode as aH, type XlsxEditHistory as aI, type XlsxEditOperation as aJ, type XlsxEditPreview as aK, type XlsxEditReceipt as aL, type XlsxEditRefusal as aM, type XlsxEditRequest as aN, type XlsxEditResult as aO, type XlsxEditSource as aP, type XlsxEditStep as aQ, type XlsxErrorValue as aR, type XlsxExportCell as aS, type XlsxExportDefinedName as aT, type XlsxExportDiagnostic as aU, type XlsxExportDiagnosticCode as aV, type XlsxExportFailure as aW, type XlsxExportFailureCode as aX, type XlsxExportHyperlink as aY, type XlsxExportMerge as aZ, type XlsxExportObject as a_, type WorkbookFrameOptions as aa, type WorkbookHandle as ab, type WorkbookHyperlink as ac, type WorkbookInitialPaint as ad, type WorkbookInitialPaintRequest as ae, WorkbookPeerHydrationError as af, WorkbookPngUnavailableError as ag, WorkbookRecoveryReplayError as ah, type WorkbookSession as ai, type WorkbookSessionEvents as aj, type WorkbookSessionMethods as ak, type WorkbookSessionOpenOptions as al, type WorkbookSessionOpenReply as am, type WorkbookSessionRecovery as an, type WorkbookSessionState as ao, type WorkbookSheetSummary as ap, type WorkbookSheetView as aq, type WorkbookUpdateInfo as ar, type WorkbookUpdateListener as as, type WorkbookUpdateOrigin as at, type XlsxAnchor as au, type XlsxAutoFilterOp as av, type XlsxCellAddress as aw, type XlsxCellGuard as ax, type XlsxCellPosition as ay, type XlsxCellRead as az, type BorderStyle as b, type WorkbookSharedWireAck as b$, type XlsxExportResult as b0, type XlsxExportScope as b1, type XlsxExportSheet as b2, type XlsxExportTable as b3, type XlsxExportValue as b4, type XlsxFindMatch as b5, type XlsxFindRequest as b6, type XlsxFindResult as b7, type XlsxFormulaResult as b8, type XlsxMarkdownContent as b9, wasmVersion as bA, workbookSessionRecovery as bB, type WorkbookReplayReply as bC, type WorkbookEditPeer as bD, type WorkbookReplayMethod as bE, type WorkbookReplayOp as bF, type CommandBasis as bG, type CommandIdentity as bH, type CommandStatus as bI, type WorkbookAck as bJ, type WorkbookCommand as bK, type WorkbookCommandContext as bL, type WorkbookCommandFrame as bM, type WorkbookCommandFrameRequest as bN, type WorkbookCommandKind as bO, type WorkbookCommandPayload as bP, type WorkbookCommandSelection as bQ, type WorkbookCommandTicket as bR, type WorkbookEchoHooks as bS, type WorkbookEditConnection as bT, type WorkbookEditFrame as bU, type WorkbookEditPayload as bV, type WorkbookEditPeerOptions as bW, type WorkbookEditState as bX, type WorkbookSharedAck as bY, type WorkbookSharedCommand as bZ, type WorkbookSharedOutcome as b_, type XlsxMarkdownOptions as ba, type XlsxObjectKind as bb, type XlsxRangeAddress as bc, type XlsxRangeRead as bd, type XlsxRangeTarget as be, type XlsxReadCalculation as bf, type XlsxReadRequest as bg, type XlsxReadResult as bh, type XlsxSheetEntry as bi, type XlsxSheetIdentity as bj, type XlsxSourcePart as bk, type XlsxStructuredContent as bl, type XlsxTextMatch as bm, type XlsxTextSearchOptions as bn, type XlsxValidationResult as bo, createWorkbookEditSession as bp, exportXlsxMarkdown as bq, exportXlsxStructured as br, getDisplayListCellLimit as bs, initWasm as bt, isPngExportAvailable as bu, isProposalsAvailable as bv, isWasmAvailable as bw, openWorkbook as bx, openWorkbookSession as by, renderXlsxMarkdown as bz, type CapturedBorderEdge as c, type WorkbookSubmitOptions as c0, type WorkbookTicketOutcome as c1, createWorkbookEditPeer as c2, hydratePeer as c3, workbookSessionInternals as c4, type CapturedBorderStyle as d, type CapturedCellFormat as e, type CapturedColor as f, type CapturedFill as g, type CapturedFormat as h, type CellEdit as i, type CellInputEdit as j, type CellPoint as k, type CellPosition as l, type ChartEdit as m, type ChartInfo as n, type ChartMutation as o, type ChartSeriesInfo as p, type ChartSeriesName as q, type ConditionalFormatInfo as r, type ConditionalFormatOp as s, type ConditionalFormatRuleInput as t, type DisplayListProfile as u, DisplayTooLargeError as v, type EditResult as w, type EditSuccess as x, type ExportCompletion as y, type ExportDiagnostic as z };
2273
+ export { type WorkbookSubmitOptions as $, type WorkbookEditState as A, type WorkbookFrame as B, type CommandBasis as C, type WorkbookFrameOptions as D, type WorkbookInitialPaint as E, type WorkbookInitialPaintRequest as F, WorkbookPeerHydrationError as G, type WorkbookPngOptions as H, WorkbookPngUnavailableError as I, WorkbookRecoveryReplayError as J, type WorkbookSession as K, type WorkbookSessionEvents as L, type WorkbookSessionMethods as M, type WorkbookSessionOpenOptions as N, type OpenWorkbookSessionOptions as O, type PngExportCode as P, type WorkbookSessionOpenReply as Q, type WorkbookSessionRecovery as R, type SaveResult as S, type WorkbookSessionState as T, type WorkbookSharedAck as U, type WorkbookSharedCommand as V, type WorkbookReplayReply as W, type WorkbookSharedOutcome as X, type WorkbookSharedWireAck as Y, type WorkbookSheetSummary as Z, type WorkbookSheetView as _, type WorkbookEditPeer as a, StaleProposalError as a$, type WorkbookTicketOutcome as a0, type XlsxFontFace as a1, type XlsxPngFont as a2, type XlsxPngOptions as a3, type XlsxPngTarget as a4, type XlsxRangeAddress as a5, type XlsxSheetRef as a6, createWorkbookEditPeer as a7, createWorkbookEditSession as a8, hydratePeer as a9, type DifferentialFormatInput as aA, type DisplayListProfile as aB, DisplayTooLargeError as aC, type EditProfile as aD, type EditResult as aE, type EditSuccess as aF, type ExportCompletion as aG, type ExportDiagnostic as aH, type ExportSeverity as aI, type HistoryState as aJ, type HorizontalAlignment as aK, type MarkdownAnchor as aL, type MergedRange as aM, type NumberFormat as aN, type NumberFormatMutation as aO, type OpenWorkbookOptions as aP, type OperationFailure as aQ, type OperationRefusal as aR, type PrintMetrics as aS, type ProfiledDisplayList as aT, type ProfiledEditResult as aU, type Proposal as aV, type ProposalCell as aW, type ProposalEdit as aX, type RangeStylePatch as aY, type SelectionFormatting as aZ, type SheetInfo as a_, openWorkbookSession as aa, workbookSessionInternals as ab, workbookSessionRecovery as ac, type BorderPatch as ad, type BorderPreset as ae, type BorderStyle as af, type CalculationStatus as ag, type CapturedBorderEdge as ah, type CapturedBorderStyle as ai, type CapturedCellFormat as aj, type CapturedColor as ak, type CapturedFill as al, type CapturedFormat as am, type CellEdit as an, type CellInputEdit as ao, type CellPoint as ap, type CellPosition as aq, type ChartEdit as ar, type ChartInfo as as, type ChartMutation as at, type ChartResizeEdges as au, type ChartSeriesInfo as av, type ChartSeriesName as aw, type ConditionalFormatInfo as ax, type ConditionalFormatOp as ay, type ConditionalFormatRuleInput as az, type WorkbookReplayMethod as b, type XlsxRangeAddress$1 as b$, type StaleProposalTarget as b0, type StyleProperty as b1, type TextWrapping as b2, type UnevaluatedCellStatus as b3, type ValidationSuccess as b4, type VerticalAlignment as b5, type Viewport as b6, type WasmInitInput as b7, type WasmInitOptions as b8, type WorkbookCalculationContext as b9, type XlsxEditSource as bA, type XlsxEditStep as bB, type XlsxErrorValue as bC, type XlsxExportCell as bD, type XlsxExportDefinedName as bE, type XlsxExportDiagnostic as bF, type XlsxExportDiagnosticCode as bG, type XlsxExportFailure as bH, type XlsxExportFailureCode as bI, type XlsxExportHyperlink as bJ, type XlsxExportMerge as bK, type XlsxExportObject as bL, type XlsxExportOptions as bM, type XlsxExportResult as bN, type XlsxExportScope as bO, type XlsxExportSheet as bP, type XlsxExportTable as bQ, type XlsxExportValue as bR, type XlsxFindMatch as bS, type XlsxFindRequest as bT, type XlsxFindResult as bU, type XlsxFormulaResult as bV, type XlsxHeaderFooterPair as bW, type XlsxHeaderFooterText as bX, type XlsxMarkdownContent as bY, type XlsxMarkdownOptions as bZ, type XlsxObjectKind as b_, type WorkbookHandle as ba, type WorkbookHyperlink as bb, type WorkbookUpdateInfo as bc, type WorkbookUpdateListener as bd, type WorkbookUpdateOrigin as be, type XlsxAnchor as bf, type XlsxAutoFilterOp as bg, type XlsxCellAddress as bh, type XlsxCellGuard as bi, type XlsxCellPosition as bj, type XlsxCellRead as bk, type XlsxCellValue as bl, type XlsxDefinedName as bm, type XlsxDefinedNameOp as bn, type XlsxDefinedNamesRequest as bo, type XlsxDefinedNamesResult as bp, type XlsxEditCalculation as bq, type XlsxEditFailure as br, type XlsxEditFailureCode as bs, type XlsxEditHistory as bt, type XlsxEditOperation as bu, type XlsxEditPreview as bv, type XlsxEditReceipt as bw, type XlsxEditRefusal as bx, type XlsxEditRequest as by, type XlsxEditResult as bz, type WorkbookReplayOp as c, type XlsxRangeRead as c0, type XlsxRangeTarget as c1, type XlsxReadCalculation as c2, type XlsxReadRequest as c3, type XlsxReadResult as c4, type XlsxReplaceStats as c5, type XlsxSheetEntry as c6, type XlsxSheetHeaderFooter as c7, type XlsxSheetIdentity as c8, type XlsxSheetVisibility as c9, type XlsxSourcePart as ca, type XlsxStructuredContent as cb, type XlsxTextMatch as cc, type XlsxTextSearchOptions as cd, type XlsxUnevaluatedCell as ce, type XlsxValidationResult as cf, type XlsxWriteOptions as cg, decodeFontFace as ch, exportXlsxMarkdown as ci, exportXlsxStructured as cj, getDisplayListCellLimit as ck, initWasm as cl, isPngExportAvailable as cm, isProposalsAvailable as cn, isWasmAvailable as co, openWorkbook as cp, renderXlsxMarkdown as cq, translateFormulasOn as cr, wasmVersion as cs, type CommandIdentity as d, type CommandStatus as e, PngExportError as f, type SaveWarning as g, type SaveWarningCode as h, type WorkbookAck as i, type WorkbookCellGeometry as j, type WorkbookCellInputs as k, type WorkbookCommand as l, type WorkbookCommandContext as m, type WorkbookCommandFrame as n, type WorkbookCommandFrameRequest as o, type WorkbookCommandKind as p, type WorkbookCommandPayload as q, type WorkbookCommandSelection as r, type WorkbookCommandTicket as s, type WorkbookEchoHooks as t, type WorkbookEditConnection as u, type WorkbookEditFrame as v, type WorkbookEditPayload as w, WorkbookEditPeerFailedError as x, type WorkbookEditPeerOptions as y, type WorkbookEditSession as z };