@stll/folio-core 0.74.0 → 0.76.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 (174) 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 +7 -3
  4. package/dist/ai-edits/headless.js +36 -21
  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 +135 -90
  9. package/dist/ai-edits/pendingJoin.d.ts +5 -1
  10. package/dist/ai-edits/pendingJoin.js +6 -2
  11. package/dist/ai-edits/read.js +9 -3
  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/tracked-batch-fidelity.d.ts +6 -10
  15. package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
  16. package/dist/ai-edits/types.d.ts +9 -4
  17. package/dist/canonical/batchCommentReferences.js +2 -1
  18. package/dist/canonical/canonicalBatchReview.d.ts +4 -1
  19. package/dist/canonical/canonicalBatchReview.js +37 -22
  20. package/dist/canonical/canonicalComments.d.ts +6 -2
  21. package/dist/canonical/canonicalComments.js +16 -6
  22. package/dist/canonical/canonicalCompilerRefusal.d.ts +2 -4
  23. package/dist/canonical/canonicalCompilerRefusal.js +20 -14
  24. package/dist/canonical/canonicalPublicOperations.js +231 -79
  25. package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
  26. package/dist/canonical/canonicalRefusalGrounds.js +56 -0
  27. package/dist/canonical/canonicalSession.d.ts +12 -6
  28. package/dist/canonical/canonicalSession.js +119 -122
  29. package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
  30. package/dist/compare/inline-atoms.d.ts +35 -41
  31. package/dist/compare/inline-atoms.js +2 -465
  32. package/dist/compare/section-boundary-properties.d.ts +3 -30
  33. package/dist/compare/section-boundary-properties.js +4 -72
  34. package/dist/controller/canonicalClipboard.d.ts +1 -1
  35. package/dist/controller/canonicalClipboard.js +110 -55
  36. package/dist/controller/canonicalComposition.d.ts +1 -1
  37. package/dist/controller/canonicalComposition.js +5 -5
  38. package/dist/controller/canonicalContentControlValue.js +7 -7
  39. package/dist/controller/canonicalInput.d.ts +4 -2
  40. package/dist/controller/canonicalInput.js +33 -16
  41. package/dist/controller/canonicalReview.d.ts +21 -0
  42. package/dist/controller/canonicalReview.js +44 -9
  43. package/dist/controller/canonicalStoryEditor.d.ts +2 -3
  44. package/dist/controller/canonicalStoryEditor.js +43 -25
  45. package/dist/controller/canonicalStructure.d.ts +19 -3
  46. package/dist/controller/canonicalStructure.js +182 -58
  47. package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
  48. package/dist/controller/deferredDisplayListPainter.js +34 -0
  49. package/dist/controller/folioEditor.js +4 -2
  50. package/dist/controller/fontReadiness.js +50 -23
  51. package/dist/controller/headerFooterEditorManager.js +3 -17
  52. package/dist/controller/hiddenEditorApi.d.ts +24 -3
  53. package/dist/controller/hiddenEditorApi.js +2 -0
  54. package/dist/controller/hiddenEditorManager.js +135 -207
  55. package/dist/controller/layoutPipeline.d.ts +4 -86
  56. package/dist/controller/layoutPipeline.js +8 -727
  57. package/dist/controller/layoutPipelineExecution.d.ts +94 -0
  58. package/dist/controller/layoutPipelineExecution.js +730 -0
  59. package/dist/controller/noteEditorManager.js +3 -16
  60. package/dist/docx/blockContentParser.d.ts +1 -3
  61. package/dist/docx/blockContentParser.js +3 -10
  62. package/dist/docx/bulletMarkers.d.ts +8 -0
  63. package/dist/docx/bulletMarkers.js +9 -1
  64. package/dist/docx/canonicalSave.d.ts +4 -3
  65. package/dist/docx/canonicalSave.js +4 -3
  66. package/dist/docx/canonicalSessionInput.js +25 -11
  67. package/dist/docx/ensureParaIds.d.ts +31 -0
  68. package/dist/docx/ensureParaIds.js +57 -32
  69. package/dist/docx/ensureUniqueControlIds.d.ts +13 -0
  70. package/dist/docx/ensureUniqueControlIds.js +47 -29
  71. package/dist/docx/ensureUniqueRevisionIds.d.ts +13 -0
  72. package/dist/docx/ensureUniqueRevisionIds.js +52 -29
  73. package/dist/docx/listMarkerComputation.d.ts +24 -17
  74. package/dist/docx/listMarkerComputation.js +31 -60
  75. package/dist/docx/listModelNormalization.js +8 -15
  76. package/dist/docx/rezip.d.ts +16 -3
  77. package/dist/docx/rezip.js +35 -9
  78. package/dist/docx/selectiveSave.js +13 -5
  79. package/dist/docx/server/templatePlan/apply.js +96 -7
  80. package/dist/docx/server/templatePlan/blocks.d.ts +70 -3
  81. package/dist/docx/server/templatePlan/blocks.js +272 -10
  82. package/dist/docx/server/templatePlan/builders.d.ts +52 -2
  83. package/dist/docx/server/templatePlan/builders.js +224 -5
  84. package/dist/docx/server/templatePlan/effects.d.ts +27 -0
  85. package/dist/docx/server/templatePlan/effects.js +188 -0
  86. package/dist/docx/server/templatePlan/emit.d.ts +4 -1
  87. package/dist/docx/server/templatePlan/emit.js +46 -2
  88. package/dist/docx/server/templatePlan/inspect.js +39 -52
  89. package/dist/docx/server/templatePlan/labels.d.ts +7 -2
  90. package/dist/docx/server/templatePlan/labels.js +120 -23
  91. package/dist/docx/server/templatePlan/plan.d.ts +24 -3
  92. package/dist/docx/server/templatePlan/plan.js +54 -15
  93. package/dist/docx/server/templatePlan/planShape.js +76 -22
  94. package/dist/docx/server/templatePlan/revisions.d.ts +46 -0
  95. package/dist/docx/server/templatePlan/revisions.js +407 -0
  96. package/dist/docx/server/templatePlan/story.d.ts +23 -1
  97. package/dist/docx/server/templatePlan/story.js +60 -2
  98. package/dist/docx/server/templatePlan/types.d.ts +354 -16
  99. package/dist/docx/server/templatePlan/verify.js +164 -14
  100. package/dist/docx/server/templatePlan/xml.d.ts +3 -0
  101. package/dist/docx/server/templatePlan/xml.js +4 -1
  102. package/dist/i18n/messages/ar.gen.js +1 -0
  103. package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
  104. package/dist/i18n/messages/catalogs.gen.js +17 -0
  105. package/dist/i18n/messages/cs.gen.js +1 -0
  106. package/dist/i18n/messages/de.gen.js +1 -0
  107. package/dist/i18n/messages/en.gen.js +1 -0
  108. package/dist/i18n/messages/es.gen.js +1 -0
  109. package/dist/i18n/messages/et.gen.js +1 -0
  110. package/dist/i18n/messages/fr.gen.js +1 -0
  111. package/dist/i18n/messages/he.gen.js +1 -0
  112. package/dist/i18n/messages/hi.gen.js +1 -0
  113. package/dist/i18n/messages/hu.gen.js +1 -0
  114. package/dist/i18n/messages/lt.gen.js +1 -0
  115. package/dist/i18n/messages/lv.gen.js +1 -0
  116. package/dist/i18n/messages/messages.gen.d.ts +1 -0
  117. package/dist/i18n/messages/pl.gen.js +1 -0
  118. package/dist/i18n/messages/pt-BR.gen.js +1 -0
  119. package/dist/i18n/messages/sk.gen.js +1 -0
  120. package/dist/i18n/messages/tr.gen.js +1 -0
  121. package/dist/i18n/messages/zh-CN.gen.js +1 -0
  122. package/dist/internal/revisionResolutionStep.d.ts +2 -31
  123. package/dist/internal/revisionResolutionStep.js +2 -171
  124. package/dist/layout-bridge/convert/toFlowBlocks.js +0 -12
  125. package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
  126. package/dist/prosemirror/commands/comments.d.ts +6 -234
  127. package/dist/prosemirror/commands/comments.js +5 -2464
  128. package/dist/prosemirror/commands/index.d.ts +4 -2
  129. package/dist/prosemirror/commands/index.js +4 -2
  130. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -11
  131. package/dist/prosemirror/commands/tableCellMergeResolution.js +3 -154
  132. package/dist/prosemirror/extensions/features/ImagePasteExtension.js +1 -1
  133. package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +6 -8
  134. package/dist/prosemirror/hyperlinkRemoval.d.ts +11 -8
  135. package/dist/prosemirror/hyperlinkRemoval.js +24 -15
  136. package/dist/prosemirror/listMarker.d.ts +1 -6
  137. package/dist/prosemirror/listMarker.js +4 -56
  138. package/dist/prosemirror/paraIds.d.ts +1 -14
  139. package/dist/prosemirror/paraIds.js +1 -14
  140. package/dist/prosemirror/paragraphMarkJoin.d.ts +0 -16
  141. package/dist/prosemirror/paragraphMarkJoin.js +3 -46
  142. package/dist/prosemirror/projectionReview.d.ts +49 -0
  143. package/dist/prosemirror/projectionReview.js +292 -0
  144. package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -13
  145. package/dist/prosemirror/rebaseParagraphRunFormatting.js +1 -16
  146. package/dist/prosemirror/replacedAnnotations.d.ts +2 -5
  147. package/dist/prosemirror/replacedAnnotations.js +1 -10
  148. package/dist/prosemirror/revisionCarriers.d.ts +9 -1
  149. package/dist/prosemirror/revisionCarriers.js +15 -1
  150. package/dist/prosemirror/revisionRangeQueries.d.ts +32 -0
  151. package/dist/prosemirror/revisionRangeQueries.js +76 -0
  152. package/dist/prosemirror/runFormattingMarkNames.d.ts +1 -1
  153. package/dist/prosemirror/runFormattingMarkNames.js +1 -1
  154. package/dist/prosemirror/suggestionQueries.d.ts +114 -0
  155. package/dist/prosemirror/suggestionQueries.js +320 -0
  156. package/dist/prosemirror/tableGridMutation.d.ts +1 -16
  157. package/dist/prosemirror/tableGridMutation.js +1 -78
  158. package/dist/prosemirror/tableRowRevisionOwnership.d.ts +18 -0
  159. package/dist/prosemirror/tableRowRevisionOwnership.js +7 -0
  160. package/dist/prosemirror/utils/extractTrackedChanges.js +14 -4
  161. package/dist/server.d.ts +2 -2
  162. package/dist/types/canonicalCapabilities.d.ts +40 -69
  163. package/dist/types/canonicalCapabilities.js +51 -65
  164. package/dist/types/canonicalComments.d.ts +2 -2
  165. package/dist/types/canonicalSections.d.ts +2 -2
  166. package/dist/utils/clipboard.d.ts +2 -28
  167. package/dist/utils/clipboard.js +1 -96
  168. package/dist/utils/clipboardFiles.d.ts +27 -0
  169. package/dist/utils/clipboardFiles.js +98 -0
  170. package/dist/utils/rulerControl.d.ts +1 -0
  171. package/dist/utils/rulerControl.js +2 -1
  172. package/package.json +2 -2
  173. package/dist/internal/headlessRevisionResolutionGuard.d.ts +0 -3
  174. package/dist/internal/headlessRevisionResolutionGuard.js +0 -18
@@ -0,0 +1,4 @@
1
+ import { CanonicalRefusalGround } from "../types/canonicalCapabilities.js";
2
+ import { DocumentOpRefusalReason } from "@stll/docx-core/ops";
3
+ /** The refusal ground a document operation refused for `reason` reports. */
4
+ export declare const groundForDocumentOpRefusal: (reason: DocumentOpRefusalReason) => CanonicalRefusalGround;
@@ -0,0 +1,56 @@
1
+ import { CANONICAL_CONDITION, CANONICAL_GAP, CANONICAL_RULE } from "../types/canonicalCapabilities.js";
2
+ // src/canonical/canonicalRefusalGrounds.ts
3
+ const STALE = { condition: CANONICAL_CONDITION.stale };
4
+ const INVALID_REQUEST = { condition: CANONICAL_CONDITION.invalidRequest };
5
+ /**
6
+ * The ground of every document operation refusal: a moved-on document is
7
+ * stale, an exhausted id space names it, a link suggestion review records
8
+ * cannot hold is the document's rule, content the tracked-change records
9
+ * cannot express is a gap, and every other reason describes a request the
10
+ * document does not allow.
11
+ */
12
+ const DOCUMENT_OP_REFUSAL_GROUNDS = {
13
+ unsupportedSchema: INVALID_REQUEST,
14
+ blockNotFound: INVALID_REQUEST,
15
+ invalidOperation: INVALID_REQUEST,
16
+ noChange: INVALID_REQUEST,
17
+ dependentRecords: INVALID_REQUEST,
18
+ invalidOffset: INVALID_REQUEST,
19
+ crossBlockRange: INVALID_REQUEST,
20
+ splitsSurrogatePair: INVALID_REQUEST,
21
+ invalidText: INVALID_REQUEST,
22
+ invalidBlockId: INVALID_REQUEST,
23
+ idCollision: INVALID_REQUEST,
24
+ notAdjacent: INVALID_REQUEST,
25
+ sectionBoundary: INVALID_REQUEST,
26
+ insideTrackedDeletion: INVALID_REQUEST,
27
+ needsNewIds: { condition: CANONICAL_CONDITION.idSpace },
28
+ invalidNewId: INVALID_REQUEST,
29
+ sharedId: INVALID_REQUEST,
30
+ stale: STALE,
31
+ structureMismatch: INVALID_REQUEST,
32
+ emptyContent: INVALID_REQUEST,
33
+ emptyBlockList: INVALID_REQUEST,
34
+ revisionConflict: INVALID_REQUEST,
35
+ pendingTableChange: INVALID_REQUEST,
36
+ pendingRunPropertyChange: INVALID_REQUEST,
37
+ pendingParagraphPropertyChange: INVALID_REQUEST,
38
+ joinIntoPendingTable: INVALID_REQUEST,
39
+ containerFinalMark: INVALID_REQUEST,
40
+ insideInlineControl: INVALID_REQUEST,
41
+ untrackable: { gap: CANONICAL_GAP.trackedChangeRecords },
42
+ pendingBreakTakeover: INVALID_REQUEST,
43
+ pendingParagraphMarkDeletion: INVALID_REQUEST,
44
+ pendingParagraphMarkInsertion: INVALID_REQUEST,
45
+ pendingParagraphJoin: INVALID_REQUEST,
46
+ pendingGridChange: INVALID_REQUEST,
47
+ unrecordableLinkSuggestion: { rule: CANONICAL_RULE.linkSuggestionShape },
48
+ missingBlockId: INVALID_REQUEST,
49
+ duplicateBlockId: INVALID_REQUEST,
50
+ duplicateRecordId: INVALID_REQUEST,
51
+ sectionsOutOfStep: STALE,
52
+ emptyRecord: INVALID_REQUEST
53
+ };
54
+ /** The refusal ground a document operation refused for `reason` reports. */
55
+ const groundForDocumentOpRefusal = (reason) => DOCUMENT_OP_REFUSAL_GROUNDS[reason];
56
+ export { groundForDocumentOpRefusal };
@@ -113,9 +113,11 @@ declare class CanonicalProjection {
113
113
  */
114
114
  heldAs(doc: Node): CanonicalProjection;
115
115
  private addressOf;
116
- /** The paragraph whose content holds `position`, its ends included. */
117
- /** Whether `position` lies in a text box's content. */
118
- private insideTextBox;
116
+ /**
117
+ * The paragraph whose content holds `position`, its ends included: a
118
+ * story paragraph, or one in a text box the story draws, which the
119
+ * projection lists after its host as the story's own.
120
+ */
119
121
  private paragraphAround;
120
122
  addressAt(position: number, edge?: CanonicalAddressEdge): Result<TextPosition, CanonicalSessionError>;
121
123
  /**
@@ -422,9 +424,11 @@ declare class CanonicalSession {
422
424
  * the edit happens at the start of the first, as the editor's own command
423
425
  * does over a cell selection. One commit, so one undo step.
424
426
  */
425
- prepareCellSelectionStructure(state: EditorState, structure: (at: TextPosition) => EditorIntent, { resourceOps, semantic }?: {
427
+ prepareCellSelectionStructure(state: EditorState, structure: (at: TextPosition) => EditorIntent, { resourceOps, semantic, story }?: {
426
428
  resourceOps?: readonly DocumentOp[];
427
429
  semantic?: CanonicalInputSemantic;
430
+ /** The story whose editor holds the cell selection. */
431
+ story?: OpStory;
428
432
  }): Result<CanonicalCommit, CanonicalSessionError>;
429
433
  prepareIntent(state: EditorState, intent: EditorIntent): Result<CanonicalCommit, CanonicalSessionError>;
430
434
  prepareIntents(state: EditorState, { intents, resourceOps, semantic }: {
@@ -448,8 +452,10 @@ declare class CanonicalSession {
448
452
  * the edit undoes both. Refused when no local edit is open.
449
453
  */
450
454
  prepareDerivedUpdate(state: EditorState, ops: readonly DocumentOp[]): Result<CanonicalCommit, CanonicalSessionError>;
451
- prepareSplit(state: EditorState): Result<CanonicalCommit, CanonicalSessionError>;
452
- prepareJoin(state: EditorState, direction: "backward" | "forward"): Result<CanonicalCommit, CanonicalSessionError>;
455
+ /** Split the paragraph at the selection of the editor showing `story`. */
456
+ prepareSplit(state: EditorState, story?: OpStory): Result<CanonicalCommit, CanonicalSessionError>;
457
+ /** Join the paragraph at the caret of the editor showing `story` with its neighbour. */
458
+ prepareJoin(state: EditorState, direction: "backward" | "forward", story?: OpStory): Result<CanonicalCommit, CanonicalSessionError>;
453
459
  prepareResolve(state: EditorState, { revisionIds, resolution, before }: {
454
460
  revisionIds: readonly number[];
455
461
  resolution: "accept" | "reject";