autoui-react 0.0.5-alpha → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -52
- package/dist/index.css +0 -10
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +87 -140
- package/dist/index.d.ts +87 -140
- package/dist/index.js +504 -2511
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +496 -2471
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -48
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# autoui
|
|
1
|
+
# @autoui/react
|
|
2
2
|
|
|
3
3
|
A React + TypeScript runtime that **generates goal-oriented UIs in real-time** using an LLM + your data schema.
|
|
4
4
|
|
|
@@ -27,13 +27,13 @@ This library implements this approach, using LLMs to interpret a goal and schema
|
|
|
27
27
|
## Installation
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npm install autoui
|
|
30
|
+
npm install @autoui/react
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Quick Start
|
|
34
34
|
|
|
35
35
|
```jsx
|
|
36
|
-
import { AutoUI } from 'autoui
|
|
36
|
+
import { AutoUI } from '@autoui/react';
|
|
37
37
|
import { emailsTable, usersTable } from './schema';
|
|
38
38
|
|
|
39
39
|
function App() {
|
|
@@ -124,7 +124,7 @@ AutoUI supports different ways to provide your data schema:
|
|
|
124
124
|
#### 2. Using Drizzle Adapter
|
|
125
125
|
|
|
126
126
|
```jsx
|
|
127
|
-
import { AutoUI } from 'autoui
|
|
127
|
+
import { AutoUI } from '@autoui/react';
|
|
128
128
|
import { db } from './db'; // Your Drizzle instance
|
|
129
129
|
import { users, posts } from './schema'; // Drizzle schema
|
|
130
130
|
|
|
@@ -177,7 +177,7 @@ function MyApp() {
|
|
|
177
177
|
AutoUI provides hooks into its internal planning and rendering process through system events. You can subscribe to these events to monitor or extend the functionality.
|
|
178
178
|
|
|
179
179
|
```jsx
|
|
180
|
-
import { AutoUI, SystemEventType } from 'autoui
|
|
180
|
+
import { AutoUI, SystemEventType } from '@autoui/react';
|
|
181
181
|
|
|
182
182
|
function MyApp() {
|
|
183
183
|
return (
|
|
@@ -241,50 +241,4 @@ MIT
|
|
|
241
241
|
|
|
242
242
|
## Contributing
|
|
243
243
|
|
|
244
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
245
|
-
## Component Adapters
|
|
246
|
-
|
|
247
|
-
### shadcn/ui (Default)
|
|
248
|
-
|
|
249
|
-
This library uses [shadcn/ui](https://ui.shadcn.com/) components by default. To set up these components in your project:
|
|
250
|
-
|
|
251
|
-
```bash
|
|
252
|
-
# Run the setup script to install required shadcn components
|
|
253
|
-
npm run setup-shadcn
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
This will:
|
|
257
|
-
1. Install Tailwind CSS if not already installed
|
|
258
|
-
2. Set up the necessary shadcn/ui components
|
|
259
|
-
3. Configure your project to use them
|
|
260
|
-
|
|
261
|
-
After setup, make sure to import the CSS in your application:
|
|
262
|
-
|
|
263
|
-
```jsx
|
|
264
|
-
// In your main entry file (e.g., main.tsx, index.tsx)
|
|
265
|
-
import "./src/tailwind.css";
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Custom Component Adapters
|
|
269
|
-
|
|
270
|
-
You can create custom adapters for other component libraries by implementing an adapter module:
|
|
271
|
-
|
|
272
|
-
```jsx
|
|
273
|
-
// Create a custom adapter (e.g., for Material UI)
|
|
274
|
-
import { Button, Table, Card } from '@mui/material';
|
|
275
|
-
|
|
276
|
-
const materialAdapter = {
|
|
277
|
-
Button: (props) => <Button {...props} />,
|
|
278
|
-
Table: (props) => <Table {...props} />,
|
|
279
|
-
// ...
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
// Use your custom adapter
|
|
283
|
-
<AutoUI
|
|
284
|
-
schema={mySchema}
|
|
285
|
-
goal="Create a user dashboard"
|
|
286
|
-
componentAdapter="material" // Not yet supported in v0.1
|
|
287
|
-
/>
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
Support for custom component adapters is planned for future releases.
|
|
244
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
package/dist/index.css
CHANGED
|
@@ -53,14 +53,4 @@
|
|
|
53
53
|
.autoui-error-message {
|
|
54
54
|
font-size: 0.875rem;
|
|
55
55
|
}
|
|
56
|
-
.autoui-mock-container {
|
|
57
|
-
color: inherit;
|
|
58
|
-
width: 100%;
|
|
59
|
-
color: #1f2937;
|
|
60
|
-
}
|
|
61
|
-
@media (prefers-color-scheme: dark) {
|
|
62
|
-
.autoui-mock-container {
|
|
63
|
-
color: #f3f4f6;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
56
|
/*# sourceMappingURL=index.css.map */
|
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/styles/autoui.css"],"sourcesContent":["/* AutoUI Component Styles */\n\n.autoui-root {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n}\n\n/* Loading states */\n.autoui-loading {\n width: 100%;\n height: 100%;\n}\n\n.autoui-shimmer-container {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n padding: 1rem;\n}\n\n.autoui-shimmer-header {\n height: 2.5rem;\n background-color: #e5e7eb;\n border-radius: 0.25rem;\n animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n.autoui-shimmer-content {\n height: 16rem;\n background-color: #e5e7eb;\n border-radius: 0.25rem;\n animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n@keyframes pulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Content */\n.autoui-content {\n flex: 1;\n width: 100%;\n}\n\n/* Error states */\n.autoui-error {\n padding: 1rem;\n border: 1px solid #fca5a5;\n background-color: #fee2e2;\n color: #b91c1c;\n border-radius: 0.25rem;\n margin-top: 1rem;\n}\n\n.autoui-error-title {\n font-weight: 600;\n}\n\n.autoui-error-message {\n font-size: 0.875rem;\n}
|
|
1
|
+
{"version":3,"sources":["../src/styles/autoui.css"],"sourcesContent":["/* AutoUI Component Styles */\n\n.autoui-root {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n}\n\n/* Loading states */\n.autoui-loading {\n width: 100%;\n height: 100%;\n}\n\n.autoui-shimmer-container {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n padding: 1rem;\n}\n\n.autoui-shimmer-header {\n height: 2.5rem;\n background-color: #e5e7eb;\n border-radius: 0.25rem;\n animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n.autoui-shimmer-content {\n height: 16rem;\n background-color: #e5e7eb;\n border-radius: 0.25rem;\n animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n@keyframes pulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Content */\n.autoui-content {\n flex: 1;\n width: 100%;\n}\n\n/* Error states */\n.autoui-error {\n padding: 1rem;\n border: 1px solid #fca5a5;\n background-color: #fee2e2;\n color: #b91c1c;\n border-radius: 0.25rem;\n margin-top: 1rem;\n}\n\n.autoui-error-title {\n font-weight: 600;\n}\n\n.autoui-error-message {\n font-size: 0.875rem;\n} "],"mappings":";AAEA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,UAAQ;AACR,SAAO;AACT;AAGA,CAAC;AACC,SAAO;AACP,UAAQ;AACV;AAEA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,OAAK;AACL,WAAS;AACX;AAEA,CAAC;AACC,UAAQ;AACR,oBAAkB;AAClB,iBAAe;AACf,aAAW,MAAM,GAAG,aAAa,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG;AACnD;AAEA,CAAC;AACC,UAAQ;AACR,oBAAkB;AAClB,iBAAe;AACf,aAAW,MAAM,GAAG,aAAa,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG;AACnD;AAEA,WAVa;AAWX;AACE,aAAS;AACX;AACA;AACE,aAAS;AACX;AACF;AAGA,CAAC;AACC,QAAM;AACN,SAAO;AACT;AAGA,CAAC;AACC,WAAS;AACT,UAAQ,IAAI,MAAM;AAClB,oBAAkB;AAClB,SAAO;AACP,iBAAe;AACf,cAAY;AACd;AAEA,CAAC;AACC,eAAa;AACf;AAEA,CAAC;AACC,aAAW;AACb;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,85 +4,88 @@ import React from 'react';
|
|
|
4
4
|
/**
|
|
5
5
|
* Event types that can be triggered by UI elements
|
|
6
6
|
*/
|
|
7
|
-
declare const uiEventType: z.ZodEnum<["
|
|
7
|
+
declare const uiEventType: z.ZodEnum<["CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
8
8
|
type UIEventType = z.infer<typeof uiEventType>;
|
|
9
9
|
/**
|
|
10
10
|
* Event payload schema
|
|
11
11
|
*/
|
|
12
12
|
declare const uiEvent: z.ZodObject<{
|
|
13
|
-
type: z.ZodEnum<["
|
|
13
|
+
type: z.ZodEnum<["CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
14
14
|
nodeId: z.ZodString;
|
|
15
|
-
timestamp: z.
|
|
16
|
-
payload: z.
|
|
15
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
type: "
|
|
18
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
19
19
|
nodeId: string;
|
|
20
|
-
timestamp
|
|
21
|
-
payload
|
|
20
|
+
timestamp?: number | undefined;
|
|
21
|
+
payload?: Record<string, any> | undefined;
|
|
22
22
|
}, {
|
|
23
|
-
type: "
|
|
23
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
24
24
|
nodeId: string;
|
|
25
|
-
timestamp
|
|
26
|
-
payload
|
|
25
|
+
timestamp?: number | undefined;
|
|
26
|
+
payload?: Record<string, any> | undefined;
|
|
27
27
|
}>;
|
|
28
28
|
type UIEvent = z.infer<typeof uiEvent>;
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Core UI specification node
|
|
31
|
+
* Represents a single element in the UI tree
|
|
32
|
+
*/
|
|
33
|
+
declare const uiSpecNode: z.ZodType<UISpecNode>;
|
|
34
|
+
type UISpecNode = {
|
|
30
35
|
id: string;
|
|
31
|
-
|
|
32
|
-
props
|
|
33
|
-
bindings
|
|
34
|
-
events
|
|
36
|
+
type: string;
|
|
37
|
+
props?: Record<string, any> | undefined;
|
|
38
|
+
bindings?: Record<string, any> | undefined;
|
|
39
|
+
events?: Record<string, {
|
|
35
40
|
action: string;
|
|
36
|
-
target
|
|
37
|
-
payload
|
|
38
|
-
}> |
|
|
39
|
-
children
|
|
40
|
-
}
|
|
41
|
-
declare const uiSpecNode: z.ZodType<UISpecNodeInterface>;
|
|
42
|
-
type UISpecNode = z.infer<typeof uiSpecNode>;
|
|
41
|
+
target?: string | undefined;
|
|
42
|
+
payload?: Record<string, any> | undefined;
|
|
43
|
+
}> | undefined;
|
|
44
|
+
children?: UISpecNode[] | undefined;
|
|
45
|
+
};
|
|
43
46
|
/**
|
|
44
47
|
* Application state for the UI engine
|
|
45
48
|
*/
|
|
46
49
|
declare const uiState: z.ZodObject<{
|
|
47
|
-
layout: z.
|
|
50
|
+
layout: z.ZodOptional<z.ZodType<UISpecNode, z.ZodTypeDef, UISpecNode>>;
|
|
48
51
|
loading: z.ZodBoolean;
|
|
49
52
|
history: z.ZodArray<z.ZodObject<{
|
|
50
|
-
type: z.ZodEnum<["
|
|
53
|
+
type: z.ZodEnum<["CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
51
54
|
nodeId: z.ZodString;
|
|
52
|
-
timestamp: z.
|
|
53
|
-
payload: z.
|
|
55
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
54
57
|
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
type: "
|
|
58
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
56
59
|
nodeId: string;
|
|
57
|
-
timestamp
|
|
58
|
-
payload
|
|
60
|
+
timestamp?: number | undefined;
|
|
61
|
+
payload?: Record<string, any> | undefined;
|
|
59
62
|
}, {
|
|
60
|
-
type: "
|
|
63
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
61
64
|
nodeId: string;
|
|
62
|
-
timestamp
|
|
63
|
-
payload
|
|
65
|
+
timestamp?: number | undefined;
|
|
66
|
+
payload?: Record<string, any> | undefined;
|
|
64
67
|
}>, "many">;
|
|
65
|
-
error: z.
|
|
68
|
+
error: z.ZodOptional<z.ZodString>;
|
|
66
69
|
}, "strip", z.ZodTypeAny, {
|
|
67
|
-
layout: UISpecNodeInterface | null;
|
|
68
70
|
loading: boolean;
|
|
69
71
|
history: {
|
|
70
|
-
type: "
|
|
72
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
71
73
|
nodeId: string;
|
|
72
|
-
timestamp
|
|
73
|
-
payload
|
|
74
|
+
timestamp?: number | undefined;
|
|
75
|
+
payload?: Record<string, any> | undefined;
|
|
74
76
|
}[];
|
|
75
|
-
|
|
77
|
+
layout?: UISpecNode | undefined;
|
|
78
|
+
error?: string | undefined;
|
|
76
79
|
}, {
|
|
77
|
-
layout: UISpecNodeInterface | null;
|
|
78
80
|
loading: boolean;
|
|
79
81
|
history: {
|
|
80
|
-
type: "
|
|
82
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
81
83
|
nodeId: string;
|
|
82
|
-
timestamp
|
|
83
|
-
payload
|
|
84
|
+
timestamp?: number | undefined;
|
|
85
|
+
payload?: Record<string, any> | undefined;
|
|
84
86
|
}[];
|
|
85
|
-
|
|
87
|
+
layout?: UISpecNode | undefined;
|
|
88
|
+
error?: string | undefined;
|
|
86
89
|
}>;
|
|
87
90
|
type UIState = z.infer<typeof uiState>;
|
|
88
91
|
/**
|
|
@@ -91,43 +94,43 @@ type UIState = z.infer<typeof uiState>;
|
|
|
91
94
|
declare const plannerInput: z.ZodObject<{
|
|
92
95
|
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
93
96
|
goal: z.ZodString;
|
|
94
|
-
history: z.
|
|
95
|
-
type: z.ZodEnum<["
|
|
97
|
+
history: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
98
|
+
type: z.ZodEnum<["CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
96
99
|
nodeId: z.ZodString;
|
|
97
|
-
timestamp: z.
|
|
98
|
-
payload: z.
|
|
100
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
99
102
|
}, "strip", z.ZodTypeAny, {
|
|
100
|
-
type: "
|
|
103
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
101
104
|
nodeId: string;
|
|
102
|
-
timestamp
|
|
103
|
-
payload
|
|
105
|
+
timestamp?: number | undefined;
|
|
106
|
+
payload?: Record<string, any> | undefined;
|
|
104
107
|
}, {
|
|
105
|
-
type: "
|
|
108
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
106
109
|
nodeId: string;
|
|
107
|
-
timestamp
|
|
108
|
-
payload
|
|
110
|
+
timestamp?: number | undefined;
|
|
111
|
+
payload?: Record<string, any> | undefined;
|
|
109
112
|
}>, "many">>;
|
|
110
|
-
userContext: z.ZodOptional<z.
|
|
113
|
+
userContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
111
114
|
}, "strip", z.ZodTypeAny, {
|
|
112
|
-
history: {
|
|
113
|
-
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
114
|
-
nodeId: string;
|
|
115
|
-
timestamp: number | null;
|
|
116
|
-
payload: Record<string, unknown> | null;
|
|
117
|
-
}[] | null;
|
|
118
115
|
schema: Record<string, unknown>;
|
|
119
116
|
goal: string;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
history: {
|
|
123
|
-
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
117
|
+
history?: {
|
|
118
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
124
119
|
nodeId: string;
|
|
125
|
-
timestamp
|
|
126
|
-
payload
|
|
127
|
-
}[] |
|
|
120
|
+
timestamp?: number | undefined;
|
|
121
|
+
payload?: Record<string, any> | undefined;
|
|
122
|
+
}[] | undefined;
|
|
123
|
+
userContext?: Record<string, unknown> | undefined;
|
|
124
|
+
}, {
|
|
128
125
|
schema: Record<string, unknown>;
|
|
129
126
|
goal: string;
|
|
130
|
-
|
|
127
|
+
history?: {
|
|
128
|
+
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
129
|
+
nodeId: string;
|
|
130
|
+
timestamp?: number | undefined;
|
|
131
|
+
payload?: Record<string, any> | undefined;
|
|
132
|
+
}[] | undefined;
|
|
133
|
+
userContext?: Record<string, unknown> | undefined;
|
|
131
134
|
}>;
|
|
132
135
|
type PlannerInput = z.infer<typeof plannerInput>;
|
|
133
136
|
|
|
@@ -143,7 +146,7 @@ interface DataContext {
|
|
|
143
146
|
*/
|
|
144
147
|
declare enum ActionType {
|
|
145
148
|
FULL_REFRESH = "FULL_REFRESH",// Generate a completely new UI
|
|
146
|
-
UPDATE_NODE = "UPDATE_NODE",// Update a specific node
|
|
149
|
+
UPDATE_NODE = "UPDATE_NODE",// Update a specific node
|
|
147
150
|
ADD_DROPDOWN = "ADD_DROPDOWN",// Add a dropdown to a specific node
|
|
148
151
|
SHOW_DETAIL = "SHOW_DETAIL",// Show a detail view
|
|
149
152
|
HIDE_DETAIL = "HIDE_DETAIL",// Hide a detail view
|
|
@@ -156,8 +159,8 @@ declare enum ActionType {
|
|
|
156
159
|
*/
|
|
157
160
|
interface ActionRouteConfig {
|
|
158
161
|
actionType: ActionType;
|
|
159
|
-
targetNodeId
|
|
160
|
-
promptTemplate
|
|
162
|
+
targetNodeId: string;
|
|
163
|
+
promptTemplate: string;
|
|
161
164
|
contextKeys?: string[];
|
|
162
165
|
}
|
|
163
166
|
/**
|
|
@@ -187,7 +190,7 @@ declare class ActionRouter {
|
|
|
187
190
|
* @param dataContext - Current data context
|
|
188
191
|
* @returns Route resolution or null if no match
|
|
189
192
|
*/
|
|
190
|
-
resolveRoute(event: UIEvent, schema: Record<string, unknown>, layout: UISpecNode |
|
|
193
|
+
resolveRoute(event: UIEvent, schema: Record<string, unknown>, layout: UISpecNode | undefined, dataContext: DataContext, goal: string, userContext?: Record<string, unknown>): RouteResolution | null;
|
|
191
194
|
/**
|
|
192
195
|
* Process a prompt template with variables
|
|
193
196
|
* @param template - Template string with ${var} placeholders
|
|
@@ -198,22 +201,6 @@ declare class ActionRouter {
|
|
|
198
201
|
}
|
|
199
202
|
declare function createDefaultRouter(): ActionRouter;
|
|
200
203
|
|
|
201
|
-
interface UseUIStateEngineOptions {
|
|
202
|
-
schema: Record<string, unknown>;
|
|
203
|
-
goal: string;
|
|
204
|
-
openaiApiKey?: string | undefined;
|
|
205
|
-
userContext?: Record<string, unknown> | undefined;
|
|
206
|
-
mockMode?: boolean | undefined;
|
|
207
|
-
planningConfig?: {
|
|
208
|
-
prefetchDepth?: number;
|
|
209
|
-
temperature?: number;
|
|
210
|
-
streaming?: boolean;
|
|
211
|
-
} | undefined;
|
|
212
|
-
router?: ActionRouter | undefined;
|
|
213
|
-
dataContext?: Record<string, unknown> | undefined;
|
|
214
|
-
enablePartialUpdates?: boolean | undefined;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
204
|
interface EventHookOptions {
|
|
218
205
|
preventDefault?: boolean;
|
|
219
206
|
stopPropagation?: boolean;
|
|
@@ -242,7 +229,7 @@ type EventHook = (context: EventHookContext) => void | Promise<void>;
|
|
|
242
229
|
* });
|
|
243
230
|
* ```
|
|
244
231
|
*/
|
|
245
|
-
declare function createEventHook(eventTypes: UIEventType[] |
|
|
232
|
+
declare function createEventHook(eventTypes: UIEventType[] | 'all', hook: EventHook, options?: EventHookOptions): EventHook;
|
|
246
233
|
|
|
247
234
|
/**
|
|
248
235
|
* System event types that represent the internal AutoUI lifecycle
|
|
@@ -383,7 +370,7 @@ declare const systemEvents: SystemEventManager;
|
|
|
383
370
|
*/
|
|
384
371
|
declare function createSystemEvent<T extends SystemEventType>(type: T, data: Omit<Extract<AnySystemEvent, {
|
|
385
372
|
type: T;
|
|
386
|
-
}>,
|
|
373
|
+
}>, 'type' | 'timestamp'>): Extract<AnySystemEvent, {
|
|
387
374
|
type: T;
|
|
388
375
|
}>;
|
|
389
376
|
|
|
@@ -466,10 +453,10 @@ interface SchemaAdapter {
|
|
|
466
453
|
* Schema adapter options union type
|
|
467
454
|
*/
|
|
468
455
|
type SchemaAdapterOptions = {
|
|
469
|
-
type:
|
|
456
|
+
type: 'drizzle';
|
|
470
457
|
options: DrizzleAdapterOptions$1;
|
|
471
458
|
} | {
|
|
472
|
-
type:
|
|
459
|
+
type: 'custom';
|
|
473
460
|
adapter: SchemaAdapter;
|
|
474
461
|
};
|
|
475
462
|
/**
|
|
@@ -480,16 +467,16 @@ declare function createSchemaAdapter(options: SchemaAdapterOptions): SchemaAdapt
|
|
|
480
467
|
interface DrizzleAdapterOptions {
|
|
481
468
|
schema: Record<string, unknown>;
|
|
482
469
|
}
|
|
483
|
-
interface AutoUIProps
|
|
470
|
+
interface AutoUIProps {
|
|
484
471
|
schema: Record<string, unknown> | {
|
|
485
|
-
type:
|
|
472
|
+
type: 'drizzle';
|
|
486
473
|
options: DrizzleAdapterOptions;
|
|
487
474
|
} | {
|
|
488
|
-
type:
|
|
475
|
+
type: 'custom';
|
|
489
476
|
adapter: SchemaAdapter;
|
|
490
477
|
};
|
|
491
478
|
goal: string;
|
|
492
|
-
componentAdapter?:
|
|
479
|
+
componentAdapter?: 'shadcn';
|
|
493
480
|
userContext?: Record<string, unknown>;
|
|
494
481
|
onEvent?: (evt: UIEvent) => void;
|
|
495
482
|
eventHooks?: {
|
|
@@ -507,13 +494,13 @@ interface AutoUIProps extends Omit<UseUIStateEngineOptions, "router" | "dataCont
|
|
|
507
494
|
enableFormNavigation?: boolean;
|
|
508
495
|
};
|
|
509
496
|
integration?: {
|
|
510
|
-
mode?:
|
|
497
|
+
mode?: 'standalone' | 'component';
|
|
511
498
|
className?: string;
|
|
512
499
|
style?: React.CSSProperties;
|
|
513
500
|
id?: string;
|
|
514
501
|
};
|
|
515
502
|
scope?: {
|
|
516
|
-
type?:
|
|
503
|
+
type?: 'form' | 'list' | 'detail' | 'dashboard' | 'full-page' | 'card';
|
|
517
504
|
focus?: string;
|
|
518
505
|
};
|
|
519
506
|
debugMode?: boolean;
|
|
@@ -524,14 +511,13 @@ interface AutoUIProps extends Omit<UseUIStateEngineOptions, "router" | "dataCont
|
|
|
524
511
|
temperature?: number;
|
|
525
512
|
streaming?: boolean;
|
|
526
513
|
};
|
|
527
|
-
openaiApiKey?: string;
|
|
528
514
|
}
|
|
529
515
|
/**
|
|
530
516
|
* AutoUI - Main component for generating goal-oriented UIs
|
|
531
517
|
*
|
|
532
518
|
* @example
|
|
533
519
|
* ```tsx
|
|
534
|
-
* import { AutoUI } from 'autoui
|
|
520
|
+
* import { AutoUI } from '@autoui/react';
|
|
535
521
|
* import { emailsTable, usersTable } from './schema';
|
|
536
522
|
*
|
|
537
523
|
* function MyApp() {
|
|
@@ -546,43 +532,4 @@ interface AutoUIProps extends Omit<UseUIStateEngineOptions, "router" | "dataCont
|
|
|
546
532
|
*/
|
|
547
533
|
declare const AutoUI: React.FC<AutoUIProps>;
|
|
548
534
|
|
|
549
|
-
|
|
550
|
-
* AI Utilities for AutoUI React
|
|
551
|
-
* Provides AI-powered UI generation functionality
|
|
552
|
-
*/
|
|
553
|
-
/**
|
|
554
|
-
* Generates a component using AI
|
|
555
|
-
*/
|
|
556
|
-
declare const generateComponent: (prompt: string) => Promise<string>;
|
|
557
|
-
/**
|
|
558
|
-
* Generates a UI description using AI
|
|
559
|
-
*/
|
|
560
|
-
declare const generateUIDescription: (prompt: string) => Promise<string>;
|
|
561
|
-
/**
|
|
562
|
-
* Generates a UI component using AI
|
|
563
|
-
*/
|
|
564
|
-
declare const generateUIComponent: (prompt: string) => Promise<string>;
|
|
565
|
-
|
|
566
|
-
interface UsePlannerOptions {
|
|
567
|
-
goal: string;
|
|
568
|
-
schema: Record<string, unknown>;
|
|
569
|
-
openaiApiKey?: string;
|
|
570
|
-
userContext?: Record<string, unknown>;
|
|
571
|
-
router?: ActionRouter;
|
|
572
|
-
modelProvider?: unknown;
|
|
573
|
-
initialLayout?: UISpecNode;
|
|
574
|
-
mockMode?: boolean;
|
|
575
|
-
}
|
|
576
|
-
interface UsePlannerResult {
|
|
577
|
-
layout: UISpecNode | undefined;
|
|
578
|
-
loading: boolean;
|
|
579
|
-
error: Error | null;
|
|
580
|
-
handleEvent: (event: UIEvent) => Promise<void>;
|
|
581
|
-
generateInitialLayout: () => Promise<void>;
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* React hook for utilizing the AI planner functionality
|
|
585
|
-
*/
|
|
586
|
-
declare function usePlanner(options: UsePlannerOptions): UsePlannerResult;
|
|
587
|
-
|
|
588
|
-
export { ActionRouteConfig, ActionRouter, ActionType, AnySystemEvent, AutoUI, AutoUIProps, DrizzleAdapter, DrizzleAdapterOptions$1 as DrizzleAdapterOptions, EventHook, EventHookContext, EventHookOptions, PlannerInput, SchemaAdapter, SchemaAdapterOptions, SystemEventHook, SystemEventType, UIEvent, UIEventType, UISpecNode, UIState, createDefaultRouter, createEventHook, createSchemaAdapter, createSystemEvent, generateComponent, generateUIComponent, generateUIDescription, systemEvents, uiEvent, uiEventType, uiSpecNode, usePlanner };
|
|
535
|
+
export { type ActionRouteConfig, ActionRouter, ActionType, type AnySystemEvent, AutoUI, type AutoUIProps, DrizzleAdapter, type DrizzleAdapterOptions$1 as DrizzleAdapterOptions, type EventHook, type EventHookContext, type EventHookOptions, type PlannerInput, type SchemaAdapter, type SchemaAdapterOptions, type SystemEventHook, SystemEventType, type UIEvent, type UIEventType, type UISpecNode, type UIState, createDefaultRouter, createEventHook, createSchemaAdapter, createSystemEvent, systemEvents, uiEvent, uiEventType, uiSpecNode };
|