@optimizely-opal/opal-tools-sdk 0.1.8-dev → 0.1.9-dev
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/proteus.d.ts +150 -14
- package/dist/proteus.js +12 -0
- package/package.json +1 -1
- package/src/proteus.ts +198 -13
package/dist/proteus.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* DO NOT MODIFY - This file is auto-generated from proteus-document-spec.json
|
|
4
4
|
* Run 'npm run generate:proteus' to regenerate
|
|
5
5
|
*/
|
|
6
|
-
export type OpalProteusDocumentSpecification = ProteusAction | ProteusAtomicCondition | ProteusCancelAction | ProteusCondition | ProteusDocument | ProteusElement | ProteusEventHandler | ProteusField | ProteusGroup | ProteusHeading | ProteusImage | ProteusInput | ProteusLink | ProteusMap | ProteusNode | ProteusRange | ProteusSelect | ProteusSelectContent | ProteusSelectTrigger | ProteusSeparator | ProteusShow | ProteusText | ProteusTextarea | ProteusValue;
|
|
6
|
+
export type OpalProteusDocumentSpecification = ProteusAction | ProteusAtomicCondition | ProteusBadge | ProteusCancelAction | ProteusChart | ProteusCondition | ProteusDataTable | ProteusDocument | ProteusElement | ProteusEventHandler | ProteusField | ProteusGroup | ProteusHeading | ProteusImage | ProteusInput | ProteusLink | ProteusMap | ProteusNode | ProteusRange | ProteusSelect | ProteusSelectContent | ProteusSelectTrigger | ProteusSeparator | ProteusShow | ProteusText | ProteusTextarea | ProteusValue;
|
|
7
7
|
export interface ProteusAction {
|
|
8
8
|
$type: "Action";
|
|
9
9
|
alignItems?: SprinklePropAlignItems;
|
|
@@ -157,6 +157,71 @@ export type ProteusAtomicCondition = {
|
|
|
157
157
|
*/
|
|
158
158
|
"!!": boolean | null | number | ProteusValue | string;
|
|
159
159
|
};
|
|
160
|
+
export interface ProteusBadge {
|
|
161
|
+
$type: "Badge";
|
|
162
|
+
alignItems?: SprinklePropAlignItems;
|
|
163
|
+
alignSelf?: SprinklePropAlignSelf;
|
|
164
|
+
animation?: SprinklePropAnimation;
|
|
165
|
+
backgroundImage?: SprinklePropBackgroundImage;
|
|
166
|
+
bg?: SprinklePropBg;
|
|
167
|
+
border?: SprinklePropBorder;
|
|
168
|
+
borderB?: SprinklePropBorderB;
|
|
169
|
+
borderColor?: SprinklePropBorderColor;
|
|
170
|
+
borderL?: SprinklePropBorderL;
|
|
171
|
+
borderR?: SprinklePropBorderR;
|
|
172
|
+
borderT?: SprinklePropBorderT;
|
|
173
|
+
children?: ProteusNode;
|
|
174
|
+
color?: SprinklePropColor;
|
|
175
|
+
cursor?: SprinklePropCursor;
|
|
176
|
+
display?: SprinklePropDisplay;
|
|
177
|
+
flex?: SprinklePropFlex;
|
|
178
|
+
flexDirection?: SprinklePropFlexDirection;
|
|
179
|
+
flexWrap?: SprinklePropFlexWrap;
|
|
180
|
+
fontFamily?: SprinklePropFontFamily;
|
|
181
|
+
fontSize?: SprinklePropFontSize;
|
|
182
|
+
fontWeight?: SprinklePropFontWeight;
|
|
183
|
+
gap?: SprinklePropGap;
|
|
184
|
+
gridColumn?: SprinklePropGridColumn;
|
|
185
|
+
gridTemplateColumns?: SprinklePropGridTemplateColumns;
|
|
186
|
+
h?: SprinklePropH;
|
|
187
|
+
/**
|
|
188
|
+
* Control the appearance by selecting between the different badge types.
|
|
189
|
+
*/
|
|
190
|
+
intent?: "danger" | "information" | "neutral" | "primary" | "success" | "warning";
|
|
191
|
+
justifyContent?: SprinklePropJustifyContent;
|
|
192
|
+
justifyItems?: SprinklePropJustifyItems;
|
|
193
|
+
m?: SprinklePropM;
|
|
194
|
+
maxH?: SprinklePropMaxH;
|
|
195
|
+
maxW?: SprinklePropMaxW;
|
|
196
|
+
mb?: SprinklePropMb;
|
|
197
|
+
ml?: SprinklePropMl;
|
|
198
|
+
mr?: SprinklePropMr;
|
|
199
|
+
mt?: SprinklePropMt;
|
|
200
|
+
mx?: SprinklePropMx;
|
|
201
|
+
my?: SprinklePropMy;
|
|
202
|
+
objectFit?: SprinklePropObjectFit;
|
|
203
|
+
overflow?: SprinklePropOverflow;
|
|
204
|
+
overflowX?: SprinklePropOverflowX;
|
|
205
|
+
overflowY?: SprinklePropOverflowY;
|
|
206
|
+
p?: SprinklePropP;
|
|
207
|
+
pb?: SprinklePropPb;
|
|
208
|
+
pl?: SprinklePropPl;
|
|
209
|
+
placeItems?: SprinklePropPlaceItems;
|
|
210
|
+
pointerEvents?: SprinklePropPointerEvents;
|
|
211
|
+
pr?: SprinklePropPr;
|
|
212
|
+
pt?: SprinklePropPt;
|
|
213
|
+
px?: SprinklePropPx;
|
|
214
|
+
py?: SprinklePropPy;
|
|
215
|
+
rounded?: SprinklePropRounded;
|
|
216
|
+
shadow?: SprinklePropShadow;
|
|
217
|
+
size?: SprinklePropSize;
|
|
218
|
+
textAlign?: SprinklePropTextAlign;
|
|
219
|
+
textTransform?: SprinklePropTextTransform;
|
|
220
|
+
transition?: SprinklePropTransition;
|
|
221
|
+
w?: SprinklePropW;
|
|
222
|
+
whiteSpace?: SprinklePropWhiteSpace;
|
|
223
|
+
z?: SprinklePropZ;
|
|
224
|
+
}
|
|
160
225
|
export interface ProteusCancelAction {
|
|
161
226
|
$type: "CancelAction";
|
|
162
227
|
alignItems?: SprinklePropAlignItems;
|
|
@@ -221,6 +286,44 @@ export interface ProteusCancelAction {
|
|
|
221
286
|
whiteSpace?: SprinklePropWhiteSpace;
|
|
222
287
|
z?: SprinklePropZ;
|
|
223
288
|
}
|
|
289
|
+
export interface ProteusChart {
|
|
290
|
+
$type: "Chart";
|
|
291
|
+
/**
|
|
292
|
+
* Chart data records, either inline or a ProteusValue reference
|
|
293
|
+
*/
|
|
294
|
+
data?: ProteusValue | {
|
|
295
|
+
[k: string]: undefined | unknown;
|
|
296
|
+
}[];
|
|
297
|
+
/**
|
|
298
|
+
* Data series configuration
|
|
299
|
+
*/
|
|
300
|
+
series?: {
|
|
301
|
+
/**
|
|
302
|
+
* Series color
|
|
303
|
+
*/
|
|
304
|
+
color?: string;
|
|
305
|
+
/**
|
|
306
|
+
* Key in data records for this series
|
|
307
|
+
*/
|
|
308
|
+
dataKey: string;
|
|
309
|
+
/**
|
|
310
|
+
* Key in data records for pre-formatted labels displayed above bars
|
|
311
|
+
*/
|
|
312
|
+
labelKey?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Display name for legend
|
|
315
|
+
*/
|
|
316
|
+
name?: string;
|
|
317
|
+
}[];
|
|
318
|
+
/**
|
|
319
|
+
* Chart type
|
|
320
|
+
*/
|
|
321
|
+
type?: "bar";
|
|
322
|
+
/**
|
|
323
|
+
* Key in data records for x-axis labels
|
|
324
|
+
*/
|
|
325
|
+
xAxisKey?: string;
|
|
326
|
+
}
|
|
224
327
|
/**
|
|
225
328
|
* Condition for Show component. Can be a comparison operator, logical AND, or logical OR. Supports nesting.
|
|
226
329
|
*/
|
|
@@ -249,14 +352,33 @@ export type ProteusCondition = ProteusAtomicCondition | {
|
|
|
249
352
|
})[]
|
|
250
353
|
];
|
|
251
354
|
};
|
|
355
|
+
export interface ProteusDataTable {
|
|
356
|
+
$type: "DataTable";
|
|
357
|
+
/**
|
|
358
|
+
* Column definitions
|
|
359
|
+
*/
|
|
360
|
+
columns?: {
|
|
361
|
+
/**
|
|
362
|
+
* Key in data objects
|
|
363
|
+
*/
|
|
364
|
+
accessorKey: string;
|
|
365
|
+
/**
|
|
366
|
+
* Column header text
|
|
367
|
+
*/
|
|
368
|
+
header: string;
|
|
369
|
+
}[];
|
|
370
|
+
data?: ProteusValue | {
|
|
371
|
+
[k: string]: undefined | unknown;
|
|
372
|
+
}[];
|
|
373
|
+
}
|
|
252
374
|
export interface ProteusDocument {
|
|
253
375
|
$type: "Document";
|
|
254
376
|
/**
|
|
255
377
|
* Actions available for this document
|
|
256
378
|
*/
|
|
257
|
-
actions?:
|
|
379
|
+
actions?: (boolean | null | number | ProteusElement | string)[] | boolean | null | number | ProteusElement | string;
|
|
258
380
|
/**
|
|
259
|
-
*
|
|
381
|
+
* URL or data URI for the application icon (e.g., 'https://example.com/icon.png' or 'data:image/svg+xml,...'). Rendered as an <img> element.
|
|
260
382
|
*/
|
|
261
383
|
appIcon?: string;
|
|
262
384
|
/**
|
|
@@ -267,20 +389,23 @@ export interface ProteusDocument {
|
|
|
267
389
|
* If true, hides chat prompt and forces user interaction with document. User can press ESC or close to abandon.
|
|
268
390
|
*/
|
|
269
391
|
blocking?: boolean;
|
|
270
|
-
body: ProteusNode;
|
|
271
392
|
/**
|
|
272
|
-
* A
|
|
393
|
+
* A Proteus node can be a string, number, boolean, null, a single element, or an array of these types (similar to ReactNode)
|
|
394
|
+
*/
|
|
395
|
+
body: (boolean | null | number | ProteusElement | string)[] | boolean | null | number | ProteusElement | string;
|
|
396
|
+
/**
|
|
397
|
+
* A Proteus node can be a string, number, boolean, null, a single element, or an array of these types (similar to ReactNode)
|
|
273
398
|
*/
|
|
274
|
-
subtitle?: string;
|
|
399
|
+
subtitle?: (boolean | null | number | ProteusElement | string)[] | boolean | null | number | ProteusElement | string;
|
|
275
400
|
/**
|
|
276
|
-
* A
|
|
401
|
+
* A Proteus node can be a string, number, boolean, null, a single element, or an array of these types (similar to ReactNode)
|
|
277
402
|
*/
|
|
278
|
-
title: string;
|
|
403
|
+
title: (boolean | null | number | ProteusElement | string)[] | boolean | null | number | ProteusElement | string;
|
|
279
404
|
}
|
|
280
405
|
/**
|
|
281
406
|
* A single Proteus UI component element identified by its $type discriminator
|
|
282
407
|
*/
|
|
283
|
-
export type ProteusElement = ProteusAction | ProteusCancelAction | ProteusField | ProteusGroup | ProteusHeading | ProteusImage | ProteusInput | ProteusLink | ProteusMap | ProteusRange | ProteusSelect | ProteusSelectContent | ProteusSelectTrigger | ProteusSeparator | ProteusShow | ProteusText | ProteusTextarea | ProteusValue;
|
|
408
|
+
export type ProteusElement = ProteusAction | ProteusBadge | ProteusCancelAction | ProteusChart | ProteusDataTable | ProteusField | ProteusGroup | ProteusHeading | ProteusImage | ProteusInput | ProteusLink | ProteusMap | ProteusRange | ProteusSelect | ProteusSelectContent | ProteusSelectTrigger | ProteusSeparator | ProteusShow | ProteusText | ProteusTextarea | ProteusValue;
|
|
284
409
|
/**
|
|
285
410
|
* Handler for user interactions - either a server-side tool call or client-side message
|
|
286
411
|
*/
|
|
@@ -520,7 +645,7 @@ export interface ProteusImage {
|
|
|
520
645
|
/**
|
|
521
646
|
* Alternative text for the image
|
|
522
647
|
*/
|
|
523
|
-
alt?: string;
|
|
648
|
+
alt?: ProteusValue | string;
|
|
524
649
|
animation?: SprinklePropAnimation;
|
|
525
650
|
backgroundImage?: SprinklePropBackgroundImage;
|
|
526
651
|
bg?: SprinklePropBg;
|
|
@@ -573,7 +698,7 @@ export interface ProteusImage {
|
|
|
573
698
|
/**
|
|
574
699
|
* The image source URL
|
|
575
700
|
*/
|
|
576
|
-
src?: string;
|
|
701
|
+
src?: ProteusValue | string;
|
|
577
702
|
textAlign?: SprinklePropTextAlign;
|
|
578
703
|
textTransform?: SprinklePropTextTransform;
|
|
579
704
|
transition?: SprinklePropTransition;
|
|
@@ -732,13 +857,13 @@ export interface ProteusLink {
|
|
|
732
857
|
export interface ProteusMap {
|
|
733
858
|
$type: "Map";
|
|
734
859
|
/**
|
|
735
|
-
* Template object to render for each item in the array. Value paths are relative to current item.
|
|
860
|
+
* Template object to render for each item in the array. Value paths inside this template are relative to the current item (e.g., path='title' resolves to each item's 'title' field). Use a leading '/' to reference top-level data (e.g., path='/title' resolves to the root data's 'title').
|
|
736
861
|
*/
|
|
737
862
|
children?: {
|
|
738
863
|
[k: string]: undefined | unknown;
|
|
739
864
|
};
|
|
740
865
|
/**
|
|
741
|
-
* JSON pointer path to array (e.g., '/
|
|
866
|
+
* JSON pointer path to the source array in the data (e.g., '/results')
|
|
742
867
|
*/
|
|
743
868
|
path: string;
|
|
744
869
|
}
|
|
@@ -1070,6 +1195,10 @@ export interface ProteusText {
|
|
|
1070
1195
|
h?: SprinklePropH;
|
|
1071
1196
|
justifyContent?: SprinklePropJustifyContent;
|
|
1072
1197
|
justifyItems?: SprinklePropJustifyItems;
|
|
1198
|
+
/**
|
|
1199
|
+
* Truncate the text at specific number of lines.
|
|
1200
|
+
*/
|
|
1201
|
+
lineClamp?: "1" | "2" | "3" | "4";
|
|
1073
1202
|
m?: SprinklePropM;
|
|
1074
1203
|
maxH?: SprinklePropMaxH;
|
|
1075
1204
|
maxW?: SprinklePropMaxW;
|
|
@@ -1098,6 +1227,10 @@ export interface ProteusText {
|
|
|
1098
1227
|
textAlign?: SprinklePropTextAlign;
|
|
1099
1228
|
textTransform?: SprinklePropTextTransform;
|
|
1100
1229
|
transition?: SprinklePropTransition;
|
|
1230
|
+
/**
|
|
1231
|
+
* Whether to truncate the text and add an ellipsis at the end.
|
|
1232
|
+
*/
|
|
1233
|
+
truncate?: boolean;
|
|
1101
1234
|
w?: SprinklePropW;
|
|
1102
1235
|
whiteSpace?: SprinklePropWhiteSpace;
|
|
1103
1236
|
z?: SprinklePropZ;
|
|
@@ -1184,7 +1317,7 @@ export interface ProteusTextarea {
|
|
|
1184
1317
|
export interface ProteusValue {
|
|
1185
1318
|
$type: "Value";
|
|
1186
1319
|
/**
|
|
1187
|
-
*
|
|
1320
|
+
* Path to a value in the data. Absolute paths start with '/' and resolve from the root (e.g., '/title', '/options/0/label'). Inside a Map template, paths without a leading '/' are relative to the current item (e.g., 'title' resolves to each item's 'title' field).
|
|
1188
1321
|
*/
|
|
1189
1322
|
path: string;
|
|
1190
1323
|
}
|
|
@@ -1429,7 +1562,10 @@ export type SprinklePropZ = "0" | "10" | "20" | "30" | "auto" | "popover" | "toa
|
|
|
1429
1562
|
*/
|
|
1430
1563
|
export declare const UI: {
|
|
1431
1564
|
Action: (props: Omit<ProteusAction, "$type">) => ProteusAction;
|
|
1565
|
+
Badge: (props: Omit<ProteusBadge, "$type">) => ProteusBadge;
|
|
1432
1566
|
CancelAction: (props: Omit<ProteusCancelAction, "$type">) => ProteusCancelAction;
|
|
1567
|
+
Chart: (props: Omit<ProteusChart, "$type">) => ProteusChart;
|
|
1568
|
+
DataTable: (props: Omit<ProteusDataTable, "$type">) => ProteusDataTable;
|
|
1433
1569
|
Document: (props: Omit<ProteusDocument, "$type">) => ProteusDocument;
|
|
1434
1570
|
Field: (props: Omit<ProteusField, "$type">) => ProteusField;
|
|
1435
1571
|
Group: (props: Omit<ProteusGroup, "$type">) => ProteusGroup;
|
package/dist/proteus.js
CHANGED
|
@@ -19,7 +19,19 @@ exports.UI = {
|
|
|
19
19
|
$type: "Action",
|
|
20
20
|
...props,
|
|
21
21
|
}),
|
|
22
|
+
Badge: (props) => ({
|
|
23
|
+
$type: "Badge",
|
|
24
|
+
...props,
|
|
25
|
+
}),
|
|
22
26
|
CancelAction: (props) => ({ $type: "CancelAction", ...props }),
|
|
27
|
+
Chart: (props) => ({
|
|
28
|
+
$type: "Chart",
|
|
29
|
+
...props,
|
|
30
|
+
}),
|
|
31
|
+
DataTable: (props) => ({
|
|
32
|
+
$type: "DataTable",
|
|
33
|
+
...props,
|
|
34
|
+
}),
|
|
23
35
|
Document: (props) => ({
|
|
24
36
|
$type: "Document",
|
|
25
37
|
...props,
|
package/package.json
CHANGED
package/src/proteus.ts
CHANGED
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
export type OpalProteusDocumentSpecification =
|
|
8
8
|
| ProteusAction
|
|
9
9
|
| ProteusAtomicCondition
|
|
10
|
+
| ProteusBadge
|
|
10
11
|
| ProteusCancelAction
|
|
12
|
+
| ProteusChart
|
|
11
13
|
| ProteusCondition
|
|
14
|
+
| ProteusDataTable
|
|
12
15
|
| ProteusDocument
|
|
13
16
|
| ProteusElement
|
|
14
17
|
| ProteusEventHandler
|
|
@@ -199,6 +202,77 @@ export type ProteusAtomicCondition =
|
|
|
199
202
|
*/
|
|
200
203
|
"!!": boolean | null | number | ProteusValue | string;
|
|
201
204
|
};
|
|
205
|
+
export interface ProteusBadge {
|
|
206
|
+
$type: "Badge";
|
|
207
|
+
alignItems?: SprinklePropAlignItems;
|
|
208
|
+
alignSelf?: SprinklePropAlignSelf;
|
|
209
|
+
animation?: SprinklePropAnimation;
|
|
210
|
+
backgroundImage?: SprinklePropBackgroundImage;
|
|
211
|
+
bg?: SprinklePropBg;
|
|
212
|
+
border?: SprinklePropBorder;
|
|
213
|
+
borderB?: SprinklePropBorderB;
|
|
214
|
+
borderColor?: SprinklePropBorderColor;
|
|
215
|
+
borderL?: SprinklePropBorderL;
|
|
216
|
+
borderR?: SprinklePropBorderR;
|
|
217
|
+
borderT?: SprinklePropBorderT;
|
|
218
|
+
children?: ProteusNode;
|
|
219
|
+
color?: SprinklePropColor;
|
|
220
|
+
cursor?: SprinklePropCursor;
|
|
221
|
+
display?: SprinklePropDisplay;
|
|
222
|
+
flex?: SprinklePropFlex;
|
|
223
|
+
flexDirection?: SprinklePropFlexDirection;
|
|
224
|
+
flexWrap?: SprinklePropFlexWrap;
|
|
225
|
+
fontFamily?: SprinklePropFontFamily;
|
|
226
|
+
fontSize?: SprinklePropFontSize;
|
|
227
|
+
fontWeight?: SprinklePropFontWeight;
|
|
228
|
+
gap?: SprinklePropGap;
|
|
229
|
+
gridColumn?: SprinklePropGridColumn;
|
|
230
|
+
gridTemplateColumns?: SprinklePropGridTemplateColumns;
|
|
231
|
+
h?: SprinklePropH;
|
|
232
|
+
/**
|
|
233
|
+
* Control the appearance by selecting between the different badge types.
|
|
234
|
+
*/
|
|
235
|
+
intent?:
|
|
236
|
+
| "danger"
|
|
237
|
+
| "information"
|
|
238
|
+
| "neutral"
|
|
239
|
+
| "primary"
|
|
240
|
+
| "success"
|
|
241
|
+
| "warning";
|
|
242
|
+
justifyContent?: SprinklePropJustifyContent;
|
|
243
|
+
justifyItems?: SprinklePropJustifyItems;
|
|
244
|
+
m?: SprinklePropM;
|
|
245
|
+
maxH?: SprinklePropMaxH;
|
|
246
|
+
maxW?: SprinklePropMaxW;
|
|
247
|
+
mb?: SprinklePropMb;
|
|
248
|
+
ml?: SprinklePropMl;
|
|
249
|
+
mr?: SprinklePropMr;
|
|
250
|
+
mt?: SprinklePropMt;
|
|
251
|
+
mx?: SprinklePropMx;
|
|
252
|
+
my?: SprinklePropMy;
|
|
253
|
+
objectFit?: SprinklePropObjectFit;
|
|
254
|
+
overflow?: SprinklePropOverflow;
|
|
255
|
+
overflowX?: SprinklePropOverflowX;
|
|
256
|
+
overflowY?: SprinklePropOverflowY;
|
|
257
|
+
p?: SprinklePropP;
|
|
258
|
+
pb?: SprinklePropPb;
|
|
259
|
+
pl?: SprinklePropPl;
|
|
260
|
+
placeItems?: SprinklePropPlaceItems;
|
|
261
|
+
pointerEvents?: SprinklePropPointerEvents;
|
|
262
|
+
pr?: SprinklePropPr;
|
|
263
|
+
pt?: SprinklePropPt;
|
|
264
|
+
px?: SprinklePropPx;
|
|
265
|
+
py?: SprinklePropPy;
|
|
266
|
+
rounded?: SprinklePropRounded;
|
|
267
|
+
shadow?: SprinklePropShadow;
|
|
268
|
+
size?: SprinklePropSize;
|
|
269
|
+
textAlign?: SprinklePropTextAlign;
|
|
270
|
+
textTransform?: SprinklePropTextTransform;
|
|
271
|
+
transition?: SprinklePropTransition;
|
|
272
|
+
w?: SprinklePropW;
|
|
273
|
+
whiteSpace?: SprinklePropWhiteSpace;
|
|
274
|
+
z?: SprinklePropZ;
|
|
275
|
+
}
|
|
202
276
|
export interface ProteusCancelAction {
|
|
203
277
|
$type: "CancelAction";
|
|
204
278
|
alignItems?: SprinklePropAlignItems;
|
|
@@ -263,6 +337,46 @@ export interface ProteusCancelAction {
|
|
|
263
337
|
whiteSpace?: SprinklePropWhiteSpace;
|
|
264
338
|
z?: SprinklePropZ;
|
|
265
339
|
}
|
|
340
|
+
export interface ProteusChart {
|
|
341
|
+
$type: "Chart";
|
|
342
|
+
/**
|
|
343
|
+
* Chart data records, either inline or a ProteusValue reference
|
|
344
|
+
*/
|
|
345
|
+
data?:
|
|
346
|
+
| ProteusValue
|
|
347
|
+
| {
|
|
348
|
+
[k: string]: undefined | unknown;
|
|
349
|
+
}[];
|
|
350
|
+
/**
|
|
351
|
+
* Data series configuration
|
|
352
|
+
*/
|
|
353
|
+
series?: {
|
|
354
|
+
/**
|
|
355
|
+
* Series color
|
|
356
|
+
*/
|
|
357
|
+
color?: string;
|
|
358
|
+
/**
|
|
359
|
+
* Key in data records for this series
|
|
360
|
+
*/
|
|
361
|
+
dataKey: string;
|
|
362
|
+
/**
|
|
363
|
+
* Key in data records for pre-formatted labels displayed above bars
|
|
364
|
+
*/
|
|
365
|
+
labelKey?: string;
|
|
366
|
+
/**
|
|
367
|
+
* Display name for legend
|
|
368
|
+
*/
|
|
369
|
+
name?: string;
|
|
370
|
+
}[];
|
|
371
|
+
/**
|
|
372
|
+
* Chart type
|
|
373
|
+
*/
|
|
374
|
+
type?: "bar";
|
|
375
|
+
/**
|
|
376
|
+
* Key in data records for x-axis labels
|
|
377
|
+
*/
|
|
378
|
+
xAxisKey?: string;
|
|
379
|
+
}
|
|
266
380
|
/**
|
|
267
381
|
* Condition for Show component. Can be a comparison operator, logical AND, or logical OR. Supports nesting.
|
|
268
382
|
*/
|
|
@@ -299,14 +413,41 @@ export type ProteusCondition =
|
|
|
299
413
|
)[],
|
|
300
414
|
];
|
|
301
415
|
};
|
|
416
|
+
export interface ProteusDataTable {
|
|
417
|
+
$type: "DataTable";
|
|
418
|
+
/**
|
|
419
|
+
* Column definitions
|
|
420
|
+
*/
|
|
421
|
+
columns?: {
|
|
422
|
+
/**
|
|
423
|
+
* Key in data objects
|
|
424
|
+
*/
|
|
425
|
+
accessorKey: string;
|
|
426
|
+
/**
|
|
427
|
+
* Column header text
|
|
428
|
+
*/
|
|
429
|
+
header: string;
|
|
430
|
+
}[];
|
|
431
|
+
data?:
|
|
432
|
+
| ProteusValue
|
|
433
|
+
| {
|
|
434
|
+
[k: string]: undefined | unknown;
|
|
435
|
+
}[];
|
|
436
|
+
}
|
|
302
437
|
export interface ProteusDocument {
|
|
303
438
|
$type: "Document";
|
|
304
439
|
/**
|
|
305
440
|
* Actions available for this document
|
|
306
441
|
*/
|
|
307
|
-
actions?:
|
|
442
|
+
actions?:
|
|
443
|
+
| (boolean | null | number | ProteusElement | string)[]
|
|
444
|
+
| boolean
|
|
445
|
+
| null
|
|
446
|
+
| number
|
|
447
|
+
| ProteusElement
|
|
448
|
+
| string;
|
|
308
449
|
/**
|
|
309
|
-
*
|
|
450
|
+
* URL or data URI for the application icon (e.g., 'https://example.com/icon.png' or 'data:image/svg+xml,...'). Rendered as an <img> element.
|
|
310
451
|
*/
|
|
311
452
|
appIcon?: string;
|
|
312
453
|
/**
|
|
@@ -317,22 +458,46 @@ export interface ProteusDocument {
|
|
|
317
458
|
* If true, hides chat prompt and forces user interaction with document. User can press ESC or close to abandon.
|
|
318
459
|
*/
|
|
319
460
|
blocking?: boolean;
|
|
320
|
-
body: ProteusNode;
|
|
321
461
|
/**
|
|
322
|
-
* A
|
|
462
|
+
* A Proteus node can be a string, number, boolean, null, a single element, or an array of these types (similar to ReactNode)
|
|
463
|
+
*/
|
|
464
|
+
body:
|
|
465
|
+
| (boolean | null | number | ProteusElement | string)[]
|
|
466
|
+
| boolean
|
|
467
|
+
| null
|
|
468
|
+
| number
|
|
469
|
+
| ProteusElement
|
|
470
|
+
| string;
|
|
471
|
+
/**
|
|
472
|
+
* A Proteus node can be a string, number, boolean, null, a single element, or an array of these types (similar to ReactNode)
|
|
323
473
|
*/
|
|
324
|
-
subtitle?:
|
|
474
|
+
subtitle?:
|
|
475
|
+
| (boolean | null | number | ProteusElement | string)[]
|
|
476
|
+
| boolean
|
|
477
|
+
| null
|
|
478
|
+
| number
|
|
479
|
+
| ProteusElement
|
|
480
|
+
| string;
|
|
325
481
|
/**
|
|
326
|
-
* A
|
|
482
|
+
* A Proteus node can be a string, number, boolean, null, a single element, or an array of these types (similar to ReactNode)
|
|
327
483
|
*/
|
|
328
|
-
title:
|
|
484
|
+
title:
|
|
485
|
+
| (boolean | null | number | ProteusElement | string)[]
|
|
486
|
+
| boolean
|
|
487
|
+
| null
|
|
488
|
+
| number
|
|
489
|
+
| ProteusElement
|
|
490
|
+
| string;
|
|
329
491
|
}
|
|
330
492
|
/**
|
|
331
493
|
* A single Proteus UI component element identified by its $type discriminator
|
|
332
494
|
*/
|
|
333
495
|
export type ProteusElement =
|
|
334
496
|
| ProteusAction
|
|
497
|
+
| ProteusBadge
|
|
335
498
|
| ProteusCancelAction
|
|
499
|
+
| ProteusChart
|
|
500
|
+
| ProteusDataTable
|
|
336
501
|
| ProteusField
|
|
337
502
|
| ProteusGroup
|
|
338
503
|
| ProteusHeading
|
|
@@ -608,7 +773,7 @@ export interface ProteusImage {
|
|
|
608
773
|
/**
|
|
609
774
|
* Alternative text for the image
|
|
610
775
|
*/
|
|
611
|
-
alt?: string;
|
|
776
|
+
alt?: ProteusValue | string;
|
|
612
777
|
animation?: SprinklePropAnimation;
|
|
613
778
|
backgroundImage?: SprinklePropBackgroundImage;
|
|
614
779
|
bg?: SprinklePropBg;
|
|
@@ -661,7 +826,7 @@ export interface ProteusImage {
|
|
|
661
826
|
/**
|
|
662
827
|
* The image source URL
|
|
663
828
|
*/
|
|
664
|
-
src?: string;
|
|
829
|
+
src?: ProteusValue | string;
|
|
665
830
|
textAlign?: SprinklePropTextAlign;
|
|
666
831
|
textTransform?: SprinklePropTextTransform;
|
|
667
832
|
transition?: SprinklePropTransition;
|
|
@@ -855,13 +1020,13 @@ export interface ProteusLink {
|
|
|
855
1020
|
export interface ProteusMap {
|
|
856
1021
|
$type: "Map";
|
|
857
1022
|
/**
|
|
858
|
-
* Template object to render for each item in the array. Value paths are relative to current item.
|
|
1023
|
+
* Template object to render for each item in the array. Value paths inside this template are relative to the current item (e.g., path='title' resolves to each item's 'title' field). Use a leading '/' to reference top-level data (e.g., path='/title' resolves to the root data's 'title').
|
|
859
1024
|
*/
|
|
860
1025
|
children?: {
|
|
861
1026
|
[k: string]: undefined | unknown;
|
|
862
1027
|
};
|
|
863
1028
|
/**
|
|
864
|
-
* JSON pointer path to array (e.g., '/
|
|
1029
|
+
* JSON pointer path to the source array in the data (e.g., '/results')
|
|
865
1030
|
*/
|
|
866
1031
|
path: string;
|
|
867
1032
|
}
|
|
@@ -1208,6 +1373,10 @@ export interface ProteusText {
|
|
|
1208
1373
|
h?: SprinklePropH;
|
|
1209
1374
|
justifyContent?: SprinklePropJustifyContent;
|
|
1210
1375
|
justifyItems?: SprinklePropJustifyItems;
|
|
1376
|
+
/**
|
|
1377
|
+
* Truncate the text at specific number of lines.
|
|
1378
|
+
*/
|
|
1379
|
+
lineClamp?: "1" | "2" | "3" | "4";
|
|
1211
1380
|
m?: SprinklePropM;
|
|
1212
1381
|
maxH?: SprinklePropMaxH;
|
|
1213
1382
|
maxW?: SprinklePropMaxW;
|
|
@@ -1236,6 +1405,10 @@ export interface ProteusText {
|
|
|
1236
1405
|
textAlign?: SprinklePropTextAlign;
|
|
1237
1406
|
textTransform?: SprinklePropTextTransform;
|
|
1238
1407
|
transition?: SprinklePropTransition;
|
|
1408
|
+
/**
|
|
1409
|
+
* Whether to truncate the text and add an ellipsis at the end.
|
|
1410
|
+
*/
|
|
1411
|
+
truncate?: boolean;
|
|
1239
1412
|
w?: SprinklePropW;
|
|
1240
1413
|
whiteSpace?: SprinklePropWhiteSpace;
|
|
1241
1414
|
z?: SprinklePropZ;
|
|
@@ -1322,7 +1495,7 @@ export interface ProteusTextarea {
|
|
|
1322
1495
|
export interface ProteusValue {
|
|
1323
1496
|
$type: "Value";
|
|
1324
1497
|
/**
|
|
1325
|
-
*
|
|
1498
|
+
* Path to a value in the data. Absolute paths start with '/' and resolve from the root (e.g., '/title', '/options/0/label'). Inside a Map template, paths without a leading '/' are relative to the current item (e.g., 'title' resolves to each item's 'title' field).
|
|
1326
1499
|
*/
|
|
1327
1500
|
path: string;
|
|
1328
1501
|
}
|
|
@@ -1762,6 +1935,7 @@ export type SprinklePropMy =
|
|
|
1762
1935
|
| "64"
|
|
1763
1936
|
| "80"
|
|
1764
1937
|
| "auto";
|
|
1938
|
+
|
|
1765
1939
|
/**
|
|
1766
1940
|
* Set the element's `object-fit` CSS property
|
|
1767
1941
|
*/
|
|
@@ -1774,7 +1948,6 @@ export type SprinklePropOverflow = "auto" | "hidden" | "visible";
|
|
|
1774
1948
|
* Set the element's `overflow-x` CSS property
|
|
1775
1949
|
*/
|
|
1776
1950
|
export type SprinklePropOverflowX = "auto" | "hidden" | "visible";
|
|
1777
|
-
|
|
1778
1951
|
/**
|
|
1779
1952
|
* Set the element's `overflow-y` CSS property
|
|
1780
1953
|
*/
|
|
@@ -2056,9 +2229,21 @@ export const UI = {
|
|
|
2056
2229
|
$type: "Action" as const,
|
|
2057
2230
|
...props,
|
|
2058
2231
|
}),
|
|
2232
|
+
Badge: (props: Omit<ProteusBadge, "$type">): ProteusBadge => ({
|
|
2233
|
+
$type: "Badge" as const,
|
|
2234
|
+
...props,
|
|
2235
|
+
}),
|
|
2059
2236
|
CancelAction: (
|
|
2060
2237
|
props: Omit<ProteusCancelAction, "$type">,
|
|
2061
2238
|
): ProteusCancelAction => ({ $type: "CancelAction" as const, ...props }),
|
|
2239
|
+
Chart: (props: Omit<ProteusChart, "$type">): ProteusChart => ({
|
|
2240
|
+
$type: "Chart" as const,
|
|
2241
|
+
...props,
|
|
2242
|
+
}),
|
|
2243
|
+
DataTable: (props: Omit<ProteusDataTable, "$type">): ProteusDataTable => ({
|
|
2244
|
+
$type: "DataTable" as const,
|
|
2245
|
+
...props,
|
|
2246
|
+
}),
|
|
2062
2247
|
Document: (props: Omit<ProteusDocument, "$type">): ProteusDocument => ({
|
|
2063
2248
|
$type: "Document" as const,
|
|
2064
2249
|
...props,
|