@peaske7/readit 0.3.0-rc.0 → 0.3.0-rc.2

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 (374) hide show
  1. package/README.md +3 -3
  2. package/dist/.vite/manifest.json +1111 -0
  3. package/dist/assets/_basePickBy-BMMA4Tou.js +1 -0
  4. package/dist/assets/_baseUniq-D40qku1I.js +1 -0
  5. package/dist/assets/arc-Ckg65iy8.js +1 -0
  6. package/dist/assets/architecture-YZFGNWBL-Dv3EY0zV.js +1 -0
  7. package/dist/assets/architectureDiagram-Q4EWVU46-DQnkwSaB.js +36 -0
  8. package/dist/assets/array-Bjz-wYpJ.js +1 -0
  9. package/dist/assets/blockDiagram-DXYQGD6D-UB6_S1lm.js +132 -0
  10. package/dist/assets/c4Diagram-AHTNJAMY-sn3k2GND.js +10 -0
  11. package/dist/assets/channel-D9wPw2fQ.js +1 -0
  12. package/dist/assets/chunk-2KRD3SAO-DaFfaCGO.js +1 -0
  13. package/dist/assets/chunk-336JU56O-C8siO5Of.js +2 -0
  14. package/dist/assets/chunk-426QAEUC-BB478m3j.js +1 -0
  15. package/dist/assets/chunk-4BX2VUAB-DRuTD7x5.js +1 -0
  16. package/dist/assets/chunk-4TB4RGXK-_l6jvVAY.js +206 -0
  17. package/dist/assets/chunk-55IACEB6-BExiaAoD.js +1 -0
  18. package/dist/assets/chunk-5FUZZQ4R-HOSFTxuG.js +62 -0
  19. package/dist/assets/chunk-5PVQY5BW-BRVNNRAX.js +2 -0
  20. package/dist/assets/chunk-67CJDMHE-DMt8LNEX.js +1 -0
  21. package/dist/assets/chunk-7N4EOEYR-CzLGefVf.js +1 -0
  22. package/dist/assets/chunk-AA7GKIK3-B6GFAk4U.js +1 -0
  23. package/dist/assets/chunk-BSJP7CBP-BK29yehL.js +1 -0
  24. package/dist/assets/chunk-CIAEETIT-D7hBXImP.js +1 -0
  25. package/dist/assets/chunk-Dlc7tRH4.js +1 -0
  26. package/dist/assets/chunk-EDXVE4YY-CSvKh9DT.js +1 -0
  27. package/dist/assets/chunk-ENJZ2VHE-QApb5cYr.js +10 -0
  28. package/dist/assets/chunk-FMBD7UC4-2FWyCCAV.js +15 -0
  29. package/dist/assets/chunk-FOC6F5B3-DKFHrt4K.js +1 -0
  30. package/dist/assets/chunk-ICPOFSXX-agBjBxsW.js +122 -0
  31. package/dist/assets/chunk-K5T4RW27-D51O7IkG.js +94 -0
  32. package/dist/assets/chunk-KGLVRYIC-DMHSCH4T.js +1 -0
  33. package/dist/assets/chunk-LIHQZDEY-C2aANxt9.js +1 -0
  34. package/dist/assets/chunk-ORNJ4GCN-Db_37NRX.js +1 -0
  35. package/dist/assets/chunk-OYMX7WX6-HGUtT2Q9.js +231 -0
  36. package/dist/assets/chunk-QZHKN3VN-8Lcg9gti.js +1 -0
  37. package/dist/assets/chunk-U2HBQHQK-BFYYQeuC.js +70 -0
  38. package/dist/assets/chunk-X2U36JSP-p8ehTP6s.js +1 -0
  39. package/dist/assets/chunk-XPW4576I-Bqbompq4.js +32 -0
  40. package/dist/assets/chunk-YZCP3GAM-HIMez9pG.js +1 -0
  41. package/dist/assets/chunk-ZZ45TVLE-DRIE_0bu.js +1 -0
  42. package/dist/assets/classDiagram-6PBFFD2Q-BawhEeUl.js +1 -0
  43. package/dist/assets/classDiagram-v2-HSJHXN6E-CLNjgH9n.js +1 -0
  44. package/dist/assets/clone-BBjvuERA.js +1 -0
  45. package/dist/assets/cose-bilkent-S5V4N54A-q90QeGKv.js +1 -0
  46. package/dist/assets/cytoscape.esm-BfXff3fb.js +321 -0
  47. package/dist/assets/dagre-Dxbob2Lr.js +1 -0
  48. package/dist/assets/dagre-KV5264BT-BuvpNxMw.js +4 -0
  49. package/dist/assets/defaultLocale-BwmRmqJp.js +1 -0
  50. package/dist/assets/diagram-5BDNPKRD-DQLsxwwt.js +10 -0
  51. package/dist/assets/diagram-G4DWMVQ6-Jv9Eefw4.js +24 -0
  52. package/dist/assets/diagram-MMDJMWI5-D-0YgNhU.js +43 -0
  53. package/dist/assets/diagram-TYMM5635-BHwO7zQG.js +24 -0
  54. package/dist/assets/dist-BNz65Ibc.js +1 -0
  55. package/dist/assets/erDiagram-SMLLAGMA-BjZGGBJz.js +85 -0
  56. package/dist/assets/flowDiagram-DWJPFMVM-CFbFUm_m.js +162 -0
  57. package/dist/assets/ganttDiagram-T4ZO3ILL-CXk4TcBi.js +292 -0
  58. package/dist/assets/gitGraph-7Q5UKJZL-BGFRt2qs.js +1 -0
  59. package/dist/assets/gitGraphDiagram-UUTBAWPF-C8yZOxjo.js +106 -0
  60. package/dist/assets/graphlib-DGcD9J2L.js +1 -0
  61. package/dist/assets/index-D-m0LiFI.js +14 -0
  62. package/dist/assets/index-DANHO6J0.css +2 -0
  63. package/dist/assets/info-OMHHGYJF-DI6-Z9vh.js +1 -0
  64. package/dist/assets/infoDiagram-42DDH7IO-p-PXDra2.js +2 -0
  65. package/dist/assets/init-TPm5RB77.js +1 -0
  66. package/dist/assets/isArrayLikeObject-69BLnVNM.js +1 -0
  67. package/dist/assets/isEmpty-DUS28g5f.js +1 -0
  68. package/dist/assets/ishikawaDiagram-UXIWVN3A-BrIoEvtb.js +70 -0
  69. package/dist/assets/journeyDiagram-VCZTEJTY-aZpvKa9g.js +139 -0
  70. package/dist/assets/kanban-definition-6JOO6SKY-CoOAY9ji.js +89 -0
  71. package/dist/assets/katex-5SGEXwpi.js +261 -0
  72. package/dist/assets/line-4MF1lR4d.js +1 -0
  73. package/dist/assets/linear-CXMqTN8N.js +1 -0
  74. package/dist/assets/mermaid-config-C8a4L22x.js +1 -0
  75. package/dist/assets/mermaid-parser.core-DREsY2u4.js +4 -0
  76. package/dist/assets/mermaid.core-8ysLpTJi.js +11 -0
  77. package/dist/assets/mindmap-definition-QFDTVHPH-CsqUJCMn.js +96 -0
  78. package/dist/assets/ordinal-D7l-8DAO.js +1 -0
  79. package/dist/assets/packet-4T2RLAQJ-DidW3JFc.js +1 -0
  80. package/dist/assets/path-BVpCanzE.js +1 -0
  81. package/dist/assets/pie-ZZUOXDRM-Bff2e5hg.js +1 -0
  82. package/dist/assets/pieDiagram-DEJITSTG-k0Br4NDS.js +30 -0
  83. package/dist/assets/quadrantDiagram-34T5L4WZ-Be9oCSza.js +7 -0
  84. package/dist/assets/radar-PYXPWWZC-CsdZBH3M.js +1 -0
  85. package/dist/assets/requirementDiagram-MS252O5E-8ECT7dEs.js +84 -0
  86. package/dist/assets/rough.esm-BoTisKeL.js +1 -0
  87. package/dist/assets/sankeyDiagram-XADWPNL6-CoKpeJJ0.js +10 -0
  88. package/dist/assets/sequenceDiagram-FGHM5R23-BTT2fFxG.js +157 -0
  89. package/dist/assets/src-CrmkjRpa.js +1 -0
  90. package/dist/assets/stateDiagram-FHFEXIEX-CIF47NYe.js +1 -0
  91. package/dist/assets/stateDiagram-v2-QKLJ7IA2-Cy1rmPfG.js +1 -0
  92. package/dist/assets/timeline-definition-GMOUNBTQ-Bes4B58n.js +120 -0
  93. package/dist/assets/treeView-SZITEDCU-DPKseaET.js +1 -0
  94. package/dist/assets/treemap-W4RFUUIX-DH-7GZe_.js +1 -0
  95. package/dist/assets/vennDiagram-DHZGUBPP-3wx2huKk.js +34 -0
  96. package/dist/assets/wardley-RL74JXVD-AgyXyBN5.js +1 -0
  97. package/dist/assets/wardleyDiagram-NUSXRM2D-DzViT1Yx.js +20 -0
  98. package/dist/assets/xychartDiagram-5P7HB3ND-BO_dbU0r.js +7 -0
  99. package/{index.html → dist/index.html} +2 -1
  100. package/dist/index.js +2625 -0
  101. package/package.json +11 -1
  102. package/.agents/skills/remotion-best-practices/SKILL.md +0 -61
  103. package/.agents/skills/remotion-best-practices/rules/3d.md +0 -86
  104. package/.agents/skills/remotion-best-practices/rules/animations.md +0 -27
  105. package/.agents/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +0 -178
  106. package/.agents/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +0 -100
  107. package/.agents/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +0 -108
  108. package/.agents/skills/remotion-best-practices/rules/assets.md +0 -78
  109. package/.agents/skills/remotion-best-practices/rules/audio-visualization.md +0 -198
  110. package/.agents/skills/remotion-best-practices/rules/audio.md +0 -169
  111. package/.agents/skills/remotion-best-practices/rules/calculate-metadata.md +0 -134
  112. package/.agents/skills/remotion-best-practices/rules/can-decode.md +0 -75
  113. package/.agents/skills/remotion-best-practices/rules/charts.md +0 -120
  114. package/.agents/skills/remotion-best-practices/rules/compositions.md +0 -154
  115. package/.agents/skills/remotion-best-practices/rules/display-captions.md +0 -184
  116. package/.agents/skills/remotion-best-practices/rules/extract-frames.md +0 -229
  117. package/.agents/skills/remotion-best-practices/rules/ffmpeg.md +0 -38
  118. package/.agents/skills/remotion-best-practices/rules/fonts.md +0 -152
  119. package/.agents/skills/remotion-best-practices/rules/get-audio-duration.md +0 -58
  120. package/.agents/skills/remotion-best-practices/rules/get-video-dimensions.md +0 -68
  121. package/.agents/skills/remotion-best-practices/rules/get-video-duration.md +0 -60
  122. package/.agents/skills/remotion-best-practices/rules/gifs.md +0 -141
  123. package/.agents/skills/remotion-best-practices/rules/images.md +0 -134
  124. package/.agents/skills/remotion-best-practices/rules/import-srt-captions.md +0 -69
  125. package/.agents/skills/remotion-best-practices/rules/light-leaks.md +0 -73
  126. package/.agents/skills/remotion-best-practices/rules/lottie.md +0 -70
  127. package/.agents/skills/remotion-best-practices/rules/maps.md +0 -412
  128. package/.agents/skills/remotion-best-practices/rules/measuring-dom-nodes.md +0 -34
  129. package/.agents/skills/remotion-best-practices/rules/measuring-text.md +0 -140
  130. package/.agents/skills/remotion-best-practices/rules/parameters.md +0 -109
  131. package/.agents/skills/remotion-best-practices/rules/sequencing.md +0 -118
  132. package/.agents/skills/remotion-best-practices/rules/sfx.md +0 -26
  133. package/.agents/skills/remotion-best-practices/rules/subtitles.md +0 -36
  134. package/.agents/skills/remotion-best-practices/rules/tailwind.md +0 -11
  135. package/.agents/skills/remotion-best-practices/rules/text-animations.md +0 -20
  136. package/.agents/skills/remotion-best-practices/rules/timing.md +0 -179
  137. package/.agents/skills/remotion-best-practices/rules/transcribe-captions.md +0 -70
  138. package/.agents/skills/remotion-best-practices/rules/transitions.md +0 -197
  139. package/.agents/skills/remotion-best-practices/rules/transparent-videos.md +0 -106
  140. package/.agents/skills/remotion-best-practices/rules/trimming.md +0 -51
  141. package/.agents/skills/remotion-best-practices/rules/videos.md +0 -171
  142. package/.agents/skills/remotion-best-practices/rules/voiceover.md +0 -99
  143. package/.agents/skills/simple/SKILL.md +0 -52
  144. package/.agents/skills/vercel-react-best-practices/AGENTS.md +0 -3254
  145. package/.agents/skills/vercel-react-best-practices/README.md +0 -123
  146. package/.agents/skills/vercel-react-best-practices/SKILL.md +0 -141
  147. package/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
  148. package/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +0 -42
  149. package/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +0 -39
  150. package/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +0 -38
  151. package/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +0 -80
  152. package/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +0 -51
  153. package/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +0 -28
  154. package/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
  155. package/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -59
  156. package/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
  157. package/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
  158. package/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
  159. package/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +0 -50
  160. package/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
  161. package/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
  162. package/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
  163. package/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
  164. package/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -107
  165. package/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
  166. package/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
  167. package/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
  168. package/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
  169. package/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +0 -50
  170. package/.agents/skills/vercel-react-best-practices/rules/js-flatmap-filter.md +0 -60
  171. package/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
  172. package/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +0 -37
  173. package/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
  174. package/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
  175. package/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
  176. package/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
  177. package/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +0 -26
  178. package/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
  179. package/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
  180. package/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
  181. package/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
  182. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
  183. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +0 -30
  184. package/.agents/skills/vercel-react-best-practices/rules/rendering-resource-hints.md +0 -85
  185. package/.agents/skills/vercel-react-best-practices/rules/rendering-script-defer-async.md +0 -68
  186. package/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
  187. package/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +0 -75
  188. package/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
  189. package/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
  190. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
  191. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
  192. package/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
  193. package/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
  194. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +0 -38
  195. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +0 -44
  196. package/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +0 -45
  197. package/.agents/skills/vercel-react-best-practices/rules/rerender-no-inline-components.md +0 -82
  198. package/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
  199. package/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
  200. package/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
  201. package/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
  202. package/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +0 -96
  203. package/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
  204. package/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +0 -76
  205. package/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +0 -65
  206. package/.agents/skills/vercel-react-best-practices/rules/server-hoist-static-io.md +0 -142
  207. package/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
  208. package/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +0 -38
  209. package/.claude/CLAUDE.md +0 -184
  210. package/.claude/commands/review.md +0 -120
  211. package/.claude/commands/sync-docs.md +0 -71
  212. package/.claude/roadmap.md +0 -121
  213. package/.claude/rules/style-guide.md +0 -830
  214. package/.claude/settings.json +0 -18
  215. package/.claude/user-stories.md +0 -333
  216. package/AGENTS.md +0 -68
  217. package/Makefile +0 -32
  218. package/biome.json +0 -79
  219. package/bun.lock +0 -854
  220. package/bunfig.toml +0 -2
  221. package/docs/design.md +0 -563
  222. package/docs/perf-baseline.md +0 -130
  223. package/docs/plans/2026-03-13-client-mode-design.md +0 -86
  224. package/docs/plans/2026-03-13-client-mode-plan.md +0 -605
  225. package/docs/plans/2026-03-13-keyboard-shortcuts-design.md +0 -129
  226. package/docs/plans/2026-03-13-keyboard-shortcuts-plan.md +0 -1471
  227. package/docs/plans/2026-03-13-multi-document-design.md +0 -183
  228. package/docs/plans/2026-03-13-performance-benchmarks-design.md +0 -121
  229. package/docs/superpowers/plans/2026-03-26-surgical-pruning.md +0 -1176
  230. package/docs/superpowers/specs/2026-03-27-go-server-rewrite-design.md +0 -284
  231. package/e2e/comments.spec.ts +0 -81
  232. package/e2e/document-load.spec.ts +0 -32
  233. package/e2e/export.spec.ts +0 -58
  234. package/e2e/fixtures/sample.md +0 -7
  235. package/e2e/perf/add-comment.spec.ts +0 -116
  236. package/e2e/perf/fixtures/generate.ts +0 -327
  237. package/e2e/perf/initial-load.spec.ts +0 -49
  238. package/e2e/perf/perf.setup.ts +0 -23
  239. package/e2e/perf/perf.teardown.ts +0 -9
  240. package/e2e/perf/screenshot-final.png +0 -0
  241. package/e2e/perf/scroll.spec.ts +0 -39
  242. package/e2e/perf/tab-switch.spec.ts +0 -69
  243. package/e2e/perf/text-selection.spec.ts +0 -119
  244. package/e2e/perf/utils/metrics.ts +0 -350
  245. package/e2e/perf/utils/perf-cli.ts +0 -86
  246. package/e2e/persistence-file.spec.ts +0 -357
  247. package/e2e/utils/cli.ts +0 -84
  248. package/e2e/utils/selection.ts +0 -79
  249. package/go/cmd/readit/main.go +0 -416
  250. package/go/go.mod +0 -20
  251. package/go/go.sum +0 -41
  252. package/go/internal/server/anchor.go +0 -302
  253. package/go/internal/server/anchor_test.go +0 -111
  254. package/go/internal/server/comments.go +0 -390
  255. package/go/internal/server/documents.go +0 -113
  256. package/go/internal/server/embed.go +0 -17
  257. package/go/internal/server/headings.go +0 -33
  258. package/go/internal/server/headings_test.go +0 -75
  259. package/go/internal/server/htmltext.go +0 -123
  260. package/go/internal/server/markdown.go +0 -157
  261. package/go/internal/server/markdown_bench_test.go +0 -42
  262. package/go/internal/server/markdown_test.go +0 -79
  263. package/go/internal/server/server.go +0 -453
  264. package/go/internal/server/server_bench_test.go +0 -122
  265. package/go/internal/server/settings.go +0 -110
  266. package/go/internal/server/sse.go +0 -140
  267. package/go/internal/server/storage.go +0 -275
  268. package/go/internal/server/storage_test.go +0 -152
  269. package/go/internal/server/template.go +0 -66
  270. package/go/internal/server/types.go +0 -101
  271. package/go/internal/server/watcher.go +0 -74
  272. package/lefthook.yml +0 -8
  273. package/nvim-readit/lua/readit/health.lua +0 -64
  274. package/nvim-readit/lua/readit/init.lua +0 -463
  275. package/nvim-readit/plugin/readit.lua +0 -19
  276. package/playwright.config.ts +0 -34
  277. package/skills-lock.json +0 -20
  278. package/src/App.svelte +0 -890
  279. package/src/cli.ts +0 -881
  280. package/src/components/ActionsMenu.svelte +0 -95
  281. package/src/components/CommentBadge.svelte +0 -67
  282. package/src/components/CommentErrorBanner.svelte +0 -33
  283. package/src/components/CommentInput.svelte +0 -75
  284. package/src/components/CommentListItem.svelte +0 -95
  285. package/src/components/CommentManager.svelte +0 -129
  286. package/src/components/CommentNav.svelte +0 -109
  287. package/src/components/DocumentViewer.svelte +0 -233
  288. package/src/components/FloatingComment.svelte +0 -107
  289. package/src/components/Header.svelte +0 -76
  290. package/src/components/InlineEditor.svelte +0 -72
  291. package/src/components/MarginNote.svelte +0 -167
  292. package/src/components/MarginNotesContainer.svelte +0 -33
  293. package/src/components/MermaidEnhancer.svelte +0 -218
  294. package/src/components/MermaidModal.svelte +0 -67
  295. package/src/components/RawModal.svelte +0 -126
  296. package/src/components/ReanchorConfirm.svelte +0 -30
  297. package/src/components/SettingsModal.svelte +0 -220
  298. package/src/components/ShortcutCapture.svelte +0 -82
  299. package/src/components/ShortcutList.svelte +0 -145
  300. package/src/components/TabBar.svelte +0 -52
  301. package/src/components/TableOfContents.svelte +0 -125
  302. package/src/components/ui/ActionLink.svelte +0 -40
  303. package/src/components/ui/Button.svelte +0 -53
  304. package/src/components/ui/Dialog.svelte +0 -97
  305. package/src/components/ui/DropdownMenu.svelte +0 -85
  306. package/src/components/ui/DropdownMenuItem.svelte +0 -38
  307. package/src/components/ui/DropdownMenuSeparator.svelte +0 -11
  308. package/src/components/ui/Text.svelte +0 -42
  309. package/src/env.d.ts +0 -6
  310. package/src/index.css +0 -859
  311. package/src/lib/__fixtures__/bench-data.ts +0 -114
  312. package/src/lib/anchor.bench.ts +0 -91
  313. package/src/lib/anchor.test.ts +0 -527
  314. package/src/lib/anchor.ts +0 -381
  315. package/src/lib/comment-storage.bench.ts +0 -49
  316. package/src/lib/comment-storage.test.ts +0 -694
  317. package/src/lib/comment-storage.ts +0 -226
  318. package/src/lib/export.bench.ts +0 -21
  319. package/src/lib/export.ts +0 -36
  320. package/src/lib/fetch-or-throw.test.ts +0 -59
  321. package/src/lib/fetch-or-throw.ts +0 -12
  322. package/src/lib/headings.test.ts +0 -103
  323. package/src/lib/headings.ts +0 -44
  324. package/src/lib/highlight/core.test.ts +0 -93
  325. package/src/lib/highlight/dom.ts +0 -187
  326. package/src/lib/highlight/highlight-registry.ts +0 -221
  327. package/src/lib/highlight/highlight.bench.ts +0 -92
  328. package/src/lib/highlight/highlighter.ts +0 -247
  329. package/src/lib/highlight/resolver.ts +0 -38
  330. package/src/lib/highlight/types.ts +0 -17
  331. package/src/lib/html-text.test.ts +0 -162
  332. package/src/lib/html-text.ts +0 -161
  333. package/src/lib/i18n/en.ts +0 -124
  334. package/src/lib/i18n/index.ts +0 -3
  335. package/src/lib/i18n/ja.ts +0 -126
  336. package/src/lib/i18n/translations.ts +0 -27
  337. package/src/lib/i18n/types.ts +0 -130
  338. package/src/lib/key-lock.test.ts +0 -104
  339. package/src/lib/key-lock.ts +0 -23
  340. package/src/lib/margin-layout.bench.ts +0 -61
  341. package/src/lib/margin-layout.ts +0 -71
  342. package/src/lib/markdown-renderer.test.ts +0 -154
  343. package/src/lib/markdown-renderer.ts +0 -178
  344. package/src/lib/mermaid-config.ts +0 -38
  345. package/src/lib/mermaid-renderer.ts +0 -162
  346. package/src/lib/mermaid-worker.ts +0 -60
  347. package/src/lib/positions.ts +0 -157
  348. package/src/lib/shortcut-registry.ts +0 -244
  349. package/src/lib/utils.ts +0 -15
  350. package/src/main.ts +0 -16
  351. package/src/schema.ts +0 -92
  352. package/src/server.ts +0 -1216
  353. package/src/stores/app.svelte.ts +0 -231
  354. package/src/stores/locale.svelte.ts +0 -46
  355. package/src/stores/settings.svelte.ts +0 -90
  356. package/src/stores/shortcuts.svelte.ts +0 -104
  357. package/src/stores/ui.svelte.ts +0 -12
  358. package/src/template.ts +0 -104
  359. package/src/test-setup.ts +0 -48
  360. package/svelte.config.js +0 -5
  361. package/test.md +0 -74
  362. package/tsconfig.cli.json +0 -12
  363. package/tsconfig.json +0 -20
  364. package/vite.config.ts +0 -47
  365. package/vitest.config.ts +0 -15
  366. package/vscode-readit/.mcp.json +0 -7
  367. package/vscode-readit/.vscodeignore +0 -7
  368. package/vscode-readit/bun.lock +0 -78
  369. package/vscode-readit/icon.svg +0 -10
  370. package/vscode-readit/package.json +0 -110
  371. package/vscode-readit/src/extension.ts +0 -117
  372. package/vscode-readit/src/server-manager.ts +0 -272
  373. package/vscode-readit/src/webview-provider.ts +0 -204
  374. package/vscode-readit/tsconfig.json +0 -20
@@ -1,124 +0,0 @@
1
- import type { Translations } from "./types";
2
-
3
- export const en: Translations = {
4
- // App
5
- "app.loading": "Loading...",
6
- "app.noDocuments": "No documents open.",
7
- "app.noDocumentsHintPrefix": "Run",
8
- "app.noDocumentsHintSuffix": "to add a file.",
9
- "app.footer": "Made with ❤️ by Jay and Claude",
10
-
11
- // Header
12
- "header.selectTextToReanchor": "Select text to re-anchor",
13
-
14
- // Actions menu
15
- "actions.ariaLabel": "Actions menu",
16
- "actions.settings": "Settings",
17
- "actions.reload": "Reload",
18
- "actions.copyAll": "Copy All",
19
- "actions.exportJson": "Export JSON",
20
- "actions.viewRaw": "View Raw",
21
-
22
- // Settings
23
- "settings.title": "Settings",
24
- "settings.theme": "Theme",
25
- "settings.font": "Font",
26
- "settings.language": "Language",
27
- "settings.theme.system": "System",
28
- "settings.theme.light": "Light",
29
- "settings.theme.dark": "Dark",
30
- "settings.font.serif": "Serif",
31
- "settings.font.sansSerif": "Sans-serif",
32
-
33
- // Comment input
34
- "comment.placeholder": "Add your comment...",
35
- "comment.cancel": "Cancel",
36
- "comment.addNote": "Add Note",
37
- "comment.highlight": "Highlight",
38
-
39
- // Margin note
40
- "marginNote.addNote": "Add note",
41
- "marginNote.delete": "Delete",
42
- "marginNote.edit": "Edit",
43
- "marginNote.copy": "Copy",
44
-
45
- // Comment manager
46
- "commentManager.unresolved": "unresolved",
47
- "commentManager.deleteAllConfirm": "Delete all {{count}} comments?",
48
- "commentManager.delete": "Delete",
49
- "commentManager.cancel": "Cancel",
50
- "commentManager.copyAllTitle": "Copy all comments",
51
- "commentManager.deleteAllTitle": "Delete all comments",
52
- "commentManager.noComments": "No comments yet",
53
-
54
- // Comment list item
55
- "commentList.edit": "Edit",
56
- "commentList.delete": "Delete",
57
- "commentList.goTo": "Go to",
58
- "commentList.reanchor": "Re-anchor",
59
- "commentList.unresolved": "unresolved",
60
-
61
- // Comment nav
62
- "commentNav.previous": "Previous comment (Alt+↑)",
63
- "commentNav.next": "Next comment (Alt+↓)",
64
- "commentNav.of": "{{current}} of {{total}}",
65
-
66
- // Inline editor
67
- "editor.save": "Save",
68
- "editor.cancel": "Cancel",
69
-
70
- // Reanchor confirm
71
- "reanchor.question": "Re-anchor to this selection?",
72
- "reanchor.confirm": "Confirm",
73
- "reanchor.cancel": "Cancel",
74
-
75
- // Raw comments modal
76
- "rawModal.title": "Raw Comments",
77
- "rawModal.copyTitle": "Copy to clipboard",
78
- "rawModal.loading": "Loading...",
79
- "rawModal.noComments": "No comments file yet. Add comments to create one.",
80
- "rawModal.copiedToClipboard": "Copied to clipboard",
81
- "rawModal.failedToCopy": "Failed to copy",
82
-
83
- // Toast messages
84
- "toast.copied": 'Copied: "{{text}}"',
85
- "toast.copiedAllComments": "Copied all comments",
86
-
87
- // Comment badge
88
- "commentBadge.title": "{{count}} comment",
89
- "commentBadge.titlePlural": "{{count}} comments",
90
-
91
- // Keyboard shortcuts
92
- "shortcuts.title": "Keyboard Shortcuts",
93
- "shortcutGroup.copy": "Copy",
94
- "shortcutGroup.navigate": "Navigate",
95
- "shortcutGroup.other": "Other",
96
- "shortcuts.resetToDefaults": "Reset to defaults",
97
- "shortcuts.enableDisable": "Enable/disable shortcut",
98
- "shortcutCapture.pressKeys": "Press keys...",
99
- "shortcutCapture.reserved": "{{binding}} is reserved",
100
- "shortcutCapture.ariaLabel": "Press a key combination",
101
- "shortcut.copyAll.label": "Copy All (AI)",
102
- "shortcut.copyAll.description": "Copy all comments in AI prompt format",
103
- "shortcut.copyAllRaw.label": "Copy All (Raw)",
104
- "shortcut.copyAllRaw.description": "Copy all comments as raw text",
105
- "shortcut.navigateNext.label": "Next Comment",
106
- "shortcut.navigateNext.description": "Navigate to next comment",
107
- "shortcut.navigatePrevious.label": "Previous Comment",
108
- "shortcut.navigatePrevious.description": "Navigate to previous comment",
109
- "shortcut.copySelectionRaw.label": "Copy Selection",
110
- "shortcut.copySelectionRaw.description": "Copy selected text",
111
- "shortcut.copySelectionLLM.label": "Copy Selection (LLM)",
112
- "shortcut.copySelectionLLM.description":
113
- "Copy selected text with context for LLM",
114
- "shortcut.clearSelection.label": "Clear Selection",
115
- "shortcut.clearSelection.description": "Clear text selection",
116
-
117
- // Mermaid diagram
118
- "mermaid.modalTitle": "Mermaid diagram",
119
- "mermaid.viewGraph": "Graph",
120
- "mermaid.viewCode": "Code",
121
- "mermaid.showSource": "Show source",
122
- "mermaid.showDiagram": "Show diagram",
123
- "mermaid.expand": "Expand diagram",
124
- };
@@ -1,3 +0,0 @@
1
- export { createT } from "./translations";
2
- export type { Locale, TranslationKey } from "./types";
3
- export { Locales } from "./types";
@@ -1,126 +0,0 @@
1
- import type { Translations } from "./types";
2
-
3
- export const ja: Translations = {
4
- // App
5
- "app.loading": "読み込み中...",
6
- "app.noDocuments": "開いているドキュメントがありません。",
7
- "app.noDocumentsHintPrefix": "",
8
- "app.noDocumentsHintSuffix": "を実行してファイルを追加してください。",
9
- "app.footer": "Made with ❤️ by Jay and Claude",
10
-
11
- // Header
12
- "header.selectTextToReanchor": "テキストを選択して再アンカー",
13
-
14
- // Actions menu
15
- "actions.ariaLabel": "操作メニュー",
16
- "actions.settings": "設定",
17
- "actions.reload": "再読み込み",
18
- "actions.copyAll": "全てコピー",
19
- "actions.exportJson": "JSONエクスポート",
20
- "actions.viewRaw": "生データを表示",
21
-
22
- // Settings
23
- "settings.title": "設定",
24
- "settings.theme": "テーマ",
25
- "settings.font": "フォント",
26
- "settings.language": "言語",
27
- "settings.theme.system": "システム",
28
- "settings.theme.light": "ライト",
29
- "settings.theme.dark": "ダーク",
30
- "settings.font.serif": "明朝体",
31
- "settings.font.sansSerif": "ゴシック体",
32
-
33
- // Comment input
34
- "comment.placeholder": "コメントを入力...",
35
- "comment.cancel": "キャンセル",
36
- "comment.addNote": "メモを追加",
37
- "comment.highlight": "ハイライト",
38
-
39
- // Margin note
40
- "marginNote.addNote": "メモを追加",
41
- "marginNote.delete": "削除",
42
- "marginNote.edit": "編集",
43
- "marginNote.copy": "コピー",
44
-
45
- // Comment manager
46
- "commentManager.unresolved": "未解決",
47
- "commentManager.deleteAllConfirm":
48
- "{{count}}件のコメントを全て削除しますか?",
49
- "commentManager.delete": "削除",
50
- "commentManager.cancel": "キャンセル",
51
- "commentManager.copyAllTitle": "全てのコメントをコピー",
52
- "commentManager.deleteAllTitle": "全てのコメントを削除",
53
- "commentManager.noComments": "コメントはまだありません",
54
-
55
- // Comment list item
56
- "commentList.edit": "編集",
57
- "commentList.delete": "削除",
58
- "commentList.goTo": "移動",
59
- "commentList.reanchor": "再アンカー",
60
- "commentList.unresolved": "未解決",
61
-
62
- // Comment nav
63
- "commentNav.previous": "前のコメント (Alt+↑)",
64
- "commentNav.next": "次のコメント (Alt+↓)",
65
- "commentNav.of": "{{current}} / {{total}}",
66
-
67
- // Inline editor
68
- "editor.save": "保存",
69
- "editor.cancel": "キャンセル",
70
-
71
- // Reanchor confirm
72
- "reanchor.question": "この選択範囲に再アンカーしますか?",
73
- "reanchor.confirm": "確認",
74
- "reanchor.cancel": "キャンセル",
75
-
76
- // Raw comments modal
77
- "rawModal.title": "コメント生データ",
78
- "rawModal.copyTitle": "クリップボードにコピー",
79
- "rawModal.loading": "読み込み中...",
80
- "rawModal.noComments":
81
- "コメントファイルはまだありません。コメントを追加して作成してください。",
82
- "rawModal.copiedToClipboard": "クリップボードにコピーしました",
83
- "rawModal.failedToCopy": "コピーに失敗しました",
84
-
85
- // Toast messages
86
- "toast.copied": 'コピーしました: "{{text}}"',
87
- "toast.copiedAllComments": "全てのコメントをコピーしました",
88
-
89
- // Comment badge
90
- "commentBadge.title": "{{count}}件のコメント",
91
- "commentBadge.titlePlural": "{{count}}件のコメント",
92
-
93
- // Keyboard shortcuts
94
- "shortcuts.title": "キーボードショートカット",
95
- "shortcutGroup.copy": "コピー",
96
- "shortcutGroup.navigate": "ナビゲーション",
97
- "shortcutGroup.other": "その他",
98
- "shortcuts.resetToDefaults": "初期設定に戻す",
99
- "shortcuts.enableDisable": "ショートカットの有効/無効",
100
- "shortcutCapture.pressKeys": "キーを入力...",
101
- "shortcutCapture.reserved": "{{binding}} は予約されています",
102
- "shortcutCapture.ariaLabel": "キーの組み合わせを入力",
103
- "shortcut.copyAll.label": "全てコピー (AI)",
104
- "shortcut.copyAll.description": "全コメントをAIプロンプト形式でコピー",
105
- "shortcut.copyAllRaw.label": "全てコピー (テキスト)",
106
- "shortcut.copyAllRaw.description": "全コメントをテキストとしてコピー",
107
- "shortcut.navigateNext.label": "次のコメント",
108
- "shortcut.navigateNext.description": "次のコメントに移動",
109
- "shortcut.navigatePrevious.label": "前のコメント",
110
- "shortcut.navigatePrevious.description": "前のコメントに移動",
111
- "shortcut.copySelectionRaw.label": "選択をコピー",
112
- "shortcut.copySelectionRaw.description": "選択テキストをコピー",
113
- "shortcut.copySelectionLLM.label": "選択をコピー (LLM)",
114
- "shortcut.copySelectionLLM.description":
115
- "選択テキストをLLMコンテキスト付きでコピー",
116
- "shortcut.clearSelection.label": "選択を解除",
117
- "shortcut.clearSelection.description": "テキスト選択を解除",
118
-
119
- // Mermaid diagram
120
- "mermaid.modalTitle": "Mermaid ダイアグラム",
121
- "mermaid.viewGraph": "図",
122
- "mermaid.viewCode": "コード",
123
- "mermaid.showSource": "ソースを表示",
124
- "mermaid.showDiagram": "図を表示",
125
- "mermaid.expand": "拡大表示",
126
- };
@@ -1,27 +0,0 @@
1
- import { en } from "./en";
2
- import { ja } from "./ja";
3
- import type { Locale, TranslationKey, Translations } from "./types";
4
- import { Locales } from "./types";
5
-
6
- const translationMap: Record<Locale, Translations> = {
7
- [Locales.JA]: ja,
8
- [Locales.EN]: en,
9
- };
10
-
11
- export function createT(locale: Locale) {
12
- const translations = translationMap[locale];
13
-
14
- return function t(
15
- key: TranslationKey,
16
- params?: Record<string, string | number>,
17
- ): string {
18
- let value = translations[key];
19
- if (!params) return value;
20
-
21
- for (const [param, replacement] of Object.entries(params)) {
22
- value = value.replaceAll(`{{${param}}}`, String(replacement));
23
- }
24
-
25
- return value;
26
- };
27
- }
@@ -1,130 +0,0 @@
1
- export const Locales = {
2
- JA: "ja",
3
- EN: "en",
4
- } as const;
5
-
6
- export type Locale = (typeof Locales)[keyof typeof Locales];
7
-
8
- export interface Translations {
9
- // App
10
- "app.loading": string;
11
- "app.noDocuments": string;
12
- "app.noDocumentsHintPrefix": string;
13
- "app.noDocumentsHintSuffix": string;
14
- "app.footer": string;
15
-
16
- // Header
17
- "header.selectTextToReanchor": string;
18
-
19
- // Actions menu
20
- "actions.ariaLabel": string;
21
- "actions.settings": string;
22
- "actions.reload": string;
23
- "actions.copyAll": string;
24
- "actions.exportJson": string;
25
- "actions.viewRaw": string;
26
-
27
- // Settings
28
- "settings.title": string;
29
- "settings.theme": string;
30
- "settings.font": string;
31
- "settings.language": string;
32
- "settings.theme.system": string;
33
- "settings.theme.light": string;
34
- "settings.theme.dark": string;
35
- "settings.font.serif": string;
36
- "settings.font.sansSerif": string;
37
-
38
- // Comment input
39
- "comment.placeholder": string;
40
- "comment.cancel": string;
41
- "comment.addNote": string;
42
- "comment.highlight": string;
43
-
44
- // Margin note
45
- "marginNote.addNote": string;
46
- "marginNote.delete": string;
47
- "marginNote.edit": string;
48
- "marginNote.copy": string;
49
-
50
- // Comment manager
51
- "commentManager.unresolved": string;
52
- "commentManager.deleteAllConfirm": string;
53
- "commentManager.delete": string;
54
- "commentManager.cancel": string;
55
- "commentManager.copyAllTitle": string;
56
- "commentManager.deleteAllTitle": string;
57
- "commentManager.noComments": string;
58
-
59
- // Comment list item
60
- "commentList.edit": string;
61
- "commentList.delete": string;
62
- "commentList.goTo": string;
63
- "commentList.reanchor": string;
64
- "commentList.unresolved": string;
65
-
66
- // Comment nav
67
- "commentNav.previous": string;
68
- "commentNav.next": string;
69
- "commentNav.of": string;
70
-
71
- // Inline editor
72
- "editor.save": string;
73
- "editor.cancel": string;
74
-
75
- // Reanchor confirm
76
- "reanchor.question": string;
77
- "reanchor.confirm": string;
78
- "reanchor.cancel": string;
79
-
80
- // Raw comments modal
81
- "rawModal.title": string;
82
- "rawModal.copyTitle": string;
83
- "rawModal.loading": string;
84
- "rawModal.noComments": string;
85
- "rawModal.copiedToClipboard": string;
86
- "rawModal.failedToCopy": string;
87
-
88
- // Toast messages
89
- "toast.copied": string;
90
- "toast.copiedAllComments": string;
91
-
92
- // Comment badge
93
- "commentBadge.title": string;
94
- "commentBadge.titlePlural": string;
95
-
96
- // Keyboard shortcuts
97
- "shortcuts.title": string;
98
- "shortcutGroup.copy": string;
99
- "shortcutGroup.navigate": string;
100
- "shortcutGroup.other": string;
101
- "shortcuts.resetToDefaults": string;
102
- "shortcuts.enableDisable": string;
103
- "shortcutCapture.pressKeys": string;
104
- "shortcutCapture.reserved": string;
105
- "shortcutCapture.ariaLabel": string;
106
- "shortcut.copyAll.label": string;
107
- "shortcut.copyAll.description": string;
108
- "shortcut.copyAllRaw.label": string;
109
- "shortcut.copyAllRaw.description": string;
110
- "shortcut.navigateNext.label": string;
111
- "shortcut.navigateNext.description": string;
112
- "shortcut.navigatePrevious.label": string;
113
- "shortcut.navigatePrevious.description": string;
114
- "shortcut.copySelectionRaw.label": string;
115
- "shortcut.copySelectionRaw.description": string;
116
- "shortcut.copySelectionLLM.label": string;
117
- "shortcut.copySelectionLLM.description": string;
118
- "shortcut.clearSelection.label": string;
119
- "shortcut.clearSelection.description": string;
120
-
121
- // Mermaid diagram
122
- "mermaid.modalTitle": string;
123
- "mermaid.viewGraph": string;
124
- "mermaid.viewCode": string;
125
- "mermaid.showSource": string;
126
- "mermaid.showDiagram": string;
127
- "mermaid.expand": string;
128
- }
129
-
130
- export type TranslationKey = keyof Translations;
@@ -1,104 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { createKeyLock } from "./key-lock";
3
-
4
- function deferred<T>(): {
5
- promise: Promise<T>;
6
- resolve: (v: T) => void;
7
- reject: (e: unknown) => void;
8
- } {
9
- let resolve!: (v: T) => void;
10
- let reject!: (e: unknown) => void;
11
- const promise = new Promise<T>((res, rej) => {
12
- resolve = res;
13
- reject = rej;
14
- });
15
- return { promise, resolve, reject };
16
- }
17
-
18
- describe("createKeyLock", () => {
19
- it("serializes operations on the same key", async () => {
20
- const withLock = createKeyLock("serial");
21
- const order: number[] = [];
22
- const a = deferred<void>();
23
- const b = deferred<void>();
24
-
25
- const p1 = withLock("k", async () => {
26
- await a.promise;
27
- order.push(1);
28
- });
29
- const p2 = withLock("k", async () => {
30
- await b.promise;
31
- order.push(2);
32
- });
33
-
34
- // p2 must NOT have started yet because p1 hasn't resolved
35
- b.resolve();
36
- await Promise.resolve();
37
- await Promise.resolve();
38
- expect(order).toEqual([]);
39
-
40
- a.resolve();
41
- await p1;
42
- await p2;
43
- expect(order).toEqual([1, 2]);
44
- });
45
-
46
- it("runs different keys concurrently", async () => {
47
- const withLock = createKeyLock("concurrent");
48
- const order: string[] = [];
49
- const a = deferred<void>();
50
-
51
- const p1 = withLock("alpha", async () => {
52
- await a.promise;
53
- order.push("alpha");
54
- });
55
- const p2 = withLock("beta", async () => {
56
- order.push("beta");
57
- });
58
-
59
- await p2;
60
- expect(order).toEqual(["beta"]);
61
-
62
- a.resolve();
63
- await p1;
64
- expect(order).toEqual(["beta", "alpha"]);
65
- });
66
-
67
- it("survives a thrown error in a previous holder", async () => {
68
- const withLock = createKeyLock("error-recovery");
69
- const p1 = withLock("k", async () => {
70
- throw new Error("boom");
71
- });
72
- await expect(p1).rejects.toThrow("boom");
73
-
74
- const p2 = withLock("k", async () => 42);
75
- await expect(p2).resolves.toBe(42);
76
- });
77
-
78
- it("preserves resolved return values", async () => {
79
- const withLock = createKeyLock("return-value");
80
- const v = await withLock("k", async () => "value");
81
- expect(v).toBe("value");
82
- });
83
-
84
- it("namespaces are independent", async () => {
85
- const a = createKeyLock("ns-a");
86
- const b = createKeyLock("ns-b");
87
- const order: string[] = [];
88
- const block = deferred<void>();
89
-
90
- const pa = a("shared-key", async () => {
91
- await block.promise;
92
- order.push("a");
93
- });
94
- const pb = b("shared-key", async () => {
95
- order.push("b");
96
- });
97
-
98
- await pb;
99
- expect(order).toEqual(["b"]);
100
- block.resolve();
101
- await pa;
102
- expect(order).toEqual(["b", "a"]);
103
- });
104
- });
@@ -1,23 +0,0 @@
1
- const locks = new Map<string, Map<string, Promise<unknown>>>();
2
-
3
- function namespace(name: string): Map<string, Promise<unknown>> {
4
- let n = locks.get(name);
5
- if (!n) {
6
- n = new Map();
7
- locks.set(name, n);
8
- }
9
- return n;
10
- }
11
-
12
- export function createKeyLock(name: string) {
13
- const map = namespace(name);
14
- return function withLock<T>(key: string, fn: () => Promise<T>): Promise<T> {
15
- const prev = map.get(key) ?? Promise.resolve();
16
- const next = prev.catch(() => {}).then(fn);
17
- map.set(
18
- key,
19
- next.catch(() => {}),
20
- );
21
- return next;
22
- };
23
- }
@@ -1,61 +0,0 @@
1
- import { bench, describe } from "vitest";
2
- import {
3
- COMMENTS_1,
4
- COMMENTS_10,
5
- COMMENTS_50,
6
- } from "./__fixtures__/bench-data";
7
- import { resolveMarginNotePositions } from "./margin-layout";
8
-
9
- function makeHighlightPositions(
10
- commentIds: string[],
11
- spacing: number,
12
- ): Record<string, number> {
13
- const positions: Record<string, number> = {};
14
- for (let i = 0; i < commentIds.length; i++) {
15
- positions[commentIds[i]] = i * spacing;
16
- }
17
- return positions;
18
- }
19
-
20
- describe("resolveMarginNotePositions — well-spaced", () => {
21
- bench("1 comment", () => {
22
- const ids = COMMENTS_1.map((c) => c.id);
23
- const positions = makeHighlightPositions(ids, 300);
24
- resolveMarginNotePositions(ids, positions, undefined);
25
- });
26
-
27
- bench("10 comments", () => {
28
- const ids = COMMENTS_10.map((c) => c.id);
29
- const positions = makeHighlightPositions(ids, 300);
30
- resolveMarginNotePositions(ids, positions, undefined);
31
- });
32
-
33
- bench("50 comments", () => {
34
- const ids = COMMENTS_50.map((c) => c.id);
35
- const positions = makeHighlightPositions(ids, 300);
36
- resolveMarginNotePositions(ids, positions, undefined);
37
- });
38
- });
39
-
40
- describe("resolveMarginNotePositions — clustered", () => {
41
- bench("10 comments, 10px apart", () => {
42
- const ids = COMMENTS_10.map((c) => c.id);
43
- const positions = makeHighlightPositions(ids, 10);
44
- resolveMarginNotePositions(ids, positions, undefined);
45
- });
46
-
47
- bench("50 comments, 10px apart", () => {
48
- const ids = COMMENTS_50.map((c) => c.id);
49
- const positions = makeHighlightPositions(ids, 10);
50
- resolveMarginNotePositions(ids, positions, undefined);
51
- });
52
- });
53
-
54
- describe("resolveMarginNotePositions — with input zone", () => {
55
- bench("50 comments, input at middle", () => {
56
- const ids = COMMENTS_50.map((c) => c.id);
57
- const positions = makeHighlightPositions(ids, 100);
58
- const midpoint = 25 * 100;
59
- resolveMarginNotePositions(ids, positions, midpoint);
60
- });
61
- });
@@ -1,71 +0,0 @@
1
- const MARGIN_NOTE_MIN_GAP_PX = 150;
2
- const COMMENT_INPUT_HEIGHT_PX = 160;
3
-
4
- interface NotePosition {
5
- commentId: string;
6
- top: number;
7
- }
8
-
9
- export function resolveMarginNotePositions(
10
- commentIds: string[],
11
- highlightPositions: Record<string, number>,
12
- pendingSelectionTop: number | undefined,
13
- ): Map<string, number> {
14
- const positions: NotePosition[] = commentIds
15
- .filter((id) => id in highlightPositions)
16
- .map((id) => ({
17
- commentId: id,
18
- top: highlightPositions[id],
19
- }));
20
-
21
- positions.sort((a, b) => a.top - b.top);
22
-
23
- if (pendingSelectionTop !== null && pendingSelectionTop !== undefined) {
24
- const inputStart = pendingSelectionTop;
25
- const inputEnd = pendingSelectionTop + COMMENT_INPUT_HEIGHT_PX;
26
-
27
- for (const pos of positions) {
28
- const noteBottom = pos.top + MARGIN_NOTE_MIN_GAP_PX;
29
-
30
- const overlaps = noteBottom > inputStart && pos.top < inputEnd;
31
-
32
- if (overlaps) {
33
- if (pos.top < inputStart) {
34
- pos.top = Math.max(0, inputStart - MARGIN_NOTE_MIN_GAP_PX);
35
- } else {
36
- pos.top = inputEnd;
37
- }
38
- }
39
- }
40
- positions.sort((a, b) => a.top - b.top);
41
- }
42
-
43
- const inputStartForOverlap = pendingSelectionTop ?? Infinity;
44
- const inputEndForOverlap =
45
- pendingSelectionTop != null
46
- ? pendingSelectionTop + COMMENT_INPUT_HEIGHT_PX
47
- : Infinity;
48
-
49
- for (let i = positions.length - 2; i >= 0; i--) {
50
- const curr = positions[i];
51
- const next = positions[i + 1];
52
- if (next.top >= inputStartForOverlap) continue;
53
- if (next.top - curr.top < MARGIN_NOTE_MIN_GAP_PX) {
54
- curr.top = Math.max(0, next.top - MARGIN_NOTE_MIN_GAP_PX);
55
- }
56
- }
57
-
58
- for (let i = 1; i < positions.length; i++) {
59
- const prev = positions[i - 1];
60
- const curr = positions[i];
61
- if (curr.top - prev.top < MARGIN_NOTE_MIN_GAP_PX) {
62
- let newTop = prev.top + MARGIN_NOTE_MIN_GAP_PX;
63
- if (newTop >= inputStartForOverlap && newTop < inputEndForOverlap) {
64
- newTop = inputEndForOverlap;
65
- }
66
- curr.top = newTop;
67
- }
68
- }
69
-
70
- return new Map(positions.map((p) => [p.commentId, p.top]));
71
- }