@stll/folio-core 0.73.0 → 0.75.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 (221) hide show
  1. package/dist/ai-edits/clean-text.d.ts +4 -1
  2. package/dist/ai-edits/clean-text.js +21 -7
  3. package/dist/ai-edits/headless.d.ts +5 -2
  4. package/dist/ai-edits/headless.js +20 -14
  5. package/dist/ai-edits/note-references.d.ts +1 -1
  6. package/dist/ai-edits/note-references.js +1 -1
  7. package/dist/ai-edits/pending-suggestions.d.ts +9 -7
  8. package/dist/ai-edits/pending-suggestions.js +134 -88
  9. package/dist/ai-edits/pendingJoin.d.ts +5 -1
  10. package/dist/ai-edits/pendingJoin.js +12 -3
  11. package/dist/ai-edits/result-validation.js +1 -1
  12. package/dist/ai-edits/retired-comment-receipts.d.ts +2 -2
  13. package/dist/ai-edits/retired-comment-receipts.js +3 -18
  14. package/dist/ai-edits/snapshot.js +1 -1
  15. package/dist/ai-edits/table-cell-mutations.js +1 -1
  16. package/dist/ai-edits/tracked-batch-fidelity.d.ts +6 -10
  17. package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
  18. package/dist/canonical/canonicalBatchReview.d.ts +4 -1
  19. package/dist/canonical/canonicalBatchReview.js +32 -14
  20. package/dist/canonical/canonicalComments.d.ts +6 -2
  21. package/dist/canonical/canonicalComments.js +8 -4
  22. package/dist/canonical/canonicalInlineGaps.d.ts +56 -0
  23. package/dist/canonical/canonicalInlineGaps.js +118 -0
  24. package/dist/canonical/canonicalInlineProjection.d.ts +4 -13
  25. package/dist/canonical/canonicalInlineProjection.js +6 -28
  26. package/dist/canonical/canonicalProjectionBlocks.d.ts +4 -4
  27. package/dist/canonical/canonicalPublicOperations.js +99 -36
  28. package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
  29. package/dist/canonical/canonicalRefusalGrounds.js +56 -0
  30. package/dist/canonical/canonicalSelection.js +1 -1
  31. package/dist/canonical/canonicalSession.d.ts +12 -6
  32. package/dist/canonical/canonicalSession.js +129 -141
  33. package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
  34. package/dist/compare/inline-atoms.d.ts +35 -41
  35. package/dist/compare/inline-atoms.js +2 -465
  36. package/dist/compare/section-boundary-properties.d.ts +3 -30
  37. package/dist/compare/section-boundary-properties.js +4 -72
  38. package/dist/controller/autocompleteSuggestion.js +1 -1
  39. package/dist/controller/canonicalClipboard.js +45 -44
  40. package/dist/controller/canonicalComposition.d.ts +1 -1
  41. package/dist/controller/canonicalComposition.js +6 -6
  42. package/dist/controller/canonicalInput.d.ts +4 -2
  43. package/dist/controller/canonicalInput.js +34 -17
  44. package/dist/controller/canonicalPresence.js +1 -1
  45. package/dist/controller/canonicalRoomAuthority.js +1 -1
  46. package/dist/controller/canonicalRoomWire.js +1 -1
  47. package/dist/controller/canonicalStoryEditor.d.ts +2 -3
  48. package/dist/controller/canonicalStoryEditor.js +43 -25
  49. package/dist/controller/canonicalStructure.d.ts +19 -2
  50. package/dist/controller/canonicalStructure.js +140 -43
  51. package/dist/controller/canonicalTabRoom.js +1 -1
  52. package/dist/controller/canonicalYjsRoom.js +1 -1
  53. package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
  54. package/dist/controller/deferredDisplayListPainter.js +34 -0
  55. package/dist/controller/folioEditor.js +4 -2
  56. package/dist/controller/headerFooterEditorManager.js +3 -17
  57. package/dist/controller/hiddenEditorApi.d.ts +24 -3
  58. package/dist/controller/hiddenEditorApi.js +4 -17
  59. package/dist/controller/hiddenEditorManager.js +136 -197
  60. package/dist/controller/layoutPipeline.d.ts +4 -86
  61. package/dist/controller/layoutPipeline.js +8 -727
  62. package/dist/controller/layoutPipelineExecution.d.ts +94 -0
  63. package/dist/controller/layoutPipelineExecution.js +730 -0
  64. package/dist/controller/noteEditorManager.js +3 -16
  65. package/dist/document-operations.js +1 -1
  66. package/dist/docx/blockContentParser.d.ts +1 -3
  67. package/dist/docx/blockContentParser.js +3 -10
  68. package/dist/docx/canonicalSave.d.ts +4 -3
  69. package/dist/docx/canonicalSave.js +4 -3
  70. package/dist/docx/canonicalSessionInput.js +1 -1
  71. package/dist/docx/containerChildren.js +1 -1
  72. package/dist/docx/createDocx.d.ts +4 -0
  73. package/dist/docx/createDocx.js +6 -0
  74. package/dist/docx/listMarkerComputation.d.ts +24 -17
  75. package/dist/docx/listMarkerComputation.js +31 -60
  76. package/dist/docx/listModelNormalization.js +8 -15
  77. package/dist/docx/modelValidation.js +1 -1
  78. package/dist/docx/parser.js +1 -1
  79. package/dist/docx/reviewResolutionProvenance.js +1 -1
  80. package/dist/docx/rezip.d.ts +16 -3
  81. package/dist/docx/rezip.js +36 -10
  82. package/dist/docx/selectiveSave.js +13 -5
  83. package/dist/docx/serializer/borderSerializer.js +1 -1
  84. package/dist/docx/serializer/commentSerializer.js +1 -1
  85. package/dist/docx/serializer/documentSerializer.js +1 -1
  86. package/dist/docx/serializer/paragraphSerializer.js +3 -3
  87. package/dist/docx/serializer/runSerializer.js +1 -1
  88. package/dist/docx/serializer/sectionPropertiesSerializer.js +1 -1
  89. package/dist/docx/serializer/tableSerializer.js +1 -1
  90. package/dist/docx/serializer/textFormattingSerializer.js +1 -1
  91. package/dist/docx/serializer/trackedChangeAttributes.js +1 -1
  92. package/dist/docx/server/templatePlan/apply.js +107 -14
  93. package/dist/docx/server/templatePlan/blocks.d.ts +16 -1
  94. package/dist/docx/server/templatePlan/blocks.js +93 -7
  95. package/dist/docx/server/templatePlan/builders.d.ts +37 -2
  96. package/dist/docx/server/templatePlan/builders.js +196 -5
  97. package/dist/docx/server/templatePlan/emit.d.ts +2 -0
  98. package/dist/docx/server/templatePlan/emit.js +2 -0
  99. package/dist/docx/server/templatePlan/inspect.js +81 -61
  100. package/dist/docx/server/templatePlan/labels.d.ts +16 -2
  101. package/dist/docx/server/templatePlan/labels.js +131 -20
  102. package/dist/docx/server/templatePlan/plan.d.ts +15 -1
  103. package/dist/docx/server/templatePlan/plan.js +62 -13
  104. package/dist/docx/server/templatePlan/planShape.js +52 -4
  105. package/dist/docx/server/templatePlan/story.d.ts +8 -0
  106. package/dist/docx/server/templatePlan/story.js +11 -1
  107. package/dist/docx/server/templatePlan/types.d.ts +176 -18
  108. package/dist/docx/server/templatePlan/types.js +1 -0
  109. package/dist/docx/server/templatePlan/verify.js +60 -11
  110. package/dist/docx/server/templatePlan/xml.d.ts +5 -0
  111. package/dist/docx/server/templatePlan/xml.js +7 -1
  112. package/dist/docx/storyBlockReplay.js +1 -1
  113. package/dist/docx/xmlParser.js +1 -1
  114. package/dist/i18n/loadMessages.d.ts +5 -0
  115. package/dist/i18n/loadMessages.js +46 -0
  116. package/dist/i18n/locales.d.ts +3 -0
  117. package/dist/i18n/locales.js +17 -0
  118. package/dist/i18n/messages/ar.gen.js +1 -0
  119. package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
  120. package/dist/i18n/messages/catalogs.gen.js +17 -0
  121. package/dist/i18n/messages/cs.gen.js +1 -0
  122. package/dist/i18n/messages/de.gen.js +1 -0
  123. package/dist/i18n/messages/en.gen.js +1 -0
  124. package/dist/i18n/messages/es.gen.js +1 -0
  125. package/dist/i18n/messages/et.gen.js +1 -0
  126. package/dist/i18n/messages/fr.gen.js +1 -0
  127. package/dist/i18n/messages/he.gen.js +1 -0
  128. package/dist/i18n/messages/hi.gen.js +1 -0
  129. package/dist/i18n/messages/hu.gen.js +1 -0
  130. package/dist/i18n/messages/lt.gen.js +1 -0
  131. package/dist/i18n/messages/lv.gen.js +1 -0
  132. package/dist/i18n/messages/messages.gen.d.ts +1 -0
  133. package/dist/i18n/messages/pl.gen.js +1 -0
  134. package/dist/i18n/messages/pt-BR.gen.js +1 -0
  135. package/dist/i18n/messages/sk.gen.js +1 -0
  136. package/dist/i18n/messages/tr.gen.js +1 -0
  137. package/dist/i18n/messages/zh-CN.gen.js +1 -0
  138. package/dist/i18n/messages.d.ts +3 -2
  139. package/dist/i18n/messages.js +4 -16
  140. package/dist/internal/clipboardTransformPlugin.d.ts +3 -0
  141. package/dist/internal/clipboardTransformPlugin.js +13 -0
  142. package/dist/internal/extensionRuntime.d.ts +7 -0
  143. package/dist/internal/extensionRuntime.js +28 -0
  144. package/dist/internal/paragraphFormattingSerialization.js +1 -1
  145. package/dist/internal/starterKitExtensions.d.ts +20 -0
  146. package/dist/internal/starterKitExtensions.js +123 -0
  147. package/dist/internal/wholeStoryRevisionResolution.js +2 -2
  148. package/dist/layout-bridge/convert/toFlowBlocks.js +0 -12
  149. package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
  150. package/dist/prosemirror/attrs/index.js +1 -1
  151. package/dist/prosemirror/canonicalSelectionRange.js +1 -1
  152. package/dist/prosemirror/canonicalTableCommands.js +1 -1
  153. package/dist/prosemirror/commands/comments.js +3 -3
  154. package/dist/prosemirror/commands/contentControls.js +1 -1
  155. package/dist/prosemirror/commands/pastePlainText.js +2 -3
  156. package/dist/prosemirror/commands/replaceRangeText.js +1 -1
  157. package/dist/prosemirror/commentRecords.js +2 -2
  158. package/dist/prosemirror/conversion/fromProseDoc.d.ts +0 -5
  159. package/dist/prosemirror/conversion/fromProseDoc.js +2 -9
  160. package/dist/prosemirror/conversion/index.d.ts +2 -2
  161. package/dist/prosemirror/conversion/index.js +2 -2
  162. package/dist/prosemirror/extensions/ExtensionManager.js +4 -22
  163. package/dist/prosemirror/extensions/StarterKit.d.ts +4 -27
  164. package/dist/prosemirror/extensions/StarterKit.js +29 -115
  165. package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -2
  166. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -1
  167. package/dist/prosemirror/extensions/features/ImagePasteExtension.js +1 -1
  168. package/dist/prosemirror/extensions/features/ListExtension.js +7 -2
  169. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
  170. package/dist/prosemirror/extensions/index.d.ts +2 -1
  171. package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +8 -3
  172. package/dist/prosemirror/extensions/nodes/TableExtension.js +7 -40
  173. package/dist/prosemirror/hyperlinkRemoval.js +7 -2
  174. package/dist/prosemirror/index.d.ts +2 -2
  175. package/dist/prosemirror/index.js +2 -2
  176. package/dist/prosemirror/keptRangeBoundaries.js +1 -1
  177. package/dist/prosemirror/listMarker.d.ts +1 -6
  178. package/dist/prosemirror/listMarker.js +4 -56
  179. package/dist/prosemirror/listNumbering.js +1 -1
  180. package/dist/prosemirror/noteReferenceOccurrences.js +1 -1
  181. package/dist/prosemirror/noteReferenceReview.d.ts +2 -56
  182. package/dist/prosemirror/noteReferenceReview.js +2 -243
  183. package/dist/prosemirror/pastedCommentCopies.js +1 -1
  184. package/dist/prosemirror/plugins/documentNumbering.js +1 -1
  185. package/dist/prosemirror/plugins/documentStyles.js +1 -1
  186. package/dist/prosemirror/replacedAnnotations.js +1 -1
  187. package/dist/prosemirror/suggestionCommands.d.ts +47 -0
  188. package/dist/prosemirror/suggestionCommands.js +31 -0
  189. package/dist/prosemirror/tableCellPaste.js +1 -1
  190. package/dist/prosemirror/tableRunIn.js +1 -1
  191. package/dist/prosemirror/textInput.js +1 -1
  192. package/dist/server.d.ts +2 -2
  193. package/dist/types/canonicalCapabilities.d.ts +42 -93
  194. package/dist/types/canonicalCapabilities.js +53 -91
  195. package/dist/types/canonicalComments.d.ts +2 -2
  196. package/dist/types/canonicalSections.d.ts +2 -2
  197. package/dist/utils/clipboard.d.ts +2 -28
  198. package/dist/utils/clipboard.js +1 -96
  199. package/dist/utils/clipboardFiles.d.ts +27 -0
  200. package/dist/utils/clipboardFiles.js +98 -0
  201. package/dist/utils/rulerControl.d.ts +1 -0
  202. package/dist/utils/rulerControl.js +2 -1
  203. package/package.json +2 -2
  204. package/dist/ai-edits/apply.d.ts +0 -94
  205. package/dist/ai-edits/apply.js +0 -6637
  206. package/dist/ai-edits/note-story-inventory.d.ts +0 -5
  207. package/dist/ai-edits/note-story-inventory.js +0 -10
  208. package/dist/ai-edits/revisionStretches.d.ts +0 -32
  209. package/dist/ai-edits/revisionStretches.js +0 -147
  210. package/dist/document-operations-apply.d.ts +0 -15
  211. package/dist/document-operations-apply.js +0 -280
  212. package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -12
  213. package/dist/prosemirror/extensions/core/HistoryExtension.js +0 -114
  214. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +0 -23
  215. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +0 -270
  216. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +0 -51
  217. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +0 -411
  218. package/dist/prosemirror/plugins/suggestionMode.d.ts +0 -92
  219. package/dist/prosemirror/plugins/suggestionMode.js +0 -1515
  220. package/dist/prosemirror/tablePositionedBookmarks.d.ts +0 -8
  221. package/dist/prosemirror/tablePositionedBookmarks.js +0 -80
@@ -7,8 +7,8 @@ import { applyParagraphUpdates, continueNumbering, listItemAttrs, resolveListTar
7
7
  import { resolveListState } from "../../listState.js";
8
8
  import { effectiveParagraphNumberingReference, paragraphNumberingSourcesFromBoundary, removedNumberingAttr } from "../../numberingAttr.js";
9
9
  import { getDocumentNumbering } from "../../plugins/documentNumbering.js";
10
- import { SUGGESTION_META, makeRevisionInfo, suggestRangeDeletion } from "../../plugins/suggestionMode.js";
11
10
  import { listLevelAttrPatch, listLevelIndentRemovalPatch } from "../../styles/resolvedStyleAttrs.js";
11
+ import { SUGGESTION_META, makeRevisionInfo, suggestRangeDeletion } from "../../suggestionCommands.js";
12
12
  import { createExtension } from "../create.js";
13
13
  import { goToNextCell, goToPrevCell } from "../nodes/TableExtension.js";
14
14
  import { Priority } from "../types.js";
@@ -421,7 +421,12 @@ const suggestedListAutoformat = (autoformat) => new Plugin({ appendTransaction(t
421
421
  if (!requests) return null;
422
422
  const start = $head.start();
423
423
  const tr = state.tr;
424
- if (!suggestRangeDeletion(state, tr, start, $head.pos)) return null;
424
+ if (!suggestRangeDeletion({
425
+ state,
426
+ tr,
427
+ from: start,
428
+ to: $head.pos
429
+ })) return null;
425
430
  const from = tr.mapping.map(start);
426
431
  if (!numberParagraphs({
427
432
  state,
@@ -1,7 +1,7 @@
1
1
  import { readOutlineLevelAttr } from "../../outlineLevelAttr.js";
2
2
  import { getDocumentBuiltInStyles, getDocumentStyleResolver } from "../../plugins/documentStyleState.js";
3
- import { Fragment, Slice } from "prosemirror-model";
4
3
  import { headingLevelOf } from "@stll/docx-core/model";
4
+ import { Fragment, Slice } from "prosemirror-model";
5
5
  // src/prosemirror/extensions/features/pastedHeadingStyles.ts
6
6
  /**
7
7
  * Retarget pasted heading paragraphs at the open document's own heading style.
@@ -1,3 +1,4 @@
1
+ import { StarterKitOptions } from "../../internal/starterKitExtensions.js";
1
2
  import { ExtensionManager } from "./ExtensionManager.js";
2
- import { StarterKitOptions, createStarterKit } from "./StarterKit.js";
3
+ import { createStarterKit } from "./StarterKit.js";
3
4
  export { ExtensionManager, type StarterKitOptions, createStarterKit };
@@ -1,7 +1,7 @@
1
1
  import { expectFootnoteRefMarkAttrs } from "../../attrs/index.js";
2
2
  import { withCanonicalCommand } from "../../canonicalCommands.js";
3
3
  import { mintNoteReferenceOccurrenceId, noteReferenceOccurrencePlugin } from "../../noteReferenceOccurrences.js";
4
- import { suggestRangeDeletion, suggestionModeKey } from "../../plugins/suggestionMode.js";
4
+ import { isSuggestionModeActive, suggestRangeDeletion } from "../../suggestionCommands.js";
5
5
  import { createMarkExtension } from "../create.js";
6
6
  import { expandNoteReferenceDeletionRange, noteReferenceRanges } from "./noteReferenceDeletion.js";
7
7
  import { panic } from "better-result";
@@ -72,7 +72,7 @@ const FootnoteRefExtension = createMarkExtension({
72
72
  },
73
73
  onSchemaReady() {
74
74
  const deleteWholeNoteReference = (direction) => (state, dispatch) => {
75
- if (suggestionModeKey.getState(state)?.active) return false;
75
+ if (isSuggestionModeActive(state)) return false;
76
76
  const { from, to, empty } = state.selection;
77
77
  const range = expandNoteReferenceDeletionRange(state.doc, empty && direction === "backward" ? Math.max(0, from - 1) : from, empty && direction === "forward" ? Math.min(state.doc.content.size, to + 1) : to);
78
78
  if (!range) return false;
@@ -110,7 +110,12 @@ const FootnoteRefExtension = createMarkExtension({
110
110
  if (references.length === 0) return false;
111
111
  if (!dispatch) return true;
112
112
  const tr = state.tr;
113
- for (const reference of references.toReversed()) if (!suggestRangeDeletion(state, tr, reference.from, reference.to)) tr.delete(reference.from, reference.to);
113
+ for (const reference of references.toReversed()) if (!suggestRangeDeletion({
114
+ state,
115
+ tr,
116
+ from: reference.from,
117
+ to: reference.to
118
+ })) tr.delete(reference.from, reference.to);
114
119
  dispatch(tr.scrollIntoView());
115
120
  return true;
116
121
  };
@@ -8,16 +8,14 @@ import { textFlowCss } from "../../../utils/textDirectionFlow.js";
8
8
  import { expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs } from "../../attrs/index.js";
9
9
  import { withCanonicalCellMerge, withCanonicalCellSplit, withCanonicalColumnDeletion, withCanonicalColumnInsertion, withCanonicalRowDeletion, withCanonicalRowInsertion, withCanonicalSelectionCommand, withCanonicalTableAttributeCommand, withCanonicalTableDeletion, withCanonicalTableInsertion } from "../../canonicalTableCommands.js";
10
10
  import { mintRevisionId } from "../../plugins/revisionIds.js";
11
- import { makeRevisionInfo } from "../../plugins/suggestionMode.js";
11
+ import { makeRevisionInfo } from "../../suggestionCommands.js";
12
12
  import { pasteTableCells, pastedSliceWithNewTableCells } from "../../tableCellPaste.js";
13
13
  import { insertTableColumn, removeTableColumns, removeTableRow } from "../../tableGridMutation.js";
14
- import { tablePositionedBookmarksPlugin } from "../../tablePositionedBookmarks.js";
15
14
  import { createExtension, createNodeExtension } from "../create.js";
16
15
  import { panic } from "better-result";
17
- import { CellSelection, TableMap, columnResizing, mergeCells, selectedRect, splitCell, tableEditing, tableNodeTypes } from "prosemirror-tables";
18
16
  import { statesNoBorder } from "@stll/docx-core/model";
19
- import { Plugin, PluginKey, Selection, TextSelection } from "prosemirror-state";
20
- import { Decoration, DecorationSet } from "prosemirror-view";
17
+ import { Plugin, Selection, TextSelection } from "prosemirror-state";
18
+ import { CellSelection, TableMap, mergeCells, selectedRect, splitCell, tableNodeTypes } from "prosemirror-tables";
21
19
  // src/prosemirror/extensions/nodes/TableExtension.ts
22
20
  /**
23
21
  * Table Extension — 4 node specs + plugins + commands
@@ -1964,42 +1962,11 @@ const TablePluginExtension = createExtension({
1964
1962
  return false;
1965
1963
  };
1966
1964
  }
1967
- const activeCellKey = new PluginKey("activeCell");
1968
- const activeCellPlugin = new Plugin({
1969
- key: activeCellKey,
1970
- props: { decorations(state) {
1971
- const { selection } = state;
1972
- if (selection instanceof CellSelection) return DecorationSet.empty;
1973
- const { $from } = selection;
1974
- for (let d = $from.depth; d > 0; d--) {
1975
- const node = $from.node(d);
1976
- if (node.type.name === "tableCell" || node.type.name === "tableHeader") {
1977
- const pos = $from.before(d);
1978
- return DecorationSet.create(state.doc, [Decoration.node(pos, pos + node.nodeSize, { class: "activeCell" })]);
1979
- }
1980
- }
1981
- return DecorationSet.empty;
1982
- } }
1983
- });
1984
- const tableCellPastePlugin = new Plugin({
1985
- key: new PluginKey("tableCellPaste"),
1986
- props: {
1987
- transformPasted: (slice) => pastedSliceWithNewTableCells(slice),
1988
- handlePaste: (view, _event, slice) => pasteTableCells(view.state, slice, view.dispatch)
1989
- }
1990
- });
1991
1965
  return {
1992
- plugins: [
1993
- columnResizing({
1994
- handleWidth: 5,
1995
- cellMinWidth: 25,
1996
- lastColumnResizable: true
1997
- }),
1998
- tableCellPastePlugin,
1999
- tableEditing(),
2000
- tablePositionedBookmarksPlugin(),
2001
- activeCellPlugin
2002
- ],
1966
+ plugins: [new Plugin({ props: {
1967
+ transformPasted: pastedSliceWithNewTableCells,
1968
+ handlePaste: (view, _event, slice) => pasteTableCells(view.state, slice, view.dispatch)
1969
+ } })],
2003
1970
  keyboardShortcuts: {
2004
1971
  Backspace: chainCommands(deleteTableIfSelected(), preventTableMergeAtGap()),
2005
1972
  Delete: chainCommands(deleteTableIfSelected(), preventTableMergeAtGap())
@@ -1,8 +1,8 @@
1
1
  import { BUILT_IN_STYLE_NAME } from "../docx/builtInStyles.js";
2
2
  import { getDocumentBuiltInStyles, getDocumentStyleResolver } from "./plugins/documentStyleState.js";
3
- import { isSuggestionModeActive, makeRevisionInfo, suggestRangeDeletion } from "./plugins/suggestionMode.js";
4
3
  import { readAuthoredRunFormatting, reconcileRunFormattingMarks } from "./runFormattingReconciliation.js";
5
4
  import { paragraphRunStyleContextAt } from "./runStyleFormatting.js";
5
+ import { isSuggestionModeActive, makeRevisionInfo, suggestRangeDeletion } from "./suggestionCommands.js";
6
6
  import { TaggedError } from "better-result";
7
7
  // src/prosemirror/hyperlinkRemoval.ts
8
8
  /**
@@ -153,7 +153,12 @@ const removeHyperlinkInRange = (state, tr, from, to) => {
153
153
  const change = previousFormatting && !hasPendingPropertyChange(piece.node.marks) ? propertyChange(previousFormatting) : null;
154
154
  setInlineMarks(tr, piece.from, piece.to, piece.node.marks, change ? change.addToSet(marks) : marks);
155
155
  }
156
- suggestRangeDeletion(state, tr, range.from, range.to);
156
+ suggestRangeDeletion({
157
+ state,
158
+ tr,
159
+ from: range.from,
160
+ to: range.to
161
+ });
157
162
  }
158
163
  return tr;
159
164
  };
@@ -15,7 +15,7 @@ import "./commands/index.js";
15
15
  import { insertPageBreak } from "./commands/pageBreak.js";
16
16
  import { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, continueNumbering, decreaseIndent, decreaseListLevel, generateTableOfContents, increaseIndent, increaseListLevel, removeList, removeTabStop, restartNumbering, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setNumberingValue, setRtl, toggleBidi, toggleBulletList, toggleNumberedList } from "./commands/paragraph.js";
17
17
  import { addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyTableStyle, autoFitContents, deleteColumn, deleteRow, deleteTable, distributeColumns, insertTable, mergeCells, removeTableBorders, selectColumn, selectRow, selectTable, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setInsideTableBorders, setOutsideTableBorders, setRowHeight, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, splitCell, toggleHeaderRow, toggleNoWrap } from "./commands/table.js";
18
- import { FromProseDocOptions, ProjectionReuse, fromProseDoc, updateDocumentContent } from "./conversion/fromProseDoc.js";
18
+ import { FromProseDocOptions, ProjectionReuse, fromProseDoc } from "./conversion/fromProseDoc.js";
19
19
  import "./conversion/index.js";
20
20
  import { ToProseDocOptions, createEmptyDoc, toProseDoc } from "./conversion/toProseDoc.js";
21
21
  import { getParagraphAlignment, getParagraphBidi, getStyleId } from "./extensions/core/ParagraphExtension.js";
@@ -40,4 +40,4 @@ import "./styles/index.js";
40
40
  import { ResolvedParagraphStyle, StyleResolver, createStyleResolver } from "./styles/styleResolver.js";
41
41
  import { ProseMirrorDocumentValidationIssue, ValidateProseMirrorDocumentResult, assertValidProseMirrorDocument, formatProseMirrorDocumentIssues, validateProseMirrorDocument } from "./validation.js";
42
42
  import { TextSelection } from "prosemirror-state";
43
- export { type ActiveListState, type BorderPreset, type CapturedTextFormatting, type FontFamilyAttrs, type FontSizeAttrs, type FromProseDocOptions, type HyperlinkAttrs, type ImageAttrs, type ListNumberingMenuState, type ListState, type ListType, NO_LIST_NUMBERING_MENU, NO_LIST_STATE, PAINTABLE_MARK_NAMES, type ParagraphAttrs, type ProjectionReuse, type ProseMirrorDocumentValidationIssue, type ResolvedParagraphStyle, type SelectionChangeCallback, type SelectionContext, type SelectionState, StyleResolver, type TableBorderCommandSpec, type TableBorderPreset, type TableCellBorderCommandSpec, type TableContextInfo, type TextColorAttrs, TextSelection, type ToProseDocOptions, type UnderlineAttrs, type ValidateProseMirrorDocumentResult, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, assertValidProseMirrorDocument, autoFitContents, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createDocumentStylesPlugin, createEmptyDoc, createSelectionTrackerPlugin, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, documentStylesKey, ensureParaIdsInState, extractSelectionContext, extractSelectionState, formatProseMirrorDocumentIssues, fromProseDoc, generateTableOfContents, getDocumentBuiltInStyles, getDocumentStyleResolver, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getSelectionContext, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertImageFromFile, insertPageBreak, insertPageBreakInView, insertTable, insertTableInView, insertTableOfContentsInView, isHyperlinkActive, isInList, isInListState, isInTableCell as isInTable, isMarkActive, listNumberingMenuState, listStateLevel, mergeCells, removeHyperlink, removeList, removeTabStop, removeTableBorders, resolveListState, restartNumbering, sameListState, schema, selectColumn, selectRow, selectTable, selectionTrackerKey, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, singletonManager, splitCell, toProseDoc, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline, updateDocumentContent, validateProseMirrorDocument };
43
+ export { type ActiveListState, type BorderPreset, type CapturedTextFormatting, type FontFamilyAttrs, type FontSizeAttrs, type FromProseDocOptions, type HyperlinkAttrs, type ImageAttrs, type ListNumberingMenuState, type ListState, type ListType, NO_LIST_NUMBERING_MENU, NO_LIST_STATE, PAINTABLE_MARK_NAMES, type ParagraphAttrs, type ProjectionReuse, type ProseMirrorDocumentValidationIssue, type ResolvedParagraphStyle, type SelectionChangeCallback, type SelectionContext, type SelectionState, StyleResolver, type TableBorderCommandSpec, type TableBorderPreset, type TableCellBorderCommandSpec, type TableContextInfo, type TextColorAttrs, TextSelection, type ToProseDocOptions, type UnderlineAttrs, type ValidateProseMirrorDocumentResult, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, assertValidProseMirrorDocument, autoFitContents, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createDocumentStylesPlugin, createEmptyDoc, createSelectionTrackerPlugin, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, documentStylesKey, ensureParaIdsInState, extractSelectionContext, extractSelectionState, formatProseMirrorDocumentIssues, fromProseDoc, generateTableOfContents, getDocumentBuiltInStyles, getDocumentStyleResolver, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getSelectionContext, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertImageFromFile, insertPageBreak, insertPageBreakInView, insertTable, insertTableInView, insertTableOfContentsInView, isHyperlinkActive, isInList, isInListState, isInTableCell as isInTable, isMarkActive, listNumberingMenuState, listStateLevel, mergeCells, removeHyperlink, removeList, removeTabStop, removeTableBorders, resolveListState, restartNumbering, sameListState, schema, selectColumn, selectRow, selectTable, selectionTrackerKey, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, singletonManager, splitCell, toProseDoc, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline, validateProseMirrorDocument };
@@ -4,7 +4,7 @@ import { insertImageFromFile } from "./commands/image.js";
4
4
  import { insertPageBreak } from "./commands/pageBreak.js";
5
5
  import { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, continueNumbering, decreaseIndent, decreaseListLevel, generateTableOfContents, increaseIndent, increaseListLevel, removeList, removeTabStop, restartNumbering, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setNumberingValue, setRtl, toggleBidi, toggleBulletList, toggleNumberedList } from "./commands/paragraph.js";
6
6
  import { addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyTableStyle, autoFitContents, deleteColumn, deleteRow, deleteTable, distributeColumns, insertTable, mergeCells, removeTableBorders, selectColumn, selectRow, selectTable, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setInsideTableBorders, setOutsideTableBorders, setRowHeight, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, splitCell, toggleHeaderRow, toggleNoWrap } from "./commands/table.js";
7
- import { fromProseDoc, updateDocumentContent } from "./conversion/fromProseDoc.js";
7
+ import { fromProseDoc } from "./conversion/fromProseDoc.js";
8
8
  import { createEmptyDoc, toProseDoc } from "./conversion/toProseDoc.js";
9
9
  import { getParagraphAlignment, getParagraphBidi, getStyleId } from "./extensions/core/ParagraphExtension.js";
10
10
  import { getListInfo, isInList } from "./extensions/features/ListExtension.js";
@@ -23,4 +23,4 @@ import { extractSelectionState } from "./selectionState.js";
23
23
  import { StyleResolver, createStyleResolver } from "./styles/styleResolver.js";
24
24
  import { assertValidProseMirrorDocument, formatProseMirrorDocumentIssues, validateProseMirrorDocument } from "./validation.js";
25
25
  import { TextSelection } from "prosemirror-state";
26
- export { NO_LIST_NUMBERING_MENU, NO_LIST_STATE, PAINTABLE_MARK_NAMES, StyleResolver, TextSelection, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, assertValidProseMirrorDocument, autoFitContents, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createDocumentStylesPlugin, createEmptyDoc, createSelectionTrackerPlugin, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, documentStylesKey, ensureParaIdsInState, extractSelectionContext, extractSelectionState, formatProseMirrorDocumentIssues, fromProseDoc, generateTableOfContents, getDocumentBuiltInStyles, getDocumentStyleResolver, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getSelectionContext, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertImageFromFile, insertPageBreak, insertPageBreakInView, insertTable, insertTableInView, insertTableOfContentsInView, isHyperlinkActive, isInList, isInListState, isInTableCell as isInTable, isMarkActive, listNumberingMenuState, listStateLevel, mergeCells, removeHyperlink, removeList, removeTabStop, removeTableBorders, resolveListState, restartNumbering, sameListState, schema, selectColumn, selectRow, selectTable, selectionTrackerKey, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, singletonManager, splitCell, toProseDoc, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline, updateDocumentContent, validateProseMirrorDocument };
26
+ export { NO_LIST_NUMBERING_MENU, NO_LIST_STATE, PAINTABLE_MARK_NAMES, StyleResolver, TextSelection, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, assertValidProseMirrorDocument, autoFitContents, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createDocumentStylesPlugin, createEmptyDoc, createSelectionTrackerPlugin, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, documentStylesKey, ensureParaIdsInState, extractSelectionContext, extractSelectionState, formatProseMirrorDocumentIssues, fromProseDoc, generateTableOfContents, getDocumentBuiltInStyles, getDocumentStyleResolver, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getSelectionContext, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertImageFromFile, insertPageBreak, insertPageBreakInView, insertTable, insertTableInView, insertTableOfContentsInView, isHyperlinkActive, isInList, isInListState, isInTableCell as isInTable, isMarkActive, listNumberingMenuState, listStateLevel, mergeCells, removeHyperlink, removeList, removeTabStop, removeTableBorders, resolveListState, restartNumbering, sameListState, schema, selectColumn, selectRow, selectTable, selectionTrackerKey, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, singletonManager, splitCell, toProseDoc, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline, validateProseMirrorDocument };
@@ -12,8 +12,8 @@ import { RANGE_ANCHOR_NODE_NAME } from "./extensions/nodes/RangeAnchorExtension.
12
12
  import { expectMoveRangeBoundaryAttrs } from "./moveRangeBoundaryAttrs.js";
13
13
  import { expectRangeAnchorAttrs } from "./rangeAnchorAttrs.js";
14
14
  import { retainedTrackedRevisionMark, trackedRevisionPathOf } from "./trackedRevisionPath.js";
15
- import { Mark } from "prosemirror-model";
16
15
  import { planWellFormedRanges, recordsCopyOrigin } from "@stll/docx-core/ops";
16
+ import { Mark } from "prosemirror-model";
17
17
  // src/prosemirror/keptRangeBoundaries.ts
18
18
  /**
19
19
  * Range boundaries rejecting a change keeps from the content it removes.
@@ -5,13 +5,8 @@ import { ParagraphAttrs } from "./schema/nodes.js";
5
5
  export type ListCounterState = {
6
6
  counters: Map<number, number[]>;
7
7
  abstractCounters: Map<number, number[]>;
8
+ /** The levels of list instances a paragraph has used, as `numId:level`. */
8
9
  seenLevels: Set<string>;
9
- restartedNumIds?: Set<number>;
10
- previousList?: {
11
- abstractNumId: number | null;
12
- fromStyle: boolean;
13
- numId: number | null;
14
- };
15
10
  lastAdvancedNumId?: number;
16
11
  };
17
12
  export type ListCounterStreams = {
@@ -30,13 +30,7 @@ function createListCounterState() {
30
30
  return {
31
31
  counters: /* @__PURE__ */ new Map(),
32
32
  abstractCounters: /* @__PURE__ */ new Map(),
33
- seenLevels: /* @__PURE__ */ new Set(),
34
- restartedNumIds: /* @__PURE__ */ new Set(),
35
- previousList: {
36
- abstractNumId: null,
37
- fromStyle: false,
38
- numId: null
39
- }
33
+ seenLevels: /* @__PURE__ */ new Set()
40
34
  };
41
35
  }
42
36
  function cloneListCounterState(state) {
@@ -56,12 +50,6 @@ function cloneListCounterState(state) {
56
50
  counters,
57
51
  abstractCounters,
58
52
  seenLevels: new Set(state.seenLevels),
59
- restartedNumIds: new Set(state.restartedNumIds ?? []),
60
- previousList: { ...state.previousList ?? {
61
- abstractNumId: null,
62
- fromStyle: false,
63
- numId: null
64
- } },
65
53
  ...state.lastAdvancedNumId !== void 0 ? { lastAdvancedNumId: state.lastAdvancedNumId } : {}
66
54
  };
67
55
  }
@@ -142,14 +130,7 @@ function formatNumberedMarker(counters, level) {
142
130
  return parts.length === 0 ? "1." : `${parts.join(".")}.`;
143
131
  }
144
132
  function advanceListMarker(attrs, state) {
145
- if (!hasListRendering(attrs)) {
146
- state.previousList = {
147
- abstractNumId: null,
148
- fromStyle: false,
149
- numId: null
150
- };
151
- return null;
152
- }
133
+ if (!hasListRendering(attrs)) return null;
153
134
  const markerTemplate = attrs.listMarkerTemplate ?? attrs.listMarker;
154
135
  const foldedMarkerSuffix = attrs.listFoldedMarkerSuffix ?? void 0;
155
136
  const effectiveNumbering = effectiveParagraphNumbering(paragraphNumberingSourcesFromBoundary({
@@ -170,44 +151,16 @@ function advanceListMarker(attrs, state) {
170
151
  forceDecimal: attrs.listIsLegal
171
152
  });
172
153
  }
173
- state.previousList = {
174
- abstractNumId: null,
175
- fromStyle: false,
176
- numId: null
177
- };
178
154
  return marker;
179
155
  }
180
156
  if (attrs.listIsBullet) {
181
- state.previousList = {
182
- abstractNumId: null,
183
- fromStyle: false,
184
- numId: null
185
- };
186
157
  if (foldedMarkerSuffix !== void 0 && attrs.listMarkerTemplate == null) return attrs.listMarker ?? null;
187
158
  const marker = convertBulletToUnicode(attrs.listMarkerTemplate ?? attrs.listMarker ?? "", bulletMarkerFontName(attrs.listMarkerFormatting));
188
159
  return foldedMarkerSuffix === void 0 ? marker : `${marker}\t${foldedMarkerSuffix}`;
189
160
  }
190
- const firstInstanceEncounter = !state.counters.has(numId);
191
- let counters = state.counters.get(numId) ?? Array.from({ length: 9 }, () => NaN);
192
161
  const abstractNumId = attrs.listAbstractNumId;
193
- const previousList = state.previousList ?? {
194
- abstractNumId: null,
195
- fromStyle: false,
196
- numId: null
197
- };
198
- const restartedNumIds = state.restartedNumIds ??= /* @__PURE__ */ new Set();
199
- const latestAbstractCounters = abstractNumId === void 0 ? void 0 : state.abstractCounters.get(abstractNumId);
200
- const styleNumbering = attrs.numPr?.kind !== "reference" && attrs.numPrFromStyle?.kind === "reference";
201
- const resumesRestartedInstance = firstInstanceEncounter && attrs.listStartOverride == null && abstractNumId !== void 0 && previousList.abstractNumId === abstractNumId && previousList.numId !== null && previousList.numId !== numId && restartedNumIds.has(previousList.numId);
202
- const resumesStyleInstance = firstInstanceEncounter && !styleNumbering && attrs.listStartOverride == null && abstractNumId !== void 0 && previousList.abstractNumId === abstractNumId && previousList.fromStyle;
203
- if (latestAbstractCounters && (styleNumbering || resumesRestartedInstance || resumesStyleInstance)) counters = latestAbstractCounters;
204
- if (attrs.listStartOverride != null || resumesRestartedInstance || previousList.numId === numId && restartedNumIds.has(numId)) restartedNumIds.add(numId);
205
- if (level > 0) {
206
- if (counters.slice(0, level).every((counter) => !Number.isFinite(counter))) for (let index = 0; index < level; index += 1) {
207
- const latestCounter = latestAbstractCounters?.[index];
208
- counters[index] = latestCounter !== void 0 && Number.isFinite(latestCounter) ? latestCounter : attrs.listLevelStarts?.[index] ?? 1;
209
- }
210
- }
162
+ const counters = (abstractNumId === void 0 ? void 0 : state.abstractCounters.get(abstractNumId)) ?? state.counters.get(numId) ?? Array.from({ length: 9 }, () => NaN);
163
+ for (let index = 0; index < level; index += 1) if (!Number.isFinite(counters[index])) counters[index] = attrs.listLevelStarts?.[index] ?? 1;
211
164
  const seenKey = `${numId}:${level}`;
212
165
  if (!state.seenLevels.has(seenKey)) {
213
166
  state.seenLevels.add(seenKey);
@@ -224,11 +177,6 @@ function advanceListMarker(attrs, state) {
224
177
  state.counters.set(numId, counters);
225
178
  state.lastAdvancedNumId = numId;
226
179
  if (abstractNumId !== void 0) state.abstractCounters.set(abstractNumId, counters);
227
- state.previousList = {
228
- abstractNumId: abstractNumId ?? null,
229
- fromStyle: Boolean(styleNumbering),
230
- numId
231
- };
232
180
  const levelFormats = attrs.listLevelNumFmts ?? (attrs.listNumFmt ? [attrs.listNumFmt] : void 0);
233
181
  if (markerTemplate?.includes("%") && (foldedMarkerSuffix === void 0 || attrs.listMarkerTemplate != null)) {
234
182
  const marker = resolveListTemplate({
@@ -11,8 +11,8 @@ import { effectiveParagraphNumbering, effectiveParagraphNumberingReference, para
11
11
  import { directParagraphIndentation } from "./paragraphIndentation.js";
12
12
  import { getDocumentNumbering } from "./plugins/documentNumbering.js";
13
13
  import { getDocumentStyleResolver } from "./plugins/documentStyleState.js";
14
- import { SUGGESTION_META, makeRevisionInfo } from "./plugins/suggestionMode.js";
15
14
  import { listAttrsFromNumbering, listIndentationProvenancePatch } from "./styles/resolvedStyleAttrs.js";
15
+ import { SUGGESTION_META, makeRevisionInfo } from "./suggestionCommands.js";
16
16
  // src/prosemirror/listNumbering.ts
17
17
  const PARAGRAPH_NODE = "paragraph";
18
18
  /**
@@ -1,7 +1,7 @@
1
1
  import { readFootnoteRefMarkAttrs } from "./attrs/index.js";
2
2
  import { Result, TaggedError, panic } from "better-result";
3
- import { Fragment, Mark, Slice } from "prosemirror-model";
4
3
  import { Plugin } from "prosemirror-state";
4
+ import { Fragment, Mark, Slice } from "prosemirror-model";
5
5
  import { isHistoryTransaction } from "prosemirror-history";
6
6
  // src/prosemirror/noteReferenceOccurrences.ts
7
7
  const NoteReferenceEditRefusalBase = TaggedError("NoteReferenceEditRefusal");
@@ -1,12 +1,6 @@
1
- /**
2
- * A note goes with its reference. Deleting a note's reference while tracking
3
- * changes deletes the note's text too, so rejecting that deletion must give
4
- * the note its text back, whichever surface resolves it: the body editor
5
- * resolves the reference, and this resolves the note's story to match.
6
- */
1
+ /** Read note references and retain the corresponding model stories. */
7
2
  import { document_d_exports } from "../types/document.js";
8
- import { Mark, Node } from "prosemirror-model";
9
- import { Transform } from "prosemirror-transform";
3
+ import { Node } from "prosemirror-model";
10
4
  type NoteKind = "footnote" | "endnote";
11
5
  /** `footnote:<id>` or `endnote:<id>`. */
12
6
  export type NoteKey = `${NoteKind}:${number}`;
@@ -15,54 +9,6 @@ export type NoteKey = `${NoteKind}:${number}`;
15
9
  * deletion: a reference is deleted when every character of it is.
16
10
  */
17
11
  export declare const noteReferenceStates: (doc: Node) => Map<NoteKey, "live" | "deleted">;
18
- /** The notes whose reference a change took from pending deletion back to live. */
19
- export declare const noteReferencesRestored: (before: Node, after: Node) => NoteKey[];
20
- /**
21
- * The revisions that deleted a note along with its reference: its text and
22
- * its paragraph marks, deleted by the reference deletion's author at its
23
- * date. A deletion in the note made some other time is a change of its own,
24
- * which resolving the reference leaves alone.
25
- */
26
- export declare const noteDeletionRevisions: (doc: Node, reference: Mark) => number[];
27
- /**
28
- * The document with the named notes' deletions that went with their
29
- * reference rejected: the notes whose reference's deletion was rejected get
30
- * their text back. `before` is the body that still had those deletions.
31
- */
32
- export declare const restoreNotes: (document: document_d_exports.Document, keys: Iterable<NoteKey>, before: Node) => document_d_exports.Document;
33
- /** The deletion each pending-deleted note reference carries. */
34
- export declare const referenceDeletions: (doc: Node) => Map<NoteKey, Mark>;
35
- /**
36
- * Delete a note's text and its paragraph marks along with its reference: by
37
- * the reference deletion's author at its date, so resolving the reference
38
- * resolves them too (see {@link noteDeletionRevisions}).
39
- */
40
- export declare const deleteNoteWithReference: <T extends Transform>(transform: T, reference: Mark) => T;
41
- /**
42
- * Keeps an editor's notes following their references across body edits. The
43
- * editor reports the body as it was before the edits it has not yet written
44
- * back, and reconciles the document it writes back:
45
- *
46
- * - a reference whose deletion is rejected gives its note back its text;
47
- * - a reference deleted again, as undoing that reject does, takes the note's
48
- * text with it: the note returns to what it was, or, when the note changed
49
- * since, its text is deleted along with the reference.
50
- */
51
- export type NoteReferenceFollower = {
52
- /** The body before the edits the next {@link reconcile} writes back. */
53
- noteBase: (before: Node) => void;
54
- /** The document to write back, its notes following the body's references. */
55
- reconcile: (document: document_d_exports.Document, body: Node) => document_d_exports.Document;
56
- /**
57
- * `document` with the note changes an earlier {@link reconcile} wrote back
58
- * and the editor's document has not taken in yet: a save reads the editor
59
- * right after a write-back, before the host hands the result back.
60
- */
61
- withPending: (document: document_d_exports.Document) => document_d_exports.Document;
62
- /** Forget the pending base and what earlier restores replaced (a new document). */
63
- reset: () => void;
64
- };
65
- export declare const createNoteReferenceFollower: () => NoteReferenceFollower;
66
12
  /** The notes model content refers to, live or pending deletion. */
67
13
  export declare const noteKeysReferencedIn: (content: unknown) => Set<NoteKey>;
68
14
  /**