@lynx-js/genui 0.0.2 → 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.
Files changed (168) hide show
  1. package/README.md +5 -9
  2. package/a2ui/AGENTS.md +167 -0
  3. package/a2ui/README.md +76 -780
  4. package/a2ui/README_zh.md +103 -0
  5. package/a2ui/dist/catalog/DateTimeInput/index.jsx +1 -10
  6. package/a2ui/dist/catalog/DateTimeInput/index.jsx.map +1 -1
  7. package/a2ui/dist/catalog/DateTimeInput/utils.d.ts +0 -1
  8. package/a2ui/dist/catalog/DateTimeInput/utils.js +0 -3
  9. package/a2ui/dist/catalog/DateTimeInput/utils.js.map +1 -1
  10. package/a2ui/dist/catalog/Loading/catalog.json +15 -0
  11. package/a2ui/dist/catalog/Loading/index.d.ts +10 -0
  12. package/a2ui/dist/catalog/Loading/index.jsx +11 -0
  13. package/a2ui/dist/catalog/Loading/index.jsx.map +1 -0
  14. package/a2ui/dist/catalog/defineCatalog.d.ts +0 -4
  15. package/a2ui/dist/catalog/defineCatalog.js.map +1 -1
  16. package/a2ui/dist/catalog/index.d.ts +1 -0
  17. package/a2ui/dist/catalog/index.js +16 -0
  18. package/a2ui/dist/catalog/index.js.map +1 -1
  19. package/a2ui/dist/catalog.json +2548 -0
  20. package/a2ui/dist/index.d.ts +1 -1
  21. package/a2ui/dist/index.js +2 -2
  22. package/a2ui/dist/index.js.map +1 -1
  23. package/a2ui/dist/react/A2UIRenderer.jsx +3 -13
  24. package/a2ui/dist/react/A2UIRenderer.jsx.map +1 -1
  25. package/a2ui/dist/tsconfig.build.tsbuildinfo +1 -1
  26. package/a2ui/docs/catalog-guide.md +401 -0
  27. package/a2ui/docs/catalog-guide_zh.md +373 -0
  28. package/a2ui/docs/overview.md +312 -0
  29. package/a2ui/docs/overview_zh.md +289 -0
  30. package/a2ui/docs/system-prompts.md +187 -0
  31. package/a2ui/docs/system-prompts_zh.md +187 -0
  32. package/a2ui/src/catalog/README.md +12 -0
  33. package/a2ui/src/catalog/index.ts +51 -0
  34. package/a2ui/src/catalog/readme_zh.md +11 -0
  35. package/a2ui/src/index.ts +115 -0
  36. package/a2ui/styles/catalog/Button.css +5 -5
  37. package/a2ui/styles/catalog/DateTimeInput.css +22 -30
  38. package/a2ui/styles/catalog/Loading.css +61 -0
  39. package/a2ui-catalog-extractor/README.md +14 -7
  40. package/a2ui-catalog-extractor/dist/cli.d.ts +1 -0
  41. package/a2ui-catalog-extractor/dist/cli.js +15 -6
  42. package/a2ui-catalog-extractor/dist/cli.js.map +1 -1
  43. package/a2ui-catalog-extractor/dist/index.d.ts +9 -2
  44. package/a2ui-catalog-extractor/dist/index.js +52 -6
  45. package/a2ui-catalog-extractor/dist/index.js.map +1 -1
  46. package/a2ui-catalog-extractor/dist/tsconfig.build.tsbuildinfo +1 -1
  47. package/a2ui-catalog-extractor/skills/a2ui-catalog-extractor/SKILL.md +1 -1
  48. package/a2ui-prompt/README.md +3 -2
  49. package/a2ui-prompt/dist/index.d.ts +2 -0
  50. package/a2ui-prompt/dist/index.js +159 -84
  51. package/cli/README.md +26 -0
  52. package/cli/bin/cli.js +7 -265
  53. package/cli/dist/a2ui/create.d.ts +5 -0
  54. package/cli/dist/a2ui/create.js +178 -0
  55. package/cli/dist/a2ui/create.js.map +1 -0
  56. package/cli/dist/a2ui/index.d.ts +5 -0
  57. package/cli/dist/a2ui/index.js +170 -0
  58. package/cli/dist/a2ui/index.js.map +1 -0
  59. package/cli/dist/cli.d.ts +4 -0
  60. package/cli/dist/cli.js +40 -0
  61. package/cli/dist/cli.js.map +1 -0
  62. package/cli/dist/openui.d.ts +1 -0
  63. package/cli/dist/openui.js +21 -0
  64. package/cli/dist/openui.js.map +1 -0
  65. package/cli/dist/tsconfig.build.tsbuildinfo +1 -0
  66. package/cli/dist/utils.d.ts +2 -0
  67. package/cli/dist/utils.js +17 -0
  68. package/cli/dist/utils.js.map +1 -0
  69. package/cli/templates/default/lynx.config.ts +13 -0
  70. package/cli/templates/default/package.json +27 -0
  71. package/cli/templates/default/src/App.css +88 -0
  72. package/cli/templates/default/src/App.tsx +100 -0
  73. package/cli/templates/default/src/index.tsx +10 -0
  74. package/cli/templates/default/src/messages.ts +158 -0
  75. package/cli/templates/default/src/rspeedy-env.d.ts +14 -0
  76. package/cli/templates/default/src/tsconfig.json +17 -0
  77. package/cli/templates/default/tsconfig.json +15 -0
  78. package/cli/templates/default/tsconfig.node.json +16 -0
  79. package/dist/tsconfig.build.tsbuildinfo +1 -1
  80. package/openui/README.md +50 -46
  81. package/openui/dist/catalog/Action/{index.js → index.jsx} +1 -1
  82. package/openui/dist/catalog/Action/index.jsx.map +1 -0
  83. package/openui/dist/catalog/Button/index.d.ts +8 -8
  84. package/openui/dist/catalog/Button/{index.js → index.jsx} +28 -14
  85. package/openui/dist/catalog/Button/index.jsx.map +1 -0
  86. package/openui/dist/catalog/Card/index.d.ts +1 -1
  87. package/openui/dist/catalog/Card/{index.js → index.jsx} +5 -4
  88. package/openui/dist/catalog/Card/{index.js.map → index.jsx.map} +1 -1
  89. package/openui/dist/catalog/CardHeader/index.d.ts +1 -1
  90. package/openui/dist/catalog/CardHeader/index.jsx +20 -0
  91. package/openui/dist/catalog/CardHeader/index.jsx.map +1 -0
  92. package/openui/dist/catalog/CheckBox/index.d.ts +16 -0
  93. package/openui/dist/catalog/CheckBox/index.jsx +82 -0
  94. package/openui/dist/catalog/CheckBox/index.jsx.map +1 -0
  95. package/openui/dist/catalog/Icon/index.d.ts +44 -0
  96. package/openui/dist/catalog/Icon/index.jsx +66 -0
  97. package/openui/dist/catalog/Icon/index.jsx.map +1 -0
  98. package/openui/dist/catalog/Image/index.d.ts +19 -0
  99. package/openui/dist/catalog/Image/index.jsx +40 -0
  100. package/openui/dist/catalog/Image/index.jsx.map +1 -0
  101. package/openui/dist/catalog/Loading/index.d.ts +7 -0
  102. package/openui/dist/catalog/Loading/index.jsx +25 -0
  103. package/openui/dist/catalog/Loading/index.jsx.map +1 -0
  104. package/openui/dist/catalog/RadioGroup/index.d.ts +21 -0
  105. package/openui/dist/catalog/RadioGroup/index.jsx +99 -0
  106. package/openui/dist/catalog/RadioGroup/index.jsx.map +1 -0
  107. package/openui/dist/catalog/Separator/index.d.ts +1 -1
  108. package/openui/dist/catalog/Separator/{index.js → index.jsx} +3 -4
  109. package/openui/dist/catalog/Separator/index.jsx.map +1 -0
  110. package/openui/dist/catalog/Slider/index.d.ts +19 -0
  111. package/openui/dist/catalog/Slider/index.jsx +139 -0
  112. package/openui/dist/catalog/Slider/index.jsx.map +1 -0
  113. package/openui/dist/catalog/Stack/index.d.ts +1 -1
  114. package/openui/dist/catalog/Stack/{index.js → index.jsx} +3 -4
  115. package/openui/dist/catalog/Stack/{index.js.map → index.jsx.map} +1 -1
  116. package/openui/dist/catalog/Tag/index.d.ts +1 -1
  117. package/openui/dist/catalog/Tag/{index.js → index.jsx} +5 -4
  118. package/openui/dist/catalog/Tag/index.jsx.map +1 -0
  119. package/openui/dist/catalog/TextContent/index.d.ts +1 -1
  120. package/openui/dist/catalog/TextContent/{index.js → index.jsx} +5 -4
  121. package/openui/dist/catalog/TextContent/{index.js.map → index.jsx.map} +1 -1
  122. package/openui/dist/catalog/TextField/index.d.ts +23 -0
  123. package/openui/dist/catalog/TextField/index.jsx +132 -0
  124. package/openui/dist/catalog/TextField/index.jsx.map +1 -0
  125. package/openui/dist/catalog/index.d.ts +14 -7
  126. package/openui/dist/catalog/index.js +14 -7
  127. package/openui/dist/catalog/index.js.map +1 -1
  128. package/openui/dist/core/context.d.ts +17 -7
  129. package/openui/dist/core/{context.js → context.jsx} +8 -2
  130. package/openui/dist/core/context.jsx.map +1 -0
  131. package/openui/dist/core/createLibrary.d.ts +1 -1
  132. package/openui/dist/core/{createLibrary.js → createLibrary.jsx} +14 -3
  133. package/openui/dist/core/createLibrary.jsx.map +1 -0
  134. package/openui/dist/core/hooks/index.d.ts +1 -0
  135. package/openui/dist/core/hooks/index.js +1 -0
  136. package/openui/dist/core/hooks/index.js.map +1 -1
  137. package/openui/dist/core/hooks/useOpenUIState.d.ts +2 -2
  138. package/openui/dist/core/hooks/useOpenUIState.js +3 -1
  139. package/openui/dist/core/hooks/useOpenUIState.js.map +1 -1
  140. package/openui/dist/core/hooks/useStateField.js +1 -1
  141. package/openui/dist/core/hooks/useStateField.js.map +1 -1
  142. package/openui/dist/core/index.d.ts +13 -7
  143. package/openui/dist/core/index.js +7 -4
  144. package/openui/dist/core/index.js.map +1 -1
  145. package/openui/dist/core/{library.js → library.jsx} +1 -1
  146. package/openui/dist/core/library.jsx.map +1 -0
  147. package/openui/dist/core/renderer.css +527 -0
  148. package/openui/dist/core/renderer.d.ts +31 -4
  149. package/openui/dist/core/renderer.jsx +281 -0
  150. package/openui/dist/core/renderer.jsx.map +1 -0
  151. package/openui/dist/core/runtime/index.d.ts +1 -0
  152. package/openui/dist/core/runtime/index.js +5 -0
  153. package/openui/dist/core/runtime/index.js.map +1 -0
  154. package/openui/dist/core/runtime/reactive.d.ts +7 -0
  155. package/openui/dist/core/runtime/reactive.js +10 -0
  156. package/openui/dist/core/runtime/reactive.js.map +1 -0
  157. package/package.json +17 -7
  158. package/openui/dist/catalog/Action/index.js.map +0 -1
  159. package/openui/dist/catalog/Button/index.js.map +0 -1
  160. package/openui/dist/catalog/CardHeader/index.js +0 -18
  161. package/openui/dist/catalog/CardHeader/index.js.map +0 -1
  162. package/openui/dist/catalog/Separator/index.js.map +0 -1
  163. package/openui/dist/catalog/Tag/index.js.map +0 -1
  164. package/openui/dist/core/context.js.map +0 -1
  165. package/openui/dist/core/createLibrary.js.map +0 -1
  166. package/openui/dist/core/library.js.map +0 -1
  167. package/openui/dist/core/renderer.js +0 -139
  168. 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,10 @@
1
+ import '@lynx-js/react/debug';
2
+ import { root } from '@lynx-js/react';
3
+
4
+ import { App } from './App.js';
5
+
6
+ root.render(<App />);
7
+
8
+ if (import.meta.webpackHot) {
9
+ import.meta.webpackHot.accept();
10
+ }
@@ -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
+ }