ezux 1.1.13 → 1.1.15
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 +22 -0
- package/dist/EzContextMenu-9STA_8UL.cjs +1 -0
- package/dist/EzContextMenu-vcwZjlYv.js +288 -0
- package/dist/EzErrorBoundary-C7R4h7QH.cjs +1 -0
- package/dist/EzErrorBoundary-b-fGQvjw.js +74 -0
- package/dist/EzEventModal-C1ItJBxp.cjs +1 -0
- package/dist/EzEventModal-MDtx4Gwd.js +720 -0
- package/dist/EzFlow-B3oi5QvJ.js +2533 -0
- package/dist/EzFlow-BeiFmX7h.cjs +5 -0
- package/dist/EzGroupingPanel-B1B2B3Sc.js +107 -0
- package/dist/EzGroupingPanel-BGHywLsj.cjs +1 -0
- package/dist/EzKanban-CEPmBCZV.js +1589 -0
- package/dist/EzKanban-CsnJ80LW.cjs +2 -0
- package/dist/EzLayout-DYRKNOrI.cjs +1 -0
- package/dist/EzLayout-DyMI9A92.js +6986 -0
- package/dist/EzProvider-Df2qgeDn.js +975 -0
- package/dist/EzProvider-DntSad5M.cjs +1 -0
- package/dist/EzScheduler-CTYXyOG8.js +2737 -0
- package/dist/EzScheduler-CzL68fTe.cjs +1 -0
- package/dist/EzSchedulerQuickAdd-CPSPAjdk.cjs +1 -0
- package/dist/EzSchedulerQuickAdd-wXGn1L1c.js +124 -0
- package/dist/EzSchedulerToolbar-B5iXsdn2.cjs +1 -0
- package/dist/EzSchedulerToolbar-NdKzGgMo.js +306 -0
- package/dist/EzSignature-Bg9jJvHp.cjs +1 -0
- package/dist/EzSignature-CZk-iAb3.js +375 -0
- package/dist/EzTable-Bde5BUoE.cjs +3 -0
- package/dist/EzTable-CaCyWXNv.js +4291 -0
- package/dist/EzTableEditDialog-5CJ-i5FI.js +84 -0
- package/dist/EzTableEditDialog-DAPhmWxI.cjs +1 -0
- package/dist/EzTableFooter-B347PRkZ.js +35 -0
- package/dist/EzTableFooter-ZqHoQKYB.cjs +1 -0
- package/dist/EzTableToolbar-D4Qw-fwb.js +161 -0
- package/dist/EzTableToolbar-DNxAgMdI.cjs +1 -0
- package/dist/EzTreeView-ChsTltti.js +819 -0
- package/dist/EzTreeView-D8k-Wmxa.cjs +1 -0
- package/dist/HighlightText-BZ_1jMaA.js +56 -0
- package/dist/HighlightText-V5NgtV18.cjs +1 -0
- package/dist/KanbanBoard-BzIhmn-2.cjs +1 -0
- package/dist/KanbanBoard-DTsy_GAc.js +1698 -0
- package/dist/NotificationPanel-B0pVgPcO.js +55 -0
- package/dist/NotificationPanel-ulIs4r-0.cjs +1 -0
- package/dist/TooltipWrapper-66yWxRSD.js +44 -0
- package/dist/TooltipWrapper-QRc3qTIG.cjs +1 -0
- package/dist/advanced.cjs +10 -0
- package/dist/advanced.d.ts +2616 -0
- package/dist/advanced.es.js +401 -0
- package/dist/avatar-DOjSWi4R.js +24 -0
- package/dist/avatar-hWg4zkh7.cjs +1 -0
- package/dist/button-BN0DK137.js +42 -0
- package/dist/button-CfngAt_5.cjs +1 -0
- package/dist/calendar-DEtDSI0W.js +112 -0
- package/dist/calendar-DroJGSPS.cjs +1 -0
- package/dist/card-CswobLmE.cjs +1 -0
- package/dist/card-vtDNxeL3.js +50 -0
- package/dist/checkbox-BpxQa4HQ.cjs +1 -0
- package/dist/checkbox-CS_BOaA6.js +22 -0
- package/dist/chunk-D-qHiVGv.cjs +1 -0
- package/dist/date-time-picker-C6i4TdP7.js +127 -0
- package/dist/date-time-picker-CfHnqJDm.cjs +1 -0
- package/dist/dropdown-menu-HrOgNiFv.js +78 -0
- package/dist/dropdown-menu-Xjuk1Xa-.cjs +1 -0
- package/dist/ezux.css +2 -1
- package/dist/flow.cjs +1 -0
- package/dist/flow.d.ts +539 -0
- package/dist/flow.es.js +2 -0
- package/dist/index.cjs +3 -12
- package/dist/index.d.ts +385 -1368
- package/dist/index.es.js +230 -1041
- package/dist/input-BE8Mmo8X.js +13 -0
- package/dist/input-DPWRzn7K.cjs +1 -0
- package/dist/kanban.cjs +1 -1
- package/dist/kanban.es.js +4 -17
- package/dist/label-4cHst7uN.cjs +1 -0
- package/dist/label-BLMeK8-Z.js +14 -0
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +4 -0
- package/dist/layout.es.js +2 -20
- package/dist/mock-services.cjs +1 -0
- package/dist/mock-services.d.ts +273 -0
- package/dist/mock-services.es.js +161 -0
- package/dist/popover--Cf3FJ0g.cjs +1 -0
- package/dist/popover-CbakOivq.js +15 -0
- package/dist/rolldown-runtime-CAFD8bLK.js +11 -0
- package/dist/scheduler.cjs +1 -1
- package/dist/scheduler.d.ts +78 -3
- package/dist/scheduler.es.js +2 -11
- package/dist/scroll-area-CBllCk9n.js +35 -0
- package/dist/scroll-area-COOakfzY.cjs +1 -0
- package/dist/select-1vYIUsge.cjs +1 -0
- package/dist/select-Bes3Q6zL.js +43 -0
- package/dist/signature.cjs +1 -1
- package/dist/signature.es.js +2 -4
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +78 -24
- package/dist/table.es.js +2 -17
- package/dist/theme-vars.css +143 -135
- package/dist/tooltip-BRCnO0kH.cjs +1 -0
- package/dist/tooltip-CrhCAu6_.js +14 -0
- package/dist/treeview.cjs +1 -1
- package/dist/treeview.es.js +2 -954
- package/dist/useComponentState-CYR9x36s.js +57 -0
- package/dist/useComponentState-DqA-gi3-.cjs +1 -0
- package/dist/useImperativeAPI-CPRA9SCj.js +7 -0
- package/dist/useImperativeAPI-KOlk1Cvt.cjs +1 -0
- package/dist/useInitCoreServices-CRq0kPGA.cjs +1 -0
- package/dist/useInitCoreServices-lkTv2its.js +40 -0
- package/dist/useService-BkqWkhiU.js +10 -0
- package/dist/useService-CKITee_1.cjs +1 -0
- package/dist/useServiceState-BDTGXKyx.cjs +1 -0
- package/dist/useServiceState-CInpkGt2.js +21 -0
- package/dist/utils-DyS9jpam.cjs +1 -0
- package/dist/utils-hFRduYmq.js +8 -0
- package/package.json +42 -16
- package/dist/EzContextMenu-B6HBUjWv.cjs +0 -5
- package/dist/EzContextMenu-BSA_B6Pr.js +0 -3500
- package/dist/EzErrorBoundary-CEdz_hDo.cjs +0 -41
- package/dist/EzErrorBoundary-D4NBadES.js +0 -3727
- package/dist/EzEventModal-BUMp_BFi.js +0 -689
- package/dist/EzEventModal-xzHfzi0O.cjs +0 -1
- package/dist/EzGroupingPanel-BUsIYDRi.js +0 -143
- package/dist/EzGroupingPanel-D0HdSomF.cjs +0 -1
- package/dist/EzSchedulerQuickAdd-C653LTGh.js +0 -118
- package/dist/EzSchedulerQuickAdd-UnOWCpJd.cjs +0 -1
- package/dist/EzSchedulerToolbar-C-5OdRY6.cjs +0 -1
- package/dist/EzSchedulerToolbar-CO5jjDQg.js +0 -240
- package/dist/EzSignature-BaNesxwC.cjs +0 -1
- package/dist/EzSignature-D4EYwo9W.js +0 -419
- package/dist/EzTableEditDialog-Cd948V1C.js +0 -63
- package/dist/EzTableEditDialog-NiOubaMT.cjs +0 -1
- package/dist/EzTableFooter-CWjfGCjL.cjs +0 -1
- package/dist/EzTableFooter-DveD12RC.js +0 -54
- package/dist/EzTableToolbar-Bz8UWv6j.js +0 -246
- package/dist/EzTableToolbar-DHE7Bb1R.cjs +0 -1
- package/dist/HighlightText-8D6KEyBw.js +0 -68
- package/dist/HighlightText-LtZmzCle.cjs +0 -1
- package/dist/NotificationPanel-D2Y-_ahk.js +0 -68
- package/dist/NotificationPanel-zLxrtTGf.cjs +0 -1
- package/dist/TooltipWrapper-BrRTi5EJ.js +0 -2021
- package/dist/TooltipWrapper-DWts4bAI.cjs +0 -1
- package/dist/avatar-BeK0E4mn.js +0 -41
- package/dist/avatar-DZAaTK2f.cjs +0 -1
- package/dist/bell-DAz8P0BR.js +0 -14
- package/dist/bell-DOX2y38e.cjs +0 -1
- package/dist/calendar-BMZ8ddOf.cjs +0 -1
- package/dist/calendar-Dy3rVMW2.js +0 -90
- package/dist/checkbox-B0lGHUyy.cjs +0 -1
- package/dist/checkbox-boJRxICT.js +0 -46
- package/dist/chevron-down-C3s8jU6B.js +0 -5
- package/dist/chevron-down-DZVL7VHW.cjs +0 -1
- package/dist/chevron-left-BFr8XZyF.js +0 -5
- package/dist/chevron-left-HWhRo6IH.cjs +0 -1
- package/dist/circle-alert-77QqFR-z.cjs +0 -1
- package/dist/circle-alert-B2AMDd8N.js +0 -9
- package/dist/circle-x-Cv7bfIC_.js +0 -9
- package/dist/circle-x-DwVXxhXr.cjs +0 -1
- package/dist/date-time-picker-DTxHdPgQ.cjs +0 -1
- package/dist/date-time-picker-Dj2eftJI.js +0 -1636
- package/dist/download-0ZhO2XaW.cjs +0 -1
- package/dist/download-panVHmk6.js +0 -9
- package/dist/ellipsis-CuqNthAj.js +0 -9
- package/dist/ellipsis-CzlqJf-i.cjs +0 -1
- package/dist/grip-vertical-CSyDKBul.js +0 -12
- package/dist/grip-vertical-DZNBW1Dn.cjs +0 -1
- package/dist/index-B3ipEEhH.cjs +0 -2
- package/dist/index-BPPb7bcs.js +0 -3220
- package/dist/index-BQKw_Vho.js +0 -9604
- package/dist/index-C5STgBSy.js +0 -5203
- package/dist/index-C6NfgycP.js +0 -4644
- package/dist/index-D4f2ZdrG.cjs +0 -2
- package/dist/index-DUY1SqMo.cjs +0 -1
- package/dist/index-c1Zg--dt.cjs +0 -7
- package/dist/input-BgM_la4k.cjs +0 -1
- package/dist/input-jYQ5VKNR.js +0 -21
- package/dist/isBefore-C3Y_wbk3.js +0 -15
- package/dist/isBefore-Cp1ttk6q.cjs +0 -1
- package/dist/label-ClOW9UCt.js +0 -55
- package/dist/label-Dx6oDB-X.cjs +0 -1
- package/dist/layers-BA4i1fYX.js +0 -27
- package/dist/layers-xSPd-hz3.cjs +0 -1
- package/dist/popover-BJq1CKmi.cjs +0 -1
- package/dist/popover-Cmlb7w3R.js +0 -341
- package/dist/scroll-area-9fwpVNxT.js +0 -573
- package/dist/scroll-area-CwwZSSA4.cjs +0 -1
- package/dist/select-GxA46anr.cjs +0 -1
- package/dist/select-mDCun_IR.js +0 -35
- package/dist/settings-CvyjK75A.js +0 -31
- package/dist/settings-DKPknrt8.cjs +0 -1
- package/dist/sortable.esm-CsRPuXyD.cjs +0 -1
- package/dist/sortable.esm-CzMCDPet.js +0 -477
- package/dist/tooltip-B41iztKT.cjs +0 -1
- package/dist/tooltip-BCtrEe0z.js +0 -490
- package/dist/useComponentState-C87xXa5d.js +0 -64
- package/dist/useComponentState-DDgGbBXv.cjs +0 -1
- package/dist/useImperativeAPI-DXmCQvPL.js +0 -7
- package/dist/useImperativeAPI-DbZ3owSV.cjs +0 -1
- package/dist/useInitCoreServices-CwXv2p4S.cjs +0 -1
- package/dist/useInitCoreServices-D1WaWlaI.js +0 -3929
- package/dist/useService-8OoezWr8.cjs +0 -1
- package/dist/useService-BUi3uAqE.js +0 -10
- package/dist/useServiceState-BjpCjUn2.cjs +0 -1
- package/dist/useServiceState-VE-viK8b.js +0 -24
|
@@ -0,0 +1,2533 @@
|
|
|
1
|
+
import { t as e } from "./utils-hFRduYmq.js";
|
|
2
|
+
import { t } from "./button-BN0DK137.js";
|
|
3
|
+
import { t as n } from "./input-BE8Mmo8X.js";
|
|
4
|
+
import { a as r, i, n as a, r as o, t as s } from "./select-Bes3Q6zL.js";
|
|
5
|
+
import { a as c, o as l, r as u, s as d, t as f } from "./card-vtDNxeL3.js";
|
|
6
|
+
import p from "react";
|
|
7
|
+
import { AlertCircle as m, Box as h, CheckCircle2 as g, ChevronDown as _, ChevronLeft as v, ChevronRight as y, Circle as b, Clock as x, Cloud as S, Diamond as C, Download as w, GitBranch as T, GripVertical as ee, Hand as te, PanelLeft as ne, PanelLeftClose as re, Play as E, Redo2 as ie, RefreshCw as ae, Repeat as oe, Rocket as D, Save as se, Send as ce, Square as le, SquareStack as ue, Trash2 as de, Undo2 as fe, Upload as pe, User as O, Wand2 as me, X as he, Zap as k } from "lucide-react";
|
|
8
|
+
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
9
|
+
import { Background as ge, BaseEdge as _e, Controls as ve, EdgeLabelRenderer as ye, Handle as N, NodeResizer as P, Position as F, ReactFlow as be, ReactFlowProvider as xe, addEdge as Se, applyEdgeChanges as Ce, applyNodeChanges as we, getSmoothStepPath as Te, useReactFlow as Ee } from "@xyflow/react";
|
|
10
|
+
//#region src/components/EzFlow/nodes/StartNode.tsx
|
|
11
|
+
var De = p.memo(({ data: t, selected: n }) => {
|
|
12
|
+
let { label: r, description: i } = t;
|
|
13
|
+
return /* @__PURE__ */ M("div", {
|
|
14
|
+
className: e("group relative flex flex-col items-center gap-1 px-6 py-3 rounded-full", "border-2 transition-all duration-200", "bg-emerald-500/10 border-emerald-500/40 text-emerald-500", "shadow-[0_0_20px_rgba(16,185,129,0.08)]", n && "ring-4 ring-emerald-500/20 scale-105 border-emerald-500 shadow-[0_0_30px_rgba(16,185,129,0.2)]"),
|
|
15
|
+
role: "group",
|
|
16
|
+
"aria-label": `Start node: ${r || "Start"}`,
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ M("div", {
|
|
19
|
+
className: "flex items-center gap-2",
|
|
20
|
+
children: [/* @__PURE__ */ j(E, {
|
|
21
|
+
size: 14,
|
|
22
|
+
className: "fill-emerald-500"
|
|
23
|
+
}), /* @__PURE__ */ j("span", {
|
|
24
|
+
className: "text-[11px] font-black uppercase tracking-[0.2em]",
|
|
25
|
+
children: r || "START"
|
|
26
|
+
})]
|
|
27
|
+
}),
|
|
28
|
+
i && /* @__PURE__ */ j("span", {
|
|
29
|
+
className: "text-[8px] opacity-50 uppercase tracking-tight",
|
|
30
|
+
children: i
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ j(N, {
|
|
33
|
+
type: "source",
|
|
34
|
+
position: F.Bottom,
|
|
35
|
+
className: "!w-4 !h-4 !bg-emerald-500 !border-[3px] !border-background !-bottom-2 shadow-lg shadow-emerald-500/30",
|
|
36
|
+
"aria-label": "Output connection"
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
De.displayName = "StartNode";
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/EzFlow/nodes/EndNode.tsx
|
|
44
|
+
var I = p.memo(({ data: t, selected: n }) => {
|
|
45
|
+
let { label: r, description: i } = t;
|
|
46
|
+
return /* @__PURE__ */ M("div", {
|
|
47
|
+
className: e("group relative flex items-center gap-3 px-6 py-3 rounded-full", "border-2 transition-all duration-200", "bg-rose-500/10 border-rose-500/30 text-rose-400", "shadow-xl", n && "ring-4 ring-rose-500/20 scale-105 border-rose-500/60"),
|
|
48
|
+
role: "group",
|
|
49
|
+
"aria-label": `End node: ${r || "End"}`,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ j(N, {
|
|
52
|
+
type: "target",
|
|
53
|
+
position: F.Top,
|
|
54
|
+
className: "!w-4 !h-4 !bg-rose-500 !border-[3px] !border-background",
|
|
55
|
+
"aria-label": "Input connection"
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ j(le, {
|
|
58
|
+
size: 10,
|
|
59
|
+
className: "fill-rose-500 text-rose-500"
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ M("div", {
|
|
62
|
+
className: "flex flex-col",
|
|
63
|
+
children: [/* @__PURE__ */ j("span", {
|
|
64
|
+
className: "text-[11px] font-black uppercase tracking-[0.2em]",
|
|
65
|
+
children: r || "END"
|
|
66
|
+
}), i && /* @__PURE__ */ j("span", {
|
|
67
|
+
className: "text-[8px] opacity-40 uppercase tracking-tight",
|
|
68
|
+
children: i
|
|
69
|
+
})]
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
I.displayName = "EndNode";
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/components/EzFlow/nodes/DecisionNode.tsx
|
|
77
|
+
var L = p.memo(({ data: t, selected: n }) => {
|
|
78
|
+
let { label: r } = t, [i, a] = p.useState(!1);
|
|
79
|
+
return /* @__PURE__ */ M("div", {
|
|
80
|
+
className: "relative w-full h-full group",
|
|
81
|
+
onPointerDownCapture: (e) => {
|
|
82
|
+
let t = e.target.closest(".react-flow__resize-control");
|
|
83
|
+
if (t) {
|
|
84
|
+
let e = t.getAttribute("data-handlepos")?.includes("-");
|
|
85
|
+
a(!!e);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
role: "group",
|
|
89
|
+
"aria-label": `Decision node: ${r || "Decision"}`,
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ j(P, {
|
|
92
|
+
color: "oklch(var(--primary))",
|
|
93
|
+
isVisible: n,
|
|
94
|
+
minWidth: 100,
|
|
95
|
+
minHeight: 100,
|
|
96
|
+
keepAspectRatio: i,
|
|
97
|
+
handleClassName: e("!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm", "data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600", "data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400"),
|
|
98
|
+
lineClassName: "!border-indigo-500/30"
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ j(N, {
|
|
101
|
+
type: "target",
|
|
102
|
+
position: F.Top,
|
|
103
|
+
className: "!w-4 !h-4 !bg-amber-500 !border-2 !border-background !z-50",
|
|
104
|
+
style: { top: -8 },
|
|
105
|
+
"aria-label": "Input connection"
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ j(N, {
|
|
108
|
+
type: "source",
|
|
109
|
+
position: F.Right,
|
|
110
|
+
id: "yes",
|
|
111
|
+
className: "!w-4 !h-4 !bg-emerald-500 !border-2 !border-background !z-50",
|
|
112
|
+
style: {
|
|
113
|
+
right: -8,
|
|
114
|
+
top: "50%"
|
|
115
|
+
},
|
|
116
|
+
"aria-label": "Yes path"
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ j(N, {
|
|
119
|
+
type: "source",
|
|
120
|
+
position: F.Bottom,
|
|
121
|
+
id: "no",
|
|
122
|
+
className: "!w-4 !h-4 !bg-rose-500 !border-2 !border-background !z-50",
|
|
123
|
+
style: { bottom: -8 },
|
|
124
|
+
"aria-label": "No path"
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ j("div", {
|
|
127
|
+
className: e("absolute inset-0 transition-all duration-200", "border-2 border-amber-500/40 bg-amber-500/10 backdrop-blur-xl", n && "border-amber-500 bg-amber-500/20 shadow-[0_0_30px_rgba(245,158,11,0.3)]"),
|
|
128
|
+
style: { clipPath: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)" }
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ M("div", {
|
|
131
|
+
className: "absolute inset-0 flex flex-col items-center justify-center z-10 pointer-events-none px-6",
|
|
132
|
+
children: [/* @__PURE__ */ j("span", {
|
|
133
|
+
className: "text-[8px] uppercase font-black tracking-widest text-amber-500/80 mb-0.5",
|
|
134
|
+
children: "Decision"
|
|
135
|
+
}), /* @__PURE__ */ j("span", {
|
|
136
|
+
className: "text-[11px] font-bold leading-tight text-foreground text-center max-w-[70px] truncate",
|
|
137
|
+
children: r
|
|
138
|
+
})]
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ j("div", {
|
|
141
|
+
className: "absolute -right-8 top-1/2 -translate-y-1/2 text-[9px] font-black text-emerald-400 pointer-events-none tracking-widest select-none z-20",
|
|
142
|
+
children: "YES"
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ j("div", {
|
|
145
|
+
className: "absolute -bottom-5 left-1/2 -translate-x-1/2 text-[9px] font-black text-rose-400 pointer-events-none tracking-widest select-none z-20",
|
|
146
|
+
children: "NO"
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
L.displayName = "DecisionNode";
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/components/EzFlow/nodes/LoopNode.tsx
|
|
154
|
+
var R = p.memo(({ data: t, selected: n }) => {
|
|
155
|
+
let { label: r, description: i, maxIterations: a } = t, [o, s] = p.useState(!1);
|
|
156
|
+
return /* @__PURE__ */ M("div", {
|
|
157
|
+
className: "w-full h-full relative group",
|
|
158
|
+
onPointerDownCapture: (e) => {
|
|
159
|
+
let t = e.target.closest(".react-flow__resize-control");
|
|
160
|
+
if (t) {
|
|
161
|
+
let e = t.getAttribute("data-handlepos")?.includes("-");
|
|
162
|
+
s(!!e);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
children: [/* @__PURE__ */ j(P, {
|
|
166
|
+
color: "oklch(var(--primary))",
|
|
167
|
+
isVisible: n,
|
|
168
|
+
minWidth: 160,
|
|
169
|
+
minHeight: 80,
|
|
170
|
+
keepAspectRatio: o,
|
|
171
|
+
handleClassName: e("!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm", "data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600", "data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400"),
|
|
172
|
+
lineClassName: "!border-indigo-500/30"
|
|
173
|
+
}), /* @__PURE__ */ M(f, {
|
|
174
|
+
className: e("w-full h-full rounded-2xl transition-all duration-200 overflow-hidden", "border-2 border-orange-500/30 bg-orange-500/5 backdrop-blur-xl", n && "ring-2 ring-orange-500/40 border-orange-500 shadow-lg"),
|
|
175
|
+
role: "group",
|
|
176
|
+
"aria-label": `Loop node: ${r || "Loop"}`,
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ j(N, {
|
|
179
|
+
type: "target",
|
|
180
|
+
position: F.Top,
|
|
181
|
+
className: "!w-3.5 !h-3.5 !bg-orange-500 !border-[3px] !border-background !z-50",
|
|
182
|
+
"aria-label": "Input connection"
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ M(c, {
|
|
185
|
+
className: "p-4 space-y-1",
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ M("div", {
|
|
188
|
+
className: "flex items-center gap-2",
|
|
189
|
+
children: [/* @__PURE__ */ j("div", {
|
|
190
|
+
className: "flex items-center justify-center w-8 h-8 rounded-lg bg-orange-500/15",
|
|
191
|
+
children: /* @__PURE__ */ j(oe, {
|
|
192
|
+
size: 16,
|
|
193
|
+
className: "text-orange-500"
|
|
194
|
+
})
|
|
195
|
+
}), /* @__PURE__ */ M("div", {
|
|
196
|
+
className: "flex-1 min-w-0",
|
|
197
|
+
children: [/* @__PURE__ */ j("div", {
|
|
198
|
+
className: "text-[9px] uppercase font-bold tracking-widest text-orange-500/70",
|
|
199
|
+
children: "Loop"
|
|
200
|
+
}), /* @__PURE__ */ j(l, {
|
|
201
|
+
className: "text-sm font-semibold truncate",
|
|
202
|
+
children: r
|
|
203
|
+
})]
|
|
204
|
+
})]
|
|
205
|
+
}),
|
|
206
|
+
i && /* @__PURE__ */ j(u, {
|
|
207
|
+
className: "text-xs line-clamp-2",
|
|
208
|
+
children: i
|
|
209
|
+
}),
|
|
210
|
+
a && /* @__PURE__ */ M("div", {
|
|
211
|
+
className: "text-[10px] text-orange-400/80 font-medium",
|
|
212
|
+
children: [
|
|
213
|
+
"Max: ",
|
|
214
|
+
a,
|
|
215
|
+
" iterations"
|
|
216
|
+
]
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
}),
|
|
220
|
+
/* @__PURE__ */ j(N, {
|
|
221
|
+
type: "source",
|
|
222
|
+
position: F.Bottom,
|
|
223
|
+
className: "!w-3.5 !h-3.5 !bg-orange-500 !border-[3px] !border-background !z-50",
|
|
224
|
+
"aria-label": "Output connection"
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ j(N, {
|
|
227
|
+
type: "source",
|
|
228
|
+
position: F.Left,
|
|
229
|
+
id: "loop-back",
|
|
230
|
+
className: "!w-3 !h-3 !bg-orange-400/70 !border-2 !border-background !z-50",
|
|
231
|
+
"aria-label": "Loop back connection"
|
|
232
|
+
})
|
|
233
|
+
]
|
|
234
|
+
})]
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
R.displayName = "LoopNode";
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/components/EzFlow/nodes/ActionNode.tsx
|
|
240
|
+
var z = p.memo(({ data: t, selected: n }) => {
|
|
241
|
+
let { label: r, description: i, actionType: a } = t, [o, s] = p.useState(!1);
|
|
242
|
+
return /* @__PURE__ */ M("div", {
|
|
243
|
+
className: "w-full h-full relative group",
|
|
244
|
+
onPointerDownCapture: (e) => {
|
|
245
|
+
let t = e.target.closest(".react-flow__resize-control");
|
|
246
|
+
if (t) {
|
|
247
|
+
let e = t.getAttribute("data-handlepos")?.includes("-");
|
|
248
|
+
s(!!e);
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
children: [/* @__PURE__ */ j(P, {
|
|
252
|
+
color: "oklch(var(--primary))",
|
|
253
|
+
isVisible: n,
|
|
254
|
+
minWidth: 160,
|
|
255
|
+
minHeight: 80,
|
|
256
|
+
keepAspectRatio: o,
|
|
257
|
+
handleClassName: e("!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm", "data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600", "data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400"),
|
|
258
|
+
lineClassName: "!border-indigo-500/30"
|
|
259
|
+
}), /* @__PURE__ */ M(f, {
|
|
260
|
+
className: e("w-full h-full rounded-2xl transition-all duration-200 overflow-hidden", "border-2 border-blue-500/30 bg-blue-500/5 backdrop-blur-xl", n && "ring-2 ring-blue-500/40 border-blue-500 shadow-lg"),
|
|
261
|
+
role: "group",
|
|
262
|
+
"aria-label": `Action node: ${r || "Action"}`,
|
|
263
|
+
children: [
|
|
264
|
+
/* @__PURE__ */ j(N, {
|
|
265
|
+
type: "target",
|
|
266
|
+
position: F.Top,
|
|
267
|
+
className: "!w-3.5 !h-3.5 !bg-blue-500 !border-[3px] !border-background !z-50",
|
|
268
|
+
"aria-label": "Input connection"
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ M(c, {
|
|
271
|
+
className: "p-4 space-y-1",
|
|
272
|
+
children: [
|
|
273
|
+
/* @__PURE__ */ M("div", {
|
|
274
|
+
className: "flex items-center gap-2",
|
|
275
|
+
children: [/* @__PURE__ */ j("div", {
|
|
276
|
+
className: "flex items-center justify-center w-8 h-8 rounded-lg bg-blue-500/15",
|
|
277
|
+
children: /* @__PURE__ */ j(k, {
|
|
278
|
+
size: 16,
|
|
279
|
+
className: "text-blue-500"
|
|
280
|
+
})
|
|
281
|
+
}), /* @__PURE__ */ M("div", {
|
|
282
|
+
className: "flex-1 min-w-0",
|
|
283
|
+
children: [/* @__PURE__ */ j("div", {
|
|
284
|
+
className: "text-[9px] uppercase font-bold tracking-widest text-blue-500/70",
|
|
285
|
+
children: "Action"
|
|
286
|
+
}), /* @__PURE__ */ j(l, {
|
|
287
|
+
className: "text-sm font-semibold truncate",
|
|
288
|
+
children: r
|
|
289
|
+
})]
|
|
290
|
+
})]
|
|
291
|
+
}),
|
|
292
|
+
i && /* @__PURE__ */ j(u, {
|
|
293
|
+
className: "text-xs line-clamp-2",
|
|
294
|
+
children: i
|
|
295
|
+
}),
|
|
296
|
+
a && /* @__PURE__ */ j("div", {
|
|
297
|
+
className: "text-[10px] text-blue-400/80 font-medium mt-1",
|
|
298
|
+
children: a
|
|
299
|
+
})
|
|
300
|
+
]
|
|
301
|
+
}),
|
|
302
|
+
/* @__PURE__ */ j(N, {
|
|
303
|
+
type: "source",
|
|
304
|
+
position: F.Bottom,
|
|
305
|
+
className: "!w-3.5 !h-3.5 !bg-blue-500 !border-[3px] !border-background !z-50",
|
|
306
|
+
"aria-label": "Output connection"
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
})]
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
z.displayName = "ActionNode";
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/components/EzFlow/nodes/RequestNode.tsx
|
|
315
|
+
var B = p.memo(({ data: t, selected: n }) => {
|
|
316
|
+
let { label: r, description: i, method: a, url: o } = t, [s, d] = p.useState(!1);
|
|
317
|
+
return /* @__PURE__ */ M("div", {
|
|
318
|
+
className: "w-full h-full relative group",
|
|
319
|
+
onPointerDownCapture: (e) => {
|
|
320
|
+
let t = e.target.closest(".react-flow__resize-control");
|
|
321
|
+
if (t) {
|
|
322
|
+
let e = t.getAttribute("data-handlepos")?.includes("-");
|
|
323
|
+
d(!!e);
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
children: [/* @__PURE__ */ j(P, {
|
|
327
|
+
color: "oklch(var(--primary))",
|
|
328
|
+
isVisible: n,
|
|
329
|
+
minWidth: 200,
|
|
330
|
+
minHeight: 100,
|
|
331
|
+
keepAspectRatio: s,
|
|
332
|
+
handleClassName: e("!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm", "data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600", "data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400"),
|
|
333
|
+
lineClassName: "!border-indigo-500/30"
|
|
334
|
+
}), /* @__PURE__ */ M(f, {
|
|
335
|
+
className: e("w-full h-full rounded-2xl transition-all duration-200 overflow-hidden", "border-2 border-indigo-500/30 bg-indigo-500/5 backdrop-blur-xl", n && "ring-2 ring-indigo-500/40 border-indigo-500 shadow-lg"),
|
|
336
|
+
role: "group",
|
|
337
|
+
"aria-label": `Request node: ${r || "HTTP Request"}`,
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ j(N, {
|
|
340
|
+
type: "target",
|
|
341
|
+
position: F.Top,
|
|
342
|
+
className: "!w-3.5 !h-3.5 !bg-indigo-500 !border-[3px] !border-background !z-50",
|
|
343
|
+
"aria-label": "Input connection"
|
|
344
|
+
}),
|
|
345
|
+
/* @__PURE__ */ M(c, {
|
|
346
|
+
className: "p-4 space-y-1",
|
|
347
|
+
children: [
|
|
348
|
+
/* @__PURE__ */ M("div", {
|
|
349
|
+
className: "flex items-center gap-2",
|
|
350
|
+
children: [/* @__PURE__ */ j("div", {
|
|
351
|
+
className: "flex items-center justify-center w-8 h-8 rounded-lg bg-indigo-500/15",
|
|
352
|
+
children: /* @__PURE__ */ j(S, {
|
|
353
|
+
size: 16,
|
|
354
|
+
className: "text-indigo-500"
|
|
355
|
+
})
|
|
356
|
+
}), /* @__PURE__ */ M("div", {
|
|
357
|
+
className: "flex-1 min-w-0",
|
|
358
|
+
children: [/* @__PURE__ */ j("div", {
|
|
359
|
+
className: "text-[9px] uppercase font-bold tracking-widest text-indigo-500/70",
|
|
360
|
+
children: "HTTP Request"
|
|
361
|
+
}), /* @__PURE__ */ j(l, {
|
|
362
|
+
className: "text-sm font-semibold truncate",
|
|
363
|
+
children: r
|
|
364
|
+
})]
|
|
365
|
+
})]
|
|
366
|
+
}),
|
|
367
|
+
i && /* @__PURE__ */ j(u, {
|
|
368
|
+
className: "text-xs line-clamp-2",
|
|
369
|
+
children: i
|
|
370
|
+
}),
|
|
371
|
+
(a || o) && /* @__PURE__ */ M("div", {
|
|
372
|
+
className: "flex items-center gap-2 mt-1",
|
|
373
|
+
children: [a && /* @__PURE__ */ j("span", {
|
|
374
|
+
className: "text-[9px] font-black uppercase tracking-wider px-2 py-0.5 rounded-full bg-indigo-500/20 text-indigo-400",
|
|
375
|
+
children: a
|
|
376
|
+
}), o && /* @__PURE__ */ j("span", {
|
|
377
|
+
className: "text-[10px] text-muted-foreground truncate max-w-[120px]",
|
|
378
|
+
children: o
|
|
379
|
+
})]
|
|
380
|
+
})
|
|
381
|
+
]
|
|
382
|
+
}),
|
|
383
|
+
/* @__PURE__ */ j(N, {
|
|
384
|
+
type: "source",
|
|
385
|
+
position: F.Bottom,
|
|
386
|
+
className: "!w-3.5 !h-3.5 !bg-indigo-500 !border-[3px] !border-background !z-50",
|
|
387
|
+
"aria-label": "Output connection"
|
|
388
|
+
})
|
|
389
|
+
]
|
|
390
|
+
})]
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
B.displayName = "RequestNode";
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/components/EzFlow/nodes/DelayNode.tsx
|
|
396
|
+
var V = p.memo(({ data: t, selected: n }) => {
|
|
397
|
+
let { label: r, description: i, duration: a, unit: o } = t, s = () => a ? `${a} ${o || "minutes"}` : null, [d, m] = p.useState(!1);
|
|
398
|
+
return /* @__PURE__ */ M("div", {
|
|
399
|
+
className: "w-full h-full relative group",
|
|
400
|
+
onPointerDownCapture: (e) => {
|
|
401
|
+
let t = e.target.closest(".react-flow__resize-control");
|
|
402
|
+
if (t) {
|
|
403
|
+
let e = t.getAttribute("data-handlepos")?.includes("-");
|
|
404
|
+
m(!!e);
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
children: [/* @__PURE__ */ j(P, {
|
|
408
|
+
color: "oklch(var(--primary))",
|
|
409
|
+
isVisible: n,
|
|
410
|
+
minWidth: 160,
|
|
411
|
+
minHeight: 80,
|
|
412
|
+
keepAspectRatio: d,
|
|
413
|
+
handleClassName: e("!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm", "data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600", "data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400"),
|
|
414
|
+
lineClassName: "!border-indigo-500/30"
|
|
415
|
+
}), /* @__PURE__ */ M(f, {
|
|
416
|
+
className: e("w-full h-full rounded-2xl transition-all duration-200 overflow-hidden", "border-2 border-gray-400/30 bg-gray-500/5 backdrop-blur-xl", n && "ring-2 ring-gray-400/40 border-gray-400 shadow-lg"),
|
|
417
|
+
role: "group",
|
|
418
|
+
"aria-label": `Delay node: ${r || "Delay"}`,
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ j(N, {
|
|
421
|
+
type: "target",
|
|
422
|
+
position: F.Top,
|
|
423
|
+
className: "!w-3.5 !h-3.5 !bg-gray-400 !border-[3px] !border-background !z-50",
|
|
424
|
+
"aria-label": "Input connection"
|
|
425
|
+
}),
|
|
426
|
+
/* @__PURE__ */ M(c, {
|
|
427
|
+
className: "p-4 space-y-1",
|
|
428
|
+
children: [
|
|
429
|
+
/* @__PURE__ */ M("div", {
|
|
430
|
+
className: "flex items-center gap-2",
|
|
431
|
+
children: [/* @__PURE__ */ j("div", {
|
|
432
|
+
className: "flex items-center justify-center w-8 h-8 rounded-lg bg-gray-500/15",
|
|
433
|
+
children: /* @__PURE__ */ j(x, {
|
|
434
|
+
size: 16,
|
|
435
|
+
className: "text-gray-400"
|
|
436
|
+
})
|
|
437
|
+
}), /* @__PURE__ */ M("div", {
|
|
438
|
+
className: "flex-1 min-w-0",
|
|
439
|
+
children: [/* @__PURE__ */ j("div", {
|
|
440
|
+
className: "text-[9px] uppercase font-bold tracking-widest text-gray-400/70",
|
|
441
|
+
children: "Delay"
|
|
442
|
+
}), /* @__PURE__ */ j(l, {
|
|
443
|
+
className: "text-sm font-semibold truncate",
|
|
444
|
+
children: r
|
|
445
|
+
})]
|
|
446
|
+
})]
|
|
447
|
+
}),
|
|
448
|
+
i && /* @__PURE__ */ j(u, {
|
|
449
|
+
className: "text-xs line-clamp-2",
|
|
450
|
+
children: i
|
|
451
|
+
}),
|
|
452
|
+
s() && /* @__PURE__ */ M("div", {
|
|
453
|
+
className: "flex items-center gap-1.5 text-[10px] text-gray-400/80 font-medium mt-1",
|
|
454
|
+
children: [/* @__PURE__ */ j(x, { size: 10 }), s()]
|
|
455
|
+
})
|
|
456
|
+
]
|
|
457
|
+
}),
|
|
458
|
+
/* @__PURE__ */ j(N, {
|
|
459
|
+
type: "source",
|
|
460
|
+
position: F.Bottom,
|
|
461
|
+
className: "!w-3.5 !h-3.5 !bg-gray-400 !border-[3px] !border-background !z-50",
|
|
462
|
+
"aria-label": "Output connection"
|
|
463
|
+
})
|
|
464
|
+
]
|
|
465
|
+
})]
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
V.displayName = "DelayNode";
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/components/EzFlow/nodes/ApprovalNode.tsx
|
|
471
|
+
var Oe = p.memo(({ data: t, selected: n }) => {
|
|
472
|
+
let { label: r, description: i, approverRole: a, slaHours: o } = t, [s, d] = p.useState(!1);
|
|
473
|
+
return /* @__PURE__ */ M("div", {
|
|
474
|
+
className: "w-full h-full relative group",
|
|
475
|
+
onPointerDownCapture: (e) => {
|
|
476
|
+
let t = e.target.closest(".react-flow__resize-control");
|
|
477
|
+
if (t) {
|
|
478
|
+
let e = t.getAttribute("data-handlepos")?.includes("-");
|
|
479
|
+
d(!!e);
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
children: [/* @__PURE__ */ j(P, {
|
|
483
|
+
color: "oklch(var(--primary))",
|
|
484
|
+
isVisible: n,
|
|
485
|
+
minWidth: 200,
|
|
486
|
+
minHeight: 100,
|
|
487
|
+
keepAspectRatio: s,
|
|
488
|
+
handleClassName: e("!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm", "data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600", "data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400"),
|
|
489
|
+
lineClassName: "!border-indigo-500/30"
|
|
490
|
+
}), /* @__PURE__ */ M(f, {
|
|
491
|
+
className: e("w-full h-full rounded-2xl transition-all duration-200 overflow-hidden", "border-2 border-purple-500/30 bg-purple-500/5 backdrop-blur-xl", n && "ring-2 ring-purple-500/40 border-purple-500 shadow-lg"),
|
|
492
|
+
role: "group",
|
|
493
|
+
"aria-label": `Approval node: ${r || "Approval"}`,
|
|
494
|
+
children: [
|
|
495
|
+
/* @__PURE__ */ j(N, {
|
|
496
|
+
type: "target",
|
|
497
|
+
position: F.Top,
|
|
498
|
+
className: "!w-3.5 !h-3.5 !bg-purple-500 !border-[3px] !border-background !z-50",
|
|
499
|
+
"aria-label": "Input connection"
|
|
500
|
+
}),
|
|
501
|
+
/* @__PURE__ */ M(c, {
|
|
502
|
+
className: "p-4 space-y-1",
|
|
503
|
+
children: [
|
|
504
|
+
/* @__PURE__ */ M("div", {
|
|
505
|
+
className: "flex items-center gap-2",
|
|
506
|
+
children: [/* @__PURE__ */ j("div", {
|
|
507
|
+
className: "flex items-center justify-center w-8 h-8 rounded-lg bg-purple-500/15",
|
|
508
|
+
children: /* @__PURE__ */ j(O, {
|
|
509
|
+
size: 16,
|
|
510
|
+
className: "text-purple-500"
|
|
511
|
+
})
|
|
512
|
+
}), /* @__PURE__ */ M("div", {
|
|
513
|
+
className: "flex-1 min-w-0",
|
|
514
|
+
children: [/* @__PURE__ */ j("div", {
|
|
515
|
+
className: "text-[9px] uppercase font-bold tracking-widest text-purple-500/70",
|
|
516
|
+
children: "Approval"
|
|
517
|
+
}), /* @__PURE__ */ j(l, {
|
|
518
|
+
className: "text-sm font-semibold truncate",
|
|
519
|
+
children: r
|
|
520
|
+
})]
|
|
521
|
+
})]
|
|
522
|
+
}),
|
|
523
|
+
i && /* @__PURE__ */ j(u, {
|
|
524
|
+
className: "text-xs line-clamp-2",
|
|
525
|
+
children: i
|
|
526
|
+
}),
|
|
527
|
+
/* @__PURE__ */ M("div", {
|
|
528
|
+
className: "flex flex-col gap-1 mt-1",
|
|
529
|
+
children: [a && /* @__PURE__ */ M("div", {
|
|
530
|
+
className: "flex items-center gap-1.5 text-[10px] text-purple-400/80 font-medium",
|
|
531
|
+
children: [
|
|
532
|
+
/* @__PURE__ */ j(O, { size: 10 }),
|
|
533
|
+
" ",
|
|
534
|
+
a
|
|
535
|
+
]
|
|
536
|
+
}), o && /* @__PURE__ */ M("div", {
|
|
537
|
+
className: "flex items-center gap-1.5 text-[10px] text-purple-400/60 font-medium",
|
|
538
|
+
children: [
|
|
539
|
+
/* @__PURE__ */ j(x, { size: 10 }),
|
|
540
|
+
" ",
|
|
541
|
+
o,
|
|
542
|
+
"h SLA"
|
|
543
|
+
]
|
|
544
|
+
})]
|
|
545
|
+
})
|
|
546
|
+
]
|
|
547
|
+
}),
|
|
548
|
+
/* @__PURE__ */ j(N, {
|
|
549
|
+
type: "source",
|
|
550
|
+
position: F.Bottom,
|
|
551
|
+
id: "approved",
|
|
552
|
+
className: "!w-3.5 !h-3.5 !bg-emerald-500 !border-[3px] !border-background !z-50",
|
|
553
|
+
"aria-label": "Approved path"
|
|
554
|
+
}),
|
|
555
|
+
/* @__PURE__ */ j(N, {
|
|
556
|
+
type: "source",
|
|
557
|
+
position: F.Right,
|
|
558
|
+
id: "rejected",
|
|
559
|
+
className: "!w-3 !h-3 !bg-rose-500 !border-2 !border-background !z-50",
|
|
560
|
+
"aria-label": "Rejected path"
|
|
561
|
+
})
|
|
562
|
+
]
|
|
563
|
+
})]
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
Oe.displayName = "ApprovalNode";
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/components/EzFlow/nodes/GroupNode.tsx
|
|
569
|
+
var H = p.memo(({ data: t, selected: n }) => {
|
|
570
|
+
let { label: r, description: i } = t, [a, o] = p.useState(!1);
|
|
571
|
+
return /* @__PURE__ */ M("div", {
|
|
572
|
+
className: e("w-full h-full rounded-2xl transition-all duration-200 relative group", "border-2 border-dashed border-muted-foreground/20 bg-muted/5 backdrop-blur-sm", "p-4", n && "ring-2 ring-primary/30 border-primary/40 bg-muted/10"),
|
|
573
|
+
onPointerDownCapture: (e) => {
|
|
574
|
+
let t = e.target.closest(".react-flow__resize-control");
|
|
575
|
+
if (t) {
|
|
576
|
+
let e = t.getAttribute("data-handlepos")?.includes("-");
|
|
577
|
+
o(!!e);
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
role: "group",
|
|
581
|
+
"aria-label": `Group node: ${r || "Group"}`,
|
|
582
|
+
children: [
|
|
583
|
+
/* @__PURE__ */ j(P, {
|
|
584
|
+
color: "oklch(var(--primary))",
|
|
585
|
+
isVisible: n,
|
|
586
|
+
minWidth: 200,
|
|
587
|
+
minHeight: 150,
|
|
588
|
+
keepAspectRatio: a,
|
|
589
|
+
handleClassName: e("!w-3 !h-3 !bg-white !border-2 transition-all hover:!scale-125 !z-[70] shadow-sm", "data-[handlepos^='top-']:!rounded-sm data-[handlepos^='bottom-']:!rounded-sm !border-indigo-600", "data-[handlepos='top']:!rounded-full data-[handlepos='bottom']:!rounded-full data-[handlepos='left']:!rounded-full data-[handlepos='right']:!rounded-full !border-slate-400"),
|
|
590
|
+
lineClassName: "!border-indigo-500/30"
|
|
591
|
+
}),
|
|
592
|
+
/* @__PURE__ */ M("div", {
|
|
593
|
+
className: "flex items-center gap-2 mb-4 pb-2 border-b border-dashed border-muted-foreground/10",
|
|
594
|
+
children: [/* @__PURE__ */ j(h, {
|
|
595
|
+
size: 14,
|
|
596
|
+
className: "text-muted-foreground/60"
|
|
597
|
+
}), /* @__PURE__ */ j("span", {
|
|
598
|
+
className: "text-[10px] font-bold uppercase tracking-widest text-muted-foreground/60",
|
|
599
|
+
children: r || "Sub-process"
|
|
600
|
+
})]
|
|
601
|
+
}),
|
|
602
|
+
i && /* @__PURE__ */ j("p", {
|
|
603
|
+
className: "text-[10px] text-muted-foreground/40 mb-4",
|
|
604
|
+
children: i
|
|
605
|
+
}),
|
|
606
|
+
/* @__PURE__ */ j(N, {
|
|
607
|
+
type: "target",
|
|
608
|
+
position: F.Top,
|
|
609
|
+
className: "!w-3 !h-3 !bg-muted-foreground/40 !border-2 !border-background",
|
|
610
|
+
"aria-label": "Input connection"
|
|
611
|
+
}),
|
|
612
|
+
/* @__PURE__ */ j(N, {
|
|
613
|
+
type: "source",
|
|
614
|
+
position: F.Bottom,
|
|
615
|
+
className: "!w-3 !h-3 !bg-muted-foreground/40 !border-2 !border-background",
|
|
616
|
+
"aria-label": "Output connection"
|
|
617
|
+
})
|
|
618
|
+
]
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
H.displayName = "GroupNode";
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/components/EzFlow/EzFlowEdge.tsx
|
|
624
|
+
var ke = ({ sourceX: e, sourceY: n, targetX: r, targetY: i, sourcePosition: a, targetPosition: o, style: s = {}, markerEnd: c, selected: l, label: u, data: d, id: f, onDelete: p }) => {
|
|
625
|
+
let [m, h, g] = Te({
|
|
626
|
+
sourceX: e,
|
|
627
|
+
sourceY: n,
|
|
628
|
+
sourcePosition: a,
|
|
629
|
+
targetX: r,
|
|
630
|
+
targetY: i,
|
|
631
|
+
targetPosition: o,
|
|
632
|
+
borderRadius: 16
|
|
633
|
+
});
|
|
634
|
+
return /* @__PURE__ */ M(A, { children: [
|
|
635
|
+
/* @__PURE__ */ j(_e, {
|
|
636
|
+
path: m,
|
|
637
|
+
markerEnd: c,
|
|
638
|
+
style: {
|
|
639
|
+
...s,
|
|
640
|
+
strokeWidth: l ? 3 : 2,
|
|
641
|
+
stroke: l ? "oklch(var(--primary))" : "oklch(var(--foreground))",
|
|
642
|
+
transition: "stroke-width 0.2s ease, stroke 0.2s ease"
|
|
643
|
+
}
|
|
644
|
+
}),
|
|
645
|
+
(u || d?.label) && /* @__PURE__ */ j(ye, { children: /* @__PURE__ */ j("div", {
|
|
646
|
+
style: {
|
|
647
|
+
position: "absolute",
|
|
648
|
+
transform: `translate(-50%, -50%) translate(${h}px,${g}px)`,
|
|
649
|
+
pointerEvents: "all"
|
|
650
|
+
},
|
|
651
|
+
className: "nodrag nopan",
|
|
652
|
+
children: /* @__PURE__ */ j("div", {
|
|
653
|
+
className: "px-3 py-1 rounded-full bg-background/80 backdrop-blur-md border border-border text-[10px] font-bold uppercase tracking-widest text-primary shadow-lg",
|
|
654
|
+
children: u || d?.label
|
|
655
|
+
})
|
|
656
|
+
}) }),
|
|
657
|
+
l && /* @__PURE__ */ j(ye, { children: /* @__PURE__ */ j("div", {
|
|
658
|
+
style: {
|
|
659
|
+
position: "absolute",
|
|
660
|
+
transform: `translate(-50%, -50%) translate(${h}px,${g + 22}px)`,
|
|
661
|
+
pointerEvents: "all"
|
|
662
|
+
},
|
|
663
|
+
className: "nodrag nopan",
|
|
664
|
+
children: /* @__PURE__ */ j(t, {
|
|
665
|
+
variant: "destructive",
|
|
666
|
+
size: "icon",
|
|
667
|
+
className: "w-5 h-5 rounded-full shadow-md",
|
|
668
|
+
"aria-label": "Delete edge",
|
|
669
|
+
onClick: () => p?.(f),
|
|
670
|
+
children: /* @__PURE__ */ j(he, { className: "w-3 h-3" })
|
|
671
|
+
})
|
|
672
|
+
}) })
|
|
673
|
+
] });
|
|
674
|
+
};
|
|
675
|
+
ke.displayName = "EzFlowEdge";
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region src/components/EzFlow/EzConnectionLine.tsx
|
|
678
|
+
var Ae = ({ fromX: e, fromY: t, toX: n, toY: r, fromPosition: i, toPosition: a, fromHandle: o }) => {
|
|
679
|
+
let [s] = Te({
|
|
680
|
+
sourceX: e,
|
|
681
|
+
sourceY: t,
|
|
682
|
+
sourcePosition: i,
|
|
683
|
+
targetX: n,
|
|
684
|
+
targetY: r,
|
|
685
|
+
targetPosition: a,
|
|
686
|
+
borderRadius: 16
|
|
687
|
+
}), c = o?.id === "yes" || o?.id === "approved", l = o?.id === "no" || o?.id === "rejected", u = o?.id === "loop-back", d = c ? "oklch(0.627 0.154 160.06)" : l ? "oklch(0.577 0.245 27.325)" : u ? "oklch(0.7 0.15 45)" : "oklch(var(--primary))", f = c ? "YES?" : l ? "NO?" : u ? "LOOP" : "CONNECT";
|
|
688
|
+
return /* @__PURE__ */ M("g", { children: [
|
|
689
|
+
/* @__PURE__ */ j("path", {
|
|
690
|
+
fill: "none",
|
|
691
|
+
stroke: d,
|
|
692
|
+
strokeWidth: 2,
|
|
693
|
+
d: s,
|
|
694
|
+
style: { strokeDasharray: "6,4" }
|
|
695
|
+
}),
|
|
696
|
+
/* @__PURE__ */ j("circle", {
|
|
697
|
+
cx: n,
|
|
698
|
+
cy: r,
|
|
699
|
+
fill: "oklch(var(--background))",
|
|
700
|
+
r: 4,
|
|
701
|
+
stroke: d,
|
|
702
|
+
strokeWidth: 1.5
|
|
703
|
+
}),
|
|
704
|
+
/* @__PURE__ */ j("foreignObject", {
|
|
705
|
+
x: n + 10,
|
|
706
|
+
y: r - 12,
|
|
707
|
+
width: 80,
|
|
708
|
+
height: 30,
|
|
709
|
+
className: "pointer-events-none",
|
|
710
|
+
children: /* @__PURE__ */ j("div", {
|
|
711
|
+
className: "flex items-center",
|
|
712
|
+
children: /* @__PURE__ */ j("div", {
|
|
713
|
+
className: "px-2 py-0.5 rounded-full bg-background/80 backdrop-blur-md border border-border text-[8px] font-black uppercase tracking-tighter shadow-xl whitespace-nowrap",
|
|
714
|
+
style: { color: d },
|
|
715
|
+
children: f
|
|
716
|
+
})
|
|
717
|
+
})
|
|
718
|
+
})
|
|
719
|
+
] });
|
|
720
|
+
};
|
|
721
|
+
Ae.displayName = "EzConnectionLine";
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region src/components/EzFlow/EzFlowBackground.tsx
|
|
724
|
+
var je = (e) => /* @__PURE__ */ j(ge, {
|
|
725
|
+
...e,
|
|
726
|
+
color: "oklch(var(--border))",
|
|
727
|
+
variant: "dots",
|
|
728
|
+
gap: 24,
|
|
729
|
+
size: 1,
|
|
730
|
+
className: "opacity-40"
|
|
731
|
+
});
|
|
732
|
+
je.displayName = "EzFlowBackground";
|
|
733
|
+
//#endregion
|
|
734
|
+
//#region src/components/EzFlow/EzFlowControls.tsx
|
|
735
|
+
var Me = (e) => /* @__PURE__ */ j(ve, {
|
|
736
|
+
...e,
|
|
737
|
+
className: "!bg-card/80 !backdrop-blur-md !border !border-border !shadow-2xl !rounded-2xl !p-1 !flex !flex-row !gap-1 !m-4 !overflow-hidden",
|
|
738
|
+
showInteractive: !1,
|
|
739
|
+
"aria-label": "Canvas zoom and fit controls"
|
|
740
|
+
});
|
|
741
|
+
Me.displayName = "EzFlowControls";
|
|
742
|
+
//#endregion
|
|
743
|
+
//#region src/components/EzFlow/EzFlowCanvas.tsx
|
|
744
|
+
var Ne = {
|
|
745
|
+
startNode: De,
|
|
746
|
+
endNode: I,
|
|
747
|
+
decisionNode: L,
|
|
748
|
+
loopNode: R,
|
|
749
|
+
actionNode: z,
|
|
750
|
+
requestNode: B,
|
|
751
|
+
delayNode: V,
|
|
752
|
+
approvalNode: Oe,
|
|
753
|
+
groupNode: H
|
|
754
|
+
}, Pe = p.forwardRef(({ nodes: t, edges: n, onNodesChange: r, onEdgesChange: i, onConnect: a, onDrop: o, onDragOver: s, onNodeClick: c, onNodeDoubleClick: l, onEdgeClick: u, onEdgeDelete: d, onPaneClick: f, nodeTypes: m = Ne, edgeTypes: h, isValidConnection: g, snapToGrid: _ = !0, snapGrid: v = [15, 15], showGrid: y = !0, fitView: b = !1, readOnly: x = !1, className: S, style: C, ...w }, T) => {
|
|
755
|
+
let ee = p.useMemo(() => h ?? { ezEdge: (e) => /* @__PURE__ */ j(ke, {
|
|
756
|
+
...e,
|
|
757
|
+
onDelete: d
|
|
758
|
+
}) }, [h, d]), te = p.useCallback((e) => {
|
|
759
|
+
if (g) return g(e);
|
|
760
|
+
if (!e.source || !e.target || e.source === e.target) return !1;
|
|
761
|
+
let r = new Map(t.map((e) => [e.id, e])), i = /* @__PURE__ */ new Set(), a = [{
|
|
762
|
+
id: e.target,
|
|
763
|
+
path: [e.target]
|
|
764
|
+
}];
|
|
765
|
+
for (; a.length > 0;) {
|
|
766
|
+
let t = a.shift();
|
|
767
|
+
if (!(!t || i.has(t.id))) {
|
|
768
|
+
i.add(t.id);
|
|
769
|
+
for (let i of n) if (i.source === t.id) {
|
|
770
|
+
if (i.target === e.source) return [...t.path, i.target].some((e) => r.get(e)?.type === "loopNode");
|
|
771
|
+
a.push({
|
|
772
|
+
id: i.target,
|
|
773
|
+
path: [...t.path, i.target]
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return !0;
|
|
779
|
+
}, [
|
|
780
|
+
n,
|
|
781
|
+
g,
|
|
782
|
+
t
|
|
783
|
+
]);
|
|
784
|
+
return /* @__PURE__ */ j("div", {
|
|
785
|
+
ref: T,
|
|
786
|
+
className: e("w-full h-full min-h-0 relative", S),
|
|
787
|
+
style: C,
|
|
788
|
+
...w,
|
|
789
|
+
children: /* @__PURE__ */ M(be, {
|
|
790
|
+
nodes: t,
|
|
791
|
+
edges: n,
|
|
792
|
+
onNodesChange: x ? void 0 : r,
|
|
793
|
+
onEdgesChange: x ? void 0 : i,
|
|
794
|
+
onConnect: x ? void 0 : a,
|
|
795
|
+
onDrop: x ? void 0 : o,
|
|
796
|
+
onDragOver: x ? void 0 : s,
|
|
797
|
+
onNodeClick: c,
|
|
798
|
+
onNodeDoubleClick: l,
|
|
799
|
+
onEdgeClick: u,
|
|
800
|
+
onPaneClick: f,
|
|
801
|
+
nodeTypes: m,
|
|
802
|
+
edgeTypes: ee,
|
|
803
|
+
connectionLineComponent: Ae,
|
|
804
|
+
isValidConnection: te,
|
|
805
|
+
fitView: b,
|
|
806
|
+
defaultViewport: {
|
|
807
|
+
x: 0,
|
|
808
|
+
y: 0,
|
|
809
|
+
zoom: 1
|
|
810
|
+
},
|
|
811
|
+
panOnScroll: !0,
|
|
812
|
+
zoomOnScroll: !1,
|
|
813
|
+
snapToGrid: _,
|
|
814
|
+
snapGrid: v,
|
|
815
|
+
nodesDraggable: !x,
|
|
816
|
+
nodesConnectable: !x,
|
|
817
|
+
elementsSelectable: !x,
|
|
818
|
+
defaultEdgeOptions: {
|
|
819
|
+
type: "ezEdge",
|
|
820
|
+
animated: !0,
|
|
821
|
+
selectable: !0
|
|
822
|
+
},
|
|
823
|
+
proOptions: { hideAttribution: !0 },
|
|
824
|
+
children: [y && /* @__PURE__ */ j(je, {
|
|
825
|
+
gap: v[0],
|
|
826
|
+
size: 1.5
|
|
827
|
+
}), /* @__PURE__ */ j(Me, { "aria-label": "Canvas controls" })]
|
|
828
|
+
})
|
|
829
|
+
});
|
|
830
|
+
});
|
|
831
|
+
Pe.displayName = "EzFlowCanvas";
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region src/components/EzFlow/EzFlowToolbox.tsx
|
|
834
|
+
var U = ({ category: e, isExpanded: t, onToggle: n, onNodeActivate: r }) => {
|
|
835
|
+
let i = (e, t) => {
|
|
836
|
+
e.dataTransfer.setData("application/reactflow", t), e.dataTransfer.setData("text/plain", t), e.dataTransfer.effectAllowed = "move";
|
|
837
|
+
};
|
|
838
|
+
return /* @__PURE__ */ M("div", {
|
|
839
|
+
className: "mb-2",
|
|
840
|
+
children: [/* @__PURE__ */ M("button", {
|
|
841
|
+
className: "w-full flex items-center gap-2 px-3 py-2 rounded-xl text-[10px] font-black uppercase tracking-widest text-muted-foreground/60 hover:bg-muted/30 transition-colors",
|
|
842
|
+
onClick: n,
|
|
843
|
+
"aria-expanded": t,
|
|
844
|
+
"aria-label": `Toggle ${e.categoryKey} section`,
|
|
845
|
+
children: [j(t ? _ : y, { size: 12 }), e.categoryKey]
|
|
846
|
+
}), t && /* @__PURE__ */ j("div", {
|
|
847
|
+
className: "flex flex-col gap-1.5 mt-1 px-1",
|
|
848
|
+
children: e.items.map((e) => /* @__PURE__ */ M("div", {
|
|
849
|
+
className: "group relative flex items-center gap-3 p-3 rounded-xl bg-background/30 border border-transparent hover:border-primary/30 hover:bg-primary/5 transition-all cursor-grab active:cursor-grabbing",
|
|
850
|
+
onDragStart: (t) => i(t, e.type),
|
|
851
|
+
onDoubleClick: () => r?.(e),
|
|
852
|
+
onKeyDown: (t) => {
|
|
853
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), r?.(e));
|
|
854
|
+
},
|
|
855
|
+
draggable: !0,
|
|
856
|
+
role: "button",
|
|
857
|
+
tabIndex: 0,
|
|
858
|
+
"aria-label": `Drag ${e.labelKey} node`,
|
|
859
|
+
"data-ezflow-node-type": e.type,
|
|
860
|
+
children: [
|
|
861
|
+
/* @__PURE__ */ j("div", {
|
|
862
|
+
className: "absolute left-1 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-30 transition-opacity",
|
|
863
|
+
children: /* @__PURE__ */ j(ee, { size: 12 })
|
|
864
|
+
}),
|
|
865
|
+
/* @__PURE__ */ j("div", {
|
|
866
|
+
className: "flex items-center justify-center w-8 h-8 rounded-lg bg-primary/10 text-primary group-hover:scale-110 transition-transform ml-2",
|
|
867
|
+
children: e.icon
|
|
868
|
+
}),
|
|
869
|
+
/* @__PURE__ */ M("div", {
|
|
870
|
+
className: "flex flex-col min-w-0",
|
|
871
|
+
children: [/* @__PURE__ */ j("span", {
|
|
872
|
+
className: "text-xs font-bold leading-none mb-0.5 truncate",
|
|
873
|
+
children: e.labelKey
|
|
874
|
+
}), e.descriptionKey && /* @__PURE__ */ j("span", {
|
|
875
|
+
className: "text-[10px] text-muted-foreground leading-tight line-clamp-1",
|
|
876
|
+
children: e.descriptionKey
|
|
877
|
+
})]
|
|
878
|
+
})
|
|
879
|
+
]
|
|
880
|
+
}, e.type))
|
|
881
|
+
})]
|
|
882
|
+
});
|
|
883
|
+
}, Fe = ({ categories: n, title: r = "Node Library", className: i, collapsed: a = !1, onCollapsedChange: o, onNodeActivate: s }) => {
|
|
884
|
+
let [c, l] = p.useState(new Set(n.map((e) => e.category))), u = (e) => {
|
|
885
|
+
l((t) => {
|
|
886
|
+
let n = new Set(t);
|
|
887
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
888
|
+
});
|
|
889
|
+
};
|
|
890
|
+
return a ? /* @__PURE__ */ M("aside", {
|
|
891
|
+
className: e("p-2 border-r border-border bg-card/30 backdrop-blur-md flex flex-col items-center", i),
|
|
892
|
+
"aria-label": "Node Library (collapsed)",
|
|
893
|
+
children: [/* @__PURE__ */ j(t, {
|
|
894
|
+
variant: "ghost",
|
|
895
|
+
size: "icon",
|
|
896
|
+
className: "rounded-xl mb-2",
|
|
897
|
+
onClick: () => o?.(!1),
|
|
898
|
+
"aria-label": "Expand node library",
|
|
899
|
+
children: /* @__PURE__ */ j(ne, { size: 16 })
|
|
900
|
+
}), n.flatMap((e) => e.items.map((e) => /* @__PURE__ */ j("div", {
|
|
901
|
+
className: "w-10 h-10 flex items-center justify-center rounded-xl hover:bg-primary/10 cursor-grab active:cursor-grabbing transition-colors mb-1",
|
|
902
|
+
onDragStart: (t) => {
|
|
903
|
+
t.dataTransfer.setData("application/reactflow", e.type), t.dataTransfer.setData("text/plain", e.type), t.dataTransfer.effectAllowed = "move";
|
|
904
|
+
},
|
|
905
|
+
onDoubleClick: () => s?.(e),
|
|
906
|
+
onKeyDown: (t) => {
|
|
907
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), s?.(e));
|
|
908
|
+
},
|
|
909
|
+
draggable: !0,
|
|
910
|
+
title: e.labelKey,
|
|
911
|
+
role: "button",
|
|
912
|
+
tabIndex: 0,
|
|
913
|
+
"aria-label": `Drag ${e.labelKey} node`,
|
|
914
|
+
"data-ezflow-node-type": e.type,
|
|
915
|
+
children: e.icon
|
|
916
|
+
}, e.type)))]
|
|
917
|
+
}) : /* @__PURE__ */ M("aside", {
|
|
918
|
+
className: e("w-72 p-4 border-r border-border bg-card/30 backdrop-blur-md flex flex-col gap-2 overflow-y-auto", i),
|
|
919
|
+
"aria-label": "Node Library",
|
|
920
|
+
children: [/* @__PURE__ */ M("div", {
|
|
921
|
+
className: "flex items-center justify-between mb-2",
|
|
922
|
+
children: [/* @__PURE__ */ j("div", {
|
|
923
|
+
className: "text-[10px] uppercase font-black tracking-widest text-primary/60 px-1",
|
|
924
|
+
children: r
|
|
925
|
+
}), o && /* @__PURE__ */ j(t, {
|
|
926
|
+
variant: "ghost",
|
|
927
|
+
size: "icon",
|
|
928
|
+
className: "rounded-xl w-7 h-7",
|
|
929
|
+
onClick: () => o(!0),
|
|
930
|
+
"aria-label": "Collapse node library",
|
|
931
|
+
children: /* @__PURE__ */ j(re, { size: 14 })
|
|
932
|
+
})]
|
|
933
|
+
}), n.map((e) => /* @__PURE__ */ j(U, {
|
|
934
|
+
category: e,
|
|
935
|
+
isExpanded: c.has(e.category),
|
|
936
|
+
onToggle: () => u(e.category),
|
|
937
|
+
onNodeActivate: s
|
|
938
|
+
}, e.category))]
|
|
939
|
+
});
|
|
940
|
+
};
|
|
941
|
+
Fe.displayName = "EzFlowToolbox";
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region src/components/EzFlow/EzFlowHeader.tsx
|
|
944
|
+
var Ie = {
|
|
945
|
+
draft: {
|
|
946
|
+
className: "bg-amber-500/15 text-amber-500 border-amber-500/30",
|
|
947
|
+
label: "Draft"
|
|
948
|
+
},
|
|
949
|
+
live: {
|
|
950
|
+
className: "bg-emerald-500/15 text-emerald-500 border-emerald-500/30",
|
|
951
|
+
label: "Live"
|
|
952
|
+
},
|
|
953
|
+
archived: {
|
|
954
|
+
className: "bg-gray-500/15 text-gray-400 border-gray-500/30",
|
|
955
|
+
label: "Archived"
|
|
956
|
+
}
|
|
957
|
+
}, Le = ({ title: n, description: r, status: i = "draft", isDirty: a = !1, onTitleChange: o, onDescriptionChange: s, onSave: c, onPublish: l, onCancel: u, showGrid: d = !0, onShowGridChange: f, snapToGrid: m = !0, onSnapToGridChange: h, className: g }) => {
|
|
958
|
+
let [_, y] = p.useState(!1), [b, x] = p.useState(!1), [S, C] = p.useState(n), [w, T] = p.useState(r || ""), ee = p.useRef(null), te = p.useRef(null);
|
|
959
|
+
p.useEffect(() => {
|
|
960
|
+
C(n);
|
|
961
|
+
}, [n]), p.useEffect(() => {
|
|
962
|
+
T(r || "");
|
|
963
|
+
}, [r]);
|
|
964
|
+
let ne = () => {
|
|
965
|
+
y(!1), S !== n && o?.(S);
|
|
966
|
+
}, re = () => {
|
|
967
|
+
x(!1), w !== r && s?.(w);
|
|
968
|
+
}, E = () => {
|
|
969
|
+
a && !window.confirm("You have unsaved changes. Discard and exit?") || u?.();
|
|
970
|
+
}, ie = Ie[i];
|
|
971
|
+
return /* @__PURE__ */ M("header", {
|
|
972
|
+
className: e("h-16 border-b border-border flex items-center justify-between px-6 bg-card/50 backdrop-blur-xl shrink-0", g),
|
|
973
|
+
role: "banner",
|
|
974
|
+
"aria-label": "Workflow designer header",
|
|
975
|
+
children: [/* @__PURE__ */ M("div", {
|
|
976
|
+
className: "flex items-center gap-4 min-w-0",
|
|
977
|
+
children: [
|
|
978
|
+
/* @__PURE__ */ j(t, {
|
|
979
|
+
variant: "ghost",
|
|
980
|
+
size: "icon",
|
|
981
|
+
className: "rounded-xl shrink-0",
|
|
982
|
+
onClick: E,
|
|
983
|
+
"aria-label": "Go back",
|
|
984
|
+
children: /* @__PURE__ */ j(v, { size: 18 })
|
|
985
|
+
}),
|
|
986
|
+
/* @__PURE__ */ j("div", { className: "h-6 w-px bg-border shrink-0" }),
|
|
987
|
+
/* @__PURE__ */ M("div", {
|
|
988
|
+
className: "flex flex-col min-w-0",
|
|
989
|
+
children: [_ ? /* @__PURE__ */ j("input", {
|
|
990
|
+
ref: ee,
|
|
991
|
+
value: S,
|
|
992
|
+
onChange: (e) => C(e.target.value),
|
|
993
|
+
onBlur: ne,
|
|
994
|
+
onKeyDown: (e) => {
|
|
995
|
+
e.key === "Enter" && ne(), e.key === "Escape" && (C(n), y(!1));
|
|
996
|
+
},
|
|
997
|
+
className: "text-base font-bold bg-transparent border-none outline-none ring-0 p-0 text-foreground w-full",
|
|
998
|
+
autoFocus: !0,
|
|
999
|
+
"aria-label": "Workflow title"
|
|
1000
|
+
}) : /* @__PURE__ */ M("button", {
|
|
1001
|
+
className: "text-base font-bold text-left hover:text-primary transition-colors cursor-text truncate",
|
|
1002
|
+
onClick: () => {
|
|
1003
|
+
y(!0), setTimeout(() => ee.current?.focus(), 0);
|
|
1004
|
+
},
|
|
1005
|
+
"aria-label": `Workflow title: ${S}. Click to edit`,
|
|
1006
|
+
children: [S || "Untitled Workflow", a && /* @__PURE__ */ j("span", {
|
|
1007
|
+
className: "ml-2 text-[9px] text-muted-foreground/50 font-normal",
|
|
1008
|
+
children: "(unsaved)"
|
|
1009
|
+
})]
|
|
1010
|
+
}), b ? /* @__PURE__ */ j("input", {
|
|
1011
|
+
ref: te,
|
|
1012
|
+
value: w,
|
|
1013
|
+
onChange: (e) => T(e.target.value),
|
|
1014
|
+
onBlur: re,
|
|
1015
|
+
onKeyDown: (e) => {
|
|
1016
|
+
e.key === "Enter" && re(), e.key === "Escape" && (T(r || ""), x(!1));
|
|
1017
|
+
},
|
|
1018
|
+
className: "text-[10px] uppercase tracking-widest text-muted-foreground bg-transparent border-none outline-none ring-0 p-0 w-full",
|
|
1019
|
+
autoFocus: !0,
|
|
1020
|
+
"aria-label": "Workflow description"
|
|
1021
|
+
}) : /* @__PURE__ */ j("button", {
|
|
1022
|
+
className: "text-[10px] uppercase tracking-widest text-muted-foreground/50 text-left hover:text-muted-foreground transition-colors cursor-text truncate",
|
|
1023
|
+
onClick: () => {
|
|
1024
|
+
x(!0), setTimeout(() => te.current?.focus(), 0);
|
|
1025
|
+
},
|
|
1026
|
+
"aria-label": `Description: ${w || "Click to add description"}`,
|
|
1027
|
+
children: w || "Click to add description"
|
|
1028
|
+
})]
|
|
1029
|
+
}),
|
|
1030
|
+
/* @__PURE__ */ j("div", {
|
|
1031
|
+
className: e("shrink-0 px-3 py-1 rounded-full border text-[10px] font-bold uppercase tracking-widest", ie.className),
|
|
1032
|
+
role: "status",
|
|
1033
|
+
"aria-label": `Status: ${ie.label}`,
|
|
1034
|
+
children: ie.label
|
|
1035
|
+
})
|
|
1036
|
+
]
|
|
1037
|
+
}), /* @__PURE__ */ M("div", {
|
|
1038
|
+
className: "flex items-center gap-6 shrink-0",
|
|
1039
|
+
children: [/* @__PURE__ */ M("div", {
|
|
1040
|
+
className: "flex items-center gap-4 bg-background/40 px-4 py-1.5 rounded-2xl border border-border/10",
|
|
1041
|
+
children: [
|
|
1042
|
+
/* @__PURE__ */ M("label", {
|
|
1043
|
+
className: "flex items-center gap-2 cursor-pointer group",
|
|
1044
|
+
children: [/* @__PURE__ */ j("input", {
|
|
1045
|
+
type: "checkbox",
|
|
1046
|
+
checked: d,
|
|
1047
|
+
onChange: (e) => f?.(e.target.checked),
|
|
1048
|
+
className: "w-4 h-4 rounded border-border text-primary focus:ring-primary/20 transition-all cursor-pointer"
|
|
1049
|
+
}), /* @__PURE__ */ j("span", {
|
|
1050
|
+
className: "text-[10px] uppercase tracking-wider font-bold text-muted-foreground group-hover:text-foreground transition-colors",
|
|
1051
|
+
children: "Grid"
|
|
1052
|
+
})]
|
|
1053
|
+
}),
|
|
1054
|
+
/* @__PURE__ */ j("div", { className: "w-px h-4 bg-border/20" }),
|
|
1055
|
+
/* @__PURE__ */ M("label", {
|
|
1056
|
+
className: "flex items-center gap-2 cursor-pointer group",
|
|
1057
|
+
children: [/* @__PURE__ */ j("input", {
|
|
1058
|
+
type: "checkbox",
|
|
1059
|
+
checked: m,
|
|
1060
|
+
onChange: (e) => h?.(e.target.checked),
|
|
1061
|
+
className: "w-4 h-4 rounded border-border text-primary focus:ring-primary/20 transition-all cursor-pointer"
|
|
1062
|
+
}), /* @__PURE__ */ j("span", {
|
|
1063
|
+
className: "text-[10px] uppercase tracking-wider font-bold text-muted-foreground group-hover:text-foreground transition-colors",
|
|
1064
|
+
children: "Snap"
|
|
1065
|
+
})]
|
|
1066
|
+
})
|
|
1067
|
+
]
|
|
1068
|
+
}), /* @__PURE__ */ M("div", {
|
|
1069
|
+
className: "flex items-center gap-3",
|
|
1070
|
+
children: [
|
|
1071
|
+
/* @__PURE__ */ M(t, {
|
|
1072
|
+
variant: "ghost",
|
|
1073
|
+
className: "rounded-xl h-9 px-4 text-xs gap-2",
|
|
1074
|
+
onClick: E,
|
|
1075
|
+
"aria-label": "Cancel changes",
|
|
1076
|
+
children: [/* @__PURE__ */ j(he, { size: 14 }), "Cancel"]
|
|
1077
|
+
}),
|
|
1078
|
+
/* @__PURE__ */ M(t, {
|
|
1079
|
+
className: "rounded-xl h-9 px-6 bg-primary text-primary-foreground gap-2 shadow-lg shadow-primary/20 text-xs font-bold",
|
|
1080
|
+
onClick: c,
|
|
1081
|
+
"aria-label": "Save workflow",
|
|
1082
|
+
children: [/* @__PURE__ */ j(se, { size: 14 }), "Save"]
|
|
1083
|
+
}),
|
|
1084
|
+
l && /* @__PURE__ */ M(t, {
|
|
1085
|
+
variant: "secondary",
|
|
1086
|
+
className: "rounded-xl h-9 px-4 text-xs gap-2 font-bold",
|
|
1087
|
+
onClick: l,
|
|
1088
|
+
"aria-label": "Publish workflow",
|
|
1089
|
+
children: [/* @__PURE__ */ j(D, { size: 14 }), "Publish"]
|
|
1090
|
+
})
|
|
1091
|
+
]
|
|
1092
|
+
})]
|
|
1093
|
+
})]
|
|
1094
|
+
});
|
|
1095
|
+
};
|
|
1096
|
+
Le.displayName = "EzFlowHeader";
|
|
1097
|
+
//#endregion
|
|
1098
|
+
//#region src/components/EzFlow/EzWorkflowValidation.tsx
|
|
1099
|
+
var Re = {
|
|
1100
|
+
nodes: [],
|
|
1101
|
+
edges: [],
|
|
1102
|
+
viewport: {
|
|
1103
|
+
x: 0,
|
|
1104
|
+
y: 0,
|
|
1105
|
+
zoom: 1
|
|
1106
|
+
},
|
|
1107
|
+
metadata: {
|
|
1108
|
+
title: "Untitled Workflow",
|
|
1109
|
+
status: "draft",
|
|
1110
|
+
version: 1
|
|
1111
|
+
}
|
|
1112
|
+
}, W = {
|
|
1113
|
+
startNode: {
|
|
1114
|
+
label: "Start",
|
|
1115
|
+
triggerType: "manual"
|
|
1116
|
+
},
|
|
1117
|
+
endNode: {
|
|
1118
|
+
label: "End",
|
|
1119
|
+
outcome: "success"
|
|
1120
|
+
},
|
|
1121
|
+
decisionNode: {
|
|
1122
|
+
label: "Decision",
|
|
1123
|
+
branches: []
|
|
1124
|
+
},
|
|
1125
|
+
loopNode: {
|
|
1126
|
+
label: "Loop",
|
|
1127
|
+
iteratorSource: "",
|
|
1128
|
+
maxIterations: 10
|
|
1129
|
+
},
|
|
1130
|
+
actionNode: {
|
|
1131
|
+
label: "Action",
|
|
1132
|
+
actionType: "",
|
|
1133
|
+
config: {}
|
|
1134
|
+
},
|
|
1135
|
+
requestNode: {
|
|
1136
|
+
label: "API Request",
|
|
1137
|
+
method: "GET",
|
|
1138
|
+
url: ""
|
|
1139
|
+
},
|
|
1140
|
+
delayNode: {
|
|
1141
|
+
label: "Delay",
|
|
1142
|
+
duration: 1,
|
|
1143
|
+
unit: "hours"
|
|
1144
|
+
},
|
|
1145
|
+
approvalNode: {
|
|
1146
|
+
label: "Approval",
|
|
1147
|
+
approverRole: ""
|
|
1148
|
+
},
|
|
1149
|
+
groupNode: {
|
|
1150
|
+
label: "Group",
|
|
1151
|
+
collapsed: !1
|
|
1152
|
+
}
|
|
1153
|
+
}, ze = {
|
|
1154
|
+
startNode: {
|
|
1155
|
+
type: "startNode",
|
|
1156
|
+
label: "Start",
|
|
1157
|
+
description: "Workflow entry point",
|
|
1158
|
+
category: "flow_control",
|
|
1159
|
+
icon: /* @__PURE__ */ j(E, { size: 16 }),
|
|
1160
|
+
component: De,
|
|
1161
|
+
defaultData: W.startNode
|
|
1162
|
+
},
|
|
1163
|
+
endNode: {
|
|
1164
|
+
type: "endNode",
|
|
1165
|
+
label: "End",
|
|
1166
|
+
description: "Workflow completion",
|
|
1167
|
+
category: "flow_control",
|
|
1168
|
+
icon: /* @__PURE__ */ j(g, { size: 16 }),
|
|
1169
|
+
component: I,
|
|
1170
|
+
defaultData: W.endNode
|
|
1171
|
+
},
|
|
1172
|
+
decisionNode: {
|
|
1173
|
+
type: "decisionNode",
|
|
1174
|
+
label: "Decision",
|
|
1175
|
+
description: "Branch by condition",
|
|
1176
|
+
category: "logic",
|
|
1177
|
+
icon: /* @__PURE__ */ j(C, { size: 16 }),
|
|
1178
|
+
component: L,
|
|
1179
|
+
defaultData: W.decisionNode,
|
|
1180
|
+
requiredDataKeys: ["branches"]
|
|
1181
|
+
},
|
|
1182
|
+
loopNode: {
|
|
1183
|
+
type: "loopNode",
|
|
1184
|
+
label: "Loop",
|
|
1185
|
+
description: "Repeat a path",
|
|
1186
|
+
category: "flow_control",
|
|
1187
|
+
icon: /* @__PURE__ */ j(T, { size: 16 }),
|
|
1188
|
+
component: R,
|
|
1189
|
+
defaultData: W.loopNode,
|
|
1190
|
+
requiredDataKeys: ["iteratorSource"]
|
|
1191
|
+
},
|
|
1192
|
+
actionNode: {
|
|
1193
|
+
type: "actionNode",
|
|
1194
|
+
label: "Action",
|
|
1195
|
+
description: "Run an action",
|
|
1196
|
+
category: "execution",
|
|
1197
|
+
icon: /* @__PURE__ */ j(b, { size: 16 }),
|
|
1198
|
+
component: z,
|
|
1199
|
+
defaultData: W.actionNode,
|
|
1200
|
+
requiredDataKeys: ["actionType"]
|
|
1201
|
+
},
|
|
1202
|
+
requestNode: {
|
|
1203
|
+
type: "requestNode",
|
|
1204
|
+
label: "API Request",
|
|
1205
|
+
description: "Call an HTTP endpoint",
|
|
1206
|
+
category: "execution",
|
|
1207
|
+
icon: /* @__PURE__ */ j(ce, { size: 16 }),
|
|
1208
|
+
component: B,
|
|
1209
|
+
defaultData: W.requestNode,
|
|
1210
|
+
requiredDataKeys: ["url"]
|
|
1211
|
+
},
|
|
1212
|
+
delayNode: {
|
|
1213
|
+
type: "delayNode",
|
|
1214
|
+
label: "Delay",
|
|
1215
|
+
description: "Pause execution",
|
|
1216
|
+
category: "logic",
|
|
1217
|
+
icon: /* @__PURE__ */ j(x, { size: 16 }),
|
|
1218
|
+
component: V,
|
|
1219
|
+
defaultData: W.delayNode,
|
|
1220
|
+
requiredDataKeys: ["duration"]
|
|
1221
|
+
},
|
|
1222
|
+
approvalNode: {
|
|
1223
|
+
type: "approvalNode",
|
|
1224
|
+
label: "Approval",
|
|
1225
|
+
description: "Wait for a person",
|
|
1226
|
+
category: "human",
|
|
1227
|
+
icon: /* @__PURE__ */ j(te, { size: 16 }),
|
|
1228
|
+
component: Oe,
|
|
1229
|
+
defaultData: W.approvalNode,
|
|
1230
|
+
requiredDataKeys: ["approverRole"]
|
|
1231
|
+
},
|
|
1232
|
+
groupNode: {
|
|
1233
|
+
type: "groupNode",
|
|
1234
|
+
label: "Group",
|
|
1235
|
+
description: "Organize nodes",
|
|
1236
|
+
category: "structural",
|
|
1237
|
+
icon: /* @__PURE__ */ j(ue, { size: 16 }),
|
|
1238
|
+
component: H,
|
|
1239
|
+
defaultData: W.groupNode
|
|
1240
|
+
}
|
|
1241
|
+
}, G = [
|
|
1242
|
+
"flow_control",
|
|
1243
|
+
"logic",
|
|
1244
|
+
"execution",
|
|
1245
|
+
"human",
|
|
1246
|
+
"structural"
|
|
1247
|
+
], K = {
|
|
1248
|
+
flow_control: "Flow",
|
|
1249
|
+
logic: "Logic",
|
|
1250
|
+
execution: "Work",
|
|
1251
|
+
human: "Human",
|
|
1252
|
+
structural: "Structure"
|
|
1253
|
+
}, q = (e) => ({
|
|
1254
|
+
...e,
|
|
1255
|
+
nodes: e.nodes.map((e) => ({
|
|
1256
|
+
...e,
|
|
1257
|
+
data: { ...e.data }
|
|
1258
|
+
})),
|
|
1259
|
+
edges: e.edges.map((e) => ({
|
|
1260
|
+
...e,
|
|
1261
|
+
data: e.data ? { ...e.data } : e.data
|
|
1262
|
+
})),
|
|
1263
|
+
metadata: e.metadata ? { ...e.metadata } : void 0,
|
|
1264
|
+
viewport: e.viewport ? { ...e.viewport } : void 0
|
|
1265
|
+
}), Be = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0, Ve = (e, t) => t.filter((t) => t.source === e).map((e) => e.target), He = (e = ze) => {
|
|
1266
|
+
let t = /* @__PURE__ */ new Map();
|
|
1267
|
+
return Object.values(e).forEach((e) => {
|
|
1268
|
+
let n = t.get(e.category) ?? {
|
|
1269
|
+
categoryKey: K[e.category] ?? e.category,
|
|
1270
|
+
category: e.category,
|
|
1271
|
+
items: []
|
|
1272
|
+
};
|
|
1273
|
+
n.items.push({
|
|
1274
|
+
type: e.type,
|
|
1275
|
+
labelKey: e.label,
|
|
1276
|
+
descriptionKey: e.description,
|
|
1277
|
+
category: e.category,
|
|
1278
|
+
icon: e.icon ?? /* @__PURE__ */ j(b, { size: 16 }),
|
|
1279
|
+
defaultData: e.defaultData
|
|
1280
|
+
}), t.set(e.category, n);
|
|
1281
|
+
}), Array.from(t.values()).sort((e, t) => G.indexOf(e.category) - G.indexOf(t.category));
|
|
1282
|
+
}, J = (e, t = ze) => {
|
|
1283
|
+
let n = [], r = e.nodes.filter((e) => e.type === "startNode"), i = e.nodes.filter((e) => e.type === "endNode"), a = new Set(i.map((e) => e.id)), o = new Map(e.nodes.map((e) => [e.id, e])), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
1284
|
+
e.edges.forEach((e) => {
|
|
1285
|
+
s.set(e.target, (s.get(e.target) ?? 0) + 1), c.set(e.source, (c.get(e.source) ?? 0) + 1);
|
|
1286
|
+
}), r.length === 0 && n.push({
|
|
1287
|
+
code: "missing_start",
|
|
1288
|
+
severity: "error",
|
|
1289
|
+
message: "Workflow requires a start node."
|
|
1290
|
+
}), i.length === 0 && n.push({
|
|
1291
|
+
code: "missing_end",
|
|
1292
|
+
severity: "error",
|
|
1293
|
+
message: "Workflow requires an end node."
|
|
1294
|
+
}), e.nodes.forEach((r) => {
|
|
1295
|
+
r.type !== "startNode" && r.type !== "groupNode" && (s.get(r.id) ?? 0) === 0 && n.push({
|
|
1296
|
+
code: "orphan_node",
|
|
1297
|
+
severity: "error",
|
|
1298
|
+
message: "Node has no incoming path.",
|
|
1299
|
+
nodeId: r.id
|
|
1300
|
+
});
|
|
1301
|
+
let i = t[String(r.type ?? "")];
|
|
1302
|
+
if (i?.requiredDataKeys?.forEach((e) => {
|
|
1303
|
+
Be(r.data?.[e]) && n.push({
|
|
1304
|
+
code: "missing_required_config",
|
|
1305
|
+
severity: "error",
|
|
1306
|
+
message: `${i.label} requires ${e}.`,
|
|
1307
|
+
nodeId: r.id,
|
|
1308
|
+
field: e
|
|
1309
|
+
});
|
|
1310
|
+
}), r.data?.label || n.push({
|
|
1311
|
+
code: "missing_required_config",
|
|
1312
|
+
severity: "error",
|
|
1313
|
+
message: "Node label is required.",
|
|
1314
|
+
nodeId: r.id,
|
|
1315
|
+
field: "label"
|
|
1316
|
+
}), r.type === "decisionNode") {
|
|
1317
|
+
let e = Array.isArray(r.data?.branches) ? r.data.branches : [];
|
|
1318
|
+
(e.length < 2 || (c.get(r.id) ?? 0) < e.length) && n.push({
|
|
1319
|
+
code: "missing_decision_branch",
|
|
1320
|
+
severity: "error",
|
|
1321
|
+
message: "Decision nodes require branch coverage for each outcome.",
|
|
1322
|
+
nodeId: r.id,
|
|
1323
|
+
field: "branches"
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
n.push(...i?.validate?.(r, e) ?? []);
|
|
1327
|
+
}), e.nodes.forEach((t) => {
|
|
1328
|
+
if (t.type === "endNode" || t.type === "groupNode") return;
|
|
1329
|
+
let r = /* @__PURE__ */ new Set(), i = [t.id], o = !1;
|
|
1330
|
+
for (; i.length > 0;) {
|
|
1331
|
+
let t = i.shift();
|
|
1332
|
+
if (!(!t || r.has(t))) {
|
|
1333
|
+
if (r.add(t), a.has(t)) {
|
|
1334
|
+
o = !0;
|
|
1335
|
+
break;
|
|
1336
|
+
}
|
|
1337
|
+
i.push(...Ve(t, e.edges));
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
o || n.push({
|
|
1341
|
+
code: "missing_end_path",
|
|
1342
|
+
severity: "error",
|
|
1343
|
+
message: "Node has no path to an end node.",
|
|
1344
|
+
nodeId: t.id
|
|
1345
|
+
});
|
|
1346
|
+
});
|
|
1347
|
+
let l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = (t, r) => {
|
|
1348
|
+
if (l.has(t)) {
|
|
1349
|
+
r.slice(r.indexOf(t)).some((e) => o.get(e)?.type === "loopNode") || n.push({
|
|
1350
|
+
code: "invalid_cycle",
|
|
1351
|
+
severity: "error",
|
|
1352
|
+
message: "Workflow cycles require a loop node.",
|
|
1353
|
+
nodeId: t
|
|
1354
|
+
});
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
u.has(t) || (l.add(t), Ve(t, e.edges).forEach((e) => d(e, [...r, e])), l.delete(t), u.add(t));
|
|
1358
|
+
};
|
|
1359
|
+
return e.nodes.forEach((e) => d(e.id, [e.id])), {
|
|
1360
|
+
valid: !n.some((e) => e.severity === "error"),
|
|
1361
|
+
issues: n
|
|
1362
|
+
};
|
|
1363
|
+
}, Y = J, X = (e) => e == null ? "" : String(e), Z = (e) => e.split("\n").map((e) => e.trim()).filter(Boolean).reduce((e, t) => {
|
|
1364
|
+
let [n, ...r] = t.split(":");
|
|
1365
|
+
return n && r.length > 0 && (e[n.trim()] = r.join(":").trim()), e;
|
|
1366
|
+
}, {}), Q = (e) => e && typeof e == "object" ? Object.entries(e).map(([e, t]) => `${e}: ${t}`).join("\n") : "", Ue = ({ node: c, registry: l, issues: u, readOnly: f, onChange: p, onDelete: h, onClose: g, className: _ }) => {
|
|
1367
|
+
if (!c) return /* @__PURE__ */ M("aside", {
|
|
1368
|
+
className: e("w-80 border-l border-border bg-card/35 p-4", _),
|
|
1369
|
+
"aria-label": "Workflow inspector",
|
|
1370
|
+
children: [/* @__PURE__ */ j("div", {
|
|
1371
|
+
className: "text-xs font-bold uppercase tracking-wide text-muted-foreground",
|
|
1372
|
+
children: "Inspector"
|
|
1373
|
+
}), /* @__PURE__ */ j("div", {
|
|
1374
|
+
className: "mt-6 rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground",
|
|
1375
|
+
children: "Select a node to edit its configuration."
|
|
1376
|
+
})]
|
|
1377
|
+
});
|
|
1378
|
+
let v = l[String(c.type ?? "")], y = c.data, b = v?.editor, x = (t, n, r) => /* @__PURE__ */ M("label", {
|
|
1379
|
+
className: "grid gap-1.5",
|
|
1380
|
+
children: [/* @__PURE__ */ j("span", {
|
|
1381
|
+
className: e("text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", (r ? u.some((e) => e.field === r) : !1) && "text-destructive"),
|
|
1382
|
+
children: t
|
|
1383
|
+
}), n]
|
|
1384
|
+
}), S = (e) => p(e);
|
|
1385
|
+
return /* @__PURE__ */ M("aside", {
|
|
1386
|
+
className: e("w-80 border-l border-border bg-card/35 p-4 overflow-y-auto", _),
|
|
1387
|
+
"aria-label": "Workflow inspector",
|
|
1388
|
+
children: [
|
|
1389
|
+
/* @__PURE__ */ M("div", {
|
|
1390
|
+
className: "flex items-center justify-between gap-3",
|
|
1391
|
+
children: [/* @__PURE__ */ M("div", {
|
|
1392
|
+
className: "min-w-0",
|
|
1393
|
+
children: [/* @__PURE__ */ j("div", {
|
|
1394
|
+
className: "text-xs font-bold uppercase tracking-wide text-muted-foreground",
|
|
1395
|
+
children: "Inspector"
|
|
1396
|
+
}), /* @__PURE__ */ j("div", {
|
|
1397
|
+
className: "truncate text-sm font-semibold",
|
|
1398
|
+
children: v?.label ?? c.type ?? "Node"
|
|
1399
|
+
})]
|
|
1400
|
+
}), /* @__PURE__ */ j(t, {
|
|
1401
|
+
variant: "ghost",
|
|
1402
|
+
size: "icon",
|
|
1403
|
+
onClick: g,
|
|
1404
|
+
"aria-label": "Close inspector",
|
|
1405
|
+
children: /* @__PURE__ */ j(he, { size: 16 })
|
|
1406
|
+
})]
|
|
1407
|
+
}),
|
|
1408
|
+
/* @__PURE__ */ M("div", {
|
|
1409
|
+
className: "mt-4 grid gap-4",
|
|
1410
|
+
children: [
|
|
1411
|
+
x("Label", /* @__PURE__ */ j(n, {
|
|
1412
|
+
value: X(y.label),
|
|
1413
|
+
onChange: (e) => S({ label: e.target.value }),
|
|
1414
|
+
disabled: f
|
|
1415
|
+
}), "label"),
|
|
1416
|
+
x("Description", /* @__PURE__ */ j(d, {
|
|
1417
|
+
value: X(y.description),
|
|
1418
|
+
onChange: (e) => S({ description: e.target.value }),
|
|
1419
|
+
disabled: f
|
|
1420
|
+
})),
|
|
1421
|
+
(() => {
|
|
1422
|
+
if (b) return /* @__PURE__ */ j(b, {
|
|
1423
|
+
node: c,
|
|
1424
|
+
data: y,
|
|
1425
|
+
onChange: S,
|
|
1426
|
+
readOnly: f,
|
|
1427
|
+
issues: u
|
|
1428
|
+
});
|
|
1429
|
+
switch (c.type) {
|
|
1430
|
+
case "startNode": return x("Trigger", /* @__PURE__ */ M(s, {
|
|
1431
|
+
value: X("triggerType" in y ? y.triggerType : "manual"),
|
|
1432
|
+
onValueChange: f ? void 0 : (e) => S({ triggerType: e }),
|
|
1433
|
+
children: [/* @__PURE__ */ j(i, { children: /* @__PURE__ */ j(r, {}) }), /* @__PURE__ */ M(a, { children: [
|
|
1434
|
+
/* @__PURE__ */ j(o, {
|
|
1435
|
+
value: "manual",
|
|
1436
|
+
children: "Manual"
|
|
1437
|
+
}),
|
|
1438
|
+
/* @__PURE__ */ j(o, {
|
|
1439
|
+
value: "scheduled",
|
|
1440
|
+
children: "Scheduled"
|
|
1441
|
+
}),
|
|
1442
|
+
/* @__PURE__ */ j(o, {
|
|
1443
|
+
value: "webhook",
|
|
1444
|
+
children: "Webhook"
|
|
1445
|
+
})
|
|
1446
|
+
] })]
|
|
1447
|
+
}));
|
|
1448
|
+
case "endNode": return x("Outcome", /* @__PURE__ */ M(s, {
|
|
1449
|
+
value: X("outcome" in y ? y.outcome : "success"),
|
|
1450
|
+
onValueChange: f ? void 0 : (e) => S({ outcome: e }),
|
|
1451
|
+
children: [/* @__PURE__ */ j(i, { children: /* @__PURE__ */ j(r, {}) }), /* @__PURE__ */ M(a, { children: [
|
|
1452
|
+
/* @__PURE__ */ j(o, {
|
|
1453
|
+
value: "success",
|
|
1454
|
+
children: "Success"
|
|
1455
|
+
}),
|
|
1456
|
+
/* @__PURE__ */ j(o, {
|
|
1457
|
+
value: "failure",
|
|
1458
|
+
children: "Failure"
|
|
1459
|
+
}),
|
|
1460
|
+
/* @__PURE__ */ j(o, {
|
|
1461
|
+
value: "cancelled",
|
|
1462
|
+
children: "Cancelled"
|
|
1463
|
+
})
|
|
1464
|
+
] })]
|
|
1465
|
+
}));
|
|
1466
|
+
case "decisionNode": return /* @__PURE__ */ M(A, { children: [x("Condition", /* @__PURE__ */ j(d, {
|
|
1467
|
+
value: X("condition" in y ? y.condition : ""),
|
|
1468
|
+
onChange: (e) => S({ condition: e.target.value }),
|
|
1469
|
+
disabled: f
|
|
1470
|
+
})), x("Branches", /* @__PURE__ */ j(d, {
|
|
1471
|
+
value: ("branches" in y && Array.isArray(y.branches) ? y.branches : []).map((e) => e.label).join("\n"),
|
|
1472
|
+
onChange: (e) => S({ branches: e.target.value.split("\n").filter(Boolean).map((e, t) => ({
|
|
1473
|
+
id: `branch-${t + 1}`,
|
|
1474
|
+
label: e
|
|
1475
|
+
})) }),
|
|
1476
|
+
disabled: f
|
|
1477
|
+
}), "branches")] });
|
|
1478
|
+
case "loopNode": return /* @__PURE__ */ M(A, { children: [x("Iterator source", /* @__PURE__ */ j(n, {
|
|
1479
|
+
value: X("iteratorSource" in y ? y.iteratorSource : ""),
|
|
1480
|
+
onChange: (e) => S({ iteratorSource: e.target.value }),
|
|
1481
|
+
disabled: f
|
|
1482
|
+
}), "iteratorSource"), x("Max iterations", /* @__PURE__ */ j(n, {
|
|
1483
|
+
type: "number",
|
|
1484
|
+
min: 1,
|
|
1485
|
+
value: X("maxIterations" in y ? y.maxIterations : 10),
|
|
1486
|
+
onChange: (e) => S({ maxIterations: Number(e.target.value) }),
|
|
1487
|
+
disabled: f
|
|
1488
|
+
}))] });
|
|
1489
|
+
case "actionNode": return x("Action type", /* @__PURE__ */ j(n, {
|
|
1490
|
+
value: X("actionType" in y ? y.actionType : ""),
|
|
1491
|
+
onChange: (e) => S({ actionType: e.target.value }),
|
|
1492
|
+
disabled: f
|
|
1493
|
+
}), "actionType");
|
|
1494
|
+
case "requestNode": return /* @__PURE__ */ M(A, { children: [
|
|
1495
|
+
x("Method", /* @__PURE__ */ M(s, {
|
|
1496
|
+
value: X("method" in y ? y.method : "GET"),
|
|
1497
|
+
onValueChange: f ? void 0 : (e) => S({ method: e }),
|
|
1498
|
+
children: [/* @__PURE__ */ j(i, { children: /* @__PURE__ */ j(r, {}) }), /* @__PURE__ */ M(a, { children: [
|
|
1499
|
+
/* @__PURE__ */ j(o, {
|
|
1500
|
+
value: "GET",
|
|
1501
|
+
children: "GET"
|
|
1502
|
+
}),
|
|
1503
|
+
/* @__PURE__ */ j(o, {
|
|
1504
|
+
value: "POST",
|
|
1505
|
+
children: "POST"
|
|
1506
|
+
}),
|
|
1507
|
+
/* @__PURE__ */ j(o, {
|
|
1508
|
+
value: "PUT",
|
|
1509
|
+
children: "PUT"
|
|
1510
|
+
}),
|
|
1511
|
+
/* @__PURE__ */ j(o, {
|
|
1512
|
+
value: "PATCH",
|
|
1513
|
+
children: "PATCH"
|
|
1514
|
+
}),
|
|
1515
|
+
/* @__PURE__ */ j(o, {
|
|
1516
|
+
value: "DELETE",
|
|
1517
|
+
children: "DELETE"
|
|
1518
|
+
})
|
|
1519
|
+
] })]
|
|
1520
|
+
})),
|
|
1521
|
+
x("URL", /* @__PURE__ */ j(n, {
|
|
1522
|
+
value: X("url" in y ? y.url : ""),
|
|
1523
|
+
onChange: (e) => S({ url: e.target.value }),
|
|
1524
|
+
disabled: f
|
|
1525
|
+
}), "url"),
|
|
1526
|
+
x("Headers", /* @__PURE__ */ j(d, {
|
|
1527
|
+
value: Q("headers" in y ? y.headers : void 0),
|
|
1528
|
+
onChange: (e) => S({ headers: Z(e.target.value) }),
|
|
1529
|
+
disabled: f
|
|
1530
|
+
}))
|
|
1531
|
+
] });
|
|
1532
|
+
case "delayNode": return /* @__PURE__ */ M(A, { children: [x("Duration", /* @__PURE__ */ j(n, {
|
|
1533
|
+
type: "number",
|
|
1534
|
+
min: 1,
|
|
1535
|
+
value: X("duration" in y ? y.duration : 1),
|
|
1536
|
+
onChange: (e) => S({ duration: Number(e.target.value) }),
|
|
1537
|
+
disabled: f
|
|
1538
|
+
}), "duration"), x("Unit", /* @__PURE__ */ M(s, {
|
|
1539
|
+
value: X("unit" in y ? y.unit : "hours"),
|
|
1540
|
+
onValueChange: f ? void 0 : (e) => S({ unit: e }),
|
|
1541
|
+
children: [/* @__PURE__ */ j(i, { children: /* @__PURE__ */ j(r, {}) }), /* @__PURE__ */ M(a, { children: [
|
|
1542
|
+
/* @__PURE__ */ j(o, {
|
|
1543
|
+
value: "seconds",
|
|
1544
|
+
children: "Seconds"
|
|
1545
|
+
}),
|
|
1546
|
+
/* @__PURE__ */ j(o, {
|
|
1547
|
+
value: "minutes",
|
|
1548
|
+
children: "Minutes"
|
|
1549
|
+
}),
|
|
1550
|
+
/* @__PURE__ */ j(o, {
|
|
1551
|
+
value: "hours",
|
|
1552
|
+
children: "Hours"
|
|
1553
|
+
}),
|
|
1554
|
+
/* @__PURE__ */ j(o, {
|
|
1555
|
+
value: "days",
|
|
1556
|
+
children: "Days"
|
|
1557
|
+
})
|
|
1558
|
+
] })]
|
|
1559
|
+
}))] });
|
|
1560
|
+
case "approvalNode": return /* @__PURE__ */ M(A, { children: [
|
|
1561
|
+
x("Approver role", /* @__PURE__ */ j(n, {
|
|
1562
|
+
value: X("approverRole" in y ? y.approverRole : ""),
|
|
1563
|
+
onChange: (e) => S({ approverRole: e.target.value }),
|
|
1564
|
+
disabled: f
|
|
1565
|
+
}), "approverRole"),
|
|
1566
|
+
x("Escalation role", /* @__PURE__ */ j(n, {
|
|
1567
|
+
value: X("escalationRole" in y ? y.escalationRole : ""),
|
|
1568
|
+
onChange: (e) => S({ escalationRole: e.target.value }),
|
|
1569
|
+
disabled: f
|
|
1570
|
+
})),
|
|
1571
|
+
x("SLA hours", /* @__PURE__ */ j(n, {
|
|
1572
|
+
type: "number",
|
|
1573
|
+
min: 1,
|
|
1574
|
+
value: X("slaHours" in y ? y.slaHours : ""),
|
|
1575
|
+
onChange: (e) => S({ slaHours: Number(e.target.value) }),
|
|
1576
|
+
disabled: f
|
|
1577
|
+
}))
|
|
1578
|
+
] });
|
|
1579
|
+
default: return x("Description", /* @__PURE__ */ j(d, {
|
|
1580
|
+
value: X(y.description),
|
|
1581
|
+
onChange: (e) => S({ description: e.target.value }),
|
|
1582
|
+
disabled: f
|
|
1583
|
+
}));
|
|
1584
|
+
}
|
|
1585
|
+
})()
|
|
1586
|
+
]
|
|
1587
|
+
}),
|
|
1588
|
+
u.length > 0 && /* @__PURE__ */ j("div", {
|
|
1589
|
+
className: "mt-4 grid gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-3",
|
|
1590
|
+
children: u.map((e, t) => /* @__PURE__ */ M("div", {
|
|
1591
|
+
className: "flex gap-2 text-xs text-destructive",
|
|
1592
|
+
children: [/* @__PURE__ */ j(m, {
|
|
1593
|
+
size: 14,
|
|
1594
|
+
className: "mt-0.5 shrink-0"
|
|
1595
|
+
}), /* @__PURE__ */ j("span", { children: e.message })]
|
|
1596
|
+
}, `${e.code}-${t}`))
|
|
1597
|
+
}),
|
|
1598
|
+
!f && /* @__PURE__ */ M(t, {
|
|
1599
|
+
variant: "destructive",
|
|
1600
|
+
className: "mt-4 w-full gap-2",
|
|
1601
|
+
onClick: h,
|
|
1602
|
+
children: [/* @__PURE__ */ j(de, { size: 14 }), "Delete node"]
|
|
1603
|
+
})
|
|
1604
|
+
]
|
|
1605
|
+
});
|
|
1606
|
+
}, We = p.forwardRef((n, r) => {
|
|
1607
|
+
let { workflow: i, defaultWorkflow: a = Re, workflowId: o, service: s, nodeRegistry: c, onWorkflowChange: l, onNodeAdd: u, onNodeUpdate: d, onNodeDelete: f, onConnectionCreate: h, onValidationChange: _, onSave: v, onPublish: y, onError: b, title: x, description: S, status: C, toolboxTitle: T = "Node Library", showHeader: ee = !0, showToolbox: te = !0, showInspector: ne = !0, showValidationPanel: re = !0, showActionBar: E = !0, autoValidate: oe = !0, readOnly: D = !1, showGrid: se = !0, snapToGrid: ce = !0, fitView: le = !0, exportFileName: ue = "workflow.json", className: de, classNames: O, ...he } = n, k = p.useMemo(() => ({
|
|
1608
|
+
...ze,
|
|
1609
|
+
...c
|
|
1610
|
+
}), [c]), ge = p.useMemo(() => {
|
|
1611
|
+
let e = {};
|
|
1612
|
+
return Object.values(k).forEach((t) => {
|
|
1613
|
+
t.component && (e[t.type] = t.component);
|
|
1614
|
+
}), e;
|
|
1615
|
+
}, [k]), _e = p.useMemo(() => He(k), [k]), ve = i !== void 0, [ye, N] = p.useState(() => q(a)), [P, F] = p.useState(se), [be, xe] = p.useState(ce), [Te, De] = p.useState(!1), [I, L] = p.useState(null), [R, z] = p.useState(() => J(i ?? ye, k)), [B, V] = p.useState(!1), [Oe, H] = p.useState(!1), [ke, Ae] = p.useState(!1), [je, Me] = p.useState(void 0), [Ne, U] = p.useState(null), Ie = p.useRef(null), W = p.useRef(i ?? ye), G = p.useRef([]), K = p.useRef([]), { fitView: Be, screenToFlowPosition: Ve } = Ee(), Y = i ?? ye;
|
|
1616
|
+
p.useEffect(() => {
|
|
1617
|
+
W.current = Y;
|
|
1618
|
+
}, [Y]), p.useEffect(() => F(se), [se]), p.useEffect(() => xe(ce), [ce]);
|
|
1619
|
+
let X = p.useCallback((e = W.current) => J(e, k), [k]), Z = p.useCallback((e, t = !0) => {
|
|
1620
|
+
let n = q({
|
|
1621
|
+
...e,
|
|
1622
|
+
metadata: {
|
|
1623
|
+
...e.metadata,
|
|
1624
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
if (t && (G.current = [...G.current, q(W.current)], K.current = []), W.current = n, ve || N(n), l?.(n), oe) {
|
|
1628
|
+
let e = X(n);
|
|
1629
|
+
z(e), _?.(e);
|
|
1630
|
+
}
|
|
1631
|
+
}, [
|
|
1632
|
+
oe,
|
|
1633
|
+
ve,
|
|
1634
|
+
_,
|
|
1635
|
+
l,
|
|
1636
|
+
X
|
|
1637
|
+
]), Q = p.useCallback((e) => {
|
|
1638
|
+
let t = k[String(e.type)], n = {
|
|
1639
|
+
id: e.id ?? `${e.type}-${Date.now()}`,
|
|
1640
|
+
type: e.type,
|
|
1641
|
+
position: e.position ?? {
|
|
1642
|
+
x: 120,
|
|
1643
|
+
y: 120
|
|
1644
|
+
},
|
|
1645
|
+
data: {
|
|
1646
|
+
...t?.defaultData ?? { label: e.type },
|
|
1647
|
+
...e.data ?? {}
|
|
1648
|
+
}
|
|
1649
|
+
}, r = {
|
|
1650
|
+
...W.current,
|
|
1651
|
+
nodes: [...W.current.nodes, n]
|
|
1652
|
+
};
|
|
1653
|
+
Z(r), u?.({
|
|
1654
|
+
node: n,
|
|
1655
|
+
workflow: q(r)
|
|
1656
|
+
});
|
|
1657
|
+
}, [
|
|
1658
|
+
Z,
|
|
1659
|
+
k,
|
|
1660
|
+
u
|
|
1661
|
+
]), We = p.useCallback((e, t) => {
|
|
1662
|
+
let n, r = W.current.nodes.map((r) => r.id === e ? (n = {
|
|
1663
|
+
...r,
|
|
1664
|
+
data: {
|
|
1665
|
+
...r.data,
|
|
1666
|
+
...t
|
|
1667
|
+
}
|
|
1668
|
+
}, n) : r);
|
|
1669
|
+
if (!n) return;
|
|
1670
|
+
let i = {
|
|
1671
|
+
...W.current,
|
|
1672
|
+
nodes: r
|
|
1673
|
+
};
|
|
1674
|
+
Z(i), d?.({
|
|
1675
|
+
node: n,
|
|
1676
|
+
workflow: q(i)
|
|
1677
|
+
});
|
|
1678
|
+
}, [Z, d]), $ = p.useCallback((e) => {
|
|
1679
|
+
let t = W.current.nodes.find((t) => t.id === e);
|
|
1680
|
+
if (!t) return;
|
|
1681
|
+
let n = {
|
|
1682
|
+
...W.current,
|
|
1683
|
+
nodes: W.current.nodes.filter((t) => t.id !== e),
|
|
1684
|
+
edges: W.current.edges.filter((t) => t.source !== e && t.target !== e)
|
|
1685
|
+
};
|
|
1686
|
+
L((t) => t === e ? null : t), Z(n), f?.({
|
|
1687
|
+
node: t,
|
|
1688
|
+
workflow: q(n)
|
|
1689
|
+
});
|
|
1690
|
+
}, [Z, f]), Ge = p.useCallback((e, t) => {
|
|
1691
|
+
let n = {
|
|
1692
|
+
id: `${e}-${t}-${Date.now()}`,
|
|
1693
|
+
source: e,
|
|
1694
|
+
target: t,
|
|
1695
|
+
type: "ezEdge",
|
|
1696
|
+
animated: !0
|
|
1697
|
+
}, r = {
|
|
1698
|
+
...W.current,
|
|
1699
|
+
edges: Se(n, W.current.edges)
|
|
1700
|
+
};
|
|
1701
|
+
Z(r), h?.({
|
|
1702
|
+
edge: n,
|
|
1703
|
+
sourceId: e,
|
|
1704
|
+
targetId: t,
|
|
1705
|
+
workflow: q(r)
|
|
1706
|
+
});
|
|
1707
|
+
}, [Z, h]);
|
|
1708
|
+
p.useEffect(() => {
|
|
1709
|
+
if (!s || !o || ve) return;
|
|
1710
|
+
let e = !0;
|
|
1711
|
+
return V(!0), U(null), s.loadWorkflow(o).then((t) => {
|
|
1712
|
+
e && Z(t, !1);
|
|
1713
|
+
}).catch((t) => {
|
|
1714
|
+
e && (U(t.message), b?.(t, "load"));
|
|
1715
|
+
}).finally(() => {
|
|
1716
|
+
e && V(!1);
|
|
1717
|
+
}), () => {
|
|
1718
|
+
e = !1;
|
|
1719
|
+
};
|
|
1720
|
+
}, [
|
|
1721
|
+
ve,
|
|
1722
|
+
Z,
|
|
1723
|
+
b,
|
|
1724
|
+
s,
|
|
1725
|
+
o
|
|
1726
|
+
]), p.useEffect(() => {
|
|
1727
|
+
let e = X(Y);
|
|
1728
|
+
z(e), _?.(e);
|
|
1729
|
+
}, [
|
|
1730
|
+
Y,
|
|
1731
|
+
_,
|
|
1732
|
+
X
|
|
1733
|
+
]), p.useImperativeHandle(r, () => ({
|
|
1734
|
+
getWorkflow: () => q(W.current),
|
|
1735
|
+
setWorkflow: (e) => Z(e),
|
|
1736
|
+
validate: () => X(),
|
|
1737
|
+
addNode: Q,
|
|
1738
|
+
updateNode: We,
|
|
1739
|
+
deleteNode: $,
|
|
1740
|
+
connect: Ge,
|
|
1741
|
+
undo: () => {
|
|
1742
|
+
let e = G.current[G.current.length - 1];
|
|
1743
|
+
e && (G.current = G.current.slice(0, -1), K.current = [q(W.current), ...K.current], Z(e, !1));
|
|
1744
|
+
},
|
|
1745
|
+
redo: () => {
|
|
1746
|
+
let e = K.current[0];
|
|
1747
|
+
e && (K.current = K.current.slice(1), G.current = [...G.current, q(W.current)], Z(e, !1));
|
|
1748
|
+
},
|
|
1749
|
+
canUndo: () => G.current.length > 0,
|
|
1750
|
+
canRedo: () => K.current.length > 0,
|
|
1751
|
+
fitView: () => Be(),
|
|
1752
|
+
exportJson: () => JSON.stringify(W.current, null, 2),
|
|
1753
|
+
importJson: (e) => {
|
|
1754
|
+
try {
|
|
1755
|
+
Z(JSON.parse(e)), U(null);
|
|
1756
|
+
} catch (e) {
|
|
1757
|
+
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Invalid workflow JSON.");
|
|
1758
|
+
U(t.message), b?.(t, "import");
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
}), [
|
|
1762
|
+
Q,
|
|
1763
|
+
Ge,
|
|
1764
|
+
$,
|
|
1765
|
+
Z,
|
|
1766
|
+
Be,
|
|
1767
|
+
b,
|
|
1768
|
+
We,
|
|
1769
|
+
X
|
|
1770
|
+
]);
|
|
1771
|
+
let Ke = p.useCallback((e) => {
|
|
1772
|
+
let t = we(e, W.current.nodes);
|
|
1773
|
+
Z({
|
|
1774
|
+
...W.current,
|
|
1775
|
+
nodes: t
|
|
1776
|
+
});
|
|
1777
|
+
}, [Z]), qe = p.useCallback((e) => {
|
|
1778
|
+
Z({
|
|
1779
|
+
...W.current,
|
|
1780
|
+
edges: Ce(e, W.current.edges)
|
|
1781
|
+
});
|
|
1782
|
+
}, [Z]), Je = p.useCallback((e) => {
|
|
1783
|
+
Z({
|
|
1784
|
+
...W.current,
|
|
1785
|
+
edges: W.current.edges.filter((t) => t.id !== e)
|
|
1786
|
+
});
|
|
1787
|
+
}, [Z]), Ye = p.useCallback((e) => {
|
|
1788
|
+
e.source && e.target && Ge(e.source, e.target);
|
|
1789
|
+
}, [Ge]), Xe = p.useCallback((e) => {
|
|
1790
|
+
e.preventDefault();
|
|
1791
|
+
let t = e.dataTransfer.getData("application/reactflow") || e.dataTransfer.getData("text/plain");
|
|
1792
|
+
t && Q({
|
|
1793
|
+
type: t,
|
|
1794
|
+
position: Ve({
|
|
1795
|
+
x: e.clientX,
|
|
1796
|
+
y: e.clientY
|
|
1797
|
+
})
|
|
1798
|
+
});
|
|
1799
|
+
}, [Q, Ve]), Ze = p.useCallback(async () => {
|
|
1800
|
+
let e = q(W.current), t = X(e);
|
|
1801
|
+
if (z(t), _?.(t), t.valid) {
|
|
1802
|
+
H(!0), U(null);
|
|
1803
|
+
try {
|
|
1804
|
+
s && o && await s.saveWorkflow(o, e), await v?.(e), Me((/* @__PURE__ */ new Date()).toISOString());
|
|
1805
|
+
} catch (e) {
|
|
1806
|
+
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to save workflow.");
|
|
1807
|
+
U(t.message), b?.(t, "save");
|
|
1808
|
+
} finally {
|
|
1809
|
+
H(!1);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
}, [
|
|
1813
|
+
b,
|
|
1814
|
+
v,
|
|
1815
|
+
_,
|
|
1816
|
+
s,
|
|
1817
|
+
X,
|
|
1818
|
+
o
|
|
1819
|
+
]), Qe = p.useCallback(async () => {
|
|
1820
|
+
let e = q({
|
|
1821
|
+
...W.current,
|
|
1822
|
+
metadata: {
|
|
1823
|
+
...W.current.metadata,
|
|
1824
|
+
status: "live",
|
|
1825
|
+
publishedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1826
|
+
}
|
|
1827
|
+
}), t = X(e);
|
|
1828
|
+
if (z(t), _?.(t), t.valid) {
|
|
1829
|
+
Ae(!0), U(null);
|
|
1830
|
+
try {
|
|
1831
|
+
s && o && await s.publishWorkflow(o, e), await y?.(e), Z(e, !1);
|
|
1832
|
+
} catch (e) {
|
|
1833
|
+
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to publish workflow.");
|
|
1834
|
+
U(t.message), b?.(t, "publish");
|
|
1835
|
+
} finally {
|
|
1836
|
+
Ae(!1);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
}, [
|
|
1840
|
+
Z,
|
|
1841
|
+
b,
|
|
1842
|
+
y,
|
|
1843
|
+
_,
|
|
1844
|
+
s,
|
|
1845
|
+
X,
|
|
1846
|
+
o
|
|
1847
|
+
]), $e = p.useCallback(() => {
|
|
1848
|
+
try {
|
|
1849
|
+
let e = X();
|
|
1850
|
+
z(e), _?.(e), U(null);
|
|
1851
|
+
} catch (e) {
|
|
1852
|
+
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to validate workflow.");
|
|
1853
|
+
U(t.message), b?.(t, "validate");
|
|
1854
|
+
}
|
|
1855
|
+
}, [
|
|
1856
|
+
b,
|
|
1857
|
+
_,
|
|
1858
|
+
X
|
|
1859
|
+
]), et = p.useCallback((e) => {
|
|
1860
|
+
let t = e.target.files?.[0];
|
|
1861
|
+
t && t.text().then((t) => {
|
|
1862
|
+
try {
|
|
1863
|
+
Z(JSON.parse(t)), U(null);
|
|
1864
|
+
} catch (e) {
|
|
1865
|
+
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Invalid workflow JSON.");
|
|
1866
|
+
U(t.message), b?.(t, "import");
|
|
1867
|
+
} finally {
|
|
1868
|
+
e.target.value = "";
|
|
1869
|
+
}
|
|
1870
|
+
});
|
|
1871
|
+
}, [Z, b]), tt = p.useCallback(() => {
|
|
1872
|
+
let e = new Blob([JSON.stringify(W.current, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1873
|
+
n.href = t, n.download = ue, n.click(), URL.revokeObjectURL(t);
|
|
1874
|
+
}, [ue]), nt = x ?? Y.metadata?.title ?? "Untitled Workflow", rt = S ?? Y.metadata?.description, it = I ? Y.nodes.find((e) => e.id === I) : void 0, at = I ? R.issues.filter((e) => e.nodeId === I) : [], ot = R.issues.filter((e) => e.severity === "error").length, st = R.issues.filter((e) => e.severity === "warning").length, ct = G.current.length > 0, lt = K.current.length > 0;
|
|
1875
|
+
return /* @__PURE__ */ M("div", {
|
|
1876
|
+
className: e("ez-workflow flex h-full min-h-[560px] flex-col overflow-hidden bg-background", O?.root, de),
|
|
1877
|
+
...he,
|
|
1878
|
+
children: [
|
|
1879
|
+
/* @__PURE__ */ j("input", {
|
|
1880
|
+
ref: Ie,
|
|
1881
|
+
type: "file",
|
|
1882
|
+
accept: "application/json,.json",
|
|
1883
|
+
className: "hidden",
|
|
1884
|
+
onChange: et
|
|
1885
|
+
}),
|
|
1886
|
+
ee && /* @__PURE__ */ j(Le, {
|
|
1887
|
+
title: nt,
|
|
1888
|
+
description: rt,
|
|
1889
|
+
status: C ?? Y.metadata?.status,
|
|
1890
|
+
isDirty: G.current.length > 0,
|
|
1891
|
+
onTitleChange: (e) => Z({
|
|
1892
|
+
...W.current,
|
|
1893
|
+
metadata: {
|
|
1894
|
+
...W.current.metadata,
|
|
1895
|
+
title: e
|
|
1896
|
+
}
|
|
1897
|
+
}),
|
|
1898
|
+
onDescriptionChange: (e) => Z({
|
|
1899
|
+
...W.current,
|
|
1900
|
+
metadata: {
|
|
1901
|
+
...W.current.metadata,
|
|
1902
|
+
description: e
|
|
1903
|
+
}
|
|
1904
|
+
}),
|
|
1905
|
+
onSave: Ze,
|
|
1906
|
+
onPublish: Qe,
|
|
1907
|
+
showGrid: P,
|
|
1908
|
+
onShowGridChange: F,
|
|
1909
|
+
snapToGrid: be,
|
|
1910
|
+
onSnapToGridChange: xe,
|
|
1911
|
+
className: O?.header
|
|
1912
|
+
}),
|
|
1913
|
+
/* @__PURE__ */ M("div", {
|
|
1914
|
+
className: e("flex min-h-0 flex-1", O?.body),
|
|
1915
|
+
children: [
|
|
1916
|
+
te && /* @__PURE__ */ j(Fe, {
|
|
1917
|
+
categories: _e,
|
|
1918
|
+
title: T,
|
|
1919
|
+
collapsed: Te,
|
|
1920
|
+
onCollapsedChange: De,
|
|
1921
|
+
onNodeActivate: (e) => Q({ type: e.type }),
|
|
1922
|
+
className: O?.toolbox
|
|
1923
|
+
}),
|
|
1924
|
+
/* @__PURE__ */ j(Pe, {
|
|
1925
|
+
nodes: Y.nodes,
|
|
1926
|
+
edges: Y.edges,
|
|
1927
|
+
onNodesChange: Ke,
|
|
1928
|
+
onEdgesChange: qe,
|
|
1929
|
+
onConnect: Ye,
|
|
1930
|
+
onDrop: Xe,
|
|
1931
|
+
onDragOver: (e) => {
|
|
1932
|
+
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
1933
|
+
},
|
|
1934
|
+
onNodeClick: (e, t) => L(t.id),
|
|
1935
|
+
onNodeDoubleClick: (e, t) => L(t.id),
|
|
1936
|
+
onEdgeDelete: Je,
|
|
1937
|
+
onPaneClick: () => L(null),
|
|
1938
|
+
nodeTypes: ge,
|
|
1939
|
+
showGrid: P,
|
|
1940
|
+
snapToGrid: be,
|
|
1941
|
+
fitView: le,
|
|
1942
|
+
readOnly: D,
|
|
1943
|
+
className: e("flex-1", O?.canvas)
|
|
1944
|
+
}),
|
|
1945
|
+
ne && /* @__PURE__ */ j(Ue, {
|
|
1946
|
+
node: it,
|
|
1947
|
+
registry: k,
|
|
1948
|
+
issues: at,
|
|
1949
|
+
readOnly: D,
|
|
1950
|
+
onChange: (e) => it && We(it.id, e),
|
|
1951
|
+
onDelete: () => it && $(it.id),
|
|
1952
|
+
onClose: () => L(null),
|
|
1953
|
+
className: O?.inspector
|
|
1954
|
+
})
|
|
1955
|
+
]
|
|
1956
|
+
}),
|
|
1957
|
+
(E || re) && /* @__PURE__ */ M("footer", {
|
|
1958
|
+
className: e("flex min-h-14 items-center justify-between gap-3 border-t border-border bg-card/50 px-4 py-2", O?.actionBar),
|
|
1959
|
+
"aria-label": "Workflow actions",
|
|
1960
|
+
children: [/* @__PURE__ */ j("div", {
|
|
1961
|
+
className: "flex min-w-0 items-center gap-2",
|
|
1962
|
+
children: E && /* @__PURE__ */ M(A, { children: [
|
|
1963
|
+
/* @__PURE__ */ M(t, {
|
|
1964
|
+
variant: "outline",
|
|
1965
|
+
size: "sm",
|
|
1966
|
+
className: "gap-2",
|
|
1967
|
+
disabled: !ct || D,
|
|
1968
|
+
onClick: () => {
|
|
1969
|
+
let e = G.current[G.current.length - 1];
|
|
1970
|
+
e && (G.current = G.current.slice(0, -1), K.current = [q(W.current), ...K.current], Z(e, !1));
|
|
1971
|
+
},
|
|
1972
|
+
children: [/* @__PURE__ */ j(fe, { size: 14 }), "Undo"]
|
|
1973
|
+
}),
|
|
1974
|
+
/* @__PURE__ */ M(t, {
|
|
1975
|
+
variant: "outline",
|
|
1976
|
+
size: "sm",
|
|
1977
|
+
className: "gap-2",
|
|
1978
|
+
disabled: !lt || D,
|
|
1979
|
+
onClick: () => {
|
|
1980
|
+
let e = K.current[0];
|
|
1981
|
+
e && (K.current = K.current.slice(1), G.current = [...G.current, q(W.current)], Z(e, !1));
|
|
1982
|
+
},
|
|
1983
|
+
children: [/* @__PURE__ */ j(ie, { size: 14 }), "Redo"]
|
|
1984
|
+
}),
|
|
1985
|
+
/* @__PURE__ */ M(t, {
|
|
1986
|
+
variant: "outline",
|
|
1987
|
+
size: "sm",
|
|
1988
|
+
className: "gap-2",
|
|
1989
|
+
onClick: $e,
|
|
1990
|
+
children: [/* @__PURE__ */ j(me, { size: 14 }), "Validate"]
|
|
1991
|
+
}),
|
|
1992
|
+
/* @__PURE__ */ M(t, {
|
|
1993
|
+
variant: "outline",
|
|
1994
|
+
size: "sm",
|
|
1995
|
+
className: "gap-2",
|
|
1996
|
+
onClick: () => Ie.current?.click(),
|
|
1997
|
+
disabled: D,
|
|
1998
|
+
children: [/* @__PURE__ */ j(pe, { size: 14 }), "Import"]
|
|
1999
|
+
}),
|
|
2000
|
+
/* @__PURE__ */ M(t, {
|
|
2001
|
+
variant: "outline",
|
|
2002
|
+
size: "sm",
|
|
2003
|
+
className: "gap-2",
|
|
2004
|
+
onClick: tt,
|
|
2005
|
+
children: [/* @__PURE__ */ j(w, { size: 14 }), "Export"]
|
|
2006
|
+
})
|
|
2007
|
+
] })
|
|
2008
|
+
}), re && /* @__PURE__ */ M("div", {
|
|
2009
|
+
className: e("flex min-w-0 items-center gap-3 text-xs", O?.validationPanel),
|
|
2010
|
+
children: [
|
|
2011
|
+
B || Oe || ke ? /* @__PURE__ */ M("span", {
|
|
2012
|
+
className: "inline-flex items-center gap-2 text-muted-foreground",
|
|
2013
|
+
children: [/* @__PURE__ */ j(ae, {
|
|
2014
|
+
size: 14,
|
|
2015
|
+
className: "animate-spin"
|
|
2016
|
+
}), B ? "Loading" : ke ? "Publishing" : "Saving"]
|
|
2017
|
+
}) : R.valid ? /* @__PURE__ */ M("span", {
|
|
2018
|
+
className: "inline-flex items-center gap-2 text-emerald-600",
|
|
2019
|
+
children: [/* @__PURE__ */ j(g, { size: 14 }), "Valid"]
|
|
2020
|
+
}) : /* @__PURE__ */ M("span", {
|
|
2021
|
+
className: "inline-flex items-center gap-2 text-destructive",
|
|
2022
|
+
children: [
|
|
2023
|
+
/* @__PURE__ */ j(m, { size: 14 }),
|
|
2024
|
+
ot,
|
|
2025
|
+
" error",
|
|
2026
|
+
ot === 1 ? "" : "s",
|
|
2027
|
+
st > 0 ? `, ${st} warning${st === 1 ? "" : "s"}` : ""
|
|
2028
|
+
]
|
|
2029
|
+
}),
|
|
2030
|
+
je && /* @__PURE__ */ M("span", {
|
|
2031
|
+
className: "hidden text-muted-foreground md:inline",
|
|
2032
|
+
children: ["Saved ", new Date(je).toLocaleTimeString()]
|
|
2033
|
+
}),
|
|
2034
|
+
Ne && /* @__PURE__ */ j("span", {
|
|
2035
|
+
className: "max-w-[320px] truncate text-destructive",
|
|
2036
|
+
children: Ne
|
|
2037
|
+
}),
|
|
2038
|
+
R.issues.slice(0, 2).map((e, t) => /* @__PURE__ */ j("button", {
|
|
2039
|
+
type: "button",
|
|
2040
|
+
className: "hidden max-w-[260px] truncate rounded border border-border px-2 py-1 text-left text-muted-foreground hover:bg-muted lg:block",
|
|
2041
|
+
"aria-label": `Go to validation issue: ${e.message}`,
|
|
2042
|
+
onClick: () => e.nodeId && L(e.nodeId),
|
|
2043
|
+
children: e.message
|
|
2044
|
+
}, `${e.code}-${e.nodeId ?? t}`))
|
|
2045
|
+
]
|
|
2046
|
+
})]
|
|
2047
|
+
})
|
|
2048
|
+
]
|
|
2049
|
+
});
|
|
2050
|
+
});
|
|
2051
|
+
We.displayName = "EzWorkflowInner";
|
|
2052
|
+
var $ = p.forwardRef((e, t) => /* @__PURE__ */ j(xe, { children: /* @__PURE__ */ j(We, {
|
|
2053
|
+
...e,
|
|
2054
|
+
ref: t
|
|
2055
|
+
}) }));
|
|
2056
|
+
$.displayName = "EzWorkflow";
|
|
2057
|
+
var Ge = p.forwardRef((e, t) => /* @__PURE__ */ j($, {
|
|
2058
|
+
...e,
|
|
2059
|
+
ref: t
|
|
2060
|
+
}));
|
|
2061
|
+
Ge.displayName = "EzFlow";
|
|
2062
|
+
//#endregion
|
|
2063
|
+
//#region src/components/EzFlow/EzWorkflowServiceAdapters.ts
|
|
2064
|
+
var Ke = async (e) => ({
|
|
2065
|
+
"content-type": "application/json",
|
|
2066
|
+
...(typeof e == "function" ? await e() : e) ?? {}
|
|
2067
|
+
}), qe = async (e, t) => {
|
|
2068
|
+
if (e.ok) return;
|
|
2069
|
+
let n = await e.text().catch(() => "");
|
|
2070
|
+
throw Error(n || `Workflow ${t} failed with ${e.status}.`);
|
|
2071
|
+
}, Je = class {
|
|
2072
|
+
baseUrl;
|
|
2073
|
+
fetcher;
|
|
2074
|
+
headers;
|
|
2075
|
+
constructor(e) {
|
|
2076
|
+
this.baseUrl = e.baseUrl.replace(/\/$/, ""), this.fetcher = e.fetcher ?? fetch, this.headers = e.headers;
|
|
2077
|
+
}
|
|
2078
|
+
async loadWorkflow(e) {
|
|
2079
|
+
let t = await this.fetcher(`${this.baseUrl}/workflows/${encodeURIComponent(e)}`);
|
|
2080
|
+
return await qe(t, "load"), t.json();
|
|
2081
|
+
}
|
|
2082
|
+
async saveWorkflow(e, t) {
|
|
2083
|
+
await qe(await this.fetcher(`${this.baseUrl}/workflows/${encodeURIComponent(e)}`, {
|
|
2084
|
+
method: "PUT",
|
|
2085
|
+
headers: await Ke(this.headers),
|
|
2086
|
+
body: JSON.stringify(t)
|
|
2087
|
+
}), "save");
|
|
2088
|
+
}
|
|
2089
|
+
async publishWorkflow(e, t) {
|
|
2090
|
+
await qe(await this.fetcher(`${this.baseUrl}/workflows/${encodeURIComponent(e)}/publish`, {
|
|
2091
|
+
method: "POST",
|
|
2092
|
+
headers: await Ke(this.headers),
|
|
2093
|
+
body: JSON.stringify(t)
|
|
2094
|
+
}), "publish");
|
|
2095
|
+
}
|
|
2096
|
+
async validateWorkflow(e) {
|
|
2097
|
+
let t = await this.fetcher(`${this.baseUrl}/workflows/validate`, {
|
|
2098
|
+
method: "POST",
|
|
2099
|
+
headers: await Ke(this.headers),
|
|
2100
|
+
body: JSON.stringify(e)
|
|
2101
|
+
});
|
|
2102
|
+
return await qe(t, "validate"), t.json();
|
|
2103
|
+
}
|
|
2104
|
+
}, Ye = class {
|
|
2105
|
+
lastStableWorkflow;
|
|
2106
|
+
constructor(e) {
|
|
2107
|
+
this.service = e;
|
|
2108
|
+
}
|
|
2109
|
+
getRollbackWorkflow() {
|
|
2110
|
+
return this.lastStableWorkflow;
|
|
2111
|
+
}
|
|
2112
|
+
async loadWorkflow(e) {
|
|
2113
|
+
let t = await this.service.loadWorkflow(e);
|
|
2114
|
+
return this.lastStableWorkflow = t, t;
|
|
2115
|
+
}
|
|
2116
|
+
async saveWorkflow(e, t) {
|
|
2117
|
+
let n = this.lastStableWorkflow;
|
|
2118
|
+
this.lastStableWorkflow = t;
|
|
2119
|
+
try {
|
|
2120
|
+
await this.service.saveWorkflow(e, t);
|
|
2121
|
+
} catch (e) {
|
|
2122
|
+
throw this.lastStableWorkflow = n, e;
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
async publishWorkflow(e, t) {
|
|
2126
|
+
let n = this.lastStableWorkflow;
|
|
2127
|
+
this.lastStableWorkflow = t;
|
|
2128
|
+
try {
|
|
2129
|
+
await this.service.publishWorkflow(e, t);
|
|
2130
|
+
} catch (e) {
|
|
2131
|
+
throw this.lastStableWorkflow = n, e;
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
validateWorkflow(e) {
|
|
2135
|
+
return this.service.validateWorkflow(e);
|
|
2136
|
+
}
|
|
2137
|
+
}, Xe = (e = {}) => {
|
|
2138
|
+
let t = new Map(Object.entries(e));
|
|
2139
|
+
return {
|
|
2140
|
+
workflows: t,
|
|
2141
|
+
async loadWorkflow(e) {
|
|
2142
|
+
let n = t.get(e);
|
|
2143
|
+
if (!n) throw Error(`Workflow ${e} was not found.`);
|
|
2144
|
+
return n;
|
|
2145
|
+
},
|
|
2146
|
+
async saveWorkflow(e, n) {
|
|
2147
|
+
t.set(e, n);
|
|
2148
|
+
},
|
|
2149
|
+
async publishWorkflow(e, n) {
|
|
2150
|
+
t.set(e, {
|
|
2151
|
+
...n,
|
|
2152
|
+
metadata: {
|
|
2153
|
+
...n.metadata,
|
|
2154
|
+
status: "live",
|
|
2155
|
+
publishedAt: n.metadata?.publishedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
2156
|
+
}
|
|
2157
|
+
});
|
|
2158
|
+
},
|
|
2159
|
+
async validateWorkflow(e) {
|
|
2160
|
+
return J(e);
|
|
2161
|
+
}
|
|
2162
|
+
};
|
|
2163
|
+
}, Ze = (e) => {
|
|
2164
|
+
let t = Math.max(2, Math.floor(e)), n = Array.from({ length: t }, (e, n) => n === 0 ? {
|
|
2165
|
+
id: "node-0",
|
|
2166
|
+
type: "startNode",
|
|
2167
|
+
position: {
|
|
2168
|
+
x: 0,
|
|
2169
|
+
y: 0
|
|
2170
|
+
},
|
|
2171
|
+
data: { label: "Start" }
|
|
2172
|
+
} : n === t - 1 ? {
|
|
2173
|
+
id: `node-${n}`,
|
|
2174
|
+
type: "endNode",
|
|
2175
|
+
position: {
|
|
2176
|
+
x: n * 180,
|
|
2177
|
+
y: 0
|
|
2178
|
+
},
|
|
2179
|
+
data: { label: "End" }
|
|
2180
|
+
} : {
|
|
2181
|
+
id: `node-${n}`,
|
|
2182
|
+
type: "actionNode",
|
|
2183
|
+
position: {
|
|
2184
|
+
x: n * 180,
|
|
2185
|
+
y: n % 5 * 120
|
|
2186
|
+
},
|
|
2187
|
+
data: {
|
|
2188
|
+
label: `Action ${n}`,
|
|
2189
|
+
actionType: "noop"
|
|
2190
|
+
}
|
|
2191
|
+
});
|
|
2192
|
+
return {
|
|
2193
|
+
nodes: n,
|
|
2194
|
+
edges: n.slice(0, -1).map((e, t) => ({
|
|
2195
|
+
id: `${e.id}-${n[t + 1].id}`,
|
|
2196
|
+
source: e.id,
|
|
2197
|
+
target: n[t + 1].id,
|
|
2198
|
+
type: "ezEdge"
|
|
2199
|
+
})),
|
|
2200
|
+
metadata: {
|
|
2201
|
+
title: `${t} node performance workflow`,
|
|
2202
|
+
status: "draft",
|
|
2203
|
+
version: 1
|
|
2204
|
+
}
|
|
2205
|
+
};
|
|
2206
|
+
}, Qe = (e) => {
|
|
2207
|
+
let t = Ze(e), n = typeof performance < "u" ? () => performance.now() : () => Date.now(), r = n(), i = J(t);
|
|
2208
|
+
return {
|
|
2209
|
+
nodeCount: t.nodes.length,
|
|
2210
|
+
edgeCount: t.edges.length,
|
|
2211
|
+
validateMs: n() - r,
|
|
2212
|
+
valid: i.valid,
|
|
2213
|
+
issueCount: i.issues.length
|
|
2214
|
+
};
|
|
2215
|
+
}, $e = {
|
|
2216
|
+
nodes: [
|
|
2217
|
+
{
|
|
2218
|
+
id: "start",
|
|
2219
|
+
type: "startNode",
|
|
2220
|
+
position: {
|
|
2221
|
+
x: 0,
|
|
2222
|
+
y: 120
|
|
2223
|
+
},
|
|
2224
|
+
data: {
|
|
2225
|
+
label: "Request submitted",
|
|
2226
|
+
triggerType: "manual"
|
|
2227
|
+
}
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
id: "approval",
|
|
2231
|
+
type: "approvalNode",
|
|
2232
|
+
position: {
|
|
2233
|
+
x: 280,
|
|
2234
|
+
y: 120
|
|
2235
|
+
},
|
|
2236
|
+
data: {
|
|
2237
|
+
label: "Manager approval",
|
|
2238
|
+
approverRole: "manager",
|
|
2239
|
+
slaHours: 24
|
|
2240
|
+
}
|
|
2241
|
+
},
|
|
2242
|
+
{
|
|
2243
|
+
id: "decision",
|
|
2244
|
+
type: "decisionNode",
|
|
2245
|
+
position: {
|
|
2246
|
+
x: 560,
|
|
2247
|
+
y: 120
|
|
2248
|
+
},
|
|
2249
|
+
data: {
|
|
2250
|
+
label: "Approved?",
|
|
2251
|
+
branches: [{
|
|
2252
|
+
id: "yes",
|
|
2253
|
+
label: "Approved"
|
|
2254
|
+
}, {
|
|
2255
|
+
id: "no",
|
|
2256
|
+
label: "Rejected"
|
|
2257
|
+
}]
|
|
2258
|
+
}
|
|
2259
|
+
},
|
|
2260
|
+
{
|
|
2261
|
+
id: "end-success",
|
|
2262
|
+
type: "endNode",
|
|
2263
|
+
position: {
|
|
2264
|
+
x: 840,
|
|
2265
|
+
y: 40
|
|
2266
|
+
},
|
|
2267
|
+
data: {
|
|
2268
|
+
label: "Approved",
|
|
2269
|
+
outcome: "success"
|
|
2270
|
+
}
|
|
2271
|
+
},
|
|
2272
|
+
{
|
|
2273
|
+
id: "end-failure",
|
|
2274
|
+
type: "endNode",
|
|
2275
|
+
position: {
|
|
2276
|
+
x: 840,
|
|
2277
|
+
y: 200
|
|
2278
|
+
},
|
|
2279
|
+
data: {
|
|
2280
|
+
label: "Rejected",
|
|
2281
|
+
outcome: "failure"
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
],
|
|
2285
|
+
edges: [
|
|
2286
|
+
{
|
|
2287
|
+
id: "start-approval",
|
|
2288
|
+
source: "start",
|
|
2289
|
+
target: "approval",
|
|
2290
|
+
type: "ezEdge"
|
|
2291
|
+
},
|
|
2292
|
+
{
|
|
2293
|
+
id: "approval-decision",
|
|
2294
|
+
source: "approval",
|
|
2295
|
+
target: "decision",
|
|
2296
|
+
type: "ezEdge"
|
|
2297
|
+
},
|
|
2298
|
+
{
|
|
2299
|
+
id: "decision-success",
|
|
2300
|
+
source: "decision",
|
|
2301
|
+
target: "end-success",
|
|
2302
|
+
type: "ezEdge"
|
|
2303
|
+
},
|
|
2304
|
+
{
|
|
2305
|
+
id: "decision-failure",
|
|
2306
|
+
source: "decision",
|
|
2307
|
+
target: "end-failure",
|
|
2308
|
+
type: "ezEdge"
|
|
2309
|
+
}
|
|
2310
|
+
],
|
|
2311
|
+
metadata: {
|
|
2312
|
+
title: "Approval workflow",
|
|
2313
|
+
description: "Human approval with positive and negative outcomes.",
|
|
2314
|
+
status: "draft",
|
|
2315
|
+
version: 1
|
|
2316
|
+
}
|
|
2317
|
+
}, et = {
|
|
2318
|
+
nodes: [
|
|
2319
|
+
{
|
|
2320
|
+
id: "start",
|
|
2321
|
+
type: "startNode",
|
|
2322
|
+
position: {
|
|
2323
|
+
x: 0,
|
|
2324
|
+
y: 100
|
|
2325
|
+
},
|
|
2326
|
+
data: {
|
|
2327
|
+
label: "Webhook received",
|
|
2328
|
+
triggerType: "webhook"
|
|
2329
|
+
}
|
|
2330
|
+
},
|
|
2331
|
+
{
|
|
2332
|
+
id: "request",
|
|
2333
|
+
type: "requestNode",
|
|
2334
|
+
position: {
|
|
2335
|
+
x: 280,
|
|
2336
|
+
y: 100
|
|
2337
|
+
},
|
|
2338
|
+
data: {
|
|
2339
|
+
label: "Create ticket",
|
|
2340
|
+
method: "POST",
|
|
2341
|
+
url: "https://api.example.com/tickets"
|
|
2342
|
+
}
|
|
2343
|
+
},
|
|
2344
|
+
{
|
|
2345
|
+
id: "end",
|
|
2346
|
+
type: "endNode",
|
|
2347
|
+
position: {
|
|
2348
|
+
x: 560,
|
|
2349
|
+
y: 100
|
|
2350
|
+
},
|
|
2351
|
+
data: {
|
|
2352
|
+
label: "Ticket created",
|
|
2353
|
+
outcome: "success"
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
],
|
|
2357
|
+
edges: [{
|
|
2358
|
+
id: "start-request",
|
|
2359
|
+
source: "start",
|
|
2360
|
+
target: "request",
|
|
2361
|
+
type: "ezEdge"
|
|
2362
|
+
}, {
|
|
2363
|
+
id: "request-end",
|
|
2364
|
+
source: "request",
|
|
2365
|
+
target: "end",
|
|
2366
|
+
type: "ezEdge"
|
|
2367
|
+
}],
|
|
2368
|
+
metadata: {
|
|
2369
|
+
title: "API request workflow",
|
|
2370
|
+
description: "Webhook to HTTP request.",
|
|
2371
|
+
status: "draft",
|
|
2372
|
+
version: 1
|
|
2373
|
+
}
|
|
2374
|
+
}, tt = {
|
|
2375
|
+
nodes: [
|
|
2376
|
+
{
|
|
2377
|
+
id: "start",
|
|
2378
|
+
type: "startNode",
|
|
2379
|
+
position: {
|
|
2380
|
+
x: 0,
|
|
2381
|
+
y: 100
|
|
2382
|
+
},
|
|
2383
|
+
data: {
|
|
2384
|
+
label: "Nightly schedule",
|
|
2385
|
+
triggerType: "scheduled"
|
|
2386
|
+
}
|
|
2387
|
+
},
|
|
2388
|
+
{
|
|
2389
|
+
id: "delay",
|
|
2390
|
+
type: "delayNode",
|
|
2391
|
+
position: {
|
|
2392
|
+
x: 280,
|
|
2393
|
+
y: 100
|
|
2394
|
+
},
|
|
2395
|
+
data: {
|
|
2396
|
+
label: "Wait for upstream data",
|
|
2397
|
+
duration: 30,
|
|
2398
|
+
unit: "minutes"
|
|
2399
|
+
}
|
|
2400
|
+
},
|
|
2401
|
+
{
|
|
2402
|
+
id: "action",
|
|
2403
|
+
type: "actionNode",
|
|
2404
|
+
position: {
|
|
2405
|
+
x: 560,
|
|
2406
|
+
y: 100
|
|
2407
|
+
},
|
|
2408
|
+
data: {
|
|
2409
|
+
label: "Run reconciliation",
|
|
2410
|
+
actionType: "reconcile"
|
|
2411
|
+
}
|
|
2412
|
+
},
|
|
2413
|
+
{
|
|
2414
|
+
id: "end",
|
|
2415
|
+
type: "endNode",
|
|
2416
|
+
position: {
|
|
2417
|
+
x: 840,
|
|
2418
|
+
y: 100
|
|
2419
|
+
},
|
|
2420
|
+
data: {
|
|
2421
|
+
label: "Completed",
|
|
2422
|
+
outcome: "success"
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
],
|
|
2426
|
+
edges: [
|
|
2427
|
+
{
|
|
2428
|
+
id: "start-delay",
|
|
2429
|
+
source: "start",
|
|
2430
|
+
target: "delay",
|
|
2431
|
+
type: "ezEdge"
|
|
2432
|
+
},
|
|
2433
|
+
{
|
|
2434
|
+
id: "delay-action",
|
|
2435
|
+
source: "delay",
|
|
2436
|
+
target: "action",
|
|
2437
|
+
type: "ezEdge"
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
id: "action-end",
|
|
2441
|
+
source: "action",
|
|
2442
|
+
target: "end",
|
|
2443
|
+
type: "ezEdge"
|
|
2444
|
+
}
|
|
2445
|
+
],
|
|
2446
|
+
metadata: {
|
|
2447
|
+
title: "Scheduled workflow",
|
|
2448
|
+
description: "Scheduled job with delayed execution.",
|
|
2449
|
+
status: "draft",
|
|
2450
|
+
version: 1
|
|
2451
|
+
}
|
|
2452
|
+
}, nt = {
|
|
2453
|
+
nodes: [
|
|
2454
|
+
{
|
|
2455
|
+
id: "start",
|
|
2456
|
+
type: "startNode",
|
|
2457
|
+
position: {
|
|
2458
|
+
x: 0,
|
|
2459
|
+
y: 100
|
|
2460
|
+
},
|
|
2461
|
+
data: {
|
|
2462
|
+
label: "Case opened",
|
|
2463
|
+
triggerType: "manual"
|
|
2464
|
+
}
|
|
2465
|
+
},
|
|
2466
|
+
{
|
|
2467
|
+
id: "review",
|
|
2468
|
+
type: "approvalNode",
|
|
2469
|
+
position: {
|
|
2470
|
+
x: 280,
|
|
2471
|
+
y: 100
|
|
2472
|
+
},
|
|
2473
|
+
data: {
|
|
2474
|
+
label: "Specialist review",
|
|
2475
|
+
approverRole: "specialist",
|
|
2476
|
+
escalationRole: "team-lead",
|
|
2477
|
+
slaHours: 8
|
|
2478
|
+
}
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
id: "action",
|
|
2482
|
+
type: "actionNode",
|
|
2483
|
+
position: {
|
|
2484
|
+
x: 560,
|
|
2485
|
+
y: 100
|
|
2486
|
+
},
|
|
2487
|
+
data: {
|
|
2488
|
+
label: "Apply decision",
|
|
2489
|
+
actionType: "apply-review-outcome"
|
|
2490
|
+
}
|
|
2491
|
+
},
|
|
2492
|
+
{
|
|
2493
|
+
id: "end",
|
|
2494
|
+
type: "endNode",
|
|
2495
|
+
position: {
|
|
2496
|
+
x: 840,
|
|
2497
|
+
y: 100
|
|
2498
|
+
},
|
|
2499
|
+
data: {
|
|
2500
|
+
label: "Case closed",
|
|
2501
|
+
outcome: "success"
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
],
|
|
2505
|
+
edges: [
|
|
2506
|
+
{
|
|
2507
|
+
id: "start-review",
|
|
2508
|
+
source: "start",
|
|
2509
|
+
target: "review",
|
|
2510
|
+
type: "ezEdge"
|
|
2511
|
+
},
|
|
2512
|
+
{
|
|
2513
|
+
id: "review-action",
|
|
2514
|
+
source: "review",
|
|
2515
|
+
target: "action",
|
|
2516
|
+
type: "ezEdge"
|
|
2517
|
+
},
|
|
2518
|
+
{
|
|
2519
|
+
id: "action-end",
|
|
2520
|
+
source: "action",
|
|
2521
|
+
target: "end",
|
|
2522
|
+
type: "ezEdge"
|
|
2523
|
+
}
|
|
2524
|
+
],
|
|
2525
|
+
metadata: {
|
|
2526
|
+
title: "Human review workflow",
|
|
2527
|
+
description: "Human review followed by an automated action.",
|
|
2528
|
+
status: "draft",
|
|
2529
|
+
version: 1
|
|
2530
|
+
}
|
|
2531
|
+
};
|
|
2532
|
+
//#endregion
|
|
2533
|
+
export { I as A, H as C, z as D, B as E, R as O, ke as S, V as T, Fe as _, Ze as a, je as b, Je as c, $ as d, He as f, Le as g, Y as h, tt as i, De as j, L as k, Xe as l, J as m, $e as n, Qe as o, ze as p, nt as r, Ye as s, et as t, Ge as u, Pe as v, Oe as w, Ae as x, Me as y };
|