@stll/folio-core 0.42.0 → 0.44.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 (206) hide show
  1. package/dist/ai-edits/headless.js +6 -5
  2. package/dist/ai-edits/index.d.ts +2 -2
  3. package/dist/ai-edits/index.js +2 -2
  4. package/dist/ai-edits/snapshot.js +13 -9
  5. package/dist/compare/content-alignment.js +16 -1
  6. package/dist/compare/inline-atoms.js +1 -1
  7. package/dist/compare/style-resources.js +6 -0
  8. package/dist/compat/eigenpal.d.ts +2 -2
  9. package/dist/controller/layoutPipeline.d.ts +2 -1
  10. package/dist/controller/layoutPipeline.js +5 -2
  11. package/dist/controller/layoutSession.d.ts +2 -1
  12. package/dist/controller/layoutSession.js +1 -0
  13. package/dist/docx/appVersionNormalization.d.ts +0 -18
  14. package/dist/docx/blockContentParser.js +10 -1
  15. package/dist/docx/blockRangeMarkers.d.ts +36 -0
  16. package/dist/docx/blockRangeMarkers.js +59 -0
  17. package/dist/docx/bookmarkParser.d.ts +2 -20
  18. package/dist/docx/bookmarkParser.js +6 -30
  19. package/dist/docx/borderParser.d.ts +13 -0
  20. package/dist/docx/borderParser.js +71 -0
  21. package/dist/docx/builtInStyles.d.ts +165 -0
  22. package/dist/docx/builtInStyles.js +239 -0
  23. package/dist/docx/commentIdNormalization.d.ts +10 -0
  24. package/dist/docx/commentIdNormalization.js +33 -0
  25. package/dist/docx/commentParser.d.ts +2 -1
  26. package/dist/docx/commentParser.js +34 -7
  27. package/dist/docx/commentReferenceNormalization.d.ts +4 -1
  28. package/dist/docx/commentReferenceNormalization.js +23 -14
  29. package/dist/docx/danglingRelationshipReferences.d.ts +15 -0
  30. package/dist/docx/danglingRelationshipReferences.js +30 -0
  31. package/dist/docx/defaultParagraphStyle.d.ts +39 -0
  32. package/dist/docx/defaultParagraphStyle.js +54 -0
  33. package/dist/docx/documentParser.d.ts +2 -1
  34. package/dist/docx/documentParser.js +2 -2
  35. package/dist/docx/drawingUtils.d.ts +8 -1
  36. package/dist/docx/drawingUtils.js +12 -3
  37. package/dist/docx/fieldParser.js +3 -5
  38. package/dist/docx/footnoteParser.d.ts +3 -2
  39. package/dist/docx/footnoteParser.js +19 -2
  40. package/dist/docx/groupDrawingParser.js +1 -1
  41. package/dist/docx/headerFooterRefParser.d.ts +15 -3
  42. package/dist/docx/headerFooterRefParser.js +51 -14
  43. package/dist/docx/headerFooterReferenceNormalization.d.ts +4 -1
  44. package/dist/docx/headerFooterReferenceNormalization.js +5 -1
  45. package/dist/docx/hyperlinkParser.js +11 -15
  46. package/dist/docx/imageParser.d.ts +1 -1
  47. package/dist/docx/imageParser.js +22 -18
  48. package/dist/docx/imageRawXml.js +5 -5
  49. package/dist/docx/markupRangeMarker.d.ts +15 -0
  50. package/dist/docx/markupRangeMarker.js +44 -0
  51. package/dist/docx/noteReferenceStyles.d.ts +29 -0
  52. package/dist/docx/noteReferenceStyles.js +70 -0
  53. package/dist/docx/numberingParser.js +2 -1
  54. package/dist/docx/numberingReference.d.ts +21 -0
  55. package/dist/docx/numberingReference.js +21 -0
  56. package/dist/docx/numberingReferenceNormalization.d.ts +14 -2
  57. package/dist/docx/numberingReferenceNormalization.js +51 -9
  58. package/dist/docx/paraIdRangeNormalization.d.ts +0 -19
  59. package/dist/docx/paragraphParser.js +69 -101
  60. package/dist/docx/paragraphPropertySource.js +1 -0
  61. package/dist/docx/paragraphTraversal.d.ts +37 -1
  62. package/dist/docx/paragraphTraversal.js +84 -1
  63. package/dist/docx/parseContext.d.ts +37 -0
  64. package/dist/docx/parseContext.js +67 -0
  65. package/dist/docx/parseWarningMessage.d.ts +6 -0
  66. package/dist/docx/parseWarningMessage.js +44 -0
  67. package/dist/docx/parser.js +86 -24
  68. package/dist/docx/relsParser.d.ts +28 -11
  69. package/dist/docx/relsParser.js +26 -13
  70. package/dist/docx/revisionIdNormalization.js +81 -7
  71. package/dist/docx/rezip.js +85 -27
  72. package/dist/docx/runConsolidator.js +1 -2
  73. package/dist/docx/runParser.d.ts +8 -1
  74. package/dist/docx/runParser.js +30 -48
  75. package/dist/docx/sectionParser.d.ts +2 -1
  76. package/dist/docx/sectionParser.js +21 -65
  77. package/dist/docx/serializer/borderSerializer.d.ts +1 -2
  78. package/dist/docx/serializer/commentSerializer.js +22 -9
  79. package/dist/docx/serializer/documentSerializer.d.ts +1 -5
  80. package/dist/docx/serializer/documentSerializer.js +6 -16
  81. package/dist/docx/serializer/headerFooterSerializer.js +5 -0
  82. package/dist/docx/serializer/markupRangeAttributes.d.ts +8 -0
  83. package/dist/docx/serializer/markupRangeAttributes.js +24 -0
  84. package/dist/docx/serializer/noteSerializer.js +5 -0
  85. package/dist/docx/serializer/paragraphSerializer.d.ts +1 -5
  86. package/dist/docx/serializer/paragraphSerializer.js +29 -35
  87. package/dist/docx/serializer/runSerializer.js +13 -7
  88. package/dist/docx/serializer/tableSerializer.js +28 -13
  89. package/dist/docx/serializer/textFormattingSerializer.d.ts +2 -3
  90. package/dist/docx/server/build.js +8 -1
  91. package/dist/docx/server/createBilingualDocument.js +15 -22
  92. package/dist/docx/server/extractDocxText.js +3 -4
  93. package/dist/docx/shadingParser.d.ts +6 -0
  94. package/dist/docx/shadingParser.js +32 -0
  95. package/dist/docx/shapeParser.js +3 -3
  96. package/dist/docx/styleParser.js +15 -89
  97. package/dist/docx/styleReferenceResolution.d.ts +36 -0
  98. package/dist/docx/styleReferenceResolution.js +51 -0
  99. package/dist/docx/tableLook.d.ts +57 -0
  100. package/dist/docx/tableLook.js +63 -0
  101. package/dist/docx/tableParser.d.ts +7 -9
  102. package/dist/docx/tableParser.js +64 -110
  103. package/dist/docx/textBoxParser.js +4 -4
  104. package/dist/docx/trackedMoveRangeNormalization.d.ts +3 -1
  105. package/dist/docx/trackedMoveRangeNormalization.js +11 -21
  106. package/dist/docx/transitionalSpelling.d.ts +13 -2
  107. package/dist/docx/transitionalSpelling.js +23 -1
  108. package/dist/docx/verbatimCapture.js +4 -11
  109. package/dist/docx/vmlImageParser.js +2 -2
  110. package/dist/docx/watermarkParser.js +2 -2
  111. package/dist/docx/xmlParser.d.ts +22 -32
  112. package/dist/docx/xmlParser.js +36 -21
  113. package/dist/index.d.ts +2 -2
  114. package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +2 -0
  115. package/dist/internal/pageBreakRunSourceDescendantIndex.js +9 -6
  116. package/dist/internal/paragraphFormattingSerialization.d.ts +2 -3
  117. package/dist/internal/paragraphFormattingSerialization.js +26 -6
  118. package/dist/layout-bridge/convert/footnoteLayout.js +2 -7
  119. package/dist/layout-bridge/convert/templatePreviewFlow.d.ts +19 -11
  120. package/dist/layout-bridge/convert/templatePreviewFlow.js +103 -38
  121. package/dist/layout-bridge/convert/toFlowBlocks.js +12 -3
  122. package/dist/layout-engine/index.d.ts +2 -2
  123. package/dist/layout-engine/index.js +2 -2
  124. package/dist/layout-engine/measure/measureBlocks.js +1 -6
  125. package/dist/layout-engine/types.d.ts +8 -2
  126. package/dist/layout-engine/types.js +35 -2
  127. package/dist/markdown/index.js +1 -1
  128. package/dist/markdown/internals.d.ts +6 -1
  129. package/dist/markdown/internals.js +14 -1
  130. package/dist/markdown/renderBlock.js +35 -21
  131. package/dist/markdown/renderParagraph.js +14 -5
  132. package/dist/markdown/renderRuns.js +4 -3
  133. package/dist/markdown/renderTable.js +4 -3
  134. package/dist/markdown/trailers.js +41 -7
  135. package/dist/markdown/types.d.ts +3 -7
  136. package/dist/prosemirror/attrs/index.js +2 -5
  137. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +11 -1
  138. package/dist/prosemirror/bookmarkBoundaryAttrs.js +18 -3
  139. package/dist/prosemirror/commands/index.d.ts +3 -3
  140. package/dist/prosemirror/commands/index.js +2 -2
  141. package/dist/prosemirror/commands/pageBreak.js +12 -1
  142. package/dist/prosemirror/commands/paragraph.d.ts +3 -3
  143. package/dist/prosemirror/commands/paragraph.js +2 -2
  144. package/dist/prosemirror/commentIdAllocator.js +2 -7
  145. package/dist/prosemirror/conversion/fromProseDoc.js +131 -41
  146. package/dist/prosemirror/conversion/toProseDoc.d.ts +1 -14
  147. package/dist/prosemirror/conversion/toProseDoc.js +402 -328
  148. package/dist/prosemirror/extensions/core/ParagraphExtension.d.ts +14 -1
  149. package/dist/prosemirror/extensions/core/ParagraphExtension.js +11 -6
  150. package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -3
  151. package/dist/prosemirror/extensions/features/ListExtension.js +42 -4
  152. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +4 -1
  153. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +6 -2
  154. package/dist/prosemirror/extensions/features/pastedHeadingStyles.d.ts +7 -0
  155. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +74 -0
  156. package/dist/prosemirror/extensions/marks/markUtils.d.ts +11 -3
  157. package/dist/prosemirror/extensions/marks/markUtils.js +98 -19
  158. package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +7 -3
  159. package/dist/prosemirror/extensions/nodes/ImageExtension.js +2 -1
  160. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +1 -0
  161. package/dist/prosemirror/extensions/nodes/TableExtension.js +15 -1
  162. package/dist/prosemirror/extensions/types.d.ts +2 -2
  163. package/dist/prosemirror/index.d.ts +3 -3
  164. package/dist/prosemirror/index.js +3 -3
  165. package/dist/prosemirror/insertOperations.d.ts +9 -2
  166. package/dist/prosemirror/insertOperations.js +9 -4
  167. package/dist/prosemirror/listMarker.js +2 -1
  168. package/dist/prosemirror/numberedRefFields.js +2 -1
  169. package/dist/prosemirror/pageBreakRunProjection.d.ts +11 -3
  170. package/dist/prosemirror/pageBreakRunProjection.js +16 -8
  171. package/dist/prosemirror/paragraphFormattingProvenance.d.ts +159 -0
  172. package/dist/prosemirror/paragraphFormattingProvenance.js +106 -0
  173. package/dist/prosemirror/plugins/documentStyles.d.ts +9 -1
  174. package/dist/prosemirror/plugins/documentStyles.js +11 -1
  175. package/dist/prosemirror/plugins/index.d.ts +2 -2
  176. package/dist/prosemirror/plugins/index.js +2 -2
  177. package/dist/prosemirror/plugins/revisionIds.d.ts +11 -2
  178. package/dist/prosemirror/plugins/revisionIds.js +21 -6
  179. package/dist/prosemirror/plugins/templatePreviewValues.d.ts +42 -1
  180. package/dist/prosemirror/plugins/templatePreviewValues.js +217 -14
  181. package/dist/prosemirror/runFormattingReconciliation.js +3 -2
  182. package/dist/prosemirror/runStyleFormatting.d.ts +1 -1
  183. package/dist/prosemirror/schema/nodes.d.ts +31 -0
  184. package/dist/prosemirror/styles/resolvedStyleAttrs.js +4 -1
  185. package/dist/prosemirror/styles/styleResolver.d.ts +9 -0
  186. package/dist/prosemirror/styles/styleResolver.js +15 -6
  187. package/dist/prosemirror/utils/visualLineNavigation.d.ts +22 -2
  188. package/dist/prosemirror/utils/visualLineNavigation.js +80 -63
  189. package/dist/style-engine/styleEngine.d.ts +4 -1
  190. package/dist/style-engine/styleEngine.js +3 -0
  191. package/dist/style-sets/extract.js +35 -11
  192. package/dist/style-sets/stellaStyle.js +46 -39
  193. package/dist/style-sets/styleSetNormalization.d.ts +19 -0
  194. package/dist/style-sets/styleSetNormalization.js +99 -0
  195. package/dist/types/content.d.ts +2 -2
  196. package/dist/utils/createDocument.js +145 -20
  197. package/dist/utils/headingCollector.d.ts +8 -5
  198. package/dist/utils/headingCollector.js +23 -25
  199. package/dist/utils/tableOfContentsStyle.js +9 -2
  200. package/package.json +3 -2
  201. package/dist/docx/textWhitespace.d.ts +0 -4
  202. package/dist/docx/textWhitespace.js +0 -4
  203. package/dist/layout-bridge/engine/tableWidthUtils.d.ts +0 -6
  204. package/dist/layout-bridge/engine/tableWidthUtils.js +0 -25
  205. package/dist/markdown/headings.d.ts +0 -13
  206. package/dist/markdown/headings.js +0 -20
@@ -264,11 +264,12 @@ const formatBlockLine = (block, text) => {
264
264
  return `${label} ${text}`;
265
265
  };
266
266
  const formatBlockForLLM = (block) => formatBlockLine(block, block.text);
267
- const headingLevel = (block) => {
268
- const digits = /(\d+)/u.exec(block.styleId ?? block.displayLabel ?? "")?.[1];
269
- const level = digits ? Number.parseInt(digits, 10) : 1;
270
- return level >= 1 && level <= 9 ? level : 1;
271
- };
267
+ /**
268
+ * The level the snapshot already classified. Scraping a digit out of the style
269
+ * id instead read `ClauseParagraph2` as an h2 and every localized heading id
270
+ * without a digit as an h1.
271
+ */
272
+ const headingLevel = (block) => block.headingLevel ?? 1;
272
273
  const revisionIdOf = (target) => typeof target === "number" ? target : target.id;
273
274
  const commentPlainText = (comment) => (comment.content ?? []).map(paragraphPlainText).join("\n");
274
275
  const paragraphPlainText = (paragraph) => {
@@ -6,8 +6,8 @@ import { DocPositionRange, clampRangeToDocSize, resolveFolioAIBlockRange, resolv
6
6
  import { buildAnnotatedBlockText } from "./clean-text.js";
7
7
  import { ApplyFolioDocumentOperationsOptions, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationResultBase, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "../document-operations.js";
8
8
  import { FolioCommentAnchor, FolioReviewChange, FolioReviewChangeKind, getCommentAnchorsFromDoc, getTrackedChangesFromDoc } from "./read.js";
9
- import { createFolioAIEditSnapshot, createFolioAITextRangeHandle, hashFolioAIBlockText, isFolioAIContentBlock, normalizeFolioAIBlockText } from "./snapshot.js";
9
+ import { createFolioAIEditSnapshot, createFolioAIEditSnapshotWithStyleResolver, createFolioAITextRangeHandle, hashFolioAIBlockText, isFolioAIContentBlock, normalizeFolioAIBlockText } from "./snapshot.js";
10
10
  import { FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FolioApplyDocumentOperationsToStoryOptions, FolioDocumentStory, FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, FolioEditableDocumentStoryHandle, FolioReadReviewedStoryOptions, FolioResolveReviewedStoryOptions, FolioResolvedReviewedView, FolioReviewedStory, FolioReviewedView, UnsupportedFolioReviewedViewError, isFolioResolvedReviewedView, isFolioReviewedView } from "./headless.js";
11
11
  import { getFolioDocumentOutline, readFolioDocumentSection } from "./scoped-reading.js";
12
12
  import { getFolioParaIdFromBlockId } from "../types/block-id.js";
13
- export { type ApplyFolioDocumentOperationsOptions, type DocPositionRange, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIEditView, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIInsertFormattingScope, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsToStoryOptions, type FolioCommentAnchor, type FolioContentParagraphKind, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioEditableDocumentStoryHandle, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeKind, type FolioReviewedStory, type FolioReviewedView, type FolioRevisionStamp, type FolioWordDiffOptions, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioReviewedViewError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, applyFolioAIEditOperations, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, buildAnnotatedBlockText, clampRangeToDocSize, createFolioAIEditSnapshot, createFolioAITextRangeHandle, diffWordSegments, getCommentAnchorsFromDoc, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, getTrackedChangesFromDoc, hashFolioAIBlockText, isFolioAIContentBlock, isFolioDocumentOperationModeSupported, isFolioResolvedReviewedView, isFolioReviewedView, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, readFolioDocumentSection, resolveFolioAIBlockRange, resolveFolioAITextRange, resolvePassageRange };
13
+ export { type ApplyFolioDocumentOperationsOptions, type DocPositionRange, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIEditView, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIInsertFormattingScope, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsToStoryOptions, type FolioCommentAnchor, type FolioContentParagraphKind, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioEditableDocumentStoryHandle, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeKind, type FolioReviewedStory, type FolioReviewedView, type FolioRevisionStamp, type FolioWordDiffOptions, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioReviewedViewError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, applyFolioAIEditOperations, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, buildAnnotatedBlockText, clampRangeToDocSize, createFolioAIEditSnapshot, createFolioAIEditSnapshotWithStyleResolver, createFolioAITextRangeHandle, diffWordSegments, getCommentAnchorsFromDoc, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, getTrackedChangesFromDoc, hashFolioAIBlockText, isFolioAIContentBlock, isFolioDocumentOperationModeSupported, isFolioResolvedReviewedView, isFolioReviewedView, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, readFolioDocumentSection, resolveFolioAIBlockRange, resolveFolioAITextRange, resolvePassageRange };
@@ -6,6 +6,6 @@ import { buildAnnotatedBlockText } from "./clean-text.js";
6
6
  import { FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FolioDocumentStoryNotFoundError, UnsupportedFolioReviewedViewError, isFolioResolvedReviewedView, isFolioReviewedView } from "./headless.js";
7
7
  import { getCommentAnchorsFromDoc, getTrackedChangesFromDoc } from "./read.js";
8
8
  import { getFolioDocumentOutline, readFolioDocumentSection } from "./scoped-reading.js";
9
- import { createFolioAIEditSnapshot, createFolioAITextRangeHandle, hashFolioAIBlockText, isFolioAIContentBlock, normalizeFolioAIBlockText } from "./snapshot.js";
9
+ import { createFolioAIEditSnapshot, createFolioAIEditSnapshotWithStyleResolver, createFolioAITextRangeHandle, hashFolioAIBlockText, isFolioAIContentBlock, normalizeFolioAIBlockText } from "./snapshot.js";
10
10
  import { WORD_DIFF_GRANULARITIES, diffWordSegments } from "./word-diff.js";
11
- export { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FolioDocumentStoryNotFoundError, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioReviewedViewError, WORD_DIFF_GRANULARITIES, applyFolioAIEditOperations, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, buildAnnotatedBlockText, clampRangeToDocSize, createFolioAIEditSnapshot, createFolioAITextRangeHandle, diffWordSegments, getCommentAnchorsFromDoc, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, getTrackedChangesFromDoc, hashFolioAIBlockText, isFolioAIContentBlock, isFolioDocumentOperationModeSupported, isFolioResolvedReviewedView, isFolioReviewedView, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, readFolioDocumentSection, resolveFolioAIBlockRange, resolveFolioAITextRange, resolvePassageRange };
11
+ export { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FolioDocumentStoryNotFoundError, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioReviewedViewError, WORD_DIFF_GRANULARITIES, applyFolioAIEditOperations, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, buildAnnotatedBlockText, clampRangeToDocSize, createFolioAIEditSnapshot, createFolioAIEditSnapshotWithStyleResolver, createFolioAITextRangeHandle, diffWordSegments, getCommentAnchorsFromDoc, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, getTrackedChangesFromDoc, hashFolioAIBlockText, isFolioAIContentBlock, isFolioDocumentOperationModeSupported, isFolioResolvedReviewedView, isFolioReviewedView, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, readFolioDocumentSection, resolveFolioAIBlockRange, resolveFolioAITextRange, resolvePassageRange };
@@ -1,3 +1,4 @@
1
+ import { EMPTY_BUILT_IN_STYLE_INDEX, resolveHeadingLevel } from "../docx/builtInStyles.js";
1
2
  import { recreateProseNodeWithParagraphPropertySource } from "../docx/paragraphPropertySource.js";
2
3
  import { expectCharacterStyleMarkAttrs, expectHyperlinkMarkAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs } from "../prosemirror/attrs/index.js";
3
4
  import { marksToTextFormatting } from "../prosemirror/conversion/fromProseDoc.js";
@@ -335,6 +336,7 @@ const getTableLocation = ({ path, blockIndex, tableIndexByStart }) => {
335
336
  }
336
337
  };
337
338
  const createFolioAIEditSnapshotInternal = (doc, styleResolver) => {
339
+ const builtInStyles = styleResolver?.builtInStyles ?? EMPTY_BUILT_IN_STYLE_INDEX;
338
340
  const draftBlocks = [];
339
341
  const hashCounts = /* @__PURE__ */ new Map();
340
342
  const usedBlockIds = /* @__PURE__ */ new Set();
@@ -394,9 +396,9 @@ const createFolioAIEditSnapshotInternal = (doc, styleResolver) => {
394
396
  });
395
397
  }
396
398
  usedBlockIds.add(id);
397
- const headingLevel = getHeadingLevel(node);
399
+ const headingLevel = getHeadingLevel(node, builtInStyles);
398
400
  const kind = getBlockKind(node, headingLevel);
399
- const displayLabel = getDisplayLabel(node);
401
+ const displayLabel = getDisplayLabel(node, kind === "heading");
400
402
  const styleId = getStyleId(node);
401
403
  const listLevel = getListLevel(node);
402
404
  const listReference = getListReference(node);
@@ -477,19 +479,21 @@ const getBlockKind = (node, headingLevel) => {
477
479
  if (headingLevel !== void 0) return "heading";
478
480
  return "paragraph";
479
481
  };
480
- const getHeadingLevel = (node) => {
482
+ /** The block's 1-based heading level, as {@link resolveHeadingLevel} classifies it. */
483
+ const getHeadingLevel = (node, styles) => {
481
484
  const outlineLevel = node.attrs["outlineLevel"];
482
- if (typeof outlineLevel === "number" && Number.isInteger(outlineLevel) && outlineLevel >= 0 && outlineLevel <= 8) return outlineLevel + 1;
483
485
  const styleId = node.attrs["styleId"];
484
- if (typeof styleId !== "string") return;
485
- const level = /^heading(?<level>[1-9])$/iu.exec(styleId)?.groups?.["level"];
486
- return level === void 0 ? void 0 : Number.parseInt(level, 10);
486
+ const level = resolveHeadingLevel({
487
+ outlineLevel: typeof outlineLevel === "number" ? outlineLevel : null,
488
+ styleId: typeof styleId === "string" ? styleId : null
489
+ }, styles);
490
+ return level === void 0 ? void 0 : level + 1;
487
491
  };
488
- const getDisplayLabel = (node) => {
492
+ const getDisplayLabel = (node, isHeading) => {
489
493
  const listMarker = node.attrs["listMarker"];
490
494
  if (typeof listMarker === "string" && listMarker.trim().length > 0) return listMarker.trim();
491
495
  const styleId = node.attrs["styleId"];
492
- if (typeof styleId === "string" && /^heading/iu.test(styleId)) return styleId;
496
+ if (isHeading && typeof styleId === "string") return styleId;
493
497
  };
494
498
  const getListLevel = (node) => {
495
499
  const numPr = node.attrs["numPr"];
@@ -1171,7 +1171,22 @@ const contentStructureEvidenceIndexes = (base, revised) => {
1171
1171
  revised: index(revised)
1172
1172
  };
1173
1173
  };
1174
- const sortedIndexesLeaveRange = (indexes, start, end) => indexes !== void 0 && ((indexes.at(0) ?? start) < start || (indexes.at(-1) ?? end - 1) >= end);
1174
+ /**
1175
+ * Whether the evidence lies outside the range, and only outside it.
1176
+ *
1177
+ * Evidence inside the range is at least as good a counterpart as evidence
1178
+ * beyond it, so a match that is also present locally does not make the local
1179
+ * pair suspect. Without the second test, two structurally identical tables in
1180
+ * one document cancel each other: each shares every exact signature and anchor
1181
+ * text with the other by construction, so each looks like it belongs
1182
+ * elsewhere, and comparing the document with itself reports both deleted and
1183
+ * both re-inserted.
1184
+ */
1185
+ const sortedIndexesLeaveRange = (indexes, start, end) => {
1186
+ if (indexes === void 0) return false;
1187
+ if ((indexes.at(0) ?? start) >= start && (indexes.at(-1) ?? end - 1) < end) return false;
1188
+ return !indexes.some((index) => index >= start && index < end);
1189
+ };
1175
1190
  const profileHasEvidenceOutsideRange = (profile, opposite, start, end) => {
1176
1191
  const exactKey = opposite.exactKeyByProfile.get(profile);
1177
1192
  if (exactKey !== void 0 && sortedIndexesLeaveRange(opposite.exactIndexes.get(exactKey), start, end)) return true;
@@ -69,7 +69,7 @@ const atomBlockOf = ({ node, from }) => {
69
69
  }
70
70
  const prepared = prepareTargetInlineAtom(child);
71
71
  if (!prepared) {
72
- unalignable = true;
72
+ unsupportedTopology.push(`${offset}:${child.type.name}:${canonicalJson(child.attrs)}`);
73
73
  return false;
74
74
  }
75
75
  supported.push({
@@ -213,6 +213,12 @@ const importReferencedStyleDefinitions = ({ sourceStyles, destinationStyles, sou
213
213
  styleIdMap: /* @__PURE__ */ new Map(),
214
214
  importedStyleIds: []
215
215
  };
216
+ if (requested.length === 0 && !sourceStyles && !destinationStyles) return {
217
+ status: "unchanged",
218
+ styles: destinationStyles,
219
+ styleIdMap: /* @__PURE__ */ new Map(),
220
+ importedStyleIds: []
221
+ };
216
222
  if (!sourceStyles) return {
217
223
  status: "unalignable",
218
224
  detail: "the target has no style definitions"
@@ -29,7 +29,7 @@ import { getFolioCaretViewportRect, getFolioSelectionViewportRect } from "../pag
29
29
  import { AICitationRange, createAICitationDecorationsPlugin, setAICitationsMeta, setActiveCitationMeta } from "../prosemirror/plugins/aiCitationDecorations.js";
30
30
  import { AnonymizationMatch, AnonymizationTerm, anonymizationDecorationsKey, getAnonymizationMatches, setAnonymizationTermsMeta } from "../prosemirror/plugins/anonymizationDecorations.js";
31
31
  import { DirectiveKind, DirectiveRange, getTemplateDirectives, scanDirectives } from "../prosemirror/plugins/templateDirectives.js";
32
- import { TemplatePreviewSpan, TemplatePreviewValue, TemplatePreviewValues, setTemplatePreviewValues } from "../prosemirror/plugins/templatePreviewValues.js";
32
+ import { TemplatePreviewHiddenRange, TemplatePreviewSpan, TemplatePreviewValue, TemplatePreviewValues, setTemplatePreviewValues } from "../prosemirror/plugins/templatePreviewValues.js";
33
33
  import { TemplateSlashMenuKeyAction, TemplateSlashMenuState, clearTemplateSlashMenu, consumeTemplateSlashQuery, getTemplateSlashMenu, resetTemplateSlashQuery, templateSlashMenuKey } from "../prosemirror/plugins/templateSlashMenu.js";
34
34
  import { AcceptAutocompleteResult, AutocompleteSuggestionPluginOptions, AutocompleteSuggestionState, AutocompleteSuggestionStatus, AutocompleteTriggerCheck, AutocompleteTriggerOptions, AutocompleteTriggerSkipReason, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, acceptAutocompleteSuggestion, acceptAutocompleteWord, appendAutocompleteToken, autocompleteSuggestionKey, autocompleteSuggestionPlugin, clearAutocompleteSuggestion, finishAutocompleteSuggestion, getAutocompleteSuggestion, shouldTriggerAutocomplete, startAutocompleteSuggestion } from "../prosemirror/plugins/autocompleteSuggestion.js";
35
35
  import { ImageMeta, ImageRef, MarkdownOptions, MarkdownResult } from "../markdown/types.js";
@@ -40,4 +40,4 @@ import { getGoogleFontsEnabled, setEmbeddedFontFamilyMap, setGoogleFontsEnabled
40
40
  import { DOCX_CONFORMANCE_CLASSES } from "../index.js";
41
41
  type Document = document_d_exports.Document;
42
42
  type DocxConformanceClass = document_d_exports.DocxConformanceClass;
43
- export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, type CompareChange, type CompareChangeLocation, type CompareCompatibility, type CompareContentOptions, CompareDocxApplyError, type CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, type CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, type CompareFolioRequirement, type CompareResult, type CompareRevisionFormat, type CompareUnsupportedPart, type CompareUnsupportedReason, type CompareVerification, type CompareVerificationCause, type CompareVerificationFailure, type CompareVerificationInvariant, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, DRAWING_SAFETY_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type DocxDrawingClassification, type DrawingSafetyClass, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, type FinalParagraphMarkRevision, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioBlockId, type FolioContentBlock, type FolioContentBlockProperty, type FolioContentComparison, type FolioContentComparisonError, type FolioContentComparisonEvent, type FolioContentComparisonLimit, FolioContentComparisonLimitError, type FolioContentContainerPathEntry, type FolioContentFormatRange, type FolioContentFormattingChange, type FolioContentIdStability, type FolioContentInlineBooleanProperty, type FolioContentInlineComparisonResult, type FolioContentInlineFormatting, type FolioContentInlineFormattingPatch, FolioContentInlinePresentationProjectionError, type FolioContentLineSpacingRule, type FolioContentParagraphAlignment, type FolioContentParagraphFormattingPatch, type FolioContentParagraphKind, type FolioContentParagraphSpacing, type FolioContentRun, type FolioContentSnapshot, type FolioContentStructuralChange, type FolioContentTableLocation, type FolioContentTextSegment, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type FolioRevisionStamp, type FolioWordDiffOptions, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
43
+ export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, type CompareChange, type CompareChangeLocation, type CompareCompatibility, type CompareContentOptions, CompareDocxApplyError, type CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, type CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, type CompareFolioRequirement, type CompareResult, type CompareRevisionFormat, type CompareUnsupportedPart, type CompareUnsupportedReason, type CompareVerification, type CompareVerificationCause, type CompareVerificationFailure, type CompareVerificationInvariant, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, DRAWING_SAFETY_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type DocxDrawingClassification, type DrawingSafetyClass, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, type FinalParagraphMarkRevision, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioBlockId, type FolioContentBlock, type FolioContentBlockProperty, type FolioContentComparison, type FolioContentComparisonError, type FolioContentComparisonEvent, type FolioContentComparisonLimit, FolioContentComparisonLimitError, type FolioContentContainerPathEntry, type FolioContentFormatRange, type FolioContentFormattingChange, type FolioContentIdStability, type FolioContentInlineBooleanProperty, type FolioContentInlineComparisonResult, type FolioContentInlineFormatting, type FolioContentInlineFormattingPatch, FolioContentInlinePresentationProjectionError, type FolioContentLineSpacingRule, type FolioContentParagraphAlignment, type FolioContentParagraphFormattingPatch, type FolioContentParagraphKind, type FolioContentParagraphSpacing, type FolioContentRun, type FolioContentSnapshot, type FolioContentStructuralChange, type FolioContentTableLocation, type FolioContentTextSegment, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type FolioRevisionStamp, type FolioWordDiffOptions, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewHiddenRange, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
@@ -1,5 +1,5 @@
1
1
  import { document_d_exports } from "../types/document.js";
2
- import { TemplatePreviewEntry } from "../prosemirror/plugins/templatePreviewValues.js";
2
+ import { TemplatePreviewEntry, TemplatePreviewHiddenRange } from "../prosemirror/plugins/templatePreviewValues.js";
3
3
  import { ColumnLayout, FlowBlock, FootnoteContent, HeaderFooterContent, Layout, Measure, PageHeaderFooterRefs, PageMargins } from "../layout-engine/types.js";
4
4
  import { LayoutRunReason } from "../layout-engine/layoutInstrumentation.js";
5
5
  import { DirtyRange } from "../paged-layout/incrementalMeasure.js";
@@ -73,6 +73,7 @@ type LayoutPipelineDeps<THfPMs> = {
73
73
  */
74
74
  pageRenderer?: PageRendererName;
75
75
  emptyTemplatePreviewEntries: readonly TemplatePreviewEntry[];
76
+ emptyTemplatePreviewHidden: readonly TemplatePreviewHiddenRange[];
76
77
  };
77
78
  declare function runLayoutPipeline<THfPMs>(deps: LayoutPipelineDeps<THfPMs>, state: EditorState, options?: LayoutRunOptions): LayoutOutcome;
78
79
  //#endregion
@@ -100,7 +100,7 @@ function attachAuthoredMarginsToLayoutPages(layout, options) {
100
100
  } : layout;
101
101
  }
102
102
  function runLayoutPipeline(deps, state, options = {}) {
103
- const { contentWidth, columns, pageSize, margins, pageGap, showMarginGuides, marginGuideColor, syncCoordinator, headerContent, footerContent, firstPageHeaderContent, firstPageFooterContent, headerContentRId, footerContentRId, firstPageHeaderContentRId, firstPageFooterContentRId, sectionHeaderFooterRefs, theme: _theme, sectionProperties, document, defaultTabStop, mirrorMargins, styles, layout, hfPMs, painter, pagesContainer, session, renderHfFromContentOrPm, renderHeaderFooterContentByRId, documentFontsAreLoaded, buildFootnoteRenderItems, describeInvalidHighlightMarks, pageRenderer = PAGE_RENDERER.legacy, emptyTemplatePreviewEntries: EMPTY_TEMPLATE_PREVIEW_ENTRIES } = deps;
103
+ const { contentWidth, columns, pageSize, margins, pageGap, showMarginGuides, marginGuideColor, syncCoordinator, headerContent, footerContent, firstPageHeaderContent, firstPageFooterContent, headerContentRId, footerContentRId, firstPageHeaderContentRId, firstPageFooterContentRId, sectionHeaderFooterRefs, theme: _theme, sectionProperties, document, defaultTabStop, mirrorMargins, styles, layout, hfPMs, painter, pagesContainer, session, renderHfFromContentOrPm, renderHeaderFooterContentByRId, documentFontsAreLoaded, buildFootnoteRenderItems, describeInvalidHighlightMarks, pageRenderer = PAGE_RENDERER.legacy, emptyTemplatePreviewEntries: EMPTY_TEMPLATE_PREVIEW_ENTRIES, emptyTemplatePreviewHidden: EMPTY_TEMPLATE_PREVIEW_HIDDEN } = deps;
104
104
  let outcome = {};
105
105
  let pendingArtifacts;
106
106
  let pendingTemplatePreview;
@@ -144,13 +144,16 @@ function runLayoutPipeline(deps, state, options = {}) {
144
144
  }, state.doc.content, state.doc.marks) : state.doc, flowOpts);
145
145
  const previewState = templatePreviewValuesKey.getState(state);
146
146
  const previewEntries = previewState?.entries ?? EMPTY_TEMPLATE_PREVIEW_ENTRIES;
147
+ const previewHidden = previewState?.hidden ?? EMPTY_TEMPLATE_PREVIEW_HIDDEN;
147
148
  const previewMode = previewState?.preview?.mode ?? "plain";
148
- if (previewEntries.length > 0) newBlocks = applyTemplatePreviewToBlocks(newBlocks, {
149
+ if (previewEntries.length > 0 || previewHidden.length > 0) newBlocks = applyTemplatePreviewToBlocks(newBlocks, {
149
150
  entries: previewEntries,
151
+ hidden: previewHidden,
150
152
  mode: previewMode
151
153
  });
152
154
  pendingTemplatePreview = {
153
155
  entries: previewEntries,
156
+ hidden: previewHidden,
154
157
  mode: previewMode
155
158
  };
156
159
  outcome.blocks = newBlocks;
@@ -1,4 +1,4 @@
1
- import { TemplatePreviewEntry, TemplatePreviewValues } from "../prosemirror/plugins/templatePreviewValues.js";
1
+ import { TemplatePreviewEntry, TemplatePreviewHiddenRange, TemplatePreviewValues } from "../prosemirror/plugins/templatePreviewValues.js";
2
2
  import { FlowBlock, Measure } from "../layout-engine/types.js";
3
3
  import { EditorState } from "prosemirror-state";
4
4
  //#region src/controller/layoutSession.d.ts
@@ -9,6 +9,7 @@ type LayoutArtifacts = {
9
9
  };
10
10
  type LayoutTemplatePreview = {
11
11
  entries: readonly TemplatePreviewEntry[];
12
+ hidden: readonly TemplatePreviewHiddenRange[];
12
13
  mode: TemplatePreviewValues["mode"];
13
14
  };
14
15
  type LayoutSession = {
@@ -6,6 +6,7 @@ const createLayoutSession = () => ({
6
6
  usedLoadedFonts: false,
7
7
  lastTemplatePreview: {
8
8
  entries: [],
9
+ hidden: [],
9
10
  mode: "plain"
10
11
  }
11
12
  });
@@ -1,22 +1,4 @@
1
1
  //#region src/docx/appVersionNormalization.d.ts
2
- /**
3
- * Keep the application version a package states about itself in the form the
4
- * schema gives it.
5
- *
6
- * `AppVersion` in the extended-properties part is `XX.YYYY`: a one- or
7
- * two-digit integer, a dot, and four digits. Producers exist that write a
8
- * three-part version there instead, and folio copies `docProps/app.xml`
9
- * through verbatim when it saves a document it did not create — so a package
10
- * can carry a value with two dots in, and a save that copies it out hands a
11
- * consumer a package it refuses to open at all.
12
- *
13
- * {@link appVersionInSchemaForm} is the one mapping, and it is a pure function
14
- * of the value alone: it keeps the leading integer where the value opens with
15
- * one the form allows, and writes the build digits the form requires. Nothing
16
- * else in the part is touched, and a package that carries no extended
17
- * properties keeps carrying none — synthesizing metadata a document never
18
- * stated is a different decision.
19
- */
20
2
  declare const AppVersionSchemaError_base: import("better-result").TaggedErrorClass<"AppVersionSchemaError">;
21
3
  /**
22
4
  * A value reached the package that the schema form does not accept.
@@ -1,6 +1,8 @@
1
+ import { attachPendingRangeMarkers, attachTrailingRangeMarkers, isBlockRangeMarker } from "./blockRangeMarkers.js";
1
2
  import { parseBookmarkEnd, parseBookmarkStart } from "./bookmarkParser.js";
2
3
  import { appendBookmarkMarkerToLastParagraphInBlocks, prependBookmarkMarkersToFirstParagraphInBlocks } from "./bookmarkPlacement.js";
3
4
  import { convertBulletToUnicode } from "./bulletMarkers.js";
5
+ import { isNumberingReference } from "./numberingReference.js";
4
6
  import { formatOoxmlCounter } from "./ooxmlCounterFormatter.js";
5
7
  import { parseParagraph } from "./paragraphParser.js";
6
8
  import { enrichParagraphTextBoxes } from "./paragraphTextBoxEnrichment.js";
@@ -18,7 +20,7 @@ const computeListMarker = (paragraph, { numbering, listCounters, abstractCounter
18
20
  return;
19
21
  }
20
22
  const { numId, level } = listRendering;
21
- if (numId === 0) {
23
+ if (!isNumberingReference(numId)) {
22
24
  previousList.abstractNumId = null;
23
25
  previousList.fromStyle = false;
24
26
  previousList.numId = null;
@@ -105,6 +107,7 @@ const parseBlockContentWithState = (parent, styles, theme, numbering, rels, medi
105
107
  const content = [];
106
108
  const children = getChildElements(parent);
107
109
  const pendingBookmarkMarkers = [];
110
+ const pendingRangeMarkers = [];
108
111
  for (const child of children) {
109
112
  const localName = getLocalName(child.name ?? "");
110
113
  if (localName === "p") {
@@ -118,6 +121,7 @@ const parseBlockContentWithState = (parent, styles, theme, numbering, rels, medi
118
121
  restartedNumIds: state.restartedNumIds,
119
122
  previousList: state.previousList
120
123
  });
124
+ attachPendingRangeMarkers(paragraph, pendingRangeMarkers);
121
125
  content.push(paragraph);
122
126
  continue;
123
127
  }
@@ -125,6 +129,7 @@ const parseBlockContentWithState = (parent, styles, theme, numbering, rels, medi
125
129
  const table = parseTable(child, styles, theme, numbering, rels, media, state.options);
126
130
  if (!table) continue;
127
131
  if (prependBookmarkMarkersToFirstParagraphInBlocks([table], pendingBookmarkMarkers)) pendingBookmarkMarkers.length = 0;
132
+ attachPendingRangeMarkers(table, pendingRangeMarkers);
128
133
  content.push(table);
129
134
  continue;
130
135
  }
@@ -142,6 +147,7 @@ const parseBlockContentWithState = (parent, styles, theme, numbering, rels, medi
142
147
  content: sdtContent ? parseBlockContentWithState(sdtContent, styles, theme, numbering, rels, media, withContainerXmlns(withContainerXmlns(state, child), sdtContent)) : []
143
148
  };
144
149
  if (prependBookmarkMarkersToFirstParagraphInBlocks(blockSdt.content, pendingBookmarkMarkers)) pendingBookmarkMarkers.length = 0;
150
+ attachPendingRangeMarkers(blockSdt, pendingRangeMarkers);
145
151
  content.push(blockSdt);
146
152
  continue;
147
153
  }
@@ -153,12 +159,15 @@ const parseBlockContentWithState = (parent, styles, theme, numbering, rels, medi
153
159
  if (localName === "bookmarkStart" || localName === "bookmarkEnd") {
154
160
  const marker = parseBookmarkMarker(child, localName);
155
161
  if (!appendBookmarkMarkerToLastParagraphInBlocks(content, marker)) pendingBookmarkMarkers.push(marker);
162
+ continue;
156
163
  }
164
+ if (isBlockRangeMarker(localName)) pendingRangeMarkers.push(captureVerbatimXml(child));
157
165
  }
158
166
  if (pendingBookmarkMarkers.length > 0) content.push({
159
167
  type: "paragraph",
160
168
  content: [...pendingBookmarkMarkers]
161
169
  });
170
+ attachTrailingRangeMarkers(content, pendingRangeMarkers);
162
171
  return content;
163
172
  };
164
173
  /**
@@ -0,0 +1,36 @@
1
+ //#region src/docx/blockRangeMarkers.d.ts
2
+ /**
3
+ * Range markers that stand between two blocks.
4
+ *
5
+ * `w:body`, `w:tc`, a header and an SDT's content all admit
6
+ * `EG_RunLevelElts` and `EG_RangeMarkupElements` beside their paragraphs, and
7
+ * every block container dropped them: a `w:permStart` between two paragraphs
8
+ * is the whole of a document-protection range, so losing it removes the
9
+ * protection from the saved file without a word. folio models none of these,
10
+ * and their position is their meaning, so they are captured verbatim and
11
+ * replayed where they stood — the same treatment `w:sdt`'s sibling markers
12
+ * already get (MS-OE376 §2.5.2.30).
13
+ *
14
+ * Bookmarks are absent from the set on purpose: they are modelled, and the
15
+ * block containers already relocate them into the neighbouring paragraph.
16
+ */
17
+ declare const isBlockRangeMarker: (localName: string) => boolean;
18
+ /** Hand the markers collected so far to the block they stood before. */
19
+ declare const attachPendingRangeMarkers: (block: {
20
+ rawMarkersBefore?: string;
21
+ }, pending: string[]) => void;
22
+ /**
23
+ * Markers after the last block ride on it, since there is no block after them.
24
+ * With no block at all they are dropped: a container holding markers and no
25
+ * content has nothing for them to delimit.
26
+ */
27
+ declare const attachTrailingRangeMarkers: (blocks: readonly {
28
+ rawMarkersAfter?: string;
29
+ }[], pending: string[]) => void;
30
+ /** Wrap a serialized block in the markup that stood around it. */
31
+ declare const withBlockRangeMarkers: (block: {
32
+ rawMarkersBefore?: string;
33
+ rawMarkersAfter?: string;
34
+ }, xml: string) => string;
35
+ //#endregion
36
+ export { attachPendingRangeMarkers, attachTrailingRangeMarkers, isBlockRangeMarker, withBlockRangeMarkers };
@@ -0,0 +1,59 @@
1
+ //#region src/docx/blockRangeMarkers.ts
2
+ /**
3
+ * Range markers that stand between two blocks.
4
+ *
5
+ * `w:body`, `w:tc`, a header and an SDT's content all admit
6
+ * `EG_RunLevelElts` and `EG_RangeMarkupElements` beside their paragraphs, and
7
+ * every block container dropped them: a `w:permStart` between two paragraphs
8
+ * is the whole of a document-protection range, so losing it removes the
9
+ * protection from the saved file without a word. folio models none of these,
10
+ * and their position is their meaning, so they are captured verbatim and
11
+ * replayed where they stood — the same treatment `w:sdt`'s sibling markers
12
+ * already get (MS-OE376 §2.5.2.30).
13
+ *
14
+ * Bookmarks are absent from the set on purpose: they are modelled, and the
15
+ * block containers already relocate them into the neighbouring paragraph.
16
+ */
17
+ const BLOCK_RANGE_MARKER_NAMES = /* @__PURE__ */ new Set([
18
+ "commentRangeEnd",
19
+ "commentRangeStart",
20
+ "customXmlDelRangeEnd",
21
+ "customXmlDelRangeStart",
22
+ "customXmlInsRangeEnd",
23
+ "customXmlInsRangeStart",
24
+ "customXmlMoveFromRangeEnd",
25
+ "customXmlMoveFromRangeStart",
26
+ "customXmlMoveToRangeEnd",
27
+ "customXmlMoveToRangeStart",
28
+ "moveFromRangeEnd",
29
+ "moveFromRangeStart",
30
+ "moveToRangeEnd",
31
+ "moveToRangeStart",
32
+ "permEnd",
33
+ "permStart"
34
+ ]);
35
+ const isBlockRangeMarker = (localName) => BLOCK_RANGE_MARKER_NAMES.has(localName);
36
+ /** Hand the markers collected so far to the block they stood before. */
37
+ const attachPendingRangeMarkers = (block, pending) => {
38
+ if (pending.length === 0) return;
39
+ block.rawMarkersBefore = pending.join("");
40
+ pending.length = 0;
41
+ };
42
+ /**
43
+ * Markers after the last block ride on it, since there is no block after them.
44
+ * With no block at all they are dropped: a container holding markers and no
45
+ * content has nothing for them to delimit.
46
+ */
47
+ const attachTrailingRangeMarkers = (blocks, pending) => {
48
+ const last = blocks.at(-1);
49
+ if (pending.length === 0 || last === void 0) {
50
+ pending.length = 0;
51
+ return;
52
+ }
53
+ last.rawMarkersAfter = pending.join("");
54
+ pending.length = 0;
55
+ };
56
+ /** Wrap a serialized block in the markup that stood around it. */
57
+ const withBlockRangeMarkers = (block, xml) => `${block.rawMarkersBefore ?? ""}${xml}${block.rawMarkersAfter ?? ""}`;
58
+ //#endregion
59
+ export { attachPendingRangeMarkers, attachTrailingRangeMarkers, isBlockRangeMarker, withBlockRangeMarkers };
@@ -1,27 +1,9 @@
1
1
  import { document_d_exports } from "../types/document.js";
2
2
  import { XmlElement } from "./xmlParser.js";
3
3
  //#region src/docx/bookmarkParser.d.ts
4
- /**
5
- * Parse a bookmark start element (w:bookmarkStart)
6
- *
7
- * Extracts:
8
- * - id: Numeric identifier (required, matches with bookmarkEnd)
9
- * - name: Bookmark name (required, used by hyperlinks)
10
- * - colFirst: First column for table bookmarks (optional)
11
- * - colLast: Last column for table bookmarks (optional)
12
- *
13
- * @param node - The w:bookmarkStart XML element
14
- * @returns Parsed BookmarkStart object
15
- */
4
+ /** Parse a bookmark start element (w:bookmarkStart, CT_Bookmark). */
16
5
  declare function parseBookmarkStart(node: XmlElement): document_d_exports.BookmarkStart;
17
- /**
18
- * Parse a bookmark end element (w:bookmarkEnd)
19
- *
20
- * Bookmark ends only contain an ID that matches the corresponding start marker.
21
- *
22
- * @param node - The w:bookmarkEnd XML element
23
- * @returns Parsed BookmarkEnd object
24
- */
6
+ /** Parse a bookmark end element (w:bookmarkEnd, CT_MarkupRange). */
25
7
  declare function parseBookmarkEnd(node: XmlElement): document_d_exports.BookmarkEnd;
26
8
  /**
27
9
  * Bookmark map for quick lookup by ID or name
@@ -1,41 +1,17 @@
1
- import { getAttribute, parseNumericAttribute } from "./xmlParser.js";
1
+ import { parseBookmarkRangeMarker, parseMarkupRangeMarker } from "./markupRangeMarker.js";
2
2
  //#region src/docx/bookmarkParser.ts
3
- /**
4
- * Parse a bookmark start element (w:bookmarkStart)
5
- *
6
- * Extracts:
7
- * - id: Numeric identifier (required, matches with bookmarkEnd)
8
- * - name: Bookmark name (required, used by hyperlinks)
9
- * - colFirst: First column for table bookmarks (optional)
10
- * - colLast: Last column for table bookmarks (optional)
11
- *
12
- * @param node - The w:bookmarkStart XML element
13
- * @returns Parsed BookmarkStart object
14
- */
3
+ /** Parse a bookmark start element (w:bookmarkStart, CT_Bookmark). */
15
4
  function parseBookmarkStart(node) {
16
- const bookmark = {
5
+ return {
17
6
  type: "bookmarkStart",
18
- id: parseNumericAttribute(node, "w", "id") ?? 0,
19
- name: getAttribute(node, "w", "name") ?? ""
7
+ ...parseBookmarkRangeMarker(node)
20
8
  };
21
- const colFirst = parseNumericAttribute(node, "w", "colFirst");
22
- if (colFirst !== void 0) bookmark.colFirst = colFirst;
23
- const colLast = parseNumericAttribute(node, "w", "colLast");
24
- if (colLast !== void 0) bookmark.colLast = colLast;
25
- return bookmark;
26
9
  }
27
- /**
28
- * Parse a bookmark end element (w:bookmarkEnd)
29
- *
30
- * Bookmark ends only contain an ID that matches the corresponding start marker.
31
- *
32
- * @param node - The w:bookmarkEnd XML element
33
- * @returns Parsed BookmarkEnd object
34
- */
10
+ /** Parse a bookmark end element (w:bookmarkEnd, CT_MarkupRange). */
35
11
  function parseBookmarkEnd(node) {
36
12
  return {
37
13
  type: "bookmarkEnd",
38
- id: parseNumericAttribute(node, "w", "id") ?? 0
14
+ ...parseMarkupRangeMarker(node)
39
15
  };
40
16
  }
41
17
  /**
@@ -0,0 +1,13 @@
1
+ import { document_d_exports } from "../types/document.js";
2
+ import { ParseContext } from "./parseContext.js";
3
+ import { XmlElement } from "./xmlParser.js";
4
+ //#region src/docx/borderParser.d.ts
5
+ /**
6
+ * `w:val` is `use="required"` on `CT_Border`. An element without it states no
7
+ * style at all, so the border is dropped rather than invented as `none`:
8
+ * `none` is an authored token that cancels an inherited border, and a
9
+ * malformed element is not evidence the author wanted that.
10
+ */
11
+ declare function parseBorderSpec(border: XmlElement | null, context?: ParseContext): document_d_exports.BorderSpec | undefined;
12
+ //#endregion
13
+ export { parseBorderSpec };