@lynx-js/genui 0.0.1 → 0.0.3
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/{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/index.jsx +98 -0
- package/a2ui/dist/catalog/ChoicePicker/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Column/{index.js → index.jsx} +10 -7
- package/a2ui/dist/catalog/Column/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/DateTimeInput/index.jsx +249 -0
- package/a2ui/dist/catalog/DateTimeInput/index.jsx.map +1 -0
- 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/index.jsx +7 -0
- package/a2ui/dist/catalog/Divider/index.jsx.map +1 -0
- package/a2ui/dist/catalog/Icon/{index.js → index.jsx} +4 -3
- package/a2ui/dist/catalog/Icon/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/Image/{index.js → index.jsx} +2 -3
- package/a2ui/dist/catalog/Image/{index.js.map → index.jsx.map} +1 -1
- package/a2ui/dist/catalog/LineChart/{index.js → index.jsx} +50 -13
- 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/Loading/catalog.json +15 -0
- package/a2ui/dist/catalog/Loading/index.d.ts +10 -0
- package/a2ui/dist/catalog/Loading/index.jsx +11 -0
- package/a2ui/dist/catalog/Loading/index.jsx.map +1 -0
- 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/defineCatalog.d.ts +0 -4
- package/a2ui/dist/catalog/defineCatalog.js.map +1 -1
- package/a2ui/dist/catalog/index.d.ts +20 -19
- package/a2ui/dist/catalog/index.js +41 -21
- package/a2ui/dist/catalog/index.js.map +1 -1
- package/a2ui/dist/catalog.json +2548 -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 +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.js → A2UIRenderer.jsx} +32 -32
- 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/tsconfig.build.tsbuildinfo +1 -1
- package/a2ui/docs/catalog-guide.md +401 -0
- package/a2ui/docs/catalog-guide_zh.md +373 -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 +51 -0
- package/a2ui/src/catalog/readme_zh.md +11 -0
- package/a2ui/src/index.ts +115 -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/styles/catalog/Modal.css +1 -0
- package/a2ui/styles/catalog/Text.css +2 -6
- 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 +9 -2
- package/a2ui-catalog-extractor/dist/index.js +52 -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 +2 -0
- package/a2ui-prompt/dist/index.js +259 -184
- 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/tsconfig.build.tsbuildinfo +1 -1
- 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 +17 -7
- package/openui/dist/core/{context.js → context.jsx} +8 -2
- package/openui/dist/core/context.jsx.map +1 -0
- package/openui/dist/core/createLibrary.d.ts +1 -1
- package/openui/dist/core/{createLibrary.js → createLibrary.jsx} +14 -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/useOpenUIState.d.ts +2 -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.js +1 -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.js → library.jsx} +1 -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 +31 -4
- package/openui/dist/core/renderer.jsx +281 -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/package.json +18 -8
- 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/ChoicePicker/index.js +0 -66
- package/a2ui/dist/catalog/ChoicePicker/index.js.map +0 -1
- package/a2ui/dist/catalog/DateTimeInput/index.js +0 -147
- package/a2ui/dist/catalog/DateTimeInput/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/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/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,88 @@
|
|
|
1
|
+
.page {
|
|
2
|
+
width: 100%;
|
|
3
|
+
min-height: 100vh;
|
|
4
|
+
padding: 10px 12px 16px;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.Background {
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: -50%;
|
|
14
|
+
left: -50%;
|
|
15
|
+
width: 200%;
|
|
16
|
+
height: 200%;
|
|
17
|
+
background:
|
|
18
|
+
radial-gradient(
|
|
19
|
+
circle at 30% 20%,
|
|
20
|
+
rgba(120, 80, 200, 0.3) 0%,
|
|
21
|
+
transparent 50%
|
|
22
|
+
),
|
|
23
|
+
radial-gradient(
|
|
24
|
+
circle at 70% 80%,
|
|
25
|
+
rgba(80, 120, 200, 0.3) 0%,
|
|
26
|
+
transparent 50%
|
|
27
|
+
),
|
|
28
|
+
radial-gradient(
|
|
29
|
+
circle at 50% 50%,
|
|
30
|
+
rgba(200, 80, 120, 0.2) 0%,
|
|
31
|
+
transparent 70%
|
|
32
|
+
);
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.A2UIApp {
|
|
37
|
+
min-height: 100vh;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
position: relative;
|
|
41
|
+
z-index: 10;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.AppContent {
|
|
45
|
+
flex: 1;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
padding: 40px 20px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.WelcomeScreen {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
gap: 20px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.Title {
|
|
62
|
+
font-size: 42px;
|
|
63
|
+
font-weight: 800;
|
|
64
|
+
color: #a5b4fc;
|
|
65
|
+
margin-bottom: 8px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.Subtitle {
|
|
69
|
+
font-size: 16px;
|
|
70
|
+
font-weight: 400;
|
|
71
|
+
color: rgba(255, 255, 255, 0.6);
|
|
72
|
+
letter-spacing: 2px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.StartButton {
|
|
76
|
+
margin-top: 40px;
|
|
77
|
+
padding: 18px 56px;
|
|
78
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
79
|
+
border-radius: 50px;
|
|
80
|
+
box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.ButtonText {
|
|
84
|
+
color: #fff;
|
|
85
|
+
font-size: 18px;
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
letter-spacing: 1px;
|
|
88
|
+
}
|
|
@@ -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
|
+
}
|