@stll/folio-core 0.73.0 → 0.75.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 (221) hide show
  1. package/dist/ai-edits/clean-text.d.ts +4 -1
  2. package/dist/ai-edits/clean-text.js +21 -7
  3. package/dist/ai-edits/headless.d.ts +5 -2
  4. package/dist/ai-edits/headless.js +20 -14
  5. package/dist/ai-edits/note-references.d.ts +1 -1
  6. package/dist/ai-edits/note-references.js +1 -1
  7. package/dist/ai-edits/pending-suggestions.d.ts +9 -7
  8. package/dist/ai-edits/pending-suggestions.js +134 -88
  9. package/dist/ai-edits/pendingJoin.d.ts +5 -1
  10. package/dist/ai-edits/pendingJoin.js +12 -3
  11. package/dist/ai-edits/result-validation.js +1 -1
  12. package/dist/ai-edits/retired-comment-receipts.d.ts +2 -2
  13. package/dist/ai-edits/retired-comment-receipts.js +3 -18
  14. package/dist/ai-edits/snapshot.js +1 -1
  15. package/dist/ai-edits/table-cell-mutations.js +1 -1
  16. package/dist/ai-edits/tracked-batch-fidelity.d.ts +6 -10
  17. package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
  18. package/dist/canonical/canonicalBatchReview.d.ts +4 -1
  19. package/dist/canonical/canonicalBatchReview.js +32 -14
  20. package/dist/canonical/canonicalComments.d.ts +6 -2
  21. package/dist/canonical/canonicalComments.js +8 -4
  22. package/dist/canonical/canonicalInlineGaps.d.ts +56 -0
  23. package/dist/canonical/canonicalInlineGaps.js +118 -0
  24. package/dist/canonical/canonicalInlineProjection.d.ts +4 -13
  25. package/dist/canonical/canonicalInlineProjection.js +6 -28
  26. package/dist/canonical/canonicalProjectionBlocks.d.ts +4 -4
  27. package/dist/canonical/canonicalPublicOperations.js +99 -36
  28. package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
  29. package/dist/canonical/canonicalRefusalGrounds.js +56 -0
  30. package/dist/canonical/canonicalSelection.js +1 -1
  31. package/dist/canonical/canonicalSession.d.ts +12 -6
  32. package/dist/canonical/canonicalSession.js +129 -141
  33. package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
  34. package/dist/compare/inline-atoms.d.ts +35 -41
  35. package/dist/compare/inline-atoms.js +2 -465
  36. package/dist/compare/section-boundary-properties.d.ts +3 -30
  37. package/dist/compare/section-boundary-properties.js +4 -72
  38. package/dist/controller/autocompleteSuggestion.js +1 -1
  39. package/dist/controller/canonicalClipboard.js +45 -44
  40. package/dist/controller/canonicalComposition.d.ts +1 -1
  41. package/dist/controller/canonicalComposition.js +6 -6
  42. package/dist/controller/canonicalInput.d.ts +4 -2
  43. package/dist/controller/canonicalInput.js +34 -17
  44. package/dist/controller/canonicalPresence.js +1 -1
  45. package/dist/controller/canonicalRoomAuthority.js +1 -1
  46. package/dist/controller/canonicalRoomWire.js +1 -1
  47. package/dist/controller/canonicalStoryEditor.d.ts +2 -3
  48. package/dist/controller/canonicalStoryEditor.js +43 -25
  49. package/dist/controller/canonicalStructure.d.ts +19 -2
  50. package/dist/controller/canonicalStructure.js +140 -43
  51. package/dist/controller/canonicalTabRoom.js +1 -1
  52. package/dist/controller/canonicalYjsRoom.js +1 -1
  53. package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
  54. package/dist/controller/deferredDisplayListPainter.js +34 -0
  55. package/dist/controller/folioEditor.js +4 -2
  56. package/dist/controller/headerFooterEditorManager.js +3 -17
  57. package/dist/controller/hiddenEditorApi.d.ts +24 -3
  58. package/dist/controller/hiddenEditorApi.js +4 -17
  59. package/dist/controller/hiddenEditorManager.js +136 -197
  60. package/dist/controller/layoutPipeline.d.ts +4 -86
  61. package/dist/controller/layoutPipeline.js +8 -727
  62. package/dist/controller/layoutPipelineExecution.d.ts +94 -0
  63. package/dist/controller/layoutPipelineExecution.js +730 -0
  64. package/dist/controller/noteEditorManager.js +3 -16
  65. package/dist/document-operations.js +1 -1
  66. package/dist/docx/blockContentParser.d.ts +1 -3
  67. package/dist/docx/blockContentParser.js +3 -10
  68. package/dist/docx/canonicalSave.d.ts +4 -3
  69. package/dist/docx/canonicalSave.js +4 -3
  70. package/dist/docx/canonicalSessionInput.js +1 -1
  71. package/dist/docx/containerChildren.js +1 -1
  72. package/dist/docx/createDocx.d.ts +4 -0
  73. package/dist/docx/createDocx.js +6 -0
  74. package/dist/docx/listMarkerComputation.d.ts +24 -17
  75. package/dist/docx/listMarkerComputation.js +31 -60
  76. package/dist/docx/listModelNormalization.js +8 -15
  77. package/dist/docx/modelValidation.js +1 -1
  78. package/dist/docx/parser.js +1 -1
  79. package/dist/docx/reviewResolutionProvenance.js +1 -1
  80. package/dist/docx/rezip.d.ts +16 -3
  81. package/dist/docx/rezip.js +36 -10
  82. package/dist/docx/selectiveSave.js +13 -5
  83. package/dist/docx/serializer/borderSerializer.js +1 -1
  84. package/dist/docx/serializer/commentSerializer.js +1 -1
  85. package/dist/docx/serializer/documentSerializer.js +1 -1
  86. package/dist/docx/serializer/paragraphSerializer.js +3 -3
  87. package/dist/docx/serializer/runSerializer.js +1 -1
  88. package/dist/docx/serializer/sectionPropertiesSerializer.js +1 -1
  89. package/dist/docx/serializer/tableSerializer.js +1 -1
  90. package/dist/docx/serializer/textFormattingSerializer.js +1 -1
  91. package/dist/docx/serializer/trackedChangeAttributes.js +1 -1
  92. package/dist/docx/server/templatePlan/apply.js +107 -14
  93. package/dist/docx/server/templatePlan/blocks.d.ts +16 -1
  94. package/dist/docx/server/templatePlan/blocks.js +93 -7
  95. package/dist/docx/server/templatePlan/builders.d.ts +37 -2
  96. package/dist/docx/server/templatePlan/builders.js +196 -5
  97. package/dist/docx/server/templatePlan/emit.d.ts +2 -0
  98. package/dist/docx/server/templatePlan/emit.js +2 -0
  99. package/dist/docx/server/templatePlan/inspect.js +81 -61
  100. package/dist/docx/server/templatePlan/labels.d.ts +16 -2
  101. package/dist/docx/server/templatePlan/labels.js +131 -20
  102. package/dist/docx/server/templatePlan/plan.d.ts +15 -1
  103. package/dist/docx/server/templatePlan/plan.js +62 -13
  104. package/dist/docx/server/templatePlan/planShape.js +52 -4
  105. package/dist/docx/server/templatePlan/story.d.ts +8 -0
  106. package/dist/docx/server/templatePlan/story.js +11 -1
  107. package/dist/docx/server/templatePlan/types.d.ts +176 -18
  108. package/dist/docx/server/templatePlan/types.js +1 -0
  109. package/dist/docx/server/templatePlan/verify.js +60 -11
  110. package/dist/docx/server/templatePlan/xml.d.ts +5 -0
  111. package/dist/docx/server/templatePlan/xml.js +7 -1
  112. package/dist/docx/storyBlockReplay.js +1 -1
  113. package/dist/docx/xmlParser.js +1 -1
  114. package/dist/i18n/loadMessages.d.ts +5 -0
  115. package/dist/i18n/loadMessages.js +46 -0
  116. package/dist/i18n/locales.d.ts +3 -0
  117. package/dist/i18n/locales.js +17 -0
  118. package/dist/i18n/messages/ar.gen.js +1 -0
  119. package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
  120. package/dist/i18n/messages/catalogs.gen.js +17 -0
  121. package/dist/i18n/messages/cs.gen.js +1 -0
  122. package/dist/i18n/messages/de.gen.js +1 -0
  123. package/dist/i18n/messages/en.gen.js +1 -0
  124. package/dist/i18n/messages/es.gen.js +1 -0
  125. package/dist/i18n/messages/et.gen.js +1 -0
  126. package/dist/i18n/messages/fr.gen.js +1 -0
  127. package/dist/i18n/messages/he.gen.js +1 -0
  128. package/dist/i18n/messages/hi.gen.js +1 -0
  129. package/dist/i18n/messages/hu.gen.js +1 -0
  130. package/dist/i18n/messages/lt.gen.js +1 -0
  131. package/dist/i18n/messages/lv.gen.js +1 -0
  132. package/dist/i18n/messages/messages.gen.d.ts +1 -0
  133. package/dist/i18n/messages/pl.gen.js +1 -0
  134. package/dist/i18n/messages/pt-BR.gen.js +1 -0
  135. package/dist/i18n/messages/sk.gen.js +1 -0
  136. package/dist/i18n/messages/tr.gen.js +1 -0
  137. package/dist/i18n/messages/zh-CN.gen.js +1 -0
  138. package/dist/i18n/messages.d.ts +3 -2
  139. package/dist/i18n/messages.js +4 -16
  140. package/dist/internal/clipboardTransformPlugin.d.ts +3 -0
  141. package/dist/internal/clipboardTransformPlugin.js +13 -0
  142. package/dist/internal/extensionRuntime.d.ts +7 -0
  143. package/dist/internal/extensionRuntime.js +28 -0
  144. package/dist/internal/paragraphFormattingSerialization.js +1 -1
  145. package/dist/internal/starterKitExtensions.d.ts +20 -0
  146. package/dist/internal/starterKitExtensions.js +123 -0
  147. package/dist/internal/wholeStoryRevisionResolution.js +2 -2
  148. package/dist/layout-bridge/convert/toFlowBlocks.js +0 -12
  149. package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
  150. package/dist/prosemirror/attrs/index.js +1 -1
  151. package/dist/prosemirror/canonicalSelectionRange.js +1 -1
  152. package/dist/prosemirror/canonicalTableCommands.js +1 -1
  153. package/dist/prosemirror/commands/comments.js +3 -3
  154. package/dist/prosemirror/commands/contentControls.js +1 -1
  155. package/dist/prosemirror/commands/pastePlainText.js +2 -3
  156. package/dist/prosemirror/commands/replaceRangeText.js +1 -1
  157. package/dist/prosemirror/commentRecords.js +2 -2
  158. package/dist/prosemirror/conversion/fromProseDoc.d.ts +0 -5
  159. package/dist/prosemirror/conversion/fromProseDoc.js +2 -9
  160. package/dist/prosemirror/conversion/index.d.ts +2 -2
  161. package/dist/prosemirror/conversion/index.js +2 -2
  162. package/dist/prosemirror/extensions/ExtensionManager.js +4 -22
  163. package/dist/prosemirror/extensions/StarterKit.d.ts +4 -27
  164. package/dist/prosemirror/extensions/StarterKit.js +29 -115
  165. package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -2
  166. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -1
  167. package/dist/prosemirror/extensions/features/ImagePasteExtension.js +1 -1
  168. package/dist/prosemirror/extensions/features/ListExtension.js +7 -2
  169. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
  170. package/dist/prosemirror/extensions/index.d.ts +2 -1
  171. package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +8 -3
  172. package/dist/prosemirror/extensions/nodes/TableExtension.js +7 -40
  173. package/dist/prosemirror/hyperlinkRemoval.js +7 -2
  174. package/dist/prosemirror/index.d.ts +2 -2
  175. package/dist/prosemirror/index.js +2 -2
  176. package/dist/prosemirror/keptRangeBoundaries.js +1 -1
  177. package/dist/prosemirror/listMarker.d.ts +1 -6
  178. package/dist/prosemirror/listMarker.js +4 -56
  179. package/dist/prosemirror/listNumbering.js +1 -1
  180. package/dist/prosemirror/noteReferenceOccurrences.js +1 -1
  181. package/dist/prosemirror/noteReferenceReview.d.ts +2 -56
  182. package/dist/prosemirror/noteReferenceReview.js +2 -243
  183. package/dist/prosemirror/pastedCommentCopies.js +1 -1
  184. package/dist/prosemirror/plugins/documentNumbering.js +1 -1
  185. package/dist/prosemirror/plugins/documentStyles.js +1 -1
  186. package/dist/prosemirror/replacedAnnotations.js +1 -1
  187. package/dist/prosemirror/suggestionCommands.d.ts +47 -0
  188. package/dist/prosemirror/suggestionCommands.js +31 -0
  189. package/dist/prosemirror/tableCellPaste.js +1 -1
  190. package/dist/prosemirror/tableRunIn.js +1 -1
  191. package/dist/prosemirror/textInput.js +1 -1
  192. package/dist/server.d.ts +2 -2
  193. package/dist/types/canonicalCapabilities.d.ts +42 -93
  194. package/dist/types/canonicalCapabilities.js +53 -91
  195. package/dist/types/canonicalComments.d.ts +2 -2
  196. package/dist/types/canonicalSections.d.ts +2 -2
  197. package/dist/utils/clipboard.d.ts +2 -28
  198. package/dist/utils/clipboard.js +1 -96
  199. package/dist/utils/clipboardFiles.d.ts +27 -0
  200. package/dist/utils/clipboardFiles.js +98 -0
  201. package/dist/utils/rulerControl.d.ts +1 -0
  202. package/dist/utils/rulerControl.js +2 -1
  203. package/package.json +2 -2
  204. package/dist/ai-edits/apply.d.ts +0 -94
  205. package/dist/ai-edits/apply.js +0 -6637
  206. package/dist/ai-edits/note-story-inventory.d.ts +0 -5
  207. package/dist/ai-edits/note-story-inventory.js +0 -10
  208. package/dist/ai-edits/revisionStretches.d.ts +0 -32
  209. package/dist/ai-edits/revisionStretches.js +0 -147
  210. package/dist/document-operations-apply.d.ts +0 -15
  211. package/dist/document-operations-apply.js +0 -280
  212. package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -12
  213. package/dist/prosemirror/extensions/core/HistoryExtension.js +0 -114
  214. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +0 -23
  215. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +0 -270
  216. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +0 -51
  217. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +0 -411
  218. package/dist/prosemirror/plugins/suggestionMode.d.ts +0 -92
  219. package/dist/prosemirror/plugins/suggestionMode.js +0 -1515
  220. package/dist/prosemirror/tablePositionedBookmarks.d.ts +0 -8
  221. package/dist/prosemirror/tablePositionedBookmarks.js +0 -80
@@ -1,20 +1,9 @@
1
1
  /** Remaining seams to retire before the canonical session becomes the only authority. */
2
2
  export declare const CANONICAL_GAP: {
3
- readonly authorityRouting: "authority-routing";
4
3
  readonly commands: "command-descriptors";
5
4
  readonly trackedTableStructure: "tracked-table-structure";
6
5
  readonly storyContentProjection: "story-content-projection";
7
- readonly comments: "comment-model-edits";
8
- readonly modelEdits: "direct-model-edits";
9
- readonly sectionProperties: "section-properties";
10
- readonly dispatch: "unclassified-transactions";
11
- readonly save: "pm-save-projection";
12
- readonly history: "pm-history";
13
- readonly suggestionPlugin: "pm-suggestion-plugin";
14
- readonly paragraphTracker: "pm-paragraph-tracker";
15
- readonly tableGeometry: "pm-table-geometry";
16
- readonly paragraphIdentity: "pm-paragraph-identity";
17
- readonly documentOperations: "pm-document-operations";
6
+ readonly trackedChangeRecords: "tracked-change-records";
18
7
  readonly publicComments: "publicOps.comments";
19
8
  readonly publicUnsupportedInline: "publicOps.unsupportedInline";
20
9
  readonly commentReplacementAlignment: "comment-replacement-alignment";
@@ -35,39 +24,63 @@ export declare const CANONICAL_RULE_MESSAGE_KEYS: {
35
24
  readonly contentControlLock: "editor.contentLocked";
36
25
  readonly linkSuggestionShape: "editor.linkSuggestionUnavailable";
37
26
  };
27
+ /**
28
+ * Conditions of the session or of the request, not of the document: the
29
+ * session holds the capability, but cannot make this change now or was not
30
+ * asked for one it can make. A refusal under one is correct and is never a gap
31
+ * to retire.
32
+ */
33
+ export declare const CANONICAL_CONDITION: {
34
+ readonly notReady: "notReady";
35
+ readonly notEditable: "notEditable";
36
+ readonly composing: "composing";
37
+ readonly invalidRequest: "invalidRequest";
38
+ readonly idSpace: "idSpace";
39
+ readonly stale: "stale";
40
+ readonly hostTransaction: "hostTransaction";
41
+ readonly internal: "internal";
42
+ };
43
+ export type CanonicalCondition = (typeof CANONICAL_CONDITION)[keyof typeof CANONICAL_CONDITION];
38
44
  /**
39
45
  * The editor message, in the folio catalog, a host shows for a refusal under
40
46
  * any gap: the change cannot be made here yet.
41
47
  */
42
48
  export declare const CANONICAL_GAP_MESSAGE_KEY: "editor.changeUnavailable";
49
+ /**
50
+ * The editor message, in the folio catalog, a host shows for a refusal under
51
+ * any condition: the change was not made.
52
+ */
53
+ export declare const CANONICAL_CONDITION_MESSAGE_KEY: "editor.changeNotApplied";
43
54
  /** A catalog key a refusal notice reads. */
44
- export type CanonicalRefusalMessageKey = (typeof CANONICAL_RULE_MESSAGE_KEYS)[CanonicalRule] | typeof CANONICAL_GAP_MESSAGE_KEY;
55
+ export type CanonicalRefusalMessageKey = (typeof CANONICAL_RULE_MESSAGE_KEYS)[CanonicalRule] | typeof CANONICAL_GAP_MESSAGE_KEY | typeof CANONICAL_CONDITION_MESSAGE_KEY;
45
56
  /**
46
57
  * What a host shows for a refusal, always from the folio catalog, which the
47
58
  * host translates: the editor's own message for a rule the document states,
48
- * and that the change cannot be made here yet for a gap. The session's own
49
- * message describes the refusal for logs and `onError`, never for the user.
59
+ * that the change was not made for a condition, and that the change cannot be
60
+ * made here yet for a gap. The session's own message describes the refusal
61
+ * for logs and `onError`, never for the user.
50
62
  */
51
63
  export declare const canonicalRefusalNotice: (ground: CanonicalRefusalGround, translate: (key: CanonicalRefusalMessageKey) => string) => string;
52
64
  /**
53
- * The ground for a refusal: a capability the session does not have yet, or a
54
- * rule the document or its review records state. A host tells "not supported yet" from "not
55
- * allowed" by which one is present.
65
+ * The ground for a refusal: a capability the session does not have yet, a
66
+ * rule the document or its review records state, or a condition of the
67
+ * session or the request. A host tells "not supported yet" from "not allowed"
68
+ * from "not now" by which one is present.
56
69
  */
57
70
  export type CanonicalRefusalGround = {
58
71
  gap: CanonicalGap;
59
72
  rule?: never;
73
+ condition?: never;
60
74
  } | {
61
75
  rule: CanonicalRule;
62
76
  gap?: never;
77
+ condition?: never;
78
+ } | {
79
+ condition: CanonicalCondition;
80
+ gap?: never;
81
+ rule?: never;
63
82
  };
64
83
  export declare const CANONICAL_CAPABILITIES: {
65
- readonly "authority-routing": {
66
- readonly owner: "controller";
67
- readonly kind: "routing";
68
- readonly adapters: readonly ["react", "vue"];
69
- readonly summary: "Explicit session selection and legacy authority routing.";
70
- };
71
84
  readonly "command-descriptors": {
72
85
  readonly remainingCommands: {
73
86
  readonly registry: "extension-commands";
@@ -89,83 +102,20 @@ export declare const CANONICAL_CAPABILITIES: {
89
102
  readonly adapters: readonly ["react", "vue"];
90
103
  readonly summary: "Unsupported inline, field and review content cannot be projected after canonical edits; pasted embedded blocks, comment and note references copied outside the editor, and compositions over such content refuse.";
91
104
  };
92
- readonly "comment-model-edits": {
93
- readonly owner: "adapters";
94
- readonly kind: "routing";
95
- readonly adapters: readonly ["react", "vue"];
96
- readonly summary: "Legacy sessions retain comment model edits; canonical comments use semantic operations.";
97
- };
98
- readonly "direct-model-edits": {
99
- readonly owner: "adapters";
100
- readonly kind: "refusal";
101
- readonly adapters: readonly ["react", "vue"];
102
- readonly summary: "Direct model and pending-suggestion snapshots bypass the canonical journal.";
103
- };
104
- readonly "section-properties": {
105
- readonly owner: "controller";
106
- readonly kind: "routing";
107
- readonly adapters: readonly ["react", "vue"];
108
- readonly summary: "The shared controller journals section properties; legacy sessions keep model changes.";
109
- };
110
- readonly "unclassified-transactions": {
111
- readonly owner: "controller";
112
- readonly kind: "refusal";
113
- readonly adapters: readonly ["react", "vue"];
114
- readonly summary: "A host plugin or raw dispatch that changes the document is refused, naming the transaction's meta keys; hosts express edits as document operations (applyDocumentOperations).";
115
- };
116
- readonly "pm-save-projection": {
117
- readonly owner: "controller";
118
- readonly kind: "routing";
119
- readonly adapters: readonly ["react", "vue"];
120
- readonly summary: "Legacy save and read paths reconstruct documents from PM.";
121
- };
122
- readonly "pm-history": {
123
- readonly owner: "prosemirror";
124
- readonly kind: "mutation-source";
125
- readonly adapters: readonly ["react", "vue"];
126
- readonly summary: "PM history remains installed for legacy sessions.";
127
- };
128
- readonly "pm-suggestion-plugin": {
129
- readonly owner: "prosemirror";
130
- readonly kind: "mutation-source";
131
- readonly adapters: readonly ["react", "vue"];
132
- readonly summary: "The legacy suggestion plugin produces PM transactions.";
133
- };
134
- readonly "pm-paragraph-tracker": {
135
- readonly owner: "prosemirror";
136
- readonly kind: "mutation-source";
137
- readonly adapters: readonly ["react", "vue"];
138
- readonly summary: "Dirty tracking and section bookkeeping still observe PM transactions.";
139
- };
140
- readonly "pm-table-geometry": {
141
- readonly owner: "prosemirror";
142
- readonly kind: "mutation-source";
143
- readonly adapters: readonly ["react", "vue"];
144
- readonly summary: "Table geometry, resize and repair still produce PM transactions.";
145
- };
146
- readonly "pm-paragraph-identity": {
147
- readonly owner: "prosemirror";
148
- readonly kind: "mutation-source";
149
- readonly adapters: readonly ["react", "vue"];
150
- readonly summary: "Legacy paragraph identity repair remains a PM append transaction.";
151
- };
152
- readonly "pm-document-operations": {
105
+ readonly "tracked-change-records": {
153
106
  readonly owner: "document-operations";
154
- readonly legacySessionMutation: "pm-public-operations";
155
- readonly kind: "mutation-source";
107
+ readonly kind: "refusal";
156
108
  readonly adapters: readonly ["react", "vue"];
157
- readonly summary: "Public document operations still execute against a held PM view.";
109
+ readonly summary: "A suggested change whose content the tracked-change records cannot express is refused: comment boundaries in a tracked range, paragraph-mark run properties, a join at a section break, a record inside a field.";
158
110
  };
159
111
  readonly "publicOps.comments": {
160
112
  readonly owner: "document-operations";
161
- readonly legacySessionMutation: "pm-public-operations";
162
- readonly kind: "routing";
113
+ readonly kind: "refusal";
163
114
  readonly adapters: readonly ["react", "vue"];
164
- readonly summary: "Canonical public comments compile to semantic operations; legacy sessions retain PM comments.";
115
+ readonly summary: "Public comment edits refuse when their anchors or revision structure cannot be represented.";
165
116
  };
166
117
  readonly "publicOps.unsupportedInline": {
167
118
  readonly owner: "document-operations";
168
- readonly legacySessionMutation: "pm-public-operations";
169
119
  readonly kind: "refusal";
170
120
  readonly adapters: readonly ["react", "vue"];
171
121
  readonly summary: "Unsupported public payloads refuse with a typed compiler capability gap.";
@@ -178,7 +128,6 @@ export declare const CANONICAL_CAPABILITIES: {
178
128
  };
179
129
  readonly "publicOps.headlessSession": {
180
130
  readonly owner: "document-operations";
181
- readonly legacySessionMutation: "canonical";
182
131
  readonly kind: "refusal";
183
132
  readonly adapters: readonly ["react", "vue"];
184
133
  readonly summary: "A reviewer refuses to resolve one story of a suggestion that reaches several, which resolves only whole.";
@@ -1,21 +1,10 @@
1
1
  // src/types/canonicalCapabilities.ts
2
2
  /** Remaining seams to retire before the canonical session becomes the only authority. */
3
3
  const CANONICAL_GAP = {
4
- authorityRouting: "authority-routing",
5
4
  commands: "command-descriptors",
6
5
  trackedTableStructure: "tracked-table-structure",
7
6
  storyContentProjection: "story-content-projection",
8
- comments: "comment-model-edits",
9
- modelEdits: "direct-model-edits",
10
- sectionProperties: "section-properties",
11
- dispatch: "unclassified-transactions",
12
- save: "pm-save-projection",
13
- history: "pm-history",
14
- suggestionPlugin: "pm-suggestion-plugin",
15
- paragraphTracker: "pm-paragraph-tracker",
16
- tableGeometry: "pm-table-geometry",
17
- paragraphIdentity: "pm-paragraph-identity",
18
- documentOperations: "pm-document-operations",
7
+ trackedChangeRecords: "tracked-change-records",
19
8
  publicComments: "publicOps.comments",
20
9
  publicUnsupportedInline: "publicOps.unsupportedInline",
21
10
  commentReplacementAlignment: "comment-replacement-alignment",
@@ -42,24 +31,61 @@ const CANONICAL_RULE_MESSAGE_KEYS = {
42
31
  linkSuggestionShape: "editor.linkSuggestionUnavailable"
43
32
  };
44
33
  /**
34
+ * Conditions of the session or of the request, not of the document: the
35
+ * session holds the capability, but cannot make this change now or was not
36
+ * asked for one it can make. A refusal under one is correct and is never a gap
37
+ * to retire.
38
+ */
39
+ const CANONICAL_CONDITION = {
40
+ /** No session holds a document yet, or the editor showing it has closed. */
41
+ notReady: "notReady",
42
+ /** The editor is read-only. */
43
+ notEditable: "notEditable",
44
+ /** An input composition must finish first. */
45
+ composing: "composing",
46
+ /**
47
+ * The request names nothing in the document or describes no change the
48
+ * document allows, such as a reply to a missing comment.
49
+ */
50
+ invalidRequest: "invalidRequest",
51
+ /** No id is left to mint, in the document or in this author's lease. */
52
+ idSpace: "idSpace",
53
+ /** The projection, version or lease the change was prepared against moved on. */
54
+ stale: "stale",
55
+ /**
56
+ * A plugin or raw dispatch changed the document outside document
57
+ * operations; hosts express edits through `applyDocumentOperations`.
58
+ */
59
+ hostTransaction: "hostTransaction",
60
+ /**
61
+ * The session failed to project or stage the change: a defect to report,
62
+ * not a missing capability.
63
+ */
64
+ internal: "internal"
65
+ };
66
+ /**
45
67
  * The editor message, in the folio catalog, a host shows for a refusal under
46
68
  * any gap: the change cannot be made here yet.
47
69
  */
48
70
  const CANONICAL_GAP_MESSAGE_KEY = "editor.changeUnavailable";
49
71
  /**
72
+ * The editor message, in the folio catalog, a host shows for a refusal under
73
+ * any condition: the change was not made.
74
+ */
75
+ const CANONICAL_CONDITION_MESSAGE_KEY = "editor.changeNotApplied";
76
+ /**
50
77
  * What a host shows for a refusal, always from the folio catalog, which the
51
78
  * host translates: the editor's own message for a rule the document states,
52
- * and that the change cannot be made here yet for a gap. The session's own
53
- * message describes the refusal for logs and `onError`, never for the user.
79
+ * that the change was not made for a condition, and that the change cannot be
80
+ * made here yet for a gap. The session's own message describes the refusal
81
+ * for logs and `onError`, never for the user.
54
82
  */
55
- const canonicalRefusalNotice = (ground, translate) => translate(ground.rule === void 0 ? CANONICAL_GAP_MESSAGE_KEY : CANONICAL_RULE_MESSAGE_KEYS[ground.rule]);
83
+ const canonicalRefusalNotice = (ground, translate) => {
84
+ if (ground.rule !== void 0) return translate(CANONICAL_RULE_MESSAGE_KEYS[ground.rule]);
85
+ if (ground.condition !== void 0) return translate(CANONICAL_CONDITION_MESSAGE_KEY);
86
+ return translate(CANONICAL_GAP_MESSAGE_KEY);
87
+ };
56
88
  const CANONICAL_CAPABILITIES = {
57
- [CANONICAL_GAP.authorityRouting]: {
58
- owner: "controller",
59
- kind: "routing",
60
- adapters: ["react", "vue"],
61
- summary: "Explicit session selection and legacy authority routing."
62
- },
63
89
  [CANONICAL_GAP.commands]: {
64
90
  remainingCommands: { registry: "extension-commands" },
65
91
  owner: "controller",
@@ -79,83 +105,20 @@ const CANONICAL_CAPABILITIES = {
79
105
  adapters: ["react", "vue"],
80
106
  summary: "Unsupported inline, field and review content cannot be projected after canonical edits; pasted embedded blocks, comment and note references copied outside the editor, and compositions over such content refuse."
81
107
  },
82
- [CANONICAL_GAP.comments]: {
83
- owner: "adapters",
84
- kind: "routing",
85
- adapters: ["react", "vue"],
86
- summary: "Legacy sessions retain comment model edits; canonical comments use semantic operations."
87
- },
88
- [CANONICAL_GAP.modelEdits]: {
89
- owner: "adapters",
90
- kind: "refusal",
91
- adapters: ["react", "vue"],
92
- summary: "Direct model and pending-suggestion snapshots bypass the canonical journal."
93
- },
94
- [CANONICAL_GAP.sectionProperties]: {
95
- owner: "controller",
96
- kind: "routing",
97
- adapters: ["react", "vue"],
98
- summary: "The shared controller journals section properties; legacy sessions keep model changes."
99
- },
100
- [CANONICAL_GAP.dispatch]: {
101
- owner: "controller",
102
- kind: "refusal",
103
- adapters: ["react", "vue"],
104
- summary: "A host plugin or raw dispatch that changes the document is refused, naming the transaction's meta keys; hosts express edits as document operations (applyDocumentOperations)."
105
- },
106
- [CANONICAL_GAP.save]: {
107
- owner: "controller",
108
- kind: "routing",
109
- adapters: ["react", "vue"],
110
- summary: "Legacy save and read paths reconstruct documents from PM."
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]: {
108
+ [CANONICAL_GAP.trackedChangeRecords]: {
143
109
  owner: "document-operations",
144
- legacySessionMutation: "pm-public-operations",
145
- kind: "mutation-source",
110
+ kind: "refusal",
146
111
  adapters: ["react", "vue"],
147
- summary: "Public document operations still execute against a held PM view."
112
+ summary: "A suggested change whose content the tracked-change records cannot express is refused: comment boundaries in a tracked range, paragraph-mark run properties, a join at a section break, a record inside a field."
148
113
  },
149
114
  [CANONICAL_GAP.publicComments]: {
150
115
  owner: "document-operations",
151
- legacySessionMutation: "pm-public-operations",
152
- kind: "routing",
116
+ kind: "refusal",
153
117
  adapters: ["react", "vue"],
154
- summary: "Canonical public comments compile to semantic operations; legacy sessions retain PM comments."
118
+ summary: "Public comment edits refuse when their anchors or revision structure cannot be represented."
155
119
  },
156
120
  [CANONICAL_GAP.publicUnsupportedInline]: {
157
121
  owner: "document-operations",
158
- legacySessionMutation: "pm-public-operations",
159
122
  kind: "refusal",
160
123
  adapters: ["react", "vue"],
161
124
  summary: "Unsupported public payloads refuse with a typed compiler capability gap."
@@ -168,11 +131,10 @@ const CANONICAL_CAPABILITIES = {
168
131
  },
169
132
  [CANONICAL_GAP.publicHeadlessSession]: {
170
133
  owner: "document-operations",
171
- legacySessionMutation: "canonical",
172
134
  kind: "refusal",
173
135
  adapters: ["react", "vue"],
174
136
  summary: "A reviewer refuses to resolve one story of a suggestion that reaches several, which resolves only whole."
175
137
  }
176
138
  };
177
139
  const canonicalRefusalMessage = (gap, message) => `[${gap}] ${message}`;
178
- export { CANONICAL_CAPABILITIES, CANONICAL_GAP, CANONICAL_GAP_MESSAGE_KEY, CANONICAL_RULE, CANONICAL_RULE_MESSAGE_KEYS, canonicalRefusalMessage, canonicalRefusalNotice };
140
+ export { CANONICAL_CAPABILITIES, CANONICAL_CONDITION, CANONICAL_CONDITION_MESSAGE_KEY, CANONICAL_GAP, CANONICAL_GAP_MESSAGE_KEY, CANONICAL_RULE, CANONICAL_RULE_MESSAGE_KEYS, canonicalRefusalMessage, canonicalRefusalNotice };
@@ -1,4 +1,4 @@
1
- import { CanonicalGap } from "./canonicalCapabilities.js";
1
+ import { CanonicalRefusalGround } from "./canonicalCapabilities.js";
2
2
  import { Comment } from "./content.js";
3
3
  import { OpStory } from "@stll/docx-core/ops";
4
4
  /** Requests name their anchor; comment metadata never creates an unanchored root. */
@@ -41,7 +41,7 @@ export type CanonicalCommentResult = {
41
41
  commentId?: number;
42
42
  } | {
43
43
  status: "refused";
44
- gap: CanonicalGap;
44
+ ground: CanonicalRefusalGround;
45
45
  message: string;
46
46
  /** Whether the same request can succeed once a pending composition settles. */
47
47
  retry: "afterComposition" | "never";
@@ -1,9 +1,9 @@
1
- import { CANONICAL_GAP } from "./canonicalCapabilities.js";
1
+ import { CanonicalRefusalGround } from "./canonicalCapabilities.js";
2
2
  export type CanonicalSectionPropertiesResult = {
3
3
  status: "applied";
4
4
  version: number;
5
5
  } | {
6
6
  status: "refused";
7
- gap: typeof CANONICAL_GAP.sectionProperties;
7
+ ground: CanonicalRefusalGround;
8
8
  message: string;
9
9
  };
@@ -1,4 +1,5 @@
1
1
  import { document_d_exports } from "../types/document.js";
2
+ import { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, getClipboardImageFiles, getStandaloneClipboardImageFiles } from "./clipboardFiles.js";
2
3
  /**
3
4
  * Clipboard content format
4
5
  */
@@ -34,33 +35,6 @@ export type ClipboardOptions = {
34
35
  /** Callback for handling errors */
35
36
  onError?: (error: Error) => void;
36
37
  };
37
- /**
38
- * Custom MIME type for internal clipboard format
39
- */
40
- export declare const INTERNAL_CLIPBOARD_TYPE = "application/x-stella-folio";
41
- /**
42
- * Standard clipboard MIME types
43
- */
44
- export declare const CLIPBOARD_TYPES: {
45
- readonly HTML: "text/html";
46
- readonly PLAIN: "text/plain";
47
- };
48
- /**
49
- * Extract image files from clipboard data (if present).
50
- */
51
- type ClipboardDataLike = {
52
- files?: FileList | readonly File[] | undefined;
53
- getData?: ((format: string) => string) | undefined;
54
- items?: DataTransferItemList | readonly DataTransferItem[] | undefined;
55
- types?: ArrayLike<string> | undefined;
56
- };
57
- export declare function getClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];
58
- /**
59
- * Return image files only when the clipboard has no readable editor content.
60
- * Rich HTML, internal payloads, and plain text must stay on the normal paste
61
- * path; some applications include a rendered image beside that content.
62
- */
63
- export declare function getStandaloneClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];
64
38
  /**
65
39
  * Copy runs to clipboard with formatting
66
40
  */
@@ -147,4 +121,4 @@ declare const _default_1: {
147
121
  isEditorHtml: typeof isEditorHtml;
148
122
  createClipboardHandlers: typeof createClipboardHandlers;
149
123
  };
150
- export { _default_1 as default };
124
+ export { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, _default_1 as default, getClipboardImageFiles, getStandaloneClipboardImageFiles };
@@ -1,3 +1,4 @@
1
+ import { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, getClipboardImageFiles, getStandaloneClipboardImageFiles } from "./clipboardFiles.js";
1
2
  import { htmlCommentEnd } from "./htmlComments.js";
2
3
  import { stripXmlDeclarations } from "./stripXmlDeclarations.js";
3
4
  import { encodeUtf8, readBlobText } from "./textEncoding.js";
@@ -15,17 +16,6 @@ import createDOMPurify from "dompurify";
15
16
  */
16
17
  let domPurify;
17
18
  const getDomPurify = () => domPurify ??= createDOMPurify(window);
18
- /**
19
- * Custom MIME type for internal clipboard format
20
- */
21
- const INTERNAL_CLIPBOARD_TYPE = "application/x-stella-folio";
22
- /**
23
- * Standard clipboard MIME types
24
- */
25
- const CLIPBOARD_TYPES = {
26
- HTML: "text/html",
27
- PLAIN: "text/plain"
28
- };
29
19
  const SKIPPED_CLIPBOARD_ELEMENTS = /* @__PURE__ */ new Set([
30
20
  "script",
31
21
  "style",
@@ -35,91 +25,6 @@ const SKIPPED_CLIPBOARD_ELEMENTS = /* @__PURE__ */ new Set([
35
25
  "svg",
36
26
  "math"
37
27
  ]);
38
- function getClipboardImageFiles(clipboardData) {
39
- if (!clipboardData) return [];
40
- const collectFromItems = () => {
41
- const items = clipboardData.items;
42
- if (!items || items.length === 0) return [];
43
- const files = [];
44
- for (const item of Array.from(items)) {
45
- if (item.kind !== "file") continue;
46
- if (!item.type.startsWith("image/")) continue;
47
- const file = item.getAsFile();
48
- if (file) files.push(file);
49
- }
50
- return files;
51
- };
52
- const collectFromFiles = () => {
53
- const clipboardFiles = clipboardData.files;
54
- if (!clipboardFiles || clipboardFiles.length === 0) return [];
55
- return Array.from(clipboardFiles).filter((file) => file.type.startsWith("image/"));
56
- };
57
- const candidates = collectFromItems();
58
- const files = candidates.length ? candidates : collectFromFiles();
59
- if (files.length <= 1) return files;
60
- const preferredTypes = [
61
- "image/png",
62
- "image/jpeg",
63
- "image/webp",
64
- "image/gif",
65
- "image/svg+xml",
66
- "image/bmp",
67
- "image/tiff"
68
- ];
69
- const pickBest = (group) => {
70
- let best = group[0];
71
- let bestRank = preferredTypes.indexOf(best.type);
72
- if (bestRank < 0) bestRank = Number.MAX_SAFE_INTEGER;
73
- for (const file of group.slice(1)) {
74
- let rank = preferredTypes.indexOf(file.type);
75
- if (rank < 0) rank = Number.MAX_SAFE_INTEGER;
76
- if (rank < bestRank) {
77
- best = file;
78
- bestRank = rank;
79
- continue;
80
- }
81
- if (rank === bestRank && file.size > best.size) best = file;
82
- }
83
- return best;
84
- };
85
- const groups = /* @__PURE__ */ new Map();
86
- for (const file of files) {
87
- const rawName = file.name.trim();
88
- const key = (rawName ? rawName.replace(/\.[^/.]+$/, "").toLowerCase() : "") || `size:${file.size}`;
89
- const bucket = groups.get(key);
90
- if (bucket) bucket.push(file);
91
- else groups.set(key, [file]);
92
- }
93
- const deduped = [];
94
- for (const group of groups.values()) deduped.push(pickBest(group));
95
- return deduped;
96
- }
97
- const ENGINE_CLIPBOARD_TYPES = [
98
- INTERNAL_CLIPBOARD_TYPE,
99
- CLIPBOARD_TYPES.HTML,
100
- CLIPBOARD_TYPES.PLAIN
101
- ];
102
- const hasEngineClipboardContent = (clipboardData) => {
103
- if (!clipboardData.types || !clipboardData.getData) return false;
104
- const availableTypes = new Set(Array.from(clipboardData.types));
105
- for (const type of ENGINE_CLIPBOARD_TYPES) {
106
- if (!availableTypes.has(type)) continue;
107
- try {
108
- if (clipboardData.getData(type) !== "") return true;
109
- } catch {}
110
- }
111
- return false;
112
- };
113
- /**
114
- * Return image files only when the clipboard has no readable editor content.
115
- * Rich HTML, internal payloads, and plain text must stay on the normal paste
116
- * path; some applications include a rendered image beside that content.
117
- */
118
- function getStandaloneClipboardImageFiles(clipboardData) {
119
- const imageFiles = getClipboardImageFiles(clipboardData);
120
- if (imageFiles.length === 0 || !clipboardData) return imageFiles;
121
- return hasEngineClipboardContent(clipboardData) ? [] : imageFiles;
122
- }
123
28
  /**
124
29
  * Copy runs to clipboard with formatting
125
30
  */
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Custom MIME type for internal clipboard format
3
+ */
4
+ export declare const INTERNAL_CLIPBOARD_TYPE = "application/x-stella-folio";
5
+ /**
6
+ * Standard clipboard MIME types
7
+ */
8
+ export declare const CLIPBOARD_TYPES: {
9
+ readonly HTML: "text/html";
10
+ readonly PLAIN: "text/plain";
11
+ };
12
+ /**
13
+ * Extract image files from clipboard data (if present).
14
+ */
15
+ export type ClipboardDataLike = {
16
+ files?: FileList | readonly File[] | undefined;
17
+ getData?: ((format: string) => string) | undefined;
18
+ items?: DataTransferItemList | readonly DataTransferItem[] | undefined;
19
+ types?: ArrayLike<string> | undefined;
20
+ };
21
+ export declare function getClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];
22
+ /**
23
+ * Return image files only when the clipboard has no readable editor content.
24
+ * Rich HTML, internal payloads, and plain text must stay on the normal paste
25
+ * path; some applications include a rendered image beside that content.
26
+ */
27
+ export declare function getStandaloneClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];