@stll/folio-core 0.54.1 → 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 (251) hide show
  1. package/dist/ai-edits/apply.d.ts +1 -1
  2. package/dist/ai-edits/apply.js +40 -32
  3. package/dist/ai-edits/headless.d.ts +1 -2
  4. package/dist/ai-edits/headless.js +13 -27
  5. package/dist/ai-edits/read.d.ts +1 -0
  6. package/dist/ai-edits/read.js +7 -2
  7. package/dist/ai-edits/table-mutation-plan.d.ts +2 -1
  8. package/dist/ai-edits/table-mutation-plan.js +39 -1
  9. package/dist/ai-suggestions/apply.d.ts +1 -1
  10. package/dist/ai-suggestions/apply.js +3 -2
  11. package/dist/compare/compare.js +2 -1
  12. package/dist/compare/content-types.d.ts +3 -15
  13. package/dist/controller/canonicalComposition.d.ts +36 -0
  14. package/dist/controller/canonicalComposition.js +168 -0
  15. package/dist/controller/canonicalInput.d.ts +45 -0
  16. package/dist/controller/canonicalInput.js +338 -0
  17. package/dist/controller/canonicalOperations.d.ts +22 -0
  18. package/dist/controller/canonicalOperations.js +85 -0
  19. package/dist/controller/canonicalReview.d.ts +12 -0
  20. package/dist/controller/canonicalReview.js +19 -0
  21. package/dist/controller/canonicalSession.d.ts +149 -0
  22. package/dist/controller/canonicalSession.js +1038 -0
  23. package/dist/controller/canonicalStoryEditor.d.ts +34 -0
  24. package/dist/controller/canonicalStoryEditor.js +82 -0
  25. package/dist/controller/canonicalStructure.d.ts +16 -0
  26. package/dist/controller/canonicalStructure.js +269 -0
  27. package/dist/controller/folioEditor.d.ts +1 -1
  28. package/dist/controller/folioEditor.js +9 -0
  29. package/dist/controller/headerFooterEditorManager.d.ts +4 -0
  30. package/dist/controller/headerFooterEditorManager.js +71 -3
  31. package/dist/controller/hiddenEditorApi.d.ts +35 -0
  32. package/dist/controller/hiddenEditorApi.js +25 -8
  33. package/dist/controller/hiddenEditorManager.d.ts +11 -2
  34. package/dist/controller/hiddenEditorManager.js +456 -30
  35. package/dist/controller/layoutPipeline.d.ts +1 -1
  36. package/dist/controller/layoutPipeline.js +2 -0
  37. package/dist/controller/noteEditorManager.d.ts +4 -0
  38. package/dist/controller/noteEditorManager.js +113 -15
  39. package/dist/docx/attributeRemainder.js +1 -0
  40. package/dist/docx/bookmarkIds.d.ts +11 -0
  41. package/dist/docx/bookmarkIds.js +33 -0
  42. package/dist/docx/canonicalSessionInput.d.ts +11 -0
  43. package/dist/docx/canonicalSessionInput.js +27 -0
  44. package/dist/docx/canonicalStoryRepack.d.ts +10 -0
  45. package/dist/docx/canonicalStoryRepack.js +41 -0
  46. package/dist/docx/contentTypeRegistry.d.ts +8 -0
  47. package/dist/docx/contentTypeRegistry.js +64 -0
  48. package/dist/docx/documentParser.d.ts +14 -1
  49. package/dist/docx/documentParser.js +17 -4
  50. package/dist/docx/drawingIdNormalization.js +23 -8
  51. package/dist/docx/ensureParaIds.d.ts +12 -1
  52. package/dist/docx/ensureParaIds.js +173 -213
  53. package/dist/docx/foldedListNumberFields.d.ts +85 -0
  54. package/dist/docx/foldedListNumberFields.js +267 -0
  55. package/dist/docx/headerFooterVerbatim.d.ts +14 -1
  56. package/dist/docx/headerFooterVerbatim.js +95 -2
  57. package/dist/docx/listNumberingInstances.js +11 -9
  58. package/dist/docx/noteIds.d.ts +9 -0
  59. package/dist/docx/noteIds.js +17 -0
  60. package/dist/docx/noteReferenceMark.d.ts +3 -1
  61. package/dist/docx/noteReferenceMark.js +15 -14
  62. package/dist/docx/numberingIds.d.ts +14 -0
  63. package/dist/docx/numberingIds.js +16 -0
  64. package/dist/docx/numberingParser.d.ts +3 -1
  65. package/dist/docx/numberingParser.js +17 -3
  66. package/dist/docx/numericIdAllocator.d.ts +12 -0
  67. package/dist/docx/numericIdAllocator.js +33 -0
  68. package/dist/docx/numericIdNormalization.d.ts +16 -0
  69. package/dist/docx/numericIdNormalization.js +174 -0
  70. package/dist/docx/packageParts.d.ts +3 -1
  71. package/dist/docx/packageParts.js +65 -16
  72. package/dist/docx/paragraphMarkPropertyPresence.d.ts +9 -0
  73. package/dist/docx/paragraphMarkPropertyPresence.js +21 -0
  74. package/dist/docx/paragraphParser.js +101 -53
  75. package/dist/docx/paragraphPropertySource.d.ts +15 -1
  76. package/dist/docx/paragraphPropertySource.js +76 -22
  77. package/dist/docx/paragraphTextBoxEnrichment.js +2 -1
  78. package/dist/docx/parser.js +19 -6
  79. package/dist/docx/rasterMime.d.ts +64 -0
  80. package/dist/docx/rasterMime.js +116 -0
  81. package/dist/docx/replyToComment.js +13 -6
  82. package/dist/docx/reviewHistoryNamespace.d.ts +4 -0
  83. package/dist/docx/reviewHistoryNamespace.js +4 -0
  84. package/dist/docx/reviewResolutionProvenance.d.ts +25 -0
  85. package/dist/docx/reviewResolutionProvenance.js +153 -0
  86. package/dist/docx/rezip.d.ts +7 -3
  87. package/dist/docx/rezip.js +121 -52
  88. package/dist/docx/runConsolidator.d.ts +2 -58
  89. package/dist/docx/runConsolidator.js +3 -175
  90. package/dist/docx/runParser.d.ts +2 -1
  91. package/dist/docx/runParser.js +156 -116
  92. package/dist/docx/saveDiagnostics.d.ts +11 -0
  93. package/dist/docx/saveDiagnostics.js +0 -0
  94. package/dist/docx/selectiveSave.d.ts +2 -1
  95. package/dist/docx/selectiveSave.js +14 -1
  96. package/dist/docx/selectiveXmlPatch.d.ts +16 -8
  97. package/dist/docx/selectiveXmlPatch.js +74 -2
  98. package/dist/docx/serializer/headerFooterSerializer.d.ts +5 -1
  99. package/dist/docx/serializer/headerFooterSerializer.js +19 -11
  100. package/dist/docx/serializer/noteSerializer.d.ts +2 -2
  101. package/dist/docx/serializer/noteSerializer.js +24 -8
  102. package/dist/docx/serializer/paragraphSerializer.js +41 -4
  103. package/dist/docx/serializer/partNamespaces.js +6 -3
  104. package/dist/docx/serializer/runSerializer.js +8 -5
  105. package/dist/docx/serializer/trackedChangeAttributes.js +7 -1
  106. package/dist/docx/server/build.js +14 -3
  107. package/dist/docx/server/createBilingualDocument.js +10 -9
  108. package/dist/docx/settingsHeaderFooterUpdate.d.ts +5 -0
  109. package/dist/docx/settingsHeaderFooterUpdate.js +90 -0
  110. package/dist/docx/settingsParser.d.ts +1 -2
  111. package/dist/docx/settingsParser.js +5 -6
  112. package/dist/docx/storyBlockReplay.d.ts +11 -0
  113. package/dist/docx/storyBlockReplay.js +367 -0
  114. package/dist/docx/streamingXmlParser.d.ts +31 -1
  115. package/dist/docx/streamingXmlParser.js +136 -21
  116. package/dist/docx/structuralXmlPatch.js +8 -1
  117. package/dist/docx/unzip.d.ts +3 -1
  118. package/dist/docx/unzip.js +36 -16
  119. package/dist/docx/verbatimCapture.d.ts +3 -1
  120. package/dist/docx/verbatimCapture.js +49 -6
  121. package/dist/i18n/messages/ar.gen.d.ts +5 -0
  122. package/dist/i18n/messages/ar.gen.js +656 -0
  123. package/dist/i18n/messages/cs.gen.d.ts +5 -0
  124. package/dist/i18n/messages/cs.gen.js +656 -0
  125. package/dist/i18n/messages/de.gen.d.ts +5 -0
  126. package/dist/i18n/messages/de.gen.js +656 -0
  127. package/dist/i18n/messages/en.gen.d.ts +5 -0
  128. package/dist/i18n/messages/en.gen.js +656 -0
  129. package/dist/i18n/messages/es.gen.d.ts +5 -0
  130. package/dist/i18n/messages/es.gen.js +656 -0
  131. package/dist/i18n/messages/et.gen.d.ts +5 -0
  132. package/dist/i18n/messages/et.gen.js +656 -0
  133. package/dist/i18n/messages/fr.gen.d.ts +5 -0
  134. package/dist/i18n/messages/fr.gen.js +656 -0
  135. package/dist/i18n/messages/he.gen.d.ts +5 -0
  136. package/dist/i18n/messages/he.gen.js +656 -0
  137. package/dist/i18n/messages/hi.gen.d.ts +5 -0
  138. package/dist/i18n/messages/hi.gen.js +656 -0
  139. package/dist/i18n/messages/hu.gen.d.ts +5 -0
  140. package/dist/i18n/messages/hu.gen.js +656 -0
  141. package/dist/i18n/messages/locales.d.ts +5 -0
  142. package/dist/i18n/messages/locales.js +22 -0
  143. package/dist/i18n/messages/lt.gen.d.ts +5 -0
  144. package/dist/i18n/messages/lt.gen.js +656 -0
  145. package/dist/i18n/messages/lv.gen.d.ts +5 -0
  146. package/dist/i18n/messages/lv.gen.js +656 -0
  147. package/dist/i18n/messages/pl.gen.d.ts +5 -0
  148. package/dist/i18n/messages/pl.gen.js +656 -0
  149. package/dist/i18n/messages/pt-BR.gen.d.ts +5 -0
  150. package/dist/i18n/messages/pt-BR.gen.js +656 -0
  151. package/dist/i18n/messages/sk.gen.d.ts +5 -0
  152. package/dist/i18n/messages/sk.gen.js +656 -0
  153. package/dist/i18n/messages/tr.gen.d.ts +5 -0
  154. package/dist/i18n/messages/tr.gen.js +656 -0
  155. package/dist/i18n/messages/zh-CN.gen.d.ts +5 -0
  156. package/dist/i18n/messages/zh-CN.gen.js +656 -0
  157. package/dist/i18n/messages.d.ts +2 -3
  158. package/dist/i18n/messages.js +1 -19
  159. package/dist/internal/noteMarkerAttrs.d.ts +8 -0
  160. package/dist/internal/noteMarkerAttrs.js +16 -0
  161. package/dist/internal/pageBreakRunSourceDescendantIndex.js +1 -0
  162. package/dist/internal/prosemirrorAttrBoundary.d.ts +21 -0
  163. package/dist/internal/prosemirrorAttrBoundary.js +50 -0
  164. package/dist/layout-bridge/convert/fixedTableColumnWidths.d.ts +6 -0
  165. package/dist/layout-bridge/convert/fixedTableColumnWidths.js +23 -0
  166. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  167. package/dist/layout-bridge/convert/footnoteLayout.js +3 -3
  168. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  169. package/dist/layout-bridge/convert/headerFooterLayout.js +1 -0
  170. package/dist/layout-bridge/convert/noteReferences.d.ts +1 -3
  171. package/dist/layout-bridge/convert/noteReferences.js +1 -6
  172. package/dist/layout-bridge/convert/paragraphRuns.js +2 -4
  173. package/dist/layout-bridge/convert/tableConversion.js +4 -1
  174. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +2 -2
  175. package/dist/layout-bridge/convert/toFlowBlocks.js +2 -2
  176. package/dist/layout-painter/index.js +2 -5
  177. package/dist/managers/DocumentLoaderManager.d.ts +1 -0
  178. package/dist/managers/DocumentLoaderManager.js +8 -1
  179. package/dist/markdown/renderBlock.js +15 -1
  180. package/dist/markdown/renderParagraph.js +9 -13
  181. package/dist/markdown/renderRuns.js +3 -2
  182. package/dist/markdown/renderTable.js +2 -0
  183. package/dist/markdown/types.d.ts +3 -9
  184. package/dist/paged-layout/editorScrollRoot.d.ts +15 -0
  185. package/dist/paged-layout/editorScrollRoot.js +72 -0
  186. package/dist/paged-layout/scrollToPmPosition.js +8 -22
  187. package/dist/prosemirror/attrs/index.d.ts +2 -12
  188. package/dist/prosemirror/attrs/index.js +22 -48
  189. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +2 -1
  190. package/dist/prosemirror/canonicalCommands.d.ts +97 -0
  191. package/dist/prosemirror/canonicalCommands.js +28 -0
  192. package/dist/prosemirror/commands/clearParagraphIndent.d.ts +6 -0
  193. package/dist/prosemirror/commands/clearParagraphIndent.js +25 -0
  194. package/dist/prosemirror/commands/pageBreak.js +15 -1
  195. package/dist/prosemirror/commentIdAllocator.d.ts +15 -22
  196. package/dist/prosemirror/commentIdAllocator.js +50 -25
  197. package/dist/prosemirror/commentReferenceAttrs.d.ts +2 -1
  198. package/dist/prosemirror/conversion/fromProseDoc.js +91 -19
  199. package/dist/prosemirror/conversion/listRenderingDefinition.d.ts +6 -0
  200. package/dist/prosemirror/conversion/listRenderingDefinition.js +97 -0
  201. package/dist/prosemirror/conversion/toProseDoc.d.ts +4 -3
  202. package/dist/prosemirror/conversion/toProseDoc.js +51 -11
  203. package/dist/prosemirror/executeEditorCommand.d.ts +11 -0
  204. package/dist/prosemirror/executeEditorCommand.js +26 -0
  205. package/dist/prosemirror/extensions/StarterKit.js +2 -0
  206. package/dist/prosemirror/extensions/core/HistoryExtension.js +97 -5
  207. package/dist/prosemirror/extensions/core/ParagraphExtension.js +53 -20
  208. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +22 -28
  209. package/dist/prosemirror/extensions/features/ListExtension.js +18 -5
  210. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +5 -2
  211. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +13 -1
  212. package/dist/prosemirror/extensions/marks/TextColorExtension.js +3 -2
  213. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -0
  214. package/dist/prosemirror/extensions/marks/markUtils.js +70 -8
  215. package/dist/prosemirror/extensions/nodes/NoteMarkerExtension.d.ts +6 -0
  216. package/dist/prosemirror/extensions/nodes/NoteMarkerExtension.js +36 -0
  217. package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +4 -2
  218. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +8 -6
  219. package/dist/prosemirror/listMarker.d.ts +1 -0
  220. package/dist/prosemirror/listMarker.js +16 -7
  221. package/dist/prosemirror/listNumbering.js +26 -5
  222. package/dist/prosemirror/listRenderingAttrs.d.ts +1 -0
  223. package/dist/prosemirror/listRenderingAttrs.js +3 -0
  224. package/dist/prosemirror/markupViewNotes.js +3 -2
  225. package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +2 -1
  226. package/dist/prosemirror/noteReferenceReview.js +5 -3
  227. package/dist/prosemirror/plugins/revisionIds.d.ts +23 -19
  228. package/dist/prosemirror/plugins/revisionIds.js +110 -29
  229. package/dist/prosemirror/plugins/suggestionMode.d.ts +2 -2
  230. package/dist/prosemirror/plugins/suggestionMode.js +246 -42
  231. package/dist/prosemirror/rangeAnchorAttrs.d.ts +2 -1
  232. package/dist/prosemirror/runFormattingFromMarks.d.ts +4 -1
  233. package/dist/prosemirror/runFormattingFromMarks.js +15 -1
  234. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -1
  235. package/dist/prosemirror/runFormattingInlineCarriers.js +4 -1
  236. package/dist/prosemirror/schema/marks.d.ts +2 -0
  237. package/dist/prosemirror/schema/nodes.d.ts +10 -2
  238. package/dist/prosemirror/storyListNumbering.js +11 -9
  239. package/dist/prosemirror/textBoxAnchorAttrs.d.ts +2 -1
  240. package/dist/prosemirror/textInput.d.ts +6 -1
  241. package/dist/prosemirror/textInput.js +14 -3
  242. package/dist/prosemirror/trackedRevisionPath.js +2 -1
  243. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +1 -0
  244. package/dist/prosemirror/trackedRunInlineAtoms.js +1 -0
  245. package/dist/prosemirror/utils/visualLineNavigation.js +6 -8
  246. package/dist/prosemirror/validation.js +4 -0
  247. package/dist/types/content.d.ts +2 -2
  248. package/dist/utils/createDocument.js +2 -2
  249. package/dist/utils/mergeDocumentContent.d.ts +2 -2
  250. package/dist/utils/mergeDocumentContent.js +11 -8
  251. package/package.json +14 -2
@@ -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 };
@@ -0,0 +1,97 @@
1
+ import { canonicalJson } from "../../utils/canonicalJson.js";
2
+ //#region src/prosemirror/conversion/listRenderingDefinition.ts
3
+ const DEFINITION_FIELDS = Object.values({
4
+ marker: {
5
+ key: "marker",
6
+ source: "paragraph"
7
+ },
8
+ foldedMarkerSuffix: {
9
+ key: "foldedMarkerSuffix",
10
+ source: "paragraph"
11
+ },
12
+ implicitChildLevelAdvances: {
13
+ key: "implicitChildLevelAdvances",
14
+ source: "paragraph"
15
+ },
16
+ markerSecondSlotOffsetTwips: {
17
+ key: "markerSecondSlotOffsetTwips",
18
+ source: "paragraph"
19
+ },
20
+ markerTemplate: {
21
+ key: "markerTemplate",
22
+ source: "definition"
23
+ },
24
+ level: {
25
+ key: "level",
26
+ source: "definition"
27
+ },
28
+ numId: {
29
+ key: "numId",
30
+ source: "definition"
31
+ },
32
+ isBullet: {
33
+ key: "isBullet",
34
+ source: "definition"
35
+ },
36
+ isLegal: {
37
+ key: "isLegal",
38
+ source: "definition"
39
+ },
40
+ numFmt: {
41
+ key: "numFmt",
42
+ source: "definition"
43
+ },
44
+ markerHidden: {
45
+ key: "markerHidden",
46
+ source: "definition"
47
+ },
48
+ markerFormatting: {
49
+ key: "markerFormatting",
50
+ source: "definition"
51
+ },
52
+ markerAlignment: {
53
+ key: "markerAlignment",
54
+ source: "definition"
55
+ },
56
+ markerAllCaps: {
57
+ key: "markerAllCaps",
58
+ source: "definition"
59
+ },
60
+ markerSuffix: {
61
+ key: "markerSuffix",
62
+ source: "definition"
63
+ },
64
+ levelTabs: {
65
+ key: "levelTabs",
66
+ source: "definition"
67
+ },
68
+ levelNumFmts: {
69
+ key: "levelNumFmts",
70
+ source: "definition"
71
+ },
72
+ levelStarts: {
73
+ key: "levelStarts",
74
+ source: "definition"
75
+ },
76
+ abstractNumId: {
77
+ key: "abstractNumId",
78
+ source: "definition"
79
+ },
80
+ startOverride: {
81
+ key: "startOverride",
82
+ source: "definition"
83
+ }
84
+ }).filter((field) => field.source === "definition");
85
+ /** Compare scalar fields directly; only nested records need canonical ordering. */
86
+ const listRenderingDefinitionsMatch = (left, right) => {
87
+ for (const { key } of DEFINITION_FIELDS) {
88
+ const before = left[key];
89
+ const after = right[key];
90
+ if (before === after) continue;
91
+ if (typeof before !== "object" || typeof after !== "object") return false;
92
+ if (canonicalJson(before) !== canonicalJson(after)) return false;
93
+ }
94
+ return true;
95
+ };
96
+ //#endregion
97
+ export { listRenderingDefinitionsMatch };
@@ -8,6 +8,8 @@ import { Node } from "prosemirror-model";
8
8
  type ToProseDocOptions = {
9
9
  /** Style definitions for resolving paragraph styles */
10
10
  styles?: document_d_exports.StyleDefinitions;
11
+ /** Package definitions used to recompute secondary-story list rendering. */
12
+ numbering?: document_d_exports.NumberingDefinitions;
11
13
  /** Theme used when converting themed table/cell values in nested content. */
12
14
  theme?: document_d_exports.Theme | null;
13
15
  /**
@@ -28,9 +30,8 @@ declare function standaloneTableCellToProseMirror(cell: document_d_exports.Table
28
30
  * Convert HeaderFooter content (array of Paragraph/Table blocks) to a ProseMirror document.
29
31
  * Used for editing headers/footers in their own ProseMirror editor and for
30
32
  * the unified header/footer render pipeline (see
31
- * `core/layout-bridge/headerFooterLayout.ts`). `theme` lives in
32
- * `ToProseDocOptions` for future themeColor cell-shading resolution; folio's
33
- * `convertTable` does not yet thread it (orthogonal upstream divergence).
33
+ * `core/layout-bridge/headerFooterLayout.ts`). Package numbering definitions
34
+ * recompute list rendering for direct paragraphs and nested table content.
34
35
  */
35
36
  declare function headerFooterToProseDoc(content: document_d_exports.BlockContent[], options?: ToProseDocOptions): Node;
36
37
  declare function footnoteToProseDoc(content: document_d_exports.BlockContent[], options?: ToProseDocOptions): Node;
@@ -1,6 +1,7 @@
1
1
  import { rangedCommentIds } from "../../docx/commentAnchorIndex.js";
2
2
  import { resolveColorValueToHex } from "../../docx/drawingUtils.js";
3
3
  import { isInlineSdtContent, isTrackedChangeWrapperChild } from "../../docx/inlineWrapperContent.js";
4
+ import { computeListRendering, getCachedNumberingMap } from "../../docx/numberingParser.js";
4
5
  import { PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR, createProseParagraphWithPropertySource, getDocumentParagraphPropertySourceContract, proseParagraphAttrsWithoutPropertySource, recreateProseNodeWithParagraphPropertySource, transportTableCellsWithParagraphPropertySources } from "../../docx/paragraphPropertySource.js";
5
6
  import { isBaselineVertAlign } from "../../docx/runParser.js";
6
7
  import { replayableShapeAlternateContent } from "../../docx/shapeAlternateContent.js";
@@ -30,6 +31,7 @@ import { MOVE_RANGE_BOUNDARY_NODE_NAME } from "../extensions/nodes/MoveRangeBoun
30
31
  import { RANGE_ANCHOR_NODE_NAME } from "../extensions/nodes/RangeAnchorExtension.js";
31
32
  import "../extensions/nodes/SdtExtension.js";
32
33
  import { inlineWrapperLayer } from "../inlineWrapperStack.js";
34
+ import { CLEARED_LIST_RENDERING_ATTRS } from "../listMarker.js";
33
35
  import { listRenderingAttrPatch } from "../listRenderingAttrs.js";
34
36
  import { stampNumberedRefFieldBaselines } from "../numberedRefFields.js";
35
37
  import { paragraphNumberingAttr } from "../numberingAttr.js";
@@ -47,11 +49,12 @@ import { tableCellStyleRegions, tableRowBand } from "../styles/tableStyleRegions
47
49
  import { canCarryTrackedRunMark, trackedRunInlineAtomDisposition } from "../trackedRunInlineAtoms.js";
48
50
  import { assertValidProseMirrorDocument } from "../validation.js";
49
51
  import { resolveEffectiveTableCellFormatting } from "./effectiveTableCellFormatting.js";
52
+ import { listRenderingDefinitionsMatch } from "./listRenderingDefinition.js";
50
53
  import { createMarkInterner } from "./markInterner.js";
51
54
  import { hasSinkChildren } from "./preservedSinkCarriers.js";
52
55
  import { sdtAttrsFromProperties } from "./sdtAttrs.js";
53
56
  import { panic } from "better-result";
54
- import { DRAWING_RAW_XML_MODES, PARSE_WARNING_CODES } from "@stll/docx-core/model";
57
+ import { DRAWING_RAW_XML_MODES, PARSE_WARNING_CODES, mergeParagraphNumbering } from "@stll/docx-core/model";
55
58
  //#region src/prosemirror/conversion/toProseDoc.ts
56
59
  const DETACHED_WATERMARK_HOST = Symbol.for("stll.detachedWatermarkHost");
57
60
  const noPageBreakProjectionWarning = () => {};
@@ -227,11 +230,15 @@ function toProseDoc(document, options) {
227
230
  const styleResolver = createStyleEngine(options?.styles ?? document.package.styles);
228
231
  const theme = options?.theme ?? document.package.theme ?? null;
229
232
  const nextTextBoxGroupId = createTextBoxGroupIdFactory();
233
+ const nextHyperlinkInstanceIndex = createHyperlinkInstanceIndexAllocator();
234
+ const pairedBookmarkIds = collectPairedBookmarkIds(paragraphs);
230
235
  const conversionContext = {
236
+ listRenderings: /* @__PURE__ */ new Map(),
237
+ numbering: document.package.numbering === void 0 ? void 0 : getCachedNumberingMap(document.package.numbering),
231
238
  theme,
232
239
  nextTextBoxGroupId,
233
- nextHyperlinkInstanceIndex: createHyperlinkInstanceIndexAllocator(),
234
- pairedBookmarkIds: collectPairedBookmarkIds(paragraphs),
240
+ nextHyperlinkInstanceIndex,
241
+ pairedBookmarkIds,
235
242
  pageBreakRunSourceDescendants: buildPageBreakRunSourceDescendantIndex(paragraphs),
236
243
  storyRangedCommentIds: rangedCommentIds(paragraphs),
237
244
  openCommentIds: /* @__PURE__ */ new Set(),
@@ -328,7 +335,8 @@ function preservedInlineNode(content) {
328
335
  return schema.node("preservedXml", {
329
336
  xml: content.xml,
330
337
  text: content.text,
331
- level: PRESERVED_XML_LEVELS.inline
338
+ level: PRESERVED_XML_LEVELS.inline,
339
+ ...content.foldedListNumber ? { foldedListNumber: content.foldedListNumber } : {}
332
340
  });
333
341
  }
334
342
  /**
@@ -372,6 +380,20 @@ function convertBlockCustomXml(block, convertBlocks) {
372
380
  _originallyEmpty: block.content.length === 0
373
381
  }, children);
374
382
  }
383
+ const resolveListRendering = (numPr, context) => {
384
+ const key = `${numPr.numId}:${numPr.ilvl ?? 0}`;
385
+ const cached = context.listRenderings.get(key);
386
+ if (cached !== void 0) return cached;
387
+ const numbering = context.numbering;
388
+ const rendering = numbering === void 0 ? null : computeListRendering(numPr, numbering);
389
+ const nextLevel = numbering?.getLevel(numPr.numId, (numPr.ilvl ?? 0) + 1);
390
+ const resolved = {
391
+ rendering,
392
+ nextSlotOffset: nextLevel?.pPr?.hangingIndent === true && nextLevel.pPr.indentFirstLine !== void 0 && nextLevel.pPr.indentFirstLine < 0 ? -nextLevel.pPr.indentFirstLine : void 0
393
+ };
394
+ context.listRenderings.set(key, resolved);
395
+ return resolved;
396
+ };
375
397
  /**
376
398
  * Convert a Paragraph to a ProseMirror paragraph node
377
399
  *
@@ -386,6 +408,15 @@ function convertParagraph(paragraph, styleResolver, context, extraRunFormatting,
386
408
  createMark: context.createMark
387
409
  };
388
410
  const { attrs, effectiveFrame } = paragraphFormattingToAttrs(paragraph, styleResolver, tableParagraphOverlay);
411
+ const numPr = mergeParagraphNumbering(attrs.numPrFromStyle ?? void 0, attrs.numPr ?? void 0);
412
+ if (numPr?.kind === "none") Object.assign(attrs, CLEARED_LIST_RENDERING_ATTRS);
413
+ else if (context.numbering !== void 0 && numPr?.kind === "reference") {
414
+ const { rendering, nextSlotOffset } = resolveListRendering(numPr, context);
415
+ if (rendering !== null) {
416
+ const cached = paragraph.listRendering;
417
+ if (!(cached !== void 0 && listRenderingDefinitionsMatch(cached, rendering) && (cached.markerSecondSlotOffsetTwips === void 0 || cached.markerSecondSlotOffsetTwips === nextSlotOffset))) Object.assign(attrs, CLEARED_LIST_RENDERING_ATTRS, listRenderingAttrPatch(rendering));
418
+ } else Object.assign(attrs, CLEARED_LIST_RENDERING_ATTRS);
419
+ }
389
420
  reportParagraphPageBreakProjection({
390
421
  paragraph,
391
422
  attrs,
@@ -724,6 +755,7 @@ function convertTrackedChange(change, markType, nextHyperlinkInstanceIndex, runS
724
755
  initials: change.info.initials ?? null,
725
756
  moveKind,
726
757
  _docxOuterWrapperCount: wrappedBy.length,
758
+ _docxResolutionJoins: change.resolutionJoins ?? null,
727
759
  ...markType === "deletion" ? { _historicalFormatting: true } : {}
728
760
  });
729
761
  const ancestor = {
@@ -733,7 +765,8 @@ function convertTrackedChange(change, markType, nextHyperlinkInstanceIndex, runS
733
765
  ...change.info.date ? { date: change.info.date } : {},
734
766
  ...change.info.utcDate ? { utcDate: change.info.utcDate.value } : {},
735
767
  ...change.info.initials ? { initials: change.info.initials } : {},
736
- outerWrapperCount: wrappedBy.length
768
+ outerWrapperCount: wrappedBy.length,
769
+ ...change.resolutionJoins === void 0 ? {} : { resolutionJoins: change.resolutionJoins }
737
770
  };
738
771
  return nodes.map((node) => withTrackedRunMark(node, mark, ancestor));
739
772
  }
@@ -753,7 +786,7 @@ function paragraphFormattingToAttrs(paragraph, styleResolver, tableParagraphOver
753
786
  if (tableOfContentsLevel !== void 0) attrs._tableOfContentsLevel = tableOfContentsLevel;
754
787
  if (formatting?.numPr) attrs.numPr = paragraphNumberingAttr(formatting.numPr);
755
788
  if (formatting?.numPrFromStyle) attrs.numPrFromStyle = paragraphNumberingAttr(formatting.numPrFromStyle);
756
- if (paragraph.listRendering) Object.assign(attrs, listRenderingAttrPatch(paragraph.listRendering));
789
+ if (paragraph.listRendering && formatting?.numPr?.kind !== "none") Object.assign(attrs, listRenderingAttrPatch(paragraph.listRendering));
757
790
  if (formatting) attrs._originalFormatting = formatting;
758
791
  if (paragraph.propertyChanges && paragraph.propertyChanges.length > 0) attrs._propertyChanges = paragraph.propertyChanges.map(({ previousFormatting, ...change }) => {
759
792
  if (previousFormatting === void 0) return change;
@@ -1262,7 +1295,9 @@ function standaloneTableCellToProseMirror(cell, nodeType) {
1262
1295
  cell,
1263
1296
  styleResolver: null,
1264
1297
  context: {
1298
+ listRenderings: /* @__PURE__ */ new Map(),
1265
1299
  theme: null,
1300
+ numbering: void 0,
1266
1301
  nextTextBoxGroupId,
1267
1302
  nextHyperlinkInstanceIndex,
1268
1303
  pairedBookmarkIds: collectPairedBookmarkIds(cell.content),
@@ -1725,6 +1760,7 @@ function reportRunContentBesidePageBreak(run, owner, warn) {
1725
1760
  case "drawing":
1726
1761
  case "endnoteRef":
1727
1762
  case "footnoteRef":
1763
+ case "noteMarker":
1728
1764
  case "preservedXml":
1729
1765
  case "renderedPageBreak":
1730
1766
  case "symbol":
@@ -1938,6 +1974,7 @@ const carriedRunFormatting = (formatting) => formatting && Object.keys(formattin
1938
1974
  */
1939
1975
  function convertRunContent(content, marks, formatting, textBoxAnchors, authoredFormatting) {
1940
1976
  switch (content.type) {
1977
+ case "noteMarker": return [schema.node("noteMarker", { kind: content.kind }).mark(marks)];
1941
1978
  case "text":
1942
1979
  if (content.text) return [schema.text(content.text, marks)];
1943
1980
  return [];
@@ -2648,20 +2685,23 @@ function convertTextBox(textBox, styleResolver, options) {
2648
2685
  * Convert HeaderFooter content (array of Paragraph/Table blocks) to a ProseMirror document.
2649
2686
  * Used for editing headers/footers in their own ProseMirror editor and for
2650
2687
  * the unified header/footer render pipeline (see
2651
- * `core/layout-bridge/headerFooterLayout.ts`). `theme` lives in
2652
- * `ToProseDocOptions` for future themeColor cell-shading resolution; folio's
2653
- * `convertTable` does not yet thread it (orthogonal upstream divergence).
2688
+ * `core/layout-bridge/headerFooterLayout.ts`). Package numbering definitions
2689
+ * recompute list rendering for direct paragraphs and nested table content.
2654
2690
  */
2655
2691
  function headerFooterToProseDoc(content, options) {
2656
2692
  const nodes = [];
2657
2693
  const styleResolver = options?.styles ? createStyleEngine(options.styles) : null;
2658
2694
  const theme = options?.theme ?? null;
2659
2695
  const nextTextBoxGroupId = createTextBoxGroupIdFactory();
2696
+ const nextHyperlinkInstanceIndex = createHyperlinkInstanceIndexAllocator();
2697
+ const pairedBookmarkIds = collectPairedBookmarkIds(content);
2660
2698
  const conversionContext = {
2699
+ listRenderings: /* @__PURE__ */ new Map(),
2661
2700
  theme,
2701
+ numbering: options?.numbering === void 0 ? void 0 : getCachedNumberingMap(options.numbering),
2662
2702
  nextTextBoxGroupId,
2663
- nextHyperlinkInstanceIndex: createHyperlinkInstanceIndexAllocator(),
2664
- pairedBookmarkIds: collectPairedBookmarkIds(content),
2703
+ nextHyperlinkInstanceIndex,
2704
+ pairedBookmarkIds,
2665
2705
  pageBreakRunSourceDescendants: buildPageBreakRunSourceDescendantIndex(content),
2666
2706
  storyRangedCommentIds: rangedCommentIds(content),
2667
2707
  openCommentIds: /* @__PURE__ */ new Set(),
@@ -0,0 +1,11 @@
1
+ import { Command } from "prosemirror-state";
2
+ import { EditorView } from "prosemirror-view";
3
+ //#region src/prosemirror/executeEditorCommand.d.ts
4
+ /** The view's controller owns canonical command interpretation. */
5
+ declare const registerEditorCommandOwner: (view: EditorView, execute: (command: Command) => boolean | undefined) => () => void;
6
+ /** Keep commands on their selected view; a handled refusal must not fall through. */
7
+ declare const executeEditorCommand: (view: EditorView, command: Command) => boolean;
8
+ /** Legacy command chains stop at the first owner decision, including refusal. */
9
+ declare const executeFirstEditorCommand: (view: EditorView, commands: readonly Command[]) => boolean;
10
+ //#endregion
11
+ export { executeEditorCommand, executeFirstEditorCommand, registerEditorCommandOwner };
@@ -0,0 +1,26 @@
1
+ //#region src/prosemirror/executeEditorCommand.ts
2
+ const owners = /* @__PURE__ */ new WeakMap();
3
+ /** The view's controller owns canonical command interpretation. */
4
+ const registerEditorCommandOwner = (view, execute) => {
5
+ owners.set(view, execute);
6
+ return () => {
7
+ owners.delete(view);
8
+ };
9
+ };
10
+ /** Keep commands on their selected view; a handled refusal must not fall through. */
11
+ const executeEditorCommand = (view, command) => {
12
+ const handled = owners.get(view)?.(command);
13
+ if (handled !== void 0) return handled;
14
+ return command(view.state, (transaction) => view.dispatch(transaction), view);
15
+ };
16
+ /** Legacy command chains stop at the first owner decision, including refusal. */
17
+ const executeFirstEditorCommand = (view, commands) => {
18
+ for (const command of commands) {
19
+ const handled = owners.get(view)?.(command);
20
+ if (handled !== void 0) return handled;
21
+ if (command(view.state, (transaction) => view.dispatch(transaction), view)) return true;
22
+ }
23
+ return false;
24
+ };
25
+ //#endregion
26
+ export { executeEditorCommand, executeFirstEditorCommand, registerEditorCommandOwner };
@@ -30,6 +30,7 @@ import { HorizontalRuleExtension } from "./nodes/HorizontalRuleExtension.js";
30
30
  import { ImageExtension } from "./nodes/ImageExtension.js";
31
31
  import { MathExtension } from "./nodes/MathExtension.js";
32
32
  import { MoveRangeBoundaryExtension } from "./nodes/MoveRangeBoundaryExtension.js";
33
+ import { NoteMarkerExtension } from "./nodes/NoteMarkerExtension.js";
33
34
  import { PageBreakExtension } from "./nodes/PageBreakExtension.js";
34
35
  import { PageBreakRunExtension } from "./nodes/PageBreakRunExtension.js";
35
36
  import { PreservedBlockExtension } from "./nodes/PreservedBlockExtension.js";
@@ -76,6 +77,7 @@ function createStarterKit(options = {}) {
76
77
  add("tab", TabExtension());
77
78
  add("symbol", SymbolExtension());
78
79
  add("preservedXml", PreservedXmlExtension());
80
+ add("noteMarker", NoteMarkerExtension());
79
81
  add("image", ImageExtension());
80
82
  add("textBox", TextBoxExtension());
81
83
  add("textBoxAnchor", TextBoxAnchorExtension({ getInternalClipboardToken }));