stillmade-sdk 0.1.42 → 0.1.43

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.
Files changed (262) hide show
  1. package/.stillmade/sdk-baseline.json +6 -8
  2. package/AGENTS.md +15 -10
  3. package/FRAME_VIEWS.md +113 -0
  4. package/INTERFACE_DESIGN.md +62 -22
  5. package/MOBILE_UI.md +4 -2
  6. package/MODULES.md +152 -6
  7. package/PASTE_TO_LLM.md +35 -25
  8. package/README.md +3 -2
  9. package/SDK.md +994 -550
  10. package/UI_AESTHETIC.md +22 -2
  11. package/blocks/generate/package.js +1 -0
  12. package/blocks/generate/versions/1.0.0/package.js +463 -0
  13. package/docs/build/audio-to-editor.md +36 -0
  14. package/docs/build/block-builder-contract.md +150 -0
  15. package/docs/build/comfyui.md +227 -0
  16. package/docs/build/concepts.md +40 -0
  17. package/docs/build/context.md +159 -0
  18. package/docs/build/cookbook.md +57 -0
  19. package/docs/build/custom-interface.md +617 -0
  20. package/docs/build/data-types.md +83 -0
  21. package/docs/build/frame-views.md +259 -0
  22. package/docs/build/generate-media.md +59 -0
  23. package/docs/build/github-applications.md +314 -0
  24. package/docs/build/hosted-images.md +214 -0
  25. package/docs/build/hosted-music.md +39 -0
  26. package/docs/build/hosted-speech.md +157 -0
  27. package/docs/build/hosted-text.md +246 -0
  28. package/docs/build/image-description.md +49 -0
  29. package/docs/build/interface-design.md +343 -0
  30. package/docs/build/javascript.md +63 -0
  31. package/docs/build/local-preview.md +61 -0
  32. package/docs/build/media-analysis.md +27 -0
  33. package/docs/build/media.md +400 -0
  34. package/docs/build/mobile-ui.md +106 -0
  35. package/docs/build/modules.md +487 -0
  36. package/docs/build/original-blocks.md +70 -0
  37. package/docs/build/outside-apis.md +128 -0
  38. package/docs/build/production-context-templates.md +12 -0
  39. package/docs/build/project-storage.md +94 -0
  40. package/docs/build/quickstart.md +48 -0
  41. package/docs/build/recipes.md +103 -0
  42. package/docs/build/script-handoff.md +45 -0
  43. package/docs/build/script-writer.md +34 -0
  44. package/docs/build/state.md +223 -0
  45. package/docs/build/testing.md +112 -0
  46. package/docs/build/timeline-edits.md +116 -0
  47. package/docs/build/timeline-proposals.md +76 -0
  48. package/docs/build/transcription.md +59 -0
  49. package/docs/build/triggers.md +59 -0
  50. package/docs/build/tutorial.md +52 -0
  51. package/docs/build/typescript.md +34 -0
  52. package/docs/build/video-generation.md +61 -0
  53. package/docs/build/web-reading.md +37 -0
  54. package/docs/build/with-your-ai.md +27 -0
  55. package/docs/changelog.md +9 -0
  56. package/docs/creators.md +21 -0
  57. package/docs/distribute/discovery.md +43 -0
  58. package/docs/distribute/imports.md +58 -0
  59. package/docs/distribute/publishing.md +29 -0
  60. package/docs/distribute/sdk-versions.md +36 -0
  61. package/docs/distribute/selling.md +14 -0
  62. package/docs/distribute/teams.md +60 -0
  63. package/docs/distribute/versioning.md +28 -0
  64. package/docs/examples.md +23 -0
  65. package/docs/gallery.md +26 -0
  66. package/docs/index.md +50 -0
  67. package/docs/native-mcp.md +307 -0
  68. package/docs/project-types/automation.md +43 -0
  69. package/docs/project-types/batches.md +50 -0
  70. package/docs/project-types/build.md +42 -0
  71. package/docs/project-types/completion.md +15 -0
  72. package/docs/project-types/conditions.md +21 -0
  73. package/docs/project-types/hosted-review.md +115 -0
  74. package/docs/project-types/onboarding.md +75 -0
  75. package/docs/project-types/running.md +309 -0
  76. package/docs/project-types/testing.md +72 -0
  77. package/docs/reference/application-artifacts.md +87 -0
  78. package/docs/reference/authoring-guide.md +134 -0
  79. package/docs/reference/browser-applications.md +267 -0
  80. package/docs/reference/capabilities.md +45 -0
  81. package/docs/reference/cli.md +71 -0
  82. package/docs/reference/connection-api.md +59 -0
  83. package/docs/reference/cooperative-jobs.md +13 -0
  84. package/docs/reference/desktop-capabilities.md +172 -0
  85. package/docs/reference/desktop-execution.md +77 -0
  86. package/docs/reference/errors.md +233 -0
  87. package/docs/reference/execution.md +800 -0
  88. package/docs/reference/first-party-blocks.md +40 -0
  89. package/docs/reference/generation-models.md +59 -0
  90. package/docs/reference/limits.md +306 -0
  91. package/docs/reference/manifest-kinds-controls.md +36 -0
  92. package/docs/reference/manifest.md +181 -0
  93. package/docs/reference/operations.md +36 -0
  94. package/docs/reference/package-jobs.md +35 -0
  95. package/docs/reference/parity.md +55 -0
  96. package/docs/reference/permissions.md +86 -0
  97. package/docs/reference/ports.md +26 -0
  98. package/docs/reference/types.md +268 -0
  99. package/docs/reference/universal-resolver.md +303 -0
  100. package/docs/reference/view-bridge.md +60 -0
  101. package/docs/reference/view-rules.md +15 -0
  102. package/docs/reference/workspace-sync.md +25 -0
  103. package/docs/sdk.md +34 -0
  104. package/docs/tools/block-remix.md +211 -0
  105. package/docs/tools/llm.md +2213 -0
  106. package/docs/tools/repository-adaptation.md +613 -0
  107. package/examples/check-clip.stillmade.json +4 -1
  108. package/examples/generate-video.stillmade.json +6 -2
  109. package/examples/research-topic.stillmade.json +5 -1
  110. package/examples/text-workflow.stillmade.json +3 -32
  111. package/examples/timeline-polish.stillmade.json +11 -3
  112. package/examples/transcribe-audio.stillmade.json +11 -3
  113. package/package.json +1 -1
  114. package/packages/block-cli/cli.js +13 -6
  115. package/packages/block-cli/dev-host/assets/host.js +76 -38
  116. package/packages/block-cli/dev-host/assets/index.css +1 -1
  117. package/packages/block-cli/format.js +1 -1
  118. package/packages/block-cli/templates.js +31 -13
  119. package/packages/block-cli/type-packages.js +119 -0
  120. package/packages/block-platform/block-readiness.js +5 -0
  121. package/packages/block-platform/canvas.js +2 -1
  122. package/packages/block-platform/catalog.js +27 -48
  123. package/packages/block-platform/native-host-inventory.js +0 -226
  124. package/packages/block-platform/plain-descriptions.js +1 -25
  125. package/packages/block-platform/project-type-starters.js +13 -53
  126. package/packages/block-platform/script-handoff.js +2 -4
  127. package/packages/block-platform/type-workspace.js +2 -0
  128. package/packages/block-sdk/appearance.js +3 -1
  129. package/packages/block-sdk/block-tier.js +1 -1
  130. package/packages/block-sdk/builder-contract.js +10 -8
  131. package/packages/block-sdk/capabilities.js +1 -1
  132. package/packages/block-sdk/contracts.js +6 -2
  133. package/packages/block-sdk/first-party-identities.js +1 -84
  134. package/packages/block-sdk/first-party-packages.js +3 -85
  135. package/packages/block-sdk/generation-catalog.js +15 -3
  136. package/packages/block-sdk/index.d.ts +2 -1
  137. package/packages/block-sdk/media-analysis-example.js +1 -1
  138. package/packages/block-sdk/mock-host.js +7 -1
  139. package/packages/block-sdk/module-host-calls.js +35 -10
  140. package/packages/block-sdk/module-hosted.js +15 -2
  141. package/packages/block-sdk/module-media-access.js +71 -0
  142. package/packages/block-sdk/module-node.js +1 -1
  143. package/packages/block-sdk/portable-media-actions.js +1 -1
  144. package/packages/block-sdk/runtime.js +1 -1
  145. package/packages/block-sdk/timeline-proposal-example.js +1 -1
  146. package/packages/block-sdk/transcription-example.js +1 -1
  147. package/packages/block-sdk/video-generation-example.js +1 -1
  148. package/packages/block-sdk/view-bridge.js +4 -1
  149. package/packages/block-sdk/view-design.js +17 -14
  150. package/packages/block-sdk/web-example.js +1 -1
  151. package/packages/design-system/block-kit.css +48 -12
  152. package/packages/design-system/block-kit.html +3 -2
  153. package/blocks/mcp-motion-planner/versions/1.1.0/package.js +0 -97
  154. package/blocks/motion-designer/versions/1.0.1/package.js +0 -173318
  155. package/blocks/motion-designer/versions/1.0.2/package.js +0 -173318
  156. package/blocks/motion-frame-review/versions/1.1.1/package.js +0 -465
  157. package/blocks/motion-frame-review/versions/1.1.2/package.snapshot.js +0 -572
  158. package/blocks/narration/package.js +0 -1
  159. package/blocks/narration/versions/1.0.0/package.js +0 -221
  160. package/blocks/narration/versions/1.0.1/package.js +0 -221
  161. package/blocks/native/sm.animated-scene/versions/2.0.0/package.js +0 -475
  162. package/blocks/native/sm.animated-scene/versions/2.1.0/package.js +0 -498
  163. package/blocks/native/sm.animated-scene/versions/2.2.0/package.js +0 -524
  164. package/blocks/native/sm.animated-scene/versions/2.3.0/package.js +0 -618
  165. package/blocks/native/sm.animated-scene/versions/2.3.1/package.js +0 -618
  166. package/blocks/native/sm.animated-scene/versions/2.3.2/package.js +0 -723
  167. package/blocks/native/sm.animated-scene/versions/2.3.3/package.js +0 -723
  168. package/blocks/native/sm.animated-scene/versions/2.3.4/package.js +0 -676
  169. package/blocks/native/sm.animated-scene/versions/2.3.5/package.js +0 -693
  170. package/blocks/native/sm.animated-scene/versions/2.3.6/package.js +0 -700
  171. package/blocks/native/sm.animated-scene/versions/2.3.7/package.js +0 -747
  172. package/blocks/native/sm.animated-scene/versions/2.3.8/package.js +0 -769
  173. package/blocks/native/sm.animated-scene/versions/2.3.9/package.js +0 -769
  174. package/blocks/native/sm.animated-scene-assistant/versions/1.0.0/package.js +0 -183
  175. package/blocks/native/sm.blueprint/versions/2.0.0/package.js +0 -358
  176. package/blocks/native/sm.blueprint/versions/2.1.0/package.js +0 -358
  177. package/blocks/native/sm.blueprint/versions/2.1.1/package.js +0 -358
  178. package/blocks/native/sm.blueprint/versions/2.1.2/package.js +0 -358
  179. package/blocks/native/sm.blueprint/versions/2.1.3/package.js +0 -381
  180. package/blocks/native/sm.blueprint/versions/2.1.4/package.js +0 -381
  181. package/blocks/native/sm.blueprint/versions/2.1.5/package.js +0 -339
  182. package/blocks/native/sm.blueprint/versions/2.1.6/package.js +0 -356
  183. package/blocks/native/sm.blueprint/versions/2.1.7/package.js +0 -363
  184. package/blocks/native/sm.blueprint/versions/2.1.8/package.js +0 -410
  185. package/blocks/native/sm.blueprint/versions/2.1.9/package.js +0 -422
  186. package/blocks/native/sm.blueprint-assistant/versions/1.0.0/package.js +0 -172
  187. package/blocks/native/sm.chat/versions/2.0.0/package.js +0 -144
  188. package/blocks/native/sm.chat/versions/2.0.1/package.js +0 -97
  189. package/blocks/native/sm.chat/versions/2.0.2/package.js +0 -100
  190. package/blocks/native/sm.chat/versions/2.0.3/package.js +0 -100
  191. package/blocks/native/sm.continue-if/versions/1.0.0/package.js +0 -168
  192. package/blocks/native/sm.describe-media/versions/2.0.0/package.js +0 -153
  193. package/blocks/native/sm.describe-media/versions/2.0.1/package.js +0 -156
  194. package/blocks/native/sm.describe-media/versions/2.1.0/package.js +0 -140
  195. package/blocks/native/sm.image-editor/versions/2.0.0/package.js +0 -183
  196. package/blocks/native/sm.image-editor/versions/2.0.1/package.js +0 -190
  197. package/blocks/native/sm.new-items/versions/1.0.0/package.js +0 -191
  198. package/blocks/native/sm.pick-photos/versions/1.0.0/package.js +0 -334
  199. package/blocks/native/sm.quality-audit/versions/1.0.0/package.js +0 -192
  200. package/blocks/native/sm.quality-audit/versions/1.0.1/package.js +0 -192
  201. package/blocks/native/sm.quality-audit/versions/1.0.2/package.js +0 -195
  202. package/blocks/native/sm.research/versions/2.0.0/package.js +0 -175
  203. package/blocks/native/sm.research/versions/2.0.1/package.js +0 -184
  204. package/blocks/native/sm.research/versions/2.0.2/package.js +0 -187
  205. package/blocks/native/sm.script/versions/2.0.0/package.js +0 -144
  206. package/blocks/native/sm.script/versions/2.1.0/package.js +0 -144
  207. package/blocks/native/sm.script/versions/2.1.1/package.js +0 -144
  208. package/blocks/native/sm.script/versions/2.1.2/package.js +0 -105
  209. package/blocks/native/sm.script/versions/2.1.3/package.js +0 -152
  210. package/blocks/native/sm.script/versions/2.1.4/package.js +0 -156
  211. package/blocks/native/sm.script/versions/2.1.5/package.js +0 -156
  212. package/blocks/native/sm.shot-plan/versions/2.0.0/package.js +0 -301
  213. package/blocks/native/sm.shot-plan/versions/2.1.0/package.js +0 -528
  214. package/blocks/native/sm.shot-plan/versions/2.1.1/package.js +0 -528
  215. package/blocks/native/sm.shot-plan/versions/2.1.2/package.js +0 -528
  216. package/blocks/native/sm.shot-plan/versions/2.1.3/package.js +0 -536
  217. package/blocks/native/sm.shot-plan/versions/2.2.0/package.js +0 -800
  218. package/blocks/native/sm.shot-plan/versions/2.2.1/package.js +0 -920
  219. package/blocks/native/sm.shot-plan-assistant/versions/1.0.0/package.js +0 -173
  220. package/blocks/native/sm.stock-search/versions/2.0.0/package.js +0 -174
  221. package/blocks/native/sm.thumbnail/versions/2.0.0/package.js +0 -137
  222. package/blocks/native/sm.thumbnail/versions/2.0.1/package.js +0 -140
  223. package/blocks/native/sm.transcribe/versions/2.0.0/package.js +0 -163
  224. package/blocks/native/sm.transcribe/versions/2.0.1/package.js +0 -168
  225. package/blocks/native/sm.whiteboard-assistant/versions/1.0.0/package.js +0 -175
  226. package/blocks/native/sm.youtube/versions/2.0.0/package.js +0 -217
  227. package/blocks/occasion-story/package.js +0 -1
  228. package/blocks/occasion-story/versions/1.0.0/package.js +0 -1658
  229. package/blocks/occasion-story/versions/1.0.1/package.js +0 -1699
  230. package/blocks/occasion-story/versions/1.0.2/package.js +0 -1682
  231. package/blocks/photo-reel-composer/versions/1.0.0/package.js +0 -3043
  232. package/blocks/photo-reel-composer/versions/1.0.1/package.js +0 -3026
  233. package/blocks/photo-reel-composer/versions/1.0.2/package.js +0 -4149
  234. package/blocks/product-ad-variants/versions/1.0.0/package.js +0 -2911
  235. package/blocks/product-launch-director/versions/1.0.0/package.js +0 -103
  236. package/blocks/release-visuals/package.js +0 -1
  237. package/blocks/release-visuals/versions/1.0.0/package.js +0 -1492
  238. package/blocks/release-visuals/versions/1.0.1/package.js +0 -1517
  239. package/blocks/release-visuals/versions/1.0.2/package.js +0 -1500
  240. package/blocks/screen-recorder/package.js +0 -1
  241. package/blocks/screen-recorder/versions/1.0.0/package.js +0 -223
  242. package/blocks/screen-recorder/versions/1.0.1/package.js +0 -223
  243. package/blocks/short-form-finish/package.js +0 -1
  244. package/blocks/short-form-finish/versions/1.0.0/package.js +0 -1043
  245. package/blocks/short-form-finish/versions/1.0.1/package.js +0 -1043
  246. package/blocks/short-form-finish/versions/1.0.2/package.js +0 -1043
  247. package/blocks/short-form-finish/versions/1.0.3/package.js +0 -1026
  248. package/examples/saas-product-launch-reviewed-source.stillmade.json +0 -383
  249. package/examples/saas-product-launch.stillmade.json +0 -304
  250. package/packages/block-platform/dealer-inventory-video-project-type.js +0 -38
  251. package/packages/block-platform/first-revenue-project-types.js +0 -46
  252. package/packages/block-platform/fixture-starters.js +0 -13
  253. package/packages/block-platform/launch-project-source.js +0 -10
  254. package/packages/block-platform/launch-project.js +0 -30
  255. package/packages/block-platform/motion-project-types.js +0 -55
  256. package/packages/block-platform/motion-starters.js +0 -14
  257. package/packages/block-platform/product-ad-variants-project-type.js +0 -30
  258. package/packages/block-platform/product-launch-updated.js +0 -90
  259. package/packages/block-platform/revenue-review-project-types.js +0 -36
  260. package/packages/block-platform/revenue-review-starters.js +0 -13
  261. package/packages/block-platform/script-writer.js +0 -29
  262. package/packages/block-platform/website-source-block.js +0 -14
@@ -1,800 +0,0 @@
1
- // Generated immutable package data.
2
- export default {
3
- "manifest": {
4
- "schemaVersion": 1,
5
- "sdkVersion": "0.1.0",
6
- "id": "sm.shot-plan",
7
- "version": "2.2.0",
8
- "name": "Shots",
9
- "description": "Build a timed shot plan from narration, either connected from an earlier Step or saved in the project, then review and edit narration, visual direction, framing, duration, fulfillment, motion, statements, order, and retained custom fields.",
10
- "kind": "workspace",
11
- "runtime": "javascript",
12
- "entry": "src/run.js",
13
- "license": "MIT",
14
- "provenance": {
15
- "notice": "Original source (authorship declared by the packager)\nLicense: MIT\nChanges: Original implementation declared by the packager; no reused repository or dependency code.\nFiles: LICENSE, src/run.js, src/view.json\n\nMIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
16
- "portableSources": [
17
- {
18
- "kind": "original",
19
- "license": "MIT",
20
- "paths": [
21
- "LICENSE",
22
- "src/run.js",
23
- "src/view.json"
24
- ],
25
- "evidence": [
26
- "upstream/0/LICENSE",
27
- "upstream/0/src/run.js",
28
- "upstream/0/src/view.json"
29
- ],
30
- "changes": "Original implementation declared by the packager; no reused repository or dependency code."
31
- }
32
- ]
33
- },
34
- "inputs": {
35
- "shotPlan": {
36
- "type": "shot-plan",
37
- "context": "shotPlan",
38
- "primary": true,
39
- "required": false,
40
- "default": {
41
- "schemaVersion": 1,
42
- "shots": []
43
- },
44
- "description": "The complete current shot plan. Unknown fields and saved media identities are retained.",
45
- "semantic": "production_shot_plan"
46
- },
47
- "transcript": {
48
- "type": "transcript",
49
- "context": "transcript",
50
- "required": false,
51
- "default": {
52
- "schemaVersion": 1,
53
- "text": "",
54
- "words": []
55
- },
56
- "description": "Current narration words and timings used to build an initial plan when the project has no shots.",
57
- "semantic": "timed_transcript"
58
- },
59
- "script": {
60
- "type": "script",
61
- "context": "script",
62
- "required": false,
63
- "default": {
64
- "schemaVersion": 1,
65
- "text": ""
66
- },
67
- "description": "Current narration text used when word timings are unavailable.",
68
- "semantic": "narration_script"
69
- },
70
- "narrationScript": {
71
- "type": "script",
72
- "required": false,
73
- "description": "Narration script from an earlier Step, such as Script Writer or your own script Block. When it has text, it is used instead of the project's saved narration.",
74
- "semantic": "narration_script"
75
- },
76
- "narrationTiming": {
77
- "type": "transcript",
78
- "required": false,
79
- "description": "Timed narration words from an earlier Step. When connected and filled, its word timings shape the shots instead of the project's saved voiceover timing.",
80
- "semantic": "timed_transcript"
81
- },
82
- "updatedShotPlan": {
83
- "type": "shot-plan",
84
- "required": false,
85
- "default": {
86
- "schemaVersion": 1,
87
- "shots": []
88
- },
89
- "description": "The complete edited plan prepared in this workspace.",
90
- "semantic": "production_shot_plan"
91
- },
92
- "commit": {
93
- "type": "boolean",
94
- "default": false,
95
- "description": "Prepare the edited plan for StillMade review and Apply.",
96
- "semantic": "apply_changes",
97
- "required": false
98
- }
99
- },
100
- "outputs": {
101
- "shotPlan": {
102
- "type": "shot-plan",
103
- "primary": true,
104
- "role": "production_shot_plan",
105
- "description": "The complete edited shot plan for the next Step.",
106
- "semantic": "production_shot_plan"
107
- },
108
- "edit": {
109
- "type": "workspace-edit",
110
- "description": "An exact before/after Shots change reviewed before it updates the project.",
111
- "semantic": "workspace_edit"
112
- }
113
- },
114
- "permissions": {
115
- "project": [
116
- "context.shotPlan.read",
117
- "context.transcript.read",
118
- "context.script.read",
119
- "workspace.shotPlan.propose"
120
- ],
121
- "network": [],
122
- "filesystem": [],
123
- "secrets": []
124
- },
125
- "ui": [],
126
- "platforms": {
127
- "phone": {
128
- "supported": true
129
- },
130
- "browser": {
131
- "supported": true
132
- },
133
- "desktop": {
134
- "supported": true
135
- }
136
- }
137
- },
138
- "code": "const copy = value => JSON.parse(JSON.stringify(value));\nconst filled = value => typeof value==='string' ? !!value.trim() : !!(value && typeof value==='object' && (String(value.text || '').trim() || (Array.isArray(value.words) && value.words.length)));\n// Narration connected from an earlier Step is used first; the project's saved narration otherwise.\nconst wired = filled(input.narrationScript) || filled(input.narrationTiming);\nconst transcript = wired ? (filled(input.narrationTiming) ? input.narrationTiming : null) : input.transcript;\nconst script = wired ? (filled(input.narrationScript) ? input.narrationScript : null) : input.script;\nconst words = Array.isArray(transcript?.words) ? transcript.words : [];\nconst scriptText = String(transcript?.text || script?.text || (typeof script==='string'?script:'')).trim();\nconst timed = word => ({text:String(word?.text || word?.word || '').trim(),start:Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000,end:Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000});\nconst make = (text,start,end,index) => ({id:`shot-${index+1}-${Math.max(0,Math.round(start*1000))}`,voiceoverText:text,shotDescription:text?`Show a clear visual for: ${text}`:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\nconst fromWords = () => {const clean=words.map(timed).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start);const groups=[];let group=[];clean.forEach(word=>{group.push(word);const duration=word.end-group[0].start,punctuation=/[.!?]$/.test(word.text);if((punctuation&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[];}});if(group.length)groups.push(group);return groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group[group.length-1].end,index));};\nconst fromScript = () => {const parts=(scriptText.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return parts.map((text,index)=>{const duration=Math.max(2,Math.round(text.split(/\\s+/).length/2.5*10)/10),shot=make(text,cursor,cursor+duration,index);cursor+=duration;return shot;});};\nconst generated = () => ({schemaVersion:1,shots:words.length?fromWords():fromScript()});\nconst source = copy(input.shotPlan || {schemaVersion:1,shots:[]});\nconst fallback = !source.shots?.length ? generated() : source;\nconst candidate = input.commit ? copy(input.updatedShotPlan) : copy(fallback);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || !Array.isArray(candidate.shots)) throw new Error('Keep the complete version 1 shot plan.');\nif (candidate.shots.length > 2000 || !candidate.shots.every(shot => shot && !Array.isArray(shot) && typeof shot.id === 'string' && shot.id.length > 0 && shot.id.length <= 200) || new Set(candidate.shots.map(shot => shot.id)).size !== candidate.shots.length) throw new Error('Shots need up to 2,000 distinct retained IDs.');\nreturn {shotPlan:candidate,edit:{schemaVersion:1,title:`Update ${candidate.shots.length} planned shot${candidate.shots.length===1?'':'s'}`,field:'shotPlan',before:source,after:candidate}};\n",
139
- "view": {
140
- "html": "<main class=\"shots-workspace\">\n <header><div><small>Production workspace</small><h1>Shots</h1><p id=\"summary\">Loading the shot plan…</p></div><div class=\"actions\"><button id=\"build\" type=\"button\" class=\"secondary\">Build from narration</button><button id=\"reset\" type=\"button\" class=\"secondary\">Reset changes</button><button id=\"add\" type=\"button\" class=\"secondary\">Add shot</button><button id=\"save\" type=\"button\" data-stillmade-action=\"run\">Review changes</button></div></header>\n <output id=\"status\" role=\"status\" aria-live=\"polite\"></output>\n <nav aria-label=\"Shot pages\"><button id=\"previous\" type=\"button\">Previous</button><output id=\"page\"></output><button id=\"next\" type=\"button\">Next</button><button id=\"discard\" type=\"button\" disabled>Discard local draft and load shared</button></nav>\n <section id=\"shots\" class=\"shots\" aria-label=\"Planned shots\"></section>\n <details><summary>Complete shot-plan data</summary><p>Every field is retained. Use this editor for custom fields not shown on the cards.</p><label for=\"raw\">Complete shot-plan JSON</label><textarea id=\"raw\" class=\"raw\" spellcheck=\"false\"></textarea><button id=\"applyRaw\" type=\"button\" class=\"secondary\">Apply JSON to workspace</button></details>\n</main>\n",
141
- "css": ".shots-workspace{max-width:1100px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.card-head,.row,.order{display:flex;align-items:center;gap:10px;flex-wrap:wrap}header{justify-content:space-between;margin-bottom:14px}header h1{margin:2px 0}header p,header small,details p,output{color:var(--fg-muted)}\n.shots{display:grid;gap:12px}.card,details{padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.card-head{justify-content:space-between}.card h2{margin:0;font-size:18px}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}label{display:grid;gap:5px;margin:8px 0;font-size:13px;font-weight:600}input,textarea,select{width:100%;background:var(--bg)}textarea{min-height:82px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:340px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}.order button{min-width:44px}.empty{padding:28px;text-align:center;border:1px dashed var(--border-tok);border-radius:var(--r-3);color:var(--fg-muted)}\n@media(max-width:760px){.shots-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}.card,details{padding:12px}}\n",
142
- "javascript": "const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),build=document.getElementById('build');\nlet source={schemaVersion:1,shots:[]},draft={schemaVersion:1,shots:[]},transcript={schemaVersion:1,text:'',words:[]},script={schemaVersion:1,text:''},narrationScript=null,narrationTiming=null,busy=false,revision=0;\nlet shared={state:{},outputs:{},canEdit:false},canEdit=false,pending=0,failed=false,initialized=false,page=0,rawDirty=false,rawBase=null,queuedBase=null;\nconst identities=[];\nconst keyFor=id=>{let key=identities.indexOf(id);if(key<0){identities.push(id);key=identities.length-1;}return key;};\nconst clone=value=>JSON.parse(JSON.stringify(value));\nconst text=value=>value===undefined||value===null?'':String(value);\nconst wordStart=word=>Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000;\nconst wordEnd=word=>Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000;\nconst filled=value=>typeof value==='string'?!!value.trim():!!(value&&typeof value==='object'&&(text(value.text).trim()||(Array.isArray(value.words)&&value.words.length)));\n// Narration connected from an earlier Step is used first; the project's saved narration otherwise.\nconst heard=()=>filled(narrationScript)||filled(narrationTiming)?{transcript:filled(narrationTiming)?narrationTiming:{schemaVersion:1,text:'',words:[]},script:filled(narrationScript)?narrationScript:{schemaVersion:1,text:''}}:{transcript,script};\nconst make=(line,start,end,index)=>({id:'shot-'+String(index+1)+'-'+String(Math.max(0,Math.round(start*1000))),voiceoverText:line,shotDescription:line?'Show a clear visual for: '+line:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\nconst plan=()=>{const {transcript,script}=heard(),words=Array.isArray(transcript.words)?transcript.words.map(word=>({text:text(word?.text||word?.word).trim(),start:wordStart(word),end:wordEnd(word)})).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start):[];if(words.length){const groups=[];let group=[];words.forEach(word=>{group.push(word);const duration=word.end-group[0].start;if((/[.!?]$/.test(word.text)&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[]}});if(group.length)groups.push(group);return {schemaVersion:1,shots:groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group.at(-1).end,index))}}const narration=text(transcript.text||script.text||(typeof script==='string'?script:'')).trim(),parts=(narration.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return {schemaVersion:1,shots:parts.map((line,index)=>{const duration=Math.max(2,Math.round(line.split(/\\s+/).length/2.5*10)/10),shot=make(line,cursor,cursor+duration,index);cursor+=duration;return shot})}};\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},type==='textarea'?{tag:'textarea',id:'control-'+action,action,value:text(value),disabled:busy||!canEdit||failed,label}:{tag:'input',id:'control-'+action,type,action,value:Number.isFinite(value)?value:text(value),disabled:busy||!canEdit||failed,label}]});\nconst choice=(label,action,value,options)=>({tag:'label',children:[{tag:'span',text:label},{tag:'select',id:'control-'+action,action,value:text(value),disabled:busy||!canEdit||failed,label,children:options.map(option=>({tag:'option',text:option,value:option}))}]});\nconst shotCard=(shot,position)=>{const index=keyFor(shot.id);return {tag:'article',id:'shot-'+String(index),className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h2',text:'Shot '+String(position+1)+' · '+(text(shot.shotDescription)||text(shot.title)||shot.id)},{tag:'div',className:'order',children:[{tag:'button',action:'up:'+String(index),text:'↑',className:'secondary',disabled:busy||!canEdit||failed||position===0,label:'Move shot up'},{tag:'button',action:'down:'+String(index),text:'↓',className:'secondary',disabled:busy||!canEdit||failed||position===draft.shots.length-1,label:'Move shot down'},{tag:'button',action:'remove:'+String(index),text:'Remove',className:'danger',disabled:busy||!canEdit||failed}]}]},{tag:'div',className:'grid',children:[field('Narration','narration:'+String(index),shot.voiceoverText,'textarea',true),field('Visual direction','description:'+String(index),shot.shotDescription||shot.description,'textarea',true),choice('Framing','size:'+String(index),shot.shotSize||'Medium',['Wide','Medium','Close','Extreme Close']),choice('Purpose','type:'+String(index),shot.shotType||'Story',['Story','Coverage Wide','Coverage Medium','Cutaway','Insert','Movement','Transition']),field('Screen time (seconds)','duration:'+String(index),shot.estimatedScreenTime,'number'),choice('Fulfillment','fulfillment:'+String(index),shot.fulfillment||'video',['video','imageMotion']),choice('Motion','motion:'+String(index),shot.motionEffect||'Ken Burns',['Ken Burns','Pan Left','Pan Right','Push In','Pull Out','Tilt Up','Tilt Down','Drift','Locked Frame']),choice('Motion speed','speed:'+String(index),shot.motionSpeed||'Slow',['Slow','Medium','Fast']),{tag:'label',children:[{tag:'span',text:'Full-screen statement'},{tag:'input',type:'checkbox',action:'statement:'+String(index),checked:!!shot.statement,disabled:busy||!canEdit||failed,label:'Full-screen statement'}]},field('Statement reveal','reveal:'+String(index),shot.statementReveal||'words')]}]};};\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft={schemaVersion:1,shots:[]};if(!Array.isArray(draft.shots))draft.shots=[]};\nconst draw=()=>{\n ensure();page=Math.min(page,Math.max(0,Math.ceil(draft.shots.length/8)-1));\n StillMade.render('shots',draft.shots.length?draft.shots.slice(page*8,page*8+8).map((shot,index)=>shotCard(shot,page*8+index)):[{tag:'p',className:'empty',text:'No shots yet. Build from narration or add the first shot.'}]);\n if(!rawDirty)raw.value=JSON.stringify(draft,null,2);\n summary.textContent=String(draft.shots.length)+' planned shot'+(draft.shots.length===1?'':'s');\n save.disabled=busy||!canEdit||failed||pending>0||!!queuedBase;build.disabled=busy||!canEdit||failed||!(()=>{const {transcript,script}=heard();return transcript.words?.length||text(transcript.text||script.text||(typeof script==='string'?script:'')).trim();})();\n ['reset','add','applyRaw'].forEach(id=>{document.getElementById(id).disabled=busy||!canEdit||failed;});\n raw.disabled=busy||!canEdit;\n document.getElementById('previous').disabled=page===0;\n document.getElementById('next').disabled=(page+1)*8>=draft.shots.length;\n document.getElementById('page').textContent='Page '+String(page+1)+' of '+String(Math.max(1,Math.ceil(draft.shots.length/8)));\n document.getElementById('discard').disabled=pending>0||(!failed&&!rawDirty);\n};\nconst receive=value=>{\n shared=value;canEdit=value.canEdit;\n if(value.state.plan)initialized=true;\n if(!pending&&!queuedBase&&!failed&&value.state.plan)draft=clone(value.state.plan);\n draw();\n if(!busy&&!pending&&!failed&&value.outputs.edit)status.textContent='A shared shot-plan proposal is ready below. Review before applying.';\n};\nconst publishDraft=()=>{\n if(failed){queuedBase=null;draw();return;}\n const before=queuedBase;if(!before)return;queuedBase=null;\n revision+=1;const exists=initialized;initialized=true;pending+=1;draw();\n return StillMade.updateShared({plan:clone(draft)},{plan:exists?{exists:true,value:before}:{exists:false}},{merge:true}).catch(error=>{\n failed=true;status.textContent=error.message+' Your draft is retained. Copy it before loading the shared draft to resolve.';\n }).finally(()=>{pending-=1;if(!failed&&!pending&&!queuedBase)receive(StillMade.getShared());else draw();});\n};\nconst changed=before=>{\n if(!queuedBase)queuedBase=before;\n status.textContent='Sharing the draft. Review changes before applying to the project.';\n save.disabled=true;StillMade.scheduleSharedEdit('plan',publishDraft);\n};\nStillMade.onAction(event=>{if(busy||!canEdit||failed)return;ensure();const before=queuedBase||clone(draft),parts=event.action.split(':'),kind=parts[0],identity=identities.at(Number(parts[1])),index=draft.shots.findIndex(item=>item.id===identity),shot=draft.shots.find(item=>item.id===identity);if(!shot)return;if(kind==='remove'){draft.shots=draft.shots.filter((item,position)=>position!==index);changed(before);draw();return}if(kind==='up'||kind==='down'){const target=index+(kind==='up'?-1:1);if(target>=0&&target<draft.shots.length){draft.shots=draft.shots.map((item,position)=>position===index?draft.shots.find((candidate,candidatePosition)=>candidatePosition===target):position===target?shot:item);changed(before);draw()}return}if(!shot)return;if(kind==='narration')shot.voiceoverText=event.value;if(kind==='description')shot.shotDescription=event.value;if(kind==='size')shot.shotSize=event.value;if(kind==='type')shot.shotType=event.value;if(kind==='duration'){shot.estimatedScreenTime=Number(event.value);shot.generationLength=Math.min(15,Number(event.value)+2)}if(kind==='fulfillment'){shot.fulfillment=event.value;shot.fulfillmentSetBy='user'}if(kind==='motion')shot.motionEffect=event.value;if(kind==='speed')shot.motionSpeed=event.value;if(kind==='statement'){shot.statement=event.checked;shot.statementSetBy='user'}if(kind==='reveal')shot.statementReveal=event.value;changed(before)});\nbuild.addEventListener('click',()=>{if(busy||!canEdit||failed)return;const before=clone(draft);draft=plan();page=0;changed(before);});\ndocument.getElementById('add').addEventListener('click',()=>{\n if(busy||!canEdit||failed)return;const before=clone(draft);\n const id='portable-shot-'+String(Date.now())+'-'+Math.random().toString(36).slice(2);\n draft.shots=[...draft.shots,{id,voiceoverText:'',shotDescription:'',shotSize:'Medium',shotType:'Story',estimatedScreenTime:3,generationLength:5,fulfillment:'video'}];page=Math.floor((draft.shots.length-1)/8);changed(before);\n});\nraw.addEventListener('input',()=>{if(!rawDirty)rawBase=clone(draft);rawDirty=true;document.getElementById('discard').disabled=false;});\ndocument.getElementById('applyRaw').addEventListener('click',()=>{\n if(busy||!canEdit||failed)return;\n try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1||!Array.isArray(value.shots)||value.shots.length>2000||!value.shots.every(shot=>shot&&typeof shot.id==='string'&&shot.id.length>0)||new Set(value.shots.map(shot=>shot.id)).size!==value.shots.length)throw Error('Use a version 1 shot plan with at most 2,000 distinct shot IDs.');\n const before=rawBase||clone(draft);draft=clone(value);rawDirty=false;rawBase=null;changed(before);\n }catch(error){status.textContent=error.message;}\n});\ndocument.getElementById('reset').addEventListener('click',()=>{if(busy||!canEdit||failed)return;const before=clone(draft);draft=clone(source);rawDirty=false;rawBase=null;changed(before);});\ndocument.getElementById('discard').addEventListener('click',()=>{\n if(pending||queuedBase)return;failed=false;rawDirty=false;rawBase=null;shared=StillMade.getShared();initialized=!!shared.state.plan;draft=clone(shared.state.plan||source);draw();status.textContent='Loaded the shared draft. The discarded local draft is no longer in this interface.';\n});\ndocument.getElementById('previous').addEventListener('click',()=>{if(page>0){page-=1;draw();}});\ndocument.getElementById('next').addEventListener('click',()=>{if((page+1)*8<draft.shots.length){page+=1;draw();}});\nsave.addEventListener('click',async()=>{\n if(busy||!canEdit||failed||pending||queuedBase)return;const started=revision;busy=true;draw();status.textContent='Checking the complete shot plan…';\n try{await StillMade.run({shotPlan:source,transcript,script,updatedShotPlan:clone(draft),commit:true});if(started===revision)status.textContent='Shots are ready below. Review the before and after, then choose Apply.';}\n catch(error){status.textContent=error.message||'The shot plan could not be prepared.';}\n finally{busy=false;draw();}\n});\nStillMade.onShared(receive);\nStillMade.onInput(values=>{\n source=clone(values.shotPlan||{schemaVersion:1,shots:[]});transcript=clone(values.transcript||{schemaVersion:1,text:'',words:[]});script=clone(values.script||{schemaVersion:1,text:''});narrationScript=values.narrationScript===undefined?null:clone(values.narrationScript);narrationTiming=values.narrationTiming===undefined?null:clone(values.narrationTiming);\n if(!initialized&&!pending&&!queuedBase&&!failed)draft=source.shots?.length?clone(source):plan();\n revision+=1;receive(StillMade.getShared());\n});\n"
143
- },
144
- "tests": [
145
- {
146
- "name": "builds timed shots from narration when the project has no plan",
147
- "input": {
148
- "shotPlan": {
149
- "schemaVersion": 1,
150
- "shots": []
151
- },
152
- "transcript": {
153
- "schemaVersion": 1,
154
- "text": "Open with the city. Then show the product.",
155
- "words": [
156
- {
157
- "text": "Open",
158
- "start": 0,
159
- "end": 0.5
160
- },
161
- {
162
- "text": "with",
163
- "start": 0.5,
164
- "end": 1
165
- },
166
- {
167
- "text": "the",
168
- "start": 1,
169
- "end": 1.3
170
- },
171
- {
172
- "text": "city.",
173
- "start": 1.3,
174
- "end": 3
175
- },
176
- {
177
- "text": "Then",
178
- "start": 3,
179
- "end": 3.5
180
- },
181
- {
182
- "text": "show",
183
- "start": 3.5,
184
- "end": 4
185
- },
186
- {
187
- "text": "the",
188
- "start": 4,
189
- "end": 4.3
190
- },
191
- {
192
- "text": "product.",
193
- "start": 4.3,
194
- "end": 7
195
- }
196
- ]
197
- },
198
- "script": {
199
- "schemaVersion": 1,
200
- "text": "Open with the city. Then show the product."
201
- },
202
- "updatedShotPlan": {
203
- "schemaVersion": 1,
204
- "shots": []
205
- },
206
- "commit": false
207
- },
208
- "expected": {
209
- "shotPlan": {
210
- "schemaVersion": 1,
211
- "shots": [
212
- {
213
- "id": "shot-1-0",
214
- "voiceoverText": "Open with the city.",
215
- "shotDescription": "Show a clear visual for: Open with the city.",
216
- "startTime": 0,
217
- "endTime": 3,
218
- "estimatedScreenTime": 3,
219
- "generationLength": 5,
220
- "shotSize": "Wide",
221
- "shotType": "Story",
222
- "fulfillment": "video"
223
- },
224
- {
225
- "id": "shot-2-3000",
226
- "voiceoverText": "Then show the product.",
227
- "shotDescription": "Show a clear visual for: Then show the product.",
228
- "startTime": 3,
229
- "endTime": 7,
230
- "estimatedScreenTime": 4,
231
- "generationLength": 6,
232
- "shotSize": "Medium",
233
- "shotType": "Story",
234
- "fulfillment": "video"
235
- }
236
- ]
237
- },
238
- "edit": {
239
- "schemaVersion": 1,
240
- "title": "Update 2 planned shots",
241
- "field": "shotPlan",
242
- "before": {
243
- "schemaVersion": 1,
244
- "shots": []
245
- },
246
- "after": {
247
- "schemaVersion": 1,
248
- "shots": [
249
- {
250
- "id": "shot-1-0",
251
- "voiceoverText": "Open with the city.",
252
- "shotDescription": "Show a clear visual for: Open with the city.",
253
- "startTime": 0,
254
- "endTime": 3,
255
- "estimatedScreenTime": 3,
256
- "generationLength": 5,
257
- "shotSize": "Wide",
258
- "shotType": "Story",
259
- "fulfillment": "video"
260
- },
261
- {
262
- "id": "shot-2-3000",
263
- "voiceoverText": "Then show the product.",
264
- "shotDescription": "Show a clear visual for: Then show the product.",
265
- "startTime": 3,
266
- "endTime": 7,
267
- "estimatedScreenTime": 4,
268
- "generationLength": 6,
269
- "shotSize": "Medium",
270
- "shotType": "Story",
271
- "fulfillment": "video"
272
- }
273
- ]
274
- }
275
- }
276
- }
277
- },
278
- {
279
- "name": "commits the complete edited plan without losing media or custom data",
280
- "input": {
281
- "shotPlan": {
282
- "schemaVersion": 1,
283
- "shots": [
284
- {
285
- "id": "opening",
286
- "voiceoverText": "Keep narration",
287
- "selectedImage": {
288
- "assetId": "image-1",
289
- "versionId": "v1"
290
- },
291
- "custom": {
292
- "approved": true
293
- }
294
- }
295
- ]
296
- },
297
- "transcript": {
298
- "schemaVersion": 1,
299
- "text": "Keep narration",
300
- "words": []
301
- },
302
- "script": {
303
- "schemaVersion": 1,
304
- "text": "Keep narration"
305
- },
306
- "updatedShotPlan": {
307
- "schemaVersion": 1,
308
- "shots": [
309
- {
310
- "id": "opening",
311
- "voiceoverText": "Keep narration",
312
- "shotDescription": "A better opening",
313
- "selectedImage": {
314
- "assetId": "image-1",
315
- "versionId": "v2"
316
- },
317
- "custom": {
318
- "approved": true
319
- }
320
- }
321
- ]
322
- },
323
- "commit": true
324
- },
325
- "expected": {
326
- "shotPlan": {
327
- "schemaVersion": 1,
328
- "shots": [
329
- {
330
- "id": "opening",
331
- "voiceoverText": "Keep narration",
332
- "shotDescription": "A better opening",
333
- "selectedImage": {
334
- "assetId": "image-1",
335
- "versionId": "v2"
336
- },
337
- "custom": {
338
- "approved": true
339
- }
340
- }
341
- ]
342
- },
343
- "edit": {
344
- "schemaVersion": 1,
345
- "title": "Update 1 planned shot",
346
- "field": "shotPlan",
347
- "before": {
348
- "schemaVersion": 1,
349
- "shots": [
350
- {
351
- "id": "opening",
352
- "voiceoverText": "Keep narration",
353
- "selectedImage": {
354
- "assetId": "image-1",
355
- "versionId": "v1"
356
- },
357
- "custom": {
358
- "approved": true
359
- }
360
- }
361
- ]
362
- },
363
- "after": {
364
- "schemaVersion": 1,
365
- "shots": [
366
- {
367
- "id": "opening",
368
- "voiceoverText": "Keep narration",
369
- "shotDescription": "A better opening",
370
- "selectedImage": {
371
- "assetId": "image-1",
372
- "versionId": "v2"
373
- },
374
- "custom": {
375
- "approved": true
376
- }
377
- }
378
- ]
379
- }
380
- }
381
- }
382
- },
383
- {
384
- "name": "estimates timing from script sentences when word timings are unavailable",
385
- "input": {
386
- "shotPlan": {
387
- "schemaVersion": 1,
388
- "shots": []
389
- },
390
- "transcript": {
391
- "schemaVersion": 1,
392
- "text": "First beat. Second beat here!",
393
- "words": []
394
- },
395
- "script": {
396
- "schemaVersion": 1,
397
- "text": ""
398
- },
399
- "updatedShotPlan": {
400
- "schemaVersion": 1,
401
- "shots": []
402
- },
403
- "commit": false
404
- },
405
- "expected": {
406
- "shotPlan": {
407
- "schemaVersion": 1,
408
- "shots": [
409
- {
410
- "id": "shot-1-0",
411
- "voiceoverText": "First beat.",
412
- "shotDescription": "Show a clear visual for: First beat.",
413
- "startTime": 0,
414
- "endTime": 2,
415
- "estimatedScreenTime": 2,
416
- "generationLength": 4,
417
- "shotSize": "Wide",
418
- "shotType": "Story",
419
- "fulfillment": "video"
420
- },
421
- {
422
- "id": "shot-2-2000",
423
- "voiceoverText": "Second beat here!",
424
- "shotDescription": "Show a clear visual for: Second beat here!",
425
- "startTime": 2,
426
- "endTime": 4,
427
- "estimatedScreenTime": 2,
428
- "generationLength": 4,
429
- "shotSize": "Medium",
430
- "shotType": "Story",
431
- "fulfillment": "video"
432
- }
433
- ]
434
- },
435
- "edit": {
436
- "schemaVersion": 1,
437
- "title": "Update 2 planned shots",
438
- "field": "shotPlan",
439
- "before": {
440
- "schemaVersion": 1,
441
- "shots": []
442
- },
443
- "after": {
444
- "schemaVersion": 1,
445
- "shots": [
446
- {
447
- "id": "shot-1-0",
448
- "voiceoverText": "First beat.",
449
- "shotDescription": "Show a clear visual for: First beat.",
450
- "startTime": 0,
451
- "endTime": 2,
452
- "estimatedScreenTime": 2,
453
- "generationLength": 4,
454
- "shotSize": "Wide",
455
- "shotType": "Story",
456
- "fulfillment": "video"
457
- },
458
- {
459
- "id": "shot-2-2000",
460
- "voiceoverText": "Second beat here!",
461
- "shotDescription": "Show a clear visual for: Second beat here!",
462
- "startTime": 2,
463
- "endTime": 4,
464
- "estimatedScreenTime": 2,
465
- "generationLength": 4,
466
- "shotSize": "Medium",
467
- "shotType": "Story",
468
- "fulfillment": "video"
469
- }
470
- ]
471
- }
472
- }
473
- }
474
- },
475
- {
476
- "name": "keeps an empty project empty without treating document objects as narration",
477
- "input": {
478
- "shotPlan": {
479
- "schemaVersion": 1,
480
- "shots": []
481
- },
482
- "transcript": {
483
- "schemaVersion": 1,
484
- "text": "",
485
- "words": []
486
- },
487
- "script": {
488
- "schemaVersion": 1,
489
- "text": ""
490
- },
491
- "updatedShotPlan": {
492
- "schemaVersion": 1,
493
- "shots": []
494
- },
495
- "commit": false
496
- },
497
- "expected": {
498
- "shotPlan": {
499
- "schemaVersion": 1,
500
- "shots": []
501
- },
502
- "edit": {
503
- "schemaVersion": 1,
504
- "title": "Update 0 planned shots",
505
- "field": "shotPlan",
506
- "before": {
507
- "schemaVersion": 1,
508
- "shots": []
509
- },
510
- "after": {
511
- "schemaVersion": 1,
512
- "shots": []
513
- }
514
- }
515
- }
516
- },
517
- {
518
- "name": "uses connected narration before the project's saved narration",
519
- "input": {
520
- "shotPlan": {
521
- "schemaVersion": 1,
522
- "shots": []
523
- },
524
- "updatedShotPlan": {
525
- "schemaVersion": 1,
526
- "shots": []
527
- },
528
- "commit": false,
529
- "transcript": {
530
- "schemaVersion": 1,
531
- "text": "Saved project narration that is out of date.",
532
- "words": []
533
- },
534
- "script": {
535
- "schemaVersion": 1,
536
- "text": ""
537
- },
538
- "narrationScript": {
539
- "schemaVersion": 1,
540
- "text": "Open on the harbour. Close on the lighthouse!"
541
- }
542
- },
543
- "expected": {
544
- "shotPlan": {
545
- "schemaVersion": 1,
546
- "shots": [
547
- {
548
- "id": "shot-1-0",
549
- "voiceoverText": "Open on the harbour.",
550
- "shotDescription": "Show a clear visual for: Open on the harbour.",
551
- "startTime": 0,
552
- "endTime": 2,
553
- "estimatedScreenTime": 2,
554
- "generationLength": 4,
555
- "shotSize": "Wide",
556
- "shotType": "Story",
557
- "fulfillment": "video"
558
- },
559
- {
560
- "id": "shot-2-2000",
561
- "voiceoverText": "Close on the lighthouse!",
562
- "shotDescription": "Show a clear visual for: Close on the lighthouse!",
563
- "startTime": 2,
564
- "endTime": 4,
565
- "estimatedScreenTime": 2,
566
- "generationLength": 4,
567
- "shotSize": "Medium",
568
- "shotType": "Story",
569
- "fulfillment": "video"
570
- }
571
- ]
572
- },
573
- "edit": {
574
- "schemaVersion": 1,
575
- "title": "Update 2 planned shots",
576
- "field": "shotPlan",
577
- "before": {
578
- "schemaVersion": 1,
579
- "shots": []
580
- },
581
- "after": {
582
- "schemaVersion": 1,
583
- "shots": [
584
- {
585
- "id": "shot-1-0",
586
- "voiceoverText": "Open on the harbour.",
587
- "shotDescription": "Show a clear visual for: Open on the harbour.",
588
- "startTime": 0,
589
- "endTime": 2,
590
- "estimatedScreenTime": 2,
591
- "generationLength": 4,
592
- "shotSize": "Wide",
593
- "shotType": "Story",
594
- "fulfillment": "video"
595
- },
596
- {
597
- "id": "shot-2-2000",
598
- "voiceoverText": "Close on the lighthouse!",
599
- "shotDescription": "Show a clear visual for: Close on the lighthouse!",
600
- "startTime": 2,
601
- "endTime": 4,
602
- "estimatedScreenTime": 2,
603
- "generationLength": 4,
604
- "shotSize": "Medium",
605
- "shotType": "Story",
606
- "fulfillment": "video"
607
- }
608
- ]
609
- }
610
- }
611
- }
612
- },
613
- {
614
- "name": "uses connected word timings when an earlier Step supplies them",
615
- "input": {
616
- "shotPlan": {
617
- "schemaVersion": 1,
618
- "shots": []
619
- },
620
- "updatedShotPlan": {
621
- "schemaVersion": 1,
622
- "shots": []
623
- },
624
- "commit": false,
625
- "transcript": {
626
- "schemaVersion": 1,
627
- "text": "",
628
- "words": []
629
- },
630
- "script": {
631
- "schemaVersion": 1,
632
- "text": ""
633
- },
634
- "narrationTiming": {
635
- "schemaVersion": 1,
636
- "text": "Morning light.",
637
- "words": [
638
- {
639
- "text": "Morning",
640
- "start": 0.5,
641
- "end": 1.2
642
- },
643
- {
644
- "text": "light.",
645
- "start": 1.2,
646
- "end": 2
647
- }
648
- ]
649
- }
650
- },
651
- "expected": {
652
- "shotPlan": {
653
- "schemaVersion": 1,
654
- "shots": [
655
- {
656
- "id": "shot-1-500",
657
- "voiceoverText": "Morning light.",
658
- "shotDescription": "Show a clear visual for: Morning light.",
659
- "startTime": 0.5,
660
- "endTime": 2,
661
- "estimatedScreenTime": 1.5,
662
- "generationLength": 4,
663
- "shotSize": "Wide",
664
- "shotType": "Story",
665
- "fulfillment": "video"
666
- }
667
- ]
668
- },
669
- "edit": {
670
- "schemaVersion": 1,
671
- "title": "Update 1 planned shot",
672
- "field": "shotPlan",
673
- "before": {
674
- "schemaVersion": 1,
675
- "shots": []
676
- },
677
- "after": {
678
- "schemaVersion": 1,
679
- "shots": [
680
- {
681
- "id": "shot-1-500",
682
- "voiceoverText": "Morning light.",
683
- "shotDescription": "Show a clear visual for: Morning light.",
684
- "startTime": 0.5,
685
- "endTime": 2,
686
- "estimatedScreenTime": 1.5,
687
- "generationLength": 4,
688
- "shotSize": "Wide",
689
- "shotType": "Story",
690
- "fulfillment": "video"
691
- }
692
- ]
693
- }
694
- }
695
- }
696
- },
697
- {
698
- "name": "falls back to the project narration when the connected Step has no narration yet",
699
- "input": {
700
- "shotPlan": {
701
- "schemaVersion": 1,
702
- "shots": []
703
- },
704
- "updatedShotPlan": {
705
- "schemaVersion": 1,
706
- "shots": []
707
- },
708
- "commit": false,
709
- "transcript": {
710
- "schemaVersion": 1,
711
- "text": "",
712
- "words": []
713
- },
714
- "script": {
715
- "schemaVersion": 1,
716
- "text": "Saved script line."
717
- },
718
- "narrationScript": {
719
- "schemaVersion": 1,
720
- "text": " "
721
- }
722
- },
723
- "expected": {
724
- "shotPlan": {
725
- "schemaVersion": 1,
726
- "shots": [
727
- {
728
- "id": "shot-1-0",
729
- "voiceoverText": "Saved script line.",
730
- "shotDescription": "Show a clear visual for: Saved script line.",
731
- "startTime": 0,
732
- "endTime": 2,
733
- "estimatedScreenTime": 2,
734
- "generationLength": 4,
735
- "shotSize": "Wide",
736
- "shotType": "Story",
737
- "fulfillment": "video"
738
- }
739
- ]
740
- },
741
- "edit": {
742
- "schemaVersion": 1,
743
- "title": "Update 1 planned shot",
744
- "field": "shotPlan",
745
- "before": {
746
- "schemaVersion": 1,
747
- "shots": []
748
- },
749
- "after": {
750
- "schemaVersion": 1,
751
- "shots": [
752
- {
753
- "id": "shot-1-0",
754
- "voiceoverText": "Saved script line.",
755
- "shotDescription": "Show a clear visual for: Saved script line.",
756
- "startTime": 0,
757
- "endTime": 2,
758
- "estimatedScreenTime": 2,
759
- "generationLength": 4,
760
- "shotSize": "Wide",
761
- "shotType": "Story",
762
- "fulfillment": "video"
763
- }
764
- ]
765
- }
766
- }
767
- }
768
- }
769
- ],
770
- "portable": {
771
- "format": "stillmade-block/1",
772
- "dependencies": [],
773
- "sources": [
774
- {
775
- "kind": "original",
776
- "license": "MIT",
777
- "paths": [
778
- "LICENSE",
779
- "src/run.js",
780
- "src/view.json"
781
- ],
782
- "evidence": [
783
- "upstream/0/LICENSE",
784
- "upstream/0/src/run.js",
785
- "upstream/0/src/view.json"
786
- ],
787
- "changes": "Original implementation declared by the packager; no reused repository or dependency code."
788
- }
789
- ],
790
- "files": {
791
- "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",
792
- "upstream/0/src/run.js": "const copy = value => JSON.parse(JSON.stringify(value));\nconst filled = value => typeof value==='string' ? !!value.trim() : !!(value && typeof value==='object' && (String(value.text || '').trim() || (Array.isArray(value.words) && value.words.length)));\n// Narration connected from an earlier Step is used first; the project's saved narration otherwise.\nconst wired = filled(input.narrationScript) || filled(input.narrationTiming);\nconst transcript = wired ? (filled(input.narrationTiming) ? input.narrationTiming : null) : input.transcript;\nconst script = wired ? (filled(input.narrationScript) ? input.narrationScript : null) : input.script;\nconst words = Array.isArray(transcript?.words) ? transcript.words : [];\nconst scriptText = String(transcript?.text || script?.text || (typeof script==='string'?script:'')).trim();\nconst timed = word => ({text:String(word?.text || word?.word || '').trim(),start:Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000,end:Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000});\nconst make = (text,start,end,index) => ({id:`shot-${index+1}-${Math.max(0,Math.round(start*1000))}`,voiceoverText:text,shotDescription:text?`Show a clear visual for: ${text}`:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\nconst fromWords = () => {const clean=words.map(timed).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start);const groups=[];let group=[];clean.forEach(word=>{group.push(word);const duration=word.end-group[0].start,punctuation=/[.!?]$/.test(word.text);if((punctuation&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[];}});if(group.length)groups.push(group);return groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group[group.length-1].end,index));};\nconst fromScript = () => {const parts=(scriptText.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return parts.map((text,index)=>{const duration=Math.max(2,Math.round(text.split(/\\s+/).length/2.5*10)/10),shot=make(text,cursor,cursor+duration,index);cursor+=duration;return shot;});};\nconst generated = () => ({schemaVersion:1,shots:words.length?fromWords():fromScript()});\nconst source = copy(input.shotPlan || {schemaVersion:1,shots:[]});\nconst fallback = !source.shots?.length ? generated() : source;\nconst candidate = input.commit ? copy(input.updatedShotPlan) : copy(fallback);\nif (!candidate || Array.isArray(candidate) || candidate.schemaVersion !== 1 || !Array.isArray(candidate.shots)) throw new Error('Keep the complete version 1 shot plan.');\nif (candidate.shots.length > 2000 || !candidate.shots.every(shot => shot && !Array.isArray(shot) && typeof shot.id === 'string' && shot.id.length > 0 && shot.id.length <= 200) || new Set(candidate.shots.map(shot => shot.id)).size !== candidate.shots.length) throw new Error('Shots need up to 2,000 distinct retained IDs.');\nreturn {shotPlan:candidate,edit:{schemaVersion:1,title:`Update ${candidate.shots.length} planned shot${candidate.shots.length===1?'':'s'}`,field:'shotPlan',before:source,after:candidate}};\n",
793
- "upstream/0/src/view.json": "{\n \"html\": \"<main class=\\\"shots-workspace\\\">\\n <header><div><small>Production workspace</small><h1>Shots</h1><p id=\\\"summary\\\">Loading the shot plan…</p></div><div class=\\\"actions\\\"><button id=\\\"build\\\" type=\\\"button\\\" class=\\\"secondary\\\">Build from narration</button><button id=\\\"reset\\\" type=\\\"button\\\" class=\\\"secondary\\\">Reset changes</button><button id=\\\"add\\\" type=\\\"button\\\" class=\\\"secondary\\\">Add shot</button><button id=\\\"save\\\" type=\\\"button\\\" data-stillmade-action=\\\"run\\\">Review changes</button></div></header>\\n <output id=\\\"status\\\" role=\\\"status\\\" aria-live=\\\"polite\\\"></output>\\n <nav aria-label=\\\"Shot pages\\\"><button id=\\\"previous\\\" type=\\\"button\\\">Previous</button><output id=\\\"page\\\"></output><button id=\\\"next\\\" type=\\\"button\\\">Next</button><button id=\\\"discard\\\" type=\\\"button\\\" disabled>Discard local draft and load shared</button></nav>\\n <section id=\\\"shots\\\" class=\\\"shots\\\" aria-label=\\\"Planned shots\\\"></section>\\n <details><summary>Complete shot-plan data</summary><p>Every field is retained. Use this editor for custom fields not shown on the cards.</p><label for=\\\"raw\\\">Complete shot-plan JSON</label><textarea id=\\\"raw\\\" class=\\\"raw\\\" spellcheck=\\\"false\\\"></textarea><button id=\\\"applyRaw\\\" type=\\\"button\\\" class=\\\"secondary\\\">Apply JSON to workspace</button></details>\\n</main>\\n\",\n \"css\": \".shots-workspace{max-width:1100px;margin:0 auto;padding:8px;color:var(--fg)}header,.actions,.card-head,.row,.order{display:flex;align-items:center;gap:10px;flex-wrap:wrap}header{justify-content:space-between;margin-bottom:14px}header h1{margin:2px 0}header p,header small,details p,output{color:var(--fg-muted)}\\n.shots{display:grid;gap:12px}.card,details{padding:16px;border:1px solid var(--border-tok);border-radius:var(--r-3);background:var(--bg-elev-1)}.card-head{justify-content:space-between}.card h2{margin:0;font-size:18px}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}label{display:grid;gap:5px;margin:8px 0;font-size:13px;font-weight:600}input,textarea,select{width:100%;background:var(--bg)}textarea{min-height:82px;resize:vertical}.wide{grid-column:1/-1}.secondary{background:transparent;color:var(--fg)}.danger{background:transparent;color:var(--signal)}.raw{min-height:340px;font-family:var(--font-mono);font-size:12px}output{display:block;min-height:24px;margin:8px 2px}.order button{min-width:44px}.empty{padding:28px;text-align:center;border:1px dashed var(--border-tok);border-radius:var(--r-3);color:var(--fg-muted)}\\n@media(max-width:760px){.shots-workspace{padding:0}.grid{grid-template-columns:1fr}.actions{width:100%}.actions button{flex:1}.card,details{padding:12px}}\\n\",\n \"javascript\": \"const status=document.getElementById('status'),summary=document.getElementById('summary'),raw=document.getElementById('raw'),save=document.getElementById('save'),build=document.getElementById('build');\\nlet source={schemaVersion:1,shots:[]},draft={schemaVersion:1,shots:[]},transcript={schemaVersion:1,text:'',words:[]},script={schemaVersion:1,text:''},narrationScript=null,narrationTiming=null,busy=false,revision=0;\\nlet shared={state:{},outputs:{},canEdit:false},canEdit=false,pending=0,failed=false,initialized=false,page=0,rawDirty=false,rawBase=null,queuedBase=null;\\nconst identities=[];\\nconst keyFor=id=>{let key=identities.indexOf(id);if(key<0){identities.push(id);key=identities.length-1;}return key;};\\nconst clone=value=>JSON.parse(JSON.stringify(value));\\nconst text=value=>value===undefined||value===null?'':String(value);\\nconst wordStart=word=>Number.isFinite(Number(word?.start))?Number(word.start):Number(word?.startMs)/1000;\\nconst wordEnd=word=>Number.isFinite(Number(word?.end))?Number(word.end):Number(word?.endMs)/1000;\\nconst filled=value=>typeof value==='string'?!!value.trim():!!(value&&typeof value==='object'&&(text(value.text).trim()||(Array.isArray(value.words)&&value.words.length)));\\n// Narration connected from an earlier Step is used first; the project's saved narration otherwise.\\nconst heard=()=>filled(narrationScript)||filled(narrationTiming)?{transcript:filled(narrationTiming)?narrationTiming:{schemaVersion:1,text:'',words:[]},script:filled(narrationScript)?narrationScript:{schemaVersion:1,text:''}}:{transcript,script};\\nconst make=(line,start,end,index)=>({id:'shot-'+String(index+1)+'-'+String(Math.max(0,Math.round(start*1000))),voiceoverText:line,shotDescription:line?'Show a clear visual for: '+line:'',startTime:start,endTime:end,estimatedScreenTime:Math.max(1,Math.round((end-start)*10)/10),generationLength:Math.min(15,Math.max(3,Math.ceil(end-start)+2)),shotSize:index%3===0?'Wide':index%3===1?'Medium':'Close',shotType:'Story',fulfillment:'video'});\\nconst plan=()=>{const {transcript,script}=heard(),words=Array.isArray(transcript.words)?transcript.words.map(word=>({text:text(word?.text||word?.word).trim(),start:wordStart(word),end:wordEnd(word)})).filter(word=>word.text&&Number.isFinite(word.start)&&Number.isFinite(word.end)&&word.end>=word.start):[];if(words.length){const groups=[];let group=[];words.forEach(word=>{group.push(word);const duration=word.end-group[0].start;if((/[.!?]$/.test(word.text)&&duration>=2.5)||duration>=6||group.length>=18){groups.push(group);group=[]}});if(group.length)groups.push(group);return {schemaVersion:1,shots:groups.map((group,index)=>make(group.map(word=>word.text).join(' '),group[0].start,group.at(-1).end,index))}}const narration=text(transcript.text||script.text||(typeof script==='string'?script:'')).trim(),parts=(narration.match(/[^.!?]+[.!?]?/g)||[]).map(value=>value.trim()).filter(Boolean);let cursor=0;return {schemaVersion:1,shots:parts.map((line,index)=>{const duration=Math.max(2,Math.round(line.split(/\\\\s+/).length/2.5*10)/10),shot=make(line,cursor,cursor+duration,index);cursor+=duration;return shot})}};\\nconst field=(label,action,value,type='text',wide=false)=>({tag:'label',className:wide?'wide':'',children:[{tag:'span',text:label},type==='textarea'?{tag:'textarea',id:'control-'+action,action,value:text(value),disabled:busy||!canEdit||failed,label}:{tag:'input',id:'control-'+action,type,action,value:Number.isFinite(value)?value:text(value),disabled:busy||!canEdit||failed,label}]});\\nconst choice=(label,action,value,options)=>({tag:'label',children:[{tag:'span',text:label},{tag:'select',id:'control-'+action,action,value:text(value),disabled:busy||!canEdit||failed,label,children:options.map(option=>({tag:'option',text:option,value:option}))}]});\\nconst shotCard=(shot,position)=>{const index=keyFor(shot.id);return {tag:'article',id:'shot-'+String(index),className:'card',children:[{tag:'div',className:'card-head',children:[{tag:'h2',text:'Shot '+String(position+1)+' · '+(text(shot.shotDescription)||text(shot.title)||shot.id)},{tag:'div',className:'order',children:[{tag:'button',action:'up:'+String(index),text:'↑',className:'secondary',disabled:busy||!canEdit||failed||position===0,label:'Move shot up'},{tag:'button',action:'down:'+String(index),text:'↓',className:'secondary',disabled:busy||!canEdit||failed||position===draft.shots.length-1,label:'Move shot down'},{tag:'button',action:'remove:'+String(index),text:'Remove',className:'danger',disabled:busy||!canEdit||failed}]}]},{tag:'div',className:'grid',children:[field('Narration','narration:'+String(index),shot.voiceoverText,'textarea',true),field('Visual direction','description:'+String(index),shot.shotDescription||shot.description,'textarea',true),choice('Framing','size:'+String(index),shot.shotSize||'Medium',['Wide','Medium','Close','Extreme Close']),choice('Purpose','type:'+String(index),shot.shotType||'Story',['Story','Coverage Wide','Coverage Medium','Cutaway','Insert','Movement','Transition']),field('Screen time (seconds)','duration:'+String(index),shot.estimatedScreenTime,'number'),choice('Fulfillment','fulfillment:'+String(index),shot.fulfillment||'video',['video','imageMotion']),choice('Motion','motion:'+String(index),shot.motionEffect||'Ken Burns',['Ken Burns','Pan Left','Pan Right','Push In','Pull Out','Tilt Up','Tilt Down','Drift','Locked Frame']),choice('Motion speed','speed:'+String(index),shot.motionSpeed||'Slow',['Slow','Medium','Fast']),{tag:'label',children:[{tag:'span',text:'Full-screen statement'},{tag:'input',type:'checkbox',action:'statement:'+String(index),checked:!!shot.statement,disabled:busy||!canEdit||failed,label:'Full-screen statement'}]},field('Statement reveal','reveal:'+String(index),shot.statementReveal||'words')]}]};};\\nconst ensure=()=>{if(!draft||Array.isArray(draft)||draft.schemaVersion!==1)draft={schemaVersion:1,shots:[]};if(!Array.isArray(draft.shots))draft.shots=[]};\\nconst draw=()=>{\\n ensure();page=Math.min(page,Math.max(0,Math.ceil(draft.shots.length/8)-1));\\n StillMade.render('shots',draft.shots.length?draft.shots.slice(page*8,page*8+8).map((shot,index)=>shotCard(shot,page*8+index)):[{tag:'p',className:'empty',text:'No shots yet. Build from narration or add the first shot.'}]);\\n if(!rawDirty)raw.value=JSON.stringify(draft,null,2);\\n summary.textContent=String(draft.shots.length)+' planned shot'+(draft.shots.length===1?'':'s');\\n save.disabled=busy||!canEdit||failed||pending>0||!!queuedBase;build.disabled=busy||!canEdit||failed||!(()=>{const {transcript,script}=heard();return transcript.words?.length||text(transcript.text||script.text||(typeof script==='string'?script:'')).trim();})();\\n ['reset','add','applyRaw'].forEach(id=>{document.getElementById(id).disabled=busy||!canEdit||failed;});\\n raw.disabled=busy||!canEdit;\\n document.getElementById('previous').disabled=page===0;\\n document.getElementById('next').disabled=(page+1)*8>=draft.shots.length;\\n document.getElementById('page').textContent='Page '+String(page+1)+' of '+String(Math.max(1,Math.ceil(draft.shots.length/8)));\\n document.getElementById('discard').disabled=pending>0||(!failed&&!rawDirty);\\n};\\nconst receive=value=>{\\n shared=value;canEdit=value.canEdit;\\n if(value.state.plan)initialized=true;\\n if(!pending&&!queuedBase&&!failed&&value.state.plan)draft=clone(value.state.plan);\\n draw();\\n if(!busy&&!pending&&!failed&&value.outputs.edit)status.textContent='A shared shot-plan proposal is ready below. Review before applying.';\\n};\\nconst publishDraft=()=>{\\n if(failed){queuedBase=null;draw();return;}\\n const before=queuedBase;if(!before)return;queuedBase=null;\\n revision+=1;const exists=initialized;initialized=true;pending+=1;draw();\\n return StillMade.updateShared({plan:clone(draft)},{plan:exists?{exists:true,value:before}:{exists:false}},{merge:true}).catch(error=>{\\n failed=true;status.textContent=error.message+' Your draft is retained. Copy it before loading the shared draft to resolve.';\\n }).finally(()=>{pending-=1;if(!failed&&!pending&&!queuedBase)receive(StillMade.getShared());else draw();});\\n};\\nconst changed=before=>{\\n if(!queuedBase)queuedBase=before;\\n status.textContent='Sharing the draft. Review changes before applying to the project.';\\n save.disabled=true;StillMade.scheduleSharedEdit('plan',publishDraft);\\n};\\nStillMade.onAction(event=>{if(busy||!canEdit||failed)return;ensure();const before=queuedBase||clone(draft),parts=event.action.split(':'),kind=parts[0],identity=identities.at(Number(parts[1])),index=draft.shots.findIndex(item=>item.id===identity),shot=draft.shots.find(item=>item.id===identity);if(!shot)return;if(kind==='remove'){draft.shots=draft.shots.filter((item,position)=>position!==index);changed(before);draw();return}if(kind==='up'||kind==='down'){const target=index+(kind==='up'?-1:1);if(target>=0&&target<draft.shots.length){draft.shots=draft.shots.map((item,position)=>position===index?draft.shots.find((candidate,candidatePosition)=>candidatePosition===target):position===target?shot:item);changed(before);draw()}return}if(!shot)return;if(kind==='narration')shot.voiceoverText=event.value;if(kind==='description')shot.shotDescription=event.value;if(kind==='size')shot.shotSize=event.value;if(kind==='type')shot.shotType=event.value;if(kind==='duration'){shot.estimatedScreenTime=Number(event.value);shot.generationLength=Math.min(15,Number(event.value)+2)}if(kind==='fulfillment'){shot.fulfillment=event.value;shot.fulfillmentSetBy='user'}if(kind==='motion')shot.motionEffect=event.value;if(kind==='speed')shot.motionSpeed=event.value;if(kind==='statement'){shot.statement=event.checked;shot.statementSetBy='user'}if(kind==='reveal')shot.statementReveal=event.value;changed(before)});\\nbuild.addEventListener('click',()=>{if(busy||!canEdit||failed)return;const before=clone(draft);draft=plan();page=0;changed(before);});\\ndocument.getElementById('add').addEventListener('click',()=>{\\n if(busy||!canEdit||failed)return;const before=clone(draft);\\n const id='portable-shot-'+String(Date.now())+'-'+Math.random().toString(36).slice(2);\\n draft.shots=[...draft.shots,{id,voiceoverText:'',shotDescription:'',shotSize:'Medium',shotType:'Story',estimatedScreenTime:3,generationLength:5,fulfillment:'video'}];page=Math.floor((draft.shots.length-1)/8);changed(before);\\n});\\nraw.addEventListener('input',()=>{if(!rawDirty)rawBase=clone(draft);rawDirty=true;document.getElementById('discard').disabled=false;});\\ndocument.getElementById('applyRaw').addEventListener('click',()=>{\\n if(busy||!canEdit||failed)return;\\n try{const value=JSON.parse(raw.value);if(!value||Array.isArray(value)||value.schemaVersion!==1||!Array.isArray(value.shots)||value.shots.length>2000||!value.shots.every(shot=>shot&&typeof shot.id==='string'&&shot.id.length>0)||new Set(value.shots.map(shot=>shot.id)).size!==value.shots.length)throw Error('Use a version 1 shot plan with at most 2,000 distinct shot IDs.');\\n const before=rawBase||clone(draft);draft=clone(value);rawDirty=false;rawBase=null;changed(before);\\n }catch(error){status.textContent=error.message;}\\n});\\ndocument.getElementById('reset').addEventListener('click',()=>{if(busy||!canEdit||failed)return;const before=clone(draft);draft=clone(source);rawDirty=false;rawBase=null;changed(before);});\\ndocument.getElementById('discard').addEventListener('click',()=>{\\n if(pending||queuedBase)return;failed=false;rawDirty=false;rawBase=null;shared=StillMade.getShared();initialized=!!shared.state.plan;draft=clone(shared.state.plan||source);draw();status.textContent='Loaded the shared draft. The discarded local draft is no longer in this interface.';\\n});\\ndocument.getElementById('previous').addEventListener('click',()=>{if(page>0){page-=1;draw();}});\\ndocument.getElementById('next').addEventListener('click',()=>{if((page+1)*8<draft.shots.length){page+=1;draw();}});\\nsave.addEventListener('click',async()=>{\\n if(busy||!canEdit||failed||pending||queuedBase)return;const started=revision;busy=true;draw();status.textContent='Checking the complete shot plan…';\\n try{await StillMade.run({shotPlan:source,transcript,script,updatedShotPlan:clone(draft),commit:true});if(started===revision)status.textContent='Shots are ready below. Review the before and after, then choose Apply.';}\\n catch(error){status.textContent=error.message||'The shot plan could not be prepared.';}\\n finally{busy=false;draw();}\\n});\\nStillMade.onShared(receive);\\nStillMade.onInput(values=>{\\n source=clone(values.shotPlan||{schemaVersion:1,shots:[]});transcript=clone(values.transcript||{schemaVersion:1,text:'',words:[]});script=clone(values.script||{schemaVersion:1,text:''});narrationScript=values.narrationScript===undefined?null:clone(values.narrationScript);narrationTiming=values.narrationTiming===undefined?null:clone(values.narrationTiming);\\n if(!initialized&&!pending&&!queuedBase&&!failed)draft=source.shots?.length?clone(source):plan();\\n revision+=1;receive(StillMade.getShared());\\n});\\n\"\n}"
794
- },
795
- "lineage": {
796
- "parents": [],
797
- "changes": "Packaged original Block source for StillMade."
798
- }
799
- }
800
- };