@assistant-ui/react-generative-ui 0.0.23 → 0.1.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 (338) hide show
  1. package/README.md +2 -0
  2. package/dist/a2ui.d.ts +1 -4
  3. package/dist/a2ui.d.ts.map +1 -1
  4. package/dist/a2ui.js +1 -4
  5. package/dist/index.d.ts +1 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -10
  8. package/dist/index.server.d.ts +1 -2
  9. package/dist/index.server.d.ts.map +1 -1
  10. package/dist/index.server.js +1 -10
  11. package/dist/ir.d.ts +1 -111
  12. package/dist/ir.d.ts.map +1 -1
  13. package/dist/ir.js +1 -175
  14. package/dist/slack.d.ts +1 -4
  15. package/dist/slack.d.ts.map +1 -1
  16. package/dist/slack.js +1 -4
  17. package/dist/teams.d.ts +1 -4
  18. package/dist/teams.d.ts.map +1 -1
  19. package/dist/teams.js +1 -4
  20. package/package.json +5 -5
  21. package/src/a2ui.ts +1 -22
  22. package/src/index.server.ts +1 -2
  23. package/src/index.test.ts +75 -0
  24. package/src/index.ts +1 -2
  25. package/src/ir.ts +1 -279
  26. package/src/slack.ts +1 -39
  27. package/src/teams.ts +1 -35
  28. package/dist/JSONGenerativeUI.client.d.ts +0 -28
  29. package/dist/JSONGenerativeUI.client.d.ts.map +0 -1
  30. package/dist/JSONGenerativeUI.client.js +0 -101
  31. package/dist/JSONGenerativeUI.client.js.map +0 -1
  32. package/dist/JSONGenerativeUI.server.d.ts +0 -21
  33. package/dist/JSONGenerativeUI.server.d.ts.map +0 -1
  34. package/dist/JSONGenerativeUI.server.js +0 -32
  35. package/dist/JSONGenerativeUI.server.js.map +0 -1
  36. package/dist/JSONGenerativeUI.shared.d.ts +0 -63
  37. package/dist/JSONGenerativeUI.shared.d.ts.map +0 -1
  38. package/dist/JSONGenerativeUI.shared.js +0 -31
  39. package/dist/JSONGenerativeUI.shared.js.map +0 -1
  40. package/dist/RadioGroupScope.d.ts +0 -6
  41. package/dist/RadioGroupScope.d.ts.map +0 -1
  42. package/dist/RadioGroupScope.js +0 -25
  43. package/dist/RadioGroupScope.js.map +0 -1
  44. package/dist/a2ui/BindingContext.d.ts +0 -11
  45. package/dist/a2ui/BindingContext.d.ts.map +0 -1
  46. package/dist/a2ui/BindingContext.js +0 -12
  47. package/dist/a2ui/BindingContext.js.map +0 -1
  48. package/dist/a2ui/PresentRenderer.d.ts +0 -11
  49. package/dist/a2ui/PresentRenderer.d.ts.map +0 -1
  50. package/dist/a2ui/PresentRenderer.js +0 -39
  51. package/dist/a2ui/PresentRenderer.js.map +0 -1
  52. package/dist/a2ui/convert.d.ts +0 -15
  53. package/dist/a2ui/convert.d.ts.map +0 -1
  54. package/dist/a2ui/convert.js +0 -728
  55. package/dist/a2ui/convert.js.map +0 -1
  56. package/dist/a2ui/dataModel.d.ts +0 -9
  57. package/dist/a2ui/dataModel.d.ts.map +0 -1
  58. package/dist/a2ui/dataModel.js +0 -44
  59. package/dist/a2ui/dataModel.js.map +0 -1
  60. package/dist/a2ui/reducer.d.ts +0 -8
  61. package/dist/a2ui/reducer.d.ts.map +0 -1
  62. package/dist/a2ui/reducer.js +0 -242
  63. package/dist/a2ui/reducer.js.map +0 -1
  64. package/dist/a2ui/snapshot.d.ts +0 -3
  65. package/dist/a2ui/snapshot.d.ts.map +0 -1
  66. package/dist/a2ui/snapshot.js +0 -33
  67. package/dist/a2ui/snapshot.js.map +0 -1
  68. package/dist/a2ui/types.d.ts +0 -88
  69. package/dist/a2ui/types.d.ts.map +0 -1
  70. package/dist/a2ui/types.js +0 -6
  71. package/dist/a2ui/types.js.map +0 -1
  72. package/dist/a2ui/valueFunctions.d.ts +0 -16
  73. package/dist/a2ui/valueFunctions.d.ts.map +0 -1
  74. package/dist/a2ui/valueFunctions.js +0 -332
  75. package/dist/a2ui/valueFunctions.js.map +0 -1
  76. package/dist/actionRegistry.d.ts +0 -29
  77. package/dist/actionRegistry.d.ts.map +0 -1
  78. package/dist/actionRegistry.js +0 -41
  79. package/dist/actionRegistry.js.map +0 -1
  80. package/dist/answeredValues.d.ts +0 -16
  81. package/dist/answeredValues.d.ts.map +0 -1
  82. package/dist/answeredValues.js +0 -37
  83. package/dist/answeredValues.js.map +0 -1
  84. package/dist/buildPresentParameters.d.ts +0 -21
  85. package/dist/buildPresentParameters.d.ts.map +0 -1
  86. package/dist/buildPresentParameters.js +0 -95
  87. package/dist/buildPresentParameters.js.map +0 -1
  88. package/dist/constants.d.ts +0 -15
  89. package/dist/constants.d.ts.map +0 -1
  90. package/dist/constants.js +0 -19
  91. package/dist/constants.js.map +0 -1
  92. package/dist/convert/boundSpec.d.ts +0 -48
  93. package/dist/convert/boundSpec.d.ts.map +0 -1
  94. package/dist/convert/boundSpec.js +0 -108
  95. package/dist/convert/boundSpec.js.map +0 -1
  96. package/dist/convert/copyBounded.d.ts +0 -25
  97. package/dist/convert/copyBounded.d.ts.map +0 -1
  98. package/dist/convert/copyBounded.js +0 -38
  99. package/dist/convert/copyBounded.js.map +0 -1
  100. package/dist/convert/isElement.d.ts +0 -3
  101. package/dist/convert/isElement.d.ts.map +0 -1
  102. package/dist/convert/isElement.js +0 -6
  103. package/dist/convert/isElement.js.map +0 -1
  104. package/dist/convert/takeRun.d.ts +0 -6
  105. package/dist/convert/takeRun.d.ts.map +0 -1
  106. package/dist/convert/takeRun.js +0 -20
  107. package/dist/convert/takeRun.js.map +0 -1
  108. package/dist/defineGenerativeComponents.d.ts +0 -29
  109. package/dist/defineGenerativeComponents.d.ts.map +0 -1
  110. package/dist/defineGenerativeComponents.js +0 -34
  111. package/dist/defineGenerativeComponents.js.map +0 -1
  112. package/dist/fieldReferences.d.ts +0 -9
  113. package/dist/fieldReferences.d.ts.map +0 -1
  114. package/dist/fieldReferences.js +0 -53
  115. package/dist/fieldReferences.js.map +0 -1
  116. package/dist/generativeUIToJSX.d.ts +0 -18
  117. package/dist/generativeUIToJSX.d.ts.map +0 -1
  118. package/dist/generativeUIToJSX.js +0 -76
  119. package/dist/generativeUIToJSX.js.map +0 -1
  120. package/dist/index.shared.d.ts +0 -15
  121. package/dist/index.shared.d.ts.map +0 -1
  122. package/dist/index.shared.js +0 -9
  123. package/dist/ir.js.map +0 -1
  124. package/dist/renderGenerativeUI.d.ts +0 -14
  125. package/dist/renderGenerativeUI.d.ts.map +0 -1
  126. package/dist/renderGenerativeUI.js +0 -83
  127. package/dist/renderGenerativeUI.js.map +0 -1
  128. package/dist/scopeSchema.d.ts +0 -6
  129. package/dist/scopeSchema.d.ts.map +0 -1
  130. package/dist/scopeSchema.js +0 -56
  131. package/dist/scopeSchema.js.map +0 -1
  132. package/dist/slack/constants.d.ts +0 -93
  133. package/dist/slack/constants.d.ts.map +0 -1
  134. package/dist/slack/constants.js +0 -146
  135. package/dist/slack/constants.js.map +0 -1
  136. package/dist/slack/decodeBlockAction.d.ts +0 -10
  137. package/dist/slack/decodeBlockAction.d.ts.map +0 -1
  138. package/dist/slack/decodeBlockAction.js +0 -129
  139. package/dist/slack/decodeBlockAction.js.map +0 -1
  140. package/dist/slack/fromSlackBlocks.d.ts +0 -27
  141. package/dist/slack/fromSlackBlocks.d.ts.map +0 -1
  142. package/dist/slack/fromSlackBlocks.js +0 -483
  143. package/dist/slack/fromSlackBlocks.js.map +0 -1
  144. package/dist/slack/toSlackBlocks.d.ts +0 -4
  145. package/dist/slack/toSlackBlocks.d.ts.map +0 -1
  146. package/dist/slack/toSlackBlocks.js +0 -901
  147. package/dist/slack/toSlackBlocks.js.map +0 -1
  148. package/dist/slack/types.d.ts +0 -204
  149. package/dist/slack/types.d.ts.map +0 -1
  150. package/dist/slack/types.js +0 -0
  151. package/dist/teams/constants.d.ts +0 -34
  152. package/dist/teams/constants.d.ts.map +0 -1
  153. package/dist/teams/constants.js +0 -68
  154. package/dist/teams/constants.js.map +0 -1
  155. package/dist/teams/decodeSubmitData.d.ts +0 -26
  156. package/dist/teams/decodeSubmitData.d.ts.map +0 -1
  157. package/dist/teams/decodeSubmitData.js +0 -70
  158. package/dist/teams/decodeSubmitData.js.map +0 -1
  159. package/dist/teams/temporalId.d.ts +0 -5
  160. package/dist/teams/temporalId.d.ts.map +0 -1
  161. package/dist/teams/temporalId.js +0 -28
  162. package/dist/teams/temporalId.js.map +0 -1
  163. package/dist/teams/toAdaptiveCard.d.ts +0 -45
  164. package/dist/teams/toAdaptiveCard.d.ts.map +0 -1
  165. package/dist/teams/toAdaptiveCard.js +0 -642
  166. package/dist/teams/toAdaptiveCard.js.map +0 -1
  167. package/dist/teams/toTeamsAttachments.d.ts +0 -10
  168. package/dist/teams/toTeamsAttachments.d.ts.map +0 -1
  169. package/dist/teams/toTeamsAttachments.js +0 -99
  170. package/dist/teams/toTeamsAttachments.js.map +0 -1
  171. package/dist/teams/types.d.ts +0 -224
  172. package/dist/teams/types.d.ts.map +0 -1
  173. package/dist/teams/types.js +0 -0
  174. package/dist/temporal.d.ts +0 -33
  175. package/dist/temporal.d.ts.map +0 -1
  176. package/dist/temporal.js +0 -152
  177. package/dist/temporal.js.map +0 -1
  178. package/dist/types.d.ts +0 -99
  179. package/dist/types.d.ts.map +0 -1
  180. package/dist/types.js +0 -0
  181. package/dist/vocabulary/alert.d.ts +0 -32
  182. package/dist/vocabulary/alert.d.ts.map +0 -1
  183. package/dist/vocabulary/alert.js +0 -160
  184. package/dist/vocabulary/alert.js.map +0 -1
  185. package/dist/vocabulary/collectFormValues.d.ts +0 -23
  186. package/dist/vocabulary/collectFormValues.d.ts.map +0 -1
  187. package/dist/vocabulary/collectFormValues.js +0 -44
  188. package/dist/vocabulary/collectFormValues.js.map +0 -1
  189. package/dist/vocabulary/data.d.ts +0 -66
  190. package/dist/vocabulary/data.d.ts.map +0 -1
  191. package/dist/vocabulary/data.js +0 -503
  192. package/dist/vocabulary/data.js.map +0 -1
  193. package/dist/vocabulary/dispatch.d.ts +0 -9
  194. package/dist/vocabulary/dispatch.d.ts.map +0 -1
  195. package/dist/vocabulary/dispatch.js +0 -50
  196. package/dist/vocabulary/dispatch.js.map +0 -1
  197. package/dist/vocabulary/fact.d.ts +0 -19
  198. package/dist/vocabulary/fact.d.ts.map +0 -1
  199. package/dist/vocabulary/fact.js +0 -51
  200. package/dist/vocabulary/fact.js.map +0 -1
  201. package/dist/vocabulary/form.d.ts +0 -11
  202. package/dist/vocabulary/form.d.ts.map +0 -1
  203. package/dist/vocabulary/form.js +0 -23
  204. package/dist/vocabulary/form.js.map +0 -1
  205. package/dist/vocabulary/formatValue.d.ts +0 -7
  206. package/dist/vocabulary/formatValue.d.ts.map +0 -1
  207. package/dist/vocabulary/formatValue.js +0 -76
  208. package/dist/vocabulary/formatValue.js.map +0 -1
  209. package/dist/vocabulary/icon.d.ts +0 -41
  210. package/dist/vocabulary/icon.d.ts.map +0 -1
  211. package/dist/vocabulary/icon.js +0 -272
  212. package/dist/vocabulary/icon.js.map +0 -1
  213. package/dist/vocabulary/index.d.ts +0 -12
  214. package/dist/vocabulary/index.d.ts.map +0 -1
  215. package/dist/vocabulary/index.js +0 -36
  216. package/dist/vocabulary/index.js.map +0 -1
  217. package/dist/vocabulary/interactive.d.ts +0 -230
  218. package/dist/vocabulary/interactive.d.ts.map +0 -1
  219. package/dist/vocabulary/interactive.js +0 -530
  220. package/dist/vocabulary/interactive.js.map +0 -1
  221. package/dist/vocabulary/layout.d.ts +0 -79
  222. package/dist/vocabulary/layout.d.ts.map +0 -1
  223. package/dist/vocabulary/layout.js +0 -139
  224. package/dist/vocabulary/layout.js.map +0 -1
  225. package/dist/vocabulary/list.d.ts +0 -14
  226. package/dist/vocabulary/list.d.ts.map +0 -1
  227. package/dist/vocabulary/list.js +0 -50
  228. package/dist/vocabulary/list.js.map +0 -1
  229. package/dist/vocabulary/media.d.ts +0 -25
  230. package/dist/vocabulary/media.d.ts.map +0 -1
  231. package/dist/vocabulary/media.js +0 -42
  232. package/dist/vocabulary/media.js.map +0 -1
  233. package/dist/vocabulary/text.d.ts +0 -57
  234. package/dist/vocabulary/text.d.ts.map +0 -1
  235. package/dist/vocabulary/text.js +0 -49
  236. package/dist/vocabulary/text.js.map +0 -1
  237. package/dist/vocabulary/toTextContent.d.ts +0 -2
  238. package/dist/vocabulary/toTextContent.d.ts.map +0 -1
  239. package/dist/vocabulary/toTextContent.js +0 -6
  240. package/dist/vocabulary/toTextContent.js.map +0 -1
  241. package/src/JSONGenerativeUI.client.tsx +0 -168
  242. package/src/JSONGenerativeUI.server.tsx +0 -39
  243. package/src/JSONGenerativeUI.shared.ts +0 -90
  244. package/src/JSONGenerativeUI.test.tsx +0 -1298
  245. package/src/RadioGroupScope.server.test.tsx +0 -24
  246. package/src/RadioGroupScope.tsx +0 -34
  247. package/src/a2ui/BindingContext.ts +0 -26
  248. package/src/a2ui/PresentRenderer.tsx +0 -83
  249. package/src/a2ui/convert.test.ts +0 -2923
  250. package/src/a2ui/convert.ts +0 -1207
  251. package/src/a2ui/dataModel.ts +0 -69
  252. package/src/a2ui/reducer.test.ts +0 -422
  253. package/src/a2ui/reducer.ts +0 -363
  254. package/src/a2ui/snapshot.test.ts +0 -52
  255. package/src/a2ui/snapshot.ts +0 -52
  256. package/src/a2ui/types.ts +0 -114
  257. package/src/a2ui/valueFunctions.test.ts +0 -271
  258. package/src/a2ui/valueFunctions.ts +0 -523
  259. package/src/actionRegistry.test.ts +0 -90
  260. package/src/actionRegistry.ts +0 -88
  261. package/src/answeredValues.test.ts +0 -33
  262. package/src/answeredValues.tsx +0 -70
  263. package/src/buildPresentParameters.test.ts +0 -246
  264. package/src/buildPresentParameters.ts +0 -130
  265. package/src/constants.ts +0 -17
  266. package/src/convert/boundSpec.test.ts +0 -192
  267. package/src/convert/boundSpec.ts +0 -134
  268. package/src/convert/copyBounded.test.ts +0 -131
  269. package/src/convert/copyBounded.ts +0 -38
  270. package/src/convert/isElement.ts +0 -6
  271. package/src/convert/takeRun.test.ts +0 -64
  272. package/src/convert/takeRun.ts +0 -19
  273. package/src/defineGenerativeComponents.ts +0 -38
  274. package/src/fieldReferences.test.ts +0 -66
  275. package/src/fieldReferences.ts +0 -83
  276. package/src/generativeUIToJSX.test.ts +0 -268
  277. package/src/generativeUIToJSX.ts +0 -152
  278. package/src/index.server.test.ts +0 -106
  279. package/src/index.shared.ts +0 -61
  280. package/src/ir.test.ts +0 -203
  281. package/src/renderGenerativeUI.test.tsx +0 -373
  282. package/src/renderGenerativeUI.tsx +0 -165
  283. package/src/scopeSchema.test.ts +0 -72
  284. package/src/scopeSchema.ts +0 -71
  285. package/src/slack/a2uiSlack.test.ts +0 -198
  286. package/src/slack/constants.ts +0 -194
  287. package/src/slack/datePicker.test.ts +0 -612
  288. package/src/slack/decodeBlockAction.test.ts +0 -233
  289. package/src/slack/decodeBlockAction.ts +0 -232
  290. package/src/slack/fromSlackBlocks.test.ts +0 -1465
  291. package/src/slack/fromSlackBlocks.ts +0 -789
  292. package/src/slack/toSlackBlocks.test.ts +0 -3065
  293. package/src/slack/toSlackBlocks.ts +0 -1818
  294. package/src/slack/types.ts +0 -264
  295. package/src/teams/constants.ts +0 -93
  296. package/src/teams/decodeSubmitData.test.ts +0 -397
  297. package/src/teams/decodeSubmitData.ts +0 -110
  298. package/src/teams/temporal.test.ts +0 -766
  299. package/src/teams/temporalId.ts +0 -56
  300. package/src/teams/toAdaptiveCard.test.ts +0 -1897
  301. package/src/teams/toAdaptiveCard.ts +0 -1057
  302. package/src/teams/toTeamsAttachments.test.ts +0 -74
  303. package/src/teams/toTeamsAttachments.ts +0 -133
  304. package/src/teams/types.ts +0 -266
  305. package/src/temporal.test.ts +0 -319
  306. package/src/temporal.ts +0 -259
  307. package/src/types.ts +0 -119
  308. package/src/vocabulary/alert.test.tsx +0 -427
  309. package/src/vocabulary/alert.tsx +0 -217
  310. package/src/vocabulary/collectFormValues.test.ts +0 -389
  311. package/src/vocabulary/collectFormValues.ts +0 -116
  312. package/src/vocabulary/data.test.tsx +0 -858
  313. package/src/vocabulary/data.tsx +0 -819
  314. package/src/vocabulary/datepicker.dom.test.tsx +0 -1148
  315. package/src/vocabulary/dispatch.ts +0 -83
  316. package/src/vocabulary/fact.test.tsx +0 -94
  317. package/src/vocabulary/fact.tsx +0 -54
  318. package/src/vocabulary/form.test.tsx +0 -113
  319. package/src/vocabulary/form.tsx +0 -39
  320. package/src/vocabulary/formatValue.test.ts +0 -72
  321. package/src/vocabulary/formatValue.ts +0 -127
  322. package/src/vocabulary/icon.test.tsx +0 -64
  323. package/src/vocabulary/icon.tsx +0 -174
  324. package/src/vocabulary/index.test.ts +0 -65
  325. package/src/vocabulary/index.ts +0 -33
  326. package/src/vocabulary/interactive.dispatch.test.tsx +0 -454
  327. package/src/vocabulary/interactive.dom.test.tsx +0 -1747
  328. package/src/vocabulary/interactive.test.tsx +0 -377
  329. package/src/vocabulary/interactive.tsx +0 -1048
  330. package/src/vocabulary/layout.test.tsx +0 -323
  331. package/src/vocabulary/layout.tsx +0 -247
  332. package/src/vocabulary/list.test.tsx +0 -222
  333. package/src/vocabulary/list.tsx +0 -50
  334. package/src/vocabulary/media.test.tsx +0 -85
  335. package/src/vocabulary/media.tsx +0 -56
  336. package/src/vocabulary/text.test.tsx +0 -102
  337. package/src/vocabulary/text.tsx +0 -60
  338. package/src/vocabulary/toTextContent.ts +0 -2
@@ -1,174 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import { z } from "zod";
3
- import type { GenerativeUILibrary } from "../types";
4
- import { ICON_NAMES } from "../ir";
5
-
6
- const ICON_SIZE_TOKENS = ["sm", "md", "lg"] as const;
7
- const ICON_SIZE_PX: Record<(typeof ICON_SIZE_TOKENS)[number], number> = {
8
- sm: 14,
9
- md: 16,
10
- lg: 20,
11
- };
12
-
13
- const ICON_GLYPHS: Record<(typeof ICON_NAMES)[number], ReactNode> = {
14
- sun: (
15
- <>
16
- <circle cx="12" cy="12" r="4.5" />
17
- <line x1="12" y1="2" x2="12" y2="5" />
18
- <line x1="12" y1="19" x2="12" y2="22" />
19
- <line x1="2" y1="12" x2="5" y2="12" />
20
- <line x1="19" y1="12" x2="22" y2="12" />
21
- <line x1="5.5" y1="5.5" x2="7.5" y2="7.5" />
22
- <line x1="16.5" y1="16.5" x2="18.5" y2="18.5" />
23
- <line x1="18.5" y1="5.5" x2="16.5" y2="7.5" />
24
- <line x1="7.5" y1="16.5" x2="5.5" y2="18.5" />
25
- </>
26
- ),
27
- moon: <path d="M19 13.5A8.5 8.5 0 1 1 10.5 4.5 6.8 6.8 0 0 0 19 13.5Z" />,
28
- cloud: (
29
- <path d="M7 18a4 4 0 1 1 .5-8A5.5 5.5 0 0 1 17.5 11.5 3.5 3.5 0 0 1 17 18Z" />
30
- ),
31
- rain: (
32
- <>
33
- <path d="M6.5 13a3 3 0 1 1 .4-6A4.5 4.5 0 0 1 15.5 8.5 3 3 0 0 1 15 13Z" />
34
- <line x1="8" y1="15" x2="7" y2="18" />
35
- <line x1="12" y1="15" x2="11" y2="18" />
36
- <line x1="16" y1="15" x2="15" y2="18" />
37
- </>
38
- ),
39
- snow: (
40
- <>
41
- <path d="M6.5 13a3 3 0 1 1 .4-6A4.5 4.5 0 0 1 15.5 8.5 3 3 0 0 1 15 13Z" />
42
- <circle cx="7.5" cy="17" r="0.75" fill="currentColor" stroke="none" />
43
- <circle cx="12" cy="18" r="0.75" fill="currentColor" stroke="none" />
44
- <circle cx="16.5" cy="17" r="0.75" fill="currentColor" stroke="none" />
45
- </>
46
- ),
47
- wind: (
48
- <>
49
- <path d="M3 7.5h10.5a2.5 2.5 0 1 0-2-4" />
50
- <path d="M3 12h14a2.5 2.5 0 1 1-2 4" />
51
- <path d="M3 16.5h8" />
52
- </>
53
- ),
54
- play: <path d="M7 4.5v15l13-7.5z" />,
55
- pause: (
56
- <>
57
- <line x1="8" y1="4" x2="8" y2="20" />
58
- <line x1="16" y1="4" x2="16" y2="20" />
59
- </>
60
- ),
61
- check: <path d="M4 12.5l5 5.5 11-12" />,
62
- x: (
63
- <>
64
- <line x1="5" y1="5" x2="19" y2="19" />
65
- <line x1="19" y1="5" x2="5" y2="19" />
66
- </>
67
- ),
68
- star: (
69
- <path d="M12 2.5l2.6 5.9 6.4.6-4.8 4.3 1.4 6.3-5.6-3-5.6 3 1.4-6.3-4.8-4.3 6.4-.6z" />
70
- ),
71
- heart: (
72
- <path d="M12 20s-7.5-4.7-9.8-9.6C.6 6.8 3 3.3 6.6 3.3c2 0 3.7 1.1 5.4 3.3 1.7-2.2 3.4-3.3 5.4-3.3 3.6 0 6 3.5 4.4 7.1C19.5 15.3 12 20 12 20z" />
73
- ),
74
- "arrow-right": <path d="M4 12h15M13 6l6 6-6 6" />,
75
- "arrow-up-right": <path d="M7 17L17 7M9 7h8v8" />,
76
- "chevron-right": <path d="M9 5l7 7-7 7" />,
77
- calendar: (
78
- <>
79
- <rect x="3.5" y="5" width="17" height="15" rx="2" />
80
- <line x1="3.5" y1="9.5" x2="20.5" y2="9.5" />
81
- <line x1="8" y1="3" x2="8" y2="7" />
82
- <line x1="16" y1="3" x2="16" y2="7" />
83
- </>
84
- ),
85
- clock: (
86
- <>
87
- <circle cx="12" cy="12" r="8.5" />
88
- <path d="M12 7.5V12l3.5 2" />
89
- </>
90
- ),
91
- "map-pin": (
92
- <>
93
- <path d="M12 21s7-6.7 7-12.2A7 7 0 1 0 5 8.8C5 14.3 12 21 12 21z" />
94
- <circle cx="12" cy="8.8" r="2.3" />
95
- </>
96
- ),
97
- plane: (
98
- <>
99
- <path d="M3 12l18-8-6 18-3-7-7-3z" />
100
- <path d="M12 15l3-3" />
101
- </>
102
- ),
103
- truck: (
104
- <>
105
- <path d="M2 8h11v9H2z" />
106
- <path d="M13 11h4l3 3v3h-7z" />
107
- <circle cx="6" cy="19" r="1.8" />
108
- <circle cx="17" cy="19" r="1.8" />
109
- </>
110
- ),
111
- "credit-card": (
112
- <>
113
- <rect x="2.5" y="5.5" width="19" height="13" rx="2" />
114
- <line x1="2.5" y1="10" x2="21.5" y2="10" />
115
- <line x1="6" y1="15" x2="10" y2="15" />
116
- </>
117
- ),
118
- user: (
119
- <>
120
- <circle cx="12" cy="8" r="3.6" />
121
- <path d="M4.5 20.5a7.5 7.5 0 0 1 15 0" />
122
- </>
123
- ),
124
- search: (
125
- <>
126
- <circle cx="10.5" cy="10.5" r="6.5" />
127
- <line x1="20" y1="20" x2="15.3" y2="15.3" />
128
- </>
129
- ),
130
- bell: (
131
- <>
132
- <path d="M12 3a5.5 5.5 0 0 0-5.5 5.5c0 4.5-2 6-2 6h15s-2-1.5-2-6A5.5 5.5 0 0 0 12 3z" />
133
- <path d="M10 19a2 2 0 0 0 4 0" />
134
- </>
135
- ),
136
- };
137
-
138
- export const iconVocabulary = {
139
- Icon: {
140
- description:
141
- "A small line icon from the built-in set. `size` controls the rendered pixel size.",
142
- properties: z.object({
143
- name: z.enum(ICON_NAMES).describe("Which built-in icon to render."),
144
- size: z
145
- .enum(ICON_SIZE_TOKENS)
146
- .optional()
147
- .describe("Icon size; defaults to `md` (16px)."),
148
- }),
149
- render: ({ name, size }) => {
150
- const glyph = ICON_GLYPHS[name as keyof typeof ICON_GLYPHS];
151
- if (!glyph) return null;
152
- const px = ICON_SIZE_PX[(size as keyof typeof ICON_SIZE_PX) ?? "md"];
153
-
154
- return (
155
- <svg
156
- data-aui="icon"
157
- data-aui-name={name}
158
- data-aui-size={size}
159
- viewBox="0 0 24 24"
160
- width={px}
161
- height={px}
162
- fill="none"
163
- stroke="currentColor"
164
- strokeWidth="2"
165
- strokeLinecap="round"
166
- strokeLinejoin="round"
167
- aria-hidden="true"
168
- >
169
- {glyph}
170
- </svg>
171
- );
172
- },
173
- },
174
- } satisfies GenerativeUILibrary;
@@ -1,65 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { buildPresentParameters } from "../buildPresentParameters";
3
- import { defaultGenerativeUILibrary } from "./index";
4
-
5
- const EXPECTED_KEYS = [
6
- "Header",
7
- "Text",
8
- "Caption",
9
- "Image",
10
- "Divider",
11
- "Fact",
12
- "Button",
13
- "Select",
14
- "Input",
15
- "DatePicker",
16
- "Checkbox",
17
- "Slider",
18
- "RadioGroup",
19
- "CheckboxGroup",
20
- "Form",
21
- "Card",
22
- "Col",
23
- "Row",
24
- "Spacer",
25
- "Badge",
26
- "Box",
27
- "ListView",
28
- "ListViewItem",
29
- "Table",
30
- "Markdown",
31
- "Chart",
32
- "Alert",
33
- "Carousel",
34
- "Icon",
35
- ] as const;
36
-
37
- describe("defaultGenerativeUILibrary", () => {
38
- it("exposes exactly the closed vocabulary set, no stray or missing entries", () => {
39
- expect(Object.keys(defaultGenerativeUILibrary).sort()).toEqual(
40
- [...EXPECTED_KEYS].sort(),
41
- );
42
- });
43
-
44
- it("every entry has a description, a zod properties schema, and a render fn", () => {
45
- for (const [name, entry] of Object.entries(defaultGenerativeUILibrary)) {
46
- expect(typeof entry.description, `${name}.description`).toBe("string");
47
- expect(typeof entry.render, `${name}.render`).toBe("function");
48
- expect(
49
- typeof (entry.properties as { safeParse?: unknown }).safeParse,
50
- `${name}.properties is a zod schema`,
51
- ).toBe("function");
52
- }
53
- });
54
-
55
- it("buildPresentParameters produces a $type enum of the vocabulary names", () => {
56
- const schema = buildPresentParameters(defaultGenerativeUILibrary) as Record<
57
- string,
58
- unknown
59
- >;
60
- const typeProp = (schema.properties as Record<string, unknown>)[
61
- "$type"
62
- ] as { enum?: unknown[] };
63
- expect(typeProp.enum).toEqual([...EXPECTED_KEYS]);
64
- });
65
- });
@@ -1,33 +0,0 @@
1
- import type { GenerativeUILibrary } from "../types";
2
- import { alertVocabulary } from "./alert";
3
- import { dataVocabulary } from "./data";
4
- import { factVocabulary } from "./fact";
5
- import { formVocabulary } from "./form";
6
- import { iconVocabulary } from "./icon";
7
- import { interactiveVocabulary } from "./interactive";
8
- import { layoutVocabulary } from "./layout";
9
- import { listVocabulary } from "./list";
10
- import { mediaVocabulary } from "./media";
11
- import { textVocabulary } from "./text";
12
-
13
- /**
14
- * The closed generative-ui vocabulary the factory ships: a fixed set of
15
- * intrinsic components the model may render, each a zod `properties` schema
16
- * plus an unstyled structural `render` (semantic HTML with a `data-aui`
17
- * attribute naming the component, plus `data-aui-<prop>` hooks, for the host
18
- * to style). Users opt in by passing it to
19
- * `new JSONGenerativeUI({ library: defaultGenerativeUILibrary })`, and override
20
- * or extend entries with their own `defineGenerativeComponents`.
21
- */
22
- export const defaultGenerativeUILibrary: GenerativeUILibrary = {
23
- ...textVocabulary,
24
- ...mediaVocabulary,
25
- ...factVocabulary,
26
- ...interactiveVocabulary,
27
- ...formVocabulary,
28
- ...layoutVocabulary,
29
- ...listVocabulary,
30
- ...dataVocabulary,
31
- ...alertVocabulary,
32
- ...iconVocabulary,
33
- };