@lostgradient/cinder 0.16.1 → 0.17.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 (556) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/README.md +33 -11
  3. package/components.json +53 -102
  4. package/dist/_internal/chart/chart-utilities.d.ts +1 -0
  5. package/dist/cli/index.js +63 -10
  6. package/dist/cli/mcp-dependencies.d.ts +4 -0
  7. package/dist/components/approval-card/approval-card.css +1 -6
  8. package/dist/components/approval-card/index.js +94 -55
  9. package/dist/components/area-chart/index.js +40 -6
  10. package/dist/components/bar-chart/index.js +132 -83
  11. package/dist/components/code-block/index.js +58 -9
  12. package/dist/components/command-menu/command-menu.css +9 -0
  13. package/dist/components/command-menu/index.js +7 -2
  14. package/dist/components/diff-statistics/diff-statistics.svelte.d.ts +3 -3
  15. package/dist/components/file-upload/file-upload.schema.js +5 -1
  16. package/dist/components/file-upload/file-upload.types.d.ts +2 -0
  17. package/dist/components/file-upload/index.js +37 -27
  18. package/dist/components/invocation-rule-builder/index.d.ts +1 -1
  19. package/dist/components/invocation-rule-builder/index.js +244 -199
  20. package/dist/components/invocation-rule-builder/invocation-rule-builder.css +8 -0
  21. package/dist/components/invocation-rule-builder/invocation-rule-builder.schema.d.ts +2 -2
  22. package/dist/components/invocation-rule-builder/invocation-rule-builder.schema.js +309 -193
  23. package/dist/components/invocation-rule-builder/invocation-rule-builder.svelte.d.ts +3 -2
  24. package/dist/components/invocation-rule-builder/invocation-rule-builder.types.d.ts +98 -31
  25. package/dist/components/json-editor/index.d.ts +5 -0
  26. package/dist/components/json-editor/index.js +261 -0
  27. package/dist/components/json-editor/json-editor.css +49 -0
  28. package/dist/components/{diff-viewer/diff-viewer.schema.js → json-editor/json-editor.schema.js} +37 -49
  29. package/dist/components/json-editor/json-editor.svelte.d.ts +21 -0
  30. package/dist/components/json-editor/json-editor.types.d.ts +25 -0
  31. package/dist/components/{diff-viewer/diff-viewer.variables.js → json-editor/json-editor.variables.js} +4 -4
  32. package/dist/components/json-schema-editor/index.js +2041 -4165
  33. package/dist/components/json-schema-editor/json-schema-editor-state.svelte.d.ts +17 -1
  34. package/dist/components/json-schema-editor/json-schema-editor-types.d.ts +8 -1
  35. package/dist/components/json-schema-editor/json-schema-editor.css +35 -0
  36. package/dist/components/json-schema-editor/json-schema-editor.svelte.d.ts +0 -1
  37. package/dist/components/json-schema-editor/json-schema-validator.d.ts +9 -4
  38. package/dist/components/line-chart/index.js +40 -6
  39. package/dist/components/matrix-chart/index.js +40 -6
  40. package/dist/components/payload-inspector/index.js +10 -2
  41. package/dist/components/payload-inspector/payload-inspector.schema.js +11 -1
  42. package/dist/components/payload-inspector/payload-inspector.types.d.ts +20 -0
  43. package/dist/components/run-step-timeline/index.js +158 -110
  44. package/dist/components/run-step-timeline/run-step-timeline.css +46 -0
  45. package/dist/components/run-step-timeline/run-step-timeline.schema.js +26 -1
  46. package/dist/components/run-step-timeline/run-step-timeline.types.d.ts +22 -2
  47. package/dist/components/schedule-builder/index.js +165 -93
  48. package/dist/components/schedule-builder/schedule-builder.schema.js +8 -1
  49. package/dist/components/schedule-builder/schedule-builder.svelte.d.ts +1 -1
  50. package/dist/components/schedule-builder/schedule-builder.types.d.ts +12 -0
  51. package/dist/components/schema-form/index.d.ts +1 -1
  52. package/dist/components/schema-form/index.js +107 -25
  53. package/dist/components/schema-form/schema-form.schema.js +9 -1
  54. package/dist/components/schema-form/schema-form.svelte.d.ts +1 -1
  55. package/dist/components/schema-form/schema-form.types.d.ts +8 -0
  56. package/dist/components/sidebar/index.js +93 -42
  57. package/dist/components/sidebar/sidebar.css +7 -16
  58. package/dist/components/sidebar/sidebar.schema.js +8 -9
  59. package/dist/components/sidebar/sidebar.types.d.ts +14 -12
  60. package/dist/components/source-diff-viewer/source-diff-viewer.svelte.d.ts +2 -2
  61. package/dist/components/spectrogram/index.js +40 -6
  62. package/dist/components/spectrum-chart/index.js +40 -6
  63. package/dist/components/tabs/tabs.css +2 -0
  64. package/dist/components/textarea/textarea.svelte.d.ts +1 -1
  65. package/dist/components/toast-region/index.js +2 -2
  66. package/dist/components/toast-region/toast-region.css +1 -1
  67. package/dist/components/waveform/index.js +40 -6
  68. package/dist/highlighters/shiki/index.d.ts +47 -5
  69. package/dist/highlighters/shiki/index.js +58 -9
  70. package/dist/index.d.ts +4 -4
  71. package/dist/index.js +15347 -16138
  72. package/dist/server/components/access-gate/index.js +2 -5
  73. package/dist/server/components/approval-card/index.js +2 -2
  74. package/dist/server/components/area-chart/index.js +3 -3
  75. package/dist/server/components/bar-chart/index.js +3 -3
  76. package/dist/server/components/command-menu/index.js +1 -1
  77. package/dist/server/components/context-menu/index.js +5 -5
  78. package/dist/server/components/data-table/index.js +2 -2
  79. package/dist/server/components/diff-statistics/index.js +3 -5
  80. package/dist/server/components/dropdown/index.js +6 -7
  81. package/dist/server/components/file-upload/index.js +2 -3
  82. package/dist/server/components/icons/index.js +17 -26
  83. package/dist/server/components/inline-loading/index.js +1 -1
  84. package/dist/server/components/invocation-rule-builder/index.js +1 -1
  85. package/dist/server/components/json-editor/index.js +13 -0
  86. package/dist/server/components/json-schema-editor/index.js +4 -16
  87. package/dist/server/components/line-chart/index.js +3 -3
  88. package/dist/server/components/matrix-chart/index.js +2 -2
  89. package/dist/server/components/menu-bar/index.js +4 -4
  90. package/dist/server/components/payload-inspector/index.js +2 -2
  91. package/dist/server/components/run-step-timeline/index.js +1 -1
  92. package/dist/server/components/schedule-builder/index.js +3 -3
  93. package/dist/server/components/schema-form/index.js +1 -1
  94. package/dist/server/components/selection-popover/index.js +3 -5
  95. package/dist/server/components/sidebar/index.js +1 -1
  96. package/dist/server/components/spectrogram/index.js +2 -2
  97. package/dist/server/components/spectrum-chart/index.js +2 -2
  98. package/dist/server/components/surface/index.js +3 -5
  99. package/dist/server/components/table/index.js +2 -2
  100. package/dist/server/components/tabs/index.js +5 -5
  101. package/dist/server/components/toast-region/index.js +1 -1
  102. package/dist/server/components/toolbar/index.js +2 -3
  103. package/dist/server/components/waveform/index.js +2 -2
  104. package/dist/server/highlighters/shiki/index.js +61 -25
  105. package/dist/server/index.js +105 -115
  106. package/dist/server/{index.server-7yfz2t73.js → index.server-003t81xk.js} +1 -1
  107. package/dist/server/{index.server-gwgm8gqg.js → index.server-032p855q.js} +4 -4
  108. package/dist/server/{index.server-tf2n3ccm.js → index.server-1vfhzhkj.js} +1 -1
  109. package/dist/server/{index.server-jz5yxwde.js → index.server-4cbqjf14.js} +16 -7
  110. package/dist/server/{index.server-aqethy0w.js → index.server-66nm5gd5.js} +102 -26
  111. package/dist/server/{index.server-m0ezemav.js → index.server-6mnbznbt.js} +4 -2
  112. package/dist/server/{index.server-1nq8h5yb.js → index.server-6vbpz6dd.js} +40 -6
  113. package/dist/server/{index.server-796hb0r8.js → index.server-7qak74fg.js} +1 -1
  114. package/dist/server/{index.server-5exh7rmw.js → index.server-7ygdwxre.js} +57 -5
  115. package/dist/server/{index.server-q1d48s9t.js → index.server-8c6cck0y.js} +6 -4
  116. package/dist/server/index.server-93vt8ktj.js +95 -0
  117. package/dist/server/{index.server-ep81fn23.js → index.server-9eccb2fc.js} +2 -2
  118. package/dist/server/{index.server-zncgb7mw.js → index.server-9nac5z11.js} +92 -49
  119. package/dist/server/{index.server-bf7d81b4.js → index.server-9vqfmhez.js} +16 -18
  120. package/dist/server/{index.server-nt304e00.js → index.server-dx58qant.js} +1 -1
  121. package/dist/server/{index.server-zh3r8vfd.js → index.server-fhrqsg97.js} +1 -1
  122. package/dist/server/{index.server-dq0k0qf6.js → index.server-geq56xaz.js} +10 -10
  123. package/dist/server/{index.server-51sxnete.js → index.server-hxveaqg1.js} +10 -10
  124. package/dist/server/{index.server-c5qv3p61.js → index.server-j87v28yy.js} +59 -30
  125. package/dist/server/{index.server-s5g7reqp.js → index.server-mewms9dg.js} +2 -2
  126. package/dist/server/index.server-mm728d0w.js +20 -0
  127. package/dist/server/{index.server-5mc2vsy0.js → index.server-n0rbn5yf.js} +4 -2
  128. package/dist/server/{index.server-qv0kkre4.js → index.server-ng8y854r.js} +188 -107
  129. package/dist/server/{index.server-wasj5rbh.js → index.server-q5gvb174.js} +4 -4
  130. package/dist/server/{index.server-g5jgq3jp.js → index.server-qxneqxf8.js} +40 -6
  131. package/dist/server/{index.server-x1dha7bk.js → index.server-rnddtcb3.js} +4 -2
  132. package/dist/server/{index.server-7zpzspk6.js → index.server-s4wm4g2a.js} +30 -2
  133. package/dist/server/index.server-szgghcdh.js +887 -0
  134. package/dist/server/{index.server-thcda9ny.js → index.server-vd302sxz.js} +11 -4
  135. package/dist/server/{index.server-3sq9d73w.js → index.server-vz9hqkdq.js} +2 -2
  136. package/dist/server/{index.server-mvjzcna5.js → index.server-wg6ddzpa.js} +42 -20
  137. package/dist/server/{index.server-67q8dmbp.js → index.server-y2ncgt7p.js} +1 -1
  138. package/dist/server/{index.server-4x91gzy1.js → index.server-yqhww50r.js} +4 -4
  139. package/dist/server/{index.server-7798gc22.js → index.server-zfx4magq.js} +4 -2
  140. package/package.json +45 -288
  141. package/src/_internal/chart/chart-utilities.ts +74 -5
  142. package/src/components/approval-card/approval-card-actions.svelte +12 -28
  143. package/src/components/approval-card/approval-card.css +1 -6
  144. package/src/components/bar-chart/bar-chart.examples.json +1 -1
  145. package/src/components/bar-chart/bar-chart.svelte +3 -1
  146. package/src/components/command-menu/command-menu.css +9 -0
  147. package/src/components/command-menu/command-menu.svelte +9 -2
  148. package/src/components/file-upload/file-upload.schema.json +4 -0
  149. package/src/components/file-upload/file-upload.schema.ts +4 -0
  150. package/src/components/file-upload/file-upload.svelte +3 -3
  151. package/src/components/file-upload/file-upload.types.ts +2 -0
  152. package/src/components/invocation-rule-builder/index.ts +1 -0
  153. package/src/components/invocation-rule-builder/invocation-rule-builder.css +8 -0
  154. package/src/components/invocation-rule-builder/invocation-rule-builder.examples.json +6 -0
  155. package/src/components/invocation-rule-builder/invocation-rule-builder.schema.json +70 -7
  156. package/src/components/invocation-rule-builder/invocation-rule-builder.schema.ts +5 -250
  157. package/src/components/invocation-rule-builder/invocation-rule-builder.svelte +106 -83
  158. package/src/components/invocation-rule-builder/invocation-rule-builder.types.ts +145 -62
  159. package/src/components/json-editor/index.ts +6 -0
  160. package/src/components/json-editor/json-editor.css +49 -0
  161. package/src/components/json-editor/json-editor.examples.json +13 -0
  162. package/src/components/json-editor/json-editor.schema.json +57 -0
  163. package/src/components/json-editor/json-editor.schema.ts +62 -0
  164. package/src/components/json-editor/json-editor.svelte +104 -0
  165. package/src/components/json-editor/json-editor.types.ts +29 -0
  166. package/src/components/json-schema-editor/diff-view.svelte +26 -8
  167. package/src/components/json-schema-editor/form-view.svelte +1 -1
  168. package/src/components/json-schema-editor/json-schema-editor-state.svelte.ts +163 -56
  169. package/src/components/json-schema-editor/json-schema-editor-types.ts +8 -1
  170. package/src/components/json-schema-editor/json-schema-editor.css +35 -0
  171. package/src/components/json-schema-editor/json-schema-validator.ts +59 -25
  172. package/src/components/json-schema-editor/json-view.svelte +52 -18
  173. package/src/components/payload-inspector/payload-inspector.schema.json +8 -0
  174. package/src/components/payload-inspector/payload-inspector.schema.ts +10 -0
  175. package/src/components/payload-inspector/payload-inspector.svelte +2 -2
  176. package/src/components/payload-inspector/payload-inspector.types.ts +20 -0
  177. package/src/components/run-step-timeline/run-step-timeline.css +46 -0
  178. package/src/components/run-step-timeline/run-step-timeline.examples.json +3 -3
  179. package/src/components/run-step-timeline/run-step-timeline.schema.json +24 -0
  180. package/src/components/run-step-timeline/run-step-timeline.schema.ts +26 -0
  181. package/src/components/run-step-timeline/run-step-timeline.svelte +41 -4
  182. package/src/components/run-step-timeline/run-step-timeline.types.ts +22 -1
  183. package/src/components/run-step-timeline/run-step-timeline.utilities.ts +9 -1
  184. package/src/components/schedule-builder/schedule-builder.schema.json +7 -0
  185. package/src/components/schedule-builder/schedule-builder.schema.ts +8 -0
  186. package/src/components/schedule-builder/schedule-builder.svelte +94 -22
  187. package/src/components/schedule-builder/schedule-builder.types.ts +12 -0
  188. package/src/components/schema-form/index.ts +1 -0
  189. package/src/components/schema-form/schema-form-body.svelte +94 -17
  190. package/src/components/schema-form/schema-form.examples.json +1 -1
  191. package/src/components/schema-form/schema-form.schema.json +5 -0
  192. package/src/components/schema-form/schema-form.schema.ts +6 -0
  193. package/src/components/schema-form/schema-form.svelte +4 -0
  194. package/src/components/schema-form/schema-form.types.ts +9 -0
  195. package/src/components/side-navigation/side-navigation.examples.json +1 -1
  196. package/src/components/sidebar/sidebar.css +7 -16
  197. package/src/components/sidebar/sidebar.examples.json +3 -3
  198. package/src/components/sidebar/sidebar.schema.json +7 -8
  199. package/src/components/sidebar/sidebar.schema.ts +8 -8
  200. package/src/components/sidebar/sidebar.svelte +65 -27
  201. package/src/components/sidebar/sidebar.types.ts +14 -12
  202. package/src/components/tabs/tabs.css +2 -0
  203. package/src/components/toast-region/toast-region.css +1 -1
  204. package/src/components/toast-region/toast-region.examples.json +1 -1
  205. package/src/components/toast-region/toast-region.svelte +2 -2
  206. package/src/highlighters/shiki/index.ts +157 -17
  207. package/src/index.ts +5 -7
  208. package/src/styles/components.css +1 -1
  209. package/src/utilities/change-tracker.svelte.ts +1 -1
  210. package/dist/commentary/anchor-decorations.d.ts +0 -86
  211. package/dist/commentary/anchor-decorations.js +0 -490
  212. package/dist/commentary/anchoring.d.ts +0 -93
  213. package/dist/commentary/anchoring.js +0 -157
  214. package/dist/commentary/comments/index.d.ts +0 -12
  215. package/dist/commentary/comments/index.js +0 -14
  216. package/dist/commentary/comments/mentions.d.ts +0 -43
  217. package/dist/commentary/comments/mentions.js +0 -65
  218. package/dist/commentary/comments/reanchor.d.ts +0 -86
  219. package/dist/commentary/comments/reanchor.js +0 -220
  220. package/dist/commentary/comments/types.d.ts +0 -260
  221. package/dist/commentary/comments/types.js +0 -83
  222. package/dist/commentary/comments/updates.d.ts +0 -102
  223. package/dist/commentary/comments/updates.js +0 -226
  224. package/dist/commentary/export/comments-export.d.ts +0 -42
  225. package/dist/commentary/export/comments-export.js +0 -258
  226. package/dist/commentary/export/index.d.ts +0 -12
  227. package/dist/commentary/export/index.js +0 -12
  228. package/dist/commentary/export/markdown-summary.d.ts +0 -31
  229. package/dist/commentary/export/markdown-summary.js +0 -218
  230. package/dist/commentary/export/types.d.ts +0 -162
  231. package/dist/commentary/export/types.js +0 -7
  232. package/dist/commentary/export/unified-diff.d.ts +0 -28
  233. package/dist/commentary/export/unified-diff.js +0 -250
  234. package/dist/commentary/index.d.ts +0 -6
  235. package/dist/commentary/index.js +0 -6
  236. package/dist/commentary/session/index.d.ts +0 -12
  237. package/dist/commentary/session/index.js +0 -14
  238. package/dist/commentary/session/persistence.d.ts +0 -92
  239. package/dist/commentary/session/persistence.js +0 -253
  240. package/dist/commentary/session/types.d.ts +0 -208
  241. package/dist/commentary/session/types.js +0 -26
  242. package/dist/commentary/session/updates.d.ts +0 -155
  243. package/dist/commentary/session/updates.js +0 -362
  244. package/dist/commentary/shared/anchor-types.d.ts +0 -116
  245. package/dist/commentary/shared/anchor-types.js +0 -9
  246. package/dist/components/diff-viewer/diff-controller.svelte.d.ts +0 -75
  247. package/dist/components/diff-viewer/diff-front-matter.svelte.d.ts +0 -28
  248. package/dist/components/diff-viewer/diff-line.svelte.d.ts +0 -22
  249. package/dist/components/diff-viewer/diff-summary-bar.svelte.d.ts +0 -13
  250. package/dist/components/diff-viewer/diff-toolbar.svelte.d.ts +0 -36
  251. package/dist/components/diff-viewer/diff-viewer.svelte.d.ts +0 -22
  252. package/dist/components/diff-viewer/diff-viewer.types.d.ts +0 -53
  253. package/dist/components/diff-viewer/front-matter-header.svelte.d.ts +0 -26
  254. package/dist/components/diff-viewer/index.d.ts +0 -4
  255. package/dist/components/diff-viewer/index.js +0 -2848
  256. package/dist/components/markdown-editor/editor-skeleton.svelte.d.ts +0 -10
  257. package/dist/components/markdown-editor/editor-toolbar/editor-toolbar.svelte.d.ts +0 -37
  258. package/dist/components/markdown-editor/editor-toolbar/index.d.ts +0 -11
  259. package/dist/components/markdown-editor/editor-toolbar/link-popover.svelte.d.ts +0 -30
  260. package/dist/components/markdown-editor/editor-toolbar/toolbar-button.svelte.d.ts +0 -19
  261. package/dist/components/markdown-editor/editor-toolbar/toolbar-dropdown.svelte.d.ts +0 -24
  262. package/dist/components/markdown-editor/editor-toolbar/toolbar-separator.svelte.d.ts +0 -7
  263. package/dist/components/markdown-editor/editor-toolbar/types.d.ts +0 -13
  264. package/dist/components/markdown-editor/index.css +0 -61
  265. package/dist/components/markdown-editor/index.d.ts +0 -4
  266. package/dist/components/markdown-editor/index.js +0 -7494
  267. package/dist/components/markdown-editor/markdown-editor.schema.d.ts +0 -3
  268. package/dist/components/markdown-editor/markdown-editor.schema.js +0 -177
  269. package/dist/components/markdown-editor/markdown-editor.svelte.d.ts +0 -29
  270. package/dist/components/markdown-editor/markdown-editor.types.d.ts +0 -100
  271. package/dist/components/markdown-editor/markdown-editor.variables.d.ts +0 -2
  272. package/dist/components/markdown-editor/markdown-editor.variables.js +0 -61
  273. package/dist/components/review-editor/comment-composer.svelte.d.ts +0 -37
  274. package/dist/components/review-editor/comment-list.svelte.d.ts +0 -19
  275. package/dist/components/review-editor/comment-sidebar.svelte.d.ts +0 -22
  276. package/dist/components/review-editor/export-actions.svelte.d.ts +0 -18
  277. package/dist/components/review-editor/focus-navigation.d.ts +0 -105
  278. package/dist/components/review-editor/front-matter-fields.svelte.d.ts +0 -10
  279. package/dist/components/review-editor/index.d.ts +0 -20
  280. package/dist/components/review-editor/index.js +0 -14731
  281. package/dist/components/review-editor/live-region.svelte.d.ts +0 -23
  282. package/dist/components/review-editor/review-editor-anchors.svelte.d.ts +0 -96
  283. package/dist/components/review-editor/review-editor-controls.svelte.d.ts +0 -41
  284. package/dist/components/review-editor/review-editor-exports.d.ts +0 -80
  285. package/dist/components/review-editor/review-editor-front-matter.d.ts +0 -28
  286. package/dist/components/review-editor/review-editor-impl.svelte.d.ts +0 -31
  287. package/dist/components/review-editor/review-editor-selection-geometry.d.ts +0 -10
  288. package/dist/components/review-editor/review-editor-selection-types.d.ts +0 -62
  289. package/dist/components/review-editor/review-editor-selection.svelte.d.ts +0 -50
  290. package/dist/components/review-editor/review-editor-state.svelte.d.ts +0 -77
  291. package/dist/components/review-editor/review-editor-threads.svelte.d.ts +0 -137
  292. package/dist/components/review-editor/review-editor.css +0 -273
  293. package/dist/components/review-editor/review-editor.schema.d.ts +0 -3
  294. package/dist/components/review-editor/review-editor.schema.js +0 -143
  295. package/dist/components/review-editor/review-editor.svelte.d.ts +0 -19
  296. package/dist/components/review-editor/review-editor.types.d.ts +0 -77
  297. package/dist/components/review-editor/review-editor.variables.d.ts +0 -2
  298. package/dist/components/review-editor/review-editor.variables.js +0 -61
  299. package/dist/components/review-editor/thread-popover.svelte.d.ts +0 -32
  300. package/dist/diff/index.d.ts +0 -2
  301. package/dist/diff/index.js +0 -1
  302. package/dist/diff/line-diff.d.ts +0 -84
  303. package/dist/diff/line-diff.js +0 -372
  304. package/dist/diff/types.d.ts +0 -1
  305. package/dist/diff/types.js +0 -1
  306. package/dist/editor/attach.d.ts +0 -30
  307. package/dist/editor/attach.js +0 -86
  308. package/dist/editor/bridge.d.ts +0 -110
  309. package/dist/editor/bridge.js +0 -260
  310. package/dist/editor/clipboard.d.ts +0 -19
  311. package/dist/editor/clipboard.js +0 -189
  312. package/dist/editor/commands.d.ts +0 -167
  313. package/dist/editor/commands.js +0 -728
  314. package/dist/editor/component-runtime.d.ts +0 -21
  315. package/dist/editor/component-runtime.js +0 -20
  316. package/dist/editor/editor.d.ts +0 -23
  317. package/dist/editor/editor.js +0 -256
  318. package/dist/editor/index.d.ts +0 -30
  319. package/dist/editor/index.js +0 -42
  320. package/dist/editor/keymap-plugin.d.ts +0 -56
  321. package/dist/editor/keymap-plugin.js +0 -157
  322. package/dist/editor/link-input-rule.d.ts +0 -4
  323. package/dist/editor/link-input-rule.js +0 -26
  324. package/dist/editor/milkdown-plugin-runtime.d.ts +0 -20
  325. package/dist/editor/milkdown-plugin-runtime.js +0 -43
  326. package/dist/editor/placeholder-security.d.ts +0 -22
  327. package/dist/editor/placeholder-security.js +0 -36
  328. package/dist/editor/placeholder.d.ts +0 -14
  329. package/dist/editor/placeholder.js +0 -56
  330. package/dist/editor/sanitize-html.d.ts +0 -32
  331. package/dist/editor/sanitize-html.js +0 -111
  332. package/dist/editor/template-completion-plugin.d.ts +0 -159
  333. package/dist/editor/template-completion-plugin.js +0 -615
  334. package/dist/editor/template-invalid-decoration-plugin.d.ts +0 -73
  335. package/dist/editor/template-invalid-decoration-plugin.js +0 -155
  336. package/dist/editor/template-placeholders.d.ts +0 -96
  337. package/dist/editor/template-placeholders.js +0 -355
  338. package/dist/editor/template-position-utilities.d.ts +0 -34
  339. package/dist/editor/template-position-utilities.js +0 -63
  340. package/dist/editor/template-render.d.ts +0 -37
  341. package/dist/editor/template-render.js +0 -45
  342. package/dist/editor/test-utilities.d.ts +0 -49
  343. package/dist/editor/test-utilities.js +0 -93
  344. package/dist/editor/types.d.ts +0 -234
  345. package/dist/editor/types.js +0 -8
  346. package/dist/markdown/diff/compute.d.ts +0 -28
  347. package/dist/markdown/diff/compute.js +0 -250
  348. package/dist/markdown/diff/frontmatter.d.ts +0 -66
  349. package/dist/markdown/diff/frontmatter.js +0 -135
  350. package/dist/markdown/diff/index.d.ts +0 -27
  351. package/dist/markdown/diff/index.js +0 -28
  352. package/dist/markdown/diff/line-diff.d.ts +0 -2
  353. package/dist/markdown/diff/line-diff.js +0 -1
  354. package/dist/markdown/diff/positions.d.ts +0 -66
  355. package/dist/markdown/diff/positions.js +0 -147
  356. package/dist/markdown/diff/types.d.ts +0 -78
  357. package/dist/markdown/diff/types.js +0 -7
  358. package/dist/markdown/index.d.ts +0 -2
  359. package/dist/markdown/index.js +0 -8
  360. package/dist/markdown/pipeline/ast.d.ts +0 -302
  361. package/dist/markdown/pipeline/ast.js +0 -417
  362. package/dist/markdown/pipeline/errors.d.ts +0 -37
  363. package/dist/markdown/pipeline/errors.js +0 -49
  364. package/dist/markdown/pipeline/frontmatter.d.ts +0 -127
  365. package/dist/markdown/pipeline/frontmatter.js +0 -438
  366. package/dist/markdown/pipeline/index.d.ts +0 -37
  367. package/dist/markdown/pipeline/index.js +0 -40
  368. package/dist/markdown/pipeline/parser.d.ts +0 -65
  369. package/dist/markdown/pipeline/parser.js +0 -106
  370. package/dist/markdown/pipeline/serializer.d.ts +0 -67
  371. package/dist/markdown/pipeline/serializer.js +0 -78
  372. package/dist/markdown/pipeline/strip-positions.d.ts +0 -20
  373. package/dist/markdown/pipeline/strip-positions.js +0 -28
  374. package/dist/markdown/pipeline/types.d.ts +0 -116
  375. package/dist/markdown/pipeline/types.js +0 -8
  376. package/dist/markdown/rendering/extract-code-blocks.d.ts +0 -16
  377. package/dist/markdown/rendering/extract-code-blocks.js +0 -27
  378. package/dist/markdown/rendering/highlighter.d.ts +0 -109
  379. package/dist/markdown/rendering/highlighter.js +0 -251
  380. package/dist/markdown/rendering/index.d.ts +0 -41
  381. package/dist/markdown/rendering/index.js +0 -46
  382. package/dist/markdown/rendering/mermaid-cache.d.ts +0 -55
  383. package/dist/markdown/rendering/mermaid-cache.js +0 -123
  384. package/dist/markdown/rendering/rehype-shiki-sync.d.ts +0 -57
  385. package/dist/markdown/rendering/rehype-shiki-sync.js +0 -354
  386. package/dist/markdown/rendering/render-async.d.ts +0 -43
  387. package/dist/markdown/rendering/render-async.js +0 -114
  388. package/dist/markdown/rendering/render-streaming.d.ts +0 -33
  389. package/dist/markdown/rendering/render-streaming.js +0 -123
  390. package/dist/markdown/rendering/render-worker.d.ts +0 -19
  391. package/dist/markdown/rendering/render-worker.js +0 -35
  392. package/dist/markdown/rendering/render.d.ts +0 -123
  393. package/dist/markdown/rendering/render.js +0 -477
  394. package/dist/markdown/rendering/sanitize-schema.d.ts +0 -24
  395. package/dist/markdown/rendering/sanitize-schema.js +0 -105
  396. package/dist/markdown/rendering/transform-urls.d.ts +0 -37
  397. package/dist/markdown/rendering/transform-urls.js +0 -51
  398. package/dist/markdown/rendering/types.d.ts +0 -51
  399. package/dist/markdown/rendering/types.js +0 -8
  400. package/dist/markdown/rendering/worker-dom-shim.d.ts +0 -87
  401. package/dist/markdown/rendering/worker-dom-shim.js +0 -50
  402. package/dist/markdown/utilities/safe-url.d.ts +0 -100
  403. package/dist/markdown/utilities/safe-url.js +0 -236
  404. package/dist/markdown/utilities/sort-keys.d.ts +0 -19
  405. package/dist/markdown/utilities/sort-keys.js +0 -33
  406. package/dist/server/commentary/anchor-decorations.js +0 -490
  407. package/dist/server/commentary/anchoring.js +0 -157
  408. package/dist/server/commentary/comments/index.js +0 -14
  409. package/dist/server/commentary/comments/mentions.js +0 -65
  410. package/dist/server/commentary/comments/reanchor.js +0 -220
  411. package/dist/server/commentary/comments/types.js +0 -83
  412. package/dist/server/commentary/comments/updates.js +0 -226
  413. package/dist/server/commentary/export/comments-export.js +0 -258
  414. package/dist/server/commentary/export/index.js +0 -12
  415. package/dist/server/commentary/export/markdown-summary.js +0 -218
  416. package/dist/server/commentary/export/types.js +0 -7
  417. package/dist/server/commentary/export/unified-diff.js +0 -250
  418. package/dist/server/commentary/index.js +0 -6
  419. package/dist/server/commentary/session/index.js +0 -14
  420. package/dist/server/commentary/session/persistence.js +0 -253
  421. package/dist/server/commentary/session/types.js +0 -26
  422. package/dist/server/commentary/session/updates.js +0 -362
  423. package/dist/server/commentary/shared/anchor-types.js +0 -9
  424. package/dist/server/components/diff-viewer/index.js +0 -33
  425. package/dist/server/components/markdown-editor/index.js +0 -52
  426. package/dist/server/components/review-editor/index.js +0 -3493
  427. package/dist/server/diff/index.js +0 -1
  428. package/dist/server/diff/line-diff.js +0 -372
  429. package/dist/server/diff/types.js +0 -1
  430. package/dist/server/editor/attach.js +0 -86
  431. package/dist/server/editor/bridge.js +0 -260
  432. package/dist/server/editor/clipboard.js +0 -189
  433. package/dist/server/editor/commands.js +0 -728
  434. package/dist/server/editor/component-runtime.js +0 -20
  435. package/dist/server/editor/editor.js +0 -256
  436. package/dist/server/editor/index.js +0 -42
  437. package/dist/server/editor/keymap-plugin.js +0 -157
  438. package/dist/server/editor/link-input-rule.js +0 -26
  439. package/dist/server/editor/milkdown-plugin-runtime.js +0 -43
  440. package/dist/server/editor/placeholder-security.js +0 -36
  441. package/dist/server/editor/placeholder.js +0 -56
  442. package/dist/server/editor/sanitize-html.js +0 -111
  443. package/dist/server/editor/template-completion-plugin.js +0 -615
  444. package/dist/server/editor/template-invalid-decoration-plugin.js +0 -155
  445. package/dist/server/editor/template-placeholders.js +0 -355
  446. package/dist/server/editor/template-position-utilities.js +0 -63
  447. package/dist/server/editor/template-render.js +0 -45
  448. package/dist/server/editor/test-utilities.js +0 -93
  449. package/dist/server/editor/types.js +0 -8
  450. package/dist/server/index.server-25wmev4e.js +0 -2
  451. package/dist/server/index.server-2c56kqws.js +0 -187
  452. package/dist/server/index.server-45n4s30n.js +0 -35
  453. package/dist/server/index.server-4jkqgp17.js +0 -1026
  454. package/dist/server/index.server-8nm871y8.js +0 -176
  455. package/dist/server/index.server-d04aj37r.js +0 -62
  456. package/dist/server/index.server-dg19y3m7.js +0 -9
  457. package/dist/server/index.server-g3726bja.js +0 -9
  458. package/dist/server/index.server-gyzmkrnz.js +0 -2
  459. package/dist/server/index.server-jp19145t.js +0 -9
  460. package/dist/server/index.server-n4jxy52q.js +0 -2
  461. package/dist/server/index.server-sghkqw5x.js +0 -421
  462. package/dist/server/index.server-w6am2dxc.js +0 -12
  463. package/dist/server/index.server-x66zvjfc.js +0 -1163
  464. package/dist/server/index.server-zdhv33ph.js +0 -124
  465. package/dist/server/index.server-zke5zt13.js +0 -9
  466. package/dist/server/markdown/diff/compute.js +0 -250
  467. package/dist/server/markdown/diff/frontmatter.js +0 -135
  468. package/dist/server/markdown/diff/index.js +0 -28
  469. package/dist/server/markdown/diff/line-diff.js +0 -1
  470. package/dist/server/markdown/diff/positions.js +0 -147
  471. package/dist/server/markdown/diff/types.js +0 -7
  472. package/dist/server/markdown/index.js +0 -8
  473. package/dist/server/markdown/pipeline/ast.js +0 -417
  474. package/dist/server/markdown/pipeline/errors.js +0 -49
  475. package/dist/server/markdown/pipeline/frontmatter.js +0 -438
  476. package/dist/server/markdown/pipeline/index.js +0 -40
  477. package/dist/server/markdown/pipeline/parser.js +0 -106
  478. package/dist/server/markdown/pipeline/serializer.js +0 -78
  479. package/dist/server/markdown/pipeline/strip-positions.js +0 -28
  480. package/dist/server/markdown/pipeline/types.js +0 -8
  481. package/dist/server/markdown/rendering/extract-code-blocks.js +0 -27
  482. package/dist/server/markdown/rendering/highlighter.js +0 -251
  483. package/dist/server/markdown/rendering/index.js +0 -46
  484. package/dist/server/markdown/rendering/mermaid-cache.js +0 -123
  485. package/dist/server/markdown/rendering/rehype-shiki-sync.js +0 -354
  486. package/dist/server/markdown/rendering/render-async.js +0 -114
  487. package/dist/server/markdown/rendering/render-streaming.js +0 -123
  488. package/dist/server/markdown/rendering/render-worker.js +0 -35
  489. package/dist/server/markdown/rendering/render.js +0 -477
  490. package/dist/server/markdown/rendering/sanitize-schema.js +0 -105
  491. package/dist/server/markdown/rendering/transform-urls.js +0 -51
  492. package/dist/server/markdown/rendering/types.js +0 -8
  493. package/dist/server/markdown/rendering/worker-dom-shim.js +0 -50
  494. package/dist/server/markdown/utilities/safe-url.js +0 -236
  495. package/dist/server/markdown/utilities/sort-keys.js +0 -33
  496. package/src/components/diff-viewer/diff-controller.svelte.ts +0 -250
  497. package/src/components/diff-viewer/diff-front-matter.svelte +0 -52
  498. package/src/components/diff-viewer/diff-line.svelte +0 -340
  499. package/src/components/diff-viewer/diff-summary-bar.svelte +0 -106
  500. package/src/components/diff-viewer/diff-toolbar.svelte +0 -182
  501. package/src/components/diff-viewer/diff-viewer.examples.json +0 -25
  502. package/src/components/diff-viewer/diff-viewer.schema.json +0 -61
  503. package/src/components/diff-viewer/diff-viewer.schema.ts +0 -70
  504. package/src/components/diff-viewer/diff-viewer.svelte +0 -400
  505. package/src/components/diff-viewer/diff-viewer.types.ts +0 -56
  506. package/src/components/diff-viewer/front-matter-header.svelte +0 -137
  507. package/src/components/diff-viewer/index.ts +0 -5
  508. package/src/components/markdown-editor/editor-skeleton.svelte +0 -85
  509. package/src/components/markdown-editor/editor-toolbar/editor-toolbar.svelte +0 -318
  510. package/src/components/markdown-editor/editor-toolbar/index.ts +0 -18
  511. package/src/components/markdown-editor/editor-toolbar/link-popover.svelte +0 -314
  512. package/src/components/markdown-editor/editor-toolbar/toolbar-button.svelte +0 -97
  513. package/src/components/markdown-editor/editor-toolbar/toolbar-dropdown.svelte +0 -106
  514. package/src/components/markdown-editor/editor-toolbar/toolbar-separator.svelte +0 -30
  515. package/src/components/markdown-editor/editor-toolbar/types.ts +0 -15
  516. package/src/components/markdown-editor/index.ts +0 -10
  517. package/src/components/markdown-editor/markdown-editor.examples.json +0 -19
  518. package/src/components/markdown-editor/markdown-editor.schema.json +0 -111
  519. package/src/components/markdown-editor/markdown-editor.schema.ts +0 -122
  520. package/src/components/markdown-editor/markdown-editor.svelte +0 -872
  521. package/src/components/markdown-editor/markdown-editor.types.ts +0 -124
  522. package/src/components/markdown-editor/markdown-editor.variables.json +0 -1
  523. package/src/components/markdown-editor/markdown-editor.variables.ts +0 -3
  524. package/src/components/markdown-editor/prosemirror.css +0 -76
  525. package/src/components/review-editor/comment-composer.svelte +0 -271
  526. package/src/components/review-editor/comment-list.svelte +0 -311
  527. package/src/components/review-editor/comment-sidebar.svelte +0 -449
  528. package/src/components/review-editor/export-actions.svelte +0 -188
  529. package/src/components/review-editor/focus-navigation.ts +0 -220
  530. package/src/components/review-editor/front-matter-fields.svelte +0 -159
  531. package/src/components/review-editor/index.ts +0 -59
  532. package/src/components/review-editor/live-region.svelte +0 -109
  533. package/src/components/review-editor/review-editor-anchors.svelte.ts +0 -219
  534. package/src/components/review-editor/review-editor-controls.svelte +0 -201
  535. package/src/components/review-editor/review-editor-exports.ts +0 -145
  536. package/src/components/review-editor/review-editor-front-matter.ts +0 -237
  537. package/src/components/review-editor/review-editor-impl.svelte +0 -1509
  538. package/src/components/review-editor/review-editor-selection-geometry.ts +0 -31
  539. package/src/components/review-editor/review-editor-selection-types.ts +0 -68
  540. package/src/components/review-editor/review-editor-selection.svelte.ts +0 -292
  541. package/src/components/review-editor/review-editor-state.svelte.ts +0 -117
  542. package/src/components/review-editor/review-editor-threads.svelte.ts +0 -435
  543. package/src/components/review-editor/review-editor.css +0 -273
  544. package/src/components/review-editor/review-editor.examples.json +0 -19
  545. package/src/components/review-editor/review-editor.schema.json +0 -83
  546. package/src/components/review-editor/review-editor.schema.ts +0 -88
  547. package/src/components/review-editor/review-editor.svelte +0 -18
  548. package/src/components/review-editor/review-editor.types.ts +0 -92
  549. package/src/components/review-editor/review-editor.variables.json +0 -1
  550. package/src/components/review-editor/review-editor.variables.ts +0 -3
  551. package/src/components/review-editor/thread-popover.svelte +0 -261
  552. /package/dist/components/{review-editor/review-editor.css.d.ts → json-editor/json-editor.css.d.ts} +0 -0
  553. /package/dist/components/{diff-viewer/diff-viewer.schema.d.ts → json-editor/json-editor.schema.d.ts} +0 -0
  554. /package/dist/components/{diff-viewer/diff-viewer.variables.d.ts → json-editor/json-editor.variables.d.ts} +0 -0
  555. /package/src/components/{diff-viewer/diff-viewer.variables.json → json-editor/json-editor.variables.json} +0 -0
  556. /package/src/components/{diff-viewer/diff-viewer.variables.ts → json-editor/json-editor.variables.ts} +0 -0
@@ -1,260 +0,0 @@
1
- /**
2
- * Bridge between ProseMirror positions and text offsets.
3
- *
4
- * This module provides position mapping utilities needed for:
5
- * - DEP-39: Comment anchoring (map selection to persistable positions)
6
- * - DEP-43: Suggested edits (map stored positions back to editor)
7
- *
8
- * The bridge maintains the invariant that positions can round-trip
9
- * between ProseMirror and text offset coordinate systems.
10
- *
11
- * Key insight: ProseMirror positions include structural characters
12
- * (node boundaries), while text offsets (from doc.textBetween()) only
13
- * count text content plus block separators ('\n' between blocks).
14
- */
15
- /**
16
- * WeakMap cache for offset maps, keyed by document instance.
17
- * Automatically garbage collected when document is no longer referenced.
18
- */
19
- const offsetMapCache = new WeakMap();
20
- /**
21
- * Build bidirectional offset map matching doc.textBetween() semantics.
22
- *
23
- * textBetween inserts blockSeparator (default '\n') between block nodes.
24
- * This function mirrors that behavior exactly by walking the document
25
- * and tracking when we transition between blocks.
26
- *
27
- * Key insight: textBetween adds separator BETWEEN consecutive block content,
28
- * not at every block boundary. We track this by noting when we exit one
29
- * block's text content and enter another's.
30
- *
31
- * @param doc - ProseMirror document node
32
- * @returns Cached bidirectional position map
33
- */
34
- export function buildTextToProseMirrorPositionMap(doc) {
35
- const cached = offsetMapCache.get(doc);
36
- if (cached)
37
- return cached;
38
- const textToPm = new Map();
39
- const pmToText = new Map();
40
- let textOffset = 0;
41
- let hasEmittedContent = false;
42
- /**
43
- * Walk document in order, tracking block boundaries.
44
- *
45
- * Key insight: doc.textBetween() adds separators between TEXT BLOCKS
46
- * (paragraph, heading, code_block), not wrapper blocks (list, blockquote,
47
- * list_item). Using isTextblock instead of isBlock ensures we only add
48
- * separators where textBetween would.
49
- */
50
- function walk(node, pos) {
51
- // For text blocks (not wrapper blocks), add separator
52
- // before their content if we've already emitted content
53
- // isTextblock = true for paragraph, heading, code_block
54
- // isTextblock = false for bullet_list, list_item, blockquote
55
- if (node.isTextblock && hasEmittedContent && pos > 0) {
56
- // This is where textBetween would insert '\n'
57
- textToPm.set(textOffset, pos);
58
- pmToText.set(pos, textOffset);
59
- textOffset += 1;
60
- }
61
- if (node.isText && node.text) {
62
- for (let i = 0; i < node.text.length; i++) {
63
- textToPm.set(textOffset + i, pos + i);
64
- pmToText.set(pos + i, textOffset + i);
65
- }
66
- textOffset += node.text.length;
67
- // Map the exclusive end position (for slice semantics)
68
- // This ensures textOffsetToProseMirrorPosition works for end-of-quote offsets
69
- textToPm.set(textOffset, pos + node.text.length);
70
- pmToText.set(pos + node.text.length, textOffset);
71
- hasEmittedContent = true;
72
- }
73
- else if (node.isLeaf && !node.isText) {
74
- // Atom nodes (images, hard breaks, etc.)
75
- // textBetween uses leafText spec or empty string
76
- const leafText = node.type.spec.leafText?.(node) ?? '';
77
- if (leafText.length > 0) {
78
- for (let i = 0; i < leafText.length; i++) {
79
- textToPm.set(textOffset + i, pos);
80
- pmToText.set(pos, textOffset + i);
81
- }
82
- textOffset += leafText.length;
83
- // Map the exclusive end position for leaf nodes too
84
- textToPm.set(textOffset, pos + 1);
85
- pmToText.set(pos + 1, textOffset);
86
- hasEmittedContent = true;
87
- }
88
- }
89
- // Recurse into children
90
- // Each node's content starts 1 position after the node's start
91
- // But for inline content within textblocks, children don't add extra positions
92
- if (node.isTextblock) {
93
- // For textblocks (paragraph, heading, code_block), content starts at pos + 1
94
- const childPos = pos + 1;
95
- node.forEach((child, offset) => {
96
- walk(child, childPos + offset);
97
- });
98
- }
99
- else if (!node.isLeaf) {
100
- // For container blocks (doc, list, blockquote, list_item), content starts at pos + 1
101
- const childPos = pos + 1;
102
- node.forEach((child, offset) => {
103
- walk(child, childPos + offset);
104
- });
105
- }
106
- }
107
- // Start walking from doc's children
108
- // Doc's content starts at position 0 (doc has no opening token in positions)
109
- const docChildPos = 0;
110
- doc.forEach((child, offset) => {
111
- walk(child, docChildPos + offset);
112
- });
113
- const map = { textToPm, pmToText };
114
- offsetMapCache.set(doc, map);
115
- return map;
116
- }
117
- /**
118
- * Convert a text offset (from doc.textBetween()) to a ProseMirror position.
119
- *
120
- * @param doc - ProseMirror document node
121
- * @param offset - Text offset (0-based)
122
- * @returns ProseMirror position or null if offset not found
123
- */
124
- export function textOffsetToProseMirrorPosition(doc, offset) {
125
- const map = buildTextToProseMirrorPositionMap(doc);
126
- return map.textToPm.get(offset) ?? null;
127
- }
128
- /**
129
- * Convert a ProseMirror position to a text offset (as from doc.textBetween()).
130
- *
131
- * @param doc - ProseMirror document node
132
- * @param pos - ProseMirror position
133
- * @returns Text offset or 0 if position not found
134
- */
135
- export function proseMirrorPositionToTextOffset(doc, pos) {
136
- const map = buildTextToProseMirrorPositionMap(doc);
137
- return map.pmToText.get(pos) ?? 0;
138
- }
139
- /**
140
- * Compute line and column from a text offset within the document text.
141
- *
142
- * Unlike mapPosToSource (which maps to markdown source positions), this function
143
- * computes line/column within the document's text content (doc.textBetween semantics).
144
- * This is useful for originalPosition storage where we want coordinates that match
145
- * the text offset coordinate system.
146
- *
147
- * @param doc - ProseMirror document node
148
- * @param textOffset - Text offset (0-based, from doc.textBetween)
149
- * @returns SourcePosition with offset, line, and column
150
- */
151
- export function textOffsetToLineColumn(doc, textOffset) {
152
- // Extract full document text using textBetween semantics
153
- const docText = doc.textBetween(0, doc.content.size, '\n');
154
- // Count lines and columns within the document text
155
- let line = 1;
156
- let column = 1;
157
- const clampedOffset = Math.max(0, Math.min(textOffset, docText.length));
158
- for (let i = 0; i < clampedOffset; i++) {
159
- if (docText[i] === '\n') {
160
- line++;
161
- column = 1;
162
- }
163
- else {
164
- column++;
165
- }
166
- }
167
- return {
168
- offset: clampedOffset,
169
- line,
170
- column,
171
- };
172
- }
173
- // ============================================================================
174
- // Markdown Source Position Mapping (Legacy)
175
- // ============================================================================
176
- /**
177
- * Map a ProseMirror position to an mdast source position.
178
- *
179
- * This enables persisting selection/anchor positions in a format
180
- * that survives editor remounts and document changes.
181
- *
182
- * @param pmPos - ProseMirror document position
183
- * @param markdown - Current markdown content
184
- * @returns Source position or null if mapping fails
185
- *
186
- * @remarks
187
- * This direct mapping is used when the current markdown string is the only
188
- * available source of truth. Use the ProseMirror document helpers above when
189
- * mapping from an instantiated editor document.
190
- */
191
- export function mapPosToSource(pmPos, markdown) {
192
- if (pmPos < 0 || pmPos > markdown.length) {
193
- return null;
194
- }
195
- // Count lines and columns from the markdown string
196
- let line = 1;
197
- let column = 1;
198
- for (let i = 0; i < pmPos && i < markdown.length; i++) {
199
- if (markdown[i] === '\n') {
200
- line++;
201
- column = 1;
202
- }
203
- else {
204
- column++;
205
- }
206
- }
207
- return {
208
- line,
209
- column,
210
- offset: pmPos,
211
- };
212
- }
213
- /**
214
- * Map an mdast source position to a ProseMirror position.
215
- *
216
- * This enables jumping to stored positions (comments, suggestions)
217
- * when the editor loads.
218
- *
219
- * @param sourcePos - mdast source position
220
- * @param markdown - Current markdown content
221
- * @returns ProseMirror position or null if mapping fails
222
- *
223
- * @remarks
224
- * This direct mapping is used when a stored markdown offset is available. Use
225
- * the ProseMirror document helpers above when translating through an
226
- * instantiated editor document.
227
- */
228
- export function mapSourceToPos(sourcePos, markdown) {
229
- if (sourcePos.offset !== undefined && sourcePos.offset >= 0) {
230
- return Math.min(sourcePos.offset, markdown.length);
231
- }
232
- // Fall back to line/column calculation
233
- let offset = 0;
234
- let currentLine = 1;
235
- for (let i = 0; i < markdown.length; i++) {
236
- if (currentLine === sourcePos.line) {
237
- // Found the line, add column offset
238
- return Math.min(offset + sourcePos.column - 1, markdown.length);
239
- }
240
- if (markdown[i] === '\n') {
241
- currentLine++;
242
- }
243
- offset++;
244
- }
245
- // Line not found
246
- return null;
247
- }
248
- /**
249
- * Enrich an editor selection with source position information.
250
- *
251
- * @param selection - Editor selection state
252
- * @param markdown - Current markdown content
253
- * @returns Selection with sourcePosition field populated
254
- */
255
- export function enrichSelectionWithSource(selection, markdown) {
256
- return {
257
- ...selection,
258
- sourcePosition: mapPosToSource(selection.from, markdown),
259
- };
260
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Custom clipboard behavior for Milkdown (DEP-45).
3
- *
4
- * Paste rules:
5
- * - **Code (VSCode)**: Detect `vscode-editor-data` and insert a fenced code block (with language if available).
6
- * - **Markdown**: If clipboard provides `text/markdown` or `text/x-markdown`, parse and insert structured content.
7
- * - **HTML**: Sanitize (DEP-47) then parse and insert.
8
- * - **Plain text**: Let the default ProseMirror behavior insert as-is.
9
- *
10
- * Copy behavior:
11
- * - Serialize selection to Markdown via Milkdown serializer
12
- * - Normalize via DEP-35 `normalize()` before writing to the clipboard
13
- *
14
- * @module
15
- */
16
- /**
17
- * Milkdown plugin wrapper for the ProseMirror clipboard plugin.
18
- */
19
- export declare const clipboardPlugin: import("./milkdown-plugin-runtime.js").LazyProsePlugin;
@@ -1,189 +0,0 @@
1
- /**
2
- * Custom clipboard behavior for Milkdown (DEP-45).
3
- *
4
- * Paste rules:
5
- * - **Code (VSCode)**: Detect `vscode-editor-data` and insert a fenced code block (with language if available).
6
- * - **Markdown**: If clipboard provides `text/markdown` or `text/x-markdown`, parse and insert structured content.
7
- * - **HTML**: Sanitize (DEP-47) then parse and insert.
8
- * - **Plain text**: Let the default ProseMirror behavior insert as-is.
9
- *
10
- * Copy behavior:
11
- * - Serialize selection to Markdown via Milkdown serializer
12
- * - Normalize via DEP-35 `normalize()` before writing to the clipboard
13
- *
14
- * @module
15
- */
16
- import { normalize } from '../markdown/pipeline/index.js';
17
- import { DOMParser, DOMSerializer, } from 'prosemirror-model';
18
- import { Plugin, PluginKey, TextSelection } from 'prosemirror-state';
19
- import { createLazyProsePlugin } from './milkdown-plugin-runtime.js';
20
- import { sanitizeHtml } from './sanitize-html.js';
21
- function isVscodeClipboardPayload(value) {
22
- return value !== null && typeof value === 'object';
23
- }
24
- function normalizeMarkdownSafely(markdown) {
25
- try {
26
- return normalize(markdown);
27
- }
28
- catch (error) {
29
- console.warn('Failed to normalize clipboard markdown:', error);
30
- return markdown;
31
- }
32
- }
33
- function getMarkdownFromClipboard(dataTransfer) {
34
- // Prefer the markdown-specific clipboard types.
35
- const markdown = dataTransfer.getData('text/markdown') || dataTransfer.getData('text/x-markdown') || '';
36
- return markdown;
37
- }
38
- function getLanguageHintFromVscodeClipboard(dataTransfer) {
39
- const vscodeData = dataTransfer.getData('vscode-editor-data');
40
- if (!vscodeData)
41
- return undefined;
42
- try {
43
- const parsed = JSON.parse(vscodeData);
44
- return isVscodeClipboardPayload(parsed) && typeof parsed.mode === 'string'
45
- ? parsed.mode
46
- : undefined;
47
- }
48
- catch {
49
- return undefined;
50
- }
51
- }
52
- function getNodeFromSchema(type, schema) {
53
- const nodeType = schema.nodes[type];
54
- if (!nodeType) {
55
- throw new Error(`Missing ProseMirror node type: ${type}`);
56
- }
57
- return nodeType;
58
- }
59
- function isTextOnlySlice(slice) {
60
- if (slice.content.childCount !== 1)
61
- return false;
62
- const node = slice.content.firstChild;
63
- if (node?.type.name === 'text' && node.marks.length === 0)
64
- return node;
65
- if (node?.type.name === 'paragraph' && node.childCount === 1) {
66
- const firstChild = node.firstChild;
67
- if (firstChild?.type.name === 'text' && firstChild.marks.length === 0)
68
- return firstChild;
69
- }
70
- return false;
71
- }
72
- /**
73
- * Milkdown plugin wrapper for the ProseMirror clipboard plugin.
74
- */
75
- export const clipboardPlugin = createLazyProsePlugin(async (ctx) => {
76
- const { editorViewOptionsCtx, parserCtx, schemaCtx, serializerCtx } = await import('@milkdown/kit/core');
77
- const schema = ctx.get(schemaCtx);
78
- // Ensure editable prop exists (Milkdown issue workaround).
79
- ctx.update(editorViewOptionsCtx, (previous) => ({
80
- ...previous,
81
- editable: previous.editable ?? (() => true),
82
- }));
83
- const key = new PluginKey('DEP_45_CLIPBOARD');
84
- return new Plugin({
85
- key,
86
- props: {
87
- handlePaste: (view, event) => {
88
- const editable = view.props.editable?.(view.state);
89
- const { clipboardData } = event;
90
- if (!editable || !clipboardData)
91
- return false;
92
- const currentNode = view.state.selection.$from.node();
93
- if (currentNode.type.spec.code)
94
- return false;
95
- const plainText = clipboardData.getData('text/plain');
96
- // 1) VSCode paste → code block
97
- const vscodeEditorData = clipboardData.getData('vscode-editor-data');
98
- if (vscodeEditorData && plainText) {
99
- const language = getLanguageHintFromVscodeClipboard(clipboardData);
100
- const codeBlockType = getNodeFromSchema('code_block', schema);
101
- const transaction = view.state.tr;
102
- // Create a code block node, with a language hint if available.
103
- transaction.replaceSelectionWith(codeBlockType.create({ language }));
104
- transaction
105
- .setSelection(TextSelection.near(transaction.doc.resolve(Math.max(0, transaction.selection.from - 2))))
106
- .insertText(plainText.replace(/\r\n?/g, '\n'));
107
- view.dispatch(transaction);
108
- return true;
109
- }
110
- // 2) Markdown clipboard type → parse and insert
111
- const markdown = getMarkdownFromClipboard(clipboardData);
112
- if (markdown) {
113
- const parser = ctx.get(parserCtx);
114
- const parsed = parser(markdown);
115
- if (!parsed || typeof parsed === 'string') {
116
- // If parsing fails, fall back to inserting as plain text.
117
- view.dispatch(view.state.tr.insertText(markdown.replace(/\r\n?/g, '\n')));
118
- return true;
119
- }
120
- const dom = DOMSerializer.fromSchema(schema).serializeFragment(parsed.content);
121
- const slice = DOMParser.fromSchema(schema).parseSlice(dom);
122
- const textOnlyNode = isTextOnlySlice(slice);
123
- if (textOnlyNode) {
124
- view.dispatch(view.state.tr.replaceSelectionWith(textOnlyNode, true));
125
- return true;
126
- }
127
- try {
128
- view.dispatch(view.state.tr.replaceSelection(slice));
129
- return true;
130
- }
131
- catch {
132
- return false;
133
- }
134
- }
135
- // 3) HTML → sanitize then parse and insert
136
- const html = clipboardData.getData('text/html');
137
- if (html) {
138
- const sanitizedHtml = sanitizeHtml(html);
139
- const template = document.createElement('template');
140
- template.innerHTML = sanitizedHtml;
141
- const dom = template.content.cloneNode(true);
142
- template.remove();
143
- const slice = DOMParser.fromSchema(schema).parseSlice(dom);
144
- const textOnlyNode = isTextOnlySlice(slice);
145
- if (textOnlyNode) {
146
- view.dispatch(view.state.tr.replaceSelectionWith(textOnlyNode, true));
147
- return true;
148
- }
149
- try {
150
- view.dispatch(view.state.tr.replaceSelection(slice));
151
- return true;
152
- }
153
- catch {
154
- // If HTML parsing fails, fall back to plain text (safe).
155
- if (plainText) {
156
- view.dispatch(view.state.tr.insertText(plainText.replace(/\r\n?/g, '\n')));
157
- return true;
158
- }
159
- return false;
160
- }
161
- }
162
- // 4) Plain text → default ProseMirror behavior (insert as-is)
163
- return false;
164
- },
165
- clipboardTextSerializer: (slice) => {
166
- const serializer = ctx.get(serializerCtx);
167
- // Try to serialize as a valid doc node first.
168
- let doc = schema.topNodeType.createAndFill(undefined, slice.content);
169
- // If the slice is inline-only (common for partial selections), wrap it in a paragraph.
170
- if (!doc) {
171
- const paragraphType = schema.nodes['paragraph'];
172
- if (paragraphType) {
173
- const paragraph = paragraphType.createAndFill(undefined, slice.content);
174
- if (paragraph) {
175
- doc = schema.topNodeType.createAndFill(undefined, paragraph);
176
- }
177
- }
178
- }
179
- // Fallback to plain text if we can't build a valid document.
180
- if (!doc) {
181
- const plain = slice.content.textBetween(0, slice.content.size, '\n\n');
182
- return normalizeMarkdownSafely(plain);
183
- }
184
- const markdown = serializer(doc);
185
- return normalizeMarkdownSafely(markdown);
186
- },
187
- },
188
- });
189
- });
@@ -1,167 +0,0 @@
1
- /**
2
- * Command registry for the Milkdown editor.
3
- *
4
- * This module provides functions to execute editor commands and query editor state.
5
- * Used by the toolbar and keyboard shortcuts.
6
- *
7
- * IMPORTANT: Uses Milkdown's command system (callCommand) to ensure
8
- * commands respect Milkdown contexts and work correctly.
9
- */
10
- import type { CmdKey } from '@milkdown/kit/core';
11
- import type { Ctx } from '@milkdown/kit/ctx';
12
- import type { MarkType } from '@milkdown/kit/prose/model';
13
- import type { EditorView } from '@milkdown/kit/prose/view';
14
- /** Load Milkdown command modules before synchronous command handlers run. */
15
- export declare function preloadCommandRuntime(): Promise<void>;
16
- /**
17
- * Active marks at the current selection.
18
- */
19
- export interface ActiveMarks {
20
- bold: boolean;
21
- italic: boolean;
22
- code: boolean;
23
- strikethrough: boolean;
24
- link: boolean;
25
- }
26
- /**
27
- * Current block type at the selection.
28
- *
29
- * Uses a discriminated union to ensure type safety - you can't have
30
- * a paragraph with a headingLevel or a blockquote with a listType.
31
- */
32
- export type ActiveBlockType = {
33
- type: 'paragraph';
34
- } | {
35
- type: 'heading';
36
- headingLevel: 1 | 2 | 3 | 4 | 5 | 6;
37
- } | {
38
- type: 'blockquote';
39
- } | {
40
- type: 'codeBlock';
41
- } | {
42
- type: 'listItem';
43
- listType?: 'bullet' | 'ordered' | 'task';
44
- } | {
45
- type: 'unknown';
46
- };
47
- /**
48
- * Run a Milkdown command and refocus the editor.
49
- */
50
- export declare function runCommand<T>(ctx: Ctx, commandKey: CmdKey<T> | string, payload?: T): boolean;
51
- /**
52
- * Toggle bold (strong) mark on the current selection.
53
- */
54
- export declare function toggleBold(ctx: Ctx): boolean;
55
- /**
56
- * Toggle italic (emphasis) mark on the current selection.
57
- */
58
- export declare function toggleItalic(ctx: Ctx): boolean;
59
- /**
60
- * Toggle inline code mark on the current selection.
61
- */
62
- export declare function toggleCode(ctx: Ctx): boolean;
63
- /**
64
- * Toggle strikethrough mark on the current selection.
65
- */
66
- export declare function toggleStrikethrough(ctx: Ctx): boolean;
67
- /**
68
- * Set the current block to a heading at the specified level.
69
- */
70
- export declare function setHeading(ctx: Ctx, level: 1 | 2 | 3 | 4 | 5 | 6): boolean;
71
- /**
72
- * Convert the current block to a paragraph (remove heading/list/etc).
73
- */
74
- export declare function setParagraph(ctx: Ctx): boolean;
75
- /**
76
- * Toggle bullet list on the current block.
77
- */
78
- export declare function toggleBulletList(ctx: Ctx): boolean;
79
- /**
80
- * Toggle ordered list on the current block.
81
- */
82
- export declare function toggleOrderedList(ctx: Ctx): boolean;
83
- /**
84
- * Toggle blockquote on the current block.
85
- */
86
- export declare function toggleBlockquote(ctx: Ctx): boolean;
87
- /**
88
- * Indent a list item (sink).
89
- */
90
- export declare function indentListItem(ctx: Ctx): boolean;
91
- /**
92
- * Outdent a list item (lift).
93
- */
94
- export declare function outdentListItem(ctx: Ctx): boolean;
95
- /**
96
- * Insert a horizontal rule.
97
- */
98
- export declare function insertHorizontalRule(ctx: Ctx): boolean;
99
- /**
100
- * Undo the last action.
101
- */
102
- export declare function undo(ctx: Ctx): boolean;
103
- /**
104
- * Redo the last undone action.
105
- */
106
- export declare function redo(ctx: Ctx): boolean;
107
- /**
108
- * Insert a link at the current cursor position (when no selection).
109
- * This inserts text and applies the link mark in a single transaction.
110
- */
111
- export declare function insertLinkAtCursor(ctx: Ctx, text: string, url: string): boolean;
112
- /**
113
- * Apply a link mark to the current selection.
114
- */
115
- export declare function applyLinkToSelection(ctx: Ctx, url: string): boolean;
116
- /**
117
- * Update an existing link at the cursor position.
118
- * Replaces the text and URL of the link the cursor is inside.
119
- * Used when editing a link (cursor inside link, no selection).
120
- */
121
- export declare function updateLinkAtCursor(ctx: Ctx, text: string, url: string): boolean;
122
- /**
123
- * Remove link mark from the current selection or a specified range.
124
- *
125
- * @param ctx - Milkdown editor context
126
- * @param range - Optional pre-computed range [from, to] to remove link from.
127
- * If not provided, uses current selection (or finds link at cursor).
128
- * Pass this when the editor may have lost focus (e.g., popover interactions).
129
- */
130
- export declare function removeLink(ctx: Ctx, range?: [number, number]): boolean;
131
- /**
132
- * Get the link URL at the current cursor position, if any.
133
- */
134
- export declare function getLinkAtCursor(ctx: Ctx): string | null;
135
- /**
136
- * Get the link text at the current cursor position, if cursor is inside a link.
137
- * Returns the full link text even when selection is collapsed.
138
- */
139
- export declare function getLinkTextAtCursor(ctx: Ctx): string | null;
140
- /**
141
- * Get the link range at the current cursor position.
142
- * Returns [from, to] if cursor is inside a link, null otherwise.
143
- *
144
- * Use this to capture the link range before focus leaves the editor
145
- * (e.g., when opening a popover), then pass the range to removeLink.
146
- */
147
- export declare function getLinkRangeAtCursor(ctx: Ctx): [number, number] | null;
148
- /**
149
- * Check if a mark type is active at the current selection.
150
- */
151
- export declare function isMarkActive(view: EditorView, markType: MarkType): boolean;
152
- /**
153
- * Get all active marks at the current selection.
154
- */
155
- export declare function getActiveMarks(ctx: Ctx): ActiveMarks;
156
- /**
157
- * Get the active block type at the current selection.
158
- */
159
- export declare function getActiveBlockType(ctx: Ctx): ActiveBlockType;
160
- /**
161
- * Check if the current selection is collapsed (cursor only, no selection).
162
- */
163
- export declare function isSelectionCollapsed(ctx: Ctx): boolean;
164
- /**
165
- * Get the selected text, if any.
166
- */
167
- export declare function getSelectedText(ctx: Ctx): string;