@motionscript/core 0.1.0-alpha.6 → 0.1.0-alpha.7

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 (445) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +2 -4
  3. package/dist/assets/errors.js +4 -5
  4. package/dist/assets/errors.js.map +1 -1
  5. package/dist/assets/scope.d.ts +1 -1
  6. package/dist/assets/scope.d.ts.map +1 -1
  7. package/dist/assets/scope.js +1 -1
  8. package/dist/assets/scope.js.map +1 -1
  9. package/dist/attributes/audio/schedule.d.ts +3 -18
  10. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  11. package/dist/attributes/audio/schedule.js.map +1 -1
  12. package/dist/attributes/index.d.ts +3 -5
  13. package/dist/attributes/index.d.ts.map +1 -1
  14. package/dist/attributes/index.js +2 -2
  15. package/dist/attributes/index.js.map +1 -1
  16. package/dist/attributes/layout/insets.d.ts +1 -1
  17. package/dist/attributes/layout/insets.js.map +1 -1
  18. package/dist/attributes/layout/size.d.ts +1 -1
  19. package/dist/attributes/layout/size.js +1 -1
  20. package/dist/attributes/layout/size.js.map +1 -1
  21. package/dist/attributes/properties/decorator.d.ts +44 -11
  22. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  23. package/dist/attributes/properties/decorator.js +37 -9
  24. package/dist/attributes/properties/decorator.js.map +1 -1
  25. package/dist/attributes/properties/inputs.d.ts +1 -1
  26. package/dist/attributes/properties/inputs.js +1 -1
  27. package/dist/attributes/properties/inputs.js.map +1 -1
  28. package/dist/attributes/properties/typed.d.ts +19 -140
  29. package/dist/attributes/properties/typed.d.ts.map +1 -1
  30. package/dist/attributes/properties/typed.js +12 -108
  31. package/dist/attributes/properties/typed.js.map +1 -1
  32. package/dist/attributes/shape/corners/corner-radius.d.ts +1 -1
  33. package/dist/attributes/shape/corners/corner-radius.js +1 -1
  34. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  35. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +1 -1
  36. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  37. package/dist/attributes/shape/fill/color/parser.d.ts +1 -1
  38. package/dist/attributes/shape/fill/color/parser.js +1 -1
  39. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  40. package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -2
  41. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  42. package/dist/attributes/shape/fill/implementations/shader.d.ts +2 -2
  43. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  44. package/dist/attributes/shape/fill/implementations/video.d.ts +1 -1
  45. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  46. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  47. package/dist/attributes/shape/fill/lerp.d.ts +1 -1
  48. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  49. package/dist/attributes/shape/filters/chain.d.ts +1 -1
  50. package/dist/attributes/shape/filters/chain.js +1 -1
  51. package/dist/attributes/shape/filters/chain.js.map +1 -1
  52. package/dist/attributes/shape/filters/union.d.ts +4 -3
  53. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  54. package/dist/attributes/shape/filters/union.js.map +1 -1
  55. package/dist/attributes/shape/path/ops.d.ts +1 -2
  56. package/dist/attributes/shape/path/ops.d.ts.map +1 -1
  57. package/dist/attributes/shape/path/ops.js.map +1 -1
  58. package/dist/attributes/shared/operators.d.ts +2 -2
  59. package/dist/attributes/shared/operators.js.map +1 -1
  60. package/dist/attributes/text/types.d.ts +2 -3
  61. package/dist/attributes/text/types.d.ts.map +1 -1
  62. package/dist/attributes/text/types.js.map +1 -1
  63. package/dist/browser/chunks/chunk-D4FSTPML.js +14 -0
  64. package/dist/browser/chunks/chunk-D4FSTPML.js.map +7 -0
  65. package/dist/browser/chunks/chunk-LKUYVFU3.js +2 -0
  66. package/dist/browser/chunks/{chunk-DHB4COFY.js.map → chunk-LKUYVFU3.js.map} +4 -4
  67. package/dist/browser/chunks/chunk-RTNATFWX.js +5 -0
  68. package/dist/browser/chunks/chunk-RTNATFWX.js.map +7 -0
  69. package/dist/browser/chunks/chunk-ZRPZPWZU.js +3 -0
  70. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +7 -0
  71. package/dist/browser/component.js +1 -1
  72. package/dist/browser/component.js.map +4 -4
  73. package/dist/browser/experimental.js +1 -1
  74. package/dist/browser/index.js +1 -1
  75. package/dist/browser/index.js.map +4 -4
  76. package/dist/browser/manifest.json +2 -4
  77. package/dist/browser/sdk.js +1 -1
  78. package/dist/component.d.ts +10 -18
  79. package/dist/component.d.ts.map +1 -1
  80. package/dist/component.js +10 -17
  81. package/dist/component.js.map +1 -1
  82. package/dist/components/builtins/audio/audio.d.ts +53 -0
  83. package/dist/components/builtins/audio/audio.d.ts.map +1 -0
  84. package/dist/components/builtins/audio/audio.js +41 -0
  85. package/dist/components/builtins/audio/audio.js.map +1 -0
  86. package/dist/components/builtins/geometry/composite.d.ts +93 -0
  87. package/dist/components/builtins/geometry/composite.d.ts.map +1 -0
  88. package/dist/components/builtins/geometry/composite.js +25 -0
  89. package/dist/components/builtins/geometry/composite.js.map +1 -0
  90. package/dist/components/builtins/geometry/geometry.d.ts +921 -0
  91. package/dist/components/builtins/geometry/geometry.d.ts.map +1 -0
  92. package/dist/components/builtins/geometry/geometry.js +107 -0
  93. package/dist/components/builtins/geometry/geometry.js.map +1 -0
  94. package/dist/components/builtins/geometry/shape-outline.d.ts +93 -0
  95. package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -0
  96. package/dist/components/builtins/geometry/shape-outline.js +470 -0
  97. package/dist/components/builtins/geometry/shape-outline.js.map +1 -0
  98. package/dist/components/builtins/layout/layout.d.ts +186 -0
  99. package/dist/components/builtins/layout/layout.d.ts.map +1 -0
  100. package/dist/components/builtins/layout/layout.js +84 -0
  101. package/dist/components/builtins/layout/layout.js.map +1 -0
  102. package/dist/components/builtins/media/media.d.ts +240 -0
  103. package/dist/components/builtins/media/media.d.ts.map +1 -0
  104. package/dist/components/builtins/media/media.js +149 -0
  105. package/dist/components/builtins/media/media.js.map +1 -0
  106. package/dist/components/builtins/providers/providers.d.ts +47 -0
  107. package/dist/components/builtins/providers/providers.d.ts.map +1 -0
  108. package/dist/components/builtins/providers/providers.js +30 -0
  109. package/dist/components/builtins/providers/providers.js.map +1 -0
  110. package/dist/components/builtins/text/number-format.d.ts +66 -0
  111. package/dist/components/builtins/text/number-format.d.ts.map +1 -0
  112. package/dist/components/builtins/text/number-format.js +227 -0
  113. package/dist/components/builtins/text/number-format.js.map +1 -0
  114. package/dist/components/builtins/text/number-pattern.d.ts +51 -0
  115. package/dist/components/builtins/text/number-pattern.d.ts.map +1 -0
  116. package/dist/components/builtins/text/number-pattern.js +77 -0
  117. package/dist/components/builtins/text/number-pattern.js.map +1 -0
  118. package/dist/components/builtins/text/text-defaults.d.ts +32 -0
  119. package/dist/components/builtins/text/text-defaults.d.ts.map +1 -0
  120. package/dist/components/builtins/text/text-defaults.js +37 -0
  121. package/dist/components/builtins/text/text-defaults.js.map +1 -0
  122. package/dist/components/builtins/text/text-layout.d.ts +82 -0
  123. package/dist/components/builtins/text/text-layout.d.ts.map +1 -0
  124. package/dist/components/builtins/text/text-layout.js +331 -0
  125. package/dist/components/builtins/text/text-layout.js.map +1 -0
  126. package/dist/components/builtins/text/text.d.ts +409 -0
  127. package/dist/components/builtins/text/text.d.ts.map +1 -0
  128. package/dist/components/builtins/text/text.js +113 -0
  129. package/dist/components/builtins/text/text.js.map +1 -0
  130. package/dist/components/builtins/three/canvas3d.d.ts +245 -0
  131. package/dist/components/builtins/three/canvas3d.d.ts.map +1 -0
  132. package/dist/components/builtins/three/canvas3d.js +21 -0
  133. package/dist/components/builtins/three/canvas3d.js.map +1 -0
  134. package/dist/components/builtins/three/grid-geometry3d.d.ts +62 -0
  135. package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -0
  136. package/dist/components/builtins/three/grid-geometry3d.js +114 -0
  137. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -0
  138. package/dist/components/builtins/three/three.d.ts +1889 -0
  139. package/dist/components/builtins/three/three.d.ts.map +1 -0
  140. package/dist/components/builtins/three/three.js +305 -0
  141. package/dist/components/builtins/three/three.js.map +1 -0
  142. package/dist/components/factory/api.d.ts +516 -0
  143. package/dist/components/factory/api.d.ts.map +1 -0
  144. package/dist/components/factory/api.js +4 -0
  145. package/dist/components/factory/api.js.map +1 -0
  146. package/dist/components/factory/clip-of.d.ts +5 -0
  147. package/dist/components/factory/clip-of.d.ts.map +1 -0
  148. package/dist/components/factory/clip-of.js +33 -0
  149. package/dist/components/factory/clip-of.js.map +1 -0
  150. package/dist/components/factory/commands-for.d.ts +19 -0
  151. package/dist/components/factory/commands-for.d.ts.map +1 -0
  152. package/dist/components/factory/commands-for.js +5 -0
  153. package/dist/components/factory/commands-for.js.map +1 -0
  154. package/dist/components/factory/component-audio.d.ts +9 -0
  155. package/dist/components/factory/component-audio.d.ts.map +1 -0
  156. package/dist/components/factory/component-audio.js +18 -0
  157. package/dist/components/factory/component-audio.js.map +1 -0
  158. package/dist/components/factory/component2d.d.ts +8 -0
  159. package/dist/components/factory/component2d.d.ts.map +1 -0
  160. package/dist/components/factory/component2d.js +240 -0
  161. package/dist/components/factory/component2d.js.map +1 -0
  162. package/dist/components/factory/component3d.d.ts +9 -0
  163. package/dist/components/factory/component3d.d.ts.map +1 -0
  164. package/dist/components/factory/component3d.js +99 -0
  165. package/dist/components/factory/component3d.js.map +1 -0
  166. package/dist/components/factory/factory.d.ts +63 -0
  167. package/dist/components/factory/factory.d.ts.map +1 -0
  168. package/dist/components/factory/factory.js +313 -0
  169. package/dist/components/factory/factory.js.map +1 -0
  170. package/dist/components/factory/timeline.d.ts +22 -0
  171. package/dist/components/factory/timeline.d.ts.map +1 -0
  172. package/dist/components/factory/timeline.js +128 -0
  173. package/dist/components/factory/timeline.js.map +1 -0
  174. package/dist/components/factory/type-def.d.ts +26 -0
  175. package/dist/components/factory/type-def.d.ts.map +1 -0
  176. package/dist/components/factory/type-def.js +16 -0
  177. package/dist/components/factory/type-def.js.map +1 -0
  178. package/dist/components/factory/types.d.ts +91 -0
  179. package/dist/components/factory/types.d.ts.map +1 -0
  180. package/dist/components/factory/types.js +88 -0
  181. package/dist/components/factory/types.js.map +1 -0
  182. package/dist/components/factory/views.d.ts +121 -0
  183. package/dist/components/factory/views.d.ts.map +1 -0
  184. package/dist/components/factory/views.js +413 -0
  185. package/dist/components/factory/views.js.map +1 -0
  186. package/dist/components/modules/aim.d.ts +30 -0
  187. package/dist/components/modules/aim.d.ts.map +1 -0
  188. package/dist/components/modules/aim.js +39 -0
  189. package/dist/components/modules/aim.js.map +1 -0
  190. package/dist/components/modules/corners.d.ts +13 -0
  191. package/dist/components/modules/corners.d.ts.map +1 -0
  192. package/dist/components/modules/corners.js +12 -0
  193. package/dist/components/modules/corners.js.map +1 -0
  194. package/dist/components/modules/flow.d.ts +26 -0
  195. package/dist/components/modules/flow.d.ts.map +1 -0
  196. package/dist/components/modules/flow.js +57 -0
  197. package/dist/components/modules/flow.js.map +1 -0
  198. package/dist/components/modules/material.d.ts +40 -0
  199. package/dist/components/modules/material.d.ts.map +1 -0
  200. package/dist/components/modules/material.js +75 -0
  201. package/dist/components/modules/material.js.map +1 -0
  202. package/dist/components/modules/paint.d.ts +71 -0
  203. package/dist/components/modules/paint.d.ts.map +1 -0
  204. package/dist/components/modules/paint.js +106 -0
  205. package/dist/components/modules/paint.js.map +1 -0
  206. package/dist/components/modules/shapes.d.ts +31 -0
  207. package/dist/components/modules/shapes.d.ts.map +1 -0
  208. package/dist/components/modules/shapes.js +43 -0
  209. package/dist/components/modules/shapes.js.map +1 -0
  210. package/dist/components/modules/text-layout.d.ts +26 -0
  211. package/dist/components/modules/text-layout.d.ts.map +1 -0
  212. package/dist/components/modules/text-layout.js +57 -0
  213. package/dist/components/modules/text-layout.js.map +1 -0
  214. package/dist/components/modules/text-style.d.ts +48 -0
  215. package/dist/components/modules/text-style.d.ts.map +1 -0
  216. package/dist/components/modules/text-style.js +63 -0
  217. package/dist/components/modules/text-style.js.map +1 -0
  218. package/dist/components/modules/three-entries.d.ts +23 -0
  219. package/dist/components/modules/three-entries.d.ts.map +1 -0
  220. package/dist/components/modules/three-entries.js +41 -0
  221. package/dist/components/modules/three-entries.js.map +1 -0
  222. package/dist/components/modules/view3d.d.ts +59 -0
  223. package/dist/components/modules/view3d.d.ts.map +1 -0
  224. package/dist/components/modules/view3d.js +171 -0
  225. package/dist/components/modules/view3d.js.map +1 -0
  226. package/dist/components/trees/2d/group-bounds.d.ts +56 -0
  227. package/dist/components/trees/2d/group-bounds.d.ts.map +1 -0
  228. package/dist/components/trees/2d/group-bounds.js +87 -0
  229. package/dist/components/trees/2d/group-bounds.js.map +1 -0
  230. package/dist/components/trees/2d/node-lifecycle.d.ts +46 -0
  231. package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -0
  232. package/dist/components/trees/2d/node-lifecycle.js +264 -0
  233. package/dist/components/trees/2d/node-lifecycle.js.map +1 -0
  234. package/dist/components/trees/2d/node-motion.d.ts +56 -0
  235. package/dist/components/trees/2d/node-motion.d.ts.map +1 -0
  236. package/dist/components/trees/2d/node-motion.js +86 -0
  237. package/dist/components/trees/2d/node-motion.js.map +1 -0
  238. package/dist/components/trees/2d/node-render.d.ts +36 -0
  239. package/dist/components/trees/2d/node-render.d.ts.map +1 -0
  240. package/dist/components/trees/2d/node-render.js +67 -0
  241. package/dist/components/trees/2d/node-render.js.map +1 -0
  242. package/dist/components/trees/2d/node-space.d.ts +63 -0
  243. package/dist/components/trees/2d/node-space.d.ts.map +1 -0
  244. package/dist/components/trees/2d/node-space.js +131 -0
  245. package/dist/components/trees/2d/node-space.js.map +1 -0
  246. package/dist/components/trees/2d/node-transform.d.ts +55 -0
  247. package/dist/components/trees/2d/node-transform.d.ts.map +1 -0
  248. package/dist/components/trees/2d/node-transform.js +73 -0
  249. package/dist/components/trees/2d/node-transform.js.map +1 -0
  250. package/dist/components/trees/2d/node2d.d.ts +1020 -0
  251. package/dist/components/trees/2d/node2d.d.ts.map +1 -0
  252. package/dist/components/trees/2d/node2d.js +1481 -0
  253. package/dist/components/trees/2d/node2d.js.map +1 -0
  254. package/dist/components/trees/audio/index.d.ts +2 -0
  255. package/dist/components/trees/audio/index.d.ts.map +1 -0
  256. package/dist/components/trees/audio/index.js +2 -0
  257. package/dist/components/trees/audio/index.js.map +1 -0
  258. package/dist/components/trees/audio/node-audio.d.ts +109 -0
  259. package/dist/components/trees/audio/node-audio.d.ts.map +1 -0
  260. package/dist/components/trees/audio/node-audio.js +167 -0
  261. package/dist/components/trees/audio/node-audio.js.map +1 -0
  262. package/dist/components/trees/index.d.ts +10 -0
  263. package/dist/components/trees/index.d.ts.map +1 -0
  264. package/dist/components/trees/index.js +14 -0
  265. package/dist/components/trees/index.js.map +1 -0
  266. package/dist/components/trees/node/node-editor-state.d.ts +53 -0
  267. package/dist/components/trees/node/node-editor-state.d.ts.map +1 -0
  268. package/dist/components/trees/node/node-editor-state.js +23 -0
  269. package/dist/components/trees/node/node-editor-state.js.map +1 -0
  270. package/dist/components/trees/node/node-reactive.d.ts +89 -0
  271. package/dist/components/trees/node/node-reactive.d.ts.map +1 -0
  272. package/dist/components/trees/node/node-reactive.js +135 -0
  273. package/dist/components/trees/node/node-reactive.js.map +1 -0
  274. package/dist/components/trees/node/node-time.d.ts +39 -0
  275. package/dist/components/trees/node/node-time.d.ts.map +1 -0
  276. package/dist/components/trees/node/node-time.js +14 -0
  277. package/dist/components/trees/node/node-time.js.map +1 -0
  278. package/dist/components/trees/node/node-walk.d.ts +46 -0
  279. package/dist/components/trees/node/node-walk.d.ts.map +1 -0
  280. package/dist/components/trees/node/node-walk.js +74 -0
  281. package/dist/components/trees/node/node-walk.js.map +1 -0
  282. package/dist/components/trees/node/node.d.ts +401 -0
  283. package/dist/components/trees/node/node.d.ts.map +1 -0
  284. package/dist/components/trees/node/node.js +680 -0
  285. package/dist/components/trees/node/node.js.map +1 -0
  286. package/dist/components/trees/root/canvas2d-node.d.ts +163 -0
  287. package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -0
  288. package/dist/components/trees/root/canvas2d-node.js +216 -0
  289. package/dist/components/trees/root/canvas2d-node.js.map +1 -0
  290. package/dist/components/trees/three/node3d.d.ts +222 -0
  291. package/dist/components/trees/three/node3d.d.ts.map +1 -0
  292. package/dist/components/trees/three/node3d.js +289 -0
  293. package/dist/components/trees/three/node3d.js.map +1 -0
  294. package/dist/document/builtins.js +13 -13
  295. package/dist/document/builtins.js.map +1 -1
  296. package/dist/document/command-traits.d.ts +2 -2
  297. package/dist/document/command-traits.js +1 -1
  298. package/dist/document/command-traits.js.map +1 -1
  299. package/dist/document/deny-globals.d.ts +2 -2
  300. package/dist/document/deny-globals.js +2 -2
  301. package/dist/document/deny-globals.js.map +1 -1
  302. package/dist/document/expression/index.d.ts +1 -1
  303. package/dist/document/expression/index.js +1 -1
  304. package/dist/document/expression/index.js.map +1 -1
  305. package/dist/document/expression/ops.js +1 -1
  306. package/dist/document/expression/ops.js.map +1 -1
  307. package/dist/document/index.d.ts +1 -2
  308. package/dist/document/index.d.ts.map +1 -1
  309. package/dist/document/index.js +1 -2
  310. package/dist/document/index.js.map +1 -1
  311. package/dist/document/node-decorator.d.ts +14 -10
  312. package/dist/document/node-decorator.d.ts.map +1 -1
  313. package/dist/document/node-decorator.js +14 -10
  314. package/dist/document/node-decorator.js.map +1 -1
  315. package/dist/document/node-descriptor.d.ts +3 -3
  316. package/dist/document/node-descriptor.d.ts.map +1 -1
  317. package/dist/document/node-descriptor.js.map +1 -1
  318. package/dist/document/registry.d.ts +23 -25
  319. package/dist/document/registry.d.ts.map +1 -1
  320. package/dist/document/registry.js +12 -18
  321. package/dist/document/registry.js.map +1 -1
  322. package/dist/document/timeline.d.ts +3 -3
  323. package/dist/document/timeline.d.ts.map +1 -1
  324. package/dist/document/timeline.js +2 -2
  325. package/dist/document/timeline.js.map +1 -1
  326. package/dist/document/types.d.ts +4 -4
  327. package/dist/document/types.js.map +1 -1
  328. package/dist/document/validate.d.ts +1 -1
  329. package/dist/document/validate.js.map +1 -1
  330. package/dist/experimental.d.ts +19 -19
  331. package/dist/experimental.d.ts.map +1 -1
  332. package/dist/experimental.js +17 -17
  333. package/dist/experimental.js.map +1 -1
  334. package/dist/index.d.ts +10 -11
  335. package/dist/index.d.ts.map +1 -1
  336. package/dist/index.js +10 -11
  337. package/dist/index.js.map +1 -1
  338. package/dist/layout/types.d.ts +1 -1
  339. package/dist/layout/types.js.map +1 -1
  340. package/dist/props/host.d.ts +1 -1
  341. package/dist/props/host.js.map +1 -1
  342. package/dist/props/slot.d.ts +1 -1
  343. package/dist/props/slot.js +1 -1
  344. package/dist/props/slot.js.map +1 -1
  345. package/dist/render/clip.d.ts +1 -1
  346. package/dist/render/clip.js +1 -1
  347. package/dist/render/clip.js.map +1 -1
  348. package/dist/render/descriptors/rect.js.map +1 -1
  349. package/dist/render/descriptors/text.d.ts +11 -5
  350. package/dist/render/descriptors/text.d.ts.map +1 -1
  351. package/dist/render/descriptors/text.js +7 -1
  352. package/dist/render/descriptors/text.js.map +1 -1
  353. package/dist/render/render-context2d.d.ts +2 -2
  354. package/dist/render/render-context2d.js.map +1 -1
  355. package/dist/render3d/builders.d.ts +1 -1
  356. package/dist/render3d/builders.js +1 -1
  357. package/dist/render3d/builders.js.map +1 -1
  358. package/dist/render3d/graphics3d.d.ts +13 -19
  359. package/dist/render3d/graphics3d.d.ts.map +1 -1
  360. package/dist/render3d/graphics3d.js +13 -19
  361. package/dist/render3d/graphics3d.js.map +1 -1
  362. package/dist/render3d/scene3d.d.ts +1 -1
  363. package/dist/render3d/scene3d.js +1 -1
  364. package/dist/render3d/scene3d.js.map +1 -1
  365. package/dist/render3d/texture.d.ts +2 -2
  366. package/dist/render3d/texture.d.ts.map +1 -1
  367. package/dist/render3d/texture.js.map +1 -1
  368. package/dist/render3d/vector3.d.ts +2 -2
  369. package/dist/render3d/vector3.js +2 -2
  370. package/dist/render3d/vector3.js.map +1 -1
  371. package/dist/runtime/asset-refine.d.ts +1 -1
  372. package/dist/runtime/asset-refine.d.ts.map +1 -1
  373. package/dist/runtime/asset-refine.js +1 -1
  374. package/dist/runtime/asset-refine.js.map +1 -1
  375. package/dist/runtime/asset-update.js +1 -1
  376. package/dist/runtime/asset-update.js.map +1 -1
  377. package/dist/runtime/audio-index.d.ts +0 -11
  378. package/dist/runtime/audio-index.d.ts.map +1 -1
  379. package/dist/runtime/audio-index.js +0 -25
  380. package/dist/runtime/audio-index.js.map +1 -1
  381. package/dist/runtime/clip-instance.d.ts +3 -3
  382. package/dist/runtime/clip-instance.d.ts.map +1 -1
  383. package/dist/runtime/clip-instance.js +4 -4
  384. package/dist/runtime/clip-instance.js.map +1 -1
  385. package/dist/runtime/clip-store.d.ts +2 -3
  386. package/dist/runtime/clip-store.d.ts.map +1 -1
  387. package/dist/runtime/clip-store.js +17 -35
  388. package/dist/runtime/clip-store.js.map +1 -1
  389. package/dist/runtime/engine.d.ts +3 -3
  390. package/dist/runtime/engine.js +2 -2
  391. package/dist/runtime/engine.js.map +1 -1
  392. package/dist/runtime/node-picking.d.ts +2 -2
  393. package/dist/runtime/node-picking.d.ts.map +1 -1
  394. package/dist/runtime/node-picking.js +3 -3
  395. package/dist/runtime/node-picking.js.map +1 -1
  396. package/dist/runtime/node-picking3d.d.ts +2 -2
  397. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  398. package/dist/runtime/node-picking3d.js +1 -1
  399. package/dist/runtime/node-picking3d.js.map +1 -1
  400. package/dist/runtime/playback-controller.d.ts +2 -2
  401. package/dist/runtime/playback-controller.d.ts.map +1 -1
  402. package/dist/runtime/playback-controller.js +1 -1
  403. package/dist/runtime/playback-controller.js.map +1 -1
  404. package/dist/runtime/state-evaluator.d.ts +2 -2
  405. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  406. package/dist/runtime/state-evaluator.js.map +1 -1
  407. package/dist/runtime/text-geometry.d.ts +1 -1
  408. package/dist/runtime/text-geometry.d.ts.map +1 -1
  409. package/dist/runtime/text-geometry.js +4 -5
  410. package/dist/runtime/text-geometry.js.map +1 -1
  411. package/dist/sdk/index.d.ts +43 -39
  412. package/dist/sdk/index.d.ts.map +1 -1
  413. package/dist/sdk/index.js +24 -25
  414. package/dist/sdk/index.js.map +1 -1
  415. package/dist/tween/command-decorator.d.ts +7 -9
  416. package/dist/tween/command-decorator.d.ts.map +1 -1
  417. package/dist/tween/command-decorator.js +2 -2
  418. package/dist/tween/command-decorator.js.map +1 -1
  419. package/dist/tween/command.d.ts +1 -1
  420. package/dist/tween/command.js.map +1 -1
  421. package/dist/tween/index.d.ts +2 -1
  422. package/dist/tween/index.d.ts.map +1 -1
  423. package/dist/tween/index.js +1 -1
  424. package/dist/tween/index.js.map +1 -1
  425. package/dist/tween/loop.d.ts +1 -1
  426. package/dist/tween/loop.js +1 -1
  427. package/dist/tween/loop.js.map +1 -1
  428. package/dist/util/reference.d.ts +6 -6
  429. package/dist/util/reference.js.map +1 -1
  430. package/package.json +2 -10
  431. package/dist/browser/chunks/chunk-2RIYH36X.js +0 -3
  432. package/dist/browser/chunks/chunk-2RIYH36X.js.map +0 -7
  433. package/dist/browser/chunks/chunk-DDJN3QII.js +0 -15
  434. package/dist/browser/chunks/chunk-DDJN3QII.js.map +0 -7
  435. package/dist/browser/chunks/chunk-DHB4COFY.js +0 -2
  436. package/dist/browser/chunks/chunk-EJDPYDQI.js +0 -5
  437. package/dist/browser/chunks/chunk-EJDPYDQI.js.map +0 -7
  438. package/dist/browser/chunks/chunk-SFNJRPBV.js +0 -2
  439. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +0 -7
  440. package/dist/browser/chunks/chunk-XAWE4EAK.js +0 -2
  441. package/dist/browser/chunks/chunk-XAWE4EAK.js.map +0 -7
  442. package/dist/browser/jsx-jsx-dev-runtime.js +0 -2
  443. package/dist/browser/jsx-jsx-dev-runtime.js.map +0 -7
  444. package/dist/browser/jsx-jsx-runtime.js +0 -2
  445. package/dist/browser/jsx-jsx-runtime.js.map +0 -7
@@ -0,0 +1,167 @@
1
+ import { declareMembers, property } from "../../../attributes/properties/decorator.js";
2
+ import { audioFiltersProperty, audioParamProperty } from "../../../attributes/properties/typed.js";
3
+ import { Node } from "../../../components/trees/node/node.js";
4
+ /**
5
+ * The third scene graph: things that make sound.
6
+ *
7
+ * Sibling to `Node2D` and `Node3D`, and thin for the same reason they are thick
8
+ * — a node that makes sound has no box and no place in space, so it inherits the
9
+ * tree, identity, props, commands, context and clock from {@link Node} and adds
10
+ * only what every audible thing has: a level, a position in the stereo field, a
11
+ * mute, and a filter chain.
12
+ *
13
+ * Two concrete kinds, and no more: `SoundNode` is a leaf that plays a file, and
14
+ * `AudioBus` is a group that everything beneath it feeds. That is the whole
15
+ * vocabulary of a mixer, and it is deliberately the same shape as the visual
16
+ * trees — a group node and a drawing node — because the thing being described is
17
+ * the same: what exists, and what is under what.
18
+ *
19
+ * ### Levels are curves, not tweens
20
+ *
21
+ * `volume` and `pan` are {@link Param}, so a fade is `AudioFilters`-style
22
+ * automation (`fadeOut(1)`, `ramp(...)`) rather than a `to()`. That is not a
23
+ * limitation being worked around, it is what the two mechanisms mean: a tween
24
+ * writes a prop once per *frame*, while sound is scheduled once, ahead of
25
+ * time, and then runs at 48 kHz. A per-frame write reaches the graph on the one
26
+ * frame that built the request and never again — so a `to({ volume })` would
27
+ * read as animated on the timeline and render flat. `_prepareStep` refuses it
28
+ * instead.
29
+ */
30
+ export class NodeAudio extends Node {
31
+ get dimension() { return "audio"; }
32
+ constructor(props) {
33
+ super(props);
34
+ // Deferred to here rather than run by `super()`: a subclass's field
35
+ // initializers only run once `super()` has returned, so applying props
36
+ // any earlier would write into cells that do not exist yet.
37
+ this.initProps(props);
38
+ this.adoptChildrenProp(props);
39
+ }
40
+ /** This node's children in the audio tree. */
41
+ get childrenAudio() {
42
+ return this._allChildren.filter((c) => c instanceof NodeAudio);
43
+ }
44
+ /**
45
+ * This bus's identity in the platform's graph: one chain, which everything
46
+ * under it feeds.
47
+ *
48
+ * The authored id, and the structural path for a bus built in code rather
49
+ * than from a document row. Neither answer alone works, and being wrong is
50
+ * silent either way — the string reaches `AssetManager.stableKey`, so one
51
+ * that changes re-fetches and re-schedules every clip on the bus. A document
52
+ * row's id is fixed for the document's life, while its child index moves as
53
+ * `syncPresence` adds and removes siblings; a code-built bus has no authored
54
+ * id, but its parent builds it in the same slot every time.
55
+ *
56
+ * @internal
57
+ */
58
+ get _busId() {
59
+ const authored = this._props?.id;
60
+ return `bus:${typeof authored === "string" ? authored : structuralPathOf(this)}`;
61
+ }
62
+ /**
63
+ * Refuse a tween on a level, naming the curve that does work.
64
+ *
65
+ * Loud rather than silent because the failure is otherwise invisible: the
66
+ * command runs its full duration, the timeline draws a bar, and the render
67
+ * is at one flat level. See the class docblock for why the two mechanisms
68
+ * cannot agree.
69
+ */
70
+ _prepareStep(to, duration, easing) {
71
+ for (const key of TWEEN_REFUSED) {
72
+ if (!(key in to))
73
+ continue;
74
+ throw new TypeError(`${this.className}: "${key}" cannot be tweened — an audio level is scheduled once, ` +
75
+ `not written per frame, so a tween on it would render flat. Automate it with a ` +
76
+ `curve instead: ${key}: fadeOut(1), or filters: AudioFilters.gain(ramp(1, 0, 1)).`);
77
+ }
78
+ return super._prepareStep(to, duration, easing);
79
+ }
80
+ }
81
+ declareMembers(NodeAudio, {
82
+ volume: audioParamProperty({ default: 1 }),
83
+ pan: audioParamProperty({ default: 0 }),
84
+ mute: property({ default: false }),
85
+ filters: audioFiltersProperty(),
86
+ });
87
+ const TWEEN_REFUSED = ["volume", "pan"];
88
+ /**
89
+ * The buses a node feeds, **source-adjacent first**.
90
+ *
91
+ * Walks up the audio ancestors only: the walk stops at the first non-audio
92
+ * parent, which is the `Canvas2D` scene root, because a scene root is not a bus
93
+ * — it has no level of its own and nothing to mix.
94
+ */
95
+ export function busPathOf(node, spanOf) {
96
+ const stops = [];
97
+ let parent = node.parent;
98
+ while (parent instanceof NodeAudio) {
99
+ stops.push(stopOf(parent, spanOf));
100
+ parent = parent.parent;
101
+ }
102
+ return stops.length > 0 ? stops : undefined;
103
+ }
104
+ /** {@link busPathOf}, with `bus` itself as the first stop. */
105
+ export function busPathTo(bus, spanOf) {
106
+ return [stopOf(bus, spanOf), ...(busPathOf(bus, spanOf) ?? [])];
107
+ }
108
+ /**
109
+ * The bus in `from`'s scene with node id `id`, or `null`.
110
+ *
111
+ * What lets something outside the audio tree feed a bus — a `Video`, whose audio
112
+ * is welded to its picture and so cannot be parented under one. It names the bus
113
+ * by the same id a `SoundNode` under that bus writes in its `parentId`, because
114
+ * it is asking the same question: which bus. A `key` would be a second
115
+ * vocabulary for it, and an optional one.
116
+ */
117
+ export function findBusById(from, id) {
118
+ let root = from;
119
+ while (root.parent)
120
+ root = root.parent;
121
+ return searchBus(root, id);
122
+ }
123
+ function searchBus(node, id) {
124
+ if (node instanceof NodeAudio && node.id === id)
125
+ return node;
126
+ for (const child of node._allChildren) {
127
+ const found = searchBus(child, id);
128
+ if (found)
129
+ return found;
130
+ }
131
+ return null;
132
+ }
133
+ /** One bus, flattened to the plain data a platform builds its chain from. */
134
+ function stopOf(bus, spanOf) {
135
+ const filters = bus.filters;
136
+ const span = spanOf(bus);
137
+ return {
138
+ id: bus._busId,
139
+ volume: bus.volume,
140
+ pan: bus.pan,
141
+ mute: bus.mute,
142
+ ...(filters.length > 0 ? { filters } : {}),
143
+ startAt: span.start,
144
+ endAt: span.end,
145
+ };
146
+ }
147
+ /**
148
+ * A node's child-index path from the root of its tree, joined with ".".
149
+ *
150
+ * The same identity `nodePath` gives the runtime, computed bottom-up because a
151
+ * node declaring its audio knows its parents and not its index in a
152
+ * walk. Stable across a rebuild for an unchanged tree, which is the property
153
+ * both a bus id and a clip's request id need.
154
+ */
155
+ export function structuralPathOf(node) {
156
+ const parts = [];
157
+ let current = node;
158
+ while (current) {
159
+ const parent = current.parent;
160
+ if (!parent)
161
+ break;
162
+ parts.push(String(parent._allChildren.indexOf(current)));
163
+ current = parent;
164
+ }
165
+ return parts.reverse().join(".");
166
+ }
167
+ //# sourceMappingURL=node-audio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-audio.js","sourceRoot":"","sources":["../../../../src/components/trees/audio/node-audio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAMzF,OAAO,EAAE,IAAI,EAAuD,MAAM,8BAA8B,CAAC;AAezG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,SAAqD,SAAQ,IAAO;IAC7E,IAAI,SAAS,KAAoB,OAAO,OAAO,CAAC,CAAC,CAAC;IAOlD,YAAY,KAA0B;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,oEAAoE;QACpE,uEAAuE;QACvE,4DAA4D;QAC5D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,8CAA8C;IAC9C,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAkB,EAAE,CAAC,CAAC,YAAY,SAAS,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,MAAM;QACN,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACjC,OAAO,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACrF,CAAC;IAED;;;;;;;OAOG;IACM,YAAY,CAAC,EAAc,EAAE,QAAgB,EAAE,MAAuB;QAC3E,KAAK,MAAM,GAAG,IAAI,aAAa,E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AgB,CAAC,IAAU;IACvC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,GAAgB,IAAI,CAAC;IAChC,OAAO,OAAO,EAAE,CAAC;QACb,MAAM,MAAM,GAAgB,OAAO,CAAC,MAAM,CAAC;QAC3C,IAAI,CAAC,MAAM;YAAE,MAAM;QACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,OAAO,GAAG,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { declareMembers, property } from \"@/attributes/properties/decorator\";\r\nimport { audioFiltersProperty, audioParamProperty } from \"@/attributes/properties/typed\";\r\nimport { type AudioFilter } from \"@/attributes/audio/filters/chain\";\r\nimport type { AudioFilterItem } from \"@/attributes/audio/filters/union\";\r\nimport type { Param } from \"@/attributes/audio/filters/curve\";\r\nimport type { AudioBusStop } from \"@/attributes/audio/request\";\r\nimport type { NodeSpan } from \"@/document/types\";\r\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/components/trees/node/node\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { TweenStepper } from \"@/tween/stepper\";\r\n\r\nexport interface NodeAudioProps extends NodeProps {\r\n /** Linear gain. 1 leaves the signal alone, 0 silences it. */\r\n volume: Param;\r\n /** Stereo position: -1 hard left, 0 centre, +1 hard right. */\r\n pan: Param;\r\n /** Silence this node and, on a bus, everything under it. */\r\n mute: boolean;\r\n /** Filters applied in array order, index 0 closest to the source. */\r\n filters: AudioFilter;\r\n}\r\n\r\n/**\r\n * The third scene graph: things that make sound.\r\n *\r\n * Sibling to `Node2D` and `Node3D`, and thin for the same reason they are thick\r\n * — a node that makes sound has no box and no place in space, so it inherits the\r\n * tree, identity, props, commands, context and clock from {@link Node} and adds\r\n * only what every audible thing has: a level, a position in the stereo field, a\r\n * mute, and a filter chain.\r\n *\r\n * Two concrete kinds, and no more: `SoundNode` is a leaf that plays a file, and\r\n * `AudioBus` is a group that everything beneath it feeds. That is the whole\r\n * vocabulary of a mixer, and it is deliberately the same shape as the visual\r\n * trees — a group node and a drawing node — because the thing being described is\r\n * the same: what exists, and what is under what.\r\n *\r\n * ### Levels are curves, not tweens\r\n *\r\n * `volume` and `pan` are {@link Param}, so a fade is `AudioFilters`-style\r\n * automation (`fadeOut(1)`, `ramp(...)`) rather than a `to()`. That is not a\r\n * limitation being worked around, it is what the two mechanisms mean: a tween\r\n * writes a prop once per *frame*, while sound is scheduled once, ahead of\r\n * time, and then runs at 48 kHz. A per-frame write reaches the graph on the one\r\n * frame that built the request and never again — so a `to({ volume })` would\r\n * read as animated on the timeline and render flat. `_prepareStep` refuses it\r\n * instead.\r\n */\r\nexport class NodeAudio<P extends NodeAudioProps = NodeAudioProps> extends Node<P> {\r\n get dimension(): NodeDimension { return \"audio\"; }\r\n\r\n declare volume: Param;\r\n declare pan: Param;\r\n declare mute: boolean;\r\n declare filters: AudioFilter;\r\n\r\n constructor(props?: NodeConfig<any, P>) {\r\n super(props);\r\n // Deferred to here rather than run by `super()`: a subclass's field\r\n // initializers only run once `super()` has returned, so applying props\r\n // any earlier would write into cells that do not exist yet.\r\n this.initProps(props);\r\n this.adoptChildrenProp(props);\r\n }\r\n\r\n /** This node's children in the audio tree. */\r\n get childrenAudio(): NodeAudio[] {\r\n return this._allChildren.filter((c): c is NodeAudio => c instanceof NodeAudio);\r\n }\r\n\r\n /**\r\n * This bus's identity in the platform's graph: one chain, which everything\r\n * under it feeds.\r\n *\r\n * The authored id, and the structural path for a bus built in code rather\r\n * than from a document row. Neither answer alone works, and being wrong is\r\n * silent either way — the string reaches `AssetManager.stableKey`, so one\r\n * that changes re-fetches and re-schedules every clip on the bus. A document\r\n * row's id is fixed for the document's life, while its child index moves as\r\n * `syncPresence` adds and removes siblings; a code-built bus has no authored\r\n * id, but its parent builds it in the same slot every time.\r\n *\r\n * @internal\r\n */\r\n get _busId(): string {\r\n const authored = this._props?.id;\r\n return `bus:${typeof authored === \"string\" ? authored : structuralPathOf(this)}`;\r\n }\r\n\r\n /**\r\n * Refuse a tween on a level, naming the curve that does work.\r\n *\r\n * Loud rather than silent because the failure is otherwise invisible: the\r\n * command runs its full duration, the timeline draws a bar, and the render\r\n * is at one flat level. See the class docblock for why the two mechanisms\r\n * cannot agree.\r\n */\r\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\r\n for (const key of TWEEN_REFUSED) {\r\n if (!(key in to)) continue;\r\n throw new TypeError(\r\n `${this.className}: \"${key}\" cannot be tweened — an audio level is scheduled once, ` +\r\n `not written per frame, so a tween on it would render flat. Automate it with a ` +\r\n `curve instead: ${key}: fadeOut(1), or filters: AudioFilters.gain(ramp(1, 0, 1)).`,\r\n );\r\n }\r\n return super._prepareStep(to, duration, easing);\r\n }\r\n}\r\n\r\ndeclareMembers(NodeAudio, {\r\n volume: audioParamProperty({ default: 1 }),\r\n pan: audioParamProperty({ default: 0 }),\r\n mute: property({ default: false }),\r\n filters: audioFiltersProperty(),\r\n});\r\n\r\nconst TWEEN_REFUSED = [\"volume\", \"pan\"] as const;\r\n\r\n/**\r\n * The buses a node feeds, **source-adjacent first**.\r\n *\r\n * Walks up the audio ancestors only: the walk stops at the first non-audio\r\n * parent, which is the `Canvas2D` scene root, because a scene root is not a bus\r\n * — it has no level of its own and nothing to mix.\r\n */\r\nexport function busPathOf(node: NodeAudio, spanOf: SpanOf): AudioBusStop[] | undefined {\r\n const stops: AudioBusStop[] = [];\r\n let parent = node.parent;\r\n while (parent instanceof NodeAudio) {\r\n stops.push(stopOf(parent, spanOf));\r\n parent = parent.parent;\r\n }\r\n return stops.length > 0 ? stops : undefined;\r\n}\r\n\r\n/** {@link busPathOf}, with `bus` itself as the first stop. */\r\nexport function busPathTo(bus: NodeAudio, spanOf: SpanOf): AudioBusStop[] {\r\n return [stopOf(bus, spanOf), ...(busPathOf(bus, spanOf) ?? [])];\r\n}\r\n\r\n/** When a node is in the tree, in clip seconds: the span a bus stop carries. */\r\nexport type SpanOf = (node: Node) => Readonly<NodeSpan>;\r\n\r\n/**\r\n * The bus in `from`'s scene with node id `id`, or `null`.\r\n *\r\n * What lets something outside the audio tree feed a bus — a `Video`, whose audio\r\n * is welded to its picture and so cannot be parented under one. It names the bus\r\n * by the same id a `SoundNode` under that bus writes in its `parentId`, because\r\n * it is asking the same question: which bus. A `key` would be a second\r\n * vocabulary for it, and an optional one.\r\n */\r\nexport function findBusById(from: Node, id: string): NodeAudio | null {\r\n let root: Node = from;\r\n while (root.parent) root = root.parent;\r\n return searchBus(root, id);\r\n}\r\n\r\nfunction searchBus(node: Node, id: string): NodeAudio | null {\r\n if (node instanceof NodeAudio && node.id === id) return node;\r\n for (const child of node._allChildren) {\r\n const found = searchBus(child, id);\r\n if (found) return found;\r\n }\r\n return null;\r\n}\r\n\r\n/** One bus, flattened to the plain data a platform builds its chain from. */\r\nfunction stopOf(bus: NodeAudio, spanOf: SpanOf): AudioBusStop {\r\n const filters = bus.filters as unknown as AudioFilterItem[];\r\n const span = spanOf(bus);\r\n return {\r\n id: bus._busId,\r\n volume: bus.volume,\r\n pan: bus.pan,\r\n mute: bus.mute,\r\n ...(filters.length > 0 ? { filters } : {}),\r\n startAt: span.start,\r\n endAt: span.end,\r\n };\r\n}\r\n\r\n/**\r\n * A node's child-index path from the root of its tree, joined with \".\".\r\n *\r\n * The same identity `nodePath` gives the runtime, computed bottom-up because a\r\n * node declaring its audio knows its parents and not its index in a\r\n * walk. Stable across a rebuild for an unchanged tree, which is the property\r\n * both a bus id and a clip's request id need.\r\n */\r\nexport function structuralPathOf(node: Node): string {\r\n const parts: string[] = [];\r\n let current: Node | null = node;\r\n while (current) {\r\n const parent: Node | null = current.parent;\r\n if (!parent) break;\r\n parts.push(String(parent._allChildren.indexOf(current)));\r\n current = parent;\r\n }\r\n return parts.reverse().join(\".\");\r\n}\r\n"]}
@@ -0,0 +1,10 @@
1
+ export * from "./node/node.js";
2
+ export * from "./2d/node2d.js";
3
+ export type { NodeTime } from "./node/node-time.js";
4
+ /** @internal */ export { primeMotionTree, sampleTree } from "./node/node-walk.js";
5
+ export { applyEditorStates } from "./node/node-editor-state.js";
6
+ export type { NodeEditorState, NodeEditorStates } from "./node/node-editor-state.js";
7
+ export * from "./root/canvas2d-node.js";
8
+ export * from "./audio/index.js";
9
+ export * from "./three/node3d.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/trees/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClF,cAAc,sBAAsB,CAAC;AAIrC,cAAc,SAAS,CAAC;AAGxB,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,14 @@
1
+ // The two halves of the tree: the dimension-agnostic base, and its 2D side.
2
+ export * from "./node/node.js";
3
+ export * from "./2d/node2d.js";
4
+ // The per-frame subtree traversals the runtime drives. Free functions rather
5
+ // than node methods — see the module docblock.
6
+ /** @internal */ export { primeMotionTree, sampleTree } from "./node/node-walk.js";
7
+ export { applyEditorStates } from "./node/node-editor-state.js";
8
+ export * from "./root/canvas2d-node.js";
9
+ // The node types themselves are components (`components/builtins/*`), their props types beside them.
10
+ // Audio — the third tree: a bus groups, a sound plays.
11
+ export * from "./audio/index.js";
12
+ // 3D
13
+ export * from "./three/node3d.js";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/trees/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAE5B,6EAA6E;AAC7E,+CAA+C;AAC/C,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,cAAc,sBAAsB,CAAC;AAErC,qGAAqG;AACrG,uDAAuD;AACvD,cAAc,SAAS,CAAC;AAExB,KAAK;AACL,cAAc,gBAAgB,CAAC","sourcesContent":["// The two halves of the tree: the dimension-agnostic base, and its 2D side.\r\nexport * from \"./node/node\";\r\nexport * from \"./2d/node2d\";\r\nexport type { NodeTime } from \"./node/node-time\";\r\n// The per-frame subtree traversals the runtime drives. Free functions rather\r\n// than node methods — see the module docblock.\r\n/** @internal */ export { primeMotionTree, sampleTree } from \"./node/node-walk\";\r\nexport { applyEditorStates } from \"./node/node-editor-state\";\r\n\r\nexport type { NodeEditorState, NodeEditorStates } from \"./node/node-editor-state\";\r\nexport * from \"./root/canvas2d-node\";\r\n\r\n// The node types themselves are components (`components/builtins/*`), their props types beside them.\r\n// Audio — the third tree: a bus groups, a sound plays.\r\nexport * from \"./audio\";\r\n\r\n// 3D\r\nexport * from \"./three/node3d\";\r\n"]}
@@ -0,0 +1,53 @@
1
+ import { Node } from "./node.js";
2
+ /**
3
+ * What an editor says about one node, as against what the document says.
4
+ *
5
+ * Neither of these is a prop. They are not authored values, they do not tween,
6
+ * they are not part of the scene's meaning — an exported frame is the same
7
+ * whether or not the person who made it had a layer folded away. They are the
8
+ * editor's view of the tree, so they arrive on the side and are applied over it.
9
+ */
10
+ export interface NodeEditorState {
11
+ /**
12
+ * Hide the node and everything under it: no paint, no pick, and no layout
13
+ * slot — a hidden child of a row gives up its cell and its gap, the way
14
+ * `display: none` does rather than `visibility: hidden`.
15
+ *
16
+ * The node **stays in the tree**. Dropping it instead would renumber every
17
+ * later sibling's structural path, which is what a host's boxes, its
18
+ * lifespans and its picking are all keyed on.
19
+ */
20
+ hidden?: boolean;
21
+ /**
22
+ * Take the node out of reach of the pointer while leaving the picture
23
+ * untouched — Figma's padlock.
24
+ *
25
+ * Not the opposite of {@link hidden} and not a weaker form of it. A locked
26
+ * node still draws, still lays out, and still confines its children; what it
27
+ * declines is being the *answer* to a pick. Its children stay pickable,
28
+ * because locking a group is about the group.
29
+ */
30
+ locked?: boolean;
31
+ }
32
+ /**
33
+ * Editor state for a whole tree, keyed by {@link Node.key}.
34
+ *
35
+ * A record rather than a list: the walk that applies it asks once per node, and
36
+ * a host with a thousand-node scene should not pay a scan for each.
37
+ */
38
+ export type NodeEditorStates = Record<string, NodeEditorState>;
39
+ /**
40
+ * Push `states` onto the tree under `root`.
41
+ *
42
+ * Resolved onto the nodes rather than consulted from them, so `render` and the
43
+ * pick walk read a local field instead of probing a record they would first have
44
+ * to reach the scene to find. Called once per frame from `ClipInstance.attach`, which
45
+ * is after the tree is built and before it is laid out — a node that appeared
46
+ * this frame therefore gets its state on the same frame it appears.
47
+ *
48
+ * A node with no `key`, or a key the record does not mention, is reset rather
49
+ * than left alone: the record is the whole truth about editor state, so a key
50
+ * dropped from it is a node unhidden.
51
+ */
52
+ export declare function applyEditorStates(root: Node, states: NodeEditorStates | undefined): void;
53
+ //# sourceMappingURL=node-editor-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-editor-state.d.ts","sourceRoot":"","sources":["../../../../src/components/trees/node/node-editor-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE/D;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAOxF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Push `states` onto the tree under `root`.
3
+ *
4
+ * Resolved onto the nodes rather than consulted from them, so `render` and the
5
+ * pick walk read a local field instead of probing a record they would first have
6
+ * to reach the scene to find. Called once per frame from `ClipInstance.attach`, which
7
+ * is after the tree is built and before it is laid out — a node that appeared
8
+ * this frame therefore gets its state on the same frame it appears.
9
+ *
10
+ * A node with no `key`, or a key the record does not mention, is reset rather
11
+ * than left alone: the record is the whole truth about editor state, so a key
12
+ * dropped from it is a node unhidden.
13
+ */
14
+ export function applyEditorStates(root, states) {
15
+ const walk = (node) => {
16
+ const state = node.key !== undefined ? states?.[node.key] : undefined;
17
+ node._setEditorState(state?.hidden === true, state?.locked === true);
18
+ for (const child of node._allChildren)
19
+ walk(child);
20
+ };
21
+ walk(root);
22
+ }
23
+ //# sourceMappingURL=node-editor-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-editor-state.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-editor-state.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAU,EAAE,MAAoC;IAC9E,MAAM,IAAI,GAAG,CAAC,IAAU,EAAQ,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;QACrE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { Node } from \"./node\";\r\n\r\n/**\r\n * What an editor says about one node, as against what the document says.\r\n *\r\n * Neither of these is a prop. They are not authored values, they do not tween,\r\n * they are not part of the scene's meaning — an exported frame is the same\r\n * whether or not the person who made it had a layer folded away. They are the\r\n * editor's view of the tree, so they arrive on the side and are applied over it.\r\n */\r\nexport interface NodeEditorState {\r\n /**\r\n * Hide the node and everything under it: no paint, no pick, and no layout\r\n * slot — a hidden child of a row gives up its cell and its gap, the way\r\n * `display: none` does rather than `visibility: hidden`.\r\n *\r\n * The node **stays in the tree**. Dropping it instead would renumber every\r\n * later sibling's structural path, which is what a host's boxes, its\r\n * lifespans and its picking are all keyed on.\r\n */\r\n hidden?: boolean;\r\n /**\r\n * Take the node out of reach of the pointer while leaving the picture\r\n * untouched — Figma's padlock.\r\n *\r\n * Not the opposite of {@link hidden} and not a weaker form of it. A locked\r\n * node still draws, still lays out, and still confines its children; what it\r\n * declines is being the *answer* to a pick. Its children stay pickable,\r\n * because locking a group is about the group.\r\n */\r\n locked?: boolean;\r\n}\r\n\r\n/**\r\n * Editor state for a whole tree, keyed by {@link Node.key}.\r\n *\r\n * A record rather than a list: the walk that applies it asks once per node, and\r\n * a host with a thousand-node scene should not pay a scan for each.\r\n */\r\nexport type NodeEditorStates = Record<string, NodeEditorState>;\r\n\r\n/**\r\n * Push `states` onto the tree under `root`.\r\n *\r\n * Resolved onto the nodes rather than consulted from them, so `render` and the\r\n * pick walk read a local field instead of probing a record they would first have\r\n * to reach the scene to find. Called once per frame from `ClipInstance.attach`, which\r\n * is after the tree is built and before it is laid out — a node that appeared\r\n * this frame therefore gets its state on the same frame it appears.\r\n *\r\n * A node with no `key`, or a key the record does not mention, is reset rather\r\n * than left alone: the record is the whole truth about editor state, so a key\r\n * dropped from it is a node unhidden.\r\n */\r\nexport function applyEditorStates(root: Node, states: NodeEditorStates | undefined): void {\r\n const walk = (node: Node): void => {\r\n const state = node.key !== undefined ? states?.[node.key] : undefined;\r\n node._setEditorState(state?.hidden === true, state?.locked === true);\r\n for (const child of node._allChildren) walk(child);\r\n };\r\n walk(root);\r\n}\r\n"]}
@@ -0,0 +1,89 @@
1
+ import { PropSnapshot } from "../../../props/slot.js";
2
+ import { PropHost } from "../../../props/host.js";
3
+ import { EasingFunction } from "../../../tween/ease/type.js";
4
+ import { type Command } from "../../../tween/command.js";
5
+ import { TweenStepper } from "../../../tween/stepper.js";
6
+ import { PropOptions } from "../../../attributes/properties/decorator.js";
7
+ /**
8
+ * Companion implementation of {@link Node2D}'s property machinery and its
9
+ * save/restore state stack. The bodies live here as free functions over a
10
+ * narrow {@link ReactiveHost} so `node.ts` keeps only thin delegators (and the
11
+ * hot-path `set`/`_writeProp`, which stay inline on the class). Mirrors the
12
+ * existing `getPropSlot(host, name)` pattern in `props/host.ts`.
13
+ */
14
+ /**
15
+ * The slice of a {@link Node2D} these helpers touch: the {@link PropHost} maps
16
+ * plus the internal write/tween seams. `_writeProp` and `_prepareStep` remain
17
+ * methods on `Node2D`; the helpers call back through them so subclass behaviour
18
+ * and the inline hot path are preserved.
19
+ */
20
+ /** @internal */
21
+ export interface ReactiveHost extends PropHost {
22
+ readonly id: string;
23
+ _writeProp(field: string, value: unknown): void;
24
+ _prepareStep(to: Record<string, unknown>, duration: number, easing?: EasingFunction): TweenStepper;
25
+ /** LIFO stack of save() snapshot layers; owned as an instance field on Node2D. */
26
+ _stateStack: Map<string, PropSnapshot<any>>[];
27
+ }
28
+ /**
29
+ * Create the {@link PropSlot} + accessor for a freshly-declared prop and register
30
+ * its tween/mapper metadata. Extracted from `Node2D._registerProp`; defines the
31
+ * getter/setter on `host` so writes route through `host._writeProp`
32
+ * (mapper-aware, binding-aware).
33
+ */
34
+ /** @internal */
35
+ export declare function registerProp<Int>(host: ReactiveHost, field: string, options?: PropOptions<any, Int>): void;
36
+ /**
37
+ * Apply (or re-apply) a prop's initial value plus optional tween/mapper. A first
38
+ * call creates the cell via {@link registerProp}; a subsequent call for the same
39
+ * field reuses the cell and only refines its tween/mapper (so a subclass can
40
+ * override a parent default without losing the cell or its bindings), then
41
+ * writes the value. Extracted from `Node2D.applyProp`.
42
+ */
43
+ /** @internal */
44
+ export declare function applyProp<Ext, Int = Ext>(host: ReactiveHost, field: string, initial: Ext | (() => Ext) | undefined, options?: PropOptions<Ext, Int>): void;
45
+ /** Snapshot every registered prop's current value/binding into a plain object. */
46
+ /** @internal */
47
+ export declare function collectProperties(host: ReactiveHost): Record<string, any>;
48
+ /**
49
+ * Every declared prop of a node, captured as the value **or binding** its slot
50
+ * holds — see {@link Node2D.captureProps}, which is the public way to make one.
51
+ *
52
+ * Keyed by prop name. Opaque on purpose: what a slot holds is the *mapped*,
53
+ * internal form, and reading it out to write back through `set` is exactly the
54
+ * round-trip a layer exists to avoid.
55
+ */
56
+ export type PropLayer = Map<string, PropSnapshot<any>>;
57
+ /** Snapshot every prop slot (value or binding) into a fresh layer. */
58
+ /** @internal */
59
+ export declare function captureLayer(host: ReactiveHost): PropLayer;
60
+ /** Push a snapshot of every prop slot (value or binding) onto the stack. */
61
+ /** @internal */
62
+ export declare function saveState(host: ReactiveHost): void;
63
+ /** Pop the top snapshot layer, or `undefined` if the stack is empty. */
64
+ /** @internal */
65
+ export declare function popState(host: ReactiveHost): PropLayer | undefined;
66
+ /** Instantly reapply a snapshot layer to every captured slot. */
67
+ /** @internal */
68
+ export declare function applySnapshotLayer(host: ReactiveHost, layer: PropLayer): void;
69
+ /**
70
+ * Animated restore: tween the numeric / custom-tweenable props toward their
71
+ * saved resolved values, then reapply the full snapshot so bindings are
72
+ * restored (not frozen at the tween's landing value) and non-tweened props snap.
73
+ *
74
+ * A {@link Command} rather than a generator: `_prepareStep`'s stepper already
75
+ * drives the tween as a pure function of elapsed time, so `driveCommand` wraps
76
+ * it directly and fires the snapshot reapply exactly at `t === 1` — the same
77
+ * "commit at the end, restore what came before below it" shape
78
+ * `packages/components/code`'s `runTransition` uses.
79
+ *
80
+ * `_prepareStep` is called **lazily, on the command's first evaluation**, not
81
+ * when this function runs — it snapshots each prop's `from` off the *live*
82
+ * node, and a generator's body (what this replaces) never ran a line until the
83
+ * caller's first `.next()` either. Building it eagerly would snapshot whatever
84
+ * the node happened to hold at `restore()`-call time instead of at first-drive
85
+ * time, which can differ if the caller does more to the node in between.
86
+ */
87
+ /** @internal */
88
+ export declare function restoreAnimated(host: ReactiveHost, layer: PropLayer | undefined, duration: number, easing?: EasingFunction): Command<Record<string, never>>;
89
+ //# sourceMappingURL=node-reactive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-reactive.d.ts","sourceRoot":"","sources":["../../../../src/components/trees/node/node-reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAe,QAAQ,EAAW,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE;;;;;;GAMG;AAEH;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC1C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,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M7E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,gBAAgB;AAChB,wBAAgB,eAAe,CAC3B,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAkBhC"}
@@ -0,0 +1,135 @@
1
+ import { PropSlot } from "../../../props/slot.js";
2
+ import { ensureCells } from "../../../props/host.js";
3
+ import { driveCommand } from "../../../tween/command.js";
4
+ /**
5
+ * Create the {@link PropSlot} + accessor for a freshly-declared prop and register
6
+ * its tween/mapper metadata. Extracted from `Node2D._registerProp`; defines the
7
+ * getter/setter on `host` so writes route through `host._writeProp`
8
+ * (mapper-aware, binding-aware).
9
+ */
10
+ /** @internal */
11
+ export function registerProp(host, field, options) {
12
+ const slot = new PropSlot(undefined, host, field);
13
+ const cells = ensureCells(host);
14
+ cells.slots.set(field, slot);
15
+ if (options?.tween) {
16
+ (cells.tweens ??= new Map()).set(field, options.tween);
17
+ }
18
+ if (options?.mapper) {
19
+ (cells.mappers ??= new Map()).set(field, options.mapper);
20
+ }
21
+ Object.defineProperty(host, field, {
22
+ get: () => slot.get(),
23
+ set: (value) => host._writeProp(field, value),
24
+ enumerable: true,
25
+ configurable: true,
26
+ });
27
+ }
28
+ /**
29
+ * Apply (or re-apply) a prop's initial value plus optional tween/mapper. A first
30
+ * call creates the cell via {@link registerProp}; a subsequent call for the same
31
+ * field reuses the cell and only refines its tween/mapper (so a subclass can
32
+ * override a parent default without losing the cell or its bindings), then
33
+ * writes the value. Extracted from `Node2D.applyProp`.
34
+ */
35
+ /** @internal */
36
+ export function applyProp(host, field, initial, options) {
37
+ const existing = host.__cells?.slots.get(field);
38
+ if (!existing) {
39
+ registerProp(host, field, options);
40
+ }
41
+ else if (options) {
42
+ // Allow subclasses to refine tween/mapper on an inherited field.
43
+ if (options.tween) {
44
+ (ensureCells(host).tweens ??= new Map()).set(field, options.tween);
45
+ }
46
+ if (options.mapper) {
47
+ (ensureCells(host).mappers ??= new Map()).set(field, options.mapper);
48
+ }
49
+ }
50
+ host._writeProp(field, initial);
51
+ }
52
+ /** Snapshot every registered prop's current value/binding into a plain object. */
53
+ /** @internal */
54
+ export function collectProperties(host) {
55
+ const result = {};
56
+ if (host.__cells) {
57
+ for (const key of host.__cells.slots.keys()) {
58
+ result[key] = host[key];
59
+ }
60
+ }
61
+ return result;
62
+ }
63
+ /** Snapshot every prop slot (value or binding) into a fresh layer. */
64
+ /** @internal */
65
+ export function captureLayer(host) {
66
+ const layer = new Map();
67
+ const slots = host.__cells?.slots;
68
+ if (!slots)
69
+ return layer;
70
+ for (const [key, slot] of slots) {
71
+ layer.set(key, slot.snapshot());
72
+ }
73
+ return layer;
74
+ }
75
+ /** Push a snapshot of every prop slot (value or binding) onto the stack. */
76
+ /** @internal */
77
+ export function saveState(host) {
78
+ if (!host.__cells)
79
+ return;
80
+ host._stateStack.push(captureLayer(host));
81
+ }
82
+ /** Pop the top snapshot layer, or `undefined` if the stack is empty. */
83
+ /** @internal */
84
+ export function popState(host) {
85
+ return host._stateStack.pop();
86
+ }
87
+ /** Instantly reapply a snapshot layer to every captured slot. */
88
+ /** @internal */
89
+ export function applySnapshotLayer(host, layer) {
90
+ const slots = host.__cells?.slots;
91
+ if (!slots)
92
+ return;
93
+ for (const [key, snap] of layer) {
94
+ slots.get(key)?.restoreFrom(snap);
95
+ }
96
+ }
97
+ /**
98
+ * Animated restore: tween the numeric / custom-tweenable props toward their
99
+ * saved resolved values, then reapply the full snapshot so bindings are
100
+ * restored (not frozen at the tween's landing value) and non-tweened props snap.
101
+ *
102
+ * A {@link Command} rather than a generator: `_prepareStep`'s stepper already
103
+ * drives the tween as a pure function of elapsed time, so `driveCommand` wraps
104
+ * it directly and fires the snapshot reapply exactly at `t === 1` — the same
105
+ * "commit at the end, restore what came before below it" shape
106
+ * `packages/components/code`'s `runTransition` uses.
107
+ *
108
+ * `_prepareStep` is called **lazily, on the command's first evaluation**, not
109
+ * when this function runs — it snapshots each prop's `from` off the *live*
110
+ * node, and a generator's body (what this replaces) never ran a line until the
111
+ * caller's first `.next()` either. Building it eagerly would snapshot whatever
112
+ * the node happened to hold at `restore()`-call time instead of at first-drive
113
+ * time, which can differ if the caller does more to the node in between.
114
+ */
115
+ /** @internal */
116
+ export function restoreAnimated(host, layer, duration, easing) {
117
+ let stepper = null;
118
+ return driveCommand(duration, (t) => {
119
+ if (!stepper) {
120
+ // `to()` reads each snapshot's resolved `value` (correct even for a
121
+ // bound slot), so the node animates back to where it *was*.
122
+ const target = {};
123
+ if (layer) {
124
+ for (const [key, snap] of layer) {
125
+ target[key] = snap.value;
126
+ }
127
+ }
128
+ stepper = host._prepareStep(target, duration);
129
+ }
130
+ stepper.seek(t * duration);
131
+ if (layer && t >= 1)
132
+ applySnapshotLayer(host, layer);
133
+ }, easing);
134
+ }
135
+ //# sourceMappingURL=node-reactive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-reactive.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AA2B7D;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAM,IAAkB,EAAE,KAAa,EAAE,OAA+B;IAChG,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAM,SAA2B,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACzE,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7B,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC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C","sourcesContent":["import { PropSlot, PropSnapshot } from \"@/props/slot\";\r\nimport { ensureCells, PropHost, TweenFn } from \"@/props/host\";\r\nimport { EasingFunction } from \"@/tween/ease/type\";\r\nimport { driveCommand, type Command } from \"@/tween/command\";\r\nimport { TweenStepper } from \"@/tween/stepper\";\r\nimport { PropOptions } from \"@/attributes/properties/decorator\";\r\n\r\n/**\r\n * Companion implementation of {@link Node2D}'s property machinery and its\r\n * save/restore state stack. The bodies live here as free functions over a\r\n * narrow {@link ReactiveHost} so `node.ts` keeps only thin delegators (and the\r\n * hot-path `set`/`_writeProp`, which stay inline on the class). Mirrors the\r\n * existing `getPropSlot(host, name)` pattern in `props/host.ts`.\r\n */\r\n\r\n/**\r\n * The slice of a {@link Node2D} these helpers touch: the {@link PropHost} maps\r\n * plus the internal write/tween seams. `_writeProp` and `_prepareStep` remain\r\n * methods on `Node2D`; the helpers call back through them so subclass behaviour\r\n * and the inline hot path are preserved.\r\n */\r\n/** @internal */\r\nexport interface ReactiveHost extends PropHost {\r\n readonly id: string;\r\n _writeProp(field: string, value: unknown): void;\r\n _prepareStep(to: Record<string, unknown>, duration: number, easing?: EasingFunction): TweenStepper;\r\n /** LIFO stack of save() snapshot layers; owned as an instance field on Node2D. */\r\n _stateStack: Map<string, PropSnapshot<any>>[];\r\n}\r\n\r\n/**\r\n * Create the {@link PropSlot} + accessor for a freshly-declared prop and register\r\n * its tween/mapper metadata. Extracted from `Node2D._registerProp`; defines the\r\n * getter/setter on `host` so writes route through `host._writeProp`\r\n * (mapper-aware, binding-aware).\r\n */\r\n/** @internal */\r\nexport function registerProp<Int>(host: ReactiveHost, field: string, options?: PropOptions<any, Int>): void {\r\n const slot = new PropSlot<Int>(undefined as unknown as Int, host, field);\r\n const cells = ensureCells(host);\r\n cells.slots.set(field, slot);\r\n if (options?.tween) {\r\n (cells.tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\r\n }\r\n if (options?.mapper) {\r\n (cells.mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\r\n }\r\n Object.defineProperty(host, field, {\r\n get: () => slot.get(),\r\n set: (value: any) => host._writeProp(field, value),\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n}\r\n\r\n/**\r\n * Apply (or re-apply) a prop's initial value plus optional tween/mapper. A first\r\n * call creates the cell via {@link registerProp}; a subsequent call for the same\r\n * field reuses the cell and only refines its tween/mapper (so a subclass can\r\n * override a parent default without losing the cell or its bindings), then\r\n * writes the value. Extracted from `Node2D.applyProp`.\r\n */\r\n/** @internal */\r\nexport function applyProp<Ext, Int = Ext>(\r\n host: ReactiveHost,\r\n field: string,\r\n initial: Ext | (() => Ext) | undefined,\r\n options?: PropOptions<Ext, Int>,\r\n): void {\r\n const existing = host.__cells?.slots.get(field);\r\n if (!existing) {\r\n registerProp<Int>(host, field, options);\r\n } else if (options) {\r\n // Allow subclasses to refine tween/mapper on an inherited field.\r\n if (options.tween) {\r\n (ensureCells(host).tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\r\n }\r\n if (options.mapper) {\r\n (ensureCells(host).mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\r\n }\r\n }\r\n host._writeProp(field, initial);\r\n}\r\n\r\n/** Snapshot every registered prop's current value/binding into a plain object. */\r\n/** @internal */\r\nexport function collectProperties(host: ReactiveHost): Record<string, any> {\r\n const result: Record<string, any> = {};\r\n if (host.__cells) {\r\n for (const key of host.__cells.slots.keys()) {\r\n result[key] = (host as any)[key];\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n// ---- State stack (save / restore) -----------------------------------------\r\n\r\n/**\r\n * Every declared prop of a node, captured as the value **or binding** its slot\r\n * holds — see {@link Node2D.captureProps}, which is the public way to make one.\r\n *\r\n * Keyed by prop name. Opaque on purpose: what a slot holds is the *mapped*,\r\n * internal form, and reading it out to write back through `set` is exactly the\r\n * round-trip a layer exists to avoid.\r\n */\r\nexport type PropLayer = Map<string, PropSnapshot<any>>;\r\n\r\n/** Snapshot every prop slot (value or binding) into a fresh layer. */\r\n/** @internal */\r\nexport function captureLayer(host: ReactiveHost): PropLayer {\r\n const layer: PropLayer = new Map();\r\n const slots = host.__cells?.slots;\r\n if (!slots) return layer;\r\n for (const [key, slot] of slots) {\r\n layer.set(key, slot.snapshot());\r\n }\r\n return layer;\r\n}\r\n\r\n/** Push a snapshot of every prop slot (value or binding) onto the stack. */\r\n/** @internal */\r\nexport function saveState(host: ReactiveHost): void {\r\n if (!host.__cells) return;\r\n host._stateStack.push(captureLayer(host));\r\n}\r\n\r\n/** Pop the top snapshot layer, or `undefined` if the stack is empty. */\r\n/** @internal */\r\nexport function popState(host: ReactiveHost): PropLayer | undefined {\r\n return host._stateStack.pop();\r\n}\r\n\r\n/** Instantly reapply a snapshot layer to every captured slot. */\r\n/** @internal */\r\nexport function applySnapshotLayer(host: ReactiveHost, layer: PropLayer): void {\r\n const slots = host.__cells?.slots;\r\n if (!slots) return;\r\n for (const [key, snap] of layer) {\r\n slots.get(key)?.restoreFrom(snap);\r\n }\r\n}\r\n\r\n/**\r\n * Animated restore: tween the numeric / custom-tweenable props toward their\r\n * saved resolved values, then reapply the full snapshot so bindings are\r\n * restored (not frozen at the tween's landing value) and non-tweened props snap.\r\n *\r\n * A {@link Command} rather than a generator: `_prepareStep`'s stepper already\r\n * drives the tween as a pure function of elapsed time, so `driveCommand` wraps\r\n * it directly and fires the snapshot reapply exactly at `t === 1` — the same\r\n * \"commit at the end, restore what came before below it\" shape\r\n * `packages/components/code`'s `runTransition` uses.\r\n *\r\n * `_prepareStep` is called **lazily, on the command's first evaluation**, not\r\n * when this function runs — it snapshots each prop's `from` off the *live*\r\n * node, and a generator's body (what this replaces) never ran a line until the\r\n * caller's first `.next()` either. Building it eagerly would snapshot whatever\r\n * the node happened to hold at `restore()`-call time instead of at first-drive\r\n * time, which can differ if the caller does more to the node in between.\r\n */\r\n/** @internal */\r\nexport function restoreAnimated(\r\n host: ReactiveHost,\r\n layer: PropLayer | undefined,\r\n duration: number,\r\n easing?: EasingFunction,\r\n): Command<Record<string, never>> {\r\n let stepper: TweenStepper | null = null;\r\n\r\n return driveCommand(duration, (t) => {\r\n if (!stepper) {\r\n // `to()` reads each snapshot's resolved `value` (correct even for a\r\n // bound slot), so the node animates back to where it *was*.\r\n const target: Record<string, unknown> = {};\r\n if (layer) {\r\n for (const [key, snap] of layer) {\r\n target[key] = snap.value;\r\n }\r\n }\r\n stepper = host._prepareStep(target, duration);\r\n }\r\n stepper.seek(t * duration);\r\n if (layer && t >= 1) applySnapshotLayer(host, layer);\r\n }, easing);\r\n}\r\n"]}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * A node's place on the scene's clock, read via `node.time`.
3
+ *
4
+ * Advanced once per frame by `Node.attach`, and consumed by motion sampling,
5
+ * the render context's `elapsed`, and anything a node's own `tick()` derives
6
+ * from time.
7
+ *
8
+ * `creation` is seeded on the node's **first** advance rather than at
9
+ * construction, so `elapsed` measures how long a node has been *in the scene* —
10
+ * which is what an entrance animation, a video's playhead and a per-node
11
+ * dissolve all actually mean. A node built during the generator's third second
12
+ * and added then reads `elapsed === 0` on its first frame.
13
+ */
14
+ export interface NodeTime {
15
+ /** Seconds since the clip started. */
16
+ readonly total: number;
17
+ /** The clip time at which this node was first advanced. */
18
+ readonly creation: number;
19
+ /** How long this node has existed: `total - creation`. */
20
+ readonly elapsed: number;
21
+ }
22
+ /**
23
+ * The writable form the runtime advances. Nodes hand out {@link NodeTime}, which
24
+ * is the same shape with every field read-only.
25
+ *
26
+ * @internal
27
+ */
28
+ export interface MutableNodeTime {
29
+ total: number;
30
+ creation: number;
31
+ elapsed: number;
32
+ /** Whether {@link advanceNodeTime} has seeded `creation` yet. */
33
+ started: boolean;
34
+ }
35
+ /** The zeroed holder a node keeps for its lifetime. @internal */
36
+ export declare function createNodeTime(): MutableNodeTime;
37
+ /** Advance `time` to `total` clip-seconds, seeding `creation` on first tick. @internal */
38
+ export declare function advanceNodeTime(time: MutableNodeTime, total: number): void;
39
+ //# sourceMappingURL=node-time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-time.d.ts","sourceRoot":"","sources":["../../../../src/components/trees/node/node-time.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,QAAQ;IACrB,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,iEAAiE;AACjE,wBAAgB,cAAc,IAAI,eAAe,CAEhD;AAED,0FAA0F;AAC1F,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAO1E"}
@@ -0,0 +1,14 @@
1
+ /** The zeroed holder a node keeps for its lifetime. @internal */
2
+ export function createNodeTime() {
3
+ return { total: 0, creation: 0, elapsed: 0, started: false };
4
+ }
5
+ /** Advance `time` to `total` clip-seconds, seeding `creation` on first tick. @internal */
6
+ export function advanceNodeTime(time, total) {
7
+ if (!time.started) {
8
+ time.creation = total;
9
+ time.started = true;
10
+ }
11
+ time.total = total;
12
+ time.elapsed = total - time.creation;
13
+ }
14
+ //# sourceMappingURL=node-time.js.map