motionary 10.3.0 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (421) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +31 -0
  3. package/README.md +72 -0
  4. package/bin/motionary-mcp.mjs +265 -0
  5. package/dist/chunks/anim-image-BlNPv4JG.js +166 -0
  6. package/dist/chunks/anim-image-BlNPv4JG.js.map +1 -0
  7. package/dist/chunks/anim-image-DuxvYhq6.cjs +174 -0
  8. package/dist/chunks/anim-image-DuxvYhq6.cjs.map +1 -0
  9. package/dist/chunks/audio-BpU-A1m1.cjs.map +1 -1
  10. package/dist/chunks/{audio-D95jwlOh.js → audio-CWt1xdZB.js} +3 -3
  11. package/dist/chunks/{audio-D95jwlOh.js.map → audio-CWt1xdZB.js.map} +1 -1
  12. package/dist/chunks/{base-BnRyfuyM.js → base-BTev8qxg.js} +2 -2
  13. package/dist/chunks/{base-BnRyfuyM.js.map → base-BTev8qxg.js.map} +1 -1
  14. package/dist/chunks/base-DBheNxJu.cjs.map +1 -1
  15. package/dist/chunks/bind-B_CTL6Qn.js.map +1 -1
  16. package/dist/chunks/bind-Ui43-n2d.cjs.map +1 -1
  17. package/dist/chunks/builtins-CKKZNR95.cjs.map +1 -1
  18. package/dist/chunks/{builtins-CqIq1zBv.js → builtins-CPmS6aDB.js} +3 -3
  19. package/dist/chunks/{builtins-CqIq1zBv.js.map → builtins-CPmS6aDB.js.map} +1 -1
  20. package/dist/chunks/core-B5T0dhFH.cjs.map +1 -1
  21. package/dist/chunks/{core-DsGoL9EY.js → core-BviA7nFa.js} +2 -2
  22. package/dist/chunks/{core-DsGoL9EY.js.map → core-BviA7nFa.js.map} +1 -1
  23. package/dist/chunks/core-D74Fz-dL.cjs.map +1 -1
  24. package/dist/chunks/core-D7cVumUu.js.map +1 -1
  25. package/dist/chunks/{core-XA2yhn1b.js → core-KiM7MXjL.js} +2 -2
  26. package/dist/chunks/{core-XA2yhn1b.js.map → core-KiM7MXjL.js.map} +1 -1
  27. package/dist/chunks/core-MQlXZKUG.cjs.map +1 -1
  28. package/dist/chunks/ease-HwYZnZat.cjs +94 -0
  29. package/dist/chunks/ease-HwYZnZat.cjs.map +1 -0
  30. package/dist/chunks/ease-XN8_0sXu.js +89 -0
  31. package/dist/chunks/ease-XN8_0sXu.js.map +1 -0
  32. package/dist/chunks/fx-B_pbhpDp.cjs.map +1 -1
  33. package/dist/chunks/{fx-CtnrFEg9.js → fx-CgWKqVsn.js} +2 -2
  34. package/dist/chunks/{fx-CtnrFEg9.js.map → fx-CgWKqVsn.js.map} +1 -1
  35. package/dist/chunks/generative-2LhxG5BJ.js.map +1 -1
  36. package/dist/chunks/generative-BHIj-NU0.cjs.map +1 -1
  37. package/dist/chunks/{gpu-CDcXiNA8.js → gpu-BWfgYWMY.js} +2 -2
  38. package/dist/chunks/{gpu-CDcXiNA8.js.map → gpu-BWfgYWMY.js.map} +1 -1
  39. package/dist/chunks/gpu-cUixt7kT.cjs.map +1 -1
  40. package/dist/chunks/index-tags-B-JBecYg.js.map +1 -1
  41. package/dist/chunks/index-tags-hLIF2Clq.cjs.map +1 -1
  42. package/dist/chunks/{keyframes-DVAC5sQI.js → keyframes-B8ITIAVa.js} +3 -2
  43. package/dist/chunks/keyframes-B8ITIAVa.js.map +1 -0
  44. package/dist/chunks/{keyframes-Dw9zwVQa.cjs → keyframes-Ce1s05n3.cjs} +4 -3
  45. package/dist/chunks/keyframes-Ce1s05n3.cjs.map +1 -0
  46. package/dist/chunks/{manifest-D58HXVY-.js → manifest-BHx5yPN6.js} +2 -2
  47. package/dist/chunks/{manifest-D58HXVY-.js.map → manifest-BHx5yPN6.js.map} +1 -1
  48. package/dist/chunks/manifest-PaF9B8Vt.cjs.map +1 -1
  49. package/dist/chunks/{player-48Zy_NBG.js → player-BfHMNtiM.js} +4 -4
  50. package/dist/chunks/{player-48Zy_NBG.js.map → player-BfHMNtiM.js.map} +1 -1
  51. package/dist/chunks/player-C4y4jXSv.cjs.map +1 -1
  52. package/dist/chunks/presets-BYBVJVeP.js.map +1 -1
  53. package/dist/chunks/presets-CUHys3sK.cjs.map +1 -1
  54. package/dist/chunks/{registry-gFJRpPES.js → registry-BKzyg1JV.js} +2 -2
  55. package/dist/chunks/{registry-gFJRpPES.js.map → registry-BKzyg1JV.js.map} +1 -1
  56. package/dist/chunks/{registry-46AAzyeC.js → registry-DXdFb2fJ.js} +3 -3
  57. package/dist/chunks/{registry-46AAzyeC.js.map → registry-DXdFb2fJ.js.map} +1 -1
  58. package/dist/chunks/{registry-CSVil2qJ.cjs → registry-VhfPSI0v.cjs} +2 -2
  59. package/dist/chunks/{registry-CSVil2qJ.cjs.map → registry-VhfPSI0v.cjs.map} +1 -1
  60. package/dist/chunks/registry-xQZnSqqV.cjs.map +1 -1
  61. package/dist/chunks/shared-CkKHWrtJ.js.map +1 -1
  62. package/dist/chunks/shared-jkgRH-Hx.cjs.map +1 -1
  63. package/dist/chunks/{spring-CZDNyqWp.js → spring-BHuP55DR.js} +2 -2
  64. package/dist/chunks/{spring-CZDNyqWp.js.map → spring-BHuP55DR.js.map} +1 -1
  65. package/dist/chunks/spring-BlTQD2AV.cjs.map +1 -1
  66. package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -1
  67. package/dist/chunks/stagger-DtMKo2SK.js.map +1 -1
  68. package/dist/chunks/{ticker-COOYAyQy.js → ticker-C5RMHMW7.js} +2 -2
  69. package/dist/chunks/{ticker-COOYAyQy.js.map → ticker-C5RMHMW7.js.map} +1 -1
  70. package/dist/chunks/{ticker-gHv6pNfx.cjs → ticker-DvmC6WLS.cjs} +2 -2
  71. package/dist/chunks/{ticker-gHv6pNfx.cjs.map → ticker-DvmC6WLS.cjs.map} +1 -1
  72. package/dist/chunks/{tween-CGyolmzB.js → tween-CPtm-EdT.js} +4 -90
  73. package/dist/chunks/tween-CPtm-EdT.js.map +1 -0
  74. package/dist/chunks/{tween-CFN0WcOb.cjs → tween-_BGIl6hK.cjs} +4 -94
  75. package/dist/chunks/tween-_BGIl6hK.cjs.map +1 -0
  76. package/dist/chunks/variants-CrDDJoYK.cjs.map +1 -1
  77. package/dist/chunks/{variants-GU3yIL4F.js → variants-CsRGUIyA.js} +2 -2
  78. package/dist/chunks/{variants-GU3yIL4F.js.map → variants-CsRGUIyA.js.map} +1 -1
  79. package/dist/components/a11y.cjs.map +1 -1
  80. package/dist/components/a11y.js +2 -2
  81. package/dist/components/a11y.js.map +1 -1
  82. package/dist/components/angular.cjs.map +1 -1
  83. package/dist/components/angular.js +8 -8
  84. package/dist/components/angular.js.map +1 -1
  85. package/dist/components/background.cjs.map +1 -1
  86. package/dist/components/background.js +2 -2
  87. package/dist/components/background.js.map +1 -1
  88. package/dist/components/bridge.cjs.map +1 -1
  89. package/dist/components/bridge.js +1 -1
  90. package/dist/components/bridge.js.map +1 -1
  91. package/dist/components/cards.cjs.map +1 -1
  92. package/dist/components/cards.js +2 -2
  93. package/dist/components/cards.js.map +1 -1
  94. package/dist/components/click.cjs.map +1 -1
  95. package/dist/components/click.js +3 -3
  96. package/dist/components/click.js.map +1 -1
  97. package/dist/components/core.cjs.map +1 -1
  98. package/dist/components/core.js.map +1 -1
  99. package/dist/components/depth.cjs.map +1 -1
  100. package/dist/components/depth.js +3 -3
  101. package/dist/components/depth.js.map +1 -1
  102. package/dist/components/design.cjs.map +1 -1
  103. package/dist/components/design.js +3 -3
  104. package/dist/components/design.js.map +1 -1
  105. package/dist/components/dsl.cjs.map +1 -1
  106. package/dist/components/dsl.js +2 -2
  107. package/dist/components/dsl.js.map +1 -1
  108. package/dist/components/effects.cjs.map +1 -1
  109. package/dist/components/effects.js +9 -9
  110. package/dist/components/effects.js.map +1 -1
  111. package/dist/components/engine.cjs.map +1 -1
  112. package/dist/components/engine.js +2 -2
  113. package/dist/components/engine.js.map +1 -1
  114. package/dist/components/feedback.cjs.map +1 -1
  115. package/dist/components/feedback.js +1 -1
  116. package/dist/components/feedback.js.map +1 -1
  117. package/dist/components/fx-3d.cjs.map +1 -1
  118. package/dist/components/fx-3d.js +2 -2
  119. package/dist/components/fx-3d.js.map +1 -1
  120. package/dist/components/fx-ai.cjs.map +1 -1
  121. package/dist/components/fx-ai.js +2 -2
  122. package/dist/components/fx-ai.js.map +1 -1
  123. package/dist/components/fx-chart.cjs.map +1 -1
  124. package/dist/components/fx-chart.js +2 -2
  125. package/dist/components/fx-chart.js.map +1 -1
  126. package/dist/components/fx-cinema.cjs.map +1 -1
  127. package/dist/components/fx-cinema.js +2 -2
  128. package/dist/components/fx-cinema.js.map +1 -1
  129. package/dist/components/fx-cyber.cjs.map +1 -1
  130. package/dist/components/fx-cyber.js +2 -2
  131. package/dist/components/fx-cyber.js.map +1 -1
  132. package/dist/components/fx-festival.cjs.map +1 -1
  133. package/dist/components/fx-festival.js +2 -2
  134. package/dist/components/fx-festival.js.map +1 -1
  135. package/dist/components/fx-focus.cjs.map +1 -1
  136. package/dist/components/fx-focus.js +2 -2
  137. package/dist/components/fx-focus.js.map +1 -1
  138. package/dist/components/fx-form.cjs.map +1 -1
  139. package/dist/components/fx-form.js +2 -2
  140. package/dist/components/fx-form.js.map +1 -1
  141. package/dist/components/fx-game.cjs.map +1 -1
  142. package/dist/components/fx-game.js +2 -2
  143. package/dist/components/fx-game.js.map +1 -1
  144. package/dist/components/fx-genart.cjs.map +1 -1
  145. package/dist/components/fx-genart.js +2 -2
  146. package/dist/components/fx-genart.js.map +1 -1
  147. package/dist/components/fx-geo.cjs.map +1 -1
  148. package/dist/components/fx-geo.js +2 -2
  149. package/dist/components/fx-geo.js.map +1 -1
  150. package/dist/components/fx-gesture.cjs.map +1 -1
  151. package/dist/components/fx-gesture.js +2 -2
  152. package/dist/components/fx-gesture.js.map +1 -1
  153. package/dist/components/fx-gpu.js +3 -3
  154. package/dist/components/fx-light.cjs.map +1 -1
  155. package/dist/components/fx-light.js +2 -2
  156. package/dist/components/fx-light.js.map +1 -1
  157. package/dist/components/fx-lottie.cjs.map +1 -1
  158. package/dist/components/fx-lottie.js +2 -2
  159. package/dist/components/fx-lottie.js.map +1 -1
  160. package/dist/components/fx-morph.cjs.map +1 -1
  161. package/dist/components/fx-morph.js +2 -2
  162. package/dist/components/fx-morph.js.map +1 -1
  163. package/dist/components/fx-music.cjs.map +1 -1
  164. package/dist/components/fx-music.js +3 -3
  165. package/dist/components/fx-music.js.map +1 -1
  166. package/dist/components/fx-organic.cjs.map +1 -1
  167. package/dist/components/fx-organic.js +2 -2
  168. package/dist/components/fx-organic.js.map +1 -1
  169. package/dist/components/fx-paper.cjs.map +1 -1
  170. package/dist/components/fx-paper.js +2 -2
  171. package/dist/components/fx-paper.js.map +1 -1
  172. package/dist/components/fx-perf.cjs.map +1 -1
  173. package/dist/components/fx-perf.js +2 -2
  174. package/dist/components/fx-perf.js.map +1 -1
  175. package/dist/components/fx-physics.cjs.map +1 -1
  176. package/dist/components/fx-physics.js +2 -2
  177. package/dist/components/fx-physics.js.map +1 -1
  178. package/dist/components/fx-retro.cjs.map +1 -1
  179. package/dist/components/fx-retro.js +2 -2
  180. package/dist/components/fx-retro.js.map +1 -1
  181. package/dist/components/fx-safe.cjs.map +1 -1
  182. package/dist/components/fx-safe.js +2 -2
  183. package/dist/components/fx-safe.js.map +1 -1
  184. package/dist/components/fx-shop.cjs.map +1 -1
  185. package/dist/components/fx-shop.js +2 -2
  186. package/dist/components/fx-shop.js.map +1 -1
  187. package/dist/components/fx-social.cjs.map +1 -1
  188. package/dist/components/fx-social.js +2 -2
  189. package/dist/components/fx-social.js.map +1 -1
  190. package/dist/components/fx-spatial.cjs.map +1 -1
  191. package/dist/components/fx-spatial.js +2 -2
  192. package/dist/components/fx-spatial.js.map +1 -1
  193. package/dist/components/fx-surface.cjs.map +1 -1
  194. package/dist/components/fx-surface.js +2 -2
  195. package/dist/components/fx-surface.js.map +1 -1
  196. package/dist/components/fx-text.cjs.map +1 -1
  197. package/dist/components/fx-text.js +2 -2
  198. package/dist/components/fx-text.js.map +1 -1
  199. package/dist/components/fx-transitions.cjs.map +1 -1
  200. package/dist/components/fx-transitions.js +3 -3
  201. package/dist/components/fx-transitions.js.map +1 -1
  202. package/dist/components/fx-video.cjs.map +1 -1
  203. package/dist/components/fx-video.js +2 -2
  204. package/dist/components/fx-video.js.map +1 -1
  205. package/dist/components/fx-weather.cjs.map +1 -1
  206. package/dist/components/fx-weather.js +2 -2
  207. package/dist/components/fx-weather.js.map +1 -1
  208. package/dist/components/fx.cjs.map +1 -1
  209. package/dist/components/fx.js +6 -6
  210. package/dist/components/fx.js.map +1 -1
  211. package/dist/components/fx2.cjs.map +1 -1
  212. package/dist/components/fx2.js +6 -6
  213. package/dist/components/fx2.js.map +1 -1
  214. package/dist/components/gesture.cjs.map +1 -1
  215. package/dist/components/gesture.js +4 -4
  216. package/dist/components/gesture.js.map +1 -1
  217. package/dist/components/interaction.cjs.map +1 -1
  218. package/dist/components/interaction.js +1 -1
  219. package/dist/components/interaction.js.map +1 -1
  220. package/dist/components/layout.cjs.map +1 -1
  221. package/dist/components/layout.js +1 -1
  222. package/dist/components/layout.js.map +1 -1
  223. package/dist/components/lazy.cjs.map +1 -1
  224. package/dist/components/lazy.js.map +1 -1
  225. package/dist/components/lite.cjs.map +1 -1
  226. package/dist/components/lite.js.map +1 -1
  227. package/dist/components/marketplace.cjs.map +1 -1
  228. package/dist/components/marketplace.js +4 -4
  229. package/dist/components/marketplace.js.map +1 -1
  230. package/dist/components/native.cjs.map +1 -1
  231. package/dist/components/native.js +3 -3
  232. package/dist/components/native.js.map +1 -1
  233. package/dist/components/packs.cjs.map +1 -1
  234. package/dist/components/packs.js +1 -1
  235. package/dist/components/packs.js.map +1 -1
  236. package/dist/components/page.cjs.map +1 -1
  237. package/dist/components/page.js +3 -3
  238. package/dist/components/page.js.map +1 -1
  239. package/dist/components/perf.cjs.map +1 -1
  240. package/dist/components/perf.js +2 -2
  241. package/dist/components/perf.js.map +1 -1
  242. package/dist/components/physics.cjs.map +1 -1
  243. package/dist/components/physics.js +3 -3
  244. package/dist/components/physics.js.map +1 -1
  245. package/dist/components/plugins.cjs.map +1 -1
  246. package/dist/components/plugins.js +4 -4
  247. package/dist/components/plugins.js.map +1 -1
  248. package/dist/components/react.cjs.map +1 -1
  249. package/dist/components/react.js.map +1 -1
  250. package/dist/components/reveal.cjs.map +1 -1
  251. package/dist/components/reveal.js +1 -1
  252. package/dist/components/reveal.js.map +1 -1
  253. package/dist/components/solid.cjs.map +1 -1
  254. package/dist/components/solid.js +8 -8
  255. package/dist/components/solid.js.map +1 -1
  256. package/dist/components/svelte.cjs.map +1 -1
  257. package/dist/components/svelte.js +8 -8
  258. package/dist/components/svelte.js.map +1 -1
  259. package/dist/components/svg.cjs.map +1 -1
  260. package/dist/components/svg.js +1 -1
  261. package/dist/components/svg.js.map +1 -1
  262. package/dist/components/text.cjs.map +1 -1
  263. package/dist/components/text.js +2 -2
  264. package/dist/components/text.js.map +1 -1
  265. package/dist/components/timeline.cjs.map +1 -1
  266. package/dist/components/timeline.js +3 -3
  267. package/dist/components/timeline.js.map +1 -1
  268. package/dist/components/tokens.cjs.map +1 -1
  269. package/dist/components/tokens.js.map +1 -1
  270. package/dist/components/transitions.cjs.map +1 -1
  271. package/dist/components/transitions.js +1 -1
  272. package/dist/components/transitions.js.map +1 -1
  273. package/dist/components/ui.cjs.map +1 -1
  274. package/dist/components/ui.js +4 -4
  275. package/dist/components/ui.js.map +1 -1
  276. package/dist/components/vue.cjs.map +1 -1
  277. package/dist/components/vue.js +8 -8
  278. package/dist/components/vue.js.map +1 -1
  279. package/dist/components/webgl.cjs.map +1 -1
  280. package/dist/components/webgl.js +1 -1
  281. package/dist/components/webgl.js.map +1 -1
  282. package/dist/components/widgets.cjs +1102 -216
  283. package/dist/components/widgets.cjs.map +1 -1
  284. package/dist/components/widgets.d.cts +367 -2
  285. package/dist/components/widgets.d.ts +367 -2
  286. package/dist/components/widgets.js +1100 -225
  287. package/dist/components/widgets.js.map +1 -1
  288. package/dist/components.cjs.map +1 -1
  289. package/dist/components.js +10 -10
  290. package/dist/components.js.map +1 -1
  291. package/dist/element.cjs.map +1 -1
  292. package/dist/element.js.map +1 -1
  293. package/dist/index.cjs.map +1 -1
  294. package/dist/index.js +2 -2
  295. package/dist/index.js.map +1 -1
  296. package/dist/llms-full.txt +303 -1
  297. package/dist/llms.txt +16 -2
  298. package/dist/manifest.json +806 -1
  299. package/dist/presets/extended.cjs.map +1 -1
  300. package/dist/presets/extended.js.map +1 -1
  301. package/dist/react.cjs.map +1 -1
  302. package/dist/react.js.map +1 -1
  303. package/dist/runtime/format-apng.cjs +131 -0
  304. package/dist/runtime/format-apng.cjs.map +1 -0
  305. package/dist/runtime/format-apng.d.cts +250 -0
  306. package/dist/runtime/format-apng.d.ts +250 -0
  307. package/dist/runtime/format-apng.iife.js +2 -0
  308. package/dist/runtime/format-apng.iife.js.map +1 -0
  309. package/dist/runtime/format-apng.js +123 -0
  310. package/dist/runtime/format-apng.js.map +1 -0
  311. package/dist/runtime/format-css.cjs +5 -4
  312. package/dist/runtime/format-css.cjs.map +1 -1
  313. package/dist/runtime/format-css.js +5 -4
  314. package/dist/runtime/format-css.js.map +1 -1
  315. package/dist/runtime/format-gif.cjs +206 -0
  316. package/dist/runtime/format-gif.cjs.map +1 -0
  317. package/dist/runtime/format-gif.d.cts +223 -0
  318. package/dist/runtime/format-gif.d.ts +223 -0
  319. package/dist/runtime/format-gif.iife.js +2 -0
  320. package/dist/runtime/format-gif.iife.js.map +1 -0
  321. package/dist/runtime/format-gif.js +199 -0
  322. package/dist/runtime/format-gif.js.map +1 -0
  323. package/dist/runtime/format-gltf.cjs +207 -0
  324. package/dist/runtime/format-gltf.cjs.map +1 -0
  325. package/dist/runtime/format-gltf.d.cts +251 -0
  326. package/dist/runtime/format-gltf.d.ts +251 -0
  327. package/dist/runtime/format-gltf.iife.js +2 -0
  328. package/dist/runtime/format-gltf.iife.js.map +1 -0
  329. package/dist/runtime/format-gltf.js +200 -0
  330. package/dist/runtime/format-gltf.js.map +1 -0
  331. package/dist/runtime/format-motion.cjs +9 -8
  332. package/dist/runtime/format-motion.cjs.map +1 -1
  333. package/dist/runtime/format-motion.js +5 -4
  334. package/dist/runtime/format-motion.js.map +1 -1
  335. package/dist/runtime/format-obj.cjs +181 -0
  336. package/dist/runtime/format-obj.cjs.map +1 -0
  337. package/dist/runtime/format-obj.d.cts +176 -0
  338. package/dist/runtime/format-obj.d.ts +176 -0
  339. package/dist/runtime/format-obj.iife.js +2 -0
  340. package/dist/runtime/format-obj.iife.js.map +1 -0
  341. package/dist/runtime/format-obj.js +174 -0
  342. package/dist/runtime/format-obj.js.map +1 -0
  343. package/dist/runtime/format-sprite.cjs +4 -3
  344. package/dist/runtime/format-sprite.cjs.map +1 -1
  345. package/dist/runtime/format-sprite.js +4 -3
  346. package/dist/runtime/format-sprite.js.map +1 -1
  347. package/dist/runtime/format-svg.cjs +5 -4
  348. package/dist/runtime/format-svg.cjs.map +1 -1
  349. package/dist/runtime/format-svg.js +4 -3
  350. package/dist/runtime/format-svg.js.map +1 -1
  351. package/dist/runtime/format-webp.cjs +123 -0
  352. package/dist/runtime/format-webp.cjs.map +1 -0
  353. package/dist/runtime/format-webp.d.cts +245 -0
  354. package/dist/runtime/format-webp.d.ts +245 -0
  355. package/dist/runtime/format-webp.iife.js +2 -0
  356. package/dist/runtime/format-webp.iife.js.map +1 -0
  357. package/dist/runtime/format-webp.js +115 -0
  358. package/dist/runtime/format-webp.js.map +1 -0
  359. package/dist/runtime/gl.cjs +763 -0
  360. package/dist/runtime/gl.cjs.map +1 -0
  361. package/dist/runtime/gl.d.cts +260 -0
  362. package/dist/runtime/gl.d.ts +260 -0
  363. package/dist/runtime/gl.iife.js +2 -0
  364. package/dist/runtime/gl.iife.js.map +1 -0
  365. package/dist/runtime/gl.js +739 -0
  366. package/dist/runtime/gl.js.map +1 -0
  367. package/dist/runtime/scroll.cjs +2 -2
  368. package/dist/runtime/scroll.cjs.map +1 -1
  369. package/dist/runtime/scroll.js +2 -2
  370. package/dist/runtime/scroll.js.map +1 -1
  371. package/dist/runtime/smooth.cjs +284 -0
  372. package/dist/runtime/smooth.cjs.map +1 -0
  373. package/dist/runtime/smooth.d.cts +137 -0
  374. package/dist/runtime/smooth.d.ts +137 -0
  375. package/dist/runtime/smooth.iife.js +2 -0
  376. package/dist/runtime/smooth.iife.js.map +1 -0
  377. package/dist/runtime/smooth.js +279 -0
  378. package/dist/runtime/smooth.js.map +1 -0
  379. package/dist/runtime/text.cjs +1 -1
  380. package/dist/runtime/text.cjs.map +1 -1
  381. package/dist/runtime/text.js +1 -1
  382. package/dist/runtime/text.js.map +1 -1
  383. package/dist/runtime.cjs +9 -8
  384. package/dist/runtime.cjs.map +1 -1
  385. package/dist/runtime.d.cts +1 -1
  386. package/dist/runtime.d.ts +1 -1
  387. package/dist/runtime.iife.js +1 -1
  388. package/dist/runtime.iife.js.map +1 -1
  389. package/dist/runtime.js +6 -5
  390. package/dist/runtime.js.map +1 -1
  391. package/dist/solid.cjs.map +1 -1
  392. package/dist/solid.js.map +1 -1
  393. package/dist/svelte.cjs.map +1 -1
  394. package/dist/svelte.js.map +1 -1
  395. package/dist/vue.cjs.map +1 -1
  396. package/dist/vue.js.map +1 -1
  397. package/dist/widgets.umd.js +1 -1
  398. package/dist/widgets.umd.js.map +1 -1
  399. package/docs/ROADMAP.md +2 -2
  400. package/docs/components/README.md +17 -7
  401. package/docs/components/usa-gl-scene.md +66 -0
  402. package/docs/components/usa-gpu-particles.md +32 -0
  403. package/docs/components/usa-parallax-layers.md +38 -0
  404. package/docs/components/usa-scroll-ring.md +32 -0
  405. package/docs/components/usa-shader-backdrop.md +36 -0
  406. package/docs/components/usa-smooth-scroll.md +60 -0
  407. package/docs/components/usa-three-scene.md +20 -0
  408. package/docs/components.md +97 -0
  409. package/docs/mcp.md +50 -0
  410. package/docs/runtime/format-apng.md +59 -0
  411. package/docs/runtime/format-gif.md +60 -0
  412. package/docs/runtime/format-gltf.md +63 -0
  413. package/docs/runtime/format-obj.md +59 -0
  414. package/docs/runtime/format-webp.md +58 -0
  415. package/docs/runtime/gl.md +62 -0
  416. package/docs/runtime/smooth.md +60 -0
  417. package/package.json +75 -3
  418. package/dist/chunks/keyframes-DVAC5sQI.js.map +0 -1
  419. package/dist/chunks/keyframes-Dw9zwVQa.cjs.map +0 -1
  420. package/dist/chunks/tween-CFN0WcOb.cjs.map +0 -1
  421. package/dist/chunks/tween-CGyolmzB.js.map +0 -1
@@ -0,0 +1,763 @@
1
+ 'use strict';
2
+
3
+ var registry = require('../chunks/registry-VhfPSI0v.cjs');
4
+
5
+ /**
6
+ * `motionary/runtime/gl` (10.5) — a small WebGL2 scene renderer written for
7
+ * Motionary (not a Three.js clone; own API, own shaders):
8
+ *
9
+ * - **math** (`mat4`, quaternions — column-major `Float32Array`s), pure;
10
+ * - **scene graph**: `GlNode` (position / rotation quaternion / scale,
11
+ * children, optional mesh), `Camera` (perspective, `lookAt`), lights
12
+ * (`ambient`, up to 4 directional / point), `bounds()` + `frameNode()`;
13
+ * - **geometry** builders (`box`, `plane`, `sphere`, `torus`) and custom
14
+ * geometry from typed arrays (indexed 16 / 32-bit or not);
15
+ * - **materials**: `standard` (metallic-roughness PBR approximation, base
16
+ * colour texture, emissive, ACES-free Reinhard tone mapping, sRGB),
17
+ * `unlit`, and `shader` (your GLSL ES 3.00 fragment with the standard
18
+ * varyings + your uniforms);
19
+ * - **textures** from images, canvases, bitmaps and **videos** (updated per
20
+ * decoded frame with `requestVideoFrameCallback`; `scrubVideo()` seeks a
21
+ * video from a 0–1 progress, e.g. a scroll scene);
22
+ * - `orbitControls()` — drag / wheel / pinch / arrow keys, damping, optional
23
+ * auto-rotate (off under reduced motion).
24
+ *
25
+ * Math, geometry and the scene graph are pure (SSR / workers); rendering
26
+ * needs WebGL2 (`createRenderer()` throws a clear error without it). Model
27
+ * loaders live in `motionary/runtime/format-gltf` and `format-obj`.
28
+ */
29
+ const mat4 = {
30
+ identity: () => new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
31
+ multiply(a, b, out = new Float32Array(16)) {
32
+ for (let c = 0; c < 4; c++)
33
+ for (let r = 0; r < 4; r++)
34
+ out[c * 4 + r] = a[r] * b[c * 4] + a[4 + r] * b[c * 4 + 1] + a[8 + r] * b[c * 4 + 2] + a[12 + r] * b[c * 4 + 3];
35
+ return out;
36
+ },
37
+ perspective(fovy, aspect, near, far) {
38
+ const f = 1 / Math.tan(fovy / 2), nf = 1 / (near - far);
39
+ return new Float32Array([f / aspect, 0, 0, 0, 0, f, 0, 0, 0, 0, (far + near) * nf, -1, 0, 0, 2 * far * near * nf, 0]);
40
+ },
41
+ lookAt(eye, target, up = [0, 1, 0]) {
42
+ let z = sub(eye, target);
43
+ z = norm(z.some((v) => v) ? z : [0, 0, 1]);
44
+ let x = cross(up, z);
45
+ if (!x.some((v) => Math.abs(v) > 1e-9))
46
+ x = cross([0, 0, 1], z);
47
+ x = norm(x);
48
+ const y = cross(z, x);
49
+ return new Float32Array([x[0], y[0], z[0], 0, x[1], y[1], z[1], 0, x[2], y[2], z[2], 0, -dot(x, eye), -dot(y, eye), -dot(z, eye), 1]);
50
+ },
51
+ /** Translation · rotation (quaternion) · scale. */
52
+ compose(t, q, s) {
53
+ const [x, y, z, w] = q, x2 = x + x, y2 = y + y, z2 = z + z;
54
+ const xx = x * x2, xy = x * y2, xz = x * z2, yy = y * y2, yz = y * z2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2;
55
+ return new Float32Array([(1 - (yy + zz)) * s[0], (xy + wz) * s[0], (xz - wy) * s[0], 0, (xy - wz) * s[1], (1 - (xx + zz)) * s[1], (yz + wx) * s[1], 0, (xz + wy) * s[2], (yz - wx) * s[2], (1 - (xx + yy)) * s[2], 0, t[0], t[1], t[2], 1]);
56
+ },
57
+ invert(m) {
58
+ const o = new Float32Array(16);
59
+ const [a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, a30, a31, a32, a33] = m;
60
+ const b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12;
61
+ const b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32;
62
+ let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
63
+ if (!det)
64
+ return null;
65
+ det = 1 / det;
66
+ o[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
67
+ o[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
68
+ o[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
69
+ o[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
70
+ o[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
71
+ o[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
72
+ o[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
73
+ o[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
74
+ o[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
75
+ o[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
76
+ o[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
77
+ o[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
78
+ o[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
79
+ o[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
80
+ o[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
81
+ o[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
82
+ return o;
83
+ },
84
+ /** Inverse-transpose of the upper 3×3 (normal matrix), as a mat3. */
85
+ normal(m) {
86
+ const i = mat4.invert(m) || mat4.identity();
87
+ return new Float32Array([i[0], i[4], i[8], i[1], i[5], i[9], i[2], i[6], i[10]]);
88
+ },
89
+ transformPoint(m, p) {
90
+ const w = m[3] * p[0] + m[7] * p[1] + m[11] * p[2] + m[15] || 1;
91
+ return [(m[0] * p[0] + m[4] * p[1] + m[8] * p[2] + m[12]) / w, (m[1] * p[0] + m[5] * p[1] + m[9] * p[2] + m[13]) / w, (m[2] * p[0] + m[6] * p[1] + m[10] * p[2] + m[14]) / w];
92
+ },
93
+ };
94
+ const sub = (a, b) => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
95
+ const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
96
+ const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
97
+ const norm = (a) => {
98
+ const l = Math.hypot(a[0], a[1], a[2]) || 1;
99
+ return [a[0] / l, a[1] / l, a[2] / l];
100
+ };
101
+ /** Quaternion from Euler angles (radians, XYZ order). */
102
+ function quatFromEuler(x, y, z) {
103
+ const cx = Math.cos(x / 2), sx = Math.sin(x / 2), cy = Math.cos(y / 2), sy = Math.sin(y / 2), cz = Math.cos(z / 2), sz = Math.sin(z / 2);
104
+ return [sx * cy * cz + cx * sy * sz, cx * sy * cz - sx * cy * sz, cx * cy * sz + sx * sy * cz, cx * cy * cz - sx * sy * sz];
105
+ }
106
+ /** Hamilton product a·b. */
107
+ function quatMultiply(a, b) {
108
+ return [a[3] * b[0] + a[0] * b[3] + a[1] * b[2] - a[2] * b[1], a[3] * b[1] - a[0] * b[2] + a[1] * b[3] + a[2] * b[0], a[3] * b[2] + a[0] * b[1] - a[1] * b[0] + a[2] * b[3], a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2]];
109
+ }
110
+ /** Spherical interpolation. */
111
+ function quatSlerp(a, b, t) {
112
+ let d = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
113
+ const bb = d < 0 ? b.map((v) => -v) : b;
114
+ d = Math.abs(d);
115
+ if (d > 0.9995) {
116
+ const r = a.map((v, i) => v + (bb[i] - v) * t);
117
+ const l = Math.hypot(...r) || 1;
118
+ return r.map((v) => v / l);
119
+ }
120
+ const th = Math.acos(d), s = Math.sin(th), wa = Math.sin((1 - t) * th) / s, wb = Math.sin(t * th) / s;
121
+ return a.map((v, i) => v * wa + bb[i] * wb);
122
+ }
123
+ const geo = (p, n, uv, idx) => ({ positions: new Float32Array(p), normals: new Float32Array(n), uvs: new Float32Array(uv), indices: p.length / 3 > 65535 ? new Uint32Array(idx) : new Uint16Array(idx) });
124
+ /** Axis-aligned box centred on the origin. */
125
+ function box(w = 1, h = 1, d = 1) {
126
+ const p = [], n = [], uv = [], idx = [];
127
+ const faces = [[[1, 0, 0], [0, 0, -1], [0, 1, 0]], [[-1, 0, 0], [0, 0, 1], [0, 1, 0]], [[0, 1, 0], [1, 0, 0], [0, 0, -1]], [[0, -1, 0], [1, 0, 0], [0, 0, 1]], [[0, 0, 1], [1, 0, 0], [0, 1, 0]], [[0, 0, -1], [-1, 0, 0], [0, 1, 0]]];
128
+ const half = [w / 2, h / 2, d / 2];
129
+ for (const [nn, u, v] of faces) {
130
+ const b = p.length / 3;
131
+ for (const [su, sv] of [[-1, -1], [1, -1], [1, 1], [-1, 1]]) {
132
+ for (let k = 0; k < 3; k++)
133
+ p.push((nn[k] + u[k] * su + v[k] * sv) * half[k]);
134
+ n.push(...nn);
135
+ uv.push((su + 1) / 2, (1 - sv) / 2);
136
+ }
137
+ idx.push(b, b + 1, b + 2, b, b + 2, b + 3);
138
+ }
139
+ return geo(p, n, uv, idx);
140
+ }
141
+ /** XY plane facing +Z. */
142
+ function plane(w = 1, h = 1, sx = 1, sy = 1) {
143
+ const p = [], n = [], uv = [], idx = [];
144
+ for (let j = 0; j <= sy; j++)
145
+ for (let i = 0; i <= sx; i++) {
146
+ p.push((i / sx - 0.5) * w, (j / sy - 0.5) * h, 0);
147
+ n.push(0, 0, 1);
148
+ uv.push(i / sx, 1 - j / sy);
149
+ }
150
+ for (let j = 0; j < sy; j++)
151
+ for (let i = 0; i < sx; i++) {
152
+ const a = j * (sx + 1) + i, b = a + 1, c = a + sx + 1, d = c + 1;
153
+ idx.push(a, b, d, a, d, c);
154
+ }
155
+ return geo(p, n, uv, idx);
156
+ }
157
+ /** UV sphere. */
158
+ function sphere(r = 0.5, ws = 32, hs = 16) {
159
+ const p = [], n = [], uv = [], idx = [];
160
+ for (let j = 0; j <= hs; j++) {
161
+ const v = j / hs, th = v * Math.PI;
162
+ for (let i = 0; i <= ws; i++) {
163
+ const u = i / ws, ph = u * Math.PI * 2;
164
+ const x = -Math.cos(ph) * Math.sin(th), y = Math.cos(th), z = Math.sin(ph) * Math.sin(th);
165
+ p.push(x * r, y * r, z * r);
166
+ n.push(x, y, z);
167
+ uv.push(u, v);
168
+ }
169
+ }
170
+ for (let j = 0; j < hs; j++)
171
+ for (let i = 0; i < ws; i++) {
172
+ const a = j * (ws + 1) + i, b = a + ws + 1;
173
+ if (j)
174
+ idx.push(a, b, a + 1);
175
+ if (j < hs - 1)
176
+ idx.push(a + 1, b, b + 1);
177
+ }
178
+ return geo(p, n, uv, idx);
179
+ }
180
+ /** Torus in the XY plane. */
181
+ function torus(R = 0.5, r = 0.18, rs = 48, ts = 16) {
182
+ const p = [], n = [], uv = [], idx = [];
183
+ for (let j = 0; j <= ts; j++)
184
+ for (let i = 0; i <= rs; i++) {
185
+ const u = (i / rs) * Math.PI * 2, v = (j / ts) * Math.PI * 2;
186
+ const cx = R * Math.cos(u), cy = R * Math.sin(u);
187
+ const x = (R + r * Math.cos(v)) * Math.cos(u), y = (R + r * Math.cos(v)) * Math.sin(u), z = r * Math.sin(v);
188
+ p.push(x, y, z);
189
+ const nn = norm([x - cx, y - cy, z]);
190
+ n.push(...nn);
191
+ uv.push(i / rs, j / ts);
192
+ }
193
+ for (let j = 1; j <= ts; j++)
194
+ for (let i = 1; i <= rs; i++) {
195
+ const a = (rs + 1) * j + i - 1, b = (rs + 1) * (j - 1) + i - 1, c = (rs + 1) * (j - 1) + i, d = (rs + 1) * j + i;
196
+ idx.push(a, b, d, b, c, d);
197
+ }
198
+ return geo(p, n, uv, idx);
199
+ }
200
+ /** Flat normals for a geometry without them (per triangle; un-indexes the mesh). */
201
+ function computeNormals(g) {
202
+ const P = g.positions, I = g.indices;
203
+ const count = I ? I.length : P.length / 3;
204
+ const pos = new Float32Array(count * 3), nrm = new Float32Array(count * 3), uvs = g.uvs ? new Float32Array(count * 2) : undefined;
205
+ for (let t = 0; t < count; t += 3) {
206
+ const v = [0, 1, 2].map((k) => (I ? I[t + k] : t + k));
207
+ const a = [P[v[0] * 3], P[v[0] * 3 + 1], P[v[0] * 3 + 2]], b = [P[v[1] * 3], P[v[1] * 3 + 1], P[v[1] * 3 + 2]], c = [P[v[2] * 3], P[v[2] * 3 + 1], P[v[2] * 3 + 2]];
208
+ const nn = norm(cross(sub(b, a), sub(c, a)));
209
+ v.forEach((vi, k) => {
210
+ pos.set(P.subarray(vi * 3, vi * 3 + 3), (t + k) * 3);
211
+ nrm.set(nn, (t + k) * 3);
212
+ if (uvs && g.uvs)
213
+ uvs.set(g.uvs.subarray(vi * 2, vi * 2 + 2), (t + k) * 2);
214
+ });
215
+ }
216
+ return { positions: pos, normals: nrm, uvs, mode: g.mode };
217
+ }
218
+ function standardMaterial(o = {}) {
219
+ return { type: 'standard', color: [1, 1, 1, 1], metallic: 0, roughness: 0.6, emissive: [0, 0, 0], ...o };
220
+ }
221
+ function unlitMaterial(o = {}) {
222
+ return { ...standardMaterial(o), type: 'unlit' };
223
+ }
224
+ /**
225
+ * Custom fragment shader: `fragment` is GLSL ES 3.00 code defining
226
+ * `vec4 shade()`; available: `v_pos` (world), `v_nrm`, `v_uv`, `u_time`,
227
+ * `u_camPos`, `u_res` and your `uniforms` (float, vec2–4, sampler2D).
228
+ */
229
+ function shaderMaterial(fragment, uniforms = {}, o = {}) {
230
+ return { ...standardMaterial(o), type: 'shader', fragment, uniforms };
231
+ }
232
+ /** '#ff8800' / 'rgb(…)' / [r, g, b] → linear-ready [r, g, b, a] (sRGB values 0–1; the shader linearises). */
233
+ function color(c, a = 1) {
234
+ if (Array.isArray(c))
235
+ return [c[0], c[1], c[2], c[3] ?? a];
236
+ const h = /^#([0-9a-f]{3,8})$/i.exec(c.trim());
237
+ if (h) {
238
+ let s = h[1];
239
+ if (s.length <= 4)
240
+ s = s.split('').map((x) => x + x).join('');
241
+ const v = parseInt(s.slice(0, 6), 16);
242
+ return [((v >> 16) & 255) / 255, ((v >> 8) & 255) / 255, (v & 255) / 255, s.length === 8 ? parseInt(s.slice(6), 16) / 255 : a];
243
+ }
244
+ const m = /rgba?\(([^)]+)\)/.exec(c);
245
+ if (m) {
246
+ const p = m[1].split(/[\s,/]+/).filter(Boolean).map(Number);
247
+ return [p[0] / 255, p[1] / 255, p[2] / 255, p[3] ?? a];
248
+ }
249
+ return [1, 1, 1, a];
250
+ }
251
+ function texture(source, o = {}) {
252
+ const isVideo = typeof HTMLVideoElement !== 'undefined' && source instanceof HTMLVideoElement;
253
+ return { source, srgb: true, repeat: true, flipY: false, video: isVideo, needsUpdate: true, ...o };
254
+ }
255
+ class GlNode {
256
+ constructor(name = '', mesh = null) {
257
+ this.name = '';
258
+ this.position = [0, 0, 0];
259
+ this.rotation = [0, 0, 0, 1];
260
+ this.scale = [1, 1, 1];
261
+ /** Set to use a fixed local matrix instead of position / rotation / scale (glTF `matrix`). */
262
+ this.matrix = null;
263
+ this.children = [];
264
+ this.parent = null;
265
+ this.mesh = null;
266
+ this.visible = true;
267
+ /** Free-form data (loaders put source info here). */
268
+ this.extras = {};
269
+ this.world = mat4.identity();
270
+ this.name = name;
271
+ this.mesh = mesh;
272
+ }
273
+ add(...nodes) {
274
+ for (const n of nodes) {
275
+ n.parent?.remove(n);
276
+ n.parent = this;
277
+ this.children.push(n);
278
+ }
279
+ return this;
280
+ }
281
+ remove(n) {
282
+ const i = this.children.indexOf(n);
283
+ if (i >= 0)
284
+ this.children.splice(i, 1);
285
+ n.parent = null;
286
+ }
287
+ setEuler(x, y, z) {
288
+ this.rotation = quatFromEuler(x, y, z);
289
+ return this;
290
+ }
291
+ local() {
292
+ return this.matrix || mat4.compose(this.position, this.rotation, this.scale);
293
+ }
294
+ /** Recompute world matrices of this subtree. */
295
+ updateWorld(parent) {
296
+ const m = parent ? mat4.multiply(parent, this.local()) : this.local();
297
+ this.world.set(m);
298
+ for (const c of this.children)
299
+ c.updateWorld(this.world);
300
+ }
301
+ traverse(fn) {
302
+ fn(this);
303
+ for (const c of this.children)
304
+ c.traverse(fn);
305
+ }
306
+ find(name) {
307
+ let hit = null;
308
+ this.traverse((n) => {
309
+ if (!hit && n.name === name)
310
+ hit = n;
311
+ });
312
+ return hit;
313
+ }
314
+ }
315
+ class Camera extends GlNode {
316
+ constructor(o = {}) {
317
+ super('camera');
318
+ this.fov = (45 * Math.PI) / 180;
319
+ this.near = 0.05;
320
+ this.far = 500;
321
+ this.aspect = 1;
322
+ this.target = [0, 0, 0];
323
+ this.up = [0, 1, 0];
324
+ if (o.fov)
325
+ this.fov = (o.fov * Math.PI) / 180;
326
+ if (o.near)
327
+ this.near = o.near;
328
+ if (o.far)
329
+ this.far = o.far;
330
+ if (o.position)
331
+ this.position = [...o.position];
332
+ if (o.target)
333
+ this.target = [...o.target];
334
+ }
335
+ view() {
336
+ return mat4.lookAt(this.position, this.target, this.up);
337
+ }
338
+ projection() {
339
+ return mat4.perspective(this.fov, this.aspect, this.near, this.far);
340
+ }
341
+ }
342
+ class Scene {
343
+ constructor() {
344
+ this.root = new GlNode('scene');
345
+ this.ambient = [0.35, 0.35, 0.4];
346
+ this.lights = [{ type: 'directional', vector: [-0.4, -1, -0.6], color: [1, 1, 1], intensity: 2.2 }];
347
+ /** Clear colour (sRGB, 0–1) or null for transparent. */
348
+ this.background = null;
349
+ this.exposure = 1;
350
+ }
351
+ add(...n) {
352
+ this.root.add(...n);
353
+ return this;
354
+ }
355
+ }
356
+ /** World-space bounding box of a subtree's meshes. */
357
+ function bounds(node) {
358
+ node.updateWorld(node.parent ? node.parent.world : undefined);
359
+ const min = [Infinity, Infinity, Infinity], max = [-Infinity, -Infinity, -Infinity];
360
+ node.traverse((n) => {
361
+ const meshes = n.mesh ? (Array.isArray(n.mesh) ? n.mesh : [n.mesh]) : [];
362
+ for (const m of meshes) {
363
+ const P = m.geometry.positions;
364
+ for (let i = 0; i < P.length; i += 3) {
365
+ const q = mat4.transformPoint(n.world, [P[i], P[i + 1], P[i + 2]]);
366
+ for (let k = 0; k < 3; k++) {
367
+ if (q[k] < min[k])
368
+ min[k] = q[k];
369
+ if (q[k] > max[k])
370
+ max[k] = q[k];
371
+ }
372
+ }
373
+ }
374
+ });
375
+ if (min[0] === Infinity)
376
+ return { min: [0, 0, 0], max: [0, 0, 0], center: [0, 0, 0], radius: 0 };
377
+ const center = [(min[0] + max[0]) / 2, (min[1] + max[1]) / 2, (min[2] + max[2]) / 2];
378
+ return { min, max, center, radius: Math.hypot(max[0] - center[0], max[1] - center[1], max[2] - center[2]) };
379
+ }
380
+ /** Point the camera at a subtree so it fills the view. */
381
+ function frameNode(camera, node, padding = 1.25) {
382
+ const b = bounds(node);
383
+ const dist = ((b.radius || 1) * padding) / Math.sin(camera.fov / 2);
384
+ const dir = norm(sub(camera.position, camera.target).some((v) => v) ? sub(camera.position, camera.target) : [0.6, 0.4, 1]);
385
+ camera.target = b.center;
386
+ camera.position = [b.center[0] + dir[0] * dist, b.center[1] + dir[1] * dist, b.center[2] + dir[2] * dist];
387
+ camera.near = Math.max(0.01, dist / 100);
388
+ camera.far = dist * 10 + b.radius * 2;
389
+ }
390
+ // ------------------------------------------------------------------ video
391
+ /** Seek a video from a 0–1 progress (scroll-scrubbed video). Pauses it. */
392
+ function scrubVideo(video, progress) {
393
+ if (!video.duration || !isFinite(video.duration))
394
+ return;
395
+ video.pause();
396
+ const t = Math.min(video.duration - 0.001, Math.max(0, progress * video.duration));
397
+ if ('fastSeek' in video && Math.abs(video.currentTime - t) > 1)
398
+ video.fastSeek(t);
399
+ else
400
+ video.currentTime = t;
401
+ }
402
+ // ------------------------------------------------------------------ renderer
403
+ const VS = `#version 300 es
404
+ layout(location=0) in vec3 a_pos;layout(location=1) in vec3 a_nrm;layout(location=2) in vec2 a_uv;
405
+ uniform mat4 u_model,u_view,u_proj;uniform mat3 u_nmat;out vec3 v_pos,v_nrm;out vec2 v_uv;
406
+ void main(){vec4 w=u_model*vec4(a_pos,1.0);v_pos=w.xyz;v_nrm=normalize(u_nmat*a_nrm);v_uv=a_uv;gl_Position=u_proj*u_view*w;gl_PointSize=2.0;}`;
407
+ const FS_HEAD = `#version 300 es
408
+ precision highp float;in vec3 v_pos,v_nrm;in vec2 v_uv;out vec4 o;
409
+ uniform vec4 u_color;uniform vec3 u_emissive,u_camPos,u_ambient;uniform float u_metal,u_rough,u_exposure,u_time;uniform vec2 u_res;
410
+ uniform sampler2D u_map;uniform int u_hasMap,u_nl,u_unlit;uniform vec4 u_lvec[4];uniform vec3 u_lcol[4];
411
+ vec3 lin(vec3 c){return pow(c,vec3(2.2));}vec3 srgb(vec3 c){return pow(c,vec3(1.0/2.2));}
412
+ `;
413
+ const FS_STD = `${FS_HEAD}void main(){vec4 base=vec4(lin(u_color.rgb),u_color.a);if(u_hasMap==1){vec4 t=texture(u_map,v_uv);base*=vec4(lin(t.rgb),t.a);}
414
+ if(u_unlit==1){o=vec4(srgb(base.rgb),base.a);return;}
415
+ vec3 N=normalize(v_nrm);if(!gl_FrontFacing)N=-N;vec3 V=normalize(u_camPos-v_pos);float r=clamp(u_rough,0.04,1.0),m=clamp(u_metal,0.0,1.0);
416
+ vec3 F0=mix(vec3(0.04),base.rgb,m);vec3 c=u_ambient*base.rgb*(1.0-0.6*m)+u_ambient*F0*0.4;
417
+ for(int i=0;i<4;i++){if(i>=u_nl)break;vec3 L;float at=1.0;if(u_lvec[i].w>0.5){vec3 d=u_lvec[i].xyz-v_pos;float l=length(d);L=d/l;at=1.0/(1.0+0.09*l*l);}else L=normalize(-u_lvec[i].xyz);
418
+ vec3 H=normalize(L+V);float NL=max(dot(N,L),0.0),NH=max(dot(N,H),0.0),NV=max(dot(N,V),1e-3),a=r*r,a2=a*a,dd=NH*NH*(a2-1.0)+1.0,D=a2/(3.14159*dd*dd),k=(r+1.0)*(r+1.0)/8.0;
419
+ float G=NL/(NL*(1.0-k)+k)*NV/(NV*(1.0-k)+k);vec3 F=F0+(1.0-F0)*pow(1.0-max(dot(H,V),0.0),5.0);vec3 S=D*G*F/(4.0*NL*NV+1e-3);
420
+ c+=((1.0-F)*(1.0-m)*base.rgb/3.14159+S)*u_lcol[i]*NL*at;}
421
+ c=(c+u_emissive)*u_exposure;c=c/(c+1.0);o=vec4(srgb(c),base.a);}`;
422
+ /** Create a WebGL2 renderer on a canvas (throws a clear error when WebGL2 is unavailable). */
423
+ function createRenderer(canvas, o = {}) {
424
+ const gl = canvas.getContext('webgl2', { alpha: o.alpha ?? true, antialias: o.antialias ?? true, premultipliedAlpha: false, preserveDrawingBuffer: !!o.preserveDrawingBuffer });
425
+ if (!gl)
426
+ throw new Error('[motionary] runtime/gl: WebGL2 is not available in this browser / context');
427
+ const programs = new Map();
428
+ const owned = [];
429
+ let draws = 0;
430
+ const compile = (key, fs) => {
431
+ let pr = programs.get(key);
432
+ if (pr)
433
+ return pr;
434
+ const sh = (type, src) => {
435
+ const s = gl.createShader(type);
436
+ gl.shaderSource(s, src);
437
+ gl.compileShader(s);
438
+ if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
439
+ throw new Error('[motionary] runtime/gl shader: ' + gl.getShaderInfoLog(s));
440
+ return s;
441
+ };
442
+ const p = gl.createProgram();
443
+ gl.attachShader(p, sh(gl.VERTEX_SHADER, VS));
444
+ gl.attachShader(p, sh(gl.FRAGMENT_SHADER, fs));
445
+ gl.linkProgram(p);
446
+ if (!gl.getProgramParameter(p, gl.LINK_STATUS))
447
+ throw new Error('[motionary] runtime/gl link: ' + gl.getProgramInfoLog(p));
448
+ pr = { p, u: new Map() };
449
+ programs.set(key, pr);
450
+ owned.push({ del: () => gl.deleteProgram(p) });
451
+ return pr;
452
+ };
453
+ const loc = (pr, n) => {
454
+ if (!pr.u.has(n))
455
+ pr.u.set(n, gl.getUniformLocation(pr.p, n));
456
+ return pr.u.get(n);
457
+ };
458
+ const uploadGeo = (g) => {
459
+ if (g._gpu)
460
+ return g._gpu;
461
+ const vao = gl.createVertexArray();
462
+ gl.bindVertexArray(vao);
463
+ const attr = (i, data, size, fallback) => {
464
+ if (!data) {
465
+ gl.disableVertexAttribArray(i);
466
+ if (size === 3)
467
+ gl.vertexAttrib3f(i, fallback[0], fallback[1], fallback[2]);
468
+ else
469
+ gl.vertexAttrib2f(i, fallback[0], fallback[1]);
470
+ return;
471
+ }
472
+ const b = gl.createBuffer();
473
+ owned.push({ del: () => gl.deleteBuffer(b) });
474
+ gl.bindBuffer(gl.ARRAY_BUFFER, b);
475
+ gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
476
+ gl.enableVertexAttribArray(i);
477
+ gl.vertexAttribPointer(i, size, gl.FLOAT, false, 0, 0);
478
+ };
479
+ attr(0, g.positions, 3, [0, 0, 0]);
480
+ attr(1, g.normals, 3, [0, 0, 1]);
481
+ attr(2, g.uvs, 2, [0, 0]);
482
+ let count = g.positions.length / 3, type = 0;
483
+ if (g.indices) {
484
+ const b = gl.createBuffer();
485
+ owned.push({ del: () => gl.deleteBuffer(b) });
486
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, b);
487
+ gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, g.indices, gl.STATIC_DRAW);
488
+ count = g.indices.length;
489
+ type = g.indices instanceof Uint32Array ? gl.UNSIGNED_INT : gl.UNSIGNED_SHORT;
490
+ }
491
+ gl.bindVertexArray(null);
492
+ owned.push({ del: () => gl.deleteVertexArray(vao) });
493
+ return (g._gpu = { vao, count, type, indexed: !!g.indices });
494
+ };
495
+ const uploadTex = (t, unit) => {
496
+ let tex = t._gpu;
497
+ gl.activeTexture(gl.TEXTURE0 + unit);
498
+ if (!tex) {
499
+ tex = gl.createTexture();
500
+ t._gpu = tex;
501
+ owned.push({ del: () => gl.deleteTexture(tex) });
502
+ t.needsUpdate = true;
503
+ if (t.video) {
504
+ const v = t.source;
505
+ const mark = () => {
506
+ t.needsUpdate = true;
507
+ v.requestVideoFrameCallback?.(mark);
508
+ };
509
+ if (v.requestVideoFrameCallback)
510
+ v.requestVideoFrameCallback(mark);
511
+ }
512
+ }
513
+ gl.bindTexture(gl.TEXTURE_2D, tex);
514
+ const v = t.video ? t.source : null;
515
+ const videoReady = !v || v.readyState >= 2;
516
+ if ((t.needsUpdate || (v && !v.requestVideoFrameCallback && !v.paused)) && videoReady) {
517
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, !!t.flipY);
518
+ const s = t.source;
519
+ if (s && s.data && !(s instanceof ImageData))
520
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, s.width, s.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(s.data.buffer, s.data.byteOffset, s.data.byteLength));
521
+ else
522
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, s);
523
+ const pot = (n) => (n & (n - 1)) === 0;
524
+ const w = s.videoWidth || s.naturalWidth || s.width, h = s.videoHeight || s.naturalHeight || s.height;
525
+ const mip = !v && pot(w) && pot(h);
526
+ if (mip)
527
+ gl.generateMipmap(gl.TEXTURE_2D);
528
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, mip ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR);
529
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
530
+ const wrap = t.repeat && pot(w) && pot(h) ? gl.REPEAT : gl.CLAMP_TO_EDGE;
531
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrap);
532
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrap);
533
+ t.needsUpdate = false;
534
+ }
535
+ };
536
+ const r = {
537
+ gl,
538
+ canvas,
539
+ get drawCalls() {
540
+ return draws;
541
+ },
542
+ resize(w, h) {
543
+ const c = canvas;
544
+ const dpr = Math.min(o.maxDpr ?? 2, (typeof devicePixelRatio === 'number' && devicePixelRatio) || 1);
545
+ const W = Math.max(1, Math.round((w ?? c.clientWidth ?? c.width) * dpr)), H = Math.max(1, Math.round((h ?? c.clientHeight ?? c.height) * dpr));
546
+ if (c.width === W && c.height === H)
547
+ return false;
548
+ c.width = W;
549
+ c.height = H;
550
+ return true;
551
+ },
552
+ render(scene, camera, time = 0) {
553
+ draws = 0;
554
+ const W = gl.drawingBufferWidth, H = gl.drawingBufferHeight;
555
+ gl.viewport(0, 0, W, H);
556
+ camera.aspect = W / H || 1;
557
+ const bg = scene.background;
558
+ gl.clearColor(bg ? bg[0] : 0, bg ? bg[1] : 0, bg ? bg[2] : 0, bg ? bg[3] : 0);
559
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
560
+ gl.enable(gl.DEPTH_TEST);
561
+ scene.root.updateWorld();
562
+ const view = camera.view(), proj = camera.projection();
563
+ const lv = new Float32Array(16), lc = new Float32Array(12);
564
+ scene.lights.slice(0, 4).forEach((l, i) => {
565
+ lv.set([...l.vector, l.type === 'point' ? 1 : 0], i * 4);
566
+ lc.set(l.color.map((c) => c * l.intensity), i * 3);
567
+ });
568
+ const opaque = [], blend = [];
569
+ scene.root.traverse((n) => {
570
+ if (!n.visible || !n.mesh)
571
+ return;
572
+ for (const m of Array.isArray(n.mesh) ? n.mesh : [n.mesh])
573
+ (m.material.transparent || m.material.color[3] < 1 ? blend : opaque).push([n, m]);
574
+ });
575
+ for (const [n, m] of [...opaque, ...blend]) {
576
+ const mat = m.material;
577
+ const key = mat.type === 'shader' ? 'shader:' + mat.fragment : 'std';
578
+ const pr = compile(key, mat.type === 'shader' ? `${FS_HEAD}${Object.entries(mat.uniforms || {}).map(([k, v]) => `uniform ${typeof v === 'number' ? 'float' : v.source ? 'sampler2D' : `vec${v.length}`} ${k};`).join('')}\n${mat.fragment}\nvoid main(){o=shade();}` : FS_STD);
579
+ gl.useProgram(pr.p);
580
+ const U = (nm) => loc(pr, nm);
581
+ gl.uniformMatrix4fv(U('u_model'), false, n.world);
582
+ gl.uniformMatrix4fv(U('u_view'), false, view);
583
+ gl.uniformMatrix4fv(U('u_proj'), false, proj);
584
+ gl.uniformMatrix3fv(U('u_nmat'), false, mat4.normal(n.world));
585
+ gl.uniform4fv(U('u_color'), mat.color);
586
+ gl.uniform3fv(U('u_emissive'), mat.emissive);
587
+ gl.uniform3fv(U('u_camPos'), camera.position);
588
+ gl.uniform3fv(U('u_ambient'), scene.ambient);
589
+ gl.uniform1f(U('u_metal'), mat.metallic);
590
+ gl.uniform1f(U('u_rough'), mat.roughness);
591
+ gl.uniform1f(U('u_exposure'), scene.exposure);
592
+ gl.uniform1f(U('u_time'), time / 1000);
593
+ gl.uniform2f(U('u_res'), W, H);
594
+ gl.uniform1i(U('u_unlit'), mat.type === 'unlit' ? 1 : 0);
595
+ gl.uniform1i(U('u_nl'), Math.min(4, scene.lights.length));
596
+ gl.uniform4fv(U('u_lvec'), lv);
597
+ gl.uniform3fv(U('u_lcol'), lc);
598
+ let unit = 0;
599
+ if (mat.map) {
600
+ uploadTex(mat.map, unit);
601
+ gl.uniform1i(U('u_map'), unit++);
602
+ }
603
+ gl.uniform1i(U('u_hasMap'), mat.map ? 1 : 0);
604
+ for (const [k, v] of Object.entries(mat.uniforms || {})) {
605
+ if (typeof v === 'number')
606
+ gl.uniform1f(U(k), v);
607
+ else if (v.source) {
608
+ uploadTex(v, unit);
609
+ gl.uniform1i(U(k), unit++);
610
+ }
611
+ else {
612
+ const a = v;
613
+ (a.length === 2 ? gl.uniform2fv : a.length === 3 ? gl.uniform3fv : gl.uniform4fv).call(gl, U(k), a);
614
+ }
615
+ }
616
+ if (mat.doubleSided)
617
+ gl.disable(gl.CULL_FACE);
618
+ else
619
+ gl.enable(gl.CULL_FACE);
620
+ if (mat.transparent || mat.color[3] < 1) {
621
+ gl.enable(gl.BLEND);
622
+ gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
623
+ gl.depthMask(false);
624
+ }
625
+ else {
626
+ gl.disable(gl.BLEND);
627
+ gl.depthMask(true);
628
+ }
629
+ const g = uploadGeo(m.geometry);
630
+ gl.bindVertexArray(g.vao);
631
+ const mode = m.geometry.mode === 'lines' || mat.wireframe ? gl.LINES : m.geometry.mode === 'points' ? gl.POINTS : gl.TRIANGLES;
632
+ if (g.indexed)
633
+ gl.drawElements(mode, g.count, g.type, 0);
634
+ else
635
+ gl.drawArrays(mode, 0, g.count);
636
+ draws++;
637
+ }
638
+ gl.bindVertexArray(null);
639
+ gl.depthMask(true);
640
+ },
641
+ dispose() {
642
+ owned.splice(0).forEach((x) => x.del());
643
+ programs.clear();
644
+ },
645
+ };
646
+ return r;
647
+ }
648
+ /** Drag to orbit, wheel / pinch to zoom, arrow keys (when the element has focus). Call `update(dt)` per frame. */
649
+ function orbitControls(camera, el, o = {}) {
650
+ const off = sub(camera.position, camera.target);
651
+ let dist = Math.hypot(...off), theta = Math.atan2(off[0], off[2]), phi = Math.acos(Math.min(1, Math.max(-1, off[1] / (dist || 1))));
652
+ let vt = 0, vp = 0, vz = 0, drag = false, lx = 0, ly = 0;
653
+ const pts = new Map();
654
+ let pinch = 0;
655
+ const damp = o.damping ?? 0.12;
656
+ const reduce = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
657
+ const ctl = { autoRotate: reduce ? 0 : o.autoRotate ?? 0, update, dispose };
658
+ const on = (t, ty, f, opt) => {
659
+ t.addEventListener(ty, f, opt);
660
+ return () => t.removeEventListener(ty, f, opt);
661
+ };
662
+ const offs = [
663
+ on(el, 'pointerdown', (e) => {
664
+ pts.set(e.pointerId, [e.clientX, e.clientY]);
665
+ drag = true;
666
+ lx = e.clientX;
667
+ ly = e.clientY;
668
+ el.setPointerCapture?.(e.pointerId);
669
+ }),
670
+ on(el, 'pointermove', (e) => {
671
+ if (!pts.has(e.pointerId))
672
+ return;
673
+ pts.set(e.pointerId, [e.clientX, e.clientY]);
674
+ if (pts.size === 2 && o.zoom !== false) {
675
+ const [a, b] = Array.from(pts.values());
676
+ const d = Math.hypot(a[0] - b[0], a[1] - b[1]);
677
+ if (pinch)
678
+ vz += (pinch - d) * 0.004;
679
+ pinch = d;
680
+ return;
681
+ }
682
+ if (!drag)
683
+ return;
684
+ vt -= (e.clientX - lx) * 0.005;
685
+ vp -= (e.clientY - ly) * 0.005;
686
+ lx = e.clientX;
687
+ ly = e.clientY;
688
+ }),
689
+ on(el, 'pointerup', (e) => {
690
+ pts.delete(e.pointerId);
691
+ pinch = 0;
692
+ drag = pts.size > 0;
693
+ }),
694
+ on(el, 'pointercancel', (e) => {
695
+ pts.delete(e.pointerId);
696
+ drag = false;
697
+ }),
698
+ on(el, 'wheel', (e) => {
699
+ if (o.zoom === false)
700
+ return;
701
+ e.preventDefault();
702
+ vz += Math.sign(e.deltaY) * 0.08;
703
+ }, { passive: false }),
704
+ on(el, 'keydown', (e) => {
705
+ const k = { ArrowLeft: [0.1, 0, 0], ArrowRight: [-0.1, 0, 0], ArrowUp: [0, 0.1, 0], ArrowDown: [0, -0.1, 0], '+': [0, 0, -0.1], '-': [0, 0, 0.1] }[e.key];
706
+ if (!k)
707
+ return;
708
+ e.preventDefault();
709
+ vt += k[0];
710
+ vp += k[1];
711
+ vz += k[2];
712
+ }),
713
+ ];
714
+ function update(dt) {
715
+ const moving = Math.abs(vt) + Math.abs(vp) + Math.abs(vz) > 1e-5 || ctl.autoRotate;
716
+ theta += vt + (ctl.autoRotate && !drag ? (ctl.autoRotate * dt) / 1000 : 0);
717
+ phi = Math.min(Math.PI - 0.05, Math.max(0.05, phi + vp));
718
+ dist = Math.min(o.maxDistance ?? Infinity, Math.max(o.minDistance ?? 0.01, dist * (1 + vz)));
719
+ const k = Math.pow(1 - damp, dt / 16.7);
720
+ vt *= k;
721
+ vp *= k;
722
+ vz *= k;
723
+ const t = camera.target;
724
+ camera.position = [t[0] + dist * Math.sin(phi) * Math.sin(theta), t[1] + dist * Math.cos(phi), t[2] + dist * Math.sin(phi) * Math.cos(theta)];
725
+ return !!moving;
726
+ }
727
+ function dispose() {
728
+ offs.forEach((f) => f());
729
+ }
730
+ return ctl;
731
+ }
732
+ /** The module object for `use(gl)`. */
733
+ const gl = {
734
+ id: 'gl',
735
+ version: registry.RUNTIME_VERSION,
736
+ requires: ['core'],
737
+ api: { mat4, quatFromEuler, quatMultiply, quatSlerp, box, plane, sphere, torus, computeNormals, standardMaterial, unlitMaterial, shaderMaterial, color, texture, GlNode, Camera, Scene, bounds, frameNode, scrubVideo, createRenderer, orbitControls },
738
+ };
739
+
740
+ exports.Camera = Camera;
741
+ exports.GlNode = GlNode;
742
+ exports.Scene = Scene;
743
+ exports.bounds = bounds;
744
+ exports.box = box;
745
+ exports.color = color;
746
+ exports.computeNormals = computeNormals;
747
+ exports.createRenderer = createRenderer;
748
+ exports.frameNode = frameNode;
749
+ exports.gl = gl;
750
+ exports.mat4 = mat4;
751
+ exports.orbitControls = orbitControls;
752
+ exports.plane = plane;
753
+ exports.quatFromEuler = quatFromEuler;
754
+ exports.quatMultiply = quatMultiply;
755
+ exports.quatSlerp = quatSlerp;
756
+ exports.scrubVideo = scrubVideo;
757
+ exports.shaderMaterial = shaderMaterial;
758
+ exports.sphere = sphere;
759
+ exports.standardMaterial = standardMaterial;
760
+ exports.texture = texture;
761
+ exports.torus = torus;
762
+ exports.unlitMaterial = unlitMaterial;
763
+ //# sourceMappingURL=gl.cjs.map