@lynx-js/genui 0.0.1-rc.0 → 0.0.2
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.
- package/a2ui/README.md +777 -100
- package/a2ui/dist/catalog/Button/{index.js → index.jsx} +12 -8
- package/a2ui/dist/catalog/Button/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Card/{index.js → index.jsx} +5 -4
- package/a2ui/dist/catalog/Card/index.jsx.map +1 -0
- package/a2ui/dist/catalog/CheckBox/{index.js → index.jsx} +11 -6
- package/a2ui/dist/catalog/CheckBox/index.jsx.map +1 -0
- package/a2ui/dist/catalog/ChoicePicker/catalog.json +265 -0
- package/a2ui/dist/catalog/ChoicePicker/index.d.ts +56 -0
- package/a2ui/dist/catalog/ChoicePicker/index.jsx +98 -0
- package/a2ui/dist/catalog/ChoicePicker/index.jsx.map +1 -0
- package/a2ui/dist/catalog/ChoicePicker/utils.d.ts +13 -0
- package/a2ui/dist/catalog/ChoicePicker/utils.js +80 -0
- package/a2ui/dist/catalog/ChoicePicker/utils.js.map +1 -0
- package/a2ui/dist/catalog/Column/{index.js → index.jsx} +13 -14
- package/a2ui/dist/catalog/Column/index.jsx.map +1 -0
- package/a2ui/dist/catalog/DateTimeInput/catalog.json +165 -0
- package/a2ui/dist/catalog/DateTimeInput/index.d.ts +43 -0
- package/a2ui/dist/catalog/DateTimeInput/index.jsx +258 -0
- package/a2ui/dist/catalog/DateTimeInput/index.jsx.map +1 -0
- package/a2ui/dist/catalog/DateTimeInput/utils.d.ts +53 -0
- package/a2ui/dist/catalog/DateTimeInput/utils.js +248 -0
- package/a2ui/dist/catalog/DateTimeInput/utils.js.map +1 -0
- package/a2ui/dist/catalog/Divider/index.jsx +7 -0
- package/a2ui/dist/catalog/Divider/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Icon/catalog.json +173 -2
- package/a2ui/dist/catalog/Icon/index.d.ts +2 -2
- package/a2ui/dist/catalog/Icon/{index.js → index.jsx} +4 -3
- package/a2ui/dist/catalog/Icon/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Image/catalog.json +1 -17
- package/a2ui/dist/catalog/Image/index.d.ts +1 -3
- package/a2ui/dist/catalog/Image/index.jsx +21 -0
- package/a2ui/dist/catalog/Image/index.jsx.map +1 -0
- package/a2ui/dist/catalog/LineChart/{index.js → index.jsx} +53 -16
- package/a2ui/dist/catalog/LineChart/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/List/{index.js → index.jsx} +9 -6
- package/a2ui/dist/catalog/List/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/Modal/{index.js → index.jsx} +18 -9
- package/a2ui/dist/catalog/Modal/index.jsx.map +1 -0
- package/a2ui/dist/catalog/PieChart/{index.js → index.jsx} +41 -15
- package/a2ui/dist/catalog/PieChart/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/RadioGroup/{index.js → index.jsx} +18 -5
- package/a2ui/dist/catalog/RadioGroup/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Row/{index.js → index.jsx} +10 -7
- package/a2ui/dist/catalog/Row/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Slider/{index.js → index.jsx} +22 -7
- package/a2ui/dist/catalog/Slider/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/Tabs/index.jsx +40 -0
- package/a2ui/dist/catalog/Tabs/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Text/catalog.json +6 -2
- package/a2ui/dist/catalog/Text/index.d.ts +1 -1
- package/a2ui/dist/catalog/Text/index.jsx +16 -0
- package/a2ui/dist/catalog/Text/index.jsx.map +1 -0
- package/a2ui/dist/catalog/TextField/{index.js → index.jsx} +8 -5
- package/a2ui/dist/catalog/TextField/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/index.d.ts +21 -17
- package/a2ui/dist/catalog/index.js +2067 -20
- package/a2ui/dist/catalog/index.js.map +1 -1
- package/a2ui/dist/index.d.ts +1 -1
- package/a2ui/dist/index.js +1 -1
- package/a2ui/dist/index.js.map +1 -1
- package/a2ui/dist/react/A2UI.d.ts +1 -1
- package/a2ui/dist/react/{A2UI.js → A2UI.jsx} +6 -5
- package/a2ui/dist/react/{A2UI.js.map → A2UI.jsx.map} +1 -1
- package/a2ui/dist/react/{A2UIProvider.js → A2UIProvider.jsx} +2 -3
- package/a2ui/dist/react/{A2UIProvider.js.map → A2UIProvider.jsx.map} +1 -1
- package/a2ui/dist/react/A2UIRenderer.d.ts +1 -0
- package/a2ui/dist/react/{A2UIRenderer.js → A2UIRenderer.jsx} +36 -24
- package/a2ui/dist/react/A2UIRenderer.jsx.map +1 -0
- package/a2ui/dist/react/index.d.ts +3 -3
- package/a2ui/dist/react/index.js +2 -2
- package/a2ui/dist/react/index.js.map +1 -1
- package/a2ui/dist/react/useA2UIContext.d.ts +1 -1
- package/a2ui/dist/react/useA2UIContext.js +1 -1
- package/a2ui/dist/react/useA2UIContext.js.map +1 -1
- package/a2ui/dist/react/useAction.js +2 -1
- package/a2ui/dist/react/useAction.js.map +1 -1
- package/a2ui/dist/react/useChecks.js +7 -2
- package/a2ui/dist/react/useChecks.js.map +1 -1
- package/a2ui/dist/react/useDataBinding.d.ts +1 -1
- package/a2ui/dist/react/useDataBinding.js +24 -48
- package/a2ui/dist/react/useDataBinding.js.map +1 -1
- package/a2ui/dist/store/MessageProcessor.js +7 -19
- package/a2ui/dist/store/MessageProcessor.js.map +1 -1
- package/a2ui/dist/store/SignalStore.d.ts +2 -0
- package/a2ui/dist/store/SignalStore.js +5 -0
- package/a2ui/dist/store/SignalStore.js.map +1 -1
- package/a2ui/dist/store/index.d.ts +3 -1
- package/a2ui/dist/store/index.js +3 -1
- package/a2ui/dist/store/index.js.map +1 -1
- package/a2ui/dist/store/resolveDynamic.d.ts +9 -0
- package/a2ui/dist/store/resolveDynamic.js +88 -0
- package/a2ui/dist/store/resolveDynamic.js.map +1 -0
- package/a2ui/dist/store/resolveFunctionCall.d.ts +2 -4
- package/a2ui/dist/store/resolveFunctionCall.js +24 -82
- package/a2ui/dist/store/resolveFunctionCall.js.map +1 -1
- package/a2ui/dist/store/signalResolution.d.ts +4 -0
- package/a2ui/dist/store/signalResolution.js +25 -0
- package/a2ui/dist/store/signalResolution.js.map +1 -0
- package/a2ui/dist/store/utils.d.ts +7 -0
- package/a2ui/dist/store/utils.js +24 -0
- package/a2ui/dist/store/utils.js.map +1 -0
- package/a2ui/dist/tsconfig.build.tsbuildinfo +1 -1
- package/a2ui/styles/catalog/ChoicePicker.css +157 -0
- package/a2ui/styles/catalog/DateTimeInput.css +375 -0
- package/a2ui/styles/catalog/Icon.css +1 -1
- package/a2ui/styles/catalog/Modal.css +1 -0
- package/a2ui/styles/catalog/Text.css +13 -17
- package/a2ui/styles/theme.css +2 -1
- package/a2ui-catalog-extractor/README.md +23 -15
- package/a2ui-catalog-extractor/bin/a2ui-catalog-extractor.js +0 -1
- package/a2ui-catalog-extractor/dist/tsconfig.build.tsbuildinfo +1 -1
- package/a2ui-prompt/README.md +1 -2
- package/a2ui-prompt/dist/index.js +138 -104
- package/cli/bin/cli.js +5 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -1
- package/a2ui/dist/catalog/Button/index.js.map +0 -1
- package/a2ui/dist/catalog/Card/index.js.map +0 -1
- package/a2ui/dist/catalog/CheckBox/index.js.map +0 -1
- package/a2ui/dist/catalog/Column/index.js.map +0 -1
- package/a2ui/dist/catalog/Divider/index.js +0 -8
- package/a2ui/dist/catalog/Divider/index.js.map +0 -1
- package/a2ui/dist/catalog/Icon/index.js.map +0 -1
- package/a2ui/dist/catalog/Image/index.js +0 -30
- package/a2ui/dist/catalog/Image/index.js.map +0 -1
- package/a2ui/dist/catalog/Modal/index.js.map +0 -1
- package/a2ui/dist/catalog/RadioGroup/index.js.map +0 -1
- package/a2ui/dist/catalog/Row/index.js.map +0 -1
- package/a2ui/dist/catalog/Tabs/index.js +0 -32
- package/a2ui/dist/catalog/Tabs/index.js.map +0 -1
- package/a2ui/dist/catalog/Text/index.js +0 -27
- package/a2ui/dist/catalog/Text/index.js.map +0 -1
- package/a2ui/dist/react/A2UIRenderer.js.map +0 -1
package/a2ui-prompt/README.md
CHANGED
|
@@ -37,8 +37,7 @@ const prompt = buildA2UISystemPrompt({ catalog });
|
|
|
37
37
|
|
|
38
38
|
`readA2UICatalogFromDirectory` expects generated files such as
|
|
39
39
|
`<Component>/catalog.json` and optional function definitions under `functions/`.
|
|
40
|
-
Use `genui a2ui generate catalog`
|
|
41
|
-
`@lynx-js/genui/a2ui-catalog-extractor` to create those artifacts.
|
|
40
|
+
Use `genui a2ui generate catalog` to create those artifacts.
|
|
42
41
|
|
|
43
42
|
## Exports
|
|
44
43
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
2
|
+
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
3
3
|
const BASIC_CATALOG_ID = 'https://a2ui.org/specification/v0_9/basic_catalog.json';
|
|
4
4
|
const BASIC_CATALOG_EXAMPLES = [
|
|
5
5
|
{
|
|
@@ -13,6 +13,18 @@ const BASIC_CATALOG_EXAMPLES = [
|
|
|
13
13
|
catalogId: BASIC_CATALOG_ID
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
+
{
|
|
17
|
+
version: 'v0.9',
|
|
18
|
+
updateDataModel: {
|
|
19
|
+
surfaceId: 'main',
|
|
20
|
+
value: {
|
|
21
|
+
form: {
|
|
22
|
+
email: '',
|
|
23
|
+
password: ''
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
16
28
|
{
|
|
17
29
|
version: 'v0.9',
|
|
18
30
|
updateComponents: {
|
|
@@ -82,18 +94,6 @@ const BASIC_CATALOG_EXAMPLES = [
|
|
|
82
94
|
}
|
|
83
95
|
]
|
|
84
96
|
}
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
version: 'v0.9',
|
|
88
|
-
updateDataModel: {
|
|
89
|
-
surfaceId: 'main',
|
|
90
|
-
value: {
|
|
91
|
-
form: {
|
|
92
|
-
email: '',
|
|
93
|
-
password: ''
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
97
|
}
|
|
98
98
|
]
|
|
99
99
|
},
|
|
@@ -108,6 +108,27 @@ const BASIC_CATALOG_EXAMPLES = [
|
|
|
108
108
|
catalogId: BASIC_CATALOG_ID
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
+
{
|
|
112
|
+
version: 'v0.9',
|
|
113
|
+
updateDataModel: {
|
|
114
|
+
surfaceId: 'main',
|
|
115
|
+
path: '/items',
|
|
116
|
+
value: [
|
|
117
|
+
{
|
|
118
|
+
name: 'Canal walk',
|
|
119
|
+
detail: 'Morning coffee and quiet bridges'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'Museum loop',
|
|
123
|
+
detail: 'Design exhibits plus lunch nearby'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'Sunset hill',
|
|
127
|
+
detail: 'Short climb with skyline views'
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
},
|
|
111
132
|
{
|
|
112
133
|
version: 'v0.9',
|
|
113
134
|
updateComponents: {
|
|
@@ -176,27 +197,6 @@ const BASIC_CATALOG_EXAMPLES = [
|
|
|
176
197
|
}
|
|
177
198
|
]
|
|
178
199
|
}
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
version: 'v0.9',
|
|
182
|
-
updateDataModel: {
|
|
183
|
-
surfaceId: 'main',
|
|
184
|
-
path: '/items',
|
|
185
|
-
value: [
|
|
186
|
-
{
|
|
187
|
-
name: 'Canal walk',
|
|
188
|
-
detail: 'Morning coffee and quiet bridges'
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: 'Museum loop',
|
|
192
|
-
detail: 'Design exhibits plus lunch nearby'
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: 'Sunset hill',
|
|
196
|
-
detail: 'Short climb with skyline views'
|
|
197
|
-
}
|
|
198
|
-
]
|
|
199
|
-
}
|
|
200
200
|
}
|
|
201
201
|
]
|
|
202
202
|
},
|
|
@@ -211,6 +211,35 @@ const BASIC_CATALOG_EXAMPLES = [
|
|
|
211
211
|
catalogId: BASIC_CATALOG_ID
|
|
212
212
|
}
|
|
213
213
|
},
|
|
214
|
+
{
|
|
215
|
+
version: 'v0.9',
|
|
216
|
+
updateDataModel: {
|
|
217
|
+
surfaceId: 'main',
|
|
218
|
+
value: {
|
|
219
|
+
chart: {
|
|
220
|
+
labels: [
|
|
221
|
+
'Mon',
|
|
222
|
+
'Tue',
|
|
223
|
+
'Wed',
|
|
224
|
+
'Thu',
|
|
225
|
+
'Fri'
|
|
226
|
+
],
|
|
227
|
+
series: [
|
|
228
|
+
{
|
|
229
|
+
name: 'Users',
|
|
230
|
+
values: [
|
|
231
|
+
120,
|
|
232
|
+
148,
|
|
233
|
+
132,
|
|
234
|
+
171,
|
|
235
|
+
190
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
},
|
|
214
243
|
{
|
|
215
244
|
version: 'v0.9',
|
|
216
245
|
updateComponents: {
|
|
@@ -251,35 +280,6 @@ const BASIC_CATALOG_EXAMPLES = [
|
|
|
251
280
|
}
|
|
252
281
|
]
|
|
253
282
|
}
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
version: 'v0.9',
|
|
257
|
-
updateDataModel: {
|
|
258
|
-
surfaceId: 'main',
|
|
259
|
-
value: {
|
|
260
|
-
chart: {
|
|
261
|
-
labels: [
|
|
262
|
-
'Mon',
|
|
263
|
-
'Tue',
|
|
264
|
-
'Wed',
|
|
265
|
-
'Thu',
|
|
266
|
-
'Fri'
|
|
267
|
-
],
|
|
268
|
-
series: [
|
|
269
|
-
{
|
|
270
|
-
name: 'Users',
|
|
271
|
-
values: [
|
|
272
|
-
120,
|
|
273
|
-
148,
|
|
274
|
-
132,
|
|
275
|
-
171,
|
|
276
|
-
190
|
|
277
|
-
]
|
|
278
|
-
}
|
|
279
|
-
]
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
283
|
}
|
|
284
284
|
]
|
|
285
285
|
},
|
|
@@ -338,9 +338,11 @@ const BASIC_CATALOG_EXAMPLES = [
|
|
|
338
338
|
var catalog_namespaceObject = JSON.parse('{"Button":{"properties":{"child":{"type":"string"},"variant":{"type":"string","enum":["primary","borderless"]},"isValid":{"type":"boolean"},"action":{"oneOf":[{"type":"object","properties":{"event":{"type":"object","properties":{"name":{"type":"string"},"context":{"type":"object","additionalProperties":true,"description":"Context is a JSON object map in v0.9."}},"required":["name"],"additionalProperties":false}},"required":["event"],"additionalProperties":false},{"type":"object","properties":{"functionCall":{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}},"required":["functionCall"],"additionalProperties":false}],"description":"v0.9 actions should use the `event` wrapper for server-dispatched clicks."},"checks":{"type":"array","items":{"type":"object","properties":{"condition":{"oneOf":[{"type":"boolean"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}]},"message":{"type":"string"}},"required":["condition","message"],"additionalProperties":false}}},"required":["child","action"]}}');
|
|
339
339
|
var Card_catalog_namespaceObject = JSON.parse('{"Card":{"properties":{"child":{"type":"string"},"variant":{"type":"string","enum":["elevated","outlined","filled","ghost"]},"weight":{"type":"number"}},"required":["child"]}}');
|
|
340
340
|
var CheckBox_catalog_namespaceObject = JSON.parse('{"CheckBox":{"properties":{"label":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}]},"value":{"oneOf":[{"type":"boolean"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}]},"checks":{"type":"array","items":{"type":"object","properties":{"condition":{"oneOf":[{"type":"boolean"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}]},"message":{"type":"string"}},"required":["condition","message"],"additionalProperties":false}}},"required":["label","value"]}}');
|
|
341
|
+
var ChoicePicker_catalog_namespaceObject = JSON.parse('{"ChoicePicker":{"properties":{"label":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"The label for the group of options."},"variant":{"type":"string","enum":["multipleSelection","mutuallyExclusive"],"description":"A hint for how the choice picker should be displayed and behave."},"options":{"type":"array","items":{"type":"object","properties":{"label":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"The text to display for this option."},"value":{"type":"string","description":"The stable value associated with this option."}},"required":["label","value"],"additionalProperties":false},"description":"The list of available options to choose from."},"value":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"The list of currently selected values."},"displayStyle":{"type":"string","enum":["checkbox","chips"],"description":"The display style of the component."},"filterable":{"type":"boolean","description":"If true, displays a search input to filter the options."},"checks":{"type":"array","items":{"type":"object","properties":{"condition":{"oneOf":[{"type":"boolean"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"The condition that indicates whether the check passes."},"message":{"type":"string","description":"The error message to display if the check fails."}},"required":["condition","message"],"additionalProperties":false},"description":"A list of checks to perform."}},"required":["options","value"]}}');
|
|
341
342
|
var Column_catalog_namespaceObject = JSON.parse('{"Column":{"properties":{"children":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"componentId":{"type":"string"},"path":{"type":"string"}},"required":["componentId","path"],"additionalProperties":false}],"description":"Static child IDs array or template object."},"align":{"type":"string","enum":["start","center","end","stretch"]},"justify":{"type":"string","enum":["start","center","end","stretch","spaceBetween","spaceAround","spaceEvenly"]}},"required":["children"]}}');
|
|
343
|
+
var DateTimeInput_catalog_namespaceObject = JSON.parse('{"DateTimeInput":{"properties":{"value":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false}],"description":"The current date/time value. Typically bound to a data path."},"label":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"The text label for the input field."},"enableDate":{"type":"boolean","description":"Whether to show the date picker."},"enableTime":{"type":"boolean","description":"Whether to show the time picker."},"outputFormat":{"type":"string","description":"Format string for the output value. Supports YYYY, MM, DD, HH, and mm."},"min":{"type":"string","description":"Minimum allowed date/time value."},"max":{"type":"string","description":"Maximum allowed date/time value."},"checks":{"type":"array","items":{"type":"object","properties":{"condition":{"oneOf":[{"type":"boolean"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"The condition that indicates whether the check passes."},"message":{"type":"string","description":"The error message to display if the check fails."}},"required":["condition","message"],"additionalProperties":false},"description":"A list of checks to perform."}},"required":["value"]}}');
|
|
342
344
|
var Divider_catalog_namespaceObject = JSON.parse('{"Divider":{"properties":{"axis":{"type":"string","enum":["horizontal","vertical"]}},"required":[]}}');
|
|
343
|
-
var Icon_catalog_namespaceObject = JSON.parse('{"Icon":{"properties":{"name":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false}],"description":"Material icon name
|
|
345
|
+
var Icon_catalog_namespaceObject = JSON.parse('{"Icon":{"properties":{"name":{"oneOf":[{"type":"string","enum":["account_circle","add","arrow_back","arrow_forward","camera","check","close","delete","edit","error","favorite","help","home","info","location_on","lock","mail","menu","more_vert","pause","person","play_arrow","refresh","search","send","settings","share","star","warning"]},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false}],"description":"Google Material icon ligature name, e.g. \\"info\\", \\"account_circle\\", \\"arrow_back\\"."},"size":{"type":"string","enum":["sm","md","lg"]},"color":{"type":"string","enum":["primary","muted","inherit"]}},"required":["name"]}}');
|
|
344
346
|
var Image_catalog_namespaceObject = JSON.parse('{"Image":{"properties":{"url":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false}],"description":"Image URL or path binding."},"fit":{"type":"string","enum":["contain","cover","fill","none","scale-down"]},"mode":{"type":"string","enum":["center","scaleToFill","aspectFit","aspectFill"]},"variant":{"type":"string","enum":["icon","avatar","smallFeature","mediumFeature","largeFeature","header"]},"weight":{"type":"number"}},"required":["url"]}}');
|
|
345
347
|
var LineChart_catalog_namespaceObject = JSON.parse('{"LineChart":{"properties":{"labels":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false}],"description":"Category labels shown along the x axis."},"series":{"oneOf":[{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"values":{"type":"array","items":{"type":"number"}},"color":{"type":"string"}},"required":["name","values"],"additionalProperties":false}},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false}],"description":"One or more line series to render over the shared labels."},"variant":{"type":"string","enum":["linear","natural","step"]},"xLabel":{"type":"string"},"yLabel":{"type":"string"},"showGrid":{"type":"boolean"},"showLegend":{"type":"boolean"},"height":{"type":"number"}},"required":["labels","series"]}}');
|
|
346
348
|
var List_catalog_namespaceObject = JSON.parse('{"List":{"properties":{"children":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"componentId":{"type":"string"},"path":{"type":"string"}},"required":["componentId","path"],"additionalProperties":false}],"description":"Static child IDs array or template object."},"direction":{"type":"string","enum":["horizontal","vertical"]},"align":{"type":"string","enum":["start","center","end","stretch"]}},"required":["children"]}}');
|
|
@@ -349,7 +351,7 @@ var RadioGroup_catalog_namespaceObject = JSON.parse('{"RadioGroup":{"properties"
|
|
|
349
351
|
var Row_catalog_namespaceObject = JSON.parse('{"Row":{"properties":{"children":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"componentId":{"type":"string"},"path":{"type":"string"}},"required":["componentId","path"],"additionalProperties":false}],"description":"Static child IDs array or template object."},"justify":{"type":"string","enum":["start","center","end","stretch","spaceBetween","spaceAround","spaceEvenly"]},"align":{"type":"string","enum":["start","center","end","stretch"]}},"required":["children"]}}');
|
|
350
352
|
var Slider_catalog_namespaceObject = JSON.parse('{"Slider":{"properties":{"label":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"The label for the slider."},"min":{"type":"number","description":"The minimum value of the slider."},"max":{"type":"number","description":"The maximum value of the slider."},"value":{"oneOf":[{"type":"number"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"The current value of the slider."},"checks":{"type":"array","items":{"type":"object","properties":{"condition":{"oneOf":[{"type":"boolean"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"The condition that indicates whether the check passes."},"message":{"type":"string","description":"The error message to display if the check fails."}},"required":["condition","message"],"additionalProperties":false},"description":"A list of checks to perform."}},"required":["max","value"]}}');
|
|
351
353
|
var Tabs_catalog_namespaceObject = JSON.parse('{"Tabs":{"properties":{"tabs":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"child":{"type":"string"}},"required":["title","child"],"additionalProperties":false}}},"required":["tabs"]}}');
|
|
352
|
-
var Text_catalog_namespaceObject = JSON.parse('{"Text":{"properties":{"text":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"Literal text, path binding, or function call."},"variant":{"type":"string","enum":["h1","h2","h3","h4","h5","caption","body","markdown"]},"
|
|
354
|
+
var Text_catalog_namespaceObject = JSON.parse('{"Text":{"properties":{"text":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":true},"returnType":{"type":"string","enum":["string","number","boolean","object","array","any","void"]}},"required":["call","args"],"additionalProperties":false}],"description":"Literal text, path binding, or function call."},"variant":{"type":"string","enum":["h1","h2","h3","h4","h5","caption","body","markdown"]},"emphasis":{"type":"string","enum":["medium","strong"]}},"required":["text"]}}');
|
|
353
355
|
var TextField_catalog_namespaceObject = JSON.parse('{"TextField":{"properties":{"label":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false}],"description":"The text label for the input field."},"value":{"oneOf":[{"type":"string"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false}],"description":"The value of the text field."},"variant":{"type":"string","enum":["number","longText","shortText","obscured"],"description":"The type of input field to display."},"validationRegexp":{"type":"string","description":"A regular expression used for client-side validation of the input."},"checks":{"type":"array","items":{"type":"object","properties":{"condition":{"oneOf":[{"type":"boolean"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false},{"type":"object","properties":{"call":{"type":"string"},"args":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"object","properties":{"path":{"type":"string"}},"required":["path"],"additionalProperties":false}]}},"returnType":{"type":"string","enum":["boolean"]}},"required":["call"],"additionalProperties":false}],"description":"The condition that indicates whether the check passes."},"message":{"type":"string","description":"The error message to display if the check fails."}},"required":["condition","message"],"additionalProperties":false},"description":"A list of checks to perform."}},"required":["label"]}}');
|
|
354
356
|
const a2ui_catalog_BASIC_CATALOG_ID = 'https://a2ui.org/specification/v0_9/basic_catalog.json';
|
|
355
357
|
const CATALOG_MANIFESTS = [
|
|
@@ -367,6 +369,8 @@ const CATALOG_MANIFESTS = [
|
|
|
367
369
|
catalog_namespaceObject,
|
|
368
370
|
TextField_catalog_namespaceObject,
|
|
369
371
|
CheckBox_catalog_namespaceObject,
|
|
372
|
+
ChoicePicker_catalog_namespaceObject,
|
|
373
|
+
DateTimeInput_catalog_namespaceObject,
|
|
370
374
|
RadioGroup_catalog_namespaceObject,
|
|
371
375
|
Slider_catalog_namespaceObject
|
|
372
376
|
];
|
|
@@ -374,7 +378,9 @@ const COMPONENT_SUMMARIES = {
|
|
|
374
378
|
Button: 'Clickable button. MUST always include an action. Has no "label" prop; use a child Text component for the visible label.',
|
|
375
379
|
Card: 'Card container with exactly one child. Wrap multiple elements in a Column/Row/List first.',
|
|
376
380
|
CheckBox: 'Boolean checkbox with a label and optional validation checks.',
|
|
381
|
+
ChoicePicker: 'Single- or multi-select choice picker with checkbox and chip display styles.',
|
|
377
382
|
Column: 'Vertical layout container.',
|
|
383
|
+
DateTimeInput: 'Date and/or time input with a calendar panel. Without outputFormat, date-enabled inputs write YYYY-MM-DD.',
|
|
378
384
|
Divider: 'Horizontal or vertical separator line.',
|
|
379
385
|
Icon: 'Display an icon by name.',
|
|
380
386
|
Image: 'Display an image by URL.',
|
|
@@ -562,17 +568,23 @@ and exactly ONE of the following keys:
|
|
|
562
568
|
|
|
563
569
|
## Required ordering for a fresh response
|
|
564
570
|
1. createSurface (with surfaceId + catalogId)
|
|
565
|
-
2.
|
|
566
|
-
|
|
567
|
-
|
|
571
|
+
2. updateDataModel for every initial value referenced by a { "path": ... }
|
|
572
|
+
binding. Send this before the first component that reads those paths.
|
|
573
|
+
3. updateComponents (the FIRST one MUST contain a component whose id is "root")
|
|
574
|
+
4. (optional) further updateDataModel / updateComponents for incremental UI.
|
|
575
|
+
For each incremental bound component, send its data model value first, then
|
|
576
|
+
send the component that binds to it.
|
|
568
577
|
|
|
569
578
|
## Envelope semantics
|
|
570
579
|
- createSurface creates a surface. Once created, its surfaceId and catalogId are
|
|
571
580
|
fixed. To change catalog/theme, delete and recreate the surface.
|
|
572
581
|
- updateComponents adds or replaces component definitions for that surface. It
|
|
573
|
-
may reference data paths
|
|
574
|
-
|
|
575
|
-
|
|
582
|
+
may reference data paths, but for smooth streaming those paths SHOULD already
|
|
583
|
+
be populated by an earlier updateDataModel in the same response.
|
|
584
|
+
- updateDataModel has shape:
|
|
585
|
+
{ "version": "v0.9",
|
|
586
|
+
"updateDataModel": { "surfaceId": string, "path"?: string, "value"?: any } }
|
|
587
|
+
"path" defaults to "/" and "value" may be any JSON value.
|
|
576
588
|
- deleteSurface removes a surface when the UI is no longer needed.
|
|
577
589
|
|
|
578
590
|
## Component model
|
|
@@ -618,35 +630,57 @@ function buildHardRules(catalogId) {
|
|
|
618
630
|
1. Output MUST be a JSON ARRAY of A2UI messages. No prose, no Markdown, no
|
|
619
631
|
code fences, no XML. First character '[' – last character ']'.
|
|
620
632
|
2. Each element MUST include "version": "v0.9".
|
|
621
|
-
3.
|
|
633
|
+
3. Output pretty-printed JSON with 2-space indentation. Do NOT emit minified
|
|
634
|
+
single-line JSON. Put each message object and each component object on its
|
|
635
|
+
own lines so brackets and braces stay balanced.
|
|
636
|
+
4. Before finishing, check the final characters: every component object closes
|
|
637
|
+
once, every "components" array closes once, every message object closes
|
|
638
|
+
once, and the outer array closes exactly once.
|
|
639
|
+
5. For a fresh non-action response, the first message MUST be createSurface with
|
|
622
640
|
catalogId = "${catalogId}". Use surfaceId "main" unless the user specifies
|
|
623
641
|
otherwise.
|
|
624
|
-
|
|
625
|
-
updateComponents
|
|
626
|
-
|
|
627
|
-
|
|
642
|
+
6. For "{path:...}" bindings, send updateDataModel before the first
|
|
643
|
+
updateComponents message that contains components reading those paths. After
|
|
644
|
+
createSurface, either send a literal root/skeleton updateComponents first, or
|
|
645
|
+
send updateDataModel first when the first visible components use bindings.
|
|
646
|
+
7. For a fresh non-action response, the first updateComponents message MUST
|
|
647
|
+
contain exactly one component with id "root".
|
|
648
|
+
8. Use property-based component discriminators: "component": "Text", not
|
|
628
649
|
wrapper objects such as { "Text": {...} }.
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
14.
|
|
650
|
+
9. Children are referenced by id only. NEVER inline a child component.
|
|
651
|
+
10. Container references MUST point to components present in the same response.
|
|
652
|
+
11. Card.child is exactly one id; wrap multiple elements in Row/Column/List.
|
|
653
|
+
12. Buttons MUST include a dispatchable "action": either non-empty
|
|
654
|
+
"action.event.name" or non-empty "action.functionCall.call". Button has NO
|
|
655
|
+
"label" prop – provide the label via a child Text component
|
|
656
|
+
("child": "<text-id>").
|
|
657
|
+
13. When using Modal for a confirmation flow, do NOT put the server action on
|
|
658
|
+
the Modal trigger. The trigger only opens the modal. Put a separate confirm
|
|
659
|
+
Button inside Modal.content, and attach the action to that confirm Button.
|
|
660
|
+
14. Render a Modal by placing the Modal component itself where the trigger
|
|
661
|
+
should appear. Do NOT also list the trigger component as a sibling in the
|
|
662
|
+
parent container, because Modal renders its trigger internally.
|
|
663
|
+
15. The "weight" prop is only a small Row/Column child layout ratio, not CSS
|
|
664
|
+
font-weight. Do NOT use values like 400, 500, 600, or 700 for typography.
|
|
665
|
+
Use Text.variant for base typography and Text.emphasis ("medium" or
|
|
666
|
+
"strong") for extra text emphasis.
|
|
667
|
+
16. Ids are kebab-case, unique per surface ("root", "title-text", "submit-btn").
|
|
668
|
+
17. Do not invent components outside the catalog.
|
|
669
|
+
18. No comments, trailing commas or unknown fields.
|
|
670
|
+
19. If the user asks for impossible, unsafe, or unsupported UI, render a concise
|
|
640
671
|
explanatory A2UI surface using supported components rather than prose.
|
|
641
|
-
|
|
672
|
+
20. If the latest user message starts with "A2UI_USER_ACTION:", this is an
|
|
642
673
|
action response for an existing surface. Return a non-empty JSON array with
|
|
643
674
|
updateDataModel and/or updateComponents for that same surfaceId. Do NOT
|
|
644
675
|
return [] and do NOT create a new surface unless the action explicitly asks
|
|
645
676
|
to replace the whole UI.
|
|
646
|
-
|
|
677
|
+
21. For action responses, prefer the smallest valid patch: one updateDataModel
|
|
678
|
+
for changed data, plus one updateComponents only if the visible structure
|
|
679
|
+
needs to change.
|
|
680
|
+
22. For UI that should change after a button tap, keep the initial response in
|
|
647
681
|
the pre-action state. Put confirmation, success, or result details in the
|
|
648
682
|
action response instead of showing them before the action happens.
|
|
649
|
-
|
|
683
|
+
23. For Image.url, provide a short English image search query such as
|
|
650
684
|
"fresh pasta on a table" or "city skyline at night". Do NOT invent photo
|
|
651
685
|
CDN URLs. The server resolves Image.url values through its image provider.
|
|
652
686
|
`;
|
|
@@ -686,17 +720,17 @@ function buildA2UISystemPrompt(opts = {}) {
|
|
|
686
720
|
}
|
|
687
721
|
const A2UI_SYSTEM_PROMPT = buildA2UISystemPrompt();
|
|
688
722
|
function readA2UICatalogFromDirectory(options) {
|
|
689
|
-
const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
|
|
690
|
-
const catalogDir = resolve(cwd, options.catalogDir);
|
|
691
|
-
if (!existsSync(catalogDir)) throw new Error(`[a2ui-prompt] Catalog directory does not exist: ${options.catalogDir}`);
|
|
692
|
-
if (!statSync(catalogDir).isDirectory()) throw new Error(`[a2ui-prompt] Catalog path is not a directory: ${options.catalogDir}`);
|
|
723
|
+
const cwd = options.cwd ? __rspack_external_node_path_c5b9b54f.resolve(options.cwd) : process.cwd();
|
|
724
|
+
const catalogDir = __rspack_external_node_path_c5b9b54f.resolve(cwd, options.catalogDir);
|
|
725
|
+
if (!__rspack_external_node_fs_5ea92f0c.existsSync(catalogDir)) throw new Error(`[a2ui-prompt] Catalog directory does not exist: ${options.catalogDir}`);
|
|
726
|
+
if (!__rspack_external_node_fs_5ea92f0c.statSync(catalogDir).isDirectory()) throw new Error(`[a2ui-prompt] Catalog path is not a directory: ${options.catalogDir}`);
|
|
693
727
|
const componentManifests = [];
|
|
694
|
-
for (const entry of readdirSync(catalogDir, {
|
|
728
|
+
for (const entry of __rspack_external_node_fs_5ea92f0c.readdirSync(catalogDir, {
|
|
695
729
|
withFileTypes: true
|
|
696
730
|
})){
|
|
697
731
|
if (!entry.isDirectory() || 'functions' === entry.name) continue;
|
|
698
|
-
const catalogJsonPath = join(catalogDir, entry.name, 'catalog.json');
|
|
699
|
-
if (existsSync(catalogJsonPath)) componentManifests.push(readCatalogManifest(catalogJsonPath));
|
|
732
|
+
const catalogJsonPath = __rspack_external_node_path_c5b9b54f.join(catalogDir, entry.name, 'catalog.json');
|
|
733
|
+
if (__rspack_external_node_fs_5ea92f0c.existsSync(catalogJsonPath)) componentManifests.push(readCatalogManifest(catalogJsonPath));
|
|
700
734
|
}
|
|
701
735
|
if (0 === componentManifests.length) throw new Error(`[a2ui-prompt] No component catalog files found in ${options.catalogDir}. Expected files like <Component>/catalog.json. Run "genui a2ui generate catalog" first or pass --catalog-dir to the generated catalog directory.`);
|
|
702
736
|
return createA2UICatalogFromManifests({
|
|
@@ -712,15 +746,15 @@ function readA2UICatalogFromDirectory(options) {
|
|
|
712
746
|
});
|
|
713
747
|
}
|
|
714
748
|
function readFunctionDefinitions(catalogDir) {
|
|
715
|
-
const functionsDir = join(catalogDir, 'functions');
|
|
716
|
-
if (!existsSync(functionsDir)) return [];
|
|
717
|
-
if (!statSync(functionsDir).isDirectory()) throw new Error(`[a2ui-prompt] Expected functions directory at ${functionsDir}.`);
|
|
749
|
+
const functionsDir = __rspack_external_node_path_c5b9b54f.join(catalogDir, 'functions');
|
|
750
|
+
if (!__rspack_external_node_fs_5ea92f0c.existsSync(functionsDir)) return [];
|
|
751
|
+
if (!__rspack_external_node_fs_5ea92f0c.statSync(functionsDir).isDirectory()) throw new Error(`[a2ui-prompt] Expected functions directory at ${functionsDir}.`);
|
|
718
752
|
const functions = [];
|
|
719
|
-
for (const entry of readdirSync(functionsDir, {
|
|
753
|
+
for (const entry of __rspack_external_node_fs_5ea92f0c.readdirSync(functionsDir, {
|
|
720
754
|
withFileTypes: true
|
|
721
755
|
})){
|
|
722
756
|
if (!entry.isFile() || !entry.name.endsWith('.json')) continue;
|
|
723
|
-
const functionRecord = readJsonObject(join(functionsDir, entry.name));
|
|
757
|
+
const functionRecord = readJsonObject(__rspack_external_node_path_c5b9b54f.join(functionsDir, entry.name));
|
|
724
758
|
for (const [name, value] of Object.entries(functionRecord)){
|
|
725
759
|
if (!src_isRecord(value)) continue;
|
|
726
760
|
const description = value["description"];
|
|
@@ -743,7 +777,7 @@ function readFunctionDefinitions(catalogDir) {
|
|
|
743
777
|
return functions.sort((left, right)=>left.name.localeCompare(right.name));
|
|
744
778
|
}
|
|
745
779
|
function readJsonObject(filePath) {
|
|
746
|
-
const value = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
780
|
+
const value = JSON.parse(__rspack_external_node_fs_5ea92f0c.readFileSync(filePath, 'utf8'));
|
|
747
781
|
if (!src_isRecord(value)) throw new Error(`[a2ui-prompt] Expected JSON object in ${filePath}.`);
|
|
748
782
|
return value;
|
|
749
783
|
}
|
package/cli/bin/cli.js
CHANGED
|
@@ -266,6 +266,9 @@ function printPackageVersion() {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
function isMain(moduleUrl) {
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
if (process.argv[1] === undefined) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return moduleUrl === pathToFileURL(fs.realpathSync(process.argv[1])).href;
|
|
271
274
|
}
|