@lynx-js/genui 0.0.2 → 0.0.4
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/README.md +5 -9
- package/a2ui/AGENTS.md +167 -0
- package/a2ui/README.md +76 -780
- package/a2ui/README_zh.md +103 -0
- package/a2ui/dist/catalog/Button/catalog.json +2 -1
- package/a2ui/dist/catalog/Button/index.d.ts +5 -0
- package/a2ui/dist/catalog/Button/index.jsx +3 -0
- package/a2ui/dist/catalog/Button/index.jsx.map +1 -1
- package/a2ui/dist/catalog/Card/catalog.json +2 -1
- package/a2ui/dist/catalog/Card/index.d.ts +5 -0
- package/a2ui/dist/catalog/Card/index.jsx +3 -0
- package/a2ui/dist/catalog/Card/index.jsx.map +1 -1
- package/a2ui/dist/catalog/CheckBox/catalog.json +2 -1
- package/a2ui/dist/catalog/CheckBox/index.d.ts +5 -0
- package/a2ui/dist/catalog/CheckBox/index.jsx +3 -0
- package/a2ui/dist/catalog/CheckBox/index.jsx.map +1 -1
- package/a2ui/dist/catalog/ChoicePicker/catalog.json +2 -1
- package/a2ui/dist/catalog/ChoicePicker/index.d.ts +5 -0
- package/a2ui/dist/catalog/ChoicePicker/index.jsx +3 -0
- package/a2ui/dist/catalog/ChoicePicker/index.jsx.map +1 -1
- package/a2ui/dist/catalog/Column/catalog.json +2 -1
- package/a2ui/dist/catalog/Column/index.d.ts +5 -0
- package/a2ui/dist/catalog/Column/index.jsx +3 -0
- package/a2ui/dist/catalog/Column/index.jsx.map +1 -1
- package/a2ui/dist/catalog/DateTimeInput/catalog.json +2 -1
- package/a2ui/dist/catalog/DateTimeInput/index.d.ts +5 -0
- package/a2ui/dist/catalog/DateTimeInput/index.jsx +4 -10
- package/a2ui/dist/catalog/DateTimeInput/index.jsx.map +1 -1
- package/a2ui/dist/catalog/DateTimeInput/utils.d.ts +0 -1
- package/a2ui/dist/catalog/DateTimeInput/utils.js +0 -3
- package/a2ui/dist/catalog/DateTimeInput/utils.js.map +1 -1
- package/a2ui/dist/catalog/Divider/catalog.json +2 -1
- package/a2ui/dist/catalog/Divider/index.d.ts +5 -0
- package/a2ui/dist/catalog/Divider/index.jsx +3 -0
- package/a2ui/dist/catalog/Divider/index.jsx.map +1 -1
- package/a2ui/dist/catalog/Icon/catalog.json +2 -1
- package/a2ui/dist/catalog/Icon/index.d.ts +5 -0
- package/a2ui/dist/catalog/Icon/index.jsx +3 -0
- package/a2ui/dist/catalog/Icon/index.jsx.map +1 -1
- package/a2ui/dist/catalog/Image/catalog.json +2 -1
- package/a2ui/dist/catalog/Image/index.d.ts +5 -0
- package/a2ui/dist/catalog/Image/index.jsx +3 -0
- package/a2ui/dist/catalog/Image/index.jsx.map +1 -1
- package/a2ui/dist/catalog/LazyComponent/catalog.json +37 -0
- package/a2ui/dist/catalog/LazyComponent/index.d.ts +27 -0
- package/a2ui/dist/catalog/LazyComponent/index.jsx +39 -0
- package/a2ui/dist/catalog/LazyComponent/index.jsx.map +1 -0
- package/a2ui/dist/catalog/LineChart/catalog.json +2 -1
- package/a2ui/dist/catalog/LineChart/index.d.ts +8 -0
- package/a2ui/dist/catalog/LineChart/index.jsx +3 -0
- package/a2ui/dist/catalog/LineChart/index.jsx.map +1 -1
- package/a2ui/dist/catalog/List/catalog.json +2 -1
- package/a2ui/dist/catalog/List/index.d.ts +5 -0
- package/a2ui/dist/catalog/List/index.jsx +3 -0
- package/a2ui/dist/catalog/List/index.jsx.map +1 -1
- package/a2ui/dist/catalog/Loading/catalog.json +16 -0
- package/a2ui/dist/catalog/Loading/index.d.ts +15 -0
- package/a2ui/dist/catalog/Loading/index.jsx +14 -0
- package/a2ui/dist/catalog/Loading/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Modal/catalog.json +2 -1
- package/a2ui/dist/catalog/Modal/index.d.ts +5 -0
- package/a2ui/dist/catalog/Modal/index.jsx +3 -0
- package/a2ui/dist/catalog/Modal/index.jsx.map +1 -1
- package/a2ui/dist/catalog/PieChart/catalog.json +2 -1
- package/a2ui/dist/catalog/PieChart/index.d.ts +8 -0
- package/a2ui/dist/catalog/PieChart/index.jsx +3 -0
- package/a2ui/dist/catalog/PieChart/index.jsx.map +1 -1
- package/a2ui/dist/catalog/RadioGroup/catalog.json +2 -1
- package/a2ui/dist/catalog/RadioGroup/index.d.ts +5 -0
- package/a2ui/dist/catalog/RadioGroup/index.jsx +3 -0
- package/a2ui/dist/catalog/RadioGroup/index.jsx.map +1 -1
- package/a2ui/dist/catalog/Row/catalog.json +2 -1
- package/a2ui/dist/catalog/Row/index.d.ts +5 -0
- package/a2ui/dist/catalog/Row/index.jsx +3 -0
- package/a2ui/dist/catalog/Row/index.jsx.map +1 -1
- package/a2ui/dist/catalog/Slider/catalog.json +2 -1
- package/a2ui/dist/catalog/Slider/index.d.ts +5 -0
- package/a2ui/dist/catalog/Slider/index.jsx +3 -0
- package/a2ui/dist/catalog/Slider/index.jsx.map +1 -1
- package/a2ui/dist/catalog/Tabs/catalog.json +2 -1
- package/a2ui/dist/catalog/Tabs/index.d.ts +5 -0
- package/a2ui/dist/catalog/Tabs/index.jsx +3 -0
- package/a2ui/dist/catalog/Tabs/index.jsx.map +1 -1
- package/a2ui/dist/catalog/Text/catalog.json +2 -1
- package/a2ui/dist/catalog/Text/index.d.ts +5 -0
- package/a2ui/dist/catalog/Text/index.jsx +3 -0
- package/a2ui/dist/catalog/Text/index.jsx.map +1 -1
- package/a2ui/dist/catalog/TextField/catalog.json +2 -1
- package/a2ui/dist/catalog/TextField/index.d.ts +5 -0
- package/a2ui/dist/catalog/TextField/index.jsx +3 -0
- package/a2ui/dist/catalog/TextField/index.jsx.map +1 -1
- package/a2ui/dist/catalog/defineCatalog.d.ts +4 -4
- package/a2ui/dist/catalog/defineCatalog.js.map +1 -1
- package/a2ui/dist/catalog/index.d.ts +2 -0
- package/a2ui/dist/catalog/index.js +92 -18
- package/a2ui/dist/catalog/index.js.map +1 -1
- package/a2ui/dist/catalog.json +2603 -0
- package/a2ui/dist/index.d.ts +1 -1
- package/a2ui/dist/index.js +2 -2
- package/a2ui/dist/index.js.map +1 -1
- package/a2ui/dist/react/A2UI.d.ts +3 -0
- package/a2ui/dist/react/A2UI.jsx.map +1 -1
- package/a2ui/dist/react/A2UIRenderer.d.ts +5 -18
- package/a2ui/dist/react/A2UIRenderer.jsx +3 -13
- package/a2ui/dist/react/A2UIRenderer.jsx.map +1 -1
- package/a2ui/dist/react/useAction.d.ts +7 -0
- package/a2ui/dist/react/useAction.js +4 -0
- package/a2ui/dist/react/useAction.js.map +1 -1
- package/a2ui/dist/react/useDataBinding.d.ts +7 -5
- package/a2ui/dist/react/useDataBinding.js +18 -0
- package/a2ui/dist/react/useDataBinding.js.map +1 -1
- package/a2ui/dist/store/FunctionRegistry.d.ts +7 -0
- package/a2ui/dist/store/FunctionRegistry.js +4 -0
- package/a2ui/dist/store/FunctionRegistry.js.map +1 -1
- package/a2ui/dist/store/MessageProcessor.d.ts +7 -0
- package/a2ui/dist/store/MessageProcessor.js +4 -0
- package/a2ui/dist/store/MessageProcessor.js.map +1 -1
- package/a2ui/dist/store/MessageStore.d.ts +6 -0
- package/a2ui/dist/store/MessageStore.js +3 -0
- package/a2ui/dist/store/MessageStore.js.map +1 -1
- package/a2ui/dist/store/Resource.d.ts +8 -0
- package/a2ui/dist/store/Resource.js +4 -0
- package/a2ui/dist/store/Resource.js.map +1 -1
- package/a2ui/dist/store/SignalStore.d.ts +3 -2
- package/a2ui/dist/store/SignalStore.js +9 -0
- package/a2ui/dist/store/SignalStore.js.map +1 -1
- package/a2ui/dist/store/resolveDynamic.d.ts +4 -3
- package/a2ui/dist/store/resolveDynamic.js +19 -0
- package/a2ui/dist/store/resolveDynamic.js.map +1 -1
- package/a2ui/dist/store/resolveFunctionCall.d.ts +7 -0
- package/a2ui/dist/store/resolveFunctionCall.js +4 -0
- package/a2ui/dist/store/resolveFunctionCall.js.map +1 -1
- package/a2ui/dist/store/types.d.ts +13 -0
- package/a2ui/dist/store/utils.d.ts +6 -4
- package/a2ui/dist/store/utils.js +26 -0
- package/a2ui/dist/store/utils.js.map +1 -1
- package/a2ui/dist/tsconfig.build.tsbuildinfo +1 -1
- package/a2ui/docs/catalog-guide.md +407 -0
- package/a2ui/docs/catalog-guide_zh.md +379 -0
- package/a2ui/docs/overview.md +312 -0
- package/a2ui/docs/overview_zh.md +289 -0
- package/a2ui/docs/system-prompts.md +187 -0
- package/a2ui/docs/system-prompts_zh.md +187 -0
- package/a2ui/src/catalog/README.md +12 -0
- package/a2ui/src/catalog/index.ts +52 -0
- package/a2ui/src/catalog/readme_zh.md +11 -0
- package/a2ui/src/index.ts +116 -0
- package/a2ui/styles/catalog/Button.css +5 -5
- package/a2ui/styles/catalog/DateTimeInput.css +22 -30
- package/a2ui/styles/catalog/Loading.css +61 -0
- package/a2ui-catalog-extractor/README.md +14 -7
- package/a2ui-catalog-extractor/dist/cli.d.ts +1 -0
- package/a2ui-catalog-extractor/dist/cli.js +15 -6
- package/a2ui-catalog-extractor/dist/cli.js.map +1 -1
- package/a2ui-catalog-extractor/dist/index.d.ts +97 -2
- package/a2ui-catalog-extractor/dist/index.js +91 -6
- package/a2ui-catalog-extractor/dist/index.js.map +1 -1
- package/a2ui-catalog-extractor/dist/tsconfig.build.tsbuildinfo +1 -1
- package/a2ui-catalog-extractor/skills/a2ui-catalog-extractor/SKILL.md +1 -1
- package/a2ui-prompt/README.md +3 -2
- package/a2ui-prompt/dist/index.d.ts +41 -0
- package/a2ui-prompt/dist/index.js +159 -84
- package/cli/README.md +26 -0
- package/cli/bin/cli.js +7 -265
- package/cli/dist/a2ui/create.d.ts +5 -0
- package/cli/dist/a2ui/create.js +178 -0
- package/cli/dist/a2ui/create.js.map +1 -0
- package/cli/dist/a2ui/index.d.ts +5 -0
- package/cli/dist/a2ui/index.js +170 -0
- package/cli/dist/a2ui/index.js.map +1 -0
- package/cli/dist/cli.d.ts +4 -0
- package/cli/dist/cli.js +40 -0
- package/cli/dist/cli.js.map +1 -0
- package/cli/dist/openui.d.ts +1 -0
- package/cli/dist/openui.js +21 -0
- package/cli/dist/openui.js.map +1 -0
- package/cli/dist/tsconfig.build.tsbuildinfo +1 -0
- package/cli/dist/utils.d.ts +2 -0
- package/cli/dist/utils.js +17 -0
- package/cli/dist/utils.js.map +1 -0
- package/cli/templates/default/lynx.config.ts +13 -0
- package/cli/templates/default/package.json +27 -0
- package/cli/templates/default/src/App.css +88 -0
- package/cli/templates/default/src/App.tsx +100 -0
- package/cli/templates/default/src/index.tsx +10 -0
- package/cli/templates/default/src/messages.ts +158 -0
- package/cli/templates/default/src/rspeedy-env.d.ts +14 -0
- package/cli/templates/default/src/tsconfig.json +17 -0
- package/cli/templates/default/tsconfig.json +15 -0
- package/cli/templates/default/tsconfig.node.json +16 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/index.ts +12 -0
- package/openui/README.md +50 -46
- package/openui/dist/catalog/Action/{index.js → index.jsx} +1 -1
- package/openui/dist/catalog/Action/index.jsx.map +1 -0
- package/openui/dist/catalog/Button/index.d.ts +8 -8
- package/openui/dist/catalog/Button/{index.js → index.jsx} +28 -14
- package/openui/dist/catalog/Button/index.jsx.map +1 -0
- package/openui/dist/catalog/Card/index.d.ts +1 -1
- package/openui/dist/catalog/Card/{index.js → index.jsx} +5 -4
- package/openui/dist/catalog/Card/{index.js.map → index.jsx.map} +1 -1
- package/openui/dist/catalog/CardHeader/index.d.ts +1 -1
- package/openui/dist/catalog/CardHeader/index.jsx +20 -0
- package/openui/dist/catalog/CardHeader/index.jsx.map +1 -0
- package/openui/dist/catalog/CheckBox/index.d.ts +16 -0
- package/openui/dist/catalog/CheckBox/index.jsx +82 -0
- package/openui/dist/catalog/CheckBox/index.jsx.map +1 -0
- package/openui/dist/catalog/Icon/index.d.ts +44 -0
- package/openui/dist/catalog/Icon/index.jsx +66 -0
- package/openui/dist/catalog/Icon/index.jsx.map +1 -0
- package/openui/dist/catalog/Image/index.d.ts +19 -0
- package/openui/dist/catalog/Image/index.jsx +40 -0
- package/openui/dist/catalog/Image/index.jsx.map +1 -0
- package/openui/dist/catalog/Loading/index.d.ts +7 -0
- package/openui/dist/catalog/Loading/index.jsx +25 -0
- package/openui/dist/catalog/Loading/index.jsx.map +1 -0
- package/openui/dist/catalog/RadioGroup/index.d.ts +21 -0
- package/openui/dist/catalog/RadioGroup/index.jsx +99 -0
- package/openui/dist/catalog/RadioGroup/index.jsx.map +1 -0
- package/openui/dist/catalog/Separator/index.d.ts +1 -1
- package/openui/dist/catalog/Separator/{index.js → index.jsx} +3 -4
- package/openui/dist/catalog/Separator/index.jsx.map +1 -0
- package/openui/dist/catalog/Slider/index.d.ts +19 -0
- package/openui/dist/catalog/Slider/index.jsx +139 -0
- package/openui/dist/catalog/Slider/index.jsx.map +1 -0
- package/openui/dist/catalog/Stack/index.d.ts +1 -1
- package/openui/dist/catalog/Stack/{index.js → index.jsx} +3 -4
- package/openui/dist/catalog/Stack/{index.js.map → index.jsx.map} +1 -1
- package/openui/dist/catalog/Tag/index.d.ts +1 -1
- package/openui/dist/catalog/Tag/{index.js → index.jsx} +5 -4
- package/openui/dist/catalog/Tag/index.jsx.map +1 -0
- package/openui/dist/catalog/TextContent/index.d.ts +1 -1
- package/openui/dist/catalog/TextContent/{index.js → index.jsx} +5 -4
- package/openui/dist/catalog/TextContent/{index.js.map → index.jsx.map} +1 -1
- package/openui/dist/catalog/TextField/index.d.ts +23 -0
- package/openui/dist/catalog/TextField/index.jsx +132 -0
- package/openui/dist/catalog/TextField/index.jsx.map +1 -0
- package/openui/dist/catalog/index.d.ts +14 -7
- package/openui/dist/catalog/index.js +14 -7
- package/openui/dist/catalog/index.js.map +1 -1
- package/openui/dist/core/context.d.ts +22 -8
- package/openui/dist/core/{context.js → context.jsx} +10 -3
- package/openui/dist/core/context.jsx.map +1 -0
- package/openui/dist/core/createLibrary.d.ts +8 -1
- package/openui/dist/core/{createLibrary.js → createLibrary.jsx} +18 -3
- package/openui/dist/core/createLibrary.jsx.map +1 -0
- package/openui/dist/core/hooks/index.d.ts +1 -0
- package/openui/dist/core/hooks/index.js +1 -0
- package/openui/dist/core/hooks/index.js.map +1 -1
- package/openui/dist/core/hooks/useFormValidation.d.ts +9 -0
- package/openui/dist/core/hooks/useFormValidation.js +6 -0
- package/openui/dist/core/hooks/useFormValidation.js.map +1 -1
- package/openui/dist/core/hooks/useOpenUIState.d.ts +8 -2
- package/openui/dist/core/hooks/useOpenUIState.js +3 -1
- package/openui/dist/core/hooks/useOpenUIState.js.map +1 -1
- package/openui/dist/core/hooks/useStateField.d.ts +3 -0
- package/openui/dist/core/hooks/useStateField.js +4 -1
- package/openui/dist/core/hooks/useStateField.js.map +1 -1
- package/openui/dist/core/index.d.ts +13 -7
- package/openui/dist/core/index.js +7 -4
- package/openui/dist/core/index.js.map +1 -1
- package/openui/dist/core/library.d.ts +6 -1
- package/openui/dist/core/{library.js → library.jsx} +9 -1
- package/openui/dist/core/library.jsx.map +1 -0
- package/openui/dist/core/renderer.css +527 -0
- package/openui/dist/core/renderer.d.ts +41 -4
- package/openui/dist/core/renderer.jsx +284 -0
- package/openui/dist/core/renderer.jsx.map +1 -0
- package/openui/dist/core/runtime/index.d.ts +1 -0
- package/openui/dist/core/runtime/index.js +5 -0
- package/openui/dist/core/runtime/index.js.map +1 -0
- package/openui/dist/core/runtime/reactive.d.ts +7 -0
- package/openui/dist/core/runtime/reactive.js +10 -0
- package/openui/dist/core/runtime/reactive.js.map +1 -0
- package/openui/dist/openui-prompt/index.d.ts +47 -0
- package/openui/dist/openui-prompt/index.js +321 -0
- package/openui/dist/openui-prompt/index.js.map +1 -0
- package/package.json +20 -8
- package/openui/dist/catalog/Action/index.js.map +0 -1
- package/openui/dist/catalog/Button/index.js.map +0 -1
- package/openui/dist/catalog/CardHeader/index.js +0 -18
- package/openui/dist/catalog/CardHeader/index.js.map +0 -1
- package/openui/dist/catalog/Separator/index.js.map +0 -1
- package/openui/dist/catalog/Tag/index.js.map +0 -1
- package/openui/dist/core/context.js.map +0 -1
- package/openui/dist/core/createLibrary.js.map +0 -1
- package/openui/dist/core/library.js.map +0 -1
- package/openui/dist/core/renderer.js +0 -139
- package/openui/dist/core/renderer.js.map +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useState, useCallback } from '@lynx-js/react';
|
|
2
|
+
import { A2UI, createMessageStore, defineCatalog } from '@lynx-js/genui/a2ui';
|
|
3
|
+
import {
|
|
4
|
+
catalogManifests,
|
|
5
|
+
Text,
|
|
6
|
+
Button,
|
|
7
|
+
Card,
|
|
8
|
+
Column,
|
|
9
|
+
Row,
|
|
10
|
+
Image,
|
|
11
|
+
type CatalogComponent,
|
|
12
|
+
} from '@lynx-js/genui/a2ui/catalog';
|
|
13
|
+
import type {
|
|
14
|
+
ServerToClientMessage,
|
|
15
|
+
UserActionPayload,
|
|
16
|
+
} from '@lynx-js/genui/a2ui';
|
|
17
|
+
import {
|
|
18
|
+
initialMessages,
|
|
19
|
+
secondStageMessages,
|
|
20
|
+
thirdStageMessages,
|
|
21
|
+
finalStageMessages,
|
|
22
|
+
buttonClickMessages,
|
|
23
|
+
} from './messages';
|
|
24
|
+
|
|
25
|
+
import './App.css';
|
|
26
|
+
|
|
27
|
+
const store = createMessageStore();
|
|
28
|
+
|
|
29
|
+
const ALL_BUILTINS = defineCatalog([
|
|
30
|
+
[Text as CatalogComponent, catalogManifests.Text],
|
|
31
|
+
[Button as CatalogComponent, catalogManifests.Button],
|
|
32
|
+
[Card as CatalogComponent, catalogManifests.Card],
|
|
33
|
+
[Column as CatalogComponent, catalogManifests.Column],
|
|
34
|
+
[Row as CatalogComponent, catalogManifests.Row],
|
|
35
|
+
[Image as CatalogComponent, catalogManifests.Image],
|
|
36
|
+
]).components;
|
|
37
|
+
|
|
38
|
+
const sleep = (ms: number) => {
|
|
39
|
+
return new Promise<void>((resolve) => {
|
|
40
|
+
setTimeout(resolve, ms);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export function App() {
|
|
45
|
+
const [showResponse, setShowResponse] = useState(false);
|
|
46
|
+
|
|
47
|
+
const streamMessages = useCallback(
|
|
48
|
+
async (messages: ServerToClientMessage[]) => {
|
|
49
|
+
for (const message of messages) {
|
|
50
|
+
store.push(message);
|
|
51
|
+
await sleep(1000);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
[],
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const startDemo = useCallback(async () => {
|
|
58
|
+
setShowResponse(true);
|
|
59
|
+
await streamMessages(initialMessages);
|
|
60
|
+
await streamMessages(secondStageMessages);
|
|
61
|
+
await streamMessages(thirdStageMessages);
|
|
62
|
+
await streamMessages(finalStageMessages);
|
|
63
|
+
}, [streamMessages]);
|
|
64
|
+
|
|
65
|
+
const handleAction = useCallback((action: UserActionPayload) => {
|
|
66
|
+
if (action?.name === 'button_click') {
|
|
67
|
+
buttonClickMessages.forEach(msg => {
|
|
68
|
+
store.push(msg);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<view className='A2UIApp'>
|
|
75
|
+
<view className='Background' />
|
|
76
|
+
<view className='AppContent'>
|
|
77
|
+
{!showResponse
|
|
78
|
+
? (
|
|
79
|
+
<view className='WelcomeScreen'>
|
|
80
|
+
<text className='Title'>A2UI Demo</text>
|
|
81
|
+
<text className='Subtitle'>ReactLynx GenUI</text>
|
|
82
|
+
<view className='StartButton' bindtap={startDemo}>
|
|
83
|
+
<text className='ButtonText'>Start Demo</text>
|
|
84
|
+
</view>
|
|
85
|
+
</view>
|
|
86
|
+
)
|
|
87
|
+
: (
|
|
88
|
+
<A2UI
|
|
89
|
+
messageStore={store}
|
|
90
|
+
catalogs={ALL_BUILTINS}
|
|
91
|
+
wrapSurface={(children) => (
|
|
92
|
+
<view className='A2UISurface'>{children}</view>
|
|
93
|
+
)}
|
|
94
|
+
onAction={handleAction}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
</view>
|
|
98
|
+
</view>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { ServerToClientMessage } from '@lynx-js/genui/a2ui';
|
|
2
|
+
|
|
3
|
+
export const initialMessages: ServerToClientMessage[] = [
|
|
4
|
+
{
|
|
5
|
+
version: 'v0.9',
|
|
6
|
+
createSurface: {
|
|
7
|
+
surfaceId: 'main',
|
|
8
|
+
catalogId: 'https://a2ui.org/specification/v0_9/basic_catalog.json',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
version: 'v0.9',
|
|
13
|
+
updateComponents: {
|
|
14
|
+
surfaceId: 'main',
|
|
15
|
+
components: [
|
|
16
|
+
{
|
|
17
|
+
id: 'root-card',
|
|
18
|
+
component: 'Card',
|
|
19
|
+
variant: 'elevated',
|
|
20
|
+
child: 'content-column',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'content-column',
|
|
24
|
+
component: 'Column',
|
|
25
|
+
children: [
|
|
26
|
+
'loading-text',
|
|
27
|
+
],
|
|
28
|
+
align: 'center',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'loading-text',
|
|
32
|
+
component: 'Text',
|
|
33
|
+
text: 'Loading...',
|
|
34
|
+
variant: 'body',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
export const secondStageMessages: ServerToClientMessage[] = [
|
|
42
|
+
{
|
|
43
|
+
version: 'v0.9',
|
|
44
|
+
updateComponents: {
|
|
45
|
+
surfaceId: 'main',
|
|
46
|
+
components: [
|
|
47
|
+
{
|
|
48
|
+
id: 'content-column',
|
|
49
|
+
component: 'Column',
|
|
50
|
+
children: [
|
|
51
|
+
'title-text',
|
|
52
|
+
'loading-text',
|
|
53
|
+
],
|
|
54
|
+
align: 'center',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'title-text',
|
|
58
|
+
component: 'Text',
|
|
59
|
+
text: 'Welcome to A2UI Demo',
|
|
60
|
+
variant: 'h1',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'loading-text',
|
|
64
|
+
component: 'Text',
|
|
65
|
+
text: 'Loading more content...',
|
|
66
|
+
variant: 'body',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
export const thirdStageMessages: ServerToClientMessage[] = [
|
|
74
|
+
{
|
|
75
|
+
version: 'v0.9',
|
|
76
|
+
updateComponents: {
|
|
77
|
+
surfaceId: 'main',
|
|
78
|
+
components: [
|
|
79
|
+
{
|
|
80
|
+
id: 'content-column',
|
|
81
|
+
component: 'Column',
|
|
82
|
+
children: [
|
|
83
|
+
'title-text',
|
|
84
|
+
'description-text',
|
|
85
|
+
'loading-text',
|
|
86
|
+
],
|
|
87
|
+
align: 'center',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'description-text',
|
|
91
|
+
component: 'Text',
|
|
92
|
+
text: 'This is a ReactLynx A2UI demonstration',
|
|
93
|
+
variant: 'body',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'loading-text',
|
|
97
|
+
component: 'Text',
|
|
98
|
+
text: 'Almost done...',
|
|
99
|
+
variant: 'body',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
export const finalStageMessages: ServerToClientMessage[] = [
|
|
107
|
+
{
|
|
108
|
+
version: 'v0.9',
|
|
109
|
+
updateComponents: {
|
|
110
|
+
surfaceId: 'main',
|
|
111
|
+
components: [
|
|
112
|
+
{
|
|
113
|
+
id: 'content-column',
|
|
114
|
+
component: 'Column',
|
|
115
|
+
children: [
|
|
116
|
+
'title-text',
|
|
117
|
+
'description-text',
|
|
118
|
+
'action-button',
|
|
119
|
+
],
|
|
120
|
+
align: 'center',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: 'action-button',
|
|
124
|
+
component: 'Button',
|
|
125
|
+
variant: 'primary',
|
|
126
|
+
child: 'button-text',
|
|
127
|
+
action: {
|
|
128
|
+
event: {
|
|
129
|
+
name: 'button_click',
|
|
130
|
+
context: { message: 'Hello from A2UI!' },
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: 'button-text',
|
|
136
|
+
component: 'Text',
|
|
137
|
+
text: 'Click Me',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
export const buttonClickMessages: ServerToClientMessage[] = [
|
|
145
|
+
{
|
|
146
|
+
version: 'v0.9',
|
|
147
|
+
updateComponents: {
|
|
148
|
+
surfaceId: 'main',
|
|
149
|
+
components: [
|
|
150
|
+
{
|
|
151
|
+
id: 'button-text',
|
|
152
|
+
component: 'Text',
|
|
153
|
+
text: 'Clicked!',
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="@lynx-js/rspeedy/client" />
|
|
2
|
+
|
|
3
|
+
declare module '@lynx-js/types' {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
5
|
+
interface GlobalProps {
|
|
6
|
+
/**
|
|
7
|
+
* Define your global properties in this interface.
|
|
8
|
+
* These types will be accessible through `lynx.__globalProps`.
|
|
9
|
+
*/
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// This export makes the file a module
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"jsxImportSource": "@lynx-js/react",
|
|
8
|
+
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"moduleResolution": "Bundler",
|
|
11
|
+
|
|
12
|
+
"lib": ["es2015"],
|
|
13
|
+
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
},
|
|
16
|
+
"include": ["./**/*.ts", "./**/*.tsx"],
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"isolatedModules": true,
|
|
5
|
+
"verbatimModuleSyntax": true,
|
|
6
|
+
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
},
|
|
10
|
+
"references": [
|
|
11
|
+
{ "path": "./tsconfig.node.json" },
|
|
12
|
+
{ "path": "./src" },
|
|
13
|
+
],
|
|
14
|
+
"files": [],
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
|
|
6
|
+
"module": "node16",
|
|
7
|
+
"moduleResolution": "node16",
|
|
8
|
+
"erasableSyntaxOnly": true,
|
|
9
|
+
|
|
10
|
+
"lib": ["es2023"],
|
|
11
|
+
"target": "es2022",
|
|
12
|
+
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
},
|
|
15
|
+
"include": ["./lynx.config.ts"],
|
|
16
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export { createFallbackMessagesFromPlainText, createMessageStore, createResource
|
|
|
4
4
|
export type { A2UIClientEventMessage, A2UIEvent, ComponentInstance, FunctionCallContext, FunctionEntry, FunctionImpl, GenericComponentProps, MessageStore, MessageStoreOptions, RawResource, ResolveFunctionOptions, Resource, ResourceInfo, ResourceStatus, ServerToClientMessage, Surface, SurfaceId, UserActionPayload, } from '@lynx-js/genui/a2ui/store';
|
|
5
5
|
export { basicFunctions, registerBasicFunctions, } from '@lynx-js/genui/a2ui/functions';
|
|
6
6
|
export * from '@lynx-js/genui/openui';
|
|
7
|
+
export { buildOpenUiSystemPrompt, createOpenUiPromptLibrary, OPENUI_SYSTEM_PROMPT, openUiPromptActionPropSchema, } from '@lynx-js/genui/openui/prompt';
|
|
8
|
+
export type { BuildOpenUiSystemPromptOptions, CreateOpenUiPromptLibraryOptions, OpenUiPromptComponent, OpenUiPromptLibrary, } from '@lynx-js/genui/openui/prompt';
|
|
7
9
|
export { A2UI_PROTOCOL_VERSION, A2UI_SYSTEM_PROMPT, BASIC_CATALOG, BASIC_CATALOG_EXAMPLES, BASIC_CATALOG_ID, buildA2UISystemPrompt, createA2UICatalogFromManifests, readA2UICatalogFromDirectory, renderCatalogReference, } from '@lynx-js/genui/a2ui-prompt';
|
|
8
10
|
export type { A2UICatalog as A2UIPromptCatalog, A2UIComponentProp, A2UIComponentSpec, A2UIExample, A2UIFunctionSpec, BuildSystemPromptOptions, JsonSchema as A2UIPromptJsonSchema, ReadA2UICatalogDirectoryOptions, } from '@lynx-js/genui/a2ui-prompt';
|
|
9
11
|
export { createA2UICatalog, extractCatalogComponents, extractCatalogComponentsFromTypeDocJson, extractCatalogComponentsFromTypeDocProject, extractCatalogFunctions, extractCatalogFunctionsFromTypeDocJson, extractCatalogFunctionsFromTypeDocProject, findCatalogSourceFiles, writeCatalogArtifacts, writeCatalogComponents, writeCatalogFunctionDefinitions, writeCatalogFunctions, writeComponentCatalogs, } from '@lynx-js/genui/a2ui-catalog-extractor';
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { A2UI, NodeRenderer, useAction, useChecks, useDataBinding, useResolvedPr
|
|
|
5
5
|
export { createFallbackMessagesFromPlainText, createMessageStore, createResource, createTextCardMessages, executeFunctionCall, FunctionRegistry, functionRegistry, isDataBinding, isFunctionCall, MessageProcessor, normalizePayloadToMessages, prepareMessagesForProcessing, resolveDynamicValue, resolveFunctionArguments, SignalStore, } from '@lynx-js/genui/a2ui/store';
|
|
6
6
|
export { basicFunctions, registerBasicFunctions, } from '@lynx-js/genui/a2ui/functions';
|
|
7
7
|
export * from '@lynx-js/genui/openui';
|
|
8
|
+
export { buildOpenUiSystemPrompt, createOpenUiPromptLibrary, OPENUI_SYSTEM_PROMPT, openUiPromptActionPropSchema, } from '@lynx-js/genui/openui/prompt';
|
|
8
9
|
export { A2UI_PROTOCOL_VERSION, A2UI_SYSTEM_PROMPT, BASIC_CATALOG, BASIC_CATALOG_EXAMPLES, BASIC_CATALOG_ID, buildA2UISystemPrompt, createA2UICatalogFromManifests, readA2UICatalogFromDirectory, renderCatalogReference, } from '@lynx-js/genui/a2ui-prompt';
|
|
9
10
|
export { createA2UICatalog, extractCatalogComponents, extractCatalogComponentsFromTypeDocJson, extractCatalogComponentsFromTypeDocProject, extractCatalogFunctions, extractCatalogFunctionsFromTypeDocJson, extractCatalogFunctionsFromTypeDocProject, findCatalogSourceFiles, writeCatalogArtifacts, writeCatalogComponents, writeCatalogFunctionDefinitions, writeCatalogFunctions, writeComponentCatalogs, } from '@lynx-js/genui/a2ui-catalog-extractor';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAMnC,OAAO,EACL,mCAAmC,EACnC,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,0BAA0B,EAC1B,4BAA4B,EAC5B,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,GACZ,MAAM,2BAA2B,CAAC;AAqBnC,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,8BAA8B,EAC9B,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAWpC,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,uCAAuC,EACvC,0CAA0C,EAC1C,uBAAuB,EACvB,sCAAsC,EACtC,yCAAyC,EACzC,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,+BAA+B,EAC/B,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAMnC,OAAO,EACL,mCAAmC,EACnC,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,0BAA0B,EAC1B,4BAA4B,EAC5B,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,GACZ,MAAM,2BAA2B,CAAC;AAqBnC,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,8BAA8B,EAC9B,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAWpC,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,uCAAuC,EACvC,0CAA0C,EAC1C,uBAAuB,EACvB,sCAAsC,EACtC,yCAAyC,EACzC,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,+BAA+B,EAC/B,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,uCAAuC,CAAC"}
|