@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,327 +0,0 @@
1
- import * as crypto from "node:crypto";
2
- import * as fs from "node:fs/promises";
3
- import * as os from "node:os";
4
- import * as path from "node:path";
5
-
6
- // ─── Types ───────────────────────────────────────────────────────────
7
-
8
- interface Comment {
9
- id: string;
10
- selectedText: string;
11
- comment: string;
12
- startOffset: number;
13
- endOffset: number;
14
- lineHint: string;
15
- }
16
-
17
- interface CommentFile {
18
- source: string;
19
- hash: string;
20
- version: number;
21
- comments: Comment[];
22
- }
23
-
24
- export interface Tier {
25
- name: string;
26
- lines: number;
27
- comments: number;
28
- fileName: string;
29
- }
30
-
31
- export const TIERS: Tier[] = [
32
- { name: "medium", lines: 1000, comments: 100, fileName: "medium.md" },
33
- { name: "large", lines: 3000, comments: 200, fileName: "large.md" },
34
- ];
35
-
36
- // Second medium doc for tab-switch tests
37
- export const TAB_SWITCH_TIER: Tier = {
38
- name: "medium-b",
39
- lines: 1000,
40
- comments: 100,
41
- fileName: "medium-b.md",
42
- };
43
-
44
- export const FIXTURES_DIR = path.join(os.tmpdir(), "readit-perf-fixtures");
45
-
46
- // ─── Markdown generation ─────────────────────────────────────────────
47
-
48
- function generateMarkdownDoc(lineCount: number, seed: number): string {
49
- const lines: string[] = [];
50
- lines.push(`# Performance Benchmark Document (seed=${seed})`);
51
- lines.push("");
52
- lines.push(
53
- "This document is auto-generated for performance benchmarking. It contains realistic markdown patterns.",
54
- );
55
- lines.push("");
56
-
57
- let sectionNum = 1;
58
- while (lines.length < lineCount) {
59
- lines.push(`## Section ${sectionNum}: Topic Area ${sectionNum}`);
60
- lines.push("");
61
- lines.push(
62
- `This section covers topic ${sectionNum} in detail. It includes various formatting such as **bold text**, *italic text*, and \`inline code\`. The content is designed to exercise the rendering pipeline.`,
63
- );
64
- lines.push("");
65
-
66
- // Paragraph
67
- lines.push(
68
- `When reviewing documents of this complexity, it is important to consider the performance implications of rendering each element. Section ${sectionNum} demonstrates how the margin notes system handles comments distributed across a long document.`,
69
- );
70
- lines.push("");
71
-
72
- // List
73
- for (let j = 1; j <= 4; j++) {
74
- lines.push(
75
- `- Item ${j} in section ${sectionNum}: a list entry with enough text to be selectable`,
76
- );
77
- }
78
- lines.push("");
79
-
80
- // Code block
81
- lines.push("```typescript");
82
- lines.push(`function processSection${sectionNum}(data: unknown) {`);
83
- lines.push(` const result = validate(data);`);
84
- lines.push(
85
- ` if (!result.ok) throw new Error("Section ${sectionNum} failed");`,
86
- );
87
- lines.push(` return transform(result.value);`);
88
- lines.push("}");
89
- lines.push("```");
90
- lines.push("");
91
-
92
- // Another paragraph
93
- lines.push(
94
- `The conclusion of section ${sectionNum} summarizes the key findings and provides actionable recommendations for the reader. This paragraph exists to ensure sufficient text density for highlight testing.`,
95
- );
96
- lines.push("");
97
-
98
- // Table every 4th section
99
- if (sectionNum % 4 === 0) {
100
- lines.push("| Metric | Before | After | Change |");
101
- lines.push("|--------|--------|-------|--------|");
102
- lines.push(
103
- `| Latency | ${sectionNum * 10}ms | ${sectionNum * 5}ms | -50% |`,
104
- );
105
- lines.push(
106
- `| Throughput | ${sectionNum * 100} | ${sectionNum * 200} | +100% |`,
107
- );
108
- lines.push("");
109
- }
110
-
111
- // Blockquote every 5th section
112
- if (sectionNum % 5 === 0) {
113
- lines.push(
114
- `> Note: Section ${sectionNum} contains important observations about system behavior under load.`,
115
- );
116
- lines.push("");
117
- }
118
-
119
- sectionNum++;
120
- }
121
-
122
- return lines.slice(0, lineCount).join("\n");
123
- }
124
-
125
- // ─── Comment generation ──────────────────────────────────────────────
126
-
127
- function makeComment(
128
- index: number,
129
- doc: string,
130
- totalComments: number,
131
- ): Comment {
132
- const lines = doc.split("\n");
133
-
134
- // Distribute comments evenly across the document, skipping empty lines and headers
135
- const contentLines: { lineIndex: number; text: string }[] = [];
136
- for (let i = 0; i < lines.length; i++) {
137
- const line = lines[i];
138
- if (
139
- line.length > 20 &&
140
- !line.startsWith("#") &&
141
- !line.startsWith("```") &&
142
- !line.startsWith("|") &&
143
- !line.startsWith(">") &&
144
- !line.startsWith("- ")
145
- ) {
146
- contentLines.push({ lineIndex: i, text: line });
147
- }
148
- }
149
-
150
- // Pick a content line for this comment
151
- const targetIdx = Math.floor(
152
- (index / totalComments) * (contentLines.length - 1),
153
- );
154
- const target = contentLines[Math.min(targetIdx, contentLines.length - 1)];
155
-
156
- // Select a substring from the target line
157
- const selectStart = 0;
158
- const selectEnd = Math.min(40, target.text.length);
159
- const selectedText = target.text.slice(selectStart, selectEnd);
160
-
161
- // Compute character offset in the full document
162
- let startOffset = 0;
163
- for (let i = 0; i < target.lineIndex; i++) {
164
- startOffset += lines[i].length + 1; // +1 for \n
165
- }
166
- startOffset += selectStart;
167
- const endOffset = startOffset + selectedText.length;
168
-
169
- // Line hint (1-indexed)
170
- const lineHint = `L${target.lineIndex + 1}`;
171
-
172
- return {
173
- id: `perf${String(index).padStart(4, "0")}`,
174
- selectedText,
175
- comment: `Review comment #${index + 1}: This section needs attention regarding clarity and accuracy.`,
176
- startOffset,
177
- endOffset,
178
- lineHint,
179
- };
180
- }
181
-
182
- // ─── Comment serialization (standalone, no imports from src/) ────────
183
-
184
- function computeHash(content: string): string {
185
- return crypto.createHash("sha256").update(content).digest("hex").slice(0, 16);
186
- }
187
-
188
- function serializeComments(file: CommentFile): string {
189
- const lines: string[] = [];
190
-
191
- lines.push("---");
192
- lines.push(`source: ${file.source}`);
193
- lines.push(`hash: ${file.hash}`);
194
- lines.push(`version: ${file.version}`);
195
- lines.push("---");
196
- lines.push("");
197
-
198
- for (const comment of file.comments) {
199
- // Metadata
200
- lines.push(`<!-- c:${comment.id}|${comment.lineHint} -->`);
201
-
202
- // Selected text as blockquote
203
- const quotedLines = comment.selectedText
204
- .split("\n")
205
- .map((line) => `> ${line}`);
206
- lines.push(...quotedLines);
207
-
208
- // Comment body
209
- if (comment.comment) {
210
- lines.push("");
211
- lines.push(comment.comment);
212
- }
213
-
214
- lines.push("");
215
- lines.push("---");
216
- lines.push("");
217
- }
218
-
219
- return lines.join("\n");
220
- }
221
-
222
- /**
223
- * Compute comment path using realpath to match the server's path resolution.
224
- * The server uses fs.realpath() which resolves symlinks (e.g., /var → /private/var on macOS).
225
- * The sourcePath must exist on disk before calling this.
226
- */
227
- async function getCommentPathReal(sourcePath: string): Promise<string> {
228
- const real = await fs.realpath(path.resolve(sourcePath));
229
- const normalized = real.replace(/^\//, "").replace(/^[A-Z]:[\\/]/, "");
230
- const ext = path.extname(normalized);
231
- const withoutExt = normalized.slice(0, -ext.length || undefined);
232
- return path.join(
233
- os.homedir(),
234
- ".readit",
235
- "comments",
236
- `${withoutExt}.comments.md`,
237
- );
238
- }
239
-
240
- /** Sync version for cleanup (file may not exist) */
241
- function getCommentPathSync(sourcePath: string): string {
242
- let absolute: string;
243
- try {
244
- absolute = require("node:fs").realpathSync(path.resolve(sourcePath));
245
- } catch {
246
- absolute = path.resolve(sourcePath);
247
- }
248
- const normalized = absolute.replace(/^\//, "").replace(/^[A-Z]:[\\/]/, "");
249
- const ext = path.extname(normalized);
250
- const withoutExt = normalized.slice(0, -ext.length || undefined);
251
- return path.join(
252
- os.homedir(),
253
- ".readit",
254
- "comments",
255
- `${withoutExt}.comments.md`,
256
- );
257
- }
258
-
259
- // ─── Public API ──────────────────────────────────────────────────────
260
-
261
- export function getFixturePath(tier: Tier): string {
262
- return path.join(FIXTURES_DIR, tier.fileName);
263
- }
264
-
265
- export async function generateFixtures(): Promise<void> {
266
- await fs.mkdir(FIXTURES_DIR, { recursive: true });
267
-
268
- const allTiers = [...TIERS, TAB_SWITCH_TIER];
269
-
270
- for (const tier of allTiers) {
271
- const doc = generateMarkdownDoc(tier.lines, tier.lines);
272
- const fixturePath = getFixturePath(tier);
273
- await fs.writeFile(fixturePath, doc, "utf-8");
274
-
275
- // Generate and write comment file
276
- const comments: Comment[] = [];
277
- for (let i = 0; i < tier.comments; i++) {
278
- comments.push(makeComment(i, doc, tier.comments));
279
- }
280
-
281
- // Use realpath for the comment path (file must exist first)
282
- const realFixturePath = await fs.realpath(fixturePath);
283
-
284
- const commentFile: CommentFile = {
285
- source: realFixturePath,
286
- hash: computeHash(doc),
287
- version: 1,
288
- comments,
289
- };
290
-
291
- const commentPath = await getCommentPathReal(fixturePath);
292
- await fs.mkdir(path.dirname(commentPath), { recursive: true });
293
- await fs.writeFile(commentPath, serializeComments(commentFile), "utf-8");
294
- }
295
- }
296
-
297
- export async function cleanupFixtures(): Promise<void> {
298
- // Collect comment paths before removing fixtures (need realpath while files exist)
299
- const commentPaths: string[] = [];
300
- const allTiers = [...TIERS, TAB_SWITCH_TIER];
301
- for (const tier of allTiers) {
302
- commentPaths.push(getCommentPathSync(getFixturePath(tier)));
303
- }
304
-
305
- // Remove fixture files
306
- try {
307
- await fs.rm(FIXTURES_DIR, { recursive: true, force: true });
308
- } catch {
309
- // Ignore if already removed
310
- }
311
-
312
- // Remove comment files
313
- for (const commentPath of commentPaths) {
314
- try {
315
- await fs.unlink(commentPath);
316
- } catch {
317
- // Ignore if already removed
318
- }
319
- }
320
- }
321
-
322
- // Allow running directly: bun e2e/perf/fixtures/generate.ts
323
- if (import.meta.url === `file://${process.argv[1]}`) {
324
- generateFixtures().then(() => {
325
- console.log(`Fixtures generated in ${FIXTURES_DIR}`);
326
- });
327
- }
@@ -1,49 +0,0 @@
1
- import { test } from "@playwright/test";
2
- import { getFixturePath, TIERS } from "./fixtures/generate";
3
- import { collectLoadMetrics, reportLoadMetrics } from "./utils/metrics";
4
- import { spawnPerfCli } from "./utils/perf-cli";
5
-
6
- const ITERATIONS = 3;
7
-
8
- for (const tier of TIERS) {
9
- test(`initial-load: ${tier.name} (${tier.lines} lines, ${tier.comments} comments)`, async ({
10
- page,
11
- }, testInfo) => {
12
- const fixturePath = getFixturePath(tier);
13
- const { url, cleanup } = await spawnPerfCli(fixturePath, {
14
- port: 4600 + TIERS.indexOf(tier),
15
- });
16
-
17
- try {
18
- const results: (typeof collected)[] = [];
19
- let collected!: Awaited<ReturnType<typeof collectLoadMetrics>>;
20
-
21
- for (let i = 0; i < ITERATIONS; i++) {
22
- // Clear performance entries between iterations
23
- if (i > 0) {
24
- await page.evaluate(() => performance.clearResourceTimings());
25
- }
26
-
27
- collected = await collectLoadMetrics(page, url, tier.comments);
28
- results.push(collected);
29
-
30
- // Navigate away between iterations to force full reload
31
- if (i < ITERATIONS - 1) {
32
- await page.goto("about:blank");
33
- }
34
- }
35
-
36
- // Report median
37
- results.sort((a, b) => a.allHighlightsPainted - b.allHighlightsPainted);
38
- const median = results[Math.floor(results.length / 2)];
39
-
40
- reportLoadMetrics(
41
- testInfo,
42
- `initial-load (${tier.name}: ${tier.lines} lines, ${tier.comments} comments)`,
43
- median,
44
- );
45
- } finally {
46
- await cleanup();
47
- }
48
- });
49
- }
@@ -1,23 +0,0 @@
1
- import { execFileSync } from "node:child_process";
2
- import { existsSync } from "node:fs";
3
- import { resolve } from "node:path";
4
- import { generateFixtures } from "./fixtures/generate";
5
-
6
- async function globalSetup() {
7
- // Build the app if dist doesn't exist
8
- const distIndex = resolve(import.meta.dirname, "../../dist/cli.js");
9
- if (!existsSync(distIndex)) {
10
- console.log("[perf] Building app...");
11
- execFileSync("bun", ["run", "build"], {
12
- cwd: resolve(import.meta.dirname, "../.."),
13
- stdio: "inherit",
14
- });
15
- }
16
-
17
- // Generate fixture files and comment files
18
- console.log("[perf] Generating fixtures...");
19
- await generateFixtures();
20
- console.log("[perf] Setup complete.");
21
- }
22
-
23
- export default globalSetup;
@@ -1,9 +0,0 @@
1
- import { cleanupFixtures } from "./fixtures/generate";
2
-
3
- async function globalTeardown() {
4
- console.log("[perf] Cleaning up fixtures...");
5
- await cleanupFixtures();
6
- console.log("[perf] Teardown complete.");
7
- }
8
-
9
- export default globalTeardown;
Binary file
@@ -1,39 +0,0 @@
1
- import { test } from "@playwright/test";
2
- import { getFixturePath, TIERS } from "./fixtures/generate";
3
- import {
4
- collectScrollMetrics,
5
- reportScrollMetrics,
6
- waitForHighlightCount,
7
- } from "./utils/metrics";
8
- import { spawnPerfCli } from "./utils/perf-cli";
9
-
10
- for (const tier of TIERS) {
11
- test(`scroll: ${tier.name} (${tier.lines} lines, ${tier.comments} comments)`, async ({
12
- page,
13
- }, testInfo) => {
14
- const fixturePath = getFixturePath(tier);
15
- const { url, cleanup } = await spawnPerfCli(fixturePath, {
16
- port: 4610 + TIERS.indexOf(tier),
17
- });
18
-
19
- try {
20
- await page.goto(url);
21
-
22
- // Wait for all highlights to be painted before starting scroll
23
- await waitForHighlightCount(page, tier.comments);
24
-
25
- // Small pause for layout to settle
26
- await page.waitForTimeout(500);
27
-
28
- const metrics = await collectScrollMetrics(page);
29
-
30
- reportScrollMetrics(
31
- testInfo,
32
- `scroll (${tier.name}: ${tier.lines} lines, ${tier.comments} comments)`,
33
- metrics,
34
- );
35
- } finally {
36
- await cleanup();
37
- }
38
- });
39
- }
@@ -1,69 +0,0 @@
1
- import { test } from "@playwright/test";
2
- import { getFixturePath, TAB_SWITCH_TIER, TIERS } from "./fixtures/generate";
3
- import {
4
- measureInteraction,
5
- reportInteraction,
6
- waitForHighlightCount,
7
- } from "./utils/metrics";
8
- import { spawnPerfCli } from "./utils/perf-cli";
9
-
10
- const tierA = TIERS[0]; // medium
11
- const tierB = TAB_SWITCH_TIER; // medium-b
12
-
13
- test(`tab-switch: between two ${tierA.name} documents`, async ({
14
- page,
15
- }, testInfo) => {
16
- const pathA = getFixturePath(tierA);
17
- const pathB = getFixturePath(tierB);
18
-
19
- const { url, cleanup } = await spawnPerfCli([pathA, pathB], { port: 4640 });
20
-
21
- try {
22
- await page.goto(url);
23
-
24
- // Wait for first document to be fully loaded with highlights
25
- await waitForHighlightCount(page, tierA.comments);
26
- await page.waitForTimeout(500);
27
-
28
- // Find the second tab and measure the switch
29
- const duration = await measureInteraction(
30
- page,
31
- "tab-switch",
32
- async () => {
33
- // Click the second tab — tabs display file names
34
- const tabs = page.locator('[role="tab"], button').filter({
35
- hasText: tierB.fileName.replace(".md", ""),
36
- });
37
-
38
- // If tabs aren't labeled with role="tab", find by filename text
39
- const tabCount = await tabs.count();
40
- if (tabCount > 0) {
41
- await tabs.first().click();
42
- } else {
43
- // Fallback: find any clickable element containing the filename
44
- const allButtons = page.locator("button, a");
45
- const count = await allButtons.count();
46
- for (let i = 0; i < count; i++) {
47
- const text = await allButtons.nth(i).textContent();
48
- if (text?.includes("medium-b")) {
49
- await allButtons.nth(i).click();
50
- break;
51
- }
52
- }
53
- }
54
- },
55
- async () => {
56
- // Wait for the second document's highlights to paint
57
- await waitForHighlightCount(page, tierB.comments, 60_000);
58
- },
59
- );
60
-
61
- reportInteraction(
62
- testInfo,
63
- `tab-switch: ${tierA.name} → ${tierB.name} (${tierA.comments} → ${tierB.comments} comments)`,
64
- duration,
65
- );
66
- } finally {
67
- await cleanup();
68
- }
69
- });
@@ -1,119 +0,0 @@
1
- import { test } from "@playwright/test";
2
- import { getFixturePath, TIERS } from "./fixtures/generate";
3
- import {
4
- measureInteraction,
5
- reportInteraction,
6
- waitForHighlightCount,
7
- } from "./utils/metrics";
8
- import { spawnPerfCli } from "./utils/perf-cli";
9
-
10
- // Use medium tier
11
- const tier = TIERS[0];
12
- const ITERATIONS = 5;
13
-
14
- test(`text-selection: ${tier.name} (${tier.lines} lines, ${tier.comments} comments)`, async ({
15
- page,
16
- }, testInfo) => {
17
- const fixturePath = getFixturePath(tier);
18
- const { url, cleanup } = await spawnPerfCli(fixturePath, { port: 4630 });
19
-
20
- try {
21
- await page.goto(url);
22
- await waitForHighlightCount(page, tier.comments);
23
- await page.waitForTimeout(300);
24
-
25
- // Collect selectable text positions distributed across the document
26
- const targets = await page.evaluate((count) => {
27
- const article = document.querySelector("article");
28
- if (!article) throw new Error("Article not found");
29
-
30
- const paragraphs = [...article.querySelectorAll("p")];
31
- const step = Math.floor(paragraphs.length / (count + 1));
32
-
33
- return paragraphs
34
- .filter((_, i) => i % step === 0)
35
- .slice(0, count)
36
- .map((p) => {
37
- const text = (p.textContent || "").slice(0, 25).trim();
38
- return text;
39
- })
40
- .filter((t) => t.length > 10);
41
- }, ITERATIONS);
42
-
43
- const durations: number[] = [];
44
-
45
- for (const targetText of targets) {
46
- // Clear any existing selection state
47
- await page.evaluate(() => window.getSelection()?.removeAllRanges());
48
- await page.waitForTimeout(100);
49
-
50
- const duration = await measureInteraction(
51
- page,
52
- `text-selection-${targets.indexOf(targetText)}`,
53
- async () => {
54
- // Trigger text selection via custom event
55
- await page.evaluate((text) => {
56
- const article = document.querySelector("article");
57
- if (!article) throw new Error("Article not found");
58
-
59
- const walker = document.createTreeWalker(
60
- article,
61
- NodeFilter.SHOW_TEXT,
62
- );
63
- let currentOffset = 0;
64
-
65
- while (walker.nextNode()) {
66
- const textNode = walker.currentNode as Text;
67
- const content = textNode.textContent || "";
68
- const index = content.indexOf(text);
69
-
70
- if (index !== -1) {
71
- const startOffset = currentOffset + index;
72
- const endOffset = startOffset + text.length;
73
- window.dispatchEvent(
74
- new CustomEvent("test:select-text", {
75
- detail: { text, startOffset, endOffset },
76
- }),
77
- );
78
- return;
79
- }
80
-
81
- currentOffset += content.length;
82
- }
83
-
84
- throw new Error(`Text "${text}" not found`);
85
- }, targetText);
86
- },
87
- async () => {
88
- // Wait for comment input textarea to appear
89
- await page
90
- .locator('textarea[placeholder="Add your comment..."]')
91
- .waitFor({ state: "visible", timeout: 10_000 });
92
- },
93
- );
94
-
95
- durations.push(duration);
96
-
97
- // Cancel the selection (press Escape to dismiss the comment input)
98
- await page.keyboard.press("Escape");
99
- await page.waitForTimeout(100);
100
- }
101
-
102
- // Report median
103
- durations.sort((a, b) => a - b);
104
- const median = durations[Math.floor(durations.length / 2)];
105
-
106
- reportInteraction(
107
- testInfo,
108
- `text-selection: median of ${durations.length} iterations (${tier.name})`,
109
- median,
110
- );
111
-
112
- // Also report all iterations
113
- console.log(
114
- ` All iterations: ${durations.map((d) => `${Math.round(d)}ms`).join(", ")}`,
115
- );
116
- } finally {
117
- await cleanup();
118
- }
119
- });