{"schemaVersion":1,"id":"recommended.sm-editor","version":"1.0.0","name":"Editor workflow","description":"An editable production workflow using Editor v2.0.0.","stages":[{"id":"main","blockId":"sm.editor","version":"2.0.0","label":"Editor"}],"connections":[],"packages":[{"manifest":{"schemaVersion":1,"sdkVersion":"0.1.0","id":"sm.editor","version":"2.0.0","name":"Editor","description":"Edit the complete StillMade timeline—including video, audio, captions, text, grading, transitions, motion graphics, scoring, effects, versions, and export settings—in one portable workspace.","kind":"workspace","runtime":"javascript","entry":"src/run.js","license":"MIT","provenance":{"notice":"Original source (authorship declared by the packager)\nLicense: MIT\nChanges: Original implementation declared by the packager; no reused repository or dependency code.\nFiles: LICENSE, src/run.js, src/view.json\n\nMIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","portableSources":[{"kind":"original","license":"MIT","paths":["LICENSE","src/run.js","src/view.json"],"evidence":["upstream/0/LICENSE","upstream/0/src/run.js","upstream/0/src/view.json"],"changes":"Original implementation declared by the packager; no reused repository or dependency code."}]},"inputs":{"editor":{"type":"timeline","context":"editor","primary":true,"required":false,"default":{"schemaVersion":1,"activeTimelineId":"timeline-1","tracks":[],"clips":[],"audioItems":[],"captions":[],"textOverlays":[],"effects":[]},"description":"The complete current Editor document. All internal editing tools and retained media/version data remain together."},"updatedEditor":{"type":"timeline","required":false,"default":{"schemaVersion":1,"activeTimelineId":"timeline-1","tracks":[],"clips":[],"audioItems":[],"captions":[],"textOverlays":[],"effects":[]},"description":"The complete edited timeline prepared in this workspace."},"commit":{"type":"boolean","default":false,"description":"Prepare the edited Editor document for StillMade review and Apply."}},"outputs":{"editor":{"type":"timeline","primary":true,"role":"editor_timeline","description":"The complete edited timeline for immediate use and downstream Blocks."},"edit":{"type":"workspace-edit","description":"An exact before/after Editor change reviewed before it updates the project."}},"permissions":{"project":["context.editor.read","workspace.editor.propose"],"network":[],"filesystem":[],"secrets":[]},"ui":[],"platforms":{"phone":{"supported":true},"browser":{"supported":true},"desktop":{"supported":true}}},"code":"const copy = value => JSON.parse(JSON.stringify(value));\nconst source = copy(input.editor || {schemaVersion:1,activeTimelineId:'timeline-1',tracks:[],clips:[],audioItems:[],captions:[],textOverlays:[],effects:[]});\nconst candidate = input.commit ? copy(input.updatedEditor) : copy(source);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || typeof candidate.activeTimelineId !== 'string' || !candidate.activeTimelineId) throw new Error('Keep the complete version 1 Editor document and active timeline identity.');\nconst names=['tracks','clips','audioItems','captions','textOverlays','stickers','effects','markers','fxEvents','liveOverlays','mediaItems','timelineVersions'];\nif (!names.every(name => candidate[name] === undefined || Array.isArray(candidate[name]) && candidate[name].length <= 10000 && candidate[name].every(item => item && typeof item === 'object' && !Array.isArray(item) && typeof item.id === 'string' && item.id.length > 0 && item.id.length <= 200) && new Set(candidate[name].map(item => item.id)).size === candidate[name].length)) throw new Error('Editor collections need valid distinct retained item IDs.');\nreturn {editor:candidate,edit:{schemaVersion:1,title:`Update Editor timeline ${candidate.activeTimelineId}`,field:'editor',before:source,after:candidate}};\n","view":{"html":"<main class=\"editor-workspace\">\n  <header><div><small>Production workspace</small><h1>Editor</h1><p id=\"summary\">Loading the complete timeline…</p></div><div class=\"actions\"><button id=\"reset\" type=\"button\" class=\"secondary\">Reset changes</button><button id=\"addText\" type=\"button\" class=\"secondary\">Add text</button><button id=\"addCaption\" type=\"button\" class=\"secondary\">Add caption</button><button id=\"save\" type=\"button\">Review changes</button></div></header>\n  <output id=\"status\" role=\"status\" aria-live=\"polite\"></output>\n  <section><h2>Timeline</h2><div class=\"grid\"><label>Active timeline<input id=\"timelineId\" type=\"text\" disabled></label><label>Aspect ratio<input id=\"aspect\" type=\"text\"></label></div></section>\n  <section><h2>Video</h2><div id=\"clips\" class=\"cards\"></div></section>\n  <section><h2>Audio and scoring</h2><div id=\"audio\" class=\"cards\"></div></section>\n  <section><h2>Text and motion graphics</h2><div id=\"text\" class=\"cards\"></div><p id=\"graphics\" class=\"hint\"></p></section>\n  <section><h2>Captions</h2><div id=\"captions\" class=\"cards\"></div></section>\n  <section><h2>Effects</h2><div id=\"effects\" class=\"cards\"></div></section>\n  <details><summary>Complete Editor data</summary><p>All timeline lanes, motion graphics, grade settings, transitions, scoring, versions, and export settings are retained. Use this editor for fields not shown on the lane cards.</p><textarea id=\"raw\" class=\"raw\" spellcheck=\"false\"></textarea><button id=\"applyRaw\" type=\"button\" class=\"secondary\">Apply JSON to workspace</button></details>\n</main>\n","css":".editor-workspace{max-width:1160px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.card-head,.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}header{justify-content:space-between;margin-bottom:14px}header h1{margin:2px 0}header p,header small,details p,output,.hint{color:var(--fg-muted)}section,details{margin:12px 0;padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}section h2{margin:0 0 10px}.cards{display:grid;gap:10px}.card{padding:12px;border:1px solid var(--border-tok);border-radius:var(--r-2);background:var(--bg)}.card-head{justify-content:space-between}.card h3{margin:0;font-size:16px}.grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}label{display:grid;gap:5px;margin:7px 0;font-size:13px;font-weight:600}input,textarea{width:100%;background:var(--bg)}textarea{min-height:70px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:440px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}\n@media(max-width:900px){.grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:560px){.editor-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}section,details{padding:12px}}\n","javascript":"const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),aspect=document.getElementById('aspect'),timelineId=document.getElementById('timelineId'),graphics=document.getElementById('graphics');\nlet source={schemaVersion:1,activeTimelineId:'timeline-1',tracks:[],clips:[],audioItems:[],captions:[],textOverlays:[],effects:[]},draft={schemaVersion:1,activeTimelineId:'timeline-1',tracks:[],clips:[],audioItems:[],captions:[],textOverlays:[],effects:[]},busy=false,revision=0;\nconst clone=value=>JSON.parse(JSON.stringify(value));\nconst text=value=>value===undefined||value===null?'':String(value);\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},{tag:'input',type,action,value:Number.isFinite(value)?value:text(value),disabled:busy,label}]});\nconst remove=action=>({tag:'button',action,text:'Remove',className:'danger',disabled:busy});\nconst clipCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.label)||text(item.name)||text(item.id)},remove('remove-clip:'+String(index))]},{tag:'div',className:'grid',children:[field('Track','clip-track:'+String(index),item.trackId),field('Start (seconds)','clip-start:'+String(index),item.start,'number'),field('Length (seconds)','clip-duration:'+String(index),item.duration,'number'),field('Trim start','clip-trim:'+String(index),item.trimStart,'number'),field('Speed','clip-speed:'+String(index),item.speed,'number'),field('Volume','clip-volume:'+String(index),item.volume,'number'),field('Transition','clip-transition:'+String(index),item.transition&&item.transition.type),field('Transition length','clip-transition-duration:'+String(index),item.transition&&item.transition.duration,'number'),field('Motion','clip-motion:'+String(index),item.motion&&item.motion.type),field('Motion easing','clip-easing:'+String(index),item.motion&&item.motion.easing)]}]});\nconst audioCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.label)||text(item.name)||text(item.id)},remove('remove-audio:'+String(index))]},{tag:'div',className:'grid',children:[field('Track','audio-track:'+String(index),item.trackId),field('Start (seconds)','audio-start:'+String(index),item.start,'number'),field('Length (seconds)','audio-duration:'+String(index),item.duration,'number'),field('Trim start','audio-trim:'+String(index),item.trimStart===undefined?item.sourceOffset:item.trimStart,'number'),field('Volume','audio-volume:'+String(index),item.volume,'number'),{tag:'label',children:[{tag:'span',text:'Muted'},{tag:'input',type:'checkbox',action:'audio-muted:'+String(index),checked:!!item.muted,disabled:busy,label:'Muted'}]}]}]});\nconst textCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.id)},remove('remove-text:'+String(index))]},{tag:'div',className:'grid',children:[field('Text','text-value:'+String(index),item.text,'text',true),field('Track','text-track:'+String(index),item.trackId),field('Start (seconds)','text-start:'+String(index),item.start,'number'),field('Length (seconds)','text-duration:'+String(index),item.duration,'number'),field('Animation','text-animation:'+String(index),item.animation)]}]});\nconst captionCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.id)},remove('remove-caption:'+String(index))]},{tag:'div',className:'grid',children:[field('Caption','caption-value:'+String(index),item.text,'text',true),field('Track','caption-track:'+String(index),item.trackId),field('Start (seconds)','caption-start:'+String(index),item.start,'number'),field('End (seconds)','caption-end:'+String(index),item.end,'number'),field('Animation','caption-animation:'+String(index),item.animation)]}]});\nconst effectCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.type)||text(item.id)},remove('remove-effect:'+String(index))]},{tag:'div',className:'grid',children:[field('Type','effect-type:'+String(index),item.type),field('Track','effect-track:'+String(index),item.trackId),field('Start (seconds)','effect-start:'+String(index),item.start,'number'),field('Length (seconds)','effect-duration:'+String(index),item.duration,'number'),field('Intensity','effect-intensity:'+String(index),item.intensity,'number')]}]});\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft=clone(source);if(!Array.isArray(draft.tracks))draft.tracks=[];if(!Array.isArray(draft.clips))draft.clips=[];if(!Array.isArray(draft.audioItems))draft.audioItems=[];if(!Array.isArray(draft.captions))draft.captions=[];if(!Array.isArray(draft.textOverlays))draft.textOverlays=[];if(!Array.isArray(draft.effects))draft.effects=[]};\nconst draw=()=>{ensure();StillMade.render('clips',draft.clips.length?draft.clips.map(clipCard):[{tag:'p',text:'No video clips.'}]);StillMade.render('audio',draft.audioItems.length?draft.audioItems.map(audioCard):[{tag:'p',text:'No audio items.'}]);StillMade.render('text',draft.textOverlays.length?draft.textOverlays.map(textCard):[{tag:'p',text:'No text overlays.'}]);StillMade.render('captions',draft.captions.length?draft.captions.map(captionCard):[{tag:'p',text:'No captions.'}]);StillMade.render('effects',draft.effects.length?draft.effects.map(effectCard):[{tag:'p',text:'No effects.'}]);timelineId.value=text(draft.activeTimelineId);aspect.value=text(draft.aspect);const mg=(Array.isArray(draft.fullscreenFrames)?draft.fullscreenFrames.length:0)+(Array.isArray(draft.figureSweeps)?draft.figureSweeps.length:0)+(Array.isArray(draft.graphs)?draft.graphs.length:0);graphics.textContent=String(mg)+' motion graphic item'+(mg===1?'':'s')+' retained in this Editor Block. Use Complete Editor data for advanced motion-graphics fields.';raw.value=JSON.stringify(draft,null,2);summary.textContent=String(draft.clips.length)+' video · '+String(draft.audioItems.length)+' audio · '+String(draft.captions.length)+' captions · '+String(draft.textOverlays.length)+' text';save.disabled=busy;document.getElementById('reset').disabled=busy;document.getElementById('addText').disabled=busy;document.getElementById('addCaption').disabled=busy};\nconst changed=()=>{revision+=1;raw.value=JSON.stringify(draft,null,2);status.textContent='Changes are local until you choose Review changes.'};\naspect.addEventListener('input',()=>{draft.aspect=aspect.value;changed()});\nStillMade.onAction(event=>{if(busy)return;ensure();const parts=event.action.split(':'),kind=parts[0],index=Number(parts[1]),clip=draft.clips.find((item,position)=>position===index),audio=draft.audioItems.find((item,position)=>position===index),title=draft.textOverlays.find((item,position)=>position===index),caption=draft.captions.find((item,position)=>position===index),effect=draft.effects.find((item,position)=>position===index);\n if(kind==='remove-clip'){draft.clips=draft.clips.filter((item,position)=>position!==index);changed();draw();return}if(kind==='remove-audio'){draft.audioItems=draft.audioItems.filter((item,position)=>position!==index);changed();draw();return}if(kind==='remove-text'){draft.textOverlays=draft.textOverlays.filter((item,position)=>position!==index);changed();draw();return}if(kind==='remove-caption'){draft.captions=draft.captions.filter((item,position)=>position!==index);changed();draw();return}if(kind==='remove-effect'){draft.effects=draft.effects.filter((item,position)=>position!==index);changed();draw();return}\n if(clip){if(kind==='clip-track')clip.trackId=event.value;if(kind==='clip-start')clip.start=Math.max(0,Number(event.value)||0);if(kind==='clip-duration')clip.duration=Math.max(0.001,Number(event.value)||0.001);if(kind==='clip-trim')clip.trimStart=Math.max(0,Number(event.value)||0);if(kind==='clip-speed')clip.speed=Math.max(0.01,Number(event.value)||1);if(kind==='clip-volume')clip.volume=Math.max(0,Number(event.value)||0);if(kind==='clip-transition'||kind==='clip-transition-duration'){if(!clip.transition||Array.isArray(clip.transition))clip.transition={type:'Cut',duration:0};if(kind==='clip-transition')clip.transition.type=event.value;else clip.transition.duration=Math.max(0,Number(event.value)||0)}if(kind==='clip-motion'||kind==='clip-easing'){if(!clip.motion||Array.isArray(clip.motion))clip.motion={type:'none',easing:'ease-in-out'};if(kind==='clip-motion')clip.motion.type=event.value;else clip.motion.easing=event.value}}\n if(audio){if(kind==='audio-track')audio.trackId=event.value;if(kind==='audio-start')audio.start=Math.max(0,Number(event.value)||0);if(kind==='audio-duration')audio.duration=Math.max(0.001,Number(event.value)||0.001);if(kind==='audio-trim'){audio.trimStart=Math.max(0,Number(event.value)||0);audio.sourceOffset=audio.trimStart}if(kind==='audio-volume')audio.volume=Math.max(0,Number(event.value)||0);if(kind==='audio-muted')audio.muted=event.checked}\n if(title){if(kind==='text-value')title.text=event.value;if(kind==='text-track')title.trackId=event.value;if(kind==='text-start')title.start=Math.max(0,Number(event.value)||0);if(kind==='text-duration')title.duration=Math.max(0.001,Number(event.value)||0.001);if(kind==='text-animation')title.animation=event.value}\n if(caption){if(kind==='caption-value')caption.text=event.value;if(kind==='caption-track')caption.trackId=event.value;if(kind==='caption-start')caption.start=Math.max(0,Number(event.value)||0);if(kind==='caption-end')caption.end=Math.max(caption.start+0.001,Number(event.value)||caption.start+0.001);if(kind==='caption-animation')caption.animation=event.value}\n if(effect){if(kind==='effect-type')effect.type=event.value;if(kind==='effect-track')effect.trackId=event.value;if(kind==='effect-start')effect.start=Math.max(0,Number(event.value)||0);if(kind==='effect-duration')effect.duration=Math.max(0.001,Number(event.value)||0.001);if(kind==='effect-intensity')effect.intensity=Number(event.value)}changed()});\ndocument.getElementById('addText').addEventListener('click',()=>{if(busy)return;ensure();draft.textOverlays=[...draft.textOverlays,{id:'portable-text-'+String(draft.textOverlays.length+1)+'-'+String(revision+1),trackId:'text',text:'New text',start:0,duration:2,animation:'none'}];changed();draw()});\ndocument.getElementById('addCaption').addEventListener('click',()=>{if(busy)return;ensure();draft.captions=[...draft.captions,{id:'portable-caption-'+String(draft.captions.length+1)+'-'+String(revision+1),trackId:'captions',text:'New caption',start:0,end:2,font:'Hanken Grotesk',animation:'none'}];changed();draw()});\ndocument.getElementById('applyRaw').addEventListener('click',()=>{if(busy)return;try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1||typeof value.activeTimelineId!=='string')throw Error('Editor JSON must be a version 1 document with an active timeline ID.');draft=clone(value);changed();draw();status.textContent='Complete Editor data applied locally.'}catch(error){status.textContent=error.message}});\ndocument.getElementById('reset').addEventListener('click',()=>{if(!busy){draft=clone(source);revision+=1;draw();status.textContent='Changes reset to the current Editor timeline.'}});\nsave.addEventListener('click',async()=>{if(busy)return;const started=revision;busy=true;draw();status.textContent='Checking the complete Editor timeline…';try{const result=await StillMade.run({editor:source,updatedEditor:draft,commit:true});draft=clone(result.editor);if(started===revision)status.textContent='Editor changes are ready below. Review the before and after, then choose Apply.'}catch(error){status.textContent=error.message||'Editor changes could not be prepared.'}finally{busy=false;draw()}});\nStillMade.onInput(values=>{source=clone(values.editor||source);draft=clone(source);revision+=1;draw();status.textContent='Edit the complete timeline. Motion graphics and every other Editor tool stay inside this Block.'});\n"},"tests":[{"name":"Retain the complete Editor and all internal tools","input":{"editor":{"schemaVersion":1,"activeTimelineId":"timeline-1","aspect":"16:9","tracks":[{"id":"video","type":"video"},{"id":"audio","type":"audio"}],"clips":[{"id":"clip-1","trackId":"video","start":0,"duration":4,"url":"https://media.example/clip.mp4","motion":{"type":"push-in"},"color":{"brightness":5},"transition":{"type":"Fade","duration":0.5}}],"audioItems":[{"id":"music-1","trackId":"audio","start":0,"duration":4,"url":"https://media.example/music.mp3","volume":70}],"captions":[{"id":"caption-1","trackId":"captions","text":"Hello","start":0,"end":1}],"textOverlays":[{"id":"title-1","text":"Opening","start":0,"duration":2}],"effects":[{"id":"effect-1","type":"grain","start":0,"duration":4}],"fullscreenFrames":[{"id":"mg-frame-1","title":"Motion graphic"}],"figureSweeps":[{"id":"mg-figure-1","value":42}],"audioScore":{"wholeMusic":{"versions":[{"url":"https://media.example/score.mp3"}],"idx":0}},"timelineVersions":[{"id":"timeline-1","name":"Main","clips":[]}],"exportSettings":{"resolution":"1080p"},"custom":{"keep":true}},"updatedEditor":{"schemaVersion":1,"activeTimelineId":"timeline-1","tracks":[],"clips":[],"audioItems":[],"captions":[],"textOverlays":[],"effects":[]},"commit":false},"expected":{"editor":{"schemaVersion":1,"activeTimelineId":"timeline-1","aspect":"16:9","tracks":[{"id":"video","type":"video"},{"id":"audio","type":"audio"}],"clips":[{"id":"clip-1","trackId":"video","start":0,"duration":4,"url":"https://media.example/clip.mp4","motion":{"type":"push-in"},"color":{"brightness":5},"transition":{"type":"Fade","duration":0.5}}],"audioItems":[{"id":"music-1","trackId":"audio","start":0,"duration":4,"url":"https://media.example/music.mp3","volume":70}],"captions":[{"id":"caption-1","trackId":"captions","text":"Hello","start":0,"end":1}],"textOverlays":[{"id":"title-1","text":"Opening","start":0,"duration":2}],"effects":[{"id":"effect-1","type":"grain","start":0,"duration":4}],"fullscreenFrames":[{"id":"mg-frame-1","title":"Motion graphic"}],"figureSweeps":[{"id":"mg-figure-1","value":42}],"audioScore":{"wholeMusic":{"versions":[{"url":"https://media.example/score.mp3"}],"idx":0}},"timelineVersions":[{"id":"timeline-1","name":"Main","clips":[]}],"exportSettings":{"resolution":"1080p"},"custom":{"keep":true}},"edit":{"schemaVersion":1,"title":"Update Editor timeline timeline-1","field":"editor","before":{"schemaVersion":1,"activeTimelineId":"timeline-1","aspect":"16:9","tracks":[{"id":"video","type":"video"},{"id":"audio","type":"audio"}],"clips":[{"id":"clip-1","trackId":"video","start":0,"duration":4,"url":"https://media.example/clip.mp4","motion":{"type":"push-in"},"color":{"brightness":5},"transition":{"type":"Fade","duration":0.5}}],"audioItems":[{"id":"music-1","trackId":"audio","start":0,"duration":4,"url":"https://media.example/music.mp3","volume":70}],"captions":[{"id":"caption-1","trackId":"captions","text":"Hello","start":0,"end":1}],"textOverlays":[{"id":"title-1","text":"Opening","start":0,"duration":2}],"effects":[{"id":"effect-1","type":"grain","start":0,"duration":4}],"fullscreenFrames":[{"id":"mg-frame-1","title":"Motion graphic"}],"figureSweeps":[{"id":"mg-figure-1","value":42}],"audioScore":{"wholeMusic":{"versions":[{"url":"https://media.example/score.mp3"}],"idx":0}},"timelineVersions":[{"id":"timeline-1","name":"Main","clips":[]}],"exportSettings":{"resolution":"1080p"},"custom":{"keep":true}},"after":{"schemaVersion":1,"activeTimelineId":"timeline-1","aspect":"16:9","tracks":[{"id":"video","type":"video"},{"id":"audio","type":"audio"}],"clips":[{"id":"clip-1","trackId":"video","start":0,"duration":4,"url":"https://media.example/clip.mp4","motion":{"type":"push-in"},"color":{"brightness":5},"transition":{"type":"Fade","duration":0.5}}],"audioItems":[{"id":"music-1","trackId":"audio","start":0,"duration":4,"url":"https://media.example/music.mp3","volume":70}],"captions":[{"id":"caption-1","trackId":"captions","text":"Hello","start":0,"end":1}],"textOverlays":[{"id":"title-1","text":"Opening","start":0,"duration":2}],"effects":[{"id":"effect-1","type":"grain","start":0,"duration":4}],"fullscreenFrames":[{"id":"mg-frame-1","title":"Motion graphic"}],"figureSweeps":[{"id":"mg-figure-1","value":42}],"audioScore":{"wholeMusic":{"versions":[{"url":"https://media.example/score.mp3"}],"idx":0}},"timelineVersions":[{"id":"timeline-1","name":"Main","clips":[]}],"exportSettings":{"resolution":"1080p"},"custom":{"keep":true}}}}},{"name":"Prepare one exact complete Editor update","input":{"editor":{"schemaVersion":1,"activeTimelineId":"timeline-1","tracks":[{"id":"video","type":"video"}],"clips":[{"id":"clip-1","trackId":"video","start":0,"duration":4,"url":"https://media.example/clip.mp4","volume":100}],"audioItems":[],"captions":[],"textOverlays":[{"id":"title-1","text":"Old","start":0,"duration":2}],"effects":[]},"updatedEditor":{"schemaVersion":1,"activeTimelineId":"timeline-1","tracks":[{"id":"video","type":"video"}],"clips":[{"id":"clip-1","trackId":"video","start":1,"duration":3,"url":"https://media.example/clip.mp4","volume":80}],"audioItems":[],"captions":[],"textOverlays":[{"id":"title-1","text":"New","start":1,"duration":2}],"effects":[]},"commit":true},"expected":{"editor":{"schemaVersion":1,"activeTimelineId":"timeline-1","tracks":[{"id":"video","type":"video"}],"clips":[{"id":"clip-1","trackId":"video","start":1,"duration":3,"url":"https://media.example/clip.mp4","volume":80}],"audioItems":[],"captions":[],"textOverlays":[{"id":"title-1","text":"New","start":1,"duration":2}],"effects":[]},"edit":{"schemaVersion":1,"title":"Update Editor timeline timeline-1","field":"editor","before":{"schemaVersion":1,"activeTimelineId":"timeline-1","tracks":[{"id":"video","type":"video"}],"clips":[{"id":"clip-1","trackId":"video","start":0,"duration":4,"url":"https://media.example/clip.mp4","volume":100}],"audioItems":[],"captions":[],"textOverlays":[{"id":"title-1","text":"Old","start":0,"duration":2}],"effects":[]},"after":{"schemaVersion":1,"activeTimelineId":"timeline-1","tracks":[{"id":"video","type":"video"}],"clips":[{"id":"clip-1","trackId":"video","start":1,"duration":3,"url":"https://media.example/clip.mp4","volume":80}],"audioItems":[],"captions":[],"textOverlays":[{"id":"title-1","text":"New","start":1,"duration":2}],"effects":[]}}}}],"portable":{"format":"stillmade-block/1","dependencies":[],"sources":[{"kind":"original","license":"MIT","paths":["LICENSE","src/run.js","src/view.json"],"evidence":["upstream/0/LICENSE","upstream/0/src/run.js","upstream/0/src/view.json"],"changes":"Original implementation declared by the packager; no reused repository or dependency code."}],"files":{"upstream/0/LICENSE":"MIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","upstream/0/src/run.js":"const copy = value => JSON.parse(JSON.stringify(value));\nconst source = copy(input.editor || {schemaVersion:1,activeTimelineId:'timeline-1',tracks:[],clips:[],audioItems:[],captions:[],textOverlays:[],effects:[]});\nconst candidate = input.commit ? copy(input.updatedEditor) : copy(source);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || typeof candidate.activeTimelineId !== 'string' || !candidate.activeTimelineId) throw new Error('Keep the complete version 1 Editor document and active timeline identity.');\nconst names=['tracks','clips','audioItems','captions','textOverlays','stickers','effects','markers','fxEvents','liveOverlays','mediaItems','timelineVersions'];\nif (!names.every(name => candidate[name] === undefined || Array.isArray(candidate[name]) && candidate[name].length <= 10000 && candidate[name].every(item => item && typeof item === 'object' && !Array.isArray(item) && typeof item.id === 'string' && item.id.length > 0 && item.id.length <= 200) && new Set(candidate[name].map(item => item.id)).size === candidate[name].length)) throw new Error('Editor collections need valid distinct retained item IDs.');\nreturn {editor:candidate,edit:{schemaVersion:1,title:`Update Editor timeline ${candidate.activeTimelineId}`,field:'editor',before:source,after:candidate}};\n","upstream/0/src/view.json":"{\n  \"html\": \"<main class=\\\"editor-workspace\\\">\\n  <header><div><small>Production workspace</small><h1>Editor</h1><p id=\\\"summary\\\">Loading the complete timeline…</p></div><div class=\\\"actions\\\"><button id=\\\"reset\\\" type=\\\"button\\\" class=\\\"secondary\\\">Reset changes</button><button id=\\\"addText\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add text</button><button id=\\\"addCaption\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add caption</button><button id=\\\"save\\\" type=\\\"button\\\">Review changes</button></div></header>\\n  <output id=\\\"status\\\" role=\\\"status\\\" aria-live=\\\"polite\\\"></output>\\n  <section><h2>Timeline</h2><div class=\\\"grid\\\"><label>Active timeline<input id=\\\"timelineId\\\" type=\\\"text\\\" disabled></label><label>Aspect ratio<input id=\\\"aspect\\\" type=\\\"text\\\"></label></div></section>\\n  <section><h2>Video</h2><div id=\\\"clips\\\" class=\\\"cards\\\"></div></section>\\n  <section><h2>Audio and scoring</h2><div id=\\\"audio\\\" class=\\\"cards\\\"></div></section>\\n  <section><h2>Text and motion graphics</h2><div id=\\\"text\\\" class=\\\"cards\\\"></div><p id=\\\"graphics\\\" class=\\\"hint\\\"></p></section>\\n  <section><h2>Captions</h2><div id=\\\"captions\\\" class=\\\"cards\\\"></div></section>\\n  <section><h2>Effects</h2><div id=\\\"effects\\\" class=\\\"cards\\\"></div></section>\\n  <details><summary>Complete Editor data</summary><p>All timeline lanes, motion graphics, grade settings, transitions, scoring, versions, and export settings are retained. Use this editor for fields not shown on the lane cards.</p><textarea id=\\\"raw\\\" class=\\\"raw\\\" spellcheck=\\\"false\\\"></textarea><button id=\\\"applyRaw\\\" type=\\\"button\\\" class=\\\"secondary\\\">Apply JSON to workspace</button></details>\\n</main>\\n\",\n  \"css\": \".editor-workspace{max-width:1160px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.card-head,.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}header{justify-content:space-between;margin-bottom:14px}header h1{margin:2px 0}header p,header small,details p,output,.hint{color:var(--fg-muted)}section,details{margin:12px 0;padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}section h2{margin:0 0 10px}.cards{display:grid;gap:10px}.card{padding:12px;border:1px solid var(--border-tok);border-radius:var(--r-2);background:var(--bg)}.card-head{justify-content:space-between}.card h3{margin:0;font-size:16px}.grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}label{display:grid;gap:5px;margin:7px 0;font-size:13px;font-weight:600}input,textarea{width:100%;background:var(--bg)}textarea{min-height:70px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:440px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}\\n@media(max-width:900px){.grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:560px){.editor-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}section,details{padding:12px}}\\n\",\n  \"javascript\": \"const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),aspect=document.getElementById('aspect'),timelineId=document.getElementById('timelineId'),graphics=document.getElementById('graphics');\\nlet source={schemaVersion:1,activeTimelineId:'timeline-1',tracks:[],clips:[],audioItems:[],captions:[],textOverlays:[],effects:[]},draft={schemaVersion:1,activeTimelineId:'timeline-1',tracks:[],clips:[],audioItems:[],captions:[],textOverlays:[],effects:[]},busy=false,revision=0;\\nconst clone=value=>JSON.parse(JSON.stringify(value));\\nconst text=value=>value===undefined||value===null?'':String(value);\\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},{tag:'input',type,action,value:Number.isFinite(value)?value:text(value),disabled:busy,label}]});\\nconst remove=action=>({tag:'button',action,text:'Remove',className:'danger',disabled:busy});\\nconst clipCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.label)||text(item.name)||text(item.id)},remove('remove-clip:'+String(index))]},{tag:'div',className:'grid',children:[field('Track','clip-track:'+String(index),item.trackId),field('Start (seconds)','clip-start:'+String(index),item.start,'number'),field('Length (seconds)','clip-duration:'+String(index),item.duration,'number'),field('Trim start','clip-trim:'+String(index),item.trimStart,'number'),field('Speed','clip-speed:'+String(index),item.speed,'number'),field('Volume','clip-volume:'+String(index),item.volume,'number'),field('Transition','clip-transition:'+String(index),item.transition&&item.transition.type),field('Transition length','clip-transition-duration:'+String(index),item.transition&&item.transition.duration,'number'),field('Motion','clip-motion:'+String(index),item.motion&&item.motion.type),field('Motion easing','clip-easing:'+String(index),item.motion&&item.motion.easing)]}]});\\nconst audioCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.label)||text(item.name)||text(item.id)},remove('remove-audio:'+String(index))]},{tag:'div',className:'grid',children:[field('Track','audio-track:'+String(index),item.trackId),field('Start (seconds)','audio-start:'+String(index),item.start,'number'),field('Length (seconds)','audio-duration:'+String(index),item.duration,'number'),field('Trim start','audio-trim:'+String(index),item.trimStart===undefined?item.sourceOffset:item.trimStart,'number'),field('Volume','audio-volume:'+String(index),item.volume,'number'),{tag:'label',children:[{tag:'span',text:'Muted'},{tag:'input',type:'checkbox',action:'audio-muted:'+String(index),checked:!!item.muted,disabled:busy,label:'Muted'}]}]}]});\\nconst textCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.id)},remove('remove-text:'+String(index))]},{tag:'div',className:'grid',children:[field('Text','text-value:'+String(index),item.text,'text',true),field('Track','text-track:'+String(index),item.trackId),field('Start (seconds)','text-start:'+String(index),item.start,'number'),field('Length (seconds)','text-duration:'+String(index),item.duration,'number'),field('Animation','text-animation:'+String(index),item.animation)]}]});\\nconst captionCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.id)},remove('remove-caption:'+String(index))]},{tag:'div',className:'grid',children:[field('Caption','caption-value:'+String(index),item.text,'text',true),field('Track','caption-track:'+String(index),item.trackId),field('Start (seconds)','caption-start:'+String(index),item.start,'number'),field('End (seconds)','caption-end:'+String(index),item.end,'number'),field('Animation','caption-animation:'+String(index),item.animation)]}]});\\nconst effectCard=(item,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(item.type)||text(item.id)},remove('remove-effect:'+String(index))]},{tag:'div',className:'grid',children:[field('Type','effect-type:'+String(index),item.type),field('Track','effect-track:'+String(index),item.trackId),field('Start (seconds)','effect-start:'+String(index),item.start,'number'),field('Length (seconds)','effect-duration:'+String(index),item.duration,'number'),field('Intensity','effect-intensity:'+String(index),item.intensity,'number')]}]});\\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft=clone(source);if(!Array.isArray(draft.tracks))draft.tracks=[];if(!Array.isArray(draft.clips))draft.clips=[];if(!Array.isArray(draft.audioItems))draft.audioItems=[];if(!Array.isArray(draft.captions))draft.captions=[];if(!Array.isArray(draft.textOverlays))draft.textOverlays=[];if(!Array.isArray(draft.effects))draft.effects=[]};\\nconst draw=()=>{ensure();StillMade.render('clips',draft.clips.length?draft.clips.map(clipCard):[{tag:'p',text:'No video clips.'}]);StillMade.render('audio',draft.audioItems.length?draft.audioItems.map(audioCard):[{tag:'p',text:'No audio items.'}]);StillMade.render('text',draft.textOverlays.length?draft.textOverlays.map(textCard):[{tag:'p',text:'No text overlays.'}]);StillMade.render('captions',draft.captions.length?draft.captions.map(captionCard):[{tag:'p',text:'No captions.'}]);StillMade.render('effects',draft.effects.length?draft.effects.map(effectCard):[{tag:'p',text:'No effects.'}]);timelineId.value=text(draft.activeTimelineId);aspect.value=text(draft.aspect);const mg=(Array.isArray(draft.fullscreenFrames)?draft.fullscreenFrames.length:0)+(Array.isArray(draft.figureSweeps)?draft.figureSweeps.length:0)+(Array.isArray(draft.graphs)?draft.graphs.length:0);graphics.textContent=String(mg)+' motion graphic item'+(mg===1?'':'s')+' retained in this Editor Block. Use Complete Editor data for advanced motion-graphics fields.';raw.value=JSON.stringify(draft,null,2);summary.textContent=String(draft.clips.length)+' video · '+String(draft.audioItems.length)+' audio · '+String(draft.captions.length)+' captions · '+String(draft.textOverlays.length)+' text';save.disabled=busy;document.getElementById('reset').disabled=busy;document.getElementById('addText').disabled=busy;document.getElementById('addCaption').disabled=busy};\\nconst changed=()=>{revision+=1;raw.value=JSON.stringify(draft,null,2);status.textContent='Changes are local until you choose Review changes.'};\\naspect.addEventListener('input',()=>{draft.aspect=aspect.value;changed()});\\nStillMade.onAction(event=>{if(busy)return;ensure();const parts=event.action.split(':'),kind=parts[0],index=Number(parts[1]),clip=draft.clips.find((item,position)=>position===index),audio=draft.audioItems.find((item,position)=>position===index),title=draft.textOverlays.find((item,position)=>position===index),caption=draft.captions.find((item,position)=>position===index),effect=draft.effects.find((item,position)=>position===index);\\n if(kind==='remove-clip'){draft.clips=draft.clips.filter((item,position)=>position!==index);changed();draw();return}if(kind==='remove-audio'){draft.audioItems=draft.audioItems.filter((item,position)=>position!==index);changed();draw();return}if(kind==='remove-text'){draft.textOverlays=draft.textOverlays.filter((item,position)=>position!==index);changed();draw();return}if(kind==='remove-caption'){draft.captions=draft.captions.filter((item,position)=>position!==index);changed();draw();return}if(kind==='remove-effect'){draft.effects=draft.effects.filter((item,position)=>position!==index);changed();draw();return}\\n if(clip){if(kind==='clip-track')clip.trackId=event.value;if(kind==='clip-start')clip.start=Math.max(0,Number(event.value)||0);if(kind==='clip-duration')clip.duration=Math.max(0.001,Number(event.value)||0.001);if(kind==='clip-trim')clip.trimStart=Math.max(0,Number(event.value)||0);if(kind==='clip-speed')clip.speed=Math.max(0.01,Number(event.value)||1);if(kind==='clip-volume')clip.volume=Math.max(0,Number(event.value)||0);if(kind==='clip-transition'||kind==='clip-transition-duration'){if(!clip.transition||Array.isArray(clip.transition))clip.transition={type:'Cut',duration:0};if(kind==='clip-transition')clip.transition.type=event.value;else clip.transition.duration=Math.max(0,Number(event.value)||0)}if(kind==='clip-motion'||kind==='clip-easing'){if(!clip.motion||Array.isArray(clip.motion))clip.motion={type:'none',easing:'ease-in-out'};if(kind==='clip-motion')clip.motion.type=event.value;else clip.motion.easing=event.value}}\\n if(audio){if(kind==='audio-track')audio.trackId=event.value;if(kind==='audio-start')audio.start=Math.max(0,Number(event.value)||0);if(kind==='audio-duration')audio.duration=Math.max(0.001,Number(event.value)||0.001);if(kind==='audio-trim'){audio.trimStart=Math.max(0,Number(event.value)||0);audio.sourceOffset=audio.trimStart}if(kind==='audio-volume')audio.volume=Math.max(0,Number(event.value)||0);if(kind==='audio-muted')audio.muted=event.checked}\\n if(title){if(kind==='text-value')title.text=event.value;if(kind==='text-track')title.trackId=event.value;if(kind==='text-start')title.start=Math.max(0,Number(event.value)||0);if(kind==='text-duration')title.duration=Math.max(0.001,Number(event.value)||0.001);if(kind==='text-animation')title.animation=event.value}\\n if(caption){if(kind==='caption-value')caption.text=event.value;if(kind==='caption-track')caption.trackId=event.value;if(kind==='caption-start')caption.start=Math.max(0,Number(event.value)||0);if(kind==='caption-end')caption.end=Math.max(caption.start+0.001,Number(event.value)||caption.start+0.001);if(kind==='caption-animation')caption.animation=event.value}\\n if(effect){if(kind==='effect-type')effect.type=event.value;if(kind==='effect-track')effect.trackId=event.value;if(kind==='effect-start')effect.start=Math.max(0,Number(event.value)||0);if(kind==='effect-duration')effect.duration=Math.max(0.001,Number(event.value)||0.001);if(kind==='effect-intensity')effect.intensity=Number(event.value)}changed()});\\ndocument.getElementById('addText').addEventListener('click',()=>{if(busy)return;ensure();draft.textOverlays=[...draft.textOverlays,{id:'portable-text-'+String(draft.textOverlays.length+1)+'-'+String(revision+1),trackId:'text',text:'New text',start:0,duration:2,animation:'none'}];changed();draw()});\\ndocument.getElementById('addCaption').addEventListener('click',()=>{if(busy)return;ensure();draft.captions=[...draft.captions,{id:'portable-caption-'+String(draft.captions.length+1)+'-'+String(revision+1),trackId:'captions',text:'New caption',start:0,end:2,font:'Hanken Grotesk',animation:'none'}];changed();draw()});\\ndocument.getElementById('applyRaw').addEventListener('click',()=>{if(busy)return;try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1||typeof value.activeTimelineId!=='string')throw Error('Editor JSON must be a version 1 document with an active timeline ID.');draft=clone(value);changed();draw();status.textContent='Complete Editor data applied locally.'}catch(error){status.textContent=error.message}});\\ndocument.getElementById('reset').addEventListener('click',()=>{if(!busy){draft=clone(source);revision+=1;draw();status.textContent='Changes reset to the current Editor timeline.'}});\\nsave.addEventListener('click',async()=>{if(busy)return;const started=revision;busy=true;draw();status.textContent='Checking the complete Editor timeline…';try{const result=await StillMade.run({editor:source,updatedEditor:draft,commit:true});draft=clone(result.editor);if(started===revision)status.textContent='Editor changes are ready below. Review the before and after, then choose Apply.'}catch(error){status.textContent=error.message||'Editor changes could not be prepared.'}finally{busy=false;draw()}});\\nStillMade.onInput(values=>{source=clone(values.editor||source);draft=clone(source);revision+=1;draw();status.textContent='Edit the complete timeline. Motion graphics and every other Editor tool stay inside this Block.'});\\n\"\n}"},"lineage":{"parents":[],"changes":"Packaged original Block source for StillMade."}}}],"license":"MIT"}