rvlib-shipkit 2.22.1 → 2.24.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 (139) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/render.ts +28 -14
  4. package/src/agent-time/report.ts +46 -25
  5. package/src/agent-time/store.ts +30 -10
  6. package/src/agent-time/timeline.ts +43 -15
  7. package/src/annex/annex.ts +3 -0
  8. package/src/annex/born.ts +464 -0
  9. package/src/annex/flush.ts +46 -0
  10. package/src/annex/offload.ts +171 -38
  11. package/src/annex/snapshots.ts +53 -0
  12. package/src/annex/tidy.ts +368 -0
  13. package/src/asks/asks-queue.ts +32 -11
  14. package/src/checks/SK041-annex-links.check.ts +4 -2
  15. package/src/checks/SK043-scratch-on-the-mac.check.ts +45 -0
  16. package/src/checks/SK044-behind-upstream.check.ts +38 -0
  17. package/src/cli/cmd_Annex.ts +60 -9
  18. package/src/cli/cmd_Asks.ts +2 -0
  19. package/src/cli/cmd_Backup.ts +7 -5
  20. package/src/cli/cmd_Bump.ts +1 -0
  21. package/src/cli/cmd_Capacity.ts +26 -0
  22. package/src/cli/cmd_Check.ts +1 -0
  23. package/src/cli/cmd_Checks.ts +1 -0
  24. package/src/cli/cmd_Ci.ts +1 -0
  25. package/src/cli/cmd_Commands.ts +50 -14
  26. package/src/cli/cmd_Home.ts +0 -1
  27. package/src/cli/cmd_Hooks.ts +1 -0
  28. package/src/cli/cmd_Mv.ts +1 -0
  29. package/src/cli/cmd_Rec.ts +17 -7
  30. package/src/cli/cmd_Reflect.ts +1 -0
  31. package/src/cli/cmd_Releases.ts +1 -0
  32. package/src/cli/cmd_Review.ts +124 -17
  33. package/src/cli/cmd_Secret.ts +41 -2
  34. package/src/cli/cmd_Shot.ts +1 -0
  35. package/src/cli/cmd_Status.ts +1 -0
  36. package/src/cli/cmd_Time.ts +3 -1
  37. package/src/cli/cmd_Tmp.ts +82 -0
  38. package/src/cli/cmd_Wiki.ts +1 -0
  39. package/src/cli/registry.ts +13 -1
  40. package/src/collections/pings.ts +1 -1
  41. package/src/core/capacity.ts +71 -0
  42. package/src/core/check-runner.ts +86 -15
  43. package/src/core/machine-db.ts +8 -0
  44. package/src/core/motherhome.ts +67 -9
  45. package/src/core/slots.ts +49 -12
  46. package/src/core/trace-audit.ts +4 -1
  47. package/src/drill/run.ts +5 -2
  48. package/src/home/daemon-jobs.ts +10 -3
  49. package/src/home/global-units.ts +3 -0
  50. package/src/home/gui-app/ShipkitGui.swift +1 -0
  51. package/src/home/home-launchd.ts +11 -3
  52. package/src/home/home-routes.ts +11 -4
  53. package/src/home/machine-host.ts +65 -0
  54. package/src/home/machine-stores.ts +30 -4
  55. package/src/home/machine-temp.ts +493 -0
  56. package/src/home/other-macs.ts +74 -0
  57. package/src/home/pm.ts +4 -1
  58. package/src/home/run-daemon.ts +10 -2
  59. package/src/home/run-pm.ts +1 -0
  60. package/src/home/serve-web.ts +2 -2
  61. package/src/home/via-hub.ts +6 -1
  62. package/src/identities/identities.ts +92 -24
  63. package/src/init-repo.ts +7 -3
  64. package/src/ledger/ledger.ts +6 -0
  65. package/src/ledger/store.ts +6 -0
  66. package/src/media-store/backup/keys.ts +21 -6
  67. package/src/media-store/backup/manifest.ts +52 -11
  68. package/src/media-store/backup/restore.ts +17 -10
  69. package/src/media-store/backup/run.ts +5 -2
  70. package/src/media-store/backup/sources.ts +2 -1
  71. package/src/media-store/daemon.ts +2 -2
  72. package/src/media-store/purge.ts +4 -0
  73. package/src/mv/mv-md.ts +121 -42
  74. package/src/recordings/load.ts +3 -3
  75. package/src/recordings/model.ts +7 -0
  76. package/src/recordings/open.ts +12 -0
  77. package/src/recordings/presets.ts +12 -5
  78. package/src/recordings/recorder-app/Capture.swift +34 -5
  79. package/src/recordings/recorder-app/Clip.swift +126 -17
  80. package/src/recordings/recorder-app/Editor.swift +177 -7
  81. package/src/recordings/recorder-app/Hud.swift +189 -0
  82. package/src/recordings/recorder-app/Tray.swift +179 -36
  83. package/src/recordings/recorder-app/icon.svg +16 -0
  84. package/src/recordings/recorder-app/main.swift +349 -18
  85. package/src/recordings/recorder-app.ts +8 -4
  86. package/src/recordings/recorder.shipkit.ts +2 -1
  87. package/src/recordings/routes.ts +52 -6
  88. package/src/recordings/run-recorder.ts +2 -1
  89. package/src/recordings/share.ts +27 -0
  90. package/src/recordings/take.ts +36 -4
  91. package/src/recordings/view.ts +11 -0
  92. package/src/reflect/transcript.ts +56 -11
  93. package/src/releases/from-card.ts +45 -3
  94. package/src/releases/model.ts +6 -0
  95. package/src/releases/store.ts +8 -1
  96. package/src/repo-config.ts +14 -4
  97. package/src/review/cells.ts +24 -3
  98. package/src/review/format.ts +33 -9
  99. package/src/review/media-kind.ts +14 -11
  100. package/src/review/media-read.ts +6 -5
  101. package/src/review/model.ts +104 -7
  102. package/src/review/paste.ts +2 -1
  103. package/src/review/previews.ts +123 -36
  104. package/src/review/routes.ts +29 -18
  105. package/src/review/store.ts +74 -12
  106. package/src/review/threads.ts +7 -5
  107. package/src/secrets/copy.ts +110 -0
  108. package/src/secrets/list.ts +17 -7
  109. package/src/serve/hub-app/home-strip.css +5 -0
  110. package/src/serve/hub-app/home-strip.tsx +18 -0
  111. package/src/serve/hub-app/hub-app.tsx +2 -1
  112. package/src/serve/hub-app/hub.css +18 -0
  113. package/src/serve/hub-app/inbox.css +1 -0
  114. package/src/serve/hub-app/pull-refresh.tsx +88 -0
  115. package/src/serve/hub-app/recordings-st.ts +135 -24
  116. package/src/serve/hub-app/recordings-view.tsx +293 -54
  117. package/src/serve/hub-app/recordings.css +77 -24
  118. package/src/serve/hub-app/review/review-cells.tsx +52 -13
  119. package/src/serve/hub-app/review/review-list.tsx +6 -1
  120. package/src/serve/hub-app/review/review-st.ts +6 -5
  121. package/src/serve/hub-app/review/review-thread.tsx +3 -1
  122. package/src/serve/hub-app/review/review-views.tsx +18 -11
  123. package/src/serve/hub-app/review/thread-st.ts +82 -14
  124. package/src/serve/hub-app/review.css +15 -2
  125. package/src/serve/hub-runtime.ts +2 -1
  126. package/src/serve/run-serve.ts +4 -2
  127. package/src/serve/serve-hub.ts +9 -2
  128. package/src/shipkit-files.ts +5 -0
  129. package/src/social/drafts.ts +4 -3
  130. package/src/social/load.ts +7 -2
  131. package/src/social/publish/discord.ts +10 -3
  132. package/src/suite/child-tools.ts +45 -0
  133. package/src/suite/judge-suites.ts +10 -22
  134. package/src/suite/select.ts +83 -8
  135. package/src/suite/suite-cli.ts +38 -14
  136. package/src/suite/suite-cores.ts +68 -0
  137. package/src/suite/suite-reads-preload.ts +8 -6
  138. package/src/ts/config.ts +44 -0
  139. package/src/ts/rename.ts +11 -1
@@ -1,6 +1,7 @@
1
1
  /* the Recordings page (recordings-view.tsx): one editor window, the height of the page. The top row (repo, record,
2
2
  gallery), the toolbar, the stage that takes all the room left, a video's timeline and transport, the strip */
3
3
  .rcapp{display:flex;flex-direction:column;gap:var(--s2);height:100%;box-sizing:border-box;overflow:hidden;padding:var(--s2) var(--s3)}
4
+ .rcapp.rcsolo{gap:var(--s1);padding:var(--s1) var(--s2)}
4
5
  .rctop{display:flex;align-items:center;gap:var(--s1);flex-wrap:wrap}
5
6
  .rctop .sp,.rctoolbar .sp{flex:1}
6
7
  .rcdot{color:var(--red)}
@@ -9,24 +10,55 @@
9
10
  .rcapp .acpill.on{color:var(--accent);border-color:var(--accent)}
10
11
 
11
12
  .rced{flex:1;min-height:0;display:flex;flex-direction:column;gap:var(--s1)}
12
- .rctoolbar{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
13
- .rcrename{height:24px;width:200px;max-width:100%;box-sizing:border-box;background:var(--bg);color:var(--ink);border:1px solid var(--line);border-radius:4px;padding:0 var(--s2);font:inherit;font-weight:650}
14
- .rcrename:focus{outline:none;border-color:var(--accent)}
15
- .rcrepo{height:24px;background:var(--bg);color:var(--ink);border:1px solid var(--line);border-radius:4px;font:inherit;font-size:12px}
16
- .rcgroup{display:inline-flex;align-items:center;gap:var(--s0)}
17
- .rctool{min-width:28px;height:26px;padding:0 var(--s1);border:1px solid var(--line);border-radius:4px;background:var(--bg);color:var(--ink);font-size:14px;line-height:1;cursor:pointer}
18
- .rctool:hover{border-color:var(--accent)}
19
- .rctool.on{background:var(--accent);border-color:var(--accent);color:var(--bg)}
20
- .rctool:disabled{opacity:.4;cursor:default}
21
- .rcswatch{width:18px;height:18px;border-radius:50%;border:2px solid var(--line);padding:0;cursor:pointer}
22
- .rcswatch.on{border-color:var(--ink);box-shadow:0 0 0 2px var(--accent)}
23
- .rcinfo{font-size:11.5px}
13
+ /* two rows over the capture: what you do (tools, colours, undo, what ⌘C copies, Save), then what it is and where it
14
+ stands (name, repo, size, then disk, edit, Space, WebP) */
15
+ .rctoolbar,.rcinforow{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap;row-gap:var(--s1)}
16
+ .rcinforow .sp{flex:1}
17
+ .rcico{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;display:block}
18
+ .rcrename{height:24px;width:170px;max-width:100%;box-sizing:border-box;background:transparent;color:var(--ink);border:1px solid transparent;border-radius:4px;padding:0 var(--s1);font:inherit;font-size:13px;font-weight:650}
19
+ .rcrename:hover{border-color:var(--line)}
20
+ .rcrename:focus{outline:none;border-color:var(--accent);background:var(--bg)}
21
+ .rcrepo{height:24px;max-width:130px;background:var(--bg);color:var(--ink);border:1px solid var(--line);border-radius:4px;font:inherit;font-size:12px}
22
+ .rcgroup{display:inline-flex;align-items:center;gap:var(--s1)}
23
+ /* a run of tools is one bar: no gap, one border, the tool picked filled */
24
+ .rctools{gap:0;border:1px solid var(--line);border-radius:6px;background:var(--bg);overflow:hidden}
25
+ .rctool{display:inline-flex;align-items:center;justify-content:center;width:32px;height:28px;padding:0;border:0;border-radius:0;background:transparent;color:var(--ink);cursor:pointer}
26
+ .rctools .rctool+.rctool{border-left:1px solid var(--line)}
27
+ .rctool:hover:not(:disabled){background:var(--sel)}
28
+ .rctool.on,.rctool.on:hover{background:var(--accent);color:var(--bg)}
29
+ .rctool:disabled{opacity:.35;cursor:default;color:var(--ink)}
30
+ .rctool.rcalone{border:1px solid var(--line);border-radius:6px;background:var(--bg)}
31
+ .rcswatch{width:20px;height:20px;border-radius:50%;border:1px solid var(--hi1);padding:0;cursor:pointer}
32
+ .rcswatch.on{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--ink)}
33
+ .rcinfo{font-size:12px;color:var(--dim);font-variant-numeric:tabular-nums;white-space:nowrap}
34
+ .rckey{font-size:11px;font-weight:600;color:var(--dim);font-variant-numeric:tabular-nums}
35
+ .rcsave{display:inline-flex;align-items:center;gap:var(--s1);height:28px;padding:0 var(--s3);border:1px solid var(--line);border-radius:6px;background:var(--bg);color:var(--ok);font-size:12.5px;font-weight:650;cursor:pointer;white-space:nowrap}
36
+ .rcsave.dirty{background:var(--accent);border-color:var(--accent);color:var(--bg)}
37
+ .rcsave.dirty .rckey{color:var(--bg);opacity:.8}
38
+ .rcsave:disabled{opacity:1;cursor:default;color:var(--dim);border-color:var(--line)}
24
39
  .rcapp .ghost.on{color:var(--accent)}
40
+ /* where the capture stands: one chip a step, its light first */
41
+ .rcstanding{display:inline-flex;align-items:center;gap:var(--s1);flex-wrap:wrap}
42
+ .rcchip{display:inline-flex;align-items:center;gap:var(--s1);height:24px;padding:0 var(--s2);border:1px solid var(--line);border-radius:6px;background:var(--bg);font-size:12px;color:var(--ink);white-space:nowrap}
43
+ .rcchip b{font-weight:650;color:var(--dim)}
44
+ .rcchip.act{cursor:pointer}
45
+ .rcchip.act:hover{border-color:var(--accent)}
46
+ .rclight{width:8px;height:8px;border-radius:50%;box-sizing:border-box;flex:none}
47
+ .rcchip.ok .rclight{background:var(--ok)}
48
+ .rcchip.todo .rclight{border:1.5px solid var(--dim)}
49
+ .rcchip.todo>span{color:var(--dim)}
50
+ .rcchip.warn{border-color:var(--warn)}
51
+ .rcchip.warn .rclight{background:var(--warn)}
52
+ .rcchip.warn>span{color:var(--warn);font-weight:600}
53
+ .rcchip .rcspin.sm{border-color:var(--line);border-top-color:var(--accent)}
54
+ .rcver{height:20px;max-width:130px;margin-right:-4px;padding:0 var(--s1);border:1px solid var(--line);border-radius:4px;background:var(--panel2);color:var(--ink);font-size:11px}
25
55
 
26
- .rcstage{flex:1;min-height:120px;display:flex;align-items:center;justify-content:center;background:var(--chk2);border-radius:4px;overflow:hidden}
56
+ /* the capture on its ground: a dark line then a light one around it, so its edge reads on a light capture and on a
57
+ dark one, in either theme */
58
+ .rcstage{flex:1;min-height:120px;display:flex;align-items:center;justify-content:center;background:var(--chk1);border:1px solid var(--line);border-radius:6px;overflow:hidden}
27
59
  .rccanvas{position:relative;flex:none}
28
60
  .rccanvas.grown{background:repeating-conic-gradient(var(--chk1) 0% 25%,var(--chk2) 0% 50%) 0 0/16px 16px;outline:1px dashed var(--hair)}
29
- .rcframe{position:absolute;background:var(--solid)}
61
+ .rcframe{position:absolute;background:var(--solid);outline:1px solid var(--ink);box-shadow:0 0 0 2px var(--bg),0 6px 22px 2px var(--shadow)}
30
62
  .rcframe video,.rcframe img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;display:block}
31
63
  .rcdraw{position:absolute;inset:0;pointer-events:none}
32
64
  .rcstage{touch-action:none}
@@ -38,14 +70,11 @@
38
70
 
39
71
  .rctl{display:flex;flex-direction:column;gap:var(--s0)}
40
72
  .rcline{position:relative;height:26px;border:1px solid var(--line);border-radius:4px;background:var(--chk2);cursor:pointer;touch-action:none}
41
- .rcout{position:absolute;top:0;bottom:0;background:var(--hi2)}
42
73
  .rckeep{position:absolute;top:0;bottom:0;background:var(--wash);border-left:1px solid var(--hair);border-right:1px solid var(--hair)}
43
74
  .rcspeed{position:absolute;bottom:0;height:10px;background:var(--warn);color:var(--solid);font-size:9px;line-height:10px;text-align:center;opacity:.8}
44
75
  .rcsel{position:absolute;top:0;bottom:0;background:var(--hi2);border-left:2px solid var(--accent);border-right:2px solid var(--accent)}
45
76
  .rcmark{position:absolute;top:0;bottom:0;width:2px;transform:translateX(-50%);background:var(--accent)}
46
77
  .rchead{position:absolute;top:0;bottom:0;width:2px;transform:translateX(-50%);background:var(--red);pointer-events:none}
47
- .rchandle{position:absolute;top:-2px;bottom:-2px;width:8px;transform:translateX(-100%);background:var(--warn);border-radius:3px 0 0 3px;cursor:ew-resize}
48
- .rchandle.end{transform:none;border-radius:0 3px 3px 0}
49
78
  .rclane{position:relative;height:12px}
50
79
  .rcspan{position:absolute;top:2px;bottom:2px;border-radius:3px;opacity:.75;cursor:grab;display:flex;align-items:center;overflow:hidden;touch-action:none}
51
80
  .rclane.on .rcspan{opacity:1;outline:2px solid var(--accent)}
@@ -66,17 +95,41 @@
66
95
  .rctname i{color:var(--warn);font-style:normal}
67
96
  .rctmeta{font-size:10.5px;color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
68
97
  .rcacts{display:flex;gap:var(--s0)}
69
- .rcacts button{flex:1;height:20px;padding:0;border:1px solid var(--line);border-radius:3px;background:var(--panel2);color:var(--ink);font-size:11px;cursor:pointer}
98
+ .rcacts button{flex:1;display:inline-flex;align-items:center;justify-content:center;height:22px;padding:0;border:1px solid var(--line);border-radius:3px;background:var(--panel2);color:var(--ink);font-size:11px;cursor:pointer}
99
+ .rcacts .rcico{width:13px;height:13px}
70
100
  .rcacts button:hover{border-color:var(--accent)}
71
101
  .rcacts button.rcarmed{flex:2;background:var(--red);border-color:var(--red);color:var(--bg)}
72
102
  .rcgallery{flex:1;min-height:0;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,240px),1fr));gap:var(--s3);align-content:start}
73
103
  .rcthumb.big{width:auto}
104
+ .rcgtitle{font-size:13px;font-weight:650}
105
+ .rcsolo .rcgallery{padding-bottom:var(--s2)}
74
106
  .rcsolo{position:fixed;inset:0;background:var(--bg)}
75
107
  .rcsolo .rcsaid{position:absolute;right:var(--s3);bottom:var(--s2);z-index:2}
76
- .rctoolbar .rcacts{flex:none}
77
- .rctoolbar .rcacts button{flex:none;width:30px;height:24px;font-size:13px}
78
108
  /* instant tooltips: the native one waits a second; these show on hover at once */
79
- .rcapp [data-tip]{position:relative}
80
- .rcapp [data-tip]:hover::after{content:attr(data-tip);position:absolute;top:calc(100% + var(--s1));left:50%;transform:translateX(-50%);z-index:20;white-space:nowrap;padding:var(--s1) var(--s2);border-radius:4px;background:var(--ink);color:var(--bg);font:500 11.5px -apple-system,Helvetica,sans-serif;pointer-events:none}
81
- .rcstrip [data-tip]:hover::after{top:auto;bottom:calc(100% + var(--s1))}
82
- .rcup{display:inline-flex;align-items:center;gap:var(--s1);font-size:11.5px;color:var(--warn)}
109
+ .rctip{position:fixed;left:0;top:0;visibility:hidden;z-index:50;max-width:min(420px,calc(100vw - 12px));padding:var(--s1) var(--s2);border-radius:4px;background:var(--ink);color:var(--bg);font:500 11.5px -apple-system,Helvetica,sans-serif;pointer-events:none}
110
+ /* what ⌘C copies: one bar, each mode a dot of the recorder tray's own colour; the one picked is filled with it */
111
+ .rccopy{display:inline-flex;align-items:center;gap:var(--s1)}
112
+ .rcseg{display:inline-flex;border:1px solid var(--line);border-radius:6px;background:var(--bg);overflow:hidden}
113
+ .rcseg button{display:inline-flex;align-items:center;gap:var(--s1);height:26px;padding:0 var(--s3);border:0;border-radius:0;background:transparent;color:var(--ink);font-size:12px;font-weight:600;cursor:pointer}
114
+ .rcseg button+button{border-left:1px solid var(--line)}
115
+ .rcseg button i{width:8px;height:8px;border-radius:50%;background:var(--mode)}
116
+ .rcseg button:hover:not(:disabled):not(.on){background:var(--sel)}
117
+ .rcseg button.on{background:var(--mode);color:var(--recink)}
118
+ .rcseg button.on i{background:var(--recink)}
119
+ .rcseg button:disabled{opacity:.45;cursor:default;color:var(--ink)}
120
+ .rcseg .rcspin.sm{border-color:var(--mode);border-top-color:transparent}
121
+ .rcseg .on .rcspin.sm{border-color:var(--recink);border-top-color:transparent}
122
+ .rcspin.sm{width:9px;height:9px;border-width:2px;flex:none}
123
+ .rcmode-file{--mode:var(--recfile)}
124
+ .rcmode-webp-hq{--mode:var(--recwebp)}
125
+ .rcmode-link{--mode:var(--reclink)}
126
+ .rccuts{position:relative;height:18px;border:1px dashed var(--hair);border-radius:4px;cursor:crosshair;touch-action:none}
127
+ .rccutsname{position:absolute;left:var(--s1);top:0;bottom:0;display:flex;align-items:center;font-size:10px;font-weight:650;color:var(--dim);pointer-events:none;z-index:1}
128
+ .rccut{position:absolute;top:0;bottom:0;background:var(--red);opacity:.8;border-radius:3px;cursor:pointer}
129
+ .rccut.painting{opacity:.45;pointer-events:none}
130
+ .rccut.restoring{background:var(--ok);opacity:.7;pointer-events:none;z-index:1}
131
+ .rccutshint{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:10.5px;color:var(--dim);pointer-events:none}
132
+ .rcstagebox{position:relative;flex:1;min-height:120px;display:flex}
133
+ .rcexporting{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--s1);background:var(--chk2);opacity:.92;border-radius:4px;font-size:12px;color:var(--ink)}
134
+ .rcspin{width:22px;height:22px;border:3px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:rcspin .8s linear infinite}
135
+ @keyframes rcspin{to{transform:rotate(360deg)}}
@@ -4,14 +4,14 @@
4
4
  // click shows the view they sit on), a reply and a note are words; a run of state changes is one thin line
5
5
  import { observer } from 'mobx-react-lite'
6
6
  import type { EventCell, NoteCell, ReplyCell, VerdictCell, VersionCell } from '../../../review/cells.ts'
7
- import { isGallery, isTrailerCard, STATUS_LABEL, viewName, viewTag, type Item, type Rect, type TrailerCard } from '../../../review/model.ts'
7
+ import { isGallery, isTrailerCard, STATUS_LABEL, UPDATE_WORDS, viewName, viewTag, type Item, type Rect, type TrailerCard } from '../../../review/model.ts'
8
8
  import { Caret, Icon, ICON } from '../icons.tsx'
9
9
  import { renderMd } from '../md.ts'
10
10
  import { ageWords, stampWords } from '../time-ago.tsx'
11
11
  import { KindView, AnimPanel } from './kind-view.tsx'
12
12
  import { keepFocus, laneColor, REACTIONS, secs, SIDE_LABEL, toneOf } from './kit.tsx'
13
13
  import type { ReviewSt } from './review-st.ts'
14
- import { VersionViews } from './review-views.tsx'
14
+ import { VersionViews, ViewCell } from './review-views.tsx'
15
15
  import { cellDom, type Framed, type ThreadSt } from './thread-st.ts'
16
16
  import { NoteMeta, NoteStill, TrailerCardBody } from './trailer-card.tsx'
17
17
 
@@ -57,8 +57,9 @@ export const CellFrame = observer(({ rv, card, c }: { rv: ReviewSt; card: Thread
57
57
  <button className="rv-foldbtn" aria-label={open ? 'fold' : 'unfold'} aria-expanded={open} onMouseDown={keepFocus} onClick={(e) => { e.stopPropagation(); card.toggleCell(c) }}><Caret open={open} /></button>
58
58
  <Avatar who={c.who} />
59
59
  {avatarText(c.who) === whoWords(c.who) ? null : <b className="rv-cwho">{whoWords(c.who)}</b>}
60
- <span className="rv-ckind">{c.kind === 'version' ? `v${c.n}` : c.kind === 'reply' && c.op ? (c.op === 'ask' ? 'question' : 'answer') : KIND_LABEL[c.kind]}</span>
60
+ <span className="rv-ckind">{c.kind === 'version' ? `v${c.n}` : c.kind === 'reply' && c.op ? (c.op === 'ask' ? 'question' : 'answer') : c.kind === 'reply' && c.update ? `update ${c.update.k}` : c.kind === 'reply' && c.re ? `hint on update ${c.re.k}` : KIND_LABEL[c.kind]}</span>
61
61
  {c.kind === 'version' ? <span className="rv-badge">{STATUS_LABEL[c.status]}</span> : null}
62
+ {c.kind === 'reply' && c.update ? <span className={`rv-badge rv-up up-${c.update.state}`}>{UPDATE_WORDS[c.update.state]}</span> : null}
62
63
  {c.kind === 'verdict' ? <span className="rv-badge">{STATUS_LABEL[c.verdict]}</span> : null}
63
64
  {c.kind === 'verdict' ? (
64
65
  <button className="rv-on ghost" title={c.n > 0 ? `the version this answers: v${c.n}` : 'the note this answers'} onMouseDown={keepFocus} onClick={(e) => { e.stopPropagation(); card.reveal(c.on) }}>↑ on {c.n > 0 ? `v${c.n}` : 'the note'}</button>
@@ -75,7 +76,7 @@ export const CellFrame = observer(({ rv, card, c }: { rv: ReviewSt; card: Thread
75
76
  </header>
76
77
  {open ? (
77
78
  <div className="rv-cbody">
78
- {c.kind === 'version' ? <VersionBody rv={rv} card={card} c={c} /> : c.kind === 'verdict' ? <VerdictBody card={card} c={c} /> : c.kind === 'reply' ? <ReplyBody rv={rv} c={c} /> : <NoteBody rv={rv} c={c} />}
79
+ {c.kind === 'version' ? <VersionBody rv={rv} card={card} c={c} /> : c.kind === 'verdict' ? <VerdictBody card={card} c={c} /> : c.kind === 'reply' ? <ReplyBody rv={rv} card={card} c={c} /> : <NoteBody rv={rv} c={c} />}
79
80
  </div>
80
81
  ) : (
81
82
  <div className="rv-csum" onClick={() => card.toggleCell(c)}>{c.summary || '·'}</div>
@@ -204,15 +205,53 @@ const TrailerVerdictRows = observer(({ card, c, item }: { card: ThreadSt; c: Ver
204
205
  </div>
205
206
  ))
206
207
 
207
- /** words of either party, and an image he pasted */
208
- const ReplyBody = ({ rv, c }: { rv: ReviewSt; c: ReplyCell }) => (
209
- <>
210
- <div className="rv-pre rv-words">{c.text}</div>
211
- {c.image ? (
212
- <a href={rv.threadImageUrl(c.on, c.image)} target="_blank" rel="noreferrer"><img className="rv-msgimg" src={rv.threadImageUrl(c.on, c.image)} alt="" loading="lazy" /></a>
213
- ) : null}
214
- </>
215
- )
208
+ /** words of either party, and an image he pasted; an agent's update draws its view here, at its time, and takes his hint */
209
+ const ReplyBody = observer(({ rv, card, c }: { rv: ReviewSt; card: ThreadSt; c: ReplyCell }) => {
210
+ const version = c.update?.view !== undefined ? card.versionOf(c.on) : null
211
+ const view = c.update?.view !== undefined ? version?.item.views[c.update.view] : undefined
212
+ return (
213
+ <>
214
+ {c.re ? (
215
+ <button className="rv-on ghost" onMouseDown={keepFocus} onClick={() => card.reveal(c.re!.id)}>↑ on update {c.re.k} · {UPDATE_WORDS[c.re.state]}</button>
216
+ ) : null}
217
+ <div className="rv-pre rv-words">{c.text}</div>
218
+ {c.image ? (
219
+ <a href={rv.threadImageUrl(c.on, c.image)} target="_blank" rel="noreferrer"><img className="rv-msgimg" src={rv.threadImageUrl(c.on, c.image)} alt="" loading="lazy" /></a>
220
+ ) : null}
221
+ {version && view && c.update?.view !== undefined ? (
222
+ <ViewCell
223
+ ver={{ rv, card, cell: version, live: version.id === card.head?.id && card.takesVerdict, claim: version.id === card.newest?.id && card.claims }}
224
+ v={view}
225
+ i={c.update.view}
226
+ noted={false}
227
+ />
228
+ ) : null}
229
+ {c.update && c.party === 'agent' ? <HintBox card={card} c={c} /> : null}
230
+ </>
231
+ )
232
+ })
233
+
234
+ /** his few words on one update: a hint the agent reads, the card left as it is */
235
+ const HintBox = observer(({ card, c }: { card: ThreadSt; c: ReplyCell }) => {
236
+ const text = card.hints[c.id] ?? ''
237
+ return (
238
+ <div className="rv-hint">
239
+ <input
240
+ type="text"
241
+ placeholder="a hint on this update (Enter sends it, the card stays as it is)"
242
+ value={text}
243
+ onChange={(e) => card.setHint(c.id, e.target.value)}
244
+ onKeyDown={(e) => {
245
+ if (e.key === 'Enter') {
246
+ e.preventDefault()
247
+ void card.sendHint(c)
248
+ }
249
+ }}
250
+ />
251
+ <button disabled={!text.trim() || card.busy} onMouseDown={keepFocus} onClick={() => void card.sendHint(c)}>hint</button>
252
+ </div>
253
+ )
254
+ })
216
255
 
217
256
  /** what he or a player raised, or his mark: the words, the still with his rectangles on it */
218
257
  const NoteBody = ({ rv, c }: { rv: ReviewSt; c: NoteCell }) => {
@@ -3,7 +3,7 @@
3
3
  import { observer } from 'mobx-react-lite'
4
4
  import { useEffect, useRef } from 'react'
5
5
  import type { ThreadRow } from '../../../review/cells.ts'
6
- import { MOVE_LABEL, STATUS_LABEL, subjectLabel, type Move, type ShownStatus } from '../../../review/model.ts'
6
+ import { MOVE_LABEL, STATUS_LABEL, subjectLabel, UPDATE_WORDS, type Move, type ShownStatus } from '../../../review/model.ts'
7
7
  import { AutoTag, LaneTag, laneColor, Listeners, Rework, ThumbOf, toneOf } from './kit.tsx'
8
8
  import { ReviewBoard } from './review-board.tsx'
9
9
  import type { ReviewSt } from './review-st.ts'
@@ -114,6 +114,11 @@ const Row = observer(({ rv, r, on }: { rv: ReviewSt; r: ThreadRow; on: boolean }
114
114
  {r.rule ? <AutoTag rule={r.rule} /> : null}
115
115
  <span className="rv-about">{ABOUT(r, rv)}</span>
116
116
  </div>
117
+ {r.update ? (
118
+ <div className={`rv-rowupdate up-${r.update.state}`} title={r.update.text}>
119
+ <b>{UPDATE_WORDS[r.update.state]}</b> {r.update.text}
120
+ </div>
121
+ ) : null}
117
122
  <Rework r={r.rework} />
118
123
  </div>
119
124
  </div>
@@ -338,10 +338,10 @@ export class ReviewSt {
338
338
  return `${f ? `${f}&` : ''}limit=${this.shown}`
339
339
  }
340
340
 
341
- /** the verdict he just gave, by thread head: its row shows it at once, while the store takes it */
342
- answering: Record<string, ReviewStatus> = {}
341
+ /** the verdict he just gave or took back (`pending`), by thread head: its row shows it at once, while the store takes it */
342
+ answering: Record<string, ReviewStatus | 'pending'> = {}
343
343
 
344
- setAnswering(head: string, status: ReviewStatus | null): void {
344
+ setAnswering(head: string, status: ReviewStatus | 'pending' | null): void {
345
345
  if (status === null) delete this.answering[head]
346
346
  else this.answering[head] = status
347
347
  }
@@ -599,9 +599,10 @@ export class ReviewSt {
599
599
  return `${this.st.url(`/api/review/${id}/${name}`)}${wip ? `?f=${wip.frame}` : ''}`
600
600
  }
601
601
 
602
- /** an image at the size the card column draws it (1600 px webp); any other file is the file itself */
602
+ /** an image at the size the card column draws it (1600 px webp), a clip as it plays (its play copy when it is over
603
+ * the line); any other file is the file itself */
603
604
  fitUrl(id: string, name: string, wip?: { frame: number }): string {
604
- return /\.(png|jpe?g|webp)$/i.test(name) ? `${this.st.url(`/api/review/${id}/preview/fit/${name}`)}${wip ? `?f=${wip.frame}` : ''}` : this.fileUrl(id, name, wip)
605
+ return /\.(png|jpe?g|webp|mp4|webm|mov|m4v)$/i.test(name) ? `${this.st.url(`/api/review/${id}/preview/fit/${name}`)}${wip ? `?f=${wip.frame}` : ''}` : this.fileUrl(id, name, wip)
605
606
  }
606
607
 
607
608
  /** an image at the list's size (480 px webp) */
@@ -317,8 +317,10 @@ const Composer = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
317
317
  <div className="rv-acts">
318
318
  {verdicts
319
319
  ? VERDICTS.map((x) => (
320
- <button key={x.status} className={`rv-verdict ${toneOf(x.status)}${sent === x.status ? ' chosen' : ''}`} disabled={card.busy} onClick={() => void card.submit(x.status)} title={`${x.label} (${x.key})`}>
320
+ <button key={x.status} className={`rv-verdict ${toneOf(x.status)}${sent === x.status ? ' chosen' : ''}`} disabled={card.busy} onClick={() => void card.submit(x.status)}
321
+ title={sent === x.status ? `${x.label}: your answer now. Click again (${x.key}) to take it back, the card waits for you again` : `${x.label} (${x.key})`}>
321
322
  {rv.phone.on ? x.short : <><span className="rv-vglyph">{x.glyph}</span> {x.short} ({x.key})</>}
323
+ {sent === x.status ? <span className="rv-undo" aria-label="click again to take it back"> ↺</span> : null}
322
324
  </button>
323
325
  ))
324
326
  : null}
@@ -48,6 +48,8 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
48
48
  const drawable = takes(ver) && views.some((v) => isGallery(v) || (!v.clip && !v.audio))
49
49
  // a draft card's history is no view of its own: its frames cycle in place over the live one
50
50
  const history = item.wip ? views.find(isGallery) : undefined
51
+ // 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))
51
53
  const options = rows || (card.full[item.id] === true)
52
54
  return (
53
55
  <div className="rv-views">
@@ -73,16 +75,16 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
73
75
  ) : null}
74
76
  </div>
75
77
  {rows ? (
76
- <div className="rv-opts">{views.map((v, i) => <OptionRow key={i} ver={ver} v={v} i={i} />)}</div>
78
+ <div className="rv-opts">{views.map((v, i) => (owned.has(i) ? null : <OptionRow key={i} ver={ver} v={v} i={i} />))}</div>
77
79
  ) : (
78
- views.map((v, i) => (v === history ? null : <ViewCell key={i} ver={ver} v={v} i={i} {...(i === 0 && history && isGallery(history) ? { frames: history } : {})} />))
80
+ views.map((v, i) => (v === history || owned.has(i) ? null : <ViewCell key={i} ver={ver} v={v} i={i} {...(i === 0 && history && isGallery(history) ? { frames: history } : {})} />))
79
81
  )}
80
82
  </div>
81
83
  )
82
84
  })
83
85
 
84
86
  /** 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 */
85
- const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewView; i: number; frames?: GalleryView }) => {
87
+ export const ViewCell = observer(({ ver, v: live, i, frames, noted = true }: { ver: Ver; v: ReviewView; i: number; frames?: GalleryView; noted?: boolean }) => {
86
88
  const { rv, card, cell } = ver
87
89
  const past = frames && card.frame !== null ? frames.gallery[card.frame] : undefined
88
90
  const v: ReviewView = past && !isGallery(live) ? { ...live, files: { image: past.file }, size: past.size } : live
@@ -110,7 +112,7 @@ const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewVie
110
112
  <div className="rv-viewbody">
111
113
  {frames ? <FrameSlider card={card} frames={frames} /> : null}
112
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} />}
113
- {media?.note ? <div className="rv-viewnote">{media.note}</div> : null}
115
+ {noted && media?.note ? <div className="rv-viewnote">{media.note}</div> : null}
114
116
  </div>
115
117
  ) : null}
116
118
  </section>
@@ -216,6 +218,7 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
216
218
  const reaction = card.reactionShown(cell, i)
217
219
  const choice = isChoice(item)
218
220
  const picked = card.pickShown(cell) === i
221
+ const held = takes(ver) && card.holdsPick(id, i)
219
222
  const unfolded = card.rowOpen(item, i)
220
223
  const file = playable ? ('video' in playable.files ? playable.files.video : 'audio' in playable.files ? playable.files.audio : '') : ''
221
224
  const duration = playable?.clip?.duration ?? playable?.audio?.duration ?? 0
@@ -237,7 +240,7 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
237
240
  {choice && item.agentPick === i ? <span className="rv-mypick" title="the option the agent suggests; your pick is your own">my pick</span> : null}
238
241
  {c && playable?.clip && !unfolded ? (
239
242
  <span className="rv-optthumb" style={{ aspectRatio: `${playable.size.w} / ${playable.size.h}` }} onClick={() => card.toggleRow(item, i)} title="the full view">
240
- <ClipVideo clip={c} src={rv.fileUrl(id, file, item.wip)} poster={rv.thumbUrl(id, playable.clip.poster)} loop={false} />
243
+ <ClipVideo clip={c} src={rv.fitUrl(id, file, item.wip)} poster={rv.thumbUrl(id, playable.clip.poster)} loop={false} />
241
244
  </span>
242
245
  ) : null}
243
246
  {c && playable && clock2 ? (
@@ -254,8 +257,9 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
254
257
  ) : null}
255
258
  {playable?.audio ? <a className="rv-dl" href={rv.fileUrl(id, file)} download={`${id}-${file}`} title="download the sound">⤓</a> : null}
256
259
  {choice && takes(ver) ? (
257
- <button className={`rv-pick${picked ? ' on' : ''}`} title="pick this one: it is your answer (P)" disabled={card.busy} onClick={() => mark(ver, () => void card.choose(i))}>
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))}>
258
261
  {picked ? '✓ picked' : 'pick'}
262
+ {held ? <span className="rv-undo" aria-label="click again to take it back"> ↺</span> : null}
259
263
  </button>
260
264
  ) : choice && picked ? <span className="rv-pick on">✓ picked</span> : null}
261
265
  </span>
@@ -561,7 +565,8 @@ const MediaBody = observer(({ ver, v, i, zoom }: { ver: Ver; v: MediaView; i: nu
561
565
  const aspect = `${v.size.w} / ${v.size.h}`
562
566
  const scale = zoom === 'fit' ? null : Number(zoom)
563
567
  const room = FIT_ROOM + (v.clip ? 40 : 0)
564
- const src = (name: string): string => (v.clip ? rv.fileUrl(id, name, item.wip) : scale ? rv.fileUrl(id, name, item.wip) : rv.fitUrl(id, name, item.wip))
568
+ // 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))
565
570
  const bar = v.clip ? <ClipBar clip={card.clipOf(id, i)} info={v.clip} use={() => ver.live && card.setView(i)} /> : null
566
571
  const scroll = scale ? { overflow: 'auto', maxHeight: `calc(100vh - ${room}px)` } : undefined
567
572
  if (!isPair(f)) {
@@ -835,7 +840,7 @@ const Frame = ({ aspect, caption, modCap, swipe, onPeek, over, children }: { asp
835
840
  const frame = useRef<HTMLDivElement>(null)
836
841
  const down = (e: React.PointerEvent): void => {
837
842
  const el = frame.current
838
- if (!swipe || !el) return
843
+ if (!swipe || !el || !e.isPrimary) return
839
844
  e.preventDefault()
840
845
  const at = (x: number): void => {
841
846
  const r = el.getBoundingClientRect()
@@ -882,11 +887,13 @@ export function dragBox(e: { clientX: number; clientY: number }, el: Element, sh
882
887
  cur = { ...cur, x1: b.x, y1: b.y }
883
888
  show(cur)
884
889
  }
885
- const up = (): void => {
890
+ const up = (ev: PointerEvent): void => {
886
891
  window.removeEventListener('pointermove', move)
887
892
  window.removeEventListener('pointerup', up)
888
893
  window.removeEventListener('pointercancel', up)
889
894
  show(null)
895
+ // a second finger hands the gesture to the browser's pinch, which cancels this one: no rectangle, no tap
896
+ if (ev.type === 'pointercancel') return
890
897
  const r = box(cur)
891
898
  end(r.w > MIN_DRAG && r.h > MIN_DRAG ? r : null)
892
899
  }
@@ -930,7 +937,7 @@ const Marks = observer(({ ver, src, side, view, face, tile, onTap, alone, notes
930
937
  const drawing = takes(ver) && (phone.on ? phone.draw && (free || phone.pair !== 'swipe' || rv.compare.mode !== 'swipe') : free || rv.compare.mode !== 'swipe')
931
938
  const c = clock?.c ?? null
932
939
  const down = (e: React.PointerEvent): void => {
933
- if (e.button !== 0) return
940
+ if (e.button !== 0 || !e.isPrimary) return
934
941
  if (clock && ver.live && !active) {
935
942
  e.preventDefault()
936
943
  card.setView(view)
@@ -955,7 +962,7 @@ const Marks = observer(({ ver, src, side, view, face, tile, onTap, alone, notes
955
962
  const rings = rv.marksOn ? (shown?.marks ?? []).filter((m) => m.side === side) : []
956
963
  const live = drawing || (clock !== null && ver.live && !active)
957
964
  return (
958
- <div ref={el} className={`rv-marks${clock && ver.live && !active ? ' pick' : drawing ? ' draw' : ''}`} onPointerDown={down} style={{ pointerEvents: live ? 'auto' : 'none', touchAction: drawing ? 'none' : undefined }}>
965
+ <div ref={el} className={`rv-marks${clock && ver.live && !active ? ' pick' : drawing ? ' draw' : ''}`} onPointerDown={down} style={{ pointerEvents: live ? 'auto' : 'none', touchAction: drawing ? 'pinch-zoom' : undefined }}>
959
966
  {face ?? (c ? <ClipVideo key={src} clip={c} src={src} poster={shown?.clip ? rv.fitUrl(cell.id, shown.clip.poster) : undefined} preload={ver.live ? 'auto' : 'none'} /> : <img src={src} alt="" draggable={false} className="rv-markimg" loading="lazy" decoding="async" />)}
960
967
  {shown && rings.length > 0 ? <Rings marks={rings} w={shown.size.w} h={shown.size.h} /> : null}
961
968
  {notes
@@ -144,9 +144,11 @@ export class ThreadSt {
144
144
  full: Record<string, boolean> = {}
145
145
  /** an option row folded or unfolded by hand, by `<item>#<view>` */
146
146
  openRows: Record<string, boolean> = {}
147
+ /** his hint being typed on an agent's update, by the update's cell id */
148
+ hints: Record<string, string> = {}
147
149
  busy = false
148
- /** the verdict he just gave: shown as chosen the moment he clicks, while the store takes it */
149
- sending: { on: string; status: ReviewStatus } | null = null
150
+ /** the verdict he just gave (null: the one he took back): shown the moment he clicks, while the store takes it */
151
+ sending: { on: string; status: ReviewStatus | null } | null = null
150
152
  private readonly clips = new Map<string, ClipSt>()
151
153
  /** a trailer card's player, by its version's id */
152
154
  private readonly trailers = new Map<string, TrailerSt>()
@@ -431,7 +433,10 @@ export class ThreadSt {
431
433
  if (h?.kind !== 'version' || h.item.wip) return []
432
434
  const sent = this.verdictsOn(h.id).findLast((v) => v.current)
433
435
  const choice = isChoice(h.item)
434
- return h.item.views.map((v, i) => {
436
+ // an older update's picture is history: only the newest one waits for his answer
437
+ const ups = this.updateViewsOf(h.id)
438
+ const past = new Set(ups.slice(0, -1))
439
+ return h.item.views.flatMap((v, i) => (past.has(i) ? [] : [{ v, i }])).map(({ v, i }) => {
435
440
  const own = this.reactionOf(i)
436
441
  const given = sent?.reactions.find((r) => r.view === i && r.tile === undefined)
437
442
  const r = own ?? given
@@ -444,6 +449,11 @@ export class ThreadSt {
444
449
  })
445
450
  }
446
451
 
452
+ /** the views of an item its agent's updates hold, oldest update first: they draw in the update's cell */
453
+ updateViewsOf(on: string): number[] {
454
+ return this.cells.flatMap((c) => (c.kind === 'reply' && c.on === on && c.update?.view !== undefined ? [c.update.view] : []))
455
+ }
456
+
447
457
  /** the views of that version still waiting for his answer, of all its views: « 3 of 5 views waiting for you » */
448
458
  get waitingViews(): { waiting: number; of: number } | null {
449
459
  const marks = this.viewMarks
@@ -456,8 +466,8 @@ export class ThreadSt {
456
466
  /** the verdicts on one version, oldest first */
457
467
  /** the verdict a version shows as chosen: the one being sent, else its current one */
458
468
  chosenOn(id: string): ReviewStatus | undefined {
459
- if (this.sending?.on === id) return this.sending.status
460
- return this.verdictsOn(id).findLast((x) => x.current)?.verdict
469
+ if (this.sending?.on === id) return this.sending.status ?? undefined
470
+ return this.currentVerdict(id)?.verdict
461
471
  }
462
472
 
463
473
  verdictsOn(id: string): VerdictCell[] {
@@ -693,10 +703,15 @@ export class ThreadSt {
693
703
  return [...(this.draft.reactions ?? [])].sort((a, b) => a.view - b.view || (a.tile ?? -1) - (b.tile ?? -1))
694
704
  }
695
705
 
696
- /** « pick »: that option is his answer, sent at once as an approval; his stars and words go with it */
706
+ /** « pick »: that option is his answer, sent at once as an approval; his stars and words go with it. The option he
707
+ * picked, clicked again, takes the pick back */
697
708
  async choose(view: number): Promise<void> {
698
709
  const h = this.head
699
710
  if (h?.kind !== 'version' || !isChoice(h.item)) return
711
+ if (this.holdsPick(h.id, view)) {
712
+ this.edit(({ pick: _, ...d }) => d)
713
+ return this.takeBack()
714
+ }
700
715
  this.edit((d) => ({ ...d, pick: view }))
701
716
  await this.submit('approved')
702
717
  }
@@ -847,7 +862,19 @@ export class ThreadSt {
847
862
 
848
863
  // ── what he sends ──
849
864
 
850
- /** V, F, R, A: the draft goes to the newest version as the owner's verdict */
865
+ /** the verdict that holds on a version now, as sent: what a click on the lit verdict takes back */
866
+ private currentVerdict(id: string): VerdictCell | undefined {
867
+ return this.verdictsOn(id).findLast((x) => x.current)
868
+ }
869
+
870
+ /** that option is the pick his answer holds: a click on it takes it back */
871
+ holdsPick(id: string, view: number): boolean {
872
+ const v = this.currentVerdict(id)
873
+ return v?.verdict === 'approved' && v.pick === view
874
+ }
875
+
876
+ /** V, F, R, A: the draft goes to the newest version as the owner's verdict. The verdict that holds already, clicked
877
+ * again, is taken back instead (a new pick on a choice is a new answer) */
851
878
  async submit(status: ReviewStatus): Promise<void> {
852
879
  const h = this.head
853
880
  if (!h || this.busy) return
@@ -860,20 +887,36 @@ export class ThreadSt {
860
887
  return
861
888
  }
862
889
  const d = this.draft
863
- const head = this.data?.head ?? h.id
864
- this.busy = true
865
- this.error = null
866
- this.sending = { on: h.id, status }
867
- this.rv.setAnswering(head, status)
868
- try {
890
+ const held = this.currentVerdict(h.id)
891
+ if (held?.verdict === status && (d.pick === undefined || d.pick === held.pick)) return this.takeBack()
892
+ await this.send(h.id, status, async () => {
869
893
  const pick = isChoice(h.item) && isApproved(status) && d.pick !== undefined ? { pick: d.pick } : {}
870
894
  await postJson(this.rv.url(`/api/review/${h.id}/feedback`), { status, comment: d.comment, rects: d.rects, reactions: d.reactions ?? [], ...pick })
871
895
  runInAction(() => this.settle(h.id, d))
896
+ })
897
+ }
898
+
899
+ /** a click on his lit verdict: he takes it back, and the card waits for his answer again (the old verdict stays in
900
+ * the thread, an agent's watch hears it); his draft stays as it is */
901
+ async takeBack(): Promise<void> {
902
+ const h = this.head
903
+ if (h?.kind !== 'version' || this.busy || !this.currentVerdict(h.id)) return
904
+ await this.send(h.id, null, () => postJson(this.rv.url(`/api/review/${h.id}/reopen`), {}))
905
+ }
906
+
907
+ /** one answer on its way: shown at once on the card and its row, the truth again once the store took it or refused */
908
+ private async send(on: string, status: ReviewStatus | null, post: () => Promise<unknown>): Promise<void> {
909
+ const head = this.data?.head ?? on
910
+ this.busy = true
911
+ this.error = null
912
+ this.sending = { on, status }
913
+ this.rv.setAnswering(head, status ?? 'pending')
914
+ try {
915
+ await post()
872
916
  await this.rv.answered()
873
917
  } catch (e) {
874
918
  runInAction(() => (this.error = (e as Error).message))
875
919
  } finally {
876
- // the store's answer is in by now, or the send failed: either way what shows is the truth again
877
920
  runInAction(() => {
878
921
  this.busy = false
879
922
  this.sending = null
@@ -905,6 +948,31 @@ export class ThreadSt {
905
948
  }
906
949
  }
907
950
 
951
+ setHint(cellId: string, text: string): void {
952
+ this.hints[cellId] = text
953
+ }
954
+
955
+ /** Enter or « hint »: his few words on one update go to its item as a reply naming it; the card stays as it is */
956
+ async sendHint(c: { id: string; on: string }): Promise<void> {
957
+ const sent = this.hints[c.id] ?? ''
958
+ const text = sent.trim()
959
+ const re = c.id.slice(c.on.length + 1)
960
+ if (!text || this.busy) return
961
+ this.busy = true
962
+ this.error = null
963
+ try {
964
+ await postJson(this.rv.url(`/api/review/${c.on}/reply`), { text, re })
965
+ runInAction(() => {
966
+ if (this.hints[c.id] === sent) delete this.hints[c.id]
967
+ })
968
+ await this.rv.answered()
969
+ } catch (e) {
970
+ runInAction(() => (this.error = (e as Error).message))
971
+ } finally {
972
+ runInAction(() => (this.busy = false))
973
+ }
974
+ }
975
+
908
976
  /** the agent words he has not read, by cell id: the page sends them read once each shows on his screen */
909
977
  get unreadCells(): string[] {
910
978
  return this.cells.filter((c) => (c.kind === 'reply' || c.kind === 'note') && c.party === 'agent' && !c.read && c.id.includes('/')).map((c) => c.id)
@@ -79,9 +79,18 @@
79
79
  color:var(--bg);background:var(--tone,var(--dim));white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}
80
80
  .rv-badge.outline{background:none;color:var(--ink);border:1px solid var(--line)}
81
81
  .rv-about{font-size:11px;color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
82
+ /* an agent's update: where the work stands, at a glance; its tone the state's */
83
+ .up-broken{--tone:var(--red)}
84
+ .up-better{--tone:var(--warn)}
85
+ .up-fixed{--tone:var(--ok)}
86
+ .rv-rowupdate{font-size:11.5px;line-height:1.35;margin-top:var(--s0);color:var(--ink);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
87
+ .rv-rowupdate b{color:var(--tone);text-transform:uppercase;font-size:10px;letter-spacing:.04em;margin-right:var(--s1)}
88
+ .rv-hint{display:flex;gap:var(--s1);margin-top:var(--s2)}
89
+ .rv-hint input{flex:1;min-width:0;font-size:13px}
82
90
  /* a narrow list: the title on its own line on top, a smaller image under it beside the badges */
83
91
  @container (max-width:250px){
84
- .rv-row{display:grid;grid-template-columns:40px minmax(0,1fr);grid-template-areas:"title title" "thumb meta" "rework rework";align-items:center;column-gap:var(--s2);row-gap:var(--s1)}
92
+ .rv-row{display:grid;grid-template-columns:40px minmax(0,1fr);grid-template-areas:"title title" "thumb meta" "update update" "rework rework";align-items:center;column-gap:var(--s2);row-gap:var(--s1)}
93
+ .rv-row .rv-rowupdate{grid-area:update;margin-top:0}
85
94
  .rv-row .rv-rowbody{display:contents}
86
95
  .rv-row .rv-rowtitle{grid-area:title}
87
96
  .rv-row .rv-thumb{grid-area:thumb;width:40px;height:40px}
@@ -218,6 +227,10 @@
218
227
  .rv-verdict{padding:var(--s1) var(--s3);font-size:13px;border-color:color-mix(in srgb,var(--tone) 60%,var(--line))}
219
228
  .rv-verdict .rv-vglyph{color:var(--tone);font-weight:800}
220
229
  .rv-verdict.chosen{background:color-mix(in srgb,var(--tone) 22%,var(--panel));border-color:var(--tone)}
230
+ /* the lit verdict or pick is a toggle: its ↺ says a click takes it back, and a hover shows it lifting */
231
+ .rv-undo{opacity:.7;font-weight:700}
232
+ .rv-verdict.chosen:hover:not(:disabled),.rv-pick.on:hover:not(:disabled){border-style:dashed;background:var(--panel)}
233
+ .rv-pick.on:hover:not(:disabled){color:var(--ok)}
221
234
  .rv-send{padding:var(--s1) var(--s4)}
222
235
 
223
236
  /* ── a version's views: each a sub cell, its number and title big, its kind, then what was said on it ── */
@@ -259,7 +272,7 @@ span.rv-react{display:inline-block;border:1px solid;border-radius:4px}
259
272
  .rv-over:has(.rv-note){z-index:5}
260
273
  .rv-frame{position:relative;width:100%;max-width:100%;border-radius:4px;border:1px solid var(--line);overflow:hidden;
261
274
  background:repeating-conic-gradient(var(--chk1) 0 25%,var(--chk2) 0 50%) 0 0/16px 16px}
262
- .rv-frame.swipe{cursor:ew-resize;touch-action:none}
275
+ .rv-frame.swipe{cursor:ew-resize;touch-action:pan-y pinch-zoom}
263
276
  .rv-fill{position:absolute;inset:0}
264
277
  .rv-caption{font-size:11px;color:var(--dim)}
265
278
  .rv-caption.mod,.rv-modcap{color:var(--k2)}