@pixerate/editor 0.25.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +30 -0
  2. package/THIRD_PARTY_NOTICES.md +11 -0
  3. package/dist/agent/index.cjs +174 -11
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +18 -4
  6. package/dist/agent/index.d.ts +18 -4
  7. package/dist/agent/index.js +167 -4
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/{arrangeShortcuts-B8O3f8-P.d.cts → arrange-BICutYPk.d.cts} +243 -29
  10. package/dist/{arrangeShortcuts-sLlD2rSX.d.ts → arrange-BICutYPk.d.ts} +243 -29
  11. package/dist/builtins-CdPcLwwF.d.cts +176 -0
  12. package/dist/builtins-Chj6zv_O.d.ts +176 -0
  13. package/dist/canvas/index.cjs +3917 -19
  14. package/dist/canvas/index.cjs.map +1 -1
  15. package/dist/canvas/index.d.cts +1232 -7
  16. package/dist/canvas/index.d.ts +1232 -7
  17. package/dist/canvas/index.js +3916 -18
  18. package/dist/canvas/index.js.map +1 -1
  19. package/dist/chunk-3CC7OPUQ.cjs +831 -0
  20. package/dist/chunk-3CC7OPUQ.cjs.map +1 -0
  21. package/dist/{chunk-7WISYZFO.cjs → chunk-66IMF6OD.cjs} +174 -67
  22. package/dist/chunk-66IMF6OD.cjs.map +1 -0
  23. package/dist/{chunk-AL6JMGWW.cjs → chunk-CS6NZWWA.cjs} +24 -24
  24. package/dist/{chunk-AL6JMGWW.cjs.map → chunk-CS6NZWWA.cjs.map} +1 -1
  25. package/dist/{chunk-C7P22VIP.cjs → chunk-EWCOFSCQ.cjs} +17 -6
  26. package/dist/chunk-EWCOFSCQ.cjs.map +1 -0
  27. package/dist/chunk-HDYMLS3X.cjs +409 -0
  28. package/dist/chunk-HDYMLS3X.cjs.map +1 -0
  29. package/dist/{chunk-V3CHHWOE.cjs → chunk-HNDSPZ5T.cjs} +4 -4
  30. package/dist/{chunk-V3CHHWOE.cjs.map → chunk-HNDSPZ5T.cjs.map} +1 -1
  31. package/dist/{chunk-X4N4WUKB.cjs → chunk-IFHKKVXH.cjs} +150 -38
  32. package/dist/chunk-IFHKKVXH.cjs.map +1 -0
  33. package/dist/chunk-KRGXUQ2Y.js +1696 -0
  34. package/dist/chunk-KRGXUQ2Y.js.map +1 -0
  35. package/dist/{chunk-PO6A6QQH.cjs → chunk-LN2POBHT.cjs} +742 -970
  36. package/dist/chunk-LN2POBHT.cjs.map +1 -0
  37. package/dist/chunk-MR2764X2.js +831 -0
  38. package/dist/chunk-MR2764X2.js.map +1 -0
  39. package/dist/{chunk-WSQKHXW7.cjs → chunk-NQF32I6Z.cjs} +1209 -457
  40. package/dist/chunk-NQF32I6Z.cjs.map +1 -0
  41. package/dist/{chunk-NAXVVS5I.js → chunk-QJSOZFCZ.js} +2 -2
  42. package/dist/{chunk-UAKDG62Z.js → chunk-SWE3NPOU.js} +116 -4
  43. package/dist/chunk-SWE3NPOU.js.map +1 -0
  44. package/dist/chunk-TXXNBDQX.cjs +1696 -0
  45. package/dist/chunk-TXXNBDQX.cjs.map +1 -0
  46. package/dist/chunk-UBCFIABU.js +409 -0
  47. package/dist/chunk-UBCFIABU.js.map +1 -0
  48. package/dist/{chunk-ECCCYKGL.js → chunk-UKI64KUD.js} +147 -40
  49. package/dist/chunk-UKI64KUD.js.map +1 -0
  50. package/dist/{chunk-QGYDWPRM.js → chunk-WON34HKM.js} +2 -2
  51. package/dist/{chunk-RR7F5GUM.js → chunk-X7HXL2SB.js} +941 -189
  52. package/dist/chunk-X7HXL2SB.js.map +1 -0
  53. package/dist/{chunk-IXHSYOVY.js → chunk-XQFHLT53.js} +638 -866
  54. package/dist/chunk-XQFHLT53.js.map +1 -0
  55. package/dist/{chunk-FH6F67DN.js → chunk-ZRNHGAQT.js} +17 -6
  56. package/dist/{chunk-FH6F67DN.js.map → chunk-ZRNHGAQT.js.map} +1 -1
  57. package/dist/commands/index.cjs +352 -4
  58. package/dist/commands/index.cjs.map +1 -1
  59. package/dist/commands/index.d.cts +37 -108
  60. package/dist/commands/index.d.ts +37 -108
  61. package/dist/commands/index.js +351 -3
  62. package/dist/commands/index.js.map +1 -1
  63. package/dist/compare/index.cjs +3 -3
  64. package/dist/compare/index.js +2 -2
  65. package/dist/{controller-BIJiNoVs.d.cts → controller-CxXGOEmy.d.cts} +209 -13
  66. package/dist/{controller-BIJiNoVs.d.ts → controller-CxXGOEmy.d.ts} +209 -13
  67. package/dist/export/index.cjs +36 -0
  68. package/dist/export/index.cjs.map +1 -0
  69. package/dist/export/index.d.cts +243 -0
  70. package/dist/export/index.d.ts +243 -0
  71. package/dist/export/index.js +36 -0
  72. package/dist/export/index.js.map +1 -0
  73. package/dist/extensions/index.cjs +54 -6
  74. package/dist/extensions/index.cjs.map +1 -1
  75. package/dist/extensions/index.d.cts +7 -2
  76. package/dist/extensions/index.d.ts +7 -2
  77. package/dist/extensions/index.js +59 -11
  78. package/dist/{index-7a6bHTLy.d.ts → index-B273Zllk.d.ts} +211 -207
  79. package/dist/{index-Csd5qI8u.d.cts → index-jcJwmBYt.d.cts} +211 -207
  80. package/dist/index.cjs +146 -32
  81. package/dist/index.cjs.map +1 -1
  82. package/dist/index.d.cts +50 -14
  83. package/dist/index.d.ts +50 -14
  84. package/dist/index.js +138 -24
  85. package/dist/index.js.map +1 -1
  86. package/dist/registry-CED5C0lA.d.cts +204 -0
  87. package/dist/registry-CED5C0lA.d.ts +204 -0
  88. package/dist/{registry-D32LpIc4.d.cts → registry-D0GADKc7.d.cts} +1 -1
  89. package/dist/{registry-evKTP4ls.d.ts → registry-DhVUZioj.d.ts} +1 -1
  90. package/dist/serializers/index.cjs +6 -4
  91. package/dist/serializers/index.cjs.map +1 -1
  92. package/dist/serializers/index.d.cts +15 -4
  93. package/dist/serializers/index.d.ts +15 -4
  94. package/dist/serializers/index.js +5 -3
  95. package/dist/spreadsheet/index.cjs +33 -3
  96. package/dist/spreadsheet/index.cjs.map +1 -1
  97. package/dist/spreadsheet/index.d.cts +106 -3
  98. package/dist/spreadsheet/index.d.ts +106 -3
  99. package/dist/spreadsheet/index.js +32 -2
  100. package/package.json +10 -1
  101. package/dist/chunk-7WISYZFO.cjs.map +0 -1
  102. package/dist/chunk-C7P22VIP.cjs.map +0 -1
  103. package/dist/chunk-ECCCYKGL.js.map +0 -1
  104. package/dist/chunk-IXHSYOVY.js.map +0 -1
  105. package/dist/chunk-PO6A6QQH.cjs.map +0 -1
  106. package/dist/chunk-RR7F5GUM.js.map +0 -1
  107. package/dist/chunk-UAKDG62Z.js.map +0 -1
  108. package/dist/chunk-WSQKHXW7.cjs.map +0 -1
  109. package/dist/chunk-X4N4WUKB.cjs.map +0 -1
  110. package/dist/types-DX4Mh4SL.d.cts +0 -217
  111. package/dist/types-DX4Mh4SL.d.ts +0 -217
  112. /package/dist/{chunk-NAXVVS5I.js.map → chunk-QJSOZFCZ.js.map} +0 -0
  113. /package/dist/{chunk-QGYDWPRM.js.map → chunk-WON34HKM.js.map} +0 -0
@@ -654,6 +654,11 @@ interface FormulaNameDefinition {
654
654
  /** A key identifying the name (for cycle detection), e.g. `Data!RATE`. Defaults to the name. */
655
655
  key?: string;
656
656
  }
657
+ /** Hints for `EvaluationContext.resolveRange`. */
658
+ interface RangeResolveOptions {
659
+ /** The values are only aggregated by a function that ignores blank cells. */
660
+ skipBlanks?: boolean;
661
+ }
657
662
  interface EvaluationContext {
658
663
  /**
659
664
  * Value of a cell. `sheet` is set for sheet-qualified references
@@ -665,8 +670,11 @@ interface EvaluationContext {
665
670
  * Values of a rectangular range, column by column (all rows of the first
666
671
  * column, then the next column). Lookup functions rely on this order.
667
672
  * `sheet` as in `resolveCell`; return an error code for a missing sheet.
673
+ * `options.skipBlanks` is a hint that the caller ignores blank cells
674
+ * (SUM, COUNT, AVERAGE, …): a resolver may then leave them out, so sparse
675
+ * ranges cost no array slots. Returning every value is always correct.
668
676
  */
669
- resolveRange?: (startCol: string, startRow: number, endCol: string, endRow: number, sheet?: string) => any[] | string;
677
+ resolveRange?: (startCol: string, startRow: number, endCol: string, endRow: number, sheet?: string, options?: RangeResolveOptions) => any[] | string;
670
678
  resolveProperty?: (property: string) => any;
671
679
  /**
672
680
  * The spilled array anchored at a cell, for `A1#` references: its shape and
@@ -760,6 +768,10 @@ declare class FormulaEvaluator {
760
768
  private evaluateRange;
761
769
  private callFunction;
762
770
  private finishCall;
771
+ /**
772
+ * Arguments evaluated on first use. With `skipBlanks` (the function ignores
773
+ * blank cells), range arguments may come back without their blanks.
774
+ */
763
775
  private lazyArguments;
764
776
  /**
765
777
  * Applies a scalar function element by element when it receives arrays
@@ -843,19 +855,107 @@ declare function extractNameDependencies(node: ASTNode): NameDep[];
843
855
  */
844
856
  declare const columnDependencyKey: (col: string) => string;
845
857
  declare function extractCellDependencies(node: ASTNode): CellDep[];
858
+ /**
859
+ * A reference a formula reads, without expanding ranges: a single cell or
860
+ * a rectangle (`A1:B9`; a whole column `A:A` runs to `WHOLE_COLUMN_END_ROW`).
861
+ * Columns are letters, rows are 1-based; ranges are normalised (start ≤ end).
862
+ */
863
+ type ReferenceDep = ({
864
+ kind: 'cell';
865
+ col: string;
866
+ row: number;
867
+ } & Pick<CellDep, 'sheet' | 'sheetEnd'>) | ({
868
+ kind: 'range';
869
+ startCol: string;
870
+ startRow: number;
871
+ endCol: string;
872
+ endRow: number;
873
+ } & Pick<CellDep, 'sheet' | 'sheetEnd'>);
874
+ /**
875
+ * The cells and ranges a formula reads, ranges kept whole (unlike
876
+ * `extractCellDependencies`, which lists every cell of a range). `A1#`
877
+ * depends on its anchor `A1`.
878
+ */
879
+ declare function extractReferenceDependencies(node: ASTNode): ReferenceDep[];
880
+ /**
881
+ * Dependency key of a rectangle (`A1:B9`, or `SHEET!A1:B9` with a sheet
882
+ * prefix), for `DependencyGraph.setCellDependencies`. The graph stores it as
883
+ * one range, however many cells it covers.
884
+ */
885
+ declare function rangeDependencyKey(startCol: string, startRow: number, endCol: string, endRow: number, sheetPrefix?: string): string;
886
+ interface IntervalEntry<T> {
887
+ r0: number;
888
+ r1: number;
889
+ id: string;
890
+ payload: T;
891
+ }
892
+ /**
893
+ * Row intervals `[r0, r1]` with payloads, answering "which intervals overlap
894
+ * rows `a..b`?" in O(log n + k). Entries are sorted by start, with an
895
+ * implicit segment tree of the largest end below each node, so a query only
896
+ * descends into subtrees holding a match. Removals mark entries dead;
897
+ * insertions wait in a small pending set. Both are merged in (on the next
898
+ * query) once either grows, so mutations cost O(log n) amortised.
899
+ */
900
+ declare class IntervalIndex<T> {
901
+ private items;
902
+ private dead;
903
+ private deadCount;
904
+ private maxEnd;
905
+ private leaves;
906
+ private position;
907
+ private pending;
908
+ /** Live entries. */
909
+ get size(): number;
910
+ /** Adds (or revives) the entry `id`. An id always names the same interval. */
911
+ insert(r0: number, r1: number, id: string, payload: T): void;
912
+ remove(id: string): void;
913
+ /** Merges pending insertions and drops dead entries when there are enough of them. */
914
+ private settle;
915
+ /** Calls `fn` for every live interval overlapping rows `a..b` (`r0 <= b && r1 >= a`). */
916
+ query(a: number, b: number, fn: (payload: T, entry: IntervalEntry<T>) => void): void;
917
+ private walk;
918
+ }
919
+ /** Sizes of the dependency index (see `DependencyGraph.getIndexStats`). */
920
+ interface DependencyIndexStats {
921
+ /** Cells with registered dependencies (formulas). */
922
+ formulas: number;
923
+ /** Single-cell edges (formula → cell it reads). */
924
+ cellEdges: number;
925
+ /** Range entries: one per range (per column for ranges up to 64 columns wide), however many cells it covers. */
926
+ rangeEntries: number;
927
+ /** Formulas that use a volatile function. */
928
+ volatile: number;
929
+ }
846
930
  declare class DependencyGraph {
847
- private dependencies;
848
- private dependents;
931
+ private nodes;
932
+ private cellDependents;
933
+ private rangeIndex;
934
+ private volatile;
849
935
  private spillDependencies;
850
936
  private spillDependents;
851
937
  private spillEdges;
852
- /**
853
- * Sets the cells `cellKey` depends on directly (keys such as `B2`, or a
854
- * column key from `columnDependencyKey`), replacing its previous
855
- * dependencies. Used by spreadsheets whose keys carry more than A1 text
856
- * (e.g. sheet-qualified keys); `setCellFormula` derives them from a formula.
938
+ private blockingEdges;
939
+ private parsed;
940
+ private parse;
941
+ private sheetIndex;
942
+ private removeNode;
943
+ /**
944
+ * Sets what `cellKey` depends on directly, replacing its previous
945
+ * dependencies. Keys are single cells (`B2`), rectangles (`A1:B9`) or
946
+ * whole columns (`A:`, see `columnDependencyKey`), each optionally
947
+ * sheet-qualified (`SHEET!A1:A9`). Ranges are stored whole in an interval
948
+ * index, never expanded cell by cell. `setCellFormula` derives the keys
949
+ * from a formula.
857
950
  */
858
951
  setCellDependencies(cellKey: string, dependencyKeys: Iterable<string>): void;
952
+ /**
953
+ * Marks `cellKey` as volatile (its formula uses NOW, RAND, …): it is
954
+ * recalculated by every plan made with `includeVolatile`, whatever changed.
955
+ */
956
+ setVolatile(cellKey: string, volatile: boolean): void;
957
+ /** Cells whose formulas are volatile. */
958
+ getVolatileKeys(): string[];
859
959
  setCellFormula(cellKey: string, formulaStr: string | null): void;
860
960
  /** Removes every registered formula and dependency. */
861
961
  clear(): void;
@@ -867,12 +967,34 @@ declare class DependencyGraph {
867
967
  * the anchor's edges.
868
968
  */
869
969
  setSpillEdges(anchorKey: string, spilledKeys: Iterable<string>, blockingKeys?: Iterable<string>): void;
970
+ /**
971
+ * Drops the edge from a spilled cell to the anchor whose values it holds,
972
+ * for a cell that just got input of its own: its value no longer comes
973
+ * from the anchor (which recalculates and becomes `#SPILL!`), and the
974
+ * stale edge could otherwise close a false cycle with the cell's new
975
+ * formula before the anchor is evaluated again.
976
+ */
977
+ detachSpilledCell(cellKey: string): void;
870
978
  /** The spilled cells registered for `anchorKey` by `setSpillEdges`. */
871
979
  getSpilledKeys(anchorKey: string): string[];
872
- /** Formula dependencies plus dynamic-array (spill) dependencies of a cell. */
980
+ /**
981
+ * What a cell depends on directly: single cells, ranges (as registered,
982
+ * e.g. `A1:A9` or `A:`, not expanded) and dynamic-array (spill) edges.
983
+ */
873
984
  getDependencies(cellKey: string): string[];
874
- /** Cells depending on `cellKey`, through formulas or spills. */
985
+ /**
986
+ * Whether the formula in `formulaKey` reads `cellKey` directly: as a cell,
987
+ * inside one of its ranges, or through a spill edge.
988
+ */
989
+ dependsOn(formulaKey: string, cellKey: string): boolean;
990
+ /**
991
+ * Formulas (and spilled cells) reading `cellKey` directly, through formulas
992
+ * or spills. Found in O(log n + k) through the range index.
993
+ */
875
994
  getDependents(cellKey: string): string[];
995
+ private collectDependents;
996
+ /** Sizes of the index: ranges count once (per column), not once per cell. */
997
+ getIndexStats(): DependencyIndexStats;
876
998
  /**
877
999
  * Detects if there is a cycle containing cellKey.
878
1000
  */
@@ -886,13 +1008,19 @@ declare class DependencyGraph {
886
1008
  };
887
1009
  /**
888
1010
  * Plans a recalculation over `cellKeys` (and, with `includeDependents`, every
889
- * cell that transitively depends on them). Returns the keys in evaluation
1011
+ * cell that transitively depends on them; with `includeVolatile`, every
1012
+ * volatile formula and its dependents too). Returns the keys in evaluation
890
1013
  * order (dependencies first) and the set of keys that are part of a cycle,
891
1014
  * which must be marked `#CYCLE!` instead of evaluated. Every member of a
892
1015
  * cycle is reported, not just the cell that closed it.
1016
+ *
1017
+ * Only the planned cells are ordered: a range a formula reads becomes one
1018
+ * node whose edges are the planned cells inside it (found by binary
1019
+ * search), so a range shared by many formulas is resolved once.
893
1020
  */
894
1021
  getEvaluationPlan(cellKeys: Iterable<string>, options?: {
895
1022
  includeDependents?: boolean;
1023
+ includeVolatile?: boolean;
896
1024
  }): {
897
1025
  order: string[];
898
1026
  cyclic: Set<string>;
@@ -1234,6 +1362,15 @@ interface SpreadsheetControllerOptions {
1234
1362
  */
1235
1363
  maxHistoryBytes?: number;
1236
1364
  }
1365
+ /** Work done by a recalculation (see `SpreadsheetController.getRecalculationStats`). */
1366
+ interface SpreadsheetRecalculationStats {
1367
+ /** Formulas evaluated. */
1368
+ evaluated: number;
1369
+ /** Cells in the evaluation plans: formulas, their dependents and spilled cells. */
1370
+ planned: number;
1371
+ /** Evaluation passes (another pass runs when spill ranges change). */
1372
+ passes: number;
1373
+ }
1237
1374
  /** A defined name as listed by `getNames()`. */
1238
1375
  interface SpreadsheetNameInfo extends SpreadsheetDefinedName {
1239
1376
  /** Name of the sheet a sheet-scoped name belongs to; unset for workbook scope. */
@@ -1273,6 +1410,9 @@ declare class SpreadsheetController {
1273
1410
  private evaluatingRowIndex;
1274
1411
  private evaluatingCell;
1275
1412
  private spillChanges;
1413
+ private recalcStats;
1414
+ private astCache;
1415
+ private rangeCache;
1276
1416
  /** The active sheet's document (the sheet the editor shows). */
1277
1417
  get document(): SpreadsheetDocument;
1278
1418
  set document(doc: SpreadsheetDocument);
@@ -1358,7 +1498,17 @@ declare class SpreadsheetController {
1358
1498
  private recomputeRowIndices;
1359
1499
  getColumn(colIdOrKey: string): SpreadsheetColumn | undefined;
1360
1500
  getRow(rowIdOrIndex: string | number): SpreadsheetRow | undefined;
1501
+ /** The row with this id on the current sheet (constant time, see `PositionCache`). */
1502
+ private findRow;
1503
+ /** The column with this id on the current sheet. */
1504
+ private findColumn;
1505
+ /** The column whose key is `key` (`A`, `B`, …): keys follow column positions. */
1506
+ private columnByKey;
1361
1507
  getCell(rowId: string, colId: string): CellData;
1508
+ /** `getCell` for a row and column already looked up. */
1509
+ private cellOf;
1510
+ /** A cell with no value of its own: derived (bound, column formula, blank), keeping an explicit number format. */
1511
+ private finishCell;
1362
1512
  /** Value of a cell with no stored data: bound record value, column formula, or blank. */
1363
1513
  private getDerivedCell;
1364
1514
  setCellValue(rowId: string, colId: string, raw: string): void;
@@ -1375,7 +1525,26 @@ declare class SpreadsheetController {
1375
1525
  * span) and, through defined names, the cells those names refer to.
1376
1526
  */
1377
1527
  private registerFormula;
1378
- /** Adds the qualified keys `ast` depends on, with unqualified references on `home`. */
1528
+ /**
1529
+ * Spill edges made stale by new input in `cellKey`: the edges of the array
1530
+ * it anchored (its new formula re-spills when evaluated; spill changes
1531
+ * are recalculated in a further pass) and, when it now holds input, its
1532
+ * edge to the anchor whose values it held. Left in place they can close
1533
+ * false cycles with the new formulas before the anchors are evaluated.
1534
+ */
1535
+ private dropStaleSpillEdges;
1536
+ /**
1537
+ * The parsed formula, shared by dependency registration and evaluation (so
1538
+ * a load parses each formula once). ASTs are never mutated.
1539
+ */
1540
+ private parseCached;
1541
+ /**
1542
+ * Adds the qualified keys `ast` depends on, with unqualified references on
1543
+ * `home`: cells, and ranges kept whole (`SHEETID!A1:A50000`), which the
1544
+ * graph indexes as intervals instead of one key per cell. Sets
1545
+ * `volatile.found` when a volatile function (NOW, RAND, …) is used,
1546
+ * directly or through a defined name.
1547
+ */
1379
1548
  private collectDependencies;
1380
1549
  /**
1381
1550
  * Recalculates `keys` (and, with `includeDependents`, their dependents) in
@@ -1385,12 +1554,31 @@ declare class SpreadsheetController {
1385
1554
  * another pass, until nothing changes.
1386
1555
  */
1387
1556
  private recalculateKeys;
1557
+ /**
1558
+ * Recalculates cells of the current sheet whose stored input changed (their
1559
+ * formulas already registered), with their dependents, in one plan.
1560
+ */
1561
+ private recalculateWrittenCells;
1562
+ /**
1563
+ * Work done by the last recalculation (an edit, paste, import, load or
1564
+ * full recalculation): formulas evaluated, cells planned (formulas, their
1565
+ * dependents and spilled cells) and passes (more than one when spill
1566
+ * ranges changed). Deterministic, unlike timings: use it to check that an
1567
+ * edit only recalculates what depends on it.
1568
+ */
1569
+ getRecalculationStats(): SpreadsheetRecalculationStats;
1388
1570
  /**
1389
1571
  * Rebuilds the dependency graph from scratch and recalculates every formula
1390
1572
  * in dependency order.
1391
1573
  */
1392
1574
  recalculateAll(): void;
1393
1575
  private runEvaluationPlan;
1576
+ /**
1577
+ * Drops cached ranges of `sheetId` that cover column `col` (whose cell was
1578
+ * just evaluated), or all of the sheet's when `col` is null (spilled
1579
+ * values moved or changed).
1580
+ */
1581
+ private invalidateRangeCache;
1394
1582
  private locateCellKey;
1395
1583
  private markCycle;
1396
1584
  private evalSingleCellByKey;
@@ -1415,6 +1603,11 @@ declare class SpreadsheetController {
1415
1603
  /** Whether `range` overlaps a spilled array (its anchor or spilled cells). */
1416
1604
  private intersectsSpill;
1417
1605
  private resolveCellByCoord;
1606
+ /**
1607
+ * Values of a range, column by column. With `skipBlanks` (functions that
1608
+ * ignore blank cells: SUM, COUNT, AVERAGE, …) blank cells are left out, so
1609
+ * a sparse column costs one lookup per row and no array slot.
1610
+ */
1418
1611
  private resolveRangeByCoords;
1419
1612
  private resolveCurrentRowProperty;
1420
1613
  selectCell(row: number, col: number, extendSelection?: boolean): void;
@@ -1735,6 +1928,9 @@ declare class SpreadsheetController {
1735
1928
  sheet?: string;
1736
1929
  }): FormulaEvaluationResult;
1737
1930
  private recordSnapshot;
1931
+ /** Records the stored state of one cell, for undoing a single-cell edit. */
1932
+ private recordCellSnapshot;
1933
+ private cellHistory;
1738
1934
  private recordWorkbookSnapshot;
1739
1935
  private pushUndo;
1740
1936
  /** Drops the oldest snapshots beyond `maxHistoryBytes`, always keeping the newest. */
@@ -1839,4 +2035,4 @@ declare class SpreadsheetController {
1839
2035
  isInvalidDataCircled(row: number, col: number): boolean;
1840
2036
  }
1841
2037
 
1842
- export { type GroupSummary as $, type ASTNode as A, type BinaryOpNode as B, type CellCoordinate as C, DEFAULT_COLUMN_WIDTH as D, type DataValidationResult as E, type DataValidationRule as F, type DataValidationSheet as G, type DataValidationType as H, DependencyGraph as I, type EvaluationContext as J, FORMULA_ERRORS as K, type FilterOperator as L, type FilterRule as M, type FormulaDiagnostic as N, type FormulaErrorCode as O, type FormulaEvaluationResult as P, FormulaEvaluator as Q, type FormulaNameDefinition as R, SpreadsheetController as S, FormulaParser as T, type FormulaRange as U, type FormulaReferenceFilter as V, type FormulaReferenceInfo as W, type FormulaToken as X, type FormulaTokenType as Y, type FunctionCallNode as Z, type GroupAggregate as _, type CellData as a, getTableSections as a$, type InvokeNode as a0, type LiteralNode as a1, MAX_FORMULA_ARRAY_SIZE as a2, type MissingNode as a3, type NameDep as a4, type NameNode as a5, type NewConditionalFormatRule as a6, type NewDataValidationRule as a7, type NewFilterRule as a8, type ParsedSpreadsheetClipboard as a9, type SpreadsheetRowSection as aA, type SpreadsheetSheetInfo as aB, type SpreadsheetSpill as aC, type SpreadsheetTableSettings as aD, type SpreadsheetValidationAction as aE, type SpreadsheetValidationPrompt as aF, type SpreadsheetViewColumn as aG, type SpreadsheetViewModel as aH, type SpreadsheetViewRow as aI, type SpreadsheetWorkbook as aJ, type StructuralChange as aK, type UnaryOpNode as aL, WHOLE_COLUMN_END_ROW as aM, buildSpreadsheetView as aN, colNameToIndex as aO, columnDependencyKey as aP, compareNumbers as aQ, compareValues as aR, computeRowGroups as aS, createSpreadsheetClipboardData as aT, deleteSheetInFormula as aU, describeFormulaError as aV, extractCellDependencies as aW, extractNameDependencies as aX, formatSheetPrefix as aY, formulaIdentifiers as aZ, getRowSection as a_, type PropertyRefNode as aa, type RangeNode as ab, type RowType as ac, SPREADSHEET_CLIPBOARD_MIME as ad, type SheetQualifier as ae, type SortDirection as af, type SortKey as ag, type SpillRefNode as ah, type SpreadsheetCellSpan as ai, type SpreadsheetClipboardCell as aj, type SpreadsheetClipboardData as ak, type SpreadsheetClipboardPayload as al, type SpreadsheetClipboardSource as am, type SpreadsheetColumn as an, type SpreadsheetCommitResult as ao, type SpreadsheetControllerOptions as ap, type SpreadsheetDataSource as aq, type SpreadsheetDataSourceField as ar, type SpreadsheetDefinedName as as, type SpreadsheetDocument as at, type SpreadsheetFilterState as au, type SpreadsheetGrouping as av, type SpreadsheetNameInfo as aw, type SpreadsheetNameScope as ax, type SpreadsheetRow as ay, type SpreadsheetRowGroup as az, type CellDep as b, indexToColName as b0, isFormulaError as b1, mapFormulaReferences as b2, numberToText as b3, offsetFormulaReferences as b4, parseCellReference as b5, parseFormula as b6, parseHtmlTable as b7, parseRange as b8, quoteSheetName as b9, readSpreadsheetClipboard as ba, rebaseClipboardRows as bb, remapFormulaReferences as bc, renameNameInFormula as bd, renameSheetInFormula as be, rowPassesFilters as bf, serializeHtmlTable as bg, sheetNameNeedsQuotes as bh, shiftFormulaReferences as bi, sortCompareValues as bj, tokenizeFormula as bk, type CellFormat as c, type CellPosition as d, type CellRange as e, type CellRefNode as f, type CellValueReader as g, type ColumnBinding as h, type ColumnType as i, type ConditionalCellFormat as j, type ConditionalFormatCondition as k, type ConditionalFormatIconSet as l, type ConditionalFormatOperator as m, type ConditionalFormatOverlay as n, type ConditionalFormatRule as o, type ConditionalFormatSheet as p, type ConditionalFormatStyle as q, type ConditionalFormatTimePeriod as r, type ConditionalFormatType as s, type ConditionalFormatValue as t, type CsvExportOptions as u, type CsvImportOptions as v, DEFAULT_ROW_HEIGHT as w, DataSourceBinder as x, type DataValidationErrorStyle as y, type DataValidationOperator as z };
2038
+ export { type GroupAggregate as $, type ASTNode as A, type BinaryOpNode as B, type CellCoordinate as C, DEFAULT_COLUMN_WIDTH as D, type DataValidationResult as E, type DataValidationRule as F, type DataValidationSheet as G, type DataValidationType as H, DependencyGraph as I, type DependencyIndexStats as J, type EvaluationContext as K, FORMULA_ERRORS as L, type FilterOperator as M, type FilterRule as N, type FormulaDiagnostic as O, type FormulaErrorCode as P, type FormulaEvaluationResult as Q, FormulaEvaluator as R, SpreadsheetController as S, type FormulaNameDefinition as T, FormulaParser as U, type FormulaRange as V, type FormulaReferenceFilter as W, type FormulaReferenceInfo as X, type FormulaToken as Y, type FormulaTokenType as Z, type FunctionCallNode as _, type CellData as a, extractCellDependencies as a$, type GroupSummary as a0, IntervalIndex as a1, type InvokeNode as a2, type LiteralNode as a3, MAX_FORMULA_ARRAY_SIZE as a4, type MissingNode as a5, type NameDep as a6, type NameNode as a7, type NewConditionalFormatRule as a8, type NewDataValidationRule as a9, type SpreadsheetNameInfo as aA, type SpreadsheetNameScope as aB, type SpreadsheetRecalculationStats as aC, type SpreadsheetRow as aD, type SpreadsheetRowGroup as aE, type SpreadsheetRowSection as aF, type SpreadsheetSheetInfo as aG, type SpreadsheetSpill as aH, type SpreadsheetTableSettings as aI, type SpreadsheetValidationAction as aJ, type SpreadsheetValidationPrompt as aK, type SpreadsheetViewColumn as aL, type SpreadsheetViewModel as aM, type SpreadsheetViewRow as aN, type SpreadsheetWorkbook as aO, type StructuralChange as aP, type UnaryOpNode as aQ, WHOLE_COLUMN_END_ROW as aR, buildSpreadsheetView as aS, colNameToIndex as aT, columnDependencyKey as aU, compareNumbers as aV, compareValues as aW, computeRowGroups as aX, createSpreadsheetClipboardData as aY, deleteSheetInFormula as aZ, describeFormulaError as a_, type NewFilterRule as aa, type ParsedSpreadsheetClipboard as ab, type PropertyRefNode as ac, type RangeNode as ad, type RangeResolveOptions as ae, type ReferenceDep as af, type RowType as ag, SPREADSHEET_CLIPBOARD_MIME as ah, type SheetQualifier as ai, type SortDirection as aj, type SortKey as ak, type SpillRefNode as al, type SpreadsheetCellSpan as am, type SpreadsheetClipboardCell as an, type SpreadsheetClipboardData as ao, type SpreadsheetClipboardPayload as ap, type SpreadsheetClipboardSource as aq, type SpreadsheetColumn as ar, type SpreadsheetCommitResult as as, type SpreadsheetControllerOptions as at, type SpreadsheetDataSource as au, type SpreadsheetDataSourceField as av, type SpreadsheetDefinedName as aw, type SpreadsheetDocument as ax, type SpreadsheetFilterState as ay, type SpreadsheetGrouping as az, type CellDep as b, extractNameDependencies as b0, extractReferenceDependencies as b1, formatSheetPrefix as b2, formulaIdentifiers as b3, getRowSection as b4, getTableSections as b5, indexToColName as b6, isFormulaError as b7, mapFormulaReferences as b8, numberToText as b9, offsetFormulaReferences as ba, parseCellReference as bb, parseFormula as bc, parseHtmlTable as bd, parseRange as be, quoteSheetName as bf, rangeDependencyKey as bg, readSpreadsheetClipboard as bh, rebaseClipboardRows as bi, remapFormulaReferences as bj, renameNameInFormula as bk, renameSheetInFormula as bl, rowPassesFilters as bm, serializeHtmlTable as bn, sheetNameNeedsQuotes as bo, shiftFormulaReferences as bp, sortCompareValues as bq, tokenizeFormula as br, type CellFormat as c, type CellPosition as d, type CellRange as e, type CellRefNode as f, type CellValueReader as g, type ColumnBinding as h, type ColumnType as i, type ConditionalCellFormat as j, type ConditionalFormatCondition as k, type ConditionalFormatIconSet as l, type ConditionalFormatOperator as m, type ConditionalFormatOverlay as n, type ConditionalFormatRule as o, type ConditionalFormatSheet as p, type ConditionalFormatStyle as q, type ConditionalFormatTimePeriod as r, type ConditionalFormatType as s, type ConditionalFormatValue as t, type CsvExportOptions as u, type CsvImportOptions as v, DEFAULT_ROW_HEIGHT as w, DataSourceBinder as x, type DataValidationErrorStyle as y, type DataValidationOperator as z };
@@ -0,0 +1,36 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ var _chunkTXXNBDQXcjs = require('../chunk-TXXNBDQX.cjs');
18
+ require('../chunk-3CC7OPUQ.cjs');
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ exports.DOCX_ANONYMOUS_AUTHOR = _chunkTXXNBDQXcjs.DOCX_ANONYMOUS_AUTHOR; exports.DOCX_EXPORT_MIME_TYPE = _chunkTXXNBDQXcjs.DOCX_EXPORT_MIME_TYPE; exports.DocxExportController = _chunkTXXNBDQXcjs.DocxExportController; exports.XmlWriter = _chunkTXXNBDQXcjs.XmlWriter; exports.createDocxExportController = _chunkTXXNBDQXcjs.createDocxExportController; exports.createDocxParts = _chunkTXXNBDQXcjs.createDocxParts; exports.deflateRaw = _chunkTXXNBDQXcjs.deflateRaw; exports.docxFileName = _chunkTXXNBDQXcjs.docxFileName; exports.downloadBlob = _chunkTXXNBDQXcjs.downloadBlob; exports.escapeXmlAttr = _chunkTXXNBDQXcjs.escapeXmlAttr; exports.escapeXmlText = _chunkTXXNBDQXcjs.escapeXmlText; exports.exportDocx = _chunkTXXNBDQXcjs.exportDocx; exports.exportDocxBlob = _chunkTXXNBDQXcjs.exportDocxBlob; exports.stripInvalidXmlChars = _chunkTXXNBDQXcjs.stripInvalidXmlChars; exports.writeZip = _chunkTXXNBDQXcjs.writeZip;
36
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/export/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,g5BAAC","file":"/home/runner/work/editor/editor/packages/core/dist/export/index.cjs"}
@@ -0,0 +1,243 @@
1
+ import { S as SerializedComments, f as CommentThread, R as ReviewAuthor } from '../comment-store-BEMgVlAA.cjs';
2
+ import { e as StyleRegistry, f as StyleRegistryJSON, c as StyleDefinition } from '../registry-CED5C0lA.cjs';
3
+
4
+ /**
5
+ * Dependency-free DOCX (WordprocessingML) export of TipTap documents.
6
+ *
7
+ * Takes an editor (anything with `getJSON()`) or its JSON and writes a
8
+ * minimal, valid package: `[Content_Types].xml`, `_rels/.rels`,
9
+ * `word/document.xml` (+ relationships), `styles.xml` (from the paragraph
10
+ * style registry, with `basedOn` / `next` / `link`), `numbering.xml` (one
11
+ * `w:num` per list), `settings.xml`, `comments.xml` +
12
+ * `commentsExtended.xml` (replies and resolved state) + `people.xml` (author
13
+ * ids), `docProps/core.xml` and `docProps/app.xml`, plus embedded images.
14
+ *
15
+ * Tracked insertions, deletions, moves (`w:moveFrom` / `w:moveTo` with
16
+ * named move ranges), formatting changes (`w:rPrChange`) and block changes
17
+ * (`w:pPrChange`, paragraph-mark `w:ins` / `w:del`) keep their authors and
18
+ * dates. Anything that cannot be written is listed in the returned report.
19
+ */
20
+ declare const DOCX_EXPORT_MIME_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
21
+ /** A ProseMirror / TipTap JSON node (`editor.getJSON()`). */
22
+ interface DocxJSONNode {
23
+ type?: string;
24
+ attrs?: Record<string, any>;
25
+ content?: DocxJSONNode[];
26
+ marks?: DocxJSONMark[];
27
+ text?: string;
28
+ }
29
+ interface DocxJSONMark {
30
+ type: string;
31
+ attrs?: Record<string, any>;
32
+ }
33
+ /** Anything with `getJSON()`, e.g. a TipTap `Editor`. Its comment store and style registry are used by default. */
34
+ interface DocxExportEditorLike {
35
+ getJSON(): DocxJSONNode;
36
+ storage?: unknown;
37
+ }
38
+ /** A comment store (`CommentStore`), its `toJSON()` output, or a thread list. */
39
+ type DocxCommentSource = {
40
+ toJSON(): SerializedComments;
41
+ } | {
42
+ getSnapshot(): {
43
+ threads: readonly CommentThread[];
44
+ };
45
+ } | SerializedComments | readonly CommentThread[];
46
+ interface DocxExportOptions {
47
+ /**
48
+ * Paragraph and character styles written to `styles.xml`. Defaults to the
49
+ * editor's registry (`ParagraphStyles` extension), else the built-in styles.
50
+ */
51
+ styles?: StyleRegistry | StyleRegistryJSON | readonly StyleDefinition[];
52
+ /** Comment threads. Defaults to the editor's comment store (`Comments` extension). */
53
+ comments?: DocxCommentSource | null;
54
+ /**
55
+ * The document's author (`dc:creator`) and the author of tracked changes
56
+ * and comments that name none.
57
+ */
58
+ author?: string | ReviewAuthor;
59
+ /**
60
+ * `"strip-authors"` writes every comment, reply and tracked change as
61
+ * "Author" (initials "A"), leaves out `people.xml`, the creator and last
62
+ * modified by, and sets `w:removePersonalInformation` so Word keeps doing
63
+ * so. Default `"keep"`.
64
+ */
65
+ privacy?: "keep" | "strip-authors";
66
+ /** `dc:title` of the document. */
67
+ title?: string;
68
+ /**
69
+ * Images with `http(s)` URLs: `"skip"` (default, reported) or `"link"`
70
+ * (an external relationship Word may load when the file is opened).
71
+ */
72
+ remoteImages?: "skip" | "link";
73
+ /** Time written as created / modified (default: now). */
74
+ now?: () => Date;
75
+ /** ZIP compression (default `"auto"`: deflate when `CompressionStream` exists). */
76
+ compression?: "auto" | "store";
77
+ }
78
+ type DocxExportIssueKind = "node" | "mark" | "image" | "link" | "comment" | "style";
79
+ /** Something the export left out or simplified, counted per kind, name and reason. */
80
+ interface DocxExportIssue {
81
+ kind: DocxExportIssueKind;
82
+ /** Node / mark type, style id, image or link URL (truncated), or comment thread id. */
83
+ name: string;
84
+ reason: string;
85
+ count: number;
86
+ }
87
+ interface DocxExportReport {
88
+ /** Content that was dropped or simplified. Empty when everything was written. */
89
+ dropped: DocxExportIssue[];
90
+ /** Counts of what was written. */
91
+ written: {
92
+ paragraphs: number;
93
+ tables: number;
94
+ images: number;
95
+ comments: number;
96
+ replies: number;
97
+ trackedChanges: number;
98
+ };
99
+ }
100
+ interface DocxExportResult {
101
+ /** The `.docx` file. */
102
+ data: Uint8Array;
103
+ report: DocxExportReport;
104
+ }
105
+ interface DocxPackagePart {
106
+ name: string;
107
+ data: Uint8Array | string;
108
+ }
109
+ /** Name written for every author with `privacy: "strip-authors"` (as Word does). */
110
+ declare const DOCX_ANONYMOUS_AUTHOR = "Author";
111
+ /**
112
+ * Builds the package parts of a DOCX file without zipping them (synchronous;
113
+ * useful for inspection and tests). See {@link exportDocx}.
114
+ */
115
+ declare function createDocxParts(input: DocxExportEditorLike | DocxJSONNode, options?: DocxExportOptions): {
116
+ parts: DocxPackagePart[];
117
+ report: DocxExportReport;
118
+ };
119
+ /**
120
+ * Exports an editor (or its JSON) as a Word document. Resolves with the file
121
+ * bytes and a report of what was dropped. Never fetches anything: remote
122
+ * images are skipped (or linked with `remoteImages: "link"`).
123
+ */
124
+ declare function exportDocx(input: DocxExportEditorLike | DocxJSONNode, options?: DocxExportOptions): Promise<DocxExportResult>;
125
+ /** Like {@link exportDocx}, but resolves with a `Blob` of type {@link DOCX_EXPORT_MIME_TYPE}. */
126
+ declare function exportDocxBlob(input: DocxExportEditorLike | DocxJSONNode, options?: DocxExportOptions): Promise<{
127
+ blob: Blob;
128
+ report: DocxExportReport;
129
+ }>;
130
+
131
+ /**
132
+ * Saves a `Blob` as a file through a temporary `<a download>` link. Does
133
+ * nothing (returns `false`) without a DOM.
134
+ */
135
+ declare function downloadBlob(blob: Blob, fileName: string): boolean;
136
+ /** `name.docx`, with characters that are invalid in file names replaced. */
137
+ declare function docxFileName(name: string | undefined): string;
138
+ interface DocxExportState {
139
+ isExporting: boolean;
140
+ /** Last export error (cleared when a new export starts). */
141
+ error: Error | null;
142
+ /** Report of the most recent successful export. */
143
+ lastReport: DocxExportReport | null;
144
+ }
145
+ interface DocxExportControllerOptions extends DocxExportOptions {
146
+ /** Download file name (default: `title`, else `document`, plus `.docx`). */
147
+ fileName?: string;
148
+ /** Called after each successful export with its report. */
149
+ onExport?: (report: DocxExportReport, blob: Blob) => void;
150
+ /** Called when an export fails (the error is also kept in the state). */
151
+ onError?: (error: Error) => void;
152
+ }
153
+ /**
154
+ * Framework-agnostic state for an "Export to Word" button: tracks
155
+ * `isExporting` / `error` / `lastReport` and downloads the `.docx` of the
156
+ * editor returned by `getSource`. React's `useDocxExport` and Svelte's
157
+ * `createDocxExport` wrap it.
158
+ */
159
+ declare class DocxExportController {
160
+ private readonly getSource;
161
+ private options;
162
+ private state;
163
+ private readonly listeners;
164
+ private pending;
165
+ constructor(getSource: () => DocxExportEditorLike | DocxJSONNode | null | undefined, options?: DocxExportControllerOptions);
166
+ setOptions(options: DocxExportControllerOptions): void;
167
+ getState: () => DocxExportState;
168
+ subscribe: (listener: (state: DocxExportState) => void) => (() => void);
169
+ private setState;
170
+ /** Builds the `.docx` without downloading it. Resolves with `null` when there is no editor or it fails. */
171
+ exportBlob(): Promise<{
172
+ blob: Blob;
173
+ report: DocxExportReport;
174
+ } | null>;
175
+ /** Exports and downloads the document. Resolves with the report, or `null`. */
176
+ download(fileName?: string): Promise<DocxExportReport | null>;
177
+ }
178
+ declare function createDocxExportController(getSource: () => DocxExportEditorLike | DocxJSONNode | null | undefined, options?: DocxExportControllerOptions): DocxExportController;
179
+
180
+ /**
181
+ * Minimal, dependency-free ZIP writer (the counterpart of `readZip`), used by
182
+ * the DOCX export. Entries are deflated with the platform
183
+ * `CompressionStream("deflate-raw")` when it exists (modern browsers,
184
+ * Node ≥ 18) and stored otherwise, or when deflating does not make them
185
+ * smaller. Names are written as UTF-8 (flag bit 11). No ZIP64: archives are
186
+ * limited to 65 535 entries and 4 GiB.
187
+ */
188
+ interface ZipWriteEntry {
189
+ /** Entry path with `/` separators; must be relative and free of `..`. */
190
+ name: string;
191
+ /** Strings are encoded as UTF-8. */
192
+ data: Uint8Array | string;
193
+ }
194
+ interface ZipWriteOptions {
195
+ /**
196
+ * `"auto"` (default) deflates when `CompressionStream` is available,
197
+ * `"store"` never compresses.
198
+ */
199
+ compression?: "auto" | "store";
200
+ /**
201
+ * Modification time written for every entry (default 1980-01-01, the DOS
202
+ * epoch, so the output is deterministic).
203
+ */
204
+ modified?: Date;
205
+ }
206
+ /** Raw deflate with `CompressionStream`, or `null` when it is unavailable. */
207
+ declare function deflateRaw(data: Uint8Array): Promise<Uint8Array | null>;
208
+ /** Writes a ZIP archive. Throws on unsafe or duplicate names and oversized archives. */
209
+ declare function writeZip(entries: readonly ZipWriteEntry[], options?: ZipWriteOptions): Promise<Uint8Array>;
210
+
211
+ /** Removes characters that are not allowed in XML 1.0 documents. */
212
+ declare function stripInvalidXmlChars(value: string): string;
213
+ /** Escapes text for XML element content (`&`, `<`, `>`), dropping invalid characters. */
214
+ declare function escapeXmlText(value: string): string;
215
+ /**
216
+ * Escapes a value for a double- or single-quoted XML attribute. White space
217
+ * other than spaces is written as character references, because attribute
218
+ * value normalisation would otherwise turn tabs and newlines into spaces.
219
+ */
220
+ declare function escapeXmlAttr(value: string): string;
221
+ type XmlAttrs = Record<string, string | number | undefined | null | false>;
222
+ /**
223
+ * A small string-building XML writer; every attribute value and text node is
224
+ * escaped. Element names are trusted (always literals in this codebase).
225
+ */
226
+ declare class XmlWriter {
227
+ private parts;
228
+ /** `declaration: false` writes a fragment (e.g. one paragraph). */
229
+ constructor(declaration?: boolean);
230
+ open(name: string, values?: XmlAttrs): this;
231
+ empty(name: string, values?: XmlAttrs): this;
232
+ close(name: string): this;
233
+ text(value: string): this;
234
+ /** `<name attrs>text</name>`. */
235
+ leaf(name: string, values: XmlAttrs | undefined, text: string): this;
236
+ /** `<name w:val="value"/>`. */
237
+ val(name: string, value: string | number): this;
238
+ /** Appends markup produced by another writer. */
239
+ raw(markup: string): this;
240
+ toString(): string;
241
+ }
242
+
243
+ export { DOCX_ANONYMOUS_AUTHOR, DOCX_EXPORT_MIME_TYPE, type DocxCommentSource, DocxExportController, type DocxExportControllerOptions, type DocxExportEditorLike, type DocxExportIssue, type DocxExportIssueKind, type DocxExportOptions, type DocxExportReport, type DocxExportResult, type DocxExportState, type DocxJSONMark, type DocxJSONNode, type DocxPackagePart, type XmlAttrs, XmlWriter, type ZipWriteEntry, type ZipWriteOptions, createDocxExportController, createDocxParts, deflateRaw, docxFileName, downloadBlob, escapeXmlAttr, escapeXmlText, exportDocx, exportDocxBlob, stripInvalidXmlChars, writeZip };