rvlib-shipkit 2.19.0 → 2.21.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 +32 -0
- package/package.json +1 -1
- package/src/annex/annex.ts +227 -0
- package/src/annex/offload.ts +279 -0
- package/src/checks/SK004-gitignore-policy.check.ts +6 -3
- package/src/checks/SK040-release-words.check.ts +43 -0
- package/src/checks/SK041-annex-links.check.ts +28 -0
- package/src/checks/SK042-post-kinds.check.ts +73 -0
- package/src/cli/cmd_Annex.ts +179 -0
- package/src/cli/cmd_Commands.ts +4 -1
- package/src/cli/cmd_GlobalProcesses.ts +2 -107
- package/src/cli/cmd_Home.ts +4 -3
- package/src/cli/cmd_Messages.ts +155 -0
- package/src/cli/cmd_Overview.ts +2 -1
- package/src/cli/cmd_Releases.ts +84 -0
- package/src/cli/cmd_Review.ts +176 -12
- package/src/cli/cmd_Shot.ts +4 -4
- package/src/cli/cmd_Social.ts +151 -8
- package/src/cli/cmd_Sound.ts +17 -4
- package/src/cli/cmd_Trailer.ts +67 -1
- package/src/cli/family-pages.ts +2 -0
- package/src/cli/kit/index.ts +1 -1
- package/src/cli/kit/verb.ts +11 -3
- package/src/cli/registry.ts +7 -1
- package/src/collections/collection-types.ts +8 -1
- package/src/collections/providers.ts +4 -1
- package/src/collections/review.ts +23 -4
- package/src/commands/model.ts +36 -0
- package/src/commands/registry.ts +49 -0
- package/src/commands/routes.ts +59 -0
- package/src/commands/runner.ts +35 -0
- package/src/commands/runs.ts +112 -0
- package/src/core/app-icon.ts +4 -3
- package/src/core/icon-type.ts +8 -0
- package/src/core/jobs.ts +4 -3
- package/src/core/layout.ts +11 -2
- package/src/core/squircle.ts +95 -0
- package/src/home/daemon-jobs.ts +26 -2
- package/src/home/global-units.ts +3 -0
- package/src/home/gui-app/ShipkitGui.swift +337 -5
- package/src/home/gui-app.ts +64 -33
- package/src/home/hmr-keep.ts +134 -0
- package/src/home/home-start.ts +2 -2
- package/src/home/lib-watch.ts +21 -11
- package/src/home/pm-switch.ts +112 -0
- package/src/home/pm.ts +1 -1
- package/src/home/process-apps.ts +181 -0
- package/src/home/resources.ts +3 -3
- package/src/home/run-web.ts +7 -4
- package/src/home/serve-web.ts +64 -14
- package/src/identities/collection.ts +49 -0
- package/src/identities/identities.ts +121 -14
- package/src/identities/machine.ts +4 -3
- package/src/identities/rating.ts +33 -0
- package/src/identities/shown.ts +170 -0
- package/src/identities/steps.ts +5 -0
- package/src/media-store/purge.ts +15 -1
- package/src/media-store/remote.ts +22 -6
- package/src/messages/brief.ts +117 -0
- package/src/messages/collection.ts +40 -0
- package/src/messages/model.ts +171 -0
- package/src/messages/routes.ts +15 -0
- package/src/messages/score.ts +182 -0
- package/src/messages/tabs.ts +13 -0
- package/src/release/notes.ts +130 -0
- package/src/release/run-bump.ts +41 -18
- package/src/release/run-release.ts +22 -4
- package/src/release/run-releases.ts +17 -15
- package/src/release/unit-resolve.ts +9 -0
- package/src/releases/add.ts +94 -0
- package/src/releases/before.ts +31 -0
- package/src/releases/collection.ts +36 -0
- package/src/releases/from-card.ts +151 -0
- package/src/releases/model.ts +327 -0
- package/src/releases/pictures.ts +110 -0
- package/src/releases/routes.ts +36 -0
- package/src/releases/store.ts +71 -0
- package/src/repo-config.ts +5 -0
- package/src/review/cells.ts +0 -11
- package/src/review/format.ts +10 -6
- package/src/review/http.ts +1 -1
- package/src/review/model.ts +102 -3
- package/src/review/notes.ts +2 -48
- package/src/review/routes.ts +28 -10
- package/src/review/stage-card.ts +197 -0
- package/src/review/stage-routes.ts +123 -0
- package/src/review/store.ts +47 -1
- package/src/review/trailer-card.ts +99 -0
- package/src/review/trailer-desk.ts +76 -4
- package/src/review/trailer-model.ts +106 -7
- package/src/review/trailer-notes.ts +45 -0
- package/src/review/trailer-routes.ts +119 -13
- package/src/review/trailer-voices.ts +144 -0
- package/src/review/watchers.ts +58 -1
- package/src/serve/hub-app/app-bridge.ts +71 -0
- package/src/serve/hub-app/benign-errors.ts +22 -0
- package/src/serve/hub-app/commands/commands-page.tsx +122 -0
- package/src/serve/hub-app/commands/commands-st.ts +177 -0
- package/src/serve/hub-app/commands.css +24 -0
- package/src/serve/hub-app/hash-route.ts +59 -8
- package/src/serve/hub-app/home-st.ts +19 -2
- package/src/serve/hub-app/home.html +3 -0
- package/src/serve/hub-app/hub-app.tsx +8 -0
- package/src/serve/hub-app/icons.tsx +5 -0
- package/src/serve/hub-app/identities-view.tsx +4 -1
- package/src/serve/hub-app/identities.css +1 -0
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/keys.ts +2 -2
- package/src/serve/hub-app/machine-st.ts +41 -10
- package/src/serve/hub-app/messages/messages-page.tsx +354 -0
- package/src/serve/hub-app/messages/messages-st.ts +74 -0
- package/src/serve/hub-app/messages.css +35 -0
- package/src/serve/hub-app/project-list.css +7 -2
- package/src/serve/hub-app/project-list.tsx +9 -0
- package/src/serve/hub-app/projects-svc.ts +16 -6
- package/src/serve/hub-app/releases/releases-page.tsx +187 -0
- package/src/serve/hub-app/releases/releases-st.ts +111 -0
- package/src/serve/hub-app/releases.css +52 -0
- package/src/serve/hub-app/repo-sections.ts +16 -2
- package/src/serve/hub-app/repo-st.ts +66 -10
- package/src/serve/hub-app/review/clip-st.ts +34 -4
- package/src/serve/hub-app/review/kit.tsx +3 -3
- package/src/serve/hub-app/review/note-place.ts +31 -0
- package/src/serve/hub-app/review/review-cells.tsx +27 -3
- package/src/serve/hub-app/review/review-st.ts +77 -2
- package/src/serve/hub-app/review/review-thread.tsx +9 -31
- package/src/serve/hub-app/review/review-views.tsx +164 -58
- package/src/serve/hub-app/review/thread-st.ts +108 -41
- package/src/serve/hub-app/review/trailer-card.tsx +187 -0
- package/src/serve/hub-app/review/trailer-page.tsx +92 -36
- package/src/serve/hub-app/review/trailer-st.ts +306 -34
- package/src/serve/hub-app/review/trailer-timeline.tsx +68 -23
- package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
- package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
- package/src/serve/hub-app/review.css +137 -6
- package/src/serve/hub-app/social/comms-page.tsx +65 -28
- package/src/serve/hub-app/social/identity-pictures.ts +46 -8
- package/src/serve/hub-app/social/kit.tsx +9 -6
- package/src/serve/hub-app/social/next-release.tsx +118 -0
- package/src/serve/hub-app/social/post-card.tsx +10 -2
- package/src/serve/hub-app/social/social-model.ts +39 -3
- package/src/serve/hub-app/social/social-page.tsx +179 -65
- package/src/serve/hub-app/social/social-st.ts +117 -27
- package/src/serve/hub-app/social/stage-popup.tsx +268 -0
- package/src/serve/hub-app/social/stage-st.ts +310 -0
- package/src/serve/hub-app/social/step-layout.ts +42 -0
- package/src/serve/hub-app/social.css +68 -1
- package/src/serve/hub-app/tree-build.ts +40 -1
- package/src/serve/hub-app/tree-svc.ts +10 -3
- package/src/serve/project-gutter-route.ts +12 -2
- package/src/serve/project-gutter.ts +4 -2
- package/src/serve/same-origin.ts +24 -1
- package/src/serve/serve-hub.ts +15 -1
- package/src/shipkit-files.ts +9 -7
- package/src/shot/box.ts +33 -12
- package/src/shot/client.ts +1 -1
- package/src/shot/shooter.ts +22 -12
- package/src/shot/shot-ask.ts +14 -3
- package/src/shot/shot.shipkit.ts +1 -1
- package/src/social/desk-index.ts +49 -8
- package/src/social/discord-layout.ts +54 -7
- package/src/social/drafts.ts +1 -1
- package/src/social/fit.ts +84 -0
- package/src/social/identity-words.ts +74 -0
- package/src/social/kind-pages.ts +41 -0
- package/src/social/kinds.ts +93 -0
- package/src/social/load.ts +125 -10
- package/src/social/media-limit.ts +63 -2
- package/src/social/presence.ts +1 -1
- package/src/social/publish/bluesky.ts +58 -19
- package/src/social/publish/index.ts +47 -6
- package/src/social/reach.ts +49 -0
- package/src/social/release-stage.ts +277 -0
- package/src/social/routes.ts +44 -8
- package/src/social/stage.ts +246 -0
- package/src/social/strip.ts +85 -0
- package/src/social/text.ts +6 -2
- package/src/social/unit.ts +57 -1
- package/src/social/writes.ts +11 -0
- package/src/trailer/bed.ts +111 -0
- package/src/trailer/build.ts +72 -40
- package/src/trailer/ffmpeg.ts +6 -0
- package/src/trailer/grammar.ts +37 -6
- package/src/trailer/graph.ts +12 -1
- package/src/trailer/public-words.ts +41 -0
- package/src/trailer/shot-plan.ts +75 -0
- package/src/trailer/shot-state.ts +191 -0
- package/src/trailer/sound/audio.ts +28 -0
- package/src/trailer/sound/brand.ts +53 -3
- package/src/trailer/sound/gen.ts +61 -2
- package/src/trailer/sound/index.ts +25 -11
- package/src/trailer/sound/presets.ts +86 -5
- package/src/trailer/sound/run.ts +1 -1
- package/src/trailer/sound/takes.ts +94 -0
- package/src/trailer/titles.ts +36 -0
- package/src/trailer/url.ts +1 -1
|
@@ -5,13 +5,14 @@
|
|
|
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
|
|
7
7
|
import { observer } from 'mobx-react-lite'
|
|
8
|
-
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
|
8
|
+
import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'
|
|
9
9
|
import type { VersionCell } from '../../../review/cells.ts'
|
|
10
10
|
import { isChoice, isGallery, isPair, onFrame, STARS, STATUS_LABEL, thumbFileOf, tileName, viewFilesOf, viewName, viewTag, type GalleryTile, type GalleryView, type Item, type MediaView, type Rect, type ReviewClip, type ReviewMark, type ReviewView, type Side } from '../../../review/model.ts'
|
|
11
11
|
import { AutoText } from '../auto-text.tsx'
|
|
12
12
|
import type { ClipSt } from './clip-st.ts'
|
|
13
13
|
import { blurOnEscape, FIT_ROOM, keepFocus, PAIR_NAMES, REACTIONS, secs, SIDE_LABEL } from './kit.tsx'
|
|
14
14
|
import { GALLERY_FITS, GALLERY_MODES, TILE_H, ZOOMS, type GalleryFit, type GalleryMode, type Zoom } from './review-kit.ts'
|
|
15
|
+
import { notePlace } from './note-place.ts'
|
|
15
16
|
import { COMPARE_MODES, drawnSide, type CompareMode, type CompareSt, type PairSide, type ReviewSt } from './review-st.ts'
|
|
16
17
|
import { TILE_FILTERS, viewDom, viewKind, viewKey, type ThreadSt, type TileFilter } from './thread-st.ts'
|
|
17
18
|
import { Caret } from '../icons.tsx'
|
|
@@ -102,6 +103,7 @@ const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewVie
|
|
|
102
103
|
<span className="sp" />
|
|
103
104
|
{open && media?.marks && media.marks.length > 0 ? <button className={rv.marksOn ? 'primary' : ''} onMouseDown={keepFocus} onClick={() => rv.toggleMarks()}>marks · M</button> : null}
|
|
104
105
|
{open && media && isPair(media.files) && !media.audio && !rv.phone.on ? <CompareModes c={rv.compare} clip={media.clip !== undefined} /> : null}
|
|
106
|
+
<StageButtons ver={ver} v={v} i={i} />
|
|
105
107
|
</header>
|
|
106
108
|
<ViewNotes ver={ver} i={i} gallery={isGallery(v)} />
|
|
107
109
|
{open ? (
|
|
@@ -115,6 +117,30 @@ const ViewCell = observer(({ ver, v: live, i, frames }: { ver: Ver; v: ReviewVie
|
|
|
115
117
|
)
|
|
116
118
|
})
|
|
117
119
|
|
|
120
|
+
/** « 📤 » on a view: the stage popup on that media; a pair offers its after, its before, and the wipe of two images; a
|
|
121
|
+
* gallery opens on its first tile, the popup's strip holding every other; a sound alone stages nothing */
|
|
122
|
+
const StageButtons = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number }) => {
|
|
123
|
+
const { rv } = ver
|
|
124
|
+
const item = itemOf(ver)
|
|
125
|
+
if (item.origin.by !== 'agent') return null
|
|
126
|
+
const at = `${item.id}#${i}`
|
|
127
|
+
const btn = (key: string, label: string, tip: string) => (
|
|
128
|
+
<button key={key} className="ghost rv-stagebtn" title={tip} onMouseDown={keepFocus} onClick={() => rv.openStage(key)}>
|
|
129
|
+
{label}
|
|
130
|
+
</button>
|
|
131
|
+
)
|
|
132
|
+
if (isGallery(v)) return btn(`${at}/0`, '📤', 'stage a tile of this grid as a post')
|
|
133
|
+
if (v.audio) return null
|
|
134
|
+
if (!isPair(v.files)) return btn(at, '📤', 'stage this media as a post: a draft in comms, never posted')
|
|
135
|
+
return (
|
|
136
|
+
<>
|
|
137
|
+
{btn(`${at}.after`, '📤 after', 'stage the after as a post')}
|
|
138
|
+
{btn(`${at}.before`, '📤 before', 'stage the before as a post')}
|
|
139
|
+
{v.clip ? null : btn(`${at}.wipe`, '📤 wipe', 'stage the pair as one wipe from before to after')}
|
|
140
|
+
</>
|
|
141
|
+
)
|
|
142
|
+
})
|
|
143
|
+
|
|
118
144
|
/** what was said on one view, above it: each answer's rectangles and reactions (a click shows the rectangle), then on
|
|
119
145
|
* the newest version his draft: each rectangle's word, his word on the view */
|
|
120
146
|
const ViewNotes = observer(({ ver, i, gallery, word = true }: { ver: Ver; i: number; gallery: boolean; word?: boolean }) => {
|
|
@@ -208,6 +234,7 @@ const OptionRow = observer(({ ver, v, i }: { ver: Ver; v: ReviewView; i: number
|
|
|
208
234
|
</button>
|
|
209
235
|
) : null}
|
|
210
236
|
<b className="rv-optlabel" title={viewName(v, i)}>{viewName(v, i)}</b>
|
|
237
|
+
{choice && item.agentPick === i ? <span className="rv-mypick" title="the option the agent suggests; your pick is your own">my pick</span> : null}
|
|
211
238
|
{c && playable?.clip && !unfolded ? (
|
|
212
239
|
<span className="rv-optthumb" style={{ aspectRatio: `${playable.size.w} / ${playable.size.h}` }} onClick={() => card.toggleRow(item, i)} title="the full view">
|
|
213
240
|
<ClipVideo clip={c} src={rv.fileUrl(id, file, item.wip)} poster={rv.thumbUrl(id, playable.clip.poster)} loop={false} />
|
|
@@ -783,7 +810,7 @@ const Compare = observer(({ c, mode = c.mode, base, mod, names, aspect, draw, ov
|
|
|
783
810
|
)
|
|
784
811
|
if (mode === 'diff')
|
|
785
812
|
return (
|
|
786
|
-
<Frame aspect={aspect} caption={<>changes <span className="rv-modcap">{changesWords(share)}</span
|
|
813
|
+
<Frame aspect={aspect} caption={<>changes view: only the changed pixels are coloured, <span className="rv-modcap">{changesWords(share)}</span> · ◫ or D for the normal view</>} over={over?.([mod])}>
|
|
787
814
|
<div className="rv-fill">{draw(mod, <DiffCanvas base={base} mod={mod} say={setShare} />)}</div>
|
|
788
815
|
</Frame>
|
|
789
816
|
)
|
|
@@ -833,36 +860,78 @@ const Frame = ({ aspect, caption, modCap, swipe, onPeek, over, children }: { asp
|
|
|
833
860
|
|
|
834
861
|
// ── drawing ──
|
|
835
862
|
|
|
836
|
-
|
|
837
|
-
const
|
|
863
|
+
type Corners = { x0: number; y0: number; x1: number; y1: number }
|
|
864
|
+
const box = (a: Corners) => ({ x: Math.min(a.x0, a.x1), y: Math.min(a.y0, a.y1), w: Math.abs(a.x1 - a.x0), h: Math.abs(a.y1 - a.y0) })
|
|
865
|
+
export const pct = (r: { x: number; y: number; w: number; h: number }) => ({ left: `${r.x * 100}%`, top: `${r.y * 100}%`, width: `${r.w * 100}%`, height: `${r.h * 100}%` })
|
|
838
866
|
const clamp01 = (v: number): number => Math.max(0, Math.min(1, v))
|
|
839
867
|
/** a drag shorter than this, on either axis, is a click: it picks nothing */
|
|
840
868
|
const MIN_DRAG = 0.01
|
|
841
869
|
|
|
870
|
+
/** the drag that draws a rectangle on a picture, 0 to 1 over `el`: `show` the box while it moves (null once let go),
|
|
871
|
+
* `end` the rectangle, or null for a click. A card's views draw with it, and a trailer page's frame */
|
|
872
|
+
export function dragBox(e: { clientX: number; clientY: number }, el: Element, show: (c: Corners | null) => void, end: (r: { x: number; y: number; w: number; h: number } | null) => void): void {
|
|
873
|
+
const at = (p: { clientX: number; clientY: number }): { x: number; y: number } => {
|
|
874
|
+
const b = el.getBoundingClientRect()
|
|
875
|
+
return { x: clamp01((p.clientX - b.left) / b.width), y: clamp01((p.clientY - b.top) / b.height) }
|
|
876
|
+
}
|
|
877
|
+
const a = at(e)
|
|
878
|
+
let cur: Corners = { x0: a.x, y0: a.y, x1: a.x, y1: a.y }
|
|
879
|
+
show(cur)
|
|
880
|
+
const move = (m: PointerEvent): void => {
|
|
881
|
+
const b = at(m)
|
|
882
|
+
cur = { ...cur, x1: b.x, y1: b.y }
|
|
883
|
+
show(cur)
|
|
884
|
+
}
|
|
885
|
+
const up = (): void => {
|
|
886
|
+
window.removeEventListener('pointermove', move)
|
|
887
|
+
window.removeEventListener('pointerup', up)
|
|
888
|
+
window.removeEventListener('pointercancel', up)
|
|
889
|
+
show(null)
|
|
890
|
+
const r = box(cur)
|
|
891
|
+
end(r.w > MIN_DRAG && r.h > MIN_DRAG ? r : null)
|
|
892
|
+
}
|
|
893
|
+
window.addEventListener('pointermove', move)
|
|
894
|
+
window.addEventListener('pointerup', up)
|
|
895
|
+
window.addEventListener('pointercancel', up)
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/** the rectangle being drawn */
|
|
899
|
+
export const DragBox = ({ c }: { c: Corners | null }) => (c ? <div className="rv-drag" style={pct(box(c))} /> : null)
|
|
900
|
+
|
|
901
|
+
/** what a host that shows notes by time says of each rectangle: hidden now (null), else its number and whether it is lit */
|
|
902
|
+
export type ShownNote = (r: Rect) => { n: number; lit: boolean } | null
|
|
903
|
+
|
|
904
|
+
/** a picture another kind of view hosts (a trailer card's player): the regular frame and its rectangles over the host's
|
|
905
|
+
* own `face`, drawn and kept as on an image, the picked one's note box beside it. `notes` says which rectangles show
|
|
906
|
+
* now and their numbers */
|
|
907
|
+
export const HostedFrame = observer(({ ver, view, side, aspect, face, notes }: { ver: Ver; view: number; side: Side | undefined; aspect: string; face: ReactNode; notes: ShownNote }) => (
|
|
908
|
+
<Frame aspect={aspect} caption={null} over={ver.live ? <RectNote ver={ver} view={view} sides={[side]} notes={notes} /> : null}>
|
|
909
|
+
<div className="rv-fill"><Marks ver={ver} src="" side={side} view={view} face={face} alone notes={notes} /></div>
|
|
910
|
+
</Frame>
|
|
911
|
+
))
|
|
912
|
+
|
|
842
913
|
/** one image or clip of view `view` and its rectangles: the ones his answers sent (still), and on the version his
|
|
843
914
|
* answer goes to his draft's, a drag drawing one (never in the curtain, whose drag moves the line). A clip view of
|
|
844
915
|
* that version that is not the active one loops on its own: a click makes it active. On a claiming version (the newest,
|
|
845
916
|
* his answer on an older one) a drag draws at once and brings his answer here. `face` takes the image's place (the
|
|
846
|
-
* changes of a pair)
|
|
847
|
-
|
|
917
|
+
* changes of a pair, a trailer card's player); `alone`: one picture with no curtain over it, whatever its side. The
|
|
918
|
+
* clock its frames stand on is the card's (`clockOf`): a clip's own, a trailer card's player's. `notes`: a host that
|
|
919
|
+
* shows its notes by time picks which rectangles show and numbers them, each with its first words */
|
|
920
|
+
const Marks = observer(({ ver, src, side, view, face, tile, onTap, alone, notes }: { ver: Ver; src: string; side: Side | undefined; view: number; face?: ReactNode; tile?: number; onTap?: () => void; alone?: boolean; notes?: ShownNote }) => {
|
|
848
921
|
const { rv, card, cell } = ver
|
|
849
922
|
const el = useRef<HTMLDivElement>(null)
|
|
850
|
-
const [drag, setDrag] = useState<
|
|
923
|
+
const [drag, setDrag] = useState<Corners | null>(null)
|
|
851
924
|
const phone = rv.phone
|
|
852
925
|
const any = itemOf(ver).views[view]
|
|
853
926
|
const shown = any && !isGallery(any) ? any : undefined
|
|
854
|
-
const
|
|
927
|
+
const clock = tile === undefined ? card.clockOf(cell.id, view) : null
|
|
855
928
|
const active = card.view === view
|
|
856
|
-
const
|
|
857
|
-
const
|
|
858
|
-
const
|
|
859
|
-
const b = el.current?.getBoundingClientRect()
|
|
860
|
-
if (!b) return { x: 0, y: 0 }
|
|
861
|
-
return { x: clamp01((e.clientX - b.left) / b.width), y: clamp01((e.clientY - b.top) / b.height) }
|
|
862
|
-
}
|
|
929
|
+
const free = alone === true || side === undefined
|
|
930
|
+
const drawing = takes(ver) && (phone.on ? phone.draw && (free || phone.pair !== 'swipe' || rv.compare.mode !== 'swipe') : free || rv.compare.mode !== 'swipe')
|
|
931
|
+
const c = clock?.c ?? null
|
|
863
932
|
const down = (e: React.PointerEvent): void => {
|
|
864
933
|
if (e.button !== 0) return
|
|
865
|
-
if (
|
|
934
|
+
if (clock && ver.live && !active) {
|
|
866
935
|
e.preventDefault()
|
|
867
936
|
card.setView(view)
|
|
868
937
|
return
|
|
@@ -873,46 +942,49 @@ const Marks = observer(({ ver, src, side, view, face, tile, onTap }: { ver: Ver;
|
|
|
873
942
|
if (ver.claim) card.answerNewest()
|
|
874
943
|
// he draws on the paused frame: the rectangle keeps its time
|
|
875
944
|
if (c && !c.paused) c.pause()
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
const move = (m: PointerEvent): void => {
|
|
880
|
-
const b = at(m)
|
|
881
|
-
cur = { ...cur, x1: b.x, y1: b.y }
|
|
882
|
-
setDrag(cur)
|
|
883
|
-
}
|
|
884
|
-
const up = (): void => {
|
|
885
|
-
window.removeEventListener('pointermove', move)
|
|
886
|
-
window.removeEventListener('pointerup', up)
|
|
887
|
-
window.removeEventListener('pointercancel', up)
|
|
888
|
-
setDrag(null)
|
|
889
|
-
const r = box(cur)
|
|
890
|
-
if (r.w > MIN_DRAG && r.h > MIN_DRAG) card.addRect(r, side, view, tile)
|
|
945
|
+
if (!el.current) return
|
|
946
|
+
dragBox(e, el.current, setDrag, (r) => {
|
|
947
|
+
if (r) card.addRect(r, side, view, tile)
|
|
891
948
|
else if (onTap) onTap()
|
|
892
949
|
else card.pickRect(null)
|
|
893
|
-
}
|
|
894
|
-
window.addEventListener('pointermove', move)
|
|
895
|
-
window.addEventListener('pointerup', up)
|
|
896
|
-
window.addEventListener('pointercancel', up)
|
|
950
|
+
})
|
|
897
951
|
}
|
|
898
952
|
const rects = ver.live ? card.draft.rects.map((r, i) => [r, i] as const).filter(([r]) => r.side === side && (r.view ?? 0) === view && r.tile === tile) : []
|
|
899
953
|
const sent = card.sentRects(cell.id, view, side, tile)
|
|
900
|
-
const onIts = (r: Rect): boolean => !
|
|
954
|
+
const onIts = (r: Rect): boolean => !clock || r.t === undefined || (clock.c.paused && onFrame(r.t, clock.c.time, clock.fps))
|
|
901
955
|
const rings = rv.marksOn ? (shown?.marks ?? []).filter((m) => m.side === side) : []
|
|
902
|
-
const live = drawing || (
|
|
956
|
+
const live = drawing || (clock !== null && ver.live && !active)
|
|
903
957
|
return (
|
|
904
|
-
<div ref={el} className={`rv-marks${
|
|
958
|
+
<div ref={el} className={`rv-marks${clock && ver.live && !active ? ' pick' : drawing ? ' draw' : ''}`} onPointerDown={down} style={{ pointerEvents: live ? 'auto' : 'none', touchAction: drawing ? 'none' : undefined }}>
|
|
905
959
|
{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" />)}
|
|
906
960
|
{shown && rings.length > 0 ? <Rings marks={rings} w={shown.size.w} h={shown.size.h} /> : null}
|
|
907
|
-
{
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
961
|
+
{notes
|
|
962
|
+
? sent.flatMap(({ r }, k) => {
|
|
963
|
+
const s = notes(r)
|
|
964
|
+
return s ? [<NoteRect key={`s${k}`} r={r} n={s.n} on={s.lit} sent />] : []
|
|
965
|
+
})
|
|
966
|
+
: 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>)}
|
|
967
|
+
{notes
|
|
968
|
+
? rects.flatMap(([r, i]) => {
|
|
969
|
+
const s = notes(r)
|
|
970
|
+
return s ? [<NoteRect key={i} r={r} n={s.n} on={s.lit || card.rect === i} pick={() => card.pickRect(i, true)} />] : []
|
|
971
|
+
})
|
|
972
|
+
: rects.map(([r, i]) => (
|
|
973
|
+
<RectMark key={i} r={r} n={i + 1} on={card.rect === i} faint={!onIts(r)} at={clock && r.t !== undefined ? secs(r.t) : undefined} pick={() => card.pickRect(i, true)} />
|
|
974
|
+
))}
|
|
975
|
+
<DragBox c={drag} />
|
|
912
976
|
</div>
|
|
913
977
|
)
|
|
914
978
|
})
|
|
915
979
|
|
|
980
|
+
/** a note's rectangle as a host that shows notes by time draws it: solid, its number and its first words on its label */
|
|
981
|
+
export const NoteRect = ({ r, n, on, sent, pick }: { r: { x: number; y: number; w: number; h: number; comment: string }; n: number; on: boolean; sent?: boolean; pick?: () => void }) => (
|
|
982
|
+
<div className={`rv-rect tr-noterect${on ? ' on' : ''}${sent ? ' was' : ''}`} style={{ ...pct(r), pointerEvents: pick ? 'auto' : 'none' }} title={r.comment || `note ${n}`}
|
|
983
|
+
onPointerDown={pick ? (e) => { e.stopPropagation(); pick() } : undefined} onMouseDown={keepFocus}>
|
|
984
|
+
<span className="tr-notelabel"><b>{n}</b>{r.comment.trim() ? ` ${firstWords(r.comment)}` : ''}</span>
|
|
985
|
+
</div>
|
|
986
|
+
)
|
|
987
|
+
|
|
916
988
|
/** a repo's own rings over its shot; they never take a click */
|
|
917
989
|
const Rings = ({ marks, w, h }: { marks: readonly ReviewMark[]; w: number; h: number }) => (
|
|
918
990
|
<svg className="rv-rings" viewBox={`0 0 ${w} ${h}`} preserveAspectRatio="none">
|
|
@@ -939,28 +1011,64 @@ const firstWords = (s: string): string => {
|
|
|
939
1011
|
return w.length > 5 ? `${w.slice(0, 5).join(' ')}…` : w.join(' ')
|
|
940
1012
|
}
|
|
941
1013
|
|
|
942
|
-
/** the picked rectangle's note box, beside it on the
|
|
943
|
-
*
|
|
944
|
-
* frame shows. Its tag names the side it marks (before or
|
|
945
|
-
* under the hand that drew it (ReactionToggles, the head's
|
|
946
|
-
|
|
1014
|
+
/** the picked rectangle's note box, beside it on the frame and never over it (notePlace), focused once drawn or
|
|
1015
|
+
* clicked. Enter, Escape or a press anywhere outside closes it (the rectangle and its words stay: each key writes the
|
|
1016
|
+
* draft), Shift Enter is a new line; `sides` are the sides the frame shows. Its tag names the side it marks (before or
|
|
1017
|
+
* after), and a second row repeats the view's OK, Fix and No under the hand that drew it (ReactionToggles, the head's
|
|
1018
|
+
* own). `notes`: a host that shows its notes by time (a trailer card) numbers it, shows it only paused on its frame,
|
|
1019
|
+
* and leaves OK, Fix and No to the verdict */
|
|
1020
|
+
const RectNote = observer(({ ver, view, sides, tile, notes }: { ver: Ver; view: number; sides: readonly (Side | undefined)[]; tile?: number; notes?: ShownNote }) => {
|
|
947
1021
|
const { card } = ver
|
|
948
1022
|
const box = useRef<HTMLTextAreaElement | null>(null)
|
|
1023
|
+
const el = useRef<HTMLDivElement>(null)
|
|
1024
|
+
const [size, setSize] = useState<{ fw: number; fh: number; nw: number; nh: number } | null>(null)
|
|
949
1025
|
const i = card.rect
|
|
950
1026
|
const r = i === null ? undefined : card.draft.rects[i]
|
|
951
|
-
const
|
|
1027
|
+
const shown = r && notes ? notes(r) : null
|
|
1028
|
+
const paused = card.clockOf(card.target ?? '', view)?.c.paused ?? true
|
|
1029
|
+
const here = i !== null && r !== undefined && (r.view ?? 0) === view && sides.includes(r.side) && r.tile === tile && (!notes || (shown !== null && paused))
|
|
952
1030
|
const focus = here && card.noteFocus === i
|
|
953
1031
|
useEffect(() => {
|
|
954
|
-
|
|
955
|
-
|
|
1032
|
+
const t = box.current
|
|
1033
|
+
if (!focus || t === null) return
|
|
1034
|
+
// the cursor after the words, so a reopened note goes on where it stopped
|
|
1035
|
+
t.focus()
|
|
1036
|
+
t.setSelectionRange(t.value.length, t.value.length)
|
|
956
1037
|
card.noteFocused()
|
|
957
1038
|
}, [focus, card])
|
|
1039
|
+
// the frame's size and its own, read before paint and again as either changes (a word wraps, the window moves)
|
|
1040
|
+
useLayoutEffect(() => {
|
|
1041
|
+
const n = el.current
|
|
1042
|
+
const f = n?.parentElement
|
|
1043
|
+
if (!n || !f) return
|
|
1044
|
+
const read = (): void => {
|
|
1045
|
+
const v = { fw: f.clientWidth, fh: f.clientHeight, nw: n.offsetWidth, nh: n.offsetHeight }
|
|
1046
|
+
setSize((s) => (s && s.fw === v.fw && s.fh === v.fh && s.nw === v.nw && s.nh === v.nh ? s : v))
|
|
1047
|
+
}
|
|
1048
|
+
read()
|
|
1049
|
+
const ro = new ResizeObserver(read)
|
|
1050
|
+
ro.observe(n)
|
|
1051
|
+
ro.observe(f)
|
|
1052
|
+
return () => ro.disconnect()
|
|
1053
|
+
}, [here])
|
|
1054
|
+
// a press outside closes it, captured so a handler that stops it (a rectangle, the frame's drag) closes it too
|
|
1055
|
+
useEffect(() => {
|
|
1056
|
+
if (!here) return
|
|
1057
|
+
const out = (e: PointerEvent): void => {
|
|
1058
|
+
if (!el.current?.contains(e.target as Node)) card.pickRect(null)
|
|
1059
|
+
}
|
|
1060
|
+
document.addEventListener('pointerdown', out, true)
|
|
1061
|
+
return () => document.removeEventListener('pointerdown', out, true)
|
|
1062
|
+
}, [here, card])
|
|
958
1063
|
if (!here) return null
|
|
959
|
-
const
|
|
960
|
-
|
|
1064
|
+
const at = size ? notePlace({ x: r.x * size.fw, y: r.y * size.fh, w: r.w * size.fw, h: r.h * size.fh }, { w: size.fw, h: size.fh }, { w: size.nw, h: size.nh }) : null
|
|
1065
|
+
// until measured it waits unseen, still focusable, where it most often lands
|
|
1066
|
+
const place = at ? { left: at.left, top: at.top } : { left: `${r.x * 100}%`, top: `${(r.y + r.h) * 100}%`, opacity: 0 }
|
|
1067
|
+
const n = shown?.n ?? i + 1
|
|
1068
|
+
const side = notes ? undefined : r.side
|
|
961
1069
|
return (
|
|
962
|
-
<div className={`rv-note${
|
|
963
|
-
<span className={`rv-noten${
|
|
1070
|
+
<div ref={el} className={`rv-note ${at?.side ?? 'below'}`} style={place} onPointerDown={(e) => e.stopPropagation()}>
|
|
1071
|
+
<span className={`rv-noten${side ? ` ${side}` : ''}`}>{n}{side ? ` · ${side}` : ''}{r.t !== undefined ? ` · ${secs(r.t)}` : ''}</span>
|
|
964
1072
|
<AutoText el={(t) => (box.current = t)} placeholder="what is wrong here · Enter closes" value={r.comment}
|
|
965
1073
|
onText={(t) => card.setRectComment(i, t)}
|
|
966
1074
|
onKeyDown={(e) => {
|
|
@@ -970,12 +1078,10 @@ const RectNote = observer(({ ver, view, sides, tile }: { ver: Ver; view: number;
|
|
|
970
1078
|
}
|
|
971
1079
|
}} />
|
|
972
1080
|
<button className="ghost rv-x" title="delete this rectangle" aria-label="delete this rectangle" onMouseDown={keepFocus} onClick={() => card.removeRect(i)}>✕</button>
|
|
973
|
-
<span className="rv-notereacts"><ReactionToggles ver={ver} view={view} small /></span>
|
|
1081
|
+
{notes ? null : <span className="rv-notereacts"><ReactionToggles ver={ver} view={view} small /></span>}
|
|
974
1082
|
</div>
|
|
975
1083
|
)
|
|
976
1084
|
})
|
|
977
|
-
/** a rectangle whose bottom is lower than this share of the image opens its note over it, when there is room above */
|
|
978
|
-
const NOTE_LOW = 0.78
|
|
979
1085
|
|
|
980
1086
|
// ── a clip ──
|
|
981
1087
|
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
isChoice,
|
|
11
11
|
isGallery,
|
|
12
12
|
isPair,
|
|
13
|
+
isTrailerCard,
|
|
13
14
|
STARS,
|
|
14
15
|
viewTag,
|
|
15
16
|
type Item,
|
|
@@ -19,10 +20,14 @@ import {
|
|
|
19
20
|
type ReviewStatus,
|
|
20
21
|
type ReviewView,
|
|
21
22
|
type Side,
|
|
23
|
+
type TrailerCard,
|
|
22
24
|
} from '../../../review/model.ts'
|
|
23
25
|
import { ClipSt } from './clip-st.ts'
|
|
24
26
|
import { etagLoader, postJson } from './review-kit.ts'
|
|
25
27
|
import type { ReviewSt } from './review-st.ts'
|
|
28
|
+
import { TrailerSt } from './trailer-st.ts'
|
|
29
|
+
import { laneNotes, notesNow, sortedDraft, type LaneNote } from '../../../review/trailer-notes.ts'
|
|
30
|
+
import type { LaneMark } from '../../../review/trailer-model.ts'
|
|
26
31
|
|
|
27
32
|
export interface Draft {
|
|
28
33
|
rects: Rect[]
|
|
@@ -116,6 +121,9 @@ export class ThreadSt {
|
|
|
116
121
|
view = 0
|
|
117
122
|
/** a picked rectangle of his draft: its note box opens beside it */
|
|
118
123
|
rect: number | null = null
|
|
124
|
+
/** a trailer card's note picked (`LaneNote.key`), and the one under the pointer in the rail */
|
|
125
|
+
noteSel: string | null = null
|
|
126
|
+
noteHover: string | null = null
|
|
119
127
|
/** the rectangle whose note box takes the focus once it shows */
|
|
120
128
|
noteFocus: number | null = null
|
|
121
129
|
/** the gallery tile shown large, `<item>#<view>/<tile>` */
|
|
@@ -139,9 +147,9 @@ export class ThreadSt {
|
|
|
139
147
|
busy = false
|
|
140
148
|
/** the verdict he just gave: shown as chosen the moment he clicks, while the store takes it */
|
|
141
149
|
sending: { on: string; status: ReviewStatus } | null = null
|
|
142
|
-
/** « 📣 post »'s box: his word while it is open, null when shut */
|
|
143
|
-
postBox: string | null = null
|
|
144
150
|
private readonly clips = new Map<string, ClipSt>()
|
|
151
|
+
/** a trailer card's player, by its version's id */
|
|
152
|
+
private readonly trailers = new Map<string, TrailerSt>()
|
|
145
153
|
/** the agent words already sent as read, by message id */
|
|
146
154
|
private readonly reading = new Set<string>()
|
|
147
155
|
private readonly load: () => Promise<ThreadView>
|
|
@@ -154,12 +162,24 @@ export class ThreadSt {
|
|
|
154
162
|
) {
|
|
155
163
|
this.view = view
|
|
156
164
|
this.load = etagLoader<ThreadView>(() => rv.url(`/api/review/threads/${encodeURIComponent(id)}`))
|
|
157
|
-
makeAutoObservable<this, 'rv' | 'clips' | 'reading' | 'load'>(this, { rv: false, clips: false, reading: false, load: false, data: observableRef })
|
|
165
|
+
makeAutoObservable<this, 'rv' | 'clips' | 'trailers' | 'reading' | 'load'>(this, { rv: false, clips: false, trailers: false, reading: false, load: false, data: observableRef })
|
|
158
166
|
}
|
|
159
167
|
|
|
160
168
|
dispose(): void {
|
|
161
169
|
for (const c of this.clips.values()) c.pause()
|
|
162
170
|
this.clips.clear()
|
|
171
|
+
for (const t of this.trailers.values()) t.stop()
|
|
172
|
+
this.trailers.clear()
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** the trailer entry's player for a trailer card's version, made once */
|
|
176
|
+
trailerOf(item: Item & { trailer: TrailerCard }): TrailerSt {
|
|
177
|
+
let t = this.trailers.get(item.id)
|
|
178
|
+
if (!t) {
|
|
179
|
+
t = new TrailerSt(this.rv.repo, { id: item.id, spec: item.trailer, lane: () => this.laneMarks(item.id) })
|
|
180
|
+
this.trailers.set(item.id, t)
|
|
181
|
+
}
|
|
182
|
+
return t
|
|
163
183
|
}
|
|
164
184
|
|
|
165
185
|
async refresh(): Promise<void> {
|
|
@@ -390,9 +410,10 @@ export class ThreadSt {
|
|
|
390
410
|
if (c.kind === 'version') {
|
|
391
411
|
out.push({ key: c.id, kind: 'version', cell: c.id, label: `v${c.n} · ${c.summary || c.item.title}`, badge: `v${c.n}`, tone: `st-${c.status}`, head: isHead })
|
|
392
412
|
const choice = isChoice(c.item)
|
|
413
|
+
const trailer = isTrailerCard(c.item)
|
|
393
414
|
c.item.views.forEach((v, i) => {
|
|
394
415
|
const r = this.reactionShown(c, i)
|
|
395
|
-
out.push({ key: viewKey(c.id, i), kind: 'view', cell: c.id, view: i, label: `${viewTag(c.n, i)}${v.label ? ` ${v.label}` : ''}`, badge: viewKind(v, choice), tone: r?.status ? `re-${r.status}` : this.pickShown(c) === i ? 're-approved' : null, head: isHead })
|
|
416
|
+
out.push({ key: viewKey(c.id, i), kind: 'view', cell: c.id, view: i, label: `${viewTag(c.n, i)}${v.label ? ` ${v.label}` : ''}`, badge: trailer ? 'trailer' : viewKind(v, choice), tone: r?.status ? `re-${r.status}` : this.pickShown(c) === i ? 're-approved' : null, head: isHead })
|
|
396
417
|
})
|
|
397
418
|
} else if (c.kind === 'verdict') out.push({ key: c.id, kind: 'verdict', cell: c.id, label: `on v${c.n} · ${c.summary}`, badge: 'verdict', tone: `st-${c.verdict}`, head: false })
|
|
398
419
|
else out.push({ key: c.id, kind: c.kind, cell: c.id, label: `${c.who === 'owner' ? 'you' : c.who} · ${c.summary}`, badge: KIND_WORD[c.kind], tone: null, head: isHead })
|
|
@@ -540,13 +561,69 @@ export class ThreadSt {
|
|
|
540
561
|
addRect(r: { x: number; y: number; w: number; h: number }, side: Side | undefined, on: number, tile?: number): void {
|
|
541
562
|
if (on !== this.view) this.setView(on)
|
|
542
563
|
const view = on > 0 ? { view: on } : {}
|
|
543
|
-
const
|
|
544
|
-
const t =
|
|
545
|
-
|
|
546
|
-
|
|
564
|
+
const clock = tile === undefined ? this.clockOf(this.target ?? '', on) : null
|
|
565
|
+
const t = clock ? { t: Math.round(clock.c.time * 1000) / 1000 } : {}
|
|
566
|
+
// on a trailer card's frame it is also anchored on its shot, so a new render places it
|
|
567
|
+
const shot = clock?.trailer?.anchor ?? null
|
|
568
|
+
const added: Rect = { ...r, comment: '', ...view, ...(side ? { side } : {}), ...t, ...(shot ? { shot } : {}), ...(tile !== undefined ? { tile } : {}) }
|
|
569
|
+
if (clock?.trailer) {
|
|
570
|
+
// a trailer's draft stays in the order of the cut, so the verdict sends it so and the rail numbers it so
|
|
571
|
+
const { rects, at } = sortedDraft(this.draft.rects, added)
|
|
572
|
+
this.edit((d) => ({ ...d, rects }))
|
|
573
|
+
this.rect = at
|
|
574
|
+
this.noteSel = `d:${at}`
|
|
575
|
+
} else {
|
|
576
|
+
this.edit((d) => ({ ...d, rects: [...d.rects, added] }))
|
|
577
|
+
this.rect = this.draft.rects.length - 1
|
|
578
|
+
}
|
|
547
579
|
this.noteFocus = this.rect
|
|
548
580
|
}
|
|
549
581
|
|
|
582
|
+
// ── a trailer card's notes (wiki tools/shipkit/review.md, A trailer) ──
|
|
583
|
+
|
|
584
|
+
/** a version's notes in the order of the cut: its verdicts' rectangles, then on the version his answer goes to his draft's */
|
|
585
|
+
trailerNotes(id: string): LaneNote[] {
|
|
586
|
+
const sent = this.verdictsOn(id).map((v) => ({ id: v.id, rects: v.rects }))
|
|
587
|
+
return laneNotes(sent, id === this.target ? this.draft.rects : [])
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/** the notes the frame shows now: on the render on screen, on its frame while paused, around their time while it plays */
|
|
591
|
+
trailerNotesNow(id: string): LaneNote[] {
|
|
592
|
+
const tr = this.trailers.get(id)
|
|
593
|
+
if (!tr) return []
|
|
594
|
+
return notesNow(this.trailerNotes(id), { time: tr.clock.time, fps: tr.fps, paused: tr.clock.paused, side: tr.sideName })
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/** a note picked on the lane, the rail or the verdict: its render, its exact frame, paused; a draft's note box opens
|
|
598
|
+
* beside its rectangle */
|
|
599
|
+
selectNote(id: string, n: LaneNote): void {
|
|
600
|
+
this.noteSel = n.key
|
|
601
|
+
this.rect = n.draft
|
|
602
|
+
this.noteFocus = null
|
|
603
|
+
const tr = this.trailers.get(id)
|
|
604
|
+
if (!tr) return
|
|
605
|
+
if (n.side !== undefined && n.side !== tr.sideName) tr.showSide(n.side, n.shot ?? null)
|
|
606
|
+
else tr.clock.seek(n.t)
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/** a path of the repo hub's api as the page reaches it */
|
|
610
|
+
fileUrl(path: string): string {
|
|
611
|
+
return this.rv.url(path)
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/** the note under the pointer in the rail: its rectangle lit on the frame */
|
|
615
|
+
hoverNote(key: string | null): void {
|
|
616
|
+
this.noteHover = key
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/** the lane's markers of a version: the notes of the render on screen */
|
|
620
|
+
laneMarks(id: string): LaneMark[] {
|
|
621
|
+
const side = this.trailers.get(id)?.sideName
|
|
622
|
+
return this.trailerNotes(id)
|
|
623
|
+
.filter((n) => n.side === side)
|
|
624
|
+
.map((n) => ({ key: n.key, n: n.n, at: n.t, tone: n.draft === null ? 'sent' : 'draft', text: n.rect.comment, selected: this.noteSel === n.key, go: () => this.selectNote(id, n) }))
|
|
625
|
+
}
|
|
626
|
+
|
|
550
627
|
/** a rectangle picked: its view becomes the active one, and on a clip its frame shows, paused; `focus` (a click on it
|
|
551
628
|
* on the image) puts the cursor in its note box */
|
|
552
629
|
pickRect(i: number | null, focus = false): void {
|
|
@@ -554,9 +631,13 @@ export class ThreadSt {
|
|
|
554
631
|
this.noteFocus = focus ? i : null
|
|
555
632
|
if (i === null) return
|
|
556
633
|
const r = this.draft.rects[i]
|
|
634
|
+
if (r?.t !== undefined) this.noteSel = `d:${i}`
|
|
557
635
|
this.view = r?.view ?? 0
|
|
558
|
-
|
|
559
|
-
|
|
636
|
+
const clock = this.clockOf(this.target ?? '', this.view)
|
|
637
|
+
if (r?.t === undefined || !clock) return
|
|
638
|
+
// on a trailer card, a rectangle of the other render brings that render back on its shot first
|
|
639
|
+
if (clock.trailer && r.side !== undefined && r.side !== clock.trailer.sideName) clock.trailer.showSide(r.side, r.shot ?? null)
|
|
640
|
+
else clock.c.seek(r.t)
|
|
560
641
|
}
|
|
561
642
|
|
|
562
643
|
noteFocused(): void {
|
|
@@ -571,6 +652,7 @@ export class ThreadSt {
|
|
|
571
652
|
this.edit((d) => ({ ...d, rects: d.rects.filter((_, j) => j !== i) }))
|
|
572
653
|
this.rect = null
|
|
573
654
|
this.noteFocus = null
|
|
655
|
+
if (this.noteSel?.startsWith('d:')) this.noteSel = null
|
|
574
656
|
}
|
|
575
657
|
|
|
576
658
|
reactionOf(view: number, tile?: number): ReviewReaction | null {
|
|
@@ -724,6 +806,19 @@ export class ThreadSt {
|
|
|
724
806
|
return c
|
|
725
807
|
}
|
|
726
808
|
|
|
809
|
+
/** the clock a view's frames stand on, its rate, and on a trailer card the player that owns it: a clip's own, a trailer
|
|
810
|
+
* card's frame's; null on an image. A rectangle drawn on it keeps its time */
|
|
811
|
+
clockOf(id: string, view: number): { c: ClipSt; fps: number; trailer?: TrailerSt } | null {
|
|
812
|
+
const item = (this.cells.find((x) => x.kind === 'version' && x.id === id) as VersionCell | undefined)?.item
|
|
813
|
+
if (!item) return null
|
|
814
|
+
if (view === 0 && isTrailerCard(item)) {
|
|
815
|
+
const trailer = this.trailerOf(item)
|
|
816
|
+
return { c: trailer.clock, fps: trailer.fps, trailer }
|
|
817
|
+
}
|
|
818
|
+
const v = item.views[view]
|
|
819
|
+
return v && !isGallery(v) && v.clip ? { c: this.clipOf(id, view), fps: v.clip.fps } : null
|
|
820
|
+
}
|
|
821
|
+
|
|
727
822
|
/** the newest version's active view when it plays (a clip, or a sound on a row); empty when it shows images */
|
|
728
823
|
get clipKey(): string {
|
|
729
824
|
const h = this.head
|
|
@@ -787,37 +882,6 @@ export class ThreadSt {
|
|
|
787
882
|
}
|
|
788
883
|
}
|
|
789
884
|
|
|
790
|
-
openPost(): void {
|
|
791
|
-
this.postBox = ''
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
setPost(text: string): void {
|
|
795
|
-
this.postBox = text
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
closePost(): void {
|
|
799
|
-
this.postBox = null
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
/** « 📣 post »: this card deserves its own public post, his word the angle; an agent writes the draft */
|
|
803
|
-
async askPost(): Promise<void> {
|
|
804
|
-
const text = this.postBox
|
|
805
|
-
const card = this.data?.head
|
|
806
|
-
if (text === null || !card || this.busy) return
|
|
807
|
-
this.busy = true
|
|
808
|
-
this.error = null
|
|
809
|
-
try {
|
|
810
|
-
await postJson(this.rv.url(`/api/review/${card}/post`), { text })
|
|
811
|
-
runInAction(() => (this.postBox = null))
|
|
812
|
-
this.rv.say('post asked: an agent writes the draft')
|
|
813
|
-
await this.rv.answered()
|
|
814
|
-
} catch (e) {
|
|
815
|
-
runInAction(() => (this.error = (e as Error).message))
|
|
816
|
-
} finally {
|
|
817
|
-
runInAction(() => (this.busy = false))
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
|
|
821
885
|
/** ⌘Enter or « reply »: his word goes to the thread's head as a reply; his marks stay in the draft */
|
|
822
886
|
async sendReply(): Promise<void> {
|
|
823
887
|
const h = this.target
|
|
@@ -871,6 +935,9 @@ export class ThreadSt {
|
|
|
871
935
|
key(e: Pick<KeyboardEvent, 'key' | 'shiftKey'> & { code?: string }): boolean {
|
|
872
936
|
const h = this.head
|
|
873
937
|
if (h?.kind !== 'version') return false
|
|
938
|
+
// a trailer card's keys are the trailer entry's: Space, a frame, a shot, N a note, B its before
|
|
939
|
+
const tr = this.newest?.kind === 'version' && this.newest.item.trailer ? this.trailers.get(this.newest.item.id) : undefined
|
|
940
|
+
if (tr?.key(e)) return true
|
|
874
941
|
const rows = this.rows(h.item)
|
|
875
942
|
const choice = isChoice(h.item)
|
|
876
943
|
const digit = Number(/^Digit([1-9])$/.exec(e.code ?? '')?.[1] ?? (/^[1-9]$/.test(e.key) ? e.key : 0))
|