@nodetool-ai/timeline 0.8.1

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 (505) hide show
  1. package/README.md +55 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/animation/bakedAnimation.d.ts +84 -0
  4. package/dist/animation/bakedAnimation.d.ts.map +1 -0
  5. package/dist/animation/bakedAnimation.js +95 -0
  6. package/dist/animation/bakedAnimation.js.map +1 -0
  7. package/dist/animation/beat.d.ts +7 -0
  8. package/dist/animation/beat.d.ts.map +1 -0
  9. package/dist/animation/beat.js +36 -0
  10. package/dist/animation/beat.js.map +1 -0
  11. package/dist/animation/compile.d.ts +184 -0
  12. package/dist/animation/compile.d.ts.map +1 -0
  13. package/dist/animation/compile.js +312 -0
  14. package/dist/animation/compile.js.map +1 -0
  15. package/dist/animation/custom.d.ts +183 -0
  16. package/dist/animation/custom.d.ts.map +1 -0
  17. package/dist/animation/custom.js +583 -0
  18. package/dist/animation/custom.js.map +1 -0
  19. package/dist/animation/easing.d.ts +34 -0
  20. package/dist/animation/easing.d.ts.map +1 -0
  21. package/dist/animation/easing.js +332 -0
  22. package/dist/animation/easing.js.map +1 -0
  23. package/dist/animation/index.d.ts +20 -0
  24. package/dist/animation/index.d.ts.map +1 -0
  25. package/dist/animation/index.js +20 -0
  26. package/dist/animation/index.js.map +1 -0
  27. package/dist/animation/links.d.ts +33 -0
  28. package/dist/animation/links.d.ts.map +1 -0
  29. package/dist/animation/links.js +126 -0
  30. package/dist/animation/links.js.map +1 -0
  31. package/dist/animation/presets.d.ts +86 -0
  32. package/dist/animation/presets.d.ts.map +1 -0
  33. package/dist/animation/presets.js +642 -0
  34. package/dist/animation/presets.js.map +1 -0
  35. package/dist/animation/sample.d.ts +145 -0
  36. package/dist/animation/sample.d.ts.map +1 -0
  37. package/dist/animation/sample.js +390 -0
  38. package/dist/animation/sample.js.map +1 -0
  39. package/dist/animation/simplify.d.ts +70 -0
  40. package/dist/animation/simplify.d.ts.map +1 -0
  41. package/dist/animation/simplify.js +278 -0
  42. package/dist/animation/simplify.js.map +1 -0
  43. package/dist/animation/sourceCurves.d.ts +45 -0
  44. package/dist/animation/sourceCurves.d.ts.map +1 -0
  45. package/dist/animation/sourceCurves.js +168 -0
  46. package/dist/animation/sourceCurves.js.map +1 -0
  47. package/dist/animation/styleTracks.d.ts +23 -0
  48. package/dist/animation/styleTracks.d.ts.map +1 -0
  49. package/dist/animation/styleTracks.js +341 -0
  50. package/dist/animation/styleTracks.js.map +1 -0
  51. package/dist/animation/types.d.ts +269 -0
  52. package/dist/animation/types.d.ts.map +1 -0
  53. package/dist/animation/types.js +173 -0
  54. package/dist/animation/types.js.map +1 -0
  55. package/dist/animation/typewriter.d.ts +8 -0
  56. package/dist/animation/typewriter.d.ts.map +1 -0
  57. package/dist/animation/typewriter.js +32 -0
  58. package/dist/animation/typewriter.js.map +1 -0
  59. package/dist/audioFade.d.ts +73 -0
  60. package/dist/audioFade.d.ts.map +1 -0
  61. package/dist/audioFade.js +134 -0
  62. package/dist/audioFade.js.map +1 -0
  63. package/dist/authoredStyles.d.ts +61 -0
  64. package/dist/authoredStyles.d.ts.map +1 -0
  65. package/dist/authoredStyles.js +90 -0
  66. package/dist/authoredStyles.js.map +1 -0
  67. package/dist/authoring.d.ts +50 -0
  68. package/dist/authoring.d.ts.map +1 -0
  69. package/dist/authoring.js +207 -0
  70. package/dist/authoring.js.map +1 -0
  71. package/dist/beats.d.ts +103 -0
  72. package/dist/beats.d.ts.map +1 -0
  73. package/dist/beats.js +228 -0
  74. package/dist/beats.js.map +1 -0
  75. package/dist/clone.d.ts +32 -0
  76. package/dist/clone.d.ts.map +1 -0
  77. package/dist/clone.js +53 -0
  78. package/dist/clone.js.map +1 -0
  79. package/dist/composition.d.ts +87 -0
  80. package/dist/composition.d.ts.map +1 -0
  81. package/dist/composition.js +253 -0
  82. package/dist/composition.js.map +1 -0
  83. package/dist/crop.d.ts +48 -0
  84. package/dist/crop.d.ts.map +1 -0
  85. package/dist/crop.js +75 -0
  86. package/dist/crop.js.map +1 -0
  87. package/dist/defaults.d.ts +142 -0
  88. package/dist/defaults.d.ts.map +1 -0
  89. package/dist/defaults.js +335 -0
  90. package/dist/defaults.js.map +1 -0
  91. package/dist/dependencyHash.d.ts +14 -0
  92. package/dist/dependencyHash.d.ts.map +1 -0
  93. package/dist/dependencyHash.js +19 -0
  94. package/dist/dependencyHash.js.map +1 -0
  95. package/dist/dropResolve.d.ts +40 -0
  96. package/dist/dropResolve.d.ts.map +1 -0
  97. package/dist/dropResolve.js +137 -0
  98. package/dist/dropResolve.js.map +1 -0
  99. package/dist/examples/node.d.ts +11 -0
  100. package/dist/examples/node.d.ts.map +1 -0
  101. package/dist/examples/node.js +87 -0
  102. package/dist/examples/node.js.map +1 -0
  103. package/dist/extension.d.ts +52 -0
  104. package/dist/extension.d.ts.map +1 -0
  105. package/dist/extension.js +269 -0
  106. package/dist/extension.js.map +1 -0
  107. package/dist/extensionRequest.d.ts +40 -0
  108. package/dist/extensionRequest.d.ts.map +1 -0
  109. package/dist/extensionRequest.js +135 -0
  110. package/dist/extensionRequest.js.map +1 -0
  111. package/dist/fill-text.d.ts +30 -0
  112. package/dist/fill-text.d.ts.map +1 -0
  113. package/dist/fill-text.js +73 -0
  114. package/dist/fill-text.js.map +1 -0
  115. package/dist/fonts/catalog.d.ts +97 -0
  116. package/dist/fonts/catalog.d.ts.map +1 -0
  117. package/dist/fonts/catalog.js +276 -0
  118. package/dist/fonts/catalog.js.map +1 -0
  119. package/dist/fonts/css.d.ts +24 -0
  120. package/dist/fonts/css.d.ts.map +1 -0
  121. package/dist/fonts/css.js +50 -0
  122. package/dist/fonts/css.js.map +1 -0
  123. package/dist/fonts/index.d.ts +10 -0
  124. package/dist/fonts/index.d.ts.map +1 -0
  125. package/dist/fonts/index.js +10 -0
  126. package/dist/fonts/index.js.map +1 -0
  127. package/dist/fonts/register-node.d.ts +45 -0
  128. package/dist/fonts/register-node.d.ts.map +1 -0
  129. package/dist/fonts/register-node.js +71 -0
  130. package/dist/fonts/register-node.js.map +1 -0
  131. package/dist/generatedMatte.d.ts +86 -0
  132. package/dist/generatedMatte.d.ts.map +1 -0
  133. package/dist/generatedMatte.js +152 -0
  134. package/dist/generatedMatte.js.map +1 -0
  135. package/dist/generative.d.ts +145 -0
  136. package/dist/generative.d.ts.map +1 -0
  137. package/dist/generative.js +396 -0
  138. package/dist/generative.js.map +1 -0
  139. package/dist/group.d.ts +47 -0
  140. package/dist/group.d.ts.map +1 -0
  141. package/dist/group.js +131 -0
  142. package/dist/group.js.map +1 -0
  143. package/dist/index.d.ts +55 -0
  144. package/dist/index.d.ts.map +1 -0
  145. package/dist/index.js +58 -0
  146. package/dist/index.js.map +1 -0
  147. package/dist/interchange.d.ts +47 -0
  148. package/dist/interchange.d.ts.map +1 -0
  149. package/dist/interchange.js +158 -0
  150. package/dist/interchange.js.map +1 -0
  151. package/dist/keyframes.d.ts +44 -0
  152. package/dist/keyframes.d.ts.map +1 -0
  153. package/dist/keyframes.js +148 -0
  154. package/dist/keyframes.js.map +1 -0
  155. package/dist/lineDelivery.d.ts +108 -0
  156. package/dist/lineDelivery.d.ts.map +1 -0
  157. package/dist/lineDelivery.js +154 -0
  158. package/dist/lineDelivery.js.map +1 -0
  159. package/dist/linked.d.ts +41 -0
  160. package/dist/linked.d.ts.map +1 -0
  161. package/dist/linked.js +166 -0
  162. package/dist/linked.js.map +1 -0
  163. package/dist/lipSyncRequest.d.ts +65 -0
  164. package/dist/lipSyncRequest.d.ts.map +1 -0
  165. package/dist/lipSyncRequest.js +73 -0
  166. package/dist/lipSyncRequest.js.map +1 -0
  167. package/dist/measureClipDurations.d.ts +7 -0
  168. package/dist/measureClipDurations.d.ts.map +1 -0
  169. package/dist/measureClipDurations.js +17 -0
  170. package/dist/measureClipDurations.js.map +1 -0
  171. package/dist/mediaTrack.d.ts +120 -0
  172. package/dist/mediaTrack.d.ts.map +1 -0
  173. package/dist/mediaTrack.js +269 -0
  174. package/dist/mediaTrack.js.map +1 -0
  175. package/dist/midi/cacheKey.d.ts +25 -0
  176. package/dist/midi/cacheKey.d.ts.map +1 -0
  177. package/dist/midi/cacheKey.js +54 -0
  178. package/dist/midi/cacheKey.js.map +1 -0
  179. package/dist/midi/edit.d.ts +48 -0
  180. package/dist/midi/edit.d.ts.map +1 -0
  181. package/dist/midi/edit.js +93 -0
  182. package/dist/midi/edit.js.map +1 -0
  183. package/dist/midi/engines/bl1.d.ts +29 -0
  184. package/dist/midi/engines/bl1.d.ts.map +1 -0
  185. package/dist/midi/engines/bl1.js +128 -0
  186. package/dist/midi/engines/bl1.js.map +1 -0
  187. package/dist/midi/engines/dr1.d.ts +28 -0
  188. package/dist/midi/engines/dr1.d.ts.map +1 -0
  189. package/dist/midi/engines/dr1.js +101 -0
  190. package/dist/midi/engines/dr1.js.map +1 -0
  191. package/dist/midi/engines/dsp.d.ts +126 -0
  192. package/dist/midi/engines/dsp.d.ts.map +1 -0
  193. package/dist/midi/engines/dsp.js +371 -0
  194. package/dist/midi/engines/dsp.js.map +1 -0
  195. package/dist/midi/engines/index.d.ts +13 -0
  196. package/dist/midi/engines/index.d.ts.map +1 -0
  197. package/dist/midi/engines/index.js +13 -0
  198. package/dist/midi/engines/index.js.map +1 -0
  199. package/dist/midi/engines/kits.d.ts +12 -0
  200. package/dist/midi/engines/kits.d.ts.map +1 -0
  201. package/dist/midi/engines/kits.js +121 -0
  202. package/dist/midi/engines/kits.js.map +1 -0
  203. package/dist/midi/engines/wavetables.d.ts +45 -0
  204. package/dist/midi/engines/wavetables.d.ts.map +1 -0
  205. package/dist/midi/engines/wavetables.js +334 -0
  206. package/dist/midi/engines/wavetables.js.map +1 -0
  207. package/dist/midi/engines/wt1.d.ts +30 -0
  208. package/dist/midi/engines/wt1.d.ts.map +1 -0
  209. package/dist/midi/engines/wt1.js +91 -0
  210. package/dist/midi/engines/wt1.js.map +1 -0
  211. package/dist/midi/grid.d.ts +51 -0
  212. package/dist/midi/grid.d.ts.map +1 -0
  213. package/dist/midi/grid.js +104 -0
  214. package/dist/midi/grid.js.map +1 -0
  215. package/dist/midi/index.d.ts +20 -0
  216. package/dist/midi/index.d.ts.map +1 -0
  217. package/dist/midi/index.js +20 -0
  218. package/dist/midi/index.js.map +1 -0
  219. package/dist/midi/instrument.d.ts +32 -0
  220. package/dist/midi/instrument.d.ts.map +1 -0
  221. package/dist/midi/instrument.js +73 -0
  222. package/dist/midi/instrument.js.map +1 -0
  223. package/dist/midi/notes.d.ts +46 -0
  224. package/dist/midi/notes.d.ts.map +1 -0
  225. package/dist/midi/notes.js +121 -0
  226. package/dist/midi/notes.js.map +1 -0
  227. package/dist/midi/notesEdit.d.ts +94 -0
  228. package/dist/midi/notesEdit.d.ts.map +1 -0
  229. package/dist/midi/notesEdit.js +159 -0
  230. package/dist/midi/notesEdit.js.map +1 -0
  231. package/dist/midi/presets.d.ts +29 -0
  232. package/dist/midi/presets.d.ts.map +1 -0
  233. package/dist/midi/presets.js +281 -0
  234. package/dist/midi/presets.js.map +1 -0
  235. package/dist/midi/tempo.d.ts +27 -0
  236. package/dist/midi/tempo.d.ts.map +1 -0
  237. package/dist/midi/tempo.js +57 -0
  238. package/dist/midi/tempo.js.map +1 -0
  239. package/dist/midi/ticks.d.ts +25 -0
  240. package/dist/midi/ticks.d.ts.map +1 -0
  241. package/dist/midi/ticks.js +35 -0
  242. package/dist/midi/ticks.js.map +1 -0
  243. package/dist/midi/voice.d.ts +148 -0
  244. package/dist/midi/voice.d.ts.map +1 -0
  245. package/dist/midi/voice.js +348 -0
  246. package/dist/midi/voice.js.map +1 -0
  247. package/dist/midi/wav.d.ts +14 -0
  248. package/dist/midi/wav.d.ts.map +1 -0
  249. package/dist/midi/wav.js +51 -0
  250. package/dist/midi/wav.js.map +1 -0
  251. package/dist/model3d.d.ts +41 -0
  252. package/dist/model3d.d.ts.map +1 -0
  253. package/dist/model3d.js +39 -0
  254. package/dist/model3d.js.map +1 -0
  255. package/dist/model3dBake.d.ts +80 -0
  256. package/dist/model3dBake.d.ts.map +1 -0
  257. package/dist/model3dBake.js +127 -0
  258. package/dist/model3dBake.js.map +1 -0
  259. package/dist/ops/apply.d.ts +32 -0
  260. package/dist/ops/apply.d.ts.map +1 -0
  261. package/dist/ops/apply.js +1595 -0
  262. package/dist/ops/apply.js.map +1 -0
  263. package/dist/ops/index.d.ts +13 -0
  264. package/dist/ops/index.d.ts.map +1 -0
  265. package/dist/ops/index.js +13 -0
  266. package/dist/ops/index.js.map +1 -0
  267. package/dist/ops/op.d.ts +407 -0
  268. package/dist/ops/op.d.ts.map +1 -0
  269. package/dist/ops/op.js +61 -0
  270. package/dist/ops/op.js.map +1 -0
  271. package/dist/ops/serialize.d.ts +77 -0
  272. package/dist/ops/serialize.d.ts.map +1 -0
  273. package/dist/ops/serialize.js +81 -0
  274. package/dist/ops/serialize.js.map +1 -0
  275. package/dist/ops/types.d.ts +150 -0
  276. package/dist/ops/types.d.ts.map +1 -0
  277. package/dist/ops/types.js +12 -0
  278. package/dist/ops/types.js.map +1 -0
  279. package/dist/pathSampling.d.ts +51 -0
  280. package/dist/pathSampling.d.ts.map +1 -0
  281. package/dist/pathSampling.js +111 -0
  282. package/dist/pathSampling.js.map +1 -0
  283. package/dist/placement/index.d.ts +2 -0
  284. package/dist/placement/index.d.ts.map +1 -0
  285. package/dist/placement/index.js +2 -0
  286. package/dist/placement/index.js.map +1 -0
  287. package/dist/placement/resolveTrackPlacement.d.ts +40 -0
  288. package/dist/placement/resolveTrackPlacement.d.ts.map +1 -0
  289. package/dist/placement/resolveTrackPlacement.js +71 -0
  290. package/dist/placement/resolveTrackPlacement.js.map +1 -0
  291. package/dist/production.d.ts +99 -0
  292. package/dist/production.d.ts.map +1 -0
  293. package/dist/production.js +328 -0
  294. package/dist/production.js.map +1 -0
  295. package/dist/reassemble.d.ts +68 -0
  296. package/dist/reassemble.d.ts.map +1 -0
  297. package/dist/reassemble.js +187 -0
  298. package/dist/reassemble.js.map +1 -0
  299. package/dist/recipe.d.ts +24 -0
  300. package/dist/recipe.d.ts.map +1 -0
  301. package/dist/recipe.js +89 -0
  302. package/dist/recipe.js.map +1 -0
  303. package/dist/recordedVoiceReplacement.d.ts +70 -0
  304. package/dist/recordedVoiceReplacement.d.ts.map +1 -0
  305. package/dist/recordedVoiceReplacement.js +82 -0
  306. package/dist/recordedVoiceReplacement.js.map +1 -0
  307. package/dist/reframe.d.ts +31 -0
  308. package/dist/reframe.d.ts.map +1 -0
  309. package/dist/reframe.js +227 -0
  310. package/dist/reframe.js.map +1 -0
  311. package/dist/render/canvas2d.d.ts +419 -0
  312. package/dist/render/canvas2d.d.ts.map +1 -0
  313. package/dist/render/canvas2d.js +1392 -0
  314. package/dist/render/canvas2d.js.map +1 -0
  315. package/dist/render/color.d.ts +26 -0
  316. package/dist/render/color.d.ts.map +1 -0
  317. package/dist/render/color.js +305 -0
  318. package/dist/render/color.js.map +1 -0
  319. package/dist/render/cpuLegacyEffects.d.ts +17 -0
  320. package/dist/render/cpuLegacyEffects.d.ts.map +1 -0
  321. package/dist/render/cpuLegacyEffects.js +347 -0
  322. package/dist/render/cpuLegacyEffects.js.map +1 -0
  323. package/dist/render/cpuVisualEffects.d.ts +13 -0
  324. package/dist/render/cpuVisualEffects.d.ts.map +1 -0
  325. package/dist/render/cpuVisualEffects.js +388 -0
  326. package/dist/render/cpuVisualEffects.js.map +1 -0
  327. package/dist/render/cubeLut.d.ts +12 -0
  328. package/dist/render/cubeLut.d.ts.map +1 -0
  329. package/dist/render/cubeLut.js +81 -0
  330. package/dist/render/cubeLut.js.map +1 -0
  331. package/dist/render/curveFitting.d.ts +28 -0
  332. package/dist/render/curveFitting.d.ts.map +1 -0
  333. package/dist/render/curveFitting.js +94 -0
  334. package/dist/render/curveFitting.js.map +1 -0
  335. package/dist/render/draw.d.ts +265 -0
  336. package/dist/render/draw.d.ts.map +1 -0
  337. package/dist/render/draw.js +929 -0
  338. package/dist/render/draw.js.map +1 -0
  339. package/dist/render/effects.d.ts +120 -0
  340. package/dist/render/effects.d.ts.map +1 -0
  341. package/dist/render/effects.js +804 -0
  342. package/dist/render/effects.js.map +1 -0
  343. package/dist/render/frameCompositor.d.ts +502 -0
  344. package/dist/render/frameCompositor.d.ts.map +1 -0
  345. package/dist/render/frameCompositor.js +1331 -0
  346. package/dist/render/frameCompositor.js.map +1 -0
  347. package/dist/render/index.d.ts +27 -0
  348. package/dist/render/index.d.ts.map +1 -0
  349. package/dist/render/index.js +27 -0
  350. package/dist/render/index.js.map +1 -0
  351. package/dist/render/layout.d.ts +17 -0
  352. package/dist/render/layout.d.ts.map +1 -0
  353. package/dist/render/layout.js +197 -0
  354. package/dist/render/layout.js.map +1 -0
  355. package/dist/render/model3dBakeSamples.d.ts +45 -0
  356. package/dist/render/model3dBakeSamples.d.ts.map +1 -0
  357. package/dist/render/model3dBakeSamples.js +68 -0
  358. package/dist/render/model3dBakeSamples.js.map +1 -0
  359. package/dist/render/motionBlur.d.ts +170 -0
  360. package/dist/render/motionBlur.d.ts.map +1 -0
  361. package/dist/render/motionBlur.js +193 -0
  362. package/dist/render/motionBlur.js.map +1 -0
  363. package/dist/render/sceneModel.d.ts +577 -0
  364. package/dist/render/sceneModel.d.ts.map +1 -0
  365. package/dist/render/sceneModel.js +1460 -0
  366. package/dist/render/sceneModel.js.map +1 -0
  367. package/dist/render/shapeGeometry.d.ts +81 -0
  368. package/dist/render/shapeGeometry.d.ts.map +1 -0
  369. package/dist/render/shapeGeometry.js +460 -0
  370. package/dist/render/shapeGeometry.js.map +1 -0
  371. package/dist/render/spatial.d.ts +9 -0
  372. package/dist/render/spatial.d.ts.map +1 -0
  373. package/dist/render/spatial.js +58 -0
  374. package/dist/render/spatial.js.map +1 -0
  375. package/dist/render/svgPath.d.ts +80 -0
  376. package/dist/render/svgPath.d.ts.map +1 -0
  377. package/dist/render/svgPath.js +199 -0
  378. package/dist/render/svgPath.js.map +1 -0
  379. package/dist/render/temporal.d.ts +6 -0
  380. package/dist/render/temporal.d.ts.map +1 -0
  381. package/dist/render/temporal.js +74 -0
  382. package/dist/render/temporal.js.map +1 -0
  383. package/dist/render/textLayout.d.ts +159 -0
  384. package/dist/render/textLayout.d.ts.map +1 -0
  385. package/dist/render/textLayout.js +301 -0
  386. package/dist/render/textLayout.js.map +1 -0
  387. package/dist/render/trackEffects.d.ts +23 -0
  388. package/dist/render/trackEffects.d.ts.map +1 -0
  389. package/dist/render/trackEffects.js +93 -0
  390. package/dist/render/trackEffects.js.map +1 -0
  391. package/dist/render/transform.d.ts +54 -0
  392. package/dist/render/transform.d.ts.map +1 -0
  393. package/dist/render/transform.js +222 -0
  394. package/dist/render/transform.js.map +1 -0
  395. package/dist/render/transition.d.ts +109 -0
  396. package/dist/render/transition.d.ts.map +1 -0
  397. package/dist/render/transition.js +351 -0
  398. package/dist/render/transition.js.map +1 -0
  399. package/dist/retarget.d.ts +73 -0
  400. package/dist/retarget.d.ts.map +1 -0
  401. package/dist/retarget.js +305 -0
  402. package/dist/retarget.js.map +1 -0
  403. package/dist/rippleEdit.d.ts +83 -0
  404. package/dist/rippleEdit.d.ts.map +1 -0
  405. package/dist/rippleEdit.js +184 -0
  406. package/dist/rippleEdit.js.map +1 -0
  407. package/dist/scene.d.ts +28 -0
  408. package/dist/scene.d.ts.map +1 -0
  409. package/dist/scene.js +28 -0
  410. package/dist/scene.js.map +1 -0
  411. package/dist/script-link.d.ts +52 -0
  412. package/dist/script-link.d.ts.map +1 -0
  413. package/dist/script-link.js +78 -0
  414. package/dist/script-link.js.map +1 -0
  415. package/dist/script.d.ts +52 -0
  416. package/dist/script.d.ts.map +1 -0
  417. package/dist/script.js +93 -0
  418. package/dist/script.js.map +1 -0
  419. package/dist/snap.d.ts +2 -0
  420. package/dist/snap.d.ts.map +1 -0
  421. package/dist/snap.js +21 -0
  422. package/dist/snap.js.map +1 -0
  423. package/dist/snapping/buildSnapPoints.d.ts +16 -0
  424. package/dist/snapping/buildSnapPoints.d.ts.map +1 -0
  425. package/dist/snapping/buildSnapPoints.js +39 -0
  426. package/dist/snapping/buildSnapPoints.js.map +1 -0
  427. package/dist/snapping/index.d.ts +3 -0
  428. package/dist/snapping/index.d.ts.map +1 -0
  429. package/dist/snapping/index.js +3 -0
  430. package/dist/snapping/index.js.map +1 -0
  431. package/dist/snapping/resolveSnap.d.ts +19 -0
  432. package/dist/snapping/resolveSnap.d.ts.map +1 -0
  433. package/dist/snapping/resolveSnap.js +39 -0
  434. package/dist/snapping/resolveSnap.js.map +1 -0
  435. package/dist/sourceRate.d.ts +12 -0
  436. package/dist/sourceRate.d.ts.map +1 -0
  437. package/dist/sourceRate.js +13 -0
  438. package/dist/sourceRate.js.map +1 -0
  439. package/dist/spatialVideoRequest.d.ts +91 -0
  440. package/dist/spatialVideoRequest.d.ts.map +1 -0
  441. package/dist/spatialVideoRequest.js +175 -0
  442. package/dist/spatialVideoRequest.js.map +1 -0
  443. package/dist/splitClip.d.ts +3 -0
  444. package/dist/splitClip.d.ts.map +1 -0
  445. package/dist/splitClip.js +190 -0
  446. package/dist/splitClip.js.map +1 -0
  447. package/dist/stableSerialize.d.ts +11 -0
  448. package/dist/stableSerialize.d.ts.map +1 -0
  449. package/dist/stableSerialize.js +31 -0
  450. package/dist/stableSerialize.js.map +1 -0
  451. package/dist/staleSet.d.ts +41 -0
  452. package/dist/staleSet.d.ts.map +1 -0
  453. package/dist/staleSet.js +106 -0
  454. package/dist/staleSet.js.map +1 -0
  455. package/dist/storyboard.d.ts +221 -0
  456. package/dist/storyboard.d.ts.map +1 -0
  457. package/dist/storyboard.js +417 -0
  458. package/dist/storyboard.js.map +1 -0
  459. package/dist/subtitles.d.ts +61 -0
  460. package/dist/subtitles.d.ts.map +1 -0
  461. package/dist/subtitles.js +92 -0
  462. package/dist/subtitles.js.map +1 -0
  463. package/dist/takes.d.ts +76 -0
  464. package/dist/takes.d.ts.map +1 -0
  465. package/dist/takes.js +238 -0
  466. package/dist/takes.js.map +1 -0
  467. package/dist/timeRemap.d.ts +101 -0
  468. package/dist/timeRemap.d.ts.map +1 -0
  469. package/dist/timeRemap.js +183 -0
  470. package/dist/timeRemap.js.map +1 -0
  471. package/dist/trackOrder.d.ts +38 -0
  472. package/dist/trackOrder.d.ts.map +1 -0
  473. package/dist/trackOrder.js +54 -0
  474. package/dist/trackOrder.js.map +1 -0
  475. package/dist/transitionAtCut.d.ts +89 -0
  476. package/dist/transitionAtCut.d.ts.map +1 -0
  477. package/dist/transitionAtCut.js +217 -0
  478. package/dist/transitionAtCut.js.map +1 -0
  479. package/dist/trimClip.d.ts +13 -0
  480. package/dist/trimClip.d.ts.map +1 -0
  481. package/dist/trimClip.js +60 -0
  482. package/dist/trimClip.js.map +1 -0
  483. package/dist/types.d.ts +1772 -0
  484. package/dist/types.d.ts.map +1 -0
  485. package/dist/types.js +84 -0
  486. package/dist/types.js.map +1 -0
  487. package/fonts/BebasNeue-Regular.ttf +0 -0
  488. package/fonts/Inter-ExtraBold.ttf +0 -0
  489. package/fonts/Inter-Italic-Variable.ttf +0 -0
  490. package/fonts/Inter-SemiBold.ttf +0 -0
  491. package/fonts/Inter-Variable.ttf +0 -0
  492. package/fonts/JetBrainsMono-Italic-Variable.ttf +0 -0
  493. package/fonts/JetBrainsMono-Variable.ttf +0 -0
  494. package/fonts/Lora-Italic-Variable.ttf +0 -0
  495. package/fonts/Lora-Variable.ttf +0 -0
  496. package/fonts/OFL-BebasNeue.txt +93 -0
  497. package/fonts/OFL-Inter.txt +93 -0
  498. package/fonts/OFL-JetBrainsMono.txt +93 -0
  499. package/fonts/OFL-Lora.txt +93 -0
  500. package/fonts/OFL-PlayfairDisplay.txt +93 -0
  501. package/fonts/OFL-SpaceGrotesk.txt +93 -0
  502. package/fonts/PlayfairDisplay-Italic-Variable.ttf +0 -0
  503. package/fonts/PlayfairDisplay-Variable.ttf +0 -0
  504. package/fonts/SpaceGrotesk-Variable.ttf +0 -0
  505. package/package.json +108 -0
@@ -0,0 +1,227 @@
1
+ /** Pure source-time Smart Reframe math. */
2
+ import { applySmoothingToSample, isMediaTrackStale, sampleMediaTrackAt } from "./mediaTrack.js";
3
+ const clamp01 = (value) => Math.min(1, Math.max(0, value));
4
+ /** Whether a ready point/box track contains coordinates the framing solver supports. */
5
+ export function mediaTrackCanDriveReframe(track) {
6
+ return (track.status === "ready" &&
7
+ track.samples.some((sample) => sample.x !== undefined && sample.y !== undefined));
8
+ }
9
+ function lerp(a, b, t) {
10
+ return a + (b - a) * t;
11
+ }
12
+ function samplePathAt(samples, sourceMs) {
13
+ if (samples.length === 0)
14
+ return undefined;
15
+ const ordered = [...samples].sort((a, b) => a.sourceMs - b.sourceMs);
16
+ const first = ordered[0];
17
+ if (sourceMs <= first.sourceMs)
18
+ return { ...first, sourceMs };
19
+ const last = ordered[ordered.length - 1];
20
+ if (sourceMs >= last.sourceMs)
21
+ return { ...last, sourceMs };
22
+ for (let i = 1; i < ordered.length; i += 1) {
23
+ const b = ordered[i];
24
+ if (sourceMs > b.sourceMs)
25
+ continue;
26
+ const a = ordered[i - 1];
27
+ const span = b.sourceMs - a.sourceMs;
28
+ const t = span > 0 ? (sourceMs - a.sourceMs) / span : 0;
29
+ const sample = {
30
+ sourceMs,
31
+ x: lerp(a.x, b.x, t),
32
+ y: lerp(a.y, b.y, t)
33
+ };
34
+ if (a.width !== undefined && b.width !== undefined) {
35
+ sample.width = lerp(a.width, b.width, t);
36
+ }
37
+ if (a.height !== undefined && b.height !== undefined) {
38
+ sample.height = lerp(a.height, b.height, t);
39
+ }
40
+ if (a.confidence !== undefined && b.confidence !== undefined) {
41
+ sample.confidence = lerp(a.confidence, b.confidence, t);
42
+ }
43
+ return sample;
44
+ }
45
+ return { ...last, sourceMs };
46
+ }
47
+ /** Convert a point/box MediaTrack into a compact automatic framing path. */
48
+ export function solveReframeSamples(track) {
49
+ return track.samples.flatMap((sample) => {
50
+ if (sample.x === undefined || sample.y === undefined)
51
+ return [];
52
+ const solved = {
53
+ sourceMs: sample.sourceMs,
54
+ x: clamp01(sample.x),
55
+ y: clamp01(sample.y)
56
+ };
57
+ if (sample.width !== undefined) {
58
+ solved.width = clamp01(sample.width);
59
+ }
60
+ if (sample.height !== undefined) {
61
+ solved.height = clamp01(sample.height);
62
+ }
63
+ if (sample.confidence !== undefined)
64
+ solved.confidence = sample.confidence;
65
+ return [solved];
66
+ });
67
+ }
68
+ function trackSample(reframe, track, sourceMs) {
69
+ if (reframe.mode !== "track" ||
70
+ !track ||
71
+ track.id !== reframe.trackId ||
72
+ track.status !== "ready") {
73
+ return undefined;
74
+ }
75
+ const sample = reframe.smoothing !== undefined && reframe.smoothing > 0
76
+ ? applySmoothingToSample(track, sourceMs, reframe.smoothing)
77
+ : sampleMediaTrackAt(track, sourceMs);
78
+ if (!sample || sample.x === undefined || sample.y === undefined) {
79
+ return undefined;
80
+ }
81
+ const result = { sourceMs, x: sample.x, y: sample.y };
82
+ if (sample.width !== undefined)
83
+ result.width = sample.width;
84
+ if (sample.height !== undefined)
85
+ result.height = sample.height;
86
+ if (sample.confidence !== undefined)
87
+ result.confidence = sample.confidence;
88
+ return result;
89
+ }
90
+ function baseSample(reframe, sourceMs, track) {
91
+ const tracked = trackSample(reframe, track, sourceMs);
92
+ if (tracked)
93
+ return tracked;
94
+ if (reframe.mode === "auto") {
95
+ const automatic = samplePathAt(reframe.samples ?? [], sourceMs);
96
+ if (automatic)
97
+ return automatic;
98
+ }
99
+ return { sourceMs, x: 0.5, y: 0.5 };
100
+ }
101
+ function correctionAt(reframe, sourceMs, track) {
102
+ const keyframes = [...(reframe.keyframes ?? [])].sort((a, b) => a.sourceMs - b.sourceMs);
103
+ if (keyframes.length === 0)
104
+ return { x: 0, y: 0, zoom: 1 };
105
+ const corrections = keyframes.map((keyframe) => {
106
+ const automatic = baseSample(reframe, keyframe.sourceMs, track);
107
+ return {
108
+ sourceMs: keyframe.sourceMs,
109
+ x: keyframe.x - automatic.x,
110
+ y: keyframe.y - automatic.y,
111
+ zoom: Math.max(1, keyframe.zoom ?? 1)
112
+ };
113
+ });
114
+ const first = corrections[0];
115
+ if (sourceMs <= first.sourceMs)
116
+ return first;
117
+ const last = corrections[corrections.length - 1];
118
+ if (sourceMs >= last.sourceMs)
119
+ return last;
120
+ for (let i = 1; i < corrections.length; i += 1) {
121
+ const b = corrections[i];
122
+ if (sourceMs > b.sourceMs)
123
+ continue;
124
+ const a = corrections[i - 1];
125
+ const span = b.sourceMs - a.sourceMs;
126
+ const t = span > 0 ? (sourceMs - a.sourceMs) / span : 0;
127
+ return {
128
+ x: lerp(a.x, b.x, t),
129
+ y: lerp(a.y, b.y, t),
130
+ zoom: lerp(a.zoom, b.zoom, t)
131
+ };
132
+ }
133
+ return last;
134
+ }
135
+ /** Resolve automatic framing plus interpolated manual corrections. */
136
+ export function sampleReframeAt(reframe, sourceMs, track) {
137
+ const automatic = baseSample(reframe, sourceMs, track);
138
+ const correction = correctionAt(reframe, sourceMs, track);
139
+ return {
140
+ ...automatic,
141
+ sourceMs,
142
+ x: clamp01(automatic.x + correction.x),
143
+ y: clamp01(automatic.y + correction.y),
144
+ zoom: correction.zoom
145
+ };
146
+ }
147
+ /** Resolve a target-aspect crop in normalized source coordinates. */
148
+ export function resolveReframeCrop(reframe, sourceMs, sourceSize, targetSize, track) {
149
+ if (sourceSize.width <= 0 ||
150
+ sourceSize.height <= 0 ||
151
+ targetSize.width <= 0 ||
152
+ targetSize.height <= 0) {
153
+ return undefined;
154
+ }
155
+ const sourceAspect = sourceSize.width / sourceSize.height;
156
+ const targetAspect = targetSize.width / targetSize.height;
157
+ let cropWidth = 1;
158
+ let cropHeight = 1;
159
+ if (targetAspect < sourceAspect)
160
+ cropWidth = targetAspect / sourceAspect;
161
+ else
162
+ cropHeight = sourceAspect / targetAspect;
163
+ const sampled = sampleReframeAt(reframe, sourceMs, track);
164
+ if (reframe.safeMargin !== undefined) {
165
+ const margin = Math.min(0.49, Math.max(0, reframe.safeMargin));
166
+ const available = 1 - margin * 2;
167
+ const widthScale = sampled.width === undefined ? 0 : sampled.width / (cropWidth * available);
168
+ const heightScale = sampled.height === undefined
169
+ ? 0
170
+ : sampled.height / (cropHeight * available);
171
+ if (widthScale > 0 || heightScale > 0) {
172
+ const subjectFitScale = Math.min(1, Math.max(widthScale, heightScale));
173
+ cropWidth *= subjectFitScale;
174
+ cropHeight *= subjectFitScale;
175
+ }
176
+ }
177
+ cropWidth /= sampled.zoom;
178
+ cropHeight /= sampled.zoom;
179
+ const centerX = Math.min(1 - cropWidth / 2, Math.max(cropWidth / 2, sampled.x));
180
+ const centerY = Math.min(1 - cropHeight / 2, Math.max(cropHeight / 2, sampled.y));
181
+ return {
182
+ left: centerX - cropWidth / 2,
183
+ right: 1 - centerX - cropWidth / 2,
184
+ top: centerY - cropHeight / 2,
185
+ bottom: 1 - centerY - cropHeight / 2
186
+ };
187
+ }
188
+ /** Add or replace one manual keyframe, keeping source-time order. */
189
+ export function addReframeKeyframe(reframe, keyframe) {
190
+ const keyframes = (reframe.keyframes ?? []).filter((candidate) => candidate.sourceMs !== keyframe.sourceMs);
191
+ keyframes.push({ ...keyframe });
192
+ keyframes.sort((a, b) => a.sourceMs - b.sourceMs);
193
+ return { ...reframe, keyframes };
194
+ }
195
+ /** Remove framing state without changing any other editorial property. */
196
+ export function clearReframe(clip) {
197
+ if (!clip.reframe)
198
+ return clip;
199
+ const next = { ...clip };
200
+ delete next.reframe;
201
+ return next;
202
+ }
203
+ /** Automatic analysis is stale independently of manual correction keyframes. */
204
+ export function isReframeStale(clip, track) {
205
+ const reframe = clip.reframe;
206
+ if (!reframe)
207
+ return false;
208
+ if (reframe.sourceAssetId && reframe.sourceAssetId !== clip.currentAssetId) {
209
+ return true;
210
+ }
211
+ return (reframe.mode === "track" &&
212
+ (track === undefined ||
213
+ track.status !== "ready" ||
214
+ isMediaTrackStale(track, clip)));
215
+ }
216
+ /**
217
+ * Return framing that is safe to render for the clip's current source.
218
+ * Stale automatic data is ignored, while manual keyframes remain absolute
219
+ * source-space framing points and continue to interpolate around centre.
220
+ */
221
+ export function renderableReframe(clip, track) {
222
+ const reframe = clip.reframe;
223
+ if (!reframe || !isReframeStale(clip, track))
224
+ return reframe;
225
+ return { ...reframe, mode: "center" };
226
+ }
227
+ //# sourceMappingURL=reframe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reframe.js","sourceRoot":"","sources":["../src/reframe.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAUzB,MAAM,OAAO,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAE3E,wFAAwF;AACxF,MAAM,UAAU,yBAAyB,CAAC,KAAiB;IACzD,OAAO,CACL,KAAK,CAAC,MAAM,KAAK,OAAO;QACxB,KAAK,CAAC,OAAO,CAAC,IAAI,CAChB,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,CAAC,KAAK,SAAS,CAC7D,CACF,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IAC3C,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,YAAY,CACnB,OAAiC,EACjC,QAAgB;IAEhB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,MAAM,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IACrE,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;IAC1B,IAAI,QAAQ,I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3E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,OAAO;QACxB,CAAC,KAAK,KAAK,SAAS;YAClB,KAAK,CAAC,MAAM,KAAK,OAAO;YACxB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAClC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAsD,EACtD,KAAkB;IAElB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC7B,IAAI,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IAC7D,OAAO,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,419 @@
1
+ /**
2
+ * canvas2d — the Canvas 2D compositing rules shared by every non-GPU render
3
+ * surface.
4
+ *
5
+ * {@link HeadlessFrameCompositor} is the GPU path; this is the same placement,
6
+ * opacity, blend, wipe and rounded-corner math expressed against a Canvas 2D
7
+ * context, so the browser's WebGPU fallback and the server-side frame preview
8
+ * draw one frame the same way. Written against {@link CompositeContext2D} — the
9
+ * subset of the Canvas 2D API these drawings need — for the reason `draw.ts` is
10
+ * written against `RasterContext2D`: one implementation serves an
11
+ * `OffscreenCanvas`, a DOM canvas and `@napi-rs/canvas`.
12
+ *
13
+ * Pixel effects run on a scratch surface shared by browser and Node hosts.
14
+ * If a host cannot provide that surface, the frame reports the degradation.
15
+ *
16
+ * A group carrying effects, a blend mode, or a transition composites its
17
+ * children onto an intermediate surface first, so the effect chain and cut
18
+ * run on the composed picture and the blend meets the frame once. The host vends that surface through
19
+ * {@link CompositeSurfaceFactory}, because there is no way to make one that
20
+ * exists in both a browser and Node.
21
+ *
22
+ * An adjustment reuses that machinery from the other end: at its own z it
23
+ * copies the surface it sits on, runs its chain on the copy, and mixes the copy
24
+ * back into the untreated composite by its coverage — so it treats everything
25
+ * drawn below it and nothing above, and replaces what it covers rather than
26
+ * lying over it.
27
+ */
28
+ import type { AnimationSampleMask, WipeDirection } from "../animation/index.js";
29
+ import type { ClipCrop, ClipEffect, ClipMask, ClipTransform, TrackEffect } from "../types.js";
30
+ import { type MaskContext2D } from "./draw.js";
31
+ import type { MatteMode } from "./sceneModel.js";
32
+ import { type CanvasAffine } from "./transform.js";
33
+ import { type ResolvedTransition } from "./transition.js";
34
+ /**
35
+ * The Canvas 2D surface a composite draws through. `drawImage` is generic in
36
+ * its source so a host can pass whatever bitmap its canvas accepts — an
37
+ * `HTMLVideoElement`, an `ImageBitmap`, a `@napi-rs/canvas` `Image`.
38
+ */
39
+ export interface CompositeContext2D<TSource> extends MaskContext2D {
40
+ globalAlpha: number;
41
+ /**
42
+ * The one clip effect this path draws rather than approximates. Canvas 2D
43
+ * casts a shadow from whatever is drawn next, which is the same silhouette
44
+ * `mixer.dropShadow@1` blurs on the GPU path.
45
+ */
46
+ shadowColor: string;
47
+ shadowBlur: number;
48
+ shadowOffsetX: number;
49
+ shadowOffsetY: number;
50
+ setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
51
+ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
52
+ drawImage(source: TSource, x: number, y: number, w: number, h: number): void;
53
+ /**
54
+ * Read back the surface's pixels. A luma matte is the one rule here that no
55
+ * composite operation expresses: `destination-in` multiplies alpha by alpha,
56
+ * and moving a matte's luminance into its alpha needs the bytes.
57
+ */
58
+ getImageData(x: number, y: number, w: number, h: number): ImagePixels;
59
+ putImageData(pixels: ImagePixels, x: number, y: number): void;
60
+ }
61
+ /** The pixels `getImageData` vends, as both canvas implementations shape them. */
62
+ export interface ImagePixels {
63
+ data: Uint8ClampedArray;
64
+ width: number;
65
+ height: number;
66
+ }
67
+ /** One layer to composite, with its source already decoded or rasterized. */
68
+ export interface Canvas2DLayer<TSource> {
69
+ /**
70
+ * The clip this layer draws, when the host knows it. Only a
71
+ * {@link Canvas2DDegradation} reads it — a report naming no clip is a report
72
+ * an agent cannot act on.
73
+ */
74
+ clipId?: string;
75
+ source: TSource;
76
+ /** Source pixel dimensions — the space the transform and mask act in. */
77
+ sourceWidth: number;
78
+ sourceHeight: number;
79
+ opacity: number;
80
+ blendMode: unknown;
81
+ /** Composite order, ascending. */
82
+ zIndex: number;
83
+ /** Order among clips and group surfaces with the same zIndex. */
84
+ stackOrder?: number;
85
+ transform?: ClipTransform;
86
+ /** The layer's group matrix, from the scene model. Composes as `parent × own`. */
87
+ parentMatrix?: Float32Array;
88
+ /**
89
+ * The precomposite this layer draws into instead of the main stack, from the
90
+ * scene model. Absent on every layer of a document with no precompositing
91
+ * group, which is the path that allocates no surface.
92
+ */
93
+ precomposeGroupId?: string;
94
+ /** Rounded-corner radius in source pixels. */
95
+ borderRadius?: number;
96
+ /**
97
+ * The part of the source this layer draws, taken before anything else reads
98
+ * it: the contain fit, the transform, the border radius and the masks all see
99
+ * the cropped rectangle as the layer's whole picture. Needs `cropSurface` to
100
+ * copy through, or the layer draws uncropped and reports `crop_skipped`.
101
+ */
102
+ crop?: ClipCrop;
103
+ mask?: AnimationSampleMask;
104
+ /**
105
+ * The clip's shape mask, in this layer's own source-pixel space so it turns
106
+ * with the layer. A hard edge is a path clip and costs nothing; a feathered
107
+ * one rasterizes its coverage on `maskSurface` and multiplies it in.
108
+ */
109
+ shapeMask?: ClipMask;
110
+ /**
111
+ * The track matte driving this layer's alpha. `layer` is the matte source
112
+ * resolved as an ordinary layer — it is composited to its own surface and
113
+ * read, never drawn onto the frame.
114
+ */
115
+ matte?: Canvas2DMatte<TSource>;
116
+ effects?: ClipEffect[];
117
+ trackEffects?: TrackEffect[];
118
+ /**
119
+ * The cut this layer is part of, from the scene model. Its opacity is
120
+ * already in `opacity`; the offset, scale, reveal mask and dip solid it
121
+ * names are drawn here.
122
+ */
123
+ transition?: ResolvedTransition;
124
+ }
125
+ /** A track matte with its source layer's pixels already in hand. */
126
+ export interface Canvas2DMatte<TSource> {
127
+ mode: MatteMode;
128
+ invert: boolean;
129
+ layer: Canvas2DLayer<TSource>;
130
+ /** Multiplies the matte's alpha. Absent means 1. */
131
+ strength?: number;
132
+ /**
133
+ * Softened edge, in pixels. This path has no separable blur to run on a
134
+ * keyhole surface, so it draws the edge hard and reports
135
+ * `generated_matte_feather_ignored`.
136
+ */
137
+ featherPx?: number;
138
+ }
139
+ /**
140
+ * A group that composites its children onto an intermediate surface, runs its
141
+ * effect chain on the composed picture, and blends the result once.
142
+ *
143
+ * Mirrors `PrecompositeLayer` from the scene model with `trackIndex` already
144
+ * resolved to a `zIndex`, the way {@link Canvas2DLayer} mirrors `ActiveLayer`.
145
+ */
146
+ export interface Canvas2DPrecomposite {
147
+ /** The group clip's id — what a layer names in `precomposeGroupId`. */
148
+ id: string;
149
+ /** Composite order of the blended result, ascending. */
150
+ zIndex: number;
151
+ /** Order among clips and group surfaces with the same zIndex. */
152
+ stackOrder?: number;
153
+ opacity: number;
154
+ blendMode: unknown;
155
+ /** Run once on the composed surface, not once per child. */
156
+ effects?: ClipEffect[];
157
+ /** Applied to the composed surface, not separately to its children. */
158
+ transition?: ResolvedTransition;
159
+ /** Set when a precompositing group holds this one: the surface it draws into. */
160
+ precomposeGroupId?: string;
161
+ }
162
+ /**
163
+ * An adjustment clip's treatment of the surface beneath it.
164
+ *
165
+ * Mirrors `AdjustmentLayer` from the scene model with `trackIndex` already
166
+ * resolved to a `zIndex`, the way {@link Canvas2DLayer} mirrors `ActiveLayer`.
167
+ * It draws nothing of its own: at its `zIndex` the composite so far is copied
168
+ * to a surface, {@link effects} run on the copy, and the copy is mixed back
169
+ * into the original at {@link opacity} — a replacement at full coverage, not a
170
+ * second picture over the first.
171
+ */
172
+ export interface Canvas2DAdjustment {
173
+ /** The clip this treatment came from, for a {@link Canvas2DDegradation}. */
174
+ clipId?: string;
175
+ /** Where in the composite order the treatment runs, ascending. */
176
+ zIndex: number;
177
+ /** How much of the treated copy is kept. 1 is fully treated, 0 a no-op. */
178
+ opacity: number;
179
+ effects?: ClipEffect[];
180
+ /** Where the treatment lands, in the treated surface's own pixel space. */
181
+ mask?: ClipMask;
182
+ /** An animated wipe limiting the treatment, as it limits a layer. */
183
+ wipe?: AnimationSampleMask;
184
+ /** The precomposite surface this treats instead of the frame. */
185
+ precomposeGroupId?: string;
186
+ }
187
+ /** Canvas geometry a composite draws into. */
188
+ export interface Canvas2DFrameGeometry {
189
+ /** Backing-store size of the destination canvas, in pixels. */
190
+ canvasWidth: number;
191
+ canvasHeight: number;
192
+ /**
193
+ * The sequence's own resolution. A stored `transform.position` is expressed
194
+ * against this, so a DPR-scaled preview canvas places a clip where the
195
+ * export does. Defaults to the canvas size.
196
+ */
197
+ refWidth?: number;
198
+ refHeight?: number;
199
+ }
200
+ /**
201
+ * An offscreen surface this module draws on and then draws back: the scratch a
202
+ * feathered wipe pre-masks its source on, and the intermediate a precompositing
203
+ * group composes its children into.
204
+ *
205
+ * A surface is a context plus whatever the host's `drawImage` accepts as a
206
+ * source, never a canvas class (I6): the browser hands over an `OffscreenCanvas`
207
+ * and the server an `@napi-rs/canvas` one, and only their 2D contexts have a
208
+ * shape both satisfy.
209
+ */
210
+ export interface CompositeSurface<TSource> {
211
+ ctx: CompositeContext2D<TSource>;
212
+ /** The surface itself, to draw back onto the main context. */
213
+ surface: TSource;
214
+ }
215
+ /**
216
+ * How a host makes a {@link CompositeSurface} — `document.createElement`,
217
+ * `new OffscreenCanvas`, `createCanvas` — since none of those exists
218
+ * everywhere. Returning null means the host could not, and the caller says what
219
+ * it does instead.
220
+ */
221
+ export type CompositeSurfaceFactory<TSource> = (width: number, height: number) => CompositeSurface<TSource> | null;
222
+ /** @deprecated Use {@link CompositeSurface}. */
223
+ export type MaskScratch<TSource> = CompositeSurface<TSource>;
224
+ /** @deprecated Use {@link CompositeSurfaceFactory}. */
225
+ export type MaskScratchFactory<TSource> = CompositeSurfaceFactory<TSource>;
226
+ /** The optional halves of a frame draw: the surfaces, and the group stack. */
227
+ export interface DrawTimelineFrameOptions<TSource> {
228
+ /** Scratch for procedural and spatial effects before placement. */
229
+ effectSurface?: CompositeSurfaceFactory<TSource>;
230
+ /** Scratch for filtering and masking a source before its perspective warp. */
231
+ projectiveSurface?: CompositeSurfaceFactory<TSource>;
232
+ /**
233
+ * Scratch for feathered wipes. One reused surface is enough — a wipe draws it
234
+ * back before the next layer asks for it.
235
+ */
236
+ maskScratch?: CompositeSurfaceFactory<TSource>;
237
+ /** The groups to composite separately, innermost first (scene-model order). */
238
+ precomposites?: readonly Canvas2DPrecomposite[];
239
+ /**
240
+ * The adjustments to run, in any order — each one runs at its own `zIndex`,
241
+ * on the surface it names. Omitted, the frame draws exactly as it did before
242
+ * adjustments existed and no surface is asked for.
243
+ */
244
+ adjustments?: readonly Canvas2DAdjustment[];
245
+ /**
246
+ * A frame-sized surface for one adjustment's treated copy. Consumed within a
247
+ * single treatment — the copy is drawn back before the next layer draws — so
248
+ * one reused surface is enough. Without it the treatment is skipped and the
249
+ * untreated composite stands.
250
+ */
251
+ adjustmentSurface?: CompositeSurfaceFactory<TSource>;
252
+ /**
253
+ * Frame-sized intermediates for those groups. Each call must answer with a
254
+ * surface no other precomposite in this frame is still using — nested groups
255
+ * hold theirs until the group above has drawn it — so this cannot be the same
256
+ * pooled surface `maskScratch` vends. Returning null draws the group's
257
+ * children onto the stack beneath instead, without its effects or blend mode.
258
+ */
259
+ precompositeSurface?: CompositeSurfaceFactory<TSource>;
260
+ /**
261
+ * Coverage scratch for a feathered shape mask, distinct from `maskScratch`:
262
+ * the mask is rasterized here and then multiplied into the copy of the layer
263
+ * that `maskScratch` holds, so both are live at once. One reused surface is
264
+ * enough — it is consumed within a single layer's draw. Without it a
265
+ * feathered mask falls back to its hard edge.
266
+ */
267
+ maskSurface?: CompositeSurfaceFactory<TSource>;
268
+ /**
269
+ * Frame-sized surfaces for a matted layer: one holds the layer, one holds its
270
+ * matte source, and both are live at once, so each call must answer with a
271
+ * surface the other is not using. Without it a matted layer draws unmatted.
272
+ */
273
+ matteSurface?: CompositeSurfaceFactory<TSource>;
274
+ /**
275
+ * Holds a cropped layer's picture at the crop's own size. Distinct from
276
+ * `maskScratch` and `maskSurface`: it stays live for the whole of one layer's
277
+ * draw, and both of those read from it while it does. Without it a cropped
278
+ * layer draws uncropped and reports `crop_skipped`.
279
+ */
280
+ cropSurface?: CompositeSurfaceFactory<TSource>;
281
+ /**
282
+ * Seed the frame fully transparent instead of opaque black — an alpha export.
283
+ * Off by default, so a preview keeps the ground it has.
284
+ */
285
+ alpha?: boolean;
286
+ }
287
+ /**
288
+ * A way this path draws a frame the GPU compositor would draw differently,
289
+ * where the difference is not an effect type {@link unsupportedEffectTypes}
290
+ * could name (I7).
291
+ *
292
+ * Most are host shortfalls: the drawing exists, but the surface it needs is
293
+ * unavailable. Extra drop shadows and near-plane fallback are approximations
294
+ * of GPU behavior even when the host provides every surface.
295
+ */
296
+ export type Canvas2DDegradationReason = "effect_surface_missing"
297
+ /** A feathered shape mask drawn as its hard edge. */
298
+ | "mask_hard_edge"
299
+ /** A feathered wipe drawn as a hard edge. */
300
+ | "wipe_hard_edge"
301
+ /** A track matte skipped: the layer drew unmatted. */
302
+ | "matte_skipped"
303
+ /** A generated matte's feathered edge drawn hard. */
304
+ | "generated_matte_feather_ignored"
305
+ /** A precompositing group's blend mode and effects lost. */
306
+ | "group_blend_lost"
307
+ /** An adjustment did not run: the untreated composite stands. */
308
+ | "adjustment_skipped"
309
+ /** Drop shadows past the first in the chain, not cast. */
310
+ | "drop_shadow_extra_ignored"
311
+ /** A tilted layer rendered without its requested shadow. */
312
+ | "drop_shadow_skipped" | "perspective_skipped"
313
+ /** Near-plane crossing uses tessellation rather than pixel sampling. */
314
+ | "perspective_near_plane_fallback"
315
+ /** Brightness applied as a CSS multiply instead of the GPU's addition. */
316
+ | "brightness_multiplicative"
317
+ /** A crop skipped: the layer drew its whole source, at its whole-source fit. */
318
+ | "crop_skipped";
319
+ /** One degradation, and the clip it happened to. */
320
+ export interface Canvas2DDegradation {
321
+ /** The clip, when the host set {@link Canvas2DLayer.clipId}. */
322
+ clipId?: string;
323
+ reason: Canvas2DDegradationReason;
324
+ }
325
+ /** What a frame draw left behind besides pixels. */
326
+ export interface Canvas2DFrameReport<TSource> {
327
+ /** Layers that drew nothing, in composite order. */
328
+ skipped: Canvas2DLayer<TSource>[];
329
+ /** Every way this frame differs from the GPU render, in draw order. */
330
+ degraded: Canvas2DDegradation[];
331
+ }
332
+ /**
333
+ * The effect types present on these layers that Canvas 2D cannot draw. A
334
+ * caller reports these rather than letting the frame quietly differ from the
335
+ * GPU render (I7).
336
+ *
337
+ * A group's effects run on its composed surface, not on any one layer, so a
338
+ * caller with precomposites passes them in too — `Canvas2DPrecomposite` carries
339
+ * `effects` for exactly that. An adjustment is the same case: its chain runs on
340
+ * the composite beneath it and belongs to no layer, so a caller passes its
341
+ * adjustments in as well. Leaving either out is how a group blur, or a keyed
342
+ * adjustment, that this path never applied would go unreported.
343
+ *
344
+ * A missing scratch surface is reported by the frame draw, because support
345
+ * depends on the host rather than the effect document.
346
+ */
347
+ export declare function unsupportedEffectTypes(layers: readonly {
348
+ effects?: ClipEffect[];
349
+ trackEffects?: TrackEffect[];
350
+ }[]): string[];
351
+ /**
352
+ * The 2D affine that places a layer of the given source size on the canvas,
353
+ * matching the GPU compositor's placement.
354
+ */
355
+ export declare function layerCanvasAffine(transform: ClipTransform | undefined, sourceWidth: number, sourceHeight: number, geometry: Canvas2DFrameGeometry, parentMatrix?: Float32Array): CanvasAffine;
356
+ interface ProjectivePoint {
357
+ x: number;
358
+ y: number;
359
+ }
360
+ /** Project a source pixel through the same matrix the GPU compositor reads. */
361
+ export declare function projectSourcePoint(matrix: Float32Array, x: number, y: number, sourceWidth: number, sourceHeight: number, canvasWidth: number, canvasHeight: number): ProjectivePoint;
362
+ /**
363
+ * Composite `layers` onto `ctx`, bottom-up by `zIndex`, over an opaque black
364
+ * ground — the same clear the GPU compositor starts from, and with
365
+ * `options.alpha` the same transparent one. The context is left in the reset
366
+ * state. Returns the layers that drew nothing and every way this frame differs
367
+ * from the GPU render, both in composite order.
368
+ *
369
+ * A layer naming a precomposite in `options.precomposites` draws onto that
370
+ * group's own surface first, and the surface blends once at the group's z. With
371
+ * no precomposites the layers go straight onto `ctx` and no surface is asked
372
+ * for at all.
373
+ *
374
+ * An adjustment in `options.adjustments` runs at its own z on the surface it
375
+ * names — the frame, or the group's — treating what is already on it.
376
+ */
377
+ export declare function drawTimelineFrame<TSource>(ctx: CompositeContext2D<TSource>, layers: readonly Canvas2DLayer<TSource>[], geometry: Canvas2DFrameGeometry, options?: DrawTimelineFrameOptions<TSource>): Canvas2DFrameReport<TSource>;
378
+ /**
379
+ * Draw one layer with its transform, opacity, blend mode, effect filter,
380
+ * rounded corners and wipe mask. Assumes the context is in the reset state and
381
+ * leaves it that way.
382
+ *
383
+ * Returns false when the layer contributed nothing — a degenerate source size,
384
+ * or a source the host handed over that turned out not to be drawable (a
385
+ * `<video>` that began seeking between the readiness check and this call).
386
+ * A live preview ignores that and re-draws next frame; a one-shot render
387
+ * reports it, because there a missing layer is a missing layer.
388
+ */
389
+ export declare function drawTimelineLayer<TSource>(ctx: CompositeContext2D<TSource>, layer: Canvas2DLayer<TSource>, geometry: Canvas2DFrameGeometry, surfaces?: DrawTimelineFrameOptions<TSource>, degraded?: Canvas2DDegradation[]): boolean;
390
+ /**
391
+ * The source-pixel point at normalized distance `c` from a wipe's reveal edge,
392
+ * along the wipe axis.
393
+ */
394
+ export declare function axisPoint(direction: WipeDirection, c: number, width: number, height: number): {
395
+ x: number;
396
+ y: number;
397
+ };
398
+ /**
399
+ * Clip to a hard-edged wipe's visible region: the rect within normalized
400
+ * distance `progress` of the reveal edge, in source-pixel space (so it
401
+ * composes with the active layer transform and any rounded-rect clip).
402
+ */
403
+ export declare function clipWipeRect<TSource>(ctx: CompositeContext2D<TSource>, width: number, height: number, mask: AnimationSampleMask): void;
404
+ /** Clip the current path to a rounded rectangle in the active transform space. */
405
+ export declare function clipRoundedRect<TSource>(ctx: CompositeContext2D<TSource>, x: number, y: number, w: number, h: number, r: number): void;
406
+ /**
407
+ * @param brightnessApplied The layer's brightness already landed as the GPU's
408
+ * addition on a scratch copy, so the filter must leave it out rather than
409
+ * apply the lift a second time.
410
+ */
411
+ export declare function filterForEffects(clipEffects: ClipEffect[] | undefined, trackEffects: TrackEffect[] | undefined, brightnessApplied?: boolean): string;
412
+ /**
413
+ * The grade's total brightness, summed over the clip and track effects exactly
414
+ * as the filter builder sums it — one accumulation, so the scratch pass and the
415
+ * filter can never disagree about how much lift is left to apply.
416
+ */
417
+ export declare function brightnessForEffects(clipEffects: ClipEffect[] | undefined, trackEffects: TrackEffect[] | undefined): number;
418
+ export {};
419
+ //# sourceMappingURL=canvas2d.d.ts.map