rvlib-shipkit 2.19.0 → 2.20.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 +16 -0
- package/package.json +1 -1
- package/src/annex/annex.ts +227 -0
- package/src/annex/offload.ts +279 -0
- 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_Home.ts +3 -2
- package/src/cli/cmd_Messages.ts +155 -0
- package/src/cli/cmd_Releases.ts +48 -0
- package/src/cli/cmd_Review.ts +161 -6
- package/src/cli/cmd_Shot.ts +4 -4
- package/src/cli/cmd_Social.ts +143 -6
- 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 +6 -1
- package/src/collections/collection-types.ts +8 -1
- package/src/collections/providers.ts +4 -1
- 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 +5 -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 +302 -5
- package/src/home/gui-app.ts +63 -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.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 +110 -8
- 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 +180 -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 +66 -0
- package/src/releases/collection.ts +36 -0
- package/src/releases/from-card.ts +66 -0
- package/src/releases/model.ts +267 -0
- package/src/releases/pictures.ts +89 -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/model.ts +92 -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 +36 -0
- package/src/review/trailer-card.ts +99 -0
- package/src/review/trailer-desk.ts +57 -4
- package/src/review/trailer-model.ts +41 -7
- package/src/review/trailer-notes.ts +45 -0
- package/src/review/trailer-routes.ts +22 -13
- package/src/serve/hub-app/app-bridge.ts +71 -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 +40 -1
- package/src/serve/hub-app/home-st.ts +11 -2
- package/src/serve/hub-app/home.html +3 -0
- package/src/serve/hub-app/hub-app.tsx +6 -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/releases/releases-page.tsx +94 -0
- package/src/serve/hub-app/releases/releases-st.ts +69 -0
- package/src/serve/hub-app/releases.css +25 -0
- package/src/serve/hub-app/repo-sections.ts +15 -1
- package/src/serve/hub-app/repo-st.ts +56 -5
- package/src/serve/hub-app/review/clip-st.ts +31 -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 +62 -31
- package/src/serve/hub-app/review/trailer-st.ts +138 -26
- package/src/serve/hub-app/review/trailer-timeline.tsx +39 -26
- package/src/serve/hub-app/review.css +49 -6
- package/src/serve/hub-app/social/comms-page.tsx +55 -23
- 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/post-card.tsx +10 -2
- package/src/serve/hub-app/social/social-model.ts +37 -3
- package/src/serve/hub-app/social/social-page.tsx +179 -65
- package/src/serve/hub-app/social/social-st.ts +79 -26
- 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 +60 -1
- package/src/serve/hub-app/tree-build.ts +38 -1
- package/src/serve/hub-app/tree-svc.ts +10 -3
- package/src/serve/project-gutter-route.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/shooter.ts +3 -3
- package/src/shot/shot-ask.ts +14 -3
- package/src/shot/shot.shipkit.ts +1 -1
- package/src/social/discord-layout.ts +48 -5
- 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 +92 -0
- package/src/social/load.ts +105 -9
- 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 +31 -5
- package/src/social/reach.ts +49 -0
- package/src/social/release-stage.ts +173 -0
- package/src/social/routes.ts +42 -7
- package/src/social/stage.ts +227 -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/build.ts +15 -2
- package/src/trailer/grammar.ts +14 -4
- package/src/trailer/public-words.ts +41 -0
|
@@ -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))
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// a trailer card's body (wiki tools/shipkit/review.md, A trailer): the trailer entry's player on the renders the card
|
|
2
|
+
// pinned, its before and after on one toggle that keeps the shot, the shots the change touched; the owner's notes by
|
|
3
|
+
// time: the timeline's lane, the rail of stills beside the player (under it when narrow), and on the frame only the
|
|
4
|
+
// notes on it. A note is a card's own rectangle, drafted and sent with the verdict as on an image
|
|
5
|
+
import { observer } from 'mobx-react-lite'
|
|
6
|
+
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
|
7
|
+
import { clock } from '../../../review/trailer-model.ts'
|
|
8
|
+
import type { LaneNote } from '../../../review/trailer-notes.ts'
|
|
9
|
+
import type { Item, TrailerCard } from '../../../review/model.ts'
|
|
10
|
+
import { AutoText } from '../auto-text.tsx'
|
|
11
|
+
import { keepFocus } from './kit.tsx'
|
|
12
|
+
import { HostedFrame, pct, type ShownNote, type Ver } from './review-views.tsx'
|
|
13
|
+
import { viewDom, type ThreadSt } from './thread-st.ts'
|
|
14
|
+
import { PlayerColumn } from './trailer-page.tsx'
|
|
15
|
+
import type { TrailerSt } from './trailer-st.ts'
|
|
16
|
+
|
|
17
|
+
type TrailerItem = Item & { trailer: TrailerCard }
|
|
18
|
+
|
|
19
|
+
export const TrailerCardBody = observer(({ ver, item }: { ver: Ver; item: TrailerItem }) => {
|
|
20
|
+
const { card } = ver
|
|
21
|
+
const tr = card.trailerOf(item)
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
tr.start()
|
|
24
|
+
return () => tr.stop()
|
|
25
|
+
}, [tr])
|
|
26
|
+
// only the notes on the frame show, numbered in the order of the cut; the picked one and the one under the pointer lit
|
|
27
|
+
const notes: ShownNote = (r) => {
|
|
28
|
+
const n = card.trailerNotesNow(item.id).find((x) => x.rect === r)
|
|
29
|
+
return n ? { n: n.n, lit: card.noteSel === n.key || card.noteHover === n.key } : null
|
|
30
|
+
}
|
|
31
|
+
// the rail beside the player when the card is wide, else right under the timeline, ahead of the shot cards
|
|
32
|
+
const box = useRef<HTMLDivElement>(null)
|
|
33
|
+
const [wide, setWide] = useState(false)
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const el = box.current
|
|
36
|
+
if (!el) return
|
|
37
|
+
const ro = new ResizeObserver(() => setWide(el.clientWidth >= RAIL_BESIDE))
|
|
38
|
+
ro.observe(el)
|
|
39
|
+
return () => ro.disconnect()
|
|
40
|
+
}, [])
|
|
41
|
+
const rail = <NotesRail card={card} item={item} live={ver.live || ver.claim} />
|
|
42
|
+
const host = (video: ReactNode, aspect: string) => <HostedFrame ver={ver} view={0} side={tr.sideName} aspect={aspect} face={video} notes={notes} />
|
|
43
|
+
return (
|
|
44
|
+
<div ref={box} className={`tr-card${wide ? ' wide' : ''}`} id={viewDom(item.id, 0)}>
|
|
45
|
+
<CardBar ver={ver} tr={tr} spec={item.trailer} />
|
|
46
|
+
{wide ? (
|
|
47
|
+
<div className="tr-cardgrid">
|
|
48
|
+
<PlayerColumn tr={tr} app={ver.rv.repo} host={host} />
|
|
49
|
+
{rail}
|
|
50
|
+
</div>
|
|
51
|
+
) : (
|
|
52
|
+
<PlayerColumn tr={tr} app={ver.rv.repo} host={host} under={rail} />
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
/** the card this wide or more holds its rail beside the player */
|
|
59
|
+
const RAIL_BESIDE = 1150
|
|
60
|
+
|
|
61
|
+
/** which render plays (B swaps them on the same shot), the shots the change touched, each a jump to its start; W the
|
|
62
|
+
* card wide, its rail beside the player */
|
|
63
|
+
const CardBar = observer(({ ver, tr, spec }: { ver: Ver; tr: TrailerSt; spec: TrailerCard }) => {
|
|
64
|
+
const shots = tr.timeline?.shots ?? []
|
|
65
|
+
return (
|
|
66
|
+
<div className="tr-cardbar">
|
|
67
|
+
<span className="tr-trailername">🎬 {spec.trailer}</span>
|
|
68
|
+
{spec.before ? (
|
|
69
|
+
<span className="seg" title="the two renders, on the same shot at the same time into it (B)">
|
|
70
|
+
<button className={tr.onBefore ? 'on' : ''} onMouseDown={keepFocus} onClick={() => tr.side(spec.before?.cut ?? '')}>before · {spec.before.cut}</button>
|
|
71
|
+
<button className={tr.onBefore ? '' : 'on'} onMouseDown={keepFocus} onClick={() => tr.side(spec.after.cut)}>after · {spec.after.cut}</button>
|
|
72
|
+
</span>
|
|
73
|
+
) : (
|
|
74
|
+
<b>{spec.after.cut}</b>
|
|
75
|
+
)}
|
|
76
|
+
{spec.shots.length > 0 ? (
|
|
77
|
+
<span className="tr-cardshots">
|
|
78
|
+
<span className="tr-dim">changed:</span>
|
|
79
|
+
{spec.shots.map((name) => {
|
|
80
|
+
const s = shots.find((x) => x.name === name)
|
|
81
|
+
return (
|
|
82
|
+
<button key={name} className={`tr-changed${tr.shot?.name === name ? ' on' : ''}`} disabled={!s} title={s ? `go to ${name}` : `${name} is not in this render`} onMouseDown={keepFocus} onClick={() => s && tr.seek(s.start)}>
|
|
83
|
+
{name}
|
|
84
|
+
</button>
|
|
85
|
+
)
|
|
86
|
+
})}
|
|
87
|
+
</span>
|
|
88
|
+
) : null}
|
|
89
|
+
<span className="sp" />
|
|
90
|
+
<span className="tr-dim tr-small">{ver.live || ver.claim ? `Space · , . a frame · drag on the frame: a note${spec.before ? ' · B before, after' : ''}` : 'an older version: its own render and the notes sent on it'}</span>
|
|
91
|
+
{ver.rv.phone.on ? null : (
|
|
92
|
+
<button className={ver.rv.wide ? 'on' : ''} title="the card takes the page, its notes beside the player (W)" onMouseDown={keepFocus} onClick={() => ver.rv.toggleWide()}>
|
|
93
|
+
{ver.rv.wide ? 'narrow' : 'wide'} (W)
|
|
94
|
+
</button>
|
|
95
|
+
)}
|
|
96
|
+
</div>
|
|
97
|
+
)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
/** the version's notes in the order of the cut: each its frame's still with its rectangle, its number, time, shot and
|
|
101
|
+
* words. A click lands on its frame; a draft's words are typed in the box beside its rectangle, or here */
|
|
102
|
+
const NotesRail = observer(({ card, item, live }: { card: ThreadSt; item: TrailerItem; live: boolean }) => {
|
|
103
|
+
const notes = card.trailerNotes(item.id)
|
|
104
|
+
const drafts = notes.filter((n) => n.draft !== null).length
|
|
105
|
+
const sent = notes.length - drafts
|
|
106
|
+
const said = [...(sent > 0 ? [`${sent} sent`] : []), ...(drafts > 0 ? [`${drafts} draft${drafts > 1 ? 's' : ''}, sent with your verdict`] : [])]
|
|
107
|
+
return (
|
|
108
|
+
<div className="tr-rail">
|
|
109
|
+
<div className="tr-railhead">
|
|
110
|
+
<b>Notes</b>
|
|
111
|
+
<span className="tr-dim tr-small">{said.length > 0 ? said.join(' · ') : 'in the order of the cut'}</span>
|
|
112
|
+
</div>
|
|
113
|
+
<div className="tr-railrows">
|
|
114
|
+
{notes.length === 0 ? <div className="rv-empty">{live ? 'Drag on the frame: a note with its rectangle, its words typed right beside it.' : 'No note on this version.'}</div> : null}
|
|
115
|
+
{notes.map((n) => <NoteRow key={n.key} card={card} item={item} n={n} />)}
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
const NoteRow = observer(({ card, item, n }: { card: ThreadSt; item: TrailerItem; n: LaneNote }) => {
|
|
122
|
+
const on = card.noteSel === n.key
|
|
123
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
124
|
+
// the picked row comes into the rail's own view; the page never scrolls away from the player for it
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
const row = ref.current
|
|
127
|
+
const rail = row?.closest('.tr-railrows')
|
|
128
|
+
if (!on || !row || !(rail instanceof HTMLElement)) return
|
|
129
|
+
const top = row.offsetTop - rail.offsetTop
|
|
130
|
+
if (top < rail.scrollTop || top + row.offsetHeight > rail.scrollTop + rail.clientHeight) rail.scrollTo({ top: top - 8, behavior: 'smooth' })
|
|
131
|
+
}, [on])
|
|
132
|
+
return (
|
|
133
|
+
<div ref={ref} className={`tr-row${on ? ' on' : ''}${n.draft !== null ? ' draft' : ''}`}
|
|
134
|
+
onMouseEnter={() => card.hoverNote(n.key)} onMouseLeave={() => card.hoverNote(null)}
|
|
135
|
+
onClick={(e) => {
|
|
136
|
+
if ((e.target as Element).closest('textarea, button')) return
|
|
137
|
+
card.selectNote(item.id, n)
|
|
138
|
+
// under the player when narrow: the player comes back in view on its frame
|
|
139
|
+
card.reveal(item.id, 0)
|
|
140
|
+
}}>
|
|
141
|
+
<NoteStill card={card} item={item} n={n} />
|
|
142
|
+
<div className="tr-rowbody">
|
|
143
|
+
<NoteMeta item={item} n={n} />
|
|
144
|
+
{n.draft !== null ? (
|
|
145
|
+
<div className="tr-rowwrite">
|
|
146
|
+
<AutoText rows={2} placeholder="what is wrong here, what you want instead · Enter keeps it" value={n.rect.comment}
|
|
147
|
+
onText={(t) => card.setRectComment(n.draft ?? 0, t)}
|
|
148
|
+
onKeyDown={(e) => {
|
|
149
|
+
if ((e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) || e.key === 'Escape') {
|
|
150
|
+
e.preventDefault()
|
|
151
|
+
e.currentTarget.blur()
|
|
152
|
+
}
|
|
153
|
+
}} />
|
|
154
|
+
<button className="ghost tr-rowx" title="drop this note" aria-label="drop this note" onMouseDown={keepFocus} onClick={() => card.removeRect(n.draft ?? 0)}>✕</button>
|
|
155
|
+
</div>
|
|
156
|
+
) : (
|
|
157
|
+
<div className="tr-rowtext">{n.rect.comment || <span className="tr-dim">(no words)</span>}</div>
|
|
158
|
+
)}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
)
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
/** a note's number, time, shot, the render it is on when the card has two, and « draft » */
|
|
165
|
+
export const NoteMeta = ({ item, n }: { item: TrailerItem; n: LaneNote }) => (
|
|
166
|
+
<div className="tr-rowmeta">
|
|
167
|
+
<span className={`tr-notenum${n.draft !== null ? ' draft' : ''}`}>{n.n}</span>
|
|
168
|
+
<b className="tr-mono">{clock(n.t)}</b>
|
|
169
|
+
{n.shot ? <span className="tr-dim">{n.shot.name} +{n.shot.time.toFixed(2)} s</span> : null}
|
|
170
|
+
{item.trailer.before && n.side ? <span className="tr-dim">· {n.side === 'before' ? item.trailer.before.cut : item.trailer.after.cut}</span> : null}
|
|
171
|
+
{n.draft !== null ? <span className="tr-drafttag">draft</span> : null}
|
|
172
|
+
</div>
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
/** the note's frame, cut from the render it was drawn on, with its rectangle */
|
|
176
|
+
export const NoteStill = observer(({ card, item, n }: { card: ThreadSt; item: TrailerItem; n: LaneNote }) => {
|
|
177
|
+
const spec = item.trailer
|
|
178
|
+
const pin = n.side === 'before' && spec.before ? spec.before : spec.after
|
|
179
|
+
const fps = card.trailerOf(item).fps
|
|
180
|
+
const [w, h] = spec.size ?? [16, 9]
|
|
181
|
+
const url = card.fileUrl(`/api/trailer/still/${spec.trailer}/${pin.cut}/${pin.render}/${Math.floor(n.t * fps + 1e-6)}.jpg`)
|
|
182
|
+
return (
|
|
183
|
+
<div className="tr-rowstill" style={{ aspectRatio: `${w} / ${h}`, backgroundImage: `url(${url})` }}>
|
|
184
|
+
<div className="tr-rowrect" style={pct(n.rect)} />
|
|
185
|
+
</div>
|
|
186
|
+
)
|
|
187
|
+
})
|