@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
@@ -0,0 +1,154 @@
1
+ import * as z from 'zod';
2
+ import type {BlokComponentContracts} from '../../renderer/runtime/catalog';
3
+ import {classNameSchema, numberSchema} from '../props';
4
+
5
+ /**
6
+ * The icons a blok payload may name, and `Icon` (ui@1).
7
+ *
8
+ * The names are spelled out here so the contract carries no icon set: the
9
+ * renderer's `BLOK_ICONS` map is typed against this tuple, so a name without a
10
+ * glyph (or a glyph without a name) does not compile. Adding an icon means
11
+ * adding the name here and the import and entry in `renderer/bloks/icons.tsx`.
12
+ */
13
+ export const ICON_NAMES = [
14
+ 'activity',
15
+ 'alert-circle',
16
+ 'alert-triangle',
17
+ 'archive',
18
+ 'arrow-down',
19
+ 'arrow-left',
20
+ 'arrow-right',
21
+ 'arrow-up',
22
+ 'at-sign',
23
+ 'ban',
24
+ 'bar-chart',
25
+ 'bell',
26
+ 'bookmark',
27
+ 'box',
28
+ 'braces',
29
+ 'calendar',
30
+ 'camera',
31
+ 'check',
32
+ 'check-circle',
33
+ 'chevron-down',
34
+ 'chevron-left',
35
+ 'chevron-right',
36
+ 'chevron-up',
37
+ 'chevrons-up-down',
38
+ 'circle',
39
+ 'circle-dot',
40
+ 'clipboard',
41
+ 'clock',
42
+ 'cloud',
43
+ 'code',
44
+ 'cog',
45
+ 'copy',
46
+ 'cpu',
47
+ 'database',
48
+ 'download',
49
+ 'edit',
50
+ 'external-link',
51
+ 'eye',
52
+ 'eye-off',
53
+ 'file',
54
+ 'file-text',
55
+ 'filter',
56
+ 'flag',
57
+ 'folder',
58
+ 'folder-open',
59
+ 'gauge',
60
+ 'globe',
61
+ 'grid',
62
+ 'hash',
63
+ 'heart',
64
+ 'help-circle',
65
+ 'history',
66
+ 'home',
67
+ 'image',
68
+ 'inbox',
69
+ 'info',
70
+ 'key',
71
+ 'layers',
72
+ 'layout',
73
+ 'link',
74
+ 'list',
75
+ 'loader',
76
+ 'lock',
77
+ 'log-in',
78
+ 'log-out',
79
+ 'mail',
80
+ 'map',
81
+ 'maximize',
82
+ 'menu',
83
+ 'message',
84
+ 'microscope',
85
+ 'minimize',
86
+ 'minus',
87
+ 'monitor',
88
+ 'more-horizontal',
89
+ 'more-vertical',
90
+ 'move',
91
+ 'network',
92
+ 'package',
93
+ 'paperclip',
94
+ 'pause',
95
+ 'pencil',
96
+ 'play',
97
+ 'plus',
98
+ 'power',
99
+ 'refresh',
100
+ 'rocket',
101
+ 'rotate-ccw',
102
+ 'save',
103
+ 'search',
104
+ 'send',
105
+ 'server',
106
+ 'settings',
107
+ 'share',
108
+ 'shield',
109
+ 'skip-forward',
110
+ 'sliders',
111
+ 'square',
112
+ 'star',
113
+ 'stop',
114
+ 'table',
115
+ 'tag',
116
+ 'terminal',
117
+ 'thumbs-down',
118
+ 'thumbs-up',
119
+ 'trash',
120
+ 'trending-down',
121
+ 'trending-up',
122
+ 'upload',
123
+ 'user',
124
+ 'user-plus',
125
+ 'users',
126
+ 'video',
127
+ 'wand',
128
+ 'workflow',
129
+ 'wrench',
130
+ 'x',
131
+ 'x-circle',
132
+ 'zap',
133
+ 'zoom-in',
134
+ 'zoom-out',
135
+ ] as const;
136
+
137
+ export type BlokIconName = (typeof ICON_NAMES)[number];
138
+
139
+ export const iconNameSchema = z
140
+ .enum(ICON_NAMES)
141
+ .optional()
142
+ .describe(`Icon name. One of: ${ICON_NAMES.join(', ')}.`);
143
+
144
+ export const iconContracts = {
145
+ Icon: {
146
+ schema: z
147
+ .object({
148
+ name: iconNameSchema,
149
+ size: numberSchema.describe('Pixel size. Defaults to the surrounding text size.'),
150
+ className: classNameSchema,
151
+ })
152
+ .describe('A lucide icon.'),
153
+ },
154
+ } satisfies BlokComponentContracts;
@@ -0,0 +1,38 @@
1
+ import {dataContracts} from './data';
2
+ import {feedbackContracts} from './feedback';
3
+ import {formContracts} from './forms';
4
+ import {htmlContracts} from './html';
5
+ import {iconContracts} from './icons';
6
+ import {inspectorContracts} from './inspector';
7
+ import {layoutContracts} from './layout';
8
+ import {logoContracts} from './logo';
9
+ import {navigationContracts} from './navigation';
10
+ import {overlayContracts} from './overlays';
11
+ import {runContracts} from './run';
12
+ import {sceneContracts} from './scene';
13
+ import {structureContracts} from './structure';
14
+ import {toastContracts} from './toast';
15
+ import {typographyContracts} from './typography';
16
+
17
+ /**
18
+ * Every component contract this package defines, by name, grouped by family
19
+ * as the renders are. The catalogs (`../ui.ts`, `../scene.ts`, ...) pick theirs
20
+ * from here; a name is one component, in one catalog.
21
+ */
22
+ export const parts = {
23
+ ...layoutContracts,
24
+ ...typographyContracts,
25
+ ...htmlContracts,
26
+ ...formContracts,
27
+ ...overlayContracts,
28
+ ...navigationContracts,
29
+ ...feedbackContracts,
30
+ ...dataContracts,
31
+ ...iconContracts,
32
+ ...toastContracts,
33
+ ...inspectorContracts,
34
+ ...logoContracts,
35
+ ...sceneContracts,
36
+ ...runContracts,
37
+ ...structureContracts,
38
+ };
@@ -0,0 +1,14 @@
1
+ import * as z from 'zod';
2
+ import type {BlokComponentContracts} from '../../renderer/runtime/catalog';
3
+
4
+ /** Debug views. */
5
+
6
+ export const inspectorContracts = {
7
+ RawInspector: {
8
+ schema: z
9
+ .object({
10
+ name: z.string().describe('Label for the inspected node.'),
11
+ })
12
+ .describe('Debug view of a node\'s raw props.'),
13
+ },
14
+ } satisfies BlokComponentContracts;
@@ -0,0 +1,217 @@
1
+ import * as z from 'zod';
2
+ import type {BlokComponentContracts} from '../../renderer/runtime/catalog';
3
+ import {
4
+ alignSchema,
5
+ boolSchema,
6
+ childListSchema,
7
+ classNameSchema,
8
+ contentSchema,
9
+ flexDirectionSchema,
10
+ justifySchema,
11
+ layoutFields,
12
+ numberSchema,
13
+ orientationSchema,
14
+ sizeSchema,
15
+ spacingSchema,
16
+ } from '../props';
17
+
18
+ /** Box and structural bloks. See `renderer/bloks/layout.tsx` for the naming convention. */
19
+
20
+ const flexSchema = z
21
+ .object({
22
+ children: childListSchema,
23
+ direction: flexDirectionSchema,
24
+ wrap: boolSchema.describe('Allow children to wrap onto multiple lines.'),
25
+ justify: justifySchema,
26
+ align: alignSchema,
27
+ bordered: boolSchema.describe('Draw a border around the box.'),
28
+ ...layoutFields,
29
+ })
30
+ .describe('A flexbox container.');
31
+
32
+ /**
33
+ * A per-breakpoint value: `{base: 2, md: 4}`, mobile first, measured on the
34
+ * grid's own width (sm 640, md 768, lg 1024, xl 1280, 2xl 1536).
35
+ */
36
+ const responsive = <T extends z.ZodTypeAny>(value: T) =>
37
+ z.union([
38
+ value,
39
+ z
40
+ .object({
41
+ base: value.optional(),
42
+ sm: value.optional(),
43
+ md: value.optional(),
44
+ lg: value.optional(),
45
+ xl: value.optional(),
46
+ '2xl': value.optional(),
47
+ })
48
+ .strict(),
49
+ ]);
50
+
51
+ const bentoSpanSchema = z.union([
52
+ z.number().int().min(1),
53
+ z.object({
54
+ min: z.number().int().min(1).optional(),
55
+ ideal: z.union([z.number(), z.templateLiteral([z.number(), '%'])]),
56
+ max: z.number().int().min(1).optional(),
57
+ }),
58
+ ]);
59
+
60
+ /**
61
+ * The layout props a `BentoItem` hands its parent. The grid solves the layout
62
+ * from them before any item renders, so it reads them off the payload: they
63
+ * must be static literals.
64
+ */
65
+ export const bentoItemLayoutFields = {
66
+ cols: responsive(bentoSpanSchema)
67
+ .optional()
68
+ .describe(
69
+ 'Column span: 2, {"min":1,"ideal":2,"max":3}, {"ideal":"50%"}, or one per breakpoint ({"base":1,"md":2}). Static; read by the parent BentoGrid. Defaults to 1.',
70
+ ),
71
+ rows: responsive(bentoSpanSchema)
72
+ .optional()
73
+ .describe('Row span, same forms as cols. Static; read by the parent BentoGrid. Defaults to 1.'),
74
+ priority: responsive(z.number().min(0))
75
+ .optional()
76
+ .describe(
77
+ 'How strongly the item holds its ideal size: 1 normal, 2-3 key tiles, 0.5 fillers that flex first, 0 takes whatever closes the layout. Static.',
78
+ ),
79
+ show: responsive(z.boolean())
80
+ .optional()
81
+ .describe('false leaves the item out, optionally per breakpoint. Static.'),
82
+ };
83
+
84
+ export const bentoItemLayoutSchema = z.object(bentoItemLayoutFields);
85
+
86
+ /**
87
+ * `Flex`, `Row` and `Column` are the same component over the same schema; the
88
+ * only difference is whether the direction is author-controlled or fixed.
89
+ */
90
+ export const layoutContracts = {
91
+ Flex: {schema: flexSchema.describe('A flexbox container with an author-set direction.')},
92
+ Row: {schema: flexSchema.describe('A horizontal flexbox container.')},
93
+ Column: {schema: flexSchema.describe('A vertical flexbox container.')},
94
+ Grid: {
95
+ schema: z
96
+ .object({
97
+ children: childListSchema,
98
+ columns: z
99
+ .number()
100
+ .int()
101
+ .min(1)
102
+ .optional()
103
+ .describe('Fixed column count. Omit to auto-fit on minColumnWidth.'),
104
+ minColumnWidth: sizeSchema.describe('Minimum column width when auto-fitting.'),
105
+ bordered: boolSchema.describe('Draw a border around the grid.'),
106
+ ...layoutFields,
107
+ })
108
+ .describe('A CSS grid container.'),
109
+ },
110
+ div: {
111
+ schema: z
112
+ .object({
113
+ children: contentSchema,
114
+ className: classNameSchema,
115
+ ...layoutFields,
116
+ })
117
+ .describe('A plain block container.'),
118
+ },
119
+ Spacer: {
120
+ schema: z
121
+ .object({
122
+ size: sizeSchema.describe('Fixed size along the parent axis.'),
123
+ grow: numberSchema.describe('flex-grow; defaults to 1 when no size is given.'),
124
+ })
125
+ .describe('Flexible empty space between siblings.'),
126
+ },
127
+ Separator: {
128
+ schema: z
129
+ .object({
130
+ orientation: orientationSchema,
131
+ className: classNameSchema,
132
+ })
133
+ .describe('A dividing line between sections.'),
134
+ },
135
+ AspectRatio: {
136
+ schema: z
137
+ .object({
138
+ children: childListSchema,
139
+ ratio: z.number().positive().optional().describe('Width divided by height, e.g. 1.777.'),
140
+ className: classNameSchema,
141
+ })
142
+ .describe('Constrains its content to a fixed aspect ratio.'),
143
+ },
144
+ ScrollArea: {
145
+ schema: z
146
+ .object({
147
+ children: childListSchema,
148
+ className: classNameSchema,
149
+ gap: spacingSchema,
150
+ height: sizeSchema,
151
+ maxHeight: sizeSchema,
152
+ })
153
+ .describe('A scrollable region with styled scrollbars.'),
154
+ },
155
+ Resizable: {
156
+ schema: z
157
+ .object({
158
+ children: childListSchema.describe('ResizablePanel and ResizableHandle children.'),
159
+ direction: flexDirectionSchema.describe('"row" splits left/right, "column" top/bottom.'),
160
+ className: classNameSchema,
161
+ })
162
+ .describe('A group of user-resizable panels.'),
163
+ },
164
+ ResizablePanel: {
165
+ schema: z
166
+ .object({
167
+ children: childListSchema,
168
+ defaultSize: numberSchema.describe('Initial size as a percentage of the group.'),
169
+ minSize: numberSchema.describe('Minimum size percentage.'),
170
+ maxSize: numberSchema.describe('Maximum size percentage.'),
171
+ className: classNameSchema,
172
+ })
173
+ .describe('One panel inside a Resizable group.'),
174
+ },
175
+ ResizableHandle: {
176
+ schema: z
177
+ .object({
178
+ withHandle: boolSchema.describe('Show the grab affordance.'),
179
+ className: classNameSchema,
180
+ })
181
+ .describe('The drag handle between two ResizablePanels.'),
182
+ },
183
+ BentoGrid: {
184
+ schema: z
185
+ .object({
186
+ children: childListSchema.describe(
187
+ 'BentoItem children (their cols/rows/priority/show place them). Any other child, a foreach included, is one 1x1 tile.',
188
+ ),
189
+ columns: responsive(z.number().int().min(1))
190
+ .optional()
191
+ .describe('Column count, optionally per breakpoint: {"base":2,"md":4,"lg":6}. Defaults to 4.'),
192
+ rowHeight: responsive(z.union([z.number(), z.string()]))
193
+ .optional()
194
+ .describe('Row height in px or a CSS length, optionally per breakpoint. Defaults to "10rem".'),
195
+ holeCost: numberSchema.describe('Cost per empty cell inside the layout. Default 10.'),
196
+ raggedCost: numberSchema.describe('Cost per empty cell along the bottom edge. Defaults to holeCost.'),
197
+ animate: boolSchema.describe('Animate items entering, leaving and moving. Default true.'),
198
+ appear: boolSchema.describe('Also animate the items present on first render.'),
199
+ className: classNameSchema,
200
+ ...layoutFields,
201
+ })
202
+ .describe(
203
+ 'A bento grid: tiles in order, each sized as close to its preferred span as the columns allow, packed without holes.',
204
+ ),
205
+ },
206
+ BentoItem: {
207
+ placement: {downstreamOf: ['BentoGrid']},
208
+ schema: z
209
+ .object({
210
+ children: childListSchema,
211
+ ...bentoItemLayoutFields,
212
+ className: classNameSchema,
213
+ ...layoutFields,
214
+ })
215
+ .describe('One tile of a BentoGrid; fills the cells the grid gives it.'),
216
+ },
217
+ } satisfies BlokComponentContracts;
@@ -0,0 +1,254 @@
1
+ import * as z from 'zod';
2
+ import type {BlokComponentContracts} from '../../renderer/runtime/catalog';
3
+ import type {BlokComponentContract, BlokComponentPlacement} from '../../renderer/runtime/components';
4
+ import {loadVocabulary} from '../../spec/vocabulary';
5
+ import {actionProp, describedString} from '../props';
6
+
7
+ /**
8
+ * The `logo@1` module of the blok language: the `AgentLogo` and `ActionLogo`
9
+ * roots and the classic SVG elements as components.
10
+ *
11
+ * A logo root sits in html like `Scene` does and opens the `logo` context, so a
12
+ * `Path` or a `Circle` is only ever placed inside one. The root names the
13
+ * blok's context: an `AgentLogo` root is a LOGO blok, an `ActionLogo` root an
14
+ * ACTION_LOGO blok (it reads `task`, the viewer's last task of the action); any
15
+ * html blok may draw either too.
16
+ *
17
+ * A logo paints with the viewer's pens only (vocabulary `theme.logo_pens`:
18
+ * `ink`, `brand`, ..., the status roles `success`, `warning`, `info`), drawn
19
+ * from the brand hue as `var(--logo-*)`, or with `url(#id)` into the drawing.
20
+ * Anything else is drawn in `ink`; the server refuses it at save.
21
+ *
22
+ * A shape may `animate`. It plays while the logo is hovered, and while an
23
+ * action logo's task runs (`[data-logo-active]`); see `index.css`.
24
+ *
25
+ * Names are capitalised like the rest of the catalog and props are camelCase
26
+ * (`strokeWidth`, not `stroke-width`). `Text` is the typography component, so
27
+ * SVG text is `SvgText`.
28
+ *
29
+ * A node's id is the BSX `id`, and that is what a gradient or a clip path is
30
+ * referenced by: `fill="url(#sky)"` names `<LinearGradient id="sky">`.
31
+ */
32
+
33
+ /** The pens: what `var(--logo-<pen>)` in `index.css` draws from the brand hue (vocabulary `theme.logo_pens`). */
34
+ export const LOGO_PAINT_TOKENS: readonly string[] = loadVocabulary().theme.logoPens;
35
+
36
+ /** What a shape may play: a class `logo-anim-<name>` the stylesheet animates. */
37
+ export const LOGO_ANIMATIONS = ['spin', 'pulse', 'float', 'draw', 'march', 'blink'] as const;
38
+
39
+ const length = (description: string) =>
40
+ z.union([z.number(), z.string()]).optional().describe(description);
41
+
42
+ export const AGENT_LOGO_ROOT = 'AgentLogo';
43
+ export const ACTION_LOGO_ROOT = 'ActionLogo';
44
+ export const LOGO_ROOTS = [AGENT_LOGO_ROOT, ACTION_LOGO_ROOT];
45
+
46
+ const IN_SVG: BlokComponentPlacement = {context: 'logo', downstreamOf: LOGO_ROOTS};
47
+
48
+ /* -------------------------------------------------------------------------- */
49
+ /* Presentation: what every shape and group may set */
50
+ /* -------------------------------------------------------------------------- */
51
+
52
+ const PAINT_HELP = `${LOGO_PAINT_TOKENS.join(', ')} (the viewer's pens), or url(#gradient)`;
53
+
54
+ export const presentationFields = {
55
+ fill: describedString(`Fill paint: ${PAINT_HELP}.`),
56
+ fillOpacity: length('Fill opacity, 0 to 1.'),
57
+ fillRule: z.enum(['nonzero', 'evenodd']).optional().describe('Which parts of a self-intersecting shape are inside.'),
58
+ stroke: describedString(`Stroke paint: ${PAINT_HELP}.`),
59
+ strokeWidth: length('Stroke width, in user units.'),
60
+ strokeOpacity: length('Stroke opacity, 0 to 1.'),
61
+ strokeLinecap: z.enum(['butt', 'round', 'square']).optional().describe('How open line ends are drawn.'),
62
+ strokeLinejoin: z.enum(['miter', 'round', 'bevel']).optional().describe('How corners are drawn.'),
63
+ strokeDasharray: describedString('Dash pattern, e.g. "4 2".'),
64
+ opacity: length('Opacity of the whole element, 0 to 1.'),
65
+ transform: describedString('SVG transform, e.g. "rotate(45 12 12)".'),
66
+ clipPath: describedString('url(#clip) of a ClipPath to clip by.'),
67
+ title: describedString('Tooltip text (an SVG <title>).'),
68
+ onClick: actionProp('Runs when the element is clicked.'),
69
+ animate: z
70
+ .enum(LOGO_ANIMATIONS)
71
+ .optional()
72
+ .describe(
73
+ 'Plays while the logo is hovered, and while an action logo\'s task runs: spin, pulse, float, draw (traces the stroke), march (moves a dashed stroke) or blink.',
74
+ ),
75
+ animateDelay: length('Seconds before the animation starts, to stagger shapes.'),
76
+ };
77
+
78
+ /* -------------------------------------------------------------------------- */
79
+ /* Shapes */
80
+ /* -------------------------------------------------------------------------- */
81
+
82
+ /** Each shape's geometry props, passed through to its SVG element as they are. */
83
+ export const shapeGeometry = {
84
+ Path: {
85
+ d: describedString('Path data, e.g. "M2 12h20".'),
86
+ },
87
+ Circle: {
88
+ cx: length('Centre x.'),
89
+ cy: length('Centre y.'),
90
+ r: length('Radius.'),
91
+ },
92
+ Ellipse: {
93
+ cx: length('Centre x.'),
94
+ cy: length('Centre y.'),
95
+ rx: length('Horizontal radius.'),
96
+ ry: length('Vertical radius.'),
97
+ },
98
+ Rect: {
99
+ x: length('Left edge.'),
100
+ y: length('Top edge.'),
101
+ width: length('Width.'),
102
+ height: length('Height.'),
103
+ rx: length('Corner radius, horizontal.'),
104
+ ry: length('Corner radius, vertical.'),
105
+ },
106
+ Line: {
107
+ x1: length('Start x.'),
108
+ y1: length('Start y.'),
109
+ x2: length('End x.'),
110
+ y2: length('End y.'),
111
+ },
112
+ Polyline: {
113
+ points: describedString('Points, e.g. "0,0 10,5 20,0".'),
114
+ },
115
+ Polygon: {
116
+ points: describedString('Points, e.g. "0,0 10,5 20,0".'),
117
+ },
118
+ } satisfies Record<string, Record<string, z.ZodTypeAny>>;
119
+
120
+ /** A shape: one SVG element, its geometry props plus the shared presentation. */
121
+ const shape = (description: string, geometry: Record<string, z.ZodTypeAny>) => {
122
+ const schema: BlokComponentContract['schema'] = z
123
+ .object({...geometry, ...presentationFields})
124
+ .describe(description);
125
+ return {placement: IN_SVG, schema};
126
+ };
127
+
128
+ /* -------------------------------------------------------------------------- */
129
+ /* The root */
130
+ /* -------------------------------------------------------------------------- */
131
+
132
+ const rootSchema = (description: string) =>
133
+ z
134
+ .object({
135
+ viewBox: describedString('The user coordinate system, "minX minY width height", e.g. "0 0 24 24".'),
136
+ width: length('Width; fills its box when left out.'),
137
+ height: length('Height; fills its box when left out.'),
138
+ preserveAspectRatio: describedString('How the viewBox fits the box, e.g. "xMidYMid meet".'),
139
+ title: describedString('What the drawing shows, for screen readers and as a tooltip.'),
140
+ })
141
+ .describe(description);
142
+
143
+ /** A drawing's root: an `<svg>` whose shapes paint with the pens. */
144
+ const logoRoot = (description: string) => ({
145
+ acceptsChildren: true,
146
+ placement: {childrenContext: 'logo', notDownstreamOf: LOGO_ROOTS} satisfies BlokComponentPlacement,
147
+ schema: rootSchema(description),
148
+ });
149
+
150
+ /* -------------------------------------------------------------------------- */
151
+ /* Structure: groups, definitions, gradients, clip paths */
152
+ /* -------------------------------------------------------------------------- */
153
+
154
+ const gradientUnits = z
155
+ .enum(['objectBoundingBox', 'userSpaceOnUse'])
156
+ .optional()
157
+ .describe('Whether the coordinates are fractions of the shape (the default) or user units.');
158
+
159
+ /** The `logo@1` module: the root, seven shapes, text, and what shapes reference. */
160
+ export const logoContracts = {
161
+ [AGENT_LOGO_ROOT]: logoRoot(
162
+ "The root of an agent's logo: a drawing in the viewer's pens. Its children are SVG shapes.",
163
+ ),
164
+ [ACTION_LOGO_ROOT]: logoRoot(
165
+ "The root of an action's logo: a drawing in the viewer's pens that reads task (the viewer's last task of the action, idle until they run it). Its children are SVG shapes.",
166
+ ),
167
+ Path: shape('An SVG path.', shapeGeometry.Path),
168
+ Circle: shape('An SVG circle.', shapeGeometry.Circle),
169
+ Ellipse: shape('An SVG ellipse.', shapeGeometry.Ellipse),
170
+ Rect: shape('An SVG rectangle.', shapeGeometry.Rect),
171
+ Line: shape('An SVG line.', shapeGeometry.Line),
172
+ Polyline: shape('An open SVG polyline.', shapeGeometry.Polyline),
173
+ Polygon: shape('A closed SVG polygon.', shapeGeometry.Polygon),
174
+ SvgText: {
175
+ placement: IN_SVG,
176
+ schema: z
177
+ .object({
178
+ text: describedString('The text to draw.'),
179
+ x: length('Anchor x.'),
180
+ y: length('Baseline y.'),
181
+ fontSize: length('Font size, in user units.'),
182
+ fontFamily: describedString('Font family.'),
183
+ fontWeight: describedString('Font weight, e.g. "bold" or "600".'),
184
+ textAnchor: z.enum(['start', 'middle', 'end']).optional().describe('Where x is on the text.'),
185
+ dominantBaseline: z
186
+ .enum(['auto', 'middle', 'central', 'hanging', 'alphabetic'])
187
+ .optional()
188
+ .describe('Where y is on the text.'),
189
+ ...presentationFields,
190
+ })
191
+ .describe('Text in an SVG drawing (the SVG <text> element).'),
192
+ },
193
+ G: {
194
+ acceptsChildren: true,
195
+ placement: IN_SVG,
196
+ schema: z.object(presentationFields).describe('A group of SVG elements, which share its presentation and transform.'),
197
+ },
198
+ Defs: {
199
+ acceptsChildren: true,
200
+ placement: IN_SVG,
201
+ schema: z.object({}).describe('Definitions (gradients, clip paths) that are referenced, not drawn.'),
202
+ },
203
+ LinearGradient: {
204
+ acceptsChildren: true,
205
+ placement: IN_SVG,
206
+ schema: z
207
+ .object({
208
+ x1: length('Start x.'),
209
+ y1: length('Start y.'),
210
+ x2: length('End x.'),
211
+ y2: length('End y.'),
212
+ gradientUnits,
213
+ gradientTransform: describedString('Transform of the gradient.'),
214
+ })
215
+ .describe('A linear gradient, filled by its Stop children. Referenced as url(#id) by its BSX id.'),
216
+ },
217
+ RadialGradient: {
218
+ acceptsChildren: true,
219
+ placement: IN_SVG,
220
+ schema: z
221
+ .object({
222
+ cx: length('Centre x.'),
223
+ cy: length('Centre y.'),
224
+ r: length('Radius.'),
225
+ fx: length('Focal point x.'),
226
+ fy: length('Focal point y.'),
227
+ gradientUnits,
228
+ gradientTransform: describedString('Transform of the gradient.'),
229
+ })
230
+ .describe('A radial gradient, filled by its Stop children. Referenced as url(#id) by its BSX id.'),
231
+ },
232
+ Stop: {
233
+ placement: {context: 'logo', downstreamOf: ['LinearGradient', 'RadialGradient']},
234
+ schema: z
235
+ .object({
236
+ offset: length('Where along the gradient, 0 to 1 or a percentage.'),
237
+ stopColor: describedString(`The colour at this stop: ${PAINT_HELP}.`),
238
+ stopOpacity: length('The opacity at this stop, 0 to 1.'),
239
+ })
240
+ .describe('One colour stop of a gradient.'),
241
+ },
242
+ ClipPath: {
243
+ acceptsChildren: true,
244
+ placement: IN_SVG,
245
+ schema: z
246
+ .object({
247
+ clipPathUnits: z
248
+ .enum(['userSpaceOnUse', 'objectBoundingBox'])
249
+ .optional()
250
+ .describe('Whether its shapes are in user units (the default) or fractions of the clipped shape.'),
251
+ })
252
+ .describe('A clip path made of its shape children. Referenced as url(#id) by its BSX id.'),
253
+ },
254
+ } satisfies BlokComponentContracts;