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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1133) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -48
  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.d.ts.map +1 -1
  10. package/dist/assets/manager.js +7 -5
  11. package/dist/assets/manager.js.map +1 -1
  12. package/dist/assets/manifest.js.map +1 -1
  13. package/dist/assets/record.js.map +1 -1
  14. package/dist/assets/scope.js.map +1 -1
  15. package/dist/attributes/audio/effects/chain.d.ts +73 -0
  16. package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
  17. package/dist/attributes/audio/effects/chain.js +67 -0
  18. package/dist/attributes/audio/effects/chain.js.map +1 -0
  19. package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
  20. package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
  21. package/dist/attributes/audio/{filters → effects}/implementations/echo.js +2 -2
  22. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -0
  23. package/dist/attributes/audio/effects/implementations/gain.d.ts +10 -0
  24. package/dist/attributes/audio/effects/implementations/gain.d.ts.map +1 -0
  25. package/dist/attributes/audio/{filters → effects}/implementations/gain.js +2 -2
  26. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -0
  27. package/dist/attributes/audio/effects/implementations/highpass.d.ts +12 -0
  28. package/dist/attributes/audio/effects/implementations/highpass.d.ts.map +1 -0
  29. package/dist/attributes/audio/{filters → effects}/implementations/highpass.js +2 -2
  30. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -0
  31. package/dist/attributes/audio/effects/implementations/lowpass.d.ts +12 -0
  32. package/dist/attributes/audio/effects/implementations/lowpass.d.ts.map +1 -0
  33. package/dist/attributes/audio/{filters → effects}/implementations/lowpass.js +2 -2
  34. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -0
  35. package/dist/attributes/audio/effects/implementations/tremolo.d.ts +12 -0
  36. package/dist/attributes/audio/effects/implementations/tremolo.d.ts.map +1 -0
  37. package/dist/attributes/audio/{filters → effects}/implementations/tremolo.js +2 -2
  38. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -0
  39. package/dist/attributes/audio/effects/index.d.ts +12 -0
  40. package/dist/attributes/audio/effects/index.d.ts.map +1 -0
  41. package/dist/attributes/audio/effects/index.js +4 -0
  42. package/dist/attributes/audio/effects/index.js.map +1 -0
  43. package/dist/attributes/audio/effects/registry.d.ts +36 -0
  44. package/dist/attributes/audio/effects/registry.d.ts.map +1 -0
  45. package/dist/attributes/audio/effects/registry.js +80 -0
  46. package/dist/attributes/audio/effects/registry.js.map +1 -0
  47. package/dist/attributes/audio/effects/union.d.ts +14 -0
  48. package/dist/attributes/audio/effects/union.d.ts.map +1 -0
  49. package/dist/attributes/audio/effects/union.js +24 -0
  50. package/dist/attributes/audio/effects/union.js.map +1 -0
  51. package/dist/attributes/audio/ramp.d.ts +103 -0
  52. package/dist/attributes/audio/ramp.d.ts.map +1 -0
  53. package/dist/attributes/audio/ramp.js +246 -0
  54. package/dist/attributes/audio/ramp.js.map +1 -0
  55. package/dist/attributes/audio/request.d.ts +24 -13
  56. package/dist/attributes/audio/request.d.ts.map +1 -1
  57. package/dist/attributes/audio/request.js +4 -3
  58. package/dist/attributes/audio/request.js.map +1 -1
  59. package/dist/attributes/audio/schedule.d.ts +21 -13
  60. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  61. package/dist/attributes/audio/schedule.js +42 -28
  62. package/dist/attributes/audio/schedule.js.map +1 -1
  63. package/dist/attributes/audio/sound.d.ts +15 -12
  64. package/dist/attributes/audio/sound.d.ts.map +1 -1
  65. package/dist/attributes/audio/sound.js +8 -10
  66. package/dist/attributes/audio/sound.js.map +1 -1
  67. package/dist/attributes/audio/transition.d.ts +33 -0
  68. package/dist/attributes/audio/transition.d.ts.map +1 -0
  69. package/dist/attributes/audio/transition.js +48 -0
  70. package/dist/attributes/audio/transition.js.map +1 -0
  71. package/dist/attributes/index.d.ts +4 -3
  72. package/dist/attributes/index.d.ts.map +1 -1
  73. package/dist/attributes/index.js +4 -7
  74. package/dist/attributes/index.js.map +1 -1
  75. package/dist/attributes/layout/alignment.js.map +1 -1
  76. package/dist/attributes/layout/index.js.map +1 -1
  77. package/dist/attributes/layout/insets.js.map +1 -1
  78. package/dist/attributes/layout/matrix2d.d.ts +2 -2
  79. package/dist/attributes/layout/matrix2d.js.map +1 -1
  80. package/dist/attributes/layout/size.js.map +1 -1
  81. package/dist/attributes/layout/space3d.js +1 -1
  82. package/dist/attributes/layout/space3d.js.map +1 -1
  83. package/dist/attributes/layout/transform3d.js.map +1 -1
  84. package/dist/attributes/layout/vector2.js.map +1 -1
  85. package/dist/attributes/layout/world-transform.js.map +1 -1
  86. package/dist/attributes/mask/boolean.js.map +1 -1
  87. package/dist/attributes/mask/mask.js.map +1 -1
  88. package/dist/attributes/properties/decorator.js.map +1 -1
  89. package/dist/attributes/properties/inputs.js.map +1 -1
  90. package/dist/attributes/properties/typed.d.ts +7 -7
  91. package/dist/attributes/properties/typed.d.ts.map +1 -1
  92. package/dist/attributes/properties/typed.js +6 -6
  93. package/dist/attributes/properties/typed.js.map +1 -1
  94. package/dist/attributes/render3d/orbit.js.map +1 -1
  95. package/dist/attributes/shape/corners/corner-radius.d.ts +1 -2
  96. package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
  97. package/dist/attributes/shape/corners/corner-radius.js +1 -2
  98. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  99. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  100. package/dist/attributes/shape/corners/corners.js.map +1 -1
  101. package/dist/attributes/shape/corners/index.js.map +1 -1
  102. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  103. package/dist/attributes/shape/effects/chain.d.ts +96 -409
  104. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  105. package/dist/attributes/shape/effects/chain.js +93 -283
  106. package/dist/attributes/shape/effects/chain.js.map +1 -1
  107. package/dist/attributes/shape/effects/effect-data.d.ts +1 -1
  108. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/ascii.d.ts +45 -13
  110. package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/ascii.js +29 -23
  112. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +32 -7
  114. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/bit-crush.js +17 -15
  116. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/block-displace.d.ts +46 -10
  118. package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/block-displace.js +21 -19
  120. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/bloom.d.ts +32 -7
  122. package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/bloom.js +17 -11
  124. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/blur.d.ts +16 -3
  126. package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/blur.js +13 -5
  128. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/bulge.d.ts +28 -9
  130. package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/bulge.js +15 -14
  132. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +21 -5
  134. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +15 -10
  136. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  137. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +96 -26
  138. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
  139. package/dist/attributes/shape/effects/implementations/color-adjustment.js +29 -26
  140. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  141. package/dist/attributes/shape/effects/implementations/curves.d.ts +20 -6
  142. package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
  143. package/dist/attributes/shape/effects/implementations/curves.js +26 -23
  144. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  145. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +26 -5
  146. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
  147. package/dist/attributes/shape/effects/implementations/directional-blur.js +15 -10
  148. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  149. package/dist/attributes/shape/effects/implementations/dither.d.ts +58 -11
  150. package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
  151. package/dist/attributes/shape/effects/implementations/dither.js +26 -20
  152. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  153. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +46 -14
  154. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
  155. package/dist/attributes/shape/effects/implementations/drop-shadow.js +24 -29
  156. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  157. package/dist/attributes/shape/effects/implementations/duotone.d.ts +26 -7
  158. package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
  159. package/dist/attributes/shape/effects/implementations/duotone.js +17 -16
  160. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  161. package/dist/attributes/shape/effects/implementations/edges.d.ts +29 -7
  162. package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
  163. package/dist/attributes/shape/effects/implementations/edges.js +17 -14
  164. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  165. package/dist/attributes/shape/effects/implementations/glass.d.ts +76 -19
  166. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  167. package/dist/attributes/shape/effects/implementations/glass.js +28 -22
  168. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  169. package/dist/attributes/shape/effects/implementations/glow.d.ts +149 -42
  170. package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
  171. package/dist/attributes/shape/effects/implementations/glow.js +74 -72
  172. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  173. package/dist/attributes/shape/effects/implementations/grain.d.ts +43 -11
  174. package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
  175. package/dist/attributes/shape/effects/implementations/grain.js +21 -18
  176. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  177. package/dist/attributes/shape/effects/implementations/grayscale.d.ts +17 -3
  178. package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
  179. package/dist/attributes/shape/effects/implementations/grayscale.js +13 -5
  180. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  181. package/dist/attributes/shape/effects/implementations/halftone.d.ts +40 -9
  182. package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
  183. package/dist/attributes/shape/effects/implementations/halftone.js +20 -16
  184. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  185. package/dist/attributes/shape/effects/implementations/invert.d.ts +23 -5
  186. package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
  187. package/dist/attributes/shape/effects/implementations/invert.js +15 -10
  188. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  189. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +57 -18
  190. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
  191. package/dist/attributes/shape/effects/implementations/kaleidoscope.js +25 -22
  192. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  193. package/dist/attributes/shape/effects/implementations/lut.d.ts +34 -7
  194. package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
  195. package/dist/attributes/shape/effects/implementations/lut.js +20 -16
  196. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  197. package/dist/attributes/shape/effects/implementations/magnify.d.ts +27 -9
  198. package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
  199. package/dist/attributes/shape/effects/implementations/magnify.js +17 -14
  200. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  201. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +54 -19
  202. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
  203. package/dist/attributes/shape/effects/implementations/motion-blur.js +42 -20
  204. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  205. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +17 -3
  206. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
  207. package/dist/attributes/shape/effects/implementations/oil-paint.js +13 -9
  208. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  209. package/dist/attributes/shape/effects/implementations/outline.d.ts +28 -8
  210. package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
  211. package/dist/attributes/shape/effects/implementations/outline.js +18 -17
  212. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  213. package/dist/attributes/shape/effects/implementations/pixelate.d.ts +25 -6
  214. package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
  215. package/dist/attributes/shape/effects/implementations/pixelate.js +16 -14
  216. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  217. package/dist/attributes/shape/effects/implementations/posterize.d.ts +14 -3
  218. package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
  219. package/dist/attributes/shape/effects/implementations/posterize.js +13 -9
  220. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  221. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +91 -26
  222. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
  223. package/dist/attributes/shape/effects/implementations/progressive-blur.js +27 -28
  224. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  225. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +49 -10
  226. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
  227. package/dist/attributes/shape/effects/implementations/radial-blur.js +19 -20
  228. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  229. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +36 -6
  230. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
  231. package/dist/attributes/shape/effects/implementations/rgb-shift.js +16 -15
  232. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  233. package/dist/attributes/shape/effects/implementations/scanlines.d.ts +52 -11
  234. package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
  235. package/dist/attributes/shape/effects/implementations/scanlines.js +21 -18
  236. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  237. package/dist/attributes/shape/effects/implementations/scatter.d.ts +23 -9
  238. package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
  239. package/dist/attributes/shape/effects/implementations/scatter.js +15 -12
  240. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  241. package/dist/attributes/shape/effects/implementations/shader.d.ts +90 -34
  242. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  243. package/dist/attributes/shape/effects/implementations/shader.js +42 -26
  244. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  245. package/dist/attributes/shape/effects/implementations/sharpen.d.ts +23 -5
  246. package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
  247. package/dist/attributes/shape/effects/implementations/sharpen.js +16 -11
  248. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  249. package/dist/attributes/shape/effects/implementations/streak.d.ts +40 -9
  250. package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
  251. package/dist/attributes/shape/effects/implementations/streak.js +19 -16
  252. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  253. package/dist/attributes/shape/effects/implementations/threshold.d.ts +24 -5
  254. package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
  255. package/dist/attributes/shape/effects/implementations/threshold.js +17 -11
  256. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  257. package/dist/attributes/shape/effects/implementations/twirl.d.ts +35 -8
  258. package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
  259. package/dist/attributes/shape/effects/implementations/twirl.js +17 -16
  260. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  261. package/dist/attributes/shape/effects/implementations/vignette.d.ts +37 -7
  262. package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
  263. package/dist/attributes/shape/effects/implementations/vignette.js +19 -18
  264. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  265. package/dist/attributes/shape/effects/implementations/vintage.d.ts +24 -5
  266. package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
  267. package/dist/attributes/shape/effects/implementations/vintage.js +15 -10
  268. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  269. package/dist/attributes/shape/effects/implementations/wave.d.ts +61 -14
  270. package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
  271. package/dist/attributes/shape/effects/implementations/wave.js +26 -23
  272. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  273. package/dist/attributes/shape/effects/index.d.ts +4 -2
  274. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  275. package/dist/attributes/shape/effects/index.js +1 -1
  276. package/dist/attributes/shape/effects/index.js.map +1 -1
  277. package/dist/attributes/shape/effects/registry.d.ts +11 -0
  278. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  279. package/dist/attributes/shape/effects/registry.js +113 -102
  280. package/dist/attributes/shape/effects/registry.js.map +1 -1
  281. package/dist/attributes/shape/effects/spec.d.ts +229 -0
  282. package/dist/attributes/shape/effects/spec.d.ts.map +1 -0
  283. package/dist/attributes/shape/effects/spec.js +178 -0
  284. package/dist/attributes/shape/effects/spec.js.map +1 -0
  285. package/dist/attributes/shape/effects/union.js.map +1 -1
  286. package/dist/attributes/shape/fill/blend.js.map +1 -1
  287. package/dist/attributes/shape/fill/chain.d.ts +7 -9
  288. package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
  289. package/dist/attributes/shape/fill/chain.js +9 -11
  290. package/dist/attributes/shape/fill/chain.js.map +1 -1
  291. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  292. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  293. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  294. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  295. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  296. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  297. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  298. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  299. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  300. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  301. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  302. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  303. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  304. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  305. package/dist/attributes/shape/fill/implementations/shader.d.ts +27 -26
  306. package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
  307. package/dist/attributes/shape/fill/implementations/shader.js +20 -14
  308. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  309. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  310. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  311. package/dist/attributes/shape/fill/index.d.ts +1 -1
  312. package/dist/attributes/shape/fill/index.d.ts.map +1 -1
  313. package/dist/attributes/shape/fill/index.js.map +1 -1
  314. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  315. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  316. package/dist/attributes/shape/fill/registry.d.ts +1 -2
  317. package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
  318. package/dist/attributes/shape/fill/registry.js +1 -2
  319. package/dist/attributes/shape/fill/registry.js.map +1 -1
  320. package/dist/attributes/shape/fill/union.js.map +1 -1
  321. package/dist/attributes/shape/filters/chain.d.ts +2 -6
  322. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  323. package/dist/attributes/shape/filters/chain.js +1 -5
  324. package/dist/attributes/shape/filters/chain.js.map +1 -1
  325. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  326. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  327. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  328. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +2 -2
  329. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
  330. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  331. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  332. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  333. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  334. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  335. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  336. package/dist/attributes/shape/filters/index.js.map +1 -1
  337. package/dist/attributes/shape/filters/registry.d.ts +1 -1
  338. package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
  339. package/dist/attributes/shape/filters/registry.js +3 -3
  340. package/dist/attributes/shape/filters/registry.js.map +1 -1
  341. package/dist/attributes/shape/filters/union.d.ts +2 -3
  342. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  343. package/dist/attributes/shape/filters/union.js.map +1 -1
  344. package/dist/attributes/shape/path/anchors.js.map +1 -1
  345. package/dist/attributes/shape/path/bezier.js.map +1 -1
  346. package/dist/attributes/shape/path/index.js.map +1 -1
  347. package/dist/attributes/shape/path/measure.js.map +1 -1
  348. package/dist/attributes/shape/path/morph.js.map +1 -1
  349. package/dist/attributes/shape/path/ops.js.map +1 -1
  350. package/dist/attributes/shape/path/types.js.map +1 -1
  351. package/dist/attributes/shape/path/walk.js.map +1 -1
  352. package/dist/attributes/shape/shaders/index.d.ts +2 -0
  353. package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
  354. package/dist/attributes/shape/shaders/index.js +2 -0
  355. package/dist/attributes/shape/shaders/index.js.map +1 -1
  356. package/dist/attributes/shape/shaders/language.d.ts +26 -0
  357. package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
  358. package/dist/attributes/shape/shaders/language.js +20 -0
  359. package/dist/attributes/shape/shaders/language.js.map +1 -0
  360. package/dist/attributes/shape/shaders/pack.d.ts +25 -11
  361. package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
  362. package/dist/attributes/shape/shaders/pack.js +9 -4
  363. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  364. package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
  365. package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
  366. package/dist/attributes/shape/shaders/resolve.js +3 -6
  367. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  368. package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
  369. package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
  370. package/dist/attributes/shape/shaders/uniforms.js +0 -0
  371. package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
  372. package/dist/attributes/shape/shadow/index.js.map +1 -1
  373. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  374. package/dist/attributes/shape/stroke/index.js.map +1 -1
  375. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  376. package/dist/attributes/shared/operators.js.map +1 -1
  377. package/dist/attributes/text/index.js.map +1 -1
  378. package/dist/attributes/text/ops.js.map +1 -1
  379. package/dist/attributes/text/types.js.map +1 -1
  380. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  381. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  382. package/dist/browser/chunks/chunk-7DB6BI27.js +6 -0
  383. package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
  384. package/dist/browser/chunks/chunk-IX53IFBD.js +13 -0
  385. package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
  386. package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
  387. package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
  388. package/dist/browser/component.js +1 -1
  389. package/dist/browser/experimental.js +1 -1
  390. package/dist/browser/experimental.js.map +4 -4
  391. package/dist/browser/index.js +1 -1
  392. package/dist/browser/index.js.map +2 -2
  393. package/dist/browser/manifest.json +1 -1
  394. package/dist/browser/sdk.js +1 -1
  395. package/dist/component.js.map +1 -1
  396. package/dist/components/builtins/audio/audio.d.ts +14 -5
  397. package/dist/components/builtins/audio/audio.d.ts.map +1 -1
  398. package/dist/components/builtins/audio/audio.js +10 -13
  399. package/dist/components/builtins/audio/audio.js.map +1 -1
  400. package/dist/components/builtins/geometry/composite.d.ts +3 -3
  401. package/dist/components/builtins/geometry/composite.js.map +1 -1
  402. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  403. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  404. package/dist/components/builtins/layout/layout.js.map +1 -1
  405. package/dist/components/builtins/media/media.d.ts +7 -7
  406. package/dist/components/builtins/media/media.d.ts.map +1 -1
  407. package/dist/components/builtins/media/media.js +4 -10
  408. package/dist/components/builtins/media/media.js.map +1 -1
  409. package/dist/components/builtins/providers/providers.js.map +1 -1
  410. package/dist/components/builtins/text/number-format.js.map +1 -1
  411. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  412. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  413. package/dist/components/builtins/text/text-layout.js.map +1 -1
  414. package/dist/components/builtins/text/text.d.ts +9 -9
  415. package/dist/components/builtins/text/text.d.ts.map +1 -1
  416. package/dist/components/builtins/text/text.js +3 -0
  417. package/dist/components/builtins/text/text.js.map +1 -1
  418. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  419. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  420. package/dist/components/builtins/three/three.js.map +1 -1
  421. package/dist/components/factory/api.d.ts +38 -11
  422. package/dist/components/factory/api.d.ts.map +1 -1
  423. package/dist/components/factory/api.js.map +1 -1
  424. package/dist/components/factory/clip-of.js.map +1 -1
  425. package/dist/components/factory/commands-for.js.map +1 -1
  426. package/dist/components/factory/component-audio.js.map +1 -1
  427. package/dist/components/factory/component2d.js.map +1 -1
  428. package/dist/components/factory/component3d.d.ts.map +1 -1
  429. package/dist/components/factory/component3d.js +11 -3
  430. package/dist/components/factory/component3d.js.map +1 -1
  431. package/dist/components/factory/factory.d.ts +3 -0
  432. package/dist/components/factory/factory.d.ts.map +1 -1
  433. package/dist/components/factory/factory.js +39 -5
  434. package/dist/components/factory/factory.js.map +1 -1
  435. package/dist/components/factory/timeline.js.map +1 -1
  436. package/dist/components/factory/type-def.js.map +1 -1
  437. package/dist/components/factory/types.js.map +1 -1
  438. package/dist/components/factory/views.js.map +1 -1
  439. package/dist/components/modules/aim.js.map +1 -1
  440. package/dist/components/modules/corners.js.map +1 -1
  441. package/dist/components/modules/flow.js.map +1 -1
  442. package/dist/components/modules/material.js.map +1 -1
  443. package/dist/components/modules/paint.js.map +1 -1
  444. package/dist/components/modules/shapes.js.map +1 -1
  445. package/dist/components/modules/text-layout.js.map +1 -1
  446. package/dist/components/modules/text-style.js.map +1 -1
  447. package/dist/components/modules/three-entries.js.map +1 -1
  448. package/dist/components/modules/view3d.js.map +1 -1
  449. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  450. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  451. package/dist/components/trees/2d/node-motion.js.map +1 -1
  452. package/dist/components/trees/2d/node-render.d.ts +1 -1
  453. package/dist/components/trees/2d/node-render.js +1 -1
  454. package/dist/components/trees/2d/node-render.js.map +1 -1
  455. package/dist/components/trees/2d/node-space.js.map +1 -1
  456. package/dist/components/trees/2d/node-transform.js.map +1 -1
  457. package/dist/components/trees/2d/node2d.d.ts +1 -1
  458. package/dist/components/trees/2d/node2d.js +1 -1
  459. package/dist/components/trees/2d/node2d.js.map +1 -1
  460. package/dist/components/trees/audio/index.js.map +1 -1
  461. package/dist/components/trees/audio/node-audio.d.ts +16 -9
  462. package/dist/components/trees/audio/node-audio.d.ts.map +1 -1
  463. package/dist/components/trees/audio/node-audio.js +15 -11
  464. package/dist/components/trees/audio/node-audio.js.map +1 -1
  465. package/dist/components/trees/index.js.map +1 -1
  466. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  467. package/dist/components/trees/node/node-reactive.js.map +1 -1
  468. package/dist/components/trees/node/node-time.js.map +1 -1
  469. package/dist/components/trees/node/node-walk.js.map +1 -1
  470. package/dist/components/trees/node/node.js.map +1 -1
  471. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  472. package/dist/components/trees/three/node3d.js.map +1 -1
  473. package/dist/document/audio.js.map +1 -1
  474. package/dist/document/builtins.js.map +1 -1
  475. package/dist/document/command-traits.d.ts +12 -2
  476. package/dist/document/command-traits.d.ts.map +1 -1
  477. package/dist/document/command-traits.js +34 -6
  478. package/dist/document/command-traits.js.map +1 -1
  479. package/dist/document/deny-globals.js.map +1 -1
  480. package/dist/document/diff.js.map +1 -1
  481. package/dist/document/doc-index.js.map +1 -1
  482. package/dist/document/expression/compile.js.map +1 -1
  483. package/dist/document/expression/index.js.map +1 -1
  484. package/dist/document/expression/ops.js.map +1 -1
  485. package/dist/document/expression/parse.js.map +1 -1
  486. package/dist/document/expression/refs.js.map +1 -1
  487. package/dist/document/expression/types.js.map +1 -1
  488. package/dist/document/expression/walk.js.map +1 -1
  489. package/dist/document/index.d.ts +8 -0
  490. package/dist/document/index.d.ts.map +1 -1
  491. package/dist/document/index.js +4 -0
  492. package/dist/document/index.js.map +1 -1
  493. package/dist/document/migrate.d.ts +70 -0
  494. package/dist/document/migrate.d.ts.map +1 -0
  495. package/dist/document/migrate.js +202 -0
  496. package/dist/document/migrate.js.map +1 -0
  497. package/dist/document/missing-node.d.ts +27 -0
  498. package/dist/document/missing-node.d.ts.map +1 -0
  499. package/dist/document/missing-node.js +48 -0
  500. package/dist/document/missing-node.js.map +1 -0
  501. package/dist/document/node-decorator.js.map +1 -1
  502. package/dist/document/node-descriptor.d.ts +4 -0
  503. package/dist/document/node-descriptor.d.ts.map +1 -1
  504. package/dist/document/node-descriptor.js.map +1 -1
  505. package/dist/document/placement.d.ts +2 -1
  506. package/dist/document/placement.d.ts.map +1 -1
  507. package/dist/document/placement.js.map +1 -1
  508. package/dist/document/project.d.ts +2 -0
  509. package/dist/document/project.d.ts.map +1 -1
  510. package/dist/document/project.js +1 -0
  511. package/dist/document/project.js.map +1 -1
  512. package/dist/document/prop-evolution.d.ts +51 -0
  513. package/dist/document/prop-evolution.d.ts.map +1 -0
  514. package/dist/document/prop-evolution.js +83 -0
  515. package/dist/document/prop-evolution.js.map +1 -0
  516. package/dist/document/registry.d.ts +16 -0
  517. package/dist/document/registry.d.ts.map +1 -1
  518. package/dist/document/registry.js +30 -4
  519. package/dist/document/registry.js.map +1 -1
  520. package/dist/document/settled-index.d.ts +2 -0
  521. package/dist/document/settled-index.d.ts.map +1 -1
  522. package/dist/document/settled-index.js +5 -5
  523. package/dist/document/settled-index.js.map +1 -1
  524. package/dist/document/timeline-patch.d.ts +4 -0
  525. package/dist/document/timeline-patch.d.ts.map +1 -1
  526. package/dist/document/timeline-patch.js +28 -3
  527. package/dist/document/timeline-patch.js.map +1 -1
  528. package/dist/document/timeline.d.ts +45 -1
  529. package/dist/document/timeline.d.ts.map +1 -1
  530. package/dist/document/timeline.js +172 -42
  531. package/dist/document/timeline.js.map +1 -1
  532. package/dist/document/types.d.ts +14 -28
  533. package/dist/document/types.d.ts.map +1 -1
  534. package/dist/document/types.js.map +1 -1
  535. package/dist/document/validate.d.ts +17 -5
  536. package/dist/document/validate.d.ts.map +1 -1
  537. package/dist/document/validate.js +158 -21
  538. package/dist/document/validate.js.map +1 -1
  539. package/dist/document/vocabulary.d.ts +28 -0
  540. package/dist/document/vocabulary.d.ts.map +1 -0
  541. package/dist/document/vocabulary.js +42 -0
  542. package/dist/document/vocabulary.js.map +1 -0
  543. package/dist/experimental.d.ts +68 -8
  544. package/dist/experimental.d.ts.map +1 -1
  545. package/dist/experimental.js +22 -8
  546. package/dist/experimental.js.map +1 -1
  547. package/dist/index.js.map +1 -1
  548. package/dist/layout/bounds.js.map +1 -1
  549. package/dist/layout/constraints.js.map +1 -1
  550. package/dist/layout/flex.js.map +1 -1
  551. package/dist/layout/freeform.js.map +1 -1
  552. package/dist/layout/grid.js.map +1 -1
  553. package/dist/layout/index.js.map +1 -1
  554. package/dist/layout/item.js.map +1 -1
  555. package/dist/layout/ops.js.map +1 -1
  556. package/dist/layout/types.js.map +1 -1
  557. package/dist/platform/audio-sink.js.map +1 -1
  558. package/dist/platform/exporter.d.ts +13 -0
  559. package/dist/platform/exporter.d.ts.map +1 -1
  560. package/dist/platform/exporter.js.map +1 -1
  561. package/dist/platform/index.js.map +1 -1
  562. package/dist/platform/stepped-clock.js.map +1 -1
  563. package/dist/platform/storage-adapter.js.map +1 -1
  564. package/dist/platform/ticker.js.map +1 -1
  565. package/dist/project/config.js.map +1 -1
  566. package/dist/project/index.js.map +1 -1
  567. package/dist/project/tree.js.map +1 -1
  568. package/dist/props/host.js.map +1 -1
  569. package/dist/props/index.js.map +1 -1
  570. package/dist/props/observer.js.map +1 -1
  571. package/dist/props/slot.js.map +1 -1
  572. package/dist/renamed-scene-names.d.ts +1 -1
  573. package/dist/renamed-scene-names.d.ts.map +1 -1
  574. package/dist/renamed-scene-names.js +1 -1
  575. package/dist/renamed-scene-names.js.map +1 -1
  576. package/dist/render/canvas-render-context2d.d.ts +9 -0
  577. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  578. package/dist/render/canvas-render-context2d.js +10 -0
  579. package/dist/render/canvas-render-context2d.js.map +1 -1
  580. package/dist/render/clip-contains.js +1 -1
  581. package/dist/render/clip-contains.js.map +1 -1
  582. package/dist/render/clip.js.map +1 -1
  583. package/dist/render/descriptors/ellipse.js.map +1 -1
  584. package/dist/render/descriptors/line.js.map +1 -1
  585. package/dist/render/descriptors/path-builder.js.map +1 -1
  586. package/dist/render/descriptors/path.js.map +1 -1
  587. package/dist/render/descriptors/polygon.js.map +1 -1
  588. package/dist/render/descriptors/polygram.js.map +1 -1
  589. package/dist/render/descriptors/rect.js.map +1 -1
  590. package/dist/render/descriptors/richtext.js.map +1 -1
  591. package/dist/render/descriptors/shape.js.map +1 -1
  592. package/dist/render/descriptors/text.d.ts +2 -2
  593. package/dist/render/descriptors/text.js +2 -2
  594. package/dist/render/descriptors/text.js.map +1 -1
  595. package/dist/render/descriptors/transform.js.map +1 -1
  596. package/dist/render/graphics2d.js.map +1 -1
  597. package/dist/render/index.d.ts +2 -0
  598. package/dist/render/index.d.ts.map +1 -1
  599. package/dist/render/index.js +1 -0
  600. package/dist/render/index.js.map +1 -1
  601. package/dist/render/measure-context.js.map +1 -1
  602. package/dist/render/null-render-context.js.map +1 -1
  603. package/dist/render/render-context2d.d.ts +1 -1
  604. package/dist/render/render-context2d.js.map +1 -1
  605. package/dist/render/render-issue.d.ts +39 -0
  606. package/dist/render/render-issue.d.ts.map +1 -0
  607. package/dist/render/render-issue.js +29 -0
  608. package/dist/render/render-issue.js.map +1 -0
  609. package/dist/render/surface.d.ts +2 -2
  610. package/dist/render/surface.js.map +1 -1
  611. package/dist/render/text-defaults.js.map +1 -1
  612. package/dist/render/text-layout.js.map +1 -1
  613. package/dist/render3d/bounds3d.js.map +1 -1
  614. package/dist/render3d/builders.js.map +1 -1
  615. package/dist/render3d/camera.js.map +1 -1
  616. package/dist/render3d/fill3d.js.map +1 -1
  617. package/dist/render3d/geometry.js.map +1 -1
  618. package/dist/render3d/graphics3d.d.ts.map +1 -1
  619. package/dist/render3d/graphics3d.js +54 -5
  620. package/dist/render3d/graphics3d.js.map +1 -1
  621. package/dist/render3d/index.js.map +1 -1
  622. package/dist/render3d/inert.js.map +1 -1
  623. package/dist/render3d/light.js.map +1 -1
  624. package/dist/render3d/material.js.map +1 -1
  625. package/dist/render3d/matrix4.js.map +1 -1
  626. package/dist/render3d/render-context3d.js.map +1 -1
  627. package/dist/render3d/resources.js.map +1 -1
  628. package/dist/render3d/rounded-box.js.map +1 -1
  629. package/dist/render3d/scene-settings.js.map +1 -1
  630. package/dist/render3d/scene3d.js.map +1 -1
  631. package/dist/render3d/segments.js.map +1 -1
  632. package/dist/render3d/texture.js.map +1 -1
  633. package/dist/render3d/tracking.js.map +1 -1
  634. package/dist/render3d/transform.js.map +1 -1
  635. package/dist/render3d/vector3.js.map +1 -1
  636. package/dist/render3d/walk.js.map +1 -1
  637. package/dist/runtime/asset-refine.js +2 -1
  638. package/dist/runtime/asset-refine.js.map +1 -1
  639. package/dist/runtime/asset-timeline.d.ts +10 -0
  640. package/dist/runtime/asset-timeline.d.ts.map +1 -1
  641. package/dist/runtime/asset-timeline.js.map +1 -1
  642. package/dist/runtime/asset-update.d.ts.map +1 -1
  643. package/dist/runtime/asset-update.js +7 -0
  644. package/dist/runtime/asset-update.js.map +1 -1
  645. package/dist/runtime/audio-index.js.map +1 -1
  646. package/dist/runtime/builtin-context.js.map +1 -1
  647. package/dist/runtime/clip-instance.d.ts +3 -1
  648. package/dist/runtime/clip-instance.d.ts.map +1 -1
  649. package/dist/runtime/clip-instance.js +4 -0
  650. package/dist/runtime/clip-instance.js.map +1 -1
  651. package/dist/runtime/clip-store.d.ts.map +1 -1
  652. package/dist/runtime/clip-store.js +17 -2
  653. package/dist/runtime/clip-store.js.map +1 -1
  654. package/dist/runtime/engine.d.ts +5 -3
  655. package/dist/runtime/engine.d.ts.map +1 -1
  656. package/dist/runtime/engine.js +2 -1
  657. package/dist/runtime/engine.js.map +1 -1
  658. package/dist/runtime/frame-time.js.map +1 -1
  659. package/dist/runtime/index.js.map +1 -1
  660. package/dist/runtime/node-picking.js.map +1 -1
  661. package/dist/runtime/node-picking3d.js.map +1 -1
  662. package/dist/runtime/placement.js.map +1 -1
  663. package/dist/runtime/playback-controller.d.ts.map +1 -1
  664. package/dist/runtime/playback-controller.js +14 -4
  665. package/dist/runtime/playback-controller.js.map +1 -1
  666. package/dist/runtime/playback.js.map +1 -1
  667. package/dist/runtime/precompisition.js.map +1 -1
  668. package/dist/runtime/project-assets.js.map +1 -1
  669. package/dist/runtime/session.d.ts +7 -3
  670. package/dist/runtime/session.d.ts.map +1 -1
  671. package/dist/runtime/session.js +11 -4
  672. package/dist/runtime/session.js.map +1 -1
  673. package/dist/runtime/settle.js.map +1 -1
  674. package/dist/runtime/state-evaluator.js.map +1 -1
  675. package/dist/runtime/text-geometry.d.ts +1 -1
  676. package/dist/runtime/text-geometry.js.map +1 -1
  677. package/dist/sdk/index.d.ts +8 -6
  678. package/dist/sdk/index.d.ts.map +1 -1
  679. package/dist/sdk/index.js +10 -3
  680. package/dist/sdk/index.js.map +1 -1
  681. package/dist/tween/command-decorator.d.ts +7 -0
  682. package/dist/tween/command-decorator.d.ts.map +1 -1
  683. package/dist/tween/command-decorator.js +1 -0
  684. package/dist/tween/command-decorator.js.map +1 -1
  685. package/dist/tween/command.js.map +1 -1
  686. package/dist/tween/ease/constants.js.map +1 -1
  687. package/dist/tween/ease/curve.js.map +1 -1
  688. package/dist/tween/ease/describe.d.ts +2 -0
  689. package/dist/tween/ease/describe.d.ts.map +1 -1
  690. package/dist/tween/ease/describe.js +4 -0
  691. package/dist/tween/ease/describe.js.map +1 -1
  692. package/dist/tween/ease/spec.d.ts +31 -0
  693. package/dist/tween/ease/spec.d.ts.map +1 -0
  694. package/dist/tween/ease/spec.js +51 -0
  695. package/dist/tween/ease/spec.js.map +1 -0
  696. package/dist/tween/ease/type.js.map +1 -1
  697. package/dist/tween/index.d.ts +1 -0
  698. package/dist/tween/index.d.ts.map +1 -1
  699. package/dist/tween/index.js +1 -0
  700. package/dist/tween/index.js.map +1 -1
  701. package/dist/tween/inert.js.map +1 -1
  702. package/dist/tween/lerp.js.map +1 -1
  703. package/dist/tween/loop.js.map +1 -1
  704. package/dist/tween/prepare.js.map +1 -1
  705. package/dist/tween/stepper.js.map +1 -1
  706. package/dist/tween/to-command.js.map +1 -1
  707. package/dist/util/clamp.js.map +1 -1
  708. package/dist/util/context.js.map +1 -1
  709. package/dist/util/csv.js.map +1 -1
  710. package/dist/util/generateList.js.map +1 -1
  711. package/dist/util/index.js.map +1 -1
  712. package/dist/util/metrics.js.map +1 -1
  713. package/dist/util/random.js.map +1 -1
  714. package/dist/util/reference.js.map +1 -1
  715. package/dist/util/scheduler.js.map +1 -1
  716. package/package.json +2 -2
  717. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  718. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  719. package/dist/attributes/audio/filters/chain.js +0 -104
  720. package/dist/attributes/audio/filters/chain.js.map +0 -1
  721. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  722. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  723. package/dist/attributes/audio/filters/curve.js +0 -250
  724. package/dist/attributes/audio/filters/curve.js.map +0 -1
  725. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  726. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  727. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  728. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  729. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  730. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  731. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  732. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  733. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  734. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  735. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  736. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  737. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  738. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  739. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  740. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  741. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  742. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  743. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  744. package/dist/attributes/audio/filters/index.d.ts +0 -22
  745. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  746. package/dist/attributes/audio/filters/index.js +0 -8
  747. package/dist/attributes/audio/filters/index.js.map +0 -1
  748. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  749. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  750. package/dist/attributes/audio/filters/registry.js +0 -82
  751. package/dist/attributes/audio/filters/registry.js.map +0 -1
  752. package/dist/attributes/audio/filters/union.d.ts +0 -18
  753. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  754. package/dist/attributes/audio/filters/union.js +0 -28
  755. package/dist/attributes/audio/filters/union.js.map +0 -1
  756. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  757. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  758. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  759. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  760. package/dist/browser/chunks/chunk-D4FSTPML.js +0 -14
  761. package/dist/browser/chunks/chunk-D4FSTPML.js.map +0 -7
  762. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  763. package/dist/browser/chunks/chunk-RTNATFWX.js +0 -5
  764. package/dist/browser/chunks/chunk-RTNATFWX.js.map +0 -7
  765. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  766. package/dist/component/api.d.ts +0 -508
  767. package/dist/component/api.d.ts.map +0 -1
  768. package/dist/component/api.js +0 -4
  769. package/dist/component/api.js.map +0 -1
  770. package/dist/component/builtins/audio.d.ts +0 -26
  771. package/dist/component/builtins/audio.d.ts.map +0 -1
  772. package/dist/component/builtins/audio.js +0 -41
  773. package/dist/component/builtins/audio.js.map +0 -1
  774. package/dist/component/builtins/canvas3d.d.ts +0 -98
  775. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  776. package/dist/component/builtins/canvas3d.js +0 -21
  777. package/dist/component/builtins/canvas3d.js.map +0 -1
  778. package/dist/component/builtins/composite.d.ts +0 -56
  779. package/dist/component/builtins/composite.d.ts.map +0 -1
  780. package/dist/component/builtins/composite.js +0 -25
  781. package/dist/component/builtins/composite.js.map +0 -1
  782. package/dist/component/builtins/geometry.d.ts +0 -505
  783. package/dist/component/builtins/geometry.d.ts.map +0 -1
  784. package/dist/component/builtins/geometry.js +0 -107
  785. package/dist/component/builtins/geometry.js.map +0 -1
  786. package/dist/component/builtins/layout.d.ts +0 -88
  787. package/dist/component/builtins/layout.d.ts.map +0 -1
  788. package/dist/component/builtins/layout.js +0 -84
  789. package/dist/component/builtins/layout.js.map +0 -1
  790. package/dist/component/builtins/media.d.ts +0 -95
  791. package/dist/component/builtins/media.d.ts.map +0 -1
  792. package/dist/component/builtins/media.js +0 -149
  793. package/dist/component/builtins/media.js.map +0 -1
  794. package/dist/component/builtins/providers.d.ts +0 -23
  795. package/dist/component/builtins/providers.d.ts.map +0 -1
  796. package/dist/component/builtins/providers.js +0 -30
  797. package/dist/component/builtins/providers.js.map +0 -1
  798. package/dist/component/builtins/text.d.ts +0 -193
  799. package/dist/component/builtins/text.d.ts.map +0 -1
  800. package/dist/component/builtins/text.js +0 -113
  801. package/dist/component/builtins/text.js.map +0 -1
  802. package/dist/component/builtins/three.d.ts +0 -1085
  803. package/dist/component/builtins/three.d.ts.map +0 -1
  804. package/dist/component/builtins/three.js +0 -265
  805. package/dist/component/builtins/three.js.map +0 -1
  806. package/dist/component/clip-of.d.ts +0 -5
  807. package/dist/component/clip-of.d.ts.map +0 -1
  808. package/dist/component/clip-of.js +0 -33
  809. package/dist/component/clip-of.js.map +0 -1
  810. package/dist/component/commands-for.d.ts +0 -19
  811. package/dist/component/commands-for.d.ts.map +0 -1
  812. package/dist/component/commands-for.js +0 -5
  813. package/dist/component/commands-for.js.map +0 -1
  814. package/dist/component/component-audio.d.ts +0 -9
  815. package/dist/component/component-audio.d.ts.map +0 -1
  816. package/dist/component/component-audio.js +0 -18
  817. package/dist/component/component-audio.js.map +0 -1
  818. package/dist/component/component2d.d.ts +0 -9
  819. package/dist/component/component2d.d.ts.map +0 -1
  820. package/dist/component/component2d.js +0 -239
  821. package/dist/component/component2d.js.map +0 -1
  822. package/dist/component/component3d.d.ts +0 -9
  823. package/dist/component/component3d.d.ts.map +0 -1
  824. package/dist/component/component3d.js +0 -99
  825. package/dist/component/component3d.js.map +0 -1
  826. package/dist/component/factory.d.ts +0 -63
  827. package/dist/component/factory.d.ts.map +0 -1
  828. package/dist/component/factory.js +0 -313
  829. package/dist/component/factory.js.map +0 -1
  830. package/dist/component/modules/aim.d.ts +0 -30
  831. package/dist/component/modules/aim.d.ts.map +0 -1
  832. package/dist/component/modules/aim.js +0 -39
  833. package/dist/component/modules/aim.js.map +0 -1
  834. package/dist/component/modules/corners.d.ts +0 -13
  835. package/dist/component/modules/corners.d.ts.map +0 -1
  836. package/dist/component/modules/corners.js +0 -12
  837. package/dist/component/modules/corners.js.map +0 -1
  838. package/dist/component/modules/flow.d.ts +0 -26
  839. package/dist/component/modules/flow.d.ts.map +0 -1
  840. package/dist/component/modules/flow.js +0 -55
  841. package/dist/component/modules/flow.js.map +0 -1
  842. package/dist/component/modules/material.d.ts +0 -40
  843. package/dist/component/modules/material.d.ts.map +0 -1
  844. package/dist/component/modules/material.js +0 -75
  845. package/dist/component/modules/material.js.map +0 -1
  846. package/dist/component/modules/paint.d.ts +0 -71
  847. package/dist/component/modules/paint.d.ts.map +0 -1
  848. package/dist/component/modules/paint.js +0 -106
  849. package/dist/component/modules/paint.js.map +0 -1
  850. package/dist/component/modules/shapes.d.ts +0 -31
  851. package/dist/component/modules/shapes.d.ts.map +0 -1
  852. package/dist/component/modules/shapes.js +0 -43
  853. package/dist/component/modules/shapes.js.map +0 -1
  854. package/dist/component/modules/text-layout.d.ts +0 -26
  855. package/dist/component/modules/text-layout.d.ts.map +0 -1
  856. package/dist/component/modules/text-layout.js +0 -57
  857. package/dist/component/modules/text-layout.js.map +0 -1
  858. package/dist/component/modules/text-style.d.ts +0 -48
  859. package/dist/component/modules/text-style.d.ts.map +0 -1
  860. package/dist/component/modules/text-style.js +0 -63
  861. package/dist/component/modules/text-style.js.map +0 -1
  862. package/dist/component/modules/three-entries.d.ts +0 -23
  863. package/dist/component/modules/three-entries.d.ts.map +0 -1
  864. package/dist/component/modules/three-entries.js +0 -41
  865. package/dist/component/modules/three-entries.js.map +0 -1
  866. package/dist/component/modules/view3d.d.ts +0 -55
  867. package/dist/component/modules/view3d.d.ts.map +0 -1
  868. package/dist/component/modules/view3d.js +0 -160
  869. package/dist/component/modules/view3d.js.map +0 -1
  870. package/dist/component/timeline.d.ts +0 -22
  871. package/dist/component/timeline.d.ts.map +0 -1
  872. package/dist/component/timeline.js +0 -128
  873. package/dist/component/timeline.js.map +0 -1
  874. package/dist/component/type-def.d.ts +0 -26
  875. package/dist/component/type-def.d.ts.map +0 -1
  876. package/dist/component/type-def.js +0 -16
  877. package/dist/component/type-def.js.map +0 -1
  878. package/dist/component/types.d.ts +0 -91
  879. package/dist/component/types.d.ts.map +0 -1
  880. package/dist/component/types.js +0 -88
  881. package/dist/component/types.js.map +0 -1
  882. package/dist/component/views.d.ts +0 -121
  883. package/dist/component/views.d.ts.map +0 -1
  884. package/dist/component/views.js +0 -413
  885. package/dist/component/views.js.map +0 -1
  886. package/dist/document/withdraw.d.ts +0 -28
  887. package/dist/document/withdraw.d.ts.map +0 -1
  888. package/dist/document/withdraw.js +0 -61
  889. package/dist/document/withdraw.js.map +0 -1
  890. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  891. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  892. package/dist/jsx/jsx-dev-runtime.js +0 -3
  893. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  894. package/dist/jsx/jsx-runtime.d.ts +0 -27
  895. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  896. package/dist/jsx/jsx-runtime.js +0 -26
  897. package/dist/jsx/jsx-runtime.js.map +0 -1
  898. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  899. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  900. package/dist/nodes/2d/node-lifecycle.js +0 -264
  901. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  902. package/dist/nodes/2d/node-motion.d.ts +0 -56
  903. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  904. package/dist/nodes/2d/node-motion.js +0 -86
  905. package/dist/nodes/2d/node-motion.js.map +0 -1
  906. package/dist/nodes/2d/node-render.d.ts +0 -44
  907. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  908. package/dist/nodes/2d/node-render.js +0 -80
  909. package/dist/nodes/2d/node-render.js.map +0 -1
  910. package/dist/nodes/2d/node-space.d.ts +0 -63
  911. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  912. package/dist/nodes/2d/node-space.js +0 -131
  913. package/dist/nodes/2d/node-space.js.map +0 -1
  914. package/dist/nodes/2d/node-transform.d.ts +0 -55
  915. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  916. package/dist/nodes/2d/node-transform.js +0 -73
  917. package/dist/nodes/2d/node-transform.js.map +0 -1
  918. package/dist/nodes/2d/node2d.d.ts +0 -1111
  919. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  920. package/dist/nodes/2d/node2d.js +0 -1665
  921. package/dist/nodes/2d/node2d.js.map +0 -1
  922. package/dist/nodes/2d/paint-node.d.ts +0 -142
  923. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  924. package/dist/nodes/2d/paint-node.js +0 -232
  925. package/dist/nodes/2d/paint-node.js.map +0 -1
  926. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  927. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  928. package/dist/nodes/audio/audio-bus.js +0 -33
  929. package/dist/nodes/audio/audio-bus.js.map +0 -1
  930. package/dist/nodes/audio/index.d.ts +0 -4
  931. package/dist/nodes/audio/index.d.ts.map +0 -1
  932. package/dist/nodes/audio/index.js +0 -2
  933. package/dist/nodes/audio/index.js.map +0 -1
  934. package/dist/nodes/audio/node-audio.d.ts +0 -107
  935. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  936. package/dist/nodes/audio/node-audio.js +0 -179
  937. package/dist/nodes/audio/node-audio.js.map +0 -1
  938. package/dist/nodes/audio/sound-node.d.ts +0 -41
  939. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  940. package/dist/nodes/audio/sound-node.js +0 -71
  941. package/dist/nodes/audio/sound-node.js.map +0 -1
  942. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  943. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  944. package/dist/nodes/geometry/boolean-node.js +0 -81
  945. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  946. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  947. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  948. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  949. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  950. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  951. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  952. package/dist/nodes/geometry/box-path-node.js +0 -116
  953. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  954. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  955. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  956. package/dist/nodes/geometry/ellipse-node.js +0 -45
  957. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  958. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  959. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  960. package/dist/nodes/geometry/group-bounds.js +0 -87
  961. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  962. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  963. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  964. package/dist/nodes/geometry/mask-node.js +0 -66
  965. package/dist/nodes/geometry/mask-node.js.map +0 -1
  966. package/dist/nodes/geometry/path-node.d.ts +0 -26
  967. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  968. package/dist/nodes/geometry/path-node.js +0 -58
  969. package/dist/nodes/geometry/path-node.js.map +0 -1
  970. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  971. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  972. package/dist/nodes/geometry/polygon-node.js +0 -47
  973. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  974. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  975. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  976. package/dist/nodes/geometry/polygram-node.js +0 -52
  977. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  978. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  979. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  980. package/dist/nodes/geometry/rect-node.js +0 -56
  981. package/dist/nodes/geometry/rect-node.js.map +0 -1
  982. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  983. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  984. package/dist/nodes/geometry/shape-node.js +0 -140
  985. package/dist/nodes/geometry/shape-node.js.map +0 -1
  986. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  987. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  988. package/dist/nodes/geometry/shape-outline.js +0 -470
  989. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  990. package/dist/nodes/index.d.ts +0 -53
  991. package/dist/nodes/index.d.ts.map +0 -1
  992. package/dist/nodes/index.js +0 -35
  993. package/dist/nodes/index.js.map +0 -1
  994. package/dist/nodes/layout/camera-node.d.ts +0 -80
  995. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  996. package/dist/nodes/layout/camera-node.js +0 -153
  997. package/dist/nodes/layout/camera-node.js.map +0 -1
  998. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  999. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  1000. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  1001. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  1002. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  1003. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  1004. package/dist/nodes/layout/rotated-box.js +0 -76
  1005. package/dist/nodes/layout/rotated-box.js.map +0 -1
  1006. package/dist/nodes/media/video-node.d.ts +0 -229
  1007. package/dist/nodes/media/video-node.d.ts.map +0 -1
  1008. package/dist/nodes/media/video-node.js +0 -350
  1009. package/dist/nodes/media/video-node.js.map +0 -1
  1010. package/dist/nodes/node/declare-paints.d.ts +0 -19
  1011. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  1012. package/dist/nodes/node/declare-paints.js +0 -27
  1013. package/dist/nodes/node/declare-paints.js.map +0 -1
  1014. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  1015. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  1016. package/dist/nodes/node/node-editor-state.js +0 -23
  1017. package/dist/nodes/node/node-editor-state.js.map +0 -1
  1018. package/dist/nodes/node/node-reactive.d.ts +0 -89
  1019. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  1020. package/dist/nodes/node/node-reactive.js +0 -135
  1021. package/dist/nodes/node/node-reactive.js.map +0 -1
  1022. package/dist/nodes/node/node-time.d.ts +0 -39
  1023. package/dist/nodes/node/node-time.d.ts.map +0 -1
  1024. package/dist/nodes/node/node-time.js +0 -14
  1025. package/dist/nodes/node/node-time.js.map +0 -1
  1026. package/dist/nodes/node/node-walk.d.ts +0 -46
  1027. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  1028. package/dist/nodes/node/node-walk.js +0 -74
  1029. package/dist/nodes/node/node-walk.js.map +0 -1
  1030. package/dist/nodes/node/node.d.ts +0 -445
  1031. package/dist/nodes/node/node.d.ts.map +0 -1
  1032. package/dist/nodes/node/node.js +0 -745
  1033. package/dist/nodes/node/node.js.map +0 -1
  1034. package/dist/nodes/node/text-defaults.d.ts +0 -32
  1035. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  1036. package/dist/nodes/node/text-defaults.js +0 -37
  1037. package/dist/nodes/node/text-defaults.js.map +0 -1
  1038. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  1039. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  1040. package/dist/nodes/root/canvas2d-node.js +0 -264
  1041. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  1042. package/dist/nodes/root/provider-node.d.ts +0 -47
  1043. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  1044. package/dist/nodes/root/provider-node.js +0 -63
  1045. package/dist/nodes/root/provider-node.js.map +0 -1
  1046. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  1047. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  1048. package/dist/nodes/root/theme-provider-node.js +0 -43
  1049. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  1050. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  1051. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  1052. package/dist/nodes/text/default-text-style-node.js +0 -146
  1053. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  1054. package/dist/nodes/text/number-format.d.ts +0 -66
  1055. package/dist/nodes/text/number-format.d.ts.map +0 -1
  1056. package/dist/nodes/text/number-format.js +0 -227
  1057. package/dist/nodes/text/number-format.js.map +0 -1
  1058. package/dist/nodes/text/number-node.d.ts +0 -94
  1059. package/dist/nodes/text/number-node.d.ts.map +0 -1
  1060. package/dist/nodes/text/number-node.js +0 -86
  1061. package/dist/nodes/text/number-node.js.map +0 -1
  1062. package/dist/nodes/text/number-pattern.d.ts +0 -51
  1063. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  1064. package/dist/nodes/text/number-pattern.js +0 -77
  1065. package/dist/nodes/text/number-pattern.js.map +0 -1
  1066. package/dist/nodes/text/richtext-node.d.ts +0 -68
  1067. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  1068. package/dist/nodes/text/richtext-node.js +0 -78
  1069. package/dist/nodes/text/richtext-node.js.map +0 -1
  1070. package/dist/nodes/text/text-base.d.ts +0 -118
  1071. package/dist/nodes/text/text-base.d.ts.map +0 -1
  1072. package/dist/nodes/text/text-base.js +0 -153
  1073. package/dist/nodes/text/text-base.js.map +0 -1
  1074. package/dist/nodes/text/text-layout.d.ts +0 -87
  1075. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  1076. package/dist/nodes/text/text-layout.js +0 -368
  1077. package/dist/nodes/text/text-layout.js.map +0 -1
  1078. package/dist/nodes/text/text-node.d.ts +0 -84
  1079. package/dist/nodes/text/text-node.d.ts.map +0 -1
  1080. package/dist/nodes/text/text-node.js +0 -188
  1081. package/dist/nodes/text/text-node.js.map +0 -1
  1082. package/dist/nodes/text/text-selection.d.ts +0 -125
  1083. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  1084. package/dist/nodes/text/text-selection.js +0 -209
  1085. package/dist/nodes/text/text-selection.js.map +0 -1
  1086. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  1087. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  1088. package/dist/nodes/three/camera-nodes.js +0 -112
  1089. package/dist/nodes/three/camera-nodes.js.map +0 -1
  1090. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  1091. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  1092. package/dist/nodes/three/canvas3d-node.js +0 -486
  1093. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  1094. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  1095. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  1096. package/dist/nodes/three/drawable-nodes.js +0 -284
  1097. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  1098. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  1099. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  1100. package/dist/nodes/three/environment-nodes.js +0 -134
  1101. package/dist/nodes/three/environment-nodes.js.map +0 -1
  1102. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  1103. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  1104. package/dist/nodes/three/geometry-nodes.js +0 -322
  1105. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  1106. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  1107. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  1108. package/dist/nodes/three/grid-geometry3d.js +0 -114
  1109. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  1110. package/dist/nodes/three/group3d.d.ts +0 -23
  1111. package/dist/nodes/three/group3d.d.ts.map +0 -1
  1112. package/dist/nodes/three/group3d.js +0 -21
  1113. package/dist/nodes/three/group3d.js.map +0 -1
  1114. package/dist/nodes/three/light-nodes.d.ts +0 -120
  1115. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  1116. package/dist/nodes/three/light-nodes.js +0 -173
  1117. package/dist/nodes/three/light-nodes.js.map +0 -1
  1118. package/dist/nodes/three/mesh3d.d.ts +0 -117
  1119. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  1120. package/dist/nodes/three/mesh3d.js +0 -147
  1121. package/dist/nodes/three/mesh3d.js.map +0 -1
  1122. package/dist/nodes/three/node3d.d.ts +0 -230
  1123. package/dist/nodes/three/node3d.d.ts.map +0 -1
  1124. package/dist/nodes/three/node3d.js +0 -337
  1125. package/dist/nodes/three/node3d.js.map +0 -1
  1126. package/dist/render/descriptors/latex.d.ts +0 -6
  1127. package/dist/render/descriptors/latex.d.ts.map +0 -1
  1128. package/dist/render/descriptors/latex.js +0 -2
  1129. package/dist/render/descriptors/latex.js.map +0 -1
  1130. package/dist/tween/seekable.d.ts +0 -81
  1131. package/dist/tween/seekable.d.ts.map +0 -1
  1132. package/dist/tween/seekable.js +0 -137
  1133. package/dist/tween/seekable.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"doc-index.js","sourceRoot":"","sources":["../../src/document/doc-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,cAAc,EAAuB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EACH,gBAAgB,EAChB,QAAQ,EACR,YAAY,GAOf,MAAM,SAAS,CAAC;AAiEjB,MAAM,UAAU,aAAa,CAAC,GAAiB;IAC3C,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,OAAO,GAAmB,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAmB,CAA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AI,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YACjE,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACnC,IAAI,CAAC,KAAK;gBAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;YACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACZ,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBACvB,SAAS;YACb,CAAC;YACD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YACxD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAU,CAAC,CAAC,CAAC;YACpG,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;QACvH,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { clipDocument } from \"./audio\";\r\nimport { expressionRefs, type ExpressionRefs } from \"./expression/refs\";\r\nimport {\r\n documentDuration,\r\n nodeSpan,\r\n ROOT_NODE_ID,\r\n type ClipDocument,\r\n type CommandSpec,\r\n type NodeSpan,\r\n type VisualDocument,\r\n type TimedNodeSpec,\r\n type VariableSpec,\r\n} from \"./types\";\r\n\r\n/** Whether a node is in the tree at t=0, and if so whether it is mounted there. */\r\nexport type InitialKey = \"mounted\" | \"unmounted\" | \"absent\";\r\n\r\n/**\r\n * When compile baselines a node that is not present at t=0: at the first command\r\n * `at` inside its own span, mounted or not at that moment.\r\n */\r\nexport type CaptureKey = \"none\" | \"arrival-mounted\" | \"arrival-unmounted\";\r\n\r\n/** Structural faults an incremental update cannot reason about; any one means rebuild. */\r\nexport interface DocIndexIssues {\r\n /** A node, command or variable id claimed twice, or a node id a variable also claims. */\r\n duplicateIds: boolean;\r\n duplicateKeys: boolean;\r\n unresolvedParent: boolean;\r\n cycle: boolean;\r\n /** A row with id `\"\"` that is not an unparented `canvas2d`. */\r\n invalidRoot: boolean;\r\n unparsable: boolean;\r\n /** An expression naming a variable or node key the document does not declare. */\r\n unresolvedRefs: boolean;\r\n}\r\n\r\nexport interface DocIndex {\r\n /** Audio documents are indexed as the composition they lower to. */\r\n readonly doc: VisualDocument;\r\n /** Every node by id, the root under `\"\"` (synthesized when the document omits it). */\r\n readonly nodes: ReadonlyMap<string, TimedNodeSpec>;\r\n /** Nodes other than the root. */\r\n readonly nodeCount: number;\r\n readonly variables: ReadonlyMap<string, VariableSpec>;\r\n readonly commands: ReadonlyMap<string, CommandSpec>;\r\n /** Commands in timeline order: `at`, ties by array index. */\r\n readonly ordered: readonly CommandSpec[];\r\n /** Command ids per target in timeline order; the root's under `\"\"`. */\r\n readonly byTarget: ReadonlyMap<string, readonly string[]>;\r\n readonly keyed: ReadonlyMap<string, string>;\r\n /** Nodes whose props (or `set` args) read a variable, or a keyed node's prop. */\r\n readonly dependents: {\r\n byVar: ReadonlyMap<string, ReadonlySet<string>>;\r\n byKey: ReadonlyMap<string, ReadonlySet<string>>;\r\n };\r\n readonly duration: number;\r\n readonly issues: DocIndexIssues;\r\n\r\n /** Child ids in sibling order: `layerOrder`, ties by array index. */\r\n children(parentId: string): readonly string[];\r\n /** Every document descendant of `id`, not including it. */\r\n descendants(id: string): string[];\r\n ownSpan(id: string): NodeSpan | undefined;\r\n /** Own span intersected with every ancestor's — when the node is mounted. Half-open. */\r\n effSpan(id: string): NodeSpan | undefined;\r\n /** The id a command acts on: its `targetId`, or `\"\"` for the root. */\r\n targetOf(spec: CommandSpec): string;\r\n commandsAt(at: number): readonly CommandSpec[];\r\n /** References per top-level prop, from the row's props and every `set` targeting it. */\r\n bindings(id: string): ReadonlyMap<string, ExpressionRefs>;\r\n refs(id: string): ExpressionRefs;\r\n initialKey(id: string): InitialKey;\r\n captureKey(id: string): CaptureKey;\r\n captureTime(id: string): number | undefined;\r\n}\r\n\r\nexport function indexDocument(doc: ClipDocument): DocIndex {\r\n return new DocumentIndex(clipDocument(doc));\r\n}\r\n\r\nconst NO_REFS: ExpressionRefs = Object.freeze({ vars: [], keys: [], unparsable: 0 }) as ExpressionRefs;\r\nconst NO_BINDINGS: ReadonlyMap<string, ExpressionRefs> = new Map();\r\nconst EMPTY: readonly never[] = [];\r\n\r\nfunction contains(span: NodeSpan | undefined, t: number): boolean {\r\n return span !== undefined && t >= span.start && t < span.end;\r\n}\r\n\r\nclass DocumentIndex implements DocIndex {\r\n readonly nodes = new Map<string, TimedNodeSpec>();\r\n readonly nodeCount: number;\r\n readonly variables = new Map<string, VariableSpec>();\r\n readonly commands = new Map<string, CommandSpec>();\r\n readonly ordered: readonly CommandSpec[];\r\n readonly byTarget = new Map<string, string[]>();\r\n readonly keyed = new Map<string, string>();\r\n readonly dependents = { byVar: new Map<string, Set<string>>(), byKey: new Map<string, Set<string>>() };\r\n readonly duration: number;\r\n readonly issues: DocIndexIssues = {\r\n duplicateIds: false,\r\n duplicateKeys: false,\r\n unresolvedParent: false,\r\n cycle: false,\r\n invalidRoot: false,\r\n unparsable: false,\r\n unresolvedRefs: false,\r\n };\r\n\r\n constructor(readonly doc: VisualDocument) {\r\n this.duration = documentDuration(doc);\r\n const commandRows = doc.kind === \"composition\" ? doc.commands : [];\r\n\r\n this._indexNodes(doc.nodes);\r\n this.nodeCount = this.nodes.size - 1;\r\n for (const spec of doc.variables ?? []) {\r\n if (this.variables.has(spec.id) || this.nodes.has(spec.id)) this.issues.duplicateIds = true;\r\n this.variables.set(spec.id, spec);\r\n }\r\n\r\n this.ordered = commandRows\r\n .map((spec, index) => ({ spec, index }))\r\n .sort((a, b) => (a.spec.at - b.spec.at) || (a.index - b.index))\r\n .map((e) => e.spec);\r\n for (const spec of this.ordered) {\r\n if (this.commands.has(spec.id)) this.issues.duplicateIds = true;\r\n this.commands.set(spec.id, spec);\r\n const target = this.targetOf(spec);\r\n let list = this.byTarget.get(target);\r\n if (!list) this.byTarget.set(target, list = []);\r\n list.push(spec.id);\r\n let atList = this._byAt.get(spec.at);\r\n if (!atList) this._byAt.set(spec.at, atList = []);\r\n atList.push(spec);\r\n }\r\n this._ats = [...this._byAt.keys()];\r\n\r\n this._indexRefs(commandRows);\r\n }\r\n\r\n children(parentId: string): readonly string[] {\r\n return this._children.get(parentId) ?? EMPTY;\r\n }\r\n\r\n descendants(id: string): string[] {\r\n const out: string[] = [];\r\n const seen = new Set<string>([id]);\r\n const stack = [...this.children(id)].reverse();\r\n while (stack.length > 0) {\r\n const child = stack.pop()!;\r\n if (seen.has(child)) continue;\r\n seen.add(child);\r\n out.push(child);\r\n const grand = this.children(child);\r\n for (let i = grand.length - 1; i >= 0; i--) stack.push(grand[i]);\r\n }\r\n return out;\r\n }\r\n\r\n ownSpan(id: string): NodeSpan | undefined {\r\n const spec = this.nodes.get(id);\r\n return spec ? nodeSpan(spec) : undefined;\r\n }\r\n\r\n effSpan(id: string): NodeSpan | undefined {\r\n const memo = this._eff.get(id);\r\n if (memo) return memo;\r\n if (!this.nodes.has(id)) return undefined;\r\n\r\n const chain: TimedNodeSpec[] = [];\r\n const seen = new Set<string>();\r\n let base: NodeSpan = { start: 0, end: Infinity };\r\n let cursor = this.nodes.get(id);\r\n while (cursor) {\r\n const known = this._eff.get(cursor.id);\r\n if (known) {\r\n base = known;\r\n break;\r\n }\r\n if (seen.has(cursor.id)) break;\r\n seen.add(cursor.id);\r\n chain.push(cursor);\r\n if (cursor.id === ROOT_NODE_ID || cursor.parentId === null) break;\r\n cursor = this.nodes.get(cursor.parentId);\r\n }\r\n for (let i = chain.length - 1; i >= 0; i--) {\r\n const own = nodeSpan(chain[i]);\r\n base = { start: Math.max(base.start, own.start), end: Math.min(base.end, own.end) };\r\n this._eff.set(chain[i].id, base);\r\n }\r\n return this._eff.get(id);\r\n }\r\n\r\n targetOf(spec: CommandSpec): string {\r\n return spec.targetId ?? ROOT_NODE_ID;\r\n }\r\n\r\n commandsAt(at: number): readonly CommandSpec[] {\r\n return this._byAt.get(at) ?? EMPTY;\r\n }\r\n\r\n bindings(id: string): ReadonlyMap<string, ExpressionRefs> {\r\n return this._bindings.get(id) ?? NO_BINDINGS;\r\n }\r\n\r\n refs(id: string): ExpressionRefs {\r\n return this._refs.get(id) ?? NO_REFS;\r\n }\r\n\r\n initialKey(id: string): InitialKey {\r\n if (!contains(this.ownSpan(id), 0)) return \"absent\";\r\n return contains(this.effSpan(id), 0) ? \"mounted\" : \"unmounted\";\r\n }\r\n\r\n captureKey(id: string): CaptureKey {\r\n const at = this.captureTime(id);\r\n if (at === undefined) return \"none\";\r\n return contains(this.effSpan(id), at) ? \"arrival-mounted\" : \"arrival-unmounted\";\r\n }\r\n\r\n captureTime(id: string): number | undefined {\r\n const own = this.ownSpan(id);\r\n if (!own || contains(own, 0)) return undefined;\r\n let lo = 0;\r\n let hi = this._ats.length;\r\n while (lo < hi) {\r\n const mid = (lo + hi) >> 1;\r\n if (this._ats[mid] < own.start) lo = mid + 1;\r\n else hi = mid;\r\n }\r\n const at = this._ats[lo];\r\n return at !== undefined && at < own.end ? at : undefined;\r\n }\r\n\r\n private readonly _children = new Map<string, string[]>();\r\n private readonly _eff = new Map<string, NodeSpan>();\r\n private readonly _byAt = new Map<number, CommandSpec[]>();\r\n /** Distinct command `at`s, ascending (inherited from {@link ordered}). */\r\n private _ats: number[] = [];\r\n private readonly _bindings = new Map<string, Map<string, ExpressionRefs>>();\r\n private readonly _refs = new Map<string, ExpressionRefs>();\r\n\r\n private _indexNodes(rows: readonly TimedNodeSpec[]): void {\r\n const siblings = new Map<string, Array<{ id: string; order: number; index: number }>>();\r\n rows.forEach((spec, index) => {\r\n if (this.nodes.has(spec.id)) this.issues.duplicateIds = true;\r\n this.nodes.set(spec.id, spec);\r\n if (spec.key) {\r\n if (this.keyed.has(spec.key)) this.issues.duplicateKeys = true;\r\n this.keyed.set(spec.key, spec.id);\r\n }\r\n if (spec.id === ROOT_NODE_ID) {\r\n if (spec.type !== \"canvas2d\" || spec.parentId !== null) this.issues.invalidRoot = true;\r\n return;\r\n }\r\n const parent = spec.parentId ?? ROOT_NODE_ID;\r\n let list = siblings.get(parent);\r\n if (!list) siblings.set(parent, list = []);\r\n list.push({ id: spec.id, order: spec.layerOrder, index });\r\n });\r\n if (!this.nodes.has(ROOT_NODE_ID)) {\r\n this.nodes.set(ROOT_NODE_ID, { id: ROOT_NODE_ID, type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} });\r\n }\r\n for (const [parent, list] of siblings) {\r\n list.sort((a, b) => (a.order - b.order) || (a.index - b.index));\r\n this._children.set(parent, list.map((e) => e.id));\r\n }\r\n\r\n const settled = new Set<string>([ROOT_NODE_ID]);\r\n for (const spec of this.nodes.values()) {\r\n if (spec.parentId !== null && !this.nodes.has(spec.parentId)) this.issues.unresolvedParent = true;\r\n const seen = new Set<string>();\r\n let cursor: TimedNodeSpec | undefined = spec;\r\n while (cursor && !settled.has(cursor.id)) {\r\n if (seen.has(cursor.id)) {\r\n this.issues.cycle = true;\r\n break;\r\n }\r\n seen.add(cursor.id);\r\n cursor = cursor.parentId === null ? undefined : this.nodes.get(cursor.parentId);\r\n }\r\n for (const id of seen) settled.add(id);\r\n }\r\n }\r\n\r\n private _indexRefs(commandRows: readonly CommandSpec[]): void {\r\n for (const spec of this.nodes.values()) this._bind(spec.id, spec.props);\r\n for (const command of commandRows) {\r\n if (command.type === \"set\") {\r\n const target = this.targetOf(command);\r\n if (this.nodes.has(target)) {\r\n this._bind(target, command.args);\r\n continue;\r\n }\r\n }\r\n if (expressionRefs(command.args).unparsable > 0) this.issues.unparsable = true;\r\n }\r\n\r\n for (const [id, props] of this._bindings) {\r\n const vars = new Set<string>();\r\n const keys = new Map<string, [string, string]>();\r\n let unparsable = 0;\r\n for (const refs of props.values()) {\r\n for (const v of refs.vars) vars.add(v);\r\n for (const pair of refs.keys) keys.set(`${pair[0]}.${pair[1]}`, pair);\r\n unparsable += refs.unparsable;\r\n }\r\n this._refs.set(id, { vars: [...vars], keys: [...keys.values()], unparsable });\r\n\r\n for (const v of vars) {\r\n if (!this.variables.has(v)) this.issues.unresolvedRefs = true;\r\n let readers = this.dependents.byVar.get(v);\r\n if (!readers) this.dependents.byVar.set(v, readers = new Set());\r\n readers.add(id);\r\n }\r\n for (const [key] of keys.values()) {\r\n if (!this.keyed.has(key)) this.issues.unresolvedRefs = true;\r\n let readers = this.dependents.byKey.get(key);\r\n if (!readers) this.dependents.byKey.set(key, readers = new Set());\r\n readers.add(id);\r\n }\r\n }\r\n }\r\n\r\n /** Merge one props bag's references into a node's per-prop table. */\r\n private _bind(id: string, props: Record<string, unknown> | undefined): void {\r\n if (!props) return;\r\n for (const prop of Object.keys(props)) {\r\n const found = expressionRefs(props[prop]);\r\n if (found.unparsable > 0) this.issues.unparsable = true;\r\n if (found.vars.length === 0 && found.keys.length === 0) continue;\r\n let table = this._bindings.get(id);\r\n if (!table) this._bindings.set(id, table = new Map());\r\n const existing = table.get(prop);\r\n if (!existing) {\r\n table.set(prop, found);\r\n continue;\r\n }\r\n const vars = new Set([...existing.vars, ...found.vars]);\r\n const keys = new Map([...existing.keys, ...found.keys].map((p) => [`${p[0]}.${p[1]}`, p] as const));\r\n table.set(prop, { vars: [...vars], keys: [...keys.values()], unparsable: existing.unparsable + found.unparsable });\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"doc-index.js","sourceRoot":"","sources":["../../src/document/doc-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,cAAc,EAAuB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EACH,gBAAgB,EAChB,QAAQ,EACR,YAAY,GAOf,MAAM,SAAS,CAAC;AAiEjB,MAAM,UAAU,aAAa,CAAC,GAAiB;IAC3C,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,OAAO,GAAmB,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAmB,CAAC;AACvG,MAAM,WAAW,GAAwC,IAAI,GAAG,EAAE,CAAC;AACnE,MAAM,KAAK,GAAqB,EAAE,CAAC;AAEnC,SAAS,QAAQ,CAAC,IAA0B,EAAE,CAAS;IACnD,OAAO,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;AACjE,CAAC;AAED,MAAM,aAAa;IAoBM;IAnBZ,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;IACzC,SAAS,CAAS;IAClB,SAAS,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC5C,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC1C,OAAO,CAAyB;IAChC,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;IACvC,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAClC,UAAU,GAAG,EAAE,KAAK,EAAE,IAAI,GAAG,EAAuB,EAAE,KAAK,EAAE,IAAI,GAAG,EAA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IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAU,CAAC,CAAC,CAAC;YACpG,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;QACvH,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { clipDocument } from \"./audio\";\nimport { expressionRefs, type ExpressionRefs } from \"./expression/refs\";\nimport {\n documentDuration,\n nodeSpan,\n ROOT_NODE_ID,\n type ClipDocument,\n type CommandSpec,\n type NodeSpan,\n type VisualDocument,\n type TimedNodeSpec,\n type VariableSpec,\n} from \"./types\";\n\n/** Whether a node is in the tree at t=0, and if so whether it is mounted there. */\nexport type InitialKey = \"mounted\" | \"unmounted\" | \"absent\";\n\n/**\n * When compile baselines a node that is not present at t=0: at the first command\n * `at` inside its own span, mounted or not at that moment.\n */\nexport type CaptureKey = \"none\" | \"arrival-mounted\" | \"arrival-unmounted\";\n\n/** Structural faults an incremental update cannot reason about; any one means rebuild. */\nexport interface DocIndexIssues {\n /** A node, command or variable id claimed twice, or a node id a variable also claims. */\n duplicateIds: boolean;\n duplicateKeys: boolean;\n unresolvedParent: boolean;\n cycle: boolean;\n /** A row with id `\"\"` that is not an unparented `canvas2d`. */\n invalidRoot: boolean;\n unparsable: boolean;\n /** An expression naming a variable or node key the document does not declare. */\n unresolvedRefs: boolean;\n}\n\nexport interface DocIndex {\n /** Audio documents are indexed as the composition they lower to. */\n readonly doc: VisualDocument;\n /** Every node by id, the root under `\"\"` (synthesized when the document omits it). */\n readonly nodes: ReadonlyMap<string, TimedNodeSpec>;\n /** Nodes other than the root. */\n readonly nodeCount: number;\n readonly variables: ReadonlyMap<string, VariableSpec>;\n readonly commands: ReadonlyMap<string, CommandSpec>;\n /** Commands in timeline order: `at`, ties by array index. */\n readonly ordered: readonly CommandSpec[];\n /** Command ids per target in timeline order; the root's under `\"\"`. */\n readonly byTarget: ReadonlyMap<string, readonly string[]>;\n readonly keyed: ReadonlyMap<string, string>;\n /** Nodes whose props (or `set` args) read a variable, or a keyed node's prop. */\n readonly dependents: {\n byVar: ReadonlyMap<string, ReadonlySet<string>>;\n byKey: ReadonlyMap<string, ReadonlySet<string>>;\n };\n readonly duration: number;\n readonly issues: DocIndexIssues;\n\n /** Child ids in sibling order: `layerOrder`, ties by array index. */\n children(parentId: string): readonly string[];\n /** Every document descendant of `id`, not including it. */\n descendants(id: string): string[];\n ownSpan(id: string): NodeSpan | undefined;\n /** Own span intersected with every ancestor's — when the node is mounted. Half-open. */\n effSpan(id: string): NodeSpan | undefined;\n /** The id a command acts on: its `targetId`, or `\"\"` for the root. */\n targetOf(spec: CommandSpec): string;\n commandsAt(at: number): readonly CommandSpec[];\n /** References per top-level prop, from the row's props and every `set` targeting it. */\n bindings(id: string): ReadonlyMap<string, ExpressionRefs>;\n refs(id: string): ExpressionRefs;\n initialKey(id: string): InitialKey;\n captureKey(id: string): CaptureKey;\n captureTime(id: string): number | undefined;\n}\n\nexport function indexDocument(doc: ClipDocument): DocIndex {\n return new DocumentIndex(clipDocument(doc));\n}\n\nconst NO_REFS: ExpressionRefs = Object.freeze({ vars: [], keys: [], unparsable: 0 }) as ExpressionRefs;\nconst NO_BINDINGS: ReadonlyMap<string, ExpressionRefs> = new Map();\nconst EMPTY: readonly never[] = [];\n\nfunction contains(span: NodeSpan | undefined, t: number): boolean {\n return span !== undefined && t >= span.start && t < span.end;\n}\n\nclass DocumentIndex implements DocIndex {\n readonly nodes = new Map<string, TimedNodeSpec>();\n readonly nodeCount: number;\n readonly variables = new Map<string, VariableSpec>();\n readonly commands = new Map<string, CommandSpec>();\n readonly ordered: readonly CommandSpec[];\n readonly byTarget = new Map<string, string[]>();\n readonly keyed = new Map<string, string>();\n readonly dependents = { byVar: new Map<string, Set<string>>(), byKey: new Map<string, Set<string>>() };\n readonly duration: number;\n readonly issues: DocIndexIssues = {\n duplicateIds: false,\n duplicateKeys: false,\n unresolvedParent: false,\n cycle: false,\n invalidRoot: false,\n unparsable: false,\n unresolvedRefs: false,\n };\n\n constructor(readonly doc: VisualDocument) {\n this.duration = documentDuration(doc);\n const commandRows = doc.kind === \"composition\" ? doc.commands : [];\n\n this._indexNodes(doc.nodes);\n this.nodeCount = this.nodes.size - 1;\n for (const spec of doc.variables ?? []) {\n if (this.variables.has(spec.id) || this.nodes.has(spec.id)) this.issues.duplicateIds = true;\n this.variables.set(spec.id, spec);\n }\n\n this.ordered = commandRows\n .map((spec, index) => ({ spec, index }))\n .sort((a, b) => (a.spec.at - b.spec.at) || (a.index - b.index))\n .map((e) => e.spec);\n for (const spec of this.ordered) {\n if (this.commands.has(spec.id)) this.issues.duplicateIds = true;\n this.commands.set(spec.id, spec);\n const target = this.targetOf(spec);\n let list = this.byTarget.get(target);\n if (!list) this.byTarget.set(target, list = []);\n list.push(spec.id);\n let atList = this._byAt.get(spec.at);\n if (!atList) this._byAt.set(spec.at, atList = []);\n atList.push(spec);\n }\n this._ats = [...this._byAt.keys()];\n\n this._indexRefs(commandRows);\n }\n\n children(parentId: string): readonly string[] {\n return this._children.get(parentId) ?? EMPTY;\n }\n\n descendants(id: string): string[] {\n const out: string[] = [];\n const seen = new Set<string>([id]);\n const stack = [...this.children(id)].reverse();\n while (stack.length > 0) {\n const child = stack.pop()!;\n if (seen.has(child)) continue;\n seen.add(child);\n out.push(child);\n const grand = this.children(child);\n for (let i = grand.length - 1; i >= 0; i--) stack.push(grand[i]);\n }\n return out;\n }\n\n ownSpan(id: string): NodeSpan | undefined {\n const spec = this.nodes.get(id);\n return spec ? nodeSpan(spec) : undefined;\n }\n\n effSpan(id: string): NodeSpan | undefined {\n const memo = this._eff.get(id);\n if (memo) return memo;\n if (!this.nodes.has(id)) return undefined;\n\n const chain: TimedNodeSpec[] = [];\n const seen = new Set<string>();\n let base: NodeSpan = { start: 0, end: Infinity };\n let cursor = this.nodes.get(id);\n while (cursor) {\n const known = this._eff.get(cursor.id);\n if (known) {\n base = known;\n break;\n }\n if (seen.has(cursor.id)) break;\n seen.add(cursor.id);\n chain.push(cursor);\n if (cursor.id === ROOT_NODE_ID || cursor.parentId === null) break;\n cursor = this.nodes.get(cursor.parentId);\n }\n for (let i = chain.length - 1; i >= 0; i--) {\n const own = nodeSpan(chain[i]);\n base = { start: Math.max(base.start, own.start), end: Math.min(base.end, own.end) };\n this._eff.set(chain[i].id, base);\n }\n return this._eff.get(id);\n }\n\n targetOf(spec: CommandSpec): string {\n return spec.targetId ?? ROOT_NODE_ID;\n }\n\n commandsAt(at: number): readonly CommandSpec[] {\n return this._byAt.get(at) ?? EMPTY;\n }\n\n bindings(id: string): ReadonlyMap<string, ExpressionRefs> {\n return this._bindings.get(id) ?? NO_BINDINGS;\n }\n\n refs(id: string): ExpressionRefs {\n return this._refs.get(id) ?? NO_REFS;\n }\n\n initialKey(id: string): InitialKey {\n if (!contains(this.ownSpan(id), 0)) return \"absent\";\n return contains(this.effSpan(id), 0) ? \"mounted\" : \"unmounted\";\n }\n\n captureKey(id: string): CaptureKey {\n const at = this.captureTime(id);\n if (at === undefined) return \"none\";\n return contains(this.effSpan(id), at) ? \"arrival-mounted\" : \"arrival-unmounted\";\n }\n\n captureTime(id: string): number | undefined {\n const own = this.ownSpan(id);\n if (!own || contains(own, 0)) return undefined;\n let lo = 0;\n let hi = this._ats.length;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (this._ats[mid] < own.start) lo = mid + 1;\n else hi = mid;\n }\n const at = this._ats[lo];\n return at !== undefined && at < own.end ? at : undefined;\n }\n\n private readonly _children = new Map<string, string[]>();\n private readonly _eff = new Map<string, NodeSpan>();\n private readonly _byAt = new Map<number, CommandSpec[]>();\n /** Distinct command `at`s, ascending (inherited from {@link ordered}). */\n private _ats: number[] = [];\n private readonly _bindings = new Map<string, Map<string, ExpressionRefs>>();\n private readonly _refs = new Map<string, ExpressionRefs>();\n\n private _indexNodes(rows: readonly TimedNodeSpec[]): void {\n const siblings = new Map<string, Array<{ id: string; order: number; index: number }>>();\n rows.forEach((spec, index) => {\n if (this.nodes.has(spec.id)) this.issues.duplicateIds = true;\n this.nodes.set(spec.id, spec);\n if (spec.key) {\n if (this.keyed.has(spec.key)) this.issues.duplicateKeys = true;\n this.keyed.set(spec.key, spec.id);\n }\n if (spec.id === ROOT_NODE_ID) {\n if (spec.type !== \"canvas2d\" || spec.parentId !== null) this.issues.invalidRoot = true;\n return;\n }\n const parent = spec.parentId ?? ROOT_NODE_ID;\n let list = siblings.get(parent);\n if (!list) siblings.set(parent, list = []);\n list.push({ id: spec.id, order: spec.layerOrder, index });\n });\n if (!this.nodes.has(ROOT_NODE_ID)) {\n this.nodes.set(ROOT_NODE_ID, { id: ROOT_NODE_ID, type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} });\n }\n for (const [parent, list] of siblings) {\n list.sort((a, b) => (a.order - b.order) || (a.index - b.index));\n this._children.set(parent, list.map((e) => e.id));\n }\n\n const settled = new Set<string>([ROOT_NODE_ID]);\n for (const spec of this.nodes.values()) {\n if (spec.parentId !== null && !this.nodes.has(spec.parentId)) this.issues.unresolvedParent = true;\n const seen = new Set<string>();\n let cursor: TimedNodeSpec | undefined = spec;\n while (cursor && !settled.has(cursor.id)) {\n if (seen.has(cursor.id)) {\n this.issues.cycle = true;\n break;\n }\n seen.add(cursor.id);\n cursor = cursor.parentId === null ? undefined : this.nodes.get(cursor.parentId);\n }\n for (const id of seen) settled.add(id);\n }\n }\n\n private _indexRefs(commandRows: readonly CommandSpec[]): void {\n for (const spec of this.nodes.values()) this._bind(spec.id, spec.props);\n for (const command of commandRows) {\n if (command.type === \"set\") {\n const target = this.targetOf(command);\n if (this.nodes.has(target)) {\n this._bind(target, command.args);\n continue;\n }\n }\n if (expressionRefs(command.args).unparsable > 0) this.issues.unparsable = true;\n }\n\n for (const [id, props] of this._bindings) {\n const vars = new Set<string>();\n const keys = new Map<string, [string, string]>();\n let unparsable = 0;\n for (const refs of props.values()) {\n for (const v of refs.vars) vars.add(v);\n for (const pair of refs.keys) keys.set(`${pair[0]}.${pair[1]}`, pair);\n unparsable += refs.unparsable;\n }\n this._refs.set(id, { vars: [...vars], keys: [...keys.values()], unparsable });\n\n for (const v of vars) {\n if (!this.variables.has(v)) this.issues.unresolvedRefs = true;\n let readers = this.dependents.byVar.get(v);\n if (!readers) this.dependents.byVar.set(v, readers = new Set());\n readers.add(id);\n }\n for (const [key] of keys.values()) {\n if (!this.keyed.has(key)) this.issues.unresolvedRefs = true;\n let readers = this.dependents.byKey.get(key);\n if (!readers) this.dependents.byKey.set(key, readers = new Set());\n readers.add(id);\n }\n }\n }\n\n /** Merge one props bag's references into a node's per-prop table. */\n private _bind(id: string, props: Record<string, unknown> | undefined): void {\n if (!props) return;\n for (const prop of Object.keys(props)) {\n const found = expressionRefs(props[prop]);\n if (found.unparsable > 0) this.issues.unparsable = true;\n if (found.vars.length === 0 && found.keys.length === 0) continue;\n let table = this._bindings.get(id);\n if (!table) this._bindings.set(id, table = new Map());\n const existing = table.get(prop);\n if (!existing) {\n table.set(prop, found);\n continue;\n }\n const vars = new Set([...existing.vars, ...found.vars]);\n const keys = new Map([...existing.keys, ...found.keys].map((p) => [`${p[0]}.${p[1]}`, p] as const));\n table.set(prop, { vars: [...vars], keys: [...keys.values()], unparsable: existing.unparsable + found.unparsable });\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/document/expression/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,k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AAE,KAAK,EAAE,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACjC,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7C,CAAC;QACL,CAAC;QACD,MAAM,IAAI,eAAe,CAAC,6BAA6B,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACtF,CAAC,CAAC;IAEF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["/**\r\n * The document's back end: an {@link ExpressionNode} tree into the binding a\r\n * `PropSlot` takes.\r\n *\r\n * The tree is compiled into closures once rather than walked per read — the\r\n * difference matters on a scene where a hundred props read the same variable\r\n * every frame. A dialect with a different target compiles the same AST its own\r\n * way; `@motionscript/math` emits `(x, y) => number` from this one, and shares\r\n * the front end rather than this file.\r\n */\r\nimport { DOCUMENT_FUNCTIONS } from \"./parse\";\r\nimport { ExpressionError } from \"./types\";\r\nimport type { ExpressionNode, ParsedExpression, VariableResolver } from \"./types\";\r\n\r\n/**\r\n * Coerce a variable's value into the number arithmetic needs.\r\n *\r\n * A number is itself, a boolean is `1` or `0`, and a string is what `Number`\r\n * reads from it (`\"5\"` is 5, `\"0x10\"` is 16) unless it is empty after trimming,\r\n * which is `NaN`. Anything else — `null`, `undefined`, an object — is `NaN`\r\n * too. That is the intent: a `width` of `NaN` is visible in the first frame,\r\n * where a silent `0` looks like a deliberate collapse and gets debugged as a\r\n * layout problem, and `Number(\"\")` is exactly that silent zero.\r\n */\r\nfunction toNumber(value: unknown): number {\r\n if (typeof value === \"number\") return value;\r\n if (typeof value === \"boolean\") return value ? 1 : 0;\r\n if (typeof value === \"string\") return value.trim() === \"\" ? NaN : Number(value);\r\n return NaN;\r\n}\r\n\r\n/**\r\n * `path` is where in the props bag the formula was written, so a reference to\r\n * something undeclared names the prop and not just the formula.\r\n */\r\nexport function compile(parsed: ParsedExpression, resolve: VariableResolver, path?: string): () => unknown {\r\n const readOf = (name: string): (() => unknown) => {\r\n const read = resolve(name);\r\n if (!read) {\r\n throw new ExpressionError(\r\n `\"${name}\" resolves to nothing in this document — a reference names a variable ` +\r\n `(declared with a \"variable\" command), a constant (a \\`constants\\` row), or another ` +\r\n `node's prop as \"[key.prop]\" (\\`key\\` on that node's row)`,\r\n parsed.source, -1, path,\r\n );\r\n }\r\n return read;\r\n };\r\n\r\n // A lone `[x]` hands the value over untouched: see `passthrough`.\r\n if (parsed.passthrough) return readOf((parsed.root as { name: string }).name);\r\n\r\n const emit = (node: ExpressionNode): (() => number) => {\r\n switch (node.kind) {\r\n case \"const\": {\r\n const { value } = node;\r\n return () => value;\r\n }\r\n case \"ref\": {\r\n const read = readOf(node.name);\r\n return () => toNumber(read());\r\n }\r\n case \"unary\": {\r\n const operand = emit(node.operand);\r\n return () => -operand();\r\n }\r\n case \"binary\": {\r\n const left = emit(node.left);\r\n const right = emit(node.right);\r\n switch (node.op) {\r\n case \"+\": return () => left() + right();\r\n case \"-\": return () => left() - right();\r\n case \"*\": return () => left() * right();\r\n case \"/\": return () => left() / right();\r\n case \"%\": return () => left() % right();\r\n case \"^\": return () => left() ** right();\r\n }\r\n break;\r\n }\r\n case \"call\": {\r\n const { apply } = DOCUMENT_FUNCTIONS[node.name];\r\n const args = node.args.map(emit);\r\n return () => apply(args.map((a) => a()));\r\n }\r\n }\r\n throw new ExpressionError(\"unsupported expression node\", parsed.source, -1, path);\r\n };\r\n\r\n return emit(parsed.root);\r\n}\r\n"]}
1
+ {"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/document/expression/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM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AAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACjC,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7C,CAAC;QACL,CAAC;QACD,MAAM,IAAI,eAAe,CAAC,6BAA6B,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACtF,CAAC,CAAC;IAEF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["/**\n * The document's back end: an {@link ExpressionNode} tree into the binding a\n * `PropSlot` takes.\n *\n * The tree is compiled into closures once rather than walked per read — the\n * difference matters on a scene where a hundred props read the same variable\n * every frame. A dialect with a different target compiles the same AST its own\n * way; `@motionscript/math` emits `(x, y) => number` from this one, and shares\n * the front end rather than this file.\n */\nimport { DOCUMENT_FUNCTIONS } from \"./parse\";\nimport { ExpressionError } from \"./types\";\nimport type { ExpressionNode, ParsedExpression, VariableResolver } from \"./types\";\n\n/**\n * Coerce a variable's value into the number arithmetic needs.\n *\n * A number is itself, a boolean is `1` or `0`, and a string is what `Number`\n * reads from it (`\"5\"` is 5, `\"0x10\"` is 16) unless it is empty after trimming,\n * which is `NaN`. Anything else — `null`, `undefined`, an object — is `NaN`\n * too. That is the intent: a `width` of `NaN` is visible in the first frame,\n * where a silent `0` looks like a deliberate collapse and gets debugged as a\n * layout problem, and `Number(\"\")` is exactly that silent zero.\n */\nfunction toNumber(value: unknown): number {\n if (typeof value === \"number\") return value;\n if (typeof value === \"boolean\") return value ? 1 : 0;\n if (typeof value === \"string\") return value.trim() === \"\" ? NaN : Number(value);\n return NaN;\n}\n\n/**\n * `path` is where in the props bag the formula was written, so a reference to\n * something undeclared names the prop and not just the formula.\n */\nexport function compile(parsed: ParsedExpression, resolve: VariableResolver, path?: string): () => unknown {\n const readOf = (name: string): (() => unknown) => {\n const read = resolve(name);\n if (!read) {\n throw new ExpressionError(\n `\"${name}\" resolves to nothing in this document — a reference names a variable ` +\n `(declared with a \"variable\" command), a constant (a \\`constants\\` row), or another ` +\n `node's prop as \"[key.prop]\" (\\`key\\` on that node's row)`,\n parsed.source, -1, path,\n );\n }\n return read;\n };\n\n // A lone `[x]` hands the value over untouched: see `passthrough`.\n if (parsed.passthrough) return readOf((parsed.root as { name: string }).name);\n\n const emit = (node: ExpressionNode): (() => number) => {\n switch (node.kind) {\n case \"const\": {\n const { value } = node;\n return () => value;\n }\n case \"ref\": {\n const read = readOf(node.name);\n return () => toNumber(read());\n }\n case \"unary\": {\n const operand = emit(node.operand);\n return () => -operand();\n }\n case \"binary\": {\n const left = emit(node.left);\n const right = emit(node.right);\n switch (node.op) {\n case \"+\": return () => left() + right();\n case \"-\": return () => left() - right();\n case \"*\": return () => left() * right();\n case \"/\": return () => left() / right();\n case \"%\": return () => left() % right();\n case \"^\": return () => left() ** right();\n }\n break;\n }\n case \"call\": {\n const { apply } = DOCUMENT_FUNCTIONS[node.name];\n const args = node.args.map(emit);\n return () => apply(args.map((a) => a()));\n }\n }\n throw new ExpressionError(\"unsupported expression node\", parsed.source, -1, path);\n };\n\n return emit(parsed.root);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/document/expression/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC","sourcesContent":["/**\r\n * **Expressions**: a prop that follows a variable instead of holding a value.\r\n *\r\n * A document is data, so it cannot carry a function — which is exactly what a\r\n * derived prop is (`packages/core/src/props/`: a `property`'s slot either holds\r\n * a value or is *bound* to a thunk). An expression is that function written as\r\n * a string a document can store:\r\n *\r\n * ```json\r\n * { \"id\": \"card\", \"type\": \"rect\", \"props\": { \"x\": \"=4[g]+3\", \"opacity\": \"=[g]\" } }\r\n * ```\r\n *\r\n * A leading `=` marks the string as a formula rather than a value, and `[name]`\r\n * reads the `VariableSpec` with that id. What it compiles to is an ordinary\r\n * prop binding, so nothing underneath it changes: a command writes the\r\n * variable's slot, and a bound prop recomputes on every read, so each of them\r\n * sees the new value without anything being invalidated. That is what makes one\r\n * variable able to drive twenty nodes without twenty copies of the same tween.\r\n *\r\n * Three rules the syntax turns on, each of which removes a question a reader\r\n * would otherwise have to ask:\r\n *\r\n * - **`=` marks the whole string, not part of it.** There is no `${…}` hole in\r\n * surrounding text. A prop is either a value or a formula, so nothing has to\r\n * define what a half-interpolated `cornerRadius` means. A literal string that\r\n * really does start with `=` is written `\"==\"`.\r\n * - **A lone `[x]` passes the value through, unconverted.** `\"=[c]\"` on a `fill`\r\n * yields whatever `c` holds — a colour string, a `Vector2`, an object — while\r\n * anything with arithmetic in it is numeric. Without that rule a variable\r\n * could only ever be a number, and driving four nodes' `fill` from one place\r\n * is half the reason variables exist.\r\n * - **Angles are degrees**, matching every angle in the library (`rotation`,\r\n * `startAngle`, 3D Euler rotations). `sin(30)` is `0.5`.\r\n *\r\n * Expressions **bind**; they are not tween destinations. See\r\n * `document/timeline.ts` for where that is enforced and why.\r\n *\r\n * One value — {@link expressionOps} — carries every operation: recognition,\r\n * parsing, compiling, the authored-value walk, and the name lists a host's\r\n * completion needs. The free functions this used to export\r\n * (`isExpressionSource`, `unescapeExpression`, `parseExpression`,\r\n * `tryParseExpression`, `compileExpression`, `compileValue`, `compileProps`,\r\n * `collectExpressions`, `expressionFunctionNames`, `expressionConstantNames`)\r\n * are those methods now.\r\n */\r\nexport { expressionOps } from \"./ops\";\r\nexport { ExpressionError } from \"./types\";\r\nexport type * from \"./types\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/document/expression/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC","sourcesContent":["/**\n * **Expressions**: a prop that follows a variable instead of holding a value.\n *\n * A document is data, so it cannot carry a function — which is exactly what a\n * derived prop is (`packages/core/src/props/`: a `property`'s slot either holds\n * a value or is *bound* to a thunk). An expression is that function written as\n * a string a document can store:\n *\n * ```json\n * { \"id\": \"card\", \"type\": \"rect\", \"props\": { \"x\": \"=4[g]+3\", \"opacity\": \"=[g]\" } }\n * ```\n *\n * A leading `=` marks the string as a formula rather than a value, and `[name]`\n * reads the `VariableSpec` with that id. What it compiles to is an ordinary\n * prop binding, so nothing underneath it changes: a command writes the\n * variable's slot, and a bound prop recomputes on every read, so each of them\n * sees the new value without anything being invalidated. That is what makes one\n * variable able to drive twenty nodes without twenty copies of the same tween.\n *\n * Three rules the syntax turns on, each of which removes a question a reader\n * would otherwise have to ask:\n *\n * - **`=` marks the whole string, not part of it.** There is no `${…}` hole in\n * surrounding text. A prop is either a value or a formula, so nothing has to\n * define what a half-interpolated `cornerRadius` means. A literal string that\n * really does start with `=` is written `\"==\"`.\n * - **A lone `[x]` passes the value through, unconverted.** `\"=[c]\"` on a `fill`\n * yields whatever `c` holds — a colour string, a `Vector2`, an object — while\n * anything with arithmetic in it is numeric. Without that rule a variable\n * could only ever be a number, and driving four nodes' `fill` from one place\n * is half the reason variables exist.\n * - **Angles are degrees**, matching every angle in the library (`rotation`,\n * `startAngle`, 3D Euler rotations). `sin(30)` is `0.5`.\n *\n * Expressions **bind**; they are not tween destinations. See\n * `document/timeline.ts` for where that is enforced and why.\n *\n * One value — {@link expressionOps} — carries every operation: recognition,\n * parsing, compiling, the authored-value walk, and the name lists a host's\n * completion needs. The free functions this used to export\n * (`isExpressionSource`, `unescapeExpression`, `parseExpression`,\n * `tryParseExpression`, `compileExpression`, `compileValue`, `compileProps`,\n * `collectExpressions`, `expressionFunctionNames`, `expressionConstantNames`)\n * are those methods now.\n */\nexport { expressionOps } from \"./ops\";\nexport { ExpressionError } from \"./types\";\nexport type * from \"./types\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../src/document/expression/ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAMlF,wEAAwE;AACxE,SAAS,WAAW,CAAC,MAAc,EAAE,UAA6B,gBAAgB;IAC9E,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC;AAoCD,MAAM,CAAC,MAAM,aAAa,GAAkB;IACxC,QAAQ;IACR,QAAQ;IAER,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QAC1B,IAAI,CAAC;YACD,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;QACxD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,EAAE,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,CAAC;IACL,CAAC;IAED,OAAO;IACP,IAAI;IACJ,SAAS;IAET,OAAO;IACP,UAAU;IACV,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,SAAS,CAAC;IACvD,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,SAAS,CAAC;IACvD,OAAO,EAAE,gBAAgB;CAC5B,CAAC","sourcesContent":["/**\r\n * Every expression operation, on one object.\r\n *\r\n * The same shape `pathOps` has, for the same reason — one value to import, and a\r\n * call site one grep from its implementation. Unlike `pathOps`, `insetsOps` and\r\n * the rest, this is **not** an `AttributeOps`: an expression is not an attribute,\r\n * has no `resolve`/`lerp` pair, and nothing in `attributes/properties/typed.ts`\r\n * builds a property from it. Only the naming convention transfers.\r\n *\r\n * Behind it is one grammar. There were two — this one and the function-plot\r\n * language in `@motionscript/math` — agreeing on every rule they documented and\r\n * disagreeing everywhere they hadn't. The pipeline is now:\r\n *\r\n * a prop value ── bind/collect ──▶ \"=4[g]+3\" ── parse ──▶ ExpressionNode\r\n * (one walk) the marker │\r\n * stripped here ▼\r\n * compile ──▶ () => unknown\r\n *\r\n * A dialect chooses the function library and how a reference is spelled, so\r\n * `sin` can be degrees here and radians in a plot without a second parser.\r\n */\r\nimport { DOCUMENT_DIALECT, parse, sortedKeys } from \"./parse\";\r\nimport { compile } from \"./compile\";\r\nimport { bind, bindProps, collect, isSource, renameRefs, unescape } from \"./walk\";\r\nimport type {\r\n CompiledProps, CompiledValue, ExpressionDialect, ExpressionSite,\r\n ParsedExpression, VariableResolver,\r\n} from \"./types\";\r\n\r\n/** {@link parse}, tolerating the `=` a raw prop value still carries. */\r\nfunction parseSource(source: string, dialect: ExpressionDialect = DOCUMENT_DIALECT): ParsedExpression {\r\n return parse(isSource(source) ? source.slice(1) : source, dialect);\r\n}\r\n\r\nexport interface ExpressionOps {\r\n // ── Recognition ────────────────────────────────────────────────────────\r\n /** True for a formula. `\"==\"` escapes a literal string starting with `=`. */\r\n isSource(value: unknown): value is string;\r\n /** Strip that escape: `\"==x\"` → `\"=x\"`. Everything else passes through. */\r\n unescape(value: string): string;\r\n\r\n // ── Reading ────────────────────────────────────────────────────────────\r\n /** Parse a formula, with or without its leading `=`. Throws `ExpressionError`. */\r\n parse(source: string, dialect?: ExpressionDialect): ParsedExpression;\r\n /** {@link ExpressionOps.parse} without throwing — the shape a validator wants. */\r\n tryParse(source: string, dialect?: ExpressionDialect): { expression: ParsedExpression } | { error: string };\r\n\r\n // ── Binding ────────────────────────────────────────────────────────────\r\n /** A parsed formula into the binding a `PropSlot` takes. */\r\n compile(parsed: ParsedExpression, resolve: VariableResolver, path?: string): () => unknown;\r\n /** One authored prop value: a plain value, or the binding an expression inside it produced. */\r\n bind(value: unknown, resolve: VariableResolver, path?: string): CompiledValue;\r\n /** A whole props bag, split into what a constructor can take and what has to be bound. */\r\n bindProps(props: Record<string, unknown> | undefined, resolve: VariableResolver, path?: string): CompiledProps;\r\n\r\n // ── Inspecting ─────────────────────────────────────────────────────────\r\n /** Every expression inside an authored value, with a JSON-Pointer-style path. */\r\n collect(value: unknown, path: string): ExpressionSite[];\r\n /** Rewrite the `[ref]`s inside every expression in a value; `undefined` keeps one. */\r\n renameRefs<T>(value: T, rename: (ref: string) => string | undefined): T;\r\n /** Every function name, for a host offering completion. Sorted. */\r\n functions(): string[];\r\n /** Every constant name, for a host offering completion. Sorted. */\r\n constants(): string[];\r\n /** The language a document's props are written in. */\r\n readonly dialect: ExpressionDialect;\r\n}\r\n\r\nexport const expressionOps: ExpressionOps = {\r\n isSource,\r\n unescape,\r\n\r\n parse: parseSource,\r\n tryParse: (source, dialect) => {\r\n try {\r\n return { expression: parseSource(source, dialect) };\r\n } catch (e) {\r\n return { error: e instanceof Error ? e.message : String(e) };\r\n }\r\n },\r\n\r\n compile,\r\n bind,\r\n bindProps,\r\n\r\n collect,\r\n renameRefs,\r\n functions: () => sortedKeys(DOCUMENT_DIALECT.functions),\r\n constants: () => sortedKeys(DOCUMENT_DI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AAU,CAAC,gBAAgB,CAAC,SAAS,CAAC;IACvD,OAAO,EAAE,gBAAgB;CAC5B,CAAC","sourcesContent":["/**\n * Every expression operation, on one object.\n *\n * The same shape `pathOps` has, for the same reason — one value to import, and a\n * call site one grep from its implementation. Unlike `pathOps`, `insetsOps` and\n * the rest, this is **not** an `AttributeOps`: an expression is not an attribute,\n * has no `resolve`/`lerp` pair, and nothing in `attributes/properties/typed.ts`\n * builds a property from it. Only the naming convention transfers.\n *\n * Behind it is one grammar. There were two — this one and the function-plot\n * language in `@motionscript/math` — agreeing on every rule they documented and\n * disagreeing everywhere they hadn't. The pipeline is now:\n *\n * a prop value ── bind/collect ──▶ \"=4[g]+3\" ── parse ──▶ ExpressionNode\n * (one walk) the marker │\n * stripped here ▼\n * compile ──▶ () => unknown\n *\n * A dialect chooses the function library and how a reference is spelled, so\n * `sin` can be degrees here and radians in a plot without a second parser.\n */\nimport { DOCUMENT_DIALECT, parse, sortedKeys } from \"./parse\";\nimport { compile } from \"./compile\";\nimport { bind, bindProps, collect, isSource, renameRefs, unescape } from \"./walk\";\nimport type {\n CompiledProps, CompiledValue, ExpressionDialect, ExpressionSite,\n ParsedExpression, VariableResolver,\n} from \"./types\";\n\n/** {@link parse}, tolerating the `=` a raw prop value still carries. */\nfunction parseSource(source: string, dialect: ExpressionDialect = DOCUMENT_DIALECT): ParsedExpression {\n return parse(isSource(source) ? source.slice(1) : source, dialect);\n}\n\nexport interface ExpressionOps {\n // ── Recognition ────────────────────────────────────────────────────────\n /** True for a formula. `\"==\"` escapes a literal string starting with `=`. */\n isSource(value: unknown): value is string;\n /** Strip that escape: `\"==x\"` → `\"=x\"`. Everything else passes through. */\n unescape(value: string): string;\n\n // ── Reading ────────────────────────────────────────────────────────────\n /** Parse a formula, with or without its leading `=`. Throws `ExpressionError`. */\n parse(source: string, dialect?: ExpressionDialect): ParsedExpression;\n /** {@link ExpressionOps.parse} without throwing — the shape a validator wants. */\n tryParse(source: string, dialect?: ExpressionDialect): { expression: ParsedExpression } | { error: string };\n\n // ── Binding ────────────────────────────────────────────────────────────\n /** A parsed formula into the binding a `PropSlot` takes. */\n compile(parsed: ParsedExpression, resolve: VariableResolver, path?: string): () => unknown;\n /** One authored prop value: a plain value, or the binding an expression inside it produced. */\n bind(value: unknown, resolve: VariableResolver, path?: string): CompiledValue;\n /** A whole props bag, split into what a constructor can take and what has to be bound. */\n bindProps(props: Record<string, unknown> | undefined, resolve: VariableResolver, path?: string): CompiledProps;\n\n // ── Inspecting ─────────────────────────────────────────────────────────\n /** Every expression inside an authored value, with a JSON-Pointer-style path. */\n collect(value: unknown, path: string): ExpressionSite[];\n /** Rewrite the `[ref]`s inside every expression in a value; `undefined` keeps one. */\n renameRefs<T>(value: T, rename: (ref: string) => string | undefined): T;\n /** Every function name, for a host offering completion. Sorted. */\n functions(): string[];\n /** Every constant name, for a host offering completion. Sorted. */\n constants(): string[];\n /** The language a document's props are written in. */\n readonly dialect: ExpressionDialect;\n}\n\nexport const expressionOps: ExpressionOps = {\n isSource,\n unescape,\n\n parse: parseSource,\n tryParse: (source, dialect) => {\n try {\n return { expression: parseSource(source, dialect) };\n } catch (e) {\n return { error: e instanceof Error ? e.message : String(e) };\n }\n },\n\n compile,\n bind,\n bindProps,\n\n collect,\n renameRefs,\n functions: () => sortedKeys(DOCUMENT_DIALECT.functions),\n constants: () => sortedKeys(DOCUMENT_DIALECT.constants),\n dialect: DOCUMENT_DIALECT,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/document/expression/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAM1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA+B;IAC1D,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC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E,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;AACpE,CAAC","sourcesContent":["/**\r\n * The one scanner and the one grammar, plus the document's own dialect.\r\n *\r\n * There were two of each — this module's, and the function-plot language in\r\n * `@motionscript/math` — and they agreed on every rule they documented while\r\n * disagreeing on the parts nobody wrote down. Plot scanned `1.2.3` as a single\r\n * token, which `Number` turned into a `NaN` that parsed, compiled and rendered\r\n * an entirely invisible surface with no diagnostic anywhere. It treated `\\r` as\r\n * an unexpected character, so a pasted CRLF equation failed. It checked no arity\r\n * on its variadic functions, so `atan2(1)` was a silent `NaN`.\r\n *\r\n * What the two genuinely disagree about is a *table*: which functions exist,\r\n * whether `sin` takes degrees or radians, and how a reference is spelled. That\r\n * is {@link ExpressionDialect}, and it is the only thing this file is\r\n * parameterized by.\r\n *\r\n * Precedence is the ordinary arithmetic one, with `^` right-associative and\r\n * **implicit multiplication** between adjacent primaries — which is what makes\r\n * `4[g]+3` mean what it reads as. Note `unary` sits *above* `power`, so `-2^2`\r\n * is `-4` as in maths, and the exponent parses as a unary so `2^3^2` is 512 and\r\n * `2^-3` is legal.\r\n */\r\nimport { ExpressionError } from \"./types\";\r\nimport type { BinaryOp, ExpressionDialect, ExpressionNode, FnArity, ParsedExpression } from \"./types\";\r\n\r\nconst DEG = Math.PI / 180;\r\n\r\ninterface DocumentFn extends FnArity {\r\n apply(args: number[]): number;\r\n}\r\n\r\n/**\r\n * The document's function library.\r\n *\r\n * Deliberately small and closed: an expression is stored in a document and\r\n * evaluated by whatever version of the library opens it later, so every name\r\n * here is as much a public contract as an exported symbol. Trig is in **degrees**\r\n * because every other angle in the library is.\r\n */\r\nexport const DOCUMENT_FUNCTIONS: Record<string, DocumentFn> = {\r\n abs: { arity: [1, 1], apply: (a) => Math.abs(a[0]) },\r\n sign: { arity: [1, 1], apply: (a) => Math.sign(a[0]) },\r\n sqrt: { arity: [1, 1], apply: (a) => Math.sqrt(a[0]) },\r\n floor: { arity: [1, 1], apply: (a) => Math.floor(a[0]) },\r\n ceil: { arity: [1, 1], apply: (a) => Math.ceil(a[0]) },\r\n round: { arity: [1, 2], apply: (a) => (a.length > 1 && a[1] !== 0 ? Math.round(a[0] / a[1]) * a[1] : Math.round(a[0])) },\r\n min: { arity: [1, Infinity], apply: (a) => Math.min(...a) },\r\n max: { arity: [1, Infinity], apply: (a) => Math.max(...a) },\r\n clamp: { arity: [3, 3], apply: (a) => Math.min(Math.max(a[0], a[1]), a[2]) },\r\n mod: { arity: [2, 2], apply: (a) => ((a[0] % a[1]) + a[1]) % a[1] },\r\n pow: { arity: [2, 2], apply: (a) => a[0] ** a[1] },\r\n log: { arity: [1, 2], apply: (a) => (a.length > 1 ? Math.log(a[0]) / Math.log(a[1]) : Math.log(a[0])) },\r\n exp: { arity: [1, 1], apply: (a) => Math.exp(a[0]) },\r\n mix: { arity: [3, 3], apply: (a) => a[0] + (a[1] - a[0]) * a[2] },\r\n smoothstep: {\r\n arity: [3, 3],\r\n apply: (a) => {\r\n if (Number.isNaN(a[0]) || Number.isNaN(a[1]) || Number.isNaN(a[2])) return NaN;\r\n // Equal edges: a step at the edge, like `step` — no divide by zero.\r\n if (a[0] === a[1]) return a[2] < a[0] ? 0 : 1;\r\n const t = Math.min(Math.max((a[2] - a[0]) / (a[1] - a[0]), 0), 1);\r\n return t * t * (3 - 2 * t);\r\n },\r\n },\r\n step: { arity: [2, 2], apply: (a) => (Number.isNaN(a[0]) || Number.isNaN(a[1]) ? NaN : a[1] < a[0] ? 0 : 1) },\r\n sin: { arity: [1, 1], apply: (a) => Math.sin(a[0] * DEG) },\r\n cos: { arity: [1, 1], apply: (a) => Math.cos(a[0] * DEG) },\r\n tan: { arity: [1, 1], apply: (a) => Math.tan(a[0] * DEG) },\r\n asin: { arity: [1, 1], apply: (a) => Math.asin(a[0]) / DEG },\r\n acos: { arity: [1, 1], apply: (a) => Math.acos(a[0]) / DEG },\r\n atan: { arity: [1, 1], apply: (a) => Math.atan(a[0]) / DEG },\r\n atan2: { arity: [2, 2], apply: (a) => Math.atan2(a[0], a[1]) / DEG },\r\n hypot: { arity: [2, Infinity], apply: (a) => Math.hypot(...a) },\r\n};\r\n\r\n/** Bare identifiers that are values rather than calls. */\r\nconst DOCUMENT_CONSTANTS: Record<string, number> = {\r\n pi: Math.PI,\r\n tau: Math.PI * 2,\r\n e: Math.E,\r\n};\r\n\r\n/** The language a `\"=…\"` prop is written in. */\r\nexport const DOCUMENT_DIALECT: ExpressionDialect = {\r\n functions: DOCUMENT_FUNCTIONS,\r\n constants: DOCUMENT_CONSTANTS,\r\n refs: \"bracket\",\r\n unknownName: (name) =>\r\n `unknown name \"${name}\" — a variable is referenced as \"[${name}]\"; ` +\r\n `bare names are the constants ${sortedKeys(DOCUMENT_CONSTANTS).join(\", \")}`,\r\n};\r\n\r\n/** Sorted, so a message or a completion list is stable. */\r\nexport function sortedKeys(table: Record<string, unknown>): string[] {\r\n return Object.keys(table).sort();\r\n}\r\n\r\n// ── Scanner ──────────────────────────────────────────────────────────────────\r\n\r\ntype TokenKind = \"number\" | \"ref\" | \"ident\" | \"op\" | \"(\" | \")\" | \",\" | \"end\";\r\n\r\ninterface Token {\r\n kind: TokenKind;\r\n /** The identifier, operator or reference name. Empty for numbers. */\r\n text: string;\r\n /** Parsed value, for numbers. */\r\n value: number;\r\n pos: number;\r\n}\r\n\r\nconst OPERATORS = new Set([\"+\", \"-\", \"*\", \"/\", \"%\", \"^\"]);\r\n\r\nfunction isDigit(ch: string | undefined): boolean {\r\n return ch !== undefined && ch >= \"0\" && ch <= \"9\";\r\n}\r\n\r\nfunction tokenize(source: string, dialect: ExpressionDialect): Token[] {\r\n const tokens: Token[] = [];\r\n let i = 0;\r\n\r\n while (i < source.length) {\r\n const ch = source[i];\r\n\r\n if (ch === \" \" || ch === \"\\t\" || ch === \"\\n\" || ch === \"\\r\") {\r\n i++;\r\n continue;\r\n }\r\n\r\n if (isDigit(ch) || (ch === \".\" && isDigit(source[i + 1]))) {\r\n const start = i;\r\n while (isDigit(source[i])) i++;\r\n if (source[i] === \".\") {\r\n i++;\r\n while (isDigit(source[i])) i++;\r\n }\r\n if (source[i] === \"e\" || source[i] === \"E\") {\r\n const mark = i;\r\n i++;\r\n if (source[i] === \"+\" || source[i] === \"-\") i++;\r\n if (isDigit(source[i])) {\r\n while (isDigit(source[i])) i++;\r\n } else {\r\n // `2e` followed by something else is `2` times the identifier\r\n // `e`, not a malformed exponent.\r\n i = mark;\r\n }\r\n }\r\n // A second `.` ends a number that has already had one. Both parsers\r\n // this replaces got here differently and both got it wrong: one\r\n // scanned `1.2.3` as a single token that `Number` turned into a\r\n // silent `NaN`, the other split it into `1.2 * 0.3`. Neither is\r\n // anything anyone wrote on purpose.\r\n if (source[i] === \".\") throw new ExpressionError('unexpected character \".\"', source, i);\r\n tokens.push({ kind: \"number\", text: \"\", value: Number(source.slice(start, i)), pos: start });\r\n continue;\r\n }\r\n\r\n // `[` is legal only where a reference is spelled with one, so a plot\r\n // equation gets \"unexpected character\" here rather than failing later\r\n // with a message about variable references it has never heard of.\r\n if (ch === \"[\" && dialect.refs === \"bracket\") {\r\n const start = i;\r\n const end = source.indexOf(\"]\", i + 1);\r\n if (end === -1) throw new ExpressionError(\"unclosed `[` — a variable reference is written `[id]`\", source, start);\r\n const name = source.slice(i + 1, end).trim();\r\n if (name.length === 0) throw new ExpressionError(\"empty variable reference `[]`\", source, start);\r\n if (name.includes(\"[\")) throw new ExpressionError(\"variable references cannot nest\", source, start);\r\n tokens.push({ kind: \"ref\", text: name, value: 0, pos: start });\r\n i = end + 1;\r\n continue;\r\n }\r\n\r\n if (/[A-Za-z_]/.test(ch)) {\r\n const start = i;\r\n while (i < source.length && /[A-Za-z0-9_]/.test(source[i])) i++;\r\n tokens.push({ kind: \"ident\", text: source.slice(start, i), value: 0, pos: start });\r\n continue;\r\n }\r\n\r\n if (OPERATORS.has(ch)) {\r\n tokens.push({ kind: \"op\", text: ch, value: 0, pos: i++ });\r\n continue;\r\n }\r\n if (ch === \"(\" || ch === \")\" || ch === \",\") {\r\n tokens.push({ kind: ch as TokenKind, text: ch, value: 0, pos: i++ });\r\n continue;\r\n }\r\n\r\n throw new ExpressionError(`unexpected character \"${ch}\"`, source, i);\r\n }\r\n\r\n tokens.push({ kind: \"end\", text: \"\", value: 0, pos: source.length });\r\n return tokens;\r\n}\r\n\r\n// ── Grammar ──────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Parse a formula against a dialect.\r\n *\r\n * `source` is the formula alone — the document's `=` is stripped by the walk\r\n * that recognised it, because the marker is not part of any grammar.\r\n */\r\nexport function parse(source: string, dialect: ExpressionDialect = DOCUMENT_DIALECT): ParsedExpression {\r\n if (source.trim().length === 0) throw new ExpressionError(\"empty expression\", source);\r\n\r\n const tokens = tokenize(source, dialect);\r\n const refs: string[] = [];\r\n let index = 0;\r\n\r\n const peek = (): Token => tokens[index];\r\n const next = (): Token => tokens[index++];\r\n\r\n const addRef = (name: string): ExpressionNode => {\r\n if (!refs.includes(name)) refs.push(name);\r\n return { kind: \"ref\", name };\r\n };\r\n\r\n /** True when the token can begin a primary — the test implicit `*` turns on. */\r\n const startsPrimary = (t: Token): boolean =>\r\n t.kind === \"number\" || t.kind === \"ref\" || t.kind === \"ident\" || t.kind === \"(\";\r\n\r\n function parseAdditive(): ExpressionNode {\r\n let left = parseMultiplicative();\r\n for (;;) {\r\n const t = peek();\r\n if (t.kind === \"op\" && (t.text === \"+\" || t.text === \"-\")) {\r\n next();\r\n left = { kind: \"binary\", op: t.text, left, right: parseMultiplicative() };\r\n continue;\r\n }\r\n return left;\r\n }\r\n }\r\n\r\n function parseMultiplicative(): ExpressionNode {\r\n let left = parseUnary();\r\n for (;;) {\r\n const t = peek();\r\n if (t.kind === \"op\" && (t.text === \"*\" || t.text === \"/\" || t.text === \"%\")) {\r\n next();\r\n left = { kind: \"binary\", op: t.text as BinaryOp, left, right: parseUnary() };\r\n continue;\r\n }\r\n // `4[g]`, `2(x+1)`, `[a][b]`, `2pi` — juxtaposition is multiplication.\r\n if (startsPrimary(t)) {\r\n left = { kind: \"binary\", op: \"*\", left, right: parseUnary() };\r\n continue;\r\n }\r\n return left;\r\n }\r\n }\r\n\r\n function parseUnary(): ExpressionNode {\r\n const t = peek();\r\n if (t.kind === \"op\" && (t.text === \"-\" || t.text === \"+\")) {\r\n next();\r\n const operand = parseUnary();\r\n return t.text === \"-\" ? { kind: \"unary\", op: \"-\", operand } : operand;\r\n }\r\n return parsePower();\r\n }\r\n\r\n function parsePower(): ExpressionNode {\r\n const base = parsePrimary();\r\n const t = peek();\r\n if (t.kind === \"op\" && t.text === \"^\") {\r\n next();\r\n // Right-associative, and binding tighter than unary minus on its\r\n // right: `2^-1` is a half, not an error.\r\n return { kind: \"binary\", op: \"^\", left: base, right: parseUnary() };\r\n }\r\n return base;\r\n }\r\n\r\n function parseCall(name: string, pos: number): ExpressionNode {\r\n // Own keys only: `toString(1)` must be an unknown function, not a lookup\r\n // that finds `Object.prototype`'s.\r\n const def = Object.hasOwn(dialect.functions, name) ? dialect.functions[name] : undefined;\r\n if (!def) {\r\n throw new ExpressionError(\r\n `unknown function \"${name}\" — available: ${sortedKeys(dialect.functions).join(\", \")}`,\r\n source, pos,\r\n );\r\n }\r\n const args: ExpressionNode[] = [];\r\n if (peek().kind !== \")\") {\r\n for (;;) {\r\n args.push(parseAdditive());\r\n if (peek().kind !== \",\") break;\r\n next();\r\n }\r\n }\r\n const close = next();\r\n if (close.kind !== \")\") throw new ExpressionError(`expected \\`)\\` closing ${name}(`, source, close.pos);\r\n\r\n const [min, max] = def.arity;\r\n if (args.length < min || args.length > max) {\r\n const want = max === Infinity ? `at least ${min}` : min === max ? `${min}` : `${min}–${max}`;\r\n // Singular only when `want` names the number one (`1`, `at least 1`), never for a range.\r\n const plural = (max === Infinity || min === max) && min === 1 ? \"\" : \"s\";\r\n throw new ExpressionError(\r\n `${name}() takes ${want} argument${plural}, got ${args.length}`,\r\n source, pos,\r\n );\r\n }\r\n return { kind: \"call\", name, args };\r\n }\r\n\r\n function parsePrimary(): ExpressionNode {\r\n const t = next();\r\n switch (t.kind) {\r\n case \"number\":\r\n return { kind: \"const\", value: t.value };\r\n case \"ref\":\r\n return addRef(t.text);\r\n case \"(\": {\r\n const inner = parseAdditive();\r\n const close = next();\r\n if (close.kind !== \")\") throw new ExpressionError(\"expected `)`\", source, close.pos);\r\n return inner;\r\n }\r\n case \"ident\": {\r\n if (peek().kind === \"(\") {\r\n next();\r\n return parseCall(t.text, t.pos);\r\n }\r\n // A constant is folded here, before a bare identifier can become\r\n // a reference — so a dialect's constant name can never also be\r\n // one of its free variables.\r\n const constant = Object.hasOwn(dialect.constants, t.text) ? dialect.constants[t.text] : undefined;\r\n if (constant !== undefined) return { kind: \"const\", value: constant };\r\n if (dialect.refs === \"bare\") return addRef(t.text);\r\n throw new ExpressionError(dialect.unknownName(t.text), source, t.pos);\r\n }\r\n default:\r\n throw new ExpressionError(\r\n t.kind === \"end\" ? \"expression ends early\" : `unexpected \"${t.text}\"`,\r\n source, t.pos,\r\n );\r\n }\r\n }\r\n\r\n const root = parseAdditive();\r\n const trailing = peek();\r\n if (trailing.kind !== \"end\") throw new ExpressionError(`unexpected \"${trailing.text}\"`, source, trailing.pos);\r\n\r\n return { source, root, refs, passthrough: root.kind === \"ref\" };\r\n}\r\n"]}
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/document/expression/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAM1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA+B;IAC1D,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC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E,CAAC;AACpE,CAAC","sourcesContent":["/**\n * The one scanner and the one grammar, plus the document's own dialect.\n *\n * There were two of each — this module's, and the function-plot language in\n * `@motionscript/math` — and they agreed on every rule they documented while\n * disagreeing on the parts nobody wrote down. Plot scanned `1.2.3` as a single\n * token, which `Number` turned into a `NaN` that parsed, compiled and rendered\n * an entirely invisible surface with no diagnostic anywhere. It treated `\\r` as\n * an unexpected character, so a pasted CRLF equation failed. It checked no arity\n * on its variadic functions, so `atan2(1)` was a silent `NaN`.\n *\n * What the two genuinely disagree about is a *table*: which functions exist,\n * whether `sin` takes degrees or radians, and how a reference is spelled. That\n * is {@link ExpressionDialect}, and it is the only thing this file is\n * parameterized by.\n *\n * Precedence is the ordinary arithmetic one, with `^` right-associative and\n * **implicit multiplication** between adjacent primaries — which is what makes\n * `4[g]+3` mean what it reads as. Note `unary` sits *above* `power`, so `-2^2`\n * is `-4` as in maths, and the exponent parses as a unary so `2^3^2` is 512 and\n * `2^-3` is legal.\n */\nimport { ExpressionError } from \"./types\";\nimport type { BinaryOp, ExpressionDialect, ExpressionNode, FnArity, ParsedExpression } from \"./types\";\n\nconst DEG = Math.PI / 180;\n\ninterface DocumentFn extends FnArity {\n apply(args: number[]): number;\n}\n\n/**\n * The document's function library.\n *\n * Deliberately small and closed: an expression is stored in a document and\n * evaluated by whatever version of the library opens it later, so every name\n * here is as much a public contract as an exported symbol. Trig is in **degrees**\n * because every other angle in the library is.\n */\nexport const DOCUMENT_FUNCTIONS: Record<string, DocumentFn> = {\n abs: { arity: [1, 1], apply: (a) => Math.abs(a[0]) },\n sign: { arity: [1, 1], apply: (a) => Math.sign(a[0]) },\n sqrt: { arity: [1, 1], apply: (a) => Math.sqrt(a[0]) },\n floor: { arity: [1, 1], apply: (a) => Math.floor(a[0]) },\n ceil: { arity: [1, 1], apply: (a) => Math.ceil(a[0]) },\n round: { arity: [1, 2], apply: (a) => (a.length > 1 && a[1] !== 0 ? Math.round(a[0] / a[1]) * a[1] : Math.round(a[0])) },\n min: { arity: [1, Infinity], apply: (a) => Math.min(...a) },\n max: { arity: [1, Infinity], apply: (a) => Math.max(...a) },\n clamp: { arity: [3, 3], apply: (a) => Math.min(Math.max(a[0], a[1]), a[2]) },\n mod: { arity: [2, 2], apply: (a) => ((a[0] % a[1]) + a[1]) % a[1] },\n pow: { arity: [2, 2], apply: (a) => a[0] ** a[1] },\n log: { arity: [1, 2], apply: (a) => (a.length > 1 ? Math.log(a[0]) / Math.log(a[1]) : Math.log(a[0])) },\n exp: { arity: [1, 1], apply: (a) => Math.exp(a[0]) },\n mix: { arity: [3, 3], apply: (a) => a[0] + (a[1] - a[0]) * a[2] },\n smoothstep: {\n arity: [3, 3],\n apply: (a) => {\n if (Number.isNaN(a[0]) || Number.isNaN(a[1]) || Number.isNaN(a[2])) return NaN;\n // Equal edges: a step at the edge, like `step` — no divide by zero.\n if (a[0] === a[1]) return a[2] < a[0] ? 0 : 1;\n const t = Math.min(Math.max((a[2] - a[0]) / (a[1] - a[0]), 0), 1);\n return t * t * (3 - 2 * t);\n },\n },\n step: { arity: [2, 2], apply: (a) => (Number.isNaN(a[0]) || Number.isNaN(a[1]) ? NaN : a[1] < a[0] ? 0 : 1) },\n sin: { arity: [1, 1], apply: (a) => Math.sin(a[0] * DEG) },\n cos: { arity: [1, 1], apply: (a) => Math.cos(a[0] * DEG) },\n tan: { arity: [1, 1], apply: (a) => Math.tan(a[0] * DEG) },\n asin: { arity: [1, 1], apply: (a) => Math.asin(a[0]) / DEG },\n acos: { arity: [1, 1], apply: (a) => Math.acos(a[0]) / DEG },\n atan: { arity: [1, 1], apply: (a) => Math.atan(a[0]) / DEG },\n atan2: { arity: [2, 2], apply: (a) => Math.atan2(a[0], a[1]) / DEG },\n hypot: { arity: [2, Infinity], apply: (a) => Math.hypot(...a) },\n};\n\n/** Bare identifiers that are values rather than calls. */\nconst DOCUMENT_CONSTANTS: Record<string, number> = {\n pi: Math.PI,\n tau: Math.PI * 2,\n e: Math.E,\n};\n\n/** The language a `\"=…\"` prop is written in. */\nexport const DOCUMENT_DIALECT: ExpressionDialect = {\n functions: DOCUMENT_FUNCTIONS,\n constants: DOCUMENT_CONSTANTS,\n refs: \"bracket\",\n unknownName: (name) =>\n `unknown name \"${name}\" — a variable is referenced as \"[${name}]\"; ` +\n `bare names are the constants ${sortedKeys(DOCUMENT_CONSTANTS).join(\", \")}`,\n};\n\n/** Sorted, so a message or a completion list is stable. */\nexport function sortedKeys(table: Record<string, unknown>): string[] {\n return Object.keys(table).sort();\n}\n\n// ── Scanner ──────────────────────────────────────────────────────────────────\n\ntype TokenKind = \"number\" | \"ref\" | \"ident\" | \"op\" | \"(\" | \")\" | \",\" | \"end\";\n\ninterface Token {\n kind: TokenKind;\n /** The identifier, operator or reference name. Empty for numbers. */\n text: string;\n /** Parsed value, for numbers. */\n value: number;\n pos: number;\n}\n\nconst OPERATORS = new Set([\"+\", \"-\", \"*\", \"/\", \"%\", \"^\"]);\n\nfunction isDigit(ch: string | undefined): boolean {\n return ch !== undefined && ch >= \"0\" && ch <= \"9\";\n}\n\nfunction tokenize(source: string, dialect: ExpressionDialect): Token[] {\n const tokens: Token[] = [];\n let i = 0;\n\n while (i < source.length) {\n const ch = source[i];\n\n if (ch === \" \" || ch === \"\\t\" || ch === \"\\n\" || ch === \"\\r\") {\n i++;\n continue;\n }\n\n if (isDigit(ch) || (ch === \".\" && isDigit(source[i + 1]))) {\n const start = i;\n while (isDigit(source[i])) i++;\n if (source[i] === \".\") {\n i++;\n while (isDigit(source[i])) i++;\n }\n if (source[i] === \"e\" || source[i] === \"E\") {\n const mark = i;\n i++;\n if (source[i] === \"+\" || source[i] === \"-\") i++;\n if (isDigit(source[i])) {\n while (isDigit(source[i])) i++;\n } else {\n // `2e` followed by something else is `2` times the identifier\n // `e`, not a malformed exponent.\n i = mark;\n }\n }\n // A second `.` ends a number that has already had one. Both parsers\n // this replaces got here differently and both got it wrong: one\n // scanned `1.2.3` as a single token that `Number` turned into a\n // silent `NaN`, the other split it into `1.2 * 0.3`. Neither is\n // anything anyone wrote on purpose.\n if (source[i] === \".\") throw new ExpressionError('unexpected character \".\"', source, i);\n tokens.push({ kind: \"number\", text: \"\", value: Number(source.slice(start, i)), pos: start });\n continue;\n }\n\n // `[` is legal only where a reference is spelled with one, so a plot\n // equation gets \"unexpected character\" here rather than failing later\n // with a message about variable references it has never heard of.\n if (ch === \"[\" && dialect.refs === \"bracket\") {\n const start = i;\n const end = source.indexOf(\"]\", i + 1);\n if (end === -1) throw new ExpressionError(\"unclosed `[` — a variable reference is written `[id]`\", source, start);\n const name = source.slice(i + 1, end).trim();\n if (name.length === 0) throw new ExpressionError(\"empty variable reference `[]`\", source, start);\n if (name.includes(\"[\")) throw new ExpressionError(\"variable references cannot nest\", source, start);\n tokens.push({ kind: \"ref\", text: name, value: 0, pos: start });\n i = end + 1;\n continue;\n }\n\n if (/[A-Za-z_]/.test(ch)) {\n const start = i;\n while (i < source.length && /[A-Za-z0-9_]/.test(source[i])) i++;\n tokens.push({ kind: \"ident\", text: source.slice(start, i), value: 0, pos: start });\n continue;\n }\n\n if (OPERATORS.has(ch)) {\n tokens.push({ kind: \"op\", text: ch, value: 0, pos: i++ });\n continue;\n }\n if (ch === \"(\" || ch === \")\" || ch === \",\") {\n tokens.push({ kind: ch as TokenKind, text: ch, value: 0, pos: i++ });\n continue;\n }\n\n throw new ExpressionError(`unexpected character \"${ch}\"`, source, i);\n }\n\n tokens.push({ kind: \"end\", text: \"\", value: 0, pos: source.length });\n return tokens;\n}\n\n// ── Grammar ──────────────────────────────────────────────────────────────────\n\n/**\n * Parse a formula against a dialect.\n *\n * `source` is the formula alone — the document's `=` is stripped by the walk\n * that recognised it, because the marker is not part of any grammar.\n */\nexport function parse(source: string, dialect: ExpressionDialect = DOCUMENT_DIALECT): ParsedExpression {\n if (source.trim().length === 0) throw new ExpressionError(\"empty expression\", source);\n\n const tokens = tokenize(source, dialect);\n const refs: string[] = [];\n let index = 0;\n\n const peek = (): Token => tokens[index];\n const next = (): Token => tokens[index++];\n\n const addRef = (name: string): ExpressionNode => {\n if (!refs.includes(name)) refs.push(name);\n return { kind: \"ref\", name };\n };\n\n /** True when the token can begin a primary — the test implicit `*` turns on. */\n const startsPrimary = (t: Token): boolean =>\n t.kind === \"number\" || t.kind === \"ref\" || t.kind === \"ident\" || t.kind === \"(\";\n\n function parseAdditive(): ExpressionNode {\n let left = parseMultiplicative();\n for (;;) {\n const t = peek();\n if (t.kind === \"op\" && (t.text === \"+\" || t.text === \"-\")) {\n next();\n left = { kind: \"binary\", op: t.text, left, right: parseMultiplicative() };\n continue;\n }\n return left;\n }\n }\n\n function parseMultiplicative(): ExpressionNode {\n let left = parseUnary();\n for (;;) {\n const t = peek();\n if (t.kind === \"op\" && (t.text === \"*\" || t.text === \"/\" || t.text === \"%\")) {\n next();\n left = { kind: \"binary\", op: t.text as BinaryOp, left, right: parseUnary() };\n continue;\n }\n // `4[g]`, `2(x+1)`, `[a][b]`, `2pi` — juxtaposition is multiplication.\n if (startsPrimary(t)) {\n left = { kind: \"binary\", op: \"*\", left, right: parseUnary() };\n continue;\n }\n return left;\n }\n }\n\n function parseUnary(): ExpressionNode {\n const t = peek();\n if (t.kind === \"op\" && (t.text === \"-\" || t.text === \"+\")) {\n next();\n const operand = parseUnary();\n return t.text === \"-\" ? { kind: \"unary\", op: \"-\", operand } : operand;\n }\n return parsePower();\n }\n\n function parsePower(): ExpressionNode {\n const base = parsePrimary();\n const t = peek();\n if (t.kind === \"op\" && t.text === \"^\") {\n next();\n // Right-associative, and binding tighter than unary minus on its\n // right: `2^-1` is a half, not an error.\n return { kind: \"binary\", op: \"^\", left: base, right: parseUnary() };\n }\n return base;\n }\n\n function parseCall(name: string, pos: number): ExpressionNode {\n // Own keys only: `toString(1)` must be an unknown function, not a lookup\n // that finds `Object.prototype`'s.\n const def = Object.hasOwn(dialect.functions, name) ? dialect.functions[name] : undefined;\n if (!def) {\n throw new ExpressionError(\n `unknown function \"${name}\" — available: ${sortedKeys(dialect.functions).join(\", \")}`,\n source, pos,\n );\n }\n const args: ExpressionNode[] = [];\n if (peek().kind !== \")\") {\n for (;;) {\n args.push(parseAdditive());\n if (peek().kind !== \",\") break;\n next();\n }\n }\n const close = next();\n if (close.kind !== \")\") throw new ExpressionError(`expected \\`)\\` closing ${name}(`, source, close.pos);\n\n const [min, max] = def.arity;\n if (args.length < min || args.length > max) {\n const want = max === Infinity ? `at least ${min}` : min === max ? `${min}` : `${min}–${max}`;\n // Singular only when `want` names the number one (`1`, `at least 1`), never for a range.\n const plural = (max === Infinity || min === max) && min === 1 ? \"\" : \"s\";\n throw new ExpressionError(\n `${name}() takes ${want} argument${plural}, got ${args.length}`,\n source, pos,\n );\n }\n return { kind: \"call\", name, args };\n }\n\n function parsePrimary(): ExpressionNode {\n const t = next();\n switch (t.kind) {\n case \"number\":\n return { kind: \"const\", value: t.value };\n case \"ref\":\n return addRef(t.text);\n case \"(\": {\n const inner = parseAdditive();\n const close = next();\n if (close.kind !== \")\") throw new ExpressionError(\"expected `)`\", source, close.pos);\n return inner;\n }\n case \"ident\": {\n if (peek().kind === \"(\") {\n next();\n return parseCall(t.text, t.pos);\n }\n // A constant is folded here, before a bare identifier can become\n // a reference — so a dialect's constant name can never also be\n // one of its free variables.\n const constant = Object.hasOwn(dialect.constants, t.text) ? dialect.constants[t.text] : undefined;\n if (constant !== undefined) return { kind: \"const\", value: constant };\n if (dialect.refs === \"bare\") return addRef(t.text);\n throw new ExpressionError(dialect.unknownName(t.text), source, t.pos);\n }\n default:\n throw new ExpressionError(\n t.kind === \"end\" ? \"expression ends early\" : `unexpected \"${t.text}\"`,\n source, t.pos,\n );\n }\n }\n\n const root = parseAdditive();\n const trailing = peek();\n if (trailing.kind !== \"end\") throw new ExpressionError(`unexpected \"${trailing.text}\"`, source, trailing.pos);\n\n return { source, root, refs, passthrough: root.kind === \"ref\" };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"refs.js","sourceRoot":"","sources":["../../../src/document/expression/refs.ts"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IAAI,CAAC,CAAC,CAAC;;gBACtC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import { expressionOps } from \"./ops\";\r\n\r\n/**\r\n * A reference split into the node key and prop it names, or `undefined` when it\r\n * has no dot and so names a variable instead.\r\n *\r\n * The dot is the whole discriminator, in the parser (which hands the bracket's\r\n * contents over as one opaque name), the validator, and `ClipTimeline`.\r\n */\r\nexport function splitNodeRef(ref: string): { key: string; prop: string } | undefined {\r\n const dot = ref.indexOf(\".\");\r\n return dot < 0 ? undefined : { key: ref.slice(0, dot), prop: ref.slice(dot + 1) };\r\n}\r\n\r\nexport interface ExpressionRefs {\r\n /** Variable ids read, de-duplicated, in first-seen order. */\r\n vars: string[];\r\n /** `[key, prop]` pairs read, de-duplicated, in first-seen order. */\r\n keys: Array<[key: string, prop: string]>;\r\n /** Expressions that failed to parse; their references are not in the lists above. */\r\n unparsable: number;\r\n}\r\n\r\n/** Every reference inside every expression in an authored value, at any depth. */\r\nexport function expressionRefs(value: unknown, path = \"\"): ExpressionRefs {\r\n const vars: string[] = [];\r\n const keys: Array<[string, string]> = [];\r\n let unparsable = 0;\r\n const seen = new Set<string>();\r\n for (const site of expressionOps.collect(value, path)) {\r\n const parsed = expressionOps.tryParse(site.source);\r\n if (\"error\" in parsed) {\r\n unparsable++;\r\n continue;\r\n }\r\n for (const ref of parsed.expression.refs) {\r\n if (seen.has(ref)) continue;\r\n seen.add(ref);\r\n const node = splitNodeRef(ref);\r\n if (node) keys.push([node.key, node.prop]);\r\n else vars.push(ref);\r\n }\r\n }\r\n return { vars, keys, unparsable };\r\n}\r\n"]}
1
+ {"version":3,"file":"refs.js","sourceRoot":"","sources":["../../../src/document/expression/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC;;;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C;QACxB,CAAC;IACL,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import { expressionOps } from \"./ops\";\n\n/**\n * A reference split into the node key and prop it names, or `undefined` when it\n * has no dot and so names a variable instead.\n *\n * The dot is the whole discriminator, in the parser (which hands the bracket's\n * contents over as one opaque name), the validator, and `ClipTimeline`.\n */\nexport function splitNodeRef(ref: string): { key: string; prop: string } | undefined {\n const dot = ref.indexOf(\".\");\n return dot < 0 ? undefined : { key: ref.slice(0, dot), prop: ref.slice(dot + 1) };\n}\n\nexport interface ExpressionRefs {\n /** Variable ids read, de-duplicated, in first-seen order. */\n vars: string[];\n /** `[key, prop]` pairs read, de-duplicated, in first-seen order. */\n keys: Array<[key: string, prop: string]>;\n /** Expressions that failed to parse; their references are not in the lists above. */\n unparsable: number;\n}\n\n/** Every reference inside every expression in an authored value, at any depth. */\nexport function expressionRefs(value: unknown, path = \"\"): ExpressionRefs {\n const vars: string[] = [];\n const keys: Array<[string, string]> = [];\n let unparsable = 0;\n const seen = new Set<string>();\n for (const site of expressionOps.collect(value, path)) {\n const parsed = expressionOps.tryParse(site.source);\n if (\"error\" in parsed) {\n unparsable++;\n continue;\n }\n for (const ref of parsed.expression.refs) {\n if (seen.has(ref)) continue;\n seen.add(ref);\n const node = splitNodeRef(ref);\n if (node) keys.push([node.key, node.prop]);\n else vars.push(ref);\n }\n }\n return { vars, keys, unparsable };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/document/expression/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,yFAAyF;AACzF,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACtC,iFAAiF;IACxE,MAAM,CAAS;IACxB,sFAAsF;IAC7E,QAAQ,CAAS;IAC1B,6EAA6E;IACpE,IAAI,CAAU;IAEvB,YAAY,OAAe,EAAE,MAAc,EAAE,QAAQ,GAAG,CAAC,CAAC,EAAE,IAAa;QACrE,MAAM,KAAK,GAAG,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,QAAQ,GAAG,CAAC,QAAQ,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC;QACrG,KAAK,CAAC,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ","sourcesContent":["/**\r\n * Every type the expression module names, in one place.\r\n *\r\n * The vocabulary is small and worth seeing at once, because the whole module is\r\n * four representations and the steps between them:\r\n *\r\n * a prop value ──▶ \"=4[g]+3\" ──▶ ExpressionNode ──▶ () => unknown\r\n * at any depth the marked the AST, per a prop binding\r\n * (walk) string dialect (parse) (compile)\r\n *\r\n * The `=` appears in exactly one of those steps. It marks a *document prop* as a\r\n * formula, which is recognition, not grammar — `=` is not a legal character in\r\n * any dialect — so the walk strips it and the parser never sees one.\r\n */\r\n\r\n/** Thrown for a formula that cannot be parsed or whose reference resolves to nothing. */\r\nexport class ExpressionError extends Error {\r\n /** The formula as the parser received it: no marker, and no surrounding prop. */\r\n readonly source: string;\r\n /** Character offset into {@link source}, or `-1` when the whole thing is at fault. */\r\n readonly position: number;\r\n /** Where in the props bag it was written, JSON-Pointer style, when known. */\r\n readonly path?: string;\r\n\r\n constructor(message: string, source: string, position = -1, path?: string) {\r\n const where = position >= 0 ? ` (at character ${position + 1} of \"${source}\")` : ` (in \"${source}\")`;\r\n super(`${message}${where}${path ? ` at ${path}` : \"\"}`);\r\n this.name = \"ExpressionError\";\r\n this.source = source;\r\n this.position = position;\r\n this.path = path;\r\n }\r\n}\r\n\r\n// ── The syntax tree ──────────────────────────────────────────────────────────\r\n\r\nexport type BinaryOp = \"+\" | \"-\" | \"*\" | \"/\" | \"%\" | \"^\";\r\n\r\n/** One node of a parsed formula. Kept public so a host can lint or rewrite one. */\r\nexport type ExpressionNode =\r\n | { kind: \"const\"; value: number }\r\n | { kind: \"ref\"; name: string }\r\n | { kind: \"unary\"; op: \"-\"; operand: ExpressionNode }\r\n | { kind: \"binary\"; op: BinaryOp; left: ExpressionNode; right: ExpressionNode }\r\n | { kind: \"call\"; name: string; args: ExpressionNode[] };\r\n\r\n/** A formula, parsed. Resolver-free, so it can be checked without a scene. */\r\nexport interface ParsedExpression {\r\n /** The formula's text as the parser received it — no marker. */\r\n readonly source: string;\r\n readonly root: ExpressionNode;\r\n /** Names it reads, de-duplicated, in first-seen order. */\r\n readonly refs: readonly string[];\r\n /**\r\n * True when the formula is exactly one reference and nothing else.\r\n *\r\n * The passthrough case: the document's compiled binding returns the\r\n * variable's value untouched rather than coercing it to a number, which is\r\n * what lets a variable hold a colour, a `Vector2` or any other prop value.\r\n * A dialect whose references are bare identifiers sets it for a lone\r\n * variable too (`\"x\"`), where it means nothing — only the document's\r\n * compiler reads it.\r\n */\r\n readonly passthrough: boolean;\r\n}\r\n\r\n// ── Dialects ─────────────────────────────────────────────────────────────────\r\n\r\n/** What the parser needs to know about a function. What it *does* is the back end's. */\r\nexport interface FnArity {\r\n /** Minimum and maximum argument count; `Infinity` for variadic. */\r\n arity: [number, number];\r\n}\r\n\r\n/**\r\n * One language over the shared grammar.\r\n *\r\n * The grammar is fixed — precedence, implicit multiplication, right-associative\r\n * `^`, the scientific-notation rule — and everything a language is free to\r\n * disagree about is here. That is what lets the document's `sin` be degrees and\r\n * a function plot's be radians without two parsers: the trig unit is a property\r\n * of a table, not of the grammar.\r\n */\r\nexport interface ExpressionDialect {\r\n /** Names callable as `f(…)`, and how many arguments each takes. */\r\n functions: Record<string, FnArity>;\r\n /** Bare identifiers that are values. Folded at parse time, so one can never also be a reference. */\r\n constants: Record<string, number>;\r\n /**\r\n * How a reference is spelled. `\"bracket\"` is `[id]`, and is the only mode in\r\n * which `[` is a legal character; `\"bare\"` makes any identifier that is not a\r\n * call or a constant a reference.\r\n */\r\n refs: \"bracket\" | \"bare\";\r\n /** What an identifier that resolves to nothing says. The document points at `[id]`; a plot does not. */\r\n unknownName(name: string): string;\r\n}\r\n\r\n// ── Compilation ──────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Resolves a name to a read function, or `undefined` when nothing in the\r\n * document declares it. The read is what the compiled binding calls, once per\r\n * evaluation of the prop it drives.\r\n */\r\nexport type VariableResolver = (name: string) => (() => unknown) | undefined;\r\n\r\n/**\r\n * A prop value, compiled: either a plain value or the binding an expression\r\n * somewhere inside it produced.\r\n */\r\nexport type CompiledValue =\r\n | { dynamic: false; value: unknown }\r\n | { dynamic: true; read: () => unknown };\r\n\r\n/** A props bag, split into what a constructor can take and what has to be bound. */\r\nexport interface CompiledProps {\r\n /**\r\n * Props with no expression in them.\r\n *\r\n * Handed to the node's constructor as-is. A bound prop is deliberately\r\n * *absent* here rather than present as a placeholder: a node's constructor\r\n * reads its raw props to decide things like a default size, and a\r\n * placeholder would answer those questions with a lie.\r\n */\r\n literal: Record<string, unknown>;\r\n /** Field → binding, applied with `node.set()` once the variables exist. */\r\n bindings: Record<string, () => unknown>;\r\n /** True when {@link CompiledProps.bindings} has anything in it. */\r\n hasBindings: boolean;\r\n}\r\n\r\n/** One expression found in a document, and where. */\r\nexport interface ExpressionSite {\r\n /** JSON-Pointer-style path, matching `ValidationIssue.path`. */\r\n path: string;\r\n /** The raw prop value, `=` and all. */\r\n source: string;\r\n}\r\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/document/expression/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,yFAAyF;AACzF,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACtC,iFAAiF;IACxE,MAAM,CAAS;IACxB,sFAAsF;IAC7E,QAAQ,CAAS;IAC1B,6EAA6E;IACpE,IAAI,CAAU;IAEvB,YAAY,OAAe,EAAE,MAAc,EAAE,QAAQ,GAAG,CAAC,CAAC,EAAE,IAAa;QACrE,MAAM,KAAK,GAAG,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,QAAQ,GAAG,CAAC,QAAQ,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC;QACrG,KAAK,CAAC,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ","sourcesContent":["/**\n * Every type the expression module names, in one place.\n *\n * The vocabulary is small and worth seeing at once, because the whole module is\n * four representations and the steps between them:\n *\n * a prop value ──▶ \"=4[g]+3\" ──▶ ExpressionNode ──▶ () => unknown\n * at any depth the marked the AST, per a prop binding\n * (walk) string dialect (parse) (compile)\n *\n * The `=` appears in exactly one of those steps. It marks a *document prop* as a\n * formula, which is recognition, not grammar — `=` is not a legal character in\n * any dialect — so the walk strips it and the parser never sees one.\n */\n\n/** Thrown for a formula that cannot be parsed or whose reference resolves to nothing. */\nexport class ExpressionError extends Error {\n /** The formula as the parser received it: no marker, and no surrounding prop. */\n readonly source: string;\n /** Character offset into {@link source}, or `-1` when the whole thing is at fault. */\n readonly position: number;\n /** Where in the props bag it was written, JSON-Pointer style, when known. */\n readonly path?: string;\n\n constructor(message: string, source: string, position = -1, path?: string) {\n const where = position >= 0 ? ` (at character ${position + 1} of \"${source}\")` : ` (in \"${source}\")`;\n super(`${message}${where}${path ? ` at ${path}` : \"\"}`);\n this.name = \"ExpressionError\";\n this.source = source;\n this.position = position;\n this.path = path;\n }\n}\n\n// ── The syntax tree ──────────────────────────────────────────────────────────\n\nexport type BinaryOp = \"+\" | \"-\" | \"*\" | \"/\" | \"%\" | \"^\";\n\n/** One node of a parsed formula. Kept public so a host can lint or rewrite one. */\nexport type ExpressionNode =\n | { kind: \"const\"; value: number }\n | { kind: \"ref\"; name: string }\n | { kind: \"unary\"; op: \"-\"; operand: ExpressionNode }\n | { kind: \"binary\"; op: BinaryOp; left: ExpressionNode; right: ExpressionNode }\n | { kind: \"call\"; name: string; args: ExpressionNode[] };\n\n/** A formula, parsed. Resolver-free, so it can be checked without a scene. */\nexport interface ParsedExpression {\n /** The formula's text as the parser received it — no marker. */\n readonly source: string;\n readonly root: ExpressionNode;\n /** Names it reads, de-duplicated, in first-seen order. */\n readonly refs: readonly string[];\n /**\n * True when the formula is exactly one reference and nothing else.\n *\n * The passthrough case: the document's compiled binding returns the\n * variable's value untouched rather than coercing it to a number, which is\n * what lets a variable hold a colour, a `Vector2` or any other prop value.\n * A dialect whose references are bare identifiers sets it for a lone\n * variable too (`\"x\"`), where it means nothing — only the document's\n * compiler reads it.\n */\n readonly passthrough: boolean;\n}\n\n// ── Dialects ─────────────────────────────────────────────────────────────────\n\n/** What the parser needs to know about a function. What it *does* is the back end's. */\nexport interface FnArity {\n /** Minimum and maximum argument count; `Infinity` for variadic. */\n arity: [number, number];\n}\n\n/**\n * One language over the shared grammar.\n *\n * The grammar is fixed — precedence, implicit multiplication, right-associative\n * `^`, the scientific-notation rule — and everything a language is free to\n * disagree about is here. That is what lets the document's `sin` be degrees and\n * a function plot's be radians without two parsers: the trig unit is a property\n * of a table, not of the grammar.\n */\nexport interface ExpressionDialect {\n /** Names callable as `f(…)`, and how many arguments each takes. */\n functions: Record<string, FnArity>;\n /** Bare identifiers that are values. Folded at parse time, so one can never also be a reference. */\n constants: Record<string, number>;\n /**\n * How a reference is spelled. `\"bracket\"` is `[id]`, and is the only mode in\n * which `[` is a legal character; `\"bare\"` makes any identifier that is not a\n * call or a constant a reference.\n */\n refs: \"bracket\" | \"bare\";\n /** What an identifier that resolves to nothing says. The document points at `[id]`; a plot does not. */\n unknownName(name: string): string;\n}\n\n// ── Compilation ──────────────────────────────────────────────────────────────\n\n/**\n * Resolves a name to a read function, or `undefined` when nothing in the\n * document declares it. The read is what the compiled binding calls, once per\n * evaluation of the prop it drives.\n */\nexport type VariableResolver = (name: string) => (() => unknown) | undefined;\n\n/**\n * A prop value, compiled: either a plain value or the binding an expression\n * somewhere inside it produced.\n */\nexport type CompiledValue =\n | { dynamic: false; value: unknown }\n | { dynamic: true; read: () => unknown };\n\n/** A props bag, split into what a constructor can take and what has to be bound. */\nexport interface CompiledProps {\n /**\n * Props with no expression in them.\n *\n * Handed to the node's constructor as-is. A bound prop is deliberately\n * *absent* here rather than present as a placeholder: a node's constructor\n * reads its raw props to decide things like a default size, and a\n * placeholder would answer those questions with a lie.\n */\n literal: Record<string, unknown>;\n /** Field → binding, applied with `node.set()` once the variables exist. */\n bindings: Record<string, () => unknown>;\n /** True when {@link CompiledProps.bindings} has anything in it. */\n hasBindings: boolean;\n}\n\n/** One expression found in a document, and where. */\nexport interface ExpressionSite {\n /** JSON-Pointer-style path, matching `ValidationIssue.path`. */\n path: string;\n /** The raw prop value, `=` and all. */\n source: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"walk.js","sourceRoot":"","sources":["../../../src/document/expression/walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KA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AAC,IAAI,EAAE,CAAC,CAAC;YAChC,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC;QACpD,CAAC,CAAC,CAAC,CAAC;IACR,CAAC,CAAC,CAAC;IACH,OAAQ,MAAuB,CAAC,KAAK,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,CAAU;IAC7B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["/**\r\n * Recognition, and the one walk over an authored prop value.\r\n *\r\n * There were two walks — one compiling, one collecting — with the same three\r\n * cases and different leaves, and they had already drifted: the compiling one\r\n * read `Object.keys`, the collecting one `for…in`. Neither carried a path, so an\r\n * `ExpressionError` from a formula nested inside a `fill` array named the\r\n * formula and left the reader to find which prop it was written in.\r\n *\r\n * One recursion now, parameterized by what to do with a string. `bind` returns a\r\n * replacement, so containers are rebuilt around it; `collect` returns its input,\r\n * so nothing is rebuilt and the result is thrown away.\r\n */\r\nimport { compile } from \"./compile\";\r\nimport { parse } from \"./parse\";\r\nimport type { CompiledProps, CompiledValue, ExpressionSite, VariableResolver } from \"./types\";\r\n\r\n/**\r\n * True when a value is a formula rather than a string.\r\n *\r\n * `\"==\"` is the escape, so `\"==total\"` is the literal `\"=total\"` and not an\r\n * expression; a bare `\"=\"` is likewise just that string. Both are handled by\r\n * {@link unescape}, which every literal path runs values through.\r\n */\r\nexport function isSource(value: unknown): value is string {\r\n return typeof value === \"string\" && value.length > 1 && value[0] === \"=\" && value[1] !== \"=\";\r\n}\r\n\r\n/** Strip the escape from a literal string that begins with `=`. `\"==x\"` → `\"=x\"`. */\r\nexport function unescape(value: string): string {\r\n return value.startsWith(\"==\") ? value.slice(1) : value;\r\n}\r\n\r\n/** What the walk does with each string it reaches. Returns the value to put back. */\r\ntype StringHandler = (source: string, path: string) => CompiledValue;\r\n\r\nconst STATIC = (value: unknown): CompiledValue => ({ dynamic: false, value });\r\n\r\n/**\r\n * Visit every string in an authored value, at any depth.\r\n *\r\n * An expression is recognised at any depth, not just as a whole prop, because\r\n * half the props worth driving are compound: `{\"origin\": {\"x\": \"=[g]\", \"y\": 0}}`,\r\n * `{\"fill\": [\"#111\", {\"type\": \"solid\", \"color\": \"=[c]\"}]}`. A container holding\r\n * one is rebuilt on each recompute; a container holding none is passed through\r\n * **by identity**, so a scene that uses no expressions allocates nothing and\r\n * compares equal to the document it came from.\r\n */\r\nfunction walk(value: unknown, path: string, onString: StringHandler): CompiledValue {\r\n if (typeof value === \"string\") return onString(value, path);\r\n\r\n if (Array.isArray(value)) {\r\n const parts = value.map((v, i) => walk(v, `${path}[${i}]`, onString));\r\n if (parts.some((p) => p.dynamic)) {\r\n return { dynamic: true, read: () => parts.map((p) => (p.dynamic ? p.read() : p.value)) };\r\n }\r\n // Rebuild only if a leaf actually changed, so the common case keeps the\r\n // document's own array.\r\n const rebuilt = parts.map((p) => (p as { value: unknown }).value);\r\n return STATIC(rebuilt.every((v, i) => v === value[i]) ? value : rebuilt);\r\n }\r\n\r\n if (isPlainObject(value)) {\r\n const keys = Object.keys(value);\r\n const parts = keys.map((k) => walk(value[k], `${path}.${k}`, onString));\r\n if (parts.some((p) => p.dynamic)) {\r\n return {\r\n dynamic: true,\r\n read: () => {\r\n const out: Record<string, unknown> = {};\r\n keys.forEach((k, i) => {\r\n const part = parts[i];\r\n out[k] = part.dynamic ? part.read() : part.value;\r\n });\r\n return out;\r\n },\r\n };\r\n }\r\n if (!parts.some((p, i) => (p as { value: unknown }).value !== value[keys[i]])) return STATIC(value);\r\n const rebuilt: Record<string, unknown> = {};\r\n keys.forEach((k, i) => { rebuilt[k] = (parts[i] as { value: unknown }).value; });\r\n return STATIC(rebuilt);\r\n }\r\n\r\n return STATIC(value);\r\n}\r\n\r\n/** Compile one authored prop value: a plain value, or the binding it produced. */\r\nexport function bind(value: unknown, resolve: VariableResolver, path = \"props\"): CompiledValue {\r\n return walk(value, path, (source, at) =>\r\n isSource(source)\r\n // The `=` is the document's marker, not the grammar's — strip it here\r\n // and the parser never sees one.\r\n ? { dynamic: true, read: compile(parse(source.slice(1)), resolve, at) }\r\n : STATIC(unescape(source)));\r\n}\r\n\r\n/** Compile a whole props bag. See {@link CompiledProps}. */\r\nexport function bindProps(\r\n props: Record<string, unknown> | undefined,\r\n resolve: VariableResolver,\r\n path = \"props\",\r\n): CompiledProps {\r\n const literal: Record<string, unknown> = {};\r\n const bindings: Record<string, () => unknown> = {};\r\n let hasBindings = false;\r\n\r\n for (const key of Object.keys(props ?? {})) {\r\n const compiled = bind(props![key], resolve, `${path}.${key}`);\r\n if (compiled.dynamic) {\r\n bindings[key] = compiled.read;\r\n hasBindings = true;\r\n } else {\r\n literal[key] = compiled.value;\r\n }\r\n }\r\n return { literal, bindings, hasBindings };\r\n}\r\n\r\n/**\r\n * Find every expression inside an authored value, at any depth.\r\n *\r\n * Used by the validator, which checks that each one parses and names a declared\r\n * variable — the two failures worth catching before anything is built.\r\n */\r\nexport function collect(value: unknown, path: string): ExpressionSite[] {\r\n const out: ExpressionSite[] = [];\r\n walk(value, path, (source, at) => {\r\n if (isSource(source)) out.push({ path: at, source });\r\n return STATIC(source);\r\n });\r\n return out;\r\n}\r\n\r\n/** A bracketed reference. The grammar has no string literals, so a `[` is always one. */\r\nconst REF = /\\[([^[\\]]+)\\]/g;\r\n\r\n/**\r\n * Rewrite the references inside every expression in an authored value.\r\n *\r\n * `rename` sees each reference as written (`\"fade\"`, `\"card.x\"`) and returns its\r\n * replacement, or `undefined` to keep it. What a host moving a subtree between\r\n * documents needs when ids or keys change on the way; a value with nothing to\r\n * rewrite comes back **by identity**, the same as {@link bind}'s static path.\r\n */\r\nexport function renameRefs<T>(value: T, rename: (ref: string) => string | undefined): T {\r\n const result = walk(value, \"\", (source) => {\r\n if (!isSource(source)) return STATIC(source);\r\n return STATIC(source.replace(REF, (whole, ref: string) => {\r\n // The parser trims a reference's name (`[ g ]` reads `g`), so the callback sees it trimmed too.\r\n const next = rename(ref.trim());\r\n return next === undefined ? whole : `[${next}]`;\r\n }));\r\n });\r\n return (result as { value: T }).value;\r\n}\r\n\r\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\r\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\r\n}\r\n"]}
1
+ {"version":3,"file":"walk.js","sourceRoot":"","sources":["../../../src/document/expression/walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AACjG,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,QAAQ,CAAC,KAAa;IAClC,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3D,CAAC;AAKD,MAAM,MAAM,GAAG,CAAC,KAAc,EAAiB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAE9E;;;;;;;;;GASG;AACH,SAAS,IAAI,CAAC,KAAc,EAAE,IAAY,EAAE,QAAuB;IAC/D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAE5D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,KA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C,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACf,CAAC;AAED,yFAAyF;AACzF,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAE7B;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAI,KAAQ,EAAE,MAA2C;IAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE;QACtC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;YACrD,gGAAgG;YAChG,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAChC,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC;QACpD,CAAC,CAAC,CAAC,CAAC;IACR,CAAC,CAAC,CAAC;IACH,OAAQ,MAAuB,CAAC,KAAK,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,CAAU;IAC7B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["/**\n * Recognition, and the one walk over an authored prop value.\n *\n * There were two walks — one compiling, one collecting — with the same three\n * cases and different leaves, and they had already drifted: the compiling one\n * read `Object.keys`, the collecting one `for…in`. Neither carried a path, so an\n * `ExpressionError` from a formula nested inside a `fill` array named the\n * formula and left the reader to find which prop it was written in.\n *\n * One recursion now, parameterized by what to do with a string. `bind` returns a\n * replacement, so containers are rebuilt around it; `collect` returns its input,\n * so nothing is rebuilt and the result is thrown away.\n */\nimport { compile } from \"./compile\";\nimport { parse } from \"./parse\";\nimport type { CompiledProps, CompiledValue, ExpressionSite, VariableResolver } from \"./types\";\n\n/**\n * True when a value is a formula rather than a string.\n *\n * `\"==\"` is the escape, so `\"==total\"` is the literal `\"=total\"` and not an\n * expression; a bare `\"=\"` is likewise just that string. Both are handled by\n * {@link unescape}, which every literal path runs values through.\n */\nexport function isSource(value: unknown): value is string {\n return typeof value === \"string\" && value.length > 1 && value[0] === \"=\" && value[1] !== \"=\";\n}\n\n/** Strip the escape from a literal string that begins with `=`. `\"==x\"` → `\"=x\"`. */\nexport function unescape(value: string): string {\n return value.startsWith(\"==\") ? value.slice(1) : value;\n}\n\n/** What the walk does with each string it reaches. Returns the value to put back. */\ntype StringHandler = (source: string, path: string) => CompiledValue;\n\nconst STATIC = (value: unknown): CompiledValue => ({ dynamic: false, value });\n\n/**\n * Visit every string in an authored value, at any depth.\n *\n * An expression is recognised at any depth, not just as a whole prop, because\n * half the props worth driving are compound: `{\"origin\": {\"x\": \"=[g]\", \"y\": 0}}`,\n * `{\"fill\": [\"#111\", {\"type\": \"solid\", \"color\": \"=[c]\"}]}`. A container holding\n * one is rebuilt on each recompute; a container holding none is passed through\n * **by identity**, so a scene that uses no expressions allocates nothing and\n * compares equal to the document it came from.\n */\nfunction walk(value: unknown, path: string, onString: StringHandler): CompiledValue {\n if (typeof value === \"string\") return onString(value, path);\n\n if (Array.isArray(value)) {\n const parts = value.map((v, i) => walk(v, `${path}[${i}]`, onString));\n if (parts.some((p) => p.dynamic)) {\n return { dynamic: true, read: () => parts.map((p) => (p.dynamic ? p.read() : p.value)) };\n }\n // Rebuild only if a leaf actually changed, so the common case keeps the\n // document's own array.\n const rebuilt = parts.map((p) => (p as { value: unknown }).value);\n return STATIC(rebuilt.every((v, i) => v === value[i]) ? value : rebuilt);\n }\n\n if (isPlainObject(value)) {\n const keys = Object.keys(value);\n const parts = keys.map((k) => walk(value[k], `${path}.${k}`, onString));\n if (parts.some((p) => p.dynamic)) {\n return {\n dynamic: true,\n read: () => {\n const out: Record<string, unknown> = {};\n keys.forEach((k, i) => {\n const part = parts[i];\n out[k] = part.dynamic ? part.read() : part.value;\n });\n return out;\n },\n };\n }\n if (!parts.some((p, i) => (p as { value: unknown }).value !== value[keys[i]])) return STATIC(value);\n const rebuilt: Record<string, unknown> = {};\n keys.forEach((k, i) => { rebuilt[k] = (parts[i] as { value: unknown }).value; });\n return STATIC(rebuilt);\n }\n\n return STATIC(value);\n}\n\n/** Compile one authored prop value: a plain value, or the binding it produced. */\nexport function bind(value: unknown, resolve: VariableResolver, path = \"props\"): CompiledValue {\n return walk(value, path, (source, at) =>\n isSource(source)\n // The `=` is the document's marker, not the grammar's — strip it here\n // and the parser never sees one.\n ? { dynamic: true, read: compile(parse(source.slice(1)), resolve, at) }\n : STATIC(unescape(source)));\n}\n\n/** Compile a whole props bag. See {@link CompiledProps}. */\nexport function bindProps(\n props: Record<string, unknown> | undefined,\n resolve: VariableResolver,\n path = \"props\",\n): CompiledProps {\n const literal: Record<string, unknown> = {};\n const bindings: Record<string, () => unknown> = {};\n let hasBindings = false;\n\n for (const key of Object.keys(props ?? {})) {\n const compiled = bind(props![key], resolve, `${path}.${key}`);\n if (compiled.dynamic) {\n bindings[key] = compiled.read;\n hasBindings = true;\n } else {\n literal[key] = compiled.value;\n }\n }\n return { literal, bindings, hasBindings };\n}\n\n/**\n * Find every expression inside an authored value, at any depth.\n *\n * Used by the validator, which checks that each one parses and names a declared\n * variable — the two failures worth catching before anything is built.\n */\nexport function collect(value: unknown, path: string): ExpressionSite[] {\n const out: ExpressionSite[] = [];\n walk(value, path, (source, at) => {\n if (isSource(source)) out.push({ path: at, source });\n return STATIC(source);\n });\n return out;\n}\n\n/** A bracketed reference. The grammar has no string literals, so a `[` is always one. */\nconst REF = /\\[([^[\\]]+)\\]/g;\n\n/**\n * Rewrite the references inside every expression in an authored value.\n *\n * `rename` sees each reference as written (`\"fade\"`, `\"card.x\"`) and returns its\n * replacement, or `undefined` to keep it. What a host moving a subtree between\n * documents needs when ids or keys change on the way; a value with nothing to\n * rewrite comes back **by identity**, the same as {@link bind}'s static path.\n */\nexport function renameRefs<T>(value: T, rename: (ref: string) => string | undefined): T {\n const result = walk(value, \"\", (source) => {\n if (!isSource(source)) return STATIC(source);\n return STATIC(source.replace(REF, (whole, ref: string) => {\n // The parser trims a reference's name (`[ g ]` reads `g`), so the callback sees it trimmed too.\n const next = rename(ref.trim());\n return next === undefined ? whole : `[${next}]`;\n }));\n });\n return (result as { value: T }).value;\n}\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n"]}
@@ -2,6 +2,14 @@ export * from "./types.js";
2
2
  export * from "./project.js";
3
3
  export * from "./expression/index.js";
4
4
  export * from "./validate.js";
5
+ export { DOCUMENT_FORMAT_VERSION, DOCUMENT_MIGRATIONS, DocumentTooNewError, documentFormatVersion, migrateDocument, } from "./migrate.js";
6
+ export type { DocumentChange, DocumentMigration, DocumentMigrationResult, JsonDocument, NoteChange } from "./migrate.js";
7
+ export { migrateNodeProps } from "./prop-evolution.js";
8
+ export type { PropEvolution, PropMigration, PropNote } from "./prop-evolution.js";
9
+ export { missingNodeOf } from "./missing-node.js";
10
+ export { registryVocabulary, vocabularyBreaks } from "./vocabulary.js";
11
+ export type { RegistryVocabulary, VocabularyBreak } from "./vocabulary.js";
12
+ export type { MissingNodeInfo } from "./missing-node.js";
5
13
  export * from "./registry.js";
6
14
  export * from "./node-descriptor.js";
7
15
  export { NODE_META, getNodeDescriptor } from "./node-decorator.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GAClB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACtH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -2,6 +2,10 @@ export * from "./types.js";
2
2
  export * from "./project.js";
3
3
  export * from "./expression/index.js";
4
4
  export * from "./validate.js";
5
+ export { DOCUMENT_FORMAT_VERSION, DOCUMENT_MIGRATIONS, DocumentTooNewError, documentFormatVersion, migrateDocument, } from "./migrate.js";
6
+ export { migrateNodeProps } from "./prop-evolution.js";
7
+ export { missingNodeOf } from "./missing-node.js";
8
+ export { registryVocabulary, vocabularyBreaks } from "./vocabulary.js";
5
9
  export * from "./registry.js";
6
10
  export * from "./node-descriptor.js";
7
11
  export { NODE_META, getNodeDescriptor } from "./node-decorator.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,iFAAiF;AACjF,2EAA2E;AAC3E,mBAAmB","sourcesContent":["export * from \"./types\";\r\nexport * from \"./project\";\r\nexport * from \"./expression\";\r\nexport * from \"./validate\";\r\nexport * from \"./registry\";\r\nexport * from \"./node-descriptor\";\r\nexport { NODE_META, getNodeDescriptor } from \"./node-decorator\";\r\nexport * from \"./placement\";\r\nexport * from \"./timeline\";\r\nexport * from \"./audio\";\r\n// `installBuiltins` is deliberately NOT exported: a `Registry` seeds itself from\r\n// its own constructor, so a host has no module-scope call for a bundler to\r\n// tree-shake away.\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGpE,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,iFAAiF;AACjF,2EAA2E;AAC3E,mBAAmB","sourcesContent":["export * from \"./types\";\nexport * from \"./project\";\nexport * from \"./expression\";\nexport * from \"./validate\";\nexport {\n DOCUMENT_FORMAT_VERSION,\n DOCUMENT_MIGRATIONS,\n DocumentTooNewError,\n documentFormatVersion,\n migrateDocument,\n} from \"./migrate\";\nexport type { DocumentChange, DocumentMigration, DocumentMigrationResult, JsonDocument, NoteChange } from \"./migrate\";\nexport { migrateNodeProps } from \"./prop-evolution\";\nexport type { PropEvolution, PropMigration, PropNote } from \"./prop-evolution\";\nexport { missingNodeOf } from \"./missing-node\";\nexport { registryVocabulary, vocabularyBreaks } from \"./vocabulary\";\nexport type { RegistryVocabulary, VocabularyBreak } from \"./vocabulary\";\nexport type { MissingNodeInfo } from \"./missing-node\";\nexport * from \"./registry\";\nexport * from \"./node-descriptor\";\nexport { NODE_META, getNodeDescriptor } from \"./node-decorator\";\nexport * from \"./placement\";\nexport * from \"./timeline\";\nexport * from \"./audio\";\n// `installBuiltins` is deliberately NOT exported: a `Registry` seeds itself from\n// its own constructor, so a host has no module-scope call for a bundler to\n// tree-shake away.\n"]}