Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Place and size a shot's lyrics in any render that draws them (#11570)
[._.]/bbf92ee2c8be
diff --git a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx b/client/src/components/musicVideo/CompositionPreviewPlayer.jsxindex 49637e9aa7..b65bd24f5f 100644--- a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx+++ b/client/src/components/musicVideo/CompositionPreviewPlayer.jsx@@ -13,7 +13,7 @@ export const playthroughVersion = (project) => JSON.stringify([project.audioAnalysis?.durationSec ?? null,(project.lyricCues || []).map((cue) => [cue.text, cue.startSec, cue.endSec, (cue.words || []).map((w) => [w.startSec, w.endSec])]),(project.lyricMarkers || []).map((m) => [m.type, m.label, m.line]),- (project.scenes || []).map((s) => [s.startSec, s.endSec, s.textZone, s.lyricRole]),+ (project.scenes || []).map((s) => [s.startSec, s.endSec, s.textZone, s.lyricRole, s.lyricSize]),]);/** The lyric line sung at song time `t`, from the project's timed cues. */diff --git a/client/src/components/musicVideo/SceneCard.jsx b/client/src/components/musicVideo/SceneCard.jsxindex f2f0a9f563..6a0523310b 100644--- a/client/src/components/musicVideo/SceneCard.jsx+++ b/client/src/components/musicVideo/SceneCard.jsx@@ -18,14 +18,12 @@ import { isPerformanceScene, planPerformanceRepair } from '../../lib/musicVideoSimport SceneTakeStrip from './SceneTakeStrip.jsx';import { sceneEndFramePlanFor } from './SceneEndFrame.jsx';import SceneFrames from './SceneFrames.jsx';-import { CLIP_TIMING_FPS, MUSIC_VIDEO_LYRIC_ROLES, MUSIC_VIDEO_TEXT_ZONES, MUSIC_VIDEO_VISUAL_LAYERS, clipReversed, sceneHasAuthoredSpan } from '../../lib/musicVideoLayers.js';+import { CLIP_TIMING_FPS, MUSIC_VIDEO_VISUAL_LAYERS, clipReversed, composedDrawsLyrics, sceneHasAuthoredSpan } from '../../lib/musicVideoLayers.js';// #8985: what a composed render shows for this scene's span.const LAYER_LABELS = { footage: 'Footage', still: 'Still image', card: 'Title card', code: 'Code-drawn' };const STILL_MOVE_LABELS = [['hold', 'Hold'], ['push', 'Push in'], ['pan', 'Pan']];// #10583: the shared lyric type's zone and style for this shot (composition documents).-const TEXT_ZONE_LABELS = { 'lower-left': 'Lower left', 'upper-right': 'Upper right', upper: 'Upper centre', lower: 'Lower centre', center: 'Centre', none: 'No lyrics' };-const LYRIC_ROLE_LABELS = { line: 'Sung line', hook: 'Hook slam', stamp: 'Stamp', data: 'Data caption' };const SHOT_MODE_LABELS = { cutaway: 'Cutaway', performance: 'Performance (lip-sync)', music: 'Performance (music-driven)' };const PRIMARY_BUTTON = 'flex items-center gap-1 bg-port-border hover:bg-port-border/70 disabled:opacity-50 rounded px-2 py-1.5 text-xs min-h-[44px] sm:min-h-0 whitespace-nowrap';const SECONDARY_BUTTON = 'flex items-center gap-1 bg-port-bg border border-port-border hover:bg-port-border/40 disabled:opacity-50 rounded px-2 py-1.5 text-xs min-h-[44px] sm:min-h-0 whitespace-nowrap';@@ -41,6 +39,7 @@ import SceneFrameFit from './SceneFrameFit.jsx';import SceneCutEffect from './SceneCutEffect.jsx';import { plannedTransitions } from '../../lib/musicVideoCutEffects.js';import SceneGlitches from './SceneGlitches.jsx';+import SceneLyricType from './SceneLyricType.jsx';import SceneTransitions from './SceneTransitions.jsx';import SceneImageEffect from './SceneImageEffect.jsx';import ScenePicturePreview from './ScenePicturePreview.jsx';@@ -242,6 +241,8 @@ export default function SceneCard({planned={plannedTransitions(project?.productionReview?.draft?.storyboard).get(scene.sceneId)} />{/* Glitches at moments inside the shot, set and moved on a slider; they add no time. */}<SceneGlitches fieldId={fieldId} scene={scene} onChange={applyPatch} />+ {/* Where the lyrics over this shot sit, their style and size, whenever the render draws lyrics (a card draws its own text). */}+ {(documentComposition || (layer !== 'card' && composedDrawsLyrics(project))) && <SceneLyricType fieldId={fieldId} scene={scene} onChange={applyPatch} />}{/* Everything set once and rarely revisited: timing, shot mode, layer, and a non-footage shot's camera. */}<details className="group/settings rounded border border-port-border"><summary className="flex min-h-[44px] cursor-pointer items-center gap-2 px-2 text-xs marker:content-none sm:min-h-[32px] [&::-webkit-details-marker]:hidden">@@ -318,24 +319,6 @@ export default function SceneCard({className="h-8 w-10 min-h-[44px] sm:min-h-0 bg-port-bg border border-port-border rounded" /></>)}- {documentComposition && (- <>- <label htmlFor={fieldId('text-zone')}>Lyrics</label>- <select id={fieldId('text-zone')} value={scene.textZone || ''} onChange={(e) => applyPatch({ textZone: e.target.value || null })}- title="Where the lyric type may sit in this shot, so it stays off the subject"- className="bg-port-bg border border-port-border rounded px-1 py-1 min-h-[44px] sm:min-h-0">- <option value="">Default zone</option>- {MUSIC_VIDEO_TEXT_ZONES.map((value) => <option key={value} value={value}>{TEXT_ZONE_LABELS[value]}</option>)}- </select>- <label htmlFor={fieldId('lyric-role')} className="sr-only">Lyric style</label>- <select id={fieldId('lyric-role')} value={scene.lyricRole || ''} onChange={(e) => applyPatch({ lyricRole: e.target.value || null })}- title="The lyric style of the lines sung over this shot"- className="bg-port-bg border border-port-border rounded px-1 py-1 min-h-[44px] sm:min-h-0">- <option value="">Style from the lyric sheet</option>- {MUSIC_VIDEO_LYRIC_ROLES.map((value) => <option key={value} value={value}>{LYRIC_ROLE_LABELS[value]}</option>)}- </select>- </>- )}</div>{layer !== 'footage' && !layered && (<p className="text-[11px] text-port-text-muted">diff --git a/client/src/components/musicVideo/SceneCard.test.jsx b/client/src/components/musicVideo/SceneCard.test.jsxindex 2415dc94d5..e0e0e38735 100644--- a/client/src/components/musicVideo/SceneCard.test.jsx+++ b/client/src/components/musicVideo/SceneCard.test.jsx@@ -207,22 +207,27 @@ describe('planned camera move (#10589)', () => {});describe('lyric type per shot (#10583)', () => {- it('lets a composition-document shot pick its lyric zone and style, and clears back to the defaults', () => {+ it('lets a shot pick where its lyrics sit, their style and size whenever the render draws lyrics', () => {const onSave = vi.fn();const scene = { sceneId: 's1', startSec: 0, endSec: 5, takes: [], textZone: 'upper-right' };- const { rerender } = render(<SceneCard scene={scene} index={0} layered onEditLocal={() => {}} onSave={onSave} />);- // Only a composition document draws the shared lyric type.+ const composed = { composition: { mode: 'composed', textCues: [] }, lyricCues: [{ text: 'a sung line', startSec: 1, endSec: 3 }] };+ const { rerender } = render(<SceneCard scene={scene} index={0} layered project={{ composition: { mode: 'composed', textCues: [] } }} onEditLocal={() => {}} onSave={onSave} />);+ // A composed render with no timed lyrics draws none, so there is nothing to place.expect(screen.queryByLabelText('Lyrics')).toBeNull();- rerender(<SceneCard scene={scene} index={0} layered documentComposition onEditLocal={() => {}} onSave={onSave} />);+ rerender(<SceneCard scene={scene} index={0} layered project={composed} onEditLocal={() => {}} onSave={onSave} />);expect(screen.getByLabelText('Lyrics').value).toBe('upper-right');- for (const [label, value] of [['Upper centre', 'upper'], ['Lower centre', 'lower']]) {+ for (const [label, value] of [['Bottom', 'lower'], ['Bottom right', 'lower-right'], ['Top left', 'upper-left']]) {expect(screen.getByRole('option', { name: label }).value).toBe(value);fireEvent.change(screen.getByLabelText('Lyrics'), { target: { value } });}- fireEvent.change(screen.getByLabelText('Lyrics'), { target: { value: 'none' } });fireEvent.change(screen.getByLabelText('Lyric style'), { target: { value: 'stamp' } });+ fireEvent.change(screen.getByLabelText('Lyric size'), { target: { value: 'small' } });fireEvent.change(screen.getByLabelText('Lyrics'), { target: { value: '' } });- expect(onSave.mock.calls).toEqual([['s1', { textZone: 'upper' }], ['s1', { textZone: 'lower' }], ['s1', { textZone: 'none' }], ['s1', { lyricRole: 'stamp' }], ['s1', { textZone: null }]]);+ expect(onSave.mock.calls).toEqual([['s1', { textZone: 'lower' }], ['s1', { textZone: 'lower-right' }], ['s1', { textZone: 'upper-left' }],+ ['s1', { lyricRole: 'stamp' }], ['s1', { lyricSize: 'small' }], ['s1', { textZone: null }]]);+ // A composition document always draws the lyric type.+ rerender(<SceneCard scene={scene} index={0} layered documentComposition onEditLocal={() => {}} onSave={onSave} />);+ expect(screen.getByLabelText('Lyrics')).toBeTruthy();});});diff --git a/client/src/components/musicVideo/SceneLyricType.jsx b/client/src/components/musicVideo/SceneLyricType.jsxnew file mode 100644index 0000000000..a94d46c0bd--- /dev/null+++ b/client/src/components/musicVideo/SceneLyricType.jsx@@ -0,0 +1,43 @@+import { MUSIC_VIDEO_LYRIC_ROLES, MUSIC_VIDEO_LYRIC_SIZES } from '../../lib/musicVideoLayers.js';++// The lyric spots in reading order: the top row, the middle, the bottom row, then none.+const ZONES = [+ ['upper-left', 'Top left'], ['upper', 'Top'], ['upper-right', 'Top right'], ['center', 'Centre'],+ ['lower-left', 'Bottom left'], ['lower', 'Bottom'], ['lower-right', 'Bottom right'], ['none', 'No lyrics'],+];+const ROLE_LABELS = { line: 'Sung line', hook: 'Hook slam', stamp: 'Stamp', data: 'Data caption' };+const SIZE_LABELS = { small: 'Small', large: 'Large' };+const SELECT = 'min-w-0 bg-port-bg border border-port-border rounded px-1 py-1 min-h-[44px] sm:min-h-0';++/**+ * Where the lyrics sung over a shot sit, their style and size. The player and+ * the final render both draw them this way; Auto keeps the lyric sheet's choice.+ */+export default function SceneLyricType({ fieldId, scene, onChange }) {+ return (+ <div className="flex flex-wrap items-center gap-2 text-xs">+ <label htmlFor={fieldId('text-zone')} className="font-medium">Lyrics</label>+ <select id={fieldId('text-zone')} value={scene.textZone || ''} onChange={(e) => onChange({ textZone: e.target.value || null })}+ title="Where the lyrics sit in this shot, so they stay off the subject" className={SELECT}>+ <option value="">Auto spot</option>+ {ZONES.map(([value, text]) => <option key={value} value={value}>{text}</option>)}+ </select>+ {scene.textZone !== 'none' && (+ <>+ <label htmlFor={fieldId('lyric-role')} className="sr-only">Lyric style</label>+ <select id={fieldId('lyric-role')} value={scene.lyricRole || ''} onChange={(e) => onChange({ lyricRole: e.target.value || null })}+ title="The style of the lines sung over this shot" className={SELECT}>+ <option value="">Auto style</option>+ {MUSIC_VIDEO_LYRIC_ROLES.map((value) => <option key={value} value={value}>{ROLE_LABELS[value]}</option>)}+ </select>+ <label htmlFor={fieldId('lyric-size')} className="sr-only">Lyric size</label>+ <select id={fieldId('lyric-size')} value={scene.lyricSize || ''} onChange={(e) => onChange({ lyricSize: e.target.value || null })}+ title="The lyric size over this shot" className={SELECT}>+ <option value="">Normal size</option>+ {MUSIC_VIDEO_LYRIC_SIZES.map((value) => <option key={value} value={value}>{SIZE_LABELS[value]}</option>)}+ </select>+ </>+ )}+ </div>+ );+}diff --git a/client/src/components/musicVideo/SceneTakePicker.test.jsx b/client/src/components/musicVideo/SceneTakePicker.test.jsxindex 5caa5fe436..e8ad33cfa5 100644--- a/client/src/components/musicVideo/SceneTakePicker.test.jsx+++ b/client/src/components/musicVideo/SceneTakePicker.test.jsx@@ -104,6 +104,8 @@ describe('Swap from unused', () => {});render(<SceneTakePicker open projectId="mv-1" scene={{ sceneId: 's8' }} kind="image" onPlace={vi.fn()} shotNumbers={new Map()} />);await waitFor(() => expect(screen.getAllByRole('listitem')).toHaveLength(60));+ // The footer starts observing in an effect that can land after the first page paints.+ await waitFor(() => expect(observers.length).toBeGreaterThan(0));act(() => observers.at(-1).fire());await waitFor(() => expect(screen.getAllByRole('listitem')).toHaveLength(70));expect(screen.queryByRole('button', { name: /Show more/ })).toBeNull();diff --git a/client/src/lib/musicVideoLayers.js b/client/src/lib/musicVideoLayers.jsindex 21017de8b2..85eeac3829 100644--- a/client/src/lib/musicVideoLayers.js+++ b/client/src/lib/musicVideoLayers.js@@ -9,6 +9,7 @@ export {MUSIC_VIDEO_FRAME_FITS,MUSIC_VIDEO_TEXT_ZONES,MUSIC_VIDEO_LYRIC_ROLES,+ MUSIC_VIDEO_LYRIC_SIZES,composedDrawsLyrics,isSelfDrawnLayer,sceneVisualLayer,diff --git a/docs/HTML_COMPOSITIONS.md b/docs/HTML_COMPOSITIONS.mdindex 65575e5478..ce31cd025a 100644--- a/docs/HTML_COMPOSITIONS.md+++ b/docs/HTML_COMPOSITIONS.md@@ -239,7 +239,7 @@ in the shared lyric type, exactly as the storyboard animatic shows them: itstages the animatic's lyric overlay page (`documentTemplates/lyricOverlay`)beside the typography page and captures it over each line's window(`composedLyricWindows`, the first onset to two seconds past the line's end).-Each shot's Text zone and Lyric role apply; a title card shot already draws its+Each shot's lyric placement, style and size apply; a title card shot already draws itstext (else its sung line), so the overlay keeps its lines off it. A Subtitle cue hands the wordsback to the text cues, so "Copy timed lyrics" swaps the lyric type for plainsubtitles.@@ -427,7 +427,7 @@ snapshot freezes (`server/services/musicVideo/documentRender.js`):{ width, height, fps, frames, durationSec }, song: { durationSec, bpm, beats,downbeats, sections, words }, lyrics, lyricMarkers, scenes: [{ sceneId,label, startSec, endSec, shotMode, visualLayer, stillMove, cardText,- cardColor, textZone, lyricRole, lyricText, direction, media: { kind, src, inSec, outSec, fps,+ cardColor, textZone, lyricRole, lyricSize, lyricText, direction, media: { kind, src, inSec, outSec, fps,width, height } | null }], textCues, composition: { mode, style, posterSec,overlay } }`. Load it with `<script src="portos-mv.js">`; the sandboxrefuses `fetch`.@@ -513,9 +513,11 @@ and its repeats come back as sung lines unless `hookRepeats: 'hook'`),at most one per shot). A per-line override or the line's own `role` wins,then the shot's `lyricRole`, then the lyric sheet: the line's `lyricMarkers`delivery direction (spoken/shouted lines stamp), else its section header-(choruses, hooks, refrains and drops are hooks), else `line`. Each shot's `textZone` (`lower-left`, `upper-right`,-centred `upper` / `lower`, `center`, or `none` to keep the shot clear) places-the words so they never cover the subject. A line never shows before its first word onset, stays at+(choruses, hooks, refrains and drops are hooks), else `line`. Each shot's `textZone` (the corners `upper-left`, `upper-right`,+`lower-left`, `lower-right`, centred `upper` / `lower`, `center`, or `none` to+keep the shot clear) places the words so they never cover the subject, and its+`lyricSize` (`small`, `large`, or null for normal; `LYRIC_SIZE_SCALE`) scales the+type and its share of the frame, never below the floor. A line never shows before its first word onset, stays atleast 0.8s, and sung type stays at least 56px at 1080p. Type stays out of thepicture's way: one caption covers at most 6% of the frame (hooks 10%, datareadouts 4%; `LYRIC_FIT`) in at most two balanced rows, shrinking to fit butdiff --git a/server/lib/musicVideoLayers.js b/server/lib/musicVideoLayers.jsindex d2f8385558..e1d62d4ca8 100644--- a/server/lib/musicVideoLayers.js+++ b/server/lib/musicVideoLayers.js@@ -36,7 +36,9 @@ export const MUSIC_VIDEO_FRAME_FITS = ['fill', 'still', 'vhs', 'black'];* lines sung over it. Both are optional; a shot without them takes the sheet's roles* and the module's default zone.*/-export const MUSIC_VIDEO_TEXT_ZONES = ['lower-left', 'upper-right', 'upper', 'lower', 'center', 'none'];+export const MUSIC_VIDEO_TEXT_ZONES = ['lower-left', 'upper-right', 'upper', 'lower', 'center', 'none', 'lower-right', 'upper-left'];+// A shot's lyric size: a step down or up from the type's own size (null is normal).+export const MUSIC_VIDEO_LYRIC_SIZES = ['small', 'large'];export const MUSIC_VIDEO_LYRIC_ROLES = ['line', 'hook', 'stamp', 'data'];/**diff --git a/server/lib/musicVideoValidation.js b/server/lib/musicVideoValidation.jsindex d1ee1d59da..4745f4dc75 100644--- a/server/lib/musicVideoValidation.js+++ b/server/lib/musicVideoValidation.js@@ -52,7 +52,7 @@ import { EFFORT_LEVELS } from './providerModels.js';import { shotActionContractProblem } from './musicVideoActionContract.js';import { NARRATIVE_EVENT_KINDS } from './musicVideoNarrativeEvents.js';import { MUSIC_VIDEO_MEDIA } from './musicVideoMediumPlan.js';-import { CLIP_OFFSET_FRAMES_RANGE, CLIP_SPEED_FPS_RANGE, MUSIC_VIDEO_FRAME_FITS, MUSIC_VIDEO_LYRIC_ROLES, MUSIC_VIDEO_STILL_MOVES, MUSIC_VIDEO_TEXT_ZONES, MUSIC_VIDEO_VISUAL_LAYERS } from './musicVideoLayers.js';+import { CLIP_OFFSET_FRAMES_RANGE, CLIP_SPEED_FPS_RANGE, MUSIC_VIDEO_FRAME_FITS, MUSIC_VIDEO_LYRIC_ROLES, MUSIC_VIDEO_LYRIC_SIZES, MUSIC_VIDEO_STILL_MOVES, MUSIC_VIDEO_TEXT_ZONES, MUSIC_VIDEO_VISUAL_LAYERS } from './musicVideoLayers.js';import { MUSIC_VIDEO_SHOT_GLITCH_LIMIT, MUSIC_VIDEO_TRANSITIONS } from './musicVideoTransitions.js';import { BEAT_TOGGLE_OVERLAP, BEAT_TOGGLE_RATES, MUSIC_VIDEO_CUT_EFFECTS } from './musicVideoCutEffects.js';import { IMAGE_EFFECT_SEC_RANGE, MUSIC_VIDEO_IMAGE_EFFECTS } from './musicVideoImageEffects.js';@@ -663,6 +663,7 @@ const sceneLayerFields = {// #10583: where a composition document's lyric type may sit in this shot, and the role of its lines.textZone: z.enum(MUSIC_VIDEO_TEXT_ZONES).nullable().optional(),lyricRole: z.enum(MUSIC_VIDEO_LYRIC_ROLES).nullable().optional(),+ lyricSize: z.enum(MUSIC_VIDEO_LYRIC_SIZES).nullable().optional(),};// ---- Pre-production treatment (#8980) --------------------------------------diff --git a/server/services/musicVideo/documentRender.js b/server/services/musicVideo/documentRender.jsindex 2a3813eda2..2ca406a915 100644--- a/server/services/musicVideo/documentRender.js+++ b/server/services/musicVideo/documentRender.js@@ -38,7 +38,7 @@ import { ServerError } from '../../lib/errorHandler.js';import { PATHS } from '../../lib/fileUtils.js';import { htmlCompositionContractSchemaFor } from '../../lib/validation.js';import { selectedPerformanceInstruction } from '../../lib/musicVideoShotTiming.js';-import { clipSpeedRate, clipOffsetSec, documentSceneVisualLayer, MUSIC_VIDEO_LYRIC_ROLES, MUSIC_VIDEO_TEXT_ZONES } from '../../lib/musicVideoLayers.js';+import { clipSpeedRate, clipOffsetSec, documentSceneVisualLayer, MUSIC_VIDEO_LYRIC_ROLES, MUSIC_VIDEO_LYRIC_SIZES, MUSIC_VIDEO_TEXT_ZONES } from '../../lib/musicVideoLayers.js';import { musicVideoAspect } from '../../lib/musicVideoAspect.js';import { documentDirectoryForRender } from './compositionDocument.js';import { musicVideoSongDocument } from './compositionRender.js';@@ -232,6 +232,7 @@ export function buildDocumentData(project, { media = new Map(), frame, clock, socardColor: typeof scene.cardColor === 'string' ? scene.cardColor : null,textZone: MUSIC_VIDEO_TEXT_ZONES.includes(scene.textZone) ? scene.textZone : null,lyricRole: MUSIC_VIDEO_LYRIC_ROLES.includes(scene.lyricRole) ? scene.lyricRole : null,+ lyricSize: MUSIC_VIDEO_LYRIC_SIZES.includes(scene.lyricSize) ? scene.lyricSize : null,lyricText: typeof scene.lyricText === 'string' ? scene.lyricText : null,visualIntent: typeof scene.visualIntent === 'string' ? scene.visualIntent : null,direction: sceneDirection(project, scene.sceneId),diff --git a/server/services/musicVideo/documentTemplates/shared/lyricType.js b/server/services/musicVideo/documentTemplates/shared/lyricType.jsindex 4198ec4c74..ddc8eedac7 100644--- a/server/services/musicVideo/documentTemplates/shared/lyricType.js+++ b/server/services/musicVideo/documentTemplates/shared/lyricType.js@@ -40,7 +40,9 @@*/export const LYRIC_ROLES = Object.freeze(['line', 'hook', 'stamp', 'data']);-export const TEXT_ZONES = Object.freeze(['lower-left', 'upper-right', 'upper', 'lower', 'center', 'none']);+export const TEXT_ZONES = Object.freeze(['lower-left', 'upper-right', 'upper', 'lower', 'center', 'none', 'lower-right', 'upper-left']);+// A shot's lyric size scales the type's own size (and its share of the frame); null is normal.+export const LYRIC_SIZE_SCALE = Object.freeze({ small: 0.8, large: 1.25 });export const DEFAULT_PALETTE = Object.freeze({ fill: '#f3ead7', ink: '#141217', accent: '#ff5a1f', strike: '#ff2a2a' });export const DEFAULT_FONTS = Object.freeze({ display: '"MV Archivo", "Arial Black", Impact, sans-serif', mono: '"MV Mono", Menlo, monospace' });@@ -219,6 +221,15 @@ function zoneRect(zone, width, height) {const w = portrait ? width - 2 * insetX : width * 0.46;return { zone, x: width - insetX - w, y: insetY, w, h: height * 0.3, align: 'right', anchor: 'top' };}+ case 'upper-left': {+ const w = portrait ? width - 2 * insetX : width * 0.46;+ return { zone, x: insetX, y: insetY, w, h: height * 0.3, align: 'left', anchor: 'top' };+ }+ case 'lower-right': {+ const w = portrait ? width - 2 * insetX : width * 0.5;+ const h = height * 0.3;+ return { zone, x: width - insetX - w, y: height - insetY - h, w, h, align: 'right', anchor: 'bottom' };+ }case 'lower-left':default: {const w = portrait ? width - 2 * insetX : width * 0.5;@@ -392,7 +403,8 @@ export function createLyricType(mv = globalThis.PORTOS_MV, options = {}) {if (!rect) return null;const unit = Math.min(width, height) / 1080;const floor = (line.role === 'data' ? 40 : T.minPx) * unit;- let px = basePx(line.role, unit, height > width);+ const scale = LYRIC_SIZE_SCALE[line.shot?.lyricSize] || 1;+ let px = Math.max(floor, basePx(line.role, unit, height > width) * scale);const items = line.words.map((w) => (line.role === 'hook' ? String(w.text).toUpperCase() : w.text));const rowsAt = (size) => {const list = items.map((text, index) => ({ text, index }));@@ -408,7 +420,7 @@ export function createLyricType(mv = globalThis.PORTOS_MV, options = {}) {const lineHOf = (size) => size * (line.role === 'data' ? 1.3 : 1.02);// The area the caption's rows cover at a size (row widths × row height).const cover = (size, at) => at.reduce((sum, row) => sum + row.reduce((w, item) => w + measure(`${item.text} `, fontFor(line.role, size)), 0), 0) * lineHOf(size);- const budget = (LYRIC_FIT.maxCover[line.role] ?? LYRIC_FIT.maxCover.line) * width * height;+ const budget = (LYRIC_FIT.maxCover[line.role] ?? LYRIC_FIT.maxCover.line) * scale * scale * width * height;while ((rows.length > LYRIC_FIT.maxRows || rows.length * px * 1.05 > rect.h || cover(px, rows) > budget) && px > floor + 1e-6) { px = Math.max(floor, px * 0.9); rows = rowsAt(px); }const lineH = lineHOf(px);const blockH = rows.length * lineH;@@ -517,4 +529,4 @@ export function createLyricType(mv = globalThis.PORTOS_MV, options = {}) {}// Classic-script templates (the layered engine) reach the module through this global.-if (typeof globalThis !== 'undefined') globalThis.PORTOS_LYRIC_TYPE = { createLyricType, zoneRect, LYRIC_ROLES, TEXT_ZONES, LYRIC_FIT };+if (typeof globalThis !== 'undefined') globalThis.PORTOS_LYRIC_TYPE = { createLyricType, zoneRect, LYRIC_ROLES, TEXT_ZONES, LYRIC_FIT, LYRIC_SIZE_SCALE };diff --git a/server/services/musicVideo/documentTemplates/shared/lyricType.test.js b/server/services/musicVideo/documentTemplates/shared/lyricType.test.jsindex 387368e244..9b6614cdc8 100644--- a/server/services/musicVideo/documentTemplates/shared/lyricType.test.js+++ b/server/services/musicVideo/documentTemplates/shared/lyricType.test.js@@ -259,6 +259,35 @@ describe('lyricType text zones', () => {}});+ it('places corner lyrics in all four corners, right-aligned on the right side', () => {+ const text = 'a short sung line';+ for (const zone of ['upper-left', 'upper-right', 'lower-left', 'lower-right']) {+ expect(TEXT_ZONES).toContain(zone);+ const type = createLyricType({}, { lines: [{ text, role: 'line', zone, startSec: 0, words: words(text, 0) }] });+ const placed = type.layout(type.lines[0], 1920, 1080, measure);+ const right = Math.max(...placed.words.map((word) => word.x + word.w - measure(' ', `${Math.round(placed.px)}px`)));+ const left = Math.min(...placed.words.map((word) => word.x));+ if (zone.endsWith('right')) expect(right).toBeCloseTo(placed.rect.x + placed.rect.w, 6);+ else expect(left).toBeCloseTo(placed.rect.x, 6);+ for (const word of placed.words) {+ if (zone.startsWith('upper')) expect(word.y).toBeLessThan(1080 / 2);+ else expect(word.y - placed.px).toBeGreaterThan(1080 / 2);+ }+ }+ });++ it('sizes a shot\'s lyrics small or large without going under the phone floor', () => {+ const text = 'a short sung line';+ const sizeOf = (lyricSize) => {+ const type = createLyricType({ scenes: [{ sceneId: 's', startSec: 0, endSec: 9, lyricSize }] }, { lines: [{ text, role: 'line', startSec: 0, words: words(text, 0) }] });+ return type.layout(type.lines[0], 1920, 1080, measure).px;+ };+ const normal = sizeOf(null);+ expect(sizeOf('large')).toBeCloseTo(normal * 1.25, 6);+ expect(sizeOf('small')).toBe(56);+ expect(normal).toBe(60);+ });+it('reframes zones for a portrait frame', () => {const rect = zoneRect('lower-left', 1080, 1920);expect(rect.x + rect.w).toBeCloseTo(1080 - rect.x, 6);diff --git a/server/services/musicVideo/lyricPlaythrough.js b/server/services/musicVideo/lyricPlaythrough.jsindex ebde241f92..01b9575e9b 100644--- a/server/services/musicVideo/lyricPlaythrough.js+++ b/server/services/musicVideo/lyricPlaythrough.js@@ -26,7 +26,7 @@ import { buildDocumentData, documentRenderClock, documentSongDuration } from './const LINES_PER_SCENE = 4;const finite = (n) => typeof n === 'number' && Number.isFinite(n);// The fields the template reads from a shot; no take, frame or clip comes along.-const SCENE_FIELDS = ['sceneId', 'order', 'label', 'sectionLabel', 'startSec', 'endSec', 'shotMode', 'textZone', 'lyricRole', 'lyricText', 'camera', 'stillMove'];+const SCENE_FIELDS = ['sceneId', 'order', 'label', 'sectionLabel', 'startSec', 'endSec', 'shotMode', 'textZone', 'lyricRole', 'lyricSize', 'lyricText', 'camera', 'stillMove'];const timedShots = (scenes) => (Array.isArray(scenes) ? scenes : []).filter((scene) => scene?.sceneId && finite(scene.startSec) && finite(scene.endSec) && scene.endSec > scene.startSec)diff --git a/server/services/musicVideo/productionReview.js b/server/services/musicVideo/productionReview.jsindex 8d0be28dac..8134ad5760 100644--- a/server/services/musicVideo/productionReview.js+++ b/server/services/musicVideo/productionReview.js@@ -43,8 +43,8 @@ export const documentStoryboardBasis = project => hash({export const overlayTextBasis = project => hash({document: project.composition?.document?.directory || null, aspect: musicVideoAspect(project), source: source(project),textCues: project.composition?.textCues ?? null, overlay: project.composition?.overlay ?? null, style: project.composition?.style ?? null,- scenes: (project.scenes || []).map(({ sceneId, startSec, endSec, textZone, lyricRole, lyricText, cardText, referenceImageId, videoHistoryId, performanceEdit, visualLayer }) =>- ({ sceneId, startSec, endSec, textZone, lyricRole, lyricText, cardText, referenceImageId, videoHistoryId, performanceEdit, visualLayer })),+ scenes: (project.scenes || []).map(({ sceneId, startSec, endSec, textZone, lyricRole, lyricSize, lyricText, cardText, referenceImageId, videoHistoryId, performanceEdit, visualLayer }) =>+ ({ sceneId, startSec, endSec, textZone, lyricRole, lyricSize, lyricText, cardText, referenceImageId, videoHistoryId, performanceEdit, visualLayer })),});// Share the evidence contract between new decisions and persisted approvals:diff --git a/server/services/musicVideo/projectsLogic.js b/server/services/musicVideo/projectsLogic.jsindex ff9660997b..200e2593da 100644--- a/server/services/musicVideo/projectsLogic.js+++ b/server/services/musicVideo/projectsLogic.js@@ -695,7 +695,7 @@ export function removeScene(project, sceneId) {// the song, its section, and the lyric sung there. A reorder leaves these on// their positions and moves only the shot (prompts, frames, clips, takes,// direction, camera), so swapping two shots keeps the song timing intact.-const SCENE_SLOT_FIELDS = ['startSec', 'endSec', 'beatAligned', 'sectionIndex', 'sectionLabel', 'lyricText', 'lyricRole'];+const SCENE_SLOT_FIELDS = ['startSec', 'endSec', 'beatAligned', 'sectionIndex', 'sectionLabel', 'lyricText', 'lyricRole', 'lyricSize'];const DRAFT_SHOT_SLOT_FIELDS = ['startSec', 'endSec', 'lyricCueIds'];const pickSlot = (record, fields) => Object.fromEntries(fields.filter((k) => k in record).map((k) => [k, record[k]]));const withoutSlot = (record, fields) => Object.fromEntries(Object.entries(record).filter(([k]) => !fields.includes(k)));