@lalalic/markcut 3.2.58 → 3.2.59

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.
@@ -15,6 +15,13 @@ function App(){
15
15
  const ref=React.useRef<PlayerRef|null>(null);
16
16
  const [currentTime,setCurrentTime]=React.useState(0);
17
17
  const [browserTts,setBrowserTts]=React.useState(true);
18
+ const [compact,setCompact]=React.useState(()=>window.matchMedia('(max-width: 640px), (max-height: 520px)').matches);
19
+ React.useEffect(()=>{
20
+ const query=window.matchMedia('(max-width: 640px), (max-height: 520px)');
21
+ const update=()=>setCompact(query.matches);
22
+ query.addEventListener('change',update);
23
+ return ()=>query.removeEventListener('change',update);
24
+ },[]);
18
25
  const [commentedScenes,setCommentedScenes]=React.useState<string[]>([]);
19
26
  const [spotMarkers,setSpotMarkers]=React.useState<Array<{id:number;scope:'overall'|'scene'|'spot';text:string;context:{timeSeconds:number;sceneName?:string};selected:boolean;placeholder?:boolean}>>([{id:0,scope:'overall',text:'',context:{timeSeconds:0},selected:true,placeholder:true}]);
20
27
  const [seekBar,setSeekBar]=React.useState<HTMLElement|null>(null);
@@ -89,13 +96,13 @@ function App(){
89
96
  if(!data)return <div>Missing compiled scene tree</div>;
90
97
  const videoName=String(revision.title||revision.videoTitle||revision.path?.split('/').pop()?.replace(/\.md$/i,'').replace(/[-_]+/g,' ')||'Video');
91
98
  return <div id="remotion-preview" data-revision={revision.revisionId}>
92
- {document.getElementById("header-tts")&&createPortal(
99
+ {Boolean(data?.subtitle?.src)&&document.getElementById("header-tts")&&createPortal(
93
100
  <label style={{display:"flex",gap:5,alignItems:"center",fontSize:12,whiteSpace:"nowrap",cursor:"pointer"}} title="Use browser narration with captions from the script">
94
101
  <input type="checkbox" checked={useBrowserTts} disabled={!data?.subtitle?.src} onChange={e=>setBrowserTts(e.target.checked)}/>
95
102
  Browser TTS
96
103
  </label>,document.getElementById("header-tts")!)}
97
- <div id="remotion-canvas" style={{position:'relative',width:'100%',aspectRatio:`${data.width||1080}/${data.height||1920}`,maxHeight:'65vh',margin:'auto'}}>
98
- <SharedPlayer key={revision.revisionId} root={playbackRoot} playerRef={ref} numberOfSharedAudioTags={0} style={{width:'100%',height:'100%'}} />
104
+ <div id="remotion-canvas" style={{position:'relative',width:'100%',aspectRatio:`${data.width||1080}/${data.height||1920}`,maxHeight:'65vh',margin:'auto', '--markcut-player-ratio':String((data.width||1080)/(data.height||1920))} as React.CSSProperties}>
105
+ <SharedPlayer key={revision.revisionId} root={playbackRoot} playerRef={ref} numberOfSharedAudioTags={0} showPlaybackRateControl={!compact} style={{width:'100%',height:'100%'}} />
99
106
  {useBrowserTts&&caption&&<div id="browser-tts-caption" aria-live="off" style={{position:'absolute',bottom:50,left:12,right:12,zIndex:5,pointerEvents:'none',textAlign:'center'}}>
100
107
  <span style={{display:'inline-block',maxWidth:'90%',padding:'5px 10px',borderRadius:5,background:'rgba(0,0,0,.72)',color:'#fff',fontSize:'clamp(12px,1.6vw,18px)',lineHeight:1.4,textShadow:'0 1px 2px #000',overflowWrap:'anywhere'}}>{caption}</span>
101
108
  </div>}
@@ -28,12 +28,23 @@ describe('Markcut Remotion MCP App',()=>{
28
28
  expect(html).toContain('https://neoy.example.test/files/_neoy/markcut/player/');
29
29
  expect(html).not.toContain('id="remotion-bundle"');
30
30
  // The generic event contract requires client-side identity and reserved-field validation.
31
- expect(html.length).toBeLessThan(26000);
31
+ expect(html.length).toBeLessThan(30000);
32
32
  expect(html).not.toContain('<video id="video-player"');
33
33
  expect(html).not.toContain('data:video/mp4');
34
34
  expect(html).not.toContain('127.0.0.1');
35
35
  expect(html).not.toContain('src="/player.js"');
36
36
  });
37
+ it('fits the phone player by BOTH width and height, with scenes above canvas and actions in normal flow',()=>{
38
+ const html=buildPreviewHtml();
39
+ expect(html).toContain('@media (max-width: 640px), (max-height: 520px)');
40
+ expect(html).toContain('var(--markcut-player-ratio, 0.5625)');
41
+ expect(html).toContain('#scene-thumbnails { order: -1;');
42
+ expect(html).toContain("grid-template-areas: 'changes approve' 'status status'");
43
+ expect(html).not.toMatch(/#remotion-canvas\s*\{[^}]*position\s*:\s*absolute/);
44
+ const app=readFileSync(new URL('../src/mcp/remotion-app.tsx',import.meta.url),'utf8');
45
+ expect(app).toContain('showPlaybackRateControl={!compact}');
46
+ expect(app).toContain('Boolean(data?.subtitle?.src)&&document.getElementById');
47
+ });
37
48
  it('omits the developer BGM decode-status row while preserving Web Audio playback',()=>{
38
49
  const renderer=readFileSync(new URL('../src/mcp/remotion-app.tsx',import.meta.url),'utf8');
39
50
  const audio=readFileSync(new URL('../src/mcp/web-audio-preview.ts',import.meta.url),'utf8');
@@ -41,9 +52,9 @@ describe('Markcut Remotion MCP App',()=>{
41
52
  expect(audio).toContain('ctx.decodeAudioData(bytes)');
42
53
  expect(audio).toContain("p.addEventListener('play',play)");
43
54
  });
44
- it('publishes v46 while retaining v45 as a compatible alias',()=>{
45
- expect(RESOURCE_URI).toBe('ui://markcut/video-preview-v46.html');
46
- expect(LEGACY_RESOURCE_URIS).toContain('ui://markcut/video-preview-v45.html');
55
+ it('publishes v47 while retaining v46 as a compatible alias',()=>{
56
+ expect(RESOURCE_URI).toBe('ui://markcut/video-preview-v47.html');
57
+ expect(LEGACY_RESOURCE_URIS).toContain('ui://markcut/video-preview-v46.html');
47
58
  });
48
59
  it('registers latest resource at startup and aliases previous URIs',()=>{
49
60
  for(const uri of [RESOURCE_URI,...LEGACY_RESOURCE_URIS]){