@copilotkit/a2ui-renderer 1.55.0-next.9 → 1.55.1-next.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 (497) hide show
  1. package/dist/a2ui-types.cjs +2 -3
  2. package/dist/a2ui-types.cjs.map +1 -1
  3. package/dist/a2ui-types.d.cts +21 -5
  4. package/dist/a2ui-types.d.cts.map +1 -1
  5. package/dist/a2ui-types.d.mts +21 -5
  6. package/dist/a2ui-types.d.mts.map +1 -1
  7. package/dist/a2ui-types.mjs +2 -3
  8. package/dist/a2ui-types.mjs.map +1 -1
  9. package/dist/index.cjs +40 -61
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/index.d.cts +10 -39
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +10 -39
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +12 -29
  16. package/dist/index.mjs.map +1 -0
  17. package/dist/index.umd.js +1743 -2783
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/react-renderer/a2ui-react/A2uiSurface.cjs +110 -0
  20. package/dist/react-renderer/a2ui-react/A2uiSurface.cjs.map +1 -0
  21. package/dist/react-renderer/a2ui-react/A2uiSurface.d.cts +2 -0
  22. package/dist/react-renderer/a2ui-react/A2uiSurface.d.mts +3 -0
  23. package/dist/react-renderer/a2ui-react/A2uiSurface.mjs +107 -0
  24. package/dist/react-renderer/a2ui-react/A2uiSurface.mjs.map +1 -0
  25. package/dist/react-renderer/a2ui-react/adapter.cjs +63 -0
  26. package/dist/react-renderer/a2ui-react/adapter.cjs.map +1 -0
  27. package/dist/react-renderer/a2ui-react/adapter.d.cts +23 -0
  28. package/dist/react-renderer/a2ui-react/adapter.d.cts.map +1 -0
  29. package/dist/react-renderer/a2ui-react/adapter.d.mts +23 -0
  30. package/dist/react-renderer/a2ui-react/adapter.d.mts.map +1 -0
  31. package/dist/react-renderer/a2ui-react/adapter.mjs +61 -0
  32. package/dist/react-renderer/a2ui-react/adapter.mjs.map +1 -0
  33. package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.cjs +53 -0
  34. package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.cjs.map +1 -0
  35. package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.d.cts +1 -0
  36. package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.d.mts +1 -0
  37. package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.mjs +36 -0
  38. package/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.mjs.map +1 -0
  39. package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.cjs +48 -0
  40. package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.cjs.map +1 -0
  41. package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.d.cts +1 -0
  42. package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.d.mts +1 -0
  43. package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.mjs +31 -0
  44. package/dist/react-renderer/a2ui-react/catalog/basic/components/Button.mjs.map +1 -0
  45. package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.cjs +39 -0
  46. package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.cjs.map +1 -0
  47. package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.d.cts +1 -0
  48. package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.d.mts +1 -0
  49. package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.mjs +22 -0
  50. package/dist/react-renderer/a2ui-react/catalog/basic/components/Card.mjs.map +1 -0
  51. package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.cjs +73 -0
  52. package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.cjs.map +1 -0
  53. package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.d.cts +1 -0
  54. package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.d.mts +1 -0
  55. package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.mjs +71 -0
  56. package/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.mjs.map +1 -0
  57. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.cjs +36 -0
  58. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.cjs.map +1 -0
  59. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.mjs +34 -0
  60. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.mjs.map +1 -0
  61. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.cjs +110 -0
  62. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.cjs.map +1 -0
  63. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.d.cts +1 -0
  64. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.d.mts +1 -0
  65. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.mjs +108 -0
  66. package/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.mjs.map +1 -0
  67. package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.cjs +45 -0
  68. package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.cjs.map +1 -0
  69. package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.d.cts +1 -0
  70. package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.d.mts +1 -0
  71. package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.mjs +44 -0
  72. package/dist/react-renderer/a2ui-react/catalog/basic/components/Column.mjs.map +1 -0
  73. package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.cjs +69 -0
  74. package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.cjs.map +1 -0
  75. package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.d.cts +1 -0
  76. package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.d.mts +1 -0
  77. package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.mjs +67 -0
  78. package/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.mjs.map +1 -0
  79. package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.cjs +44 -0
  80. package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.cjs.map +1 -0
  81. package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.d.cts +1 -0
  82. package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.d.mts +1 -0
  83. package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.mjs +27 -0
  84. package/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.mjs.map +1 -0
  85. package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.cjs +44 -0
  86. package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.cjs.map +1 -0
  87. package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.d.cts +1 -0
  88. package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.d.mts +1 -0
  89. package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.mjs +27 -0
  90. package/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.mjs.map +1 -0
  91. package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.cjs +59 -0
  92. package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.cjs.map +1 -0
  93. package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.d.cts +1 -0
  94. package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.d.mts +1 -0
  95. package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.mjs +42 -0
  96. package/dist/react-renderer/a2ui-react/catalog/basic/components/Image.mjs.map +1 -0
  97. package/dist/react-renderer/a2ui-react/catalog/basic/components/List.cjs +49 -0
  98. package/dist/react-renderer/a2ui-react/catalog/basic/components/List.cjs.map +1 -0
  99. package/dist/react-renderer/a2ui-react/catalog/basic/components/List.d.cts +1 -0
  100. package/dist/react-renderer/a2ui-react/catalog/basic/components/List.d.mts +1 -0
  101. package/dist/react-renderer/a2ui-react/catalog/basic/components/List.mjs +32 -0
  102. package/dist/react-renderer/a2ui-react/catalog/basic/components/List.mjs.map +1 -0
  103. package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.cjs +81 -0
  104. package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.cjs.map +1 -0
  105. package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.d.cts +1 -0
  106. package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.d.mts +1 -0
  107. package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.mjs +80 -0
  108. package/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.mjs.map +1 -0
  109. package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.cjs +45 -0
  110. package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.cjs.map +1 -0
  111. package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.d.cts +1 -0
  112. package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.d.mts +1 -0
  113. package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.mjs +44 -0
  114. package/dist/react-renderer/a2ui-react/catalog/basic/components/Row.mjs.map +1 -0
  115. package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.cjs +74 -0
  116. package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.cjs.map +1 -0
  117. package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.d.cts +1 -0
  118. package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.d.mts +1 -0
  119. package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.mjs +72 -0
  120. package/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.mjs.map +1 -0
  121. package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.cjs +63 -0
  122. package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.cjs.map +1 -0
  123. package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.d.cts +1 -0
  124. package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.d.mts +1 -0
  125. package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.mjs +62 -0
  126. package/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.mjs.map +1 -0
  127. package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.cjs +69 -0
  128. package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.cjs.map +1 -0
  129. package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.d.cts +1 -0
  130. package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.d.mts +1 -0
  131. package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.mjs +52 -0
  132. package/dist/react-renderer/a2ui-react/catalog/basic/components/Text.mjs.map +1 -0
  133. package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.cjs +88 -0
  134. package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.cjs.map +1 -0
  135. package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.d.cts +1 -0
  136. package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.d.mts +1 -0
  137. package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.mjs +86 -0
  138. package/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.mjs.map +1 -0
  139. package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.cjs +40 -0
  140. package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.cjs.map +1 -0
  141. package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.d.cts +1 -0
  142. package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.d.mts +1 -0
  143. package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.mjs +23 -0
  144. package/dist/react-renderer/a2ui-react/catalog/basic/components/Video.mjs.map +1 -0
  145. package/dist/react-renderer/a2ui-react/catalog/basic/index.cjs +63 -0
  146. package/dist/react-renderer/a2ui-react/catalog/basic/index.cjs.map +1 -0
  147. package/dist/react-renderer/a2ui-react/catalog/basic/index.d.cts +26 -0
  148. package/dist/react-renderer/a2ui-react/catalog/basic/index.d.cts.map +1 -0
  149. package/dist/react-renderer/a2ui-react/catalog/basic/index.d.mts +26 -0
  150. package/dist/react-renderer/a2ui-react/catalog/basic/index.d.mts.map +1 -0
  151. package/dist/react-renderer/a2ui-react/catalog/basic/index.mjs +62 -0
  152. package/dist/react-renderer/a2ui-react/catalog/basic/index.mjs.map +1 -0
  153. package/dist/react-renderer/a2ui-react/catalog/basic/utils.cjs +52 -0
  154. package/dist/react-renderer/a2ui-react/catalog/basic/utils.cjs.map +1 -0
  155. package/dist/react-renderer/a2ui-react/catalog/basic/utils.mjs +45 -0
  156. package/dist/react-renderer/a2ui-react/catalog/basic/utils.mjs.map +1 -0
  157. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.cjs +51 -0
  158. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.cjs.map +1 -0
  159. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.d.cts +2 -0
  160. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.d.mts +2 -0
  161. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.mjs +34 -0
  162. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.mjs.map +1 -0
  163. package/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.cjs +36 -0
  164. package/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.cjs.map +1 -0
  165. package/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.mjs +34 -0
  166. package/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.mjs.map +1 -0
  167. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.cjs +85 -0
  168. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.cjs.map +1 -0
  169. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.d.cts +2 -0
  170. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.d.mts +2 -0
  171. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.mjs +84 -0
  172. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.mjs.map +1 -0
  173. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.cjs +84 -0
  174. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.cjs.map +1 -0
  175. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.d.cts +2 -0
  176. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.d.mts +2 -0
  177. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.mjs +83 -0
  178. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.mjs.map +1 -0
  179. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.cjs +54 -0
  180. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.cjs.map +1 -0
  181. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.d.cts +2 -0
  182. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.d.mts +2 -0
  183. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.mjs +53 -0
  184. package/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.mjs.map +1 -0
  185. package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.cjs +85 -0
  186. package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.cjs.map +1 -0
  187. package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.d.cts +2 -0
  188. package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.d.mts +2 -0
  189. package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.mjs +68 -0
  190. package/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.mjs.map +1 -0
  191. package/dist/react-renderer/a2ui-react/catalog/minimal/index.cjs +44 -0
  192. package/dist/react-renderer/a2ui-react/catalog/minimal/index.cjs.map +1 -0
  193. package/dist/react-renderer/a2ui-react/catalog/minimal/index.d.cts +7 -0
  194. package/dist/react-renderer/a2ui-react/catalog/minimal/index.d.mts +7 -0
  195. package/dist/react-renderer/a2ui-react/catalog/minimal/index.mjs +44 -0
  196. package/dist/react-renderer/a2ui-react/catalog/minimal/index.mjs.map +1 -0
  197. package/dist/react-renderer/a2ui-react/index.cjs +22 -0
  198. package/dist/react-renderer/a2ui-react/index.d.cts +4 -0
  199. package/dist/react-renderer/a2ui-react/index.d.mts +4 -0
  200. package/dist/react-renderer/a2ui-react/index.mjs +24 -0
  201. package/dist/react-renderer/catalog-utils.cjs +84 -0
  202. package/dist/react-renderer/catalog-utils.cjs.map +1 -0
  203. package/dist/react-renderer/catalog-utils.d.cts +39 -0
  204. package/dist/react-renderer/catalog-utils.d.cts.map +1 -0
  205. package/dist/react-renderer/catalog-utils.d.mts +39 -0
  206. package/dist/react-renderer/catalog-utils.d.mts.map +1 -0
  207. package/dist/react-renderer/catalog-utils.mjs +79 -0
  208. package/dist/react-renderer/catalog-utils.mjs.map +1 -0
  209. package/dist/react-renderer/core/A2UIProvider.cjs +48 -70
  210. package/dist/react-renderer/core/A2UIProvider.cjs.map +1 -1
  211. package/dist/react-renderer/core/A2UIProvider.d.cts +13 -47
  212. package/dist/react-renderer/core/A2UIProvider.d.cts.map +1 -1
  213. package/dist/react-renderer/core/A2UIProvider.d.mts +13 -47
  214. package/dist/react-renderer/core/A2UIProvider.d.mts.map +1 -1
  215. package/dist/react-renderer/core/A2UIProvider.mjs +48 -71
  216. package/dist/react-renderer/core/A2UIProvider.mjs.map +1 -1
  217. package/dist/react-renderer/core/A2UIRenderer.cjs +8 -56
  218. package/dist/react-renderer/core/A2UIRenderer.cjs.map +1 -1
  219. package/dist/react-renderer/core/A2UIRenderer.d.cts +5 -19
  220. package/dist/react-renderer/core/A2UIRenderer.d.cts.map +1 -1
  221. package/dist/react-renderer/core/A2UIRenderer.d.mts +5 -19
  222. package/dist/react-renderer/core/A2UIRenderer.d.mts.map +1 -1
  223. package/dist/react-renderer/core/A2UIRenderer.mjs +9 -57
  224. package/dist/react-renderer/core/A2UIRenderer.mjs.map +1 -1
  225. package/dist/react-renderer/core/store.d.cts +6 -17
  226. package/dist/react-renderer/core/store.d.cts.map +1 -1
  227. package/dist/react-renderer/core/store.d.mts +6 -17
  228. package/dist/react-renderer/core/store.d.mts.map +1 -1
  229. package/dist/react-renderer/create-catalog.cjs +115 -0
  230. package/dist/react-renderer/create-catalog.cjs.map +1 -0
  231. package/dist/react-renderer/create-catalog.d.cts +107 -0
  232. package/dist/react-renderer/create-catalog.d.cts.map +1 -0
  233. package/dist/react-renderer/create-catalog.d.mts +107 -0
  234. package/dist/react-renderer/create-catalog.d.mts.map +1 -0
  235. package/dist/react-renderer/create-catalog.mjs +111 -0
  236. package/dist/react-renderer/create-catalog.mjs.map +1 -0
  237. package/dist/react-renderer/hooks/useA2UI.cjs +1 -26
  238. package/dist/react-renderer/hooks/useA2UI.cjs.map +1 -1
  239. package/dist/react-renderer/hooks/useA2UI.d.cts +5 -33
  240. package/dist/react-renderer/hooks/useA2UI.d.cts.map +1 -1
  241. package/dist/react-renderer/hooks/useA2UI.d.mts +5 -33
  242. package/dist/react-renderer/hooks/useA2UI.d.mts.map +1 -1
  243. package/dist/react-renderer/hooks/useA2UI.mjs +1 -26
  244. package/dist/react-renderer/hooks/useA2UI.mjs.map +1 -1
  245. package/dist/react-renderer/index.cjs +21 -27
  246. package/dist/react-renderer/index.cjs.map +1 -0
  247. package/dist/react-renderer/index.d.cts +17 -27
  248. package/dist/react-renderer/index.d.cts.map +1 -0
  249. package/dist/react-renderer/index.d.mts +17 -27
  250. package/dist/react-renderer/index.d.mts.map +1 -0
  251. package/dist/react-renderer/index.mjs +15 -27
  252. package/dist/react-renderer/index.mjs.map +1 -0
  253. package/dist/react-renderer/lib/utils.cjs +0 -25
  254. package/dist/react-renderer/lib/utils.cjs.map +1 -1
  255. package/dist/react-renderer/lib/utils.d.cts +0 -8
  256. package/dist/react-renderer/lib/utils.d.cts.map +1 -1
  257. package/dist/react-renderer/lib/utils.d.mts +0 -8
  258. package/dist/react-renderer/lib/utils.d.mts.map +1 -1
  259. package/dist/react-renderer/lib/utils.mjs +1 -25
  260. package/dist/react-renderer/lib/utils.mjs.map +1 -1
  261. package/dist/react-renderer/styles/index.cjs +4 -459
  262. package/dist/react-renderer/styles/index.cjs.map +1 -1
  263. package/dist/react-renderer/styles/index.d.mts +2 -18
  264. package/dist/react-renderer/styles/index.d.mts.map +1 -1
  265. package/dist/react-renderer/styles/index.mjs +4 -459
  266. package/dist/react-renderer/styles/index.mjs.map +1 -1
  267. package/dist/react-renderer/theme/ThemeContext.cjs +2 -19
  268. package/dist/react-renderer/theme/ThemeContext.cjs.map +1 -1
  269. package/dist/react-renderer/theme/ThemeContext.d.cts +4 -23
  270. package/dist/react-renderer/theme/ThemeContext.d.cts.map +1 -1
  271. package/dist/react-renderer/theme/ThemeContext.d.mts +4 -23
  272. package/dist/react-renderer/theme/ThemeContext.d.mts.map +1 -1
  273. package/dist/react-renderer/theme/ThemeContext.mjs +2 -19
  274. package/dist/react-renderer/theme/ThemeContext.mjs.map +1 -1
  275. package/dist/react-renderer/types.d.cts +24 -29
  276. package/dist/react-renderer/types.d.cts.map +1 -1
  277. package/dist/react-renderer/types.d.mts +24 -29
  278. package/dist/react-renderer/types.d.mts.map +1 -1
  279. package/package.json +29 -29
  280. package/dist/A2UIViewer.cjs +0 -154
  281. package/dist/A2UIViewer.cjs.map +0 -1
  282. package/dist/A2UIViewer.d.cts +0 -39
  283. package/dist/A2UIViewer.d.cts.map +0 -1
  284. package/dist/A2UIViewer.d.mts +0 -39
  285. package/dist/A2UIViewer.d.mts.map +0 -1
  286. package/dist/A2UIViewer.mjs +0 -152
  287. package/dist/A2UIViewer.mjs.map +0 -1
  288. package/dist/react-renderer/components/content/AudioPlayer.cjs +0 -34
  289. package/dist/react-renderer/components/content/AudioPlayer.cjs.map +0 -1
  290. package/dist/react-renderer/components/content/AudioPlayer.d.cts +0 -12
  291. package/dist/react-renderer/components/content/AudioPlayer.d.cts.map +0 -1
  292. package/dist/react-renderer/components/content/AudioPlayer.d.mts +0 -12
  293. package/dist/react-renderer/components/content/AudioPlayer.d.mts.map +0 -1
  294. package/dist/react-renderer/components/content/AudioPlayer.mjs +0 -33
  295. package/dist/react-renderer/components/content/AudioPlayer.mjs.map +0 -1
  296. package/dist/react-renderer/components/content/Divider.cjs +0 -31
  297. package/dist/react-renderer/components/content/Divider.cjs.map +0 -1
  298. package/dist/react-renderer/components/content/Divider.d.cts +0 -17
  299. package/dist/react-renderer/components/content/Divider.d.cts.map +0 -1
  300. package/dist/react-renderer/components/content/Divider.d.mts +0 -17
  301. package/dist/react-renderer/components/content/Divider.d.mts.map +0 -1
  302. package/dist/react-renderer/components/content/Divider.mjs +0 -30
  303. package/dist/react-renderer/components/content/Divider.mjs.map +0 -1
  304. package/dist/react-renderer/components/content/Icon.cjs +0 -50
  305. package/dist/react-renderer/components/content/Icon.cjs.map +0 -1
  306. package/dist/react-renderer/components/content/Icon.d.cts +0 -20
  307. package/dist/react-renderer/components/content/Icon.d.cts.map +0 -1
  308. package/dist/react-renderer/components/content/Icon.d.mts +0 -20
  309. package/dist/react-renderer/components/content/Icon.d.mts.map +0 -1
  310. package/dist/react-renderer/components/content/Icon.mjs +0 -49
  311. package/dist/react-renderer/components/content/Icon.mjs.map +0 -1
  312. package/dist/react-renderer/components/content/Image.cjs +0 -43
  313. package/dist/react-renderer/components/content/Image.cjs.map +0 -1
  314. package/dist/react-renderer/components/content/Image.d.cts +0 -15
  315. package/dist/react-renderer/components/content/Image.d.cts.map +0 -1
  316. package/dist/react-renderer/components/content/Image.d.mts +0 -15
  317. package/dist/react-renderer/components/content/Image.d.mts.map +0 -1
  318. package/dist/react-renderer/components/content/Image.mjs +0 -42
  319. package/dist/react-renderer/components/content/Image.mjs.map +0 -1
  320. package/dist/react-renderer/components/content/Text.cjs +0 -131
  321. package/dist/react-renderer/components/content/Text.cjs.map +0 -1
  322. package/dist/react-renderer/components/content/Text.d.cts +0 -32
  323. package/dist/react-renderer/components/content/Text.d.cts.map +0 -1
  324. package/dist/react-renderer/components/content/Text.d.mts +0 -32
  325. package/dist/react-renderer/components/content/Text.d.mts.map +0 -1
  326. package/dist/react-renderer/components/content/Text.mjs +0 -129
  327. package/dist/react-renderer/components/content/Text.mjs.map +0 -1
  328. package/dist/react-renderer/components/content/Video.cjs +0 -56
  329. package/dist/react-renderer/components/content/Video.cjs.map +0 -1
  330. package/dist/react-renderer/components/content/Video.d.cts +0 -14
  331. package/dist/react-renderer/components/content/Video.d.cts.map +0 -1
  332. package/dist/react-renderer/components/content/Video.d.mts +0 -14
  333. package/dist/react-renderer/components/content/Video.d.mts.map +0 -1
  334. package/dist/react-renderer/components/content/Video.mjs +0 -55
  335. package/dist/react-renderer/components/content/Video.mjs.map +0 -1
  336. package/dist/react-renderer/components/interactive/Button.cjs +0 -39
  337. package/dist/react-renderer/components/interactive/Button.cjs.map +0 -1
  338. package/dist/react-renderer/components/interactive/Button.d.cts +0 -15
  339. package/dist/react-renderer/components/interactive/Button.d.cts.map +0 -1
  340. package/dist/react-renderer/components/interactive/Button.d.mts +0 -15
  341. package/dist/react-renderer/components/interactive/Button.d.mts.map +0 -1
  342. package/dist/react-renderer/components/interactive/Button.mjs +0 -38
  343. package/dist/react-renderer/components/interactive/Button.mjs.map +0 -1
  344. package/dist/react-renderer/components/interactive/CheckBox.cjs +0 -58
  345. package/dist/react-renderer/components/interactive/CheckBox.cjs.map +0 -1
  346. package/dist/react-renderer/components/interactive/CheckBox.d.cts +0 -14
  347. package/dist/react-renderer/components/interactive/CheckBox.d.cts.map +0 -1
  348. package/dist/react-renderer/components/interactive/CheckBox.d.mts +0 -14
  349. package/dist/react-renderer/components/interactive/CheckBox.d.mts.map +0 -1
  350. package/dist/react-renderer/components/interactive/CheckBox.mjs +0 -57
  351. package/dist/react-renderer/components/interactive/CheckBox.mjs.map +0 -1
  352. package/dist/react-renderer/components/interactive/DateTimeInput.cjs +0 -65
  353. package/dist/react-renderer/components/interactive/DateTimeInput.cjs.map +0 -1
  354. package/dist/react-renderer/components/interactive/DateTimeInput.d.cts +0 -14
  355. package/dist/react-renderer/components/interactive/DateTimeInput.d.cts.map +0 -1
  356. package/dist/react-renderer/components/interactive/DateTimeInput.d.mts +0 -14
  357. package/dist/react-renderer/components/interactive/DateTimeInput.d.mts.map +0 -1
  358. package/dist/react-renderer/components/interactive/DateTimeInput.mjs +0 -64
  359. package/dist/react-renderer/components/interactive/DateTimeInput.mjs.map +0 -1
  360. package/dist/react-renderer/components/interactive/MultipleChoice.cjs +0 -54
  361. package/dist/react-renderer/components/interactive/MultipleChoice.cjs.map +0 -1
  362. package/dist/react-renderer/components/interactive/MultipleChoice.d.cts +0 -15
  363. package/dist/react-renderer/components/interactive/MultipleChoice.d.cts.map +0 -1
  364. package/dist/react-renderer/components/interactive/MultipleChoice.d.mts +0 -15
  365. package/dist/react-renderer/components/interactive/MultipleChoice.d.mts.map +0 -1
  366. package/dist/react-renderer/components/interactive/MultipleChoice.mjs +0 -53
  367. package/dist/react-renderer/components/interactive/MultipleChoice.mjs.map +0 -1
  368. package/dist/react-renderer/components/interactive/Slider.cjs +0 -72
  369. package/dist/react-renderer/components/interactive/Slider.cjs.map +0 -1
  370. package/dist/react-renderer/components/interactive/Slider.d.cts +0 -14
  371. package/dist/react-renderer/components/interactive/Slider.d.cts.map +0 -1
  372. package/dist/react-renderer/components/interactive/Slider.d.mts +0 -14
  373. package/dist/react-renderer/components/interactive/Slider.d.mts.map +0 -1
  374. package/dist/react-renderer/components/interactive/Slider.mjs +0 -71
  375. package/dist/react-renderer/components/interactive/Slider.mjs.map +0 -1
  376. package/dist/react-renderer/components/interactive/TextField.cjs +0 -74
  377. package/dist/react-renderer/components/interactive/TextField.cjs.map +0 -1
  378. package/dist/react-renderer/components/interactive/TextField.d.cts +0 -14
  379. package/dist/react-renderer/components/interactive/TextField.d.cts.map +0 -1
  380. package/dist/react-renderer/components/interactive/TextField.d.mts +0 -14
  381. package/dist/react-renderer/components/interactive/TextField.d.mts.map +0 -1
  382. package/dist/react-renderer/components/interactive/TextField.mjs +0 -73
  383. package/dist/react-renderer/components/interactive/TextField.mjs.map +0 -1
  384. package/dist/react-renderer/components/layout/Card.cjs +0 -46
  385. package/dist/react-renderer/components/layout/Card.cjs.map +0 -1
  386. package/dist/react-renderer/components/layout/Card.d.cts +0 -21
  387. package/dist/react-renderer/components/layout/Card.d.cts.map +0 -1
  388. package/dist/react-renderer/components/layout/Card.d.mts +0 -21
  389. package/dist/react-renderer/components/layout/Card.d.mts.map +0 -1
  390. package/dist/react-renderer/components/layout/Card.mjs +0 -45
  391. package/dist/react-renderer/components/layout/Card.mjs.map +0 -1
  392. package/dist/react-renderer/components/layout/Column.cjs +0 -43
  393. package/dist/react-renderer/components/layout/Column.cjs.map +0 -1
  394. package/dist/react-renderer/components/layout/Column.d.cts +0 -14
  395. package/dist/react-renderer/components/layout/Column.d.cts.map +0 -1
  396. package/dist/react-renderer/components/layout/Column.d.mts +0 -14
  397. package/dist/react-renderer/components/layout/Column.d.mts.map +0 -1
  398. package/dist/react-renderer/components/layout/Column.mjs +0 -42
  399. package/dist/react-renderer/components/layout/Column.mjs.map +0 -1
  400. package/dist/react-renderer/components/layout/List.cjs +0 -41
  401. package/dist/react-renderer/components/layout/List.cjs.map +0 -1
  402. package/dist/react-renderer/components/layout/List.d.cts +0 -14
  403. package/dist/react-renderer/components/layout/List.d.cts.map +0 -1
  404. package/dist/react-renderer/components/layout/List.d.mts +0 -14
  405. package/dist/react-renderer/components/layout/List.d.mts.map +0 -1
  406. package/dist/react-renderer/components/layout/List.mjs +0 -40
  407. package/dist/react-renderer/components/layout/List.mjs.map +0 -1
  408. package/dist/react-renderer/components/layout/Modal.cjs +0 -92
  409. package/dist/react-renderer/components/layout/Modal.cjs.map +0 -1
  410. package/dist/react-renderer/components/layout/Modal.d.cts +0 -19
  411. package/dist/react-renderer/components/layout/Modal.d.cts.map +0 -1
  412. package/dist/react-renderer/components/layout/Modal.d.mts +0 -19
  413. package/dist/react-renderer/components/layout/Modal.d.mts.map +0 -1
  414. package/dist/react-renderer/components/layout/Modal.mjs +0 -91
  415. package/dist/react-renderer/components/layout/Modal.mjs.map +0 -1
  416. package/dist/react-renderer/components/layout/Row.cjs +0 -43
  417. package/dist/react-renderer/components/layout/Row.cjs.map +0 -1
  418. package/dist/react-renderer/components/layout/Row.d.cts +0 -14
  419. package/dist/react-renderer/components/layout/Row.d.cts.map +0 -1
  420. package/dist/react-renderer/components/layout/Row.d.mts +0 -14
  421. package/dist/react-renderer/components/layout/Row.d.mts.map +0 -1
  422. package/dist/react-renderer/components/layout/Row.mjs +0 -42
  423. package/dist/react-renderer/components/layout/Row.mjs.map +0 -1
  424. package/dist/react-renderer/components/layout/Tabs.cjs +0 -47
  425. package/dist/react-renderer/components/layout/Tabs.cjs.map +0 -1
  426. package/dist/react-renderer/components/layout/Tabs.d.cts +0 -12
  427. package/dist/react-renderer/components/layout/Tabs.d.cts.map +0 -1
  428. package/dist/react-renderer/components/layout/Tabs.d.mts +0 -12
  429. package/dist/react-renderer/components/layout/Tabs.d.mts.map +0 -1
  430. package/dist/react-renderer/components/layout/Tabs.mjs +0 -46
  431. package/dist/react-renderer/components/layout/Tabs.mjs.map +0 -1
  432. package/dist/react-renderer/core/A2UIViewer.cjs +0 -11
  433. package/dist/react-renderer/core/A2UIViewer.d.cts +0 -16
  434. package/dist/react-renderer/core/A2UIViewer.d.cts.map +0 -1
  435. package/dist/react-renderer/core/A2UIViewer.d.mts +0 -16
  436. package/dist/react-renderer/core/A2UIViewer.d.mts.map +0 -1
  437. package/dist/react-renderer/core/A2UIViewer.mjs +0 -11
  438. package/dist/react-renderer/core/ComponentNode.cjs +0 -53
  439. package/dist/react-renderer/core/ComponentNode.cjs.map +0 -1
  440. package/dist/react-renderer/core/ComponentNode.d.cts +0 -29
  441. package/dist/react-renderer/core/ComponentNode.d.cts.map +0 -1
  442. package/dist/react-renderer/core/ComponentNode.d.mts +0 -29
  443. package/dist/react-renderer/core/ComponentNode.d.mts.map +0 -1
  444. package/dist/react-renderer/core/ComponentNode.mjs +0 -52
  445. package/dist/react-renderer/core/ComponentNode.mjs.map +0 -1
  446. package/dist/react-renderer/hooks/useA2UIComponent.cjs +0 -173
  447. package/dist/react-renderer/hooks/useA2UIComponent.cjs.map +0 -1
  448. package/dist/react-renderer/hooks/useA2UIComponent.d.cts +0 -56
  449. package/dist/react-renderer/hooks/useA2UIComponent.d.cts.map +0 -1
  450. package/dist/react-renderer/hooks/useA2UIComponent.d.mts +0 -56
  451. package/dist/react-renderer/hooks/useA2UIComponent.d.mts.map +0 -1
  452. package/dist/react-renderer/hooks/useA2UIComponent.mjs +0 -172
  453. package/dist/react-renderer/hooks/useA2UIComponent.mjs.map +0 -1
  454. package/dist/react-renderer/registry/ComponentRegistry.cjs +0 -114
  455. package/dist/react-renderer/registry/ComponentRegistry.cjs.map +0 -1
  456. package/dist/react-renderer/registry/ComponentRegistry.d.cts +0 -82
  457. package/dist/react-renderer/registry/ComponentRegistry.d.cts.map +0 -1
  458. package/dist/react-renderer/registry/ComponentRegistry.d.mts +0 -82
  459. package/dist/react-renderer/registry/ComponentRegistry.d.mts.map +0 -1
  460. package/dist/react-renderer/registry/ComponentRegistry.mjs +0 -113
  461. package/dist/react-renderer/registry/ComponentRegistry.mjs.map +0 -1
  462. package/dist/react-renderer/registry/defaultCatalog.cjs +0 -58
  463. package/dist/react-renderer/registry/defaultCatalog.cjs.map +0 -1
  464. package/dist/react-renderer/registry/defaultCatalog.d.cts +0 -17
  465. package/dist/react-renderer/registry/defaultCatalog.d.cts.map +0 -1
  466. package/dist/react-renderer/registry/defaultCatalog.d.mts +0 -17
  467. package/dist/react-renderer/registry/defaultCatalog.d.mts.map +0 -1
  468. package/dist/react-renderer/registry/defaultCatalog.mjs +0 -57
  469. package/dist/react-renderer/registry/defaultCatalog.mjs.map +0 -1
  470. package/dist/react-renderer/styles/reset.cjs +0 -29
  471. package/dist/react-renderer/styles/reset.cjs.map +0 -1
  472. package/dist/react-renderer/styles/reset.mjs +0 -28
  473. package/dist/react-renderer/styles/reset.mjs.map +0 -1
  474. package/dist/react-renderer/theme/litTheme.cjs +0 -386
  475. package/dist/react-renderer/theme/litTheme.cjs.map +0 -1
  476. package/dist/react-renderer/theme/litTheme.d.cts +0 -12
  477. package/dist/react-renderer/theme/litTheme.d.cts.map +0 -1
  478. package/dist/react-renderer/theme/litTheme.d.mts +0 -12
  479. package/dist/react-renderer/theme/litTheme.d.mts.map +0 -1
  480. package/dist/react-renderer/theme/litTheme.mjs +0 -384
  481. package/dist/react-renderer/theme/litTheme.mjs.map +0 -1
  482. package/dist/react-renderer/theme/utils.cjs +0 -41
  483. package/dist/react-renderer/theme/utils.cjs.map +0 -1
  484. package/dist/react-renderer/theme/utils.d.cts +0 -26
  485. package/dist/react-renderer/theme/utils.d.cts.map +0 -1
  486. package/dist/react-renderer/theme/utils.d.mts +0 -26
  487. package/dist/react-renderer/theme/utils.d.mts.map +0 -1
  488. package/dist/react-renderer/theme/utils.mjs +0 -39
  489. package/dist/react-renderer/theme/utils.mjs.map +0 -1
  490. package/dist/theme/viewer-theme.cjs +0 -395
  491. package/dist/theme/viewer-theme.cjs.map +0 -1
  492. package/dist/theme/viewer-theme.d.cts +0 -7
  493. package/dist/theme/viewer-theme.d.cts.map +0 -1
  494. package/dist/theme/viewer-theme.d.mts +0 -7
  495. package/dist/theme/viewer-theme.d.mts.map +0 -1
  496. package/dist/theme/viewer-theme.mjs +0 -394
  497. package/dist/theme/viewer-theme.mjs.map +0 -1
package/dist/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function(global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@a2ui/lit/0.8'), require('react/jsx-runtime'), require('clsx'), require('markdown-it'), require('@a2ui/lit')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@a2ui/lit/0.8', 'react/jsx-runtime', 'clsx', 'markdown-it', '@a2ui/lit'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitA2UIRenderer = {}), global.React,global.A2UILit,global.React,global.clsx,global.markdownit,global.A2UILit));
5
- })(this, function(exports, react, _a2ui_lit_0_8, react_jsx_runtime, clsx, markdown_it, _a2ui_lit) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@a2ui/web_core/v0_9'), require('react/jsx-runtime'), require('@a2ui/web_core/v0_9/basic_catalog'), require('zod'), require('clsx'), require('zod-to-json-schema')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@a2ui/web_core/v0_9', 'react/jsx-runtime', '@a2ui/web_core/v0_9/basic_catalog', 'zod', 'clsx', 'zod-to-json-schema'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitA2UIRenderer = {}), global.React,global._a2ui_web_core_v0_9,global.React,global._a2ui_web_core_v0_9_basic_catalog,global.Zod,global.clsx,global.zod_to_json_schema));
5
+ })(this, function(exports, react, _a2ui_web_core_v0_9, react_jsx_runtime, _a2ui_web_core_v0_9_basic_catalog, zod, clsx, zod_to_json_schema) {
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7
7
  //#region \0rolldown/runtime.js
8
8
  var __create = Object.create;
@@ -32,3055 +32,2015 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
32
32
 
33
33
  //#endregion
34
34
  react = __toESM(react);
35
- markdown_it = __toESM(markdown_it);
36
35
 
37
- //#region src/react-renderer/theme/litTheme.ts
36
+ //#region src/react-renderer/a2ui-react/A2uiSurface.tsx
38
37
  /**
39
- * Default theme for A2UI React components.
38
+ * Copyright 2026 Google LLC
40
39
  *
41
- * This theme uses the same CSS class conventions as the Lit renderer,
42
- * ensuring visual consistency between React and Lit implementations.
40
+ * Licensed under the Apache License, Version 2.0 (the "License");
41
+ * you may not use this file except in compliance with the License.
42
+ * You may obtain a copy of the License at
43
43
  *
44
- * IMPORTANT: This theme must be kept in sync with the Lit renderer's internal
45
- * styling. If Lit components change their class maps, this file must be updated
46
- * to match. Ideally, Lit would export its default theme for direct import.
44
+ * http://www.apache.org/licenses/LICENSE-2.0
47
45
  *
48
- * Requires the structural styles to be injected:
49
- * @example
50
- * ```tsx
51
- * import { A2UIProvider } from '@a2ui/react';
52
- * import { injectStyles } from '@a2ui/react/styles';
53
- *
54
- * // Inject structural CSS at app startup
55
- * injectStyles();
56
- *
57
- * function App() {
58
- * return (
59
- * <A2UIProvider>
60
- * <A2UIRenderer surfaceId="main" />
61
- * </A2UIProvider>
62
- * );
63
- * }
64
- * ```
46
+ * Unless required by applicable law or agreed to in writing, software
47
+ * distributed under the License is distributed on an "AS IS" BASIS,
48
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49
+ * See the License for the specific language governing permissions and
50
+ * limitations under the License.
65
51
  */
66
- const elementA = {
67
- "typography-f-sf": true,
68
- "typography-fs-n": true,
69
- "typography-w-500": true,
70
- "layout-as-n": true,
71
- "layout-dis-iflx": true,
72
- "layout-al-c": true,
73
- "typography-td-none": true,
74
- "color-c-p40": true
75
- };
76
- const elementAudio = { "layout-w-100": true };
77
- const elementBody = {
78
- "typography-f-s": true,
79
- "typography-fs-n": true,
80
- "typography-w-400": true,
81
- "layout-mt-0": true,
82
- "layout-mb-2": true,
83
- "typography-sz-bm": true,
84
- "color-c-n10": true
85
- };
86
- const elementButton = {
87
- "typography-f-sf": true,
88
- "typography-fs-n": true,
89
- "typography-w-500": true,
90
- "layout-pt-3": true,
91
- "layout-pb-3": true,
92
- "layout-pl-5": true,
93
- "layout-pr-5": true,
94
- "layout-mb-1": true,
95
- "border-br-16": true,
96
- "border-bw-0": true,
97
- "border-c-n70": true,
98
- "border-bs-s": true,
99
- "color-bgc-s30": true,
100
- "behavior-ho-80": true
101
- };
102
- const elementHeading = {
103
- "typography-f-sf": true,
104
- "typography-fs-n": true,
105
- "typography-w-500": true,
106
- "layout-mt-0": true,
107
- "layout-mb-2": true
108
- };
109
- const elementIframe = { "behavior-sw-n": true };
110
- const elementInput = {
111
- "typography-f-sf": true,
112
- "typography-fs-n": true,
113
- "typography-w-400": true,
114
- "layout-pl-4": true,
115
- "layout-pr-4": true,
116
- "layout-pt-2": true,
117
- "layout-pb-2": true,
118
- "border-br-6": true,
119
- "border-bw-1": true,
120
- "color-bc-s70": true,
121
- "border-bs-s": true,
122
- "layout-as-n": true,
123
- "color-c-n10": true
124
- };
125
- const elementP = {
126
- "typography-f-s": true,
127
- "typography-fs-n": true,
128
- "typography-w-400": true,
129
- "layout-m-0": true,
130
- "typography-sz-bm": true,
131
- "layout-as-n": true,
132
- "color-c-n10": true
133
- };
134
- const elementList = {
135
- "typography-f-s": true,
136
- "typography-fs-n": true,
137
- "typography-w-400": true,
138
- "layout-m-0": true,
139
- "typography-sz-bm": true,
140
- "layout-as-n": true,
141
- "color-c-n10": true
142
- };
143
- const elementPre = {
144
- "typography-f-c": true,
145
- "typography-fs-n": true,
146
- "typography-w-400": true,
147
- "typography-sz-bm": true,
148
- "typography-ws-p": true,
149
- "layout-as-n": true
150
- };
151
- const elementTextarea = {
152
- ...elementInput,
153
- "layout-r-none": true,
154
- "layout-fs-c": true
155
- };
156
- const elementVideo = { "layout-el-cv": true };
157
- const litTheme = {
158
- additionalStyles: {
159
- Button: {
160
- background: "var(--primary, oklch(0.205 0 0))",
161
- color: "var(--primary-foreground, oklch(0.985 0 0))",
162
- "border-radius": "calc(var(--radius, 0.625rem) - 2px)",
163
- cursor: "pointer",
164
- width: "100%",
165
- "--n-10": "var(--primary-foreground, oklch(0.985 0 0))",
166
- "--n-35": "var(--primary-foreground, oklch(0.985 0 0))",
167
- "--n-60": "var(--primary-foreground, oklch(0.985 0 0))"
168
- },
169
- Card: {
170
- background: "var(--card, oklch(1 0 0))",
171
- border: "1px solid var(--border, oklch(0.922 0 0))",
172
- "border-radius": "var(--radius, 0.625rem)"
173
- },
174
- TextField: {
175
- "background-color": "var(--background, oklch(1 0 0))",
176
- "border-color": "var(--input, oklch(0.922 0 0))",
177
- color: "var(--foreground, oklch(0.145 0 0))",
178
- "border-radius": "var(--radius, 0.625rem)"
179
- },
180
- CheckBox: {
181
- "--p-100": "var(--background, oklch(1 0 0))",
182
- "--p-60": "var(--input, oklch(0.922 0 0))",
183
- "--n-30": "var(--foreground, oklch(0.145 0 0))"
184
- },
185
- DateTimeInput: {
186
- "background-color": "var(--background, oklch(1 0 0))",
187
- "border-color": "var(--input, oklch(0.922 0 0))",
188
- color: "var(--foreground, oklch(0.145 0 0))",
189
- "border-radius": "var(--radius, 0.625rem)"
190
- },
191
- Modal: {
192
- "--p-100": "var(--card, oklch(1 0 0))",
193
- "--p-80": "var(--border, oklch(0.922 0 0))",
194
- "border-radius": "var(--radius, 0.625rem)"
195
- },
196
- Text: { color: "var(--foreground, oklch(0.145 0 0))" }
197
- },
198
- components: {
199
- AudioPlayer: {},
200
- Divider: {},
201
- Icon: {},
202
- Image: {
203
- all: {
204
- "border-br-5": true,
205
- "layout-el-cv": true,
206
- "layout-w-100": true,
207
- "layout-h-100": true
208
- },
209
- avatar: { "is-avatar": true },
210
- header: {},
211
- icon: {},
212
- largeFeature: {},
213
- mediumFeature: {},
214
- smallFeature: {}
215
- },
216
- Text: {
217
- all: {
218
- "layout-w-100": true,
219
- "layout-g-2": true
220
- },
221
- h1: {
222
- "typography-f-sf": true,
223
- "typography-v-r": true,
224
- "typography-w-400": true,
225
- "layout-m-0": true,
226
- "layout-p-0": true,
227
- "typography-sz-hs": true
228
- },
229
- h2: {
230
- "typography-f-sf": true,
231
- "typography-v-r": true,
232
- "typography-w-400": true,
233
- "layout-m-0": true,
234
- "layout-p-0": true,
235
- "typography-sz-tl": true
236
- },
237
- h3: {
238
- "typography-f-sf": true,
239
- "typography-v-r": true,
240
- "typography-w-400": true,
241
- "layout-m-0": true,
242
- "layout-p-0": true,
243
- "typography-sz-tl": true
244
- },
245
- h4: {
246
- "typography-f-sf": true,
247
- "typography-v-r": true,
248
- "typography-w-400": true,
249
- "layout-m-0": true,
250
- "layout-p-0": true,
251
- "typography-sz-bl": true
252
- },
253
- h5: {
254
- "typography-f-sf": true,
255
- "typography-v-r": true,
256
- "typography-w-400": true,
257
- "layout-m-0": true,
258
- "layout-p-0": true,
259
- "typography-sz-bm": true
260
- },
261
- body: {},
262
- caption: {}
263
- },
264
- Video: {
265
- "border-br-5": true,
266
- "layout-el-cv": true
267
- },
268
- Card: {
269
- "border-br-9": true,
270
- "layout-p-4": true,
271
- "color-bgc-n100": true
272
- },
273
- Column: { "layout-g-2": true },
274
- List: {
275
- "layout-g-4": true,
276
- "layout-p-2": true
277
- },
278
- Modal: {
279
- backdrop: { "color-bbgc-p60_20": true },
280
- element: {
281
- "border-br-2": true,
282
- "color-bgc-p100": true,
283
- "layout-p-4": true,
284
- "border-bw-1": true,
285
- "border-bs-s": true,
286
- "color-bc-p80": true
287
- }
288
- },
289
- Row: { "layout-g-4": true },
290
- Tabs: {
291
- container: {},
292
- controls: {
293
- all: {},
294
- selected: {}
295
- },
296
- element: {}
297
- },
298
- Button: {
299
- "layout-pt-2": true,
300
- "layout-pb-2": true,
301
- "layout-pl-3": true,
302
- "layout-pr-3": true,
303
- "border-bw-0": true,
304
- "border-bs-s": true,
305
- "typography-w-400": true
306
- },
307
- CheckBox: {
308
- container: {
309
- "layout-dsp-iflex": true,
310
- "layout-al-c": true
311
- },
312
- element: {
313
- "layout-m-0": true,
314
- "layout-mr-2": true,
315
- "layout-p-2": true,
316
- "border-br-2": true,
317
- "border-bw-1": true,
318
- "border-bs-s": true,
319
- "color-bgc-p100": true,
320
- "color-bc-p60": true,
321
- "color-c-n30": true
322
- },
323
- label: {
324
- "typography-f-sf": true,
325
- "typography-v-r": true,
326
- "typography-w-400": true,
327
- "layout-flx-1": true,
328
- "typography-sz-ll": true
329
- }
330
- },
331
- DateTimeInput: {
332
- container: {
333
- "typography-sz-bm": true,
334
- "layout-w-100": true,
335
- "layout-g-2": true,
336
- "layout-dsp-flexvert": true
337
- },
338
- label: {
339
- "color-c-p30": true,
340
- "typography-sz-bm": true
52
+ const ResolvedChild = (0, react.memo)(({ surface, id, basePath, compImpl, componentModel }) => {
53
+ const ComponentToRender = compImpl.render;
54
+ const context = (0, react.useMemo)(() => new _a2ui_web_core_v0_9.ComponentContext(surface, id, basePath), [
55
+ surface,
56
+ id,
57
+ basePath,
58
+ componentModel
59
+ ]);
60
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentToRender, {
61
+ context,
62
+ buildChild: (0, react.useCallback)((childId, specificPath) => {
63
+ const path = specificPath || context.dataContext.path;
64
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeferredChild, {
65
+ surface,
66
+ id: childId,
67
+ basePath: path
68
+ }, `${childId}-${path}`);
69
+ }, [surface, context.dataContext.path])
70
+ });
71
+ });
72
+ ResolvedChild.displayName = "ResolvedChild";
73
+ const DeferredChild = (0, react.memo)(({ surface, id, basePath }) => {
74
+ const store = (0, react.useMemo)(() => {
75
+ let version = 0;
76
+ return {
77
+ subscribe: (cb) => {
78
+ const unsub1 = surface.componentsModel.onCreated.subscribe((comp) => {
79
+ if (comp.id === id) {
80
+ version++;
81
+ cb();
82
+ }
83
+ });
84
+ const unsub2 = surface.componentsModel.onDeleted.subscribe((delId) => {
85
+ if (delId === id) {
86
+ version++;
87
+ cb();
88
+ }
89
+ });
90
+ return () => {
91
+ unsub1.unsubscribe();
92
+ unsub2.unsubscribe();
93
+ };
341
94
  },
342
- element: {
343
- "layout-pt-2": true,
344
- "layout-pb-2": true,
345
- "layout-pl-3": true,
346
- "layout-pr-3": true,
347
- "border-bw-1": true,
348
- "border-bs-s": true
95
+ getSnapshot: () => {
96
+ const comp = surface.componentsModel.get(id);
97
+ return comp ? `${comp.type}-${version}` : `missing-${version}`;
349
98
  }
99
+ };
100
+ }, [surface, id]);
101
+ (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot);
102
+ const componentModel = surface.componentsModel.get(id);
103
+ if (!componentModel) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
104
+ style: {
105
+ padding: "12px 16px",
106
+ borderRadius: "8px",
107
+ background: "linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)",
108
+ backgroundSize: "200% 100%",
109
+ animation: "a2ui-shimmer 1.5s ease-in-out infinite",
110
+ minHeight: "2rem"
350
111
  },
351
- MultipleChoice: {
352
- container: {},
353
- label: {},
354
- element: {}
355
- },
356
- Slider: {
357
- container: {},
358
- label: {},
359
- element: {}
360
- },
361
- TextField: {
362
- container: {
363
- "typography-sz-bm": true,
364
- "layout-w-100": true,
365
- "layout-g-2": true,
366
- "layout-dsp-flexvert": true
367
- },
368
- label: { "layout-flx-0": true },
369
- element: {
370
- "typography-sz-bm": true,
371
- "layout-pt-2": true,
372
- "layout-pb-2": true,
373
- "layout-pl-3": true,
374
- "layout-pr-3": true,
375
- "border-bw-1": true,
376
- "border-bs-s": true
377
- }
378
- }
379
- },
380
- elements: {
381
- a: elementA,
382
- audio: elementAudio,
383
- body: elementBody,
384
- button: elementButton,
385
- h1: elementHeading,
386
- h2: elementHeading,
387
- h3: elementHeading,
388
- h4: elementHeading,
389
- h5: elementHeading,
390
- iframe: elementIframe,
391
- input: elementInput,
392
- p: elementP,
393
- pre: elementPre,
394
- textarea: elementTextarea,
395
- video: elementVideo
396
- },
397
- markdown: {
398
- p: Object.keys(elementP),
399
- h1: Object.keys(elementHeading),
400
- h2: Object.keys(elementHeading),
401
- h3: Object.keys(elementHeading),
402
- h4: Object.keys(elementHeading),
403
- h5: Object.keys(elementHeading),
404
- ul: Object.keys(elementList),
405
- ol: Object.keys(elementList),
406
- li: Object.keys(elementList),
407
- a: Object.keys(elementA),
408
- strong: [],
409
- em: ["typography-fs-n"]
410
- }
112
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: `@keyframes a2ui-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }` })
113
+ });
114
+ const compImpl = surface.catalog.components.get(componentModel.type);
115
+ if (!compImpl) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
116
+ style: { color: "red" },
117
+ children: ["Unknown component: ", componentModel.type]
118
+ });
119
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResolvedChild, {
120
+ surface,
121
+ id,
122
+ basePath,
123
+ componentModel,
124
+ compImpl
125
+ });
126
+ });
127
+ DeferredChild.displayName = "DeferredChild";
128
+ const A2uiSurface = ({ surface }) => {
129
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeferredChild, {
130
+ surface,
131
+ id: "root",
132
+ basePath: "/"
133
+ });
411
134
  };
412
- /**
413
- * Alias for litTheme - the default theme for A2UI React components.
414
- * @see litTheme
415
- */
416
- const defaultTheme = litTheme;
417
135
 
418
136
  //#endregion
419
- //#region src/react-renderer/theme/ThemeContext.tsx
137
+ //#region src/react-renderer/a2ui-react/adapter.tsx
420
138
  /**
421
- * React context for the A2UI theme.
139
+ * Copyright 2026 Google LLC
140
+ *
141
+ * Licensed under the Apache License, Version 2.0 (the "License");
142
+ * you may not use this file except in compliance with the License.
143
+ * You may obtain a copy of the License at
144
+ *
145
+ * http://www.apache.org/licenses/LICENSE-2.0
146
+ *
147
+ * Unless required by applicable law or agreed to in writing, software
148
+ * distributed under the License is distributed on an "AS IS" BASIS,
149
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
150
+ * See the License for the specific language governing permissions and
151
+ * limitations under the License.
422
152
  */
423
- const ThemeContext = (0, react.createContext)(void 0);
424
153
  /**
425
- * Provider component that makes the A2UI theme available to descendant components.
154
+ * Creates a React component implementation using the deep generic binder.
426
155
  */
427
- function ThemeProvider({ theme, children }) {
428
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeContext.Provider, {
429
- value: theme !== null && theme !== void 0 ? theme : defaultTheme,
430
- children
156
+ function createReactComponent(api, RenderComponent) {
157
+ const MemoizedRender = (0, react.memo)(RenderComponent, (prev, next) => {
158
+ if (prev.props !== next.props) return false;
159
+ if (prev.context.componentModel.id !== next.context.componentModel.id) return false;
160
+ if (prev.context.dataContext.path !== next.context.dataContext.path) return false;
161
+ return true;
431
162
  });
163
+ const ReactWrapper = ({ context, buildChild }) => {
164
+ const bindingRef = (0, react.useRef)(null);
165
+ if (!bindingRef.current) bindingRef.current = new _a2ui_web_core_v0_9.GenericBinder(context, api.schema);
166
+ else if (bindingRef.current.context !== context) {
167
+ bindingRef.current.dispose();
168
+ bindingRef.current = new _a2ui_web_core_v0_9.GenericBinder(context, api.schema);
169
+ }
170
+ const binding = bindingRef.current;
171
+ const props = (0, react.useSyncExternalStore)((0, react.useCallback)((callback) => {
172
+ const sub = binding.subscribe(callback);
173
+ return () => sub.unsubscribe();
174
+ }, [binding]), (0, react.useCallback)(() => binding.snapshot, [binding]));
175
+ (0, react.useEffect)(() => {
176
+ return () => binding.dispose();
177
+ }, [binding]);
178
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedRender, {
179
+ props: props || {},
180
+ buildChild,
181
+ context
182
+ });
183
+ };
184
+ return {
185
+ name: api.name,
186
+ schema: api.schema,
187
+ render: ReactWrapper
188
+ };
432
189
  }
433
- /**
434
- * Hook to access the current A2UI theme.
190
+
191
+ //#endregion
192
+ //#region src/react-renderer/a2ui-react/catalog/basic/utils.ts
193
+ /** Standard leaf margin from the implementation guide. */
194
+ const LEAF_MARGIN = "8px";
195
+ /** Standard internal padding for visually bounded containers. */
196
+ const CONTAINER_PADDING = "16px";
197
+ /** Standard border for cards and inputs. */
198
+ const STANDARD_BORDER = "1px solid #ccc";
199
+ /** Standard border radius. */
200
+ const STANDARD_RADIUS = "8px";
201
+ const mapJustify$2 = (j) => {
202
+ switch (j) {
203
+ case "center": return "center";
204
+ case "end": return "flex-end";
205
+ case "spaceAround": return "space-around";
206
+ case "spaceBetween": return "space-between";
207
+ case "spaceEvenly": return "space-evenly";
208
+ case "start": return "flex-start";
209
+ case "stretch": return "stretch";
210
+ default: return "flex-start";
211
+ }
212
+ };
213
+ const mapAlign$2 = (a) => {
214
+ switch (a) {
215
+ case "start": return "flex-start";
216
+ case "center": return "center";
217
+ case "end": return "flex-end";
218
+ case "stretch": return "stretch";
219
+ default: return "stretch";
220
+ }
221
+ };
222
+ const getBaseLeafStyle = () => ({
223
+ margin: LEAF_MARGIN,
224
+ boxSizing: "border-box"
225
+ });
226
+ const getBaseContainerStyle = () => ({
227
+ margin: LEAF_MARGIN,
228
+ padding: CONTAINER_PADDING,
229
+ border: STANDARD_BORDER,
230
+ borderRadius: STANDARD_RADIUS,
231
+ boxSizing: "border-box"
232
+ });
233
+
234
+ //#endregion
235
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Text.tsx
236
+ /**
237
+ * Copyright 2026 Google LLC
435
238
  *
436
- * @returns The current theme
437
- * @throws If used outside of a ThemeProvider
438
- */
439
- function useTheme() {
440
- const theme = (0, react.useContext)(ThemeContext);
441
- if (!theme) throw new Error("useTheme must be used within a ThemeProvider or A2UIProvider");
442
- return theme;
443
- }
444
- /**
445
- * Hook to optionally access the current A2UI theme.
239
+ * Licensed under the Apache License, Version 2.0 (the "License");
240
+ * you may not use this file except in compliance with the License.
241
+ * You may obtain a copy of the License at
446
242
  *
447
- * @returns The current theme, or undefined if not within a provider
243
+ * http://www.apache.org/licenses/LICENSE-2.0
244
+ *
245
+ * Unless required by applicable law or agreed to in writing, software
246
+ * distributed under the License is distributed on an "AS IS" BASIS,
247
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
248
+ * See the License for the specific language governing permissions and
249
+ * limitations under the License.
448
250
  */
449
- function useThemeOptional() {
450
- return (0, react.useContext)(ThemeContext);
451
- }
251
+ const Text$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.TextApi, ({ props }) => {
252
+ var _props$text;
253
+ const text = (_props$text = props.text) !== null && _props$text !== void 0 ? _props$text : "";
254
+ const style = {
255
+ ...getBaseLeafStyle(),
256
+ display: "inline-block"
257
+ };
258
+ switch (props.variant) {
259
+ case "h1": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
260
+ style,
261
+ children: text
262
+ });
263
+ case "h2": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
264
+ style,
265
+ children: text
266
+ });
267
+ case "h3": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
268
+ style,
269
+ children: text
270
+ });
271
+ case "h4": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
272
+ style,
273
+ children: text
274
+ });
275
+ case "h5": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", {
276
+ style,
277
+ children: text
278
+ });
279
+ case "caption": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
280
+ style: {
281
+ ...style,
282
+ color: "#666",
283
+ textAlign: "left"
284
+ },
285
+ children: text
286
+ });
287
+ default: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
288
+ style,
289
+ children: text
290
+ });
291
+ }
292
+ });
452
293
 
453
294
  //#endregion
454
- //#region src/react-renderer/core/A2UIProvider.tsx
295
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Image.tsx
455
296
  /**
456
- * Context for stable actions (never changes reference, prevents re-renders).
457
- * Components that only need to dispatch actions or read data won't re-render.
458
- */
459
- const A2UIActionsContext = (0, react.createContext)(null);
460
- /**
461
- * Context for reactive state (changes trigger re-renders).
462
- * Only components that need to react to state changes subscribe to this.
463
- */
464
- const A2UIStateContext = (0, react.createContext)(null);
465
- /**
466
- * Provider component that sets up the A2UI context for descendant components.
297
+ * Copyright 2026 Google LLC
467
298
  *
468
- * This provider uses a two-context architecture for performance:
469
- * - A2UIActionsContext: Stable actions that never change (no re-renders)
470
- * - A2UIStateContext: Reactive state that triggers re-renders when needed
299
+ * Licensed under the Apache License, Version 2.0 (the "License");
300
+ * you may not use this file except in compliance with the License.
301
+ * You may obtain a copy of the License at
471
302
  *
472
- * @example
473
- * ```tsx
474
- * function App() {
475
- * const handleAction = async (message) => {
476
- * const response = await fetch('/api/a2ui', {
477
- * method: 'POST',
478
- * body: JSON.stringify(message)
479
- * });
480
- * const newMessages = await response.json();
481
- * };
482
- *
483
- * return (
484
- * <A2UIProvider onAction={handleAction}>
485
- * <A2UIRenderer surfaceId="main" />
486
- * </A2UIProvider>
487
- * );
488
- * }
489
- * ```
303
+ * http://www.apache.org/licenses/LICENSE-2.0
304
+ *
305
+ * Unless required by applicable law or agreed to in writing, software
306
+ * distributed under the License is distributed on an "AS IS" BASIS,
307
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
308
+ * See the License for the specific language governing permissions and
309
+ * limitations under the License.
490
310
  */
491
- function A2UIProvider({ onAction, theme, children }) {
492
- const processorRef = (0, react.useRef)(null);
493
- if (!processorRef.current) processorRef.current = _a2ui_lit_0_8.Data.createSignalA2uiMessageProcessor();
494
- const processor = processorRef.current;
495
- const [version, setVersion] = (0, react.useState)(0);
496
- const onActionRef = (0, react.useRef)(onAction !== null && onAction !== void 0 ? onAction : null);
497
- onActionRef.current = onAction !== null && onAction !== void 0 ? onAction : null;
498
- const actionsRef = (0, react.useRef)(null);
499
- if (!actionsRef.current) actionsRef.current = {
500
- processMessages: (messages) => {
501
- processor.processMessages(messages);
502
- setVersion((v) => v + 1);
503
- },
504
- setData: (node, path, value, surfaceId) => {
505
- processor.setData(node, path, value, surfaceId);
506
- setVersion((v) => v + 1);
507
- },
508
- dispatch: (message) => {
509
- if (onActionRef.current) onActionRef.current(message);
510
- },
511
- clearSurfaces: () => {
512
- processor.clearSurfaces();
513
- setVersion((v) => v + 1);
514
- },
515
- getSurface: (surfaceId) => {
516
- return processor.getSurfaces().get(surfaceId);
517
- },
518
- getSurfaces: () => {
519
- return processor.getSurfaces();
520
- },
521
- getData: (node, path, surfaceId) => {
522
- return processor.getData(node, path, surfaceId);
523
- },
524
- resolvePath: (path, dataContextPath) => {
525
- return processor.resolvePath(path, dataContextPath);
526
- }
311
+ const Image = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ImageApi, ({ props }) => {
312
+ const mapFit = (fit) => {
313
+ if (fit === "scaleDown") return "scale-down";
314
+ return fit || "fill";
527
315
  };
528
- const actions = actionsRef.current;
529
- const stateValue = (0, react.useMemo)(() => ({ version }), [version]);
530
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIActionsContext.Provider, {
531
- value: actions,
532
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIStateContext.Provider, {
533
- value: stateValue,
534
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeProvider, {
535
- theme,
536
- children
537
- })
538
- })
316
+ const style = {
317
+ ...getBaseLeafStyle(),
318
+ objectFit: mapFit(props.fit),
319
+ width: "100%",
320
+ height: "auto",
321
+ display: "block"
322
+ };
323
+ if (props.variant === "icon") {
324
+ style.width = "24px";
325
+ style.height = "24px";
326
+ } else if (props.variant === "avatar") {
327
+ style.width = "40px";
328
+ style.height = "40px";
329
+ style.borderRadius = "50%";
330
+ } else if (props.variant === "smallFeature") style.maxWidth = "100px";
331
+ else if (props.variant === "largeFeature") style.maxHeight = "400px";
332
+ else if (props.variant === "header") {
333
+ style.height = "200px";
334
+ style.objectFit = "cover";
335
+ }
336
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
337
+ src: props.url,
338
+ alt: props.description || "",
339
+ style
539
340
  });
540
- }
541
- /**
542
- * Hook to access stable A2UI actions (won't cause re-renders).
543
- * Use this when you only need to dispatch actions or read data.
341
+ });
342
+
343
+ //#endregion
344
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Icon.tsx
345
+ /**
346
+ * Copyright 2026 Google LLC
544
347
  *
545
- * @returns Stable actions object
546
- * @throws If used outside of an A2UIProvider
547
- */
548
- function useA2UIActions() {
549
- const actions = (0, react.useContext)(A2UIActionsContext);
550
- if (!actions) throw new Error("useA2UIActions must be used within an A2UIProvider");
551
- return actions;
552
- }
553
- /**
554
- * Hook to subscribe to A2UI state changes.
555
- * Components using this will re-render when state changes.
348
+ * Licensed under the Apache License, Version 2.0 (the "License");
349
+ * you may not use this file except in compliance with the License.
350
+ * You may obtain a copy of the License at
556
351
  *
557
- * @returns Current version number
558
- * @throws If used outside of an A2UIProvider
559
- */
560
- function useA2UIState() {
561
- const state = (0, react.useContext)(A2UIStateContext);
562
- if (!state) throw new Error("useA2UIState must be used within an A2UIProvider");
563
- return state;
564
- }
565
- /**
566
- * Hook to access the full A2UI context (actions + state).
567
- * Components using this will re-render when state changes.
352
+ * http://www.apache.org/licenses/LICENSE-2.0
568
353
  *
569
- * @returns The A2UI context value
570
- * @throws If used outside of an A2UIProvider
354
+ * Unless required by applicable law or agreed to in writing, software
355
+ * distributed under the License is distributed on an "AS IS" BASIS,
356
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
357
+ * See the License for the specific language governing permissions and
358
+ * limitations under the License.
571
359
  */
572
- function useA2UIContext() {
573
- const actions = useA2UIActions();
574
- const state = useA2UIState();
575
- return (0, react.useMemo)(() => ({
576
- ...actions,
577
- processor: null,
578
- version: state.version,
579
- onAction: null
580
- }), [actions, state.version]);
581
- }
582
- /**
583
- * @deprecated Use useA2UIContext instead. This alias exists for backward compatibility only.
584
- */
585
- const useA2UIStore = useA2UIContext;
586
- /**
587
- * @deprecated This selector pattern does not provide performance benefits with React Context.
588
- * Components will re-render on any context change regardless of what you select.
589
- * Use useA2UIContext() or useA2UI() directly instead.
360
+ const Icon = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.IconApi, ({ props }) => {
361
+ var _props$name;
362
+ const iconName = typeof props.name === "string" ? props.name : (_props$name = props.name) === null || _props$name === void 0 ? void 0 : _props$name.path;
363
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
364
+ className: "material-symbols-outlined",
365
+ style: {
366
+ ...getBaseLeafStyle(),
367
+ fontSize: "24px",
368
+ width: "24px",
369
+ height: "24px",
370
+ display: "inline-flex",
371
+ alignItems: "center",
372
+ justifyContent: "center"
373
+ },
374
+ children: iconName
375
+ });
376
+ });
377
+
378
+ //#endregion
379
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Video.tsx
380
+ /**
381
+ * Copyright 2026 Google LLC
590
382
  *
591
- * @param selector - Function to select a slice of state
592
- * @returns The selected state
383
+ * Licensed under the Apache License, Version 2.0 (the "License");
384
+ * you may not use this file except in compliance with the License.
385
+ * You may obtain a copy of the License at
386
+ *
387
+ * http://www.apache.org/licenses/LICENSE-2.0
388
+ *
389
+ * Unless required by applicable law or agreed to in writing, software
390
+ * distributed under the License is distributed on an "AS IS" BASIS,
391
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
392
+ * See the License for the specific language governing permissions and
393
+ * limitations under the License.
593
394
  */
594
- function useA2UIStoreSelector(selector) {
595
- return selector(useA2UIContext());
596
- }
395
+ const Video = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.VideoApi, ({ props }) => {
396
+ const style = {
397
+ ...getBaseLeafStyle(),
398
+ width: "100%",
399
+ aspectRatio: "16/9"
400
+ };
401
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("video", {
402
+ src: props.url,
403
+ controls: true,
404
+ style
405
+ });
406
+ });
597
407
 
598
408
  //#endregion
599
- //#region src/react-renderer/hooks/useA2UI.ts
409
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.tsx
600
410
  /**
601
- * Main API hook for A2UI. Provides methods to process messages
602
- * and access surface state.
411
+ * Copyright 2026 Google LLC
603
412
  *
604
- * Note: This hook subscribes to state changes. Components using this
605
- * will re-render when the A2UI state changes. For action-only usage
606
- * (no re-renders), use useA2UIActions() instead.
413
+ * Licensed under the Apache License, Version 2.0 (the "License");
414
+ * you may not use this file except in compliance with the License.
415
+ * You may obtain a copy of the License at
607
416
  *
608
- * @returns Object with message processing and surface access methods
417
+ * http://www.apache.org/licenses/LICENSE-2.0
609
418
  *
610
- * @example
611
- * ```tsx
612
- * function ChatApp() {
613
- * const { processMessages, getSurface } = useA2UI();
614
- *
615
- * useEffect(() => {
616
- * const ws = new WebSocket('wss://agent.example.com');
617
- * ws.onmessage = (event) => {
618
- * const messages = JSON.parse(event.data);
619
- * processMessages(messages);
620
- * };
621
- * return () => ws.close();
622
- * }, [processMessages]);
623
- *
624
- * return <A2UIRenderer surfaceId="main" />;
625
- * }
626
- * ```
419
+ * Unless required by applicable law or agreed to in writing, software
420
+ * distributed under the License is distributed on an "AS IS" BASIS,
421
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
422
+ * See the License for the specific language governing permissions and
423
+ * limitations under the License.
627
424
  */
628
- function useA2UI() {
629
- const actions = useA2UIActions();
630
- const state = useA2UIState();
631
- return {
632
- processMessages: actions.processMessages,
633
- getSurface: actions.getSurface,
634
- getSurfaces: actions.getSurfaces,
635
- clearSurfaces: actions.clearSurfaces,
636
- version: state.version
425
+ const AudioPlayer = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.AudioPlayerApi, ({ props }) => {
426
+ const style = {
427
+ ...getBaseLeafStyle(),
428
+ width: "100%"
637
429
  };
638
- }
430
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
431
+ style: {
432
+ display: "flex",
433
+ flexDirection: "column",
434
+ gap: "4px",
435
+ width: "100%"
436
+ },
437
+ children: [props.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
438
+ style: {
439
+ fontSize: "12px",
440
+ color: "#666"
441
+ },
442
+ children: props.description
443
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("audio", {
444
+ src: props.url,
445
+ controls: true,
446
+ style
447
+ })]
448
+ });
449
+ });
639
450
 
640
451
  //#endregion
641
- //#region src/react-renderer/registry/ComponentRegistry.ts
452
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/ChildList.tsx
642
453
  /**
643
- * Registry for A2UI components. Allows registration of custom components
644
- * and supports lazy loading for code splitting.
645
- *
646
- * @example
647
- * ```tsx
648
- * const registry = new ComponentRegistry();
454
+ * Copyright 2026 Google LLC
649
455
  *
650
- * // Register a component directly
651
- * registry.register('Text', { component: Text });
456
+ * Licensed under the Apache License, Version 2.0 (the "License");
457
+ * you may not use this file except in compliance with the License.
458
+ * You may obtain a copy of the License at
652
459
  *
653
- * // Register with lazy loading
654
- * registry.register('Modal', {
655
- * component: () => import('./components/Modal'),
656
- * lazy: true
657
- * });
460
+ * http://www.apache.org/licenses/LICENSE-2.0
658
461
  *
659
- * // Use with A2UIRenderer
660
- * <A2UIRenderer surfaceId="main" registry={registry} />
661
- * ```
462
+ * Unless required by applicable law or agreed to in writing, software
463
+ * distributed under the License is distributed on an "AS IS" BASIS,
464
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
465
+ * See the License for the specific language governing permissions and
466
+ * limitations under the License.
662
467
  */
663
- var ComponentRegistry = class ComponentRegistry {
664
- constructor() {
665
- this.registry = /* @__PURE__ */ new Map();
666
- this.lazyCache = /* @__PURE__ */ new Map();
667
- }
668
- /**
669
- * Get the singleton instance of the registry.
670
- * Use this for the default global registry.
671
- */
672
- static getInstance() {
673
- if (!ComponentRegistry._instance) ComponentRegistry._instance = new ComponentRegistry();
674
- return ComponentRegistry._instance;
675
- }
676
- /**
677
- * Reset the singleton instance.
678
- * Useful for testing.
679
- */
680
- static resetInstance() {
681
- ComponentRegistry._instance = null;
682
- }
683
- /**
684
- * Register a component type.
685
- *
686
- * @param type - The A2UI component type name (e.g., 'Text', 'Button')
687
- * @param registration - The component registration
688
- */
689
- register(type, registration) {
690
- this.registry.set(type, registration);
691
- }
692
- /**
693
- * Unregister a component type.
694
- *
695
- * @param type - The component type to unregister
696
- */
697
- unregister(type) {
698
- this.registry.delete(type);
699
- this.lazyCache.delete(type);
700
- }
701
- /**
702
- * Check if a component type is registered.
703
- *
704
- * @param type - The component type to check
705
- * @returns True if the component is registered
706
- */
707
- has(type) {
708
- return this.registry.has(type);
709
- }
710
- /**
711
- * Get a component by type. If the component is registered with lazy loading,
712
- * returns a React.lazy wrapped component.
713
- *
714
- * @param type - The component type to get
715
- * @returns The React component, or null if not found
716
- */
717
- get(type) {
718
- const registration = this.registry.get(type);
719
- if (!registration) return null;
720
- if (registration.lazy && typeof registration.component === "function") {
721
- const cached = this.lazyCache.get(type);
722
- if (cached) return cached;
723
- const lazyComponent = (0, react.lazy)(registration.component);
724
- this.lazyCache.set(type, lazyComponent);
725
- return lazyComponent;
468
+ const ChildList$1 = ({ childList, buildChild }) => {
469
+ if (Array.isArray(childList)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: childList.map((item, i) => {
470
+ if (item && typeof item === "object" && "id" in item) {
471
+ const node = item;
472
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: buildChild(node.id, node.basePath) }, `${node.id}-${i}`);
726
473
  }
727
- return registration.component;
728
- }
729
- /**
730
- * Get all registered component types.
731
- *
732
- * @returns Array of registered type names
733
- */
734
- getRegisteredTypes() {
735
- return Array.from(this.registry.keys());
736
- }
737
- /**
738
- * Clear all registrations.
739
- */
740
- clear() {
741
- this.registry.clear();
742
- this.lazyCache.clear();
743
- }
474
+ if (typeof item === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: buildChild(item) }, `${item}-${i}`);
475
+ return null;
476
+ }) });
477
+ return null;
744
478
  };
745
- ComponentRegistry._instance = null;
746
479
 
747
480
  //#endregion
748
- //#region src/react-renderer/core/ComponentNode.tsx
749
- /** Memoized loading fallback to avoid recreating on each render */
750
- const LoadingFallback = (0, react.memo)(function LoadingFallback() {
481
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Row.tsx
482
+ /**
483
+ * Copyright 2026 Google LLC
484
+ *
485
+ * Licensed under the Apache License, Version 2.0 (the "License");
486
+ * you may not use this file except in compliance with the License.
487
+ * You may obtain a copy of the License at
488
+ *
489
+ * http://www.apache.org/licenses/LICENSE-2.0
490
+ *
491
+ * Unless required by applicable law or agreed to in writing, software
492
+ * distributed under the License is distributed on an "AS IS" BASIS,
493
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
494
+ * See the License for the specific language governing permissions and
495
+ * limitations under the License.
496
+ */
497
+ const Row$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.RowApi, ({ props, buildChild, context }) => {
751
498
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
752
- className: "a2ui-loading",
753
499
  style: {
754
- padding: "8px",
755
- opacity: .5
500
+ display: "flex",
501
+ flexDirection: "row",
502
+ justifyContent: mapJustify$2(props.justify),
503
+ alignItems: mapAlign$2(props.align),
504
+ width: "100%",
505
+ margin: 0,
506
+ padding: 0
756
507
  },
757
- children: "Loading..."
508
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList$1, {
509
+ childList: props.children,
510
+ buildChild,
511
+ context
512
+ })
758
513
  });
759
514
  });
760
- /**
761
- * ComponentNode - dynamically renders an A2UI component based on its type.
515
+
516
+ //#endregion
517
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Column.tsx
518
+ /**
519
+ * Copyright 2026 Google LLC
762
520
  *
763
- * Looks up the component in the registry and renders it with the appropriate props.
764
- * Supports lazy-loaded components via React.Suspense.
521
+ * Licensed under the Apache License, Version 2.0 (the "License");
522
+ * you may not use this file except in compliance with the License.
523
+ * You may obtain a copy of the License at
765
524
  *
766
- * No wrapper div is rendered - the component's root div (e.g., .a2ui-image) is the
767
- * direct flex child, exactly matching Lit's structure where the :host element IS
768
- * the flex item. Each component handles --weight CSS variable on its root div.
525
+ * http://www.apache.org/licenses/LICENSE-2.0
769
526
  *
770
- * Memoized to prevent unnecessary re-renders when parent updates but node hasn't changed.
527
+ * Unless required by applicable law or agreed to in writing, software
528
+ * distributed under the License is distributed on an "AS IS" BASIS,
529
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
530
+ * See the License for the specific language governing permissions and
531
+ * limitations under the License.
771
532
  */
772
- const ComponentNode = (0, react.memo)(function ComponentNode({ node, surfaceId, registry }) {
773
- const actualRegistry = registry !== null && registry !== void 0 ? registry : ComponentRegistry.getInstance();
774
- const nodeType = node && typeof node === "object" && "type" in node ? node.type : null;
775
- const Component = (0, react.useMemo)(() => nodeType ? actualRegistry.get(nodeType) : null, [actualRegistry, nodeType]);
776
- if (!nodeType) {
777
- if (node) console.warn("[A2UI] Invalid component node (not resolved?):", node);
778
- return null;
779
- }
780
- if (!Component) {
781
- console.warn(`[A2UI] Unknown component type: ${nodeType}`);
782
- return null;
783
- }
784
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
785
- fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadingFallback, {}),
786
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
787
- node,
788
- surfaceId
533
+ const Column$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ColumnApi, ({ props, buildChild, context }) => {
534
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
535
+ style: {
536
+ display: "flex",
537
+ flexDirection: "column",
538
+ justifyContent: mapJustify$2(props.justify),
539
+ alignItems: mapAlign$2(props.align),
540
+ width: "100%",
541
+ margin: 0,
542
+ padding: 0
543
+ },
544
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList$1, {
545
+ childList: props.children,
546
+ buildChild,
547
+ context
789
548
  })
790
549
  });
791
550
  });
792
551
 
793
552
  //#endregion
794
- //#region src/react-renderer/theme/utils.ts
553
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/List.tsx
795
554
  /**
796
- * Converts a theme class map (Record<string, boolean>) to a className string.
797
- *
798
- * @param classMap - An object where keys are class names and values are booleans
799
- * @returns A space-separated string of class names where the value is true
555
+ * Copyright 2026 Google LLC
800
556
  *
801
- * @example
802
- * classMapToString({ 'a2ui-button': true, 'a2ui-button--primary': true, 'disabled': false })
803
- * // Returns: 'a2ui-button a2ui-button--primary'
804
- */
805
- function classMapToString(classMap) {
806
- if (!classMap) return "";
807
- return Object.entries(classMap).filter(([, enabled]) => enabled).map(([className]) => className).join(" ");
808
- }
809
- /**
810
- * Converts an additional styles object (Record<string, string>) to a React style object.
557
+ * Licensed under the Apache License, Version 2.0 (the "License");
558
+ * you may not use this file except in compliance with the License.
559
+ * You may obtain a copy of the License at
811
560
  *
812
- * @param styles - An object with CSS property names as keys and values as strings
813
- * @returns A React-compatible style object, or undefined if no styles
561
+ * http://www.apache.org/licenses/LICENSE-2.0
814
562
  *
815
- * @example
816
- * stylesToObject({ 'background-color': 'red', 'font-size': '16px', '--custom-var': 'blue' })
817
- * // Returns: { backgroundColor: 'red', fontSize: '16px', '--custom-var': 'blue' }
563
+ * Unless required by applicable law or agreed to in writing, software
564
+ * distributed under the License is distributed on an "AS IS" BASIS,
565
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
566
+ * See the License for the specific language governing permissions and
567
+ * limitations under the License.
818
568
  */
819
- function stylesToObject(styles) {
820
- if (!styles || Object.keys(styles).length === 0) return void 0;
821
- const result = {};
822
- for (const [key, value] of Object.entries(styles)) if (key.startsWith("--")) result[key] = value;
823
- else {
824
- const camelKey = key.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
825
- result[camelKey] = value;
826
- }
827
- return result;
828
- }
569
+ const List = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ListApi, ({ props, buildChild, context }) => {
570
+ const isHorizontal = props.direction === "horizontal";
571
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
572
+ style: {
573
+ display: "flex",
574
+ flexDirection: isHorizontal ? "row" : "column",
575
+ alignItems: mapAlign$2(props.align),
576
+ overflowX: isHorizontal ? "auto" : "hidden",
577
+ overflowY: isHorizontal ? "hidden" : "auto",
578
+ width: "100%",
579
+ margin: 0,
580
+ padding: 0
581
+ },
582
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList$1, {
583
+ childList: props.children,
584
+ buildChild,
585
+ context
586
+ })
587
+ });
588
+ });
829
589
 
830
590
  //#endregion
831
- //#region src/react-renderer/lib/utils.ts
591
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Card.tsx
832
592
  /**
833
- * Utility function to merge class names.
834
- * Combines clsx for conditional classes.
593
+ * Copyright 2026 Google LLC
835
594
  *
836
- * @param inputs - Class values to merge
837
- * @returns Merged class name string
595
+ * Licensed under the Apache License, Version 2.0 (the "License");
596
+ * you may not use this file except in compliance with the License.
597
+ * You may obtain a copy of the License at
838
598
  *
839
- * @example
840
- * cn('base-class', condition && 'conditional-class', { 'object-class': true })
841
- */
842
- function cn(...inputs) {
843
- return (0, clsx.clsx)(inputs);
844
- }
845
- /**
846
- * Merges multiple class maps into a single class map.
847
- * Uses Lit's Styles.merge() function directly for consistency.
599
+ * http://www.apache.org/licenses/LICENSE-2.0
848
600
  *
849
- * Lit's merge handles prefix conflicts: if you have 'layout-p-2' and 'layout-p-4',
850
- * only the latter is kept (same prefix 'layout-p-' means they conflict).
851
- *
852
- * @param maps - Class maps to merge
853
- * @returns A merged class map
601
+ * Unless required by applicable law or agreed to in writing, software
602
+ * distributed under the License is distributed on an "AS IS" BASIS,
603
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
604
+ * See the License for the specific language governing permissions and
605
+ * limitations under the License.
854
606
  */
855
- function mergeClassMaps(...maps) {
856
- const validMaps = maps.filter((m) => m !== void 0);
857
- if (validMaps.length === 0) return {};
858
- return _a2ui_lit_0_8.Styles.merge(...validMaps);
859
- }
860
-
861
- //#endregion
862
- //#region src/react-renderer/core/A2UIRenderer.tsx
863
- /** Default loading fallback - memoized to prevent recreation */
864
- const DefaultLoadingFallback = (0, react.memo)(function DefaultLoadingFallback() {
607
+ const Card = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.CardApi, ({ props, buildChild }) => {
865
608
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
866
- className: "a2ui-loading",
867
609
  style: {
868
- padding: "16px",
869
- opacity: .5
610
+ ...getBaseContainerStyle(),
611
+ backgroundColor: "#fff",
612
+ boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
613
+ width: "100%"
870
614
  },
871
- children: "Loading..."
615
+ children: props.child ? buildChild(props.child) : null
872
616
  });
873
617
  });
874
- /**
875
- * A2UIRenderer - renders an A2UI surface.
618
+
619
+ //#endregion
620
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Tabs.tsx
621
+ /**
622
+ * Copyright 2026 Google LLC
876
623
  *
877
- * This is the main entry point for rendering A2UI content in your React app.
878
- * It reads the surface state from the A2UI store and renders the component tree.
624
+ * Licensed under the Apache License, Version 2.0 (the "License");
625
+ * you may not use this file except in compliance with the License.
626
+ * You may obtain a copy of the License at
879
627
  *
880
- * Memoized to prevent unnecessary re-renders when props haven't changed.
628
+ * http://www.apache.org/licenses/LICENSE-2.0
881
629
  *
882
- * @example
883
- * ```tsx
884
- * function App() {
885
- * return (
886
- * <A2UIProvider onAction={handleAction}>
887
- * <A2UIRenderer surfaceId="main" />
888
- * </A2UIProvider>
889
- * );
890
- * }
891
- * ```
630
+ * Unless required by applicable law or agreed to in writing, software
631
+ * distributed under the License is distributed on an "AS IS" BASIS,
632
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
633
+ * See the License for the specific language governing permissions and
634
+ * limitations under the License.
892
635
  */
893
- const A2UIRenderer = (0, react.memo)(function A2UIRenderer({ surfaceId, className, fallback = null, loadingFallback, registry }) {
894
- const { getSurface, version } = useA2UI();
895
- const surface = getSurface(surfaceId);
896
- const surfaceStyles = (0, react.useMemo)(() => {
897
- if (!(surface === null || surface === void 0 ? void 0 : surface.styles)) return {};
898
- const styles = {};
899
- for (const [key, value] of Object.entries(surface.styles)) switch (key) {
900
- case "primaryColor":
901
- styles["--p-100"] = "#ffffff";
902
- styles["--p-99"] = `color-mix(in srgb, ${value} 2%, white 98%)`;
903
- styles["--p-98"] = `color-mix(in srgb, ${value} 4%, white 96%)`;
904
- styles["--p-95"] = `color-mix(in srgb, ${value} 10%, white 90%)`;
905
- styles["--p-90"] = `color-mix(in srgb, ${value} 20%, white 80%)`;
906
- styles["--p-80"] = `color-mix(in srgb, ${value} 40%, white 60%)`;
907
- styles["--p-70"] = `color-mix(in srgb, ${value} 60%, white 40%)`;
908
- styles["--p-60"] = `color-mix(in srgb, ${value} 80%, white 20%)`;
909
- styles["--p-50"] = String(value);
910
- styles["--p-40"] = `color-mix(in srgb, ${value} 80%, black 20%)`;
911
- styles["--p-35"] = `color-mix(in srgb, ${value} 70%, black 30%)`;
912
- styles["--p-30"] = `color-mix(in srgb, ${value} 60%, black 40%)`;
913
- styles["--p-25"] = `color-mix(in srgb, ${value} 50%, black 50%)`;
914
- styles["--p-20"] = `color-mix(in srgb, ${value} 40%, black 60%)`;
915
- styles["--p-15"] = `color-mix(in srgb, ${value} 30%, black 70%)`;
916
- styles["--p-10"] = `color-mix(in srgb, ${value} 20%, black 80%)`;
917
- styles["--p-5"] = `color-mix(in srgb, ${value} 10%, black 90%)`;
918
- styles["--p-0"] = "#000000";
919
- break;
920
- case "font":
921
- styles["--font-family"] = String(value);
922
- styles["--font-family-flex"] = String(value);
923
- break;
924
- }
925
- return styles;
926
- }, [surface === null || surface === void 0 ? void 0 : surface.styles]);
927
- if (!surface || !surface.componentTree) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: fallback });
928
- const actualLoadingFallback = loadingFallback !== null && loadingFallback !== void 0 ? loadingFallback : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultLoadingFallback, {});
929
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
930
- className: cn("a2ui-surface", className),
931
- style: surfaceStyles,
932
- "data-surface-id": surfaceId,
933
- "data-version": version,
934
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
935
- fallback: actualLoadingFallback,
936
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
937
- node: surface.componentTree,
938
- surfaceId,
939
- registry
940
- })
941
- })
636
+ const Tabs = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.TabsApi, ({ props, buildChild }) => {
637
+ const [selectedIndex, setSelectedIndex] = (0, react.useState)(0);
638
+ const tabs = props.tabs || [];
639
+ const activeTab = tabs[selectedIndex];
640
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
641
+ style: {
642
+ display: "flex",
643
+ flexDirection: "column",
644
+ width: "100%",
645
+ margin: LEAF_MARGIN
646
+ },
647
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
648
+ style: {
649
+ display: "flex",
650
+ borderBottom: "1px solid #ccc",
651
+ marginBottom: "8px"
652
+ },
653
+ children: tabs.map((tab, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
654
+ onClick: () => setSelectedIndex(i),
655
+ style: {
656
+ padding: "8px 16px",
657
+ border: "none",
658
+ background: "none",
659
+ borderBottom: selectedIndex === i ? "2px solid var(--a2ui-primary-color, #007bff)" : "none",
660
+ fontWeight: selectedIndex === i ? "bold" : "normal",
661
+ cursor: "pointer",
662
+ color: selectedIndex === i ? "var(--a2ui-primary-color, #007bff)" : "inherit"
663
+ },
664
+ children: tab.title
665
+ }, i))
666
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
667
+ style: { flex: 1 },
668
+ children: activeTab ? buildChild(activeTab.child) : null
669
+ })]
942
670
  });
943
671
  });
944
672
 
945
673
  //#endregion
946
- //#region src/react-renderer/hooks/useA2UIComponent.ts
674
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Divider.tsx
947
675
  /**
948
- * Base hook for A2UI components. Provides data binding, theme access,
949
- * and action dispatching.
676
+ * Copyright 2026 Google LLC
950
677
  *
951
- * @param node - The component node from the A2UI message processor
952
- * @param surfaceId - The surface ID this component belongs to
953
- * @returns Object with theme, data binding helpers, and action dispatcher
678
+ * Licensed under the Apache License, Version 2.0 (the "License");
679
+ * you may not use this file except in compliance with the License.
680
+ * You may obtain a copy of the License at
954
681
  *
955
- * @example
956
- * ```tsx
957
- * function TextField({ node, surfaceId }: A2UIComponentProps<Types.TextFieldNode>) {
958
- * const { theme, resolveString, setValue } = useA2UIComponent(node, surfaceId);
959
- *
960
- * const label = resolveString(node.properties.label);
961
- * const value = resolveString(node.properties.text) ?? '';
962
- *
963
- * return (
964
- * <div className={classMapToString(theme.components.TextField.container)}>
965
- * <label>{label}</label>
966
- * <input
967
- * value={value}
968
- * onChange={(e) => setValue(node.properties.text?.path!, e.target.value)}
969
- * />
970
- * </div>
971
- * );
972
- * }
973
- * ```
682
+ * http://www.apache.org/licenses/LICENSE-2.0
683
+ *
684
+ * Unless required by applicable law or agreed to in writing, software
685
+ * distributed under the License is distributed on an "AS IS" BASIS,
686
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
687
+ * See the License for the specific language governing permissions and
688
+ * limitations under the License.
974
689
  */
975
- function useA2UIComponent(node, surfaceId) {
976
- const actions = useA2UIActions();
977
- const theme = useTheme();
978
- const baseId = (0, react.useId)();
979
- useA2UIState();
980
- /**
981
- * Resolve a StringValue to its actual string value.
982
- * Checks literalString, literal, then path in that order.
983
- * Note: This reads from data model via stable actions reference.
984
- */
985
- const resolveString = (0, react.useCallback)((value) => {
986
- if (!value) return null;
987
- if (typeof value !== "object") return null;
988
- if (value.literalString !== void 0) return value.literalString;
989
- if (value.literal !== void 0) return String(value.literal);
990
- if (value.path) {
991
- const data = actions.getData(node, value.path, surfaceId);
992
- return data !== null ? String(data) : null;
993
- }
994
- return null;
995
- }, [
996
- actions,
997
- node,
998
- surfaceId
999
- ]);
1000
- /**
1001
- * Resolve a NumberValue to its actual number value.
1002
- */
1003
- const resolveNumber = (0, react.useCallback)((value) => {
1004
- if (!value) return null;
1005
- if (typeof value !== "object") return null;
1006
- if (value.literalNumber !== void 0) return value.literalNumber;
1007
- if (value.literal !== void 0) return Number(value.literal);
1008
- if (value.path) {
1009
- const data = actions.getData(node, value.path, surfaceId);
1010
- return data !== null ? Number(data) : null;
1011
- }
1012
- return null;
1013
- }, [
1014
- actions,
1015
- node,
1016
- surfaceId
1017
- ]);
1018
- /**
1019
- * Resolve a BooleanValue to its actual boolean value.
1020
- */
1021
- const resolveBoolean = (0, react.useCallback)((value) => {
1022
- if (!value) return null;
1023
- if (typeof value !== "object") return null;
1024
- if (value.literalBoolean !== void 0) return value.literalBoolean;
1025
- if (value.literal !== void 0) return Boolean(value.literal);
1026
- if (value.path) {
1027
- const data = actions.getData(node, value.path, surfaceId);
1028
- return data !== null ? Boolean(data) : null;
1029
- }
1030
- return null;
1031
- }, [
1032
- actions,
1033
- node,
1034
- surfaceId
1035
- ]);
1036
- /**
1037
- * Set a value in the data model for two-way binding.
1038
- */
1039
- const setValue = (0, react.useCallback)((path, value) => {
1040
- actions.setData(node, path, value, surfaceId);
1041
- }, [
1042
- actions,
1043
- node,
1044
- surfaceId
1045
- ]);
1046
- /**
1047
- * Get a value from the data model.
1048
- */
1049
- const getValue = (0, react.useCallback)((path) => {
1050
- return actions.getData(node, path, surfaceId);
1051
- }, [
1052
- actions,
1053
- node,
1054
- surfaceId
1055
- ]);
1056
- /**
1057
- * Dispatch a user action to the server.
1058
- * Resolves all context bindings before dispatching.
1059
- */
1060
- const sendAction = (0, react.useCallback)((action) => {
1061
- const actionContext = {};
1062
- if (action.context) {
1063
- for (const item of action.context) if (item.value.literalString !== void 0) actionContext[item.key] = item.value.literalString;
1064
- else if (item.value.literalNumber !== void 0) actionContext[item.key] = item.value.literalNumber;
1065
- else if (item.value.literalBoolean !== void 0) actionContext[item.key] = item.value.literalBoolean;
1066
- else if (item.value.path) {
1067
- const resolvedPath = actions.resolvePath(item.value.path, node.dataContextPath);
1068
- actionContext[item.key] = actions.getData(node, resolvedPath, surfaceId);
1069
- }
1070
- }
1071
- actions.dispatch({ userAction: {
1072
- name: action.name,
1073
- sourceComponentId: node.id,
1074
- surfaceId,
1075
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1076
- context: actionContext
1077
- } });
1078
- }, [
1079
- actions,
1080
- node,
1081
- surfaceId
1082
- ]);
1083
- /**
1084
- * Generate a unique ID for accessibility purposes.
1085
- * Uses React's useId() for SSR and Concurrent Mode compatibility.
1086
- */
1087
- const getUniqueId = (0, react.useCallback)((prefix) => {
1088
- return `${prefix}${baseId}`;
1089
- }, [baseId]);
1090
- return (0, react.useMemo)(() => ({
1091
- theme,
1092
- resolveString,
1093
- resolveNumber,
1094
- resolveBoolean,
1095
- setValue,
1096
- getValue,
1097
- sendAction,
1098
- getUniqueId
1099
- }), [
1100
- theme,
1101
- resolveString,
1102
- resolveNumber,
1103
- resolveBoolean,
1104
- setValue,
1105
- getValue,
1106
- sendAction,
1107
- getUniqueId
1108
- ]);
1109
- }
690
+ const Divider = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.DividerApi, ({ props }) => {
691
+ const isVertical = props.axis === "vertical";
692
+ const style = {
693
+ margin: LEAF_MARGIN,
694
+ border: "none",
695
+ backgroundColor: "#ccc"
696
+ };
697
+ if (isVertical) {
698
+ style.width = "1px";
699
+ style.height = "100%";
700
+ } else {
701
+ style.width = "100%";
702
+ style.height = "1px";
703
+ }
704
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style });
705
+ });
1110
706
 
1111
707
  //#endregion
1112
- //#region src/react-renderer/components/content/Text.tsx
1113
- function isHintedStyles(styles) {
1114
- if (typeof styles !== "object" || !styles || Array.isArray(styles)) return false;
1115
- return [
1116
- "h1",
1117
- "h2",
1118
- "h3",
1119
- "h4",
1120
- "h5",
1121
- "caption",
1122
- "body"
1123
- ].some((v) => v in styles);
1124
- }
1125
- /**
1126
- * Markdown-it instance for rendering markdown text.
1127
- * Uses synchronous import to ensure availability at first render (matches Lit renderer).
1128
- *
1129
- * Configuration matches Lit's markdown directive (uses MarkdownIt defaults):
1130
- * - html: false (default) - Security: disable raw HTML
1131
- * - linkify: false (default) - Don't auto-convert URLs/emails to links
1132
- * - breaks: false (default) - Don't convert \n to <br>
1133
- * - typographer: false (default) - Don't use smart quotes/dashes
708
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Modal.tsx
709
+ /**
710
+ * Copyright 2026 Google LLC
711
+ *
712
+ * Licensed under the Apache License, Version 2.0 (the "License");
713
+ * you may not use this file except in compliance with the License.
714
+ * You may obtain a copy of the License at
715
+ *
716
+ * http://www.apache.org/licenses/LICENSE-2.0
717
+ *
718
+ * Unless required by applicable law or agreed to in writing, software
719
+ * distributed under the License is distributed on an "AS IS" BASIS,
720
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
721
+ * See the License for the specific language governing permissions and
722
+ * limitations under the License.
1134
723
  */
1135
- const markdownRenderer = new markdown_it.default();
1136
- /**
1137
- * Apply theme classes to markdown HTML elements.
1138
- * Replaces default element tags with themed versions.
724
+ const Modal = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ModalApi, ({ props, buildChild }) => {
725
+ const [isOpen, setIsOpen] = (0, react.useState)(false);
726
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
727
+ onClick: () => setIsOpen(true),
728
+ style: { display: "inline-block" },
729
+ children: props.trigger ? buildChild(props.trigger) : null
730
+ }), isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
731
+ style: {
732
+ position: "fixed",
733
+ top: 0,
734
+ left: 0,
735
+ right: 0,
736
+ bottom: 0,
737
+ backgroundColor: "rgba(0,0,0,0.5)",
738
+ display: "flex",
739
+ alignItems: "center",
740
+ justifyContent: "center",
741
+ zIndex: 1e3
742
+ },
743
+ onClick: () => setIsOpen(false),
744
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
745
+ style: {
746
+ backgroundColor: "#fff",
747
+ padding: "24px",
748
+ borderRadius: "8px",
749
+ maxWidth: "90%",
750
+ maxHeight: "90%",
751
+ overflow: "auto",
752
+ display: "flex",
753
+ flexDirection: "column"
754
+ },
755
+ onClick: (e) => e.stopPropagation(),
756
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
757
+ style: {
758
+ display: "flex",
759
+ justifyContent: "flex-end"
760
+ },
761
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
762
+ onClick: () => setIsOpen(false),
763
+ style: {
764
+ border: "none",
765
+ background: "none",
766
+ fontSize: "20px",
767
+ cursor: "pointer",
768
+ padding: "4px"
769
+ },
770
+ children: "×"
771
+ })
772
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
773
+ style: { flex: 1 },
774
+ children: props.content ? buildChild(props.content) : null
775
+ })]
776
+ })
777
+ })] });
778
+ });
779
+
780
+ //#endregion
781
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Button.tsx
782
+ /**
783
+ * Copyright 2026 Google LLC
784
+ *
785
+ * Licensed under the Apache License, Version 2.0 (the "License");
786
+ * you may not use this file except in compliance with the License.
787
+ * You may obtain a copy of the License at
788
+ *
789
+ * http://www.apache.org/licenses/LICENSE-2.0
790
+ *
791
+ * Unless required by applicable law or agreed to in writing, software
792
+ * distributed under the License is distributed on an "AS IS" BASIS,
793
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
794
+ * See the License for the specific language governing permissions and
795
+ * limitations under the License.
1139
796
  */
1140
- function applyMarkdownTheme(html, markdownTheme) {
1141
- if (!markdownTheme) return html;
1142
- const replacements = [];
1143
- for (const [element, classes] of Object.entries(markdownTheme)) {
1144
- if (!classes || Array.isArray(classes) && classes.length === 0) continue;
1145
- const classString = Array.isArray(classes) ? classes.join(" ") : classMapToString(classes);
1146
- if (!classString) continue;
1147
- const tagRegex = new RegExp(`<${element}(?=\\s|>|/>)`, "gi");
1148
- replacements.push([tagRegex, `<${element} class="${classString}"`]);
1149
- }
1150
- let result = html;
1151
- for (const [regex, replacement] of replacements) result = result.replace(regex, replacement);
1152
- return result;
1153
- }
1154
- /**
1155
- * Text component - renders text content with markdown support.
1156
- *
1157
- * Structure mirrors Lit's Text component:
1158
- * <div class="a2ui-text"> ← :host equivalent
1159
- * <section class="..."> ← theme classes
1160
- * <h2>...</h2> ← rendered markdown content
1161
- * </section>
1162
- * </div>
1163
- *
1164
- * Text is parsed as markdown and rendered as HTML (matches Lit renderer behavior).
1165
- * Supports usageHint values: h1, h2, h3, h4, h5, caption, body
1166
- *
1167
- * Markdown features supported:
1168
- * - **Bold** and *italic* text
1169
- * - Lists (ordered and unordered)
1170
- * - `inline code` and code blocks
1171
- * - [Links](url) (auto-linkified URLs too)
1172
- * - Blockquotes
1173
- * - Horizontal rules
1174
- *
1175
- * Note: Raw HTML is disabled for security.
797
+ const Button$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ButtonApi, ({ props, buildChild }) => {
798
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
799
+ style: {
800
+ margin: LEAF_MARGIN,
801
+ padding: "8px 16px",
802
+ cursor: "pointer",
803
+ border: props.variant === "borderless" ? "none" : "1px solid #ccc",
804
+ backgroundColor: props.variant === "primary" ? "var(--a2ui-primary-color, #007bff)" : props.variant === "borderless" ? "transparent" : "#fff",
805
+ color: props.variant === "primary" ? "#fff" : "inherit",
806
+ borderRadius: "4px",
807
+ display: "inline-flex",
808
+ alignItems: "center",
809
+ justifyContent: "center",
810
+ boxSizing: "border-box"
811
+ },
812
+ onClick: props.action,
813
+ disabled: props.isValid === false,
814
+ children: props.child ? buildChild(props.child) : null
815
+ });
816
+ });
817
+
818
+ //#endregion
819
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/TextField.tsx
820
+ /**
821
+ * Copyright 2026 Google LLC
822
+ *
823
+ * Licensed under the Apache License, Version 2.0 (the "License");
824
+ * you may not use this file except in compliance with the License.
825
+ * You may obtain a copy of the License at
826
+ *
827
+ * http://www.apache.org/licenses/LICENSE-2.0
828
+ *
829
+ * Unless required by applicable law or agreed to in writing, software
830
+ * distributed under the License is distributed on an "AS IS" BASIS,
831
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
832
+ * See the License for the specific language governing permissions and
833
+ * limitations under the License.
1176
834
  */
1177
- const Text = (0, react.memo)(function Text({ node, surfaceId }) {
1178
- var _theme$additionalStyl2;
1179
- const { theme, resolveString } = useA2UIComponent(node, surfaceId);
1180
- const props = node.properties;
1181
- const textValue = resolveString(props.text);
1182
- const usageHint = props.usageHint;
1183
- const classes = mergeClassMaps(theme.components.Text.all, usageHint ? theme.components.Text[usageHint] : {});
1184
- const additionalStyles = (0, react.useMemo)(() => {
1185
- var _theme$additionalStyl;
1186
- const textStyles = (_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Text;
1187
- if (!textStyles) return void 0;
1188
- if (isHintedStyles(textStyles)) return stylesToObject(textStyles[usageHint !== null && usageHint !== void 0 ? usageHint : "body"]);
1189
- return stylesToObject(textStyles);
1190
- }, [(_theme$additionalStyl2 = theme.additionalStyles) === null || _theme$additionalStyl2 === void 0 ? void 0 : _theme$additionalStyl2.Text, usageHint]);
1191
- const renderedContent = (0, react.useMemo)(() => {
1192
- if (textValue === null || textValue === void 0) return null;
1193
- let markdownText = textValue;
1194
- switch (usageHint) {
1195
- case "h1":
1196
- markdownText = `# ${markdownText}`;
1197
- break;
1198
- case "h2":
1199
- markdownText = `## ${markdownText}`;
1200
- break;
1201
- case "h3":
1202
- markdownText = `### ${markdownText}`;
1203
- break;
1204
- case "h4":
1205
- markdownText = `#### ${markdownText}`;
1206
- break;
1207
- case "h5":
1208
- markdownText = `##### ${markdownText}`;
1209
- break;
1210
- case "caption":
1211
- markdownText = `*${markdownText}*`;
1212
- break;
1213
- default: break;
1214
- }
1215
- return { __html: applyMarkdownTheme(markdownRenderer.render(markdownText), theme.markdown) };
1216
- }, [
1217
- textValue,
1218
- theme.markdown,
1219
- usageHint
1220
- ]);
1221
- if (!renderedContent) return null;
1222
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1223
- className: "a2ui-text",
1224
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1225
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1226
- className: classMapToString(classes),
1227
- style: additionalStyles,
1228
- dangerouslySetInnerHTML: renderedContent
1229
- })
835
+ const TextField$1 = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.TextFieldApi, ({ props }) => {
836
+ const onChange = (e) => {
837
+ props.setValue(e.target.value);
838
+ };
839
+ const isLong = props.variant === "longText";
840
+ const type = props.variant === "number" ? "number" : props.variant === "obscured" ? "password" : "text";
841
+ const style = {
842
+ padding: "8px",
843
+ width: "100%",
844
+ border: STANDARD_BORDER,
845
+ borderRadius: STANDARD_RADIUS,
846
+ boxSizing: "border-box"
847
+ };
848
+ const uniqueId = react.default.useId();
849
+ const hasError = props.validationErrors && props.validationErrors.length > 0;
850
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
851
+ style: {
852
+ display: "flex",
853
+ flexDirection: "column",
854
+ gap: "4px",
855
+ width: "100%",
856
+ margin: LEAF_MARGIN
857
+ },
858
+ children: [
859
+ props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
860
+ htmlFor: uniqueId,
861
+ style: {
862
+ fontSize: "14px",
863
+ fontWeight: "bold"
864
+ },
865
+ children: props.label
866
+ }),
867
+ isLong ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
868
+ id: uniqueId,
869
+ style: {
870
+ ...style,
871
+ border: hasError ? "1px solid red" : STANDARD_BORDER
872
+ },
873
+ value: props.value || "",
874
+ onChange
875
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
876
+ id: uniqueId,
877
+ type,
878
+ style: {
879
+ ...style,
880
+ border: hasError ? "1px solid red" : STANDARD_BORDER
881
+ },
882
+ value: props.value || "",
883
+ onChange
884
+ }),
885
+ hasError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
886
+ style: {
887
+ fontSize: "12px",
888
+ color: "red"
889
+ },
890
+ children: props.validationErrors[0]
891
+ })
892
+ ]
1230
893
  });
1231
894
  });
1232
895
 
1233
896
  //#endregion
1234
- //#region src/react-renderer/components/content/Image.tsx
897
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/CheckBox.tsx
1235
898
  /**
1236
- * Image component - renders an image from a URL with optional sizing and fit modes.
899
+ * Copyright 2026 Google LLC
1237
900
  *
1238
- * Supports usageHint values: icon, avatar, smallFeature, mediumFeature, largeFeature, header
1239
- * Supports fit values: contain, cover, fill, none, scale-down (maps to object-fit via CSS variable)
901
+ * Licensed under the Apache License, Version 2.0 (the "License");
902
+ * you may not use this file except in compliance with the License.
903
+ * You may obtain a copy of the License at
904
+ *
905
+ * http://www.apache.org/licenses/LICENSE-2.0
906
+ *
907
+ * Unless required by applicable law or agreed to in writing, software
908
+ * distributed under the License is distributed on an "AS IS" BASIS,
909
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
910
+ * See the License for the specific language governing permissions and
911
+ * limitations under the License.
1240
912
  */
1241
- const Image = (0, react.memo)(function Image({ node, surfaceId }) {
1242
- var _ref, _theme$additionalStyl;
1243
- const { theme, resolveString } = useA2UIComponent(node, surfaceId);
1244
- const props = node.properties;
1245
- const rawUrl = resolveString(props.url);
1246
- const url = rawUrl === null || rawUrl === void 0 ? void 0 : rawUrl.replace("//via.placeholder.com/", "//placehold.co/");
1247
- const usageHint = props.usageHint;
1248
- const fit = (_ref = props.fit) !== null && _ref !== void 0 ? _ref : "fill";
1249
- const classes = mergeClassMaps(theme.components.Image.all, usageHint ? theme.components.Image[usageHint] : {});
1250
- const style = {
1251
- ...stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Image),
1252
- "--object-fit": fit
913
+ const CheckBox = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.CheckBoxApi, ({ props }) => {
914
+ var _props$validationErro;
915
+ const onChange = (e) => {
916
+ props.setValue(e.target.checked);
1253
917
  };
1254
- if (!url) return null;
1255
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1256
- className: "a2ui-image",
1257
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1258
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1259
- className: classMapToString(classes),
1260
- style,
1261
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
1262
- src: url,
1263
- alt: ""
1264
- })
1265
- })
918
+ const uniqueId = react.default.useId();
919
+ const hasError = props.validationErrors && props.validationErrors.length > 0;
920
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
921
+ style: {
922
+ display: "flex",
923
+ flexDirection: "column",
924
+ margin: LEAF_MARGIN
925
+ },
926
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
927
+ style: {
928
+ display: "flex",
929
+ alignItems: "center",
930
+ gap: "8px"
931
+ },
932
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
933
+ id: uniqueId,
934
+ type: "checkbox",
935
+ checked: !!props.value,
936
+ onChange,
937
+ style: {
938
+ cursor: "pointer",
939
+ outline: hasError ? "1px solid red" : "none"
940
+ }
941
+ }), props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
942
+ htmlFor: uniqueId,
943
+ style: {
944
+ cursor: "pointer",
945
+ color: hasError ? "red" : "inherit"
946
+ },
947
+ children: props.label
948
+ })]
949
+ }), hasError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
950
+ style: {
951
+ fontSize: "12px",
952
+ color: "red",
953
+ marginTop: "4px"
954
+ },
955
+ children: (_props$validationErro = props.validationErrors) === null || _props$validationErro === void 0 ? void 0 : _props$validationErro[0]
956
+ })]
1266
957
  });
1267
958
  });
1268
959
 
1269
960
  //#endregion
1270
- //#region src/react-renderer/components/content/Icon.tsx
961
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.tsx
1271
962
  /**
1272
- * Convert camelCase to snake_case for Material Symbols font.
1273
- * e.g., "shoppingCart" -> "shopping_cart"
1274
- * This matches the Lit renderer's approach.
1275
- */
1276
- function toSnakeCase(str) {
1277
- return str.replace(/([A-Z])/g, "_$1").toLowerCase();
1278
- }
1279
- /**
1280
- * Icon component - renders an icon using Material Symbols Outlined font.
963
+ * Copyright 2026 Google LLC
1281
964
  *
1282
- * This matches the Lit renderer's approach using the g-icon class with
1283
- * Material Symbols Outlined font.
965
+ * Licensed under the Apache License, Version 2.0 (the "License");
966
+ * you may not use this file except in compliance with the License.
967
+ * You may obtain a copy of the License at
1284
968
  *
1285
- * @example Add Material Symbols font to your HTML:
1286
- * ```html
1287
- * <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet">
1288
- * ```
969
+ * http://www.apache.org/licenses/LICENSE-2.0
970
+ *
971
+ * Unless required by applicable law or agreed to in writing, software
972
+ * distributed under the License is distributed on an "AS IS" BASIS,
973
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
974
+ * See the License for the specific language governing permissions and
975
+ * limitations under the License.
1289
976
  */
1290
- const Icon = (0, react.memo)(function Icon({ node, surfaceId }) {
1291
- var _theme$additionalStyl;
1292
- const { theme, resolveString } = useA2UIComponent(node, surfaceId);
1293
- const props = node.properties;
1294
- const iconName = resolveString(props.name);
1295
- if (!iconName) return null;
1296
- const snakeCaseName = toSnakeCase(iconName);
1297
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1298
- className: "a2ui-icon",
1299
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1300
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1301
- className: classMapToString(theme.components.Icon),
1302
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Icon),
1303
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1304
- className: "g-icon",
1305
- children: snakeCaseName
977
+ const ChoicePicker = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.ChoicePickerApi, ({ props, context }) => {
978
+ const [filter, setFilter] = (0, react.useState)("");
979
+ const values = Array.isArray(props.value) ? props.value : [];
980
+ const isMutuallyExclusive = props.variant === "mutuallyExclusive";
981
+ const onToggle = (val) => {
982
+ if (isMutuallyExclusive) props.setValue([val]);
983
+ else {
984
+ const newValues = values.includes(val) ? values.filter((v) => v !== val) : [...values, val];
985
+ props.setValue(newValues);
986
+ }
987
+ };
988
+ const options = (props.options || []).filter((opt) => !props.filterable || filter === "" || String(opt.label).toLowerCase().includes(filter.toLowerCase()));
989
+ const containerStyle = {
990
+ display: "flex",
991
+ flexDirection: "column",
992
+ gap: "8px",
993
+ margin: LEAF_MARGIN,
994
+ width: "100%"
995
+ };
996
+ const listStyle = {
997
+ display: "flex",
998
+ flexDirection: props.displayStyle === "chips" ? "row" : "column",
999
+ flexWrap: props.displayStyle === "chips" ? "wrap" : "nowrap",
1000
+ gap: "8px"
1001
+ };
1002
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1003
+ style: containerStyle,
1004
+ children: [
1005
+ props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
1006
+ style: { fontSize: "14px" },
1007
+ children: props.label
1008
+ }),
1009
+ props.filterable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1010
+ type: "text",
1011
+ placeholder: "Filter options...",
1012
+ value: filter,
1013
+ onChange: (e) => setFilter(e.target.value),
1014
+ style: {
1015
+ padding: "4px 8px",
1016
+ border: STANDARD_BORDER,
1017
+ borderRadius: STANDARD_RADIUS
1018
+ }
1019
+ }),
1020
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1021
+ style: listStyle,
1022
+ children: options.map((opt, i) => {
1023
+ const isSelected = values.includes(opt.value);
1024
+ if (props.displayStyle === "chips") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1025
+ onClick: () => onToggle(opt.value),
1026
+ style: {
1027
+ padding: "4px 12px",
1028
+ borderRadius: "16px",
1029
+ border: isSelected ? "1px solid var(--a2ui-primary-color, #007bff)" : STANDARD_BORDER,
1030
+ backgroundColor: isSelected ? "var(--a2ui-primary-color, #007bff)" : "#fff",
1031
+ color: isSelected ? "#fff" : "inherit",
1032
+ cursor: "pointer",
1033
+ fontSize: "12px"
1034
+ },
1035
+ children: opt.label
1036
+ }, i);
1037
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1038
+ style: {
1039
+ display: "flex",
1040
+ alignItems: "center",
1041
+ gap: "8px",
1042
+ cursor: "pointer"
1043
+ },
1044
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1045
+ type: isMutuallyExclusive ? "radio" : "checkbox",
1046
+ checked: isSelected,
1047
+ onChange: () => onToggle(opt.value),
1048
+ name: isMutuallyExclusive ? `choice-${context.componentModel.id}` : void 0
1049
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1050
+ style: { fontSize: "14px" },
1051
+ children: opt.label
1052
+ })]
1053
+ }, i);
1054
+ })
1306
1055
  })
1307
- })
1056
+ ]
1308
1057
  });
1309
1058
  });
1310
1059
 
1311
1060
  //#endregion
1312
- //#region src/react-renderer/components/content/Divider.tsx
1061
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/Slider.tsx
1313
1062
  /**
1314
- * Divider component - renders a visual separator line.
1063
+ * Copyright 2026 Google LLC
1064
+ *
1065
+ * Licensed under the Apache License, Version 2.0 (the "License");
1066
+ * you may not use this file except in compliance with the License.
1067
+ * You may obtain a copy of the License at
1315
1068
  *
1316
- * Structure mirrors Lit's Divider component:
1317
- * <div class="a2ui-divider"> ← :host equivalent
1318
- * <hr class="..."> ← internal element
1319
- * </div>
1069
+ * http://www.apache.org/licenses/LICENSE-2.0
1070
+ *
1071
+ * Unless required by applicable law or agreed to in writing, software
1072
+ * distributed under the License is distributed on an "AS IS" BASIS,
1073
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1074
+ * See the License for the specific language governing permissions and
1075
+ * limitations under the License.
1320
1076
  */
1321
- const Divider = (0, react.memo)(function Divider({ node, surfaceId }) {
1322
- var _theme$additionalStyl;
1323
- const { theme } = useA2UIComponent(node, surfaceId);
1324
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1325
- className: "a2ui-divider",
1326
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1327
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", {
1328
- className: classMapToString(theme.components.Divider),
1329
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Divider)
1330
- })
1077
+ const Slider = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.SliderApi, ({ props }) => {
1078
+ var _props$min, _props$value;
1079
+ const onChange = (e) => {
1080
+ props.setValue(Number(e.target.value));
1081
+ };
1082
+ const uniqueId = react.default.useId();
1083
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1084
+ style: {
1085
+ display: "flex",
1086
+ flexDirection: "column",
1087
+ gap: "4px",
1088
+ margin: LEAF_MARGIN,
1089
+ width: "100%"
1090
+ },
1091
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1092
+ style: {
1093
+ display: "flex",
1094
+ justifyContent: "space-between"
1095
+ },
1096
+ children: [props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1097
+ htmlFor: uniqueId,
1098
+ style: {
1099
+ fontSize: "14px",
1100
+ fontWeight: "bold"
1101
+ },
1102
+ children: props.label
1103
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1104
+ style: {
1105
+ fontSize: "12px",
1106
+ color: "#666"
1107
+ },
1108
+ children: props.value
1109
+ })]
1110
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1111
+ id: uniqueId,
1112
+ type: "range",
1113
+ min: (_props$min = props.min) !== null && _props$min !== void 0 ? _props$min : 0,
1114
+ max: props.max,
1115
+ value: (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : 0,
1116
+ onChange,
1117
+ style: {
1118
+ width: "100%",
1119
+ cursor: "pointer"
1120
+ }
1121
+ })]
1331
1122
  });
1332
1123
  });
1333
1124
 
1334
1125
  //#endregion
1335
- //#region src/react-renderer/components/content/Video.tsx
1126
+ //#region src/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.tsx
1336
1127
  /**
1337
- * Check if a URL is a YouTube URL and extract the video ID.
1338
- */
1339
- function getYouTubeVideoId(url) {
1340
- for (const pattern of [/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([^&\s?]+)/]) {
1341
- const match = url.match(pattern);
1342
- if (match && match.length > 1) return match[1];
1343
- }
1344
- return null;
1345
- }
1346
- /**
1347
- * Video component - renders a video player.
1128
+ * Copyright 2026 Google LLC
1348
1129
  *
1349
- * Supports regular video URLs and YouTube URLs (renders as embedded iframe).
1130
+ * Licensed under the Apache License, Version 2.0 (the "License");
1131
+ * you may not use this file except in compliance with the License.
1132
+ * You may obtain a copy of the License at
1133
+ *
1134
+ * http://www.apache.org/licenses/LICENSE-2.0
1135
+ *
1136
+ * Unless required by applicable law or agreed to in writing, software
1137
+ * distributed under the License is distributed on an "AS IS" BASIS,
1138
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1139
+ * See the License for the specific language governing permissions and
1140
+ * limitations under the License.
1350
1141
  */
1351
- const Video = (0, react.memo)(function Video({ node, surfaceId }) {
1352
- var _theme$additionalStyl;
1353
- const { theme, resolveString } = useA2UIComponent(node, surfaceId);
1354
- const props = node.properties;
1355
- const url = resolveString(props.url);
1356
- if (!url) return null;
1357
- const youtubeId = getYouTubeVideoId(url);
1358
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1359
- className: "a2ui-video",
1360
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1361
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1362
- className: classMapToString(theme.components.Video),
1363
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Video),
1364
- children: youtubeId ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
1365
- src: `https://www.youtube.com/embed/${youtubeId}`,
1366
- title: "YouTube video player",
1367
- allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
1368
- allowFullScreen: true,
1369
- style: {
1370
- border: "none",
1371
- width: "100%",
1372
- aspectRatio: "16/9"
1373
- }
1374
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("video", {
1375
- src: url,
1376
- controls: true
1377
- })
1378
- })
1142
+ const DateTimeInput = createReactComponent(_a2ui_web_core_v0_9_basic_catalog.DateTimeInputApi, ({ props }) => {
1143
+ const onChange = (e) => {
1144
+ props.setValue(e.target.value);
1145
+ };
1146
+ const uniqueId = react.default.useId();
1147
+ let type = "datetime-local";
1148
+ if (props.enableDate && !props.enableTime) type = "date";
1149
+ if (!props.enableDate && props.enableTime) type = "time";
1150
+ const style = {
1151
+ padding: "8px",
1152
+ width: "100%",
1153
+ border: STANDARD_BORDER,
1154
+ borderRadius: STANDARD_RADIUS,
1155
+ boxSizing: "border-box"
1156
+ };
1157
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1158
+ style: {
1159
+ display: "flex",
1160
+ flexDirection: "column",
1161
+ gap: "4px",
1162
+ width: "100%",
1163
+ margin: LEAF_MARGIN
1164
+ },
1165
+ children: [props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1166
+ htmlFor: uniqueId,
1167
+ style: {
1168
+ fontSize: "14px",
1169
+ fontWeight: "bold"
1170
+ },
1171
+ children: props.label
1172
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1173
+ id: uniqueId,
1174
+ type,
1175
+ style,
1176
+ value: props.value || "",
1177
+ onChange,
1178
+ min: typeof props.min === "string" ? props.min : void 0,
1179
+ max: typeof props.max === "string" ? props.max : void 0
1180
+ })]
1379
1181
  });
1380
1182
  });
1381
1183
 
1382
1184
  //#endregion
1383
- //#region src/react-renderer/components/content/AudioPlayer.tsx
1185
+ //#region src/react-renderer/a2ui-react/catalog/basic/index.ts
1384
1186
  /**
1385
- * AudioPlayer component - renders an audio player with optional description.
1187
+ * Copyright 2026 Google LLC
1188
+ *
1189
+ * Licensed under the Apache License, Version 2.0 (the "License");
1190
+ * you may not use this file except in compliance with the License.
1191
+ * You may obtain a copy of the License at
1192
+ *
1193
+ * http://www.apache.org/licenses/LICENSE-2.0
1194
+ *
1195
+ * Unless required by applicable law or agreed to in writing, software
1196
+ * distributed under the License is distributed on an "AS IS" BASIS,
1197
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1198
+ * See the License for the specific language governing permissions and
1199
+ * limitations under the License.
1386
1200
  */
1387
- const AudioPlayer = (0, react.memo)(function AudioPlayer({ node, surfaceId }) {
1388
- var _props$description, _theme$additionalStyl;
1389
- const { theme, resolveString } = useA2UIComponent(node, surfaceId);
1390
- const props = node.properties;
1391
- const url = resolveString(props.url);
1392
- const description = resolveString((_props$description = props.description) !== null && _props$description !== void 0 ? _props$description : null);
1393
- if (!url) return null;
1394
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1395
- className: "a2ui-audio",
1396
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1397
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1398
- className: classMapToString(theme.components.AudioPlayer),
1399
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.AudioPlayer),
1400
- children: [description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: description }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("audio", {
1401
- src: url,
1402
- controls: true
1403
- })]
1404
- })
1405
- });
1406
- });
1201
+ const basicComponents = [
1202
+ Text$1,
1203
+ Image,
1204
+ Icon,
1205
+ Video,
1206
+ AudioPlayer,
1207
+ Row$1,
1208
+ Column$1,
1209
+ List,
1210
+ Card,
1211
+ Tabs,
1212
+ Divider,
1213
+ Modal,
1214
+ Button$1,
1215
+ TextField$1,
1216
+ CheckBox,
1217
+ ChoicePicker,
1218
+ Slider,
1219
+ DateTimeInput
1220
+ ];
1221
+ const basicCatalog = new _a2ui_web_core_v0_9.Catalog("https://a2ui.org/specification/v0_9/basic_catalog.json", basicComponents, _a2ui_web_core_v0_9_basic_catalog.BASIC_FUNCTIONS);
1407
1222
 
1408
1223
  //#endregion
1409
- //#region src/react-renderer/components/layout/Row.tsx
1224
+ //#region src/react-renderer/a2ui-react/catalog/minimal/components/Text.tsx
1410
1225
  /**
1411
- * Row component - arranges children horizontally using flexbox.
1226
+ * Copyright 2026 Google LLC
1412
1227
  *
1413
- * Supports distribution (justify-content) and alignment (align-items) properties.
1228
+ * Licensed under the Apache License, Version 2.0 (the "License");
1229
+ * you may not use this file except in compliance with the License.
1230
+ * You may obtain a copy of the License at
1231
+ *
1232
+ * http://www.apache.org/licenses/LICENSE-2.0
1233
+ *
1234
+ * Unless required by applicable law or agreed to in writing, software
1235
+ * distributed under the License is distributed on an "AS IS" BASIS,
1236
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1237
+ * See the License for the specific language governing permissions and
1238
+ * limitations under the License.
1414
1239
  */
1415
- const Row = (0, react.memo)(function Row({ node, surfaceId }) {
1416
- var _props$alignment, _props$distribution, _theme$additionalStyl;
1417
- const { theme } = useA2UIComponent(node, surfaceId);
1418
- const props = node.properties;
1419
- const alignment = (_props$alignment = props.alignment) !== null && _props$alignment !== void 0 ? _props$alignment : "stretch";
1420
- const distribution = (_props$distribution = props.distribution) !== null && _props$distribution !== void 0 ? _props$distribution : "start";
1421
- const children = Array.isArray(props.children) ? props.children : [];
1422
- const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
1423
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1424
- className: "a2ui-row",
1425
- "data-alignment": alignment,
1426
- "data-distribution": distribution,
1427
- style: hostStyle,
1428
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1429
- className: classMapToString(theme.components.Row),
1430
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Row),
1431
- children: children.map((child, index) => {
1432
- const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
1433
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
1434
- node: typeof child === "object" && child !== null && "type" in child ? child : null,
1435
- surfaceId
1436
- }, childId);
1437
- })
1438
- })
1439
- });
1240
+ const TextSchema = zod.z.object({
1241
+ text: _a2ui_web_core_v0_9.CommonSchemas.DynamicString,
1242
+ variant: zod.z.enum([
1243
+ "h1",
1244
+ "h2",
1245
+ "h3",
1246
+ "h4",
1247
+ "h5",
1248
+ "caption",
1249
+ "body"
1250
+ ]).optional()
1251
+ });
1252
+ const TextApiDef = {
1253
+ name: "Text",
1254
+ schema: TextSchema
1255
+ };
1256
+ const Text = createReactComponent(TextApiDef, ({ props }) => {
1257
+ var _props$text;
1258
+ const text = (_props$text = props.text) !== null && _props$text !== void 0 ? _props$text : "";
1259
+ switch (props.variant) {
1260
+ case "h1": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", { children: text });
1261
+ case "h2": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: text });
1262
+ case "h3": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: text });
1263
+ case "h4": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", { children: text });
1264
+ case "h5": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", { children: text });
1265
+ case "caption": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: text });
1266
+ default: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: text });
1267
+ }
1440
1268
  });
1441
1269
 
1442
1270
  //#endregion
1443
- //#region src/react-renderer/components/layout/Column.tsx
1271
+ //#region src/react-renderer/a2ui-react/catalog/minimal/components/Button.tsx
1444
1272
  /**
1445
- * Column component - arranges children vertically using flexbox.
1273
+ * Copyright 2026 Google LLC
1446
1274
  *
1447
- * Supports distribution (justify-content) and alignment (align-items) properties.
1275
+ * Licensed under the Apache License, Version 2.0 (the "License");
1276
+ * you may not use this file except in compliance with the License.
1277
+ * You may obtain a copy of the License at
1278
+ *
1279
+ * http://www.apache.org/licenses/LICENSE-2.0
1280
+ *
1281
+ * Unless required by applicable law or agreed to in writing, software
1282
+ * distributed under the License is distributed on an "AS IS" BASIS,
1283
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1284
+ * See the License for the specific language governing permissions and
1285
+ * limitations under the License.
1448
1286
  */
1449
- const Column = (0, react.memo)(function Column({ node, surfaceId }) {
1450
- var _props$alignment, _props$distribution, _theme$additionalStyl;
1451
- const { theme } = useA2UIComponent(node, surfaceId);
1452
- const props = node.properties;
1453
- const alignment = (_props$alignment = props.alignment) !== null && _props$alignment !== void 0 ? _props$alignment : "stretch";
1454
- const distribution = (_props$distribution = props.distribution) !== null && _props$distribution !== void 0 ? _props$distribution : "start";
1455
- const children = Array.isArray(props.children) ? props.children : [];
1456
- const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
1457
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1458
- className: "a2ui-column",
1459
- "data-alignment": alignment,
1460
- "data-distribution": distribution,
1461
- style: hostStyle,
1462
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1463
- className: classMapToString(theme.components.Column),
1464
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Column),
1465
- children: children.map((child, index) => {
1466
- const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
1467
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
1468
- node: typeof child === "object" && child !== null && "type" in child ? child : null,
1469
- surfaceId
1470
- }, childId);
1471
- })
1472
- })
1287
+ const ButtonSchema = zod.z.object({
1288
+ child: _a2ui_web_core_v0_9.CommonSchemas.ComponentId,
1289
+ action: _a2ui_web_core_v0_9.CommonSchemas.Action,
1290
+ variant: zod.z.enum(["primary", "borderless"]).optional()
1291
+ });
1292
+ const ButtonApiDef = {
1293
+ name: "Button",
1294
+ schema: ButtonSchema
1295
+ };
1296
+ const Button = createReactComponent(ButtonApiDef, ({ props, buildChild }) => {
1297
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1298
+ style: {
1299
+ padding: "8px 16px",
1300
+ cursor: "pointer",
1301
+ border: props.variant === "borderless" ? "none" : "1px solid #ccc",
1302
+ backgroundColor: props.variant === "primary" ? "#007bff" : "transparent",
1303
+ color: props.variant === "primary" ? "#fff" : "inherit",
1304
+ borderRadius: "4px"
1305
+ },
1306
+ onClick: props.action,
1307
+ children: props.child ? buildChild(props.child) : null
1473
1308
  });
1474
1309
  });
1475
1310
 
1476
1311
  //#endregion
1477
- //#region src/react-renderer/components/layout/List.tsx
1312
+ //#region src/react-renderer/a2ui-react/catalog/minimal/components/ChildList.tsx
1478
1313
  /**
1479
- * List component - renders a scrollable list of items.
1314
+ * Copyright 2026 Google LLC
1315
+ *
1316
+ * Licensed under the Apache License, Version 2.0 (the "License");
1317
+ * you may not use this file except in compliance with the License.
1318
+ * You may obtain a copy of the License at
1319
+ *
1320
+ * http://www.apache.org/licenses/LICENSE-2.0
1480
1321
  *
1481
- * Supports direction (vertical/horizontal) properties.
1322
+ * Unless required by applicable law or agreed to in writing, software
1323
+ * distributed under the License is distributed on an "AS IS" BASIS,
1324
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1325
+ * See the License for the specific language governing permissions and
1326
+ * limitations under the License.
1482
1327
  */
1483
- const List = (0, react.memo)(function List({ node, surfaceId }) {
1484
- var _props$direction, _theme$additionalStyl;
1485
- const { theme } = useA2UIComponent(node, surfaceId);
1486
- const props = node.properties;
1487
- const direction = (_props$direction = props.direction) !== null && _props$direction !== void 0 ? _props$direction : "vertical";
1488
- const children = Array.isArray(props.children) ? props.children : [];
1489
- const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
1490
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1491
- className: "a2ui-list",
1492
- "data-direction": direction,
1493
- style: hostStyle,
1494
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1495
- className: classMapToString(theme.components.List),
1496
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.List),
1497
- children: children.map((child, index) => {
1498
- const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
1499
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
1500
- node: typeof child === "object" && child !== null && "type" in child ? child : null,
1501
- surfaceId
1502
- }, childId);
1503
- })
1504
- })
1505
- });
1506
- });
1328
+ const ChildList = ({ childList, buildChild }) => {
1329
+ if (Array.isArray(childList)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: childList.map((item, i) => {
1330
+ if (item && typeof item === "object" && "id" in item) {
1331
+ const node = item;
1332
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: buildChild(node.id, node.basePath) }, `${node.id}-${i}`);
1333
+ }
1334
+ if (typeof item === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: buildChild(item) }, `${item}-${i}`);
1335
+ return null;
1336
+ }) });
1337
+ return null;
1338
+ };
1507
1339
 
1508
1340
  //#endregion
1509
- //#region src/react-renderer/components/layout/Card.tsx
1341
+ //#region src/react-renderer/a2ui-react/catalog/minimal/components/Row.tsx
1510
1342
  /**
1511
- * Card component - a container that visually groups content.
1343
+ * Copyright 2026 Google LLC
1344
+ *
1345
+ * Licensed under the Apache License, Version 2.0 (the "License");
1346
+ * you may not use this file except in compliance with the License.
1347
+ * You may obtain a copy of the License at
1512
1348
  *
1513
- * Structure mirrors Lit's Card component:
1514
- * <div class="a2ui-card"> ← :host equivalent
1515
- * <section class="..."> ← theme classes (border, padding, background)
1516
- * {children} ← ::slotted(*) equivalent
1517
- * </section>
1518
- * </div>
1349
+ * http://www.apache.org/licenses/LICENSE-2.0
1519
1350
  *
1520
- * All styles come from componentSpecificStyles CSS, no inline styles needed.
1351
+ * Unless required by applicable law or agreed to in writing, software
1352
+ * distributed under the License is distributed on an "AS IS" BASIS,
1353
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1354
+ * See the License for the specific language governing permissions and
1355
+ * limitations under the License.
1521
1356
  */
1522
- const Card = (0, react.memo)(function Card({ node, surfaceId }) {
1523
- var _props$children, _theme$additionalStyl;
1524
- const { theme } = useA2UIComponent(node, surfaceId);
1525
- const props = node.properties;
1526
- const rawChildren = (_props$children = props.children) !== null && _props$children !== void 0 ? _props$children : props.child ? [props.child] : [];
1527
- const children = Array.isArray(rawChildren) ? rawChildren : [];
1357
+ const RowSchema = zod.z.object({
1358
+ children: _a2ui_web_core_v0_9.CommonSchemas.ChildList,
1359
+ justify: zod.z.enum([
1360
+ "center",
1361
+ "end",
1362
+ "spaceAround",
1363
+ "spaceBetween",
1364
+ "spaceEvenly",
1365
+ "start",
1366
+ "stretch"
1367
+ ]).optional(),
1368
+ align: zod.z.enum([
1369
+ "start",
1370
+ "center",
1371
+ "end",
1372
+ "stretch"
1373
+ ]).optional()
1374
+ });
1375
+ const mapJustify$1 = (j) => {
1376
+ switch (j) {
1377
+ case "center": return "center";
1378
+ case "end": return "flex-end";
1379
+ case "spaceAround": return "space-around";
1380
+ case "spaceBetween": return "space-between";
1381
+ case "spaceEvenly": return "space-evenly";
1382
+ case "start": return "flex-start";
1383
+ case "stretch": return "stretch";
1384
+ default: return "flex-start";
1385
+ }
1386
+ };
1387
+ const mapAlign$1 = (a) => {
1388
+ switch (a) {
1389
+ case "start": return "flex-start";
1390
+ case "center": return "center";
1391
+ case "end": return "flex-end";
1392
+ case "stretch": return "stretch";
1393
+ default: return "stretch";
1394
+ }
1395
+ };
1396
+ const RowApiDef = {
1397
+ name: "Row",
1398
+ schema: RowSchema
1399
+ };
1400
+ const Row = createReactComponent(RowApiDef, ({ props, buildChild }) => {
1528
1401
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1529
- className: "a2ui-card",
1530
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1531
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1532
- className: classMapToString(theme.components.Card),
1533
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Card),
1534
- children: children.map((child, index) => {
1535
- const childId = typeof child === "object" && child !== null && "id" in child ? child.id : `child-${index}`;
1536
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
1537
- node: typeof child === "object" && child !== null && "type" in child ? child : null,
1538
- surfaceId
1539
- }, childId);
1540
- })
1402
+ style: {
1403
+ display: "flex",
1404
+ flexDirection: "row",
1405
+ justifyContent: mapJustify$1(props.justify),
1406
+ alignItems: mapAlign$1(props.align)
1407
+ },
1408
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList, {
1409
+ childList: props.children,
1410
+ buildChild
1541
1411
  })
1542
1412
  });
1543
1413
  });
1544
1414
 
1545
1415
  //#endregion
1546
- //#region src/react-renderer/components/layout/Tabs.tsx
1416
+ //#region src/react-renderer/a2ui-react/catalog/minimal/components/Column.tsx
1547
1417
  /**
1548
- * Tabs component - displays content in switchable tabs.
1418
+ * Copyright 2026 Google LLC
1419
+ *
1420
+ * Licensed under the Apache License, Version 2.0 (the "License");
1421
+ * you may not use this file except in compliance with the License.
1422
+ * You may obtain a copy of the License at
1423
+ *
1424
+ * http://www.apache.org/licenses/LICENSE-2.0
1425
+ *
1426
+ * Unless required by applicable law or agreed to in writing, software
1427
+ * distributed under the License is distributed on an "AS IS" BASIS,
1428
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1429
+ * See the License for the specific language governing permissions and
1430
+ * limitations under the License.
1549
1431
  */
1550
- const Tabs = (0, react.memo)(function Tabs({ node, surfaceId }) {
1551
- var _props$tabItems, _theme$additionalStyl;
1552
- const { theme, resolveString } = useA2UIComponent(node, surfaceId);
1553
- const props = node.properties;
1554
- const [selectedIndex, setSelectedIndex] = (0, react.useState)(0);
1555
- const tabItems = (_props$tabItems = props.tabItems) !== null && _props$tabItems !== void 0 ? _props$tabItems : [];
1432
+ const ColumnSchema = zod.z.object({
1433
+ children: _a2ui_web_core_v0_9.CommonSchemas.ChildList,
1434
+ justify: zod.z.enum([
1435
+ "start",
1436
+ "center",
1437
+ "end",
1438
+ "spaceBetween",
1439
+ "spaceAround",
1440
+ "spaceEvenly",
1441
+ "stretch"
1442
+ ]).optional(),
1443
+ align: zod.z.enum([
1444
+ "center",
1445
+ "end",
1446
+ "start",
1447
+ "stretch"
1448
+ ]).optional()
1449
+ });
1450
+ const mapJustify = (j) => {
1451
+ switch (j) {
1452
+ case "center": return "center";
1453
+ case "end": return "flex-end";
1454
+ case "spaceAround": return "space-around";
1455
+ case "spaceBetween": return "space-between";
1456
+ case "spaceEvenly": return "space-evenly";
1457
+ case "start": return "flex-start";
1458
+ case "stretch": return "stretch";
1459
+ default: return "flex-start";
1460
+ }
1461
+ };
1462
+ const mapAlign = (a) => {
1463
+ switch (a) {
1464
+ case "start": return "flex-start";
1465
+ case "center": return "center";
1466
+ case "end": return "flex-end";
1467
+ case "stretch": return "stretch";
1468
+ default: return "stretch";
1469
+ }
1470
+ };
1471
+ const ColumnApiDef = {
1472
+ name: "Column",
1473
+ schema: ColumnSchema
1474
+ };
1475
+ const Column = createReactComponent(ColumnApiDef, ({ props, buildChild }) => {
1556
1476
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1557
- className: "a2ui-tabs",
1558
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1559
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1560
- className: classMapToString(theme.components.Tabs.container),
1561
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Tabs),
1562
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1563
- id: "buttons",
1564
- className: classMapToString(theme.components.Tabs.element),
1565
- children: tabItems.map((tab, index) => {
1566
- const title = resolveString(tab.title);
1567
- const isSelected = index === selectedIndex;
1568
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1569
- disabled: isSelected,
1570
- className: classMapToString(isSelected ? mergeClassMaps(theme.components.Tabs.controls.all, theme.components.Tabs.controls.selected) : theme.components.Tabs.controls.all),
1571
- onClick: () => setSelectedIndex(index),
1572
- children: title
1573
- }, index);
1574
- })
1575
- }), tabItems[selectedIndex] && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
1576
- node: tabItems[selectedIndex].child,
1577
- surfaceId
1578
- })]
1477
+ style: {
1478
+ display: "flex",
1479
+ flexDirection: "column",
1480
+ justifyContent: mapJustify(props.justify),
1481
+ alignItems: mapAlign(props.align),
1482
+ gap: "8px"
1483
+ },
1484
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildList, {
1485
+ childList: props.children,
1486
+ buildChild
1579
1487
  })
1580
1488
  });
1581
1489
  });
1582
1490
 
1583
1491
  //#endregion
1584
- //#region src/react-renderer/components/layout/Modal.tsx
1492
+ //#region src/react-renderer/a2ui-react/catalog/minimal/components/TextField.tsx
1585
1493
  /**
1586
- * Modal component - displays content in a dialog overlay.
1494
+ * Copyright 2026 Google LLC
1587
1495
  *
1588
- * Matches Lit's rendering approach:
1589
- * - When closed: renders section with entry point child
1590
- * - When open: renders dialog with content child (entry point is replaced)
1496
+ * Licensed under the Apache License, Version 2.0 (the "License");
1497
+ * you may not use this file except in compliance with the License.
1498
+ * You may obtain a copy of the License at
1591
1499
  *
1592
- * The dialog is rendered in place (no portal) so it stays inside .a2ui-surface
1593
- * and CSS selectors work correctly. showModal() handles the top-layer overlay.
1500
+ * http://www.apache.org/licenses/LICENSE-2.0
1501
+ *
1502
+ * Unless required by applicable law or agreed to in writing, software
1503
+ * distributed under the License is distributed on an "AS IS" BASIS,
1504
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1505
+ * See the License for the specific language governing permissions and
1506
+ * limitations under the License.
1594
1507
  */
1595
- const Modal = (0, react.memo)(function Modal({ node, surfaceId }) {
1596
- var _theme$additionalStyl;
1597
- const { theme } = useA2UIComponent(node, surfaceId);
1598
- const props = node.properties;
1599
- const [isOpen, setIsOpen] = (0, react.useState)(false);
1600
- const dialogRef = (0, react.useRef)(null);
1601
- const openModal = (0, react.useCallback)(() => {
1602
- setIsOpen(true);
1603
- }, []);
1604
- const closeModal = (0, react.useCallback)(() => {
1605
- setIsOpen(false);
1606
- }, []);
1607
- (0, react.useEffect)(() => {
1608
- const dialog = dialogRef.current;
1609
- if (!dialog) return;
1610
- if (isOpen && !dialog.open) dialog.showModal();
1611
- const handleClose = () => {
1612
- setIsOpen(false);
1613
- };
1614
- dialog.addEventListener("close", handleClose);
1615
- return () => dialog.removeEventListener("close", handleClose);
1616
- }, [isOpen]);
1617
- const handleBackdropClick = (0, react.useCallback)((e) => {
1618
- if (e.target === e.currentTarget) closeModal();
1619
- }, [closeModal]);
1620
- const handleKeyDown = (0, react.useCallback)((e) => {
1621
- if (e.key === "Escape") closeModal();
1622
- }, [closeModal]);
1623
- const hostStyle = node.weight !== void 0 ? { "--weight": node.weight } : {};
1624
- if (!isOpen) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1625
- className: "a2ui-modal",
1626
- style: hostStyle,
1627
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1628
- onClick: openModal,
1629
- style: { cursor: "pointer" },
1630
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
1631
- node: props.entryPointChild,
1632
- surfaceId
1633
- })
1634
- })
1635
- });
1636
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1637
- className: "a2ui-modal",
1638
- style: hostStyle,
1639
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dialog", {
1640
- ref: dialogRef,
1641
- className: classMapToString(theme.components.Modal.backdrop),
1642
- onClick: handleBackdropClick,
1643
- onKeyDown: handleKeyDown,
1644
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1645
- className: classMapToString(theme.components.Modal.element),
1646
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Modal),
1647
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1648
- id: "controls",
1649
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1650
- onClick: closeModal,
1651
- "aria-label": "Close modal",
1652
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1653
- className: "g-icon",
1654
- children: "close"
1655
- })
1656
- })
1657
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
1658
- node: props.contentChild,
1659
- surfaceId
1660
- })]
1661
- })
1662
- })
1508
+ const TextFieldSchema = zod.z.object({
1509
+ label: _a2ui_web_core_v0_9.CommonSchemas.DynamicString,
1510
+ value: _a2ui_web_core_v0_9.CommonSchemas.DynamicString,
1511
+ variant: zod.z.enum([
1512
+ "longText",
1513
+ "number",
1514
+ "shortText",
1515
+ "obscured"
1516
+ ]).optional(),
1517
+ validationRegexp: zod.z.string().optional()
1518
+ });
1519
+ const TextFieldApiDef = {
1520
+ name: "TextField",
1521
+ schema: TextFieldSchema
1522
+ };
1523
+ const TextField = createReactComponent(TextFieldApiDef, ({ props, context }) => {
1524
+ const onChange = (e) => {
1525
+ if (props.setValue) props.setValue(e.target.value);
1526
+ };
1527
+ const isLong = props.variant === "longText";
1528
+ const type = props.variant === "number" ? "number" : props.variant === "obscured" ? "password" : "text";
1529
+ const style = {
1530
+ padding: "8px",
1531
+ width: "100%",
1532
+ border: "1px solid #ccc",
1533
+ borderRadius: "4px",
1534
+ boxSizing: "border-box"
1535
+ };
1536
+ const id = `textfield-${context.componentModel.id}`;
1537
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1538
+ style: {
1539
+ display: "flex",
1540
+ flexDirection: "column",
1541
+ gap: "4px",
1542
+ width: "100%"
1543
+ },
1544
+ children: [props.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1545
+ htmlFor: id,
1546
+ style: {
1547
+ fontSize: "14px",
1548
+ fontWeight: "bold"
1549
+ },
1550
+ children: props.label
1551
+ }), isLong ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
1552
+ id,
1553
+ style,
1554
+ value: props.value || "",
1555
+ onChange
1556
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1557
+ id,
1558
+ type,
1559
+ style,
1560
+ value: props.value || "",
1561
+ onChange
1562
+ })]
1663
1563
  });
1664
1564
  });
1665
1565
 
1666
1566
  //#endregion
1667
- //#region src/react-renderer/components/interactive/Button.tsx
1567
+ //#region src/react-renderer/a2ui-react/catalog/minimal/index.ts
1668
1568
  /**
1669
- * Button component - a clickable element that triggers an action.
1569
+ * Copyright 2026 Google LLC
1570
+ *
1571
+ * Licensed under the Apache License, Version 2.0 (the "License");
1572
+ * you may not use this file except in compliance with the License.
1573
+ * You may obtain a copy of the License at
1670
1574
  *
1671
- * Contains a child component (usually Text or Icon) and dispatches
1672
- * a user action when clicked.
1575
+ * http://www.apache.org/licenses/LICENSE-2.0
1576
+ *
1577
+ * Unless required by applicable law or agreed to in writing, software
1578
+ * distributed under the License is distributed on an "AS IS" BASIS,
1579
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1580
+ * See the License for the specific language governing permissions and
1581
+ * limitations under the License.
1673
1582
  */
1674
- const Button = (0, react.memo)(function Button({ node, surfaceId }) {
1675
- var _theme$additionalStyl;
1676
- const { theme, sendAction } = useA2UIComponent(node, surfaceId);
1677
- const props = node.properties;
1678
- const handleClick = (0, react.useCallback)(() => {
1679
- if (props.action) sendAction(props.action);
1680
- }, [props.action, sendAction]);
1681
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1682
- className: "a2ui-button",
1683
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1684
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1685
- className: classMapToString(theme.components.Button),
1686
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Button),
1687
- onClick: handleClick,
1688
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentNode, {
1689
- node: props.child,
1690
- surfaceId
1691
- })
1692
- })
1583
+ const minimalComponents = [
1584
+ Text,
1585
+ Button,
1586
+ Row,
1587
+ Column,
1588
+ TextField
1589
+ ];
1590
+ const minimalCatalog = new _a2ui_web_core_v0_9.Catalog("https://a2ui.org/specification/v0_9/catalogs/minimal/minimal_catalog.json", minimalComponents, [(0, _a2ui_web_core_v0_9.createFunctionImplementation)({
1591
+ name: "capitalize",
1592
+ returnType: "string",
1593
+ schema: zod.z.object({ value: zod.z.unknown() })
1594
+ }, (args) => {
1595
+ const val = args.value;
1596
+ if (typeof val === "string") return val.toUpperCase();
1597
+ return val;
1598
+ })]);
1599
+
1600
+ //#endregion
1601
+ //#region src/react-renderer/theme/ThemeContext.tsx
1602
+ /** React context for the A2UI theme. */
1603
+ const ThemeContext = (0, react.createContext)(void 0);
1604
+ function ThemeProvider({ theme, children }) {
1605
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeContext.Provider, {
1606
+ value: theme !== null && theme !== void 0 ? theme : {},
1607
+ children
1693
1608
  });
1694
- });
1609
+ }
1610
+ function useTheme() {
1611
+ const theme = (0, react.useContext)(ThemeContext);
1612
+ if (!theme) throw new Error("useTheme must be used within a ThemeProvider or A2UIProvider");
1613
+ return theme;
1614
+ }
1615
+ function useThemeOptional() {
1616
+ return (0, react.useContext)(ThemeContext);
1617
+ }
1695
1618
 
1696
1619
  //#endregion
1697
- //#region src/react-renderer/components/interactive/TextField.tsx
1620
+ //#region src/react-renderer/core/A2UIProvider.tsx
1698
1621
  /**
1699
- * TextField component - an input field for text entry.
1700
- *
1701
- * Supports various input types and two-way data binding.
1622
+ * Context for stable actions (never changes reference, prevents re-renders).
1623
+ */
1624
+ const A2UIActionsContext = (0, react.createContext)(null);
1625
+ /**
1626
+ * Context for reactive state (changes trigger re-renders).
1627
+ */
1628
+ const A2UIStateContext = (0, react.createContext)(null);
1629
+ /**
1630
+ * Provider component that sets up the A2UI v0.9 context for descendant components.
1631
+ * Uses a two-context architecture for performance:
1632
+ * - A2UIActionsContext: Stable actions that never change (no re-renders)
1633
+ * - A2UIStateContext: Reactive state that triggers re-renders when needed
1702
1634
  */
1703
- const TextField = (0, react.memo)(function TextField({ node, surfaceId }) {
1704
- var _props$text, _resolveString, _theme$additionalStyl, _theme$additionalStyl2;
1705
- const { theme, resolveString, setValue, getValue } = useA2UIComponent(node, surfaceId);
1706
- const props = node.properties;
1707
- const id = (0, react.useId)();
1708
- const label = resolveString(props.label);
1709
- const textPath = (_props$text = props.text) === null || _props$text === void 0 ? void 0 : _props$text.path;
1710
- const initialValue = (_resolveString = resolveString(props.text)) !== null && _resolveString !== void 0 ? _resolveString : "";
1711
- const fieldType = props.type;
1712
- const validationRegexp = props.validationRegexp;
1713
- const [value, setLocalValue] = (0, react.useState)(initialValue);
1714
- const [_isValid, setIsValid] = (0, react.useState)(true);
1715
- (0, react.useEffect)(() => {
1716
- if (textPath) {
1717
- const externalValue = getValue(textPath);
1718
- if (externalValue !== null && String(externalValue) !== value) setLocalValue(String(externalValue));
1635
+ function A2UIProvider({ onAction, theme, catalog, children }) {
1636
+ const onActionRef = (0, react.useRef)(onAction !== null && onAction !== void 0 ? onAction : null);
1637
+ onActionRef.current = onAction !== null && onAction !== void 0 ? onAction : null;
1638
+ const processorRef = (0, react.useRef)(null);
1639
+ if (!processorRef.current) processorRef.current = new _a2ui_web_core_v0_9.MessageProcessor([catalog !== null && catalog !== void 0 ? catalog : basicCatalog], (action) => {
1640
+ if (onActionRef.current) {
1641
+ var _action$name, _action$surfaceId, _action$timestamp;
1642
+ const message = { userAction: {
1643
+ name: (_action$name = action === null || action === void 0 ? void 0 : action.name) !== null && _action$name !== void 0 ? _action$name : "unknown",
1644
+ surfaceId: (_action$surfaceId = action === null || action === void 0 ? void 0 : action.surfaceId) !== null && _action$surfaceId !== void 0 ? _action$surfaceId : "default",
1645
+ sourceComponentId: action === null || action === void 0 ? void 0 : action.sourceComponentId,
1646
+ context: action === null || action === void 0 ? void 0 : action.context,
1647
+ timestamp: (_action$timestamp = action === null || action === void 0 ? void 0 : action.timestamp) !== null && _action$timestamp !== void 0 ? _action$timestamp : (/* @__PURE__ */ new Date()).toISOString()
1648
+ } };
1649
+ onActionRef.current(message);
1719
1650
  }
1720
- }, [textPath, getValue]);
1721
- const handleChange = (0, react.useCallback)((e) => {
1722
- const newValue = e.target.value;
1723
- setLocalValue(newValue);
1724
- if (validationRegexp) setIsValid(new RegExp(validationRegexp).test(newValue));
1725
- if (textPath) setValue(textPath, newValue);
1726
- }, [
1727
- validationRegexp,
1728
- textPath,
1729
- setValue
1730
- ]);
1731
- const inputType = fieldType === "number" ? "number" : fieldType === "date" ? "date" : "text";
1732
- const isTextArea = fieldType === "longText";
1733
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1734
- className: "a2ui-textfield",
1735
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1736
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1737
- className: classMapToString(theme.components.TextField.container),
1738
- children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1739
- htmlFor: id,
1740
- className: classMapToString(theme.components.TextField.label),
1741
- children: label
1742
- }), isTextArea ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
1743
- id,
1744
- value,
1745
- onChange: handleChange,
1746
- placeholder: "Please enter a value",
1747
- className: classMapToString(theme.components.TextField.element),
1748
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.TextField)
1749
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1750
- type: inputType,
1751
- id,
1752
- value,
1753
- onChange: handleChange,
1754
- placeholder: "Please enter a value",
1755
- className: classMapToString(theme.components.TextField.element),
1756
- style: stylesToObject((_theme$additionalStyl2 = theme.additionalStyles) === null || _theme$additionalStyl2 === void 0 ? void 0 : _theme$additionalStyl2.TextField)
1757
- })]
1651
+ });
1652
+ const processor = processorRef.current;
1653
+ const [version, setVersion] = (0, react.useState)(0);
1654
+ const [error, setError] = (0, react.useState)(null);
1655
+ const actionsRef = (0, react.useRef)(null);
1656
+ if (!actionsRef.current) actionsRef.current = {
1657
+ processMessages: (messages) => {
1658
+ try {
1659
+ processor.processMessages(messages);
1660
+ } catch (err) {
1661
+ console.warn("[A2UI] processMessages error:", err);
1662
+ setError(err instanceof Error ? err.message : String(err));
1663
+ return;
1664
+ }
1665
+ setError(null);
1666
+ setVersion((v) => v + 1);
1667
+ },
1668
+ dispatch: (message) => {
1669
+ if (onActionRef.current) onActionRef.current(message);
1670
+ },
1671
+ getSurface: (surfaceId) => {
1672
+ return processor.model.getSurface(surfaceId);
1673
+ },
1674
+ clearSurfaces: () => {
1675
+ const surfaces = processor.model.surfacesMap;
1676
+ for (const [id] of surfaces) processor.processMessages([{
1677
+ version: "v0.9",
1678
+ deleteSurface: { surfaceId: id }
1679
+ }]);
1680
+ setVersion((v) => v + 1);
1681
+ }
1682
+ };
1683
+ const actions = actionsRef.current;
1684
+ const stateValue = (0, react.useMemo)(() => ({
1685
+ version,
1686
+ error
1687
+ }), [version, error]);
1688
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIActionsContext.Provider, {
1689
+ value: actions,
1690
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIStateContext.Provider, {
1691
+ value: stateValue,
1692
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeProvider, {
1693
+ theme,
1694
+ children
1695
+ })
1758
1696
  })
1759
1697
  });
1760
- });
1698
+ }
1699
+ /**
1700
+ * Hook to access stable A2UI actions (won't cause re-renders).
1701
+ */
1702
+ function useA2UIActions() {
1703
+ const actions = (0, react.useContext)(A2UIActionsContext);
1704
+ if (!actions) throw new Error("useA2UIActions must be used within an A2UIProvider");
1705
+ return actions;
1706
+ }
1707
+ /**
1708
+ * Hook to subscribe to A2UI state changes.
1709
+ */
1710
+ function useA2UIState() {
1711
+ const state = (0, react.useContext)(A2UIStateContext);
1712
+ if (!state) throw new Error("useA2UIState must be used within an A2UIProvider");
1713
+ return state;
1714
+ }
1715
+ /**
1716
+ * Hook to access the full A2UI context (actions + state).
1717
+ */
1718
+ function useA2UIContext() {
1719
+ const actions = useA2UIActions();
1720
+ const state = useA2UIState();
1721
+ return (0, react.useMemo)(() => ({
1722
+ ...actions,
1723
+ version: state.version,
1724
+ onAction: null
1725
+ }), [actions, state.version]);
1726
+ }
1727
+ /** @deprecated Use useA2UIContext instead. */
1728
+ const useA2UIStore = useA2UIContext;
1729
+ /**
1730
+ * Hook to access the current A2UI error state.
1731
+ */
1732
+ function useA2UIError() {
1733
+ var _state$error;
1734
+ const state = (0, react.useContext)(A2UIStateContext);
1735
+ return (_state$error = state === null || state === void 0 ? void 0 : state.error) !== null && _state$error !== void 0 ? _state$error : null;
1736
+ }
1737
+ /** @deprecated Use useA2UIContext() or useA2UI() directly instead. */
1738
+ function useA2UIStoreSelector(selector) {
1739
+ return selector(useA2UIContext());
1740
+ }
1761
1741
 
1762
1742
  //#endregion
1763
- //#region src/react-renderer/components/interactive/CheckBox.tsx
1743
+ //#region src/react-renderer/hooks/useA2UI.ts
1764
1744
  /**
1765
- * CheckBox component - a boolean toggle with a label.
1766
- *
1767
- * Supports two-way data binding for the checked state.
1745
+ * Main API hook for A2UI v0.9. Provides methods to process messages
1746
+ * and access surface state.
1768
1747
  */
1769
- const CheckBox = (0, react.memo)(function CheckBox({ node, surfaceId }) {
1770
- var _props$value, _resolveBoolean, _props$value3, _theme$additionalStyl;
1771
- const { theme, resolveString, resolveBoolean, setValue, getValue } = useA2UIComponent(node, surfaceId);
1772
- const props = node.properties;
1773
- const id = (0, react.useId)();
1774
- const label = resolveString(props.label);
1775
- const valuePath = (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.path;
1776
- const [checked, setChecked] = (0, react.useState)((_resolveBoolean = resolveBoolean(props.value)) !== null && _resolveBoolean !== void 0 ? _resolveBoolean : false);
1777
- (0, react.useEffect)(() => {
1778
- if (valuePath) {
1779
- const externalValue = getValue(valuePath);
1780
- if (externalValue !== null && Boolean(externalValue) !== checked) setChecked(Boolean(externalValue));
1781
- }
1782
- }, [valuePath, getValue]);
1783
- (0, react.useEffect)(() => {
1784
- var _props$value2;
1785
- if (((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.literalBoolean) !== void 0) setChecked(props.value.literalBoolean);
1786
- }, [(_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.literalBoolean]);
1787
- const handleChange = (0, react.useCallback)((e) => {
1788
- const newValue = e.target.checked;
1789
- setChecked(newValue);
1790
- if (valuePath) setValue(valuePath, newValue);
1791
- }, [valuePath, setValue]);
1792
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1793
- className: "a2ui-checkbox",
1794
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1795
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1796
- className: classMapToString(theme.components.CheckBox.container),
1797
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.CheckBox),
1798
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1799
- type: "checkbox",
1800
- id,
1801
- checked,
1802
- onChange: handleChange,
1803
- className: classMapToString(theme.components.CheckBox.element)
1804
- }), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1805
- htmlFor: id,
1806
- className: classMapToString(theme.components.CheckBox.label),
1807
- children: label
1808
- })]
1809
- })
1810
- });
1811
- });
1748
+ function useA2UI() {
1749
+ const actions = useA2UIActions();
1750
+ const state = useA2UIState();
1751
+ return {
1752
+ processMessages: actions.processMessages,
1753
+ getSurface: actions.getSurface,
1754
+ clearSurfaces: actions.clearSurfaces,
1755
+ version: state.version
1756
+ };
1757
+ }
1812
1758
 
1813
1759
  //#endregion
1814
- //#region src/react-renderer/components/interactive/Slider.tsx
1760
+ //#region src/react-renderer/lib/utils.ts
1815
1761
  /**
1816
- * Slider component - a numeric value selector with a range.
1817
- *
1818
- * Supports two-way data binding for the value.
1762
+ * Utility function to merge class names.
1819
1763
  */
1820
- const Slider = (0, react.memo)(function Slider({ node, surfaceId }) {
1821
- var _props$value, _resolveNumber, _props$minValue, _props$maxValue, _props$value3, _theme$additionalStyl;
1822
- const { theme, resolveNumber, resolveString, setValue, getValue } = useA2UIComponent(node, surfaceId);
1823
- const props = node.properties;
1824
- const id = (0, react.useId)();
1825
- const valuePath = (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.path;
1826
- const initialValue = (_resolveNumber = resolveNumber(props.value)) !== null && _resolveNumber !== void 0 ? _resolveNumber : 0;
1827
- const minValue = (_props$minValue = props.minValue) !== null && _props$minValue !== void 0 ? _props$minValue : 0;
1828
- const maxValue = (_props$maxValue = props.maxValue) !== null && _props$maxValue !== void 0 ? _props$maxValue : 0;
1829
- const [value, setLocalValue] = (0, react.useState)(initialValue);
1830
- (0, react.useEffect)(() => {
1831
- if (valuePath) {
1832
- const externalValue = getValue(valuePath);
1833
- if (externalValue !== null && Number(externalValue) !== value) setLocalValue(Number(externalValue));
1834
- }
1835
- }, [valuePath, getValue]);
1836
- (0, react.useEffect)(() => {
1837
- var _props$value2;
1838
- if (((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.literalNumber) !== void 0) setLocalValue(props.value.literalNumber);
1839
- }, [(_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.literalNumber]);
1840
- const handleChange = (0, react.useCallback)((e) => {
1841
- const newValue = Number(e.target.value);
1842
- setLocalValue(newValue);
1843
- if (valuePath) setValue(valuePath, newValue);
1844
- }, [valuePath, setValue]);
1845
- const labelValue = props.label;
1846
- const label = labelValue ? resolveString(labelValue) : "";
1847
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1848
- className: "a2ui-slider",
1849
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1850
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1851
- className: classMapToString(theme.components.Slider.container),
1852
- children: [
1853
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1854
- htmlFor: id,
1855
- className: classMapToString(theme.components.Slider.label),
1856
- children: label
1857
- }),
1858
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1859
- type: "range",
1860
- id,
1861
- name: "data",
1862
- value,
1863
- min: minValue,
1864
- max: maxValue,
1865
- onChange: handleChange,
1866
- className: classMapToString(theme.components.Slider.element),
1867
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.Slider)
1868
- }),
1869
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1870
- className: classMapToString(theme.components.Slider.label),
1871
- children: value
1872
- })
1873
- ]
1874
- })
1875
- });
1876
- });
1764
+ function cn(...inputs) {
1765
+ return (0, clsx.clsx)(inputs);
1766
+ }
1877
1767
 
1878
1768
  //#endregion
1879
- //#region src/react-renderer/components/interactive/DateTimeInput.tsx
1880
- /**
1881
- * DateTimeInput component - a date and/or time picker.
1882
- *
1883
- * Supports enabling date, time, or both. Uses native HTML5 date/time inputs.
1884
- */
1885
- const DateTimeInput = (0, react.memo)(function DateTimeInput({ node, surfaceId }) {
1886
- var _props$value, _resolveString, _props$enableDate, _props$enableTime, _theme$additionalStyl;
1887
- const { theme, resolveString, setValue, getValue } = useA2UIComponent(node, surfaceId);
1888
- const props = node.properties;
1889
- const id = (0, react.useId)();
1890
- const valuePath = (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.path;
1891
- const initialValue = (_resolveString = resolveString(props.value)) !== null && _resolveString !== void 0 ? _resolveString : "";
1892
- const enableDate = (_props$enableDate = props.enableDate) !== null && _props$enableDate !== void 0 ? _props$enableDate : true;
1893
- const enableTime = (_props$enableTime = props.enableTime) !== null && _props$enableTime !== void 0 ? _props$enableTime : false;
1894
- const [value, setLocalValue] = (0, react.useState)(initialValue);
1895
- (0, react.useEffect)(() => {
1896
- if (valuePath) {
1897
- const externalValue = getValue(valuePath);
1898
- if (externalValue !== null && String(externalValue) !== value) setLocalValue(String(externalValue));
1899
- }
1900
- }, [valuePath, getValue]);
1901
- const handleChange = (0, react.useCallback)((e) => {
1902
- const newValue = e.target.value;
1903
- setLocalValue(newValue);
1904
- if (valuePath) setValue(valuePath, newValue);
1905
- }, [valuePath, setValue]);
1906
- let inputType = "date";
1907
- if (enableDate && enableTime) inputType = "datetime-local";
1908
- else if (enableTime && !enableDate) inputType = "time";
1909
- const getPlaceholderText = () => {
1910
- if (enableDate && enableTime) return "Date & Time";
1911
- else if (enableTime) return "Time";
1912
- return "Date";
1913
- };
1769
+ //#region src/react-renderer/core/A2UIRenderer.tsx
1770
+ /** Default loading fallback - memoized to prevent recreation */
1771
+ const DefaultLoadingFallback = (0, react.memo)(function DefaultLoadingFallback() {
1914
1772
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1915
- className: "a2ui-datetime-input",
1916
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1917
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1918
- className: classMapToString(theme.components.DateTimeInput.container),
1919
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1920
- htmlFor: id,
1921
- className: classMapToString(theme.components.DateTimeInput.label),
1922
- children: getPlaceholderText()
1923
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1924
- type: inputType,
1925
- id,
1926
- value,
1927
- onChange: handleChange,
1928
- className: classMapToString(theme.components.DateTimeInput.element),
1929
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.DateTimeInput)
1930
- })]
1931
- })
1773
+ className: "a2ui-loading",
1774
+ style: {
1775
+ padding: "16px",
1776
+ opacity: .5
1777
+ },
1778
+ children: "Loading..."
1932
1779
  });
1933
1780
  });
1934
-
1935
- //#endregion
1936
- //#region src/react-renderer/components/interactive/MultipleChoice.tsx
1937
- /**
1938
- * MultipleChoice component - a selection component using a dropdown.
1781
+ /**
1782
+ * A2UIRenderer - renders an A2UI surface using the v0.9 renderer.
1939
1783
  *
1940
- * Renders a <select> element with options, matching the Lit renderer's behavior.
1941
- * Supports two-way data binding for the selected value.
1784
+ * Uses A2uiSurface from a2ui-react which handles all component
1785
+ * rendering internally via the catalog system.
1942
1786
  */
1943
- const MultipleChoice = (0, react.memo)(function MultipleChoice({ node, surfaceId }) {
1944
- var _ref, _props$selections, _resolveString, _theme$additionalStyl;
1945
- const { theme, resolveString, setValue } = useA2UIComponent(node, surfaceId);
1946
- const props = node.properties;
1947
- const id = (0, react.useId)();
1948
- const options = (_ref = props.options) !== null && _ref !== void 0 ? _ref : [];
1949
- const selectionsPath = (_props$selections = props.selections) === null || _props$selections === void 0 ? void 0 : _props$selections.path;
1950
- const description = (_resolveString = resolveString(props.description)) !== null && _resolveString !== void 0 ? _resolveString : "Select an item";
1951
- const handleChange = (0, react.useCallback)((e) => {
1952
- if (selectionsPath) setValue(selectionsPath, [e.target.value]);
1953
- }, [selectionsPath, setValue]);
1787
+ const A2UIRenderer = (0, react.memo)(function A2UIRenderer({ surfaceId, className, fallback = null, loadingFallback }) {
1788
+ const { getSurface, version } = useA2UI();
1789
+ const surface = getSurface(surfaceId);
1790
+ if (!surface) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: fallback });
1791
+ const actualLoadingFallback = loadingFallback !== null && loadingFallback !== void 0 ? loadingFallback : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultLoadingFallback, {});
1954
1792
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1955
- className: "a2ui-multiplechoice",
1956
- style: node.weight !== void 0 ? { "--weight": node.weight } : {},
1957
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1958
- className: classMapToString(theme.components.MultipleChoice.container),
1959
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1960
- htmlFor: id,
1961
- className: classMapToString(theme.components.MultipleChoice.label),
1962
- children: description
1963
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
1964
- name: "data",
1965
- id,
1966
- className: classMapToString(theme.components.MultipleChoice.element),
1967
- style: stylesToObject((_theme$additionalStyl = theme.additionalStyles) === null || _theme$additionalStyl === void 0 ? void 0 : _theme$additionalStyl.MultipleChoice),
1968
- onChange: handleChange,
1969
- children: options.map((option) => {
1970
- const label = resolveString(option.label);
1971
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1972
- value: option.value,
1973
- children: label
1974
- }, option.value);
1975
- })
1976
- })]
1793
+ className: cn("a2ui-surface", className),
1794
+ "data-surface-id": surfaceId,
1795
+ "data-version": version,
1796
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
1797
+ fallback: actualLoadingFallback,
1798
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2uiSurface, { surface })
1977
1799
  })
1978
1800
  });
1979
1801
  });
1980
1802
 
1981
1803
  //#endregion
1982
- //#region src/react-renderer/registry/defaultCatalog.ts
1983
- /**
1984
- * Registers all standard A2UI components in the registry.
1985
- *
1986
- * @param registry - The component registry to populate
1804
+ //#region src/react-renderer/catalog-utils.ts
1805
+ const BASIC_CATALOG_ID = "https://a2ui.org/specification/v0_9/basic_catalog.json";
1806
+ /**
1807
+ * Context description used to identify the A2UI component schema in RunAgentInput.context.
1808
+ * Must match the constant in @ag-ui/a2ui-middleware so the middleware can overwrite
1809
+ * a frontend-provided schema with a server-side one.
1987
1810
  */
1988
- function registerDefaultCatalog(registry) {
1989
- registry.register("Text", { component: Text });
1990
- registry.register("Image", { component: Image });
1991
- registry.register("Icon", { component: Icon });
1992
- registry.register("Divider", { component: Divider });
1993
- registry.register("Video", { component: Video });
1994
- registry.register("AudioPlayer", { component: AudioPlayer });
1995
- registry.register("Row", { component: Row });
1996
- registry.register("Column", { component: Column });
1997
- registry.register("List", { component: List });
1998
- registry.register("Card", { component: Card });
1999
- registry.register("Tabs", { component: Tabs });
2000
- registry.register("Modal", { component: Modal });
2001
- registry.register("Button", { component: Button });
2002
- registry.register("TextField", { component: TextField });
2003
- registry.register("CheckBox", { component: CheckBox });
2004
- registry.register("Slider", { component: Slider });
2005
- registry.register("DateTimeInput", { component: DateTimeInput });
2006
- registry.register("MultipleChoice", { component: MultipleChoice });
2007
- }
1811
+ const A2UI_SCHEMA_CONTEXT_DESCRIPTION = "A2UI Component Schema — available components for generating UI surfaces. Use these component names and props when creating A2UI operations.";
2008
1812
  /**
2009
- * Initialize the default catalog in the singleton registry.
2010
- * Call this once at app startup.
1813
+ * Check whether a catalog is a superset of the basic catalog
1814
+ * (i.e., it contains all basic components by name).
2011
1815
  */
2012
- function initializeDefaultCatalog() {
2013
- registerDefaultCatalog(ComponentRegistry.getInstance());
1816
+ function extendsBasicCatalog(catalog) {
1817
+ for (const name of basicCatalog.components.keys()) if (!catalog.components.has(name)) return false;
1818
+ return true;
2014
1819
  }
2015
-
2016
- //#endregion
2017
- //#region src/react-renderer/styles/reset.ts
2018
- /**
2019
- * Browser default reset for A2UI surfaces.
2020
- *
2021
- * The React renderer uses Light DOM, which means host-app CSS resets
2022
- * (e.g. Tailwind preflight, normalize.css) can strip browser defaults
2023
- * like heading margins, list styles, and form element appearance from
2024
- * elements inside the renderer.
2025
- *
2026
- * The Lit renderer avoids this because Shadow DOM isolates its elements
2027
- * from external stylesheets.
2028
- *
2029
- * This reset restores browser defaults inside `.a2ui-surface` by using
2030
- * `all: revert` in a CSS @layer. Layered styles have the lowest author
2031
- * priority, so every other A2UI style (utility classes, component styles,
2032
- * theme classes, inline styles) automatically overrides the reset.
1820
+ /**
1821
+ * Return the names of components in a catalog that are not in the basic catalog.
2033
1822
  */
2034
- const resetStyles = `
2035
- @layer a2ui-reset {
2036
- :where(.a2ui-surface) :where(*) {
2037
- all: revert;
2038
- }
2039
- }
2040
- `;
2041
-
2042
- //#endregion
2043
- //#region src/react-renderer/styles/index.ts
2044
- /**
2045
- * Structural CSS styles from the Lit renderer, converted for global DOM use.
2046
- * These styles define all the utility classes (layout-*, typography-*, color-*, etc.)
2047
- * Converts :host selectors to .a2ui-surface for scoped use outside Shadow DOM.
1823
+ function getCustomComponentNames(catalog) {
1824
+ const custom = [];
1825
+ for (const name of catalog.components.keys()) if (!basicCatalog.components.has(name)) custom.push(name);
1826
+ return custom;
1827
+ }
1828
+ /**
1829
+ * Build a context string describing the available A2UI catalog and custom components.
1830
+ * Custom components (those not in the basic catalog) are described using their
1831
+ * JSON Schema representation, matching the canonical A2UI catalog format.
2048
1832
  */
2049
- const structuralStyles = _a2ui_lit_0_8.Styles.structuralStyles.replace(/:host\s*\{/g, ".a2ui-surface {");
1833
+ function buildCatalogContextValue(catalog) {
1834
+ const resolved = catalog !== null && catalog !== void 0 ? catalog : basicCatalog;
1835
+ const lines = [];
1836
+ lines.push("Available A2UI catalog:");
1837
+ if (resolved.id === BASIC_CATALOG_ID) {
1838
+ lines.push(`- ${resolved.id} (basic catalog)`);
1839
+ return lines.join("\n");
1840
+ }
1841
+ const isSuperset = extendsBasicCatalog(resolved);
1842
+ const customNames = getCustomComponentNames(resolved);
1843
+ lines.push(`- ${resolved.id}`);
1844
+ if (isSuperset) lines.push(" Extends the basic catalog with all standard components plus:");
1845
+ else {
1846
+ lines.push(" Custom catalog (does NOT include all basic components).");
1847
+ lines.push(" Custom components:");
1848
+ }
1849
+ for (const name of customNames) {
1850
+ const comp = resolved.components.get(name);
1851
+ if (!comp) continue;
1852
+ const jsonSchema = (0, zod_to_json_schema.zodToJsonSchema)(comp.schema);
1853
+ lines.push(` - ${name}:`);
1854
+ lines.push(` ${JSON.stringify(jsonSchema, null, 2).split("\n").join("\n ")}`);
1855
+ }
1856
+ return lines.join("\n");
1857
+ }
2050
1858
  /**
2051
- * Component-specific styles that replicate Lit's Shadow DOM scoped CSS.
2052
- *
2053
- * Each Lit component has `static styles` with :host, element selectors, and ::slotted().
2054
- * Since React uses Light DOM, we transform these to global CSS scoped under .a2ui-surface.
1859
+ * Extract component schemas from a catalog in the same format used by
1860
+ * the A2UI middleware (`A2UIComponentSchema[]`). Each component's Zod
1861
+ * schema is converted to JSON Schema via zod-to-json-schema.
2055
1862
  *
2056
- * Transformation rules:
2057
- * :host → .a2ui-surface .a2ui-{component}
2058
- * section → .a2ui-surface .a2ui-{component} section
2059
- * ::slotted(*) → .a2ui-surface .a2ui-{component} section > *
1863
+ * When sent via `useAgentContext` with `A2UI_SCHEMA_CONTEXT_DESCRIPTION`,
1864
+ * the middleware can optionally overwrite it with a server-side schema.
2060
1865
  */
2061
- const componentSpecificStyles = `
2062
- /* =========================================================================
2063
- * Card (from Lit card.ts static styles)
2064
- * ========================================================================= */
2065
-
2066
- /* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
2067
- .a2ui-surface .a2ui-card {
2068
- display: block;
2069
- flex: var(--weight);
2070
- min-height: 0;
2071
- overflow: auto;
2072
- }
2073
-
2074
- /* section { height: 100%; width: 100%; min-height: 0; overflow: auto; } */
2075
- /* Use > to target only Card's direct section, not nested sections (e.g., TextField's section) */
2076
- .a2ui-surface .a2ui-card > section {
2077
- height: 100%;
2078
- width: 100%;
2079
- min-height: 0;
2080
- overflow: auto;
2081
- }
2082
-
2083
- /* section ::slotted(*) { height: 100%; width: 100%; } */
2084
- /* Use > section > to only target Card's slotted children, not deeply nested elements */
2085
- .a2ui-surface .a2ui-card > section > * {
2086
- height: 100%;
2087
- width: 100%;
2088
- }
2089
-
2090
- /* =========================================================================
2091
- * Divider (from Lit divider.ts static styles)
2092
- * ========================================================================= */
2093
-
2094
- /* :host { display: block; min-height: 0; overflow: auto; } */
2095
- .a2ui-surface .a2ui-divider {
2096
- display: block;
2097
- min-height: 0;
2098
- overflow: auto;
2099
- }
2100
-
2101
- /* hr { height: 1px; background: #ccc; border: none; } */
2102
- /* Use :where() for low specificity (0,0,1) so theme utility classes can override */
2103
- /* Browser default margins apply (margin-block: 0.5em, margin-inline: auto) */
2104
- :where(.a2ui-surface .a2ui-divider) hr {
2105
- height: 1px;
2106
- background: #ccc;
2107
- border: none;
2108
- }
2109
-
2110
- /* =========================================================================
2111
- * Text (from Lit text.ts static styles)
2112
- * ========================================================================= */
2113
-
2114
- /* :host { display: block; flex: var(--weight); } */
2115
- .a2ui-surface .a2ui-text {
2116
- display: block;
2117
- flex: var(--weight);
2118
- }
2119
-
2120
- /* h1, h2, h3, h4, h5 { line-height: inherit; font: inherit; } */
2121
- /* Use :where() to match Lit's low specificity (0,0,0,1 - just element) */
2122
- :where(.a2ui-surface .a2ui-text) h1,
2123
- :where(.a2ui-surface .a2ui-text) h2,
2124
- :where(.a2ui-surface .a2ui-text) h3,
2125
- :where(.a2ui-surface .a2ui-text) h4,
2126
- :where(.a2ui-surface .a2ui-text) h5 {
2127
- line-height: inherit;
2128
- font: inherit;
2129
- }
2130
-
2131
- /* Ensure markdown paragraph margins are reset */
2132
- .a2ui-surface .a2ui-text p {
2133
- margin: 0;
2134
- }
2135
-
2136
- /* =========================================================================
2137
- * TextField (from Lit text-field.ts static styles)
2138
- * ========================================================================= */
2139
-
2140
- /* :host { display: flex; flex: var(--weight); } */
2141
- .a2ui-surface .a2ui-textfield {
2142
- display: flex;
2143
- flex: var(--weight);
2144
- }
2145
-
2146
- /* input { display: block; width: 100%; } */
2147
- :where(.a2ui-surface .a2ui-textfield) input {
2148
- display: block;
2149
- width: 100%;
2150
- }
2151
-
2152
- /* label { display: block; margin-bottom: 4px; } */
2153
- :where(.a2ui-surface .a2ui-textfield) label {
2154
- display: block;
2155
- margin-bottom: 4px;
2156
- }
2157
-
2158
- /* textarea - same styling as input for multiline text fields */
2159
- :where(.a2ui-surface .a2ui-textfield) textarea {
2160
- display: block;
2161
- width: 100%;
2162
- }
2163
-
2164
- /* =========================================================================
2165
- * CheckBox (from Lit checkbox.ts static styles)
2166
- * ========================================================================= */
2167
-
2168
- /* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
2169
- .a2ui-surface .a2ui-checkbox {
2170
- display: block;
2171
- flex: var(--weight);
2172
- min-height: 0;
2173
- overflow: auto;
2174
- }
2175
-
2176
- /* input { display: block; width: 100%; } */
2177
- :where(.a2ui-surface .a2ui-checkbox) input {
2178
- display: block;
2179
- width: 100%;
2180
- }
2181
-
2182
- /* =========================================================================
2183
- * Slider (from Lit slider.ts static styles)
2184
- * ========================================================================= */
2185
-
2186
- /* :host { display: block; flex: var(--weight); } */
2187
- .a2ui-surface .a2ui-slider {
2188
- display: block;
2189
- flex: var(--weight);
2190
- }
2191
-
2192
- /* input { display: block; width: 100%; } */
2193
- :where(.a2ui-surface .a2ui-slider) input {
2194
- display: block;
2195
- width: 100%;
2196
- }
2197
-
2198
- /* =========================================================================
2199
- * Button (from Lit button.ts static styles)
2200
- * ========================================================================= */
2201
-
2202
- /* :host { display: block; flex: var(--weight); min-height: 0; } */
2203
- .a2ui-surface .a2ui-button {
2204
- display: block;
2205
- flex: var(--weight);
2206
- min-height: 0;
2207
- }
2208
-
2209
- /* =========================================================================
2210
- * Icon (from Lit icon.ts static styles)
2211
- * ========================================================================= */
2212
-
2213
- /* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
2214
- .a2ui-surface .a2ui-icon {
2215
- display: block;
2216
- flex: var(--weight);
2217
- min-height: 0;
2218
- overflow: auto;
2219
- }
2220
-
2221
- /* =========================================================================
2222
- * Tabs (from Lit tabs.ts static styles)
2223
- * ========================================================================= */
2224
-
2225
- /* :host { display: block; flex: var(--weight); } */
2226
- .a2ui-surface .a2ui-tabs {
2227
- display: block;
2228
- flex: var(--weight);
2229
- }
2230
-
2231
- /* =========================================================================
2232
- * Modal (from Lit modal.ts static styles)
2233
- * ========================================================================= */
2234
-
2235
- /* :host { display: block; flex: var(--weight); } */
2236
- .a2ui-surface .a2ui-modal {
2237
- display: block;
2238
- flex: var(--weight);
2239
- }
2240
-
2241
- /* dialog { padding: 0; border: none; background: none; } */
2242
- :where(.a2ui-surface .a2ui-modal) dialog {
2243
- padding: 0;
2244
- border: none;
2245
- background: none;
2246
- }
2247
-
2248
- /* dialog section #controls { display: flex; justify-content: end; margin-bottom: 4px; } */
2249
- .a2ui-surface .a2ui-modal dialog section #controls {
2250
- display: flex;
2251
- justify-content: end;
2252
- margin-bottom: 4px;
2253
- }
2254
-
2255
- /* dialog section #controls button { padding: 0; background: none; ... } */
2256
- .a2ui-surface .a2ui-modal dialog section #controls button {
2257
- padding: 0;
2258
- background: none;
2259
- width: 20px;
2260
- height: 20px;
2261
- cursor: pointer;
2262
- border: none;
2263
- }
2264
-
2265
- /* =========================================================================
2266
- * Image (from Lit image.ts static styles)
2267
- * ========================================================================= */
2268
-
2269
- /* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
2270
- .a2ui-surface .a2ui-image {
2271
- display: block;
2272
- flex: var(--weight);
2273
- min-height: 0;
2274
- overflow: auto;
2275
- }
2276
-
2277
- /* img { display: block; width: 100%; height: 100%; object-fit: var(--object-fit, fill); } */
2278
- :where(.a2ui-surface .a2ui-image) img {
2279
- display: block;
2280
- width: 100%;
2281
- height: 100%;
2282
- object-fit: var(--object-fit, fill);
2283
- }
2284
-
2285
- /* =========================================================================
2286
- * Video (from Lit video.ts static styles)
2287
- * ========================================================================= */
2288
-
2289
- /* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
2290
- .a2ui-surface .a2ui-video {
2291
- display: block;
2292
- flex: var(--weight);
2293
- min-height: 0;
2294
- overflow: auto;
2295
- }
2296
-
2297
- /* video { display: block; width: 100%; } */
2298
- :where(.a2ui-surface .a2ui-video) video {
2299
- display: block;
2300
- width: 100%;
2301
- }
2302
-
2303
- /* =========================================================================
2304
- * AudioPlayer (from Lit audio.ts static styles)
2305
- * ========================================================================= */
2306
-
2307
- /* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
2308
- .a2ui-surface .a2ui-audio {
2309
- display: block;
2310
- flex: var(--weight);
2311
- min-height: 0;
2312
- overflow: auto;
2313
- }
2314
-
2315
- /* audio { display: block; width: 100%; } */
2316
- :where(.a2ui-surface .a2ui-audio) audio {
2317
- display: block;
2318
- width: 100%;
2319
- }
2320
-
2321
- /* =========================================================================
2322
- * MultipleChoice (from Lit multiple-choice.ts static styles)
2323
- * ========================================================================= */
2324
-
2325
- /* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
2326
- .a2ui-surface .a2ui-multiplechoice {
2327
- display: block;
2328
- flex: var(--weight);
2329
- min-height: 0;
2330
- overflow: auto;
2331
- }
2332
-
2333
- /* select { width: 100%; } */
2334
- :where(.a2ui-surface .a2ui-multiplechoice) select {
2335
- width: 100%;
2336
- }
2337
-
2338
- /* =========================================================================
2339
- * Column (from Lit column.ts static styles)
2340
- * ========================================================================= */
2341
-
2342
- /* :host { display: flex; flex: var(--weight); } */
2343
- .a2ui-surface .a2ui-column {
2344
- display: flex;
2345
- flex: var(--weight);
2346
- }
2347
-
2348
- /* section { display: flex; flex-direction: column; min-width: 100%; height: 100%; } */
2349
- .a2ui-surface .a2ui-column > section {
2350
- display: flex;
2351
- flex-direction: column;
2352
- min-width: 100%;
2353
- height: 100%;
2354
- }
2355
-
2356
- /* :host([alignment="..."]) section { align-items: ...; } */
2357
- /* Use > section to only target Column's direct section, not nested sections (e.g., CheckBox's section) */
2358
- .a2ui-surface .a2ui-column[data-alignment="start"] > section { align-items: start; }
2359
- .a2ui-surface .a2ui-column[data-alignment="center"] > section { align-items: center; }
2360
- .a2ui-surface .a2ui-column[data-alignment="end"] > section { align-items: end; }
2361
- .a2ui-surface .a2ui-column[data-alignment="stretch"] > section { align-items: stretch; }
2362
-
2363
- /* :host([distribution="..."]) section { justify-content: ...; } */
2364
- .a2ui-surface .a2ui-column[data-distribution="start"] > section { justify-content: start; }
2365
- .a2ui-surface .a2ui-column[data-distribution="center"] > section { justify-content: center; }
2366
- .a2ui-surface .a2ui-column[data-distribution="end"] > section { justify-content: end; }
2367
- .a2ui-surface .a2ui-column[data-distribution="spaceBetween"] > section { justify-content: space-between; }
2368
- .a2ui-surface .a2ui-column[data-distribution="spaceAround"] > section { justify-content: space-around; }
2369
- .a2ui-surface .a2ui-column[data-distribution="spaceEvenly"] > section { justify-content: space-evenly; }
2370
-
2371
- /* =========================================================================
2372
- * Row (from Lit row.ts static styles)
2373
- * ========================================================================= */
2374
-
2375
- /* :host { display: flex; flex: var(--weight); } */
2376
- .a2ui-surface .a2ui-row {
2377
- display: flex;
2378
- flex: var(--weight);
2379
- }
2380
-
2381
- /* section { display: flex; flex-direction: row; width: 100%; min-height: 100%; } */
2382
- .a2ui-surface .a2ui-row > section {
2383
- display: flex;
2384
- flex-direction: row;
2385
- width: 100%;
2386
- min-height: 100%;
2387
- }
2388
-
2389
- /* :host([alignment="..."]) section { align-items: ...; } */
2390
- /* Use > section to only target Row's direct section, not nested sections */
2391
- .a2ui-surface .a2ui-row[data-alignment="start"] > section { align-items: start; }
2392
- .a2ui-surface .a2ui-row[data-alignment="center"] > section { align-items: center; }
2393
- .a2ui-surface .a2ui-row[data-alignment="end"] > section { align-items: end; }
2394
- .a2ui-surface .a2ui-row[data-alignment="stretch"] > section { align-items: stretch; }
2395
-
2396
- /* :host([distribution="..."]) section { justify-content: ...; } */
2397
- .a2ui-surface .a2ui-row[data-distribution="start"] > section { justify-content: start; }
2398
- .a2ui-surface .a2ui-row[data-distribution="center"] > section { justify-content: center; }
2399
- .a2ui-surface .a2ui-row[data-distribution="end"] > section { justify-content: end; }
2400
- .a2ui-surface .a2ui-row[data-distribution="spaceBetween"] > section { justify-content: space-between; }
2401
- .a2ui-surface .a2ui-row[data-distribution="spaceAround"] > section { justify-content: space-around; }
2402
- .a2ui-surface .a2ui-row[data-distribution="spaceEvenly"] > section { justify-content: space-evenly; }
2403
-
2404
- /* =========================================================================
2405
- * List (from Lit list.ts static styles)
2406
- * ========================================================================= */
2407
-
2408
- /* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
2409
- .a2ui-surface .a2ui-list {
2410
- display: block;
2411
- flex: var(--weight);
2412
- min-height: 0;
2413
- overflow: auto;
2414
- }
2415
-
2416
- /* :host([direction="vertical"]) section { display: grid; } */
2417
- .a2ui-surface .a2ui-list[data-direction="vertical"] > section {
2418
- display: grid;
2419
- }
2420
-
2421
- /* :host([direction="horizontal"]) section { display: flex; max-width: 100%; overflow-x: scroll; ... } */
2422
- .a2ui-surface .a2ui-list[data-direction="horizontal"] > section {
2423
- display: flex;
2424
- max-width: 100%;
2425
- overflow-x: scroll;
2426
- overflow-y: hidden;
2427
- scrollbar-width: none;
2428
- }
2429
-
2430
- /* :host([direction="horizontal"]) section > ::slotted(*) { flex: 1 0 fit-content; ... } */
2431
- .a2ui-surface .a2ui-list[data-direction="horizontal"] > section > * {
2432
- flex: 1 0 fit-content;
2433
- max-width: min(80%, 400px);
2434
- }
2435
-
2436
- /* =========================================================================
2437
- * DateTimeInput (from Lit datetime-input.ts static styles)
2438
- * ========================================================================= */
2439
-
2440
- /* :host { display: block; flex: var(--weight); min-height: 0; overflow: auto; } */
2441
- .a2ui-surface .a2ui-datetime-input {
2442
- display: block;
2443
- flex: var(--weight);
2444
- min-height: 0;
2445
- overflow: auto;
2446
- }
2447
-
2448
- /* input { display: block; border-radius: 8px; padding: 8px; border: 1px solid #ccc; width: 100%; } */
2449
- /* Use :where() to match Lit's low specificity (0,0,0,1) so theme utility classes can override */
2450
- :where(.a2ui-surface .a2ui-datetime-input) input {
2451
- display: block;
2452
- border-radius: 8px;
2453
- padding: 8px;
2454
- border: 1px solid #ccc;
2455
- width: 100%;
2456
- }
2457
-
2458
- /* =========================================================================
2459
- * Global box-sizing (matches Lit's * { box-sizing: border-box; } in components)
2460
- * ========================================================================= */
1866
+ function extractCatalogComponentSchemas(catalog) {
1867
+ const resolved = catalog !== null && catalog !== void 0 ? catalog : basicCatalog;
1868
+ const schemas = [];
1869
+ for (const [name, comp] of resolved.components) schemas.push({
1870
+ name,
1871
+ props: (0, zod_to_json_schema.zodToJsonSchema)(comp.schema, { target: "openApi3" })
1872
+ });
1873
+ return schemas;
1874
+ }
2461
1875
 
2462
- .a2ui-surface *,
2463
- .a2ui-surface *::before,
2464
- .a2ui-surface *::after {
2465
- box-sizing: border-box;
2466
- }
2467
- `;
2468
- /**
2469
- * Injects A2UI structural styles into the document head.
2470
- * Includes utility classes (layout-*, typography-*, color-*, etc.) and React-specific overrides.
2471
- * Call this once at application startup.
1876
+ //#endregion
1877
+ //#region src/react-renderer/create-catalog.tsx
1878
+ /**
1879
+ * Create an A2UI catalog from definitions and renderers.
2472
1880
  *
2473
- * NOTE: CSS variables (--n-*, --p-*, etc.) must be defined by the host application on :root,
2474
- * just like in the Lit renderer. This allows full customization of the color palette.
1881
+ * Definitions are platform-agnostic (Zod schemas + descriptions).
1882
+ * Renderers are platform-specific (React components).
1883
+ * TypeScript enforces that renderers match definitions exactly.
2475
1884
  *
2476
1885
  * @example
2477
1886
  * ```tsx
2478
- * import { injectStyles } from '@a2ui/react/styles';
2479
- *
2480
- * // In your app entry point:
2481
- * injectStyles();
1887
+ * // schema.ts (platform-agnostic)
1888
+ * export const demoCatalogDefinitions = {
1889
+ * Card: {
1890
+ * description: "A card container",
1891
+ * props: z.object({ title: z.string(), child: z.string().optional() }),
1892
+ * },
1893
+ * } satisfies CatalogDefinitions;
1894
+ *
1895
+ * // catalog.tsx (React renderers)
1896
+ * export const demoCatalog = createCatalog(demoCatalogDefinitions, {
1897
+ * Card: ({ props, children }) => (
1898
+ * <div>{props.title}{props.child && children(props.child)}</div>
1899
+ * ),
1900
+ * });
2482
1901
  * ```
2483
1902
  */
2484
- function injectStyles() {
2485
- if (typeof document === "undefined") return;
2486
- const styleId = "a2ui-structural-styles";
2487
- if (document.getElementById(styleId)) return;
2488
- const styleElement = document.createElement("style");
2489
- styleElement.id = styleId;
2490
- styleElement.textContent = resetStyles + "\n" + structuralStyles + "\n" + componentSpecificStyles;
2491
- document.head.appendChild(styleElement);
1903
+ function createCatalog(definitions, renderers, options) {
1904
+ var _options$catalogId;
1905
+ const catalogId = (_options$catalogId = options === null || options === void 0 ? void 0 : options.catalogId) !== null && _options$catalogId !== void 0 ? _options$catalogId : "copilotkit://custom-catalog";
1906
+ const includeBasic = (options === null || options === void 0 ? void 0 : options.includeBasicCatalog) === true;
1907
+ const customComponents = [];
1908
+ for (const [name, def] of Object.entries(definitions)) {
1909
+ const api = {
1910
+ name,
1911
+ schema: def.props
1912
+ };
1913
+ const renderer = renderers[name];
1914
+ const wrapped = createReactComponent(api, ({ props, buildChild, context }) => {
1915
+ const Render = renderer;
1916
+ const dispatch = (action) => context.dispatchAction(action);
1917
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Render, {
1918
+ props,
1919
+ children: buildChild,
1920
+ dispatch
1921
+ });
1922
+ });
1923
+ customComponents.push(wrapped);
1924
+ }
1925
+ return new _a2ui_web_core_v0_9.Catalog(catalogId, includeBasic ? [...Array.from(basicCatalog.components.values()), ...customComponents] : customComponents, includeBasic ? Array.from(basicCatalog.functions.values()) : []);
2492
1926
  }
2493
1927
  /**
2494
- * Removes injected A2UI styles from the document.
2495
- * Useful for cleanup in tests or when unmounting.
1928
+ * Extract a JSON-serializable schema from catalog definitions.
1929
+ * Suitable for passing to the runtime's `a2ui.schema` config.
2496
1930
  */
2497
- function removeStyles() {
2498
- if (typeof document === "undefined") return;
2499
- const styleElement = document.getElementById("a2ui-structural-styles");
2500
- if (styleElement) styleElement.remove();
1931
+ function extractSchema(definitions) {
1932
+ return Object.entries(definitions).map(([name, def]) => ({
1933
+ name,
1934
+ description: def.description,
1935
+ props: zodSchemaToSimpleObject(def.props)
1936
+ }));
2501
1937
  }
2502
-
2503
- //#endregion
2504
- //#region src/theme/viewer-theme.ts
2505
- /** Elements */
2506
- const a = {
2507
- "typography-f-sf": true,
2508
- "typography-fs-n": true,
2509
- "typography-w-500": true,
2510
- "layout-as-n": true,
2511
- "layout-dis-iflx": true,
2512
- "layout-al-c": true
2513
- };
2514
- const audio = { "layout-w-100": true };
2515
- const body = {
2516
- "typography-f-s": true,
2517
- "typography-fs-n": true,
2518
- "typography-w-400": true,
2519
- "layout-mt-0": true,
2520
- "layout-mb-2": true,
2521
- "typography-sz-bm": true,
2522
- "color-c-n10": true
2523
- };
2524
- const button = {
2525
- "typography-f-sf": true,
2526
- "typography-fs-n": true,
2527
- "typography-w-500": true,
2528
- "layout-pt-3": true,
2529
- "layout-pb-3": true,
2530
- "layout-pl-5": true,
2531
- "layout-pr-5": true,
2532
- "layout-mb-1": true,
2533
- "border-br-16": true,
2534
- "border-bw-0": true,
2535
- "border-c-n70": true,
2536
- "border-bs-s": true,
2537
- "color-bgc-s30": true,
2538
- "color-c-n100": true,
2539
- "behavior-ho-80": true
2540
- };
2541
- const heading = {
2542
- "typography-f-sf": true,
2543
- "typography-fs-n": true,
2544
- "typography-w-500": true,
2545
- "layout-mt-0": true,
2546
- "layout-mb-2": true,
2547
- "color-c-n10": true
2548
- };
2549
- const h1 = {
2550
- ...heading,
2551
- "typography-sz-tl": true
2552
- };
2553
- const h2 = {
2554
- ...heading,
2555
- "typography-sz-tm": true
2556
- };
2557
- const h3 = {
2558
- ...heading,
2559
- "typography-sz-ts": true
2560
- };
2561
- const iframe = { "behavior-sw-n": true };
2562
- const input = {
2563
- "typography-f-sf": true,
2564
- "typography-fs-n": true,
2565
- "typography-w-400": true,
2566
- "layout-pl-4": true,
2567
- "layout-pr-4": true,
2568
- "layout-pt-2": true,
2569
- "layout-pb-2": true,
2570
- "border-br-6": true,
2571
- "border-bw-1": true,
2572
- "color-bc-s70": true,
2573
- "border-bs-s": true,
2574
- "layout-as-n": true,
2575
- "color-c-n10": true
2576
- };
2577
- const p = {
2578
- "typography-f-s": true,
2579
- "typography-fs-n": true,
2580
- "typography-w-400": true,
2581
- "layout-m-0": true,
2582
- "typography-sz-bm": true,
2583
- "layout-as-n": true,
2584
- "color-c-n10": true
2585
- };
2586
- const orderedList = {
2587
- "typography-f-s": true,
2588
- "typography-fs-n": true,
2589
- "typography-w-400": true,
2590
- "layout-m-0": true,
2591
- "typography-sz-bm": true,
2592
- "layout-as-n": true
2593
- };
2594
- const unorderedList = {
2595
- "typography-f-s": true,
2596
- "typography-fs-n": true,
2597
- "typography-w-400": true,
2598
- "layout-m-0": true,
2599
- "typography-sz-bm": true,
2600
- "layout-as-n": true
2601
- };
2602
- const listItem = {
2603
- "typography-f-s": true,
2604
- "typography-fs-n": true,
2605
- "typography-w-400": true,
2606
- "layout-m-0": true,
2607
- "typography-sz-bm": true,
2608
- "layout-as-n": true
2609
- };
2610
- const pre = {
2611
- "typography-f-c": true,
2612
- "typography-fs-n": true,
2613
- "typography-w-400": true,
2614
- "typography-sz-bm": true,
2615
- "typography-ws-p": true,
2616
- "layout-as-n": true
2617
- };
2618
- const textarea = {
2619
- ...input,
2620
- "layout-r-none": true,
2621
- "layout-fs-c": true
2622
- };
2623
- const video = { "layout-el-cv": true };
2624
- const aLight = _a2ui_lit.v0_8.Styles.merge(a, { "color-c-n5": true });
2625
- const inputLight = _a2ui_lit.v0_8.Styles.merge(input, { "color-c-n5": true });
2626
- const textareaLight = _a2ui_lit.v0_8.Styles.merge(textarea, { "color-c-n5": true });
2627
- const buttonLight = _a2ui_lit.v0_8.Styles.merge(button, { "color-c-n100": true });
2628
- const h1Light = _a2ui_lit.v0_8.Styles.merge(h1, { "color-c-n5": true });
2629
- const h2Light = _a2ui_lit.v0_8.Styles.merge(h2, { "color-c-n5": true });
2630
- const h3Light = _a2ui_lit.v0_8.Styles.merge(h3, { "color-c-n5": true });
2631
- const bodyLight = _a2ui_lit.v0_8.Styles.merge(body, { "color-c-n5": true });
2632
- const pLight = _a2ui_lit.v0_8.Styles.merge(p, { "color-c-n35": true });
2633
- const preLight = _a2ui_lit.v0_8.Styles.merge(pre, { "color-c-n35": true });
2634
- const orderedListLight = _a2ui_lit.v0_8.Styles.merge(orderedList, { "color-c-n35": true });
2635
- const unorderedListLight = _a2ui_lit.v0_8.Styles.merge(unorderedList, { "color-c-n35": true });
2636
- const listItemLight = _a2ui_lit.v0_8.Styles.merge(listItem, { "color-c-n35": true });
2637
- const theme = {
2638
- additionalStyles: {
2639
- Button: {
2640
- background: "var(--primary, oklch(0.205 0 0))",
2641
- color: "var(--primary-foreground, oklch(0.985 0 0))",
2642
- "border-radius": "calc(var(--radius, 0.625rem) - 2px)",
2643
- cursor: "pointer",
2644
- width: "100%",
2645
- "--n-10": "var(--primary-foreground, oklch(0.985 0 0))",
2646
- "--n-35": "var(--primary-foreground, oklch(0.985 0 0))",
2647
- "--n-60": "var(--primary-foreground, oklch(0.985 0 0))"
2648
- },
2649
- Card: {
2650
- background: "var(--card, oklch(1 0 0))",
2651
- border: "1px solid var(--border, oklch(0.922 0 0))",
2652
- "border-radius": "var(--radius, 0.625rem)",
2653
- padding: "16px"
2654
- },
2655
- TextField: {
2656
- "background-color": "var(--background, oklch(1 0 0))",
2657
- "border-color": "var(--input, oklch(0.922 0 0))",
2658
- color: "var(--foreground, oklch(0.145 0 0))",
2659
- "border-radius": "var(--radius, 0.625rem)"
2660
- },
2661
- CheckBox: {
2662
- "--n-100": "var(--background, oklch(1 0 0))",
2663
- "--n-70": "var(--border, oklch(0.922 0 0))",
2664
- "--n-30": "var(--foreground, oklch(0.145 0 0))"
2665
- },
2666
- DateTimeInput: {
2667
- "background-color": "var(--background, oklch(1 0 0))",
2668
- "border-color": "var(--input, oklch(0.922 0 0))",
2669
- color: "var(--foreground, oklch(0.145 0 0))",
2670
- "border-radius": "var(--radius, 0.625rem)"
2671
- },
2672
- Modal: {
2673
- "--p-100": "var(--card, oklch(1 0 0))",
2674
- "--p-80": "var(--border, oklch(0.922 0 0))",
2675
- "border-radius": "var(--radius, 0.625rem)"
2676
- },
2677
- Text: { color: "var(--foreground, oklch(0.145 0 0))" }
2678
- },
2679
- components: {
2680
- AudioPlayer: {},
2681
- Button: {
2682
- "layout-pt-2": true,
2683
- "layout-pb-2": true,
2684
- "layout-pl-3": true,
2685
- "layout-pr-3": true,
2686
- "border-bw-0": true,
2687
- "border-bs-s": true
2688
- },
2689
- Card: {
2690
- "border-br-9": true,
2691
- "color-bgc-n100": true
2692
- },
2693
- CheckBox: {
2694
- element: {
2695
- "layout-m-0": true,
2696
- "layout-mr-2": true,
2697
- "layout-p-2": true,
2698
- "border-br-2": true,
2699
- "border-bw-1": true,
2700
- "border-bs-s": true,
2701
- "color-bgc-n100": true,
2702
- "color-bc-n70": true,
2703
- "color-c-n30": true
2704
- },
2705
- label: {
2706
- "typography-f-sf": true,
2707
- "typography-v-r": true,
2708
- "typography-w-400": true,
2709
- "layout-flx-1": true,
2710
- "typography-sz-ll": true
2711
- },
2712
- container: {
2713
- "layout-dsp-iflex": true,
2714
- "layout-al-c": true
2715
- }
2716
- },
2717
- Column: { "layout-g-2": true },
2718
- DateTimeInput: {
2719
- container: {},
2720
- label: {},
2721
- element: {
2722
- "layout-pt-2": true,
2723
- "layout-pb-2": true,
2724
- "layout-pl-3": true,
2725
- "layout-pr-3": true,
2726
- "border-br-2": true,
2727
- "border-bw-1": true,
2728
- "border-bs-s": true,
2729
- "color-bgc-n100": true,
2730
- "color-bc-n70": true,
2731
- "color-c-n30": true
2732
- }
2733
- },
2734
- Divider: {},
2735
- Image: {
2736
- all: {
2737
- "border-br-5": true,
2738
- "layout-el-cv": true,
2739
- "layout-w-100": true,
2740
- "layout-h-100": true
2741
- },
2742
- avatar: { "is-avatar": true },
2743
- header: {},
2744
- icon: {},
2745
- largeFeature: {},
2746
- mediumFeature: {},
2747
- smallFeature: {}
2748
- },
2749
- Icon: {},
2750
- List: {
2751
- "layout-g-4": true,
2752
- "layout-p-2": true
2753
- },
2754
- Modal: {
2755
- backdrop: { "color-bbgc-n10_20": true },
2756
- element: {
2757
- "border-br-2": true,
2758
- "color-bgc-n100": true,
2759
- "layout-p-4": true,
2760
- "border-bw-1": true,
2761
- "border-bs-s": true,
2762
- "color-bc-n80": true
2763
- }
2764
- },
2765
- MultipleChoice: {
2766
- container: {},
2767
- label: {},
2768
- element: {}
2769
- },
2770
- Row: { "layout-g-4": true },
2771
- Slider: {
2772
- container: {},
2773
- label: {},
2774
- element: {}
2775
- },
2776
- Tabs: {
2777
- container: {},
2778
- controls: {
2779
- all: {},
2780
- selected: {}
2781
- },
2782
- element: {}
2783
- },
2784
- Text: {
2785
- all: {
2786
- "layout-w-100": true,
2787
- "layout-g-2": true
2788
- },
2789
- h1: {
2790
- "typography-f-sf": true,
2791
- "typography-v-r": true,
2792
- "typography-w-400": true,
2793
- "layout-m-0": true,
2794
- "layout-p-0": true,
2795
- "typography-sz-tl": true
2796
- },
2797
- h2: {
2798
- "typography-f-sf": true,
2799
- "typography-v-r": true,
2800
- "typography-w-400": true,
2801
- "layout-m-0": true,
2802
- "layout-p-0": true,
2803
- "typography-sz-tm": true
2804
- },
2805
- h3: {
2806
- "typography-f-sf": true,
2807
- "typography-v-r": true,
2808
- "typography-w-400": true,
2809
- "layout-m-0": true,
2810
- "layout-p-0": true,
2811
- "typography-sz-ts": true
2812
- },
2813
- h4: {
2814
- "typography-f-sf": true,
2815
- "typography-v-r": true,
2816
- "typography-w-400": true,
2817
- "layout-m-0": true,
2818
- "layout-p-0": true,
2819
- "typography-sz-bl": true
2820
- },
2821
- h5: {
2822
- "typography-f-sf": true,
2823
- "typography-v-r": true,
2824
- "typography-w-400": true,
2825
- "layout-m-0": true,
2826
- "layout-p-0": true,
2827
- "typography-sz-bm": true
2828
- },
2829
- body: {},
2830
- caption: {}
2831
- },
2832
- TextField: {
2833
- container: {
2834
- "typography-sz-bm": true,
2835
- "layout-w-100": true,
2836
- "layout-g-2": true,
2837
- "layout-dsp-flexvert": true
2838
- },
2839
- label: { "layout-flx-0": true },
2840
- element: {
2841
- "typography-sz-bm": true,
2842
- "layout-pt-2": true,
2843
- "layout-pb-2": true,
2844
- "layout-pl-3": true,
2845
- "layout-pr-3": true,
2846
- "border-br-2": true,
2847
- "border-bw-1": true,
2848
- "border-bs-s": true,
2849
- "color-bgc-n100": true,
2850
- "color-bc-n70": true,
2851
- "color-c-n30": true
2852
- }
2853
- },
2854
- Video: {
2855
- "border-br-5": true,
2856
- "layout-el-cv": true
2857
- }
2858
- },
2859
- elements: {
2860
- a: aLight,
2861
- audio,
2862
- body: bodyLight,
2863
- button: buttonLight,
2864
- em: { "typography-fs-n": true },
2865
- h1: h1Light,
2866
- h2: h2Light,
2867
- h3: h3Light,
2868
- h4: {},
2869
- h5: {},
2870
- iframe,
2871
- input: inputLight,
2872
- p: pLight,
2873
- pre: preLight,
2874
- textarea: textareaLight,
2875
- video
2876
- },
2877
- markdown: {
2878
- p: [...Object.keys(pLight)],
2879
- h1: [...Object.keys(h1Light)],
2880
- h2: [...Object.keys(h2Light)],
2881
- h3: [...Object.keys(h3Light)],
2882
- h4: [],
2883
- h5: [],
2884
- ul: [...Object.keys(unorderedListLight)],
2885
- ol: [...Object.keys(orderedListLight)],
2886
- li: [...Object.keys(listItemLight)],
2887
- a: [...Object.keys(aLight)],
2888
- strong: [],
2889
- em: ["typography-fs-n"]
2890
- }
2891
- };
2892
-
2893
- //#endregion
2894
- //#region src/A2UIViewer.tsx
2895
- let initialized = false;
2896
- function ensureInitialized() {
2897
- if (!initialized) {
2898
- initializeDefaultCatalog();
2899
- injectStyles();
2900
- initialized = true;
1938
+ function zodSchemaToSimpleObject(schema) {
1939
+ const shape = schema.shape;
1940
+ const properties = {};
1941
+ for (const [key, value] of Object.entries(shape)) {
1942
+ var _zodValue$_def$typeNa, _zodValue$_def;
1943
+ const zodValue = value;
1944
+ properties[key] = {
1945
+ type: (_zodValue$_def$typeNa = (_zodValue$_def = zodValue._def) === null || _zodValue$_def === void 0 ? void 0 : _zodValue$_def.typeName) !== null && _zodValue$_def$typeNa !== void 0 ? _zodValue$_def$typeNa : "unknown",
1946
+ ...zodValue.description ? { description: zodValue.description } : {}
1947
+ };
2901
1948
  }
1949
+ return {
1950
+ type: "object",
1951
+ properties
1952
+ };
2902
1953
  }
2903
1954
  /**
2904
- * A2UIViewer renders an A2UI component tree from a JSON definition and data.
2905
- * It re-renders cleanly when props change, discarding previous state.
1955
+ * @deprecated Use `createCatalog(definitions, renderers)` instead.
2906
1956
  */
2907
- function A2UIViewer({ root, components, data, onAction, styles, className }) {
2908
- ensureInitialized();
2909
- const baseId = (0, react.useId)();
2910
- const surfaceId = (0, react.useMemo)(() => {
2911
- const definitionKey = `${root}-${JSON.stringify(components)}`;
2912
- let hash = 0;
2913
- for (let i = 0; i < definitionKey.length; i++) {
2914
- const char = definitionKey.charCodeAt(i);
2915
- hash = (hash << 5) - hash + char;
2916
- hash = hash & hash;
2917
- }
2918
- return `surface${baseId.replace(/:/g, "-")}${hash}`;
2919
- }, [
2920
- baseId,
2921
- root,
2922
- components
2923
- ]);
2924
- const handleAction = (0, react.useMemo)(() => {
2925
- if (!onAction) return void 0;
2926
- return (message) => {
2927
- const userAction = message.userAction;
2928
- if (userAction) {
2929
- var _userAction$context;
2930
- onAction({
2931
- actionName: userAction.name,
2932
- sourceComponentId: userAction.sourceComponentId,
2933
- timestamp: userAction.timestamp,
2934
- context: (_userAction$context = userAction.context) !== null && _userAction$context !== void 0 ? _userAction$context : {}
2935
- });
2936
- }
1957
+ function createA2UICatalog(components, options) {
1958
+ const definitions = {};
1959
+ const renderers = {};
1960
+ for (const [name, def] of Object.entries(components)) {
1961
+ definitions[name] = {
1962
+ props: def.props,
1963
+ description: def.description
2937
1964
  };
2938
- }, [onAction]);
2939
- if (!components || components.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2940
- className,
2941
- style: {
2942
- padding: 16,
2943
- color: "#666",
2944
- fontFamily: "system-ui"
2945
- },
2946
- children: "No content to display"
2947
- });
2948
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIProvider, {
2949
- onAction: handleAction,
2950
- theme,
2951
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIViewerInner, {
2952
- surfaceId,
2953
- root,
2954
- components,
2955
- data: data !== null && data !== void 0 ? data : {},
2956
- styles,
2957
- className
2958
- })
2959
- });
2960
- }
2961
- /**
2962
- * Inner component that processes messages within the provider context.
2963
- */
2964
- function A2UIViewerInner({ surfaceId, root, components, data, styles, className }) {
2965
- const { processMessages } = useA2UIActions();
2966
- const lastProcessedRef = (0, react.useRef)("");
2967
- (0, react.useEffect)(() => {
2968
- const key = `${surfaceId}-${JSON.stringify(components)}-${JSON.stringify(data)}`;
2969
- if (key === lastProcessedRef.current) return;
2970
- lastProcessedRef.current = key;
2971
- const messages = [{ beginRendering: {
2972
- surfaceId,
2973
- root,
2974
- styles: styles !== null && styles !== void 0 ? styles : {}
2975
- } }, { surfaceUpdate: {
2976
- surfaceId,
2977
- components
2978
- } }];
2979
- if (data && Object.keys(data).length > 0) {
2980
- const contents = objectToValueMaps(data);
2981
- if (contents.length > 0) messages.push({ dataModelUpdate: {
2982
- surfaceId,
2983
- path: "/",
2984
- contents
2985
- } });
2986
- }
2987
- processMessages(messages);
2988
- }, [
2989
- processMessages,
2990
- surfaceId,
2991
- root,
2992
- components,
2993
- data,
2994
- styles
2995
- ]);
2996
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2997
- className,
2998
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIRenderer, { surfaceId })
2999
- });
3000
- }
3001
- /**
3002
- * Converts a nested JavaScript object to the ValueMap[] format
3003
- * expected by A2UI's dataModelUpdate message.
3004
- */
3005
- function objectToValueMaps(obj) {
3006
- return Object.entries(obj).map(([key, value]) => valueToValueMap(key, value));
1965
+ renderers[name] = def.render;
1966
+ }
1967
+ return createCatalog(definitions, renderers, options);
3007
1968
  }
3008
1969
  /**
3009
- * Converts a single key-value pair to a ValueMap.
1970
+ * @deprecated Use `extractSchema(definitions)` instead.
3010
1971
  */
3011
- function valueToValueMap(key, value) {
3012
- if (typeof value === "string") return {
3013
- key,
3014
- valueString: value
3015
- };
3016
- if (typeof value === "number") return {
3017
- key,
3018
- valueNumber: value
3019
- };
3020
- if (typeof value === "boolean") return {
3021
- key,
3022
- valueBoolean: value
3023
- };
3024
- if (value === null || value === void 0) return { key };
3025
- if (Array.isArray(value)) return {
3026
- key,
3027
- valueMap: value.map((item, index) => valueToValueMap(String(index), item))
1972
+ function extractA2UISchema(components) {
1973
+ const definitions = {};
1974
+ for (const [name, def] of Object.entries(components)) definitions[name] = {
1975
+ props: def.props,
1976
+ description: def.description
3028
1977
  };
3029
- if (typeof value === "object") return {
3030
- key,
3031
- valueMap: objectToValueMaps(value)
3032
- };
3033
- return { key };
1978
+ return extractSchema(definitions);
3034
1979
  }
3035
1980
 
1981
+ //#endregion
1982
+ //#region src/react-renderer/styles/index.ts
1983
+ /**
1984
+ * v0.9: Styles are now handled by a2ui-react components internally.
1985
+ * These functions are kept as no-ops for backward compatibility.
1986
+ */
1987
+ function injectStyles() {}
1988
+ function removeStyles() {}
1989
+
1990
+ //#endregion
1991
+ //#region src/react-renderer/index.ts
1992
+ function registerDefaultCatalog() {}
1993
+ function initializeDefaultCatalog() {}
1994
+ const defaultTheme = {};
1995
+ const litTheme = defaultTheme;
1996
+
3036
1997
  //#endregion
3037
1998
  //#region src/a2ui-types.ts
3038
- const DEFAULT_SURFACE_ID = _a2ui_lit.v0_8.Data.A2uiMessageProcessor.DEFAULT_SURFACE_ID;
1999
+ /** Default surface ID when none is specified */
2000
+ const DEFAULT_SURFACE_ID = "default";
2001
+
2002
+ //#endregion
2003
+ //#region src/index.ts
2004
+ const viewerTheme = {};
3039
2005
 
3040
2006
  //#endregion
3041
2007
  exports.A2UIProvider = A2UIProvider;
3042
2008
  exports.A2UIRenderer = A2UIRenderer;
3043
- exports.A2UIViewer = A2UIViewer;
3044
- exports.AudioPlayer = AudioPlayer;
3045
- exports.Button = Button;
3046
- exports.Card = Card;
3047
- exports.CheckBox = CheckBox;
3048
- exports.Column = Column;
3049
- exports.ComponentNode = ComponentNode;
3050
- exports.ComponentRegistry = ComponentRegistry;
2009
+ exports.A2UI_SCHEMA_CONTEXT_DESCRIPTION = A2UI_SCHEMA_CONTEXT_DESCRIPTION;
2010
+ Object.defineProperty(exports, 'Catalog', {
2011
+ enumerable: true,
2012
+ get: function () {
2013
+ return _a2ui_web_core_v0_9.Catalog;
2014
+ }
2015
+ });
3051
2016
  exports.DEFAULT_SURFACE_ID = DEFAULT_SURFACE_ID;
3052
- exports.DateTimeInput = DateTimeInput;
3053
- exports.Divider = Divider;
3054
- exports.Icon = Icon;
3055
- exports.Image = Image;
3056
- exports.List = List;
3057
- exports.Modal = Modal;
3058
- exports.MultipleChoice = MultipleChoice;
3059
- exports.Row = Row;
3060
- exports.Slider = Slider;
3061
- exports.Tabs = Tabs;
3062
- exports.Text = Text;
3063
- exports.TextField = TextField;
3064
2017
  exports.ThemeProvider = ThemeProvider;
3065
- exports.Video = Video;
3066
- exports.classMapToString = classMapToString;
2018
+ exports.basicCatalog = basicCatalog;
2019
+ exports.buildCatalogContextValue = buildCatalogContextValue;
3067
2020
  exports.cn = cn;
2021
+ exports.createA2UICatalog = createA2UICatalog;
2022
+ exports.createCatalog = createCatalog;
2023
+ exports.createReactComponent = createReactComponent;
3068
2024
  exports.defaultTheme = defaultTheme;
2025
+ exports.extendsBasicCatalog = extendsBasicCatalog;
2026
+ exports.extractA2UISchema = extractA2UISchema;
2027
+ exports.extractCatalogComponentSchemas = extractCatalogComponentSchemas;
2028
+ exports.extractSchema = extractSchema;
2029
+ exports.getCustomComponentNames = getCustomComponentNames;
3069
2030
  exports.initializeDefaultCatalog = initializeDefaultCatalog;
3070
2031
  exports.injectStyles = injectStyles;
3071
2032
  exports.litTheme = litTheme;
3072
2033
  exports.registerDefaultCatalog = registerDefaultCatalog;
3073
2034
  exports.removeStyles = removeStyles;
3074
- exports.stylesToObject = stylesToObject;
3075
2035
  exports.useA2UI = useA2UI;
3076
2036
  exports.useA2UIActions = useA2UIActions;
3077
- exports.useA2UIComponent = useA2UIComponent;
3078
2037
  exports.useA2UIContext = useA2UIContext;
2038
+ exports.useA2UIError = useA2UIError;
3079
2039
  exports.useA2UIState = useA2UIState;
3080
2040
  exports.useA2UIStore = useA2UIStore;
3081
2041
  exports.useA2UIStoreSelector = useA2UIStoreSelector;
3082
2042
  exports.useTheme = useTheme;
3083
2043
  exports.useThemeOptional = useThemeOptional;
3084
- exports.viewerTheme = theme;
2044
+ exports.viewerTheme = viewerTheme;
3085
2045
  });
3086
2046
  //# sourceMappingURL=index.umd.js.map