@a2ui-sdk/types 0.1.1 → 0.2.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/dist/0.8/index.d.ts +1 -164
- package/dist/0.8/index.js +1 -1
- package/dist/0.8/standard-catalog.d.ts +157 -0
- package/dist/0.8/standard-catalog.js +1 -0
- package/dist/0.9/index.d.ts +20 -202
- package/dist/0.9/index.js +1 -1
- package/dist/0.9/standard-catalog.d.ts +164 -0
- package/dist/0.9/standard-catalog.js +1 -0
- package/package.json +10 -1
package/dist/0.8/index.d.ts
CHANGED
|
@@ -150,167 +150,4 @@ export interface A2UIMessage {
|
|
|
150
150
|
dataModelUpdate?: DataModelUpdatePayload;
|
|
151
151
|
deleteSurface?: DeleteSurfacePayload;
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
* Base props shared by all A2UI components.
|
|
155
|
-
*/
|
|
156
|
-
export interface BaseComponentProps {
|
|
157
|
-
surfaceId: string;
|
|
158
|
-
componentId: string;
|
|
159
|
-
weight?: number;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Text component properties.
|
|
163
|
-
*/
|
|
164
|
-
export interface TextComponentProps extends BaseComponentProps {
|
|
165
|
-
text?: ValueSource;
|
|
166
|
-
usageHint?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'caption' | 'body';
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Image component properties.
|
|
170
|
-
*/
|
|
171
|
-
export interface ImageComponentProps extends BaseComponentProps {
|
|
172
|
-
url?: ValueSource;
|
|
173
|
-
fit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
174
|
-
usageHint?: 'icon' | 'avatar' | 'smallFeature' | 'mediumFeature' | 'largeFeature' | 'header';
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Icon component properties.
|
|
178
|
-
*/
|
|
179
|
-
export interface IconComponentProps extends BaseComponentProps {
|
|
180
|
-
name?: ValueSource;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Video component properties.
|
|
184
|
-
*/
|
|
185
|
-
export interface VideoComponentProps extends BaseComponentProps {
|
|
186
|
-
url?: ValueSource;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* AudioPlayer component properties.
|
|
190
|
-
*/
|
|
191
|
-
export interface AudioPlayerComponentProps extends BaseComponentProps {
|
|
192
|
-
url?: ValueSource;
|
|
193
|
-
description?: ValueSource;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Divider component properties.
|
|
197
|
-
*/
|
|
198
|
-
export interface DividerComponentProps extends BaseComponentProps {
|
|
199
|
-
axis?: 'horizontal' | 'vertical';
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Distribution values for flex layouts.
|
|
203
|
-
*/
|
|
204
|
-
export type Distribution = 'start' | 'center' | 'end' | 'spaceBetween' | 'spaceAround' | 'spaceEvenly';
|
|
205
|
-
/**
|
|
206
|
-
* Alignment values for flex layouts.
|
|
207
|
-
*/
|
|
208
|
-
export type Alignment = 'start' | 'center' | 'end' | 'stretch';
|
|
209
|
-
/**
|
|
210
|
-
* Row component properties.
|
|
211
|
-
*/
|
|
212
|
-
export interface RowComponentProps extends BaseComponentProps {
|
|
213
|
-
children?: ChildrenDefinition;
|
|
214
|
-
distribution?: Distribution;
|
|
215
|
-
alignment?: Alignment;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Column component properties.
|
|
219
|
-
*/
|
|
220
|
-
export interface ColumnComponentProps extends BaseComponentProps {
|
|
221
|
-
children?: ChildrenDefinition;
|
|
222
|
-
distribution?: Distribution;
|
|
223
|
-
alignment?: Alignment;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* List component properties.
|
|
227
|
-
*/
|
|
228
|
-
export interface ListComponentProps extends BaseComponentProps {
|
|
229
|
-
children?: ChildrenDefinition;
|
|
230
|
-
direction?: 'vertical' | 'horizontal';
|
|
231
|
-
alignment?: Alignment;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Card component properties.
|
|
235
|
-
*/
|
|
236
|
-
export interface CardComponentProps extends BaseComponentProps {
|
|
237
|
-
child?: string;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Tab item definition.
|
|
241
|
-
*/
|
|
242
|
-
export interface TabItem {
|
|
243
|
-
title?: ValueSource;
|
|
244
|
-
child: string;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Tabs component properties.
|
|
248
|
-
*/
|
|
249
|
-
export interface TabsComponentProps extends BaseComponentProps {
|
|
250
|
-
tabItems?: TabItem[];
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Modal component properties.
|
|
254
|
-
*/
|
|
255
|
-
export interface ModalComponentProps extends BaseComponentProps {
|
|
256
|
-
entryPointChild?: string;
|
|
257
|
-
contentChild?: string;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Button component properties.
|
|
261
|
-
*/
|
|
262
|
-
export interface ButtonComponentProps extends BaseComponentProps {
|
|
263
|
-
child?: string;
|
|
264
|
-
primary?: boolean;
|
|
265
|
-
action?: Action;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* CheckBox component properties.
|
|
269
|
-
*/
|
|
270
|
-
export interface CheckBoxComponentProps extends BaseComponentProps {
|
|
271
|
-
label?: ValueSource;
|
|
272
|
-
value?: ValueSource;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* TextField component properties.
|
|
276
|
-
*/
|
|
277
|
-
export interface TextFieldComponentProps extends BaseComponentProps {
|
|
278
|
-
label?: ValueSource;
|
|
279
|
-
text?: ValueSource;
|
|
280
|
-
textFieldType?: 'date' | 'longText' | 'number' | 'shortText' | 'obscured';
|
|
281
|
-
validationRegexp?: string;
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* DateTimeInput component properties.
|
|
285
|
-
*/
|
|
286
|
-
export interface DateTimeInputComponentProps extends BaseComponentProps {
|
|
287
|
-
label?: ValueSource;
|
|
288
|
-
value?: ValueSource;
|
|
289
|
-
enableDate?: boolean;
|
|
290
|
-
enableTime?: boolean;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* MultipleChoice option definition.
|
|
294
|
-
*/
|
|
295
|
-
export interface MultipleChoiceOption {
|
|
296
|
-
label?: ValueSource;
|
|
297
|
-
value: string;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* MultipleChoice component properties.
|
|
301
|
-
*/
|
|
302
|
-
export interface MultipleChoiceComponentProps extends BaseComponentProps {
|
|
303
|
-
label?: ValueSource;
|
|
304
|
-
selections?: ValueSource;
|
|
305
|
-
options?: MultipleChoiceOption[];
|
|
306
|
-
maxAllowedSelections?: number;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Slider component properties.
|
|
310
|
-
*/
|
|
311
|
-
export interface SliderComponentProps extends BaseComponentProps {
|
|
312
|
-
label?: ValueSource;
|
|
313
|
-
value?: ValueSource;
|
|
314
|
-
minValue?: number;
|
|
315
|
-
maxValue?: number;
|
|
316
|
-
}
|
|
153
|
+
export * as StandardCatalog from './standard-catalog.js';
|
package/dist/0.8/index.js
CHANGED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { Action, ChildrenDefinition, ValueSource } from './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Text component properties.
|
|
4
|
+
*/
|
|
5
|
+
export interface TextComponentProps {
|
|
6
|
+
text?: ValueSource;
|
|
7
|
+
usageHint?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'caption' | 'body';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Image component properties.
|
|
11
|
+
*/
|
|
12
|
+
export interface ImageComponentProps {
|
|
13
|
+
url?: ValueSource;
|
|
14
|
+
fit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
15
|
+
usageHint?: 'icon' | 'avatar' | 'smallFeature' | 'mediumFeature' | 'largeFeature' | 'header';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Icon component properties.
|
|
19
|
+
*/
|
|
20
|
+
export interface IconComponentProps {
|
|
21
|
+
name?: ValueSource;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Video component properties.
|
|
25
|
+
*/
|
|
26
|
+
export interface VideoComponentProps {
|
|
27
|
+
url?: ValueSource;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* AudioPlayer component properties.
|
|
31
|
+
*/
|
|
32
|
+
export interface AudioPlayerComponentProps {
|
|
33
|
+
url?: ValueSource;
|
|
34
|
+
description?: ValueSource;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Divider component properties.
|
|
38
|
+
*/
|
|
39
|
+
export interface DividerComponentProps {
|
|
40
|
+
axis?: 'horizontal' | 'vertical';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Distribution values for flex layouts.
|
|
44
|
+
*/
|
|
45
|
+
export type Distribution = 'start' | 'center' | 'end' | 'spaceBetween' | 'spaceAround' | 'spaceEvenly';
|
|
46
|
+
/**
|
|
47
|
+
* Alignment values for flex layouts.
|
|
48
|
+
*/
|
|
49
|
+
export type Alignment = 'start' | 'center' | 'end' | 'stretch';
|
|
50
|
+
/**
|
|
51
|
+
* Row component properties.
|
|
52
|
+
*/
|
|
53
|
+
export interface RowComponentProps {
|
|
54
|
+
children?: ChildrenDefinition;
|
|
55
|
+
distribution?: Distribution;
|
|
56
|
+
alignment?: Alignment;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Column component properties.
|
|
60
|
+
*/
|
|
61
|
+
export interface ColumnComponentProps {
|
|
62
|
+
children?: ChildrenDefinition;
|
|
63
|
+
distribution?: Distribution;
|
|
64
|
+
alignment?: Alignment;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* List component properties.
|
|
68
|
+
*/
|
|
69
|
+
export interface ListComponentProps {
|
|
70
|
+
children?: ChildrenDefinition;
|
|
71
|
+
direction?: 'vertical' | 'horizontal';
|
|
72
|
+
alignment?: Alignment;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Card component properties.
|
|
76
|
+
*/
|
|
77
|
+
export interface CardComponentProps {
|
|
78
|
+
child?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Tab item definition.
|
|
82
|
+
*/
|
|
83
|
+
export interface TabItem {
|
|
84
|
+
title?: ValueSource;
|
|
85
|
+
child: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Tabs component properties.
|
|
89
|
+
*/
|
|
90
|
+
export interface TabsComponentProps {
|
|
91
|
+
tabItems?: TabItem[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Modal component properties.
|
|
95
|
+
*/
|
|
96
|
+
export interface ModalComponentProps {
|
|
97
|
+
entryPointChild?: string;
|
|
98
|
+
contentChild?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Button component properties.
|
|
102
|
+
*/
|
|
103
|
+
export interface ButtonComponentProps {
|
|
104
|
+
child?: string;
|
|
105
|
+
primary?: boolean;
|
|
106
|
+
action?: Action;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* CheckBox component properties.
|
|
110
|
+
*/
|
|
111
|
+
export interface CheckBoxComponentProps {
|
|
112
|
+
label?: ValueSource;
|
|
113
|
+
value?: ValueSource;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* TextField component properties.
|
|
117
|
+
*/
|
|
118
|
+
export interface TextFieldComponentProps {
|
|
119
|
+
label?: ValueSource;
|
|
120
|
+
text?: ValueSource;
|
|
121
|
+
textFieldType?: 'date' | 'longText' | 'number' | 'shortText' | 'obscured';
|
|
122
|
+
validationRegexp?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* DateTimeInput component properties.
|
|
126
|
+
*/
|
|
127
|
+
export interface DateTimeInputComponentProps {
|
|
128
|
+
label?: ValueSource;
|
|
129
|
+
value?: ValueSource;
|
|
130
|
+
enableDate?: boolean;
|
|
131
|
+
enableTime?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* MultipleChoice option definition.
|
|
135
|
+
*/
|
|
136
|
+
export interface MultipleChoiceOption {
|
|
137
|
+
label?: ValueSource;
|
|
138
|
+
value: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* MultipleChoice component properties.
|
|
142
|
+
*/
|
|
143
|
+
export interface MultipleChoiceComponentProps {
|
|
144
|
+
label?: ValueSource;
|
|
145
|
+
selections?: ValueSource;
|
|
146
|
+
options?: MultipleChoiceOption[];
|
|
147
|
+
maxAllowedSelections?: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Slider component properties.
|
|
151
|
+
*/
|
|
152
|
+
export interface SliderComponentProps {
|
|
153
|
+
label?: ValueSource;
|
|
154
|
+
value?: ValueSource;
|
|
155
|
+
minValue?: number;
|
|
156
|
+
maxValue?: number;
|
|
157
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/0.9/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface CreateSurfacePayload {
|
|
|
29
29
|
*/
|
|
30
30
|
export interface UpdateComponentsPayload {
|
|
31
31
|
surfaceId: string;
|
|
32
|
-
components:
|
|
32
|
+
components: ComponentDefinition[];
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* UpdateDataModel message payload - updates the data model at a specific path.
|
|
@@ -135,210 +135,27 @@ export interface Checkable {
|
|
|
135
135
|
checks?: CheckRule[];
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
138
|
+
* Common properties for all components.
|
|
139
139
|
*/
|
|
140
|
-
export interface
|
|
140
|
+
export interface ComponentCommon {
|
|
141
141
|
id: string;
|
|
142
|
-
/** Discriminator: "Text", "Button", etc. */
|
|
143
|
-
component: string;
|
|
144
142
|
/** flex-grow for Row/Column children */
|
|
145
143
|
weight?: number;
|
|
146
144
|
}
|
|
147
145
|
/**
|
|
148
|
-
*
|
|
149
|
-
*/
|
|
150
|
-
export interface TextComponent extends ComponentBase {
|
|
151
|
-
component: 'Text';
|
|
152
|
-
text: DynamicString;
|
|
153
|
-
variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'caption' | 'body';
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Image component.
|
|
157
|
-
*/
|
|
158
|
-
export interface ImageComponent extends ComponentBase {
|
|
159
|
-
component: 'Image';
|
|
160
|
-
url: DynamicString;
|
|
161
|
-
fit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
162
|
-
variant?: 'icon' | 'avatar' | 'smallFeature' | 'mediumFeature' | 'largeFeature' | 'header';
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Icon component.
|
|
166
|
-
*/
|
|
167
|
-
export interface IconComponent extends ComponentBase {
|
|
168
|
-
component: 'Icon';
|
|
169
|
-
name: DynamicString;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Video component.
|
|
173
|
-
*/
|
|
174
|
-
export interface VideoComponent extends ComponentBase {
|
|
175
|
-
component: 'Video';
|
|
176
|
-
url: DynamicString;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* AudioPlayer component.
|
|
180
|
-
*/
|
|
181
|
-
export interface AudioPlayerComponent extends ComponentBase {
|
|
182
|
-
component: 'AudioPlayer';
|
|
183
|
-
url: DynamicString;
|
|
184
|
-
description?: DynamicString;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Divider component.
|
|
188
|
-
*/
|
|
189
|
-
export interface DividerComponent extends ComponentBase {
|
|
190
|
-
component: 'Divider';
|
|
191
|
-
axis?: 'horizontal' | 'vertical';
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Justify values for flex layouts (main axis distribution).
|
|
195
|
-
*/
|
|
196
|
-
export type Justify = 'start' | 'center' | 'end' | 'spaceBetween' | 'spaceAround' | 'spaceEvenly' | 'stretch';
|
|
197
|
-
/**
|
|
198
|
-
* Align values for flex layouts (cross axis alignment).
|
|
199
|
-
*/
|
|
200
|
-
export type Align = 'start' | 'center' | 'end' | 'stretch';
|
|
201
|
-
/**
|
|
202
|
-
* Row component.
|
|
203
|
-
*/
|
|
204
|
-
export interface RowComponent extends ComponentBase {
|
|
205
|
-
component: 'Row';
|
|
206
|
-
children: ChildList;
|
|
207
|
-
justify?: Justify;
|
|
208
|
-
align?: Align;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Column component.
|
|
212
|
-
*/
|
|
213
|
-
export interface ColumnComponent extends ComponentBase {
|
|
214
|
-
component: 'Column';
|
|
215
|
-
children: ChildList;
|
|
216
|
-
justify?: Justify;
|
|
217
|
-
align?: Align;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* List component.
|
|
221
|
-
*/
|
|
222
|
-
export interface ListComponent extends ComponentBase {
|
|
223
|
-
component: 'List';
|
|
224
|
-
children: ChildList;
|
|
225
|
-
direction?: 'vertical' | 'horizontal';
|
|
226
|
-
align?: Align;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Card component.
|
|
230
|
-
*/
|
|
231
|
-
export interface CardComponent extends ComponentBase {
|
|
232
|
-
component: 'Card';
|
|
233
|
-
/** Single child component ID */
|
|
234
|
-
child: string;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Tab item definition.
|
|
238
|
-
*/
|
|
239
|
-
export interface TabItem {
|
|
240
|
-
title: DynamicString;
|
|
241
|
-
/** Component ID */
|
|
242
|
-
child: string;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Tabs component.
|
|
246
|
-
*/
|
|
247
|
-
export interface TabsComponent extends ComponentBase {
|
|
248
|
-
component: 'Tabs';
|
|
249
|
-
tabs: TabItem[];
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Modal component.
|
|
253
|
-
*/
|
|
254
|
-
export interface ModalComponent extends ComponentBase {
|
|
255
|
-
component: 'Modal';
|
|
256
|
-
/** Component ID for trigger */
|
|
257
|
-
trigger: string;
|
|
258
|
-
/** Component ID for content */
|
|
259
|
-
content: string;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Action definition (attached to Button components).
|
|
263
|
-
*/
|
|
264
|
-
export interface Action {
|
|
265
|
-
name: string;
|
|
266
|
-
context?: Record<string, DynamicValue>;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Button component.
|
|
270
|
-
*/
|
|
271
|
-
export interface ButtonComponent extends ComponentBase, Checkable {
|
|
272
|
-
component: 'Button';
|
|
273
|
-
/** Component ID (typically Text or Icon) */
|
|
274
|
-
child: string;
|
|
275
|
-
primary?: boolean;
|
|
276
|
-
action: Action;
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* TextField component.
|
|
280
|
-
*/
|
|
281
|
-
export interface TextFieldComponent extends ComponentBase, Checkable {
|
|
282
|
-
component: 'TextField';
|
|
283
|
-
label: DynamicString;
|
|
284
|
-
/** Two-way binding path */
|
|
285
|
-
value?: DynamicString;
|
|
286
|
-
variant?: 'longText' | 'number' | 'shortText' | 'obscured';
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* CheckBox component.
|
|
290
|
-
*/
|
|
291
|
-
export interface CheckBoxComponent extends ComponentBase, Checkable {
|
|
292
|
-
component: 'CheckBox';
|
|
293
|
-
label: DynamicString;
|
|
294
|
-
/** Two-way binding path */
|
|
295
|
-
value: DynamicBoolean;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Choice option definition.
|
|
299
|
-
*/
|
|
300
|
-
export interface ChoiceOption {
|
|
301
|
-
label: DynamicString;
|
|
302
|
-
value: string;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* ChoicePicker component (renamed from MultipleChoice).
|
|
306
|
-
*/
|
|
307
|
-
export interface ChoicePickerComponent extends ComponentBase, Checkable {
|
|
308
|
-
component: 'ChoicePicker';
|
|
309
|
-
label?: DynamicString;
|
|
310
|
-
variant?: 'multipleSelection' | 'mutuallyExclusive';
|
|
311
|
-
options: ChoiceOption[];
|
|
312
|
-
/** Two-way binding path */
|
|
313
|
-
value: DynamicStringList;
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Slider component.
|
|
146
|
+
* Base component properties that all components share.
|
|
317
147
|
*/
|
|
318
|
-
export interface
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
max: number;
|
|
323
|
-
/** Two-way binding path */
|
|
324
|
-
value: DynamicNumber;
|
|
148
|
+
export interface BaseComponentDefinition extends ComponentCommon {
|
|
149
|
+
id: string;
|
|
150
|
+
/** Discriminator: "Text", "Button", etc. */
|
|
151
|
+
component: string;
|
|
325
152
|
}
|
|
326
153
|
/**
|
|
327
|
-
*
|
|
154
|
+
* Any components.
|
|
328
155
|
*/
|
|
329
|
-
export interface
|
|
330
|
-
|
|
331
|
-
/** Two-way binding path (ISO 8601) */
|
|
332
|
-
value: DynamicString;
|
|
333
|
-
enableDate?: boolean;
|
|
334
|
-
enableTime?: boolean;
|
|
335
|
-
outputFormat?: string;
|
|
336
|
-
label?: DynamicString;
|
|
156
|
+
export interface ComponentDefinition extends BaseComponentDefinition {
|
|
157
|
+
[key: string]: unknown;
|
|
337
158
|
}
|
|
338
|
-
/**
|
|
339
|
-
* Union type of all standard catalog components.
|
|
340
|
-
*/
|
|
341
|
-
export type Component = TextComponent | ImageComponent | IconComponent | VideoComponent | AudioPlayerComponent | DividerComponent | RowComponent | ColumnComponent | ListComponent | CardComponent | TabsComponent | ModalComponent | ButtonComponent | TextFieldComponent | CheckBoxComponent | ChoicePickerComponent | SliderComponent | DateTimeInputComponent;
|
|
342
159
|
/**
|
|
343
160
|
* Data model type (hierarchical key-value store).
|
|
344
161
|
*/
|
|
@@ -349,17 +166,10 @@ export type DataModel = Record<string, unknown>;
|
|
|
349
166
|
export interface SurfaceState {
|
|
350
167
|
surfaceId: string;
|
|
351
168
|
catalogId: string;
|
|
352
|
-
components: Map<string,
|
|
169
|
+
components: Map<string, ComponentDefinition>;
|
|
353
170
|
dataModel: DataModel;
|
|
354
171
|
created: boolean;
|
|
355
172
|
}
|
|
356
|
-
/**
|
|
357
|
-
* Provider state managing multiple surfaces.
|
|
358
|
-
*/
|
|
359
|
-
export interface ProviderState {
|
|
360
|
-
surfaces: Map<string, SurfaceState>;
|
|
361
|
-
messageBuffer: Map<string, A2UIMessage[]>;
|
|
362
|
-
}
|
|
363
173
|
/**
|
|
364
174
|
* Scope value for collection scopes.
|
|
365
175
|
*/
|
|
@@ -375,6 +185,13 @@ export interface ValidationResult {
|
|
|
375
185
|
/** List of failed check messages */
|
|
376
186
|
errors: string[];
|
|
377
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Action definition (attached to Button components).
|
|
190
|
+
*/
|
|
191
|
+
export interface Action {
|
|
192
|
+
name: string;
|
|
193
|
+
context?: Record<string, DynamicValue>;
|
|
194
|
+
}
|
|
378
195
|
/**
|
|
379
196
|
* Resolved action payload sent to the action handler.
|
|
380
197
|
*/
|
|
@@ -389,3 +206,4 @@ export interface ActionPayload {
|
|
|
389
206
|
* Action handler callback type.
|
|
390
207
|
*/
|
|
391
208
|
export type ActionHandler = (action: ActionPayload) => void;
|
|
209
|
+
export * as StandardCatalog from './standard-catalog.js';
|
package/dist/0.9/index.js
CHANGED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { Action, CheckRule, ChildList, DynamicBoolean, DynamicNumber, DynamicString, DynamicStringList } from './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Justify values for flex layouts (main axis distribution).
|
|
4
|
+
*/
|
|
5
|
+
export type Justify = 'start' | 'center' | 'end' | 'spaceBetween' | 'spaceAround' | 'spaceEvenly' | 'stretch';
|
|
6
|
+
/**
|
|
7
|
+
* Align values for flex layouts (cross axis alignment).
|
|
8
|
+
*/
|
|
9
|
+
export type Align = 'start' | 'center' | 'end' | 'stretch';
|
|
10
|
+
/**
|
|
11
|
+
* Tab item definition.
|
|
12
|
+
*/
|
|
13
|
+
export interface TabItem {
|
|
14
|
+
title: DynamicString;
|
|
15
|
+
/** Component ID */
|
|
16
|
+
child: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Choice option definition.
|
|
20
|
+
*/
|
|
21
|
+
export interface ChoiceOption {
|
|
22
|
+
label: DynamicString;
|
|
23
|
+
value: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Text component props.
|
|
27
|
+
*/
|
|
28
|
+
export interface TextComponentProps {
|
|
29
|
+
text: DynamicString;
|
|
30
|
+
variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'caption' | 'body';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Image component props.
|
|
34
|
+
*/
|
|
35
|
+
export interface ImageComponentProps {
|
|
36
|
+
url: DynamicString;
|
|
37
|
+
fit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
38
|
+
variant?: 'icon' | 'avatar' | 'smallFeature' | 'mediumFeature' | 'largeFeature' | 'header';
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Icon component props.
|
|
42
|
+
*/
|
|
43
|
+
export interface IconComponentProps {
|
|
44
|
+
name: DynamicString;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Video component props.
|
|
48
|
+
*/
|
|
49
|
+
export interface VideoComponentProps {
|
|
50
|
+
url: DynamicString;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* AudioPlayer component props.
|
|
54
|
+
*/
|
|
55
|
+
export interface AudioPlayerComponentProps {
|
|
56
|
+
url: DynamicString;
|
|
57
|
+
description?: DynamicString;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Divider component props.
|
|
61
|
+
*/
|
|
62
|
+
export interface DividerComponentProps {
|
|
63
|
+
axis?: 'horizontal' | 'vertical';
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Row component props.
|
|
67
|
+
*/
|
|
68
|
+
export interface RowComponentProps {
|
|
69
|
+
children: ChildList;
|
|
70
|
+
justify?: Justify;
|
|
71
|
+
align?: Align;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Column component props.
|
|
75
|
+
*/
|
|
76
|
+
export interface ColumnComponentProps {
|
|
77
|
+
children: ChildList;
|
|
78
|
+
justify?: Justify;
|
|
79
|
+
align?: Align;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* List component props.
|
|
83
|
+
*/
|
|
84
|
+
export interface ListComponentProps {
|
|
85
|
+
children: ChildList;
|
|
86
|
+
direction?: 'vertical' | 'horizontal';
|
|
87
|
+
align?: Align;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Card component props.
|
|
91
|
+
*/
|
|
92
|
+
export interface CardComponentProps {
|
|
93
|
+
child: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Tabs component props.
|
|
97
|
+
*/
|
|
98
|
+
export interface TabsComponentProps {
|
|
99
|
+
tabs: TabItem[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Modal component props.
|
|
103
|
+
*/
|
|
104
|
+
export interface ModalComponentProps {
|
|
105
|
+
trigger: string;
|
|
106
|
+
content: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Checkable props mixin for validation.
|
|
110
|
+
*/
|
|
111
|
+
export interface CheckableProps {
|
|
112
|
+
checks?: CheckRule[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Button component props.
|
|
116
|
+
*/
|
|
117
|
+
export interface ButtonComponentProps extends CheckableProps {
|
|
118
|
+
child: string;
|
|
119
|
+
primary?: boolean;
|
|
120
|
+
action: Action;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* TextField component props.
|
|
124
|
+
*/
|
|
125
|
+
export interface TextFieldComponentProps extends CheckableProps {
|
|
126
|
+
label: DynamicString;
|
|
127
|
+
value?: DynamicString;
|
|
128
|
+
variant?: 'longText' | 'number' | 'shortText' | 'obscured';
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* CheckBox component props.
|
|
132
|
+
*/
|
|
133
|
+
export interface CheckBoxComponentProps extends CheckableProps {
|
|
134
|
+
label: DynamicString;
|
|
135
|
+
value: DynamicBoolean;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* ChoicePicker component props.
|
|
139
|
+
*/
|
|
140
|
+
export interface ChoicePickerComponentProps extends CheckableProps {
|
|
141
|
+
label?: DynamicString;
|
|
142
|
+
variant?: 'multipleSelection' | 'mutuallyExclusive';
|
|
143
|
+
options: ChoiceOption[];
|
|
144
|
+
value: DynamicStringList;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Slider component props.
|
|
148
|
+
*/
|
|
149
|
+
export interface SliderComponentProps extends CheckableProps {
|
|
150
|
+
label?: DynamicString;
|
|
151
|
+
min: number;
|
|
152
|
+
max: number;
|
|
153
|
+
value: DynamicNumber;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* DateTimeInput component props.
|
|
157
|
+
*/
|
|
158
|
+
export interface DateTimeInputComponentProps extends CheckableProps {
|
|
159
|
+
value: DynamicString;
|
|
160
|
+
enableDate?: boolean;
|
|
161
|
+
enableTime?: boolean;
|
|
162
|
+
outputFormat?: string;
|
|
163
|
+
label?: DynamicString;
|
|
164
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a2ui-sdk/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A2UI types",
|
|
5
5
|
"homepage": "https://a2ui-sdk.js.org/",
|
|
6
6
|
"repository": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
|
+
"sideEffects": false,
|
|
14
15
|
"exports": {
|
|
15
16
|
".": {
|
|
16
17
|
"types": "./dist/index.d.ts",
|
|
@@ -20,9 +21,17 @@
|
|
|
20
21
|
"types": "./dist/0.8/index.d.ts",
|
|
21
22
|
"default": "./dist/0.8/index.js"
|
|
22
23
|
},
|
|
24
|
+
"./0.8/standard-catalog": {
|
|
25
|
+
"types": "./dist/0.8/standard-catalog.d.ts",
|
|
26
|
+
"default": "./dist/0.8/standard-catalog.js"
|
|
27
|
+
},
|
|
23
28
|
"./0.9": {
|
|
24
29
|
"types": "./dist/0.9/index.d.ts",
|
|
25
30
|
"default": "./dist/0.9/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./0.9/standard-catalog": {
|
|
33
|
+
"types": "./dist/0.9/standard-catalog.d.ts",
|
|
34
|
+
"default": "./dist/0.9/standard-catalog.js"
|
|
26
35
|
}
|
|
27
36
|
},
|
|
28
37
|
"files": [
|