@eigenpal/docx-editor-core 1.0.3 → 1.2.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 (266) hide show
  1. package/LICENSE +13 -16
  2. package/dist/agent/index.d.mts +42 -7
  3. package/dist/agent/index.d.ts +42 -7
  4. package/dist/agent/index.js +1 -1
  5. package/dist/agent/index.mjs +1 -1
  6. package/dist/chunk-2EQGBVPV.js +2 -0
  7. package/dist/chunk-2XP6GLA4.mjs +1 -0
  8. package/dist/chunk-44FHVKSI.js +1 -0
  9. package/dist/{chunk-2IE6UDHJ.mjs → chunk-44JKHPGF.mjs} +1 -1
  10. package/dist/{chunk-ABBG4WD2.js → chunk-4QEETB7U.js} +2 -2
  11. package/dist/chunk-53VKL6CG.js +1 -0
  12. package/dist/chunk-5BLQHXWK.mjs +1 -0
  13. package/dist/chunk-5M7TI6TV.js +1 -0
  14. package/dist/chunk-6JKM7TWJ.mjs +1 -0
  15. package/dist/{chunk-EQVNAHL7.mjs → chunk-6Y6LON6Y.mjs} +1 -1
  16. package/dist/{chunk-QVEAQOMR.mjs → chunk-6ZXL3EIP.mjs} +1 -1
  17. package/dist/{chunk-GHQS3I2W.mjs → chunk-7BVHKWEW.mjs} +1 -1
  18. package/dist/chunk-7HANRHHL.js +1 -0
  19. package/dist/chunk-7LRR7RKE.mjs +15 -0
  20. package/dist/chunk-7OW3VCZE.mjs +1 -0
  21. package/dist/chunk-7ZN4WI5N.mjs +4 -0
  22. package/dist/chunk-AMB6Y77B.js +1 -0
  23. package/dist/{chunk-3JXR6YU4.mjs → chunk-BOOHU5EW.mjs} +1 -1
  24. package/dist/{chunk-XBHF5Q2F.js → chunk-BXWOLARZ.js} +1 -1
  25. package/dist/chunk-C45EFOVP.js +1 -0
  26. package/dist/chunk-CCPBNE2F.mjs +2 -0
  27. package/dist/{chunk-XWQB6APW.mjs → chunk-D62KS7QG.mjs} +1 -1
  28. package/dist/chunk-DI6CRWSW.mjs +1 -0
  29. package/dist/chunk-DTTWBKGN.mjs +0 -0
  30. package/dist/chunk-DV6GWBUJ.js +2 -0
  31. package/dist/{chunk-EPX7BBJD.js → chunk-E4JMCA5X.js} +2 -2
  32. package/dist/chunk-EQAORQC3.mjs +1 -0
  33. package/dist/chunk-FO6IX2DB.js +6 -0
  34. package/dist/chunk-FW23IMBF.mjs +1 -0
  35. package/dist/chunk-FYKRDDKG.js +1 -0
  36. package/dist/chunk-GSKMHXHG.js +1 -0
  37. package/dist/chunk-GUQFNJHE.mjs +1 -0
  38. package/dist/{chunk-D536HC5M.js → chunk-HQPWFUP5.js} +1 -1
  39. package/dist/chunk-ICE6NC3S.mjs +1 -0
  40. package/dist/chunk-IFUED5ZS.mjs +1 -0
  41. package/dist/chunk-ISKTBM4L.js +1 -0
  42. package/dist/chunk-IYKBX24M.js +1 -0
  43. package/dist/chunk-KOEWROYV.mjs +6 -0
  44. package/dist/chunk-KRN6YSR2.mjs +1 -0
  45. package/dist/chunk-KZXZWGFX.mjs +1 -0
  46. package/dist/chunk-L24C5TEX.mjs +1 -0
  47. package/dist/chunk-L72YAV5N.js +3 -0
  48. package/dist/chunk-LK6I3HMH.mjs +0 -0
  49. package/dist/{chunk-XBIKSAH6.js → chunk-LTHT4A4S.js} +1 -1
  50. package/dist/chunk-LWH66Q7Q.js +1 -0
  51. package/dist/chunk-MERJFGEP.mjs +59 -0
  52. package/dist/chunk-MJ6XZFVD.mjs +1 -0
  53. package/dist/chunk-MNOHUTKE.js +15 -0
  54. package/dist/chunk-MP4QSEO2.mjs +1 -0
  55. package/dist/{chunk-HL5PQT3A.mjs → chunk-OEXVWIHW.mjs} +1 -1
  56. package/dist/chunk-PVAVS3IU.js +1 -0
  57. package/dist/chunk-QEACB5VG.js +1 -0
  58. package/dist/{chunk-EV6W6KXG.mjs → chunk-QKLY4F2J.mjs} +1 -1
  59. package/dist/chunk-QYF7BRG3.js +2 -0
  60. package/dist/chunk-ROG4MNOR.js +4 -0
  61. package/dist/{chunk-D5E5TA74.js → chunk-RORPREG3.js} +1 -1
  62. package/dist/chunk-SORYYVJ7.js +1 -0
  63. package/dist/chunk-SZIOF5SG.js +59 -0
  64. package/dist/{chunk-SAFW7UQZ.js → chunk-THLJYXFB.js} +1 -1
  65. package/dist/chunk-TUIEV7Q7.js +1 -0
  66. package/dist/{chunk-Z4SJCSTS.js → chunk-U4WUDHDK.js} +1 -1
  67. package/dist/chunk-U4XMGWF7.js +1 -0
  68. package/dist/chunk-U67MWOPZ.mjs +1 -0
  69. package/dist/chunk-VMRUBLPI.js +1 -0
  70. package/dist/chunk-WLDI6N3B.mjs +3 -0
  71. package/dist/chunk-WLHNIXWC.mjs +2 -0
  72. package/dist/chunk-WVERBZZU.js +1 -0
  73. package/dist/chunk-XCKTBNKN.js +1 -0
  74. package/dist/chunk-XPV6VILW.mjs +1 -0
  75. package/dist/chunk-Z5MJYQSD.mjs +1 -0
  76. package/dist/chunk-ZBFNOJGY.js +1 -0
  77. package/dist/chunk-ZX26QZJ5.mjs +1 -0
  78. package/dist/content-CE-ZdMwG.d.mts +1418 -0
  79. package/dist/content-CYXJ2tfQ.d.ts +1418 -0
  80. package/dist/contentControlValues-DAwTWfgR.d.mts +187 -0
  81. package/dist/contentControlValues-gyVPsi6m.d.ts +187 -0
  82. package/dist/core-plugins.d.mts +1 -2
  83. package/dist/core-plugins.d.ts +1 -2
  84. package/dist/core-plugins.js +1 -1
  85. package/dist/core-plugins.mjs +1 -1
  86. package/dist/core.d.mts +6 -7
  87. package/dist/core.d.ts +6 -7
  88. package/dist/core.js +1 -1
  89. package/dist/core.mjs +1 -1
  90. package/dist/{documentSerializer-C1ueey5d.d.mts → documentSerializer-Bghq9rFI.d.mts} +1 -1
  91. package/dist/{documentSerializer-Chn7J1WG.d.ts → documentSerializer-C4lFC60P.d.ts} +1 -1
  92. package/dist/documentStyles-D87dxl18.d.mts +34 -0
  93. package/dist/documentStyles-DToJv9co.d.ts +34 -0
  94. package/dist/docx/index.d.mts +1 -2
  95. package/dist/docx/index.d.ts +1 -2
  96. package/dist/docx/index.js +1 -1
  97. package/dist/docx/index.mjs +1 -1
  98. package/dist/docx/parser.d.mts +1 -2
  99. package/dist/docx/parser.d.ts +1 -2
  100. package/dist/docx/parser.js +1 -1
  101. package/dist/docx/parser.mjs +1 -1
  102. package/dist/docx/rezip.d.mts +1 -2
  103. package/dist/docx/rezip.d.ts +1 -2
  104. package/dist/docx/rezip.js +1 -1
  105. package/dist/docx/rezip.mjs +1 -1
  106. package/dist/docx/serializer/index.d.mts +2 -3
  107. package/dist/docx/serializer/index.d.ts +2 -3
  108. package/dist/docx/serializer/index.js +1 -1
  109. package/dist/docx/serializer/index.mjs +1 -1
  110. package/dist/{fontLoader-QPwbcX5j.d.ts → fontLoader-Cm02v7PO.d.ts} +63 -3
  111. package/dist/{fontLoader-BOt95Jtf.d.mts → fontLoader-Z7pqeNvZ.d.mts} +63 -3
  112. package/dist/{headerFooterLayout-B5LyDpSM.d.ts → headerFooterLayout-Bd58Tum3.d.ts} +74 -2
  113. package/dist/{headerFooterLayout-DVFcJ832.d.mts → headerFooterLayout-CuIJiIzi.d.mts} +74 -2
  114. package/dist/headless.d.mts +7 -6
  115. package/dist/headless.d.ts +7 -6
  116. package/dist/headless.js +1 -1
  117. package/dist/headless.mjs +1 -1
  118. package/dist/layout-bridge/index.d.mts +4 -4
  119. package/dist/layout-bridge/index.d.ts +4 -4
  120. package/dist/layout-bridge/index.js +1 -1
  121. package/dist/layout-bridge/index.mjs +1 -1
  122. package/dist/layout-bridge/measuring/index.d.mts +4 -0
  123. package/dist/layout-bridge/measuring/index.d.ts +4 -0
  124. package/dist/layout-bridge/measuring/index.js +1 -1
  125. package/dist/layout-bridge/measuring/index.mjs +1 -1
  126. package/dist/layout-bridge/tableInsertHover.js +1 -1
  127. package/dist/layout-bridge/tableInsertHover.mjs +1 -1
  128. package/dist/layout-bridge/toFlowBlocks.d.mts +2 -1
  129. package/dist/layout-bridge/toFlowBlocks.d.ts +2 -1
  130. package/dist/layout-bridge/toFlowBlocks.js +1 -1
  131. package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
  132. package/dist/layout-engine/index.d.mts +4 -1
  133. package/dist/layout-engine/index.d.ts +4 -1
  134. package/dist/layout-engine/index.js +1 -1
  135. package/dist/layout-engine/index.mjs +1 -1
  136. package/dist/layout-engine/types.d.mts +74 -1
  137. package/dist/layout-engine/types.d.ts +74 -1
  138. package/dist/layout-painter/index.d.mts +4 -4
  139. package/dist/layout-painter/index.d.ts +4 -4
  140. package/dist/layout-painter/index.js +1 -1
  141. package/dist/layout-painter/index.mjs +1 -1
  142. package/dist/layout-painter/renderPage.d.mts +27 -4
  143. package/dist/layout-painter/renderPage.d.ts +27 -4
  144. package/dist/layout-painter/renderPage.js +1 -1
  145. package/dist/layout-painter/renderPage.mjs +1 -1
  146. package/dist/managers/AutoSaveManager.d.mts +1 -2
  147. package/dist/managers/AutoSaveManager.d.ts +1 -2
  148. package/dist/managers/TableSelectionManager.d.mts +1 -2
  149. package/dist/managers/TableSelectionManager.d.ts +1 -2
  150. package/dist/managers/types.d.mts +1 -2
  151. package/dist/managers/types.d.ts +1 -2
  152. package/dist/mcp-cli.mjs +23 -22
  153. package/dist/mcp.d.mts +1 -2
  154. package/dist/mcp.d.ts +1 -2
  155. package/dist/mcp.js +3 -3
  156. package/dist/mcp.mjs +1 -1
  157. package/dist/{nodes-D7PTUJ2N.d.ts → nodes-BNkRKBBX.d.ts} +64 -3
  158. package/dist/{nodes-CL8M0L-a.d.mts → nodes-Bz-UHhLE.d.mts} +64 -3
  159. package/dist/prosemirror/commands/formatting.js +1 -1
  160. package/dist/prosemirror/commands/formatting.mjs +1 -1
  161. package/dist/prosemirror/commands/index.d.mts +80 -6
  162. package/dist/prosemirror/commands/index.d.ts +80 -6
  163. package/dist/prosemirror/commands/index.js +1 -1
  164. package/dist/prosemirror/commands/index.mjs +1 -1
  165. package/dist/prosemirror/commands/paragraph.js +1 -1
  166. package/dist/prosemirror/commands/paragraph.mjs +1 -1
  167. package/dist/prosemirror/conversion/fromProseDoc.d.mts +2 -3
  168. package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -3
  169. package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
  170. package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
  171. package/dist/prosemirror/conversion/index.d.mts +3 -4
  172. package/dist/prosemirror/conversion/index.d.ts +3 -4
  173. package/dist/prosemirror/conversion/index.js +1 -1
  174. package/dist/prosemirror/conversion/index.mjs +1 -1
  175. package/dist/prosemirror/editor.css +302 -95
  176. package/dist/prosemirror/extensions/index.js +1 -1
  177. package/dist/prosemirror/extensions/index.mjs +1 -1
  178. package/dist/prosemirror/extensions/nodes/TableExtension.js +1 -1
  179. package/dist/prosemirror/extensions/nodes/TableExtension.mjs +1 -1
  180. package/dist/prosemirror/index.d.mts +94 -7
  181. package/dist/prosemirror/index.d.ts +94 -7
  182. package/dist/prosemirror/index.js +3 -1
  183. package/dist/prosemirror/index.mjs +3 -1
  184. package/dist/prosemirror/plugins/index.d.mts +124 -17
  185. package/dist/prosemirror/plugins/index.d.ts +124 -17
  186. package/dist/prosemirror/plugins/index.js +1 -1
  187. package/dist/prosemirror/plugins/index.mjs +1 -1
  188. package/dist/prosemirror/schema/index.d.mts +3 -4
  189. package/dist/prosemirror/schema/index.d.ts +3 -4
  190. package/dist/prosemirror/schema/index.js +1 -1
  191. package/dist/prosemirror/schema/index.mjs +1 -1
  192. package/dist/prosemirror/styles/index.d.mts +9 -0
  193. package/dist/prosemirror/styles/index.d.ts +9 -0
  194. package/dist/prosemirror/styles/index.js +1 -1
  195. package/dist/prosemirror/styles/index.mjs +1 -1
  196. package/dist/prosemirror/utils/extractTrackedChanges.d.mts +44 -22
  197. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +44 -22
  198. package/dist/prosemirror/utils/extractTrackedChanges.js +1 -1
  199. package/dist/prosemirror/utils/extractTrackedChanges.mjs +1 -1
  200. package/dist/types/content.d.mts +4 -1167
  201. package/dist/types/content.d.ts +4 -1167
  202. package/dist/types/document.d.mts +2 -4
  203. package/dist/types/document.d.ts +2 -4
  204. package/dist/utils/comments.d.mts +78 -5
  205. package/dist/utils/comments.d.ts +78 -5
  206. package/dist/utils/comments.js +1 -1
  207. package/dist/utils/comments.mjs +1 -1
  208. package/dist/utils/highlightColors.js +1 -1
  209. package/dist/utils/highlightColors.mjs +1 -1
  210. package/dist/utils/index.d.mts +2 -3
  211. package/dist/utils/index.d.ts +2 -3
  212. package/dist/utils/index.js +3 -3
  213. package/dist/utils/index.mjs +3 -3
  214. package/dist/{variableDetector-CAdt8yOr.d.mts → variableDetector-C7BLz9sJ.d.mts} +1 -1
  215. package/dist/{variableDetector-W4XEN9YC.d.ts → variableDetector-HPZbJ_gw.d.ts} +1 -1
  216. package/package.json +3 -3
  217. package/dist/chunk-3AZWLVLC.js +0 -1
  218. package/dist/chunk-3NLVHZMT.js +0 -59
  219. package/dist/chunk-5SU4HPQS.mjs +0 -1
  220. package/dist/chunk-7PX32GLB.mjs +0 -1
  221. package/dist/chunk-AHXPHBMT.js +0 -1
  222. package/dist/chunk-B6LYBJ4H.mjs +0 -1
  223. package/dist/chunk-BFB4PRS4.mjs +0 -1
  224. package/dist/chunk-BRHHK4MG.mjs +0 -2
  225. package/dist/chunk-CP5OSG5Z.mjs +0 -1
  226. package/dist/chunk-CUXXRGPQ.mjs +0 -1
  227. package/dist/chunk-D4RPOJC7.js +0 -1
  228. package/dist/chunk-FWTP7BN7.mjs +0 -4
  229. package/dist/chunk-G7AKYAKU.mjs +0 -1
  230. package/dist/chunk-HAAMO2Z2.mjs +0 -1
  231. package/dist/chunk-ILJUDEZ5.mjs +0 -1
  232. package/dist/chunk-IN6IYQ2X.js +0 -1
  233. package/dist/chunk-IO6HZ7KR.js +0 -2
  234. package/dist/chunk-IP2VXNWG.js +0 -1
  235. package/dist/chunk-KBU6QQFU.js +0 -9
  236. package/dist/chunk-LBKMYD3M.mjs +0 -1
  237. package/dist/chunk-LDKESXXK.mjs +0 -3
  238. package/dist/chunk-MZOVDLYL.js +0 -1
  239. package/dist/chunk-N3EIZN65.js +0 -1
  240. package/dist/chunk-NBLJPT54.mjs +0 -1
  241. package/dist/chunk-NERY274X.js +0 -1
  242. package/dist/chunk-NNQWQOC5.mjs +0 -1
  243. package/dist/chunk-NO5LW2DQ.mjs +0 -1
  244. package/dist/chunk-OCAX2KJQ.js +0 -4
  245. package/dist/chunk-OTDF6PZK.js +0 -1
  246. package/dist/chunk-P3AXSRLG.mjs +0 -1
  247. package/dist/chunk-Q4CKLXWA.js +0 -1
  248. package/dist/chunk-QMLIXLZJ.mjs +0 -4
  249. package/dist/chunk-QXHL67FG.mjs +0 -1
  250. package/dist/chunk-TGPS3SRR.mjs +0 -1
  251. package/dist/chunk-TMISJEGL.js +0 -1
  252. package/dist/chunk-TRJWRZZD.js +0 -1
  253. package/dist/chunk-TRQN2SFW.mjs +0 -59
  254. package/dist/chunk-UGXSKZVM.js +0 -1
  255. package/dist/chunk-V435QKZB.js +0 -3
  256. package/dist/chunk-V6SWUCTS.js +0 -2
  257. package/dist/chunk-VQWZHPWI.mjs +0 -1
  258. package/dist/chunk-X3NB7STJ.js +0 -1
  259. package/dist/chunk-XOH7YAYL.js +0 -1
  260. package/dist/chunk-Y5HZAMND.mjs +0 -9
  261. package/dist/chunk-Y7I5QDCN.mjs +0 -1
  262. package/dist/chunk-YCDB5TA6.js +0 -4
  263. package/dist/chunk-YE357WVA.js +0 -1
  264. package/dist/chunk-YVYB4YCI.js +0 -1
  265. package/dist/lists-CvG_iVK3.d.mts +0 -148
  266. package/dist/lists-UTp_tk7B.d.ts +0 -148
@@ -7,39 +7,59 @@
7
7
  * @public
8
8
  */
9
9
  export { SelectionChangeCallback, SelectionContext, createSelectionTrackerPlugin, extractSelectionContext, getSelectionContext, selectionTrackerKey } from './selectionTracker.js';
10
- import { Plugin, EditorState, Transaction, PluginKey } from 'prosemirror-state';
10
+ import { PluginKey, EditorState, Transaction, Plugin } from 'prosemirror-state';
11
+ export { c as createDocumentStylesPlugin, d as documentStylesKey, g as getDocumentStyleResolver } from '../../documentStyles-DToJv9co.js';
12
+ import { m as RevisionInfo } from '../../content-CYXJ2tfQ.js';
11
13
  import '../../formatting-_OXU8gLB.js';
12
14
  import '../../colors-C3vA7HUU.js';
15
+ import '../../styles-BBv7doYK.js';
16
+ import '../styles/index.js';
17
+ import '../../docx/wrapTypes.js';
13
18
 
14
19
  /**
15
- * Suggestion Mode Plugin
16
- *
17
- * When active, intercepts all text insertions and deletions,
18
- * wrapping them in tracked change marks (insertion/deletion)
19
- * instead of modifying the document directly.
20
+ * Suggestion-mode plugin state + shared meta keys.
20
21
  *
21
- * - Typed text is marked as insertion (green underline)
22
- * - Deleted text is NOT removed it's marked as deletion (red strikethrough)
23
- * - Text already marked as insertion by the current author is deleted normally
24
- * (retracting your own suggestion)
22
+ * Kept in its own module to avoid an import cycle: every handler file needs
23
+ * the plugin key + meta constants but should not transitively pull in the
24
+ * plugin factory.
25
25
  */
26
26
 
27
- declare const suggestionModeKey: PluginKey<SuggestionModeState>;
28
27
  interface SuggestionModeState {
29
28
  active: boolean;
30
29
  author: string;
31
30
  }
31
+ declare const suggestionModeKey: PluginKey<SuggestionModeState>;
32
+
32
33
  /**
33
- * Create the suggestion mode plugin.
34
- * When active, text edits become tracked changes.
34
+ * Suggesting-mode toggle / set / query commands. Each dispatches a meta on
35
+ * the plugin key the plugin's `state.apply` merges it into
36
+ * `SuggestionModeState`. No-ops gracefully when the plugin isn't mounted.
35
37
  */
36
- declare function createSuggestionModePlugin(initialActive?: boolean, author?: string): Plugin;
38
+
37
39
  /**
38
- * Toggle suggestion mode on/off.
40
+ * Toggle suggesting mode on/off. The mounted `createSuggestionModePlugin`
41
+ * is required for the dispatch to have any effect — without it the meta
42
+ * is silently dropped. Returns `false` (no-op) if the plugin is missing.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * import { toggleSuggestionMode } from '@eigenpal/docx-editor-core/prosemirror/plugins';
47
+ * toggleSuggestionMode(view.state, view.dispatch);
48
+ * ```
39
49
  */
40
50
  declare function toggleSuggestionMode(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
41
51
  /**
42
- * Set suggestion mode active state and author.
52
+ * Set suggesting mode active state and (optionally) author. Author
53
+ * tracks across every revision minted while the mode is on. The
54
+ * mounted `createSuggestionModePlugin` is required.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * import { setSuggestionMode } from '@eigenpal/docx-editor-core/prosemirror/plugins';
59
+ * setSuggestionMode(true, view.state, view.dispatch, 'Jane');
60
+ * // ... typed text now wraps in <w:ins> with author="Jane"
61
+ * setSuggestionMode(false, view.state, view.dispatch);
62
+ * ```
43
63
  */
44
64
  declare function setSuggestionMode(active: boolean, state: EditorState, dispatch?: (tr: Transaction) => void, author?: string): boolean;
45
65
  /**
@@ -47,4 +67,91 @@ declare function setSuggestionMode(active: boolean, state: EditorState, dispatch
47
67
  */
48
68
  declare function isSuggestionModeActive(state: EditorState): boolean;
49
69
 
50
- export { createSuggestionModePlugin, isSuggestionModeActive, setSuggestionMode, suggestionModeKey, toggleSuggestionMode };
70
+ /**
71
+ * Suggestion Mode Plugin
72
+ *
73
+ * When active, intercepts all text insertions and deletions, wrapping
74
+ * them in tracked-change marks (insertion/deletion) instead of modifying
75
+ * the document directly.
76
+ *
77
+ * - Typed text is marked as insertion (green underline)
78
+ * - Deleted text is NOT removed — it's marked as deletion (red strikethrough)
79
+ * - Text already marked as insertion by the current author is deleted
80
+ * normally (retracting your own suggestion)
81
+ *
82
+ * The implementation is split across this directory for readability:
83
+ * - `state.ts` — plugin key, meta constants, shared types
84
+ * - `markAttrs.ts` — fresh-attr minting + projection
85
+ * - `adjacency.ts` — coalescing lookups (sibling, cross-block, cellMarker)
86
+ * - `handlers/` — keyboard / input handlers (delete, insert, structural)
87
+ * - `commands.ts` — toggle / set / isActive
88
+ * - this file — `createSuggestionModePlugin` + public re-exports
89
+ */
90
+
91
+ /**
92
+ * Create the suggestion-mode ProseMirror plugin. **Must be mounted on
93
+ * the editor view for `setSuggestionMode` and `toggleSuggestionMode`
94
+ * to do anything** — both adapters (`@eigenpal/docx-editor-react`,
95
+ * `@eigenpal/docx-editor-vue`) auto-mount this inside the `DocxEditor`
96
+ * component, so consumers using the bundled components don't need to
97
+ * register it themselves.
98
+ *
99
+ * When active, typed text gets the `insertion` mark, deleted text gets
100
+ * the `deletion` mark (text stays in the doc; the painter strikes it
101
+ * through), Enter sets `pPrIns` on the originating paragraph, and
102
+ * Backspace at paragraph start sets `pPrDel` on the previous paragraph.
103
+ * Author + adjacent same-author marks coalesce into one tracked change.
104
+ *
105
+ * @param initialActive - Whether suggesting mode starts on. Default `false`.
106
+ * @param author - Author name attached to every minted revision. Default `'User'`.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * import { createSuggestionModePlugin } from '@eigenpal/docx-editor-core/prosemirror/plugins';
111
+ *
112
+ * const plugin = createSuggestionModePlugin(false, 'Jane');
113
+ * EditorState.create({ doc, plugins: [plugin, ...other] });
114
+ * ```
115
+ */
116
+ declare function createSuggestionModePlugin(initialActive?: boolean, author?: string): Plugin;
117
+
118
+ /**
119
+ * Single source of tracked-revision ids across the package.
120
+ *
121
+ * Why a shared module-level counter:
122
+ *
123
+ * - Each `revisionId` is the OOXML `<w:ins w:id="…"/>` attribute. Two
124
+ * unrelated revisions emitted by the same author with the same id
125
+ * would silently collapse in the sidebar (grouped by id+author+date)
126
+ * and on accept (resolved by id), so collisions are observable.
127
+ * - Pre-refactor, three call sites each kept their own
128
+ * `Date.now() + offset` counter (suggestionMode.ts, table commands
129
+ * delete.ts, table commands insert.ts). Offsets made first-load
130
+ * collisions rare but not impossible — counters drift independently,
131
+ * and parallel-browser Playwright workers can start from identical
132
+ * `Date.now()` seeds.
133
+ *
134
+ * Routing every mint through this module guarantees within-realm
135
+ * uniqueness even when callers interleave across plugins, commands, and
136
+ * test harnesses.
137
+ *
138
+ * Re-exported as `@public` through `prosemirror/plugins/index.ts` so
139
+ * adapter integrations (image insertion, custom commands) can mint
140
+ * revision triples without reaching into the implementation directly.
141
+ *
142
+ * @packageDocumentation
143
+ * @public
144
+ */
145
+
146
+ /**
147
+ * Build a fresh `RevisionInfo` triple from the active suggesting-mode
148
+ * state. Returns `null` when suggesting mode is OFF — callers use this to
149
+ * decide whether to track an edit or apply it directly.
150
+ *
151
+ * Shared by `suggestionMode.ts`'s text/paragraph handlers and by the
152
+ * suggesting-aware table commands (`addRowBelow`, `deleteRow`, ...). One
153
+ * source of truth for both the mint and the author/date fields.
154
+ */
155
+ declare function makeRevisionInfo(state: EditorState): RevisionInfo | null;
156
+
157
+ export { RevisionInfo, createSuggestionModePlugin, isSuggestionModeActive, makeRevisionInfo, setSuggestionMode, suggestionModeKey, toggleSuggestionMode };
@@ -1 +1 @@
1
- 'use strict';var chunkTRJWRZZD_js=require('../../chunk-TRJWRZZD.js'),chunk6LVPRTB6_js=require('../../chunk-6LVPRTB6.js');require('../../chunk-DC7S76ZX.js');Object.defineProperty(exports,"createSuggestionModePlugin",{enumerable:true,get:function(){return chunkTRJWRZZD_js.b}});Object.defineProperty(exports,"isSuggestionModeActive",{enumerable:true,get:function(){return chunkTRJWRZZD_js.e}});Object.defineProperty(exports,"setSuggestionMode",{enumerable:true,get:function(){return chunkTRJWRZZD_js.d}});Object.defineProperty(exports,"suggestionModeKey",{enumerable:true,get:function(){return chunkTRJWRZZD_js.a}});Object.defineProperty(exports,"toggleSuggestionMode",{enumerable:true,get:function(){return chunkTRJWRZZD_js.c}});Object.defineProperty(exports,"createSelectionTrackerPlugin",{enumerable:true,get:function(){return chunk6LVPRTB6_js.c}});Object.defineProperty(exports,"extractSelectionContext",{enumerable:true,get:function(){return chunk6LVPRTB6_js.b}});Object.defineProperty(exports,"getSelectionContext",{enumerable:true,get:function(){return chunk6LVPRTB6_js.d}});Object.defineProperty(exports,"selectionTrackerKey",{enumerable:true,get:function(){return chunk6LVPRTB6_js.a}});
1
+ 'use strict';require('../../chunk-53VKL6CG.js');var chunkIYKBX24M_js=require('../../chunk-IYKBX24M.js'),chunkWVERBZZU_js=require('../../chunk-WVERBZZU.js'),chunk6LVPRTB6_js=require('../../chunk-6LVPRTB6.js');require('../../chunk-LWH66Q7Q.js');var chunk7HANRHHL_js=require('../../chunk-7HANRHHL.js');require('../../chunk-GSKMHXHG.js'),require('../../chunk-DC7S76ZX.js');Object.defineProperty(exports,"createSuggestionModePlugin",{enumerable:true,get:function(){return chunkIYKBX24M_js.d}});Object.defineProperty(exports,"isSuggestionModeActive",{enumerable:true,get:function(){return chunkIYKBX24M_js.c}});Object.defineProperty(exports,"setSuggestionMode",{enumerable:true,get:function(){return chunkIYKBX24M_js.b}});Object.defineProperty(exports,"toggleSuggestionMode",{enumerable:true,get:function(){return chunkIYKBX24M_js.a}});Object.defineProperty(exports,"createDocumentStylesPlugin",{enumerable:true,get:function(){return chunkWVERBZZU_js.k}});Object.defineProperty(exports,"documentStylesKey",{enumerable:true,get:function(){return chunkWVERBZZU_js.j}});Object.defineProperty(exports,"getDocumentStyleResolver",{enumerable:true,get:function(){return chunkWVERBZZU_js.l}});Object.defineProperty(exports,"createSelectionTrackerPlugin",{enumerable:true,get:function(){return chunk6LVPRTB6_js.c}});Object.defineProperty(exports,"extractSelectionContext",{enumerable:true,get:function(){return chunk6LVPRTB6_js.b}});Object.defineProperty(exports,"getSelectionContext",{enumerable:true,get:function(){return chunk6LVPRTB6_js.d}});Object.defineProperty(exports,"selectionTrackerKey",{enumerable:true,get:function(){return chunk6LVPRTB6_js.a}});Object.defineProperty(exports,"makeRevisionInfo",{enumerable:true,get:function(){return chunk7HANRHHL_js.i}});Object.defineProperty(exports,"suggestionModeKey",{enumerable:true,get:function(){return chunk7HANRHHL_js.e}});
@@ -1 +1 @@
1
- export{b as createSuggestionModePlugin,e as isSuggestionModeActive,d as setSuggestionMode,a as suggestionModeKey,c as toggleSuggestionMode}from'../../chunk-NNQWQOC5.mjs';export{c as createSelectionTrackerPlugin,b as extractSelectionContext,d as getSelectionContext,a as selectionTrackerKey}from'../../chunk-BGY3CB37.mjs';import'../../chunk-QYUPLKLP.mjs';
1
+ import'../../chunk-DTTWBKGN.mjs';export{d as createSuggestionModePlugin,c as isSuggestionModeActive,b as setSuggestionMode,a as toggleSuggestionMode}from'../../chunk-FW23IMBF.mjs';export{k as createDocumentStylesPlugin,j as documentStylesKey,l as getDocumentStyleResolver}from'../../chunk-U67MWOPZ.mjs';export{c as createSelectionTrackerPlugin,b as extractSelectionContext,d as getSelectionContext,a as selectionTrackerKey}from'../../chunk-BGY3CB37.mjs';import'../../chunk-2XP6GLA4.mjs';export{i as makeRevisionInfo,e as suggestionModeKey}from'../../chunk-MJ6XZFVD.mjs';import'../../chunk-DI6CRWSW.mjs';import'../../chunk-QYUPLKLP.mjs';
@@ -9,14 +9,13 @@
9
9
  */
10
10
  import * as prosemirror_model from 'prosemirror-model';
11
11
  import { a as ExtensionManager } from '../../types-RchZmPFN.mjs';
12
- export { I as ImageAttrs, a as ImagePositionAttrs, P as ParagraphAttrs, T as TableAttrs, b as TableCellAttrs, c as TableRowAttrs } from '../../nodes-CL8M0L-a.mjs';
12
+ export { I as ImageAttrs, a as ImagePositionAttrs, P as ParagraphAttrs, T as TableAttrs, b as TableCellAttrs, c as TableRowAttrs } from '../../nodes-Bz-UHhLE.mjs';
13
13
  export { F as FontFamilyAttrs, a as FontSizeAttrs, H as HyperlinkAttrs, T as TextColorAttrs, U as UnderlineAttrs } from '../../marks-BY573yZn.mjs';
14
14
  import 'prosemirror-state';
15
- import '../../formatting-BH4hcZiq.mjs';
16
15
  import '../../colors-C3vA7HUU.mjs';
17
- import '../../lists-CvG_iVK3.mjs';
16
+ import '../../formatting-BH4hcZiq.mjs';
17
+ import '../../content-CE-ZdMwG.mjs';
18
18
  import '../../docx/wrapTypes.mjs';
19
- import '../../types/content.mjs';
20
19
 
21
20
  declare const singletonManager: ExtensionManager;
22
21
  declare const schema: prosemirror_model.Schema<any, any>;
@@ -9,14 +9,13 @@
9
9
  */
10
10
  import * as prosemirror_model from 'prosemirror-model';
11
11
  import { a as ExtensionManager } from '../../types-RchZmPFN.js';
12
- export { I as ImageAttrs, a as ImagePositionAttrs, P as ParagraphAttrs, T as TableAttrs, b as TableCellAttrs, c as TableRowAttrs } from '../../nodes-D7PTUJ2N.js';
12
+ export { I as ImageAttrs, a as ImagePositionAttrs, P as ParagraphAttrs, T as TableAttrs, b as TableCellAttrs, c as TableRowAttrs } from '../../nodes-BNkRKBBX.js';
13
13
  export { F as FontFamilyAttrs, a as FontSizeAttrs, H as HyperlinkAttrs, T as TextColorAttrs, U as UnderlineAttrs } from '../../marks-CjC9tF5k.js';
14
14
  import 'prosemirror-state';
15
- import '../../formatting-_OXU8gLB.js';
16
15
  import '../../colors-C3vA7HUU.js';
17
- import '../../lists-UTp_tk7B.js';
16
+ import '../../formatting-_OXU8gLB.js';
17
+ import '../../content-CYXJ2tfQ.js';
18
18
  import '../../docx/wrapTypes.js';
19
- import '../../types/content.js';
20
19
 
21
20
  declare const singletonManager: ExtensionManager;
22
21
  declare const schema: prosemirror_model.Schema<any, any>;
@@ -1 +1 @@
1
- 'use strict';var chunkYVYB4YCI_js=require('../../chunk-YVYB4YCI.js');require('../../chunk-IO6HZ7KR.js'),require('../../chunk-BHBOAP6Z.js'),require('../../chunk-MZ7LW5CH.js'),require('../../chunk-N3Y5BUKV.js'),require('../../chunk-6LVPRTB6.js'),require('../../chunk-NERY274X.js'),require('../../chunk-MJ5FQX7Q.js'),require('../../chunk-C2BAPYGJ.js'),require('../../chunk-Q4CKLXWA.js'),require('../../chunk-4Q2IP5FW.js'),require('../../chunk-DC7S76ZX.js');Object.defineProperty(exports,"schema",{enumerable:true,get:function(){return chunkYVYB4YCI_js.b}});Object.defineProperty(exports,"singletonManager",{enumerable:true,get:function(){return chunkYVYB4YCI_js.a}});
1
+ 'use strict';var chunkVMRUBLPI_js=require('../../chunk-VMRUBLPI.js');require('../../chunk-2EQGBVPV.js'),require('../../chunk-BHBOAP6Z.js'),require('../../chunk-MZ7LW5CH.js'),require('../../chunk-N3Y5BUKV.js'),require('../../chunk-WVERBZZU.js'),require('../../chunk-6LVPRTB6.js'),require('../../chunk-LWH66Q7Q.js'),require('../../chunk-TUIEV7Q7.js'),require('../../chunk-7HANRHHL.js'),require('../../chunk-MJ5FQX7Q.js'),require('../../chunk-C2BAPYGJ.js'),require('../../chunk-4Q2IP5FW.js'),require('../../chunk-GSKMHXHG.js'),require('../../chunk-DC7S76ZX.js');Object.defineProperty(exports,"schema",{enumerable:true,get:function(){return chunkVMRUBLPI_js.b}});Object.defineProperty(exports,"singletonManager",{enumerable:true,get:function(){return chunkVMRUBLPI_js.a}});
@@ -1 +1 @@
1
- export{b as schema,a as singletonManager}from'../../chunk-TGPS3SRR.mjs';import'../../chunk-BRHHK4MG.mjs';import'../../chunk-MOKKS75W.mjs';import'../../chunk-OZMNIX6U.mjs';import'../../chunk-AMENZY5F.mjs';import'../../chunk-BGY3CB37.mjs';import'../../chunk-CP5OSG5Z.mjs';import'../../chunk-67LVRQIR.mjs';import'../../chunk-LE67NTCN.mjs';import'../../chunk-VQWZHPWI.mjs';import'../../chunk-VW22RZ6C.mjs';import'../../chunk-QYUPLKLP.mjs';
1
+ export{b as schema,a as singletonManager}from'../../chunk-ICE6NC3S.mjs';import'../../chunk-CCPBNE2F.mjs';import'../../chunk-MOKKS75W.mjs';import'../../chunk-OZMNIX6U.mjs';import'../../chunk-AMENZY5F.mjs';import'../../chunk-U67MWOPZ.mjs';import'../../chunk-BGY3CB37.mjs';import'../../chunk-2XP6GLA4.mjs';import'../../chunk-ZX26QZJ5.mjs';import'../../chunk-MJ6XZFVD.mjs';import'../../chunk-67LVRQIR.mjs';import'../../chunk-LE67NTCN.mjs';import'../../chunk-VW22RZ6C.mjs';import'../../chunk-DI6CRWSW.mjs';import'../../chunk-QYUPLKLP.mjs';
@@ -61,6 +61,15 @@ declare class StyleResolver {
61
61
  * @returns Resolved paragraph and run formatting
62
62
  */
63
63
  resolveParagraphStyle(styleId: string | undefined | null): ResolvedParagraphStyle;
64
+ /**
65
+ * Resolve the style applied to the paragraph that follows one styled with
66
+ * `styleId` when the user presses Enter (OOXML `w:next`, §17.7.4.10).
67
+ *
68
+ * Returns null when the style has no `w:next`, when `next` points back at
69
+ * the same style (the common heading-stays-heading case is handled by the
70
+ * caller), or when the style is unknown.
71
+ */
72
+ getNextStyleId(styleId: string | undefined | null): string | null;
64
73
  /**
65
74
  * Get all available table styles (for style gallery)
66
75
  */
@@ -61,6 +61,15 @@ declare class StyleResolver {
61
61
  * @returns Resolved paragraph and run formatting
62
62
  */
63
63
  resolveParagraphStyle(styleId: string | undefined | null): ResolvedParagraphStyle;
64
+ /**
65
+ * Resolve the style applied to the paragraph that follows one styled with
66
+ * `styleId` when the user presses Enter (OOXML `w:next`, §17.7.4.10).
67
+ *
68
+ * Returns null when the style has no `w:next`, when `next` points back at
69
+ * the same style (the common heading-stays-heading case is handled by the
70
+ * caller), or when the style is unknown.
71
+ */
72
+ getNextStyleId(styleId: string | undefined | null): string | null;
64
73
  /**
65
74
  * Get all available table styles (for style gallery)
66
75
  */
@@ -1 +1 @@
1
- 'use strict';var chunkIP2VXNWG_js=require('../../chunk-IP2VXNWG.js');require('../../chunk-MZOVDLYL.js'),require('../../chunk-Q4CKLXWA.js'),require('../../chunk-DC7S76ZX.js');Object.defineProperty(exports,"StyleResolver",{enumerable:true,get:function(){return chunkIP2VXNWG_js.a}});Object.defineProperty(exports,"createStyleResolver",{enumerable:true,get:function(){return chunkIP2VXNWG_js.b}});
1
+ 'use strict';require('../../chunk-ISKTBM4L.js');var chunkLWH66Q7Q_js=require('../../chunk-LWH66Q7Q.js');require('../../chunk-GSKMHXHG.js'),require('../../chunk-DC7S76ZX.js');Object.defineProperty(exports,"StyleResolver",{enumerable:true,get:function(){return chunkLWH66Q7Q_js.a}});Object.defineProperty(exports,"createStyleResolver",{enumerable:true,get:function(){return chunkLWH66Q7Q_js.b}});
@@ -1 +1 @@
1
- export{a as StyleResolver,b as createStyleResolver}from'../../chunk-NBLJPT54.mjs';import'../../chunk-ILJUDEZ5.mjs';import'../../chunk-VQWZHPWI.mjs';import'../../chunk-QYUPLKLP.mjs';
1
+ import'../../chunk-LK6I3HMH.mjs';export{a as StyleResolver,b as createStyleResolver}from'../../chunk-2XP6GLA4.mjs';import'../../chunk-DI6CRWSW.mjs';import'../../chunk-QYUPLKLP.mjs';
@@ -6,25 +6,22 @@
6
6
  * for replace ops).
7
7
  *
8
8
  * Pure function — no React, no Vue, no side effects. Single O(N) walk
9
- * over text nodes. Lifted from packages/react/src/hooks/useTrackedChanges.ts
10
- * so both adapters can call it directly.
11
- *
12
- * @remarks
13
- * Tagged `@internal` post-1.0 cut. Both adapters re-export this through
14
- * their own composables (`useTrackedChanges`); consumers should prefer
15
- * those. The subpath stays in `package.json` `exports` for back-compat;
16
- * expect it to move behind a public surface in a future major.
9
+ * over text nodes. Consumers building custom sidebars should prefer the
10
+ * adapter-specific wrappers (`useTrackedChanges` in
11
+ * `@eigenpal/docx-editor-react/hooks` and
12
+ * `@eigenpal/docx-editor-vue/composables`), which add the memoization
13
+ * and reactivity layer. Reach for the core function directly for
14
+ * server-side analysis or test fixtures.
17
15
  *
18
16
  * @packageDocumentation
19
- * @internal
17
+ * @public
20
18
  */
21
19
  import { EditorState } from 'prosemirror-state';
22
20
  import { TrackedChangeEntry } from '../../utils/comments.mjs';
23
- import '../../types/content.mjs';
21
+ import '../../content-CE-ZdMwG.mjs';
24
22
  import '../../formatting-BH4hcZiq.mjs';
25
23
  import '../../colors-C3vA7HUU.mjs';
26
24
  import '../../docx/wrapTypes.mjs';
27
- import '../../lists-CvG_iVK3.mjs';
28
25
 
29
26
  /**
30
27
  * Walk the PM doc once and derive (a) the tracked-change list and (b) a
@@ -34,20 +31,22 @@ import '../../lists-CvG_iVK3.mjs';
34
31
  * for replace ops).
35
32
  *
36
33
  * Pure function — no React, no Vue, no side effects. Single O(N) walk
37
- * over text nodes. Lifted from packages/react/src/hooks/useTrackedChanges.ts
38
- * so both adapters can call it directly.
39
- *
40
- * @remarks
41
- * Tagged `@internal` post-1.0 cut. Both adapters re-export this through
42
- * their own composables (`useTrackedChanges`); consumers should prefer
43
- * those. The subpath stays in `package.json` `exports` for back-compat;
44
- * expect it to move behind a public surface in a future major.
34
+ * over text nodes. Consumers building custom sidebars should prefer the
35
+ * adapter-specific wrappers (`useTrackedChanges` in
36
+ * `@eigenpal/docx-editor-react/hooks` and
37
+ * `@eigenpal/docx-editor-vue/composables`), which add the memoization
38
+ * and reactivity layer. Reach for the core function directly for
39
+ * server-side analysis or test fixtures.
45
40
  *
46
41
  * @packageDocumentation
47
- * @internal
42
+ * @public
48
43
  */
49
44
 
50
- /** @internal */
45
+ /**
46
+ * Output of {@link extractTrackedChanges}.
47
+ *
48
+ * @public
49
+ */
51
50
  interface TrackedChangesResult {
52
51
  /** Tracked-change entries, sorted by document position, with adjacent same-revision entries merged. */
53
52
  entries: TrackedChangeEntry[];
@@ -57,7 +56,30 @@ interface TrackedChangesResult {
57
56
  */
58
57
  commentToRevision: Map<number, number>;
59
58
  }
60
- /** @internal */
59
+ /**
60
+ * Walk the PM doc and extract every tracked change as a flat list of
61
+ * `TrackedChangeEntry` plus a comment→revision overlap map. Adjacent
62
+ * inline marks coalesce by `(type, revisionId, author, date)`; a
63
+ * deletion immediately followed by an insertion (same author + same
64
+ * date) collapses into a single `replacement` entry; paragraph-mark
65
+ * cards (`paragraphMarkInsertion` / `paragraphMarkDeletion`) are
66
+ * hidden when an inline entry already covers their revision triple
67
+ * (one Accept clears every site of one conceptual change).
68
+ *
69
+ * Pure and deterministic. Returns `EMPTY_RESULT` on null state.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * import { extractTrackedChanges } from '@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges';
74
+ *
75
+ * const { entries, commentToRevision } = extractTrackedChanges(view.state);
76
+ * for (const e of entries) {
77
+ * console.log(e.type, e.author, e.text);
78
+ * }
79
+ * ```
80
+ *
81
+ * @public
82
+ */
61
83
  declare function extractTrackedChanges(state: EditorState | null): TrackedChangesResult;
62
84
 
63
85
  export { type TrackedChangesResult, extractTrackedChanges };
@@ -6,25 +6,22 @@
6
6
  * for replace ops).
7
7
  *
8
8
  * Pure function — no React, no Vue, no side effects. Single O(N) walk
9
- * over text nodes. Lifted from packages/react/src/hooks/useTrackedChanges.ts
10
- * so both adapters can call it directly.
11
- *
12
- * @remarks
13
- * Tagged `@internal` post-1.0 cut. Both adapters re-export this through
14
- * their own composables (`useTrackedChanges`); consumers should prefer
15
- * those. The subpath stays in `package.json` `exports` for back-compat;
16
- * expect it to move behind a public surface in a future major.
9
+ * over text nodes. Consumers building custom sidebars should prefer the
10
+ * adapter-specific wrappers (`useTrackedChanges` in
11
+ * `@eigenpal/docx-editor-react/hooks` and
12
+ * `@eigenpal/docx-editor-vue/composables`), which add the memoization
13
+ * and reactivity layer. Reach for the core function directly for
14
+ * server-side analysis or test fixtures.
17
15
  *
18
16
  * @packageDocumentation
19
- * @internal
17
+ * @public
20
18
  */
21
19
  import { EditorState } from 'prosemirror-state';
22
20
  import { TrackedChangeEntry } from '../../utils/comments.js';
23
- import '../../types/content.js';
21
+ import '../../content-CYXJ2tfQ.js';
24
22
  import '../../formatting-_OXU8gLB.js';
25
23
  import '../../colors-C3vA7HUU.js';
26
24
  import '../../docx/wrapTypes.js';
27
- import '../../lists-UTp_tk7B.js';
28
25
 
29
26
  /**
30
27
  * Walk the PM doc once and derive (a) the tracked-change list and (b) a
@@ -34,20 +31,22 @@ import '../../lists-UTp_tk7B.js';
34
31
  * for replace ops).
35
32
  *
36
33
  * Pure function — no React, no Vue, no side effects. Single O(N) walk
37
- * over text nodes. Lifted from packages/react/src/hooks/useTrackedChanges.ts
38
- * so both adapters can call it directly.
39
- *
40
- * @remarks
41
- * Tagged `@internal` post-1.0 cut. Both adapters re-export this through
42
- * their own composables (`useTrackedChanges`); consumers should prefer
43
- * those. The subpath stays in `package.json` `exports` for back-compat;
44
- * expect it to move behind a public surface in a future major.
34
+ * over text nodes. Consumers building custom sidebars should prefer the
35
+ * adapter-specific wrappers (`useTrackedChanges` in
36
+ * `@eigenpal/docx-editor-react/hooks` and
37
+ * `@eigenpal/docx-editor-vue/composables`), which add the memoization
38
+ * and reactivity layer. Reach for the core function directly for
39
+ * server-side analysis or test fixtures.
45
40
  *
46
41
  * @packageDocumentation
47
- * @internal
42
+ * @public
48
43
  */
49
44
 
50
- /** @internal */
45
+ /**
46
+ * Output of {@link extractTrackedChanges}.
47
+ *
48
+ * @public
49
+ */
51
50
  interface TrackedChangesResult {
52
51
  /** Tracked-change entries, sorted by document position, with adjacent same-revision entries merged. */
53
52
  entries: TrackedChangeEntry[];
@@ -57,7 +56,30 @@ interface TrackedChangesResult {
57
56
  */
58
57
  commentToRevision: Map<number, number>;
59
58
  }
60
- /** @internal */
59
+ /**
60
+ * Walk the PM doc and extract every tracked change as a flat list of
61
+ * `TrackedChangeEntry` plus a comment→revision overlap map. Adjacent
62
+ * inline marks coalesce by `(type, revisionId, author, date)`; a
63
+ * deletion immediately followed by an insertion (same author + same
64
+ * date) collapses into a single `replacement` entry; paragraph-mark
65
+ * cards (`paragraphMarkInsertion` / `paragraphMarkDeletion`) are
66
+ * hidden when an inline entry already covers their revision triple
67
+ * (one Accept clears every site of one conceptual change).
68
+ *
69
+ * Pure and deterministic. Returns `EMPTY_RESULT` on null state.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * import { extractTrackedChanges } from '@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges';
74
+ *
75
+ * const { entries, commentToRevision } = extractTrackedChanges(view.state);
76
+ * for (const e of entries) {
77
+ * console.log(e.type, e.author, e.text);
78
+ * }
79
+ * ```
80
+ *
81
+ * @public
82
+ */
61
83
  declare function extractTrackedChanges(state: EditorState | null): TrackedChangesResult;
62
84
 
63
85
  export { type TrackedChangesResult, extractTrackedChanges };
@@ -1 +1 @@
1
- 'use strict';require('../../chunk-DC7S76ZX.js');var l={entries:[],commentToRevision:new Map};function k(d){if(!d)return l;let{doc:h,schema:i}=d,a=i.marks.insertion,u=i.marks.deletion,p=i.marks.comment;if(!a&&!u)return l;let f=[],m=new Map;h.descendants((e,t)=>{if(!e.isText)return;let r=null;for(let n of e.marks)(n.type===a||n.type===u)&&(f.push({type:n.type===a?"insertion":"deletion",text:e.text||"",author:n.attrs.author||"",date:n.attrs.date,from:t,to:t+e.nodeSize,revisionId:n.attrs.revisionId}),r=n);if(p&&r){let n=e.marks.find(s=>s.type===p);if(n){let s=n.attrs.commentId,y=r.attrs.revisionId;m.has(s)||m.set(s,y);}}});let o=[];for(let e of f){let t=o[o.length-1];t&&t.revisionId===e.revisionId&&t.type===e.type&&t.to===e.from?(t.text+=e.text,t.to=e.to):o.push({...e});}let c=[];for(let e=0;e<o.length;e++){let t=o[e],r=o[e+1];t.type==="deletion"&&r&&r.type==="insertion"&&t.author===r.author&&t.date===r.date&&t.to===r.from?(c.push({type:"replacement",text:r.text,deletedText:t.text,author:t.author,date:t.date,from:t.from,to:r.to,revisionId:t.revisionId,insertionRevisionId:r.revisionId}),e++):c.push(t);}return {entries:c,commentToRevision:m}}exports.extractTrackedChanges=k;
1
+ 'use strict';require('../../chunk-DC7S76ZX.js');var B={entries:[],commentToRevision:new Map};function O(S){if(!S)return B;let{doc:K,schema:v}=S,b=v.marks.insertion,g=v.marks.deletion,w=v.marks.comment;if(!b&&!g)return B;let d=[],C=new Map;K.descendants((e,t)=>{if(e.type.name==="paragraph"){let r=e.attrs.pPrIns,i=e.attrs.pPrDel;r&&d.push({type:"paragraphMarkInsertion",text:e.textContent||"",author:r.author||"",date:r.date??void 0,from:t,to:t+e.nodeSize,revisionId:r.revisionId}),i&&d.push({type:"paragraphMarkDeletion",text:e.textContent||"",author:i.author||"",date:i.date??void 0,from:t,to:t+e.nodeSize,revisionId:i.revisionId});let o=e.attrs.pPrChange;if(Array.isArray(o))for(let a of o)d.push({type:"paragraphPropertiesChanged",text:e.textContent||"",author:a.info.author||"",date:a.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:a.info.id});}if(e.type.name==="tableRow"){let r=e.attrs.trIns,i=e.attrs.trDel;r&&d.push({type:"rowInserted",text:e.textContent||"",author:r.author||"",date:r.date??void 0,from:t,to:t+e.nodeSize,revisionId:r.revisionId}),i&&d.push({type:"rowDeleted",text:e.textContent||"",author:i.author||"",date:i.date??void 0,from:t,to:t+e.nodeSize,revisionId:i.revisionId});let o=e.attrs.trPrChange;if(Array.isArray(o))for(let a of o)!a?.info||typeof a.info.id!="number"||d.push({type:"rowPropertiesChanged",text:e.textContent||"",author:a.info.author||"",date:a.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:a.info.id});}if(e.type.name==="tableCell"||e.type.name==="tableHeader"){let r=e.attrs.cellMarker;if(r?.info&&typeof r.info.revisionId=="number"){let a={ins:"cellInserted",del:"cellDeleted",merge:"cellMerged"}[r.kind];a&&d.push({type:a,text:e.textContent||"",author:r.info.author||"",date:r.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:r.info.revisionId});}let i=e.attrs.tcPrChange;if(Array.isArray(i))for(let o of i)!o?.info||typeof o.info.id!="number"||d.push({type:"cellPropertiesChanged",text:e.textContent||"",author:o.info.author||"",date:o.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:o.info.id});}if(e.type.name==="table"){let r=e.attrs.tblPrChange;if(Array.isArray(r))for(let l of r)!l?.info||typeof l.info.id!="number"||d.push({type:"tablePropertiesChanged",text:"",author:l.info.author||"",date:l.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:l.info.id});let i=e.firstChild,o=i?.attrs.trIns,a=i?.attrs.trDel,x=o?"trIns":a?"trDel":null;if(x){let l=o??a,R=true,M=[];if(e.forEach(p=>{if(p.type.name!=="tableRow"){R=false;return}let c=p.attrs[x];if(!c||(c.author??"")!==(l.author??"")||(c.date??null)!==(l.date??null)){R=false;return}M.push(c.revisionId);}),R){let p="";g?e.descendants(h=>{h.isText&&!h.marks.some(P=>P.type===g)&&(p+=h.text||"");}):p=e.textContent||"";let c=l.revisionId,A=M.filter((h,P)=>h!==c&&M.indexOf(h)===P);d.push({type:x==="trIns"?"tableInserted":"tableDeleted",text:p,author:l.author||"",date:l.date??void 0,from:t,to:t+e.nodeSize,revisionId:c,...A.length>0?{coalescedRevisionIds:A}:{}});}}}if(!e.isInline)return;let n=e.isText?e.text||"":e.type.name==="image"?e.attrs.alt||"image":e.type.name,s=null;for(let r of e.marks)(r.type===b||r.type===g)&&(d.push({type:r.type===b?"insertion":"deletion",text:n,author:r.attrs.author||"",date:r.attrs.date,from:t,to:t+e.nodeSize,revisionId:r.attrs.revisionId}),s=r);if(w&&s){let r=e.marks.find(i=>i.type===w);if(r){let i=r.attrs.commentId,o=s.attrs.revisionId;C.has(i)||C.set(i,o);}}});let k={tableInserted:6,tableDeleted:6,tablePropertiesChanged:5,rowInserted:4,rowDeleted:4,rowPropertiesChanged:4,cellInserted:3,cellDeleted:3,cellMerged:3,cellPropertiesChanged:3,paragraphMarkInsertion:2,paragraphMarkDeletion:2,paragraphPropertiesChanged:2},U=e=>e in k,E=new Map,f=[],T=(e,t)=>{let n=new Set(e.coalescedRevisionIds??[]);for(let s of t.coalescedRevisionIds??[])n.add(s);return n.add(t.revisionId),n.delete(e.revisionId),[...n]};for(let e of d){if(!U(e.type)){f.push(e);continue}let t=`${e.author}|${e.date??""}`,n=E.get(t);if(n===void 0){E.set(t,f.push(e)-1);continue}let s=f[n],r=k[e.type]??0,i=k[s.type]??0;r>i?f[n]={...e,coalescedRevisionIds:T(e,s)}:f[n]={...s,coalescedRevisionIds:T(s,e)};}let D=new Map,y=[];for(let e of f){if(!(e.type==="insertion"||e.type==="deletion")){y.push({...e});continue}let n=`${e.type}|${e.author}|${e.date??""}`,s=D.get(n);if(s){let r=s.to===e.from?"":" ";if(s.text+=r+e.text,s.to=e.to,e.revisionId!==s.revisionId){let i=new Set(s.coalescedRevisionIds??[]);for(let o of e.coalescedRevisionIds??[])i.add(o);i.add(e.revisionId),i.delete(s.revisionId),s.coalescedRevisionIds=i.size>0?[...i]:void 0;}}else {let r={...e};D.set(n,r),y.push(r);}}let u=[];for(let e=0;e<y.length;e++){let t=y[e],n=y[e+1];t.type==="deletion"&&n&&n.type==="insertion"&&t.author===n.author&&t.date===n.date&&t.to===n.from?(u.push({type:"replacement",text:n.text,deletedText:t.text,author:t.author,date:t.date,from:t.from,to:n.to,revisionId:t.revisionId,insertionRevisionId:n.revisionId}),e++):u.push(t);}let I=new Map;for(let e of u)if(e.type==="insertion"||e.type==="deletion"||e.type==="replacement"){let t=`${e.author}|${e.date??""}`;I.has(t)||I.set(t,e);}for(let e of u){if(e.type!=="paragraphMarkInsertion"&&e.type!=="paragraphMarkDeletion")continue;let t=I.get(`${e.author}|${e.date??""}`);if(!t)continue;let n=new Set(t.coalescedRevisionIds??[]);for(let s of e.coalescedRevisionIds??[])n.add(s);n.add(e.revisionId),n.delete(t.revisionId),t.type==="replacement"&&t.insertionRevisionId!=null&&n.delete(t.insertionRevisionId),t.coalescedRevisionIds=n.size>0?[...n]:void 0;}let z=new Set,m=new Map;for(let e of u){if(e.type!=="tableInserted"&&e.type!=="tableDeleted")continue;let t=`${e.author}|${e.date??""}`;e.text.trim().length>0||(z.add(e),m.has(t)||m.set(t,e));}for(let e of u){if(e.type!=="paragraphMarkInsertion"&&e.type!=="paragraphMarkDeletion")continue;let t=m.get(`${e.author}|${e.date??""}`);if(!t)continue;let n=new Set(t.coalescedRevisionIds??[]);for(let s of e.coalescedRevisionIds??[])n.add(s);n.add(e.revisionId),n.delete(t.revisionId),t.coalescedRevisionIds=n.size>0?[...n]:void 0;}let H=u.filter(e=>e.type==="insertion"||e.type==="replacement"),$=new Set;for(let e of u){if(e.type!=="paragraphPropertiesChanged")continue;let t=H.find(s=>s.author===e.author&&s.from<e.to&&e.from<s.to);if(!t)continue;let n=new Set(T(t,e));t.type==="replacement"&&t.insertionRevisionId!=null&&n.delete(t.insertionRevisionId),t.coalescedRevisionIds=n.size>0?[...n]:void 0,$.add(e);}return {entries:u.filter(e=>{let t=`${e.author}|${e.date??""}`;return e.type==="tableInserted"||e.type==="tableDeleted"?z.has(e):e.type==="paragraphMarkInsertion"||e.type==="paragraphMarkDeletion"?!I.has(t)&&!m.has(t):e.type==="paragraphPropertiesChanged"?!$.has(e):e.type==="insertion"||e.type==="deletion"||e.type==="replacement"?!m.has(t):true}),commentToRevision:C}}exports.extractTrackedChanges=O;
@@ -1 +1 @@
1
- import'../../chunk-QYUPLKLP.mjs';var l={entries:[],commentToRevision:new Map};function k(d){if(!d)return l;let{doc:h,schema:i}=d,a=i.marks.insertion,u=i.marks.deletion,p=i.marks.comment;if(!a&&!u)return l;let f=[],m=new Map;h.descendants((e,t)=>{if(!e.isText)return;let r=null;for(let n of e.marks)(n.type===a||n.type===u)&&(f.push({type:n.type===a?"insertion":"deletion",text:e.text||"",author:n.attrs.author||"",date:n.attrs.date,from:t,to:t+e.nodeSize,revisionId:n.attrs.revisionId}),r=n);if(p&&r){let n=e.marks.find(s=>s.type===p);if(n){let s=n.attrs.commentId,y=r.attrs.revisionId;m.has(s)||m.set(s,y);}}});let o=[];for(let e of f){let t=o[o.length-1];t&&t.revisionId===e.revisionId&&t.type===e.type&&t.to===e.from?(t.text+=e.text,t.to=e.to):o.push({...e});}let c=[];for(let e=0;e<o.length;e++){let t=o[e],r=o[e+1];t.type==="deletion"&&r&&r.type==="insertion"&&t.author===r.author&&t.date===r.date&&t.to===r.from?(c.push({type:"replacement",text:r.text,deletedText:t.text,author:t.author,date:t.date,from:t.from,to:r.to,revisionId:t.revisionId,insertionRevisionId:r.revisionId}),e++):c.push(t);}return {entries:c,commentToRevision:m}}export{k as extractTrackedChanges};
1
+ import'../../chunk-QYUPLKLP.mjs';var B={entries:[],commentToRevision:new Map};function O(S){if(!S)return B;let{doc:K,schema:v}=S,b=v.marks.insertion,g=v.marks.deletion,w=v.marks.comment;if(!b&&!g)return B;let d=[],C=new Map;K.descendants((e,t)=>{if(e.type.name==="paragraph"){let r=e.attrs.pPrIns,i=e.attrs.pPrDel;r&&d.push({type:"paragraphMarkInsertion",text:e.textContent||"",author:r.author||"",date:r.date??void 0,from:t,to:t+e.nodeSize,revisionId:r.revisionId}),i&&d.push({type:"paragraphMarkDeletion",text:e.textContent||"",author:i.author||"",date:i.date??void 0,from:t,to:t+e.nodeSize,revisionId:i.revisionId});let o=e.attrs.pPrChange;if(Array.isArray(o))for(let a of o)d.push({type:"paragraphPropertiesChanged",text:e.textContent||"",author:a.info.author||"",date:a.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:a.info.id});}if(e.type.name==="tableRow"){let r=e.attrs.trIns,i=e.attrs.trDel;r&&d.push({type:"rowInserted",text:e.textContent||"",author:r.author||"",date:r.date??void 0,from:t,to:t+e.nodeSize,revisionId:r.revisionId}),i&&d.push({type:"rowDeleted",text:e.textContent||"",author:i.author||"",date:i.date??void 0,from:t,to:t+e.nodeSize,revisionId:i.revisionId});let o=e.attrs.trPrChange;if(Array.isArray(o))for(let a of o)!a?.info||typeof a.info.id!="number"||d.push({type:"rowPropertiesChanged",text:e.textContent||"",author:a.info.author||"",date:a.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:a.info.id});}if(e.type.name==="tableCell"||e.type.name==="tableHeader"){let r=e.attrs.cellMarker;if(r?.info&&typeof r.info.revisionId=="number"){let a={ins:"cellInserted",del:"cellDeleted",merge:"cellMerged"}[r.kind];a&&d.push({type:a,text:e.textContent||"",author:r.info.author||"",date:r.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:r.info.revisionId});}let i=e.attrs.tcPrChange;if(Array.isArray(i))for(let o of i)!o?.info||typeof o.info.id!="number"||d.push({type:"cellPropertiesChanged",text:e.textContent||"",author:o.info.author||"",date:o.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:o.info.id});}if(e.type.name==="table"){let r=e.attrs.tblPrChange;if(Array.isArray(r))for(let l of r)!l?.info||typeof l.info.id!="number"||d.push({type:"tablePropertiesChanged",text:"",author:l.info.author||"",date:l.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:l.info.id});let i=e.firstChild,o=i?.attrs.trIns,a=i?.attrs.trDel,x=o?"trIns":a?"trDel":null;if(x){let l=o??a,R=true,M=[];if(e.forEach(p=>{if(p.type.name!=="tableRow"){R=false;return}let c=p.attrs[x];if(!c||(c.author??"")!==(l.author??"")||(c.date??null)!==(l.date??null)){R=false;return}M.push(c.revisionId);}),R){let p="";g?e.descendants(h=>{h.isText&&!h.marks.some(P=>P.type===g)&&(p+=h.text||"");}):p=e.textContent||"";let c=l.revisionId,A=M.filter((h,P)=>h!==c&&M.indexOf(h)===P);d.push({type:x==="trIns"?"tableInserted":"tableDeleted",text:p,author:l.author||"",date:l.date??void 0,from:t,to:t+e.nodeSize,revisionId:c,...A.length>0?{coalescedRevisionIds:A}:{}});}}}if(!e.isInline)return;let n=e.isText?e.text||"":e.type.name==="image"?e.attrs.alt||"image":e.type.name,s=null;for(let r of e.marks)(r.type===b||r.type===g)&&(d.push({type:r.type===b?"insertion":"deletion",text:n,author:r.attrs.author||"",date:r.attrs.date,from:t,to:t+e.nodeSize,revisionId:r.attrs.revisionId}),s=r);if(w&&s){let r=e.marks.find(i=>i.type===w);if(r){let i=r.attrs.commentId,o=s.attrs.revisionId;C.has(i)||C.set(i,o);}}});let k={tableInserted:6,tableDeleted:6,tablePropertiesChanged:5,rowInserted:4,rowDeleted:4,rowPropertiesChanged:4,cellInserted:3,cellDeleted:3,cellMerged:3,cellPropertiesChanged:3,paragraphMarkInsertion:2,paragraphMarkDeletion:2,paragraphPropertiesChanged:2},U=e=>e in k,E=new Map,f=[],T=(e,t)=>{let n=new Set(e.coalescedRevisionIds??[]);for(let s of t.coalescedRevisionIds??[])n.add(s);return n.add(t.revisionId),n.delete(e.revisionId),[...n]};for(let e of d){if(!U(e.type)){f.push(e);continue}let t=`${e.author}|${e.date??""}`,n=E.get(t);if(n===void 0){E.set(t,f.push(e)-1);continue}let s=f[n],r=k[e.type]??0,i=k[s.type]??0;r>i?f[n]={...e,coalescedRevisionIds:T(e,s)}:f[n]={...s,coalescedRevisionIds:T(s,e)};}let D=new Map,y=[];for(let e of f){if(!(e.type==="insertion"||e.type==="deletion")){y.push({...e});continue}let n=`${e.type}|${e.author}|${e.date??""}`,s=D.get(n);if(s){let r=s.to===e.from?"":" ";if(s.text+=r+e.text,s.to=e.to,e.revisionId!==s.revisionId){let i=new Set(s.coalescedRevisionIds??[]);for(let o of e.coalescedRevisionIds??[])i.add(o);i.add(e.revisionId),i.delete(s.revisionId),s.coalescedRevisionIds=i.size>0?[...i]:void 0;}}else {let r={...e};D.set(n,r),y.push(r);}}let u=[];for(let e=0;e<y.length;e++){let t=y[e],n=y[e+1];t.type==="deletion"&&n&&n.type==="insertion"&&t.author===n.author&&t.date===n.date&&t.to===n.from?(u.push({type:"replacement",text:n.text,deletedText:t.text,author:t.author,date:t.date,from:t.from,to:n.to,revisionId:t.revisionId,insertionRevisionId:n.revisionId}),e++):u.push(t);}let I=new Map;for(let e of u)if(e.type==="insertion"||e.type==="deletion"||e.type==="replacement"){let t=`${e.author}|${e.date??""}`;I.has(t)||I.set(t,e);}for(let e of u){if(e.type!=="paragraphMarkInsertion"&&e.type!=="paragraphMarkDeletion")continue;let t=I.get(`${e.author}|${e.date??""}`);if(!t)continue;let n=new Set(t.coalescedRevisionIds??[]);for(let s of e.coalescedRevisionIds??[])n.add(s);n.add(e.revisionId),n.delete(t.revisionId),t.type==="replacement"&&t.insertionRevisionId!=null&&n.delete(t.insertionRevisionId),t.coalescedRevisionIds=n.size>0?[...n]:void 0;}let z=new Set,m=new Map;for(let e of u){if(e.type!=="tableInserted"&&e.type!=="tableDeleted")continue;let t=`${e.author}|${e.date??""}`;e.text.trim().length>0||(z.add(e),m.has(t)||m.set(t,e));}for(let e of u){if(e.type!=="paragraphMarkInsertion"&&e.type!=="paragraphMarkDeletion")continue;let t=m.get(`${e.author}|${e.date??""}`);if(!t)continue;let n=new Set(t.coalescedRevisionIds??[]);for(let s of e.coalescedRevisionIds??[])n.add(s);n.add(e.revisionId),n.delete(t.revisionId),t.coalescedRevisionIds=n.size>0?[...n]:void 0;}let H=u.filter(e=>e.type==="insertion"||e.type==="replacement"),$=new Set;for(let e of u){if(e.type!=="paragraphPropertiesChanged")continue;let t=H.find(s=>s.author===e.author&&s.from<e.to&&e.from<s.to);if(!t)continue;let n=new Set(T(t,e));t.type==="replacement"&&t.insertionRevisionId!=null&&n.delete(t.insertionRevisionId),t.coalescedRevisionIds=n.size>0?[...n]:void 0,$.add(e);}return {entries:u.filter(e=>{let t=`${e.author}|${e.date??""}`;return e.type==="tableInserted"||e.type==="tableDeleted"?z.has(e):e.type==="paragraphMarkInsertion"||e.type==="paragraphMarkDeletion"?!I.has(t)&&!m.has(t):e.type==="paragraphPropertiesChanged"?!$.has(e):e.type==="insertion"||e.type==="deletion"||e.type==="replacement"?!m.has(t):true}),commentToRevision:C}}export{O as extractTrackedChanges};