@stll/folio-core 0.53.0 → 0.54.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 (148) hide show
  1. package/dist/ai-edits/apply.js +390 -166
  2. package/dist/ai-edits/batch-claims.d.ts +21 -6
  3. package/dist/ai-edits/batch-claims.js +47 -16
  4. package/dist/ai-edits/headless.d.ts +20 -0
  5. package/dist/ai-edits/headless.js +140 -11
  6. package/dist/ai-edits/pending-suggestions.js +1 -1
  7. package/dist/ai-edits/read.d.ts +5 -3
  8. package/dist/ai-edits/read.js +97 -47
  9. package/dist/ai-edits/revisionStretches.d.ts +17 -0
  10. package/dist/ai-edits/revisionStretches.js +80 -0
  11. package/dist/ai-edits/snapshot.js +3 -2
  12. package/dist/ai-edits/table-cell-mutations.d.ts +3 -1
  13. package/dist/ai-edits/table-cell-mutations.js +2 -1
  14. package/dist/ai-edits/table-row-column-mutations.d.ts +6 -1
  15. package/dist/ai-edits/table-row-column-mutations.js +27 -10
  16. package/dist/compare/content-alignment.d.ts +5 -1
  17. package/dist/compare/content-alignment.js +39 -32
  18. package/dist/compare/inline-provenance.js +1 -1
  19. package/dist/controller/layoutPipeline.js +3 -2
  20. package/dist/docx/archiveInflation.d.ts +127 -0
  21. package/dist/docx/archiveInflation.js +181 -0
  22. package/dist/docx/metadataPrivacy.js +24 -1
  23. package/dist/docx/noteReferenceMark.d.ts +15 -0
  24. package/dist/docx/noteReferenceMark.js +48 -0
  25. package/dist/docx/paragraphParser.js +5 -3
  26. package/dist/docx/paragraphPropertySource.d.ts +1 -1
  27. package/dist/docx/paragraphPropertySource.js +3 -1
  28. package/dist/docx/parser.js +2 -2
  29. package/dist/docx/rezip.js +4 -2
  30. package/dist/docx/selectiveXmlPatch.d.ts +3 -1
  31. package/dist/docx/selectiveXmlPatch.js +81 -3
  32. package/dist/docx/server/boundedArchive.d.ts +8 -13
  33. package/dist/docx/server/boundedArchive.js +70 -59
  34. package/dist/docx/server/extractDocxText.d.ts +8 -2
  35. package/dist/docx/server/extractDocxText.js +2 -2
  36. package/dist/docx/server/validateDocxConformance.d.ts +1 -1
  37. package/dist/docx/server/validateDocxConformance.js +1 -0
  38. package/dist/docx/unzip.d.ts +19 -2
  39. package/dist/docx/unzip.js +135 -24
  40. package/dist/fonts/embeddedFonts.js +1 -1
  41. package/dist/i18n/messages/catalogs.gen.d.ts +34 -34
  42. package/dist/i18n/messages/catalogs.gen.js +34 -34
  43. package/dist/i18n/messages/messages.gen.d.ts +2 -2
  44. package/dist/internal/wholeStoryRevisionResolution.js +95 -25
  45. package/dist/layout-engine/measure/measureParagraph.js +2 -2
  46. package/dist/layout-engine/measure/paragraphMeasureShared.d.ts +12 -1
  47. package/dist/layout-engine/measure/paragraphMeasureShared.js +14 -1
  48. package/dist/markdown/escape.d.ts +2 -2
  49. package/dist/markdown/escape.js +4 -5
  50. package/dist/markdown/renderBlock.js +91 -25
  51. package/dist/markdown/renderRuns.d.ts +10 -1
  52. package/dist/markdown/renderRuns.js +320 -59
  53. package/dist/prosemirror/clearRunColor.d.ts +6 -0
  54. package/dist/prosemirror/clearRunColor.js +46 -0
  55. package/dist/prosemirror/commands/comments.js +56 -21
  56. package/dist/prosemirror/commands/formatPainter.js +1 -1
  57. package/dist/prosemirror/commands/hyperlink.js +2 -1
  58. package/dist/prosemirror/commands/propertyChangeScope.d.ts +3 -2
  59. package/dist/prosemirror/commands/propertyChangeScope.js +24 -3
  60. package/dist/prosemirror/commands/resolveAllTableChanges.js +46 -41
  61. package/dist/prosemirror/commands/resolveParagraphProperties.js +20 -6
  62. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +8 -1
  63. package/dist/prosemirror/commands/tableCellMergeResolution.js +23 -7
  64. package/dist/prosemirror/containerFinalParagraph.d.ts +11 -5
  65. package/dist/prosemirror/containerFinalParagraph.js +7 -6
  66. package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -13
  67. package/dist/prosemirror/conversion/fromProseDoc.js +12 -590
  68. package/dist/prosemirror/conversion/toProseDoc.d.ts +4 -11
  69. package/dist/prosemirror/conversion/toProseDoc.js +31 -150
  70. package/dist/prosemirror/documentSchema.d.ts +8 -0
  71. package/dist/prosemirror/documentSchema.js +18 -0
  72. package/dist/prosemirror/extensions/StarterKit.js +2 -0
  73. package/dist/prosemirror/extensions/core/ParagraphExtension.js +104 -63
  74. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -1
  75. package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +24 -3
  76. package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +20 -0
  77. package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.js +43 -0
  78. package/dist/prosemirror/extensions/features/ListExtension.js +10 -9
  79. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
  80. package/dist/prosemirror/extensions/features/pastedHtmlLists.js +2 -4
  81. package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +14 -8
  82. package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +8 -4
  83. package/dist/prosemirror/extensions/marks/StrikeExtension.js +2 -2
  84. package/dist/prosemirror/extensions/marks/SubscriptExtension.js +2 -2
  85. package/dist/prosemirror/extensions/marks/SuperscriptExtension.js +2 -2
  86. package/dist/prosemirror/extensions/marks/TextColorExtension.js +4 -3
  87. package/dist/prosemirror/extensions/marks/markUtils.d.ts +8 -6
  88. package/dist/prosemirror/extensions/marks/markUtils.js +17 -8
  89. package/dist/prosemirror/extensions/marks/noteReferenceDeletion.d.ts +3 -1
  90. package/dist/prosemirror/extensions/marks/noteReferenceDeletion.js +12 -1
  91. package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +2 -2
  92. package/dist/prosemirror/extensions/nodes/HardBreakExtension.js +5 -3
  93. package/dist/prosemirror/extensions/nodes/TableExtension.js +104 -210
  94. package/dist/prosemirror/extensions/types.d.ts +7 -0
  95. package/dist/prosemirror/hyperlinkRemoval.d.ts +9 -0
  96. package/dist/prosemirror/hyperlinkRemoval.js +129 -0
  97. package/dist/prosemirror/index.d.ts +2 -1
  98. package/dist/prosemirror/index.js +2 -1
  99. package/dist/prosemirror/listNumbering.d.ts +3 -21
  100. package/dist/prosemirror/listNumbering.js +10 -25
  101. package/dist/prosemirror/listRendering.d.ts +27 -0
  102. package/dist/prosemirror/listRendering.js +27 -0
  103. package/dist/prosemirror/markupViewNotes.d.ts +8 -0
  104. package/dist/prosemirror/markupViewNotes.js +49 -0
  105. package/dist/prosemirror/markupViewProjection.d.ts +3 -1
  106. package/dist/prosemirror/markupViewProjection.js +7 -2
  107. package/dist/prosemirror/noteReferenceReview.d.ts +77 -0
  108. package/dist/prosemirror/noteReferenceReview.js +332 -0
  109. package/dist/prosemirror/paragraphIndentation.js +5 -2
  110. package/dist/prosemirror/paragraphMarkJoin.d.ts +6 -4
  111. package/dist/prosemirror/paragraphMarkJoin.js +21 -19
  112. package/dist/prosemirror/paragraphPropertyCarry.d.ts +64 -0
  113. package/dist/prosemirror/paragraphPropertyCarry.js +158 -0
  114. package/dist/prosemirror/plugins/documentStyleState.d.ts +26 -0
  115. package/dist/prosemirror/plugins/documentStyleState.js +32 -0
  116. package/dist/prosemirror/plugins/documentStyles.d.ts +2 -21
  117. package/dist/prosemirror/plugins/documentStyles.js +66 -29
  118. package/dist/prosemirror/plugins/index.d.ts +2 -1
  119. package/dist/prosemirror/plugins/index.js +2 -1
  120. package/dist/prosemirror/plugins/paragraphStyleResolution.d.ts +15 -0
  121. package/dist/prosemirror/plugins/paragraphStyleResolution.js +230 -0
  122. package/dist/prosemirror/plugins/suggestionMode.d.ts +12 -2
  123. package/dist/prosemirror/plugins/suggestionMode.js +391 -28
  124. package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +22 -2
  125. package/dist/prosemirror/rebaseParagraphRunFormatting.js +39 -13
  126. package/dist/prosemirror/rebaseParagraphRuns.d.ts +36 -0
  127. package/dist/prosemirror/rebaseParagraphRuns.js +99 -0
  128. package/dist/prosemirror/runFormattingFromMarks.d.ts +18 -0
  129. package/dist/prosemirror/runFormattingFromMarks.js +567 -0
  130. package/dist/prosemirror/runFormattingReconciliation.js +10 -9
  131. package/dist/prosemirror/schema/nodes.d.ts +2 -0
  132. package/dist/prosemirror/styles/paragraphStyleCascade.d.ts +59 -0
  133. package/dist/prosemirror/styles/paragraphStyleCascade.js +145 -0
  134. package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +21 -2
  135. package/dist/prosemirror/styles/resolvedStyleAttrs.js +38 -1
  136. package/dist/prosemirror/styles/tableStyleRegions.d.ts +31 -0
  137. package/dist/prosemirror/styles/tableStyleRegions.js +55 -0
  138. package/dist/prosemirror/tableCellPaste.d.ts +74 -0
  139. package/dist/prosemirror/tableCellPaste.js +525 -0
  140. package/dist/prosemirror/tableGridMutation.d.ts +53 -14
  141. package/dist/prosemirror/tableGridMutation.js +166 -18
  142. package/dist/prosemirror/tableRunIn.d.ts +51 -0
  143. package/dist/prosemirror/tableRunIn.js +165 -0
  144. package/dist/prosemirror/textInput.js +11 -2
  145. package/dist/prosemirror/trackedRevisionPath.d.ts +17 -0
  146. package/dist/prosemirror/trackedRevisionPath.js +32 -0
  147. package/dist/server.d.ts +2 -2
  148. package/package.json +5 -5
@@ -1,5 +1,6 @@
1
1
  import { expectTableAttrs, mergeTableAttrs } from "./attrs/index.js";
2
- import { TableMap } from "prosemirror-tables";
2
+ import { panic } from "better-result";
3
+ import { TableMap, removeColumn } from "prosemirror-tables";
3
4
  //#region src/prosemirror/tableGridMutation.ts
4
5
  /**
5
6
  * Remove one row, keeping every vertical merge that touches it whole: a merge
@@ -43,26 +44,33 @@ const removeTableRow = (tr, { map, table, tableStart }, row) => {
43
44
  column += colspan;
44
45
  }
45
46
  };
46
- /**
47
- * Remove every row a structural edit left without a cell of its own, closing
48
- * the vertical merges that reached through it over one row fewer.
49
- *
50
- * Deleting the only column a row still had a cell in, or merging whole rows
51
- * together, leaves a row holding nothing but the merges from above. The
52
- * editable model can carry such a row, but nothing else agrees with it: a
53
- * package spells it as a row of `w:vMerge` continuations, which the reader
54
- * gives a cell of its own by splitting the merge apart, so the reopened table
55
- * differs from the one the operation reported. Accepting the same deletion
56
- * tracked removes the cells one at a time and the row with its last one,
57
- * which is this result; the two modes have to leave the same table.
58
- */
59
- const removeRowsWithoutCells = (tr, tablePosition) => {
47
+ const ROW_CLEANUP_PENDING = "pending";
48
+ /** A transient row attribute follows node moves; conversion never serializes it. */
49
+ const markRowEmptiedInBatch = ({ tr, rowPosition, emptied }) => {
50
+ const row = tr.doc.nodeAt(rowPosition);
51
+ if (!row || row.type.spec.attrs?.["_batchRowCleanup"] === void 0) panic("Batch row cleanup requires the table row cleanup attribute");
52
+ tr.setNodeAttribute(rowPosition, "_batchRowCleanup", ROW_CLEANUP_PENDING);
53
+ emptied.pending = true;
54
+ };
55
+ /** Column removal keeps row indices stable: mark only newly cell-less rows. */
56
+ const markRowsEmptiedInBatch = ({ tr, tablePosition, previousTable, emptied }) => {
57
+ const table = tr.doc.nodeAt(tablePosition);
58
+ if (!table || table.type.spec["tableRole"] !== "table") return;
59
+ table.forEach((row, offset, index) => {
60
+ if (row.childCount === 0 && previousTable.child(index).childCount > 0) markRowEmptiedInBatch({
61
+ tr,
62
+ rowPosition: tablePosition + 1 + offset,
63
+ emptied
64
+ });
65
+ });
66
+ };
67
+ const removeEmptyRows = ({ tr, tablePosition, shouldRemove }) => {
60
68
  for (;;) {
61
69
  const table = tr.doc.nodeAt(tablePosition);
62
70
  if (!table || table.type.spec["tableRole"] !== "table" || table.childCount < 2) return;
63
71
  let emptyRow = -1;
64
72
  table.forEach((row, _offset, index) => {
65
- if (emptyRow === -1 && row.childCount === 0) emptyRow = index;
73
+ if (emptyRow === -1 && row.childCount === 0 && shouldRemove(row)) emptyRow = index;
66
74
  });
67
75
  if (emptyRow === -1) return;
68
76
  removeTableRow(tr, {
@@ -72,6 +80,44 @@ const removeRowsWithoutCells = (tr, tablePosition) => {
72
80
  }, emptyRow);
73
81
  }
74
82
  };
83
+ /** Remove only rows emptied by deletions in this transaction, then clear remaining markers. */
84
+ const removeBatchRows = (tr, tablePosition) => {
85
+ removeEmptyRows({
86
+ tr,
87
+ tablePosition,
88
+ shouldRemove: (row) => row.attrs["_batchRowCleanup"] === ROW_CLEANUP_PENDING
89
+ });
90
+ tr.doc.nodeAt(tablePosition)?.forEach((row, offset) => {
91
+ if (row.attrs["_batchRowCleanup"] === ROW_CLEANUP_PENDING) tr.setNodeAttribute(tablePosition + 1 + offset, "_batchRowCleanup", null);
92
+ });
93
+ };
94
+ /** Sweep current tables in reverse so moves cannot invalidate cleanup targets. */
95
+ const removeRowsWithoutCellsAfterBatch = (tr, emptied) => {
96
+ if (!emptied.pending) return;
97
+ const tables = [];
98
+ tr.doc.descendants((node, position) => {
99
+ if (node.type.spec["tableRole"] === "table") tables.push(position);
100
+ return !node.isTextblock;
101
+ });
102
+ for (const position of tables.toReversed()) removeBatchRows(tr, position);
103
+ };
104
+ /** Close marked rows before their owning cell is captured into a continuation payload. */
105
+ const removeRowsWithoutCellsInRange = ({ tr, from, to }) => {
106
+ const tables = [];
107
+ tr.doc.nodesBetween(from, to, (node, position) => {
108
+ if (position >= from && node.type.spec["tableRole"] === "table") tables.push(position);
109
+ return !node.isTextblock;
110
+ });
111
+ for (const position of tables.toReversed()) removeBatchRows(tr, position);
112
+ };
113
+ /** Close all cell-less rows after an immediate structural edit. */
114
+ const removeRowsWithoutCells = (tr, tablePosition) => {
115
+ removeEmptyRows({
116
+ tr,
117
+ tablePosition,
118
+ shouldRemove: () => true
119
+ });
120
+ };
75
121
  /**
76
122
  * Keep the editable table grid aligned with a physical column removal.
77
123
  *
@@ -112,7 +158,7 @@ const reconcileTableGridAfterColumnInsertion = ({ tr, tablePosition, previousTab
112
158
  if (columnCount <= previousColumnCount) return;
113
159
  const insertedColumnCount = columnCount - previousColumnCount;
114
160
  const previousWidths = expectTableAttrs(previousTable).columnWidths;
115
- const neighbourWidth = previousWidths?.[Math.max(0, Math.min(insertedColumn, previousColumnCount) - 1)] ?? previousWidths?.[0];
161
+ const neighbourWidth = insertedColumnWidth(previousTable, insertedColumn);
116
162
  const columnWidths = previousWidths?.length === previousColumnCount && neighbourWidth !== void 0 ? previousWidths.toSpliced(insertedColumn, 0, ...Array.from({ length: insertedColumnCount }, () => neighbourWidth)) : void 0;
117
163
  setTableGrid({
118
164
  tr,
@@ -122,6 +168,29 @@ const reconcileTableGridAfterColumnInsertion = ({ tr, tablePosition, previousTab
122
168
  columnCount
123
169
  });
124
170
  };
171
+ /** The width a column inserted at `insertedColumn` takes: its left neighbour's, when the grid is known. */
172
+ const insertedColumnWidth = (table, insertedColumn) => {
173
+ const columnCount = TableMap.get(table).width;
174
+ const widths = expectTableAttrs(table).columnWidths;
175
+ if (widths?.length !== columnCount) return;
176
+ return widths[Math.max(0, Math.min(insertedColumn, columnCount) - 1)] ?? widths[0];
177
+ };
178
+ /**
179
+ * Give a cell whose span grew or shrank the matching rendered width: its
180
+ * resolved twips width moves by `delta`. Layout falls back to cell widths
181
+ * when the grid is unknown, so a merged cell must not keep its old one. A
182
+ * percentage width, and the authored `w:tcW` kept beside it, stay as they are.
183
+ */
184
+ const resizeCellWidth = (tr, position, delta) => {
185
+ const cell = tr.doc.nodeAt(position);
186
+ const width = cell?.attrs["width"];
187
+ const widthType = cell?.attrs["widthType"];
188
+ if (!cell || delta === 0 || typeof width !== "number" || widthType !== null && widthType !== void 0 && widthType !== "dxa") return;
189
+ tr.setNodeMarkup(position, null, {
190
+ ...cell.attrs,
191
+ width: Math.max(1, width + delta)
192
+ });
193
+ };
125
194
  const setTableGrid = ({ tr, tablePosition, table, columnWidths, columnCount }) => {
126
195
  const formatting = expectTableAttrs(table)._originalFormatting;
127
196
  const originalFormatting = formatting ? { ...formatting } : void 0;
@@ -131,5 +200,84 @@ const setTableGrid = ({ tr, tablePosition, table, columnWidths, columnCount }) =
131
200
  _originalFormatting: originalFormatting
132
201
  }));
133
202
  };
203
+ /**
204
+ * Insert a grid column, walking the table map: each row gains a cell at the
205
+ * column's place in the grid (after any cell a merge from a row above holds
206
+ * there), a cell merged across that place widens instead, and `w:tblGrid`
207
+ * gains the column.
208
+ */
209
+ const insertTableColumn = ({ tr, tablePosition, column, templateColumn, createCell }) => {
210
+ const table = tr.doc.nodeAt(tablePosition);
211
+ if (!table || table.type.spec["tableRole"] !== "table") return;
212
+ const map = TableMap.get(table);
213
+ const tableStart = tablePosition + 1;
214
+ const mapFrom = tr.mapping.maps.length;
215
+ const addedWidth = insertedColumnWidth(table, column) ?? 0;
216
+ for (let row = 0; row < map.height; row++) {
217
+ const index = row * map.width + column;
218
+ const position = map.map[index];
219
+ const straddling = column > 0 && column < map.width && position !== void 0 && map.map[index - 1] === position ? table.nodeAt(position) : null;
220
+ if (straddling && position !== void 0) {
221
+ const offset = column - map.colCount(position);
222
+ const colwidth = straddling.attrs["colwidth"];
223
+ const mapped = tr.mapping.slice(mapFrom).map(tableStart + position);
224
+ tr.setNodeMarkup(mapped, null, {
225
+ ...straddling.attrs,
226
+ colspan: (Number(straddling.attrs["colspan"]) || 1) + 1,
227
+ colwidth: Array.isArray(colwidth) ? colwidth.toSpliced(offset, 0, 0) : colwidth
228
+ });
229
+ resizeCellWidth(tr, mapped, addedWidth);
230
+ row += (Number(straddling.attrs["rowspan"]) || 1) - 1;
231
+ continue;
232
+ }
233
+ const templatePosition = map.map[row * map.width + templateColumn];
234
+ const template = templatePosition === void 0 ? null : table.nodeAt(templatePosition);
235
+ tr.insert(tr.mapping.slice(mapFrom).map(tableStart + map.positionAt(row, column, table)), createCell(template));
236
+ }
237
+ reconcileTableGridAfterColumnInsertion({
238
+ tr,
239
+ tablePosition,
240
+ previousTable: table,
241
+ insertedColumn: column
242
+ });
243
+ };
244
+ /**
245
+ * Remove grid columns [`left`, `right`), walking the table map: a cell only
246
+ * in them goes, a cell merged across them narrows, `w:tblGrid` loses them,
247
+ * and a row left without a cell of its own goes too.
248
+ */
249
+ const removeTableColumns = (tr, tablePosition, left, right) => {
250
+ for (let column = right - 1; column >= left; column--) {
251
+ const table = tr.doc.nodeAt(tablePosition);
252
+ if (!table || table.type.spec["tableRole"] !== "table") return;
253
+ const map = TableMap.get(table);
254
+ const widths = expectTableAttrs(table).columnWidths;
255
+ const removedWidth = widths?.length === map.width ? widths[column] ?? 0 : 0;
256
+ const narrowed = /* @__PURE__ */ new Set();
257
+ for (let row = 0; row < map.height; row++) {
258
+ const index = row * map.width + column;
259
+ const position = map.map[index];
260
+ if (position !== void 0 && (column > 0 && map.map[index - 1] === position || column < map.width - 1 && map.map[index + 1] === position)) narrowed.add(position);
261
+ }
262
+ const mapFrom = tr.mapping.maps.length;
263
+ removeColumn(tr, {
264
+ map,
265
+ table,
266
+ tableStart: tablePosition + 1,
267
+ left: column,
268
+ right: column + 1,
269
+ top: 0,
270
+ bottom: map.height
271
+ }, column);
272
+ for (const position of narrowed) resizeCellWidth(tr, tr.mapping.slice(mapFrom).map(tablePosition + 1 + position), -removedWidth);
273
+ reconcileTableGridAfterColumnRemoval({
274
+ tr,
275
+ tablePosition,
276
+ previousTable: table,
277
+ removedColumn: column
278
+ });
279
+ }
280
+ removeRowsWithoutCells(tr, tablePosition);
281
+ };
134
282
  //#endregion
135
- export { reconcileTableGridAfterColumnInsertion, reconcileTableGridAfterColumnRemoval, removeRowsWithoutCells, removeTableRow };
283
+ export { insertTableColumn, markRowEmptiedInBatch, markRowsEmptiedInBatch, reconcileTableGridAfterColumnInsertion, reconcileTableGridAfterColumnRemoval, removeRowsWithoutCells, removeRowsWithoutCellsAfterBatch, removeRowsWithoutCellsInRange, removeTableColumns, removeTableRow };
@@ -0,0 +1,51 @@
1
+ import { RunStyleResolver } from "./runStyleFormatting.js";
2
+ import { ParagraphPropertySourceTransfer } from "../docx/paragraphPropertySource.js";
3
+ import { MarkType, Node } from "prosemirror-model";
4
+ import { StepMap, Transform } from "prosemirror-transform";
5
+ //#region src/prosemirror/tableRunIn.d.ts
6
+ /**
7
+ * Whether the cell a paragraph's words would run into is itself pending: its
8
+ * row or the cell (through nested tables' first cells) is inserted, deleted
9
+ * or merged, so resolving may not keep it. Pending rows or cells elsewhere in
10
+ * the table leave that cell where it is.
11
+ */
12
+ declare const runInCellPending: (table: Node) => boolean;
13
+ type RunParagraphIntoTableOptions = {
14
+ tr: Transform;
15
+ paragraphPos: number;
16
+ styleResolver: RunStyleResolver | null;
17
+ /** Content a resolution in progress removes: it does not count as words left. */
18
+ removedMark?: MarkType | undefined;
19
+ };
20
+ /**
21
+ * Run the paragraph at `paragraphPos` on into the table right after it.
22
+ * Returns where the paragraph that took its words now starts and the
23
+ * paragraph-property source it hands over, or null when it did not run in and
24
+ * the caller keeps its own handling.
25
+ */
26
+ declare const runParagraphIntoTable: ({ tr, paragraphPos, styleResolver, removedMark }: RunParagraphIntoTableOptions) => {
27
+ position: number;
28
+ map: StepMap;
29
+ transfer: ParagraphPropertySourceTransfer;
30
+ } | null;
31
+ /**
32
+ * Whether resolving every change in `mode` runs `paragraph` on into `next`:
33
+ * its mark goes and `next` is a table.
34
+ */
35
+ declare const runsIntoFollowingTable: (paragraph: Node, next: Node | null | undefined, mode: "accept" | "reject") => boolean;
36
+ /**
37
+ * Before every change in a story is resolved: run each paragraph whose mark
38
+ * goes and that sits right before a table on into that table. Returns each
39
+ * paragraph that took words (its position after the step count given) and
40
+ * the paragraph-property sources handed over.
41
+ */
42
+ declare const runParagraphsIntoTables: (tr: Transform, mode: "accept" | "reject", styleResolver: RunStyleResolver | null) => {
43
+ targets: {
44
+ position: number;
45
+ step: number;
46
+ }[];
47
+ maps: StepMap[];
48
+ transfers: ParagraphPropertySourceTransfer[];
49
+ };
50
+ //#endregion
51
+ export { runInCellPending, runParagraphIntoTable, runParagraphsIntoTables, runsIntoFollowingTable };
@@ -0,0 +1,165 @@
1
+ import { getProseParagraphPropertySourceToken, recreateProseNodeWithParagraphPropertySource } from "../docx/paragraphPropertySource.js";
2
+ import { expectParagraphAttrs } from "./attrs/index.js";
3
+ import { rebaseParagraphRuns } from "./rebaseParagraphRunFormatting.js";
4
+ import { paragraphRunStyleContext } from "./runStyleFormatting.js";
5
+ import { holdsNoContent } from "./zeroWidthAnchors.js";
6
+ import { Fragment, Slice } from "prosemirror-model";
7
+ import { ReplaceAroundStep, StepMap } from "prosemirror-transform";
8
+ //#region src/prosemirror/tableRunIn.ts
9
+ /**
10
+ * A paragraph whose mark goes, right before a table.
11
+ *
12
+ * With its mark gone a paragraph runs on into what follows it. When that is a
13
+ * table, its words run on into the table's first cell: they lead that cell's
14
+ * first paragraph, which is the paragraph left, with its identity and
15
+ * properties. What the removed paragraph's style lent its runs is re-read in
16
+ * that paragraph's style, as in any join.
17
+ *
18
+ * A paragraph with nothing left to carry is simply removed by the resolvers;
19
+ * one that ends a section keeps its place, as does one before a table whose
20
+ * rows or cells are themselves pending.
21
+ */
22
+ /**
23
+ * Whether the cell a paragraph's words would run into is itself pending: its
24
+ * row or the cell (through nested tables' first cells) is inserted, deleted
25
+ * or merged, so resolving may not keep it. Pending rows or cells elsewhere in
26
+ * the table leave that cell where it is.
27
+ */
28
+ const runInCellPending = (table) => {
29
+ let node = table;
30
+ while (node?.type.spec["tableRole"] === "table") {
31
+ const row = node.firstChild;
32
+ if (!row) return false;
33
+ if (row.attrs["trIns"] != null || row.attrs["trDel"] != null) return true;
34
+ const cell = row.firstChild;
35
+ if (!cell) return false;
36
+ if (cell.attrs["cellMarker"] != null) return true;
37
+ node = cell.firstChild;
38
+ }
39
+ return false;
40
+ };
41
+ /** The first paragraph of a table's first cell, descending into nested tables. */
42
+ const runInTarget = (doc, tablePos) => {
43
+ let node = doc.nodeAt(tablePos);
44
+ let pos = tablePos;
45
+ const table = node;
46
+ const firstRow = table?.firstChild;
47
+ if (!table || table.type.spec["tableRole"] !== "table" || !firstRow) return null;
48
+ if (runInCellPending(table)) return null;
49
+ while (node && node.type.name !== "paragraph") {
50
+ const child = node.firstChild;
51
+ if (!child || child.isInline) return null;
52
+ pos += 1;
53
+ node = child;
54
+ }
55
+ return node ? {
56
+ pos,
57
+ node
58
+ } : null;
59
+ };
60
+ /**
61
+ * Run the paragraph at `paragraphPos` on into the table right after it.
62
+ * Returns where the paragraph that took its words now starts and the
63
+ * paragraph-property source it hands over, or null when it did not run in and
64
+ * the caller keeps its own handling.
65
+ */
66
+ const runParagraphIntoTable = ({ tr, paragraphPos, styleResolver, removedMark }) => {
67
+ const paragraph = tr.doc.nodeAt(paragraphPos);
68
+ if (paragraph?.type.name !== "paragraph") return null;
69
+ if (expectParagraphAttrs(paragraph)._sectionProperties !== void 0) return null;
70
+ if (holdsNoContent(removedMark ? paragraph.copy(Fragment.fromArray(paragraph.children.filter((child) => !removedMark.isInSet(child.marks)))) : paragraph)) return null;
71
+ const tablePos = paragraphPos + paragraph.nodeSize;
72
+ const target = runInTarget(tr.doc, tablePos);
73
+ if (!target) return null;
74
+ const $target = tr.doc.resolve(target.pos + 1);
75
+ const containerDepth = tr.doc.resolve(paragraphPos).depth;
76
+ let opening = Fragment.empty;
77
+ for (let depth = $target.depth; depth > containerDepth; depth--) opening = Fragment.from(recreateProseNodeWithParagraphPropertySource($target.node(depth), { content: opening }));
78
+ const levels = $target.depth - containerDepth;
79
+ tr.step(new ReplaceAroundStep(paragraphPos, target.pos + 1, paragraphPos + 1, paragraphPos + paragraph.nodeSize - 1, new Slice(opening, 0, levels), levels, true));
80
+ const position = paragraphPos + levels - 1;
81
+ if (styleResolver && paragraph.content.size > 0) rebaseParagraphRuns({
82
+ previousContext: paragraphRunStyleContext(paragraph, styleResolver),
83
+ paragraphPosition: position,
84
+ range: {
85
+ from: 0,
86
+ to: paragraph.content.size
87
+ },
88
+ styleResolver,
89
+ tr
90
+ });
91
+ const displaced = getProseParagraphPropertySourceToken(paragraph);
92
+ const selected = getProseParagraphPropertySourceToken(target.node);
93
+ const closing = paragraphPos + paragraph.nodeSize - 1;
94
+ return {
95
+ position,
96
+ map: new StepMap([
97
+ paragraphPos,
98
+ 0,
99
+ levels - 1,
100
+ closing,
101
+ target.pos + 1 - closing,
102
+ 0
103
+ ]),
104
+ transfer: {
105
+ displacedToken: typeof displaced === "string" ? displaced : null,
106
+ selectedToken: typeof selected === "string" ? selected : null
107
+ }
108
+ };
109
+ };
110
+ /** Whether resolving every change in `mode` removes this paragraph's mark. */
111
+ const markGoes = (paragraph, mode) => {
112
+ const mark = expectParagraphAttrs(paragraph).pPrMark;
113
+ if (!mark) return false;
114
+ return (mark.kind === "ins" || mark.kind === "moveTo") !== (mode === "accept");
115
+ };
116
+ /**
117
+ * Whether resolving every change in `mode` runs `paragraph` on into `next`:
118
+ * its mark goes and `next` is a table.
119
+ */
120
+ const runsIntoFollowingTable = (paragraph, next, mode) => paragraph.type.name === "paragraph" && next?.type.spec["tableRole"] === "table" && markGoes(paragraph, mode);
121
+ /**
122
+ * Before every change in a story is resolved: run each paragraph whose mark
123
+ * goes and that sits right before a table on into that table. Returns each
124
+ * paragraph that took words (its position after the step count given) and
125
+ * the paragraph-property sources handed over.
126
+ */
127
+ const runParagraphsIntoTables = (tr, mode, styleResolver) => {
128
+ const removedMark = tr.doc.type.schema.marks[mode === "accept" ? "deletion" : "insertion"];
129
+ const tried = /* @__PURE__ */ new Set();
130
+ const targets = [];
131
+ const transfers = [];
132
+ const maps = [];
133
+ for (;;) {
134
+ let candidate = null;
135
+ tr.doc.descendants((node, pos, parent, index) => {
136
+ if (node.type.name !== "paragraph") return !node.isTextblock;
137
+ const next = parent?.maybeChild(index + 1);
138
+ if (runsIntoFollowingTable(node, next, mode) && !tried.has(pos)) candidate = pos;
139
+ return false;
140
+ });
141
+ if (candidate === null) return {
142
+ targets,
143
+ maps,
144
+ transfers
145
+ };
146
+ tried.add(candidate);
147
+ const ranIn = runParagraphIntoTable({
148
+ tr,
149
+ paragraphPos: candidate,
150
+ styleResolver,
151
+ removedMark
152
+ });
153
+ if (ranIn !== null) {
154
+ targets.push({
155
+ position: ranIn.position,
156
+ step: tr.steps.length
157
+ });
158
+ transfers.push(ranIn.transfer);
159
+ maps.push(ranIn.map);
160
+ tried.clear();
161
+ }
162
+ }
163
+ };
164
+ //#endregion
165
+ export { runInCellPending, runParagraphIntoTable, runParagraphsIntoTables, runsIntoFollowingTable };
@@ -1,9 +1,18 @@
1
- import { Plugin } from "prosemirror-state";
1
+ import { AllSelection, Plugin, Selection, TextSelection } from "prosemirror-state";
2
2
  //#region src/prosemirror/textInput.ts
3
3
  const dispatchEditorTextInput = (view, input) => {
4
4
  const { from, to } = typeof input === "string" ? view.state.selection : input;
5
5
  const text = typeof input === "string" ? input : input.text;
6
- const defaultTransaction = () => view.state.tr.insertText(text, from, to);
6
+ const defaultTransaction = () => {
7
+ if (!(view.state.selection instanceof AllSelection)) return view.state.tr.insertText(text, from, to);
8
+ const start = Selection.atStart(view.state.doc);
9
+ const end = Selection.atEnd(view.state.doc);
10
+ const last = end.$to.parent;
11
+ const tr = view.state.tr.insertText(text, start.from, end.to);
12
+ const $typed = tr.doc.resolve(start.from);
13
+ if (start.$from.parent.type.name === "paragraph" && last.type.name === "paragraph" && $typed.parent.type.name === "paragraph" && start.$from.parent !== last) tr.setNodeMarkup($typed.before(), void 0, last.attrs);
14
+ return tr.setSelection(TextSelection.create(tr.doc, start.from + text.length));
15
+ };
7
16
  if (!view.someProp("handleTextInput", (handler) => handler(view, from, to, text, defaultTransaction))) view.dispatch(defaultTransaction());
8
17
  };
9
18
  const replacementSelection = (view, event) => {
@@ -0,0 +1,17 @@
1
+ import { InlineWrapperLayer, TrackedRevisionAncestor } from "./schema/marks.js";
2
+ import { Mark, Node } from "prosemirror-model";
3
+ //#region src/prosemirror/trackedRevisionPath.d.ts
4
+ /** The wrappers `node` sits inside, outermost first; empty when it sits in none. */
5
+ declare const inlineWrapperStackOf: (node: Node) => readonly InlineWrapperLayer[];
6
+ /** One layer of the path used to write and enumerate a tracked run. */
7
+ declare const trackedRevisionLayerOf: (mark: Mark, node: Node) => TrackedRevisionAncestor;
8
+ type EnclosingInsertionAncestorsOptions = {
9
+ /** The insertion a deletion mark shares its text with, if any. */
10
+ insertionMark: Mark | undefined;
11
+ ancestors: readonly TrackedRevisionAncestor[];
12
+ node: Node;
13
+ };
14
+ /** The deletion's ancestor path, with the insertion it sits in as the outermost layer. */
15
+ declare const enclosingInsertionAncestors: ({ insertionMark, ancestors, node }: EnclosingInsertionAncestorsOptions) => readonly TrackedRevisionAncestor[];
16
+ //#endregion
17
+ export { enclosingInsertionAncestors, inlineWrapperStackOf, trackedRevisionLayerOf };
@@ -0,0 +1,32 @@
1
+ import { expectInlineWrapperMarkAttrs, expectTrackedChangeMarkAttrs } from "./attrs/index.js";
2
+ import { INLINE_WRAPPER_MARK_NAME } from "./extensions/marks/InlineWrapperExtension.js";
3
+ //#region src/prosemirror/trackedRevisionPath.ts
4
+ /** The wrappers `node` sits inside, outermost first; empty when it sits in none. */
5
+ const inlineWrapperStackOf = (node) => {
6
+ const mark = node.marks.find((candidate) => candidate.type.name === INLINE_WRAPPER_MARK_NAME);
7
+ return mark ? expectInlineWrapperMarkAttrs(mark).stack : [];
8
+ };
9
+ /** One layer of the path used to write and enumerate a tracked run. */
10
+ const trackedRevisionLayerOf = (mark, node) => {
11
+ const attrs = expectTrackedChangeMarkAttrs(mark);
12
+ const type = mark.type.name === "insertion" ? "insertion" : "deletion";
13
+ const moveType = type === "insertion" ? "moveTo" : "moveFrom";
14
+ return {
15
+ type: attrs.moveKind === moveType ? moveType : type,
16
+ revisionId: attrs.revisionId,
17
+ author: attrs.author || "Unknown",
18
+ ...attrs.date ? { date: attrs.date } : {},
19
+ ...attrs.utcDate ? { utcDate: attrs.utcDate } : {},
20
+ ...attrs.initials ? { initials: attrs.initials } : {},
21
+ outerWrapperCount: attrs._docxOuterWrapperCount ?? inlineWrapperStackOf(node).length
22
+ };
23
+ };
24
+ /** The deletion's ancestor path, with the insertion it sits in as the outermost layer. */
25
+ const enclosingInsertionAncestors = ({ insertionMark, ancestors, node }) => {
26
+ if (!insertionMark) return ancestors;
27
+ const attrs = expectTrackedChangeMarkAttrs(insertionMark);
28
+ if (ancestors.some(({ revisionId }) => revisionId === attrs.revisionId)) return ancestors;
29
+ return [trackedRevisionLayerOf(insertionMark, node), ...ancestors];
30
+ };
31
+ //#endregion
32
+ export { enclosingInsertionAncestors, inlineWrapperStackOf, trackedRevisionLayerOf };
package/dist/server.d.ts CHANGED
@@ -25,10 +25,10 @@ import { HEADING_LEVELS, HeadingLevel, InvalidFolioReportBuilderOptionsError, Ta
25
25
  import { BILINGUAL_TABLE_LAYOUTS, BilingualBorders, BilingualParagraphRef, BilingualRow, BilingualRowKind, BilingualTableLayout, BilingualTableParagraphRef, CreateBilingualDocumentOptions, CreateBilingualDocumentResult, InvalidBilingualDocumentOptionsError, createBilingualDocument, readBilingualDocument } from "./docx/server/createBilingualDocument.js";
26
26
  import { CreateBilingualDocxOptions, CreateBilingualDocxResult, createBilingualDocx, readBilingualDocx } from "./docx/server/createBilingualDocx.js";
27
27
  import { docxToMarkdown } from "./docx/server/docxToMarkdown.js";
28
- import { DocxParagraphSource, DocxTableRowKind, DocxTableRowPosition, ExtractedDocxParagraph, ExtractedDocxTableCell, ExtractedDocxTableCellParagraph, ExtractedDocxText, extractDocxText } from "./docx/server/extractDocxText.js";
28
+ import { DocxParagraphSource, DocxTableRowKind, DocxTableRowPosition, ExtractDocxTextOptions, ExtractedDocxParagraph, ExtractedDocxTableCell, ExtractedDocxTableCellParagraph, ExtractedDocxText, extractDocxText } from "./docx/server/extractDocxText.js";
29
29
  import { FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FolioDocxInspectedXmlPart, FolioDocxPackageInspection, FolioDocxPackageInspectionError, FolioDocxPackageInspectionErrorCode, FolioDocxPackageInspectionLimits, FolioDocxPackagePart, FolioDocxPackagePartKind, InspectDocxPackageOptions, inspectDocxPackage } from "./docx/server/inspectDocxPackage.js";
30
30
  import { FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, FolioYjsDocxMaterializationError, FolioYjsDocxMaterializationErrorCode, MaterializeYjsDocxOptions, materializeYjsDocx } from "./docx/server/materializeYjsDocx.js";
31
31
  import { FOLIO_YJS_SNAPSHOT_MIGRATION_ERROR_CODES, FolioYjsSnapshotMigrationError, FolioYjsSnapshotMigrationErrorCode, FolioYjsSnapshotMigrationResult, migrateFolioYjsSnapshot } from "./docx/server/migrateYjsAttrSchema.js";
32
32
  import { GenerateRedlineDocxOptions, GenerateRedlineDocxResult, GenerateRedlineUnprocessedStory, InvalidGenerateRedlineDocxOptionsError, generateRedlineDocx } from "./redline.js";
33
33
  import { FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FolioBlockDiff, FolioBlockProperty, FolioCompareDocxVersionsOptions, FolioDocumentMetadataValue, FolioFormatProperty, FolioMetadataDiff, FolioStoryDiff, FolioVersionBlockHandle, FolioVersionChangeProperty, FolioVersionComparisonPrivacyTransform, FolioVersionComparisonScope, FolioVersionDiff, FolioVersionDiffPrivacyOptions, FolioVersionDiffPrivacyReport, FolioVersionDiffSegment, FolioVersionDiffSummaryCounts, InvalidFolioVersionComparisonOptionsError, applyFolioVersionDiffPrivacy, compareDocxVersions, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope } from "./version-comparison.js";
34
- export { type ApplyDocxXmlPatchProposalArgs, type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, BILINGUAL_TABLE_LAYOUTS, type BilingualBorders, type BilingualParagraphRef, type BilingualRow, type BilingualRowKind, type BilingualTableLayout, type BilingualTableParagraphRef, type CreateBilingualDocumentOptions, type CreateBilingualDocumentResult, type CreateBilingualDocxOptions, type CreateBilingualDocxResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, DocxArchiveError, type DocxArchiveOptions, type DocxParagraphSource, type DocxTableRowKind, type DocxTableRowPosition, EnsureParaIdsError, type EnsureParaIdsOptions, type EnsureParaIdsResult, type EvaluateDocxXmlPatchProposalArgs, type ExtractDocumentStyleSetOptions, type ExtractedDocxParagraph, type ExtractedDocxTableCell, type ExtractedDocxTableCellParagraph, type ExtractedDocxText, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_ATTR_SCHEMA_VERSION, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_SNAPSHOT_MIGRATION_ERROR_CODES, FOLIO_YJS_UPDATE_MAX_BYTES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphSpacing, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsOptions, type FolioApplyDocumentOperationsToStoryOptions, type FolioApplyOperationsOptions, type FolioBlockDiff, type FolioBlockId, type FolioBlockProperty, type FolioCompareDocxVersionsOptions, type FolioContentParagraphKind, type FolioDocumentMetadataProperty, type FolioDocumentMetadataValue, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationBatchPrecondition, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationQueuedOperation, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, FolioDocumentPrivacyArchiveError, type FolioDocumentPrivacyOptions, type FolioDocumentPrivacyReport, type FolioDocumentPrivacyTransform, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioDocxConformanceCheck, type FolioDocxConformanceCheckId, type FolioDocxConformanceCheckStatus, type FolioDocxConformanceIssue, type FolioDocxConformanceIssueCode, type FolioDocxConformanceReport, type FolioDocxConformanceStatus, type FolioDocxInspectedXmlPart, type FolioDocxPackageInspection, FolioDocxPackageInspectionError, type FolioDocxPackageInspectionErrorCode, type FolioDocxPackageInspectionLimits, type FolioDocxPackagePart, type FolioDocxPackagePartKind, type FolioDocxPreparedXmlReplacement, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioDocxXmlPatchApplication, FolioDocxXmlPatchApplicationError, type FolioDocxXmlPatchApplicationReceipt, type FolioDocxXmlPatchProposal, type FolioDocxXmlPatchProposalEvaluation, type FolioDocxXmlPatchProposalIssue, type FolioDocxXmlPatchProposalIssueCode, type FolioDocxXmlPatchProposalLimits, type FolioDocxXmlReplacement, type FolioEditableDocumentStoryHandle, type FolioFormatProperty, type FolioMetadataDiff, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, type FolioReviewedStory, type FolioReviewedView, type FolioReviewerRepackReason, type FolioReviewerSaveOptions, type FolioReviewerSaveResult, type FolioRevisionStamp, type FolioStoryDiff, type FolioVersionBlockHandle, type FolioVersionChangeProperty, type FolioVersionComparisonPrivacyTransform, type FolioVersionComparisonScope, type FolioVersionDiff, type FolioVersionDiffPrivacyOptions, type FolioVersionDiffPrivacyReport, type FolioVersionDiffSegment, type FolioVersionDiffSummaryCounts, type FolioYjsAttrSchemaVersion, FolioYjsAttrSchemaVersionError, FolioYjsDocxMaterializationError, type FolioYjsDocxMaterializationErrorCode, FolioYjsSnapshotMigrationError, type FolioYjsSnapshotMigrationErrorCode, type FolioYjsSnapshotMigrationResult, type GenerateRedlineDocxOptions, type GenerateRedlineDocxResult, type GenerateRedlineUnprocessedStory, HEADING_LEVELS, type HeadingLevel, type InspectDocxPackageOptions, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, type MaterializeYjsDocxOptions, type ParseOptions, type RewriteDocxMetadataPrivacyResult, STELLA_STYLE_SET_NAME, type TableCellSpec, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, type ValidateDocxConformanceOptions, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, migrateFolioYjsSnapshot, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
34
+ export { type ApplyDocxXmlPatchProposalArgs, type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, BILINGUAL_TABLE_LAYOUTS, type BilingualBorders, type BilingualParagraphRef, type BilingualRow, type BilingualRowKind, type BilingualTableLayout, type BilingualTableParagraphRef, type CreateBilingualDocumentOptions, type CreateBilingualDocumentResult, type CreateBilingualDocxOptions, type CreateBilingualDocxResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, DocxArchiveError, type DocxArchiveOptions, type DocxParagraphSource, type DocxTableRowKind, type DocxTableRowPosition, EnsureParaIdsError, type EnsureParaIdsOptions, type EnsureParaIdsResult, type EvaluateDocxXmlPatchProposalArgs, type ExtractDocumentStyleSetOptions, type ExtractDocxTextOptions, type ExtractedDocxParagraph, type ExtractedDocxTableCell, type ExtractedDocxTableCellParagraph, type ExtractedDocxText, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_ATTR_SCHEMA_VERSION, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_SNAPSHOT_MIGRATION_ERROR_CODES, FOLIO_YJS_UPDATE_MAX_BYTES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphSpacing, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsOptions, type FolioApplyDocumentOperationsToStoryOptions, type FolioApplyOperationsOptions, type FolioBlockDiff, type FolioBlockId, type FolioBlockProperty, type FolioCompareDocxVersionsOptions, type FolioContentParagraphKind, type FolioDocumentMetadataProperty, type FolioDocumentMetadataValue, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationBatchPrecondition, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationQueuedOperation, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, FolioDocumentPrivacyArchiveError, type FolioDocumentPrivacyOptions, type FolioDocumentPrivacyReport, type FolioDocumentPrivacyTransform, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioDocxConformanceCheck, type FolioDocxConformanceCheckId, type FolioDocxConformanceCheckStatus, type FolioDocxConformanceIssue, type FolioDocxConformanceIssueCode, type FolioDocxConformanceReport, type FolioDocxConformanceStatus, type FolioDocxInspectedXmlPart, type FolioDocxPackageInspection, FolioDocxPackageInspectionError, type FolioDocxPackageInspectionErrorCode, type FolioDocxPackageInspectionLimits, type FolioDocxPackagePart, type FolioDocxPackagePartKind, type FolioDocxPreparedXmlReplacement, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioDocxXmlPatchApplication, FolioDocxXmlPatchApplicationError, type FolioDocxXmlPatchApplicationReceipt, type FolioDocxXmlPatchProposal, type FolioDocxXmlPatchProposalEvaluation, type FolioDocxXmlPatchProposalIssue, type FolioDocxXmlPatchProposalIssueCode, type FolioDocxXmlPatchProposalLimits, type FolioDocxXmlReplacement, type FolioEditableDocumentStoryHandle, type FolioFormatProperty, type FolioMetadataDiff, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, type FolioReviewedStory, type FolioReviewedView, type FolioReviewerRepackReason, type FolioReviewerSaveOptions, type FolioReviewerSaveResult, type FolioRevisionStamp, type FolioStoryDiff, type FolioVersionBlockHandle, type FolioVersionChangeProperty, type FolioVersionComparisonPrivacyTransform, type FolioVersionComparisonScope, type FolioVersionDiff, type FolioVersionDiffPrivacyOptions, type FolioVersionDiffPrivacyReport, type FolioVersionDiffSegment, type FolioVersionDiffSummaryCounts, type FolioYjsAttrSchemaVersion, FolioYjsAttrSchemaVersionError, FolioYjsDocxMaterializationError, type FolioYjsDocxMaterializationErrorCode, FolioYjsSnapshotMigrationError, type FolioYjsSnapshotMigrationErrorCode, type FolioYjsSnapshotMigrationResult, type GenerateRedlineDocxOptions, type GenerateRedlineDocxResult, type GenerateRedlineUnprocessedStory, HEADING_LEVELS, type HeadingLevel, type InspectDocxPackageOptions, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, type MaterializeYjsDocxOptions, type ParseOptions, type RewriteDocxMetadataPrivacyResult, STELLA_STYLE_SET_NAME, type TableCellSpec, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, type ValidateDocxConformanceOptions, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, migrateFolioYjsSnapshot, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/folio-core",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "description": "Headless, framework-neutral core of folio: the OOXML (.docx) parser, document model, ProseMirror integration, and page-layout engine. No React.",
5
5
  "keywords": [
6
6
  "document-model",
@@ -130,11 +130,11 @@
130
130
  "test:conformance:full": "FOLIO_CONFORMANCE=full bun test src/__tests__/editorCommandConformance.test.ts",
131
131
  "wasm:check": "bun ../../scripts/build-shaper-wasm.ts --check",
132
132
  "wasm:generate": "bun ../../scripts/build-shaper-wasm.ts --write",
133
- "test:property": "bun test $(grep -rlF 'fc.assert' src --include='*.test.ts')",
133
+ "test:property": "bun test $(grep -rlE 'fc\\.(assert|check)\\(|assertProperty\\(' src --include='*.test.ts')",
134
134
  "perf": "bun scripts/profile-editor.ts"
135
135
  },
136
136
  "dependencies": {
137
- "@stll/docx-core": "^0.28.1",
137
+ "@stll/docx-core": "^0.29.0",
138
138
  "@stll/docx-utils": "^0.1.0",
139
139
  "@stll/template-conditions": ">=0.4.0 <1.0.0",
140
140
  "better-result": "3.0.1",
@@ -142,7 +142,7 @@
142
142
  "dompurify": "^3.4.13",
143
143
  "fast-xml-parser": "^5.10.1",
144
144
  "hyphen": "1.14.1",
145
- "jszip": "3.10.1",
145
+ "jszip": "3.10.2",
146
146
  "prosemirror-commands": "^1.7.1",
147
147
  "prosemirror-dropcursor": "^1.8.2",
148
148
  "prosemirror-gapcursor": "^1.4.1",
@@ -155,7 +155,7 @@
155
155
  "prosemirror-transform": "^1.12.0",
156
156
  "prosemirror-view": "^1.41.8",
157
157
  "utif2": "^4.1.0",
158
- "valibot": "1.4.2",
158
+ "valibot": "1.5.0",
159
159
  "y-prosemirror": "^1.3.7",
160
160
  "yjs": "^13.6.31"
161
161
  },