rvlib-shipkit 2.31.0 → 2.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/package.json +1 -1
  3. package/src/advisors/acts.ts +16 -15
  4. package/src/advisors/advice.ts +56 -102
  5. package/src/advisors/advisor-view.ts +122 -76
  6. package/src/advisors/app-graph.ts +1 -1
  7. package/src/advisors/app.ts +3 -11
  8. package/src/advisors/cf-api.ts +1 -1
  9. package/src/advisors/dir-bucket.ts +4 -3
  10. package/src/advisors/edge/api.ts +20 -221
  11. package/src/advisors/edge/bucket.ts +2 -2
  12. package/src/advisors/edge/handler.ts +13 -155
  13. package/src/advisors/edge/here.ts +5 -5
  14. package/src/advisors/edge/pages.ts +12 -9
  15. package/src/advisors/edge/shell.ts +6 -5
  16. package/src/advisors/edge/sign-in.ts +101 -36
  17. package/src/advisors/edge/status.ts +19 -6
  18. package/src/advisors/edge/types.ts +36 -60
  19. package/src/advisors/expose.ts +29 -29
  20. package/src/advisors/here.ts +12 -12
  21. package/src/advisors/invite-send.ts +79 -35
  22. package/src/advisors/invite.ts +31 -8
  23. package/src/advisors/job.ts +24 -16
  24. package/src/advisors/login.ts +40 -15
  25. package/src/advisors/owner-store.ts +46 -22
  26. package/src/advisors/photos.ts +3 -3
  27. package/src/advisors/project.ts +27 -25
  28. package/src/advisors/reach.ts +89 -0
  29. package/src/advisors/rights.ts +1 -1
  30. package/src/advisors/routes.ts +55 -74
  31. package/src/advisors/scan.ts +0 -4
  32. package/src/advisors/setup-run.ts +14 -14
  33. package/src/advisors/share-trace.ts +3 -3
  34. package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
  35. package/src/advisors/speaks.ts +29 -0
  36. package/src/advisors/sync.ts +97 -183
  37. package/src/advisors/tunnel.ts +6 -5
  38. package/src/advisors/users-listen.ts +92 -0
  39. package/src/advisors/users-router.ts +261 -87
  40. package/src/advisors/users-store.ts +81 -0
  41. package/src/agent-time/blocked-scan.ts +181 -0
  42. package/src/agent-time/registry.ts +12 -5
  43. package/src/agent-time/store.ts +9 -109
  44. package/src/asks/ask-bar-fold.ts +2 -1
  45. package/src/asks/ask-close.ts +2 -1
  46. package/src/asks/ask-doc.ts +2 -1
  47. package/src/asks/ask-migrate.ts +3 -2
  48. package/src/asks/ask-steps-fold.ts +2 -1
  49. package/src/asks/ask-store.ts +4 -3
  50. package/src/check.ts +3 -43
  51. package/src/checks/SK001-package-json-shape.check.ts +4 -55
  52. package/src/checks/SK004-gitignore-policy.check.ts +24 -69
  53. package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
  54. package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
  55. package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
  56. package/src/checks/SK020-self-spawning-check.check.ts +5 -7
  57. package/src/checks/SK035-public-clean.check.ts +1 -1
  58. package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
  59. package/src/checks/SK042-post-kinds.check.ts +5 -14
  60. package/src/checks/SK054-agent-allow-list.check.ts +5 -74
  61. package/src/checks/SK055-retired-config-keys.check.ts +45 -0
  62. package/src/cli/cmd_Advisors.ts +11 -45
  63. package/src/cli/cmd_Asks.ts +3 -10
  64. package/src/cli/cmd_Backup.ts +25 -127
  65. package/src/cli/cmd_BackupTargets.ts +1 -1
  66. package/src/cli/cmd_Capacity.ts +6 -2
  67. package/src/cli/cmd_Checks.ts +0 -14
  68. package/src/cli/cmd_Ci.ts +2 -1
  69. package/src/cli/cmd_Db.ts +3 -82
  70. package/src/cli/cmd_Home.ts +4 -32
  71. package/src/cli/cmd_Hq.ts +0 -17
  72. package/src/cli/cmd_Releases.ts +57 -4
  73. package/src/cli/cmd_Review.ts +333 -354
  74. package/src/cli/cmd_Shot.ts +26 -4
  75. package/src/cli/cmd_SocialDrafts.ts +6 -13
  76. package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
  77. package/src/cli/cmd_Time.ts +1 -1
  78. package/src/cli/cmd_Trailer.ts +1 -1
  79. package/src/cli/inbox-hook-run.ts +5 -23
  80. package/src/cli/registry-heads.ts +5 -55
  81. package/src/cli/registry.ts +1 -5
  82. package/src/cli/review-here.ts +1 -1
  83. package/src/cli.ts +15 -4
  84. package/src/collections/collection-types.ts +1 -1
  85. package/src/collections/review.ts +5 -4
  86. package/src/core/admission.ts +268 -0
  87. package/src/core/agent-allow-policy.ts +32 -2
  88. package/src/core/agent-env.ts +8 -0
  89. package/src/core/allow-rows.ts +74 -0
  90. package/src/core/check-file-names.ts +19 -106
  91. package/src/core/code-lines.ts +36 -21
  92. package/src/core/footprint.ts +17 -13
  93. package/src/core/identities-root.ts +1 -4
  94. package/src/core/layout.ts +1 -2
  95. package/src/core/machine-db.ts +33 -208
  96. package/src/core/machine-layout.ts +14 -127
  97. package/src/core/machine-read.ts +5 -2
  98. package/src/core/mask-source.ts +60 -0
  99. package/src/core/memory-watch.ts +17 -14
  100. package/src/core/motherhome.ts +8 -35
  101. package/src/core/one-way-in-policy.ts +0 -3
  102. package/src/core/peer-sk.ts +8 -0
  103. package/src/core/repo-walk.ts +0 -9
  104. package/src/core/retention.ts +1 -9
  105. package/src/core/retired-checks.ts +2 -0
  106. package/src/core/tmux-policy.ts +1 -1
  107. package/src/core/tree-watch.ts +2 -2
  108. package/src/core/when.ts +7 -45
  109. package/src/gate/admit-heavy.ts +150 -0
  110. package/src/gate/check-runner.ts +6 -0
  111. package/src/gate/discover-checks.ts +42 -32
  112. package/src/gate/gate-checks.ts +21 -131
  113. package/src/gate/head-gate.ts +1 -1
  114. package/src/gate/job-run.ts +2 -1
  115. package/src/gate/pre-commit-discovery.ts +22 -28
  116. package/src/gate/run-check.ts +3 -4
  117. package/src/gate/run-ci.ts +4 -0
  118. package/src/gate/run-fix.ts +5 -17
  119. package/src/gate/run-fixers.ts +6 -42
  120. package/src/home/app-sign.ts +2 -2
  121. package/src/home/backup-status.ts +52 -92
  122. package/src/home/backup-verdict.ts +2 -2
  123. package/src/home/daemon-jobs.ts +51 -95
  124. package/src/home/database-words.ts +1 -2
  125. package/src/home/databases.ts +9 -25
  126. package/src/home/home-launchd.ts +0 -6
  127. package/src/home/home-paths.ts +8 -4
  128. package/src/home/home-routes.ts +3 -10
  129. package/src/home/home-state.ts +2 -14
  130. package/src/home/inbox-shape.ts +14 -15
  131. package/src/home/inbox.ts +1 -1
  132. package/src/home/machine-repair.ts +102 -103
  133. package/src/home/resume.ts +1 -15
  134. package/src/home/run-daemon.ts +7 -12
  135. package/src/home/space-page.ts +3 -2
  136. package/src/home/supervise.ts +3 -7
  137. package/src/hooks/commit-msg-run.ts +61 -0
  138. package/src/hooks/commit-run.ts +16 -166
  139. package/src/hooks/gate-outcome.ts +108 -0
  140. package/src/hooks/git-hook.ts +9 -9
  141. package/src/hooks/hook-config.ts +8 -8
  142. package/src/hooks/leak-guard.ts +1 -1
  143. package/src/hooks/pre-commit-checks.ts +1 -1
  144. package/src/hooks/run-hooks.ts +2 -6
  145. package/src/hooks/shared-file.ts +3 -2
  146. package/src/hq/daemon-db.ts +8 -8
  147. package/src/hq/door.ts +3 -16
  148. package/src/hq/hq-db.ts +4 -3
  149. package/src/hq/hq-local.ts +1 -2
  150. package/src/hq/hq-store.ts +0 -15
  151. package/src/hq/item-direct.ts +8 -10
  152. package/src/hq/item-fill.ts +37 -0
  153. package/src/hq/kinds/item-gone.ts +7 -10
  154. package/src/hq/kinds/item-msg.ts +12 -18
  155. package/src/hq/kinds/item.ts +13 -19
  156. package/src/hq/kinds/report.ts +3 -4
  157. package/src/hq/owner-switch.ts +3 -3
  158. package/src/hq/report.ts +5 -9
  159. package/src/hq/switch.ts +2 -11
  160. package/src/hq/thread-sync.ts +5 -17
  161. package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
  162. package/src/http/owner-word.ts +1 -1
  163. package/src/identities/machine.ts +16 -0
  164. package/src/init-repo.ts +0 -1
  165. package/src/ledger/check-stats.ts +6 -5
  166. package/src/ledger/db.ts +2 -4
  167. package/src/ledger/record-kept.ts +117 -48
  168. package/src/ledger/run-log.ts +21 -2
  169. package/src/ledger/slow-tests.ts +96 -0
  170. package/src/ledger/store.ts +3 -86
  171. package/src/ledger/suite-log.ts +8 -2
  172. package/src/media-store/backup/facts.ts +3 -37
  173. package/src/media-store/backup/keys.ts +1 -8
  174. package/src/media-store/backup/manifest.ts +6 -67
  175. package/src/media-store/backup/restore.ts +4 -13
  176. package/src/media-store/backup/retention.ts +13 -1
  177. package/src/media-store/backup/run.ts +6 -267
  178. package/src/media-store/backup/snapshot.ts +2 -38
  179. package/src/media-store/backup/sources.ts +3 -113
  180. package/src/media-store/backup/target-send.ts +5 -29
  181. package/src/media-store/db.ts +8 -7
  182. package/src/media-store/forget-one.ts +1 -1
  183. package/src/media-store/forget.ts +1 -80
  184. package/src/orchestrator/guards.ts +0 -1
  185. package/src/orchestrator/presence.ts +2 -2
  186. package/src/orchestrator/routes.ts +1 -1
  187. package/src/orchestrator/started.ts +0 -9
  188. package/src/orchestrator/talk-key.ts +3 -4
  189. package/src/orchestrator/unheard.ts +1 -1
  190. package/src/plan/planner.ts +3 -2
  191. package/src/recordings/edit.ts +3 -3
  192. package/src/recordings/marks-draw.ts +17 -6
  193. package/src/recordings/marks.ts +120 -9
  194. package/src/reflections/reflections-queue.ts +3 -10
  195. package/src/release/notes.ts +1 -1
  196. package/src/release/public-clean.ts +66 -6
  197. package/src/release/run-bump.ts +11 -0
  198. package/src/release/run-release.ts +4 -0
  199. package/src/releases/from-thread.ts +3 -3
  200. package/src/releases/model.ts +186 -36
  201. package/src/releases/store.ts +13 -3
  202. package/src/releases/validate.ts +83 -0
  203. package/src/repo-config.ts +36 -64
  204. package/src/review/answer-kinds.ts +63 -4
  205. package/src/review/blocked-guard.ts +11 -0
  206. package/src/review/blocked-object.ts +298 -0
  207. package/src/review/cells.ts +144 -230
  208. package/src/review/close.ts +39 -1
  209. package/src/review/doc-save.ts +3 -2
  210. package/src/review/draft-item.ts +1 -1
  211. package/src/review/events.ts +3 -7
  212. package/src/review/expect.ts +23 -39
  213. package/src/review/format.ts +79 -46
  214. package/src/review/glyphs.ts +1 -0
  215. package/src/review/hand-over.ts +3 -3
  216. package/src/review/heard.ts +1 -1
  217. package/src/review/holds-sync.ts +2 -1
  218. package/src/review/inbox-hook.ts +2 -2
  219. package/src/review/inbox-read.ts +39 -33
  220. package/src/review/instruction-guards.ts +12 -0
  221. package/src/review/instructions.ts +0 -1
  222. package/src/review/item-db.ts +13 -43
  223. package/src/review/item-hq.ts +2 -2
  224. package/src/review/item-rows.ts +3 -14
  225. package/src/review/kind-catalog.ts +3 -1
  226. package/src/review/kinds.ts +18 -8
  227. package/src/review/live-view.ts +3 -0
  228. package/src/review/media-kind.ts +1 -1
  229. package/src/review/mentions.ts +1 -2
  230. package/src/review/model.ts +158 -114
  231. package/src/review/move.ts +149 -0
  232. package/src/review/need-threads.ts +3 -2
  233. package/src/review/object-card.ts +11 -0
  234. package/src/review/object-read.ts +6 -1
  235. package/src/review/one-block.ts +1 -1
  236. package/src/review/owner-read.ts +1 -1
  237. package/src/review/phone-push.ts +10 -9
  238. package/src/review/previews.ts +32 -4
  239. package/src/review/push.ts +2 -2
  240. package/src/review/recap.ts +129 -0
  241. package/src/review/referring.ts +6 -3
  242. package/src/review/reflection-object.ts +4 -3
  243. package/src/review/routes.ts +51 -47
  244. package/src/review/secret-route.ts +3 -2
  245. package/src/review/settle.ts +0 -6
  246. package/src/review/snooze.ts +5 -3
  247. package/src/review/speaker.ts +68 -0
  248. package/src/review/start-title.ts +19 -0
  249. package/src/review/store-parties.ts +28 -0
  250. package/src/review/store.ts +94 -59
  251. package/src/review/{wakes.ts → thread-events.ts} +92 -7
  252. package/src/review/thread-md.ts +35 -14
  253. package/src/review/thread-state.ts +804 -0
  254. package/src/review/threads.ts +29 -347
  255. package/src/review/traces.ts +104 -7
  256. package/src/review/trailer-item.ts +1 -1
  257. package/src/review/unit.ts +7 -9
  258. package/src/review/verdict-items.ts +12 -10
  259. package/src/review/view-layout.ts +25 -1
  260. package/src/review/watch-feed.ts +1 -2
  261. package/src/review/working-guards.ts +2 -3
  262. package/src/rules/untrack-generated.ts +1 -15
  263. package/src/secrets/copy.ts +4 -4
  264. package/src/secrets/lapse.ts +2 -1
  265. package/src/serve/hub-app/advisor-app.tsx +4 -4
  266. package/src/serve/hub-app/advisor-face.tsx +9 -3
  267. package/src/serve/hub-app/advisor-host.ts +27 -27
  268. package/src/serve/hub-app/advisors-model.ts +17 -8
  269. package/src/serve/hub-app/advisors-rights.tsx +1 -1
  270. package/src/serve/hub-app/advisors-st.ts +15 -14
  271. package/src/serve/hub-app/advisors-view.tsx +13 -11
  272. package/src/serve/hub-app/app-bridge.ts +23 -3
  273. package/src/serve/hub-app/asks-page.tsx +1 -1
  274. package/src/serve/hub-app/auto-text.tsx +71 -16
  275. package/src/serve/hub-app/check-view.tsx +0 -8
  276. package/src/serve/hub-app/controls.css +14 -3
  277. package/src/serve/hub-app/database-view.tsx +1 -2
  278. package/src/serve/hub-app/dock-st.ts +1 -1
  279. package/src/serve/hub-app/git-view.tsx +3 -1
  280. package/src/serve/hub-app/hub.css +12 -5
  281. package/src/serve/hub-app/icons.tsx +1 -1
  282. package/src/serve/hub-app/inbox-view.tsx +1 -2
  283. package/src/serve/hub-app/live-sources.ts +2 -2
  284. package/src/serve/hub-app/main-panel.tsx +2 -1
  285. package/src/serve/hub-app/panel-repo.ts +0 -9
  286. package/src/serve/hub-app/pic.tsx +29 -12
  287. package/src/serve/hub-app/polled.ts +16 -2
  288. package/src/serve/hub-app/recordings-st.ts +23 -2
  289. package/src/serve/hub-app/recordings-view.tsx +68 -10
  290. package/src/serve/hub-app/ref-pill.ts +1 -1
  291. package/src/serve/hub-app/repo-st.ts +1 -2
  292. package/src/serve/hub-app/review/advisor-add.tsx +1 -1
  293. package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
  294. package/src/serve/hub-app/review/draft-body.tsx +2 -2
  295. package/src/serve/hub-app/review/heard-line.tsx +1 -1
  296. package/src/serve/hub-app/review/instructions-view.tsx +1 -8
  297. package/src/serve/hub-app/review/kind-states.tsx +14 -9
  298. package/src/serve/hub-app/review/kit.tsx +4 -11
  299. package/src/serve/hub-app/review/lane-bar.tsx +3 -3
  300. package/src/serve/hub-app/review/lightbox.tsx +15 -11
  301. package/src/serve/hub-app/review/line-window.ts +4 -1
  302. package/src/serve/hub-app/review/live-bar-st.ts +2 -2
  303. package/src/serve/hub-app/review/live-view.tsx +57 -1
  304. package/src/serve/hub-app/review/object-panel.tsx +20 -8
  305. package/src/serve/hub-app/review/question-views.tsx +191 -53
  306. package/src/serve/hub-app/review/recap-bar.tsx +40 -0
  307. package/src/serve/hub-app/review/request-cell.tsx +48 -0
  308. package/src/serve/hub-app/review/review-cells.tsx +154 -96
  309. package/src/serve/hub-app/review/review-host.ts +8 -4
  310. package/src/serve/hub-app/review/review-kit.ts +17 -11
  311. package/src/serve/hub-app/review/review-list.tsx +30 -35
  312. package/src/serve/hub-app/review/review-st.ts +32 -42
  313. package/src/serve/hub-app/review/review-thread.tsx +139 -85
  314. package/src/serve/hub-app/review/review-views.tsx +127 -68
  315. package/src/serve/hub-app/review/share-lines.tsx +4 -4
  316. package/src/serve/hub-app/review/start-st.ts +2 -5
  317. package/src/serve/hub-app/review/superseded-runs.ts +4 -3
  318. package/src/serve/hub-app/review/thread-close.tsx +10 -7
  319. package/src/serve/hub-app/review/thread-st.ts +381 -202
  320. package/src/serve/hub-app/review/tone-bar.tsx +129 -0
  321. package/src/serve/hub-app/review/tones.ts +53 -0
  322. package/src/serve/hub-app/review/trailer-body.tsx +2 -2
  323. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  324. package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
  325. package/src/serve/hub-app/review.css +189 -106
  326. package/src/serve/hub-app/search-view.tsx +1 -1
  327. package/src/serve/hub-app/social/social-model.ts +0 -4
  328. package/src/serve/hub-app/source-acts.ts +2 -1
  329. package/src/serve/hub-app/stores/stores-page.tsx +2 -2
  330. package/src/serve/hub-app/terminal-sources.tsx +2 -1
  331. package/src/serve/hub-app/thread-row.tsx +3 -4
  332. package/src/serve/hub-app/tree-build.ts +0 -4
  333. package/src/serve/hub-app/urls-view.tsx +2 -1
  334. package/src/serve/hub-app/view-layout.css +13 -3
  335. package/src/serve/hub-app/wikis-view.tsx +5 -2
  336. package/src/serve/hub-runtime.ts +7 -37
  337. package/src/serve/project-gutter-route.ts +6 -2
  338. package/src/serve/read-thread.ts +20 -2
  339. package/src/serve/read-worker.ts +9 -1
  340. package/src/serve/record-pages.ts +46 -0
  341. package/src/serve/serve-hub.ts +2 -2
  342. package/src/serve/terminal-host.ts +1 -1
  343. package/src/serve/terminal-route.ts +1 -3
  344. package/src/serve/tracked-watch.ts +1 -3
  345. package/src/setup-house.ts +2 -2
  346. package/src/shipkit-files.ts +1 -1
  347. package/src/shipkit.ts +1 -6
  348. package/src/shot/client.ts +2 -1
  349. package/src/shot/film-box.ts +0 -20
  350. package/src/shot/on-place.ts +141 -0
  351. package/src/social/drafts.ts +1 -1
  352. package/src/social/kinds.ts +6 -29
  353. package/src/social/load.ts +2 -2
  354. package/src/social/post-object.ts +3 -2
  355. package/src/social/release-stage.ts +1 -1
  356. package/src/social/stage.ts +2 -2
  357. package/src/stores/model.ts +4 -0
  358. package/src/stores/routes.ts +11 -3
  359. package/src/suite/judge-suites.ts +58 -0
  360. package/src/suite/red-alone.ts +54 -18
  361. package/src/suite/runner-shapes.ts +2 -2
  362. package/src/suite/suite-cli.ts +67 -14
  363. package/src/suite/test-units.ts +2 -1
  364. package/src/urls/fill.ts +1 -1
  365. package/src/urls/places.ts +1 -2
  366. package/src/vault/vault-config.ts +2 -2
  367. package/src/vault/vault-init.ts +1 -5
  368. package/src/wiki/graph-page.ts +14 -2
  369. package/src/advisors/copy-truth.ts +0 -49
  370. package/src/advisors/door-child.ts +0 -112
  371. package/src/advisors/door-serve.ts +0 -52
  372. package/src/advisors/door.ts +0 -118
  373. package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
  374. package/src/checks/SK029-explicit-check-files.check.ts +0 -112
  375. package/src/checks/SK048-one-local-file.check.ts +0 -36
  376. package/src/core/config-rewrite.ts +0 -111
  377. package/src/core/daemon-port.ts +0 -10
  378. package/src/core/legacy-shapes.ts +0 -263
  379. package/src/core/migrate-layout.ts +0 -638
  380. package/src/core/port-check-cli.ts +0 -52
  381. package/src/core/port-check-file.ts +0 -295
  382. package/src/core/port-check-files.ts +0 -31
  383. package/src/gate/discover-legacy-checks.ts +0 -26
  384. package/src/home/home-move.ts +0 -527
  385. package/src/home/machine-fold.ts +0 -810
  386. package/src/hq/item-shapes.ts +0 -54
  387. package/src/hq/kinds/items-read.ts +0 -4
  388. package/src/media-store/backup/daemon.ts +0 -220
  389. package/src/media-store/backup/kept.ts +0 -241
  390. package/src/media-store/backup/prune.ts +0 -359
  391. package/src/media-store/backup/secret.ts +0 -88
  392. package/src/media-store/backup/ssh-space.ts +0 -202
  393. package/src/media-store/backup/watch.ts +0 -117
  394. package/src/review/band.ts +0 -182
  395. package/src/review/folders.ts +0 -216
  396. package/src/review/hook-ask.ts +0 -58
  397. package/src/review/role.ts +0 -48
  398. package/src/review/thread-fold.ts +0 -64
  399. package/src/review/wait.ts +0 -91
  400. package/src/rules/rule.ts +0 -43
  401. package/src/serve/hook-thread.ts +0 -37
  402. package/src/serve/hook-work.ts +0 -92
  403. package/src/serve/hook-worker.ts +0 -57
  404. package/src/serve/hub-app/review/dock.tsx +0 -147
  405. package/src/serve/hub-app/review/faces.tsx +0 -18
  406. package/src/serve/hub-app/review/item-verdict.tsx +0 -112
  407. package/src/serve/hub-app/review/review-board.tsx +0 -48
  408. /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
@@ -7,7 +7,7 @@
7
7
  import { observer } from 'mobx-react-lite'
8
8
  import { useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react'
9
9
  import { createPortal } from 'react-dom'
10
- import type { VersionCell } from '../../../review/cells.ts'
10
+ import type { ReplyCell, VersionCell } from '../../../review/cells.ts'
11
11
  import { isChoice, isGallery, isPair, onFrame, SCENE_WORDS, STARS, STATUS_LABEL, thumbFileOf, tileName, viewFilesOf, viewName, viewTag, type GalleryTile, type GalleryView, type Item, type MediaView, type Rect, type ReviewClip, type ReviewMark, type ReviewStatus, type ReviewView, type Side } from '../../../review/model.ts'
12
12
  import { AutoText } from '../auto-text.tsx'
13
13
  import { Pic } from '../pic.tsx'
@@ -16,7 +16,7 @@ import { boxReaction, FIT_ROOM, keepFocus, Key, PAIR_NAMES, PLACE_TIPS, REACTION
16
16
  import { BoxView } from './box-view.ts'
17
17
  import { BoxViewCtx, BoxZoomBar, useBoxView, ZoomMap } from './box-zoom.tsx'
18
18
  import { TILE_H, type Zoom } from './review-kit.ts'
19
- import { fillWidth, formOf, LAYOUT, sizeOf, TILE_ASPECT, TINY_TILE, type Size, type ViewForm } from '../../../review/view-layout.ts'
19
+ import { fillWidth, formOf, LAYOUT, sizeOf, TILE_ASPECT, tilePreviewOf, type PreviewSize, type Size, type ViewForm } from '../../../review/view-layout.ts'
20
20
  import { COMPARE_MODES, drawnSide, type CompareMode, type CompareSt, type PairSide, type ReviewSt } from './review-st.ts'
21
21
  import { TILE_FILTERS, viewDom, viewKind, type SaidNote, type ThreadSt, type TileFilter } from './thread-st.ts'
22
22
  import { Caret, Icon, ICON } from '../icons.tsx'
@@ -24,8 +24,11 @@ import { Pop, Popover } from '../floating.tsx'
24
24
  import { AnimPanel } from './kind-view.tsx'
25
25
  import { KindBox, KindViewFrames } from './kind-states.tsx'
26
26
  import { Lightbox } from './lightbox.tsx'
27
- import { LiveBody } from './live-view.tsx'
28
- import { liveOpenHref } from '../../../review/live-view.ts'
27
+ import { ToneBar } from './tone-bar.tsx'
28
+ import { questionTones, toneKey } from './tones.ts'
29
+ import { renderMdInline } from '../md.ts'
30
+ import { LiveBody, LiveTile } from './live-view.tsx'
31
+ import { repoIdentity } from '../side-frame-view.tsx'
29
32
  import { SceneBody } from './scene-view.tsx'
30
33
  import { Words } from '../words.tsx'
31
34
  import { soleSpot } from '../../../review/one-block.ts'
@@ -34,31 +37,24 @@ import { Age } from '../time-ago.tsx'
34
37
 
35
38
  export const toneClass = (s: string | undefined): string => (s ? ` re-${s}` : '')
36
39
 
37
- /** one version as its views draw it: `live` when his answer goes to it and it draws his draft; `claim` when it is the
38
- * newest while his answer sits on an older version: it takes his marks, and the first one brings his answer here */
40
+ /** one version as its views draw it: `live` when his answer goes to it and it draws his draft */
39
41
  export interface Ver {
40
42
  rv: ReviewSt
41
43
  thread: ThreadSt
42
44
  cell: VersionCell
43
45
  live: boolean
44
- claim: boolean
45
46
  }
46
47
 
47
48
  const itemOf = (ver: Ver): Item => ver.cell.item
48
49
  /** the version takes his marks: OK, Fix, No, a rectangle, a word, a star, a pick. An advisor's page takes none of
49
50
  * them: their advice is a verdict's button and words (review-host.ts) */
50
- export const takes = (ver: Ver): boolean => (ver.live || ver.claim) && ver.rv.can('rects')
51
+ export const takes = (ver: Ver): boolean => ver.live && ver.rv.can('rects')
51
52
  /** the owner's verdict stands on the version he answers and no draft of his sits on it: each view reads its answer as one quiet
52
53
  * line, and the controls to change it show on a hover of the view's head (a phone reopens the thread instead) */
53
54
  export const decided = (ver: Ver): boolean => ver.live && ver.cell.status !== 'pending' && ver.cell.status !== 'wip' && !ver.thread.marked
54
55
  /** a version of one view or one place where its verdict is drawn: that verdict is its one set, the spot's OK, Fix, No
55
56
  * are not drawn again (review/one-block.ts soleSpot) */
56
57
  export const oneSet = (ver: Ver): boolean => ver.live && soleSpot(ver.cell.item) !== null
57
- /** a mark on a claiming version: his answer comes to it first, then the mark lands in its own draft */
58
- export const mark = (ver: Ver, f: () => void): void => {
59
- if (ver.claim) ver.thread.answerNewest()
60
- f()
61
- }
62
58
 
63
59
  /** a version's views, laid out by one table (review/view-layout.ts LAYOUT): a view alone at its form's size, several
64
60
  * views as a grid of equal tiles that fills the row, a sound or a gallery across the whole row. A choice, or views
@@ -100,7 +96,7 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
100
96
 
101
97
  /** one view: in the thread its media at the size its form takes (LAYOUT), its name and number as one small line under
102
98
  * it, its tools over it on a hover, what was said on it under; in the lightbox (`boxed`) its body alone */
103
- export const ViewCell = observer(({ ver, v: live, i, frames, noted = true, boxed = false, among }: { ver: Ver; v: ReviewView; i: number; frames?: GalleryView; noted?: boolean; boxed?: boolean; among?: readonly ReviewView[] }) => {
99
+ export const ViewCell = observer(({ ver, v: live, i, frames, noted = true, boxed = false, among, named = true }: { ver: Ver; v: ReviewView; i: number; frames?: GalleryView; noted?: boolean; boxed?: boolean; among?: readonly ReviewView[]; named?: boolean }) => {
104
100
  const { rv, thread, cell } = ver
105
101
  const past = frames && thread.frame !== null ? frames.gallery[thread.frame] : undefined
106
102
  const v: ReviewView = past && !isGallery(live) ? { ...live, files: { image: past.file }, size: past.size } : live
@@ -125,8 +121,9 @@ export const ViewCell = observer(({ ver, v: live, i, frames, noted = true, boxed
125
121
  const active = ver.live && thread.view === i
126
122
  const many = (among?.length ?? 1) > 1
127
123
  const tag = viewTag(cell.n, i)
128
- // its name under it when it has one or shares the version; else its number floats with its tools
129
- const caption = v.label || many
124
+ // its name under it when it has one or shares the version; else its number floats with its tools. `named` false: its
125
+ // name is said beside it (a question's option button), so its number floats and no line repeats the name
126
+ const caption = named && (v.label || many)
130
127
  return (
131
128
  <section id={viewDom(cell.id, i)} className={`rv-view f-${form} s-${size}${toneClass(shown?.status)}${active ? ' active' : ''}`} data-check="view-cell" data-view={i} data-form={form} data-size={size}
132
129
  onMouseDownCapture={() => ver.live && thread.view !== i && thread.setView(i)}>
@@ -171,15 +168,10 @@ const ViewBody = observer(({ ver, v, i, form, size }: { ver: Ver; v: ReviewView;
171
168
  return size === 'fill' ? <PreviewOf ver={ver} v={v} i={i} /> : <Still src={rv.fitUrl(item.id, thumbFileOf(v), item.wip)} word={null} open={open} fit="contain" />
172
169
  default: {
173
170
  // a panorama, a splat, a mesh, a live page: its still at a tile's size, opened whole in the lightbox; a live
174
- // page also opens itself, beside the thread, from a link on its still
175
- const still = <Still src={rv.fitUrl(item.id, thumbFileOf(v), item.wip)} word={v.scene ? SCENE_WORDS[v.scene.kind] : 'live page'} open={open} fit="cover" />
176
- if (!v.live || !rv.can('live')) return still
177
- return (
178
- <>
179
- {still}
180
- <a className="rv-stilllink" data-check="live-open" href={liveOpenHref(v.live, location.origin)} target="_blank" rel="noopener noreferrer" {...tip(`open the page itself: ${v.live.url}`)}>open the page ↗</a>
181
- </>
182
- )
171
+ // page's tile says so and carries its ways to open it (LiveTile)
172
+ const still = <Still src={rv.fitUrl(item.id, thumbFileOf(v), item.wip)} word={v.scene ? SCENE_WORDS[v.scene.kind] : v.live ? null : 'live page'} open={open} fit="cover" />
173
+ if (!v.live) return still
174
+ return <LiveTile live={v.live} label={v.label} still={still} open={open} framed={rv.can('live')} hub={rv} identity={() => (rv.host.owner == null ? null : repoIdentity(rv.host.owner))} />
183
175
  }
184
176
  }
185
177
  })
@@ -377,7 +369,7 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
377
369
  ) : null}
378
370
  {playable?.audio ? <a className="rv-dl" href={rv.fileUrl(id, file)} download={`${id}-${file}`} {...tip('download the sound')}>⤓</a> : null}
379
371
  {choice && takes(ver) ? (
380
- <button className={`rv-pick${picked ? ' on' : ''}`} {...tip(held ? 'take your pick back: the version waits for your answer again' : 'pick this one: it is your answer', held ? null : 'P')} disabled={thread.busy} onClick={() => mark(ver, () => void thread.choose(i))}>
372
+ <button className={`rv-pick${picked ? ' on' : ''}`} {...tip(held ? 'take your pick back: the version waits for your answer again' : 'pick this one: it is your answer', held ? null : 'P')} disabled={thread.busy} onClick={() => void thread.choose(i)}>
381
373
  {picked ? '✓ picked' : 'pick'}
382
374
  {held ? <span className="rv-undo" aria-label="press again to take it back"> ↺</span> : null}
383
375
  </button>
@@ -437,7 +429,7 @@ const Stars = observer(({ ver, view, tile, given }: { ver: Ver; view: number; ti
437
429
  <span className="rv-stars" {...tip(live ? null : 'the score you gave this version; it takes no new score')}>
438
430
  {Array.from({ length: STARS }, (_, k) => (
439
431
  <button key={k} className={k < n ? 'on' : ''} disabled={!live}
440
- {...tip(live && (k + 1 === n ? 'take this score off' : `score it ${k + 1} of ${STARS}${tile === undefined ? ', the row playing takes the key too' : ', the key works with the pointer on the image'}`), tile === undefined ? `⇧${k + 1}` : `${k + 1}`)} aria-label={`${k + 1} of ${STARS}`} onMouseDown={keepFocus} onClick={() => mark(ver, () => thread.setStars(view, k + 1, tile))}>{k < n ? '★' : '☆'}</button>
432
+ {...tip(live && (k + 1 === n ? 'take this score off' : `score it ${k + 1} of ${STARS}${tile === undefined ? ', the row playing takes the key too' : ', the key works with the pointer on the image'}`), tile === undefined ? `⇧${k + 1}` : `${k + 1}`)} aria-label={`${k + 1} of ${STARS}`} onMouseDown={keepFocus} onClick={() => thread.setStars(view, k + 1, tile)}>{k < n ? '★' : '☆'}</button>
441
433
  ))}
442
434
  </span>
443
435
  )
@@ -507,14 +499,15 @@ const FrameSlider = observer(({ thread, frames }: { thread: ThreadSt; frames: Ga
507
499
  * version's own verdict (a version of one view, in the lightbox) */
508
500
  export const ReactionToggles = observer(({ ver, view, tile, post, small, keys, said, verdict = false }: { ver: Ver; view: number; tile?: number; post?: string; small?: boolean; keys?: boolean; said?: (status: ReviewStatus) => void; verdict?: boolean }) => {
509
501
  const { thread } = ver
510
- const cur = verdict ? thread.chosenOn(ver.cell.id) : ver.claim ? undefined : thread.reactionOf(view, tile, post)?.status
502
+ const cur = verdict ? thread.chosenOn(ver.cell.id) : thread.reactionOf(view, tile, post)?.status
511
503
  const says = (o: (typeof REACTIONS)[number]): string => (post !== undefined ? (PLACE_TIPS[o.status] ?? o.tip) : o.tip)
512
504
  return (
513
505
  <span className="rv-reacts">
514
506
  {REACTIONS.map((o) => (
515
507
  <button key={o.status} {...tip(says(o), keys ? o.key : null)} className={`rv-react re-${o.status}${small ? '' : ' big'}${cur === o.status ? ' on' : ''}${cur && cur !== o.status ? ' off' : ''}`}
516
508
  onMouseDown={keepFocus} onClick={() => {
517
- mark(ver, () => (verdict ? void thread.submit(o.status) : thread.react(view, tile, o.status, post)))
509
+ if (verdict) void thread.submit(o.status)
510
+ else thread.react(view, tile, o.status, post)
518
511
  if (cur !== o.status) said?.(o.status)
519
512
  }}>
520
513
  {o.glyph} {o.label}
@@ -534,10 +527,25 @@ const PHONE_TILE = 120
534
527
  * GALLERY_LARGE images, at most PHONE_TILE on a phone */
535
528
  const tileMin = (rv: ReviewSt, large: boolean): number => Math.min(Math.round((large ? rv.tileH / 2 : rv.tileH) * TILE_ASPECT), rv.phone.on ? PHONE_TILE : Infinity)
536
529
 
537
- type TilePreview = 'tile' | 'thumb' | 'fit'
538
- /** the preview a gallery tile of this least width loads: the tiny one up to TINY_TILE, the thumb up to TILE_H.thumb,
539
- * past it the fit size; the full file only in the lightbox past « fit » */
540
- export const tilePreview = (min: number): TilePreview => (min <= TINY_TILE ? 'tile' : min <= TILE_H.thumb ? 'thumb' : 'fit')
530
+ /** a gallery's grid of equal tiles, each loading the least preview its drawn width needs (view-layout.ts
531
+ * tilePreviewOf): the width is read once laid out, before the first paint, and again as the column resizes; a page with
532
+ * no layout reads the widest a tile of the grid can be, twice its least width */
533
+ const TileGrid = observer(({ ver, view, xs, min }: { ver: Ver; view: number; xs: { t: GalleryTile; k: number }[]; min: number }) => {
534
+ const el = useRef<HTMLDivElement | null>(null)
535
+ const [w, setW] = useState(0)
536
+ useLayoutEffect(() => {
537
+ const g = el.current
538
+ if (!g) return
539
+ const read = (): void => setW(Math.round(g.firstElementChild?.getBoundingClientRect().width ?? 0))
540
+ read()
541
+ if (typeof ResizeObserver === 'undefined') return
542
+ const ro = new ResizeObserver(read)
543
+ ro.observe(g)
544
+ return () => ro.disconnect()
545
+ }, [])
546
+ const boxW = w > 0 ? w : 2 * min
547
+ return <div ref={el} className="rv-gtiles" style={{ '--gmin': `${min}px` } as React.CSSProperties}>{xs.map(({ t, k }) => <Thumb key={k} ver={ver} view={view} t={t} k={k} size={tilePreviewOf(boxW, t.size)} />)}</div>
548
+ })
541
549
 
542
550
  /** a gallery in the thread, a chat's attachments: its images as equal tiles that fill the row, each named, nothing
543
551
  * else (LAYOUT gallery). A click opens one in the lightbox, where it is rated, kept, drawn on and stepped through; the
@@ -548,9 +556,7 @@ const GalleryThumbs = observer(({ ver, v, view }: { ver: Ver; v: GalleryView; vi
548
556
  const large = v.gallery.length > GALLERY_LARGE
549
557
  const shown = v.gallery.map((t, k) => ({ t, k })).filter(({ k }) => thread.tileShown(thread.reactionShown(cell, view, k)))
550
558
  const min = tileMin(rv, large)
551
- const grid = (xs: typeof shown): ReactNode => (
552
- <div className="rv-gtiles" style={{ '--gmin': `${min}px` } as React.CSSProperties}>{xs.map(({ t, k }) => <Thumb key={k} ver={ver} view={view} t={t} k={k} size={tilePreview(min)} />)}</div>
553
- )
559
+ const grid = (xs: typeof shown): ReactNode => <TileGrid ver={ver} view={view} xs={xs} min={min} />
554
560
  const rows = v.gallery.some((t) => t.group) ? [...new Set(shown.map(({ t }) => t.group ?? ''))] : null
555
561
  return (
556
562
  <div className={`rv-gallerywrap${large ? ' large' : ''}`}>
@@ -570,7 +576,7 @@ const GalleryThumbs = observer(({ ver, v, view }: { ver: Ver; v: GalleryView; vi
570
576
  /** one image of a gallery in the thread: an equal tile, the picture fit inside it, its name under it, and only once
571
577
  * given the owner's marks (OK, fix or no as its tone and glyph, its stars, kept, the notes drawn on it). A click opens
572
578
  * it in the lightbox; 1 to 5 score it under the pointer */
573
- const Thumb = observer(({ ver, view, t, k, size }: { ver: Ver; view: number; t: GalleryTile; k: number; size: TilePreview }) => {
579
+ const Thumb = observer(({ ver, view, t, k, size }: { ver: Ver; view: number; t: GalleryTile; k: number; size: PreviewSize }) => {
574
580
  const { rv, thread, cell } = ver
575
581
  const id = itemOf(ver).id
576
582
  const r = thread.reactionShown(cell, view, k)
@@ -579,19 +585,18 @@ const Thumb = observer(({ ver, view, t, k, size }: { ver: Ver; view: number; t:
579
585
  const src = size === 'fit' ? rv.fitUrl(id, file) : size === 'thumb' ? rv.thumbUrl(id, file) : rv.tileUrl(id, file)
580
586
  const notes = ver.live ? thread.marks.rects.filter((x) => (x.view ?? 0) === view && x.tile === k).length : 0
581
587
  const o = REACTIONS.find((x) => x.status === r?.status)
582
- const marked = o !== undefined || !!r?.stars || !!r?.picked || notes > 0
588
+ const marked = o !== undefined || !!r?.stars || notes > 0
583
589
  return (
584
- <button type="button" className={`rv-gtile${r?.picked ? ' picked' : ''}${toneClass(r?.status)}`} data-check="gallery-tile" data-tile={k}
590
+ <button type="button" className={`rv-gtile${toneClass(r?.status)}`} data-check="gallery-tile" data-tile={k}
585
591
  {...tip(`${t.label}: open it large to rate it and draw on it${live ? ' (1 to 5 score it here)' : ''}`)}
586
592
  onMouseDown={keepFocus} onClick={() => thread.openBox(cell.id, view, k)}
587
593
  onMouseEnter={live ? () => thread.setHoverTile({ view, tile: k }) : undefined} onMouseLeave={live ? () => thread.setHoverTile(null) : undefined}>
588
594
  <span className="rv-gtileimg">
589
- <Pic src={src} />
595
+ <Pic src={src} className="fills" />
590
596
  {marked ? (
591
597
  <span className="rv-gmarks">
592
598
  {o ? <span className="rv-gmark tone" {...tip(o.label)}>{o.glyph}</span> : null}
593
599
  {r?.stars ? <span className="rv-gmark star" {...tip(`${r.stars} of ${STARS}`)}>★{r.stars}</span> : null}
594
- {r?.picked ? <span className="rv-gmark kept" {...tip('kept for its row')}>✓ kept</span> : null}
595
600
  {notes > 0 ? <span className="rv-gmark note" {...tip('your notes drawn on it, a draft')}>⬚ {notes}</span> : null}
596
601
  </span>
597
602
  ) : null}
@@ -607,7 +612,7 @@ const GalleryCount = observer(({ ver, v, view, shown }: { ver: Ver; v: GalleryVi
607
612
  const { thread, cell } = ver
608
613
  const marked = v.gallery.filter((_, k) => {
609
614
  const r = thread.reactionShown(cell, view, k)
610
- return !!(r?.stars || r?.status || r?.picked)
615
+ return !!(r?.stars || r?.status)
611
616
  }).length
612
617
  return (
613
618
  <div className="rv-gallerycount">
@@ -686,13 +691,13 @@ const SmallSizes = ({ src }: { src: string }) => (
686
691
  </span>
687
692
  )
688
693
 
689
- /** what sits under a gallery image in the lightbox: its stars and keep, and the small sizes when shown */
694
+ /** what sits under a gallery image in the lightbox: its stars, and the small sizes when shown */
690
695
  const tileUnder = (rv: ReviewSt): number => 44 + (rv.tileSmall ? 84 : 0)
691
696
 
692
697
  /** a gallery image large in the lightbox, whole in the stage's room (--fit-h, review.css, less what sits under it)
693
698
  * until the lightbox's view sizes it (box-view.ts): its image (its before while flipped or peeked), a drag circles a
694
- * spot; under it the small sizes, its stars, keep on a row of variants. OK, Fix, No are the lightbox bar's */
695
- const BoxTile = observer(({ ver, v, view, t, k }: { ver: Ver; v: GalleryView; view: number; t: GalleryTile; k: number }) => {
699
+ * spot; under it the small sizes and its stars. OK, Fix, No are the lightbox bar's */
700
+ const BoxTile = observer(({ ver, view, t, k }: { ver: Ver; view: number; t: GalleryTile; k: number }) => {
696
701
  const { rv, thread, cell } = ver
697
702
  const id = itemOf(ver).id
698
703
  const r = thread.reactionShown(cell, view, k)
@@ -704,7 +709,7 @@ const BoxTile = observer(({ ver, v, view, t, k }: { ver: Ver; v: GalleryView; vi
704
709
  // past « fit » the full file, so its own pixels show
705
710
  const src = zoom?.full ? rv.fileUrl(id, file) : rv.fitUrl(id, file)
706
711
  return (
707
- <div className={`rv-tile big${r?.picked ? ' picked' : ''}${toneClass(r?.status)}`}
712
+ <div className={`rv-tile big${toneClass(r?.status)}`}
708
713
  onMouseEnter={live ? () => thread.setHoverTile({ view, tile: k }) : undefined} onMouseLeave={live ? () => thread.setHoverTile(null) : undefined}>
709
714
  <div className="rv-tilestage">
710
715
  <div className="rv-tileimg rv-zoomface rv-zoomport" data-cols={1} {...tip(live ? 'drag to circle a spot' : undefined)} style={style}>
@@ -719,10 +724,6 @@ const BoxTile = observer(({ ver, v, view, t, k }: { ver: Ver; v: GalleryView; vi
719
724
  {rv.tileSmall ? <SmallSizes src={rv.tileUrl(id, file)} /> : null}
720
725
  <div className="rv-tileunder">
721
726
  {live || r?.stars ? <Stars ver={ver} view={view} tile={k} given={r?.stars} /> : null}
722
- {t.group && (live || r?.picked) ? (
723
- <button className={`rv-chip rv-keep${r?.picked ? ' on' : ''}`} disabled={!live} {...tip(`keep this one for ${t.group}: one a row`)} onMouseDown={keepFocus}
724
- onClick={() => mark(ver, () => thread.pickTile(view, k, t.group ?? '', v.gallery))}>{r?.picked ? '✓ kept' : `keep for ${t.group}`}</button>
725
- ) : null}
726
727
  </div>
727
728
  </div>
728
729
  )
@@ -812,25 +813,28 @@ function boxOf(rv: ReviewSt, thread: ThreadSt) {
812
813
  const b = thread.boxed
813
814
  // a kind's page framed live is KindBox's
814
815
  if (b == null || 'states' in b) return null
815
- const cell = thread.versionOf(b.cell)
816
+ const cell = thread.holderOf(b.cell)
816
817
  const v = cell == null ? undefined : cell.item.views[b.view]
817
818
  if (cell == null || v === undefined) return null
818
819
  const media = isGallery(v) ? null : v
819
820
  const views = cell.item.views.length
820
- const ver: Ver = { rv, thread, cell, live: cell.id === thread.head?.id && thread.takesVerdict, claim: cell.id === thread.newest?.id && thread.claims }
821
+ const ver: Ver = { rv, thread, cell, live: cell.id === thread.head?.id && thread.takesVerdict }
821
822
  // a gallery's image shown large: ← → step through the images the filter shows (the one shown stays among them), OK
822
823
  // Fix No and the word are the image's
823
824
  const order = isGallery(v) ? v.gallery.flatMap((_, k) => (k === b.tile || thread.tileShown(thread.reactionShown(cell, b.view, k)) ? [k] : [])) : []
824
825
  const tile = isGallery(v) && b.tile !== undefined && v.gallery[b.tile] !== undefined ? { k: b.tile, t: v.gallery[b.tile]!, n: v.gallery.length, order } : null
825
826
  // a still of a view of a kind's page opens that page live, a space or a live page fills the stage: no size of their own
826
827
  const size = tile ? (tile.t.view !== undefined ? null : tile.t.size) : media !== null && !media.audio && !media.scene && !media.live ? media.size : null
827
- const can = { step: tile ? order.length > 1 : views > 1, pair: media !== null && isPair(media.files) && !media.audio, size: size !== null }
828
+ // an option's picture of a question: ← → step through that question's options, its side panel answers the one shown
829
+ const opt = tile ? null : thread.optionAt(cell.id, b.view)
830
+ const can = { step: tile ? order.length > 1 : opt ? opt.order.length > 1 : views > 1, pair: media !== null && isPair(media.files) && !media.audio, size: size !== null }
828
831
  // a view that is a gallery opens on its first image
829
832
  const view = (to: number): void => thread.openBox(cell.id, to, isGallery(cell.item.views[to]!) ? 0 : undefined)
830
- const step = (by: number): void => (tile ? thread.openBox(cell.id, b.view, order[(order.indexOf(tile.k) + by + order.length) % order.length]) : view((b.view + by + views) % views))
833
+ const stepOption = (o: NonNullable<typeof opt>, by: number): void => view(o.c.ask!.views![o.order[(o.order.indexOf(o.i) + by + o.order.length) % o.order.length]!]!)
834
+ const step = (by: number): void => (tile ? thread.openBox(cell.id, b.view, order[(order.indexOf(tile.k) + by + order.length) % order.length]) : opt ? stepOption(opt, by) : view((b.view + by + views) % views))
831
835
  // the whole picture, small: the map of a view larger than its room
832
836
  const whole = size === null ? null : rv.fitUrl(cell.id, tile ? tile.t.file : media !== null ? thumbFileOf(media) : '', cell.item.wip)
833
- return { at: b.view, cell, v, media, views, ver, can, step, tile, size, whole }
837
+ return { at: b.view, cell, v, media, views, ver, can, step, tile, size, whole, opt }
834
838
  }
835
839
 
836
840
  /** a key in the lightbox, true when it acted. Each acts only where its control shows: ← → the views, space a pair's
@@ -839,7 +843,7 @@ function boxOf(rv: ReviewSt, thread: ThreadSt) {
839
843
  * ← → where they step nothing (one view, no clip). The page keeps the
840
844
  * rest (D the compare mode, a clip's space, its ← → on a version of one view, A archives the thread). A text field
841
845
  * (`field`) keeps every key but Escape */
842
- export function boxKey(rv: ReviewSt, thread: ThreadSt, view: BoxView, e: Pick<KeyboardEvent, 'key' | 'metaKey' | 'ctrlKey' | 'altKey'>, field: boolean): boolean {
846
+ export function boxKey(rv: ReviewSt, thread: ThreadSt, view: BoxView, e: Pick<KeyboardEvent, 'key' | 'metaKey' | 'ctrlKey' | 'altKey'> & { code?: string }, field: boolean): boolean {
843
847
  // ↑ ↓ are the lightbox's and never reach the page behind it. They are the view's
844
848
  // (a 3D view goes forward and back, view3d/viewer.ts hears them itself)
845
849
  const upDown = !e.metaKey && !e.ctrlKey && !e.altKey && !field && (e.key === 'ArrowUp' || e.key === 'ArrowDown')
@@ -847,9 +851,18 @@ export function boxKey(rv: ReviewSt, thread: ThreadSt, view: BoxView, e: Pick<Ke
847
851
  if (thread.boxed != null && 'states' in thread.boxed) return e.key === 'Escape' ? (thread.closeBox(), true) : upDown
848
852
  const x = boxOf(rv, thread)
849
853
  if (x == null || e.metaKey || e.ctrlKey || e.altKey || (field && e.key !== 'Escape')) return false
850
- const { at, ver, can, step, tile } = x
854
+ // Escape in an open tone's box closes that box (tone-bar.tsx NoteBox), the lightbox stays
855
+ if (field && thread.note !== null) return false
856
+ const { at, ver, can, step, tile, opt } = x
851
857
  const said = boxReaction(e.key)
858
+ // an option's picture: the keys of its side panel's answers (tones.ts questionTones) open that answer's box for the
859
+ // option shown, as the thread's keys do
860
+ const keyed = opt ? toneKey(e.key, /^Digit[1-6]$/.test(e.code ?? '') ? e.code!.slice(5) : undefined) : null
861
+ const toned = keyed !== null && questionTones('option', null).some((t) => t.status === keyed) ? keyed : null
852
862
  if (e.key === 'Escape') thread.closeBox()
863
+ else if (opt && toned !== null) {
864
+ if (thread.can(toned === 'approved' || toned === 'approved-with-fix' ? 'pick' : 'answer')) thread.face(opt.c.id, toned, opt.i)
865
+ }
853
866
  else if (can.step && (e.key === 'ArrowLeft' || e.key === 'ArrowRight')) step(e.key === 'ArrowLeft' ? -1 : 1)
854
867
  else if (upDown) view.nudge(0, e.key === 'ArrowUp' ? -1 : 1)
855
868
  else if (view.on && !x.media?.clip && (e.key === 'ArrowLeft' || e.key === 'ArrowRight')) view.nudge(e.key === 'ArrowLeft' ? -1 : 1, 0)
@@ -860,7 +873,10 @@ export function boxKey(rv: ReviewSt, thread: ThreadSt, view: BoxView, e: Pick<Ke
860
873
  } else if (can.size && (e.key === '+' || e.key === '=' || e.key === '-')) view.step(e.key === '-' ? -1 : 1)
861
874
  else if (said != null) {
862
875
  // a version of one view: O, F, N are the version's verdict
863
- if (takes(ver)) mark(ver, () => (tile === undefined && oneSet(ver) ? void thread.submit(said) : thread.react(at, tile?.k, said)))
876
+ if (takes(ver)) {
877
+ if (tile === undefined && oneSet(ver)) void thread.submit(said)
878
+ else thread.react(at, tile?.k, said)
879
+ }
864
880
  } else return false
865
881
  return true
866
882
  }
@@ -919,7 +935,7 @@ export const ViewBox = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadS
919
935
  export const BoxFrame = observer(({ rv, thread, stage, view }: { rv: ReviewSt; thread: ThreadSt; stage: React.RefObject<HTMLDivElement | null>; view: BoxView }) => {
920
936
  const x = boxOf(rv, thread)
921
937
  if (x == null) return null
922
- const { at, cell, v, media, views, ver, can, step, tile } = x
938
+ const { at, cell, v, media, views, ver, can, step, tile, opt } = x
923
939
  const shown = thread.reactionShown(cell, at, tile?.k)
924
940
  const kind = viewKind(v, false)
925
941
  const name = tile ? tile.t.label : v.label || kind
@@ -935,18 +951,20 @@ export const BoxFrame = observer(({ rv, thread, stage, view }: { rv: ReviewSt; t
935
951
  close={() => thread.closeBox()}
936
952
  stage={stage}
937
953
  over={x.size !== null && x.whole !== null && !rv.phone.on ? <ZoomMap view={view} src={x.whole} size={x.size} /> : null}
954
+ side={opt ? <OptionSide rv={rv} thread={thread} cell={cell} opt={opt} /> : undefined}
938
955
  top={<>
939
956
  <span className="rv-boxwhere">
940
- {can.step ? <button className="ghost rv-keybtn" data-check="lightbox-prev" {...tip(tile ? 'the image before' : 'the view before', '←')} aria-label="the one before" onMouseDown={keepFocus} onClick={() => step(-1)}><Key k="←" /><span className="rv-nokey">‹</span></button> : null}
941
- <span className="rv-boxn rv-dim">{tile ? tile.order.indexOf(tile.k) + 1 : at + 1} of {tile ? tile.order.length : views}{tile && thread.tileFilter !== 'all' ? ` · ${TILE_FILTER_LABEL[thread.tileFilter]}` : ''}</span>
942
- {can.step ? <button className="ghost rv-keybtn" data-check="lightbox-next" {...tip(tile ? 'the image after' : 'the view after', '→')} aria-label="the one after" onMouseDown={keepFocus} onClick={() => step(1)}><Key k="→" /><span className="rv-nokey">›</span></button> : null}
957
+ {can.step ? <button className="ghost rv-keybtn" data-check="lightbox-prev" {...tip(tile ? 'the image before' : opt ? 'the option before' : 'the view before', '←')} aria-label="the one before" onMouseDown={keepFocus} onClick={() => step(-1)}><Key k="←" /><span className="rv-nokey">‹</span></button> : null}
958
+ <span className="rv-boxn rv-dim">{tile ? tile.order.indexOf(tile.k) + 1 : opt ? opt.order.indexOf(opt.i) + 1 : at + 1} of {tile ? tile.order.length : opt ? opt.order.length : views}{tile && thread.tileFilter !== 'all' ? ` · ${TILE_FILTER_LABEL[thread.tileFilter]}` : ''}</span>
959
+ {can.step ? <button className="ghost rv-keybtn" data-check="lightbox-next" {...tip(tile ? 'the image after' : opt ? 'the option after' : 'the view after', '→')} aria-label="the one after" onMouseDown={keepFocus} onClick={() => step(1)}><Key k="→" /><span className="rv-nokey">›</span></button> : null}
943
960
  <b className="rv-boxname" {...tip(name)}>{name}</b>
944
961
  {tile ? (v.label ? <span className="rv-boxkind rv-dim">{v.label}</span> : null) : v.label && v.label.toLowerCase() !== kind.toLowerCase() ? <span className="rv-boxkind rv-dim">{kind}</span> : null}
945
962
  <span className="rv-boxtag" {...tip(`view ${tag}`)}>{tag}</span>
946
963
  <span className="rv-boxtitle rv-dim" {...tip(cell.item.title)}>{cell.item.title}</span>
947
964
  </span>
948
- {/* a version of one view: its keys and buttons here are the version's own verdict */}
949
- {takes(ver) ? <ReactionToggles ver={ver} view={at} {...(tile ? { tile: tile.k } : {})} keys verdict={!tile && oneSet(ver)} /> : shown?.status ? <SentReaction status={shown.status} /> : null}
965
+ {/* a version of one view: its keys and buttons here are the version's own verdict; an option's picture is
966
+ answered in its side panel */}
967
+ {opt ? null : takes(ver) ? <ReactionToggles ver={ver} view={at} {...(tile ? { tile: tile.k } : {})} keys verdict={!tile && oneSet(ver)} /> : shown?.status ? <SentReaction status={shown.status} /> : null}
950
968
  <span className="rv-boxlook">
951
969
  {rv.phone.on && takes(ver) && (tile !== null || (media !== null && !media.clip && !media.audio && !media.scene)) ? <button className={rv.phone.draw ? 'primary' : ''} {...tip('a drag circles a spot instead of scrolling')} onClick={() => rv.phone.toggleDraw()}>Circle</button> : null}
952
970
  {can.pair && rv.phone.on ? <PhoneSides rv={rv} /> : null}
@@ -975,11 +993,54 @@ export const BoxFrame = observer(({ rv, thread, stage, view }: { rv: ReviewSt; t
975
993
  </>}
976
994
  >
977
995
  {tile && isGallery(v) && tile.t.view !== undefined && cell.item.states ? <KindViewFrames rv={rv} thread={thread} item={cell.item} view={tile.t.view} />
978
- : tile && isGallery(v) ? <BoxTile ver={ver} v={v} view={at} t={tile.t} k={tile.k} /> : <ViewCell ver={ver} v={v} i={at} boxed />}
996
+ : tile && isGallery(v) ? <BoxTile ver={ver} view={at} t={tile.t} k={tile.k} /> : <ViewCell ver={ver} v={v} i={at} boxed />}
979
997
  </Lightbox>
980
998
  )
981
999
  })
982
1000
 
1001
+ /** the side panel of the lightbox on an option's picture: every option of the question as a small picture (the one
1002
+ * shown lit, his pick and the agent's marked, a click shows it), then the option shown, its number and label whole,
1003
+ * « my pick » on the agent's, his remark with it, the question's words, then THAT option's pick and pick with a remark
1004
+ * over the question's row (tone-bar.tsx): he compares and answers without closing. ← → step the options, a digit opens
1005
+ * its answer, Escape closes */
1006
+ const OptionSide = observer(({ rv, thread, cell, opt }: { rv: ReviewSt; thread: ThreadSt; cell: VersionCell; opt: { c: ReplyCell; i: number; order: number[] } }) => {
1007
+ const { c, i, order } = opt
1008
+ const ask = c.ask!
1009
+ const label = ask.options[i] ?? `option ${i + 1}`
1010
+ const yours = thread.yours(c)
1011
+ const remark = yours === i ? thread.yourRemark(c) : ''
1012
+ const answers = !c.superseded && c.step === undefined
1013
+ return (
1014
+ <aside className="rv-boxside" data-check="lightbox-side" aria-label={`option ${i + 1}: ${label}`}>
1015
+ <div className="rv-sidestrip" role="group" aria-label="the options">
1016
+ {order.map((k) => {
1017
+ const v = cell.item.views[ask.views![k]!]
1018
+ const src = v && !isGallery(v) && !v.audio ? rv.fitUrl(cell.id, thumbFileOf(v), cell.item.wip) : null
1019
+ return (
1020
+ <button key={k} type="button" className={`rv-sideopt${k === i ? ' on' : ''}${yours === k ? ' yours' : ''}`} aria-pressed={k === i} {...tip(`${k + 1} · ${ask.options[k] ?? ''}`)} onMouseDown={keepFocus} onClick={() => thread.openBox(cell.id, ask.views![k]!)}>
1021
+ {src ? <Pic src={src} /> : null}
1022
+ <span className="rv-sideoptn">{k + 1}{ask.pick === k ? ' ★' : ''}</span>
1023
+ </button>
1024
+ )
1025
+ })}
1026
+ </div>
1027
+ <div className="rv-sidehead">
1028
+ <span className="rv-sidenum">option {i + 1} of {ask.options.length}</span>
1029
+ {ask.pick === i ? <span className="rv-mypick" {...tip("the agent's suggestion, never your answer")}>my pick</span> : null}
1030
+ {yours === i ? <span className="rv-yours">✓ yours</span> : null}
1031
+ </div>
1032
+ <div className="rv-sidelabel mdi" dangerouslySetInnerHTML={{ __html: renderMdInline(label) }} />
1033
+ {remark !== '' ? <div className="rv-askremarksaid" {...tip('your remark with this pick')}>« {remark} »</div> : null}
1034
+ <div className="rv-sideq">
1035
+ {ask.row ? <b className="rv-siderow">{ask.row.label}</b> : null}
1036
+ <Words text={c.text} className="rv-sideqwords" />
1037
+ </div>
1038
+ {answers ? <ToneBar thread={thread} on={c.id} question={c} pick={ask.pick !== undefined ? (ask.options[ask.pick] ?? `option ${ask.pick + 1}`) : null} option={i} /> : null}
1039
+ <div className="rv-sidekeys rv-dim"><Key k="←" /><Key k="→" /> the options · <Key k="1" /> pick · <Key k="2" /> with a remark · <Key k="esc" /> closes</div>
1040
+ </aside>
1041
+ )
1042
+ })
1043
+
983
1044
  /** a sound view: its waveform over the browser's player, one row a side on a pair, each to download */
984
1045
  const SoundBody = ({ ver, v, saves = true }: { ver: Ver; v: MediaView; saves?: boolean }) => {
985
1046
  const { rv } = ver
@@ -1345,8 +1406,7 @@ export const HostedFrame = observer(({ ver, view, side, aspect, face, notes }: {
1345
1406
 
1346
1407
  /** one image or clip of view `view` and its rectangles: the ones his answers sent (still), and on the version his
1347
1408
  * answer goes to his draft's, a drag drawing one (never in the curtain, whose drag moves the line). A clip view of
1348
- * that version that is not the active one loops on its own: a click makes it active. On a claiming version (the newest,
1349
- * his answer on an older one) a drag draws at once and brings his answer here. `face` takes the image's place (the
1409
+ * that version that is not the active one loops on its own: a click makes it active. `face` takes the image's place (the
1350
1410
  * changes of a pair, a trailer version's player); `alone`: one picture with no curtain over it, whatever its side. The
1351
1411
  * clock its frames stand on is the version's (`clockOf`): a clip's own, a trailer version's player's. `notes`: a host that
1352
1412
  * shows its notes by time picks which rectangles show and numbers them, each with its first words */
@@ -1375,7 +1435,6 @@ const Marks = observer(({ ver, src, side, view, face, tile, onTap, alone, notes
1375
1435
  if (!drawing) return
1376
1436
  e.preventDefault()
1377
1437
  e.stopPropagation()
1378
- if (ver.claim) thread.answerNewest()
1379
1438
  // he draws on the paused frame: the rectangle keeps its time
1380
1439
  if (c && !c.paused) c.pause()
1381
1440
  if (!el.current) return
@@ -1,19 +1,19 @@
1
- // a share's acts where he shared (wiki tools/shipkit/advisors.md, The share's trace, Copy the invite): under a live
1
+ // a share's acts where he shared (wiki tools/shipkit/advisors.md, What he does, one click each): under a live
2
2
  // share's newest line in the thread's timeline and on the done step of « add advisor », « copy invite » and « copy
3
3
  // link » (on its row of the advisors page too). His share IS the act that lets them in: they sign in at once.
4
4
  // The lines themselves come from the thread's bar (`/thread` `trace`, advisors/share-trace.ts) and draw as traces
5
5
  // (review-cells.tsx)
6
6
  import { observer } from 'mobx-react-lite'
7
7
  import type { ReactNode } from 'react'
8
- import type { DoorFacts } from '../../../advisors/door.ts'
8
+ import type { ReachFacts } from '../../../advisors/reach.ts'
9
9
  import type { ShareRow } from '../../../advisors/routes.ts'
10
10
  import type { AdvisorsSt, ThreadBarSt } from '../advisors-st.ts'
11
11
  import { tip } from '../tips.ts'
12
12
  import { CopyButton } from './copy-button.tsx'
13
13
 
14
14
  /** an ask of the house, opened on the asks page: a plain link, so this module reaches no page of the home (the
15
- * advisors' page at the door builds the thread page, review-cells.tsx draws the share's line) */
16
- export const AskLink = ({ adv, ask, children, says }: { adv: AdvisorsSt; ask: DoorFacts['ask'] | undefined; children: ReactNode; says: string }) =>
15
+ * advisors page's app builds the thread page, review-cells.tsx draws the share's line) */
16
+ export const AskLink = ({ adv, ask, children, says }: { adv: AdvisorsSt; ask: ReachFacts['ask'] | undefined; children: ReactNode; says: string }) =>
17
17
  ask == null || ask.repo === '' ? (
18
18
  <>{children}</>
19
19
  ) : (
@@ -6,10 +6,7 @@
6
6
  import { makeAutoObservable, runInAction } from 'mobx'
7
7
  import { AttachSt } from './attach-st.ts'
8
8
  import type { ReviewHost } from './review-host.ts'
9
-
10
- /** a title is optional: the first line of the words names the thread when none is typed */
11
- export const startTitle = (title: string, text: string): string =>
12
- title.trim() || (text.trim().split('\n')[0] ?? '').replace(/\[(?:image|file) \d+\]\s*/g, '').trim().slice(0, 120) || 'a new thread'
9
+ import { startTitle } from '../../../review/start-title.ts'
13
10
 
14
11
  /** what they sent, shown as their first message until its thread is on the list */
15
12
  export interface Started {
@@ -114,9 +111,9 @@ export class StartSt {
114
111
  if (!this.canSend) return
115
112
  this.sending = true
116
113
  this.error = ''
117
- const title = startTitle(this.title, this.text)
118
114
  const project = this.target
119
115
  const out = this.attach.outgoing(this.text.trim())
116
+ const title = startTitle(this.title, this.text, out.files)
120
117
  try {
121
118
  await this.host.start!(project, { title, text: out.text, files: out.files })
122
119
  runInAction(() => {
@@ -4,10 +4,11 @@
4
4
  // keeps which run he opened
5
5
  import type { Framed, Line } from './thread-st.ts'
6
6
 
7
- /** the timeline draws the cell: an ask's head with no words of its own holds its facts in the thread's title, and a
8
- * field inside a step of an ask's instructions draws in that step */
7
+ /** the timeline draws the cell: an ask's head with no words of its own holds its facts in the thread's title, a field
8
+ * inside a step of an ask's instructions draws in that step, and a row after the first of a question with a row per
9
+ * thing draws in its first row */
9
10
  export const drawnCell = (c: Framed): boolean =>
10
- !(c.kind === 'version' && c.item.ask !== undefined && !c.item.what && c.item.views.length === 0) && !(c.kind === 'reply' && c.step !== undefined)
11
+ !(c.kind === 'version' && c.item.ask !== undefined && !c.item.what && c.item.views.length === 0) && !(c.kind === 'reply' && c.step !== undefined) && !(c.kind === 'reply' && (c.ask?.row?.i ?? 0) > 0)
11
12
 
12
13
  /** what one superseded item is, in a word and its plural */
13
14
  const kindOf = (c: Framed): [string, string] =>
@@ -67,6 +67,9 @@ const WontfixBox = ({ busy, send }: { busy: boolean; send: (words: string) => vo
67
67
  )
68
68
  }
69
69
 
70
+ /** the state an act was said on: this thread, open or closed at its time; the bar outlives a move to another thread */
71
+ const sayOn = (v: { head: string; state: { closed: { at: string } | null } }): string => `${v.head} ${v.state.closed?.at ?? 'open'}`
72
+
70
73
  export const CloseBar = observer(({ rv, thread }: { rv: ReviewSt; thread: ThreadSt }) => {
71
74
  const v = thread.data
72
75
  const [busy, setBusy] = useState(false)
@@ -75,12 +78,12 @@ export const CloseBar = observer(({ rv, thread }: { rv: ReviewSt; thread: Thread
75
78
  // while the thread's state is the one it was said on, dropped with its error when the server refuses
76
79
  const [said, setSaid] = useState<{ how: 'done' | 'wontfix' | 'reopen'; on: string } | null>(null)
77
80
  if (!v || v.ask) return null
78
- const held = v.holds.filter((h) => h.held)
81
+ const held = v.state.holds.filter((h) => h.held)
79
82
  const send = async (how: 'done' | 'wontfix' | 'reopen', note?: string): Promise<void> => {
80
83
  rv.holdPlace(v.head)
81
84
  setBusy(true)
82
85
  setErr(null)
83
- if (how === 'reopen' || held.length === 0) setSaid({ how, on: v.state.state })
86
+ if (how === 'reopen' || held.length === 0) setSaid({ how, on: sayOn(v) })
84
87
  try {
85
88
  await postJson(rv.url(`/api/review/${v.head}/close`), { how, ...(note?.trim() ? { note: note.trim() } : {}) })
86
89
  await thread.refresh()
@@ -92,14 +95,14 @@ export const CloseBar = observer(({ rv, thread }: { rv: ReviewSt; thread: Thread
92
95
  setBusy(false)
93
96
  }
94
97
  }
95
- const shown = said !== null && said.on === v.state.state ? said : null
96
- const closed = shown === null ? v.state.state === 'closed' : shown.how !== 'reopen'
97
- const why = shown === null ? v.state.why : shown.how === 'done' ? 'fixed' : 'wontfix'
98
+ const shown = said !== null && said.on === sayOn(v) ? said : null
99
+ const closed = shown === null ? v.state.closed != null : shown.how !== 'reopen'
100
+ const why = shown === null ? v.state.closed?.why : shown.how === 'done' ? 'fixed' : 'wontfix'
98
101
  // closed by the owner's verdict, still held: what holds it, and the owner's close, which wins and releases it
99
- if (shown === null && v.state.state === 'closed' && held.length > 0)
102
+ if (shown === null && v.state.closed != null && held.length > 0)
100
103
  return (
101
104
  <span className="rv-closebar on">
102
- <span className="rv-stateword"><i className="trturn turn-done" aria-hidden />{CLOSED_WORDS[v.state.why ?? ''] ?? v.state.why ?? 'closed'}, held open</span>
105
+ <span className="rv-stateword"><i className="trturn turn-done" aria-hidden />{CLOSED_WORDS[v.state.closed.why] ?? v.state.closed.why}, held open</span>
103
106
  <HoldLines rv={rv} head={v.head} holds={held} />
104
107
  <HeadBtn className="rv-act" data-check="close-anyway" disabled={busy} says="close anyway" more="the holds are released and named in the thread" onClick={() => void send('done')}><Icon d={ICON.check} /> close anyway</HeadBtn>
105
108
  {err ? <span className="err">✗ {err}</span> : null}