@stll/folio-core 0.54.2 → 0.56.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 (267) hide show
  1. package/dist/ai-edits/apply.js +185 -33
  2. package/dist/ai-edits/headless.js +3 -2
  3. package/dist/ai-edits/types.d.ts +7 -1
  4. package/dist/compare/compare.js +1 -0
  5. package/dist/compare/content-types.d.ts +3 -15
  6. package/dist/compare/reproducible-package.d.ts +0 -17
  7. package/dist/compare/reproducible-package.js +12 -18
  8. package/dist/controller/canonicalClipboard.d.ts +23 -0
  9. package/dist/controller/canonicalClipboard.js +476 -0
  10. package/dist/controller/canonicalClipboardResources.d.ts +21 -0
  11. package/dist/controller/canonicalClipboardResources.js +382 -0
  12. package/dist/controller/canonicalComposition.d.ts +53 -0
  13. package/dist/controller/canonicalComposition.js +296 -0
  14. package/dist/controller/canonicalInlineProjection.d.ts +113 -0
  15. package/dist/controller/canonicalInlineProjection.js +393 -0
  16. package/dist/controller/canonicalInput.d.ts +54 -0
  17. package/dist/controller/canonicalInput.js +377 -0
  18. package/dist/controller/canonicalInputTimer.d.ts +7 -0
  19. package/dist/controller/canonicalInputTimer.js +11 -0
  20. package/dist/controller/canonicalOperations.d.ts +22 -0
  21. package/dist/controller/canonicalOperations.js +85 -0
  22. package/dist/controller/canonicalPublicOperations.d.ts +48 -0
  23. package/dist/controller/canonicalPublicOperations.js +556 -0
  24. package/dist/controller/canonicalReview.d.ts +12 -0
  25. package/dist/controller/canonicalReview.js +19 -0
  26. package/dist/controller/canonicalSession.d.ts +167 -0
  27. package/dist/controller/canonicalSession.js +1186 -0
  28. package/dist/controller/canonicalStoryEditor.d.ts +36 -0
  29. package/dist/controller/canonicalStoryEditor.js +87 -0
  30. package/dist/controller/canonicalStructure.d.ts +16 -0
  31. package/dist/controller/canonicalStructure.js +322 -0
  32. package/dist/controller/canonicalTocSelection.d.ts +11 -0
  33. package/dist/controller/canonicalTocSelection.js +43 -0
  34. package/dist/controller/folioEditor.d.ts +3 -10
  35. package/dist/controller/folioEditor.js +14 -4
  36. package/dist/controller/headerFooterEditorManager.d.ts +5 -0
  37. package/dist/controller/headerFooterEditorManager.js +72 -3
  38. package/dist/controller/hiddenEditorApi.d.ts +45 -0
  39. package/dist/controller/hiddenEditorApi.js +29 -8
  40. package/dist/controller/hiddenEditorManager.d.ts +13 -2
  41. package/dist/controller/hiddenEditorManager.js +639 -31
  42. package/dist/controller/layoutPipeline.d.ts +1 -1
  43. package/dist/controller/layoutPipeline.js +2 -0
  44. package/dist/controller/noteEditorManager.d.ts +5 -0
  45. package/dist/controller/noteEditorManager.js +114 -15
  46. package/dist/document-operations.d.ts +8 -1
  47. package/dist/document-operations.js +6 -4
  48. package/dist/docx/attributeRemainder.js +1 -0
  49. package/dist/docx/blockPlainText.d.ts +1 -1
  50. package/dist/docx/blockPlainText.js +11 -3
  51. package/dist/docx/canonicalResourceSave.d.ts +16 -0
  52. package/dist/docx/canonicalResourceSave.js +27 -0
  53. package/dist/docx/canonicalSave.d.ts +29 -0
  54. package/dist/docx/canonicalSave.js +101 -0
  55. package/dist/docx/canonicalSessionInput.d.ts +11 -0
  56. package/dist/docx/canonicalSessionInput.js +27 -0
  57. package/dist/docx/canonicalStoryRepack.d.ts +10 -0
  58. package/dist/docx/canonicalStoryRepack.js +74 -0
  59. package/dist/docx/contentTypeRegistry.d.ts +8 -0
  60. package/dist/docx/contentTypeRegistry.js +64 -0
  61. package/dist/docx/documentParser.d.ts +1 -13
  62. package/dist/docx/documentParser.js +1 -47
  63. package/dist/docx/ensureParaIds.d.ts +7 -1
  64. package/dist/docx/ensureParaIds.js +173 -215
  65. package/dist/docx/foldedListNumberFields.d.ts +85 -0
  66. package/dist/docx/foldedListNumberFields.js +267 -0
  67. package/dist/docx/footnoteParser.d.ts +1 -11
  68. package/dist/docx/footnoteParser.js +1 -16
  69. package/dist/docx/headerFooterParser.d.ts +1 -9
  70. package/dist/docx/headerFooterParser.js +1 -12
  71. package/dist/docx/headerFooterVerbatim.d.ts +39 -1
  72. package/dist/docx/headerFooterVerbatim.js +173 -2
  73. package/dist/docx/imageParser.d.ts +13 -1
  74. package/dist/docx/imageParser.js +20 -11
  75. package/dist/docx/metadataPrivacy.js +6 -1
  76. package/dist/docx/noteIds.d.ts +5 -0
  77. package/dist/docx/noteIds.js +6 -2
  78. package/dist/docx/noteReferenceMark.d.ts +3 -1
  79. package/dist/docx/noteReferenceMark.js +15 -14
  80. package/dist/docx/numberingParser.d.ts +3 -1
  81. package/dist/docx/numberingParser.js +17 -3
  82. package/dist/docx/packageParts.d.ts +3 -1
  83. package/dist/docx/packageParts.js +74 -19
  84. package/dist/docx/paragraphMarkPropertyPresence.d.ts +9 -0
  85. package/dist/docx/paragraphMarkPropertyPresence.js +21 -0
  86. package/dist/docx/paragraphParser.js +101 -53
  87. package/dist/docx/paragraphPropertySource.d.ts +15 -1
  88. package/dist/docx/paragraphPropertySource.js +77 -22
  89. package/dist/docx/parser.js +3 -1
  90. package/dist/docx/removeHeaderFooterParts.js +17 -6
  91. package/dist/docx/reviewHistoryNamespace.d.ts +4 -0
  92. package/dist/docx/reviewHistoryNamespace.js +4 -0
  93. package/dist/docx/reviewResolutionProvenance.d.ts +25 -0
  94. package/dist/docx/reviewResolutionProvenance.js +153 -0
  95. package/dist/docx/rezip.d.ts +54 -6
  96. package/dist/docx/rezip.js +835 -257
  97. package/dist/docx/runConsolidator.d.ts +2 -58
  98. package/dist/docx/runConsolidator.js +3 -175
  99. package/dist/docx/runParser.d.ts +2 -1
  100. package/dist/docx/runParser.js +156 -116
  101. package/dist/docx/saveDiagnostics.d.ts +22 -0
  102. package/dist/docx/saveDiagnostics.js +0 -0
  103. package/dist/docx/selectiveSave.d.ts +3 -1
  104. package/dist/docx/selectiveSave.js +36 -4
  105. package/dist/docx/selectiveXmlPatch.d.ts +16 -8
  106. package/dist/docx/selectiveXmlPatch.js +81 -7
  107. package/dist/docx/serializer/documentSerializer.d.ts +9 -2
  108. package/dist/docx/serializer/documentSerializer.js +29 -10
  109. package/dist/docx/serializer/headerFooterSerializer.d.ts +5 -1
  110. package/dist/docx/serializer/headerFooterSerializer.js +19 -11
  111. package/dist/docx/serializer/noteSerializer.d.ts +2 -2
  112. package/dist/docx/serializer/noteSerializer.js +24 -8
  113. package/dist/docx/serializer/paragraphSerializer.js +41 -4
  114. package/dist/docx/serializer/partNamespaces.js +2 -1
  115. package/dist/docx/serializer/runSerializer.js +3 -1
  116. package/dist/docx/server/applyDocxXmlPatchProposal.js +14 -9
  117. package/dist/docx/settingsHeaderFooterUpdate.d.ts +5 -0
  118. package/dist/docx/settingsHeaderFooterUpdate.js +90 -0
  119. package/dist/docx/settingsParser.d.ts +1 -2
  120. package/dist/docx/settingsParser.js +5 -6
  121. package/dist/docx/storyBlockReplay.d.ts +31 -0
  122. package/dist/docx/storyBlockReplay.js +471 -0
  123. package/dist/docx/storyPlainText.d.ts +20 -0
  124. package/dist/docx/storyPlainText.js +23 -0
  125. package/dist/docx/streamingXmlParser.d.ts +22 -1
  126. package/dist/docx/streamingXmlParser.js +49 -3
  127. package/dist/docx/structuralXmlPatch.js +18 -23
  128. package/dist/docx/styleParser.d.ts +5 -1
  129. package/dist/docx/styleParser.js +1 -1
  130. package/dist/docx/tableParser.d.ts +1 -8
  131. package/dist/docx/tableParser.js +1 -28
  132. package/dist/docx/textBoxParser.d.ts +1 -5
  133. package/dist/docx/textBoxParser.js +1 -20
  134. package/dist/docx/unzip.js +6 -1
  135. package/dist/docx/verbatimCapture.d.ts +3 -1
  136. package/dist/docx/verbatimCapture.js +49 -6
  137. package/dist/i18n/messages/ar.gen.d.ts +5 -0
  138. package/dist/i18n/messages/ar.gen.js +656 -0
  139. package/dist/i18n/messages/cs.gen.d.ts +5 -0
  140. package/dist/i18n/messages/cs.gen.js +656 -0
  141. package/dist/i18n/messages/de.gen.d.ts +5 -0
  142. package/dist/i18n/messages/de.gen.js +656 -0
  143. package/dist/i18n/messages/en.gen.d.ts +5 -0
  144. package/dist/i18n/messages/en.gen.js +656 -0
  145. package/dist/i18n/messages/es.gen.d.ts +5 -0
  146. package/dist/i18n/messages/es.gen.js +656 -0
  147. package/dist/i18n/messages/et.gen.d.ts +5 -0
  148. package/dist/i18n/messages/et.gen.js +656 -0
  149. package/dist/i18n/messages/fr.gen.d.ts +5 -0
  150. package/dist/i18n/messages/fr.gen.js +656 -0
  151. package/dist/i18n/messages/he.gen.d.ts +5 -0
  152. package/dist/i18n/messages/he.gen.js +656 -0
  153. package/dist/i18n/messages/hi.gen.d.ts +5 -0
  154. package/dist/i18n/messages/hi.gen.js +656 -0
  155. package/dist/i18n/messages/hu.gen.d.ts +5 -0
  156. package/dist/i18n/messages/hu.gen.js +656 -0
  157. package/dist/i18n/messages/locales.d.ts +5 -0
  158. package/dist/i18n/messages/locales.js +22 -0
  159. package/dist/i18n/messages/lt.gen.d.ts +5 -0
  160. package/dist/i18n/messages/lt.gen.js +656 -0
  161. package/dist/i18n/messages/lv.gen.d.ts +5 -0
  162. package/dist/i18n/messages/lv.gen.js +656 -0
  163. package/dist/i18n/messages/pl.gen.d.ts +5 -0
  164. package/dist/i18n/messages/pl.gen.js +656 -0
  165. package/dist/i18n/messages/pt-BR.gen.d.ts +5 -0
  166. package/dist/i18n/messages/pt-BR.gen.js +656 -0
  167. package/dist/i18n/messages/sk.gen.d.ts +5 -0
  168. package/dist/i18n/messages/sk.gen.js +656 -0
  169. package/dist/i18n/messages/tr.gen.d.ts +5 -0
  170. package/dist/i18n/messages/tr.gen.js +656 -0
  171. package/dist/i18n/messages/zh-CN.gen.d.ts +5 -0
  172. package/dist/i18n/messages/zh-CN.gen.js +656 -0
  173. package/dist/i18n/messages.d.ts +2 -3
  174. package/dist/i18n/messages.js +1 -19
  175. package/dist/internal/acceptedBlockProjection.d.ts +12 -0
  176. package/dist/internal/acceptedBlockProjection.js +45 -0
  177. package/dist/internal/noteMarkerAttrs.d.ts +8 -0
  178. package/dist/internal/noteMarkerAttrs.js +16 -0
  179. package/dist/internal/pageBreakRunSourceDescendantIndex.js +1 -0
  180. package/dist/internal/prosemirrorAttrBoundary.d.ts +21 -0
  181. package/dist/internal/prosemirrorAttrBoundary.js +50 -0
  182. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  183. package/dist/layout-bridge/convert/footnoteLayout.js +3 -3
  184. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  185. package/dist/layout-bridge/convert/headerFooterLayout.js +1 -0
  186. package/dist/layout-bridge/convert/noteReferences.d.ts +1 -3
  187. package/dist/layout-bridge/convert/noteReferences.js +1 -6
  188. package/dist/layout-bridge/convert/paragraphRuns.js +2 -4
  189. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +2 -2
  190. package/dist/layout-bridge/convert/toFlowBlocks.js +2 -2
  191. package/dist/managers/DocumentLoaderManager.d.ts +1 -0
  192. package/dist/managers/DocumentLoaderManager.js +9 -1
  193. package/dist/markdown/escape.d.ts +3 -1
  194. package/dist/markdown/escape.js +9 -2
  195. package/dist/markdown/renderBlock.js +20 -121
  196. package/dist/markdown/renderParagraph.js +13 -15
  197. package/dist/markdown/renderRuns.d.ts +7 -1
  198. package/dist/markdown/renderRuns.js +35 -15
  199. package/dist/markdown/renderTable.js +2 -0
  200. package/dist/markdown/types.d.ts +3 -9
  201. package/dist/prosemirror/attrs/index.d.ts +2 -12
  202. package/dist/prosemirror/attrs/index.js +22 -48
  203. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +2 -1
  204. package/dist/prosemirror/canonicalCommands.d.ts +121 -0
  205. package/dist/prosemirror/canonicalCommands.js +35 -0
  206. package/dist/prosemirror/canonicalSelectionRange.d.ts +9 -0
  207. package/dist/prosemirror/canonicalSelectionRange.js +15 -0
  208. package/dist/prosemirror/clipboardIntent.d.ts +7 -0
  209. package/dist/prosemirror/clipboardIntent.js +9 -0
  210. package/dist/prosemirror/commands/pageBreak.js +15 -1
  211. package/dist/prosemirror/commands/pastePlainText.js +2 -1
  212. package/dist/prosemirror/commentReferenceAttrs.d.ts +2 -1
  213. package/dist/prosemirror/conversion/fromProseDoc.js +91 -19
  214. package/dist/prosemirror/conversion/hyphenTextCarriers.d.ts +8 -0
  215. package/dist/prosemirror/conversion/hyphenTextCarriers.js +8 -0
  216. package/dist/prosemirror/conversion/listRenderingDefinition.d.ts +6 -0
  217. package/dist/prosemirror/conversion/listRenderingDefinition.js +97 -0
  218. package/dist/prosemirror/conversion/toProseDoc.d.ts +11 -4
  219. package/dist/prosemirror/conversion/toProseDoc.js +55 -14
  220. package/dist/prosemirror/executeEditorCommand.d.ts +11 -0
  221. package/dist/prosemirror/executeEditorCommand.js +26 -0
  222. package/dist/prosemirror/extensions/StarterKit.js +2 -0
  223. package/dist/prosemirror/extensions/core/ParagraphExtension.js +88 -48
  224. package/dist/prosemirror/extensions/features/ListExtension.js +18 -5
  225. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +5 -2
  226. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +13 -1
  227. package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +56 -28
  228. package/dist/prosemirror/extensions/marks/TextColorExtension.js +3 -2
  229. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -0
  230. package/dist/prosemirror/extensions/marks/markUtils.js +72 -8
  231. package/dist/prosemirror/extensions/nodes/NoteMarkerExtension.d.ts +6 -0
  232. package/dist/prosemirror/extensions/nodes/NoteMarkerExtension.js +36 -0
  233. package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +4 -2
  234. package/dist/prosemirror/insertOperations.js +2 -1
  235. package/dist/prosemirror/listMarker.d.ts +1 -0
  236. package/dist/prosemirror/listMarker.js +16 -7
  237. package/dist/prosemirror/listNumbering.js +26 -5
  238. package/dist/prosemirror/listRenderingAttrs.d.ts +1 -0
  239. package/dist/prosemirror/listRenderingAttrs.js +3 -0
  240. package/dist/prosemirror/markupViewNotes.js +3 -2
  241. package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +2 -1
  242. package/dist/prosemirror/noteReferenceReview.js +5 -3
  243. package/dist/prosemirror/paragraphPropertyCarry.d.ts +7 -1
  244. package/dist/prosemirror/paragraphPropertyCarry.js +8 -3
  245. package/dist/prosemirror/plugins/suggestionMode.js +57 -7
  246. package/dist/prosemirror/rangeAnchorAttrs.d.ts +2 -1
  247. package/dist/prosemirror/runFormattingFromMarks.d.ts +4 -1
  248. package/dist/prosemirror/runFormattingFromMarks.js +15 -1
  249. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -1
  250. package/dist/prosemirror/runFormattingInlineCarriers.js +4 -1
  251. package/dist/prosemirror/schema/marks.d.ts +2 -0
  252. package/dist/prosemirror/schema/nodes.d.ts +10 -2
  253. package/dist/prosemirror/textBoxAnchorAttrs.d.ts +2 -1
  254. package/dist/prosemirror/textInput.js +5 -1
  255. package/dist/prosemirror/trackedRevisionPath.js +2 -1
  256. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +1 -0
  257. package/dist/prosemirror/trackedRunInlineAtoms.js +1 -0
  258. package/dist/prosemirror/validation.js +4 -0
  259. package/dist/types/canonicalCapabilities.d.ts +215 -0
  260. package/dist/types/canonicalCapabilities.js +212 -0
  261. package/dist/types/canonicalSave.d.ts +11 -0
  262. package/dist/types/canonicalSave.js +0 -0
  263. package/dist/types/content.d.ts +2 -2
  264. package/dist/types/docxSerialization.d.ts +14 -0
  265. package/dist/types/docxSerialization.js +7 -0
  266. package/dist/utils/createDocument.js +2 -2
  267. package/package.json +16 -4
@@ -17,7 +17,7 @@ import { directParagraphAlignment } from "../prosemirror/paragraphAlignment.js";
17
17
  import { styleResolvedParagraphFormatting } from "../prosemirror/paragraphFormattingProvenance.js";
18
18
  import { directParagraphIndentation, paragraphIndentationAttrPatch, paragraphIndentationEqual, paragraphIndentationFromFormatting, withDirectParagraphIndentation } from "../prosemirror/paragraphIndentation.js";
19
19
  import { joinAtParagraphMark } from "../prosemirror/paragraphMarkJoin.js";
20
- import { carryParagraphProperties, paragraphLeftAfter, propertiesSetInBatch, recordReplacedParagraphProperties } from "../prosemirror/paragraphPropertyCarry.js";
20
+ import { carriedParagraphProperties, carryParagraphProperties, paragraphLeftAfter, propertiesSetInBatch, recordReplacedParagraphProperties } from "../prosemirror/paragraphPropertyCarry.js";
21
21
  import { directParagraphSpacing, paragraphSpacingAttrPatch, paragraphSpacingEqual, paragraphSpacingFromFormatting, withDirectParagraphSpacing } from "../prosemirror/paragraphSpacing.js";
22
22
  import { getDocumentNumbering, getDocumentNumberingInstanceIds } from "../prosemirror/plugins/documentNumbering.js";
23
23
  import { getDocumentStyleDefinitions, getDocumentStyleResolver } from "../prosemirror/plugins/documentStyleState.js";
@@ -33,6 +33,7 @@ import { listAttrsFromNumbering, listLevelAttrPatch } from "../prosemirror/style
33
33
  import { removeRowsWithoutCellsAfterBatch } from "../prosemirror/tableGridMutation.js";
34
34
  import { isZeroWidthAnchor } from "../prosemirror/zeroWidthAnchors.js";
35
35
  import { getFolioParaIdFromBlockId } from "../types/block-id.js";
36
+ import { CANONICAL_GAP } from "../types/canonicalCapabilities.js";
36
37
  import { BatchClaims } from "./batch-claims.js";
37
38
  import { stripBlockIdentityAttrs } from "./block-identity.js";
38
39
  import { describeCharacterSplit } from "./character-boundaries.js";
@@ -436,6 +437,10 @@ const preserveRunFormattingAcrossTrackedStyleChange = ({ allocateRevisionInfo, n
436
437
  revisionIds
437
438
  };
438
439
  };
440
+ const appendParagraphPropertyChange = (existing, change) => {
441
+ if (change.info.provenance !== "suggested" && hasSerializableParagraphPropertyChange(existing)) panic("A paragraph-property write must resolve its occupied revision slot first");
442
+ return [...existing ?? [], change];
443
+ };
439
444
  /**
440
445
  * Apply one paragraph-property patch to a live node. A tracked patch stores
441
446
  * the complete previous pPr: a partial snapshot cannot distinguish a property
@@ -482,7 +487,7 @@ const applyBlockParagraphProperties = ({ tr, position, node, properties, styleRe
482
487
  const nextAttrs = {
483
488
  ...node.attrs,
484
489
  ...patch,
485
- ...change ? { _propertyChanges: [...Array.isArray(existing) ? existing : [], change] } : {}
490
+ ...change ? { _propertyChanges: appendParagraphPropertyChange(existing, change) } : {}
486
491
  };
487
492
  const bridgeResult = preserveRunFormatting && revisionInfo ? preserveRunFormattingAcrossTrackedStyleChange({
488
493
  allocateRevisionInfo: revisionInfo,
@@ -560,7 +565,7 @@ const applyReplaceBlockStyleId = ({ item, tr, styleResolver, revisionInfo }) =>
560
565
  const nextAttrs = {
561
566
  ...block.attrs,
562
567
  ...patch,
563
- ...change ? { _propertyChanges: [...Array.isArray(existing) ? existing : [], change] } : {}
568
+ ...change ? { _propertyChanges: appendParagraphPropertyChange(existing, change) } : {}
564
569
  };
565
570
  const bridgeResult = preserveRunFormatting && revisionInfo ? preserveRunFormattingAcrossTrackedStyleChange({
566
571
  allocateRevisionInfo: revisionInfo,
@@ -1280,6 +1285,11 @@ const isInsertedPPrMark = (value) => typeof value === "object" && value !== null
1280
1285
  const isSuggestedParagraphInsert = (paragraph) => typeof paragraph.attrs["_suggestedInsert"] === "object" && paragraph.attrs["_suggestedInsert"] !== null;
1281
1286
  /** A paragraph mark that is a pending deletion, or a relocation's source. */
1282
1287
  const isDeletedPPrMark = (value) => typeof value === "object" && value !== null && "kind" in value && (value.kind === "del" || value.kind === "moveFrom");
1288
+ const pendingParagraphMarkPropertyRefusal = {
1289
+ reason: "pendingParagraphMarkDeletion",
1290
+ canonicalRefusal: { gap: CANONICAL_GAP.publicPendingParagraphMarkProperties },
1291
+ message: "Resolve the pending paragraph mark deletion before editing its properties, or provide mergedParagraphProperties on the merge operation for atomic intent."
1292
+ };
1283
1293
  const hasRevisionMarker = (value) => typeof value === "object" && value !== null && "revisionId" in value;
1284
1294
  const isDeletedCell = (cell) => {
1285
1295
  const marker = cell.attrs["cellMarker"];
@@ -1485,6 +1495,26 @@ const finalParagraphPredecessor = (doc, at) => {
1485
1495
  }
1486
1496
  return null;
1487
1497
  };
1498
+ /**
1499
+ * Whether a sibling between a final carrier's predecessor and the carrier
1500
+ * has its break deleted by this batch.
1501
+ */
1502
+ const crossesBatchDeletion = ({ doc, from, to, batchRevisionIds }) => {
1503
+ const $to = doc.resolve(to);
1504
+ let position = to;
1505
+ for (let index = $to.index() - 1; index >= 0 && position > from; index--) {
1506
+ const node = $to.parent.child(index);
1507
+ position -= node.nodeSize;
1508
+ const mark = node.attrs["pPrMark"];
1509
+ const revisionId = isPlainDeletedPPrMark(mark) ? addedOrDeletedBreakRevisionId(mark) : null;
1510
+ if (revisionId !== null && batchRevisionIds.has(revisionId)) return true;
1511
+ }
1512
+ return false;
1513
+ };
1514
+ const canRetractFinalBreak = ({ predecessor, target }) => {
1515
+ if (target.type !== predecessor.type) return false;
1516
+ return !(JSON.stringify(paragraphPropertiesBeforePendingChanges(target)) !== JSON.stringify(paragraphPropertiesSnapshot(predecessor)) && hasSerializableParagraphPropertyChange(expectParagraphAttrs(predecessor)._propertyChanges));
1517
+ };
1488
1518
  /** Pending retirements, read after the merge has mapped any inserted separator. */
1489
1519
  const pendingRemovedFinalBreakPositions = (tr, deletions) => {
1490
1520
  const positions = /* @__PURE__ */ new Set();
@@ -1496,6 +1526,92 @@ const pendingRemovedFinalBreakPositions = (tr, deletions) => {
1496
1526
  }
1497
1527
  return positions;
1498
1528
  };
1529
+ /** An unoccupied final carrier takes admissible writes from the finished batch. */
1530
+ const finalParagraphCarry = ({ tr, at, target, predecessor, batchRevisionIds, styleResolver, numbering }) => {
1531
+ const { node: previous, position } = predecessor;
1532
+ const beforeBatch = hasSerializableParagraphPropertyChange(expectParagraphAttrs(target)._propertyChanges) ? resolveParagraphChangeAttrs({
1533
+ node: previous,
1534
+ mode: "reject",
1535
+ boundaryCovered: true,
1536
+ revisionSet: batchRevisionIds,
1537
+ styleResolver,
1538
+ numbering
1539
+ }) : null;
1540
+ return {
1541
+ source: beforeBatch ? previous.type.create(beforeBatch, previous.content, previous.marks) : previous,
1542
+ keep: crossesBatchDeletion({
1543
+ doc: tr.doc,
1544
+ from: position + previous.nodeSize,
1545
+ to: at,
1546
+ batchRevisionIds
1547
+ }) ? /* @__PURE__ */ new Set() : propertiesSetInBatch(target, batchRevisionIds)
1548
+ };
1549
+ };
1550
+ /** Deferred retirement still owns a slot before a later explicit formatting merge. */
1551
+ const hasDeferredParagraphPropertyWrite = ({ tr, deletions, targets, mergedPropertyTargets, batchRevisionIds, styleResolver, numbering }) => {
1552
+ for (const deletion of deletions) {
1553
+ const at = tr.mapping.slice(deletion.mappedFrom).map(deletion.position);
1554
+ const target = tr.doc.nodeAt(at);
1555
+ if (!target) continue;
1556
+ const predecessor = finalParagraphPredecessor(tr.doc, at);
1557
+ if (!predecessor) continue;
1558
+ const mark = predecessor.node.attrs["pPrMark"];
1559
+ if (mark == null && mergedPropertyTargets.some(({ position, mappedFrom }) => {
1560
+ const mapped = tr.mapping.slice(mappedFrom).mapResult(position);
1561
+ return !mapped.deleted && mapped.pos === at;
1562
+ })) continue;
1563
+ const writeTarget = mark == null ? target : tr.doc.nodeAt(predecessor.position + predecessor.node.nodeSize);
1564
+ if (!writeTarget || !targets.includes(writeTarget)) continue;
1565
+ if (mark != null && !(isInsertedPPrMark(mark) && canRetractFinalBreak({
1566
+ predecessor: predecessor.node,
1567
+ target: writeTarget
1568
+ }))) continue;
1569
+ const transfer = mark == null ? finalParagraphCarry({
1570
+ tr,
1571
+ at,
1572
+ target,
1573
+ predecessor,
1574
+ batchRevisionIds,
1575
+ styleResolver,
1576
+ numbering
1577
+ }) : {
1578
+ source: predecessor.node,
1579
+ keep: propertiesSetInBatch(writeTarget, batchRevisionIds)
1580
+ };
1581
+ if (JSON.stringify(paragraphPropertiesSnapshot(writeTarget)) !== JSON.stringify(carriedParagraphProperties({
1582
+ ...transfer,
1583
+ target: writeTarget
1584
+ }))) return true;
1585
+ }
1586
+ return false;
1587
+ };
1588
+ /** The paragraph a merge leaves owns its properties, even across pending deleted breaks. */
1589
+ const paragraphPropertyRevisionTargets = ({ item, tr, deletedFinalParagraphs }) => {
1590
+ const position = tr.mapping.map(item.blockFrom, item.operation.type === "replaceBlock" ? -1 : 1);
1591
+ const source = tr.doc.nodeAt(position) ?? item.blockNode;
1592
+ const targets = source.type.name === "paragraph" ? [source] : [];
1593
+ if (item.operation.type !== "mergeBlockWithNext") return targets;
1594
+ const removedBreakPositions = pendingRemovedFinalBreakPositions(tr, deletedFinalParagraphs);
1595
+ for (const deletion of deletedFinalParagraphs) {
1596
+ const at = tr.mapping.slice(deletion.mappedFrom).map(deletion.position);
1597
+ const predecessor = finalParagraphPredecessor(tr.doc, at);
1598
+ if (!predecessor || !isInsertedPPrMark(predecessor.node.attrs["pPrMark"])) continue;
1599
+ const target = tr.doc.nodeAt(predecessor.position + predecessor.node.nodeSize);
1600
+ if (!target) continue;
1601
+ if (canRetractFinalBreak({
1602
+ predecessor: predecessor.node,
1603
+ target
1604
+ })) removedBreakPositions.add(predecessor.position);
1605
+ }
1606
+ const survivorPosition = paragraphLeftAfter({
1607
+ doc: tr.doc,
1608
+ paragraphPos: position,
1609
+ removedBreakPositions
1610
+ });
1611
+ const survivor = survivorPosition === null ? null : tr.doc.nodeAt(survivorPosition);
1612
+ if (survivor?.type.name === "paragraph") targets.push(survivor);
1613
+ return targets;
1614
+ };
1499
1615
  /**
1500
1616
  * Finish the tracked deletion of every paragraph a container ends with.
1501
1617
  *
@@ -1546,21 +1662,21 @@ const withRetiredFinalParagraphs = ({ tr, deletions, mergedPropertyTargets, appl
1546
1662
  ...revisionExtras
1547
1663
  }
1548
1664
  });
1549
- const beforeBatch = resolveParagraphChangeAttrs({
1550
- node: previous,
1551
- mode: "reject",
1552
- boundaryCovered: true,
1553
- revisionSet: batchRevisionIds,
1554
- styleResolver,
1555
- numbering
1556
- });
1557
1665
  if (!mergedPropertyTargets.some(({ position: target, mappedFrom }) => {
1558
1666
  const mapped = tr.mapping.slice(mappedFrom).mapResult(target);
1559
1667
  return !mapped.deleted && mapped.pos === at;
1560
1668
  })) carryParagraphProperties({
1561
1669
  tr,
1562
1670
  position: at,
1563
- source: beforeBatch ? previous.type.create(beforeBatch, previous.content, previous.marks) : previous,
1671
+ ...finalParagraphCarry({
1672
+ tr,
1673
+ at,
1674
+ target: emptied,
1675
+ predecessor,
1676
+ batchRevisionIds,
1677
+ styleResolver,
1678
+ numbering
1679
+ }),
1564
1680
  styleResolver,
1565
1681
  numbering,
1566
1682
  revision: {
@@ -1568,8 +1684,7 @@ const withRetiredFinalParagraphs = ({ tr, deletions, mergedPropertyTargets, appl
1568
1684
  author,
1569
1685
  date,
1570
1686
  ...revisionExtras
1571
- },
1572
- keep: propertiesSetInBatch(emptied, batchRevisionIds)
1687
+ }
1573
1688
  });
1574
1689
  resolvedOperationIds.add(operationId);
1575
1690
  addedRevisions.push({
@@ -1580,11 +1695,10 @@ const withRetiredFinalParagraphs = ({ tr, deletions, mergedPropertyTargets, appl
1580
1695
  }
1581
1696
  if (isInsertedPPrMark(mark)) {
1582
1697
  const following = tr.doc.nodeAt(position + previous.nodeSize);
1583
- if (following?.type.name !== emptied.type.name) continue;
1584
- const previousFormatting = paragraphPropertiesBeforePendingChanges(following);
1585
- const formattingChanges = JSON.stringify(previousFormatting) !== JSON.stringify(paragraphPropertiesSnapshot(previous));
1586
- const existing = expectParagraphAttrs(previous)._propertyChanges;
1587
- if (formattingChanges && hasSerializableParagraphPropertyChange(existing)) continue;
1698
+ if (!following || !canRetractFinalBreak({
1699
+ predecessor: previous,
1700
+ target: following
1701
+ })) continue;
1588
1702
  joinAtParagraphMark({
1589
1703
  tr,
1590
1704
  paragraphPos: position,
@@ -2127,6 +2241,7 @@ const applyFolioAIEditOperationsInternal = ({ view, snapshot, operations: reques
2127
2241
  skipped.push({
2128
2242
  id: operation.id,
2129
2243
  reason: resolution.reason,
2244
+ ...resolution.canonicalRefusal !== void 0 && { canonicalRefusal: resolution.canonicalRefusal },
2130
2245
  ...resolution.message !== void 0 && { message: resolution.message }
2131
2246
  });
2132
2247
  continue;
@@ -2323,9 +2438,22 @@ const applyFolioAIEditOperationsInternal = ({ view, snapshot, operations: reques
2323
2438
  if (!item) panic("The operation execution index exceeded the resolved plan", { executionIndex });
2324
2439
  continueSharedRevisionIds();
2325
2440
  if (mode === "tracked-changes" && writesParagraphPropertyChange(item)) {
2326
- const livePosition = tr.mapping.map(item.blockFrom);
2327
- const liveBlock = tr.doc.nodeAt(livePosition) ?? item.blockNode;
2328
- if (hasSerializableParagraphPropertyChange(liveBlock.type.name === "paragraph" ? expectParagraphAttrs(liveBlock)._propertyChanges : void 0)) {
2441
+ const appliedIds = new Set(applied.map(({ id }) => id));
2442
+ const pendingDeletions = deletedFinalParagraphs.filter(({ operationId }) => appliedIds.has(operationId));
2443
+ const targets = paragraphPropertyRevisionTargets({
2444
+ item,
2445
+ tr,
2446
+ deletedFinalParagraphs: pendingDeletions
2447
+ });
2448
+ if (targets.some((target) => hasSerializableParagraphPropertyChange(expectParagraphAttrs(target)._propertyChanges)) || item.operation.type === "mergeBlockWithNext" && hasDeferredParagraphPropertyWrite({
2449
+ tr,
2450
+ deletions: pendingDeletions,
2451
+ targets,
2452
+ mergedPropertyTargets,
2453
+ batchRevisionIds: new Set(applied.flatMap(({ revisionIds }) => revisionIds ?? [])),
2454
+ styleResolver,
2455
+ numbering
2456
+ })) {
2329
2457
  skipped.push({
2330
2458
  id: item.operation.id,
2331
2459
  reason: "pendingParagraphPropertyChange"
@@ -2559,6 +2687,13 @@ const applyFolioAIEditOperationsInternal = ({ view, snapshot, operations: reques
2559
2687
  case "replaceBlock": {
2560
2688
  if (!isResolvedReplaceBlockOperation(item)) panic("Resolved replaceBlock operation lost its impact discriminator");
2561
2689
  const { changesStyle, changesText } = REPLACE_BLOCK_IMPACT[item.replaceBlockImpact];
2690
+ if (changesStyle && isDeletedPPrMark(tr.doc.nodeAt(tr.mapping.map(item.blockFrom, -1))?.attrs["pPrMark"])) {
2691
+ skipped.push({
2692
+ id: item.operation.id,
2693
+ ...pendingParagraphMarkPropertyRefusal
2694
+ });
2695
+ continue;
2696
+ }
2562
2697
  const revisionIdDelete = operationRevisionSeed;
2563
2698
  const revisionIdInsert = changesText ? operationRevisionSeed + 1 : operationRevisionSeed;
2564
2699
  const revisionIdBackgroundSeed = changesText ? operationRevisionSeed + 2 : operationRevisionSeed;
@@ -3291,6 +3426,13 @@ const applyFolioAIEditOperationsInternal = ({ view, snapshot, operations: reques
3291
3426
  continue;
3292
3427
  }
3293
3428
  const blockPosition = mapped.pos;
3429
+ if (isDeletedPPrMark(liveBlock.attrs["pPrMark"])) {
3430
+ skipped.push({
3431
+ id: item.operation.id,
3432
+ ...pendingParagraphMarkPropertyRefusal
3433
+ });
3434
+ continue;
3435
+ }
3294
3436
  const appliedProperties = applyBlockParagraphProperties({
3295
3437
  tr,
3296
3438
  position: blockPosition,
@@ -4868,17 +5010,23 @@ const resolveOperationTarget = ({ snapshot, operation, liveBlocks, liveBlocksByP
4868
5010
  }
4869
5011
  };
4870
5012
  }
4871
- if (operation.type === "setBlockParagraphProperties") return {
4872
- type: "resolved",
4873
- operation: {
4874
- operation,
4875
- from: blockFrom,
4876
- to: blockTo,
4877
- blockFrom,
4878
- blockTo,
4879
- blockNode
4880
- }
4881
- };
5013
+ if (operation.type === "setBlockParagraphProperties") {
5014
+ if (isDeletedPPrMark(blockNode.attrs["pPrMark"])) return {
5015
+ type: "skip",
5016
+ ...pendingParagraphMarkPropertyRefusal
5017
+ };
5018
+ return {
5019
+ type: "resolved",
5020
+ operation: {
5021
+ operation,
5022
+ from: blockFrom,
5023
+ to: blockTo,
5024
+ blockFrom,
5025
+ blockTo,
5026
+ blockNode
5027
+ }
5028
+ };
5029
+ }
4882
5030
  if (operation.type === "splitBlock") {
4883
5031
  const separator = operation.separator ?? "";
4884
5032
  const startOffset = operation.offset;
@@ -4944,6 +5092,10 @@ const resolveOperationTarget = ({ snapshot, operation, liveBlocks, liveBlocksByP
4944
5092
  if (operation.type === "deleteBlock" || operation.type === "replaceBlock") {
4945
5093
  const replaceChangesText = operation.type === "replaceBlock" && operation.text !== currentText;
4946
5094
  const replaceChangesStyle = operation.type === "replaceBlock" && operation.styleId !== void 0 && operation.styleId !== (expectParagraphAttrs(blockNode).styleId ?? null);
5095
+ if (replaceChangesStyle && isDeletedPPrMark(blockNode.attrs["pPrMark"])) return {
5096
+ type: "skip",
5097
+ ...pendingParagraphMarkPropertyRefusal
5098
+ };
4947
5099
  if (replaceChangesText && cleanBlock.structuralBoundaries.some((boundary) => boundary.type !== "field" && boundary.type !== "noteReference")) return {
4948
5100
  type: "skip",
4949
5101
  reason: "unsupportedBlock"
@@ -5,8 +5,7 @@ import { importReferencedStyleDefinitions } from "../compare/style-resources.js"
5
5
  import { applyFolioDocumentOperations } from "../document-operations.js";
6
6
  import { applyReplyThreadMarkers } from "../docx/commentReplyMarkers.js";
7
7
  import { rebindDrawingImageRelationship } from "../docx/drawingRelationships.js";
8
- import { getEndnoteText, getFootnoteText, isSeparatorEndnote, isSeparatorFootnote } from "../docx/footnoteParser.js";
9
- import { getHeaderFooterText } from "../docx/headerFooterParser.js";
8
+ import { isSeparatorEndnote, isSeparatorFootnote } from "../docx/footnoteParser.js";
10
9
  import { createNumberingIdAllocator } from "../docx/numberingIds.js";
11
10
  import { getCachedNumberingMap } from "../docx/numberingParser.js";
12
11
  import { recreateProseNodeWithParagraphPropertySource, transferProseParagraphPropertySource } from "../docx/paragraphPropertySource.js";
@@ -15,6 +14,7 @@ import { createReply } from "../docx/replyToComment.js";
15
14
  import { repackDocx } from "../docx/rezip.js";
16
15
  import { sectionReferenceHistory } from "../docx/sectionReferenceHistory.js";
17
16
  import { attemptSelectiveSave } from "../docx/selectiveSave.js";
17
+ import { getEndnoteText, getFootnoteText, getHeaderFooterText } from "../docx/storyPlainText.js";
18
18
  import { pluginsForHeadlessRevisionResolution } from "../internal/headlessRevisionResolutionGuard.js";
19
19
  import { withTrackedSectionEndpointRemoval } from "../internal/sectionEndpointResolution.js";
20
20
  import { captureSectionReferenceInventory, resolvedSectionReferenceLosses, withSectionReferenceResolution } from "../internal/sectionReferenceResolution.js";
@@ -1895,6 +1895,7 @@ var FolioDocxReviewer = class FolioDocxReviewer {
1895
1895
  const source = story.type === "header" || story.type === "footer" ? this.getHeaderFooterStory(story) : this.getNoteStory(story);
1896
1896
  if (!source) return null;
1897
1897
  const conversionOptions = {
1898
+ ...this.baseDocument.package.numbering !== void 0 && { numbering: this.baseDocument.package.numbering },
1898
1899
  ...this.baseDocument.package.styles !== void 0 && { styles: this.baseDocument.package.styles },
1899
1900
  ...this.baseDocument.package.theme !== void 0 && { theme: this.baseDocument.package.theme }
1900
1901
  };
@@ -1,4 +1,5 @@
1
1
  import { document_d_exports } from "../types/document.js";
2
+ import { CanonicalGap } from "../types/canonicalCapabilities.js";
2
3
  import { FolioContentBlock, FolioContentInlineBooleanProperty, FolioContentInlineFormatting, FolioContentInlineFormattingPatch, FolioContentListReference, FolioContentParagraphIndentation, FolioContentParagraphKind, FolioContentParagraphSpacing, FolioContentRun, FolioContentSnapshot, FolioContentTableLocation } from "../compare/content-types.js";
3
4
  import { ListKind } from "../docx/listNumberingInstances.js";
4
5
  //#region src/ai-edits/types.d.ts
@@ -656,7 +657,9 @@ type FolioAIEditSkipReason = "missingBlock" | "changedBlock" | "ambiguousFind" |
656
657
  * deletion is accepted. Reject that deletion first, or insert a new block
657
658
  * next to it.
658
659
  */
659
- "pendingDeletion";
660
+ "pendingDeletion" |
661
+ /** Resolve the removed paragraph mark before editing its properties separately. */
662
+ "pendingParagraphMarkDeletion";
660
663
  type FolioAIEditAppliedOperation = {
661
664
  id: string;
662
665
  commentId?: number;
@@ -689,6 +692,9 @@ type FolioAIEditAppliedOperation = {
689
692
  type FolioAIEditSkippedOperation = {
690
693
  id: string;
691
694
  reason: FolioAIEditSkipReason;
695
+ canonicalRefusal?: {
696
+ gap: CanonicalGap;
697
+ };
692
698
  /**
693
699
  * What exactly was wrong when the reason alone does not say: the values a
694
700
  * `payloadDoesNotFit` skip could not place, the earlier operation an
@@ -486,6 +486,7 @@ const COMPARE_SKIP_DISPOSITION = {
486
486
  staleRange: "fatal",
487
487
  emptyOperation: "unwritable",
488
488
  pendingParagraphPropertyChange: "unwritable",
489
+ pendingParagraphMarkDeletion: "unwritable",
489
490
  pendingRunPropertyChange: "unwritable",
490
491
  noopOperation: "unwritable",
491
492
  documentVersionMismatch: "fatal",
@@ -83,14 +83,9 @@ type FolioContentTableLocation = {
83
83
  */
84
84
  type FolioContentParagraphAlignment = document_d_exports.ParagraphAlignment;
85
85
  /** Line-height interpretation understood by the neutral comparison model. */
86
- type FolioContentLineSpacingRule = "auto" | "exact" | "atLeast";
86
+ type FolioContentLineSpacingRule = NonNullable<document_d_exports.ParagraphFormatting["lineSpacingRule"]>;
87
87
  /** The complete modeled attribute set of direct paragraph indentation. */
88
- type FolioContentParagraphIndentation = {
89
- indentLeft?: number;
90
- indentRight?: number;
91
- indentFirstLine?: number;
92
- hangingIndent?: boolean;
93
- };
88
+ type FolioContentParagraphIndentation = Pick<document_d_exports.ParagraphFormatting, "indentLeft" | "indentRight" | "indentFirstLine" | "hangingIndent">;
94
89
  /** A concrete numbering instance and its zero-based level. */
95
90
  type FolioContentListReference = {
96
91
  numId: number;
@@ -100,14 +95,7 @@ type FolioContentListReference = {
100
95
  * The complete modeled attribute set of direct paragraph spacing. Optional
101
96
  * fields distinguish an absent attribute from an explicit zero or false value.
102
97
  */
103
- type FolioContentParagraphSpacing = {
104
- spaceBefore?: number;
105
- spaceAfter?: number;
106
- lineSpacing?: number;
107
- lineSpacingRule?: FolioContentLineSpacingRule;
108
- beforeAutospacing?: boolean;
109
- afterAutospacing?: boolean;
110
- };
98
+ type FolioContentParagraphSpacing = Pick<document_d_exports.ParagraphFormatting, "spaceBefore" | "spaceAfter" | "lineSpacing" | "lineSpacingRule" | "beforeAutospacing" | "afterAutospacing">;
111
99
  /** A representation-neutral block in one ordered document story. */
112
100
  type FolioContentBlock<Kind extends string = string> = {
113
101
  id: string;
@@ -1,21 +1,4 @@
1
1
  //#region src/compare/reproducible-package.d.ts
2
- /**
3
- * The last two clocks in the compare path are outside the document body.
4
- *
5
- * Every part the serializer rewrites is stored with JSZip's default entry
6
- * date, which is `new Date()`. The XML is identical between two runs, but the
7
- * DOS timestamp fields in the local headers are not, and they only agree when
8
- * both runs land in the same two-second bucket — so the packages match most of
9
- * the time and differ occasionally, which is worse than differing always.
10
- *
11
- * The save also stamps `dcterms:modified` in `docProps/core.xml` from the wall
12
- * clock, which is the same failure one part deeper: two runs over identical
13
- * inputs differ in that part alone.
14
- *
15
- * Restamping both from the comparison's own timestamp removes them. It also
16
- * states the truth about the package: a generated redline is dated by the
17
- * comparison that produced it, not by the second it happened to be written.
18
- */
19
2
  declare const withFixedPackageDates: (buffer: ArrayBuffer, date: Date) => Promise<ArrayBuffer>;
20
3
  //#endregion
21
4
  export { withFixedPackageDates };
@@ -1,21 +1,10 @@
1
+ import { writeZipPart } from "@stll/docx-core/zip";
1
2
  import JSZip from "jszip";
2
3
  //#region src/compare/reproducible-package.ts
3
4
  /**
4
- * The last two clocks in the compare path are outside the document body.
5
- *
6
- * Every part the serializer rewrites is stored with JSZip's default entry
7
- * date, which is `new Date()`. The XML is identical between two runs, but the
8
- * DOS timestamp fields in the local headers are not, and they only agree when
9
- * both runs land in the same two-second bucket — so the packages match most of
10
- * the time and differ occasionally, which is worse than differing always.
11
- *
12
- * The save also stamps `dcterms:modified` in `docProps/core.xml` from the wall
13
- * clock, which is the same failure one part deeper: two runs over identical
14
- * inputs differ in that part alone.
15
- *
16
- * Restamping both from the comparison's own timestamp removes them. It also
17
- * states the truth about the package: a generated redline is dated by the
18
- * comparison that produced it, not by the second it happened to be written.
5
+ * Date comparison output from the comparison's timestamp. Imported entries
6
+ * retain source dates, and saves can stamp `dcterms:modified` from the wall
7
+ * clock; restamping both makes repeated comparisons reproducible.
19
8
  */
20
9
  /** JSZip deflate level `repackDocx` writes DOCX parts at. */
21
10
  const DOCX_COMPRESSION_LEVEL = 6;
@@ -30,9 +19,14 @@ const withFixedModifiedDate = (corePropsXml, date) => corePropsXml.replace(MODIF
30
19
  const withFixedPackageDates = async (buffer, date) => {
31
20
  const zip = await JSZip.loadAsync(buffer);
32
21
  const coreProps = zip.file(CORE_PROPERTIES_PATH);
33
- if (coreProps) zip.file(CORE_PROPERTIES_PATH, withFixedModifiedDate(await coreProps.async("text"), date), {
34
- compression: "DEFLATE",
35
- compressionOptions: { level: DOCX_COMPRESSION_LEVEL }
22
+ if (coreProps) writeZipPart({
23
+ zip,
24
+ path: CORE_PROPERTIES_PATH,
25
+ data: withFixedModifiedDate(await coreProps.async("text"), date),
26
+ options: {
27
+ compression: "DEFLATE",
28
+ compressionOptions: { level: DOCX_COMPRESSION_LEVEL }
29
+ }
36
30
  });
37
31
  zip.forEach((_path, file) => {
38
32
  file.date = date;
@@ -0,0 +1,23 @@
1
+ import { document_d_exports } from "../types/document.js";
2
+ import { CanonicalCommit, CanonicalSession, CanonicalSessionError } from "./canonicalSession.js";
3
+ import { Slice } from "prosemirror-model";
4
+ import { EditorState } from "prosemirror-state";
5
+ import { Result } from "better-result";
6
+ //#region src/controller/canonicalClipboard.d.ts
7
+ /** Clipboard slices are input payloads; their paragraph identities and private captures are not owners. */
8
+ type PrepareCanonicalPasteOptions = {
9
+ session: CanonicalSession;
10
+ state: EditorState;
11
+ slice: Slice;
12
+ plain?: boolean;
13
+ moveTarget?: number;
14
+ pasteTarget?: number;
15
+ sourceDocument?: document_d_exports.Document;
16
+ moveSource?: {
17
+ from: number;
18
+ to: number;
19
+ };
20
+ };
21
+ declare const prepareCanonicalPaste: ({ session, state, slice, plain, moveTarget, pasteTarget, sourceDocument, moveSource }: PrepareCanonicalPasteOptions) => Result<CanonicalCommit, CanonicalSessionError>;
22
+ //#endregion
23
+ export { prepareCanonicalPaste };