@motionscript/core 0.1.0-alpha.8 → 0.1.0

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 (817) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -49
  4. package/README.md +91 -91
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.js.map +1 -1
  7. package/dist/assets/errors.js.map +1 -1
  8. package/dist/assets/index.js.map +1 -1
  9. package/dist/assets/manager.js.map +1 -1
  10. package/dist/assets/manifest.js.map +1 -1
  11. package/dist/assets/record.js.map +1 -1
  12. package/dist/assets/scope.js.map +1 -1
  13. package/dist/attributes/audio/effects/chain.js.map +1 -1
  14. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -1
  15. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -1
  16. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -1
  17. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -1
  18. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -1
  19. package/dist/attributes/audio/effects/index.js.map +1 -1
  20. package/dist/attributes/audio/effects/registry.js.map +1 -1
  21. package/dist/attributes/audio/effects/union.js.map +1 -1
  22. package/dist/attributes/audio/ramp.js.map +1 -1
  23. package/dist/attributes/audio/request.js.map +1 -1
  24. package/dist/attributes/audio/schedule.js.map +1 -1
  25. package/dist/attributes/audio/sound.js.map +1 -1
  26. package/dist/attributes/audio/transition.js.map +1 -1
  27. package/dist/attributes/index.js.map +1 -1
  28. package/dist/attributes/layout/alignment.js.map +1 -1
  29. package/dist/attributes/layout/index.js.map +1 -1
  30. package/dist/attributes/layout/insets.js.map +1 -1
  31. package/dist/attributes/layout/matrix2d.js.map +1 -1
  32. package/dist/attributes/layout/size.js.map +1 -1
  33. package/dist/attributes/layout/space3d.js.map +1 -1
  34. package/dist/attributes/layout/transform3d.js.map +1 -1
  35. package/dist/attributes/layout/vector2.js.map +1 -1
  36. package/dist/attributes/layout/world-transform.js.map +1 -1
  37. package/dist/attributes/mask/boolean.js.map +1 -1
  38. package/dist/attributes/mask/mask.js.map +1 -1
  39. package/dist/attributes/properties/decorator.js.map +1 -1
  40. package/dist/attributes/properties/inputs.js.map +1 -1
  41. package/dist/attributes/properties/typed.js.map +1 -1
  42. package/dist/attributes/render3d/orbit.js.map +1 -1
  43. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  44. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  45. package/dist/attributes/shape/corners/corners.js.map +1 -1
  46. package/dist/attributes/shape/corners/index.js.map +1 -1
  47. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  48. package/dist/attributes/shape/effects/chain.js.map +1 -1
  49. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  50. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  51. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  52. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  53. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  54. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  55. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  56. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  57. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  58. package/dist/attributes/shape/effects/implementations/curves.d.ts +2 -2
  59. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  60. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  61. package/dist/attributes/shape/effects/implementations/dither.d.ts +2 -2
  62. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  63. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  64. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  65. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  66. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  67. package/dist/attributes/shape/effects/implementations/glow.d.ts +4 -4
  68. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  69. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  70. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  71. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  72. package/dist/attributes/shape/effects/implementations/invert.d.ts +2 -2
  73. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  74. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  75. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  76. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  77. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  78. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  79. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  80. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  81. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  82. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  83. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  84. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  85. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  86. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  87. package/dist/attributes/shape/effects/implementations/shader.d.ts +2 -2
  88. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  96. package/dist/attributes/shape/effects/index.js.map +1 -1
  97. package/dist/attributes/shape/effects/registry.js.map +1 -1
  98. package/dist/attributes/shape/effects/spec.js.map +1 -1
  99. package/dist/attributes/shape/effects/union.js.map +1 -1
  100. package/dist/attributes/shape/fill/blend.js.map +1 -1
  101. package/dist/attributes/shape/fill/chain.js.map +1 -1
  102. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  103. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  104. package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
  105. package/dist/attributes/shape/fill/color/parser.js +20 -5
  106. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  107. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  108. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  109. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  110. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  111. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  112. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  113. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  114. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  115. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  116. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  117. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  118. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  119. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  120. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  121. package/dist/attributes/shape/fill/index.js.map +1 -1
  122. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  123. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  124. package/dist/attributes/shape/fill/registry.js.map +1 -1
  125. package/dist/attributes/shape/fill/union.js.map +1 -1
  126. package/dist/attributes/shape/filters/chain.js.map +1 -1
  127. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  128. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  129. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  130. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  131. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  132. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  133. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  134. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  135. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  136. package/dist/attributes/shape/filters/index.js.map +1 -1
  137. package/dist/attributes/shape/filters/registry.js.map +1 -1
  138. package/dist/attributes/shape/filters/union.js.map +1 -1
  139. package/dist/attributes/shape/path/anchors.js.map +1 -1
  140. package/dist/attributes/shape/path/bezier.js.map +1 -1
  141. package/dist/attributes/shape/path/index.js.map +1 -1
  142. package/dist/attributes/shape/path/measure.js.map +1 -1
  143. package/dist/attributes/shape/path/morph.js.map +1 -1
  144. package/dist/attributes/shape/path/ops.js.map +1 -1
  145. package/dist/attributes/shape/path/types.js.map +1 -1
  146. package/dist/attributes/shape/path/walk.js.map +1 -1
  147. package/dist/attributes/shape/shaders/index.js.map +1 -1
  148. package/dist/attributes/shape/shaders/language.js.map +1 -1
  149. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  150. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  151. package/dist/attributes/shape/shadow/index.js.map +1 -1
  152. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  153. package/dist/attributes/shape/stroke/index.js.map +1 -1
  154. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  155. package/dist/attributes/shared/operators.js.map +1 -1
  156. package/dist/attributes/text/index.js.map +1 -1
  157. package/dist/attributes/text/ops.js.map +1 -1
  158. package/dist/attributes/text/types.js.map +1 -1
  159. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  160. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  161. package/dist/browser/chunks/chunk-CCGVIR4F.js +3 -0
  162. package/dist/browser/chunks/chunk-CCGVIR4F.js.map +7 -0
  163. package/dist/browser/chunks/chunk-N4WSN5WY.js +13 -0
  164. package/dist/browser/chunks/chunk-N4WSN5WY.js.map +7 -0
  165. package/dist/browser/chunks/chunk-WZSI3GSK.js +6 -0
  166. package/dist/browser/chunks/chunk-WZSI3GSK.js.map +7 -0
  167. package/dist/browser/component.js +1 -1
  168. package/dist/browser/experimental.js +1 -1
  169. package/dist/browser/experimental.js.map +1 -1
  170. package/dist/browser/index.js +1 -1
  171. package/dist/browser/index.js.map +1 -1
  172. package/dist/browser/manifest.json +1 -1
  173. package/dist/browser/sdk.js +1 -1
  174. package/dist/component.js.map +1 -1
  175. package/dist/components/builtins/audio/audio.js.map +1 -1
  176. package/dist/components/builtins/geometry/composite.js.map +1 -1
  177. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  178. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  179. package/dist/components/builtins/layout/layout.js.map +1 -1
  180. package/dist/components/builtins/media/media.js.map +1 -1
  181. package/dist/components/builtins/providers/providers.js.map +1 -1
  182. package/dist/components/builtins/text/number-format.js.map +1 -1
  183. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  184. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  185. package/dist/components/builtins/text/text-layout.js.map +1 -1
  186. package/dist/components/builtins/text/text.d.ts +9 -9
  187. package/dist/components/builtins/text/text.js.map +1 -1
  188. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  189. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  190. package/dist/components/builtins/three/three.js.map +1 -1
  191. package/dist/components/factory/api.js.map +1 -1
  192. package/dist/components/factory/clip-of.js.map +1 -1
  193. package/dist/components/factory/commands-for.js.map +1 -1
  194. package/dist/components/factory/component-audio.js.map +1 -1
  195. package/dist/components/factory/component2d.js.map +1 -1
  196. package/dist/components/factory/component3d.js.map +1 -1
  197. package/dist/components/factory/factory.js.map +1 -1
  198. package/dist/components/factory/timeline.js.map +1 -1
  199. package/dist/components/factory/type-def.js.map +1 -1
  200. package/dist/components/factory/types.js.map +1 -1
  201. package/dist/components/factory/views.d.ts.map +1 -1
  202. package/dist/components/factory/views.js +41 -1
  203. package/dist/components/factory/views.js.map +1 -1
  204. package/dist/components/modules/aim.js.map +1 -1
  205. package/dist/components/modules/corners.js.map +1 -1
  206. package/dist/components/modules/flow.js.map +1 -1
  207. package/dist/components/modules/material.js.map +1 -1
  208. package/dist/components/modules/paint.js.map +1 -1
  209. package/dist/components/modules/shapes.js.map +1 -1
  210. package/dist/components/modules/text-layout.js.map +1 -1
  211. package/dist/components/modules/text-style.d.ts +1 -1
  212. package/dist/components/modules/text-style.js.map +1 -1
  213. package/dist/components/modules/three-entries.js.map +1 -1
  214. package/dist/components/modules/view3d.js.map +1 -1
  215. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  216. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  217. package/dist/components/trees/2d/node-motion.js.map +1 -1
  218. package/dist/components/trees/2d/node-render.js.map +1 -1
  219. package/dist/components/trees/2d/node-space.js.map +1 -1
  220. package/dist/components/trees/2d/node-transform.js.map +1 -1
  221. package/dist/components/trees/2d/node2d.js.map +1 -1
  222. package/dist/components/trees/audio/index.js.map +1 -1
  223. package/dist/components/trees/audio/node-audio.js.map +1 -1
  224. package/dist/components/trees/index.js.map +1 -1
  225. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  226. package/dist/components/trees/node/node-reactive.d.ts +3 -4
  227. package/dist/components/trees/node/node-reactive.d.ts.map +1 -1
  228. package/dist/components/trees/node/node-reactive.js +13 -10
  229. package/dist/components/trees/node/node-reactive.js.map +1 -1
  230. package/dist/components/trees/node/node-time.js.map +1 -1
  231. package/dist/components/trees/node/node-walk.js.map +1 -1
  232. package/dist/components/trees/node/node.js.map +1 -1
  233. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  234. package/dist/components/trees/three/node3d.js.map +1 -1
  235. package/dist/document/audio.js.map +1 -1
  236. package/dist/document/builtins.js.map +1 -1
  237. package/dist/document/command-traits.d.ts +8 -0
  238. package/dist/document/command-traits.d.ts.map +1 -1
  239. package/dist/document/command-traits.js +17 -0
  240. package/dist/document/command-traits.js.map +1 -1
  241. package/dist/document/deny-globals.js.map +1 -1
  242. package/dist/document/diff.js.map +1 -1
  243. package/dist/document/doc-index.js.map +1 -1
  244. package/dist/document/expression/compile.js.map +1 -1
  245. package/dist/document/expression/index.js.map +1 -1
  246. package/dist/document/expression/ops.js.map +1 -1
  247. package/dist/document/expression/parse.js.map +1 -1
  248. package/dist/document/expression/refs.js.map +1 -1
  249. package/dist/document/expression/types.js.map +1 -1
  250. package/dist/document/expression/walk.js.map +1 -1
  251. package/dist/document/index.js.map +1 -1
  252. package/dist/document/migrate.js.map +1 -1
  253. package/dist/document/missing-node.js.map +1 -1
  254. package/dist/document/node-decorator.js.map +1 -1
  255. package/dist/document/node-descriptor.js.map +1 -1
  256. package/dist/document/placement.js.map +1 -1
  257. package/dist/document/project.js.map +1 -1
  258. package/dist/document/prop-evolution.js.map +1 -1
  259. package/dist/document/registry.js.map +1 -1
  260. package/dist/document/settled-index.d.ts +6 -0
  261. package/dist/document/settled-index.d.ts.map +1 -1
  262. package/dist/document/settled-index.js +18 -1
  263. package/dist/document/settled-index.js.map +1 -1
  264. package/dist/document/timeline-patch.js.map +1 -1
  265. package/dist/document/timeline.d.ts.map +1 -1
  266. package/dist/document/timeline.js +26 -6
  267. package/dist/document/timeline.js.map +1 -1
  268. package/dist/document/types.js.map +1 -1
  269. package/dist/document/validate.js.map +1 -1
  270. package/dist/document/vocabulary.js.map +1 -1
  271. package/dist/experimental.d.ts.map +1 -1
  272. package/dist/experimental.js.map +1 -1
  273. package/dist/index.js.map +1 -1
  274. package/dist/layout/bounds.js.map +1 -1
  275. package/dist/layout/constraints.js.map +1 -1
  276. package/dist/layout/flex.js.map +1 -1
  277. package/dist/layout/freeform.js.map +1 -1
  278. package/dist/layout/grid.js.map +1 -1
  279. package/dist/layout/index.js.map +1 -1
  280. package/dist/layout/item.js.map +1 -1
  281. package/dist/layout/ops.js.map +1 -1
  282. package/dist/layout/types.js.map +1 -1
  283. package/dist/platform/audio-sink.js.map +1 -1
  284. package/dist/platform/exporter.js.map +1 -1
  285. package/dist/platform/index.js.map +1 -1
  286. package/dist/platform/stepped-clock.js.map +1 -1
  287. package/dist/platform/storage-adapter.js.map +1 -1
  288. package/dist/platform/ticker.js.map +1 -1
  289. package/dist/project/config.js.map +1 -1
  290. package/dist/project/index.js.map +1 -1
  291. package/dist/project/tree.js.map +1 -1
  292. package/dist/props/host.d.ts +5 -0
  293. package/dist/props/host.d.ts.map +1 -1
  294. package/dist/props/host.js +3 -1
  295. package/dist/props/host.js.map +1 -1
  296. package/dist/props/index.js.map +1 -1
  297. package/dist/props/layout.d.ts +29 -0
  298. package/dist/props/layout.d.ts.map +1 -0
  299. package/dist/props/layout.js +84 -0
  300. package/dist/props/layout.js.map +1 -0
  301. package/dist/props/observer.js.map +1 -1
  302. package/dist/props/slot.js.map +1 -1
  303. package/dist/renamed-scene-names.js.map +1 -1
  304. package/dist/render/canvas-render-context2d.js.map +1 -1
  305. package/dist/render/clip-contains.js.map +1 -1
  306. package/dist/render/clip.js.map +1 -1
  307. package/dist/render/descriptors/ellipse.js.map +1 -1
  308. package/dist/render/descriptors/line.js.map +1 -1
  309. package/dist/render/descriptors/path-builder.js.map +1 -1
  310. package/dist/render/descriptors/path.js.map +1 -1
  311. package/dist/render/descriptors/polygon.js.map +1 -1
  312. package/dist/render/descriptors/polygram.js.map +1 -1
  313. package/dist/render/descriptors/rect.js.map +1 -1
  314. package/dist/render/descriptors/richtext.js.map +1 -1
  315. package/dist/render/descriptors/shape.js.map +1 -1
  316. package/dist/render/descriptors/text.js.map +1 -1
  317. package/dist/render/descriptors/transform.js.map +1 -1
  318. package/dist/render/graphics2d.js.map +1 -1
  319. package/dist/render/index.js.map +1 -1
  320. package/dist/render/measure-context.js.map +1 -1
  321. package/dist/render/null-render-context.js.map +1 -1
  322. package/dist/render/render-context2d.js.map +1 -1
  323. package/dist/render/render-issue.js.map +1 -1
  324. package/dist/render/surface.js.map +1 -1
  325. package/dist/render/text-defaults.js.map +1 -1
  326. package/dist/render/text-layout.js.map +1 -1
  327. package/dist/render3d/bounds3d.js.map +1 -1
  328. package/dist/render3d/builders.js.map +1 -1
  329. package/dist/render3d/camera.js.map +1 -1
  330. package/dist/render3d/fill3d.js.map +1 -1
  331. package/dist/render3d/geometry.js.map +1 -1
  332. package/dist/render3d/graphics3d.js.map +1 -1
  333. package/dist/render3d/index.js.map +1 -1
  334. package/dist/render3d/inert.js.map +1 -1
  335. package/dist/render3d/light.js.map +1 -1
  336. package/dist/render3d/material.js.map +1 -1
  337. package/dist/render3d/matrix4.js.map +1 -1
  338. package/dist/render3d/render-context3d.js.map +1 -1
  339. package/dist/render3d/resources.js.map +1 -1
  340. package/dist/render3d/rounded-box.js.map +1 -1
  341. package/dist/render3d/scene-settings.js.map +1 -1
  342. package/dist/render3d/scene3d.js.map +1 -1
  343. package/dist/render3d/segments.js.map +1 -1
  344. package/dist/render3d/texture.js.map +1 -1
  345. package/dist/render3d/tracking.js.map +1 -1
  346. package/dist/render3d/transform.js.map +1 -1
  347. package/dist/render3d/vector3.js.map +1 -1
  348. package/dist/render3d/walk.js.map +1 -1
  349. package/dist/runtime/asset-refine.js.map +1 -1
  350. package/dist/runtime/asset-timeline.js.map +1 -1
  351. package/dist/runtime/asset-update.js.map +1 -1
  352. package/dist/runtime/audio-index.js.map +1 -1
  353. package/dist/runtime/builtin-context.js.map +1 -1
  354. package/dist/runtime/clip-instance.js.map +1 -1
  355. package/dist/runtime/clip-store.js.map +1 -1
  356. package/dist/runtime/engine.js.map +1 -1
  357. package/dist/runtime/frame-time.js.map +1 -1
  358. package/dist/runtime/index.js.map +1 -1
  359. package/dist/runtime/node-picking.js.map +1 -1
  360. package/dist/runtime/node-picking3d.js.map +1 -1
  361. package/dist/runtime/placement.js.map +1 -1
  362. package/dist/runtime/playback-controller.js.map +1 -1
  363. package/dist/runtime/playback.js.map +1 -1
  364. package/dist/runtime/precompisition.js.map +1 -1
  365. package/dist/runtime/project-assets.js.map +1 -1
  366. package/dist/runtime/session.js.map +1 -1
  367. package/dist/runtime/settle.js.map +1 -1
  368. package/dist/runtime/state-evaluator.js.map +1 -1
  369. package/dist/runtime/text-geometry.js.map +1 -1
  370. package/dist/sdk/index.js.map +1 -1
  371. package/dist/tween/command-decorator.js.map +1 -1
  372. package/dist/tween/command.js.map +1 -1
  373. package/dist/tween/ease/constants.js.map +1 -1
  374. package/dist/tween/ease/curve.js.map +1 -1
  375. package/dist/tween/ease/describe.js.map +1 -1
  376. package/dist/tween/ease/spec.js.map +1 -1
  377. package/dist/tween/ease/type.js.map +1 -1
  378. package/dist/tween/index.js.map +1 -1
  379. package/dist/tween/inert.js.map +1 -1
  380. package/dist/tween/lerp.js.map +1 -1
  381. package/dist/tween/loop.js.map +1 -1
  382. package/dist/tween/prepare.js.map +1 -1
  383. package/dist/tween/stepper.js.map +1 -1
  384. package/dist/tween/to-command.js.map +1 -1
  385. package/dist/util/clamp.js.map +1 -1
  386. package/dist/util/context.js.map +1 -1
  387. package/dist/util/csv.js.map +1 -1
  388. package/dist/util/generateList.js.map +1 -1
  389. package/dist/util/index.js.map +1 -1
  390. package/dist/util/metrics.js.map +1 -1
  391. package/dist/util/random.js.map +1 -1
  392. package/dist/util/reference.js.map +1 -1
  393. package/dist/util/scheduler.js.map +1 -1
  394. package/package.json +1 -1
  395. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  396. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  397. package/dist/attributes/audio/filters/chain.js +0 -104
  398. package/dist/attributes/audio/filters/chain.js.map +0 -1
  399. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  400. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  401. package/dist/attributes/audio/filters/curve.js +0 -250
  402. package/dist/attributes/audio/filters/curve.js.map +0 -1
  403. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  404. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  405. package/dist/attributes/audio/filters/implementations/echo.js +0 -11
  406. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  407. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  408. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  409. package/dist/attributes/audio/filters/implementations/gain.js +0 -6
  410. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  411. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  412. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  413. package/dist/attributes/audio/filters/implementations/highpass.js +0 -10
  414. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  415. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  416. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  417. package/dist/attributes/audio/filters/implementations/lowpass.js +0 -10
  418. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  419. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  420. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  421. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  422. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  423. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  424. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  425. package/dist/attributes/audio/filters/implementations/tremolo.js +0 -10
  426. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  427. package/dist/attributes/audio/filters/index.d.ts +0 -22
  428. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  429. package/dist/attributes/audio/filters/index.js +0 -8
  430. package/dist/attributes/audio/filters/index.js.map +0 -1
  431. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  432. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  433. package/dist/attributes/audio/filters/registry.js +0 -82
  434. package/dist/attributes/audio/filters/registry.js.map +0 -1
  435. package/dist/attributes/audio/filters/union.d.ts +0 -18
  436. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  437. package/dist/attributes/audio/filters/union.js +0 -28
  438. package/dist/attributes/audio/filters/union.js.map +0 -1
  439. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  440. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  441. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  442. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  443. package/dist/browser/chunks/chunk-AOT33LMS.js +0 -13
  444. package/dist/browser/chunks/chunk-AOT33LMS.js.map +0 -7
  445. package/dist/browser/chunks/chunk-GKM6UZJR.js +0 -6
  446. package/dist/browser/chunks/chunk-GKM6UZJR.js.map +0 -7
  447. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  448. package/dist/browser/chunks/chunk-ZRPZPWZU.js +0 -3
  449. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  450. package/dist/component/api.d.ts +0 -508
  451. package/dist/component/api.d.ts.map +0 -1
  452. package/dist/component/api.js +0 -4
  453. package/dist/component/api.js.map +0 -1
  454. package/dist/component/builtins/audio.d.ts +0 -26
  455. package/dist/component/builtins/audio.d.ts.map +0 -1
  456. package/dist/component/builtins/audio.js +0 -41
  457. package/dist/component/builtins/audio.js.map +0 -1
  458. package/dist/component/builtins/canvas3d.d.ts +0 -98
  459. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  460. package/dist/component/builtins/canvas3d.js +0 -21
  461. package/dist/component/builtins/canvas3d.js.map +0 -1
  462. package/dist/component/builtins/composite.d.ts +0 -56
  463. package/dist/component/builtins/composite.d.ts.map +0 -1
  464. package/dist/component/builtins/composite.js +0 -25
  465. package/dist/component/builtins/composite.js.map +0 -1
  466. package/dist/component/builtins/geometry.d.ts +0 -505
  467. package/dist/component/builtins/geometry.d.ts.map +0 -1
  468. package/dist/component/builtins/geometry.js +0 -107
  469. package/dist/component/builtins/geometry.js.map +0 -1
  470. package/dist/component/builtins/layout.d.ts +0 -88
  471. package/dist/component/builtins/layout.d.ts.map +0 -1
  472. package/dist/component/builtins/layout.js +0 -84
  473. package/dist/component/builtins/layout.js.map +0 -1
  474. package/dist/component/builtins/media.d.ts +0 -95
  475. package/dist/component/builtins/media.d.ts.map +0 -1
  476. package/dist/component/builtins/media.js +0 -149
  477. package/dist/component/builtins/media.js.map +0 -1
  478. package/dist/component/builtins/providers.d.ts +0 -23
  479. package/dist/component/builtins/providers.d.ts.map +0 -1
  480. package/dist/component/builtins/providers.js +0 -30
  481. package/dist/component/builtins/providers.js.map +0 -1
  482. package/dist/component/builtins/text.d.ts +0 -193
  483. package/dist/component/builtins/text.d.ts.map +0 -1
  484. package/dist/component/builtins/text.js +0 -113
  485. package/dist/component/builtins/text.js.map +0 -1
  486. package/dist/component/builtins/three.d.ts +0 -1085
  487. package/dist/component/builtins/three.d.ts.map +0 -1
  488. package/dist/component/builtins/three.js +0 -265
  489. package/dist/component/builtins/three.js.map +0 -1
  490. package/dist/component/clip-of.d.ts +0 -5
  491. package/dist/component/clip-of.d.ts.map +0 -1
  492. package/dist/component/clip-of.js +0 -33
  493. package/dist/component/clip-of.js.map +0 -1
  494. package/dist/component/commands-for.d.ts +0 -19
  495. package/dist/component/commands-for.d.ts.map +0 -1
  496. package/dist/component/commands-for.js +0 -5
  497. package/dist/component/commands-for.js.map +0 -1
  498. package/dist/component/component-audio.d.ts +0 -9
  499. package/dist/component/component-audio.d.ts.map +0 -1
  500. package/dist/component/component-audio.js +0 -18
  501. package/dist/component/component-audio.js.map +0 -1
  502. package/dist/component/component2d.d.ts +0 -9
  503. package/dist/component/component2d.d.ts.map +0 -1
  504. package/dist/component/component2d.js +0 -239
  505. package/dist/component/component2d.js.map +0 -1
  506. package/dist/component/component3d.d.ts +0 -9
  507. package/dist/component/component3d.d.ts.map +0 -1
  508. package/dist/component/component3d.js +0 -99
  509. package/dist/component/component3d.js.map +0 -1
  510. package/dist/component/factory.d.ts +0 -63
  511. package/dist/component/factory.d.ts.map +0 -1
  512. package/dist/component/factory.js +0 -313
  513. package/dist/component/factory.js.map +0 -1
  514. package/dist/component/modules/aim.d.ts +0 -30
  515. package/dist/component/modules/aim.d.ts.map +0 -1
  516. package/dist/component/modules/aim.js +0 -39
  517. package/dist/component/modules/aim.js.map +0 -1
  518. package/dist/component/modules/corners.d.ts +0 -13
  519. package/dist/component/modules/corners.d.ts.map +0 -1
  520. package/dist/component/modules/corners.js +0 -12
  521. package/dist/component/modules/corners.js.map +0 -1
  522. package/dist/component/modules/flow.d.ts +0 -26
  523. package/dist/component/modules/flow.d.ts.map +0 -1
  524. package/dist/component/modules/flow.js +0 -55
  525. package/dist/component/modules/flow.js.map +0 -1
  526. package/dist/component/modules/material.d.ts +0 -40
  527. package/dist/component/modules/material.d.ts.map +0 -1
  528. package/dist/component/modules/material.js +0 -75
  529. package/dist/component/modules/material.js.map +0 -1
  530. package/dist/component/modules/paint.d.ts +0 -71
  531. package/dist/component/modules/paint.d.ts.map +0 -1
  532. package/dist/component/modules/paint.js +0 -106
  533. package/dist/component/modules/paint.js.map +0 -1
  534. package/dist/component/modules/shapes.d.ts +0 -31
  535. package/dist/component/modules/shapes.d.ts.map +0 -1
  536. package/dist/component/modules/shapes.js +0 -43
  537. package/dist/component/modules/shapes.js.map +0 -1
  538. package/dist/component/modules/text-layout.d.ts +0 -26
  539. package/dist/component/modules/text-layout.d.ts.map +0 -1
  540. package/dist/component/modules/text-layout.js +0 -57
  541. package/dist/component/modules/text-layout.js.map +0 -1
  542. package/dist/component/modules/text-style.d.ts +0 -48
  543. package/dist/component/modules/text-style.d.ts.map +0 -1
  544. package/dist/component/modules/text-style.js +0 -63
  545. package/dist/component/modules/text-style.js.map +0 -1
  546. package/dist/component/modules/three-entries.d.ts +0 -23
  547. package/dist/component/modules/three-entries.d.ts.map +0 -1
  548. package/dist/component/modules/three-entries.js +0 -41
  549. package/dist/component/modules/three-entries.js.map +0 -1
  550. package/dist/component/modules/view3d.d.ts +0 -55
  551. package/dist/component/modules/view3d.d.ts.map +0 -1
  552. package/dist/component/modules/view3d.js +0 -160
  553. package/dist/component/modules/view3d.js.map +0 -1
  554. package/dist/component/timeline.d.ts +0 -22
  555. package/dist/component/timeline.d.ts.map +0 -1
  556. package/dist/component/timeline.js +0 -128
  557. package/dist/component/timeline.js.map +0 -1
  558. package/dist/component/type-def.d.ts +0 -26
  559. package/dist/component/type-def.d.ts.map +0 -1
  560. package/dist/component/type-def.js +0 -16
  561. package/dist/component/type-def.js.map +0 -1
  562. package/dist/component/types.d.ts +0 -91
  563. package/dist/component/types.d.ts.map +0 -1
  564. package/dist/component/types.js +0 -88
  565. package/dist/component/types.js.map +0 -1
  566. package/dist/component/views.d.ts +0 -121
  567. package/dist/component/views.d.ts.map +0 -1
  568. package/dist/component/views.js +0 -413
  569. package/dist/component/views.js.map +0 -1
  570. package/dist/document/withdraw.d.ts +0 -28
  571. package/dist/document/withdraw.d.ts.map +0 -1
  572. package/dist/document/withdraw.js +0 -61
  573. package/dist/document/withdraw.js.map +0 -1
  574. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  575. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  576. package/dist/jsx/jsx-dev-runtime.js +0 -3
  577. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  578. package/dist/jsx/jsx-runtime.d.ts +0 -27
  579. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  580. package/dist/jsx/jsx-runtime.js +0 -26
  581. package/dist/jsx/jsx-runtime.js.map +0 -1
  582. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  583. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  584. package/dist/nodes/2d/node-lifecycle.js +0 -264
  585. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  586. package/dist/nodes/2d/node-motion.d.ts +0 -56
  587. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  588. package/dist/nodes/2d/node-motion.js +0 -86
  589. package/dist/nodes/2d/node-motion.js.map +0 -1
  590. package/dist/nodes/2d/node-render.d.ts +0 -44
  591. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  592. package/dist/nodes/2d/node-render.js +0 -80
  593. package/dist/nodes/2d/node-render.js.map +0 -1
  594. package/dist/nodes/2d/node-space.d.ts +0 -63
  595. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  596. package/dist/nodes/2d/node-space.js +0 -131
  597. package/dist/nodes/2d/node-space.js.map +0 -1
  598. package/dist/nodes/2d/node-transform.d.ts +0 -55
  599. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  600. package/dist/nodes/2d/node-transform.js +0 -73
  601. package/dist/nodes/2d/node-transform.js.map +0 -1
  602. package/dist/nodes/2d/node2d.d.ts +0 -1111
  603. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  604. package/dist/nodes/2d/node2d.js +0 -1665
  605. package/dist/nodes/2d/node2d.js.map +0 -1
  606. package/dist/nodes/2d/paint-node.d.ts +0 -142
  607. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  608. package/dist/nodes/2d/paint-node.js +0 -232
  609. package/dist/nodes/2d/paint-node.js.map +0 -1
  610. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  611. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  612. package/dist/nodes/audio/audio-bus.js +0 -33
  613. package/dist/nodes/audio/audio-bus.js.map +0 -1
  614. package/dist/nodes/audio/index.d.ts +0 -4
  615. package/dist/nodes/audio/index.d.ts.map +0 -1
  616. package/dist/nodes/audio/index.js +0 -2
  617. package/dist/nodes/audio/index.js.map +0 -1
  618. package/dist/nodes/audio/node-audio.d.ts +0 -107
  619. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  620. package/dist/nodes/audio/node-audio.js +0 -179
  621. package/dist/nodes/audio/node-audio.js.map +0 -1
  622. package/dist/nodes/audio/sound-node.d.ts +0 -41
  623. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  624. package/dist/nodes/audio/sound-node.js +0 -71
  625. package/dist/nodes/audio/sound-node.js.map +0 -1
  626. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  627. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  628. package/dist/nodes/geometry/boolean-node.js +0 -81
  629. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  630. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  631. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  632. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  633. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  634. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  635. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  636. package/dist/nodes/geometry/box-path-node.js +0 -116
  637. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  638. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  639. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  640. package/dist/nodes/geometry/ellipse-node.js +0 -45
  641. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  642. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  643. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  644. package/dist/nodes/geometry/group-bounds.js +0 -87
  645. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  646. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  647. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  648. package/dist/nodes/geometry/mask-node.js +0 -66
  649. package/dist/nodes/geometry/mask-node.js.map +0 -1
  650. package/dist/nodes/geometry/path-node.d.ts +0 -26
  651. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  652. package/dist/nodes/geometry/path-node.js +0 -58
  653. package/dist/nodes/geometry/path-node.js.map +0 -1
  654. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  655. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  656. package/dist/nodes/geometry/polygon-node.js +0 -47
  657. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  658. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  659. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  660. package/dist/nodes/geometry/polygram-node.js +0 -52
  661. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  662. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  663. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  664. package/dist/nodes/geometry/rect-node.js +0 -56
  665. package/dist/nodes/geometry/rect-node.js.map +0 -1
  666. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  667. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  668. package/dist/nodes/geometry/shape-node.js +0 -140
  669. package/dist/nodes/geometry/shape-node.js.map +0 -1
  670. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  671. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  672. package/dist/nodes/geometry/shape-outline.js +0 -470
  673. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  674. package/dist/nodes/index.d.ts +0 -53
  675. package/dist/nodes/index.d.ts.map +0 -1
  676. package/dist/nodes/index.js +0 -35
  677. package/dist/nodes/index.js.map +0 -1
  678. package/dist/nodes/layout/camera-node.d.ts +0 -80
  679. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  680. package/dist/nodes/layout/camera-node.js +0 -153
  681. package/dist/nodes/layout/camera-node.js.map +0 -1
  682. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  683. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  684. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  685. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  686. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  687. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  688. package/dist/nodes/layout/rotated-box.js +0 -76
  689. package/dist/nodes/layout/rotated-box.js.map +0 -1
  690. package/dist/nodes/media/video-node.d.ts +0 -229
  691. package/dist/nodes/media/video-node.d.ts.map +0 -1
  692. package/dist/nodes/media/video-node.js +0 -350
  693. package/dist/nodes/media/video-node.js.map +0 -1
  694. package/dist/nodes/node/declare-paints.d.ts +0 -19
  695. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  696. package/dist/nodes/node/declare-paints.js +0 -27
  697. package/dist/nodes/node/declare-paints.js.map +0 -1
  698. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  699. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  700. package/dist/nodes/node/node-editor-state.js +0 -23
  701. package/dist/nodes/node/node-editor-state.js.map +0 -1
  702. package/dist/nodes/node/node-reactive.d.ts +0 -89
  703. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  704. package/dist/nodes/node/node-reactive.js +0 -135
  705. package/dist/nodes/node/node-reactive.js.map +0 -1
  706. package/dist/nodes/node/node-time.d.ts +0 -39
  707. package/dist/nodes/node/node-time.d.ts.map +0 -1
  708. package/dist/nodes/node/node-time.js +0 -14
  709. package/dist/nodes/node/node-time.js.map +0 -1
  710. package/dist/nodes/node/node-walk.d.ts +0 -46
  711. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  712. package/dist/nodes/node/node-walk.js +0 -74
  713. package/dist/nodes/node/node-walk.js.map +0 -1
  714. package/dist/nodes/node/node.d.ts +0 -445
  715. package/dist/nodes/node/node.d.ts.map +0 -1
  716. package/dist/nodes/node/node.js +0 -745
  717. package/dist/nodes/node/node.js.map +0 -1
  718. package/dist/nodes/node/text-defaults.d.ts +0 -32
  719. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  720. package/dist/nodes/node/text-defaults.js +0 -37
  721. package/dist/nodes/node/text-defaults.js.map +0 -1
  722. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  723. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  724. package/dist/nodes/root/canvas2d-node.js +0 -264
  725. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  726. package/dist/nodes/root/provider-node.d.ts +0 -47
  727. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  728. package/dist/nodes/root/provider-node.js +0 -63
  729. package/dist/nodes/root/provider-node.js.map +0 -1
  730. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  731. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  732. package/dist/nodes/root/theme-provider-node.js +0 -43
  733. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  734. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  735. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  736. package/dist/nodes/text/default-text-style-node.js +0 -146
  737. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  738. package/dist/nodes/text/number-format.d.ts +0 -66
  739. package/dist/nodes/text/number-format.d.ts.map +0 -1
  740. package/dist/nodes/text/number-format.js +0 -227
  741. package/dist/nodes/text/number-format.js.map +0 -1
  742. package/dist/nodes/text/number-node.d.ts +0 -94
  743. package/dist/nodes/text/number-node.d.ts.map +0 -1
  744. package/dist/nodes/text/number-node.js +0 -86
  745. package/dist/nodes/text/number-node.js.map +0 -1
  746. package/dist/nodes/text/number-pattern.d.ts +0 -51
  747. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  748. package/dist/nodes/text/number-pattern.js +0 -77
  749. package/dist/nodes/text/number-pattern.js.map +0 -1
  750. package/dist/nodes/text/richtext-node.d.ts +0 -68
  751. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  752. package/dist/nodes/text/richtext-node.js +0 -78
  753. package/dist/nodes/text/richtext-node.js.map +0 -1
  754. package/dist/nodes/text/text-base.d.ts +0 -118
  755. package/dist/nodes/text/text-base.d.ts.map +0 -1
  756. package/dist/nodes/text/text-base.js +0 -153
  757. package/dist/nodes/text/text-base.js.map +0 -1
  758. package/dist/nodes/text/text-layout.d.ts +0 -87
  759. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  760. package/dist/nodes/text/text-layout.js +0 -368
  761. package/dist/nodes/text/text-layout.js.map +0 -1
  762. package/dist/nodes/text/text-node.d.ts +0 -84
  763. package/dist/nodes/text/text-node.d.ts.map +0 -1
  764. package/dist/nodes/text/text-node.js +0 -188
  765. package/dist/nodes/text/text-node.js.map +0 -1
  766. package/dist/nodes/text/text-selection.d.ts +0 -125
  767. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  768. package/dist/nodes/text/text-selection.js +0 -209
  769. package/dist/nodes/text/text-selection.js.map +0 -1
  770. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  771. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  772. package/dist/nodes/three/camera-nodes.js +0 -112
  773. package/dist/nodes/three/camera-nodes.js.map +0 -1
  774. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  775. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  776. package/dist/nodes/three/canvas3d-node.js +0 -486
  777. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  778. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  779. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  780. package/dist/nodes/three/drawable-nodes.js +0 -284
  781. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  782. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  783. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  784. package/dist/nodes/three/environment-nodes.js +0 -134
  785. package/dist/nodes/three/environment-nodes.js.map +0 -1
  786. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  787. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  788. package/dist/nodes/three/geometry-nodes.js +0 -322
  789. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  790. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  791. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  792. package/dist/nodes/three/grid-geometry3d.js +0 -114
  793. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  794. package/dist/nodes/three/group3d.d.ts +0 -23
  795. package/dist/nodes/three/group3d.d.ts.map +0 -1
  796. package/dist/nodes/three/group3d.js +0 -21
  797. package/dist/nodes/three/group3d.js.map +0 -1
  798. package/dist/nodes/three/light-nodes.d.ts +0 -120
  799. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  800. package/dist/nodes/three/light-nodes.js +0 -173
  801. package/dist/nodes/three/light-nodes.js.map +0 -1
  802. package/dist/nodes/three/mesh3d.d.ts +0 -117
  803. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  804. package/dist/nodes/three/mesh3d.js +0 -147
  805. package/dist/nodes/three/mesh3d.js.map +0 -1
  806. package/dist/nodes/three/node3d.d.ts +0 -230
  807. package/dist/nodes/three/node3d.d.ts.map +0 -1
  808. package/dist/nodes/three/node3d.js +0 -337
  809. package/dist/nodes/three/node3d.js.map +0 -1
  810. package/dist/render/descriptors/latex.d.ts +0 -6
  811. package/dist/render/descriptors/latex.d.ts.map +0 -1
  812. package/dist/render/descriptors/latex.js +0 -2
  813. package/dist/render/descriptors/latex.js.map +0 -1
  814. package/dist/tween/seekable.d.ts +0 -81
  815. package/dist/tween/seekable.d.ts.map +0 -1
  816. package/dist/tween/seekable.js +0 -137
  817. package/dist/tween/seekable.js.map +0 -1
@@ -1,1665 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { _observer, PropSlot } from "../../props/slot.js";
8
- import { LAYOUT_SLOT } from "../../props/observer.js";
9
- import { AssetNotLoadedError } from "../../assets/errors.js";
10
- import { property } from "../../attributes/properties/decorator.js";
11
- import { effectsProperty, insetsProperty, alignmentProperty } from "../../attributes/properties/typed.js";
12
- import { createMotionHistory, sampleMotion, primeMotion } from "./node-motion.js";
13
- import { addChildAtAnimated, removeChildAtAnimated, reparentAnimated } from "./node-lifecycle.js";
14
- import { alignmentOps } from "../../attributes/layout/alignment.js";
15
- import { Node } from "../../nodes/node/node.js";
16
- import { applyToPoint, facesAway, hasProjection3D, invert, multiply, } from "../../attributes/layout/matrix2d.js";
17
- import { expandTransform3D } from "../../attributes/layout/transform3d.js";
18
- import { multiplyAffine3, nodeSpaceMatrix } from "../../attributes/layout/space3d.js";
19
- import { localMatrix, rotateOffset, worldAnchors } from "./node-transform.js";
20
- import { spaceChildFrame, spaceChildOrder, spaceRootFrame } from "./node-space.js";
21
- import { applyBackdropEffects as applyBackdropEffectsImpl, applyContentEffectScope, computeSpaceRects, } from "./node-render.js";
22
- import { command } from "../../tween/command-decorator.js";
23
- import { PathBuilder } from "../../render/descriptors/path-builder.js";
24
- import { pathOps } from "../../attributes/shape/path/ops.js";
25
- import { size2DOps, sizeInputOps } from "../../attributes/layout/size.js";
26
- import { insetsOps } from "../../attributes/layout/insets.js";
27
- import { lerpPerspective } from "../../tween/lerp.js";
28
- import { flowOps } from "../../layout/ops.js";
29
- /**
30
- * Stand-in for a node's reference rects when the context never reads them.
31
- * Shared and empty — `computeSpaceRects` returns the same shape for a node with
32
- * no parent, so consumers already handle it. See {@link Node2D.beforeRender}.
33
- */
34
- const NO_SPACE_RECTS = {};
35
- /** The node centre in the normalised `[-1, 1]` alignment space — `pivot`'s own default. */
36
- const ORIGIN_2D = { x: 0, y: 0 };
37
- const NO_HANDLES = [];
38
- // Filled per call and read synchronously by the matrix builders, like `_projectionScratch`.
39
- const SLOT_PROJECTION = {
40
- rotationX: 0, rotationY: 0, rotationZ: 0, depth: 0, perspective: 0,
41
- flipHorizontal: false, flipVertical: false,
42
- };
43
- function slotProjection(placement) {
44
- SLOT_PROJECTION.rotationX = placement.rotationX;
45
- SLOT_PROJECTION.rotationY = placement.rotationY;
46
- SLOT_PROJECTION.depth = placement.depth;
47
- return SLOT_PROJECTION;
48
- }
49
- /** No settings: centred freeform, which is how a plain node arranges its children. */
50
- const DEFAULT_FLOW = Object.freeze({});
51
- const NO_CONTENT = { width: 0, height: 0 };
52
- // WorldTransform, PropInput, and PropInputs now live in dedicated
53
- // modules (see imports above) and are re-exported below so existing
54
- // `from ".../node2d"` imports keep resolving.
55
- export { Node } from "../../nodes/node/node.js";
56
- /**
57
- * Base class for all scene-graph nodes.
58
- *
59
- * Every visible or structural element in a scene extends `Node2D`. It wires
60
- * together three orthogonal systems:
61
- *
62
- * **Properties** — fields declared with `@property()` are backed by a
63
- * {@link PropSlot}, which holds either a value or a thunk. Use {@link set} to
64
- * update one or more props imperatively, or pass a callback `() => expr` to
65
- * bind the prop to a derived value, which recomputes on every read.
66
- *
67
- * **Tweening** — `to(props, duration, ease?)` returns a {@link Command}
68
- * that animates one or more props to target values over the given duration (in
69
- * seconds). It is evaluable at a time via `at(t)`. Numeric props are
70
- * interpolated; props that register a custom `tween` fn (via
71
- * `@property({ tween })`) can animate any value type. The convenience helpers
72
- * `moveTo`, `moveX`, `moveY`, `fadeTo`, `rotateTo`, and `scaleTo` wrap `to`
73
- * for the most common single-property animations.
74
- *
75
- * **Layout** — `measure()` is called top-down to resolve sizes, then
76
- * `layout()` places the node in its allocated `BoxBounds`. Children are
77
- * measured and laid out by the parent; the base class just stores the rect.
78
- *
79
- * ### Built-in visual props
80
- * | prop | default | unit / notes |
81
- * |-----------|----------|---------------------------------------|
82
- * | `x` | 0 | horizontal offset in scene pixels |
83
- * | `y` | 0 | vertical offset (positive = up) |
84
- * | `width` | `'fill'` | `SizeInput`: px, `'fill'`, `'auto'` |
85
- * | `height` | `'fill'` | same |
86
- * | `size` | — | sugar: sets `width` and `height` together |
87
- * | `scale` | 1 | uniform scale factor |
88
- * | `rotate` | 0 | degrees, clockwise |
89
- * | `opacity` | 1 | 0–1 |
90
- * | `blend` | `'pass-through'` | layer blend mode (`NodeBlendMode`) |
91
- * | `effects` | [] | post-process / blend effects |
92
- * | `padding` | 0 | inner spacing, all four edges |
93
- */ export class Node2D extends Node {
94
- get dimension() { return "2d"; }
95
- /**
96
- * This node's parent, when that parent is itself 2D.
97
- *
98
- * A `Node2D` can only ever be adopted by another `Node2D` (see
99
- * {@link Node.acceptsChild}), so this is `null` only for a detached node or
100
- * the root — but it is typed honestly rather than cast, because the base
101
- * tree holds both dimensions.
102
- */
103
- get parent2D() {
104
- const parent = this._parent;
105
- return parent instanceof Node2D ? parent : null;
106
- }
107
- /**
108
- * This node's parent, narrowed to the 2D tree.
109
- *
110
- * Only a `Node2D` can adopt a `Node2D` (see {@link Node.acceptsChild}), so
111
- * this never hides a real parent — it just spares every 2D caller a cast.
112
- */
113
- get parent() {
114
- if (_observer !== null)
115
- _observer.read(this._structureSlot());
116
- return this.parent2D;
117
- }
118
- /**
119
- * This node's children **in the 2D tree**.
120
- *
121
- * `Canvas3D` is the one node that holds both dimensions, and its `Node3D`
122
- * children are not part of the 2D tree — they describe a scene it paints,
123
- * not boxes it lays out — so they are reached through its own accessor
124
- * instead. Every other node's list is already 2D, and this returns the live
125
- * array untouched in that case rather than allocating a copy per read.
126
- */
127
- get children() {
128
- if (_observer !== null)
129
- _observer.read(this._structureSlot());
130
- const all = this._children;
131
- for (let i = 0; i < all.length; i++) {
132
- if (!(all[i] instanceof Node2D)) {
133
- return all.filter((c) => c instanceof Node2D);
134
- }
135
- }
136
- return all;
137
- }
138
- constructor(props) {
139
- super(props);
140
- // Expand the `size` and `transform3D` sugar into the props they name
141
- // before anything reads either — in place, so the single object `super()`
142
- // retained as `_props` already carries the expanded values.
143
- if (props) {
144
- size2DOps.expand(props);
145
- expandTransform3D(props);
146
- }
147
- // Fires the ref, adopts the seed, and applies every `@property` default.
148
- // Deferred to here rather than run by `super()` because the cells those
149
- // props write into are this class's own fields, and a subclass's field
150
- // initializers only run once `super()` has returned.
151
- this.initProps(props);
152
- // Specifying `flex` signals intent to fill the parent's main axis, so an
153
- // unspecified width/height defaults to 'fill' (flex is a no-op on a
154
- // fixed/hug axis) and skips the has-children default below.
155
- if (props && props.flex !== undefined) {
156
- if (props.width === undefined)
157
- this.applyProp("width", "fill", { tween: sizeInputOps.lerp });
158
- if (props.height === undefined)
159
- this.applyProp("height", "fill", { tween: sizeInputOps.lerp });
160
- }
161
- else {
162
- this.applyDefaultSize(props);
163
- }
164
- // Alignment-based positioning: validate, derive pivot, bind x/y. The pivot
165
- // and centre offset math lives in alignmentOps (shared with the
166
- // `to()` path); here we use its reactive binding form.
167
- if (props) {
168
- alignmentOps.validateProps(props);
169
- const alignmentKey = alignmentOps.findKey(props);
170
- if (alignmentKey) {
171
- const raw = props[alignmentKey];
172
- const getTarget = typeof raw === 'function' ? raw : () => raw;
173
- const { pivot, x, y } = alignmentOps.bindTarget(alignmentKey, getTarget, () => this._layoutBounds.get());
174
- this._writeProp('pivot', pivot);
175
- this._writeProp('x', x);
176
- this._writeProp('y', y);
177
- }
178
- }
179
- this.adoptChildrenProp(props);
180
- }
181
- /**
182
- * The 2D half of `set()`: `size` and `transform3D` are sugar with no slot of
183
- * their own, so they are distributed into the props that do have one before
184
- * the generic write loop runs.
185
- */
186
- set(props) {
187
- // `size` has no slot of its own — it's sugar written straight to
188
- // width/height (explicit width/height in the same call still wins).
189
- const sizeVal = props.size;
190
- // Same for `transform3D`, but expanded up front rather than after the
191
- // loop: its fields are real props, so distributing them into `props`
192
- // first means the generic loop writes them like any other key. Only the
193
- // present-and-an-object case allocates, which is the rare one.
194
- if (props.transform3D !== undefined) {
195
- props = { ...props };
196
- expandTransform3D(props);
197
- }
198
- super.set(props);
199
- if (sizeVal !== undefined) {
200
- if (props.width === undefined)
201
- this._writeProp('width', sizeVal);
202
- if (props.height === undefined)
203
- this._writeProp('height', sizeVal);
204
- }
205
- }
206
- /**
207
- * The 2D half of `_prepareStep`: expand the positional sugar into the props
208
- * that actually have cells, then let the base resolve the step.
209
- *
210
- * `to` is mutated in place, so the base sees the expanded target — which is
211
- * why this can run entirely before `super`.
212
- */
213
- _prepareStep(to, duration, easing) {
214
- // `size` has no slot of its own — expand it into width/height targets
215
- // before anchor validation and the per-key tween setup below see it.
216
- // `transform3D` is sugar in the same way, so it expands here too and its
217
- // fields tween individually, exactly as if they had been named directly.
218
- size2DOps.expand(to);
219
- expandTransform3D(to);
220
- // `pivot`: an explicit, transient origin for *this step's* rotation and
221
- // scale — `moveTo`/`rotateTo`/`scaleTo`'s own option (see their object-form
222
- // overloads below), or just as well a bare key on a `to()` target. Not a
223
- // real prop — nothing on the node holds a value named `pivot` that a tween
224
- // interpolates — so it's read and stripped before anything else here (the
225
- // alignment validation included) ever sees it.
226
- const explicitPivot = to.pivot;
227
- if (explicitPivot !== undefined)
228
- delete to.pivot;
229
- alignmentOps.validateProps(to);
230
- // If an alignment key is in the tween target, resolve it to x/y targets and
231
- // set the transform origin (one-shot form of the shared alignment math in
232
- // alignmentOps).
233
- const alignmentKey = alignmentOps.findKey(to);
234
- if (alignmentKey) {
235
- const raw = to[alignmentKey];
236
- const { pivot, x, y } = alignmentOps.resolveTargetOnce(alignmentKey, this._layoutBounds.get(), raw);
237
- // Was `this._writeProp('pivot', pivot)`. `pivot` is the node's
238
- // *permanent* rotation/scale origin — set once, reactively, at
239
- // construction (see `alignmentOps.bindTarget`) from whichever alignment prop
240
- // positions it there. A *tween's* target used to overwrite that
241
- // permanent value with its own alignment every time one was used to
242
- // state a position, which means a `moveTo` aligned differently from
243
- // the node quietly re-pointed every rotation that ran after it.
244
- // `transformOrigin` (see its own doc) is the right prop for this
245
- // instead: it wins for the whole transform without being the node's
246
- // one true pivot. An explicit `pivot` given on this same step (via
247
- // `moveTo`/`rotateTo`/`scaleTo`'s object form) overrides the
248
- // alignment-derived value in turn — the point a position is stated
249
- // against and the point a rotation turns about are two different
250
- // questions once a step can state them separately.
251
- this._writeProp('transformOrigin', explicitPivot !== undefined ? alignmentOps.resolve(explicitPivot) : pivot);
252
- to.x = x;
253
- to.y = y;
254
- }
255
- else if (explicitPivot !== undefined) {
256
- this._writeProp('transformOrigin', alignmentOps.resolve(explicitPivot));
257
- }
258
- return super._prepareStep(to, duration, easing);
259
- }
260
- /**
261
- * {@link PaintNode} adds `fill`/`stroke`/`shadow` and {@link ShapeNode} `overlay`, so only a
262
- * node painting something its attributes do not describe has anything to add.
263
- */
264
- declareAssets(assets) {
265
- assets.effects(this.effects);
266
- }
267
- /** Sample this node's own derived render state for the current frame. */
268
- _sample() {
269
- this._sampleMotion();
270
- }
271
- /**
272
- * Record this node's current position as the motion history's previous
273
- * frame, stamped `at`, deriving no velocity — see the base's note.
274
- */
275
- _primeMotion(at) {
276
- const r = this.layoutBounds;
277
- const o = this._offset();
278
- primeMotion(this._motionHistory, (r?.x ?? 0) + o.x, (r?.y ?? 0) - o.y, this.rotation, this.scale, at);
279
- }
280
- _layoutBounds = new PropSlot({ x: 0, y: 0, width: 0, height: 0 }, this, LAYOUT_SLOT);
281
- /**
282
- * The size limits and the measurer threaded through this node's last
283
- * {@link measure} pass.
284
- *
285
- * Retained so off-tree work can measure a not-yet-attached child *in
286
- * isolation* — the animated child-insert in `node-lifecycle.ts` needs a hug
287
- * child's natural size without putting it in this node's flow first, or the
288
- * siblings shift for a frame. Undefined until this node is first measured.
289
- *
290
- * One object rather than two loose fields, because the two are only ever
291
- * useful together and were previously reached through a
292
- * `{ constraints?; _lastScope? }` structural cast from two other modules —
293
- * a cast that would have gone on compiling through any rename.
294
- *
295
- * @internal
296
- */
297
- lastMeasure;
298
- /** The constraints this node was last measured against. */
299
- get constraints() {
300
- return this.lastMeasure?.constraints ?? {};
301
- }
302
- /**
303
- * The box the last layout pass allocated this node: its size, and where it
304
- * sits in its parent's space (canvas y-down).
305
- *
306
- * Reactive — a read inside a binding is tracked, so a prop bound to another
307
- * node's box re-evaluates when that box moves.
308
- *
309
- * **Public, and a single member.** It used to be a `protected layoutRect`
310
- * plus a public `measuredRect` alias that existed only so the picking walk
311
- * could reach it — and, in practice, a `(node as any).layoutRect` cast in
312
- * every test that needed a box. Two names for one value, one of them
313
- * reachable only by lying to the compiler, is worse than the thing
314
- * `protected` was buying. Writing it is still {@link setLayoutBounds}, which
315
- * is where the layout engine's invariants live.
316
- */
317
- get layoutBounds() { return this._layoutBounds.get(); }
318
- /**
319
- * {@link flattenChildrenProp}, narrowed to the children this node will
320
- * actually lay out — a 3D or audio child sits in the same `children` prop but
321
- * takes no part in 2D layout, so it can't inform the size defaults either.
322
- */
323
- static flowChildrenProp(props) {
324
- return Node2D.flattenChildrenProp(props).filter((c) => c instanceof Node2D);
325
- }
326
- /**
327
- * True if any of `children` requests `"fill"` on `axis` — the signal a
328
- * container's {@link applyDefaultSize} override uses to decide whether its
329
- * own hug default on that axis would strand the child with no space to
330
- * fill into (see the {@link Rect} override).
331
- */
332
- static hasFillChild(children, axis) {
333
- return children.some((c) => (axis === "width" ? c.width : c.height) === "fill");
334
- }
335
- /**
336
- * Figma-style smart default for `width`/`height`: hug-to-content when the
337
- * node is given children, fill-the-parent when it's empty — so a plain
338
- * `new Rect({ children: [...] })` shrink-wraps like a Figma auto-layout
339
- * frame, while an empty one behaves like a background/spacer. Called once
340
- * from the constructor (skipped when `flex` is set, since that already
341
- * implies 'fill'), so it's the baseline every `Node2D` gets for free.
342
- *
343
- * Subclasses with their own sizing convention (`Text` hugs single-line
344
- * text but fills when wrapping/autofit; `Path`/`RichText` always hug)
345
- * override this — typically a one-line replacement
346
- * — instead of duplicating the children-check in their constructor.
347
- */
348
- applyDefaultSize(props) {
349
- const hasChildren = Node2D.flowChildrenProp(props).length > 0;
350
- const defaultSize = hasChildren ? "hug" : "fill";
351
- if (!props || props.width === undefined)
352
- this.applyProp("width", defaultSize, { tween: sizeInputOps.lerp });
353
- if (!props || props.height === undefined)
354
- this.applyProp("height", defaultSize, { tween: sizeInputOps.lerp });
355
- }
356
- // ---- Motion helpers ---------------------------------------------------
357
- //
358
- // Each returns the `Command` it delegates to rather than wrapping it in
359
- // anything, because the wrapper would discard the thing worth having: a
360
- // `Command` can be *evaluated* at a time, and anything that merely advances
361
- // can only be run to one.
362
- /**
363
- * Animate `x`/`y` to the given position, along `path`, or onto another node.
364
- * `pivot` (optional) sets {@link Node2DProps.transformOrigin} — the point
365
- * later rotate/scale turn about — independent of the node's own permanent
366
- * {@link pivot}, and it carries forward like any other prop until something
367
- * restates it.
368
- *
369
- * `path` replaces the destination rather than qualifying it — stating both is
370
- * an error, since the path's own end is where the move ends — and the node
371
- * walks it by **arc length**, so easing shapes the travel rather than the
372
- * curve's parameter. Its coordinates *are* `x`/`y` values, in the same y-up
373
- * space a `PathCommand[]` is authored in library-wide: the path says where
374
- * the node is at `t`, not how far it has come from wherever the previous
375
- * command left it.
376
- *
377
- * `target` is a node id and `targetAnchor` the point of its box to land on
378
- * (centre when absent), resolved when the command is built — so moving the
379
- * target re-aims the move with nothing to re-author, and a target absent at
380
- * that moment leaves the node where it is. Like `path`, it replaces `x`/`y`.
381
- * Given a `path` as well, the path is turned and scaled about its own start
382
- * until its end lands on the target, which is exact where the two already
383
- * agree and keeps the curve's shape where the target has since moved.
384
- *
385
- * @example
386
- * node.moveTo({ data: { x: 200, y: 100, pivot: 'topRight' }, duration: 0.5 });
387
- * node.moveTo({ data: { path: new PathBuilder().arc({ width: 600, startAngle: 180, sweep: -180 }) }, duration: 2 });
388
- * node.moveTo({ data: { target: 'card', targetAnchor: 'topRight' }, duration: 1 });
389
- */
390
- moveTo(args) {
391
- const { path, target, targetAnchor, ...destination } = args.data ?? {};
392
- const positioned = destination.x !== undefined || destination.y !== undefined;
393
- const aimed = typeof target === "string" && target !== "";
394
- if (aimed && positioned) {
395
- throw new Error("moveTo takes a `target` or an `x`/`y` destination, not both — the target's anchor is where the move ends.");
396
- }
397
- const aim = aimed ? this._pointOnNode(target, targetAnchor) : null;
398
- if (path === undefined || path === null) {
399
- return this.to({ data: { ...destination, ...aim }, duration: args.duration, easing: args.easing });
400
- }
401
- if (positioned) {
402
- throw new Error("moveTo takes a `path` or an `x`/`y` destination, not both — the path's own end is where the move ends.");
403
- }
404
- const sampler = pathOps.sampler(path instanceof PathBuilder ? path.toCommands() : path);
405
- const { length } = sampler;
406
- const first = sampler.frameAt(0);
407
- const last = sampler.frameAt(length);
408
- const fit = aim && first && last ? pathOps.endFit(first, last, aim) : null;
409
- const origin = destination.pivot;
410
- return this.command((t) => {
411
- const frame = sampler.frameAt(length * t);
412
- // A degenerate path has no point to be at, so the move writes
413
- // nothing rather than collapsing the node onto the origin.
414
- if (!frame)
415
- return {};
416
- const point = fit ? fit(frame) : frame;
417
- const at = { x: point.x, y: point.y };
418
- if (origin !== undefined)
419
- at.transformOrigin = origin;
420
- return at;
421
- }, args.duration, args.easing);
422
- }
423
- /** Animate `opacity` to the target value, in `[0, 1]`. */
424
- fadeTo(args) {
425
- return this.to({ data: args.data, duration: args.duration, easing: args.easing });
426
- }
427
- /**
428
- * Animate `rotation` to the target angle (degrees, clockwise). `pivot`
429
- * (optional) behaves as in {@link moveTo}.
430
- *
431
- * @example
432
- * node.rotateTo({ data: { rotation: 180, pivot: 'topRight' }, duration: 0.6 });
433
- */
434
- rotateTo(args) {
435
- return this.to({ data: args.data, duration: args.duration, easing: args.easing });
436
- }
437
- /**
438
- * Animate `scale` to the target factor. `pivot` (optional) behaves as in
439
- * {@link moveTo}.
440
- *
441
- * @example
442
- * node.scaleTo({ data: { scale: 2, pivot: 'topRight' }, duration: 0.4 });
443
- */
444
- scaleTo(args) {
445
- return this.to({ data: args.data, duration: args.duration, easing: args.easing });
446
- }
447
- /**
448
- * Animate the box: `width`, `height` and `padding`, whichever are given.
449
- * A size keyword (`'fill'`, `'hug'`) snaps; a number interpolates.
450
- *
451
- * @example
452
- * node.layoutTo({ data: { width: 640, height: 360 }, duration: 0.5 });
453
- */
454
- layoutTo(args) {
455
- return this.to({ data: _stated(args.data), duration: args.duration, easing: args.easing });
456
- }
457
- /**
458
- * Swell to `factor` times the node's size and settle back: a nudge of the
459
- * eye toward it. It ends as it began, so nothing after it needs restating.
460
- *
461
- * @example
462
- * node.pulse({ data: { factor: 1.3 }, duration: 0.6 });
463
- */
464
- pulse(args) {
465
- const rest = this.scale;
466
- const factor = args.data?.factor ?? 1.2;
467
- return this.command((t) => ({ scale: rest * (1 + (factor - 1) * Math.sin(Math.PI * t)) }), args.duration, args.easing);
468
- }
469
- /**
470
- * Rock about the node's own turn, `angle` degrees each way for `turns`
471
- * swings, building up and dying away. It ends as it began.
472
- *
473
- * @example
474
- * node.wiggle({ data: { angle: 10, turns: 4 }, duration: 0.8 });
475
- */
476
- wiggle(args) {
477
- const rest = this.rotation;
478
- const angle = args.data?.angle ?? 8;
479
- const turns = args.data?.turns ?? 3;
480
- return this.command((t) => ({ rotation: rest + angle * Math.sin(2 * Math.PI * turns * t) * Math.sin(Math.PI * t) }), args.duration, args.easing);
481
- }
482
- /** Animate the `effects` stack to another one. */
483
- effectTo(args) {
484
- return this.to({ data: _stated(args.data), duration: args.duration, easing: args.easing });
485
- }
486
- // ---- Layout queries ---------------------------------------------------
487
- get measuredWidth() {
488
- return this.layoutBounds.width;
489
- }
490
- get measuredHeight() {
491
- return this.layoutBounds.height;
492
- }
493
- // ---- Alignment points ----------------------------------------------------
494
- // All getters read `layoutBounds` and the x/y/rotation props, and a bound prop
495
- // recomputes on every read — so a callback built from them is always current.
496
- /** Rotate offset (ox, oy) by this node's rotation (degrees clockwise) around the node center. */
497
- _rotateOffset(ox, oy) {
498
- const o = this._offset();
499
- return rotateOffset(o.x, o.y, this.rotation, ox, oy);
500
- }
501
- /** Center of the node — equivalent to its x/y position (0,0 is the center of the layout cell). */
502
- get center() {
503
- const o = this._offset();
504
- return { x: o.x, y: o.y };
505
- }
506
- get topLeft() {
507
- const r = this.layoutBounds;
508
- return this._rotateOffset(-r.width / 2, r.height / 2);
509
- }
510
- get topRight() {
511
- const r = this.layoutBounds;
512
- return this._rotateOffset(r.width / 2, r.height / 2);
513
- }
514
- get bottomLeft() {
515
- const r = this.layoutBounds;
516
- return this._rotateOffset(-r.width / 2, -r.height / 2);
517
- }
518
- get bottomRight() {
519
- const r = this.layoutBounds;
520
- return this._rotateOffset(r.width / 2, -r.height / 2);
521
- }
522
- get topCenter() {
523
- const r = this.layoutBounds;
524
- return this._rotateOffset(0, r.height / 2);
525
- }
526
- get bottomCenter() {
527
- const r = this.layoutBounds;
528
- return this._rotateOffset(0, -r.height / 2);
529
- }
530
- get centerLeft() {
531
- const r = this.layoutBounds;
532
- return this._rotateOffset(-r.width / 2, 0);
533
- }
534
- get centerRight() {
535
- const r = this.layoutBounds;
536
- return this._rotateOffset(r.width / 2, 0);
537
- }
538
- // ---- Global (world-space) transform -----------------------------------
539
- // The local alignment getters above are relative to this node's *parent*; their
540
- // global counterparts below fold in the full ancestor chain so a node can be
541
- // aligned to another regardless of where each sits in the tree:
542
- // new Rect({ x: () => other().global.x, y: () => other().global.y })
543
- // Each read walks this node's and every ancestor's live
544
- // layout/x/y/rotation/scale/pivot props, so a binding over them stays current.
545
- /**
546
- * This node's local transform in canvas (y-down) space — position, rotation,
547
- * scale, about its origin. Composed with the parent chain by
548
- * {@link worldMatrix}, and the matrix every world-space *reading* of the node
549
- * comes from: {@link global}, `runtime/node-picking.ts`, and so any editor
550
- * overlay drawn on top of a scene.
551
- *
552
- * **It is flat, deliberately, and the renderer's is not.** A node that
553
- * mirrors or tilts ({@link Node2DProps.rotationX}, {@link Node2DProps.perspective},
554
- * {@link Node2DProps.flipHorizontal}, …) is *painted* through a projected
555
- * matrix, but goes on measuring, reporting and hit-testing as the upright
556
- * rectangle it was — see {@link applyTransform}.
557
- *
558
- * That is a choice, not an oversight. Everything that reads a node's box
559
- * reads it to put a handle on: a selection outline, a resize grip, a rotation
560
- * dial, `other.global.topRight` as an alignment target. Those all mean
561
- * something on a rectangle and stop meaning it on a trapezoid — a "width"
562
- * handle on a foreshortened edge does not correspond to any number, and a
563
- * corner that has swung behind the viewer has no screen position at all.
564
- * Letting the projection through would make the tilt a thing that quietly
565
- * breaks every other tool in the editor; keeping the geometry flat makes it
566
- * exactly what it looks like, a way of drawing the node.
567
- */
568
- /** @internal Composed with the camera scopes in between by `runtime/node-picking.ts`. */
569
- _localMatrix() {
570
- const r = this.layoutBounds;
571
- const slot = this._slotMatrix();
572
- const { x: ox, y: oy } = this._offset();
573
- if (slot) {
574
- return multiply(slot, localMatrix(ox, -oy, this.rotation, this.scale, this._transformOrigin(), r?.width ?? 0, r?.height ?? 0));
575
- }
576
- const cx = (r?.x ?? 0) + ox;
577
- const cy = (r?.y ?? 0) - oy;
578
- // The accessor stores the resolved normalised pivot via the mapper.
579
- // No projection: see the note above for why a node's *geometry* stays
580
- // flat while its paint does not.
581
- return localMatrix(cx, cy, this.rotation, this.scale, this._transformOrigin(), r?.width ?? 0, r?.height ?? 0);
582
- }
583
- /** @internal The slot {@link _placementOf} puts this node in, from its parent. */
584
- _placement() {
585
- return this.parent2D?._placementOf(this) ?? null;
586
- }
587
- /**
588
- * The slot this node places `child` in beyond its layout box, or `null` —
589
- * the default — when the box says it all. A layout that turns, scales or
590
- * fades each of its children answers here, and the renderer, picking and
591
- * `global` all follow. See {@link ChildPlacement}.
592
- */
593
- /** @internal */
594
- _placementOf(_child) {
595
- return null;
596
- }
597
- /**
598
- * The coordinates `child`'s `x`/`y` are in, or `null` — the default — when
599
- * they are pixels. A `null` child asks for one that is not here yet: where
600
- * a host would drop or paste it. See {@link ChildPlane}.
601
- */
602
- /** @internal */
603
- _planeOf(_child) {
604
- return null;
605
- }
606
- /**
607
- * Where its own layout would centre a child of `size` that is not here yet,
608
- * y-down from its centre, or `null` when it arranges its children in a run
609
- * or a grid (the run decides) or has not laid any out.
610
- */
611
- /** @internal */
612
- _slotFor(size) {
613
- const inner = this._childBox;
614
- const box = inner ? flowOps.freeSlot(this.flowArrangement(), inner, size) : null;
615
- return inner && box ? { x: inner.x + box.x, y: inner.y - box.y } : null;
616
- }
617
- /**
618
- * Where its centre sits from the point its `x`/`y` place, in its parent's
619
- * frame, y-down, at `rotation` and `scale`: what turning or scaling about an
620
- * off-centre pivot adds.
621
- */
622
- /** @internal */
623
- _centreShift(rotation = this.rotation, scale = this.scale) {
624
- const r = this.layoutBounds;
625
- const own = localMatrix(0, 0, rotation, scale, this._transformOrigin(), r?.width ?? 0, r?.height ?? 0);
626
- return applyToPoint(own, { x: 0, y: 0 });
627
- }
628
- /** The points an editor may drag on this node, where they sit now; none by default. See {@link NodeHandle}. */
629
- /** @internal */
630
- _handles() {
631
- return NO_HANDLES;
632
- }
633
- /** The value `prop` takes for its handle to sit at `at`, in this node's own frame; `null` when it has none. */
634
- /** @internal */
635
- _handleValue(_prop, _at) {
636
- return null;
637
- }
638
- _offsetScratch = { x: 0, y: 0 };
639
- /**
640
- * This node's `x`/`y` as the pixel offset its parent sees. Every position
641
- * read goes through here, which is what keeps paint, picking and `global`
642
- * agreeing under a {@link ChildPlane}. The result is reused: read it at once.
643
- */
644
- /** @internal */
645
- _offset() {
646
- const plane = this.parent2D?._planeOf(this);
647
- if (plane)
648
- return plane.toOffset(this.x, this.y);
649
- const o = this._offsetScratch;
650
- o.x = this.x;
651
- o.y = this.y;
652
- return o;
653
- }
654
- /**
655
- * The flat part of this node's slot, as the frame its own `x`/`y` move in —
656
- * the layout box's centre, turned and scaled by the slot. `null` when it has
657
- * no slot. With `paint`, the slot's tilt as well, which only paint sees.
658
- */
659
- /** @internal Also the plane `runtime/node-picking.ts` drags a placed node across. */
660
- _slotMatrix(paint = false) {
661
- const slot = this._placement();
662
- if (!slot)
663
- return null;
664
- const r = this.layoutBounds;
665
- return localMatrix(r?.x ?? 0, r?.y ?? 0, slot.rotation, slot.scale, ORIGIN_2D, 0, 0, paint ? slotProjection(slot) : undefined);
666
- }
667
- /** @internal {@link _slotMatrix} in a space, where the slot's tilt and depth are geometry. */
668
- _slotAffine() {
669
- const slot = this._placement();
670
- if (!slot)
671
- return null;
672
- const r = this.layoutBounds;
673
- return nodeSpaceMatrix(r?.x ?? 0, r?.y ?? 0, slot.rotation, slot.scale, 0, 0, slotProjection(slot));
674
- }
675
- /**
676
- * The point this node's transform turns about, normalised: `transformOrigin`
677
- * where one is set, the alignment-derived `pivot` otherwise. One resolution,
678
- * read by {@link _localMatrix} and {@link applyTransform} alike.
679
- */
680
- _transformOrigin() {
681
- return this.transformOrigin ?? this.pivot;
682
- }
683
- // Reused for the same reason `_transformScratch` is: `_localMatrix` runs once
684
- // per ancestor per `global` read, and the two functions that take a
685
- // Projection3D read it synchronously and never retain it.
686
- _projectionScratch = {
687
- rotationX: 0, rotationY: 0, rotationZ: 0, depth: 0, perspective: 0,
688
- flipHorizontal: false, flipVertical: false,
689
- };
690
- /**
691
- * This node's out-of-plane fields, gathered for the matrix builders — and for
692
- * the backface test. A space root overrides it, because its 3D props aim the
693
- * camera rather than turn the root.
694
- */
695
- _projection() {
696
- const p = this._projectionScratch;
697
- p.rotationX = this.rotationX;
698
- p.rotationY = this.rotationY;
699
- p.rotationZ = this.rotationZ;
700
- p.depth = this.depth;
701
- p.perspective = this.perspective;
702
- p.flipHorizontal = this.flipHorizontal;
703
- p.flipVertical = this.flipVertical;
704
- return p;
705
- }
706
- /** @internal This node's transform in its parent's 3D frame, when it is inside a space. See `node-space.ts`. */
707
- _spaceMatrix() {
708
- const r = this.layoutBounds;
709
- const width = r?.width ?? 0;
710
- const height = r?.height ?? 0;
711
- const origin = this._transformOrigin();
712
- const slot = this._slotAffine();
713
- const { x: ox, y: oy } = this._offset();
714
- if (slot) {
715
- return multiplyAffine3(slot, nodeSpaceMatrix(ox, -oy, this.rotation, this.scale, origin.x * (width / 2), -origin.y * (height / 2), this._projection()));
716
- }
717
- return nodeSpaceMatrix((r?.x ?? 0) + ox, (r?.y ?? 0) - oy, this.rotation, this.scale, origin.x * (width / 2), -origin.y * (height / 2), this._projection());
718
- }
719
- /**
720
- * This node's full transform in canvas (y-down) world space — the product of
721
- * every ancestor's local matrix from the root down to this node. Walks the
722
- * live parent chain on every call, reading each node's transform props.
723
- */
724
- worldMatrix() {
725
- const local = this._localMatrix();
726
- const parent = this.parent2D;
727
- return parent ? multiply(parent.worldMatrix(), local) : local;
728
- }
729
- /**
730
- * Resolved world-space transform — the same alignment points and metrics as the
731
- * local getters (`center`, `topRight`, `rotation`, …) but folded through the
732
- * full ancestor chain, so values are absolute scene coordinates rather than
733
- * parent-relative ones. See {@link WorldTransform}. Every field is reactive.
734
- *
735
- * @example
736
- * // Read another node's absolute corner, regardless of its parent:
737
- * const p = other.global.topRight; // world-space {x, y}
738
- *
739
- * ### Reading vs. placing
740
- * `global` is for *reading* world coordinates. `x`/`y` (and the alignment props)
741
- * are **parent-relative**, so assigning a world value to them does not by
742
- * itself place this node in world space — it offsets it from this node's own
743
- * parent. To land exactly on another node regardless of either parent,
744
- * subtract this node's parent's world contribution:
745
- *
746
- * @example
747
- * // Place this node's origin exactly on `other`, any parent:
748
- * new Rect({
749
- * x: () => other.global.x - (myParent.global.x),
750
- * y: () => other.global.y - (myParent.global.y),
751
- * });
752
- *
753
- * When both nodes share the same parent origin (e.g. both at the scene root),
754
- * `x: () => other.global.x` already lands on target with no compensation.
755
- */
756
- get global() {
757
- const r = this.layoutBounds;
758
- const anchors = worldAnchors(this.worldMatrix(), (r?.width ?? 0) / 2, (r?.height ?? 0) / 2);
759
- // Accumulate ancestor rotation/scale/opacity up the chain (rotation sums,
760
- // scale and opacity multiply — all match the renderer's nested transforms
761
- // and its pass-through alpha fold).
762
- let rotation = 0;
763
- let scale = 1;
764
- let opacity = 1;
765
- for (let n = this; n; n = n.parent2D) {
766
- const slot = n._placement();
767
- rotation += n.rotation + (slot?.rotation ?? 0);
768
- scale *= n.scale * (slot?.scale ?? 1);
769
- opacity *= n.opacity * (slot?.opacity ?? 1);
770
- }
771
- return {
772
- x: anchors.center.x,
773
- y: anchors.center.y,
774
- ...anchors,
775
- rotation,
776
- scale,
777
- opacity,
778
- };
779
- }
780
- /**
781
- * The `x`/`y` that put this node on `anchor` of the node `id` names, in this
782
- * tree — or `null` when there is no such 2D node here right now.
783
- */
784
- _pointOnNode(id, anchor) {
785
- const target = findNode2D(this, id);
786
- if (!target)
787
- return null;
788
- const a = alignmentOps.resolve(anchor ?? "center");
789
- const box = target.layoutBounds;
790
- const world = applyToPoint(target.worldMatrix(), {
791
- x: a.x * ((box?.width ?? 0) / 2),
792
- y: -a.y * ((box?.height ?? 0) / 2),
793
- });
794
- const parent = this.parent2D;
795
- const toParent = parent ? invert(parent.worldMatrix()) : null;
796
- if (parent && !toParent)
797
- return null;
798
- const local = toParent ? applyToPoint(toParent, world) : world;
799
- const own = this.layoutBounds;
800
- const x = local.x - (own?.x ?? 0);
801
- const y = (own?.y ?? 0) - local.y;
802
- return parent?._planeOf(this)?.toCoords(x, y) ?? { x, y };
803
- }
804
- resolveSizeInput(sizeInput, availableSize, childrenSize) {
805
- return sizeInputOps.resolveLayout(sizeInput, availableSize, childrenSize);
806
- }
807
- addChildAt(args) {
808
- const { child, index } = args.data;
809
- this.assertAcceptsChild(child);
810
- if (args.duration === undefined) {
811
- this._insertChildAt(child, index);
812
- return;
813
- }
814
- // Past the guard, so this is a 2D child: the animated insert measures it
815
- // off-tree, which only a laid-out node can do.
816
- return addChildAtAnimated(this, child, index, args.duration, args.easing);
817
- }
818
- removeChildAt(args) {
819
- const index = args.data.index;
820
- if (args.duration === undefined) {
821
- if (index < 0 || index >= this._children.length)
822
- return null;
823
- if (_observer !== null)
824
- this._structureChanged(this._children[index]);
825
- const [removed] = this._children.splice(index, 1);
826
- if (removed) {
827
- removed._parent = null;
828
- removed.detach();
829
- }
830
- return removed ?? null;
831
- }
832
- return removeChildAtAnimated(this, index, args.duration, args.easing);
833
- }
834
- // ---- Rendering --------------------------------------------------------
835
- // Reused each frame so applyTransform doesn't allocate a fresh descriptor
836
- // per node per frame. ctx.transform reads it synchronously and never retains
837
- // it, so a single mutated instance is safe.
838
- _transformScratch = {
839
- x: 0, y: 0, width: 0, height: 0,
840
- scale: 1, rotation: 0, opacity: 1, blend: 'pass-through',
841
- effects: [], pivot: { x: 0, y: 0 },
842
- };
843
- // ---- Motion sampling --------------------------------------------------
844
- // Per-node motion (velocity/direction/speed/angular/scale) is sampled once
845
- // per frame from ellapse() (see its call site) as a backward difference
846
- // against the previous frame. Sampling every advanced frame — not just
847
- // rendered ones — is what keeps velocity correct through a scrub/rewind,
848
- // which advances through frames without rendering them. Because ellapse()
849
- // runs before the frame's generator.next(), x/y here hold the *previous*
850
- // frame's value, so the velocity trails the rendered position by one frame;
851
- // the lag is constant and identical forward vs. scrub. Layout-dependent
852
- // fields (rects) can't be resolved here — layout hasn't run for advanced-
853
- // but-unrendered frames — so beforeRender() fills those in at draw time,
854
- // leaving the motion fields untouched.
855
- /** Rolling history for the backward-difference velocity estimate. Allocated once (not per frame); mutated in place by {@link _sampleMotion}. */
856
- _motionHistory = createMotionHistory();
857
- /** Reused per-node state handed to `ctx.begin()` (mirrors `_transformScratch`). */
858
- _renderState = {
859
- id: this.id,
860
- rects: {},
861
- elapsed: 0,
862
- dt: 0,
863
- velocity: { x: 0, y: 0 },
864
- direction: 0,
865
- speed: 0,
866
- angularVelocity: 0,
867
- scaleVelocity: 0,
868
- };
869
- /**
870
- * Compute this frame's motion (velocity/direction/speed/angular/scale) into
871
- * {@link _renderState} as a backward difference against the previous frame,
872
- * and roll the history forward. Velocity is `0`/`{0,0}` when no trustworthy
873
- * delta exists — the first frame, or after a non-monotonic time jump (only
874
- * `0 < dt <= MAX` is trusted, so a scrub that resets the clock reads as
875
- * "unknown" rather than a spurious huge velocity). The world position
876
- * matches {@link applyTransform} (`layoutBounds + x`, `layoutBounds - y`,
877
- * y-down). Called via {@link sample} every frame; layout-dependent fields
878
- * (`rects`/`elapsed`) are filled in by {@link beforeRender} at draw time.
879
- */
880
- _sampleMotion() {
881
- // Resolve the reactive world position (y-down, matching applyTransform);
882
- // the backward-difference math lives in sampleMotion (no per-frame alloc).
883
- const r = this.layoutBounds;
884
- const o = this._offset();
885
- const x = (r?.x ?? 0) + o.x;
886
- const y = (r?.y ?? 0) - o.y;
887
- sampleMotion(this._renderState, this._motionHistory, x, y, this.rotation, this.scale, this._time.total);
888
- }
889
- /**
890
- * Push this node's transform (position, scale, rotate, opacity, effects).
891
- *
892
- * The decomposed fields are the whole story for a node in its own plane, and
893
- * that path is untouched: the backend translates, rotates and scales exactly
894
- * as it always has. A node that mirrors or tilts hands over a precomposed
895
- * {@link TransformState.matrix} instead, built by the same `localMatrix`
896
- * {@link _localMatrix} calls — with the out-of-plane half switched on.
897
- *
898
- * **This is the one place that half is applied.** The mirrors and the tilt
899
- * are paint, not geometry: the node goes on measuring and hit-testing as the
900
- * upright rectangle it was, and only what is drawn is projected. See
901
- * {@link _localMatrix} for why.
902
- */
903
- applyTransform(ctx) {
904
- const r = this.layoutBounds;
905
- const s = this._transformScratch;
906
- const { x: ox, y: oy } = this._offset();
907
- s.x = (r?.x ?? 0) + ox;
908
- s.y = (r?.y ?? 0) - oy;
909
- s.width = r?.width ?? 0;
910
- s.height = r?.height ?? 0;
911
- s.scale = this.scale;
912
- s.rotation = this.rotation;
913
- s.opacity = this.opacity;
914
- s.blend = this.blend;
915
- s.effects = this.effects;
916
- s.pivot = this._transformOrigin();
917
- const slotOpacity = this._placement()?.opacity;
918
- if (slotOpacity !== undefined)
919
- s.opacity *= slotOpacity;
920
- const frame = this._spaceFrame;
921
- const slot = frame ? null : this._slotMatrix(true);
922
- if (frame) {
923
- s.matrix = frame.local;
924
- }
925
- else if (slot) {
926
- s.matrix = multiply(slot, localMatrix(ox, -oy, s.rotation, s.scale, s.pivot, s.width, s.height, this._projection()));
927
- }
928
- else {
929
- const projection = this._projection();
930
- s.matrix = hasProjection3D(projection)
931
- ? localMatrix(s.x, s.y, s.rotation, s.scale, s.pivot, s.width, s.height, projection)
932
- : undefined;
933
- }
934
- ctx.transform(s);
935
- }
936
- /**
937
- * Hook for custom nodes that draw their own content (raw `Graphics2D`
938
- * commands, etc.) without subclassing {@link ShapeNode}. Called from
939
- * {@link render} between the transform push and the children render, the same
940
- * slot `ShapeNode.renderSelf` occupies. No-op by default — drawing nothing
941
- * here doesn't change the render flow at all.
942
- */
943
- renderSelf(ctx) { }
944
- /**
945
- * Paint the node's `overlay` layer — over its own fill *and* its children,
946
- * but under the stroke — clipped to the node's silhouette. Called from
947
- * {@link render} after children render and before {@link renderStroke}. No-op by
948
- * default; {@link ShapeNode} paints the resolved overlay as a fill of its
949
- * silhouette so a texture (e.g. VHS grain) sits over the whole subtree.
950
- */
951
- renderOverlay(ctx) { }
952
- /**
953
- * Paint the node's stroke last — over its fill, children, and overlay.
954
- * Deferred out of {@link renderSelf} (which now draws only shadow+fill) so
955
- * the stroke frames the whole subtree and sits above any overlay. Called
956
- * from {@link render} after {@link renderOverlay}. No-op by default; {@link
957
- * ShapeNode} strokes its silhouette.
958
- */
959
- renderStroke(ctx) { }
960
- /**
961
- * This node's outline as a {@link Clip} command list — the single source of
962
- * truth for every clip the node needs: its `clip` boundary (when `clip` is
963
- * true) and the silhouette its backdrop effects (backdrop-flagged filters,
964
- * magnify) are confined to. Returning `null` (the default) means the node has
965
- * no clip outline, so its children render unclipped and it gets no backdrop
966
- * effects. Nodes with a definite box (shapes via {@link ShapeNode}, layout
967
- * containers like {@link Rect}) override this to describe their geometry —
968
- * and so behave the same way for `clip` and effect area.
969
- */
970
- clipSelf() { return null; }
971
- /**
972
- * The camera scope this node pushes around its **children** (`beginCamera`),
973
- * or `null` when it pushes none. Only {@link Canvas2D} and `Camera` override
974
- * it, and each returns non-null exactly when its `renderChildren` actually
975
- * opens a camera — so a consumer can reproduce the renderer's transform *and*
976
- * its viewport clip without knowing which classes have a camera.
977
- *
978
- * Read by `runtime/node-picking.ts`: a camera is applied at render time only,
979
- * so it is not part of {@link worldMatrix}, and a node's on-screen box would
980
- * be offset without it. `@internal`.
981
- */
982
- /** @internal */
983
- _cameraScope() { return null; }
984
- /**
985
- * The camera this node opens a 2.5D space with, or `null` when it opens none.
986
- * Only a space root overrides it: its children, and theirs, are then placed
987
- * in one 3D frame and seen through this camera. See `node-space.ts`.
988
- */
989
- /** @internal */
990
- _spaceCamera() { return null; }
991
- /**
992
- * Whether this node hands its children on into the space it sits in. False
993
- * for a node that composites its children itself — a mask, a boolean, a
994
- * nested camera — which flattens its subtree into its own plane, where the
995
- * per-node 3D rules apply again. Picking reads it; the renderer gets the same
996
- * answer because such a node never reaches the base {@link renderChildren}.
997
- */
998
- /** @internal */
999
- _rendersChildrenInSpace() { return true; }
1000
- /** @internal Set by the parent for the length of this node's render while it is inside a space. */
1001
- _spaceFrame = null;
1002
- /**
1003
- * Whether the renderer confines this node's children to its own box — either
1004
- * because `clip` is set *and* the node has an outline to clip to (a bare
1005
- * `clip` with no {@link clipSelf} is a no-op, see {@link applyClip}), or
1006
- * because it opens a camera scope, which clips to the viewport rect.
1007
- *
1008
- * Read by `runtime/node-picking.ts`: a point outside a confining node cannot
1009
- * hit anything inside it, so the whole subtree is skipped. `@internal`.
1010
- */
1011
- /** @internal */
1012
- _confinesChildren() {
1013
- if (this._cameraScope() !== null)
1014
- return true;
1015
- if (!this.clip)
1016
- return false;
1017
- const clip = this.clipSelf();
1018
- return clip !== null && !clip.isEmpty();
1019
- }
1020
- /**
1021
- * Whether `local` — a point in this node's local space (centred on the node,
1022
- * y-up, rotation and scale already removed) — is inside the node, within
1023
- * `tolerance` scene units of its edge.
1024
- *
1025
- * The default is the layout box, which is the right answer for containers,
1026
- * text, and media: their box *is* their extent. {@link ShapeNode} narrows it
1027
- * to the node's declared {@link clipSelf} outline. Custom nodes that draw
1028
- * their own content can override this so selection follows what they actually
1029
- * paint.
1030
- *
1031
- * `tolerance` is grab-slop, applied outward. An editor passes its
1032
- * zoom-corrected pixel slop so the grab area stays constant on screen
1033
- * regardless of preview zoom.
1034
- */
1035
- hitTestSelf(local, tolerance) {
1036
- const b = this._localBounds();
1037
- return Math.abs(local.x - b.x) <= b.width / 2 + tolerance
1038
- && Math.abs(local.y - b.y) <= b.height / 2 + tolerance;
1039
- }
1040
- /**
1041
- * The extent of this node's ink in its own local space — what an editor draws
1042
- * a selection box around, and the region the default {@link hitTestSelf}
1043
- * grabs.
1044
- *
1045
- * The returned {@link BoxBounds} is **y-up and relative to the node's own
1046
- * centre**: `x`/`y` are where the ink's centre sits relative to the node,
1047
- * normally `(0, 0)`. That is a different space from `layoutBounds`, which is
1048
- * the same type but canvas y-down and relative to the parent — see
1049
- * `BoxBounds`, which deliberately does not encode a space.
1050
- *
1051
- * Defaults to the layout box, centred on the node, which is right for every
1052
- * node whose drawing fills its cell. It is a separate seam from the layout
1053
- * rect because for some nodes the two genuinely differ: a boolean group or
1054
- * a mask is drawn where its children's ink is, which can be both a different
1055
- * size *and* off-centre from its own cell. Overriding this
1056
- * fixes the box and the grab region together, without perturbing layout —
1057
- * which a `measure()` override would.
1058
- *
1059
- * `@internal`; override it on a custom node whose drawing is not its cell.
1060
- */
1061
- /** @internal */
1062
- _localBounds() {
1063
- return { x: 0, y: 0, width: this.measuredWidth, height: this.measuredHeight };
1064
- }
1065
- /** @internal Dispatch seam so `node-picking.ts` can reach the protected override. */
1066
- _hitTestSelf(local, tolerance) {
1067
- return this.hitTestSelf(local, tolerance);
1068
- }
1069
- /**
1070
- * An optional clip path that cuts through this node's *own* content **and**
1071
- * its children — unlike {@link clip}, which only confines children to the
1072
- * node's outline and leaves the node's own fill/stroke untouched. Returning
1073
- * `null` (the default) applies no such cut. The Video node exposes
1074
- * this as an author-facing `clipPath` prop so a path can carve the painted
1075
- * frame and everything stacked on it as one.
1076
- */
1077
- clipPathSelf() { return null; }
1078
- /**
1079
- * Open `clipSelf()`'s outline as a clip scope, confining whatever is drawn
1080
- * until the matching `ctx.endClip()` to the shape. Returns `true` when a
1081
- * clip was actually opened (so the caller knows to close it) and `false`
1082
- * when the node has no outline (the default).
1083
- */
1084
- applyClip(ctx) {
1085
- const clip = this.clipSelf();
1086
- if (!clip || clip.isEmpty())
1087
- return false;
1088
- ctx.beginClip(clip);
1089
- return true;
1090
- }
1091
- /**
1092
- * Apply backdrop effects (any `mode: "backdrop"` effect — blur, grayscale, …;
1093
- * plus magnify and backdrop SkSL) beneath this node, clipped to its
1094
- * silhouette, before the node's own content is drawn — so the content
1095
- * underneath is filtered/warped while the node's own edges stay sharp. One
1096
- * backdrop effect scope, confined to the silhouette clip, runs the lot; the
1097
- * renderer routes each effect to a filter or shader pass. A no-op for nodes
1098
- * without a {@link clipSelf} outline (there's no silhouette to confine to).
1099
- */
1100
- applyBackdropEffects(ctx) {
1101
- const effects = this.effects;
1102
- // Bail before building the silhouette. `applyBackdropEffectsImpl` returns
1103
- // immediately when there are no backdrop effects, but by then `clipSelf()`
1104
- // has already allocated a Clip and its op list for a node that will never
1105
- // use it — and a node with no effects at all is the overwhelmingly common
1106
- // case, so that allocation was pure waste on nearly every node, every frame.
1107
- if (effects.length === 0)
1108
- return;
1109
- applyBackdropEffectsImpl(ctx, effects, this.clipSelf(), this.layoutBounds?.width ?? 0, this.layoutBounds?.height ?? 0);
1110
- }
1111
- /**
1112
- * Run `body` (this node's own painting + children) inside the node's effect
1113
- * and clip-path scopes — the shared content-rendering envelope every node
1114
- * uses so effects behave identically regardless of how a node draws. The
1115
- * caller is expected to have already pushed the node's transform
1116
- * ({@link applyTransform}). The envelope, outermost-first:
1117
- *
1118
- * 1. {@link applyBackdropEffects} — filters/warps the backdrop beneath the
1119
- * node, confined to its {@link clipSelf} silhouette.
1120
- * 2. A `foreground` effect scope (posterize wrapping bulge) capturing
1121
- * everything `body` paints, so those shader effects warp/band the lot.
1122
- * 3. A {@link clipPathSelf} clip cutting through both the node's own paint
1123
- * and its children.
1124
- *
1125
- * Nodes with a bespoke `render` (boolean, mask, …) call this with their
1126
- * custom body to gain the same effect support as a standard shape, instead
1127
- * of duplicating the scope bookkeeping.
1128
- */
1129
- renderContentWithEffects(ctx, body) {
1130
- this.applyBackdropEffects(ctx);
1131
- applyContentEffectScope(ctx, this.effects, this.clipPathSelf(), this.layoutBounds?.width ?? 0, this.layoutBounds?.height ?? 0, body);
1132
- }
1133
- renderChildren(ctx) {
1134
- // A node opening a space of its own flattens its subtree into its own
1135
- // plane, whatever space it sits in — the same answer picking's
1136
- // `spaceFrameOf` gives, which asks for a camera before anything else.
1137
- const camera = this._spaceCamera();
1138
- if (camera) {
1139
- this._renderInSpace(ctx, spaceRootFrame(this, camera));
1140
- return;
1141
- }
1142
- const frame = this._spaceFrame;
1143
- if (frame) {
1144
- this._renderInSpace(ctx, frame);
1145
- return;
1146
- }
1147
- for (const child of this._children)
1148
- if (child instanceof Node2D)
1149
- child.render(ctx);
1150
- }
1151
- /**
1152
- * Paint the children placed in `frame`, far to near rather than in authored
1153
- * order — each with its frame set for exactly the length of its own render,
1154
- * so a node reached any other way (a mask's children, a `Tex.surface`
1155
- * source) draws flat.
1156
- */
1157
- /** @internal A space root opens its space through this. */
1158
- _renderInSpace(ctx, frame) {
1159
- const children = [];
1160
- for (const child of this._children)
1161
- if (child instanceof Node2D)
1162
- children.push(child);
1163
- const frames = children.map((child) => spaceChildFrame(frame, child));
1164
- // Order is invisible to a walk that only discovers assets.
1165
- const order = ctx.drawsVisibleOnly ? spaceChildOrder(frames) : frames.map((_, i) => i);
1166
- for (const i of order) {
1167
- const child = children[i];
1168
- child._spaceFrame = frames[i];
1169
- try {
1170
- child.render(ctx);
1171
- }
1172
- finally {
1173
- child._spaceFrame = null;
1174
- }
1175
- }
1176
- }
1177
- /** Run `paint` confined to `cut` — the part of the node in front of the lens — when there is one. */
1178
- _paintInFront(ctx, cut, paint) {
1179
- if (!cut) {
1180
- paint();
1181
- return;
1182
- }
1183
- ctx.beginClip(cut);
1184
- try {
1185
- paint();
1186
- }
1187
- finally {
1188
- ctx.endClip();
1189
- }
1190
- }
1191
- /**
1192
- * Hook run just before this node paints anything, inside its own draw scope.
1193
- *
1194
- * No-op by default, and safe to override without calling `super`: the scope
1195
- * itself is opened by {@link render}, not here. That is the whole reason
1196
- * `begin`/`end` are not on {@link RenderContext2D} — an override that forgot
1197
- * to close what it opened used to leave every sibling drawn afterwards inside
1198
- * this node's scope.
1199
- */
1200
- beforeRender(ctx) { }
1201
- /**
1202
- * This node's per-frame render state, resolved for the scope {@link render}
1203
- * is about to open.
1204
- *
1205
- * Motion was already sampled when the clock advanced; only the
1206
- * layout-dependent fields are filled in here, where layout is current.
1207
- */
1208
- renderState(ctx) {
1209
- const s = this._renderState;
1210
- // Skipped for contexts that never resolve a `space:'parent'` fill — the
1211
- // precomp pass walks every node's render every frame purely to discover
1212
- // assets, and this is an object allocation per node per frame that nothing
1213
- // there would ever read.
1214
- s.rects = ctx.readsSpaceRects ? this._spaceRects() : NO_SPACE_RECTS;
1215
- s.elapsed = this._time.elapsed;
1216
- return s;
1217
- }
1218
- /**
1219
- * Reference rects for fills with `space:'parent'`, expressed in this node's
1220
- * local space (origin = this node's positioned centre, y-down to match the
1221
- * canvas). The viewport (`space:'global'`) is resolved by the renderer, which
1222
- * knows the surface size. Rotation/scale of this node are not folded in —
1223
- * the rect is the axis-aligned parent box, which is what gradients expect.
1224
- */
1225
- _spaceRects() {
1226
- const o = this._offset();
1227
- return computeSpaceRects(this.parent2D?.layoutBounds, this.layoutBounds, o.x, o.y);
1228
- }
1229
- /**
1230
- * Hook run just after this node and its subtree have painted, still inside
1231
- * its draw scope. No-op by default — see {@link beforeRender}.
1232
- */
1233
- afterRender(ctx) { }
1234
- /**
1235
- * Draw this node and its subtree.
1236
- *
1237
- * **The whole pipeline, in one method.** It used to be `render` calling
1238
- * `beforeRender` → `onRender` → `afterRender`, with `onRender` holding the
1239
- * body — three overridable hooks stacked so that a custom node had to know
1240
- * which of the three to reach for, and a subclass overriding `onRender`
1241
- * silently opted out of the skip checks above it. The hooks that are worth
1242
- * overriding are still here ({@link beforeRender}, {@link renderSelf},
1243
- * {@link renderOverlay}, {@link renderStroke}, {@link afterRender}); what is
1244
- * gone is the extra layer that only existed to hold them.
1245
- *
1246
- * Takes a {@link RenderPass2D} rather than a bare {@link RenderContext2D}
1247
- * because opening this node's draw scope is *this* method's job — the hooks
1248
- * below are handed the narrower surface, so none of them can open one.
1249
- *
1250
- * Ordering that is load-bearing and must not drift: `renderSelf` draws
1251
- * shadow + fill only, and the stroke is deferred to {@link renderStroke} so
1252
- * it frames the whole subtree; the overlay and the stroke sit *inside* the
1253
- * foreground-effect / clip-path scope but *outside* the children-confine
1254
- * clip.
1255
- */
1256
- render(ctx) {
1257
- // Not in the tree ⇒ no box, no surface, nothing to draw. Guarded here
1258
- // rather than in each override, so a subclass cannot opt out of it.
1259
- if (!this.mounted)
1260
- return;
1261
- // A subtree at zero opacity paints nothing, so on a context that only
1262
- // draws what can be seen there is no reason to walk it. Not a niche case:
1263
- // a chart carries a full second axis at `opacity: 0` purely to reserve a
1264
- // gutter, and every cross-fade spends its first and last frames here.
1265
- //
1266
- // `drawsVisibleOnly` is false on the tracking walk, which must still
1267
- // descend — an invisible node's font and images have to be discovered or
1268
- // they will not have loaded by the time it fades in. See the flag's doc.
1269
- if (ctx.drawsVisibleOnly && this.opacity * (this._placement()?.opacity ?? 1) <= 0)
1270
- return;
1271
- // Hidden by the editor. Same exemption as the two checks around it: the
1272
- // tracking walk still descends, or a node hidden and shown again would
1273
- // come back before its fonts and images had been discovered.
1274
- if (ctx.drawsVisibleOnly && this.hidden)
1275
- return;
1276
- // A node that has turned past edge-on and declines to show its back
1277
- // paints nothing either — same reasoning, same walk skipped, and the same
1278
- // exemption for the tracking pass, which still has to discover the assets
1279
- // of a card that is currently face-down and will be face-up in a moment.
1280
- // In a space the camera decides which way a node faces, not its own tilt.
1281
- const frame = this._spaceFrame;
1282
- if (ctx.drawsVisibleOnly && !this.backfaceVisible && this._facesAway(frame))
1283
- return;
1284
- // Edge-on or behind the lens, a node whose children lie in its own plane
1285
- // has nothing anywhere to show.
1286
- if (ctx.drawsVisibleOnly && frame && !frame.paints && !this._rendersChildrenInSpace())
1287
- return;
1288
- try {
1289
- ctx.begin(this.renderState(ctx));
1290
- try {
1291
- this.beforeRender(ctx);
1292
- this.renderContent(ctx);
1293
- this.afterRender(ctx);
1294
- }
1295
- finally {
1296
- ctx.end();
1297
- }
1298
- }
1299
- catch (error) {
1300
- // The innermost node claims it, so the runtime can learn the segment against the node that drew.
1301
- if (error instanceof AssetNotLoadedError)
1302
- error.nodeId ??= this.id;
1303
- throw error;
1304
- }
1305
- }
1306
- /**
1307
- * Everything this node paints: its transform, its effect envelope, its own
1308
- * drawing, its children, its overlay and its stroke.
1309
- *
1310
- * The seam for a node whose children must not simply draw themselves —
1311
- * `BooleanGroup` feeds them into a path-collection scope, `MaskGroup` splits
1312
- * the first off as a mask. Overriding this replaces the body while keeping
1313
- * every guard {@link render} performs above it, which is the whole reason it
1314
- * is a separate method: a node that overrode the entry point instead would
1315
- * quietly opt out of the mounted and visibility checks.
1316
- */
1317
- renderContent(ctx) {
1318
- this.applyTransform(ctx);
1319
- const frame = this._spaceFrame;
1320
- // Edge-on or behind the lens: nothing of its own to draw and no plane to
1321
- // draw it on, but its children are placed by frames of their own.
1322
- if (frame && !frame.paints) {
1323
- this.renderChildren(ctx);
1324
- return;
1325
- }
1326
- const cut = frame?.nearCut ?? null;
1327
- this.renderContentWithEffects(ctx, () => {
1328
- this._paintInFront(ctx, cut, () => this.renderSelf(ctx));
1329
- // Confine children to this node's outline. Built once from clipSelf();
1330
- // skipped when the node has no outline (clipped === false) so the
1331
- // endClip() below stays balanced.
1332
- const clipped = this.clip && this.applyClip(ctx);
1333
- this.renderChildren(ctx);
1334
- if (clipped)
1335
- ctx.endClip();
1336
- this._paintInFront(ctx, cut, () => {
1337
- this.renderOverlay(ctx);
1338
- this.renderStroke(ctx);
1339
- });
1340
- });
1341
- }
1342
- /** Whether the node shows its back — to the space's camera when it is in one, else by its own tilt. */
1343
- _facesAway(frame) {
1344
- if (frame)
1345
- return frame.facesAway;
1346
- const p = this._projection();
1347
- return facesAway(p.rotationX, p.rotationY);
1348
- }
1349
- // ---- Layout -----------------------------------------------------------
1350
- /** What {@link measure} hands {@link layoutChildren} within a pass; consumed there. */
1351
- _flowMeasure = null;
1352
- /** The content box {@link layoutChildren} last placed children in, y-down from this node's centre. */
1353
- _childBox = null;
1354
- _flowWarned = false;
1355
- /**
1356
- * Record this node's allocated bounds without touching children.
1357
- *
1358
- * Compared field by field, because every caller builds a fresh object literal,
1359
- * so identity always differs — including on every frame of a node that is
1360
- * simply sitting still. Skipping the write keeps the object stable for the
1361
- * aliasing reason below.
1362
- */
1363
- setLayoutBounds(rect) {
1364
- const current = this._layoutBounds.get();
1365
- if (current.x === rect.x
1366
- && current.y === rect.y
1367
- && current.width === rect.width
1368
- && current.height === rect.height)
1369
- return;
1370
- // Stores the *new* object rather than mutating the old one in place:
1371
- // `layoutBounds` is handed out by `get()` to its public reader, to
1372
- // `computeSpaceRects` and to bound anchor computations, and mutating it
1373
- // under them would be an aliasing change none of them could see coming.
1374
- this._layoutBounds.set(rect);
1375
- }
1376
- /**
1377
- * The children this node lays out itself — its 2D children, minus the hidden
1378
- * ones. Every measure and layout pass in a container iterates *this*, not
1379
- * `children`.
1380
- *
1381
- * Returns the live array untouched in the common case, so an ordinary tree
1382
- * allocates nothing per pass.
1383
- */
1384
- flowChildren() {
1385
- const children = this._children;
1386
- // Only a hidden child — or a 3D child under a `Canvas3D` — can leave the
1387
- // flow, and both are rare enough to be worth checking for before
1388
- // allocating.
1389
- let i = 0;
1390
- for (; i < children.length; i++) {
1391
- const child = children[i];
1392
- if (!(child instanceof Node2D) || child.hidden)
1393
- break;
1394
- }
1395
- if (i === children.length)
1396
- return children;
1397
- // A hidden child gives up its cell *and* its gap — `display: none`, not
1398
- // `visibility: hidden`. Leaving the slot would put a hole in a row
1399
- // wherever someone folded a layer away.
1400
- return children.filter((c) => c instanceof Node2D && !c.hidden);
1401
- }
1402
- /**
1403
- * The inset children are laid out within. A node with a stroke to clear adds
1404
- * the part of it that intrudes (see `ShapeNode`).
1405
- */
1406
- effectivePadding() {
1407
- return this.padding;
1408
- }
1409
- /**
1410
- * How this node arranges its children: centred freeform, unless a subclass
1411
- * says otherwise. A container returns its own layout props; a custom node can
1412
- * return a constant — `{ flow: "horizontal", gap: 32 }` — to lay its children
1413
- * out as a row without wrapping them in a `Rect`.
1414
- */
1415
- flowArrangement() {
1416
- return DEFAULT_FLOW;
1417
- }
1418
- /** Record `rect`, then place the flow children in it — see {@link layoutChildren}. */
1419
- layout(rect, scope) {
1420
- this.setLayoutBounds(rect);
1421
- this.layoutChildren(rect, scope);
1422
- }
1423
- /**
1424
- * Place the flow children in `rect`'s content box by {@link flowArrangement}.
1425
- *
1426
- * Reuses what {@link measure} found when the box is the one it measured in —
1427
- * or, on an axis that hugs, exactly what it hugged — and measures again
1428
- * otherwise: a parent laying this node out at a size it did not measure it
1429
- * for would leave the children arranged for the wrong box.
1430
- */
1431
- layoutChildren(rect, scope) {
1432
- const pending = this._flowMeasure;
1433
- this._flowMeasure = null;
1434
- const inner = insetsOps.insetBounds(rect.width, rect.height, this.effectivePadding());
1435
- this._childBox = inner;
1436
- const children = this.flowChildren();
1437
- if (children.length === 0)
1438
- return;
1439
- const settings = this.flowArrangement();
1440
- const measured = pending && flowOps.reusable(pending, inner)
1441
- ? pending
1442
- : flowOps.measure(settings, children, {
1443
- width: inner.width,
1444
- height: inner.height,
1445
- hugWidth: this.width === "hug",
1446
- hugHeight: this.height === "hug",
1447
- }, scope);
1448
- // The boxes are y-up from the content box's centre; a layout rect is y-down
1449
- // from this node's.
1450
- const boxes = flowOps.place(measured, settings, inner);
1451
- for (let i = 0; i < boxes.length; i++) {
1452
- const box = boxes[i];
1453
- measured.items[i].layout({ x: inner.x + box.x, y: inner.y - box.y, width: box.width, height: box.height }, scope);
1454
- }
1455
- if (this._flowWarned)
1456
- return;
1457
- const warning = flowOps.collapsedRun(measured, rect);
1458
- if (warning === null)
1459
- return;
1460
- this._flowWarned = true;
1461
- console.warn(`[motionscript] "${this.className}" ${warning}`);
1462
- }
1463
- /**
1464
- * Resolve `width`/`height`, measuring the flow children by
1465
- * {@link flowArrangement}: a `'hug'` axis wraps what they come to, plus this
1466
- * node's padding. What it finds is kept for {@link layoutChildren}.
1467
- *
1468
- * Only flow children are measured: a canvas-pinned child is sized against the
1469
- * canvas, so hugging it would shrink-wrap a box this node never contains.
1470
- */
1471
- measure(constraints, scope) {
1472
- this.lastMeasure = { constraints, measurer: scope };
1473
- const padding = this.effectivePadding();
1474
- const children = this.flowChildren();
1475
- if (children.length === 0) {
1476
- this._flowMeasure = null;
1477
- return flowOps.size(this, constraints, padding, NO_CONTENT);
1478
- }
1479
- const space = flowOps.contentBox(this, constraints, padding);
1480
- const measured = flowOps.measure(this.flowArrangement(), children, space, scope);
1481
- this._flowMeasure = measured;
1482
- return flowOps.size(this, constraints, padding, measured.hug);
1483
- }
1484
- reparent(args) {
1485
- const newParent = args.data.newParent;
1486
- if (args.duration === undefined) {
1487
- const old = this.parent;
1488
- if (old)
1489
- old.remove(this);
1490
- newParent.add(this);
1491
- return;
1492
- }
1493
- return reparentAnimated(this, newParent, args.duration, args.easing);
1494
- }
1495
- }
1496
- __decorate([
1497
- property({ default: 0 })
1498
- ], Node2D.prototype, "x", void 0);
1499
- __decorate([
1500
- property({ default: 0 })
1501
- ], Node2D.prototype, "y", void 0);
1502
- __decorate([
1503
- property({ default: 'fill', tween: sizeInputOps.lerp })
1504
- ], Node2D.prototype, "width", void 0);
1505
- __decorate([
1506
- property({ default: 'fill', tween: sizeInputOps.lerp })
1507
- ], Node2D.prototype, "height", void 0);
1508
- __decorate([
1509
- property({ default: 1 })
1510
- ], Node2D.prototype, "scale", void 0);
1511
- __decorate([
1512
- property({ default: 0 })
1513
- ], Node2D.prototype, "rotation", void 0);
1514
- __decorate([
1515
- property({ default: 1 })
1516
- ], Node2D.prototype, "opacity", void 0);
1517
- __decorate([
1518
- property({ default: 'pass-through' })
1519
- ], Node2D.prototype, "blend", void 0);
1520
- __decorate([
1521
- effectsProperty()
1522
- ], Node2D.prototype, "effects", void 0);
1523
- __decorate([
1524
- insetsProperty()
1525
- ], Node2D.prototype, "padding", void 0);
1526
- __decorate([
1527
- alignmentProperty()
1528
- ], Node2D.prototype, "pivot", void 0);
1529
- __decorate([
1530
- property({ default: false })
1531
- ], Node2D.prototype, "flipHorizontal", void 0);
1532
- __decorate([
1533
- property({ default: false })
1534
- ], Node2D.prototype, "flipVertical", void 0);
1535
- __decorate([
1536
- property({ default: 0 })
1537
- ], Node2D.prototype, "rotationX", void 0);
1538
- __decorate([
1539
- property({ default: 0 })
1540
- ], Node2D.prototype, "rotationY", void 0);
1541
- __decorate([
1542
- property({ default: 0 })
1543
- ], Node2D.prototype, "rotationZ", void 0);
1544
- __decorate([
1545
- property({ default: 0 })
1546
- ], Node2D.prototype, "depth", void 0);
1547
- __decorate([
1548
- property({ default: 0, tween: lerpPerspective })
1549
- ], Node2D.prototype, "perspective", void 0);
1550
- __decorate([
1551
- property({ default: true })
1552
- ], Node2D.prototype, "backfaceVisible", void 0);
1553
- __decorate([
1554
- property({
1555
- default: undefined,
1556
- // `null` is unset too: a document read back from JSON has no `undefined`.
1557
- mapper: (v) => (v == null ? undefined : alignmentOps.resolve(v)),
1558
- // Tweening *into* an origin from "no origin set" starts where it ends —
1559
- // there is no point to travel from, and snapping to the target's own
1560
- // start is the one reading that isn't an invented one.
1561
- tween: (from, to, t) => alignmentOps.lerp(from ?? to ?? ORIGIN_2D, to ?? ORIGIN_2D, t),
1562
- })
1563
- ], Node2D.prototype, "transformOrigin", void 0);
1564
- __decorate([
1565
- property({ default: false })
1566
- ], Node2D.prototype, "clip", void 0);
1567
- __decorate([
1568
- property({ default: 1 })
1569
- ], Node2D.prototype, "flex", void 0);
1570
- __decorate([
1571
- property({ default: 1 })
1572
- ], Node2D.prototype, "gapScale", void 0);
1573
- __decorate([
1574
- property({ default: undefined })
1575
- ], Node2D.prototype, "column", void 0);
1576
- __decorate([
1577
- property({ default: undefined })
1578
- ], Node2D.prototype, "row", void 0);
1579
- __decorate([
1580
- property({ default: 1 })
1581
- ], Node2D.prototype, "colSpan", void 0);
1582
- __decorate([
1583
- property({ default: 1 })
1584
- ], Node2D.prototype, "rowSpan", void 0);
1585
- __decorate([
1586
- command({
1587
- args: [
1588
- "x",
1589
- "y",
1590
- { key: "path", kind: "path" },
1591
- { key: "target", kind: "nodeRef" },
1592
- { key: "targetAnchor", kind: "alignment" },
1593
- ],
1594
- })
1595
- ], Node2D.prototype, "moveTo", null);
1596
- __decorate([
1597
- command({ args: ["opacity"] })
1598
- ], Node2D.prototype, "fadeTo", null);
1599
- __decorate([
1600
- command({ args: ["rotation"] })
1601
- ], Node2D.prototype, "rotateTo", null);
1602
- __decorate([
1603
- command({ args: ["scale"] })
1604
- ], Node2D.prototype, "scaleTo", null);
1605
- __decorate([
1606
- command({ args: [{ key: "width", kind: "size" }, { key: "height", kind: "size" }, { key: "padding", kind: "insets" }] })
1607
- ], Node2D.prototype, "layoutTo", null);
1608
- __decorate([
1609
- command({ args: [{ key: "factor", kind: "number", min: 0, step: 0.05, unit: "×", default: 1.2 }] })
1610
- ], Node2D.prototype, "pulse", null);
1611
- __decorate([
1612
- command({
1613
- args: [
1614
- { key: "angle", kind: "number", min: 0, unit: "°", default: 8 },
1615
- { key: "turns", kind: "number", min: 1, step: 1, default: 3 },
1616
- ],
1617
- })
1618
- ], Node2D.prototype, "wiggle", null);
1619
- __decorate([
1620
- command({ args: [{ key: "effects", kind: "effects" }] })
1621
- ], Node2D.prototype, "effectTo", null);
1622
- __decorate([
1623
- command({ args: ["index"] })
1624
- ], Node2D.prototype, "removeChildAt", null);
1625
- __decorate([
1626
- command({ args: ["newParent"] })
1627
- ], Node2D.prototype, "reparent", null);
1628
- /** A command's `data` without the arguments a document left out, which arrive as `undefined` and must not be tweened to. */
1629
- function _stated(data) {
1630
- const stated = {};
1631
- for (const key in data) {
1632
- if (data[key] !== undefined)
1633
- stated[key] = data[key];
1634
- }
1635
- return stated;
1636
- }
1637
- /** The 2D node `id` names anywhere in the tree `from` is in, or `null`. */
1638
- export function findNode2D(from, id) {
1639
- let root = from;
1640
- while (root.parent)
1641
- root = root.parent;
1642
- return findUnder(root, id);
1643
- }
1644
- function findUnder(at, id) {
1645
- if (at.id === id)
1646
- return at instanceof Node2D ? at : null;
1647
- for (const child of at._allChildren) {
1648
- const found = findUnder(child, id);
1649
- if (found)
1650
- return found;
1651
- }
1652
- return null;
1653
- }
1654
- /**
1655
- * Where `node`'s frame sits in `host`'s, wherever each is in the tree: its
1656
- * centre as an offset (y-up) from `host`'s, and its turn and scale relative to it.
1657
- */
1658
- export function frameIn(host, node) {
1659
- const there = node.global;
1660
- const here = host.global;
1661
- const inverse = here.scale === 0 ? 0 : 1 / here.scale;
1662
- const offset = rotateOffset(0, 0, -here.rotation, (there.x - here.x) * inverse, (there.y - here.y) * inverse);
1663
- return { x: offset.x, y: offset.y, rotation: there.rotation - here.rotation, scale: there.scale * inverse };
1664
- }
1665
- //# sourceMappingURL=node2d.js.map