@apteva/apteva-kit 0.1.86 → 0.1.88
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/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +575 -447
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -131,6 +131,21 @@ interface ImageWidget extends Widget {
|
|
|
131
131
|
caption?: string;
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
+
interface FlowStep {
|
|
135
|
+
id: string;
|
|
136
|
+
label: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
status?: 'pending' | 'active' | 'completed' | 'error' | 'skipped';
|
|
139
|
+
}
|
|
140
|
+
interface FlowWidget extends Widget {
|
|
141
|
+
type: 'flow';
|
|
142
|
+
props: {
|
|
143
|
+
title?: string;
|
|
144
|
+
steps: FlowStep[];
|
|
145
|
+
direction?: 'vertical' | 'horizontal';
|
|
146
|
+
compact?: boolean;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
134
149
|
interface GalleryWidget extends Widget {
|
|
135
150
|
type: 'gallery';
|
|
136
151
|
props: {
|
|
@@ -215,6 +230,10 @@ declare const WIDGET_DEFINITIONS: {
|
|
|
215
230
|
readonly schema: "chartType: line|bar|pie, data: {labels, datasets}";
|
|
216
231
|
readonly example: "@ui:chart[{\"chartType\": \"bar\", \"data\": {\"labels\": [\"A\"], \"datasets\": [{\"label\": \"X\", \"data\": [10]}]}}]";
|
|
217
232
|
};
|
|
233
|
+
readonly flow: {
|
|
234
|
+
readonly schema: "title?, steps: [{id, label, description?, status?: pending|active|completed|error|skipped}], direction?: vertical|horizontal, compact? - Show task/process flow. Omit status for proposal view.";
|
|
235
|
+
readonly example: "@ui:flow[{\"title\": \"Plan\", \"steps\": [{\"id\": \"1\", \"label\": \"Step 1\", \"description\": \"Details\"}, {\"id\": \"2\", \"label\": \"Step 2\"}]}]";
|
|
236
|
+
};
|
|
218
237
|
};
|
|
219
238
|
type WidgetType = keyof typeof WIDGET_DEFINITIONS;
|
|
220
239
|
|
|
@@ -493,4 +512,4 @@ declare const mockMessages: Message[];
|
|
|
493
512
|
declare const mockThreads: Thread[];
|
|
494
513
|
declare const mockWidgets: Widget[];
|
|
495
514
|
|
|
496
|
-
export { type Action, type ActionEvent, AptevaClient, type AptevaClientConfig, type AptevaKitControl, Button, type ButtonGroupWidget, type ButtonWidget, Card, type CardWidget, type ChartWidget, Chat, type ChatHandle, type ChatMessage, type ChatProps, type ChatRequest, type ChatResponse, Command, type CommandProps, type CommandResult, type FormField, type FormWidget, type GalleryWidget, type ImageWidget, List, type ListItem, type ListWidget, type MapWidget, type Message, Prompt, type PromptProps, type SendMessageParams, Stream, type StreamChunk, type StreamProps, type SuggestedPrompt, type TableColumn, type TableWidget, type Thread, Threads, type ThreadsProps, type UseAptevaKitReturn, type Widget, Widgets, type WidgetsProps, aptevaClient, cn, getThemeScript, mockMessages, mockThreads, mockWidgets };
|
|
515
|
+
export { type Action, type ActionEvent, AptevaClient, type AptevaClientConfig, type AptevaKitControl, Button, type ButtonGroupWidget, type ButtonWidget, Card, type CardWidget, type ChartWidget, Chat, type ChatHandle, type ChatMessage, type ChatProps, type ChatRequest, type ChatResponse, Command, type CommandProps, type CommandResult, type FlowStep, type FlowWidget, type FormField, type FormWidget, type GalleryWidget, type ImageWidget, List, type ListItem, type ListWidget, type MapWidget, type Message, Prompt, type PromptProps, type SendMessageParams, Stream, type StreamChunk, type StreamProps, type SuggestedPrompt, type TableColumn, type TableWidget, type Thread, Threads, type ThreadsProps, type UseAptevaKitReturn, type Widget, Widgets, type WidgetsProps, aptevaClient, cn, getThemeScript, mockMessages, mockThreads, mockWidgets };
|
package/dist/index.d.ts
CHANGED
|
@@ -131,6 +131,21 @@ interface ImageWidget extends Widget {
|
|
|
131
131
|
caption?: string;
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
+
interface FlowStep {
|
|
135
|
+
id: string;
|
|
136
|
+
label: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
status?: 'pending' | 'active' | 'completed' | 'error' | 'skipped';
|
|
139
|
+
}
|
|
140
|
+
interface FlowWidget extends Widget {
|
|
141
|
+
type: 'flow';
|
|
142
|
+
props: {
|
|
143
|
+
title?: string;
|
|
144
|
+
steps: FlowStep[];
|
|
145
|
+
direction?: 'vertical' | 'horizontal';
|
|
146
|
+
compact?: boolean;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
134
149
|
interface GalleryWidget extends Widget {
|
|
135
150
|
type: 'gallery';
|
|
136
151
|
props: {
|
|
@@ -215,6 +230,10 @@ declare const WIDGET_DEFINITIONS: {
|
|
|
215
230
|
readonly schema: "chartType: line|bar|pie, data: {labels, datasets}";
|
|
216
231
|
readonly example: "@ui:chart[{\"chartType\": \"bar\", \"data\": {\"labels\": [\"A\"], \"datasets\": [{\"label\": \"X\", \"data\": [10]}]}}]";
|
|
217
232
|
};
|
|
233
|
+
readonly flow: {
|
|
234
|
+
readonly schema: "title?, steps: [{id, label, description?, status?: pending|active|completed|error|skipped}], direction?: vertical|horizontal, compact? - Show task/process flow. Omit status for proposal view.";
|
|
235
|
+
readonly example: "@ui:flow[{\"title\": \"Plan\", \"steps\": [{\"id\": \"1\", \"label\": \"Step 1\", \"description\": \"Details\"}, {\"id\": \"2\", \"label\": \"Step 2\"}]}]";
|
|
236
|
+
};
|
|
218
237
|
};
|
|
219
238
|
type WidgetType = keyof typeof WIDGET_DEFINITIONS;
|
|
220
239
|
|
|
@@ -493,4 +512,4 @@ declare const mockMessages: Message[];
|
|
|
493
512
|
declare const mockThreads: Thread[];
|
|
494
513
|
declare const mockWidgets: Widget[];
|
|
495
514
|
|
|
496
|
-
export { type Action, type ActionEvent, AptevaClient, type AptevaClientConfig, type AptevaKitControl, Button, type ButtonGroupWidget, type ButtonWidget, Card, type CardWidget, type ChartWidget, Chat, type ChatHandle, type ChatMessage, type ChatProps, type ChatRequest, type ChatResponse, Command, type CommandProps, type CommandResult, type FormField, type FormWidget, type GalleryWidget, type ImageWidget, List, type ListItem, type ListWidget, type MapWidget, type Message, Prompt, type PromptProps, type SendMessageParams, Stream, type StreamChunk, type StreamProps, type SuggestedPrompt, type TableColumn, type TableWidget, type Thread, Threads, type ThreadsProps, type UseAptevaKitReturn, type Widget, Widgets, type WidgetsProps, aptevaClient, cn, getThemeScript, mockMessages, mockThreads, mockWidgets };
|
|
515
|
+
export { type Action, type ActionEvent, AptevaClient, type AptevaClientConfig, type AptevaKitControl, Button, type ButtonGroupWidget, type ButtonWidget, Card, type CardWidget, type ChartWidget, Chat, type ChatHandle, type ChatMessage, type ChatProps, type ChatRequest, type ChatResponse, Command, type CommandProps, type CommandResult, type FlowStep, type FlowWidget, type FormField, type FormWidget, type GalleryWidget, type ImageWidget, List, type ListItem, type ListWidget, type MapWidget, type Message, Prompt, type PromptProps, type SendMessageParams, Stream, type StreamChunk, type StreamProps, type SuggestedPrompt, type TableColumn, type TableWidget, type Thread, Threads, type ThreadsProps, type UseAptevaKitReturn, type Widget, Widgets, type WidgetsProps, aptevaClient, cn, getThemeScript, mockMessages, mockThreads, mockWidgets };
|
package/dist/index.js
CHANGED
|
@@ -761,6 +761,10 @@ var WIDGET_DEFINITIONS = {
|
|
|
761
761
|
chart: {
|
|
762
762
|
schema: "chartType: line|bar|pie, data: {labels, datasets}",
|
|
763
763
|
example: '@ui:chart[{"chartType": "bar", "data": {"labels": ["A"], "datasets": [{"label": "X", "data": [10]}]}}]'
|
|
764
|
+
},
|
|
765
|
+
flow: {
|
|
766
|
+
schema: "title?, steps: [{id, label, description?, status?: pending|active|completed|error|skipped}], direction?: vertical|horizontal, compact? - Show task/process flow. Omit status for proposal view.",
|
|
767
|
+
example: '@ui:flow[{"title": "Plan", "steps": [{"id": "1", "label": "Step 1", "description": "Details"}, {"id": "2", "label": "Step 2"}]}]'
|
|
764
768
|
}
|
|
765
769
|
};
|
|
766
770
|
var ALL_WIDGET_TYPES = Object.keys(WIDGET_DEFINITIONS);
|
|
@@ -1204,6 +1208,126 @@ function Form({ widget, onAction }) {
|
|
|
1204
1208
|
] });
|
|
1205
1209
|
}
|
|
1206
1210
|
|
|
1211
|
+
// src/components/Widgets/widget-library/Image.tsx
|
|
1212
|
+
|
|
1213
|
+
function Image({ widget }) {
|
|
1214
|
+
const { src, alt, caption } = widget.props;
|
|
1215
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "figure", { className: "overflow-hidden rounded-xl", children: [
|
|
1216
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1217
|
+
"img",
|
|
1218
|
+
{
|
|
1219
|
+
src,
|
|
1220
|
+
alt,
|
|
1221
|
+
className: "w-full h-auto object-contain bg-neutral-100 dark:bg-neutral-800",
|
|
1222
|
+
loading: "lazy"
|
|
1223
|
+
}
|
|
1224
|
+
),
|
|
1225
|
+
caption && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "figcaption", { className: "mt-2 text-center text-sm text-neutral-600 dark:text-neutral-400", children: caption })
|
|
1226
|
+
] });
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
// src/components/Widgets/widget-library/Flow.tsx
|
|
1230
|
+
|
|
1231
|
+
function StepIcon({ status, isLast }) {
|
|
1232
|
+
if (status === "completed") {
|
|
1233
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-6 h-6 rounded-full bg-emerald-500 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-3.5 h-3.5 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) }) });
|
|
1234
|
+
}
|
|
1235
|
+
if (status === "active") {
|
|
1236
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-6 h-6 rounded-full bg-blue-500 flex items-center justify-center flex-shrink-0 animate-pulse", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-2 h-2 rounded-full bg-white" }) });
|
|
1237
|
+
}
|
|
1238
|
+
if (status === "error") {
|
|
1239
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-6 h-6 rounded-full bg-red-500 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-3.5 h-3.5 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) }) });
|
|
1240
|
+
}
|
|
1241
|
+
if (status === "skipped") {
|
|
1242
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-6 h-6 rounded-full bg-neutral-300 dark:bg-neutral-600 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-3.5 h-3.5 text-neutral-500 dark:text-neutral-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M20 12H4" }) }) });
|
|
1243
|
+
}
|
|
1244
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-6 h-6 rounded-full border-2 border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 flex-shrink-0" });
|
|
1245
|
+
}
|
|
1246
|
+
function VerticalFlow({ steps, compact }) {
|
|
1247
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "relative", children: steps.map((step, index) => {
|
|
1248
|
+
const isLast = index === steps.length - 1;
|
|
1249
|
+
const isCompleted = step.status === "completed";
|
|
1250
|
+
const isActive = step.status === "active";
|
|
1251
|
+
const isSkipped = step.status === "skipped";
|
|
1252
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative flex gap-3", children: [
|
|
1253
|
+
!isLast && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1254
|
+
"div",
|
|
1255
|
+
{
|
|
1256
|
+
className: `absolute left-[11px] top-6 w-0.5 ${compact ? "h-6" : "h-8"} ${isCompleted ? "bg-emerald-500" : "bg-neutral-200 dark:bg-neutral-700"}`
|
|
1257
|
+
}
|
|
1258
|
+
),
|
|
1259
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, StepIcon, { status: step.status, isLast }),
|
|
1260
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `${compact ? "pb-4" : "pb-6"} ${isLast ? "pb-0" : ""}`, children: [
|
|
1261
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1262
|
+
"div",
|
|
1263
|
+
{
|
|
1264
|
+
className: `font-medium text-sm ${isSkipped ? "text-neutral-400 dark:text-neutral-500 line-through" : isActive ? "text-blue-600 dark:text-blue-400" : "text-neutral-900 dark:text-neutral-100"}`,
|
|
1265
|
+
children: step.label
|
|
1266
|
+
}
|
|
1267
|
+
),
|
|
1268
|
+
step.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1269
|
+
"div",
|
|
1270
|
+
{
|
|
1271
|
+
className: `text-xs mt-0.5 ${isSkipped ? "text-neutral-300 dark:text-neutral-600" : "text-neutral-500 dark:text-neutral-400"}`,
|
|
1272
|
+
children: step.description
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1275
|
+
] })
|
|
1276
|
+
] }, step.id);
|
|
1277
|
+
}) });
|
|
1278
|
+
}
|
|
1279
|
+
function HorizontalFlow({ steps, compact }) {
|
|
1280
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-start gap-2 overflow-x-auto pb-2", children: steps.map((step, index) => {
|
|
1281
|
+
const isLast = index === steps.length - 1;
|
|
1282
|
+
const isCompleted = step.status === "completed";
|
|
1283
|
+
const isActive = step.status === "active";
|
|
1284
|
+
const isSkipped = step.status === "skipped";
|
|
1285
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center", children: [
|
|
1286
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center text-center min-w-[80px] max-w-[120px]", children: [
|
|
1287
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, StepIcon, { status: step.status, isLast }),
|
|
1288
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1289
|
+
"div",
|
|
1290
|
+
{
|
|
1291
|
+
className: `font-medium text-xs mt-2 ${isSkipped ? "text-neutral-400 dark:text-neutral-500 line-through" : isActive ? "text-blue-600 dark:text-blue-400" : "text-neutral-900 dark:text-neutral-100"}`,
|
|
1292
|
+
children: step.label
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1295
|
+
step.description && !compact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1296
|
+
"div",
|
|
1297
|
+
{
|
|
1298
|
+
className: `text-[10px] mt-0.5 ${isSkipped ? "text-neutral-300 dark:text-neutral-600" : "text-neutral-500 dark:text-neutral-400"}`,
|
|
1299
|
+
children: step.description
|
|
1300
|
+
}
|
|
1301
|
+
)
|
|
1302
|
+
] }),
|
|
1303
|
+
!isLast && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center px-1", children: [
|
|
1304
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1305
|
+
"div",
|
|
1306
|
+
{
|
|
1307
|
+
className: `w-8 h-0.5 ${isCompleted ? "bg-emerald-500" : "bg-neutral-200 dark:bg-neutral-700"}`
|
|
1308
|
+
}
|
|
1309
|
+
),
|
|
1310
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1311
|
+
"svg",
|
|
1312
|
+
{
|
|
1313
|
+
className: `w-2 h-2 -ml-0.5 ${isCompleted ? "text-emerald-500" : "text-neutral-300 dark:text-neutral-600"}`,
|
|
1314
|
+
fill: "currentColor",
|
|
1315
|
+
viewBox: "0 0 24 24",
|
|
1316
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z" })
|
|
1317
|
+
}
|
|
1318
|
+
)
|
|
1319
|
+
] })
|
|
1320
|
+
] }, step.id);
|
|
1321
|
+
}) });
|
|
1322
|
+
}
|
|
1323
|
+
function Flow({ widget }) {
|
|
1324
|
+
const { title, steps, direction = "vertical", compact } = widget.props;
|
|
1325
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-hidden", children: [
|
|
1326
|
+
title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-4 py-3 border-b border-neutral-200 dark:border-neutral-700", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-sm text-neutral-900 dark:text-neutral-100", children: title }) }),
|
|
1327
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `p-4 ${direction === "horizontal" ? "overflow-x-auto" : ""}`, children: direction === "horizontal" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HorizontalFlow, { steps, compact }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, VerticalFlow, { steps, compact }) })
|
|
1328
|
+
] });
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1207
1331
|
// src/components/Widgets/WidgetRenderer.tsx
|
|
1208
1332
|
|
|
1209
1333
|
function WidgetRenderer({ widget, onAction }) {
|
|
@@ -1221,6 +1345,10 @@ function WidgetRenderer({ widget, onAction }) {
|
|
|
1221
1345
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Table, { widget, onAction });
|
|
1222
1346
|
case "form":
|
|
1223
1347
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Form, { widget, onAction });
|
|
1348
|
+
case "image":
|
|
1349
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Image, { widget });
|
|
1350
|
+
case "flow":
|
|
1351
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Flow, { widget });
|
|
1224
1352
|
default:
|
|
1225
1353
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
|
|
1226
1354
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-yellow-800", children: [
|