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
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
// a repo's trailer page as state (wiki tools/trailer/index.md, Frame notes): a cut's render on a clip clock, its montage as a
|
|
2
2
|
// timeline, the owner's notes on its frames. The render on screen is a kept version: a new render never swaps under
|
|
3
|
-
// him, the page offers it. The desk is read while the page shows, every 3 s
|
|
3
|
+
// him, the page offers it. The desk is read while the page shows, every 3 s. The same state plays a trailer card's body
|
|
4
|
+
// (wiki tools/shipkit/review.md, A trailer): its renders pinned, its before and after on one clock, the card's own
|
|
5
|
+
// rectangles drawn on its frame (thread-st.ts clockOf)
|
|
4
6
|
import { makeAutoObservable, observableRef, reaction, runInAction } from 'mobx'
|
|
7
|
+
import type { Side, TrailerCard } from '../../../review/model.ts'
|
|
5
8
|
import {
|
|
6
9
|
noteTime,
|
|
7
10
|
shotAt,
|
|
8
11
|
type CaptionSpan,
|
|
9
12
|
type CutInfo,
|
|
10
|
-
type
|
|
13
|
+
type LaneMark,
|
|
14
|
+
type NoteMark,
|
|
11
15
|
type NoteState,
|
|
16
|
+
type PinnedRender,
|
|
12
17
|
type SectionSpan,
|
|
13
18
|
type ShotSpan,
|
|
14
19
|
type Timeline,
|
|
15
20
|
type TrailerDesk,
|
|
16
21
|
type TrailerInfo,
|
|
17
22
|
type TrailerNote,
|
|
23
|
+
type VoicesDesk,
|
|
18
24
|
} from '../../../review/trailer-model.ts'
|
|
19
25
|
import { reach } from '../reach.ts'
|
|
20
26
|
import type { RepoSt } from '../repo-st.ts'
|
|
21
27
|
import { ClipSt } from './clip-st.ts'
|
|
28
|
+
import { VoicesSt } from './trailer-voices-st.ts'
|
|
29
|
+
import { LIT_S } from '../../../review/trailer-notes.ts'
|
|
30
|
+
import type { CutStates } from '../../../trailer/shot-state.ts'
|
|
22
31
|
|
|
23
32
|
const POLL_MS = 3000
|
|
24
33
|
|
|
@@ -36,7 +45,7 @@ interface Shown {
|
|
|
36
45
|
interface NoteDraft {
|
|
37
46
|
time: number
|
|
38
47
|
text: string
|
|
39
|
-
|
|
48
|
+
mark: NoteMark | null
|
|
40
49
|
}
|
|
41
50
|
|
|
42
51
|
/** a note placed on the cut on screen: `at` its time there, null when its shot is not in it */
|
|
@@ -45,10 +54,24 @@ export interface PlacedNote {
|
|
|
45
54
|
at: number | null
|
|
46
55
|
/** it was written on this cut and its shot has moved since */
|
|
47
56
|
moved: boolean
|
|
57
|
+
/** its number in the order of the cut on screen, the lane's and the frame's label */
|
|
58
|
+
n: number
|
|
48
59
|
}
|
|
49
60
|
|
|
50
61
|
type NoteFilter = 'open' | 'all'
|
|
51
62
|
|
|
63
|
+
/** the whole cut with his takes (the standin where he made none), or with the standin on every line */
|
|
64
|
+
export type VoiceSide = 'takes' | 'standin'
|
|
65
|
+
|
|
66
|
+
/** who reads a working cut's lines of his voice, for the render on screen (`at`) */
|
|
67
|
+
export interface OwnVoice {
|
|
68
|
+
at: string
|
|
69
|
+
who: string
|
|
70
|
+
standin: string
|
|
71
|
+
/** the brand plays his takes */
|
|
72
|
+
takes: boolean
|
|
73
|
+
}
|
|
74
|
+
|
|
52
75
|
const ZOOMS = [1, 1.5, 2, 3, 4, 6, 8, 12, 16] as const
|
|
53
76
|
|
|
54
77
|
/** the caption's text as the title draws it: `\n` in the file is a line break */
|
|
@@ -69,6 +92,11 @@ async function send<T>(url: string, method: string, body?: unknown): Promise<T>
|
|
|
69
92
|
return JSON.parse(text) as T
|
|
70
93
|
}
|
|
71
94
|
|
|
95
|
+
/** the cut a page opens on when none is named: the working cut (never a kept version) whose file or render changed
|
|
96
|
+
* last, so the cut being worked on, never the first by name */
|
|
97
|
+
export const latestCut = (cuts: readonly CutInfo[]): CutInfo | null =>
|
|
98
|
+
cuts.filter((c) => !c.version && c.video !== null).reduce<CutInfo | null>((best, c) => (best === null || c.fileMtime > best.fileMtime ? c : best), null)
|
|
99
|
+
|
|
72
100
|
export class TrailerSt {
|
|
73
101
|
desk: TrailerDesk | null = null
|
|
74
102
|
deskError: string | null = null
|
|
@@ -88,24 +116,51 @@ export class TrailerSt {
|
|
|
88
116
|
/** the montage page of the cut on screen, its markdown, once asked */
|
|
89
117
|
montage: { key: string; md: string | null } | null = null
|
|
90
118
|
montageOpen = false
|
|
119
|
+
/** the voice side he picked; null: the brand's */
|
|
120
|
+
voiceSide: VoiceSide | null = null
|
|
121
|
+
/** the cut on screen's lines of his voice; null while unknown or when it has none */
|
|
122
|
+
own: OwnVoice | null = null
|
|
123
|
+
/** the side asked for the render on screen: its file's key once made, or why it is refused */
|
|
124
|
+
voiced: { id: string; key: string | null; error: string | null } | null = null
|
|
125
|
+
/** the last side made for a render, on screen while the next is made */
|
|
126
|
+
private lastVoiced: { at: string; key: string } | null = null
|
|
127
|
+
/** a play asked while the side was being made: it plays once it is */
|
|
128
|
+
private held = false
|
|
91
129
|
private landing: { shot: string; offset: number; play: boolean } | null = null
|
|
92
130
|
private noteLanding: string | null = null
|
|
93
131
|
private timer: ReturnType<typeof setInterval> | null = null
|
|
94
132
|
private readonly prefs: string
|
|
95
|
-
|
|
96
|
-
|
|
133
|
+
/** the Voices view: the lines of the trailer, his takes, his microphone */
|
|
134
|
+
readonly voices: VoicesSt
|
|
135
|
+
|
|
136
|
+
constructor(
|
|
137
|
+
private readonly st: RepoSt,
|
|
138
|
+
/** a trailer card's body: the card, what it plays, its notes as the lane's markers; null on the trailer page */
|
|
139
|
+
readonly card: { id: string; spec: TrailerCard; lane: () => LaneMark[] } | null = null,
|
|
140
|
+
) {
|
|
97
141
|
this.prefs = `shipkit.trailer.${st.key}`
|
|
142
|
+
this.voices = new VoicesSt(st, () => this.trailer?.id ?? null)
|
|
143
|
+
if (card) {
|
|
144
|
+
this.trailerId = card.spec.trailer
|
|
145
|
+
this.cutId = card.spec.after.cut
|
|
146
|
+
}
|
|
98
147
|
try {
|
|
99
|
-
const p = JSON.parse(localStorage.getItem(this.prefs) ?? '{}') as { zoom?: number; filter?: NoteFilter; rate?: number }
|
|
148
|
+
const p = JSON.parse(localStorage.getItem(this.prefs) ?? '{}') as { zoom?: number; filter?: NoteFilter; rate?: number; voice?: VoiceSide }
|
|
100
149
|
if (p.zoom && ZOOMS.includes(p.zoom as never)) this.zoom = p.zoom
|
|
101
150
|
if (p.filter === 'open' || p.filter === 'all') this.filter = p.filter
|
|
102
151
|
if (p.rate) this.clock.setRate(p.rate)
|
|
152
|
+
if (p.voice === 'takes' || p.voice === 'standin') this.voiceSide = p.voice
|
|
103
153
|
} catch {
|
|
104
154
|
// a blocked storage only loses the kept choices
|
|
105
155
|
}
|
|
106
|
-
makeAutoObservable<this, 'st' | 'landing' | 'timer' | 'prefs' | 'noteLanding'>(this, { st: false, clock: false, shown: observableRef, landing: false, timer: false, prefs: false, noteLanding: false })
|
|
156
|
+
makeAutoObservable<this, 'st' | 'landing' | 'timer' | 'prefs' | 'noteLanding' | 'held'>(this, { st: false, card: false, clock: false, voices: false, shown: observableRef, landing: false, timer: false, prefs: false, noteLanding: false, held: false })
|
|
107
157
|
// a trailer is heard: the clock starts with its sound on
|
|
108
158
|
this.clock.hear(true)
|
|
159
|
+
// a card plays its pinned render from the start; no address is its own
|
|
160
|
+
if (card) {
|
|
161
|
+
void this.showPinned()
|
|
162
|
+
return
|
|
163
|
+
}
|
|
109
164
|
// the first answer, or a cut picked: the render on screen follows
|
|
110
165
|
reaction(
|
|
111
166
|
() => [this.cut?.video?.mtime ?? null, this.trailer?.id ?? null, this.cut?.cut ?? null] as const,
|
|
@@ -126,8 +181,32 @@ export class TrailerSt {
|
|
|
126
181
|
() => [this.shown?.version ?? null, this.notes.length] as const,
|
|
127
182
|
() => this.landOnNote(),
|
|
128
183
|
)
|
|
184
|
+
// the render on screen, or the page back from Voices (a take recorded, edited): who reads its lines, read again
|
|
185
|
+
reaction(
|
|
186
|
+
() => [this.shownAt, this.voices.on] as const,
|
|
187
|
+
([, voicesOn]) => void (voicesOn ? undefined : this.readOwn()),
|
|
188
|
+
{ fireImmediately: true },
|
|
189
|
+
)
|
|
190
|
+
// a side flipped, or known at last: its file asked for
|
|
129
191
|
reaction(
|
|
130
|
-
() =>
|
|
192
|
+
() => this.voicedId,
|
|
193
|
+
() => void this.askVoiced(),
|
|
194
|
+
)
|
|
195
|
+
// nothing of the other side plays: a play while the side is made or refused waits, and plays once it is made
|
|
196
|
+
reaction(
|
|
197
|
+
() => [this.voicing, this.voiceError !== null, this.clock.paused] as const,
|
|
198
|
+
([making, refused, paused]) => {
|
|
199
|
+
if ((making || refused) && !paused) {
|
|
200
|
+
this.held = making
|
|
201
|
+
this.clock.pause()
|
|
202
|
+
} else if (!making && !refused && this.held) {
|
|
203
|
+
this.held = false
|
|
204
|
+
if (paused) this.clock.play()
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
)
|
|
208
|
+
reaction(
|
|
209
|
+
() => JSON.stringify({ zoom: this.zoom, filter: this.filter, rate: this.clock.rate, ...(this.voiceSide ? { voice: this.voiceSide } : {}) }),
|
|
131
210
|
(s) => {
|
|
132
211
|
try {
|
|
133
212
|
localStorage.setItem(this.prefs, s)
|
|
@@ -147,9 +226,11 @@ export class TrailerSt {
|
|
|
147
226
|
if (this.timer !== null) clearInterval(this.timer)
|
|
148
227
|
this.timer = null
|
|
149
228
|
if (!this.clock.paused) this.clock.pause()
|
|
229
|
+
void this.voices.cancel()
|
|
150
230
|
}
|
|
151
231
|
|
|
152
232
|
async refresh(): Promise<void> {
|
|
233
|
+
if (!this.card) void this.voices.refresh()
|
|
153
234
|
try {
|
|
154
235
|
const desk = await send<TrailerDesk>(this.st.url('/api/trailer'), 'GET')
|
|
155
236
|
runInAction(() => {
|
|
@@ -171,18 +252,34 @@ export class TrailerSt {
|
|
|
171
252
|
|
|
172
253
|
get cut(): CutInfo | null {
|
|
173
254
|
const cuts = this.trailer?.cuts ?? []
|
|
174
|
-
return cuts.find((c) => c.cut === this.cutId) ?? cuts.find((c) => c.video !== null) ?? cuts[0] ?? null
|
|
255
|
+
return cuts.find((c) => c.cut === this.cutId) ?? latestCut(cuts) ?? cuts.find((c) => c.video !== null) ?? cuts[0] ?? null
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** each shot of the cut on screen in plain words, and the summary (trailer/shot-state.ts); none on a card, whose
|
|
259
|
+
* renders are pinned history */
|
|
260
|
+
get shotStates(): CutStates | null {
|
|
261
|
+
const c = this.cut
|
|
262
|
+
return this.card || !c || this.shown?.cut !== c.cut ? null : c.shots
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** a card a shot waits on, opened in the review page */
|
|
266
|
+
openCard(id: string): void {
|
|
267
|
+
this.st.showReview(id)
|
|
175
268
|
}
|
|
176
269
|
|
|
177
270
|
/** a finished render newer than the one on screen */
|
|
178
271
|
get newer(): boolean {
|
|
179
272
|
const v = this.cut?.video
|
|
180
|
-
return !!v && !!this.shown && this.shown.cut === this.cut?.cut && v.mtime !== this.shown.version
|
|
273
|
+
return !this.card && !!v && !!this.shown && this.shown.cut === this.cut?.cut && v.mtime !== this.shown.version
|
|
181
274
|
}
|
|
182
275
|
|
|
183
276
|
/** the cut the address names, the note open on it (the player lands on its frame), the notes filter; an address
|
|
184
277
|
* with no filter keeps the one the page remembers */
|
|
185
|
-
select(trailer: string | null, cut: string | null, note: string | null = null, filter: NoteFilter | null = null): void {
|
|
278
|
+
select(trailer: string | null, cut: string | null, note: string | null = null, filter: NoteFilter | null = null, voices?: string): void {
|
|
279
|
+
// the Voices view rides on the address: '' is the view on its first line
|
|
280
|
+
if (voices === undefined) {
|
|
281
|
+
if (this.voices.on) this.voices.show(false)
|
|
282
|
+
} else this.voices.open(voices || null)
|
|
186
283
|
if (cut !== this.cutId || trailer !== this.trailerId) {
|
|
187
284
|
this.draft = null
|
|
188
285
|
this.editing = null
|
|
@@ -198,8 +295,9 @@ export class TrailerSt {
|
|
|
198
295
|
}
|
|
199
296
|
|
|
200
297
|
/** what the address carries of this page; RepoSt.setSel writes it, the one place an address is written */
|
|
201
|
-
get address(): { t: 'trailer'; trailer: string | null; cut: string | null; note: string | null; filter: NoteFilter | null } {
|
|
202
|
-
|
|
298
|
+
get address(): { t: 'trailer'; trailer: string | null; cut: string | null; note: string | null; filter: NoteFilter | null; voices?: string } {
|
|
299
|
+
const v = this.voices
|
|
300
|
+
return { t: 'trailer', trailer: this.trailerId, cut: this.cutId, note: this.selected, filter: this.filter === 'all' ? null : this.filter, ...(v.on ? { voices: v.openKey ?? '' } : {}) }
|
|
203
301
|
}
|
|
204
302
|
|
|
205
303
|
/** the note an address opened: the player lands on its frame once the cut on screen places it */
|
|
@@ -214,7 +312,13 @@ export class TrailerSt {
|
|
|
214
312
|
|
|
215
313
|
/** a trailer or a cut picked on the page: its address follows */
|
|
216
314
|
pick(trailer: string, cut: string | null): void {
|
|
217
|
-
|
|
315
|
+
if (this.card) {
|
|
316
|
+
if (cut !== null) this.side(cut)
|
|
317
|
+
return
|
|
318
|
+
}
|
|
319
|
+
// a cut picked plays it; a trailer picked keeps the view on screen
|
|
320
|
+
const voices = cut === null && this.voices.on ? '' : undefined
|
|
321
|
+
this.st.showTrailer(trailer, cut, trailer === this.trailerId ? this.selected : null, this.filter === 'all' ? null : this.filter, voices)
|
|
218
322
|
}
|
|
219
323
|
|
|
220
324
|
showCurrent(): void {
|
|
@@ -233,6 +337,77 @@ export class TrailerSt {
|
|
|
233
337
|
if (land?.play) this.clock.play()
|
|
234
338
|
}
|
|
235
339
|
|
|
340
|
+
// ── a trailer card ──
|
|
341
|
+
|
|
342
|
+
/** the card's cut on screen: its after, or its before */
|
|
343
|
+
get onBefore(): boolean {
|
|
344
|
+
return this.card?.spec.before !== undefined && this.cutId === this.card.spec.before.cut
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** the shots the card's change touched */
|
|
348
|
+
get changed(): ReadonlySet<string> {
|
|
349
|
+
return new Set(this.card?.spec.shots ?? [])
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/** the card's other render, on the shot and the time into it he was on, playing if it played */
|
|
353
|
+
side(cut: string): void {
|
|
354
|
+
const spec = this.card?.spec
|
|
355
|
+
if (!spec || cut === this.cutId || (cut !== spec.after.cut && cut !== spec.before?.cut)) return
|
|
356
|
+
const s = this.shot
|
|
357
|
+
if (s && !this.landing) this.landing = { shot: s.name, offset: this.time - s.start, play: !this.clock.paused }
|
|
358
|
+
if (!this.clock.paused) this.clock.pause()
|
|
359
|
+
this.cutId = cut
|
|
360
|
+
this.draft = null
|
|
361
|
+
void this.showPinned()
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
toggleSide(): void {
|
|
365
|
+
const spec = this.card?.spec
|
|
366
|
+
if (spec?.before) this.side(this.onBefore ? spec.after.cut : spec.before.cut)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** the render on screen as a rectangle names it: `before` or `after` on a card with a before, else none */
|
|
370
|
+
get sideName(): Side | undefined {
|
|
371
|
+
return this.card?.spec.before ? (this.onBefore ? 'before' : 'after') : undefined
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** that render, landed on a shot and the seconds into it (a rectangle picked), paused */
|
|
375
|
+
showSide(side: Side, shot: { name: string; time: number } | null): void {
|
|
376
|
+
const spec = this.card?.spec
|
|
377
|
+
const cut = side === 'before' ? spec?.before?.cut : spec?.after.cut
|
|
378
|
+
if (!cut) return
|
|
379
|
+
if (shot) this.landing = { shot: shot.name, offset: shot.time, play: false }
|
|
380
|
+
this.side(cut)
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** where a rectangle drawn now sits: the shot on screen and the seconds into it */
|
|
384
|
+
get anchor(): { name: string; time: number } | null {
|
|
385
|
+
const s = this.shot
|
|
386
|
+
return s ? { name: s.name, time: Math.round((this.time - s.start) * 1000) / 1000 } : null
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** the render the card pinned for the cut on screen, whatever render the cut has now */
|
|
390
|
+
private async showPinned(): Promise<void> {
|
|
391
|
+
const spec = this.card?.spec
|
|
392
|
+
if (!spec) return
|
|
393
|
+
const pin = this.onBefore && spec.before ? spec.before : spec.after
|
|
394
|
+
try {
|
|
395
|
+
const r = await send<PinnedRender>(this.st.url(`/api/trailer/render/${spec.trailer}/${pin.cut}/${pin.render}`), 'GET')
|
|
396
|
+
runInAction(() => {
|
|
397
|
+
if (this.cutId !== pin.cut) return
|
|
398
|
+
this.shown = { trailer: spec.trailer, cut: pin.cut, version: pin.render, duration: r.duration, fps: r.fps, timeline: r.timeline, strip: r.strip }
|
|
399
|
+
this.clock.load(`trailer:${spec.trailer}/${pin.cut}/${pin.render}`, r.duration, r.fps)
|
|
400
|
+
const land = this.landing
|
|
401
|
+
this.landing = null
|
|
402
|
+
const s = land ? r.timeline.shots.find((x) => x.name === land.shot) : undefined
|
|
403
|
+
this.clock.seek(s && land ? s.start + Math.min(land.offset, s.length) : 0)
|
|
404
|
+
if (land?.play) this.clock.play()
|
|
405
|
+
})
|
|
406
|
+
} catch (e) {
|
|
407
|
+
runInAction(() => (this.error = (e as Error).message))
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
236
411
|
/** the new render, on the shot and the time into it he was on */
|
|
237
412
|
loadNewer(): void {
|
|
238
413
|
const s = this.shot
|
|
@@ -241,9 +416,94 @@ export class TrailerSt {
|
|
|
241
416
|
this.showCurrent()
|
|
242
417
|
}
|
|
243
418
|
|
|
419
|
+
/** the render on screen, the cut with the side he hears once it is made (its picture is the render's) */
|
|
244
420
|
get videoUrl(): string | null {
|
|
245
421
|
const s = this.shown
|
|
246
|
-
|
|
422
|
+
if (!s) return null
|
|
423
|
+
// a side being made keeps the last side's file on screen, paused: the same picture, no reload
|
|
424
|
+
const v = this.voiced
|
|
425
|
+
const key = v && v.id === this.voicedId && v.key ? v.key : this.lastVoiced?.at === this.shownAt ? this.lastVoiced.key : null
|
|
426
|
+
return key ? this.st.url(`/api/trailer/voiced/${key}.mp4`) : this.st.url(`/api/trailer/video/${s.trailer}/${s.cut}/${s.version}.mp4`)
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// ── his voice or the standin's (wiki tools/trailer/trailer-sound.md, Your own voice) ──
|
|
430
|
+
|
|
431
|
+
private get shownAt(): string | null {
|
|
432
|
+
const s = this.shown
|
|
433
|
+
return s && !this.card ? `${s.trailer}/${s.cut}/${s.version}` : null
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/** the lines of his voice of the render on screen; null when it has none */
|
|
437
|
+
get ownHere(): OwnVoice | null {
|
|
438
|
+
return this.own && this.own.at === this.shownAt ? this.own : null
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** the side heard: his pick, else the brand's; null when the cut has no line of his voice */
|
|
442
|
+
get heard(): VoiceSide | null {
|
|
443
|
+
const o = this.ownHere
|
|
444
|
+
return o ? (this.voiceSide ?? (o.takes ? 'takes' : 'standin')) : null
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
private get voicedId(): string | null {
|
|
448
|
+
const at = this.shownAt
|
|
449
|
+
return at && this.heard ? `${at}/${this.heard}` : null
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** the side heard is still being made */
|
|
453
|
+
get voicing(): boolean {
|
|
454
|
+
const id = this.voicedId
|
|
455
|
+
return id !== null && (this.voiced?.id !== id || (this.voiced.key === null && this.voiced.error === null))
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/** why the side heard cannot play */
|
|
459
|
+
get voiceError(): string | null {
|
|
460
|
+
return this.voiced && this.voiced.id === this.voicedId ? this.voiced.error : null
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
setVoice(side: VoiceSide): void {
|
|
464
|
+
this.voiceSide = side
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** who reads the cut on screen's lines: the trailer's Voices, its uses on this cut */
|
|
468
|
+
private async readOwn(): Promise<void> {
|
|
469
|
+
const at = this.shownAt
|
|
470
|
+
const s = this.shown
|
|
471
|
+
const cut = this.cut
|
|
472
|
+
if (!at || !s || cut?.cut !== s.cut || cut.version || !cut.files.trailer) {
|
|
473
|
+
this.own = null
|
|
474
|
+
return
|
|
475
|
+
}
|
|
476
|
+
try {
|
|
477
|
+
const d = await send<VoicesDesk>(this.st.url(`/api/trailer/voices/${s.trailer}`), 'GET')
|
|
478
|
+
const use = d.lines.flatMap((l) => l.uses).find((u) => u.cut === s.cut && u.mine)
|
|
479
|
+
const had = this.voiced?.id ?? null
|
|
480
|
+
runInAction(() => {
|
|
481
|
+
this.own = use && d.recorder ? { at, who: d.recorder.who, standin: use.standin?.name ?? "the brand's voice", takes: d.recorder.takes } : null
|
|
482
|
+
})
|
|
483
|
+
// back from Voices: the same side asked again, a take made since changes its file
|
|
484
|
+
if (had !== null && had === this.voicedId) void this.askVoiced()
|
|
485
|
+
} catch (e) {
|
|
486
|
+
runInAction(() => (this.error = `voices: ${(e as Error).message}`))
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/** the side heard, made on the hub when it is not yet; the file on screen stays until the new one is made */
|
|
491
|
+
private async askVoiced(): Promise<void> {
|
|
492
|
+
const id = this.voicedId
|
|
493
|
+
if (!id) return
|
|
494
|
+
const was = this.voiced
|
|
495
|
+
if (was?.key && this.shownAt) this.lastVoiced = { at: this.shownAt, key: was.key }
|
|
496
|
+
if (was?.id !== id) this.voiced = { id, key: null, error: null }
|
|
497
|
+
try {
|
|
498
|
+
const r = await send<{ key: string }>(this.st.url(`/api/trailer/voiced/${id}`), 'GET')
|
|
499
|
+
runInAction(() => {
|
|
500
|
+
if (this.voiced?.id === id) this.voiced = { id, key: r.key, error: null }
|
|
501
|
+
})
|
|
502
|
+
} catch (e) {
|
|
503
|
+
runInAction(() => {
|
|
504
|
+
if (this.voiced?.id === id) this.voiced = { id, key: null, error: (e as Error).message }
|
|
505
|
+
})
|
|
506
|
+
}
|
|
247
507
|
}
|
|
248
508
|
|
|
249
509
|
get stripUrl(): string | null {
|
|
@@ -318,8 +578,9 @@ export class TrailerSt {
|
|
|
318
578
|
|
|
319
579
|
// ── the notes ──
|
|
320
580
|
|
|
581
|
+
/** the trailer's frame notes; none on a card, whose rectangles are its own verdict's */
|
|
321
582
|
get notes(): TrailerNote[] {
|
|
322
|
-
return this.trailer?.notes ?? []
|
|
583
|
+
return this.card ? [] : (this.trailer?.notes ?? [])
|
|
323
584
|
}
|
|
324
585
|
|
|
325
586
|
get openCount(): number {
|
|
@@ -341,6 +602,13 @@ export class TrailerSt {
|
|
|
341
602
|
return { note: n, at, moved: at !== null && n.cut === this.shown?.cut && Math.abs(at - n.time) > 0.5 / this.fps }
|
|
342
603
|
})
|
|
343
604
|
.sort((a, b) => (a.at ?? Infinity) - (b.at ?? Infinity) || a.note.n - b.note.n)
|
|
605
|
+
.map((p, i) => ({ ...p, n: i + 1 }))
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/** the timeline's notes lane: a card's notes, else this page's frame notes on the cut on screen */
|
|
609
|
+
get lane(): LaneMark[] {
|
|
610
|
+
if (this.card) return this.card.lane()
|
|
611
|
+
return this.here.map((p) => ({ key: p.note.id, n: p.n, at: p.at ?? 0, tone: p.note.state, text: p.note.text, selected: this.selected === p.note.id, go: () => this.goTo(p) }))
|
|
344
612
|
}
|
|
345
613
|
|
|
346
614
|
get here(): PlacedNote[] {
|
|
@@ -351,10 +619,10 @@ export class TrailerSt {
|
|
|
351
619
|
return this.placed.filter((p) => p.at === null)
|
|
352
620
|
}
|
|
353
621
|
|
|
354
|
-
/** the notes whose
|
|
355
|
-
get
|
|
356
|
-
const near = this.clock.paused ? 0.5 / this.fps + 1e-6 :
|
|
357
|
-
return this.here.filter((p) => p.note.
|
|
622
|
+
/** the notes whose mark shows over the frame: on this frame while paused, around their time while it plays */
|
|
623
|
+
get marksNow(): PlacedNote[] {
|
|
624
|
+
const near = this.clock.paused ? 0.5 / this.fps + 1e-6 : LIT_S
|
|
625
|
+
return this.here.filter((p) => p.note.mark && p.at !== null && Math.abs(p.at - this.time) <= near)
|
|
358
626
|
}
|
|
359
627
|
|
|
360
628
|
setFilter(f: NoteFilter): void {
|
|
@@ -416,36 +684,38 @@ export class TrailerSt {
|
|
|
416
684
|
// ── writing ──
|
|
417
685
|
|
|
418
686
|
/** N, or a click on the frame: a note on the frame on screen, paused there */
|
|
419
|
-
newNote(
|
|
687
|
+
newNote(mark: NoteMark | null = null): void {
|
|
420
688
|
if (!this.shown) return
|
|
421
689
|
if (!this.clock.paused) this.clock.pause()
|
|
422
690
|
this.editing = null
|
|
423
691
|
this.closing = null
|
|
424
|
-
this.draft = { time: this.clock.time, text: this.draft?.text ?? '',
|
|
692
|
+
this.draft = { time: this.clock.time, text: this.draft?.text ?? '', mark: mark ?? this.draft?.mark ?? null }
|
|
425
693
|
}
|
|
426
694
|
|
|
427
|
-
/** a
|
|
428
|
-
|
|
695
|
+
/** a drag on the frame (`mark`), or a click (null): the rectangle of the note being edited on this frame, else of the
|
|
696
|
+
* draft, else a new note; a click opens a note on the frame when none is open */
|
|
697
|
+
drawFrame(mark: NoteMark | null): void {
|
|
429
698
|
const e = this.editing ? this.here.find((p) => p.note.id === this.editing?.id) : undefined
|
|
430
699
|
if (e && e.at !== null && Math.abs(e.at - this.time) <= 0.5 / this.fps + 1e-6) {
|
|
431
|
-
void this.edit(e.note.id, {
|
|
700
|
+
if (mark) void this.edit(e.note.id, { mark })
|
|
432
701
|
return
|
|
433
702
|
}
|
|
434
703
|
if (this.draft) {
|
|
435
|
-
|
|
704
|
+
if (!mark) return
|
|
705
|
+
this.draft.mark = mark
|
|
436
706
|
if (!this.clock.paused) this.clock.pause()
|
|
437
707
|
this.draft.time = this.clock.time
|
|
438
708
|
return
|
|
439
709
|
}
|
|
440
|
-
this.newNote(
|
|
710
|
+
this.newNote(mark)
|
|
441
711
|
}
|
|
442
712
|
|
|
443
713
|
setDraftText(t: string): void {
|
|
444
714
|
if (this.draft) this.draft.text = t
|
|
445
715
|
}
|
|
446
716
|
|
|
447
|
-
|
|
448
|
-
if (this.draft) this.draft.
|
|
717
|
+
unmarkDraft(): void {
|
|
718
|
+
if (this.draft) this.draft.mark = null
|
|
449
719
|
}
|
|
450
720
|
|
|
451
721
|
cancelDraft(): void {
|
|
@@ -465,7 +735,7 @@ export class TrailerSt {
|
|
|
465
735
|
version: s.version,
|
|
466
736
|
time: d.time,
|
|
467
737
|
text: d.text,
|
|
468
|
-
...(d.
|
|
738
|
+
...(d.mark ? { mark: d.mark } : {}),
|
|
469
739
|
})
|
|
470
740
|
runInAction(() => {
|
|
471
741
|
this.draft = null
|
|
@@ -530,11 +800,11 @@ export class TrailerSt {
|
|
|
530
800
|
await this.edit(n.id, { state: 'open' })
|
|
531
801
|
}
|
|
532
802
|
|
|
533
|
-
async
|
|
534
|
-
await this.edit(n.id, {
|
|
803
|
+
async unmark(n: TrailerNote): Promise<void> {
|
|
804
|
+
await this.edit(n.id, { mark: null })
|
|
535
805
|
}
|
|
536
806
|
|
|
537
|
-
async edit(id: string, body: { text?: string;
|
|
807
|
+
async edit(id: string, body: { text?: string; mark?: NoteMark | null; state?: NoteState; reply?: string }): Promise<void> {
|
|
538
808
|
const t = this.trailer
|
|
539
809
|
if (!t) return
|
|
540
810
|
this.error = null
|
|
@@ -578,6 +848,7 @@ export class TrailerSt {
|
|
|
578
848
|
* note), N a note on this frame, M the sound, - and + the timeline's zoom, Home the start. Arrows and plain keys,
|
|
579
849
|
* so an AZERTY keyboard reaches every one */
|
|
580
850
|
key(e: Pick<KeyboardEvent, 'key' | 'shiftKey'>): boolean {
|
|
851
|
+
if (this.voices.on) return this.voices.key(e)
|
|
581
852
|
const k = e.key.toLowerCase()
|
|
582
853
|
if (e.key === ' ') {
|
|
583
854
|
// a focused button would click again on the key's release
|
|
@@ -590,11 +861,12 @@ export class TrailerSt {
|
|
|
590
861
|
const d = e.key === 'ArrowDown' ? 1 : -1
|
|
591
862
|
if (e.shiftKey) this.noteBy(d)
|
|
592
863
|
else this.shotBy(d)
|
|
593
|
-
} else if (k === 'n') this.newNote()
|
|
864
|
+
} else if (k === 'n' && !this.card) this.newNote()
|
|
594
865
|
else if (k === 'm') this.clock.toggleSound()
|
|
595
866
|
else if (e.key === '-') this.zoomBy(-1)
|
|
596
867
|
else if (e.key === '+' || e.key === '=') this.zoomBy(1)
|
|
597
868
|
else if (e.key === 'Home') this.seek(0)
|
|
869
|
+
else if (k === 'b' && this.card?.spec.before) this.toggleSide()
|
|
598
870
|
else if (e.key === 'Escape' && this.draft) this.cancelDraft()
|
|
599
871
|
else return false
|
|
600
872
|
return true
|