stillmade-sdk 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.stillmade/sdk-baseline.json +1 -1
- package/AGENTS.md +8 -2
- package/DESKTOP_CAPABILITIES.md +1 -1
- package/INTERFACE_DESIGN.md +167 -83
- package/MODULES.md +1 -1
- package/NATIVE_MCP.md +1 -1
- package/PASTE_TO_LLM.md +151 -12
- package/README.md +5 -2
- package/SDK.md +510 -115
- package/UI_AESTHETIC.md +64 -0
- package/blocks/native/sm.export-video/versions/2.1.0/package.js +580 -0
- package/blocks/native/sm.panel-strip/versions/2.4.0/package.js +1176 -0
- package/blocks/native/sm.panel-strip/versions/2.4.1/package.js +1316 -0
- package/blocks/native/sm.shot-plan/versions/2.2.0/package.js +800 -0
- package/blocks/native/sm.shot-plan/versions/2.2.1/package.js +920 -0
- package/examples/README.md +10 -0
- package/examples/custom-interface.stillmade.json +3 -3
- package/package.json +7 -1
- package/packages/block-cli/dev-host/assets/host.js +219 -26
- package/packages/block-cli/dev-host/assets/index.css +1 -1
- package/packages/block-cli/format.js +1 -1
- package/packages/block-cli/templates.js +53 -22
- package/packages/block-platform/block-readiness.js +5 -0
- package/packages/block-platform/brief-ports.js +29 -0
- package/packages/block-platform/catalog.js +32 -9
- package/packages/block-platform/current-semantic-source.js +7 -3
- package/packages/block-platform/flow-inspection.js +14 -4
- package/packages/block-platform/plain-descriptions.js +1 -1
- package/packages/block-platform/project-context.js +7 -0
- package/packages/block-platform/project-input-samples.js +3 -1
- package/packages/block-platform/project-inputs.js +11 -2
- package/packages/block-platform/project-start-input.js +46 -0
- package/packages/block-platform/segment-runner.js +4 -2
- package/packages/block-platform/step-groups.js +4 -0
- package/packages/block-platform/steps.js +55 -4
- package/packages/block-platform/type-preview.js +19 -3
- package/packages/block-platform/workspace-input-readset.js +6 -1
- package/packages/block-sdk/builder-contract.js +11 -5
- package/packages/block-sdk/collaboration-admission.js +4 -2
- package/packages/block-sdk/connection-adapters.js +35 -2
- package/packages/block-sdk/contracts.js +5 -2
- package/packages/block-sdk/examples.js +3 -3
- package/packages/block-sdk/first-party-identities.js +190 -0
- package/packages/block-sdk/first-party-packages.js +6 -1
- package/packages/block-sdk/index.d.ts +2 -0
- package/packages/block-sdk/index.js +1 -1
- package/packages/block-sdk/javascript.js +5 -1
- package/packages/block-sdk/platform-checks.js +13 -2
- package/packages/block-sdk/shared-agent-controls.js +5 -4
- package/packages/block-sdk/shared-controls.js +13 -9
- package/packages/block-sdk/view-design.js +104 -27
- package/packages/block-sdk/view.js +4 -2
- package/packages/design-system/block-kit.css +184 -0
- package/packages/design-system/block-kit.html +187 -0
|
@@ -0,0 +1,920 @@
|
|
|
1
|
+
// Generated by scripts/build-owned-blocks.mjs. Edit the owned source files.
|
|
2
|
+
export default {
|
|
3
|
+
"manifest": {
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"sdkVersion": "0.1.0",
|
|
6
|
+
"id": "sm.shot-plan",
|
|
7
|
+
"version": "2.2.1",
|
|
8
|
+
"name": "Shots",
|
|
9
|
+
"description": "Build a timed shot plan from narration, either connected from an earlier Step or saved in the project, then review and edit narration, visual direction, framing, duration, fulfillment, motion, statements, order, and retained custom fields.",
|
|
10
|
+
"kind": "workspace",
|
|
11
|
+
"runtime": "javascript",
|
|
12
|
+
"entry": "src/run.js",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"provenance": {
|
|
15
|
+
"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",
|
|
16
|
+
"portableSources": [
|
|
17
|
+
{
|
|
18
|
+
"kind": "original",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"paths": [
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"src/run.js",
|
|
23
|
+
"src/view.json"
|
|
24
|
+
],
|
|
25
|
+
"evidence": [
|
|
26
|
+
"upstream/0/LICENSE",
|
|
27
|
+
"upstream/0/src/run.js",
|
|
28
|
+
"upstream/0/src/view.json"
|
|
29
|
+
],
|
|
30
|
+
"changes": "Original implementation declared by the packager; no reused repository or dependency code."
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"inputs": {
|
|
35
|
+
"shotPlan": {
|
|
36
|
+
"type": "shot-plan",
|
|
37
|
+
"context": "shotPlan",
|
|
38
|
+
"primary": true,
|
|
39
|
+
"required": false,
|
|
40
|
+
"default": {
|
|
41
|
+
"schemaVersion": 1,
|
|
42
|
+
"shots": []
|
|
43
|
+
},
|
|
44
|
+
"description": "The complete current shot plan. Unknown fields and saved media identities are retained.",
|
|
45
|
+
"semantic": "production_shot_plan"
|
|
46
|
+
},
|
|
47
|
+
"transcript": {
|
|
48
|
+
"type": "transcript",
|
|
49
|
+
"context": "transcript",
|
|
50
|
+
"required": false,
|
|
51
|
+
"default": {
|
|
52
|
+
"schemaVersion": 1,
|
|
53
|
+
"text": "",
|
|
54
|
+
"words": []
|
|
55
|
+
},
|
|
56
|
+
"description": "Current narration words and timings used to build an initial plan when the project has no shots.",
|
|
57
|
+
"semantic": "timed_transcript"
|
|
58
|
+
},
|
|
59
|
+
"script": {
|
|
60
|
+
"type": "script",
|
|
61
|
+
"context": "script",
|
|
62
|
+
"required": false,
|
|
63
|
+
"default": {
|
|
64
|
+
"schemaVersion": 1,
|
|
65
|
+
"text": ""
|
|
66
|
+
},
|
|
67
|
+
"description": "Current narration text used when word timings are unavailable.",
|
|
68
|
+
"semantic": "narration_script"
|
|
69
|
+
},
|
|
70
|
+
"narrationScript": {
|
|
71
|
+
"type": "script",
|
|
72
|
+
"required": false,
|
|
73
|
+
"description": "Narration script from an earlier Step, such as Script Writer or your own script Block. When it has text, it is used instead of the project's saved narration.",
|
|
74
|
+
"semantic": "narration_script"
|
|
75
|
+
},
|
|
76
|
+
"narrationTiming": {
|
|
77
|
+
"type": "transcript",
|
|
78
|
+
"required": false,
|
|
79
|
+
"description": "Timed narration words from an earlier Step. When connected and filled, its word timings shape the shots instead of the project's saved voiceover timing.",
|
|
80
|
+
"semantic": "timed_transcript"
|
|
81
|
+
},
|
|
82
|
+
"updatedShotPlan": {
|
|
83
|
+
"type": "shot-plan",
|
|
84
|
+
"required": false,
|
|
85
|
+
"default": {
|
|
86
|
+
"schemaVersion": 1,
|
|
87
|
+
"shots": []
|
|
88
|
+
},
|
|
89
|
+
"description": "The complete edited plan prepared in this workspace.",
|
|
90
|
+
"semantic": "production_shot_plan"
|
|
91
|
+
},
|
|
92
|
+
"commit": {
|
|
93
|
+
"type": "boolean",
|
|
94
|
+
"default": false,
|
|
95
|
+
"description": "Prepare the edited plan for StillMade review and Apply.",
|
|
96
|
+
"semantic": "apply_changes",
|
|
97
|
+
"required": false
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"outputs": {
|
|
101
|
+
"shotPlan": {
|
|
102
|
+
"type": "shot-plan",
|
|
103
|
+
"primary": true,
|
|
104
|
+
"role": "production_shot_plan",
|
|
105
|
+
"description": "The complete edited shot plan for the next Step.",
|
|
106
|
+
"semantic": "production_shot_plan"
|
|
107
|
+
},
|
|
108
|
+
"edit": {
|
|
109
|
+
"type": "workspace-edit",
|
|
110
|
+
"description": "An exact before/after Shots change reviewed before it updates the project.",
|
|
111
|
+
"semantic": "workspace_edit"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"permissions": {
|
|
115
|
+
"project": [
|
|
116
|
+
"context.shotPlan.read",
|
|
117
|
+
"context.transcript.read",
|
|
118
|
+
"context.script.read",
|
|
119
|
+
"workspace.shotPlan.propose"
|
|
120
|
+
],
|
|
121
|
+
"network": [],
|
|
122
|
+
"filesystem": [],
|
|
123
|
+
"secrets": []
|
|
124
|
+
},
|
|
125
|
+
"ui": [],
|
|
126
|
+
"platforms": {
|
|
127
|
+
"phone": {
|
|
128
|
+
"supported": true
|
|
129
|
+
},
|
|
130
|
+
"browser": {
|
|
131
|
+
"supported": true
|
|
132
|
+
},
|
|
133
|
+
"desktop": {
|
|
134
|
+
"supported": true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"code": "const copy = value => JSON.parse(JSON.stringify(value));\nconst filled = value => typeof value==='string' ? !!value.trim() : !!(value && typeof value==='object' && (String(value.text || '').trim() || (Array.isArray(value.words) && value.words.length)));\n// Narration connected from an earlier Step is used first; the project's saved narration otherwise.\nconst wired = filled(input.narrationScript) || filled(input.narrationTiming);\nconst transcript = wired ? (filled(input.narrationTiming) ? input.narrationTiming : null) : input.transcript;\nconst script = wired ? (filled(input.narrationScript) ? input.narrationScript : null) : input.script;\nconst words = Array.isArray(transcript?.words) ? transcript.words : [];\nconst scriptText = String(transcript?.text || script?.text || (typeof script==='string'?script:'')).trim();\nconst timed = word => ({text:String(word?.text || word?.word || '').trim(),start:Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000,end:Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000});\nconst make = (text,start,end,index) => ({id:`shot-${index+1}-${Math.max(0,Math.round(start*1000))}`,voiceoverText:text,shotDescription:text?`Show a clear visual for: ${text}`:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\nconst fromWords = () => {const clean=words.map(timed).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start);const groups=[];let group=[];clean.forEach(word=>{group.push(word);const duration=word.end-group[0].start,punctuation=/[.!?]$/.test(word.text);if((punctuation&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[];}});if(group.length)groups.push(group);return groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group[group.length-1].end,index));};\n// A sentence ends at . ! or ? followed by a space or the end, so web addresses, domains and emails stay in one shot.\nconst fromScript = () => {const parts=(scriptText.match(/[\\s\\S]*?[.!?]+[\"'”’)\\]]*(?=\\s|$)|[\\s\\S]+/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return parts.map((text,index)=>{const duration=Math.max(2,Math.round(text.split(/\\s+/).length/2.5*10)/10),shot=make(text,cursor,cursor+duration,index);cursor+=duration;return shot;});};\nconst generated = () => ({schemaVersion:1,shots:words.length?fromWords():fromScript()});\nconst source = copy(input.shotPlan || {schemaVersion:1,shots:[]});\nconst fallback = !source.shots?.length ? generated() : source;\nconst candidate = input.commit ? copy(input.updatedShotPlan) : copy(fallback);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || !Array.isArray(candidate.shots)) throw new Error('Keep the complete version 1 shot plan.');\nif (candidate.shots.length > 2000 || !candidate.shots.every(shot => shot && !Array.isArray(shot) && typeof shot.id === 'string' && shot.id.length > 0 && shot.id.length <= 200) || new Set(candidate.shots.map(shot => shot.id)).size !== candidate.shots.length) throw new Error('Shots need up to 2,000 distinct retained IDs.');\nreturn {shotPlan:candidate,edit:{schemaVersion:1,title:`Update ${candidate.shots.length} planned shot${candidate.shots.length===1?'':'s'}`,field:'shotPlan',before:source,after:candidate}};\n",
|
|
139
|
+
"view": {
|
|
140
|
+
"html": "<main class=\"shots-workspace\">\n <header><div><small>Production workspace</small><h1>Shots</h1><p id=\"summary\">Loading the shot plan…</p></div><div class=\"actions\"><button id=\"build\" type=\"button\" class=\"secondary\">Build from narration</button><button id=\"reset\" type=\"button\" class=\"secondary\">Reset changes</button><button id=\"add\" type=\"button\" class=\"secondary\">Add shot</button><button id=\"save\" type=\"button\" data-stillmade-action=\"run\">Review changes</button></div></header>\n <output id=\"status\" role=\"status\" aria-live=\"polite\"></output>\n <nav aria-label=\"Shot pages\"><button id=\"previous\" type=\"button\">Previous</button><output id=\"page\"></output><button id=\"next\" type=\"button\">Next</button><button id=\"discard\" type=\"button\" disabled>Discard local draft and load shared</button></nav>\n <section id=\"shots\" class=\"shots\" aria-label=\"Planned shots\"></section>\n <details><summary>Complete shot-plan data</summary><p>Every field is retained. Use this editor for custom fields not shown on the cards.</p><label for=\"raw\">Complete shot-plan JSON</label><textarea id=\"raw\" class=\"raw\" spellcheck=\"false\"></textarea><button id=\"applyRaw\" type=\"button\" class=\"secondary\">Apply JSON to workspace</button></details>\n</main>\n",
|
|
141
|
+
"css": ".shots-workspace{max-width:1100px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.card-head,.row,.order{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{color:var(--fg-muted)}\n.shots{display:grid;gap:12px}.card,details{padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.card-head{justify-content:space-between}.card h2{margin:0;font-size:18px}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}label{display:grid;gap:5px;margin:8px 0;font-size:13px;font-weight:600}input,textarea,select{width:100%;background:var(--bg)}textarea{min-height:82px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:340px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}.order button{min-width:44px}.empty{padding:28px;text-align:center;border:1px dashed var(--border-tok);border-radius:var(--r-3);color:var(--fg-muted)}\n@media(max-width:760px){.shots-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}.card,details{padding:12px}}\n",
|
|
142
|
+
"javascript": "const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),build=document.getElementById('build');\nlet source={schemaVersion:1,shots:[]},draft={schemaVersion:1,shots:[]},transcript={schemaVersion:1,text:'',words:[]},script={schemaVersion:1,text:''},narrationScript=null,narrationTiming=null,busy=false,revision=0;\nlet shared={state:{},outputs:{},canEdit:false},canEdit=false,pending=0,failed=false,initialized=false,page=0,rawDirty=false,rawBase=null,queuedBase=null;\nconst identities=[];\nconst keyFor=id=>{let key=identities.indexOf(id);if(key<0){identities.push(id);key=identities.length-1;}return key;};\nconst clone=value=>JSON.parse(JSON.stringify(value));\nconst text=value=>value===undefined||value===null?'':String(value);\nconst wordStart=word=>Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000;\nconst wordEnd=word=>Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000;\nconst filled=value=>typeof value==='string'?!!value.trim():!!(value&&typeof value==='object'&&(text(value.text).trim()||(Array.isArray(value.words)&&value.words.length)));\n// Narration connected from an earlier Step is used first; the project's saved narration otherwise.\nconst heard=()=>filled(narrationScript)||filled(narrationTiming)?{transcript:filled(narrationTiming)?narrationTiming:{schemaVersion:1,text:'',words:[]},script:filled(narrationScript)?narrationScript:{schemaVersion:1,text:''}}:{transcript,script};\nconst make=(line,start,end,index)=>({id:'shot-'+String(index+1)+'-'+String(Math.max(0,Math.round(start*1000))),voiceoverText:line,shotDescription:line?'Show a clear visual for: '+line:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\n// A sentence ends at . ! or ? followed by a space or the end, so web addresses, domains and emails stay in one shot.\nconst plan=()=>{const {transcript,script}=heard(),words=Array.isArray(transcript.words)?transcript.words.map(word=>({text:text(word?.text||word?.word).trim(),start:wordStart(word),end:wordEnd(word)})).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start):[];if(words.length){const groups=[];let group=[];words.forEach(word=>{group.push(word);const duration=word.end-group[0].start;if((/[.!?]$/.test(word.text)&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[]}});if(group.length)groups.push(group);return {schemaVersion:1,shots:groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group.at(-1).end,index))}}const narration=text(transcript.text||script.text||(typeof script==='string'?script:'')).trim(),parts=(narration.match(/[\\s\\S]*?[.!?]+[\"'”’)\\]]*(?=\\s|$)|[\\s\\S]+/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return {schemaVersion:1,shots:parts.map((line,index)=>{const duration=Math.max(2,Math.round(line.split(/\\s+/).length/2.5*10)/10),shot=make(line,cursor,cursor+duration,index);cursor+=duration;return shot})}};\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},type==='textarea'?{tag:'textarea',id:'control-'+action,action,value:text(value),disabled:busy||!canEdit||failed,label}:{tag:'input',id:'control-'+action,type,action,value:Number.isFinite(value)?value:text(value),disabled:busy||!canEdit||failed,label}]});\nconst choice=(label,action,value,options)=>({tag:'label',children:[{tag:'span',text:label},{tag:'select',id:'control-'+action,action,value:text(value),disabled:busy||!canEdit||failed,label,children:options.map(option=>({tag:'option',text:option,value:option}))}]});\nconst shotCard=(shot,position)=>{const index=keyFor(shot.id);return {tag:'article',id:'shot-'+String(index),className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h2',text:'Shot '+String(position+1)+' · '+(text(shot.shotDescription)||text(shot.title)||shot.id)},{tag:'div',className:'order',children:[{tag:'button',action:'up:'+String(index),text:'↑',className:'secondary',disabled:busy||!canEdit||failed||position===0,label:'Move shot up'},{tag:'button',action:'down:'+String(index),text:'↓',className:'secondary',disabled:busy||!canEdit||failed||position===draft.shots.length-1,label:'Move shot down'},{tag:'button',action:'remove:'+String(index),text:'Remove',className:'danger',disabled:busy||!canEdit||failed}]}]},{tag:'div',className:'grid',children:[field('Narration','narration:'+String(index),shot.voiceoverText,'textarea',true),field('Visual direction','description:'+String(index),shot.shotDescription||shot.description,'textarea',true),choice('Framing','size:'+String(index),shot.shotSize||'Medium',['Wide','Medium','Close','Extreme Close']),choice('Purpose','type:'+String(index),shot.shotType||'Story',['Story','Coverage Wide','Coverage Medium','Cutaway','Insert','Movement','Transition']),field('Screen time (seconds)','duration:'+String(index),shot.estimatedScreenTime,'number'),choice('Fulfillment','fulfillment:'+String(index),shot.fulfillment||'video',['video','imageMotion']),choice('Motion','motion:'+String(index),shot.motionEffect||'Ken Burns',['Ken Burns','Pan Left','Pan Right','Push In','Pull Out','Tilt Up','Tilt Down','Drift','Locked Frame']),choice('Motion speed','speed:'+String(index),shot.motionSpeed||'Slow',['Slow','Medium','Fast']),{tag:'label',children:[{tag:'span',text:'Full-screen statement'},{tag:'input',type:'checkbox',action:'statement:'+String(index),checked:!!shot.statement,disabled:busy||!canEdit||failed,label:'Full-screen statement'}]},field('Statement reveal','reveal:'+String(index),shot.statementReveal||'words')]}]};};\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft={schemaVersion:1,shots:[]};if(!Array.isArray(draft.shots))draft.shots=[]};\nconst draw=()=>{\n ensure();page=Math.min(page,Math.max(0,Math.ceil(draft.shots.length/8)-1));\n StillMade.render('shots',draft.shots.length?draft.shots.slice(page*8,page*8+8).map((shot,index)=>shotCard(shot,page*8+index)):[{tag:'p',className:'empty',text:'No shots yet. Build from narration or add the first shot.'}]);\n if(!rawDirty)raw.value=JSON.stringify(draft,null,2);\n summary.textContent=String(draft.shots.length)+' planned shot'+(draft.shots.length===1?'':'s');\n save.disabled=busy||!canEdit||failed||pending>0||!!queuedBase;build.disabled=busy||!canEdit||failed||!(()=>{const {transcript,script}=heard();return transcript.words?.length||text(transcript.text||script.text||(typeof script==='string'?script:'')).trim();})();\n ['reset','add','applyRaw'].forEach(id=>{document.getElementById(id).disabled=busy||!canEdit||failed;});\n raw.disabled=busy||!canEdit;\n document.getElementById('previous').disabled=page===0;\n document.getElementById('next').disabled=(page+1)*8>=draft.shots.length;\n document.getElementById('page').textContent='Page '+String(page+1)+' of '+String(Math.max(1,Math.ceil(draft.shots.length/8)));\n document.getElementById('discard').disabled=pending>0||(!failed&&!rawDirty);\n};\nconst receive=value=>{\n shared=value;canEdit=value.canEdit;\n if(value.state.plan)initialized=true;\n if(!pending&&!queuedBase&&!failed&&value.state.plan)draft=clone(value.state.plan);\n draw();\n if(!busy&&!pending&&!failed&&value.outputs.edit)status.textContent='A shared shot-plan proposal is ready below. Review before applying.';\n};\nconst publishDraft=()=>{\n if(failed){queuedBase=null;draw();return;}\n const before=queuedBase;if(!before)return;queuedBase=null;\n revision+=1;const exists=initialized;initialized=true;pending+=1;draw();\n return StillMade.updateShared({plan:clone(draft)},{plan:exists?{exists:true,value:before}:{exists:false}},{merge:true}).catch(error=>{\n failed=true;status.textContent=error.message+' Your draft is retained. Copy it before loading the shared draft to resolve.';\n }).finally(()=>{pending-=1;if(!failed&&!pending&&!queuedBase)receive(StillMade.getShared());else draw();});\n};\nconst changed=before=>{\n if(!queuedBase)queuedBase=before;\n status.textContent='Sharing the draft. Review changes before applying to the project.';\n save.disabled=true;StillMade.scheduleSharedEdit('plan',publishDraft);\n};\nStillMade.onAction(event=>{if(busy||!canEdit||failed)return;ensure();const before=queuedBase||clone(draft),parts=event.action.split(':'),kind=parts[0],identity=identities.at(Number(parts[1])),index=draft.shots.findIndex(item=>item.id===identity),shot=draft.shots.find(item=>item.id===identity);if(!shot)return;if(kind==='remove'){draft.shots=draft.shots.filter((item,position)=>position!==index);changed(before);draw();return}if(kind==='up'||kind==='down'){const target=index+(kind==='up'?-1:1);if(target>=0&&target<draft.shots.length){draft.shots=draft.shots.map((item,position)=>position===index?draft.shots.find((candidate,candidatePosition)=>candidatePosition===target):position===target?shot:item);changed(before);draw()}return}if(!shot)return;if(kind==='narration')shot.voiceoverText=event.value;if(kind==='description')shot.shotDescription=event.value;if(kind==='size')shot.shotSize=event.value;if(kind==='type')shot.shotType=event.value;if(kind==='duration'){shot.estimatedScreenTime=Number(event.value);shot.generationLength=Math.min(15,Number(event.value)+2)}if(kind==='fulfillment'){shot.fulfillment=event.value;shot.fulfillmentSetBy='user'}if(kind==='motion')shot.motionEffect=event.value;if(kind==='speed')shot.motionSpeed=event.value;if(kind==='statement'){shot.statement=event.checked;shot.statementSetBy='user'}if(kind==='reveal')shot.statementReveal=event.value;changed(before)});\nbuild.addEventListener('click',()=>{if(busy||!canEdit||failed)return;const before=clone(draft);draft=plan();page=0;changed(before);});\ndocument.getElementById('add').addEventListener('click',()=>{\n if(busy||!canEdit||failed)return;const before=clone(draft);\n const id='portable-shot-'+String(Date.now())+'-'+Math.random().toString(36).slice(2);\n draft.shots=[...draft.shots,{id,voiceoverText:'',shotDescription:'',shotSize:'Medium',shotType:'Story',estimatedScreenTime:3,generationLength:5,fulfillment:'video'}];page=Math.floor((draft.shots.length-1)/8);changed(before);\n});\nraw.addEventListener('input',()=>{if(!rawDirty)rawBase=clone(draft);rawDirty=true;document.getElementById('discard').disabled=false;});\ndocument.getElementById('applyRaw').addEventListener('click',()=>{\n if(busy||!canEdit||failed)return;\n try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1||!Array.isArray(value.shots)||value.shots.length>2000||!value.shots.every(shot=>shot&&typeof shot.id==='string'&&shot.id.length>0)||new Set(value.shots.map(shot=>shot.id)).size!==value.shots.length)throw Error('Use a version 1 shot plan with at most 2,000 distinct shot IDs.');\n const before=rawBase||clone(draft);draft=clone(value);rawDirty=false;rawBase=null;changed(before);\n }catch(error){status.textContent=error.message;}\n});\ndocument.getElementById('reset').addEventListener('click',()=>{if(busy||!canEdit||failed)return;const before=clone(draft);draft=clone(source);rawDirty=false;rawBase=null;changed(before);});\ndocument.getElementById('discard').addEventListener('click',()=>{\n if(pending||queuedBase)return;failed=false;rawDirty=false;rawBase=null;shared=StillMade.getShared();initialized=!!shared.state.plan;draft=clone(shared.state.plan||source);draw();status.textContent='Loaded the shared draft. The discarded local draft is no longer in this interface.';\n});\ndocument.getElementById('previous').addEventListener('click',()=>{if(page>0){page-=1;draw();}});\ndocument.getElementById('next').addEventListener('click',()=>{if((page+1)*8<draft.shots.length){page+=1;draw();}});\nsave.addEventListener('click',async()=>{\n if(busy||!canEdit||failed||pending||queuedBase)return;const started=revision;busy=true;draw();status.textContent='Checking the complete shot plan…';\n try{await StillMade.run({shotPlan:source,transcript,script,updatedShotPlan:clone(draft),commit:true});if(started===revision)status.textContent='Shots are ready below. Review the before and after, then choose Apply.';}\n catch(error){status.textContent=error.message||'The shot plan could not be prepared.';}\n finally{busy=false;draw();}\n});\nStillMade.onShared(receive);\nStillMade.onInput(values=>{\n source=clone(values.shotPlan||{schemaVersion:1,shots:[]});transcript=clone(values.transcript||{schemaVersion:1,text:'',words:[]});script=clone(values.script||{schemaVersion:1,text:''});narrationScript=values.narrationScript===undefined?null:clone(values.narrationScript);narrationTiming=values.narrationTiming===undefined?null:clone(values.narrationTiming);\n if(!initialized&&!pending&&!queuedBase&&!failed)draft=source.shots?.length?clone(source):plan();\n revision+=1;receive(StillMade.getShared());\n});\n"
|
|
143
|
+
},
|
|
144
|
+
"tests": [
|
|
145
|
+
{
|
|
146
|
+
"name": "builds timed shots from narration when the project has no plan",
|
|
147
|
+
"input": {
|
|
148
|
+
"shotPlan": {
|
|
149
|
+
"schemaVersion": 1,
|
|
150
|
+
"shots": []
|
|
151
|
+
},
|
|
152
|
+
"transcript": {
|
|
153
|
+
"schemaVersion": 1,
|
|
154
|
+
"text": "Open with the city. Then show the product.",
|
|
155
|
+
"words": [
|
|
156
|
+
{
|
|
157
|
+
"text": "Open",
|
|
158
|
+
"start": 0,
|
|
159
|
+
"end": 0.5
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"text": "with",
|
|
163
|
+
"start": 0.5,
|
|
164
|
+
"end": 1
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"text": "the",
|
|
168
|
+
"start": 1,
|
|
169
|
+
"end": 1.3
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"text": "city.",
|
|
173
|
+
"start": 1.3,
|
|
174
|
+
"end": 3
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"text": "Then",
|
|
178
|
+
"start": 3,
|
|
179
|
+
"end": 3.5
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"text": "show",
|
|
183
|
+
"start": 3.5,
|
|
184
|
+
"end": 4
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"text": "the",
|
|
188
|
+
"start": 4,
|
|
189
|
+
"end": 4.3
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"text": "product.",
|
|
193
|
+
"start": 4.3,
|
|
194
|
+
"end": 7
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
"script": {
|
|
199
|
+
"schemaVersion": 1,
|
|
200
|
+
"text": "Open with the city. Then show the product."
|
|
201
|
+
},
|
|
202
|
+
"updatedShotPlan": {
|
|
203
|
+
"schemaVersion": 1,
|
|
204
|
+
"shots": []
|
|
205
|
+
},
|
|
206
|
+
"commit": false
|
|
207
|
+
},
|
|
208
|
+
"expected": {
|
|
209
|
+
"shotPlan": {
|
|
210
|
+
"schemaVersion": 1,
|
|
211
|
+
"shots": [
|
|
212
|
+
{
|
|
213
|
+
"id": "shot-1-0",
|
|
214
|
+
"voiceoverText": "Open with the city.",
|
|
215
|
+
"shotDescription": "Show a clear visual for: Open with the city.",
|
|
216
|
+
"startTime": 0,
|
|
217
|
+
"endTime": 3,
|
|
218
|
+
"estimatedScreenTime": 3,
|
|
219
|
+
"generationLength": 5,
|
|
220
|
+
"shotSize": "Wide",
|
|
221
|
+
"shotType": "Story",
|
|
222
|
+
"fulfillment": "video"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"id": "shot-2-3000",
|
|
226
|
+
"voiceoverText": "Then show the product.",
|
|
227
|
+
"shotDescription": "Show a clear visual for: Then show the product.",
|
|
228
|
+
"startTime": 3,
|
|
229
|
+
"endTime": 7,
|
|
230
|
+
"estimatedScreenTime": 4,
|
|
231
|
+
"generationLength": 6,
|
|
232
|
+
"shotSize": "Medium",
|
|
233
|
+
"shotType": "Story",
|
|
234
|
+
"fulfillment": "video"
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
"edit": {
|
|
239
|
+
"schemaVersion": 1,
|
|
240
|
+
"title": "Update 2 planned shots",
|
|
241
|
+
"field": "shotPlan",
|
|
242
|
+
"before": {
|
|
243
|
+
"schemaVersion": 1,
|
|
244
|
+
"shots": []
|
|
245
|
+
},
|
|
246
|
+
"after": {
|
|
247
|
+
"schemaVersion": 1,
|
|
248
|
+
"shots": [
|
|
249
|
+
{
|
|
250
|
+
"id": "shot-1-0",
|
|
251
|
+
"voiceoverText": "Open with the city.",
|
|
252
|
+
"shotDescription": "Show a clear visual for: Open with the city.",
|
|
253
|
+
"startTime": 0,
|
|
254
|
+
"endTime": 3,
|
|
255
|
+
"estimatedScreenTime": 3,
|
|
256
|
+
"generationLength": 5,
|
|
257
|
+
"shotSize": "Wide",
|
|
258
|
+
"shotType": "Story",
|
|
259
|
+
"fulfillment": "video"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"id": "shot-2-3000",
|
|
263
|
+
"voiceoverText": "Then show the product.",
|
|
264
|
+
"shotDescription": "Show a clear visual for: Then show the product.",
|
|
265
|
+
"startTime": 3,
|
|
266
|
+
"endTime": 7,
|
|
267
|
+
"estimatedScreenTime": 4,
|
|
268
|
+
"generationLength": 6,
|
|
269
|
+
"shotSize": "Medium",
|
|
270
|
+
"shotType": "Story",
|
|
271
|
+
"fulfillment": "video"
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": "commits the complete edited plan without losing media or custom data",
|
|
280
|
+
"input": {
|
|
281
|
+
"shotPlan": {
|
|
282
|
+
"schemaVersion": 1,
|
|
283
|
+
"shots": [
|
|
284
|
+
{
|
|
285
|
+
"id": "opening",
|
|
286
|
+
"voiceoverText": "Keep narration",
|
|
287
|
+
"selectedImage": {
|
|
288
|
+
"assetId": "image-1",
|
|
289
|
+
"versionId": "v1"
|
|
290
|
+
},
|
|
291
|
+
"custom": {
|
|
292
|
+
"approved": true
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
]
|
|
296
|
+
},
|
|
297
|
+
"transcript": {
|
|
298
|
+
"schemaVersion": 1,
|
|
299
|
+
"text": "Keep narration",
|
|
300
|
+
"words": []
|
|
301
|
+
},
|
|
302
|
+
"script": {
|
|
303
|
+
"schemaVersion": 1,
|
|
304
|
+
"text": "Keep narration"
|
|
305
|
+
},
|
|
306
|
+
"updatedShotPlan": {
|
|
307
|
+
"schemaVersion": 1,
|
|
308
|
+
"shots": [
|
|
309
|
+
{
|
|
310
|
+
"id": "opening",
|
|
311
|
+
"voiceoverText": "Keep narration",
|
|
312
|
+
"shotDescription": "A better opening",
|
|
313
|
+
"selectedImage": {
|
|
314
|
+
"assetId": "image-1",
|
|
315
|
+
"versionId": "v2"
|
|
316
|
+
},
|
|
317
|
+
"custom": {
|
|
318
|
+
"approved": true
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
"commit": true
|
|
324
|
+
},
|
|
325
|
+
"expected": {
|
|
326
|
+
"shotPlan": {
|
|
327
|
+
"schemaVersion": 1,
|
|
328
|
+
"shots": [
|
|
329
|
+
{
|
|
330
|
+
"id": "opening",
|
|
331
|
+
"voiceoverText": "Keep narration",
|
|
332
|
+
"shotDescription": "A better opening",
|
|
333
|
+
"selectedImage": {
|
|
334
|
+
"assetId": "image-1",
|
|
335
|
+
"versionId": "v2"
|
|
336
|
+
},
|
|
337
|
+
"custom": {
|
|
338
|
+
"approved": true
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
},
|
|
343
|
+
"edit": {
|
|
344
|
+
"schemaVersion": 1,
|
|
345
|
+
"title": "Update 1 planned shot",
|
|
346
|
+
"field": "shotPlan",
|
|
347
|
+
"before": {
|
|
348
|
+
"schemaVersion": 1,
|
|
349
|
+
"shots": [
|
|
350
|
+
{
|
|
351
|
+
"id": "opening",
|
|
352
|
+
"voiceoverText": "Keep narration",
|
|
353
|
+
"selectedImage": {
|
|
354
|
+
"assetId": "image-1",
|
|
355
|
+
"versionId": "v1"
|
|
356
|
+
},
|
|
357
|
+
"custom": {
|
|
358
|
+
"approved": true
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
},
|
|
363
|
+
"after": {
|
|
364
|
+
"schemaVersion": 1,
|
|
365
|
+
"shots": [
|
|
366
|
+
{
|
|
367
|
+
"id": "opening",
|
|
368
|
+
"voiceoverText": "Keep narration",
|
|
369
|
+
"shotDescription": "A better opening",
|
|
370
|
+
"selectedImage": {
|
|
371
|
+
"assetId": "image-1",
|
|
372
|
+
"versionId": "v2"
|
|
373
|
+
},
|
|
374
|
+
"custom": {
|
|
375
|
+
"approved": true
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"name": "estimates timing from script sentences when word timings are unavailable",
|
|
385
|
+
"input": {
|
|
386
|
+
"shotPlan": {
|
|
387
|
+
"schemaVersion": 1,
|
|
388
|
+
"shots": []
|
|
389
|
+
},
|
|
390
|
+
"transcript": {
|
|
391
|
+
"schemaVersion": 1,
|
|
392
|
+
"text": "First beat. Second beat here!",
|
|
393
|
+
"words": []
|
|
394
|
+
},
|
|
395
|
+
"script": {
|
|
396
|
+
"schemaVersion": 1,
|
|
397
|
+
"text": ""
|
|
398
|
+
},
|
|
399
|
+
"updatedShotPlan": {
|
|
400
|
+
"schemaVersion": 1,
|
|
401
|
+
"shots": []
|
|
402
|
+
},
|
|
403
|
+
"commit": false
|
|
404
|
+
},
|
|
405
|
+
"expected": {
|
|
406
|
+
"shotPlan": {
|
|
407
|
+
"schemaVersion": 1,
|
|
408
|
+
"shots": [
|
|
409
|
+
{
|
|
410
|
+
"id": "shot-1-0",
|
|
411
|
+
"voiceoverText": "First beat.",
|
|
412
|
+
"shotDescription": "Show a clear visual for: First beat.",
|
|
413
|
+
"startTime": 0,
|
|
414
|
+
"endTime": 2,
|
|
415
|
+
"estimatedScreenTime": 2,
|
|
416
|
+
"generationLength": 4,
|
|
417
|
+
"shotSize": "Wide",
|
|
418
|
+
"shotType": "Story",
|
|
419
|
+
"fulfillment": "video"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"id": "shot-2-2000",
|
|
423
|
+
"voiceoverText": "Second beat here!",
|
|
424
|
+
"shotDescription": "Show a clear visual for: Second beat here!",
|
|
425
|
+
"startTime": 2,
|
|
426
|
+
"endTime": 4,
|
|
427
|
+
"estimatedScreenTime": 2,
|
|
428
|
+
"generationLength": 4,
|
|
429
|
+
"shotSize": "Medium",
|
|
430
|
+
"shotType": "Story",
|
|
431
|
+
"fulfillment": "video"
|
|
432
|
+
}
|
|
433
|
+
]
|
|
434
|
+
},
|
|
435
|
+
"edit": {
|
|
436
|
+
"schemaVersion": 1,
|
|
437
|
+
"title": "Update 2 planned shots",
|
|
438
|
+
"field": "shotPlan",
|
|
439
|
+
"before": {
|
|
440
|
+
"schemaVersion": 1,
|
|
441
|
+
"shots": []
|
|
442
|
+
},
|
|
443
|
+
"after": {
|
|
444
|
+
"schemaVersion": 1,
|
|
445
|
+
"shots": [
|
|
446
|
+
{
|
|
447
|
+
"id": "shot-1-0",
|
|
448
|
+
"voiceoverText": "First beat.",
|
|
449
|
+
"shotDescription": "Show a clear visual for: First beat.",
|
|
450
|
+
"startTime": 0,
|
|
451
|
+
"endTime": 2,
|
|
452
|
+
"estimatedScreenTime": 2,
|
|
453
|
+
"generationLength": 4,
|
|
454
|
+
"shotSize": "Wide",
|
|
455
|
+
"shotType": "Story",
|
|
456
|
+
"fulfillment": "video"
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"id": "shot-2-2000",
|
|
460
|
+
"voiceoverText": "Second beat here!",
|
|
461
|
+
"shotDescription": "Show a clear visual for: Second beat here!",
|
|
462
|
+
"startTime": 2,
|
|
463
|
+
"endTime": 4,
|
|
464
|
+
"estimatedScreenTime": 2,
|
|
465
|
+
"generationLength": 4,
|
|
466
|
+
"shotSize": "Medium",
|
|
467
|
+
"shotType": "Story",
|
|
468
|
+
"fulfillment": "video"
|
|
469
|
+
}
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"name": "keeps an empty project empty without treating document objects as narration",
|
|
477
|
+
"input": {
|
|
478
|
+
"shotPlan": {
|
|
479
|
+
"schemaVersion": 1,
|
|
480
|
+
"shots": []
|
|
481
|
+
},
|
|
482
|
+
"transcript": {
|
|
483
|
+
"schemaVersion": 1,
|
|
484
|
+
"text": "",
|
|
485
|
+
"words": []
|
|
486
|
+
},
|
|
487
|
+
"script": {
|
|
488
|
+
"schemaVersion": 1,
|
|
489
|
+
"text": ""
|
|
490
|
+
},
|
|
491
|
+
"updatedShotPlan": {
|
|
492
|
+
"schemaVersion": 1,
|
|
493
|
+
"shots": []
|
|
494
|
+
},
|
|
495
|
+
"commit": false
|
|
496
|
+
},
|
|
497
|
+
"expected": {
|
|
498
|
+
"shotPlan": {
|
|
499
|
+
"schemaVersion": 1,
|
|
500
|
+
"shots": []
|
|
501
|
+
},
|
|
502
|
+
"edit": {
|
|
503
|
+
"schemaVersion": 1,
|
|
504
|
+
"title": "Update 0 planned shots",
|
|
505
|
+
"field": "shotPlan",
|
|
506
|
+
"before": {
|
|
507
|
+
"schemaVersion": 1,
|
|
508
|
+
"shots": []
|
|
509
|
+
},
|
|
510
|
+
"after": {
|
|
511
|
+
"schemaVersion": 1,
|
|
512
|
+
"shots": []
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"name": "uses connected narration before the project's saved narration",
|
|
519
|
+
"input": {
|
|
520
|
+
"shotPlan": {
|
|
521
|
+
"schemaVersion": 1,
|
|
522
|
+
"shots": []
|
|
523
|
+
},
|
|
524
|
+
"updatedShotPlan": {
|
|
525
|
+
"schemaVersion": 1,
|
|
526
|
+
"shots": []
|
|
527
|
+
},
|
|
528
|
+
"commit": false,
|
|
529
|
+
"transcript": {
|
|
530
|
+
"schemaVersion": 1,
|
|
531
|
+
"text": "Saved project narration that is out of date.",
|
|
532
|
+
"words": []
|
|
533
|
+
},
|
|
534
|
+
"script": {
|
|
535
|
+
"schemaVersion": 1,
|
|
536
|
+
"text": ""
|
|
537
|
+
},
|
|
538
|
+
"narrationScript": {
|
|
539
|
+
"schemaVersion": 1,
|
|
540
|
+
"text": "Open on the harbour. Close on the lighthouse!"
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
"expected": {
|
|
544
|
+
"shotPlan": {
|
|
545
|
+
"schemaVersion": 1,
|
|
546
|
+
"shots": [
|
|
547
|
+
{
|
|
548
|
+
"id": "shot-1-0",
|
|
549
|
+
"voiceoverText": "Open on the harbour.",
|
|
550
|
+
"shotDescription": "Show a clear visual for: Open on the harbour.",
|
|
551
|
+
"startTime": 0,
|
|
552
|
+
"endTime": 2,
|
|
553
|
+
"estimatedScreenTime": 2,
|
|
554
|
+
"generationLength": 4,
|
|
555
|
+
"shotSize": "Wide",
|
|
556
|
+
"shotType": "Story",
|
|
557
|
+
"fulfillment": "video"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
"id": "shot-2-2000",
|
|
561
|
+
"voiceoverText": "Close on the lighthouse!",
|
|
562
|
+
"shotDescription": "Show a clear visual for: Close on the lighthouse!",
|
|
563
|
+
"startTime": 2,
|
|
564
|
+
"endTime": 4,
|
|
565
|
+
"estimatedScreenTime": 2,
|
|
566
|
+
"generationLength": 4,
|
|
567
|
+
"shotSize": "Medium",
|
|
568
|
+
"shotType": "Story",
|
|
569
|
+
"fulfillment": "video"
|
|
570
|
+
}
|
|
571
|
+
]
|
|
572
|
+
},
|
|
573
|
+
"edit": {
|
|
574
|
+
"schemaVersion": 1,
|
|
575
|
+
"title": "Update 2 planned shots",
|
|
576
|
+
"field": "shotPlan",
|
|
577
|
+
"before": {
|
|
578
|
+
"schemaVersion": 1,
|
|
579
|
+
"shots": []
|
|
580
|
+
},
|
|
581
|
+
"after": {
|
|
582
|
+
"schemaVersion": 1,
|
|
583
|
+
"shots": [
|
|
584
|
+
{
|
|
585
|
+
"id": "shot-1-0",
|
|
586
|
+
"voiceoverText": "Open on the harbour.",
|
|
587
|
+
"shotDescription": "Show a clear visual for: Open on the harbour.",
|
|
588
|
+
"startTime": 0,
|
|
589
|
+
"endTime": 2,
|
|
590
|
+
"estimatedScreenTime": 2,
|
|
591
|
+
"generationLength": 4,
|
|
592
|
+
"shotSize": "Wide",
|
|
593
|
+
"shotType": "Story",
|
|
594
|
+
"fulfillment": "video"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"id": "shot-2-2000",
|
|
598
|
+
"voiceoverText": "Close on the lighthouse!",
|
|
599
|
+
"shotDescription": "Show a clear visual for: Close on the lighthouse!",
|
|
600
|
+
"startTime": 2,
|
|
601
|
+
"endTime": 4,
|
|
602
|
+
"estimatedScreenTime": 2,
|
|
603
|
+
"generationLength": 4,
|
|
604
|
+
"shotSize": "Medium",
|
|
605
|
+
"shotType": "Story",
|
|
606
|
+
"fulfillment": "video"
|
|
607
|
+
}
|
|
608
|
+
]
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"name": "uses connected word timings when an earlier Step supplies them",
|
|
615
|
+
"input": {
|
|
616
|
+
"shotPlan": {
|
|
617
|
+
"schemaVersion": 1,
|
|
618
|
+
"shots": []
|
|
619
|
+
},
|
|
620
|
+
"updatedShotPlan": {
|
|
621
|
+
"schemaVersion": 1,
|
|
622
|
+
"shots": []
|
|
623
|
+
},
|
|
624
|
+
"commit": false,
|
|
625
|
+
"transcript": {
|
|
626
|
+
"schemaVersion": 1,
|
|
627
|
+
"text": "",
|
|
628
|
+
"words": []
|
|
629
|
+
},
|
|
630
|
+
"script": {
|
|
631
|
+
"schemaVersion": 1,
|
|
632
|
+
"text": ""
|
|
633
|
+
},
|
|
634
|
+
"narrationTiming": {
|
|
635
|
+
"schemaVersion": 1,
|
|
636
|
+
"text": "Morning light.",
|
|
637
|
+
"words": [
|
|
638
|
+
{
|
|
639
|
+
"text": "Morning",
|
|
640
|
+
"start": 0.5,
|
|
641
|
+
"end": 1.2
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"text": "light.",
|
|
645
|
+
"start": 1.2,
|
|
646
|
+
"end": 2
|
|
647
|
+
}
|
|
648
|
+
]
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
"expected": {
|
|
652
|
+
"shotPlan": {
|
|
653
|
+
"schemaVersion": 1,
|
|
654
|
+
"shots": [
|
|
655
|
+
{
|
|
656
|
+
"id": "shot-1-500",
|
|
657
|
+
"voiceoverText": "Morning light.",
|
|
658
|
+
"shotDescription": "Show a clear visual for: Morning light.",
|
|
659
|
+
"startTime": 0.5,
|
|
660
|
+
"endTime": 2,
|
|
661
|
+
"estimatedScreenTime": 1.5,
|
|
662
|
+
"generationLength": 4,
|
|
663
|
+
"shotSize": "Wide",
|
|
664
|
+
"shotType": "Story",
|
|
665
|
+
"fulfillment": "video"
|
|
666
|
+
}
|
|
667
|
+
]
|
|
668
|
+
},
|
|
669
|
+
"edit": {
|
|
670
|
+
"schemaVersion": 1,
|
|
671
|
+
"title": "Update 1 planned shot",
|
|
672
|
+
"field": "shotPlan",
|
|
673
|
+
"before": {
|
|
674
|
+
"schemaVersion": 1,
|
|
675
|
+
"shots": []
|
|
676
|
+
},
|
|
677
|
+
"after": {
|
|
678
|
+
"schemaVersion": 1,
|
|
679
|
+
"shots": [
|
|
680
|
+
{
|
|
681
|
+
"id": "shot-1-500",
|
|
682
|
+
"voiceoverText": "Morning light.",
|
|
683
|
+
"shotDescription": "Show a clear visual for: Morning light.",
|
|
684
|
+
"startTime": 0.5,
|
|
685
|
+
"endTime": 2,
|
|
686
|
+
"estimatedScreenTime": 1.5,
|
|
687
|
+
"generationLength": 4,
|
|
688
|
+
"shotSize": "Wide",
|
|
689
|
+
"shotType": "Story",
|
|
690
|
+
"fulfillment": "video"
|
|
691
|
+
}
|
|
692
|
+
]
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
"name": "falls back to the project narration when the connected Step has no narration yet",
|
|
699
|
+
"input": {
|
|
700
|
+
"shotPlan": {
|
|
701
|
+
"schemaVersion": 1,
|
|
702
|
+
"shots": []
|
|
703
|
+
},
|
|
704
|
+
"updatedShotPlan": {
|
|
705
|
+
"schemaVersion": 1,
|
|
706
|
+
"shots": []
|
|
707
|
+
},
|
|
708
|
+
"commit": false,
|
|
709
|
+
"transcript": {
|
|
710
|
+
"schemaVersion": 1,
|
|
711
|
+
"text": "",
|
|
712
|
+
"words": []
|
|
713
|
+
},
|
|
714
|
+
"script": {
|
|
715
|
+
"schemaVersion": 1,
|
|
716
|
+
"text": "Saved script line."
|
|
717
|
+
},
|
|
718
|
+
"narrationScript": {
|
|
719
|
+
"schemaVersion": 1,
|
|
720
|
+
"text": " "
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
"expected": {
|
|
724
|
+
"shotPlan": {
|
|
725
|
+
"schemaVersion": 1,
|
|
726
|
+
"shots": [
|
|
727
|
+
{
|
|
728
|
+
"id": "shot-1-0",
|
|
729
|
+
"voiceoverText": "Saved script line.",
|
|
730
|
+
"shotDescription": "Show a clear visual for: Saved script line.",
|
|
731
|
+
"startTime": 0,
|
|
732
|
+
"endTime": 2,
|
|
733
|
+
"estimatedScreenTime": 2,
|
|
734
|
+
"generationLength": 4,
|
|
735
|
+
"shotSize": "Wide",
|
|
736
|
+
"shotType": "Story",
|
|
737
|
+
"fulfillment": "video"
|
|
738
|
+
}
|
|
739
|
+
]
|
|
740
|
+
},
|
|
741
|
+
"edit": {
|
|
742
|
+
"schemaVersion": 1,
|
|
743
|
+
"title": "Update 1 planned shot",
|
|
744
|
+
"field": "shotPlan",
|
|
745
|
+
"before": {
|
|
746
|
+
"schemaVersion": 1,
|
|
747
|
+
"shots": []
|
|
748
|
+
},
|
|
749
|
+
"after": {
|
|
750
|
+
"schemaVersion": 1,
|
|
751
|
+
"shots": [
|
|
752
|
+
{
|
|
753
|
+
"id": "shot-1-0",
|
|
754
|
+
"voiceoverText": "Saved script line.",
|
|
755
|
+
"shotDescription": "Show a clear visual for: Saved script line.",
|
|
756
|
+
"startTime": 0,
|
|
757
|
+
"endTime": 2,
|
|
758
|
+
"estimatedScreenTime": 2,
|
|
759
|
+
"generationLength": 4,
|
|
760
|
+
"shotSize": "Wide",
|
|
761
|
+
"shotType": "Story",
|
|
762
|
+
"fulfillment": "video"
|
|
763
|
+
}
|
|
764
|
+
]
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
"name": "keeps web addresses, domains and emails inside one shot",
|
|
771
|
+
"input": {
|
|
772
|
+
"shotPlan": {
|
|
773
|
+
"schemaVersion": 1,
|
|
774
|
+
"shots": []
|
|
775
|
+
},
|
|
776
|
+
"updatedShotPlan": {
|
|
777
|
+
"schemaVersion": 1,
|
|
778
|
+
"shots": []
|
|
779
|
+
},
|
|
780
|
+
"commit": false,
|
|
781
|
+
"transcript": {
|
|
782
|
+
"schemaVersion": 1,
|
|
783
|
+
"text": "",
|
|
784
|
+
"words": []
|
|
785
|
+
},
|
|
786
|
+
"script": {
|
|
787
|
+
"schemaVersion": 1,
|
|
788
|
+
"text": ""
|
|
789
|
+
},
|
|
790
|
+
"narrationScript": {
|
|
791
|
+
"schemaVersion": 1,
|
|
792
|
+
"text": "Come see it today. Check us out at testmotors.example. Email sales@testmotors.example or open https://www.testmotors.example/inventory?stock=42 now."
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
"expected": {
|
|
796
|
+
"shotPlan": {
|
|
797
|
+
"schemaVersion": 1,
|
|
798
|
+
"shots": [
|
|
799
|
+
{
|
|
800
|
+
"id": "shot-1-0",
|
|
801
|
+
"voiceoverText": "Come see it today.",
|
|
802
|
+
"shotDescription": "Show a clear visual for: Come see it today.",
|
|
803
|
+
"startTime": 0,
|
|
804
|
+
"endTime": 2,
|
|
805
|
+
"estimatedScreenTime": 2,
|
|
806
|
+
"generationLength": 4,
|
|
807
|
+
"shotSize": "Wide",
|
|
808
|
+
"shotType": "Story",
|
|
809
|
+
"fulfillment": "video"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
"id": "shot-2-2000",
|
|
813
|
+
"voiceoverText": "Check us out at testmotors.example.",
|
|
814
|
+
"shotDescription": "Show a clear visual for: Check us out at testmotors.example.",
|
|
815
|
+
"startTime": 2,
|
|
816
|
+
"endTime": 4,
|
|
817
|
+
"estimatedScreenTime": 2,
|
|
818
|
+
"generationLength": 4,
|
|
819
|
+
"shotSize": "Medium",
|
|
820
|
+
"shotType": "Story",
|
|
821
|
+
"fulfillment": "video"
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
"id": "shot-3-4000",
|
|
825
|
+
"voiceoverText": "Email sales@testmotors.example or open https://www.testmotors.example/inventory?stock=42 now.",
|
|
826
|
+
"shotDescription": "Show a clear visual for: Email sales@testmotors.example or open https://www.testmotors.example/inventory?stock=42 now.",
|
|
827
|
+
"startTime": 4,
|
|
828
|
+
"endTime": 6.4,
|
|
829
|
+
"estimatedScreenTime": 2.4,
|
|
830
|
+
"generationLength": 5,
|
|
831
|
+
"shotSize": "Close",
|
|
832
|
+
"shotType": "Story",
|
|
833
|
+
"fulfillment": "video"
|
|
834
|
+
}
|
|
835
|
+
]
|
|
836
|
+
},
|
|
837
|
+
"edit": {
|
|
838
|
+
"schemaVersion": 1,
|
|
839
|
+
"title": "Update 3 planned shots",
|
|
840
|
+
"field": "shotPlan",
|
|
841
|
+
"before": {
|
|
842
|
+
"schemaVersion": 1,
|
|
843
|
+
"shots": []
|
|
844
|
+
},
|
|
845
|
+
"after": {
|
|
846
|
+
"schemaVersion": 1,
|
|
847
|
+
"shots": [
|
|
848
|
+
{
|
|
849
|
+
"id": "shot-1-0",
|
|
850
|
+
"voiceoverText": "Come see it today.",
|
|
851
|
+
"shotDescription": "Show a clear visual for: Come see it today.",
|
|
852
|
+
"startTime": 0,
|
|
853
|
+
"endTime": 2,
|
|
854
|
+
"estimatedScreenTime": 2,
|
|
855
|
+
"generationLength": 4,
|
|
856
|
+
"shotSize": "Wide",
|
|
857
|
+
"shotType": "Story",
|
|
858
|
+
"fulfillment": "video"
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
"id": "shot-2-2000",
|
|
862
|
+
"voiceoverText": "Check us out at testmotors.example.",
|
|
863
|
+
"shotDescription": "Show a clear visual for: Check us out at testmotors.example.",
|
|
864
|
+
"startTime": 2,
|
|
865
|
+
"endTime": 4,
|
|
866
|
+
"estimatedScreenTime": 2,
|
|
867
|
+
"generationLength": 4,
|
|
868
|
+
"shotSize": "Medium",
|
|
869
|
+
"shotType": "Story",
|
|
870
|
+
"fulfillment": "video"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
"id": "shot-3-4000",
|
|
874
|
+
"voiceoverText": "Email sales@testmotors.example or open https://www.testmotors.example/inventory?stock=42 now.",
|
|
875
|
+
"shotDescription": "Show a clear visual for: Email sales@testmotors.example or open https://www.testmotors.example/inventory?stock=42 now.",
|
|
876
|
+
"startTime": 4,
|
|
877
|
+
"endTime": 6.4,
|
|
878
|
+
"estimatedScreenTime": 2.4,
|
|
879
|
+
"generationLength": 5,
|
|
880
|
+
"shotSize": "Close",
|
|
881
|
+
"shotType": "Story",
|
|
882
|
+
"fulfillment": "video"
|
|
883
|
+
}
|
|
884
|
+
]
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
],
|
|
890
|
+
"portable": {
|
|
891
|
+
"format": "stillmade-block/1",
|
|
892
|
+
"dependencies": [],
|
|
893
|
+
"sources": [
|
|
894
|
+
{
|
|
895
|
+
"kind": "original",
|
|
896
|
+
"license": "MIT",
|
|
897
|
+
"paths": [
|
|
898
|
+
"LICENSE",
|
|
899
|
+
"src/run.js",
|
|
900
|
+
"src/view.json"
|
|
901
|
+
],
|
|
902
|
+
"evidence": [
|
|
903
|
+
"upstream/0/LICENSE",
|
|
904
|
+
"upstream/0/src/run.js",
|
|
905
|
+
"upstream/0/src/view.json"
|
|
906
|
+
],
|
|
907
|
+
"changes": "Original implementation declared by the packager; no reused repository or dependency code."
|
|
908
|
+
}
|
|
909
|
+
],
|
|
910
|
+
"files": {
|
|
911
|
+
"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",
|
|
912
|
+
"upstream/0/src/run.js": "const copy = value => JSON.parse(JSON.stringify(value));\nconst filled = value => typeof value==='string' ? !!value.trim() : !!(value && typeof value==='object' && (String(value.text || '').trim() || (Array.isArray(value.words) && value.words.length)));\n// Narration connected from an earlier Step is used first; the project's saved narration otherwise.\nconst wired = filled(input.narrationScript) || filled(input.narrationTiming);\nconst transcript = wired ? (filled(input.narrationTiming) ? input.narrationTiming : null) : input.transcript;\nconst script = wired ? (filled(input.narrationScript) ? input.narrationScript : null) : input.script;\nconst words = Array.isArray(transcript?.words) ? transcript.words : [];\nconst scriptText = String(transcript?.text || script?.text || (typeof script==='string'?script:'')).trim();\nconst timed = word => ({text:String(word?.text || word?.word || '').trim(),start:Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000,end:Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000});\nconst make = (text,start,end,index) => ({id:`shot-${index+1}-${Math.max(0,Math.round(start*1000))}`,voiceoverText:text,shotDescription:text?`Show a clear visual for: ${text}`:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\nconst fromWords = () => {const clean=words.map(timed).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start);const groups=[];let group=[];clean.forEach(word=>{group.push(word);const duration=word.end-group[0].start,punctuation=/[.!?]$/.test(word.text);if((punctuation&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[];}});if(group.length)groups.push(group);return groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group[group.length-1].end,index));};\n// A sentence ends at . ! or ? followed by a space or the end, so web addresses, domains and emails stay in one shot.\nconst fromScript = () => {const parts=(scriptText.match(/[\\s\\S]*?[.!?]+[\"'”’)\\]]*(?=\\s|$)|[\\s\\S]+/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return parts.map((text,index)=>{const duration=Math.max(2,Math.round(text.split(/\\s+/).length/2.5*10)/10),shot=make(text,cursor,cursor+duration,index);cursor+=duration;return shot;});};\nconst generated = () => ({schemaVersion:1,shots:words.length?fromWords():fromScript()});\nconst source = copy(input.shotPlan || {schemaVersion:1,shots:[]});\nconst fallback = !source.shots?.length ? generated() : source;\nconst candidate = input.commit ? copy(input.updatedShotPlan) : copy(fallback);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || !Array.isArray(candidate.shots)) throw new Error('Keep the complete version 1 shot plan.');\nif (candidate.shots.length > 2000 || !candidate.shots.every(shot => shot && !Array.isArray(shot) && typeof shot.id === 'string' && shot.id.length > 0 && shot.id.length <= 200) || new Set(candidate.shots.map(shot => shot.id)).size !== candidate.shots.length) throw new Error('Shots need up to 2,000 distinct retained IDs.');\nreturn {shotPlan:candidate,edit:{schemaVersion:1,title:`Update ${candidate.shots.length} planned shot${candidate.shots.length===1?'':'s'}`,field:'shotPlan',before:source,after:candidate}};\n",
|
|
913
|
+
"upstream/0/src/view.json": "{\n \"html\": \"<main class=\\\"shots-workspace\\\">\\n <header><div><small>Production workspace</small><h1>Shots</h1><p id=\\\"summary\\\">Loading the shot plan…</p></div><div class=\\\"actions\\\"><button id=\\\"build\\\" type=\\\"button\\\" class=\\\"secondary\\\">Build from narration</button><button id=\\\"reset\\\" type=\\\"button\\\" class=\\\"secondary\\\">Reset changes</button><button id=\\\"add\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add shot</button><button id=\\\"save\\\" type=\\\"button\\\" data-stillmade-action=\\\"run\\\">Review changes</button></div></header>\\n <output id=\\\"status\\\" role=\\\"status\\\" aria-live=\\\"polite\\\"></output>\\n <nav aria-label=\\\"Shot pages\\\"><button id=\\\"previous\\\" type=\\\"button\\\">Previous</button><output id=\\\"page\\\"></output><button id=\\\"next\\\" type=\\\"button\\\">Next</button><button id=\\\"discard\\\" type=\\\"button\\\" disabled>Discard local draft and load shared</button></nav>\\n <section id=\\\"shots\\\" class=\\\"shots\\\" aria-label=\\\"Planned shots\\\"></section>\\n <details><summary>Complete shot-plan data</summary><p>Every field is retained. Use this editor for custom fields not shown on the cards.</p><label for=\\\"raw\\\">Complete shot-plan JSON</label><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\": \".shots-workspace{max-width:1100px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.card-head,.row,.order{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{color:var(--fg-muted)}\\n.shots{display:grid;gap:12px}.card,details{padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.card-head{justify-content:space-between}.card h2{margin:0;font-size:18px}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}label{display:grid;gap:5px;margin:8px 0;font-size:13px;font-weight:600}input,textarea,select{width:100%;background:var(--bg)}textarea{min-height:82px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:340px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}.order button{min-width:44px}.empty{padding:28px;text-align:center;border:1px dashed var(--border-tok);border-radius:var(--r-3);color:var(--fg-muted)}\\n@media(max-width:760px){.shots-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}.card,details{padding:12px}}\\n\",\n \"javascript\": \"const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),build=document.getElementById('build');\\nlet source={schemaVersion:1,shots:[]},draft={schemaVersion:1,shots:[]},transcript={schemaVersion:1,text:'',words:[]},script={schemaVersion:1,text:''},narrationScript=null,narrationTiming=null,busy=false,revision=0;\\nlet shared={state:{},outputs:{},canEdit:false},canEdit=false,pending=0,failed=false,initialized=false,page=0,rawDirty=false,rawBase=null,queuedBase=null;\\nconst identities=[];\\nconst keyFor=id=>{let key=identities.indexOf(id);if(key<0){identities.push(id);key=identities.length-1;}return key;};\\nconst clone=value=>JSON.parse(JSON.stringify(value));\\nconst text=value=>value===undefined||value===null?'':String(value);\\nconst wordStart=word=>Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000;\\nconst wordEnd=word=>Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000;\\nconst filled=value=>typeof value==='string'?!!value.trim():!!(value&&typeof value==='object'&&(text(value.text).trim()||(Array.isArray(value.words)&&value.words.length)));\\n// Narration connected from an earlier Step is used first; the project's saved narration otherwise.\\nconst heard=()=>filled(narrationScript)||filled(narrationTiming)?{transcript:filled(narrationTiming)?narrationTiming:{schemaVersion:1,text:'',words:[]},script:filled(narrationScript)?narrationScript:{schemaVersion:1,text:''}}:{transcript,script};\\nconst make=(line,start,end,index)=>({id:'shot-'+String(index+1)+'-'+String(Math.max(0,Math.round(start*1000))),voiceoverText:line,shotDescription:line?'Show a clear visual for: '+line:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\\n// A sentence ends at . ! or ? followed by a space or the end, so web addresses, domains and emails stay in one shot.\\nconst plan=()=>{const {transcript,script}=heard(),words=Array.isArray(transcript.words)?transcript.words.map(word=>({text:text(word?.text||word?.word).trim(),start:wordStart(word),end:wordEnd(word)})).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start):[];if(words.length){const groups=[];let group=[];words.forEach(word=>{group.push(word);const duration=word.end-group[0].start;if((/[.!?]$/.test(word.text)&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[]}});if(group.length)groups.push(group);return {schemaVersion:1,shots:groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group.at(-1).end,index))}}const narration=text(transcript.text||script.text||(typeof script==='string'?script:'')).trim(),parts=(narration.match(/[\\\\s\\\\S]*?[.!?]+[\\\"'”’)\\\\]]*(?=\\\\s|$)|[\\\\s\\\\S]+/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return {schemaVersion:1,shots:parts.map((line,index)=>{const duration=Math.max(2,Math.round(line.split(/\\\\s+/).length/2.5*10)/10),shot=make(line,cursor,cursor+duration,index);cursor+=duration;return shot})}};\\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},type==='textarea'?{tag:'textarea',id:'control-'+action,action,value:text(value),disabled:busy||!canEdit||failed,label}:{tag:'input',id:'control-'+action,type,action,value:Number.isFinite(value)?value:text(value),disabled:busy||!canEdit||failed,label}]});\\nconst choice=(label,action,value,options)=>({tag:'label',children:[{tag:'span',text:label},{tag:'select',id:'control-'+action,action,value:text(value),disabled:busy||!canEdit||failed,label,children:options.map(option=>({tag:'option',text:option,value:option}))}]});\\nconst shotCard=(shot,position)=>{const index=keyFor(shot.id);return {tag:'article',id:'shot-'+String(index),className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h2',text:'Shot '+String(position+1)+' · '+(text(shot.shotDescription)||text(shot.title)||shot.id)},{tag:'div',className:'order',children:[{tag:'button',action:'up:'+String(index),text:'↑',className:'secondary',disabled:busy||!canEdit||failed||position===0,label:'Move shot up'},{tag:'button',action:'down:'+String(index),text:'↓',className:'secondary',disabled:busy||!canEdit||failed||position===draft.shots.length-1,label:'Move shot down'},{tag:'button',action:'remove:'+String(index),text:'Remove',className:'danger',disabled:busy||!canEdit||failed}]}]},{tag:'div',className:'grid',children:[field('Narration','narration:'+String(index),shot.voiceoverText,'textarea',true),field('Visual direction','description:'+String(index),shot.shotDescription||shot.description,'textarea',true),choice('Framing','size:'+String(index),shot.shotSize||'Medium',['Wide','Medium','Close','Extreme Close']),choice('Purpose','type:'+String(index),shot.shotType||'Story',['Story','Coverage Wide','Coverage Medium','Cutaway','Insert','Movement','Transition']),field('Screen time (seconds)','duration:'+String(index),shot.estimatedScreenTime,'number'),choice('Fulfillment','fulfillment:'+String(index),shot.fulfillment||'video',['video','imageMotion']),choice('Motion','motion:'+String(index),shot.motionEffect||'Ken Burns',['Ken Burns','Pan Left','Pan Right','Push In','Pull Out','Tilt Up','Tilt Down','Drift','Locked Frame']),choice('Motion speed','speed:'+String(index),shot.motionSpeed||'Slow',['Slow','Medium','Fast']),{tag:'label',children:[{tag:'span',text:'Full-screen statement'},{tag:'input',type:'checkbox',action:'statement:'+String(index),checked:!!shot.statement,disabled:busy||!canEdit||failed,label:'Full-screen statement'}]},field('Statement reveal','reveal:'+String(index),shot.statementReveal||'words')]}]};};\\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft={schemaVersion:1,shots:[]};if(!Array.isArray(draft.shots))draft.shots=[]};\\nconst draw=()=>{\\n ensure();page=Math.min(page,Math.max(0,Math.ceil(draft.shots.length/8)-1));\\n StillMade.render('shots',draft.shots.length?draft.shots.slice(page*8,page*8+8).map((shot,index)=>shotCard(shot,page*8+index)):[{tag:'p',className:'empty',text:'No shots yet. Build from narration or add the first shot.'}]);\\n if(!rawDirty)raw.value=JSON.stringify(draft,null,2);\\n summary.textContent=String(draft.shots.length)+' planned shot'+(draft.shots.length===1?'':'s');\\n save.disabled=busy||!canEdit||failed||pending>0||!!queuedBase;build.disabled=busy||!canEdit||failed||!(()=>{const {transcript,script}=heard();return transcript.words?.length||text(transcript.text||script.text||(typeof script==='string'?script:'')).trim();})();\\n ['reset','add','applyRaw'].forEach(id=>{document.getElementById(id).disabled=busy||!canEdit||failed;});\\n raw.disabled=busy||!canEdit;\\n document.getElementById('previous').disabled=page===0;\\n document.getElementById('next').disabled=(page+1)*8>=draft.shots.length;\\n document.getElementById('page').textContent='Page '+String(page+1)+' of '+String(Math.max(1,Math.ceil(draft.shots.length/8)));\\n document.getElementById('discard').disabled=pending>0||(!failed&&!rawDirty);\\n};\\nconst receive=value=>{\\n shared=value;canEdit=value.canEdit;\\n if(value.state.plan)initialized=true;\\n if(!pending&&!queuedBase&&!failed&&value.state.plan)draft=clone(value.state.plan);\\n draw();\\n if(!busy&&!pending&&!failed&&value.outputs.edit)status.textContent='A shared shot-plan proposal is ready below. Review before applying.';\\n};\\nconst publishDraft=()=>{\\n if(failed){queuedBase=null;draw();return;}\\n const before=queuedBase;if(!before)return;queuedBase=null;\\n revision+=1;const exists=initialized;initialized=true;pending+=1;draw();\\n return StillMade.updateShared({plan:clone(draft)},{plan:exists?{exists:true,value:before}:{exists:false}},{merge:true}).catch(error=>{\\n failed=true;status.textContent=error.message+' Your draft is retained. Copy it before loading the shared draft to resolve.';\\n }).finally(()=>{pending-=1;if(!failed&&!pending&&!queuedBase)receive(StillMade.getShared());else draw();});\\n};\\nconst changed=before=>{\\n if(!queuedBase)queuedBase=before;\\n status.textContent='Sharing the draft. Review changes before applying to the project.';\\n save.disabled=true;StillMade.scheduleSharedEdit('plan',publishDraft);\\n};\\nStillMade.onAction(event=>{if(busy||!canEdit||failed)return;ensure();const before=queuedBase||clone(draft),parts=event.action.split(':'),kind=parts[0],identity=identities.at(Number(parts[1])),index=draft.shots.findIndex(item=>item.id===identity),shot=draft.shots.find(item=>item.id===identity);if(!shot)return;if(kind==='remove'){draft.shots=draft.shots.filter((item,position)=>position!==index);changed(before);draw();return}if(kind==='up'||kind==='down'){const target=index+(kind==='up'?-1:1);if(target>=0&&target<draft.shots.length){draft.shots=draft.shots.map((item,position)=>position===index?draft.shots.find((candidate,candidatePosition)=>candidatePosition===target):position===target?shot:item);changed(before);draw()}return}if(!shot)return;if(kind==='narration')shot.voiceoverText=event.value;if(kind==='description')shot.shotDescription=event.value;if(kind==='size')shot.shotSize=event.value;if(kind==='type')shot.shotType=event.value;if(kind==='duration'){shot.estimatedScreenTime=Number(event.value);shot.generationLength=Math.min(15,Number(event.value)+2)}if(kind==='fulfillment'){shot.fulfillment=event.value;shot.fulfillmentSetBy='user'}if(kind==='motion')shot.motionEffect=event.value;if(kind==='speed')shot.motionSpeed=event.value;if(kind==='statement'){shot.statement=event.checked;shot.statementSetBy='user'}if(kind==='reveal')shot.statementReveal=event.value;changed(before)});\\nbuild.addEventListener('click',()=>{if(busy||!canEdit||failed)return;const before=clone(draft);draft=plan();page=0;changed(before);});\\ndocument.getElementById('add').addEventListener('click',()=>{\\n if(busy||!canEdit||failed)return;const before=clone(draft);\\n const id='portable-shot-'+String(Date.now())+'-'+Math.random().toString(36).slice(2);\\n draft.shots=[...draft.shots,{id,voiceoverText:'',shotDescription:'',shotSize:'Medium',shotType:'Story',estimatedScreenTime:3,generationLength:5,fulfillment:'video'}];page=Math.floor((draft.shots.length-1)/8);changed(before);\\n});\\nraw.addEventListener('input',()=>{if(!rawDirty)rawBase=clone(draft);rawDirty=true;document.getElementById('discard').disabled=false;});\\ndocument.getElementById('applyRaw').addEventListener('click',()=>{\\n if(busy||!canEdit||failed)return;\\n try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1||!Array.isArray(value.shots)||value.shots.length>2000||!value.shots.every(shot=>shot&&typeof shot.id==='string'&&shot.id.length>0)||new Set(value.shots.map(shot=>shot.id)).size!==value.shots.length)throw Error('Use a version 1 shot plan with at most 2,000 distinct shot IDs.');\\n const before=rawBase||clone(draft);draft=clone(value);rawDirty=false;rawBase=null;changed(before);\\n }catch(error){status.textContent=error.message;}\\n});\\ndocument.getElementById('reset').addEventListener('click',()=>{if(busy||!canEdit||failed)return;const before=clone(draft);draft=clone(source);rawDirty=false;rawBase=null;changed(before);});\\ndocument.getElementById('discard').addEventListener('click',()=>{\\n if(pending||queuedBase)return;failed=false;rawDirty=false;rawBase=null;shared=StillMade.getShared();initialized=!!shared.state.plan;draft=clone(shared.state.plan||source);draw();status.textContent='Loaded the shared draft. The discarded local draft is no longer in this interface.';\\n});\\ndocument.getElementById('previous').addEventListener('click',()=>{if(page>0){page-=1;draw();}});\\ndocument.getElementById('next').addEventListener('click',()=>{if((page+1)*8<draft.shots.length){page+=1;draw();}});\\nsave.addEventListener('click',async()=>{\\n if(busy||!canEdit||failed||pending||queuedBase)return;const started=revision;busy=true;draw();status.textContent='Checking the complete shot plan…';\\n try{await StillMade.run({shotPlan:source,transcript,script,updatedShotPlan:clone(draft),commit:true});if(started===revision)status.textContent='Shots are ready below. Review the before and after, then choose Apply.';}\\n catch(error){status.textContent=error.message||'The shot plan could not be prepared.';}\\n finally{busy=false;draw();}\\n});\\nStillMade.onShared(receive);\\nStillMade.onInput(values=>{\\n source=clone(values.shotPlan||{schemaVersion:1,shots:[]});transcript=clone(values.transcript||{schemaVersion:1,text:'',words:[]});script=clone(values.script||{schemaVersion:1,text:''});narrationScript=values.narrationScript===undefined?null:clone(values.narrationScript);narrationTiming=values.narrationTiming===undefined?null:clone(values.narrationTiming);\\n if(!initialized&&!pending&&!queuedBase&&!failed)draft=source.shots?.length?clone(source):plan();\\n revision+=1;receive(StillMade.getShared());\\n});\\n\"\n}"
|
|
914
|
+
},
|
|
915
|
+
"lineage": {
|
|
916
|
+
"parents": [],
|
|
917
|
+
"changes": "Packaged original Block source for StillMade."
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
};
|