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
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
// a repo's trailer page (`#page:trailer`, wiki tools/trailer/index.md, Frame notes): the cuts on the left, the player over
|
|
2
|
-
// its timeline and its shot cards in the middle, the notes on the right. A note
|
|
2
|
+
// its timeline and its shot cards in the middle, the notes on the right. A note marks a frame of the render on screen
|
|
3
3
|
// and becomes an item of the review store. On a phone the three stacked
|
|
4
4
|
import { observer } from 'mobx-react-lite'
|
|
5
5
|
import { Fragment, useEffect, useRef, useState, type ReactNode } from 'react'
|
|
6
6
|
import { Panel, Separator } from 'react-resizable-panels'
|
|
7
7
|
import { KeptCols } from '../kept-cols.tsx'
|
|
8
8
|
import { AutoText } from '../auto-text.tsx'
|
|
9
|
-
import { clock, cutsByRecent, shotAt, type CutInfo, type TrailerNote } from '../../../review/trailer-model.ts'
|
|
9
|
+
import { clock, cutsByRecent, shotAt, type CutInfo, type NoteMark, type TrailerNote } from '../../../review/trailer-model.ts'
|
|
10
10
|
import { editorHref } from '../check-words.ts'
|
|
11
11
|
import { renderMd } from '../md.ts'
|
|
12
12
|
import type { RepoSt } from '../repo-st.ts'
|
|
13
13
|
import { keepFocus } from './kit.tsx'
|
|
14
14
|
import { PANEL, PhoneTop } from './review-page.tsx'
|
|
15
|
-
import { ClipSound } from './review-views.tsx'
|
|
16
|
-
import { hueOf, ShotCards, TrailerTimeline } from './trailer-timeline.tsx'
|
|
15
|
+
import { ClipSound, DragBox, dragBox, NoteRect, pct } from './review-views.tsx'
|
|
16
|
+
import { hueOf, secsOf, ShotCards, TrailerTimeline } from './trailer-timeline.tsx'
|
|
17
17
|
import { captionText, type PlacedNote, type TrailerSt } from './trailer-st.ts'
|
|
18
18
|
import { Caret } from '../icons.tsx'
|
|
19
19
|
|
|
@@ -116,7 +116,8 @@ const KEYS: [string, string][] = [
|
|
|
116
116
|
['↑ ↓', 'shot back, on'],
|
|
117
117
|
['⇧↑ ⇧↓', 'note back, on'],
|
|
118
118
|
['N', 'a note on this frame'],
|
|
119
|
-
['
|
|
119
|
+
['drag', 'a note with its rectangle'],
|
|
120
|
+
['click', 'a note on that frame'],
|
|
120
121
|
['M', 'sound'],
|
|
121
122
|
['- +', 'timeline zoom'],
|
|
122
123
|
['Home', 'to the start'],
|
|
@@ -131,10 +132,13 @@ const Keys = () => (
|
|
|
131
132
|
|
|
132
133
|
// ── the player ──
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
/** the player over its timeline and shot cards: the trailer page's middle, and a trailer card's body; `under` sits right
|
|
136
|
+
* under the timeline (a narrow card's notes rail) */
|
|
137
|
+
export const PlayerColumn = observer(({ tr, app, host, under }: { tr: TrailerSt; app: RepoSt; host?: FrameHost; under?: ReactNode }) => {
|
|
135
138
|
const c = tr.cut
|
|
136
139
|
if (!tr.desk) return <div className="rv-empty">{tr.deskError ?? 'Reading the cuts…'}</div>
|
|
137
140
|
if (!c) return <div className="rv-empty">No cut. A trailer is trailer/<name>/<cut>.trailer, rendered by sk trailer.</div>
|
|
141
|
+
if (!tr.shown && tr.card) return <div className="rv-empty">{tr.error ?? <><span className="spin" /> reading the render…</>}</div>
|
|
138
142
|
if (!tr.shown) return <div className="rv-empty">{c.video ? `${c.cut}: its timeline does not read (${c.errors[0] ?? '?'})` : `${c.cut} is not rendered yet: sk trailer ${c.files.trailer ?? ''}`}</div>
|
|
139
143
|
return (
|
|
140
144
|
<div className="tr-player">
|
|
@@ -144,22 +148,27 @@ const PlayerColumn = observer(({ tr, app }: { tr: TrailerSt; app: RepoSt }) => {
|
|
|
144
148
|
<button className="primary" onClick={() => tr.loadNewer()}>Load it, on the same shot</button>
|
|
145
149
|
</div>
|
|
146
150
|
) : null}
|
|
147
|
-
{!tr.newer && c.edited && !c.timelineFromRender ? (
|
|
151
|
+
{!tr.card && !tr.newer && c.edited && !c.timelineFromRender ? (
|
|
148
152
|
<div className="tr-banner warn">The .trailer changed since this render: the timeline comes from the file, its shots may be off until the next sk trailer.</div>
|
|
149
153
|
) : null}
|
|
150
|
-
<Player tr={tr} />
|
|
154
|
+
<Player tr={tr} host={host} />
|
|
151
155
|
<Transport tr={tr} app={app} />
|
|
152
156
|
<NowLine tr={tr} />
|
|
153
157
|
<TrailerTimeline st={tr} />
|
|
158
|
+
{under}
|
|
154
159
|
<ShotCards st={tr} />
|
|
155
160
|
<Montage tr={tr} />
|
|
156
161
|
</div>
|
|
157
162
|
)
|
|
158
163
|
})
|
|
159
164
|
|
|
160
|
-
|
|
165
|
+
/** the render on screen, as tall as leaves the transport and the timeline in view (`--tr-room`); `host` (a trailer
|
|
166
|
+
* card) frames the picture with a review card's own rectangles, else a drag on it draws a frame note's rectangle and a
|
|
167
|
+
* click writes a note on the frame */
|
|
168
|
+
const Player = observer(({ tr, host }: { tr: TrailerSt; host?: FrameHost | undefined }) => {
|
|
161
169
|
const shown = tr.shown
|
|
162
170
|
const ref = useRef<HTMLVideoElement>(null)
|
|
171
|
+
const [drag, setDrag] = useState<Parameters<typeof DragBox>[0]['c']>(null)
|
|
163
172
|
const src = tr.videoUrl
|
|
164
173
|
useEffect(() => {
|
|
165
174
|
const el = ref.current
|
|
@@ -168,30 +177,51 @@ const Player = observer(({ tr }: { tr: TrailerSt }) => {
|
|
|
168
177
|
}, [tr, src])
|
|
169
178
|
if (!shown || !src) return null
|
|
170
179
|
const [w, h] = shown.timeline.size
|
|
180
|
+
const width = `min(100%, calc((100vh - var(--tr-room, 420px)) * ${w / h}))`
|
|
181
|
+
const video = <video ref={ref} src={src} playsInline preload="auto" onEnded={() => tr.clock.pause()} />
|
|
182
|
+
const paused = tr.clock.paused ? <div className="tr-paused">❚❚ {clock(tr.time)} · frame {tr.frame + 1}{tr.shot ? ` · ${tr.shot.name}` : ''}</div> : null
|
|
183
|
+
if (host)
|
|
184
|
+
return (
|
|
185
|
+
<div className="tr-screen">
|
|
186
|
+
<div className="tr-frame" style={{ width }}>
|
|
187
|
+
{host(video, `${w} / ${h}`)}
|
|
188
|
+
{paused}
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
)
|
|
171
192
|
return (
|
|
172
193
|
<div className="tr-screen">
|
|
173
|
-
<div className="tr-frame" style={{ width
|
|
174
|
-
|
|
175
|
-
<div className="tr-clickzone" title="click: a note
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
194
|
+
<div className="tr-frame" style={{ width, aspectRatio: `${w} / ${h}` }}>
|
|
195
|
+
{video}
|
|
196
|
+
<div className="tr-clickzone" title="drag: a note with its rectangle · click: a note on this frame"
|
|
197
|
+
onPointerDown={(e) => {
|
|
198
|
+
if (e.button !== 0) return
|
|
199
|
+
e.preventDefault()
|
|
200
|
+
// he draws on the paused frame: the note keeps its time
|
|
201
|
+
if (!tr.clock.paused) tr.clock.pause()
|
|
202
|
+
dragBox(e, e.currentTarget, setDrag, (r) => tr.drawFrame(r))
|
|
179
203
|
}}>
|
|
180
|
-
<
|
|
204
|
+
<FrameMarks tr={tr} />
|
|
205
|
+
<DragBox c={drag} />
|
|
181
206
|
</div>
|
|
182
|
-
{
|
|
207
|
+
{paused}
|
|
183
208
|
</div>
|
|
184
209
|
</div>
|
|
185
210
|
)
|
|
186
211
|
})
|
|
187
212
|
|
|
188
|
-
/** the
|
|
189
|
-
|
|
213
|
+
/** what frames the picture of a trailer card: the video, the frame's aspect, the picture to draw */
|
|
214
|
+
export type FrameHost = (video: ReactNode, aspect: string) => ReactNode
|
|
215
|
+
|
|
216
|
+
/** the marks of the notes on the frame, and the draft's: a rectangle as a card draws a note's, a point as a pin */
|
|
217
|
+
const FrameMarks = observer(({ tr }: { tr: TrailerSt }) => {
|
|
190
218
|
const d = tr.draft
|
|
219
|
+
const mark = (key: string, m: NoteMark, n: string, text: string, state: string, on: boolean, pulse = false) =>
|
|
220
|
+
m.w > 0 && m.h > 0 ? <NoteRect key={key} r={{ ...m, comment: text }} n={Number(n) || 0} on={on} /> : <Pin key={key} x={m.x} y={m.y} state={state} label={n} on={on} pulse={pulse} />
|
|
191
221
|
return (
|
|
192
222
|
<>
|
|
193
|
-
{tr.
|
|
194
|
-
{d?.
|
|
223
|
+
{tr.marksNow.map((p) => mark(p.note.id, p.note.mark!, String(p.n), p.note.text, p.note.state, tr.selected === p.note.id))}
|
|
224
|
+
{d?.mark ? mark('draft', d.mark, '+', d.text, 'open', true, true) : null}
|
|
195
225
|
</>
|
|
196
226
|
)
|
|
197
227
|
})
|
|
@@ -228,7 +258,7 @@ const Transport = observer(({ tr, app }: { tr: TrailerSt; app: RepoSt }) => {
|
|
|
228
258
|
<ClipSound clip={c} keyHint="M" />
|
|
229
259
|
{href && file ? <a className="tr-file" href={href} title={`open ${file} in the editor`}>{file.split('/').pop()}</a> : null}
|
|
230
260
|
{tr.shown ? <button className="tr-tbtn" title={`show ${tr.cut?.files.video ?? 'the render'} in the Finder`} aria-label="show the render in the Finder" onMouseDown={keepFocus} onClick={() => void tr.reveal()}>📂</button> : null}
|
|
231
|
-
<button className="tr-notebtn" onMouseDown={keepFocus} onClick={() => tr.newNote()}>✚ Note (N)</button>
|
|
261
|
+
{tr.card ? null : <button className="tr-notebtn" onMouseDown={keepFocus} onClick={() => tr.newNote()}>✚ Note (N)</button>}
|
|
232
262
|
</div>
|
|
233
263
|
)
|
|
234
264
|
})
|
|
@@ -242,7 +272,7 @@ const NowLine = observer(({ tr }: { tr: TrailerSt }) => {
|
|
|
242
272
|
<div className="tr-now">
|
|
243
273
|
<span className={`tr-secbadge ${hueOf(tl, s.section)}`}>{s.section ?? 'opening'}</span>
|
|
244
274
|
<b className="tr-shotnow">{s.name}</b>
|
|
245
|
-
<span className="tr-dim">shot {tr.shotIndex + 1}/{tl.shots.length} · {(tr.time - s.start).toFixed(2)} s of {s.length}
|
|
275
|
+
<span className="tr-dim">shot {tr.shotIndex + 1}/{tl.shots.length} · {(tr.time - s.start).toFixed(2)} s of {secsOf(s.length)} · line {s.line}</span>
|
|
246
276
|
{tr.captions.map((c) => <span key={`${c.start}${c.text}`} className="tr-capnow">« {captionText(c)} »</span>)}
|
|
247
277
|
</div>
|
|
248
278
|
)
|
|
@@ -268,10 +298,10 @@ const DraftBox = observer(({ tr }: { tr: TrailerSt }) => {
|
|
|
268
298
|
<div className="tr-draft">
|
|
269
299
|
<div className="tr-drafthead">
|
|
270
300
|
<b>New note · {clock(d.time)} · {s?.name}</b>
|
|
271
|
-
{d.
|
|
272
|
-
<span><span className="tr-pinned"
|
|
301
|
+
{d.mark ? (
|
|
302
|
+
<span><span className="tr-pinned">▭ marked</span> <button className="ghost" onClick={() => tr.unmarkDraft()}>remove</button></span>
|
|
273
303
|
) : (
|
|
274
|
-
<span className="tr-dim tr-small">
|
|
304
|
+
<span className="tr-dim tr-small">drag on the image to mark a spot</span>
|
|
275
305
|
)}
|
|
276
306
|
</div>
|
|
277
307
|
<AutoText autoFocus rows={3} placeholder="What is wrong, what you want instead…" value={d.text} onText={(t) => tr.setDraftText(t)}
|
|
@@ -352,7 +382,7 @@ const NoteCard = observer(({ tr, n: p }: { tr: TrailerSt; n: PlacedNote }) => {
|
|
|
352
382
|
{!on ? <Still tr={tr} n={n} w={112} /> : null}
|
|
353
383
|
<div className="tr-notebody">
|
|
354
384
|
<div className="tr-notemeta">
|
|
355
|
-
<span className="tr-
|
|
385
|
+
<span className="tr-notenum" title={n.id}>{p.n}</span>
|
|
356
386
|
<b className="tr-mono">{p.at !== null ? clock(p.at) : `${n.cut} ${clock(n.time)}`}</b>
|
|
357
387
|
<span className={`tr-secbadge small ${tr.timeline ? hueOf(tr.timeline, n.section) : 'hue-none'}`}>{n.shot}</span>
|
|
358
388
|
{n.state !== 'open' ? <span className={`tr-statebadge ns-${n.state}`}>{n.state === 'done' ? '✓' : '⊘'} {STATE_LABEL[n.state]}</span> : null}
|
|
@@ -366,7 +396,7 @@ const NoteCard = observer(({ tr, n: p }: { tr: TrailerSt; n: PlacedNote }) => {
|
|
|
366
396
|
{editing ? (
|
|
367
397
|
<div className="tr-edit">
|
|
368
398
|
<AutoText autoFocus rows={3} value={editing.text} onText={(t) => tr.setEditText(t)} onKeyDown={enterSaves(() => void tr.saveEdit(), () => tr.cancelEdit())} />
|
|
369
|
-
<div className="tr-dim tr-small">Enter saves · Escape drops it · on its frame, a
|
|
399
|
+
<div className="tr-dim tr-small">Enter saves · Escape drops it · on its frame, a drag draws its rectangle again</div>
|
|
370
400
|
</div>
|
|
371
401
|
) : null}
|
|
372
402
|
{n.reply && !closing ? (
|
|
@@ -396,7 +426,7 @@ const NoteCard = observer(({ tr, n: p }: { tr: TrailerSt; n: PlacedNote }) => {
|
|
|
396
426
|
) : (
|
|
397
427
|
<button onClick={() => void tr.reopen(n)}>↺ Reopen</button>
|
|
398
428
|
)}
|
|
399
|
-
{n.
|
|
429
|
+
{n.mark ? <button className="ghost" onClick={() => void tr.unmark(n)}>Remove the mark</button> : null}
|
|
400
430
|
<span className="sp" />
|
|
401
431
|
<button className={`tr-delete${sure ? ' sure' : ''}`} onClick={() => (sure ? void tr.remove(n) : setSure(true))} onMouseLeave={() => setSure(false)}>
|
|
402
432
|
{sure ? 'Sure?' : 'Delete'}
|
|
@@ -407,13 +437,14 @@ const NoteCard = observer(({ tr, n: p }: { tr: TrailerSt; n: PlacedNote }) => {
|
|
|
407
437
|
)
|
|
408
438
|
})
|
|
409
439
|
|
|
410
|
-
/** a note's still, as cut when he wrote it, with its
|
|
440
|
+
/** a note's still, as cut when he wrote it, with its rectangle or its point */
|
|
411
441
|
const Still = ({ tr, n, w }: { tr: TrailerSt; n: TrailerNote; w: number | string }) => {
|
|
412
442
|
const [sw, sh] = tr.shown?.timeline.size ?? [16, 9]
|
|
443
|
+
const m = n.mark
|
|
413
444
|
return (
|
|
414
445
|
<div className={`tr-still${typeof w === 'string' ? ' wide' : ''}`} style={{ width: w, aspectRatio: `${sw} / ${sh}` }}>
|
|
415
446
|
<img src={tr.stillUrl(n)} alt="" loading="lazy" />
|
|
416
|
-
{
|
|
447
|
+
{m && m.w > 0 && m.h > 0 ? <div className="tr-stillrect" style={pct(m)} /> : m ? <div className={`tr-stillpin ns-${n.state}`} style={{ left: `${m.x * 100}%`, top: `${m.y * 100}%` }} /> : null}
|
|
417
448
|
</div>
|
|
418
449
|
)
|
|
419
450
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
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,
|
|
@@ -19,6 +24,7 @@ import {
|
|
|
19
24
|
import { reach } from '../reach.ts'
|
|
20
25
|
import type { RepoSt } from '../repo-st.ts'
|
|
21
26
|
import { ClipSt } from './clip-st.ts'
|
|
27
|
+
import { LIT_S } from '../../../review/trailer-notes.ts'
|
|
22
28
|
|
|
23
29
|
const POLL_MS = 3000
|
|
24
30
|
|
|
@@ -36,7 +42,7 @@ interface Shown {
|
|
|
36
42
|
interface NoteDraft {
|
|
37
43
|
time: number
|
|
38
44
|
text: string
|
|
39
|
-
|
|
45
|
+
mark: NoteMark | null
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
/** a note placed on the cut on screen: `at` its time there, null when its shot is not in it */
|
|
@@ -45,6 +51,8 @@ export interface PlacedNote {
|
|
|
45
51
|
at: number | null
|
|
46
52
|
/** it was written on this cut and its shot has moved since */
|
|
47
53
|
moved: boolean
|
|
54
|
+
/** its number in the order of the cut on screen, the lane's and the frame's label */
|
|
55
|
+
n: number
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
type NoteFilter = 'open' | 'all'
|
|
@@ -69,6 +77,11 @@ async function send<T>(url: string, method: string, body?: unknown): Promise<T>
|
|
|
69
77
|
return JSON.parse(text) as T
|
|
70
78
|
}
|
|
71
79
|
|
|
80
|
+
/** the cut a page opens on when none is named: the working cut (never a kept version) whose file or render changed
|
|
81
|
+
* last, so the cut being worked on, never the first by name */
|
|
82
|
+
export const latestCut = (cuts: readonly CutInfo[]): CutInfo | null =>
|
|
83
|
+
cuts.filter((c) => !c.version && c.video !== null).reduce<CutInfo | null>((best, c) => (best === null || c.fileMtime > best.fileMtime ? c : best), null)
|
|
84
|
+
|
|
72
85
|
export class TrailerSt {
|
|
73
86
|
desk: TrailerDesk | null = null
|
|
74
87
|
deskError: string | null = null
|
|
@@ -93,8 +106,16 @@ export class TrailerSt {
|
|
|
93
106
|
private timer: ReturnType<typeof setInterval> | null = null
|
|
94
107
|
private readonly prefs: string
|
|
95
108
|
|
|
96
|
-
constructor(
|
|
109
|
+
constructor(
|
|
110
|
+
private readonly st: RepoSt,
|
|
111
|
+
/** a trailer card's body: the card, what it plays, its notes as the lane's markers; null on the trailer page */
|
|
112
|
+
readonly card: { id: string; spec: TrailerCard; lane: () => LaneMark[] } | null = null,
|
|
113
|
+
) {
|
|
97
114
|
this.prefs = `shipkit.trailer.${st.key}`
|
|
115
|
+
if (card) {
|
|
116
|
+
this.trailerId = card.spec.trailer
|
|
117
|
+
this.cutId = card.spec.after.cut
|
|
118
|
+
}
|
|
98
119
|
try {
|
|
99
120
|
const p = JSON.parse(localStorage.getItem(this.prefs) ?? '{}') as { zoom?: number; filter?: NoteFilter; rate?: number }
|
|
100
121
|
if (p.zoom && ZOOMS.includes(p.zoom as never)) this.zoom = p.zoom
|
|
@@ -103,9 +124,14 @@ export class TrailerSt {
|
|
|
103
124
|
} catch {
|
|
104
125
|
// a blocked storage only loses the kept choices
|
|
105
126
|
}
|
|
106
|
-
makeAutoObservable<this, 'st' | 'landing' | 'timer' | 'prefs' | 'noteLanding'>(this, { st: false, clock: false, shown: observableRef, landing: false, timer: false, prefs: false, noteLanding: false })
|
|
127
|
+
makeAutoObservable<this, 'st' | 'landing' | 'timer' | 'prefs' | 'noteLanding'>(this, { st: false, card: false, clock: false, shown: observableRef, landing: false, timer: false, prefs: false, noteLanding: false })
|
|
107
128
|
// a trailer is heard: the clock starts with its sound on
|
|
108
129
|
this.clock.hear(true)
|
|
130
|
+
// a card plays its pinned render from the start; no address is its own
|
|
131
|
+
if (card) {
|
|
132
|
+
void this.showPinned()
|
|
133
|
+
return
|
|
134
|
+
}
|
|
109
135
|
// the first answer, or a cut picked: the render on screen follows
|
|
110
136
|
reaction(
|
|
111
137
|
() => [this.cut?.video?.mtime ?? null, this.trailer?.id ?? null, this.cut?.cut ?? null] as const,
|
|
@@ -171,13 +197,13 @@ export class TrailerSt {
|
|
|
171
197
|
|
|
172
198
|
get cut(): CutInfo | null {
|
|
173
199
|
const cuts = this.trailer?.cuts ?? []
|
|
174
|
-
return cuts.find((c) => c.cut === this.cutId) ?? cuts.find((c) => c.video !== null) ?? cuts[0] ?? null
|
|
200
|
+
return cuts.find((c) => c.cut === this.cutId) ?? latestCut(cuts) ?? cuts.find((c) => c.video !== null) ?? cuts[0] ?? null
|
|
175
201
|
}
|
|
176
202
|
|
|
177
203
|
/** a finished render newer than the one on screen */
|
|
178
204
|
get newer(): boolean {
|
|
179
205
|
const v = this.cut?.video
|
|
180
|
-
return !!v && !!this.shown && this.shown.cut === this.cut?.cut && v.mtime !== this.shown.version
|
|
206
|
+
return !this.card && !!v && !!this.shown && this.shown.cut === this.cut?.cut && v.mtime !== this.shown.version
|
|
181
207
|
}
|
|
182
208
|
|
|
183
209
|
/** the cut the address names, the note open on it (the player lands on its frame), the notes filter; an address
|
|
@@ -214,6 +240,10 @@ export class TrailerSt {
|
|
|
214
240
|
|
|
215
241
|
/** a trailer or a cut picked on the page: its address follows */
|
|
216
242
|
pick(trailer: string, cut: string | null): void {
|
|
243
|
+
if (this.card) {
|
|
244
|
+
if (cut !== null) this.side(cut)
|
|
245
|
+
return
|
|
246
|
+
}
|
|
217
247
|
this.st.showTrailer(trailer, cut, trailer === this.trailerId ? this.selected : null, this.filter === 'all' ? null : this.filter)
|
|
218
248
|
}
|
|
219
249
|
|
|
@@ -233,6 +263,77 @@ export class TrailerSt {
|
|
|
233
263
|
if (land?.play) this.clock.play()
|
|
234
264
|
}
|
|
235
265
|
|
|
266
|
+
// ── a trailer card ──
|
|
267
|
+
|
|
268
|
+
/** the card's cut on screen: its after, or its before */
|
|
269
|
+
get onBefore(): boolean {
|
|
270
|
+
return this.card?.spec.before !== undefined && this.cutId === this.card.spec.before.cut
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/** the shots the card's change touched */
|
|
274
|
+
get changed(): ReadonlySet<string> {
|
|
275
|
+
return new Set(this.card?.spec.shots ?? [])
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** the card's other render, on the shot and the time into it he was on, playing if it played */
|
|
279
|
+
side(cut: string): void {
|
|
280
|
+
const spec = this.card?.spec
|
|
281
|
+
if (!spec || cut === this.cutId || (cut !== spec.after.cut && cut !== spec.before?.cut)) return
|
|
282
|
+
const s = this.shot
|
|
283
|
+
if (s && !this.landing) this.landing = { shot: s.name, offset: this.time - s.start, play: !this.clock.paused }
|
|
284
|
+
if (!this.clock.paused) this.clock.pause()
|
|
285
|
+
this.cutId = cut
|
|
286
|
+
this.draft = null
|
|
287
|
+
void this.showPinned()
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
toggleSide(): void {
|
|
291
|
+
const spec = this.card?.spec
|
|
292
|
+
if (spec?.before) this.side(this.onBefore ? spec.after.cut : spec.before.cut)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** the render on screen as a rectangle names it: `before` or `after` on a card with a before, else none */
|
|
296
|
+
get sideName(): Side | undefined {
|
|
297
|
+
return this.card?.spec.before ? (this.onBefore ? 'before' : 'after') : undefined
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** that render, landed on a shot and the seconds into it (a rectangle picked), paused */
|
|
301
|
+
showSide(side: Side, shot: { name: string; time: number } | null): void {
|
|
302
|
+
const spec = this.card?.spec
|
|
303
|
+
const cut = side === 'before' ? spec?.before?.cut : spec?.after.cut
|
|
304
|
+
if (!cut) return
|
|
305
|
+
if (shot) this.landing = { shot: shot.name, offset: shot.time, play: false }
|
|
306
|
+
this.side(cut)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** where a rectangle drawn now sits: the shot on screen and the seconds into it */
|
|
310
|
+
get anchor(): { name: string; time: number } | null {
|
|
311
|
+
const s = this.shot
|
|
312
|
+
return s ? { name: s.name, time: Math.round((this.time - s.start) * 1000) / 1000 } : null
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** the render the card pinned for the cut on screen, whatever render the cut has now */
|
|
316
|
+
private async showPinned(): Promise<void> {
|
|
317
|
+
const spec = this.card?.spec
|
|
318
|
+
if (!spec) return
|
|
319
|
+
const pin = this.onBefore && spec.before ? spec.before : spec.after
|
|
320
|
+
try {
|
|
321
|
+
const r = await send<PinnedRender>(this.st.url(`/api/trailer/render/${spec.trailer}/${pin.cut}/${pin.render}`), 'GET')
|
|
322
|
+
runInAction(() => {
|
|
323
|
+
if (this.cutId !== pin.cut) return
|
|
324
|
+
this.shown = { trailer: spec.trailer, cut: pin.cut, version: pin.render, duration: r.duration, fps: r.fps, timeline: r.timeline, strip: r.strip }
|
|
325
|
+
this.clock.load(`trailer:${spec.trailer}/${pin.cut}/${pin.render}`, r.duration, r.fps)
|
|
326
|
+
const land = this.landing
|
|
327
|
+
this.landing = null
|
|
328
|
+
const s = land ? r.timeline.shots.find((x) => x.name === land.shot) : undefined
|
|
329
|
+
this.clock.seek(s && land ? s.start + Math.min(land.offset, s.length) : 0)
|
|
330
|
+
if (land?.play) this.clock.play()
|
|
331
|
+
})
|
|
332
|
+
} catch (e) {
|
|
333
|
+
runInAction(() => (this.error = (e as Error).message))
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
236
337
|
/** the new render, on the shot and the time into it he was on */
|
|
237
338
|
loadNewer(): void {
|
|
238
339
|
const s = this.shot
|
|
@@ -318,8 +419,9 @@ export class TrailerSt {
|
|
|
318
419
|
|
|
319
420
|
// ── the notes ──
|
|
320
421
|
|
|
422
|
+
/** the trailer's frame notes; none on a card, whose rectangles are its own verdict's */
|
|
321
423
|
get notes(): TrailerNote[] {
|
|
322
|
-
return this.trailer?.notes ?? []
|
|
424
|
+
return this.card ? [] : (this.trailer?.notes ?? [])
|
|
323
425
|
}
|
|
324
426
|
|
|
325
427
|
get openCount(): number {
|
|
@@ -341,6 +443,13 @@ export class TrailerSt {
|
|
|
341
443
|
return { note: n, at, moved: at !== null && n.cut === this.shown?.cut && Math.abs(at - n.time) > 0.5 / this.fps }
|
|
342
444
|
})
|
|
343
445
|
.sort((a, b) => (a.at ?? Infinity) - (b.at ?? Infinity) || a.note.n - b.note.n)
|
|
446
|
+
.map((p, i) => ({ ...p, n: i + 1 }))
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** the timeline's notes lane: a card's notes, else this page's frame notes on the cut on screen */
|
|
450
|
+
get lane(): LaneMark[] {
|
|
451
|
+
if (this.card) return this.card.lane()
|
|
452
|
+
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
453
|
}
|
|
345
454
|
|
|
346
455
|
get here(): PlacedNote[] {
|
|
@@ -351,10 +460,10 @@ export class TrailerSt {
|
|
|
351
460
|
return this.placed.filter((p) => p.at === null)
|
|
352
461
|
}
|
|
353
462
|
|
|
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.
|
|
463
|
+
/** the notes whose mark shows over the frame: on this frame while paused, around their time while it plays */
|
|
464
|
+
get marksNow(): PlacedNote[] {
|
|
465
|
+
const near = this.clock.paused ? 0.5 / this.fps + 1e-6 : LIT_S
|
|
466
|
+
return this.here.filter((p) => p.note.mark && p.at !== null && Math.abs(p.at - this.time) <= near)
|
|
358
467
|
}
|
|
359
468
|
|
|
360
469
|
setFilter(f: NoteFilter): void {
|
|
@@ -416,36 +525,38 @@ export class TrailerSt {
|
|
|
416
525
|
// ── writing ──
|
|
417
526
|
|
|
418
527
|
/** N, or a click on the frame: a note on the frame on screen, paused there */
|
|
419
|
-
newNote(
|
|
528
|
+
newNote(mark: NoteMark | null = null): void {
|
|
420
529
|
if (!this.shown) return
|
|
421
530
|
if (!this.clock.paused) this.clock.pause()
|
|
422
531
|
this.editing = null
|
|
423
532
|
this.closing = null
|
|
424
|
-
this.draft = { time: this.clock.time, text: this.draft?.text ?? '',
|
|
533
|
+
this.draft = { time: this.clock.time, text: this.draft?.text ?? '', mark: mark ?? this.draft?.mark ?? null }
|
|
425
534
|
}
|
|
426
535
|
|
|
427
|
-
/** a
|
|
428
|
-
|
|
536
|
+
/** a drag on the frame (`mark`), or a click (null): the rectangle of the note being edited on this frame, else of the
|
|
537
|
+
* draft, else a new note; a click opens a note on the frame when none is open */
|
|
538
|
+
drawFrame(mark: NoteMark | null): void {
|
|
429
539
|
const e = this.editing ? this.here.find((p) => p.note.id === this.editing?.id) : undefined
|
|
430
540
|
if (e && e.at !== null && Math.abs(e.at - this.time) <= 0.5 / this.fps + 1e-6) {
|
|
431
|
-
void this.edit(e.note.id, {
|
|
541
|
+
if (mark) void this.edit(e.note.id, { mark })
|
|
432
542
|
return
|
|
433
543
|
}
|
|
434
544
|
if (this.draft) {
|
|
435
|
-
|
|
545
|
+
if (!mark) return
|
|
546
|
+
this.draft.mark = mark
|
|
436
547
|
if (!this.clock.paused) this.clock.pause()
|
|
437
548
|
this.draft.time = this.clock.time
|
|
438
549
|
return
|
|
439
550
|
}
|
|
440
|
-
this.newNote(
|
|
551
|
+
this.newNote(mark)
|
|
441
552
|
}
|
|
442
553
|
|
|
443
554
|
setDraftText(t: string): void {
|
|
444
555
|
if (this.draft) this.draft.text = t
|
|
445
556
|
}
|
|
446
557
|
|
|
447
|
-
|
|
448
|
-
if (this.draft) this.draft.
|
|
558
|
+
unmarkDraft(): void {
|
|
559
|
+
if (this.draft) this.draft.mark = null
|
|
449
560
|
}
|
|
450
561
|
|
|
451
562
|
cancelDraft(): void {
|
|
@@ -465,7 +576,7 @@ export class TrailerSt {
|
|
|
465
576
|
version: s.version,
|
|
466
577
|
time: d.time,
|
|
467
578
|
text: d.text,
|
|
468
|
-
...(d.
|
|
579
|
+
...(d.mark ? { mark: d.mark } : {}),
|
|
469
580
|
})
|
|
470
581
|
runInAction(() => {
|
|
471
582
|
this.draft = null
|
|
@@ -530,11 +641,11 @@ export class TrailerSt {
|
|
|
530
641
|
await this.edit(n.id, { state: 'open' })
|
|
531
642
|
}
|
|
532
643
|
|
|
533
|
-
async
|
|
534
|
-
await this.edit(n.id, {
|
|
644
|
+
async unmark(n: TrailerNote): Promise<void> {
|
|
645
|
+
await this.edit(n.id, { mark: null })
|
|
535
646
|
}
|
|
536
647
|
|
|
537
|
-
async edit(id: string, body: { text?: string;
|
|
648
|
+
async edit(id: string, body: { text?: string; mark?: NoteMark | null; state?: NoteState; reply?: string }): Promise<void> {
|
|
538
649
|
const t = this.trailer
|
|
539
650
|
if (!t) return
|
|
540
651
|
this.error = null
|
|
@@ -590,11 +701,12 @@ export class TrailerSt {
|
|
|
590
701
|
const d = e.key === 'ArrowDown' ? 1 : -1
|
|
591
702
|
if (e.shiftKey) this.noteBy(d)
|
|
592
703
|
else this.shotBy(d)
|
|
593
|
-
} else if (k === 'n') this.newNote()
|
|
704
|
+
} else if (k === 'n' && !this.card) this.newNote()
|
|
594
705
|
else if (k === 'm') this.clock.toggleSound()
|
|
595
706
|
else if (e.key === '-') this.zoomBy(-1)
|
|
596
707
|
else if (e.key === '+' || e.key === '=') this.zoomBy(1)
|
|
597
708
|
else if (e.key === 'Home') this.seek(0)
|
|
709
|
+
else if (k === 'b' && this.card?.spec.before) this.toggleSide()
|
|
598
710
|
else if (e.key === 'Escape' && this.draft) this.cancelDraft()
|
|
599
711
|
else return false
|
|
600
712
|
return true
|