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.
Files changed (196) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +1 -1
  3. package/src/annex/annex.ts +227 -0
  4. package/src/annex/offload.ts +279 -0
  5. package/src/checks/SK004-gitignore-policy.check.ts +6 -3
  6. package/src/checks/SK040-release-words.check.ts +43 -0
  7. package/src/checks/SK041-annex-links.check.ts +28 -0
  8. package/src/checks/SK042-post-kinds.check.ts +73 -0
  9. package/src/cli/cmd_Annex.ts +179 -0
  10. package/src/cli/cmd_Commands.ts +4 -1
  11. package/src/cli/cmd_GlobalProcesses.ts +2 -107
  12. package/src/cli/cmd_Home.ts +4 -3
  13. package/src/cli/cmd_Messages.ts +155 -0
  14. package/src/cli/cmd_Overview.ts +2 -1
  15. package/src/cli/cmd_Releases.ts +84 -0
  16. package/src/cli/cmd_Review.ts +176 -12
  17. package/src/cli/cmd_Shot.ts +4 -4
  18. package/src/cli/cmd_Social.ts +151 -8
  19. package/src/cli/cmd_Sound.ts +17 -4
  20. package/src/cli/cmd_Trailer.ts +67 -1
  21. package/src/cli/family-pages.ts +2 -0
  22. package/src/cli/kit/index.ts +1 -1
  23. package/src/cli/kit/verb.ts +11 -3
  24. package/src/cli/registry.ts +7 -1
  25. package/src/collections/collection-types.ts +8 -1
  26. package/src/collections/providers.ts +4 -1
  27. package/src/collections/review.ts +23 -4
  28. package/src/commands/model.ts +36 -0
  29. package/src/commands/registry.ts +49 -0
  30. package/src/commands/routes.ts +59 -0
  31. package/src/commands/runner.ts +35 -0
  32. package/src/commands/runs.ts +112 -0
  33. package/src/core/app-icon.ts +4 -3
  34. package/src/core/icon-type.ts +8 -0
  35. package/src/core/jobs.ts +4 -3
  36. package/src/core/layout.ts +11 -2
  37. package/src/core/squircle.ts +95 -0
  38. package/src/home/daemon-jobs.ts +26 -2
  39. package/src/home/global-units.ts +3 -0
  40. package/src/home/gui-app/ShipkitGui.swift +337 -5
  41. package/src/home/gui-app.ts +64 -33
  42. package/src/home/hmr-keep.ts +134 -0
  43. package/src/home/home-start.ts +2 -2
  44. package/src/home/lib-watch.ts +21 -11
  45. package/src/home/pm-switch.ts +112 -0
  46. package/src/home/pm.ts +1 -1
  47. package/src/home/process-apps.ts +181 -0
  48. package/src/home/resources.ts +3 -3
  49. package/src/home/run-web.ts +7 -4
  50. package/src/home/serve-web.ts +64 -14
  51. package/src/identities/collection.ts +49 -0
  52. package/src/identities/identities.ts +121 -14
  53. package/src/identities/machine.ts +4 -3
  54. package/src/identities/rating.ts +33 -0
  55. package/src/identities/shown.ts +170 -0
  56. package/src/identities/steps.ts +5 -0
  57. package/src/media-store/purge.ts +15 -1
  58. package/src/media-store/remote.ts +22 -6
  59. package/src/messages/brief.ts +117 -0
  60. package/src/messages/collection.ts +40 -0
  61. package/src/messages/model.ts +171 -0
  62. package/src/messages/routes.ts +15 -0
  63. package/src/messages/score.ts +182 -0
  64. package/src/messages/tabs.ts +13 -0
  65. package/src/release/notes.ts +130 -0
  66. package/src/release/run-bump.ts +41 -18
  67. package/src/release/run-release.ts +22 -4
  68. package/src/release/run-releases.ts +17 -15
  69. package/src/release/unit-resolve.ts +9 -0
  70. package/src/releases/add.ts +94 -0
  71. package/src/releases/before.ts +31 -0
  72. package/src/releases/collection.ts +36 -0
  73. package/src/releases/from-card.ts +151 -0
  74. package/src/releases/model.ts +327 -0
  75. package/src/releases/pictures.ts +110 -0
  76. package/src/releases/routes.ts +36 -0
  77. package/src/releases/store.ts +71 -0
  78. package/src/repo-config.ts +5 -0
  79. package/src/review/cells.ts +0 -11
  80. package/src/review/format.ts +10 -6
  81. package/src/review/http.ts +1 -1
  82. package/src/review/model.ts +102 -3
  83. package/src/review/notes.ts +2 -48
  84. package/src/review/routes.ts +28 -10
  85. package/src/review/stage-card.ts +197 -0
  86. package/src/review/stage-routes.ts +123 -0
  87. package/src/review/store.ts +47 -1
  88. package/src/review/trailer-card.ts +99 -0
  89. package/src/review/trailer-desk.ts +76 -4
  90. package/src/review/trailer-model.ts +106 -7
  91. package/src/review/trailer-notes.ts +45 -0
  92. package/src/review/trailer-routes.ts +119 -13
  93. package/src/review/trailer-voices.ts +144 -0
  94. package/src/review/watchers.ts +58 -1
  95. package/src/serve/hub-app/app-bridge.ts +71 -0
  96. package/src/serve/hub-app/benign-errors.ts +22 -0
  97. package/src/serve/hub-app/commands/commands-page.tsx +122 -0
  98. package/src/serve/hub-app/commands/commands-st.ts +177 -0
  99. package/src/serve/hub-app/commands.css +24 -0
  100. package/src/serve/hub-app/hash-route.ts +59 -8
  101. package/src/serve/hub-app/home-st.ts +19 -2
  102. package/src/serve/hub-app/home.html +3 -0
  103. package/src/serve/hub-app/hub-app.tsx +8 -0
  104. package/src/serve/hub-app/icons.tsx +5 -0
  105. package/src/serve/hub-app/identities-view.tsx +4 -1
  106. package/src/serve/hub-app/identities.css +1 -0
  107. package/src/serve/hub-app/index.html +3 -0
  108. package/src/serve/hub-app/keys.ts +2 -2
  109. package/src/serve/hub-app/machine-st.ts +41 -10
  110. package/src/serve/hub-app/messages/messages-page.tsx +354 -0
  111. package/src/serve/hub-app/messages/messages-st.ts +74 -0
  112. package/src/serve/hub-app/messages.css +35 -0
  113. package/src/serve/hub-app/project-list.css +7 -2
  114. package/src/serve/hub-app/project-list.tsx +9 -0
  115. package/src/serve/hub-app/projects-svc.ts +16 -6
  116. package/src/serve/hub-app/releases/releases-page.tsx +187 -0
  117. package/src/serve/hub-app/releases/releases-st.ts +111 -0
  118. package/src/serve/hub-app/releases.css +52 -0
  119. package/src/serve/hub-app/repo-sections.ts +16 -2
  120. package/src/serve/hub-app/repo-st.ts +66 -10
  121. package/src/serve/hub-app/review/clip-st.ts +34 -4
  122. package/src/serve/hub-app/review/kit.tsx +3 -3
  123. package/src/serve/hub-app/review/note-place.ts +31 -0
  124. package/src/serve/hub-app/review/review-cells.tsx +27 -3
  125. package/src/serve/hub-app/review/review-st.ts +77 -2
  126. package/src/serve/hub-app/review/review-thread.tsx +9 -31
  127. package/src/serve/hub-app/review/review-views.tsx +164 -58
  128. package/src/serve/hub-app/review/thread-st.ts +108 -41
  129. package/src/serve/hub-app/review/trailer-card.tsx +187 -0
  130. package/src/serve/hub-app/review/trailer-page.tsx +92 -36
  131. package/src/serve/hub-app/review/trailer-st.ts +306 -34
  132. package/src/serve/hub-app/review/trailer-timeline.tsx +68 -23
  133. package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
  134. package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
  135. package/src/serve/hub-app/review.css +137 -6
  136. package/src/serve/hub-app/social/comms-page.tsx +65 -28
  137. package/src/serve/hub-app/social/identity-pictures.ts +46 -8
  138. package/src/serve/hub-app/social/kit.tsx +9 -6
  139. package/src/serve/hub-app/social/next-release.tsx +118 -0
  140. package/src/serve/hub-app/social/post-card.tsx +10 -2
  141. package/src/serve/hub-app/social/social-model.ts +39 -3
  142. package/src/serve/hub-app/social/social-page.tsx +179 -65
  143. package/src/serve/hub-app/social/social-st.ts +117 -27
  144. package/src/serve/hub-app/social/stage-popup.tsx +268 -0
  145. package/src/serve/hub-app/social/stage-st.ts +310 -0
  146. package/src/serve/hub-app/social/step-layout.ts +42 -0
  147. package/src/serve/hub-app/social.css +68 -1
  148. package/src/serve/hub-app/tree-build.ts +40 -1
  149. package/src/serve/hub-app/tree-svc.ts +10 -3
  150. package/src/serve/project-gutter-route.ts +12 -2
  151. package/src/serve/project-gutter.ts +4 -2
  152. package/src/serve/same-origin.ts +24 -1
  153. package/src/serve/serve-hub.ts +15 -1
  154. package/src/shipkit-files.ts +9 -7
  155. package/src/shot/box.ts +33 -12
  156. package/src/shot/client.ts +1 -1
  157. package/src/shot/shooter.ts +22 -12
  158. package/src/shot/shot-ask.ts +14 -3
  159. package/src/shot/shot.shipkit.ts +1 -1
  160. package/src/social/desk-index.ts +49 -8
  161. package/src/social/discord-layout.ts +54 -7
  162. package/src/social/drafts.ts +1 -1
  163. package/src/social/fit.ts +84 -0
  164. package/src/social/identity-words.ts +74 -0
  165. package/src/social/kind-pages.ts +41 -0
  166. package/src/social/kinds.ts +93 -0
  167. package/src/social/load.ts +125 -10
  168. package/src/social/media-limit.ts +63 -2
  169. package/src/social/presence.ts +1 -1
  170. package/src/social/publish/bluesky.ts +58 -19
  171. package/src/social/publish/index.ts +47 -6
  172. package/src/social/reach.ts +49 -0
  173. package/src/social/release-stage.ts +277 -0
  174. package/src/social/routes.ts +44 -8
  175. package/src/social/stage.ts +246 -0
  176. package/src/social/strip.ts +85 -0
  177. package/src/social/text.ts +6 -2
  178. package/src/social/unit.ts +57 -1
  179. package/src/social/writes.ts +11 -0
  180. package/src/trailer/bed.ts +111 -0
  181. package/src/trailer/build.ts +72 -40
  182. package/src/trailer/ffmpeg.ts +6 -0
  183. package/src/trailer/grammar.ts +37 -6
  184. package/src/trailer/graph.ts +12 -1
  185. package/src/trailer/public-words.ts +41 -0
  186. package/src/trailer/shot-plan.ts +75 -0
  187. package/src/trailer/shot-state.ts +191 -0
  188. package/src/trailer/sound/audio.ts +28 -0
  189. package/src/trailer/sound/brand.ts +53 -3
  190. package/src/trailer/sound/gen.ts +61 -2
  191. package/src/trailer/sound/index.ts +25 -11
  192. package/src/trailer/sound/presets.ts +86 -5
  193. package/src/trailer/sound/run.ts +1 -1
  194. package/src/trailer/sound/takes.ts +94 -0
  195. package/src/trailer/titles.ts +36 -0
  196. package/src/trailer/url.ts +1 -1
@@ -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
+ })
@@ -1,21 +1,22 @@
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 pins a frame of the render on screen
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, ShotSummary, 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
+ import { VoiceOpen, VoicesButton, VoicesList } from './trailer-voices.tsx'
19
20
 
20
21
  export const TrailerPage = observer(({ app }: { app: RepoSt }) => {
21
22
  const tr = app.trailer
@@ -23,12 +24,13 @@ export const TrailerPage = observer(({ app }: { app: RepoSt }) => {
23
24
  tr.start()
24
25
  return () => tr.stop()
25
26
  }, [tr])
27
+ const voices = tr.voices.on
26
28
  if (app.review.phone.on)
27
29
  return (
28
30
  <div className="tr-phone">
29
31
  <PhoneTop app={app} />
30
- <PlayerColumn tr={tr} app={app} />
31
- <NotesColumn tr={tr} />
32
+ {voices ? <VoiceOpen tr={tr} /> : <PlayerColumn tr={tr} app={app} />}
33
+ {voices ? <VoicesList tr={tr} /> : <NotesColumn tr={tr} />}
32
34
  <CutList tr={tr} />
33
35
  </div>
34
36
  )
@@ -39,11 +41,11 @@ export const TrailerPage = observer(({ app }: { app: RepoSt }) => {
39
41
  </Panel>
40
42
  <Separator className="rsep" />
41
43
  <Panel id="trailer-player" defaultSize="57%" minSize={420} className="rv-pane" style={PANEL}>
42
- <div className="rv-scroll"><PlayerColumn tr={tr} app={app} /></div>
44
+ <div className="rv-scroll">{voices ? <VoiceOpen tr={tr} /> : <PlayerColumn tr={tr} app={app} />}</div>
43
45
  </Panel>
44
46
  <Separator className="rsep" />
45
47
  <Panel id="trailer-notes" defaultSize="28%" minSize={300} className="rv-pane" style={PANEL}>
46
- <NotesColumn tr={tr} />
48
+ {voices ? <VoicesList tr={tr} /> : <NotesColumn tr={tr} />}
47
49
  </Panel>
48
50
  </KeptCols>
49
51
  )
@@ -66,12 +68,13 @@ const CutList = observer(({ tr }: { tr: TrailerSt }) => (
66
68
  <div className="tr-cuts">
67
69
  {tr.deskError ? <div className="rv-err">{tr.deskError}</div> : null}
68
70
  {tr.trailers.length > 1 ? (
69
- <select value={tr.trailer?.id ?? ''} onChange={(e) => tr.pick(e.currentTarget.value, null)}>
71
+ <select value={tr.trailer?.id ?? ''} onChange={(e) => tr.pick(e.currentTarget.value, null)} title="the trailer folder: trailer/<name>/, its cuts below">
70
72
  {tr.trailers.map((t) => <option key={t.id} value={t.id}>{t.id}</option>)}
71
73
  </select>
72
74
  ) : (
73
75
  <div className="tr-trailername">🎬 {tr.trailer?.id ?? 'trailer'}</div>
74
76
  )}
77
+ {tr.trailer ? <VoicesButton tr={tr} /> : null}
75
78
  {!tr.desk && !tr.deskError ? <div className="rv-empty"><span className="spin" /> reading the cuts…</div> : null}
76
79
  {tr.desk && tr.trailers.length === 0 ? <div className="rv-empty">No trailer under trailer/: write trailer/&lt;name&gt;/main.trailer, then sk trailer.</div> : null}
77
80
  <div className="tr-cutrows">
@@ -116,7 +119,8 @@ const KEYS: [string, string][] = [
116
119
  ['↑ ↓', 'shot back, on'],
117
120
  ['⇧↑ ⇧↓', 'note back, on'],
118
121
  ['N', 'a note on this frame'],
119
- ['click', 'a note pinned to that point'],
122
+ ['drag', 'a note with its rectangle'],
123
+ ['click', 'a note on that frame'],
120
124
  ['M', 'sound'],
121
125
  ['- +', 'timeline zoom'],
122
126
  ['Home', 'to the start'],
@@ -131,10 +135,13 @@ const Keys = () => (
131
135
 
132
136
  // ── the player ──
133
137
 
134
- const PlayerColumn = observer(({ tr, app }: { tr: TrailerSt; app: RepoSt }) => {
138
+ /** the player over its timeline and shot cards: the trailer page's middle, and a trailer card's body; `under` sits right
139
+ * under the timeline (a narrow card's notes rail) */
140
+ export const PlayerColumn = observer(({ tr, app, host, under }: { tr: TrailerSt; app: RepoSt; host?: FrameHost; under?: ReactNode }) => {
135
141
  const c = tr.cut
136
142
  if (!tr.desk) return <div className="rv-empty">{tr.deskError ?? 'Reading the cuts…'}</div>
137
143
  if (!c) return <div className="rv-empty">No cut. A trailer is trailer/&lt;name&gt;/&lt;cut&gt;.trailer, rendered by sk trailer.</div>
144
+ if (!tr.shown && tr.card) return <div className="rv-empty">{tr.error ?? <><span className="spin" /> reading the render…</>}</div>
138
145
  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
146
  return (
140
147
  <div className="tr-player">
@@ -144,22 +151,29 @@ const PlayerColumn = observer(({ tr, app }: { tr: TrailerSt; app: RepoSt }) => {
144
151
  <button className="primary" onClick={() => tr.loadNewer()}>Load it, on the same shot</button>
145
152
  </div>
146
153
  ) : null}
147
- {!tr.newer && c.edited && !c.timelineFromRender ? (
154
+ {!tr.card && !tr.newer && c.edited && !c.timelineFromRender ? (
148
155
  <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
156
  ) : null}
150
- <Player tr={tr} />
157
+ <Player tr={tr} host={host} />
151
158
  <Transport tr={tr} app={app} />
159
+ {tr.voiceError ? <div className="rv-err">{tr.heard === 'takes' ? 'my voice' : tr.ownHere?.standin}: {tr.voiceError}</div> : null}
152
160
  <NowLine tr={tr} />
161
+ <ShotSummary st={tr} />
153
162
  <TrailerTimeline st={tr} />
163
+ {under}
154
164
  <ShotCards st={tr} />
155
165
  <Montage tr={tr} />
156
166
  </div>
157
167
  )
158
168
  })
159
169
 
160
- const Player = observer(({ tr }: { tr: TrailerSt }) => {
170
+ /** the render on screen, as tall as leaves the transport and the timeline in view (`--tr-room`); `host` (a trailer
171
+ * card) frames the picture with a review card's own rectangles, else a drag on it draws a frame note's rectangle and a
172
+ * click writes a note on the frame */
173
+ const Player = observer(({ tr, host }: { tr: TrailerSt; host?: FrameHost | undefined }) => {
161
174
  const shown = tr.shown
162
175
  const ref = useRef<HTMLVideoElement>(null)
176
+ const [drag, setDrag] = useState<Parameters<typeof DragBox>[0]['c']>(null)
163
177
  const src = tr.videoUrl
164
178
  useEffect(() => {
165
179
  const el = ref.current
@@ -168,30 +182,51 @@ const Player = observer(({ tr }: { tr: TrailerSt }) => {
168
182
  }, [tr, src])
169
183
  if (!shown || !src) return null
170
184
  const [w, h] = shown.timeline.size
185
+ const width = `min(100%, calc((100vh - var(--tr-room, 420px)) * ${w / h}))`
186
+ const video = <video ref={ref} src={src} playsInline preload="auto" onEnded={() => tr.clock.pause()} />
187
+ const paused = tr.clock.paused ? <div className="tr-paused">❚❚ {clock(tr.time)} · frame {tr.frame + 1}{tr.shot ? ` · ${tr.shot.name}` : ''}</div> : null
188
+ if (host)
189
+ return (
190
+ <div className="tr-screen">
191
+ <div className="tr-frame" style={{ width }}>
192
+ {host(video, `${w} / ${h}`)}
193
+ {paused}
194
+ </div>
195
+ </div>
196
+ )
171
197
  return (
172
198
  <div className="tr-screen">
173
- <div className="tr-frame" style={{ width: `min(100%, calc(64vh * ${w / h}))`, aspectRatio: `${w} / ${h}` }}>
174
- <video ref={ref} src={src} playsInline preload="auto" onEnded={() => tr.clock.pause()} />
175
- <div className="tr-clickzone" title="click: a note pinned to this point"
176
- onClick={(e) => {
177
- const r = e.currentTarget.getBoundingClientRect()
178
- tr.clickFrame({ x: (e.clientX - r.left) / r.width, y: (e.clientY - r.top) / r.height })
199
+ <div className="tr-frame" style={{ width, aspectRatio: `${w} / ${h}` }}>
200
+ {video}
201
+ <div className="tr-clickzone" title="drag: a note with its rectangle · click: a note on this frame"
202
+ onPointerDown={(e) => {
203
+ if (e.button !== 0) return
204
+ e.preventDefault()
205
+ // he draws on the paused frame: the note keeps its time
206
+ if (!tr.clock.paused) tr.clock.pause()
207
+ dragBox(e, e.currentTarget, setDrag, (r) => tr.drawFrame(r))
179
208
  }}>
180
- <FramePins tr={tr} />
209
+ <FrameMarks tr={tr} />
210
+ <DragBox c={drag} />
181
211
  </div>
182
- {tr.clock.paused ? <div className="tr-paused">❚❚ frame {tr.frame + 1}</div> : null}
212
+ {paused}
183
213
  </div>
184
214
  </div>
185
215
  )
186
216
  })
187
217
 
188
- /** the pins of the notes on this frame, and the draft's */
189
- const FramePins = observer(({ tr }: { tr: TrailerSt }) => {
218
+ /** what frames the picture of a trailer card: the video, the frame's aspect, the picture to draw */
219
+ export type FrameHost = (video: ReactNode, aspect: string) => ReactNode
220
+
221
+ /** 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 */
222
+ const FrameMarks = observer(({ tr }: { tr: TrailerSt }) => {
190
223
  const d = tr.draft
224
+ const mark = (key: string, m: NoteMark, n: string, text: string, state: string, on: boolean, pulse = false) =>
225
+ 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
226
  return (
192
227
  <>
193
- {tr.pinsNow.map((n) => <Pin key={n.note.id} x={n.note.pin!.x} y={n.note.pin!.y} state={n.note.state} label={String(n.note.n)} on={tr.selected === n.note.id} />)}
194
- {d?.pin ? <Pin x={d.pin.x} y={d.pin.y} state="open" label="+" on pulse /> : null}
228
+ {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))}
229
+ {d?.mark ? mark('draft', d.mark, '+', d.text, 'open', true, true) : null}
195
230
  </>
196
231
  )
197
232
  })
@@ -225,14 +260,34 @@ const Transport = observer(({ tr, app }: { tr: TrailerSt; app: RepoSt }) => {
225
260
  </div>
226
261
  <span className="sp" />
227
262
  <span className="seg">{RATES.map((r) => <button key={r} className={c.rate === r ? 'on' : ''} onMouseDown={keepFocus} onClick={() => c.setRate(r)}>×{r}</button>)}</span>
263
+ <VoiceToggle tr={tr} />
228
264
  <ClipSound clip={c} keyHint="M" />
229
265
  {href && file ? <a className="tr-file" href={href} title={`open ${file} in the editor`}>{file.split('/').pop()}</a> : null}
230
266
  {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>
267
+ {tr.card ? null : <button className="tr-notebtn" onMouseDown={keepFocus} onClick={() => tr.newNote()}>✚ Note (N)</button>}
232
268
  </div>
233
269
  )
234
270
  })
235
271
 
272
+ /** the whole cut in his voice or its standin's, on a working cut with lines of his voice; a side being made holds the
273
+ * play until it is */
274
+ const VoiceToggle = observer(({ tr }: { tr: TrailerSt }) => {
275
+ const o = tr.ownHere
276
+ if (!o) return null
277
+ const side = (s: 'standin' | 'takes', label: string) => (
278
+ <button className={tr.heard === s ? 'on' : ''} onMouseDown={keepFocus} onClick={() => tr.setVoice(s)}>{label}</button>
279
+ )
280
+ return (
281
+ <>
282
+ <span className="tv-hear" title={`the whole cut read by ${o.standin}, or by ${o.who}: his takes, ${o.standin} on the lines he has not recorded`}>
283
+ {side('standin', o.standin)}
284
+ {side('takes', 'my voice')}
285
+ </span>
286
+ {tr.voicing ? <span className="tr-dim tr-small"><span className="spin" /> making…</span> : null}
287
+ </>
288
+ )
289
+ })
290
+
236
291
  /** what is on screen: the section, the shot and the time into it, the caption shown */
237
292
  const NowLine = observer(({ tr }: { tr: TrailerSt }) => {
238
293
  const s = tr.shot
@@ -242,7 +297,7 @@ const NowLine = observer(({ tr }: { tr: TrailerSt }) => {
242
297
  <div className="tr-now">
243
298
  <span className={`tr-secbadge ${hueOf(tl, s.section)}`}>{s.section ?? 'opening'}</span>
244
299
  <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} s · line {s.line}</span>
300
+ <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
301
  {tr.captions.map((c) => <span key={`${c.start}${c.text}`} className="tr-capnow">« {captionText(c)} »</span>)}
247
302
  </div>
248
303
  )
@@ -268,10 +323,10 @@ const DraftBox = observer(({ tr }: { tr: TrailerSt }) => {
268
323
  <div className="tr-draft">
269
324
  <div className="tr-drafthead">
270
325
  <b>New note · {clock(d.time)} · {s?.name}</b>
271
- {d.pin ? (
272
- <span><span className="tr-pinned">📍 pinned</span> <button className="ghost" onClick={() => tr.unpinDraft()}>remove</button></span>
326
+ {d.mark ? (
327
+ <span><span className="tr-pinned">▭ marked</span> <button className="ghost" onClick={() => tr.unmarkDraft()}>remove</button></span>
273
328
  ) : (
274
- <span className="tr-dim tr-small">click the image to pin a point</span>
329
+ <span className="tr-dim tr-small">drag on the image to mark a spot</span>
275
330
  )}
276
331
  </div>
277
332
  <AutoText autoFocus rows={3} placeholder="What is wrong, what you want instead…" value={d.text} onText={(t) => tr.setDraftText(t)}
@@ -352,7 +407,7 @@ const NoteCard = observer(({ tr, n: p }: { tr: TrailerSt; n: PlacedNote }) => {
352
407
  {!on ? <Still tr={tr} n={n} w={112} /> : null}
353
408
  <div className="tr-notebody">
354
409
  <div className="tr-notemeta">
355
- <span className="tr-mono tr-dim" title={n.id}>#{n.n}</span>
410
+ <span className="tr-notenum" title={n.id}>{p.n}</span>
356
411
  <b className="tr-mono">{p.at !== null ? clock(p.at) : `${n.cut} ${clock(n.time)}`}</b>
357
412
  <span className={`tr-secbadge small ${tr.timeline ? hueOf(tr.timeline, n.section) : 'hue-none'}`}>{n.shot}</span>
358
413
  {n.state !== 'open' ? <span className={`tr-statebadge ns-${n.state}`}>{n.state === 'done' ? '✓' : '⊘'} {STATE_LABEL[n.state]}</span> : null}
@@ -366,7 +421,7 @@ const NoteCard = observer(({ tr, n: p }: { tr: TrailerSt; n: PlacedNote }) => {
366
421
  {editing ? (
367
422
  <div className="tr-edit">
368
423
  <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 click moves the pin</div>
424
+ <div className="tr-dim tr-small">Enter saves · Escape drops it · on its frame, a drag draws its rectangle again</div>
370
425
  </div>
371
426
  ) : null}
372
427
  {n.reply && !closing ? (
@@ -396,7 +451,7 @@ const NoteCard = observer(({ tr, n: p }: { tr: TrailerSt; n: PlacedNote }) => {
396
451
  ) : (
397
452
  <button onClick={() => void tr.reopen(n)}>↺ Reopen</button>
398
453
  )}
399
- {n.pin ? <button className="ghost" onClick={() => void tr.unpin(n)}>📍 Unpin</button> : null}
454
+ {n.mark ? <button className="ghost" onClick={() => void tr.unmark(n)}>Remove the mark</button> : null}
400
455
  <span className="sp" />
401
456
  <button className={`tr-delete${sure ? ' sure' : ''}`} onClick={() => (sure ? void tr.remove(n) : setSure(true))} onMouseLeave={() => setSure(false)}>
402
457
  {sure ? 'Sure?' : 'Delete'}
@@ -407,13 +462,14 @@ const NoteCard = observer(({ tr, n: p }: { tr: TrailerSt; n: PlacedNote }) => {
407
462
  )
408
463
  })
409
464
 
410
- /** a note's still, as cut when he wrote it, with its pin */
465
+ /** a note's still, as cut when he wrote it, with its rectangle or its point */
411
466
  const Still = ({ tr, n, w }: { tr: TrailerSt; n: TrailerNote; w: number | string }) => {
412
467
  const [sw, sh] = tr.shown?.timeline.size ?? [16, 9]
468
+ const m = n.mark
413
469
  return (
414
470
  <div className={`tr-still${typeof w === 'string' ? ' wide' : ''}`} style={{ width: w, aspectRatio: `${sw} / ${sh}` }}>
415
471
  <img src={tr.stillUrl(n)} alt="" loading="lazy" />
416
- {n.pin ? <div className={`tr-stillpin ns-${n.state}`} style={{ left: `${n.pin.x * 100}%`, top: `${n.pin.y * 100}%` }} /> : null}
472
+ {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
473
  </div>
418
474
  )
419
475
  }