@motionscript/core 0.1.0-alpha.8 → 0.1.0-alpha.9

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 (791) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -49
  4. package/README.md +91 -91
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.js.map +1 -1
  7. package/dist/assets/errors.js.map +1 -1
  8. package/dist/assets/index.js.map +1 -1
  9. package/dist/assets/manager.js.map +1 -1
  10. package/dist/assets/manifest.js.map +1 -1
  11. package/dist/assets/record.js.map +1 -1
  12. package/dist/assets/scope.js.map +1 -1
  13. package/dist/attributes/audio/effects/chain.js.map +1 -1
  14. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -1
  15. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -1
  16. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -1
  17. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -1
  18. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -1
  19. package/dist/attributes/audio/effects/index.js.map +1 -1
  20. package/dist/attributes/audio/effects/registry.js.map +1 -1
  21. package/dist/attributes/audio/effects/union.js.map +1 -1
  22. package/dist/attributes/audio/ramp.js.map +1 -1
  23. package/dist/attributes/audio/request.js.map +1 -1
  24. package/dist/attributes/audio/schedule.js.map +1 -1
  25. package/dist/attributes/audio/sound.js.map +1 -1
  26. package/dist/attributes/audio/transition.js.map +1 -1
  27. package/dist/attributes/index.js.map +1 -1
  28. package/dist/attributes/layout/alignment.js.map +1 -1
  29. package/dist/attributes/layout/index.js.map +1 -1
  30. package/dist/attributes/layout/insets.js.map +1 -1
  31. package/dist/attributes/layout/matrix2d.js.map +1 -1
  32. package/dist/attributes/layout/size.js.map +1 -1
  33. package/dist/attributes/layout/space3d.js.map +1 -1
  34. package/dist/attributes/layout/transform3d.js.map +1 -1
  35. package/dist/attributes/layout/vector2.js.map +1 -1
  36. package/dist/attributes/layout/world-transform.js.map +1 -1
  37. package/dist/attributes/mask/boolean.js.map +1 -1
  38. package/dist/attributes/mask/mask.js.map +1 -1
  39. package/dist/attributes/properties/decorator.js.map +1 -1
  40. package/dist/attributes/properties/inputs.js.map +1 -1
  41. package/dist/attributes/properties/typed.js.map +1 -1
  42. package/dist/attributes/render3d/orbit.js.map +1 -1
  43. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  44. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  45. package/dist/attributes/shape/corners/corners.js.map +1 -1
  46. package/dist/attributes/shape/corners/index.js.map +1 -1
  47. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  48. package/dist/attributes/shape/effects/chain.js.map +1 -1
  49. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  50. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  51. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  52. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  53. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  54. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  55. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  56. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  57. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  58. package/dist/attributes/shape/effects/implementations/curves.d.ts +2 -2
  59. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  60. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  61. package/dist/attributes/shape/effects/implementations/dither.d.ts +2 -2
  62. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  63. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  64. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  65. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  66. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  67. package/dist/attributes/shape/effects/implementations/glow.d.ts +4 -4
  68. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  69. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  70. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  71. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  72. package/dist/attributes/shape/effects/implementations/invert.d.ts +2 -2
  73. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  74. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  75. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  76. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  77. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  78. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  79. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  80. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  81. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  82. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  83. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  84. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  85. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  86. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  87. package/dist/attributes/shape/effects/implementations/shader.d.ts +2 -2
  88. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  96. package/dist/attributes/shape/effects/index.js.map +1 -1
  97. package/dist/attributes/shape/effects/registry.js.map +1 -1
  98. package/dist/attributes/shape/effects/spec.js.map +1 -1
  99. package/dist/attributes/shape/effects/union.js.map +1 -1
  100. package/dist/attributes/shape/fill/blend.js.map +1 -1
  101. package/dist/attributes/shape/fill/chain.js.map +1 -1
  102. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  103. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  104. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  105. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  106. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  107. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  108. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  109. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  110. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  111. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  112. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  113. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  114. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  115. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  116. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  117. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  118. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  119. package/dist/attributes/shape/fill/index.js.map +1 -1
  120. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  121. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  122. package/dist/attributes/shape/fill/registry.js.map +1 -1
  123. package/dist/attributes/shape/fill/union.js.map +1 -1
  124. package/dist/attributes/shape/filters/chain.js.map +1 -1
  125. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  126. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  127. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  128. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  129. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  130. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  131. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  132. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  133. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  134. package/dist/attributes/shape/filters/index.js.map +1 -1
  135. package/dist/attributes/shape/filters/registry.js.map +1 -1
  136. package/dist/attributes/shape/filters/union.js.map +1 -1
  137. package/dist/attributes/shape/path/anchors.js.map +1 -1
  138. package/dist/attributes/shape/path/bezier.js.map +1 -1
  139. package/dist/attributes/shape/path/index.js.map +1 -1
  140. package/dist/attributes/shape/path/measure.js.map +1 -1
  141. package/dist/attributes/shape/path/morph.js.map +1 -1
  142. package/dist/attributes/shape/path/ops.js.map +1 -1
  143. package/dist/attributes/shape/path/types.js.map +1 -1
  144. package/dist/attributes/shape/path/walk.js.map +1 -1
  145. package/dist/attributes/shape/shaders/index.js.map +1 -1
  146. package/dist/attributes/shape/shaders/language.js.map +1 -1
  147. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  148. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  149. package/dist/attributes/shape/shadow/index.js.map +1 -1
  150. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  151. package/dist/attributes/shape/stroke/index.js.map +1 -1
  152. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  153. package/dist/attributes/shared/operators.js.map +1 -1
  154. package/dist/attributes/text/index.js.map +1 -1
  155. package/dist/attributes/text/ops.js.map +1 -1
  156. package/dist/attributes/text/types.js.map +1 -1
  157. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  158. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  159. package/dist/browser/chunks/{chunk-GKM6UZJR.js → chunk-7DB6BI27.js} +2 -2
  160. package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
  161. package/dist/browser/chunks/{chunk-AOT33LMS.js → chunk-IX53IFBD.js} +2 -2
  162. package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
  163. package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
  164. package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
  165. package/dist/browser/component.js +1 -1
  166. package/dist/browser/experimental.js +1 -1
  167. package/dist/browser/experimental.js.map +1 -1
  168. package/dist/browser/index.js +1 -1
  169. package/dist/browser/index.js.map +1 -1
  170. package/dist/browser/sdk.js +1 -1
  171. package/dist/component.js.map +1 -1
  172. package/dist/components/builtins/audio/audio.js.map +1 -1
  173. package/dist/components/builtins/geometry/composite.js.map +1 -1
  174. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  175. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  176. package/dist/components/builtins/layout/layout.js.map +1 -1
  177. package/dist/components/builtins/media/media.js.map +1 -1
  178. package/dist/components/builtins/providers/providers.js.map +1 -1
  179. package/dist/components/builtins/text/number-format.js.map +1 -1
  180. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  181. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  182. package/dist/components/builtins/text/text-layout.js.map +1 -1
  183. package/dist/components/builtins/text/text.d.ts +9 -9
  184. package/dist/components/builtins/text/text.js.map +1 -1
  185. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  186. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  187. package/dist/components/builtins/three/three.js.map +1 -1
  188. package/dist/components/factory/api.js.map +1 -1
  189. package/dist/components/factory/clip-of.js.map +1 -1
  190. package/dist/components/factory/commands-for.js.map +1 -1
  191. package/dist/components/factory/component-audio.js.map +1 -1
  192. package/dist/components/factory/component2d.js.map +1 -1
  193. package/dist/components/factory/component3d.js.map +1 -1
  194. package/dist/components/factory/factory.js.map +1 -1
  195. package/dist/components/factory/timeline.js.map +1 -1
  196. package/dist/components/factory/type-def.js.map +1 -1
  197. package/dist/components/factory/types.js.map +1 -1
  198. package/dist/components/factory/views.js.map +1 -1
  199. package/dist/components/modules/aim.js.map +1 -1
  200. package/dist/components/modules/corners.js.map +1 -1
  201. package/dist/components/modules/flow.js.map +1 -1
  202. package/dist/components/modules/material.js.map +1 -1
  203. package/dist/components/modules/paint.js.map +1 -1
  204. package/dist/components/modules/shapes.js.map +1 -1
  205. package/dist/components/modules/text-layout.js.map +1 -1
  206. package/dist/components/modules/text-style.d.ts +1 -1
  207. package/dist/components/modules/text-style.js.map +1 -1
  208. package/dist/components/modules/three-entries.js.map +1 -1
  209. package/dist/components/modules/view3d.js.map +1 -1
  210. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  211. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  212. package/dist/components/trees/2d/node-motion.js.map +1 -1
  213. package/dist/components/trees/2d/node-render.js.map +1 -1
  214. package/dist/components/trees/2d/node-space.js.map +1 -1
  215. package/dist/components/trees/2d/node-transform.js.map +1 -1
  216. package/dist/components/trees/2d/node2d.js.map +1 -1
  217. package/dist/components/trees/audio/index.js.map +1 -1
  218. package/dist/components/trees/audio/node-audio.js.map +1 -1
  219. package/dist/components/trees/index.js.map +1 -1
  220. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  221. package/dist/components/trees/node/node-reactive.js.map +1 -1
  222. package/dist/components/trees/node/node-time.js.map +1 -1
  223. package/dist/components/trees/node/node-walk.js.map +1 -1
  224. package/dist/components/trees/node/node.js.map +1 -1
  225. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  226. package/dist/components/trees/three/node3d.js.map +1 -1
  227. package/dist/document/audio.js.map +1 -1
  228. package/dist/document/builtins.js.map +1 -1
  229. package/dist/document/command-traits.js.map +1 -1
  230. package/dist/document/deny-globals.js.map +1 -1
  231. package/dist/document/diff.js.map +1 -1
  232. package/dist/document/doc-index.js.map +1 -1
  233. package/dist/document/expression/compile.js.map +1 -1
  234. package/dist/document/expression/index.js.map +1 -1
  235. package/dist/document/expression/ops.js.map +1 -1
  236. package/dist/document/expression/parse.js.map +1 -1
  237. package/dist/document/expression/refs.js.map +1 -1
  238. package/dist/document/expression/types.js.map +1 -1
  239. package/dist/document/expression/walk.js.map +1 -1
  240. package/dist/document/index.js.map +1 -1
  241. package/dist/document/migrate.js.map +1 -1
  242. package/dist/document/missing-node.js.map +1 -1
  243. package/dist/document/node-decorator.js.map +1 -1
  244. package/dist/document/node-descriptor.js.map +1 -1
  245. package/dist/document/placement.js.map +1 -1
  246. package/dist/document/project.js.map +1 -1
  247. package/dist/document/prop-evolution.js.map +1 -1
  248. package/dist/document/registry.js.map +1 -1
  249. package/dist/document/settled-index.js.map +1 -1
  250. package/dist/document/timeline-patch.js.map +1 -1
  251. package/dist/document/timeline.js.map +1 -1
  252. package/dist/document/types.js.map +1 -1
  253. package/dist/document/validate.js.map +1 -1
  254. package/dist/document/vocabulary.js.map +1 -1
  255. package/dist/experimental.d.ts.map +1 -1
  256. package/dist/experimental.js.map +1 -1
  257. package/dist/index.js.map +1 -1
  258. package/dist/layout/bounds.js.map +1 -1
  259. package/dist/layout/constraints.js.map +1 -1
  260. package/dist/layout/flex.js.map +1 -1
  261. package/dist/layout/freeform.js.map +1 -1
  262. package/dist/layout/grid.js.map +1 -1
  263. package/dist/layout/index.js.map +1 -1
  264. package/dist/layout/item.js.map +1 -1
  265. package/dist/layout/ops.js.map +1 -1
  266. package/dist/layout/types.js.map +1 -1
  267. package/dist/platform/audio-sink.js.map +1 -1
  268. package/dist/platform/exporter.js.map +1 -1
  269. package/dist/platform/index.js.map +1 -1
  270. package/dist/platform/stepped-clock.js.map +1 -1
  271. package/dist/platform/storage-adapter.js.map +1 -1
  272. package/dist/platform/ticker.js.map +1 -1
  273. package/dist/project/config.js.map +1 -1
  274. package/dist/project/index.js.map +1 -1
  275. package/dist/project/tree.js.map +1 -1
  276. package/dist/props/host.js.map +1 -1
  277. package/dist/props/index.js.map +1 -1
  278. package/dist/props/observer.js.map +1 -1
  279. package/dist/props/slot.js.map +1 -1
  280. package/dist/renamed-scene-names.js.map +1 -1
  281. package/dist/render/canvas-render-context2d.js.map +1 -1
  282. package/dist/render/clip-contains.js.map +1 -1
  283. package/dist/render/clip.js.map +1 -1
  284. package/dist/render/descriptors/ellipse.js.map +1 -1
  285. package/dist/render/descriptors/line.js.map +1 -1
  286. package/dist/render/descriptors/path-builder.js.map +1 -1
  287. package/dist/render/descriptors/path.js.map +1 -1
  288. package/dist/render/descriptors/polygon.js.map +1 -1
  289. package/dist/render/descriptors/polygram.js.map +1 -1
  290. package/dist/render/descriptors/rect.js.map +1 -1
  291. package/dist/render/descriptors/richtext.js.map +1 -1
  292. package/dist/render/descriptors/shape.js.map +1 -1
  293. package/dist/render/descriptors/text.js.map +1 -1
  294. package/dist/render/descriptors/transform.js.map +1 -1
  295. package/dist/render/graphics2d.js.map +1 -1
  296. package/dist/render/index.js.map +1 -1
  297. package/dist/render/measure-context.js.map +1 -1
  298. package/dist/render/null-render-context.js.map +1 -1
  299. package/dist/render/render-context2d.js.map +1 -1
  300. package/dist/render/render-issue.js.map +1 -1
  301. package/dist/render/surface.js.map +1 -1
  302. package/dist/render/text-defaults.js.map +1 -1
  303. package/dist/render/text-layout.js.map +1 -1
  304. package/dist/render3d/bounds3d.js.map +1 -1
  305. package/dist/render3d/builders.js.map +1 -1
  306. package/dist/render3d/camera.js.map +1 -1
  307. package/dist/render3d/fill3d.js.map +1 -1
  308. package/dist/render3d/geometry.js.map +1 -1
  309. package/dist/render3d/graphics3d.js.map +1 -1
  310. package/dist/render3d/index.js.map +1 -1
  311. package/dist/render3d/inert.js.map +1 -1
  312. package/dist/render3d/light.js.map +1 -1
  313. package/dist/render3d/material.js.map +1 -1
  314. package/dist/render3d/matrix4.js.map +1 -1
  315. package/dist/render3d/render-context3d.js.map +1 -1
  316. package/dist/render3d/resources.js.map +1 -1
  317. package/dist/render3d/rounded-box.js.map +1 -1
  318. package/dist/render3d/scene-settings.js.map +1 -1
  319. package/dist/render3d/scene3d.js.map +1 -1
  320. package/dist/render3d/segments.js.map +1 -1
  321. package/dist/render3d/texture.js.map +1 -1
  322. package/dist/render3d/tracking.js.map +1 -1
  323. package/dist/render3d/transform.js.map +1 -1
  324. package/dist/render3d/vector3.js.map +1 -1
  325. package/dist/render3d/walk.js.map +1 -1
  326. package/dist/runtime/asset-refine.js.map +1 -1
  327. package/dist/runtime/asset-timeline.js.map +1 -1
  328. package/dist/runtime/asset-update.js.map +1 -1
  329. package/dist/runtime/audio-index.js.map +1 -1
  330. package/dist/runtime/builtin-context.js.map +1 -1
  331. package/dist/runtime/clip-instance.js.map +1 -1
  332. package/dist/runtime/clip-store.js.map +1 -1
  333. package/dist/runtime/engine.js.map +1 -1
  334. package/dist/runtime/frame-time.js.map +1 -1
  335. package/dist/runtime/index.js.map +1 -1
  336. package/dist/runtime/node-picking.js.map +1 -1
  337. package/dist/runtime/node-picking3d.js.map +1 -1
  338. package/dist/runtime/placement.js.map +1 -1
  339. package/dist/runtime/playback-controller.js.map +1 -1
  340. package/dist/runtime/playback.js.map +1 -1
  341. package/dist/runtime/precompisition.js.map +1 -1
  342. package/dist/runtime/project-assets.js.map +1 -1
  343. package/dist/runtime/session.js.map +1 -1
  344. package/dist/runtime/settle.js.map +1 -1
  345. package/dist/runtime/state-evaluator.js.map +1 -1
  346. package/dist/runtime/text-geometry.js.map +1 -1
  347. package/dist/sdk/index.js.map +1 -1
  348. package/dist/tween/command-decorator.js.map +1 -1
  349. package/dist/tween/command.js.map +1 -1
  350. package/dist/tween/ease/constants.js.map +1 -1
  351. package/dist/tween/ease/curve.js.map +1 -1
  352. package/dist/tween/ease/describe.js.map +1 -1
  353. package/dist/tween/ease/spec.js.map +1 -1
  354. package/dist/tween/ease/type.js.map +1 -1
  355. package/dist/tween/index.js.map +1 -1
  356. package/dist/tween/inert.js.map +1 -1
  357. package/dist/tween/lerp.js.map +1 -1
  358. package/dist/tween/loop.js.map +1 -1
  359. package/dist/tween/prepare.js.map +1 -1
  360. package/dist/tween/stepper.js.map +1 -1
  361. package/dist/tween/to-command.js.map +1 -1
  362. package/dist/util/clamp.js.map +1 -1
  363. package/dist/util/context.js.map +1 -1
  364. package/dist/util/csv.js.map +1 -1
  365. package/dist/util/generateList.js.map +1 -1
  366. package/dist/util/index.js.map +1 -1
  367. package/dist/util/metrics.js.map +1 -1
  368. package/dist/util/random.js.map +1 -1
  369. package/dist/util/reference.js.map +1 -1
  370. package/dist/util/scheduler.js.map +1 -1
  371. package/package.json +1 -1
  372. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  373. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  374. package/dist/attributes/audio/filters/chain.js +0 -104
  375. package/dist/attributes/audio/filters/chain.js.map +0 -1
  376. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  377. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  378. package/dist/attributes/audio/filters/curve.js +0 -250
  379. package/dist/attributes/audio/filters/curve.js.map +0 -1
  380. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  381. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  382. package/dist/attributes/audio/filters/implementations/echo.js +0 -11
  383. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  384. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  385. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  386. package/dist/attributes/audio/filters/implementations/gain.js +0 -6
  387. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  388. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  389. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  390. package/dist/attributes/audio/filters/implementations/highpass.js +0 -10
  391. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  392. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  393. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  394. package/dist/attributes/audio/filters/implementations/lowpass.js +0 -10
  395. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  396. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  397. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  398. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  399. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  400. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  401. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  402. package/dist/attributes/audio/filters/implementations/tremolo.js +0 -10
  403. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  404. package/dist/attributes/audio/filters/index.d.ts +0 -22
  405. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  406. package/dist/attributes/audio/filters/index.js +0 -8
  407. package/dist/attributes/audio/filters/index.js.map +0 -1
  408. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  409. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  410. package/dist/attributes/audio/filters/registry.js +0 -82
  411. package/dist/attributes/audio/filters/registry.js.map +0 -1
  412. package/dist/attributes/audio/filters/union.d.ts +0 -18
  413. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  414. package/dist/attributes/audio/filters/union.js +0 -28
  415. package/dist/attributes/audio/filters/union.js.map +0 -1
  416. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  417. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  418. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  419. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  420. package/dist/browser/chunks/chunk-AOT33LMS.js.map +0 -7
  421. package/dist/browser/chunks/chunk-GKM6UZJR.js.map +0 -7
  422. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  423. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  424. package/dist/component/api.d.ts +0 -508
  425. package/dist/component/api.d.ts.map +0 -1
  426. package/dist/component/api.js +0 -4
  427. package/dist/component/api.js.map +0 -1
  428. package/dist/component/builtins/audio.d.ts +0 -26
  429. package/dist/component/builtins/audio.d.ts.map +0 -1
  430. package/dist/component/builtins/audio.js +0 -41
  431. package/dist/component/builtins/audio.js.map +0 -1
  432. package/dist/component/builtins/canvas3d.d.ts +0 -98
  433. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  434. package/dist/component/builtins/canvas3d.js +0 -21
  435. package/dist/component/builtins/canvas3d.js.map +0 -1
  436. package/dist/component/builtins/composite.d.ts +0 -56
  437. package/dist/component/builtins/composite.d.ts.map +0 -1
  438. package/dist/component/builtins/composite.js +0 -25
  439. package/dist/component/builtins/composite.js.map +0 -1
  440. package/dist/component/builtins/geometry.d.ts +0 -505
  441. package/dist/component/builtins/geometry.d.ts.map +0 -1
  442. package/dist/component/builtins/geometry.js +0 -107
  443. package/dist/component/builtins/geometry.js.map +0 -1
  444. package/dist/component/builtins/layout.d.ts +0 -88
  445. package/dist/component/builtins/layout.d.ts.map +0 -1
  446. package/dist/component/builtins/layout.js +0 -84
  447. package/dist/component/builtins/layout.js.map +0 -1
  448. package/dist/component/builtins/media.d.ts +0 -95
  449. package/dist/component/builtins/media.d.ts.map +0 -1
  450. package/dist/component/builtins/media.js +0 -149
  451. package/dist/component/builtins/media.js.map +0 -1
  452. package/dist/component/builtins/providers.d.ts +0 -23
  453. package/dist/component/builtins/providers.d.ts.map +0 -1
  454. package/dist/component/builtins/providers.js +0 -30
  455. package/dist/component/builtins/providers.js.map +0 -1
  456. package/dist/component/builtins/text.d.ts +0 -193
  457. package/dist/component/builtins/text.d.ts.map +0 -1
  458. package/dist/component/builtins/text.js +0 -113
  459. package/dist/component/builtins/text.js.map +0 -1
  460. package/dist/component/builtins/three.d.ts +0 -1085
  461. package/dist/component/builtins/three.d.ts.map +0 -1
  462. package/dist/component/builtins/three.js +0 -265
  463. package/dist/component/builtins/three.js.map +0 -1
  464. package/dist/component/clip-of.d.ts +0 -5
  465. package/dist/component/clip-of.d.ts.map +0 -1
  466. package/dist/component/clip-of.js +0 -33
  467. package/dist/component/clip-of.js.map +0 -1
  468. package/dist/component/commands-for.d.ts +0 -19
  469. package/dist/component/commands-for.d.ts.map +0 -1
  470. package/dist/component/commands-for.js +0 -5
  471. package/dist/component/commands-for.js.map +0 -1
  472. package/dist/component/component-audio.d.ts +0 -9
  473. package/dist/component/component-audio.d.ts.map +0 -1
  474. package/dist/component/component-audio.js +0 -18
  475. package/dist/component/component-audio.js.map +0 -1
  476. package/dist/component/component2d.d.ts +0 -9
  477. package/dist/component/component2d.d.ts.map +0 -1
  478. package/dist/component/component2d.js +0 -239
  479. package/dist/component/component2d.js.map +0 -1
  480. package/dist/component/component3d.d.ts +0 -9
  481. package/dist/component/component3d.d.ts.map +0 -1
  482. package/dist/component/component3d.js +0 -99
  483. package/dist/component/component3d.js.map +0 -1
  484. package/dist/component/factory.d.ts +0 -63
  485. package/dist/component/factory.d.ts.map +0 -1
  486. package/dist/component/factory.js +0 -313
  487. package/dist/component/factory.js.map +0 -1
  488. package/dist/component/modules/aim.d.ts +0 -30
  489. package/dist/component/modules/aim.d.ts.map +0 -1
  490. package/dist/component/modules/aim.js +0 -39
  491. package/dist/component/modules/aim.js.map +0 -1
  492. package/dist/component/modules/corners.d.ts +0 -13
  493. package/dist/component/modules/corners.d.ts.map +0 -1
  494. package/dist/component/modules/corners.js +0 -12
  495. package/dist/component/modules/corners.js.map +0 -1
  496. package/dist/component/modules/flow.d.ts +0 -26
  497. package/dist/component/modules/flow.d.ts.map +0 -1
  498. package/dist/component/modules/flow.js +0 -55
  499. package/dist/component/modules/flow.js.map +0 -1
  500. package/dist/component/modules/material.d.ts +0 -40
  501. package/dist/component/modules/material.d.ts.map +0 -1
  502. package/dist/component/modules/material.js +0 -75
  503. package/dist/component/modules/material.js.map +0 -1
  504. package/dist/component/modules/paint.d.ts +0 -71
  505. package/dist/component/modules/paint.d.ts.map +0 -1
  506. package/dist/component/modules/paint.js +0 -106
  507. package/dist/component/modules/paint.js.map +0 -1
  508. package/dist/component/modules/shapes.d.ts +0 -31
  509. package/dist/component/modules/shapes.d.ts.map +0 -1
  510. package/dist/component/modules/shapes.js +0 -43
  511. package/dist/component/modules/shapes.js.map +0 -1
  512. package/dist/component/modules/text-layout.d.ts +0 -26
  513. package/dist/component/modules/text-layout.d.ts.map +0 -1
  514. package/dist/component/modules/text-layout.js +0 -57
  515. package/dist/component/modules/text-layout.js.map +0 -1
  516. package/dist/component/modules/text-style.d.ts +0 -48
  517. package/dist/component/modules/text-style.d.ts.map +0 -1
  518. package/dist/component/modules/text-style.js +0 -63
  519. package/dist/component/modules/text-style.js.map +0 -1
  520. package/dist/component/modules/three-entries.d.ts +0 -23
  521. package/dist/component/modules/three-entries.d.ts.map +0 -1
  522. package/dist/component/modules/three-entries.js +0 -41
  523. package/dist/component/modules/three-entries.js.map +0 -1
  524. package/dist/component/modules/view3d.d.ts +0 -55
  525. package/dist/component/modules/view3d.d.ts.map +0 -1
  526. package/dist/component/modules/view3d.js +0 -160
  527. package/dist/component/modules/view3d.js.map +0 -1
  528. package/dist/component/timeline.d.ts +0 -22
  529. package/dist/component/timeline.d.ts.map +0 -1
  530. package/dist/component/timeline.js +0 -128
  531. package/dist/component/timeline.js.map +0 -1
  532. package/dist/component/type-def.d.ts +0 -26
  533. package/dist/component/type-def.d.ts.map +0 -1
  534. package/dist/component/type-def.js +0 -16
  535. package/dist/component/type-def.js.map +0 -1
  536. package/dist/component/types.d.ts +0 -91
  537. package/dist/component/types.d.ts.map +0 -1
  538. package/dist/component/types.js +0 -88
  539. package/dist/component/types.js.map +0 -1
  540. package/dist/component/views.d.ts +0 -121
  541. package/dist/component/views.d.ts.map +0 -1
  542. package/dist/component/views.js +0 -413
  543. package/dist/component/views.js.map +0 -1
  544. package/dist/document/withdraw.d.ts +0 -28
  545. package/dist/document/withdraw.d.ts.map +0 -1
  546. package/dist/document/withdraw.js +0 -61
  547. package/dist/document/withdraw.js.map +0 -1
  548. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  549. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  550. package/dist/jsx/jsx-dev-runtime.js +0 -3
  551. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  552. package/dist/jsx/jsx-runtime.d.ts +0 -27
  553. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  554. package/dist/jsx/jsx-runtime.js +0 -26
  555. package/dist/jsx/jsx-runtime.js.map +0 -1
  556. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  557. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  558. package/dist/nodes/2d/node-lifecycle.js +0 -264
  559. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  560. package/dist/nodes/2d/node-motion.d.ts +0 -56
  561. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  562. package/dist/nodes/2d/node-motion.js +0 -86
  563. package/dist/nodes/2d/node-motion.js.map +0 -1
  564. package/dist/nodes/2d/node-render.d.ts +0 -44
  565. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  566. package/dist/nodes/2d/node-render.js +0 -80
  567. package/dist/nodes/2d/node-render.js.map +0 -1
  568. package/dist/nodes/2d/node-space.d.ts +0 -63
  569. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  570. package/dist/nodes/2d/node-space.js +0 -131
  571. package/dist/nodes/2d/node-space.js.map +0 -1
  572. package/dist/nodes/2d/node-transform.d.ts +0 -55
  573. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  574. package/dist/nodes/2d/node-transform.js +0 -73
  575. package/dist/nodes/2d/node-transform.js.map +0 -1
  576. package/dist/nodes/2d/node2d.d.ts +0 -1111
  577. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  578. package/dist/nodes/2d/node2d.js +0 -1665
  579. package/dist/nodes/2d/node2d.js.map +0 -1
  580. package/dist/nodes/2d/paint-node.d.ts +0 -142
  581. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  582. package/dist/nodes/2d/paint-node.js +0 -232
  583. package/dist/nodes/2d/paint-node.js.map +0 -1
  584. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  585. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  586. package/dist/nodes/audio/audio-bus.js +0 -33
  587. package/dist/nodes/audio/audio-bus.js.map +0 -1
  588. package/dist/nodes/audio/index.d.ts +0 -4
  589. package/dist/nodes/audio/index.d.ts.map +0 -1
  590. package/dist/nodes/audio/index.js +0 -2
  591. package/dist/nodes/audio/index.js.map +0 -1
  592. package/dist/nodes/audio/node-audio.d.ts +0 -107
  593. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  594. package/dist/nodes/audio/node-audio.js +0 -179
  595. package/dist/nodes/audio/node-audio.js.map +0 -1
  596. package/dist/nodes/audio/sound-node.d.ts +0 -41
  597. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  598. package/dist/nodes/audio/sound-node.js +0 -71
  599. package/dist/nodes/audio/sound-node.js.map +0 -1
  600. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  601. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  602. package/dist/nodes/geometry/boolean-node.js +0 -81
  603. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  604. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  605. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  606. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  607. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  608. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  609. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  610. package/dist/nodes/geometry/box-path-node.js +0 -116
  611. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  612. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  613. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  614. package/dist/nodes/geometry/ellipse-node.js +0 -45
  615. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  616. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  617. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  618. package/dist/nodes/geometry/group-bounds.js +0 -87
  619. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  620. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  621. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  622. package/dist/nodes/geometry/mask-node.js +0 -66
  623. package/dist/nodes/geometry/mask-node.js.map +0 -1
  624. package/dist/nodes/geometry/path-node.d.ts +0 -26
  625. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  626. package/dist/nodes/geometry/path-node.js +0 -58
  627. package/dist/nodes/geometry/path-node.js.map +0 -1
  628. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  629. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  630. package/dist/nodes/geometry/polygon-node.js +0 -47
  631. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  632. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  633. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  634. package/dist/nodes/geometry/polygram-node.js +0 -52
  635. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  636. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  637. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  638. package/dist/nodes/geometry/rect-node.js +0 -56
  639. package/dist/nodes/geometry/rect-node.js.map +0 -1
  640. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  641. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  642. package/dist/nodes/geometry/shape-node.js +0 -140
  643. package/dist/nodes/geometry/shape-node.js.map +0 -1
  644. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  645. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  646. package/dist/nodes/geometry/shape-outline.js +0 -470
  647. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  648. package/dist/nodes/index.d.ts +0 -53
  649. package/dist/nodes/index.d.ts.map +0 -1
  650. package/dist/nodes/index.js +0 -35
  651. package/dist/nodes/index.js.map +0 -1
  652. package/dist/nodes/layout/camera-node.d.ts +0 -80
  653. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  654. package/dist/nodes/layout/camera-node.js +0 -153
  655. package/dist/nodes/layout/camera-node.js.map +0 -1
  656. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  657. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  658. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  659. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  660. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  661. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  662. package/dist/nodes/layout/rotated-box.js +0 -76
  663. package/dist/nodes/layout/rotated-box.js.map +0 -1
  664. package/dist/nodes/media/video-node.d.ts +0 -229
  665. package/dist/nodes/media/video-node.d.ts.map +0 -1
  666. package/dist/nodes/media/video-node.js +0 -350
  667. package/dist/nodes/media/video-node.js.map +0 -1
  668. package/dist/nodes/node/declare-paints.d.ts +0 -19
  669. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  670. package/dist/nodes/node/declare-paints.js +0 -27
  671. package/dist/nodes/node/declare-paints.js.map +0 -1
  672. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  673. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  674. package/dist/nodes/node/node-editor-state.js +0 -23
  675. package/dist/nodes/node/node-editor-state.js.map +0 -1
  676. package/dist/nodes/node/node-reactive.d.ts +0 -89
  677. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  678. package/dist/nodes/node/node-reactive.js +0 -135
  679. package/dist/nodes/node/node-reactive.js.map +0 -1
  680. package/dist/nodes/node/node-time.d.ts +0 -39
  681. package/dist/nodes/node/node-time.d.ts.map +0 -1
  682. package/dist/nodes/node/node-time.js +0 -14
  683. package/dist/nodes/node/node-time.js.map +0 -1
  684. package/dist/nodes/node/node-walk.d.ts +0 -46
  685. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  686. package/dist/nodes/node/node-walk.js +0 -74
  687. package/dist/nodes/node/node-walk.js.map +0 -1
  688. package/dist/nodes/node/node.d.ts +0 -445
  689. package/dist/nodes/node/node.d.ts.map +0 -1
  690. package/dist/nodes/node/node.js +0 -745
  691. package/dist/nodes/node/node.js.map +0 -1
  692. package/dist/nodes/node/text-defaults.d.ts +0 -32
  693. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  694. package/dist/nodes/node/text-defaults.js +0 -37
  695. package/dist/nodes/node/text-defaults.js.map +0 -1
  696. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  697. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  698. package/dist/nodes/root/canvas2d-node.js +0 -264
  699. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  700. package/dist/nodes/root/provider-node.d.ts +0 -47
  701. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  702. package/dist/nodes/root/provider-node.js +0 -63
  703. package/dist/nodes/root/provider-node.js.map +0 -1
  704. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  705. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  706. package/dist/nodes/root/theme-provider-node.js +0 -43
  707. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  708. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  709. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  710. package/dist/nodes/text/default-text-style-node.js +0 -146
  711. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  712. package/dist/nodes/text/number-format.d.ts +0 -66
  713. package/dist/nodes/text/number-format.d.ts.map +0 -1
  714. package/dist/nodes/text/number-format.js +0 -227
  715. package/dist/nodes/text/number-format.js.map +0 -1
  716. package/dist/nodes/text/number-node.d.ts +0 -94
  717. package/dist/nodes/text/number-node.d.ts.map +0 -1
  718. package/dist/nodes/text/number-node.js +0 -86
  719. package/dist/nodes/text/number-node.js.map +0 -1
  720. package/dist/nodes/text/number-pattern.d.ts +0 -51
  721. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  722. package/dist/nodes/text/number-pattern.js +0 -77
  723. package/dist/nodes/text/number-pattern.js.map +0 -1
  724. package/dist/nodes/text/richtext-node.d.ts +0 -68
  725. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  726. package/dist/nodes/text/richtext-node.js +0 -78
  727. package/dist/nodes/text/richtext-node.js.map +0 -1
  728. package/dist/nodes/text/text-base.d.ts +0 -118
  729. package/dist/nodes/text/text-base.d.ts.map +0 -1
  730. package/dist/nodes/text/text-base.js +0 -153
  731. package/dist/nodes/text/text-base.js.map +0 -1
  732. package/dist/nodes/text/text-layout.d.ts +0 -87
  733. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  734. package/dist/nodes/text/text-layout.js +0 -368
  735. package/dist/nodes/text/text-layout.js.map +0 -1
  736. package/dist/nodes/text/text-node.d.ts +0 -84
  737. package/dist/nodes/text/text-node.d.ts.map +0 -1
  738. package/dist/nodes/text/text-node.js +0 -188
  739. package/dist/nodes/text/text-node.js.map +0 -1
  740. package/dist/nodes/text/text-selection.d.ts +0 -125
  741. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  742. package/dist/nodes/text/text-selection.js +0 -209
  743. package/dist/nodes/text/text-selection.js.map +0 -1
  744. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  745. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  746. package/dist/nodes/three/camera-nodes.js +0 -112
  747. package/dist/nodes/three/camera-nodes.js.map +0 -1
  748. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  749. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  750. package/dist/nodes/three/canvas3d-node.js +0 -486
  751. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  752. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  753. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  754. package/dist/nodes/three/drawable-nodes.js +0 -284
  755. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  756. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  757. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  758. package/dist/nodes/three/environment-nodes.js +0 -134
  759. package/dist/nodes/three/environment-nodes.js.map +0 -1
  760. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  761. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  762. package/dist/nodes/three/geometry-nodes.js +0 -322
  763. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  764. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  765. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  766. package/dist/nodes/three/grid-geometry3d.js +0 -114
  767. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  768. package/dist/nodes/three/group3d.d.ts +0 -23
  769. package/dist/nodes/three/group3d.d.ts.map +0 -1
  770. package/dist/nodes/three/group3d.js +0 -21
  771. package/dist/nodes/three/group3d.js.map +0 -1
  772. package/dist/nodes/three/light-nodes.d.ts +0 -120
  773. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  774. package/dist/nodes/three/light-nodes.js +0 -173
  775. package/dist/nodes/three/light-nodes.js.map +0 -1
  776. package/dist/nodes/three/mesh3d.d.ts +0 -117
  777. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  778. package/dist/nodes/three/mesh3d.js +0 -147
  779. package/dist/nodes/three/mesh3d.js.map +0 -1
  780. package/dist/nodes/three/node3d.d.ts +0 -230
  781. package/dist/nodes/three/node3d.d.ts.map +0 -1
  782. package/dist/nodes/three/node3d.js +0 -337
  783. package/dist/nodes/three/node3d.js.map +0 -1
  784. package/dist/render/descriptors/latex.d.ts +0 -6
  785. package/dist/render/descriptors/latex.d.ts.map +0 -1
  786. package/dist/render/descriptors/latex.js +0 -2
  787. package/dist/render/descriptors/latex.js.map +0 -1
  788. package/dist/tween/seekable.d.ts +0 -81
  789. package/dist/tween/seekable.d.ts.map +0 -1
  790. package/dist/tween/seekable.js +0 -137
  791. package/dist/tween/seekable.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"node3d.js","sourceRoot":"","sources":["../../../../src/components/trees/three/node3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EACH,cAAc,GAEjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,IAAI,EAAuD,MAAM,8BAA8B,CAAC;AAEzG,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAgEpD;;;GAGG;AACH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,IAAY;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAuC,CAAC;IAC5D,OAAO,OAAO,MAAM,EAAE,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjF,CAAC;AAED,wEAAwE;AACxE,MAAM,YAAY,GAAgE;IAC9E,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACzB,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC;IACjD,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM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AI,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1E,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,MAAe,EAAE,KAAa;IAC/C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["import { declareMembers, property } from \"@/attributes/properties/decorator\";\r\nimport { optionalVector3Property, quaternionProperty } from \"@/attributes/properties/typed\";\r\nimport {\r\n resolveVector3,\r\n type Euler3, type EulerOrder, type Quaternion, type Vector3, type Vector3Input,\r\n} from \"@/render3d/vector3\";\r\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\r\nimport { Scene3D } from \"@/render3d/scene3d\";\r\nimport { declare3DResources } from \"@/render3d/tracking\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport type { Shadow3D, Transform3D } from \"@/render3d/transform\";\r\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/components/trees/node/node\";\r\nimport type { Command, CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { TweenStepper } from \"@/tween/stepper\";\r\n\r\nexport interface Node3DProps extends NodeProps {\r\n /** Position in the parent's local space. A scalar sets all three axes. */\r\n position: Vector3Input;\r\n /** Position on one axis. The same names 2D uses, one dimension over. */\r\n x: number;\r\n y: number;\r\n z: number;\r\n /**\r\n * Euler rotation in **degrees**, matching 2D `rotation`. Ignored when\r\n * {@link quaternion} is set.\r\n */\r\n rotation: Vector3Input | Euler3;\r\n /** Rotation about one axis, in **degrees**. Same names as 2D's. */\r\n rotationX: number;\r\n rotationY: number;\r\n rotationZ: number;\r\n /** The order the Euler axes are applied in. Default `\"XYZ\"`. */\r\n rotationOrder: EulerOrder;\r\n /**\r\n * Rotation as a unit quaternion. Wins over {@link rotation} — use it for\r\n * tumbles where Euler interpolation would gimbal.\r\n */\r\n quaternion: Quaternion;\r\n /** Per-axis scale; a scalar scales uniformly. Default 1. */\r\n scale: Vector3Input;\r\n scaleX: number;\r\n scaleY: number;\r\n scaleZ: number;\r\n /**\r\n * World-space point to orient toward, applied after {@link position}. Wins\r\n * over both {@link rotation} and {@link quaternion}.\r\n */\r\n lookAt: Vector3Input | undefined;\r\n /** Hide without removing — the cached renderer object stays alive. */\r\n visible: boolean;\r\n /**\r\n * Shadow participation. Default `true`, so turning shadows on for the scene\r\n * turns them on. Pass `false` to opt out, or `\"cast\"`/`\"receive\"` for one half.\r\n */\r\n shadow: Shadow3D;\r\n /** Draw-order override, for tuning transparent sorting. */\r\n renderOrder: number;\r\n}\r\n\r\n/**\r\n * A 3D parent's own coordinates for where its children sit: the units of a\r\n * graph, say. Position only, as a `ChildPlane` is in 2D: a child keeps its\r\n * size, turn and scale. Answered by the parent ({@link Node3D._spaceOf}, or\r\n * `Canvas3D._spaceOf` for a child of the viewport itself).\r\n */\r\nexport interface ChildSpace3D {\r\n /** A child's `x`/`y`/`z` as a point in the parent's local space. */\r\n toLocal(x: number, y: number, z: number): Vector3;\r\n}\r\n\r\n/** A parent that may place its 3D children in coordinates of its own: a `Node3D`, or a 3D viewport. */\r\ninterface SpaceHolder3D {\r\n _spaceOf(child: Node3D | null): ChildSpace3D | null;\r\n}\r\n\r\n/**\r\n * The coordinates `node`'s parent places it by, or `null` when they are the\r\n * parent's local space. The parent may be a 3D node or the viewport holding it.\r\n */\r\n/** @internal */\r\nexport function parentSpaceOf(node: Node3D): ChildSpace3D | null {\r\n const parent = node.parent as Partial<SpaceHolder3D> | null;\r\n return typeof parent?._spaceOf === \"function\" ? parent._spaceOf(node) : null;\r\n}\r\n\r\n/** The three axis props each vector prop distributes into, in order. */\r\nconst VECTOR_SUGAR: Readonly<Record<string, readonly [string, string, string]>> = {\r\n position: [\"x\", \"y\", \"z\"],\r\n rotation: [\"rotationX\", \"rotationY\", \"rotationZ\"],\r\n scale: [\"scaleX\", \"scaleY\", \"scaleZ\"],\r\n};\r\n\r\n/**\r\n * A thing in 3D space — the root of the 3D scene graph.\r\n *\r\n * The sibling of {@link Node2D}: same tree, same props, same `to()`/`set()`/\r\n * `save()`/`restore()`, same refs, context and per-node clock, all inherited from\r\n * {@link Node}. What differs is the only thing that genuinely differs between the\r\n * two — how a node is placed and how it draws. There is no `width`, no `padding`,\r\n * no anchor and no flex here, because none of them mean anything for a mesh; a 3D\r\n * node's whole placement is its transform.\r\n *\r\n * Canvas3D({\r\n * children: [\r\n * Camera3D({ orbit: 30, elevation: 18, distance: 6 }),\r\n * AmbientLight3D({ intensity: 0.4 }),\r\n * Group3D({ ref: rig, children: [Box3D({ width: 2, cornerRadius: 0.15, fill: \"tomato\" })] }),\r\n * ],\r\n * })\r\n *\r\n * rig().to({ data: { rotationY: 360, y: 1 }, duration: 2 });\r\n *\r\n * ── Axes are scalars, and vectors are sugar over them ─────────────────────────\r\n * `x`, `y`, `z`, `rotationX/Y/Z` and `scaleX/Y/Z` are the real props, and they\r\n * are named exactly what 2D names them. `position`, `rotation` and `scale` are\r\n * distributed into those three, the way `Node2D` already distributes `size` into\r\n * `width`/`height` — so both spellings tween identically and there is one source\r\n * of truth for where a node is. That is what makes `to({ y: 3 })` work: with a\r\n * single vector prop it would have had nothing to interpolate on the other two\r\n * axes, which is exactly the trap that made every 3D scene restate coordinates it\r\n * did not mean to change.\r\n *\r\n * A `Node3D` only ever lives under a `Canvas3D` — the one node that holds both\r\n * dimensions. Parenting one to a `Rect` throws rather than silently drawing\r\n * nothing (see {@link Node.acceptsChild}). Every 3D node type is a\r\n * `component3d`, which lowers onto this class and draws from its `render`.\r\n */\r\nexport class Node3D<P extends Node3DProps = Node3DProps> extends Node<P> {\r\n get dimension(): NodeDimension { return \"3d\"; }\r\n\r\n declare x: number;\r\n declare y: number;\r\n declare z: number;\r\n\r\n declare rotationX: number;\r\n declare rotationY: number;\r\n declare rotationZ: number;\r\n declare rotationOrder: EulerOrder;\r\n\r\n declare quaternion: Quaternion;\r\n\r\n declare scaleX: number;\r\n declare scaleY: number;\r\n declare scaleZ: number;\r\n\r\n declare lookAt: Vector3Input | undefined;\r\n declare visible: boolean;\r\n declare shadow: Shadow3D;\r\n declare renderOrder: number;\r\n\r\n constructor(props?: NodeConfig<any, P>) {\r\n super(props);\r\n // Distributed before `initProps`, which only ever applies keys that are\r\n // registered props — a `position` left in the bag would be dropped.\r\n this.initProps(distributeVectors(props) as NodeConfig<any, P>);\r\n this.adoptChildrenProp(props);\r\n }\r\n\r\n /** Animate the position, whichever axes are given; the rest stay where they are. */\r\n moveTo(args: CommandArgs<{ x?: number; y?: number; z?: number }> & { duration: number }): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the Euler rotation, in degrees, whichever axes are given. */\r\n rotateTo(\r\n args: CommandArgs<{ rotationX?: number; rotationY?: number; rotationZ?: number }> & { duration: number },\r\n ): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the scale: `scale` on every axis, and any axis given beside it on that one. */\r\n scaleTo(\r\n args: CommandArgs<{ scale?: number; scaleX?: number; scaleY?: number; scaleZ?: number }> & { duration: number },\r\n ): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** This node's position, composed from the axis props. */\r\n get position(): Vector3 {\r\n return { x: this.x, y: this.y, z: this.z };\r\n }\r\n set position(value: Vector3Input) {\r\n this.set({ position: value } as never);\r\n }\r\n\r\n /** This node's Euler rotation in degrees, composed from the axis props. */\r\n get rotation(): Euler3 {\r\n return { x: this.rotationX, y: this.rotationY, z: this.rotationZ, order: this.rotationOrder };\r\n }\r\n set rotation(value: Vector3Input | Euler3) {\r\n this.set({ rotation: value } as never);\r\n }\r\n\r\n /** This node's scale, composed from the axis props. */\r\n get scale(): Vector3 {\r\n return { x: this.scaleX, y: this.scaleY, z: this.scaleZ };\r\n }\r\n set scale(value: Vector3Input) {\r\n this.set({ scale: value } as never);\r\n }\r\n\r\n /**\r\n * Distribute the vector sugar into axis props, then write as usual.\r\n *\r\n * Same shape as `Node2D.set`'s handling of `size`, and for the same reason:\r\n * `position` has no slot of its own, so it has to become three writes\r\n * before the generic loop runs. An explicitly stated axis in the same call\r\n * wins over the vector, which is what lets `{ position: p, y: 0 }` mean what\r\n * it reads like.\r\n */\r\n override set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\r\n super.set(distributeVectors(props) as typeof props);\r\n }\r\n\r\n /**\r\n * The tween half of the same rule. Expanded here rather than in the command\r\n * so `to({ position: [...] })` and `to({ x, y, z })` produce identical\r\n * steppers — one interpolating path, whichever way it was written.\r\n */\r\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\r\n return super._prepareStep(distributeVectors(to) as Partial<P>, duration, easing);\r\n }\r\n\r\n /**\r\n * This node's placement, as the renderer's own vocabulary.\r\n *\r\n * Sampled fresh every frame from the prop slots, so a tween moves the object\r\n * without anything here caching state between frames.\r\n *\r\n * `quaternion` is only emitted when it has been set away from identity: it\r\n * wins over `rotation` in a {@link Transform3D}, so always sending it would\r\n * make `rotation` silently do nothing.\r\n */\r\n protected transform3D(): Transform3D {\r\n const quaternion = this.quaternion as unknown as Quaternion;\r\n const identityQuaternion =\r\n quaternion.x === 0 && quaternion.y === 0 && quaternion.z === 0 && quaternion.w === 1;\r\n const space = parentSpaceOf(this);\r\n return {\r\n position: space ? space.toLocal(this.x, this.y, this.z) : this.position,\r\n rotation: this.rotation,\r\n quaternion: identityQuaternion ? undefined : quaternion,\r\n scale: this.scale,\r\n lookAt: this.lookAt,\r\n visible: this.visible,\r\n shadow: this.shadow,\r\n renderOrder: this.renderOrder,\r\n };\r\n }\r\n\r\n /**\r\n * The coordinates `child`'s `x`/`y`/`z` are in, or `null` (the default) when\r\n * they are this node's local space. A `null` child is one not here yet.\r\n */\r\n /** @internal */\r\n _spaceOf(_child: Node3D | null): ChildSpace3D | null {\r\n return null;\r\n }\r\n\r\n /**\r\n * The transform that goes on this node's *group* — the scope its children\r\n * nest inside. Defaults to this node's own placement, which is right for\r\n * everything that lives at its own origin.\r\n *\r\n * A camera answers identity and places itself instead: three aims a\r\n * camera's -Z at `lookAt` but a plain group's +Z, so hanging a camera's\r\n * placement on its group would point the shot backwards.\r\n */\r\n protected groupTransform(): Transform3D {\r\n return this.transform3D();\r\n }\r\n\r\n /**\r\n * Draw this node's own contribution to the scene — a `ctx.draw(graphics3D)`\r\n * for something with geometry, a `ctx.light(...)` for a light, nothing at all\r\n * for a plain {@link Group3D}. Children are recorded after it, nested inside\r\n * this node's transform.\r\n */\r\n protected renderSelf(ctx: RenderContext3D): void { }\r\n\r\n /**\r\n * Record this node and its subtree into `ctx`.\r\n *\r\n * An invisible node still opens its scope: `visible: false` is a renderer-side\r\n * flag on a live object rather than a removal, which is what lets a node be\r\n * hidden and shown again without its GPU resources being rebuilt. Skipping the\r\n * walk here would instead sweep the whole subtree out of the cache.\r\n */\r\n render(ctx: RenderContext3D): void {\r\n // The editor's flag folds into `visible` rather than adding a second one:\r\n // the 3D side already has exactly this concept, honoured by the picking\r\n // walk, and two flags meaning \"do not show this\" would be two places to\r\n // ask. Still opens its scope — see the note above on why an invisible\r\n // node keeps its cached renderer object.\r\n if (this.hidden) {\r\n ctx.begin({ id: this.id, transform: { ...this.groupTransform(), visible: false } });\r\n ctx.end();\r\n return;\r\n }\r\n ctx.begin({ id: this.id, transform: this.groupTransform() });\r\n this.renderSelf(ctx);\r\n for (const child of this._children) {\r\n if (child instanceof Node3D) child.render(ctx);\r\n }\r\n ctx.end();\r\n }\r\n\r\n /**\r\n * What {@link renderSelf} records, never {@link render}: the placement lives on\r\n * the group scope, so moving a node does not change what it declares.\r\n */\r\n declareAssets(assets: AssetScope): void {\r\n if (this.renderSelf === Node3D.prototype.renderSelf) return;\r\n const scene = new Scene3D();\r\n this.renderSelf(scene);\r\n declare3DResources(scene, assets);\r\n }\r\n}\r\n\r\ndeclareMembers(Node3D, {\r\n x: property({ default: 0 }),\r\n y: property({ default: 0 }),\r\n z: property({ default: 0 }),\r\n rotationX: property({ default: 0 }),\r\n rotationY: property({ default: 0 }),\r\n rotationZ: property({ default: 0 }),\r\n rotationOrder: property({ default: \"XYZ\" }),\r\n quaternion: quaternionProperty(),\r\n scaleX: property({ default: 1 }),\r\n scaleY: property({ default: 1 }),\r\n scaleZ: property({ default: 1 }),\r\n lookAt: optionalVector3Property(\"snap\"),\r\n visible: property({ default: true }),\r\n shadow: property({ default: true }),\r\n renderOrder: property({ default: 0 }),\r\n\r\n moveTo: command({ args: [\"x\", \"y\", \"z\"] }),\r\n rotateTo: command({ args: [\"rotationX\", \"rotationY\", \"rotationZ\"] }),\r\n scaleTo: command({\r\n args: [{ key: \"scale\", kind: \"number\", min: 0, step: 0.05, unit: \"×\" }, \"scaleX\", \"scaleY\", \"scaleZ\"],\r\n }),\r\n});\r\n\r\n/**\r\n * Expand `position`/`rotation`/`scale` in a prop bag into their axis props.\r\n *\r\n * Returns the bag untouched when it names none of them, so the common write path\r\n * allocates nothing. A **binding** expands into three bindings that each resolve\r\n * the vector and take one component — so `position={() => lift()}` stays a\r\n * binding, and one thunk driving all three axes is still read once per axis per\r\n * frame rather than being frozen at bind time.\r\n */\r\nfunction distributeVectors<T extends object>(props: T | undefined): T | undefined {\r\n if (!props) return props;\r\n\r\n let out: Record<string, unknown> | undefined;\r\n\r\n for (const key in VECTOR_SUGAR) {\r\n const value = (props as Record<string, unknown>)[key];\r\n if (value === undefined) continue;\r\n\r\n out ??= { ...(props as Record<string, unknown>) };\r\n delete out[key];\r\n\r\n const axes = VECTOR_SUGAR[key];\r\n\r\n if (typeof value === \"function\") {\r\n const read = value as () => Vector3Input;\r\n for (let i = 0; i < 3; i++) {\r\n const axis = axes[i];\r\n if (out[axis] !== undefined) continue;\r\n out[axis] = () => componentOf(resolveVector3(read()), i);\r\n }\r\n continue;\r\n }\r\n\r\n const vector = resolveVector3(value as Vector3Input);\r\n for (let i = 0; i < 3; i++) {\r\n const axis = axes[i];\r\n if (out[axis] === undefined) out[axis] = componentOf(vector, i);\r\n }\r\n\r\n // `order` rides on an Euler and has nowhere else to go.\r\n if (key === \"rotation\") {\r\n const order = (value as Euler3).order;\r\n if (order !== undefined && out.rotationOrder === undefined) out.rotationOrder = order;\r\n }\r\n }\r\n\r\n return (out as T) ?? props;\r\n}\r\n\r\n/** `data` without the keys left unstated, so a tween never aims an axis at `undefined`. */\r\nfunction stated<T extends object>(data: T | undefined): Partial<T> {\r\n const out: Partial<T> = {};\r\n for (const key in data) if (data[key] !== undefined) out[key] = data[key];\r\n return out;\r\n}\r\n\r\nfunction componentOf(vector: Vector3, index: number): number {\r\n return index === 0 ? vector.x : index === 1 ? vector.y : vector.z;\r\n}\r\n"]}
1
+ {"version":3,"file":"node3d.js","sourceRoot":"","sources":["../../../../src/components/trees/three/node3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EACH,cAAc,GAEjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,IAAI,EAAuD,MAAM,8BAA8B,CAAC;AAEzG,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAgEpD;;;GAGG;AACH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,IAAY;IACtC,MAA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CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACpE,CAAC;QAED,wDAAwD;QACxD,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACrB,MAAM,KAAK,GAAI,KAAgB,CAAC,KAAK,CAAC;YACtC,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,aAAa,KAAK,SAAS;gBAAE,GAAG,CAAC,aAAa,GAAG,KAAK,CAAC;QAC1F,CAAC;IACL,CAAC;IAED,OAAQ,GAAS,IAAI,KAAK,CAAC;AAC/B,CAAC;AAED,2FAA2F;AAC3F,SAAS,MAAM,CAAmB,IAAmB;IACjD,MAAM,GAAG,GAAe,EAAE,CAAC;IAC3B,KAAK,MAAM,GAAG,IAAI,IAAI;QAAE,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1E,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,MAAe,EAAE,KAAa;IAC/C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["import { declareMembers, property } from \"@/attributes/properties/decorator\";\nimport { optionalVector3Property, quaternionProperty } from \"@/attributes/properties/typed\";\nimport {\n resolveVector3,\n type Euler3, type EulerOrder, type Quaternion, type Vector3, type Vector3Input,\n} from \"@/render3d/vector3\";\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\nimport { Scene3D } from \"@/render3d/scene3d\";\nimport { declare3DResources } from \"@/render3d/tracking\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport type { Shadow3D, Transform3D } from \"@/render3d/transform\";\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/components/trees/node/node\";\nimport type { Command, CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\nimport type { EasingFunction } from \"@/tween/ease/type\";\nimport type { TweenStepper } from \"@/tween/stepper\";\n\nexport interface Node3DProps extends NodeProps {\n /** Position in the parent's local space. A scalar sets all three axes. */\n position: Vector3Input;\n /** Position on one axis. The same names 2D uses, one dimension over. */\n x: number;\n y: number;\n z: number;\n /**\n * Euler rotation in **degrees**, matching 2D `rotation`. Ignored when\n * {@link quaternion} is set.\n */\n rotation: Vector3Input | Euler3;\n /** Rotation about one axis, in **degrees**. Same names as 2D's. */\n rotationX: number;\n rotationY: number;\n rotationZ: number;\n /** The order the Euler axes are applied in. Default `\"XYZ\"`. */\n rotationOrder: EulerOrder;\n /**\n * Rotation as a unit quaternion. Wins over {@link rotation} — use it for\n * tumbles where Euler interpolation would gimbal.\n */\n quaternion: Quaternion;\n /** Per-axis scale; a scalar scales uniformly. Default 1. */\n scale: Vector3Input;\n scaleX: number;\n scaleY: number;\n scaleZ: number;\n /**\n * World-space point to orient toward, applied after {@link position}. Wins\n * over both {@link rotation} and {@link quaternion}.\n */\n lookAt: Vector3Input | undefined;\n /** Hide without removing — the cached renderer object stays alive. */\n visible: boolean;\n /**\n * Shadow participation. Default `true`, so turning shadows on for the scene\n * turns them on. Pass `false` to opt out, or `\"cast\"`/`\"receive\"` for one half.\n */\n shadow: Shadow3D;\n /** Draw-order override, for tuning transparent sorting. */\n renderOrder: number;\n}\n\n/**\n * A 3D parent's own coordinates for where its children sit: the units of a\n * graph, say. Position only, as a `ChildPlane` is in 2D: a child keeps its\n * size, turn and scale. Answered by the parent ({@link Node3D._spaceOf}, or\n * `Canvas3D._spaceOf` for a child of the viewport itself).\n */\nexport interface ChildSpace3D {\n /** A child's `x`/`y`/`z` as a point in the parent's local space. */\n toLocal(x: number, y: number, z: number): Vector3;\n}\n\n/** A parent that may place its 3D children in coordinates of its own: a `Node3D`, or a 3D viewport. */\ninterface SpaceHolder3D {\n _spaceOf(child: Node3D | null): ChildSpace3D | null;\n}\n\n/**\n * The coordinates `node`'s parent places it by, or `null` when they are the\n * parent's local space. The parent may be a 3D node or the viewport holding it.\n */\n/** @internal */\nexport function parentSpaceOf(node: Node3D): ChildSpace3D | null {\n const parent = node.parent as Partial<SpaceHolder3D> | null;\n return typeof parent?._spaceOf === \"function\" ? parent._spaceOf(node) : null;\n}\n\n/** The three axis props each vector prop distributes into, in order. */\nconst VECTOR_SUGAR: Readonly<Record<string, readonly [string, string, string]>> = {\n position: [\"x\", \"y\", \"z\"],\n rotation: [\"rotationX\", \"rotationY\", \"rotationZ\"],\n scale: [\"scaleX\", \"scaleY\", \"scaleZ\"],\n};\n\n/**\n * A thing in 3D space — the root of the 3D scene graph.\n *\n * The sibling of {@link Node2D}: same tree, same props, same `to()`/`set()`/\n * `save()`/`restore()`, same refs, context and per-node clock, all inherited from\n * {@link Node}. What differs is the only thing that genuinely differs between the\n * two — how a node is placed and how it draws. There is no `width`, no `padding`,\n * no anchor and no flex here, because none of them mean anything for a mesh; a 3D\n * node's whole placement is its transform.\n *\n * Canvas3D({\n * children: [\n * Camera3D({ orbit: 30, elevation: 18, distance: 6 }),\n * AmbientLight3D({ intensity: 0.4 }),\n * Group3D({ ref: rig, children: [Box3D({ width: 2, cornerRadius: 0.15, fill: \"tomato\" })] }),\n * ],\n * })\n *\n * rig().to({ data: { rotationY: 360, y: 1 }, duration: 2 });\n *\n * ── Axes are scalars, and vectors are sugar over them ─────────────────────────\n * `x`, `y`, `z`, `rotationX/Y/Z` and `scaleX/Y/Z` are the real props, and they\n * are named exactly what 2D names them. `position`, `rotation` and `scale` are\n * distributed into those three, the way `Node2D` already distributes `size` into\n * `width`/`height` — so both spellings tween identically and there is one source\n * of truth for where a node is. That is what makes `to({ y: 3 })` work: with a\n * single vector prop it would have had nothing to interpolate on the other two\n * axes, which is exactly the trap that made every 3D scene restate coordinates it\n * did not mean to change.\n *\n * A `Node3D` only ever lives under a `Canvas3D` — the one node that holds both\n * dimensions. Parenting one to a `Rect` throws rather than silently drawing\n * nothing (see {@link Node.acceptsChild}). Every 3D node type is a\n * `component3d`, which lowers onto this class and draws from its `render`.\n */\nexport class Node3D<P extends Node3DProps = Node3DProps> extends Node<P> {\n get dimension(): NodeDimension { return \"3d\"; }\n\n declare x: number;\n declare y: number;\n declare z: number;\n\n declare rotationX: number;\n declare rotationY: number;\n declare rotationZ: number;\n declare rotationOrder: EulerOrder;\n\n declare quaternion: Quaternion;\n\n declare scaleX: number;\n declare scaleY: number;\n declare scaleZ: number;\n\n declare lookAt: Vector3Input | undefined;\n declare visible: boolean;\n declare shadow: Shadow3D;\n declare renderOrder: number;\n\n constructor(props?: NodeConfig<any, P>) {\n super(props);\n // Distributed before `initProps`, which only ever applies keys that are\n // registered props — a `position` left in the bag would be dropped.\n this.initProps(distributeVectors(props) as NodeConfig<any, P>);\n this.adoptChildrenProp(props);\n }\n\n /** Animate the position, whichever axes are given; the rest stay where they are. */\n moveTo(args: CommandArgs<{ x?: number; y?: number; z?: number }> & { duration: number }): Command<P> {\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\n }\n\n /** Animate the Euler rotation, in degrees, whichever axes are given. */\n rotateTo(\n args: CommandArgs<{ rotationX?: number; rotationY?: number; rotationZ?: number }> & { duration: number },\n ): Command<P> {\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\n }\n\n /** Animate the scale: `scale` on every axis, and any axis given beside it on that one. */\n scaleTo(\n args: CommandArgs<{ scale?: number; scaleX?: number; scaleY?: number; scaleZ?: number }> & { duration: number },\n ): Command<P> {\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\n }\n\n /** This node's position, composed from the axis props. */\n get position(): Vector3 {\n return { x: this.x, y: this.y, z: this.z };\n }\n set position(value: Vector3Input) {\n this.set({ position: value } as never);\n }\n\n /** This node's Euler rotation in degrees, composed from the axis props. */\n get rotation(): Euler3 {\n return { x: this.rotationX, y: this.rotationY, z: this.rotationZ, order: this.rotationOrder };\n }\n set rotation(value: Vector3Input | Euler3) {\n this.set({ rotation: value } as never);\n }\n\n /** This node's scale, composed from the axis props. */\n get scale(): Vector3 {\n return { x: this.scaleX, y: this.scaleY, z: this.scaleZ };\n }\n set scale(value: Vector3Input) {\n this.set({ scale: value } as never);\n }\n\n /**\n * Distribute the vector sugar into axis props, then write as usual.\n *\n * Same shape as `Node2D.set`'s handling of `size`, and for the same reason:\n * `position` has no slot of its own, so it has to become three writes\n * before the generic loop runs. An explicitly stated axis in the same call\n * wins over the vector, which is what lets `{ position: p, y: 0 }` mean what\n * it reads like.\n */\n override set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\n super.set(distributeVectors(props) as typeof props);\n }\n\n /**\n * The tween half of the same rule. Expanded here rather than in the command\n * so `to({ position: [...] })` and `to({ x, y, z })` produce identical\n * steppers — one interpolating path, whichever way it was written.\n */\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\n return super._prepareStep(distributeVectors(to) as Partial<P>, duration, easing);\n }\n\n /**\n * This node's placement, as the renderer's own vocabulary.\n *\n * Sampled fresh every frame from the prop slots, so a tween moves the object\n * without anything here caching state between frames.\n *\n * `quaternion` is only emitted when it has been set away from identity: it\n * wins over `rotation` in a {@link Transform3D}, so always sending it would\n * make `rotation` silently do nothing.\n */\n protected transform3D(): Transform3D {\n const quaternion = this.quaternion as unknown as Quaternion;\n const identityQuaternion =\n quaternion.x === 0 && quaternion.y === 0 && quaternion.z === 0 && quaternion.w === 1;\n const space = parentSpaceOf(this);\n return {\n position: space ? space.toLocal(this.x, this.y, this.z) : this.position,\n rotation: this.rotation,\n quaternion: identityQuaternion ? undefined : quaternion,\n scale: this.scale,\n lookAt: this.lookAt,\n visible: this.visible,\n shadow: this.shadow,\n renderOrder: this.renderOrder,\n };\n }\n\n /**\n * The coordinates `child`'s `x`/`y`/`z` are in, or `null` (the default) when\n * they are this node's local space. A `null` child is one not here yet.\n */\n /** @internal */\n _spaceOf(_child: Node3D | null): ChildSpace3D | null {\n return null;\n }\n\n /**\n * The transform that goes on this node's *group* — the scope its children\n * nest inside. Defaults to this node's own placement, which is right for\n * everything that lives at its own origin.\n *\n * A camera answers identity and places itself instead: three aims a\n * camera's -Z at `lookAt` but a plain group's +Z, so hanging a camera's\n * placement on its group would point the shot backwards.\n */\n protected groupTransform(): Transform3D {\n return this.transform3D();\n }\n\n /**\n * Draw this node's own contribution to the scene — a `ctx.draw(graphics3D)`\n * for something with geometry, a `ctx.light(...)` for a light, nothing at all\n * for a plain {@link Group3D}. Children are recorded after it, nested inside\n * this node's transform.\n */\n protected renderSelf(ctx: RenderContext3D): void { }\n\n /**\n * Record this node and its subtree into `ctx`.\n *\n * An invisible node still opens its scope: `visible: false` is a renderer-side\n * flag on a live object rather than a removal, which is what lets a node be\n * hidden and shown again without its GPU resources being rebuilt. Skipping the\n * walk here would instead sweep the whole subtree out of the cache.\n */\n render(ctx: RenderContext3D): void {\n // The editor's flag folds into `visible` rather than adding a second one:\n // the 3D side already has exactly this concept, honoured by the picking\n // walk, and two flags meaning \"do not show this\" would be two places to\n // ask. Still opens its scope — see the note above on why an invisible\n // node keeps its cached renderer object.\n if (this.hidden) {\n ctx.begin({ id: this.id, transform: { ...this.groupTransform(), visible: false } });\n ctx.end();\n return;\n }\n ctx.begin({ id: this.id, transform: this.groupTransform() });\n this.renderSelf(ctx);\n for (const child of this._children) {\n if (child instanceof Node3D) child.render(ctx);\n }\n ctx.end();\n }\n\n /**\n * What {@link renderSelf} records, never {@link render}: the placement lives on\n * the group scope, so moving a node does not change what it declares.\n */\n declareAssets(assets: AssetScope): void {\n if (this.renderSelf === Node3D.prototype.renderSelf) return;\n const scene = new Scene3D();\n this.renderSelf(scene);\n declare3DResources(scene, assets);\n }\n}\n\ndeclareMembers(Node3D, {\n x: property({ default: 0 }),\n y: property({ default: 0 }),\n z: property({ default: 0 }),\n rotationX: property({ default: 0 }),\n rotationY: property({ default: 0 }),\n rotationZ: property({ default: 0 }),\n rotationOrder: property({ default: \"XYZ\" }),\n quaternion: quaternionProperty(),\n scaleX: property({ default: 1 }),\n scaleY: property({ default: 1 }),\n scaleZ: property({ default: 1 }),\n lookAt: optionalVector3Property(\"snap\"),\n visible: property({ default: true }),\n shadow: property({ default: true }),\n renderOrder: property({ default: 0 }),\n\n moveTo: command({ args: [\"x\", \"y\", \"z\"] }),\n rotateTo: command({ args: [\"rotationX\", \"rotationY\", \"rotationZ\"] }),\n scaleTo: command({\n args: [{ key: \"scale\", kind: \"number\", min: 0, step: 0.05, unit: \"×\" }, \"scaleX\", \"scaleY\", \"scaleZ\"],\n }),\n});\n\n/**\n * Expand `position`/`rotation`/`scale` in a prop bag into their axis props.\n *\n * Returns the bag untouched when it names none of them, so the common write path\n * allocates nothing. A **binding** expands into three bindings that each resolve\n * the vector and take one component — so `position={() => lift()}` stays a\n * binding, and one thunk driving all three axes is still read once per axis per\n * frame rather than being frozen at bind time.\n */\nfunction distributeVectors<T extends object>(props: T | undefined): T | undefined {\n if (!props) return props;\n\n let out: Record<string, unknown> | undefined;\n\n for (const key in VECTOR_SUGAR) {\n const value = (props as Record<string, unknown>)[key];\n if (value === undefined) continue;\n\n out ??= { ...(props as Record<string, unknown>) };\n delete out[key];\n\n const axes = VECTOR_SUGAR[key];\n\n if (typeof value === \"function\") {\n const read = value as () => Vector3Input;\n for (let i = 0; i < 3; i++) {\n const axis = axes[i];\n if (out[axis] !== undefined) continue;\n out[axis] = () => componentOf(resolveVector3(read()), i);\n }\n continue;\n }\n\n const vector = resolveVector3(value as Vector3Input);\n for (let i = 0; i < 3; i++) {\n const axis = axes[i];\n if (out[axis] === undefined) out[axis] = componentOf(vector, i);\n }\n\n // `order` rides on an Euler and has nowhere else to go.\n if (key === \"rotation\") {\n const order = (value as Euler3).order;\n if (order !== undefined && out.rotationOrder === undefined) out.rotationOrder = order;\n }\n }\n\n return (out as T) ?? props;\n}\n\n/** `data` without the keys left unstated, so a tween never aims an axis at `undefined`. */\nfunction stated<T extends object>(data: T | undefined): Partial<T> {\n const out: Partial<T> = {};\n for (const key in data) if (data[key] !== undefined) out[key] = data[key];\n return out;\n}\n\nfunction componentOf(vector: Vector3, index: number): number {\n return index === 0 ? vector.x : index === 1 ? vector.y : vector.z;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"audio.js","sourceRoot":"","sources":["../../src/document/audio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErE;;;;;GAKG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,yEAAyE;AACzE,SAAS,cAAc;IACnB,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAC7F,CAAC;AAED,8EAA8E;AAC9E,SAAS,QAAQ;IACb,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAClF,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAkB;IACnD,MAAM,KAAK,GAAoB,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7D,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEzD,OAAO;QACH,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,SAAS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C,MAAM,EAAE,CAAC;qBAClE;iBACJ,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YACH,SAAS;QACb,CAAC;QACD,KAAK,CAAC,IAAI,CAAC;YACP,EAAE,EAAE,SAAS,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK;YAClE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;SAC7D,CAAC,CAAC;IACP,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AACxF,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC1C,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACvE,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import type { AudioDocument, ClipDocument, CommandSpec, CompositionDocument, NodeSpec, TimedNodeSpec, VisualDocument } from \"./types\";\r\nimport { isAudioDocument, isStillDocument, nodeSpan } from \"./types\";\r\n\r\n/**\r\n * The id the authored root bus is rewritten to.\r\n *\r\n * Namespaced like every other synthesized id in the document layer, so it can\r\n * never collide with one a document authored itself.\r\n */\r\nconst AUDIO_ROOT_ID = \"@bus\";\r\n\r\n/** The root bus when an audio document doesn't author one explicitly. */\r\nfunction defaultRootBus(): NodeSpec {\r\n return { id: AUDIO_ROOT_ID, type: \"audioBus\", parentId: null, layerOrder: 0, props: {} };\r\n}\r\n\r\n/** The root a lowered audio clip hangs from. Draws nothing; lays out once. */\r\nfunction clipRoot(): NodeSpec {\r\n return { id: \"\", type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\r\n}\r\n\r\n/**\r\n * An audio document, as the composition it already is.\r\n *\r\n * There is no second evaluator for sound, and this is what keeps it that way:\r\n * an audio clip is compiled, seeked and restored by `ClipTimeline` like any\r\n * other, so a bus fade and a rectangle's fade cannot drift because there is only\r\n * one machine running them.\r\n *\r\n * The only thing that has to be arranged is the root. An audio document's own\r\n * root is a bus, but a clip's root is always a `Canvas2D` — so the bus\r\n * becomes that canvas's single audio child under {@link AUDIO_ROOT_ID}, and\r\n * every `targetId: null` / `parentId: null` is rewritten to name it. The canvas\r\n * draws nothing and lays out an empty box once, which is the whole cost of a\r\n * clip that is only sound.\r\n */\r\nexport function loweredAudioDocument(doc: AudioDocument): CompositionDocument {\r\n const nodes: TimedNodeSpec[] = [clipRoot()];\r\n if (!doc.nodes.some(isRootBus)) nodes.push(defaultRootBus());\r\n for (const spec of doc.nodes) nodes.push(reparent(spec));\r\n\r\n return {\r\n kind: \"composition\",\r\n duration: doc.duration,\r\n variables: doc.variables,\r\n nodes,\r\n commands: doc.commands.map(retarget),\r\n };\r\n}\r\n\r\n/** The row an audio document means as its root bus. */\r\nfunction isRootBus(spec: NodeSpec): boolean {\r\n return spec.id === \"\" && spec.type === \"audioBus\";\r\n}\r\n\r\n/** A node spec with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\r\nfunction reparent(spec: TimedNodeSpec): TimedNodeSpec {\r\n if (isRootBus(spec)) return { ...spec, id: AUDIO_ROOT_ID, parentId: null };\r\n // `null` is the document's own convention for \"the root\"; `\"\"` is the same\r\n // row named by id, which `checkTree` also resolves. Both mean the bus.\r\n if (spec.parentId === null || spec.parentId === \"\") return { ...spec, parentId: AUDIO_ROOT_ID };\r\n return spec;\r\n}\r\n\r\n/** A command with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\r\nfunction retarget(command: CommandSpec): CommandSpec {\r\n if (command.targetId === null || command.targetId === \"\") {\r\n return { ...command, targetId: AUDIO_ROOT_ID };\r\n }\r\n return command;\r\n}\r\n\r\nexport { AUDIO_ROOT_ID };\r\n\r\n/**\r\n * A `sound` or `video` row with no `play` command of its own plays as it did\r\n * before sound came only from commands: a sound over its span (open-ended, to\r\n * its own end), a video once per segment, or over its span while it plays.\r\n */\r\nexport function withPlayedSounds(doc: CompositionDocument): CompositionDocument {\r\n const played = new Set(doc.commands.filter((c) => c.type === \"play\").map((c) => c.targetId));\r\n const added: CommandSpec[] = [];\r\n for (const spec of doc.nodes) {\r\n if ((spec.type !== \"sound\" && spec.type !== \"video\") || played.has(spec.id)) continue;\r\n const { start, end } = nodeSpan(spec);\r\n const segments = spec.type === \"video\" ? (spec.props as { segments?: unknown }).segments : undefined;\r\n if (Array.isArray(segments) && segments.length > 0) {\r\n (segments as { at: number; from: number; duration: number; speed?: number; volume?: number }[]).forEach((segment, i) => {\r\n added.push({\r\n // An endless segment plays to the source's end: a command has no endless length.\r\n id: `@play:${spec.id}:${i}`, type: \"play\", targetId: spec.id, at: start + segment.at,\r\n duration: Number.isFinite(segment.duration) ? segment.duration : 0,\r\n args: {\r\n from: segment.from,\r\n ...(segment.speed !== undefined && { speed: segment.speed }),\r\n ...(segment.volume !== undefined && { volume: segment.volume }),\r\n },\r\n });\r\n });\r\n continue;\r\n }\r\n added.push({\r\n id: `@play:${spec.id}`, type: \"play\", targetId: spec.id, at: start,\r\n duration: Number.isFinite(end) ? end - start : 0, args: {},\r\n });\r\n }\r\n return added.length === 0 ? doc : { ...doc, commands: [...doc.commands, ...added] };\r\n}\r\n\r\n/** A clip as its timeline builds it: an audio document lowered to the composition it is, its sounds played. */\r\nexport function clipDocument(doc: ClipDocument): VisualDocument {\r\n const lowered = isAudioDocument(doc) ? loweredAudioDocument(doc) : doc;\r\n return isStillDocument(lowered) ? lowered : withPlayedSounds(lowered);\r\n}\r\n"]}
1
+ {"version":3,"file":"audio.js","sourceRoot":"","sources":["../../src/document/audio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErE;;;;;GAKG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,yEAAyE;AACzE,SAAS,cAAc;IACnB,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAC7F,CAAC;AAED,8EAA8E;AAC9E,SAAS,QAAQ;IACb,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAClF,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAkB;IACnD,MAAM,KAAK,GAAoB,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7D,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEzD,OAAO;QACH,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,KAAK;QACL,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;KACvC,CAAC;AACN,CAAC;AAED,uDAAuD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S,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK;YAClE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;SAC7D,CAAC,CAAC;IACP,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AACxF,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC1C,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACvE,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import type { AudioDocument, ClipDocument, CommandSpec, CompositionDocument, NodeSpec, TimedNodeSpec, VisualDocument } from \"./types\";\nimport { isAudioDocument, isStillDocument, nodeSpan } from \"./types\";\n\n/**\n * The id the authored root bus is rewritten to.\n *\n * Namespaced like every other synthesized id in the document layer, so it can\n * never collide with one a document authored itself.\n */\nconst AUDIO_ROOT_ID = \"@bus\";\n\n/** The root bus when an audio document doesn't author one explicitly. */\nfunction defaultRootBus(): NodeSpec {\n return { id: AUDIO_ROOT_ID, type: \"audioBus\", parentId: null, layerOrder: 0, props: {} };\n}\n\n/** The root a lowered audio clip hangs from. Draws nothing; lays out once. */\nfunction clipRoot(): NodeSpec {\n return { id: \"\", type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\n}\n\n/**\n * An audio document, as the composition it already is.\n *\n * There is no second evaluator for sound, and this is what keeps it that way:\n * an audio clip is compiled, seeked and restored by `ClipTimeline` like any\n * other, so a bus fade and a rectangle's fade cannot drift because there is only\n * one machine running them.\n *\n * The only thing that has to be arranged is the root. An audio document's own\n * root is a bus, but a clip's root is always a `Canvas2D` — so the bus\n * becomes that canvas's single audio child under {@link AUDIO_ROOT_ID}, and\n * every `targetId: null` / `parentId: null` is rewritten to name it. The canvas\n * draws nothing and lays out an empty box once, which is the whole cost of a\n * clip that is only sound.\n */\nexport function loweredAudioDocument(doc: AudioDocument): CompositionDocument {\n const nodes: TimedNodeSpec[] = [clipRoot()];\n if (!doc.nodes.some(isRootBus)) nodes.push(defaultRootBus());\n for (const spec of doc.nodes) nodes.push(reparent(spec));\n\n return {\n kind: \"composition\",\n duration: doc.duration,\n variables: doc.variables,\n nodes,\n commands: doc.commands.map(retarget),\n };\n}\n\n/** The row an audio document means as its root bus. */\nfunction isRootBus(spec: NodeSpec): boolean {\n return spec.id === \"\" && spec.type === \"audioBus\";\n}\n\n/** A node spec with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\nfunction reparent(spec: TimedNodeSpec): TimedNodeSpec {\n if (isRootBus(spec)) return { ...spec, id: AUDIO_ROOT_ID, parentId: null };\n // `null` is the document's own convention for \"the root\"; `\"\"` is the same\n // row named by id, which `checkTree` also resolves. Both mean the bus.\n if (spec.parentId === null || spec.parentId === \"\") return { ...spec, parentId: AUDIO_ROOT_ID };\n return spec;\n}\n\n/** A command with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\nfunction retarget(command: CommandSpec): CommandSpec {\n if (command.targetId === null || command.targetId === \"\") {\n return { ...command, targetId: AUDIO_ROOT_ID };\n }\n return command;\n}\n\nexport { AUDIO_ROOT_ID };\n\n/**\n * A `sound` or `video` row with no `play` command of its own plays as it did\n * before sound came only from commands: a sound over its span (open-ended, to\n * its own end), a video once per segment, or over its span while it plays.\n */\nexport function withPlayedSounds(doc: CompositionDocument): CompositionDocument {\n const played = new Set(doc.commands.filter((c) => c.type === \"play\").map((c) => c.targetId));\n const added: CommandSpec[] = [];\n for (const spec of doc.nodes) {\n if ((spec.type !== \"sound\" && spec.type !== \"video\") || played.has(spec.id)) continue;\n const { start, end } = nodeSpan(spec);\n const segments = spec.type === \"video\" ? (spec.props as { segments?: unknown }).segments : undefined;\n if (Array.isArray(segments) && segments.length > 0) {\n (segments as { at: number; from: number; duration: number; speed?: number; volume?: number }[]).forEach((segment, i) => {\n added.push({\n // An endless segment plays to the source's end: a command has no endless length.\n id: `@play:${spec.id}:${i}`, type: \"play\", targetId: spec.id, at: start + segment.at,\n duration: Number.isFinite(segment.duration) ? segment.duration : 0,\n args: {\n from: segment.from,\n ...(segment.speed !== undefined && { speed: segment.speed }),\n ...(segment.volume !== undefined && { volume: segment.volume }),\n },\n });\n });\n continue;\n }\n added.push({\n id: `@play:${spec.id}`, type: \"play\", targetId: spec.id, at: start,\n duration: Number.isFinite(end) ? end - start : 0, args: {},\n });\n }\n return added.length === 0 ? doc : { ...doc, commands: [...doc.commands, ...added] };\n}\n\n/** A clip as its timeline builds it: an audio document lowered to the composition it is, its sounds played. */\nexport function clipDocument(doc: ClipDocument): VisualDocument {\n const lowered = isAudioDocument(doc) ? loweredAudioDocument(doc) : doc;\n return isStillDocument(lowered) ? lowered : withPlayedSounds(lowered);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../src/document/builtins.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkC,MAAM,iBAAiB,CAAC;AAK/E,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,yCAAyC,CAAC;AACtG,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UA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;YACpB,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC,EAAE,MAAM,CAAgD,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,6EAA6E;IAC7E,QAAQ,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxD,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE;QACjB,MAAM,CAAC,GAAG,CAAE,IAA4B,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC,CAAgD,CAAC,CAAC;IAEvD,4EAA4E;IAC5E,8EAA8E;IAC9E,sEAAsE;IACtE,2EAA2E;IAC3E,0EAA0E;IAC1E,gEAAgE;IAChE,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CACnC,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE;QAChB,MAAiB,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC,CAAgD,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import type { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport type { Shadow } from \"@/attributes/shape/shadow/shadow\";\r\nimport type { Stroke } from \"@/attributes/shape/stroke/stroke\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { driveCommand, type Command, type CommandArgs } from \"@/tween/command\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\r\n\r\nimport { BooleanGroup, MaskGroup } from \"@/components/builtins/geometry/composite\";\r\nimport { Ellipse, PathShape, Polygon, Polygram, Rect } from \"@/components/builtins/geometry/geometry\";\r\nimport { Camera, OrbitCamera, RotatedBox } from \"@/components/builtins/layout/layout\";\r\nimport { Video } from \"@/components/builtins/media/media\";\r\nimport { AudioBus, SoundNode } from \"@/components/builtins/audio/audio\";\r\nimport { Canvas2D } from \"@/components/trees/root/canvas2d-node\";\r\nimport { Provider, ThemeProvider } from \"@/components/builtins/providers/providers\";\r\nimport { DefaultTextStyle, NumberNode, RichText, Text } from \"@/components/builtins/text/text\";\r\nimport { Canvas3D } from \"@/components/builtins/three/canvas3d\";\r\nimport {\r\n AmbientLight3D, AreaLight3D, Box3D, Camera3D, Capsule3D, Circle3D, Cone3D, Cylinder3D, DirectionalLight3D,\r\n Environment3D, Extrude3D, Fog3D, Group3D, HemisphereLight3D, Instances3D, Lathe3D, Line3D, Mesh3D, Model3D,\r\n Plane3D, PointLight3D, Points3D, Polyhedron3D, Ring3D, Sphere3D, SpotLight3D, Sprite3D, Torus3D, TorusKnot3D, Tube3D,\r\n} from \"@/components/builtins/three/three\";\r\n\r\nimport { lerpVector2 } from \"@/attributes/layout/vector2\";\r\nimport { lerpColor } from \"@/attributes/shape/fill/lerp\";\r\nimport { parseColor } from \"@/attributes/shape/fill/color/parser\";\r\nimport { lerpVector3 } from \"@/render3d/vector3\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\nimport type { NodeConstructor, Registry, VariableLerp } from \"./registry\";\r\n\r\n/**\r\n * Registration of everything `@motionscript/core` itself ships.\r\n *\r\n * The keys here are **document API**. A stored scene names its nodes and its\r\n * animations with these strings, so renaming one silently breaks every document\r\n * that used it — they are as much a public contract as an exported symbol, and\r\n * are deliberately spelled out rather than derived from `constructor.name`\r\n * (which a minifier is free to mangle).\r\n */\r\n\r\n/** Every built-in node type, keyed as a document names it. */\r\nconst NODE_TYPES: Record<string, NodeConstructor> = {\r\n // Clip root and structural\r\n canvas2d: Canvas2D as unknown as NodeConstructor,\r\n provider: Provider as unknown as NodeConstructor,\r\n \"theme-provider\": ThemeProvider as unknown as NodeConstructor,\r\n \"default-text-style\": DefaultTextStyle as unknown as NodeConstructor,\r\n\r\n // Geometry\r\n rect: Rect as unknown as NodeConstructor,\r\n ellipse: Ellipse as unknown as NodeConstructor,\r\n // The **unit-box** path, not `path-node.ts`'s face-value `Path`. A stored\r\n // document's `data` is a fraction of the node's own box, so a resize is an\r\n // ordinary `width`/`height` write and every editor gizmo works on it\r\n // unchanged (`box-path-node.ts` has the whole argument). `Path` draws its\r\n // `d` at face value and hugs it, which is right for geometry somebody wrote\r\n // in code — it stays exported for that, and is reached by importing the\r\n // class rather than by naming a type in a document.\r\n path: PathShape as unknown as NodeConstructor,\r\n polygon: Polygon as unknown as NodeConstructor,\r\n polygram: Polygram as unknown as NodeConstructor,\r\n boolean: BooleanGroup as unknown as NodeConstructor,\r\n mask: MaskGroup as unknown as NodeConstructor,\r\n\r\n // Layout\r\n camera: Camera as unknown as NodeConstructor,\r\n orbitCamera: OrbitCamera as unknown as NodeConstructor,\r\n \"rotated-box\": RotatedBox as unknown as NodeConstructor,\r\n\r\n // Text\r\n text: Text as unknown as NodeConstructor,\r\n richtext: RichText as unknown as NodeConstructor,\r\n number: NumberNode as unknown as NodeConstructor,\r\n\r\n // Media\r\n video: Video as unknown as NodeConstructor,\r\n\r\n // Audio — a bus groups, a sound plays. `audioBus` is also the root of an\r\n // AudioDocument, the way `canvas2d` is the root of a scene.\r\n audioBus: AudioBus as unknown as NodeConstructor,\r\n sound: SoundNode as unknown as NodeConstructor,\r\n\r\n // 3D — the viewport, then the tree that lives inside it\r\n canvas3d: Canvas3D as unknown as NodeConstructor,\r\n group3d: Group3D as unknown as NodeConstructor,\r\n mesh3d: Mesh3D as unknown as NodeConstructor,\r\n box3d: Box3D as unknown as NodeConstructor,\r\n sphere3d: Sphere3D as unknown as NodeConstructor,\r\n plane3d: Plane3D as unknown as NodeConstructor,\r\n circle3d: Circle3D as unknown as NodeConstructor,\r\n cylinder3d: Cylinder3D as unknown as NodeConstructor,\r\n cone3d: Cone3D as unknown as NodeConstructor,\r\n capsule3d: Capsule3D as unknown as NodeConstructor,\r\n torus3d: Torus3D as unknown as NodeConstructor,\r\n \"torus-knot3d\": TorusKnot3D as unknown as NodeConstructor,\r\n tube3d: Tube3D as unknown as NodeConstructor,\r\n lathe3d: Lathe3D as unknown as NodeConstructor,\r\n extrude3d: Extrude3D as unknown as NodeConstructor,\r\n ring3d: Ring3D as unknown as NodeConstructor,\r\n polyhedron3d: Polyhedron3D as unknown as NodeConstructor,\r\n points3d: Points3D as unknown as NodeConstructor,\r\n line3d: Line3D as unknown as NodeConstructor,\r\n sprite3d: Sprite3D as unknown as NodeConstructor,\r\n instances3d: Instances3D as unknown as NodeConstructor,\r\n model3d: Model3D as unknown as NodeConstructor,\r\n camera3d: Camera3D as unknown as NodeConstructor,\r\n \"ambient-light3d\": AmbientLight3D as unknown as NodeConstructor,\r\n \"directional-light3d\": DirectionalLight3D as unknown as NodeConstructor,\r\n \"point-light3d\": PointLight3D as unknown as NodeConstructor,\r\n \"spot-light3d\": SpotLight3D as unknown as NodeConstructor,\r\n \"hemisphere-light3d\": HemisphereLight3D as unknown as NodeConstructor,\r\n \"area-light3d\": AreaLight3D as unknown as NodeConstructor,\r\n fog3d: Fog3D as unknown as NodeConstructor,\r\n environment3d: Environment3D as unknown as NodeConstructor,\r\n};\r\n\r\n/** A node method taking one {@link CommandArgs}. */\r\ntype EasedMethod = (args: CommandArgs) => Command<Record<string, unknown>>;\r\n\r\n/** Call a paint command (`fillTo`/`overlayTo`/`strokeTo`/`shadowTo`). */\r\nfunction paintCommand(method: string, argKey: string) {\r\n return (\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 const fn = (target as unknown as Record<string, unknown>)[method];\r\n if (typeof fn !== \"function\") {\r\n throw new Error(\r\n `Command \"${method}\" is not available on ${target.constructor.name}.`,\r\n );\r\n }\r\n return (fn as EasedMethod).call(target, { data: args[argKey] as Record<string, unknown>, duration, easing });\r\n };\r\n}\r\n\r\n/**\r\n * The interpolations a document can name in `VariableSpec.lerp`.\r\n *\r\n * Deliberately the small set a variable actually holds — a number, a point, a\r\n * colour — rather than one entry per attribute in the library. A variable drives\r\n * props *through* an expression, so it only has to carry the quantity that\r\n * varies: a gradient that shifts is one `stop` number bound into a fill, not a\r\n * whole fill being interpolated a second time. Anything else is a\r\n * `registry.addLerp` away.\r\n */\r\nconst VARIABLE_LERPS: Record<string, VariableLerp> = {\r\n number: lerpNumber as VariableLerp,\r\n vector2: lerpVector2 as VariableLerp,\r\n vector3: lerpVector3 as VariableLerp,\r\n /**\r\n * Parse both ends, blend per channel, hand back a CSS string.\r\n *\r\n * A string rather than the parsed tuple because that is what the prop on the\r\n * far side of the expression takes — every fill, stroke and shadow resolves\r\n * a colour from CSS text, and `parseColor` reads theme tokens and the\r\n * `\"white/10\"` opacity suffix too, so a variable can hold either.\r\n */\r\n color: ((from, to, t) => {\r\n const [r, g, b, a] = lerpColor(parseColor(String(from)), parseColor(String(to)), t);\r\n const channel = (v: number) => Math.round(Math.min(Math.max(v, 0), 1) * 255);\r\n return `rgba(${channel(r)}, ${channel(g)}, ${channel(b)}, ${Number(a.toFixed(4))})`;\r\n }) as VariableLerp,\r\n /**\r\n * No interpolation: hold `from` until the tween lands, then take `to`.\r\n *\r\n * The default for a non-numeric variable: a discrete value (a string of\r\n * text, an enum, a boolean) has no midpoint, and inventing one produces a\r\n * frame that is neither state.\r\n */\r\n step: ((from, to, t) => (t >= 1 ? to : from)) as VariableLerp,\r\n};\r\n\r\n/**\r\n * Seed a {@link Registry} with everything `@motionscript/core` itself ships.\r\n *\r\n * **Internal, and called from `Registry`'s own constructor.** It used to be\r\n * public and every host had to call it at module scope before compiling\r\n * anything — which `sideEffects: false` is entitled to delete, with a failure\r\n * mode (\"unknown node type rect\") that points nowhere near the cause. A registry\r\n * that seeds itself makes the vocabulary a value dependency of the engine\r\n * instead, so there is nothing left to tree-shake and nothing to remember.\r\n *\r\n * @internal\r\n */\r\nexport function installBuiltins(registry: Registry): void {\r\n for (const [key, ctor] of Object.entries(NODE_TYPES)) {\r\n registry.addNode(key, ctor);\r\n }\r\n for (const [key, lerp] of Object.entries(VARIABLE_LERPS)) {\r\n registry.addLerp(key, lerp);\r\n }\r\n\r\n // ── Props ────────────────────────────────────────────────────────────────\r\n // `args` *is* the props diff — no wrapper key, since `to`/`set` each carry\r\n // exactly one argument and a node's own props are already a fixed,\r\n // known-shape bag (not something a second command parameter could collide\r\n // with the way `to`/`set` never gained one).\r\n registry.addCommand(\"to\", (target, args, duration, easing) =>\r\n (target as Node2D).to({\r\n // Copied: `_prepareStep` expands sugar into its target in place, which\r\n // would rewrite the document row a diff compares by identity.\r\n data: { ...args } as Record<string, never>,\r\n duration,\r\n easing,\r\n }) as unknown as Command<Record<string, unknown>>);\r\n\r\n // A stamp: write props with no tween. `duration` is ignored, which is what\r\n // makes it usable as the \"set this here\" a keyframe editor needs.\r\n //\r\n // `binds` because its args reach `set()` verbatim, so an expression among\r\n // them is a binding — this is how a prop starts following a variable partway\r\n // through a scene rather than from the moment its node is authored.\r\n registry.addCommand(\"set\", (target, args) => {\r\n const props = args as Record<string, never>;\r\n return driveCommand(0, () => {\r\n (target as Node2D).set(props);\r\n }) as unknown as Command<Record<string, unknown>>;\r\n }, { binds: true });\r\n\r\n // ── Paint (shapes, text, Canvas2D) ─────────────────────────────────────\r\n // Node-less rather than per-type, like `to` and `set` above: these are\r\n // generic over every painted node, and they take a `TweenOptions` bag where\r\n // an ordinary command takes a bare easing function — so they need a factory\r\n // that knows that convention rather than the uniform one a node type's own\r\n // table dispatches through.\r\n // Each declares the one key it reads, in the kind its property uses, so a\r\n // host draws the same paint stack for the command as for the prop.\r\n registry.addCommand(\"fillTo\", paintCommand(\"fillTo\", \"fill\"), { args: [{ key: \"fill\", kind: \"fills\" }], method: \"fillTo\" });\r\n registry.addCommand(\"overlayTo\", paintCommand(\"overlayTo\", \"overlay\"), { args: [{ key: \"overlay\", kind: \"fills\" }], method: \"overlayTo\" });\r\n registry.addCommand(\"strokeTo\", paintCommand(\"strokeTo\", \"stroke\"), { args: [{ key: \"stroke\", kind: \"strokes\" }], method: \"strokeTo\" });\r\n registry.addCommand(\"shadowTo\", paintCommand(\"shadowTo\", \"shadow\"), { args: [{ key: \"shadow\", kind: \"shadows\" }], method: \"shadowTo\" });\r\n\r\n // Transform, camera, text and `restore` commands are not registered here:\r\n // they are `command()` methods, and `Registry.addNode` publishes them off\r\n // the classes above. See `document/registry.ts`.\r\n\r\n // ── Variables ────────────────────────────────────────────────────────────\r\n // Tween a variable. The one command that drives many nodes at once: every\r\n // prop bound to `\"=[id]\"` follows what this writes, with no command of its\r\n // own and nothing to keep in sync.\r\n registry.addVariableCommand(\"variableTo\", (target, args, duration, easing) => {\r\n const to = (args as { value?: unknown }).value;\r\n const lerpKey = (args as { lerp?: unknown }).lerp;\r\n const override = typeof lerpKey === \"string\" ? registry.lerp(lerpKey) : undefined;\r\n if (lerpKey !== undefined && !override) {\r\n throw new Error(\r\n `A \"lerp\" param must name a registered lerp (variable \"${target.id}\"), ` +\r\n `got ${JSON.stringify(lerpKey)}. Registered: ${registry.lerpKeys().join(\", \")}.`,\r\n );\r\n }\r\n const lerp = override ?? target.lerp;\r\n\r\n // `from` is captured on the command's first evaluation rather than here,\r\n // exactly as a node's `to()` does: the timeline builds commands in order\r\n // and runs each to `at(1)`, so the capture sees the state its\r\n // predecessors left. Captured once, it is then a pure function of `t`.\r\n let from: unknown;\r\n let captured = false;\r\n return driveCommand(duration, (t) => {\r\n if (!captured) {\r\n from = target.get();\r\n captured = true;\r\n }\r\n target.set(lerp(from, to, t));\r\n }, easing) as unknown as Command<Record<string, unknown>>;\r\n });\r\n\r\n // A stamp, matching `set`: write the value with no tween, ignoring duration.\r\n registry.addVariableCommand(\"variableSet\", (target, args) =>\r\n driveCommand(0, () => {\r\n target.set((args as { value?: unknown }).value);\r\n }) as unknown as Command<Record<string, unknown>>);\r\n\r\n // ── State ────────────────────────────────────────────────────────────────\r\n // `restore` pops the layer a `save` pushed, and is published off `Node`'s own\r\n // `command()`. `save` is not one, so it is registered here — both are\r\n // commands so the pair is placed on the timeline like anything else, and a\r\n // seek past the save still produces the same frame: the value is computed\r\n // from the chain rather than accumulated as the playhead moves.\r\n registry.addCommand(\"save\", (target) =>\r\n driveCommand(0, () => {\r\n (target as Node2D).save();\r\n }) as unknown as Command<Record<string, unknown>>);\r\n}\r\n\r\n/** Type-only re-exports, so a caller writing args gets the same shapes. */\r\nexport type { Fill, Shadow, Stroke, Vector2 };\r\n"]}
1
+ {"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../src/document/builtins.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkC,MAAM,iBAAiB,CAAC;AAK/E,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,yCAAyC,CAAC;AACtG,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EACH,cAAc,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EACzG,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAC1G,OAAO,EAAE,Y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C3D,CAAC","sourcesContent":["import type { Fill } from \"@/attributes/shape/fill/chain\";\nimport type { Shadow } from \"@/attributes/shape/shadow/shadow\";\nimport type { Stroke } from \"@/attributes/shape/stroke/stroke\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport { driveCommand, type Command, type CommandArgs } from \"@/tween/command\";\nimport type { EasingFunction } from \"@/tween/ease/type\";\nimport type { Node } from \"@/components/trees/node/node\";\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\n\nimport { BooleanGroup, MaskGroup } from \"@/components/builtins/geometry/composite\";\nimport { Ellipse, PathShape, Polygon, Polygram, Rect } from \"@/components/builtins/geometry/geometry\";\nimport { Camera, OrbitCamera, RotatedBox } from \"@/components/builtins/layout/layout\";\nimport { Video } from \"@/components/builtins/media/media\";\nimport { AudioBus, SoundNode } from \"@/components/builtins/audio/audio\";\nimport { Canvas2D } from \"@/components/trees/root/canvas2d-node\";\nimport { Provider, ThemeProvider } from \"@/components/builtins/providers/providers\";\nimport { DefaultTextStyle, NumberNode, RichText, Text } from \"@/components/builtins/text/text\";\nimport { Canvas3D } from \"@/components/builtins/three/canvas3d\";\nimport {\n AmbientLight3D, AreaLight3D, Box3D, Camera3D, Capsule3D, Circle3D, Cone3D, Cylinder3D, DirectionalLight3D,\n Environment3D, Extrude3D, Fog3D, Group3D, HemisphereLight3D, Instances3D, Lathe3D, Line3D, Mesh3D, Model3D,\n Plane3D, PointLight3D, Points3D, Polyhedron3D, Ring3D, Sphere3D, SpotLight3D, Sprite3D, Torus3D, TorusKnot3D, Tube3D,\n} from \"@/components/builtins/three/three\";\n\nimport { lerpVector2 } from \"@/attributes/layout/vector2\";\nimport { lerpColor } from \"@/attributes/shape/fill/lerp\";\nimport { parseColor } from \"@/attributes/shape/fill/color/parser\";\nimport { lerpVector3 } from \"@/render3d/vector3\";\nimport { lerpNumber } from \"@/tween/lerp\";\n\nimport type { NodeConstructor, Registry, VariableLerp } from \"./registry\";\n\n/**\n * Registration of everything `@motionscript/core` itself ships.\n *\n * The keys here are **document API**. A stored scene names its nodes and its\n * animations with these strings, so renaming one silently breaks every document\n * that used it — they are as much a public contract as an exported symbol, and\n * are deliberately spelled out rather than derived from `constructor.name`\n * (which a minifier is free to mangle).\n */\n\n/** Every built-in node type, keyed as a document names it. */\nconst NODE_TYPES: Record<string, NodeConstructor> = {\n // Clip root and structural\n canvas2d: Canvas2D as unknown as NodeConstructor,\n provider: Provider as unknown as NodeConstructor,\n \"theme-provider\": ThemeProvider as unknown as NodeConstructor,\n \"default-text-style\": DefaultTextStyle as unknown as NodeConstructor,\n\n // Geometry\n rect: Rect as unknown as NodeConstructor,\n ellipse: Ellipse as unknown as NodeConstructor,\n // The **unit-box** path, not `path-node.ts`'s face-value `Path`. A stored\n // document's `data` is a fraction of the node's own box, so a resize is an\n // ordinary `width`/`height` write and every editor gizmo works on it\n // unchanged (`box-path-node.ts` has the whole argument). `Path` draws its\n // `d` at face value and hugs it, which is right for geometry somebody wrote\n // in code — it stays exported for that, and is reached by importing the\n // class rather than by naming a type in a document.\n path: PathShape as unknown as NodeConstructor,\n polygon: Polygon as unknown as NodeConstructor,\n polygram: Polygram as unknown as NodeConstructor,\n boolean: BooleanGroup as unknown as NodeConstructor,\n mask: MaskGroup as unknown as NodeConstructor,\n\n // Layout\n camera: Camera as unknown as NodeConstructor,\n orbitCamera: OrbitCamera as unknown as NodeConstructor,\n \"rotated-box\": RotatedBox as unknown as NodeConstructor,\n\n // Text\n text: Text as unknown as NodeConstructor,\n richtext: RichText as unknown as NodeConstructor,\n number: NumberNode as unknown as NodeConstructor,\n\n // Media\n video: Video as unknown as NodeConstructor,\n\n // Audio — a bus groups, a sound plays. `audioBus` is also the root of an\n // AudioDocument, the way `canvas2d` is the root of a scene.\n audioBus: AudioBus as unknown as NodeConstructor,\n sound: SoundNode as unknown as NodeConstructor,\n\n // 3D — the viewport, then the tree that lives inside it\n canvas3d: Canvas3D as unknown as NodeConstructor,\n group3d: Group3D as unknown as NodeConstructor,\n mesh3d: Mesh3D as unknown as NodeConstructor,\n box3d: Box3D as unknown as NodeConstructor,\n sphere3d: Sphere3D as unknown as NodeConstructor,\n plane3d: Plane3D as unknown as NodeConstructor,\n circle3d: Circle3D as unknown as NodeConstructor,\n cylinder3d: Cylinder3D as unknown as NodeConstructor,\n cone3d: Cone3D as unknown as NodeConstructor,\n capsule3d: Capsule3D as unknown as NodeConstructor,\n torus3d: Torus3D as unknown as NodeConstructor,\n \"torus-knot3d\": TorusKnot3D as unknown as NodeConstructor,\n tube3d: Tube3D as unknown as NodeConstructor,\n lathe3d: Lathe3D as unknown as NodeConstructor,\n extrude3d: Extrude3D as unknown as NodeConstructor,\n ring3d: Ring3D as unknown as NodeConstructor,\n polyhedron3d: Polyhedron3D as unknown as NodeConstructor,\n points3d: Points3D as unknown as NodeConstructor,\n line3d: Line3D as unknown as NodeConstructor,\n sprite3d: Sprite3D as unknown as NodeConstructor,\n instances3d: Instances3D as unknown as NodeConstructor,\n model3d: Model3D as unknown as NodeConstructor,\n camera3d: Camera3D as unknown as NodeConstructor,\n \"ambient-light3d\": AmbientLight3D as unknown as NodeConstructor,\n \"directional-light3d\": DirectionalLight3D as unknown as NodeConstructor,\n \"point-light3d\": PointLight3D as unknown as NodeConstructor,\n \"spot-light3d\": SpotLight3D as unknown as NodeConstructor,\n \"hemisphere-light3d\": HemisphereLight3D as unknown as NodeConstructor,\n \"area-light3d\": AreaLight3D as unknown as NodeConstructor,\n fog3d: Fog3D as unknown as NodeConstructor,\n environment3d: Environment3D as unknown as NodeConstructor,\n};\n\n/** A node method taking one {@link CommandArgs}. */\ntype EasedMethod = (args: CommandArgs) => Command<Record<string, unknown>>;\n\n/** Call a paint command (`fillTo`/`overlayTo`/`strokeTo`/`shadowTo`). */\nfunction paintCommand(method: string, argKey: string) {\n return (\n target: Node,\n args: Record<string, unknown>,\n duration: number,\n easing?: EasingFunction,\n ): Command<Record<string, unknown>> => {\n const fn = (target as unknown as Record<string, unknown>)[method];\n if (typeof fn !== \"function\") {\n throw new Error(\n `Command \"${method}\" is not available on ${target.constructor.name}.`,\n );\n }\n return (fn as EasedMethod).call(target, { data: args[argKey] as Record<string, unknown>, duration, easing });\n };\n}\n\n/**\n * The interpolations a document can name in `VariableSpec.lerp`.\n *\n * Deliberately the small set a variable actually holds — a number, a point, a\n * colour — rather than one entry per attribute in the library. A variable drives\n * props *through* an expression, so it only has to carry the quantity that\n * varies: a gradient that shifts is one `stop` number bound into a fill, not a\n * whole fill being interpolated a second time. Anything else is a\n * `registry.addLerp` away.\n */\nconst VARIABLE_LERPS: Record<string, VariableLerp> = {\n number: lerpNumber as VariableLerp,\n vector2: lerpVector2 as VariableLerp,\n vector3: lerpVector3 as VariableLerp,\n /**\n * Parse both ends, blend per channel, hand back a CSS string.\n *\n * A string rather than the parsed tuple because that is what the prop on the\n * far side of the expression takes — every fill, stroke and shadow resolves\n * a colour from CSS text, and `parseColor` reads theme tokens and the\n * `\"white/10\"` opacity suffix too, so a variable can hold either.\n */\n color: ((from, to, t) => {\n const [r, g, b, a] = lerpColor(parseColor(String(from)), parseColor(String(to)), t);\n const channel = (v: number) => Math.round(Math.min(Math.max(v, 0), 1) * 255);\n return `rgba(${channel(r)}, ${channel(g)}, ${channel(b)}, ${Number(a.toFixed(4))})`;\n }) as VariableLerp,\n /**\n * No interpolation: hold `from` until the tween lands, then take `to`.\n *\n * The default for a non-numeric variable: a discrete value (a string of\n * text, an enum, a boolean) has no midpoint, and inventing one produces a\n * frame that is neither state.\n */\n step: ((from, to, t) => (t >= 1 ? to : from)) as VariableLerp,\n};\n\n/**\n * Seed a {@link Registry} with everything `@motionscript/core` itself ships.\n *\n * **Internal, and called from `Registry`'s own constructor.** It used to be\n * public and every host had to call it at module scope before compiling\n * anything — which `sideEffects: false` is entitled to delete, with a failure\n * mode (\"unknown node type rect\") that points nowhere near the cause. A registry\n * that seeds itself makes the vocabulary a value dependency of the engine\n * instead, so there is nothing left to tree-shake and nothing to remember.\n *\n * @internal\n */\nexport function installBuiltins(registry: Registry): void {\n for (const [key, ctor] of Object.entries(NODE_TYPES)) {\n registry.addNode(key, ctor);\n }\n for (const [key, lerp] of Object.entries(VARIABLE_LERPS)) {\n registry.addLerp(key, lerp);\n }\n\n // ── Props ────────────────────────────────────────────────────────────────\n // `args` *is* the props diff — no wrapper key, since `to`/`set` each carry\n // exactly one argument and a node's own props are already a fixed,\n // known-shape bag (not something a second command parameter could collide\n // with the way `to`/`set` never gained one).\n registry.addCommand(\"to\", (target, args, duration, easing) =>\n (target as Node2D).to({\n // Copied: `_prepareStep` expands sugar into its target in place, which\n // would rewrite the document row a diff compares by identity.\n data: { ...args } as Record<string, never>,\n duration,\n easing,\n }) as unknown as Command<Record<string, unknown>>);\n\n // A stamp: write props with no tween. `duration` is ignored, which is what\n // makes it usable as the \"set this here\" a keyframe editor needs.\n //\n // `binds` because its args reach `set()` verbatim, so an expression among\n // them is a binding — this is how a prop starts following a variable partway\n // through a scene rather than from the moment its node is authored.\n registry.addCommand(\"set\", (target, args) => {\n const props = args as Record<string, never>;\n return driveCommand(0, () => {\n (target as Node2D).set(props);\n }) as unknown as Command<Record<string, unknown>>;\n }, { binds: true });\n\n // ── Paint (shapes, text, Canvas2D) ─────────────────────────────────────\n // Node-less rather than per-type, like `to` and `set` above: these are\n // generic over every painted node, and they take a `TweenOptions` bag where\n // an ordinary command takes a bare easing function — so they need a factory\n // that knows that convention rather than the uniform one a node type's own\n // table dispatches through.\n // Each declares the one key it reads, in the kind its property uses, so a\n // host draws the same paint stack for the command as for the prop.\n registry.addCommand(\"fillTo\", paintCommand(\"fillTo\", \"fill\"), { args: [{ key: \"fill\", kind: \"fills\" }], method: \"fillTo\" });\n registry.addCommand(\"overlayTo\", paintCommand(\"overlayTo\", \"overlay\"), { args: [{ key: \"overlay\", kind: \"fills\" }], method: \"overlayTo\" });\n registry.addCommand(\"strokeTo\", paintCommand(\"strokeTo\", \"stroke\"), { args: [{ key: \"stroke\", kind: \"strokes\" }], method: \"strokeTo\" });\n registry.addCommand(\"shadowTo\", paintCommand(\"shadowTo\", \"shadow\"), { args: [{ key: \"shadow\", kind: \"shadows\" }], method: \"shadowTo\" });\n\n // Transform, camera, text and `restore` commands are not registered here:\n // they are `command()` methods, and `Registry.addNode` publishes them off\n // the classes above. See `document/registry.ts`.\n\n // ── Variables ────────────────────────────────────────────────────────────\n // Tween a variable. The one command that drives many nodes at once: every\n // prop bound to `\"=[id]\"` follows what this writes, with no command of its\n // own and nothing to keep in sync.\n registry.addVariableCommand(\"variableTo\", (target, args, duration, easing) => {\n const to = (args as { value?: unknown }).value;\n const lerpKey = (args as { lerp?: unknown }).lerp;\n const override = typeof lerpKey === \"string\" ? registry.lerp(lerpKey) : undefined;\n if (lerpKey !== undefined && !override) {\n throw new Error(\n `A \"lerp\" param must name a registered lerp (variable \"${target.id}\"), ` +\n `got ${JSON.stringify(lerpKey)}. Registered: ${registry.lerpKeys().join(\", \")}.`,\n );\n }\n const lerp = override ?? target.lerp;\n\n // `from` is captured on the command's first evaluation rather than here,\n // exactly as a node's `to()` does: the timeline builds commands in order\n // and runs each to `at(1)`, so the capture sees the state its\n // predecessors left. Captured once, it is then a pure function of `t`.\n let from: unknown;\n let captured = false;\n return driveCommand(duration, (t) => {\n if (!captured) {\n from = target.get();\n captured = true;\n }\n target.set(lerp(from, to, t));\n }, easing) as unknown as Command<Record<string, unknown>>;\n });\n\n // A stamp, matching `set`: write the value with no tween, ignoring duration.\n registry.addVariableCommand(\"variableSet\", (target, args) =>\n driveCommand(0, () => {\n target.set((args as { value?: unknown }).value);\n }) as unknown as Command<Record<string, unknown>>);\n\n // ── State ────────────────────────────────────────────────────────────────\n // `restore` pops the layer a `save` pushed, and is published off `Node`'s own\n // `command()`. `save` is not one, so it is registered here — both are\n // commands so the pair is placed on the timeline like anything else, and a\n // seek past the save still produces the same frame: the value is computed\n // from the chain rather than accumulated as the playhead moves.\n registry.addCommand(\"save\", (target) =>\n driveCommand(0, () => {\n (target as Node2D).save();\n }) as unknown as Command<Record<string, unknown>>);\n}\n\n/** Type-only re-exports, so a caller writing args gets the same shapes. */\nexport type { Fill, Shadow, Stroke, Vector2 };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"command-traits.js","sourceRoot":"","sources":["../../src/document/command-traits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAwB,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAqBvC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC7C,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa;IAC5D,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa;CAC3D,CAAC;AAEF,MAAM,OAAO,GAAkB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AAEzH;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,QAAkB,EAAE,IAAiB,EAAE,MAA4B;IAC7F,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,MAAM,EAAE,KAAK,KAAK,UAAU,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAC7F,C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\nimport { expressionOps } from \"./expression/ops\";\r\nimport { Registry, type NodeConstructor } from \"./registry\";\r\nimport type { CommandSpec, NodeSpec } from \"./types\";\r\nimport { ROOT_NODE_ID } from \"./types\";\r\n\r\n/**\r\n * What a command can do to the tree around it, read off the document and the\r\n * registry without building anything.\r\n *\r\n * Only the library's own implementations are described: a command resolving to a\r\n * component's method could do anything, so it is `known: false` and assumed to\r\n * read and write layout.\r\n */\r\nexport interface CommandTraits {\r\n scope: \"node\" | \"variable\";\r\n /** Resolves to the library's own implementation, so the rules below hold for it. */\r\n known: boolean;\r\n lifecycle: boolean;\r\n /** Building it can read a laid-out box, so it must be built against a settled tree. */\r\n readsLayout: boolean;\r\n /** Running it can change what layout computes. */\r\n writesLayout: boolean;\r\n}\r\n\r\n/** The nine named alignment props, which position a node against its own laid-out box. */\r\nexport const ALIGNMENT_KEYS: readonly string[] = [\r\n \"center\", \"topLeft\", \"topRight\", \"bottomLeft\", \"bottomRight\",\r\n \"topCenter\", \"bottomCenter\", \"centerLeft\", \"centerRight\",\r\n];\r\n\r\nconst SKIPPED: CommandTraits = { scope: \"node\", known: true, lifecycle: false, readsLayout: false, writesLayout: false };\r\n\r\n/**\r\n * How a document command resolves, as `ClipTimeline._buildPlaced` resolves it,\r\n * and what it does — or `null` when it resolves to nothing (compiling it throws).\r\n * One the build skips — aimed at a placeholder, or unpublished by its target's\r\n * type — writes nothing, which is known.\r\n * `target` is the command's target row; for `targetId: null` a document with no\r\n * explicit root row may pass `undefined`.\r\n */\r\nexport function commandTraits(registry: Registry, spec: CommandSpec, target: NodeSpec | undefined): CommandTraits | null {\r\n const lifecycle = LIFECYCLE.has(spec.type);\r\n const global = registry.command(spec.type);\r\n if (global?.scope === \"variable\") {\r\n const known = VARIABLE_COMMANDS.has(spec.type);\r\n return { scope: \"variable\", known, lifecycle, readsLayout: !known, writesLayout: false };\r\n }\r\n\r\n const row = target ?? (spec.targetId === null ? DEFAULT_ROOT : undefined);\r\n const record = row ? registry.node(row.type) : undefined;\r\n if (!row) return null;\r\n if (!record) return registry.strict ? null : SKIPPED;\r\n\r\n let chain: readonly string[] | undefined;\r\n if (global) {\r\n chain = GLOBAL_NODE_COMMANDS[spec.type];\r\n if (chain && typeof methodOf(record.ctor, chain[0]) !== \"function\") return null;\r\n } else {\r\n const entry = record.commands.get(spec.type);\r\n if (!entry) return registry.strict ? null : SKIPPED;\r\n // A method published under a core command's key is not the core command.\r\n chain = entry.method === spec.type ? NODE_COMMANDS[spec.type] : undefined;\r\n }\r\n\r\n const known = !lifecycle && chain !== undefined && implementsCore(record.ctor, chain);\r\n if (!known) return { scope: \"node\", known, lifecycle, readsLayout: true, writesLayout: true };\r\n\r\n const args = spec.args ?? {};\r\n const props = row.props ?? {};\r\n const written = writtenKeys(spec.type, args);\r\n return {\r\n scope: \"node\",\r\n known,\r\n lifecycle,\r\n readsLayout: readsLayout(spec.type, args, props, written),\r\n writesLayout: written === undefined || written.some((key) => !isLayoutNeutralProp(registry, row.type, key)),\r\n };\r\n}\r\n\r\n/**\r\n * The node ids a command's args name through a `nodeRef` argument — the nodes\r\n * whose boxes it may read when it is built, beside its own target.\r\n */\r\nexport function commandNodeRefs(registry: Registry, spec: CommandSpec, target: NodeSpec | undefined): string[] {\r\n const global = registry.command(spec.type);\r\n const row = target ?? (spec.targetId === null ? DEFAULT_ROOT : undefined);\r\n const descriptors = global\r\n ? (global.scope === \"node\" ? global.args : undefined)\r\n : row ? registry.node(row.type)?.commands.get(spec.type)?.args : undefined;\r\n const refs: string[] = [];\r\n for (const descriptor of descriptors ?? []) {\r\n const value = spec.args?.[descriptor.key];\r\n if (descriptor.kind === \"nodeRef\" && typeof value === \"string\" && value !== \"\") refs.push(value);\r\n }\r\n return refs;\r\n}\r\n\r\n/** Whether `type` hands its descendants a context of its own. */\r\nexport function isContextProvider(registry: Registry, type: string): boolean {\r\n const ctor = registry.node(type)?.ctor;\r\n return ctor !== undefined && methodOf(ctor, \"provideContext\") !== methodOf(Node, \"provideContext\");\r\n}\r\n\r\n/**\r\n * Whether an authored value holds an expression reading another node's prop\r\n * (`[card.x]`), at any depth. An unparsable one counts: it fails the build anyway.\r\n */\r\nexport function hasNodeRef(value: unknown): boolean {\r\n for (const site of expressionOps.collect(value, \"\")) {\r\n const parsed = expressionOps.tryParse(site.source);\r\n if (\"error\" in parsed || parsed.expression.refs.some((ref) => ref.includes(\".\"))) return true;\r\n }\r\n return false;\r\n}\r\n\r\n/**\r\n * Whether writing `key` on a node of `type` leaves every laid-out box unchanged.\r\n *\r\n * Every node's placement is applied after layout; past that, answered only for\r\n * the library's own classes, since a custom node may lay itself out from anything.\r\n */\r\nexport function isLayoutNeutralProp(registry: Registry, type: string, key: string): boolean {\r\n const record = registry.node(type);\r\n if (!record) return false;\r\n // Sound has no box, and the 2D walk skips an audio child.\r\n if (record.descriptor.dimension === \"audio\") return true;\r\n if (isPlacementProp(registry, type, key)) return true;\r\n return coreLibrary().ctors.has(record.ctor) && NEUTRAL_KEYS.has(key);\r\n}\r\n\r\n/** Whether `key` is placement every node of `type` holds as a plain slot, read only once a frame is drawn. */\r\nexport function isPlacementProp(registry: Registry, type: string, key: string): boolean {\r\n const dimension = registry.node(type)?.descriptor.dimension;\r\n return dimension === \"3d\" ? PLACEMENT_3D.has(key) : dimension === \"2d\" && PLACEMENT_2D.has(key);\r\n}\r\n\r\n/**\r\n * Whether a new `key` on `row` can be written onto its live node as a fresh\r\n * build would set it: placement, on a row with no prop its node turns into\r\n * placement when built (`topLeft` binds `x` and `y`).\r\n */\r\nexport function writesPlacementInPlace(registry: Registry, row: NodeSpec, key: string): boolean {\r\n const dimension = registry.node(row.type)?.descriptor.dimension;\r\n const sugar = dimension === \"3d\" ? PLACEMENT_SUGAR_3D : PLACEMENT_SUGAR_2D;\r\n return isPlacementProp(registry, row.type, key) && !Object.keys(row.props).some((prop) => sugar.has(prop));\r\n}\r\n\r\nconst LIFECYCLE = new Set([\"removeChildAt\", \"addChildAt\", \"reparent\"]);\r\n\r\nconst VARIABLE_COMMANDS = new Set([\"variableTo\", \"variableSet\"]);\r\n\r\nconst NEUTRAL_KEYS = new Set([\r\n \"x\", \"y\", \"rotation\", \"scale\", \"opacity\", \"fill\", \"stroke\", \"shadow\", \"overlay\",\r\n \"effects\", \"blend\", \"transformOrigin\", \"zoom\", \"lookAt\", \"heading\",\r\n]);\r\n\r\nconst PLACEMENT_2D = new Set([\"x\", \"y\", \"rotation\", \"scale\", \"opacity\"]);\r\n\r\nconst PLACEMENT_3D = new Set([\"x\", \"y\", \"z\", \"rotationX\", \"rotationY\", \"rotationZ\", \"scaleX\", \"scaleY\", \"scaleZ\"]);\r\n\r\nconst PLACEMENT_SUGAR_2D = new Set([\r\n \"center\", \"topLeft\", \"topRight\", \"bottomLeft\", \"bottomRight\", \"topCenter\", \"bottomCenter\", \"centerLeft\", \"centerRight\",\r\n]);\r\n\r\nconst PLACEMENT_SUGAR_3D = new Set([\"position\", \"rotation\", \"scale\"]);\r\n\r\nconst DEFAULT_ROOT: NodeSpec = { id: ROOT_NODE_ID, type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\r\n\r\n// Each command's behaviour, as the methods on its target it runs through. A class\r\n// overriding any of them is running something else under the command's name.\r\nconst TO = [\"to\", \"_prepareStep\", \"_writeProp\"];\r\nconst PAINT = [\"command\", \"set\", \"_writeProp\"];\r\n\r\nconst GLOBAL_NODE_COMMANDS: Readonly<Record<string, readonly string[]>> = {\r\n to: TO,\r\n set: [\"set\", \"_writeProp\"],\r\n save: [\"save\"],\r\n fillTo: [\"fillTo\", ...PAINT],\r\n overlayTo: [\"overlayTo\", ...PAINT],\r\n strokeTo: [\"strokeTo\", ...PAINT],\r\n shadowTo: [\"shadowTo\", ...PAINT],\r\n};\r\n\r\nconst NODE_COMMANDS: Readonly<Record<string, readonly string[]>> = {\r\n ...GLOBAL_NODE_COMMANDS,\r\n restore: [\"restore\", \"_prepareStep\", \"_writeProp\"],\r\n fadeTo: [\"fadeTo\", ...TO],\r\n rotateTo: [\"rotateTo\", ...TO],\r\n scaleTo: [\"scaleTo\", ...TO],\r\n layoutTo: [\"layoutTo\", ...TO],\r\n effectTo: [\"effectTo\", ...TO],\r\n progressTo: [\"progressTo\", ...TO],\r\n pulse: [\"pulse\", ...PAINT],\r\n wiggle: [\"wiggle\", ...PAINT],\r\n flash: [\"flash\", ...PAINT],\r\n moveTo: [\"moveTo\", ...TO, \"command\", \"set\"],\r\n zoomTo: [\"zoomTo\", ...TO],\r\n panTo: [\"panTo\", ...TO],\r\n headingTo: [\"headingTo\", ...TO],\r\n countTo: [\"countTo\", ...TO],\r\n append: [\"append\", ...TO],\r\n prepend: [\"prepend\", ...TO],\r\n // Plays its node's sound: scheduled ahead of time, writing nothing.\r\n play: [\"play\"],\r\n};\r\n\r\n/** Named commands' writes. `to`/`set` write their args; absent means \"anything\". */\r\nconst WRITES: Readonly<Record<string, readonly string[]>> = {\r\n fadeTo: [\"opacity\"],\r\n rotateTo: [\"rotation\"],\r\n scaleTo: [\"scale\"],\r\n layoutTo: [\"width\", \"height\", \"padding\"],\r\n effectTo: [\"effects\"],\r\n progressTo: [\"start\", \"end\"],\r\n pulse: [\"scale\"],\r\n wiggle: [\"rotation\"],\r\n flash: [\"start\", \"end\"],\r\n moveTo: [\"x\", \"y\"],\r\n zoomTo: [\"zoom\"],\r\n panTo: [\"lookAt\"],\r\n headingTo: [\"heading\"],\r\n fillTo: [\"fill\"],\r\n overlayTo: [\"overlay\"],\r\n strokeTo: [\"stroke\"],\r\n shadowTo: [\"shadow\"],\r\n play: [],\r\n};\r\n\r\n/** What a known command reads `from` — every command but the stamps. */\r\nconst READS_FROM = new Set(Object.keys(NODE_COMMANDS).filter((type) => type !== \"set\" && type !== \"save\"));\r\n\r\nfunction readsLayout(\r\n type: string,\r\n args: Record<string, unknown>,\r\n props: Record<string, unknown>,\r\n written: readonly string[] | undefined,\r\n): boolean {\r\n // Resolved against the node's own box the moment the step is prepared.\r\n if (hasAlignmentKey(args)) return true;\r\n // Aimed at another node's box.\r\n if (type === \"moveTo\" && typeof args.target === \"string\" && args.target !== \"\") return true;\r\n // An alignment-authored node's x/y are bindings over its box, and a node-ref\r\n // expression may read another node's (`[card.x]` on an aligned card); taking a\r\n // `from`, or a snapshot, evaluates them.\r\n const aligned = hasAlignmentKey(props);\r\n const refBound = nodeRefKeys(props);\r\n if (type === \"save\" || type === \"restore\") return aligned || refBound.size > 0;\r\n if (!READS_FROM.has(type)) return false;\r\n const touched = type === \"append\" || type === \"prepend\" ? [\"text\"] : type === \"countTo\" ? [\"value\"] : written ?? [];\r\n return touched.some((key) => refBound.has(key) || (aligned && (key === \"x\" || key === \"y\")));\r\n}\r\n\r\nfunction writtenKeys(type: string, args: Record<string, unknown>): readonly string[] | undefined {\r\n const named = WRITES[type];\r\n if (named) return named;\r\n if (type !== \"to\" && type !== \"set\") return undefined;\r\n const keys: string[] = [];\r\n for (const key of Object.keys(args)) {\r\n if (key === \"size\") keys.push(\"width\", \"height\");\r\n else if (type === \"to\" && key === \"pivot\") keys.push(\"transformOrigin\");\r\n else if (type === \"to\" && ALIGNMENT_KEYS.includes(key)) keys.push(\"x\", \"y\", \"transformOrigin\");\r\n else keys.push(key);\r\n }\r\n return keys;\r\n}\r\n\r\nfunction hasAlignmentKey(values: Record<string, unknown>): boolean {\r\n return ALIGNMENT_KEYS.some((key) => values[key] !== undefined);\r\n}\r\n\r\nconst REF_KEYS = new WeakMap<object, ReadonlySet<string>>();\r\n\r\n/** The top-level props of a row whose authored value reads another node. */\r\nfunction nodeRefKeys(props: Record<string, unknown>): ReadonlySet<string> {\r\n let keys = REF_KEYS.get(props);\r\n if (!keys) {\r\n const found = new Set<string>();\r\n for (const key of Object.keys(props)) {\r\n if (hasNodeRef(props[key])) found.add(key);\r\n }\r\n REF_KEYS.set(props, (keys = found));\r\n }\r\n return keys;\r\n}\r\n\r\nfunction methodOf(ctor: abstract new (...args: never[]) => unknown, name: string): unknown {\r\n return (ctor.prototype as Record<string, unknown>)[name];\r\n}\r\n\r\nconst KNOWN = new WeakMap<object, Map<readonly string[], boolean>>();\r\n\r\nfunction implementsCore(ctor: NodeConstructor, chain: readonly string[]): boolean {\r\n let byChain = KNOWN.get(ctor);\r\n if (!byChain) KNOWN.set(ctor, (byChain = new Map()));\r\n let known = byChain.get(chain);\r\n if (known === undefined) {\r\n // A method the class lacks entirely is not an override of one.\r\n known = chain.every((name) => {\r\n const impl = methodOf(ctor, name);\r\n return impl === undefined || coreImplementations(name).has(impl);\r\n });\r\n byChain.set(chain, known);\r\n }\r\n return known;\r\n}\r\n\r\ninterface CoreLibrary {\r\n ctors: ReadonlySet<NodeConstructor>;\r\n methods: Map<string, ReadonlySet<unknown>>;\r\n}\r\n\r\nlet core: CoreLibrary | null = null;\r\n\r\nfunction coreLibrary(): CoreLibrary {\r\n if (!core) {\r\n // A registry seeds itself with exactly what the library ships, so a fresh one is that list.\r\n const seeded = new Registry();\r\n core = { ctors: new Set(seeded.nodeKeys().map((key) => seeded.node(key)!.ctor)), methods: new Map() };\r\n }\r\n return core;\r\n}\r\n\r\n/** Every body the library's classes give `name`, base classes included. */\r\nfunction coreImplementations(name: string): ReadonlySet<unknown> {\r\n const library = coreLibrary();\r\n let impls = library.methods.get(name);\r\n if (!impls) {\r\n const found = new Set<unknown>();\r\n for (const ctor of library.ctors) {\r\n for (let proto = ctor.prototype; proto && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) {\r\n const own = Object.getOwnPropertyDescriptor(proto, name);\r\n if (own && typeof own.value === \"function\") found.add(own.value);\r\n }\r\n }\r\n library.methods.set(name, (impls = found));\r\n }\r\n return impls;\r\n}\r\n"]}
1
+ {"version":3,"file":"command-traits.js","sourceRoot":"","sources":["../../src/document/command-traits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAwB,MAAM,YAAY,CAAC;AAE5D,OA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AAChB,CAAC;AAED,2EAA2E;AAC3E,SAAS,mBAAmB,CAAC,IAAY;IACrC,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,MAAM,KAAK,GAAG,IAAI,GAAG,EAAW,CAAC;QACjC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAC/B,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,IAAI,KAAK,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzG,MAAM,GAAG,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBACzD,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU;oBAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrE,CAAC;QACL,CAAC;QACD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { Node } from \"@/components/trees/node/node\";\nimport { expressionOps } from \"./expression/ops\";\nimport { Registry, type NodeConstructor } from \"./registry\";\nimport type { CommandSpec, NodeSpec } from \"./types\";\nimport { ROOT_NODE_ID } from \"./types\";\n\n/**\n * What a command can do to the tree around it, read off the document and the\n * registry without building anything.\n *\n * Only the library's own implementations are described: a command resolving to a\n * component's method could do anything, so it is `known: false` and assumed to\n * read and write layout.\n */\nexport interface CommandTraits {\n scope: \"node\" | \"variable\";\n /** Resolves to the library's own implementation, so the rules below hold for it. */\n known: boolean;\n lifecycle: boolean;\n /** Building it can read a laid-out box, so it must be built against a settled tree. */\n readsLayout: boolean;\n /** Running it can change what layout computes. */\n writesLayout: boolean;\n}\n\n/** The nine named alignment props, which position a node against its own laid-out box. */\nexport const ALIGNMENT_KEYS: readonly string[] = [\n \"center\", \"topLeft\", \"topRight\", \"bottomLeft\", \"bottomRight\",\n \"topCenter\", \"bottomCenter\", \"centerLeft\", \"centerRight\",\n];\n\nconst SKIPPED: CommandTraits = { scope: \"node\", known: true, lifecycle: false, readsLayout: false, writesLayout: false };\n\n/**\n * How a document command resolves, as `ClipTimeline._buildPlaced` resolves it,\n * and what it does — or `null` when it resolves to nothing (compiling it throws).\n * One the build skips — aimed at a placeholder, or unpublished by its target's\n * type — writes nothing, which is known.\n * `target` is the command's target row; for `targetId: null` a document with no\n * explicit root row may pass `undefined`.\n */\nexport function commandTraits(registry: Registry, spec: CommandSpec, target: NodeSpec | undefined): CommandTraits | null {\n const lifecycle = LIFECYCLE.has(spec.type);\n const global = registry.command(spec.type);\n if (global?.scope === \"variable\") {\n const known = VARIABLE_COMMANDS.has(spec.type);\n return { scope: \"variable\", known, lifecycle, readsLayout: !known, writesLayout: false };\n }\n\n const row = target ?? (spec.targetId === null ? DEFAULT_ROOT : undefined);\n const record = row ? registry.node(row.type) : undefined;\n if (!row) return null;\n if (!record) return registry.strict ? null : SKIPPED;\n\n let chain: readonly string[] | undefined;\n if (global) {\n chain = GLOBAL_NODE_COMMANDS[spec.type];\n if (chain && typeof methodOf(record.ctor, chain[0]) !== \"function\") return null;\n } else {\n const entry = record.commands.get(spec.type);\n if (!entry) return registry.strict ? null : SKIPPED;\n // A method published under a core command's key is not the core command.\n chain = entry.method === spec.type ? NODE_COMMANDS[spec.type] : undefined;\n }\n\n const known = !lifecycle && chain !== undefined && implementsCore(record.ctor, chain);\n if (!known) return { scope: \"node\", known, lifecycle, readsLayout: true, writesLayout: true };\n\n const args = spec.args ?? {};\n const props = row.props ?? {};\n const written = writtenKeys(spec.type, args);\n return {\n scope: \"node\",\n known,\n lifecycle,\n readsLayout: readsLayout(spec.type, args, props, written),\n writesLayout: written === undefined || written.some((key) => !isLayoutNeutralProp(registry, row.type, key)),\n };\n}\n\n/**\n * The node ids a command's args name through a `nodeRef` argument — the nodes\n * whose boxes it may read when it is built, beside its own target.\n */\nexport function commandNodeRefs(registry: Registry, spec: CommandSpec, target: NodeSpec | undefined): string[] {\n const global = registry.command(spec.type);\n const row = target ?? (spec.targetId === null ? DEFAULT_ROOT : undefined);\n const descriptors = global\n ? (global.scope === \"node\" ? global.args : undefined)\n : row ? registry.node(row.type)?.commands.get(spec.type)?.args : undefined;\n const refs: string[] = [];\n for (const descriptor of descriptors ?? []) {\n const value = spec.args?.[descriptor.key];\n if (descriptor.kind === \"nodeRef\" && typeof value === \"string\" && value !== \"\") refs.push(value);\n }\n return refs;\n}\n\n/** Whether `type` hands its descendants a context of its own. */\nexport function isContextProvider(registry: Registry, type: string): boolean {\n const ctor = registry.node(type)?.ctor;\n return ctor !== undefined && methodOf(ctor, \"provideContext\") !== methodOf(Node, \"provideContext\");\n}\n\n/**\n * Whether an authored value holds an expression reading another node's prop\n * (`[card.x]`), at any depth. An unparsable one counts: it fails the build anyway.\n */\nexport function hasNodeRef(value: unknown): boolean {\n for (const site of expressionOps.collect(value, \"\")) {\n const parsed = expressionOps.tryParse(site.source);\n if (\"error\" in parsed || parsed.expression.refs.some((ref) => ref.includes(\".\"))) return true;\n }\n return false;\n}\n\n/**\n * Whether writing `key` on a node of `type` leaves every laid-out box unchanged.\n *\n * Every node's placement is applied after layout; past that, answered only for\n * the library's own classes, since a custom node may lay itself out from anything.\n */\nexport function isLayoutNeutralProp(registry: Registry, type: string, key: string): boolean {\n const record = registry.node(type);\n if (!record) return false;\n // Sound has no box, and the 2D walk skips an audio child.\n if (record.descriptor.dimension === \"audio\") return true;\n if (isPlacementProp(registry, type, key)) return true;\n return coreLibrary().ctors.has(record.ctor) && NEUTRAL_KEYS.has(key);\n}\n\n/** Whether `key` is placement every node of `type` holds as a plain slot, read only once a frame is drawn. */\nexport function isPlacementProp(registry: Registry, type: string, key: string): boolean {\n const dimension = registry.node(type)?.descriptor.dimension;\n return dimension === \"3d\" ? PLACEMENT_3D.has(key) : dimension === \"2d\" && PLACEMENT_2D.has(key);\n}\n\n/**\n * Whether a new `key` on `row` can be written onto its live node as a fresh\n * build would set it: placement, on a row with no prop its node turns into\n * placement when built (`topLeft` binds `x` and `y`).\n */\nexport function writesPlacementInPlace(registry: Registry, row: NodeSpec, key: string): boolean {\n const dimension = registry.node(row.type)?.descriptor.dimension;\n const sugar = dimension === \"3d\" ? PLACEMENT_SUGAR_3D : PLACEMENT_SUGAR_2D;\n return isPlacementProp(registry, row.type, key) && !Object.keys(row.props).some((prop) => sugar.has(prop));\n}\n\nconst LIFECYCLE = new Set([\"removeChildAt\", \"addChildAt\", \"reparent\"]);\n\nconst VARIABLE_COMMANDS = new Set([\"variableTo\", \"variableSet\"]);\n\nconst NEUTRAL_KEYS = new Set([\n \"x\", \"y\", \"rotation\", \"scale\", \"opacity\", \"fill\", \"stroke\", \"shadow\", \"overlay\",\n \"effects\", \"blend\", \"transformOrigin\", \"zoom\", \"lookAt\", \"heading\",\n]);\n\nconst PLACEMENT_2D = new Set([\"x\", \"y\", \"rotation\", \"scale\", \"opacity\"]);\n\nconst PLACEMENT_3D = new Set([\"x\", \"y\", \"z\", \"rotationX\", \"rotationY\", \"rotationZ\", \"scaleX\", \"scaleY\", \"scaleZ\"]);\n\nconst PLACEMENT_SUGAR_2D = new Set([\n \"center\", \"topLeft\", \"topRight\", \"bottomLeft\", \"bottomRight\", \"topCenter\", \"bottomCenter\", \"centerLeft\", \"centerRight\",\n]);\n\nconst PLACEMENT_SUGAR_3D = new Set([\"position\", \"rotation\", \"scale\"]);\n\nconst DEFAULT_ROOT: NodeSpec = { id: ROOT_NODE_ID, type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\n\n// Each command's behaviour, as the methods on its target it runs through. A class\n// overriding any of them is running something else under the command's name.\nconst TO = [\"to\", \"_prepareStep\", \"_writeProp\"];\nconst PAINT = [\"command\", \"set\", \"_writeProp\"];\n\nconst GLOBAL_NODE_COMMANDS: Readonly<Record<string, readonly string[]>> = {\n to: TO,\n set: [\"set\", \"_writeProp\"],\n save: [\"save\"],\n fillTo: [\"fillTo\", ...PAINT],\n overlayTo: [\"overlayTo\", ...PAINT],\n strokeTo: [\"strokeTo\", ...PAINT],\n shadowTo: [\"shadowTo\", ...PAINT],\n};\n\nconst NODE_COMMANDS: Readonly<Record<string, readonly string[]>> = {\n ...GLOBAL_NODE_COMMANDS,\n restore: [\"restore\", \"_prepareStep\", \"_writeProp\"],\n fadeTo: [\"fadeTo\", ...TO],\n rotateTo: [\"rotateTo\", ...TO],\n scaleTo: [\"scaleTo\", ...TO],\n layoutTo: [\"layoutTo\", ...TO],\n effectTo: [\"effectTo\", ...TO],\n progressTo: [\"progressTo\", ...TO],\n pulse: [\"pulse\", ...PAINT],\n wiggle: [\"wiggle\", ...PAINT],\n flash: [\"flash\", ...PAINT],\n moveTo: [\"moveTo\", ...TO, \"command\", \"set\"],\n zoomTo: [\"zoomTo\", ...TO],\n panTo: [\"panTo\", ...TO],\n headingTo: [\"headingTo\", ...TO],\n countTo: [\"countTo\", ...TO],\n append: [\"append\", ...TO],\n prepend: [\"prepend\", ...TO],\n // Plays its node's sound: scheduled ahead of time, writing nothing.\n play: [\"play\"],\n};\n\n/** Named commands' writes. `to`/`set` write their args; absent means \"anything\". */\nconst WRITES: Readonly<Record<string, readonly string[]>> = {\n fadeTo: [\"opacity\"],\n rotateTo: [\"rotation\"],\n scaleTo: [\"scale\"],\n layoutTo: [\"width\", \"height\", \"padding\"],\n effectTo: [\"effects\"],\n progressTo: [\"start\", \"end\"],\n pulse: [\"scale\"],\n wiggle: [\"rotation\"],\n flash: [\"start\", \"end\"],\n moveTo: [\"x\", \"y\"],\n zoomTo: [\"zoom\"],\n panTo: [\"lookAt\"],\n headingTo: [\"heading\"],\n fillTo: [\"fill\"],\n overlayTo: [\"overlay\"],\n strokeTo: [\"stroke\"],\n shadowTo: [\"shadow\"],\n play: [],\n};\n\n/** What a known command reads `from` — every command but the stamps. */\nconst READS_FROM = new Set(Object.keys(NODE_COMMANDS).filter((type) => type !== \"set\" && type !== \"save\"));\n\nfunction readsLayout(\n type: string,\n args: Record<string, unknown>,\n props: Record<string, unknown>,\n written: readonly string[] | undefined,\n): boolean {\n // Resolved against the node's own box the moment the step is prepared.\n if (hasAlignmentKey(args)) return true;\n // Aimed at another node's box.\n if (type === \"moveTo\" && typeof args.target === \"string\" && args.target !== \"\") return true;\n // An alignment-authored node's x/y are bindings over its box, and a node-ref\n // expression may read another node's (`[card.x]` on an aligned card); taking a\n // `from`, or a snapshot, evaluates them.\n const aligned = hasAlignmentKey(props);\n const refBound = nodeRefKeys(props);\n if (type === \"save\" || type === \"restore\") return aligned || refBound.size > 0;\n if (!READS_FROM.has(type)) return false;\n const touched = type === \"append\" || type === \"prepend\" ? [\"text\"] : type === \"countTo\" ? [\"value\"] : written ?? [];\n return touched.some((key) => refBound.has(key) || (aligned && (key === \"x\" || key === \"y\")));\n}\n\nfunction writtenKeys(type: string, args: Record<string, unknown>): readonly string[] | undefined {\n const named = WRITES[type];\n if (named) return named;\n if (type !== \"to\" && type !== \"set\") return undefined;\n const keys: string[] = [];\n for (const key of Object.keys(args)) {\n if (key === \"size\") keys.push(\"width\", \"height\");\n else if (type === \"to\" && key === \"pivot\") keys.push(\"transformOrigin\");\n else if (type === \"to\" && ALIGNMENT_KEYS.includes(key)) keys.push(\"x\", \"y\", \"transformOrigin\");\n else keys.push(key);\n }\n return keys;\n}\n\nfunction hasAlignmentKey(values: Record<string, unknown>): boolean {\n return ALIGNMENT_KEYS.some((key) => values[key] !== undefined);\n}\n\nconst REF_KEYS = new WeakMap<object, ReadonlySet<string>>();\n\n/** The top-level props of a row whose authored value reads another node. */\nfunction nodeRefKeys(props: Record<string, unknown>): ReadonlySet<string> {\n let keys = REF_KEYS.get(props);\n if (!keys) {\n const found = new Set<string>();\n for (const key of Object.keys(props)) {\n if (hasNodeRef(props[key])) found.add(key);\n }\n REF_KEYS.set(props, (keys = found));\n }\n return keys;\n}\n\nfunction methodOf(ctor: abstract new (...args: never[]) => unknown, name: string): unknown {\n return (ctor.prototype as Record<string, unknown>)[name];\n}\n\nconst KNOWN = new WeakMap<object, Map<readonly string[], boolean>>();\n\nfunction implementsCore(ctor: NodeConstructor, chain: readonly string[]): boolean {\n let byChain = KNOWN.get(ctor);\n if (!byChain) KNOWN.set(ctor, (byChain = new Map()));\n let known = byChain.get(chain);\n if (known === undefined) {\n // A method the class lacks entirely is not an override of one.\n known = chain.every((name) => {\n const impl = methodOf(ctor, name);\n return impl === undefined || coreImplementations(name).has(impl);\n });\n byChain.set(chain, known);\n }\n return known;\n}\n\ninterface CoreLibrary {\n ctors: ReadonlySet<NodeConstructor>;\n methods: Map<string, ReadonlySet<unknown>>;\n}\n\nlet core: CoreLibrary | null = null;\n\nfunction coreLibrary(): CoreLibrary {\n if (!core) {\n // A registry seeds itself with exactly what the library ships, so a fresh one is that list.\n const seeded = new Registry();\n core = { ctors: new Set(seeded.nodeKeys().map((key) => seeded.node(key)!.ctor)), methods: new Map() };\n }\n return core;\n}\n\n/** Every body the library's classes give `name`, base classes included. */\nfunction coreImplementations(name: string): ReadonlySet<unknown> {\n const library = coreLibrary();\n let impls = library.methods.get(name);\n if (!impls) {\n const found = new Set<unknown>();\n for (const ctor of library.ctors) {\n for (let proto = ctor.prototype; proto && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) {\n const own = Object.getOwnPropertyDescriptor(proto, name);\n if (own && typeof own.value === \"function\") found.add(own.value);\n }\n }\n library.methods.set(name, (impls = found));\n }\n return impls;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deny-globals.js","sourceRoot":"","sources":["../../src/document/deny-globals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC7C,2DAA2D;IAC3D,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IAER,wBAAwB;IACxB,EAAE;IACF,2EAA2E;IAC3E,kEAAkE;IAClE,yEAAyE;IACzE,2EAA2E;IAC3E,yDAAyD;IACzD,UAAU;IACV,eAAe;IAEf,oDAAoD;IACpD,UAAU;IACV,WAAW;IACX,UAAU;IACV,SAAS;IACT,QAAQ;IACR,gBAAgB;IAEhB,iEAAiE;IACjE,+CAA+C;IAC/C,OAAO;IACP,gBAAgB;IAChB,WAAW;IACX,aAAa;IACb,SAAS;IACT,UAAU;IACV,SAAS;IAET,sCAAsC;IACtC,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,QAAQ;IACR,aAAa;IACb,QAAQ;IAER,qCAAqC;IACrC,QAAQ;IACR,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,kBAAkB;IAClB,aAAa;IAEb,6DAA6D;IAC7D,OAAO;IACP,SAAS;IACT,QAAQ;IACR,MAAM;IACN,OAAO;IACP,cAAc;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAElD,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACrB,MAAM,IAAI,KAAK,CACX,iCAAiC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB;QACvE,uFAAuF,CAC9F,CAAC;AACN,CAAC","sourcesContent":["/**\r\n * The ambient capabilities a dynamic node's compiled source is denied.\r\n *\r\n * ## What this is, and what it very deliberately is not\r\n *\r\n * A dynamic node's compiled JS is evaluated with `new Function` **in the\r\n * host's own realm**, and that is forced by the architecture rather than\r\n * chosen: the node it produces has to be a live class that satisfies\r\n * `instanceof` against the host's own already-loaded `core`, and participate\r\n * in the same per-frame reactive `property` graph. A live class instance\r\n * cannot cross a worker or cross-origin iframe boundary, so the usual \"run it\r\n * in another realm\" answer is closed off by what the renderer is, not by how\r\n * much effort is spent on it.\r\n *\r\n * What *is* possible in one realm is taking the dangerous names out of scope.\r\n * Every identifier below becomes a parameter of the `new Function` factory\r\n * bound to `undefined`, so `fetch(...)` inside a compiled node is a call on\r\n * `undefined` rather than a network request. Under `\"use strict\"` — which the\r\n * factory already sets — a bare `this` is `undefined` too, so the usual back\r\n * door is shut.\r\n *\r\n * **This is hardening, not a sandbox.** A determined script can still reach\r\n * the real global object through the intrinsics: `({}).constructor.constructor`\r\n * is `Function`, and `Function(\"return globalThis\")()` walks straight back\r\n * out. Closing that would mean freezing or poisoning `Object.prototype`,\r\n * `Function` and every async/generator constructor, which breaks the engine\r\n * itself — it subclasses, it writes prototypes, it builds objects constantly.\r\n * So the honest security boundary is not this file. It is whatever gate the\r\n * *host* puts in front of calling `Registry.addNodeFromSource` at all — a\r\n * compiled node's source is not evaluated until something upstream decides\r\n * it should be.\r\n *\r\n * This file's job is to make the easy paths closed, the accidents impossible,\r\n * and the escape require obvious intent that a reviewer would notice.\r\n */\r\n\r\n/**\r\n * Names bound to `undefined` in every dynamic node module's scope.\r\n *\r\n * Grouped by what they'd be used for, because the list is only auditable if\r\n * you can see what each entry is keeping out. Adding a browser API here is\r\n * cheap; leaving one out is the bug.\r\n *\r\n * This engine's `Registry` only ever evaluates a dynamic node inside a\r\n * browser-realm page (a real browser tab, or headless's own Playwright page —\r\n * never bare Node), so this list is scoped to that one realm rather than also\r\n * covering Node globals (`process`, `require`, `global`) that never apply\r\n * here.\r\n */\r\nexport const DENIED_GLOBALS: readonly string[] = [\r\n // Reaching the global object, and from it everything else.\r\n \"globalThis\",\r\n \"window\",\r\n \"self\",\r\n \"top\",\r\n \"parent\",\r\n \"frames\",\r\n\r\n // Evaluating more code.\r\n //\r\n // `eval` is missing on purpose and cannot be added: strict mode forbids it\r\n // as a binding name, so naming it here makes `new Function` throw\r\n // \"Unexpected eval or arguments in strict mode\" and *every* dynamic node\r\n // stops linking. It stays reachable, which is one more reason this file is\r\n // not the security boundary — see the module note above.\r\n \"Function\",\r\n \"importScripts\",\r\n\r\n // The DOM: reading the page, and `document.cookie`.\r\n \"document\",\r\n \"navigator\",\r\n \"location\",\r\n \"history\",\r\n \"screen\",\r\n \"customElements\",\r\n\r\n // Anywhere to send what was found. (`navigator.sendBeacon` needs\r\n // `navigator`, which is already denied above.)\r\n \"fetch\",\r\n \"XMLHttpRequest\",\r\n \"WebSocket\",\r\n \"EventSource\",\r\n \"Request\",\r\n \"Response\",\r\n \"Headers\",\r\n\r\n // Anywhere to read a credential from.\r\n \"localStorage\",\r\n \"sessionStorage\",\r\n \"indexedDB\",\r\n \"caches\",\r\n \"cookieStore\",\r\n \"crypto\",\r\n\r\n // Other threads and other documents.\r\n \"Worker\",\r\n \"SharedWorker\",\r\n \"ServiceWorker\",\r\n \"MessageChannel\",\r\n \"BroadcastChannel\",\r\n \"postMessage\",\r\n\r\n // Things that ask the user for something, or leave the page.\r\n \"alert\",\r\n \"confirm\",\r\n \"prompt\",\r\n \"open\",\r\n \"print\",\r\n \"Notification\",\r\n];\r\n\r\n/**\r\n * Names strict mode refuses to bind, and which would therefore break linking\r\n * for every dynamic node rather than protecting anything.\r\n *\r\n * Checked rather than trusted: adding one to the list above is an easy\r\n * mistake that fails at *evaluation* time, on whichever node happens to\r\n * compile first, with an error naming neither the list nor the culprit.\r\n */\r\nconst UNBINDABLE = new Set([\"eval\", \"arguments\"]);\r\n\r\nconst illegal = DENIED_GLOBALS.filter((name) => UNBINDABLE.has(name));\r\nif (illegal.length > 0) {\r\n throw new Error(\r\n `DENIED_GLOBALS cannot contain ${illegal.join(\", \")}: strict mode forbids ` +\r\n `binding those names, so no dynamic node would link at all. See the note in this file.`,\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"deny-globals.js","sourceRoot":"","sources":["../../src/document/deny-globals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC7C,2DAA2D;IAC3D,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IAER,wBAAwB;IACxB,EAAE;IACF,2EAA2E;IAC3E,kEAAkE;IAClE,yEAAyE;IACzE,2EAA2E;IAC3E,yDAAyD;IACzD,UAAU;IACV,eAAe;IAEf,oDAAoD;IACpD,UAAU;IACV,WAAW;IACX,UAAU;IACV,SAAS;IACT,QAAQ;IACR,gBAAgB;IAEhB,iEAAiE;IACjE,+CAA+C;IAC/C,OAAO;IACP,gBAAgB;IAChB,WAAW;IACX,aAAa;IACb,SAAS;IACT,UAAU;IACV,SAAS;IAET,sCAAsC;IACtC,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,QAAQ;IACR,aAAa;IACb,QAAQ;IAER,qCAAqC;IACrC,QAAQ;IACR,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,kBAAkB;IAClB,aAAa;IAEb,6DAA6D;IAC7D,OAAO;IACP,SAAS;IACT,QAAQ;IACR,MAAM;IACN,OAAO;IACP,cAAc;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAElD,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACrB,MAAM,IAAI,KAAK,CACX,iCAAiC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB;QACvE,uFAAuF,CAC9F,CAAC;AACN,CAAC","sourcesContent":["/**\n * The ambient capabilities a dynamic node's compiled source is denied.\n *\n * ## What this is, and what it very deliberately is not\n *\n * A dynamic node's compiled JS is evaluated with `new Function` **in the\n * host's own realm**, and that is forced by the architecture rather than\n * chosen: the node it produces has to be a live class that satisfies\n * `instanceof` against the host's own already-loaded `core`, and participate\n * in the same per-frame reactive `property` graph. A live class instance\n * cannot cross a worker or cross-origin iframe boundary, so the usual \"run it\n * in another realm\" answer is closed off by what the renderer is, not by how\n * much effort is spent on it.\n *\n * What *is* possible in one realm is taking the dangerous names out of scope.\n * Every identifier below becomes a parameter of the `new Function` factory\n * bound to `undefined`, so `fetch(...)` inside a compiled node is a call on\n * `undefined` rather than a network request. Under `\"use strict\"` — which the\n * factory already sets — a bare `this` is `undefined` too, so the usual back\n * door is shut.\n *\n * **This is hardening, not a sandbox.** A determined script can still reach\n * the real global object through the intrinsics: `({}).constructor.constructor`\n * is `Function`, and `Function(\"return globalThis\")()` walks straight back\n * out. Closing that would mean freezing or poisoning `Object.prototype`,\n * `Function` and every async/generator constructor, which breaks the engine\n * itself — it subclasses, it writes prototypes, it builds objects constantly.\n * So the honest security boundary is not this file. It is whatever gate the\n * *host* puts in front of calling `Registry.addNodeFromSource` at all — a\n * compiled node's source is not evaluated until something upstream decides\n * it should be.\n *\n * This file's job is to make the easy paths closed, the accidents impossible,\n * and the escape require obvious intent that a reviewer would notice.\n */\n\n/**\n * Names bound to `undefined` in every dynamic node module's scope.\n *\n * Grouped by what they'd be used for, because the list is only auditable if\n * you can see what each entry is keeping out. Adding a browser API here is\n * cheap; leaving one out is the bug.\n *\n * This engine's `Registry` only ever evaluates a dynamic node inside a\n * browser-realm page (a real browser tab, or headless's own Playwright page —\n * never bare Node), so this list is scoped to that one realm rather than also\n * covering Node globals (`process`, `require`, `global`) that never apply\n * here.\n */\nexport const DENIED_GLOBALS: readonly string[] = [\n // Reaching the global object, and from it everything else.\n \"globalThis\",\n \"window\",\n \"self\",\n \"top\",\n \"parent\",\n \"frames\",\n\n // Evaluating more code.\n //\n // `eval` is missing on purpose and cannot be added: strict mode forbids it\n // as a binding name, so naming it here makes `new Function` throw\n // \"Unexpected eval or arguments in strict mode\" and *every* dynamic node\n // stops linking. It stays reachable, which is one more reason this file is\n // not the security boundary — see the module note above.\n \"Function\",\n \"importScripts\",\n\n // The DOM: reading the page, and `document.cookie`.\n \"document\",\n \"navigator\",\n \"location\",\n \"history\",\n \"screen\",\n \"customElements\",\n\n // Anywhere to send what was found. (`navigator.sendBeacon` needs\n // `navigator`, which is already denied above.)\n \"fetch\",\n \"XMLHttpRequest\",\n \"WebSocket\",\n \"EventSource\",\n \"Request\",\n \"Response\",\n \"Headers\",\n\n // Anywhere to read a credential from.\n \"localStorage\",\n \"sessionStorage\",\n \"indexedDB\",\n \"caches\",\n \"cookieStore\",\n \"crypto\",\n\n // Other threads and other documents.\n \"Worker\",\n \"SharedWorker\",\n \"ServiceWorker\",\n \"MessageChannel\",\n \"BroadcastChannel\",\n \"postMessage\",\n\n // Things that ask the user for something, or leave the page.\n \"alert\",\n \"confirm\",\n \"prompt\",\n \"open\",\n \"print\",\n \"Notification\",\n];\n\n/**\n * Names strict mode refuses to bind, and which would therefore break linking\n * for every dynamic node rather than protecting anything.\n *\n * Checked rather than trusted: adding one to the list above is an easy\n * mistake that fails at *evaluation* time, on whichever node happens to\n * compile first, with an error naming neither the list nor the culprit.\n */\nconst UNBINDABLE = new Set([\"eval\", \"arguments\"]);\n\nconst illegal = DENIED_GLOBALS.filter((name) => UNBINDABLE.has(name));\nif (illegal.length > 0) {\n throw new Error(\n `DENIED_GLOBALS cannot contain ${illegal.join(\", \")}: strict mode forbids ` +\n `binding those names, so no dynamic node would link at all. See the note in this file.`,\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/document/diff.ts"],"names":[],"mappings":"AAAA,OA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,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,iFAAiF;AACjF,SAAS,iBAAiB,CAAC,CAAoB,EAAE,CAAoB;IACjE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAChD,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { clipDocument } from \"./audio\";\r\nimport {\r\n documentDuration,\r\n nodeSpan,\r\n ROOT_NODE_ID,\r\n type ClipDocument,\r\n type CommandSpec,\r\n type NodeSpec,\r\n type VisualDocument,\r\n type TimedNodeSpec,\r\n type VariableSpec,\r\n} from \"./types\";\r\n\r\n/**\r\n * Deep equality over JSON values: key order is irrelevant, an `undefined`-valued\r\n * key equals an absent one (neither survives serialization), arrays are ordered.\r\n */\r\nexport function jsonEqual(a: unknown, b: unknown): boolean {\r\n if (a === b) return true;\r\n if (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) {\r\n return a !== a && b !== b;\r\n }\r\n if (Array.isArray(a)) {\r\n if (!Array.isArray(b) || a.length !== b.length) return false;\r\n for (let i = 0; i < a.length; i++) {\r\n if (!jsonEqual(a[i], b[i])) return false;\r\n }\r\n return true;\r\n }\r\n if (Array.isArray(b)) return false;\r\n const ao = a as Record<string, unknown>;\r\n const bo = b as Record<string, unknown>;\r\n let defined = 0;\r\n for (const key of Object.keys(ao)) {\r\n const value = ao[key];\r\n if (value === undefined) continue;\r\n defined++;\r\n if (!jsonEqual(value, bo[key])) return false;\r\n }\r\n for (const key of Object.keys(bo)) {\r\n if (bo[key] !== undefined) defined--;\r\n }\r\n return defined === 0;\r\n}\r\n\r\nexport interface RowChanges {\r\n added: Set<string>;\r\n removed: Set<string>;\r\n /** Present on both sides with any semantic field different. */\r\n changed: Set<string>;\r\n}\r\n\r\nexport interface ClipDiff {\r\n /** Nothing semantic differs — the two documents build the same clip. */\r\n identical: boolean;\r\n kindChanged: boolean;\r\n themeChanged: boolean;\r\n rootChanged: boolean;\r\n duration: boolean;\r\n nodes: RowChanges & {\r\n /** `type`, `key` or `props` differ. */\r\n respec: Set<string>;\r\n /** `parentId` differs. */\r\n moved: Set<string>;\r\n /** `startAt` or `endAt` differ, as spans. */\r\n span: Set<string>;\r\n /** Parents (`\"\"` for top level) whose kept children sit in a different sibling order. */\r\n reorderedParents: Set<string>;\r\n };\r\n commands: RowChanges & {\r\n /** `at` values whose kept commands appear in a different relative array order. */\r\n reorderedAts: Set<number>;\r\n };\r\n /** `changed` is `value` or `lerp`; a `name` is a label and never counts. */\r\n variables: RowChanges;\r\n /** Keys present on both sides that name a different node id. */\r\n remappedKeys: Set<string>;\r\n}\r\n\r\nfunction emptyDiff(): ClipDiff {\r\n return {\r\n identical: true,\r\n kindChanged: false,\r\n themeChanged: false,\r\n rootChanged: false,\r\n duration: false,\r\n nodes: {\r\n added: new Set(), removed: new Set(), changed: new Set(),\r\n respec: new Set(), moved: new Set(), span: new Set(), reorderedParents: new Set(),\r\n },\r\n commands: { added: new Set(), removed: new Set(), changed: new Set(), reorderedAts: new Set() },\r\n variables: { added: new Set(), removed: new Set(), changed: new Set() },\r\n remappedKeys: new Set(),\r\n };\r\n}\r\n\r\n/**\r\n * What differs between two versions of one clip, by row id.\r\n *\r\n * Only semantic fields are compared, so an edit that cannot change what the\r\n * clip builds (a variable's `name`, key order inside `props`, `startAt: 0`\r\n * against an absent one) is not a change. Audio documents are compared as the\r\n * compositions they lower to, which is what the timeline builds.\r\n */\r\nexport function diffClip(prev: ClipDocument, next: ClipDocument): ClipDiff {\r\n const diff = emptyDiff();\r\n if (prev === next) return diff;\r\n\r\n if (prev.kind !== next.kind) {\r\n diff.kindChanged = true;\r\n diff.identical = false;\r\n return diff;\r\n }\r\n\r\n const p = lowered(prev);\r\n const n = lowered(next);\r\n\r\n diff.themeChanged = !jsonEqual((prev as { theme?: unknown }).theme, (next as { theme?: unknown }).theme);\r\n diff.duration = documentDuration(p) !== documentDuration(n);\r\n\r\n if (prev.nodes !== next.nodes) diffNodes(p.nodes, n.nodes, diff);\r\n if (prev.variables !== next.variables) diffVariables(p.variables ?? [], n.variables ?? [], diff);\r\n const prevCommands = p.kind === \"composition\" ? p.commands : [];\r\n const nextCommands = n.kind === \"composition\" ? n.commands : [];\r\n if ((prev as { commands?: unknown }).commands !== (next as { commands?: unknown }).commands) {\r\n diffCommands(prevCommands, nextCommands, diff);\r\n }\r\n\r\n diff.identical = !diff.themeChanged && !diff.rootChanged && !diff.duration\r\n && diff.remappedKeys.size === 0\r\n && rowsEmpty(diff.nodes) && diff.nodes.reorderedParents.size === 0\r\n && rowsEmpty(diff.commands) && diff.commands.reorderedAts.size === 0\r\n && rowsEmpty(diff.variables);\r\n return diff;\r\n}\r\n\r\nfunction lowered(doc: ClipDocument): VisualDocument {\r\n return clipDocument(doc);\r\n}\r\n\r\nfunction rowsEmpty(rows: RowChanges): boolean {\r\n return rows.added.size === 0 && rows.removed.size === 0 && rows.changed.size === 0;\r\n}\r\n\r\nconst DEFAULT_ROOT: NodeSpec = { id: ROOT_NODE_ID, type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\r\n\r\nfunction diffNodes(prevRows: readonly TimedNodeSpec[], nextRows: readonly TimedNodeSpec[], diff: ClipDiff): void {\r\n const prev = byId(prevRows);\r\n const next = byId(nextRows);\r\n const changes = diff.nodes;\r\n\r\n const prevRoot = prev.get(ROOT_NODE_ID) ?? DEFAULT_ROOT;\r\n const nextRoot = next.get(ROOT_NODE_ID) ?? DEFAULT_ROOT;\r\n diff.rootChanged = prevRoot !== nextRoot && !sameNode(prevRoot, nextRoot);\r\n\r\n for (const [id, a] of prev) {\r\n if (id === ROOT_NODE_ID) continue;\r\n const b = next.get(id);\r\n if (!b) {\r\n changes.removed.add(id);\r\n continue;\r\n }\r\n if (a === b) continue;\r\n let changed = false;\r\n if (a.type !== b.type || a.key !== b.key || !jsonEqual(a.props, b.props)) {\r\n changes.respec.add(id);\r\n changed = true;\r\n }\r\n if (a.parentId !== b.parentId) {\r\n changes.moved.add(id);\r\n changed = true;\r\n }\r\n if (!sameSpan(a, b)) {\r\n changes.span.add(id);\r\n changed = true;\r\n }\r\n if (changed || a.layerOrder !== b.layerOrder) changes.changed.add(id);\r\n }\r\n for (const id of next.keys()) {\r\n if (id !== ROOT_NODE_ID && !prev.has(id)) changes.added.add(id);\r\n }\r\n\r\n const prevKeys = keyed(prevRows);\r\n for (const [key, id] of keyed(nextRows)) {\r\n const was = prevKeys.get(key);\r\n if (was !== undefined && was !== id) diff.remappedKeys.add(key);\r\n }\r\n\r\n const prevOrder = siblingOrder(prevRows);\r\n const nextOrder = siblingOrder(nextRows);\r\n for (const [parent, before] of prevOrder) {\r\n const after = nextOrder.get(parent);\r\n if (after && !sameRelativeOrder(before, after)) changes.reorderedParents.add(parent);\r\n }\r\n}\r\n\r\nfunction sameNode(a: NodeSpec, b: NodeSpec): boolean {\r\n return a.type === b.type\r\n && a.key === b.key\r\n && a.parentId === b.parentId\r\n && a.layerOrder === b.layerOrder\r\n && jsonEqual(a.props, b.props)\r\n && sameSpan(a, b);\r\n}\r\n\r\nfunction sameSpan(a: NodeSpec, b: NodeSpec): boolean {\r\n const sa = nodeSpan(a);\r\n const sb = nodeSpan(b);\r\n return sa.start === sb.start && sa.end === sb.end;\r\n}\r\n\r\nfunction diffCommands(prevRows: readonly CommandSpec[], nextRows: readonly CommandSpec[], diff: ClipDiff): void {\r\n const prev = byId(prevRows);\r\n const next = byId(nextRows);\r\n const changes = diff.commands;\r\n\r\n for (const [id, a] of prev) {\r\n const b = next.get(id);\r\n if (!b) {\r\n changes.removed.add(id);\r\n continue;\r\n }\r\n if (a === b) continue;\r\n if (\r\n a.type !== b.type\r\n || a.targetId !== b.targetId\r\n || a.at !== b.at\r\n || (a.duration ?? 0) !== (b.duration ?? 0)\r\n || !jsonEqual(a.easing, b.easing)\r\n || !jsonEqual(a.loop, b.loop)\r\n || !jsonEqual(a.args, b.args)\r\n ) {\r\n changes.changed.add(id);\r\n }\r\n }\r\n for (const id of next.keys()) {\r\n if (!prev.has(id)) changes.added.add(id);\r\n }\r\n\r\n const prevAts = groupByAt(prevRows);\r\n const nextAts = groupByAt(nextRows);\r\n for (const [at, before] of prevAts) {\r\n const after = nextAts.get(at);\r\n if (after && !sameRelativeOrder(before, after)) changes.reorderedAts.add(at);\r\n }\r\n}\r\n\r\nfunction diffVariables(prevRows: readonly VariableSpec[], nextRows: readonly VariableSpec[], diff: ClipDiff): void {\r\n const prev = byId(prevRows);\r\n const next = byId(nextRows);\r\n const changes = diff.variables;\r\n for (const [id, a] of prev) {\r\n const b = next.get(id);\r\n if (!b) {\r\n changes.removed.add(id);\r\n continue;\r\n }\r\n if (a !== b && (a.lerp !== b.lerp || !jsonEqual(a.value, b.value))) changes.changed.add(id);\r\n }\r\n for (const id of next.keys()) {\r\n if (!prev.has(id)) changes.added.add(id);\r\n }\r\n}\r\n\r\nfunction byId<T extends { id: string }>(rows: readonly T[]): Map<string, T> {\r\n const out = new Map<string, T>();\r\n for (const row of rows) out.set(row.id, row);\r\n return out;\r\n}\r\n\r\nfunction keyed(rows: readonly NodeSpec[]): Map<string, string> {\r\n const out = new Map<string, string>();\r\n for (const row of rows) if (row.key) out.set(row.key, row.id);\r\n return out;\r\n}\r\n\r\n/** Child ids per parent, in the order `syncPresence` inserts them: `layerOrder`, ties by array index. */\r\nfunction siblingOrder(rows: readonly NodeSpec[]): Map<string, string[]> {\r\n const groups = new Map<string, Array<{ id: string; order: number; index: number }>>();\r\n rows.forEach((row, index) => {\r\n if (row.id === ROOT_NODE_ID) return;\r\n const parent = row.parentId ?? ROOT_NODE_ID;\r\n let list = groups.get(parent);\r\n if (!list) groups.set(parent, list = []);\r\n list.push({ id: row.id, order: row.layerOrder, index });\r\n });\r\n const out = new Map<string, string[]>();\r\n for (const [parent, list] of groups) {\r\n list.sort((a, b) => (a.order - b.order) || (a.index - b.index));\r\n out.set(parent, list.map((e) => e.id));\r\n }\r\n return out;\r\n}\r\n\r\n/** Command ids per exact `at`, in array order — the tiebreak `inTimelineOrder` uses. */\r\nfunction groupByAt(rows: readonly CommandSpec[]): Map<number, string[]> {\r\n const out = new Map<number, string[]>();\r\n for (const row of rows) {\r\n let list = out.get(row.at);\r\n if (!list) out.set(row.at, list = []);\r\n list.push(row.id);\r\n }\r\n return out;\r\n}\r\n\r\n/** Whether the ids both lists hold appear in the same relative order in each. */\r\nfunction sameRelativeOrder(a: readonly string[], b: readonly string[]): boolean {\r\n const inB = new Set(b);\r\n const inA = new Set(a);\r\n const sharedA = a.filter((id) => inB.has(id));\r\n const sharedB = b.filter((id) => inA.has(id));\r\n if (sharedA.length !== sharedB.length) return false;\r\n for (let i = 0; i < sharedA.length; i++) {\r\n if (sharedA[i] !== sharedB[i]) return false;\r\n }\r\n return true;\r\n}\r\n"]}
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/document/diff.ts"],"names":[],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AAC,GAAG,CAAC,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,iFAAiF;AACjF,SAAS,iBAAiB,CAAC,CAAoB,EAAE,CAAoB;IACjE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAChD,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { clipDocument } from \"./audio\";\nimport {\n documentDuration,\n nodeSpan,\n ROOT_NODE_ID,\n type ClipDocument,\n type CommandSpec,\n type NodeSpec,\n type VisualDocument,\n type TimedNodeSpec,\n type VariableSpec,\n} from \"./types\";\n\n/**\n * Deep equality over JSON values: key order is irrelevant, an `undefined`-valued\n * key equals an absent one (neither survives serialization), arrays are ordered.\n */\nexport function jsonEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) {\n return a !== a && b !== b;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!jsonEqual(a[i], b[i])) return false;\n }\n return true;\n }\n if (Array.isArray(b)) return false;\n const ao = a as Record<string, unknown>;\n const bo = b as Record<string, unknown>;\n let defined = 0;\n for (const key of Object.keys(ao)) {\n const value = ao[key];\n if (value === undefined) continue;\n defined++;\n if (!jsonEqual(value, bo[key])) return false;\n }\n for (const key of Object.keys(bo)) {\n if (bo[key] !== undefined) defined--;\n }\n return defined === 0;\n}\n\nexport interface RowChanges {\n added: Set<string>;\n removed: Set<string>;\n /** Present on both sides with any semantic field different. */\n changed: Set<string>;\n}\n\nexport interface ClipDiff {\n /** Nothing semantic differs — the two documents build the same clip. */\n identical: boolean;\n kindChanged: boolean;\n themeChanged: boolean;\n rootChanged: boolean;\n duration: boolean;\n nodes: RowChanges & {\n /** `type`, `key` or `props` differ. */\n respec: Set<string>;\n /** `parentId` differs. */\n moved: Set<string>;\n /** `startAt` or `endAt` differ, as spans. */\n span: Set<string>;\n /** Parents (`\"\"` for top level) whose kept children sit in a different sibling order. */\n reorderedParents: Set<string>;\n };\n commands: RowChanges & {\n /** `at` values whose kept commands appear in a different relative array order. */\n reorderedAts: Set<number>;\n };\n /** `changed` is `value` or `lerp`; a `name` is a label and never counts. */\n variables: RowChanges;\n /** Keys present on both sides that name a different node id. */\n remappedKeys: Set<string>;\n}\n\nfunction emptyDiff(): ClipDiff {\n return {\n identical: true,\n kindChanged: false,\n themeChanged: false,\n rootChanged: false,\n duration: false,\n nodes: {\n added: new Set(), removed: new Set(), changed: new Set(),\n respec: new Set(), moved: new Set(), span: new Set(), reorderedParents: new Set(),\n },\n commands: { added: new Set(), removed: new Set(), changed: new Set(), reorderedAts: new Set() },\n variables: { added: new Set(), removed: new Set(), changed: new Set() },\n remappedKeys: new Set(),\n };\n}\n\n/**\n * What differs between two versions of one clip, by row id.\n *\n * Only semantic fields are compared, so an edit that cannot change what the\n * clip builds (a variable's `name`, key order inside `props`, `startAt: 0`\n * against an absent one) is not a change. Audio documents are compared as the\n * compositions they lower to, which is what the timeline builds.\n */\nexport function diffClip(prev: ClipDocument, next: ClipDocument): ClipDiff {\n const diff = emptyDiff();\n if (prev === next) return diff;\n\n if (prev.kind !== next.kind) {\n diff.kindChanged = true;\n diff.identical = false;\n return diff;\n }\n\n const p = lowered(prev);\n const n = lowered(next);\n\n diff.themeChanged = !jsonEqual((prev as { theme?: unknown }).theme, (next as { theme?: unknown }).theme);\n diff.duration = documentDuration(p) !== documentDuration(n);\n\n if (prev.nodes !== next.nodes) diffNodes(p.nodes, n.nodes, diff);\n if (prev.variables !== next.variables) diffVariables(p.variables ?? [], n.variables ?? [], diff);\n const prevCommands = p.kind === \"composition\" ? p.commands : [];\n const nextCommands = n.kind === \"composition\" ? n.commands : [];\n if ((prev as { commands?: unknown }).commands !== (next as { commands?: unknown }).commands) {\n diffCommands(prevCommands, nextCommands, diff);\n }\n\n diff.identical = !diff.themeChanged && !diff.rootChanged && !diff.duration\n && diff.remappedKeys.size === 0\n && rowsEmpty(diff.nodes) && diff.nodes.reorderedParents.size === 0\n && rowsEmpty(diff.commands) && diff.commands.reorderedAts.size === 0\n && rowsEmpty(diff.variables);\n return diff;\n}\n\nfunction lowered(doc: ClipDocument): VisualDocument {\n return clipDocument(doc);\n}\n\nfunction rowsEmpty(rows: RowChanges): boolean {\n return rows.added.size === 0 && rows.removed.size === 0 && rows.changed.size === 0;\n}\n\nconst DEFAULT_ROOT: NodeSpec = { id: ROOT_NODE_ID, type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\n\nfunction diffNodes(prevRows: readonly TimedNodeSpec[], nextRows: readonly TimedNodeSpec[], diff: ClipDiff): void {\n const prev = byId(prevRows);\n const next = byId(nextRows);\n const changes = diff.nodes;\n\n const prevRoot = prev.get(ROOT_NODE_ID) ?? DEFAULT_ROOT;\n const nextRoot = next.get(ROOT_NODE_ID) ?? DEFAULT_ROOT;\n diff.rootChanged = prevRoot !== nextRoot && !sameNode(prevRoot, nextRoot);\n\n for (const [id, a] of prev) {\n if (id === ROOT_NODE_ID) continue;\n const b = next.get(id);\n if (!b) {\n changes.removed.add(id);\n continue;\n }\n if (a === b) continue;\n let changed = false;\n if (a.type !== b.type || a.key !== b.key || !jsonEqual(a.props, b.props)) {\n changes.respec.add(id);\n changed = true;\n }\n if (a.parentId !== b.parentId) {\n changes.moved.add(id);\n changed = true;\n }\n if (!sameSpan(a, b)) {\n changes.span.add(id);\n changed = true;\n }\n if (changed || a.layerOrder !== b.layerOrder) changes.changed.add(id);\n }\n for (const id of next.keys()) {\n if (id !== ROOT_NODE_ID && !prev.has(id)) changes.added.add(id);\n }\n\n const prevKeys = keyed(prevRows);\n for (const [key, id] of keyed(nextRows)) {\n const was = prevKeys.get(key);\n if (was !== undefined && was !== id) diff.remappedKeys.add(key);\n }\n\n const prevOrder = siblingOrder(prevRows);\n const nextOrder = siblingOrder(nextRows);\n for (const [parent, before] of prevOrder) {\n const after = nextOrder.get(parent);\n if (after && !sameRelativeOrder(before, after)) changes.reorderedParents.add(parent);\n }\n}\n\nfunction sameNode(a: NodeSpec, b: NodeSpec): boolean {\n return a.type === b.type\n && a.key === b.key\n && a.parentId === b.parentId\n && a.layerOrder === b.layerOrder\n && jsonEqual(a.props, b.props)\n && sameSpan(a, b);\n}\n\nfunction sameSpan(a: NodeSpec, b: NodeSpec): boolean {\n const sa = nodeSpan(a);\n const sb = nodeSpan(b);\n return sa.start === sb.start && sa.end === sb.end;\n}\n\nfunction diffCommands(prevRows: readonly CommandSpec[], nextRows: readonly CommandSpec[], diff: ClipDiff): void {\n const prev = byId(prevRows);\n const next = byId(nextRows);\n const changes = diff.commands;\n\n for (const [id, a] of prev) {\n const b = next.get(id);\n if (!b) {\n changes.removed.add(id);\n continue;\n }\n if (a === b) continue;\n if (\n a.type !== b.type\n || a.targetId !== b.targetId\n || a.at !== b.at\n || (a.duration ?? 0) !== (b.duration ?? 0)\n || !jsonEqual(a.easing, b.easing)\n || !jsonEqual(a.loop, b.loop)\n || !jsonEqual(a.args, b.args)\n ) {\n changes.changed.add(id);\n }\n }\n for (const id of next.keys()) {\n if (!prev.has(id)) changes.added.add(id);\n }\n\n const prevAts = groupByAt(prevRows);\n const nextAts = groupByAt(nextRows);\n for (const [at, before] of prevAts) {\n const after = nextAts.get(at);\n if (after && !sameRelativeOrder(before, after)) changes.reorderedAts.add(at);\n }\n}\n\nfunction diffVariables(prevRows: readonly VariableSpec[], nextRows: readonly VariableSpec[], diff: ClipDiff): void {\n const prev = byId(prevRows);\n const next = byId(nextRows);\n const changes = diff.variables;\n for (const [id, a] of prev) {\n const b = next.get(id);\n if (!b) {\n changes.removed.add(id);\n continue;\n }\n if (a !== b && (a.lerp !== b.lerp || !jsonEqual(a.value, b.value))) changes.changed.add(id);\n }\n for (const id of next.keys()) {\n if (!prev.has(id)) changes.added.add(id);\n }\n}\n\nfunction byId<T extends { id: string }>(rows: readonly T[]): Map<string, T> {\n const out = new Map<string, T>();\n for (const row of rows) out.set(row.id, row);\n return out;\n}\n\nfunction keyed(rows: readonly NodeSpec[]): Map<string, string> {\n const out = new Map<string, string>();\n for (const row of rows) if (row.key) out.set(row.key, row.id);\n return out;\n}\n\n/** Child ids per parent, in the order `syncPresence` inserts them: `layerOrder`, ties by array index. */\nfunction siblingOrder(rows: readonly NodeSpec[]): Map<string, string[]> {\n const groups = new Map<string, Array<{ id: string; order: number; index: number }>>();\n rows.forEach((row, index) => {\n if (row.id === ROOT_NODE_ID) return;\n const parent = row.parentId ?? ROOT_NODE_ID;\n let list = groups.get(parent);\n if (!list) groups.set(parent, list = []);\n list.push({ id: row.id, order: row.layerOrder, index });\n });\n const out = new Map<string, string[]>();\n for (const [parent, list] of groups) {\n list.sort((a, b) => (a.order - b.order) || (a.index - b.index));\n out.set(parent, list.map((e) => e.id));\n }\n return out;\n}\n\n/** Command ids per exact `at`, in array order — the tiebreak `inTimelineOrder` uses. */\nfunction groupByAt(rows: readonly CommandSpec[]): Map<number, string[]> {\n const out = new Map<number, string[]>();\n for (const row of rows) {\n let list = out.get(row.at);\n if (!list) out.set(row.at, list = []);\n list.push(row.id);\n }\n return out;\n}\n\n/** Whether the ids both lists hold appear in the same relative order in each. */\nfunction sameRelativeOrder(a: readonly string[], b: readonly string[]): boolean {\n const inB = new Set(b);\n const inA = new Set(a);\n const sharedA = a.filter((id) => inB.has(id));\n const sharedB = b.filter((id) => inA.has(id));\n if (sharedA.length !== sharedB.length) return false;\n for (let i = 0; i < sharedA.length; i++) {\n if (sharedA[i] !== sharedB[i]) return false;\n }\n return true;\n}\n"]}