@lynx-js/genui 0.0.1-rc.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 (254) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +170 -0
  3. package/a2ui/README.md +140 -0
  4. package/a2ui/dist/catalog/Button/catalog.json +156 -0
  5. package/a2ui/dist/catalog/Button/index.d.ts +35 -0
  6. package/a2ui/dist/catalog/Button/index.js +35 -0
  7. package/a2ui/dist/catalog/Button/index.js.map +1 -0
  8. package/a2ui/dist/catalog/Card/catalog.json +24 -0
  9. package/a2ui/dist/catalog/Card/index.d.ts +11 -0
  10. package/a2ui/dist/catalog/Card/index.js +19 -0
  11. package/a2ui/dist/catalog/Card/index.js.map +1 -0
  12. package/a2ui/dist/catalog/CheckBox/catalog.json +170 -0
  13. package/a2ui/dist/catalog/CheckBox/index.d.ts +32 -0
  14. package/a2ui/dist/catalog/CheckBox/index.js +24 -0
  15. package/a2ui/dist/catalog/CheckBox/index.js.map +1 -0
  16. package/a2ui/dist/catalog/Column/catalog.json +57 -0
  17. package/a2ui/dist/catalog/Column/index.d.ts +15 -0
  18. package/a2ui/dist/catalog/Column/index.js +55 -0
  19. package/a2ui/dist/catalog/Column/index.js.map +1 -0
  20. package/a2ui/dist/catalog/Divider/catalog.json +14 -0
  21. package/a2ui/dist/catalog/Divider/index.d.ts +9 -0
  22. package/a2ui/dist/catalog/Divider/index.js +8 -0
  23. package/a2ui/dist/catalog/Divider/index.js.map +1 -0
  24. package/a2ui/dist/catalog/Icon/catalog.json +45 -0
  25. package/a2ui/dist/catalog/Icon/index.d.ts +14 -0
  26. package/a2ui/dist/catalog/Icon/index.js +11 -0
  27. package/a2ui/dist/catalog/Icon/index.js.map +1 -0
  28. package/a2ui/dist/catalog/Image/catalog.json +62 -0
  29. package/a2ui/dist/catalog/Image/index.d.ts +16 -0
  30. package/a2ui/dist/catalog/Image/index.js +30 -0
  31. package/a2ui/dist/catalog/Image/index.js.map +1 -0
  32. package/a2ui/dist/catalog/LineChart/catalog.json +98 -0
  33. package/a2ui/dist/catalog/LineChart/index.d.ts +31 -0
  34. package/a2ui/dist/catalog/LineChart/index.js +195 -0
  35. package/a2ui/dist/catalog/LineChart/index.js.map +1 -0
  36. package/a2ui/dist/catalog/List/catalog.json +52 -0
  37. package/a2ui/dist/catalog/List/index.d.ts +15 -0
  38. package/a2ui/dist/catalog/List/index.js +53 -0
  39. package/a2ui/dist/catalog/List/index.js.map +1 -0
  40. package/a2ui/dist/catalog/Modal/catalog.json +18 -0
  41. package/a2ui/dist/catalog/Modal/index.d.ts +12 -0
  42. package/a2ui/dist/catalog/Modal/index.js +33 -0
  43. package/a2ui/dist/catalog/Modal/index.js.map +1 -0
  44. package/a2ui/dist/catalog/PieChart/catalog.json +87 -0
  45. package/a2ui/dist/catalog/PieChart/index.d.ts +37 -0
  46. package/a2ui/dist/catalog/PieChart/index.js +131 -0
  47. package/a2ui/dist/catalog/PieChart/index.js.map +1 -0
  48. package/a2ui/dist/catalog/RadioGroup/catalog.json +184 -0
  49. package/a2ui/dist/catalog/RadioGroup/index.d.ts +36 -0
  50. package/a2ui/dist/catalog/RadioGroup/index.js +36 -0
  51. package/a2ui/dist/catalog/RadioGroup/index.js.map +1 -0
  52. package/a2ui/dist/catalog/Row/catalog.json +57 -0
  53. package/a2ui/dist/catalog/Row/index.d.ts +15 -0
  54. package/a2ui/dist/catalog/Row/index.js +28 -0
  55. package/a2ui/dist/catalog/Row/index.js.map +1 -0
  56. package/a2ui/dist/catalog/Slider/catalog.json +183 -0
  57. package/a2ui/dist/catalog/Slider/index.d.ts +41 -0
  58. package/a2ui/dist/catalog/Slider/index.js +39 -0
  59. package/a2ui/dist/catalog/Slider/index.js.map +1 -0
  60. package/a2ui/dist/catalog/Slider/utils.d.ts +11 -0
  61. package/a2ui/dist/catalog/Slider/utils.js +58 -0
  62. package/a2ui/dist/catalog/Slider/utils.js.map +1 -0
  63. package/a2ui/dist/catalog/Tabs/catalog.json +28 -0
  64. package/a2ui/dist/catalog/Tabs/index.d.ts +12 -0
  65. package/a2ui/dist/catalog/Tabs/index.js +32 -0
  66. package/a2ui/dist/catalog/Tabs/index.js.map +1 -0
  67. package/a2ui/dist/catalog/Text/catalog.json +74 -0
  68. package/a2ui/dist/catalog/Text/index.d.ts +18 -0
  69. package/a2ui/dist/catalog/Text/index.js +27 -0
  70. package/a2ui/dist/catalog/Text/index.js.map +1 -0
  71. package/a2ui/dist/catalog/TextField/catalog.json +147 -0
  72. package/a2ui/dist/catalog/TextField/index.d.ts +35 -0
  73. package/a2ui/dist/catalog/TextField/index.js +43 -0
  74. package/a2ui/dist/catalog/TextField/index.js.map +1 -0
  75. package/a2ui/dist/catalog/TextField/utils.d.ts +7 -0
  76. package/a2ui/dist/catalog/TextField/utils.js +51 -0
  77. package/a2ui/dist/catalog/TextField/utils.js.map +1 -0
  78. package/a2ui/dist/catalog/defineCatalog.d.ts +119 -0
  79. package/a2ui/dist/catalog/defineCatalog.js +196 -0
  80. package/a2ui/dist/catalog/defineCatalog.js.map +1 -0
  81. package/a2ui/dist/catalog/index.d.ts +20 -0
  82. package/a2ui/dist/catalog/index.js +26 -0
  83. package/a2ui/dist/catalog/index.js.map +1 -0
  84. package/a2ui/dist/catalog/utils/chart.d.ts +3 -0
  85. package/a2ui/dist/catalog/utils/chart.js +28 -0
  86. package/a2ui/dist/catalog/utils/chart.js.map +1 -0
  87. package/a2ui/dist/functions/index.d.ts +19 -0
  88. package/a2ui/dist/functions/index.js +87 -0
  89. package/a2ui/dist/functions/index.js.map +1 -0
  90. package/a2ui/dist/index.d.ts +11 -0
  91. package/a2ui/dist/index.js +35 -0
  92. package/a2ui/dist/index.js.map +1 -0
  93. package/a2ui/dist/react/A2UI.d.ts +77 -0
  94. package/a2ui/dist/react/A2UI.js +159 -0
  95. package/a2ui/dist/react/A2UI.js.map +1 -0
  96. package/a2ui/dist/react/A2UIProvider.d.ts +25 -0
  97. package/a2ui/dist/react/A2UIProvider.js +20 -0
  98. package/a2ui/dist/react/A2UIProvider.js.map +1 -0
  99. package/a2ui/dist/react/A2UIRenderer.d.ts +34 -0
  100. package/a2ui/dist/react/A2UIRenderer.js +161 -0
  101. package/a2ui/dist/react/A2UIRenderer.js.map +1 -0
  102. package/a2ui/dist/react/FormContext.d.ts +10 -0
  103. package/a2ui/dist/react/FormContext.js +12 -0
  104. package/a2ui/dist/react/FormContext.js.map +1 -0
  105. package/a2ui/dist/react/index.d.ts +8 -0
  106. package/a2ui/dist/react/index.js +23 -0
  107. package/a2ui/dist/react/index.js.map +1 -0
  108. package/a2ui/dist/react/useA2UIContext.d.ts +7 -0
  109. package/a2ui/dist/react/useA2UIContext.js +19 -0
  110. package/a2ui/dist/react/useA2UIContext.js.map +1 -0
  111. package/a2ui/dist/react/useAction.d.ts +9 -0
  112. package/a2ui/dist/react/useAction.js +38 -0
  113. package/a2ui/dist/react/useAction.js.map +1 -0
  114. package/a2ui/dist/react/useCatalog.d.ts +7 -0
  115. package/a2ui/dist/react/useCatalog.js +13 -0
  116. package/a2ui/dist/react/useCatalog.js.map +1 -0
  117. package/a2ui/dist/react/useChecks.d.ts +27 -0
  118. package/a2ui/dist/react/useChecks.js +76 -0
  119. package/a2ui/dist/react/useChecks.js.map +1 -0
  120. package/a2ui/dist/react/useDataBinding.d.ts +10 -0
  121. package/a2ui/dist/react/useDataBinding.js +175 -0
  122. package/a2ui/dist/react/useDataBinding.js.map +1 -0
  123. package/a2ui/dist/store/FormController.d.ts +23 -0
  124. package/a2ui/dist/store/FormController.js +40 -0
  125. package/a2ui/dist/store/FormController.js.map +1 -0
  126. package/a2ui/dist/store/FunctionRegistry.d.ts +47 -0
  127. package/a2ui/dist/store/FunctionRegistry.js +23 -0
  128. package/a2ui/dist/store/FunctionRegistry.js.map +1 -0
  129. package/a2ui/dist/store/MessageProcessor.d.ts +28 -0
  130. package/a2ui/dist/store/MessageProcessor.js +408 -0
  131. package/a2ui/dist/store/MessageProcessor.js.map +1 -0
  132. package/a2ui/dist/store/MessageStore.d.ts +38 -0
  133. package/a2ui/dist/store/MessageStore.js +37 -0
  134. package/a2ui/dist/store/MessageStore.js.map +1 -0
  135. package/a2ui/dist/store/Resource.d.ts +45 -0
  136. package/a2ui/dist/store/Resource.js +80 -0
  137. package/a2ui/dist/store/Resource.js.map +1 -0
  138. package/a2ui/dist/store/SignalStore.d.ts +10 -0
  139. package/a2ui/dist/store/SignalStore.js +29 -0
  140. package/a2ui/dist/store/SignalStore.js.map +1 -0
  141. package/a2ui/dist/store/index.d.ts +14 -0
  142. package/a2ui/dist/store/index.js +15 -0
  143. package/a2ui/dist/store/index.js.map +1 -0
  144. package/a2ui/dist/store/payloadNormalizer.d.ts +27 -0
  145. package/a2ui/dist/store/payloadNormalizer.js +179 -0
  146. package/a2ui/dist/store/payloadNormalizer.js.map +1 -0
  147. package/a2ui/dist/store/resolveFunctionCall.d.ts +18 -0
  148. package/a2ui/dist/store/resolveFunctionCall.js +131 -0
  149. package/a2ui/dist/store/resolveFunctionCall.js.map +1 -0
  150. package/a2ui/dist/store/types.d.ts +68 -0
  151. package/a2ui/dist/store/types.js +2 -0
  152. package/a2ui/dist/store/types.js.map +1 -0
  153. package/a2ui/dist/tsconfig.build.tsbuildinfo +1 -0
  154. package/a2ui/styles/catalog/Button.css +83 -0
  155. package/a2ui/styles/catalog/Card.css +49 -0
  156. package/a2ui/styles/catalog/CheckBox.css +46 -0
  157. package/a2ui/styles/catalog/Column.css +89 -0
  158. package/a2ui/styles/catalog/Divider.css +20 -0
  159. package/a2ui/styles/catalog/Icon.css +39 -0
  160. package/a2ui/styles/catalog/Image.css +54 -0
  161. package/a2ui/styles/catalog/LineChart.css +116 -0
  162. package/a2ui/styles/catalog/List.css +38 -0
  163. package/a2ui/styles/catalog/Modal.css +60 -0
  164. package/a2ui/styles/catalog/PieChart.css +109 -0
  165. package/a2ui/styles/catalog/RadioGroup.css +123 -0
  166. package/a2ui/styles/catalog/Row.css +83 -0
  167. package/a2ui/styles/catalog/Slider.css +96 -0
  168. package/a2ui/styles/catalog/Tabs.css +46 -0
  169. package/a2ui/styles/catalog/Text.css +121 -0
  170. package/a2ui/styles/catalog/TextField.css +48 -0
  171. package/a2ui/styles/theme.css +62 -0
  172. package/a2ui-catalog-extractor/README.md +605 -0
  173. package/a2ui-catalog-extractor/bin/a2ui-catalog-extractor.js +6 -0
  174. package/a2ui-catalog-extractor/dist/cli.d.ts +12 -0
  175. package/a2ui-catalog-extractor/dist/cli.js +171 -0
  176. package/a2ui-catalog-extractor/dist/cli.js.map +1 -0
  177. package/a2ui-catalog-extractor/dist/index.d.ts +140 -0
  178. package/a2ui-catalog-extractor/dist/index.js +755 -0
  179. package/a2ui-catalog-extractor/dist/index.js.map +1 -0
  180. package/a2ui-catalog-extractor/dist/tsconfig.build.tsbuildinfo +1 -0
  181. package/a2ui-catalog-extractor/skills/a2ui-catalog-extractor/SKILL.md +30 -0
  182. package/a2ui-prompt/README.md +65 -0
  183. package/a2ui-prompt/dist/index.d.ts +91 -0
  184. package/a2ui-prompt/dist/index.js +767 -0
  185. package/cli/README.md +88 -0
  186. package/cli/bin/cli.js +271 -0
  187. package/dist/index.d.ts +10 -0
  188. package/dist/index.js +10 -0
  189. package/dist/index.js.map +1 -0
  190. package/dist/tsconfig.build.tsbuildinfo +1 -0
  191. package/index.ts +114 -0
  192. package/openui/README.md +211 -0
  193. package/openui/dist/catalog/Action/index.d.ts +20 -0
  194. package/openui/dist/catalog/Action/index.js +23 -0
  195. package/openui/dist/catalog/Action/index.js.map +1 -0
  196. package/openui/dist/catalog/Button/index.d.ts +64 -0
  197. package/openui/dist/catalog/Button/index.js +75 -0
  198. package/openui/dist/catalog/Button/index.js.map +1 -0
  199. package/openui/dist/catalog/Card/index.d.ts +34 -0
  200. package/openui/dist/catalog/Card/index.js +69 -0
  201. package/openui/dist/catalog/Card/index.js.map +1 -0
  202. package/openui/dist/catalog/CardHeader/index.d.ts +5 -0
  203. package/openui/dist/catalog/CardHeader/index.js +18 -0
  204. package/openui/dist/catalog/CardHeader/index.js.map +1 -0
  205. package/openui/dist/catalog/Separator/index.d.ts +2 -0
  206. package/openui/dist/catalog/Separator/index.js +13 -0
  207. package/openui/dist/catalog/Separator/index.js.map +1 -0
  208. package/openui/dist/catalog/Stack/index.d.ts +29 -0
  209. package/openui/dist/catalog/Stack/index.js +61 -0
  210. package/openui/dist/catalog/Stack/index.js.map +1 -0
  211. package/openui/dist/catalog/Tag/index.d.ts +4 -0
  212. package/openui/dist/catalog/Tag/index.js +15 -0
  213. package/openui/dist/catalog/Tag/index.js.map +1 -0
  214. package/openui/dist/catalog/TextContent/index.d.ts +11 -0
  215. package/openui/dist/catalog/TextContent/index.js +33 -0
  216. package/openui/dist/catalog/TextContent/index.js.map +1 -0
  217. package/openui/dist/catalog/index.d.ts +7 -0
  218. package/openui/dist/catalog/index.js +11 -0
  219. package/openui/dist/catalog/index.js.map +1 -0
  220. package/openui/dist/catalog/utils.d.ts +2 -0
  221. package/openui/dist/catalog/utils.js +17 -0
  222. package/openui/dist/catalog/utils.js.map +1 -0
  223. package/openui/dist/core/context.d.ts +112 -0
  224. package/openui/dist/core/context.js +99 -0
  225. package/openui/dist/core/context.js.map +1 -0
  226. package/openui/dist/core/createLibrary.d.ts +10 -0
  227. package/openui/dist/core/createLibrary.js +36 -0
  228. package/openui/dist/core/createLibrary.js.map +1 -0
  229. package/openui/dist/core/hooks/index.d.ts +4 -0
  230. package/openui/dist/core/hooks/index.js +6 -0
  231. package/openui/dist/core/hooks/index.js.map +1 -0
  232. package/openui/dist/core/hooks/useFormValidation.d.ts +13 -0
  233. package/openui/dist/core/hooks/useFormValidation.js +76 -0
  234. package/openui/dist/core/hooks/useFormValidation.js.map +1 -0
  235. package/openui/dist/core/hooks/useOpenUIState.d.ts +33 -0
  236. package/openui/dist/core/hooks/useOpenUIState.js +413 -0
  237. package/openui/dist/core/hooks/useOpenUIState.js.map +1 -0
  238. package/openui/dist/core/hooks/useStateField.d.ts +2 -0
  239. package/openui/dist/core/hooks/useStateField.js +11 -0
  240. package/openui/dist/core/hooks/useStateField.js.map +1 -0
  241. package/openui/dist/core/index.d.ts +7 -0
  242. package/openui/dist/core/index.js +8 -0
  243. package/openui/dist/core/index.js.map +1 -0
  244. package/openui/dist/core/library.d.ts +20 -0
  245. package/openui/dist/core/library.js +13 -0
  246. package/openui/dist/core/library.js.map +1 -0
  247. package/openui/dist/core/renderer.css +271 -0
  248. package/openui/dist/core/renderer.d.ts +9 -0
  249. package/openui/dist/core/renderer.js +139 -0
  250. package/openui/dist/core/renderer.js.map +1 -0
  251. package/openui/dist/core/utils.d.ts +1 -0
  252. package/openui/dist/core/utils.js +76 -0
  253. package/openui/dist/core/utils.js.map +1 -0
  254. package/package.json +120 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/catalog/Stack/index.tsx"],"names":[],"mappings":";AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEjD,SAAS,aAAa,CAAC,KAA6C;IAClE,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,OAAO;YACV,OAAO,kBAAkB,CAAC;QAC5B,KAAK,QAAQ;YACX,OAAO,mBAAmB,CAAC;QAC7B,KAAK,KAAK;YACR,OAAO,gBAAgB,CAAC;QAC1B;YACE,OAAO,oBAAoB,CAAC;IAChC,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CACtB,OAA+C;IAE/C,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,QAAQ;YACX,OAAO,qBAAqB,CAAC;QAC/B,KAAK,KAAK;YACR,OAAO,kBAAkB,CAAC;QAC5B,KAAK,SAAS;YACZ,OAAO,sBAAsB,CAAC;QAChC;YACE,OAAO,oBA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mB;YAC5D,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE;YACnC,SAAS,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC;YAChC,aAAa,CAAC,KAAK,CAAC;YACpB,eAAe,CAAC,OAAO,CAAC;SACzB;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO,CACL,eAAM,SAAS,EAAE,SAAS,YAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAQ,CACzE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const Tag: import("../../core/library.js").DefinedComponent<z.ZodObject<{
3
+ text: z.ZodString;
4
+ }, z.core.$strip>>;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "@lynx-js/react/jsx-runtime";
2
+ // Copyright 2026 The Lynx Authors. All rights reserved.
3
+ // Licensed under the Apache License Version 2.0 that can be found in the
4
+ // LICENSE file in the root directory of this source tree.
5
+ import { z } from 'zod/v4';
6
+ import { defineComponent } from '../../core/library.js';
7
+ export const Tag = defineComponent({
8
+ name: 'Tag',
9
+ props: z.object({
10
+ text: z.string(),
11
+ }),
12
+ description: 'Tag',
13
+ component: ({ props }) => (_jsx("view", { className: 'OpenUITag', children: _jsx("text", { className: 'OpenUITagText', children: props.text }) })),
14
+ });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/catalog/Tag/index.tsx"],"names":[],"mappings":";AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,MAAM,GAAG,GAAG,eAAe,CAAC;IACjC,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC;IACF,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACxB,eAAM,SAAS,EAAC,WAAW,YACzB,eAAM,SAAS,EAAC,eAAe,YAAE,KAAK,CAAC,IAAI,GAAQ,GAC9C,CACR;CACF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const TextContent: import("../../core/library.js").DefinedComponent<z.ZodObject<{
3
+ text: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
4
+ size: z.ZodOptional<z.ZodEnum<{
5
+ default: "default";
6
+ small: "small";
7
+ large: "large";
8
+ "small-heavy": "small-heavy";
9
+ "large-heavy": "large-heavy";
10
+ }>>;
11
+ }, z.core.$strip>>;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "@lynx-js/react/jsx-runtime";
2
+ // Copyright 2026 The Lynx Authors. All rights reserved.
3
+ // Licensed under the Apache License Version 2.0 that can be found in the
4
+ // LICENSE file in the root directory of this source tree.
5
+ import { z } from 'zod/v4';
6
+ import { defineComponent } from '../../core/library.js';
7
+ export const TextContent = defineComponent({
8
+ name: 'TextContent',
9
+ props: z.object({
10
+ text: z.union([z.string(), z.number(), z.boolean()]),
11
+ size: z.enum(['small', 'default', 'large', 'small-heavy', 'large-heavy'])
12
+ .optional(),
13
+ }),
14
+ description: 'Text content with optional size.',
15
+ component: ({ props }) => {
16
+ const size = props.size ?? 'default';
17
+ let sizeClass = 'OpenUITextContentDefault';
18
+ if (size === 'small') {
19
+ sizeClass = 'OpenUITextContentSmall';
20
+ }
21
+ else if (size === 'large') {
22
+ sizeClass = 'OpenUITextContentLarge';
23
+ }
24
+ else if (size === 'small-heavy') {
25
+ sizeClass = 'OpenUITextContentSmallHeavy';
26
+ }
27
+ else if (size === 'large-heavy') {
28
+ sizeClass = 'OpenUITextContentLargeHeavy';
29
+ }
30
+ return (_jsx("text", { className: `OpenUITextContent ${sizeClass}`, children: String(props.text ?? '') }));
31
+ },
32
+ });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/catalog/TextContent/index.tsx"],"names":[],"mappings":";AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;IACzC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;aACtE,QAAQ,EAAE;KACd,CAAC;IACF,WAAW,EAAE,kCAAkC;IAC/C,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,SAAS,CAAC;QACrC,IAAI,SAAS,GAAG,0BAA0B,CAAC;QAC3C,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACrB,SAAS,GAAG,wBAAwB,CAAC;QACvC,CAAC;aAAM,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,SAAS,GAAG,wBAAwB,CAAC;QACvC,CAAC;aAAM,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;YAClC,SAAS,GAAG,6BAA6B,CAAC;QAC5C,CAAC;aAAM,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;YAClC,SAAS,GAAG,6BAA6B,CAAC;QAC5C,CAAC;QAED,OAAO,CACL,eAAM,SAAS,EAAE,qBAAqB,SAAS,EAAE,YAC9C,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,GACpB,CACR,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { Button, Buttons } from './Button/index.js';
2
+ export { Card } from './Card/index.js';
3
+ export { CardHeader } from './CardHeader/index.js';
4
+ export { Separator } from './Separator/index.js';
5
+ export { Stack } from './Stack/index.js';
6
+ export { Tag } from './Tag/index.js';
7
+ export { TextContent } from './TextContent/index.js';
@@ -0,0 +1,11 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export { Button, Buttons } from './Button/index.js';
5
+ export { Card } from './Card/index.js';
6
+ export { CardHeader } from './CardHeader/index.js';
7
+ export { Separator } from './Separator/index.js';
8
+ export { Stack } from './Stack/index.js';
9
+ export { Tag } from './Tag/index.js';
10
+ export { TextContent } from './TextContent/index.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/catalog/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const GAP_CLASS: Record<string, string>;
2
+ export declare function asArray<T>(value: T | T[] | null | undefined): T[];
@@ -0,0 +1,17 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export const GAP_CLASS = {
5
+ none: 'OpenUIGapNone',
6
+ xs: 'OpenUIGapXs',
7
+ s: 'OpenUIGapS',
8
+ m: 'OpenUIGapM',
9
+ l: 'OpenUIGapL',
10
+ xl: 'OpenUIGapXl',
11
+ };
12
+ export function asArray(value) {
13
+ if (value === null || value === undefined)
14
+ return [];
15
+ return Array.isArray(value) ? value : [value];
16
+ }
17
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/catalog/utils.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,MAAM,CAAC,MAAM,SAAS,GAA2B;IAC/C,IAAI,EAAE,eAAe;IACrB,EAAE,EAAE,aAAa;IACjB,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,YAAY;IACf,EAAE,EAAE,aAAa;CAClB,CAAC;AAEF,MAAM,UAAU,OAAO,CAAI,KAAiC;IAC1D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,112 @@
1
+ import type { ActionPlan, EvaluationContext, Library, OpenUIError, Store } from '@openuidev/lang-core';
2
+ import type { ReactNode } from '@lynx-js/react';
3
+ export interface OpenUIContextValue {
4
+ /** The active component library (schema + renderers). */
5
+ library: Library;
6
+ /**
7
+ * Render any value (element, array, primitive) into React nodes.
8
+ */
9
+ renderNode: (value: unknown) => ReactNode;
10
+ /**
11
+ * Trigger an action. Accepts either:
12
+ * - ActionPlan (v0.5): runs steps sequentially (Run, Set, ToAssistant, OpenUrl)
13
+ * - Legacy action config (v0.1): { type?: string, params?: Record<string, any> }
14
+ * - Nothing: fires ContinueConversation with the label
15
+ */
16
+ triggerAction: (userMessage: string, formName?: string, action?: ActionPlan | {
17
+ type?: string;
18
+ params?: Record<string, any>;
19
+ }) => void | Promise<void>;
20
+ /** Whether the LLM is currently streaming content. */
21
+ isStreaming: boolean;
22
+ /** Get a field value. Top-level for $bindings, nested under formName for form fields. */
23
+ getFieldValue: (formName: string | undefined, name: string) => any;
24
+ /**
25
+ * Set a form field value.
26
+ *
27
+ * @param formName The form's name prop
28
+ * @param componentType The component type (e.g. "Input", "Select") — optional
29
+ * @param name The field's name prop
30
+ * @param value The new value
31
+ * @param shouldTriggerSaveCallback When true, persists state via onStateUpdate.
32
+ * Text inputs should pass `false` on change and `true` on blur.
33
+ * Discrete inputs (Select, RadioGroup, etc.) should always pass `true`.
34
+ */
35
+ setFieldValue: (formName: string | undefined, componentType: string | undefined, name: string, value: unknown, shouldTriggerSaveCallback?: boolean) => void;
36
+ /** Reactive binding store for $variables and form data. */
37
+ store: Store;
38
+ /** AST evaluation context used by runtime expression evaluation. */
39
+ evaluationContext: EvaluationContext;
40
+ /** Report a structured error (used internally by error boundary). */
41
+ reportError?: (error: OpenUIError) => void;
42
+ }
43
+ export declare const OpenUIContext: import("react").Context<OpenUIContextValue | null>;
44
+ /**
45
+ * Access the full OpenUI context. Throws if used outside a <Renderer />.
46
+ */
47
+ export declare function useOpenUI(): OpenUIContextValue;
48
+ /**
49
+ * Get the renderNode function for rendering nested component values.
50
+ */
51
+ export declare function useRenderNode(): (value: unknown) => ReactNode;
52
+ /**
53
+ * Get the triggerAction function for firing structured action events.
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * const triggerAction = useTriggerAction();
58
+ * <button onClick={() => triggerAction("Submit", "myForm")}>
59
+ * ```
60
+ */
61
+ export declare function useTriggerAction(): (userMessage: string, formName?: string, action?: ActionPlan | {
62
+ type?: string;
63
+ params?: Record<string, any>;
64
+ }) => void | Promise<void>;
65
+ /**
66
+ * Whether the LLM is currently streaming content.
67
+ */
68
+ export declare function useIsStreaming(): boolean;
69
+ /**
70
+ * Get a form field value from the form state context.
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * const getFieldValue = useGetFieldValue();
75
+ * const name = getFieldValue("contactForm", "name");
76
+ * ```
77
+ */
78
+ export declare function useGetFieldValue(): (formName: string | undefined, name: string) => any;
79
+ /**
80
+ * Get the setFieldValue function for updating form field values.
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * const setFieldValue = useSetFieldValue();
85
+ * <input onChange={(e) => setFieldValue("contactForm", "Input", "name", e.target.value, false)} />
86
+ * ```
87
+ */
88
+ export declare function useSetFieldValue(): (formName: string | undefined, componentType: string | undefined, name: string, value: unknown, shouldTriggerSaveCallback?: boolean) => void;
89
+ export declare const FormNameContext: import("react").Context<string | undefined>;
90
+ /**
91
+ * Get the current form name (set by the nearest parent Form component).
92
+ * Returns undefined if not inside a Form.
93
+ */
94
+ export declare function useFormName(): string | undefined;
95
+ /**
96
+ * Persists a component's default/initial value into form state once streaming
97
+ * finishes — but only if the user hasn't already set a value.
98
+ *
99
+ * Call this inside any form component that has a `defaultValue` or
100
+ * `defaultChecked` prop. It is a no-op during streaming so that LLM
101
+ * prop changes don't fight with partial state.
102
+ *
103
+ * @param shouldTriggerSaveCallback — defaults to `false` (only local state, no message persistence)
104
+ */
105
+ export declare function useSetDefaultValue({ formName, componentType, name, existingValue, defaultValue, shouldTriggerSaveCallback, }: {
106
+ formName?: string;
107
+ componentType?: string;
108
+ name: string;
109
+ existingValue: unknown;
110
+ defaultValue: unknown;
111
+ shouldTriggerSaveCallback?: boolean;
112
+ }): void;
@@ -0,0 +1,99 @@
1
+ import { createContext, useContext, useEffect } from '@lynx-js/react';
2
+ export const OpenUIContext = createContext(null);
3
+ /**
4
+ * Access the full OpenUI context. Throws if used outside a <Renderer />.
5
+ */
6
+ export function useOpenUI() {
7
+ const ctx = useContext(OpenUIContext);
8
+ if (!ctx) {
9
+ throw new Error('useOpenUI must be used within a <Renderer /> component.');
10
+ }
11
+ return ctx;
12
+ }
13
+ /**
14
+ * Get the renderNode function for rendering nested component values.
15
+ */
16
+ export function useRenderNode() {
17
+ return useOpenUI().renderNode;
18
+ }
19
+ /**
20
+ * Get the triggerAction function for firing structured action events.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * const triggerAction = useTriggerAction();
25
+ * <button onClick={() => triggerAction("Submit", "myForm")}>
26
+ * ```
27
+ */
28
+ export function useTriggerAction() {
29
+ return useOpenUI().triggerAction;
30
+ }
31
+ /**
32
+ * Whether the LLM is currently streaming content.
33
+ */
34
+ export function useIsStreaming() {
35
+ return useOpenUI().isStreaming;
36
+ }
37
+ /**
38
+ * Get a form field value from the form state context.
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * const getFieldValue = useGetFieldValue();
43
+ * const name = getFieldValue("contactForm", "name");
44
+ * ```
45
+ */
46
+ export function useGetFieldValue() {
47
+ return useOpenUI().getFieldValue;
48
+ }
49
+ /**
50
+ * Get the setFieldValue function for updating form field values.
51
+ *
52
+ * @example
53
+ * ```tsx
54
+ * const setFieldValue = useSetFieldValue();
55
+ * <input onChange={(e) => setFieldValue("contactForm", "Input", "name", e.target.value, false)} />
56
+ * ```
57
+ */
58
+ export function useSetFieldValue() {
59
+ return useOpenUI().setFieldValue;
60
+ }
61
+ // ─── FormName context ───
62
+ export const FormNameContext = createContext(undefined);
63
+ /**
64
+ * Get the current form name (set by the nearest parent Form component).
65
+ * Returns undefined if not inside a Form.
66
+ */
67
+ export function useFormName() {
68
+ return useContext(FormNameContext);
69
+ }
70
+ // ─── Default value helper ───
71
+ /**
72
+ * Persists a component's default/initial value into form state once streaming
73
+ * finishes — but only if the user hasn't already set a value.
74
+ *
75
+ * Call this inside any form component that has a `defaultValue` or
76
+ * `defaultChecked` prop. It is a no-op during streaming so that LLM
77
+ * prop changes don't fight with partial state.
78
+ *
79
+ * @param shouldTriggerSaveCallback — defaults to `false` (only local state, no message persistence)
80
+ */
81
+ export function useSetDefaultValue({ formName, componentType, name, existingValue, defaultValue, shouldTriggerSaveCallback = false, }) {
82
+ const setFieldValue = useSetFieldValue();
83
+ const isStreaming = useIsStreaming();
84
+ useEffect(() => {
85
+ if (!isStreaming && existingValue === undefined && defaultValue !== undefined) {
86
+ setFieldValue(formName, componentType, name, defaultValue, shouldTriggerSaveCallback);
87
+ }
88
+ }, [
89
+ defaultValue,
90
+ existingValue,
91
+ formName,
92
+ componentType,
93
+ name,
94
+ isStreaming,
95
+ setFieldValue,
96
+ shouldTriggerSaveCallback,
97
+ ]);
98
+ }
99
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/core/context.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA4DtE,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC;AAE5E;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IACtC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,SAAS,EAAE,CAAC,UAAU,CAAC;AAChC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,SAAS,EAAE,CAAC,aAAa,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,SAAS,EAAE,CAAC,WAAW,CAAC;AACjC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,SAAS,EAAE,CAAC,aAAa,CAAC;AACnC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,SAAS,EAAE,CAAC,aAAa,CAAC;AACnC,CAAC;AAED,2BAA2B;AAE3B,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAqB,SAAS,CAAC,CAAC;AAE5E;;;GAGG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,UAAU,CAAC,eAAe,CAAC,CAAC;AACrC,CAAC;AAED,+BAA+B;AAE/B;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,yBAAyB,GAAG,KAAK,GAQlC;IACC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,IACE,CAAC,WAAW,IAAI,aAAa,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,EACzE,CAAC;YACD,aAAa,CACX,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,YAAY,EACZ,yBAAyB,CAC1B,CAAC;QACJ,CAAC;IACH,CAAC,EAAE;QACD,YAAY;QACZ,aAAa;QACb,QAAQ;QACR,aAAa;QACb,IAAI;QACJ,WAAW;QACX,aAAa;QACb,yBAAyB;KAC1B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ComponentGroup, DefinedComponent, Library } from './library.js';
2
+ export interface CreateOpenUiLibraryOptions {
3
+ /** Override the root component name. Defaults to `'Stack'`. */
4
+ root?: string;
5
+ /** Replace or extend the built-in component set. */
6
+ components?: DefinedComponent<any>[];
7
+ /** Replace or extend the built-in component groups. */
8
+ componentGroups?: ComponentGroup[];
9
+ }
10
+ export declare function createOpenUiLibrary(options?: CreateOpenUiLibraryOptions): Library;
@@ -0,0 +1,36 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ import { createLibrary } from './library.js';
5
+ import * as c from '../catalog/index.js';
6
+ const DEFAULT_COMPONENTS = [
7
+ c.Stack,
8
+ c.Card,
9
+ c.CardHeader,
10
+ c.TextContent,
11
+ c.Separator,
12
+ c.Button,
13
+ c.Buttons,
14
+ c.Tag,
15
+ ];
16
+ const DEFAULT_COMPONENT_GROUPS = [
17
+ { name: 'Layout', components: ['Stack'] },
18
+ {
19
+ name: 'Content',
20
+ components: ['Card', 'CardHeader', 'TextContent', 'Separator'],
21
+ },
22
+ { name: 'Buttons', components: ['Button', 'Buttons'] },
23
+ { name: 'Data Display', components: ['Tag'] },
24
+ ];
25
+ export function createOpenUiLibrary(options) {
26
+ return createLibrary({
27
+ root: options?.root ?? 'Stack',
28
+ components: options?.components
29
+ ? [...DEFAULT_COMPONENTS, ...options.components]
30
+ : DEFAULT_COMPONENTS,
31
+ componentGroups: options?.componentGroups
32
+ ? [...DEFAULT_COMPONENT_GROUPS, ...options.componentGroups]
33
+ : DEFAULT_COMPONENT_GROUPS,
34
+ });
35
+ }
36
+ //# sourceMappingURL=createLibrary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLibrary.js","sourceRoot":"","sources":["../../src/core/createLibrary.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,CAAC,MAAM,qBAAqB,CAAC;AAWzC,MAAM,kBAAkB,GAA4B;IAClD,CAAC,CAAC,KAAK;IACP,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,WAAW;IACb,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,MAAM;IACR,CAAC,CAAC,OAAO;IACT,CAAC,CAAC,GAAG;CACN,CAAC;AAEF,MAAM,wBAAwB,GAAqB;IACjD,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE;IACzC;QACE,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC;KAC/D;IACD,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE;IACtD,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE;CAC9C,CAAC;AAEF,MAAM,UAAU,mBAAmB,CACjC,OAAoC;IAEpC,OAAO,aAAa,CAAC;QACnB,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,OAAO;QAC9B,UAAU,EAAE,OAAO,EAAE,UAAU;YAC7B,CAAC,CAAC,CAAC,GAAG,kBAAkB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAChD,CAAC,CAAC,kBAAkB;QACtB,eAAe,EAAE,OAAO,EAAE,eAAe;YACvC,CAAC,CAAC,CAAC,GAAG,wBAAwB,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;YAC3D,CAAC,CAAC,wBAAwB;KAC7B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { useOpenUIState } from './useOpenUIState.js';
2
+ export type { OpenUIState, UseOpenUIStateOptions } from './useOpenUIState.js';
3
+ export { FormValidationContext, useCreateFormValidation, useFormValidation, } from './useFormValidation.js';
4
+ export type { FormValidationContextValue } from './useFormValidation.js';
@@ -0,0 +1,6 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export { useOpenUIState } from './useOpenUIState.js';
5
+ export { FormValidationContext, useCreateFormValidation, useFormValidation, } from './useFormValidation.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/hooks/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { ParsedRule } from '@openuidev/lang-core';
2
+ export interface FormValidationContextValue {
3
+ errors: Record<string, string | undefined>;
4
+ getFieldError: (name: string) => string | undefined;
5
+ validateField: (name: string, value: unknown, rules: ParsedRule[]) => boolean;
6
+ registerField: (name: string, rules: ParsedRule[], getValue: () => unknown) => void;
7
+ unregisterField: (name: string) => void;
8
+ validateForm: () => boolean;
9
+ clearFieldError: (name: string) => void;
10
+ }
11
+ export declare const FormValidationContext: import("react").Context<FormValidationContextValue | null>;
12
+ export declare function useFormValidation(): FormValidationContextValue | null;
13
+ export declare function useCreateFormValidation(): FormValidationContextValue;
@@ -0,0 +1,76 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ import { validate } from '@openuidev/lang-core';
5
+ import { createContext, useCallback, useContext, useMemo, useRef, useState, } from '@lynx-js/react';
6
+ export const FormValidationContext = createContext(null);
7
+ export function useFormValidation() {
8
+ return useContext(FormValidationContext);
9
+ }
10
+ export function useCreateFormValidation() {
11
+ const [errors, setErrors] = useState({});
12
+ const errorsRef = useRef(errors);
13
+ errorsRef.current = errors;
14
+ const fieldsRef = useRef({});
15
+ const getFieldError = useCallback((name) => errorsRef.current[name], []);
16
+ const validateField = useCallback((name, value, rules) => {
17
+ const error = validate(value, rules);
18
+ setErrors((prev) => {
19
+ if (prev[name] === error)
20
+ return prev;
21
+ return { ...prev, [name]: error };
22
+ });
23
+ return !error;
24
+ }, []);
25
+ const registerField = useCallback((name, rules, getValue) => {
26
+ fieldsRef.current[name] = { rules, getValue };
27
+ }, []);
28
+ const unregisterField = useCallback((name) => {
29
+ delete fieldsRef.current[name];
30
+ }, []);
31
+ const validateForm = useCallback(() => {
32
+ let allValid = true;
33
+ const newErrors = {};
34
+ for (const [name, reg] of Object.entries(fieldsRef.current)) {
35
+ let value = reg.getValue();
36
+ // Normalize: form state stores { value, componentType }; extract actual value if needed
37
+ if (value != null
38
+ && typeof value === 'object'
39
+ && 'value' in value
40
+ && 'componentType' in value) {
41
+ value = value.value;
42
+ }
43
+ const error = validate(value, reg.rules);
44
+ newErrors[name] = error;
45
+ if (error)
46
+ allValid = false;
47
+ }
48
+ setErrors(newErrors);
49
+ return allValid;
50
+ }, []);
51
+ const clearFieldError = useCallback((name) => {
52
+ setErrors((prev) => {
53
+ if (prev[name] === undefined)
54
+ return prev;
55
+ return { ...prev, [name]: undefined };
56
+ });
57
+ }, []);
58
+ return useMemo(() => ({
59
+ errors,
60
+ getFieldError,
61
+ validateField,
62
+ registerField,
63
+ unregisterField,
64
+ validateForm,
65
+ clearFieldError,
66
+ }), [
67
+ errors,
68
+ getFieldError,
69
+ validateField,
70
+ registerField,
71
+ unregisterField,
72
+ validateForm,
73
+ clearFieldError,
74
+ ]);
75
+ }
76
+ //# sourceMappingURL=useFormValidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormValidation.js","sourceRoot":"","sources":["../../../src/core/hooks/useFormValidation.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EACL,aA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AAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,aAAa;QACb,aAAa;QACb,aAAa;QACb,eAAe;QACf,YAAY;QACZ,eAAe;KAChB,CAAC,EACF;QACE,MAAM;QACN,aAAa;QACb,aAAa;QACb,aAAa;QACb,eAAe;QACf,YAAY;QACZ,eAAe;KAChB,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { ActionEvent, OpenUIError, ParseResult, ToolProvider } from '@openuidev/lang-core';
2
+ import type React from 'react';
3
+ import type { OpenUIContextValue } from '../context.js';
4
+ import type { Library } from '../library.js';
5
+ export interface UseOpenUIStateOptions {
6
+ response: string | null;
7
+ library: Library;
8
+ isStreaming: boolean;
9
+ onAction?: (event: ActionEvent) => void;
10
+ onStateUpdate?: (state: Record<string, unknown>) => void;
11
+ initialState?: Record<string, unknown>;
12
+ /** ToolProvider for Query data fetching — MCP, REST, GraphQL, or any backend. */
13
+ toolProvider?: ToolProvider | null;
14
+ /** Callback for structured, LLM-friendly errors. See OpenUIError type. */
15
+ onError?: (errors: OpenUIError[]) => void;
16
+ }
17
+ export interface OpenUIState {
18
+ /** Evaluated result (props resolved to concrete values). Used by Renderer. */
19
+ result: ParseResult | null;
20
+ /** Raw parse result (AST nodes in props). Used by onParseResult callback. */
21
+ parseResult: ParseResult | null;
22
+ contextValue: OpenUIContextValue;
23
+ /** Whether any Query is currently fetching data. */
24
+ isQueryLoading: boolean;
25
+ }
26
+ /**
27
+ * Core state hook — extracts all form state, action handling, parser
28
+ * management, and context assembly out of the Renderer component.
29
+ *
30
+ * Store holds everything: $bindings as top-level keys, form fields nested
31
+ * under formName as plain values.
32
+ */
33
+ export declare function useOpenUIState({ response, library, isStreaming, onAction, onStateUpdate, initialState, toolProvider, onError, }: UseOpenUIStateOptions, renderDeep: (value: unknown) => React.ReactNode): OpenUIState;