@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.5

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 (746) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +48 -0
  4. package/README.md +93 -72
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.d.ts +9 -0
  7. package/dist/assets/catalog.d.ts.map +1 -1
  8. package/dist/assets/catalog.js +11 -0
  9. package/dist/assets/catalog.js.map +1 -1
  10. package/dist/assets/errors.d.ts.map +1 -1
  11. package/dist/assets/errors.js +8 -3
  12. package/dist/assets/errors.js.map +1 -1
  13. package/dist/assets/index.js.map +1 -1
  14. package/dist/assets/manager.d.ts +26 -1
  15. package/dist/assets/manager.d.ts.map +1 -1
  16. package/dist/assets/manager.js +79 -4
  17. package/dist/assets/manager.js.map +1 -1
  18. package/dist/assets/manifest.js.map +1 -1
  19. package/dist/assets/record.js.map +1 -1
  20. package/dist/assets/scope.d.ts +3 -3
  21. package/dist/assets/scope.d.ts.map +1 -1
  22. package/dist/assets/scope.js.map +1 -1
  23. package/dist/attributes/audio/filters/chain.d.ts +1 -1
  24. package/dist/attributes/audio/filters/chain.js.map +1 -1
  25. package/dist/attributes/audio/filters/curve.d.ts +8 -8
  26. package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
  27. package/dist/attributes/audio/filters/curve.js +20 -19
  28. package/dist/attributes/audio/filters/curve.js.map +1 -1
  29. package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
  30. package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
  31. package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
  32. package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
  33. package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
  34. package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
  35. package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
  36. package/dist/attributes/audio/filters/index.d.ts +1 -1
  37. package/dist/attributes/audio/filters/index.d.ts.map +1 -1
  38. package/dist/attributes/audio/filters/index.js +1 -1
  39. package/dist/attributes/audio/filters/index.js.map +1 -1
  40. package/dist/attributes/audio/filters/registry.js.map +1 -1
  41. package/dist/attributes/audio/filters/union.js.map +1 -1
  42. package/dist/attributes/audio/request.d.ts +17 -2
  43. package/dist/attributes/audio/request.d.ts.map +1 -1
  44. package/dist/attributes/audio/request.js.map +1 -1
  45. package/dist/attributes/audio/schedule.d.ts +4 -2
  46. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  47. package/dist/attributes/audio/schedule.js +15 -8
  48. package/dist/attributes/audio/schedule.js.map +1 -1
  49. package/dist/attributes/audio/sound.d.ts +4 -2
  50. package/dist/attributes/audio/sound.d.ts.map +1 -1
  51. package/dist/attributes/audio/sound.js +8 -4
  52. package/dist/attributes/audio/sound.js.map +1 -1
  53. package/dist/attributes/index.js.map +1 -1
  54. package/dist/attributes/layout/alignment.js +1 -1
  55. package/dist/attributes/layout/alignment.js.map +1 -1
  56. package/dist/attributes/layout/index.js.map +1 -1
  57. package/dist/attributes/layout/insets.js.map +1 -1
  58. package/dist/attributes/layout/matrix2d.js.map +1 -1
  59. package/dist/attributes/layout/size.js.map +1 -1
  60. package/dist/attributes/layout/transform3d.js.map +1 -1
  61. package/dist/attributes/layout/vector2.js.map +1 -1
  62. package/dist/attributes/layout/world-transform.js.map +1 -1
  63. package/dist/attributes/mask/boolean.js.map +1 -1
  64. package/dist/attributes/mask/mask.js.map +1 -1
  65. package/dist/attributes/properties/decorator.d.ts +3 -1
  66. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  67. package/dist/attributes/properties/decorator.js.map +1 -1
  68. package/dist/attributes/properties/inputs.js.map +1 -1
  69. package/dist/attributes/properties/typed.d.ts +9 -2
  70. package/dist/attributes/properties/typed.d.ts.map +1 -1
  71. package/dist/attributes/properties/typed.js +15 -1
  72. package/dist/attributes/properties/typed.js.map +1 -1
  73. package/dist/attributes/render3d/orbit.d.ts +8 -8
  74. package/dist/attributes/render3d/orbit.js +7 -7
  75. package/dist/attributes/render3d/orbit.js.map +1 -1
  76. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  77. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  78. package/dist/attributes/shape/corners/corners.js.map +1 -1
  79. package/dist/attributes/shape/corners/index.js.map +1 -1
  80. package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
  81. package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
  82. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  83. package/dist/attributes/shape/effects/chain.d.ts +28 -120
  84. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  85. package/dist/attributes/shape/effects/chain.js +16 -88
  86. package/dist/attributes/shape/effects/chain.js.map +1 -1
  87. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  88. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
  96. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  97. package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
  98. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  99. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  100. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  101. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  102. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  103. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  104. package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
  105. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  106. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  107. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  108. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  110. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  112. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
  114. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  116. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  118. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  120. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  122. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  124. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  126. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/shader.js +15 -8
  128. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  130. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  132. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  134. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  136. package/dist/attributes/shape/effects/index.d.ts +2 -6
  137. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  138. package/dist/attributes/shape/effects/index.js.map +1 -1
  139. package/dist/attributes/shape/effects/registry.d.ts +23 -6
  140. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  141. package/dist/attributes/shape/effects/registry.js +44 -10
  142. package/dist/attributes/shape/effects/registry.js.map +1 -1
  143. package/dist/attributes/shape/effects/union.d.ts +2 -6
  144. package/dist/attributes/shape/effects/union.d.ts.map +1 -1
  145. package/dist/attributes/shape/effects/union.js.map +1 -1
  146. package/dist/attributes/shape/fill/blend.js.map +1 -1
  147. package/dist/attributes/shape/fill/chain.js.map +1 -1
  148. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  149. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  150. package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
  151. package/dist/attributes/shape/fill/color/parser.js +81 -44
  152. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  153. package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
  154. package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
  155. package/dist/attributes/shape/fill/gradient-stops.js +65 -0
  156. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
  157. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  158. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  159. package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
  160. package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
  161. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  162. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  163. package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
  164. package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
  165. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  166. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  167. package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
  168. package/dist/attributes/shape/fill/implementations/image.js +5 -4
  169. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  170. package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
  171. package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
  172. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  173. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  174. package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
  175. package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
  176. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  177. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  178. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  179. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  180. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  181. package/dist/attributes/shape/fill/index.js.map +1 -1
  182. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  183. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  184. package/dist/attributes/shape/fill/registry.js.map +1 -1
  185. package/dist/attributes/shape/fill/union.js.map +1 -1
  186. package/dist/attributes/shape/filters/chain.d.ts +4 -10
  187. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  188. package/dist/attributes/shape/filters/chain.js +1 -13
  189. package/dist/attributes/shape/filters/chain.js.map +1 -1
  190. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  191. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  192. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  193. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  194. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  195. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  196. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  197. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  198. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  199. package/dist/attributes/shape/filters/index.d.ts +1 -1
  200. package/dist/attributes/shape/filters/index.js.map +1 -1
  201. package/dist/attributes/shape/filters/registry.d.ts +2 -2
  202. package/dist/attributes/shape/filters/registry.js +3 -3
  203. package/dist/attributes/shape/filters/registry.js.map +1 -1
  204. package/dist/attributes/shape/filters/union.d.ts +6 -7
  205. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  206. package/dist/attributes/shape/filters/union.js.map +1 -1
  207. package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
  208. package/dist/attributes/shape/path/anchors.js +12 -5
  209. package/dist/attributes/shape/path/anchors.js.map +1 -1
  210. package/dist/attributes/shape/path/bezier.js.map +1 -1
  211. package/dist/attributes/shape/path/index.js.map +1 -1
  212. package/dist/attributes/shape/path/measure.js.map +1 -1
  213. package/dist/attributes/shape/path/morph.d.ts.map +1 -1
  214. package/dist/attributes/shape/path/morph.js +16 -4
  215. package/dist/attributes/shape/path/morph.js.map +1 -1
  216. package/dist/attributes/shape/path/ops.js.map +1 -1
  217. package/dist/attributes/shape/path/types.js.map +1 -1
  218. package/dist/attributes/shape/path/walk.js.map +1 -1
  219. package/dist/attributes/shape/shaders/index.js.map +1 -1
  220. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  221. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  222. package/dist/attributes/shape/shadow/index.js.map +1 -1
  223. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  224. package/dist/attributes/shape/stroke/index.d.ts +2 -2
  225. package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
  226. package/dist/attributes/shape/stroke/index.js +1 -1
  227. package/dist/attributes/shape/stroke/index.js.map +1 -1
  228. package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
  229. package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
  230. package/dist/attributes/shape/stroke/stroke.js +22 -2
  231. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  232. package/dist/attributes/shared/operators.js.map +1 -1
  233. package/dist/attributes/text/index.js.map +1 -1
  234. package/dist/attributes/text/ops.d.ts +6 -0
  235. package/dist/attributes/text/ops.d.ts.map +1 -1
  236. package/dist/attributes/text/ops.js +1 -0
  237. package/dist/attributes/text/ops.js.map +1 -1
  238. package/dist/attributes/text/types.js.map +1 -1
  239. package/dist/browser/chunks/chunk-FUZVFT3W.js +18 -0
  240. package/dist/browser/chunks/chunk-FUZVFT3W.js.map +7 -0
  241. package/dist/browser/chunks/chunk-QG6C23IJ.js +3 -0
  242. package/dist/browser/chunks/chunk-QG6C23IJ.js.map +7 -0
  243. package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
  244. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
  245. package/dist/browser/component.js +1 -1
  246. package/dist/browser/component.js.map +1 -1
  247. package/dist/browser/index.js +1 -1
  248. package/dist/browser/index.js.map +4 -4
  249. package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
  250. package/dist/browser/jsx-jsx-runtime.js +1 -1
  251. package/dist/browser/manifest.json +3 -2
  252. package/dist/browser/sdk.js +1 -1
  253. package/dist/component.js.map +1 -1
  254. package/dist/document/audio.d.ts +1 -1
  255. package/dist/document/audio.js +4 -4
  256. package/dist/document/audio.js.map +1 -1
  257. package/dist/document/builtins.d.ts.map +1 -1
  258. package/dist/document/builtins.js +8 -14
  259. package/dist/document/builtins.js.map +1 -1
  260. package/dist/document/command-traits.d.ts +1 -1
  261. package/dist/document/command-traits.js +13 -1
  262. package/dist/document/command-traits.js.map +1 -1
  263. package/dist/document/deny-globals.js.map +1 -1
  264. package/dist/document/diff.js.map +1 -1
  265. package/dist/document/doc-index.d.ts +2 -2
  266. package/dist/document/doc-index.d.ts.map +1 -1
  267. package/dist/document/doc-index.js.map +1 -1
  268. package/dist/document/expression/compile.d.ts.map +1 -1
  269. package/dist/document/expression/compile.js +8 -5
  270. package/dist/document/expression/compile.js.map +1 -1
  271. package/dist/document/expression/index.js.map +1 -1
  272. package/dist/document/expression/ops.js +1 -1
  273. package/dist/document/expression/ops.js.map +1 -1
  274. package/dist/document/expression/parse.d.ts.map +1 -1
  275. package/dist/document/expression/parse.js +15 -6
  276. package/dist/document/expression/parse.js.map +1 -1
  277. package/dist/document/expression/refs.d.ts +1 -1
  278. package/dist/document/expression/refs.js +1 -1
  279. package/dist/document/expression/refs.js.map +1 -1
  280. package/dist/document/expression/types.js.map +1 -1
  281. package/dist/document/expression/walk.d.ts.map +1 -1
  282. package/dist/document/expression/walk.js +2 -1
  283. package/dist/document/expression/walk.js.map +1 -1
  284. package/dist/document/index.d.ts +2 -0
  285. package/dist/document/index.d.ts.map +1 -1
  286. package/dist/document/index.js +2 -0
  287. package/dist/document/index.js.map +1 -1
  288. package/dist/document/node-decorator.js.map +1 -1
  289. package/dist/document/node-descriptor.d.ts +19 -0
  290. package/dist/document/node-descriptor.d.ts.map +1 -1
  291. package/dist/document/node-descriptor.js.map +1 -1
  292. package/dist/document/placement.d.ts +70 -0
  293. package/dist/document/placement.d.ts.map +1 -0
  294. package/dist/document/placement.js +83 -0
  295. package/dist/document/placement.js.map +1 -0
  296. package/dist/document/project.d.ts +2 -2
  297. package/dist/document/project.d.ts.map +1 -1
  298. package/dist/document/project.js.map +1 -1
  299. package/dist/document/registry.d.ts +17 -0
  300. package/dist/document/registry.d.ts.map +1 -1
  301. package/dist/document/registry.js +29 -2
  302. package/dist/document/registry.js.map +1 -1
  303. package/dist/document/timeline-patch.js.map +1 -1
  304. package/dist/document/timeline.d.ts +73 -18
  305. package/dist/document/timeline.d.ts.map +1 -1
  306. package/dist/document/timeline.js +192 -40
  307. package/dist/document/timeline.js.map +1 -1
  308. package/dist/document/types.d.ts +12 -12
  309. package/dist/document/types.d.ts.map +1 -1
  310. package/dist/document/types.js +2 -2
  311. package/dist/document/types.js.map +1 -1
  312. package/dist/document/validate.d.ts +2 -2
  313. package/dist/document/validate.d.ts.map +1 -1
  314. package/dist/document/validate.js +37 -31
  315. package/dist/document/validate.js.map +1 -1
  316. package/dist/document/withdraw.d.ts +28 -0
  317. package/dist/document/withdraw.d.ts.map +1 -0
  318. package/dist/document/withdraw.js +61 -0
  319. package/dist/document/withdraw.js.map +1 -0
  320. package/dist/index.d.ts +1 -0
  321. package/dist/index.d.ts.map +1 -1
  322. package/dist/index.js +1 -0
  323. package/dist/index.js.map +1 -1
  324. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  325. package/dist/jsx/jsx-runtime.d.ts +9 -1
  326. package/dist/jsx/jsx-runtime.d.ts.map +1 -1
  327. package/dist/jsx/jsx-runtime.js +13 -3
  328. package/dist/jsx/jsx-runtime.js.map +1 -1
  329. package/dist/layout/bounds.d.ts +0 -1
  330. package/dist/layout/bounds.d.ts.map +1 -1
  331. package/dist/layout/bounds.js.map +1 -1
  332. package/dist/layout/constraints.js.map +1 -1
  333. package/dist/layout/flex.d.ts +4 -2
  334. package/dist/layout/flex.d.ts.map +1 -1
  335. package/dist/layout/flex.js +27 -11
  336. package/dist/layout/flex.js.map +1 -1
  337. package/dist/layout/freeform.js.map +1 -1
  338. package/dist/layout/grid.js.map +1 -1
  339. package/dist/layout/index.js.map +1 -1
  340. package/dist/layout/item.js.map +1 -1
  341. package/dist/layout/ops.d.ts +6 -0
  342. package/dist/layout/ops.d.ts.map +1 -1
  343. package/dist/layout/ops.js +6 -0
  344. package/dist/layout/ops.js.map +1 -1
  345. package/dist/layout/types.js.map +1 -1
  346. package/dist/nodes/2d/node-lifecycle.js.map +1 -1
  347. package/dist/nodes/2d/node-motion.js.map +1 -1
  348. package/dist/nodes/2d/node-render.d.ts +3 -3
  349. package/dist/nodes/2d/node-render.d.ts.map +1 -1
  350. package/dist/nodes/2d/node-render.js.map +1 -1
  351. package/dist/nodes/2d/node-transform.js.map +1 -1
  352. package/dist/nodes/2d/node2d.d.ts +115 -3
  353. package/dist/nodes/2d/node2d.d.ts.map +1 -1
  354. package/dist/nodes/2d/node2d.js +180 -28
  355. package/dist/nodes/2d/node2d.js.map +1 -1
  356. package/dist/nodes/2d/paint-node.d.ts +27 -0
  357. package/dist/nodes/2d/paint-node.d.ts.map +1 -1
  358. package/dist/nodes/2d/paint-node.js +42 -0
  359. package/dist/nodes/2d/paint-node.js.map +1 -1
  360. package/dist/nodes/audio/audio-bus.js.map +1 -1
  361. package/dist/nodes/audio/index.js.map +1 -1
  362. package/dist/nodes/audio/node-audio.js.map +1 -1
  363. package/dist/nodes/audio/sound-node.d.ts +2 -2
  364. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  365. package/dist/nodes/audio/sound-node.js +1 -1
  366. package/dist/nodes/audio/sound-node.js.map +1 -1
  367. package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
  368. package/dist/nodes/geometry/bounds-shape-node.js +2 -2
  369. package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
  370. package/dist/nodes/geometry/box-path-node.d.ts +3 -3
  371. package/dist/nodes/geometry/box-path-node.js +2 -2
  372. package/dist/nodes/geometry/box-path-node.js.map +1 -1
  373. package/dist/nodes/geometry/ellipse-node.js.map +1 -1
  374. package/dist/nodes/geometry/group-bounds.d.ts +2 -2
  375. package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
  376. package/dist/nodes/geometry/group-bounds.js +1 -2
  377. package/dist/nodes/geometry/group-bounds.js.map +1 -1
  378. package/dist/nodes/geometry/path-node.d.ts.map +1 -1
  379. package/dist/nodes/geometry/path-node.js +6 -0
  380. package/dist/nodes/geometry/path-node.js.map +1 -1
  381. package/dist/nodes/geometry/polygon-node.js.map +1 -1
  382. package/dist/nodes/geometry/polygram-node.js.map +1 -1
  383. package/dist/nodes/geometry/rect-node.js.map +1 -1
  384. package/dist/nodes/geometry/shape-node.js.map +1 -1
  385. package/dist/nodes/geometry/shape-outline.d.ts +2 -2
  386. package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
  387. package/dist/nodes/geometry/shape-outline.js +2 -13
  388. package/dist/nodes/geometry/shape-outline.js.map +1 -1
  389. package/dist/nodes/index.d.ts +3 -8
  390. package/dist/nodes/index.d.ts.map +1 -1
  391. package/dist/nodes/index.js +3 -8
  392. package/dist/nodes/index.js.map +1 -1
  393. package/dist/nodes/layout/camera-node.d.ts +9 -0
  394. package/dist/nodes/layout/camera-node.d.ts.map +1 -1
  395. package/dist/nodes/layout/camera-node.js +38 -3
  396. package/dist/nodes/layout/camera-node.js.map +1 -1
  397. package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
  398. package/dist/nodes/layout/orbit-camera-node.js +1 -1
  399. package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
  400. package/dist/nodes/layout/rotated-box.js.map +1 -1
  401. package/dist/nodes/media/video-node.d.ts.map +1 -1
  402. package/dist/nodes/media/video-node.js +2 -0
  403. package/dist/nodes/media/video-node.js.map +1 -1
  404. package/dist/nodes/node/declare-paints.js.map +1 -1
  405. package/dist/nodes/node/node-editor-state.js.map +1 -1
  406. package/dist/nodes/node/node-reactive.js.map +1 -1
  407. package/dist/nodes/node/node-time.d.ts +3 -3
  408. package/dist/nodes/node/node-time.d.ts.map +1 -1
  409. package/dist/nodes/node/node-time.js +1 -1
  410. package/dist/nodes/node/node-time.js.map +1 -1
  411. package/dist/nodes/node/node-walk.js.map +1 -1
  412. package/dist/nodes/node/node.d.ts +5 -3
  413. package/dist/nodes/node/node.d.ts.map +1 -1
  414. package/dist/nodes/node/node.js +44 -19
  415. package/dist/nodes/node/node.js.map +1 -1
  416. package/dist/nodes/node/text-defaults.d.ts +10 -12
  417. package/dist/nodes/node/text-defaults.d.ts.map +1 -1
  418. package/dist/nodes/node/text-defaults.js +10 -12
  419. package/dist/nodes/node/text-defaults.js.map +1 -1
  420. package/dist/nodes/{scene → root}/canvas2d-node.d.ts +2 -2
  421. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
  422. package/dist/nodes/{scene → root}/canvas2d-node.js +2 -2
  423. package/dist/nodes/root/canvas2d-node.js.map +1 -0
  424. package/dist/nodes/root/provider-node.d.ts.map +1 -0
  425. package/dist/nodes/root/provider-node.js.map +1 -0
  426. package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
  427. package/dist/nodes/root/theme-provider-node.js.map +1 -0
  428. package/dist/nodes/text/default-text-style-node.d.ts +5 -2
  429. package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
  430. package/dist/nodes/text/default-text-style-node.js +10 -4
  431. package/dist/nodes/text/default-text-style-node.js.map +1 -1
  432. package/dist/nodes/text/number-format.d.ts +1 -1
  433. package/dist/nodes/text/number-format.js +1 -1
  434. package/dist/nodes/text/number-format.js.map +1 -1
  435. package/dist/nodes/text/number-node.js.map +1 -1
  436. package/dist/nodes/text/number-pattern.js.map +1 -1
  437. package/dist/nodes/text/richtext-node.js +1 -1
  438. package/dist/nodes/text/richtext-node.js.map +1 -1
  439. package/dist/nodes/text/text-base.d.ts.map +1 -1
  440. package/dist/nodes/text/text-base.js +1 -1
  441. package/dist/nodes/text/text-base.js.map +1 -1
  442. package/dist/nodes/text/text-node.js.map +1 -1
  443. package/dist/nodes/text/text-selection.js.map +1 -1
  444. package/dist/nodes/three/camera-nodes.d.ts +21 -3
  445. package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
  446. package/dist/nodes/three/camera-nodes.js +42 -1
  447. package/dist/nodes/three/camera-nodes.js.map +1 -1
  448. package/dist/nodes/three/canvas3d-node.d.ts +29 -6
  449. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  450. package/dist/nodes/three/canvas3d-node.js +44 -2
  451. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  452. package/dist/nodes/three/drawable-nodes.d.ts +25 -11
  453. package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
  454. package/dist/nodes/three/drawable-nodes.js +43 -13
  455. package/dist/nodes/three/drawable-nodes.js.map +1 -1
  456. package/dist/nodes/three/environment-nodes.d.ts +9 -3
  457. package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
  458. package/dist/nodes/three/environment-nodes.js.map +1 -1
  459. package/dist/nodes/three/geometry-nodes.d.ts +2 -2
  460. package/dist/nodes/three/geometry-nodes.js +2 -2
  461. package/dist/nodes/three/geometry-nodes.js.map +1 -1
  462. package/dist/nodes/three/grid-geometry3d.js.map +1 -1
  463. package/dist/nodes/three/group3d.js.map +1 -1
  464. package/dist/nodes/three/light-nodes.d.ts.map +1 -1
  465. package/dist/nodes/three/light-nodes.js +3 -3
  466. package/dist/nodes/three/light-nodes.js.map +1 -1
  467. package/dist/nodes/three/mesh3d.js.map +1 -1
  468. package/dist/nodes/three/node3d.d.ts +48 -0
  469. package/dist/nodes/three/node3d.d.ts.map +1 -1
  470. package/dist/nodes/three/node3d.js +53 -3
  471. package/dist/nodes/three/node3d.js.map +1 -1
  472. package/dist/platform/audio-sink.d.ts +2 -2
  473. package/dist/platform/audio-sink.d.ts.map +1 -1
  474. package/dist/platform/audio-sink.js.map +1 -1
  475. package/dist/platform/exporter.d.ts +13 -8
  476. package/dist/platform/exporter.d.ts.map +1 -1
  477. package/dist/platform/exporter.js.map +1 -1
  478. package/dist/platform/index.d.ts +1 -1
  479. package/dist/platform/index.d.ts.map +1 -1
  480. package/dist/platform/index.js.map +1 -1
  481. package/dist/platform/stepped-clock.js.map +1 -1
  482. package/dist/platform/storage-adapter.d.ts +12 -6
  483. package/dist/platform/storage-adapter.d.ts.map +1 -1
  484. package/dist/platform/storage-adapter.js +4 -0
  485. package/dist/platform/storage-adapter.js.map +1 -1
  486. package/dist/platform/ticker.d.ts +6 -0
  487. package/dist/platform/ticker.d.ts.map +1 -1
  488. package/dist/platform/ticker.js +6 -0
  489. package/dist/platform/ticker.js.map +1 -1
  490. package/dist/project/config.js.map +1 -1
  491. package/dist/project/index.js.map +1 -1
  492. package/dist/project/tree.d.ts +3 -3
  493. package/dist/project/tree.d.ts.map +1 -1
  494. package/dist/project/tree.js.map +1 -1
  495. package/dist/props/host.js.map +1 -1
  496. package/dist/props/index.js.map +1 -1
  497. package/dist/props/observer.js.map +1 -1
  498. package/dist/props/slot.js.map +1 -1
  499. package/dist/renamed-scene-names.d.ts +17 -0
  500. package/dist/renamed-scene-names.d.ts.map +1 -0
  501. package/dist/renamed-scene-names.js +9 -0
  502. package/dist/renamed-scene-names.js.map +1 -0
  503. package/dist/render/canvas-render-context2d.d.ts +2 -2
  504. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  505. package/dist/render/canvas-render-context2d.js.map +1 -1
  506. package/dist/render/clip-contains.js.map +1 -1
  507. package/dist/render/clip.js.map +1 -1
  508. package/dist/render/descriptors/ellipse.js.map +1 -1
  509. package/dist/render/descriptors/latex.js.map +1 -1
  510. package/dist/render/descriptors/line.js.map +1 -1
  511. package/dist/render/descriptors/path-builder.js.map +1 -1
  512. package/dist/render/descriptors/path.js.map +1 -1
  513. package/dist/render/descriptors/polygon.js.map +1 -1
  514. package/dist/render/descriptors/polygram.js.map +1 -1
  515. package/dist/render/descriptors/rect.js.map +1 -1
  516. package/dist/render/descriptors/richtext.js.map +1 -1
  517. package/dist/render/descriptors/shape.d.ts +12 -0
  518. package/dist/render/descriptors/shape.d.ts.map +1 -1
  519. package/dist/render/descriptors/shape.js.map +1 -1
  520. package/dist/render/descriptors/text.d.ts +2 -2
  521. package/dist/render/descriptors/text.js +2 -2
  522. package/dist/render/descriptors/text.js.map +1 -1
  523. package/dist/render/descriptors/transform.d.ts +2 -2
  524. package/dist/render/descriptors/transform.d.ts.map +1 -1
  525. package/dist/render/descriptors/transform.js.map +1 -1
  526. package/dist/render/graphics2d.d.ts +3 -3
  527. package/dist/render/graphics2d.d.ts.map +1 -1
  528. package/dist/render/graphics2d.js +1 -1
  529. package/dist/render/graphics2d.js.map +1 -1
  530. package/dist/render/index.js.map +1 -1
  531. package/dist/render/measure-context.js.map +1 -1
  532. package/dist/render/null-render-context.js.map +1 -1
  533. package/dist/render/render-context2d.d.ts +2 -2
  534. package/dist/render/render-context2d.d.ts.map +1 -1
  535. package/dist/render/render-context2d.js.map +1 -1
  536. package/dist/render/surface.js.map +1 -1
  537. package/dist/render/text-defaults.js.map +1 -1
  538. package/dist/render/text-layout.js.map +1 -1
  539. package/dist/render3d/bounds3d.d.ts.map +1 -1
  540. package/dist/render3d/bounds3d.js +4 -2
  541. package/dist/render3d/bounds3d.js.map +1 -1
  542. package/dist/render3d/builders.js.map +1 -1
  543. package/dist/render3d/camera.d.ts +6 -0
  544. package/dist/render3d/camera.d.ts.map +1 -1
  545. package/dist/render3d/camera.js +5 -3
  546. package/dist/render3d/camera.js.map +1 -1
  547. package/dist/render3d/fill3d.d.ts +2 -9
  548. package/dist/render3d/fill3d.d.ts.map +1 -1
  549. package/dist/render3d/fill3d.js +2 -13
  550. package/dist/render3d/fill3d.js.map +1 -1
  551. package/dist/render3d/geometry.d.ts +8 -1
  552. package/dist/render3d/geometry.d.ts.map +1 -1
  553. package/dist/render3d/geometry.js.map +1 -1
  554. package/dist/render3d/graphics3d.d.ts +8 -4
  555. package/dist/render3d/graphics3d.d.ts.map +1 -1
  556. package/dist/render3d/graphics3d.js +18 -10
  557. package/dist/render3d/graphics3d.js.map +1 -1
  558. package/dist/render3d/index.d.ts +1 -1
  559. package/dist/render3d/index.js +1 -1
  560. package/dist/render3d/index.js.map +1 -1
  561. package/dist/render3d/inert.d.ts +14 -0
  562. package/dist/render3d/inert.d.ts.map +1 -0
  563. package/dist/render3d/inert.js +62 -0
  564. package/dist/render3d/inert.js.map +1 -0
  565. package/dist/render3d/light.js.map +1 -1
  566. package/dist/render3d/material.d.ts +10 -5
  567. package/dist/render3d/material.d.ts.map +1 -1
  568. package/dist/render3d/material.js.map +1 -1
  569. package/dist/render3d/matrix4.js.map +1 -1
  570. package/dist/render3d/render-context3d.js.map +1 -1
  571. package/dist/render3d/resources.js.map +1 -1
  572. package/dist/render3d/rounded-box.js.map +1 -1
  573. package/dist/render3d/scene-settings.d.ts +23 -4
  574. package/dist/render3d/scene-settings.d.ts.map +1 -1
  575. package/dist/render3d/scene-settings.js.map +1 -1
  576. package/dist/render3d/scene3d.d.ts +11 -0
  577. package/dist/render3d/scene3d.d.ts.map +1 -1
  578. package/dist/render3d/scene3d.js +39 -6
  579. package/dist/render3d/scene3d.js.map +1 -1
  580. package/dist/render3d/segments.js.map +1 -1
  581. package/dist/render3d/texture.d.ts +9 -0
  582. package/dist/render3d/texture.d.ts.map +1 -1
  583. package/dist/render3d/texture.js +13 -0
  584. package/dist/render3d/texture.js.map +1 -1
  585. package/dist/render3d/tracking.js.map +1 -1
  586. package/dist/render3d/transform.d.ts +1 -1
  587. package/dist/render3d/transform.js.map +1 -1
  588. package/dist/render3d/vector3.d.ts +18 -1
  589. package/dist/render3d/vector3.d.ts.map +1 -1
  590. package/dist/render3d/vector3.js +27 -0
  591. package/dist/render3d/vector3.js.map +1 -1
  592. package/dist/render3d/walk.d.ts +1 -1
  593. package/dist/render3d/walk.d.ts.map +1 -1
  594. package/dist/render3d/walk.js +5 -1
  595. package/dist/render3d/walk.js.map +1 -1
  596. package/dist/runtime/asset-refine.js.map +1 -1
  597. package/dist/runtime/asset-timeline.js.map +1 -1
  598. package/dist/runtime/asset-update.js.map +1 -1
  599. package/dist/runtime/audio-index.js.map +1 -1
  600. package/dist/runtime/builtin-context.js.map +1 -1
  601. package/dist/runtime/clip-instance.d.ts +5 -3
  602. package/dist/runtime/clip-instance.d.ts.map +1 -1
  603. package/dist/runtime/clip-instance.js +10 -6
  604. package/dist/runtime/clip-instance.js.map +1 -1
  605. package/dist/runtime/clip-store.d.ts +9 -0
  606. package/dist/runtime/clip-store.d.ts.map +1 -1
  607. package/dist/runtime/clip-store.js +19 -0
  608. package/dist/runtime/clip-store.js.map +1 -1
  609. package/dist/runtime/engine.d.ts +5 -0
  610. package/dist/runtime/engine.d.ts.map +1 -1
  611. package/dist/runtime/engine.js +2 -0
  612. package/dist/runtime/engine.js.map +1 -1
  613. package/dist/runtime/frame-time.d.ts +31 -0
  614. package/dist/runtime/frame-time.d.ts.map +1 -0
  615. package/dist/runtime/frame-time.js +29 -0
  616. package/dist/runtime/frame-time.js.map +1 -0
  617. package/dist/runtime/index.d.ts +1 -0
  618. package/dist/runtime/index.d.ts.map +1 -1
  619. package/dist/runtime/index.js +1 -0
  620. package/dist/runtime/index.js.map +1 -1
  621. package/dist/runtime/node-picking.d.ts +44 -3
  622. package/dist/runtime/node-picking.d.ts.map +1 -1
  623. package/dist/runtime/node-picking.js +118 -3
  624. package/dist/runtime/node-picking.js.map +1 -1
  625. package/dist/runtime/node-picking3d.d.ts +2 -1
  626. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  627. package/dist/runtime/node-picking3d.js +5 -2
  628. package/dist/runtime/node-picking3d.js.map +1 -1
  629. package/dist/runtime/placement.d.ts.map +1 -1
  630. package/dist/runtime/placement.js +4 -5
  631. package/dist/runtime/placement.js.map +1 -1
  632. package/dist/runtime/playback-controller.d.ts +31 -2
  633. package/dist/runtime/playback-controller.d.ts.map +1 -1
  634. package/dist/runtime/playback-controller.js +63 -6
  635. package/dist/runtime/playback-controller.js.map +1 -1
  636. package/dist/runtime/playback.js.map +1 -1
  637. package/dist/runtime/precompisition.js.map +1 -1
  638. package/dist/runtime/project-assets.js.map +1 -1
  639. package/dist/runtime/session.d.ts +9 -7
  640. package/dist/runtime/session.d.ts.map +1 -1
  641. package/dist/runtime/session.js +12 -4
  642. package/dist/runtime/session.js.map +1 -1
  643. package/dist/runtime/settle.js.map +1 -1
  644. package/dist/runtime/state-evaluator.d.ts +1 -1
  645. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  646. package/dist/runtime/state-evaluator.js +4 -3
  647. package/dist/runtime/state-evaluator.js.map +1 -1
  648. package/dist/runtime/text-geometry.js.map +1 -1
  649. package/dist/sdk/index.d.ts +19 -15
  650. package/dist/sdk/index.d.ts.map +1 -1
  651. package/dist/sdk/index.js +11 -6
  652. package/dist/sdk/index.js.map +1 -1
  653. package/dist/tween/command-decorator.d.ts +2 -0
  654. package/dist/tween/command-decorator.d.ts.map +1 -1
  655. package/dist/tween/command-decorator.js.map +1 -1
  656. package/dist/tween/command.js.map +1 -1
  657. package/dist/tween/ease/constants.d.ts.map +1 -1
  658. package/dist/tween/ease/constants.js +8 -5
  659. package/dist/tween/ease/constants.js.map +1 -1
  660. package/dist/tween/ease/curve.d.ts.map +1 -1
  661. package/dist/tween/ease/curve.js +4 -3
  662. package/dist/tween/ease/curve.js.map +1 -1
  663. package/dist/tween/ease/describe.d.ts +15 -0
  664. package/dist/tween/ease/describe.d.ts.map +1 -0
  665. package/dist/tween/ease/describe.js +37 -0
  666. package/dist/tween/ease/describe.js.map +1 -0
  667. package/dist/tween/ease/type.js.map +1 -1
  668. package/dist/tween/index.js.map +1 -1
  669. package/dist/tween/inert.js.map +1 -1
  670. package/dist/tween/lerp.js.map +1 -1
  671. package/dist/tween/loop.js.map +1 -1
  672. package/dist/tween/prepare.d.ts +3 -3
  673. package/dist/tween/prepare.js +3 -3
  674. package/dist/tween/prepare.js.map +1 -1
  675. package/dist/tween/seekable.d.ts +1 -1
  676. package/dist/tween/seekable.js.map +1 -1
  677. package/dist/tween/stepper.js.map +1 -1
  678. package/dist/tween/to-command.js.map +1 -1
  679. package/dist/util/clamp.js.map +1 -1
  680. package/dist/util/context.js.map +1 -1
  681. package/dist/util/csv.js.map +1 -1
  682. package/dist/util/generateList.js.map +1 -1
  683. package/dist/util/index.js.map +1 -1
  684. package/dist/util/metrics.d.ts +1 -1
  685. package/dist/util/metrics.js +1 -1
  686. package/dist/util/metrics.js.map +1 -1
  687. package/dist/util/random.js.map +1 -1
  688. package/dist/util/reference.js.map +1 -1
  689. package/dist/util/scheduler.js.map +1 -1
  690. package/package.json +2 -1
  691. package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
  692. package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
  693. package/dist/attributes/shape/effects/implementations/displace.js +0 -30
  694. package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
  695. package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
  696. package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
  697. package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
  698. package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
  699. package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
  700. package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
  701. package/dist/attributes/shape/effects/implementations/texture.js +0 -25
  702. package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
  703. package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
  704. package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
  705. package/dist/attributes/shape/effects/implementations/trails.js +0 -22
  706. package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
  707. package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
  708. package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
  709. package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
  710. package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
  711. package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
  712. package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
  713. package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
  714. package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
  715. package/dist/nodes/geometry/dot-grid-node.js +0 -142
  716. package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
  717. package/dist/nodes/geometry/grid-lines.d.ts +0 -101
  718. package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
  719. package/dist/nodes/geometry/grid-lines.js +0 -128
  720. package/dist/nodes/geometry/grid-lines.js.map +0 -1
  721. package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
  722. package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
  723. package/dist/nodes/geometry/grid-pattern-node.js +0 -172
  724. package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
  725. package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
  726. package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
  727. package/dist/nodes/geometry/line-grid-node.js +0 -127
  728. package/dist/nodes/geometry/line-grid-node.js.map +0 -1
  729. package/dist/nodes/geometry/line-node.d.ts +0 -58
  730. package/dist/nodes/geometry/line-node.d.ts.map +0 -1
  731. package/dist/nodes/geometry/line-node.js +0 -123
  732. package/dist/nodes/geometry/line-node.js.map +0 -1
  733. package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
  734. package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
  735. package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
  736. package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
  737. package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
  738. package/dist/nodes/scene/canvas2d-node.js.map +0 -1
  739. package/dist/nodes/scene/provider-node.d.ts.map +0 -1
  740. package/dist/nodes/scene/provider-node.js.map +0 -1
  741. package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
  742. package/dist/nodes/scene/theme-provider-node.js.map +0 -1
  743. /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
  744. /package/dist/nodes/{scene → root}/provider-node.js +0 -0
  745. /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
  746. /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/document/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAuB,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,cAAc,EAA8C,MAAM,2BAA2B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,CAAC;YAC7B,KAAK,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC;YACjC,KAAK,QAAQ;gBACT,IAAI,KAAK,KAAK,IAAI;oBAAE,OAAO,SAAS,CAAC;gBACrC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;oBAClE,CAAC,CAAC,QAAQ;oBACV,CAAC,CAAC,QAAQ,CAAC;YACnB,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;QAC9B,CAAC;IACL,CAAC;IAED,sFAAsF;IAC9E,aAAa,CAAC,IAAuC;QACzD,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC5B,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;IAC/F,CAAC","sourcesContent":["import type { Node, NodeDimension } from \"@/nodes/node/node\";\nimport type { Command, CommandArgs } from \"@/tween/command\";\nimport type { EasingFunction } from \"@/tween/ease/type\";\nimport { getPropertyMeta, type PropertyEditor } from \"@/attributes/properties/decorator\";\nimport { getCommandMeta, type CommandArg, type CommandArgDescriptor } from \"@/tween/command-decorator\";\nimport {\n normalizeShaderPack,\n type EffectShader,\n type FillShader,\n type Shader,\n} from \"@/attributes/shape/shaders/pack\";\nimport { installBuiltins } from \"./builtins\";\nimport { DENIED_GLOBALS } from \"./deny-globals\";\nimport { getNodeDescriptor } from \"./node-decorator\";\nimport type { NodePropertyDescriptor, NodeTypeDescriptor } from \"./node-descriptor\";\nimport type { NodeSpec } from \"./types\";\n\n/**\n * The specifiers a dynamic node's `require()` resolves to the host's sdk\n * barrel (and, with `/jsx-runtime` appended, to its JSX runtime). The published\n * name comes first; the two after it are the package's earlier unscoped names,\n * kept so a script authored under either still compiles.\n */\nconst SDK_SPECIFIERS: readonly string[] = [\"@motionscript/sdk\", \"motionscript\", \"motion-script\"];\n\n/**\n * The **code** half of the document model, as one object an engine owns.\n *\n * A document names a node type, a command, a lerp and a shader with a string.\n * Something has to turn `\"rect\"` into a class and `\"fillTo\"` into an animation,\n * and that something is deliberately a registry rather than a table in the\n * database: node types are code — a class with `@property` declarations, a\n * `renderSelf`, and `@command()` methods — and code is versioned with the\n * library, not with the document.\n *\n * **It is an instance, not a module.** Every table here used to be a\n * module-scope `Map` behind a dozen free functions, which made a registration\n * a fact about the *process*: two engines in one process shared one vocabulary,\n * a decorated class was registered by the mere act of being imported, whichever\n * host loaded first won a contested key, and a test had to remember to call a\n * `clearRegistries()` that reached into three modules. A registry is now a value\n * with an owner — an `Engine`'s own, reached through `registerNode`/`registerShader`\n * rather than a public `registry` field — so what a document can name is a\n * property of the engine opening it, and two engines disagree about it freely.\n *\n * ```ts\n * const registry = new Registry({ nodes: [Blob], shaders: { swirl: SWIRL } });\n * registry.commandKeys(\"blob\"); // [\"fadeTo\", \"moveTo\", …, \"wobbleTo\"]\n * ```\n *\n * **Commands are per node type, and that is the point.** They used to share one\n * flat table with the node types, which made a command key a global claim: the\n * first package to register `reveal` owned the word, and a second node type\n * wanting it — with different arguments — could not have it. Nothing about a\n * command is global, though: it is a method on a class, dispatched against an\n * instance the document already names. Only the handful that must resolve\n * *without* a node — the variable-scoped ones and the generic prop writers — sit\n * in a table of their own.\n */\n\n/** Constructs a node from its authored props. Every built-in node class matches this. */\nexport type NodeConstructor = new (props?: Record<string, unknown>) => Node;\n\n/** Node types a registry makes available, by the key a document names them with. */\nexport type NodeTypeMap = Record<string, NodeConstructor>;\n\n/** Shader packs a registry makes available, by document key. A pack is plain JSON. */\nexport type ShaderPackMap = Record<string, unknown>;\n\n/**\n * Builds the {@link Command} a `CommandSpec` stands for.\n *\n * Called **once per compile**, in timeline order, with `target` already in the\n * state the previous command left it — that is what fixes the command's `from`\n * value and makes the returned `Command.at(t)` pure thereafter. See\n * `tween/command.ts` and `document/timeline.ts`.\n *\n * @param target The node the command acts on (the scene root for `targetId: null`).\n * @param args The spec's `args`, verbatim.\n * @param duration Seconds, already defaulted by the caller.\n * @param easing Resolved from the spec's `EaseSpec`, or `undefined`.\n */\nexport type CommandFactory = (\n target: Node,\n args: Record<string, unknown>,\n duration: number,\n easing?: EasingFunction,\n) => Command<Record<string, unknown>>;\n\n/**\n * The variable a variable command writes.\n *\n * A handle rather than the cell itself, so a command cannot subscribe to it,\n * rebind it, or hold it past the build that made it — the three ways a command\n * could stop being a pure function of `t`.\n */\nexport interface VariableTarget {\n /** The id an expression names with `[id]`. */\n readonly id: string;\n /** What it holds right now. */\n get(): unknown;\n set(value: unknown): void;\n /**\n * The lerp its `VariableSpec.lerp` resolved to. A command is free to use a\n * different one when its args ask for it — `variableTo` does.\n */\n readonly lerp: VariableLerp;\n}\n\n/**\n * Builds the {@link Command} a variable-scoped `CommandSpec` stands for.\n *\n * Same contract as {@link CommandFactory} — called once per compile, in timeline\n * order, against a variable already holding what its predecessors left — with a\n * {@link VariableTarget} in place of a node.\n */\nexport type VariableCommandFactory = (\n target: VariableTarget,\n args: Record<string, unknown>,\n duration: number,\n easing?: EasingFunction,\n) => Command<Record<string, unknown>>;\n\n/**\n * How a variable's value interpolates between two states.\n *\n * The same shape every `@property` tween already has, widened to `unknown`\n * because a variable's type is a fact of the document rather than of a class:\n * one holds a number, the next a colour string, the next a whole fill object.\n */\nexport type VariableLerp = (from: unknown, to: unknown, t: number) => unknown;\n\n/**\n * One command that resolves without a node.\n *\n * `scope` says which table `CommandSpec.targetId` is looked up in, and is what\n * lets a variable command reuse the same field a node command uses instead of\n * inventing a second one every host's timeline would then have to special-case.\n */\nexport type CommandTypeEntry =\n | {\n key: string;\n scope: \"node\";\n factory: CommandFactory;\n /**\n * Its leading parameters, as {@link NodeCommandEntry.args} describes a\n * node command's — declared by the paint commands, which read one key\n * each. Absent for `to`/`set`, whose args *are* the props diff.\n */\n args?: readonly CommandArgDescriptor[];\n /**\n * This command **writes props declaratively**, so an expression in its\n * args compiles to a binding rather than being passed through as a\n * string. `set` is the only built-in that does.\n *\n * A flag rather than a name check, because the distinction is real: `to`\n * tweens *towards* a value and a formula is not a value, so binding one\n * as a tween destination would interpolate towards `NaN` and look like a\n * renderer bug. A command opting in is saying its args reach `set()`.\n */\n binds?: boolean;\n }\n | {\n key: string;\n scope: \"variable\";\n factory: VariableCommandFactory;\n };\n\n/**\n * One node type's own command table.\n *\n * Built from the class's `@command()` methods — the **whole** prototype chain,\n * not just its own — because the table is per type. A `Card` extending `Rect`\n * answers to `fadeTo` for the same reason it answers to `.fadeTo()`: it has the\n * method. There is nothing here for two node types to collide over, so\n * inherited entries can simply be copied into each.\n */\nexport interface NodeTypeRecord {\n /** The document key, matching `NodeSpec.type`. */\n key: string;\n /** The class to construct. */\n ctor: NodeConstructor;\n /** Its commands, by the key a document names them with. */\n commands: ReadonlyMap<string, NodeCommandEntry>;\n /**\n * What the type declares about itself — see {@link NodeTypeDescriptor}.\n *\n * Always present, so a host reads one shape whether the type was registered\n * with a bare key, a full descriptor, or a decorated class.\n */\n descriptor: NodeTypeDescriptor;\n}\n\n/** One command on one node type. */\nexport interface NodeCommandEntry {\n /** The method to call. */\n method: string;\n /**\n * Its leading parameters, from `@command({ args })`, always as descriptors.\n *\n * A bare name normalises to `{ key, kind: \"unknown\" }`, so a host reads one\n * shape whether the method bothered to describe its arguments or not.\n */\n args: readonly CommandArgDescriptor[];\n}\n\n/**\n * How a registry compiles and links a node authored as a TS/JSX source\n * string, via {@link Registry.addNodeFromSource}.\n *\n * Entirely host-supplied — `core` has no compiler dependency and cannot\n * import the published `@motionscript/sdk` barrel itself (that package\n * depends on `core`, so the reverse direction would be circular).\n */\nexport interface DynamicNodeConfig {\n /**\n * What `require(\"@motionscript/sdk\")` resolves to inside a compiled\n * script — the host's own already-loaded sdk barrel instance. Must be the\n * same module instance the rest of the app uses, or `instanceof` silently\n * fails against it. The earlier unscoped specifiers, `\"motionscript\"` and\n * the dashed `\"motion-script\"`, resolve to the same object, so a node\n * script authored under either name keeps compiling unmodified.\n */\n sdk: Record<string, unknown>;\n /**\n * What `require(\"@motionscript/sdk/jsx-runtime\")` resolves to (also under\n * the legacy `motionscript/jsx-runtime` and `motion-script/jsx-runtime`\n * specifiers). Omit to reject a script that uses JSX outright.\n */\n jsxRuntime?: Record<string, unknown>;\n /**\n * Further modules a script may `require`, by exact specifier — what a\n * forked component imports beyond the sdk barrel:\n * `@motionscript/sdk/component`, its package's kit. Consulted after the\n * two above, so neither can be shadowed. Each value has to be the host's\n * own loaded instance, for the same `instanceof` reason as `sdk`.\n */\n modules?: Readonly<Record<string, unknown>>;\n /**\n * TS/JSX source → JS text (CommonJS). Host-injected, never bundled —\n * `core` has no compiler dependency of its own.\n */\n compile: (source: string) => Promise<string>;\n}\n\n/** What a registry is seeded with, on top of the builtin vocabulary. */\nexport interface RegistryOptions {\n /**\n * Custom node types — decorated classes, or explicit keys.\n *\n * An array reads each class's `@node()` declaration; a record names the key\n * outright, which is also an assertion that the two agree (a rename on\n * either side throws here rather than surfacing as an unknown type at\n * render).\n */\n nodes?: NodeTypeMap | readonly NodeConstructor[];\n /** Shader packs, by document key. Plain JSON — normalised on the way in. */\n shaders?: ShaderPackMap;\n /** Extra variable interpolations, on top of `number`/`vector2`/`vector3`/`color`/`step`. */\n lerps?: Record<string, VariableLerp>;\n /** Custom eases, referenced from a document as `{ kind: \"custom\", args: key }`. */\n eases?: Record<string, EasingFunction>;\n /** Enables {@link Registry.addNodeFromSource} — see {@link DynamicNodeConfig}. */\n dynamicNodes?: DynamicNodeConfig;\n /**\n * Leave out everything the library itself ships. Only useful to a test\n * asserting on the seeding, or a host building a deliberately tiny\n * vocabulary — a document naming `\"rect\"` will not compile without it.\n */\n builtins?: boolean;\n}\n\n/** See the module docblock. */\nexport class Registry {\n /** Ceiling, so an import cannot evict a workspace's own shaders by volume. */\n static readonly MAX_SHADERS = 512;\n\n constructor(options: RegistryOptions = {}) {\n this._dynamicNodes = options.dynamicNodes;\n if (options.builtins !== false) installBuiltins(this);\n if (Array.isArray(options.nodes)) {\n for (const ctor of options.nodes) this.addNode(ctor);\n } else {\n for (const [key, ctor] of Object.entries(options.nodes ?? {})) this.addNode(key, ctor);\n }\n for (const [key, lerp] of Object.entries(options.lerps ?? {})) this.addLerp(key, lerp);\n for (const [key, ease] of Object.entries(options.eases ?? {})) this.addEase(key, ease);\n for (const [key, pack] of Object.entries(options.shaders ?? {})) this.addShader(key, pack);\n }\n\n // ─── Node types ──────────────────────────────────────────────────────────\n\n /**\n * Register a node class, with its commands and whatever else it declares.\n *\n * Takes a decorated class on its own, or a bare key / full\n * {@link NodeTypeDescriptor} plus the class. The descriptor is the code half\n * of what a component package used to restate in a `manifest.json` —\n * carried, never interpreted, so a host has one place to ask and no second\n * file to disagree with the class.\n *\n * The commands come off the class, so `@command()` is the only place a\n * node's animations are written down. Nothing is constructed to read them:\n * `@command` records onto the prototype, so an object *over* the prototype\n * reaches the whole chain without running a constructor that may expect\n * props, build children, or touch a clock.\n *\n * Re-registering the same class under the same key is a no-op, so a hot\n * reload or a duplicated dependency is harmless. Re-registering a\n * *different* class throws: two classes answering to one key means a\n * document renders differently depending on registration order, which is not\n * a failure anyone would find by looking at the document.\n *\n * Pass `{ replace: true }` to opt out of that throw — the one case it's\n * wrong for is a node whose source has genuinely been edited and\n * recompiled (see {@link addNodeFromSource}), where re-registering under\n * the same key with a new class is the whole point. The default stays a\n * throw; this is deliberately not the common path.\n */\n addNode(ctor: NodeConstructor, options?: { replace?: boolean }): this;\n addNode(type: string | NodeTypeDescriptor, ctor: NodeConstructor, options?: { replace?: boolean }): this;\n addNode(\n type: string | NodeTypeDescriptor | NodeConstructor,\n ctorOrOptions?: NodeConstructor | { replace?: boolean },\n maybeOptions?: { replace?: boolean },\n ): this {\n const isTwoArgForm = typeof ctorOrOptions === \"function\";\n const cls = (isTwoArgForm ? ctorOrOptions : type) as NodeConstructor;\n const options = isTwoArgForm ? maybeOptions : ctorOrOptions as { replace?: boolean } | undefined;\n const declared = isTwoArgForm ? type as string | NodeTypeDescriptor : getNodeDescriptor(cls);\n if (declared === undefined) {\n throw new Error(\n `${cls.name || \"The class\"} carries no @node(...) declaration, so it has no ` +\n `document key. Decorate it, or register it explicitly: addNode(\"myKey\", TheClass).`,\n );\n }\n const descriptor: NodeTypeDescriptor = typeof declared === \"string\" ? { key: declared } : declared;\n const key = descriptor.key;\n\n const existing = this._nodes.get(key);\n if (existing) {\n if (existing.ctor === cls) return this;\n if (!options?.replace) {\n throw new Error(\n `Node type \"${key}\" is already registered to a different class ` +\n `(${existing.ctor.name} vs ${cls.name}). Keys must be unique — a document ` +\n `naming this type would otherwise resolve differently depending on registration order.`,\n );\n }\n }\n\n const commands = new Map<string, NodeCommandEntry>();\n for (const meta of getCommandMeta(Object.create(cls.prototype) as object)) {\n commands.set(meta.key, { method: meta.method, args: this._describeArgs(meta.args) });\n }\n\n this._nodes.set(key, {\n key,\n ctor: cls,\n commands,\n // Derived, never declared: see `NodeTypeDescriptor.properties`.\n descriptor: {\n ...descriptor,\n dimension: this._describeDimension(cls),\n properties: this._describeProperties(cls),\n },\n });\n return this;\n }\n\n /**\n * Compile a TS/JSX source string into a live node class and register it.\n *\n * The script must `export default` a class carrying `@node(...)` — that\n * decorator is what supplies the registry key, exactly as {@link addNode}\n * already reads it off a statically-imported class. There is no separate\n * `key` parameter: one way to name a dynamic node's key, not two that\n * could disagree.\n *\n * Requires `dynamicNodes` to have been passed to the constructor — see\n * {@link DynamicNodeConfig}. `core` never compiles anything itself; this\n * only calls the host-supplied `compile` and links its result.\n */\n async addNodeFromSource(source: string, options?: { replace?: boolean }): Promise<NodeConstructor> {\n if (!this._dynamicNodes) {\n throw new Error(\n \"addNodeFromSource needs `dynamicNodes: { sdk, compile }` on the Registry constructor.\",\n );\n }\n const js = await this._dynamicNodes.compile(source);\n const ctor = this._evalNodeModule(js);\n this.addNode(ctor, options);\n return ctor;\n }\n\n /** Everything registered under `key`, or `undefined`. */\n node(key: string): NodeTypeRecord | undefined {\n return this._nodes.get(key);\n }\n\n /** Whether a document naming `key` can be compiled against this registry. */\n hasNode(key: string): boolean {\n return this._nodes.has(key);\n }\n\n /** Every registered node key, for a host offering a palette. Sorted, so the order is stable. */\n nodeKeys(): string[] {\n return [...this._nodes.keys()].sort();\n }\n\n /** What `key` declares about itself, or `undefined` if it is not registered. */\n describe(key: string): NodeTypeDescriptor | undefined {\n return this._nodes.get(key)?.descriptor;\n }\n\n /**\n * Build a node from its spec. Throws on an unknown type.\n *\n * `props` overrides the spec's own, which is how the timeline keeps an\n * expression out of a constructor: an expression-bound prop is left out of\n * what is passed here and written afterwards with `set()`. Constructors read\n * their raw props to decide things like a default size, and a `() => number`\n * is not an answer to that question. The spec's `id` outranks both, so\n * {@link Node.id} is the document's own identity rather than a per-instance\n * UUID — without it a host could never resolve a node it addressed by id.\n *\n * `key` rides along the same way, and only when the row carries one:\n * `applyEditorStates` keys the whole editor-state record on {@link Node.key},\n * so a row whose key never reached the node is a node a host cannot hide or\n * lock — and overwriting one passed in `props` with an absent row-level key\n * would take that away from a caller who had it working.\n */\n instantiate(spec: NodeSpec, props?: Record<string, unknown>): Node {\n const record = this._nodes.get(spec.type);\n if (!record) {\n throw new Error(\n `Unknown node type \"${spec.type}\" (node ${spec.id}). ` +\n `This registry knows: ${this.nodeKeys().join(\", \") || \"nothing\"}.`,\n );\n }\n return new record.ctor({\n ...(props ?? spec.props),\n id: spec.id,\n ...(spec.key !== undefined && { key: spec.key }),\n });\n }\n\n // ─── Commands ────────────────────────────────────────────────────────────\n\n /**\n * Register a command that resolves **without** a node — see\n * {@link CommandTypeEntry}. Same uniqueness rule as {@link addNode}.\n */\n addCommand(\n key: string,\n factory: CommandFactory,\n options?: { binds?: boolean; args?: readonly CommandArg[] },\n ): this {\n if (this._claimed(key, factory)) return this;\n this._commands.set(key, {\n key,\n scope: \"node\",\n factory,\n ...(options?.args ? { args: this._describeArgs(options.args) } : {}),\n binds: options?.binds,\n });\n return this;\n }\n\n /**\n * Register a command that writes a **variable** rather than a node.\n *\n * The seam a host reaches for to add its own — a spring, a wiggle, a\n * sample-and-hold — without touching the timeline. `CommandSpec.targetId`\n * names the variable, and the {@link Command} that comes back must be a pure\n * function of `t` like any other.\n */\n addVariableCommand(key: string, factory: VariableCommandFactory): this {\n if (this._claimed(key, factory)) return this;\n this._commands.set(key, { key, scope: \"variable\", factory });\n return this;\n }\n\n /** The node-less command registered under `key`, or `undefined`. */\n command(key: string): CommandTypeEntry | undefined {\n return this._commands.get(key);\n }\n\n /**\n * A factory for `commandKey` on `nodeTypeKey`, or `undefined` if that type\n * does not publish it.\n *\n * Dispatches by **calling the named method**, never by testing the target\n * against a class: a forked component is a different class carrying the same\n * source, and an `instanceof` against the original is false for it.\n */\n nodeCommand(nodeTypeKey: string, commandKey: string): CommandFactory | undefined {\n const entry = this._nodes.get(nodeTypeKey)?.commands.get(commandKey);\n if (!entry) return undefined;\n return (target, args, duration, easing) => {\n const fn = (target as unknown as Record<string, unknown>)[entry.method];\n if (typeof fn !== \"function\") {\n throw new Error(\n `Command \"${commandKey}\" needs a \"${entry.method}\" method on ` +\n `${target.constructor.name}, which has none.`,\n );\n }\n const data: Record<string, unknown> = {};\n for (const arg of entry.args) data[arg.key] = args[arg.key];\n return (fn as (args: CommandArgs) => Command<Record<string, unknown>>)\n .call(target, { data, duration, easing });\n };\n }\n\n /**\n * Every command key available. With a node type, that type's own table;\n * without one, the node-less commands. Sorted, so the order is stable.\n */\n commandKeys(nodeTypeKey?: string): string[] {\n const keys = nodeTypeKey === undefined\n ? this._commands.keys()\n : this._nodes.get(nodeTypeKey)?.commands.keys() ?? [];\n return [...keys].sort();\n }\n\n // ─── Variable lerps ──────────────────────────────────────────────────────\n\n /**\n * Register an interpolation under a document key.\n *\n * The **code** half of a variable, exactly as a node class is the code half\n * of a node: `{\"lerp\": \"color\"}` in a document is a string, and something\n * has to turn it into the function that blends two colours. Same uniqueness\n * rule as {@link addNode}.\n */\n addLerp(key: string, lerp: VariableLerp): this {\n const existing = this._lerps.get(key);\n if (existing && existing !== lerp) {\n throw new Error(\n `Variable lerp \"${key}\" is already registered to a different function. Keys must be unique.`,\n );\n }\n this._lerps.set(key, lerp);\n return this;\n }\n\n /** The lerp registered under `key`, or `undefined`. */\n lerp(key: string): VariableLerp | undefined {\n return this._lerps.get(key);\n }\n\n /** Every registered lerp key. Sorted, so the order is stable. */\n lerpKeys(): string[] {\n return [...this._lerps.keys()].sort();\n }\n\n /**\n * The lerp a `VariableSpec` resolves to, defaulting from its value.\n *\n * A numeric variable with no declared lerp interpolates; anything else snaps\n * at the end. That is less a fallback than the only honest default —\n * guessing a structural lerp off one sample would blend two objects that\n * merely share an `x` key into something neither of them is.\n */\n requireLerp(key: string | undefined, value: unknown, where: string): VariableLerp {\n const resolved = key ?? (typeof value === \"number\" ? \"number\" : \"step\");\n const lerp = this._lerps.get(resolved);\n if (!lerp) {\n throw new Error(\n `Unknown variable lerp \"${resolved}\" (${where}). ` +\n `Registered: ${this.lerpKeys().join(\", \") || \"none\"}.`,\n );\n }\n return lerp;\n }\n\n // ─── Custom eases ────────────────────────────────────────────────────────\n\n /**\n * Register a custom ease under a document key, referenced as\n * `{ kind: \"custom\", args: key }`. Same uniqueness rule as {@link addNode}.\n */\n addEase(key: string, ease: EasingFunction): this {\n const existing = this._eases.get(key);\n if (existing && existing !== ease) {\n throw new Error(\n `Ease \"${key}\" is already registered to a different function. Keys must be unique.`,\n );\n }\n this._eases.set(key, ease);\n return this;\n }\n\n /** The ease registered under `key`, or `undefined`. */\n ease(key: string): EasingFunction | undefined {\n return this._eases.get(key);\n }\n\n /** Every registered ease key. Sorted, so the order is stable. */\n easeKeys(): string[] {\n return [...this._eases.keys()].sort();\n }\n\n // ─── Shaders ─────────────────────────────────────────────────────────────\n\n /**\n * Register a shader pack under a document key.\n *\n * The key is an argument rather than a field of the pack — the same shape\n * {@link addNode} has — so one file can be registered under whatever name a\n * project wants and stays portable between them. A pack's own `id`, when it\n * has one, is provenance.\n *\n * The pack is normalised on the way in, so what comes back out of\n * {@link shader} is always the current shape whatever the file looked like.\n * Re-registering an equal pack is a no-op — the common case is the *same\n * file* imported twice, which produces two structurally identical objects,\n * and throwing on that would make the uniqueness rule fire on the one case\n * it is meant to tolerate.\n *\n * Pass `{ replace: true }` to overwrite a key with a genuinely different\n * pack — the same opt-in `addNode` takes, for the same reason: a live-edited\n * shader re-registering under its existing key.\n */\n addShader(key: string, pack: unknown, options?: { replace?: boolean }): Shader {\n const normalized = normalizeShaderPack(pack);\n const existing = this._shaders.get(key);\n if (existing) {\n if (\n existing.scope === normalized.scope\n && existing.source === normalized.source\n && existing.name === normalized.name\n ) return existing;\n if (!options?.replace) {\n throw new Error(\n `Shader \"${key}\" is already registered to a different pack ` +\n `(\"${existing.name}\" vs \"${normalized.name}\"). Keys must be unique — a document ` +\n `naming this shader would otherwise resolve differently depending on registration order.`,\n );\n }\n } else if (this._shaders.size >= Registry.MAX_SHADERS) {\n throw new Error(\n `Cannot register shader \"${key}\": the ${Registry.MAX_SHADERS}-shader ceiling is reached.`,\n );\n }\n this._shaders.set(key, normalized);\n return normalized;\n }\n\n /** The pack registered under `key`, or `undefined`. */\n shader(key: string): Shader | undefined {\n return this._shaders.get(key);\n }\n\n /**\n * The pack registered under `key`, if it is a **fill** shader.\n *\n * The typed accessors are what actually deliver the compile error the union\n * promises: {@link shader} hands back `Shader`, and a call site that never\n * narrows could still pass an effect pack to `Fills.shader`.\n */\n fillShader(key: string): FillShader | undefined {\n const pack = this._shaders.get(key);\n return pack?.scope === \"fill\" ? pack : undefined;\n }\n\n /** The pack registered under `key`, if it is an **effect** shader. */\n effectShader(key: string): EffectShader | undefined {\n const pack = this._shaders.get(key);\n return pack?.scope === \"effect\" ? pack : undefined;\n }\n\n /** Every registered shader key, for a host offering a picker. Sorted. */\n shaderKeys(): string[] {\n return [...this._shaders.keys()].sort();\n }\n\n // ─── Internals ───────────────────────────────────────────────────────────\n\n private readonly _nodes = new Map<string, NodeTypeRecord>();\n private readonly _commands = new Map<string, CommandTypeEntry>();\n private readonly _lerps = new Map<string, VariableLerp>();\n private readonly _eases = new Map<string, EasingFunction>();\n private readonly _shaders = new Map<string, Shader>();\n private readonly _dynamicNodes?: DynamicNodeConfig;\n\n /**\n * Evaluates one compiled (CommonJS) dynamic-node module in the current\n * realm and returns its default export.\n *\n * `new Function` in-realm, never a blob module or a worker — see\n * {@link DynamicNodeConfig} and `deny-globals.ts` for why. `require()` is\n * locked to exactly `\"@motionscript/sdk\"`/`\"@motionscript/sdk/jsx-runtime\"`\n * (plus the earlier unscoped `\"motionscript\"` and `\"motion-script\"`\n * spellings, so a script written under either name still compiles) and\n * the host's `modules`, own keys only so `require(\"constructor\")` cannot\n * reach `Object`. No relative\n * imports, since a dynamic node is one script, not a package.\n */\n private _evalNodeModule(js: string): NodeConstructor {\n const { sdk, jsxRuntime, modules } = this._dynamicNodes!;\n const require = (specifier: string): unknown => {\n if (SDK_SPECIFIERS.includes(specifier)) return sdk;\n if (jsxRuntime && SDK_SPECIFIERS.some((name) => specifier === `${name}/jsx-runtime`)) {\n return jsxRuntime;\n }\n if (modules && Object.hasOwn(modules, specifier)) return modules[specifier];\n const available = [\n \"@motionscript/sdk\",\n ...(jsxRuntime ? [\"@motionscript/sdk/jsx-runtime\"] : []),\n ...Object.keys(modules ?? {}),\n ];\n throw new Error(\n `\"${specifier}\" isn't available to a custom node. It can require ` +\n `${available.map((s) => `\"${s}\"`).join(\", \")}; a host supplies more through \\`dynamicNodes.modules\\`.`,\n );\n };\n const mod = { exports: {} as Record<string, unknown> };\n // The script runs one function in from the parameters that deny the\n // globals, so its own top-level `const frames` shadows a denied name\n // instead of redeclaring a parameter. A body that closes that function\n // early is still inside the outer one, which denies the same names.\n const factory = new Function(\n \"exports\", \"require\", \"module\", ...DENIED_GLOBALS,\n `\"use strict\";\\nreturn function () {\\n${js}\\n};`,\n );\n factory(mod.exports, require, mod)();\n\n const ctor = mod.exports.default as NodeConstructor | undefined;\n if (typeof ctor !== \"function\" || getNodeDescriptor(ctor) === undefined) {\n throw new Error(\"This script must `export default` a class decorated with @node(...).\");\n }\n return ctor;\n }\n\n /** One key, one factory — see {@link addNode} for why. */\n private _claimed(key: string, factory: CommandFactory | VariableCommandFactory): boolean {\n const existing = this._commands.get(key);\n if (!existing) return false;\n if (existing.factory === factory) return true;\n throw new Error(\n `Command type \"${key}\" is already registered to a different factory. Keys must be unique.`,\n );\n }\n\n /**\n * A class's editable properties, read off its `@property` declarations.\n *\n * The whole prototype chain, so a `Card` extending `Rect` publishes the box\n * it inherits as well as what it adds — a host editing one edits every\n * control it actually has, without the subclass restating any of them.\n */\n private _describeProperties(ctor: NodeConstructor): Record<string, NodePropertyDescriptor> {\n const out: Record<string, NodePropertyDescriptor> = {};\n for (const meta of getPropertyMeta(Object.create(ctor.prototype) as object)) {\n const editor: PropertyEditor = meta.editor ?? {};\n out[meta.key] = {\n ...editor,\n kind: editor.kind ?? this._inferKind(meta.default),\n ...(meta.default !== undefined ? { default: meta.default } : {}),\n };\n }\n return out;\n }\n\n /**\n * A type's dimension, read off the prototype without constructing one.\n *\n * `Node.dimension` is a getter rather than a field for exactly this reason —\n * it answers from the prototype, before any field initializer has run.\n */\n private _describeDimension(ctor: NodeConstructor): NodeDimension | undefined {\n const dimension = (Object.create(ctor.prototype) as Node).dimension;\n return typeof dimension === \"string\" ? dimension : undefined;\n }\n\n /**\n * The control a value's own type implies. Only ever a fallback: a typed\n * decorator states its kind, and a plain `@property` may too.\n *\n * A function default is a *reactive binding*, not a value, so it says nothing\n * about the control; those declare their kind or take \"unknown\", which a host\n * draws as read-only rather than guessing.\n */\n private _inferKind(value: unknown): string {\n switch (typeof value) {\n case \"number\": return \"number\";\n case \"string\": return \"text\";\n case \"boolean\": return \"boolean\";\n case \"object\":\n if (value === null) return \"unknown\";\n return Array.isArray(value) && value.every(v => typeof v === \"number\")\n ? \"vector\"\n : \"object\";\n default: return \"unknown\";\n }\n }\n\n /** A command's arguments as descriptors, whichever shorthand they were written in. */\n private _describeArgs(args: readonly CommandArg[] | undefined): CommandArgDescriptor[] {\n return (args ?? []).map((arg) =>\n typeof arg === \"string\" ? { key: arg, kind: \"unknown\" } : { kind: \"unknown\", ...arg });\n }\n}\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/document/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAuB,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,cAAc,EAA8C,MAAM,2BAA2B,CAAC;AACvG,OAAO,EACH,mBAAmB,GAItB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD;;;;;GAKG;AACH,MAAM,cAAc,GAAsB,CAAC,mBAAmB,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;AAkQjG,+BAA+B;AAC/B,MAAM,OAAO,QAAQ;IACjB,8EAA8E;IAC9E,MAAM,CAAU,WAAW,GAAG,GAAG,CAAC;IAElC,YAAY,UAA2B,EAAE;QACrC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;QAC1C,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK;YAAE,eAAe,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK;gBAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACJ,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,C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C;QACpE,OAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,CAAC;IAED;;;;;;;OAOG;IACK,UAAU,CAAC,KAAc;QAC7B,QAAQ,OAAO,KAAK,EAAE,CAAC;YACnB,KAAK,QAAQ,CAAC,CAAC,OAAO,QAAQ,CAAC;YAC/B,KAAK,QAAQ,CAAC,CAAC,OAAO,MAAM,CAAC;YAC7B,KAAK,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC;YACjC,KAAK,QAAQ;gBACT,IAAI,KAAK,KAAK,IAAI;oBAAE,OAAO,SAAS,CAAC;gBACrC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;oBAClE,CAAC,CAAC,QAAQ;oBACV,CAAC,CAAC,QAAQ,CAAC;YACnB,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;QAC9B,CAAC;IACL,CAAC;IAED,sFAAsF;IAC9E,aAAa,CAAC,IAAuC;QACzD,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC5B,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;IAC/F,CAAC","sourcesContent":["import type { Node, NodeDimension } from \"@/nodes/node/node\";\r\nimport type { Command, CommandArgs } from \"@/tween/command\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport { getPropertyMeta, type PropertyEditor } from \"@/attributes/properties/decorator\";\r\nimport { getCommandMeta, type CommandArg, type CommandArgDescriptor } from \"@/tween/command-decorator\";\r\nimport {\r\n normalizeShaderPack,\r\n type EffectShader,\r\n type FillShader,\r\n type Shader,\r\n} from \"@/attributes/shape/shaders/pack\";\r\nimport { installBuiltins } from \"./builtins\";\r\nimport { DENIED_GLOBALS } from \"./deny-globals\";\r\nimport { getNodeDescriptor } from \"./node-decorator\";\r\nimport type { NodePropertyDescriptor, NodeTypeDescriptor } from \"./node-descriptor\";\r\nimport type { NodeSpec } from \"./types\";\r\n\r\n/**\r\n * The specifiers a dynamic node's `require()` resolves to the host's sdk\r\n * barrel (and, with `/jsx-runtime` appended, to its JSX runtime). The published\r\n * name comes first; the two after it are the package's earlier unscoped names,\r\n * kept so a script authored under either still compiles.\r\n */\r\nconst SDK_SPECIFIERS: readonly string[] = [\"@motionscript/sdk\", \"motionscript\", \"motion-script\"];\r\n\r\n/**\r\n * The **code** half of the document model, as one object an engine owns.\r\n *\r\n * A document names a node type, a command, a lerp and a shader with a string.\r\n * Something has to turn `\"rect\"` into a class and `\"fillTo\"` into an animation,\r\n * and that something is deliberately a registry rather than a table in the\r\n * database: node types are code — a class with `@property` declarations, a\r\n * `renderSelf`, and `@command()` methods — and code is versioned with the\r\n * library, not with the document.\r\n *\r\n * **It is an instance, not a module.** Every table here used to be a\r\n * module-scope `Map` behind a dozen free functions, which made a registration\r\n * a fact about the *process*: two engines in one process shared one vocabulary,\r\n * a decorated class was registered by the mere act of being imported, whichever\r\n * host loaded first won a contested key, and a test had to remember to call a\r\n * `clearRegistries()` that reached into three modules. A registry is now a value\r\n * with an owner — an `Engine`'s own, reached through `registerNode`/`registerShader`\r\n * rather than a public `registry` field — so what a document can name is a\r\n * property of the engine opening it, and two engines disagree about it freely.\r\n *\r\n * ```ts\r\n * const registry = new Registry({ nodes: [Blob], shaders: { swirl: SWIRL } });\r\n * registry.commandKeys(\"blob\"); // [\"fadeTo\", \"moveTo\", …, \"wobbleTo\"]\r\n * ```\r\n *\r\n * **Commands are per node type, and that is the point.** They used to share one\r\n * flat table with the node types, which made a command key a global claim: the\r\n * first package to register `reveal` owned the word, and a second node type\r\n * wanting it — with different arguments — could not have it. Nothing about a\r\n * command is global, though: it is a method on a class, dispatched against an\r\n * instance the document already names. Only the handful that must resolve\r\n * *without* a node — the variable-scoped ones and the generic prop writers — sit\r\n * in a table of their own.\r\n */\r\n\r\n/** Constructs a node from its authored props. Every built-in node class matches this. */\r\nexport type NodeConstructor = new (props?: Record<string, unknown>) => Node;\r\n\r\n/** Node types a registry makes available, by the key a document names them with. */\r\nexport type NodeTypeMap = Record<string, NodeConstructor>;\r\n\r\n/** Shader packs a registry makes available, by document key. A pack is plain JSON. */\r\nexport type ShaderPackMap = Record<string, unknown>;\r\n\r\n/**\r\n * Builds the {@link Command} a `CommandSpec` stands for.\r\n *\r\n * Called **once per compile**, in timeline order, with `target` already in the\r\n * state the previous command left it — that is what fixes the command's `from`\r\n * value and makes the returned `Command.at(t)` pure thereafter. See\r\n * `tween/command.ts` and `document/timeline.ts`.\r\n *\r\n * @param target The node the command acts on (the scene root for `targetId: null`).\r\n * @param args The spec's `args`, verbatim.\r\n * @param duration Seconds, already defaulted by the caller.\r\n * @param easing Resolved from the spec's `EaseSpec`, or `undefined`.\r\n */\r\nexport type CommandFactory = (\r\n target: Node,\r\n args: Record<string, unknown>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n) => Command<Record<string, unknown>>;\r\n\r\n/**\r\n * The variable a variable command writes.\r\n *\r\n * A handle rather than the cell itself, so a command cannot subscribe to it,\r\n * rebind it, or hold it past the build that made it — the three ways a command\r\n * could stop being a pure function of `t`.\r\n */\r\nexport interface VariableTarget {\r\n /** The id an expression names with `[id]`. */\r\n readonly id: string;\r\n /** What it holds right now. */\r\n get(): unknown;\r\n set(value: unknown): void;\r\n /**\r\n * The lerp its `VariableSpec.lerp` resolved to. A command is free to use a\r\n * different one when its args ask for it — `variableTo` does.\r\n */\r\n readonly lerp: VariableLerp;\r\n}\r\n\r\n/**\r\n * Builds the {@link Command} a variable-scoped `CommandSpec` stands for.\r\n *\r\n * Same contract as {@link CommandFactory} — called once per compile, in timeline\r\n * order, against a variable already holding what its predecessors left — with a\r\n * {@link VariableTarget} in place of a node.\r\n */\r\nexport type VariableCommandFactory = (\r\n target: VariableTarget,\r\n args: Record<string, unknown>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n) => Command<Record<string, unknown>>;\r\n\r\n/**\r\n * How a variable's value interpolates between two states.\r\n *\r\n * The same shape every `@property` tween already has, widened to `unknown`\r\n * because a variable's type is a fact of the document rather than of a class:\r\n * one holds a number, the next a colour string, the next a whole fill object.\r\n */\r\nexport type VariableLerp = (from: unknown, to: unknown, t: number) => unknown;\r\n\r\n/**\r\n * One command that resolves without a node.\r\n *\r\n * `scope` says which table `CommandSpec.targetId` is looked up in, and is what\r\n * lets a variable command reuse the same field a node command uses instead of\r\n * inventing a second one every host's timeline would then have to special-case.\r\n */\r\nexport type CommandTypeEntry =\r\n | {\r\n key: string;\r\n scope: \"node\";\r\n factory: CommandFactory;\r\n /**\r\n * Its leading parameters, as {@link NodeCommandEntry.args} describes a\r\n * node command's — declared by the paint commands, which read one key\r\n * each. Absent for `to`/`set`, whose args *are* the props diff.\r\n */\r\n args?: readonly CommandArgDescriptor[];\r\n /**\r\n * This command **writes props declaratively**, so an expression in its\r\n * args compiles to a binding rather than being passed through as a\r\n * string. `set` is the only built-in that does.\r\n *\r\n * A flag rather than a name check, because the distinction is real: `to`\r\n * tweens *towards* a value and a formula is not a value, so binding one\r\n * as a tween destination would interpolate towards `NaN` and look like a\r\n * renderer bug. A command opting in is saying its args reach `set()`.\r\n */\r\n binds?: boolean;\r\n /**\r\n * The method it runs on its target, where it runs one: the paint\r\n * commands call the node's own `fillTo`, `strokeTo`, …. A node type\r\n * without it, or one that withdrew it, does not take the command\r\n * ({@link Registry.takesCommand}).\r\n */\r\n method?: string;\r\n }\r\n | {\r\n key: string;\r\n scope: \"variable\";\r\n factory: VariableCommandFactory;\r\n };\r\n\r\n/**\r\n * One node type's own command table.\r\n *\r\n * Built from the class's `@command()` methods — the **whole** prototype chain,\r\n * not just its own — because the table is per type. A `Card` extending `Rect`\r\n * answers to `fadeTo` for the same reason it answers to `.fadeTo()`: it has the\r\n * method. There is nothing here for two node types to collide over, so\r\n * inherited entries can simply be copied into each.\r\n */\r\nexport interface NodeTypeRecord {\r\n /** The document key, matching `NodeSpec.type`. */\r\n key: string;\r\n /** The class to construct. */\r\n ctor: NodeConstructor;\r\n /** Its commands, by the key a document names them with. */\r\n commands: ReadonlyMap<string, NodeCommandEntry>;\r\n /** Commands it inherits and withdrew (`withdraw`): never offered, still dispatched for a stored document that names one. */\r\n withdrawn: ReadonlyMap<string, NodeCommandEntry>;\r\n /**\r\n * What the type declares about itself — see {@link NodeTypeDescriptor}.\r\n *\r\n * Always present, so a host reads one shape whether the type was registered\r\n * with a bare key, a full descriptor, or a decorated class.\r\n */\r\n descriptor: NodeTypeDescriptor;\r\n}\r\n\r\n/** One command on one node type. */\r\nexport interface NodeCommandEntry {\r\n /** The method to call. */\r\n method: string;\r\n /**\r\n * Its leading parameters, from `@command({ args })`, always as descriptors.\r\n *\r\n * A bare name normalises to `{ key, kind: \"unknown\" }`, so a host reads one\r\n * shape whether the method bothered to describe its arguments or not.\r\n */\r\n args: readonly CommandArgDescriptor[];\r\n}\r\n\r\n/**\r\n * How a registry compiles and links a node authored as a TS/JSX source\r\n * string, via {@link Registry.addNodeFromSource}.\r\n *\r\n * Entirely host-supplied — `core` has no compiler dependency and cannot\r\n * import the published `@motionscript/sdk` barrel itself (that package\r\n * depends on `core`, so the reverse direction would be circular).\r\n */\r\nexport interface DynamicNodeConfig {\r\n /**\r\n * What `require(\"@motionscript/sdk\")` resolves to inside a compiled\r\n * script — the host's own already-loaded sdk barrel instance. Must be the\r\n * same module instance the rest of the app uses, or `instanceof` silently\r\n * fails against it. The earlier unscoped specifiers, `\"motionscript\"` and\r\n * the dashed `\"motion-script\"`, resolve to the same object, so a node\r\n * script authored under either name keeps compiling unmodified.\r\n */\r\n sdk: Record<string, unknown>;\r\n /**\r\n * What `require(\"@motionscript/sdk/jsx-runtime\")` resolves to (also under\r\n * the legacy `motionscript/jsx-runtime` and `motion-script/jsx-runtime`\r\n * specifiers). Omit to reject a script that uses JSX outright.\r\n */\r\n jsxRuntime?: Record<string, unknown>;\r\n /**\r\n * Further modules a script may `require`, by exact specifier — what a\r\n * forked component imports beyond the sdk barrel:\r\n * `@motionscript/sdk/component`, its package's kit. Consulted after the\r\n * two above, so neither can be shadowed. Each value has to be the host's\r\n * own loaded instance, for the same `instanceof` reason as `sdk`.\r\n */\r\n modules?: Readonly<Record<string, unknown>>;\r\n /**\r\n * TS/JSX source → JS text (CommonJS). Host-injected, never bundled —\r\n * `core` has no compiler dependency of its own.\r\n */\r\n compile: (source: string) => Promise<string>;\r\n}\r\n\r\n/** What a registry is seeded with, on top of the builtin vocabulary. */\r\nexport interface RegistryOptions {\r\n /**\r\n * Custom node types — decorated classes, or explicit keys.\r\n *\r\n * An array reads each class's `@node()` declaration; a record names the key\r\n * outright, which is also an assertion that the two agree (a rename on\r\n * either side throws here rather than surfacing as an unknown type at\r\n * render).\r\n */\r\n nodes?: NodeTypeMap | readonly NodeConstructor[];\r\n /** Shader packs, by document key. Plain JSON — normalised on the way in. */\r\n shaders?: ShaderPackMap;\r\n /** Extra variable interpolations, on top of `number`/`vector2`/`vector3`/`color`/`step`. */\r\n lerps?: Record<string, VariableLerp>;\r\n /** Custom eases, referenced from a document as `{ kind: \"custom\", args: key }`. */\r\n eases?: Record<string, EasingFunction>;\r\n /** Enables {@link Registry.addNodeFromSource} — see {@link DynamicNodeConfig}. */\r\n dynamicNodes?: DynamicNodeConfig;\r\n /**\r\n * Leave out everything the library itself ships. Only useful to a test\r\n * asserting on the seeding, or a host building a deliberately tiny\r\n * vocabulary — a document naming `\"rect\"` will not compile without it.\r\n */\r\n builtins?: boolean;\r\n}\r\n\r\n/** See the module docblock. */\r\nexport class Registry {\r\n /** Ceiling, so an import cannot evict a workspace's own shaders by volume. */\r\n static readonly MAX_SHADERS = 512;\r\n\r\n constructor(options: RegistryOptions = {}) {\r\n this._dynamicNodes = options.dynamicNodes;\r\n if (options.builtins !== false) installBuiltins(this);\r\n if (Array.isArray(options.nodes)) {\r\n for (const ctor of options.nodes) this.addNode(ctor);\r\n } else {\r\n for (const [key, ctor] of Object.entries(options.nodes ?? {})) this.addNode(key, ctor);\r\n }\r\n for (const [key, lerp] of Object.entries(options.lerps ?? {})) this.addLerp(key, lerp);\r\n for (const [key, ease] of Object.entries(options.eases ?? {})) this.addEase(key, ease);\r\n for (const [key, pack] of Object.entries(options.shaders ?? {})) this.addShader(key, pack);\r\n }\r\n\r\n // ─── Node types ──────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register a node class, with its commands and whatever else it declares.\r\n *\r\n * Takes a decorated class on its own, or a bare key / full\r\n * {@link NodeTypeDescriptor} plus the class. The descriptor is the code half\r\n * of what a component package used to restate in a `manifest.json` —\r\n * carried, never interpreted, so a host has one place to ask and no second\r\n * file to disagree with the class.\r\n *\r\n * The commands come off the class, so `@command()` is the only place a\r\n * node's animations are written down. Nothing is constructed to read them:\r\n * `@command` records onto the prototype, so an object *over* the prototype\r\n * reaches the whole chain without running a constructor that may expect\r\n * props, build children, or touch a clock.\r\n *\r\n * Re-registering the same class under the same key is a no-op, so a hot\r\n * reload or a duplicated dependency is harmless. Re-registering a\r\n * *different* class throws: two classes answering to one key means a\r\n * document renders differently depending on registration order, which is not\r\n * a failure anyone would find by looking at the document.\r\n *\r\n * Pass `{ replace: true }` to opt out of that throw — the one case it's\r\n * wrong for is a node whose source has genuinely been edited and\r\n * recompiled (see {@link addNodeFromSource}), where re-registering under\r\n * the same key with a new class is the whole point. The default stays a\r\n * throw; this is deliberately not the common path.\r\n */\r\n addNode(ctor: NodeConstructor, options?: { replace?: boolean }): this;\r\n addNode(type: string | NodeTypeDescriptor, ctor: NodeConstructor, options?: { replace?: boolean }): this;\r\n addNode(\r\n type: string | NodeTypeDescriptor | NodeConstructor,\r\n ctorOrOptions?: NodeConstructor | { replace?: boolean },\r\n maybeOptions?: { replace?: boolean },\r\n ): this {\r\n const isTwoArgForm = typeof ctorOrOptions === \"function\";\r\n const cls = (isTwoArgForm ? ctorOrOptions : type) as NodeConstructor;\r\n const options = isTwoArgForm ? maybeOptions : ctorOrOptions as { replace?: boolean } | undefined;\r\n const declared = isTwoArgForm ? type as string | NodeTypeDescriptor : getNodeDescriptor(cls);\r\n if (declared === undefined) {\r\n throw new Error(\r\n `${cls.name || \"The class\"} carries no @node(...) declaration, so it has no ` +\r\n `document key. Decorate it, or register it explicitly: addNode(\"myKey\", TheClass).`,\r\n );\r\n }\r\n const descriptor: NodeTypeDescriptor = typeof declared === \"string\" ? { key: declared } : declared;\r\n const key = descriptor.key;\r\n\r\n const existing = this._nodes.get(key);\r\n if (existing) {\r\n if (existing.ctor === cls) return this;\r\n if (!options?.replace) {\r\n throw new Error(\r\n `Node type \"${key}\" is already registered to a different class ` +\r\n `(${existing.ctor.name} vs ${cls.name}). Keys must be unique — a document ` +\r\n `naming this type would otherwise resolve differently depending on registration order.`,\r\n );\r\n }\r\n }\r\n\r\n const commands = new Map<string, NodeCommandEntry>();\r\n const withdrawn = new Map<string, NodeCommandEntry>();\r\n for (const meta of getCommandMeta(Object.create(cls.prototype) as object)) {\r\n (meta.withdrawn ? withdrawn : commands).set(meta.key, { method: meta.method, args: this._describeArgs(meta.args) });\r\n }\r\n\r\n this._nodes.set(key, {\r\n key,\r\n ctor: cls,\r\n commands,\r\n withdrawn,\r\n // Derived, never declared: see `NodeTypeDescriptor.properties`.\r\n descriptor: {\r\n ...descriptor,\r\n dimension: this._describeDimension(cls),\r\n properties: this._describeProperties(cls),\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Compile a TS/JSX source string into a live node class and register it.\r\n *\r\n * The script must `export default` a class carrying `@node(...)` — that\r\n * decorator is what supplies the registry key, exactly as {@link addNode}\r\n * already reads it off a statically-imported class. There is no separate\r\n * `key` parameter: one way to name a dynamic node's key, not two that\r\n * could disagree.\r\n *\r\n * Requires `dynamicNodes` to have been passed to the constructor — see\r\n * {@link DynamicNodeConfig}. `core` never compiles anything itself; this\r\n * only calls the host-supplied `compile` and links its result.\r\n */\r\n async addNodeFromSource(source: string, options?: { replace?: boolean }): Promise<NodeConstructor> {\r\n if (!this._dynamicNodes) {\r\n throw new Error(\r\n \"addNodeFromSource needs `dynamicNodes: { sdk, compile }` on the Registry constructor.\",\r\n );\r\n }\r\n const js = await this._dynamicNodes.compile(source);\r\n const ctor = this._evalNodeModule(js);\r\n this.addNode(ctor, options);\r\n return ctor;\r\n }\r\n\r\n /** Everything registered under `key`, or `undefined`. */\r\n node(key: string): NodeTypeRecord | undefined {\r\n return this._nodes.get(key);\r\n }\r\n\r\n /** Whether a document naming `key` can be compiled against this registry. */\r\n hasNode(key: string): boolean {\r\n return this._nodes.has(key);\r\n }\r\n\r\n /** Every registered node key, for a host offering a palette. Sorted, so the order is stable. */\r\n nodeKeys(): string[] {\r\n return [...this._nodes.keys()].sort();\r\n }\r\n\r\n /** What `key` declares about itself, or `undefined` if it is not registered. */\r\n describe(key: string): NodeTypeDescriptor | undefined {\r\n return this._nodes.get(key)?.descriptor;\r\n }\r\n\r\n /**\r\n * Build a node from its spec. Throws on an unknown type.\r\n *\r\n * `props` overrides the spec's own, which is how the timeline keeps an\r\n * expression out of a constructor: an expression-bound prop is left out of\r\n * what is passed here and written afterwards with `set()`. Constructors read\r\n * their raw props to decide things like a default size, and a `() => number`\r\n * is not an answer to that question. The spec's `id` outranks both, so\r\n * {@link Node.id} is the document's own identity rather than a per-instance\r\n * UUID — without it a host could never resolve a node it addressed by id.\r\n *\r\n * `key` rides along the same way, and only when the row carries one:\r\n * `applyEditorStates` keys the whole editor-state record on {@link Node.key},\r\n * so a row whose key never reached the node is a node a host cannot hide or\r\n * lock — and overwriting one passed in `props` with an absent row-level key\r\n * would take that away from a caller who had it working.\r\n */\r\n instantiate(spec: NodeSpec, props?: Record<string, unknown>): Node {\r\n const record = this._nodes.get(spec.type);\r\n if (!record) {\r\n throw new Error(\r\n `Unknown node type \"${spec.type}\" (node ${spec.id}). ` +\r\n `This registry knows: ${this.nodeKeys().join(\", \") || \"nothing\"}.`,\r\n );\r\n }\r\n return new record.ctor({\r\n ...(props ?? spec.props),\r\n id: spec.id,\r\n ...(spec.key !== undefined && { key: spec.key }),\r\n });\r\n }\r\n\r\n // ─── Commands ────────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register a command that resolves **without** a node — see\r\n * {@link CommandTypeEntry}. Same uniqueness rule as {@link addNode}.\r\n */\r\n addCommand(\r\n key: string,\r\n factory: CommandFactory,\r\n options?: { binds?: boolean; args?: readonly CommandArg[]; method?: string },\r\n ): this {\r\n if (this._claimed(key, factory)) return this;\r\n this._commands.set(key, {\r\n key,\r\n scope: \"node\",\r\n factory,\r\n ...(options?.args ? { args: this._describeArgs(options.args) } : {}),\r\n binds: options?.binds,\r\n ...(options?.method ? { method: options.method } : {}),\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Register a command that writes a **variable** rather than a node.\r\n *\r\n * The seam a host reaches for to add its own — a spring, a wiggle, a\r\n * sample-and-hold — without touching the timeline. `CommandSpec.targetId`\r\n * names the variable, and the {@link Command} that comes back must be a pure\r\n * function of `t` like any other.\r\n */\r\n addVariableCommand(key: string, factory: VariableCommandFactory): this {\r\n if (this._claimed(key, factory)) return this;\r\n this._commands.set(key, { key, scope: \"variable\", factory });\r\n return this;\r\n }\r\n\r\n /** The node-less command registered under `key`, or `undefined`. */\r\n command(key: string): CommandTypeEntry | undefined {\r\n return this._commands.get(key);\r\n }\r\n\r\n /**\r\n * A factory for `commandKey` on `nodeTypeKey`, or `undefined` if that type\r\n * does not publish it.\r\n *\r\n * Dispatches by **calling the named method**, never by testing the target\r\n * against a class: a forked component is a different class carrying the same\r\n * source, and an `instanceof` against the original is false for it.\r\n */\r\n nodeCommand(nodeTypeKey: string, commandKey: string): CommandFactory | undefined {\r\n const record = this._nodes.get(nodeTypeKey);\r\n const entry = record?.commands.get(commandKey) ?? record?.withdrawn.get(commandKey);\r\n if (!entry) return undefined;\r\n return (target, args, duration, easing) => {\r\n const fn = (target as unknown as Record<string, unknown>)[entry.method];\r\n if (typeof fn !== \"function\") {\r\n throw new Error(\r\n `Command \"${commandKey}\" needs a \"${entry.method}\" method on ` +\r\n `${target.constructor.name}, which has none.`,\r\n );\r\n }\r\n const data: Record<string, unknown> = {};\r\n for (const arg of entry.args) data[arg.key] = args[arg.key];\r\n return (fn as (args: CommandArgs) => Command<Record<string, unknown>>)\r\n .call(target, { data, duration, easing });\r\n };\r\n }\r\n\r\n /**\r\n * Whether a node of `nodeTypeKey` takes `commandKey`: one its own table\r\n * publishes, or a node-less one that acts on a node (`to`, `fillTo`) unless\r\n * the method it runs is one the type lacks or withdrew. What a host offers a\r\n * node is its table and the node-less commands it takes.\r\n */\r\n takesCommand(nodeTypeKey: string, commandKey: string): boolean {\r\n const record = this._nodes.get(nodeTypeKey);\r\n if (!record) return false;\r\n if (record.commands.has(commandKey)) return true;\r\n const global = this._commands.get(commandKey);\r\n if (global?.scope !== \"node\") return false;\r\n if (global.method === undefined) return true;\r\n if (record.withdrawn.has(global.method)) return false;\r\n return typeof (record.ctor.prototype as Record<string, unknown>)[global.method] === \"function\";\r\n }\r\n\r\n /**\r\n * Every command key available. With a node type, that type's own table;\r\n * without one, the node-less commands. Sorted, so the order is stable.\r\n */\r\n commandKeys(nodeTypeKey?: string): string[] {\r\n const keys = nodeTypeKey === undefined\r\n ? this._commands.keys()\r\n : this._nodes.get(nodeTypeKey)?.commands.keys() ?? [];\r\n return [...keys].sort();\r\n }\r\n\r\n // ─── Variable lerps ──────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register an interpolation under a document key.\r\n *\r\n * The **code** half of a variable, exactly as a node class is the code half\r\n * of a node: `{\"lerp\": \"color\"}` in a document is a string, and something\r\n * has to turn it into the function that blends two colours. Same uniqueness\r\n * rule as {@link addNode}.\r\n */\r\n addLerp(key: string, lerp: VariableLerp): this {\r\n const existing = this._lerps.get(key);\r\n if (existing && existing !== lerp) {\r\n throw new Error(\r\n `Variable lerp \"${key}\" is already registered to a different function. Keys must be unique.`,\r\n );\r\n }\r\n this._lerps.set(key, lerp);\r\n return this;\r\n }\r\n\r\n /** The lerp registered under `key`, or `undefined`. */\r\n lerp(key: string): VariableLerp | undefined {\r\n return this._lerps.get(key);\r\n }\r\n\r\n /** Every registered lerp key. Sorted, so the order is stable. */\r\n lerpKeys(): string[] {\r\n return [...this._lerps.keys()].sort();\r\n }\r\n\r\n /**\r\n * The lerp a `VariableSpec` resolves to, defaulting from its value.\r\n *\r\n * A numeric variable with no declared lerp interpolates; anything else snaps\r\n * at the end. That is less a fallback than the only honest default —\r\n * guessing a structural lerp off one sample would blend two objects that\r\n * merely share an `x` key into something neither of them is.\r\n */\r\n requireLerp(key: string | undefined, value: unknown, where: string): VariableLerp {\r\n const resolved = key ?? (typeof value === \"number\" ? \"number\" : \"step\");\r\n const lerp = this._lerps.get(resolved);\r\n if (!lerp) {\r\n throw new Error(\r\n `Unknown variable lerp \"${resolved}\" (${where}). ` +\r\n `Registered: ${this.lerpKeys().join(\", \") || \"none\"}.`,\r\n );\r\n }\r\n return lerp;\r\n }\r\n\r\n // ─── Custom eases ────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register a custom ease under a document key, referenced as\r\n * `{ kind: \"custom\", args: key }`. Same uniqueness rule as {@link addNode}.\r\n */\r\n addEase(key: string, ease: EasingFunction): this {\r\n const existing = this._eases.get(key);\r\n if (existing && existing !== ease) {\r\n throw new Error(\r\n `Ease \"${key}\" is already registered to a different function. Keys must be unique.`,\r\n );\r\n }\r\n this._eases.set(key, ease);\r\n return this;\r\n }\r\n\r\n /** The ease registered under `key`, or `undefined`. */\r\n ease(key: string): EasingFunction | undefined {\r\n return this._eases.get(key);\r\n }\r\n\r\n /** Every registered ease key. Sorted, so the order is stable. */\r\n easeKeys(): string[] {\r\n return [...this._eases.keys()].sort();\r\n }\r\n\r\n // ─── Shaders ─────────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register a shader pack under a document key.\r\n *\r\n * The key is an argument rather than a field of the pack — the same shape\r\n * {@link addNode} has — so one file can be registered under whatever name a\r\n * project wants and stays portable between them. A pack's own `id`, when it\r\n * has one, is provenance.\r\n *\r\n * The pack is normalised on the way in, so what comes back out of\r\n * {@link shader} is always the current shape whatever the file looked like.\r\n * Re-registering an equal pack is a no-op — the common case is the *same\r\n * file* imported twice, which produces two structurally identical objects,\r\n * and throwing on that would make the uniqueness rule fire on the one case\r\n * it is meant to tolerate.\r\n *\r\n * Pass `{ replace: true }` to overwrite a key with a genuinely different\r\n * pack — the same opt-in `addNode` takes, for the same reason: a live-edited\r\n * shader re-registering under its existing key.\r\n */\r\n addShader(key: string, pack: unknown, options?: { replace?: boolean }): Shader {\r\n const normalized = normalizeShaderPack(pack);\r\n const existing = this._shaders.get(key);\r\n if (existing) {\r\n if (\r\n existing.scope === normalized.scope\r\n && existing.source === normalized.source\r\n && existing.name === normalized.name\r\n ) return existing;\r\n if (!options?.replace) {\r\n throw new Error(\r\n `Shader \"${key}\" is already registered to a different pack ` +\r\n `(\"${existing.name}\" vs \"${normalized.name}\"). Keys must be unique — a document ` +\r\n `naming this shader would otherwise resolve differently depending on registration order.`,\r\n );\r\n }\r\n } else if (this._shaders.size >= Registry.MAX_SHADERS) {\r\n throw new Error(\r\n `Cannot register shader \"${key}\": the ${Registry.MAX_SHADERS}-shader ceiling is reached.`,\r\n );\r\n }\r\n this._shaders.set(key, normalized);\r\n return normalized;\r\n }\r\n\r\n /** The pack registered under `key`, or `undefined`. */\r\n shader(key: string): Shader | undefined {\r\n return this._shaders.get(key);\r\n }\r\n\r\n /**\r\n * The pack registered under `key`, if it is a **fill** shader.\r\n *\r\n * The typed accessors are what actually deliver the compile error the union\r\n * promises: {@link shader} hands back `Shader`, and a call site that never\r\n * narrows could still pass an effect pack to `Fills.shader`.\r\n */\r\n fillShader(key: string): FillShader | undefined {\r\n const pack = this._shaders.get(key);\r\n return pack?.scope === \"fill\" ? pack : undefined;\r\n }\r\n\r\n /** The pack registered under `key`, if it is an **effect** shader. */\r\n effectShader(key: string): EffectShader | undefined {\r\n const pack = this._shaders.get(key);\r\n return pack?.scope === \"effect\" ? pack : undefined;\r\n }\r\n\r\n /** Every registered shader key, for a host offering a picker. Sorted. */\r\n shaderKeys(): string[] {\r\n return [...this._shaders.keys()].sort();\r\n }\r\n\r\n // ─── Internals ───────────────────────────────────────────────────────────\r\n\r\n private readonly _nodes = new Map<string, NodeTypeRecord>();\r\n private readonly _commands = new Map<string, CommandTypeEntry>();\r\n private readonly _lerps = new Map<string, VariableLerp>();\r\n private readonly _eases = new Map<string, EasingFunction>();\r\n private readonly _shaders = new Map<string, Shader>();\r\n private readonly _dynamicNodes?: DynamicNodeConfig;\r\n\r\n /**\r\n * Evaluates one compiled (CommonJS) dynamic-node module in the current\r\n * realm and returns its default export.\r\n *\r\n * `new Function` in-realm, never a blob module or a worker — see\r\n * {@link DynamicNodeConfig} and `deny-globals.ts` for why. `require()` is\r\n * locked to exactly `\"@motionscript/sdk\"`/`\"@motionscript/sdk/jsx-runtime\"`\r\n * (plus the earlier unscoped `\"motionscript\"` and `\"motion-script\"`\r\n * spellings, so a script written under either name still compiles) and\r\n * the host's `modules`, own keys only so `require(\"constructor\")` cannot\r\n * reach `Object`. No relative\r\n * imports, since a dynamic node is one script, not a package.\r\n */\r\n private _evalNodeModule(js: string): NodeConstructor {\r\n const { sdk, jsxRuntime, modules } = this._dynamicNodes!;\r\n const require = (specifier: string): unknown => {\r\n if (SDK_SPECIFIERS.includes(specifier)) return sdk;\r\n if (jsxRuntime && SDK_SPECIFIERS.some((name) => specifier === `${name}/jsx-runtime`)) {\r\n return jsxRuntime;\r\n }\r\n if (modules && Object.hasOwn(modules, specifier)) return modules[specifier];\r\n const available = [\r\n \"@motionscript/sdk\",\r\n ...(jsxRuntime ? [\"@motionscript/sdk/jsx-runtime\"] : []),\r\n ...Object.keys(modules ?? {}),\r\n ];\r\n throw new Error(\r\n `\"${specifier}\" isn't available to a custom node. It can require ` +\r\n `${available.map((s) => `\"${s}\"`).join(\", \")}; a host supplies more through \\`dynamicNodes.modules\\`.`,\r\n );\r\n };\r\n const mod = { exports: {} as Record<string, unknown> };\r\n // The script runs one function in from the parameters that deny the\r\n // globals, so its own top-level `const frames` shadows a denied name\r\n // instead of redeclaring a parameter. A body that closes that function\r\n // early is still inside the outer one, which denies the same names.\r\n const factory = new Function(\r\n \"exports\", \"require\", \"module\", ...DENIED_GLOBALS,\r\n `\"use strict\";\\nreturn function () {\\n${js}\\n};`,\r\n );\r\n factory(mod.exports, require, mod)();\r\n\r\n const ctor = mod.exports.default as NodeConstructor | undefined;\r\n if (typeof ctor !== \"function\" || getNodeDescriptor(ctor) === undefined) {\r\n throw new Error(\"This script must `export default` a class decorated with @node(...).\");\r\n }\r\n return ctor;\r\n }\r\n\r\n /** One key, one factory — see {@link addNode} for why. */\r\n private _claimed(key: string, factory: CommandFactory | VariableCommandFactory): boolean {\r\n const existing = this._commands.get(key);\r\n if (!existing) return false;\r\n if (existing.factory === factory) return true;\r\n throw new Error(\r\n `Command type \"${key}\" is already registered to a different factory. Keys must be unique.`,\r\n );\r\n }\r\n\r\n /**\r\n * A class's editable properties, read off its `@property` declarations.\r\n *\r\n * The whole prototype chain, so a `Card` extending `Rect` publishes the box\r\n * it inherits as well as what it adds — a host editing one edits every\r\n * control it actually has, without the subclass restating any of them.\r\n */\r\n private _describeProperties(ctor: NodeConstructor): Record<string, NodePropertyDescriptor> {\r\n const out: Record<string, NodePropertyDescriptor> = {};\r\n for (const meta of getPropertyMeta(Object.create(ctor.prototype) as object)) {\r\n if (meta.withdrawn) continue;\r\n const editor: PropertyEditor = meta.editor ?? {};\r\n out[meta.key] = {\r\n ...editor,\r\n kind: editor.kind ?? this._inferKind(meta.default),\r\n ...(meta.default !== undefined ? { default: meta.default } : {}),\r\n };\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * A type's dimension, read off the prototype without constructing one.\r\n *\r\n * `Node.dimension` is a getter rather than a field for exactly this reason —\r\n * it answers from the prototype, before any field initializer has run.\r\n */\r\n private _describeDimension(ctor: NodeConstructor): NodeDimension | undefined {\r\n const dimension = (Object.create(ctor.prototype) as Node).dimension;\r\n return typeof dimension === \"string\" ? dimension : undefined;\r\n }\r\n\r\n /**\r\n * The control a value's own type implies. Only ever a fallback: a typed\r\n * decorator states its kind, and a plain `@property` may too.\r\n *\r\n * A function default is a *reactive binding*, not a value, so it says nothing\r\n * about the control; those declare their kind or take \"unknown\", which a host\r\n * draws as read-only rather than guessing.\r\n */\r\n private _inferKind(value: unknown): string {\r\n switch (typeof value) {\r\n case \"number\": return \"number\";\r\n case \"string\": return \"text\";\r\n case \"boolean\": return \"boolean\";\r\n case \"object\":\r\n if (value === null) return \"unknown\";\r\n return Array.isArray(value) && value.every(v => typeof v === \"number\")\r\n ? \"vector\"\r\n : \"object\";\r\n default: return \"unknown\";\r\n }\r\n }\r\n\r\n /** A command's arguments as descriptors, whichever shorthand they were written in. */\r\n private _describeArgs(args: readonly CommandArg[] | undefined): CommandArgDescriptor[] {\r\n return (args ?? []).map((arg) =>\r\n typeof arg === \"string\" ? { key: arg, kind: \"unknown\" } : { kind: \"unknown\", ...arg });\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"timeline-patch.js","sourceRoot":"","sources":["../../src/document/timeline-patch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAiB,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAkD,MAAM,SAAS,CAAC;AA0CjG;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC7B,IAAc,EACd,IAAc,EACd,IAAc,EACd,GAAqB,EACrB,UAAwB,EAAE;IAE1B,IAAI,IAAI,CAAC,WA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AC;IACzB,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IAClC,IAAI,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,CAAuB,EAAE,CAAuB;IAC9D,OAAO,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,GAAG,CAAC;AACtD,CAAC;AAED,SAAS,QAAQ,CAAC,CAAgC,EAAE,CAAgC;IAChF,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IACnE,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import type { CommandTraits } from \"./command-traits\";\nimport { jsonEqual, type ClipDiff } from \"./diff\";\nimport type { DocIndex } from \"./doc-index\";\nimport type { ExpressionRefs } from \"./expression/refs\";\nimport { nodeSpan, ROOT_NODE_ID, type CommandSpec, type NodeSpan, type NodeSpec } from \"./types\";\n\n/** What the planner needs to know about code, so it can be exercised without a registry. */\nexport interface PatchEnvironment {\n traits(spec: CommandSpec, target: NodeSpec | undefined): CommandTraits | null;\n /** Node ids the command's args name (`moveTo`'s `target`). Absent names none. */\n nodeRefs?(spec: CommandSpec, target: NodeSpec | undefined): readonly string[];\n isContextProvider(type: string): boolean;\n isLayoutNeutralProp(type: string, key: string): boolean;\n /** The live instance's constructor, or `undefined` when there is none to compare. */\n ctorOf(id: string): unknown;\n registeredCtor(type: string): unknown;\n /** A type's tree; `\"audio\"` rows are left out of layout decisions. Absent treats every type as laid out. */\n dimensionOf?(type: string): string | undefined;\n}\n\nexport interface TimelinePatch {\n prev: DocIndex;\n next: DocIndex;\n diff: ClipDiff;\n added: ReadonlySet<string>;\n removed: ReadonlySet<string>;\n /** Kept ids that get a new instance. */\n reinstantiate: ReadonlySet<string>;\n detach: ReadonlySet<string>;\n /** Nodes whose command chains are rebuilt; may include the root `\"\"`. */\n dirtyNodes: ReadonlySet<string>;\n dirtyVariables: ReadonlySet<string>;\n /** Clean chains that must run for dirty ones to build against the right values; empty means none. */\n replay: ReadonlySet<string> | \"all\";\n /** Arrival baselines to take during the walk, ascending by `at`. */\n captures: ReadonlyArray<{ at: number; id: string }>;\n layoutChanged: boolean;\n}\n\nexport interface PatchOptions {\n /** Rebuild instead once more than this fraction of nodes would be re-instantiated. Default 0.5. */\n rebuildFraction?: number;\n /** Patch whenever at most this many nodes would be re-instantiated, whatever the fraction. Default {@link MIN_REBUILD_NODES}. */\n minRebuildNodes?: number;\n}\n\n/**\n * A rebuild of a small clip is not cheaper than patching it: the runtime also\n * throws away the track's asset index, sweeps it again and republishes it.\n */\nexport const MIN_REBUILD_NODES = 16;\n\n/**\n * Plan an in-place update of a built clip from `prev` to `next`, or `null` when\n * only a rebuild is sound.\n *\n * Every rule errs towards doing more: a node marked dirty that did not need it\n * costs one chain rebuild, while one missed renders a frame that disagrees with\n * a fresh build of the same document.\n */\nexport function planTimelinePatch(\n prev: DocIndex,\n next: DocIndex,\n diff: ClipDiff,\n env: PatchEnvironment,\n options: PatchOptions = {},\n): TimelinePatch | null {\n if (diff.kindChanged || diff.themeChanged) return null;\n if (structurallyFaulty(prev) || structurallyFaulty(next)) return null;\n const prevRoot = prev.nodes.get(ROOT_NODE_ID)!;\n const nextRoot = next.nodes.get(ROOT_NODE_ID)!;\n // The canvas is never re-instantiated, so only props it can be reset and re-set to are patched.\n if (diff.rootChanged && !onlyPropsDiffer(prevRoot, nextRoot)) return null;\n if (next.issues.unparsable || next.issues.unresolvedRefs) return null;\n if (diff.remappedKeys.size > 0) return null;\n\n const prevTraits = traitsOf(prev, env);\n const nextTraits = prevTraits && traitsOf(next, env);\n if (!prevTraits || !nextTraits) return null;\n\n const { added, removed, respec, moved, span, reorderedParents } = diff.nodes;\n const targeted = (id: string): boolean => (next.byTarget.get(id)?.length ?? 0) > 0;\n const anyCommand = (index: DocIndex, traits: Map<string, CommandTraits>, id: string, test: (t: CommandTraits) => boolean) =>\n index.byTarget.get(id)?.some((cid) => test(traits.get(cid)!)) ?? false;\n const unknownEither = (id: string) =>\n anyCommand(prev, prevTraits, id, (t) => !t.known) || anyCommand(next, nextTraits, id, (t) => !t.known);\n const laidOut = (index: DocIndex, id: string) => {\n const type = index.nodes.get(id)?.type;\n return type === undefined || env.dimensionOf?.(type) !== \"audio\";\n };\n const laidOutEither = (id: string) => laidOut(prev, id) || laidOut(next, id);\n const kept: string[] = [];\n for (const id of next.nodes.keys()) {\n if (id !== ROOT_NODE_ID && prev.nodes.has(id)) kept.push(id);\n }\n\n // ── Re-instantiation ────────────────────────────────────────────────────\n const R = new Set<string>();\n const isProvider = (id: string) => {\n const a = prev.nodes.get(id)?.type;\n const b = next.nodes.get(id)?.type;\n return (a !== undefined && env.isContextProvider(a)) || (b !== undefined && env.isContextProvider(b));\n };\n const reinstantiate = (id: string) => {\n if (R.has(id)) return;\n R.add(id);\n // A provider among the descendants needs no recursion: its subtree is already in this one.\n if (isProvider(id)) for (const d of next.descendants(id)) R.add(d);\n };\n\n for (const id of respec) reinstantiate(id);\n for (const id of moved) {\n reinstantiate(id);\n if (providerAbove(prev, id, env) || providerAbove(next, id, env)) {\n for (const d of next.descendants(id)) R.add(d);\n }\n }\n for (const id of [...added, ...removed]) {\n if (isProvider(id)) for (const d of next.descendants(id)) R.add(d);\n }\n let reregistered = false;\n for (const id of kept) {\n const live = env.ctorOf(id);\n if (live !== undefined && env.registeredCtor(next.nodes.get(id)!.type) !== live) {\n reinstantiate(id);\n if (laidOutEither(id)) reregistered = true;\n }\n if (targeted(id) && prev.initialKey(id) !== next.initialKey(id)) reinstantiate(id);\n }\n\n // ── Dirty chains ────────────────────────────────────────────────────────\n const DN = new Set<string>();\n const DV = new Set<string>();\n const mark = (id: string) => {\n if (next.variables.has(id)) DV.add(id);\n else if (next.nodes.has(id)) DN.add(id);\n };\n\n for (const cid of diff.commands.added) mark(next.targetOf(next.commands.get(cid)!));\n for (const cid of diff.commands.removed) mark(prev.targetOf(prev.commands.get(cid)!));\n for (const cid of diff.commands.changed) {\n mark(prev.targetOf(prev.commands.get(cid)!));\n mark(next.targetOf(next.commands.get(cid)!));\n }\n for (const id of new Set([...prev.byTarget.keys(), ...next.byTarget.keys()])) {\n if (!sameList(prev.byTarget.get(id), next.byTarget.get(id))) mark(id);\n }\n for (const at of diff.commands.reorderedAts) {\n for (const spec of prev.commandsAt(at)) mark(prev.targetOf(spec));\n for (const spec of next.commandsAt(at)) mark(next.targetOf(spec));\n }\n // An unlimited loop is built to fill the clip it found, so a clip that grew\n // or shrank rebuilds it — nothing on the command itself changed.\n if (diff.duration) {\n for (const spec of next.commands.values()) {\n if (spec.loop?.count === null) mark(next.targetOf(spec));\n }\n }\n for (const id of diff.variables.added) DV.add(id);\n for (const id of diff.variables.changed) DV.add(id);\n\n const presenceChanged = new Set<string>();\n for (const id of kept) {\n if (!sameSpan(prev.effSpan(id), next.effSpan(id))) {\n presenceChanged.add(id);\n if (targeted(id)) DN.add(id);\n } else if (\n targeted(id)\n && (prev.captureKey(id) !== next.captureKey(id) || prev.captureTime(id) !== next.captureTime(id))\n ) {\n DN.add(id);\n }\n }\n\n let L = reorderedParents.size > 0 || reregistered\n || [...added].some((id) => laidOut(next, id))\n || [...removed].some((id) => laidOut(prev, id))\n || [...moved].some(laidOutEither)\n || [...span].some(laidOutEither)\n || [...respec].some((id) => laidOutEither(id) && respecTouchesLayout(prev.nodes.get(id)!, next.nodes.get(id)!, env))\n || (diff.rootChanged && respecTouchesLayout(prevRoot, nextRoot, env));\n\n // Nodes whose prop values over time may differ from the live build: anything\n // reading one of them through `[key.prop]` builds its chain from different values.\n const valueChanged = new Set<string>([...added, ...removed, ...presenceChanged]);\n if (diff.rootChanged) valueChanged.add(ROOT_NODE_ID);\n const aimed = [...nodeReaders(prev, env), ...nodeReaders(next, env)];\n const bindsLayout = (reader: string, reads: (refs: ExpressionRefs) => boolean) => {\n const type = next.nodes.get(reader)?.type;\n if (type === undefined || env.dimensionOf?.(type) === \"audio\") return false;\n for (const [prop, refs] of next.bindings(reader)) {\n if (reads(refs) && !env.isLayoutNeutralProp(type, prop)) return true;\n }\n return false;\n };\n\n let size = -1;\n while (size !== DN.size + DV.size + R.size + valueChanged.size + (L ? 1 : 0)) {\n size = DN.size + DV.size + R.size + valueChanged.size + (L ? 1 : 0);\n\n for (const id of R) if (targeted(id)) DN.add(id);\n for (const id of R) valueChanged.add(id);\n for (const id of DN) valueChanged.add(id);\n\n for (const v of DV) {\n for (const reader of next.dependents.byVar.get(v) ?? []) {\n valueChanged.add(reader);\n if (!L && bindsLayout(reader, (refs) => refs.vars.includes(v))) L = true;\n }\n }\n for (const id of valueChanged) {\n for (const key of keysOf(prev, next, id)) {\n for (const reader of next.dependents.byKey.get(key) ?? []) {\n valueChanged.add(reader);\n if (!L && bindsLayout(reader, (refs) => refs.keys.some(([k]) => k === key))) L = true;\n }\n }\n }\n // Where a named node is depends on every ancestor too.\n for (const { reader, ref } of aimed) {\n if (lineageIn(prev, ref, valueChanged) || lineageIn(next, ref, valueChanged)) valueChanged.add(reader);\n }\n for (const id of valueChanged) if (next.nodes.has(id) && targeted(id)) DN.add(id);\n\n for (const id of DN) {\n if (id !== ROOT_NODE_ID && unknownEither(id)) reinstantiate(id);\n }\n\n if (!L) {\n for (const id of [...DN, ...DV]) {\n if (anyCommand(prev, prevTraits, id, (t) => t.writesLayout) || anyCommand(next, nextTraits, id, (t) => t.writesLayout)) {\n L = true;\n break;\n }\n }\n }\n if (L) {\n for (const id of next.byTarget.keys()) {\n if (next.nodes.has(id) && anyCommand(next, nextTraits, id, (t) => t.readsLayout)) DN.add(id);\n }\n }\n }\n\n if (DN.has(ROOT_NODE_ID) && unknownEither(ROOT_NODE_ID)) return null;\n const limit = Math.max((options.rebuildFraction ?? 0.5) * next.nodeCount, options.minRebuildNodes ?? MIN_REBUILD_NODES);\n if (R.size > limit) return null;\n\n // ── Replay ──────────────────────────────────────────────────────────────\n let replay: Set<string> | \"all\";\n const dirtyTargets = [...DN, ...DV];\n if (dirtyTargets.some((id) => anyCommand(next, nextTraits, id, (t) => t.readsLayout || !t.known))) {\n replay = \"all\";\n } else {\n replay = new Set<string>();\n const queue: string[] = [];\n const visited = new Set<string>();\n for (const id of DN) {\n const refs = next.refs(id);\n if (refs.vars.length === 0 && refs.keys.length === 0) continue;\n if (!(next.byTarget.get(id) ?? []).some((cid) => next.commands.get(cid)!.type !== \"set\")) continue;\n visited.add(id);\n queue.push(id);\n }\n while (queue.length > 0) {\n const refs = next.refs(queue.pop()!);\n for (const v of refs.vars) {\n if (!DV.has(v) && targeted(v)) replay.add(v);\n }\n for (const [key] of refs.keys) {\n const id = next.keyed.get(key);\n if (id === undefined) continue;\n if (!DN.has(id) && targeted(id)) replay.add(id);\n if (!visited.has(id)) {\n visited.add(id);\n queue.push(id);\n }\n }\n }\n }\n\n // ── Structure ───────────────────────────────────────────────────────────\n const detach = new Set<string>([...removed, ...R]);\n for (const parent of reorderedParents) {\n for (const child of next.children(parent)) if (prev.nodes.has(child)) detach.add(child);\n }\n for (const id of R) {\n for (const child of next.children(id)) detach.add(child);\n }\n\n const captures: Array<{ at: number; id: string }> = [];\n for (const id of new Set([...DN, ...R, ...added])) {\n if (!targeted(id)) continue;\n const at = next.captureTime(id);\n if (at !== undefined) captures.push({ at, id });\n }\n captures.sort((a, b) => a.at - b.at);\n\n return {\n prev,\n next,\n diff,\n added,\n removed,\n reinstantiate: R,\n detach,\n dirtyNodes: DN,\n dirtyVariables: DV,\n replay,\n captures,\n layoutChanged: L,\n };\n}\n\nfunction structurallyFaulty(index: DocIndex): boolean {\n const { duplicateIds, duplicateKeys, unresolvedParent, cycle, invalidRoot } = index.issues;\n return duplicateIds || duplicateKeys || unresolvedParent || cycle || invalidRoot;\n}\n\n/**\n * Every command's traits, or `null` when one cannot be patched at all: it does\n * not resolve, it changes structure, or its target is not the kind its scope names.\n */\nfunction traitsOf(index: DocIndex, env: PatchEnvironment): Map<string, CommandTraits> | null {\n const out = new Map<string, CommandTraits>();\n for (const spec of index.ordered) {\n const targetId = index.targetOf(spec);\n const target = index.nodes.get(targetId);\n const traits = env.traits(spec, target);\n if (!traits || traits.lifecycle) return null;\n if (traits.scope === \"variable\" ? !index.variables.has(targetId) : !target) return null;\n out.set(spec.id, traits);\n }\n return out;\n}\n\n/** Each command target paired with a node its args name. */\nfunction nodeReaders(index: DocIndex, env: PatchEnvironment): Array<{ reader: string; ref: string }> {\n if (!env.nodeRefs) return [];\n const out: Array<{ reader: string; ref: string }> = [];\n for (const spec of index.ordered) {\n const reader = index.targetOf(spec);\n for (const ref of env.nodeRefs(spec, index.nodes.get(reader))) out.push({ reader, ref });\n }\n return out;\n}\n\n/** Whether `id` or any ancestor of it is in `set`. */\nfunction lineageIn(index: DocIndex, id: string, set: ReadonlySet<string>): boolean {\n const seen = new Set<string>();\n let cursor: string | undefined = id;\n while (cursor !== undefined && !seen.has(cursor)) {\n if (set.has(cursor)) return true;\n seen.add(cursor);\n const spec = index.nodes.get(cursor);\n if (!spec || cursor === ROOT_NODE_ID) return false;\n cursor = spec.parentId ?? ROOT_NODE_ID;\n }\n return false;\n}\n\nfunction providerAbove(index: DocIndex, id: string, env: PatchEnvironment): boolean {\n const seen = new Set<string>([id]);\n let cursor = index.nodes.get(id);\n while (cursor && cursor.id !== ROOT_NODE_ID) {\n const parentId: string = cursor.parentId ?? ROOT_NODE_ID;\n if (seen.has(parentId)) return false;\n seen.add(parentId);\n cursor = index.nodes.get(parentId);\n if (cursor && env.isContextProvider(cursor.type)) return true;\n }\n return false;\n}\n\nfunction onlyPropsDiffer(a: NodeSpec, b: NodeSpec): boolean {\n const sa = nodeSpan(a);\n const sb = nodeSpan(b);\n return a.type === b.type && a.key === b.key && a.parentId === b.parentId && a.layerOrder === b.layerOrder\n && sa.start === sb.start && sa.end === sb.end;\n}\n\nfunction respecTouchesLayout(a: NodeSpec, b: NodeSpec, env: PatchEnvironment): boolean {\n if (a.type !== b.type || a.key !== b.key) return true;\n for (const key of new Set([...Object.keys(a.props), ...Object.keys(b.props)])) {\n if (!jsonEqual(a.props[key], b.props[key]) && !env.isLayoutNeutralProp(b.type, key)) return true;\n }\n return false;\n}\n\nfunction keysOf(prev: DocIndex, next: DocIndex, id: string): string[] {\n const out: string[] = [];\n const a = prev.nodes.get(id)?.key;\n const b = next.nodes.get(id)?.key;\n if (a) out.push(a);\n if (b && b !== a) out.push(b);\n return out;\n}\n\nfunction sameSpan(a: NodeSpan | undefined, b: NodeSpan | undefined): boolean {\n return a?.start === b?.start && a?.end === b?.end;\n}\n\nfunction sameList(a: readonly string[] | undefined, b: readonly string[] | undefined): boolean {\n if (a === b) return true;\n if (!a || !b || a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n return true;\n}\n"]}
1
+ {"version":3,"file":"timeline-patch.js","sourceRoot":"","sources":["../../src/document/timeline-patch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAiB,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAkD,MAAM,SAAS,CAAC;AA0CjG;;;GAGG;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r\nimport type { DocIndex } from \"./doc-index\";\r\nimport type { ExpressionRefs } from \"./expression/refs\";\r\nimport { nodeSpan, ROOT_NODE_ID, type CommandSpec, type NodeSpan, type NodeSpec } from \"./types\";\r\n\r\n/** What the planner needs to know about code, so it can be exercised without a registry. */\r\nexport interface PatchEnvironment {\r\n traits(spec: CommandSpec, target: NodeSpec | undefined): CommandTraits | null;\r\n /** Node ids the command's args name (`moveTo`'s `target`). Absent names none. */\r\n nodeRefs?(spec: CommandSpec, target: NodeSpec | undefined): readonly string[];\r\n isContextProvider(type: string): boolean;\r\n isLayoutNeutralProp(type: string, key: string): boolean;\r\n /** The live instance's constructor, or `undefined` when there is none to compare. */\r\n ctorOf(id: string): unknown;\r\n registeredCtor(type: string): unknown;\r\n /** A type's tree; `\"audio\"` rows are left out of layout decisions. Absent treats every type as laid out. */\r\n dimensionOf?(type: string): string | undefined;\r\n}\r\n\r\nexport interface TimelinePatch {\r\n prev: DocIndex;\r\n next: DocIndex;\r\n diff: ClipDiff;\r\n added: ReadonlySet<string>;\r\n removed: ReadonlySet<string>;\r\n /** Kept ids that get a new instance. */\r\n reinstantiate: ReadonlySet<string>;\r\n detach: ReadonlySet<string>;\r\n /** Nodes whose command chains are rebuilt; may include the root `\"\"`. */\r\n dirtyNodes: ReadonlySet<string>;\r\n dirtyVariables: ReadonlySet<string>;\r\n /** Clean chains that must run for dirty ones to build against the right values; empty means none. */\r\n replay: ReadonlySet<string> | \"all\";\r\n /** Arrival baselines to take during the walk, ascending by `at`. */\r\n captures: ReadonlyArray<{ at: number; id: string }>;\r\n layoutChanged: boolean;\r\n}\r\n\r\nexport interface PatchOptions {\r\n /** Rebuild instead once more than this fraction of nodes would be re-instantiated. Default 0.5. */\r\n rebuildFraction?: number;\r\n /** Patch whenever at most this many nodes would be re-instantiated, whatever the fraction. Default {@link MIN_REBUILD_NODES}. */\r\n minRebuildNodes?: number;\r\n}\r\n\r\n/**\r\n * A rebuild of a small clip is not cheaper than patching it: the runtime also\r\n * throws away the track's asset index, sweeps it again and republishes it.\r\n */\r\nexport const MIN_REBUILD_NODES = 16;\r\n\r\n/**\r\n * Plan an in-place update of a built clip from `prev` to `next`, or `null` when\r\n * only a rebuild is sound.\r\n *\r\n * Every rule errs towards doing more: a node marked dirty that did not need it\r\n * costs one chain rebuild, while one missed renders a frame that disagrees with\r\n * a fresh build of the same document.\r\n */\r\nexport function planTimelinePatch(\r\n prev: DocIndex,\r\n next: DocIndex,\r\n diff: ClipDiff,\r\n env: PatchEnvironment,\r\n options: PatchOptions = {},\r\n): TimelinePatch | null {\r\n if (diff.kindChanged || diff.themeChanged) return null;\r\n if (structurallyFaulty(prev) || structurallyFaulty(next)) return null;\r\n const prevRoot = prev.nodes.get(ROOT_NODE_ID)!;\r\n const nextRoot = next.nodes.get(ROOT_NODE_ID)!;\r\n // The canvas is never re-instantiated, so only props it can be reset and re-set to are patched.\r\n if (diff.rootChanged && !onlyPropsDiffer(prevRoot, nextRoot)) return null;\r\n if (next.issues.unparsable || next.issues.unresolvedRefs) return null;\r\n if (diff.remappedKeys.size > 0) return null;\r\n\r\n const prevTraits = traitsOf(prev, env);\r\n const nextTraits = prevTraits && traitsOf(next, env);\r\n if (!prevTraits || !nextTraits) return null;\r\n\r\n const { added, removed, respec, moved, span, reorderedParents } = diff.nodes;\r\n const targeted = (id: string): boolean => (next.byTarget.get(id)?.length ?? 0) > 0;\r\n const anyCommand = (index: DocIndex, traits: Map<string, CommandTraits>, id: string, test: (t: CommandTraits) => boolean) =>\r\n index.byTarget.get(id)?.some((cid) => test(traits.get(cid)!)) ?? false;\r\n const unknownEither = (id: string) =>\r\n anyCommand(prev, prevTraits, id, (t) => !t.known) || anyCommand(next, nextTraits, id, (t) => !t.known);\r\n const laidOut = (index: DocIndex, id: string) => {\r\n const type = index.nodes.get(id)?.type;\r\n return type === undefined || env.dimensionOf?.(type) !== \"audio\";\r\n };\r\n const laidOutEither = (id: string) => laidOut(prev, id) || laidOut(next, id);\r\n const kept: string[] = [];\r\n for (const id of next.nodes.keys()) {\r\n if (id !== ROOT_NODE_ID && prev.nodes.has(id)) kept.push(id);\r\n }\r\n\r\n // ── Re-instantiation ────────────────────────────────────────────────────\r\n const R = new Set<string>();\r\n const isProvider = (id: string) => {\r\n const a = prev.nodes.get(id)?.type;\r\n const b = next.nodes.get(id)?.type;\r\n return (a !== undefined && env.isContextProvider(a)) || (b !== undefined && env.isContextProvider(b));\r\n };\r\n const reinstantiate = (id: string) => {\r\n if (R.has(id)) return;\r\n R.add(id);\r\n // A provider among the descendants needs no recursion: its subtree is already in this one.\r\n if (isProvider(id)) for (const d of next.descendants(id)) R.add(d);\r\n };\r\n\r\n for (const id of respec) reinstantiate(id);\r\n for (const id of moved) {\r\n reinstantiate(id);\r\n if (providerAbove(prev, id, env) || providerAbove(next, id, env)) {\r\n for (const d of next.descendants(id)) R.add(d);\r\n }\r\n }\r\n for (const id of [...added, ...removed]) {\r\n if (isProvider(id)) for (const d of next.descendants(id)) R.add(d);\r\n }\r\n let reregistered = false;\r\n for (const id of kept) {\r\n const live = env.ctorOf(id);\r\n if (live !== undefined && env.registeredCtor(next.nodes.get(id)!.type) !== live) {\r\n reinstantiate(id);\r\n if (laidOutEither(id)) reregistered = true;\r\n }\r\n if (targeted(id) && prev.initialKey(id) !== next.initialKey(id)) reinstantiate(id);\r\n }\r\n\r\n // ── Dirty chains ────────────────────────────────────────────────────────\r\n const DN = new Set<string>();\r\n const DV = new Set<string>();\r\n const mark = (id: string) => {\r\n if (next.variables.has(id)) DV.add(id);\r\n else if (next.nodes.has(id)) DN.add(id);\r\n };\r\n\r\n for (const cid of diff.commands.added) mark(next.targetOf(next.commands.get(cid)!));\r\n for (const cid of diff.commands.removed) mark(prev.targetOf(prev.commands.get(cid)!));\r\n for (const cid of diff.commands.changed) {\r\n mark(prev.targetOf(prev.commands.get(cid)!));\r\n mark(next.targetOf(next.commands.get(cid)!));\r\n }\r\n for (const id of new Set([...prev.byTarget.keys(), ...next.byTarget.keys()])) {\r\n if (!sameList(prev.byTarget.get(id), next.byTarget.get(id))) mark(id);\r\n }\r\n for (const at of diff.commands.reorderedAts) {\r\n for (const spec of prev.commandsAt(at)) mark(prev.targetOf(spec));\r\n for (const spec of next.commandsAt(at)) mark(next.targetOf(spec));\r\n }\r\n // An unlimited loop is built to fill the clip it found, so a clip that grew\r\n // or shrank rebuilds it — nothing on the command itself changed.\r\n if (diff.duration) {\r\n for (const spec of next.commands.values()) {\r\n if (spec.loop?.count === null) mark(next.targetOf(spec));\r\n }\r\n }\r\n for (const id of diff.variables.added) DV.add(id);\r\n for (const id of diff.variables.changed) DV.add(id);\r\n\r\n const presenceChanged = new Set<string>();\r\n for (const id of kept) {\r\n if (!sameSpan(prev.effSpan(id), next.effSpan(id))) {\r\n presenceChanged.add(id);\r\n if (targeted(id)) DN.add(id);\r\n } else if (\r\n targeted(id)\r\n && (prev.captureKey(id) !== next.captureKey(id) || prev.captureTime(id) !== next.captureTime(id))\r\n ) {\r\n DN.add(id);\r\n }\r\n }\r\n\r\n let L = reorderedParents.size > 0 || reregistered\r\n || [...added].some((id) => laidOut(next, id))\r\n || [...removed].some((id) => laidOut(prev, id))\r\n || [...moved].some(laidOutEither)\r\n || [...span].some(laidOutEither)\r\n || [...respec].some((id) => laidOutEither(id) && respecTouchesLayout(prev.nodes.get(id)!, next.nodes.get(id)!, env))\r\n || (diff.rootChanged && respecTouchesLayout(prevRoot, nextRoot, env));\r\n\r\n // Nodes whose prop values over time may differ from the live build: anything\r\n // reading one of them through `[key.prop]` builds its chain from different values.\r\n const valueChanged = new Set<string>([...added, ...removed, ...presenceChanged]);\r\n if (diff.rootChanged) valueChanged.add(ROOT_NODE_ID);\r\n const aimed = [...nodeReaders(prev, env), ...nodeReaders(next, env)];\r\n const bindsLayout = (reader: string, reads: (refs: ExpressionRefs) => boolean) => {\r\n const type = next.nodes.get(reader)?.type;\r\n if (type === undefined || env.dimensionOf?.(type) === \"audio\") return false;\r\n for (const [prop, refs] of next.bindings(reader)) {\r\n if (reads(refs) && !env.isLayoutNeutralProp(type, prop)) return true;\r\n }\r\n return false;\r\n };\r\n\r\n let size = -1;\r\n while (size !== DN.size + DV.size + R.size + valueChanged.size + (L ? 1 : 0)) {\r\n size = DN.size + DV.size + R.size + valueChanged.size + (L ? 1 : 0);\r\n\r\n for (const id of R) if (targeted(id)) DN.add(id);\r\n for (const id of R) valueChanged.add(id);\r\n for (const id of DN) valueChanged.add(id);\r\n\r\n for (const v of DV) {\r\n for (const reader of next.dependents.byVar.get(v) ?? []) {\r\n valueChanged.add(reader);\r\n if (!L && bindsLayout(reader, (refs) => refs.vars.includes(v))) L = true;\r\n }\r\n }\r\n for (const id of valueChanged) {\r\n for (const key of keysOf(prev, next, id)) {\r\n for (const reader of next.dependents.byKey.get(key) ?? []) {\r\n valueChanged.add(reader);\r\n if (!L && bindsLayout(reader, (refs) => refs.keys.some(([k]) => k === key))) L = true;\r\n }\r\n }\r\n }\r\n // Where a named node is depends on every ancestor too.\r\n for (const { reader, ref } of aimed) {\r\n if (lineageIn(prev, ref, valueChanged) || lineageIn(next, ref, valueChanged)) valueChanged.add(reader);\r\n }\r\n for (const id of valueChanged) if (next.nodes.has(id) && targeted(id)) DN.add(id);\r\n\r\n for (const id of DN) {\r\n if (id !== ROOT_NODE_ID && unknownEither(id)) reinstantiate(id);\r\n }\r\n\r\n if (!L) {\r\n for (const id of [...DN, ...DV]) {\r\n if (anyCommand(prev, prevTraits, id, (t) => t.writesLayout) || anyCommand(next, nextTraits, id, (t) => t.writesLayout)) {\r\n L = true;\r\n break;\r\n }\r\n }\r\n }\r\n if (L) {\r\n for (const id of next.byTarget.keys()) {\r\n if (next.nodes.has(id) && anyCommand(next, nextTraits, id, (t) => t.readsLayout)) DN.add(id);\r\n }\r\n }\r\n }\r\n\r\n if (DN.has(ROOT_NODE_ID) && unknownEither(ROOT_NODE_ID)) return null;\r\n const limit = Math.max((options.rebuildFraction ?? 0.5) * next.nodeCount, options.minRebuildNodes ?? MIN_REBUILD_NODES);\r\n if (R.size > limit) return null;\r\n\r\n // ── Replay ──────────────────────────────────────────────────────────────\r\n let replay: Set<string> | \"all\";\r\n const dirtyTargets = [...DN, ...DV];\r\n if (dirtyTargets.some((id) => anyCommand(next, nextTraits, id, (t) => t.readsLayout || !t.known))) {\r\n replay = \"all\";\r\n } else {\r\n replay = new Set<string>();\r\n const queue: string[] = [];\r\n const visited = new Set<string>();\r\n for (const id of DN) {\r\n const refs = next.refs(id);\r\n if (refs.vars.length === 0 && refs.keys.length === 0) continue;\r\n if (!(next.byTarget.get(id) ?? []).some((cid) => next.commands.get(cid)!.type !== \"set\")) continue;\r\n visited.add(id);\r\n queue.push(id);\r\n }\r\n while (queue.length > 0) {\r\n const refs = next.refs(queue.pop()!);\r\n for (const v of refs.vars) {\r\n if (!DV.has(v) && targeted(v)) replay.add(v);\r\n }\r\n for (const [key] of refs.keys) {\r\n const id = next.keyed.get(key);\r\n if (id === undefined) continue;\r\n if (!DN.has(id) && targeted(id)) replay.add(id);\r\n if (!visited.has(id)) {\r\n visited.add(id);\r\n queue.push(id);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // ── Structure ───────────────────────────────────────────────────────────\r\n const detach = new Set<string>([...removed, ...R]);\r\n for (const parent of reorderedParents) {\r\n for (const child of next.children(parent)) if (prev.nodes.has(child)) detach.add(child);\r\n }\r\n for (const id of R) {\r\n for (const child of next.children(id)) detach.add(child);\r\n }\r\n\r\n const captures: Array<{ at: number; id: string }> = [];\r\n for (const id of new Set([...DN, ...R, ...added])) {\r\n if (!targeted(id)) continue;\r\n const at = next.captureTime(id);\r\n if (at !== undefined) captures.push({ at, id });\r\n }\r\n captures.sort((a, b) => a.at - b.at);\r\n\r\n return {\r\n prev,\r\n next,\r\n diff,\r\n added,\r\n removed,\r\n reinstantiate: R,\r\n detach,\r\n dirtyNodes: DN,\r\n dirtyVariables: DV,\r\n replay,\r\n captures,\r\n layoutChanged: L,\r\n };\r\n}\r\n\r\nfunction structurallyFaulty(index: DocIndex): boolean {\r\n const { duplicateIds, duplicateKeys, unresolvedParent, cycle, invalidRoot } = index.issues;\r\n return duplicateIds || duplicateKeys || unresolvedParent || cycle || invalidRoot;\r\n}\r\n\r\n/**\r\n * Every command's traits, or `null` when one cannot be patched at all: it does\r\n * not resolve, it changes structure, or its target is not the kind its scope names.\r\n */\r\nfunction traitsOf(index: DocIndex, env: PatchEnvironment): Map<string, CommandTraits> | null {\r\n const out = new Map<string, CommandTraits>();\r\n for (const spec of index.ordered) {\r\n const targetId = index.targetOf(spec);\r\n const target = index.nodes.get(targetId);\r\n const traits = env.traits(spec, target);\r\n if (!traits || traits.lifecycle) return null;\r\n if (traits.scope === \"variable\" ? !index.variables.has(targetId) : !target) return null;\r\n out.set(spec.id, traits);\r\n }\r\n return out;\r\n}\r\n\r\n/** Each command target paired with a node its args name. */\r\nfunction nodeReaders(index: DocIndex, env: PatchEnvironment): Array<{ reader: string; ref: string }> {\r\n if (!env.nodeRefs) return [];\r\n const out: Array<{ reader: string; ref: string }> = [];\r\n for (const spec of index.ordered) {\r\n const reader = index.targetOf(spec);\r\n for (const ref of env.nodeRefs(spec, index.nodes.get(reader))) out.push({ reader, ref });\r\n }\r\n return out;\r\n}\r\n\r\n/** Whether `id` or any ancestor of it is in `set`. */\r\nfunction lineageIn(index: DocIndex, id: string, set: ReadonlySet<string>): boolean {\r\n const seen = new Set<string>();\r\n let cursor: string | undefined = id;\r\n while (cursor !== undefined && !seen.has(cursor)) {\r\n if (set.has(cursor)) return true;\r\n seen.add(cursor);\r\n const spec = index.nodes.get(cursor);\r\n if (!spec || cursor === ROOT_NODE_ID) return false;\r\n cursor = spec.parentId ?? ROOT_NODE_ID;\r\n }\r\n return false;\r\n}\r\n\r\nfunction providerAbove(index: DocIndex, id: string, env: PatchEnvironment): boolean {\r\n const seen = new Set<string>([id]);\r\n let cursor = index.nodes.get(id);\r\n while (cursor && cursor.id !== ROOT_NODE_ID) {\r\n const parentId: string = cursor.parentId ?? ROOT_NODE_ID;\r\n if (seen.has(parentId)) return false;\r\n seen.add(parentId);\r\n cursor = index.nodes.get(parentId);\r\n if (cursor && env.isContextProvider(cursor.type)) return true;\r\n }\r\n return false;\r\n}\r\n\r\nfunction onlyPropsDiffer(a: NodeSpec, b: NodeSpec): boolean {\r\n const sa = nodeSpan(a);\r\n const sb = nodeSpan(b);\r\n return a.type === b.type && a.key === b.key && a.parentId === b.parentId && a.layerOrder === b.layerOrder\r\n && sa.start === sb.start && sa.end === sb.end;\r\n}\r\n\r\nfunction respecTouchesLayout(a: NodeSpec, b: NodeSpec, env: PatchEnvironment): boolean {\r\n if (a.type !== b.type || a.key !== b.key) return true;\r\n for (const key of new Set([...Object.keys(a.props), ...Object.keys(b.props)])) {\r\n if (!jsonEqual(a.props[key], b.props[key]) && !env.isLayoutNeutralProp(b.type, key)) return true;\r\n }\r\n return false;\r\n}\r\n\r\nfunction keysOf(prev: DocIndex, next: DocIndex, id: string): string[] {\r\n const out: string[] = [];\r\n const a = prev.nodes.get(id)?.key;\r\n const b = next.nodes.get(id)?.key;\r\n if (a) out.push(a);\r\n if (b && b !== a) out.push(b);\r\n return out;\r\n}\r\n\r\nfunction sameSpan(a: NodeSpan | undefined, b: NodeSpan | undefined): boolean {\r\n return a?.start === b?.start && a?.end === b?.end;\r\n}\r\n\r\nfunction sameList(a: readonly string[] | undefined, b: readonly string[] | undefined): boolean {\r\n if (a === b) return true;\r\n if (!a || !b || a.length !== b.length) return false;\r\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\r\n return true;\r\n}\r\n"]}
@@ -1,16 +1,16 @@
1
1
  import type { Node } from "../nodes/node/node.js";
2
- import type { Canvas2D } from "../nodes/scene/canvas2d-node.js";
2
+ import type { Canvas2D } from "../nodes/root/canvas2d-node.js";
3
3
  import { PropSlot } from "../props/slot.js";
4
4
  import type { Registry } from "./registry.js";
5
5
  import { type TimelinePatch } from "./timeline-patch.js";
6
- import type { CommandSpec, SceneDocument, VariableSpec } from "./types.js";
6
+ import type { CommandSpec, VisualDocument, VariableSpec } from "./types.js";
7
7
  /**
8
- * A compiled scene document: the thing that answers "what does this look like
8
+ * A compiled clip document: the thing that answers "what does this look like
9
9
  * at `t`" without having rendered `t - 1`.
10
10
  *
11
- * This is the whole reason the document model exists. A generator scene could
11
+ * This is the whole reason the document model exists. A generator could
12
12
  * only be *advanced*, so a backward seek meant tearing the tree down and
13
- * replaying from frame 0, and a scene's duration was unknowable without running
13
+ * replaying from frame 0, and a clip's duration was unknowable without running
14
14
  * it to the end. A timeline is built once and evaluated in any order, at any
15
15
  * time, as many times as you like — which is what makes scrubbing cheap, export
16
16
  * parallelizable, and a frame reproducible.
@@ -45,13 +45,13 @@ import type { CommandSpec, SceneDocument, VariableSpec } from "./types.js";
45
45
  * to restore, because nothing overwrote it.
46
46
  *
47
47
  * A reference spelled with a dot (`"=[card.x]+20"`) reads another node's prop
48
- * instead, through the same machinery — see `SceneTimeline._resolveVariable`
48
+ * instead, through the same machinery — see `ClipTimeline._resolveVariable`
49
49
  * for why that one resolves at read time rather than at compile time.
50
50
  */
51
51
  /** A placed command as the runtime outside the timeline sees it. */
52
52
  export interface PlacedCommandInfo {
53
53
  readonly spec: CommandSpec;
54
- /** Seconds from scene start. */
54
+ /** Seconds from clip start. */
55
55
  readonly start: number;
56
56
  /** Seconds. Zero is a stamp — it applies in full from `start` onward. */
57
57
  readonly duration: number;
@@ -60,12 +60,12 @@ export interface PlacedCommandInfo {
60
60
  readonly readsLayout: boolean;
61
61
  }
62
62
  /**
63
- * The scene document, compiled and evaluable, over the one canvas it builds
63
+ * The clip document, compiled and evaluable, over the one canvas it builds
64
64
  * into — its live nodes, presence and baselines all belong to that tree.
65
65
  */
66
- export declare class SceneTimeline {
66
+ export declare class ClipTimeline {
67
67
  private readonly canvas;
68
- constructor(doc: SceneDocument, registry: Registry, canvas: Canvas2D);
68
+ constructor(doc: VisualDocument, registry: Registry, canvas: Canvas2D);
69
69
  /** How long the scene runs. Read by the runtime after {@link build}. */
70
70
  get duration(): number;
71
71
  /** Instantiate the tree into the canvas. Once per timeline: the nodes it makes belong to that canvas. */
@@ -112,13 +112,20 @@ export declare class SceneTimeline {
112
112
  syncPresence(seconds: number): boolean;
113
113
  /** The node a row built, mounted or not; the canvas for the root. */
114
114
  liveNode(id: string): Node | undefined;
115
+ /**
116
+ * What a row holds before any command has acted on it: its props as it
117
+ * arrived, or as built for one that has not arrived yet. The same at every
118
+ * time, which is what tells it from the node's live props. A bound prop is
119
+ * read through its binding, so it answers for the tree as it stands.
120
+ */
121
+ baselineProps(id: string): Record<string, unknown> | undefined;
115
122
  presenceSlot(id: string): PropSlot<boolean> | undefined;
116
123
  variableSlot(id: string): PropSlot<unknown> | undefined;
117
124
  /**
118
125
  * How to bring this built timeline to `next` in place, or `null` when only a
119
126
  * fresh build is sound. An audio document must be lowered by the caller first.
120
127
  */
121
- planUpdate(next: SceneDocument): TimelinePatch | null;
128
+ planUpdate(next: VisualDocument): TimelinePatch | null;
122
129
  /**
123
130
  * Apply a {@link planUpdate} result. The canvas must be attached at time 0
124
131
  * first, as for {@link build}; `prepare` samples and lays out like the step
@@ -160,12 +167,28 @@ export declare class SceneTimeline {
160
167
  private _animated;
161
168
  /** Only the variables some command writes to. Same reasoning. */
162
169
  private _animatedVars;
170
+ /**
171
+ * Slots on a part a node built for itself that some command writes, restored
172
+ * alongside {@link _animated}. A part is no document row, so its baseline is
173
+ * the slot's state the first time a command wrote it — see {@link _notePartWrite}.
174
+ */
175
+ private _animatedParts;
176
+ private readonly _partBaselines;
163
177
  /** Children each parent built for itself, which the document must not disturb. */
164
178
  private readonly _baseChildCount;
165
179
  /** Node ids currently in the tree, so presence only churns when it changes. */
166
180
  private readonly _present;
167
181
  /** Node ids whose baseline was taken while mounted — see {@link _compileCommands}. */
168
182
  private _baselined;
183
+ /**
184
+ * Rows present at time 0 that a lifecycle command (`removeChildAt`,
185
+ * `reparent`) took out of the parent their row names, as compile left them.
186
+ * Presence only moves a row across its own span, so nothing else would put
187
+ * one back before its command starts.
188
+ */
189
+ private _displaced;
190
+ /** Rows that arrived, or were built, while an ancestor was out of the tree and wait for it — see {@link _baselineArrival}. */
191
+ private readonly _unmounted;
169
192
  private _presence;
170
193
  /** The rows the last {@link syncPresence} brought in, in document order. */
171
194
  private _arrived;
@@ -236,11 +259,32 @@ export declare class SceneTimeline {
236
259
  * {@link _settleWindows}.
237
260
  */
238
261
  private _compileCommands;
262
+ /** The present rows whose node is no longer under the parent its row names. */
263
+ private _collectDisplaced;
264
+ /**
265
+ * Put displaced rows back where {@link syncPresence} would have inserted them.
266
+ * Returns whether any moved.
267
+ */
268
+ private _restoreDisplaced;
269
+ /** The node a row's `parentId` names: the canvas for the root, `undefined` while that row is unbuilt. */
270
+ private _declaredParent;
271
+ /**
272
+ * Take the baseline of a row that has just arrived, if it is mounted.
273
+ *
274
+ * A baseline is the node as it stands once attached: an unmounted node's cells
275
+ * hold pre-attach values, without what it inherits from its ancestors. A row
276
+ * can arrive while an ancestor is still out of the tree (a child entering
277
+ * before its parent), so its baseline waits in {@link _unmounted} until
278
+ * {@link _baselineMounted} finds it mounted.
279
+ */
280
+ private _baselineArrival;
281
+ /** Baseline the rows that arrived unmounted and have since been mounted by an ancestor arriving. */
282
+ private _baselineMounted;
239
283
  /**
240
284
  * Build one command against the tree as it stands and run it to its end —
241
285
  * which is what leaves its target where the next command's `from` must start.
242
- * Undone wholesale by {@link _restoreBaselines}. `null` when its target node
243
- * does not exist.
286
+ * Undone wholesale by {@link _restoreBaselines}. Throws when its target names
287
+ * no row, for a node-scoped command of any kind.
244
288
  *
245
289
  * The running-to-`at(1)` cannot be skipped: `node.to({ x: 100 })` reads `x`
246
290
  * when the command is *constructed*, so a chain built against the untouched
@@ -268,14 +312,23 @@ export declare class SceneTimeline {
268
312
  * playhead reached it, which is the one thing the whole design forbids.
269
313
  *
270
314
  * `writes` is already recorded (see {@link WriteRecorder}) and a slot carries
271
- * its owner, so this needs no declaration from the command. A slot whose host
272
- * is no document row — a variable's, or a cell on a child a composite built
273
- * for itself — has no baseline of its own and is skipped: the variable
274
- * arrives as {@link PlacedCommand.owner}, and the composite's child is
275
- * rebuilt with its parent.
315
+ * its owner, so this needs no declaration from the command. A variable's slot
316
+ * arrives as {@link PlacedCommand.owner}. A slot on a part a node built for
317
+ * itself has no row to be restored through, so it is restored on its own, to
318
+ * the state {@link _notePartWrite} saw before any command wrote it.
276
319
  */
277
320
  private _touch;
278
321
  private _touchOwner;
322
+ /**
323
+ * Save a part's slot the first time a command is about to write it.
324
+ *
325
+ * Called by the observer *before* the write lands, while a command is built:
326
+ * every earlier command has run to its end by then, but none of them wrote
327
+ * this slot, so what it holds is what the part was built with (plus whatever
328
+ * the command's own factory primed, which is part of the command, not of the
329
+ * part).
330
+ */
331
+ private readonly _notePartWrite;
279
332
  /**
280
333
  * Compile the expressions in a binding command's args.
281
334
  *
@@ -296,6 +349,8 @@ export declare class SceneTimeline {
296
349
  * a document that half-renders is worse than one that refuses to.
297
350
  */
298
351
  private _assertNoExpressions;
352
+ /** The live node a node-scoped command targets; one error, naming the `targetId`, when no row has it. */
353
+ private _targetOrThrow;
299
354
  /** Resolve a command's `targetId` to a live node, or `null` if it names nothing. */
300
355
  private _targetOf;
301
356
  private _evaluateObserved;