@stll/folio-core 0.54.2 → 0.55.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 (199) hide show
  1. package/dist/ai-edits/apply.js +22 -1
  2. package/dist/ai-edits/headless.js +1 -0
  3. package/dist/compare/content-types.d.ts +3 -15
  4. package/dist/controller/canonicalComposition.d.ts +36 -0
  5. package/dist/controller/canonicalComposition.js +168 -0
  6. package/dist/controller/canonicalInput.d.ts +45 -0
  7. package/dist/controller/canonicalInput.js +338 -0
  8. package/dist/controller/canonicalOperations.d.ts +22 -0
  9. package/dist/controller/canonicalOperations.js +85 -0
  10. package/dist/controller/canonicalReview.d.ts +12 -0
  11. package/dist/controller/canonicalReview.js +19 -0
  12. package/dist/controller/canonicalSession.d.ts +149 -0
  13. package/dist/controller/canonicalSession.js +1038 -0
  14. package/dist/controller/canonicalStoryEditor.d.ts +34 -0
  15. package/dist/controller/canonicalStoryEditor.js +82 -0
  16. package/dist/controller/canonicalStructure.d.ts +16 -0
  17. package/dist/controller/canonicalStructure.js +269 -0
  18. package/dist/controller/folioEditor.d.ts +1 -1
  19. package/dist/controller/folioEditor.js +9 -0
  20. package/dist/controller/headerFooterEditorManager.d.ts +4 -0
  21. package/dist/controller/headerFooterEditorManager.js +71 -3
  22. package/dist/controller/hiddenEditorApi.d.ts +35 -0
  23. package/dist/controller/hiddenEditorApi.js +25 -8
  24. package/dist/controller/hiddenEditorManager.d.ts +11 -2
  25. package/dist/controller/hiddenEditorManager.js +456 -30
  26. package/dist/controller/layoutPipeline.d.ts +1 -1
  27. package/dist/controller/layoutPipeline.js +2 -0
  28. package/dist/controller/noteEditorManager.d.ts +4 -0
  29. package/dist/controller/noteEditorManager.js +113 -15
  30. package/dist/docx/attributeRemainder.js +1 -0
  31. package/dist/docx/canonicalSessionInput.d.ts +11 -0
  32. package/dist/docx/canonicalSessionInput.js +27 -0
  33. package/dist/docx/canonicalStoryRepack.d.ts +10 -0
  34. package/dist/docx/canonicalStoryRepack.js +41 -0
  35. package/dist/docx/contentTypeRegistry.d.ts +8 -0
  36. package/dist/docx/contentTypeRegistry.js +64 -0
  37. package/dist/docx/ensureParaIds.d.ts +7 -1
  38. package/dist/docx/ensureParaIds.js +163 -211
  39. package/dist/docx/foldedListNumberFields.d.ts +85 -0
  40. package/dist/docx/foldedListNumberFields.js +267 -0
  41. package/dist/docx/headerFooterVerbatim.d.ts +14 -1
  42. package/dist/docx/headerFooterVerbatim.js +95 -2
  43. package/dist/docx/noteIds.d.ts +5 -0
  44. package/dist/docx/noteIds.js +6 -2
  45. package/dist/docx/noteReferenceMark.d.ts +3 -1
  46. package/dist/docx/noteReferenceMark.js +15 -14
  47. package/dist/docx/numberingParser.d.ts +3 -1
  48. package/dist/docx/numberingParser.js +17 -3
  49. package/dist/docx/packageParts.d.ts +3 -1
  50. package/dist/docx/packageParts.js +65 -16
  51. package/dist/docx/paragraphMarkPropertyPresence.d.ts +9 -0
  52. package/dist/docx/paragraphMarkPropertyPresence.js +21 -0
  53. package/dist/docx/paragraphParser.js +101 -53
  54. package/dist/docx/paragraphPropertySource.d.ts +15 -1
  55. package/dist/docx/paragraphPropertySource.js +76 -22
  56. package/dist/docx/parser.js +2 -1
  57. package/dist/docx/reviewHistoryNamespace.d.ts +4 -0
  58. package/dist/docx/reviewHistoryNamespace.js +4 -0
  59. package/dist/docx/reviewResolutionProvenance.d.ts +25 -0
  60. package/dist/docx/reviewResolutionProvenance.js +153 -0
  61. package/dist/docx/rezip.d.ts +7 -3
  62. package/dist/docx/rezip.js +107 -45
  63. package/dist/docx/runConsolidator.d.ts +2 -58
  64. package/dist/docx/runConsolidator.js +3 -175
  65. package/dist/docx/runParser.d.ts +2 -1
  66. package/dist/docx/runParser.js +156 -116
  67. package/dist/docx/saveDiagnostics.d.ts +11 -0
  68. package/dist/docx/saveDiagnostics.js +0 -0
  69. package/dist/docx/selectiveSave.d.ts +2 -1
  70. package/dist/docx/selectiveSave.js +4 -1
  71. package/dist/docx/selectiveXmlPatch.d.ts +16 -8
  72. package/dist/docx/selectiveXmlPatch.js +74 -2
  73. package/dist/docx/serializer/headerFooterSerializer.d.ts +5 -1
  74. package/dist/docx/serializer/headerFooterSerializer.js +19 -11
  75. package/dist/docx/serializer/noteSerializer.d.ts +2 -2
  76. package/dist/docx/serializer/noteSerializer.js +24 -8
  77. package/dist/docx/serializer/paragraphSerializer.js +41 -4
  78. package/dist/docx/serializer/partNamespaces.js +2 -1
  79. package/dist/docx/serializer/runSerializer.js +3 -1
  80. package/dist/docx/settingsHeaderFooterUpdate.d.ts +5 -0
  81. package/dist/docx/settingsHeaderFooterUpdate.js +90 -0
  82. package/dist/docx/settingsParser.d.ts +1 -2
  83. package/dist/docx/settingsParser.js +5 -6
  84. package/dist/docx/storyBlockReplay.d.ts +11 -0
  85. package/dist/docx/storyBlockReplay.js +367 -0
  86. package/dist/docx/streamingXmlParser.d.ts +22 -1
  87. package/dist/docx/streamingXmlParser.js +49 -3
  88. package/dist/docx/structuralXmlPatch.js +8 -1
  89. package/dist/docx/verbatimCapture.d.ts +3 -1
  90. package/dist/docx/verbatimCapture.js +49 -6
  91. package/dist/i18n/messages/ar.gen.d.ts +5 -0
  92. package/dist/i18n/messages/ar.gen.js +656 -0
  93. package/dist/i18n/messages/cs.gen.d.ts +5 -0
  94. package/dist/i18n/messages/cs.gen.js +656 -0
  95. package/dist/i18n/messages/de.gen.d.ts +5 -0
  96. package/dist/i18n/messages/de.gen.js +656 -0
  97. package/dist/i18n/messages/en.gen.d.ts +5 -0
  98. package/dist/i18n/messages/en.gen.js +656 -0
  99. package/dist/i18n/messages/es.gen.d.ts +5 -0
  100. package/dist/i18n/messages/es.gen.js +656 -0
  101. package/dist/i18n/messages/et.gen.d.ts +5 -0
  102. package/dist/i18n/messages/et.gen.js +656 -0
  103. package/dist/i18n/messages/fr.gen.d.ts +5 -0
  104. package/dist/i18n/messages/fr.gen.js +656 -0
  105. package/dist/i18n/messages/he.gen.d.ts +5 -0
  106. package/dist/i18n/messages/he.gen.js +656 -0
  107. package/dist/i18n/messages/hi.gen.d.ts +5 -0
  108. package/dist/i18n/messages/hi.gen.js +656 -0
  109. package/dist/i18n/messages/hu.gen.d.ts +5 -0
  110. package/dist/i18n/messages/hu.gen.js +656 -0
  111. package/dist/i18n/messages/locales.d.ts +5 -0
  112. package/dist/i18n/messages/locales.js +22 -0
  113. package/dist/i18n/messages/lt.gen.d.ts +5 -0
  114. package/dist/i18n/messages/lt.gen.js +656 -0
  115. package/dist/i18n/messages/lv.gen.d.ts +5 -0
  116. package/dist/i18n/messages/lv.gen.js +656 -0
  117. package/dist/i18n/messages/pl.gen.d.ts +5 -0
  118. package/dist/i18n/messages/pl.gen.js +656 -0
  119. package/dist/i18n/messages/pt-BR.gen.d.ts +5 -0
  120. package/dist/i18n/messages/pt-BR.gen.js +656 -0
  121. package/dist/i18n/messages/sk.gen.d.ts +5 -0
  122. package/dist/i18n/messages/sk.gen.js +656 -0
  123. package/dist/i18n/messages/tr.gen.d.ts +5 -0
  124. package/dist/i18n/messages/tr.gen.js +656 -0
  125. package/dist/i18n/messages/zh-CN.gen.d.ts +5 -0
  126. package/dist/i18n/messages/zh-CN.gen.js +656 -0
  127. package/dist/i18n/messages.d.ts +2 -3
  128. package/dist/i18n/messages.js +1 -19
  129. package/dist/internal/noteMarkerAttrs.d.ts +8 -0
  130. package/dist/internal/noteMarkerAttrs.js +16 -0
  131. package/dist/internal/pageBreakRunSourceDescendantIndex.js +1 -0
  132. package/dist/internal/prosemirrorAttrBoundary.d.ts +21 -0
  133. package/dist/internal/prosemirrorAttrBoundary.js +50 -0
  134. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  135. package/dist/layout-bridge/convert/footnoteLayout.js +3 -3
  136. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  137. package/dist/layout-bridge/convert/headerFooterLayout.js +1 -0
  138. package/dist/layout-bridge/convert/noteReferences.d.ts +1 -3
  139. package/dist/layout-bridge/convert/noteReferences.js +1 -6
  140. package/dist/layout-bridge/convert/paragraphRuns.js +2 -4
  141. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +2 -2
  142. package/dist/layout-bridge/convert/toFlowBlocks.js +2 -2
  143. package/dist/managers/DocumentLoaderManager.d.ts +1 -0
  144. package/dist/managers/DocumentLoaderManager.js +8 -1
  145. package/dist/markdown/renderBlock.js +15 -1
  146. package/dist/markdown/renderParagraph.js +9 -13
  147. package/dist/markdown/renderRuns.js +3 -2
  148. package/dist/markdown/renderTable.js +2 -0
  149. package/dist/markdown/types.d.ts +3 -9
  150. package/dist/prosemirror/attrs/index.d.ts +2 -12
  151. package/dist/prosemirror/attrs/index.js +22 -48
  152. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +2 -1
  153. package/dist/prosemirror/canonicalCommands.d.ts +97 -0
  154. package/dist/prosemirror/canonicalCommands.js +28 -0
  155. package/dist/prosemirror/commands/pageBreak.js +15 -1
  156. package/dist/prosemirror/commentReferenceAttrs.d.ts +2 -1
  157. package/dist/prosemirror/conversion/fromProseDoc.js +91 -19
  158. package/dist/prosemirror/conversion/listRenderingDefinition.d.ts +6 -0
  159. package/dist/prosemirror/conversion/listRenderingDefinition.js +97 -0
  160. package/dist/prosemirror/conversion/toProseDoc.d.ts +4 -3
  161. package/dist/prosemirror/conversion/toProseDoc.js +51 -11
  162. package/dist/prosemirror/executeEditorCommand.d.ts +11 -0
  163. package/dist/prosemirror/executeEditorCommand.js +26 -0
  164. package/dist/prosemirror/extensions/StarterKit.js +2 -0
  165. package/dist/prosemirror/extensions/core/ParagraphExtension.js +50 -19
  166. package/dist/prosemirror/extensions/features/ListExtension.js +18 -5
  167. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +5 -2
  168. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +13 -1
  169. package/dist/prosemirror/extensions/marks/TextColorExtension.js +3 -2
  170. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -0
  171. package/dist/prosemirror/extensions/marks/markUtils.js +70 -8
  172. package/dist/prosemirror/extensions/nodes/NoteMarkerExtension.d.ts +6 -0
  173. package/dist/prosemirror/extensions/nodes/NoteMarkerExtension.js +36 -0
  174. package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +4 -2
  175. package/dist/prosemirror/listMarker.d.ts +1 -0
  176. package/dist/prosemirror/listMarker.js +16 -7
  177. package/dist/prosemirror/listNumbering.js +26 -5
  178. package/dist/prosemirror/listRenderingAttrs.d.ts +1 -0
  179. package/dist/prosemirror/listRenderingAttrs.js +3 -0
  180. package/dist/prosemirror/markupViewNotes.js +3 -2
  181. package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +2 -1
  182. package/dist/prosemirror/noteReferenceReview.js +5 -3
  183. package/dist/prosemirror/plugins/suggestionMode.js +50 -2
  184. package/dist/prosemirror/rangeAnchorAttrs.d.ts +2 -1
  185. package/dist/prosemirror/runFormattingFromMarks.d.ts +4 -1
  186. package/dist/prosemirror/runFormattingFromMarks.js +15 -1
  187. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -1
  188. package/dist/prosemirror/runFormattingInlineCarriers.js +4 -1
  189. package/dist/prosemirror/schema/marks.d.ts +2 -0
  190. package/dist/prosemirror/schema/nodes.d.ts +10 -2
  191. package/dist/prosemirror/textBoxAnchorAttrs.d.ts +2 -1
  192. package/dist/prosemirror/textInput.js +5 -1
  193. package/dist/prosemirror/trackedRevisionPath.js +2 -1
  194. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +1 -0
  195. package/dist/prosemirror/trackedRunInlineAtoms.js +1 -0
  196. package/dist/prosemirror/validation.js +4 -0
  197. package/dist/types/content.d.ts +2 -2
  198. package/dist/utils/createDocument.js +2 -2
  199. package/package.json +14 -2
@@ -1,7 +1,10 @@
1
1
  import { isSerializablePreservedAttribute } from "../../docx/attributeRemainder.js";
2
2
  import { DRAWING_ANCHOR_FLAG_KEYS } from "../../docx/drawingAnchor.js";
3
+ import { isFoldedListNumber } from "../../docx/foldedListNumberFields.js";
3
4
  import { GRAPHIC_FRAME_LOCK_KEYS } from "../../docx/graphicFrameLocks.js";
4
5
  import { allowsDirectDrawingEdit, isDrawingRawXmlMode } from "../../docx/imageRawXml.js";
6
+ import { isParagraphMarkResolutionJoin, isResolutionJoins } from "../../docx/reviewResolutionProvenance.js";
7
+ import { attrsRecord, attrsResult, expectAttrs, expectCachedNodeAttrs, expectNodeType, isRecord } from "../../internal/prosemirrorAttrBoundary.js";
5
8
  import { COUNTER_FORMAT_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LINE_SPACING_RULE_VALUES, OUTLINE_STYLE_ATTR_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_DIRECTION_VALUES, TEXT_EFFECT_VALUES, UNDERLINE_STYLE_VALUES } from "../../types/documentEnumValues.js";
6
9
  import { canonicalJson } from "../../utils/canonicalJson.js";
7
10
  import { normalizeHorizontalScalePercent } from "../../utils/horizontalScale.js";
@@ -10,7 +13,6 @@ import { outlineLevelFromAttrValue } from "../outlineLevelAttr.js";
10
13
  import { isParagraphDirection } from "../paragraphDirection.js";
11
14
  import { COMPLEX_SCRIPT_RUN_PROPERTY_KEYS, RUN_FORMATTING_BOOLEAN_PROPERTIES, RUN_FORMATTING_VALUE_PROPERTIES, TRACKED_CHANGE_PROVENANCE_VALUES } from "../schema/marks.js";
12
15
  import { PRESERVED_XML_LEVELS, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES } from "../schema/nodes.js";
13
- import { panic } from "better-result";
14
16
  import { DRAWING_RAW_XML_MODES, THEME_COLORS, isOoxmlSymbolCharacter } from "@stll/docx-core/model";
15
17
  import { isSafePreservedChildXml, isWithinPreservedMarkupBudget } from "@stll/docx-core/schema";
16
18
  //#region src/prosemirror/attrs/index.ts
@@ -216,6 +218,11 @@ const readParagraphAttrsUncached = (node) => {
216
218
  const attrs = attrsRecord(node.attrs);
217
219
  const issues = [];
218
220
  expectNodeType(node, "paragraph", issues);
221
+ const paragraphMark = attrs["pPrMark"];
222
+ if (isRecord(paragraphMark) && paragraphMark["resolutionJoin"] !== void 0 && !isParagraphMarkResolutionJoin(paragraphMark["resolutionJoin"])) issues.push({
223
+ path: "paragraph.attrs.pPrMark.resolutionJoin",
224
+ message: "Expected a non-negative bounded paragraph cut depth."
225
+ });
219
226
  optionalString(attrs, "paraId", "paragraph.attrs.paraId", issues);
220
227
  optionalString(attrs, "_docxParagraphSourceToken", "paragraph.attrs._docxParagraphSourceToken", issues);
221
228
  optionalString(attrs, "textId", "paragraph.attrs.textId", issues);
@@ -243,6 +250,7 @@ const readParagraphAttrsUncached = (node) => {
243
250
  optionalBoolean(attrs, "listIsLegal", "paragraph.attrs.listIsLegal", issues);
244
251
  optionalString(attrs, "listMarker", "paragraph.attrs.listMarker", issues);
245
252
  optionalString(attrs, "listMarkerTemplate", "paragraph.attrs.listMarkerTemplate", issues);
253
+ optionalString(attrs, "listFoldedMarkerSuffix", "paragraph.attrs.listFoldedMarkerSuffix", issues);
246
254
  optionalBoolean(attrs, "listMarkerHidden", "paragraph.attrs.listMarkerHidden", issues);
247
255
  optionalTextFormatting(attrs, "listMarkerFormatting", "paragraph.attrs.listMarkerFormatting", issues);
248
256
  optionalOneOf(attrs, "listMarkerAlignment", "paragraph.attrs.listMarkerAlignment", issues, [
@@ -362,6 +370,11 @@ const readPreservedXmlAttrs = (node) => {
362
370
  expectNodeType(node, "preservedXml", issues);
363
371
  requiredString(attrs, "xml", "preservedXml.attrs.xml", issues);
364
372
  requiredString(attrs, "text", "preservedXml.attrs.text", issues);
373
+ const folded = attrs["foldedListNumber"];
374
+ if (folded !== void 0 && folded !== null && !isFoldedListNumber(folded)) issues.push({
375
+ path: "preservedXml.attrs.foldedListNumber",
376
+ message: "Expected a folded list-number field or tab."
377
+ });
365
378
  if (!PRESERVED_XML_LEVEL_VALUES.has(attrs["level"])) issues.push({
366
379
  path: "preservedXml.attrs.level",
367
380
  message: `Expected one of ${[...PRESERVED_XML_LEVEL_VALUES].join(", ")}.`
@@ -580,6 +593,7 @@ const isFieldCodeContent = (value) => {
580
593
  case "symbol": return typeof value["font"] === "string" && typeof value["char"] === "string";
581
594
  case "footnoteRef":
582
595
  case "endnoteRef": return typeof value["id"] === "number";
596
+ case "noteMarker": return value["kind"] === "footnote" || value["kind"] === "endnote";
583
597
  case "drawing": return isRecord(value["image"]);
584
598
  case "shape": return isRecord(value["shape"]);
585
599
  case "tab":
@@ -953,7 +967,7 @@ const readCommentMarkAttrs = (mark) => {
953
967
  return attrsResult(attrs, issues);
954
968
  };
955
969
  const expectCommentMarkAttrs = (mark) => expectCachedMarkAttrs(mark, commentAttrsCache, readCommentMarkAttrs, "comment attrs");
956
- const isTrackedRevisionAncestorArray = (value) => Array.isArray(value) && value.length > 0 && value.every((ancestor) => isRecord(ancestor) && TRACKED_REVISION_ANCESTOR_TYPES.some((type) => type === ancestor["type"]) && typeof ancestor["revisionId"] === "number" && Number.isSafeInteger(ancestor["revisionId"]) && ancestor["revisionId"] >= 0 && typeof ancestor["author"] === "string" && (ancestor["date"] === void 0 || typeof ancestor["date"] === "string") && (ancestor["utcDate"] === void 0 || typeof ancestor["utcDate"] === "string") && (ancestor["initials"] === void 0 || typeof ancestor["initials"] === "string") && typeof ancestor["outerWrapperCount"] === "number" && Number.isSafeInteger(ancestor["outerWrapperCount"]) && ancestor["outerWrapperCount"] >= 0);
970
+ const isTrackedRevisionAncestorArray = (value) => Array.isArray(value) && value.length > 0 && value.every((ancestor) => isRecord(ancestor) && TRACKED_REVISION_ANCESTOR_TYPES.some((type) => type === ancestor["type"]) && typeof ancestor["revisionId"] === "number" && Number.isSafeInteger(ancestor["revisionId"]) && ancestor["revisionId"] >= 0 && typeof ancestor["author"] === "string" && (ancestor["date"] === void 0 || typeof ancestor["date"] === "string") && (ancestor["utcDate"] === void 0 || typeof ancestor["utcDate"] === "string") && (ancestor["initials"] === void 0 || typeof ancestor["initials"] === "string") && typeof ancestor["outerWrapperCount"] === "number" && Number.isSafeInteger(ancestor["outerWrapperCount"]) && ancestor["outerWrapperCount"] >= 0 && (ancestor["resolutionJoins"] === void 0 || isResolutionJoins(ancestor["resolutionJoins"])));
957
971
  const readTrackedChangeMarkAttrs = (mark) => {
958
972
  const attrs = attrsRecord(mark.attrs);
959
973
  const issues = [];
@@ -969,6 +983,11 @@ const readTrackedChangeMarkAttrs = (mark) => {
969
983
  message: "Expected a non-negative safe integer."
970
984
  });
971
985
  const ancestors = attrs["_docxRevisionAncestors"];
986
+ const resolutionJoins = attrs["_docxResolutionJoins"];
987
+ if (resolutionJoins !== void 0 && resolutionJoins !== null && !isResolutionJoins(resolutionJoins)) issues.push({
988
+ path: `${mark.type.name}.attrs._docxResolutionJoins`,
989
+ message: "Expected valid tracked-resolution provenance."
990
+ });
972
991
  if (ancestors !== void 0 && ancestors !== null && !isTrackedRevisionAncestorArray(ancestors)) issues.push({
973
992
  path: `${mark.type.name}.attrs._docxRevisionAncestors`,
974
993
  message: "Expected a non-empty array of valid revision ancestors."
@@ -1310,46 +1329,6 @@ const mergeTableCellAttrs = (node, patch) => {
1310
1329
  }
1311
1330
  };
1312
1331
  };
1313
- const attrsRecord = (attrs) => {
1314
- if (isRecord(attrs)) return attrs;
1315
- return {};
1316
- };
1317
- const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
1318
- const attrsResult = (attrs, issues) => {
1319
- if (issues.length > 0) return {
1320
- ok: false,
1321
- issues
1322
- };
1323
- let normalizedAttrs;
1324
- return {
1325
- ok: true,
1326
- get value() {
1327
- if (normalizedAttrs !== void 0) return normalizedAttrs;
1328
- const presentAttrs = {};
1329
- for (const key in attrs) {
1330
- if (!Object.hasOwn(attrs, key)) continue;
1331
- const value = attrs[key];
1332
- if (value !== null) presentAttrs[key] = value;
1333
- }
1334
- normalizedAttrs = presentAttrs;
1335
- return normalizedAttrs;
1336
- },
1337
- set value(value) {
1338
- normalizedAttrs = value;
1339
- }
1340
- };
1341
- };
1342
- const expectAttrs = (result, label) => {
1343
- if (result.ok) return result.value;
1344
- panic(`Invalid ProseMirror ${label}:\n${result.issues.map((issue) => `${issue.path}: ${issue.message}`).join("\n")}`);
1345
- };
1346
- function expectCachedNodeAttrs(node, cache, reader, label) {
1347
- const cached = cache.get(node);
1348
- if (cached) return cached;
1349
- const value = expectAttrs(reader(node), label);
1350
- cache.set(node, value);
1351
- return value;
1352
- }
1353
1332
  function expectCachedMarkAttrs(mark, cache, reader, label) {
1354
1333
  const cached = cache.get(mark);
1355
1334
  if (cached) return cached;
@@ -1357,12 +1336,6 @@ function expectCachedMarkAttrs(mark, cache, reader, label) {
1357
1336
  cache.set(mark, value);
1358
1337
  return value;
1359
1338
  }
1360
- const expectNodeType = (node, expected, issues) => {
1361
- if (node.type.name !== expected) issues.push({
1362
- path: "node.type.name",
1363
- message: `Expected ${expected}, got ${node.type.name}.`
1364
- });
1365
- };
1366
1339
  const expectNodeTypeOneOf = (node, expected, issues) => {
1367
1340
  if (!expected.includes(node.type.name)) issues.push({
1368
1341
  path: "node.type.name",
@@ -2408,6 +2381,7 @@ const validateParagraphFormatting = (value, path, issues) => {
2408
2381
  optionalOneOf(value, "listNumFmt", `${path}.listNumFmt`, issues, COUNTER_FORMAT_VALUES);
2409
2382
  optionalString(value, "listMarker", `${path}.listMarker`, issues);
2410
2383
  optionalString(value, "listMarkerTemplate", `${path}.listMarkerTemplate`, issues);
2384
+ optionalString(value, "listFoldedMarkerSuffix", `${path}.listFoldedMarkerSuffix`, issues);
2411
2385
  optionalTextFormatting(value, "listMarkerFormatting", `${path}.listMarkerFormatting`, issues);
2412
2386
  optionalOneOf(value, "listMarkerAlignment", `${path}.listMarkerAlignment`, issues, [
2413
2387
  "left",
@@ -1,6 +1,7 @@
1
1
  import { document_d_exports } from "../types/document.js";
2
2
  import { BookmarkBoundaryAttrs } from "./schema/nodes.js";
3
- import { ReadProseMirrorAttrsResult } from "./attrs/index.js";
3
+ import { ReadProseMirrorAttrsResult } from "../internal/prosemirrorAttrBoundary.js";
4
+ import "./attrs/index.js";
4
5
  import { Node } from "prosemirror-model";
5
6
  //#region src/prosemirror/bookmarkBoundaryAttrs.d.ts
6
7
  declare const isDisplacedByCustomXml: (value: unknown) => value is document_d_exports.DisplacedByCustomXml;
@@ -0,0 +1,97 @@
1
+ import { Node } from "prosemirror-model";
2
+ import { Command, EditorState } from "prosemirror-state";
3
+ import { ParagraphPropsPatch, RunPropsPatch } from "@stll/docx-core/ops";
4
+ //#region src/prosemirror/canonicalCommands.d.ts
5
+ /** Command meaning before canonical positions are resolved by the session. */
6
+ type CanonicalCommandIntent = {
7
+ type: "formatRun";
8
+ from: number;
9
+ to: number;
10
+ patch: RunPropsPatch;
11
+ } | {
12
+ type: "formatParagraph";
13
+ at: number;
14
+ patch: ParagraphPropsPatch;
15
+ } | {
16
+ type: "toggleList";
17
+ kind: "bullet" | "decimal";
18
+ } | {
19
+ type: "changeListLevel";
20
+ direction: "increase" | "decrease";
21
+ } | {
22
+ type: "removeList";
23
+ } | {
24
+ type: "restartNumbering";
25
+ start?: number;
26
+ } | {
27
+ type: "continueNumbering";
28
+ } | {
29
+ type: "insertBreak";
30
+ from: number;
31
+ to: number;
32
+ breakType: "page" | "textWrapping";
33
+ };
34
+ type CanonicalCommandDescriptor = (state: EditorState) => readonly CanonicalCommandIntent[];
35
+ /** Registration leaves execution and side-effect-free command probes unchanged. */
36
+ declare const withCanonicalCommand: (command: Command, descriptor: CanonicalCommandDescriptor) => Command;
37
+ declare const getCanonicalCommandIntents: (command: Command, state: EditorState) => readonly CanonicalCommandIntent[] | undefined;
38
+ declare const canonicalRunFormatting: (state: EditorState, patch: RunPropsPatch) => readonly [{
39
+ readonly type: "formatRun";
40
+ readonly from: number;
41
+ readonly to: number;
42
+ readonly patch: import("@stll/docx-core/ops").FormattingPatch<{
43
+ bold?: boolean | undefined;
44
+ boldCs?: boolean | undefined;
45
+ italic?: boolean | undefined;
46
+ italicCs?: boolean | undefined;
47
+ underline?: {
48
+ style: import("@stll/docx-core/model").UnderlineStyle;
49
+ color?: import("@stll/docx-core/model").ColorValue;
50
+ } | undefined;
51
+ strike?: boolean | undefined;
52
+ doubleStrike?: boolean | undefined;
53
+ vertAlign?: "baseline" | "superscript" | "subscript" | undefined;
54
+ smallCaps?: boolean | undefined;
55
+ allCaps?: boolean | undefined;
56
+ hidden?: boolean | undefined;
57
+ noProof?: boolean | undefined;
58
+ color?: import("@stll/docx-core/model").ColorValue | undefined;
59
+ highlight?: "black" | "blue" | "cyan" | "darkBlue" | "darkCyan" | "darkGray" | "darkGreen" | "darkMagenta" | "darkRed" | "darkYellow" | "green" | "lightGray" | "magenta" | "none" | "red" | "white" | "yellow" | undefined;
60
+ shading?: import("@stll/docx-core/model").ShadingProperties | undefined;
61
+ fontSize?: number | undefined;
62
+ fontSizeCs?: number | undefined;
63
+ fontFamily?: {
64
+ ascii?: string;
65
+ hAnsi?: string;
66
+ eastAsia?: string;
67
+ cs?: string;
68
+ hint?: "default" | "eastAsia" | "cs";
69
+ asciiTheme?: "majorAscii" | "majorHAnsi" | "majorEastAsia" | "majorBidi" | "minorAscii" | "minorHAnsi" | "minorEastAsia" | "minorBidi";
70
+ hAnsiTheme?: string;
71
+ eastAsiaTheme?: string;
72
+ csTheme?: string;
73
+ } | undefined;
74
+ language?: {
75
+ val?: string;
76
+ eastAsia?: string;
77
+ bidi?: string;
78
+ } | undefined;
79
+ spacing?: number | undefined;
80
+ position?: number | undefined;
81
+ scale?: number | undefined;
82
+ kerning?: number | undefined;
83
+ effect?: import("@stll/docx-core/model").TextEffect | undefined;
84
+ emphasisMark?: import("@stll/docx-core/model").EmphasisMark | undefined;
85
+ emboss?: boolean | undefined;
86
+ imprint?: boolean | undefined;
87
+ outline?: boolean | undefined;
88
+ shadow?: boolean | undefined;
89
+ rtl?: boolean | undefined;
90
+ cs?: boolean | undefined;
91
+ styleId?: string | undefined;
92
+ preserved?: import("@stll/docx-core/model").PreservedMarkup | undefined;
93
+ }>;
94
+ }];
95
+ declare const withCanonicalParagraphFormatting: (command: Command, patch: ParagraphPropsPatch | ((paragraph: Node) => ParagraphPropsPatch)) => Command;
96
+ //#endregion
97
+ export { CanonicalCommandIntent, canonicalRunFormatting, getCanonicalCommandIntents, withCanonicalCommand, withCanonicalParagraphFormatting };
@@ -0,0 +1,28 @@
1
+ //#region src/prosemirror/canonicalCommands.ts
2
+ const descriptors = /* @__PURE__ */ new WeakMap();
3
+ /** Registration leaves execution and side-effect-free command probes unchanged. */
4
+ const withCanonicalCommand = (command, descriptor) => {
5
+ descriptors.set(command, descriptor);
6
+ return command;
7
+ };
8
+ const getCanonicalCommandIntents = (command, state) => descriptors.get(command)?.(state);
9
+ const canonicalRunFormatting = (state, patch) => [{
10
+ type: "formatRun",
11
+ from: state.selection.from,
12
+ to: state.selection.to,
13
+ patch
14
+ }];
15
+ const withCanonicalParagraphFormatting = (command, patch) => withCanonicalCommand(command, (state) => {
16
+ const intents = [];
17
+ state.doc.nodesBetween(state.selection.from, state.selection.to, (node, position) => {
18
+ if (node.type.name !== "paragraph") return;
19
+ intents.push({
20
+ type: "formatParagraph",
21
+ at: position + 1,
22
+ patch: typeof patch === "function" ? patch(node) : patch
23
+ });
24
+ });
25
+ return intents;
26
+ });
27
+ //#endregion
28
+ export { canonicalRunFormatting, getCanonicalCommandIntents, withCanonicalCommand, withCanonicalParagraphFormatting };
@@ -1,3 +1,4 @@
1
+ import { withCanonicalCommand } from "../canonicalCommands.js";
1
2
  import { pageBreakRunParagraphProjectionDisposition } from "../pageBreakRunProjection.js";
2
3
  //#region src/prosemirror/commands/pageBreak.ts
3
4
  const UNSUPPORTED_PAGE_BREAK_RUN_ANCESTORS = /* @__PURE__ */ new Set([
@@ -23,7 +24,7 @@ const hasTextBoxAnchorAtOrAfter = (paragraph, contentStart, position) => {
23
24
  * position among neighbouring run content. Block-level `pageBreak` remains a
24
25
  * legacy input boundary and is never emitted by this command.
25
26
  */
26
- const insertPageBreak = (state, dispatch) => {
27
+ const insertPageBreakCommand = (state, dispatch) => {
27
28
  const { schema } = state;
28
29
  const pageBreakRunType = schema.nodes["pageBreakRun"];
29
30
  const { $from } = state.selection;
@@ -36,5 +37,18 @@ const insertPageBreak = (state, dispatch) => {
36
37
  }
37
38
  return true;
38
39
  };
40
+ /**
41
+ * Insert a page-break run at the current text cursor.
42
+ *
43
+ * Keeping the atom inline preserves its authored run, revision marks, and exact
44
+ * position among neighbouring run content. Block-level `pageBreak` remains a
45
+ * legacy input boundary and is never emitted by this command.
46
+ */
47
+ const insertPageBreak = withCanonicalCommand(insertPageBreakCommand, (state) => insertPageBreakCommand(state) ? [{
48
+ type: "insertBreak",
49
+ from: state.selection.from,
50
+ to: state.selection.to,
51
+ breakType: "page"
52
+ }] : []);
39
53
  //#endregion
40
54
  export { insertPageBreak };
@@ -1,5 +1,6 @@
1
1
  import { CommentReferenceAttrs } from "./schema/nodes.js";
2
- import { ReadProseMirrorAttrsResult } from "./attrs/index.js";
2
+ import { ReadProseMirrorAttrsResult } from "../internal/prosemirrorAttrBoundary.js";
3
+ import "./attrs/index.js";
3
4
  import { Node } from "prosemirror-model";
4
5
  //#region src/prosemirror/commentReferenceAttrs.d.ts
5
6
  declare const readCommentReferenceAttrs: (node: Node) => ReadProseMirrorAttrsResult<CommentReferenceAttrs>;
@@ -1,13 +1,15 @@
1
1
  import { joinCommentRangesAcrossParagraphs } from "../../docx/commentRangeJoin.js";
2
2
  import { completeCommentReferences } from "../../docx/commentReferenceCompletion.js";
3
+ import { normalizeFoldedListNumbers } from "../../docx/foldedListNumberFields.js";
3
4
  import { EDITED_PREVIEW_FINGERPRINT, imageRawXmlFingerprint } from "../../docx/imageRawXml.js";
4
5
  import { isInlineSdtContent, isSimpleFieldContent } from "../../docx/inlineWrapperContent.js";
5
6
  import { paragraphNumberingReferenceId as paragraphNumberingReferenceId$1, sameStatedParagraphNumbering as sameStatedParagraphNumbering$1 } from "../../docx/numberingReference.js";
6
- import { PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR, ParagraphPropertySourceValidationError, copyDocumentParagraphPropertySourceContract, copyDocumentParagraphPropertySources, copyParagraphPropertyCapture, copyParagraphPropertySource, decodeTableCellParagraphSourcePayload, getDocumentParagraphPropertySourceContract, getParagraphPropertySource, getParagraphPropertySourceCandidate, getParagraphPropertySourceToken, getParagraphPropertySourceTransferId, getProseDocumentParagraphPropertySourceContract, getProseParagraphPropertySourceToken, isParagraphPropertySourceToken, linkParagraphPropertySourceCandidate, paragraphPropertySourceBelongsToDocument, paragraphPropertySourceTokenMatchesContract, recreateProseNodeWithParagraphPropertySource, restoreTableCellsWithParagraphPropertySources, visitDocumentStoryParagraphs, visitTableCellParagraphPropertySourceBindings } from "../../docx/paragraphPropertySource.js";
7
+ import { PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR, ParagraphPropertySourceValidationError, copyDocumentParagraphPropertySourceContract, copyDocumentParagraphPropertySources, copyParagraphPropertyCapture, copyParagraphPropertySource, decodeTableCellParagraphSourcePayload, getDocumentParagraphPropertySourceContract, getParagraphPropertySource, getParagraphPropertySourceCandidate, getParagraphPropertySourceToken, getParagraphPropertySourceTransferId, getProseDocumentParagraphPropertySourceContract, getProseParagraphPropertySourceToken, inspectParagraphSourceIdentity, isParagraphPropertySourceToken, linkParagraphPropertySourceCandidate, paragraphPropertySourceTokenMatchesContract, recreateProseNodeWithParagraphPropertySource, restoreTableCellsWithParagraphPropertySources, visitDocumentStoryParagraphs, visitTableCellParagraphPropertySourceBindings } from "../../docx/paragraphPropertySource.js";
7
8
  import { BLOCK_TREE_DESCENT, visitBlockTreeRecords, visitDocxParagraphs } from "../../docx/paragraphTraversal.js";
8
9
  import { refingerprintShapeAlternateContent } from "../../docx/shapeAlternateContent.js";
9
10
  import { DATE_UTC_ATTRIBUTE } from "../../docx/trackedChangeInfo.js";
10
11
  import { copiedWrapPolygon } from "../../docx/wrapPolygon.js";
12
+ import { expectNoteMarkerAttrs } from "../../internal/noteMarkerAttrs.js";
11
13
  import { isStyleSourcedParagraphNumbering, modelParagraphFormattingEmission } from "../../internal/paragraphFormattingSerialization.js";
12
14
  import { createStyleEngine } from "../../style-engine/styleEngine.js";
13
15
  import { normalizeShapeTextAnchor, presetDashForOutlineAttr } from "../../types/documentEnumValues.js";
@@ -185,11 +187,16 @@ const validateParagraphPropertySourceTokens = (pmDoc, baseDocument, contract) =>
185
187
  if (!sourceParagraphs) panic("A paragraph-property source contract lost its source registry");
186
188
  const currentTokens = /* @__PURE__ */ new Set();
187
189
  visitDocumentStoryParagraphs(baseDocument.package.document.content, (paragraph) => {
188
- const token = getParagraphPropertySourceToken(paragraph);
189
- if (!token) {
190
- if (paragraphPropertySourceBelongsToDocument(paragraph, baseDocument)) throw sourceValidationError("invalid_token", "A source-bound paragraph is missing its paragraph-property token.");
191
- return;
190
+ const identity = inspectParagraphSourceIdentity(paragraph, baseDocument);
191
+ switch (identity.type) {
192
+ case "authored":
193
+ case "capture-only": return;
194
+ case "missing-token": throw sourceValidationError("invalid_token", "A source-bound paragraph is missing its paragraph-property token.");
195
+ case "invalid": throw sourceValidationError("invalid_token", "The source paragraph identity is invalid.");
196
+ case "durable": break;
197
+ default: panic(`Unhandled paragraph source identity: ${String(identity)}`);
192
198
  }
199
+ const { token } = identity;
193
200
  if (!paragraphPropertySourceTokenMatchesContract(token, contract)) throw sourceValidationError("invalid_token", "The source document contains an invalid paragraph-property token.");
194
201
  if (!sourceParagraphs.has(token)) throw sourceValidationError("unknown_token", "The source document contains an unknown paragraph-property token.");
195
202
  if (currentTokens.has(token)) throw sourceValidationError("duplicate_token", "The source document contains a duplicate paragraph-property token.");
@@ -965,6 +972,7 @@ function convertPMParagraph(node, documentCounts, textBoxAnchorMarkers, styleRes
965
972
  if (pFormatting) paragraph.formatting = pFormatting;
966
973
  const listRendering = listRenderingFromAttrs(attrs);
967
974
  if (listRendering) paragraph.listRendering = listRendering;
975
+ normalizeFoldedListNumbers(paragraph);
968
976
  if (attrs.renderedPageBreakBefore) paragraph.renderedPageBreakBefore = true;
969
977
  if (attrs._sectionProperties) paragraph.sectionProperties = attrs._sectionProperties;
970
978
  if (attrs._propertyChanges && attrs._propertyChanges.length > 0) paragraph.propertyChanges = attrs._propertyChanges.map(propertyChangeFromAttrs);
@@ -1172,27 +1180,32 @@ function paragraphAttrsToFormatting(attrs) {
1172
1180
  if (suppressAutoHyphens != null) f.suppressAutoHyphens = suppressAutoHyphens;
1173
1181
  return f;
1174
1182
  }
1175
- function createTrackedRunWrapper(type, info, child) {
1183
+ function createTrackedRunWrapper({ type, info, child, resolutionJoins }) {
1176
1184
  const content = child ? [child] : [];
1185
+ const provenance = resolutionJoins === void 0 ? {} : { resolutionJoins: structuredClone(resolutionJoins) };
1177
1186
  if (type === "insertion") return {
1178
1187
  type,
1179
1188
  info,
1180
- content
1189
+ content,
1190
+ ...provenance
1181
1191
  };
1182
1192
  if (type === "deletion") return {
1183
1193
  type,
1184
1194
  info,
1185
- content
1195
+ content,
1196
+ ...provenance
1186
1197
  };
1187
1198
  if (type === "moveFrom") return {
1188
1199
  type,
1189
1200
  info,
1190
- content
1201
+ content,
1202
+ ...provenance
1191
1203
  };
1192
1204
  return {
1193
1205
  type,
1194
1206
  info,
1195
- content
1207
+ content,
1208
+ ...provenance
1196
1209
  };
1197
1210
  }
1198
1211
  /**
@@ -1272,7 +1285,7 @@ const nestRevisionAwareInlineWrappers = (items, stack, revisionOuterWrapperCount
1272
1285
  closeLayer();
1273
1286
  return nested;
1274
1287
  };
1275
- const sameRevisionLayer = (left, right) => left.type === right.type && left.revisionId === right.revisionId && left.author === right.author && left.date === right.date && left.utcDate === right.utcDate && left.initials === right.initials && left.outerWrapperCount === right.outerWrapperCount;
1288
+ const sameRevisionLayer = (left, right) => left.type === right.type && left.revisionId === right.revisionId && left.author === right.author && left.date === right.date && left.utcDate === right.utcDate && left.initials === right.initials && left.outerWrapperCount === right.outerWrapperCount && JSON.stringify(left.resolutionJoins) === JSON.stringify(right.resolutionJoins);
1276
1289
  const revisionInfoFromLayer = (layer) => ({
1277
1290
  id: layer.revisionId,
1278
1291
  author: layer.author,
@@ -1299,14 +1312,19 @@ const nestRevisionAncestors = (items, ancestorsByWrapper, revisionOuterWrapperCo
1299
1312
  ...item.info.date ? { date: item.info.date } : {},
1300
1313
  ...item.info.utcDate ? { utcDate: item.info.utcDate.value } : {},
1301
1314
  ...item.info.initials ? { initials: item.info.initials } : {},
1302
- outerWrapperCount: revisionOuterWrapperCounts.get(item) ?? 0
1315
+ outerWrapperCount: revisionOuterWrapperCounts.get(item) ?? 0,
1316
+ ...item.resolutionJoins === void 0 ? {} : { resolutionJoins: item.resolutionJoins }
1303
1317
  };
1304
1318
  const path = [...ancestorsByWrapper.get(item) ?? [], ownLayer];
1305
1319
  let shared = 0;
1306
1320
  while (shared < open.length && path[shared] && sameRevisionLayer(open[shared].layer, path[shared])) shared += 1;
1307
1321
  open.length = shared;
1308
1322
  for (const layer of path.slice(shared)) {
1309
- const wrapper = createTrackedRunWrapper(layer.type, revisionInfoFromLayer(layer));
1323
+ const wrapper = createTrackedRunWrapper({
1324
+ type: layer.type,
1325
+ info: revisionInfoFromLayer(layer),
1326
+ resolutionJoins: layer.resolutionJoins
1327
+ });
1310
1328
  revisionOuterWrapperCounts.set(wrapper, layer.outerWrapperCount);
1311
1329
  const parent = open.at(-1)?.wrapper;
1312
1330
  if (parent) parent.content.push(wrapper);
@@ -1553,7 +1571,12 @@ function extractParagraphContent(paragraph, _documentCounts, emptyHyperlinks, te
1553
1571
  let type;
1554
1572
  if (insertionMark) type = changeAttrs.moveKind === "moveTo" ? "moveTo" : "insertion";
1555
1573
  else type = changeAttrs.moveKind === "moveFrom" ? "moveFrom" : "deletion";
1556
- const wrapper = createTrackedRunWrapper(type, info, anchoredContent);
1574
+ const wrapper = createTrackedRunWrapper({
1575
+ type,
1576
+ info,
1577
+ child: anchoredContent,
1578
+ resolutionJoins: changeAttrs._docxResolutionJoins ?? void 0
1579
+ });
1557
1580
  revisionOuterWrapperCounts.set(wrapper, changeAttrs._docxOuterWrapperCount ?? inlineWrapperStackOf(node).length);
1558
1581
  revisionAncestorsByWrapper.set(wrapper, changeAttrs._docxRevisionAncestors ?? []);
1559
1582
  content.push(wrapper);
@@ -1584,12 +1607,17 @@ function extractParagraphContent(paragraph, _documentCounts, emptyHyperlinks, te
1584
1607
  if (changeMark === insertionMark) type = changeAttrs.moveKind === "moveTo" ? "moveTo" : "insertion";
1585
1608
  else type = changeAttrs.moveKind === "moveFrom" ? "moveFrom" : "deletion";
1586
1609
  const outerWrapperCount = changeAttrs._docxOuterWrapperCount ?? inlineWrapperStackOf(node).length;
1587
- const trackedChangeKey = `${type}:${JSON.stringify(info)}:${outerWrapperCount}:${JSON.stringify(revisionAncestors)}`;
1610
+ const trackedChangeKey = `${type}:${JSON.stringify(info)}:${outerWrapperCount}:${JSON.stringify(revisionAncestors)}:${JSON.stringify(changeAttrs._docxResolutionJoins ?? void 0)}`;
1588
1611
  if (linkMark) {
1589
1612
  const linkKey = getLinkKey(linkMark);
1590
1613
  if (!currentTrackedChange || currentTrackedChange.type !== "hyperlink" || currentTrackedChange.key !== trackedChangeKey || currentTrackedChange.hyperlinkKey !== linkKey) {
1591
1614
  const hyperlink = createIndexedHyperlink(linkMark);
1592
- const wrapper = createTrackedRunWrapper(type, info, hyperlink);
1615
+ const wrapper = createTrackedRunWrapper({
1616
+ type,
1617
+ info,
1618
+ child: hyperlink,
1619
+ resolutionJoins: changeAttrs._docxResolutionJoins ?? void 0
1620
+ });
1593
1621
  revisionOuterWrapperCounts.set(wrapper, outerWrapperCount);
1594
1622
  revisionAncestorsByWrapper.set(wrapper, revisionAncestors);
1595
1623
  content.push(wrapper);
@@ -1624,7 +1652,11 @@ function extractParagraphContent(paragraph, _documentCounts, emptyHyperlinks, te
1624
1652
  return;
1625
1653
  }
1626
1654
  if (!currentTrackedChange || currentTrackedChange.type !== "direct" || currentTrackedChange.key !== trackedChangeKey) {
1627
- const wrapper = createTrackedRunWrapper(type, info);
1655
+ const wrapper = createTrackedRunWrapper({
1656
+ type,
1657
+ info,
1658
+ resolutionJoins: changeAttrs._docxResolutionJoins ?? void 0
1659
+ });
1628
1660
  revisionOuterWrapperCounts.set(wrapper, outerWrapperCount);
1629
1661
  revisionAncestorsByWrapper.set(wrapper, revisionAncestors);
1630
1662
  content.push(wrapper);
@@ -1717,6 +1749,13 @@ function extractParagraphContent(paragraph, _documentCounts, emptyHyperlinks, te
1717
1749
  clear,
1718
1750
  marks: node.marks
1719
1751
  }));
1752
+ } else if (node.type.name === "noteMarker") {
1753
+ flushCurrentInline();
1754
+ appendDirectRun(node, createNoteMarkerRun({
1755
+ node,
1756
+ marks: node.marks,
1757
+ formattingContext
1758
+ }));
1720
1759
  } else if (node.type.name === "symbol") {
1721
1760
  flushCurrentInline();
1722
1761
  content.push(createSymbolRun(node, node.marks, formattingContext));
@@ -1806,6 +1845,11 @@ function createTrackedChangeRun({ baseParagraphFormatting, inheritedFormatting,
1806
1845
  };
1807
1846
  restoreRunRecord(run, marks);
1808
1847
  } else if (node.type.name === "symbol") run = createSymbolRun(node, marks, formattingContext);
1848
+ else if (node.type.name === "noteMarker") run = createNoteMarkerRun({
1849
+ node,
1850
+ marks,
1851
+ formattingContext
1852
+ });
1809
1853
  else if (node.type.name === "preservedXml") run = createPreservedXmlRun(node, marks, formattingContext);
1810
1854
  else if (node.type.name === "hardBreak") run = createBreakRun(expectHardBreakAttrs(node), marks, formattingContext);
1811
1855
  else if (node.type.name === "pageBreakRun") {
@@ -1968,6 +2012,14 @@ function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedForma
1968
2012
  hyperlink.children.push(run);
1969
2013
  return;
1970
2014
  }
2015
+ if (node.type.name === "noteMarker") {
2016
+ hyperlink.children.push(createNoteMarkerRun({
2017
+ node,
2018
+ marks: nonLinkMarks,
2019
+ formattingContext
2020
+ }));
2021
+ return;
2022
+ }
1971
2023
  if (node.type.name === "symbol") {
1972
2024
  hyperlink.children.push(createSymbolRun(node, nonLinkMarks, {
1973
2025
  baseParagraphFormatting,
@@ -2098,13 +2150,33 @@ function createSymbolRun(node, marks, formattingContext) {
2098
2150
  const isInlineLevelPreservedXml = (node) => node.type.name === "preservedXml" && expectPreservedXmlAttrs(node).level === PRESERVED_XML_LEVELS.inline;
2099
2151
  /** The paragraph-level capture an inline-level atom writes back. */
2100
2152
  const createPreservedInline = (node) => {
2101
- const { xml, text } = expectPreservedXmlAttrs(node);
2102
- return {
2153
+ const { xml, text, foldedListNumber } = expectPreservedXmlAttrs(node);
2154
+ return foldedListNumber ? {
2155
+ type: "preservedInline",
2156
+ xml,
2157
+ text,
2158
+ foldedListNumber
2159
+ } : {
2103
2160
  type: "preservedInline",
2104
2161
  xml,
2105
2162
  text
2106
2163
  };
2107
2164
  };
2165
+ /** Rebuild the authored automatic mark and its run properties from the atom. */
2166
+ const createNoteMarkerRun = ({ node, marks, formattingContext }) => {
2167
+ const { kind } = expectNoteMarkerAttrs(node);
2168
+ const run = {
2169
+ type: "run",
2170
+ content: [{
2171
+ type: "noteMarker",
2172
+ kind
2173
+ }]
2174
+ };
2175
+ const formatting = getAtomRunFormattingFromMarks(marks, formattingContext);
2176
+ if (formatting) run.formatting = formatting;
2177
+ restoreRunRecord(run, marks);
2178
+ return run;
2179
+ };
2108
2180
  /**
2109
2181
  * Rebuild the run around a preserved child. The markup is opaque and comes
2110
2182
  * back byte for byte; only the run properties around it are rebuilt from the
@@ -0,0 +1,6 @@
1
+ import { document_d_exports } from "../../types/document.js";
2
+ //#region src/prosemirror/conversion/listRenderingDefinition.d.ts
3
+ /** Compare scalar fields directly; only nested records need canonical ordering. */
4
+ declare const listRenderingDefinitionsMatch: (left: document_d_exports.ListRendering, right: document_d_exports.ListRendering) => boolean;
5
+ //#endregion
6
+ export { listRenderingDefinitionsMatch };