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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (615) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +2 -4
  3. package/dist/assets/errors.js +4 -5
  4. package/dist/assets/errors.js.map +1 -1
  5. package/dist/assets/scope.d.ts +1 -1
  6. package/dist/assets/scope.d.ts.map +1 -1
  7. package/dist/assets/scope.js +1 -1
  8. package/dist/assets/scope.js.map +1 -1
  9. package/dist/attributes/audio/schedule.d.ts +3 -18
  10. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  11. package/dist/attributes/audio/schedule.js.map +1 -1
  12. package/dist/attributes/index.d.ts +3 -5
  13. package/dist/attributes/index.d.ts.map +1 -1
  14. package/dist/attributes/index.js +2 -2
  15. package/dist/attributes/index.js.map +1 -1
  16. package/dist/attributes/layout/insets.d.ts +1 -1
  17. package/dist/attributes/layout/insets.js.map +1 -1
  18. package/dist/attributes/layout/size.d.ts +1 -1
  19. package/dist/attributes/layout/size.js +1 -1
  20. package/dist/attributes/layout/size.js.map +1 -1
  21. package/dist/attributes/properties/decorator.d.ts +44 -11
  22. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  23. package/dist/attributes/properties/decorator.js +37 -9
  24. package/dist/attributes/properties/decorator.js.map +1 -1
  25. package/dist/attributes/properties/inputs.d.ts +1 -1
  26. package/dist/attributes/properties/inputs.js +1 -1
  27. package/dist/attributes/properties/inputs.js.map +1 -1
  28. package/dist/attributes/properties/typed.d.ts +19 -140
  29. package/dist/attributes/properties/typed.d.ts.map +1 -1
  30. package/dist/attributes/properties/typed.js +12 -108
  31. package/dist/attributes/properties/typed.js.map +1 -1
  32. package/dist/attributes/shape/corners/corner-radius.d.ts +1 -1
  33. package/dist/attributes/shape/corners/corner-radius.js +1 -1
  34. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  35. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +1 -1
  36. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  37. package/dist/attributes/shape/fill/color/parser.d.ts +1 -1
  38. package/dist/attributes/shape/fill/color/parser.js +1 -1
  39. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  40. package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -2
  41. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  42. package/dist/attributes/shape/fill/implementations/shader.d.ts +2 -2
  43. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  44. package/dist/attributes/shape/fill/implementations/video.d.ts +1 -1
  45. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  46. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  47. package/dist/attributes/shape/fill/lerp.d.ts +1 -1
  48. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  49. package/dist/attributes/shape/filters/chain.d.ts +1 -1
  50. package/dist/attributes/shape/filters/chain.js +1 -1
  51. package/dist/attributes/shape/filters/chain.js.map +1 -1
  52. package/dist/attributes/shape/filters/union.d.ts +4 -3
  53. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  54. package/dist/attributes/shape/filters/union.js.map +1 -1
  55. package/dist/attributes/shape/path/ops.d.ts +1 -2
  56. package/dist/attributes/shape/path/ops.d.ts.map +1 -1
  57. package/dist/attributes/shape/path/ops.js.map +1 -1
  58. package/dist/attributes/shared/operators.d.ts +2 -2
  59. package/dist/attributes/shared/operators.js.map +1 -1
  60. package/dist/attributes/text/types.d.ts +2 -3
  61. package/dist/attributes/text/types.d.ts.map +1 -1
  62. package/dist/attributes/text/types.js.map +1 -1
  63. package/dist/browser/chunks/chunk-D4FSTPML.js +14 -0
  64. package/dist/browser/chunks/chunk-D4FSTPML.js.map +7 -0
  65. package/dist/browser/chunks/chunk-LKUYVFU3.js +2 -0
  66. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +7 -0
  67. package/dist/browser/chunks/chunk-RTNATFWX.js +5 -0
  68. package/dist/browser/chunks/chunk-RTNATFWX.js.map +7 -0
  69. package/dist/browser/chunks/chunk-ZRPZPWZU.js +3 -0
  70. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +7 -0
  71. package/dist/browser/component.js +1 -1
  72. package/dist/browser/component.js.map +4 -4
  73. package/dist/browser/experimental.js +2 -0
  74. package/dist/browser/index.js +1 -1
  75. package/dist/browser/index.js.map +4 -4
  76. package/dist/browser/manifest.json +3 -4
  77. package/dist/browser/sdk.js +1 -1
  78. package/dist/component/api.d.ts +508 -0
  79. package/dist/component/api.d.ts.map +1 -0
  80. package/dist/component/api.js +4 -0
  81. package/dist/component/api.js.map +1 -0
  82. package/dist/component/builtins/audio.d.ts +26 -0
  83. package/dist/component/builtins/audio.d.ts.map +1 -0
  84. package/dist/component/builtins/audio.js +41 -0
  85. package/dist/component/builtins/audio.js.map +1 -0
  86. package/dist/component/builtins/canvas3d.d.ts +98 -0
  87. package/dist/component/builtins/canvas3d.d.ts.map +1 -0
  88. package/dist/component/builtins/canvas3d.js +21 -0
  89. package/dist/component/builtins/canvas3d.js.map +1 -0
  90. package/dist/component/builtins/composite.d.ts +56 -0
  91. package/dist/component/builtins/composite.d.ts.map +1 -0
  92. package/dist/component/builtins/composite.js +25 -0
  93. package/dist/component/builtins/composite.js.map +1 -0
  94. package/dist/component/builtins/geometry.d.ts +505 -0
  95. package/dist/component/builtins/geometry.d.ts.map +1 -0
  96. package/dist/component/builtins/geometry.js +107 -0
  97. package/dist/component/builtins/geometry.js.map +1 -0
  98. package/dist/component/builtins/layout.d.ts +88 -0
  99. package/dist/component/builtins/layout.d.ts.map +1 -0
  100. package/dist/component/builtins/layout.js +84 -0
  101. package/dist/component/builtins/layout.js.map +1 -0
  102. package/dist/component/builtins/media.d.ts +95 -0
  103. package/dist/component/builtins/media.d.ts.map +1 -0
  104. package/dist/component/builtins/media.js +149 -0
  105. package/dist/component/builtins/media.js.map +1 -0
  106. package/dist/component/builtins/providers.d.ts +23 -0
  107. package/dist/component/builtins/providers.d.ts.map +1 -0
  108. package/dist/component/builtins/providers.js +30 -0
  109. package/dist/component/builtins/providers.js.map +1 -0
  110. package/dist/component/builtins/text.d.ts +193 -0
  111. package/dist/component/builtins/text.d.ts.map +1 -0
  112. package/dist/component/builtins/text.js +113 -0
  113. package/dist/component/builtins/text.js.map +1 -0
  114. package/dist/component/builtins/three.d.ts +1085 -0
  115. package/dist/component/builtins/three.d.ts.map +1 -0
  116. package/dist/component/builtins/three.js +265 -0
  117. package/dist/component/builtins/three.js.map +1 -0
  118. package/dist/component/clip-of.d.ts +5 -0
  119. package/dist/component/clip-of.d.ts.map +1 -0
  120. package/dist/component/clip-of.js +33 -0
  121. package/dist/component/clip-of.js.map +1 -0
  122. package/dist/component/commands-for.d.ts +19 -0
  123. package/dist/component/commands-for.d.ts.map +1 -0
  124. package/dist/component/commands-for.js +5 -0
  125. package/dist/component/commands-for.js.map +1 -0
  126. package/dist/component/component-audio.d.ts +9 -0
  127. package/dist/component/component-audio.d.ts.map +1 -0
  128. package/dist/component/component-audio.js +18 -0
  129. package/dist/component/component-audio.js.map +1 -0
  130. package/dist/component/component2d.d.ts +9 -0
  131. package/dist/component/component2d.d.ts.map +1 -0
  132. package/dist/component/component2d.js +239 -0
  133. package/dist/component/component2d.js.map +1 -0
  134. package/dist/component/component3d.d.ts +9 -0
  135. package/dist/component/component3d.d.ts.map +1 -0
  136. package/dist/component/component3d.js +99 -0
  137. package/dist/component/component3d.js.map +1 -0
  138. package/dist/component/factory.d.ts +63 -0
  139. package/dist/component/factory.d.ts.map +1 -0
  140. package/dist/component/factory.js +313 -0
  141. package/dist/component/factory.js.map +1 -0
  142. package/dist/component/modules/aim.d.ts +30 -0
  143. package/dist/component/modules/aim.d.ts.map +1 -0
  144. package/dist/component/modules/aim.js +39 -0
  145. package/dist/component/modules/aim.js.map +1 -0
  146. package/dist/component/modules/corners.d.ts +13 -0
  147. package/dist/component/modules/corners.d.ts.map +1 -0
  148. package/dist/component/modules/corners.js +12 -0
  149. package/dist/component/modules/corners.js.map +1 -0
  150. package/dist/component/modules/flow.d.ts +26 -0
  151. package/dist/component/modules/flow.d.ts.map +1 -0
  152. package/dist/component/modules/flow.js +55 -0
  153. package/dist/component/modules/flow.js.map +1 -0
  154. package/dist/component/modules/material.d.ts +40 -0
  155. package/dist/component/modules/material.d.ts.map +1 -0
  156. package/dist/component/modules/material.js +75 -0
  157. package/dist/component/modules/material.js.map +1 -0
  158. package/dist/component/modules/paint.d.ts +71 -0
  159. package/dist/component/modules/paint.d.ts.map +1 -0
  160. package/dist/component/modules/paint.js +106 -0
  161. package/dist/component/modules/paint.js.map +1 -0
  162. package/dist/component/modules/shapes.d.ts +31 -0
  163. package/dist/component/modules/shapes.d.ts.map +1 -0
  164. package/dist/component/modules/shapes.js +43 -0
  165. package/dist/component/modules/shapes.js.map +1 -0
  166. package/dist/component/modules/text-layout.d.ts +26 -0
  167. package/dist/component/modules/text-layout.d.ts.map +1 -0
  168. package/dist/component/modules/text-layout.js +57 -0
  169. package/dist/component/modules/text-layout.js.map +1 -0
  170. package/dist/component/modules/text-style.d.ts +48 -0
  171. package/dist/component/modules/text-style.d.ts.map +1 -0
  172. package/dist/component/modules/text-style.js +63 -0
  173. package/dist/component/modules/text-style.js.map +1 -0
  174. package/dist/component/modules/three-entries.d.ts +23 -0
  175. package/dist/component/modules/three-entries.d.ts.map +1 -0
  176. package/dist/component/modules/three-entries.js +41 -0
  177. package/dist/component/modules/three-entries.js.map +1 -0
  178. package/dist/component/modules/view3d.d.ts +55 -0
  179. package/dist/component/modules/view3d.d.ts.map +1 -0
  180. package/dist/component/modules/view3d.js +160 -0
  181. package/dist/component/modules/view3d.js.map +1 -0
  182. package/dist/component/timeline.d.ts +22 -0
  183. package/dist/component/timeline.d.ts.map +1 -0
  184. package/dist/component/timeline.js +128 -0
  185. package/dist/component/timeline.js.map +1 -0
  186. package/dist/component/type-def.d.ts +26 -0
  187. package/dist/component/type-def.d.ts.map +1 -0
  188. package/dist/component/type-def.js +16 -0
  189. package/dist/component/type-def.js.map +1 -0
  190. package/dist/component/types.d.ts +91 -0
  191. package/dist/component/types.d.ts.map +1 -0
  192. package/dist/component/types.js +88 -0
  193. package/dist/component/types.js.map +1 -0
  194. package/dist/component/views.d.ts +121 -0
  195. package/dist/component/views.d.ts.map +1 -0
  196. package/dist/component/views.js +413 -0
  197. package/dist/component/views.js.map +1 -0
  198. package/dist/component.d.ts +10 -19
  199. package/dist/component.d.ts.map +1 -1
  200. package/dist/component.js +10 -19
  201. package/dist/component.js.map +1 -1
  202. package/dist/components/builtins/audio/audio.d.ts +53 -0
  203. package/dist/components/builtins/audio/audio.d.ts.map +1 -0
  204. package/dist/components/builtins/audio/audio.js +41 -0
  205. package/dist/components/builtins/audio/audio.js.map +1 -0
  206. package/dist/components/builtins/geometry/composite.d.ts +93 -0
  207. package/dist/components/builtins/geometry/composite.d.ts.map +1 -0
  208. package/dist/components/builtins/geometry/composite.js +25 -0
  209. package/dist/components/builtins/geometry/composite.js.map +1 -0
  210. package/dist/components/builtins/geometry/geometry.d.ts +921 -0
  211. package/dist/components/builtins/geometry/geometry.d.ts.map +1 -0
  212. package/dist/components/builtins/geometry/geometry.js +107 -0
  213. package/dist/components/builtins/geometry/geometry.js.map +1 -0
  214. package/dist/components/builtins/geometry/shape-outline.d.ts +93 -0
  215. package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -0
  216. package/dist/components/builtins/geometry/shape-outline.js +470 -0
  217. package/dist/components/builtins/geometry/shape-outline.js.map +1 -0
  218. package/dist/components/builtins/layout/layout.d.ts +186 -0
  219. package/dist/components/builtins/layout/layout.d.ts.map +1 -0
  220. package/dist/components/builtins/layout/layout.js +84 -0
  221. package/dist/components/builtins/layout/layout.js.map +1 -0
  222. package/dist/components/builtins/media/media.d.ts +240 -0
  223. package/dist/components/builtins/media/media.d.ts.map +1 -0
  224. package/dist/components/builtins/media/media.js +149 -0
  225. package/dist/components/builtins/media/media.js.map +1 -0
  226. package/dist/components/builtins/providers/providers.d.ts +47 -0
  227. package/dist/components/builtins/providers/providers.d.ts.map +1 -0
  228. package/dist/components/builtins/providers/providers.js +30 -0
  229. package/dist/components/builtins/providers/providers.js.map +1 -0
  230. package/dist/components/builtins/text/number-format.d.ts +66 -0
  231. package/dist/components/builtins/text/number-format.d.ts.map +1 -0
  232. package/dist/components/builtins/text/number-format.js +227 -0
  233. package/dist/components/builtins/text/number-format.js.map +1 -0
  234. package/dist/components/builtins/text/number-pattern.d.ts +51 -0
  235. package/dist/components/builtins/text/number-pattern.d.ts.map +1 -0
  236. package/dist/components/builtins/text/number-pattern.js +77 -0
  237. package/dist/components/builtins/text/number-pattern.js.map +1 -0
  238. package/dist/components/builtins/text/text-defaults.d.ts +32 -0
  239. package/dist/components/builtins/text/text-defaults.d.ts.map +1 -0
  240. package/dist/components/builtins/text/text-defaults.js +37 -0
  241. package/dist/components/builtins/text/text-defaults.js.map +1 -0
  242. package/dist/components/builtins/text/text-layout.d.ts +82 -0
  243. package/dist/components/builtins/text/text-layout.d.ts.map +1 -0
  244. package/dist/components/builtins/text/text-layout.js +331 -0
  245. package/dist/components/builtins/text/text-layout.js.map +1 -0
  246. package/dist/components/builtins/text/text.d.ts +409 -0
  247. package/dist/components/builtins/text/text.d.ts.map +1 -0
  248. package/dist/components/builtins/text/text.js +113 -0
  249. package/dist/components/builtins/text/text.js.map +1 -0
  250. package/dist/components/builtins/three/canvas3d.d.ts +245 -0
  251. package/dist/components/builtins/three/canvas3d.d.ts.map +1 -0
  252. package/dist/components/builtins/three/canvas3d.js +21 -0
  253. package/dist/components/builtins/three/canvas3d.js.map +1 -0
  254. package/dist/components/builtins/three/grid-geometry3d.d.ts +62 -0
  255. package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -0
  256. package/dist/components/builtins/three/grid-geometry3d.js +114 -0
  257. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -0
  258. package/dist/components/builtins/three/three.d.ts +1889 -0
  259. package/dist/components/builtins/three/three.d.ts.map +1 -0
  260. package/dist/components/builtins/three/three.js +305 -0
  261. package/dist/components/builtins/three/three.js.map +1 -0
  262. package/dist/components/factory/api.d.ts +516 -0
  263. package/dist/components/factory/api.d.ts.map +1 -0
  264. package/dist/components/factory/api.js +4 -0
  265. package/dist/components/factory/api.js.map +1 -0
  266. package/dist/components/factory/clip-of.d.ts +5 -0
  267. package/dist/components/factory/clip-of.d.ts.map +1 -0
  268. package/dist/components/factory/clip-of.js +33 -0
  269. package/dist/components/factory/clip-of.js.map +1 -0
  270. package/dist/components/factory/commands-for.d.ts +19 -0
  271. package/dist/components/factory/commands-for.d.ts.map +1 -0
  272. package/dist/components/factory/commands-for.js +5 -0
  273. package/dist/components/factory/commands-for.js.map +1 -0
  274. package/dist/components/factory/component-audio.d.ts +9 -0
  275. package/dist/components/factory/component-audio.d.ts.map +1 -0
  276. package/dist/components/factory/component-audio.js +18 -0
  277. package/dist/components/factory/component-audio.js.map +1 -0
  278. package/dist/components/factory/component2d.d.ts +8 -0
  279. package/dist/components/factory/component2d.d.ts.map +1 -0
  280. package/dist/components/factory/component2d.js +240 -0
  281. package/dist/components/factory/component2d.js.map +1 -0
  282. package/dist/components/factory/component3d.d.ts +9 -0
  283. package/dist/components/factory/component3d.d.ts.map +1 -0
  284. package/dist/components/factory/component3d.js +99 -0
  285. package/dist/components/factory/component3d.js.map +1 -0
  286. package/dist/components/factory/factory.d.ts +63 -0
  287. package/dist/components/factory/factory.d.ts.map +1 -0
  288. package/dist/components/factory/factory.js +313 -0
  289. package/dist/components/factory/factory.js.map +1 -0
  290. package/dist/components/factory/timeline.d.ts +22 -0
  291. package/dist/components/factory/timeline.d.ts.map +1 -0
  292. package/dist/components/factory/timeline.js +128 -0
  293. package/dist/components/factory/timeline.js.map +1 -0
  294. package/dist/components/factory/type-def.d.ts +26 -0
  295. package/dist/components/factory/type-def.d.ts.map +1 -0
  296. package/dist/components/factory/type-def.js +16 -0
  297. package/dist/components/factory/type-def.js.map +1 -0
  298. package/dist/components/factory/types.d.ts +91 -0
  299. package/dist/components/factory/types.d.ts.map +1 -0
  300. package/dist/components/factory/types.js +88 -0
  301. package/dist/components/factory/types.js.map +1 -0
  302. package/dist/components/factory/views.d.ts +121 -0
  303. package/dist/components/factory/views.d.ts.map +1 -0
  304. package/dist/components/factory/views.js +413 -0
  305. package/dist/components/factory/views.js.map +1 -0
  306. package/dist/components/modules/aim.d.ts +30 -0
  307. package/dist/components/modules/aim.d.ts.map +1 -0
  308. package/dist/components/modules/aim.js +39 -0
  309. package/dist/components/modules/aim.js.map +1 -0
  310. package/dist/components/modules/corners.d.ts +13 -0
  311. package/dist/components/modules/corners.d.ts.map +1 -0
  312. package/dist/components/modules/corners.js +12 -0
  313. package/dist/components/modules/corners.js.map +1 -0
  314. package/dist/components/modules/flow.d.ts +26 -0
  315. package/dist/components/modules/flow.d.ts.map +1 -0
  316. package/dist/components/modules/flow.js +57 -0
  317. package/dist/components/modules/flow.js.map +1 -0
  318. package/dist/components/modules/material.d.ts +40 -0
  319. package/dist/components/modules/material.d.ts.map +1 -0
  320. package/dist/components/modules/material.js +75 -0
  321. package/dist/components/modules/material.js.map +1 -0
  322. package/dist/components/modules/paint.d.ts +71 -0
  323. package/dist/components/modules/paint.d.ts.map +1 -0
  324. package/dist/components/modules/paint.js +106 -0
  325. package/dist/components/modules/paint.js.map +1 -0
  326. package/dist/components/modules/shapes.d.ts +31 -0
  327. package/dist/components/modules/shapes.d.ts.map +1 -0
  328. package/dist/components/modules/shapes.js +43 -0
  329. package/dist/components/modules/shapes.js.map +1 -0
  330. package/dist/components/modules/text-layout.d.ts +26 -0
  331. package/dist/components/modules/text-layout.d.ts.map +1 -0
  332. package/dist/components/modules/text-layout.js +57 -0
  333. package/dist/components/modules/text-layout.js.map +1 -0
  334. package/dist/components/modules/text-style.d.ts +48 -0
  335. package/dist/components/modules/text-style.d.ts.map +1 -0
  336. package/dist/components/modules/text-style.js +63 -0
  337. package/dist/components/modules/text-style.js.map +1 -0
  338. package/dist/components/modules/three-entries.d.ts +23 -0
  339. package/dist/components/modules/three-entries.d.ts.map +1 -0
  340. package/dist/components/modules/three-entries.js +41 -0
  341. package/dist/components/modules/three-entries.js.map +1 -0
  342. package/dist/components/modules/view3d.d.ts +59 -0
  343. package/dist/components/modules/view3d.d.ts.map +1 -0
  344. package/dist/components/modules/view3d.js +171 -0
  345. package/dist/components/modules/view3d.js.map +1 -0
  346. package/dist/components/trees/2d/group-bounds.d.ts +56 -0
  347. package/dist/components/trees/2d/group-bounds.d.ts.map +1 -0
  348. package/dist/components/trees/2d/group-bounds.js +87 -0
  349. package/dist/components/trees/2d/group-bounds.js.map +1 -0
  350. package/dist/components/trees/2d/node-lifecycle.d.ts +46 -0
  351. package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -0
  352. package/dist/components/trees/2d/node-lifecycle.js +264 -0
  353. package/dist/components/trees/2d/node-lifecycle.js.map +1 -0
  354. package/dist/components/trees/2d/node-motion.d.ts +56 -0
  355. package/dist/components/trees/2d/node-motion.d.ts.map +1 -0
  356. package/dist/components/trees/2d/node-motion.js +86 -0
  357. package/dist/components/trees/2d/node-motion.js.map +1 -0
  358. package/dist/components/trees/2d/node-render.d.ts +36 -0
  359. package/dist/components/trees/2d/node-render.d.ts.map +1 -0
  360. package/dist/components/trees/2d/node-render.js +67 -0
  361. package/dist/components/trees/2d/node-render.js.map +1 -0
  362. package/dist/components/trees/2d/node-space.d.ts +63 -0
  363. package/dist/components/trees/2d/node-space.d.ts.map +1 -0
  364. package/dist/components/trees/2d/node-space.js +131 -0
  365. package/dist/components/trees/2d/node-space.js.map +1 -0
  366. package/dist/components/trees/2d/node-transform.d.ts +55 -0
  367. package/dist/components/trees/2d/node-transform.d.ts.map +1 -0
  368. package/dist/components/trees/2d/node-transform.js +73 -0
  369. package/dist/components/trees/2d/node-transform.js.map +1 -0
  370. package/dist/components/trees/2d/node2d.d.ts +1020 -0
  371. package/dist/components/trees/2d/node2d.d.ts.map +1 -0
  372. package/dist/components/trees/2d/node2d.js +1481 -0
  373. package/dist/components/trees/2d/node2d.js.map +1 -0
  374. package/dist/components/trees/audio/index.d.ts +2 -0
  375. package/dist/components/trees/audio/index.d.ts.map +1 -0
  376. package/dist/components/trees/audio/index.js +2 -0
  377. package/dist/components/trees/audio/index.js.map +1 -0
  378. package/dist/components/trees/audio/node-audio.d.ts +109 -0
  379. package/dist/components/trees/audio/node-audio.d.ts.map +1 -0
  380. package/dist/components/trees/audio/node-audio.js +167 -0
  381. package/dist/components/trees/audio/node-audio.js.map +1 -0
  382. package/dist/components/trees/index.d.ts +10 -0
  383. package/dist/components/trees/index.d.ts.map +1 -0
  384. package/dist/components/trees/index.js +14 -0
  385. package/dist/components/trees/index.js.map +1 -0
  386. package/dist/components/trees/node/node-editor-state.d.ts +53 -0
  387. package/dist/components/trees/node/node-editor-state.d.ts.map +1 -0
  388. package/dist/components/trees/node/node-editor-state.js +23 -0
  389. package/dist/components/trees/node/node-editor-state.js.map +1 -0
  390. package/dist/components/trees/node/node-reactive.d.ts +89 -0
  391. package/dist/components/trees/node/node-reactive.d.ts.map +1 -0
  392. package/dist/components/trees/node/node-reactive.js +135 -0
  393. package/dist/components/trees/node/node-reactive.js.map +1 -0
  394. package/dist/components/trees/node/node-time.d.ts +39 -0
  395. package/dist/components/trees/node/node-time.d.ts.map +1 -0
  396. package/dist/components/trees/node/node-time.js +14 -0
  397. package/dist/components/trees/node/node-time.js.map +1 -0
  398. package/dist/components/trees/node/node-walk.d.ts +46 -0
  399. package/dist/components/trees/node/node-walk.d.ts.map +1 -0
  400. package/dist/components/trees/node/node-walk.js +74 -0
  401. package/dist/components/trees/node/node-walk.js.map +1 -0
  402. package/dist/components/trees/node/node.d.ts +401 -0
  403. package/dist/components/trees/node/node.d.ts.map +1 -0
  404. package/dist/components/trees/node/node.js +680 -0
  405. package/dist/components/trees/node/node.js.map +1 -0
  406. package/dist/components/trees/root/canvas2d-node.d.ts +163 -0
  407. package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -0
  408. package/dist/components/trees/root/canvas2d-node.js +216 -0
  409. package/dist/components/trees/root/canvas2d-node.js.map +1 -0
  410. package/dist/components/trees/three/node3d.d.ts +222 -0
  411. package/dist/components/trees/three/node3d.d.ts.map +1 -0
  412. package/dist/components/trees/three/node3d.js +289 -0
  413. package/dist/components/trees/three/node3d.js.map +1 -0
  414. package/dist/document/audio.d.ts +9 -1
  415. package/dist/document/audio.d.ts.map +1 -1
  416. package/dist/document/audio.js +41 -0
  417. package/dist/document/audio.js.map +1 -1
  418. package/dist/document/builtins.d.ts.map +1 -1
  419. package/dist/document/builtins.js +13 -31
  420. package/dist/document/builtins.js.map +1 -1
  421. package/dist/document/command-traits.d.ts +2 -2
  422. package/dist/document/command-traits.js +4 -1
  423. package/dist/document/command-traits.js.map +1 -1
  424. package/dist/document/deny-globals.d.ts +2 -2
  425. package/dist/document/deny-globals.js +2 -2
  426. package/dist/document/deny-globals.js.map +1 -1
  427. package/dist/document/diff.d.ts.map +1 -1
  428. package/dist/document/diff.js +3 -3
  429. package/dist/document/diff.js.map +1 -1
  430. package/dist/document/doc-index.d.ts.map +1 -1
  431. package/dist/document/doc-index.js +3 -3
  432. package/dist/document/doc-index.js.map +1 -1
  433. package/dist/document/expression/index.d.ts +1 -1
  434. package/dist/document/expression/index.js +1 -1
  435. package/dist/document/expression/index.js.map +1 -1
  436. package/dist/document/expression/ops.js +1 -1
  437. package/dist/document/expression/ops.js.map +1 -1
  438. package/dist/document/index.d.ts +1 -2
  439. package/dist/document/index.d.ts.map +1 -1
  440. package/dist/document/index.js +1 -2
  441. package/dist/document/index.js.map +1 -1
  442. package/dist/document/node-decorator.d.ts +14 -10
  443. package/dist/document/node-decorator.d.ts.map +1 -1
  444. package/dist/document/node-decorator.js +14 -10
  445. package/dist/document/node-decorator.js.map +1 -1
  446. package/dist/document/node-descriptor.d.ts +9 -3
  447. package/dist/document/node-descriptor.d.ts.map +1 -1
  448. package/dist/document/node-descriptor.js.map +1 -1
  449. package/dist/document/placement.js +2 -2
  450. package/dist/document/placement.js.map +1 -1
  451. package/dist/document/registry.d.ts +29 -36
  452. package/dist/document/registry.d.ts.map +1 -1
  453. package/dist/document/registry.js +29 -35
  454. package/dist/document/registry.js.map +1 -1
  455. package/dist/document/settled-index.d.ts +49 -0
  456. package/dist/document/settled-index.d.ts.map +1 -0
  457. package/dist/document/settled-index.js +247 -0
  458. package/dist/document/settled-index.js.map +1 -0
  459. package/dist/document/timeline.d.ts +29 -3
  460. package/dist/document/timeline.d.ts.map +1 -1
  461. package/dist/document/timeline.js +99 -3
  462. package/dist/document/timeline.js.map +1 -1
  463. package/dist/document/types.d.ts +4 -4
  464. package/dist/document/types.js.map +1 -1
  465. package/dist/document/validate.d.ts +1 -1
  466. package/dist/document/validate.js.map +1 -1
  467. package/dist/experimental.d.ts +22 -0
  468. package/dist/experimental.d.ts.map +1 -0
  469. package/dist/experimental.js +20 -0
  470. package/dist/experimental.js.map +1 -0
  471. package/dist/index.d.ts +10 -2
  472. package/dist/index.d.ts.map +1 -1
  473. package/dist/index.js +10 -2
  474. package/dist/index.js.map +1 -1
  475. package/dist/layout/types.d.ts +1 -1
  476. package/dist/layout/types.js.map +1 -1
  477. package/dist/nodes/audio/index.d.ts +2 -2
  478. package/dist/nodes/audio/index.d.ts.map +1 -1
  479. package/dist/nodes/audio/index.js +0 -2
  480. package/dist/nodes/audio/index.js.map +1 -1
  481. package/dist/nodes/audio/sound-node.d.ts +2 -1
  482. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  483. package/dist/nodes/audio/sound-node.js +3 -0
  484. package/dist/nodes/audio/sound-node.js.map +1 -1
  485. package/dist/nodes/index.d.ts +39 -27
  486. package/dist/nodes/index.d.ts.map +1 -1
  487. package/dist/nodes/index.js +16 -30
  488. package/dist/nodes/index.js.map +1 -1
  489. package/dist/nodes/node/node.d.ts +7 -1
  490. package/dist/nodes/node/node.d.ts.map +1 -1
  491. package/dist/nodes/node/node.js +23 -8
  492. package/dist/nodes/node/node.js.map +1 -1
  493. package/dist/nodes/root/canvas2d-node.d.ts +2 -1
  494. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -1
  495. package/dist/nodes/root/canvas2d-node.js +3 -0
  496. package/dist/nodes/root/canvas2d-node.js.map +1 -1
  497. package/dist/nodes/text/richtext-node.d.ts +0 -5
  498. package/dist/nodes/text/richtext-node.d.ts.map +1 -1
  499. package/dist/nodes/text/richtext-node.js +5 -71
  500. package/dist/nodes/text/richtext-node.js.map +1 -1
  501. package/dist/nodes/text/text-base.d.ts +5 -22
  502. package/dist/nodes/text/text-base.d.ts.map +1 -1
  503. package/dist/nodes/text/text-base.js +12 -363
  504. package/dist/nodes/text/text-base.js.map +1 -1
  505. package/dist/nodes/text/text-layout.d.ts +87 -0
  506. package/dist/nodes/text/text-layout.d.ts.map +1 -0
  507. package/dist/nodes/text/text-layout.js +368 -0
  508. package/dist/nodes/text/text-layout.js.map +1 -0
  509. package/dist/nodes/three/canvas3d-node.d.ts +3 -1
  510. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  511. package/dist/nodes/three/canvas3d-node.js +6 -0
  512. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  513. package/dist/props/host.d.ts +1 -1
  514. package/dist/props/host.js.map +1 -1
  515. package/dist/props/slot.d.ts +1 -1
  516. package/dist/props/slot.js +1 -1
  517. package/dist/props/slot.js.map +1 -1
  518. package/dist/render/clip.d.ts +1 -1
  519. package/dist/render/clip.js +1 -1
  520. package/dist/render/clip.js.map +1 -1
  521. package/dist/render/descriptors/rect.js.map +1 -1
  522. package/dist/render/descriptors/text.d.ts +11 -5
  523. package/dist/render/descriptors/text.d.ts.map +1 -1
  524. package/dist/render/descriptors/text.js +7 -1
  525. package/dist/render/descriptors/text.js.map +1 -1
  526. package/dist/render/render-context2d.d.ts +2 -2
  527. package/dist/render/render-context2d.js.map +1 -1
  528. package/dist/render3d/builders.d.ts +1 -1
  529. package/dist/render3d/builders.js +1 -1
  530. package/dist/render3d/builders.js.map +1 -1
  531. package/dist/render3d/graphics3d.d.ts +13 -19
  532. package/dist/render3d/graphics3d.d.ts.map +1 -1
  533. package/dist/render3d/graphics3d.js +13 -19
  534. package/dist/render3d/graphics3d.js.map +1 -1
  535. package/dist/render3d/scene3d.d.ts +1 -1
  536. package/dist/render3d/scene3d.js +1 -1
  537. package/dist/render3d/scene3d.js.map +1 -1
  538. package/dist/render3d/texture.d.ts +2 -2
  539. package/dist/render3d/texture.d.ts.map +1 -1
  540. package/dist/render3d/texture.js.map +1 -1
  541. package/dist/render3d/vector3.d.ts +2 -2
  542. package/dist/render3d/vector3.js +2 -2
  543. package/dist/render3d/vector3.js.map +1 -1
  544. package/dist/runtime/asset-refine.d.ts +1 -1
  545. package/dist/runtime/asset-refine.d.ts.map +1 -1
  546. package/dist/runtime/asset-refine.js +1 -1
  547. package/dist/runtime/asset-refine.js.map +1 -1
  548. package/dist/runtime/asset-update.js +1 -1
  549. package/dist/runtime/asset-update.js.map +1 -1
  550. package/dist/runtime/audio-index.d.ts +0 -11
  551. package/dist/runtime/audio-index.d.ts.map +1 -1
  552. package/dist/runtime/audio-index.js +0 -25
  553. package/dist/runtime/audio-index.js.map +1 -1
  554. package/dist/runtime/clip-instance.d.ts +7 -4
  555. package/dist/runtime/clip-instance.d.ts.map +1 -1
  556. package/dist/runtime/clip-instance.js +21 -7
  557. package/dist/runtime/clip-instance.js.map +1 -1
  558. package/dist/runtime/clip-store.d.ts +11 -3
  559. package/dist/runtime/clip-store.d.ts.map +1 -1
  560. package/dist/runtime/clip-store.js +83 -23
  561. package/dist/runtime/clip-store.js.map +1 -1
  562. package/dist/runtime/engine.d.ts +3 -3
  563. package/dist/runtime/engine.js +2 -2
  564. package/dist/runtime/engine.js.map +1 -1
  565. package/dist/runtime/node-picking.d.ts +2 -2
  566. package/dist/runtime/node-picking.d.ts.map +1 -1
  567. package/dist/runtime/node-picking.js +9 -10
  568. package/dist/runtime/node-picking.js.map +1 -1
  569. package/dist/runtime/node-picking3d.d.ts +12 -5
  570. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  571. package/dist/runtime/node-picking3d.js +6 -1
  572. package/dist/runtime/node-picking3d.js.map +1 -1
  573. package/dist/runtime/playback-controller.d.ts +2 -2
  574. package/dist/runtime/playback-controller.d.ts.map +1 -1
  575. package/dist/runtime/playback-controller.js +1 -1
  576. package/dist/runtime/playback-controller.js.map +1 -1
  577. package/dist/runtime/state-evaluator.d.ts +2 -2
  578. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  579. package/dist/runtime/state-evaluator.js.map +1 -1
  580. package/dist/runtime/text-geometry.d.ts +1 -1
  581. package/dist/runtime/text-geometry.d.ts.map +1 -1
  582. package/dist/runtime/text-geometry.js +6 -3
  583. package/dist/runtime/text-geometry.js.map +1 -1
  584. package/dist/sdk/index.d.ts +46 -21
  585. package/dist/sdk/index.d.ts.map +1 -1
  586. package/dist/sdk/index.js +47 -43
  587. package/dist/sdk/index.js.map +1 -1
  588. package/dist/tween/command-decorator.d.ts +7 -9
  589. package/dist/tween/command-decorator.d.ts.map +1 -1
  590. package/dist/tween/command-decorator.js +2 -2
  591. package/dist/tween/command-decorator.js.map +1 -1
  592. package/dist/tween/command.d.ts +13 -1
  593. package/dist/tween/command.d.ts.map +1 -1
  594. package/dist/tween/command.js +14 -0
  595. package/dist/tween/command.js.map +1 -1
  596. package/dist/tween/index.d.ts +2 -1
  597. package/dist/tween/index.d.ts.map +1 -1
  598. package/dist/tween/index.js +1 -1
  599. package/dist/tween/index.js.map +1 -1
  600. package/dist/tween/loop.d.ts +1 -1
  601. package/dist/tween/loop.js +1 -1
  602. package/dist/tween/loop.js.map +1 -1
  603. package/dist/util/reference.d.ts +6 -6
  604. package/dist/util/reference.js.map +1 -1
  605. package/package.json +7 -10
  606. package/dist/browser/chunks/chunk-FUZVFT3W.js +0 -18
  607. package/dist/browser/chunks/chunk-FUZVFT3W.js.map +0 -7
  608. package/dist/browser/chunks/chunk-QG6C23IJ.js +0 -3
  609. package/dist/browser/chunks/chunk-QG6C23IJ.js.map +0 -7
  610. package/dist/browser/chunks/chunk-SFNJRPBV.js +0 -2
  611. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +0 -7
  612. package/dist/browser/jsx-jsx-dev-runtime.js +0 -2
  613. package/dist/browser/jsx-jsx-runtime.js +0 -2
  614. package/dist/browser/jsx-jsx-runtime.js.map +0 -7
  615. /package/dist/browser/{jsx-jsx-dev-runtime.js.map → experimental.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # @motionscript/core
2
2
 
3
+ ## 0.1.0-alpha.7
4
+
5
+ ### Minor Changes
6
+
7
+ - 5941d52: The class versions of the built-in node types are gone. Every built-in has been a component for a while; core kept the old classes only to compare against. Removed from `@motionscript/core`: `PaintNode`, `ShapeNode`, `BoundsShape`, `TextBase`, `applyTextDefaults`, and the transitional `RectBase`, `EllipseBase`, `PathBase`, `PathShapeBase`, `PolygonBase`, `PolygramBase`, `VideoBase`, `Mesh3DBase` and `Canvas3DBase`. Build on the components (`Rect`, `Text`, `Mesh3D`, `Canvas3D`, ...) and the modules (`Paint`, `Flow`, `Shapes`, `Typeface`, `TextLayout`, `Material`, `View3D`) instead. `Canvas2D` and the `Node`, `Node2D`, `Node3D` and `NodeAudio` bases stay.
8
+
9
+ No `@motionscript/sdk` export is removed: the props types (`RectProps`, `TextProps`, `Mesh3DProps`, ...) are unchanged and now live beside their components. `ModelView3D` is a component rather than a `Model3D` subclass, so `instanceof Model3D` no longer holds for it. `TextSelection` now takes any `TextSelectionHost` rather than the removed `Text` class.
10
+
11
+ - 737f7d0: What was left of the class authoring system is gone. Each piece existed to write or extend a node class, and a node type is a component now; no built-in, kit or host used them.
12
+
13
+ Removed from `@motionscript/core`:
14
+
15
+ - the registration functions `property`, `node`, `command` and `withdraw`, and the thirteen typed property helpers (`fillProperty`, `strokeProperty`, `shadowProperty`, `effectsProperty`, `colorProperty`, `cornerRadiusProperty`, `cornerStyleProperty`, `pathProperty`, `insetsProperty`, `alignmentProperty`, `vector2Property`, `sizeProperty`, `textProperty`) with their `AttributePropOptions` type. A component declares its entries with `Types`. `getPropertyMeta`, `getNodeDescriptor`, `getCommandMeta` and the metadata types stay;
16
+ - `TextSelection`, `TextSelectionHost`, `TextSelectionProps`, `TextRange`, `SelectionOverrides` and `normalizeRanges`: the component `Text` has no selection API, so nothing could make one. Style a range with `runs`;
17
+ - `AudioScope` and the `declareAudio` hook on `Node`: sound plays from commands (`timeline.sound`). `busPathOf` and `busPathTo` take a function answering a node's span instead of an `AudioScope`;
18
+ - the `Node.tick` hook and the `Node2D` hooks `beforeRender`, `afterRender`, `renderStroke`, `clipPathSelf`, `resolveSizeInput` and `constraints`, which only a subclass could reach;
19
+ - `NodeTypeRecord.withdrawn` and `CommandMeta.withdrawn`. `PropertyMeta.withdrawn` stays, deprecated: nothing sets it.
20
+
21
+ Removed from `@motionscript/core/component`, and so from `@motionscript/sdk/component` and `@motionscript/charts/kit`, which re-export it: the seekable composition `at`, `hold`, `sequence` and `together`, with the `Seekable` and `Placed` types. A component command returns timeline pieces.
22
+
23
+ Removed from `@motionscript/sdk`: `TextSelection`, `TextSelectionProps`, `TextRange`, `SelectionOverrides`, `AudioScope` and `AudioClip`.
24
+
25
+ - 17f9883: Core no longer ships its JSX runtime: its `./jsx/jsx-runtime` and `./jsx/jsx-dev-runtime` subpaths are gone, and so are the `jsx`, `jsxs`, `Fragment` and `JSX` the root barrel re-exported. Build a tree with calls (`Rect({ children: [Text({ text: "hi" })] })`), as a component does. Nothing in the engine uses decorator syntax any more either, so no consumer needs `experimentalDecorators` on core's account.
26
+
27
+ ### Patch Changes
28
+
29
+ - 17f9883: Three fixes for components. A component frame (a `Rect`, or any component laid out by `Flow`) answers where a dropped node lands, so `reparentPlacementAt` into one gives a placement instead of `null`. `View3D.load(loader, extend)` takes the `extend` a viewport's render draws with and declares what it draws, so its textures and models load before the frame; math's `axes3d` passes its axes. `ref` is typed on component calls as the node the call builds, accepting a ref of any supertype.
30
+
31
+ ## 0.1.0-alpha.6
32
+
33
+ ### Minor Changes
34
+
35
+ - 163b708: Node types are components: one spec object handed to `component2d`, `component3d` or `componentAudio`, with no classes, decorators or JSX.
36
+
37
+ - **Writing a node type.** A component is one object literal: `key`, `state` (literals and `Types`), `defaults`, `commands`, `children`, `allowedChildren`/`allowedParents`, `provide`, `load`, and its tree's own fields (`measure`, `layout`, `render` for 2D). Behaviour comes from modules you spread in and call: `Paint`, `Flow`, `Shapes`, `Typeface`, `TextLayout`, `Aim`, `Material`, `View3D`. ADR 0007 and the custom-node docs cover it.
38
+ - **Building nodes in code** uses calls: `Rect({ fill: 'tomato', children: [Text({ text: 'Hi' })] })`, or `new Rect({...})` for the node itself.
39
+ - **Every built-in and every kit node is a component**, under the same document key. Code that tested `instanceof` a class now uses the component's `.is`, or `instanceof X.node`. Changed members:
40
+ - `SurfacePlot3d.valueAt` and `FunctionPlot.valueAt` are now the functions `surfaceValueAt` and `curveValue`.
41
+ - A system's `coordinates` is replaced by `planeMap`/`axesMap`/`systemMap`.
42
+ - `PieChart.isSelected` is replaced by `isSliceSelected`.
43
+ - `ItemGrid` is a kit module (`ItemGrid.isGrid`, `ItemGrid.define`), not a base class.
44
+ - **The sdk no longer exports the class surface:**
45
+ - the decorators: `node`, `property` and every `*Property`, `command`, `withdraw`, `driveCommand`;
46
+ - the authoring bases: `PaintNode`, `ShapeNode`, `TextBase`, `Mesh3DBase`, `Canvas3DBase` and the `*Base` geometry classes;
47
+ - `asCommand`, `compose`, `drive` and `declarePaints` from `@motionscript/sdk/component`;
48
+ - the `jsx-runtime` and `jsx-dev-runtime` subpaths.
49
+ - `Node`, `Node2D`, `Node3D` and `NodeAudio` remain as types.
50
+ - **Editor metadata leaves the engine.** The kits no longer declare `parentKey`, `forkable`, `layout`, `seed`, `within`, `beside` or `closed`; a host keeps those in its own configs. `describe()` now reports `holds`, the trees a type takes children from, and the placement checks use it, so a 2D viewport of your own that takes 3D children places them.
51
+ - A command called from code with no argument runs, and a refused child is told what its parent takes (`allowedChildren`) or where it goes (`allowedParents`).
52
+
53
+ - aa75a19: A source-string node default-exports a component, and is written with calls.
54
+
55
+ - `Registry.addNodeFromSource`, `engine.registerNode(source)` and a string in `nodes` (browser and headless) take a script whose default export is a component (`export default component2d({ key: "…", … })`), not a class decorated with `@node(...)`.
56
+ - `DynamicNodeConfig.jsxRuntime` is gone, and browser's default compiler reads TypeScript without JSX or decorators: a script with JSX fails to compile, and one that requires `@motionscript/sdk/jsx-runtime` fails to link. The CDN build no longer imports `@motionscript/core/jsx/jsx-runtime`, so an import map need not name it.
57
+
3
58
  ## 0.1.0-alpha.5
4
59
 
5
60
  ### Patch Changes
package/README.md CHANGED
@@ -37,13 +37,11 @@ function of its time, so a seek costs the same in either direction.
37
37
  play, seek and export it.
38
38
  - **Nodes**: the scene graph (`Rect`, `Ellipse`, `Text`, `RichText`, `Video`,
39
39
  paths, 3D, audio, and more) with attributes for fills, gradients, filters, and
40
- SkSL shader effects. A custom node is a class registered with the engine, and
41
- any document it opens can name it.
40
+ SkSL shader effects. A custom node is a component registered with the engine,
41
+ and any document it opens can name it.
42
42
  - **Tweens**: interpolation and easing for animating attributes over time.
43
43
  - **Layout**: `flowOps`, the flow layout every 2D node runs on its children:
44
44
  freeform, runs (wrapped or not) and grid.
45
- - **JSX runtime**: lets a composite node build its children as TSX
46
- (`./jsx/jsx-runtime`, `./jsx/jsx-dev-runtime`).
47
45
  - **Project / render / platform / assets**: the abstractions a renderer and a
48
46
  platform implement to turn a scene graph into pixels, audio, and exported
49
47
  video: `RenderContext2D`/`RenderContext3D` (implemented by
@@ -33,11 +33,10 @@ export class AssetNotLoadedError extends Error {
33
33
  this.src = src;
34
34
  }
35
35
  }
36
- /** How to declare an asset of `assetType`: the scope method, or audio's own seam. */
36
+ /** How to declare an asset of `assetType`: the scope method, or a command's sound. */
37
37
  function declareHint(assetType) {
38
- const how = assetType === "audio"
39
- ? "declareAudio()"
40
- : `declareAssets() (e.g. assets.${assetType}(...))`;
41
- return `Declare it from the node's ${how}, so the asset timeline loads it before this frame draws.`;
38
+ if (assetType === "audio")
39
+ return "Play it from a command (`timeline.sound(...)`), so the asset timeline loads it before this frame draws.";
40
+ return `Declare it from the node's declareAssets() (e.g. assets.${assetType}(...)), so the asset timeline loads it before this frame draws.`;
42
41
  }
43
42
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/assets/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACjC,SAAS,CAAY;IACrB,GAAG,CAAS;IACrB,6EAA6E;IAC7E,MAAM,CAAU;IAEhB,YAAY,SAAoB,EAAE,GAAW,EAAE,IAAa;QACxD,KAAK,CAAC,GAAG,SAAS,WAAW,GAAG,mBAAmB,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AAED,qFAAqF;AACrF,SAAS,WAAW,CAAC,SAAoB;IACrC,MAAM,GAAG,GAAG,SAAS,KAAK,OAAO;QAC7B,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,gCAAgC,SAAS,QAAQ,CAAC;IACxD,OAAO,8BAA8B,GAAG,2DAA2D,CAAC;AACxG,CAAC","sourcesContent":["import type { AssetType } from \"./record\";\r\n\r\n/**\r\n * A frame reached for an asset that was never loaded.\r\n *\r\n * This is the counterweight to declared asset tracking. A node states what it\r\n * needs from `Node.declareAssets`; if it\r\n * misses something, the renderer finds nothing when it goes to paint. The old\r\n * inference pass could not really get this wrong — it discovered assets *from*\r\n * the draw calls, so anything drawn was by construction requested — and the\r\n * fills were written to match: a missing decode returned `false` and the layer\r\n * was quietly skipped.\r\n *\r\n * Under declarations that leniency is the wrong default. A skipped layer is a\r\n * frame that renders *almost* right, with a photo missing or a heading in the\r\n * fallback face, on a node that may only appear seconds in and only on a cold\r\n * load. Throwing turns a silent visual gap into a located failure: during precomp\r\n * it is caught per scene and surfaces as a `BuildError` in the errors panel, and\r\n * at playback it stops the frame rather than shipping a wrong one.\r\n *\r\n * It means \"declared but not loaded, or never declared\". It deliberately does\r\n * **not** cover a *time-varying* miss — a video frame the decode window has not\r\n * reached yet is an asset that loaded fine, and `warmPendingVideo` already exists\r\n * to settle those; those paths still paint the nearest decoded frame.\r\n */\r\nexport class AssetNotLoadedError extends Error {\r\n readonly assetType: AssetType;\r\n readonly src: string;\r\n /** The innermost drawing node, stamped by `Node2D.render` on the way out. */\r\n nodeId?: string;\r\n\r\n constructor(assetType: AssetType, src: string, hint?: string) {\r\n super(`${assetType} asset \"${src}\" is not loaded. ` + (hint ?? declareHint(assetType)));\r\n this.name = \"AssetNotLoadedError\";\r\n this.assetType = assetType;\r\n this.src = src;\r\n }\r\n}\r\n\r\n/** How to declare an asset of `assetType`: the scope method, or audio's own seam. */\r\nfunction declareHint(assetType: AssetType): string {\r\n const how = assetType === \"audio\"\r\n ? \"declareAudio()\"\r\n : `declareAssets() (e.g. assets.${assetType}(...))`;\r\n return `Declare it from the node's ${how}, so the asset timeline loads it before this frame draws.`;\r\n}\r\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/assets/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACjC,SAAS,CAAY;IACrB,GAAG,CAAS;IACrB,6EAA6E;IAC7E,MAAM,CAAU;IAEhB,YAAY,SAAoB,EAAE,GAAW,EAAE,IAAa;QACxD,KAAK,CAAC,GAAG,SAAS,WAAW,GAAG,mBAAmB,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AAED,sFAAsF;AACtF,SAAS,WAAW,CAAC,SAAoB;IACrC,IAAI,SAAS,KAAK,OAAO;QAAE,OAAO,yGAAyG,CAAC;IAC5I,OAAO,2DAA2D,SAAS,iEAAiE,CAAC;AACjJ,CAAC","sourcesContent":["import type { AssetType } from \"./record\";\r\n\r\n/**\r\n * A frame reached for an asset that was never loaded.\r\n *\r\n * This is the counterweight to declared asset tracking. A node states what it\r\n * needs from `Node.declareAssets`; if it\r\n * misses something, the renderer finds nothing when it goes to paint. The old\r\n * inference pass could not really get this wrong — it discovered assets *from*\r\n * the draw calls, so anything drawn was by construction requested — and the\r\n * fills were written to match: a missing decode returned `false` and the layer\r\n * was quietly skipped.\r\n *\r\n * Under declarations that leniency is the wrong default. A skipped layer is a\r\n * frame that renders *almost* right, with a photo missing or a heading in the\r\n * fallback face, on a node that may only appear seconds in and only on a cold\r\n * load. Throwing turns a silent visual gap into a located failure: during precomp\r\n * it is caught per scene and surfaces as a `BuildError` in the errors panel, and\r\n * at playback it stops the frame rather than shipping a wrong one.\r\n *\r\n * It means \"declared but not loaded, or never declared\". It deliberately does\r\n * **not** cover a *time-varying* miss — a video frame the decode window has not\r\n * reached yet is an asset that loaded fine, and `warmPendingVideo` already exists\r\n * to settle those; those paths still paint the nearest decoded frame.\r\n */\r\nexport class AssetNotLoadedError extends Error {\r\n readonly assetType: AssetType;\r\n readonly src: string;\r\n /** The innermost drawing node, stamped by `Node2D.render` on the way out. */\r\n nodeId?: string;\r\n\r\n constructor(assetType: AssetType, src: string, hint?: string) {\r\n super(`${assetType} asset \"${src}\" is not loaded. ` + (hint ?? declareHint(assetType)));\r\n this.name = \"AssetNotLoadedError\";\r\n this.assetType = assetType;\r\n this.src = src;\r\n }\r\n}\r\n\r\n/** How to declare an asset of `assetType`: the scope method, or a command's sound. */\r\nfunction declareHint(assetType: AssetType): string {\r\n if (assetType === \"audio\") return \"Play it from a command (`timeline.sound(...)`), so the asset timeline loads it before this frame draws.\";\r\n return `Declare it from the node's declareAssets() (e.g. assets.${assetType}(...)), so the asset timeline loads it before this frame draws.`;\r\n}\r\n"]}
@@ -2,7 +2,7 @@ import type { AssetCatalog } from "./catalog.js";
2
2
  import type { LoaderFn } from "./record.js";
3
3
  import type { FillResolved } from "../attributes/shape/fill/union.js";
4
4
  import type { NodeEffect } from "../attributes/shape/effects/union.js";
5
- import type { Node } from "../nodes/node/node.js";
5
+ import type { Node } from "../components/trees/node/node.js";
6
6
  /** Whether an asset has to be resident before layout measures, or only before a frame draws. */
7
7
  export type AssetGate = "layout" | "render";
8
8
  export type AssetDecl = {
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/assets/scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAK9C,gGAAgG;AAChG,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5C,MAAM,MAAM,SAAS,GACf;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClE;IAAE,IAAI,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C,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKpD,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,IAAI;IAoBzE,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,YAAY,EAAE,GAAG,IAAI;IASzD,OAAO,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI;IAK7C,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IASzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,SAAS,CAAwB;CAC5C"}
@@ -1,6 +1,6 @@
1
1
  import { declareFill } from "../attributes/shape/fill/registry.js";
2
2
  import { declareEffect } from "../attributes/shape/effects/registry.js";
3
- import { declareTree } from "../nodes/node/node-walk.js";
3
+ import { declareTree } from "../components/trees/node/node-walk.js";
4
4
  /**
5
5
  * Fonts key by family alone: `loadFont` registers every weight of a family at once
6
6
  * and a variable weight renders through `fontVariations`, so a weight in the key
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/assets/scope.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAgCrD;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAe;IACpC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACR,OAAO,IAAI,CAAC,GAAG,CAAC;QACpB,KAAK,MAAM;YACP,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,KAAK,QAAQ;YACT,OAA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,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;IACL,CAAC;IAED,IAAI,CAAC,KAA6C;QAC9C,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,WAAW,CAAC,KAAqB,EAAE,IAAI,CAAC,CAAC;YACzC,OAAO;QACX,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,KAAgC;YAAE,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,CAAC,OAA8B;QAClC,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,CAAC,IAAU;QACd,IAAI,CAAC,SAAS,KAAK,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QACrC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS;YAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;YAC5D,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAEgB,QAAQ,CAA0B;IAClC,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC/C,SAAS,CAAwB;CAC5C","sourcesContent":["import type { AssetCatalog } from \"./catalog\";\r\nimport type { LoaderFn } from \"./record\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { Node } from \"@/nodes/node/node\";\r\nimport { declareFill } from \"@/attributes/shape/fill/registry\";\r\nimport { declareEffect } from \"@/attributes/shape/effects/registry\";\r\nimport { declareTree } from \"@/nodes/node/node-walk\";\r\n\r\n/** Whether an asset has to be resident before layout measures, or only before a frame draws. */\r\nexport type AssetGate = \"layout\" | \"render\";\r\n\r\nexport type AssetDecl =\r\n | { type: \"image\"; src: string }\r\n | { type: \"video\"; src: string; trimStart: number; trimEnd: number }\r\n | { type: \"font\"; family: string; weight: number }\r\n | { type: \"loader\"; key: string; load: LoaderFn; gate: AssetGate };\r\n\r\n/**\r\n * What a node's `declareAssets` states its needs into.\r\n *\r\n * A declaration must be a pure function of the props and context it reads — never\r\n * `layoutBounds`, never `time`, no writes — because the runtime re-runs it only\r\n * when something it read changes. Declarations dedupe by {@link assetKey}.\r\n */\r\nexport interface AssetScope {\r\n readonly catalog: AssetCatalog;\r\n image(src: string): void;\r\n video(src: string, trim?: { start?: number; end?: number }): void;\r\n /** Gates layout: text is measured against the face. */\r\n font(family: string, weight?: number | string): void;\r\n /** `gate` defaults to `\"render\"`; pass `\"layout\"` for a load measurement depends on. */\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void;\r\n fill(fills: FillResolved | readonly FillResolved[]): void;\r\n effects(effects: readonly NodeEffect[]): void;\r\n /** A detached subtree this node draws (a `Tex.surface` node source), declared as part of this node. */\r\n subtree(node: Node): void;\r\n}\r\n\r\n/**\r\n * Fonts key by family alone: `loadFont` registers every weight of a family at once\r\n * and a variable weight renders through `fontVariations`, so a weight in the key\r\n * would mint an entry per frame of a weight tween.\r\n */\r\nexport function assetKey(decl: AssetDecl): string {\r\n switch (decl.type) {\r\n case \"image\":\r\n case \"video\":\r\n return decl.src;\r\n case \"font\":\r\n return decl.family;\r\n case \"loader\":\r\n return decl.key;\r\n }\r\n}\r\n\r\n/** Anything unparseable lands on 400, which is what an unspecified weight means anyway. */\r\nexport function normalizeWeight(weight: number | string | undefined): number {\r\n if (typeof weight === \"number\") return Number.isFinite(weight) ? weight : 400;\r\n if (typeof weight === \"string\") return parseInt(weight, 10) || 400;\r\n return 400;\r\n}\r\n\r\nexport interface AssetDeclarationOptions {\r\n /** Binds a detached subtree (catalog, context, clock) before it declares. */\r\n bindSubtree?: (node: Node) => void;\r\n /** Replaces the default {@link declareTree} walk over a subtree. */\r\n onSubtree?: (node: Node, scope: AssetScope) => void;\r\n}\r\n\r\n/**\r\n * The {@link AssetScope} that collects: one declaration pass, keyed and validated.\r\n *\r\n * Unknown images and videos throw here, so a typo surfaces against the node that\r\n * declared it rather than as a picture that never paints.\r\n */\r\nexport class AssetDeclaration implements AssetScope {\r\n readonly catalog: AssetCatalog;\r\n\r\n constructor(catalog: AssetCatalog, options: AssetDeclarationOptions = {}) {\r\n this.catalog = catalog;\r\n this._options = options;\r\n }\r\n\r\n get declarations(): ReadonlyMap<string, AssetDecl> {\r\n return this._decls;\r\n }\r\n\r\n // An empty `src` is an unset media slot — it paints the checkerboard, not a\r\n // missing asset — so it declares nothing.\r\n image(src: string): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getImageMeta(src);\r\n this._decls.set(src, { type: \"image\", src });\r\n }\r\n\r\n video(src: string, trim?: { start?: number; end?: number }): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getVideoMeta(src);\r\n this._decls.set(src, {\r\n type: \"video\",\r\n src,\r\n trimStart: trim?.start ?? 0,\r\n trimEnd: trim?.end ?? this.catalog.getVideoDuration(src),\r\n });\r\n }\r\n\r\n font(family: string, weight?: number | string): void {\r\n if (!family || this._decls.has(family)) return;\r\n this._decls.set(family, { type: \"font\", family, weight: normalizeWeight(weight) });\r\n }\r\n\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void {\r\n const gate = options?.gate ?? \"render\";\r\n const existing = this._decls.get(key);\r\n if (existing === undefined) {\r\n this._decls.set(key, { type: \"loader\", key, load, gate });\r\n return;\r\n }\r\n if (existing.type !== \"loader\") return;\r\n if (existing.load !== load && process.env.NODE_ENV !== \"production\") {\r\n console.warn(\r\n `[assets] Loader \"${key}\" was declared with a different load function; the first is kept. ` +\r\n `Hoist the function so every declaration of the key hands over the same one.`,\r\n );\r\n }\r\n // Layout is the stricter gate, so it wins whichever declaration asked first.\r\n if (gate === \"layout\" && existing.gate !== \"layout\") {\r\n this._decls.set(key, { ...existing, gate });\r\n }\r\n }\r\n\r\n fill(fills: FillResolved | readonly FillResolved[]): void {\r\n if (!fills) return;\r\n if (!Array.isArray(fills)) {\r\n declareFill(fills as FillResolved, this);\r\n return;\r\n }\r\n for (const fill of fills as readonly FillResolved[]) declareFill(fill, this);\r\n }\r\n\r\n effects(effects: readonly NodeEffect[]): void {\r\n if (!effects) return;\r\n for (const effect of effects) declareEffect(effect, this);\r\n }\r\n\r\n subtree(node: Node): void {\r\n this._subtrees ??= new Set();\r\n if (this._subtrees.has(node)) return;\r\n this._subtrees.add(node);\r\n this._options.bindSubtree?.(node);\r\n if (this._options.onSubtree) this._options.onSubtree(node, this);\r\n else declareTree(node, this);\r\n }\r\n\r\n private readonly _options: AssetDeclarationOptions;\r\n private readonly _decls = new Map<string, AssetDecl>();\r\n private _subtrees: Set<Node> | undefined;\r\n}\r\n"]}
1
+ {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/assets/scope.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAgChE;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAe;IACpC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACR,OAAO,IAAI,CAAC,GAAG,CAAC;QACpB,KAAK,MAAM;YACP,OAAO,IAAI,CAAC,MAAM,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AQ,EAAE,CAAC;YAClD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;IACL,CAAC;IAED,IAAI,CAAC,KAA6C;QAC9C,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,WAAW,CAAC,KAAqB,EAAE,IAAI,CAAC,CAAC;YACzC,OAAO;QACX,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,KAAgC;YAAE,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,CAAC,OAA8B;QAClC,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,CAAC,IAAU;QACd,IAAI,CAAC,SAAS,KAAK,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QACrC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS;YAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;YAC5D,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAEgB,QAAQ,CAA0B;IAClC,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC/C,SAAS,CAAwB;CAC5C","sourcesContent":["import type { AssetCatalog } from \"./catalog\";\r\nimport type { LoaderFn } from \"./record\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport { declareFill } from \"@/attributes/shape/fill/registry\";\r\nimport { declareEffect } from \"@/attributes/shape/effects/registry\";\r\nimport { declareTree } from \"@/components/trees/node/node-walk\";\r\n\r\n/** Whether an asset has to be resident before layout measures, or only before a frame draws. */\r\nexport type AssetGate = \"layout\" | \"render\";\r\n\r\nexport type AssetDecl =\r\n | { type: \"image\"; src: string }\r\n | { type: \"video\"; src: string; trimStart: number; trimEnd: number }\r\n | { type: \"font\"; family: string; weight: number }\r\n | { type: \"loader\"; key: string; load: LoaderFn; gate: AssetGate };\r\n\r\n/**\r\n * What a node's `declareAssets` states its needs into.\r\n *\r\n * A declaration must be a pure function of the props and context it reads — never\r\n * `layoutBounds`, never `time`, no writes — because the runtime re-runs it only\r\n * when something it read changes. Declarations dedupe by {@link assetKey}.\r\n */\r\nexport interface AssetScope {\r\n readonly catalog: AssetCatalog;\r\n image(src: string): void;\r\n video(src: string, trim?: { start?: number; end?: number }): void;\r\n /** Gates layout: text is measured against the face. */\r\n font(family: string, weight?: number | string): void;\r\n /** `gate` defaults to `\"render\"`; pass `\"layout\"` for a load measurement depends on. */\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void;\r\n fill(fills: FillResolved | readonly FillResolved[]): void;\r\n effects(effects: readonly NodeEffect[]): void;\r\n /** A detached subtree this node draws (a `Tex.surface` node source), declared as part of this node. */\r\n subtree(node: Node): void;\r\n}\r\n\r\n/**\r\n * Fonts key by family alone: `loadFont` registers every weight of a family at once\r\n * and a variable weight renders through `fontVariations`, so a weight in the key\r\n * would mint an entry per frame of a weight tween.\r\n */\r\nexport function assetKey(decl: AssetDecl): string {\r\n switch (decl.type) {\r\n case \"image\":\r\n case \"video\":\r\n return decl.src;\r\n case \"font\":\r\n return decl.family;\r\n case \"loader\":\r\n return decl.key;\r\n }\r\n}\r\n\r\n/** Anything unparseable lands on 400, which is what an unspecified weight means anyway. */\r\nexport function normalizeWeight(weight: number | string | undefined): number {\r\n if (typeof weight === \"number\") return Number.isFinite(weight) ? weight : 400;\r\n if (typeof weight === \"string\") return parseInt(weight, 10) || 400;\r\n return 400;\r\n}\r\n\r\nexport interface AssetDeclarationOptions {\r\n /** Binds a detached subtree (catalog, context, clock) before it declares. */\r\n bindSubtree?: (node: Node) => void;\r\n /** Replaces the default {@link declareTree} walk over a subtree. */\r\n onSubtree?: (node: Node, scope: AssetScope) => void;\r\n}\r\n\r\n/**\r\n * The {@link AssetScope} that collects: one declaration pass, keyed and validated.\r\n *\r\n * Unknown images and videos throw here, so a typo surfaces against the node that\r\n * declared it rather than as a picture that never paints.\r\n */\r\nexport class AssetDeclaration implements AssetScope {\r\n readonly catalog: AssetCatalog;\r\n\r\n constructor(catalog: AssetCatalog, options: AssetDeclarationOptions = {}) {\r\n this.catalog = catalog;\r\n this._options = options;\r\n }\r\n\r\n get declarations(): ReadonlyMap<string, AssetDecl> {\r\n return this._decls;\r\n }\r\n\r\n // An empty `src` is an unset media slot — it paints the checkerboard, not a\r\n // missing asset — so it declares nothing.\r\n image(src: string): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getImageMeta(src);\r\n this._decls.set(src, { type: \"image\", src });\r\n }\r\n\r\n video(src: string, trim?: { start?: number; end?: number }): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getVideoMeta(src);\r\n this._decls.set(src, {\r\n type: \"video\",\r\n src,\r\n trimStart: trim?.start ?? 0,\r\n trimEnd: trim?.end ?? this.catalog.getVideoDuration(src),\r\n });\r\n }\r\n\r\n font(family: string, weight?: number | string): void {\r\n if (!family || this._decls.has(family)) return;\r\n this._decls.set(family, { type: \"font\", family, weight: normalizeWeight(weight) });\r\n }\r\n\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void {\r\n const gate = options?.gate ?? \"render\";\r\n const existing = this._decls.get(key);\r\n if (existing === undefined) {\r\n this._decls.set(key, { type: \"loader\", key, load, gate });\r\n return;\r\n }\r\n if (existing.type !== \"loader\") return;\r\n if (existing.load !== load && process.env.NODE_ENV !== \"production\") {\r\n console.warn(\r\n `[assets] Loader \"${key}\" was declared with a different load function; the first is kept. ` +\r\n `Hoist the function so every declaration of the key hands over the same one.`,\r\n );\r\n }\r\n // Layout is the stricter gate, so it wins whichever declaration asked first.\r\n if (gate === \"layout\" && existing.gate !== \"layout\") {\r\n this._decls.set(key, { ...existing, gate });\r\n }\r\n }\r\n\r\n fill(fills: FillResolved | readonly FillResolved[]): void {\r\n if (!fills) return;\r\n if (!Array.isArray(fills)) {\r\n declareFill(fills as FillResolved, this);\r\n return;\r\n }\r\n for (const fill of fills as readonly FillResolved[]) declareFill(fill, this);\r\n }\r\n\r\n effects(effects: readonly NodeEffect[]): void {\r\n if (!effects) return;\r\n for (const effect of effects) declareEffect(effect, this);\r\n }\r\n\r\n subtree(node: Node): void {\r\n this._subtrees ??= new Set();\r\n if (this._subtrees.has(node)) return;\r\n this._subtrees.add(node);\r\n this._options.bindSubtree?.(node);\r\n if (this._options.onSubtree) this._options.onSubtree(node, this);\r\n else declareTree(node, this);\r\n }\r\n\r\n private readonly _options: AssetDeclarationOptions;\r\n private readonly _decls = new Map<string, AssetDecl>();\r\n private _subtrees: Set<Node> | undefined;\r\n}\r\n"]}
@@ -1,15 +1,13 @@
1
1
  import type { AssetCatalog } from "../../assets/catalog.js";
2
- import type { NodeSpan } from "../../document/types.js";
3
- import type { Node } from "../../nodes/node/node.js";
4
2
  import { type AudioFilter } from "./filters/chain.js";
5
3
  import type { AudioFilterItem } from "./filters/union.js";
6
4
  import type { AudioBusStop, AudioRequest } from "./request.js";
7
- /** One clip a node plays, in its clip's seconds. */
5
+ /** One clip a command's sound plays, in its clip's seconds. */
8
6
  export interface AudioClip {
9
7
  src: string;
10
- /** When it starts. Defaults to when its owner enters the tree. */
8
+ /** When it starts. */
11
9
  at?: number;
12
- /** When it is cut, however much of it is left. Defaults to when its owner leaves. */
10
+ /** When it is cut, however much of it is left. */
13
11
  until?: number;
14
12
  /** In-point inside the source, in seconds. */
15
13
  trimStart?: number;
@@ -23,19 +21,6 @@ export interface AudioClip {
23
21
  /** Sound nobody asked for by name — see {@link AudioRequest.optional}. */
24
22
  optional?: boolean;
25
23
  }
26
- /** What a node's `declareAudio` is handed. */
27
- export interface AudioScope {
28
- readonly catalog: AssetCatalog;
29
- /** When the node is in the tree, in clip seconds. `end` is `Infinity` for one that never leaves. */
30
- readonly span: Readonly<NodeSpan>;
31
- clip(clip: AudioClip): void;
32
- /**
33
- * When `node` is in the tree, in clip seconds: the span a bus stop carries.
34
- *
35
- * @internal
36
- */
37
- _spanOf(node: Node): Readonly<NodeSpan>;
38
- }
39
24
  /**
40
25
  * The product of every scalar `speed` filter. A curve contributes 1 here — its
41
26
  * effect on length needs integrating, which {@link clipDurationFor} does.
@@ -1 +1 @@
1
- {"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../src/attributes/audio/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAExE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5D,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,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G,SAAS,CAAC,CAAC,CAAC;QACjF,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,CAAC,CAAC;QAClD,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;YACpB,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC;QACpC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC","sourcesContent":["import type { AssetCatalog } from \"@/assets/catalog\";\r\nimport type { NodeSpan } from \"@/document/types\";\r\nimport type { Node } from \"@/nodes/node/node\";\r\nimport { resolveAudioFilters, type AudioFilter } from \"./filters/chain\";\r\nimport { integrateSpeedToClipTime, isCurve } from \"./filters/curve\";\r\nimport type { AudioFilterItem } from \"./filters/union\";\r\nimport type { AudioBusStop, AudioRequest } from \"./request\";\r\n\r\n/** One clip a node plays, in its clip's seconds. */\r\nexport interface AudioClip {\r\n src: string;\r\n /** When it starts. Defaults to when its owner enters the tree. */\r\n at?: number;\r\n /** When it is cut, however much of it is left. Defaults to when its owner leaves. */\r\n until?: number;\r\n /** In-point inside the source, in seconds. */\r\n trimStart?: number;\r\n /** Out-point inside the source. Absent plays to the source's end. */\r\n trimEnd?: number;\r\n loop?: boolean;\r\n volume?: number;\r\n filters?: AudioFilter;\r\n /** Source-adjacent first — see {@link AudioRequest.bus}. */\r\n bus?: readonly AudioBusStop[];\r\n /** Sound nobody asked for by name — see {@link AudioRequest.optional}. */\r\n optional?: boolean;\r\n}\r\n\r\n/** What a node's `declareAudio` is handed. */\r\nexport interface AudioScope {\r\n readonly catalog: AssetCatalog;\r\n /** When the node is in the tree, in clip seconds. `end` is `Infinity` for one that never leaves. */\r\n readonly span: Readonly<NodeSpan>;\r\n clip(clip: AudioClip): void;\r\n /**\r\n * When `node` is in the tree, in clip seconds: the span a bus stop carries.\r\n *\r\n * @internal\r\n */\r\n _spanOf(node: Node): Readonly<NodeSpan>;\r\n}\r\n\r\n/**\r\n * The product of every scalar `speed` filter. A curve contributes 1 here — its\r\n * effect on length needs integrating, which {@link clipDurationFor} does.\r\n */\r\nexport function effectiveSpeed(filters: readonly AudioFilterItem[]): number {\r\n let speed = 1;\r\n for (const f of filters) {\r\n if (f.type === \"speed\" && !isCurve(f.value) && f.value > 0) speed *= f.value;\r\n }\r\n return speed;\r\n}\r\n\r\n/**\r\n * Clip seconds consumed by playing `length` seconds of source through `filters`.\r\n * Must match the renderer's `playbackRate` schedule, or the request ends before\r\n * or after the sound does.\r\n */\r\nexport function clipDurationFor(filters: readonly AudioFilterItem[], length: number): number {\r\n const scalar = effectiveSpeed(filters);\r\n for (const f of filters) {\r\n if (f.type === \"speed\" && isCurve(f.value)) return integrateSpeedToClipTime(f.value, length) / scalar;\r\n }\r\n return length / scalar;\r\n}\r\n\r\n/**\r\n * The request `clip` schedules.\r\n *\r\n * Bounded when it has an end — a trim, or an `until` — and **open** otherwise, so\r\n * a bed nothing cuts continues across later tracks; see `AudioRequest.open`.\r\n */\r\nexport function requestOf(clip: AudioClip, catalog: AssetCatalog, ownerKey: string, n: number): AudioRequest {\r\n const at = clip.at ?? 0;\r\n const until = clip.until ?? Infinity;\r\n const trimStart = clip.trimStart ?? 0;\r\n const trimEnd = clip.trimEnd ?? Infinity;\r\n const loop = clip.loop ?? false;\r\n const filters = resolveAudioFilters(clip.filters);\r\n // Read even when the length goes unused: a missing file throws here, as a\r\n // build error, rather than playing silence.\r\n const mediaDuration = catalog.getMediaDuration(clip.src);\r\n\r\n const request: AudioRequest = {\r\n id: `${ownerKey}|${clip.src}|${at}|${n}`,\r\n src: clip.src,\r\n startAt: at,\r\n endAt: Infinity,\r\n trimStart,\r\n volume: clip.volume ?? 1,\r\n loop,\r\n ownerId: ownerKey,\r\n };\r\n if (filters.length > 0) request.filters = filters;\r\n if (clip.bus) request.bus = clip.bus;\r\n if (clip.optional) request.optional = true;\r\n\r\n // A loop repeats the trimmed region, so a `trimEnd` bounds one pass and says\r\n // nothing about when the clip stops: only a cut (`until`) ends it, and with\r\n // none it runs open to the project end like any other bed.\r\n if (loop && trimEnd > trimStart && Number.isFinite(trimEnd)) request.trimEnd = trimEnd;\r\n\r\n if (loop && Number.isFinite(until)) {\r\n request.endAt = until;\r\n } else if (loop) {\r\n request.open = true;\r\n } else if (Number.isFinite(trimEnd)) {\r\n request.endAt = Math.min(until, at + clipDurationFor(filters, Math.max(0, trimEnd - trimStart)));\r\n } else {\r\n const natural = clipDurationFor(filters, Math.max(0, mediaDuration - trimStart));\r\n if (Number.isFinite(until)) {\r\n request.endAt = Math.min(until, at + natural);\r\n } else {\r\n request.open = true;\r\n request.mediaDuration = natural;\r\n }\r\n }\r\n return request;\r\n}\r\n"]}
1
+ {"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../src/attributes/audio/schedule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAoB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAwBpE;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAmC;IAC9D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC;YAAE,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC;IACjF,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAmC,EAAE,MAAc;IAC/E,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACtB,I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assets/catalog\";\r\nimport { resolveAudioFilters, type AudioFilter } from \"./filters/chain\";\r\nimport { integrateSpeedToClipTime, isCurve } from \"./filters/curve\";\r\nimport type { AudioFilterItem } from \"./filters/union\";\r\nimport type { AudioBusStop, AudioRequest } from \"./request\";\r\n\r\n/** One clip a command's sound plays, in its clip's seconds. */\r\nexport interface AudioClip {\r\n src: string;\r\n /** When it starts. */\r\n at?: number;\r\n /** When it is cut, however much of it is left. */\r\n until?: number;\r\n /** In-point inside the source, in seconds. */\r\n trimStart?: number;\r\n /** Out-point inside the source. Absent plays to the source's end. */\r\n trimEnd?: number;\r\n loop?: boolean;\r\n volume?: number;\r\n filters?: AudioFilter;\r\n /** Source-adjacent first — see {@link AudioRequest.bus}. */\r\n bus?: readonly AudioBusStop[];\r\n /** Sound nobody asked for by name — see {@link AudioRequest.optional}. */\r\n optional?: boolean;\r\n}\r\n\r\n/**\r\n * The product of every scalar `speed` filter. A curve contributes 1 here — its\r\n * effect on length needs integrating, which {@link clipDurationFor} does.\r\n */\r\nexport function effectiveSpeed(filters: readonly AudioFilterItem[]): number {\r\n let speed = 1;\r\n for (const f of filters) {\r\n if (f.type === \"speed\" && !isCurve(f.value) && f.value > 0) speed *= f.value;\r\n }\r\n return speed;\r\n}\r\n\r\n/**\r\n * Clip seconds consumed by playing `length` seconds of source through `filters`.\r\n * Must match the renderer's `playbackRate` schedule, or the request ends before\r\n * or after the sound does.\r\n */\r\nexport function clipDurationFor(filters: readonly AudioFilterItem[], length: number): number {\r\n const scalar = effectiveSpeed(filters);\r\n for (const f of filters) {\r\n if (f.type === \"speed\" && isCurve(f.value)) return integrateSpeedToClipTime(f.value, length) / scalar;\r\n }\r\n return length / scalar;\r\n}\r\n\r\n/**\r\n * The request `clip` schedules.\r\n *\r\n * Bounded when it has an end — a trim, or an `until` — and **open** otherwise, so\r\n * a bed nothing cuts continues across later tracks; see `AudioRequest.open`.\r\n */\r\nexport function requestOf(clip: AudioClip, catalog: AssetCatalog, ownerKey: string, n: number): AudioRequest {\r\n const at = clip.at ?? 0;\r\n const until = clip.until ?? Infinity;\r\n const trimStart = clip.trimStart ?? 0;\r\n const trimEnd = clip.trimEnd ?? Infinity;\r\n const loop = clip.loop ?? false;\r\n const filters = resolveAudioFilters(clip.filters);\r\n // Read even when the length goes unused: a missing file throws here, as a\r\n // build error, rather than playing silence.\r\n const mediaDuration = catalog.getMediaDuration(clip.src);\r\n\r\n const request: AudioRequest = {\r\n id: `${ownerKey}|${clip.src}|${at}|${n}`,\r\n src: clip.src,\r\n startAt: at,\r\n endAt: Infinity,\r\n trimStart,\r\n volume: clip.volume ?? 1,\r\n loop,\r\n ownerId: ownerKey,\r\n };\r\n if (filters.length > 0) request.filters = filters;\r\n if (clip.bus) request.bus = clip.bus;\r\n if (clip.optional) request.optional = true;\r\n\r\n // A loop repeats the trimmed region, so a `trimEnd` bounds one pass and says\r\n // nothing about when the clip stops: only a cut (`until`) ends it, and with\r\n // none it runs open to the project end like any other bed.\r\n if (loop && trimEnd > trimStart && Number.isFinite(trimEnd)) request.trimEnd = trimEnd;\r\n\r\n if (loop && Number.isFinite(until)) {\r\n request.endAt = until;\r\n } else if (loop) {\r\n request.open = true;\r\n } else if (Number.isFinite(trimEnd)) {\r\n request.endAt = Math.min(until, at + clipDurationFor(filters, Math.max(0, trimEnd - trimStart)));\r\n } else {\r\n const natural = clipDurationFor(filters, Math.max(0, mediaDuration - trimStart));\r\n if (Number.isFinite(until)) {\r\n request.endAt = Math.min(until, at + natural);\r\n } else {\r\n request.open = true;\r\n request.mediaDuration = natural;\r\n }\r\n }\r\n return request;\r\n}\r\n"]}
@@ -10,16 +10,14 @@ export * from './shape/stroke/index.js';
10
10
  export { Sound, SoundProps } from './audio/sound.js';
11
11
  export type { AudioBusStop, AudioRequest } from './audio/request.js';
12
12
  export { busStopKey } from './audio/request.js';
13
- export type { AudioClip, AudioScope } from './audio/schedule.js';
13
+ export type { AudioClip } from './audio/schedule.js';
14
14
  export * from './audio/filters/index.js';
15
15
  export * from './layout/index.js';
16
16
  export * from './mask/boolean.js';
17
17
  export * from './mask/mask.js';
18
18
  export * from './text/index.js';
19
- export { property, getPropertyMeta, PropOptions } from './properties/decorator.js';
20
- export type { PropertyMeta } from './properties/decorator.js';
21
- export { fillProperty, strokeProperty, shadowProperty, effectsProperty, colorProperty, cornerRadiusProperty, cornerStyleProperty, pathProperty, insetsProperty, alignmentProperty, vector2Property, sizeProperty, textProperty, } from './properties/typed.js';
22
- export type { AttributePropOptions } from './properties/typed.js';
19
+ export { getPropertyMeta } from './properties/decorator.js';
20
+ export type { PropertyMeta, PropOptions } from './properties/decorator.js';
23
21
  export * from "./shape/shaders/index.js";
24
22
  export * from './shared/operators.js';
25
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/attributes/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAM7B,OAAO,EACH,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EACtD,kBAAkB,EAAE,mBAAmB,EACvC,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,GACrE,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACR,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,GACjF,MAAM,uBAAuB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,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EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACxE,cAAc,iBAAiB,CAAC;AAEhC,cAAc,oBAAoB,CAAC"}
@@ -18,8 +18,8 @@ export * from './layout/index.js';
18
18
  export * from './mask/boolean.js';
19
19
  export * from './mask/mask.js';
20
20
  export * from './text/index.js';
21
- export { property, getPropertyMeta } from './properties/decorator.js';
22
- export { fillProperty, strokeProperty, shadowProperty, effectsProperty, colorProperty, cornerRadiusProperty, cornerStyleProperty, pathProperty, insetsProperty, alignmentProperty, vector2Property, sizeProperty, textProperty, } from './properties/typed.js';
21
+ // What a host reads to draw an inspector: every property a node type declares.
22
+ export { getPropertyMeta } from './properties/decorator.js';
23
23
  export * from "./shape/shaders/index.js";
24
24
  export * from './shared/operators.js';
25
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/attributes/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,8EAA8E;AAC9E,kFAAkF;AAClF,iFAAiF;AACjF,kFAAkF;AAClF,8CAA8C;AAC9C,OAAO,EACH,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EACtD,kBAAkB,EAAE,mBAAmB,EACvC,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,GACrE,MAAM,uBAAuB,CAAC;AAI/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAc,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAe,MAAM,wBAAwB,CAAC;AAEhF,OAAO,EACH,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAC5E,oBAAoB,EAAE,mBAAmB,EAAE,YAAY,EACvD,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAChE,YAAY,GACf,MAAM,oBAAoB,CAAC;AAE5B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './shape/corners';\r\nexport * from './shape/effects';\r\nexport * from './shape/fill';\r\n// The renderer-facing half of the SkSL plumbing. Surfaced for the same reason\r\n// `resolveVideoTimestamp` is: the marshalling rules are part of the shader fill's\r\n// contract, so the backend consumes core's definition rather than reimplementing\r\n// it. Named rather than wildcard because `SkSLUniform`/`SkSLUniformValue` already\r\n// reach the barrel through `./shape/effects`.\r\nexport {\r\n normalizeUniforms, lerpUniformValue, lerpUniformRecord,\r\n uniformValuesEqual, uniformRecordsEqual,\r\n describeUniforms, writeUniforms, coordsMatrix, parseShaderChildren,\r\n} from './shape/sksl-uniforms';\r\nexport type {\r\n SkSLUniformRecord, UniformReflect, UniformSlot, UniformBounds, ShaderChildDecl,\r\n} from './shape/sksl-uniforms';\r\nexport * from './shape/filters';\r\nexport * from './shape/path';\r\nexport * from './shape/shadow';\r\nexport * from './shape/stroke';\r\nexport { Sound, SoundProps } from './audio/sound';\r\nexport type { AudioBusStop, AudioRequest } from './audio/request';\r\nexport { busStopKey } from './audio/request';\r\nexport type { AudioClip, AudioScope } from './audio/schedule';\r\nexport * from './audio/filters';\r\nexport * from './layout';\r\nexport * from './mask/boolean';\r\nexport * from './mask/mask';\r\nexport * from './text';\r\nexport { property, getPropertyMeta, PropOptions } from './properties/decorator';\r\nexport type { PropertyMeta } from './properties/decorator';\r\nexport {\r\n fillProperty, strokeProperty, shadowProperty, effectsProperty, colorProperty,\r\n cornerRadiusProperty, cornerStyleProperty, pathProperty,\r\n insetsProperty, alignmentProperty, vector2Property, sizeProperty,\r\n textProperty,\r\n} from './properties/typed';\r\nexport type { AttributePropOptions } from './properties/typed';\r\nexport * from \"./shape/shaders\";\r\n\r\nexport * from './shared/operators';\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/attributes/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,8EAA8E;AAC9E,kFAAkF;AAClF,iFAAiF;AACjF,kFAAkF;AAClF,8CAA8C;AAC9C,OAAO,EACH,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EACtD,kBAAkB,EAAE,mBAAmB,EACvC,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,GACrE,MAAM,uBAAuB,CAAC;AAI/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAc,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,+EAA+E;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,cAAc,iBAAiB,CAAC;AAEhC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './shape/corners';\r\nexport * from './shape/effects';\r\nexport * from './shape/fill';\r\n// The renderer-facing half of the SkSL plumbing. Surfaced for the same reason\r\n// `resolveVideoTimestamp` is: the marshalling rules are part of the shader fill's\r\n// contract, so the backend consumes core's definition rather than reimplementing\r\n// it. Named rather than wildcard because `SkSLUniform`/`SkSLUniformValue` already\r\n// reach the barrel through `./shape/effects`.\r\nexport {\r\n normalizeUniforms, lerpUniformValue, lerpUniformRecord,\r\n uniformValuesEqual, uniformRecordsEqual,\r\n describeUniforms, writeUniforms, coordsMatrix, parseShaderChildren,\r\n} from './shape/sksl-uniforms';\r\nexport type {\r\n SkSLUniformRecord, UniformReflect, UniformSlot, UniformBounds, ShaderChildDecl,\r\n} from './shape/sksl-uniforms';\r\nexport * from './shape/filters';\r\nexport * from './shape/path';\r\nexport * from './shape/shadow';\r\nexport * from './shape/stroke';\r\nexport { Sound, SoundProps } from './audio/sound';\r\nexport type { AudioBusStop, AudioRequest } from './audio/request';\r\nexport { busStopKey } from './audio/request';\r\nexport type { AudioClip } from './audio/schedule';\r\nexport * from './audio/filters';\r\nexport * from './layout';\r\nexport * from './mask/boolean';\r\nexport * from './mask/mask';\r\nexport * from './text';\r\n// What a host reads to draw an inspector: every property a node type declares.\r\nexport { getPropertyMeta } from './properties/decorator';\r\nexport type { PropertyMeta, PropOptions } from './properties/decorator';\r\nexport * from \"./shape/shaders\";\r\n\r\nexport * from './shared/operators';\r\n"]}
@@ -31,7 +31,7 @@ export type InsetsProps = number | Partial<InsetsResolved> & {
31
31
  */
32
32
  export type Insets = InsetsProps | InsetsResolved;
33
33
  /**
34
- * The insets attribute's op set — used by `@insetsProperty` and anywhere else a
34
+ * The insets attribute's op set — used by `insetsProperty` and anywhere else a
35
35
  * four-sided inset (padding, an image fill's `crop`, …) resolves and tweens.
36
36
  *
37
37
  * `insetBounds` computes the inner content area produced by subtracting a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AAU,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;SAChD,CAAC;IACN,CAAC;IACD,WAAW,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAC5C,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC;QACrD,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;QACvD,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;QAC7B,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;KAChC,CAAC;IACF,UAAU,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAC3C,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK;QACxC,MAAM,EAAE,WAAW,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM;KAC7C,CAAC;CACL,CAAC","sourcesContent":["import { lerpNumber } from \"@/tween/lerp\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\nimport type { BoxBounds } from \"@/layout/bounds\";\r\nimport { Size2D } from \"./size\";\r\n\r\n/** Fully resolved per-side edge insets. */\r\nexport interface InsetsResolved {\r\n left: number;\r\n right: number;\r\n top: number;\r\n bottom: number;\r\n}\r\n\r\n\r\nexport type InsetsProps = number | Partial<InsetsResolved> & {\r\n horizontal?: number;\r\n vertical?: number;\r\n};\r\n\r\n/**\r\n * Accepted shapes for a four-sided inset prop.\r\n *\r\n * The type is named for the shape (four edge insets), not for one use of it:\r\n * `Node2D.padding` insets a layout box in pixels, an image fill's `crop` insets a\r\n * source in fractions. Same value, same shorthands, same tween — different roles,\r\n * and each prop names its own.\r\n *\r\n * Mirrors {@link Fill}: the loose author-facing {@link InsetsProps} (a number or\r\n * per-side/symmetric object) plus the strict {@link InsetsResolved} — a read-back\r\n * resolved value structurally satisfies `InsetsProps`, so it passes through\r\n * `insetsOps.resolve` idempotently and can be assigned straight back.\r\n *\r\n * node.padding = 3 // uniform\r\n * node.padding = { horizontal: 8, top: 4 } // mixed\r\n * node.padding = otherNode.padding // resolved passes through\r\n */\r\nexport type Insets = InsetsProps | InsetsResolved;\r\n\r\n\r\n/**\r\n * The insets attribute's op set — used by `@insetsProperty` and anywhere else a\r\n * four-sided inset (padding, an image fill's `crop`, …) resolves and tweens.\r\n *\r\n * `insetBounds` computes the inner content area produced by subtracting a\r\n * resolved inset from an outer size — pure, works for any width/height pair,\r\n * with `x`/`y` carrying the offset of the inner-area center relative to the\r\n * outer-area center. `outsetSize` is its inverse: adds padding back onto\r\n * an inner size to get the outer size that contains it.\r\n */\r\n\r\nexport interface InsetsOps {\r\n\r\n insetBounds(outerWidth: number, outerHeight: number, pad: InsetsResolved): BoxBounds;\r\n outsetSize(innerWidth: number, innerHeight: number, pad: InsetsResolved): Size2D;\r\n}\r\n\r\nexport const insetsOps: AttributeOps<InsetsProps, InsetsResolved> & InsetsOps = {\r\n resolve: (value: InsetsProps, previous?: InsetsResolved): InsetsResolved => {\r\n if (typeof value === \"number\") {\r\n return { left: value, right: value, top: value, bottom: value };\r\n }\r\n\r\n // Fallback resolution order: Specific side -> Symmetric shortcut -> Previous fallback -> Default 0\r\n return {\r\n left: value.left ?? value.horizontal ?? previous?.left ?? 0,\r\n right: value.right ?? value.horizontal ?? previous?.right ?? 0,\r\n top: value.top ?? value.vertical ?? previous?.top ?? 0,\r\n bottom: value.bottom ?? value.vertical ?? previous?.bottom ?? 0,\r\n };\r\n },\r\n lerp: (from: InsetsResolved, to: InsetsResolved, t: number): InsetsResolved => {\r\n return {\r\n left: lerpNumber(from.left, to.left, t),\r\n right: lerpNumber(from.right, to.right, t),\r\n top: lerpNumber(from.top, to.top, t),\r\n bottom: lerpNumber(from.bottom, to.bottom, t),\r\n };\r\n },\r\n insetBounds: (outerWidth, outerHeight, pad) => ({\r\n width: Math.max(0, outerWidth - pad.left - pad.right),\r\n height: Math.max(0, outerHeight - pad.top - pad.bottom),\r\n x: (pad.left - pad.right) / 2,\r\n y: (pad.top - pad.bottom) / 2,\r\n }),\r\n outsetSize: (innerWidth, innerHeight, pad) => ({\r\n width: innerWidth + pad.left + pad.right,\r\n height: innerHeight + pad.top + pad.bottom,\r\n }),\r\n};\r\n"]}
1
+ {"version":3,"file":"insets.js","sourceRoot":"","sources":["../../../src/attributes/layout/insets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAwD1C,MAAM,CAAC,MAAM,SAAS,GAA0D;IAC5E,OAAO,EAAE,CAAC,KAAkB,EAAE,QAAyB,EAAkB,EAAE;QACvE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QACpE,CAAC;QAED,mGAAmG;QACnG,OAAO;YACH,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,UAAU,IAAI,QAAQ,EAAE,IAAI,IAAI,CAAC;YAC3D,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,UAAU,IAAI,QAAQ,EAAE,KAAK,IAAI,CAAC;YAC9D,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,QAAQ,IAAI,QAAQ,EAAE,GAAG,IAAI,CAAC;YACtD,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,QAAQ,EAAE,MAAM,IAAI,C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esContent":["import { lerpNumber } from \"@/tween/lerp\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\nimport type { BoxBounds } from \"@/layout/bounds\";\r\nimport { Size2D } from \"./size\";\r\n\r\n/** Fully resolved per-side edge insets. */\r\nexport interface InsetsResolved {\r\n left: number;\r\n right: number;\r\n top: number;\r\n bottom: number;\r\n}\r\n\r\n\r\nexport type InsetsProps = number | Partial<InsetsResolved> & {\r\n horizontal?: number;\r\n vertical?: number;\r\n};\r\n\r\n/**\r\n * Accepted shapes for a four-sided inset prop.\r\n *\r\n * The type is named for the shape (four edge insets), not for one use of it:\r\n * `Node2D.padding` insets a layout box in pixels, an image fill's `crop` insets a\r\n * source in fractions. Same value, same shorthands, same tween — different roles,\r\n * and each prop names its own.\r\n *\r\n * Mirrors {@link Fill}: the loose author-facing {@link InsetsProps} (a number or\r\n * per-side/symmetric object) plus the strict {@link InsetsResolved} — a read-back\r\n * resolved value structurally satisfies `InsetsProps`, so it passes through\r\n * `insetsOps.resolve` idempotently and can be assigned straight back.\r\n *\r\n * node.padding = 3 // uniform\r\n * node.padding = { horizontal: 8, top: 4 } // mixed\r\n * node.padding = otherNode.padding // resolved passes through\r\n */\r\nexport type Insets = InsetsProps | InsetsResolved;\r\n\r\n\r\n/**\r\n * The insets attribute's op set — used by `insetsProperty` and anywhere else a\r\n * four-sided inset (padding, an image fill's `crop`, …) resolves and tweens.\r\n *\r\n * `insetBounds` computes the inner content area produced by subtracting a\r\n * resolved inset from an outer size — pure, works for any width/height pair,\r\n * with `x`/`y` carrying the offset of the inner-area center relative to the\r\n * outer-area center. `outsetSize` is its inverse: adds padding back onto\r\n * an inner size to get the outer size that contains it.\r\n */\r\n\r\nexport interface InsetsOps {\r\n\r\n insetBounds(outerWidth: number, outerHeight: number, pad: InsetsResolved): BoxBounds;\r\n outsetSize(innerWidth: number, innerHeight: number, pad: InsetsResolved): Size2D;\r\n}\r\n\r\nexport const insetsOps: AttributeOps<InsetsProps, InsetsResolved> & InsetsOps = {\r\n resolve: (value: InsetsProps, previous?: InsetsResolved): InsetsResolved => {\r\n if (typeof value === \"number\") {\r\n return { left: value, right: value, top: value, bottom: value };\r\n }\r\n\r\n // Fallback resolution order: Specific side -> Symmetric shortcut -> Previous fallback -> Default 0\r\n return {\r\n left: value.left ?? value.horizontal ?? previous?.left ?? 0,\r\n right: value.right ?? value.horizontal ?? previous?.right ?? 0,\r\n top: value.top ?? value.vertical ?? previous?.top ?? 0,\r\n bottom: value.bottom ?? value.vertical ?? previous?.bottom ?? 0,\r\n };\r\n },\r\n lerp: (from: InsetsResolved, to: InsetsResolved, t: number): InsetsResolved => {\r\n return {\r\n left: lerpNumber(from.left, to.left, t),\r\n right: lerpNumber(from.right, to.right, t),\r\n top: lerpNumber(from.top, to.top, t),\r\n bottom: lerpNumber(from.bottom, to.bottom, t),\r\n };\r\n },\r\n insetBounds: (outerWidth, outerHeight, pad) => ({\r\n width: Math.max(0, outerWidth - pad.left - pad.right),\r\n height: Math.max(0, outerHeight - pad.top - pad.bottom),\r\n x: (pad.left - pad.right) / 2,\r\n y: (pad.top - pad.bottom) / 2,\r\n }),\r\n outsetSize: (innerWidth, innerHeight, pad) => ({\r\n width: innerWidth + pad.left + pad.right,\r\n height: innerHeight + pad.top + pad.bottom,\r\n }),\r\n};\r\n"]}
@@ -28,7 +28,7 @@ export type SizeType = "fill" | "hug";
28
28
  /** @internal */
29
29
  export type SizeInput = SizeType | number;
30
30
  /**
31
- * The dimension-keyword `SizeInput` attribute's op set — used by `@sizeProperty`.
31
+ * The dimension-keyword `SizeInput` attribute's op set — `width`/`height`'s.
32
32
  * `lerp` interpolates two numbers; a keyword on either end hard-switches at t=1.
33
33
  * `resolveLayout` turns a `SizeInput` into a concrete number for layout, given
34
34
  * the space available and the size contents would need; `isAuto` reports
@@ -22,7 +22,7 @@ export const size2DOps = {
22
22
  },
23
23
  };
24
24
  /**
25
- * The dimension-keyword `SizeInput` attribute's op set — used by `@sizeProperty`.
25
+ * The dimension-keyword `SizeInput` attribute's op set — `width`/`height`'s.
26
26
  * `lerp` interpolates two numbers; a keyword on either end hard-switches at t=1.
27
27
  * `resolveLayout` turns a `SizeInput` into a concrete number for layout, given
28
28
  * the space available and the size contents would need; `isAuto` reports
@@ -1 +1 @@
1
- {"version":3,"file":"size.js","sourceRoot":"","sources":["../../../src/attributes/layout/size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAoF;IACtG,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;IACtH,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;QACd,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO;QACrC,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;QACxD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;IAC9D,CAAC;CACJ,CAAC;AAcF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAGrB;IACA,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QAClB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;YACrD,OAAO,UAAU,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/B,CAAC;IACD,aAAa,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,EAAE;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,KAAK,KAAK,MAAM;YAAE,OAAO,aAAa,CAAC;QAC3C,IAAI,KAAK,KAAK,KAAK;YAAE,OAAO,WAAW,CAAC;QACxC,OAAO,aAAa,CAAC;IACzB,CAAC;IACD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ;CAC/C,CAAC","sourcesContent":["import { lerpNumber } from \"@/tween/lerp\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\n\r\n/** Width and height in pixels. */\r\nexport interface Size2D {\r\n width: number;\r\n height: number;\r\n}\r\n\r\n/**\r\n * The {@link Size2D} attribute's op set: `lerp` interpolates `width`/`height`\r\n * independently. `expand` fills the `size` shorthand into `width`/`height` on a\r\n * props-like object, in place. `size` is sugar for \"the same value on both\r\n * axes\"; explicit `width`/`height` take precedence over it (same precedence as\r\n * `insetsOps.resolve`'s side-vs-shorthand rule), so `{ size: 200, width: 100 }`\r\n * keeps `width: 100` and only fills in `height: 200`. No-op when `size` is\r\n * absent. The reactive-binding form (`size: () => SizeInput`) is supported —\r\n * both axes are bound to the same callback, re-evaluated independently per axis.\r\n */\r\nexport const size2DOps: AttributeOps<Size2D, Size2D> & { expand(props: Record<string, unknown>): void } = {\r\n resolve: (value) => value,\r\n lerp: (from, to, t) => ({ width: lerpNumber(from.width, to.width, t), height: lerpNumber(from.height, to.height, t) }),\r\n expand: (props) => {\r\n if (props.size === undefined) return;\r\n if (props.width === undefined) props.width = props.size;\r\n if (props.height === undefined) props.height = props.size;\r\n },\r\n};\r\n\r\n/**\r\n * Sizing behavior for a node dimension.\r\n * - `\"fill\"`: expand to fill available space from the parent\r\n * - `\"hug\"`: shrink to fit the node's own content\r\n */\r\n/** @internal */\r\nexport type SizeType = \"fill\" | \"hug\";\r\n\r\n/** A dimension can be specified as a behavior keyword or a fixed pixel value. */\r\n/** @internal */\r\nexport type SizeInput = SizeType | number;\r\n\r\n/**\r\n * The dimension-keyword `SizeInput` attribute's op set — used by `@sizeProperty`.\r\n * `lerp` interpolates two numbers; a keyword on either end hard-switches at t=1.\r\n * `resolveLayout` turns a `SizeInput` into a concrete number for layout, given\r\n * the space available and the size contents would need; `isAuto` reports\r\n * whether a dimension needs layout to resolve at all (a keyword) as opposed to\r\n * being a fixed number.\r\n */\r\nexport const sizeInputOps: AttributeOps<SizeInput, SizeInput> & {\r\n resolveLayout(input: SizeInput, availableSize: number, contentSize: number): number;\r\n isAuto(input: SizeInput): boolean;\r\n} = {\r\n resolve: (value) => value,\r\n lerp: (from, to, t) => {\r\n if (typeof from === \"number\" && typeof to === \"number\") {\r\n return lerpNumber(from, to, t);\r\n }\r\n return t === 1 ? to : from;\r\n },\r\n resolveLayout: (input, availableSize, contentSize) => {\r\n if (typeof input === \"number\") return input;\r\n if (input === \"fill\") return availableSize;\r\n if (input === \"hug\") return contentSize;\r\n return availableSize;\r\n },\r\n isAuto: (input) => typeof input !== \"number\",\r\n};\r\n"]}
1
+ {"version":3,"file":"size.js","sourceRoot":"","sources":["../../../src/attributes/layout/size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAoF;IACtG,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,UA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C,OAAO,KAAK,KAAK,QAAQ;CAC/C,CAAC","sourcesContent":["import { lerpNumber } from \"@/tween/lerp\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\n\r\n/** Width and height in pixels. */\r\nexport interface Size2D {\r\n width: number;\r\n height: number;\r\n}\r\n\r\n/**\r\n * The {@link Size2D} attribute's op set: `lerp` interpolates `width`/`height`\r\n * independently. `expand` fills the `size` shorthand into `width`/`height` on a\r\n * props-like object, in place. `size` is sugar for \"the same value on both\r\n * axes\"; explicit `width`/`height` take precedence over it (same precedence as\r\n * `insetsOps.resolve`'s side-vs-shorthand rule), so `{ size: 200, width: 100 }`\r\n * keeps `width: 100` and only fills in `height: 200`. No-op when `size` is\r\n * absent. The reactive-binding form (`size: () => SizeInput`) is supported —\r\n * both axes are bound to the same callback, re-evaluated independently per axis.\r\n */\r\nexport const size2DOps: AttributeOps<Size2D, Size2D> & { expand(props: Record<string, unknown>): void } = {\r\n resolve: (value) => value,\r\n lerp: (from, to, t) => ({ width: lerpNumber(from.width, to.width, t), height: lerpNumber(from.height, to.height, t) }),\r\n expand: (props) => {\r\n if (props.size === undefined) return;\r\n if (props.width === undefined) props.width = props.size;\r\n if (props.height === undefined) props.height = props.size;\r\n },\r\n};\r\n\r\n/**\r\n * Sizing behavior for a node dimension.\r\n * - `\"fill\"`: expand to fill available space from the parent\r\n * - `\"hug\"`: shrink to fit the node's own content\r\n */\r\n/** @internal */\r\nexport type SizeType = \"fill\" | \"hug\";\r\n\r\n/** A dimension can be specified as a behavior keyword or a fixed pixel value. */\r\n/** @internal */\r\nexport type SizeInput = SizeType | number;\r\n\r\n/**\r\n * The dimension-keyword `SizeInput` attribute's op set — `width`/`height`'s.\r\n * `lerp` interpolates two numbers; a keyword on either end hard-switches at t=1.\r\n * `resolveLayout` turns a `SizeInput` into a concrete number for layout, given\r\n * the space available and the size contents would need; `isAuto` reports\r\n * whether a dimension needs layout to resolve at all (a keyword) as opposed to\r\n * being a fixed number.\r\n */\r\nexport const sizeInputOps: AttributeOps<SizeInput, SizeInput> & {\r\n resolveLayout(input: SizeInput, availableSize: number, contentSize: number): number;\r\n isAuto(input: SizeInput): boolean;\r\n} = {\r\n resolve: (value) => value,\r\n lerp: (from, to, t) => {\r\n if (typeof from === \"number\" && typeof to === \"number\") {\r\n return lerpNumber(from, to, t);\r\n }\r\n return t === 1 ? to : from;\r\n },\r\n resolveLayout: (input, availableSize, contentSize) => {\r\n if (typeof input === \"number\") return input;\r\n if (input === \"fill\") return availableSize;\r\n if (input === \"hug\") return contentSize;\r\n return availableSize;\r\n },\r\n isAuto: (input) => typeof input !== \"number\",\r\n};\r\n"]}
@@ -11,7 +11,7 @@ export interface PropertyMeta {
11
11
  options?: PropOptions<any, any>;
12
12
  /** How a host edits this prop — see {@link PropertyEditor}. */
13
13
  editor?: PropertyEditor;
14
- /** Withdrawn by a subclass: undescribed, and held at its default. See `withdraw`. */
14
+ /** @deprecated Nothing sets it: the engine withdraws no property. Kept so a host that tests it still compiles. */
15
15
  withdrawn?: boolean;
16
16
  }
17
17
  /**
@@ -28,8 +28,8 @@ export interface PropertyMeta {
28
28
  */
29
29
  export interface PropertyEditor {
30
30
  /**
31
- * The control to draw. Inferred when absent — a typed decorator knows its
32
- * own (`@colorProperty` is a colour), and a plain `@property` reads it off
31
+ * The control to draw. Inferred when absent — a typed entry knows its
32
+ * own (`Types.color` is a colour), and a plain `property` reads it off
33
33
  * the default's type.
34
34
  */
35
35
  kind?: string;
@@ -55,10 +55,10 @@ export interface PropertyEditor {
55
55
  /** Whatever a control needs that this vocabulary does not name. */
56
56
  [option: string]: unknown;
57
57
  }
58
- /** Symbol used to store @property metadata on class prototypes. */
58
+ /** Symbol used to store property metadata on class prototypes. */
59
59
  export declare const PROPERTY_META: unique symbol;
60
60
  /**
61
- * Every `@property` on an instance's class, inherited included, ordered base →
61
+ * Every `property` on an instance's class, inherited included, ordered base →
62
62
  * subclass so `initProps` applies them in declaration order. A subclass that
63
63
  * redeclares a key replaces the inherited declaration whole — default, mapper,
64
64
  * tween and editor — at the position the base gave it.
@@ -72,16 +72,49 @@ export declare function mostDerived<M extends {
72
72
  key: string;
73
73
  }>(instance: object, symbol: symbol): M[];
74
74
  /**
75
- * Legacy property decorator (`experimentalDecorators: true`) that declares a
76
- * property on a `Node` subclass. Redeclaring an inherited key overrides it; see
77
- * {@link getPropertyMeta}.
75
+ * A registration for one member of a node class: what `property(...)` and
76
+ * `command(...)` return, applied to the class's prototype under the member's
77
+ * key by {@link declareMembers}.
78
+ */
79
+ export type MemberRegistration = (target: object, key: string) => void;
80
+ /**
81
+ * Registers properties and commands on a node class, in the order given.
82
+ *
83
+ * Core's own base classes (`Node`, `Node2D`, `Node3D`, …) declare their props
84
+ * as `declare` fields and register them here, right after the class body.
85
+ * Order is meaningful: {@link getPropertyMeta} lists properties in
86
+ * registration order, which is the order `Registry.describe` hands a host's
87
+ * inspector, so a new entry goes where it should appear.
78
88
  *
79
89
  * @example
80
90
  * ```ts
81
- * @property({ default: 0 }) declare x: number;
91
+ * class Dial extends Node2D<DialProps> {
92
+ * declare level: number;
93
+ * turn(args: CommandArgs<{ by: number }>) { … }
94
+ * }
95
+ * declareMembers(Dial, {
96
+ * level: property({ default: 0 }),
97
+ * turn: command({ args: ["by"] }),
98
+ * });
99
+ * ```
82
100
  *
83
- * @property({ mapper: fillOps.resolve, tween: fillOps.lerp })
84
- * declare fill: FillResolved[];
101
+ * Node types outside core are components (`component2d`), which do this for
102
+ * their `props` and `commands` themselves.
103
+ */
104
+ export declare function declareMembers<C extends abstract new (...args: never[]) => object>(ctor: C, members: {
105
+ [K in keyof InstanceType<C> & string]?: MemberRegistration;
106
+ }): void;
107
+ /**
108
+ * Declares a property on a `Node` subclass: applied to the prototype under the
109
+ * property's key, directly or through {@link declareMembers}. Redeclaring an
110
+ * inherited key overrides it; see {@link getPropertyMeta}.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * declareMembers(Glow, {
115
+ * radius: property({ default: 0 }),
116
+ * fill: property({ mapper: fillOps.resolve, tween: fillOps.lerp }),
117
+ * });
85
118
  * ```
86
119
  *
87
120
  * The `default` value is used when the corresponding key is absent from the
@@ -1 +1 @@
1
- {"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/attributes/properties/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,WAAW,WAAW,CAAC,GAAG,EAAE,GAAG;IACjC,+LAA+L;IAC/L,KAAK,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACrB,yIAAyI;IACzI,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;CAC1C;AAGD,MAAM,WAAW,YAAY;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAChC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,qFAAqF;IACrF,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,yDAAyD;IACzD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,mEAAmE;IACnE,CAAC,M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