rvlib-shipkit 2.11.0 → 2.13.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.
- package/CHANGELOG.md +56 -12
- package/README.md +1 -1
- package/package.json +4 -2
- package/src/agent-time/store.ts +2 -2
- package/src/check.ts +1 -1
- package/src/checks/SK001-package-json-shape.check.ts +4 -0
- package/src/checks/SK003-claude-md-shape.check.ts +1 -1
- package/src/checks/SK004-gitignore-policy.check.ts +27 -2
- package/src/checks/SK005-rvlib-versions.check.ts +1 -1
- package/src/checks/SK008-reviewer-agent.check.ts +2 -2
- package/src/checks/SK012-config-barrel-import.check.ts +1 -1
- package/src/checks/SK015-nested-repo.check.ts +1 -1
- package/src/checks/SK035-public-clean.check.ts +46 -0
- package/src/checks/SK036-draft-media-size.check.ts +28 -0
- package/src/cli/cmd_Backup.ts +152 -0
- package/src/cli/cmd_Ci.ts +8 -11
- package/src/cli/cmd_Drill.ts +145 -0
- package/src/cli/cmd_Home.ts +50 -3
- package/src/cli/cmd_Media.ts +96 -5
- package/src/cli/cmd_Review.ts +8 -2
- package/src/cli/cmd_Shot.ts +5 -2
- package/src/cli/cmd_Smoke.ts +4 -1
- package/src/cli/cmd_Social.ts +226 -0
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +9 -2
- package/src/cli/cmd_Veille.ts +173 -0
- package/src/cli/family-pages.ts +3 -0
- package/src/cli/registry.ts +13 -2
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +1 -49
- package/src/collections/checks.ts +2 -1
- package/src/collections/collection-types.ts +11 -2
- package/src/collections/providers.ts +4 -4
- package/src/collections/review.ts +2 -1
- package/src/collections/tests.ts +19 -8
- package/src/contracts/apply-contracts.ts +1 -3
- package/src/contracts/contract-manifests.ts +2 -3
- package/src/contracts/contract-types.ts +0 -1
- package/src/contracts/contracts-engine.ts +0 -3
- package/src/core/app-icon.ts +9 -3
- package/src/core/bun-builtins.ts +2 -2
- package/src/core/discover-checks.ts +37 -5
- package/src/core/fix-scope.ts +4 -2
- package/src/core/floor-resolve.ts +68 -48
- package/src/core/floor.ts +9 -0
- package/src/core/git-root.ts +24 -0
- package/src/core/last-good.ts +3 -1
- package/src/core/layout.ts +8 -0
- package/src/core/log-stamp.ts +36 -0
- package/src/core/loop-watch.ts +93 -0
- package/src/core/machine-link.ts +134 -0
- package/src/core/memory-watch.ts +41 -0
- package/src/core/one-way-in-policy.ts +27 -19
- package/src/core/run-ci.ts +6 -8
- package/src/core/run-fixers.ts +9 -9
- package/src/core/slots.ts +21 -0
- package/src/core/tree-rev.ts +60 -0
- package/src/core/unit-files.ts +42 -0
- package/src/drill/render.ts +140 -0
- package/src/drill/run.ts +269 -0
- package/src/fleet/scan-fleet.ts +6 -5
- package/src/home/daemon-jobs.ts +201 -0
- package/src/home/global-context.ts +34 -1
- package/src/home/home-routes.ts +22 -15
- package/src/home/hubs.ts +10 -3
- package/src/home/inbox-shape.ts +61 -6
- package/src/home/inbox.ts +75 -4
- package/src/home/lib-watch.ts +10 -3
- package/src/home/machine-stores.ts +15 -29
- package/src/home/run-daemon.ts +15 -18
- package/src/home/run-pm.ts +2 -0
- package/src/home/serve-daemon.ts +4 -3
- package/src/home/serve-web.ts +110 -1
- package/src/hooks/commit-message.ts +28 -19
- package/src/hooks/leak-guard.ts +10 -3
- package/src/hooks/run-hooks.ts +2 -6
- package/src/identities/identities.ts +334 -0
- package/src/identities/machine-route.ts +126 -0
- package/src/identities/machine.ts +62 -0
- package/src/init-repo.ts +1 -1
- package/src/ledger/check-stats.ts +10 -9
- package/src/ledger/gate-checks.ts +32 -1
- package/src/ledger/record-kept.ts +112 -0
- package/src/ledger/repo-view.ts +10 -0
- package/src/ledger/run-log.ts +17 -12
- package/src/ledger/run-timeline.ts +8 -4
- package/src/ledger/store.ts +7 -0
- package/src/ledger/suite-log.ts +17 -13
- package/src/media-kinds.ts +9 -1
- package/src/media-store/backup/daemon.ts +73 -0
- package/src/media-store/backup/keys.ts +25 -0
- package/src/media-store/backup/manifest.ts +193 -0
- package/src/media-store/backup/restore.ts +192 -0
- package/src/media-store/backup/run.ts +278 -0
- package/src/media-store/backup/secret.ts +86 -0
- package/src/media-store/backup/snapshot.ts +64 -0
- package/src/media-store/backup/sources.ts +199 -0
- package/src/media-store/content.ts +11 -1
- package/src/media-store/daemon.ts +56 -70
- package/src/media-store/hand.ts +58 -0
- package/src/media-store/put.ts +122 -0
- package/src/media-store/space.ts +73 -11
- package/src/pages/forward.ts +35 -0
- package/src/pages/frame-client.ts +118 -0
- package/src/pages/routes.ts +29 -0
- package/src/pages/unit.ts +92 -0
- package/src/plan/planner.ts +12 -0
- package/src/plan/repo-source.ts +19 -5
- package/src/reflect/transcript.ts +35 -10
- package/src/release/public-clean.ts +301 -0
- package/src/release/published-here.ts +22 -0
- package/src/release/run-bump.ts +2 -1
- package/src/release/run-release.ts +4 -1
- package/src/repo-config.ts +53 -2
- package/src/review/http.ts +16 -2
- package/src/review/media-kind.ts +3 -3
- package/src/review/media-read.ts +3 -3
- package/src/review/model.ts +24 -5
- package/src/review/notes.ts +77 -0
- package/src/review/project.ts +6 -38
- package/src/review/routes.ts +8 -13
- package/src/review/store.ts +46 -4
- package/src/review/trailer-media.ts +24 -3
- package/src/review/trailer-shots.ts +106 -0
- package/src/review/unit.ts +1 -1
- package/src/scaffold/files/agent-handoff.md +3 -0
- package/src/scaffold/files/agent-index.md +4 -12
- package/src/scaffold/project-scaffold.ts +5 -4
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/col-card.tsx +3 -17
- package/src/serve/hub-app/col-tables-view.tsx +2 -1
- package/src/serve/hub-app/cols-svc.ts +12 -14
- package/src/serve/hub-app/dock-st.ts +4 -2
- package/src/serve/hub-app/dock-view.tsx +2 -0
- package/src/serve/hub-app/frames-st.ts +35 -0
- package/src/serve/hub-app/hash-route.ts +64 -1
- package/src/serve/hub-app/home-st.ts +31 -7
- package/src/serve/hub-app/home-strip.css +9 -1
- package/src/serve/hub-app/home-strip.tsx +7 -6
- package/src/serve/hub-app/home.html +5 -0
- package/src/serve/hub-app/hub-app.tsx +49 -5
- package/src/serve/hub-app/hub.css +29 -11
- package/src/serve/hub-app/icons.tsx +16 -1
- package/src/serve/hub-app/identities-st.ts +210 -0
- package/src/serve/hub-app/identities-view.tsx +352 -0
- package/src/serve/hub-app/identities.css +48 -0
- package/src/serve/hub-app/identity-address.ts +52 -0
- package/src/serve/hub-app/inbox-st.ts +59 -6
- package/src/serve/hub-app/inbox-view.tsx +48 -6
- package/src/serve/hub-app/inbox.css +12 -1
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/keys.ts +10 -2
- package/src/serve/hub-app/list-walk.ts +89 -0
- package/src/serve/hub-app/machine-st.ts +12 -0
- package/src/serve/hub-app/media-view.tsx +2 -1
- package/src/serve/hub-app/pages-frames.tsx +134 -0
- package/src/serve/hub-app/pages-svc.ts +111 -0
- package/src/serve/hub-app/palette-st.ts +18 -3
- package/src/serve/hub-app/palette-view.tsx +9 -2
- package/src/serve/hub-app/planned-view.tsx +2 -1
- package/src/serve/hub-app/project-list.css +18 -14
- package/src/serve/hub-app/project-list.tsx +88 -49
- package/src/serve/hub-app/projects-svc.ts +33 -3
- package/src/serve/hub-app/repo-sections.ts +19 -2
- package/src/serve/hub-app/repo-st.ts +75 -19
- package/src/serve/hub-app/review/review-cells.tsx +3 -3
- package/src/serve/hub-app/review/review-kit.ts +30 -7
- package/src/serve/hub-app/review/review-page.tsx +1 -1
- package/src/serve/hub-app/review/review-st.ts +33 -11
- package/src/serve/hub-app/review/review-thread.tsx +11 -9
- package/src/serve/hub-app/review/review-views.tsx +84 -19
- package/src/serve/hub-app/review/thread-st.ts +1 -10
- package/src/serve/hub-app/review/trailer-page.tsx +2 -1
- package/src/serve/hub-app/review.css +17 -8
- package/src/serve/hub-app/site/site-part.tsx +173 -0
- package/src/serve/hub-app/site/site-st.ts +157 -0
- package/src/serve/hub-app/site.css +35 -0
- package/src/serve/hub-app/social/calendar.tsx +182 -0
- package/src/serve/hub-app/social/comms-page.tsx +306 -0
- package/src/serve/hub-app/social/kit.tsx +244 -0
- package/src/serve/hub-app/social/post-card.tsx +456 -0
- package/src/serve/hub-app/social/problems.tsx +60 -0
- package/src/serve/hub-app/social/social-model.ts +154 -0
- package/src/serve/hub-app/social/social-page.tsx +674 -0
- package/src/serve/hub-app/social/social-st.ts +986 -0
- package/src/serve/hub-app/social.css +289 -0
- package/src/serve/hub-app/stores/stores-page.tsx +311 -0
- package/src/serve/hub-app/stores/stores-st.ts +286 -0
- package/src/serve/hub-app/stores.css +54 -0
- package/src/serve/hub-app/test-view.tsx +9 -2
- package/src/serve/hub-app/tests-svc.ts +16 -1
- package/src/serve/hub-app/timeline-geometry.ts +1 -1
- package/src/serve/hub-app/timeline-view.tsx +3 -2
- package/src/serve/hub-app/tree-build.ts +6 -0
- package/src/serve/hub-app/tree-row.tsx +27 -4
- package/src/serve/hub-app/tree-svc.ts +18 -49
- package/src/serve/hub-app/veille/veille-page.tsx +514 -0
- package/src/serve/hub-app/veille/veille-st.ts +443 -0
- package/src/serve/hub-app/veille.css +84 -0
- package/src/serve/hub-runtime.ts +14 -9
- package/src/serve/project-gutter-route.ts +44 -12
- package/src/serve/resources-wire.ts +48 -0
- package/src/serve/run-lanes.ts +7 -4
- package/src/serve/same-origin.ts +1 -1
- package/src/serve/serve-hub.ts +27 -18
- package/src/serve/tracked-watch.ts +24 -3
- package/src/serve/warm-cell.ts +5 -1
- package/src/shipkit-files.ts +15 -4
- package/src/shipkit.ts +0 -1
- package/src/shot/box.ts +162 -0
- package/src/shot/browser-slot.ts +62 -0
- package/src/shot/client.ts +43 -7
- package/src/shot/clip-encoder.ts +93 -12
- package/src/shot/film-box.ts +188 -0
- package/src/shot/shooter.ts +50 -15
- package/src/shot/shot-ask.ts +10 -2
- package/src/shot/stepped-clip.ts +5 -4
- package/src/site/desk.ts +242 -0
- package/src/site/routes.ts +66 -0
- package/src/site/unit.ts +62 -0
- package/src/social/brands.ts +22 -0
- package/src/social/compose.ts +97 -0
- package/src/social/desk-index.ts +123 -0
- package/src/social/desk-wire.ts +64 -0
- package/src/social/drafts.ts +183 -0
- package/src/social/house.ts +24 -0
- package/src/social/load.ts +319 -0
- package/src/social/md.ts +70 -0
- package/src/social/media-facts.ts +53 -0
- package/src/social/media-kind.ts +189 -0
- package/src/social/media-limit.ts +42 -0
- package/src/social/media-of.ts +30 -0
- package/src/social/migrate.ts +123 -0
- package/src/social/open.ts +17 -0
- package/src/social/post-url.ts +158 -0
- package/src/social/presence.ts +332 -0
- package/src/social/public-read.ts +53 -0
- package/src/social/publish/bluesky.ts +168 -0
- package/src/social/publish/discord.ts +76 -0
- package/src/social/publish/index.ts +24 -0
- package/src/social/publish/secret.ts +13 -0
- package/src/social/push.ts +31 -0
- package/src/social/richtext.ts +37 -0
- package/src/social/routes.ts +180 -0
- package/src/social/stats.ts +134 -0
- package/src/social/text.ts +267 -0
- package/src/social/tracker-route.ts +39 -0
- package/src/social/tracker.ts +255 -0
- package/src/social/unit.ts +53 -0
- package/src/social/writes.ts +130 -0
- package/src/start-repo.ts +14 -9
- package/src/stores/collection.ts +27 -0
- package/src/stores/desk.ts +336 -0
- package/src/stores/model.ts +187 -0
- package/src/stores/routes.ts +126 -0
- package/src/stores/unit.ts +57 -0
- package/src/suite/calibrate.ts +127 -0
- package/src/suite/core-counters.ts +91 -0
- package/src/suite/judge-suites.ts +94 -34
- package/src/suite/suite-cli.ts +44 -10
- package/src/suite/suite-cpu-preload.ts +34 -9
- package/src/trailer/adapter.ts +4 -0
- package/src/trailer/build.ts +42 -11
- package/src/trailer/ffmpeg.ts +11 -0
- package/src/trailer/footage.ts +30 -13
- package/src/trailer/grammar.ts +18 -2
- package/src/trailer/graph.ts +28 -6
- package/src/trailer/passage.ts +21 -6
- package/src/trailer/plan.ts +74 -3
- package/src/trailer/shelf.ts +16 -0
- package/src/trailer/stitch.ts +67 -26
- package/src/trailer/url.ts +1 -1
- package/src/trailer/versions.ts +24 -0
- package/src/ts/gate-typecheck.ts +32 -0
- package/src/ts/typecheck-cli.ts +9 -11
- package/src/tui/tui-app.tsx +0 -1
- package/src/veille/asks.ts +155 -0
- package/src/veille/auto.ts +31 -0
- package/src/veille/batch.ts +27 -0
- package/src/veille/chrome.ts +127 -0
- package/src/veille/collection.ts +28 -0
- package/src/veille/desk.ts +242 -0
- package/src/veille/identity.ts +80 -0
- package/src/veille/import.ts +68 -0
- package/src/veille/log.ts +183 -0
- package/src/veille/platforms.ts +118 -0
- package/src/veille/reads.ts +66 -0
- package/src/veille/replied.ts +110 -0
- package/src/veille/routes.ts +185 -0
- package/src/veille/service.ts +81 -0
- package/src/veille/watch.ts +116 -0
- package/src/veille/worth.ts +46 -0
- package/src/wiki/scan-md.ts +18 -0
- package/src/collections/posts.ts +0 -142
- package/src/contracts/manifests/social.contract.ts +0 -20
- package/src/scaffold/files/agent-coding.md +0 -35
- package/src/ts/typecheck-cache.ts +0 -11
|
@@ -28,19 +28,42 @@ export const kept = {
|
|
|
28
28
|
/** a loader for a polled url: it sends the tag of its last answer for that same url, and on « not modified » gives
|
|
29
29
|
* that answer again (the same object, so nothing draws again). A tag is the store's index build, the same for every
|
|
30
30
|
* url, so it is only sent back to the url that answered it */
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
export type EtagLoader<T> = (() => Promise<T>) & {
|
|
32
|
+
/** the last answer for the url as it reads now, at once, with no request: what the page draws first */
|
|
33
|
+
held(): T | null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** how many urls of one key the browser keeps: a filter or a mode switched back draws at once too */
|
|
37
|
+
const KEPT_URLS = 4
|
|
38
|
+
|
|
39
|
+
/** `keep`: the browser keeps the last answer of its last few urls under this key, so a page opened again (a reload,
|
|
40
|
+
* a daemon restarting, a filter switched back) draws it in the first frame, and its first request sends the kept tag */
|
|
41
|
+
export function etagLoader<T>(url: () => string, o: { keep?: string } = {}): EtagLoader<T> {
|
|
42
|
+
type Last = { url: string; tag: string; value: T }
|
|
43
|
+
const key = o.keep == null ? null : `shipkit.answer.${o.keep}`
|
|
44
|
+
let held: Last[] = []
|
|
45
|
+
if (key != null) {
|
|
46
|
+
try {
|
|
47
|
+
const v = JSON.parse(kept.get(key) ?? '[]') as unknown
|
|
48
|
+
held = Array.isArray(v) ? (v as Last[]) : []
|
|
49
|
+
} catch {
|
|
50
|
+
held = []
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const of = (u: string): Last | null => held.find((x) => x.url === u) ?? null
|
|
54
|
+
const load = async (): Promise<T> => {
|
|
34
55
|
const u = url()
|
|
35
|
-
const
|
|
36
|
-
const res = await reach(u, { cache: 'no-store', headers:
|
|
37
|
-
if (res.status === 304 &&
|
|
56
|
+
const last = of(u)
|
|
57
|
+
const res = await reach(u, { cache: 'no-store', headers: last ? { 'If-None-Match': last.tag } : {} })
|
|
58
|
+
if (res.status === 304 && last) return last.value
|
|
38
59
|
if (!res.ok) throw new Error(`${u}: HTTP ${res.status} ${await res.text().catch(() => '')}`.trim())
|
|
39
60
|
const value = (await res.json()) as T
|
|
40
61
|
const tag = res.headers.get('ETag')
|
|
41
|
-
|
|
62
|
+
held = [...(tag ? [{ url: u, tag, value }] : []), ...held.filter((x) => x.url !== u)].slice(0, key == null ? 1 : KEPT_URLS)
|
|
63
|
+
if (key != null) kept.put(key, JSON.stringify(held))
|
|
42
64
|
return value
|
|
43
65
|
}
|
|
66
|
+
return Object.assign(load, { held: (): T | null => (key == null ? null : of(url())?.value ?? null) })
|
|
44
67
|
}
|
|
45
68
|
|
|
46
69
|
export async function postJson<T>(url: string, body: unknown): Promise<T> {
|
|
@@ -51,7 +51,7 @@ export const PhoneTop = observer(({ app }: { app: RepoSt }) => (
|
|
|
51
51
|
<div className="rv-phonetop">
|
|
52
52
|
{app.home.embedded ? null : <button className="ghost" onClick={() => app.showReadme()}>◂ hub</button>}
|
|
53
53
|
<b>{app.name}</b>
|
|
54
|
-
<span className="rv-dim">{app.sel?.t === 'trailer' ? 'trailer' : `review${app.review.pendingCount > 0 ? ` · ${app.review.pendingCount} waiting` : ''}`}</span>
|
|
54
|
+
<span className="rv-dim">{app.sel?.t === 'trailer' ? 'trailer' : app.sel?.t === 'stores' ? 'stores' : app.sel?.t === 'veille' ? 'veille' : app.sel?.t === 'comms' ? 'communications' : app.sel?.t === 'social' ? 'social' : `review${app.review.pendingCount > 0 ? ` · ${app.review.pendingCount} waiting` : ''}`}</span>
|
|
55
55
|
</div>
|
|
56
56
|
))
|
|
57
57
|
|
|
@@ -8,7 +8,7 @@ import { MOVE_LABEL, pasteBlock, STATUS_LABEL, type Move, type ShownStatus, type
|
|
|
8
8
|
import type { PasteHosts } from '../../../review/paste.ts'
|
|
9
9
|
import type { Role } from '../../../review/role.ts'
|
|
10
10
|
import type { RepoSt } from '../repo-st.ts'
|
|
11
|
-
import { copyText, etagLoader, kept, postJson, ZOOMS, type Zoom } from './review-kit.ts'
|
|
11
|
+
import { copyText, etagLoader, kept, postJson, ZOOMS, type EtagLoader, type Zoom } from './review-kit.ts'
|
|
12
12
|
import { ThreadSt, type Draft } from './thread-st.ts'
|
|
13
13
|
|
|
14
14
|
/** a live `sk review watch`: its process, the session or lane it keeps, when it started */
|
|
@@ -20,10 +20,11 @@ export interface Watcher {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/** how a pair of images shows: side by side, the curtain, one over the other, the after alone */
|
|
23
|
-
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/** side by side, the curtain, the onion skin, the after alone, or only what changed (the after's changed pixels) */
|
|
24
|
+
export type CompareMode = 'side' | 'swipe' | 'onion' | 'mod' | 'diff'
|
|
25
|
+
export const COMPARE_MODES: readonly CompareMode[] = ['side', 'swipe', 'onion', 'mod', 'diff']
|
|
26
|
+
/** the side a rectangle lands on: the after alone and the changes draw on the after */
|
|
27
|
+
export const drawnSide = (mode: CompareMode, drawn: 'before' | 'after'): 'before' | 'after' => (mode === 'mod' || mode === 'diff' ? 'after' : drawn)
|
|
27
28
|
|
|
28
29
|
/** a repo's review unit as the page reads it: the words of its kinds and topics, its dispatcher and who holds the role */
|
|
29
30
|
export type RepoSpec = Spec & { role: Role | null; sources: string[]; auto: { id: string; every: string }[]; where?: PasteHosts | null }
|
|
@@ -63,6 +64,11 @@ export class CompareSt {
|
|
|
63
64
|
this.mode = m
|
|
64
65
|
kept.put(this.key, m)
|
|
65
66
|
}
|
|
67
|
+
/** the next mode (D), or the one before (⇧D), round the list */
|
|
68
|
+
cycle(step: 1 | -1): void {
|
|
69
|
+
const i = COMPARE_MODES.indexOf(this.mode)
|
|
70
|
+
this.setMode(COMPARE_MODES[(i + step + COMPARE_MODES.length) % COMPARE_MODES.length]!)
|
|
71
|
+
}
|
|
66
72
|
setSplit(v: number): void {
|
|
67
73
|
this.split = Math.max(0, Math.min(1, v))
|
|
68
74
|
}
|
|
@@ -142,14 +148,18 @@ export class ReviewSt {
|
|
|
142
148
|
private toastTimer: ReturnType<typeof setTimeout> | null = null
|
|
143
149
|
private searchTimer: ReturnType<typeof setTimeout> | null = null
|
|
144
150
|
private timer: ReturnType<typeof setInterval> | null = null
|
|
145
|
-
|
|
151
|
+
/** the read a start began, while it runs */
|
|
152
|
+
private starting: { card: ThreadSt | null; p: Promise<void> } | null = null
|
|
153
|
+
/** the unit's words, read once a start, again after a stop */
|
|
154
|
+
private specRead: Promise<unknown> | null = null
|
|
155
|
+
private readonly loadPage: EtagLoader<ThreadPage>
|
|
146
156
|
private readonly loadWatchers: () => Promise<Watcher[]>
|
|
147
157
|
private readonly loadBoard: () => Promise<{ role: Role | null; rows: BoardRow[] }>
|
|
148
158
|
private readonly prefix: string
|
|
149
159
|
|
|
150
160
|
constructor(private readonly st: RepoSt) {
|
|
151
161
|
this.prefix = `shipkit.review.${st.key}.`
|
|
152
|
-
this.loadPage = etagLoader(() => st.url(`/api/review/threads?${this.listQuery}`))
|
|
162
|
+
this.loadPage = etagLoader(() => st.url(`/api/review/threads?${this.listQuery}`), { keep: `review.${st.key}` })
|
|
153
163
|
this.loadWatchers = etagLoader(() => st.url('/api/review/watchers'))
|
|
154
164
|
this.loadBoard = etagLoader(() => st.url('/api/review/board'))
|
|
155
165
|
this.compare = new CompareSt(`${this.prefix}compare`)
|
|
@@ -163,11 +173,15 @@ export class ReviewSt {
|
|
|
163
173
|
} catch {
|
|
164
174
|
// a broken pref is the default
|
|
165
175
|
}
|
|
166
|
-
|
|
176
|
+
// the last list drawn in the first frame: the daemon answers after, and only what moved draws again
|
|
177
|
+
this.page = this.loadPage.held()
|
|
178
|
+
makeAutoObservable<this, 'st' | 'toastTimer' | 'searchTimer' | 'timer' | 'starting' | 'specRead' | 'loadPage' | 'loadWatchers' | 'loadBoard' | 'prefix'>(this, {
|
|
167
179
|
st: false,
|
|
168
180
|
toastTimer: false,
|
|
169
181
|
searchTimer: false,
|
|
170
182
|
timer: false,
|
|
183
|
+
starting: false,
|
|
184
|
+
specRead: false,
|
|
171
185
|
loadPage: false,
|
|
172
186
|
loadWatchers: false,
|
|
173
187
|
loadBoard: false,
|
|
@@ -210,8 +224,12 @@ export class ReviewSt {
|
|
|
210
224
|
|
|
211
225
|
/** the list, the watches and the open card, read now and every 2 s while the page shows; the unit's words once */
|
|
212
226
|
start(): void {
|
|
213
|
-
|
|
214
|
-
|
|
227
|
+
// the page starts more than once at boot (its resume, its address): one read while the first runs
|
|
228
|
+
if (this.starting?.card !== this.card) {
|
|
229
|
+
const p = this.refresh().finally(() => { if (this.starting?.p === p) this.starting = null })
|
|
230
|
+
this.starting = { card: this.card, p }
|
|
231
|
+
}
|
|
232
|
+
this.specRead ??= fetch(this.st.url('/api/review/spec'))
|
|
215
233
|
.then((r) => (r.ok ? (r.json() as Promise<RepoSpec>) : null))
|
|
216
234
|
.catch(() => null)
|
|
217
235
|
.then((spec) => runInAction(() => (this.spec = spec)))
|
|
@@ -221,6 +239,7 @@ export class ReviewSt {
|
|
|
221
239
|
stop(): void {
|
|
222
240
|
if (this.timer !== null) clearInterval(this.timer)
|
|
223
241
|
this.timer = null
|
|
242
|
+
this.specRead = null
|
|
224
243
|
}
|
|
225
244
|
|
|
226
245
|
async refresh(): Promise<void> {
|
|
@@ -533,7 +552,8 @@ export class ReviewSt {
|
|
|
533
552
|
}
|
|
534
553
|
|
|
535
554
|
/** the page's keys, as the atelier takes its own: true when it used the key. V approves, F ok with a fix, R rejects,
|
|
536
|
-
* A archives, N the next waiting card, C copies the card for an agent, M the rings,
|
|
555
|
+
* A archives, N the next waiting card, C copies the card for an agent, M the rings, T the contents, D the next
|
|
556
|
+
* compare mode of every pair (⇧D the one before), ↑ ↓ the list; the card takes
|
|
537
557
|
* the rest (ThreadSt.key). A digit is read from its physical key (`code`), so ⇧ and an AZERTY keyboard read the same */
|
|
538
558
|
key(e: Pick<KeyboardEvent, 'key' | 'shiftKey'> & { code?: string }): boolean {
|
|
539
559
|
const card = this.card
|
|
@@ -547,6 +567,8 @@ export class ReviewSt {
|
|
|
547
567
|
else if (k === 'n') this.nextPending()
|
|
548
568
|
else if (k === 'c') void this.copyCard()
|
|
549
569
|
else if (k === 'm') this.toggleMarks()
|
|
570
|
+
else if (k === 't') this.toggleRail()
|
|
571
|
+
else if (k === 'd') this.compare.cycle(e.shiftKey ? -1 : 1)
|
|
550
572
|
else return false
|
|
551
573
|
return true
|
|
552
574
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// the open card as one chat (wiki build/shipkit/review.md, The review page): a bar on top (the title, where it stands,
|
|
2
|
-
// fold or unfold all, the contents), the cells in time order with the newest at the bottom, the contents strip beside
|
|
2
|
+
// fold or unfold all, on a phone the contents), the cells in time order with the newest at the bottom, the contents strip beside
|
|
3
3
|
// them (every version, view, verdict and reply: a click scrolls there and unfolds it), and his answer box pinned under
|
|
4
4
|
// them: one word, sent with a verdict or as a reply. The column opens scrolled to the newest cell
|
|
5
5
|
import { observer } from 'mobx-react-lite'
|
|
@@ -10,7 +10,7 @@ import { Icon, ICON } from '../icons.tsx'
|
|
|
10
10
|
import { AutoTag, Empty, keepFocus, LaneTag, Listeners, Rework, toneOf, VERDICTS } from './kit.tsx'
|
|
11
11
|
import { CellFrame, EventsLine } from './review-cells.tsx'
|
|
12
12
|
import type { ReviewSt } from './review-st.ts'
|
|
13
|
-
import {
|
|
13
|
+
import { type ThreadSt, type ViewMark } from './thread-st.ts'
|
|
14
14
|
|
|
15
15
|
/** `back`: where the phone's ◂ goes, the cards when absent; null when the page around the column draws its own */
|
|
16
16
|
export const ThreadColumn = observer(({ rv, back }: { rv: ReviewSt; back?: (() => void) | null }) => {
|
|
@@ -55,8 +55,8 @@ export const ThreadColumn = observer(({ rv, back }: { rv: ReviewSt; back?: (() =
|
|
|
55
55
|
)
|
|
56
56
|
})
|
|
57
57
|
|
|
58
|
-
/** the card's bar: its title, where it stands, its lane, who listens, the copy for an agent, fold or unfold all
|
|
59
|
-
*
|
|
58
|
+
/** the card's bar: its title, where it stands, its lane, who listens, the copy for an agent, fold or unfold all; on the
|
|
59
|
+
* phone the contents and a way back to the cards */
|
|
60
60
|
const TopBar = observer(({ rv, card, back }: { rv: ReviewSt; card: ThreadSt; back?: (() => void) | null }) => {
|
|
61
61
|
const v = card.data
|
|
62
62
|
const row = rv.openRow
|
|
@@ -88,10 +88,11 @@ const TopBar = observer(({ rv, card, back }: { rv: ReviewSt; card: ThreadSt; bac
|
|
|
88
88
|
<Rework r={v.rework} />
|
|
89
89
|
<span className="sp" />
|
|
90
90
|
<span className="seg">
|
|
91
|
-
<button title="fold every cell" onMouseDown={keepFocus} onClick={() => card.foldAll(false)}
|
|
92
|
-
<button title="unfold every cell (it loads every image)" onMouseDown={keepFocus} onClick={() => card.foldAll(true)}
|
|
91
|
+
<button className="rv-iconbtn" title="fold every cell" aria-label="fold every cell" onMouseDown={keepFocus} onClick={() => card.foldAll(false)}><Icon d={ICON.foldAll} /></button>
|
|
92
|
+
<button className="rv-iconbtn" title="unfold every cell (it loads every image)" aria-label="unfold every cell" onMouseDown={keepFocus} onClick={() => card.foldAll(true)}><Icon d={ICON.unfoldAll} /></button>
|
|
93
93
|
</span>
|
|
94
|
-
|
|
94
|
+
{/* on a desk the strip (☰) and the panel (fold ›) carry the toggle in place; a phone has neither, so its contents sheet opens here */}
|
|
95
|
+
{rv.phone.on ? <button className={rv.sheet ? 'on' : ''} title="every item of the card" onMouseDown={keepFocus} onClick={() => rv.toggleRail()}>☰ contents</button> : null}
|
|
95
96
|
</div>
|
|
96
97
|
) : card.error ? null : (
|
|
97
98
|
<div className="rv-meta"><span className="spin" /> reading the thread…</div>
|
|
@@ -177,7 +178,8 @@ const Contents = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => (
|
|
|
177
178
|
<b>contents</b>
|
|
178
179
|
<span className="rv-dim">{card.contents.length}</span>
|
|
179
180
|
<span className="sp" />
|
|
180
|
-
{rv.sheet ? <button className="ghost rv-x" aria-label="close" onClick={() => rv.closeSheet()}>✕</button>
|
|
181
|
+
{rv.sheet ? <button className="ghost rv-x" aria-label="close" onClick={() => rv.closeSheet()}>✕</button>
|
|
182
|
+
: <button className="ghost rv-fold" title="fold the contents (T)" aria-label="fold the contents" onMouseDown={keepFocus} onClick={() => rv.toggleRail()}>fold ›</button>}
|
|
181
183
|
</div>
|
|
182
184
|
<Minimap rv={rv} card={card} dir="row" />
|
|
183
185
|
<ol>
|
|
@@ -224,7 +226,7 @@ export const Minimap = observer(({ rv, card, dir }: { rv: ReviewSt; card: Thread
|
|
|
224
226
|
const marks = card.viewMarks
|
|
225
227
|
return (
|
|
226
228
|
<nav className={`rv-mini ${dir}`} aria-label="the card's versions, the views of the one you answer, the answers">
|
|
227
|
-
{dir === 'col' ? <button className="rv-miniopen" title="every item of the card" onMouseDown={keepFocus} onClick={() => rv.toggleRail()}>☰</button> : null}
|
|
229
|
+
{dir === 'col' ? <button className="rv-miniopen" title="show every item of the card (T)" onMouseDown={keepFocus} onClick={() => rv.toggleRail()}>☰</button> : null}
|
|
228
230
|
{dir === 'row' && rv.phone.on ? <Waiting card={card} /> : null}
|
|
229
231
|
{card.contents.filter((e) => e.kind !== 'view').map((e) => (
|
|
230
232
|
<span key={e.key} className="rv-minigroup">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// the views of one version, each its own numbered sub cell (`3.2`): a big title and its kind, drawn by kind (an image,
|
|
2
|
-
// a pair side by side, as a curtain, an onion skin
|
|
3
|
-
// what was said on it
|
|
2
|
+
// a pair side by side, as a curtain, an onion skin, the after alone or only its changes, a clip on its own clock, a sound,
|
|
3
|
+
// a gallery), with what was said on it and his word above the view. Images come at the column's size (a 1600 px preview), the full file only on zoom.
|
|
4
4
|
// The newest version takes his marks: a drag on an image draws a rectangle whose note box opens beside it, a clip pauses
|
|
5
5
|
// and keeps the frame's time. A choice, or views that each play alone, read as option rows, each image and clip full
|
|
6
6
|
// under its row
|
|
@@ -14,6 +14,7 @@ import { blurOnEscape, FIT_ROOM, keepFocus, PAIR_NAMES, REACTIONS, secs, SIDE_LA
|
|
|
14
14
|
import { ZOOMS, type Zoom } from './review-kit.ts'
|
|
15
15
|
import { COMPARE_MODES, drawnSide, type CompareMode, type CompareSt, type PairSide, type ReviewSt } from './review-st.ts'
|
|
16
16
|
import { viewDom, viewKind, viewKey, type ThreadSt } from './thread-st.ts'
|
|
17
|
+
import { Caret } from '../icons.tsx'
|
|
17
18
|
|
|
18
19
|
const ZOOM_LABEL: Record<Zoom, string> = { fit: 'Fit', '1': '100 %', '1.5': '150 %', '2': '200 %' }
|
|
19
20
|
const toneClass = (s: string | undefined): string => (s ? ` re-${s}` : '')
|
|
@@ -49,7 +50,7 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
|
|
|
49
50
|
) : null}
|
|
50
51
|
{rv.phone.on && drawable ? <button className={rv.phone.draw ? 'primary' : ''} onClick={() => rv.phone.toggleDraw()}>Circle</button> : null}
|
|
51
52
|
<span className="sp" />
|
|
52
|
-
<span className="seg" title="the zoom every view
|
|
53
|
+
<span className="seg" title="the zoom of every view of every card">
|
|
53
54
|
{ZOOMS.map((z) => <button key={z} className={rv.zoom === z ? 'on' : ''} onMouseDown={keepFocus} onClick={() => rv.setZoom(z)}>{ZOOM_LABEL[z]}</button>)}
|
|
54
55
|
</span>
|
|
55
56
|
</div>
|
|
@@ -62,21 +63,21 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
|
|
|
62
63
|
)
|
|
63
64
|
})
|
|
64
65
|
|
|
65
|
-
/** one view as a sub cell: its number and title, its kind, the owner's reaction, its tools,
|
|
66
|
+
/** 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 */
|
|
66
67
|
const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewView; i: number; frames?: GalleryView }) => {
|
|
67
68
|
const { rv, card, cell } = ver
|
|
68
69
|
const past = frames && card.frame !== null ? frames.gallery[card.frame] : undefined
|
|
69
70
|
const v: ReviewView = past && !isGallery(live) ? { ...live, files: { image: past.file }, size: past.size } : live
|
|
70
71
|
const media = isGallery(v) ? null : v
|
|
71
72
|
const open = card.viewOpen(cell.id, i)
|
|
72
|
-
const zoom =
|
|
73
|
+
const zoom = rv.zoom
|
|
73
74
|
const shown = card.reactionShown(cell, i)
|
|
74
75
|
const active = ver.live && card.view === i
|
|
75
76
|
const gone = goneOf(ver, v)
|
|
76
77
|
return (
|
|
77
78
|
<section id={viewDom(cell.id, i)} className={`rv-view${toneClass(shown?.status)}${active ? ' active' : ''}${open ? '' : ' folded'}`}>
|
|
78
79
|
<header className="rv-viewhead">
|
|
79
|
-
<button className="rv-foldbtn" aria-label={open ? 'fold this view' : 'unfold this view'} aria-expanded={open} onMouseDown={keepFocus} onClick={() => card.toggleView(cell.id, i)}
|
|
80
|
+
<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>
|
|
80
81
|
<span className="rv-viewn">{viewTag(cell.n, i)}</span>
|
|
81
82
|
<h4 className="rv-viewname" onClick={() => card.toggleView(cell.id, i)}>{v.label || <span className="rv-dim">{viewName(v, i)}</span>}</h4>
|
|
82
83
|
<span className="rv-kind">{viewKind(v, false)}</span>
|
|
@@ -84,11 +85,8 @@ const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewVie
|
|
|
84
85
|
<span className="sp" />
|
|
85
86
|
{open && media?.marks && media.marks.length > 0 ? <button className={rv.marksOn ? 'primary' : ''} onMouseDown={keepFocus} onClick={() => rv.toggleMarks()}>marks · M</button> : null}
|
|
86
87
|
{open && media && isPair(media.files) && !media.audio && !rv.phone.on ? <CompareModes c={rv.compare} /> : null}
|
|
87
|
-
{open && media && !media.audio ? (
|
|
88
|
-
<button title={zoom === 'fit' ? 'see this image at its own size, the full file' : 'fit this image to the column'} onMouseDown={keepFocus}
|
|
89
|
-
onClick={() => card.setViewZoom(cell.id, i, zoom === 'fit' ? '1' : 'fit')}>{zoom === 'fit' ? '100 %' : 'Fit'}</button>
|
|
90
|
-
) : null}
|
|
91
88
|
</header>
|
|
89
|
+
<ViewNotes ver={ver} i={i} gallery={isGallery(v)} />
|
|
92
90
|
{open ? (
|
|
93
91
|
<div className="rv-viewbody">
|
|
94
92
|
{frames ? <FrameSlider card={card} frames={frames} /> : null}
|
|
@@ -96,12 +94,11 @@ const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewVie
|
|
|
96
94
|
{media?.note ? <div className="rv-viewnote">{media.note}</div> : null}
|
|
97
95
|
</div>
|
|
98
96
|
) : null}
|
|
99
|
-
<ViewNotes ver={ver} i={i} gallery={isGallery(v)} />
|
|
100
97
|
</section>
|
|
101
98
|
)
|
|
102
99
|
})
|
|
103
100
|
|
|
104
|
-
/** what was said on one view,
|
|
101
|
+
/** what was said on one view, above it: each answer's rectangles and reactions (a click shows the rectangle), then on
|
|
105
102
|
* the newest version his draft: each rectangle's word, his word on the view */
|
|
106
103
|
const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: number; gallery: boolean; word?: boolean }) => {
|
|
107
104
|
const { card, cell } = ver
|
|
@@ -205,7 +202,7 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
|
|
|
205
202
|
{choice ? <Stars card={card} view={i} live={ver.live} given={reaction?.stars} /> : ver.live ? <ReactionToggles card={card} view={i} /> : reaction?.status ? <SentReaction status={reaction.status} /> : null}
|
|
206
203
|
{ver.live ? <button className={`rv-optword${showWord ? ' on' : ''}`} title="a word on this one" onMouseDown={keepFocus} onClick={() => setWord(!word)}>✎ word</button> : null}
|
|
207
204
|
{playable?.clip || !playable ? (
|
|
208
|
-
<button className={unfolded ? 'on' : ''} title={unfolded ? 'fold it back to its row' : 'show it full under its row'} onMouseDown={keepFocus} onClick={() => card.toggleRow(item, i)}
|
|
205
|
+
<button className={unfolded ? 'on' : ''} title={unfolded ? 'fold it back to its row' : 'show it full under its row'} onMouseDown={keepFocus} onClick={() => card.toggleRow(item, i)}><Caret v open={unfolded} /> {unfolded ? 'fold' : 'show'}</button>
|
|
209
206
|
) : null}
|
|
210
207
|
{playable?.audio ? <a className="rv-dl" href={rv.fileUrl(id, file)} download={`${id}-${file}`} title="download the sound">⤓</a> : null}
|
|
211
208
|
{choice && ver.live ? (
|
|
@@ -224,7 +221,7 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
|
|
|
224
221
|
{c && playable?.audio ? <SoundEl clip={c} src={rv.fileUrl(id, file)} /> : null}
|
|
225
222
|
{unfolded ? (
|
|
226
223
|
<div className="rv-optbody">
|
|
227
|
-
{gone.length > 0 ? <Gone files={gone} /> : isGallery(v) ? <Gallery ver={ver} v={v} view={i} /> : <MediaBody ver={ver} v={v} i={i} zoom={
|
|
224
|
+
{gone.length > 0 ? <Gone files={gone} /> : isGallery(v) ? <Gallery ver={ver} v={v} view={i} /> : <MediaBody ver={ver} v={v} i={i} zoom={ver.rv.zoom} />}
|
|
228
225
|
</div>
|
|
229
226
|
) : null}
|
|
230
227
|
<ViewNotes ver={ver} i={i} gallery={isGallery(v)} word={false} />
|
|
@@ -418,7 +415,7 @@ const MediaBody = observer(({ ver, v, i, zoom }: { ver: Ver; v: MediaView; i: nu
|
|
|
418
415
|
<div style={scroll}>
|
|
419
416
|
<div className="rv-pairgrid" style={{ width: scale ? `${v.size.w * scale * cols + 8 * (cols - 1)}px` : fitW, gridTemplateColumns: `repeat(${cols}, 1fr)` }}>
|
|
420
417
|
<Compare c={c} base={before} mod={after} names={PAIR_NAMES} aspect={aspect}
|
|
421
|
-
draw={(s) => <Marks ver={ver} src={s} side={drawnSide(c.mode, s === before ? 'before' : 'after')} view={i} />}
|
|
418
|
+
draw={(s, face) => <Marks ver={ver} src={s} side={drawnSide(c.mode, s === before ? 'before' : 'after')} view={i} face={face} />}
|
|
422
419
|
over={(srcs) => (ver.live ? <RectNote card={card} view={i} sides={srcs.map((s) => drawnSide(c.mode, s === before ? 'before' : 'after'))} /> : null)} />
|
|
423
420
|
</div>
|
|
424
421
|
</div>
|
|
@@ -519,6 +516,7 @@ const MODES: { mode: CompareMode; glyph: string; tip: string }[] = [
|
|
|
519
516
|
{ mode: 'swipe', glyph: '⇹', tip: 'curtain: drag the line, the before on the left, the after on the right' },
|
|
520
517
|
{ mode: 'onion', glyph: '◐', tip: 'onion skin: the after over the before' },
|
|
521
518
|
{ mode: 'mod', glyph: '▣', tip: 'the after alone: hovering the image shows the before' },
|
|
519
|
+
{ mode: 'diff', glyph: '≠', tip: 'only what changed: the after\'s changed pixels in colour, the rest faded' },
|
|
522
520
|
]
|
|
523
521
|
|
|
524
522
|
/** the compare modes as tiny buttons, the onion's opacity floating under them */
|
|
@@ -527,7 +525,7 @@ const CompareModes = observer(({ c }: { c: CompareSt }) => (
|
|
|
527
525
|
<span className="seg">
|
|
528
526
|
{COMPARE_MODES.map((m) => {
|
|
529
527
|
const o = MODES.find((x) => x.mode === m)!
|
|
530
|
-
return <button key={m} title={o.tip} className={c.mode === m ? 'on' : ''} onMouseDown={keepFocus} onClick={() => c.setMode(m)}>{o.glyph}</button>
|
|
528
|
+
return <button key={m} title={`${o.tip} (D cycles, ⇧D back)`} className={c.mode === m ? 'on' : ''} onMouseDown={keepFocus} onClick={() => c.setMode(m)}>{o.glyph}</button>
|
|
531
529
|
})}
|
|
532
530
|
</span>
|
|
533
531
|
{c.mode === 'onion' ? (
|
|
@@ -536,6 +534,65 @@ const CompareModes = observer(({ c }: { c: CompareSt }) => (
|
|
|
536
534
|
</span>
|
|
537
535
|
))
|
|
538
536
|
|
|
537
|
+
/** a channel sum under this is the encoder's noise, never a change */
|
|
538
|
+
const DIFF_NOISE = 24
|
|
539
|
+
|
|
540
|
+
/** the share of the pixels that changed, as the caption says it */
|
|
541
|
+
const changesWords = (share: number | null | undefined): string =>
|
|
542
|
+
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`
|
|
543
|
+
|
|
544
|
+
/** the after, only where it changed from the before: each changed pixel in its own colour, every other pixel a pale
|
|
545
|
+
* gray of it, so what moved is all that stands out. Read in the browser from the two previews; `say` gets the share
|
|
546
|
+
* that changed, undefined while it reads, null when an image cannot be read */
|
|
547
|
+
const DiffCanvas = ({ base, mod, say }: { base: string; mod: string; say: (share: number | null | undefined) => void }) => {
|
|
548
|
+
const ref = useRef<HTMLCanvasElement>(null)
|
|
549
|
+
useEffect(() => {
|
|
550
|
+
let gone = false
|
|
551
|
+
const load = (src: string): Promise<HTMLImageElement> =>
|
|
552
|
+
new Promise((ok, no) => {
|
|
553
|
+
const img = new Image()
|
|
554
|
+
img.onload = () => ok(img)
|
|
555
|
+
img.onerror = () => no(new Error(src))
|
|
556
|
+
img.src = src
|
|
557
|
+
})
|
|
558
|
+
say(undefined)
|
|
559
|
+
Promise.all([load(base), load(mod)]).then(([a, b]) => {
|
|
560
|
+
const cv = ref.current
|
|
561
|
+
if (gone || cv == null) return
|
|
562
|
+
const w = b.naturalWidth
|
|
563
|
+
const h = b.naturalHeight
|
|
564
|
+
cv.width = w
|
|
565
|
+
cv.height = h
|
|
566
|
+
const ctx = cv.getContext('2d', { willReadFrequently: true })
|
|
567
|
+
if (ctx == null) return say(null)
|
|
568
|
+
ctx.drawImage(a, 0, 0, w, h)
|
|
569
|
+
const pa = ctx.getImageData(0, 0, w, h).data
|
|
570
|
+
ctx.drawImage(b, 0, 0, w, h)
|
|
571
|
+
const out = ctx.getImageData(0, 0, w, h)
|
|
572
|
+
const pb = out.data
|
|
573
|
+
let changed = 0
|
|
574
|
+
for (let i = 0; i < pb.length; i += 4) {
|
|
575
|
+
if (Math.abs(pa[i]! - pb[i]!) + Math.abs(pa[i + 1]! - pb[i + 1]!) + Math.abs(pa[i + 2]! - pb[i + 2]!) > DIFF_NOISE) {
|
|
576
|
+
changed++
|
|
577
|
+
continue
|
|
578
|
+
}
|
|
579
|
+
const v = 228 + (pb[i]! * 0.3 + pb[i + 1]! * 0.59 + pb[i + 2]! * 0.11) * 0.1
|
|
580
|
+
pb[i] = v
|
|
581
|
+
pb[i + 1] = v
|
|
582
|
+
pb[i + 2] = v
|
|
583
|
+
}
|
|
584
|
+
ctx.putImageData(out, 0, 0)
|
|
585
|
+
say(changed / (w * h))
|
|
586
|
+
}, () => {
|
|
587
|
+
if (!gone) say(null)
|
|
588
|
+
})
|
|
589
|
+
return () => {
|
|
590
|
+
gone = true
|
|
591
|
+
}
|
|
592
|
+
}, [base, mod, say])
|
|
593
|
+
return <canvas ref={ref} className="rv-diff" />
|
|
594
|
+
}
|
|
595
|
+
|
|
539
596
|
/** follows the pointer until it is released */
|
|
540
597
|
function track(move: (e: PointerEvent) => void): void {
|
|
541
598
|
const up = (): void => {
|
|
@@ -549,8 +606,9 @@ function track(move: (e: PointerEvent) => void): void {
|
|
|
549
606
|
/** THE pair: side by side, the curtain clipping both images, the after over the before as an onion skin, or the
|
|
550
607
|
* after alone (the before while the pointer is over it). One image alone when `mod` is undefined. `over` draws what
|
|
551
608
|
* sits over a frame unclipped (the picked rectangle's note box), given the images that frame shows */
|
|
552
|
-
const Compare = observer(({ c, base, mod, names, aspect, draw, over }: { c: CompareSt; base: string; mod: string | undefined; names?: { base: string; mod: string }; aspect: string; draw: (src: string) => ReactNode; over?: (srcs: string[]) => ReactNode }) => {
|
|
609
|
+
const Compare = observer(({ c, base, mod, names, aspect, draw, over }: { c: CompareSt; base: string; mod: string | undefined; names?: { base: string; mod: string }; aspect: string; draw: (src: string, face?: ReactNode) => ReactNode; over?: (srcs: string[]) => ReactNode }) => {
|
|
553
610
|
const [peek, setPeek] = useState(false)
|
|
611
|
+
const [share, setShare] = useState<number | null | undefined>(undefined)
|
|
554
612
|
if (mod === undefined) return <Frame aspect={aspect} caption={null} over={over?.([base])}><div className="rv-fill">{draw(base)}</div></Frame>
|
|
555
613
|
const n = names ?? PAIR_NAMES
|
|
556
614
|
if (c.mode === 'side')
|
|
@@ -560,6 +618,12 @@ const Compare = observer(({ c, base, mod, names, aspect, draw, over }: { c: Comp
|
|
|
560
618
|
<Frame aspect={aspect} caption={n.mod} modCap over={over?.([mod])}><div className="rv-fill">{draw(mod)}</div></Frame>
|
|
561
619
|
</>
|
|
562
620
|
)
|
|
621
|
+
if (c.mode === 'diff')
|
|
622
|
+
return (
|
|
623
|
+
<Frame aspect={aspect} caption={<>changes <span className="rv-modcap">{changesWords(share)}</span></>} over={over?.([mod])}>
|
|
624
|
+
<div className="rv-fill">{draw(mod, <DiffCanvas base={base} mod={mod} say={setShare} />)}</div>
|
|
625
|
+
</Frame>
|
|
626
|
+
)
|
|
563
627
|
if (c.mode === 'mod')
|
|
564
628
|
return (
|
|
565
629
|
<Frame aspect={aspect} caption={peek ? n.base : n.mod} modCap={!peek} onPeek={setPeek} over={over?.([peek ? base : mod])}>
|
|
@@ -615,7 +679,8 @@ const MIN_DRAG = 0.01
|
|
|
615
679
|
/** one image of view `view` and its rectangles: the ones his answers sent (still), and on the newest version his
|
|
616
680
|
* draft's, a drag drawing one (never in the curtain, whose drag moves the line). A clip view of the newest version that
|
|
617
681
|
* is not the active one loops on its own: a click makes it active */
|
|
618
|
-
|
|
682
|
+
/** an image or a clip and what is drawn on it; `face` takes the image's place (the changes of a pair) */
|
|
683
|
+
const Marks = observer(({ ver, src, side, view, face }: { ver: Ver; src: string; side: Side | undefined; view: number; face?: ReactNode }) => {
|
|
619
684
|
const { rv, card, cell } = ver
|
|
620
685
|
const el = useRef<HTMLDivElement>(null)
|
|
621
686
|
const [drag, setDrag] = useState<{ x0: number; y0: number; x1: number; y1: number } | null>(null)
|
|
@@ -671,7 +736,7 @@ const Marks = observer(({ ver, src, side, view }: { ver: Ver; src: string; side:
|
|
|
671
736
|
const live = drawing || (clip !== undefined && ver.live && !active)
|
|
672
737
|
return (
|
|
673
738
|
<div ref={el} className={`rv-marks${clip && ver.live && !active ? ' pick' : drawing ? ' draw' : ''}`} onPointerDown={down} style={{ pointerEvents: live ? 'auto' : 'none', touchAction: drawing ? 'none' : undefined }}>
|
|
674
|
-
{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" />}
|
|
739
|
+
{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" />)}
|
|
675
740
|
{shown && rings.length > 0 ? <Rings marks={rings} w={shown.size.w} h={shown.size.h} /> : null}
|
|
676
741
|
{sent.map(({ r, n }, k) => <div key={`s${k}`} className={`rv-rect sent${onIts(r) ? '' : ' faint'}`} style={pct(r)} title={r.comment || `rectangle ${n}`}><span className="rv-rectn">{n}</span></div>)}
|
|
677
742
|
{rects.map(([r, i]) => (
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
type Side,
|
|
22
22
|
} from '../../../review/model.ts'
|
|
23
23
|
import { ClipSt } from './clip-st.ts'
|
|
24
|
-
import { etagLoader, postJson
|
|
24
|
+
import { etagLoader, postJson } from './review-kit.ts'
|
|
25
25
|
import type { ReviewSt } from './review-st.ts'
|
|
26
26
|
|
|
27
27
|
export interface Draft {
|
|
@@ -115,7 +115,6 @@ export class ThreadSt {
|
|
|
115
115
|
rect: number | null = null
|
|
116
116
|
/** the rectangle whose note box takes the focus once it shows */
|
|
117
117
|
noteFocus: number | null = null
|
|
118
|
-
viewZoom: Record<string, Zoom> = {}
|
|
119
118
|
/** the gallery tile shown large, `<item>#<view>/<tile>` */
|
|
120
119
|
bigTile: string | null = null
|
|
121
120
|
/** a draft card's past frame shown in place of its live one; null is now */
|
|
@@ -582,14 +581,6 @@ export class ThreadSt {
|
|
|
582
581
|
this.rect = null
|
|
583
582
|
}
|
|
584
583
|
|
|
585
|
-
zoomOf(id: string, i: number): Zoom {
|
|
586
|
-
return this.viewZoom[viewKey(id, i)] ?? this.rv.zoom
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
setViewZoom(id: string, i: number, z: Zoom): void {
|
|
590
|
-
this.viewZoom = { ...this.viewZoom, [viewKey(id, i)]: z }
|
|
591
|
-
}
|
|
592
|
-
|
|
593
584
|
setFrame(f: number | null): void {
|
|
594
585
|
this.frame = f
|
|
595
586
|
}
|
|
@@ -14,6 +14,7 @@ import { PANEL, PhoneTop } from './review-page.tsx'
|
|
|
14
14
|
import { ClipSound } from './review-views.tsx'
|
|
15
15
|
import { hueOf, ShotCards, TrailerTimeline } from './trailer-timeline.tsx'
|
|
16
16
|
import { captionText, type PlacedNote, type TrailerSt } from './trailer-st.ts'
|
|
17
|
+
import { Caret } from '../icons.tsx'
|
|
17
18
|
|
|
18
19
|
export const TrailerPage = observer(({ app }: { app: RepoSt }) => {
|
|
19
20
|
const tr = app.trailer
|
|
@@ -251,7 +252,7 @@ const Montage = observer(({ tr }: { tr: TrailerSt }) => {
|
|
|
251
252
|
const m = tr.montage
|
|
252
253
|
return (
|
|
253
254
|
<div className="tr-montage">
|
|
254
|
-
<button className="ghost" onClick={() => void tr.toggleMontage()}
|
|
255
|
+
<button className="ghost" onClick={() => void tr.toggleMontage()}><Caret open={tr.montageOpen} /> montage</button>
|
|
255
256
|
{tr.montageOpen ? (m == null ? <span className="spin" /> : m.md == null ? <div className="rv-dim">This render has no montage page.</div> : <div className="md tr-montagebody" dangerouslySetInnerHTML={{ __html: renderMd(m.md) }} />) : null}
|
|
256
257
|
</div>
|
|
257
258
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* the review page and the trailer page (hub-app/review/):
|
|
1
|
+
/* the review page and the trailer page (hub-app/review/): a project's review and trailer tabs on the hub's tokens.
|
|
2
2
|
A status, a reaction, a note state and a section each set --tone or --hue, and the parts read it, so no rule here
|
|
3
3
|
writes a colour (tests/hub-css-invariants.test.ts) */
|
|
4
4
|
.st-pending{--tone:var(--blue)}
|
|
@@ -102,7 +102,9 @@
|
|
|
102
102
|
.rv-copyid:hover{color:var(--ink)}
|
|
103
103
|
.rv-toast{position:fixed;left:50%;bottom:var(--s4);transform:translateX(-50%);z-index:40;max-width:calc(100% - 2 * var(--s4));padding:var(--s1) var(--s3);border-radius:6px;border:1px solid var(--line);background:var(--panel);color:var(--ink);font-size:12.5px;box-shadow:0 6px 20px var(--shadow)}
|
|
104
104
|
.rv-threadbody{position:relative;flex:1;min-height:0;display:flex}
|
|
105
|
-
|
|
105
|
+
/* a sticky row inside sticks under the scroller's top padding, and the cells scroll through that band above it:
|
|
106
|
+
--stick pulls it up to the edge, by the same var(--s3) */
|
|
107
|
+
.rv-cells{--stick:calc(-1 * var(--s3));position:relative;flex:1;min-width:0;overflow-y:auto;display:flex;flex-direction:column;gap:var(--s3);padding:var(--s3) var(--s4) var(--s4)}
|
|
106
108
|
.rv-day{display:flex;align-items:center;gap:var(--s2);margin-top:var(--s2);font-size:10.5px;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:var(--dim)}
|
|
107
109
|
.rv-day::before,.rv-day::after{content:'';flex:1;border-top:1px solid var(--line)}
|
|
108
110
|
.rv-events{display:flex;flex-direction:column;gap:var(--s0)}
|
|
@@ -208,15 +210,16 @@
|
|
|
208
210
|
.rv-view[class*=' re-']{border-color:color-mix(in srgb,var(--tone) 55%,var(--line))}
|
|
209
211
|
.rv-view.active{border-color:color-mix(in srgb,var(--accent) 55%,var(--line))}
|
|
210
212
|
/* one sticky row per view: its label, its title, the owner's verdict on it, the tools; it stays at the top while the view scrolls */
|
|
211
|
-
.rv-viewhead{position:sticky;top:0;z-index:4;display:flex;flex-wrap:wrap;gap:var(--s1) var(--s2);align-items:center;padding:var(--s2) var(--s3) var(--s2) var(--s1);border-bottom:1px solid var(--line);border-radius:7px 7px 0 0;background:color-mix(in srgb,var(--panel2) 70%,var(--bg));box-shadow:0 2px 6px var(--shadow)}
|
|
213
|
+
.rv-viewhead{position:sticky;top:var(--stick,0);z-index:4;display:flex;flex-wrap:wrap;gap:var(--s1) var(--s2);align-items:center;padding:var(--s2) var(--s3) var(--s2) var(--s1);border-bottom:1px solid var(--line);border-radius:7px 7px 0 0;background:color-mix(in srgb,var(--panel2) 70%,var(--bg));box-shadow:0 2px 6px var(--shadow)}
|
|
212
214
|
.rv-view.folded .rv-viewhead{border-bottom:0;border-radius:4px 7px 7px 4px}
|
|
213
215
|
.rv-viewn{flex:none;font:800 18px/30px ui-monospace,Menlo,monospace;padding:0 var(--s3);border-radius:6px;color:var(--bg);background:var(--ink)}
|
|
214
216
|
.rv-viewname{margin:0;min-width:0;font-size:16px;line-height:1.3;font-weight:700;color:var(--ink);cursor:pointer}
|
|
215
217
|
.rv-kind{flex:none;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--dim);border:1px solid var(--line);border-radius:10px;padding:0 var(--s2);line-height:18px}
|
|
216
218
|
.rv-viewbody{padding:var(--s3)}
|
|
217
219
|
.rv-viewnote{margin-top:var(--s2);font-size:13px;color:var(--ink)}
|
|
218
|
-
|
|
219
|
-
.rv-
|
|
220
|
+
/* above the view, under its head: what was said on it and his word, read and written before the image */
|
|
221
|
+
.rv-viewnotes{display:flex;flex-direction:column;gap:var(--s1);padding:var(--s3) var(--s3) 0}
|
|
222
|
+
.rv-view.folded .rv-viewnotes{padding:var(--s2) var(--s3) var(--s3)}
|
|
220
223
|
.rv-said{display:flex;gap:var(--s2);align-items:baseline;padding:var(--s1) var(--s2);font-size:13px;line-height:1.4;border-radius:6px;border-left:3px solid var(--tone,var(--k4));background:color-mix(in srgb,var(--tone,var(--k4)) 8%,transparent)}
|
|
221
224
|
.rv-said.rect{--tone:var(--k4)}
|
|
222
225
|
.rv-saidmark{flex:none;font-weight:800;color:var(--tone,var(--k4));white-space:nowrap}
|
|
@@ -247,6 +250,8 @@ span.rv-react{display:inline-block;border:1px solid;border-radius:4px}
|
|
|
247
250
|
.rv-marks.draw{cursor:crosshair}
|
|
248
251
|
.rv-marks.pick{cursor:pointer}
|
|
249
252
|
.rv-markimg,.rv-video{display:block;width:100%;height:100%;pointer-events:none}
|
|
253
|
+
/* the changes of a pair: the after's changed pixels on its faded self, drawn in place of the image */
|
|
254
|
+
.rv-diff{display:block;width:100%;height:100%;pointer-events:none}
|
|
250
255
|
.rv-rings{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
|
|
251
256
|
.rv-ring{fill:none;stroke:var(--warn);stroke-width:3}
|
|
252
257
|
.rv-ringshade{fill:none;stroke:var(--solid);stroke-opacity:.35;stroke-width:7}
|
|
@@ -295,7 +300,7 @@ span.rv-react{display:inline-block;border:1px solid;border-radius:4px}
|
|
|
295
300
|
.rv-opt.picked{--tone:var(--ok);border-color:var(--tone);border-left-color:var(--tone);background:color-mix(in srgb,var(--tone) 9%,var(--bg))}
|
|
296
301
|
.rv-optrow{display:flex;flex-wrap:wrap;gap:var(--s1) var(--s2);align-items:center;min-height:36px}
|
|
297
302
|
.rv-optn{flex:none;font:800 16px/28px ui-monospace,Menlo,monospace;padding:0 8px;border-radius:5px;color:var(--bg);background:var(--ink)}
|
|
298
|
-
.rv-opt.unfolded > .rv-optrow{position:sticky;top:0;z-index:4;margin:calc(-1 * var(--s1)) calc(-1 * var(--s2)) 0;padding:var(--s1) var(--s2);border-radius:7px 7px 0 0;background:var(--bg);box-shadow:0 2px 6px var(--shadow)}
|
|
303
|
+
.rv-opt.unfolded > .rv-optrow{position:sticky;top:var(--stick,0);z-index:4;margin:calc(-1 * var(--s1)) calc(-1 * var(--s2)) 0;padding:var(--s1) var(--s2);border-radius:7px 7px 0 0;background:var(--bg);box-shadow:0 2px 6px var(--shadow)}
|
|
299
304
|
.rv-optplay{flex:none;width:32px;height:28px;padding:0;font-size:13px}
|
|
300
305
|
.rv-optplay.on{color:var(--bg);background:var(--accent);border-color:var(--accent)}
|
|
301
306
|
.rv-optlabel{flex:0 1 auto;min-width:48px;max-width:30%;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
@@ -332,6 +337,10 @@ span.rv-pick{display:inline-block;border:1px solid;border-radius:4px;font-size:1
|
|
|
332
337
|
.rv-outbadge.rect{--tone:var(--warn)}
|
|
333
338
|
.rv-outbadge.rect.on{--tone:var(--blue)}
|
|
334
339
|
.rv-x{flex:none;padding:0 var(--s1);border:0}
|
|
340
|
+
/* a seg's icon button (fold every cell, unfold every cell): the icon centred, the row's height kept */
|
|
341
|
+
.rv-iconbtn{display:inline-flex;align-items:center;justify-content:center;padding:0 var(--s2)}
|
|
342
|
+
.rv-fold{flex:none;padding:0 var(--s2);font-size:11px;text-transform:none;letter-spacing:0;color:var(--dim)}
|
|
343
|
+
.rv-fold:hover{color:var(--ink)}
|
|
335
344
|
|
|
336
345
|
/* ── the phone: the page covers the hub's panes, one pane at a time, the verdicts under the thumb ── */
|
|
337
346
|
.rv-phone,.tr-phone{position:fixed;inset:0;z-index:30;background:var(--bg)}
|
|
@@ -347,7 +356,7 @@ span.rv-pick{display:inline-block;border:1px solid;border-radius:4px;font-size:1
|
|
|
347
356
|
.rv-phone .rv-cbody{padding:var(--s2)}
|
|
348
357
|
.rv-phone .rv-chead .rv-copyid{display:none}
|
|
349
358
|
.rv-phone .rv-viewbody{padding:var(--s1)}
|
|
350
|
-
.rv-phone .rv-viewnotes{padding:
|
|
359
|
+
.rv-phone .rv-viewnotes{padding:var(--s2) var(--s1) 0}
|
|
351
360
|
.rv-phone .rv-viewname{font-size:15px}
|
|
352
361
|
.rv-phone .rv-composer{padding:var(--s2)}
|
|
353
362
|
.rv-phone .rv-acts .sp{display:none}
|
|
@@ -501,7 +510,7 @@ span.rv-pick{display:inline-block;border:1px solid;border-radius:4px;font-size:1
|
|
|
501
510
|
.rv-c.k-version > .rv-cbody{padding:0}
|
|
502
511
|
.rv-vgrid{display:grid;grid-template-columns:52px minmax(0,1fr)}
|
|
503
512
|
.rv-gut{border-right:1px solid color-mix(in srgb,var(--who) 35%,var(--line));border-radius:0 0 0 9px;background:color-mix(in srgb,var(--who) 12%,var(--panel2))}
|
|
504
|
-
.rv-gutlabel{position:sticky;top:0;display:block;padding:var(--s2) 0;text-align:center;font:800 19px/1.2 ui-monospace,Menlo,monospace;color:var(--who)}
|
|
513
|
+
.rv-gutlabel{position:sticky;top:var(--stick,0);display:block;padding:var(--s2) 0;text-align:center;font:800 19px/1.2 ui-monospace,Menlo,monospace;color:var(--who)}
|
|
505
514
|
.rv-vmain{min-width:0;display:flex;flex-direction:column;gap:var(--s3);padding:var(--s3)}
|
|
506
515
|
.rv-phone .rv-vgrid{grid-template-columns:30px minmax(0,1fr)}
|
|
507
516
|
.rv-phone .rv-gutlabel{font-size:12.5px}
|