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,1176 @@
|
|
|
1
|
+
// Generated immutable package data.
|
|
2
|
+
export default {
|
|
3
|
+
"manifest": {
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"sdkVersion": "0.1.0",
|
|
6
|
+
"id": "sm.panel-strip",
|
|
7
|
+
"version": "2.4.0",
|
|
8
|
+
"name": "Image Panels",
|
|
9
|
+
"description": "Build an editable Image Panels draft from narration, either connected from an earlier Step or saved in the project, then review scenes, beats, images, versions, prompts, timing, canvas elements, transitions, actions, 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
|
+
"panels": {
|
|
36
|
+
"type": "panel-document",
|
|
37
|
+
"context": "panels",
|
|
38
|
+
"primary": true,
|
|
39
|
+
"required": false,
|
|
40
|
+
"default": {
|
|
41
|
+
"schemaVersion": 1,
|
|
42
|
+
"scenes": [],
|
|
43
|
+
"strip": []
|
|
44
|
+
},
|
|
45
|
+
"description": "The complete current Image Panels document. Existing images, versions, narration, canvas elements, and custom fields are retained.",
|
|
46
|
+
"semantic": "image_panel_document"
|
|
47
|
+
},
|
|
48
|
+
"transcript": {
|
|
49
|
+
"type": "transcript",
|
|
50
|
+
"context": "transcript",
|
|
51
|
+
"required": false,
|
|
52
|
+
"default": {
|
|
53
|
+
"schemaVersion": 1,
|
|
54
|
+
"text": "",
|
|
55
|
+
"words": []
|
|
56
|
+
},
|
|
57
|
+
"description": "Current narration words and timings used to build panels when the project has no panel document.",
|
|
58
|
+
"semantic": "timed_transcript"
|
|
59
|
+
},
|
|
60
|
+
"script": {
|
|
61
|
+
"type": "script",
|
|
62
|
+
"context": "script",
|
|
63
|
+
"required": false,
|
|
64
|
+
"default": {
|
|
65
|
+
"schemaVersion": 1,
|
|
66
|
+
"text": ""
|
|
67
|
+
},
|
|
68
|
+
"description": "Current narration text used when word timings are unavailable.",
|
|
69
|
+
"semantic": "narration_script"
|
|
70
|
+
},
|
|
71
|
+
"narrationScript": {
|
|
72
|
+
"type": "script",
|
|
73
|
+
"required": false,
|
|
74
|
+
"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.",
|
|
75
|
+
"semantic": "narration_script"
|
|
76
|
+
},
|
|
77
|
+
"narrationTiming": {
|
|
78
|
+
"type": "transcript",
|
|
79
|
+
"required": false,
|
|
80
|
+
"description": "Timed narration words from an earlier Step. When connected and filled, its word timings shape the panels instead of the project's saved voiceover timing.",
|
|
81
|
+
"semantic": "timed_transcript"
|
|
82
|
+
},
|
|
83
|
+
"blueprint": {
|
|
84
|
+
"type": "bible",
|
|
85
|
+
"context": "blueprint",
|
|
86
|
+
"required": false,
|
|
87
|
+
"default": {
|
|
88
|
+
"schemaVersion": 1
|
|
89
|
+
},
|
|
90
|
+
"description": "Current cast, locations, and visual style used to prepare panel generation prompts.",
|
|
91
|
+
"semantic": "production_blueprint"
|
|
92
|
+
},
|
|
93
|
+
"updatedPanels": {
|
|
94
|
+
"type": "panel-document",
|
|
95
|
+
"required": false,
|
|
96
|
+
"default": {
|
|
97
|
+
"schemaVersion": 1,
|
|
98
|
+
"scenes": [],
|
|
99
|
+
"strip": []
|
|
100
|
+
},
|
|
101
|
+
"description": "The complete edited Image Panels document prepared in this workspace.",
|
|
102
|
+
"semantic": "image_panel_document"
|
|
103
|
+
},
|
|
104
|
+
"commit": {
|
|
105
|
+
"type": "boolean",
|
|
106
|
+
"default": false,
|
|
107
|
+
"description": "Prepare the edited Image Panels document for StillMade review and Apply.",
|
|
108
|
+
"semantic": "apply_changes",
|
|
109
|
+
"required": false
|
|
110
|
+
},
|
|
111
|
+
"generatedImage": {
|
|
112
|
+
"type": "image",
|
|
113
|
+
"imageMode": "reference",
|
|
114
|
+
"required": false,
|
|
115
|
+
"description": "An exact stored image version produced by an approved generation Block or selected from project media.",
|
|
116
|
+
"semantic": "image"
|
|
117
|
+
},
|
|
118
|
+
"targetPanelId": {
|
|
119
|
+
"type": "text",
|
|
120
|
+
"required": false,
|
|
121
|
+
"default": "",
|
|
122
|
+
"description": "Panel that receives the connected image when attachment is enabled.",
|
|
123
|
+
"semantic": "panel_id"
|
|
124
|
+
},
|
|
125
|
+
"attachGeneratedImage": {
|
|
126
|
+
"type": "boolean",
|
|
127
|
+
"default": false,
|
|
128
|
+
"description": "Attach the connected image to the target panel while preserving its prior versions.",
|
|
129
|
+
"semantic": "boolean",
|
|
130
|
+
"required": false
|
|
131
|
+
},
|
|
132
|
+
"action": {
|
|
133
|
+
"type": "text",
|
|
134
|
+
"required": false,
|
|
135
|
+
"default": "none",
|
|
136
|
+
"description": "The Block-owned interface selects a declared host action.",
|
|
137
|
+
"semantic": "host_action"
|
|
138
|
+
},
|
|
139
|
+
"stockQuery": {
|
|
140
|
+
"type": "text",
|
|
141
|
+
"required": false,
|
|
142
|
+
"default": "",
|
|
143
|
+
"description": "Licensed stock search query.",
|
|
144
|
+
"semantic": "stock_query"
|
|
145
|
+
},
|
|
146
|
+
"generatedImages": {
|
|
147
|
+
"type": "image[]",
|
|
148
|
+
"imageMode": "reference",
|
|
149
|
+
"required": false,
|
|
150
|
+
"default": [],
|
|
151
|
+
"description": "Exact generated image versions returned by one approved server-budgeted panel batch.",
|
|
152
|
+
"semantic": "image_list"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"outputs": {
|
|
156
|
+
"panels": {
|
|
157
|
+
"type": "panel-document",
|
|
158
|
+
"primary": true,
|
|
159
|
+
"role": "image_panel_document",
|
|
160
|
+
"description": "The complete edited Image Panels document for the next Step.",
|
|
161
|
+
"semantic": "image_panel_document"
|
|
162
|
+
},
|
|
163
|
+
"edit": {
|
|
164
|
+
"type": "workspace-edit",
|
|
165
|
+
"description": "An exact before/after Image Panels change reviewed before it updates the project.",
|
|
166
|
+
"semantic": "workspace_edit"
|
|
167
|
+
},
|
|
168
|
+
"stockAction": {
|
|
169
|
+
"type": "approval",
|
|
170
|
+
"required": false,
|
|
171
|
+
"role": "portable_media_action",
|
|
172
|
+
"description": "Licensed stock search with acquisition receipt.",
|
|
173
|
+
"semantic": "portable_media_action"
|
|
174
|
+
},
|
|
175
|
+
"qualityAction": {
|
|
176
|
+
"type": "approval",
|
|
177
|
+
"required": false,
|
|
178
|
+
"role": "portable_media_action",
|
|
179
|
+
"description": "Exact-version multi-image quality review.",
|
|
180
|
+
"semantic": "portable_media_action"
|
|
181
|
+
},
|
|
182
|
+
"renderAction": {
|
|
183
|
+
"type": "approval",
|
|
184
|
+
"required": false,
|
|
185
|
+
"role": "portable_media_action",
|
|
186
|
+
"description": "Final video render plan.",
|
|
187
|
+
"semantic": "portable_media_action"
|
|
188
|
+
},
|
|
189
|
+
"stockAsset": {
|
|
190
|
+
"type": "asset",
|
|
191
|
+
"required": false,
|
|
192
|
+
"description": "Selected licensed stock asset with retained acquisition receipt.",
|
|
193
|
+
"semantic": "licensed_asset"
|
|
194
|
+
},
|
|
195
|
+
"stockImage": {
|
|
196
|
+
"type": "image",
|
|
197
|
+
"required": false,
|
|
198
|
+
"description": "Selected licensed stock image with its exact saved version and acquisition receipt, ready to connect to an Image Panels input.",
|
|
199
|
+
"semantic": "licensed_stock_image"
|
|
200
|
+
},
|
|
201
|
+
"qualityReport": {
|
|
202
|
+
"type": "metadata",
|
|
203
|
+
"required": false,
|
|
204
|
+
"description": "Settled exact-version quality report.",
|
|
205
|
+
"semantic": "quality_report"
|
|
206
|
+
},
|
|
207
|
+
"generationPlan": {
|
|
208
|
+
"type": "metadata",
|
|
209
|
+
"required": false,
|
|
210
|
+
"description": "A non-billable batch-ready prompt and progress plan for approved downstream generation Blocks.",
|
|
211
|
+
"semantic": "generation_plan"
|
|
212
|
+
},
|
|
213
|
+
"generateAction": {
|
|
214
|
+
"type": "approval",
|
|
215
|
+
"required": false,
|
|
216
|
+
"role": "portable_media_action",
|
|
217
|
+
"description": "A reviewed single-panel image generation request using StillMade's trusted image capability.",
|
|
218
|
+
"semantic": "portable_media_action"
|
|
219
|
+
},
|
|
220
|
+
"generatedImage": {
|
|
221
|
+
"type": "image",
|
|
222
|
+
"required": false,
|
|
223
|
+
"description": "The exact saved image returned by the reviewed generation service and available to attach to a panel.",
|
|
224
|
+
"semantic": "generated_image"
|
|
225
|
+
},
|
|
226
|
+
"batchGenerateAction": {
|
|
227
|
+
"type": "approval",
|
|
228
|
+
"required": false,
|
|
229
|
+
"role": "portable_media_action",
|
|
230
|
+
"description": "One reviewed missing-panel batch with a server-owned aggregate maximum, progress, replay protection, and evidence settlement.",
|
|
231
|
+
"semantic": "portable_media_action"
|
|
232
|
+
},
|
|
233
|
+
"generatedImages": {
|
|
234
|
+
"type": "image[]",
|
|
235
|
+
"required": false,
|
|
236
|
+
"description": "Completed exact panel image versions from the aggregate batch, retained even when another panel fails.",
|
|
237
|
+
"semantic": "generated_image_list"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"permissions": {
|
|
241
|
+
"project": [
|
|
242
|
+
"context.panels.read",
|
|
243
|
+
"context.transcript.read",
|
|
244
|
+
"context.script.read",
|
|
245
|
+
"context.blueprint.read",
|
|
246
|
+
"workspace.panels.propose"
|
|
247
|
+
],
|
|
248
|
+
"network": [],
|
|
249
|
+
"filesystem": [],
|
|
250
|
+
"secrets": [],
|
|
251
|
+
"actions": [
|
|
252
|
+
"stock.search",
|
|
253
|
+
"quality.analyze",
|
|
254
|
+
"final.render",
|
|
255
|
+
"image.generate",
|
|
256
|
+
"image.generate.batch"
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
"ui": [],
|
|
260
|
+
"platforms": {
|
|
261
|
+
"phone": {
|
|
262
|
+
"supported": true
|
|
263
|
+
},
|
|
264
|
+
"browser": {
|
|
265
|
+
"supported": true
|
|
266
|
+
},
|
|
267
|
+
"desktop": {
|
|
268
|
+
"supported": true
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
"code": "const copy = value => JSON.parse(JSON.stringify(value));\nconst source = copy(input.panels || {schemaVersion: 1, scenes: [], strip: []});\nconst blueprint=copy(input.blueprint||{schemaVersion:1});\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 narration=String(transcript?.text||script?.text||(typeof script==='string'?script:'')).trim();\nconst timed=Array.isArray(transcript?.words)?transcript.words.map(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})).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start):[];\nconst draftFromNarration=()=>{const groups=[];let group=[];timed.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);if(!groups.length){let cursor=0;(narration.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean).forEach(value=>{const duration=Math.max(2,value.split(/\\s+/).length/2.5);groups.push([{text:value,start:cursor,end:cursor+duration}]);cursor+=duration;});}return {schemaVersion:1,scenes:groups.length?[{sceneId:'scene-1',title:'Narration',description:'Panels built from the current narration.'}]:[],strip:groups.map((words,index)=>{const start=words[0].start,end=words.at(-1).end,text=words.map(word=>word.text).join(' ');return {panelId:'panel-'+String(index+1)+'-'+String(Math.max(0,Math.round(start*1000))),sceneId:'scene-1',type:'panel',changePrompt:'Create a clear image for: '+text,narration:text,startMs:Math.round(start*1000),durationMs:Math.max(1,Math.round((end-start)*1000)),image:null,versions:[],provenance:'narration'}})}};\nconst fallback=!source.strip?.length?draftFromNarration():source;\nconst candidate = input.commit || ['prepare','generate','generate-batch','stock','quality','render'].includes(input.action) ? copy(input.updatedPanels) : copy(fallback);\nif (input.attachGeneratedImage) {\n if (!input.generatedImage || input.generatedImage.kind !== 'image') throw new Error('Connect an approved generated image before attaching it.');\n const target = candidate.strip.find(panel => panel.panelId === input.targetPanelId);\n if (!target) throw new Error('Choose an existing target panel for the connected image.');\n const prior = Array.isArray(target.versions) ? target.versions : target.image ? [target.image] : [];\n const url = input.generatedImage.url;\n target.image = url;\n target.imageAsset = copy(input.generatedImage);\n target.versions = [...prior.filter(version => version !== url), url].slice(-8);\n}\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || !Array.isArray(candidate.strip)) {\n throw new Error('Keep the complete version 1 Image Panels document and its strip.');\n}\nif (candidate.strip.length > 4096 || !candidate.strip.every(panel => panel && typeof panel === 'object' && !Array.isArray(panel) && typeof panel.panelId === 'string' && panel.panelId.length > 0)) {\n throw new Error('Image Panels supports up to 4,096 rows with retained panel IDs.');\n}\nconst ids = candidate.strip.map(panel => panel.panelId);\nif (new Set(ids).size !== ids.length) throw new Error('Keep every Image Panel ID unique.');\nif (candidate.scenes !== undefined && (!Array.isArray(candidate.scenes) || candidate.scenes.length > 2048 || !candidate.scenes.every(scene => scene && typeof scene === 'object' && !Array.isArray(scene)))) {\n throw new Error('Image Panels needs a valid retained scene list.');\n}\nif (!candidate.strip.every(panel => !panel.elements || Array.isArray(panel.elements) && panel.elements.length <= 5000 && panel.elements.every(element => element && typeof element === 'object' && !Array.isArray(element)))) {\n throw new Error('Canvas panels need valid element lists with up to 5,000 elements.');\n}\nconst itemEnd=item=>Math.max(0,Number(item.start)||0)+Math.max(.001,Number(item.duration)||Number(item.durationMs)/1000||.001);\nconst outputs={panels:candidate,edit:{schemaVersion:1,title:`Update Image Panels (${candidate.scenes.length} scenes, ${candidate.strip.length} panels)`,field:'panels',before:source,after:candidate}};\nconst generationItem=(panel,index)=>{const style=String(candidate.generationSettings?.stylePrompt||blueprint.visualStyle||blueprint.style?.description||'').trim(),cast=Array.isArray(panel.cast)?panel.cast.map(String).filter(Boolean).slice(0,20):[],prompt=[String(panel.changePrompt||panel.prompt||panel.narration||'Panel '+String(index+1)).trim(),style&&'Style: '+style,cast.length&&'Cast: '+cast.join(', ')].filter(Boolean).join('. '),exact=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null);return {panelId:panel.panelId,prompt,status:exact&&exact.assetId&&exact.versionId?'complete':'ready',...(exact&&exact.assetId&&exact.versionId?{image:{kind:'image',assetId:exact.assetId,versionId:exact.versionId,url:exact.url}}:{})}};\nif(input.action==='prepare'){const items=candidate.strip.map(generationItem),stylePrompt=String(candidate.generationSettings?.stylePrompt||blueprint.visualStyle||blueprint.style?.description||'').trim();outputs.generationPlan={schemaVersion:1,kind:'panel-generation-plan',stylePrompt,items,progress:{complete:items.filter(item=>item.status==='complete').length,total:items.length}};}\nif(input.action==='generate'){const panel=candidate.strip.find(item=>item.panelId===input.targetPanelId);if(!panel)throw new Error('Choose the current panel before generating.');const style=String(candidate.generationSettings?.stylePrompt||blueprint.visualStyle||blueprint.style?.description||'').trim(),cast=Array.isArray(panel.cast)?panel.cast.map(String).filter(Boolean).slice(0,20):[],prompt=[String(panel.changePrompt||panel.prompt||panel.narration||'Create this panel').trim(),style&&'Style: '+style,cast.length&&'Cast: '+cast.join(', ')].filter(Boolean).join('. ');outputs.generateAction={schemaVersion:1,kind:'stillmade.media-action',operation:'image.generate',request:{prompt},resultPort:'generatedImage'};}\nif(input.action==='generate-batch'){const items=candidate.strip.map(generationItem).filter(item=>item.status!=='complete').slice(0,100);if(!items.length)throw new Error('Every panel already has an exact image.');outputs.batchGenerateAction={schemaVersion:1,kind:'stillmade.media-action',operation:'image.generate.batch',request:{source:{id:'sm.panel-strip',version:'2.4.0'},items:items.map(({panelId,prompt})=>({panelId,prompt})),aspectRatio:String(candidate.aspectRatio||candidate.meta?.aspect||'16:9')},resultPort:'generatedImages'};}\nconst images=candidate.strip.map(panel=>panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null)).filter(image=>image&&image.kind==='image'&&image.assetId&&image.versionId&&image.url).slice(0,16);\nif(input.action==='stock'&&input.stockQuery.trim())outputs.stockAction={schemaVersion:1,kind:'stillmade.media-action',operation:'stock.search',request:{query:input.stockQuery.trim(),type:'photo'},resultPort:'stockImage'};\nif(input.action==='quality'&&images.length)outputs.qualityAction={schemaVersion:1,kind:'stillmade.media-action',operation:'quality.analyze',request:{assets:images.map(({assetId,versionId,url})=>({kind:'image',assetId,versionId,url}))},resultPort:'qualityReport'};\nif(input.action==='render'){const clips=candidate.strip.map((panel,index)=>({id:panel.panelId||'panel-'+index,start:(Number(panel.startMs)||0)/1000,duration:Math.max(.001,(Number(panel.durationMs)||1000)/1000),url:panel.image?.url||panel.imageAsset?.url||panel.asset?.url||panel.selectedImage?.url||typeof panel.image==='string'&&panel.image||''})),targetDuration=Math.max(.001,...clips.map(itemEnd));outputs.renderAction={schemaVersion:1,kind:'stillmade.media-action',operation:'final.render',request:{schemaVersion:1,kind:'video',timeline:{schemaVersion:1,activeTimelineId:'panels',clips,audio:[],overlays:[],targetDuration},settings:{fps:30,resolution:1080,quality:'high'},source:{id:'sm.panel-strip',version:'2.4.0'}},resultPort:null};}\nreturn outputs;\n",
|
|
273
|
+
"view": {
|
|
274
|
+
"html": "<main class=\"panels-workspace\">\n <header><div><small>Production workspace</small><h1>Image Panels</h1><p id=\"summary\">Loading panels…</p></div><div class=\"actions\"><button id=\"build\" type=\"button\" class=\"secondary\">Build from narration</button><button id=\"reset\" type=\"button\" class=\"secondary\">Reset shared draft</button><button id=\"addScene\" type=\"button\" class=\"secondary\">Add scene</button><button id=\"addPanel\" type=\"button\" class=\"secondary\">Add panel</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 <div id=\"recovery\" hidden><p id=\"recoveryMessage\" role=\"alert\"></p><div class=\"actions\"><button id=\"retryShared\" type=\"button\" class=\"secondary\">Retry sharing</button><button id=\"discardShared\" type=\"button\" class=\"secondary\">Discard my unsent edits</button><button id=\"resetSharedSource\" type=\"button\" class=\"secondary\">Review source reset</button><button id=\"confirmSourceReset\" type=\"button\" class=\"danger\" hidden>Confirm: replace the shared draft for everyone</button></div><p>Resetting the source discards shared draft edits for everyone and uses the latest project input. Saved project content is unchanged until reviewed and applied.</p></div>\n <output id=\"sharedResult\" role=\"status\" aria-live=\"polite\"></output>\n <section><div class=\"section-title\"><h2>Generation plan</h2><strong id=\"progress\">0 of 0 panels have images</strong></div><label>Visual style<textarea id=\"stylePrompt\" placeholder=\"Describe the consistent visual style\"></textarea></label><p id=\"blueprintHints\" class=\"hint\"></p><div class=\"actions\"><button id=\"prepareBatch\" type=\"button\" class=\"secondary\">Prepare all prompts</button><button id=\"generateBatch\" type=\"button\">Review and generate missing panels</button></div><div id=\"queue\" class=\"cards\"></div></section>\n <section><div class=\"section-title\"><h2>Connected generated image</h2></div><img id=\"imagePreview\" alt=\"Selected panel image preview\" hidden><div id=\"handoff\"></div></section>\n <section><div class=\"section-title\"><h2>Scenes</h2></div><div id=\"scenes\" class=\"cards\"></div></section>\n <section><div class=\"section-title\"><h2>Panels</h2></div><div id=\"panels\" class=\"cards\"></div></section>\n <details id=\"rawDetails\"><summary>Complete Image Panels data</summary><p>Every field, media reference, version, canvas element, and audio setting is retained. Edit this JSON for custom fields not shown on the cards.</p><textarea id=\"raw\" class=\"raw\" spellcheck=\"false\" aria-label=\"Complete Image Panels data\"></textarea><p id=\"rawNotice\">JSON typing is shared live; Apply updates the panel document.</p><button id=\"discardRaw\" type=\"button\" class=\"secondary\" disabled>Discard shared JSON draft</button><button id=\"applyRaw\" type=\"button\" class=\"secondary\">Apply JSON to workspace</button></details>\n<section><h2>Finish panels</h2><label>Stock search<input id=\"stockQuery\" type=\"text\" placeholder=\"sunset city skyline\"></label><div class=\"actions\"><button id=\"stockSearch\" type=\"button\" class=\"secondary\">Search licensed stock</button><button id=\"qualityReview\" type=\"button\" class=\"secondary\">Review image quality</button><button id=\"renderFinal\" type=\"button\">Render final video</button></div></section></main>\n",
|
|
275
|
+
"css": ".panels-workspace{max-width:1120px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.section-title,.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}.cards{display:grid;gap:12px;margin-top:12px}.card{padding:14px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg)}.card-head{justify-content:space-between}.card h3{margin:0;font-size:17px}.grid{display:grid;grid-template-columns:repeat(4,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:76px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:380px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}\n@media(max-width:820px){.grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:560px){.panels-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}section,details{padding:12px}}\nimg{display:block;width:min(100%,640px);max-height:420px;object-fit:contain;margin:10px auto;border-radius:var(--r-3);background:var(--bg)}img[hidden]{display:none}\n",
|
|
276
|
+
"javascript": "const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),build=document.getElementById('build'),imagePreview=document.getElementById('imagePreview'),progress=document.getElementById('progress'),stylePrompt=document.getElementById('stylePrompt'),blueprintHints=document.getElementById('blueprintHints');\nlet source={schemaVersion:1,scenes:[],strip:[]},draft={schemaVersion:1,scenes:[],strip:[]},connectedImage=null,generatedImages=[],transcript={schemaVersion:1,text:'',words:[]},script={schemaVersion:1,text:''},narrationScript=null,narrationTiming=null,busy=false,revision=0,blueprint={schemaVersion:1};\nlet shared=null,scratchShared=null,scratch={text:null,base:null,stockQuery:''},scratchAccess={canEdit:false,error:null,pending:false},access={canEdit:false,error:null,sourceConflict:false,pending:false},rawDirty=false,rawBase=null,rawStale=false,sharedOutputs={},resultSignature='',sourceResetArmed=false,rawPreview='';\nconst blocked=()=>busy||!shared||!scratchShared||!access.canEdit||!scratchAccess.canEdit||!!access.error||!!scratchAccess.error;\nconst uniqueId=prefix=>prefix+'-'+Date.now().toString(36)+'-'+Math.random().toString(36).slice(2,12);\nconst clone=value=>JSON.parse(JSON.stringify(value));\nconst text=value=>value===undefined||value===null?'':String(value);\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 heardText=()=>{const {transcript,script}=heard();return text(transcript.text||script.text||(typeof script==='string'?script:'')).trim();};\nconst plan=()=>{const narration=heardText(),parts=(narration.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let start=0;return {schemaVersion:1,scenes:parts.length?[{sceneId:'scene-1',title:'Narration',description:'Panels built from the current narration.'}]:[],strip:parts.map((line,index)=>{const duration=Math.max(2000,Math.round(line.split(/\\s+/).length/2.5*1000)),panel={panelId:'panel-'+String(index+1)+'-'+String(start),sceneId:'scene-1',type:'panel',changePrompt:'Create a clear image for: '+line,narration:line,startMs:start,durationMs:duration,image:null,versions:[],provenance:'narration'};start+=duration;return panel})}};\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},type==='textarea'?{tag:'textarea',action,value:text(value),disabled:blocked(),label}:{tag:'input',type,action,value:Number.isFinite(value)?value:text(value),disabled:blocked(),label}]});\nconst choice=(label,action,value,options)=>({tag:'label',children:[{tag:'span',text:label},{tag:'select',action,value:text(value),disabled:blocked(),label,children:options.map(option=>({tag:'option',text:option,value:option}))}]});\nconst sceneCard=(scene,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(scene.title)||text(scene.name)||'Scene '+String(index+1)},{tag:'button',action:'remove-scene:'+String(index),text:'Remove',className:'danger',disabled:blocked()}]},{tag:'div',className:'grid',children:[field('Scene ID','scene-id:'+String(index),scene.sceneId||scene.id),field('Title','scene-title:'+String(index),scene.title||scene.name),field('Description','scene-description:'+String(index),scene.description||scene.summary,'textarea',true)]}]});\nconst panelCard=(panel,index)=>{const preview=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null),versions=Array.isArray(panel.imageVersions)?panel.imageVersions.filter(value=>value&&value.kind==='image'&&value.assetId&&value.versionId):[];return {tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:'Panel '+String(index+1)+' · '+text(panel.panelId)},{tag:'div',className:'row',children:[{tag:'button',action:'generate-panel:'+String(index),text:'Generate',className:'secondary',disabled:blocked()},{tag:'button',action:'preview-panel:'+String(index),text:'Preview',className:'secondary',disabled:busy||!preview},{tag:'button',action:'duplicate-panel:'+String(index),text:'Duplicate',className:'secondary',disabled:blocked()},{tag:'button',action:'move-up:'+String(index),text:'Up',className:'secondary',disabled:blocked()||index===0},{tag:'button',action:'move-down:'+String(index),text:'Down',className:'secondary',disabled:blocked()||index===draft.strip.length-1},{tag:'button',action:'remove-panel:'+String(index),text:'Remove',className:'danger',disabled:blocked()}]}]},{tag:'div',className:'grid',children:[field('Panel ID','panel-id:'+String(index),panel.panelId),field('Scene ID','panel-scene:'+String(index),panel.sceneId),choice('Type','panel-type:'+String(index),panel.type||'panel',['panel','canvas','zoom']),field('Starts (ms)','panel-start:'+String(index),panel.startMs,'number'),field('Length (ms)','panel-duration:'+String(index),panel.durationMs,'number'),field('Source panel','panel-source:'+String(index),panel.sourcePanelId||panel.repeatOf),field('Cast (comma separated)','panel-cast:'+String(index),Array.isArray(panel.cast)?panel.cast.join(', '):panel.cast,'text',true),field('Change prompt','panel-prompt:'+String(index),panel.changePrompt,'textarea',true),field('Narration','panel-narration:'+String(index),panel.narration||panel.voiceoverText,'textarea',true),{tag:'p',className:'wide hint',text:(preview?'Exact current image retained. ':'')+String(versions.length)+' exact image version'+(versions.length===1?'':'s')+' available.'},{tag:'div',className:'wide row',children:versions.map((version,versionIndex)=>({tag:'button',action:'restore-image:'+String(index)+':'+String(versionIndex),text:'Use v'+String(versionIndex+1)+' · '+text(version.versionId),className:'secondary',disabled:blocked()||preview&&preview.versionId===version.versionId}))}]}]}};\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft={schemaVersion:1,scenes:[],strip:[]};if(!Array.isArray(draft.scenes))draft.scenes=[];if(!Array.isArray(draft.strip))draft.strip=[]};\nconst retime=()=>{let start=0;draft.strip=draft.strip.map(panel=>{const next={...panel,startMs:start};start+=Math.max(0,Number(panel.durationMs)||0);return next})};\nconst rawIsOpen=()=>document.getElementById('rawDetails').getAttribute('open')!==null;\nconst renderRawPreview=()=>{if(!rawIsOpen())return;if(rawDirty){rawStale=JSON.stringify(scratch.base)!==JSON.stringify(draft);if(raw.value!==scratch.text)raw.value=scratch.text;drawRecovery();return;}const value=JSON.stringify(draft,null,2);rawPreview=value;if(raw.value!==value)raw.value=value;};\nconst scheduleRawPreview=()=>{if(rawIsOpen())StillMade.scheduleSharedEdit('panelsRawPreview',renderRawPreview);};\ndocument.getElementById('rawDetails').addEventListener('toggle',renderRawPreview);\nconst queueCard=item=>({tag:'article',className:'card',children:[{tag:'strong',text:text(item.panelId)+' · '+text(item.status)},{tag:'p',text:text(item.generationText)}]});const draw=()=>{ensure();StillMade.render('handoff',connectedImage?[{tag:'p',className:'hint',text:'Ready: '+text(connectedImage.assetId)+' · version '+text(connectedImage.versionId)},{tag:'div',className:'row',children:[{tag:'button',action:'preview-connected',text:'Preview image',className:'secondary',disabled:busy},...draft.strip.map((panel,index)=>({tag:'button',action:'attach-image:'+String(index),text:'Use in panel '+String(index+1),className:'secondary',disabled:blocked()}))]}]:[{tag:'p',className:'hint',text:'Connect Generate image or the licensed stock result to attach an approved stored result. Provider credentials and charging stay outside this Block.'}]);const queue=Array.isArray(draft.generationQueue)?draft.generationQueue:[];StillMade.render('queue',queue.length?queue.map(queueCard):[{tag:'p',text:'Prepare prompts to create a saved generation queue.'}]);StillMade.render('scenes',draft.scenes.length?draft.scenes.map(sceneCard):[{tag:'p',text:'No scene groups yet.'}]);StillMade.render('panels',draft.strip.length?draft.strip.map(panelCard):[{tag:'p',text:'No panels yet. Add one to begin.'}]);const complete=draft.strip.filter(panel=>{const image=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null);return image&&image.assetId&&image.versionId}).length;progress.textContent=String(complete)+' of '+String(draft.strip.length)+' panels have exact images';stylePrompt.value=text(draft.generationSettings&&draft.generationSettings.stylePrompt);scheduleRawPreview();summary.textContent=String(draft.strip.length)+' panel'+(draft.strip.length===1?'':'s')+' across '+String(draft.scenes.length)+' scene'+(draft.scenes.length===1?'':'s');save.disabled=blocked()||rawDirty;build.disabled=blocked()||!heardText();document.getElementById('reset').disabled=blocked();document.getElementById('addScene').disabled=blocked();document.getElementById('addPanel').disabled=blocked();document.getElementById('prepareBatch').disabled=blocked()||!draft.strip.length;document.getElementById('generateBatch').disabled=blocked()||!draft.strip.some(panel=>!(panel.imageAsset&&panel.imageAsset.assetId&&panel.imageAsset.versionId));['applyRaw','stockSearch','qualityReview','renderFinal'].forEach(id=>{document.getElementById(id).disabled=blocked();});stylePrompt.disabled=blocked();raw.disabled=blocked();document.getElementById('stockQuery').disabled=blocked();drawRecovery();drawResults()};\nconst edited=()=>{revision+=1;if(rawDirty)rawStale=true;scheduleRawPreview();shared.changed();status.textContent='Sharing draft changes. Review changes applies the document to your project.'};\nconst drawRecovery=()=>{document.getElementById('recovery').hidden=!access.error&&!scratchAccess.error;document.getElementById('recoveryMessage').textContent=access.error||scratchAccess.error||'';document.getElementById('retryShared').disabled=!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending||access.sourceConflict;document.getElementById('discardShared').disabled=!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending||access.sourceConflict;document.getElementById('resetSharedSource').hidden=!access.sourceConflict;document.getElementById('resetSharedSource').disabled=!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending;document.getElementById('confirmSourceReset').hidden=!sourceResetArmed||!access.sourceConflict;document.getElementById('confirmSourceReset').disabled=!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending;document.getElementById('rawNotice').textContent=rawDirty?(rawStale?'The shared JSON draft is retained. The panel document changed; Apply checks for conflicting edits.':'This JSON draft is shared live. Apply it to the panel document when ready, or discard the shared scratch.'):'JSON typing is shared live; Apply updates the panel document.';document.getElementById('discardRaw').disabled=blocked()||!rawDirty;save.disabled=blocked()||rawDirty;};\nconst drawResults=()=>{const images=Array.isArray(sharedOutputs.generatedImages)?sharedOutputs.generatedImages:[];document.getElementById('sharedResult').textContent=images.length?String(images.length)+' generated images are available in the shared result below.':sharedOutputs.generatedImage?'A generated image is available in the shared result below.':sharedOutputs.panels?'The latest reviewed Image Panels result is available below.':'';};\nraw.addEventListener('input',()=>{if(blocked())return;if(!rawDirty)scratch.base=rawPreview?JSON.parse(rawPreview):clone(draft);scratch.text=raw.value;rawBase=scratch.base;rawDirty=true;scratchShared.changed();drawRecovery();});\ndocument.getElementById('discardRaw').addEventListener('click',()=>{if(blocked())return;scratch={...scratch,text:null,base:null};rawDirty=false;rawBase=null;rawStale=false;scratchShared.changed();renderRawPreview();drawRecovery();});\ndocument.getElementById('stockQuery').addEventListener('input',()=>{if(blocked())return;scratch.stockQuery=document.getElementById('stockQuery').value;scratchShared.changed();});\nconst recover=async(action)=>{if(busy||!shared||!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending)return;busy=true;draw();try{await action();sourceResetArmed=false;status.textContent='Shared draft recovered.';}catch(error){status.textContent=error.message;}finally{busy=false;draw();}};\ndocument.getElementById('retryShared').addEventListener('click',()=>recover(async()=>{await shared.retry();await scratchShared.retry();}));\ndocument.getElementById('discardShared').addEventListener('click',()=>recover(async()=>{await shared.discard();await scratchShared.discard();}));\ndocument.getElementById('resetSharedSource').addEventListener('click',()=>{sourceResetArmed=true;drawRecovery();});\ndocument.getElementById('confirmSourceReset').addEventListener('click',()=>recover(()=>shared.resetSharedSource({discardSharedEdits:true})));\nStillMade.onShared(value=>{sharedOutputs=value.outputs||{};const signature=JSON.stringify(sharedOutputs);if(signature!==resultSignature){resultSignature=signature;drawResults();}});\n\nStillMade.onAction(event=>{if(busy||(!event.action.startsWith('preview-')&&blocked()))return;ensure();const parts=event.action.split(':'),kind=parts[0],index=Number(parts[1]),scene=draft.scenes.find((item,position)=>position===index),panel=draft.strip.find((item,position)=>position===index);\n if(kind==='remove-scene'){draft.scenes=draft.scenes.filter((item,position)=>position!==index);edited();draw();return}if(kind==='scene-id'&&scene){if(Object.hasOwn(scene,'sceneId'))scene.sceneId=event.value;else scene.id=event.value}if(kind==='scene-title'&&scene){if(Object.hasOwn(scene,'title'))scene.title=event.value;else scene.name=event.value}if(kind==='scene-description'&&scene){if(Object.hasOwn(scene,'description'))scene.description=event.value;else scene.summary=event.value}\n if(kind==='generate-panel'&&panel){mediaAction('generate',{targetPanelId:panel.panelId});return} if(kind==='restore-image'&&panel){const versionIndex=Number(parts[2]),versions=Array.isArray(panel.imageVersions)?panel.imageVersions:[],version=versions.find((item,position)=>position===versionIndex);if(version){panel.image=version.url;panel.imageAsset=clone(version);edited();draw();status.textContent='Exact image version restored for '+text(panel.panelId)+'.'}return}if(kind==='preview-connected'&&connectedImage){StillMade.previewImage(connectedImage).then(value=>{imagePreview.src=value.url;imagePreview.hidden=false;status.textContent='Previewing connected image version.'}).catch(error=>{status.textContent=error.message});return}if(kind==='preview-panel'&&panel){const value=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null);if(value)StillMade.previewImage(value).then(preview=>{imagePreview.src=preview.url;imagePreview.hidden=false;status.textContent='Previewing '+text(panel.panelId)+'.'}).catch(error=>{status.textContent=error.message});return}if(kind==='duplicate-panel'&&panel){const next=clone(panel);next.panelId=uniqueId('panel-copy');next.startMs=(Number(panel.startMs)||0)+(Number(panel.durationMs)||0);next.provenance='duplicate';draft.strip=[...draft.strip.slice(0,index+1),next,...draft.strip.slice(index+1)];retime();edited();draw();return}if(kind==='remove-panel'){draft.strip=draft.strip.filter((item,position)=>position!==index);retime();edited();draw();return}if(kind==='move-up'&&index>0){const target=draft.strip.find((item,position)=>position===index-1);draft.strip=draft.strip.map((item,position)=>position===index-1?panel:position===index?target:item);retime();edited();draw();return}if(kind==='move-down'&&index<draft.strip.length-1){const target=draft.strip.find((item,position)=>position===index+1);draft.strip=draft.strip.map((item,position)=>position===index+1?panel:position===index?target:item);retime();edited();draw();return}if(!panel){edited();return}\n if(kind==='attach-image'&&connectedImage){const priorVersions=Array.isArray(panel.versions)?panel.versions:panel.image?[panel.image]:[];panel.image=connectedImage.url;panel.imageAsset=clone(connectedImage);panel.imageVersions=[...(Array.isArray(panel.imageVersions)?panel.imageVersions:[]).filter(value=>value.versionId!==connectedImage.versionId),clone(connectedImage)].slice(-8);panel.versions=[...priorVersions.filter(value=>value!==connectedImage.url),connectedImage.url].slice(-8);edited();draw();status.textContent='Connected image attached with its exact asset and version identity.';return}\n if(kind==='panel-id'){if(!event.value||draft.strip.some(item=>item!==panel&&item.panelId===event.value)){status.textContent='Keep every panel ID nonempty and unique.';return;}panel.panelId=event.value;}if(kind==='panel-scene')panel.sceneId=event.value;if(kind==='panel-type')panel.type=event.value;if(kind==='panel-start')panel.startMs=Math.max(0,Number(event.value)||0);if(kind==='panel-duration')panel.durationMs=Math.max(1,Number(event.value)||1);if(kind==='panel-source'){if(panel.type==='zoom')panel.sourcePanelId=event.value;else panel.repeatOf=event.value}if(kind==='panel-cast')panel.cast=event.value.split(',').map(value=>value.trim()).filter(Boolean).slice(0,20);if(kind==='panel-prompt')panel.changePrompt=event.value;if(kind==='panel-narration'){if(Object.hasOwn(panel,'voiceoverText'))panel.voiceoverText=event.value;else panel.narration=event.value}edited()});\nbuild.addEventListener('click',()=>{if(!blocked()){draft=plan();edited();draw();status.textContent='Built a draft from the current narration. Review prompts and timing before applying.'}});\ndocument.getElementById('addScene').addEventListener('click',()=>{if(blocked())return;ensure();const id=uniqueId('portable-scene');draft.scenes=[...draft.scenes,{sceneId:id,title:'New scene',description:''}];edited();draw()});\ndocument.getElementById('addPanel').addEventListener('click',()=>{if(blocked())return;ensure();const start=draft.strip.reduce((total,panel)=>total+Math.max(0,Number(panel.durationMs)||0),0),id=uniqueId('portable-panel'),scene=draft.scenes.find((item,position)=>position===0);draft.strip=[...draft.strip,{panelId:id,sceneId:scene?scene.sceneId||scene.id:null,type:'panel',changePrompt:'',narration:'',startMs:start,durationMs:4000,image:null,versions:[],provenance:'user'}];edited();draw()});\ndocument.getElementById('applyRaw').addEventListener('click',async()=>{if(blocked()||!rawDirty)return;const requested=clone(scratch);busy=true;draw();try{await scratchShared.flush();if(JSON.stringify(scratch)!==JSON.stringify(requested))throw Error('The shared JSON draft changed. Review the latest text before applying it.');if(!access.canEdit||!scratchAccess.canEdit||access.error||scratchAccess.error)throw Error('Editing access changed. The shared JSON draft is retained.');const pending=clone(scratch),value=JSON.parse(pending.text);if(!value||Array.isArray(value)||value.schemaVersion!==1||!Array.isArray(value.strip))throw Error('Image Panels JSON must be a version 1 object with a strip.');if(value.strip.some(panel=>!panel||typeof panel.panelId!=='string'||!panel.panelId)||new Set(value.strip.map(panel=>panel.panelId)).size!==value.strip.length)throw Error('Keep every panel ID nonempty and unique.');const edits=StillMade.diffDocument(pending.base||draft,value);draft=StillMade.applyDocument(draft,edits);edited();await shared.flush();if(!access.canEdit||!scratchAccess.canEdit)throw Error('Editing access changed; the shared JSON draft is retained.');if(JSON.stringify(scratch)===JSON.stringify(pending)){scratch={...scratch,text:null,base:null};rawDirty=false;rawBase=null;rawStale=false;scratchShared.changed();await scratchShared.flush();}status.textContent='Complete Image Panels data applied to the shared draft.';}catch(error){status.textContent=error.message;}finally{busy=false;draw();}});\n\ndocument.getElementById('reset').addEventListener('click',()=>{if(!blocked()){draft=clone(source);edited();draw();status.textContent='Reset to the project Image Panels document is being shared.'}});\nsave.addEventListener('click',async()=>{if(blocked()||rawDirty)return;busy=true;draw();status.textContent='Checking the complete Image Panels document…';try{await shared.flush();await scratchShared.flush();if(!access.canEdit||!scratchAccess.canEdit||access.error||scratchAccess.error||rawDirty)throw Error('Editing access changed. The draft was not run.');const started=revision;await StillMade.run({panels:clone(source),updatedPanels:clone(draft),commit:true});status.textContent=started===revision?'Image Panels changes are ready below. Review the before and after, then choose Apply.':'A reviewed result is ready below; newer shared edits were retained.';}catch(error){status.textContent=error.message||'Image Panels could not be prepared.';}finally{busy=false;draw();}});\nStillMade.onInput(values=>{source=clone(values.panels||{schemaVersion:1,scenes:[],strip:[]});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);blueprint=clone(values.blueprint||{schemaVersion:1});let next=values.updatedPanels&&values.updatedPanels.strip?.length?clone(values.updatedPanels):source.strip?.length?clone(source):plan();connectedImage=values.generatedImage?clone(values.generatedImage):null;generatedImages=Array.isArray(values.generatedImages)?clone(values.generatedImages):[];if(generatedImages.length){const byPanel=new Map(generatedImages.map(image=>[image.panelId,image]));next.strip=next.strip.map(panel=>{const image=byPanel.get(panel.panelId);if(!image)return panel;const prior=Array.isArray(panel.imageVersions)?panel.imageVersions:[];return {...panel,image:image.url,imageAsset:clone(image),imageVersions:[...prior.filter(value=>value.versionId!==image.versionId),clone(image)].slice(-8),versions:[...(Array.isArray(panel.versions)?panel.versions:[]).filter(value=>value!==image.url),image.url].slice(-8)}})}if(!next.generationSettings)next.generationSettings={stylePrompt:text(blueprint.visualStyle)};const names=Array.isArray(blueprint.characters)?blueprint.characters.map(item=>text(item.name||item.title)).filter(Boolean):[];blueprintHints.textContent=names.length?'Blueprint cast: '+names.slice(0,12).join(', '):'Add cast names per panel; approved generation stays in connected generation Blocks.';if(!shared){shared=StillMade.connectDocument({key:'panelsDocument',source:next,collections:[{path:['strip'],key:'panelId',fallback:'atomic'}],read:()=>draft,replace:value=>{draft=value;revision+=1;if(rawDirty)rawStale=true;draw();}});scratchShared=StillMade.connectDocument({key:'panelsScratch',source:{text:null,base:null,stockQuery:''},read:()=>scratch,replace:value=>{scratch=value;rawDirty=scratch.text!==null;rawBase=scratch.base;rawStale=false;if(rawDirty&&rawIsOpen()&&raw.value!==scratch.text)raw.value=scratch.text;scheduleRawPreview();document.getElementById('stockQuery').value=scratch.stockQuery;drawRecovery();}});scratchShared.onStatus(value=>{const redraw=scratchAccess.canEdit!==value.canEdit||scratchAccess.error!==value.error;scratchAccess=value;if(redraw)draw();else drawRecovery();});shared.onStatus(value=>{const redraw=access.canEdit!==value.canEdit||access.error!==value.error;access=value;if(redraw)draw();else drawRecovery();});}else shared.replaceSource(next);revision+=1;draw();status.textContent=access.error||'Draft edits are shared live. Review changes applies them to the project; generated results stay in the shared results below.'});\n\nstylePrompt.addEventListener('input',()=>{if(blocked())return;if(!draft.generationSettings)draft.generationSettings={};draft.generationSettings.stylePrompt=stylePrompt.value;edited()});\ndocument.getElementById('prepareBatch').addEventListener('click',()=>{if(blocked())return;const visualLook=text(draft.generationSettings&&draft.generationSettings.stylePrompt).trim();draft.generationQueue=draft.strip.map((panel,index)=>{const cast=Array.isArray(panel.cast)?panel.cast:[],image=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null),generationText=[text(panel.changePrompt||panel.narration||'Panel '+String(index+1)).trim(),visualLook&&'Style: '+visualLook,cast.length&&'Cast: '+cast.join(', ')].filter(Boolean).join('. ');return {id:'queue-'+text(panel.panelId),panelId:panel.panelId,generationText,status:image&&image.assetId&&image.versionId?'complete':'ready'}});edited();draw();mediaAction('prepare')});\ndocument.getElementById('generateBatch').addEventListener('click',()=>mediaAction('generate-batch'));\nconst mediaAction=async(action,extra={})=>{if(blocked()||rawDirty)return;busy=true;draw();try{await shared.flush();await scratchShared.flush();if(!access.canEdit||!scratchAccess.canEdit||access.error||scratchAccess.error||rawDirty)throw Error('Editing access changed. The action was not run.');await StillMade.run({panels:clone(source),updatedPanels:clone(draft),commit:false,action,...extra});status.textContent='The approved action is ready below.'}catch(error){status.textContent=error.message||'The media action could not be prepared.'}finally{busy=false;draw()}};document.getElementById('stockSearch').addEventListener('click',()=>mediaAction('stock',{stockQuery:document.getElementById('stockQuery').value}));document.getElementById('qualityReview').addEventListener('click',()=>mediaAction('quality'));document.getElementById('renderFinal').addEventListener('click',()=>mediaAction('render'));\n"
|
|
277
|
+
},
|
|
278
|
+
"tests": [
|
|
279
|
+
{
|
|
280
|
+
"name": "Retain the complete current Image Panels document",
|
|
281
|
+
"input": {
|
|
282
|
+
"panels": {
|
|
283
|
+
"schemaVersion": 1,
|
|
284
|
+
"scenes": [
|
|
285
|
+
{
|
|
286
|
+
"sceneId": "scene-1",
|
|
287
|
+
"title": "Opening"
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
"strip": [
|
|
291
|
+
{
|
|
292
|
+
"panelId": "panel-1",
|
|
293
|
+
"sceneId": "scene-1",
|
|
294
|
+
"type": "panel",
|
|
295
|
+
"prompt": "Opening frame",
|
|
296
|
+
"narration": "Welcome",
|
|
297
|
+
"startMs": 0,
|
|
298
|
+
"durationMs": 4000,
|
|
299
|
+
"image": "https://media.example/panel.png",
|
|
300
|
+
"versions": [
|
|
301
|
+
"https://media.example/old.png",
|
|
302
|
+
"https://media.example/panel.png"
|
|
303
|
+
],
|
|
304
|
+
"custom": {
|
|
305
|
+
"keep": true
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
"audio": {
|
|
310
|
+
"voPath": "https://media.example/voice.mp3"
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"updatedPanels": {
|
|
314
|
+
"schemaVersion": 1,
|
|
315
|
+
"scenes": [],
|
|
316
|
+
"strip": []
|
|
317
|
+
},
|
|
318
|
+
"commit": false
|
|
319
|
+
},
|
|
320
|
+
"expected": {
|
|
321
|
+
"panels": {
|
|
322
|
+
"schemaVersion": 1,
|
|
323
|
+
"scenes": [
|
|
324
|
+
{
|
|
325
|
+
"sceneId": "scene-1",
|
|
326
|
+
"title": "Opening"
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
"strip": [
|
|
330
|
+
{
|
|
331
|
+
"panelId": "panel-1",
|
|
332
|
+
"sceneId": "scene-1",
|
|
333
|
+
"type": "panel",
|
|
334
|
+
"prompt": "Opening frame",
|
|
335
|
+
"narration": "Welcome",
|
|
336
|
+
"startMs": 0,
|
|
337
|
+
"durationMs": 4000,
|
|
338
|
+
"image": "https://media.example/panel.png",
|
|
339
|
+
"versions": [
|
|
340
|
+
"https://media.example/old.png",
|
|
341
|
+
"https://media.example/panel.png"
|
|
342
|
+
],
|
|
343
|
+
"custom": {
|
|
344
|
+
"keep": true
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
],
|
|
348
|
+
"audio": {
|
|
349
|
+
"voPath": "https://media.example/voice.mp3"
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
"edit": {
|
|
353
|
+
"schemaVersion": 1,
|
|
354
|
+
"title": "Update Image Panels (1 scenes, 1 panels)",
|
|
355
|
+
"field": "panels",
|
|
356
|
+
"before": {
|
|
357
|
+
"schemaVersion": 1,
|
|
358
|
+
"scenes": [
|
|
359
|
+
{
|
|
360
|
+
"sceneId": "scene-1",
|
|
361
|
+
"title": "Opening"
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
"strip": [
|
|
365
|
+
{
|
|
366
|
+
"panelId": "panel-1",
|
|
367
|
+
"sceneId": "scene-1",
|
|
368
|
+
"type": "panel",
|
|
369
|
+
"prompt": "Opening frame",
|
|
370
|
+
"narration": "Welcome",
|
|
371
|
+
"startMs": 0,
|
|
372
|
+
"durationMs": 4000,
|
|
373
|
+
"image": "https://media.example/panel.png",
|
|
374
|
+
"versions": [
|
|
375
|
+
"https://media.example/old.png",
|
|
376
|
+
"https://media.example/panel.png"
|
|
377
|
+
],
|
|
378
|
+
"custom": {
|
|
379
|
+
"keep": true
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"audio": {
|
|
384
|
+
"voPath": "https://media.example/voice.mp3"
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
"after": {
|
|
388
|
+
"schemaVersion": 1,
|
|
389
|
+
"scenes": [
|
|
390
|
+
{
|
|
391
|
+
"sceneId": "scene-1",
|
|
392
|
+
"title": "Opening"
|
|
393
|
+
}
|
|
394
|
+
],
|
|
395
|
+
"strip": [
|
|
396
|
+
{
|
|
397
|
+
"panelId": "panel-1",
|
|
398
|
+
"sceneId": "scene-1",
|
|
399
|
+
"type": "panel",
|
|
400
|
+
"prompt": "Opening frame",
|
|
401
|
+
"narration": "Welcome",
|
|
402
|
+
"startMs": 0,
|
|
403
|
+
"durationMs": 4000,
|
|
404
|
+
"image": "https://media.example/panel.png",
|
|
405
|
+
"versions": [
|
|
406
|
+
"https://media.example/old.png",
|
|
407
|
+
"https://media.example/panel.png"
|
|
408
|
+
],
|
|
409
|
+
"custom": {
|
|
410
|
+
"keep": true
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
],
|
|
414
|
+
"audio": {
|
|
415
|
+
"voPath": "https://media.example/voice.mp3"
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"name": "Prepare one exact complete Image Panels update",
|
|
423
|
+
"input": {
|
|
424
|
+
"panels": {
|
|
425
|
+
"schemaVersion": 1,
|
|
426
|
+
"scenes": [
|
|
427
|
+
{
|
|
428
|
+
"sceneId": "scene-1",
|
|
429
|
+
"title": "Opening"
|
|
430
|
+
}
|
|
431
|
+
],
|
|
432
|
+
"strip": [
|
|
433
|
+
{
|
|
434
|
+
"panelId": "panel-1",
|
|
435
|
+
"sceneId": "scene-1",
|
|
436
|
+
"type": "panel",
|
|
437
|
+
"prompt": "Opening frame",
|
|
438
|
+
"startMs": 0,
|
|
439
|
+
"durationMs": 4000,
|
|
440
|
+
"image": "https://media.example/panel.png",
|
|
441
|
+
"versions": [
|
|
442
|
+
"https://media.example/panel.png"
|
|
443
|
+
]
|
|
444
|
+
}
|
|
445
|
+
]
|
|
446
|
+
},
|
|
447
|
+
"updatedPanels": {
|
|
448
|
+
"schemaVersion": 1,
|
|
449
|
+
"scenes": [
|
|
450
|
+
{
|
|
451
|
+
"sceneId": "scene-1",
|
|
452
|
+
"title": "New opening"
|
|
453
|
+
}
|
|
454
|
+
],
|
|
455
|
+
"strip": [
|
|
456
|
+
{
|
|
457
|
+
"panelId": "panel-1",
|
|
458
|
+
"sceneId": "scene-1",
|
|
459
|
+
"type": "panel",
|
|
460
|
+
"prompt": "Closer opening frame",
|
|
461
|
+
"startMs": 0,
|
|
462
|
+
"durationMs": 4500,
|
|
463
|
+
"image": "https://media.example/panel.png",
|
|
464
|
+
"versions": [
|
|
465
|
+
"https://media.example/panel.png"
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
"commit": true
|
|
471
|
+
},
|
|
472
|
+
"expected": {
|
|
473
|
+
"panels": {
|
|
474
|
+
"schemaVersion": 1,
|
|
475
|
+
"scenes": [
|
|
476
|
+
{
|
|
477
|
+
"sceneId": "scene-1",
|
|
478
|
+
"title": "New opening"
|
|
479
|
+
}
|
|
480
|
+
],
|
|
481
|
+
"strip": [
|
|
482
|
+
{
|
|
483
|
+
"panelId": "panel-1",
|
|
484
|
+
"sceneId": "scene-1",
|
|
485
|
+
"type": "panel",
|
|
486
|
+
"prompt": "Closer opening frame",
|
|
487
|
+
"startMs": 0,
|
|
488
|
+
"durationMs": 4500,
|
|
489
|
+
"image": "https://media.example/panel.png",
|
|
490
|
+
"versions": [
|
|
491
|
+
"https://media.example/panel.png"
|
|
492
|
+
]
|
|
493
|
+
}
|
|
494
|
+
]
|
|
495
|
+
},
|
|
496
|
+
"edit": {
|
|
497
|
+
"schemaVersion": 1,
|
|
498
|
+
"title": "Update Image Panels (1 scenes, 1 panels)",
|
|
499
|
+
"field": "panels",
|
|
500
|
+
"before": {
|
|
501
|
+
"schemaVersion": 1,
|
|
502
|
+
"scenes": [
|
|
503
|
+
{
|
|
504
|
+
"sceneId": "scene-1",
|
|
505
|
+
"title": "Opening"
|
|
506
|
+
}
|
|
507
|
+
],
|
|
508
|
+
"strip": [
|
|
509
|
+
{
|
|
510
|
+
"panelId": "panel-1",
|
|
511
|
+
"sceneId": "scene-1",
|
|
512
|
+
"type": "panel",
|
|
513
|
+
"prompt": "Opening frame",
|
|
514
|
+
"startMs": 0,
|
|
515
|
+
"durationMs": 4000,
|
|
516
|
+
"image": "https://media.example/panel.png",
|
|
517
|
+
"versions": [
|
|
518
|
+
"https://media.example/panel.png"
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
"after": {
|
|
524
|
+
"schemaVersion": 1,
|
|
525
|
+
"scenes": [
|
|
526
|
+
{
|
|
527
|
+
"sceneId": "scene-1",
|
|
528
|
+
"title": "New opening"
|
|
529
|
+
}
|
|
530
|
+
],
|
|
531
|
+
"strip": [
|
|
532
|
+
{
|
|
533
|
+
"panelId": "panel-1",
|
|
534
|
+
"sceneId": "scene-1",
|
|
535
|
+
"type": "panel",
|
|
536
|
+
"prompt": "Closer opening frame",
|
|
537
|
+
"startMs": 0,
|
|
538
|
+
"durationMs": 4500,
|
|
539
|
+
"image": "https://media.example/panel.png",
|
|
540
|
+
"versions": [
|
|
541
|
+
"https://media.example/panel.png"
|
|
542
|
+
]
|
|
543
|
+
}
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"name": "Build timed panels from narration when the project has none",
|
|
551
|
+
"input": {
|
|
552
|
+
"panels": {
|
|
553
|
+
"schemaVersion": 1,
|
|
554
|
+
"scenes": [],
|
|
555
|
+
"strip": []
|
|
556
|
+
},
|
|
557
|
+
"transcript": {
|
|
558
|
+
"schemaVersion": 1,
|
|
559
|
+
"text": "Opening city view. Show the product.",
|
|
560
|
+
"words": [
|
|
561
|
+
{
|
|
562
|
+
"text": "Opening",
|
|
563
|
+
"start": 0,
|
|
564
|
+
"end": 0.5
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
"text": "city",
|
|
568
|
+
"start": 0.5,
|
|
569
|
+
"end": 1
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"text": "view.",
|
|
573
|
+
"start": 1,
|
|
574
|
+
"end": 3
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"text": "Show",
|
|
578
|
+
"start": 3,
|
|
579
|
+
"end": 3.5
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"text": "the",
|
|
583
|
+
"start": 3.5,
|
|
584
|
+
"end": 4
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"text": "product.",
|
|
588
|
+
"start": 4,
|
|
589
|
+
"end": 6
|
|
590
|
+
}
|
|
591
|
+
]
|
|
592
|
+
},
|
|
593
|
+
"script": {
|
|
594
|
+
"schemaVersion": 1,
|
|
595
|
+
"text": ""
|
|
596
|
+
},
|
|
597
|
+
"updatedPanels": {
|
|
598
|
+
"schemaVersion": 1,
|
|
599
|
+
"scenes": [],
|
|
600
|
+
"strip": []
|
|
601
|
+
},
|
|
602
|
+
"commit": false,
|
|
603
|
+
"action": "none",
|
|
604
|
+
"stockQuery": ""
|
|
605
|
+
},
|
|
606
|
+
"expected": {
|
|
607
|
+
"panels": {
|
|
608
|
+
"schemaVersion": 1,
|
|
609
|
+
"scenes": [
|
|
610
|
+
{
|
|
611
|
+
"sceneId": "scene-1",
|
|
612
|
+
"title": "Narration",
|
|
613
|
+
"description": "Panels built from the current narration."
|
|
614
|
+
}
|
|
615
|
+
],
|
|
616
|
+
"strip": [
|
|
617
|
+
{
|
|
618
|
+
"panelId": "panel-1-0",
|
|
619
|
+
"sceneId": "scene-1",
|
|
620
|
+
"type": "panel",
|
|
621
|
+
"changePrompt": "Create a clear image for: Opening city view.",
|
|
622
|
+
"narration": "Opening city view.",
|
|
623
|
+
"startMs": 0,
|
|
624
|
+
"durationMs": 3000,
|
|
625
|
+
"image": null,
|
|
626
|
+
"versions": [],
|
|
627
|
+
"provenance": "narration"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"panelId": "panel-2-3000",
|
|
631
|
+
"sceneId": "scene-1",
|
|
632
|
+
"type": "panel",
|
|
633
|
+
"changePrompt": "Create a clear image for: Show the product.",
|
|
634
|
+
"narration": "Show the product.",
|
|
635
|
+
"startMs": 3000,
|
|
636
|
+
"durationMs": 3000,
|
|
637
|
+
"image": null,
|
|
638
|
+
"versions": [],
|
|
639
|
+
"provenance": "narration"
|
|
640
|
+
}
|
|
641
|
+
]
|
|
642
|
+
},
|
|
643
|
+
"edit": {
|
|
644
|
+
"schemaVersion": 1,
|
|
645
|
+
"title": "Update Image Panels (1 scenes, 2 panels)",
|
|
646
|
+
"field": "panels",
|
|
647
|
+
"before": {
|
|
648
|
+
"schemaVersion": 1,
|
|
649
|
+
"scenes": [],
|
|
650
|
+
"strip": []
|
|
651
|
+
},
|
|
652
|
+
"after": {
|
|
653
|
+
"schemaVersion": 1,
|
|
654
|
+
"scenes": [
|
|
655
|
+
{
|
|
656
|
+
"sceneId": "scene-1",
|
|
657
|
+
"title": "Narration",
|
|
658
|
+
"description": "Panels built from the current narration."
|
|
659
|
+
}
|
|
660
|
+
],
|
|
661
|
+
"strip": [
|
|
662
|
+
{
|
|
663
|
+
"panelId": "panel-1-0",
|
|
664
|
+
"sceneId": "scene-1",
|
|
665
|
+
"type": "panel",
|
|
666
|
+
"changePrompt": "Create a clear image for: Opening city view.",
|
|
667
|
+
"narration": "Opening city view.",
|
|
668
|
+
"startMs": 0,
|
|
669
|
+
"durationMs": 3000,
|
|
670
|
+
"image": null,
|
|
671
|
+
"versions": [],
|
|
672
|
+
"provenance": "narration"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
"panelId": "panel-2-3000",
|
|
676
|
+
"sceneId": "scene-1",
|
|
677
|
+
"type": "panel",
|
|
678
|
+
"changePrompt": "Create a clear image for: Show the product.",
|
|
679
|
+
"narration": "Show the product.",
|
|
680
|
+
"startMs": 3000,
|
|
681
|
+
"durationMs": 3000,
|
|
682
|
+
"image": null,
|
|
683
|
+
"versions": [],
|
|
684
|
+
"provenance": "narration"
|
|
685
|
+
}
|
|
686
|
+
]
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
"name": "Retain valid legacy long and control-character panel IDs",
|
|
693
|
+
"input": {
|
|
694
|
+
"panels": {
|
|
695
|
+
"schemaVersion": 1,
|
|
696
|
+
"scenes": [
|
|
697
|
+
{
|
|
698
|
+
"sceneId": "scene-1",
|
|
699
|
+
"title": "Opening"
|
|
700
|
+
}
|
|
701
|
+
],
|
|
702
|
+
"strip": [
|
|
703
|
+
{
|
|
704
|
+
"panelId": "legacy-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\u0001",
|
|
705
|
+
"sceneId": "scene-1",
|
|
706
|
+
"type": "panel",
|
|
707
|
+
"prompt": "Opening frame",
|
|
708
|
+
"narration": "Welcome",
|
|
709
|
+
"startMs": 0,
|
|
710
|
+
"durationMs": 4000,
|
|
711
|
+
"image": "https://media.example/panel.png",
|
|
712
|
+
"versions": [
|
|
713
|
+
"https://media.example/old.png",
|
|
714
|
+
"https://media.example/panel.png"
|
|
715
|
+
],
|
|
716
|
+
"custom": {
|
|
717
|
+
"keep": true
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
],
|
|
721
|
+
"audio": {
|
|
722
|
+
"voPath": "https://media.example/voice.mp3"
|
|
723
|
+
}
|
|
724
|
+
},
|
|
725
|
+
"updatedPanels": {
|
|
726
|
+
"schemaVersion": 1,
|
|
727
|
+
"scenes": [],
|
|
728
|
+
"strip": []
|
|
729
|
+
},
|
|
730
|
+
"commit": false
|
|
731
|
+
},
|
|
732
|
+
"expected": {
|
|
733
|
+
"panels": {
|
|
734
|
+
"schemaVersion": 1,
|
|
735
|
+
"scenes": [
|
|
736
|
+
{
|
|
737
|
+
"sceneId": "scene-1",
|
|
738
|
+
"title": "Opening"
|
|
739
|
+
}
|
|
740
|
+
],
|
|
741
|
+
"strip": [
|
|
742
|
+
{
|
|
743
|
+
"panelId": "legacy-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\u0001",
|
|
744
|
+
"sceneId": "scene-1",
|
|
745
|
+
"type": "panel",
|
|
746
|
+
"prompt": "Opening frame",
|
|
747
|
+
"narration": "Welcome",
|
|
748
|
+
"startMs": 0,
|
|
749
|
+
"durationMs": 4000,
|
|
750
|
+
"image": "https://media.example/panel.png",
|
|
751
|
+
"versions": [
|
|
752
|
+
"https://media.example/old.png",
|
|
753
|
+
"https://media.example/panel.png"
|
|
754
|
+
],
|
|
755
|
+
"custom": {
|
|
756
|
+
"keep": true
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
],
|
|
760
|
+
"audio": {
|
|
761
|
+
"voPath": "https://media.example/voice.mp3"
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
"edit": {
|
|
765
|
+
"schemaVersion": 1,
|
|
766
|
+
"title": "Update Image Panels (1 scenes, 1 panels)",
|
|
767
|
+
"field": "panels",
|
|
768
|
+
"before": {
|
|
769
|
+
"schemaVersion": 1,
|
|
770
|
+
"scenes": [
|
|
771
|
+
{
|
|
772
|
+
"sceneId": "scene-1",
|
|
773
|
+
"title": "Opening"
|
|
774
|
+
}
|
|
775
|
+
],
|
|
776
|
+
"strip": [
|
|
777
|
+
{
|
|
778
|
+
"panelId": "legacy-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\u0001",
|
|
779
|
+
"sceneId": "scene-1",
|
|
780
|
+
"type": "panel",
|
|
781
|
+
"prompt": "Opening frame",
|
|
782
|
+
"narration": "Welcome",
|
|
783
|
+
"startMs": 0,
|
|
784
|
+
"durationMs": 4000,
|
|
785
|
+
"image": "https://media.example/panel.png",
|
|
786
|
+
"versions": [
|
|
787
|
+
"https://media.example/old.png",
|
|
788
|
+
"https://media.example/panel.png"
|
|
789
|
+
],
|
|
790
|
+
"custom": {
|
|
791
|
+
"keep": true
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
],
|
|
795
|
+
"audio": {
|
|
796
|
+
"voPath": "https://media.example/voice.mp3"
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
"after": {
|
|
800
|
+
"schemaVersion": 1,
|
|
801
|
+
"scenes": [
|
|
802
|
+
{
|
|
803
|
+
"sceneId": "scene-1",
|
|
804
|
+
"title": "Opening"
|
|
805
|
+
}
|
|
806
|
+
],
|
|
807
|
+
"strip": [
|
|
808
|
+
{
|
|
809
|
+
"panelId": "legacy-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\u0001",
|
|
810
|
+
"sceneId": "scene-1",
|
|
811
|
+
"type": "panel",
|
|
812
|
+
"prompt": "Opening frame",
|
|
813
|
+
"narration": "Welcome",
|
|
814
|
+
"startMs": 0,
|
|
815
|
+
"durationMs": 4000,
|
|
816
|
+
"image": "https://media.example/panel.png",
|
|
817
|
+
"versions": [
|
|
818
|
+
"https://media.example/old.png",
|
|
819
|
+
"https://media.example/panel.png"
|
|
820
|
+
],
|
|
821
|
+
"custom": {
|
|
822
|
+
"keep": true
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
],
|
|
826
|
+
"audio": {
|
|
827
|
+
"voPath": "https://media.example/voice.mp3"
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
"name": "uses connected narration before the project's saved narration",
|
|
835
|
+
"input": {
|
|
836
|
+
"panels": {
|
|
837
|
+
"schemaVersion": 1,
|
|
838
|
+
"scenes": [],
|
|
839
|
+
"strip": []
|
|
840
|
+
},
|
|
841
|
+
"blueprint": {
|
|
842
|
+
"schemaVersion": 1
|
|
843
|
+
},
|
|
844
|
+
"updatedPanels": {
|
|
845
|
+
"schemaVersion": 1,
|
|
846
|
+
"scenes": [],
|
|
847
|
+
"strip": []
|
|
848
|
+
},
|
|
849
|
+
"commit": false,
|
|
850
|
+
"transcript": {
|
|
851
|
+
"schemaVersion": 1,
|
|
852
|
+
"text": "Saved project narration that is out of date.",
|
|
853
|
+
"words": []
|
|
854
|
+
},
|
|
855
|
+
"script": {
|
|
856
|
+
"schemaVersion": 1,
|
|
857
|
+
"text": ""
|
|
858
|
+
},
|
|
859
|
+
"narrationScript": {
|
|
860
|
+
"schemaVersion": 1,
|
|
861
|
+
"text": "Open on the harbour. Close on the lighthouse!"
|
|
862
|
+
}
|
|
863
|
+
},
|
|
864
|
+
"expected": {
|
|
865
|
+
"panels": {
|
|
866
|
+
"schemaVersion": 1,
|
|
867
|
+
"scenes": [
|
|
868
|
+
{
|
|
869
|
+
"sceneId": "scene-1",
|
|
870
|
+
"title": "Narration",
|
|
871
|
+
"description": "Panels built from the current narration."
|
|
872
|
+
}
|
|
873
|
+
],
|
|
874
|
+
"strip": [
|
|
875
|
+
{
|
|
876
|
+
"panelId": "panel-1-0",
|
|
877
|
+
"sceneId": "scene-1",
|
|
878
|
+
"type": "panel",
|
|
879
|
+
"changePrompt": "Create a clear image for: Open on the harbour.",
|
|
880
|
+
"narration": "Open on the harbour.",
|
|
881
|
+
"startMs": 0,
|
|
882
|
+
"durationMs": 2000,
|
|
883
|
+
"image": null,
|
|
884
|
+
"versions": [],
|
|
885
|
+
"provenance": "narration"
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
"panelId": "panel-2-2000",
|
|
889
|
+
"sceneId": "scene-1",
|
|
890
|
+
"type": "panel",
|
|
891
|
+
"changePrompt": "Create a clear image for: Close on the lighthouse!",
|
|
892
|
+
"narration": "Close on the lighthouse!",
|
|
893
|
+
"startMs": 2000,
|
|
894
|
+
"durationMs": 2000,
|
|
895
|
+
"image": null,
|
|
896
|
+
"versions": [],
|
|
897
|
+
"provenance": "narration"
|
|
898
|
+
}
|
|
899
|
+
]
|
|
900
|
+
},
|
|
901
|
+
"edit": {
|
|
902
|
+
"schemaVersion": 1,
|
|
903
|
+
"title": "Update Image Panels (1 scenes, 2 panels)",
|
|
904
|
+
"field": "panels",
|
|
905
|
+
"before": {
|
|
906
|
+
"schemaVersion": 1,
|
|
907
|
+
"scenes": [],
|
|
908
|
+
"strip": []
|
|
909
|
+
},
|
|
910
|
+
"after": {
|
|
911
|
+
"schemaVersion": 1,
|
|
912
|
+
"scenes": [
|
|
913
|
+
{
|
|
914
|
+
"sceneId": "scene-1",
|
|
915
|
+
"title": "Narration",
|
|
916
|
+
"description": "Panels built from the current narration."
|
|
917
|
+
}
|
|
918
|
+
],
|
|
919
|
+
"strip": [
|
|
920
|
+
{
|
|
921
|
+
"panelId": "panel-1-0",
|
|
922
|
+
"sceneId": "scene-1",
|
|
923
|
+
"type": "panel",
|
|
924
|
+
"changePrompt": "Create a clear image for: Open on the harbour.",
|
|
925
|
+
"narration": "Open on the harbour.",
|
|
926
|
+
"startMs": 0,
|
|
927
|
+
"durationMs": 2000,
|
|
928
|
+
"image": null,
|
|
929
|
+
"versions": [],
|
|
930
|
+
"provenance": "narration"
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
"panelId": "panel-2-2000",
|
|
934
|
+
"sceneId": "scene-1",
|
|
935
|
+
"type": "panel",
|
|
936
|
+
"changePrompt": "Create a clear image for: Close on the lighthouse!",
|
|
937
|
+
"narration": "Close on the lighthouse!",
|
|
938
|
+
"startMs": 2000,
|
|
939
|
+
"durationMs": 2000,
|
|
940
|
+
"image": null,
|
|
941
|
+
"versions": [],
|
|
942
|
+
"provenance": "narration"
|
|
943
|
+
}
|
|
944
|
+
]
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
"name": "uses connected word timings when an earlier Step supplies them",
|
|
951
|
+
"input": {
|
|
952
|
+
"panels": {
|
|
953
|
+
"schemaVersion": 1,
|
|
954
|
+
"scenes": [],
|
|
955
|
+
"strip": []
|
|
956
|
+
},
|
|
957
|
+
"blueprint": {
|
|
958
|
+
"schemaVersion": 1
|
|
959
|
+
},
|
|
960
|
+
"updatedPanels": {
|
|
961
|
+
"schemaVersion": 1,
|
|
962
|
+
"scenes": [],
|
|
963
|
+
"strip": []
|
|
964
|
+
},
|
|
965
|
+
"commit": false,
|
|
966
|
+
"transcript": {
|
|
967
|
+
"schemaVersion": 1,
|
|
968
|
+
"text": "",
|
|
969
|
+
"words": []
|
|
970
|
+
},
|
|
971
|
+
"script": {
|
|
972
|
+
"schemaVersion": 1,
|
|
973
|
+
"text": ""
|
|
974
|
+
},
|
|
975
|
+
"narrationTiming": {
|
|
976
|
+
"schemaVersion": 1,
|
|
977
|
+
"text": "Morning light.",
|
|
978
|
+
"words": [
|
|
979
|
+
{
|
|
980
|
+
"text": "Morning",
|
|
981
|
+
"start": 0.5,
|
|
982
|
+
"end": 1.2
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
"text": "light.",
|
|
986
|
+
"start": 1.2,
|
|
987
|
+
"end": 2
|
|
988
|
+
}
|
|
989
|
+
]
|
|
990
|
+
}
|
|
991
|
+
},
|
|
992
|
+
"expected": {
|
|
993
|
+
"panels": {
|
|
994
|
+
"schemaVersion": 1,
|
|
995
|
+
"scenes": [
|
|
996
|
+
{
|
|
997
|
+
"sceneId": "scene-1",
|
|
998
|
+
"title": "Narration",
|
|
999
|
+
"description": "Panels built from the current narration."
|
|
1000
|
+
}
|
|
1001
|
+
],
|
|
1002
|
+
"strip": [
|
|
1003
|
+
{
|
|
1004
|
+
"panelId": "panel-1-500",
|
|
1005
|
+
"sceneId": "scene-1",
|
|
1006
|
+
"type": "panel",
|
|
1007
|
+
"changePrompt": "Create a clear image for: Morning light.",
|
|
1008
|
+
"narration": "Morning light.",
|
|
1009
|
+
"startMs": 500,
|
|
1010
|
+
"durationMs": 1500,
|
|
1011
|
+
"image": null,
|
|
1012
|
+
"versions": [],
|
|
1013
|
+
"provenance": "narration"
|
|
1014
|
+
}
|
|
1015
|
+
]
|
|
1016
|
+
},
|
|
1017
|
+
"edit": {
|
|
1018
|
+
"schemaVersion": 1,
|
|
1019
|
+
"title": "Update Image Panels (1 scenes, 1 panels)",
|
|
1020
|
+
"field": "panels",
|
|
1021
|
+
"before": {
|
|
1022
|
+
"schemaVersion": 1,
|
|
1023
|
+
"scenes": [],
|
|
1024
|
+
"strip": []
|
|
1025
|
+
},
|
|
1026
|
+
"after": {
|
|
1027
|
+
"schemaVersion": 1,
|
|
1028
|
+
"scenes": [
|
|
1029
|
+
{
|
|
1030
|
+
"sceneId": "scene-1",
|
|
1031
|
+
"title": "Narration",
|
|
1032
|
+
"description": "Panels built from the current narration."
|
|
1033
|
+
}
|
|
1034
|
+
],
|
|
1035
|
+
"strip": [
|
|
1036
|
+
{
|
|
1037
|
+
"panelId": "panel-1-500",
|
|
1038
|
+
"sceneId": "scene-1",
|
|
1039
|
+
"type": "panel",
|
|
1040
|
+
"changePrompt": "Create a clear image for: Morning light.",
|
|
1041
|
+
"narration": "Morning light.",
|
|
1042
|
+
"startMs": 500,
|
|
1043
|
+
"durationMs": 1500,
|
|
1044
|
+
"image": null,
|
|
1045
|
+
"versions": [],
|
|
1046
|
+
"provenance": "narration"
|
|
1047
|
+
}
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
"name": "falls back to the project narration when the connected Step has no narration yet",
|
|
1055
|
+
"input": {
|
|
1056
|
+
"panels": {
|
|
1057
|
+
"schemaVersion": 1,
|
|
1058
|
+
"scenes": [],
|
|
1059
|
+
"strip": []
|
|
1060
|
+
},
|
|
1061
|
+
"blueprint": {
|
|
1062
|
+
"schemaVersion": 1
|
|
1063
|
+
},
|
|
1064
|
+
"updatedPanels": {
|
|
1065
|
+
"schemaVersion": 1,
|
|
1066
|
+
"scenes": [],
|
|
1067
|
+
"strip": []
|
|
1068
|
+
},
|
|
1069
|
+
"commit": false,
|
|
1070
|
+
"transcript": {
|
|
1071
|
+
"schemaVersion": 1,
|
|
1072
|
+
"text": "",
|
|
1073
|
+
"words": []
|
|
1074
|
+
},
|
|
1075
|
+
"script": {
|
|
1076
|
+
"schemaVersion": 1,
|
|
1077
|
+
"text": "Saved script line."
|
|
1078
|
+
},
|
|
1079
|
+
"narrationScript": {
|
|
1080
|
+
"schemaVersion": 1,
|
|
1081
|
+
"text": " "
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
"expected": {
|
|
1085
|
+
"panels": {
|
|
1086
|
+
"schemaVersion": 1,
|
|
1087
|
+
"scenes": [
|
|
1088
|
+
{
|
|
1089
|
+
"sceneId": "scene-1",
|
|
1090
|
+
"title": "Narration",
|
|
1091
|
+
"description": "Panels built from the current narration."
|
|
1092
|
+
}
|
|
1093
|
+
],
|
|
1094
|
+
"strip": [
|
|
1095
|
+
{
|
|
1096
|
+
"panelId": "panel-1-0",
|
|
1097
|
+
"sceneId": "scene-1",
|
|
1098
|
+
"type": "panel",
|
|
1099
|
+
"changePrompt": "Create a clear image for: Saved script line.",
|
|
1100
|
+
"narration": "Saved script line.",
|
|
1101
|
+
"startMs": 0,
|
|
1102
|
+
"durationMs": 2000,
|
|
1103
|
+
"image": null,
|
|
1104
|
+
"versions": [],
|
|
1105
|
+
"provenance": "narration"
|
|
1106
|
+
}
|
|
1107
|
+
]
|
|
1108
|
+
},
|
|
1109
|
+
"edit": {
|
|
1110
|
+
"schemaVersion": 1,
|
|
1111
|
+
"title": "Update Image Panels (1 scenes, 1 panels)",
|
|
1112
|
+
"field": "panels",
|
|
1113
|
+
"before": {
|
|
1114
|
+
"schemaVersion": 1,
|
|
1115
|
+
"scenes": [],
|
|
1116
|
+
"strip": []
|
|
1117
|
+
},
|
|
1118
|
+
"after": {
|
|
1119
|
+
"schemaVersion": 1,
|
|
1120
|
+
"scenes": [
|
|
1121
|
+
{
|
|
1122
|
+
"sceneId": "scene-1",
|
|
1123
|
+
"title": "Narration",
|
|
1124
|
+
"description": "Panels built from the current narration."
|
|
1125
|
+
}
|
|
1126
|
+
],
|
|
1127
|
+
"strip": [
|
|
1128
|
+
{
|
|
1129
|
+
"panelId": "panel-1-0",
|
|
1130
|
+
"sceneId": "scene-1",
|
|
1131
|
+
"type": "panel",
|
|
1132
|
+
"changePrompt": "Create a clear image for: Saved script line.",
|
|
1133
|
+
"narration": "Saved script line.",
|
|
1134
|
+
"startMs": 0,
|
|
1135
|
+
"durationMs": 2000,
|
|
1136
|
+
"image": null,
|
|
1137
|
+
"versions": [],
|
|
1138
|
+
"provenance": "narration"
|
|
1139
|
+
}
|
|
1140
|
+
]
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
],
|
|
1146
|
+
"portable": {
|
|
1147
|
+
"format": "stillmade-block/1",
|
|
1148
|
+
"dependencies": [],
|
|
1149
|
+
"sources": [
|
|
1150
|
+
{
|
|
1151
|
+
"kind": "original",
|
|
1152
|
+
"license": "MIT",
|
|
1153
|
+
"paths": [
|
|
1154
|
+
"LICENSE",
|
|
1155
|
+
"src/run.js",
|
|
1156
|
+
"src/view.json"
|
|
1157
|
+
],
|
|
1158
|
+
"evidence": [
|
|
1159
|
+
"upstream/0/LICENSE",
|
|
1160
|
+
"upstream/0/src/run.js",
|
|
1161
|
+
"upstream/0/src/view.json"
|
|
1162
|
+
],
|
|
1163
|
+
"changes": "Original implementation declared by the packager; no reused repository or dependency code."
|
|
1164
|
+
}
|
|
1165
|
+
],
|
|
1166
|
+
"files": {
|
|
1167
|
+
"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",
|
|
1168
|
+
"upstream/0/src/run.js": "const copy = value => JSON.parse(JSON.stringify(value));\nconst source = copy(input.panels || {schemaVersion: 1, scenes: [], strip: []});\nconst blueprint=copy(input.blueprint||{schemaVersion:1});\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 narration=String(transcript?.text||script?.text||(typeof script==='string'?script:'')).trim();\nconst timed=Array.isArray(transcript?.words)?transcript.words.map(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})).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start):[];\nconst draftFromNarration=()=>{const groups=[];let group=[];timed.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);if(!groups.length){let cursor=0;(narration.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean).forEach(value=>{const duration=Math.max(2,value.split(/\\s+/).length/2.5);groups.push([{text:value,start:cursor,end:cursor+duration}]);cursor+=duration;});}return {schemaVersion:1,scenes:groups.length?[{sceneId:'scene-1',title:'Narration',description:'Panels built from the current narration.'}]:[],strip:groups.map((words,index)=>{const start=words[0].start,end=words.at(-1).end,text=words.map(word=>word.text).join(' ');return {panelId:'panel-'+String(index+1)+'-'+String(Math.max(0,Math.round(start*1000))),sceneId:'scene-1',type:'panel',changePrompt:'Create a clear image for: '+text,narration:text,startMs:Math.round(start*1000),durationMs:Math.max(1,Math.round((end-start)*1000)),image:null,versions:[],provenance:'narration'}})}};\nconst fallback=!source.strip?.length?draftFromNarration():source;\nconst candidate = input.commit || ['prepare','generate','generate-batch','stock','quality','render'].includes(input.action) ? copy(input.updatedPanels) : copy(fallback);\nif (input.attachGeneratedImage) {\n if (!input.generatedImage || input.generatedImage.kind !== 'image') throw new Error('Connect an approved generated image before attaching it.');\n const target = candidate.strip.find(panel => panel.panelId === input.targetPanelId);\n if (!target) throw new Error('Choose an existing target panel for the connected image.');\n const prior = Array.isArray(target.versions) ? target.versions : target.image ? [target.image] : [];\n const url = input.generatedImage.url;\n target.image = url;\n target.imageAsset = copy(input.generatedImage);\n target.versions = [...prior.filter(version => version !== url), url].slice(-8);\n}\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || !Array.isArray(candidate.strip)) {\n throw new Error('Keep the complete version 1 Image Panels document and its strip.');\n}\nif (candidate.strip.length > 4096 || !candidate.strip.every(panel => panel && typeof panel === 'object' && !Array.isArray(panel) && typeof panel.panelId === 'string' && panel.panelId.length > 0)) {\n throw new Error('Image Panels supports up to 4,096 rows with retained panel IDs.');\n}\nconst ids = candidate.strip.map(panel => panel.panelId);\nif (new Set(ids).size !== ids.length) throw new Error('Keep every Image Panel ID unique.');\nif (candidate.scenes !== undefined && (!Array.isArray(candidate.scenes) || candidate.scenes.length > 2048 || !candidate.scenes.every(scene => scene && typeof scene === 'object' && !Array.isArray(scene)))) {\n throw new Error('Image Panels needs a valid retained scene list.');\n}\nif (!candidate.strip.every(panel => !panel.elements || Array.isArray(panel.elements) && panel.elements.length <= 5000 && panel.elements.every(element => element && typeof element === 'object' && !Array.isArray(element)))) {\n throw new Error('Canvas panels need valid element lists with up to 5,000 elements.');\n}\nconst itemEnd=item=>Math.max(0,Number(item.start)||0)+Math.max(.001,Number(item.duration)||Number(item.durationMs)/1000||.001);\nconst outputs={panels:candidate,edit:{schemaVersion:1,title:`Update Image Panels (${candidate.scenes.length} scenes, ${candidate.strip.length} panels)`,field:'panels',before:source,after:candidate}};\nconst generationItem=(panel,index)=>{const style=String(candidate.generationSettings?.stylePrompt||blueprint.visualStyle||blueprint.style?.description||'').trim(),cast=Array.isArray(panel.cast)?panel.cast.map(String).filter(Boolean).slice(0,20):[],prompt=[String(panel.changePrompt||panel.prompt||panel.narration||'Panel '+String(index+1)).trim(),style&&'Style: '+style,cast.length&&'Cast: '+cast.join(', ')].filter(Boolean).join('. '),exact=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null);return {panelId:panel.panelId,prompt,status:exact&&exact.assetId&&exact.versionId?'complete':'ready',...(exact&&exact.assetId&&exact.versionId?{image:{kind:'image',assetId:exact.assetId,versionId:exact.versionId,url:exact.url}}:{})}};\nif(input.action==='prepare'){const items=candidate.strip.map(generationItem),stylePrompt=String(candidate.generationSettings?.stylePrompt||blueprint.visualStyle||blueprint.style?.description||'').trim();outputs.generationPlan={schemaVersion:1,kind:'panel-generation-plan',stylePrompt,items,progress:{complete:items.filter(item=>item.status==='complete').length,total:items.length}};}\nif(input.action==='generate'){const panel=candidate.strip.find(item=>item.panelId===input.targetPanelId);if(!panel)throw new Error('Choose the current panel before generating.');const style=String(candidate.generationSettings?.stylePrompt||blueprint.visualStyle||blueprint.style?.description||'').trim(),cast=Array.isArray(panel.cast)?panel.cast.map(String).filter(Boolean).slice(0,20):[],prompt=[String(panel.changePrompt||panel.prompt||panel.narration||'Create this panel').trim(),style&&'Style: '+style,cast.length&&'Cast: '+cast.join(', ')].filter(Boolean).join('. ');outputs.generateAction={schemaVersion:1,kind:'stillmade.media-action',operation:'image.generate',request:{prompt},resultPort:'generatedImage'};}\nif(input.action==='generate-batch'){const items=candidate.strip.map(generationItem).filter(item=>item.status!=='complete').slice(0,100);if(!items.length)throw new Error('Every panel already has an exact image.');outputs.batchGenerateAction={schemaVersion:1,kind:'stillmade.media-action',operation:'image.generate.batch',request:{source:{id:'sm.panel-strip',version:'2.4.0'},items:items.map(({panelId,prompt})=>({panelId,prompt})),aspectRatio:String(candidate.aspectRatio||candidate.meta?.aspect||'16:9')},resultPort:'generatedImages'};}\nconst images=candidate.strip.map(panel=>panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null)).filter(image=>image&&image.kind==='image'&&image.assetId&&image.versionId&&image.url).slice(0,16);\nif(input.action==='stock'&&input.stockQuery.trim())outputs.stockAction={schemaVersion:1,kind:'stillmade.media-action',operation:'stock.search',request:{query:input.stockQuery.trim(),type:'photo'},resultPort:'stockImage'};\nif(input.action==='quality'&&images.length)outputs.qualityAction={schemaVersion:1,kind:'stillmade.media-action',operation:'quality.analyze',request:{assets:images.map(({assetId,versionId,url})=>({kind:'image',assetId,versionId,url}))},resultPort:'qualityReport'};\nif(input.action==='render'){const clips=candidate.strip.map((panel,index)=>({id:panel.panelId||'panel-'+index,start:(Number(panel.startMs)||0)/1000,duration:Math.max(.001,(Number(panel.durationMs)||1000)/1000),url:panel.image?.url||panel.imageAsset?.url||panel.asset?.url||panel.selectedImage?.url||typeof panel.image==='string'&&panel.image||''})),targetDuration=Math.max(.001,...clips.map(itemEnd));outputs.renderAction={schemaVersion:1,kind:'stillmade.media-action',operation:'final.render',request:{schemaVersion:1,kind:'video',timeline:{schemaVersion:1,activeTimelineId:'panels',clips,audio:[],overlays:[],targetDuration},settings:{fps:30,resolution:1080,quality:'high'},source:{id:'sm.panel-strip',version:'2.4.0'}},resultPort:null};}\nreturn outputs;\n",
|
|
1169
|
+
"upstream/0/src/view.json": "{\n \"html\": \"<main class=\\\"panels-workspace\\\">\\n <header><div><small>Production workspace</small><h1>Image Panels</h1><p id=\\\"summary\\\">Loading panels…</p></div><div class=\\\"actions\\\"><button id=\\\"build\\\" type=\\\"button\\\" class=\\\"secondary\\\">Build from narration</button><button id=\\\"reset\\\" type=\\\"button\\\" class=\\\"secondary\\\">Reset shared draft</button><button id=\\\"addScene\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add scene</button><button id=\\\"addPanel\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add panel</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 <div id=\\\"recovery\\\" hidden><p id=\\\"recoveryMessage\\\" role=\\\"alert\\\"></p><div class=\\\"actions\\\"><button id=\\\"retryShared\\\" type=\\\"button\\\" class=\\\"secondary\\\">Retry sharing</button><button id=\\\"discardShared\\\" type=\\\"button\\\" class=\\\"secondary\\\">Discard my unsent edits</button><button id=\\\"resetSharedSource\\\" type=\\\"button\\\" class=\\\"secondary\\\">Review source reset</button><button id=\\\"confirmSourceReset\\\" type=\\\"button\\\" class=\\\"danger\\\" hidden>Confirm: replace the shared draft for everyone</button></div><p>Resetting the source discards shared draft edits for everyone and uses the latest project input. Saved project content is unchanged until reviewed and applied.</p></div>\\n <output id=\\\"sharedResult\\\" role=\\\"status\\\" aria-live=\\\"polite\\\"></output>\\n <section><div class=\\\"section-title\\\"><h2>Generation plan</h2><strong id=\\\"progress\\\">0 of 0 panels have images</strong></div><label>Visual style<textarea id=\\\"stylePrompt\\\" placeholder=\\\"Describe the consistent visual style\\\"></textarea></label><p id=\\\"blueprintHints\\\" class=\\\"hint\\\"></p><div class=\\\"actions\\\"><button id=\\\"prepareBatch\\\" type=\\\"button\\\" class=\\\"secondary\\\">Prepare all prompts</button><button id=\\\"generateBatch\\\" type=\\\"button\\\">Review and generate missing panels</button></div><div id=\\\"queue\\\" class=\\\"cards\\\"></div></section>\\n <section><div class=\\\"section-title\\\"><h2>Connected generated image</h2></div><img id=\\\"imagePreview\\\" alt=\\\"Selected panel image preview\\\" hidden><div id=\\\"handoff\\\"></div></section>\\n <section><div class=\\\"section-title\\\"><h2>Scenes</h2></div><div id=\\\"scenes\\\" class=\\\"cards\\\"></div></section>\\n <section><div class=\\\"section-title\\\"><h2>Panels</h2></div><div id=\\\"panels\\\" class=\\\"cards\\\"></div></section>\\n <details id=\\\"rawDetails\\\"><summary>Complete Image Panels data</summary><p>Every field, media reference, version, canvas element, and audio setting is retained. Edit this JSON for custom fields not shown on the cards.</p><textarea id=\\\"raw\\\" class=\\\"raw\\\" spellcheck=\\\"false\\\" aria-label=\\\"Complete Image Panels data\\\"></textarea><p id=\\\"rawNotice\\\">JSON typing is shared live; Apply updates the panel document.</p><button id=\\\"discardRaw\\\" type=\\\"button\\\" class=\\\"secondary\\\" disabled>Discard shared JSON draft</button><button id=\\\"applyRaw\\\" type=\\\"button\\\" class=\\\"secondary\\\">Apply JSON to workspace</button></details>\\n<section><h2>Finish panels</h2><label>Stock search<input id=\\\"stockQuery\\\" type=\\\"text\\\" placeholder=\\\"sunset city skyline\\\"></label><div class=\\\"actions\\\"><button id=\\\"stockSearch\\\" type=\\\"button\\\" class=\\\"secondary\\\">Search licensed stock</button><button id=\\\"qualityReview\\\" type=\\\"button\\\" class=\\\"secondary\\\">Review image quality</button><button id=\\\"renderFinal\\\" type=\\\"button\\\">Render final video</button></div></section></main>\\n\",\n \"css\": \".panels-workspace{max-width:1120px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.section-title,.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}.cards{display:grid;gap:12px;margin-top:12px}.card{padding:14px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg)}.card-head{justify-content:space-between}.card h3{margin:0;font-size:17px}.grid{display:grid;grid-template-columns:repeat(4,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:76px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:380px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}\\n@media(max-width:820px){.grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:560px){.panels-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}section,details{padding:12px}}\\nimg{display:block;width:min(100%,640px);max-height:420px;object-fit:contain;margin:10px auto;border-radius:var(--r-3);background:var(--bg)}img[hidden]{display:none}\\n\",\n \"javascript\": \"const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),build=document.getElementById('build'),imagePreview=document.getElementById('imagePreview'),progress=document.getElementById('progress'),stylePrompt=document.getElementById('stylePrompt'),blueprintHints=document.getElementById('blueprintHints');\\nlet source={schemaVersion:1,scenes:[],strip:[]},draft={schemaVersion:1,scenes:[],strip:[]},connectedImage=null,generatedImages=[],transcript={schemaVersion:1,text:'',words:[]},script={schemaVersion:1,text:''},narrationScript=null,narrationTiming=null,busy=false,revision=0,blueprint={schemaVersion:1};\\nlet shared=null,scratchShared=null,scratch={text:null,base:null,stockQuery:''},scratchAccess={canEdit:false,error:null,pending:false},access={canEdit:false,error:null,sourceConflict:false,pending:false},rawDirty=false,rawBase=null,rawStale=false,sharedOutputs={},resultSignature='',sourceResetArmed=false,rawPreview='';\\nconst blocked=()=>busy||!shared||!scratchShared||!access.canEdit||!scratchAccess.canEdit||!!access.error||!!scratchAccess.error;\\nconst uniqueId=prefix=>prefix+'-'+Date.now().toString(36)+'-'+Math.random().toString(36).slice(2,12);\\nconst clone=value=>JSON.parse(JSON.stringify(value));\\nconst text=value=>value===undefined||value===null?'':String(value);\\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 heardText=()=>{const {transcript,script}=heard();return text(transcript.text||script.text||(typeof script==='string'?script:'')).trim();};\\nconst plan=()=>{const narration=heardText(),parts=(narration.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let start=0;return {schemaVersion:1,scenes:parts.length?[{sceneId:'scene-1',title:'Narration',description:'Panels built from the current narration.'}]:[],strip:parts.map((line,index)=>{const duration=Math.max(2000,Math.round(line.split(/\\\\s+/).length/2.5*1000)),panel={panelId:'panel-'+String(index+1)+'-'+String(start),sceneId:'scene-1',type:'panel',changePrompt:'Create a clear image for: '+line,narration:line,startMs:start,durationMs:duration,image:null,versions:[],provenance:'narration'};start+=duration;return panel})}};\\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},type==='textarea'?{tag:'textarea',action,value:text(value),disabled:blocked(),label}:{tag:'input',type,action,value:Number.isFinite(value)?value:text(value),disabled:blocked(),label}]});\\nconst choice=(label,action,value,options)=>({tag:'label',children:[{tag:'span',text:label},{tag:'select',action,value:text(value),disabled:blocked(),label,children:options.map(option=>({tag:'option',text:option,value:option}))}]});\\nconst sceneCard=(scene,index)=>({tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:text(scene.title)||text(scene.name)||'Scene '+String(index+1)},{tag:'button',action:'remove-scene:'+String(index),text:'Remove',className:'danger',disabled:blocked()}]},{tag:'div',className:'grid',children:[field('Scene ID','scene-id:'+String(index),scene.sceneId||scene.id),field('Title','scene-title:'+String(index),scene.title||scene.name),field('Description','scene-description:'+String(index),scene.description||scene.summary,'textarea',true)]}]});\\nconst panelCard=(panel,index)=>{const preview=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null),versions=Array.isArray(panel.imageVersions)?panel.imageVersions.filter(value=>value&&value.kind==='image'&&value.assetId&&value.versionId):[];return {tag:'article',className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h3',text:'Panel '+String(index+1)+' · '+text(panel.panelId)},{tag:'div',className:'row',children:[{tag:'button',action:'generate-panel:'+String(index),text:'Generate',className:'secondary',disabled:blocked()},{tag:'button',action:'preview-panel:'+String(index),text:'Preview',className:'secondary',disabled:busy||!preview},{tag:'button',action:'duplicate-panel:'+String(index),text:'Duplicate',className:'secondary',disabled:blocked()},{tag:'button',action:'move-up:'+String(index),text:'Up',className:'secondary',disabled:blocked()||index===0},{tag:'button',action:'move-down:'+String(index),text:'Down',className:'secondary',disabled:blocked()||index===draft.strip.length-1},{tag:'button',action:'remove-panel:'+String(index),text:'Remove',className:'danger',disabled:blocked()}]}]},{tag:'div',className:'grid',children:[field('Panel ID','panel-id:'+String(index),panel.panelId),field('Scene ID','panel-scene:'+String(index),panel.sceneId),choice('Type','panel-type:'+String(index),panel.type||'panel',['panel','canvas','zoom']),field('Starts (ms)','panel-start:'+String(index),panel.startMs,'number'),field('Length (ms)','panel-duration:'+String(index),panel.durationMs,'number'),field('Source panel','panel-source:'+String(index),panel.sourcePanelId||panel.repeatOf),field('Cast (comma separated)','panel-cast:'+String(index),Array.isArray(panel.cast)?panel.cast.join(', '):panel.cast,'text',true),field('Change prompt','panel-prompt:'+String(index),panel.changePrompt,'textarea',true),field('Narration','panel-narration:'+String(index),panel.narration||panel.voiceoverText,'textarea',true),{tag:'p',className:'wide hint',text:(preview?'Exact current image retained. ':'')+String(versions.length)+' exact image version'+(versions.length===1?'':'s')+' available.'},{tag:'div',className:'wide row',children:versions.map((version,versionIndex)=>({tag:'button',action:'restore-image:'+String(index)+':'+String(versionIndex),text:'Use v'+String(versionIndex+1)+' · '+text(version.versionId),className:'secondary',disabled:blocked()||preview&&preview.versionId===version.versionId}))}]}]}};\\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft={schemaVersion:1,scenes:[],strip:[]};if(!Array.isArray(draft.scenes))draft.scenes=[];if(!Array.isArray(draft.strip))draft.strip=[]};\\nconst retime=()=>{let start=0;draft.strip=draft.strip.map(panel=>{const next={...panel,startMs:start};start+=Math.max(0,Number(panel.durationMs)||0);return next})};\\nconst rawIsOpen=()=>document.getElementById('rawDetails').getAttribute('open')!==null;\\nconst renderRawPreview=()=>{if(!rawIsOpen())return;if(rawDirty){rawStale=JSON.stringify(scratch.base)!==JSON.stringify(draft);if(raw.value!==scratch.text)raw.value=scratch.text;drawRecovery();return;}const value=JSON.stringify(draft,null,2);rawPreview=value;if(raw.value!==value)raw.value=value;};\\nconst scheduleRawPreview=()=>{if(rawIsOpen())StillMade.scheduleSharedEdit('panelsRawPreview',renderRawPreview);};\\ndocument.getElementById('rawDetails').addEventListener('toggle',renderRawPreview);\\nconst queueCard=item=>({tag:'article',className:'card',children:[{tag:'strong',text:text(item.panelId)+' · '+text(item.status)},{tag:'p',text:text(item.generationText)}]});const draw=()=>{ensure();StillMade.render('handoff',connectedImage?[{tag:'p',className:'hint',text:'Ready: '+text(connectedImage.assetId)+' · version '+text(connectedImage.versionId)},{tag:'div',className:'row',children:[{tag:'button',action:'preview-connected',text:'Preview image',className:'secondary',disabled:busy},...draft.strip.map((panel,index)=>({tag:'button',action:'attach-image:'+String(index),text:'Use in panel '+String(index+1),className:'secondary',disabled:blocked()}))]}]:[{tag:'p',className:'hint',text:'Connect Generate image or the licensed stock result to attach an approved stored result. Provider credentials and charging stay outside this Block.'}]);const queue=Array.isArray(draft.generationQueue)?draft.generationQueue:[];StillMade.render('queue',queue.length?queue.map(queueCard):[{tag:'p',text:'Prepare prompts to create a saved generation queue.'}]);StillMade.render('scenes',draft.scenes.length?draft.scenes.map(sceneCard):[{tag:'p',text:'No scene groups yet.'}]);StillMade.render('panels',draft.strip.length?draft.strip.map(panelCard):[{tag:'p',text:'No panels yet. Add one to begin.'}]);const complete=draft.strip.filter(panel=>{const image=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null);return image&&image.assetId&&image.versionId}).length;progress.textContent=String(complete)+' of '+String(draft.strip.length)+' panels have exact images';stylePrompt.value=text(draft.generationSettings&&draft.generationSettings.stylePrompt);scheduleRawPreview();summary.textContent=String(draft.strip.length)+' panel'+(draft.strip.length===1?'':'s')+' across '+String(draft.scenes.length)+' scene'+(draft.scenes.length===1?'':'s');save.disabled=blocked()||rawDirty;build.disabled=blocked()||!heardText();document.getElementById('reset').disabled=blocked();document.getElementById('addScene').disabled=blocked();document.getElementById('addPanel').disabled=blocked();document.getElementById('prepareBatch').disabled=blocked()||!draft.strip.length;document.getElementById('generateBatch').disabled=blocked()||!draft.strip.some(panel=>!(panel.imageAsset&&panel.imageAsset.assetId&&panel.imageAsset.versionId));['applyRaw','stockSearch','qualityReview','renderFinal'].forEach(id=>{document.getElementById(id).disabled=blocked();});stylePrompt.disabled=blocked();raw.disabled=blocked();document.getElementById('stockQuery').disabled=blocked();drawRecovery();drawResults()};\\nconst edited=()=>{revision+=1;if(rawDirty)rawStale=true;scheduleRawPreview();shared.changed();status.textContent='Sharing draft changes. Review changes applies the document to your project.'};\\nconst drawRecovery=()=>{document.getElementById('recovery').hidden=!access.error&&!scratchAccess.error;document.getElementById('recoveryMessage').textContent=access.error||scratchAccess.error||'';document.getElementById('retryShared').disabled=!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending||access.sourceConflict;document.getElementById('discardShared').disabled=!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending||access.sourceConflict;document.getElementById('resetSharedSource').hidden=!access.sourceConflict;document.getElementById('resetSharedSource').disabled=!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending;document.getElementById('confirmSourceReset').hidden=!sourceResetArmed||!access.sourceConflict;document.getElementById('confirmSourceReset').disabled=!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending;document.getElementById('rawNotice').textContent=rawDirty?(rawStale?'The shared JSON draft is retained. The panel document changed; Apply checks for conflicting edits.':'This JSON draft is shared live. Apply it to the panel document when ready, or discard the shared scratch.'):'JSON typing is shared live; Apply updates the panel document.';document.getElementById('discardRaw').disabled=blocked()||!rawDirty;save.disabled=blocked()||rawDirty;};\\nconst drawResults=()=>{const images=Array.isArray(sharedOutputs.generatedImages)?sharedOutputs.generatedImages:[];document.getElementById('sharedResult').textContent=images.length?String(images.length)+' generated images are available in the shared result below.':sharedOutputs.generatedImage?'A generated image is available in the shared result below.':sharedOutputs.panels?'The latest reviewed Image Panels result is available below.':'';};\\nraw.addEventListener('input',()=>{if(blocked())return;if(!rawDirty)scratch.base=rawPreview?JSON.parse(rawPreview):clone(draft);scratch.text=raw.value;rawBase=scratch.base;rawDirty=true;scratchShared.changed();drawRecovery();});\\ndocument.getElementById('discardRaw').addEventListener('click',()=>{if(blocked())return;scratch={...scratch,text:null,base:null};rawDirty=false;rawBase=null;rawStale=false;scratchShared.changed();renderRawPreview();drawRecovery();});\\ndocument.getElementById('stockQuery').addEventListener('input',()=>{if(blocked())return;scratch.stockQuery=document.getElementById('stockQuery').value;scratchShared.changed();});\\nconst recover=async(action)=>{if(busy||!shared||!access.canEdit||!scratchAccess.canEdit||access.pending||scratchAccess.pending)return;busy=true;draw();try{await action();sourceResetArmed=false;status.textContent='Shared draft recovered.';}catch(error){status.textContent=error.message;}finally{busy=false;draw();}};\\ndocument.getElementById('retryShared').addEventListener('click',()=>recover(async()=>{await shared.retry();await scratchShared.retry();}));\\ndocument.getElementById('discardShared').addEventListener('click',()=>recover(async()=>{await shared.discard();await scratchShared.discard();}));\\ndocument.getElementById('resetSharedSource').addEventListener('click',()=>{sourceResetArmed=true;drawRecovery();});\\ndocument.getElementById('confirmSourceReset').addEventListener('click',()=>recover(()=>shared.resetSharedSource({discardSharedEdits:true})));\\nStillMade.onShared(value=>{sharedOutputs=value.outputs||{};const signature=JSON.stringify(sharedOutputs);if(signature!==resultSignature){resultSignature=signature;drawResults();}});\\n\\nStillMade.onAction(event=>{if(busy||(!event.action.startsWith('preview-')&&blocked()))return;ensure();const parts=event.action.split(':'),kind=parts[0],index=Number(parts[1]),scene=draft.scenes.find((item,position)=>position===index),panel=draft.strip.find((item,position)=>position===index);\\n if(kind==='remove-scene'){draft.scenes=draft.scenes.filter((item,position)=>position!==index);edited();draw();return}if(kind==='scene-id'&&scene){if(Object.hasOwn(scene,'sceneId'))scene.sceneId=event.value;else scene.id=event.value}if(kind==='scene-title'&&scene){if(Object.hasOwn(scene,'title'))scene.title=event.value;else scene.name=event.value}if(kind==='scene-description'&&scene){if(Object.hasOwn(scene,'description'))scene.description=event.value;else scene.summary=event.value}\\n if(kind==='generate-panel'&&panel){mediaAction('generate',{targetPanelId:panel.panelId});return} if(kind==='restore-image'&&panel){const versionIndex=Number(parts[2]),versions=Array.isArray(panel.imageVersions)?panel.imageVersions:[],version=versions.find((item,position)=>position===versionIndex);if(version){panel.image=version.url;panel.imageAsset=clone(version);edited();draw();status.textContent='Exact image version restored for '+text(panel.panelId)+'.'}return}if(kind==='preview-connected'&&connectedImage){StillMade.previewImage(connectedImage).then(value=>{imagePreview.src=value.url;imagePreview.hidden=false;status.textContent='Previewing connected image version.'}).catch(error=>{status.textContent=error.message});return}if(kind==='preview-panel'&&panel){const value=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null);if(value)StillMade.previewImage(value).then(preview=>{imagePreview.src=preview.url;imagePreview.hidden=false;status.textContent='Previewing '+text(panel.panelId)+'.'}).catch(error=>{status.textContent=error.message});return}if(kind==='duplicate-panel'&&panel){const next=clone(panel);next.panelId=uniqueId('panel-copy');next.startMs=(Number(panel.startMs)||0)+(Number(panel.durationMs)||0);next.provenance='duplicate';draft.strip=[...draft.strip.slice(0,index+1),next,...draft.strip.slice(index+1)];retime();edited();draw();return}if(kind==='remove-panel'){draft.strip=draft.strip.filter((item,position)=>position!==index);retime();edited();draw();return}if(kind==='move-up'&&index>0){const target=draft.strip.find((item,position)=>position===index-1);draft.strip=draft.strip.map((item,position)=>position===index-1?panel:position===index?target:item);retime();edited();draw();return}if(kind==='move-down'&&index<draft.strip.length-1){const target=draft.strip.find((item,position)=>position===index+1);draft.strip=draft.strip.map((item,position)=>position===index+1?panel:position===index?target:item);retime();edited();draw();return}if(!panel){edited();return}\\n if(kind==='attach-image'&&connectedImage){const priorVersions=Array.isArray(panel.versions)?panel.versions:panel.image?[panel.image]:[];panel.image=connectedImage.url;panel.imageAsset=clone(connectedImage);panel.imageVersions=[...(Array.isArray(panel.imageVersions)?panel.imageVersions:[]).filter(value=>value.versionId!==connectedImage.versionId),clone(connectedImage)].slice(-8);panel.versions=[...priorVersions.filter(value=>value!==connectedImage.url),connectedImage.url].slice(-8);edited();draw();status.textContent='Connected image attached with its exact asset and version identity.';return}\\n if(kind==='panel-id'){if(!event.value||draft.strip.some(item=>item!==panel&&item.panelId===event.value)){status.textContent='Keep every panel ID nonempty and unique.';return;}panel.panelId=event.value;}if(kind==='panel-scene')panel.sceneId=event.value;if(kind==='panel-type')panel.type=event.value;if(kind==='panel-start')panel.startMs=Math.max(0,Number(event.value)||0);if(kind==='panel-duration')panel.durationMs=Math.max(1,Number(event.value)||1);if(kind==='panel-source'){if(panel.type==='zoom')panel.sourcePanelId=event.value;else panel.repeatOf=event.value}if(kind==='panel-cast')panel.cast=event.value.split(',').map(value=>value.trim()).filter(Boolean).slice(0,20);if(kind==='panel-prompt')panel.changePrompt=event.value;if(kind==='panel-narration'){if(Object.hasOwn(panel,'voiceoverText'))panel.voiceoverText=event.value;else panel.narration=event.value}edited()});\\nbuild.addEventListener('click',()=>{if(!blocked()){draft=plan();edited();draw();status.textContent='Built a draft from the current narration. Review prompts and timing before applying.'}});\\ndocument.getElementById('addScene').addEventListener('click',()=>{if(blocked())return;ensure();const id=uniqueId('portable-scene');draft.scenes=[...draft.scenes,{sceneId:id,title:'New scene',description:''}];edited();draw()});\\ndocument.getElementById('addPanel').addEventListener('click',()=>{if(blocked())return;ensure();const start=draft.strip.reduce((total,panel)=>total+Math.max(0,Number(panel.durationMs)||0),0),id=uniqueId('portable-panel'),scene=draft.scenes.find((item,position)=>position===0);draft.strip=[...draft.strip,{panelId:id,sceneId:scene?scene.sceneId||scene.id:null,type:'panel',changePrompt:'',narration:'',startMs:start,durationMs:4000,image:null,versions:[],provenance:'user'}];edited();draw()});\\ndocument.getElementById('applyRaw').addEventListener('click',async()=>{if(blocked()||!rawDirty)return;const requested=clone(scratch);busy=true;draw();try{await scratchShared.flush();if(JSON.stringify(scratch)!==JSON.stringify(requested))throw Error('The shared JSON draft changed. Review the latest text before applying it.');if(!access.canEdit||!scratchAccess.canEdit||access.error||scratchAccess.error)throw Error('Editing access changed. The shared JSON draft is retained.');const pending=clone(scratch),value=JSON.parse(pending.text);if(!value||Array.isArray(value)||value.schemaVersion!==1||!Array.isArray(value.strip))throw Error('Image Panels JSON must be a version 1 object with a strip.');if(value.strip.some(panel=>!panel||typeof panel.panelId!=='string'||!panel.panelId)||new Set(value.strip.map(panel=>panel.panelId)).size!==value.strip.length)throw Error('Keep every panel ID nonempty and unique.');const edits=StillMade.diffDocument(pending.base||draft,value);draft=StillMade.applyDocument(draft,edits);edited();await shared.flush();if(!access.canEdit||!scratchAccess.canEdit)throw Error('Editing access changed; the shared JSON draft is retained.');if(JSON.stringify(scratch)===JSON.stringify(pending)){scratch={...scratch,text:null,base:null};rawDirty=false;rawBase=null;rawStale=false;scratchShared.changed();await scratchShared.flush();}status.textContent='Complete Image Panels data applied to the shared draft.';}catch(error){status.textContent=error.message;}finally{busy=false;draw();}});\\n\\ndocument.getElementById('reset').addEventListener('click',()=>{if(!blocked()){draft=clone(source);edited();draw();status.textContent='Reset to the project Image Panels document is being shared.'}});\\nsave.addEventListener('click',async()=>{if(blocked()||rawDirty)return;busy=true;draw();status.textContent='Checking the complete Image Panels document…';try{await shared.flush();await scratchShared.flush();if(!access.canEdit||!scratchAccess.canEdit||access.error||scratchAccess.error||rawDirty)throw Error('Editing access changed. The draft was not run.');const started=revision;await StillMade.run({panels:clone(source),updatedPanels:clone(draft),commit:true});status.textContent=started===revision?'Image Panels changes are ready below. Review the before and after, then choose Apply.':'A reviewed result is ready below; newer shared edits were retained.';}catch(error){status.textContent=error.message||'Image Panels could not be prepared.';}finally{busy=false;draw();}});\\nStillMade.onInput(values=>{source=clone(values.panels||{schemaVersion:1,scenes:[],strip:[]});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);blueprint=clone(values.blueprint||{schemaVersion:1});let next=values.updatedPanels&&values.updatedPanels.strip?.length?clone(values.updatedPanels):source.strip?.length?clone(source):plan();connectedImage=values.generatedImage?clone(values.generatedImage):null;generatedImages=Array.isArray(values.generatedImages)?clone(values.generatedImages):[];if(generatedImages.length){const byPanel=new Map(generatedImages.map(image=>[image.panelId,image]));next.strip=next.strip.map(panel=>{const image=byPanel.get(panel.panelId);if(!image)return panel;const prior=Array.isArray(panel.imageVersions)?panel.imageVersions:[];return {...panel,image:image.url,imageAsset:clone(image),imageVersions:[...prior.filter(value=>value.versionId!==image.versionId),clone(image)].slice(-8),versions:[...(Array.isArray(panel.versions)?panel.versions:[]).filter(value=>value!==image.url),image.url].slice(-8)}})}if(!next.generationSettings)next.generationSettings={stylePrompt:text(blueprint.visualStyle)};const names=Array.isArray(blueprint.characters)?blueprint.characters.map(item=>text(item.name||item.title)).filter(Boolean):[];blueprintHints.textContent=names.length?'Blueprint cast: '+names.slice(0,12).join(', '):'Add cast names per panel; approved generation stays in connected generation Blocks.';if(!shared){shared=StillMade.connectDocument({key:'panelsDocument',source:next,collections:[{path:['strip'],key:'panelId',fallback:'atomic'}],read:()=>draft,replace:value=>{draft=value;revision+=1;if(rawDirty)rawStale=true;draw();}});scratchShared=StillMade.connectDocument({key:'panelsScratch',source:{text:null,base:null,stockQuery:''},read:()=>scratch,replace:value=>{scratch=value;rawDirty=scratch.text!==null;rawBase=scratch.base;rawStale=false;if(rawDirty&&rawIsOpen()&&raw.value!==scratch.text)raw.value=scratch.text;scheduleRawPreview();document.getElementById('stockQuery').value=scratch.stockQuery;drawRecovery();}});scratchShared.onStatus(value=>{const redraw=scratchAccess.canEdit!==value.canEdit||scratchAccess.error!==value.error;scratchAccess=value;if(redraw)draw();else drawRecovery();});shared.onStatus(value=>{const redraw=access.canEdit!==value.canEdit||access.error!==value.error;access=value;if(redraw)draw();else drawRecovery();});}else shared.replaceSource(next);revision+=1;draw();status.textContent=access.error||'Draft edits are shared live. Review changes applies them to the project; generated results stay in the shared results below.'});\\n\\nstylePrompt.addEventListener('input',()=>{if(blocked())return;if(!draft.generationSettings)draft.generationSettings={};draft.generationSettings.stylePrompt=stylePrompt.value;edited()});\\ndocument.getElementById('prepareBatch').addEventListener('click',()=>{if(blocked())return;const visualLook=text(draft.generationSettings&&draft.generationSettings.stylePrompt).trim();draft.generationQueue=draft.strip.map((panel,index)=>{const cast=Array.isArray(panel.cast)?panel.cast:[],image=panel.imageAsset||panel.asset||panel.selectedImage||(panel.image&&typeof panel.image==='object'?panel.image:null),generationText=[text(panel.changePrompt||panel.narration||'Panel '+String(index+1)).trim(),visualLook&&'Style: '+visualLook,cast.length&&'Cast: '+cast.join(', ')].filter(Boolean).join('. ');return {id:'queue-'+text(panel.panelId),panelId:panel.panelId,generationText,status:image&&image.assetId&&image.versionId?'complete':'ready'}});edited();draw();mediaAction('prepare')});\\ndocument.getElementById('generateBatch').addEventListener('click',()=>mediaAction('generate-batch'));\\nconst mediaAction=async(action,extra={})=>{if(blocked()||rawDirty)return;busy=true;draw();try{await shared.flush();await scratchShared.flush();if(!access.canEdit||!scratchAccess.canEdit||access.error||scratchAccess.error||rawDirty)throw Error('Editing access changed. The action was not run.');await StillMade.run({panels:clone(source),updatedPanels:clone(draft),commit:false,action,...extra});status.textContent='The approved action is ready below.'}catch(error){status.textContent=error.message||'The media action could not be prepared.'}finally{busy=false;draw()}};document.getElementById('stockSearch').addEventListener('click',()=>mediaAction('stock',{stockQuery:document.getElementById('stockQuery').value}));document.getElementById('qualityReview').addEventListener('click',()=>mediaAction('quality'));document.getElementById('renderFinal').addEventListener('click',()=>mediaAction('render'));\\n\"\n}"
|
|
1170
|
+
},
|
|
1171
|
+
"lineage": {
|
|
1172
|
+
"parents": [],
|
|
1173
|
+
"changes": "Packaged original Block source for StillMade."
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
};
|