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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (767) hide show
  1. package/CHANGELOG.md +282 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +48 -0
  4. package/README.md +93 -72
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.d.ts +9 -0
  7. package/dist/assets/catalog.d.ts.map +1 -1
  8. package/dist/assets/catalog.js +11 -0
  9. package/dist/assets/catalog.js.map +1 -1
  10. package/dist/assets/errors.d.ts.map +1 -1
  11. package/dist/assets/errors.js +8 -3
  12. package/dist/assets/errors.js.map +1 -1
  13. package/dist/assets/index.js.map +1 -1
  14. package/dist/assets/manager.d.ts +26 -1
  15. package/dist/assets/manager.d.ts.map +1 -1
  16. package/dist/assets/manager.js +93 -11
  17. package/dist/assets/manager.js.map +1 -1
  18. package/dist/assets/manifest.js.map +1 -1
  19. package/dist/assets/record.js.map +1 -1
  20. package/dist/assets/scope.d.ts +3 -3
  21. package/dist/assets/scope.d.ts.map +1 -1
  22. package/dist/assets/scope.js.map +1 -1
  23. package/dist/attributes/audio/filters/chain.d.ts +1 -1
  24. package/dist/attributes/audio/filters/chain.js.map +1 -1
  25. package/dist/attributes/audio/filters/curve.d.ts +8 -8
  26. package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
  27. package/dist/attributes/audio/filters/curve.js +20 -19
  28. package/dist/attributes/audio/filters/curve.js.map +1 -1
  29. package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
  30. package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
  31. package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
  32. package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
  33. package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
  34. package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
  35. package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
  36. package/dist/attributes/audio/filters/index.d.ts +1 -1
  37. package/dist/attributes/audio/filters/index.d.ts.map +1 -1
  38. package/dist/attributes/audio/filters/index.js +1 -1
  39. package/dist/attributes/audio/filters/index.js.map +1 -1
  40. package/dist/attributes/audio/filters/registry.js.map +1 -1
  41. package/dist/attributes/audio/filters/union.js.map +1 -1
  42. package/dist/attributes/audio/request.d.ts +32 -4
  43. package/dist/attributes/audio/request.d.ts.map +1 -1
  44. package/dist/attributes/audio/request.js +9 -1
  45. package/dist/attributes/audio/request.js.map +1 -1
  46. package/dist/attributes/audio/schedule.d.ts +11 -2
  47. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  48. package/dist/attributes/audio/schedule.js +15 -8
  49. package/dist/attributes/audio/schedule.js.map +1 -1
  50. package/dist/attributes/audio/sound.d.ts +4 -2
  51. package/dist/attributes/audio/sound.d.ts.map +1 -1
  52. package/dist/attributes/audio/sound.js +8 -4
  53. package/dist/attributes/audio/sound.js.map +1 -1
  54. package/dist/attributes/index.d.ts +1 -0
  55. package/dist/attributes/index.d.ts.map +1 -1
  56. package/dist/attributes/index.js +1 -0
  57. package/dist/attributes/index.js.map +1 -1
  58. package/dist/attributes/layout/alignment.js +1 -1
  59. package/dist/attributes/layout/alignment.js.map +1 -1
  60. package/dist/attributes/layout/index.js.map +1 -1
  61. package/dist/attributes/layout/insets.js.map +1 -1
  62. package/dist/attributes/layout/matrix2d.js.map +1 -1
  63. package/dist/attributes/layout/size.js.map +1 -1
  64. package/dist/attributes/layout/transform3d.js.map +1 -1
  65. package/dist/attributes/layout/vector2.js.map +1 -1
  66. package/dist/attributes/layout/world-transform.js.map +1 -1
  67. package/dist/attributes/mask/boolean.js.map +1 -1
  68. package/dist/attributes/mask/mask.js.map +1 -1
  69. package/dist/attributes/properties/decorator.d.ts +17 -6
  70. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  71. package/dist/attributes/properties/decorator.js +26 -14
  72. package/dist/attributes/properties/decorator.js.map +1 -1
  73. package/dist/attributes/properties/inputs.js.map +1 -1
  74. package/dist/attributes/properties/typed.d.ts +9 -2
  75. package/dist/attributes/properties/typed.d.ts.map +1 -1
  76. package/dist/attributes/properties/typed.js +15 -1
  77. package/dist/attributes/properties/typed.js.map +1 -1
  78. package/dist/attributes/render3d/orbit.d.ts +8 -8
  79. package/dist/attributes/render3d/orbit.js +7 -7
  80. package/dist/attributes/render3d/orbit.js.map +1 -1
  81. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  82. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  83. package/dist/attributes/shape/corners/corners.js.map +1 -1
  84. package/dist/attributes/shape/corners/index.js.map +1 -1
  85. package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
  86. package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
  87. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  88. package/dist/attributes/shape/effects/chain.d.ts +28 -120
  89. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  90. package/dist/attributes/shape/effects/chain.js +16 -88
  91. package/dist/attributes/shape/effects/chain.js.map +1 -1
  92. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  96. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  97. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  98. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  99. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  100. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
  101. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  102. package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
  103. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  104. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  105. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  106. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  107. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  108. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
  110. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  112. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  114. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  116. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  118. package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
  119. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  120. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  122. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  124. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  126. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  128. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  130. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  132. package/dist/attributes/shape/effects/implementations/shader.js +15 -8
  133. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  134. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  136. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  137. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  138. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  139. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  140. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  141. package/dist/attributes/shape/effects/index.d.ts +2 -6
  142. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  143. package/dist/attributes/shape/effects/index.js.map +1 -1
  144. package/dist/attributes/shape/effects/registry.d.ts +23 -6
  145. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  146. package/dist/attributes/shape/effects/registry.js +44 -10
  147. package/dist/attributes/shape/effects/registry.js.map +1 -1
  148. package/dist/attributes/shape/effects/union.d.ts +2 -6
  149. package/dist/attributes/shape/effects/union.d.ts.map +1 -1
  150. package/dist/attributes/shape/effects/union.js.map +1 -1
  151. package/dist/attributes/shape/fill/blend.js.map +1 -1
  152. package/dist/attributes/shape/fill/chain.js.map +1 -1
  153. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  154. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  155. package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
  156. package/dist/attributes/shape/fill/color/parser.js +81 -44
  157. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  158. package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
  159. package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
  160. package/dist/attributes/shape/fill/gradient-stops.js +65 -0
  161. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
  162. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  163. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  164. package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
  165. package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
  166. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  167. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  168. package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
  169. package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
  170. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  171. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  172. package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
  173. package/dist/attributes/shape/fill/implementations/image.js +5 -4
  174. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  175. package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
  176. package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
  177. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  178. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  179. package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
  180. package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
  181. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  182. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  183. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  184. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  185. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  186. package/dist/attributes/shape/fill/index.js.map +1 -1
  187. package/dist/attributes/shape/fill/lerp.d.ts +9 -1
  188. package/dist/attributes/shape/fill/lerp.d.ts.map +1 -1
  189. package/dist/attributes/shape/fill/lerp.js +12 -1
  190. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  191. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  192. package/dist/attributes/shape/fill/registry.js.map +1 -1
  193. package/dist/attributes/shape/fill/union.js.map +1 -1
  194. package/dist/attributes/shape/filters/chain.d.ts +4 -10
  195. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  196. package/dist/attributes/shape/filters/chain.js +1 -13
  197. package/dist/attributes/shape/filters/chain.js.map +1 -1
  198. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  199. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  200. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  201. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  202. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  203. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  204. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  205. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  206. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  207. package/dist/attributes/shape/filters/index.d.ts +1 -1
  208. package/dist/attributes/shape/filters/index.js.map +1 -1
  209. package/dist/attributes/shape/filters/registry.d.ts +2 -2
  210. package/dist/attributes/shape/filters/registry.js +3 -3
  211. package/dist/attributes/shape/filters/registry.js.map +1 -1
  212. package/dist/attributes/shape/filters/union.d.ts +6 -7
  213. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  214. package/dist/attributes/shape/filters/union.js.map +1 -1
  215. package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
  216. package/dist/attributes/shape/path/anchors.js +12 -5
  217. package/dist/attributes/shape/path/anchors.js.map +1 -1
  218. package/dist/attributes/shape/path/bezier.js.map +1 -1
  219. package/dist/attributes/shape/path/index.js.map +1 -1
  220. package/dist/attributes/shape/path/measure.js.map +1 -1
  221. package/dist/attributes/shape/path/morph.d.ts.map +1 -1
  222. package/dist/attributes/shape/path/morph.js +16 -4
  223. package/dist/attributes/shape/path/morph.js.map +1 -1
  224. package/dist/attributes/shape/path/ops.js.map +1 -1
  225. package/dist/attributes/shape/path/types.js.map +1 -1
  226. package/dist/attributes/shape/path/walk.js.map +1 -1
  227. package/dist/attributes/shape/shaders/index.js.map +1 -1
  228. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  229. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  230. package/dist/attributes/shape/shadow/index.js.map +1 -1
  231. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  232. package/dist/attributes/shape/stroke/index.d.ts +2 -2
  233. package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
  234. package/dist/attributes/shape/stroke/index.js +1 -1
  235. package/dist/attributes/shape/stroke/index.js.map +1 -1
  236. package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
  237. package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
  238. package/dist/attributes/shape/stroke/stroke.js +22 -2
  239. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  240. package/dist/attributes/shared/operators.js.map +1 -1
  241. package/dist/attributes/text/index.js.map +1 -1
  242. package/dist/attributes/text/ops.d.ts +6 -0
  243. package/dist/attributes/text/ops.d.ts.map +1 -1
  244. package/dist/attributes/text/ops.js +1 -0
  245. package/dist/attributes/text/ops.js.map +1 -1
  246. package/dist/attributes/text/types.js.map +1 -1
  247. package/dist/browser/chunks/chunk-FUZVFT3W.js +18 -0
  248. package/dist/browser/chunks/chunk-FUZVFT3W.js.map +7 -0
  249. package/dist/browser/chunks/chunk-QG6C23IJ.js +3 -0
  250. package/dist/browser/chunks/chunk-QG6C23IJ.js.map +7 -0
  251. package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
  252. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
  253. package/dist/browser/component.js +1 -1
  254. package/dist/browser/component.js.map +3 -3
  255. package/dist/browser/index.js +1 -1
  256. package/dist/browser/index.js.map +4 -4
  257. package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
  258. package/dist/browser/jsx-jsx-runtime.js +1 -1
  259. package/dist/browser/manifest.json +3 -2
  260. package/dist/browser/sdk.js +1 -1
  261. package/dist/component.js.map +1 -1
  262. package/dist/document/audio.d.ts +1 -1
  263. package/dist/document/audio.js +4 -4
  264. package/dist/document/audio.js.map +1 -1
  265. package/dist/document/builtins.d.ts.map +1 -1
  266. package/dist/document/builtins.js +8 -14
  267. package/dist/document/builtins.js.map +1 -1
  268. package/dist/document/command-traits.d.ts +1 -1
  269. package/dist/document/command-traits.d.ts.map +1 -1
  270. package/dist/document/command-traits.js +17 -3
  271. package/dist/document/command-traits.js.map +1 -1
  272. package/dist/document/deny-globals.js.map +1 -1
  273. package/dist/document/diff.js.map +1 -1
  274. package/dist/document/doc-index.d.ts +2 -2
  275. package/dist/document/doc-index.d.ts.map +1 -1
  276. package/dist/document/doc-index.js.map +1 -1
  277. package/dist/document/expression/compile.d.ts.map +1 -1
  278. package/dist/document/expression/compile.js +8 -5
  279. package/dist/document/expression/compile.js.map +1 -1
  280. package/dist/document/expression/index.js.map +1 -1
  281. package/dist/document/expression/ops.js +1 -1
  282. package/dist/document/expression/ops.js.map +1 -1
  283. package/dist/document/expression/parse.d.ts.map +1 -1
  284. package/dist/document/expression/parse.js +15 -6
  285. package/dist/document/expression/parse.js.map +1 -1
  286. package/dist/document/expression/refs.d.ts +1 -1
  287. package/dist/document/expression/refs.js +1 -1
  288. package/dist/document/expression/refs.js.map +1 -1
  289. package/dist/document/expression/types.js.map +1 -1
  290. package/dist/document/expression/walk.d.ts.map +1 -1
  291. package/dist/document/expression/walk.js +2 -1
  292. package/dist/document/expression/walk.js.map +1 -1
  293. package/dist/document/index.d.ts +2 -0
  294. package/dist/document/index.d.ts.map +1 -1
  295. package/dist/document/index.js +2 -0
  296. package/dist/document/index.js.map +1 -1
  297. package/dist/document/node-decorator.js.map +1 -1
  298. package/dist/document/node-descriptor.d.ts +19 -0
  299. package/dist/document/node-descriptor.d.ts.map +1 -1
  300. package/dist/document/node-descriptor.js.map +1 -1
  301. package/dist/document/placement.d.ts +70 -0
  302. package/dist/document/placement.d.ts.map +1 -0
  303. package/dist/document/placement.js +83 -0
  304. package/dist/document/placement.js.map +1 -0
  305. package/dist/document/project.d.ts +2 -2
  306. package/dist/document/project.d.ts.map +1 -1
  307. package/dist/document/project.js.map +1 -1
  308. package/dist/document/registry.d.ts +34 -16
  309. package/dist/document/registry.d.ts.map +1 -1
  310. package/dist/document/registry.js +51 -12
  311. package/dist/document/registry.js.map +1 -1
  312. package/dist/document/timeline-patch.js.map +1 -1
  313. package/dist/document/timeline.d.ts +73 -18
  314. package/dist/document/timeline.d.ts.map +1 -1
  315. package/dist/document/timeline.js +192 -40
  316. package/dist/document/timeline.js.map +1 -1
  317. package/dist/document/types.d.ts +12 -12
  318. package/dist/document/types.d.ts.map +1 -1
  319. package/dist/document/types.js +2 -2
  320. package/dist/document/types.js.map +1 -1
  321. package/dist/document/validate.d.ts +2 -2
  322. package/dist/document/validate.d.ts.map +1 -1
  323. package/dist/document/validate.js +37 -31
  324. package/dist/document/validate.js.map +1 -1
  325. package/dist/document/withdraw.d.ts +28 -0
  326. package/dist/document/withdraw.d.ts.map +1 -0
  327. package/dist/document/withdraw.js +61 -0
  328. package/dist/document/withdraw.js.map +1 -0
  329. package/dist/index.d.ts +1 -0
  330. package/dist/index.d.ts.map +1 -1
  331. package/dist/index.js +1 -0
  332. package/dist/index.js.map +1 -1
  333. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  334. package/dist/jsx/jsx-runtime.d.ts +9 -1
  335. package/dist/jsx/jsx-runtime.d.ts.map +1 -1
  336. package/dist/jsx/jsx-runtime.js +13 -3
  337. package/dist/jsx/jsx-runtime.js.map +1 -1
  338. package/dist/layout/bounds.d.ts +0 -1
  339. package/dist/layout/bounds.d.ts.map +1 -1
  340. package/dist/layout/bounds.js.map +1 -1
  341. package/dist/layout/constraints.js.map +1 -1
  342. package/dist/layout/flex.d.ts +4 -2
  343. package/dist/layout/flex.d.ts.map +1 -1
  344. package/dist/layout/flex.js +27 -11
  345. package/dist/layout/flex.js.map +1 -1
  346. package/dist/layout/freeform.js.map +1 -1
  347. package/dist/layout/grid.js.map +1 -1
  348. package/dist/layout/index.js.map +1 -1
  349. package/dist/layout/item.js.map +1 -1
  350. package/dist/layout/ops.d.ts +6 -0
  351. package/dist/layout/ops.d.ts.map +1 -1
  352. package/dist/layout/ops.js +6 -0
  353. package/dist/layout/ops.js.map +1 -1
  354. package/dist/layout/types.js.map +1 -1
  355. package/dist/nodes/2d/node-lifecycle.js.map +1 -1
  356. package/dist/nodes/2d/node-motion.js.map +1 -1
  357. package/dist/nodes/2d/node-render.d.ts +3 -3
  358. package/dist/nodes/2d/node-render.d.ts.map +1 -1
  359. package/dist/nodes/2d/node-render.js.map +1 -1
  360. package/dist/nodes/2d/node-transform.js.map +1 -1
  361. package/dist/nodes/2d/node2d.d.ts +115 -3
  362. package/dist/nodes/2d/node2d.d.ts.map +1 -1
  363. package/dist/nodes/2d/node2d.js +188 -32
  364. package/dist/nodes/2d/node2d.js.map +1 -1
  365. package/dist/nodes/2d/paint-node.d.ts +27 -0
  366. package/dist/nodes/2d/paint-node.d.ts.map +1 -1
  367. package/dist/nodes/2d/paint-node.js +42 -0
  368. package/dist/nodes/2d/paint-node.js.map +1 -1
  369. package/dist/nodes/audio/audio-bus.js.map +1 -1
  370. package/dist/nodes/audio/index.js.map +1 -1
  371. package/dist/nodes/audio/node-audio.d.ts +3 -2
  372. package/dist/nodes/audio/node-audio.d.ts.map +1 -1
  373. package/dist/nodes/audio/node-audio.js +8 -5
  374. package/dist/nodes/audio/node-audio.js.map +1 -1
  375. package/dist/nodes/audio/sound-node.d.ts +2 -2
  376. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  377. package/dist/nodes/audio/sound-node.js +2 -2
  378. package/dist/nodes/audio/sound-node.js.map +1 -1
  379. package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
  380. package/dist/nodes/geometry/bounds-shape-node.js +2 -2
  381. package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
  382. package/dist/nodes/geometry/box-path-node.d.ts +3 -3
  383. package/dist/nodes/geometry/box-path-node.js +2 -2
  384. package/dist/nodes/geometry/box-path-node.js.map +1 -1
  385. package/dist/nodes/geometry/ellipse-node.js.map +1 -1
  386. package/dist/nodes/geometry/group-bounds.d.ts +2 -2
  387. package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
  388. package/dist/nodes/geometry/group-bounds.js +1 -2
  389. package/dist/nodes/geometry/group-bounds.js.map +1 -1
  390. package/dist/nodes/geometry/path-node.d.ts.map +1 -1
  391. package/dist/nodes/geometry/path-node.js +6 -0
  392. package/dist/nodes/geometry/path-node.js.map +1 -1
  393. package/dist/nodes/geometry/polygon-node.js.map +1 -1
  394. package/dist/nodes/geometry/polygram-node.js.map +1 -1
  395. package/dist/nodes/geometry/rect-node.js.map +1 -1
  396. package/dist/nodes/geometry/shape-node.js.map +1 -1
  397. package/dist/nodes/geometry/shape-outline.d.ts +2 -2
  398. package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
  399. package/dist/nodes/geometry/shape-outline.js +2 -13
  400. package/dist/nodes/geometry/shape-outline.js.map +1 -1
  401. package/dist/nodes/index.d.ts +3 -8
  402. package/dist/nodes/index.d.ts.map +1 -1
  403. package/dist/nodes/index.js +3 -8
  404. package/dist/nodes/index.js.map +1 -1
  405. package/dist/nodes/layout/camera-node.d.ts +9 -0
  406. package/dist/nodes/layout/camera-node.d.ts.map +1 -1
  407. package/dist/nodes/layout/camera-node.js +38 -3
  408. package/dist/nodes/layout/camera-node.js.map +1 -1
  409. package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
  410. package/dist/nodes/layout/orbit-camera-node.js +1 -1
  411. package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
  412. package/dist/nodes/layout/rotated-box.js.map +1 -1
  413. package/dist/nodes/media/video-node.d.ts.map +1 -1
  414. package/dist/nodes/media/video-node.js +5 -3
  415. package/dist/nodes/media/video-node.js.map +1 -1
  416. package/dist/nodes/node/declare-paints.js.map +1 -1
  417. package/dist/nodes/node/node-editor-state.js.map +1 -1
  418. package/dist/nodes/node/node-reactive.js.map +1 -1
  419. package/dist/nodes/node/node-time.d.ts +3 -3
  420. package/dist/nodes/node/node-time.d.ts.map +1 -1
  421. package/dist/nodes/node/node-time.js +1 -1
  422. package/dist/nodes/node/node-time.js.map +1 -1
  423. package/dist/nodes/node/node-walk.js.map +1 -1
  424. package/dist/nodes/node/node.d.ts +5 -3
  425. package/dist/nodes/node/node.d.ts.map +1 -1
  426. package/dist/nodes/node/node.js +44 -19
  427. package/dist/nodes/node/node.js.map +1 -1
  428. package/dist/nodes/node/text-defaults.d.ts +10 -12
  429. package/dist/nodes/node/text-defaults.d.ts.map +1 -1
  430. package/dist/nodes/node/text-defaults.js +10 -12
  431. package/dist/nodes/node/text-defaults.js.map +1 -1
  432. package/dist/nodes/{scene → root}/canvas2d-node.d.ts +2 -2
  433. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
  434. package/dist/nodes/{scene → root}/canvas2d-node.js +2 -2
  435. package/dist/nodes/root/canvas2d-node.js.map +1 -0
  436. package/dist/nodes/root/provider-node.d.ts.map +1 -0
  437. package/dist/nodes/root/provider-node.js.map +1 -0
  438. package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
  439. package/dist/nodes/root/theme-provider-node.js.map +1 -0
  440. package/dist/nodes/text/default-text-style-node.d.ts +5 -2
  441. package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
  442. package/dist/nodes/text/default-text-style-node.js +10 -4
  443. package/dist/nodes/text/default-text-style-node.js.map +1 -1
  444. package/dist/nodes/text/number-format.d.ts +1 -1
  445. package/dist/nodes/text/number-format.js +1 -1
  446. package/dist/nodes/text/number-format.js.map +1 -1
  447. package/dist/nodes/text/number-node.js.map +1 -1
  448. package/dist/nodes/text/number-pattern.js.map +1 -1
  449. package/dist/nodes/text/richtext-node.js +1 -1
  450. package/dist/nodes/text/richtext-node.js.map +1 -1
  451. package/dist/nodes/text/text-base.d.ts.map +1 -1
  452. package/dist/nodes/text/text-base.js +1 -1
  453. package/dist/nodes/text/text-base.js.map +1 -1
  454. package/dist/nodes/text/text-node.js.map +1 -1
  455. package/dist/nodes/text/text-selection.js.map +1 -1
  456. package/dist/nodes/three/camera-nodes.d.ts +21 -3
  457. package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
  458. package/dist/nodes/three/camera-nodes.js +42 -1
  459. package/dist/nodes/three/camera-nodes.js.map +1 -1
  460. package/dist/nodes/three/canvas3d-node.d.ts +29 -6
  461. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  462. package/dist/nodes/three/canvas3d-node.js +44 -2
  463. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  464. package/dist/nodes/three/drawable-nodes.d.ts +25 -11
  465. package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
  466. package/dist/nodes/three/drawable-nodes.js +43 -13
  467. package/dist/nodes/three/drawable-nodes.js.map +1 -1
  468. package/dist/nodes/three/environment-nodes.d.ts +9 -3
  469. package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
  470. package/dist/nodes/three/environment-nodes.js.map +1 -1
  471. package/dist/nodes/three/geometry-nodes.d.ts +2 -2
  472. package/dist/nodes/three/geometry-nodes.js +2 -2
  473. package/dist/nodes/three/geometry-nodes.js.map +1 -1
  474. package/dist/nodes/three/grid-geometry3d.js.map +1 -1
  475. package/dist/nodes/three/group3d.js.map +1 -1
  476. package/dist/nodes/three/light-nodes.d.ts.map +1 -1
  477. package/dist/nodes/three/light-nodes.js +3 -3
  478. package/dist/nodes/three/light-nodes.js.map +1 -1
  479. package/dist/nodes/three/mesh3d.js.map +1 -1
  480. package/dist/nodes/three/node3d.d.ts +48 -0
  481. package/dist/nodes/three/node3d.d.ts.map +1 -1
  482. package/dist/nodes/three/node3d.js +53 -3
  483. package/dist/nodes/three/node3d.js.map +1 -1
  484. package/dist/platform/audio-sink.d.ts +2 -2
  485. package/dist/platform/audio-sink.d.ts.map +1 -1
  486. package/dist/platform/audio-sink.js.map +1 -1
  487. package/dist/platform/exporter.d.ts +13 -8
  488. package/dist/platform/exporter.d.ts.map +1 -1
  489. package/dist/platform/exporter.js.map +1 -1
  490. package/dist/platform/index.d.ts +1 -1
  491. package/dist/platform/index.d.ts.map +1 -1
  492. package/dist/platform/index.js.map +1 -1
  493. package/dist/platform/stepped-clock.js.map +1 -1
  494. package/dist/platform/storage-adapter.d.ts +12 -6
  495. package/dist/platform/storage-adapter.d.ts.map +1 -1
  496. package/dist/platform/storage-adapter.js +4 -0
  497. package/dist/platform/storage-adapter.js.map +1 -1
  498. package/dist/platform/ticker.d.ts +6 -0
  499. package/dist/platform/ticker.d.ts.map +1 -1
  500. package/dist/platform/ticker.js +6 -0
  501. package/dist/platform/ticker.js.map +1 -1
  502. package/dist/project/config.js.map +1 -1
  503. package/dist/project/index.js.map +1 -1
  504. package/dist/project/tree.d.ts +3 -3
  505. package/dist/project/tree.d.ts.map +1 -1
  506. package/dist/project/tree.js.map +1 -1
  507. package/dist/props/host.js.map +1 -1
  508. package/dist/props/index.js.map +1 -1
  509. package/dist/props/observer.js.map +1 -1
  510. package/dist/props/slot.js.map +1 -1
  511. package/dist/renamed-scene-names.d.ts +17 -0
  512. package/dist/renamed-scene-names.d.ts.map +1 -0
  513. package/dist/renamed-scene-names.js +9 -0
  514. package/dist/renamed-scene-names.js.map +1 -0
  515. package/dist/render/canvas-render-context2d.d.ts +10 -3
  516. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  517. package/dist/render/canvas-render-context2d.js +10 -0
  518. package/dist/render/canvas-render-context2d.js.map +1 -1
  519. package/dist/render/clip-contains.js.map +1 -1
  520. package/dist/render/clip.js.map +1 -1
  521. package/dist/render/descriptors/ellipse.js.map +1 -1
  522. package/dist/render/descriptors/latex.js.map +1 -1
  523. package/dist/render/descriptors/line.js.map +1 -1
  524. package/dist/render/descriptors/path-builder.js.map +1 -1
  525. package/dist/render/descriptors/path.js.map +1 -1
  526. package/dist/render/descriptors/polygon.js.map +1 -1
  527. package/dist/render/descriptors/polygram.js.map +1 -1
  528. package/dist/render/descriptors/rect.js.map +1 -1
  529. package/dist/render/descriptors/richtext.js.map +1 -1
  530. package/dist/render/descriptors/shape.d.ts +12 -0
  531. package/dist/render/descriptors/shape.d.ts.map +1 -1
  532. package/dist/render/descriptors/shape.js.map +1 -1
  533. package/dist/render/descriptors/text.d.ts +2 -2
  534. package/dist/render/descriptors/text.js +2 -2
  535. package/dist/render/descriptors/text.js.map +1 -1
  536. package/dist/render/descriptors/transform.d.ts +2 -2
  537. package/dist/render/descriptors/transform.d.ts.map +1 -1
  538. package/dist/render/descriptors/transform.js.map +1 -1
  539. package/dist/render/graphics2d.d.ts +3 -3
  540. package/dist/render/graphics2d.d.ts.map +1 -1
  541. package/dist/render/graphics2d.js +1 -1
  542. package/dist/render/graphics2d.js.map +1 -1
  543. package/dist/render/index.js.map +1 -1
  544. package/dist/render/measure-context.js.map +1 -1
  545. package/dist/render/null-render-context.js.map +1 -1
  546. package/dist/render/render-context2d.d.ts +5 -5
  547. package/dist/render/render-context2d.d.ts.map +1 -1
  548. package/dist/render/render-context2d.js.map +1 -1
  549. package/dist/render/surface.js.map +1 -1
  550. package/dist/render/text-defaults.js.map +1 -1
  551. package/dist/render/text-layout.js.map +1 -1
  552. package/dist/render3d/bounds3d.d.ts.map +1 -1
  553. package/dist/render3d/bounds3d.js +4 -2
  554. package/dist/render3d/bounds3d.js.map +1 -1
  555. package/dist/render3d/builders.js.map +1 -1
  556. package/dist/render3d/camera.d.ts +6 -0
  557. package/dist/render3d/camera.d.ts.map +1 -1
  558. package/dist/render3d/camera.js +5 -3
  559. package/dist/render3d/camera.js.map +1 -1
  560. package/dist/render3d/fill3d.d.ts +2 -9
  561. package/dist/render3d/fill3d.d.ts.map +1 -1
  562. package/dist/render3d/fill3d.js +2 -13
  563. package/dist/render3d/fill3d.js.map +1 -1
  564. package/dist/render3d/geometry.d.ts +8 -1
  565. package/dist/render3d/geometry.d.ts.map +1 -1
  566. package/dist/render3d/geometry.js.map +1 -1
  567. package/dist/render3d/graphics3d.d.ts +8 -4
  568. package/dist/render3d/graphics3d.d.ts.map +1 -1
  569. package/dist/render3d/graphics3d.js +18 -10
  570. package/dist/render3d/graphics3d.js.map +1 -1
  571. package/dist/render3d/index.d.ts +1 -1
  572. package/dist/render3d/index.js +1 -1
  573. package/dist/render3d/index.js.map +1 -1
  574. package/dist/render3d/inert.d.ts +14 -0
  575. package/dist/render3d/inert.d.ts.map +1 -0
  576. package/dist/render3d/inert.js +62 -0
  577. package/dist/render3d/inert.js.map +1 -0
  578. package/dist/render3d/light.js.map +1 -1
  579. package/dist/render3d/material.d.ts +10 -5
  580. package/dist/render3d/material.d.ts.map +1 -1
  581. package/dist/render3d/material.js.map +1 -1
  582. package/dist/render3d/matrix4.js.map +1 -1
  583. package/dist/render3d/render-context3d.js.map +1 -1
  584. package/dist/render3d/resources.d.ts +2 -2
  585. package/dist/render3d/resources.js +2 -2
  586. package/dist/render3d/resources.js.map +1 -1
  587. package/dist/render3d/rounded-box.js.map +1 -1
  588. package/dist/render3d/scene-settings.d.ts +23 -4
  589. package/dist/render3d/scene-settings.d.ts.map +1 -1
  590. package/dist/render3d/scene-settings.js.map +1 -1
  591. package/dist/render3d/scene3d.d.ts +11 -0
  592. package/dist/render3d/scene3d.d.ts.map +1 -1
  593. package/dist/render3d/scene3d.js +39 -6
  594. package/dist/render3d/scene3d.js.map +1 -1
  595. package/dist/render3d/segments.js.map +1 -1
  596. package/dist/render3d/texture.d.ts +9 -0
  597. package/dist/render3d/texture.d.ts.map +1 -1
  598. package/dist/render3d/texture.js +13 -0
  599. package/dist/render3d/texture.js.map +1 -1
  600. package/dist/render3d/tracking.js.map +1 -1
  601. package/dist/render3d/transform.d.ts +1 -1
  602. package/dist/render3d/transform.js.map +1 -1
  603. package/dist/render3d/vector3.d.ts +18 -1
  604. package/dist/render3d/vector3.d.ts.map +1 -1
  605. package/dist/render3d/vector3.js +27 -0
  606. package/dist/render3d/vector3.js.map +1 -1
  607. package/dist/render3d/walk.d.ts +1 -1
  608. package/dist/render3d/walk.d.ts.map +1 -1
  609. package/dist/render3d/walk.js +5 -1
  610. package/dist/render3d/walk.js.map +1 -1
  611. package/dist/runtime/asset-refine.js.map +1 -1
  612. package/dist/runtime/asset-timeline.js.map +1 -1
  613. package/dist/runtime/asset-update.js.map +1 -1
  614. package/dist/runtime/audio-index.d.ts +2 -2
  615. package/dist/runtime/audio-index.d.ts.map +1 -1
  616. package/dist/runtime/audio-index.js +8 -2
  617. package/dist/runtime/audio-index.js.map +1 -1
  618. package/dist/runtime/builtin-context.js.map +1 -1
  619. package/dist/runtime/clip-instance.d.ts +5 -3
  620. package/dist/runtime/clip-instance.d.ts.map +1 -1
  621. package/dist/runtime/clip-instance.js +10 -6
  622. package/dist/runtime/clip-instance.js.map +1 -1
  623. package/dist/runtime/clip-store.d.ts +9 -0
  624. package/dist/runtime/clip-store.d.ts.map +1 -1
  625. package/dist/runtime/clip-store.js +33 -3
  626. package/dist/runtime/clip-store.js.map +1 -1
  627. package/dist/runtime/engine.d.ts +5 -0
  628. package/dist/runtime/engine.d.ts.map +1 -1
  629. package/dist/runtime/engine.js +2 -0
  630. package/dist/runtime/engine.js.map +1 -1
  631. package/dist/runtime/frame-time.d.ts +31 -0
  632. package/dist/runtime/frame-time.d.ts.map +1 -0
  633. package/dist/runtime/frame-time.js +29 -0
  634. package/dist/runtime/frame-time.js.map +1 -0
  635. package/dist/runtime/index.d.ts +1 -0
  636. package/dist/runtime/index.d.ts.map +1 -1
  637. package/dist/runtime/index.js +1 -0
  638. package/dist/runtime/index.js.map +1 -1
  639. package/dist/runtime/node-picking.d.ts +44 -3
  640. package/dist/runtime/node-picking.d.ts.map +1 -1
  641. package/dist/runtime/node-picking.js +118 -3
  642. package/dist/runtime/node-picking.js.map +1 -1
  643. package/dist/runtime/node-picking3d.d.ts +2 -1
  644. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  645. package/dist/runtime/node-picking3d.js +5 -2
  646. package/dist/runtime/node-picking3d.js.map +1 -1
  647. package/dist/runtime/placement.d.ts.map +1 -1
  648. package/dist/runtime/placement.js +4 -5
  649. package/dist/runtime/placement.js.map +1 -1
  650. package/dist/runtime/playback-controller.d.ts +31 -2
  651. package/dist/runtime/playback-controller.d.ts.map +1 -1
  652. package/dist/runtime/playback-controller.js +63 -6
  653. package/dist/runtime/playback-controller.js.map +1 -1
  654. package/dist/runtime/playback.js.map +1 -1
  655. package/dist/runtime/precompisition.js.map +1 -1
  656. package/dist/runtime/project-assets.js.map +1 -1
  657. package/dist/runtime/session.d.ts +9 -7
  658. package/dist/runtime/session.d.ts.map +1 -1
  659. package/dist/runtime/session.js +12 -4
  660. package/dist/runtime/session.js.map +1 -1
  661. package/dist/runtime/settle.js.map +1 -1
  662. package/dist/runtime/state-evaluator.d.ts +1 -1
  663. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  664. package/dist/runtime/state-evaluator.js +4 -3
  665. package/dist/runtime/state-evaluator.js.map +1 -1
  666. package/dist/runtime/text-geometry.js.map +1 -1
  667. package/dist/sdk/index.d.ts +27 -22
  668. package/dist/sdk/index.d.ts.map +1 -1
  669. package/dist/sdk/index.js +23 -9
  670. package/dist/sdk/index.js.map +1 -1
  671. package/dist/tween/command-decorator.d.ts +12 -4
  672. package/dist/tween/command-decorator.d.ts.map +1 -1
  673. package/dist/tween/command-decorator.js +10 -22
  674. package/dist/tween/command-decorator.js.map +1 -1
  675. package/dist/tween/command.js.map +1 -1
  676. package/dist/tween/ease/constants.d.ts.map +1 -1
  677. package/dist/tween/ease/constants.js +8 -5
  678. package/dist/tween/ease/constants.js.map +1 -1
  679. package/dist/tween/ease/curve.d.ts.map +1 -1
  680. package/dist/tween/ease/curve.js +4 -3
  681. package/dist/tween/ease/curve.js.map +1 -1
  682. package/dist/tween/ease/describe.d.ts +15 -0
  683. package/dist/tween/ease/describe.d.ts.map +1 -0
  684. package/dist/tween/ease/describe.js +37 -0
  685. package/dist/tween/ease/describe.js.map +1 -0
  686. package/dist/tween/ease/type.js.map +1 -1
  687. package/dist/tween/index.js.map +1 -1
  688. package/dist/tween/inert.js.map +1 -1
  689. package/dist/tween/lerp.js.map +1 -1
  690. package/dist/tween/loop.js.map +1 -1
  691. package/dist/tween/prepare.d.ts +3 -3
  692. package/dist/tween/prepare.js +3 -3
  693. package/dist/tween/prepare.js.map +1 -1
  694. package/dist/tween/seekable.d.ts +12 -1
  695. package/dist/tween/seekable.d.ts.map +1 -1
  696. package/dist/tween/seekable.js +15 -0
  697. package/dist/tween/seekable.js.map +1 -1
  698. package/dist/tween/stepper.js.map +1 -1
  699. package/dist/tween/to-command.js.map +1 -1
  700. package/dist/util/clamp.js.map +1 -1
  701. package/dist/util/context.js.map +1 -1
  702. package/dist/util/csv.js.map +1 -1
  703. package/dist/util/generateList.js.map +1 -1
  704. package/dist/util/index.js.map +1 -1
  705. package/dist/util/metrics.d.ts +1 -1
  706. package/dist/util/metrics.js +1 -1
  707. package/dist/util/metrics.js.map +1 -1
  708. package/dist/util/random.js.map +1 -1
  709. package/dist/util/reference.js.map +1 -1
  710. package/dist/util/scheduler.js.map +1 -1
  711. package/package.json +2 -1
  712. package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
  713. package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
  714. package/dist/attributes/shape/effects/implementations/displace.js +0 -30
  715. package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
  716. package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
  717. package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
  718. package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
  719. package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
  720. package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
  721. package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
  722. package/dist/attributes/shape/effects/implementations/texture.js +0 -25
  723. package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
  724. package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
  725. package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
  726. package/dist/attributes/shape/effects/implementations/trails.js +0 -22
  727. package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
  728. package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
  729. package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
  730. package/dist/browser/chunks/chunk-P3XQCHDW.js +0 -16
  731. package/dist/browser/chunks/chunk-P3XQCHDW.js.map +0 -7
  732. package/dist/browser/chunks/chunk-VJQMKHGQ.js +0 -3
  733. package/dist/browser/chunks/chunk-VJQMKHGQ.js.map +0 -7
  734. package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
  735. package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
  736. package/dist/nodes/geometry/dot-grid-node.js +0 -142
  737. package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
  738. package/dist/nodes/geometry/grid-lines.d.ts +0 -101
  739. package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
  740. package/dist/nodes/geometry/grid-lines.js +0 -128
  741. package/dist/nodes/geometry/grid-lines.js.map +0 -1
  742. package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
  743. package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
  744. package/dist/nodes/geometry/grid-pattern-node.js +0 -172
  745. package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
  746. package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
  747. package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
  748. package/dist/nodes/geometry/line-grid-node.js +0 -127
  749. package/dist/nodes/geometry/line-grid-node.js.map +0 -1
  750. package/dist/nodes/geometry/line-node.d.ts +0 -58
  751. package/dist/nodes/geometry/line-node.d.ts.map +0 -1
  752. package/dist/nodes/geometry/line-node.js +0 -123
  753. package/dist/nodes/geometry/line-node.js.map +0 -1
  754. package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
  755. package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
  756. package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
  757. package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
  758. package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
  759. package/dist/nodes/scene/canvas2d-node.js.map +0 -1
  760. package/dist/nodes/scene/provider-node.d.ts.map +0 -1
  761. package/dist/nodes/scene/provider-node.js.map +0 -1
  762. package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
  763. package/dist/nodes/scene/theme-provider-node.js.map +0 -1
  764. /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
  765. /package/dist/nodes/{scene → root}/provider-node.js +0 -0
  766. /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
  767. /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"text-selection.js","sourceRoot":"","sources":["../../../src/nodes/text/text-selection.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,SAAS,EAAwB,MAAM,oBAAoB,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAA0B,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIrF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAwDpD,mFAAmF;AACnF,MAAM,aAAa,GAAG,IAAI,GAAG,CAA2B,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IACb,IAAI,CAAO;IACX,MAAM,CAAc;IAE7B;;;;OAIG;IACM,SAAS,CAAqB;IAEvC,YAAY,IAAU,EAAE,MAAmB;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,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CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { EasingFunction } from \"@/tween/ease/type\";\nimport { TweenStepper } from \"@/tween/stepper\";\nimport { toCommand, type AnimationTarget } from \"@/tween/to-command\";\nimport { Fill } from \"@/attributes/shape/fill/chain\";\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\nimport { Stroke, StrokeResolved, strokeOps } from \"@/attributes/shape/stroke/stroke\";\nimport type { FontStyle } from \"@/attributes/text/types\";\nimport type { Text } from \"./text-node\";\n\n/**\n * The size a selection's `fontSize` starts from on an `'autofit'` node.\n *\n * The same 100 the segmented layout probes with (`layoutTextSegments`), so a\n * selection that never touches its size reports the number that block is\n * actually shaped at rather than a second, different guess.\n */\nexport const AUTOFIT_PROBE_SIZE = 100;\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\n\n/** A half-open character range `[start, end)` of a Text node's string. */\nexport interface TextRange {\n start: number;\n end: number;\n}\n\n/**\n * Properties a {@link TextSelection} can animate. Transform/opacity/font fields\n * are numeric; `fill`/`stroke` accept any author-facing paint and are resolved\n * before tweening (mirroring how {@link Text} resolves its own paint).\n *\n * `fontFamily` and `fontStyle` are the two that cannot tween, and they are here\n * anyway: what a selection is for is styling a run differently from its\n * neighbours, and a model that can change a word's weight but not its face is\n * one an editor has to work around rather than with. They switch at the end of a\n * step rather than interpolating - see {@link TextSelection._prepareStep} - for\n * the same reason a blend mode does: there is no half-way between two typefaces,\n * and inventing one would be a frame of text set in neither.\n */\nexport interface TextSelectionProps {\n opacity: number;\n x: number;\n y: number;\n scale: number;\n rotation: number;\n fontFamily: string;\n fontSize: number;\n fontStyle: FontStyle;\n fontWeight: number;\n letterSpacing: number;\n fill: Fill;\n stroke: Stroke;\n}\n\n/**\n * Live, resolved override state for a selection, read by the Text node each\n * frame to build per-piece segments. `fill`/`stroke` are `null` until set,\n * meaning \"inherit the node's paint\".\n */\nexport interface SelectionOverrides {\n opacity: number;\n x: number;\n y: number;\n scale: number;\n rotation: number;\n fontFamily: string;\n fontSize: number;\n fontStyle: FontStyle;\n fontWeight: number;\n letterSpacing: number;\n fill: FillResolved[] | null;\n stroke: StrokeResolved[] | null;\n}\n\n/** The {@link SelectionOverrides} keys that hold a string rather than a number. */\nconst DISCRETE_KEYS = new Set<keyof TextSelectionProps>([\"fontFamily\", \"fontStyle\"]);\n\n/**\n * A sub-range of a {@link Text} node's glyphs that can be animated\n * independently. Returned by the node's selector methods (`find`, `match`,\n * `line`, `word`, `words`, `slice`, `filter`).\n *\n * Implements {@link AnimationTarget} so `selection.to({ ... }, duration)`\n * plugs straight into the existing `Command` / `parallel` / `sequence`\n * machinery — each tween writes resolved values into {@link overrides}, which\n * the node reads when splitting its text into rendered pieces.\n *\n * @example\n * textRef().find(\"hello\").to({ opacity: 0.5, y: -10 }, 1);\n */\nexport class TextSelection implements AnimationTarget<TextSelectionProps> {\n readonly node: Text;\n readonly ranges: TextRange[];\n\n /**\n * Current resolved overrides for this selection. Numeric fields default to\n * the node's current values (so a partial tween starts from the node's\n * style); `fill`/`stroke` start as `null` (inherit) until tweened.\n */\n readonly overrides: SelectionOverrides;\n\n constructor(node: Text, ranges: TextRange[]) {\n this.node = node;\n this.ranges = normalizeRanges(ranges, node.text.length);\n this.overrides = {\n opacity: 1,\n x: 0,\n y: 0,\n scale: 1,\n rotation: 0,\n fontFamily: node.fontFamily,\n // `'autofit'` is a *box* decision - the size the whole block settles\n // on - so it is not a per-run value at all. A selection on an autofit\n // node starts from the probe size the segmented layout shapes with,\n // and overriding it there is what \"this word, two sizes up\" means.\n fontSize: typeof node.fontSize === \"number\" ? node.fontSize : AUTOFIT_PROBE_SIZE,\n fontStyle: node.fontStyle,\n fontWeight: node.fontWeight,\n letterSpacing: node.letterSpacing,\n fill: null,\n stroke: null,\n };\n node._registerSelection(this);\n }\n\n /** True when this selection has no overrides differing from the node default. */\n get isIdentity(): boolean {\n const o = this.overrides;\n const nodeSize = typeof this.node.fontSize === \"number\"\n ? this.node.fontSize\n : AUTOFIT_PROBE_SIZE;\n return (\n o.opacity === 1 &&\n o.x === 0 &&\n o.y === 0 &&\n o.scale === 1 &&\n o.rotation === 0 &&\n o.fontFamily === this.node.fontFamily &&\n o.fontSize === nodeSize &&\n o.fontStyle === this.node.fontStyle &&\n o.fontWeight === this.node.fontWeight &&\n o.letterSpacing === this.node.letterSpacing &&\n o.fill === null &&\n o.stroke === null\n );\n }\n\n /**\n * Write overrides straight onto the selection - no tween, no command.\n *\n * `to()` is the animation door and this is the *styling* one: an editor that\n * paints one word red is stating what the run **is**, not scheduling it, and\n * a zero-length `to()` would say the same thing while also landing a step on\n * the node's timeline for something that never moves. Paints are resolved\n * here exactly as `to()` resolves them, so a run styled this way and a run\n * tweened to the same value hold identical resolved arrays.\n *\n * Returns `this`, so a range and its style read as one expression.\n */\n set(props: Partial<TextSelectionProps>): this {\n const o = this.overrides;\n for (const key of Object.keys(props) as Array<keyof TextSelectionProps>) {\n const value = props[key];\n if (value === undefined) continue;\n if (key === \"fill\") {\n o.fill = fillOps.resolve(value as Fill);\n } else if (key === \"stroke\") {\n o.stroke = strokeOps.resolve(value as Stroke);\n } else if (DISCRETE_KEYS.has(key)) {\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = value as string;\n } else if (typeof value === \"number\") {\n (o[key as \"opacity\"] as number) = value;\n }\n }\n return this;\n }\n\n @command()\n to<D extends Partial<TextSelectionProps> = Partial<TextSelectionProps>>(\n args: CommandArgs<D> & { duration: number },\n ): Command<TextSelectionProps> {\n return toCommand<TextSelectionProps>(this, args.data ?? {}, args.duration, args.easing);\n }\n\n /**\n * Resolve one `to()` step into a flat {@link TweenStepper}. Numeric props\n * (opacity/x/y/scale/rotation/fontWeight/letterSpacing) interpolate\n * directly; `fill`/`stroke` resolve their target once and lerp via the\n * shared fill/stroke array lerps — mirroring {@link Node2D._prepareStep}.\n */\n _prepareStep(\n to: Partial<TextSelectionProps>,\n duration: number,\n easing?: EasingFunction,\n ): TweenStepper {\n const o = this.overrides;\n const numeric: Array<{ key: keyof SelectionOverrides; from: number; to: number }> = [];\n const customLerps: Array<(t: number) => void> = [];\n\n for (const key of Object.keys(to) as Array<keyof TextSelectionProps>) {\n const target = to[key];\n if (target === undefined) continue;\n\n if (key === 'fill') {\n const from = o.fill ?? (this.node.fill as FillResolved[]);\n const resolved = fillOps.resolve(target as Fill);\n customLerps.push((t) => { o.fill = fillOps.lerp(from, resolved, t); });\n } else if (key === 'stroke') {\n const from = o.stroke ?? (this.node.stroke as StrokeResolved[]);\n const resolved = strokeOps.resolve(target as Stroke);\n customLerps.push((t) => { o.stroke = strokeOps.lerp(from, resolved, t); });\n } else if (DISCRETE_KEYS.has(key)) {\n // No half-way between two faces: hold the old one until the step\n // completes, then switch. `apply(1)` runs on the seek and the\n // advance paths alike, so a scrub past the end lands on it too.\n const next = target as string;\n const previous = o[key as \"fontFamily\" | \"fontStyle\"];\n customLerps.push((t) => {\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = t >= 1 ? next : previous;\n });\n } else if (typeof target === 'number') {\n const k = key as keyof SelectionOverrides;\n numeric.push({ key: k, from: o[k] as number, to: target });\n }\n }\n\n const apply = (t: number): void => {\n const easedT = easing ? easing(t) : t;\n for (const n of numeric) {\n (o[n.key] as number) = n.from + (n.to - n.from) * easedT;\n }\n for (const fn of customLerps) fn(easedT);\n };\n\n let elapsed = 0;\n return {\n seek: (e: number) => apply(duration > 0 ? Math.min(e / duration, 1) : 1),\n advance: (dt: number): boolean => {\n elapsed += dt;\n if (elapsed < duration) {\n apply(elapsed / duration);\n return false;\n }\n apply(1);\n return true;\n },\n };\n }\n}\n\n/**\n * Clamp ranges to `[0, length]`, drop empties, sort by start, and merge any\n * that touch or overlap so each glyph is covered once per selection. The\n * relative order selections were *created* in is preserved across selections by\n * the node's registry, not here.\n */\nexport function normalizeRanges(ranges: TextRange[], length: number): TextRange[] {\n const clamped = ranges\n .map(r => ({ start: Math.max(0, Math.min(r.start, length)), end: Math.max(0, Math.min(r.end, length)) }))\n .filter(r => r.end > r.start)\n .sort((a, b) => a.start - b.start);\n\n const merged: TextRange[] = [];\n for (const r of clamped) {\n const last = merged[merged.length - 1];\n if (last && r.start <= last.end) {\n last.end = Math.max(last.end, r.end);\n } else {\n merged.push({ ...r });\n }\n }\n return merged;\n}\n"]}
1
+ {"version":3,"file":"text-selection.js","sourceRoot":"","sources":["../../../src/nodes/text/text-selection.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,SAAS,EAAwB,MAAM,oBAAoB,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAA0B,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIrF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAwDpD,mFAAmF;AACnF,MAAM,aAAa,GAAG,IAAI,GAAG,CAA2B,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IACb,IAAI,CAAO;IACX,MAAM,CAAc;IAE7B;;;;OAIG;IACM,SAAS,CAAqB;IAEvC,YAAY,IAAU,EAAE,MAAmB;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,SAAS,GAAG;YACb,OAAO,EAAE,CAAC;YACV,CAAC,EAAE,CAAC;YACJ,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G,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { EasingFunction } from \"@/tween/ease/type\";\r\nimport { TweenStepper } from \"@/tween/stepper\";\r\nimport { toCommand, type AnimationTarget } from \"@/tween/to-command\";\r\nimport { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\r\nimport { Stroke, StrokeResolved, strokeOps } from \"@/attributes/shape/stroke/stroke\";\r\nimport type { FontStyle } from \"@/attributes/text/types\";\r\nimport type { Text } from \"./text-node\";\r\n\r\n/**\r\n * The size a selection's `fontSize` starts from on an `'autofit'` node.\r\n *\r\n * The same 100 the segmented layout probes with (`layoutTextSegments`), so a\r\n * selection that never touches its size reports the number that block is\r\n * actually shaped at rather than a second, different guess.\r\n */\r\nexport const AUTOFIT_PROBE_SIZE = 100;\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\n\r\n/** A half-open character range `[start, end)` of a Text node's string. */\r\nexport interface TextRange {\r\n start: number;\r\n end: number;\r\n}\r\n\r\n/**\r\n * Properties a {@link TextSelection} can animate. Transform/opacity/font fields\r\n * are numeric; `fill`/`stroke` accept any author-facing paint and are resolved\r\n * before tweening (mirroring how {@link Text} resolves its own paint).\r\n *\r\n * `fontFamily` and `fontStyle` are the two that cannot tween, and they are here\r\n * anyway: what a selection is for is styling a run differently from its\r\n * neighbours, and a model that can change a word's weight but not its face is\r\n * one an editor has to work around rather than with. They switch at the end of a\r\n * step rather than interpolating - see {@link TextSelection._prepareStep} - for\r\n * the same reason a blend mode does: there is no half-way between two typefaces,\r\n * and inventing one would be a frame of text set in neither.\r\n */\r\nexport interface TextSelectionProps {\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n fontFamily: string;\r\n fontSize: number;\r\n fontStyle: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n fill: Fill;\r\n stroke: Stroke;\r\n}\r\n\r\n/**\r\n * Live, resolved override state for a selection, read by the Text node each\r\n * frame to build per-piece segments. `fill`/`stroke` are `null` until set,\r\n * meaning \"inherit the node's paint\".\r\n */\r\nexport interface SelectionOverrides {\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n fontFamily: string;\r\n fontSize: number;\r\n fontStyle: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n fill: FillResolved[] | null;\r\n stroke: StrokeResolved[] | null;\r\n}\r\n\r\n/** The {@link SelectionOverrides} keys that hold a string rather than a number. */\r\nconst DISCRETE_KEYS = new Set<keyof TextSelectionProps>([\"fontFamily\", \"fontStyle\"]);\r\n\r\n/**\r\n * A sub-range of a {@link Text} node's glyphs that can be animated\r\n * independently. Returned by the node's selector methods (`find`, `match`,\r\n * `line`, `word`, `words`, `slice`, `filter`).\r\n *\r\n * Implements {@link AnimationTarget} so `selection.to({ ... }, duration)`\r\n * plugs straight into the existing `Command` / `parallel` / `sequence`\r\n * machinery — each tween writes resolved values into {@link overrides}, which\r\n * the node reads when splitting its text into rendered pieces.\r\n *\r\n * @example\r\n * textRef().find(\"hello\").to({ opacity: 0.5, y: -10 }, 1);\r\n */\r\nexport class TextSelection implements AnimationTarget<TextSelectionProps> {\r\n readonly node: Text;\r\n readonly ranges: TextRange[];\r\n\r\n /**\r\n * Current resolved overrides for this selection. Numeric fields default to\r\n * the node's current values (so a partial tween starts from the node's\r\n * style); `fill`/`stroke` start as `null` (inherit) until tweened.\r\n */\r\n readonly overrides: SelectionOverrides;\r\n\r\n constructor(node: Text, ranges: TextRange[]) {\r\n this.node = node;\r\n this.ranges = normalizeRanges(ranges, node.text.length);\r\n this.overrides = {\r\n opacity: 1,\r\n x: 0,\r\n y: 0,\r\n scale: 1,\r\n rotation: 0,\r\n fontFamily: node.fontFamily,\r\n // `'autofit'` is a *box* decision - the size the whole block settles\r\n // on - so it is not a per-run value at all. A selection on an autofit\r\n // node starts from the probe size the segmented layout shapes with,\r\n // and overriding it there is what \"this word, two sizes up\" means.\r\n fontSize: typeof node.fontSize === \"number\" ? node.fontSize : AUTOFIT_PROBE_SIZE,\r\n fontStyle: node.fontStyle,\r\n fontWeight: node.fontWeight,\r\n letterSpacing: node.letterSpacing,\r\n fill: null,\r\n stroke: null,\r\n };\r\n node._registerSelection(this);\r\n }\r\n\r\n /** True when this selection has no overrides differing from the node default. */\r\n get isIdentity(): boolean {\r\n const o = this.overrides;\r\n const nodeSize = typeof this.node.fontSize === \"number\"\r\n ? this.node.fontSize\r\n : AUTOFIT_PROBE_SIZE;\r\n return (\r\n o.opacity === 1 &&\r\n o.x === 0 &&\r\n o.y === 0 &&\r\n o.scale === 1 &&\r\n o.rotation === 0 &&\r\n o.fontFamily === this.node.fontFamily &&\r\n o.fontSize === nodeSize &&\r\n o.fontStyle === this.node.fontStyle &&\r\n o.fontWeight === this.node.fontWeight &&\r\n o.letterSpacing === this.node.letterSpacing &&\r\n o.fill === null &&\r\n o.stroke === null\r\n );\r\n }\r\n\r\n /**\r\n * Write overrides straight onto the selection - no tween, no command.\r\n *\r\n * `to()` is the animation door and this is the *styling* one: an editor that\r\n * paints one word red is stating what the run **is**, not scheduling it, and\r\n * a zero-length `to()` would say the same thing while also landing a step on\r\n * the node's timeline for something that never moves. Paints are resolved\r\n * here exactly as `to()` resolves them, so a run styled this way and a run\r\n * tweened to the same value hold identical resolved arrays.\r\n *\r\n * Returns `this`, so a range and its style read as one expression.\r\n */\r\n set(props: Partial<TextSelectionProps>): this {\r\n const o = this.overrides;\r\n for (const key of Object.keys(props) as Array<keyof TextSelectionProps>) {\r\n const value = props[key];\r\n if (value === undefined) continue;\r\n if (key === \"fill\") {\r\n o.fill = fillOps.resolve(value as Fill);\r\n } else if (key === \"stroke\") {\r\n o.stroke = strokeOps.resolve(value as Stroke);\r\n } else if (DISCRETE_KEYS.has(key)) {\r\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = value as string;\r\n } else if (typeof value === \"number\") {\r\n (o[key as \"opacity\"] as number) = value;\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n @command()\r\n to<D extends Partial<TextSelectionProps> = Partial<TextSelectionProps>>(\r\n args: CommandArgs<D> & { duration: number },\r\n ): Command<TextSelectionProps> {\r\n return toCommand<TextSelectionProps>(this, args.data ?? {}, args.duration, args.easing);\r\n }\r\n\r\n /**\r\n * Resolve one `to()` step into a flat {@link TweenStepper}. Numeric props\r\n * (opacity/x/y/scale/rotation/fontWeight/letterSpacing) interpolate\r\n * directly; `fill`/`stroke` resolve their target once and lerp via the\r\n * shared fill/stroke array lerps — mirroring {@link Node2D._prepareStep}.\r\n */\r\n _prepareStep(\r\n to: Partial<TextSelectionProps>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n ): TweenStepper {\r\n const o = this.overrides;\r\n const numeric: Array<{ key: keyof SelectionOverrides; from: number; to: number }> = [];\r\n const customLerps: Array<(t: number) => void> = [];\r\n\r\n for (const key of Object.keys(to) as Array<keyof TextSelectionProps>) {\r\n const target = to[key];\r\n if (target === undefined) continue;\r\n\r\n if (key === 'fill') {\r\n const from = o.fill ?? (this.node.fill as FillResolved[]);\r\n const resolved = fillOps.resolve(target as Fill);\r\n customLerps.push((t) => { o.fill = fillOps.lerp(from, resolved, t); });\r\n } else if (key === 'stroke') {\r\n const from = o.stroke ?? (this.node.stroke as StrokeResolved[]);\r\n const resolved = strokeOps.resolve(target as Stroke);\r\n customLerps.push((t) => { o.stroke = strokeOps.lerp(from, resolved, t); });\r\n } else if (DISCRETE_KEYS.has(key)) {\r\n // No half-way between two faces: hold the old one until the step\r\n // completes, then switch. `apply(1)` runs on the seek and the\r\n // advance paths alike, so a scrub past the end lands on it too.\r\n const next = target as string;\r\n const previous = o[key as \"fontFamily\" | \"fontStyle\"];\r\n customLerps.push((t) => {\r\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = t >= 1 ? next : previous;\r\n });\r\n } else if (typeof target === 'number') {\r\n const k = key as keyof SelectionOverrides;\r\n numeric.push({ key: k, from: o[k] as number, to: target });\r\n }\r\n }\r\n\r\n const apply = (t: number): void => {\r\n const easedT = easing ? easing(t) : t;\r\n for (const n of numeric) {\r\n (o[n.key] as number) = n.from + (n.to - n.from) * easedT;\r\n }\r\n for (const fn of customLerps) fn(easedT);\r\n };\r\n\r\n let elapsed = 0;\r\n return {\r\n seek: (e: number) => apply(duration > 0 ? Math.min(e / duration, 1) : 1),\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n if (elapsed < duration) {\r\n apply(elapsed / duration);\r\n return false;\r\n }\r\n apply(1);\r\n return true;\r\n },\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Clamp ranges to `[0, length]`, drop empties, sort by start, and merge any\r\n * that touch or overlap so each glyph is covered once per selection. The\r\n * relative order selections were *created* in is preserved across selections by\r\n * the node's registry, not here.\r\n */\r\nexport function normalizeRanges(ranges: TextRange[], length: number): TextRange[] {\r\n const clamped = ranges\r\n .map(r => ({ start: Math.max(0, Math.min(r.start, length)), end: Math.max(0, Math.min(r.end, length)) }))\r\n .filter(r => r.end > r.start)\r\n .sort((a, b) => a.start - b.start);\r\n\r\n const merged: TextRange[] = [];\r\n for (const r of clamped) {\r\n const last = merged[merged.length - 1];\r\n if (last && r.start <= last.end) {\r\n last.end = Math.max(last.end, r.end);\r\n } else {\r\n merged.push({ ...r });\r\n }\r\n }\r\n return merged;\r\n}\r\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { Transform3D } from "../../render3d/transform.js";
2
- import type { CameraData3D } from "../../render3d/camera.js";
2
+ import { type CameraData3D } from "../../render3d/camera.js";
3
+ import type { Command, CommandArgs } from "../../tween/command.js";
3
4
  import type { RenderContext3D } from "../../render3d/render-context3d.js";
4
5
  import type { Vector3Input } from "../../render3d/vector3.js";
5
6
  import { Node3D, type Node3DProps } from "./node3d.js";
@@ -20,8 +21,7 @@ import { Node3D, type Node3DProps } from "./node3d.js";
20
21
  * around the thing it is looking at, which is what a camera move almost always
21
22
  * *is*. Written through `position` the same move is a `Math.sin`/`Math.cos` pair
22
23
  * recomputed every frame in a prop binding — which is exactly what every scene
23
- * did before this existed, and what the template's own `Graph3D` node
24
- * independently reinvented `orbit`/`elevation`/`zoom` props to avoid.
24
+ * did before this existed.
25
25
  *
26
26
  * `position` and `lookAt` still work and are right for a shot pinned to
27
27
  * something; setting any polar field takes over, so the two can never be half
@@ -73,6 +73,24 @@ export declare class Camera3D<P extends Camera3DProps = Camera3DProps> extends N
73
73
  near: number | undefined;
74
74
  far: number | undefined;
75
75
  zoom: number | undefined;
76
+ /**
77
+ * Swing round {@link target}, and pull back or in, whichever are given. A
78
+ * camera not yet placed by its polar fields starts from what an unset one
79
+ * reads as.
80
+ */
81
+ orbitTo(args: CommandArgs<{
82
+ orbit?: number;
83
+ elevation?: number;
84
+ distance?: number;
85
+ }> & {
86
+ duration: number;
87
+ }): Command<P>;
88
+ /** Turn to look at another point: animates {@link target}. */
89
+ lookTo(args: CommandArgs<{
90
+ target: Vector3Input;
91
+ }> & {
92
+ duration: number;
93
+ }): Command<P>;
76
94
  /**
77
95
  * A camera's group stays identity; the camera places itself.
78
96
  *
@@ -1 +1 @@
1
- {"version":3,"file":"camera-nodes.d.ts","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM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AC9B,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAE9B,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;IAClC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAE7B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnE;;;;OAIG;IAQH,OAAO,CACH,IAAI,EAAE,WAAW,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GACpG,OAAO,CAAC,CAAC,CAAC;IAiBb,8DAA8D;IAE9D,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,MAAM,EAAE,YAAY,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAItF;;;;;;;;OAQG;cACgB,cAAc,IAAI,WAAW;IAIhD,SAAS,CAAC,WAAW,IAAI,YAAY;IASrC,4FAA4F;IACnF,aAAa,IAAI,IAAI;cAEX,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;CAG5D"}
@@ -5,12 +5,41 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { property } from "../../attributes/properties/decorator.js";
8
+ import { optionalVector3Property } from "../../attributes/properties/typed.js";
9
+ import { ORBIT_CAMERA_DEFAULTS } from "../../render3d/camera.js";
10
+ import { command } from "../../tween/command-decorator.js";
8
11
  import { Node3D } from "./node3d.js";
9
12
  const CAMERA_KEYS = [
10
13
  "target", "orbit", "elevation", "distance",
11
14
  "fov", "frustumHeight", "near", "far", "zoom",
12
15
  ];
13
16
  export class Camera3D extends Node3D {
17
+ /**
18
+ * Swing round {@link target}, and pull back or in, whichever are given. A
19
+ * camera not yet placed by its polar fields starts from what an unset one
20
+ * reads as.
21
+ */
22
+ orbitTo(args) {
23
+ const to = args.data ?? {};
24
+ const from = {
25
+ orbit: this.orbit ?? ORBIT_CAMERA_DEFAULTS.orbit,
26
+ elevation: this.elevation ?? ORBIT_CAMERA_DEFAULTS.elevation,
27
+ distance: this.distance ?? ORBIT_CAMERA_DEFAULTS.distance,
28
+ };
29
+ return this.command((t) => {
30
+ const out = {};
31
+ for (const key of ["orbit", "elevation", "distance"]) {
32
+ const end = to[key];
33
+ if (end !== undefined)
34
+ out[key] = from[key] + (end - from[key]) * t;
35
+ }
36
+ return out;
37
+ }, args.duration, args.easing);
38
+ }
39
+ /** Turn to look at another point: animates {@link target}. */
40
+ lookTo(args) {
41
+ return this.to({ data: args.data, duration: args.duration, easing: args.easing });
42
+ }
14
43
  /**
15
44
  * A camera's group stays identity; the camera places itself.
16
45
  *
@@ -42,7 +71,7 @@ __decorate([
42
71
  property({ default: "perspective" })
43
72
  ], Camera3D.prototype, "type", void 0);
44
73
  __decorate([
45
- property({ default: undefined })
74
+ optionalVector3Property("origin")
46
75
  ], Camera3D.prototype, "target", void 0);
47
76
  __decorate([
48
77
  property({ default: undefined })
@@ -68,4 +97,16 @@ __decorate([
68
97
  __decorate([
69
98
  property({ default: undefined })
70
99
  ], Camera3D.prototype, "zoom", void 0);
100
+ __decorate([
101
+ command({
102
+ args: [
103
+ { key: "orbit", kind: "number", step: 1, unit: "°" },
104
+ { key: "elevation", kind: "number", min: -89, max: 89, step: 1, unit: "°" },
105
+ { key: "distance", kind: "number", min: 0.01, step: 0.1 },
106
+ ],
107
+ })
108
+ ], Camera3D.prototype, "orbitTo", null);
109
+ __decorate([
110
+ command({ args: ["target"] })
111
+ ], Camera3D.prototype, "lookTo", null);
71
112
  //# sourceMappingURL=camera-nodes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"camera-nodes.js","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAK7D,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAC;AA8DpD,MAAM,WAAW,GAAG;IAChB,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU;IAC1C,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CACvC,CAAC;AAEX,MAAM,OAAO,QAAkD,SAAQ,MAAS;IAc5E;;;;;;;;OAQG;IACgB,cAAc;QAC7B,OAAO,EAAE,CAAC;IACd,CAAC;IAES,WAAW;QACjB,MAAM,GAAG,GAA4B,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACzD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAI,IAA2C,CAAC,GAAG,CAAC,CAAC;YAChE,IAAI,KAAK,KAAK,SAAS;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC9C,CAAC;QACD,OAAO,GAA8B,CAAC;IAC1C,CAAC;IAED,4FAA4F;IACnF,aAAa,KAAW,CAAC;IAEf,UAAU,CAAC,GAAoB;QAC9C,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,EAAkB,CAAC,CAAC;IACjF,CAAC;CACJ;AAzCiD;IAA7C,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;sCAAoC;AAE/B;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;wCAA0C;AACjC;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;uCAAmC;AAC1B;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;2CAAuC;AAC9B;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;0CAAsC;AAE7B;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;qCAAiC;AACxB;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;+CAA2C;AAClC;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;sCAAkC;AACzB;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;qCAAiC;AACxB;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;sCAAkC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport type { Transform3D } from \"@/render3d/transform\";\nimport type { CameraData3D } from \"@/render3d/camera\";\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\nimport type { Vector3Input } from \"@/render3d/vector3\";\nimport { Node3D, type Node3DProps } from \"./node3d\";\n\n/**\n * The camera — where the scene is viewed from.\n *\n * **One node, two projections.** `<Camera3D type=\"orthographic\">` is the flat\n * one; there is no second class, because a perspective and an orthographic\n * camera are one object with a projection setting, which is how every editor\n * presents it and how a scene switching between them has to be written.\n *\n * <Camera3D target={[0, 0.2, 0]} orbit={-18} elevation={12} distance={13} fov={42} />\n *\n * cam().to({ data: { orbit: 160, elevation: 30 }, duration: 4, easing: easeInOut(\"quad\") });\n *\n * ── Orbit, not trigonometry ───────────────────────────────────────────────────\n * `target`/`orbit`/`elevation`/`distance` place the camera in polar coordinates\n * around the thing it is looking at, which is what a camera move almost always\n * *is*. Written through `position` the same move is a `Math.sin`/`Math.cos` pair\n * recomputed every frame in a prop binding — which is exactly what every scene\n * did before this existed, and what the template's own `Graph3D` node\n * independently reinvented `orbit`/`elevation`/`zoom` props to avoid.\n *\n * `position` and `lookAt` still work and are right for a shot pinned to\n * something; setting any polar field takes over, so the two can never be half\n * applied. Either way the camera is a node, so parenting it to a moving\n * `Group3D` carries the shot with the rig.\n *\n * ── What is derived ───────────────────────────────────────────────────────────\n * `near`/`far` come from the scene's own bounds unless you set them, and the\n * aspect ratio always tracks the viewport's layout box — it was a prop whose\n * documentation said \"don't set this\", and setting it stretched the render.\n * An asymmetric orthographic frustum is a `params` override rather than four\n * more fields.\n *\n * A scene with no camera gets a sensible default framing. A scene that declares\n * more than one keeps the last, since there is only ever one view.\n */\nexport interface Camera3DProps extends Node3DProps {\n /** `\"perspective\"` (default) or `\"orthographic\"`. */\n type: CameraData3D[\"type\"];\n /**\n * The point the camera looks at, and orbits around.\n *\n * On its own it is `lookAt` under a name that reads right beside `orbit`;\n * together with any of the three below it is also the centre they turn about.\n */\n target: Vector3Input | undefined;\n /** Azimuth around {@link target}, in **degrees**. */\n orbit: number | undefined;\n /** Angle above the horizon, in **degrees**. */\n elevation: number | undefined;\n /** Distance from {@link target}. */\n distance: number | undefined;\n /** Perspective only: vertical field of view in **degrees**. Default 50. */\n fov: number | undefined;\n /** Orthographic only: visible world height. Default 10. */\n frustumHeight: number | undefined;\n near: number | undefined;\n far: number | undefined;\n zoom: number | undefined;\n}\n\nconst CAMERA_KEYS = [\n \"target\", \"orbit\", \"elevation\", \"distance\",\n \"fov\", \"frustumHeight\", \"near\", \"far\", \"zoom\",\n] as const;\n\nexport class Camera3D<P extends Camera3DProps = Camera3DProps> extends Node3D<P> {\n @property({ default: \"perspective\" }) declare type: CameraData3D[\"type\"];\n\n @property({ default: undefined }) declare target: Vector3Input | undefined;\n @property({ default: undefined }) declare orbit: number | undefined;\n @property({ default: undefined }) declare elevation: number | undefined;\n @property({ default: undefined }) declare distance: number | undefined;\n\n @property({ default: undefined }) declare fov: number | undefined;\n @property({ default: undefined }) declare frustumHeight: number | undefined;\n @property({ default: undefined }) declare near: number | undefined;\n @property({ default: undefined }) declare far: number | undefined;\n @property({ default: undefined }) declare zoom: number | undefined;\n\n /**\n * A camera's group stays identity; the camera places itself.\n *\n * three aims a camera's **-Z** at `lookAt` and a plain group's **+Z**, so a\n * camera sitting inside a group that carried its placement would face exactly\n * backwards. Putting the placement on the descriptor hands it to the camera\n * object itself, where `Object3D.lookAt` uses the camera convention — and it\n * is still parent-relative, so a camera inside a moving rig is carried by it.\n */\n protected override groupTransform(): Transform3D {\n return {};\n }\n\n protected buildCamera(): CameraData3D {\n const out: Record<string, unknown> = { type: this.type };\n for (const key of CAMERA_KEYS) {\n const value = (this as unknown as Record<string, unknown>)[key];\n if (value !== undefined) out[key] = value;\n }\n return out as unknown as CameraData3D;\n }\n\n /** Loads nothing — and recording `renderSelf` would make every orbit tween a dependency. */\n override declareAssets(): void { }\n\n protected override renderSelf(ctx: RenderContext3D): void {\n ctx.camera({ ...this.transform3D(), ...this.buildCamera() } as CameraData3D);\n }\n}\n"]}
1
+ {"version":3,"file":"camera-nodes.js","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAqB,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAC;AA6DpD,MAAM,WAAW,GAAG;IAChB,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU;IAC1C,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CACvC,CAAC;AAEX,MAAM,OAAO,QAAkD,SAAQ,MAAS;IAc5E;;;;OAI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,EAAE,IAAI,EAAE,GAAG,EAAE;YACpD,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE;YAC3E,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;SAC5D;KACJ,CAAC;uCAkBD;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;sCAG7B","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { optionalVector3Property } from \"@/attributes/properties/typed\";\r\nimport type { Transform3D } from \"@/render3d/transform\";\r\nimport { ORBIT_CAMERA_DEFAULTS, type CameraData3D } from \"@/render3d/camera\";\r\nimport type { Command, CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\r\nimport type { Vector3Input } from \"@/render3d/vector3\";\r\nimport { Node3D, type Node3DProps } from \"./node3d\";\r\n\r\n/**\r\n * The camera — where the scene is viewed from.\r\n *\r\n * **One node, two projections.** `<Camera3D type=\"orthographic\">` is the flat\r\n * one; there is no second class, because a perspective and an orthographic\r\n * camera are one object with a projection setting, which is how every editor\r\n * presents it and how a scene switching between them has to be written.\r\n *\r\n * <Camera3D target={[0, 0.2, 0]} orbit={-18} elevation={12} distance={13} fov={42} />\r\n *\r\n * cam().to({ data: { orbit: 160, elevation: 30 }, duration: 4, easing: easeInOut(\"quad\") });\r\n *\r\n * ── Orbit, not trigonometry ───────────────────────────────────────────────────\r\n * `target`/`orbit`/`elevation`/`distance` place the camera in polar coordinates\r\n * around the thing it is looking at, which is what a camera move almost always\r\n * *is*. Written through `position` the same move is a `Math.sin`/`Math.cos` pair\r\n * recomputed every frame in a prop binding — which is exactly what every scene\r\n * did before this existed.\r\n *\r\n * `position` and `lookAt` still work and are right for a shot pinned to\r\n * something; setting any polar field takes over, so the two can never be half\r\n * applied. Either way the camera is a node, so parenting it to a moving\r\n * `Group3D` carries the shot with the rig.\r\n *\r\n * ── What is derived ───────────────────────────────────────────────────────────\r\n * `near`/`far` come from the scene's own bounds unless you set them, and the\r\n * aspect ratio always tracks the viewport's layout box — it was a prop whose\r\n * documentation said \"don't set this\", and setting it stretched the render.\r\n * An asymmetric orthographic frustum is a `params` override rather than four\r\n * more fields.\r\n *\r\n * A scene with no camera gets a sensible default framing. A scene that declares\r\n * more than one keeps the last, since there is only ever one view.\r\n */\r\nexport interface Camera3DProps extends Node3DProps {\r\n /** `\"perspective\"` (default) or `\"orthographic\"`. */\r\n type: CameraData3D[\"type\"];\r\n /**\r\n * The point the camera looks at, and orbits around.\r\n *\r\n * On its own it is `lookAt` under a name that reads right beside `orbit`;\r\n * together with any of the three below it is also the centre they turn about.\r\n */\r\n target: Vector3Input | undefined;\r\n /** Azimuth around {@link target}, in **degrees**. */\r\n orbit: number | undefined;\r\n /** Angle above the horizon, in **degrees**. */\r\n elevation: number | undefined;\r\n /** Distance from {@link target}. */\r\n distance: number | undefined;\r\n /** Perspective only: vertical field of view in **degrees**. Default 50. */\r\n fov: number | undefined;\r\n /** Orthographic only: visible world height. Default 10. */\r\n frustumHeight: number | undefined;\r\n near: number | undefined;\r\n far: number | undefined;\r\n zoom: number | undefined;\r\n}\r\n\r\nconst CAMERA_KEYS = [\r\n \"target\", \"orbit\", \"elevation\", \"distance\",\r\n \"fov\", \"frustumHeight\", \"near\", \"far\", \"zoom\",\r\n] as const;\r\n\r\nexport class Camera3D<P extends Camera3DProps = Camera3DProps> extends Node3D<P> {\r\n @property({ default: \"perspective\" }) declare type: CameraData3D[\"type\"];\r\n\r\n @optionalVector3Property(\"origin\") declare target: Vector3Input | undefined;\r\n @property({ default: undefined }) declare orbit: number | undefined;\r\n @property({ default: undefined }) declare elevation: number | undefined;\r\n @property({ default: undefined }) declare distance: number | undefined;\r\n\r\n @property({ default: undefined }) declare fov: number | undefined;\r\n @property({ default: undefined }) declare frustumHeight: number | undefined;\r\n @property({ default: undefined }) declare near: number | undefined;\r\n @property({ default: undefined }) declare far: number | undefined;\r\n @property({ default: undefined }) declare zoom: number | undefined;\r\n\r\n /**\r\n * Swing round {@link target}, and pull back or in, whichever are given. A\r\n * camera not yet placed by its polar fields starts from what an unset one\r\n * reads as.\r\n */\r\n @command({\r\n args: [\r\n { key: \"orbit\", kind: \"number\", step: 1, unit: \"°\" },\r\n { key: \"elevation\", kind: \"number\", min: -89, max: 89, step: 1, unit: \"°\" },\r\n { key: \"distance\", kind: \"number\", min: 0.01, step: 0.1 },\r\n ],\r\n })\r\n orbitTo(\r\n args: CommandArgs<{ orbit?: number; elevation?: number; distance?: number }> & { duration: number },\r\n ): Command<P> {\r\n const to = args.data ?? {};\r\n const from = {\r\n orbit: this.orbit ?? ORBIT_CAMERA_DEFAULTS.orbit,\r\n elevation: this.elevation ?? ORBIT_CAMERA_DEFAULTS.elevation,\r\n distance: this.distance ?? ORBIT_CAMERA_DEFAULTS.distance,\r\n };\r\n return this.command<P>((t) => {\r\n const out: Record<string, number> = {};\r\n for (const key of [\"orbit\", \"elevation\", \"distance\"] as const) {\r\n const end = to[key];\r\n if (end !== undefined) out[key] = from[key] + (end - from[key]) * t;\r\n }\r\n return out as Partial<P>;\r\n }, args.duration, args.easing);\r\n }\r\n\r\n /** Turn to look at another point: animates {@link target}. */\r\n @command({ args: [\"target\"] })\r\n lookTo(args: CommandArgs<{ target: Vector3Input }> & { duration: number }): Command<P> {\r\n return this.to({ data: args.data as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /**\r\n * A camera's group stays identity; the camera places itself.\r\n *\r\n * three aims a camera's **-Z** at `lookAt` and a plain group's **+Z**, so a\r\n * camera sitting inside a group that carried its placement would face exactly\r\n * backwards. Putting the placement on the descriptor hands it to the camera\r\n * object itself, where `Object3D.lookAt` uses the camera convention — and it\r\n * is still parent-relative, so a camera inside a moving rig is carried by it.\r\n */\r\n protected override groupTransform(): Transform3D {\r\n return {};\r\n }\r\n\r\n protected buildCamera(): CameraData3D {\r\n const out: Record<string, unknown> = { type: this.type };\r\n for (const key of CAMERA_KEYS) {\r\n const value = (this as unknown as Record<string, unknown>)[key];\r\n if (value !== undefined) out[key] = value;\r\n }\r\n return out as unknown as CameraData3D;\r\n }\r\n\r\n /** Loads nothing — and recording `renderSelf` would make every orbit tween a dependency. */\r\n override declareAssets(): void { }\r\n\r\n protected override renderSelf(ctx: RenderContext3D): void {\r\n ctx.camera({ ...this.transform3D(), ...this.buildCamera() } as CameraData3D);\r\n }\r\n}\r\n"]}
@@ -2,10 +2,11 @@ import { RenderContext2D } from "../../render/render-context2d.js";
2
2
  import { Scene3D } from "../../render3d/scene3d.js";
3
3
  import { type PostEffect3D, type Shadows3D, type ToneMapping3D } from "../../render3d/scene-settings.js";
4
4
  import type { Color } from "../../attributes/shape/fill/color/parser.js";
5
+ import type { Command, CommandArgs } from "../../tween/command.js";
5
6
  import type { AssetScope } from "../../assets/scope.js";
6
7
  import { Rect, RectProps } from "../geometry/rect-node.js";
7
8
  import { Node, NodeConfig } from "../../nodes/node/node.js";
8
- import { Node3D } from "./node3d.js";
9
+ import { Node3D, type ChildSpace3D } from "./node3d.js";
9
10
  export interface Canvas3DProps extends RectProps {
10
11
  /**
11
12
  * Ceiling on the 3D buffer's device-pixel ratio. Default 2.
@@ -35,6 +36,10 @@ export interface Canvas3DProps extends RectProps {
35
36
  * blur and the rest of the 2D `effects` chain already run over the composited
36
37
  * result. What is here is what genuinely needs the depth buffer, object ids,
37
38
  * or HDR radiance before tone mapping.
39
+ *
40
+ * **Inert today**: the chain is recorded on the scene and no pass is applied,
41
+ * so a viewport with `post` renders exactly like one without (the first one
42
+ * set warns in development). Use the viewport's 2D `effects` instead.
38
43
  */
39
44
  post: PostEffect3D | readonly PostEffect3D[];
40
45
  /**
@@ -42,8 +47,7 @@ export interface Canvas3DProps extends RectProps {
42
47
  *
43
48
  * A host that renders a **timeline** needs a camera a `to` command can tween
44
49
  * and a scrub can reproduce exactly, and a drag-to-orbit gesture that writes
45
- * the same values the timeline reads. `Graph3D` and `Protein` already carry
46
- * this vocabulary for the same reason. Only read when the scene contains no
50
+ * the same values the timeline reads. Only read when the scene contains no
47
51
  * camera of its own, so a `<Camera3D>` child still wins.
48
52
  */
49
53
  /** Camera orbit about the vertical axis, in **degrees**. Animate this to spin. */
@@ -92,7 +96,7 @@ export interface Canvas3DProps extends RectProps {
92
96
  * make that impossible is for there to be nothing to keep in step: see
93
97
  * {@link Canvas3DView.fadeColor}.
94
98
  *
95
- * The same rule motion-script applies to fog with no colour of its own, one
99
+ * The same rule the engine applies to fog with no colour of its own, one
96
100
  * layer down (`Canvas3D.buildScene3D`), and for the same reason.
97
101
  */
98
102
  gridFadeColor: Color;
@@ -162,7 +166,7 @@ export declare class Canvas3D<P extends Canvas3DProps = Canvas3DProps> extends R
162
166
  * Each default is applied only when the walk left that slot empty, so a
163
167
  * `PerspectiveCamera3D` or an `AmbientLight3D` placed as a child wins over the
164
168
  * node's own props rather than being silently overwritten by them — which is
165
- * the behaviour that lets this class stop being special the day the studio
169
+ * the behaviour that lets this class stop being special the day an editor
166
170
  * offers those as node types.
167
171
  */
168
172
  /**
@@ -189,7 +193,7 @@ export declare class Canvas3D<P extends Canvas3DProps = Canvas3DProps> extends R
189
193
  * leaves {@link Canvas3DProps.gridFadeColor} standing, rather than
190
194
  * inventing black.
191
195
  *
192
- * Restated here rather than imported because motion-script's own copy (used
196
+ * Restated here rather than imported because the engine's own copy (used
193
197
  * for fog, in `Canvas3D.buildScene3D`) is a module-private function. The
194
198
  * duplication is small and deliberate — the alternative was a second control
195
199
  * the author had to keep in step with the fill, which is exactly what this
@@ -204,6 +208,18 @@ export declare class Canvas3D<P extends Canvas3DProps = Canvas3DProps> extends R
204
208
  exposure: number | undefined;
205
209
  post: PostEffect3D | readonly PostEffect3D[] | undefined;
206
210
  constructor(props?: NodeConfig<Canvas3D<P>, P>);
211
+ /**
212
+ * Swing the default camera round the scene and pull it back or in,
213
+ * whichever are given. `zoom` is its distance, as the prop is. A scene with
214
+ * a `Camera3D` of its own is framed by that camera's `orbitTo` instead.
215
+ */
216
+ orbitTo(args: CommandArgs<{
217
+ orbit?: number;
218
+ elevation?: number;
219
+ zoom?: number;
220
+ }> & {
221
+ duration: number;
222
+ }): Command<P>;
207
223
  /**
208
224
  * Accept both dimensions — the only node that does.
209
225
  *
@@ -211,6 +227,13 @@ export declare class Canvas3D<P extends Canvas3DProps = Canvas3DProps> extends R
211
227
  * (see {@link Node.acceptsChild}); here it is the entire point.
212
228
  */
213
229
  protected acceptsChild(child: Node): boolean;
230
+ /**
231
+ * The coordinates its 3D children's `x`/`y`/`z` are in, or `null` (the
232
+ * default) when they are the scene's own. A viewport that is a graph answers
233
+ * with the graph's units. See {@link ChildSpace3D}.
234
+ */
235
+ /** @internal */
236
+ _spaceOf(_child: Node3D | null): ChildSpace3D | null;
214
237
  /** This node's children that describe the 3D scene. */
215
238
  get children3D(): Node3D[];
216
239
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"canvas3d-node.d.ts","sourceRoot":"","sources":["../../../src/nodes/three/canvas3d-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAEH,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EACxD,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAYlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,UAA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,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAMpH;;;;;OAKG;cACgB,YAAY,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO;IAIrD;;;;OAIG;IACH,gBAAgB;IAChB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI;IAIpD,uDAAuD;IACvD,IAAI,UAAU,IAAI,MAAM,EAAE,CAEzB;IAED;;;;;OAKG;cACgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI;IAKrE;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,YAAY,IAAI,OAAO;IAqHjC;;;;;;;;;;;;;OAaG;IACH,gBAAgB;IAChB,QAAQ,IAAI,OAAO;IAInB;;;OAGG;IACM,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAQhD;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;cAQP,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;CA0B5D"}
@@ -14,6 +14,7 @@ import { cameraOrbit, lerpColor3D, resolveColor3D } from "../../attributes/rende
14
14
  import { gridGeometry3D } from "./grid-geometry3d.js";
15
15
  import { Fills, resolveChainFill } from "../../attributes/shape/fill/chain.js";
16
16
  import { property } from "../../attributes/properties/decorator.js";
17
+ import { command } from "../../tween/command-decorator.js";
17
18
  import { declare3DResources } from "../../render3d/tracking.js";
18
19
  import { Rect } from "../geometry/rect-node.js";
19
20
  import { Node3D } from "./node3d.js";
@@ -66,7 +67,7 @@ export class Canvas3D extends Rect {
66
67
  * Each default is applied only when the walk left that slot empty, so a
67
68
  * `PerspectiveCamera3D` or an `AmbientLight3D` placed as a child wins over the
68
69
  * node's own props rather than being silently overwritten by them — which is
69
- * the behaviour that lets this class stop being special the day the studio
70
+ * the behaviour that lets this class stop being special the day an editor
70
71
  * offers those as node types.
71
72
  */
72
73
  /**
@@ -93,7 +94,7 @@ export class Canvas3D extends Rect {
93
94
  * leaves {@link Canvas3DProps.gridFadeColor} standing, rather than
94
95
  * inventing black.
95
96
  *
96
- * Restated here rather than imported because motion-script's own copy (used
97
+ * Restated here rather than imported because the engine's own copy (used
97
98
  * for fog, in `Canvas3D.buildScene3D`) is a module-private function. The
98
99
  * duplication is small and deliberate — the alternative was a second control
99
100
  * the author had to keep in step with the fill, which is exactly what this
@@ -141,6 +142,18 @@ export class Canvas3D extends Rect {
141
142
  constructor(props) {
142
143
  super((props ?? {}));
143
144
  }
145
+ /**
146
+ * Swing the default camera round the scene and pull it back or in,
147
+ * whichever are given. `zoom` is its distance, as the prop is. A scene with
148
+ * a `Camera3D` of its own is framed by that camera's `orbitTo` instead.
149
+ */
150
+ orbitTo(args) {
151
+ const data = {};
152
+ for (const [key, value] of Object.entries(args.data ?? {}))
153
+ if (value !== undefined)
154
+ data[key] = value;
155
+ return this.to({ data: data, duration: args.duration, easing: args.easing });
156
+ }
144
157
  /**
145
158
  * Accept both dimensions — the only node that does.
146
159
  *
@@ -150,6 +163,15 @@ export class Canvas3D extends Rect {
150
163
  acceptsChild(child) {
151
164
  return true;
152
165
  }
166
+ /**
167
+ * The coordinates its 3D children's `x`/`y`/`z` are in, or `null` (the
168
+ * default) when they are the scene's own. A viewport that is a graph answers
169
+ * with the graph's units. See {@link ChildSpace3D}.
170
+ */
171
+ /** @internal */
172
+ _spaceOf(_child) {
173
+ return null;
174
+ }
153
175
  /** This node's children that describe the 3D scene. */
154
176
  get children3D() {
155
177
  return this._allChildren.filter((c) => c instanceof Node3D);
@@ -227,6 +249,17 @@ export class Canvas3D extends Rect {
227
249
  },
228
250
  }));
229
251
  }
252
+ // A viewport holding only 2D children (a HUD) has nothing to frame or to
253
+ // light. Without this the default camera and rig made every scene
254
+ // non-empty, so `renderSelf` ran a full 3D pass and created the WebGL
255
+ // context to paint nothing. A subclass overriding `buildScene3D` is
256
+ // exempt: it adds its own content after `super` returns and relies on the
257
+ // rig being there.
258
+ if (this.buildScene3D === Canvas3D.prototype.buildScene3D &&
259
+ scene.isEmpty() &&
260
+ !this._children.some((child) => child instanceof Node3D)) {
261
+ return scene;
262
+ }
230
263
  if (scene.cameraDescriptor() === null) {
231
264
  // Polar placement is the camera's own vocabulary now, so the viewport's
232
265
  // orbit/elevation/zoom pass straight through instead of being converted to
@@ -416,6 +449,15 @@ __decorate([
416
449
  __decorate([
417
450
  property({ default: undefined })
418
451
  ], Canvas3D.prototype, "post", void 0);
452
+ __decorate([
453
+ command({
454
+ args: [
455
+ { key: "orbit", kind: "number", step: 1, unit: "°" },
456
+ { key: "elevation", kind: "number", min: -89, max: 89, step: 1, unit: "°" },
457
+ { key: "zoom", kind: "number", min: 0.01, step: 0.1 },
458
+ ],
459
+ })
460
+ ], Canvas3D.prototype, "orbitTo", null);
419
461
  /**
420
462
  * The colour a fill chain reads as, for anything that has to match it.
421
463
  *