rvlib-shipkit 2.12.0 → 2.14.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 +75 -21
- package/README.md +1 -1
- package/package.json +4 -2
- package/src/agent-time/store.ts +2 -2
- package/src/assets/run-assets.ts +2 -2
- package/src/assets/server/studio-server.ts +27 -23
- package/src/check.ts +4 -4
- package/src/checks/SK001-package-json-shape.check.ts +8 -4
- package/src/checks/SK002-contracts-fulfillness.check.ts +2 -2
- package/src/checks/SK003-claude-md-shape.check.ts +20 -13
- package/src/checks/SK004-gitignore-policy.check.ts +45 -6
- package/src/checks/SK005-rvlib-versions.check.ts +2 -2
- package/src/checks/SK006-npm-publish-safety.check.ts +3 -3
- package/src/checks/SK007-github-visibility.check.ts +2 -2
- package/src/checks/SK008-reviewer-agent.check.ts +3 -3
- package/src/checks/SK010-undeclared-unit.check.ts +2 -2
- package/src/checks/SK011-sibling-unit-ranges.check.ts +2 -2
- package/src/checks/SK012-config-barrel-import.check.ts +2 -2
- package/src/checks/SK013-one-way-in-policy.check.ts +2 -2
- package/src/checks/SK015-nested-repo.check.ts +3 -3
- package/src/checks/SK016-legacy-check-shapes.check.ts +2 -2
- package/src/checks/SK017-vscode-hub-task.check.ts +2 -2
- package/src/checks/SK018-test-files-run.check.ts +2 -2
- package/src/checks/SK019-tests-run-in-units.check.ts +2 -2
- package/src/checks/SK020-self-spawning-check.check.ts +2 -2
- package/src/checks/SK022-machine-runs-the-pin.check.ts +2 -2
- package/src/checks/SK024-identity-colors.check.ts +1 -1
- package/src/checks/SK025-release-drift.check.ts +2 -2
- package/src/checks/SK026-asks-autoclose.check.ts +2 -2
- package/src/checks/SK027-agent-wiki-links.check.ts +8 -2
- package/src/checks/SK028-readme.check.ts +2 -2
- package/src/checks/SK029-explicit-check-files.check.ts +3 -3
- package/src/checks/SK030-cache-audit.check.ts +7 -5
- package/src/checks/SK031-trace-audit.check.ts +7 -7
- package/src/checks/SK032-ignored-inputs.check.ts +3 -3
- package/src/checks/SK033-global-contribution.check.ts +11 -4
- package/src/checks/SK034-commit-gates-armed.check.ts +2 -2
- package/src/checks/SK035-public-clean.check.ts +46 -0
- package/src/checks/SK036-draft-media-size.check.ts +28 -0
- package/src/checks/SK037-keyword-additions.check.ts +43 -0
- package/src/cli/cmd_Backup.ts +152 -0
- package/src/cli/cmd_Ci.ts +8 -11
- package/src/cli/cmd_Commands.ts +4 -4
- package/src/cli/cmd_ConfigKeys.ts +2 -2
- package/src/cli/cmd_Drill.ts +145 -0
- package/src/cli/cmd_Home.ts +50 -3
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Media.ts +10 -8
- package/src/cli/cmd_Mv.ts +14 -7
- package/src/cli/cmd_Review.ts +6 -4
- package/src/cli/cmd_Shot.ts +5 -2
- package/src/cli/cmd_Smoke.ts +5 -2
- package/src/cli/cmd_Social.ts +226 -0
- package/src/cli/cmd_Sound.ts +1 -1
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_TraceAudit.ts +6 -6
- package/src/cli/cmd_Trailer.ts +7 -4
- package/src/cli/cmd_Veille.ts +173 -0
- package/src/cli/cmd_When.ts +2 -2
- package/src/cli/family-pages.ts +19 -16
- 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 +12 -3
- package/src/collections/providers.ts +4 -4
- package/src/collections/review.ts +3 -2
- package/src/collections/tests.ts +19 -8
- package/src/comfy/comfy-panel.ts +2 -2
- 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/contracts/manifests/discord.contract.ts +1 -1
- package/src/contracts/manifests/identity.contract.ts +1 -1
- package/src/contracts/manifests/itch.contract.ts +1 -1
- package/src/contracts/manifests/steam.contract.ts +1 -1
- package/src/core/agent-dir-at.ts +12 -0
- package/src/core/agent-dir.ts +16 -0
- package/src/core/app-icon.ts +9 -3
- package/src/core/budget.ts +1 -1
- package/src/core/bun-builtins.ts +2 -2
- package/src/core/canonical-scripts.ts +2 -2
- package/src/core/discover-checks.ts +38 -6
- 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/global-contribution.ts +4 -1
- package/src/core/ignored-block.ts +1 -1
- package/src/core/ignored-inputs.ts +3 -2
- 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/motherhome.ts +2 -2
- package/src/core/one-way-in-policy.ts +34 -26
- package/src/core/run-ci.ts +9 -11
- package/src/core/run-fixers.ts +9 -9
- package/src/core/runs-matrix.ts +1 -1
- package/src/core/slots.ts +30 -0
- package/src/core/trace-audit.ts +50 -9
- 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 +44 -8
- package/src/home/gui-app/ShipkitGui.swift +91 -2
- package/src/home/home-routes.ts +22 -15
- package/src/home/hubs.ts +10 -3
- package/src/home/inbox-shape.ts +54 -5
- package/src/home/inbox.ts +17 -2
- package/src/home/lib-watch.ts +10 -3
- package/src/home/machine-stores.ts +15 -29
- package/src/home/pm-config.ts +4 -1
- package/src/home/pm-inputs.ts +2 -0
- package/src/home/resources.ts +7 -2
- package/src/home/run-daemon.ts +15 -18
- package/src/home/run-pm.ts +3 -1
- package/src/home/serve-daemon.ts +4 -3
- package/src/home/serve-web.ts +104 -1
- package/src/hooks/commit-message.ts +29 -20
- package/src/hooks/hook-gates.ts +1 -1
- package/src/hooks/leak-guard.ts +69 -9
- package/src/hooks/run-hooks.ts +18 -22
- 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 +3 -3
- 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 +3 -2
- 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 +1 -1
- package/src/media-store/daemon.ts +56 -70
- package/src/media-store/db.ts +1 -1
- package/src/media-store/fact.ts +1 -1
- package/src/media-store/hand.ts +1 -1
- package/src/media-store/kind.ts +1 -1
- package/src/media-store/purge.ts +1 -1
- package/src/media-store/put.ts +5 -3
- package/src/media-store/remote.ts +1 -1
- package/src/media-store/space.ts +24 -5
- package/src/mv/mv-md.ts +63 -22
- 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 +319 -0
- package/src/release/published-here.ts +22 -0
- package/src/release/run-bump.ts +3 -2
- package/src/release/run-release.ts +7 -4
- package/src/repo-config.ts +71 -13
- package/src/review/anim.ts +1 -1
- package/src/review/auto.ts +1 -1
- package/src/review/cells.ts +15 -1
- package/src/review/format.ts +2 -2
- package/src/review/http.ts +16 -2
- package/src/review/marks.ts +1 -1
- package/src/review/media-kind.ts +1 -1
- package/src/review/media-read.ts +1 -1
- package/src/review/model.ts +27 -6
- package/src/review/notes.ts +125 -0
- package/src/review/previews.ts +1 -1
- package/src/review/project.ts +7 -39
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +18 -14
- package/src/review/store.ts +42 -2
- package/src/review/threads.ts +1 -1
- package/src/review/trailer-desk.ts +3 -3
- package/src/review/trailer-media.ts +8 -5
- package/src/review/trailer-model.ts +1 -1
- package/src/review/trailer-routes.ts +1 -1
- package/src/review/trailer-shots.ts +22 -5
- package/src/review/unit.ts +2 -2
- package/src/scaffold/files/agent-handoff.md +3 -0
- package/src/scaffold/files/agent-index.md +4 -12
- package/src/scaffold/files/tsconfig.json +1 -1
- package/src/scaffold/project-scaffold.ts +6 -5
- package/src/serve/embed.ts +2 -2
- package/src/serve/hub-app/check-words.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 +0 -13
- 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 +32 -8
- 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 +51 -7
- 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 +353 -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 +60 -7
- package/src/serve/hub-app/inbox-view.tsx +49 -7
- package/src/serve/hub-app/inbox.css +12 -1
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/kept-cols.tsx +30 -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-svc.ts +1 -1
- 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 +76 -20
- package/src/serve/hub-app/review/review-board.tsx +1 -1
- package/src/serve/hub-app/review/review-cells.tsx +6 -5
- package/src/serve/hub-app/review/review-kit.ts +30 -7
- package/src/serve/hub-app/review/review-page.tsx +6 -5
- package/src/serve/hub-app/review/review-st.ts +34 -15
- package/src/serve/hub-app/review/review-thread.tsx +63 -14
- package/src/serve/hub-app/review/review-views.tsx +133 -51
- package/src/serve/hub-app/review/thread-st.ts +80 -37
- package/src/serve/hub-app/review/trailer-page.tsx +7 -5
- package/src/serve/hub-app/review/trailer-st.ts +1 -1
- package/src/serve/hub-app/review.css +26 -9
- 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 +330 -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 +681 -0
- package/src/serve/hub-app/social/social-st.ts +1014 -0
- package/src/serve/hub-app/social.css +289 -0
- package/src/serve/hub-app/stores/stores-page.tsx +312 -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/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 +515 -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 +20 -11
- package/src/serve/project-gutter-route.ts +44 -12
- package/src/serve/run-lanes.ts +7 -4
- package/src/serve/same-origin.ts +1 -1
- package/src/serve/serve-hub.ts +20 -12
- 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 +160 -0
- package/src/shot/browser-slot.ts +74 -0
- package/src/shot/client.ts +42 -7
- package/src/shot/clip-encoder.ts +108 -24
- package/src/shot/film-box.ts +292 -0
- package/src/shot/shooter.ts +71 -17
- 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/card-drafts.ts +24 -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 +332 -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 +37 -0
- package/src/social/richtext.ts +37 -0
- package/src/social/routes.ts +186 -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 +95 -35
- package/src/suite/suite-cli.ts +44 -10
- package/src/suite/suite-cpu-preload.ts +34 -9
- package/src/trace/tracer.ts +12 -5
- package/src/trailer/adapter.ts +5 -1
- package/src/trailer/build.ts +45 -12
- 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/holes.ts +1 -1
- package/src/trailer/passage.ts +18 -6
- package/src/trailer/plan.ts +74 -3
- package/src/trailer/prune.ts +1 -1
- package/src/trailer/states.ts +1 -1
- package/src/trailer/stitch.ts +67 -26
- package/src/trailer/url.ts +1 -1
- package/src/trailer/versions.ts +24 -0
- package/src/trailer/words.ts +1 -1
- package/src/ts/gate-typecheck.ts +32 -0
- package/src/ts/typecheck-cli.ts +9 -11
- package/src/tui/run-tui.ts +1 -1
- package/src/tui/tui-app.tsx +0 -1
- package/src/tui/tui-store.ts +1 -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
|
@@ -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,19 +14,29 @@ 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}` : '')
|
|
20
21
|
|
|
21
|
-
/** one version as its views draw it: `live` when
|
|
22
|
+
/** one version as its views draw it: `live` when his answer goes to it and it draws his draft; `claim` when it is the
|
|
23
|
+
* newest while his answer sits on an older version: it takes his marks, and the first one brings his answer here */
|
|
22
24
|
export interface Ver {
|
|
23
25
|
rv: ReviewSt
|
|
24
26
|
card: ThreadSt
|
|
25
27
|
cell: VersionCell
|
|
26
28
|
live: boolean
|
|
29
|
+
claim: boolean
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
const itemOf = (ver: Ver): Item => ver.cell.item
|
|
33
|
+
/** the version takes his marks: OK, Fix, No, a rectangle, a word, a star, a pick */
|
|
34
|
+
const takes = (ver: Ver): boolean => ver.live || ver.claim
|
|
35
|
+
/** a mark on a claiming version: his answer comes to it first, then the mark lands in its own draft */
|
|
36
|
+
const mark = (ver: Ver, f: () => void): void => {
|
|
37
|
+
if (ver.claim) ver.card.answerNewest()
|
|
38
|
+
f()
|
|
39
|
+
}
|
|
30
40
|
|
|
31
41
|
/** a version's views: its bar (rows or full, « Circle » on a phone, the zoom), then each view as a sub cell or a row */
|
|
32
42
|
export const VersionViews = observer(({ ver }: { ver: Ver }) => {
|
|
@@ -34,7 +44,7 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
|
|
|
34
44
|
const item = itemOf(ver)
|
|
35
45
|
const views = item.views
|
|
36
46
|
const rows = card.rows(item)
|
|
37
|
-
const drawable = ver
|
|
47
|
+
const drawable = takes(ver) && views.some((v) => !isGallery(v) && !v.clip && !v.audio)
|
|
38
48
|
// a draft card's history is no view of its own: its frames cycle in place over the live one
|
|
39
49
|
const history = item.wip ? views.find(isGallery) : undefined
|
|
40
50
|
const options = rows || (card.full[item.id] === true)
|
|
@@ -49,7 +59,7 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
|
|
|
49
59
|
) : null}
|
|
50
60
|
{rv.phone.on && drawable ? <button className={rv.phone.draw ? 'primary' : ''} onClick={() => rv.phone.toggleDraw()}>Circle</button> : null}
|
|
51
61
|
<span className="sp" />
|
|
52
|
-
<span className="seg" title="the zoom every view
|
|
62
|
+
<span className="seg" title="the zoom of every view of every card">
|
|
53
63
|
{ZOOMS.map((z) => <button key={z} className={rv.zoom === z ? 'on' : ''} onMouseDown={keepFocus} onClick={() => rv.setZoom(z)}>{ZOOM_LABEL[z]}</button>)}
|
|
54
64
|
</span>
|
|
55
65
|
</div>
|
|
@@ -62,33 +72,30 @@ export const VersionViews = observer(({ ver }: { ver: Ver }) => {
|
|
|
62
72
|
)
|
|
63
73
|
})
|
|
64
74
|
|
|
65
|
-
/** one view as a sub cell: its number and title, its kind, the owner's reaction, its tools,
|
|
75
|
+
/** 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
76
|
const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewView; i: number; frames?: GalleryView }) => {
|
|
67
77
|
const { rv, card, cell } = ver
|
|
68
78
|
const past = frames && card.frame !== null ? frames.gallery[card.frame] : undefined
|
|
69
79
|
const v: ReviewView = past && !isGallery(live) ? { ...live, files: { image: past.file }, size: past.size } : live
|
|
70
80
|
const media = isGallery(v) ? null : v
|
|
71
81
|
const open = card.viewOpen(cell.id, i)
|
|
72
|
-
const zoom =
|
|
82
|
+
const zoom = rv.zoom
|
|
73
83
|
const shown = card.reactionShown(cell, i)
|
|
74
84
|
const active = ver.live && card.view === i
|
|
75
85
|
const gone = goneOf(ver, v)
|
|
76
86
|
return (
|
|
77
87
|
<section id={viewDom(cell.id, i)} className={`rv-view${toneClass(shown?.status)}${active ? ' active' : ''}${open ? '' : ' folded'}`}>
|
|
78
88
|
<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)}
|
|
89
|
+
<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
90
|
<span className="rv-viewn">{viewTag(cell.n, i)}</span>
|
|
81
91
|
<h4 className="rv-viewname" onClick={() => card.toggleView(cell.id, i)}>{v.label || <span className="rv-dim">{viewName(v, i)}</span>}</h4>
|
|
82
92
|
<span className="rv-kind">{viewKind(v, false)}</span>
|
|
83
|
-
{ver
|
|
93
|
+
{takes(ver) ? <ReactionToggles ver={ver} view={i} /> : shown?.status ? <SentReaction status={shown.status} /> : null}
|
|
84
94
|
<span className="sp" />
|
|
85
95
|
{open && media?.marks && media.marks.length > 0 ? <button className={rv.marksOn ? 'primary' : ''} onMouseDown={keepFocus} onClick={() => rv.toggleMarks()}>marks · M</button> : null}
|
|
86
96
|
{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
97
|
</header>
|
|
98
|
+
<ViewNotes ver={ver} i={i} gallery={isGallery(v)} />
|
|
92
99
|
{open ? (
|
|
93
100
|
<div className="rv-viewbody">
|
|
94
101
|
{frames ? <FrameSlider card={card} frames={frames} /> : null}
|
|
@@ -96,12 +103,11 @@ const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewVie
|
|
|
96
103
|
{media?.note ? <div className="rv-viewnote">{media.note}</div> : null}
|
|
97
104
|
</div>
|
|
98
105
|
) : null}
|
|
99
|
-
<ViewNotes ver={ver} i={i} gallery={isGallery(v)} />
|
|
100
106
|
</section>
|
|
101
107
|
)
|
|
102
108
|
})
|
|
103
109
|
|
|
104
|
-
/** what was said on one view,
|
|
110
|
+
/** what was said on one view, above it: each answer's rectangles and reactions (a click shows the rectangle), then on
|
|
105
111
|
* the newest version his draft: each rectangle's word, his word on the view */
|
|
106
112
|
const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: number; gallery: boolean; word?: boolean }) => {
|
|
107
113
|
const { card, cell } = ver
|
|
@@ -109,7 +115,7 @@ const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: num
|
|
|
109
115
|
const views = itemOf(ver).views
|
|
110
116
|
const draft = ver.live ? card.draft.rects.map((r, k) => [r, k] as const).filter(([r]) => (r.view ?? 0) === i) : []
|
|
111
117
|
const reaction = ver.live ? card.reactionOf(i) : null
|
|
112
|
-
if (said.length === 0 && draft.length === 0 && !(ver
|
|
118
|
+
if (said.length === 0 && draft.length === 0 && !(takes(ver) && word)) return null
|
|
113
119
|
return (
|
|
114
120
|
<div className="rv-viewnotes">
|
|
115
121
|
{said.map((s, k) => {
|
|
@@ -142,9 +148,9 @@ const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: num
|
|
|
142
148
|
<button className="ghost rv-x" title="delete this note" aria-label="delete this note" onClick={() => card.removeRect(k)}>✕</button>
|
|
143
149
|
</div>
|
|
144
150
|
))}
|
|
145
|
-
{ver
|
|
151
|
+
{takes(ver) && word ? (
|
|
146
152
|
<AutoText className="rv-word" placeholder={gallery ? 'a word on these images' : 'a word on this view'} value={reaction?.comment ?? ''}
|
|
147
|
-
onKeyDown={blurOnEscape} onText={(t) => card.setReactionComment(i, undefined, t)} />
|
|
153
|
+
onKeyDown={blurOnEscape} onText={(t) => mark(ver, () => card.setReactionComment(i, undefined, t))} />
|
|
148
154
|
) : null}
|
|
149
155
|
</div>
|
|
150
156
|
)
|
|
@@ -175,7 +181,7 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
|
|
|
175
181
|
const unfolded = card.rowOpen(item, i)
|
|
176
182
|
const file = playable ? ('video' in playable.files ? playable.files.video : 'audio' in playable.files ? playable.files.audio : '') : ''
|
|
177
183
|
const duration = playable?.clip?.duration ?? playable?.audio?.duration ?? 0
|
|
178
|
-
const showWord = ver
|
|
184
|
+
const showWord = takes(ver) && (word || (reaction?.comment ?? '') !== '')
|
|
179
185
|
const active = ver.live && card.view === i
|
|
180
186
|
// an unfolded clip plays under its own bar: the row keeps no second clock
|
|
181
187
|
const clock2 = c !== null && !(unfolded && playable?.clip)
|
|
@@ -202,14 +208,14 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
|
|
|
202
208
|
)}
|
|
203
209
|
{c && clock2 ? <span className="rv-mono rv-opttime">{clock(c.time)} / {clock(duration)}</span> : null}
|
|
204
210
|
<span className="rv-optacts">
|
|
205
|
-
{choice ? <Stars
|
|
206
|
-
{ver
|
|
211
|
+
{choice ? <Stars ver={ver} view={i} given={reaction?.stars} /> : takes(ver) ? <ReactionToggles ver={ver} view={i} /> : reaction?.status ? <SentReaction status={reaction.status} /> : null}
|
|
212
|
+
{takes(ver) ? <button className={`rv-optword${showWord ? ' on' : ''}`} title="a word on this one" onMouseDown={keepFocus} onClick={() => setWord(!word)}>✎ word</button> : null}
|
|
207
213
|
{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)}
|
|
214
|
+
<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
215
|
) : null}
|
|
210
216
|
{playable?.audio ? <a className="rv-dl" href={rv.fileUrl(id, file)} download={`${id}-${file}`} title="download the sound">⤓</a> : null}
|
|
211
|
-
{choice && ver
|
|
212
|
-
<button className={`rv-pick${picked ? ' on' : ''}`} title="pick this one: it is your answer (P)" disabled={card.busy} onClick={() => void card.choose(i)}>
|
|
217
|
+
{choice && takes(ver) ? (
|
|
218
|
+
<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))}>
|
|
213
219
|
{picked ? '✓ picked' : 'pick'}
|
|
214
220
|
</button>
|
|
215
221
|
) : choice && picked ? <span className="rv-pick on">✓ picked</span> : null}
|
|
@@ -219,12 +225,12 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
|
|
|
219
225
|
{!ver.live && reaction?.comment ? <div className="rv-optnote rv-saidtext">« {reaction.comment} »</div> : null}
|
|
220
226
|
{showWord ? (
|
|
221
227
|
<AutoText className="rv-word" placeholder="a word on this one" value={reaction?.comment ?? ''} autoFocus={word && !reaction?.comment}
|
|
222
|
-
onKeyDown={blurOnEscape} onText={(t) => card.setReactionComment(i, undefined, t)} />
|
|
228
|
+
onKeyDown={blurOnEscape} onText={(t) => mark(ver, () => card.setReactionComment(i, undefined, t))} />
|
|
223
229
|
) : null}
|
|
224
230
|
{c && playable?.audio ? <SoundEl clip={c} src={rv.fileUrl(id, file)} /> : null}
|
|
225
231
|
{unfolded ? (
|
|
226
232
|
<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={
|
|
233
|
+
{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
234
|
</div>
|
|
229
235
|
) : null}
|
|
230
236
|
<ViewNotes ver={ver} i={i} gallery={isGallery(v)} word={false} />
|
|
@@ -252,12 +258,14 @@ const Gone = ({ files }: { files: readonly string[] }) => (
|
|
|
252
258
|
const clock = (t: number): string => `${Math.floor(t / 60)}:${String(Math.floor(t % 60)).padStart(2, '0')}`
|
|
253
259
|
|
|
254
260
|
/** an option's score: STARS stars, a click on the one given clears it; an older version's stars as he gave them */
|
|
255
|
-
const Stars = observer(({
|
|
261
|
+
const Stars = observer(({ ver, view, given }: { ver: Ver; view: number; given: number | undefined }) => {
|
|
262
|
+
const { card } = ver
|
|
263
|
+
const live = takes(ver)
|
|
256
264
|
const n = given ?? 0
|
|
257
265
|
return (
|
|
258
266
|
<span className="rv-stars" title={live ? `your score (⇧1 to ⇧${STARS} on the row playing)` : 'your score'}>
|
|
259
267
|
{Array.from({ length: STARS }, (_, k) => (
|
|
260
|
-
<button key={k} className={k < n ? 'on' : ''} disabled={!live} aria-label={`${k + 1} of ${STARS}`} onMouseDown={keepFocus} onClick={() => card.setStars(view, k + 1)}>{k < n ? '★' : '☆'}</button>
|
|
268
|
+
<button key={k} className={k < n ? 'on' : ''} disabled={!live} aria-label={`${k + 1} of ${STARS}`} onMouseDown={keepFocus} onClick={() => mark(ver, () => card.setStars(view, k + 1))}>{k < n ? '★' : '☆'}</button>
|
|
261
269
|
))}
|
|
262
270
|
</span>
|
|
263
271
|
)
|
|
@@ -323,13 +331,14 @@ const FrameSlider = observer(({ card, frames }: { card: ThreadSt; frames: Galler
|
|
|
323
331
|
})
|
|
324
332
|
|
|
325
333
|
/** the owner's reaction to one view or tile of the newest version: OK, fix or no; a click on the chosen one clears it */
|
|
326
|
-
const ReactionToggles = observer(({
|
|
327
|
-
const
|
|
334
|
+
const ReactionToggles = observer(({ ver, view, tile, small }: { ver: Ver; view: number; tile?: number; small?: boolean }) => {
|
|
335
|
+
const { card } = ver
|
|
336
|
+
const cur = ver.claim ? undefined : card.reactionOf(view, tile)?.status
|
|
328
337
|
return (
|
|
329
338
|
<span className="rv-reacts">
|
|
330
339
|
{REACTIONS.map((o) => (
|
|
331
340
|
<button key={o.status} title={o.tip} className={`rv-react re-${o.status}${small ? '' : ' big'}${cur === o.status ? ' on' : ''}${cur && cur !== o.status ? ' off' : ''}`}
|
|
332
|
-
onMouseDown={keepFocus} onClick={() => card.react(view, tile, o.status)}>
|
|
341
|
+
onMouseDown={keepFocus} onClick={() => mark(ver, () => card.react(view, tile, o.status))}>
|
|
333
342
|
{o.glyph} {o.label}
|
|
334
343
|
</button>
|
|
335
344
|
))}
|
|
@@ -359,10 +368,10 @@ const Gallery = observer(({ ver, v, view }: { ver: Ver; v: GalleryView; view: nu
|
|
|
359
368
|
<img src={big ? rv.fitUrl(id, t.file) : rv.thumbUrl(id, t.file)} alt={t.label} draggable={false} loading="lazy" />
|
|
360
369
|
</div>
|
|
361
370
|
<div className="rv-tilelabel" title={t.label}>{t.label}</div>
|
|
362
|
-
{ver
|
|
371
|
+
{takes(ver) ? (
|
|
363
372
|
<>
|
|
364
|
-
<ReactionToggles
|
|
365
|
-
<AutoText className="rv-word" placeholder="a word" value={r?.comment ?? ''} onKeyDown={blurOnEscape} onText={(t) => card.setReactionComment(view, k, t)} />
|
|
373
|
+
<ReactionToggles ver={ver} view={view} tile={k} small />
|
|
374
|
+
<AutoText className="rv-word" placeholder="a word" value={r?.comment ?? ''} onKeyDown={blurOnEscape} onText={(t) => mark(ver, () => card.setReactionComment(view, k, t))} />
|
|
366
375
|
</>
|
|
367
376
|
) : r?.status ? <SentReaction status={r.status} /> : null}
|
|
368
377
|
</div>
|
|
@@ -393,7 +402,7 @@ const MediaBody = observer(({ ver, v, i, zoom }: { ver: Ver; v: MediaView; i: nu
|
|
|
393
402
|
<div style={scroll}>
|
|
394
403
|
<div style={{ width: scale ? `${v.size.w * scale}px` : `min(100%, calc((100vh - ${room}px) * ${ratio}))`, margin: '0 auto' }}>
|
|
395
404
|
<Compare c={rv.compare} base={src(name)} mod={undefined} aspect={aspect} draw={(s) => <Marks ver={ver} src={s} side={undefined} view={i} />}
|
|
396
|
-
over={() => (ver.live ? <RectNote
|
|
405
|
+
over={() => (ver.live ? <RectNote ver={ver} view={i} sides={[undefined]} /> : null)} />
|
|
397
406
|
{bar}
|
|
398
407
|
<Downloads rv={rv} item={item} files={[{ file: name }]} />
|
|
399
408
|
</div>
|
|
@@ -418,8 +427,8 @@ const MediaBody = observer(({ ver, v, i, zoom }: { ver: Ver; v: MediaView; i: nu
|
|
|
418
427
|
<div style={scroll}>
|
|
419
428
|
<div className="rv-pairgrid" style={{ width: scale ? `${v.size.w * scale * cols + 8 * (cols - 1)}px` : fitW, gridTemplateColumns: `repeat(${cols}, 1fr)` }}>
|
|
420
429
|
<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} />}
|
|
422
|
-
over={(srcs) => (ver.live ? <RectNote
|
|
430
|
+
draw={(s, face) => <Marks ver={ver} src={s} side={drawnSide(c.mode, s === before ? 'before' : 'after')} view={i} face={face} />}
|
|
431
|
+
over={(srcs) => (ver.live ? <RectNote ver={ver} view={i} sides={srcs.map((s) => drawnSide(c.mode, s === before ? 'before' : 'after'))} /> : null)} />
|
|
423
432
|
</div>
|
|
424
433
|
</div>
|
|
425
434
|
{bar ? <div style={{ width: fitW, margin: '0 auto' }}>{bar}</div> : null}
|
|
@@ -484,7 +493,7 @@ const PhonePair = observer(({ ver, view, bar, before, after, aspect, size, scale
|
|
|
484
493
|
size: { w: number; h: number }
|
|
485
494
|
scale: number | null
|
|
486
495
|
}) => {
|
|
487
|
-
const { rv
|
|
496
|
+
const { rv } = ver
|
|
488
497
|
const ph = rv.phone
|
|
489
498
|
const c = rv.compare
|
|
490
499
|
const side = ph.pair === 'swipe' && c.mode !== 'swipe' ? 'after' : ph.pair
|
|
@@ -500,10 +509,10 @@ const PhonePair = observer(({ ver, view, bar, before, after, aspect, size, scale
|
|
|
500
509
|
<div style={{ width: scale ? `${size.w * scale}px` : '100%' }}>
|
|
501
510
|
{side === 'swipe' ? (
|
|
502
511
|
<Compare c={c} base={before} mod={after} names={PAIR_NAMES} aspect={aspect} draw={(s) => <Marks ver={ver} src={s} side={s === before ? 'before' : 'after'} view={view} />}
|
|
503
|
-
over={(srcs) => (ver.live ? <RectNote
|
|
512
|
+
over={(srcs) => (ver.live ? <RectNote ver={ver} view={view} sides={srcs.map((s) => (s === before ? 'before' : 'after'))} /> : null)} />
|
|
504
513
|
) : (
|
|
505
514
|
<Compare key={side} c={c} base={one} mod={undefined} aspect={aspect} draw={(s) => <Marks ver={ver} src={s} side={side} view={view} />}
|
|
506
|
-
over={() => (ver.live ? <RectNote
|
|
515
|
+
over={() => (ver.live ? <RectNote ver={ver} view={view} sides={[side]} /> : null)} />
|
|
507
516
|
)}
|
|
508
517
|
{bar}
|
|
509
518
|
</div>
|
|
@@ -519,6 +528,7 @@ const MODES: { mode: CompareMode; glyph: string; tip: string }[] = [
|
|
|
519
528
|
{ mode: 'swipe', glyph: '⇹', tip: 'curtain: drag the line, the before on the left, the after on the right' },
|
|
520
529
|
{ mode: 'onion', glyph: '◐', tip: 'onion skin: the after over the before' },
|
|
521
530
|
{ mode: 'mod', glyph: '▣', tip: 'the after alone: hovering the image shows the before' },
|
|
531
|
+
{ mode: 'diff', glyph: '≠', tip: 'only what changed: the after\'s changed pixels in colour, the rest faded' },
|
|
522
532
|
]
|
|
523
533
|
|
|
524
534
|
/** the compare modes as tiny buttons, the onion's opacity floating under them */
|
|
@@ -527,7 +537,7 @@ const CompareModes = observer(({ c }: { c: CompareSt }) => (
|
|
|
527
537
|
<span className="seg">
|
|
528
538
|
{COMPARE_MODES.map((m) => {
|
|
529
539
|
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>
|
|
540
|
+
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
541
|
})}
|
|
532
542
|
</span>
|
|
533
543
|
{c.mode === 'onion' ? (
|
|
@@ -536,6 +546,65 @@ const CompareModes = observer(({ c }: { c: CompareSt }) => (
|
|
|
536
546
|
</span>
|
|
537
547
|
))
|
|
538
548
|
|
|
549
|
+
/** a channel sum under this is the encoder's noise, never a change */
|
|
550
|
+
const DIFF_NOISE = 24
|
|
551
|
+
|
|
552
|
+
/** the share of the pixels that changed, as the caption says it */
|
|
553
|
+
const changesWords = (share: number | null | undefined): string =>
|
|
554
|
+
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`
|
|
555
|
+
|
|
556
|
+
/** the after, only where it changed from the before: each changed pixel in its own colour, every other pixel a pale
|
|
557
|
+
* gray of it, so what moved is all that stands out. Read in the browser from the two previews; `say` gets the share
|
|
558
|
+
* that changed, undefined while it reads, null when an image cannot be read */
|
|
559
|
+
const DiffCanvas = ({ base, mod, say }: { base: string; mod: string; say: (share: number | null | undefined) => void }) => {
|
|
560
|
+
const ref = useRef<HTMLCanvasElement>(null)
|
|
561
|
+
useEffect(() => {
|
|
562
|
+
let gone = false
|
|
563
|
+
const load = (src: string): Promise<HTMLImageElement> =>
|
|
564
|
+
new Promise((ok, no) => {
|
|
565
|
+
const img = new Image()
|
|
566
|
+
img.onload = () => ok(img)
|
|
567
|
+
img.onerror = () => no(new Error(src))
|
|
568
|
+
img.src = src
|
|
569
|
+
})
|
|
570
|
+
say(undefined)
|
|
571
|
+
Promise.all([load(base), load(mod)]).then(([a, b]) => {
|
|
572
|
+
const cv = ref.current
|
|
573
|
+
if (gone || cv == null) return
|
|
574
|
+
const w = b.naturalWidth
|
|
575
|
+
const h = b.naturalHeight
|
|
576
|
+
cv.width = w
|
|
577
|
+
cv.height = h
|
|
578
|
+
const ctx = cv.getContext('2d', { willReadFrequently: true })
|
|
579
|
+
if (ctx == null) return say(null)
|
|
580
|
+
ctx.drawImage(a, 0, 0, w, h)
|
|
581
|
+
const pa = ctx.getImageData(0, 0, w, h).data
|
|
582
|
+
ctx.drawImage(b, 0, 0, w, h)
|
|
583
|
+
const out = ctx.getImageData(0, 0, w, h)
|
|
584
|
+
const pb = out.data
|
|
585
|
+
let changed = 0
|
|
586
|
+
for (let i = 0; i < pb.length; i += 4) {
|
|
587
|
+
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) {
|
|
588
|
+
changed++
|
|
589
|
+
continue
|
|
590
|
+
}
|
|
591
|
+
const v = 228 + (pb[i]! * 0.3 + pb[i + 1]! * 0.59 + pb[i + 2]! * 0.11) * 0.1
|
|
592
|
+
pb[i] = v
|
|
593
|
+
pb[i + 1] = v
|
|
594
|
+
pb[i + 2] = v
|
|
595
|
+
}
|
|
596
|
+
ctx.putImageData(out, 0, 0)
|
|
597
|
+
say(changed / (w * h))
|
|
598
|
+
}, () => {
|
|
599
|
+
if (!gone) say(null)
|
|
600
|
+
})
|
|
601
|
+
return () => {
|
|
602
|
+
gone = true
|
|
603
|
+
}
|
|
604
|
+
}, [base, mod, say])
|
|
605
|
+
return <canvas ref={ref} className="rv-diff" />
|
|
606
|
+
}
|
|
607
|
+
|
|
539
608
|
/** follows the pointer until it is released */
|
|
540
609
|
function track(move: (e: PointerEvent) => void): void {
|
|
541
610
|
const up = (): void => {
|
|
@@ -549,8 +618,9 @@ function track(move: (e: PointerEvent) => void): void {
|
|
|
549
618
|
/** THE pair: side by side, the curtain clipping both images, the after over the before as an onion skin, or the
|
|
550
619
|
* after alone (the before while the pointer is over it). One image alone when `mod` is undefined. `over` draws what
|
|
551
620
|
* 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 }) => {
|
|
621
|
+
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
622
|
const [peek, setPeek] = useState(false)
|
|
623
|
+
const [share, setShare] = useState<number | null | undefined>(undefined)
|
|
554
624
|
if (mod === undefined) return <Frame aspect={aspect} caption={null} over={over?.([base])}><div className="rv-fill">{draw(base)}</div></Frame>
|
|
555
625
|
const n = names ?? PAIR_NAMES
|
|
556
626
|
if (c.mode === 'side')
|
|
@@ -560,6 +630,12 @@ const Compare = observer(({ c, base, mod, names, aspect, draw, over }: { c: Comp
|
|
|
560
630
|
<Frame aspect={aspect} caption={n.mod} modCap over={over?.([mod])}><div className="rv-fill">{draw(mod)}</div></Frame>
|
|
561
631
|
</>
|
|
562
632
|
)
|
|
633
|
+
if (c.mode === 'diff')
|
|
634
|
+
return (
|
|
635
|
+
<Frame aspect={aspect} caption={<>changes <span className="rv-modcap">{changesWords(share)}</span></>} over={over?.([mod])}>
|
|
636
|
+
<div className="rv-fill">{draw(mod, <DiffCanvas base={base} mod={mod} say={setShare} />)}</div>
|
|
637
|
+
</Frame>
|
|
638
|
+
)
|
|
563
639
|
if (c.mode === 'mod')
|
|
564
640
|
return (
|
|
565
641
|
<Frame aspect={aspect} caption={peek ? n.base : n.mod} modCap={!peek} onPeek={setPeek} over={over?.([peek ? base : mod])}>
|
|
@@ -612,10 +688,12 @@ const clamp01 = (v: number): number => Math.max(0, Math.min(1, v))
|
|
|
612
688
|
/** a drag shorter than this, on either axis, is a click: it picks nothing */
|
|
613
689
|
const MIN_DRAG = 0.01
|
|
614
690
|
|
|
615
|
-
/** one image of view `view` and its rectangles: the ones his answers sent (still), and on the
|
|
616
|
-
* draft's, a drag drawing one (never in the curtain, whose drag moves the line). A clip view of
|
|
617
|
-
* is not the active one loops on its own: a click makes it active
|
|
618
|
-
|
|
691
|
+
/** one image or clip of view `view` and its rectangles: the ones his answers sent (still), and on the version his
|
|
692
|
+
* answer goes to his draft's, a drag drawing one (never in the curtain, whose drag moves the line). A clip view of
|
|
693
|
+
* that version that is not the active one loops on its own: a click makes it active. On a claiming version (the newest,
|
|
694
|
+
* his answer on an older one) a drag draws at once and brings his answer here. `face` takes the image's place (the
|
|
695
|
+
* changes of a pair) */
|
|
696
|
+
const Marks = observer(({ ver, src, side, view, face }: { ver: Ver; src: string; side: Side | undefined; view: number; face?: ReactNode }) => {
|
|
619
697
|
const { rv, card, cell } = ver
|
|
620
698
|
const el = useRef<HTMLDivElement>(null)
|
|
621
699
|
const [drag, setDrag] = useState<{ x0: number; y0: number; x1: number; y1: number } | null>(null)
|
|
@@ -624,7 +702,7 @@ const Marks = observer(({ ver, src, side, view }: { ver: Ver; src: string; side:
|
|
|
624
702
|
const shown = any && !isGallery(any) ? any : undefined
|
|
625
703
|
const clip = shown?.clip
|
|
626
704
|
const active = card.view === view
|
|
627
|
-
const drawing = ver
|
|
705
|
+
const drawing = takes(ver) && (phone.on ? phone.draw && (side === undefined || phone.pair !== 'swipe' || rv.compare.mode !== 'swipe') : side === undefined || rv.compare.mode !== 'swipe')
|
|
628
706
|
const c = clip ? card.clipOf(cell.id, view) : null
|
|
629
707
|
const at = (e: { clientX: number; clientY: number }): { x: number; y: number } => {
|
|
630
708
|
const b = el.current?.getBoundingClientRect()
|
|
@@ -641,6 +719,7 @@ const Marks = observer(({ ver, src, side, view }: { ver: Ver; src: string; side:
|
|
|
641
719
|
if (!drawing) return
|
|
642
720
|
e.preventDefault()
|
|
643
721
|
e.stopPropagation()
|
|
722
|
+
if (ver.claim) card.answerNewest()
|
|
644
723
|
// he draws on the paused frame: the rectangle keeps its time
|
|
645
724
|
if (c && !c.paused) c.pause()
|
|
646
725
|
const a = at(e)
|
|
@@ -671,7 +750,7 @@ const Marks = observer(({ ver, src, side, view }: { ver: Ver; src: string; side:
|
|
|
671
750
|
const live = drawing || (clip !== undefined && ver.live && !active)
|
|
672
751
|
return (
|
|
673
752
|
<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" />}
|
|
753
|
+
{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
754
|
{shown && rings.length > 0 ? <Rings marks={rings} w={shown.size.w} h={shown.size.h} /> : null}
|
|
676
755
|
{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
756
|
{rects.map(([r, i]) => (
|
|
@@ -710,8 +789,10 @@ const firstWords = (s: string): string => {
|
|
|
710
789
|
|
|
711
790
|
/** the picked rectangle's note box, beside it on the image: under it, or over it when it sits low, focused once drawn
|
|
712
791
|
* or clicked. Enter or Escape closes it (the rectangle stays), Shift Enter is a new line; `sides` are the sides the
|
|
713
|
-
* frame shows
|
|
714
|
-
|
|
792
|
+
* frame shows. Its tag names the side it marks (before or after), and a second row repeats the view's OK, Fix and No
|
|
793
|
+
* under the hand that drew it (ReactionToggles, the head's own) */
|
|
794
|
+
const RectNote = observer(({ ver, view, sides }: { ver: Ver; view: number; sides: readonly (Side | undefined)[] }) => {
|
|
795
|
+
const { card } = ver
|
|
715
796
|
const box = useRef<HTMLTextAreaElement | null>(null)
|
|
716
797
|
const i = card.rect
|
|
717
798
|
const r = i === null ? undefined : card.draft.rects[i]
|
|
@@ -727,7 +808,7 @@ const RectNote = observer(({ card, view, sides }: { card: ThreadSt; view: number
|
|
|
727
808
|
const place = below ? { top: `${(r.y + r.h) * 100}%` } : { bottom: `${(1 - r.y) * 100}%` }
|
|
728
809
|
return (
|
|
729
810
|
<div className={`rv-note${below ? ' below' : ' above'}`} style={{ ...place, ['--nx' as string]: `${r.x * 100}%` }} onPointerDown={(e) => e.stopPropagation()}>
|
|
730
|
-
<span className=
|
|
811
|
+
<span className={`rv-noten${r.side ? ` ${r.side}` : ''}`}>{i + 1}{r.side ? ` · ${r.side}` : ''}{r.t !== undefined ? ` · ${secs(r.t)}` : ''}</span>
|
|
731
812
|
<AutoText el={(t) => (box.current = t)} placeholder="what is wrong here · Enter closes" value={r.comment}
|
|
732
813
|
onText={(t) => card.setRectComment(i, t)}
|
|
733
814
|
onKeyDown={(e) => {
|
|
@@ -737,6 +818,7 @@ const RectNote = observer(({ card, view, sides }: { card: ThreadSt; view: number
|
|
|
737
818
|
}
|
|
738
819
|
}} />
|
|
739
820
|
<button className="ghost rv-x" title="delete this rectangle" aria-label="delete this rectangle" onMouseDown={keepFocus} onClick={() => card.removeRect(i)}>✕</button>
|
|
821
|
+
<span className="rv-notereacts"><ReactionToggles ver={ver} view={view} small /></span>
|
|
740
822
|
</div>
|
|
741
823
|
)
|
|
742
824
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// one open card of the review page read as a thread (wiki
|
|
1
|
+
// one open card of the review page read as a thread (wiki tools/shipkit/review.md, The review page): its cells from
|
|
2
2
|
// `GET /api/review/threads/<id>`, what he folded, the contents strip and where a click on it lands, his draft on the
|
|
3
3
|
// newest version (rectangles, reactions, stars, the pick, his word), each clip's clock. Made when a card opens,
|
|
4
4
|
// disposed when another one does. Only the newest version takes his marks: an older one shows what was said on it
|
|
@@ -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 {
|
|
@@ -105,17 +105,15 @@ export class ThreadSt {
|
|
|
105
105
|
/** the column scrolled to the newest cell once, on the first load */
|
|
106
106
|
landed = false
|
|
107
107
|
private drafts: Record<string, Draft> = {}
|
|
108
|
-
/** the older version his
|
|
108
|
+
/** the older version his answer goes to: a version landed while he wrote, or he chose to answer it. His first mark
|
|
109
|
+
* on the newest version, or « answer v4 », brings his answer back to the newest */
|
|
109
110
|
draftOn: string | null = null
|
|
110
|
-
/** he chose to keep his draft on the older version: the banner that offers the move is gone */
|
|
111
|
-
keptOn = false
|
|
112
111
|
/** the newest version's active view: the one last drawn on or picked, whose clip the keys drive */
|
|
113
112
|
view = 0
|
|
114
113
|
/** a picked rectangle of his draft: its note box opens beside it */
|
|
115
114
|
rect: number | null = null
|
|
116
115
|
/** the rectangle whose note box takes the focus once it shows */
|
|
117
116
|
noteFocus: number | null = null
|
|
118
|
-
viewZoom: Record<string, Zoom> = {}
|
|
119
117
|
/** the gallery tile shown large, `<item>#<view>/<tile>` */
|
|
120
118
|
bigTile: string | null = null
|
|
121
119
|
/** a draft card's past frame shown in place of its live one; null is now */
|
|
@@ -125,6 +123,8 @@ export class ThreadSt {
|
|
|
125
123
|
/** an option row folded or unfolded by hand, by `<item>#<view>` */
|
|
126
124
|
openRows: Record<string, boolean> = {}
|
|
127
125
|
busy = false
|
|
126
|
+
/** « 📣 post »'s box: his word while it is open, null when shut */
|
|
127
|
+
postBox: string | null = null
|
|
128
128
|
private readonly clips = new Map<string, ClipSt>()
|
|
129
129
|
/** the agent words already sent as read, by message id */
|
|
130
130
|
private readonly reading = new Set<string>()
|
|
@@ -173,19 +173,13 @@ export class ThreadSt {
|
|
|
173
173
|
this.reveal(v.asked, at)
|
|
174
174
|
}
|
|
175
175
|
if (this.draftOn !== null && !v.members.includes(this.draftOn)) this.draftOn = null
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (this.draftOn === null && !isDirty(this.drafts[v.head])) {
|
|
182
|
-
const older = [...v.members].reverse().find((id) => id !== v.head && (isDirty(this.drafts[id]) || isDirty(this.rv.storedDraft(id) ?? undefined)))
|
|
183
|
-
if (older) {
|
|
184
|
-
const d = this.drafts[older] ?? this.rv.storedDraft(older)
|
|
185
|
-
if (d) this.drafts = { ...this.drafts, [older]: d }
|
|
186
|
-
this.draftOn = older
|
|
187
|
-
}
|
|
176
|
+
// every version's draft kept in the browser is found again: an older one stays on its version (`parked`)
|
|
177
|
+
const found: Record<string, Draft> = {}
|
|
178
|
+
for (const id of v.members) {
|
|
179
|
+
const d = this.drafts[id] === undefined ? this.rv.storedDraft(id) : null
|
|
180
|
+
if (d) found[id] = d
|
|
188
181
|
}
|
|
182
|
+
if (Object.keys(found).length > 0) this.drafts = { ...this.drafts, ...found }
|
|
189
183
|
}
|
|
190
184
|
|
|
191
185
|
private defaultOpen(c: Cell, v: ThreadView): boolean {
|
|
@@ -211,10 +205,45 @@ export class ThreadSt {
|
|
|
211
205
|
return (this.cells.find((c) => c.id === h && c.kind !== 'event') as Framed | undefined) ?? null
|
|
212
206
|
}
|
|
213
207
|
|
|
208
|
+
/** an unsent draft on an older version while his answer goes to the newest: found again when the card opened, or
|
|
209
|
+
* left there by a mark on the newest. Never taken, never lost: the box offers to move it, answer it, or drop it */
|
|
210
|
+
get parked(): string | null {
|
|
211
|
+
if (this.draftOn !== null || !this.data) return null
|
|
212
|
+
const head = this.data.head
|
|
213
|
+
return [...this.data.members].reverse().find((id) => id !== head && isDirty(this.drafts[id])) ?? null
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** the newest version takes his marks while his answer sits on an older one: his first mark brings it back */
|
|
217
|
+
get claims(): boolean {
|
|
218
|
+
const n = this.newest
|
|
219
|
+
return this.draftOn !== null && n?.kind === 'version' && !n.item.wip
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** his answer goes to the newest version; the draft on the older one stays there, parked */
|
|
223
|
+
answerNewest(): void {
|
|
224
|
+
if (this.draftOn === null) return
|
|
225
|
+
this.draftOn = null
|
|
226
|
+
this.rect = null
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** his answer goes to the older version his parked draft is on */
|
|
230
|
+
answerParked(): void {
|
|
231
|
+
const p = this.parked
|
|
232
|
+
if (p === null) return
|
|
233
|
+
this.draftOn = p
|
|
234
|
+
this.rect = null
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** the parked draft dropped: his notes and his word on the older version */
|
|
238
|
+
dropParked(): void {
|
|
239
|
+
const p = this.parked
|
|
240
|
+
if (p !== null) this.put(p, null)
|
|
241
|
+
}
|
|
242
|
+
|
|
214
243
|
/** his draft moved onto the newest version: his word, and the marks whose view the newest has; what does not fit
|
|
215
244
|
* stays on the older one */
|
|
216
245
|
moveDraft(): void {
|
|
217
|
-
const from = this.draftOn
|
|
246
|
+
const from = this.draftOn ?? this.parked
|
|
218
247
|
const to = this.data?.head
|
|
219
248
|
if (from === null || !to) return
|
|
220
249
|
const d = this.drafts[from] ?? EMPTY
|
|
@@ -234,15 +263,9 @@ export class ThreadSt {
|
|
|
234
263
|
this.put(to, moved)
|
|
235
264
|
this.put(from, isDirty(left) ? left : null)
|
|
236
265
|
this.draftOn = null
|
|
237
|
-
this.keptOn = false
|
|
238
266
|
this.rect = null
|
|
239
267
|
}
|
|
240
268
|
|
|
241
|
-
/** he keeps his draft on the older version: his answer goes there */
|
|
242
|
-
keepDraftOn(): void {
|
|
243
|
-
this.keptOn = true
|
|
244
|
-
}
|
|
245
|
-
|
|
246
269
|
get headItem(): Item | null {
|
|
247
270
|
const h = this.head
|
|
248
271
|
return h?.kind === 'version' ? h.item : (h?.kind === 'note' ? (h.item ?? null) : null)
|
|
@@ -485,10 +508,7 @@ export class ThreadSt {
|
|
|
485
508
|
if (reactions.length > 0) left.reactions = reactions
|
|
486
509
|
this.put(on, isDirty(left) ? left : null)
|
|
487
510
|
}
|
|
488
|
-
if (this.draftOn === on)
|
|
489
|
-
this.draftOn = null
|
|
490
|
-
this.keptOn = false
|
|
491
|
-
}
|
|
511
|
+
if (this.draftOn === on) this.draftOn = null
|
|
492
512
|
if (this.target !== on) this.rect = null
|
|
493
513
|
}
|
|
494
514
|
|
|
@@ -582,14 +602,6 @@ export class ThreadSt {
|
|
|
582
602
|
this.rect = null
|
|
583
603
|
}
|
|
584
604
|
|
|
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
605
|
setFrame(f: number | null): void {
|
|
594
606
|
this.frame = f
|
|
595
607
|
}
|
|
@@ -695,6 +707,37 @@ export class ThreadSt {
|
|
|
695
707
|
}
|
|
696
708
|
}
|
|
697
709
|
|
|
710
|
+
openPost(): void {
|
|
711
|
+
this.postBox = ''
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
setPost(text: string): void {
|
|
715
|
+
this.postBox = text
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
closePost(): void {
|
|
719
|
+
this.postBox = null
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/** « 📣 post »: this card deserves its own public post, his word the angle; an agent writes the draft */
|
|
723
|
+
async askPost(): Promise<void> {
|
|
724
|
+
const text = this.postBox
|
|
725
|
+
const card = this.data?.head
|
|
726
|
+
if (text === null || !card || this.busy) return
|
|
727
|
+
this.busy = true
|
|
728
|
+
this.error = null
|
|
729
|
+
try {
|
|
730
|
+
await postJson(this.rv.url(`/api/review/${card}/post`), { text })
|
|
731
|
+
runInAction(() => (this.postBox = null))
|
|
732
|
+
this.rv.say('post asked: an agent writes the draft')
|
|
733
|
+
await this.rv.answered()
|
|
734
|
+
} catch (e) {
|
|
735
|
+
runInAction(() => (this.error = (e as Error).message))
|
|
736
|
+
} finally {
|
|
737
|
+
runInAction(() => (this.busy = false))
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
698
741
|
/** ⌘Enter or « reply »: his word goes to the thread's head as a reply; his marks stay in the draft */
|
|
699
742
|
async sendReply(): Promise<void> {
|
|
700
743
|
const h = this.target
|