@arkitektio/bsx 0.0.0-stage → 0.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 (970) hide show
  1. package/README.md +36 -2
  2. package/dist/bsx/analyze.d.ts +30 -0
  3. package/dist/bsx/analyze.d.ts.map +1 -0
  4. package/dist/bsx/analyze.js +47 -0
  5. package/dist/bsx/analyze.js.map +1 -0
  6. package/dist/bsx/expr.d.ts +116 -0
  7. package/dist/bsx/expr.d.ts.map +1 -0
  8. package/dist/bsx/expr.js +476 -0
  9. package/dist/bsx/expr.js.map +1 -0
  10. package/dist/bsx/index.d.ts +9 -0
  11. package/dist/bsx/index.d.ts.map +1 -0
  12. package/dist/bsx/index.js +9 -0
  13. package/dist/bsx/index.js.map +1 -0
  14. package/dist/bsx/infer.d.ts +77 -0
  15. package/dist/bsx/infer.d.ts.map +1 -0
  16. package/dist/bsx/infer.js +279 -0
  17. package/dist/bsx/infer.js.map +1 -0
  18. package/dist/bsx/language.d.ts +106 -0
  19. package/dist/bsx/language.d.ts.map +1 -0
  20. package/dist/bsx/language.js +717 -0
  21. package/dist/bsx/language.js.map +1 -0
  22. package/dist/bsx/parse.d.ts +77 -0
  23. package/dist/bsx/parse.d.ts.map +1 -0
  24. package/dist/bsx/parse.js +801 -0
  25. package/dist/bsx/parse.js.map +1 -0
  26. package/dist/bsx/partial.d.ts +37 -0
  27. package/dist/bsx/partial.d.ts.map +1 -0
  28. package/dist/bsx/partial.js +184 -0
  29. package/dist/bsx/partial.js.map +1 -0
  30. package/dist/bsx/print.d.ts +21 -0
  31. package/dist/bsx/print.d.ts.map +1 -0
  32. package/dist/bsx/print.js +407 -0
  33. package/dist/bsx/print.js.map +1 -0
  34. package/dist/bsx/references.d.ts +155 -0
  35. package/dist/bsx/references.d.ts.map +1 -0
  36. package/dist/bsx/references.js +971 -0
  37. package/dist/bsx/references.js.map +1 -0
  38. package/dist/bsx/source.d.ts +34 -0
  39. package/dist/bsx/source.d.ts.map +1 -0
  40. package/dist/bsx/source.js +53 -0
  41. package/dist/bsx/source.js.map +1 -0
  42. package/dist/cache/keyedStore.d.ts +44 -0
  43. package/dist/cache/keyedStore.d.ts.map +1 -0
  44. package/dist/cache/keyedStore.js +84 -0
  45. package/dist/cache/keyedStore.js.map +1 -0
  46. package/dist/editor/BsxEditor.d.ts +19 -0
  47. package/dist/editor/BsxEditor.d.ts.map +1 -0
  48. package/dist/editor/BsxEditor.js +214 -0
  49. package/dist/editor/BsxEditor.js.map +1 -0
  50. package/dist/editor.d.ts +2 -0
  51. package/dist/editor.d.ts.map +1 -0
  52. package/dist/editor.js +3 -0
  53. package/dist/editor.js.map +1 -0
  54. package/dist/index.d.ts +6 -0
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/index.js +6 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/logo/CachedBlokLogo.d.ts +38 -0
  59. package/dist/logo/CachedBlokLogo.d.ts.map +1 -0
  60. package/dist/logo/CachedBlokLogo.js +84 -0
  61. package/dist/logo/CachedBlokLogo.js.map +1 -0
  62. package/dist/logo/SourceLogo.d.ts +8 -0
  63. package/dist/logo/SourceLogo.d.ts.map +1 -0
  64. package/dist/logo/SourceLogo.js +40 -0
  65. package/dist/logo/SourceLogo.js.map +1 -0
  66. package/dist/logo/actionLogoSource.d.ts +18 -0
  67. package/dist/logo/actionLogoSource.d.ts.map +1 -0
  68. package/dist/logo/actionLogoSource.js +20 -0
  69. package/dist/logo/actionLogoSource.js.map +1 -0
  70. package/dist/logo/demo.d.ts +8 -0
  71. package/dist/logo/demo.d.ts.map +1 -0
  72. package/dist/logo/demo.js +20 -0
  73. package/dist/logo/demo.js.map +1 -0
  74. package/dist/logo/logoCache.d.ts +44 -0
  75. package/dist/logo/logoCache.d.ts.map +1 -0
  76. package/dist/logo/logoCache.js +121 -0
  77. package/dist/logo/logoCache.js.map +1 -0
  78. package/dist/platform.d.ts +83 -0
  79. package/dist/platform.d.ts.map +1 -0
  80. package/dist/platform.js +52 -0
  81. package/dist/platform.js.map +1 -0
  82. package/dist/preview/CachedBlokPreview.d.ts +49 -0
  83. package/dist/preview/CachedBlokPreview.d.ts.map +1 -0
  84. package/dist/preview/CachedBlokPreview.js +200 -0
  85. package/dist/preview/CachedBlokPreview.js.map +1 -0
  86. package/dist/preview/previewCache.d.ts +18 -0
  87. package/dist/preview/previewCache.d.ts.map +1 -0
  88. package/dist/preview/previewCache.js +50 -0
  89. package/dist/preview/previewCache.js.map +1 -0
  90. package/dist/preview/queue.d.ts +17 -0
  91. package/dist/preview/queue.d.ts.map +1 -0
  92. package/dist/preview/queue.js +67 -0
  93. package/dist/preview/queue.js.map +1 -0
  94. package/dist/preview/snapshot.d.ts +40 -0
  95. package/dist/preview/snapshot.d.ts.map +1 -0
  96. package/dist/preview/snapshot.js +211 -0
  97. package/dist/preview/snapshot.js.map +1 -0
  98. package/dist/preview/snapshotMode.d.ts +31 -0
  99. package/dist/preview/snapshotMode.d.ts.map +1 -0
  100. package/dist/preview/snapshotMode.js +19 -0
  101. package/dist/preview/snapshotMode.js.map +1 -0
  102. package/dist/renderer/BlokComponentHost.d.ts +46 -0
  103. package/dist/renderer/BlokComponentHost.d.ts.map +1 -0
  104. package/dist/renderer/BlokComponentHost.js +83 -0
  105. package/dist/renderer/BlokComponentHost.js.map +1 -0
  106. package/dist/renderer/BlokDebugState.d.ts +7 -0
  107. package/dist/renderer/BlokDebugState.d.ts.map +1 -0
  108. package/dist/renderer/BlokDebugState.js +19 -0
  109. package/dist/renderer/BlokDebugState.js.map +1 -0
  110. package/dist/renderer/BlokRenderer.d.ts +57 -0
  111. package/dist/renderer/BlokRenderer.d.ts.map +1 -0
  112. package/dist/renderer/BlokRenderer.js +136 -0
  113. package/dist/renderer/BlokRenderer.js.map +1 -0
  114. package/dist/renderer/assets.d.ts +85 -0
  115. package/dist/renderer/assets.d.ts.map +1 -0
  116. package/dist/renderer/assets.js +99 -0
  117. package/dist/renderer/assets.js.map +1 -0
  118. package/dist/renderer/baseCatalog.d.ts +12 -0
  119. package/dist/renderer/baseCatalog.d.ts.map +1 -0
  120. package/dist/renderer/baseCatalog.js +13 -0
  121. package/dist/renderer/baseCatalog.js.map +1 -0
  122. package/dist/renderer/base_v1.json +1541 -0
  123. package/dist/renderer/bloks/control.d.ts +25 -0
  124. package/dist/renderer/bloks/control.d.ts.map +1 -0
  125. package/dist/renderer/bloks/control.js +294 -0
  126. package/dist/renderer/bloks/control.js.map +1 -0
  127. package/dist/renderer/bloks/data.d.ts +28 -0
  128. package/dist/renderer/bloks/data.d.ts.map +1 -0
  129. package/dist/renderer/bloks/data.js +409 -0
  130. package/dist/renderer/bloks/data.js.map +1 -0
  131. package/dist/renderer/bloks/feedback.d.ts +9 -0
  132. package/dist/renderer/bloks/feedback.d.ts.map +1 -0
  133. package/dist/renderer/bloks/feedback.js +128 -0
  134. package/dist/renderer/bloks/feedback.js.map +1 -0
  135. package/dist/renderer/bloks/forms.d.ts +43 -0
  136. package/dist/renderer/bloks/forms.d.ts.map +1 -0
  137. package/dist/renderer/bloks/forms.js +777 -0
  138. package/dist/renderer/bloks/forms.js.map +1 -0
  139. package/dist/renderer/bloks/html.d.ts +10 -0
  140. package/dist/renderer/bloks/html.d.ts.map +1 -0
  141. package/dist/renderer/bloks/html.js +99 -0
  142. package/dist/renderer/bloks/html.js.map +1 -0
  143. package/dist/renderer/bloks/icons.d.ts +263 -0
  144. package/dist/renderer/bloks/icons.d.ts.map +1 -0
  145. package/dist/renderer/bloks/icons.js +173 -0
  146. package/dist/renderer/bloks/icons.js.map +1 -0
  147. package/dist/renderer/bloks/index.d.ts +19 -0
  148. package/dist/renderer/bloks/index.d.ts.map +1 -0
  149. package/dist/renderer/bloks/index.js +30 -0
  150. package/dist/renderer/bloks/index.js.map +1 -0
  151. package/dist/renderer/bloks/inspector/Inspector.d.ts +2 -0
  152. package/dist/renderer/bloks/inspector/Inspector.d.ts.map +1 -0
  153. package/dist/renderer/bloks/inspector/Inspector.js +14 -0
  154. package/dist/renderer/bloks/inspector/Inspector.js.map +1 -0
  155. package/dist/renderer/bloks/layout.d.ts +16 -0
  156. package/dist/renderer/bloks/layout.d.ts.map +1 -0
  157. package/dist/renderer/bloks/layout.js +345 -0
  158. package/dist/renderer/bloks/layout.js.map +1 -0
  159. package/dist/renderer/bloks/logo/index.d.ts +26 -0
  160. package/dist/renderer/bloks/logo/index.d.ts.map +1 -0
  161. package/dist/renderer/bloks/logo/index.js +361 -0
  162. package/dist/renderer/bloks/logo/index.js.map +1 -0
  163. package/dist/renderer/bloks/logo/logo.fixture.json +323 -0
  164. package/dist/renderer/bloks/navigation.d.ts +29 -0
  165. package/dist/renderer/bloks/navigation.d.ts.map +1 -0
  166. package/dist/renderer/bloks/navigation.js +421 -0
  167. package/dist/renderer/bloks/navigation.js.map +1 -0
  168. package/dist/renderer/bloks/overlays.d.ts +56 -0
  169. package/dist/renderer/bloks/overlays.d.ts.map +1 -0
  170. package/dist/renderer/bloks/overlays.js +391 -0
  171. package/dist/renderer/bloks/overlays.js.map +1 -0
  172. package/dist/renderer/bloks/run/components.d.ts +5 -0
  173. package/dist/renderer/bloks/run/components.d.ts.map +1 -0
  174. package/dist/renderer/bloks/run/components.js +121 -0
  175. package/dist/renderer/bloks/run/components.js.map +1 -0
  176. package/dist/renderer/bloks/run/host.d.ts +38 -0
  177. package/dist/renderer/bloks/run/host.d.ts.map +1 -0
  178. package/dist/renderer/bloks/run/host.js +21 -0
  179. package/dist/renderer/bloks/run/host.js.map +1 -0
  180. package/dist/renderer/bloks/run/index.d.ts +4 -0
  181. package/dist/renderer/bloks/run/index.d.ts.map +1 -0
  182. package/dist/renderer/bloks/run/index.js +4 -0
  183. package/dist/renderer/bloks/run/index.js.map +1 -0
  184. package/dist/renderer/bloks/run/math.d.ts +50 -0
  185. package/dist/renderer/bloks/run/math.d.ts.map +1 -0
  186. package/dist/renderer/bloks/run/math.js +79 -0
  187. package/dist/renderer/bloks/run/math.js.map +1 -0
  188. package/dist/renderer/bloks/scene/Model.d.ts +3 -0
  189. package/dist/renderer/bloks/scene/Model.d.ts.map +1 -0
  190. package/dist/renderer/bloks/scene/Model.js +367 -0
  191. package/dist/renderer/bloks/scene/Model.js.map +1 -0
  192. package/dist/renderer/bloks/scene/Scene.d.ts +46 -0
  193. package/dist/renderer/bloks/scene/Scene.d.ts.map +1 -0
  194. package/dist/renderer/bloks/scene/Scene.js +467 -0
  195. package/dist/renderer/bloks/scene/Scene.js.map +1 -0
  196. package/dist/renderer/bloks/scene/Transform.d.ts +2 -0
  197. package/dist/renderer/bloks/scene/Transform.d.ts.map +1 -0
  198. package/dist/renderer/bloks/scene/Transform.js +83 -0
  199. package/dist/renderer/bloks/scene/Transform.js.map +1 -0
  200. package/dist/renderer/bloks/scene/bindings.d.ts +9 -0
  201. package/dist/renderer/bloks/scene/bindings.d.ts.map +1 -0
  202. package/dist/renderer/bloks/scene/bindings.js +387 -0
  203. package/dist/renderer/bloks/scene/bindings.js.map +1 -0
  204. package/dist/renderer/bloks/scene/colour.d.ts +23 -0
  205. package/dist/renderer/bloks/scene/colour.d.ts.map +1 -0
  206. package/dist/renderer/bloks/scene/colour.js +45 -0
  207. package/dist/renderer/bloks/scene/colour.js.map +1 -0
  208. package/dist/renderer/bloks/scene/context.d.ts +115 -0
  209. package/dist/renderer/bloks/scene/context.d.ts.map +1 -0
  210. package/dist/renderer/bloks/scene/context.js +120 -0
  211. package/dist/renderer/bloks/scene/context.js.map +1 -0
  212. package/dist/renderer/bloks/scene/host.d.ts +36 -0
  213. package/dist/renderer/bloks/scene/host.d.ts.map +1 -0
  214. package/dist/renderer/bloks/scene/host.js +41 -0
  215. package/dist/renderer/bloks/scene/host.js.map +1 -0
  216. package/dist/renderer/bloks/scene/index.d.ts +10 -0
  217. package/dist/renderer/bloks/scene/index.d.ts.map +1 -0
  218. package/dist/renderer/bloks/scene/index.js +30 -0
  219. package/dist/renderer/bloks/scene/index.js.map +1 -0
  220. package/dist/renderer/bloks/scene/interaction.d.ts +3 -0
  221. package/dist/renderer/bloks/scene/interaction.d.ts.map +1 -0
  222. package/dist/renderer/bloks/scene/interaction.js +166 -0
  223. package/dist/renderer/bloks/scene/interaction.js.map +1 -0
  224. package/dist/renderer/bloks/scene/loadModel.d.ts +35 -0
  225. package/dist/renderer/bloks/scene/loadModel.d.ts.map +1 -0
  226. package/dist/renderer/bloks/scene/loadModel.js +106 -0
  227. package/dist/renderer/bloks/scene/loadModel.js.map +1 -0
  228. package/dist/renderer/bloks/scene/scene.fixture.json +203 -0
  229. package/dist/renderer/bloks/scene/scope.fixture.glb +0 -0
  230. package/dist/renderer/bloks/shared/index.d.ts +6 -0
  231. package/dist/renderer/bloks/shared/index.d.ts.map +1 -0
  232. package/dist/renderer/bloks/shared/index.js +6 -0
  233. package/dist/renderer/bloks/shared/index.js.map +1 -0
  234. package/dist/renderer/bloks/shared/props.d.ts +72 -0
  235. package/dist/renderer/bloks/shared/props.d.ts.map +1 -0
  236. package/dist/renderer/bloks/shared/props.js +152 -0
  237. package/dist/renderer/bloks/shared/props.js.map +1 -0
  238. package/dist/renderer/bloks/shared/render.d.ts +20 -0
  239. package/dist/renderer/bloks/shared/render.d.ts.map +1 -0
  240. package/dist/renderer/bloks/shared/render.js +42 -0
  241. package/dist/renderer/bloks/shared/render.js.map +1 -0
  242. package/dist/renderer/bloks/shared/schemas.d.ts +226 -0
  243. package/dist/renderer/bloks/shared/schemas.d.ts.map +1 -0
  244. package/dist/renderer/bloks/shared/schemas.js +174 -0
  245. package/dist/renderer/bloks/shared/schemas.js.map +1 -0
  246. package/dist/renderer/bloks/shared/state.d.ts +40 -0
  247. package/dist/renderer/bloks/shared/state.d.ts.map +1 -0
  248. package/dist/renderer/bloks/shared/state.js +49 -0
  249. package/dist/renderer/bloks/shared/state.js.map +1 -0
  250. package/dist/renderer/bloks/shared/throttle.d.ts +17 -0
  251. package/dist/renderer/bloks/shared/throttle.d.ts.map +1 -0
  252. package/dist/renderer/bloks/shared/throttle.js +38 -0
  253. package/dist/renderer/bloks/shared/throttle.js.map +1 -0
  254. package/dist/renderer/bloks/testing.d.ts +29 -0
  255. package/dist/renderer/bloks/testing.d.ts.map +1 -0
  256. package/dist/renderer/bloks/testing.js +32 -0
  257. package/dist/renderer/bloks/testing.js.map +1 -0
  258. package/dist/renderer/bloks/toast.d.ts +32 -0
  259. package/dist/renderer/bloks/toast.d.ts.map +1 -0
  260. package/dist/renderer/bloks/toast.js +89 -0
  261. package/dist/renderer/bloks/toast.js.map +1 -0
  262. package/dist/renderer/bloks/typography.d.ts +25 -0
  263. package/dist/renderer/bloks/typography.d.ts.map +1 -0
  264. package/dist/renderer/bloks/typography.js +188 -0
  265. package/dist/renderer/bloks/typography.js.map +1 -0
  266. package/dist/renderer/catalog.d.ts +42 -0
  267. package/dist/renderer/catalog.d.ts.map +1 -0
  268. package/dist/renderer/catalog.js +83 -0
  269. package/dist/renderer/catalog.js.map +1 -0
  270. package/dist/renderer/declarations.d.ts +102 -0
  271. package/dist/renderer/declarations.d.ts.map +1 -0
  272. package/dist/renderer/declarations.js +159 -0
  273. package/dist/renderer/declarations.js.map +1 -0
  274. package/dist/renderer/functions/argumentSchemas.d.ts +19 -0
  275. package/dist/renderer/functions/argumentSchemas.d.ts.map +1 -0
  276. package/dist/renderer/functions/argumentSchemas.js +35 -0
  277. package/dist/renderer/functions/argumentSchemas.js.map +1 -0
  278. package/dist/renderer/functions/base.d.ts +3 -0
  279. package/dist/renderer/functions/base.d.ts.map +1 -0
  280. package/dist/renderer/functions/base.js +159 -0
  281. package/dist/renderer/functions/base.js.map +1 -0
  282. package/dist/renderer/functions/coerce.d.ts +2 -0
  283. package/dist/renderer/functions/coerce.d.ts.map +1 -0
  284. package/dist/renderer/functions/coerce.js +73 -0
  285. package/dist/renderer/functions/coerce.js.map +1 -0
  286. package/dist/renderer/functions/effects.d.ts +4 -0
  287. package/dist/renderer/functions/effects.d.ts.map +1 -0
  288. package/dist/renderer/functions/effects.js +102 -0
  289. package/dist/renderer/functions/effects.js.map +1 -0
  290. package/dist/renderer/functions/format.d.ts +2 -0
  291. package/dist/renderer/functions/format.d.ts.map +1 -0
  292. package/dist/renderer/functions/format.js +134 -0
  293. package/dist/renderer/functions/format.js.map +1 -0
  294. package/dist/renderer/functions/index.d.ts +3 -0
  295. package/dist/renderer/functions/index.d.ts.map +1 -0
  296. package/dist/renderer/functions/index.js +4 -0
  297. package/dist/renderer/functions/index.js.map +1 -0
  298. package/dist/renderer/functions/lists.d.ts +2 -0
  299. package/dist/renderer/functions/lists.d.ts.map +1 -0
  300. package/dist/renderer/functions/lists.js +139 -0
  301. package/dist/renderer/functions/lists.js.map +1 -0
  302. package/dist/renderer/functions/logic.d.ts +3 -0
  303. package/dist/renderer/functions/logic.d.ts.map +1 -0
  304. package/dist/renderer/functions/logic.js +37 -0
  305. package/dist/renderer/functions/logic.js.map +1 -0
  306. package/dist/renderer/functions/math.d.ts +4 -0
  307. package/dist/renderer/functions/math.d.ts.map +1 -0
  308. package/dist/renderer/functions/math.js +61 -0
  309. package/dist/renderer/functions/math.js.map +1 -0
  310. package/dist/renderer/functions/objects.d.ts +2 -0
  311. package/dist/renderer/functions/objects.d.ts.map +1 -0
  312. package/dist/renderer/functions/objects.js +42 -0
  313. package/dist/renderer/functions/objects.js.map +1 -0
  314. package/dist/renderer/functions/strings.d.ts +4 -0
  315. package/dist/renderer/functions/strings.d.ts.map +1 -0
  316. package/dist/renderer/functions/strings.js +115 -0
  317. package/dist/renderer/functions/strings.js.map +1 -0
  318. package/dist/renderer/functions/v2/handler.d.ts +9 -0
  319. package/dist/renderer/functions/v2/handler.d.ts.map +1 -0
  320. package/dist/renderer/functions/v2/handler.js +9 -0
  321. package/dist/renderer/functions/v2/handler.js.map +1 -0
  322. package/dist/renderer/functions/v2/index.d.ts +41 -0
  323. package/dist/renderer/functions/v2/index.d.ts.map +1 -0
  324. package/dist/renderer/functions/v2/index.js +602 -0
  325. package/dist/renderer/functions/v2/index.js.map +1 -0
  326. package/dist/renderer/modules.d.ts +21 -0
  327. package/dist/renderer/modules.d.ts.map +1 -0
  328. package/dist/renderer/modules.js +41 -0
  329. package/dist/renderer/modules.js.map +1 -0
  330. package/dist/renderer/persist.d.ts +121 -0
  331. package/dist/renderer/persist.d.ts.map +1 -0
  332. package/dist/renderer/persist.js +201 -0
  333. package/dist/renderer/persist.js.map +1 -0
  334. package/dist/renderer/runtime/checks.d.ts +13 -0
  335. package/dist/renderer/runtime/checks.d.ts.map +1 -0
  336. package/dist/renderer/runtime/checks.js +132 -0
  337. package/dist/renderer/runtime/checks.js.map +1 -0
  338. package/dist/renderer/runtime/components.d.ts +118 -0
  339. package/dist/renderer/runtime/components.d.ts.map +1 -0
  340. package/dist/renderer/runtime/components.js +158 -0
  341. package/dist/renderer/runtime/components.js.map +1 -0
  342. package/dist/renderer/runtime/context.d.ts +43 -0
  343. package/dist/renderer/runtime/context.d.ts.map +1 -0
  344. package/dist/renderer/runtime/context.js +286 -0
  345. package/dist/renderer/runtime/context.js.map +1 -0
  346. package/dist/renderer/runtime/functions.d.ts +36 -0
  347. package/dist/renderer/runtime/functions.d.ts.map +1 -0
  348. package/dist/renderer/runtime/functions.js +37 -0
  349. package/dist/renderer/runtime/functions.js.map +1 -0
  350. package/dist/renderer/runtime/hooks.d.ts +138 -0
  351. package/dist/renderer/runtime/hooks.d.ts.map +1 -0
  352. package/dist/renderer/runtime/hooks.js +535 -0
  353. package/dist/renderer/runtime/hooks.js.map +1 -0
  354. package/dist/renderer/runtime/index.d.ts +21 -0
  355. package/dist/renderer/runtime/index.d.ts.map +1 -0
  356. package/dist/renderer/runtime/index.js +26 -0
  357. package/dist/renderer/runtime/index.js.map +1 -0
  358. package/dist/renderer/runtime/nodeState.d.ts +34 -0
  359. package/dist/renderer/runtime/nodeState.d.ts.map +1 -0
  360. package/dist/renderer/runtime/nodeState.js +13 -0
  361. package/dist/renderer/runtime/nodeState.js.map +1 -0
  362. package/dist/renderer/runtime/normalize.d.ts +21 -0
  363. package/dist/renderer/runtime/normalize.d.ts.map +1 -0
  364. package/dist/renderer/runtime/normalize.js +107 -0
  365. package/dist/renderer/runtime/normalize.js.map +1 -0
  366. package/dist/renderer/runtime/port.d.ts +24 -0
  367. package/dist/renderer/runtime/port.d.ts.map +1 -0
  368. package/dist/renderer/runtime/port.js +5 -0
  369. package/dist/renderer/runtime/port.js.map +1 -0
  370. package/dist/renderer/runtime/preflight.d.ts +20 -0
  371. package/dist/renderer/runtime/preflight.d.ts.map +1 -0
  372. package/dist/renderer/runtime/preflight.js +195 -0
  373. package/dist/renderer/runtime/preflight.js.map +1 -0
  374. package/dist/renderer/runtime/reads.d.ts +101 -0
  375. package/dist/renderer/runtime/reads.d.ts.map +1 -0
  376. package/dist/renderer/runtime/reads.js +284 -0
  377. package/dist/renderer/runtime/reads.js.map +1 -0
  378. package/dist/renderer/runtime/resolution.d.ts +71 -0
  379. package/dist/renderer/runtime/resolution.d.ts.map +1 -0
  380. package/dist/renderer/runtime/resolution.js +403 -0
  381. package/dist/renderer/runtime/resolution.js.map +1 -0
  382. package/dist/renderer/runtime/resource.d.ts +71 -0
  383. package/dist/renderer/runtime/resource.d.ts.map +1 -0
  384. package/dist/renderer/runtime/resource.js +138 -0
  385. package/dist/renderer/runtime/resource.js.map +1 -0
  386. package/dist/renderer/runtime/schemas.d.ts +119 -0
  387. package/dist/renderer/runtime/schemas.d.ts.map +1 -0
  388. package/dist/renderer/runtime/schemas.js +139 -0
  389. package/dist/renderer/runtime/schemas.js.map +1 -0
  390. package/dist/renderer/runtime/scope.d.ts +41 -0
  391. package/dist/renderer/runtime/scope.d.ts.map +1 -0
  392. package/dist/renderer/runtime/scope.js +95 -0
  393. package/dist/renderer/runtime/scope.js.map +1 -0
  394. package/dist/renderer/runtime/status.d.ts +35 -0
  395. package/dist/renderer/runtime/status.d.ts.map +1 -0
  396. package/dist/renderer/runtime/status.js +23 -0
  397. package/dist/renderer/runtime/status.js.map +1 -0
  398. package/dist/renderer/runtime/task.d.ts +63 -0
  399. package/dist/renderer/runtime/task.d.ts.map +1 -0
  400. package/dist/renderer/runtime/task.js +99 -0
  401. package/dist/renderer/runtime/task.js.map +1 -0
  402. package/dist/renderer/runtime/tree.d.ts +33 -0
  403. package/dist/renderer/runtime/tree.d.ts.map +1 -0
  404. package/dist/renderer/runtime/tree.js +59 -0
  405. package/dist/renderer/runtime/tree.js.map +1 -0
  406. package/dist/renderer/runtime/types.d.ts +247 -0
  407. package/dist/renderer/runtime/types.d.ts.map +1 -0
  408. package/dist/renderer/runtime/types.js +4 -0
  409. package/dist/renderer/runtime/types.js.map +1 -0
  410. package/dist/renderer/runtime/utils.d.ts +13 -0
  411. package/dist/renderer/runtime/utils.d.ts.map +1 -0
  412. package/dist/renderer/runtime/utils.js +48 -0
  413. package/dist/renderer/runtime/utils.js.map +1 -0
  414. package/dist/renderer/runtime/viewer.d.ts +17 -0
  415. package/dist/renderer/runtime/viewer.d.ts.map +1 -0
  416. package/dist/renderer/runtime/viewer.js +15 -0
  417. package/dist/renderer/runtime/viewer.js.map +1 -0
  418. package/dist/runtime.d.ts +9 -0
  419. package/dist/runtime.d.ts.map +1 -0
  420. package/dist/runtime.js +10 -0
  421. package/dist/runtime.js.map +1 -0
  422. package/dist/scene.d.ts +3 -0
  423. package/dist/scene.d.ts.map +1 -0
  424. package/dist/scene.js +4 -0
  425. package/dist/scene.js.map +1 -0
  426. package/dist/spec/bsx_v2.json +11380 -0
  427. package/dist/spec/catalogs/base@2.json +210 -0
  428. package/dist/spec/catalogs/base@2.json.js +210 -0
  429. package/dist/spec/catalogs/html@1.json +308 -0
  430. package/dist/spec/catalogs/html@1.json.js +308 -0
  431. package/dist/spec/catalogs/logo@1.json +1673 -0
  432. package/dist/spec/catalogs/logo@1.json.js +1673 -0
  433. package/dist/spec/catalogs/scene@1.json +806 -0
  434. package/dist/spec/catalogs/scene@1.json.js +806 -0
  435. package/dist/spec/catalogs/structure@1.json +185 -0
  436. package/dist/spec/catalogs/structure@1.json.js +185 -0
  437. package/dist/spec/catalogs/ui@1.json +3696 -0
  438. package/dist/spec/catalogs/ui@1.json.js +3696 -0
  439. package/dist/spec/catalogs.d.ts +101 -0
  440. package/dist/spec/catalogs.d.ts.map +1 -0
  441. package/dist/spec/catalogs.js +131 -0
  442. package/dist/spec/catalogs.js.map +1 -0
  443. package/dist/spec/locals.d.ts +14 -0
  444. package/dist/spec/locals.d.ts.map +1 -0
  445. package/dist/spec/locals.js +29 -0
  446. package/dist/spec/locals.js.map +1 -0
  447. package/dist/spec/modules/orkestrator.json +2755 -0
  448. package/dist/spec/modules/orkestrator.json.js +2755 -0
  449. package/dist/spec/vocabulary.d.ts +209 -0
  450. package/dist/spec/vocabulary.d.ts.map +1 -0
  451. package/dist/spec/vocabulary.js +307 -0
  452. package/dist/spec/vocabulary.js.map +1 -0
  453. package/dist/spec/vocabulary.json +411 -0
  454. package/dist/spec/vocabulary.json.js +411 -0
  455. package/dist/tailwind/defaultTheme.d.ts +3 -0
  456. package/dist/tailwind/defaultTheme.d.ts.map +1 -0
  457. package/dist/tailwind/defaultTheme.js +4 -0
  458. package/dist/tailwind/defaultTheme.js.map +1 -0
  459. package/dist/tailwind/runtimeTailwind.d.ts +14 -0
  460. package/dist/tailwind/runtimeTailwind.d.ts.map +1 -0
  461. package/dist/tailwind/runtimeTailwind.js +124 -0
  462. package/dist/tailwind/runtimeTailwind.js.map +1 -0
  463. package/dist/tailwind/theme.css +137 -0
  464. package/dist/tailwind/useBlokTailwind.d.ts +5 -0
  465. package/dist/tailwind/useBlokTailwind.d.ts.map +1 -0
  466. package/dist/tailwind/useBlokTailwind.js +74 -0
  467. package/dist/tailwind/useBlokTailwind.js.map +1 -0
  468. package/dist/tailwind.d.ts +3 -0
  469. package/dist/tailwind.d.ts.map +1 -0
  470. package/dist/tailwind.js +4 -0
  471. package/dist/tailwind.js.map +1 -0
  472. package/dist/vendor/core/data/scene/camera/navigateButtons.d.ts +15 -0
  473. package/dist/vendor/core/data/scene/camera/navigateButtons.d.ts.map +1 -0
  474. package/dist/vendor/core/data/scene/camera/navigateButtons.js +15 -0
  475. package/dist/vendor/core/data/scene/camera/navigateButtons.js.map +1 -0
  476. package/dist/vendor/core/dialogs/PageDialogHost.d.ts +5 -0
  477. package/dist/vendor/core/dialogs/PageDialogHost.d.ts.map +1 -0
  478. package/dist/vendor/core/dialogs/PageDialogHost.js +32 -0
  479. package/dist/vendor/core/dialogs/PageDialogHost.js.map +1 -0
  480. package/dist/vendor/core/model/affine.d.ts +44 -0
  481. package/dist/vendor/core/model/affine.d.ts.map +1 -0
  482. package/dist/vendor/core/model/affine.js +94 -0
  483. package/dist/vendor/core/model/affine.js.map +1 -0
  484. package/dist/vendor/core/model/glb.d.ts +75 -0
  485. package/dist/vendor/core/model/glb.d.ts.map +1 -0
  486. package/dist/vendor/core/model/glb.js +478 -0
  487. package/dist/vendor/core/model/glb.js.map +1 -0
  488. package/dist/vendor/core/model/joints.d.ts +26 -0
  489. package/dist/vendor/core/model/joints.d.ts.map +1 -0
  490. package/dist/vendor/core/model/joints.js +44 -0
  491. package/dist/vendor/core/model/joints.js.map +1 -0
  492. package/dist/vendor/core/model/motion.d.ts +65 -0
  493. package/dist/vendor/core/model/motion.d.ts.map +1 -0
  494. package/dist/vendor/core/model/motion.js +89 -0
  495. package/dist/vendor/core/model/motion.js.map +1 -0
  496. package/dist/vendor/core/model/testing.d.ts +7 -0
  497. package/dist/vendor/core/model/testing.d.ts.map +1 -0
  498. package/dist/vendor/core/model/testing.js +54 -0
  499. package/dist/vendor/core/model/testing.js.map +1 -0
  500. package/dist/vendor/core/model/units.d.ts +21 -0
  501. package/dist/vendor/core/model/units.d.ts.map +1 -0
  502. package/dist/vendor/core/model/units.js +107 -0
  503. package/dist/vendor/core/model/units.js.map +1 -0
  504. package/dist/vendor/core/model/writers.d.ts +24 -0
  505. package/dist/vendor/core/model/writers.d.ts.map +1 -0
  506. package/dist/vendor/core/model/writers.js +45 -0
  507. package/dist/vendor/core/model/writers.js.map +1 -0
  508. package/dist/vendor/core/ui/AsyncBoundary.d.ts +14 -0
  509. package/dist/vendor/core/ui/AsyncBoundary.d.ts.map +1 -0
  510. package/dist/vendor/core/ui/AsyncBoundary.js +42 -0
  511. package/dist/vendor/core/ui/AsyncBoundary.js.map +1 -0
  512. package/dist/vendor/core/ui/ChromeSurface.d.ts +16 -0
  513. package/dist/vendor/core/ui/ChromeSurface.d.ts.map +1 -0
  514. package/dist/vendor/core/ui/ChromeSurface.js +44 -0
  515. package/dist/vendor/core/ui/ChromeSurface.js.map +1 -0
  516. package/dist/vendor/core/ui/accordion.d.ts +8 -0
  517. package/dist/vendor/core/ui/accordion.d.ts.map +1 -0
  518. package/dist/vendor/core/ui/accordion.js +19 -0
  519. package/dist/vendor/core/ui/accordion.js.map +1 -0
  520. package/dist/vendor/core/ui/actionPlan.d.ts +54 -0
  521. package/dist/vendor/core/ui/actionPlan.d.ts.map +1 -0
  522. package/dist/vendor/core/ui/actionPlan.js +101 -0
  523. package/dist/vendor/core/ui/actionPlan.js.map +1 -0
  524. package/dist/vendor/core/ui/alert-dialog.d.ts +19 -0
  525. package/dist/vendor/core/ui/alert-dialog.d.ts.map +1 -0
  526. package/dist/vendor/core/ui/alert-dialog.js +50 -0
  527. package/dist/vendor/core/ui/alert-dialog.js.map +1 -0
  528. package/dist/vendor/core/ui/alert.d.ts +11 -0
  529. package/dist/vendor/core/ui/alert.d.ts.map +1 -0
  530. package/dist/vendor/core/ui/alert.js +29 -0
  531. package/dist/vendor/core/ui/alert.js.map +1 -0
  532. package/dist/vendor/core/ui/aspect-ratio.d.ts +4 -0
  533. package/dist/vendor/core/ui/aspect-ratio.d.ts.map +1 -0
  534. package/dist/vendor/core/ui/aspect-ratio.js +8 -0
  535. package/dist/vendor/core/ui/aspect-ratio.js.map +1 -0
  536. package/dist/vendor/core/ui/avatar.d.ts +12 -0
  537. package/dist/vendor/core/ui/avatar.d.ts.map +1 -0
  538. package/dist/vendor/core/ui/avatar.js +24 -0
  539. package/dist/vendor/core/ui/avatar.js.map +1 -0
  540. package/dist/vendor/core/ui/badge.d.ts +10 -0
  541. package/dist/vendor/core/ui/badge.d.ts.map +1 -0
  542. package/dist/vendor/core/ui/badge.js +26 -0
  543. package/dist/vendor/core/ui/badge.js.map +1 -0
  544. package/dist/vendor/core/ui/bento-grid.d.ts +107 -0
  545. package/dist/vendor/core/ui/bento-grid.d.ts.map +1 -0
  546. package/dist/vendor/core/ui/bento-grid.js +631 -0
  547. package/dist/vendor/core/ui/bento-grid.js.map +1 -0
  548. package/dist/vendor/core/ui/breadcrumb.d.ts +12 -0
  549. package/dist/vendor/core/ui/breadcrumb.d.ts.map +1 -0
  550. package/dist/vendor/core/ui/breadcrumb.js +29 -0
  551. package/dist/vendor/core/ui/breadcrumb.js.map +1 -0
  552. package/dist/vendor/core/ui/button-group.d.ts +12 -0
  553. package/dist/vendor/core/ui/button-group.d.ts.map +1 -0
  554. package/dist/vendor/core/ui/button-group.js +28 -0
  555. package/dist/vendor/core/ui/button-group.js.map +1 -0
  556. package/dist/vendor/core/ui/button.d.ts +24 -0
  557. package/dist/vendor/core/ui/button.d.ts.map +1 -0
  558. package/dist/vendor/core/ui/button.js +39 -0
  559. package/dist/vendor/core/ui/button.js.map +1 -0
  560. package/dist/vendor/core/ui/calendar.d.ts +9 -0
  561. package/dist/vendor/core/ui/calendar.d.ts.map +1 -0
  562. package/dist/vendor/core/ui/calendar.js +76 -0
  563. package/dist/vendor/core/ui/calendar.js.map +1 -0
  564. package/dist/vendor/core/ui/card.d.ts +12 -0
  565. package/dist/vendor/core/ui/card.d.ts.map +1 -0
  566. package/dist/vendor/core/ui/card.js +26 -0
  567. package/dist/vendor/core/ui/card.js.map +1 -0
  568. package/dist/vendor/core/ui/carousel.d.ts +29 -0
  569. package/dist/vendor/core/ui/carousel.d.ts.map +1 -0
  570. package/dist/vendor/core/ui/carousel.js +92 -0
  571. package/dist/vendor/core/ui/carousel.js.map +1 -0
  572. package/dist/vendor/core/ui/chart.d.ts +41 -0
  573. package/dist/vendor/core/ui/chart.d.ts.map +1 -0
  574. package/dist/vendor/core/ui/chart.js +132 -0
  575. package/dist/vendor/core/ui/chart.js.map +1 -0
  576. package/dist/vendor/core/ui/checkbox.d.ts +5 -0
  577. package/dist/vendor/core/ui/checkbox.d.ts.map +1 -0
  578. package/dist/vendor/core/ui/checkbox.js +10 -0
  579. package/dist/vendor/core/ui/checkbox.js.map +1 -0
  580. package/dist/vendor/core/ui/collapsible.d.ts +6 -0
  581. package/dist/vendor/core/ui/collapsible.d.ts.map +1 -0
  582. package/dist/vendor/core/ui/collapsible.js +15 -0
  583. package/dist/vendor/core/ui/collapsible.js.map +1 -0
  584. package/dist/vendor/core/ui/context-menu.d.ts +28 -0
  585. package/dist/vendor/core/ui/context-menu.d.ts.map +1 -0
  586. package/dist/vendor/core/ui/context-menu.js +55 -0
  587. package/dist/vendor/core/ui/context-menu.js.map +1 -0
  588. package/dist/vendor/core/ui/dialog.d.ts +20 -0
  589. package/dist/vendor/core/ui/dialog.d.ts.map +1 -0
  590. package/dist/vendor/core/ui/dialog.js +44 -0
  591. package/dist/vendor/core/ui/dialog.js.map +1 -0
  592. package/dist/vendor/core/ui/drawer.d.ts +14 -0
  593. package/dist/vendor/core/ui/drawer.d.ts.map +1 -0
  594. package/dist/vendor/core/ui/drawer.js +38 -0
  595. package/dist/vendor/core/ui/drawer.js.map +1 -0
  596. package/dist/vendor/core/ui/dropdown-menu.d.ts +26 -0
  597. package/dist/vendor/core/ui/dropdown-menu.d.ts.map +1 -0
  598. package/dist/vendor/core/ui/dropdown-menu.js +56 -0
  599. package/dist/vendor/core/ui/dropdown-menu.js.map +1 -0
  600. package/dist/vendor/core/ui/empty.d.ts +12 -0
  601. package/dist/vendor/core/ui/empty.d.ts.map +1 -0
  602. package/dist/vendor/core/ui/empty.js +34 -0
  603. package/dist/vendor/core/ui/empty.js.map +1 -0
  604. package/dist/vendor/core/ui/field.d.ts +25 -0
  605. package/dist/vendor/core/ui/field.d.ts.map +1 -0
  606. package/dist/vendor/core/ui/field.js +68 -0
  607. package/dist/vendor/core/ui/field.js.map +1 -0
  608. package/dist/vendor/core/ui/hover-card.d.ts +7 -0
  609. package/dist/vendor/core/ui/hover-card.d.ts.map +1 -0
  610. package/dist/vendor/core/ui/hover-card.js +19 -0
  611. package/dist/vendor/core/ui/hover-card.js.map +1 -0
  612. package/dist/vendor/core/ui/image.d.ts +10 -0
  613. package/dist/vendor/core/ui/image.d.ts.map +1 -0
  614. package/dist/vendor/core/ui/image.js +49 -0
  615. package/dist/vendor/core/ui/image.js.map +1 -0
  616. package/dist/vendor/core/ui/input-group.d.ts +17 -0
  617. package/dist/vendor/core/ui/input-group.d.ts.map +1 -0
  618. package/dist/vendor/core/ui/input-group.js +59 -0
  619. package/dist/vendor/core/ui/input-group.js.map +1 -0
  620. package/dist/vendor/core/ui/input-otp.d.ts +12 -0
  621. package/dist/vendor/core/ui/input-otp.d.ts.map +1 -0
  622. package/dist/vendor/core/ui/input-otp.js +21 -0
  623. package/dist/vendor/core/ui/input-otp.js.map +1 -0
  624. package/dist/vendor/core/ui/input.d.ts +4 -0
  625. package/dist/vendor/core/ui/input.d.ts.map +1 -0
  626. package/dist/vendor/core/ui/input.js +8 -0
  627. package/dist/vendor/core/ui/input.js.map +1 -0
  628. package/dist/vendor/core/ui/item.d.ts +24 -0
  629. package/dist/vendor/core/ui/item.d.ts.map +1 -0
  630. package/dist/vendor/core/ui/item.js +69 -0
  631. package/dist/vendor/core/ui/item.js.map +1 -0
  632. package/dist/vendor/core/ui/kbd.d.ts +4 -0
  633. package/dist/vendor/core/ui/kbd.d.ts.map +1 -0
  634. package/dist/vendor/core/ui/kbd.js +10 -0
  635. package/dist/vendor/core/ui/kbd.js.map +1 -0
  636. package/dist/vendor/core/ui/label.d.ts +5 -0
  637. package/dist/vendor/core/ui/label.d.ts.map +1 -0
  638. package/dist/vendor/core/ui/label.js +10 -0
  639. package/dist/vendor/core/ui/label.js.map +1 -0
  640. package/dist/vendor/core/ui/markdown.d.ts +19 -0
  641. package/dist/vendor/core/ui/markdown.d.ts.map +1 -0
  642. package/dist/vendor/core/ui/markdown.js +236 -0
  643. package/dist/vendor/core/ui/markdown.js.map +1 -0
  644. package/dist/vendor/core/ui/menubar.d.ts +27 -0
  645. package/dist/vendor/core/ui/menubar.d.ts.map +1 -0
  646. package/dist/vendor/core/ui/menubar.js +55 -0
  647. package/dist/vendor/core/ui/menubar.js.map +1 -0
  648. package/dist/vendor/core/ui/pagination.d.ts +14 -0
  649. package/dist/vendor/core/ui/pagination.d.ts.map +1 -0
  650. package/dist/vendor/core/ui/pagination.js +28 -0
  651. package/dist/vendor/core/ui/pagination.js.map +1 -0
  652. package/dist/vendor/core/ui/popover.d.ts +11 -0
  653. package/dist/vendor/core/ui/popover.d.ts.map +1 -0
  654. package/dist/vendor/core/ui/popover.js +31 -0
  655. package/dist/vendor/core/ui/popover.js.map +1 -0
  656. package/dist/vendor/core/ui/progress.d.ts +5 -0
  657. package/dist/vendor/core/ui/progress.d.ts.map +1 -0
  658. package/dist/vendor/core/ui/progress.js +9 -0
  659. package/dist/vendor/core/ui/progress.js.map +1 -0
  660. package/dist/vendor/core/ui/radio-group.d.ts +6 -0
  661. package/dist/vendor/core/ui/radio-group.d.ts.map +1 -0
  662. package/dist/vendor/core/ui/radio-group.js +14 -0
  663. package/dist/vendor/core/ui/radio-group.js.map +1 -0
  664. package/dist/vendor/core/ui/resizable.d.ts +9 -0
  665. package/dist/vendor/core/ui/resizable.d.ts.map +1 -0
  666. package/dist/vendor/core/ui/resizable.js +15 -0
  667. package/dist/vendor/core/ui/resizable.js.map +1 -0
  668. package/dist/vendor/core/ui/scroll-area.d.ts +6 -0
  669. package/dist/vendor/core/ui/scroll-area.d.ts.map +1 -0
  670. package/dist/vendor/core/ui/scroll-area.js +13 -0
  671. package/dist/vendor/core/ui/scroll-area.js.map +1 -0
  672. package/dist/vendor/core/ui/select.d.ts +16 -0
  673. package/dist/vendor/core/ui/select.d.ts.map +1 -0
  674. package/dist/vendor/core/ui/select.js +39 -0
  675. package/dist/vendor/core/ui/select.js.map +1 -0
  676. package/dist/vendor/core/ui/separator.d.ts +5 -0
  677. package/dist/vendor/core/ui/separator.d.ts.map +1 -0
  678. package/dist/vendor/core/ui/separator.js +10 -0
  679. package/dist/vendor/core/ui/separator.js.map +1 -0
  680. package/dist/vendor/core/ui/sheet.d.ts +17 -0
  681. package/dist/vendor/core/ui/sheet.d.ts.map +1 -0
  682. package/dist/vendor/core/ui/sheet.js +45 -0
  683. package/dist/vendor/core/ui/sheet.js.map +1 -0
  684. package/dist/vendor/core/ui/skeleton.d.ts +3 -0
  685. package/dist/vendor/core/ui/skeleton.d.ts.map +1 -0
  686. package/dist/vendor/core/ui/skeleton.js +7 -0
  687. package/dist/vendor/core/ui/skeleton.js.map +1 -0
  688. package/dist/vendor/core/ui/slider.d.ts +5 -0
  689. package/dist/vendor/core/ui/slider.d.ts.map +1 -0
  690. package/dist/vendor/core/ui/slider.js +14 -0
  691. package/dist/vendor/core/ui/slider.js.map +1 -0
  692. package/dist/vendor/core/ui/spinner.d.ts +3 -0
  693. package/dist/vendor/core/ui/spinner.d.ts.map +1 -0
  694. package/dist/vendor/core/ui/spinner.js +8 -0
  695. package/dist/vendor/core/ui/spinner.js.map +1 -0
  696. package/dist/vendor/core/ui/switch.d.ts +7 -0
  697. package/dist/vendor/core/ui/switch.d.ts.map +1 -0
  698. package/dist/vendor/core/ui/switch.js +9 -0
  699. package/dist/vendor/core/ui/switch.js.map +1 -0
  700. package/dist/vendor/core/ui/table.d.ts +11 -0
  701. package/dist/vendor/core/ui/table.d.ts.map +1 -0
  702. package/dist/vendor/core/ui/table.js +30 -0
  703. package/dist/vendor/core/ui/table.js.map +1 -0
  704. package/dist/vendor/core/ui/tabs.d.ts +12 -0
  705. package/dist/vendor/core/ui/tabs.d.ts.map +1 -0
  706. package/dist/vendor/core/ui/tabs.js +30 -0
  707. package/dist/vendor/core/ui/tabs.js.map +1 -0
  708. package/dist/vendor/core/ui/textarea.d.ts +4 -0
  709. package/dist/vendor/core/ui/textarea.d.ts.map +1 -0
  710. package/dist/vendor/core/ui/textarea.js +8 -0
  711. package/dist/vendor/core/ui/textarea.js.map +1 -0
  712. package/dist/vendor/core/ui/toggle-group.d.ts +11 -0
  713. package/dist/vendor/core/ui/toggle-group.d.ts.map +1 -0
  714. package/dist/vendor/core/ui/toggle-group.js +24 -0
  715. package/dist/vendor/core/ui/toggle-group.js.map +1 -0
  716. package/dist/vendor/core/ui/toggle.d.ts +12 -0
  717. package/dist/vendor/core/ui/toggle.d.ts.map +1 -0
  718. package/dist/vendor/core/ui/toggle.js +28 -0
  719. package/dist/vendor/core/ui/toggle.js.map +1 -0
  720. package/dist/vendor/core/ui/tooltip.d.ts +8 -0
  721. package/dist/vendor/core/ui/tooltip.d.ts.map +1 -0
  722. package/dist/vendor/core/ui/tooltip.js +21 -0
  723. package/dist/vendor/core/ui/tooltip.js.map +1 -0
  724. package/dist/vendor/core/ui/trigger-child.d.ts +17 -0
  725. package/dist/vendor/core/ui/trigger-child.d.ts.map +1 -0
  726. package/dist/vendor/core/ui/trigger-child.js +31 -0
  727. package/dist/vendor/core/ui/trigger-child.js.map +1 -0
  728. package/dist/vendor/core/util/hooks/useLatestRef.d.ts +10 -0
  729. package/dist/vendor/core/util/hooks/useLatestRef.d.ts.map +1 -0
  730. package/dist/vendor/core/util/hooks/useLatestRef.js +17 -0
  731. package/dist/vendor/core/util/hooks/useLatestRef.js.map +1 -0
  732. package/dist/vendor/core/util/utils.d.ts +8 -0
  733. package/dist/vendor/core/util/utils.d.ts.map +1 -0
  734. package/dist/vendor/core/util/utils.js +17 -0
  735. package/dist/vendor/core/util/utils.js.map +1 -0
  736. package/dist/web.d.ts +13 -0
  737. package/dist/web.d.ts.map +1 -0
  738. package/dist/web.js +14 -0
  739. package/dist/web.js.map +1 -0
  740. package/package.json +188 -4
  741. package/src/bsx/analyze.ts +65 -0
  742. package/src/bsx/bsx.test.ts +111 -0
  743. package/src/bsx/expr.ts +541 -0
  744. package/src/bsx/index.ts +8 -0
  745. package/src/bsx/infer.test.ts +149 -0
  746. package/src/bsx/infer.ts +308 -0
  747. package/src/bsx/language.test.ts +204 -0
  748. package/src/bsx/language.ts +750 -0
  749. package/src/bsx/parse.ts +848 -0
  750. package/src/bsx/partial.test.ts +88 -0
  751. package/src/bsx/partial.ts +193 -0
  752. package/src/bsx/print.ts +412 -0
  753. package/src/bsx/references.test.ts +161 -0
  754. package/src/bsx/references.ts +1155 -0
  755. package/src/bsx/source.ts +70 -0
  756. package/src/cache/keyedStore.ts +122 -0
  757. package/src/editor/BsxEditor.tsx +252 -0
  758. package/src/editor.ts +2 -0
  759. package/src/env.d.ts +5 -0
  760. package/src/index.ts +6 -0
  761. package/src/logo/CachedBlokLogo.tsx +179 -0
  762. package/src/logo/SourceLogo.tsx +52 -0
  763. package/src/logo/actionLogoSource.ts +24 -0
  764. package/src/logo/demo.ts +21 -0
  765. package/src/logo/logoCache.test.ts +75 -0
  766. package/src/logo/logoCache.ts +130 -0
  767. package/src/platform.ts +121 -0
  768. package/src/preview/CachedBlokPreview.test.tsx +63 -0
  769. package/src/preview/CachedBlokPreview.tsx +336 -0
  770. package/src/preview/previewCache.test.ts +28 -0
  771. package/src/preview/previewCache.ts +64 -0
  772. package/src/preview/queue.test.ts +40 -0
  773. package/src/preview/queue.ts +75 -0
  774. package/src/preview/snapshot.test.ts +86 -0
  775. package/src/preview/snapshot.ts +226 -0
  776. package/src/preview/snapshotMode.test.tsx +45 -0
  777. package/src/preview/snapshotMode.tsx +45 -0
  778. package/src/renderer/BlokComponentHost.tsx +151 -0
  779. package/src/renderer/BlokDebugState.tsx +50 -0
  780. package/src/renderer/BlokRenderer.test.tsx +124 -0
  781. package/src/renderer/BlokRenderer.tsx +370 -0
  782. package/src/renderer/addBlokComponents.test.tsx +62 -0
  783. package/src/renderer/assets.test.tsx +123 -0
  784. package/src/renderer/assets.tsx +174 -0
  785. package/src/renderer/baseCatalog.ts +14 -0
  786. package/src/renderer/bloks/components.test.tsx +415 -0
  787. package/src/renderer/bloks/control.tsx +412 -0
  788. package/src/renderer/bloks/data.tsx +766 -0
  789. package/src/renderer/bloks/events.test.tsx +139 -0
  790. package/src/renderer/bloks/feedback.tsx +205 -0
  791. package/src/renderer/bloks/flow.test.tsx +201 -0
  792. package/src/renderer/bloks/forms.tsx +1195 -0
  793. package/src/renderer/bloks/html.tsx +171 -0
  794. package/src/renderer/bloks/icons.tsx +308 -0
  795. package/src/renderer/bloks/index.ts +42 -0
  796. package/src/renderer/bloks/inspector/Inspector.tsx +19 -0
  797. package/src/renderer/bloks/layout.tsx +538 -0
  798. package/src/renderer/bloks/logo/index.tsx +529 -0
  799. package/src/renderer/bloks/logo/logo.fixture.json +323 -0
  800. package/src/renderer/bloks/logo/logo.test.tsx +192 -0
  801. package/src/renderer/bloks/navigation.tsx +699 -0
  802. package/src/renderer/bloks/overlays.tsx +869 -0
  803. package/src/renderer/bloks/primitives.test.tsx +307 -0
  804. package/src/renderer/bloks/run/components.tsx +212 -0
  805. package/src/renderer/bloks/run/host.tsx +63 -0
  806. package/src/renderer/bloks/run/index.ts +3 -0
  807. package/src/renderer/bloks/run/math.test.ts +81 -0
  808. package/src/renderer/bloks/run/math.ts +112 -0
  809. package/src/renderer/bloks/run/run.test.tsx +164 -0
  810. package/src/renderer/bloks/scene/Model.tsx +571 -0
  811. package/src/renderer/bloks/scene/Scene.tsx +882 -0
  812. package/src/renderer/bloks/scene/Transform.tsx +116 -0
  813. package/src/renderer/bloks/scene/animate.test.tsx +81 -0
  814. package/src/renderer/bloks/scene/bindings.tsx +432 -0
  815. package/src/renderer/bloks/scene/colour.test.ts +47 -0
  816. package/src/renderer/bloks/scene/colour.ts +56 -0
  817. package/src/renderer/bloks/scene/context.tsx +228 -0
  818. package/src/renderer/bloks/scene/embedded.test.tsx +68 -0
  819. package/src/renderer/bloks/scene/host.tsx +84 -0
  820. package/src/renderer/bloks/scene/index.ts +32 -0
  821. package/src/renderer/bloks/scene/interaction.tsx +212 -0
  822. package/src/renderer/bloks/scene/loadModel.test.ts +69 -0
  823. package/src/renderer/bloks/scene/loadModel.ts +135 -0
  824. package/src/renderer/bloks/scene/scene.fixture.json +203 -0
  825. package/src/renderer/bloks/scene/scene.test.ts +35 -0
  826. package/src/renderer/bloks/scene/scope.fixture.glb +0 -0
  827. package/src/renderer/bloks/scene/transform.test.ts +26 -0
  828. package/src/renderer/bloks/shared/index.ts +5 -0
  829. package/src/renderer/bloks/shared/props.ts +224 -0
  830. package/src/renderer/bloks/shared/render.tsx +62 -0
  831. package/src/renderer/bloks/shared/schemas.ts +215 -0
  832. package/src/renderer/bloks/shared/state.ts +96 -0
  833. package/src/renderer/bloks/shared/throttle.test.ts +50 -0
  834. package/src/renderer/bloks/shared/throttle.ts +53 -0
  835. package/src/renderer/bloks/testing.tsx +73 -0
  836. package/src/renderer/bloks/time.test.tsx +78 -0
  837. package/src/renderer/bloks/toast.test.tsx +82 -0
  838. package/src/renderer/bloks/toast.tsx +132 -0
  839. package/src/renderer/bloks/typography.tsx +265 -0
  840. package/src/renderer/bloks/unavailable.test.tsx +52 -0
  841. package/src/renderer/catalog.tsx +97 -0
  842. package/src/renderer/declarations.test.ts +72 -0
  843. package/src/renderer/declarations.ts +285 -0
  844. package/src/renderer/functions/index.ts +3 -0
  845. package/src/renderer/functions/v2/functions.test.ts +256 -0
  846. package/src/renderer/functions/v2/handler.ts +11 -0
  847. package/src/renderer/functions/v2/index.ts +638 -0
  848. package/src/renderer/modules.ts +54 -0
  849. package/src/renderer/persist.test.ts +182 -0
  850. package/src/renderer/persist.ts +320 -0
  851. package/src/renderer/persistComponent.test.tsx +68 -0
  852. package/src/renderer/runtime/checks.ts +177 -0
  853. package/src/renderer/runtime/components.tsx +311 -0
  854. package/src/renderer/runtime/context.test.ts +137 -0
  855. package/src/renderer/runtime/context.tsx +369 -0
  856. package/src/renderer/runtime/functions.ts +69 -0
  857. package/src/renderer/runtime/hooks.ts +764 -0
  858. package/src/renderer/runtime/index.ts +31 -0
  859. package/src/renderer/runtime/nodeState.ts +43 -0
  860. package/src/renderer/runtime/normalize.test.ts +154 -0
  861. package/src/renderer/runtime/normalize.ts +121 -0
  862. package/src/renderer/runtime/port.tsx +24 -0
  863. package/src/renderer/runtime/preflight.test.ts +127 -0
  864. package/src/renderer/runtime/preflight.ts +264 -0
  865. package/src/renderer/runtime/reads.test.tsx +278 -0
  866. package/src/renderer/runtime/reads.tsx +448 -0
  867. package/src/renderer/runtime/resolution.test.ts +467 -0
  868. package/src/renderer/runtime/resolution.ts +531 -0
  869. package/src/renderer/runtime/resource.ts +196 -0
  870. package/src/renderer/runtime/schemas.ts +181 -0
  871. package/src/renderer/runtime/scope.tsx +123 -0
  872. package/src/renderer/runtime/status.ts +54 -0
  873. package/src/renderer/runtime/task.test.ts +131 -0
  874. package/src/renderer/runtime/task.ts +149 -0
  875. package/src/renderer/runtime/tree.tsx +138 -0
  876. package/src/renderer/runtime/types.ts +285 -0
  877. package/src/renderer/runtime/utils.test.ts +68 -0
  878. package/src/renderer/runtime/utils.ts +67 -0
  879. package/src/renderer/runtime/viewer.tsx +21 -0
  880. package/src/renderer/unbound.test.tsx +75 -0
  881. package/src/runtime.ts +9 -0
  882. package/src/scene.ts +3 -0
  883. package/src/spec/bsx_v2.json +11380 -0
  884. package/src/spec/catalogs/base@2.json +210 -0
  885. package/src/spec/catalogs/html@1.json +308 -0
  886. package/src/spec/catalogs/logo@1.json +1673 -0
  887. package/src/spec/catalogs/scene@1.json +806 -0
  888. package/src/spec/catalogs/structure@1.json +185 -0
  889. package/src/spec/catalogs/ui@1.json +3696 -0
  890. package/src/spec/catalogs.ts +210 -0
  891. package/src/spec/locals.ts +35 -0
  892. package/src/spec/modules/orkestrator.json +2755 -0
  893. package/src/spec/spec.test.ts +87 -0
  894. package/src/spec/vocabulary.json +411 -0
  895. package/src/spec/vocabulary.ts +514 -0
  896. package/src/tailwind/defaultTheme.ts +3 -0
  897. package/src/tailwind/runtimeTailwind.test.ts +86 -0
  898. package/src/tailwind/runtimeTailwind.ts +137 -0
  899. package/src/tailwind/theme.css +137 -0
  900. package/src/tailwind/useBlokTailwind.test.tsx +52 -0
  901. package/src/tailwind/useBlokTailwind.ts +84 -0
  902. package/src/tailwind.ts +3 -0
  903. package/src/vendor/core/data/scene/camera/navigateButtons.ts +15 -0
  904. package/src/vendor/core/dialogs/PageDialogHost.tsx +42 -0
  905. package/src/vendor/core/model/affine.ts +117 -0
  906. package/src/vendor/core/model/glb.ts +580 -0
  907. package/src/vendor/core/model/joints.ts +65 -0
  908. package/src/vendor/core/model/model.test.ts +241 -0
  909. package/src/vendor/core/model/motion.ts +134 -0
  910. package/src/vendor/core/model/testing.ts +57 -0
  911. package/src/vendor/core/model/units.ts +112 -0
  912. package/src/vendor/core/model/writers.ts +62 -0
  913. package/src/vendor/core/ui/AsyncBoundary.tsx +96 -0
  914. package/src/vendor/core/ui/ChromeSurface.tsx +51 -0
  915. package/src/vendor/core/ui/accordion.tsx +79 -0
  916. package/src/vendor/core/ui/actionPlan.ts +150 -0
  917. package/src/vendor/core/ui/alert-dialog.tsx +201 -0
  918. package/src/vendor/core/ui/alert.tsx +72 -0
  919. package/src/vendor/core/ui/aspect-ratio.tsx +11 -0
  920. package/src/vendor/core/ui/avatar.tsx +104 -0
  921. package/src/vendor/core/ui/badge.tsx +45 -0
  922. package/src/vendor/core/ui/bento-grid.tsx +818 -0
  923. package/src/vendor/core/ui/breadcrumb.tsx +119 -0
  924. package/src/vendor/core/ui/button-group.tsx +83 -0
  925. package/src/vendor/core/ui/button.tsx +82 -0
  926. package/src/vendor/core/ui/calendar.tsx +214 -0
  927. package/src/vendor/core/ui/card.tsx +94 -0
  928. package/src/vendor/core/ui/carousel.tsx +240 -0
  929. package/src/vendor/core/ui/chart.tsx +354 -0
  930. package/src/vendor/core/ui/checkbox.tsx +31 -0
  931. package/src/vendor/core/ui/collapsible.tsx +36 -0
  932. package/src/vendor/core/ui/context-menu.tsx +239 -0
  933. package/src/vendor/core/ui/dialog.tsx +165 -0
  934. package/src/vendor/core/ui/drawer.tsx +119 -0
  935. package/src/vendor/core/ui/dropdown-menu.tsx +250 -0
  936. package/src/vendor/core/ui/empty.tsx +99 -0
  937. package/src/vendor/core/ui/field.tsx +220 -0
  938. package/src/vendor/core/ui/hover-card.tsx +53 -0
  939. package/src/vendor/core/ui/image.tsx +70 -0
  940. package/src/vendor/core/ui/input-group.tsx +144 -0
  941. package/src/vendor/core/ui/input-otp.tsx +85 -0
  942. package/src/vendor/core/ui/input.tsx +19 -0
  943. package/src/vendor/core/ui/item.tsx +187 -0
  944. package/src/vendor/core/ui/kbd.tsx +26 -0
  945. package/src/vendor/core/ui/label.tsx +24 -0
  946. package/src/vendor/core/ui/markdown.tsx +398 -0
  947. package/src/vendor/core/ui/menubar.tsx +248 -0
  948. package/src/vendor/core/ui/pagination.tsx +132 -0
  949. package/src/vendor/core/ui/popover.tsx +96 -0
  950. package/src/vendor/core/ui/progress.tsx +29 -0
  951. package/src/vendor/core/ui/radio-group.tsx +45 -0
  952. package/src/vendor/core/ui/resizable.tsx +51 -0
  953. package/src/vendor/core/ui/scroll-area.tsx +55 -0
  954. package/src/vendor/core/ui/select.tsx +185 -0
  955. package/src/vendor/core/ui/separator.tsx +28 -0
  956. package/src/vendor/core/ui/sheet.tsx +139 -0
  957. package/src/vendor/core/ui/skeleton.tsx +13 -0
  958. package/src/vendor/core/ui/slider.tsx +57 -0
  959. package/src/vendor/core/ui/spinner.tsx +10 -0
  960. package/src/vendor/core/ui/switch.tsx +31 -0
  961. package/src/vendor/core/ui/table.tsx +95 -0
  962. package/src/vendor/core/ui/tabs.tsx +88 -0
  963. package/src/vendor/core/ui/textarea.tsx +18 -0
  964. package/src/vendor/core/ui/toggle-group.tsx +87 -0
  965. package/src/vendor/core/ui/toggle.tsx +46 -0
  966. package/src/vendor/core/ui/tooltip.tsx +64 -0
  967. package/src/vendor/core/ui/trigger-child.ts +35 -0
  968. package/src/vendor/core/util/hooks/useLatestRef.ts +17 -0
  969. package/src/vendor/core/util/utils.ts +18 -0
  970. package/src/web.ts +13 -0
@@ -0,0 +1,1155 @@
1
+ import type {
2
+ BlokActionArgument,
3
+ BlokAgentCall,
4
+ BlokComponentNode,
5
+ BlokComponentProp,
6
+ BlokUtilCall,
7
+ } from '../renderer/runtime/types';
8
+ import {defaultBlokView, type BlokView, type SpecComponent} from '../spec/catalogs';
9
+ import {valueFitsPort} from '../spec/locals';
10
+ import {LOCAL_ANY, resolveBlokScope} from './infer';
11
+ import {
12
+ argFits,
13
+ finding,
14
+ loadVocabulary,
15
+ type BlokFinding,
16
+ type BlokKind,
17
+ type BlokVocabulary,
18
+ type DiagnosticFields,
19
+ type VocabRecordField,
20
+ } from '../spec/vocabulary';
21
+
22
+ /**
23
+ * The v2 validator: a blok's tree against what it declares, its kind, and the
24
+ * catalogs that draw it. The port of arkitekt-spec's
25
+ * `declare/blok/validate.py` (with `walk.py`), held to the `checked` cases of
26
+ * the corpus (`core/blok/spec/bsx_v2.json`). The server runs the same rules on
27
+ * save; here they mark the source while the author types.
28
+ *
29
+ * Every rule is a row of the vocabulary's diagnostic table, driven by its
30
+ * data: the one reserved list, the per-kind root matrix, the record shapes,
31
+ * the function signatures and the theme.
32
+ */
33
+
34
+ /* -------------------------------------------------------------------------- */
35
+ /* The scope: the corpus' `scope` shape */
36
+ /* -------------------------------------------------------------------------- */
37
+
38
+ /** A port match, as the server's `PortMatchInput` spells it (snake_case, nulls allowed). */
39
+ export type BlokPortMatch = {
40
+ key?: string | null;
41
+ kind?: string | null;
42
+ identifier?: string | null;
43
+ nullable?: boolean | null;
44
+ children?: readonly BlokPortMatch[] | null;
45
+ };
46
+
47
+ export type BlokScopeActionDependency = {
48
+ key: string;
49
+ demand?: {arg_matches?: readonly BlokPortMatch[] | null; return_matches?: readonly BlokPortMatch[] | null} | null;
50
+ };
51
+
52
+ export type BlokScopeStateDependency = {
53
+ key: string;
54
+ demand?: {matches?: readonly BlokPortMatch[] | null} | null;
55
+ };
56
+
57
+ /** A dependency of the blok; `self` types `self`. No `*_dependencies` (null) means any. */
58
+ export type BlokScopeDependency = {
59
+ key: string;
60
+ action_dependencies?: readonly BlokScopeActionDependency[] | null;
61
+ state_dependencies?: readonly BlokScopeStateDependency[] | null;
62
+ };
63
+
64
+ /** A choice a local's port offers. */
65
+ export type BlokScopeLocalChoice = {value: unknown; label?: string | null; description?: string | null};
66
+
67
+ /** A local's port (an `ArgPortInput`): what it holds, its fields for a dict or model, its item for a list. */
68
+ export type BlokScopeLocalPort = {
69
+ key: string;
70
+ kind: string;
71
+ identifier?: string | null;
72
+ nullable?: boolean | null;
73
+ default?: unknown;
74
+ children?: readonly BlokScopeLocalPort[] | null;
75
+ choices?: readonly BlokScopeLocalChoice[] | null;
76
+ label?: string | null;
77
+ description?: string | null;
78
+ };
79
+
80
+ /**
81
+ * A local (vocabulary `locals`): an arg port plus `persist`. Its kind is a
82
+ * port kind or `ANY`; left out (absent or null), it is inferred from the tree
83
+ * (`resolveBlokScope`), and a given kind, `ANY` included, is kept.
84
+ */
85
+ export type BlokScopeLocal = Omit<BlokScopeLocalPort, 'kind'> & {kind?: string | null; persist?: boolean | null};
86
+
87
+ /** A local after inference: its kind always said. */
88
+ export type ResolvedBlokLocal = BlokScopeLocalPort & {persist?: boolean | null};
89
+
90
+ export type BlokScopeQuery = {
91
+ key: string;
92
+ service?: string | null;
93
+ document?: string | null;
94
+ /** The variables, as stored arguments (`parseBsxArgument`). */
95
+ variables?: readonly BlokActionArgument[] | null;
96
+ poll?: number | null;
97
+ /** The list field `fetch_more` appends to; a query without it cannot fetch more. */
98
+ more?: string | null;
99
+ };
100
+
101
+ export type BlokScopeSubscription = {
102
+ key: string;
103
+ service?: string | null;
104
+ document?: string | null;
105
+ variables?: readonly BlokActionArgument[] | null;
106
+ keep?: number | null;
107
+ history?: string | null;
108
+ };
109
+
110
+ /** What a blok declares beside its tree; the corpus' `scope` verbatim. */
111
+ export type BlokCheckScope = {
112
+ kind: BlokKind;
113
+ /** `HTML`, `SCENE`, `OVERLAY`, `LOGO`, or `ACTION_LOGO` (drawn as a logo). */
114
+ context: string;
115
+ dependencies: readonly BlokScopeDependency[];
116
+ locals: readonly BlokScopeLocal[];
117
+ queries: readonly BlokScopeQuery[];
118
+ subscriptions: readonly BlokScopeSubscription[];
119
+ /** The keys `args.<key>` may read; null reads any. */
120
+ args: readonly string[] | null;
121
+ /** The standard catalogs the blok declares (`ui@1`); none declared checks none. */
122
+ catalogs: readonly string[];
123
+ /** The module (an app's own extras) the blok names, if any. */
124
+ module?: string | null;
125
+ /** Per declared query, the shape of its value when its service's schema is known. */
126
+ query_values?: Readonly<Record<string, BlokPortMatch>>;
127
+ /** The assets `self.assets.<name>` may name; null (or absent) names any. */
128
+ assets?: readonly string[] | null;
129
+ /** Preview data, for the logo's foreach limit. */
130
+ demo?: {deps?: unknown; args?: unknown; task?: unknown} | null;
131
+ };
132
+
133
+ /** A scope after inference: every local kinded (dependencies are never inferred). */
134
+ export type ResolvedBlokScope = Omit<BlokCheckScope, 'locals'> & {locals: readonly ResolvedBlokLocal[]};
135
+
136
+ export const emptyBlokScope = (kind: BlokKind = 'agent', context = 'HTML'): BlokCheckScope => ({
137
+ kind,
138
+ context,
139
+ dependencies: [],
140
+ locals: [],
141
+ queries: [],
142
+ subscriptions: [],
143
+ args: null,
144
+ catalogs: [],
145
+ });
146
+
147
+ const ACTION_LOGO = 'ACTION_LOGO';
148
+ const LOGO = 'LOGO';
149
+ const SCENE = 'SCENE';
150
+
151
+ /** The context a scope's components are drawn in: an action logo's is a logo's. */
152
+ export const drawnIn = (scope: BlokCheckScope): string => (scope.context === ACTION_LOGO ? LOGO : scope.context);
153
+
154
+ /** The root component a blok of ``context`` starts with (`HTML` → `Html`): a blok's root names its context. */
155
+ export const blokRootOf = (context: string): string | null =>
156
+ Object.entries(loadVocabulary().blokRoots).find(([, named]) => named === context)?.[0] ?? null;
157
+
158
+ /** The blok context a root component names (`Overlay` → `OVERLAY`), or null when it names none. */
159
+ export const blokContextOf = (component: string): string | null => loadVocabulary().blokRoots[component] ?? null;
160
+
161
+ /* -------------------------------------------------------------------------- */
162
+ /* Matches */
163
+ /* -------------------------------------------------------------------------- */
164
+
165
+ const OPEN_IDENTIFIER = '*';
166
+ const ITEM = '...';
167
+ const TOAST_COMPONENT = 'Toast';
168
+ const TOAST_TASK_PROP = 'task';
169
+ const CLASS_NAME = 'className';
170
+ const FOREACH = 'foreach';
171
+ const FOREACH_LET = 'let';
172
+ const FOREACH_ITEMS = 'items';
173
+ const FOREACH_KEY = 'key';
174
+ /** An item of these kinds is no scalar: a foreach over it without key is keyed by position (`foreach.position_key`). */
175
+ const COMPOUND_KINDS: ReadonlySet<string> = new Set(['DICT', 'MODEL', 'LIST', 'UNION']);
176
+ const RETURNS_FIELD = 'returns';
177
+ const UNNAMED_RETURN = /^return[0-9]+$/;
178
+ const SUSPENSE = 'suspense';
179
+ const ERROR_SLOT = 'error';
180
+ const WHEN_PROP = 'when';
181
+ const BIND_PROP = 'bind';
182
+ const CALLBACK_KIND = 'CALLBACK';
183
+ const ASSET_KIND = 'ASSET';
184
+ const REFETCH_FUNCTION = 'query.refetch';
185
+ const FETCH_MORE_FUNCTION = 'query.fetch_more';
186
+ /** Per query effect, the method BSX writes it as. */
187
+ const VERBS: Readonly<Record<string, string>> = {[REFETCH_FUNCTION]: 'refetch', [FETCH_MORE_FUNCTION]: 'fetch_more'};
188
+ /** Port kinds whose fields the port does not declare: a path below such a local is taken as written. */
189
+ const OPAQUE_KINDS: ReadonlySet<string> = new Set(['STRUCTURE', 'MEMORY_STRUCTURE', 'INTERFACE', 'UNION']);
190
+ const LITERAL_KINDS: readonly string[] = ['BOOL', 'INT', 'FLOAT'];
191
+
192
+ type Match = BlokPortMatch | null;
193
+
194
+ const openMatch = (key: string | null): BlokPortMatch => ({key, identifier: OPEN_IDENTIFIER});
195
+ const isOpen = (match: Match): boolean => match !== null && match.identifier === OPEN_IDENTIFIER;
196
+
197
+ const recordMatch = (
198
+ key: string,
199
+ fields: readonly VocabRecordField[],
200
+ overrides?: Readonly<Record<string, BlokPortMatch>>,
201
+ ): BlokPortMatch => ({
202
+ key,
203
+ kind: 'DICT',
204
+ children: fields.map(field => {
205
+ const override = overrides?.[field.key];
206
+ if (override) return {...override, key: field.key};
207
+ if (field.children) return {...recordMatch(field.key, field.children), nullable: field.nullable || null};
208
+ if (field.kind === 'DICT' || field.kind === 'ANY' || field.kind === 'LIST') return openMatch(field.key);
209
+ return {key: field.key, kind: field.kind, nullable: field.nullable || null};
210
+ }),
211
+ });
212
+
213
+ const taskRecordMatch = (key: string, returns?: readonly BlokPortMatch[] | null): BlokPortMatch =>
214
+ recordMatch(
215
+ key,
216
+ loadVocabulary().records.task.fields,
217
+ returns && returns.length ? {returns: {key: 'returns', kind: 'DICT', children: returns}} : undefined,
218
+ );
219
+
220
+ /* -------------------------------------------------------------------------- */
221
+ /* Walking */
222
+ /* -------------------------------------------------------------------------- */
223
+
224
+ /** Where a value sits: the node, the prop, and which scoped roots are in force there. */
225
+ type Where = {node: BlokComponentNode; key: string; callback: boolean; inError: boolean};
226
+
227
+ const whereText = (where: Where): string => `${where.key} of <${where.node.component}> (${where.node.id})`;
228
+ const nodeContext = (node: BlokComponentNode): string => `<${node.component}> (${node.id})`;
229
+ const actionKeyFor = (call: BlokAgentCall): string => call.operation.split('.').pop() ?? call.operation;
230
+
231
+ const isEffect = (call: BlokUtilCall): boolean => loadVocabulary().functions.get(call.operation)?.effect === true;
232
+
233
+ /** Whether a prop holds a callback's one thing: a task call or an effect (`query.refetch` too). */
234
+ export const isCallbackValue = (prop: BlokComponentProp): boolean =>
235
+ prop.agent_call != null || (prop.util_call != null && isEffect(prop.util_call));
236
+
237
+ /** A local's port as a match: its kind, identifier and fields. */
238
+ const portMatch = (port: BlokScopeLocalPort): BlokPortMatch => ({
239
+ key: port.key,
240
+ kind: port.kind,
241
+ identifier: port.identifier ?? null,
242
+ nullable: port.nullable ?? null,
243
+ children: port.children?.length ? port.children.map(portMatch) : null,
244
+ });
245
+
246
+ /** Every name a task call writes its record to (`... into move`), with each call site. */
247
+ export const intoSites = (node: BlokComponentNode): Map<string, Array<{call: BlokAgentCall; site: string}>> => {
248
+ const found = new Map<string, Array<{call: BlokAgentCall; site: string}>>();
249
+ const visit = (current: BlokComponentNode) => {
250
+ for (const prop of current.props ?? []) {
251
+ if (prop.agent_call && prop.declares_value) {
252
+ const sites = found.get(prop.declares_value) ?? [];
253
+ sites.push({call: prop.agent_call, site: `${prop.key} of ${nodeContext(current)}`});
254
+ found.set(prop.declares_value, sites);
255
+ }
256
+ }
257
+ current.children?.forEach(visit);
258
+ };
259
+ visit(node);
260
+ return found;
261
+ };
262
+
263
+ /** The loop variable a `foreach` declares. */
264
+ export const foreachLet = (node: BlokComponentNode): string | null => {
265
+ if (node.component !== FOREACH) return null;
266
+ return node.props?.find(prop => prop.key === FOREACH_LET && prop.declares_value)?.declares_value ?? null;
267
+ };
268
+
269
+ const iterNodes = (node: BlokComponentNode): BlokComponentNode[] => [node, ...(node.children ?? []).flatMap(iterNodes)];
270
+
271
+ /** Every path a list of arguments reads (a query's variables), depth first. */
272
+ const argumentPaths = (args: readonly BlokActionArgument[]): string[] => {
273
+ const paths: string[] = [];
274
+ const visit = (argument: BlokActionArgument) => {
275
+ if (argument.value_path != null) paths.push(argument.value_path);
276
+ for (const call of [argument.util_call, argument.agent_call]) call?.arguments?.forEach(visit);
277
+ [...(argument.value_list ?? []), ...(argument.value_dict ?? [])].forEach(visit);
278
+ };
279
+ args.forEach(visit);
280
+ return paths;
281
+ };
282
+
283
+ type Scope = ReadonlyMap<string, Match>;
284
+
285
+ /* -------------------------------------------------------------------------- */
286
+ /* The checker */
287
+ /* -------------------------------------------------------------------------- */
288
+
289
+ const escapeRegExp = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
290
+
291
+ const colourPattern = (vocabulary: BlokVocabulary): RegExp => {
292
+ const utilities = [...vocabulary.theme.colourUtilities].sort((a, b) => b.length - a.length).map(escapeRegExp).join('|');
293
+ const colours = vocabulary.theme.paletteColours.join('|');
294
+ return new RegExp(`^(?<utility>${utilities})-(?<colour>${colours})(?:-(?<shade>\\d{2,3}))?(?:/\\d+)?$`);
295
+ };
296
+
297
+ const ARBITRARY_COLOUR = /^(?<utility>bg|text|border|ring|fill|stroke|from|via|to|outline|decoration|shadow)-\[(#|rgb|hsl|oklch|color)/;
298
+ const DIGITS = /^[0-9]+$/;
299
+
300
+ /**
301
+ * What a blok of `kind` that reads an undeclared `deps.<key>` does about it
302
+ * (the spec's `dependency_hint`):
303
+ * - a custom or task blok declares it, to copy as it is: `dependencies=[AgentDependencyInput(key="laser")]`;
304
+ * - an action blok's dependencies are its action's: ``add a dependency parameter `laser` to the action``;
305
+ * - an agent blok has none: ``agent bloks read only `self` ``.
306
+ */
307
+ export const dependencyHint = (key: string, kind: BlokKind): string => {
308
+ if (kind === 'action' || kind === 'action_logo') return `add a dependency parameter \`${key}\` to the action`;
309
+ if (kind === 'agent') return 'agent bloks read only `self`';
310
+ return `dependencies=[AgentDependencyInput(key="${key}")]`;
311
+ };
312
+
313
+ /** How a string on a typed prop is written as the literal it meant (`fullWidth={true}`): the spec's `literal_hint`. */
314
+ export const literalHint = (key: string, value: string, kind: string): string => {
315
+ const written = value.trim();
316
+ let literal: string;
317
+ if (kind === 'BOOL') {
318
+ const lower = written.toLowerCase();
319
+ literal = lower === 'true' || lower === 'false' ? lower : 'true';
320
+ } else {
321
+ const parsed = written === '' ? Number.NaN : Number(written);
322
+ const number = Number.isFinite(parsed) ? parsed : 0;
323
+ if (kind === 'INT') literal = String(Math.trunc(number));
324
+ else literal = Number.isInteger(number) && !written.includes('.') ? String(Math.trunc(number)) : pythonFloat(number);
325
+ }
326
+ return `${key}={${literal}}`;
327
+ };
328
+
329
+ /** A float as Python's `repr` writes it (`1.0`, `0.5`, `1e+20`). */
330
+ const pythonFloat = (value: number): string => {
331
+ if (Number.isInteger(value) && Math.abs(value) < 1e16) return `${value}.0`;
332
+ return String(value);
333
+ };
334
+
335
+ const article = (kind: string): string => ('aeiou'.includes(kind[0] ?? '') ? 'n' : '');
336
+
337
+ const pythonRepr = (value: unknown): string => {
338
+ if (typeof value === 'string') return `'${value}'`;
339
+ if (value === null || value === undefined) return 'None';
340
+ if (value === true) return 'True';
341
+ if (value === false) return 'False';
342
+ return JSON.stringify(value);
343
+ };
344
+
345
+ const what = (prop: BlokComponentProp): string => {
346
+ if (prop.agent_call) return 'a task call';
347
+ if (prop.util_call) return prop.util_call.operation;
348
+ if (prop.dynamic_value) return `the path ${prop.dynamic_value.path ?? ''}`;
349
+ return `the value ${pythonRepr(prop.static_value)}`;
350
+ };
351
+
352
+ /** Every literal string of a `str.classes` call: list entries, object keys, branches. */
353
+ const classLiterals = (call: BlokUtilCall): string[] => {
354
+ const literals: string[] = [];
355
+ const visit = (args: readonly BlokActionArgument[]) => {
356
+ for (const argument of args) {
357
+ if (typeof argument.value_literal === 'string') literals.push(argument.value_literal);
358
+ for (const nested of argument.value_dict ?? []) if (nested.key) literals.push(nested.key);
359
+ if (argument.util_call) visit(argument.util_call.arguments ?? []);
360
+ visit(argument.value_list ?? []);
361
+ }
362
+ };
363
+ visit(call.arguments ?? []);
364
+ return literals;
365
+ };
366
+
367
+ const stateMatch = (state: BlokScopeStateDependency): BlokPortMatch => ({
368
+ key: state.key,
369
+ kind: 'DICT',
370
+ children: state.demand?.matches ?? null,
371
+ });
372
+
373
+ const argumentWhat = (argument: BlokActionArgument): string => {
374
+ if (argument.value_path != null) return `the path ${argument.value_path}`;
375
+ if (argument.util_call) return `a call of ${argument.util_call.operation}`;
376
+ if (argument.value_list != null || argument.value_dict != null) return 'a list or object';
377
+ return `the value ${pythonRepr(argument.value_literal)}`;
378
+ };
379
+
380
+ class Checker {
381
+ readonly findings: BlokFinding[] = [];
382
+ private readonly vocabulary = loadVocabulary();
383
+ private readonly kind;
384
+ private readonly dependencies: Map<string, BlokScopeDependency>;
385
+ private readonly locals: Map<string, ResolvedBlokLocal>;
386
+ private readonly queries: Map<string, BlokScopeQuery>;
387
+ private readonly subscriptions: Map<string, BlokScopeSubscription>;
388
+ private readonly boundLocals = new Set<string>();
389
+ private readonly into = new Set<string>();
390
+ private readonly shadowed = new Set<string>();
391
+ private readonly colour: RegExp;
392
+
393
+ readonly scope: ResolvedBlokScope;
394
+ readonly view: BlokView | null;
395
+
396
+ constructor(
397
+ scope: ResolvedBlokScope,
398
+ view: BlokView | null,
399
+ ) {
400
+ this.scope = scope;
401
+ this.view = view;
402
+ this.kind = this.vocabulary.kinds[scope.kind];
403
+ this.dependencies = new Map(scope.dependencies.map(dependency => [dependency.key, dependency]));
404
+ this.locals = new Map(scope.locals.map(local => [local.key, local]));
405
+ this.queries = new Map(scope.queries.map(query => [query.key, query]));
406
+ this.subscriptions = new Map(scope.subscriptions.map(subscription => [subscription.key, subscription]));
407
+ this.colour = colourPattern(this.vocabulary);
408
+ }
409
+
410
+ add(code: string, nodeId: string | null, fields: DiagnosticFields = {}, propKey?: string): void {
411
+ this.findings.push(finding(code, fields, {...(nodeId !== null ? {nodeId} : {}), ...(propKey !== undefined ? {propKey} : {})}));
412
+ }
413
+
414
+ private rootsText(): string {
415
+ return [...this.kind.roots].sort().join(', ');
416
+ }
417
+
418
+ private notInKind(nodeId: string | null, path: string, root: string, propKey?: string): void {
419
+ this.add('roots.not_in_kind', nodeId, {path, n: article(this.scope.kind), kind: this.scope.kind, root, roots: this.rootsText()}, propKey);
420
+ }
421
+
422
+ /* -- declarations -- */
423
+
424
+ checkDeclarations(tree: BlokComponentNode): void {
425
+ const {vocabulary, scope} = this;
426
+ const drawn = drawnIn(scope);
427
+ const wrongLogo = (scope.context === ACTION_LOGO) !== (scope.kind === 'action_logo');
428
+ if (wrongLogo || !(this.kind.contexts as readonly string[]).includes(drawn)) {
429
+ this.add('context.kind', null, {n: article(scope.kind), kind: scope.kind, contexts: this.kind.contexts.join(', '), context: scope.context});
430
+ }
431
+ const root = blokRootOf(scope.context);
432
+ if (root && tree.component !== root) {
433
+ this.add('context.root', tree.id, {context: scope.context.toLowerCase(), root, component: tree.component});
434
+ }
435
+ if (scope.locals.length && !this.kind.locals) this.notInKind(null, 'locals', 'locals');
436
+ for (const local of scope.locals) {
437
+ if (vocabulary.reserved.has(local.key)) this.add('roots.reserved', `locals.${local.key}`, {name: local.key});
438
+ this.checkLocalDefault(local);
439
+ }
440
+ for (const [name, sites] of intoSites(tree)) {
441
+ this.into.add(name);
442
+ if (vocabulary.reserved.has(name)) this.add('roots.reserved', sites[0].site, {name});
443
+ if (this.locals.has(name)) this.add('roots.shadow', sites[0].site, {name, first: 'a local', second: `the record of ${sites[0].site}`});
444
+ if (sites.length > 1) this.add('into.twice', sites[1].site, {name, first: sites[0].site, second: sites[1].site});
445
+ }
446
+ for (const node of iterNodes(tree)) {
447
+ const declared = foreachLet(node);
448
+ if (declared === null) continue;
449
+ if (vocabulary.reserved.has(declared)) this.add('roots.reserved', node.id, {name: declared});
450
+ else if (this.locals.has(declared) || this.into.has(declared)) {
451
+ this.add('roots.shadow', node.id, {
452
+ name: declared,
453
+ first: this.locals.has(declared) ? 'a local' : "a call's record",
454
+ second: `the let of <foreach> (${node.id})`,
455
+ });
456
+ }
457
+ }
458
+ for (const query of scope.queries) {
459
+ for (const path of argumentPaths(query.variables ?? [])) this.resolve(path, null, new Map(), `query ${query.key}`);
460
+ }
461
+ for (const subscription of scope.subscriptions) {
462
+ for (const path of argumentPaths(subscription.variables ?? [])) this.resolve(path, null, new Map(), `subscription ${subscription.key}`);
463
+ if (subscription.history != null && !this.queries.has(subscription.history)) {
464
+ this.add('query.history', `subscriptions.${subscription.key}`, {name: subscription.key, history: subscription.history});
465
+ }
466
+ }
467
+ }
468
+
469
+ /** A local's default fits its port: a number for a number, a list for a list, one of its choices. */
470
+ private checkLocalDefault(local: ResolvedBlokLocal): void {
471
+ if (local.kind === LOCAL_ANY) return;
472
+ if (!valueFitsPort(local.default, local)) {
473
+ this.add('local.default', `locals.${local.key}`, {name: local.key, default: local.default, kind: local.kind});
474
+ }
475
+ }
476
+
477
+ /** The port a path into a local names (the local, or a field of it), or null when its shape does not say (an ANY local). */
478
+ private localPort(path: string): BlokScopeLocalPort | null {
479
+ const [root, ...rest] = path.split('.');
480
+ const local = this.locals.get(root) ?? null;
481
+ let port: BlokScopeLocalPort | null = local !== null && local.kind !== LOCAL_ANY ? local : null;
482
+ for (const part of rest) {
483
+ if (port === null) return null;
484
+ const children: readonly BlokScopeLocalPort[] = port.children ?? [];
485
+ let child = children.find(candidate => candidate.key === part) ?? null;
486
+ if (!child && children.length === 1 && children[0].key === ITEM) child = children[0];
487
+ port = child;
488
+ }
489
+ return port;
490
+ }
491
+
492
+ finish(): void {
493
+ for (const local of this.scope.locals) {
494
+ if (local.persist && !this.boundLocals.has(local.key)) this.add('local.unused_persist', `locals.${local.key}`, {name: local.key});
495
+ }
496
+ }
497
+
498
+ /* -- the walk -- */
499
+
500
+ walk(tree: BlokComponentNode): void {
501
+ const scope = new Map<string, Match>();
502
+ for (const [name, sites] of intoSites(tree)) scope.set(name, this.bindInto(sites[0].call));
503
+ this.walkNode(tree, scope, [], false);
504
+ }
505
+
506
+ private walkNode(node: BlokComponentNode, scope: Scope, ancestors: readonly BlokComponentNode[], inError: boolean): void {
507
+ this.visitComponent(node, ancestors);
508
+ const inner = new Map(scope);
509
+ const declared = foreachLet(node);
510
+ if (declared !== null) {
511
+ const items = node.props?.find(prop => prop.key === FOREACH_ITEMS) ?? null;
512
+ inner.set(declared, this.bindLet(declared, items, {node, key: FOREACH_ITEMS, callback: false, inError}, scope));
513
+ }
514
+ for (const prop of node.props ?? []) {
515
+ // A foreach reads its items outside the loop, its key inside it.
516
+ const propScope = declared !== null && prop.key === FOREACH_ITEMS ? scope : inner;
517
+ this.walkProp(node, prop, propScope, inError);
518
+ }
519
+ const inSlot = inError || (node.component === ERROR_SLOT && ancestors.length > 0 && ancestors[ancestors.length - 1].component === SUSPENSE);
520
+ for (const child of node.children ?? []) this.walkNode(child, inner, [...ancestors, node], inSlot);
521
+ }
522
+
523
+ private walkProp(node: BlokComponentNode, prop: BlokComponentProp, scope: Scope, inError: boolean): void {
524
+ const where: Where = {node, key: prop.key, callback: isCallbackValue(prop), inError};
525
+ if (prop.dynamic_value?.path != null) this.resolve(prop.dynamic_value.path, where, scope, whereText(where));
526
+ if (prop.agent_call) {
527
+ this.visitAgentCall(prop.agent_call, where, scope);
528
+ prop.agent_call.arguments?.forEach(argument => this.walkArgument(argument, scope, where));
529
+ }
530
+ if (prop.util_call) this.walkUtil(prop.util_call, scope, where, true);
531
+ }
532
+
533
+ private walkUtil(call: BlokUtilCall, scope: Scope, where: Where, top: boolean): void {
534
+ this.visitUtilCall(call, where, top);
535
+ call.arguments?.forEach(argument => this.walkArgument(argument, scope, where));
536
+ }
537
+
538
+ private walkArgument(argument: BlokActionArgument, scope: Scope, where: Where): void {
539
+ if (argument.value_path != null) this.resolve(argument.value_path, where, scope, whereText(where));
540
+ if (argument.agent_call) {
541
+ this.visitAgentCall(argument.agent_call, where, scope);
542
+ argument.agent_call.arguments?.forEach(nested => this.walkArgument(nested, scope, where));
543
+ }
544
+ if (argument.util_call) this.walkUtil(argument.util_call, scope, where, false);
545
+ [...(argument.value_list ?? []), ...(argument.value_dict ?? [])].forEach(nested => this.walkArgument(nested, scope, where));
546
+ }
547
+
548
+ /* -- components and props -- */
549
+
550
+ private visitComponent(node: BlokComponentNode, ancestors: readonly BlokComponentNode[]): void {
551
+ const spec = this.view?.components.get(node.component);
552
+ if (this.view && !spec && this.view.complete) {
553
+ this.add('catalog.unknown_component', node.id, {component: node.component, catalogs: this.view.label});
554
+ }
555
+ if (spec) this.checkCatalog(node, spec, ancestors);
556
+ const shadow = this.view?.shadows.get(node.component);
557
+ if (shadow && !this.shadowed.has(node.component)) {
558
+ this.shadowed.add(node.component);
559
+ this.add('catalog.shadow', node.id, {component: node.component, catalog: shadow.catalog, module: shadow.module, winner: shadow.winner});
560
+ }
561
+ for (const prop of node.props ?? []) this.checkProp(node, prop, spec);
562
+ }
563
+
564
+ private checkCatalog(node: BlokComponentNode, spec: SpecComponent, ancestors: readonly BlokComponentNode[]): void {
565
+ const view = this.view;
566
+ if (!view) return;
567
+ if (node.children?.length && !spec.acceptsChildren) this.add('catalog.children', node.id, {component: node.component});
568
+ const present = new Set((node.props ?? []).map(prop => prop.key));
569
+ const known = new Set([...spec.props.map(prop => prop.key), WHEN_PROP]);
570
+ const unknown = [...present].filter(key => !known.has(key)).sort();
571
+ if (unknown.length) this.add('catalog.props', node.id, {component: node.component, detail: `has no props [${unknown.map(pythonRepr).join(', ')}]`});
572
+ const missing = spec.props.filter(prop => prop.required && !present.has(prop.key)).map(prop => prop.key).sort();
573
+ if (missing.length) this.add('catalog.props', node.id, {component: node.component, detail: `requires props [${missing.map(pythonRepr).join(', ')}]`});
574
+ let context = 'HTML';
575
+ for (const ancestor of ancestors) {
576
+ const above = view.components.get(ancestor.component);
577
+ if (above && !above.inheritsContext) context = above.childrenContext ?? above.context;
578
+ }
579
+ if (!spec.inheritsContext && spec.context !== context) {
580
+ this.add('catalog.placement', node.id, {
581
+ component: node.component,
582
+ detail: `is a ${spec.context.toLowerCase()} component, not one of the ${context.toLowerCase()} context`,
583
+ });
584
+ }
585
+ const names = new Set(ancestors.map(ancestor => ancestor.component));
586
+ if (spec.downstreamOf.length && !spec.downstreamOf.some(name => names.has(name))) {
587
+ this.add('catalog.placement', node.id, {component: node.component, detail: `must be inside one of [${[...spec.downstreamOf].sort().map(pythonRepr).join(', ')}]`});
588
+ }
589
+ const forbidden = spec.notDownstreamOf.filter(name => names.has(name)).sort();
590
+ if (forbidden.length) {
591
+ this.add('catalog.placement', node.id, {component: node.component, detail: `must not be inside [${forbidden.map(pythonRepr).join(', ')}]`});
592
+ }
593
+ // Only the versioned standard catalogs are declared; a module (the Orkestrator's, an app's) is what the blok's `module` names.
594
+ const catalog = spec.catalog;
595
+ const standard = catalog.includes('@') && catalog.split('@')[0] in this.vocabulary.catalogs;
596
+ if (this.scope.catalogs.length && standard && !this.scope.catalogs.includes(catalog)) {
597
+ this.add('catalog.undeclared', node.id, {component: node.component, catalog});
598
+ }
599
+ }
600
+
601
+ private checkProp(node: BlokComponentNode, prop: BlokComponentProp, spec: SpecComponent | undefined): void {
602
+ const {vocabulary} = this;
603
+ const propSpec = spec?.props.find(candidate => candidate.key === prop.key);
604
+ const holds = isCallbackValue(prop);
605
+ const hasValue =
606
+ prop.static_value != null || prop.dynamic_value != null || prop.util_call != null || prop.agent_call != null;
607
+ if (propSpec) {
608
+ if (propSpec.kind === CALLBACK_KIND && hasValue && !holds) {
609
+ this.add('callback.unbound', node.id, {key: prop.key, component: node.component}, prop.key);
610
+ } else if (propSpec.kind !== CALLBACK_KIND && holds) {
611
+ this.add('callback.not_callback', node.id, {key: prop.key, component: node.component, what: what(prop)}, prop.key);
612
+ }
613
+ if (LITERAL_KINDS.includes(propSpec.kind) && typeof prop.static_value === 'string' && prop.key !== BIND_PROP) {
614
+ this.add(
615
+ 'props.literal_type',
616
+ node.id,
617
+ {component: node.component, key: prop.key, value: prop.static_value, kind: propSpec.kind, hint: literalHint(prop.key, prop.static_value, propSpec.kind)},
618
+ prop.key,
619
+ );
620
+ }
621
+ if (propSpec.kind === ASSET_KIND) {
622
+ const parts = (prop.dynamic_value?.path ?? '').split('.');
623
+ const agent = parts[0] === 'self' ? parts.slice(1) : parts[0] === 'deps' ? parts.slice(2) : [];
624
+ if (agent.length !== 2 || agent[0] !== vocabulary.agentSegments.assets) {
625
+ this.add('catalog.asset', node.id, {key: prop.key, component: node.component}, prop.key);
626
+ }
627
+ }
628
+ }
629
+ if (prop.util_call?.operation === 'task.answer' && !this.kind.roots.includes('task')) {
630
+ this.notInKind(node.id, 'task.answer', 'task', prop.key);
631
+ }
632
+ if (prop.key === BIND_PROP) {
633
+ const path = prop.dynamic_value?.path ?? null;
634
+ if (path === null) {
635
+ this.add('local.bind', node.id, {what: what(prop)}, prop.key);
636
+ } else {
637
+ const root = path.split('.')[0];
638
+ if (!this.locals.has(root)) this.add('local.unknown', node.id, {path, root}, prop.key);
639
+ else {
640
+ this.boundLocals.add(root);
641
+ if (propSpec) this.checkBindKind(node, propSpec.kind, path);
642
+ }
643
+ }
644
+ }
645
+ if (node.component === TOAST_COMPONENT && prop.key === TOAST_TASK_PROP) {
646
+ const path = prop.dynamic_value?.path ?? null;
647
+ if (path === null || (path !== 'task' && !this.into.has(path))) this.add('toast.task', node.id, {what: path ?? what(prop)}, prop.key);
648
+ }
649
+ if (typeof prop.static_value === 'string') {
650
+ if (prop.key === CLASS_NAME) this.checkClasses(prop.static_value, node.id, prop.key);
651
+ if (drawnIn(this.scope) === LOGO && vocabulary.theme.logoPaintProps.includes(prop.key)) this.checkPaint(node, prop.key, prop.static_value);
652
+ if (spec?.context === SCENE && vocabulary.theme.scenePaintProps.includes(prop.key)) this.checkSceneColour(node, prop.key, prop.static_value);
653
+ }
654
+ if (prop.key === CLASS_NAME && prop.util_call) {
655
+ for (const literal of classLiterals(prop.util_call)) this.checkClasses(literal, node.id, prop.key);
656
+ }
657
+ }
658
+
659
+ /** The local a control writes is of a kind the control writes (`Slider`: FLOAT or INT). */
660
+ private checkBindKind(node: BlokComponentNode, propKind: string, path: string): void {
661
+ const allowed = this.vocabulary.locals.bindKinds[propKind];
662
+ const port = this.localPort(path);
663
+ if (!allowed || port === null) return;
664
+ if (!allowed.includes(port.kind)) {
665
+ this.add(
666
+ 'local.bind_kind',
667
+ node.id,
668
+ {key: BIND_PROP, component: node.component, prop_kind: propKind, path, kind: port.kind, kinds: [...allowed].sort().join(', ')},
669
+ BIND_PROP,
670
+ );
671
+ }
672
+ }
673
+
674
+ private checkClasses(classes: string, owner: string, propKey: string): void {
675
+ const hints = this.vocabulary.theme.paletteRoleHints;
676
+ for (const token of classes.split(/\s+/).filter(Boolean)) {
677
+ const base = (token.split(':').pop() ?? token).replace(/^!+/, '');
678
+ const match = this.colour.exec(base);
679
+ if (match?.groups) {
680
+ const role = hints[match.groups.colour] ?? 'primary';
681
+ this.add('palette.raw_colour', owner, {token, suggestion: `${match.groups.utility}-${role}`}, propKey);
682
+ continue;
683
+ }
684
+ const arbitrary = ARBITRARY_COLOUR.exec(base);
685
+ if (arbitrary?.groups) {
686
+ this.add(
687
+ 'palette.raw_colour',
688
+ owner,
689
+ {token, suggestion: `${arbitrary.groups.utility}-<role> (${this.vocabulary.theme.colourRoles.slice(0, 6).join(', ')}, ...)`},
690
+ propKey,
691
+ );
692
+ }
693
+ }
694
+ }
695
+
696
+ private checkPaint(node: BlokComponentNode, key: string, value: string): void {
697
+ const paint = value.trim();
698
+ if (this.vocabulary.theme.logoPens.includes(paint) || (paint.startsWith('url(#') && paint.endsWith(')'))) return;
699
+ this.add('palette.logo_paint', node.id, {component: node.component, prop: key, value, pens: this.vocabulary.theme.logoPens.join('|')}, key);
700
+ }
701
+
702
+ /** A scene paints with the theme's colour roles, resolved by the renderer against the viewer's brand. */
703
+ private checkSceneColour(node: BlokComponentNode, key: string, value: string): void {
704
+ const roles = this.vocabulary.theme.colourRoles;
705
+ if (roles.includes(value.trim())) return;
706
+ this.add('palette.scene_colour', node.id, {component: node.component, prop: key, value, roles: roles.join(', ')}, key);
707
+ }
708
+
709
+ /* -- calls -- */
710
+
711
+ private visitAgentCall(call: BlokAgentCall, where: Where, scope: Scope): void {
712
+ const owner = whereText(where);
713
+ const action = actionKeyFor(call);
714
+ if (call.dependency === 'self') {
715
+ if (!this.kind.roots.includes('self')) {
716
+ this.notInKind(where.node.id, `self.${action}(...)`, 'self', where.key);
717
+ return;
718
+ }
719
+ } else if (!this.kind.roots.includes('deps')) {
720
+ this.notInKind(where.node.id, `deps.${call.dependency}.${action}(...)`, 'deps', where.key);
721
+ return;
722
+ }
723
+ const dependency = this.dependencies.get(call.dependency);
724
+ if (!dependency) {
725
+ if (call.dependency !== 'self') {
726
+ this.add(
727
+ 'deps.unknown',
728
+ where.node.id,
729
+ {path: owner, key: call.dependency, keys: [...this.dependencies.keys()].sort().join(', ') || 'none', hint: dependencyHint(call.dependency, this.scope.kind)},
730
+ where.key,
731
+ );
732
+ }
733
+ return;
734
+ }
735
+ const actions = dependency.action_dependencies;
736
+ if (actions != null && !actions.some(demand => demand.key === action)) {
737
+ this.add(
738
+ 'deps.unknown_action',
739
+ where.node.id,
740
+ {path: owner, key: call.dependency, action, actions: actions.map(demand => demand.key).sort().join(', ') || 'none'},
741
+ where.key,
742
+ );
743
+ return;
744
+ }
745
+ const demand = (actions ?? []).find(each => each.key === action)?.demand;
746
+ if (demand?.arg_matches?.length) this.checkArgKinds(call, demand.arg_matches, where, scope);
747
+ }
748
+
749
+ /** A local passed whole to a task call fits the action's arg port (`arg_kinds`). */
750
+ private checkArgKinds(call: BlokAgentCall, matches: readonly BlokPortMatch[], where: Where, scope: Scope): void {
751
+ const ports = new Map(matches.flatMap(match => (match.key != null ? [[match.key, match] as const] : [])));
752
+ const name = call.dependency === 'self' ? `self.${call.operation}` : `deps.${call.dependency}.${call.operation}`;
753
+ for (const argument of call.arguments ?? []) {
754
+ const path = argument.value_path;
755
+ const match = ports.get(argument.key ?? '');
756
+ if (path == null || !match || match.kind == null) continue;
757
+ const root = path.split('.')[0];
758
+ if (scope.has(root) || !this.locals.has(root)) continue;
759
+ const port = this.localPort(path);
760
+ if (port === null) continue;
761
+ const target = {kind: match.kind, identifier: match.identifier ?? null};
762
+ if (!argFits(port, target)) {
763
+ const otherStructure = port.kind === 'STRUCTURE' && match.kind === 'STRUCTURE';
764
+ this.add(
765
+ 'local.arg_kind',
766
+ where.node.id,
767
+ {
768
+ call: name,
769
+ argument: argument.key,
770
+ port_kind: otherStructure ? `${match.kind} ${match.identifier ?? ''}` : match.kind,
771
+ path,
772
+ kind: otherStructure ? `${port.kind} ${port.identifier ?? ''}` : port.kind,
773
+ },
774
+ where.key,
775
+ );
776
+ }
777
+ }
778
+ }
779
+
780
+ private visitUtilCall(call: BlokUtilCall, where: Where, top: boolean): void {
781
+ const functions = this.view?.functions ?? this.vocabulary.functions;
782
+ const fn = functions.get(call.operation);
783
+ if (!fn) {
784
+ if (!this.vocabulary.functionNamespaces.includes(call.operation.split('.')[0]) || !call.operation.includes('.')) {
785
+ this.add('expr.unknown_callee', where.node.id, {callee: call.operation}, where.key);
786
+ } else if (this.view) {
787
+ this.add('expr.unknown_function', where.node.id, {function: call.operation}, where.key);
788
+ }
789
+ return;
790
+ }
791
+ if (fn.effect && !top) this.add('callback.nested', where.node.id, {what: call.operation}, where.key);
792
+ if (call.operation in VERBS && top) this.checkQueryEffect(call, where);
793
+ const keys = new Set((call.arguments ?? []).map(argument => argument.key).filter((key): key is string => key != null));
794
+ const unknown = [...keys].filter(key => !fn.keys.includes(key) && !DIGITS.test(key)).sort();
795
+ if (unknown.length) {
796
+ this.add('expr.arguments', where.node.id, {function: call.operation, detail: `has no argument '${unknown[0]}' (${fn.keys.join(', ')})`}, where.key);
797
+ }
798
+ const missing = fn.requiredKeys.filter(key => !keys.has(key));
799
+ if (missing.length) this.add('expr.arguments', where.node.id, {function: call.operation, detail: `needs ${missing.join(', ')}`}, where.key);
800
+ }
801
+
802
+ /** `query.refetch` / `query.fetch_more`: a declared query, named by a literal; fetch_more only of one that declares `more`. */
803
+ private checkQueryEffect(call: BlokUtilCall, where: Where): void {
804
+ const verb = VERBS[call.operation];
805
+ const named = (call.arguments ?? []).find(argument => argument.key === 'query');
806
+ if (!named) return; // expr.arguments says it is missing
807
+ const name = named.value_literal;
808
+ if (typeof name !== 'string' || named.value_path != null || named.util_call != null || named.value_list != null || named.value_dict != null) {
809
+ this.add('query.effect_target', where.node.id, {function: call.operation, verb, what: argumentWhat(named)}, where.key);
810
+ return;
811
+ }
812
+ const path = `queries.${name}.${verb}()`;
813
+ if (!this.kind.roots.includes('queries')) {
814
+ this.notInKind(where.node.id, path, 'queries', where.key);
815
+ return;
816
+ }
817
+ const query = this.queries.get(name);
818
+ if (!query) {
819
+ this.add('query.unknown', where.node.id, {path, name, names: [...this.queries.keys()].sort().join(', ') || 'none'}, where.key);
820
+ return;
821
+ }
822
+ if (call.operation === FETCH_MORE_FUNCTION && query.more == null) this.add('query.fetch_more', where.node.id, {path, name}, where.key);
823
+ }
824
+
825
+ private bindLet(name: string, items: BlokComponentProp | null, where: Where, scope: Scope): Match {
826
+ const keyed = (where.node.props ?? []).some(prop => prop.key === FOREACH_KEY);
827
+ const literal = items?.static_value;
828
+ if (!keyed && Array.isArray(literal) && literal.some(item => typeof item === 'object' && item !== null)) {
829
+ this.add('foreach.position_key', where.node.id, {let: name});
830
+ }
831
+ const path = items?.dynamic_value?.path;
832
+ if (path == null) return openMatch(name);
833
+ const resolved = this.resolve(path, null, scope, whereText(where), where);
834
+ if (resolved === null || isOpen(resolved)) return openMatch(name);
835
+ const children = resolved.children ?? [];
836
+ if (children.length === 1 && children[0].key === ITEM) {
837
+ const item = children[0];
838
+ if (!keyed && (item.children?.length || (item.kind != null && COMPOUND_KINDS.has(item.kind)))) {
839
+ this.add('foreach.position_key', where.node.id, {let: name});
840
+ }
841
+ return {...item, key: name};
842
+ }
843
+ if (resolved.kind == null || resolved.kind === 'LIST') return openMatch(name);
844
+ this.add('path.unknown', where.node.id, {path, detail: `${FOREACH_ITEMS} of a foreach reads a list, not this ${resolved.kind.toLowerCase()}`}, FOREACH_ITEMS);
845
+ return openMatch(name);
846
+ }
847
+
848
+ private bindInto(call: BlokAgentCall): Match {
849
+ const dependency = this.dependencies.get(call.dependency);
850
+ const action = actionKeyFor(call);
851
+ let returns: readonly BlokPortMatch[] | null = null;
852
+ for (const demand of dependency?.action_dependencies ?? []) {
853
+ if (demand.key === action && demand.demand) returns = demand.demand.return_matches ?? null;
854
+ }
855
+ return taskRecordMatch('record', returns);
856
+ }
857
+
858
+ /* -- paths -- */
859
+
860
+ /**
861
+ * What `path` holds, recording a finding (and returning null) when it holds
862
+ * nothing. `where` is null for a query's variables and a foreach's items
863
+ * (no callback, no error slot); `at` then names the node for the finding.
864
+ */
865
+ resolve(path: string, where: Where | null, scope: Scope, owner: string, at?: Where): Match {
866
+ const {vocabulary} = this;
867
+ const place = where ?? at ?? null;
868
+ const nodeId = place ? place.node.id : owner;
869
+ const propKey = place?.key;
870
+ const parts = path.split('.');
871
+ const [root, ...rest] = parts;
872
+ const report = (code: string, fields: DiagnosticFields) => this.add(code, nodeId, fields, propKey);
873
+ if (scope.has(root)) {
874
+ if (this.into.has(root)) this.checkReturns(path, rest, nodeId, propKey);
875
+ return this.descend(scope.get(root) ?? null, rest, path, nodeId, propKey);
876
+ }
877
+ const local = this.locals.get(root);
878
+ if (local) {
879
+ if (local.kind === LOCAL_ANY || OPAQUE_KINDS.has(local.kind)) return openMatch(root);
880
+ return this.descend({...portMatch(local), key: root}, rest, path, nodeId, propKey);
881
+ }
882
+ if (root === 'event') {
883
+ if (!where || !where.callback) {
884
+ report('roots.event_outside_callback', {path});
885
+ return null;
886
+ }
887
+ return this.eventField(rest, where);
888
+ }
889
+ if (root === 'error') {
890
+ if (!where || !where.inError) {
891
+ report('roots.error_outside_boundary', {path});
892
+ return null;
893
+ }
894
+ return this.descend(recordMatch('error', vocabulary.records.error.fields), rest, path, nodeId, propKey);
895
+ }
896
+ if (!(root in vocabulary.dataRoots)) {
897
+ const namespace = vocabulary.functionNamespaces.includes(root);
898
+ report('roots.unknown', {path, root: namespace ? `${root} (a function namespace)` : root});
899
+ return null;
900
+ }
901
+ if (!this.kind.roots.includes(root)) {
902
+ this.notInKind(nodeId, path, root, propKey);
903
+ return null;
904
+ }
905
+ switch (root) {
906
+ case 'then':
907
+ if (rest.length) report('path.unknown', {path, detail: 'then is a moment (null while live), it has no fields'});
908
+ return {key: 'then', kind: 'STRING', nullable: true};
909
+ case 'self':
910
+ return this.agent(this.dependencies.get('self') ?? null, 'self', rest, path, nodeId, propKey);
911
+ case 'deps': {
912
+ if (!rest.length) {
913
+ report('roots.whole', {path, root: 'deps'});
914
+ return null;
915
+ }
916
+ const dependency = this.dependencies.get(rest[0]);
917
+ if (!dependency) {
918
+ report('deps.unknown', {path, key: rest[0], keys: [...this.dependencies.keys()].sort().join(', ') || 'none', hint: dependencyHint(rest[0], this.scope.kind)});
919
+ return null;
920
+ }
921
+ return this.agent(dependency, rest[0], rest.slice(1), path, nodeId, propKey);
922
+ }
923
+ case 'args':
924
+ if (!rest.length) {
925
+ report('roots.whole', {path, root: 'args'});
926
+ return null;
927
+ }
928
+ if (this.scope.args !== null && !this.scope.args.includes(rest[0])) {
929
+ report('args.unknown', {path, key: rest[0], keys: this.scope.args.join(', ') || 'none'});
930
+ return null;
931
+ }
932
+ return openMatch(path);
933
+ case 'task':
934
+ this.checkReturns(path, rest, nodeId, propKey);
935
+ return this.descend(taskRecordMatch('task'), rest, path, nodeId, propKey);
936
+ case 'viewer':
937
+ return this.descend(recordMatch('viewer', vocabulary.records.viewer.fields), rest, path, nodeId, propKey);
938
+ case 'queries': {
939
+ if (!rest.length) {
940
+ report('roots.whole', {path, root: 'queries'});
941
+ return null;
942
+ }
943
+ if (!this.queries.has(rest[0])) {
944
+ report('query.unknown', {path, name: rest[0], names: [...this.queries.keys()].sort().join(', ') || 'none'});
945
+ return null;
946
+ }
947
+ const value = this.scope.query_values?.[rest[0]];
948
+ const match = recordMatch(rest[0], vocabulary.records.query.fields, value ? {value} : undefined);
949
+ return this.descend(match, rest.slice(1), path, nodeId, propKey);
950
+ }
951
+ case 'subscriptions':
952
+ if (!rest.length) {
953
+ report('roots.whole', {path, root: 'subscriptions'});
954
+ return null;
955
+ }
956
+ if (!this.subscriptions.has(rest[0])) {
957
+ report('subscription.unknown', {path, name: rest[0], names: [...this.subscriptions.keys()].sort().join(', ') || 'none'});
958
+ return null;
959
+ }
960
+ return this.descend(recordMatch(rest[0], vocabulary.records.subscription.fields), rest.slice(1), path, nodeId, propKey);
961
+ default:
962
+ return openMatch(path);
963
+ }
964
+ }
965
+
966
+ /** `<record>.returns.return0`: a return the action left unnamed (a warning). */
967
+ private checkReturns(path: string, rest: readonly string[], nodeId: string, propKey: string | undefined): void {
968
+ if (rest.length > 1 && rest[0] === RETURNS_FIELD && UNNAMED_RETURN.test(rest[1])) {
969
+ this.add('returns.unnamed', nodeId, {path, port: rest[1]}, propKey);
970
+ }
971
+ }
972
+
973
+ private eventField(rest: readonly string[], where: Where): Match {
974
+ const prop = this.view?.components.get(where.node.component)?.props.find(candidate => candidate.key === where.key);
975
+ if (!prop || prop.event === null || !rest.length) return openMatch('event');
976
+ const fields = prop.event.map(field => field.key);
977
+ if (!fields.includes(rest[0])) {
978
+ this.add(
979
+ 'callback.event_field',
980
+ where.node.id,
981
+ {field: rest[0], key: where.key, component: where.node.component, fields: fields.join(', ') || 'none'},
982
+ where.key,
983
+ );
984
+ return null;
985
+ }
986
+ return openMatch(rest[0]);
987
+ }
988
+
989
+ /** What a path below an agent (`self`, `deps.<key>`) holds. */
990
+ private agent(
991
+ dependency: BlokScopeDependency | null,
992
+ key: string,
993
+ rest: readonly string[],
994
+ path: string,
995
+ nodeId: string,
996
+ propKey: string | undefined,
997
+ ): Match {
998
+ const {agentSegments} = this.vocabulary;
999
+ if (!rest.length) return openMatch(key);
1000
+ const [head, ...tail] = rest;
1001
+ const report = (code: string, fields: DiagnosticFields) => this.add(code, nodeId, fields, propKey);
1002
+ if (head in agentSegments.fields) {
1003
+ if (tail.length) report('path.unknown', {path, detail: `${head} of an agent has no fields`});
1004
+ return {key: head, kind: 'STRING'};
1005
+ }
1006
+ if (head === agentSegments.tasks) {
1007
+ if (!tail.length) {
1008
+ report('roots.whole', {path, root: `${key}.tasks`});
1009
+ return null;
1010
+ }
1011
+ const action = tail[0];
1012
+ let returns: readonly BlokPortMatch[] | null = null;
1013
+ if (dependency?.action_dependencies != null) {
1014
+ const demand = dependency.action_dependencies.find(candidate => candidate.key === action);
1015
+ if (!demand) {
1016
+ report('deps.unknown_action', {
1017
+ path,
1018
+ key,
1019
+ action,
1020
+ actions: dependency.action_dependencies.map(candidate => candidate.key).sort().join(', ') || 'none',
1021
+ });
1022
+ return null;
1023
+ }
1024
+ returns = demand.demand?.return_matches ?? null;
1025
+ }
1026
+ this.checkReturns(path, tail.slice(1), nodeId, propKey);
1027
+ return this.descend(taskRecordMatch(action, returns), tail.slice(1), path, nodeId, propKey);
1028
+ }
1029
+ if (head === agentSegments.assets) {
1030
+ if (tail.length !== 1 || (key === 'self' && this.scope.assets != null && !this.scope.assets.includes(tail[0]))) {
1031
+ report('deps.asset', {path});
1032
+ return null;
1033
+ }
1034
+ return {key: tail[0], kind: 'STRING'};
1035
+ }
1036
+ if (!dependency || dependency.state_dependencies == null) return openMatch(path);
1037
+ const state = dependency.state_dependencies.find(candidate => candidate.key === head);
1038
+ if (!state) {
1039
+ report('deps.unknown_state', {
1040
+ path,
1041
+ key,
1042
+ state: head,
1043
+ states: dependency.state_dependencies.map(candidate => candidate.key).sort().join(', ') || 'none',
1044
+ });
1045
+ return null;
1046
+ }
1047
+ return this.descend(stateMatch(state), tail, path, nodeId, propKey);
1048
+ }
1049
+
1050
+ /** Follow `rest` down `match`'s children. */
1051
+ private descend(match: Match, rest: readonly string[], path: string, nodeId: string, propKey: string | undefined): Match {
1052
+ let current = match;
1053
+ for (let index = 0; index < rest.length; index += 1) {
1054
+ const part = rest[index];
1055
+ if (current === null || isOpen(current)) return current;
1056
+ const children = current.children ?? [];
1057
+ let child = children.find(candidate => candidate.key === part) ?? null;
1058
+ if (!child && children.length === 1 && children[0].key === ITEM) child = children[0];
1059
+ if (!child) {
1060
+ const available = children.map(candidate => candidate.key).filter((key): key is string => key != null && key !== ITEM).sort();
1061
+ const whereText = rest.slice(0, index).join('.') || current.key || 'it';
1062
+ const detail = `'${part}' does not exist in ${whereText}${available.length ? ` (it has: ${available.join(', ')})` : ' (it has no fields)'}`;
1063
+ this.add('path.unknown', nodeId, {path, detail}, propKey);
1064
+ return null;
1065
+ }
1066
+ current = child;
1067
+ }
1068
+ return current;
1069
+ }
1070
+ }
1071
+
1072
+ /* -------------------------------------------------------------------------- */
1073
+ /* Logos */
1074
+ /* -------------------------------------------------------------------------- */
1075
+
1076
+ const demoItems = (prop: BlokComponentProp, demo: BlokCheckScope['demo']): number => {
1077
+ if (Array.isArray(prop.static_value)) return prop.static_value.length;
1078
+ const path = prop.dynamic_value?.path;
1079
+ if (path == null || !demo) return 0;
1080
+ const parts = path.split('.');
1081
+ const record = (value: unknown): Record<string, unknown> | null =>
1082
+ typeof value === 'object' && value !== null && !Array.isArray(value) ? (value as Record<string, unknown>) : null;
1083
+ let value: unknown;
1084
+ let rest: string[];
1085
+ if (parts[0] === 'self') {
1086
+ value = record(demo.deps)?.self;
1087
+ rest = parts.slice(1);
1088
+ } else if (parts[0] === 'deps') {
1089
+ value = demo.deps;
1090
+ rest = parts.slice(1);
1091
+ } else {
1092
+ value = parts[0] === 'task' ? demo.task : parts[0] === 'args' ? demo.args : undefined;
1093
+ rest = parts.slice(1);
1094
+ }
1095
+ for (const part of rest) {
1096
+ const container = record(value);
1097
+ if (!container || !(part in container)) return 0;
1098
+ value = container[part];
1099
+ }
1100
+ return Array.isArray(value) ? value.length : 0;
1101
+ };
1102
+
1103
+ /** A logo is an icon: few nodes, shallow, little path data, and loops over few items. */
1104
+ export const checkLogo = (tree: BlokComponentNode, demo?: BlokCheckScope['demo']): BlokFinding[] => {
1105
+ const {limits} = loadVocabulary();
1106
+ const findings: BlokFinding[] = [];
1107
+ let nodes = 0;
1108
+ let pathData = 0;
1109
+ const visit = (current: BlokComponentNode, depth: number) => {
1110
+ nodes += 1;
1111
+ if (depth > limits.logoMaxDepth) {
1112
+ findings.push(finding('logo.complexity', {detail: `a logo nests at most ${limits.logoMaxDepth} deep`}, {nodeId: current.id}));
1113
+ }
1114
+ for (const prop of current.props ?? []) {
1115
+ if (limits.logoPathDataProps.includes(prop.key) && typeof prop.static_value === 'string') pathData += prop.static_value.length;
1116
+ if (current.component === FOREACH && prop.key === FOREACH_ITEMS) {
1117
+ const items = demoItems(prop, demo);
1118
+ if (items > limits.logoMaxForeachItems) {
1119
+ findings.push(
1120
+ finding(
1121
+ 'logo.complexity',
1122
+ {detail: `a foreach in a logo draws at most ${limits.logoMaxForeachItems} items, its demo has ${items}`},
1123
+ {nodeId: current.id},
1124
+ ),
1125
+ );
1126
+ }
1127
+ }
1128
+ }
1129
+ current.children?.forEach(child => visit(child, depth + 1));
1130
+ };
1131
+ visit(tree, 1);
1132
+ if (nodes > limits.logoMaxNodes) {
1133
+ findings.push(finding('logo.complexity', {detail: `a logo has at most ${limits.logoMaxNodes} components, this one ${nodes}`}, {nodeId: tree.id}));
1134
+ }
1135
+ if (pathData > limits.logoMaxPathData) {
1136
+ findings.push(
1137
+ finding('logo.complexity', {detail: `a logo holds at most ${limits.logoMaxPathData} characters of path data, this one ${pathData}`}, {nodeId: tree.id}),
1138
+ );
1139
+ }
1140
+ return findings;
1141
+ };
1142
+
1143
+ /**
1144
+ * Every finding of `tree` against `scope` and `view`: errors and warnings, in
1145
+ * tree order. `view` defaults to the Orkestrator's (base, the standard catalogs
1146
+ * and its module); `null` skips every catalog rule.
1147
+ */
1148
+ export const checkBlokTree = (tree: BlokComponentNode, scope: BlokCheckScope, view: BlokView | null = defaultBlokView()): BlokFinding[] => {
1149
+ const checker = new Checker(resolveBlokScope(tree, scope, view), view);
1150
+ checker.checkDeclarations(tree);
1151
+ checker.walk(tree);
1152
+ if (drawnIn(scope) === LOGO) checker.findings.push(...checkLogo(tree, scope.demo));
1153
+ checker.finish();
1154
+ return checker.findings;
1155
+ };