@lostgradient/cinder 0.16.1 → 0.19.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 (588) hide show
  1. package/CHANGELOG.md +203 -0
  2. package/README.md +33 -11
  3. package/components.json +54 -102
  4. package/dist/_internal/chart/chart-utilities.d.ts +1 -0
  5. package/dist/cli/index.js +64 -11
  6. package/dist/cli/mcp-dependencies.d.ts +4 -0
  7. package/dist/cli/types.d.ts +1 -0
  8. package/dist/components/approval-card/approval-card.css +1 -6
  9. package/dist/components/approval-card/index.js +171 -64
  10. package/dist/components/area-chart/index.js +40 -6
  11. package/dist/components/bar-chart/index.js +132 -83
  12. package/dist/components/code-block/index.js +133 -17
  13. package/dist/components/combobox/combobox.schema.js +14 -1
  14. package/dist/components/combobox/combobox.svelte.d.ts +12 -12
  15. package/dist/components/combobox/combobox.types.d.ts +11 -5
  16. package/dist/components/combobox/index.js +94 -16
  17. package/dist/components/command-menu/command-menu.css +9 -0
  18. package/dist/components/command-menu/index.js +7 -2
  19. package/dist/components/diff-statistics/diff-statistics.svelte.d.ts +3 -3
  20. package/dist/components/event-stream-viewer/index.js +3 -2
  21. package/dist/components/file-upload/file-upload.schema.js +5 -1
  22. package/dist/components/file-upload/file-upload.types.d.ts +2 -0
  23. package/dist/components/file-upload/index.js +37 -27
  24. package/dist/components/invocation-rule-builder/index.d.ts +1 -1
  25. package/dist/components/invocation-rule-builder/index.js +3656 -389
  26. package/dist/components/invocation-rule-builder/invocation-rule-builder.css +22 -0
  27. package/dist/components/invocation-rule-builder/invocation-rule-builder.schema.d.ts +2 -2
  28. package/dist/components/invocation-rule-builder/invocation-rule-builder.schema.js +309 -193
  29. package/dist/components/invocation-rule-builder/invocation-rule-builder.svelte.d.ts +3 -2
  30. package/dist/components/invocation-rule-builder/invocation-rule-builder.types.d.ts +98 -31
  31. package/dist/components/json-editor/index.d.ts +5 -0
  32. package/dist/components/json-editor/index.js +329 -0
  33. package/dist/components/json-editor/json-editor-enhancement.d.ts +7 -0
  34. package/dist/components/json-editor/json-editor-enhancement.js +201 -0
  35. package/dist/components/json-editor/json-editor.css +117 -0
  36. package/dist/components/{diff-viewer/diff-viewer.schema.js → json-editor/json-editor.schema.js} +40 -48
  37. package/dist/components/json-editor/json-editor.svelte.d.ts +21 -0
  38. package/dist/components/json-editor/json-editor.types.d.ts +27 -0
  39. package/dist/components/{diff-viewer/diff-viewer.variables.js → json-editor/json-editor.variables.js} +4 -4
  40. package/dist/components/json-schema-editor/index.js +2041 -4165
  41. package/dist/components/json-schema-editor/json-schema-editor-state.svelte.d.ts +17 -1
  42. package/dist/components/json-schema-editor/json-schema-editor-types.d.ts +8 -1
  43. package/dist/components/json-schema-editor/json-schema-editor.css +35 -0
  44. package/dist/components/json-schema-editor/json-schema-editor.svelte.d.ts +0 -1
  45. package/dist/components/json-schema-editor/json-schema-validator.d.ts +9 -4
  46. package/dist/components/line-chart/index.js +40 -6
  47. package/dist/components/matrix-chart/index.js +40 -6
  48. package/dist/components/payload-inspector/index.js +10 -2
  49. package/dist/components/payload-inspector/payload-inspector.schema.js +11 -1
  50. package/dist/components/payload-inspector/payload-inspector.types.d.ts +20 -0
  51. package/dist/components/run-step-timeline/index.js +160 -111
  52. package/dist/components/run-step-timeline/run-step-timeline.css +46 -0
  53. package/dist/components/run-step-timeline/run-step-timeline.schema.js +26 -1
  54. package/dist/components/run-step-timeline/run-step-timeline.types.d.ts +22 -2
  55. package/dist/components/schedule-builder/index.js +165 -93
  56. package/dist/components/schedule-builder/schedule-builder.schema.js +8 -1
  57. package/dist/components/schedule-builder/schedule-builder.svelte.d.ts +1 -1
  58. package/dist/components/schedule-builder/schedule-builder.types.d.ts +12 -0
  59. package/dist/components/schema-form/index.d.ts +1 -1
  60. package/dist/components/schema-form/index.js +107 -25
  61. package/dist/components/schema-form/schema-form.schema.js +9 -1
  62. package/dist/components/schema-form/schema-form.svelte.d.ts +1 -1
  63. package/dist/components/schema-form/schema-form.types.d.ts +8 -0
  64. package/dist/components/sidebar/index.js +93 -42
  65. package/dist/components/sidebar/sidebar.css +7 -16
  66. package/dist/components/sidebar/sidebar.schema.js +8 -9
  67. package/dist/components/sidebar/sidebar.types.d.ts +14 -12
  68. package/dist/components/source-diff-viewer/source-diff-viewer.svelte.d.ts +2 -2
  69. package/dist/components/spectrogram/index.js +40 -6
  70. package/dist/components/spectrum-chart/index.js +40 -6
  71. package/dist/components/status-dot/index.js +3 -2
  72. package/dist/components/tabs/tabs.css +2 -0
  73. package/dist/components/textarea/textarea.svelte.d.ts +1 -1
  74. package/dist/components/toast-region/index.js +2 -2
  75. package/dist/components/toast-region/toast-region.css +1 -1
  76. package/dist/components/waveform/index.js +40 -6
  77. package/dist/highlighters/shiki/default.d.ts +5 -0
  78. package/dist/highlighters/shiki/default.js +278 -0
  79. package/dist/highlighters/shiki/index.d.ts +54 -5
  80. package/dist/highlighters/shiki/index.js +102 -16
  81. package/dist/index.d.ts +4 -4
  82. package/dist/index.js +15642 -16181
  83. package/dist/server/components/access-gate/index.js +2 -5
  84. package/dist/server/components/approval-card/index.js +3 -3
  85. package/dist/server/components/area-chart/index.js +3 -3
  86. package/dist/server/components/bar-chart/index.js +3 -3
  87. package/dist/server/components/combobox/index.js +5 -3
  88. package/dist/server/components/command-menu/index.js +1 -1
  89. package/dist/server/components/context-menu/index.js +5 -5
  90. package/dist/server/components/data-table/index.js +2 -2
  91. package/dist/server/components/diff-statistics/index.js +3 -5
  92. package/dist/server/components/dropdown/index.js +6 -7
  93. package/dist/server/components/event-stream-viewer/index.js +2 -2
  94. package/dist/server/components/file-upload/index.js +2 -3
  95. package/dist/server/components/icons/index.js +17 -26
  96. package/dist/server/components/inline-loading/index.js +1 -1
  97. package/dist/server/components/invocation-rule-builder/index.js +15 -2
  98. package/dist/server/components/json-editor/index.js +13 -0
  99. package/dist/server/components/json-editor/json-editor-enhancement.js +150 -0
  100. package/dist/server/components/json-schema-editor/index.js +4 -16
  101. package/dist/server/components/line-chart/index.js +3 -3
  102. package/dist/server/components/matrix-chart/index.js +2 -2
  103. package/dist/server/components/menu-bar/index.js +4 -4
  104. package/dist/server/components/payload-inspector/index.js +2 -2
  105. package/dist/server/components/run-step-timeline/index.js +2 -2
  106. package/dist/server/components/schedule-builder/index.js +3 -3
  107. package/dist/server/components/schema-form/index.js +1 -1
  108. package/dist/server/components/selection-popover/index.js +3 -5
  109. package/dist/server/components/sidebar/index.js +1 -1
  110. package/dist/server/components/spectrogram/index.js +2 -2
  111. package/dist/server/components/spectrum-chart/index.js +2 -2
  112. package/dist/server/components/status-dot/index.js +2 -2
  113. package/dist/server/components/surface/index.js +3 -5
  114. package/dist/server/components/table/index.js +2 -2
  115. package/dist/server/components/tabs/index.js +5 -5
  116. package/dist/server/components/toast-region/index.js +1 -1
  117. package/dist/server/components/toolbar/index.js +2 -3
  118. package/dist/server/components/waveform/index.js +2 -2
  119. package/dist/server/highlighters/shiki/default.js +39 -0
  120. package/dist/server/highlighters/shiki/index.js +9 -97
  121. package/dist/server/index.js +110 -119
  122. package/dist/server/{index.server-7yfz2t73.js → index.server-003t81xk.js} +1 -1
  123. package/dist/server/{index.server-gwgm8gqg.js → index.server-032p855q.js} +4 -4
  124. package/dist/server/{index.server-npxtkwjp.js → index.server-0gg1njz4.js} +3 -2
  125. package/dist/server/{index.server-c5qv3p61.js → index.server-0hjcds3y.js} +93 -47
  126. package/dist/server/{index.server-tf2n3ccm.js → index.server-1vfhzhkj.js} +1 -1
  127. package/dist/server/{index.server-bf7d81b4.js → index.server-20km2ga0.js} +17 -19
  128. package/dist/server/{index.server-jz5yxwde.js → index.server-4cbqjf14.js} +16 -7
  129. package/dist/server/{index.server-g5jgq3jp.js → index.server-62593nnh.js} +41 -7
  130. package/dist/server/{index.server-aqethy0w.js → index.server-66nm5gd5.js} +102 -26
  131. package/dist/server/{index.server-m0ezemav.js → index.server-6mnbznbt.js} +4 -2
  132. package/dist/server/{index.server-1nq8h5yb.js → index.server-6vbpz6dd.js} +40 -6
  133. package/dist/server/{index.server-796hb0r8.js → index.server-7qak74fg.js} +1 -1
  134. package/dist/server/{index.server-5exh7rmw.js → index.server-7ygdwxre.js} +57 -5
  135. package/dist/server/{index.server-q1d48s9t.js → index.server-8c6cck0y.js} +6 -4
  136. package/dist/server/{index.server-m8ya4p7w.js → index.server-8grn4zd3.js} +74 -14
  137. package/dist/server/{index.server-ep81fn23.js → index.server-9eccb2fc.js} +2 -2
  138. package/dist/server/{index.server-zncgb7mw.js → index.server-9nac5z11.js} +92 -49
  139. package/dist/server/index.server-c9gtmre4.js +178 -0
  140. package/dist/server/{index.server-nt304e00.js → index.server-dx58qant.js} +1 -1
  141. package/dist/server/{index.server-zh3r8vfd.js → index.server-fhrqsg97.js} +1 -1
  142. package/dist/server/{index.server-dq0k0qf6.js → index.server-geq56xaz.js} +10 -10
  143. package/dist/server/{index.server-51sxnete.js → index.server-hxveaqg1.js} +10 -10
  144. package/dist/server/{index.server-tez36va4.js → index.server-kvn6cj65.js} +1 -1
  145. package/dist/server/{index.server-s5g7reqp.js → index.server-mewms9dg.js} +2 -2
  146. package/dist/server/index.server-mm728d0w.js +20 -0
  147. package/dist/server/{index.server-5mc2vsy0.js → index.server-n0rbn5yf.js} +4 -2
  148. package/dist/server/{index.server-qv0kkre4.js → index.server-ng8y854r.js} +188 -107
  149. package/dist/server/{index.server-wasj5rbh.js → index.server-q5gvb174.js} +4 -4
  150. package/dist/server/{index.server-x1dha7bk.js → index.server-rnddtcb3.js} +4 -2
  151. package/dist/server/{index.server-7zpzspk6.js → index.server-s4wm4g2a.js} +30 -2
  152. package/dist/server/index.server-szgghcdh.js +887 -0
  153. package/dist/server/index.server-v73af5rk.js +111 -0
  154. package/dist/server/{index.server-thcda9ny.js → index.server-vd302sxz.js} +11 -4
  155. package/dist/server/{index.server-3sq9d73w.js → index.server-vz9hqkdq.js} +2 -2
  156. package/dist/server/{index.server-mvjzcna5.js → index.server-wg6ddzpa.js} +42 -20
  157. package/dist/server/{index.server-qke3ekjt.js → index.server-ww54rv4y.js} +1 -1
  158. package/dist/server/index.server-x4a15jpm.js +9 -0
  159. package/dist/server/{index.server-67q8dmbp.js → index.server-y2ncgt7p.js} +1 -1
  160. package/dist/server/{index.server-4x91gzy1.js → index.server-yqhww50r.js} +4 -4
  161. package/dist/server/{index.server-7798gc22.js → index.server-zfx4magq.js} +4 -2
  162. package/dist/utilities/json-highlight.d.ts +2 -0
  163. package/package.json +63 -288
  164. package/src/_internal/chart/chart-utilities.ts +74 -5
  165. package/src/components/approval-card/approval-card-actions.svelte +12 -28
  166. package/src/components/approval-card/approval-card.css +1 -6
  167. package/src/components/bar-chart/bar-chart.examples.json +1 -1
  168. package/src/components/bar-chart/bar-chart.svelte +3 -1
  169. package/src/components/code-block/code-block-default-highlighter.ts +2 -2
  170. package/src/components/combobox/combobox.schema.json +13 -0
  171. package/src/components/combobox/combobox.schema.ts +13 -0
  172. package/src/components/combobox/combobox.svelte +100 -14
  173. package/src/components/combobox/combobox.types.ts +11 -5
  174. package/src/components/command-menu/command-menu.css +9 -0
  175. package/src/components/command-menu/command-menu.svelte +9 -2
  176. package/src/components/file-upload/file-upload.schema.json +4 -0
  177. package/src/components/file-upload/file-upload.schema.ts +4 -0
  178. package/src/components/file-upload/file-upload.svelte +3 -3
  179. package/src/components/file-upload/file-upload.types.ts +2 -0
  180. package/src/components/invocation-rule-builder/index.ts +1 -0
  181. package/src/components/invocation-rule-builder/invocation-rule-builder.css +22 -0
  182. package/src/components/invocation-rule-builder/invocation-rule-builder.examples.json +6 -0
  183. package/src/components/invocation-rule-builder/invocation-rule-builder.schema.json +70 -7
  184. package/src/components/invocation-rule-builder/invocation-rule-builder.schema.ts +5 -250
  185. package/src/components/invocation-rule-builder/invocation-rule-builder.svelte +136 -99
  186. package/src/components/invocation-rule-builder/invocation-rule-builder.types.ts +145 -62
  187. package/src/components/json-editor/index.ts +6 -0
  188. package/src/components/json-editor/json-editor-enhancement.ts +48 -0
  189. package/src/components/json-editor/json-editor.css +117 -0
  190. package/src/components/json-editor/json-editor.examples.json +13 -0
  191. package/src/components/json-editor/json-editor.schema.json +61 -0
  192. package/src/components/json-editor/json-editor.schema.ts +67 -0
  193. package/src/components/json-editor/json-editor.svelte +164 -0
  194. package/src/components/json-editor/json-editor.types.ts +31 -0
  195. package/src/components/json-schema-editor/diff-view.svelte +26 -8
  196. package/src/components/json-schema-editor/form-view.svelte +1 -1
  197. package/src/components/json-schema-editor/json-schema-editor-state.svelte.ts +163 -56
  198. package/src/components/json-schema-editor/json-schema-editor-types.ts +8 -1
  199. package/src/components/json-schema-editor/json-schema-editor.css +35 -0
  200. package/src/components/json-schema-editor/json-schema-validator.ts +59 -25
  201. package/src/components/json-schema-editor/json-view.svelte +52 -18
  202. package/src/components/payload-inspector/payload-inspector.schema.json +8 -0
  203. package/src/components/payload-inspector/payload-inspector.schema.ts +10 -0
  204. package/src/components/payload-inspector/payload-inspector.svelte +2 -2
  205. package/src/components/payload-inspector/payload-inspector.types.ts +20 -0
  206. package/src/components/run-step-timeline/run-step-timeline.css +46 -0
  207. package/src/components/run-step-timeline/run-step-timeline.examples.json +3 -3
  208. package/src/components/run-step-timeline/run-step-timeline.schema.json +24 -0
  209. package/src/components/run-step-timeline/run-step-timeline.schema.ts +26 -0
  210. package/src/components/run-step-timeline/run-step-timeline.svelte +41 -4
  211. package/src/components/run-step-timeline/run-step-timeline.types.ts +22 -1
  212. package/src/components/run-step-timeline/run-step-timeline.utilities.ts +9 -1
  213. package/src/components/schedule-builder/schedule-builder.schema.json +7 -0
  214. package/src/components/schedule-builder/schedule-builder.schema.ts +8 -0
  215. package/src/components/schedule-builder/schedule-builder.svelte +94 -22
  216. package/src/components/schedule-builder/schedule-builder.types.ts +12 -0
  217. package/src/components/schema-form/index.ts +1 -0
  218. package/src/components/schema-form/schema-form-body.svelte +94 -17
  219. package/src/components/schema-form/schema-form.examples.json +1 -1
  220. package/src/components/schema-form/schema-form.schema.json +5 -0
  221. package/src/components/schema-form/schema-form.schema.ts +6 -0
  222. package/src/components/schema-form/schema-form.svelte +4 -0
  223. package/src/components/schema-form/schema-form.types.ts +9 -0
  224. package/src/components/side-navigation/side-navigation.examples.json +1 -1
  225. package/src/components/sidebar/sidebar.css +7 -16
  226. package/src/components/sidebar/sidebar.examples.json +3 -3
  227. package/src/components/sidebar/sidebar.schema.json +7 -8
  228. package/src/components/sidebar/sidebar.schema.ts +8 -8
  229. package/src/components/sidebar/sidebar.svelte +65 -27
  230. package/src/components/sidebar/sidebar.types.ts +14 -12
  231. package/src/components/status-dot/status-dot.svelte +6 -1
  232. package/src/components/tabs/tabs.css +2 -0
  233. package/src/components/toast-region/toast-region.css +1 -1
  234. package/src/components/toast-region/toast-region.examples.json +1 -1
  235. package/src/components/toast-region/toast-region.svelte +2 -2
  236. package/src/highlighters/shiki/default.ts +46 -0
  237. package/src/highlighters/shiki/index.ts +232 -23
  238. package/src/index.ts +5 -7
  239. package/src/styles/components.css +1 -1
  240. package/src/utilities/change-tracker.svelte.ts +1 -1
  241. package/src/utilities/json-highlight.ts +5 -0
  242. package/dist/commentary/anchor-decorations.d.ts +0 -86
  243. package/dist/commentary/anchor-decorations.js +0 -490
  244. package/dist/commentary/anchoring.d.ts +0 -93
  245. package/dist/commentary/anchoring.js +0 -157
  246. package/dist/commentary/comments/index.d.ts +0 -12
  247. package/dist/commentary/comments/index.js +0 -14
  248. package/dist/commentary/comments/mentions.d.ts +0 -43
  249. package/dist/commentary/comments/mentions.js +0 -65
  250. package/dist/commentary/comments/reanchor.d.ts +0 -86
  251. package/dist/commentary/comments/reanchor.js +0 -220
  252. package/dist/commentary/comments/types.d.ts +0 -260
  253. package/dist/commentary/comments/types.js +0 -83
  254. package/dist/commentary/comments/updates.d.ts +0 -102
  255. package/dist/commentary/comments/updates.js +0 -226
  256. package/dist/commentary/export/comments-export.d.ts +0 -42
  257. package/dist/commentary/export/comments-export.js +0 -258
  258. package/dist/commentary/export/index.d.ts +0 -12
  259. package/dist/commentary/export/index.js +0 -12
  260. package/dist/commentary/export/markdown-summary.d.ts +0 -31
  261. package/dist/commentary/export/markdown-summary.js +0 -218
  262. package/dist/commentary/export/types.d.ts +0 -162
  263. package/dist/commentary/export/types.js +0 -7
  264. package/dist/commentary/export/unified-diff.d.ts +0 -28
  265. package/dist/commentary/export/unified-diff.js +0 -250
  266. package/dist/commentary/index.d.ts +0 -6
  267. package/dist/commentary/index.js +0 -6
  268. package/dist/commentary/session/index.d.ts +0 -12
  269. package/dist/commentary/session/index.js +0 -14
  270. package/dist/commentary/session/persistence.d.ts +0 -92
  271. package/dist/commentary/session/persistence.js +0 -253
  272. package/dist/commentary/session/types.d.ts +0 -208
  273. package/dist/commentary/session/types.js +0 -26
  274. package/dist/commentary/session/updates.d.ts +0 -155
  275. package/dist/commentary/session/updates.js +0 -362
  276. package/dist/commentary/shared/anchor-types.d.ts +0 -116
  277. package/dist/commentary/shared/anchor-types.js +0 -9
  278. package/dist/components/diff-viewer/diff-controller.svelte.d.ts +0 -75
  279. package/dist/components/diff-viewer/diff-front-matter.svelte.d.ts +0 -28
  280. package/dist/components/diff-viewer/diff-line.svelte.d.ts +0 -22
  281. package/dist/components/diff-viewer/diff-summary-bar.svelte.d.ts +0 -13
  282. package/dist/components/diff-viewer/diff-toolbar.svelte.d.ts +0 -36
  283. package/dist/components/diff-viewer/diff-viewer.svelte.d.ts +0 -22
  284. package/dist/components/diff-viewer/diff-viewer.types.d.ts +0 -53
  285. package/dist/components/diff-viewer/front-matter-header.svelte.d.ts +0 -26
  286. package/dist/components/diff-viewer/index.d.ts +0 -4
  287. package/dist/components/diff-viewer/index.js +0 -2848
  288. package/dist/components/markdown-editor/editor-skeleton.svelte.d.ts +0 -10
  289. package/dist/components/markdown-editor/editor-toolbar/editor-toolbar.svelte.d.ts +0 -37
  290. package/dist/components/markdown-editor/editor-toolbar/index.d.ts +0 -11
  291. package/dist/components/markdown-editor/editor-toolbar/link-popover.svelte.d.ts +0 -30
  292. package/dist/components/markdown-editor/editor-toolbar/toolbar-button.svelte.d.ts +0 -19
  293. package/dist/components/markdown-editor/editor-toolbar/toolbar-dropdown.svelte.d.ts +0 -24
  294. package/dist/components/markdown-editor/editor-toolbar/toolbar-separator.svelte.d.ts +0 -7
  295. package/dist/components/markdown-editor/editor-toolbar/types.d.ts +0 -13
  296. package/dist/components/markdown-editor/index.css +0 -61
  297. package/dist/components/markdown-editor/index.d.ts +0 -4
  298. package/dist/components/markdown-editor/index.js +0 -7494
  299. package/dist/components/markdown-editor/markdown-editor.schema.d.ts +0 -3
  300. package/dist/components/markdown-editor/markdown-editor.schema.js +0 -177
  301. package/dist/components/markdown-editor/markdown-editor.svelte.d.ts +0 -29
  302. package/dist/components/markdown-editor/markdown-editor.types.d.ts +0 -100
  303. package/dist/components/markdown-editor/markdown-editor.variables.d.ts +0 -2
  304. package/dist/components/markdown-editor/markdown-editor.variables.js +0 -61
  305. package/dist/components/review-editor/comment-composer.svelte.d.ts +0 -37
  306. package/dist/components/review-editor/comment-list.svelte.d.ts +0 -19
  307. package/dist/components/review-editor/comment-sidebar.svelte.d.ts +0 -22
  308. package/dist/components/review-editor/export-actions.svelte.d.ts +0 -18
  309. package/dist/components/review-editor/focus-navigation.d.ts +0 -105
  310. package/dist/components/review-editor/front-matter-fields.svelte.d.ts +0 -10
  311. package/dist/components/review-editor/index.d.ts +0 -20
  312. package/dist/components/review-editor/index.js +0 -14731
  313. package/dist/components/review-editor/live-region.svelte.d.ts +0 -23
  314. package/dist/components/review-editor/review-editor-anchors.svelte.d.ts +0 -96
  315. package/dist/components/review-editor/review-editor-controls.svelte.d.ts +0 -41
  316. package/dist/components/review-editor/review-editor-exports.d.ts +0 -80
  317. package/dist/components/review-editor/review-editor-front-matter.d.ts +0 -28
  318. package/dist/components/review-editor/review-editor-impl.svelte.d.ts +0 -31
  319. package/dist/components/review-editor/review-editor-selection-geometry.d.ts +0 -10
  320. package/dist/components/review-editor/review-editor-selection-types.d.ts +0 -62
  321. package/dist/components/review-editor/review-editor-selection.svelte.d.ts +0 -50
  322. package/dist/components/review-editor/review-editor-state.svelte.d.ts +0 -77
  323. package/dist/components/review-editor/review-editor-threads.svelte.d.ts +0 -137
  324. package/dist/components/review-editor/review-editor.css +0 -273
  325. package/dist/components/review-editor/review-editor.schema.d.ts +0 -3
  326. package/dist/components/review-editor/review-editor.schema.js +0 -143
  327. package/dist/components/review-editor/review-editor.svelte.d.ts +0 -19
  328. package/dist/components/review-editor/review-editor.types.d.ts +0 -77
  329. package/dist/components/review-editor/review-editor.variables.d.ts +0 -2
  330. package/dist/components/review-editor/review-editor.variables.js +0 -61
  331. package/dist/components/review-editor/thread-popover.svelte.d.ts +0 -32
  332. package/dist/diff/index.d.ts +0 -2
  333. package/dist/diff/index.js +0 -1
  334. package/dist/diff/line-diff.d.ts +0 -84
  335. package/dist/diff/line-diff.js +0 -372
  336. package/dist/diff/types.d.ts +0 -1
  337. package/dist/diff/types.js +0 -1
  338. package/dist/editor/attach.d.ts +0 -30
  339. package/dist/editor/attach.js +0 -86
  340. package/dist/editor/bridge.d.ts +0 -110
  341. package/dist/editor/bridge.js +0 -260
  342. package/dist/editor/clipboard.d.ts +0 -19
  343. package/dist/editor/clipboard.js +0 -189
  344. package/dist/editor/commands.d.ts +0 -167
  345. package/dist/editor/commands.js +0 -728
  346. package/dist/editor/component-runtime.d.ts +0 -21
  347. package/dist/editor/component-runtime.js +0 -20
  348. package/dist/editor/editor.d.ts +0 -23
  349. package/dist/editor/editor.js +0 -256
  350. package/dist/editor/index.d.ts +0 -30
  351. package/dist/editor/index.js +0 -42
  352. package/dist/editor/keymap-plugin.d.ts +0 -56
  353. package/dist/editor/keymap-plugin.js +0 -157
  354. package/dist/editor/link-input-rule.d.ts +0 -4
  355. package/dist/editor/link-input-rule.js +0 -26
  356. package/dist/editor/milkdown-plugin-runtime.d.ts +0 -20
  357. package/dist/editor/milkdown-plugin-runtime.js +0 -43
  358. package/dist/editor/placeholder-security.d.ts +0 -22
  359. package/dist/editor/placeholder-security.js +0 -36
  360. package/dist/editor/placeholder.d.ts +0 -14
  361. package/dist/editor/placeholder.js +0 -56
  362. package/dist/editor/sanitize-html.d.ts +0 -32
  363. package/dist/editor/sanitize-html.js +0 -111
  364. package/dist/editor/template-completion-plugin.d.ts +0 -159
  365. package/dist/editor/template-completion-plugin.js +0 -615
  366. package/dist/editor/template-invalid-decoration-plugin.d.ts +0 -73
  367. package/dist/editor/template-invalid-decoration-plugin.js +0 -155
  368. package/dist/editor/template-placeholders.d.ts +0 -96
  369. package/dist/editor/template-placeholders.js +0 -355
  370. package/dist/editor/template-position-utilities.d.ts +0 -34
  371. package/dist/editor/template-position-utilities.js +0 -63
  372. package/dist/editor/template-render.d.ts +0 -37
  373. package/dist/editor/template-render.js +0 -45
  374. package/dist/editor/test-utilities.d.ts +0 -49
  375. package/dist/editor/test-utilities.js +0 -93
  376. package/dist/editor/types.d.ts +0 -234
  377. package/dist/editor/types.js +0 -8
  378. package/dist/markdown/diff/compute.d.ts +0 -28
  379. package/dist/markdown/diff/compute.js +0 -250
  380. package/dist/markdown/diff/frontmatter.d.ts +0 -66
  381. package/dist/markdown/diff/frontmatter.js +0 -135
  382. package/dist/markdown/diff/index.d.ts +0 -27
  383. package/dist/markdown/diff/index.js +0 -28
  384. package/dist/markdown/diff/line-diff.d.ts +0 -2
  385. package/dist/markdown/diff/line-diff.js +0 -1
  386. package/dist/markdown/diff/positions.d.ts +0 -66
  387. package/dist/markdown/diff/positions.js +0 -147
  388. package/dist/markdown/diff/types.d.ts +0 -78
  389. package/dist/markdown/diff/types.js +0 -7
  390. package/dist/markdown/index.d.ts +0 -2
  391. package/dist/markdown/index.js +0 -8
  392. package/dist/markdown/pipeline/ast.d.ts +0 -302
  393. package/dist/markdown/pipeline/ast.js +0 -417
  394. package/dist/markdown/pipeline/errors.d.ts +0 -37
  395. package/dist/markdown/pipeline/errors.js +0 -49
  396. package/dist/markdown/pipeline/frontmatter.d.ts +0 -127
  397. package/dist/markdown/pipeline/frontmatter.js +0 -438
  398. package/dist/markdown/pipeline/index.d.ts +0 -37
  399. package/dist/markdown/pipeline/index.js +0 -40
  400. package/dist/markdown/pipeline/parser.d.ts +0 -65
  401. package/dist/markdown/pipeline/parser.js +0 -106
  402. package/dist/markdown/pipeline/serializer.d.ts +0 -67
  403. package/dist/markdown/pipeline/serializer.js +0 -78
  404. package/dist/markdown/pipeline/strip-positions.d.ts +0 -20
  405. package/dist/markdown/pipeline/strip-positions.js +0 -28
  406. package/dist/markdown/pipeline/types.d.ts +0 -116
  407. package/dist/markdown/pipeline/types.js +0 -8
  408. package/dist/markdown/rendering/extract-code-blocks.d.ts +0 -16
  409. package/dist/markdown/rendering/extract-code-blocks.js +0 -27
  410. package/dist/markdown/rendering/highlighter.d.ts +0 -109
  411. package/dist/markdown/rendering/highlighter.js +0 -251
  412. package/dist/markdown/rendering/index.d.ts +0 -41
  413. package/dist/markdown/rendering/index.js +0 -46
  414. package/dist/markdown/rendering/mermaid-cache.d.ts +0 -55
  415. package/dist/markdown/rendering/mermaid-cache.js +0 -123
  416. package/dist/markdown/rendering/rehype-shiki-sync.d.ts +0 -57
  417. package/dist/markdown/rendering/rehype-shiki-sync.js +0 -354
  418. package/dist/markdown/rendering/render-async.d.ts +0 -43
  419. package/dist/markdown/rendering/render-async.js +0 -114
  420. package/dist/markdown/rendering/render-streaming.d.ts +0 -33
  421. package/dist/markdown/rendering/render-streaming.js +0 -123
  422. package/dist/markdown/rendering/render-worker.d.ts +0 -19
  423. package/dist/markdown/rendering/render-worker.js +0 -35
  424. package/dist/markdown/rendering/render.d.ts +0 -123
  425. package/dist/markdown/rendering/render.js +0 -477
  426. package/dist/markdown/rendering/sanitize-schema.d.ts +0 -24
  427. package/dist/markdown/rendering/sanitize-schema.js +0 -105
  428. package/dist/markdown/rendering/transform-urls.d.ts +0 -37
  429. package/dist/markdown/rendering/transform-urls.js +0 -51
  430. package/dist/markdown/rendering/types.d.ts +0 -51
  431. package/dist/markdown/rendering/types.js +0 -8
  432. package/dist/markdown/rendering/worker-dom-shim.d.ts +0 -87
  433. package/dist/markdown/rendering/worker-dom-shim.js +0 -50
  434. package/dist/markdown/utilities/safe-url.d.ts +0 -100
  435. package/dist/markdown/utilities/safe-url.js +0 -236
  436. package/dist/markdown/utilities/sort-keys.d.ts +0 -19
  437. package/dist/markdown/utilities/sort-keys.js +0 -33
  438. package/dist/server/commentary/anchor-decorations.js +0 -490
  439. package/dist/server/commentary/anchoring.js +0 -157
  440. package/dist/server/commentary/comments/index.js +0 -14
  441. package/dist/server/commentary/comments/mentions.js +0 -65
  442. package/dist/server/commentary/comments/reanchor.js +0 -220
  443. package/dist/server/commentary/comments/types.js +0 -83
  444. package/dist/server/commentary/comments/updates.js +0 -226
  445. package/dist/server/commentary/export/comments-export.js +0 -258
  446. package/dist/server/commentary/export/index.js +0 -12
  447. package/dist/server/commentary/export/markdown-summary.js +0 -218
  448. package/dist/server/commentary/export/types.js +0 -7
  449. package/dist/server/commentary/export/unified-diff.js +0 -250
  450. package/dist/server/commentary/index.js +0 -6
  451. package/dist/server/commentary/session/index.js +0 -14
  452. package/dist/server/commentary/session/persistence.js +0 -253
  453. package/dist/server/commentary/session/types.js +0 -26
  454. package/dist/server/commentary/session/updates.js +0 -362
  455. package/dist/server/commentary/shared/anchor-types.js +0 -9
  456. package/dist/server/components/diff-viewer/index.js +0 -33
  457. package/dist/server/components/markdown-editor/index.js +0 -52
  458. package/dist/server/components/review-editor/index.js +0 -3493
  459. package/dist/server/diff/index.js +0 -1
  460. package/dist/server/diff/line-diff.js +0 -372
  461. package/dist/server/diff/types.js +0 -1
  462. package/dist/server/editor/attach.js +0 -86
  463. package/dist/server/editor/bridge.js +0 -260
  464. package/dist/server/editor/clipboard.js +0 -189
  465. package/dist/server/editor/commands.js +0 -728
  466. package/dist/server/editor/component-runtime.js +0 -20
  467. package/dist/server/editor/editor.js +0 -256
  468. package/dist/server/editor/index.js +0 -42
  469. package/dist/server/editor/keymap-plugin.js +0 -157
  470. package/dist/server/editor/link-input-rule.js +0 -26
  471. package/dist/server/editor/milkdown-plugin-runtime.js +0 -43
  472. package/dist/server/editor/placeholder-security.js +0 -36
  473. package/dist/server/editor/placeholder.js +0 -56
  474. package/dist/server/editor/sanitize-html.js +0 -111
  475. package/dist/server/editor/template-completion-plugin.js +0 -615
  476. package/dist/server/editor/template-invalid-decoration-plugin.js +0 -155
  477. package/dist/server/editor/template-placeholders.js +0 -355
  478. package/dist/server/editor/template-position-utilities.js +0 -63
  479. package/dist/server/editor/template-render.js +0 -45
  480. package/dist/server/editor/test-utilities.js +0 -93
  481. package/dist/server/editor/types.js +0 -8
  482. package/dist/server/index.server-25wmev4e.js +0 -2
  483. package/dist/server/index.server-2c56kqws.js +0 -187
  484. package/dist/server/index.server-45n4s30n.js +0 -35
  485. package/dist/server/index.server-4jkqgp17.js +0 -1026
  486. package/dist/server/index.server-8nm871y8.js +0 -176
  487. package/dist/server/index.server-d04aj37r.js +0 -62
  488. package/dist/server/index.server-dg19y3m7.js +0 -9
  489. package/dist/server/index.server-g3726bja.js +0 -9
  490. package/dist/server/index.server-gyzmkrnz.js +0 -2
  491. package/dist/server/index.server-jp19145t.js +0 -9
  492. package/dist/server/index.server-n4jxy52q.js +0 -2
  493. package/dist/server/index.server-sghkqw5x.js +0 -421
  494. package/dist/server/index.server-w6am2dxc.js +0 -12
  495. package/dist/server/index.server-x66zvjfc.js +0 -1163
  496. package/dist/server/index.server-zdhv33ph.js +0 -124
  497. package/dist/server/index.server-zke5zt13.js +0 -9
  498. package/dist/server/markdown/diff/compute.js +0 -250
  499. package/dist/server/markdown/diff/frontmatter.js +0 -135
  500. package/dist/server/markdown/diff/index.js +0 -28
  501. package/dist/server/markdown/diff/line-diff.js +0 -1
  502. package/dist/server/markdown/diff/positions.js +0 -147
  503. package/dist/server/markdown/diff/types.js +0 -7
  504. package/dist/server/markdown/index.js +0 -8
  505. package/dist/server/markdown/pipeline/ast.js +0 -417
  506. package/dist/server/markdown/pipeline/errors.js +0 -49
  507. package/dist/server/markdown/pipeline/frontmatter.js +0 -438
  508. package/dist/server/markdown/pipeline/index.js +0 -40
  509. package/dist/server/markdown/pipeline/parser.js +0 -106
  510. package/dist/server/markdown/pipeline/serializer.js +0 -78
  511. package/dist/server/markdown/pipeline/strip-positions.js +0 -28
  512. package/dist/server/markdown/pipeline/types.js +0 -8
  513. package/dist/server/markdown/rendering/extract-code-blocks.js +0 -27
  514. package/dist/server/markdown/rendering/highlighter.js +0 -251
  515. package/dist/server/markdown/rendering/index.js +0 -46
  516. package/dist/server/markdown/rendering/mermaid-cache.js +0 -123
  517. package/dist/server/markdown/rendering/rehype-shiki-sync.js +0 -354
  518. package/dist/server/markdown/rendering/render-async.js +0 -114
  519. package/dist/server/markdown/rendering/render-streaming.js +0 -123
  520. package/dist/server/markdown/rendering/render-worker.js +0 -35
  521. package/dist/server/markdown/rendering/render.js +0 -477
  522. package/dist/server/markdown/rendering/sanitize-schema.js +0 -105
  523. package/dist/server/markdown/rendering/transform-urls.js +0 -51
  524. package/dist/server/markdown/rendering/types.js +0 -8
  525. package/dist/server/markdown/rendering/worker-dom-shim.js +0 -50
  526. package/dist/server/markdown/utilities/safe-url.js +0 -236
  527. package/dist/server/markdown/utilities/sort-keys.js +0 -33
  528. package/src/components/diff-viewer/diff-controller.svelte.ts +0 -250
  529. package/src/components/diff-viewer/diff-front-matter.svelte +0 -52
  530. package/src/components/diff-viewer/diff-line.svelte +0 -340
  531. package/src/components/diff-viewer/diff-summary-bar.svelte +0 -106
  532. package/src/components/diff-viewer/diff-toolbar.svelte +0 -182
  533. package/src/components/diff-viewer/diff-viewer.examples.json +0 -25
  534. package/src/components/diff-viewer/diff-viewer.schema.json +0 -61
  535. package/src/components/diff-viewer/diff-viewer.schema.ts +0 -70
  536. package/src/components/diff-viewer/diff-viewer.svelte +0 -400
  537. package/src/components/diff-viewer/diff-viewer.types.ts +0 -56
  538. package/src/components/diff-viewer/front-matter-header.svelte +0 -137
  539. package/src/components/diff-viewer/index.ts +0 -5
  540. package/src/components/markdown-editor/editor-skeleton.svelte +0 -85
  541. package/src/components/markdown-editor/editor-toolbar/editor-toolbar.svelte +0 -318
  542. package/src/components/markdown-editor/editor-toolbar/index.ts +0 -18
  543. package/src/components/markdown-editor/editor-toolbar/link-popover.svelte +0 -314
  544. package/src/components/markdown-editor/editor-toolbar/toolbar-button.svelte +0 -97
  545. package/src/components/markdown-editor/editor-toolbar/toolbar-dropdown.svelte +0 -106
  546. package/src/components/markdown-editor/editor-toolbar/toolbar-separator.svelte +0 -30
  547. package/src/components/markdown-editor/editor-toolbar/types.ts +0 -15
  548. package/src/components/markdown-editor/index.ts +0 -10
  549. package/src/components/markdown-editor/markdown-editor.examples.json +0 -19
  550. package/src/components/markdown-editor/markdown-editor.schema.json +0 -111
  551. package/src/components/markdown-editor/markdown-editor.schema.ts +0 -122
  552. package/src/components/markdown-editor/markdown-editor.svelte +0 -872
  553. package/src/components/markdown-editor/markdown-editor.types.ts +0 -124
  554. package/src/components/markdown-editor/markdown-editor.variables.json +0 -1
  555. package/src/components/markdown-editor/markdown-editor.variables.ts +0 -3
  556. package/src/components/markdown-editor/prosemirror.css +0 -76
  557. package/src/components/review-editor/comment-composer.svelte +0 -271
  558. package/src/components/review-editor/comment-list.svelte +0 -311
  559. package/src/components/review-editor/comment-sidebar.svelte +0 -449
  560. package/src/components/review-editor/export-actions.svelte +0 -188
  561. package/src/components/review-editor/focus-navigation.ts +0 -220
  562. package/src/components/review-editor/front-matter-fields.svelte +0 -159
  563. package/src/components/review-editor/index.ts +0 -59
  564. package/src/components/review-editor/live-region.svelte +0 -109
  565. package/src/components/review-editor/review-editor-anchors.svelte.ts +0 -219
  566. package/src/components/review-editor/review-editor-controls.svelte +0 -201
  567. package/src/components/review-editor/review-editor-exports.ts +0 -145
  568. package/src/components/review-editor/review-editor-front-matter.ts +0 -237
  569. package/src/components/review-editor/review-editor-impl.svelte +0 -1509
  570. package/src/components/review-editor/review-editor-selection-geometry.ts +0 -31
  571. package/src/components/review-editor/review-editor-selection-types.ts +0 -68
  572. package/src/components/review-editor/review-editor-selection.svelte.ts +0 -292
  573. package/src/components/review-editor/review-editor-state.svelte.ts +0 -117
  574. package/src/components/review-editor/review-editor-threads.svelte.ts +0 -435
  575. package/src/components/review-editor/review-editor.css +0 -273
  576. package/src/components/review-editor/review-editor.examples.json +0 -19
  577. package/src/components/review-editor/review-editor.schema.json +0 -83
  578. package/src/components/review-editor/review-editor.schema.ts +0 -88
  579. package/src/components/review-editor/review-editor.svelte +0 -18
  580. package/src/components/review-editor/review-editor.types.ts +0 -92
  581. package/src/components/review-editor/review-editor.variables.json +0 -1
  582. package/src/components/review-editor/review-editor.variables.ts +0 -3
  583. package/src/components/review-editor/thread-popover.svelte +0 -261
  584. /package/dist/components/{review-editor/review-editor.css.d.ts → json-editor/json-editor.css.d.ts} +0 -0
  585. /package/dist/components/{diff-viewer/diff-viewer.schema.d.ts → json-editor/json-editor.schema.d.ts} +0 -0
  586. /package/dist/components/{diff-viewer/diff-viewer.variables.d.ts → json-editor/json-editor.variables.d.ts} +0 -0
  587. /package/src/components/{diff-viewer/diff-viewer.variables.json → json-editor/json-editor.variables.json} +0 -0
  588. /package/src/components/{diff-viewer/diff-viewer.variables.ts → json-editor/json-editor.variables.ts} +0 -0
@@ -1,65 +0,0 @@
1
- /**
2
- * Mention extraction utility for comment bodies.
3
- *
4
- * Extracts @username mentions while avoiding false positives from:
5
- * - Email addresses (user@example.com)
6
- * - Code blocks (```code```)
7
- * - Inline code (`code`)
8
- *
9
- * ## Known Limitations
10
- *
11
- * This is a regex-based heuristic, not a full Markdown parser. Edge cases:
12
- * - **Unterminated fenced blocks**: An unclosed ``` consumes the rest of the string
13
- * - **Escaped backticks**: Inline code with escaped backticks (e.g., `foo\`bar`) may misbehave
14
- * - **HTML code tags**: `<code>@mention</code>` is not detected as code
15
- *
16
- * For most comment use cases, these limitations are acceptable. If more robust
17
- * parsing is needed, consider using the editor's AST via Milkdown/Prosemirror.
18
- *
19
- * @module
20
- */
21
- // Match @username but not email addresses (preceded by word char, period, or plus)
22
- // Uses a capturing group alternative instead of negative lookbehind for Safari <16.4 compatibility
23
- // Pattern: (start-of-string OR non-email-char) followed by @username
24
- // The username is in capture group 2
25
- // Hoisted outside function to avoid regex recompilation on each call
26
- const mentionRegex = /(^|[^.\w+])@([\w-]+)/g;
27
- /**
28
- * Extract @mentions from a comment body.
29
- *
30
- * Matches @username patterns where username contains alphanumeric characters,
31
- * underscores, and hyphens. Ignores mentions inside code blocks and inline code,
32
- * and avoids matching email addresses.
33
- *
34
- * @param body - The comment body (Markdown)
35
- * @returns Array of unique usernames (without the @ prefix)
36
- *
37
- * @example
38
- * extractMentions('Hello @alice and @bob!')
39
- * // Returns: ['alice', 'bob']
40
- *
41
- * @example
42
- * extractMentions('Email: user@example.com @alice')
43
- * // Returns: ['alice'] (ignores email)
44
- *
45
- * @example
46
- * extractMentions('See `@config` or @alice')
47
- * // Returns: ['alice'] (ignores inline code)
48
- */
49
- export function extractMentions(body) {
50
- // Remove fenced code blocks (```...```)
51
- const withoutFencedCode = body.replace(/```[\s\S]*?```/g, '');
52
- // Remove inline code (`...`)
53
- const withoutCode = withoutFencedCode.replace(/`[^`]*`/g, '');
54
- // Reset regex lastIndex since we're reusing a global regex
55
- mentionRegex.lastIndex = 0;
56
- const mentions = new Set();
57
- for (const match of withoutCode.matchAll(mentionRegex)) {
58
- // Group 2 contains the username (group 1 is the preceding character/start-of-string)
59
- const username = match[2];
60
- if (username) {
61
- mentions.add(username);
62
- }
63
- }
64
- return Array.from(mentions);
65
- }
@@ -1,220 +0,0 @@
1
- /**
2
- * Re-anchoring algorithm for comment anchors.
3
- *
4
- * This module implements the TextQuoteSelector re-anchoring algorithm
5
- * that finds anchor positions after document edits. It uses:
6
- * - Exact quote matching
7
- * - Prefix/suffix context scoring
8
- * - Position proximity for disambiguation
9
- * - Fuzzy matching as fallback
10
- *
11
- * @module
12
- */
13
- /**
14
- * Find all exact occurrences of a quote in document text.
15
- *
16
- * @param quote - Text to find
17
- * @param documentText - Document to search
18
- * @returns Array of match positions
19
- */
20
- export function findAllOccurrences(quote, documentText) {
21
- const matches = [];
22
- if (!quote)
23
- return matches;
24
- let startIndex = 0;
25
- while (true) {
26
- const index = documentText.indexOf(quote, startIndex);
27
- if (index === -1)
28
- break;
29
- matches.push({
30
- start: index,
31
- end: index + quote.length,
32
- });
33
- startIndex = index + 1;
34
- }
35
- return matches;
36
- }
37
- /**
38
- * Score how well a match's surrounding context matches the expected context.
39
- *
40
- * Uses longest common subsequence (LCS) to handle minor edits in context.
41
- *
42
- * @param documentText - Full document text
43
- * @param match - The match to score
44
- * @param expectedPrefix - Expected prefix context
45
- * @param expectedSuffix - Expected suffix context
46
- * @returns Score from 0 (no match) to 1 (perfect match)
47
- */
48
- export function scoreContextMatch(documentText, match, expectedPrefix, expectedSuffix) {
49
- // Extract actual context from document
50
- const actualPrefix = documentText.slice(Math.max(0, match.start - expectedPrefix.length), match.start);
51
- const actualSuffix = documentText.slice(match.end, match.end + expectedSuffix.length);
52
- // Score prefix match
53
- const prefixScore = expectedPrefix.length > 0 ? lcsRatio(actualPrefix, expectedPrefix) : 1.0;
54
- // Score suffix match
55
- const suffixScore = expectedSuffix.length > 0 ? lcsRatio(actualSuffix, expectedSuffix) : 1.0;
56
- // Average the scores, weighting prefix slightly higher
57
- // (prefix is often more stable than suffix)
58
- return prefixScore * 0.55 + suffixScore * 0.45;
59
- }
60
- /**
61
- * Calculate LCS (Longest Common Subsequence) ratio between two strings.
62
- *
63
- * @param a - First string
64
- * @param b - Second string
65
- * @returns Ratio of LCS length to max string length (0-1)
66
- */
67
- function lcsRatio(a, b) {
68
- if (a.length === 0 || b.length === 0)
69
- return 0;
70
- const lcsLength = longestCommonSubsequence(a, b);
71
- return lcsLength / Math.max(a.length, b.length);
72
- }
73
- /**
74
- * Calculate length of longest common subsequence.
75
- *
76
- * Uses dynamic programming with space optimization.
77
- */
78
- function longestCommonSubsequence(a, b) {
79
- const aLength = a.length;
80
- const bLength = b.length;
81
- // Use two rows for space optimization
82
- let previousRow = Array.from({ length: bLength + 1 }, () => 0);
83
- let currentRow = Array.from({ length: bLength + 1 }, () => 0);
84
- for (let aIndex = 1; aIndex <= aLength; aIndex += 1) {
85
- for (let bIndex = 1; bIndex <= bLength; bIndex += 1) {
86
- if (a[aIndex - 1] === b[bIndex - 1]) {
87
- currentRow[bIndex] = (previousRow[bIndex - 1] ?? 0) + 1;
88
- }
89
- else {
90
- currentRow[bIndex] = Math.max(previousRow[bIndex] ?? 0, currentRow[bIndex - 1] ?? 0);
91
- }
92
- }
93
- // Swap rows
94
- [previousRow, currentRow] = [currentRow, previousRow];
95
- }
96
- return previousRow[bLength] ?? 0;
97
- }
98
- /**
99
- * Attempt fuzzy re-anchoring when exact quote is not found.
100
- *
101
- * Uses the prefix + suffix to try to locate where the anchor was.
102
- * This is a fallback for when the quoted text was deleted or significantly changed.
103
- *
104
- * @param documentText - Full document text
105
- * @param anchor - Original anchor data
106
- * @returns Re-anchor result with found=false (the quoted text no longer exists)
107
- */
108
- export function fuzzyReanchor(documentText, anchor) {
109
- const { prefix, suffix, lastKnownOffset, originalPosition } = anchor;
110
- const referenceOffset = lastKnownOffset ?? originalPosition?.offset;
111
- // Try to find the junction point using prefix + suffix
112
- if (prefix.length > 0 && suffix.length > 0) {
113
- // Search for prefix ending + suffix beginning near reference position
114
- const searchRadius = 500; // Characters to search around reference
115
- const searchStart = Math.max(0, (referenceOffset ?? 0) - searchRadius);
116
- const searchEnd = Math.min(documentText.length, (referenceOffset ?? documentText.length) + searchRadius);
117
- const searchText = documentText.slice(searchStart, searchEnd);
118
- // Look for prefix ending
119
- const prefixEnd = prefix.slice(-20); // Last 20 chars of prefix
120
- const suffixStart = suffix.slice(0, 20); // First 20 chars of suffix
121
- let bestPos = -1;
122
- let bestScore = 0;
123
- // Slide through search region looking for best match
124
- for (let i = 0; i < searchText.length - 1; i++) {
125
- const beforeSlice = searchText.slice(Math.max(0, i - prefixEnd.length), i);
126
- const afterSlice = searchText.slice(i, i + suffixStart.length);
127
- const beforeScore = lcsRatio(beforeSlice, prefixEnd);
128
- const afterScore = lcsRatio(afterSlice, suffixStart);
129
- const score = (beforeScore + afterScore) / 2;
130
- if (score > bestScore) {
131
- bestScore = score;
132
- bestPos = searchStart + i;
133
- }
134
- }
135
- if (bestScore >= 0.5) {
136
- // Found a reasonable junction point where the text was deleted
137
- // Return not found - the thread will be auto-deleted
138
- return {
139
- found: false,
140
- from: bestPos,
141
- to: bestPos,
142
- confidence: bestScore,
143
- };
144
- }
145
- }
146
- // Couldn't find anything - completely gone
147
- return {
148
- found: false,
149
- from: referenceOffset ?? 0,
150
- to: referenceOffset ?? 0,
151
- confidence: 0,
152
- };
153
- }
154
- /**
155
- * Re-anchor a quote in a document.
156
- *
157
- * Algorithm:
158
- * 1. Find all exact occurrences of the quote
159
- * 2. If none found, attempt fuzzy re-anchoring
160
- * 3. If one found, score its context and return
161
- * 4. If multiple found, score by context + position proximity
162
- * 5. Check margin between top matches for ambiguity
163
- *
164
- * @param documentText - Full document text (from doc.textBetween())
165
- * @param anchor - Anchor data with quote, context, and position hints
166
- * @returns Re-anchor result with new position and status
167
- */
168
- export function reanchorQuote(documentText, anchor) {
169
- const { quote, prefix, suffix, originalPosition, lastKnownOffset } = anchor;
170
- // Prefer lastKnownOffset over originalPosition for disambiguation
171
- // lastKnownOffset tracks current location, originalPosition is historical
172
- const referenceOffset = lastKnownOffset ?? originalPosition?.offset;
173
- // Find all exact occurrences
174
- const matches = findAllOccurrences(quote, documentText);
175
- // No matches - try fuzzy re-anchoring
176
- if (matches.length === 0) {
177
- return fuzzyReanchor(documentText, anchor);
178
- }
179
- // Single match - score its context
180
- if (matches.length === 1) {
181
- const match = matches[0];
182
- if (!match) {
183
- return fuzzyReanchor(documentText, anchor);
184
- }
185
- const confidence = scoreContextMatch(documentText, match, prefix, suffix);
186
- return {
187
- found: true,
188
- from: match.start,
189
- to: match.end,
190
- confidence,
191
- };
192
- }
193
- // Multiple matches - score by context + position proximity
194
- const scoredMatches = matches.map((match) => {
195
- const contextScore = scoreContextMatch(documentText, match, prefix, suffix);
196
- // Position proximity (exponential decay with distance)
197
- let proximityScore = 0;
198
- if (referenceOffset !== undefined) {
199
- const distance = Math.abs(match.start - referenceOffset);
200
- proximityScore = Math.exp(-distance / 500);
201
- }
202
- // Weight context more heavily than proximity
203
- const totalScore = contextScore * 0.7 + proximityScore * 0.3;
204
- return { ...match, contextScore, proximityScore, totalScore };
205
- });
206
- // Sort by total score descending
207
- scoredMatches.sort((a, b) => b.totalScore - a.totalScore);
208
- const best = scoredMatches[0];
209
- if (!best) {
210
- return fuzzyReanchor(documentText, anchor);
211
- }
212
- // We found matches, return the best one
213
- // The confidence score captures how certain we are about this match
214
- return {
215
- found: true,
216
- from: best.start,
217
- to: best.end,
218
- confidence: best.totalScore,
219
- };
220
- }
@@ -1,83 +0,0 @@
1
- /**
2
- * Comment and thread types for the Markdown Review Editor.
3
- *
4
- * These types support:
5
- * - TextQuoteSelector-style anchoring (survives edits via quote + context)
6
- * - Runtime position tracking (ProseMirror positions)
7
- * - Serialization for persistence
8
- *
9
- * Threads have no lifecycle status - they exist until deleted.
10
- * When anchor text is deleted, threads are automatically removed.
11
- *
12
- * @module
13
- */
14
- // ============================================================================
15
- // Utility Types
16
- // ============================================================================
17
- /**
18
- * Generate a unique ID for threads and comments.
19
- * Uses crypto.randomUUID() when available, falls back to timestamp + random.
20
- */
21
- export function generateId() {
22
- if (typeof crypto !== 'undefined' && crypto.randomUUID) {
23
- return crypto.randomUUID();
24
- }
25
- // Fallback for environments without crypto.randomUUID
26
- return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
27
- }
28
- /**
29
- * Get current ISO timestamp.
30
- */
31
- export function timestamp() {
32
- return new Date().toISOString();
33
- }
34
- /**
35
- * Context length for TextQuoteSelector prefix/suffix.
36
- */
37
- export const ANCHOR_CONTEXT_LENGTH = 50;
38
- /**
39
- * Create a TextQuoteAnchor from a selection.
40
- *
41
- * @param quote - The selected text
42
- * @param documentText - The full document text
43
- * @param startOffset - Character offset of selection start
44
- * @param endOffset - Character offset of selection end
45
- */
46
- export function createTextQuoteAnchor(quote, documentText, startOffset, endOffset) {
47
- const prefixStart = Math.max(0, startOffset - ANCHOR_CONTEXT_LENGTH);
48
- const suffixEnd = Math.min(documentText.length, endOffset + ANCHOR_CONTEXT_LENGTH);
49
- return {
50
- quote,
51
- prefix: documentText.slice(prefixStart, startOffset),
52
- suffix: documentText.slice(endOffset, suffixEnd),
53
- };
54
- }
55
- /**
56
- * Create a document-level anchor (not anchored to specific text).
57
- *
58
- * Document-level comments are for general feedback about the entire document,
59
- * not tied to a specific text selection.
60
- */
61
- export function createDocumentAnchor() {
62
- return {
63
- type: 'document',
64
- quote: '',
65
- prefix: '',
66
- suffix: '',
67
- from: 0,
68
- to: 0,
69
- status: 'anchored',
70
- };
71
- }
72
- /**
73
- * Check if an anchor is a document-level anchor.
74
- */
75
- export function isDocumentAnchor(anchor) {
76
- return anchor.type === 'document';
77
- }
78
- /**
79
- * Check if an anchor is a text anchor (explicit 'text' type or undefined for backwards compat).
80
- */
81
- export function isTextAnchor(anchor) {
82
- return anchor.type === 'text' || anchor.type === undefined;
83
- }
@@ -1,226 +0,0 @@
1
- /**
2
- * Pure update helpers for thread and comment state management.
3
- *
4
- * All functions are pure (no side effects, no ID/timestamp generation).
5
- * They return new arrays/objects for Svelte 5 reactivity.
6
- * The `changed` flag indicates whether the operation had any effect.
7
- *
8
- * @module
9
- */
10
- // ============================================================================
11
- // Visibility Helpers
12
- // ============================================================================
13
- /**
14
- * Check if a comment is visible (not soft-deleted).
15
- */
16
- export function isCommentVisible(comment) {
17
- return !comment.deletedAt;
18
- }
19
- /**
20
- * Get visible (non-deleted) comments from a thread.
21
- */
22
- export function getVisibleComments(thread) {
23
- return thread.comments.filter(isCommentVisible);
24
- }
25
- // ============================================================================
26
- // Thread Operations
27
- // ============================================================================
28
- /**
29
- * Add a new thread to the threads array.
30
- *
31
- * @param threads - Current threads array
32
- * @param thread - The thread to add (caller provides complete Thread with ID/timestamps)
33
- */
34
- export function addThread(threads, thread) {
35
- return {
36
- threads: [...threads, thread],
37
- changed: true,
38
- };
39
- }
40
- /**
41
- * Delete a thread from the threads array.
42
- *
43
- * No-op if thread does not exist.
44
- *
45
- * @param threads - Current threads array
46
- * @param threadId - ID of the thread to delete
47
- */
48
- export function deleteThread(threads, threadId) {
49
- const exists = threads.some((t) => t.id === threadId);
50
- if (!exists) {
51
- return { threads, changed: false };
52
- }
53
- return {
54
- threads: threads.filter((t) => t.id !== threadId),
55
- changed: true,
56
- };
57
- }
58
- // ============================================================================
59
- // Comment Operations
60
- // ============================================================================
61
- /**
62
- * Add a comment to an existing thread.
63
- *
64
- * No-op if thread does not exist.
65
- *
66
- * @param threads - Current threads array
67
- * @param threadId - ID of the thread to add the comment to
68
- * @param comment - The comment to add (caller provides complete Comment with ID/timestamps)
69
- */
70
- export function addComment(threads, threadId, comment) {
71
- const exists = threads.some((t) => t.id === threadId);
72
- if (!exists) {
73
- return { threads, changed: false };
74
- }
75
- return {
76
- threads: threads.map((thread) => {
77
- if (thread.id !== threadId)
78
- return thread;
79
- return {
80
- ...thread,
81
- comments: [...thread.comments, comment],
82
- };
83
- }),
84
- changed: true,
85
- value: { comment },
86
- };
87
- }
88
- /**
89
- * Update an existing comment's body and mentions.
90
- *
91
- * No-op if thread/comment does not exist or comment is deleted.
92
- *
93
- * @param threads - Current threads array
94
- * @param threadId - ID of the thread containing the comment
95
- * @param commentId - ID of the comment to update
96
- * @param update - The update with body, mentions, and editedAt (caller provides timestamp)
97
- */
98
- export function updateComment(threads, threadId, commentId, update) {
99
- const thread = threads.find((t) => t.id === threadId);
100
- if (!thread) {
101
- return { threads, changed: false };
102
- }
103
- const comment = thread.comments.find((c) => c.id === commentId);
104
- if (!comment || comment.deletedAt) {
105
- return { threads, changed: false };
106
- }
107
- return {
108
- threads: threads.map((t) => {
109
- if (t.id !== threadId)
110
- return t;
111
- return {
112
- ...t,
113
- comments: t.comments.map((c) => {
114
- if (c.id !== commentId)
115
- return c;
116
- const updatedComment = {
117
- ...c,
118
- body: update.body,
119
- editedAt: update.editedAt,
120
- };
121
- if (update.mentions !== undefined) {
122
- updatedComment.mentions = update.mentions;
123
- }
124
- return updatedComment;
125
- }),
126
- };
127
- }),
128
- changed: true,
129
- };
130
- }
131
- /**
132
- * Delete a comment from a thread.
133
- *
134
- * Soft delete sets deletedAt timestamp.
135
- * Hard delete removes the comment from the array.
136
- *
137
- * No-op if thread/comment does not exist, or if soft-deleting an already deleted comment.
138
- *
139
- * @param threads - Current threads array
140
- * @param threadId - ID of the thread containing the comment
141
- * @param commentId - ID of the comment to delete
142
- * @param options - Delete options with soft flag and deletedAt timestamp (for soft delete)
143
- */
144
- export function deleteComment(threads, threadId, commentId, options) {
145
- const thread = threads.find((t) => t.id === threadId);
146
- if (!thread) {
147
- return { threads, changed: false };
148
- }
149
- const comment = thread.comments.find((c) => c.id === commentId);
150
- if (!comment) {
151
- return { threads, changed: false };
152
- }
153
- // For soft delete, no-op if already deleted or if deletedAt not provided
154
- if (options.soft) {
155
- if (comment.deletedAt || !options.deletedAt) {
156
- return { threads, changed: false };
157
- }
158
- const { deletedAt } = options;
159
- // Soft delete: set deletedAt
160
- return {
161
- threads: threads.map((t) => {
162
- if (t.id !== threadId)
163
- return t;
164
- return {
165
- ...t,
166
- comments: t.comments.map((c) => {
167
- if (c.id !== commentId)
168
- return c;
169
- return { ...c, deletedAt };
170
- }),
171
- };
172
- }),
173
- changed: true,
174
- };
175
- }
176
- // Hard delete: remove from array
177
- return {
178
- threads: threads.map((t) => {
179
- if (t.id !== threadId)
180
- return t;
181
- return {
182
- ...t,
183
- comments: t.comments.filter((c) => c.id !== commentId),
184
- };
185
- }),
186
- changed: true,
187
- };
188
- }
189
- /**
190
- * Restore a soft-deleted comment.
191
- *
192
- * Removes the deletedAt timestamp.
193
- *
194
- * No-op if thread/comment does not exist or comment is not deleted.
195
- *
196
- * @param threads - Current threads array
197
- * @param threadId - ID of the thread containing the comment
198
- * @param commentId - ID of the comment to restore
199
- */
200
- export function restoreComment(threads, threadId, commentId) {
201
- const thread = threads.find((t) => t.id === threadId);
202
- if (!thread) {
203
- return { threads, changed: false };
204
- }
205
- const comment = thread.comments.find((c) => c.id === commentId);
206
- if (!comment || !comment.deletedAt) {
207
- return { threads, changed: false };
208
- }
209
- return {
210
- threads: threads.map((t) => {
211
- if (t.id !== threadId)
212
- return t;
213
- return {
214
- ...t,
215
- comments: t.comments.map((c) => {
216
- if (c.id !== commentId)
217
- return c;
218
- // Remove deletedAt using delete for clean omission
219
- const { deletedAt: _deletedAt, ...restored } = c;
220
- return restored;
221
- }),
222
- };
223
- }),
224
- changed: true,
225
- };
226
- }