autoui-react 0.0.3-alpha → 0.0.5-alpha
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 +47 -1
- package/dist/index.css +10 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +135 -93
- package/dist/index.d.ts +135 -93
- package/dist/index.js +2474 -536
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2433 -524
- package/dist/index.mjs.map +1 -1
- package/package.json +44 -6
package/README.md
CHANGED
|
@@ -241,4 +241,50 @@ MIT
|
|
|
241
241
|
|
|
242
242
|
## Contributing
|
|
243
243
|
|
|
244
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
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.
|
package/dist/index.css
CHANGED
|
@@ -53,4 +53,14 @@
|
|
|
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
|
+
}
|
|
56
66
|
/*# 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} "],"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":[]}
|
|
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}\n\n/* Style for the mock Container component in shadcn.tsx */\n.autoui-mock-container {\n color: inherit;\n width: 100%;\n /* text-gray-800 */\n color: #1f2937; \n}\n\n/* Dark mode styling for the mock Container */\n@media (prefers-color-scheme: dark) {\n .autoui-mock-container {\n /* dark:text-gray-100 */\n color: #f3f4f6;\n }\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;AAGA,CAAC;AACC,SAAO;AACP,SAAO;AAEP,SAAO;AACT;AAGA,OAAO,CAAC,oBAAoB,EAAE;AAC5B,GATD;AAWG,WAAO;AACT;AACF;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,88 +4,85 @@ 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<["CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
7
|
+
declare const uiEventType: z.ZodEnum<["INIT", "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<["CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
13
|
+
type: z.ZodEnum<["INIT", "CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
14
14
|
nodeId: z.ZodString;
|
|
15
|
-
timestamp: z.
|
|
16
|
-
payload: z.
|
|
15
|
+
timestamp: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
payload: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
18
|
+
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
19
19
|
nodeId: string;
|
|
20
|
-
timestamp
|
|
21
|
-
payload
|
|
20
|
+
timestamp: number | null;
|
|
21
|
+
payload: Record<string, unknown> | null;
|
|
22
22
|
}, {
|
|
23
|
-
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
23
|
+
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
24
24
|
nodeId: string;
|
|
25
|
-
timestamp
|
|
26
|
-
payload
|
|
25
|
+
timestamp: number | null;
|
|
26
|
+
payload: Record<string, unknown> | null;
|
|
27
27
|
}>;
|
|
28
28
|
type UIEvent = z.infer<typeof uiEvent>;
|
|
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 = {
|
|
29
|
+
interface UISpecNodeInterface {
|
|
35
30
|
id: string;
|
|
36
|
-
|
|
37
|
-
props
|
|
38
|
-
bindings
|
|
39
|
-
events
|
|
31
|
+
node_type: string;
|
|
32
|
+
props: Record<string, any> | null;
|
|
33
|
+
bindings: Record<string, any> | null;
|
|
34
|
+
events: Record<string, {
|
|
40
35
|
action: string;
|
|
41
|
-
target
|
|
42
|
-
payload
|
|
43
|
-
}> |
|
|
44
|
-
children
|
|
45
|
-
}
|
|
36
|
+
target: string;
|
|
37
|
+
payload: Record<string, any> | null;
|
|
38
|
+
}> | null;
|
|
39
|
+
children: UISpecNodeInterface[] | null;
|
|
40
|
+
}
|
|
41
|
+
declare const uiSpecNode: z.ZodType<UISpecNodeInterface>;
|
|
42
|
+
type UISpecNode = z.infer<typeof uiSpecNode>;
|
|
46
43
|
/**
|
|
47
44
|
* Application state for the UI engine
|
|
48
45
|
*/
|
|
49
46
|
declare const uiState: z.ZodObject<{
|
|
50
|
-
layout: z.
|
|
47
|
+
layout: z.ZodNullable<z.ZodType<UISpecNodeInterface, z.ZodTypeDef, UISpecNodeInterface>>;
|
|
51
48
|
loading: z.ZodBoolean;
|
|
52
49
|
history: z.ZodArray<z.ZodObject<{
|
|
53
|
-
type: z.ZodEnum<["CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
50
|
+
type: z.ZodEnum<["INIT", "CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
54
51
|
nodeId: z.ZodString;
|
|
55
|
-
timestamp: z.
|
|
56
|
-
payload: z.
|
|
52
|
+
timestamp: z.ZodNullable<z.ZodNumber>;
|
|
53
|
+
payload: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
57
54
|
}, "strip", z.ZodTypeAny, {
|
|
58
|
-
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
55
|
+
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
59
56
|
nodeId: string;
|
|
60
|
-
timestamp
|
|
61
|
-
payload
|
|
57
|
+
timestamp: number | null;
|
|
58
|
+
payload: Record<string, unknown> | null;
|
|
62
59
|
}, {
|
|
63
|
-
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
60
|
+
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
64
61
|
nodeId: string;
|
|
65
|
-
timestamp
|
|
66
|
-
payload
|
|
62
|
+
timestamp: number | null;
|
|
63
|
+
payload: Record<string, unknown> | null;
|
|
67
64
|
}>, "many">;
|
|
68
|
-
error: z.
|
|
65
|
+
error: z.ZodNullable<z.ZodString>;
|
|
69
66
|
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
layout: UISpecNodeInterface | null;
|
|
70
68
|
loading: boolean;
|
|
71
69
|
history: {
|
|
72
|
-
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
70
|
+
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
73
71
|
nodeId: string;
|
|
74
|
-
timestamp
|
|
75
|
-
payload
|
|
72
|
+
timestamp: number | null;
|
|
73
|
+
payload: Record<string, unknown> | null;
|
|
76
74
|
}[];
|
|
77
|
-
|
|
78
|
-
error?: string | undefined;
|
|
75
|
+
error: string | null;
|
|
79
76
|
}, {
|
|
77
|
+
layout: UISpecNodeInterface | null;
|
|
80
78
|
loading: boolean;
|
|
81
79
|
history: {
|
|
82
|
-
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
80
|
+
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
83
81
|
nodeId: string;
|
|
84
|
-
timestamp
|
|
85
|
-
payload
|
|
82
|
+
timestamp: number | null;
|
|
83
|
+
payload: Record<string, unknown> | null;
|
|
86
84
|
}[];
|
|
87
|
-
|
|
88
|
-
error?: string | undefined;
|
|
85
|
+
error: string | null;
|
|
89
86
|
}>;
|
|
90
87
|
type UIState = z.infer<typeof uiState>;
|
|
91
88
|
/**
|
|
@@ -94,43 +91,43 @@ type UIState = z.infer<typeof uiState>;
|
|
|
94
91
|
declare const plannerInput: z.ZodObject<{
|
|
95
92
|
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
96
93
|
goal: z.ZodString;
|
|
97
|
-
history: z.
|
|
98
|
-
type: z.ZodEnum<["CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
94
|
+
history: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
95
|
+
type: z.ZodEnum<["INIT", "CLICK", "CHANGE", "SUBMIT", "MOUSEOVER", "MOUSEOUT", "FOCUS", "BLUR"]>;
|
|
99
96
|
nodeId: z.ZodString;
|
|
100
|
-
timestamp: z.
|
|
101
|
-
payload: z.
|
|
97
|
+
timestamp: z.ZodNullable<z.ZodNumber>;
|
|
98
|
+
payload: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
102
99
|
}, "strip", z.ZodTypeAny, {
|
|
103
|
-
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
100
|
+
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
104
101
|
nodeId: string;
|
|
105
|
-
timestamp
|
|
106
|
-
payload
|
|
102
|
+
timestamp: number | null;
|
|
103
|
+
payload: Record<string, unknown> | null;
|
|
107
104
|
}, {
|
|
108
|
-
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
105
|
+
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
109
106
|
nodeId: string;
|
|
110
|
-
timestamp
|
|
111
|
-
payload
|
|
107
|
+
timestamp: number | null;
|
|
108
|
+
payload: Record<string, unknown> | null;
|
|
112
109
|
}>, "many">>;
|
|
113
|
-
userContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
110
|
+
userContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
114
111
|
}, "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;
|
|
115
118
|
schema: Record<string, unknown>;
|
|
116
119
|
goal: string;
|
|
117
|
-
|
|
118
|
-
type: "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
119
|
-
nodeId: string;
|
|
120
|
-
timestamp?: number | undefined;
|
|
121
|
-
payload?: Record<string, any> | undefined;
|
|
122
|
-
}[] | undefined;
|
|
123
|
-
userContext?: Record<string, unknown> | undefined;
|
|
120
|
+
userContext?: Record<string, unknown> | null | undefined;
|
|
124
121
|
}, {
|
|
122
|
+
history: {
|
|
123
|
+
type: "INIT" | "CLICK" | "CHANGE" | "SUBMIT" | "MOUSEOVER" | "MOUSEOUT" | "FOCUS" | "BLUR";
|
|
124
|
+
nodeId: string;
|
|
125
|
+
timestamp: number | null;
|
|
126
|
+
payload: Record<string, unknown> | null;
|
|
127
|
+
}[] | null;
|
|
125
128
|
schema: Record<string, unknown>;
|
|
126
129
|
goal: string;
|
|
127
|
-
|
|
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;
|
|
130
|
+
userContext?: Record<string, unknown> | null | undefined;
|
|
134
131
|
}>;
|
|
135
132
|
type PlannerInput = z.infer<typeof plannerInput>;
|
|
136
133
|
|
|
@@ -146,7 +143,7 @@ interface DataContext {
|
|
|
146
143
|
*/
|
|
147
144
|
declare enum ActionType {
|
|
148
145
|
FULL_REFRESH = "FULL_REFRESH",// Generate a completely new UI
|
|
149
|
-
UPDATE_NODE = "UPDATE_NODE",// Update a specific node
|
|
146
|
+
UPDATE_NODE = "UPDATE_NODE",// Update a specific node, potentially with new children
|
|
150
147
|
ADD_DROPDOWN = "ADD_DROPDOWN",// Add a dropdown to a specific node
|
|
151
148
|
SHOW_DETAIL = "SHOW_DETAIL",// Show a detail view
|
|
152
149
|
HIDE_DETAIL = "HIDE_DETAIL",// Hide a detail view
|
|
@@ -159,8 +156,8 @@ declare enum ActionType {
|
|
|
159
156
|
*/
|
|
160
157
|
interface ActionRouteConfig {
|
|
161
158
|
actionType: ActionType;
|
|
162
|
-
targetNodeId
|
|
163
|
-
promptTemplate
|
|
159
|
+
targetNodeId?: string;
|
|
160
|
+
promptTemplate?: string;
|
|
164
161
|
contextKeys?: string[];
|
|
165
162
|
}
|
|
166
163
|
/**
|
|
@@ -190,7 +187,7 @@ declare class ActionRouter {
|
|
|
190
187
|
* @param dataContext - Current data context
|
|
191
188
|
* @returns Route resolution or null if no match
|
|
192
189
|
*/
|
|
193
|
-
resolveRoute(event: UIEvent, schema: Record<string, unknown>, layout: UISpecNode |
|
|
190
|
+
resolveRoute(event: UIEvent, schema: Record<string, unknown>, layout: UISpecNode | null, dataContext: DataContext, goal: string, userContext?: Record<string, unknown>): RouteResolution | null;
|
|
194
191
|
/**
|
|
195
192
|
* Process a prompt template with variables
|
|
196
193
|
* @param template - Template string with ${var} placeholders
|
|
@@ -201,6 +198,22 @@ declare class ActionRouter {
|
|
|
201
198
|
}
|
|
202
199
|
declare function createDefaultRouter(): ActionRouter;
|
|
203
200
|
|
|
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
|
+
|
|
204
217
|
interface EventHookOptions {
|
|
205
218
|
preventDefault?: boolean;
|
|
206
219
|
stopPropagation?: boolean;
|
|
@@ -229,7 +242,7 @@ type EventHook = (context: EventHookContext) => void | Promise<void>;
|
|
|
229
242
|
* });
|
|
230
243
|
* ```
|
|
231
244
|
*/
|
|
232
|
-
declare function createEventHook(eventTypes: UIEventType[] |
|
|
245
|
+
declare function createEventHook(eventTypes: UIEventType[] | "all", hook: EventHook, options?: EventHookOptions): EventHook;
|
|
233
246
|
|
|
234
247
|
/**
|
|
235
248
|
* System event types that represent the internal AutoUI lifecycle
|
|
@@ -370,7 +383,7 @@ declare const systemEvents: SystemEventManager;
|
|
|
370
383
|
*/
|
|
371
384
|
declare function createSystemEvent<T extends SystemEventType>(type: T, data: Omit<Extract<AnySystemEvent, {
|
|
372
385
|
type: T;
|
|
373
|
-
}>,
|
|
386
|
+
}>, "type" | "timestamp">): Extract<AnySystemEvent, {
|
|
374
387
|
type: T;
|
|
375
388
|
}>;
|
|
376
389
|
|
|
@@ -453,10 +466,10 @@ interface SchemaAdapter {
|
|
|
453
466
|
* Schema adapter options union type
|
|
454
467
|
*/
|
|
455
468
|
type SchemaAdapterOptions = {
|
|
456
|
-
type:
|
|
469
|
+
type: "drizzle";
|
|
457
470
|
options: DrizzleAdapterOptions$1;
|
|
458
471
|
} | {
|
|
459
|
-
type:
|
|
472
|
+
type: "custom";
|
|
460
473
|
adapter: SchemaAdapter;
|
|
461
474
|
};
|
|
462
475
|
/**
|
|
@@ -467,16 +480,16 @@ declare function createSchemaAdapter(options: SchemaAdapterOptions): SchemaAdapt
|
|
|
467
480
|
interface DrizzleAdapterOptions {
|
|
468
481
|
schema: Record<string, unknown>;
|
|
469
482
|
}
|
|
470
|
-
interface AutoUIProps {
|
|
483
|
+
interface AutoUIProps extends Omit<UseUIStateEngineOptions, "router" | "dataContext"> {
|
|
471
484
|
schema: Record<string, unknown> | {
|
|
472
|
-
type:
|
|
485
|
+
type: "drizzle";
|
|
473
486
|
options: DrizzleAdapterOptions;
|
|
474
487
|
} | {
|
|
475
|
-
type:
|
|
488
|
+
type: "custom";
|
|
476
489
|
adapter: SchemaAdapter;
|
|
477
490
|
};
|
|
478
491
|
goal: string;
|
|
479
|
-
componentAdapter?:
|
|
492
|
+
componentAdapter?: "shadcn";
|
|
480
493
|
userContext?: Record<string, unknown>;
|
|
481
494
|
onEvent?: (evt: UIEvent) => void;
|
|
482
495
|
eventHooks?: {
|
|
@@ -494,13 +507,13 @@ interface AutoUIProps {
|
|
|
494
507
|
enableFormNavigation?: boolean;
|
|
495
508
|
};
|
|
496
509
|
integration?: {
|
|
497
|
-
mode?:
|
|
510
|
+
mode?: "standalone" | "component";
|
|
498
511
|
className?: string;
|
|
499
512
|
style?: React.CSSProperties;
|
|
500
513
|
id?: string;
|
|
501
514
|
};
|
|
502
515
|
scope?: {
|
|
503
|
-
type?:
|
|
516
|
+
type?: "form" | "list" | "detail" | "dashboard" | "full-page" | "card";
|
|
504
517
|
focus?: string;
|
|
505
518
|
};
|
|
506
519
|
debugMode?: boolean;
|
|
@@ -511,6 +524,7 @@ interface AutoUIProps {
|
|
|
511
524
|
temperature?: number;
|
|
512
525
|
streaming?: boolean;
|
|
513
526
|
};
|
|
527
|
+
openaiApiKey?: string;
|
|
514
528
|
}
|
|
515
529
|
/**
|
|
516
530
|
* AutoUI - Main component for generating goal-oriented UIs
|
|
@@ -533,14 +547,42 @@ interface AutoUIProps {
|
|
|
533
547
|
declare const AutoUI: React.FC<AutoUIProps>;
|
|
534
548
|
|
|
535
549
|
/**
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
|
|
539
|
-
|
|
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
|
|
540
563
|
*/
|
|
541
|
-
declare
|
|
564
|
+
declare const generateUIComponent: (prompt: string) => Promise<string>;
|
|
542
565
|
|
|
543
|
-
|
|
544
|
-
|
|
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;
|
|
545
587
|
|
|
546
|
-
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 };
|
|
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 };
|