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

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 (373) hide show
  1. package/dist/.vite/manifest.json +1111 -0
  2. package/dist/assets/_basePickBy-BMMA4Tou.js +1 -0
  3. package/dist/assets/_baseUniq-D40qku1I.js +1 -0
  4. package/dist/assets/arc-Ckg65iy8.js +1 -0
  5. package/dist/assets/architecture-YZFGNWBL-Dv3EY0zV.js +1 -0
  6. package/dist/assets/architectureDiagram-Q4EWVU46-ClRss4cm.js +36 -0
  7. package/dist/assets/array-Bjz-wYpJ.js +1 -0
  8. package/dist/assets/blockDiagram-DXYQGD6D-CBcFvoK1.js +132 -0
  9. package/dist/assets/c4Diagram-AHTNJAMY-D4d3ZLam.js +10 -0
  10. package/dist/assets/channel-D9EJxDy_.js +1 -0
  11. package/dist/assets/chunk-2KRD3SAO-DaFfaCGO.js +1 -0
  12. package/dist/assets/chunk-336JU56O-yLEQoF0v.js +2 -0
  13. package/dist/assets/chunk-426QAEUC-Uyzd4wAA.js +1 -0
  14. package/dist/assets/chunk-4BX2VUAB-DRuTD7x5.js +1 -0
  15. package/dist/assets/chunk-4TB4RGXK-3xbpIi_o.js +206 -0
  16. package/dist/assets/chunk-55IACEB6-BExiaAoD.js +1 -0
  17. package/dist/assets/chunk-5FUZZQ4R-DatVvHnF.js +62 -0
  18. package/dist/assets/chunk-5PVQY5BW-BKgvrGh8.js +2 -0
  19. package/dist/assets/chunk-67CJDMHE-DMt8LNEX.js +1 -0
  20. package/dist/assets/chunk-7N4EOEYR-CzLGefVf.js +1 -0
  21. package/dist/assets/chunk-AA7GKIK3-B6GFAk4U.js +1 -0
  22. package/dist/assets/chunk-BSJP7CBP-BK29yehL.js +1 -0
  23. package/dist/assets/chunk-CIAEETIT-D7hBXImP.js +1 -0
  24. package/dist/assets/chunk-Dlc7tRH4.js +1 -0
  25. package/dist/assets/chunk-EDXVE4YY-PYJdlmyH.js +1 -0
  26. package/dist/assets/chunk-ENJZ2VHE-DUHKBv6x.js +10 -0
  27. package/dist/assets/chunk-FMBD7UC4-2FWyCCAV.js +15 -0
  28. package/dist/assets/chunk-FOC6F5B3-DKFHrt4K.js +1 -0
  29. package/dist/assets/chunk-ICPOFSXX-Bh__D0ec.js +122 -0
  30. package/dist/assets/chunk-K5T4RW27-D51O7IkG.js +94 -0
  31. package/dist/assets/chunk-KGLVRYIC-DMHSCH4T.js +1 -0
  32. package/dist/assets/chunk-LIHQZDEY-C2aANxt9.js +1 -0
  33. package/dist/assets/chunk-ORNJ4GCN-Db_37NRX.js +1 -0
  34. package/dist/assets/chunk-OYMX7WX6-BltXOJLJ.js +231 -0
  35. package/dist/assets/chunk-QZHKN3VN-8Lcg9gti.js +1 -0
  36. package/dist/assets/chunk-U2HBQHQK-ByS6tilY.js +70 -0
  37. package/dist/assets/chunk-X2U36JSP-Bm-4Gqg_.js +1 -0
  38. package/dist/assets/chunk-XPW4576I-Bqbompq4.js +32 -0
  39. package/dist/assets/chunk-YZCP3GAM-CsC0imPb.js +1 -0
  40. package/dist/assets/chunk-ZZ45TVLE-CG-CqfPC.js +1 -0
  41. package/dist/assets/classDiagram-6PBFFD2Q-Jy1uFUk4.js +1 -0
  42. package/dist/assets/classDiagram-v2-HSJHXN6E-ChiLl3rR.js +1 -0
  43. package/dist/assets/clone-BBjvuERA.js +1 -0
  44. package/dist/assets/cose-bilkent-S5V4N54A-q90QeGKv.js +1 -0
  45. package/dist/assets/cytoscape.esm-BfXff3fb.js +321 -0
  46. package/dist/assets/dagre-KV5264BT-BQWiLFJB.js +4 -0
  47. package/dist/assets/dagre-nn_aIZ2E.js +1 -0
  48. package/dist/assets/defaultLocale-BwmRmqJp.js +1 -0
  49. package/dist/assets/diagram-5BDNPKRD-CJa7Y97H.js +10 -0
  50. package/dist/assets/diagram-G4DWMVQ6-tVQGBWfY.js +24 -0
  51. package/dist/assets/diagram-MMDJMWI5-CpimFldm.js +43 -0
  52. package/dist/assets/diagram-TYMM5635-D11WQVgy.js +24 -0
  53. package/dist/assets/dist-BNz65Ibc.js +1 -0
  54. package/dist/assets/erDiagram-SMLLAGMA-C2bLd0jS.js +85 -0
  55. package/dist/assets/flowDiagram-DWJPFMVM-Kw3fOOLT.js +162 -0
  56. package/dist/assets/ganttDiagram-T4ZO3ILL-fyMhyE2X.js +292 -0
  57. package/dist/assets/gitGraph-7Q5UKJZL-BGFRt2qs.js +1 -0
  58. package/dist/assets/gitGraphDiagram-UUTBAWPF-D4JoiOvg.js +106 -0
  59. package/dist/assets/graphlib-DGcD9J2L.js +1 -0
  60. package/dist/assets/index-Cow3qpoq.css +2 -0
  61. package/dist/assets/index-DUf7okYi.js +14 -0
  62. package/dist/assets/info-OMHHGYJF-DI6-Z9vh.js +1 -0
  63. package/dist/assets/infoDiagram-42DDH7IO-D1ZkeMBy.js +2 -0
  64. package/dist/assets/init-TPm5RB77.js +1 -0
  65. package/dist/assets/isArrayLikeObject-69BLnVNM.js +1 -0
  66. package/dist/assets/isEmpty-DUS28g5f.js +1 -0
  67. package/dist/assets/ishikawaDiagram-UXIWVN3A-Dv8hzjZB.js +70 -0
  68. package/dist/assets/journeyDiagram-VCZTEJTY-COeB7F5r.js +139 -0
  69. package/dist/assets/kanban-definition-6JOO6SKY-BbYmxCYU.js +89 -0
  70. package/dist/assets/katex-5SGEXwpi.js +261 -0
  71. package/dist/assets/line-_v2NGEdn.js +1 -0
  72. package/dist/assets/linear-CXMqTN8N.js +1 -0
  73. package/dist/assets/mermaid-config-C8a4L22x.js +1 -0
  74. package/dist/assets/mermaid-parser.core-CFmphzPP.js +4 -0
  75. package/dist/assets/mermaid.core-DnHAupTp.js +11 -0
  76. package/dist/assets/mindmap-definition-QFDTVHPH-D7_lIep7.js +96 -0
  77. package/dist/assets/ordinal-D7l-8DAO.js +1 -0
  78. package/dist/assets/packet-4T2RLAQJ-DidW3JFc.js +1 -0
  79. package/dist/assets/path-BVpCanzE.js +1 -0
  80. package/dist/assets/pie-ZZUOXDRM-Bff2e5hg.js +1 -0
  81. package/dist/assets/pieDiagram-DEJITSTG-DDvYHCT_.js +30 -0
  82. package/dist/assets/quadrantDiagram-34T5L4WZ-DcLcIrdi.js +7 -0
  83. package/dist/assets/radar-PYXPWWZC-CsdZBH3M.js +1 -0
  84. package/dist/assets/requirementDiagram-MS252O5E-DLX6ld7D.js +84 -0
  85. package/dist/assets/rough.esm-BoTisKeL.js +1 -0
  86. package/dist/assets/sankeyDiagram-XADWPNL6-D-1GtsHM.js +10 -0
  87. package/dist/assets/sequenceDiagram-FGHM5R23-Bwxs0YQg.js +157 -0
  88. package/dist/assets/src-CrmkjRpa.js +1 -0
  89. package/dist/assets/stateDiagram-FHFEXIEX-DW7rOcnQ.js +1 -0
  90. package/dist/assets/stateDiagram-v2-QKLJ7IA2-Jm-24vQ2.js +1 -0
  91. package/dist/assets/timeline-definition-GMOUNBTQ-DVdHyzxS.js +120 -0
  92. package/dist/assets/treeView-SZITEDCU-DPKseaET.js +1 -0
  93. package/dist/assets/treemap-W4RFUUIX-DH-7GZe_.js +1 -0
  94. package/dist/assets/vennDiagram-DHZGUBPP-DJaC6xmI.js +34 -0
  95. package/dist/assets/wardley-RL74JXVD-AgyXyBN5.js +1 -0
  96. package/dist/assets/wardleyDiagram-NUSXRM2D-CTKERPKv.js +20 -0
  97. package/dist/assets/xychartDiagram-5P7HB3ND-BuExiLXc.js +7 -0
  98. package/{index.html → dist/index.html} +2 -1
  99. package/dist/index.js +2539 -0
  100. package/package.json +11 -1
  101. package/.agents/skills/remotion-best-practices/SKILL.md +0 -61
  102. package/.agents/skills/remotion-best-practices/rules/3d.md +0 -86
  103. package/.agents/skills/remotion-best-practices/rules/animations.md +0 -27
  104. package/.agents/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +0 -178
  105. package/.agents/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +0 -100
  106. package/.agents/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +0 -108
  107. package/.agents/skills/remotion-best-practices/rules/assets.md +0 -78
  108. package/.agents/skills/remotion-best-practices/rules/audio-visualization.md +0 -198
  109. package/.agents/skills/remotion-best-practices/rules/audio.md +0 -169
  110. package/.agents/skills/remotion-best-practices/rules/calculate-metadata.md +0 -134
  111. package/.agents/skills/remotion-best-practices/rules/can-decode.md +0 -75
  112. package/.agents/skills/remotion-best-practices/rules/charts.md +0 -120
  113. package/.agents/skills/remotion-best-practices/rules/compositions.md +0 -154
  114. package/.agents/skills/remotion-best-practices/rules/display-captions.md +0 -184
  115. package/.agents/skills/remotion-best-practices/rules/extract-frames.md +0 -229
  116. package/.agents/skills/remotion-best-practices/rules/ffmpeg.md +0 -38
  117. package/.agents/skills/remotion-best-practices/rules/fonts.md +0 -152
  118. package/.agents/skills/remotion-best-practices/rules/get-audio-duration.md +0 -58
  119. package/.agents/skills/remotion-best-practices/rules/get-video-dimensions.md +0 -68
  120. package/.agents/skills/remotion-best-practices/rules/get-video-duration.md +0 -60
  121. package/.agents/skills/remotion-best-practices/rules/gifs.md +0 -141
  122. package/.agents/skills/remotion-best-practices/rules/images.md +0 -134
  123. package/.agents/skills/remotion-best-practices/rules/import-srt-captions.md +0 -69
  124. package/.agents/skills/remotion-best-practices/rules/light-leaks.md +0 -73
  125. package/.agents/skills/remotion-best-practices/rules/lottie.md +0 -70
  126. package/.agents/skills/remotion-best-practices/rules/maps.md +0 -412
  127. package/.agents/skills/remotion-best-practices/rules/measuring-dom-nodes.md +0 -34
  128. package/.agents/skills/remotion-best-practices/rules/measuring-text.md +0 -140
  129. package/.agents/skills/remotion-best-practices/rules/parameters.md +0 -109
  130. package/.agents/skills/remotion-best-practices/rules/sequencing.md +0 -118
  131. package/.agents/skills/remotion-best-practices/rules/sfx.md +0 -26
  132. package/.agents/skills/remotion-best-practices/rules/subtitles.md +0 -36
  133. package/.agents/skills/remotion-best-practices/rules/tailwind.md +0 -11
  134. package/.agents/skills/remotion-best-practices/rules/text-animations.md +0 -20
  135. package/.agents/skills/remotion-best-practices/rules/timing.md +0 -179
  136. package/.agents/skills/remotion-best-practices/rules/transcribe-captions.md +0 -70
  137. package/.agents/skills/remotion-best-practices/rules/transitions.md +0 -197
  138. package/.agents/skills/remotion-best-practices/rules/transparent-videos.md +0 -106
  139. package/.agents/skills/remotion-best-practices/rules/trimming.md +0 -51
  140. package/.agents/skills/remotion-best-practices/rules/videos.md +0 -171
  141. package/.agents/skills/remotion-best-practices/rules/voiceover.md +0 -99
  142. package/.agents/skills/simple/SKILL.md +0 -52
  143. package/.agents/skills/vercel-react-best-practices/AGENTS.md +0 -3254
  144. package/.agents/skills/vercel-react-best-practices/README.md +0 -123
  145. package/.agents/skills/vercel-react-best-practices/SKILL.md +0 -141
  146. package/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
  147. package/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +0 -42
  148. package/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +0 -39
  149. package/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +0 -38
  150. package/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +0 -80
  151. package/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +0 -51
  152. package/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +0 -28
  153. package/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
  154. package/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -59
  155. package/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
  156. package/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
  157. package/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
  158. package/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +0 -50
  159. package/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
  160. package/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
  161. package/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
  162. package/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
  163. package/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -107
  164. package/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
  165. package/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
  166. package/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
  167. package/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
  168. package/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +0 -50
  169. package/.agents/skills/vercel-react-best-practices/rules/js-flatmap-filter.md +0 -60
  170. package/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
  171. package/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +0 -37
  172. package/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
  173. package/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
  174. package/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
  175. package/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
  176. package/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +0 -26
  177. package/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
  178. package/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
  179. package/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
  180. package/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
  181. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
  182. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +0 -30
  183. package/.agents/skills/vercel-react-best-practices/rules/rendering-resource-hints.md +0 -85
  184. package/.agents/skills/vercel-react-best-practices/rules/rendering-script-defer-async.md +0 -68
  185. package/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
  186. package/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +0 -75
  187. package/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
  188. package/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
  189. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
  190. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
  191. package/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
  192. package/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
  193. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +0 -38
  194. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +0 -44
  195. package/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +0 -45
  196. package/.agents/skills/vercel-react-best-practices/rules/rerender-no-inline-components.md +0 -82
  197. package/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
  198. package/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
  199. package/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
  200. package/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
  201. package/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +0 -96
  202. package/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
  203. package/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +0 -76
  204. package/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +0 -65
  205. package/.agents/skills/vercel-react-best-practices/rules/server-hoist-static-io.md +0 -142
  206. package/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
  207. package/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +0 -38
  208. package/.claude/CLAUDE.md +0 -184
  209. package/.claude/commands/review.md +0 -120
  210. package/.claude/commands/sync-docs.md +0 -71
  211. package/.claude/roadmap.md +0 -121
  212. package/.claude/rules/style-guide.md +0 -830
  213. package/.claude/settings.json +0 -18
  214. package/.claude/user-stories.md +0 -333
  215. package/AGENTS.md +0 -68
  216. package/Makefile +0 -32
  217. package/biome.json +0 -79
  218. package/bun.lock +0 -854
  219. package/bunfig.toml +0 -2
  220. package/docs/design.md +0 -563
  221. package/docs/perf-baseline.md +0 -130
  222. package/docs/plans/2026-03-13-client-mode-design.md +0 -86
  223. package/docs/plans/2026-03-13-client-mode-plan.md +0 -605
  224. package/docs/plans/2026-03-13-keyboard-shortcuts-design.md +0 -129
  225. package/docs/plans/2026-03-13-keyboard-shortcuts-plan.md +0 -1471
  226. package/docs/plans/2026-03-13-multi-document-design.md +0 -183
  227. package/docs/plans/2026-03-13-performance-benchmarks-design.md +0 -121
  228. package/docs/superpowers/plans/2026-03-26-surgical-pruning.md +0 -1176
  229. package/docs/superpowers/specs/2026-03-27-go-server-rewrite-design.md +0 -284
  230. package/e2e/comments.spec.ts +0 -81
  231. package/e2e/document-load.spec.ts +0 -32
  232. package/e2e/export.spec.ts +0 -58
  233. package/e2e/fixtures/sample.md +0 -7
  234. package/e2e/perf/add-comment.spec.ts +0 -116
  235. package/e2e/perf/fixtures/generate.ts +0 -327
  236. package/e2e/perf/initial-load.spec.ts +0 -49
  237. package/e2e/perf/perf.setup.ts +0 -23
  238. package/e2e/perf/perf.teardown.ts +0 -9
  239. package/e2e/perf/screenshot-final.png +0 -0
  240. package/e2e/perf/scroll.spec.ts +0 -39
  241. package/e2e/perf/tab-switch.spec.ts +0 -69
  242. package/e2e/perf/text-selection.spec.ts +0 -119
  243. package/e2e/perf/utils/metrics.ts +0 -350
  244. package/e2e/perf/utils/perf-cli.ts +0 -86
  245. package/e2e/persistence-file.spec.ts +0 -357
  246. package/e2e/utils/cli.ts +0 -84
  247. package/e2e/utils/selection.ts +0 -79
  248. package/go/cmd/readit/main.go +0 -416
  249. package/go/go.mod +0 -20
  250. package/go/go.sum +0 -41
  251. package/go/internal/server/anchor.go +0 -302
  252. package/go/internal/server/anchor_test.go +0 -111
  253. package/go/internal/server/comments.go +0 -390
  254. package/go/internal/server/documents.go +0 -113
  255. package/go/internal/server/embed.go +0 -17
  256. package/go/internal/server/headings.go +0 -33
  257. package/go/internal/server/headings_test.go +0 -75
  258. package/go/internal/server/htmltext.go +0 -123
  259. package/go/internal/server/markdown.go +0 -157
  260. package/go/internal/server/markdown_bench_test.go +0 -42
  261. package/go/internal/server/markdown_test.go +0 -79
  262. package/go/internal/server/server.go +0 -453
  263. package/go/internal/server/server_bench_test.go +0 -122
  264. package/go/internal/server/settings.go +0 -110
  265. package/go/internal/server/sse.go +0 -140
  266. package/go/internal/server/storage.go +0 -275
  267. package/go/internal/server/storage_test.go +0 -152
  268. package/go/internal/server/template.go +0 -66
  269. package/go/internal/server/types.go +0 -101
  270. package/go/internal/server/watcher.go +0 -74
  271. package/lefthook.yml +0 -8
  272. package/nvim-readit/lua/readit/health.lua +0 -64
  273. package/nvim-readit/lua/readit/init.lua +0 -463
  274. package/nvim-readit/plugin/readit.lua +0 -19
  275. package/playwright.config.ts +0 -34
  276. package/skills-lock.json +0 -20
  277. package/src/App.svelte +0 -890
  278. package/src/cli.ts +0 -881
  279. package/src/components/ActionsMenu.svelte +0 -95
  280. package/src/components/CommentBadge.svelte +0 -67
  281. package/src/components/CommentErrorBanner.svelte +0 -33
  282. package/src/components/CommentInput.svelte +0 -75
  283. package/src/components/CommentListItem.svelte +0 -95
  284. package/src/components/CommentManager.svelte +0 -129
  285. package/src/components/CommentNav.svelte +0 -109
  286. package/src/components/DocumentViewer.svelte +0 -233
  287. package/src/components/FloatingComment.svelte +0 -107
  288. package/src/components/Header.svelte +0 -76
  289. package/src/components/InlineEditor.svelte +0 -72
  290. package/src/components/MarginNote.svelte +0 -167
  291. package/src/components/MarginNotesContainer.svelte +0 -33
  292. package/src/components/MermaidEnhancer.svelte +0 -218
  293. package/src/components/MermaidModal.svelte +0 -67
  294. package/src/components/RawModal.svelte +0 -126
  295. package/src/components/ReanchorConfirm.svelte +0 -30
  296. package/src/components/SettingsModal.svelte +0 -220
  297. package/src/components/ShortcutCapture.svelte +0 -82
  298. package/src/components/ShortcutList.svelte +0 -145
  299. package/src/components/TabBar.svelte +0 -52
  300. package/src/components/TableOfContents.svelte +0 -125
  301. package/src/components/ui/ActionLink.svelte +0 -40
  302. package/src/components/ui/Button.svelte +0 -53
  303. package/src/components/ui/Dialog.svelte +0 -97
  304. package/src/components/ui/DropdownMenu.svelte +0 -85
  305. package/src/components/ui/DropdownMenuItem.svelte +0 -38
  306. package/src/components/ui/DropdownMenuSeparator.svelte +0 -11
  307. package/src/components/ui/Text.svelte +0 -42
  308. package/src/env.d.ts +0 -6
  309. package/src/index.css +0 -859
  310. package/src/lib/__fixtures__/bench-data.ts +0 -114
  311. package/src/lib/anchor.bench.ts +0 -91
  312. package/src/lib/anchor.test.ts +0 -527
  313. package/src/lib/anchor.ts +0 -381
  314. package/src/lib/comment-storage.bench.ts +0 -49
  315. package/src/lib/comment-storage.test.ts +0 -694
  316. package/src/lib/comment-storage.ts +0 -226
  317. package/src/lib/export.bench.ts +0 -21
  318. package/src/lib/export.ts +0 -36
  319. package/src/lib/fetch-or-throw.test.ts +0 -59
  320. package/src/lib/fetch-or-throw.ts +0 -12
  321. package/src/lib/headings.test.ts +0 -103
  322. package/src/lib/headings.ts +0 -44
  323. package/src/lib/highlight/core.test.ts +0 -93
  324. package/src/lib/highlight/dom.ts +0 -187
  325. package/src/lib/highlight/highlight-registry.ts +0 -221
  326. package/src/lib/highlight/highlight.bench.ts +0 -92
  327. package/src/lib/highlight/highlighter.ts +0 -247
  328. package/src/lib/highlight/resolver.ts +0 -38
  329. package/src/lib/highlight/types.ts +0 -17
  330. package/src/lib/html-text.test.ts +0 -162
  331. package/src/lib/html-text.ts +0 -161
  332. package/src/lib/i18n/en.ts +0 -124
  333. package/src/lib/i18n/index.ts +0 -3
  334. package/src/lib/i18n/ja.ts +0 -126
  335. package/src/lib/i18n/translations.ts +0 -27
  336. package/src/lib/i18n/types.ts +0 -130
  337. package/src/lib/key-lock.test.ts +0 -104
  338. package/src/lib/key-lock.ts +0 -23
  339. package/src/lib/margin-layout.bench.ts +0 -61
  340. package/src/lib/margin-layout.ts +0 -71
  341. package/src/lib/markdown-renderer.test.ts +0 -154
  342. package/src/lib/markdown-renderer.ts +0 -178
  343. package/src/lib/mermaid-config.ts +0 -38
  344. package/src/lib/mermaid-renderer.ts +0 -162
  345. package/src/lib/mermaid-worker.ts +0 -60
  346. package/src/lib/positions.ts +0 -157
  347. package/src/lib/shortcut-registry.ts +0 -244
  348. package/src/lib/utils.ts +0 -15
  349. package/src/main.ts +0 -16
  350. package/src/schema.ts +0 -92
  351. package/src/server.ts +0 -1216
  352. package/src/stores/app.svelte.ts +0 -231
  353. package/src/stores/locale.svelte.ts +0 -46
  354. package/src/stores/settings.svelte.ts +0 -90
  355. package/src/stores/shortcuts.svelte.ts +0 -104
  356. package/src/stores/ui.svelte.ts +0 -12
  357. package/src/template.ts +0 -104
  358. package/src/test-setup.ts +0 -48
  359. package/svelte.config.js +0 -5
  360. package/test.md +0 -74
  361. package/tsconfig.cli.json +0 -12
  362. package/tsconfig.json +0 -20
  363. package/vite.config.ts +0 -47
  364. package/vitest.config.ts +0 -15
  365. package/vscode-readit/.mcp.json +0 -7
  366. package/vscode-readit/.vscodeignore +0 -7
  367. package/vscode-readit/bun.lock +0 -78
  368. package/vscode-readit/icon.svg +0 -10
  369. package/vscode-readit/package.json +0 -110
  370. package/vscode-readit/src/extension.ts +0 -117
  371. package/vscode-readit/src/server-manager.ts +0 -272
  372. package/vscode-readit/src/webview-provider.ts +0 -204
  373. 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
- }