@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
@@ -203,6 +203,20 @@ const changedVisualFormattingGroups = (observedFormatting, expectedFormatting) =
203
203
  }
204
204
  return changed;
205
205
  };
206
+ /** Overlay only changed visual marks; private authored properties stay with the run. */
207
+ const runFormattingPatchFromMarks = (beforeMarks, afterMarks) => {
208
+ const observedMarks = (marks) => marks.filter(({ type }) => type.name !== "runFormattingOverride");
209
+ const before = marksToTextFormatting(observedMarks(beforeMarks));
210
+ const after = marksToTextFormatting(observedMarks(afterMarks));
211
+ const changed = changedVisualFormattingGroups(after, before);
212
+ const patch = before.styleId === after.styleId ? {} : { styleId: after.styleId ?? null };
213
+ const isFormattingKey = (key) => Object.hasOwn(RUN_FORMATTING_VISUAL_GROUPS, key);
214
+ for (const [key, group] of Object.entries(RUN_FORMATTING_VISUAL_GROUPS)) {
215
+ if (!isFormattingKey(key) || group === null || !changed.has(group)) continue;
216
+ Reflect.set(patch, key, after[key] ?? null);
217
+ }
218
+ return patch;
219
+ };
206
220
  const VISUAL_BOOLEAN_FORMATTING_PROPERTIES = /* @__PURE__ */ new Set([
207
221
  "allCaps",
208
222
  "bold",
@@ -564,4 +578,4 @@ function marksToTextFormatting(marks, options) {
564
578
  };
565
579
  }
566
580
  //#endregion
567
- export { marksToTextFormatting, sameFormattingValue };
581
+ export { marksToTextFormatting, runFormattingPatchFromMarks, sameFormattingValue };
@@ -1,7 +1,7 @@
1
1
  import { Mark, Node } from "prosemirror-model";
2
2
  import { Transaction } from "prosemirror-state";
3
3
  //#region src/prosemirror/runFormattingInlineCarriers.d.ts
4
- type RunFormattingInlineAtomDisposition = "break-run" | "field-run" | "not-a-run" | "page-break-carrier" | "preserved-xml-run" | "structured-field" | "symbol-run" | "tab-run" | "text-run";
4
+ type RunFormattingInlineAtomDisposition = "break-run" | "field-run" | "not-a-run" | "note-marker-run" | "page-break-carrier" | "preserved-xml-run" | "structured-field" | "symbol-run" | "tab-run" | "text-run";
5
5
  /**
6
6
  * How every inline atom maps to a serialized run-formatting carrier.
7
7
  *
@@ -18,6 +18,7 @@ declare const RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS: Readonly<{
18
18
  readonly image: "not-a-run";
19
19
  readonly math: "not-a-run";
20
20
  readonly moveRangeBoundary: "not-a-run";
21
+ readonly noteMarker: "note-marker-run";
21
22
  readonly pageBreakRun: "page-break-carrier";
22
23
  readonly preservedXml: "preserved-xml-run";
23
24
  readonly rangeAnchor: "not-a-run";
@@ -20,6 +20,7 @@ const RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS = Object.freeze({
20
20
  image: "not-a-run",
21
21
  math: "not-a-run",
22
22
  moveRangeBoundary: "not-a-run",
23
+ noteMarker: "note-marker-run",
23
24
  pageBreakRun: "page-break-carrier",
24
25
  preservedXml: "preserved-xml-run",
25
26
  rangeAnchor: "not-a-run",
@@ -52,6 +53,7 @@ const CONTROL_CHARACTER_BY_DISPOSITION = Object.freeze({
52
53
  "break-run": "\n",
53
54
  "field-run": null,
54
55
  "not-a-run": null,
56
+ "note-marker-run": null,
55
57
  "page-break-carrier": null,
56
58
  "preserved-xml-run": null,
57
59
  "structured-field": null,
@@ -179,7 +181,8 @@ const runFormattingCarrierReviewText = (carrier) => {
179
181
  case "tab-run":
180
182
  case "break-run": return CONTROL_CHARACTER_BY_DISPOSITION[carrier.disposition];
181
183
  case "text-run": return carrier.node.text ?? "";
182
- case "page-break-carrier": return "";
184
+ case "page-break-carrier":
185
+ case "note-marker-run": return "";
183
186
  case "symbol-run": {
184
187
  const { char } = expectSymbolAttrs(carrier.node);
185
188
  return decodeOoxmlSymbolCharacter(char) ?? "�";
@@ -107,6 +107,7 @@ type TrackedRevisionAncestor = {
107
107
  utcDate?: string;
108
108
  initials?: string;
109
109
  outerWrapperCount: number;
110
+ resolutionJoins?: document_d_exports.Insertion["resolutionJoins"];
110
111
  };
111
112
  type TrackedChangeMarkAttrs = {
112
113
  revisionId: number;
@@ -119,6 +120,7 @@ type TrackedChangeMarkAttrs = {
119
120
  moveKind?: "moveTo" | "moveFrom";
120
121
  /** Number of inline-wrapper layers authored outside this revision. */
121
122
  _docxOuterWrapperCount?: number;
123
+ _docxResolutionJoins?: document_d_exports.Insertion["resolutionJoins"];
122
124
  /** Outer revisions, in authored order, that ProseMirror cannot hold as nested marks. */
123
125
  _docxRevisionAncestors?: readonly TrackedRevisionAncestor[];
124
126
  /** Defaults to `"user"`; `"suggested"` for AI-proposed, non-serialized edits. */
@@ -44,6 +44,10 @@ declare const PRESERVED_XML_LEVELS: {
44
44
  readonly inline: "inline";
45
45
  };
46
46
  type PreservedXmlLevel = (typeof PRESERVED_XML_LEVELS)[keyof typeof PRESERVED_XML_LEVELS];
47
+ /** The automatic number mark authored inside a note story, with no reader text. */
48
+ type NoteMarkerAttrs = {
49
+ kind: "footnote" | "endnote";
50
+ };
47
51
  /** A run or inline child folio does not model, carried through the editor untouched. */
48
52
  type PreservedXmlAttrs = {
49
53
  /** Replayable markup, as `captureVerbatimXml` wrote it. */
@@ -51,6 +55,8 @@ type PreservedXmlAttrs = {
51
55
  /** The visible text the markup puts on the line, empty when it shows none. */
52
56
  text: string;
53
57
  level: PreservedXmlLevel;
58
+ /** `PreservedInline.foldedListNumber`, for a capture the list marker stands in for. */
59
+ foldedListNumber?: document_d_exports.FoldedListNumber;
54
60
  };
55
61
  /** A block child folio does not model, carried through the editor untouched. */
56
62
  type PreservedBlockAttrs = {
@@ -166,6 +172,8 @@ type ParagraphAttrs = {
166
172
  * next marker letter.
167
173
  */
168
174
  listImplicitChildLevelAdvances?: number;
175
+ /** Cached inline LISTNUM display text appended after the resolved list template. */
176
+ listFoldedMarkerSuffix?: string;
169
177
  /**
170
178
  * When the marker text contains a TAB separator, this column offset (in
171
179
  * twips) is where the slot after the tab should land — used to align an
@@ -338,7 +346,7 @@ type ParagraphPropertyChangeAttrs = Omit<document_d_exports.ParagraphPropertyCha
338
346
  };
339
347
  previousFormatting?: Omit<document_d_exports.ParagraphFormatting, "numPr"> & {
340
348
  numPr?: ParagraphAttrs["numPr"] | null;
341
- } & Partial<Pick<ParagraphAttrs, "listIsBullet" | "listIsLegal" | "listNumFmt" | "listMarker" | "listMarkerTemplate" | "listMarkerHidden" | "listMarkerFormatting" | "listMarkerAlignment" | "listMarkerSuffix" | "listMarkerAllCaps" | "listImplicitChildLevelAdvances" | "listMarkerSecondSlotOffsetTwips" | "listLevelNumFmts" | "listLevelStarts" | "listLevelTabs" | "listAbstractNumId" | "listStartOverride" | "lineSpacingExplicit" | "direction" | "_autospacingBase">>;
349
+ } & Partial<Pick<ParagraphAttrs, "listIsBullet" | "listIsLegal" | "listNumFmt" | "listMarker" | "listMarkerTemplate" | "listMarkerHidden" | "listMarkerFormatting" | "listMarkerAlignment" | "listMarkerSuffix" | "listMarkerAllCaps" | "listImplicitChildLevelAdvances" | "listFoldedMarkerSuffix" | "listMarkerSecondSlotOffsetTwips" | "listLevelNumFmts" | "listLevelStarts" | "listLevelTabs" | "listAbstractNumId" | "listStartOverride" | "lineSpacingExplicit" | "direction" | "_autospacingBase">>;
342
350
  currentFormatting?: document_d_exports.ParagraphFormatting;
343
351
  };
344
352
  /**
@@ -1258,4 +1266,4 @@ type TableCellAttrs = {
1258
1266
  _docxVMergeContinuationCells?: unknown;
1259
1267
  };
1260
1268
  //#endregion
1261
- export { AlternateContentAttrs, AuthoredEmuAttrs, BlockCustomXmlAttrs, BlockSdtAttrs, BookmarkBoundaryAttrs, CommentReferenceAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PRESERVED_XML_LEVELS, PageBreakRunAttrs, ParagraphAttrs, ParagraphAttrsPatch, ParagraphPropertyChangeAttrs, PreservedBlockAttrs, PreservedXmlAttrs, PreservedXmlLevel, SdtAttrs, ShapeAttrs, SuggestedStructuralMarker, SymbolAttrs, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAnchorAttrs, TextBoxAttrs, TextBoxTextBodyContentState };
1269
+ export { AlternateContentAttrs, AuthoredEmuAttrs, BlockCustomXmlAttrs, BlockSdtAttrs, BookmarkBoundaryAttrs, CommentReferenceAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, NoteMarkerAttrs, PRESERVED_XML_LEVELS, PageBreakRunAttrs, ParagraphAttrs, ParagraphAttrsPatch, ParagraphPropertyChangeAttrs, PreservedBlockAttrs, PreservedXmlAttrs, PreservedXmlLevel, SdtAttrs, ShapeAttrs, SuggestedStructuralMarker, SymbolAttrs, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAnchorAttrs, TextBoxAttrs, TextBoxTextBodyContentState };
@@ -1,5 +1,6 @@
1
1
  import { TextBoxAnchorAttrs } from "./schema/nodes.js";
2
- import { ReadProseMirrorAttrsResult } from "./attrs/index.js";
2
+ import { ReadProseMirrorAttrsResult } from "../internal/prosemirrorAttrBoundary.js";
3
+ import "./attrs/index.js";
3
4
  import { Node } from "prosemirror-model";
4
5
  //#region src/prosemirror/textBoxAnchorAttrs.d.ts
5
6
  declare const readTextBoxAnchorAttrs: (node: Node) => ReadProseMirrorAttrsResult<TextBoxAnchorAttrs>;
@@ -4,7 +4,11 @@ const dispatchEditorTextInput = (view, input) => {
4
4
  const { from, to } = typeof input === "string" ? view.state.selection : input;
5
5
  const text = typeof input === "string" ? input : input.text;
6
6
  const defaultTransaction = () => {
7
- if (!(view.state.selection instanceof AllSelection)) return view.state.tr.insertText(text, from, to);
7
+ const { selection } = view.state;
8
+ if (!(selection instanceof AllSelection)) {
9
+ const tr = view.state.tr.insertText(text, from, to);
10
+ return !selection.empty && selection.from === from && selection.to === to ? tr.setSelection(TextSelection.create(tr.doc, from + text.length)) : tr;
11
+ }
8
12
  const start = Selection.atStart(view.state.doc);
9
13
  const end = Selection.atEnd(view.state.doc);
10
14
  const last = end.$to.parent;
@@ -18,7 +18,8 @@ const trackedRevisionLayerOf = (mark, node) => {
18
18
  ...attrs.date ? { date: attrs.date } : {},
19
19
  ...attrs.utcDate ? { utcDate: attrs.utcDate } : {},
20
20
  ...attrs.initials ? { initials: attrs.initials } : {},
21
- outerWrapperCount: attrs._docxOuterWrapperCount ?? inlineWrapperStackOf(node).length
21
+ outerWrapperCount: attrs._docxOuterWrapperCount ?? inlineWrapperStackOf(node).length,
22
+ ...attrs._docxResolutionJoins == null ? {} : { resolutionJoins: attrs._docxResolutionJoins }
22
23
  };
23
24
  };
24
25
  /** The deletion's ancestor path, with the insertion it sits in as the outermost layer. */
@@ -17,6 +17,7 @@ declare const TRACKED_RUN_INLINE_ATOM_DISPOSITIONS: Readonly<{
17
17
  readonly image: "carry";
18
18
  readonly math: "carry";
19
19
  readonly moveRangeBoundary: "carry";
20
+ readonly noteMarker: "carry";
20
21
  readonly pageBreakRun: "page-break-carrier";
21
22
  readonly preservedXml: "carry";
22
23
  readonly rangeAnchor: "transparent";
@@ -16,6 +16,7 @@ const TRACKED_RUN_INLINE_ATOM_DISPOSITIONS = Object.freeze({
16
16
  image: "carry",
17
17
  math: "carry",
18
18
  moveRangeBoundary: "carry",
19
+ noteMarker: "carry",
19
20
  pageBreakRun: "page-break-carrier",
20
21
  preservedXml: "carry",
21
22
  rangeAnchor: "transparent",
@@ -1,3 +1,4 @@
1
+ import { readNoteMarkerAttrs } from "../internal/noteMarkerAttrs.js";
1
2
  import { readBlockCustomXmlAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readInlineWrapperMarkAttrs, readLanguageMarkAttrs, readMathAttrs, readPageBreakRunAttrs, readParagraphAttrs, readPreservedBlockAttrs, readPreservedXmlAttrs, readRunFormattingOverrideMarkAttrs, readRunIdentityMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs } from "./attrs/index.js";
2
3
  import { readBookmarkBoundaryAttrs } from "./bookmarkBoundaryAttrs.js";
3
4
  import { readCommentReferenceAttrs } from "./commentReferenceAttrs.js";
@@ -203,6 +204,9 @@ const validateNodeAttrs = (node, path, issues) => {
203
204
  case "symbol":
204
205
  appendAttrIssues(path, readSymbolAttrs(node), issues);
205
206
  return;
207
+ case "noteMarker":
208
+ appendAttrIssues(path, readNoteMarkerAttrs(node), issues);
209
+ return;
206
210
  case "preservedXml":
207
211
  appendAttrIssues(path, readPreservedXmlAttrs(node), issues);
208
212
  return;
@@ -0,0 +1,215 @@
1
+ //#region src/types/canonicalCapabilities.d.ts
2
+ /** Remaining seams to retire before the canonical session becomes the only authority. */
3
+ declare const CANONICAL_GAP: {
4
+ readonly authorityRouting: "authority-routing";
5
+ readonly commands: "command-descriptors";
6
+ readonly suggesting: "adapter-suggesting";
7
+ readonly trackedHyperlinkResolution: "tracked-hyperlink-resolution";
8
+ readonly comments: "comment-model-edits";
9
+ readonly modelEdits: "direct-model-edits";
10
+ readonly sectionProperties: "section-properties";
11
+ readonly watermark: "watermark-model-edits";
12
+ readonly secondaryStories: "secondary-story-routing";
13
+ readonly collaboration: "collaboration-session";
14
+ readonly dispatch: "unclassified-transactions";
15
+ readonly save: "pm-save-projection";
16
+ readonly resourceReplacement: "canonical-resource-replacement";
17
+ readonly history: "pm-history";
18
+ readonly suggestionPlugin: "pm-suggestion-plugin";
19
+ readonly paragraphTracker: "pm-paragraph-tracker";
20
+ readonly tableGeometry: "pm-table-geometry";
21
+ readonly paragraphIdentity: "pm-paragraph-identity";
22
+ readonly documentOperations: "pm-document-operations";
23
+ readonly aiSnapshots: "pm-ai-snapshots";
24
+ readonly publicComments: "publicOps.comments";
25
+ readonly publicSuggestedMode: "publicOps.suggestedMode";
26
+ readonly publicTableProjection: "publicOps.tableProjection";
27
+ readonly publicUnsupportedInline: "publicOps.unsupportedInline";
28
+ readonly publicPendingParagraphMarkProperties: "publicOps.pendingParagraphMarkProperties";
29
+ readonly publicHeadlessSession: "publicOps.headlessSession";
30
+ readonly publicSecondaryStories: "publicOps.secondaryStories";
31
+ };
32
+ type CanonicalGap = (typeof CANONICAL_GAP)[keyof typeof CANONICAL_GAP];
33
+ declare const CANONICAL_CAPABILITIES: {
34
+ readonly "authority-routing": {
35
+ readonly owner: "controller";
36
+ readonly kind: "routing";
37
+ readonly adapters: readonly ["react", "vue"];
38
+ readonly summary: "Explicit session selection and legacy authority routing.";
39
+ };
40
+ readonly "command-descriptors": {
41
+ readonly remainingCommands: {
42
+ readonly registry: "extension-commands";
43
+ };
44
+ readonly owner: "controller";
45
+ readonly kind: "refusal";
46
+ readonly adapters: readonly ["react", "vue"];
47
+ readonly summary: "Commands without canonical descriptors retain PM probing and hit the dispatch boundary.";
48
+ };
49
+ readonly "tracked-hyperlink-resolution": {
50
+ readonly owner: "controller";
51
+ readonly kind: "refusal";
52
+ readonly adapters: readonly ["react", "vue"];
53
+ readonly summary: "Hyperlink and TOC suggestions require serializable wrapper review provenance.";
54
+ };
55
+ readonly "adapter-suggesting": {
56
+ readonly owner: "adapters";
57
+ readonly kind: "refusal";
58
+ readonly adapters: readonly ["react", "vue"];
59
+ readonly summary: "Adapter suggesting controls and tracked secondary-story edits remain gated.";
60
+ };
61
+ readonly "comment-model-edits": {
62
+ readonly owner: "adapters";
63
+ readonly kind: "refusal";
64
+ readonly adapters: readonly ["react", "vue"];
65
+ readonly summary: "Comment mutations still use direct model changes.";
66
+ };
67
+ readonly "direct-model-edits": {
68
+ readonly owner: "adapters";
69
+ readonly kind: "refusal";
70
+ readonly adapters: readonly ["react", "vue"];
71
+ readonly summary: "Direct model and pending-suggestion snapshots bypass the canonical journal.";
72
+ };
73
+ readonly "section-properties": {
74
+ readonly owner: "adapters";
75
+ readonly kind: "routing";
76
+ readonly adapters: readonly ["react", "vue"];
77
+ readonly summary: "Section properties select canonical operations or legacy model changes.";
78
+ };
79
+ readonly "watermark-model-edits": {
80
+ readonly owner: "adapters";
81
+ readonly kind: "refusal";
82
+ readonly adapters: readonly ["vue"];
83
+ readonly summary: "Vue watermark mutations still change the model directly.";
84
+ };
85
+ readonly "secondary-story-routing": {
86
+ readonly owner: "controller";
87
+ readonly kind: "routing";
88
+ readonly adapters: readonly ["react", "vue"];
89
+ readonly summary: "Secondary-story creation, views and history still select their session authority.";
90
+ };
91
+ readonly "collaboration-session": {
92
+ readonly owner: "controller";
93
+ readonly kind: "refusal";
94
+ readonly adapters: readonly ["react", "vue"];
95
+ readonly summary: "Collaboration cannot activate a canonical session.";
96
+ };
97
+ readonly "unclassified-transactions": {
98
+ readonly owner: "controller";
99
+ readonly kind: "refusal";
100
+ readonly adapters: readonly ["react", "vue"];
101
+ readonly summary: "Unclassified native and plugin mutations are refused at the projection boundary.";
102
+ };
103
+ readonly "pm-save-projection": {
104
+ readonly owner: "controller";
105
+ readonly kind: "routing";
106
+ readonly adapters: readonly ["react", "vue"];
107
+ readonly summary: "Legacy save and read paths reconstruct documents from PM.";
108
+ };
109
+ readonly "canonical-resource-replacement": {
110
+ readonly owner: "controller";
111
+ readonly kind: "refusal";
112
+ readonly adapters: readonly ["react", "vue"];
113
+ readonly summary: "Canonical save refuses existing style, style-default, and media replacements the package writers cannot express.";
114
+ };
115
+ readonly "pm-history": {
116
+ readonly owner: "prosemirror";
117
+ readonly kind: "mutation-source";
118
+ readonly adapters: readonly ["react", "vue"];
119
+ readonly summary: "PM history remains installed for legacy sessions.";
120
+ };
121
+ readonly "pm-suggestion-plugin": {
122
+ readonly owner: "prosemirror";
123
+ readonly kind: "mutation-source";
124
+ readonly adapters: readonly ["react", "vue"];
125
+ readonly summary: "The legacy suggestion plugin produces PM transactions.";
126
+ };
127
+ readonly "pm-paragraph-tracker": {
128
+ readonly owner: "prosemirror";
129
+ readonly kind: "mutation-source";
130
+ readonly adapters: readonly ["react", "vue"];
131
+ readonly summary: "Dirty tracking and section bookkeeping still observe PM transactions.";
132
+ };
133
+ readonly "pm-table-geometry": {
134
+ readonly owner: "prosemirror";
135
+ readonly kind: "mutation-source";
136
+ readonly adapters: readonly ["react", "vue"];
137
+ readonly summary: "Table geometry, resize and repair still produce PM transactions.";
138
+ };
139
+ readonly "pm-paragraph-identity": {
140
+ readonly owner: "prosemirror";
141
+ readonly kind: "mutation-source";
142
+ readonly adapters: readonly ["react", "vue"];
143
+ readonly summary: "Legacy paragraph identity repair remains a PM append transaction.";
144
+ };
145
+ readonly "pm-document-operations": {
146
+ readonly owner: "document-operations";
147
+ readonly defaultSessionMutation: "pm-public-operations";
148
+ readonly kind: "mutation-source";
149
+ readonly adapters: readonly ["react", "vue"];
150
+ readonly summary: "Public document operations still execute against a held PM view.";
151
+ };
152
+ readonly "publicOps.comments": {
153
+ readonly owner: "document-operations";
154
+ readonly defaultSessionMutation: "pm-public-operations";
155
+ readonly kind: "refusal";
156
+ readonly adapters: readonly ["react", "vue"];
157
+ readonly summary: "Public comment operations refuse in canonical sessions; legacy sessions retain PM comments.";
158
+ };
159
+ readonly "publicOps.suggestedMode": {
160
+ readonly owner: "document-operations";
161
+ readonly defaultSessionMutation: "pm-public-operations";
162
+ readonly kind: "refusal";
163
+ readonly adapters: readonly ["react", "vue"];
164
+ readonly summary: "Public suggested mode refuses in canonical sessions until pending suggestions use the journal.";
165
+ };
166
+ readonly "publicOps.tableProjection": {
167
+ readonly owner: "document-operations";
168
+ readonly defaultSessionMutation: "pm-public-operations";
169
+ readonly kind: "refusal";
170
+ readonly adapters: readonly ["react", "vue"];
171
+ readonly summary: "Public table operations refuse while canonical projections require paragraph stories.";
172
+ };
173
+ readonly "publicOps.unsupportedInline": {
174
+ readonly owner: "document-operations";
175
+ readonly defaultSessionMutation: "pm-public-operations";
176
+ readonly kind: "refusal";
177
+ readonly adapters: readonly ["react", "vue"];
178
+ readonly summary: "Unsupported public payloads refuse with a typed compiler capability gap.";
179
+ };
180
+ readonly "publicOps.pendingParagraphMarkProperties": {
181
+ readonly owner: "document-operations";
182
+ readonly defaultSessionMutation: "pm-public-operations";
183
+ readonly kind: "refusal";
184
+ readonly adapters: readonly ["react", "vue"];
185
+ readonly summary: "Separate paragraph property edits refuse while the paragraph mark is pending deletion; atomic merge properties remain supported.";
186
+ };
187
+ readonly "publicOps.secondaryStories": {
188
+ readonly owner: "document-operations";
189
+ readonly defaultSessionMutation: "pm-public-operations";
190
+ readonly kind: "refusal";
191
+ readonly adapters: readonly ["react", "vue"];
192
+ readonly summary: "Public secondary-story batches refuse until canonical story routing is available.";
193
+ };
194
+ readonly "publicOps.headlessSession": {
195
+ readonly owner: "document-operations";
196
+ readonly defaultSessionMutation: "pm-headless-reviewer";
197
+ readonly kind: "mutation-source";
198
+ readonly adapters: readonly ["react", "vue"];
199
+ readonly summary: "The headless reviewer has no canonical session selector while its mutations remain PM-owned.";
200
+ };
201
+ readonly "pm-ai-snapshots": {
202
+ readonly owner: "ai-edits";
203
+ readonly kind: "mutation-source";
204
+ readonly adapters: readonly ["react", "vue"];
205
+ readonly summary: "Headless AI edits still use PM execution and snapshot undo.";
206
+ };
207
+ };
208
+ /**
209
+ * The gap argument is a typed tag counted by the source guard, not a runtime policy.
210
+ * Retire a gap by removing its sites and ledger entry.
211
+ */
212
+ declare const usesCanonicalSession: (session: "canonical" | undefined, _gap: CanonicalGap) => boolean;
213
+ declare const canonicalRefusalMessage: (gap: CanonicalGap, message: string) => string;
214
+ //#endregion
215
+ export { CANONICAL_CAPABILITIES, CANONICAL_GAP, CanonicalGap, canonicalRefusalMessage, usesCanonicalSession };
@@ -0,0 +1,212 @@
1
+ //#region src/types/canonicalCapabilities.ts
2
+ /** Remaining seams to retire before the canonical session becomes the only authority. */
3
+ const CANONICAL_GAP = {
4
+ authorityRouting: "authority-routing",
5
+ commands: "command-descriptors",
6
+ suggesting: "adapter-suggesting",
7
+ trackedHyperlinkResolution: "tracked-hyperlink-resolution",
8
+ comments: "comment-model-edits",
9
+ modelEdits: "direct-model-edits",
10
+ sectionProperties: "section-properties",
11
+ watermark: "watermark-model-edits",
12
+ secondaryStories: "secondary-story-routing",
13
+ collaboration: "collaboration-session",
14
+ dispatch: "unclassified-transactions",
15
+ save: "pm-save-projection",
16
+ resourceReplacement: "canonical-resource-replacement",
17
+ history: "pm-history",
18
+ suggestionPlugin: "pm-suggestion-plugin",
19
+ paragraphTracker: "pm-paragraph-tracker",
20
+ tableGeometry: "pm-table-geometry",
21
+ paragraphIdentity: "pm-paragraph-identity",
22
+ documentOperations: "pm-document-operations",
23
+ aiSnapshots: "pm-ai-snapshots",
24
+ publicComments: "publicOps.comments",
25
+ publicSuggestedMode: "publicOps.suggestedMode",
26
+ publicTableProjection: "publicOps.tableProjection",
27
+ publicUnsupportedInline: "publicOps.unsupportedInline",
28
+ publicPendingParagraphMarkProperties: "publicOps.pendingParagraphMarkProperties",
29
+ publicHeadlessSession: "publicOps.headlessSession",
30
+ publicSecondaryStories: "publicOps.secondaryStories"
31
+ };
32
+ const CANONICAL_CAPABILITIES = {
33
+ [CANONICAL_GAP.authorityRouting]: {
34
+ owner: "controller",
35
+ kind: "routing",
36
+ adapters: ["react", "vue"],
37
+ summary: "Explicit session selection and legacy authority routing."
38
+ },
39
+ [CANONICAL_GAP.commands]: {
40
+ remainingCommands: { registry: "extension-commands" },
41
+ owner: "controller",
42
+ kind: "refusal",
43
+ adapters: ["react", "vue"],
44
+ summary: "Commands without canonical descriptors retain PM probing and hit the dispatch boundary."
45
+ },
46
+ [CANONICAL_GAP.trackedHyperlinkResolution]: {
47
+ owner: "controller",
48
+ kind: "refusal",
49
+ adapters: ["react", "vue"],
50
+ summary: "Hyperlink and TOC suggestions require serializable wrapper review provenance."
51
+ },
52
+ [CANONICAL_GAP.suggesting]: {
53
+ owner: "adapters",
54
+ kind: "refusal",
55
+ adapters: ["react", "vue"],
56
+ summary: "Adapter suggesting controls and tracked secondary-story edits remain gated."
57
+ },
58
+ [CANONICAL_GAP.comments]: {
59
+ owner: "adapters",
60
+ kind: "refusal",
61
+ adapters: ["react", "vue"],
62
+ summary: "Comment mutations still use direct model changes."
63
+ },
64
+ [CANONICAL_GAP.modelEdits]: {
65
+ owner: "adapters",
66
+ kind: "refusal",
67
+ adapters: ["react", "vue"],
68
+ summary: "Direct model and pending-suggestion snapshots bypass the canonical journal."
69
+ },
70
+ [CANONICAL_GAP.sectionProperties]: {
71
+ owner: "adapters",
72
+ kind: "routing",
73
+ adapters: ["react", "vue"],
74
+ summary: "Section properties select canonical operations or legacy model changes."
75
+ },
76
+ [CANONICAL_GAP.watermark]: {
77
+ owner: "adapters",
78
+ kind: "refusal",
79
+ adapters: ["vue"],
80
+ summary: "Vue watermark mutations still change the model directly."
81
+ },
82
+ [CANONICAL_GAP.secondaryStories]: {
83
+ owner: "controller",
84
+ kind: "routing",
85
+ adapters: ["react", "vue"],
86
+ summary: "Secondary-story creation, views and history still select their session authority."
87
+ },
88
+ [CANONICAL_GAP.collaboration]: {
89
+ owner: "controller",
90
+ kind: "refusal",
91
+ adapters: ["react", "vue"],
92
+ summary: "Collaboration cannot activate a canonical session."
93
+ },
94
+ [CANONICAL_GAP.dispatch]: {
95
+ owner: "controller",
96
+ kind: "refusal",
97
+ adapters: ["react", "vue"],
98
+ summary: "Unclassified native and plugin mutations are refused at the projection boundary."
99
+ },
100
+ [CANONICAL_GAP.save]: {
101
+ owner: "controller",
102
+ kind: "routing",
103
+ adapters: ["react", "vue"],
104
+ summary: "Legacy save and read paths reconstruct documents from PM."
105
+ },
106
+ [CANONICAL_GAP.resourceReplacement]: {
107
+ owner: "controller",
108
+ kind: "refusal",
109
+ adapters: ["react", "vue"],
110
+ summary: "Canonical save refuses existing style, style-default, and media replacements the package writers cannot express."
111
+ },
112
+ [CANONICAL_GAP.history]: {
113
+ owner: "prosemirror",
114
+ kind: "mutation-source",
115
+ adapters: ["react", "vue"],
116
+ summary: "PM history remains installed for legacy sessions."
117
+ },
118
+ [CANONICAL_GAP.suggestionPlugin]: {
119
+ owner: "prosemirror",
120
+ kind: "mutation-source",
121
+ adapters: ["react", "vue"],
122
+ summary: "The legacy suggestion plugin produces PM transactions."
123
+ },
124
+ [CANONICAL_GAP.paragraphTracker]: {
125
+ owner: "prosemirror",
126
+ kind: "mutation-source",
127
+ adapters: ["react", "vue"],
128
+ summary: "Dirty tracking and section bookkeeping still observe PM transactions."
129
+ },
130
+ [CANONICAL_GAP.tableGeometry]: {
131
+ owner: "prosemirror",
132
+ kind: "mutation-source",
133
+ adapters: ["react", "vue"],
134
+ summary: "Table geometry, resize and repair still produce PM transactions."
135
+ },
136
+ [CANONICAL_GAP.paragraphIdentity]: {
137
+ owner: "prosemirror",
138
+ kind: "mutation-source",
139
+ adapters: ["react", "vue"],
140
+ summary: "Legacy paragraph identity repair remains a PM append transaction."
141
+ },
142
+ [CANONICAL_GAP.documentOperations]: {
143
+ owner: "document-operations",
144
+ defaultSessionMutation: "pm-public-operations",
145
+ kind: "mutation-source",
146
+ adapters: ["react", "vue"],
147
+ summary: "Public document operations still execute against a held PM view."
148
+ },
149
+ [CANONICAL_GAP.publicComments]: {
150
+ owner: "document-operations",
151
+ defaultSessionMutation: "pm-public-operations",
152
+ kind: "refusal",
153
+ adapters: ["react", "vue"],
154
+ summary: "Public comment operations refuse in canonical sessions; legacy sessions retain PM comments."
155
+ },
156
+ [CANONICAL_GAP.publicSuggestedMode]: {
157
+ owner: "document-operations",
158
+ defaultSessionMutation: "pm-public-operations",
159
+ kind: "refusal",
160
+ adapters: ["react", "vue"],
161
+ summary: "Public suggested mode refuses in canonical sessions until pending suggestions use the journal."
162
+ },
163
+ [CANONICAL_GAP.publicTableProjection]: {
164
+ owner: "document-operations",
165
+ defaultSessionMutation: "pm-public-operations",
166
+ kind: "refusal",
167
+ adapters: ["react", "vue"],
168
+ summary: "Public table operations refuse while canonical projections require paragraph stories."
169
+ },
170
+ [CANONICAL_GAP.publicUnsupportedInline]: {
171
+ owner: "document-operations",
172
+ defaultSessionMutation: "pm-public-operations",
173
+ kind: "refusal",
174
+ adapters: ["react", "vue"],
175
+ summary: "Unsupported public payloads refuse with a typed compiler capability gap."
176
+ },
177
+ [CANONICAL_GAP.publicPendingParagraphMarkProperties]: {
178
+ owner: "document-operations",
179
+ defaultSessionMutation: "pm-public-operations",
180
+ kind: "refusal",
181
+ adapters: ["react", "vue"],
182
+ summary: "Separate paragraph property edits refuse while the paragraph mark is pending deletion; atomic merge properties remain supported."
183
+ },
184
+ [CANONICAL_GAP.publicSecondaryStories]: {
185
+ owner: "document-operations",
186
+ defaultSessionMutation: "pm-public-operations",
187
+ kind: "refusal",
188
+ adapters: ["react", "vue"],
189
+ summary: "Public secondary-story batches refuse until canonical story routing is available."
190
+ },
191
+ [CANONICAL_GAP.publicHeadlessSession]: {
192
+ owner: "document-operations",
193
+ defaultSessionMutation: "pm-headless-reviewer",
194
+ kind: "mutation-source",
195
+ adapters: ["react", "vue"],
196
+ summary: "The headless reviewer has no canonical session selector while its mutations remain PM-owned."
197
+ },
198
+ [CANONICAL_GAP.aiSnapshots]: {
199
+ owner: "ai-edits",
200
+ kind: "mutation-source",
201
+ adapters: ["react", "vue"],
202
+ summary: "Headless AI edits still use PM execution and snapshot undo."
203
+ }
204
+ };
205
+ /**
206
+ * The gap argument is a typed tag counted by the source guard, not a runtime policy.
207
+ * Retire a gap by removing its sites and ledger entry.
208
+ */
209
+ const usesCanonicalSession = (session, _gap) => session === "canonical";
210
+ const canonicalRefusalMessage = (gap, message) => `[${gap}] ${message}`;
211
+ //#endregion
212
+ export { CANONICAL_CAPABILITIES, CANONICAL_GAP, canonicalRefusalMessage, usesCanonicalSession };
@@ -0,0 +1,11 @@
1
+ import { document_d_exports } from "./document.js";
2
+ //#region src/types/canonicalSave.d.ts
3
+ /** Committed model and conservative changes relative to its parsed source package. */
4
+ type CanonicalSaveSnapshot = {
5
+ document: document_d_exports.Document;
6
+ version: number;
7
+ changedBlockIds: readonly string[];
8
+ structure: "stable" | "changed";
9
+ };
10
+ //#endregion
11
+ export { CanonicalSaveSnapshot };
File without changes