@stll/folio-core 0.71.1 → 0.73.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 (213) hide show
  1. package/README.md +14 -8
  2. package/dist/ai-edits/apply.d.ts +6 -114
  3. package/dist/ai-edits/apply.js +9 -131
  4. package/dist/ai-edits/applyTypes.d.ts +85 -0
  5. package/dist/ai-edits/applyTypes.js +24 -0
  6. package/dist/ai-edits/clean-text.d.ts +7 -1
  7. package/dist/ai-edits/clean-text.js +23 -2
  8. package/dist/ai-edits/finalSectionReview.d.ts +1 -1
  9. package/dist/ai-edits/headless.d.ts +29 -147
  10. package/dist/ai-edits/headless.js +213 -1634
  11. package/dist/ai-edits/index.d.ts +3 -3
  12. package/dist/ai-edits/index.js +2 -3
  13. package/dist/ai-edits/pending-suggestions.d.ts +14 -4
  14. package/dist/ai-edits/pending-suggestions.js +183 -90
  15. package/dist/ai-edits/result-validation.js +1 -1
  16. package/dist/ai-edits/retired-comment-receipts.d.ts +1 -1
  17. package/dist/ai-edits/snapshot.js +8 -3
  18. package/dist/ai-edits/table-cell-mutations.d.ts +1 -1
  19. package/dist/ai-edits/table-cell-mutations.js +1 -1
  20. package/dist/ai-edits/table-geometry.d.ts +1 -1
  21. package/dist/ai-edits/table-geometry.js +1 -1
  22. package/dist/ai-edits/table-row-column-mutations.d.ts +1 -1
  23. package/dist/ai-edits/table-row-column-mutations.js +1 -1
  24. package/dist/ai-edits/tableNodes.d.ts +38 -0
  25. package/dist/ai-edits/tableNodes.js +86 -0
  26. package/dist/ai-edits/tracked-batch-fidelity.d.ts +1 -1
  27. package/dist/ai-edits/undefinedReferences.d.ts +7 -0
  28. package/dist/canonical/batchCommentReferences.js +1 -0
  29. package/dist/canonical/canonicalInlineProjection.js +1 -1
  30. package/dist/canonical/canonicalPublicOperations.js +228 -64
  31. package/dist/canonical/canonicalSession.d.ts +9 -1
  32. package/dist/canonical/canonicalSession.js +95 -15
  33. package/dist/compare/compare.d.ts +1 -1
  34. package/dist/compare/inline-atoms-model.d.ts +1 -1
  35. package/dist/compare/inline-atoms.d.ts +2 -2
  36. package/dist/compare/inline-provenance-model.d.ts +1 -1
  37. package/dist/compare/inline-provenance.d.ts +2 -2
  38. package/dist/compat/eigenpal.d.ts +3 -4
  39. package/dist/compat/eigenpal.js +2 -4
  40. package/dist/controller/canonicalClipboard.d.ts +13 -3
  41. package/dist/controller/canonicalClipboard.js +185 -49
  42. package/dist/controller/canonicalClipboardResources.d.ts +9 -1
  43. package/dist/controller/canonicalClipboardResources.js +22 -2
  44. package/dist/controller/canonicalReview.d.ts +1 -1
  45. package/dist/controller/canonicalReview.js +1 -1
  46. package/dist/controller/canonicalStructure.js +1 -1
  47. package/dist/controller/canonicalWatermark.d.ts +10 -0
  48. package/dist/controller/canonicalWatermark.js +37 -0
  49. package/dist/controller/canonicalYjsRoom.d.ts +1 -1
  50. package/dist/controller/headerFooterEditorManager.d.ts +11 -7
  51. package/dist/controller/headerFooterEditorManager.js +39 -151
  52. package/dist/controller/hiddenEditorApi.d.ts +1 -1
  53. package/dist/controller/hiddenEditorManager.d.ts +6 -40
  54. package/dist/controller/hiddenEditorManager.js +173 -306
  55. package/dist/controller/noteEditorManager.d.ts +3 -10
  56. package/dist/controller/noteEditorManager.js +33 -206
  57. package/dist/document-operations-apply.d.ts +15 -0
  58. package/dist/document-operations-apply.js +280 -0
  59. package/dist/document-operations.d.ts +1 -14
  60. package/dist/document-operations.js +2 -279
  61. package/dist/docx/modelValidation.js +1 -1
  62. package/dist/docx/paragraphParser.js +2 -2
  63. package/dist/docx/paragraphPropertySource.d.ts +1 -1
  64. package/dist/docx/reviewResolutionProvenance.d.ts +3 -2
  65. package/dist/docx/reviewResolutionProvenance.js +32 -9
  66. package/dist/docx/revisionIdNormalization.js +30 -7
  67. package/dist/docx/rezip.js +1 -1
  68. package/dist/docx/serializer/borderSerializer.js +1 -1
  69. package/dist/docx/serializer/commentSerializer.js +1 -1
  70. package/dist/docx/serializer/documentSerializer.js +1 -1
  71. package/dist/docx/serializer/paragraphSerializer.js +3 -3
  72. package/dist/docx/serializer/runSerializer.js +1 -1
  73. package/dist/docx/serializer/sectionPropertiesSerializer.js +1 -1
  74. package/dist/docx/serializer/tableSerializer.js +5 -37
  75. package/dist/docx/serializer/textFormattingSerializer.js +1 -1
  76. package/dist/docx/serializer/trackedChangeAttributes.js +1 -1
  77. package/dist/docx/server/templatePlan/apply.d.ts +15 -0
  78. package/dist/docx/server/templatePlan/apply.js +600 -0
  79. package/dist/docx/server/templatePlan/blocks.d.ts +97 -0
  80. package/dist/docx/server/templatePlan/blocks.js +355 -0
  81. package/dist/docx/server/templatePlan/builders.d.ts +72 -0
  82. package/dist/docx/server/templatePlan/builders.js +237 -0
  83. package/dist/docx/server/templatePlan/emit.d.ts +118 -0
  84. package/dist/docx/server/templatePlan/emit.js +466 -0
  85. package/dist/docx/server/templatePlan/emphasis.d.ts +62 -0
  86. package/dist/docx/server/templatePlan/emphasis.js +173 -0
  87. package/dist/docx/server/templatePlan/inspect.d.ts +22 -0
  88. package/dist/docx/server/templatePlan/inspect.js +177 -0
  89. package/dist/docx/server/templatePlan/labels.d.ts +36 -0
  90. package/dist/docx/server/templatePlan/labels.js +126 -0
  91. package/dist/docx/server/templatePlan/package.d.ts +34 -0
  92. package/dist/docx/server/templatePlan/package.js +99 -0
  93. package/dist/docx/server/templatePlan/plan.d.ts +143 -0
  94. package/dist/docx/server/templatePlan/plan.js +841 -0
  95. package/dist/docx/server/templatePlan/planShape.d.ts +9 -0
  96. package/dist/docx/server/templatePlan/planShape.js +161 -0
  97. package/dist/docx/server/templatePlan/resources.d.ts +41 -0
  98. package/dist/docx/server/templatePlan/resources.js +136 -0
  99. package/dist/docx/server/templatePlan/story.d.ts +128 -0
  100. package/dist/docx/server/templatePlan/story.js +440 -0
  101. package/dist/docx/server/templatePlan/types.d.ts +406 -0
  102. package/dist/docx/server/templatePlan/types.js +28 -0
  103. package/dist/docx/server/templatePlan/verify.d.ts +40 -0
  104. package/dist/docx/server/templatePlan/verify.js +968 -0
  105. package/dist/docx/server/templatePlan/xml.d.ts +69 -0
  106. package/dist/docx/server/templatePlan/xml.js +119 -0
  107. package/dist/docx/settingsHeaderFooterUpdate.d.ts +9 -0
  108. package/dist/docx/settingsHeaderFooterUpdate.js +45 -10
  109. package/dist/docx/storyBlockReplay.js +1 -1
  110. package/dist/docx/structuralXmlPatch.js +9 -1
  111. package/dist/docx/tableGridXml.d.ts +30 -0
  112. package/dist/docx/tableGridXml.js +54 -0
  113. package/dist/docx/tableParser.js +7 -0
  114. package/dist/docx/xmlParser.js +1 -1
  115. package/dist/index.d.ts +3 -4
  116. package/dist/index.js +2 -4
  117. package/dist/internal/paragraphFormattingSerialization.js +1 -1
  118. package/dist/internal/wholeStoryRevisionResolution.js +1 -1
  119. package/dist/managers/ContextMenuManager.js +2 -1
  120. package/dist/managers/DocumentLoaderManager.d.ts +0 -4
  121. package/dist/managers/DocumentLoaderManager.js +4 -12
  122. package/dist/managers/editorShortcuts.d.ts +1 -1
  123. package/dist/prosemirror/anchoredTextBoxes.d.ts +1 -1
  124. package/dist/prosemirror/canonicalCommands.d.ts +1 -1
  125. package/dist/prosemirror/canonicalSelectionRange.d.ts +1 -1
  126. package/dist/prosemirror/canonicalTableCommands.js +2 -2
  127. package/dist/prosemirror/commands/comments.js +3 -3
  128. package/dist/prosemirror/commands/contentControls.d.ts +1 -1
  129. package/dist/prosemirror/commands/formatPainter.d.ts +1 -1
  130. package/dist/prosemirror/commands/formatting.d.ts +1 -1
  131. package/dist/prosemirror/commands/pastePlainText.d.ts +1 -1
  132. package/dist/prosemirror/commands/sectionBreak.js +1 -1
  133. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -1
  134. package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +1 -1
  135. package/dist/prosemirror/commentRecords.d.ts +1 -1
  136. package/dist/prosemirror/contentControlRevisions.d.ts +1 -1
  137. package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
  138. package/dist/prosemirror/documentStructureCounts.d.ts +24 -0
  139. package/dist/prosemirror/documentStructureCounts.js +76 -0
  140. package/dist/prosemirror/extensions/ExtensionManager.d.ts +1 -1
  141. package/dist/prosemirror/extensions/StarterKit.d.ts +1 -1
  142. package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +1 -7
  143. package/dist/prosemirror/extensions/core/HistoryExtension.js +5 -13
  144. package/dist/prosemirror/extensions/core/ParagraphExtension.js +1 -1
  145. package/dist/prosemirror/extensions/core/historyCommands.d.ts +16 -0
  146. package/dist/prosemirror/extensions/core/historyCommands.js +19 -0
  147. package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +1 -1
  148. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +2 -35
  149. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +4 -142
  150. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +3 -87
  151. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +7 -162
  152. package/dist/prosemirror/extensions/features/pastedCellSections.d.ts +1 -1
  153. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
  154. package/dist/prosemirror/extensions/marks/markUtils.d.ts +1 -1
  155. package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +1 -1
  156. package/dist/prosemirror/extensions/nodes/TableExtension.js +2 -2
  157. package/dist/prosemirror/extensions/types.d.ts +1 -1
  158. package/dist/prosemirror/findReplaceSelection.d.ts +1 -1
  159. package/dist/prosemirror/hyperlinkRemoval.d.ts +1 -1
  160. package/dist/prosemirror/index.d.ts +1 -1
  161. package/dist/prosemirror/index.js +1 -1
  162. package/dist/prosemirror/insertionGaps.d.ts +1 -1
  163. package/dist/prosemirror/keptRangeBoundaries.d.ts +1 -1
  164. package/dist/prosemirror/listNumbering.d.ts +1 -1
  165. package/dist/prosemirror/lockedControls.d.ts +1 -1
  166. package/dist/prosemirror/markupViewProjection.d.ts +1 -1
  167. package/dist/prosemirror/noteReferenceOccurrences.d.ts +1 -1
  168. package/dist/prosemirror/noteReferenceReview.js +1 -1
  169. package/dist/prosemirror/numberingAttr.d.ts +1 -2
  170. package/dist/prosemirror/numberingAttr.js +1 -2
  171. package/dist/prosemirror/outlineLevelAttr.d.ts +1 -2
  172. package/dist/prosemirror/outlineLevelAttr.js +1 -2
  173. package/dist/prosemirror/paraIds.d.ts +46 -0
  174. package/dist/prosemirror/paraIds.js +152 -0
  175. package/dist/prosemirror/paragraphChangeTrackerMeta.d.ts +97 -0
  176. package/dist/prosemirror/paragraphChangeTrackerMeta.js +87 -0
  177. package/dist/prosemirror/paragraphMarkJoin.d.ts +1 -1
  178. package/dist/prosemirror/paragraphPropertyCarry.d.ts +1 -1
  179. package/dist/prosemirror/pastedCommentCopies.d.ts +1 -1
  180. package/dist/prosemirror/pastedCommentCopies.js +1 -1
  181. package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +1 -1
  182. package/dist/prosemirror/plugins/documentNumbering.d.ts +1 -1
  183. package/dist/prosemirror/plugins/suggestionMode.d.ts +1 -1
  184. package/dist/prosemirror/plugins/templateDirectives.d.ts +1 -1
  185. package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -1
  186. package/dist/prosemirror/rebaseParagraphRuns.d.ts +1 -1
  187. package/dist/prosemirror/rejoinRunCarriers.d.ts +1 -1
  188. package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
  189. package/dist/prosemirror/replacedAnnotations.js +16 -1
  190. package/dist/prosemirror/revisionCarriers.d.ts +1 -1
  191. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +1 -1
  192. package/dist/prosemirror/sectionMarkEdits.d.ts +1 -1
  193. package/dist/prosemirror/selectionBounds.d.ts +10 -0
  194. package/dist/prosemirror/selectionBounds.js +22 -0
  195. package/dist/prosemirror/storyListNumbering.d.ts +1 -1
  196. package/dist/prosemirror/tableCellPaste.d.ts +1 -1
  197. package/dist/prosemirror/tableGridMutation.d.ts +1 -1
  198. package/dist/prosemirror/textInput.d.ts +1 -1
  199. package/dist/server.d.ts +7 -5
  200. package/dist/server.js +6 -4
  201. package/dist/types/canonicalCapabilities.d.ts +8 -41
  202. package/dist/types/canonicalCapabilities.js +6 -34
  203. package/package.json +4 -6
  204. package/dist/controller/collaborationModules.d.ts +0 -3
  205. package/dist/controller/collaborationModules.js +0 -14
  206. package/dist/docx/server/materializeYjsDocx.d.ts +0 -30
  207. package/dist/docx/server/materializeYjsDocx.js +0 -96
  208. package/dist/docx/server/migrateYjsAttrSchema.d.ts +0 -53
  209. package/dist/docx/server/migrateYjsAttrSchema.js +0 -111
  210. package/dist/prosemirror/plugins/derivedFields.d.ts +0 -8
  211. package/dist/prosemirror/plugins/derivedFields.js +0 -52
  212. package/dist/prosemirror/yjsDocumentMetadata.d.ts +0 -89
  213. package/dist/prosemirror/yjsDocumentMetadata.js +0 -697
@@ -12,8 +12,8 @@
12
12
  */
13
13
  import { document_d_exports } from "../types/document.js";
14
14
  import { TrackedRevisionAncestor } from "./schema/marks.js";
15
- import { Node } from "prosemirror-model";
16
15
  import { Transaction } from "prosemirror-state";
16
+ import { Node } from "prosemirror-model";
17
17
  /** A range boundary, as the engine's model writes it. */
18
18
  type BoundaryItem = Extract<document_d_exports.ParagraphContent, {
19
19
  type: "bookmarkStart" | "bookmarkEnd" | "commentRangeStart" | "commentRangeEnd" | "moveFromRangeStart" | "moveFromRangeEnd" | "moveToRangeStart" | "moveToRangeEnd";
@@ -1,8 +1,8 @@
1
1
  import { ListKind, ListLevelFormat } from "../docx/listNumberingInstances.js";
2
2
  import { NumberingMap } from "../docx/numberingParser.js";
3
3
  import { ParagraphAttrs } from "./schema/nodes.js";
4
- import { Node, ResolvedPos } from "prosemirror-model";
5
4
  import { Command, EditorState, Transaction } from "prosemirror-state";
5
+ import { Node, ResolvedPos } from "prosemirror-model";
6
6
  /** What a list command or typed marker asks for. */
7
7
  export type ListRequest = {
8
8
  kind: ListKind;
@@ -4,8 +4,8 @@
4
4
  * document holds, as spans on its position scale, and what a transform did to
5
5
  * them.
6
6
  */
7
- import { Node } from "prosemirror-model";
8
7
  import { LockedControlSpan, LockedControlTouch, LockedControlViolation } from "@stll/docx-core/model";
8
+ import { Node } from "prosemirror-model";
9
9
  import { Transform } from "prosemirror-transform";
10
10
  export declare const lockedControlSpans: (doc: Node) => readonly LockedControlSpan[];
11
11
  /** What the locks of `doc` say about `touches`: `null` when they permit them all. */
@@ -20,8 +20,8 @@ import { RemovedSectionReference } from "../internal/sectionEndpointResolution.j
20
20
  import { DisplayMode } from "../managers/EditorModeManager.js";
21
21
  import { document_d_exports } from "../types/document.js";
22
22
  import { DeepReadonly } from "../types/documentModel.js";
23
- import { Node } from "prosemirror-model";
24
23
  import { EditorState } from "prosemirror-state";
24
+ import { Node } from "prosemirror-model";
25
25
  import { Mapping, Step, StepMap } from "prosemirror-transform";
26
26
  /** Resolve every revision in the state's story with the state's own styles and numbering. */
27
27
  export declare const resolveStateStory: (state: EditorState, mode: RevisionResolutionMode) => {
@@ -1,6 +1,6 @@
1
1
  import { TaggedErrorClass } from "better-result";
2
- import { Node } from "prosemirror-model";
3
2
  import { Plugin, Transaction } from "prosemirror-state";
3
+ import { Node } from "prosemirror-model";
4
4
  declare const NoteReferenceEditRefusalBase: TaggedErrorClass<"NoteReferenceEditRefusal">;
5
5
  export declare class NoteReferenceEditRefusal extends NoteReferenceEditRefusalBase<{
6
6
  message: string;
@@ -11,8 +11,8 @@ import { createDocumentNumberingPlugin } from "./plugins/documentNumbering.js";
11
11
  import { createDocumentStylesPlugin } from "./plugins/documentStyles.js";
12
12
  import { mintRevisionId } from "./plugins/revisionIds.js";
13
13
  import { schema, singletonManager } from "./schema/index.js";
14
- import { setDocumentBodyComments } from "@stll/docx-core/model";
15
14
  import { Transform } from "prosemirror-transform";
15
+ import { setDocumentBodyComments } from "@stll/docx-core/model";
16
16
  import { EditorState } from "prosemirror-state";
17
17
  // src/prosemirror/noteReferenceReview.ts
18
18
  const noteKey = (kind, id) => `${kind}:${id}`;
@@ -72,8 +72,7 @@ export declare const paragraphNumberingFromAttrValue: (value: unknown) => Paragr
72
72
  *
73
73
  * A value that is present and not a {@link ParagraphNumberingAttr} panics
74
74
  * rather than being ignored: it can only come from a document written under an
75
- * attr schema this build does not read, and `yjsDocumentMetadata`'s version
76
- * gate exists to make that unreachable.
75
+ * attr schema this build does not read.
77
76
  */
78
77
  export declare const readParagraphNumberingAttr: (value: unknown) => ParagraphNumberingAttr | null;
79
78
  export {};
@@ -83,8 +83,7 @@ const paragraphNumberingFromAttrValue = (value) => {
83
83
  *
84
84
  * A value that is present and not a {@link ParagraphNumberingAttr} panics
85
85
  * rather than being ignored: it can only come from a document written under an
86
- * attr schema this build does not read, and `yjsDocumentMetadata`'s version
87
- * gate exists to make that unreachable.
86
+ * attr schema this build does not read.
88
87
  */
89
88
  const readParagraphNumberingAttr = (value) => {
90
89
  if (value === void 0 || value === null) return null;
@@ -20,7 +20,6 @@ export declare const outlineLevelFromAttrValue: (value: unknown) => OutlineLevel
20
20
  *
21
21
  * A value that is present and not an {@link OutlineLevel} panics rather than
22
22
  * being ignored: it can only come from a document written under an attr schema
23
- * this build does not read, and `yjsDocumentMetadata`'s version gate exists to
24
- * make that unreachable.
23
+ * this build does not read.
25
24
  */
26
25
  export declare const readOutlineLevelAttr: (value: unknown) => OutlineLevel | null;
@@ -29,8 +29,7 @@ const outlineLevelFromAttrValue = (value) => {
29
29
  *
30
30
  * A value that is present and not an {@link OutlineLevel} panics rather than
31
31
  * being ignored: it can only come from a document written under an attr schema
32
- * this build does not read, and `yjsDocumentMetadata`'s version gate exists to
33
- * make that unreachable.
32
+ * this build does not read.
34
33
  */
35
34
  const readOutlineLevelAttr = (value) => {
36
35
  if (value === void 0 || value === null) return null;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Paragraph-id allocation shared by load-time seeding and the live
3
+ * allocator plugin (`ParaIdAllocatorExtension`).
4
+ *
5
+ * Split out of
6
+ * https://github.com/eigenpal/docx-editor/blob/main/packages/core/src/prosemirror/extensions/features/ParaIdAllocatorExtension.ts
7
+ * (Apache-2.0); see that module for the id lifecycle rules.
8
+ */
9
+ import { EditorState, Plugin, PluginKey, Transaction } from "prosemirror-state";
10
+ import { Node } from "prosemirror-model";
11
+ export type ParagraphPropertySourceSeed = {
12
+ contract: string | null;
13
+ tokens: ReadonlySet<string>;
14
+ };
15
+ export declare const paraIdAllocatorKey: Readonly<{
16
+ key: string;
17
+ createKey: () => PluginKey<ParagraphPropertySourceSeed>;
18
+ owns: (plugin: Plugin<ParagraphPropertySourceSeed>) => boolean;
19
+ get: (state: EditorState) => Plugin<ParagraphPropertySourceSeed> | undefined;
20
+ getState: (state: EditorState) => ParagraphPropertySourceSeed | undefined;
21
+ }>;
22
+ /**
23
+ * Transaction meta asking this plugin to derive the ids it mints from a
24
+ * caller-supplied seed instead of `Math.random()`.
25
+ *
26
+ * A live editor wants random ids: two people typing must not collide. A
27
+ * generator whose whole output has to be reproducible — the document compare —
28
+ * cannot afford them, and it is the only party that knows its run is meant to
29
+ * be deterministic, so it says so on its own transaction rather than leaving
30
+ * the plugin to guess.
31
+ */
32
+ export declare const deterministicParaIdSeedKey = "stll.folio.meta.deterministicParaIdSeed";
33
+ /** Ask the allocator to mint reproducible ids for the paragraphs `tr` creates. */
34
+ export declare const requestDeterministicParaIds: (tr: Transaction, seed: string) => Transaction;
35
+ export declare const isUsableParaId: (value: unknown) => value is string;
36
+ export declare const visitAuthoredParagraphs: (doc: Node, visit: (node: Node, pos: number) => void) => void;
37
+ /**
38
+ * Allocate initial paragraph IDs before constructing editor state.
39
+ *
40
+ * Rebuilding only changed branches avoids applying one ProseMirror transaction
41
+ * step per missing paragraph. Live edits still use the transaction-based plugin
42
+ * below so history, mappings, and duplicate ownership retain their semantics.
43
+ */
44
+ export declare const ensureParaIdsInDoc: (doc: Node) => Node;
45
+ /** {@link ensureParaIdsInDoc} for a state that already exists. */
46
+ export declare const ensureParaIdsInState: (state: EditorState) => EditorState;
@@ -0,0 +1,152 @@
1
+ import { recreateProseNodeWithParagraphPropertySource, setProseParagraphMarkupWithPropertySource, transferProseParagraphPropertySource } from "../docx/paragraphPropertySource.js";
2
+ import { prosePositionalParagraphId } from "../docx/unnamedParagraphIds.js";
3
+ import { deterministicHexId } from "../utils/hexId.js";
4
+ import { ignoreTrackedChanges } from "./paragraphChangeTrackerMeta.js";
5
+ import { createPluginKeyOwner } from "./pluginKeyOwner.js";
6
+ import { Fragment } from "prosemirror-model";
7
+ // src/prosemirror/paraIds.ts
8
+ /**
9
+ * Paragraph-id allocation shared by load-time seeding and the live
10
+ * allocator plugin (`ParaIdAllocatorExtension`).
11
+ *
12
+ * Split out of
13
+ * https://github.com/eigenpal/docx-editor/blob/main/packages/core/src/prosemirror/extensions/features/ParaIdAllocatorExtension.ts
14
+ * (Apache-2.0); see that module for the id lifecycle rules.
15
+ */
16
+ const paraIdAllocatorKey = createPluginKeyOwner("paraIdAllocator");
17
+ /**
18
+ * Transaction meta asking this plugin to derive the ids it mints from a
19
+ * caller-supplied seed instead of `Math.random()`.
20
+ *
21
+ * A live editor wants random ids: two people typing must not collide. A
22
+ * generator whose whole output has to be reproducible — the document compare —
23
+ * cannot afford them, and it is the only party that knows its run is meant to
24
+ * be deterministic, so it says so on its own transaction rather than leaving
25
+ * the plugin to guess.
26
+ */
27
+ const deterministicParaIdSeedKey = "stll.folio.meta.deterministicParaIdSeed";
28
+ /** Ask the allocator to mint reproducible ids for the paragraphs `tr` creates. */
29
+ const requestDeterministicParaIds = (tr, seed) => tr.setMeta(deterministicParaIdSeedKey, seed);
30
+ const isUsableParaId = (value) => typeof value === "string" && value.length > 0 && value !== "00000000";
31
+ /** Omitted grid cells render absent positions and own no package paragraphs. */
32
+ const isOmittedGridCell = (node) => (node.type.spec["tableRole"] === "cell" || node.type.spec["tableRole"] === "header_cell") && (node.attrs["_omittedGridSlot"] === "before" || node.attrs["_omittedGridSlot"] === "after");
33
+ const visitAuthoredParagraphs = (doc, visit) => {
34
+ doc.descendants((node, pos) => {
35
+ if (isOmittedGridCell(node)) return false;
36
+ if (node.type.name !== "paragraph") return true;
37
+ visit(node, pos);
38
+ return false;
39
+ });
40
+ };
41
+ /**
42
+ * The ids a loaded document's paragraphs take, in document order: `null`
43
+ * keeps the paragraph's own id, a string replaces it.
44
+ *
45
+ * This is the only load-time allocator. The live editor and the headless
46
+ * reviewer both seed through it, so the same document gives the same block ids
47
+ * on either side: an id read from the editor resolves when the edit is applied
48
+ * headlessly, and re-parsing the same bytes mints the same ids. A paragraph
49
+ * the package names no id for takes the id its place in the package gives it
50
+ * (the one `ensureParaIds` writes, so a canonical session agrees); one the
51
+ * parser could not place, such as a paragraph a host built, takes an id
52
+ * derived from its text and its document ordinal, never drawn at random.
53
+ * Authored ids are reserved first, so a minted id never takes one a later
54
+ * paragraph owns; of a duplicated authored id, the first occurrence keeps it.
55
+ */
56
+ const planLoadParaIds = (doc) => {
57
+ const paragraphs = [];
58
+ const taken = /* @__PURE__ */ new Set();
59
+ visitAuthoredParagraphs(doc, (node) => {
60
+ paragraphs.push(node);
61
+ const id = node.attrs["paraId"];
62
+ if (isUsableParaId(id)) {
63
+ taken.add(id);
64
+ return;
65
+ }
66
+ const positional = prosePositionalParagraphId(node);
67
+ if (positional !== void 0) taken.add(positional);
68
+ });
69
+ const kept = /* @__PURE__ */ new Set();
70
+ return paragraphs.map((paragraph, index) => {
71
+ const id = paragraph.attrs["paraId"];
72
+ if (isUsableParaId(id) && !kept.has(id)) {
73
+ kept.add(id);
74
+ return null;
75
+ }
76
+ const positional = prosePositionalParagraphId(paragraph);
77
+ if (positional !== void 0 && !kept.has(positional)) {
78
+ kept.add(positional);
79
+ return positional;
80
+ }
81
+ const seed = `${paragraph.textContent}:${String(index + 1)}`;
82
+ let minted = deterministicHexId(seed);
83
+ for (let salt = 1; taken.has(minted); salt++) minted = deterministicHexId(`${seed}:${String(salt)}`);
84
+ taken.add(minted);
85
+ return minted;
86
+ });
87
+ };
88
+ /** A paragraph's attrs once it holds an id folio minted rather than read. */
89
+ const mintedParagraphAttrs = (paragraph, paraId) => ({
90
+ ...paragraph.attrs,
91
+ paraId,
92
+ ...paragraph.type.spec.attrs?.["idStability"] !== void 0 && { idStability: "positional" }
93
+ });
94
+ /**
95
+ * Allocate initial paragraph IDs before constructing editor state.
96
+ *
97
+ * Rebuilding only changed branches avoids applying one ProseMirror transaction
98
+ * step per missing paragraph. Live edits still use the transaction-based plugin
99
+ * below so history, mappings, and duplicate ownership retain their semantics.
100
+ */
101
+ const ensureParaIdsInDoc = (doc) => {
102
+ const plan = planLoadParaIds(doc);
103
+ if (plan.every((paraId) => paraId === null)) return doc;
104
+ let ordinal = 0;
105
+ const rewrite = (parent) => {
106
+ let changed = false;
107
+ const children = [];
108
+ parent.forEach((child) => {
109
+ if (isOmittedGridCell(child)) {
110
+ children.push(child);
111
+ return;
112
+ }
113
+ let next = child;
114
+ if (child.type.name === "paragraph") {
115
+ const minted = plan[ordinal];
116
+ ordinal += 1;
117
+ if (minted !== null && minted !== void 0) next = recreateProseNodeWithParagraphPropertySource(child, { attrs: mintedParagraphAttrs(child, minted) });
118
+ const paraId = next.attrs["paraId"];
119
+ if (typeof paraId === "string") transferProseParagraphPropertySource(next, child, paraId);
120
+ } else if (child.childCount > 0) {
121
+ const content = rewrite(child);
122
+ if (content !== child.content) next = recreateProseNodeWithParagraphPropertySource(child, { content });
123
+ }
124
+ if (next !== child) changed = true;
125
+ children.push(next);
126
+ });
127
+ return changed ? Fragment.fromArray(children) : parent.content;
128
+ };
129
+ return recreateProseNodeWithParagraphPropertySource(doc, { content: rewrite(doc) });
130
+ };
131
+ /** {@link ensureParaIdsInDoc} for a state that already exists. */
132
+ const ensureParaIdsInState = (state) => {
133
+ const plan = planLoadParaIds(state.doc);
134
+ if (plan.every((paraId) => paraId === null)) return state;
135
+ const tr = state.tr;
136
+ let ordinal = 0;
137
+ visitAuthoredParagraphs(state.doc, (node, pos) => {
138
+ const minted = plan[ordinal];
139
+ ordinal += 1;
140
+ if (minted !== null && minted !== void 0) setProseParagraphMarkupWithPropertySource({
141
+ attrs: mintedParagraphAttrs(node, minted),
142
+ ownership: "transfer-allocated-id",
143
+ pos,
144
+ transaction: tr
145
+ });
146
+ });
147
+ ignoreTrackedChanges(tr);
148
+ tr.setMeta(paraIdAllocatorKey, "allocated");
149
+ tr.setMeta("addToHistory", false);
150
+ return state.apply(tr);
151
+ };
152
+ export { deterministicParaIdSeedKey, ensureParaIdsInDoc, ensureParaIdsInState, isUsableParaId, paraIdAllocatorKey, requestDeterministicParaIds, visitAuthoredParagraphs };
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The transaction meta the paragraph change tracker reads, and the state it
3
+ * keeps. Commands state what an edit did through these setters; only the
4
+ * tracker plugin (`ParagraphChangeTrackerExtension`) reads them.
5
+ */
6
+ import { RemovedSectionReference, TrackedSectionEndpointRemoval } from "../internal/sectionEndpointResolution.js";
7
+ import { document_d_exports } from "../types/document.js";
8
+ import { EditorState, Plugin, PluginKey, Transaction } from "prosemirror-state";
9
+ import { Node } from "prosemirror-model";
10
+ export declare const paragraphChangeTrackerKey: Readonly<{
11
+ key: string;
12
+ createKey: () => PluginKey<InternalParagraphChangeTrackerState>;
13
+ owns: (plugin: Plugin<InternalParagraphChangeTrackerState>) => boolean;
14
+ get: (state: EditorState) => Plugin<InternalParagraphChangeTrackerState> | undefined;
15
+ getState: (state: EditorState) => InternalParagraphChangeTrackerState | undefined;
16
+ }>;
17
+ export declare const CLEAR_META = "clear";
18
+ export declare const IGNORE_META = "ignore";
19
+ export declare const STRUCTURAL_META = "structural";
20
+ export declare const CHANGED_PARAGRAPH_RANGES_META = "folioChangedParagraphRanges";
21
+ export declare const SECTION_ENDPOINT_REMOVAL_META = "folioSectionEndpointRemoval";
22
+ export type ChangedParagraphRangeBatch = {
23
+ ranges: readonly {
24
+ from: number;
25
+ to: number;
26
+ }[];
27
+ mappingFrom: number;
28
+ replacesStepMapAt?: number;
29
+ };
30
+ type ChangedParagraphRangesMeta = {
31
+ type: "changed-paragraph-ranges";
32
+ batches: readonly ChangedParagraphRangeBatch[];
33
+ };
34
+ export declare const isChangedParagraphRangesMeta: (value: unknown) => value is ChangedParagraphRangesMeta;
35
+ export declare const isTrackedSectionEndpointRemoval: (value: unknown) => value is TrackedSectionEndpointRemoval;
36
+ type TrackedSectionEndpointRemovalMeta = {
37
+ type: "tracked-section-endpoint-removal-meta";
38
+ authorization: TrackedSectionEndpointRemoval;
39
+ };
40
+ export declare const isTrackedSectionEndpointRemovalMeta: (value: unknown) => value is TrackedSectionEndpointRemovalMeta;
41
+ export type ParagraphChangeTrackerState = {
42
+ /** Set of paraIds that were modified since last clear */
43
+ changedParaIds: Set<string>;
44
+ /** Whether paragraph order, membership, or block structure changed. */
45
+ structuralChange: boolean;
46
+ /** Whether edited paragraphs still lack IDs or source identity was unavailable. */
47
+ hasUntrackedChanges: boolean;
48
+ /** Paragraph count in the current tracked document. */
49
+ paragraphCount: number;
50
+ /** Cached section-endpoint count used to invalidate stale save authorization. */
51
+ sectionEndpointCount: number;
52
+ /** Exact endpoint owners and properties used to invalidate count-neutral changes. */
53
+ sectionEndpointFingerprint: string;
54
+ /** Exact tracked-resolution transition that may reduce the saved section count. */
55
+ sectionEndpointRemoval: TrackedSectionEndpointRemoval | null;
56
+ };
57
+ export type InternalParagraphChangeTrackerState = ParagraphChangeTrackerState & {
58
+ /** Edited paragraph positions retained across allocator-only transactions. */
59
+ affectedParagraphPositions: Set<number>;
60
+ /** Editing an already unidentified source paragraph cannot become selective. */
61
+ hasUntrackedSourceChanges: boolean;
62
+ blockStructureFingerprint: string;
63
+ /** The section records themselves, by identity. */
64
+ sectionRecords: ReadonlySet<document_d_exports.SectionProperties>;
65
+ };
66
+ export declare const referencesOf: (records: readonly document_d_exports.SectionProperties[]) => RemovedSectionReference[];
67
+ type MarkTrackedSectionEndpointRemovalOptions = {
68
+ sourceDoc: Node;
69
+ removedEndpointCount: number;
70
+ removedReferences: readonly RemovedSectionReference[];
71
+ };
72
+ /** Record only a complete, internally consistent endpoint-removal transition. */
73
+ export declare function markTrackedSectionEndpointRemoval(tr: Transaction, { sourceDoc, removedEndpointCount, removedReferences }: MarkTrackedSectionEndpointRemovalOptions): Transaction;
74
+ /**
75
+ * Record that `tr` removed section breaks on purpose: a command whose job is
76
+ * to remove the break (not to delete its paragraph mark, which the tracker
77
+ * reads for itself). Only a plain removal is recorded; a transaction that also
78
+ * adds or replaces a record is left as it is.
79
+ */
80
+ export declare function markSectionBreakRemoval(tr: Transaction, sourceDoc: Node): Transaction;
81
+ /**
82
+ * Create a transaction that clears the change tracker
83
+ */
84
+ export declare function clearTrackedChanges(state: EditorState): Transaction;
85
+ export declare function ignoreTrackedChanges(tr: Transaction): Transaction;
86
+ export declare function markStructuralChange(tr: Transaction): Transaction;
87
+ type MarkChangedParagraphRangesOptions = {
88
+ ranges: readonly {
89
+ from: number;
90
+ to: number;
91
+ }[];
92
+ mappingFrom: number;
93
+ replacesStepMapAt?: number;
94
+ };
95
+ /** Record mark-only paragraph changes whose replacement step has a granular map. */
96
+ export declare function markChangedParagraphRanges(tr: Transaction, batch: MarkChangedParagraphRangesOptions): Transaction;
97
+ export {};
@@ -0,0 +1,87 @@
1
+ import { countDocumentStructure } from "./documentStructureCounts.js";
2
+ import { createPluginKeyOwner } from "./pluginKeyOwner.js";
3
+ // src/prosemirror/paragraphChangeTrackerMeta.ts
4
+ const paragraphChangeTrackerKey = createPluginKeyOwner("paragraphChangeTracker");
5
+ const CLEAR_META = "clear";
6
+ const IGNORE_META = "ignore";
7
+ const STRUCTURAL_META = "structural";
8
+ const CHANGED_PARAGRAPH_RANGES_META = "folioChangedParagraphRanges";
9
+ const SECTION_ENDPOINT_REMOVAL_META = "folioSectionEndpointRemoval";
10
+ const isChangedParagraphRangesMeta = (value) => typeof value === "object" && value !== null && "type" in value && value.type === "changed-paragraph-ranges";
11
+ const isRemovedSectionReference = (value) => typeof value === "object" && value !== null && "part" in value && (value.part === "header" || value.part === "footer") && "type" in value && (value.type === "default" || value.type === "first" || value.type === "even") && "relationshipId" in value && typeof value.relationshipId === "string";
12
+ const isTrackedSectionEndpointRemoval = (value) => typeof value === "object" && value !== null && "type" in value && value.type === "tracked-section-endpoint-removal" && "sourceParagraphEndpointCount" in value && typeof value.sourceParagraphEndpointCount === "number" && Number.isSafeInteger(value.sourceParagraphEndpointCount) && "expectedParagraphEndpointCount" in value && typeof value.expectedParagraphEndpointCount === "number" && Number.isSafeInteger(value.expectedParagraphEndpointCount) && value.sourceParagraphEndpointCount > value.expectedParagraphEndpointCount && value.expectedParagraphEndpointCount >= 0 && "sourceEndpointFingerprint" in value && typeof value.sourceEndpointFingerprint === "string" && "expectedEndpointFingerprint" in value && typeof value.expectedEndpointFingerprint === "string" && "removedReferences" in value && Array.isArray(value.removedReferences) && value.removedReferences.every(isRemovedSectionReference);
13
+ const isTrackedSectionEndpointRemovalMeta = (value) => typeof value === "object" && value !== null && "type" in value && value.type === "tracked-section-endpoint-removal-meta" && "authorization" in value && isTrackedSectionEndpointRemoval(value.authorization);
14
+ const referencesOf = (records) => {
15
+ const references = [];
16
+ for (const record of records) {
17
+ for (const { type, rId } of record.headerReferences ?? []) references.push({
18
+ part: "header",
19
+ type,
20
+ relationshipId: rId
21
+ });
22
+ for (const { type, rId } of record.footerReferences ?? []) references.push({
23
+ part: "footer",
24
+ type,
25
+ relationshipId: rId
26
+ });
27
+ }
28
+ return references;
29
+ };
30
+ /** Record only a complete, internally consistent endpoint-removal transition. */
31
+ function markTrackedSectionEndpointRemoval(tr, { sourceDoc, removedEndpointCount, removedReferences }) {
32
+ const sourceStructure = countDocumentStructure(sourceDoc);
33
+ const sourceParagraphEndpointCount = sourceStructure.sectionEndpoints;
34
+ const expectedStructure = countDocumentStructure(tr.doc);
35
+ const expectedParagraphEndpointCount = expectedStructure.sectionEndpoints;
36
+ if (sourceParagraphEndpointCount - expectedParagraphEndpointCount !== removedEndpointCount) return tr;
37
+ return tr.setMeta(SECTION_ENDPOINT_REMOVAL_META, {
38
+ type: "tracked-section-endpoint-removal-meta",
39
+ authorization: {
40
+ type: "tracked-section-endpoint-removal",
41
+ sourceParagraphEndpointCount,
42
+ expectedParagraphEndpointCount,
43
+ sourceEndpointFingerprint: sourceStructure.sectionEndpointFingerprint,
44
+ expectedEndpointFingerprint: expectedStructure.sectionEndpointFingerprint,
45
+ removedReferences
46
+ }
47
+ });
48
+ }
49
+ /**
50
+ * Record that `tr` removed section breaks on purpose: a command whose job is
51
+ * to remove the break (not to delete its paragraph mark, which the tracker
52
+ * reads for itself). Only a plain removal is recorded; a transaction that also
53
+ * adds or replaces a record is left as it is.
54
+ */
55
+ function markSectionBreakRemoval(tr, sourceDoc) {
56
+ const before = countDocumentStructure(sourceDoc).sectionRecords;
57
+ const after = countDocumentStructure(tr.doc).sectionRecords;
58
+ const removed = [...before].filter((record) => !after.has(record));
59
+ if (removed.length === 0 || [...after].some((record) => !before.has(record))) return tr;
60
+ return markTrackedSectionEndpointRemoval(tr, {
61
+ sourceDoc,
62
+ removedEndpointCount: removed.length,
63
+ removedReferences: referencesOf(removed)
64
+ });
65
+ }
66
+ /**
67
+ * Create a transaction that clears the change tracker
68
+ */
69
+ function clearTrackedChanges(state) {
70
+ return state.tr.setMeta(paragraphChangeTrackerKey, CLEAR_META);
71
+ }
72
+ function ignoreTrackedChanges(tr) {
73
+ return tr.setMeta(paragraphChangeTrackerKey, IGNORE_META);
74
+ }
75
+ function markStructuralChange(tr) {
76
+ return tr.setMeta(paragraphChangeTrackerKey, STRUCTURAL_META);
77
+ }
78
+ /** Record mark-only paragraph changes whose replacement step has a granular map. */
79
+ function markChangedParagraphRanges(tr, batch) {
80
+ const previous = tr.getMeta(CHANGED_PARAGRAPH_RANGES_META);
81
+ const batches = isChangedParagraphRangesMeta(previous) ? [...previous.batches, batch] : [batch];
82
+ return tr.setMeta(CHANGED_PARAGRAPH_RANGES_META, {
83
+ type: "changed-paragraph-ranges",
84
+ batches
85
+ });
86
+ }
87
+ export { CHANGED_PARAGRAPH_RANGES_META, CLEAR_META, IGNORE_META, SECTION_ENDPOINT_REMOVAL_META, STRUCTURAL_META, clearTrackedChanges, ignoreTrackedChanges, isChangedParagraphRangesMeta, isTrackedSectionEndpointRemoval, isTrackedSectionEndpointRemovalMeta, markChangedParagraphRanges, markSectionBreakRemoval, markStructuralChange, markTrackedSectionEndpointRemoval, paragraphChangeTrackerKey, referencesOf };
@@ -14,8 +14,8 @@
14
14
  * lent them is re-read in the next paragraph's style.
15
15
  */
16
16
  import { RunStyleResolver } from "./runStyleFormatting.js";
17
- import { Node } from "prosemirror-model";
18
17
  import { Transaction } from "prosemirror-state";
18
+ import { Node } from "prosemirror-model";
19
19
  /** The two paragraphs a join runs together, and what stands between them. */
20
20
  type JoinSides = {
21
21
  /** The paragraph whose mark goes. */
@@ -13,8 +13,8 @@
13
13
  import { NumberingMap } from "../docx/numberingParser.js";
14
14
  import { RunStyleResolver } from "./runStyleFormatting.js";
15
15
  import { ParagraphPropertyChangeAttrs } from "./schema/nodes.js";
16
- import { Node } from "prosemirror-model";
17
16
  import { Transaction } from "prosemirror-state";
17
+ import { Node } from "prosemirror-model";
18
18
  type RecordedFormatting = NonNullable<ParagraphPropertyChangeAttrs["previousFormatting"]>;
19
19
  export declare const paragraphPropertySnapshotsDiffer: (left: RecordedFormatting, right: RecordedFormatting) => boolean;
20
20
  type CarryParagraphPropertiesOptions = {
@@ -21,8 +21,8 @@
21
21
  */
22
22
  import { Comment } from "../types/content.js";
23
23
  import { PastedRepeat, PlacedRange } from "./pastePlacement.js";
24
- import { Node, Slice } from "prosemirror-model";
25
24
  import { Transaction } from "prosemirror-state";
25
+ import { Node, Slice } from "prosemirror-model";
26
26
  /** The comments a paste carries, for settling them where they are placed. */
27
27
  export type PastedComments = {
28
28
  /** The comment each fresh id the slice's anchors took stands for. */
@@ -6,8 +6,8 @@ import "./extensions/nodes/RangeAnchorExtension.js";
6
6
  import { mapPlacedRanges } from "./pastePlacement.js";
7
7
  import { forEachAnnotationIdInDoc } from "./plugins/revisionIds.js";
8
8
  import { readRangeAnchorAttrs } from "./rangeAnchorAttrs.js";
9
- import { MAX_REVISION_ID } from "@stll/docx-core/model";
10
9
  import { Fragment, Slice } from "prosemirror-model";
10
+ import { MAX_REVISION_ID } from "@stll/docx-core/model";
11
11
  // src/prosemirror/pastedCommentCopies.ts
12
12
  /**
13
13
  * One range per comment id, for a paste or a drop into a ProseMirror session.
@@ -16,8 +16,8 @@
16
16
  * plugin rescans on that and on every `docChanged` transaction.
17
17
  */
18
18
  import { PluginKeyOwner } from "../pluginKeyOwner.js";
19
- import { Node } from "prosemirror-model";
20
19
  import { EditorState, Plugin } from "prosemirror-state";
20
+ import { Node } from "prosemirror-model";
21
21
  declare const SET_META = "set";
22
22
  export type DocScanState<TConfig, TRange> = {
23
23
  config: TConfig;
@@ -1,8 +1,8 @@
1
1
  /** Document-scoped numbering definitions for list-editing commands. */
2
2
  import { NumberingMap } from "../../docx/numberingParser.js";
3
3
  import { document_d_exports } from "../../types/document.js";
4
- import { Node } from "prosemirror-model";
5
4
  import { EditorState, Plugin } from "prosemirror-state";
5
+ import { Node } from "prosemirror-model";
6
6
  export declare const createDocumentNumberingPlugin: (definitions: document_d_exports.NumberingDefinitions | null | undefined) => Plugin;
7
7
  /** Numbering derived from a document when no editor plugin owns package definitions. */
8
8
  export declare const getDocumentNumberingForDoc: (doc: Node) => NumberingMap | null;
@@ -10,8 +10,8 @@
10
10
  * - Text already marked as insertion by the current author is deleted normally
11
11
  * (retracting your own suggestion)
12
12
  */
13
- import { Slice } from "prosemirror-model";
14
13
  import { EditorState, Plugin, PluginKey, Transaction } from "prosemirror-state";
14
+ import { Slice } from "prosemirror-model";
15
15
  import { EditorView } from "prosemirror-view";
16
16
  export declare const suggestionModeKey: Readonly<{
17
17
  key: string;
@@ -16,8 +16,8 @@
16
16
  * automatically.
17
17
  */
18
18
  import { DocScanState } from "./createDocScanPlugin.js";
19
- import { Node } from "prosemirror-model";
20
19
  import { EditorState, Plugin, PluginKey } from "prosemirror-state";
20
+ import { Node } from "prosemirror-model";
21
21
  import { DirectiveKind } from "@stll/template-conditions";
22
22
  export type DirectiveRange = {
23
23
  /** Inclusive PM doc position of the marker start. */
@@ -1,6 +1,6 @@
1
1
  import { ParagraphRunStyleContext, RunStyleResolver } from "./runStyleFormatting.js";
2
- import { Node } from "prosemirror-model";
3
2
  import { Transaction } from "prosemirror-state";
3
+ import { Node } from "prosemirror-model";
4
4
  import { Transform } from "prosemirror-transform";
5
5
  type RebaseParagraphRunFormattingOptions = {
6
6
  nextAttrs: Record<string, unknown>;
@@ -1,6 +1,6 @@
1
1
  import { ParagraphRunStyleContext, RunStyleResolver } from "./runStyleFormatting.js";
2
- import { Fragment, Mark, Node } from "prosemirror-model";
3
2
  import { Transaction } from "prosemirror-state";
3
+ import { Fragment, Mark, Node } from "prosemirror-model";
4
4
  /** Two contexts that lend runs the same formatting: rebasing between them changes nothing. */
5
5
  export declare const sameRunStyleContext: (source: ParagraphRunStyleContext, target: ParagraphRunStyleContext) => boolean;
6
6
  type RebaseParagraphRunsOptions = {
@@ -16,8 +16,8 @@
16
16
  * (`runIdentityAcrossRevisions.ts`).
17
17
  */
18
18
  import { ParagraphRunStyleContext, RunStyleResolver } from "./runStyleFormatting.js";
19
- import { Mark, Node } from "prosemirror-model";
20
19
  import { Transaction } from "prosemirror-state";
20
+ import { Mark, Node } from "prosemirror-model";
21
21
  type ContinuedRunMarksOptions = {
22
22
  left: Node;
23
23
  right: Node;
@@ -63,8 +63,8 @@
63
63
  * canonical guard refuses point transitions whose outcome is not proven.
64
64
  */
65
65
  import { document_d_exports } from "../types/document.js";
66
- import { Fragment, Mark, Node, Schema } from "prosemirror-model";
67
66
  import { Transaction } from "prosemirror-state";
67
+ import { Fragment, Mark, Node, Schema } from "prosemirror-model";
68
68
  /**
69
69
  * What a replacement does with each mark the schema declares
70
70
  * `inclusive: false`. Boundary inheritance already handles every other mark,