@arkitektio/bsx 0.0.0 → 2.0.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 (395) hide show
  1. package/README.md +51 -16
  2. package/dist/catalogs/html.d.ts +117 -0
  3. package/dist/catalogs/html.d.ts.map +1 -0
  4. package/dist/catalogs/html.js +14 -0
  5. package/dist/catalogs/html.js.map +1 -0
  6. package/dist/catalogs/index.d.ts +6059 -0
  7. package/dist/catalogs/index.d.ts.map +1 -0
  8. package/dist/catalogs/index.js +11 -0
  9. package/dist/catalogs/index.js.map +1 -0
  10. package/dist/catalogs/logo.d.ts +214 -0
  11. package/dist/catalogs/logo.d.ts.map +1 -0
  12. package/dist/catalogs/logo.js +27 -0
  13. package/dist/catalogs/logo.js.map +1 -0
  14. package/dist/catalogs/parts/data.d.ts +408 -0
  15. package/dist/catalogs/parts/data.d.ts.map +1 -0
  16. package/dist/catalogs/parts/data.js +206 -0
  17. package/dist/catalogs/parts/data.js.map +1 -0
  18. package/dist/catalogs/parts/feedback.d.ts +440 -0
  19. package/dist/catalogs/parts/feedback.d.ts.map +1 -0
  20. package/dist/catalogs/parts/feedback.js +70 -0
  21. package/dist/catalogs/parts/feedback.js.map +1 -0
  22. package/dist/catalogs/parts/forms.d.ts +874 -0
  23. package/dist/catalogs/parts/forms.d.ts.map +1 -0
  24. package/dist/catalogs/parts/forms.js +302 -0
  25. package/dist/catalogs/parts/forms.js.map +1 -0
  26. package/dist/catalogs/parts/html.d.ts +93 -0
  27. package/dist/catalogs/parts/html.d.ts.map +1 -0
  28. package/dist/catalogs/parts/html.js +45 -0
  29. package/dist/catalogs/parts/html.js.map +1 -0
  30. package/dist/catalogs/parts/icons.d.ts +266 -0
  31. package/dist/catalogs/parts/icons.d.ts.map +1 -0
  32. package/dist/catalogs/parts/icons.js +149 -0
  33. package/dist/catalogs/parts/icons.js.map +1 -0
  34. package/dist/catalogs/parts/index.d.ts +5765 -0
  35. package/dist/catalogs/parts/index.d.ts.map +1 -0
  36. package/dist/catalogs/parts/index.js +38 -0
  37. package/dist/catalogs/parts/index.js.map +1 -0
  38. package/dist/catalogs/parts/inspector.d.ts +10 -0
  39. package/dist/catalogs/parts/inspector.d.ts.map +1 -0
  40. package/dist/catalogs/parts/inspector.js +12 -0
  41. package/dist/catalogs/parts/inspector.js.map +1 -0
  42. package/dist/catalogs/parts/layout.d.ts +647 -0
  43. package/dist/catalogs/parts/layout.d.ts.map +1 -0
  44. package/dist/catalogs/parts/layout.js +188 -0
  45. package/dist/catalogs/parts/layout.js.map +1 -0
  46. package/dist/catalogs/parts/logo.d.ts +321 -0
  47. package/dist/catalogs/parts/logo.d.ts.map +1 -0
  48. package/dist/catalogs/parts/logo.js +227 -0
  49. package/dist/catalogs/parts/logo.js.map +1 -0
  50. package/dist/catalogs/parts/navigation.d.ts +697 -0
  51. package/dist/catalogs/parts/navigation.d.ts.map +1 -0
  52. package/dist/catalogs/parts/navigation.js +194 -0
  53. package/dist/catalogs/parts/navigation.js.map +1 -0
  54. package/dist/catalogs/parts/overlays.d.ts +2012 -0
  55. package/dist/catalogs/parts/overlays.d.ts.map +1 -0
  56. package/dist/catalogs/parts/overlays.js +191 -0
  57. package/dist/catalogs/parts/overlays.js.map +1 -0
  58. package/dist/catalogs/parts/run.d.ts +41 -0
  59. package/dist/catalogs/parts/run.d.ts.map +1 -0
  60. package/dist/catalogs/parts/run.js +46 -0
  61. package/dist/catalogs/parts/run.js.map +1 -0
  62. package/dist/catalogs/parts/scene.d.ts +326 -0
  63. package/dist/catalogs/parts/scene.d.ts.map +1 -0
  64. package/dist/catalogs/parts/scene.js +237 -0
  65. package/dist/catalogs/parts/scene.js.map +1 -0
  66. package/dist/catalogs/parts/structure.d.ts +51 -0
  67. package/dist/catalogs/parts/structure.d.ts.map +1 -0
  68. package/dist/catalogs/parts/structure.js +66 -0
  69. package/dist/catalogs/parts/structure.js.map +1 -0
  70. package/dist/catalogs/parts/toast.d.ts +37 -0
  71. package/dist/catalogs/parts/toast.d.ts.map +1 -0
  72. package/dist/catalogs/parts/toast.js +23 -0
  73. package/dist/catalogs/parts/toast.js.map +1 -0
  74. package/dist/catalogs/parts/typography.d.ts +174 -0
  75. package/dist/catalogs/parts/typography.d.ts.map +1 -0
  76. package/dist/catalogs/parts/typography.js +56 -0
  77. package/dist/catalogs/parts/typography.js.map +1 -0
  78. package/dist/{renderer/bloks/shared/schemas.d.ts → catalogs/props.d.ts} +3 -3
  79. package/dist/catalogs/props.d.ts.map +1 -0
  80. package/dist/{renderer/bloks/shared/schemas.js → catalogs/props.js} +3 -4
  81. package/dist/catalogs/props.js.map +1 -0
  82. package/dist/catalogs/scene.d.ts +250 -0
  83. package/dist/catalogs/scene.d.ts.map +1 -0
  84. package/dist/catalogs/scene.js +28 -0
  85. package/dist/catalogs/scene.js.map +1 -0
  86. package/dist/catalogs/shadcn.d.ts +2397 -0
  87. package/dist/catalogs/shadcn.d.ts.map +1 -0
  88. package/dist/catalogs/shadcn.js +82 -0
  89. package/dist/catalogs/shadcn.js.map +1 -0
  90. package/dist/catalogs/structure.d.ts +61 -0
  91. package/dist/catalogs/structure.d.ts.map +1 -0
  92. package/dist/catalogs/structure.js +14 -0
  93. package/dist/catalogs/structure.js.map +1 -0
  94. package/dist/catalogs/ui.d.ts +3027 -0
  95. package/dist/catalogs/ui.d.ts.map +1 -0
  96. package/dist/catalogs/ui.js +91 -0
  97. package/dist/catalogs/ui.js.map +1 -0
  98. package/dist/catalogs.d.ts +5 -0
  99. package/dist/catalogs.d.ts.map +1 -0
  100. package/dist/catalogs.js +6 -0
  101. package/dist/catalogs.js.map +1 -0
  102. package/dist/platform.d.ts +11 -2
  103. package/dist/platform.d.ts.map +1 -1
  104. package/dist/platform.js.map +1 -1
  105. package/dist/renderer/bloks/control.d.ts.map +1 -1
  106. package/dist/renderer/bloks/control.js +5 -1
  107. package/dist/renderer/bloks/control.js.map +1 -1
  108. package/dist/renderer/bloks/data.d.ts +378 -27
  109. package/dist/renderer/bloks/data.d.ts.map +1 -1
  110. package/dist/renderer/bloks/data.js +55 -251
  111. package/dist/renderer/bloks/data.js.map +1 -1
  112. package/dist/renderer/bloks/feedback.d.ts +425 -8
  113. package/dist/renderer/bloks/feedback.d.ts.map +1 -1
  114. package/dist/renderer/bloks/feedback.js +23 -79
  115. package/dist/renderer/bloks/feedback.js.map +1 -1
  116. package/dist/renderer/bloks/forms.d.ts +828 -42
  117. package/dist/renderer/bloks/forms.d.ts.map +1 -1
  118. package/dist/renderer/bloks/forms.js +78 -368
  119. package/dist/renderer/bloks/forms.js.map +1 -1
  120. package/dist/renderer/bloks/html.d.ts +84 -9
  121. package/dist/renderer/bloks/html.d.ts.map +1 -1
  122. package/dist/renderer/bloks/html.js +13 -48
  123. package/dist/renderer/bloks/html.js.map +1 -1
  124. package/dist/renderer/bloks/icons.d.ts +133 -130
  125. package/dist/renderer/bloks/icons.d.ts.map +1 -1
  126. package/dist/renderer/bloks/icons.js +10 -23
  127. package/dist/renderer/bloks/icons.js.map +1 -1
  128. package/dist/renderer/bloks/index.d.ts +5251 -16
  129. package/dist/renderer/bloks/index.d.ts.map +1 -1
  130. package/dist/renderer/bloks/index.js +29 -27
  131. package/dist/renderer/bloks/index.js.map +1 -1
  132. package/dist/renderer/bloks/inspector/Inspector.d.ts +5 -1
  133. package/dist/renderer/bloks/inspector/Inspector.d.ts.map +1 -1
  134. package/dist/renderer/bloks/inspector/Inspector.js +5 -11
  135. package/dist/renderer/bloks/inspector/Inspector.js.map +1 -1
  136. package/dist/renderer/bloks/layout.d.ts +432 -15
  137. package/dist/renderer/bloks/layout.d.ts.map +1 -1
  138. package/dist/renderer/bloks/layout.js +43 -224
  139. package/dist/renderer/bloks/layout.js.map +1 -1
  140. package/dist/renderer/bloks/logo/index.d.ts +172 -24
  141. package/dist/renderer/bloks/logo/index.d.ts.map +1 -1
  142. package/dist/renderer/bloks/logo/index.js +42 -236
  143. package/dist/renderer/bloks/logo/index.js.map +1 -1
  144. package/dist/renderer/bloks/navigation.d.ts +651 -28
  145. package/dist/renderer/bloks/navigation.d.ts.map +1 -1
  146. package/dist/renderer/bloks/navigation.js +65 -249
  147. package/dist/renderer/bloks/navigation.js.map +1 -1
  148. package/dist/renderer/bloks/overlays.d.ts +1998 -55
  149. package/dist/renderer/bloks/overlays.d.ts.map +1 -1
  150. package/dist/renderer/bloks/overlays.js +87 -265
  151. package/dist/renderer/bloks/overlays.js.map +1 -1
  152. package/dist/renderer/bloks/run/components.d.ts +13 -4
  153. package/dist/renderer/bloks/run/components.d.ts.map +1 -1
  154. package/dist/renderer/bloks/run/components.js +12 -34
  155. package/dist/renderer/bloks/run/components.js.map +1 -1
  156. package/dist/renderer/bloks/run/index.d.ts +1 -1
  157. package/dist/renderer/bloks/run/index.d.ts.map +1 -1
  158. package/dist/renderer/bloks/run/index.js +1 -1
  159. package/dist/renderer/bloks/run/index.js.map +1 -1
  160. package/dist/renderer/bloks/scene/Model.d.ts +6 -2
  161. package/dist/renderer/bloks/scene/Model.d.ts.map +1 -1
  162. package/dist/renderer/bloks/scene/Model.js +4 -48
  163. package/dist/renderer/bloks/scene/Model.js.map +1 -1
  164. package/dist/renderer/bloks/scene/Scene.d.ts +4 -1
  165. package/dist/renderer/bloks/scene/Scene.d.ts.map +1 -1
  166. package/dist/renderer/bloks/scene/Scene.js +3 -24
  167. package/dist/renderer/bloks/scene/Scene.js.map +1 -1
  168. package/dist/renderer/bloks/scene/Transform.d.ts +5 -1
  169. package/dist/renderer/bloks/scene/Transform.d.ts.map +1 -1
  170. package/dist/renderer/bloks/scene/Transform.js +3 -25
  171. package/dist/renderer/bloks/scene/Transform.js.map +1 -1
  172. package/dist/renderer/bloks/scene/bindings.d.ts +40 -8
  173. package/dist/renderer/bloks/scene/bindings.d.ts.map +1 -1
  174. package/dist/renderer/bloks/scene/bindings.js +18 -102
  175. package/dist/renderer/bloks/scene/bindings.js.map +1 -1
  176. package/dist/renderer/bloks/scene/index.d.ts +194 -1
  177. package/dist/renderer/bloks/scene/index.d.ts.map +1 -1
  178. package/dist/renderer/bloks/scene/index.js +21 -21
  179. package/dist/renderer/bloks/scene/index.js.map +1 -1
  180. package/dist/renderer/bloks/scene/interaction.d.ts +6 -2
  181. package/dist/renderer/bloks/scene/interaction.d.ts.map +1 -1
  182. package/dist/renderer/bloks/scene/interaction.js +6 -42
  183. package/dist/renderer/bloks/scene/interaction.js.map +1 -1
  184. package/dist/renderer/bloks/shared/index.d.ts +0 -1
  185. package/dist/renderer/bloks/shared/index.d.ts.map +1 -1
  186. package/dist/renderer/bloks/shared/index.js +0 -1
  187. package/dist/renderer/bloks/shared/index.js.map +1 -1
  188. package/dist/renderer/bloks/shared/props.d.ts +1 -1
  189. package/dist/renderer/bloks/shared/props.d.ts.map +1 -1
  190. package/dist/renderer/bloks/shared/props.js +1 -1
  191. package/dist/renderer/bloks/shared/props.js.map +1 -1
  192. package/dist/renderer/bloks/testing.d.ts +1 -1
  193. package/dist/renderer/bloks/testing.d.ts.map +1 -1
  194. package/dist/renderer/bloks/testing.js +5 -5
  195. package/dist/renderer/bloks/testing.js.map +1 -1
  196. package/dist/renderer/bloks/toast.d.ts +15 -5
  197. package/dist/renderer/bloks/toast.d.ts.map +1 -1
  198. package/dist/renderer/bloks/toast.js +11 -19
  199. package/dist/renderer/bloks/toast.js.map +1 -1
  200. package/dist/renderer/bloks/typography.d.ts +166 -24
  201. package/dist/renderer/bloks/typography.d.ts.map +1 -1
  202. package/dist/renderer/bloks/typography.js +22 -98
  203. package/dist/renderer/bloks/typography.js.map +1 -1
  204. package/dist/renderer/catalog.d.ts +3 -19
  205. package/dist/renderer/catalog.d.ts.map +1 -1
  206. package/dist/renderer/catalog.js +12 -29
  207. package/dist/renderer/catalog.js.map +1 -1
  208. package/dist/renderer/declare.d.ts +40 -0
  209. package/dist/renderer/declare.d.ts.map +1 -0
  210. package/dist/renderer/declare.js +40 -0
  211. package/dist/renderer/declare.js.map +1 -0
  212. package/dist/renderer/modules.d.ts +1 -18
  213. package/dist/renderer/modules.d.ts.map +1 -1
  214. package/dist/renderer/modules.js +1 -31
  215. package/dist/renderer/modules.js.map +1 -1
  216. package/dist/renderer/runtime/catalog.d.ts +63 -0
  217. package/dist/renderer/runtime/catalog.d.ts.map +1 -0
  218. package/dist/renderer/runtime/catalog.js +33 -0
  219. package/dist/renderer/runtime/catalog.js.map +1 -0
  220. package/dist/renderer/runtime/components.d.ts +27 -1
  221. package/dist/renderer/runtime/components.d.ts.map +1 -1
  222. package/dist/renderer/runtime/components.js +3 -0
  223. package/dist/renderer/runtime/components.js.map +1 -1
  224. package/dist/renderer/runtime/describe.d.ts +49 -0
  225. package/dist/renderer/runtime/describe.d.ts.map +1 -0
  226. package/dist/renderer/runtime/describe.js +127 -0
  227. package/dist/renderer/runtime/describe.js.map +1 -0
  228. package/dist/renderer/runtime/functions.d.ts +0 -13
  229. package/dist/renderer/runtime/functions.d.ts.map +1 -1
  230. package/dist/renderer/runtime/functions.js +0 -14
  231. package/dist/renderer/runtime/functions.js.map +1 -1
  232. package/dist/renderer/runtime/index.d.ts +2 -0
  233. package/dist/renderer/runtime/index.d.ts.map +1 -1
  234. package/dist/renderer/runtime/index.js +2 -0
  235. package/dist/renderer/runtime/index.js.map +1 -1
  236. package/dist/runtime.d.ts +1 -0
  237. package/dist/runtime.d.ts.map +1 -1
  238. package/dist/runtime.js +1 -0
  239. package/dist/runtime.js.map +1 -1
  240. package/dist/scene.d.ts +2 -0
  241. package/dist/scene.d.ts.map +1 -1
  242. package/dist/scene.js +27 -1
  243. package/dist/scene.js.map +1 -1
  244. package/dist/shadcn.d.ts +5265 -0
  245. package/dist/shadcn.d.ts.map +1 -0
  246. package/dist/shadcn.js +194 -0
  247. package/dist/shadcn.js.map +1 -0
  248. package/dist/spec/bsx_v2.json +74 -113
  249. package/dist/spec/catalogs/logo@1.json +39 -25
  250. package/dist/spec/catalogs/logo@1.json.js +39 -25
  251. package/dist/spec/catalogs/scene@1.json +23 -23
  252. package/dist/spec/catalogs/scene@1.json.js +23 -23
  253. package/dist/spec/{modules/orkestrator.json → catalogs/shadcn@1.json} +1391 -286
  254. package/dist/spec/{modules/orkestrator.json.js → catalogs/shadcn@1.json.js} +1391 -286
  255. package/dist/spec/catalogs/structure@1.json +1 -1
  256. package/dist/spec/catalogs/structure@1.json.js +1 -1
  257. package/dist/spec/catalogs/ui@1.json +1690 -37
  258. package/dist/spec/catalogs/ui@1.json.js +1690 -37
  259. package/dist/spec/catalogs.d.ts +16 -12
  260. package/dist/spec/catalogs.d.ts.map +1 -1
  261. package/dist/spec/catalogs.js +23 -15
  262. package/dist/spec/catalogs.js.map +1 -1
  263. package/dist/spec/vocabulary.json +1 -1
  264. package/dist/spec/vocabulary.json.js +1 -1
  265. package/dist/vendor/core/ui/button-group.d.ts +1 -1
  266. package/dist/vendor/core/ui/field.d.ts +1 -1
  267. package/dist/web.d.ts +0 -3
  268. package/dist/web.d.ts.map +1 -1
  269. package/dist/web.js +2 -4
  270. package/dist/web.js.map +1 -1
  271. package/package.json +12 -3
  272. package/src/bsx/infer.test.ts +2 -2
  273. package/src/bsx/references.test.ts +2 -2
  274. package/src/catalogs/catalogs.test.ts +28 -0
  275. package/src/catalogs/html.ts +14 -0
  276. package/src/catalogs/index.ts +12 -0
  277. package/src/catalogs/logo.ts +27 -0
  278. package/src/catalogs/parts/data.ts +228 -0
  279. package/src/catalogs/parts/feedback.ts +79 -0
  280. package/src/catalogs/parts/forms.ts +335 -0
  281. package/src/catalogs/parts/html.ts +51 -0
  282. package/src/catalogs/parts/icons.ts +154 -0
  283. package/src/catalogs/parts/index.ts +38 -0
  284. package/src/catalogs/parts/inspector.ts +14 -0
  285. package/src/catalogs/parts/layout.ts +217 -0
  286. package/src/catalogs/parts/logo.ts +254 -0
  287. package/src/catalogs/parts/navigation.ts +198 -0
  288. package/src/catalogs/parts/overlays.ts +221 -0
  289. package/src/catalogs/parts/run.ts +57 -0
  290. package/src/catalogs/parts/scene.ts +292 -0
  291. package/src/catalogs/parts/structure.ts +83 -0
  292. package/src/catalogs/parts/toast.ts +27 -0
  293. package/src/catalogs/parts/typography.ts +63 -0
  294. package/src/{renderer/bloks/shared/schemas.ts → catalogs/props.ts} +2 -3
  295. package/src/catalogs/scene.ts +28 -0
  296. package/src/catalogs/shadcn.ts +82 -0
  297. package/src/catalogs/structure.ts +14 -0
  298. package/src/catalogs/ui.ts +91 -0
  299. package/src/catalogs.ts +6 -0
  300. package/src/platform.ts +8 -2
  301. package/src/preview/CachedBlokPreview.test.tsx +6 -1
  302. package/src/renderer/addBlokComponents.test.tsx +9 -7
  303. package/src/renderer/bloks/control.tsx +8 -1
  304. package/src/renderer/bloks/data.tsx +339 -621
  305. package/src/renderer/bloks/feedback.tsx +32 -112
  306. package/src/renderer/bloks/forms.tsx +103 -504
  307. package/src/renderer/bloks/html.tsx +16 -78
  308. package/src/renderer/bloks/icons.tsx +14 -31
  309. package/src/renderer/bloks/index.ts +28 -38
  310. package/src/renderer/bloks/inspector/Inspector.tsx +9 -11
  311. package/src/renderer/bloks/layout.tsx +216 -453
  312. package/src/renderer/bloks/logo/index.tsx +144 -387
  313. package/src/renderer/bloks/navigation.tsx +87 -343
  314. package/src/renderer/bloks/overlays.tsx +106 -524
  315. package/src/renderer/bloks/primitives.test.tsx +3 -1
  316. package/src/renderer/bloks/run/components.tsx +20 -58
  317. package/src/renderer/bloks/run/index.ts +1 -1
  318. package/src/renderer/bloks/scene/Model.tsx +7 -64
  319. package/src/renderer/bloks/scene/Scene.tsx +12 -38
  320. package/src/renderer/bloks/scene/Transform.tsx +6 -34
  321. package/src/renderer/bloks/scene/animate.test.tsx +2 -2
  322. package/src/renderer/bloks/scene/bindings.tsx +31 -113
  323. package/src/renderer/bloks/scene/index.ts +21 -21
  324. package/src/renderer/bloks/scene/interaction.tsx +7 -59
  325. package/src/renderer/bloks/shared/index.ts +0 -1
  326. package/src/renderer/bloks/shared/props.ts +1 -1
  327. package/src/renderer/bloks/testing.tsx +5 -5
  328. package/src/renderer/bloks/toast.tsx +16 -31
  329. package/src/renderer/bloks/typography.tsx +28 -141
  330. package/src/renderer/bloks/unavailable.test.tsx +3 -1
  331. package/src/renderer/catalog.tsx +13 -36
  332. package/src/renderer/declare.ts +82 -0
  333. package/src/renderer/modules.ts +1 -43
  334. package/src/renderer/runtime/catalog.test.ts +102 -0
  335. package/src/renderer/runtime/catalog.ts +108 -0
  336. package/src/renderer/runtime/components.tsx +27 -0
  337. package/src/renderer/runtime/describe.ts +180 -0
  338. package/src/renderer/runtime/functions.ts +0 -25
  339. package/src/renderer/runtime/index.ts +2 -0
  340. package/src/runtime.ts +1 -0
  341. package/src/scene.ts +30 -1
  342. package/src/shadcn.ts +202 -0
  343. package/src/spec/bsx_v2.json +74 -113
  344. package/src/spec/catalogs/logo@1.json +39 -25
  345. package/src/spec/catalogs/scene@1.json +23 -23
  346. package/src/spec/{modules/orkestrator.json → catalogs/shadcn@1.json} +1391 -286
  347. package/src/spec/catalogs/structure@1.json +1 -1
  348. package/src/spec/catalogs/ui@1.json +1690 -37
  349. package/src/spec/catalogs.ts +25 -16
  350. package/src/spec/spec.test.ts +1 -1
  351. package/src/spec/vocabulary.json +1 -1
  352. package/src/web.ts +2 -4
  353. package/dist/renderer/base_v1.json +0 -1541
  354. package/dist/renderer/bloks/shared/schemas.d.ts.map +0 -1
  355. package/dist/renderer/bloks/shared/schemas.js.map +0 -1
  356. package/dist/renderer/functions/argumentSchemas.d.ts +0 -19
  357. package/dist/renderer/functions/argumentSchemas.d.ts.map +0 -1
  358. package/dist/renderer/functions/argumentSchemas.js +0 -35
  359. package/dist/renderer/functions/argumentSchemas.js.map +0 -1
  360. package/dist/renderer/functions/base.d.ts +0 -3
  361. package/dist/renderer/functions/base.d.ts.map +0 -1
  362. package/dist/renderer/functions/base.js +0 -159
  363. package/dist/renderer/functions/base.js.map +0 -1
  364. package/dist/renderer/functions/coerce.d.ts +0 -2
  365. package/dist/renderer/functions/coerce.d.ts.map +0 -1
  366. package/dist/renderer/functions/coerce.js +0 -73
  367. package/dist/renderer/functions/coerce.js.map +0 -1
  368. package/dist/renderer/functions/effects.d.ts +0 -4
  369. package/dist/renderer/functions/effects.d.ts.map +0 -1
  370. package/dist/renderer/functions/effects.js +0 -102
  371. package/dist/renderer/functions/effects.js.map +0 -1
  372. package/dist/renderer/functions/format.d.ts +0 -2
  373. package/dist/renderer/functions/format.d.ts.map +0 -1
  374. package/dist/renderer/functions/format.js +0 -134
  375. package/dist/renderer/functions/format.js.map +0 -1
  376. package/dist/renderer/functions/lists.d.ts +0 -2
  377. package/dist/renderer/functions/lists.d.ts.map +0 -1
  378. package/dist/renderer/functions/lists.js +0 -139
  379. package/dist/renderer/functions/lists.js.map +0 -1
  380. package/dist/renderer/functions/logic.d.ts +0 -3
  381. package/dist/renderer/functions/logic.d.ts.map +0 -1
  382. package/dist/renderer/functions/logic.js +0 -37
  383. package/dist/renderer/functions/logic.js.map +0 -1
  384. package/dist/renderer/functions/math.d.ts +0 -4
  385. package/dist/renderer/functions/math.d.ts.map +0 -1
  386. package/dist/renderer/functions/math.js +0 -61
  387. package/dist/renderer/functions/math.js.map +0 -1
  388. package/dist/renderer/functions/objects.d.ts +0 -2
  389. package/dist/renderer/functions/objects.d.ts.map +0 -1
  390. package/dist/renderer/functions/objects.js +0 -42
  391. package/dist/renderer/functions/objects.js.map +0 -1
  392. package/dist/renderer/functions/strings.d.ts +0 -4
  393. package/dist/renderer/functions/strings.d.ts.map +0 -1
  394. package/dist/renderer/functions/strings.js +0 -115
  395. package/dist/renderer/functions/strings.js.map +0 -1
@@ -16,7 +16,9 @@ import {
16
16
  } from "../runtime";
17
17
  import {invokeBlokFunction} from "../functions/v2/handler";
18
18
  import {controlBlokComponents} from "./control";
19
- import {shadcnComposableComponents} from "./index";
19
+ import {shadcnExtras, shadcnHtml, shadcnUi} from "../../shadcn";
20
+
21
+ const shadcnComposableComponents = [...shadcnUi.components, ...shadcnHtml.components, ...shadcnExtras.components];
20
22
 
21
23
  afterEach(cleanup);
22
24
 
@@ -1,15 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import * as THREE from 'three';
3
- import * as z from 'zod';
4
3
  import {Line} from '@react-three/drei';
5
- import {createBlokComponent, useBlok, useValue, type BlokRenderArgs} from '../../runtime';
6
- import {describedString} from '../shared/schemas';
4
+ import {anchorSchema, routeSchema, type runContracts} from '../../../catalogs/parts/run';
5
+ import {useBlok, useValue, type BlokRender, type BlokRenderArgs} from '../../runtime';
7
6
  import {ModelProvider, useOwnedModel, useSceneNotice, useSceneOverlay, type ModelContextValue} from '../scene/context';
8
7
  import {FALLBACK_SCENE_RGB, useThemeColour} from '../scene/colour';
9
8
  import {useBlokSceneEmbedded} from '../scene/host';
10
9
  import {BlokTrayProvider, useBlokRunHost, useBlokSpaceHost, type BlokRunAgent} from './host';
11
10
  import {progressFraction, resolveAnchors, routePoints, splitRoute, throughKeys} from './math';
12
11
 
12
+ type Contracts = typeof runContracts;
13
+
13
14
  /**
14
15
  * The components only an action's own blok holds: they read the run it is
15
16
  * shown for (scene@1). `Overlay` is the root of one drawn into the space
@@ -25,29 +26,15 @@ const Children = ({component, buildChild}: Pick<BlokRenderArgs, 'component' | 'b
25
26
  </>
26
27
  );
27
28
 
28
- const overlaySchema = z
29
- .object({})
30
- .describe(
31
- 'Root of an action\'s overlay: drawn into the space that hosts a run of the action, in its world coordinates, over the agents placed there. It owns no canvas. Place Anchor and Route inside.',
29
+ const OverlayRender: BlokRender<Contracts['Overlay']> = ({component, buildChild}) =>
30
+ useBlokSceneEmbedded() ? (
31
+ <Children component={component} buildChild={buildChild} />
32
+ ) : (
33
+ <div className="flex min-h-24 items-center justify-center rounded-xl border border-dashed border-border/70 bg-muted/30 px-6 text-center text-sm text-muted-foreground">
34
+ An overlay is drawn into the space that hosts a run of its action. Open the run in a space to see it.
35
+ </div>
32
36
  );
33
37
 
34
- export const OverlayBlok = createBlokComponent(
35
- {
36
- name: 'Overlay',
37
- acceptsChildren: true,
38
- placement: {childrenContext: 'scene', notDownstreamOf: ['Scene', 'Overlay']},
39
- schema: overlaySchema,
40
- },
41
- ({component, buildChild}) =>
42
- useBlokSceneEmbedded() ? (
43
- <Children component={component} buildChild={buildChild} />
44
- ) : (
45
- <div className="flex min-h-24 items-center justify-center rounded-xl border border-dashed border-border/70 bg-muted/30 px-6 text-center text-sm text-muted-foreground">
46
- An overlay is drawn into the space that hosts a run of its action. Open the run in a space to see it.
47
- </div>
48
- ),
49
- );
50
-
51
38
  const EMPTY_REPORT = {
52
39
  ref: '',
53
40
  size: 0,
@@ -112,17 +99,7 @@ const TrayAt = ({agent, dependency, children}: {agent: BlokRunAgent; dependency:
112
99
  );
113
100
  };
114
101
 
115
- const anchorSchema = z
116
- .object({
117
- dep: z.string().describe('The dependency key of the action whose agent this anchors at.'),
118
- })
119
- .describe(
120
- 'Anchors its children at the agent the run got for a dependency, where it stands in the hosting space; Glow, Popout and OnClick inside it bind to that device\'s model as its scene blok loaded it. A key bound to several agents anchors at each; an agent the space does not place shows in a side tray.',
121
- );
122
-
123
- export const AnchorBlok = createBlokComponent(
124
- {name: 'Anchor', acceptsChildren: true, placement: {context: 'scene', downstreamOf: ['Overlay']}, schema: anchorSchema},
125
- ({component, buildChild}) => {
102
+ const AnchorRender: BlokRender<Contracts['Anchor']> = ({component, buildChild}) => {
126
103
  const blok = useBlok(component, anchorSchema);
127
104
  const dependency = useValue(blok.dep);
128
105
  const run = useBlokRunHost();
@@ -148,23 +125,7 @@ export const AnchorBlok = createBlokComponent(
148
125
  ))}
149
126
  </>
150
127
  );
151
- },
152
- );
153
-
154
- const routeSchema = z
155
- .object({
156
- through: z
157
- .unknown()
158
- .describe('The dependency keys the line runs through, in order: `through={["robot", "frame", "robot"]}`.'),
159
- progress: z
160
- .number()
161
- .nullish()
162
- .describe('How far along the run is, from 0 to 100 (`task.progress`): the way behind is drawn solid, a marker stands at the head.'),
163
- color: describedString('The colour of the line: a colour role of the theme, usually a chart role (`chart-2`). Defaults to `chart-1`.'),
164
- })
165
- .describe(
166
- 'Draws a line through the agents the run got for these dependencies, where they stand in the hosting space. A dependency whose agent is not placed there is skipped.',
167
- );
128
+ };
168
129
 
169
130
  const ROUTE_COLOR = 'chart-1';
170
131
 
@@ -172,9 +133,7 @@ const ROUTE_COLOR = 'chart-1';
172
133
  const triples = (points: readonly THREE.Vector3[]): Array<[number, number, number]> =>
173
134
  points.map(point => [point.x, point.y, point.z]);
174
135
 
175
- export const RouteBlok = createBlokComponent(
176
- {name: 'Route', placement: {context: 'scene', downstreamOf: ['Overlay']}, schema: routeSchema},
177
- ({component}) => {
136
+ const RouteRender: BlokRender<Contracts['Route']> = ({component}) => {
178
137
  const blok = useBlok(component, routeSchema);
179
138
  const through = useValue(blok.through);
180
139
  const progress = useValue(blok.progress) ?? undefined;
@@ -206,7 +165,10 @@ export const RouteBlok = createBlokComponent(
206
165
  ) : null}
207
166
  </group>
208
167
  );
209
- },
210
- );
168
+ };
211
169
 
212
- export const runBlokComponents = [OverlayBlok, AnchorBlok, RouteBlok];
170
+ export const runRenders = {
171
+ Overlay: OverlayRender,
172
+ Anchor: AnchorRender,
173
+ Route: RouteRender,
174
+ };
@@ -1,3 +1,3 @@
1
- export {runBlokComponents} from './components';
1
+ export {runRenders} from './components';
2
2
  export * from './host';
3
3
  export {progressFraction, resolveAnchors, routePoints, splitRoute, throughKeys} from './math';
@@ -1,20 +1,19 @@
1
1
  import * as React from 'react';
2
2
  import * as THREE from 'three';
3
- import * as z from 'zod';
4
3
  import {useFrame, type ThreeEvent} from '@react-three/fiber';
5
4
  import {resolveJoints} from '../../../vendor/core/model/joints';
6
5
  import {initialMotion, stepMotion, stillMotion, type MotionState} from '../../../vendor/core/model/motion';
7
6
  import {parseVector, toBaseUnit} from '../../../vendor/core/model/units';
8
7
  import {findWriterConflicts} from '../../../vendor/core/model/writers';
8
+ import {modelSchema, robotSchema, type sceneContracts} from '../../../catalogs/parts/scene';
9
9
  import {
10
- createBlokComponent,
11
10
  useBlok,
12
11
  useEventAction,
13
12
  useValue,
14
13
  type BlokComponentNode,
14
+ type BlokRender,
15
15
  type BlokRenderArgs,
16
16
  } from '../../runtime';
17
- import {actionProp, describedString} from '../shared/schemas';
18
17
  import {
19
18
  ModelProvider,
20
19
  useSceneModelKey,
@@ -31,47 +30,7 @@ import {instantiate, loadModel, type ModelInstance} from './loadModel';
31
30
  import {useBlokReady, type BlokReadiness} from '../../../preview/snapshotMode';
32
31
  import {isExplicitId} from '../../../spec/vocabulary';
33
32
 
34
- const modelShape = {
35
- src: z
36
- .string()
37
- .describe('The 3D model to show: an asset its app registered, as in `{self.assets.scope}`.'),
38
- origin: describedString('Where the model sits in the scene, as "x y z" in meters.'),
39
- rotation: describedString('How the model is turned, as "x y z" Euler angles in radians.'),
40
- scale: z.number().optional().describe('Uniform scale. Defaults to 1; a model is authored in meters.'),
41
- };
42
-
43
- const modelSchema = z
44
- .object(modelShape)
45
- .describe(
46
- 'Places one GLB model in the scene. Its children bind the model\'s named nodes to state. A model that is missing or refused renders a placeholder that says why.',
47
- );
48
-
49
- const jointValues = z
50
- .record(z.string(), z.unknown())
51
- .optional();
52
-
53
- const robotSchema = z
54
- .object({
55
- ...modelShape,
56
- joints: jointValues.describe(
57
- 'Where each joint is: a map of joint name to radians (revolute, continuous) or meters (prismatic). A joint left out keeps its last value.',
58
- ),
59
- animateTo: jointValues.describe('Where each joint is going. Joints named here move at speed, or over duration.'),
60
- speed: z
61
- .unknown()
62
- .optional()
63
- .describe('How fast joints move to animateTo, in rad/s or m/s: one number for all joints or a map by joint name.'),
64
- duration: z
65
- .unknown()
66
- .optional()
67
- .describe('How long a move to animateTo takes, in seconds: one number or a map by joint name. Ignored where speed is given.'),
68
- onJointChange: actionProp(
69
- 'Called when the viewer sets a joint by hand. Arguments may read event.name and event.value.',
70
- ),
71
- })
72
- .describe(
73
- 'A Model with a joint table (extras.arkitekt.joints): applies a joint state map to it, including mimic joints, and clamps to limits.',
74
- );
33
+ type Contracts = typeof sceneContracts;
75
34
 
76
35
  const PLACEHOLDER_SIZE = 0.12;
77
36
 
@@ -546,26 +505,10 @@ const ModelBody = ({component, buildChild, robot}: Pick<BlokRenderArgs, 'compone
546
505
  );
547
506
  };
548
507
 
549
- const MODEL_PROP_KINDS = {src: 'ASSET'} as const;
550
-
551
- export const ModelBlok = createBlokComponent(
552
- {
553
- name: 'Model',
554
- acceptsChildren: true,
555
- placement: {context: 'scene', downstreamOf: ['Scene']},
556
- propKinds: MODEL_PROP_KINDS,
557
- schema: modelSchema,
558
- },
559
- ({component, buildChild}) => <ModelBody component={component} buildChild={buildChild} robot={false} />,
508
+ export const ModelRender: BlokRender<Contracts['Model']> = ({component, buildChild}) => (
509
+ <ModelBody component={component} buildChild={buildChild} robot={false} />
560
510
  );
561
511
 
562
- export const RobotBlok = createBlokComponent(
563
- {
564
- name: 'Robot',
565
- acceptsChildren: true,
566
- placement: {context: 'scene', downstreamOf: ['Scene']},
567
- propKinds: MODEL_PROP_KINDS,
568
- schema: robotSchema,
569
- },
570
- ({component, buildChild}) => <ModelBody component={component} buildChild={buildChild} robot />,
512
+ export const RobotRender: BlokRender<Contracts['Robot']> = ({component, buildChild}) => (
513
+ <ModelBody component={component} buildChild={buildChild} robot />
571
514
  );
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import * as THREE from 'three';
3
- import * as z from 'zod';
4
3
  import {Canvas, useFrame, useThree} from '@react-three/fiber';
5
4
  import {Grid, OrbitControls} from '@react-three/drei';
6
5
  import {Anchor, GripVertical, Grid3x3, Pin, RotateCw, Scan, Settings2, X} from 'lucide-react';
@@ -19,13 +18,13 @@ import {cn} from '../../../vendor/core/util/utils';
19
18
  import {Switch} from '../../../vendor/core/ui/switch';
20
19
  import {
21
20
  BlokNodeErrorSurface,
22
- createBlokComponent,
23
21
  useBlok,
24
22
  useValue,
25
23
  type BlokNodeErrorProps,
24
+ type BlokRender,
26
25
  type BlokRenderArgs,
27
26
  } from '../../runtime';
28
- import {describedString} from '../shared/schemas';
27
+ import type {sceneContracts} from '../../../catalogs/parts/scene';
29
28
  import {
30
29
  createSceneStore,
31
30
  SceneStoreProvider,
@@ -797,26 +796,9 @@ export const SceneSurface = ({
797
796
  );
798
797
  };
799
798
 
800
- const sceneSchema = z
801
- .object({
802
- camera: z
803
- .enum(['iso', 'front', 'side', 'top'])
804
- .optional()
805
- .describe('Where the camera starts looking from; it frames the models whatever their size. Defaults to iso.'),
806
- grid: z.boolean().optional().describe('Whether the ground grid starts shown; the viewer can switch it. Defaults to true.'),
807
- height: describedString(
808
- 'CSS height of the view, e.g. "24rem". Omit to fit the element the scene is in (24rem where that has no height of its own).',
809
- ),
810
- persist: z
811
- .boolean()
812
- .optional()
813
- .describe('Keep where the viewer leaves the camera (and the grid) on this device, by the scene\'s explicit id.'),
814
- })
815
- .describe(
816
- 'Root of a 3D view: one renderer, camera and light rig. Y is up and one unit is one meter. Place Model and Robot inside.',
817
- );
799
+ type Contracts = typeof sceneContracts;
818
800
 
819
- type SceneRenderArgs = BlokRenderArgs<typeof sceneSchema>;
801
+ type SceneRenderArgs = BlokRenderArgs<Contracts['Scene']['schema']>;
820
802
 
821
803
  const SceneChildren = ({component, buildChild}: Pick<SceneRenderArgs, 'component' | 'buildChild'>) => (
822
804
  <>
@@ -864,19 +846,11 @@ const StandaloneScene = ({component, schema, buildChild}: SceneRenderArgs) => {
864
846
  );
865
847
  };
866
848
 
867
- export const SceneBlok = createBlokComponent(
868
- {
869
- name: 'Scene',
870
- acceptsChildren: true,
871
- placement: {childrenContext: 'scene', notDownstreamOf: ['Scene']},
872
- schema: sceneSchema,
873
- },
874
- args =>
875
- // Inside a scene that is already open, this one only adds what it holds:
876
- // the camera, grid and size are the surrounding scene's.
877
- useBlokSceneEmbedded() ? (
878
- <SceneChildren component={args.component} buildChild={args.buildChild} />
879
- ) : (
880
- <StandaloneScene {...args} />
881
- ),
882
- );
849
+ export const SceneRender: BlokRender<Contracts['Scene']> = args =>
850
+ // Inside a scene that is already open, this one only adds what it holds:
851
+ // the camera, grid and size are the surrounding scene's.
852
+ useBlokSceneEmbedded() ? (
853
+ <SceneChildren component={args.component} buildChild={args.buildChild} />
854
+ ) : (
855
+ <StandaloneScene {...args} />
856
+ );
@@ -1,37 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import * as THREE from 'three';
3
- import * as z from 'zod';
4
3
  import {TransformControls} from '@react-three/drei';
5
4
  import {fromMatrix4, toMatrix4} from '../../../vendor/core/model/affine';
6
- import {createBlokComponent, markBindSchema, useBinding, useBlok, useValue, type BlokRenderArgs} from '../../runtime';
7
- import {bindSchema} from '../shared/schemas';
5
+ import {transformSchema, type sceneContracts} from '../../../catalogs/parts/scene';
6
+ import {useBinding, useBlok, useValue, type BlokRender, type BlokRenderArgs} from '../../runtime';
8
7
  import {usePersistedComponentState} from '../../persist';
9
8
  import {useBlokSceneInert, useBlokSceneStill} from './host';
10
9
 
11
- const transformSchema = z
12
- .object({
13
- matrix: z
14
- .unknown()
15
- .optional()
16
- .describe(
17
- 'Where the children stand: a 4x4 affine matrix as four rows, in meters with Y up (as a space placement keeps it). The identity when absent or malformed.',
18
- ),
19
- bind: markBindSchema(bindSchema.describe(
20
- 'The local holding the matrix (`bind={pose}`): read in place of `matrix`, and written by the gizmo.',
21
- )),
22
- persist: z
23
- .boolean()
24
- .optional()
25
- .describe('Keep where the gizmo left the children on this device, by the explicit id (unbound: the pose is the component\'s own).'),
26
- gizmo: z.boolean().optional().describe('Whether a gizmo moves the children. Defaults to true when bound or persisted; never shown while viewing the past.'),
27
- mode: z.enum(['translate', 'rotate', 'scale']).optional().describe('What the gizmo does: "translate" (the default), "rotate" or "scale".'),
28
- size: z.number().optional().describe('The size of the gizmo on screen. Defaults to 0.7.'),
29
- })
30
- .describe(
31
- 'Places its children by an affine matrix. Bound (`bind={pose}`) or persisted (`id="arm-pose" persist`), a gizmo moves them and keeps the matrix.',
32
- );
10
+ type Contracts = typeof sceneContracts;
33
11
 
34
- type TransformRenderArgs = BlokRenderArgs<typeof transformSchema>;
12
+ type TransformRenderArgs = BlokRenderArgs<Contracts['Transform']['schema']>;
35
13
 
36
14
  const sameMatrix = (a: THREE.Matrix4, b: THREE.Matrix4): boolean => a.equals(b);
37
15
 
@@ -105,12 +83,6 @@ const TransformBody = ({component, buildChild}: Pick<TransformRenderArgs, 'compo
105
83
  );
106
84
  };
107
85
 
108
- export const TransformBlok = createBlokComponent(
109
- {
110
- name: 'Transform',
111
- acceptsChildren: true,
112
- placement: {context: 'scene', downstreamOf: ['Overlay', 'Scene']},
113
- schema: transformSchema,
114
- },
115
- ({component, buildChild}) => <TransformBody component={component} buildChild={buildChild} />,
86
+ export const TransformRender: BlokRender<Contracts['Transform']> = ({component, buildChild}) => (
87
+ <TransformBody component={component} buildChild={buildChild} />
116
88
  );
@@ -4,7 +4,7 @@ import * as THREE from 'three';
4
4
  import {act, createRoot, extend} from '@react-three/fiber';
5
5
  import {afterEach, describe, expect, it} from 'vitest';
6
6
  import {BlokRuntimeProvider, createBlokRuntimeStore} from '../../runtime';
7
- import {AnimateBlok} from './bindings';
7
+ import {AnimateRender} from './bindings';
8
8
  import {createSceneStore, ModelProvider, SceneStoreProvider, type ModelContextValue} from './context';
9
9
 
10
10
  extend(THREE as unknown as Parameters<typeof extend>[0]);
@@ -39,7 +39,7 @@ describe('Animate', () => {
39
39
  await root.configure({gl: renderer, frameloop: 'never', size: {width: 100, height: 100, top: 0, left: 0}});
40
40
  unmount = () => root.unmount();
41
41
  const runtime = createBlokRuntimeStore();
42
- const Animate = AnimateBlok.render as React.ComponentType<{component: unknown}>;
42
+ const Animate = AnimateRender as React.ComponentType<{component: unknown}>;
43
43
  const at = (progress: number) => ({
44
44
  id: 'animate',
45
45
  component: 'Animate',
@@ -1,27 +1,27 @@
1
1
  import * as React from 'react';
2
2
  import * as THREE from 'three';
3
- import * as z from 'zod';
4
3
  import {useFrame} from '@react-three/fiber';
5
4
  import {clipMotion, initialMotion, stepMotion, stillMotion, type MotionState} from '../../../vendor/core/model/motion';
6
5
  import {parseAxis, toBaseUnit, wavelengthToColor, type Dimension} from '../../../vendor/core/model/units';
7
6
  import {parseNodeAddress} from '../../../vendor/core/model/writers';
8
- import {createBlokComponent, useBlok, useValue, type BlokComponentPlacement} from '../../runtime';
9
- import {describedString} from '../shared/schemas';
7
+ import {
8
+ animateSchema,
9
+ attachSchema,
10
+ beamSchema,
11
+ glowSchema,
12
+ moveSchema,
13
+ rotateSchema,
14
+ tintSchema,
15
+ visibleSchema,
16
+ type sceneContracts,
17
+ } from '../../../catalogs/parts/scene';
18
+ import {useBlok, useValue, type BlokRender} from '../../runtime';
10
19
  import {useModel, useSceneModelKey, useSceneNotice, useSceneState, type ModelContextValue} from './context';
11
20
  import {useBlokSceneStill} from './host';
12
21
  import {useThemeColour} from './colour';
13
22
  import {ownMaterials} from './loadModel';
14
23
 
15
- /** Every binding sits somewhere under the model whose nodes it names. */
16
- const IN_MODEL: BlokComponentPlacement = {context: 'scene', downstreamOf: ['Model', 'Robot']};
17
-
18
- /**
19
- * Bindings an action's overlay may also use under an `At`, on the model the
20
- * anchored device's scene blok loaded.
21
- */
22
- const IN_MODEL_OR_AT: BlokComponentPlacement = {context: 'scene', downstreamOf: ['Model', 'Robot', 'Anchor']};
23
-
24
- const nodeProp = z.string().describe('The name of the node in the enclosing model that this binds.');
24
+ type Contracts = typeof sceneContracts;
25
25
 
26
26
  /** The node a binding names, and a notice beside the scene while the model has no such node. */
27
27
  const useNode = (name: string | undefined): THREE.Object3D | undefined => {
@@ -51,34 +51,6 @@ const useAddressedNode = (address: string | undefined): THREE.Object3D | undefin
51
51
  return node;
52
52
  };
53
53
 
54
- const motionShape = (unit: string, rate: string) => ({
55
- node: nodeProp,
56
- axis: z
57
- .string()
58
- .describe('The axis in the node\'s own frame: "x", "y", "z" or a vector as "x y z".'),
59
- value: z
60
- .unknown()
61
- .optional()
62
- .describe(`Where the part is, in ${unit} from the pose the model was authored in. A quantity ({magnitude, unit}) is converted.`),
63
- animateTo: z
64
- .unknown()
65
- .optional()
66
- .describe('Where the part is going. With it, the view moves there at speed (or over duration) and value corrects it.'),
67
- speed: z.number().optional().describe(`How fast it moves to animateTo, in ${rate}.`),
68
- duration: z.number().optional().describe('How long a move to animateTo takes, in seconds. Ignored when speed is given.'),
69
- scale: z.number().optional().describe('Multiplies the value before it is applied. Defaults to 1.'),
70
- offset: z.number().optional().describe(`Added after scale, in ${unit}. Defaults to 0.`),
71
- gain: z.number().optional().describe('Exaggerates the motion on screen only, for travel too small to see. Defaults to 1.'),
72
- smooth: z.boolean().optional().describe('Whether to ease toward each new value over 300 ms. Defaults to true.'),
73
- });
74
-
75
- const moveSchema = z
76
- .object(motionShape('meters', 'm/s'))
77
- .describe('Translates a node along an axis by value x scale + offset meters from its authored pose.');
78
- const rotateSchema = z
79
- .object(motionShape('radians', 'rad/s'))
80
- .describe('Rotates a node about an axis by value x scale + offset radians from its authored pose.');
81
-
82
54
  const direction = new THREE.Vector3();
83
55
  const turn = new THREE.Quaternion();
84
56
 
@@ -161,8 +133,9 @@ const useMotionBinding = (
161
133
  );
162
134
  };
163
135
 
164
- const motionComponent = (name: 'Move' | 'Rotate', schema: typeof moveSchema, dimension: Dimension) =>
165
- createBlokComponent({name, placement: IN_MODEL, schema}, ({component}) => {
136
+ const motionRender =
137
+ (schema: typeof moveSchema, dimension: Dimension): BlokRender<Contracts['Move']> =>
138
+ ({component}) => {
166
139
  const blok = useBlok(component, schema);
167
140
  useMotionBinding(
168
141
  useModel(),
@@ -181,19 +154,12 @@ const motionComponent = (name: 'Move' | 'Rotate', schema: typeof moveSchema, dim
181
154
  dimension,
182
155
  );
183
156
  return null;
184
- });
185
-
186
- export const MoveBlok = motionComponent('Move', moveSchema, 'length');
187
- export const RotateBlok = motionComponent('Rotate', rotateSchema, 'angle');
157
+ };
188
158
 
189
- const visibleSchema = z
190
- .object({
191
- node: nodeProp,
192
- on: z.boolean().nullish().describe('Whether the node is visible. Hiding a node hides everything beneath it.'),
193
- })
194
- .describe('Shows or hides a node and its whole subtree.');
159
+ export const MoveRender = motionRender(moveSchema, 'length');
160
+ export const RotateRender = motionRender(rotateSchema, 'angle');
195
161
 
196
- export const VisibleBlok = createBlokComponent({name: 'Visible', placement: IN_MODEL, schema: visibleSchema}, ({component}) => {
162
+ export const VisibleRender: BlokRender<Contracts['Visible']> = ({component}) => {
197
163
  const blok = useBlok(component, visibleSchema);
198
164
  const node = useNode(useValue(blok.node));
199
165
  const on = useValue(blok.on);
@@ -206,21 +172,12 @@ export const VisibleBlok = createBlokComponent({name: 'Visible', placement: IN_M
206
172
  };
207
173
  }, [node, on]);
208
174
  return null;
209
- });
175
+ };
210
176
 
211
177
  type Emissive = THREE.Material & {emissive?: THREE.Color; emissiveIntensity?: number};
212
178
  type Colored = THREE.Material & {color?: THREE.Color};
213
179
 
214
- const glowSchema = z
215
- .object({
216
- node: describedString('The name of the node in the enclosing model that glows; the whole model when unset.'),
217
- on: z.boolean().optional().describe('Whether the node glows.'),
218
- intensity: z.number().optional().describe('How strongly. Defaults to 1 for materials, and to the authored intensity for a light.'),
219
- color: describedString('The colour of the glow: a colour role of the theme (`brand`, `success`, `chart-1`). Defaults to the material\'s own emissive colour, or white.'),
220
- })
221
- .describe('Switches the emissive output of a node\'s materials, or the intensity of a punctual light attached to it.');
222
-
223
- export const GlowBlok = createBlokComponent({name: 'Glow', placement: IN_MODEL_OR_AT, schema: glowSchema}, ({component}) => {
180
+ export const GlowRender: BlokRender<Contracts['Glow']> = ({component}) => {
224
181
  const blok = useBlok(component, glowSchema);
225
182
  const node = useNodeOrRoot(useValue(blok.node));
226
183
  const on = useValue(blok.on) ?? false;
@@ -260,16 +217,9 @@ export const GlowBlok = createBlokComponent({name: 'Glow', placement: IN_MODEL_O
260
217
  };
261
218
  }, [color, intensity, node, on]);
262
219
  return null;
263
- });
264
-
265
- const tintSchema = z
266
- .object({
267
- node: nodeProp,
268
- color: describedString('The base colour to give the node: a colour role of the theme (`brand`, `muted`, `chart-3`). Without it the authored colour shows.'),
269
- })
270
- .describe('Overrides the base color of a node. Its materials are copied first, so nodes sharing them are unaffected.');
220
+ };
271
221
 
272
- export const TintBlok = createBlokComponent({name: 'Tint', placement: IN_MODEL, schema: tintSchema}, ({component}) => {
222
+ export const TintRender: BlokRender<Contracts['Tint']> = ({component}) => {
273
223
  const blok = useBlok(component, tintSchema);
274
224
  const node = useNode(useValue(blok.node));
275
225
  const color = useThemeColour(useValue(blok.color));
@@ -286,19 +236,9 @@ export const TintBlok = createBlokComponent({name: 'Tint', placement: IN_MODEL,
286
236
  };
287
237
  }, [color, node]);
288
238
  return null;
289
- });
290
-
291
- const attachSchema = z
292
- .object({
293
- node: nodeProp,
294
- to: z
295
- .string()
296
- .describe('What to attach it to: a node of this model, or "<model id>:<node>" for a node of another model in the scene.'),
297
- on: z.boolean().nullish().describe('Whether it is attached. When false the node returns to where it was authored.'),
298
- })
299
- .describe('While `on` holds, carries a node with another node, keeping its place in the world at the moment of attaching. For picked-up objects.');
239
+ };
300
240
 
301
- export const AttachBlok = createBlokComponent({name: 'Attach', placement: IN_MODEL, schema: attachSchema}, ({component}) => {
241
+ export const AttachRender: BlokRender<Contracts['Attach']> = ({component}) => {
302
242
  const blok = useBlok(component, attachSchema);
303
243
  const model = useModel();
304
244
  const node = useNode(useValue(blok.node));
@@ -313,26 +253,14 @@ export const AttachBlok = createBlokComponent({name: 'Attach', placement: IN_MOD
313
253
  };
314
254
  }, [model, node, target, on]);
315
255
  return null;
316
- });
317
-
318
- const beamSchema = z
319
- .object({
320
- start: z.string().describe('The node the beam leaves from.'),
321
- end: describedString('The node the beam ends at, in this model or as "<model id>:<node>". Use this or length.'),
322
- length: z.number().optional().describe('How far the beam reaches along the start node\'s own Z axis, in meters. Use this or end.'),
323
- on: z.boolean().optional().describe('Whether the beam is drawn. Defaults to true.'),
324
- wavelength: z.number().optional().describe('The wavelength in nanometers, shown as its color.'),
325
- color: describedString('The colour of the beam: a colour role of the theme (`info`, `chart-2`, `destructive`). Takes precedence over wavelength.'),
326
- width: z.number().optional().describe('The diameter of the beam in meters. Defaults to 2 mm.'),
327
- })
328
- .describe('Draws a beam from one anchor to another, or for a length along an anchor\'s Z axis, following both as they move.');
256
+ };
329
257
 
330
258
  const from = new THREE.Vector3();
331
259
  const to = new THREE.Vector3();
332
260
  const up = new THREE.Vector3(0, 1, 0);
333
261
  const orientation = new THREE.Quaternion();
334
262
 
335
- export const BeamBlok = createBlokComponent({name: 'Beam', placement: IN_MODEL, schema: beamSchema}, ({component}) => {
263
+ export const BeamRender: BlokRender<Contracts['Beam']> = ({component}) => {
336
264
  const blok = useBlok(component, beamSchema);
337
265
  const start = useNode(useValue(blok.start));
338
266
  const end = useAddressedNode(useValue(blok.end));
@@ -370,19 +298,9 @@ export const BeamBlok = createBlokComponent({name: 'Beam', placement: IN_MODEL,
370
298
  <meshBasicMaterial color={color} transparent opacity={0.75} toneMapped={false} depthWrite={false} />
371
299
  </mesh>
372
300
  );
373
- });
374
-
375
- const animateSchema = z
376
- .object({
377
- clip: z.string().describe('The name of an animation clip in the enclosing model.'),
378
- progress: z.number().optional().describe('Where in the clip to show, from 0 (start) to 1 (end). Use this or time.'),
379
- time: z.number().optional().describe('Where in the clip to show, in seconds. Use this or progress.'),
380
- animateTo: z.number().optional().describe('The position to play to, in the unit of whichever of progress or time is used.'),
381
- duration: z.number().optional().describe('How long playing to animateTo takes, in seconds.'),
382
- })
383
- .describe('Scrubs a named animation clip of the model to a position, for mechanisms a single move or turn cannot describe. Never loops on its own.');
301
+ };
384
302
 
385
- export const AnimateBlok = createBlokComponent({name: 'Animate', placement: IN_MODEL, schema: animateSchema}, ({component}) => {
303
+ export const AnimateRender: BlokRender<Contracts['Animate']> = ({component}) => {
386
304
  const blok = useBlok(component, animateSchema);
387
305
  const model = useModel();
388
306
  const clipName = useValue(blok.clip);
@@ -429,4 +347,4 @@ export const AnimateBlok = createBlokComponent({name: 'Animate', placement: IN_M
429
347
  playing.mixer.update(0);
430
348
  });
431
349
  return null;
432
- });
350
+ };