rvlib-shipkit 2.26.0 → 2.28.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 (605) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/diet.ts +77 -0
  4. package/src/agent-time/family.ts +72 -0
  5. package/src/agent-time/hooks.ts +16 -7
  6. package/src/agent-time/limits.ts +44 -0
  7. package/src/agent-time/live.ts +12 -8
  8. package/src/agent-time/mask.ts +96 -18
  9. package/src/agent-time/refused.ts +45 -0
  10. package/src/agent-time/registry.ts +289 -0
  11. package/src/agent-time/render.ts +122 -21
  12. package/src/agent-time/report-cache.ts +57 -0
  13. package/src/agent-time/report.ts +314 -40
  14. package/src/agent-time/shape.ts +50 -3
  15. package/src/agent-time/store.ts +322 -101
  16. package/src/agent-time/timeline.ts +140 -21
  17. package/src/agent-time/turns.ts +18 -8
  18. package/src/annex/born.ts +2 -2
  19. package/src/annex/offload.ts +29 -17
  20. package/src/annex/tidy.ts +70 -10
  21. package/src/asks/ask-after.ts +44 -0
  22. package/src/asks/ask-bar-fold.ts +57 -0
  23. package/src/asks/ask-migrate.ts +280 -0
  24. package/src/asks/ask-steps-fold.ts +166 -0
  25. package/src/asks/ask-store.ts +586 -0
  26. package/src/assets/kit-config.ts +7 -3
  27. package/src/assets/kits/identity-kit.ts +361 -14
  28. package/src/assets/kits/poster-thumbnail.ts +282 -0
  29. package/src/check.ts +3 -1
  30. package/src/checks/SK003-claude-md-shape.check.ts +92 -25
  31. package/src/checks/SK004-gitignore-policy.check.ts +20 -9
  32. package/src/checks/SK013-one-way-in-policy.check.ts +18 -3
  33. package/src/checks/SK026-asks-autoclose.check.ts +9 -23
  34. package/src/checks/SK028-readme.check.ts +7 -66
  35. package/src/checks/SK030-cache-audit.check.ts +6 -1
  36. package/src/checks/SK031-trace-audit.check.ts +2 -0
  37. package/src/checks/SK033-global-contribution.check.ts +3 -1
  38. package/src/checks/SK035-public-clean.check.ts +2 -2
  39. package/src/checks/SK038-speaks-as.check.ts +3 -3
  40. package/src/checks/SK042-post-kinds.check.ts +26 -24
  41. package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
  42. package/src/checks/SK047-login-in-description.check.ts +36 -0
  43. package/src/checks/SK048-one-local-file.check.ts +36 -0
  44. package/src/checks/SK049-thread-answers-hook.check.ts +81 -0
  45. package/src/checks/SK050-retired-commands.check.ts +127 -0
  46. package/src/cli/cmd_Asks.ts +244 -27
  47. package/src/cli/cmd_Backup.ts +153 -10
  48. package/src/cli/cmd_Calls.ts +1 -0
  49. package/src/cli/cmd_Capacity.ts +2 -2
  50. package/src/cli/cmd_Commands.ts +140 -34
  51. package/src/cli/cmd_Contracts.ts +1 -0
  52. package/src/cli/cmd_CrossRepoActivity.ts +5 -4
  53. package/src/cli/cmd_Db.ts +253 -0
  54. package/src/cli/cmd_History.ts +212 -0
  55. package/src/cli/cmd_Home.ts +31 -3
  56. package/src/cli/cmd_Hq.ts +516 -0
  57. package/src/cli/cmd_Keys.ts +1 -0
  58. package/src/cli/cmd_Lanes.ts +15 -4
  59. package/src/cli/cmd_Machines.ts +36 -0
  60. package/src/cli/cmd_Media.ts +38 -6
  61. package/src/cli/cmd_Messages.ts +152 -1
  62. package/src/cli/cmd_Needs.ts +1 -0
  63. package/src/cli/cmd_Reflect.ts +23 -2
  64. package/src/cli/cmd_Review.ts +1357 -223
  65. package/src/cli/cmd_Secret.ts +295 -24
  66. package/src/cli/cmd_Social.ts +113 -28
  67. package/src/cli/cmd_SocialDrafts.ts +235 -0
  68. package/src/cli/cmd_Sound.ts +22 -1
  69. package/src/cli/cmd_Space.ts +324 -0
  70. package/src/cli/cmd_Start.ts +3 -2
  71. package/src/cli/cmd_ThreadHolds.ts +34 -0
  72. package/src/cli/cmd_ThreadKinds.ts +146 -0
  73. package/src/cli/cmd_ThreadReflect.ts +83 -0
  74. package/src/cli/cmd_ThreadSyncNeeds.ts +62 -0
  75. package/src/cli/cmd_Time.ts +76 -5
  76. package/src/cli/cmd_Tmp.ts +28 -4
  77. package/src/cli/cmd_Trailer.ts +14 -10
  78. package/src/cli/cmd_Urls.ts +56 -0
  79. package/src/cli/cmd_Vault.ts +583 -0
  80. package/src/cli/cmd_When.ts +1 -0
  81. package/src/cli/family-help.ts +5 -3
  82. package/src/cli/family-pages.ts +1 -1
  83. package/src/cli/kit/builtins.ts +1 -0
  84. package/src/cli/kit/verb.ts +6 -2
  85. package/src/cli/registry.ts +44 -4
  86. package/src/cli.ts +5 -2
  87. package/src/collections/actions.ts +42 -41
  88. package/src/collections/collection-types.ts +30 -4
  89. package/src/collections/md-body.ts +5 -3
  90. package/src/collections/pings.ts +13 -6
  91. package/src/collections/providers.ts +147 -61
  92. package/src/collections/reflections.ts +9 -4
  93. package/src/collections/review.ts +4 -4
  94. package/src/contracts/contract-manifests.ts +6 -5
  95. package/src/contracts/contract-types.ts +6 -4
  96. package/src/contracts/contracts-engine.ts +11 -0
  97. package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
  98. package/src/core/budget.ts +12 -17
  99. package/src/core/capacity.ts +27 -18
  100. package/src/core/check-runner.ts +7 -4
  101. package/src/core/discover-checks.ts +18 -3
  102. package/src/core/git.ts +31 -0
  103. package/src/core/house-layout.ts +17 -0
  104. package/src/core/layout.ts +13 -5
  105. package/src/core/locked-write.ts +4 -1
  106. package/src/core/machine-busy.ts +127 -0
  107. package/src/core/machine-commit.ts +6 -1
  108. package/src/core/machine-db.ts +370 -20
  109. package/src/core/machine-layout.ts +137 -0
  110. package/src/core/machine-read.ts +81 -0
  111. package/src/core/migrate-layout.ts +9 -11
  112. package/src/core/one-way-in-policy.ts +64 -7
  113. package/src/core/polling-policy.ts +27 -0
  114. package/src/core/retention.ts +16 -2
  115. package/src/core/scope.ts +107 -14
  116. package/src/core/slots.ts +5 -4
  117. package/src/drill/clean.ts +25 -1
  118. package/src/drill/run.ts +1 -1
  119. package/src/drill/seal.ts +27 -4
  120. package/src/home/activity-shape.ts +2 -0
  121. package/src/home/activity.ts +59 -3
  122. package/src/home/app-sign.ts +15 -4
  123. package/src/home/daemon-jobs.ts +161 -7
  124. package/src/home/database-projects.ts +111 -0
  125. package/src/home/database-words.ts +203 -0
  126. package/src/home/databases.ts +460 -0
  127. package/src/home/global-units.ts +6 -0
  128. package/src/home/gui-app/ShipkitGui.swift +122 -1
  129. package/src/home/gui-app.ts +6 -3
  130. package/src/home/home-move.ts +514 -0
  131. package/src/home/home-paths.ts +18 -6
  132. package/src/home/home-routes.ts +76 -0
  133. package/src/home/inbox-shape.ts +234 -91
  134. package/src/home/inbox.ts +26 -71
  135. package/src/home/machine-fold.ts +815 -0
  136. package/src/home/machine-host.ts +38 -5
  137. package/src/home/machine-repair.ts +503 -0
  138. package/src/home/machine-stores.ts +66 -15
  139. package/src/home/machine-temp.ts +547 -86
  140. package/src/home/other-macs.ts +2 -2
  141. package/src/home/resume.ts +79 -0
  142. package/src/home/run-daemon.ts +25 -4
  143. package/src/home/run-pm.ts +18 -5
  144. package/src/home/serve-daemon.ts +18 -3
  145. package/src/home/serve-web.ts +179 -10
  146. package/src/home/space-job.ts +115 -0
  147. package/src/home/space-page.ts +257 -0
  148. package/src/home/space-route.ts +167 -0
  149. package/src/home/space-words.ts +103 -0
  150. package/src/home/time-page-shape.ts +202 -0
  151. package/src/home/time-page.ts +64 -0
  152. package/src/home/vault-page.ts +516 -0
  153. package/src/home/vault-words.ts +132 -0
  154. package/src/hooks/leak-guard.ts +40 -13
  155. package/src/hooks/one-way-in-guard.ts +41 -6
  156. package/src/hq/cards.ts +581 -0
  157. package/src/hq/door-route.ts +43 -0
  158. package/src/hq/door.ts +163 -0
  159. package/src/hq/files-send.ts +347 -0
  160. package/src/hq/forgotten-log.ts +35 -0
  161. package/src/hq/history-check.ts +255 -0
  162. package/src/hq/history-place.ts +146 -0
  163. package/src/hq/history-send.ts +487 -0
  164. package/src/hq/hq-db.ts +102 -0
  165. package/src/hq/hq-local.ts +502 -0
  166. package/src/hq/hq-routes.ts +204 -0
  167. package/src/hq/hq-store.ts +603 -0
  168. package/src/hq/kinds/ask.ts +147 -0
  169. package/src/hq/kinds/card-gone.ts +83 -0
  170. package/src/hq/kinds/card-msg.ts +66 -0
  171. package/src/hq/kinds/card.ts +99 -0
  172. package/src/hq/kinds/index.ts +21 -0
  173. package/src/hq/kinds/kind.ts +126 -0
  174. package/src/hq/kinds/media.ts +125 -0
  175. package/src/hq/kinds/prompt.ts +219 -0
  176. package/src/hq/kinds/reflection.ts +128 -0
  177. package/src/hq/kinds/report.ts +55 -0
  178. package/src/hq/kinds/time-day.ts +236 -0
  179. package/src/hq/ledger.ts +473 -0
  180. package/src/hq/machine-key.ts +44 -0
  181. package/src/hq/machine-notes.ts +131 -0
  182. package/src/hq/outbox.ts +374 -0
  183. package/src/hq/replica.ts +167 -0
  184. package/src/hq/repo-id.ts +4 -0
  185. package/src/hq/report-facts.ts +117 -0
  186. package/src/hq/report.ts +274 -0
  187. package/src/hq/switch.ts +151 -0
  188. package/src/hq/vault-grant.ts +92 -0
  189. package/src/hq/vault-route.ts +112 -0
  190. package/src/identities/collection.ts +2 -2
  191. package/src/identities/identities.ts +24 -11
  192. package/src/identities/machine-route.ts +8 -3
  193. package/src/identities/steps.ts +31 -0
  194. package/src/ledger/db.ts +81 -27
  195. package/src/ledger/gate-checks.ts +6 -2
  196. package/src/ledger/run-log.ts +11 -3
  197. package/src/ledger/store.ts +26 -4
  198. package/src/media-store/backup/daemon.ts +73 -25
  199. package/src/media-store/backup/kept.ts +241 -0
  200. package/src/media-store/backup/keys.ts +1 -1
  201. package/src/media-store/backup/manifest.ts +20 -2
  202. package/src/media-store/backup/prune.ts +365 -0
  203. package/src/media-store/backup/restore.ts +14 -4
  204. package/src/media-store/backup/retention.ts +122 -0
  205. package/src/media-store/backup/run.ts +25 -19
  206. package/src/media-store/backup/secret.ts +6 -4
  207. package/src/media-store/backup/snapshot.ts +4 -2
  208. package/src/media-store/backup/sources.ts +83 -31
  209. package/src/media-store/backup/thread-copy.ts +340 -0
  210. package/src/media-store/copy/config.ts +76 -0
  211. package/src/media-store/copy/copy.ts +194 -0
  212. package/src/media-store/copy/lifecycle.ts +43 -0
  213. package/src/media-store/copy/night.ts +90 -0
  214. package/src/media-store/copy/proof.ts +151 -0
  215. package/src/media-store/copy/snapshot.ts +152 -0
  216. package/src/media-store/copy/store.ts +62 -0
  217. package/src/media-store/copy/stream.ts +176 -0
  218. package/src/media-store/daemon.ts +66 -16
  219. package/src/media-store/db.ts +24 -13
  220. package/src/media-store/forget.ts +141 -3
  221. package/src/media-store/hand.ts +4 -3
  222. package/src/media-store/hq-find.ts +75 -0
  223. package/src/media-store/hq-send.ts +277 -0
  224. package/src/media-store/kind.ts +2 -0
  225. package/src/media-store/purge.ts +21 -17
  226. package/src/media-store/put.ts +24 -8
  227. package/src/media-store/remote.ts +16 -7
  228. package/src/media-store/space-listing.ts +256 -0
  229. package/src/media-store/space.ts +46 -26
  230. package/src/media-store/sync.ts +5 -5
  231. package/src/media-store/tidy.ts +98 -0
  232. package/src/media-store/upload.ts +3 -3
  233. package/src/media-store/webp.ts +66 -0
  234. package/src/messages/guard.ts +49 -0
  235. package/src/messages/model.ts +16 -7
  236. package/src/messages/objects.ts +201 -0
  237. package/src/messages/routes.ts +14 -4
  238. package/src/messages/score.ts +3 -3
  239. package/src/messages/write.ts +285 -0
  240. package/src/pages/frame-client.ts +191 -4
  241. package/src/plan/planner.ts +28 -17
  242. package/src/recordings/media-kind.ts +1 -0
  243. package/src/recordings/model.ts +1 -1
  244. package/src/recordings/recorder-app/Capture.swift +9 -7
  245. package/src/reflect/hq-corpus.ts +56 -0
  246. package/src/reflect/prompt-corpus.ts +3 -1
  247. package/src/reflect/transcript.ts +129 -37
  248. package/src/reflections/reflections-queue.ts +1 -1
  249. package/src/release/gate-checkout.ts +2 -1
  250. package/src/release/git-facts.ts +3 -2
  251. package/src/release/machine-words.ts +67 -0
  252. package/src/release/public-clean.ts +11 -5
  253. package/src/releases/from-card.ts +1 -1
  254. package/src/releases/routes.ts +10 -5
  255. package/src/releases/store.ts +10 -1
  256. package/src/repo-config.ts +71 -19
  257. package/src/review/anim.ts +3 -3
  258. package/src/review/answer-kinds.ts +131 -0
  259. package/src/review/auto.ts +2 -2
  260. package/src/review/band.ts +53 -0
  261. package/src/review/branch-hold.ts +84 -0
  262. package/src/review/card-db.ts +254 -0
  263. package/src/review/card-rows.ts +267 -0
  264. package/src/review/cells.ts +360 -57
  265. package/src/review/close.ts +92 -0
  266. package/src/review/draft-card.ts +33 -0
  267. package/src/review/draft-model.ts +78 -0
  268. package/src/review/events.ts +171 -0
  269. package/src/review/format.ts +152 -19
  270. package/src/review/glyphs.ts +63 -0
  271. package/src/review/gone.ts +98 -0
  272. package/src/review/holds-sync.ts +62 -0
  273. package/src/review/holds.ts +85 -0
  274. package/src/review/house-kind-defs.ts +41 -0
  275. package/src/review/inbox-hook.ts +23 -10
  276. package/src/review/inbox-read.ts +201 -0
  277. package/src/review/instructions.ts +199 -0
  278. package/src/review/kind-apply.ts +61 -0
  279. package/src/review/kind-catalog.ts +96 -0
  280. package/src/review/kinds.ts +278 -0
  281. package/src/review/lane-ask.ts +109 -0
  282. package/src/review/marks.ts +1 -1
  283. package/src/review/media-kind.ts +7 -5
  284. package/src/review/media-read.ts +9 -7
  285. package/src/review/media.ts +32 -5
  286. package/src/review/model.ts +582 -109
  287. package/src/review/move.ts +491 -0
  288. package/src/review/need-address.ts +15 -0
  289. package/src/review/need-threads.ts +93 -0
  290. package/src/review/notes.ts +12 -20
  291. package/src/review/object-card.ts +48 -0
  292. package/src/review/object-read.ts +31 -0
  293. package/src/review/owner-verdict.ts +36 -0
  294. package/src/review/parties.ts +182 -0
  295. package/src/review/previews.ts +18 -20
  296. package/src/review/project.ts +1 -1
  297. package/src/review/projections.ts +235 -0
  298. package/src/review/referring.ts +54 -0
  299. package/src/review/reflection-object.ts +195 -0
  300. package/src/review/rev.ts +8 -0
  301. package/src/review/role.ts +1 -1
  302. package/src/review/routes.ts +194 -38
  303. package/src/review/secret-route.ts +80 -0
  304. package/src/review/snooze.ts +38 -0
  305. package/src/review/stage-card.ts +12 -8
  306. package/src/review/stage-routes.ts +1 -1
  307. package/src/review/store.ts +851 -124
  308. package/src/review/supersede.ts +116 -0
  309. package/src/review/take-back.ts +52 -0
  310. package/src/review/thread-fold.ts +64 -0
  311. package/src/review/threads.ts +349 -14
  312. package/src/review/traces.ts +218 -0
  313. package/src/review/trailer-auto-mock.ts +63 -0
  314. package/src/review/trailer-card.ts +6 -6
  315. package/src/review/trailer-desk.ts +41 -7
  316. package/src/review/trailer-media.ts +1 -0
  317. package/src/review/trailer-model.ts +8 -0
  318. package/src/review/trailer-notes.ts +1 -1
  319. package/src/review/trailer-routes.ts +9 -1
  320. package/src/review/unit.ts +77 -11
  321. package/src/review/verdict-items.ts +73 -0
  322. package/src/review/verdict-write.ts +15 -0
  323. package/src/review/wait.ts +85 -0
  324. package/src/review/watchers.ts +23 -10
  325. package/src/rules/untrack-generated.ts +92 -8
  326. package/src/scaffold/files/claude-settings-local.json +2 -0
  327. package/src/secrets/archive-mark.ts +52 -0
  328. package/src/secrets/archive.ts +83 -0
  329. package/src/secrets/copy.ts +14 -14
  330. package/src/secrets/held.ts +16 -0
  331. package/src/secrets/keychain-write.ts +48 -0
  332. package/src/secrets/keychain.ts +116 -0
  333. package/src/secrets/lapse-mark.ts +33 -0
  334. package/src/secrets/lapse.ts +60 -0
  335. package/src/secrets/list.ts +21 -17
  336. package/src/secrets/manager.ts +55 -26
  337. package/src/secrets/read.ts +385 -0
  338. package/src/secrets/tail.ts +31 -0
  339. package/src/secrets/who-reads.ts +49 -0
  340. package/src/serve/door-forward.ts +268 -0
  341. package/src/serve/door-names.ts +47 -0
  342. package/src/serve/embed.ts +1 -1
  343. package/src/serve/hub-app/activity-view.tsx +56 -32
  344. package/src/serve/hub-app/activity.css +7 -1
  345. package/src/serve/hub-app/asks-page.tsx +49 -0
  346. package/src/serve/hub-app/asks-st.ts +25 -0
  347. package/src/serve/hub-app/auto-text.tsx +14 -6
  348. package/src/serve/hub-app/benign-errors.ts +15 -1
  349. package/src/serve/hub-app/card-head.tsx +49 -0
  350. package/src/serve/hub-app/check-view.tsx +3 -2
  351. package/src/serve/hub-app/clock-svc.ts +1 -2
  352. package/src/serve/hub-app/code-copy.ts +35 -0
  353. package/src/serve/hub-app/col-card.tsx +72 -30
  354. package/src/serve/hub-app/col-list-page.tsx +125 -0
  355. package/src/serve/hub-app/col-list-st.ts +103 -0
  356. package/src/serve/hub-app/col-tables-view.tsx +17 -45
  357. package/src/serve/hub-app/col-tables.ts +76 -8
  358. package/src/serve/hub-app/cols-svc.ts +18 -39
  359. package/src/serve/hub-app/commands/commands-page.tsx +2 -1
  360. package/src/serve/hub-app/controls.css +83 -0
  361. package/src/serve/hub-app/database-st.ts +260 -0
  362. package/src/serve/hub-app/database-view.tsx +289 -0
  363. package/src/serve/hub-app/database.css +32 -0
  364. package/src/serve/hub-app/entry-bar.css +14 -0
  365. package/src/serve/hub-app/entry-bar.tsx +33 -0
  366. package/src/serve/hub-app/entry-pick.ts +31 -0
  367. package/src/serve/hub-app/floating.tsx +1 -0
  368. package/src/serve/hub-app/frames-st.ts +17 -1
  369. package/src/serve/hub-app/git-view.tsx +3 -2
  370. package/src/serve/hub-app/hash-route.ts +11 -1
  371. package/src/serve/hub-app/header-bar.tsx +14 -18
  372. package/src/serve/hub-app/home-st.ts +142 -11
  373. package/src/serve/hub-app/home-strip.css +6 -25
  374. package/src/serve/hub-app/home-strip.tsx +60 -93
  375. package/src/serve/hub-app/home.html +10 -0
  376. package/src/serve/hub-app/house-wiki-view.tsx +20 -0
  377. package/src/serve/hub-app/hub-app.tsx +71 -166
  378. package/src/serve/hub-app/hub-types.ts +5 -1
  379. package/src/serve/hub-app/hub.css +146 -71
  380. package/src/serve/hub-app/icons.tsx +32 -5
  381. package/src/serve/hub-app/identities-st.ts +56 -6
  382. package/src/serve/hub-app/identities-view.tsx +104 -61
  383. package/src/serve/hub-app/identities.css +17 -15
  384. package/src/serve/hub-app/identity-address.ts +5 -0
  385. package/src/serve/hub-app/inbox-st.ts +227 -49
  386. package/src/serve/hub-app/inbox-view.tsx +204 -120
  387. package/src/serve/hub-app/inbox.css +47 -47
  388. package/src/serve/hub-app/index.html +10 -0
  389. package/src/serve/hub-app/instructions.css +30 -0
  390. package/src/serve/hub-app/kept-cols.tsx +7 -0
  391. package/src/serve/hub-app/keys.ts +32 -17
  392. package/src/serve/hub-app/later.tsx +26 -0
  393. package/src/serve/hub-app/list-filter.tsx +14 -0
  394. package/src/serve/hub-app/list-walk.ts +72 -3
  395. package/src/serve/hub-app/machine-st.ts +2 -2
  396. package/src/serve/hub-app/machines-st.ts +251 -0
  397. package/src/serve/hub-app/machines-view.tsx +217 -0
  398. package/src/serve/hub-app/machines.css +67 -0
  399. package/src/serve/hub-app/markdown.css +51 -0
  400. package/src/serve/hub-app/md-copy.tsx +57 -0
  401. package/src/serve/hub-app/md.ts +25 -9
  402. package/src/serve/hub-app/media-view.tsx +4 -2
  403. package/src/serve/hub-app/messages/messages-page.tsx +81 -8
  404. package/src/serve/hub-app/messages/messages-st.ts +99 -3
  405. package/src/serve/hub-app/messages.css +14 -1
  406. package/src/serve/hub-app/objects.css +51 -0
  407. package/src/serve/hub-app/page-keys.ts +175 -0
  408. package/src/serve/hub-app/pages-frames.tsx +21 -3
  409. package/src/serve/hub-app/palette-st.ts +58 -11
  410. package/src/serve/hub-app/palette-view.tsx +3 -1
  411. package/src/serve/hub-app/pane-boundary.tsx +72 -0
  412. package/src/serve/hub-app/pane-errors.ts +54 -0
  413. package/src/serve/hub-app/plan-view.tsx +3 -2
  414. package/src/serve/hub-app/planned-view.tsx +3 -3
  415. package/src/serve/hub-app/planned.css +0 -4
  416. package/src/serve/hub-app/processes-view.tsx +3 -2
  417. package/src/serve/hub-app/project-list.css +46 -8
  418. package/src/serve/hub-app/project-list.tsx +125 -59
  419. package/src/serve/hub-app/projects-svc.ts +83 -8
  420. package/src/serve/hub-app/reader-chips.tsx +13 -0
  421. package/src/serve/hub-app/readme-view.tsx +2 -3
  422. package/src/serve/hub-app/readme.css +22 -6
  423. package/src/serve/hub-app/reflections-page.tsx +95 -0
  424. package/src/serve/hub-app/reflections-st.ts +17 -0
  425. package/src/serve/hub-app/releases/releases-page.tsx +28 -4
  426. package/src/serve/hub-app/releases/releases-st.ts +1 -1
  427. package/src/serve/hub-app/releases.css +0 -1
  428. package/src/serve/hub-app/repo-sections.ts +9 -5
  429. package/src/serve/hub-app/repo-st.ts +35 -8
  430. package/src/serve/hub-app/review/code-colors.ts +30 -0
  431. package/src/serve/hub-app/review/diff-view.tsx +75 -0
  432. package/src/serve/hub-app/review/dock.tsx +104 -0
  433. package/src/serve/hub-app/review/draft-card.tsx +163 -0
  434. package/src/serve/hub-app/review/group-block.tsx +209 -0
  435. package/src/serve/hub-app/review/instructions-view.tsx +116 -0
  436. package/src/serve/hub-app/review/item-verdict.tsx +38 -0
  437. package/src/serve/hub-app/review/kind-states.tsx +193 -0
  438. package/src/serve/hub-app/review/kind-view.tsx +1 -37
  439. package/src/serve/hub-app/review/kit.tsx +75 -29
  440. package/src/serve/hub-app/review/lane-bar.tsx +64 -0
  441. package/src/serve/hub-app/review/note-place.ts +1 -1
  442. package/src/serve/hub-app/review/object-card.tsx +62 -0
  443. package/src/serve/hub-app/review/object-panel.tsx +179 -0
  444. package/src/serve/hub-app/review/question-views.tsx +385 -0
  445. package/src/serve/hub-app/review/review-board.tsx +2 -2
  446. package/src/serve/hub-app/review/review-cells.tsx +148 -87
  447. package/src/serve/hub-app/review/review-kit.ts +27 -1
  448. package/src/serve/hub-app/review/review-list.tsx +160 -65
  449. package/src/serve/hub-app/review/review-page.tsx +12 -12
  450. package/src/serve/hub-app/review/review-st.ts +174 -47
  451. package/src/serve/hub-app/review/review-thread.tsx +214 -53
  452. package/src/serve/hub-app/review/review-views.tsx +494 -159
  453. package/src/serve/hub-app/review/thread-close.tsx +124 -0
  454. package/src/serve/hub-app/review/thread-control-st.ts +115 -0
  455. package/src/serve/hub-app/review/thread-control.tsx +74 -0
  456. package/src/serve/hub-app/review/thread-st.ts +288 -41
  457. package/src/serve/hub-app/review/trailer-card.tsx +2 -2
  458. package/src/serve/hub-app/review/trailer-page.tsx +37 -16
  459. package/src/serve/hub-app/review/trailer-st.ts +41 -7
  460. package/src/serve/hub-app/review/trailer-timeline.tsx +2 -2
  461. package/src/serve/hub-app/review.css +462 -97
  462. package/src/serve/hub-app/section-head.tsx +51 -0
  463. package/src/serve/hub-app/side-lists.ts +72 -0
  464. package/src/serve/hub-app/sidebar.tsx +6 -3
  465. package/src/serve/hub-app/site/site-part.tsx +2 -8
  466. package/src/serve/hub-app/site/site-st.ts +4 -4
  467. package/src/serve/hub-app/social/calendar.tsx +5 -11
  468. package/src/serve/hub-app/social/comms-page.tsx +43 -15
  469. package/src/serve/hub-app/social/kit.tsx +32 -13
  470. package/src/serve/hub-app/social/next-release.tsx +3 -5
  471. package/src/serve/hub-app/social/post-card.tsx +142 -49
  472. package/src/serve/hub-app/social/post-page.tsx +80 -0
  473. package/src/serve/hub-app/social/problems.tsx +5 -9
  474. package/src/serve/hub-app/social/serial-writes.ts +13 -0
  475. package/src/serve/hub-app/social/social-model.ts +24 -5
  476. package/src/serve/hub-app/social/social-page.tsx +95 -36
  477. package/src/serve/hub-app/social/social-st.ts +162 -41
  478. package/src/serve/hub-app/social/stage-popup.tsx +1 -1
  479. package/src/serve/hub-app/social/stage-st.ts +1 -1
  480. package/src/serve/hub-app/social/step-layout.ts +1 -1
  481. package/src/serve/hub-app/social.css +10 -17
  482. package/src/serve/hub-app/space-st.ts +209 -0
  483. package/src/serve/hub-app/space-view.tsx +196 -0
  484. package/src/serve/hub-app/space.css +27 -0
  485. package/src/serve/hub-app/stores/stores-page.tsx +97 -25
  486. package/src/serve/hub-app/stores/stores-st.ts +44 -19
  487. package/src/serve/hub-app/stores.css +6 -1
  488. package/src/serve/hub-app/theme-st.ts +22 -9
  489. package/src/serve/hub-app/thread-row.tsx +101 -0
  490. package/src/serve/hub-app/time-ago.tsx +3 -2
  491. package/src/serve/hub-app/time-charts.tsx +291 -0
  492. package/src/serve/hub-app/time-pages.tsx +749 -0
  493. package/src/serve/hub-app/time-st.ts +162 -0
  494. package/src/serve/hub-app/time-view.tsx +77 -0
  495. package/src/serve/hub-app/time.css +135 -0
  496. package/src/serve/hub-app/tree-build.ts +52 -42
  497. package/src/serve/hub-app/tree-row.tsx +3 -11
  498. package/src/serve/hub-app/tree-svc.ts +18 -9
  499. package/src/serve/hub-app/urls-svc.ts +154 -0
  500. package/src/serve/hub-app/urls-view.tsx +117 -0
  501. package/src/serve/hub-app/urls.css +30 -0
  502. package/src/serve/hub-app/vault-st.ts +127 -0
  503. package/src/serve/hub-app/vault-view.tsx +154 -0
  504. package/src/serve/hub-app/vault.css +38 -0
  505. package/src/serve/hub-app/veille/veille-page.tsx +2 -11
  506. package/src/serve/hub-app/veille/veille-st.ts +12 -10
  507. package/src/serve/hub-app/veille.css +0 -1
  508. package/src/serve/hub-app/waiting-svc.ts +29 -0
  509. package/src/serve/hub-app/when-view.tsx +6 -3
  510. package/src/serve/hub-app/wiki-st.ts +30 -4
  511. package/src/serve/hub-app/wikis-view.tsx +6 -5
  512. package/src/serve/hub-runtime.ts +35 -8
  513. package/src/serve/project-gutter-route.ts +42 -19
  514. package/src/serve/project-gutter.ts +16 -50
  515. package/src/serve/same-origin.ts +13 -0
  516. package/src/serve/secret-gate.ts +21 -0
  517. package/src/serve/serve-hub.ts +38 -20
  518. package/src/serve/tailnet-caller.ts +117 -0
  519. package/src/shipkit-files.ts +16 -2
  520. package/src/shipkit.ts +3 -3
  521. package/src/shot/shooter.ts +616 -420
  522. package/src/shot/shot-ask.ts +246 -155
  523. package/src/site/desk.ts +4 -4
  524. package/src/smoke/run-smoke.ts +6 -6
  525. package/src/social/brands.ts +4 -0
  526. package/src/social/card-drafts.ts +11 -19
  527. package/src/social/cover.ts +202 -0
  528. package/src/social/desk-index.ts +34 -13
  529. package/src/social/discord-layout.ts +37 -13
  530. package/src/social/drafts.ts +7 -4
  531. package/src/social/import-drafts.ts +244 -0
  532. package/src/social/kind-pages.ts +3 -3
  533. package/src/social/kinds.ts +1 -1
  534. package/src/social/load.ts +111 -65
  535. package/src/social/media-kind.ts +68 -160
  536. package/src/social/media-of.ts +5 -4
  537. package/src/social/open.ts +3 -2
  538. package/src/social/post-object.ts +120 -0
  539. package/src/social/post-sources.ts +136 -0
  540. package/src/social/post-text.ts +103 -0
  541. package/src/social/posts.ts +378 -0
  542. package/src/social/presence.ts +7 -5
  543. package/src/social/publish/discord.ts +5 -2
  544. package/src/social/publish/index.ts +17 -5
  545. package/src/social/publish/secret.ts +4 -4
  546. package/src/social/release-stage.ts +79 -63
  547. package/src/social/routes.ts +89 -24
  548. package/src/social/stage.ts +43 -58
  549. package/src/social/stats.ts +12 -9
  550. package/src/social/strip.ts +4 -1
  551. package/src/social/text.ts +4 -3
  552. package/src/social/thumbnail.ts +347 -0
  553. package/src/social/tracker.ts +1 -1
  554. package/src/social/writes.ts +12 -29
  555. package/src/stores/collection.ts +15 -11
  556. package/src/stores/desk.ts +246 -47
  557. package/src/stores/model.ts +72 -6
  558. package/src/stores/routes.ts +37 -12
  559. package/src/stores/unit.ts +16 -10
  560. package/src/suite/judge-suites.ts +41 -11
  561. package/src/suite/select.ts +45 -3
  562. package/src/suite/suite-cli.ts +16 -10
  563. package/src/trailer/bed.ts +1 -1
  564. package/src/trailer/build.ts +134 -21
  565. package/src/trailer/ffmpeg.ts +7 -0
  566. package/src/trailer/fonts.ts +3 -2
  567. package/src/trailer/grammar.ts +201 -2
  568. package/src/trailer/graph.ts +42 -5
  569. package/src/trailer/look.ts +21 -0
  570. package/src/trailer/mock.ts +154 -0
  571. package/src/trailer/passage.ts +65 -26
  572. package/src/trailer/score/heard.ts +89 -0
  573. package/src/trailer/score/sound.ts +14 -8
  574. package/src/trailer/sound/eleven.ts +33 -3
  575. package/src/trailer/sound/run.ts +16 -6
  576. package/src/trailer/stitch.ts +26 -5
  577. package/src/trailer/titles.ts +82 -19
  578. package/src/trailer/versions.ts +1 -3
  579. package/src/trailer/vertical.ts +3 -1
  580. package/src/urls/frame.ts +195 -0
  581. package/src/urls/routes.ts +43 -0
  582. package/src/urls/rows.ts +171 -0
  583. package/src/urls/unit.ts +73 -0
  584. package/src/vault/house-keys.ts +42 -0
  585. package/src/vault/layout.ts +50 -0
  586. package/src/vault/policy.ts +165 -0
  587. package/src/vault/vault-audit.ts +276 -0
  588. package/src/vault/vault-client.ts +40 -0
  589. package/src/vault/vault-config.ts +159 -0
  590. package/src/vault/vault-destroy.ts +78 -0
  591. package/src/vault/vault-handover.ts +305 -0
  592. package/src/vault/vault-http.ts +360 -0
  593. package/src/vault/vault-import.ts +213 -0
  594. package/src/vault/vault-init.ts +328 -0
  595. package/src/vault/vault-minter.ts +271 -0
  596. package/src/vault/vault-restore.ts +333 -0
  597. package/src/vault/vault-serve.ts +342 -0
  598. package/src/vault/vault-snapshot.ts +281 -0
  599. package/src/veille/asks.ts +1 -1
  600. package/src/veille/desk.ts +2 -2
  601. package/src/veille/identity.ts +2 -2
  602. package/src/wiki/graph-pages.ts +13 -1
  603. package/src/wiki/scan-md.ts +1 -1
  604. package/src/asks/asks-queue.ts +0 -266
  605. package/src/social/migrate.ts +0 -123
@@ -6,19 +6,21 @@
6
6
  // under its row
7
7
  import { observer } from 'mobx-react-lite'
8
8
  import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'
9
+ import { createPortal } from 'react-dom'
9
10
  import type { VersionCell } from '../../../review/cells.ts'
10
- import { isChoice, isGallery, isPair, onFrame, STARS, STATUS_LABEL, thumbFileOf, tileName, viewFilesOf, viewName, viewTag, type GalleryTile, type GalleryView, type Item, type MediaView, type Rect, type ReviewClip, type ReviewMark, type ReviewView, type Side } from '../../../review/model.ts'
11
+ import { isChoice, isGallery, isPair, onFrame, 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'
11
12
  import { AutoText } from '../auto-text.tsx'
12
13
  import type { ClipSt } from './clip-st.ts'
13
- import { blurOnEscape, FIT_ROOM, keepFocus, PAIR_NAMES, REACTIONS, secs, SIDE_LABEL } from './kit.tsx'
14
- import { GALLERY_FITS, GALLERY_MODES, TILE_H, ZOOMS, type GalleryFit, type GalleryMode, type Zoom } from './review-kit.ts'
14
+ import { blurOnEscape, boxReaction, FIT_ROOM, keepFocus, Key, PAIR_NAMES, PLACE_TIPS, REACTIONS, secs, SIDE_LABEL } from './kit.tsx'
15
+ import { BOX_ZOOM, boxStep, GALLERY_FITS, GALLERY_MODES, PREVIEW_H, TILE_H, ZOOMS, type BoxZoom, type GalleryFit, type GalleryMode, type Zoom } from './review-kit.ts'
15
16
  import { notePlace } from './note-place.ts'
16
17
  import { COMPARE_MODES, drawnSide, type CompareMode, type CompareSt, type PairSide, type ReviewSt } from './review-st.ts'
17
- import { TILE_FILTERS, viewDom, viewKind, viewKey, type ThreadSt, type TileFilter } from './thread-st.ts'
18
- import { Caret } from '../icons.tsx'
18
+ import { TILE_FILTERS, viewDom, viewKind, type SaidNote, type ThreadSt, type TileFilter } from './thread-st.ts'
19
+ import { Caret, Icon, ICON } from '../icons.tsx'
20
+ import { Pop } from '../floating.tsx'
19
21
 
20
- const ZOOM_LABEL: Record<Zoom, string> = { fit: 'Fit', '1': '100 %', '1.5': '150 %', '2': '200 %' }
21
- const toneClass = (s: string | undefined): string => (s ? ` re-${s}` : '')
22
+ const ZOOM_LABEL: Record<Zoom, string> = { preview: 'Preview', fit: 'Fit', '1': '100 %', '1.5': '150 %', '2': '200 %' }
23
+ export const toneClass = (s: string | undefined): string => (s ? ` re-${s}` : '')
22
24
 
23
25
  /** one version as its views draw it: `live` when his answer goes to it and it draws his draft; `claim` when it is the
24
26
  * newest while his answer sits on an older version: it takes his marks, and the first one brings his answer here */
@@ -32,9 +34,9 @@ export interface Ver {
32
34
 
33
35
  const itemOf = (ver: Ver): Item => ver.cell.item
34
36
  /** the version takes his marks: OK, Fix, No, a rectangle, a word, a star, a pick */
35
- const takes = (ver: Ver): boolean => ver.live || ver.claim
37
+ export const takes = (ver: Ver): boolean => ver.live || ver.claim
36
38
  /** a mark on a claiming version: his answer comes to it first, then the mark lands in its own draft */
37
- const mark = (ver: Ver, f: () => void): void => {
39
+ export const mark = (ver: Ver, f: () => void): void => {
38
40
  if (ver.claim) ver.card.answerNewest()
39
41
  f()
40
42
  }
@@ -49,7 +51,8 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
49
51
  // a draft card's history is no view of its own: its frames cycle in place over the live one
50
52
  const history = item.wip ? views.find(isGallery) : undefined
51
53
  // a view an agent's update holds draws in that update's cell, at its time in the thread
52
- const owned = new Set(card.updateViewsOf(item.id))
54
+ const owned = card.messageViewsOf(item.id)
55
+ if (views.length > 0 && views.every((_, i) => owned.has(i))) return null
53
56
  const options = rows || (card.full[item.id] === true)
54
57
  return (
55
58
  <div className="rv-views">
@@ -69,7 +72,7 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
69
72
  </label>
70
73
  ) : null}
71
74
  {views.some((v) => !isGallery(v)) ? (
72
- <span className="seg" title="the zoom of every view of every card">
75
+ <span className="seg" title="the zoom of every view of every version">
73
76
  {ZOOMS.map((z) => <button key={z} className={rv.zoom === z ? 'on' : ''} onMouseDown={keepFocus} onClick={() => rv.setZoom(z)}>{ZOOM_LABEL[z]}</button>)}
74
77
  </span>
75
78
  ) : null}
@@ -84,34 +87,45 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
84
87
  })
85
88
 
86
89
  /** one view as a sub cell: its number and title, its kind, the owner's reaction, its tools, what was said on it and his word, then the view */
87
- export const ViewCell = observer(({ ver, v: live, i, frames, noted = true }: { ver: Ver; v: ReviewView; i: number; frames?: GalleryView; noted?: boolean }) => {
90
+ export const ViewCell = observer(({ ver, v: live, i, frames, noted = true, boxed = false }: { ver: Ver; v: ReviewView; i: number; frames?: GalleryView; noted?: boolean; boxed?: boolean }) => {
88
91
  const { rv, card, cell } = ver
89
92
  const past = frames && card.frame !== null ? frames.gallery[card.frame] : undefined
90
93
  const v: ReviewView = past && !isGallery(live) ? { ...live, files: { image: past.file }, size: past.size } : live
91
94
  const media = isGallery(v) ? null : v
92
95
  const open = card.viewOpen(cell.id, i)
93
- const zoom = rv.zoom
96
+ // the lightbox draws the view at its own size (ViewBox holds the control), whatever the thread's zoom
97
+ const zoom: Zoom | BoxZoom = boxed ? rv.boxZoom : rv.zoom
94
98
  const shown = card.reactionShown(cell, i)
95
99
  const active = ver.live && card.view === i
96
100
  const gone = goneOf(ver, v)
101
+ const body = gone.length > 0 ? <Gone files={gone} /> : isGallery(v) ? <Gallery ver={ver} v={v} view={i} head={!boxed} /> : <MediaBody ver={ver} v={v} i={i} zoom={zoom} boxed={boxed} />
102
+ // the lightbox draws its own bars around the view (ViewBox): the cell is its body alone
103
+ if (boxed)
104
+ return (
105
+ <section className={`rv-view boxed${toneClass(shown?.status)}`}>
106
+ {frames ? <FrameSlider card={card} frames={frames} /> : null}
107
+ {body}
108
+ </section>
109
+ )
97
110
  return (
98
111
  <section id={viewDom(cell.id, i)} className={`rv-view${toneClass(shown?.status)}${active ? ' active' : ''}${open ? '' : ' folded'}`}>
99
112
  <header className="rv-viewhead">
100
113
  <button className="rv-foldbtn" aria-label={open ? 'fold this view' : 'unfold this view'} aria-expanded={open} onMouseDown={keepFocus} onClick={() => card.toggleView(cell.id, i)}><Caret open={open} /></button>
101
- <span className="rv-viewn">{viewTag(cell.n, i)}</span>
102
- <h4 className="rv-viewname" onClick={() => card.toggleView(cell.id, i)}>{v.label || <span className="rv-dim">{viewName(v, i)}</span>}</h4>
103
- <span className="rv-kind">{viewKind(v, false)}</span>
114
+ <h4 className="rv-viewname" onClick={() => card.toggleView(cell.id, i)}>{v.label || <span className="rv-dim">{viewKind(v, false)}</span>}</h4>
115
+ {v.label ? <span className="rv-kind">{viewKind(v, false)}</span> : null}
104
116
  {takes(ver) ? <ReactionToggles ver={ver} view={i} /> : shown?.status ? <SentReaction status={shown.status} /> : null}
105
117
  <span className="sp" />
106
118
  {open && media?.marks && media.marks.length > 0 ? <button className={rv.marksOn ? 'primary' : ''} onMouseDown={keepFocus} onClick={() => rv.toggleMarks()}>marks · M</button> : null}
107
- {open && media && isPair(media.files) && !media.audio && !rv.phone.on ? <CompareModes c={rv.compare} clip={media.clip !== undefined} /> : null}
119
+ {/* the compare modes act on a pair drawn full: a preview has none */}
120
+ {open && zoom !== 'preview' && media && isPair(media.files) && !media.audio && !rv.phone.on ? <CompareModes c={rv.compare} clip={media.clip !== undefined} /> : null}
108
121
  <StageButtons ver={ver} v={v} i={i} />
122
+ <span className="rv-viewn" title={`view ${viewTag(cell.n, i)}`}>{viewTag(cell.n, i)}</span>
109
123
  </header>
110
124
  <ViewNotes ver={ver} i={i} gallery={isGallery(v)} />
111
125
  {open ? (
112
126
  <div className="rv-viewbody">
113
127
  {frames ? <FrameSlider card={card} frames={frames} /> : null}
114
- {gone.length > 0 ? <Gone files={gone} /> : isGallery(v) ? <Gallery ver={ver} v={v} view={i} /> : <MediaBody ver={ver} v={v} i={i} zoom={zoom} />}
128
+ {body}
115
129
  {noted && media?.note ? <div className="rv-viewnote">{media.note}</div> : null}
116
130
  </div>
117
131
  ) : null}
@@ -119,27 +133,26 @@ export const ViewCell = observer(({ ver, v: live, i, frames, noted = true }: { v
119
133
  )
120
134
  })
121
135
 
122
- /** « 📤 » on a view: the stage popup on that media; a pair offers its after, its before, and the wipe of two images; a
123
- * gallery opens on its first tile, the popup's strip holding every other; a sound alone stages nothing */
136
+ /** the stage icon on a view: the stage popup on that media; a pair's icon opens a menu of its after, its before, and
137
+ * the wipe of two images; a gallery opens on its first tile, the popup's strip holding every other; a sound alone
138
+ * stages nothing */
124
139
  const StageButtons = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number }) => {
125
140
  const { rv } = ver
126
141
  const item = itemOf(ver)
127
- if (item.origin.by !== 'agent') return null
142
+ if (item.origin.by !== 'agent' || v.audio) return null
128
143
  const at = `${item.id}#${i}`
129
- const btn = (key: string, label: string, tip: string) => (
130
- <button key={key} className="ghost rv-stagebtn" title={tip} onMouseDown={keepFocus} onClick={() => rv.openStage(key)}>
131
- {label}
132
- </button>
133
- )
134
- if (isGallery(v)) return btn(`${at}/0`, '📤', 'stage a tile of this grid as a post')
135
- if (v.audio) return null
136
- if (!isPair(v.files)) return btn(at, '📤', 'stage this media as a post: a draft in comms, never posted')
144
+ const icon = <Icon d={ICON.stage} />
145
+ if (isGallery(v) || !isPair(v.files))
146
+ return <button className="ghost rv-iconbtn rv-stagebtn" title={isGallery(v) ? 'stage a tile of this grid as a post' : 'stage this media as a post: a draft in comms, never posted'} aria-label="stage as a post" onMouseDown={keepFocus} onClick={() => rv.openStage(isGallery(v) ? `${at}/0` : at)}>{icon}</button>
147
+ const entries: [string, string][] = [[`${at}.after`, 'the after'], [`${at}.before`, 'the before'], ...(v.clip ? [] : [[`${at}.wipe`, 'a wipe from before to after'] as [string, string]])]
137
148
  return (
138
- <>
139
- {btn(`${at}.after`, '📤 after', 'stage the after as a post')}
140
- {btn(`${at}.before`, '📤 before', 'stage the before as a post')}
141
- {v.clip ? null : btn(`${at}.wipe`, '📤 wipe', 'stage the pair as one wipe from before to after')}
142
- </>
149
+ <Pop className="ghost rv-iconbtn rv-stagebtn" aria-label="stage as a post" title="stage as a post: a draft in comms, never posted" label={icon} placement="bottom-end">
150
+ {(close) => (
151
+ <div className="rv-stagemenu">
152
+ {entries.map(([key, words]) => <button key={key} className="ghost" onClick={() => { close(); rv.openStage(key) }}>stage {words}</button>)}
153
+ </div>
154
+ )}
155
+ </Pop>
143
156
  )
144
157
  })
145
158
 
@@ -154,19 +167,7 @@ const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: num
154
167
  if (said.length === 0 && draft.length === 0 && !(takes(ver) && word)) return null
155
168
  return (
156
169
  <div className="rv-viewnotes">
157
- {said.map((s, k) => {
158
- const tile = s.reaction?.tile ?? s.rect?.r.tile
159
- const where = tileWhere(views[i], tile)
160
- return (
161
- <div key={k} className={`rv-said${s.reaction?.status ? ` re-${s.reaction.status}` : s.rect ? ' rect' : ''}`}>
162
- <span className="rv-saidmark">
163
- {s.rect ? `⬚ ${s.rect.n}${s.rect.r.side ? ` ${SIDE_LABEL[s.rect.r.side]}` : ''}${s.rect.r.t !== undefined ? ` · ${secs(s.rect.r.t)}` : ''}${where ? ` ${where}` : ''}` : `${REACTIONS.find((o) => o.status === s.reaction?.status)?.glyph ?? ''}${s.reaction?.stars ? ` ★${s.reaction.stars}` : ''}${where ? ` ${where}` : ''}`}
164
- </span>
165
- <span className="rv-saidtext">{(s.rect ? s.rect.r.comment : s.reaction?.comment) || <i className="rv-dim">{s.reaction?.status ? REACTIONS.find((o) => o.status === s.reaction?.status)?.tip : 'no word'}</i>}</span>
166
- <span className="rv-saidwho rv-dim">you · {STATUS_LABEL[s.verdict.verdict]} · v{cell.n}</span>
167
- </div>
168
- )
169
- })}
170
+ {said.map((s, k) => <SaidLine key={k} s={s} v={views[i]} n={cell.n} />)}
170
171
  {draft.length > 0 ? (
171
172
  <div className="rv-drafthead">
172
173
  <b>your notes</b>
@@ -192,6 +193,21 @@ const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: num
192
193
  )
193
194
  })
194
195
 
196
+ /** one thing an answer said on a view: a rectangle or a reaction, its word, whose answer */
197
+ const SaidLine = ({ s, v, n }: { s: SaidNote; v: ReviewView | undefined; n: number }) => {
198
+ const where = tileWhere(v, s.reaction?.tile ?? s.rect?.r.tile)
199
+ const o = REACTIONS.find((x) => x.status === s.reaction?.status)
200
+ return (
201
+ <div className={`rv-said${s.reaction?.status ? ` re-${s.reaction.status}` : s.rect ? ' rect' : ''}`}>
202
+ <span className="rv-saidmark">
203
+ {s.rect ? `⬚ ${s.rect.n}${s.rect.r.side ? ` ${SIDE_LABEL[s.rect.r.side]}` : ''}${s.rect.r.t !== undefined ? ` · ${secs(s.rect.r.t)}` : ''}${where ? ` ${where}` : ''}` : `${o?.glyph ?? ''}${s.reaction?.stars ? ` ★${s.reaction.stars}` : ''}${where ? ` ${where}` : ''}`}
204
+ </span>
205
+ <span className="rv-saidtext">{(s.rect ? s.rect.r.comment : s.reaction?.comment) || <i className="rv-dim">{s.reaction?.status ? o?.tip : 'no word'}</i>}</span>
206
+ <span className="rv-saidwho rv-dim">you · {STATUS_LABEL[s.verdict.verdict]} · v{n}</span>
207
+ </div>
208
+ )
209
+ }
210
+
195
211
  const isGalleryView = (v: ReviewView | undefined): v is GalleryView => v !== undefined && isGallery(v)
196
212
 
197
213
  /** the name of a gallery tile a note is on, or null off a gallery */
@@ -199,7 +215,7 @@ const tileWhere = (v: ReviewView | undefined, tile: number | undefined): string
199
215
  tile !== undefined && isGalleryView(v) ? (v.gallery[tile] ? tileName(v.gallery[tile]) : `tile ${tile + 1}`) : null
200
216
 
201
217
  /** a reaction an older answer gave, as a still pill */
202
- const SentReaction = ({ status }: { status: string }) => {
218
+ export const SentReaction = ({ status }: { status: string }) => {
203
219
  const o = REACTIONS.find((r) => r.status === status)
204
220
  return o ? <span className={`rv-react on re-${status}`}>{o.glyph} {o.label}</span> : null
205
221
  }
@@ -257,7 +273,7 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
257
273
  ) : null}
258
274
  {playable?.audio ? <a className="rv-dl" href={rv.fileUrl(id, file)} download={`${id}-${file}`} title="download the sound">⤓</a> : null}
259
275
  {choice && takes(ver) ? (
260
- <button className={`rv-pick${picked ? ' on' : ''}`} title={held ? 'your pick: click again to take it back, the card waits for you again' : 'pick this one: it is your answer (P)'} disabled={card.busy} onClick={() => mark(ver, () => void card.choose(i))}>
276
+ <button className={`rv-pick${picked ? ' on' : ''}`} title={held ? 'your pick: click again to take it back, the version waits for you again' : 'pick this one: it is your answer (P)'} disabled={card.busy} onClick={() => mark(ver, () => void card.choose(i))}>
261
277
  {picked ? '✓ picked' : 'pick'}
262
278
  {held ? <span className="rv-undo" aria-label="click again to take it back"> ↺</span> : null}
263
279
  </button>
@@ -293,7 +309,7 @@ const goneOf = (ver: Ver, v: ReviewView): string[] => {
293
309
  const Gone = ({ files }: { files: readonly string[] }) => (
294
310
  <div className="rv-gone">
295
311
  <b>the media is gone from the store</b>
296
- <span className="rv-dim">{files.join(', ')}: deleted after the card was sent; its words and answers stay</span>
312
+ <span className="rv-dim">{files.join(', ')}: deleted after the version was sent; its words and answers stay</span>
297
313
  </div>
298
314
  )
299
315
 
@@ -373,16 +389,22 @@ const FrameSlider = observer(({ card, frames }: { card: ThreadSt; frames: Galler
373
389
  )
374
390
  })
375
391
 
376
- /** the owner's reaction to one view or tile of the newest version: OK, fix or no; a click on the chosen one clears it */
377
- const ReactionToggles = observer(({ ver, view, tile, small }: { ver: Ver; view: number; tile?: number; small?: boolean }) => {
392
+ /** the owner's reaction to one view or tile of the newest version, or to one message of a draft card (`post`): OK, fix
393
+ * or no; a click on the chosen one clears it. `said` hears the reaction a click set */
394
+ export const ReactionToggles = observer(({ ver, view, tile, post, small, keys, said }: { ver: Ver; view: number; tile?: number; post?: string; small?: boolean; keys?: boolean; said?: (status: ReviewStatus) => void }) => {
378
395
  const { card } = ver
379
- const cur = ver.claim ? undefined : card.reactionOf(view, tile)?.status
396
+ const cur = ver.claim ? undefined : card.reactionOf(view, tile, post)?.status
397
+ const tip = (o: (typeof REACTIONS)[number]): string => (post !== undefined ? (PLACE_TIPS[o.status] ?? o.tip) : o.tip)
380
398
  return (
381
399
  <span className="rv-reacts">
382
400
  {REACTIONS.map((o) => (
383
- <button key={o.status} title={o.tip} className={`rv-react re-${o.status}${small ? '' : ' big'}${cur === o.status ? ' on' : ''}${cur && cur !== o.status ? ' off' : ''}`}
384
- onMouseDown={keepFocus} onClick={() => mark(ver, () => card.react(view, tile, o.status))}>
401
+ <button key={o.status} title={keys ? `${tip(o)} (${o.key})` : tip(o)} className={`rv-react re-${o.status}${small ? '' : ' big'}${cur === o.status ? ' on' : ''}${cur && cur !== o.status ? ' off' : ''}`}
402
+ onMouseDown={keepFocus} onClick={() => {
403
+ mark(ver, () => card.react(view, tile, o.status, post))
404
+ if (cur !== o.status) said?.(o.status)
405
+ }}>
385
406
  {o.glyph} {o.label}
407
+ {keys ? <Key k={o.key} /> : null}
386
408
  </button>
387
409
  ))}
388
410
  </span>
@@ -393,39 +415,18 @@ const ReactionToggles = observer(({ ver, view, tile, small }: { ver: Ver; view:
393
415
  * list, one image a row at full width; grid, its tiles at the slider's height, one row per asset when its tiles are
394
416
  * variants (a group each). A head picks the mode and the fit, filters the tiles, flips every tile to its before, adds
395
417
  * the small sizes. A phone has no room for a side list, so its tabs read as the list */
396
- const Gallery = observer(({ ver, v, view }: { ver: Ver; v: GalleryView; view: number }) => {
397
- const { rv, card } = ver
398
- const befores = v.gallery.some((t) => t.before)
418
+ const Gallery = observer(({ ver, v, view, head = true }: { ver: Ver; v: GalleryView; view: number; head?: boolean }) => {
419
+ const { rv } = ver
399
420
  const tiles = v.gallery.map((t, k) => ({ t, k }))
400
421
  const sections = v.gallery.some((t) => t.group) ? [...new Set(v.gallery.map((t) => t.group ?? ''))].map((g) => ({ g, tiles: tiles.filter((x) => (x.t.group ?? '') === g) })) : null
401
- const mode: GalleryMode = rv.galleryMode === 'tabs' && rv.phone.on ? 'list' : rv.galleryMode
422
+ const mode = galleryModeOf(rv)
402
423
  const draw = (xs: typeof tiles): ReactNode =>
403
424
  mode === 'list'
404
425
  ? <div className="rv-gallerylist">{xs.map(({ t, k }) => <Tile key={k} ver={ver} v={v} view={view} t={t} k={k} fill />)}</div>
405
426
  : <div className="rv-gallery">{xs.map(({ t, k }) => <Tile key={k} ver={ver} v={v} view={view} t={t} k={k} />)}</div>
406
427
  return (
407
428
  <div className="rv-gallerywrap">
408
- <div className="rv-galleryhead rv-small">
409
- <span className="seg" role="group" aria-label="how the images show">
410
- {GALLERY_MODES.map((m) => (
411
- <button key={m} data-mode={m} className={rv.galleryMode === m ? 'on' : ''} title={GALLERY_MODE_TITLE[m]} onMouseDown={keepFocus} onClick={() => rv.setGalleryMode(m)}>{m}</button>
412
- ))}
413
- </span>
414
- {mode !== 'grid' ? (
415
- <span className="seg" role="group" aria-label="how a large image fits">
416
- {GALLERY_FITS.map((f) => (
417
- <button key={f} data-fit={f} className={rv.galleryFit === f ? 'on' : ''} title={GALLERY_FIT_TITLE[f]} onMouseDown={keepFocus} onClick={() => rv.setGalleryFit(f)}>{`fit ${f}`}</button>
418
- ))}
419
- </span>
420
- ) : null}
421
- <span className="seg" role="group" aria-label="which tiles show">
422
- {TILE_FILTERS.map((f) => (
423
- <button key={f} className={card.tileFilter === f ? 'on' : ''} onMouseDown={keepFocus} onClick={() => card.setTileFilter(f)}>{TILE_FILTER_LABEL[f]}</button>
424
- ))}
425
- </span>
426
- {befores ? <button className={`rv-chip${card.beforeAll ? ' on' : ''}`} title="every tile shows its before" onMouseDown={keepFocus} onClick={() => card.toggleBeforeAll()}>before</button> : null}
427
- <button className={`rv-chip${rv.tileSmall ? ' on' : ''}`} title="each tile also at 16, 32 and 64 px" onMouseDown={keepFocus} onClick={() => rv.toggleTileSmall()}>real size</button>
428
- </div>
429
+ {head ? <GalleryHead ver={ver} v={v} /> : null}
429
430
  {mode === 'tabs'
430
431
  ? <GalleryTabs ver={ver} v={v} view={view} />
431
432
  : sections
@@ -440,6 +441,39 @@ const Gallery = observer(({ ver, v, view }: { ver: Ver; v: GalleryView; view: nu
440
441
  )
441
442
  })
442
443
 
444
+ /** the mode a gallery draws in: a phone has no room for a side list, so its tabs read as the list */
445
+ const galleryModeOf = (rv: ReviewSt): GalleryMode => (rv.galleryMode === 'tabs' && rv.phone.on ? 'list' : rv.galleryMode)
446
+
447
+ /** a gallery's head: the mode, the fit, which tiles show, every tile at its before, the small sizes; the lightbox
448
+ * draws it in its own top bar */
449
+ const GalleryHead = observer(({ ver, v }: { ver: Ver; v: GalleryView }) => {
450
+ const { rv, card } = ver
451
+ const mode = galleryModeOf(rv)
452
+ return (
453
+ <div className="rv-galleryhead rv-small">
454
+ <span className="seg" role="group" aria-label="how the images show">
455
+ {GALLERY_MODES.map((m) => (
456
+ <button key={m} data-mode={m} className={rv.galleryMode === m ? 'on' : ''} title={GALLERY_MODE_TITLE[m]} onMouseDown={keepFocus} onClick={() => rv.setGalleryMode(m)}>{m}</button>
457
+ ))}
458
+ </span>
459
+ {mode !== 'grid' ? (
460
+ <span className="seg" role="group" aria-label="how a large image fits">
461
+ {GALLERY_FITS.map((f) => (
462
+ <button key={f} data-fit={f} className={rv.galleryFit === f ? 'on' : ''} title={GALLERY_FIT_TITLE[f]} onMouseDown={keepFocus} onClick={() => rv.setGalleryFit(f)}>{`fit ${f}`}</button>
463
+ ))}
464
+ </span>
465
+ ) : null}
466
+ <span className="seg" role="group" aria-label="which tiles show">
467
+ {TILE_FILTERS.map((f) => (
468
+ <button key={f} className={card.tileFilter === f ? 'on' : ''} onMouseDown={keepFocus} onClick={() => card.setTileFilter(f)}>{TILE_FILTER_LABEL[f]}</button>
469
+ ))}
470
+ </span>
471
+ {v.gallery.some((t) => t.before) ? <button className={`rv-chip${card.beforeAll ? ' on' : ''}`} title="every tile shows its before" onMouseDown={keepFocus} onClick={() => card.toggleBeforeAll()}>before</button> : null}
472
+ <button className={`rv-chip${rv.tileSmall ? ' on' : ''}`} title="each tile also at 16, 32 and 64 px" onMouseDown={keepFocus} onClick={() => rv.toggleTileSmall()}>real size</button>
473
+ </div>
474
+ )
475
+ })
476
+
443
477
  const GALLERY_MODE_TITLE: Record<GalleryMode, string> = {
444
478
  tabs: 'a list of the images on the left, the picked one large (↑ ↓ in the list walk it)',
445
479
  list: 'every image one under the other, at full width',
@@ -494,6 +528,8 @@ const TILE_FILTER_LABEL: Record<TileFilter, string> = { all: 'all', unrated: 'un
494
528
  const TILE_CHROME = 12
495
529
  const TILE_MIN_W = 150
496
530
  const TILE_WIDE = 1.6
531
+ /** what a large tile holds under its image: its label, its stars, OK Fix No and its word */
532
+ const TILE_UNDER = 128
497
533
 
498
534
  /** the small sizes an icon lives at */
499
535
  const SMALL_SIZES = [16, 32, 64] as const
@@ -501,12 +537,11 @@ const SMALL_SIZES = [16, 32, 64] as const
501
537
  /** one gallery tile: its image (its before while flipped or peeked), the small sizes, its label, stars, the variant
502
538
  * pick on a row, OK fix or no and a word; a click shows it large at the column's size. `fill`: drawn large in the
503
539
  * tabs or the list, at the fit he picks (the column's width, or the screen), with no click to shrink it */
504
- const Tile = observer(({ ver, v, view, t, k, fill = false }: { ver: Ver; v: GalleryView; view: number; t: GalleryTile; k: number; fill?: boolean }) => {
540
+ const Tile = observer(({ ver, v, view, t, k, fill = false, boxed = false }: { ver: Ver; v: GalleryView; view: number; t: GalleryTile; k: number; fill?: boolean; boxed?: boolean }) => {
505
541
  const { rv, card, cell } = ver
506
542
  const id = itemOf(ver).id
507
- const big = card.bigTile === `${viewKey(id, view)}/${k}`
508
543
  const r = card.reactionShown(cell, view, k)
509
- if (!big && !card.tileShown(r)) return null
544
+ if (!boxed && !card.tileShown(r)) return null
510
545
  const live = takes(ver)
511
546
  const h = rv.tileH
512
547
  const ratio = t.size.w / t.size.h
@@ -515,14 +550,16 @@ const Tile = observer(({ ver, v, view, t, k, fill = false }: { ver: Ver; v: Gall
515
550
  const ih = Math.round(iw / ratio)
516
551
  const file = t.before && card.showsBefore(view, k) ? t.before : t.file
517
552
  const thumb = rv.thumbUrl(id, file)
518
- const src = big || fill || h > TILE_H.thumb ? rv.fitUrl(id, file) : thumb
519
- const toggle = (): void => { if (!fill) card.toggleTile(id, view, k) }
553
+ const src = boxed || fill || h > TILE_H.thumb ? rv.fitUrl(id, file) : thumb
554
+ // a click shows the tile large in the lightbox, where ← → step through the gallery
555
+ const toggle = (): void => { if (!boxed) card.openBox(cell.id, view, k) }
520
556
  const aspect = `${t.size.w} / ${t.size.h}`
521
- const screen = { width: `min(100%, calc((100vh - ${FIT_ROOM}px) * ${ratio}))`, aspectRatio: aspect }
522
- const imgStyle = fill ? (rv.galleryFit === 'width' ? { width: '100%', aspectRatio: aspect } : screen) : big ? screen : { width: iw, height: ih }
523
- const title = live ? (fill ? 'drag to circle a spot' : 'drag to circle a spot, click to enlarge') : fill ? undefined : big ? 'click to shrink' : 'click to enlarge'
557
+ // the height a fit takes: the column's, or the lightbox's stage (--fit-h, review.css), less what sits under the image
558
+ const screen = { width: `min(100%, calc((var(--fit-h, 100vh - ${FIT_ROOM - TILE_UNDER}px) - ${TILE_UNDER}px) * ${ratio}))`, aspectRatio: aspect }
559
+ const imgStyle = boxed ? screen : fill ? (rv.galleryFit === 'width' ? { width: '100%', aspectRatio: aspect } : screen) : { width: iw, height: ih }
560
+ const title = boxed ? (live ? 'drag to circle a spot' : undefined) : live ? 'drag to circle a spot, click to see it large' : 'click to see it large'
524
561
  return (
525
- <div className={`rv-tile${big ? ' big' : ''}${fill ? ' fill' : ''}${r?.picked ? ' picked' : ''}${toneClass(r?.status)}`} style={big || fill ? undefined : { width: Math.max(iw, TILE_MIN_W) + TILE_CHROME }}
562
+ <div className={`rv-tile${boxed ? ' big' : ''}${fill ? ' fill' : ''}${r?.picked ? ' picked' : ''}${toneClass(r?.status)}`} style={boxed || fill ? undefined : { width: Math.max(iw, TILE_MIN_W) + TILE_CHROME }}
526
563
  onMouseEnter={live ? () => card.setHoverTile({ view, tile: k }) : undefined} onMouseLeave={live ? () => card.setHoverTile(null) : undefined}>
527
564
  <div className="rv-tileimg" onClick={live ? undefined : toggle} title={title} style={imgStyle}>
528
565
  <Marks ver={ver} src={src} side={undefined} view={view} tile={k} onTap={toggle} />
@@ -537,13 +574,13 @@ const Tile = observer(({ ver, v, view, t, k, fill = false }: { ver: Ver; v: Gall
537
574
  {SMALL_SIZES.map((px) => <img key={px} src={thumb} alt="" width={px} height={px} title={`${px} px`} draggable={false} loading="lazy" />)}
538
575
  </div>
539
576
  ) : null}
540
- <div className="rv-tilelabel" title={t.label}>{t.label}</div>
577
+ {boxed ? null : <div className="rv-tilelabel" title={t.label}>{t.label}</div>}
541
578
  {live || r?.stars ? <Stars ver={ver} view={view} tile={k} given={r?.stars} /> : null}
542
579
  {t.group && (live || r?.picked) ? (
543
580
  <button className={`rv-chip rv-keep${r?.picked ? ' on' : ''}`} disabled={!live} title={`keep this one for ${t.group}: one a row`} onMouseDown={keepFocus}
544
581
  onClick={() => mark(ver, () => card.pickTile(view, k, t.group ?? '', v.gallery))}>{r?.picked ? '✓ kept' : 'keep'}</button>
545
582
  ) : null}
546
- {live ? (
583
+ {boxed ? null : live ? (
547
584
  <>
548
585
  <ReactionToggles ver={ver} view={view} tile={k} small />
549
586
  <AutoText className="rv-word" placeholder="a word" value={r?.comment ?? ''} onKeyDown={blurOnEscape} onText={(t) => mark(ver, () => card.setReactionComment(view, k, t))} />
@@ -553,67 +590,288 @@ const Tile = observer(({ ver, v, view, t, k, fill = false }: { ver: Ver; v: Gall
553
590
  )
554
591
  })
555
592
 
556
- /** one media view: a single image or clip, or the pair in the compare component; fitted to the column on its own, or
557
- * zoomed (the full file) with its own scroll */
558
- const MediaBody = observer(({ ver, v, i, zoom }: { ver: Ver; v: MediaView; i: number; zoom: Zoom }) => {
593
+ /** one media view: a single image or clip, or the pair in the compare component; fitted to the column on its own, as
594
+ * wide as the column, or zoomed (the full file), the last two with their own scroll. `.rv-zoomface` is the element a
595
+ * size is measured on: its width holds `data-cols` images side by side */
596
+ const MediaBody = observer(({ ver, v, i, zoom, boxed = false }: { ver: Ver; v: MediaView; i: number; zoom: Zoom | BoxZoom; boxed?: boolean }) => {
559
597
  const { rv, card } = ver
560
598
  const item = itemOf(ver)
561
599
  const id = item.id
562
- if (v.audio) return <SoundBody ver={ver} v={v} />
600
+ if (v.audio) return <SoundBody ver={ver} v={v} saves={!boxed} />
601
+ // a still at Preview is a preview a click opens in the lightbox, where it is judged and drawn on; a clip keeps its player
602
+ if (zoom === 'preview' && !v.clip) return <PreviewOf ver={ver} v={v} i={i} />
563
603
  const f = v.files
564
604
  const ratio = v.size.w / v.size.h
565
605
  const aspect = `${v.size.w} / ${v.size.h}`
566
- const scale = zoom === 'fit' ? null : Number(zoom)
606
+ const wide = zoom === 'width'
607
+ const scale = zoom === 'fit' || zoom === 'preview' || wide ? null : Number(zoom)
567
608
  const room = FIT_ROOM + (v.clip ? 40 : 0)
609
+ const c = rv.compare
610
+ const mode = c.modeFor(v.clip !== undefined)
611
+ // the lightbox's stage (--fit-h) less what sits under the image there: a pair's captions, the clip's bar, the curtain's line
612
+ const under = (isPair(v.files) && !rv.phone.on ? 26 : 0) + (v.clip ? 44 : 0) + (isPair(v.files) && mode === 'swipe' ? 22 : 0)
613
+ // the height a view fits in: a preview's, the lightbox's, or the column's
614
+ const fitH = zoom === 'preview' ? `${PREVIEW_H}px` : boxed ? `(var(--fit-h) - ${under}px)` : `(100vh - ${room}px)`
568
615
  // a clip always plays its fit url (its play copy keeps its size and frames), an image is the full file past « fit »
569
- const src = (name: string): string => (scale && !v.clip ? rv.fileUrl(id, name, item.wip) : rv.fitUrl(id, name, item.wip))
570
- const bar = v.clip ? <ClipBar clip={card.clipOf(id, i)} info={v.clip} use={() => ver.live && card.setView(i)} /> : null
571
- const scroll = scale ? { overflow: 'auto', maxHeight: `calc(100vh - ${room}px)` } : undefined
616
+ const src = (name: string): string => ((scale || wide) && !v.clip ? rv.fileUrl(id, name, item.wip) : rv.fitUrl(id, name, item.wip))
617
+ // the page's clip keys reach the version his answer goes to: space when it is no pair, ← → when it has one view
618
+ const page = boxed && ver.cell.id === card.target
619
+ const keys = boxed ? { play: page && !isPair(f), frames: page && item.views.length === 1 } : undefined
620
+ const bar = v.clip ? <ClipBar clip={card.clipOf(id, i)} info={v.clip} use={() => ver.live && card.setView(i)} keys={keys} /> : null
621
+ const scroll = scale || wide ? { overflow: 'auto', maxHeight: boxed ? `calc(var(--fit-h) - ${under}px)` : `calc(100vh - ${room}px)` } : undefined
572
622
  if (!isPair(f)) {
573
623
  const name = 'image' in f ? f.image : 'video' in f ? f.video : f.audio
574
624
  return (
575
625
  <div style={scroll}>
576
- <div style={{ width: scale ? `${v.size.w * scale}px` : `min(100%, calc((100vh - ${room}px) * ${ratio}))`, margin: '0 auto' }}>
626
+ <div className="rv-zoomface" data-cols={1} style={{ width: scale ? `${v.size.w * scale}px` : wide ? '100%' : `min(100%, calc(${fitH} * ${ratio}))`, margin: '0 auto' }}>
577
627
  <Compare c={rv.compare} base={src(name)} mod={undefined} aspect={aspect} draw={(s) => <Marks ver={ver} src={s} side={undefined} view={i} />}
578
628
  over={() => (ver.live ? <RectNote ver={ver} view={i} sides={[undefined]} /> : null)} />
579
629
  {bar}
580
- <Downloads rv={rv} item={item} files={[{ file: name }]} />
630
+ {boxed ? null : <Downloads rv={rv} item={item} files={[{ file: name }]} />}
581
631
  </div>
582
632
  </div>
583
633
  )
584
634
  }
585
635
  const before = src(f.before)
586
636
  const after = src(f.after)
587
- const saves = <Downloads rv={rv} item={item} files={[{ file: f.before, label: 'before' }, { file: f.after, label: 'after' }]} />
637
+ const saves = boxed ? null : <Downloads rv={rv} item={item} files={[{ file: f.before, label: 'before' }, { file: f.after, label: 'after' }]} />
588
638
  if (rv.phone.on)
589
639
  return (
590
640
  <>
591
- <PhonePair ver={ver} view={i} bar={bar} before={before} after={after} aspect={aspect} size={v.size} scale={scale} />
641
+ <PhonePair ver={ver} view={i} bar={bar} before={before} after={after} aspect={aspect} size={v.size} scale={scale} fitH={boxed ? fitH : null} />
592
642
  {saves}
593
643
  </>
594
644
  )
595
- const c = rv.compare
596
- const mode = c.modeFor(v.clip !== undefined)
597
645
  const cols = mode === 'side' ? 2 : 1
598
- const fitW = `min(100%, calc((100vh - ${room}px) * ${ratio * cols}))`
646
+ const fitW = wide ? '100%' : `min(100%, calc(${fitH} * ${ratio * cols}))`
599
647
  return (
600
648
  <>
601
649
  <div style={scroll}>
602
- <div className="rv-pairgrid" style={{ width: scale ? `${v.size.w * scale * cols + 8 * (cols - 1)}px` : fitW, gridTemplateColumns: `repeat(${cols}, 1fr)` }}>
650
+ <div className="rv-pairgrid rv-zoomface" data-cols={cols} style={{ width: scale ? `${v.size.w * scale * cols + 8 * (cols - 1)}px` : fitW, gridTemplateColumns: `repeat(${cols}, 1fr)` }}>
603
651
  <Compare c={c} mode={mode} base={before} mod={after} names={PAIR_NAMES} aspect={aspect}
604
652
  draw={(s, face) => <Marks ver={ver} src={s} side={drawnSide(mode, s === before ? 'before' : 'after')} view={i} face={face} />}
605
653
  over={(srcs) => (ver.live ? <RectNote ver={ver} view={i} sides={srcs.map((s) => drawnSide(mode, s === before ? 'before' : 'after'))} /> : null)} />
606
654
  </div>
607
655
  </div>
608
656
  {bar ? <div style={{ width: fitW, margin: '0 auto' }}>{bar}</div> : null}
609
- <div style={{ width: fitW, margin: '0 auto' }}>{saves}</div>
657
+ {saves ? <div style={{ width: fitW, margin: '0 auto' }}>{saves}</div> : null}
610
658
  {mode === 'swipe' ? <div className="rv-dim rv-center">curtain: a drag moves the line; rectangles are drawn in the other modes</div> : null}
611
659
  </>
612
660
  )
613
661
  })
614
662
 
663
+ /** a view at Preview: its image (a pair's before and after side by side), at most PREVIEW_H tall; a click opens the
664
+ * lightbox on it */
665
+ const PreviewOf = observer(({ ver, v, i }: { ver: Ver; v: MediaView; i: number }) => {
666
+ const { rv } = ver
667
+ const item = itemOf(ver)
668
+ const f = v.files
669
+ const open = (): void => ver.card.openBox(ver.cell.id, i)
670
+ const aspect = { aspectRatio: `${v.size.w} / ${v.size.h}` }
671
+ if (isPair(f)) {
672
+ const before = rv.fitUrl(item.id, f.before, item.wip)
673
+ const after = rv.fitUrl(item.id, f.after, item.wip)
674
+ // one frame on a loop: the before, the changed pixels glowing, then the after (a still after alone when motion is reduced)
675
+ return (
676
+ <button type="button" className="rv-viewpreview" title="the before, what changed, the after: open it full to judge it, draw on it, save it" onMouseDown={keepFocus} onClick={open}>
677
+ <span className="rv-flip" style={{ ...aspect, width: `min(100%, calc(${PREVIEW_H}px * ${v.size.w / v.size.h}))` }}>
678
+ <img className="rv-flipbefore" src={before} alt="" loading="lazy" decoding="async" />
679
+ <img className="rv-flipafter" src={after} alt="" loading="lazy" decoding="async" />
680
+ <GlowCanvas base={before} mod={after} />
681
+ <span className="rv-fliptag before">before</span>
682
+ <span className="rv-fliptag after">after</span>
683
+ </span>
684
+ </button>
685
+ )
686
+ }
687
+ return (
688
+ <button type="button" className="rv-viewpreview" title="open it full: judge it, draw on it, save it" onMouseDown={keepFocus} onClick={open}>
689
+ <img src={rv.fitUrl(item.id, thumbFileOf(v), item.wip)} alt="" loading="lazy" decoding="async" style={aspect} />
690
+ </button>
691
+ )
692
+ })
693
+
694
+ /** the share of its own pixels a view is drawn at now, read off the page: what « fit » and « width » come to */
695
+ function shownScale(box: HTMLElement | null, v: ReviewView | undefined): number | null {
696
+ const face = box?.querySelector<HTMLElement>('.rv-zoomface')
697
+ if (face == null || v === undefined || isGallery(v) || !(v.size.w > 0)) return null
698
+ const cols = Number(face.dataset['cols'] ?? 1) || 1
699
+ const w = (face.getBoundingClientRect().width - 8 * (cols - 1)) / cols
700
+ return w > 0 ? w / v.size.w : null
701
+ }
702
+
703
+ const BOX_LABEL = { fit: 'Fit', width: 'Width' } as const
704
+ const BOX_TIP = { fit: 'the whole view in the window (0)', width: 'as wide as the window, it scrolls' } as const
705
+
706
+ /** the size of the view in the lightbox: whole, wide, its own pixels; a size the wheel or the keys gave shows as its
707
+ * percent; − and + step it. Kept for the repo */
708
+ const BoxZoomBar = observer(({ rv, step }: { rv: ReviewSt; step: (by: 1 | -1) => void }) => {
709
+ const z = rv.boxZoom
710
+ const free = typeof z === 'number' && !(BOX_ZOOM.picks as readonly number[]).includes(z)
711
+ return (
712
+ <span className="rv-boxzoom rv-keyed" title="the size of the view: ⌘ or ctrl with the wheel, a pinch, or + and −">
713
+ <span className="seg">
714
+ {(['fit', 'width'] as const).map((k) => (
715
+ <button key={k} className={z === k ? 'on' : ''} title={BOX_TIP[k]} onMouseDown={keepFocus} onClick={() => rv.setBoxZoom(k)}>{BOX_LABEL[k]}{k === 'fit' ? <Key k="0" /> : null}</button>
716
+ ))}
717
+ {BOX_ZOOM.picks.map((n) => <button key={n} className={z === n ? 'on' : ''} title={`${n * 100} % of its own pixels`} onMouseDown={keepFocus} onClick={() => rv.setBoxZoom(n)}>{n * 100} %</button>)}
718
+ {free ? <button className="on" title="the size the wheel or the keys gave" onMouseDown={keepFocus}>{Math.round(z * 100)} %</button> : null}
719
+ </span>
720
+ <button className="ghost rv-keybtn" title="smaller (−)" aria-label="smaller" onMouseDown={keepFocus} onClick={() => step(-1)}><Key k="−" /><span className="rv-nokey">−</span></button>
721
+ <button className="ghost rv-keybtn" title="larger (+)" aria-label="larger" onMouseDown={keepFocus} onClick={() => step(1)}><Key k="+" /><span className="rv-nokey">+</span></button>
722
+ </span>
723
+ )
724
+ })
725
+
726
+ /** what the lightbox shows: the version and its view, and what that view takes (the steps, a pair's flip and compare
727
+ * modes, a size); null while it is shut */
728
+ function boxOf(rv: ReviewSt, card: ThreadSt) {
729
+ const b = card.boxed
730
+ const cell = b == null ? null : card.versionOf(b.cell)
731
+ const v = b == null || cell == null ? undefined : cell.item.views[b.view]
732
+ if (b == null || cell == null || v === undefined) return null
733
+ const media = isGallery(v) ? null : v
734
+ const views = cell.item.views.length
735
+ const ver: Ver = { rv, card, cell, live: cell.id === card.head?.id && card.takesVerdict, claim: cell.id === card.newest?.id && card.claims }
736
+ // a gallery's tile shown large: ← → step through its tiles, OK Fix No and the word are the tile's
737
+ const tile = isGallery(v) && b.tile !== undefined && v.gallery[b.tile] !== undefined ? { k: b.tile, t: v.gallery[b.tile]!, n: v.gallery.length } : null
738
+ const can = { step: tile ? tile.n > 1 : views > 1, pair: media !== null && isPair(media.files) && !media.audio, size: media !== null && !media.audio }
739
+ const step = (by: number): void => (tile ? card.openBox(cell.id, b.view, (tile.k + by + tile.n) % tile.n) : card.openBox(cell.id, (b.view + by + views) % views))
740
+ return { at: b.view, cell, v, media, views, ver, can, step, tile }
741
+ }
742
+
743
+ /** a step of the lightbox's size from the size the view is drawn at now */
744
+ const resizeOf = (rv: ReviewSt, stage: { current: HTMLElement | null }, v: ReviewView) => (by: 1 | -1): void => rv.setBoxZoom(boxStep(shownScale(stage.current, v) ?? 1, by))
745
+
746
+ /** a key in the lightbox, true when it acted. Each acts only where its control shows: ← → the views, space a pair's
747
+ * before or after, V F R (or 1 2 3) OK Fix No on the view, 0 + − the size, Escape closes; V F R never reach the
748
+ * card's verdict from here. The page keeps the rest (D the compare mode, a clip's space, its ← → on a card of one
749
+ * view, A archives the card). A text field (`field`) keeps every key but Escape */
750
+ export function boxKey(rv: ReviewSt, card: ThreadSt, stage: { current: HTMLElement | null }, e: Pick<KeyboardEvent, 'key' | 'metaKey' | 'ctrlKey' | 'altKey'>, field: boolean): boolean {
751
+ const x = boxOf(rv, card)
752
+ if (x == null || e.metaKey || e.ctrlKey || e.altKey || (field && e.key !== 'Escape')) return false
753
+ const { at, ver, can, step, tile } = x
754
+ const said = boxReaction(e.key)
755
+ if (e.key === 'Escape') card.closeBox()
756
+ else if (can.step && (e.key === 'ArrowLeft' || e.key === 'ArrowRight')) step(e.key === 'ArrowLeft' ? -1 : 1)
757
+ else if (can.pair && e.key === ' ') rv.compare.flip()
758
+ else if (can.size && e.key === '0') rv.setBoxZoom('fit')
759
+ else if (can.size && (e.key === '+' || e.key === '=' || e.key === '-')) resizeOf(rv, stage, x.v)(e.key === '-' ? -1 : 1)
760
+ else if (said != null) {
761
+ if (takes(ver)) mark(ver, () => card.react(at, tile?.k, said))
762
+ } else return false
763
+ return true
764
+ }
765
+
766
+ /** the lightbox over the whole window (BoxFrame draws it), its wheel and its keys */
767
+ export const ViewBox = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
768
+ const stage = useRef<HTMLDivElement>(null)
769
+ const x = boxOf(rv, card)
770
+ const v = x?.v
771
+ // ⌘ or ctrl with the wheel (a pinch on a trackpad arrives as one) sizes the view around the pointer; the plain
772
+ // wheel scrolls. Not passive: the browser would zoom the whole page
773
+ useEffect(() => {
774
+ const el = stage.current
775
+ if (el == null || v === undefined) return
776
+ const wheel = (e: WheelEvent): void => {
777
+ if (!e.ctrlKey && !e.metaKey) return
778
+ const face = el.querySelector<HTMLElement>('.rv-zoomface')
779
+ const from = shownScale(el, v)
780
+ if (face == null || from == null) return
781
+ e.preventDefault()
782
+ const was = face.getBoundingClientRect()
783
+ const fx = (e.clientX - was.left) / was.width
784
+ const fy = (e.clientY - was.top) / was.height
785
+ rv.setBoxZoom(boxStep(from, -e.deltaY / 100))
786
+ // once it is drawn at its new size, the point that was under the pointer is put back under it
787
+ requestAnimationFrame(() => {
788
+ const now = el.querySelector<HTMLElement>('.rv-zoomface')
789
+ const scroller = now?.parentElement
790
+ if (now == null || scroller == null) return
791
+ const is = now.getBoundingClientRect()
792
+ scroller.scrollLeft += is.left + fx * is.width - e.clientX
793
+ scroller.scrollTop += is.top + fy * is.height - e.clientY
794
+ })
795
+ }
796
+ el.addEventListener('wheel', wheel, { passive: false })
797
+ return () => el.removeEventListener('wheel', wheel)
798
+ }, [v, rv])
799
+ // its keys come before the page's (capture): boxKey
800
+ useEffect(() => {
801
+ if (x == null) return
802
+ const key = (e: KeyboardEvent): void => {
803
+ const field = (e.target as HTMLElement | null)?.closest?.('input, textarea, select, [contenteditable]') != null
804
+ if (!boxKey(rv, card, stage, e, field)) return
805
+ e.preventDefault()
806
+ e.stopPropagation()
807
+ }
808
+ window.addEventListener('keydown', key, true)
809
+ return () => window.removeEventListener('keydown', key, true)
810
+ })
811
+ if (x == null) return null
812
+ return createPortal(<BoxFrame rv={rv} card={card} stage={stage} />, document.body)
813
+ })
814
+
815
+ /** the lightbox: the view a preview opened, over the whole window. One bar on top reads as what he does, left to
816
+ * right: where he is (← → the version's views, the view's name, its tag, the card), what he says of it (OK Fix No),
817
+ * how he looks at it (the compare modes, one side alone, the size, a gallery's head), ✕. The view takes the room
818
+ * between, « fit » fitting that room (--fit-h, review.css). One bar under it: his word on the view and its files.
819
+ * Every key is a chip on the control it triggers, shown only where the key acts */
820
+ export const BoxFrame = observer(({ rv, card, stage }: { rv: ReviewSt; card: ThreadSt; stage: React.RefObject<HTMLDivElement | null> }) => {
821
+ const x = boxOf(rv, card)
822
+ if (x == null) return null
823
+ const { at, cell, v, media, views, ver, can, step, tile } = x
824
+ const shown = card.reactionShown(cell, at, tile?.k)
825
+ const kind = viewKind(v, false)
826
+ const name = tile ? tile.t.label : v.label || kind
827
+ const files = filesOf(v)
828
+ const said = card.saidOn(cell.id, at)
829
+ const tag = viewTag(cell.n, at)
830
+ return (
831
+ <div className={`rv-viewbox${toneClass(shown?.status)}`} role="dialog" aria-modal="true" aria-label={`view ${tag}: ${name}`}>
832
+ <header className="rv-boxbar rv-boxtop">
833
+ <span className="rv-boxwhere">
834
+ {can.step ? <button className="ghost rv-keybtn" title={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}
835
+ <span className="rv-boxn rv-dim">{tile ? tile.k + 1 : at + 1} of {tile ? tile.n : views}</span>
836
+ {can.step ? <button className="ghost rv-keybtn" title={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}
837
+ <b className="rv-boxname" title={name}>{name}</b>
838
+ {v.label && v.label.toLowerCase() !== kind.toLowerCase() ? <span className="rv-boxkind rv-dim">{kind}</span> : null}
839
+ <span className="rv-boxtag" title={`view ${tag}`}>{tag}</span>
840
+ <span className="rv-boxtitle rv-dim" title={cell.item.title}>{cell.item.title}</span>
841
+ </span>
842
+ {takes(ver) ? <ReactionToggles ver={ver} view={at} {...(tile ? { tile: tile.k } : {})} keys /> : shown?.status ? <SentReaction status={shown.status} /> : null}
843
+ <span className="rv-boxlook">
844
+ {can.pair && rv.phone.on ? <PhoneSides rv={rv} /> : null}
845
+ {can.pair && !rv.phone.on ? <CompareModes c={rv.compare} clip={media?.clip !== undefined} keys /> : null}
846
+ {can.pair && !rv.phone.on ? <PairFlip c={rv.compare} /> : null}
847
+ {media?.marks && media.marks.length > 0 ? <button className={rv.marksOn ? 'primary' : ''} title="the repo's own rings on the shot (M)" onMouseDown={keepFocus} onClick={() => rv.toggleMarks()}>marks<Key k="M" /></button> : null}
848
+ {/* a phone sizes with a pinch: the size control is the keyboard's and the wheel's */}
849
+ {can.size && !rv.phone.on ? <BoxZoomBar rv={rv} step={resizeOf(rv, stage, v)} /> : null}
850
+ {isGallery(v) && !tile ? <GalleryHead ver={ver} v={v} /> : null}
851
+ </span>
852
+ <button className="ghost rv-boxclose" title="close (Escape)" aria-label="close" onClick={() => card.closeBox()}>✕<Key k="esc" /></button>
853
+ </header>
854
+ <div ref={stage} className="rv-boxstage">
855
+ {tile && isGallery(v) ? <Tile ver={ver} v={v} view={at} t={tile.t} k={tile.k} boxed /> : <ViewCell ver={ver} v={v} i={at} boxed />}
856
+ </div>
857
+ <footer className="rv-boxbar rv-boxfoot">
858
+ {media?.note ? <span className="rv-boxnote rv-dim" title={media.note}>{media.note}</span> : null}
859
+ {said.length > 0 ? <div className="rv-boxsaid">{said.map((s, k) => <SaidLine key={k} s={s} v={v} n={cell.n} />)}</div> : null}
860
+ {takes(ver) ? (
861
+ <AutoText className="rv-word rv-boxword" placeholder={tile ? `a word on ${tile.t.label}` : isGallery(v) ? 'a word on these images' : 'a word on this view'} value={(ver.live ? card.reactionOf(at, tile?.k)?.comment : undefined) ?? ''}
862
+ onKeyDown={blurOnEscape} onText={(t) => mark(ver, () => card.setReactionComment(at, tile?.k, t))} />
863
+ ) : <span className="sp" />}
864
+ <span className="rv-boxfiles">
865
+ {files.length > 0 ? <Downloads rv={rv} item={cell.item} files={files} /> : null}
866
+ <StageButtons ver={ver} v={v} i={at} />
867
+ </span>
868
+ </footer>
869
+ </div>
870
+ )
871
+ })
872
+
615
873
  /** a sound view: its waveform over the browser's player, one row a side on a pair, each to download */
616
- const SoundBody = ({ ver, v }: { ver: Ver; v: MediaView }) => {
874
+ const SoundBody = ({ ver, v, saves = true }: { ver: Ver; v: MediaView; saves?: boolean }) => {
617
875
  const { rv } = ver
618
876
  const item = itemOf(ver)
619
877
  const f = v.files
@@ -632,11 +890,18 @@ const SoundBody = ({ ver, v }: { ver: Ver; v: MediaView }) => {
632
890
  </div>
633
891
  ))}
634
892
  <div className="rv-dim">{secs(a.duration)}</div>
635
- <Downloads rv={rv} item={item} files={rows.map((r) => ({ file: r.file, ...(r.label ? { label: r.label } : {}) }))} />
893
+ {saves ? <Downloads rv={rv} item={item} files={filesOf(v)} /> : null}
636
894
  </div>
637
895
  )
638
896
  }
639
897
 
898
+ /** the files a view saves, links and shows in the Finder: a pair's two sides, else its one file; a gallery none */
899
+ const filesOf = (v: ReviewView): { file: string; label?: string }[] => {
900
+ if (isGallery(v)) return []
901
+ const f = v.files
902
+ return isPair(f) ? [{ file: f.before, label: 'before' }, { file: f.after, label: 'after' }] : [{ file: 'image' in f ? f.image : 'video' in f ? f.video : f.audio }]
903
+ }
904
+
640
905
  /** a view's files to save at full size, each under the card's id and its own name */
641
906
  const Downloads = observer(({ rv, item, files }: { rv: ReviewSt; item: Item; files: readonly { file: string; label?: string }[] }) => (
642
907
  <div className="rv-downloads">
@@ -654,7 +919,7 @@ const Downloads = observer(({ rv, item, files }: { rv: ReviewSt; item: Item; fil
654
919
  })}
655
920
  {/* the Finder is on the desktop only: a phone has none */}
656
921
  {rv.phone.on || files[0] === undefined ? null : (
657
- <button className="rv-dl ghost" title={`open the card's folder in the Finder, ${files[0].file} selected`} onClick={() => void rv.reveal(item.id, files[0]!.file)}>show in Finder</button>
922
+ <button className="rv-dl ghost" title={`open the version's folder in the Finder, ${files[0].file} selected`} onClick={() => void rv.reveal(item.id, files[0]!.file)}>show in Finder</button>
658
923
  )}
659
924
  </div>
660
925
  ))
@@ -665,8 +930,21 @@ const PAIR_SIDES: { value: PairSide; label: string }[] = [
665
930
  { value: 'swipe', label: 'curtain' },
666
931
  ]
667
932
 
668
- /** a pair on a phone: one side at a time full width, or the curtain; the zoom scrolls */
669
- const PhonePair = observer(({ ver, view, bar, before, after, aspect, size, scale }: {
933
+ /** which side of a pair a phone shows: before, after, or the curtain */
934
+ const PhoneSides = observer(({ rv }: { rv: ReviewSt }) => {
935
+ const ph = rv.phone
936
+ const c = rv.compare
937
+ const side = ph.pair === 'swipe' && c.mode !== 'swipe' ? 'after' : ph.pair
938
+ const pick = (s: PairSide): void => {
939
+ if (s === 'swipe') c.setMode('swipe')
940
+ ph.setPair(s)
941
+ }
942
+ return <span className="seg">{PAIR_SIDES.map((s) => <button key={s.value} className={side === s.value ? 'on' : ''} onClick={() => pick(s.value)}>{s.label}</button>)}</span>
943
+ })
944
+
945
+ /** a pair on a phone: one side at a time full width, or the curtain; the zoom scrolls. `fitH`: in the lightbox, the
946
+ * height it fits, its sides chosen in the lightbox's bar */
947
+ const PhonePair = observer(({ ver, view, bar, before, after, aspect, size, scale, fitH }: {
670
948
  ver: Ver
671
949
  view: number
672
950
  bar: ReactNode
@@ -675,21 +953,19 @@ const PhonePair = observer(({ ver, view, bar, before, after, aspect, size, scale
675
953
  aspect: string
676
954
  size: { w: number; h: number }
677
955
  scale: number | null
956
+ fitH: string | null
678
957
  }) => {
679
958
  const { rv } = ver
680
959
  const ph = rv.phone
681
960
  const c = rv.compare
682
961
  const side = ph.pair === 'swipe' && c.mode !== 'swipe' ? 'after' : ph.pair
683
- const pick = (s: PairSide): void => {
684
- if (s === 'swipe') c.setMode('swipe')
685
- ph.setPair(s)
686
- }
687
962
  const one = side === 'before' ? before : after
963
+ const fit = fitH ? `min(100%, calc(${fitH} * ${size.w / size.h}))` : '100%'
688
964
  return (
689
965
  <div className="rv-phonepair">
690
- <span className="seg">{PAIR_SIDES.map((s) => <button key={s.value} className={side === s.value ? 'on' : ''} onClick={() => pick(s.value)}>{s.label}</button>)}</span>
691
- <div style={scale ? { overflow: 'auto', maxHeight: '70vh' } : undefined}>
692
- <div style={{ width: scale ? `${size.w * scale}px` : '100%' }}>
966
+ {fitH ? null : <PhoneSides rv={rv} />}
967
+ <div style={scale ? { overflow: 'auto', maxHeight: fitH ? `calc(${fitH})` : '70vh' } : undefined}>
968
+ <div className={fitH ? 'rv-zoomface' : undefined} data-cols={fitH ? 1 : undefined} style={{ width: scale ? `${size.w * scale}px` : fit, margin: '0 auto' }}>
693
969
  {side === 'swipe' ? (
694
970
  <Compare c={c} base={before} mod={after} names={PAIR_NAMES} aspect={aspect} draw={(s) => <Marks ver={ver} src={s} side={s === before ? 'before' : 'after'} view={view} />}
695
971
  over={(srcs) => (ver.live ? <RectNote ver={ver} view={view} sides={srcs.map((s) => (s === before ? 'before' : 'after'))} /> : null)} />
@@ -714,14 +990,17 @@ const MODES: { mode: CompareMode; glyph: string; tip: string }[] = [
714
990
  { mode: 'diff', glyph: '≠', tip: 'only what changed: the after\'s changed pixels in colour, the rest faded' },
715
991
  ]
716
992
 
717
- /** the compare modes as tiny buttons, the onion's opacity floating under them */
718
- const CompareModes = observer(({ c, clip }: { c: CompareSt; clip: boolean }) => (
993
+ /** the compare modes as tiny buttons, the onion's opacity floating under them; `keys`: the D that cycles them beside */
994
+ const CompareModes = observer(({ c, clip, keys }: { c: CompareSt; clip: boolean; keys?: boolean }) => (
719
995
  <span className="rv-modes">
720
- <span className="seg">
721
- {COMPARE_MODES.filter((m) => !(clip && m === 'diff')).map((m) => {
722
- const o = MODES.find((x) => x.mode === m)!
723
- return <button key={m} title={`${o.tip} (D cycles, ⇧D back)`} className={c.modeFor(clip) === m ? 'on' : ''} onMouseDown={keepFocus} onClick={() => c.setMode(m)}>{o.glyph}</button>
724
- })}
996
+ <span className="rv-keyed">
997
+ <span className="seg">
998
+ {COMPARE_MODES.filter((m) => !(clip && m === 'diff')).map((m) => {
999
+ const o = MODES.find((x) => x.mode === m)!
1000
+ return <button key={m} title={`${o.tip} (D cycles, ⇧D back)`} className={c.modeFor(clip) === m ? 'on' : ''} onMouseDown={keepFocus} onClick={() => c.setMode(m)}>{o.glyph}</button>
1001
+ })}
1002
+ </span>
1003
+ {keys ? <Key k="D" /> : null}
725
1004
  </span>
726
1005
  {c.mode === 'onion' ? (
727
1006
  <input className="rv-onion" type="range" min={0} max={1} step={0.05} value={c.opacity} title={`after ${Math.round(c.opacity * 100)} %`} onChange={(e) => c.setOpacity(Number(e.currentTarget.value))} />
@@ -729,6 +1008,18 @@ const CompareModes = observer(({ c, clip }: { c: CompareSt; clip: boolean }) =>
729
1008
  </span>
730
1009
  ))
731
1010
 
1011
+ /** one side of a pair alone, the before or the after (the hover mode); space flips them */
1012
+ const PairFlip = observer(({ c }: { c: CompareSt }) => (
1013
+ <span className="rv-keyed">
1014
+ <span className="seg" role="group" aria-label="one side alone">
1015
+ {(['before', 'after'] as const).map((side) => (
1016
+ <button key={side} className={c.shown === side ? 'on' : ''} title={`the ${side} alone (space flips)`} onMouseDown={keepFocus} onClick={() => c.show(side)}>{side}</button>
1017
+ ))}
1018
+ </span>
1019
+ <Key k="space" />
1020
+ </span>
1021
+ ))
1022
+
732
1023
  /** a channel sum under this is the encoder's noise, never a change */
733
1024
  const DIFF_NOISE = 24
734
1025
 
@@ -736,6 +1027,36 @@ const DIFF_NOISE = 24
736
1027
  const changesWords = (share: number | null | undefined): string =>
737
1028
  share === undefined ? 'reading…' : share === null ? 'could not be read' : share === 0 ? 'none: no pixel differs' : `${share < 0.001 ? '< 0.1' : (share * 100).toFixed(1)} % of the pixels`
738
1029
 
1030
+ /** the before's and the after's pixels, drawn at the after's size on `canvas()` (left holding the after), or null when
1031
+ * either cannot be read: a load failed, the canvas is gone, or an image came from another origin (a media the disk let
1032
+ * go is a redirect to the Space), which taints the canvas and makes getImageData throw */
1033
+ const pixelsOf = async (base: string, mod: string, canvas: () => HTMLCanvasElement | null): Promise<{ ctx: CanvasRenderingContext2D; pa: Uint8ClampedArray; out: ImageData; w: number; h: number } | null> => {
1034
+ const load = (src: string): Promise<HTMLImageElement> =>
1035
+ new Promise((ok, no) => {
1036
+ const img = new Image()
1037
+ img.onload = () => ok(img)
1038
+ img.onerror = () => no(new Error(src))
1039
+ img.src = src
1040
+ })
1041
+ try {
1042
+ const [a, b] = await Promise.all([load(base), load(mod)])
1043
+ const cv = canvas()
1044
+ const ctx = cv?.getContext('2d', { willReadFrequently: true })
1045
+ if (cv == null || ctx == null) return null
1046
+ const w = b.naturalWidth
1047
+ const h = b.naturalHeight
1048
+ cv.width = w
1049
+ cv.height = h
1050
+ ctx.drawImage(a, 0, 0, w, h)
1051
+ const pa = ctx.getImageData(0, 0, w, h).data
1052
+ ctx.clearRect(0, 0, w, h)
1053
+ ctx.drawImage(b, 0, 0, w, h)
1054
+ return { ctx, pa, out: ctx.getImageData(0, 0, w, h), w, h }
1055
+ } catch {
1056
+ return null
1057
+ }
1058
+ }
1059
+
739
1060
  /** the after, only where it changed from the before: each changed pixel in its own colour, every other pixel a pale
740
1061
  * gray of it, so what moved is all that stands out. Read in the browser from the two previews; `say` gets the share
741
1062
  * that changed, undefined while it reads, null when an image cannot be read */
@@ -743,27 +1064,11 @@ const DiffCanvas = ({ base, mod, say }: { base: string; mod: string; say: (share
743
1064
  const ref = useRef<HTMLCanvasElement>(null)
744
1065
  useEffect(() => {
745
1066
  let gone = false
746
- const load = (src: string): Promise<HTMLImageElement> =>
747
- new Promise((ok, no) => {
748
- const img = new Image()
749
- img.onload = () => ok(img)
750
- img.onerror = () => no(new Error(src))
751
- img.src = src
752
- })
753
1067
  say(undefined)
754
- Promise.all([load(base), load(mod)]).then(([a, b]) => {
755
- const cv = ref.current
756
- if (gone || cv == null) return
757
- const w = b.naturalWidth
758
- const h = b.naturalHeight
759
- cv.width = w
760
- cv.height = h
761
- const ctx = cv.getContext('2d', { willReadFrequently: true })
762
- if (ctx == null) return say(null)
763
- ctx.drawImage(a, 0, 0, w, h)
764
- const pa = ctx.getImageData(0, 0, w, h).data
765
- ctx.drawImage(b, 0, 0, w, h)
766
- const out = ctx.getImageData(0, 0, w, h)
1068
+ void pixelsOf(base, mod, () => (gone ? null : ref.current)).then((px) => {
1069
+ if (gone) return
1070
+ if (px == null) return say(null)
1071
+ const { ctx, pa, out, w, h } = px
767
1072
  const pb = out.data
768
1073
  let changed = 0
769
1074
  for (let i = 0; i < pb.length; i += 4) {
@@ -778,8 +1083,6 @@ const DiffCanvas = ({ base, mod, say }: { base: string; mod: string; say: (share
778
1083
  }
779
1084
  ctx.putImageData(out, 0, 0)
780
1085
  say(changed / (w * h))
781
- }, () => {
782
- if (!gone) say(null)
783
1086
  })
784
1087
  return () => {
785
1088
  gone = true
@@ -788,6 +1091,28 @@ const DiffCanvas = ({ base, mod, say }: { base: string; mod: string; say: (share
788
1091
  return <canvas ref={ref} className="rv-diff" />
789
1092
  }
790
1093
 
1094
+ /** the pixels that changed from `base` to `mod`, alone on a clear canvas (the rest transparent), for the preview's glow */
1095
+ const GlowCanvas = ({ base, mod }: { base: string; mod: string }) => {
1096
+ const ref = useRef<HTMLCanvasElement>(null)
1097
+ useEffect(() => {
1098
+ let gone = false
1099
+ void pixelsOf(base, mod, () => (gone ? null : ref.current)).then((px) => {
1100
+ if (px == null) return
1101
+ const { ctx, pa, out } = px
1102
+ const pb = out.data
1103
+ for (let i = 0; i < pb.length; i += 4) {
1104
+ const moved = Math.abs(pa[i]! - pb[i]!) + Math.abs(pa[i + 1]! - pb[i + 1]!) + Math.abs(pa[i + 2]! - pb[i + 2]!) > DIFF_NOISE
1105
+ pb[i + 3] = moved ? 255 : 0
1106
+ }
1107
+ ctx.putImageData(out, 0, 0)
1108
+ })
1109
+ return () => {
1110
+ gone = true
1111
+ }
1112
+ }, [base, mod])
1113
+ return <canvas ref={ref} className="rv-flipglow" aria-hidden="true" />
1114
+ }
1115
+
791
1116
  /** follows the pointer until it is released */
792
1117
  function track(move: (e: PointerEvent) => void): void {
793
1118
  const up = (): void => {
@@ -819,12 +1144,15 @@ const Compare = observer(({ c, mode = c.mode, base, mod, names, aspect, draw, ov
819
1144
  <div className="rv-fill">{draw(mod, <DiffCanvas base={base} mod={mod} say={setShare} />)}</div>
820
1145
  </Frame>
821
1146
  )
822
- if (mode === 'mod')
1147
+ if (mode === 'mod') {
1148
+ // the before shows on a hover or after a space, not both: a hover on a flipped pair shows the after again
1149
+ const before = peek !== c.flipped
823
1150
  return (
824
- <Frame aspect={aspect} caption={peek ? n.base : n.mod} modCap={!peek} onPeek={setPeek} over={over?.([peek ? base : mod])}>
825
- <div className="rv-fill">{draw(peek ? base : mod)}</div>
1151
+ <Frame aspect={aspect} caption={before ? n.base : n.mod} modCap={!before} onPeek={setPeek} side={before ? { tone: 'before', name: n.base } : { tone: 'after', name: n.mod }} over={over?.([before ? base : mod])}>
1152
+ <div className="rv-fill">{draw(before ? base : mod)}</div>
826
1153
  </Frame>
827
1154
  )
1155
+ }
828
1156
  const pct = Math.round(c.split * 100)
829
1157
  return (
830
1158
  <Frame aspect={aspect} caption={<>{n.base} {mode === 'swipe' ? '◀ ▶' : '+'} <span className="rv-modcap">{n.mod}</span></>} swipe={mode === 'swipe' ? c : undefined} over={over?.([base, mod])}>
@@ -836,7 +1164,9 @@ const Compare = observer(({ c, mode = c.mode, base, mod, names, aspect, draw, ov
836
1164
  })
837
1165
 
838
1166
  /** one frame and its caption; the curtain's line follows the pointer; `over` sits on the frame, free of its clip */
839
- const Frame = ({ aspect, caption, modCap, swipe, onPeek, over, children }: { aspect: string; caption: ReactNode; modCap?: boolean; swipe?: CompareSt | undefined; onPeek?: (on: boolean) => void; over?: ReactNode; children: ReactNode }) => {
1167
+ /** `side`: which image of a pair the frame shows right now, said on the frame itself: its outline (the before red, the
1168
+ * after green) and its name in a corner tag, both drawn over the image so nothing moves when it changes */
1169
+ const Frame = ({ aspect, caption, modCap, swipe, onPeek, side, over, children }: { aspect: string; caption: ReactNode; modCap?: boolean; swipe?: CompareSt | undefined; onPeek?: (on: boolean) => void; side?: { tone: 'before' | 'after'; name: string }; over?: ReactNode; children: ReactNode }) => {
840
1170
  const frame = useRef<HTMLDivElement>(null)
841
1171
  const down = (e: React.PointerEvent): void => {
842
1172
  const el = frame.current
@@ -852,10 +1182,11 @@ const Frame = ({ aspect, caption, modCap, swipe, onPeek, over, children }: { asp
852
1182
  return (
853
1183
  <div className="rv-cell">
854
1184
  <div className="rv-framebox">
855
- <div ref={frame} className={`rv-frame${swipe ? ' swipe' : ''}`} style={{ aspectRatio: aspect }} onPointerDown={down}
1185
+ <div ref={frame} className={`rv-frame${swipe ? ' swipe' : ''}${side ? ` side-${side.tone}` : ''}`} style={{ aspectRatio: aspect }} onPointerDown={down}
856
1186
  onMouseEnter={() => onPeek?.(true)} onMouseLeave={() => onPeek?.(false)}>
857
1187
  {children}
858
1188
  </div>
1189
+ {side ? <span className={`rv-sidetag side-${side.tone}`} aria-live="polite">{side.name}</span> : null}
859
1190
  {over ? <div className="rv-over">{over}</div> : null}
860
1191
  </div>
861
1192
  {caption != null ? <div className={`rv-caption${modCap ? ' mod' : ''}`}>{caption}</div> : null}
@@ -1115,15 +1446,19 @@ export const ClipSound = observer(({ clip, keyHint }: { clip: ClipSt; keyHint?:
1115
1446
  </span>
1116
1447
  ))
1117
1448
 
1118
- /** under a clip: play or pause, one frame back or on, the scrubber, the time and the frame */
1119
- const ClipBar = observer(({ clip, info, use }: { clip: ClipSt; info: ReviewClip; use: () => void }) => {
1449
+ /** under a clip: play or pause, one frame back or on, the scrubber, the time and the frame. `keys`: in the lightbox,
1450
+ * which of its keys reach the clip there (space flips a pair, ← → step the views of a card that has several), each
1451
+ * shown on its button */
1452
+ const ClipBar = observer(({ clip, info, use, keys }: { clip: ClipSt; info: ReviewClip; use: () => void; keys?: { play: boolean; frames: boolean } | undefined }) => {
1120
1453
  const frames = Math.max(1, Math.round(info.duration * info.fps))
1454
+ const play = keys?.play ?? true
1455
+ const step = keys?.frames ?? true
1121
1456
  return (
1122
1457
  <div className="rv-clipbar" onMouseDownCapture={use} onTouchStartCapture={use}>
1123
- <button title={clip.paused ? 'play (Space)' : 'pause (Space)'} onMouseDown={keepFocus} onClick={() => clip.toggle()}>{clip.paused ? '▶' : '❚❚'}</button>
1458
+ <button title={`${clip.paused ? 'play' : 'pause'}${play ? ' (Space)' : ''}`} onMouseDown={keepFocus} onClick={() => clip.toggle()}>{clip.paused ? '▶' : '❚❚'}{keys && play ? <Key k="space" /> : null}</button>
1124
1459
  <ClipSound clip={clip} />
1125
- <button title="frame back (←)" onMouseDown={keepFocus} onClick={() => clip.step(-1)}>⏮</button>
1126
- <button title="frame on (→)" onMouseDown={keepFocus} onClick={() => clip.step(1)}>⏭</button>
1460
+ <button title={`frame back${step ? ' (←)' : ''}`} onMouseDown={keepFocus} onClick={() => clip.step(-1)}>⏮{keys && step ? <Key k="←" /> : null}</button>
1461
+ <button title={`frame on${step ? ' (→)' : ''}`} onMouseDown={keepFocus} onClick={() => clip.step(1)}>⏭{keys && step ? <Key k="→" /> : null}</button>
1127
1462
  <input className="rv-scrub" type="range" min={0} max={info.duration} step={1 / info.fps} value={Math.min(clip.time, info.duration)}
1128
1463
  onChange={(e) => clip.seek(Number(e.currentTarget.value))} onMouseUp={(e) => e.currentTarget.blur()} />
1129
1464
  <span className="rv-mono">{secs(clip.time)} · frame {clip.frameOf(clip.time) + 1}/{frames}</span>