@michael_home/workflow-engine-vue 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CanvasView.vue.d.ts +108 -0
- package/dist/CanvasView.vue.d.ts.map +1 -0
- package/dist/EdgeView.vue.d.ts +41 -0
- package/dist/EdgeView.vue.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +810 -0
- package/dist/style.css +1 -1
- package/package.json +12 -10
- package/dist/index.mjs +0 -457
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.canvas-view[data-v-
|
|
1
|
+
.canvas-view[data-v-209f0bd3]{position:relative;overflow:hidden;border:1px solid #dee2e6;background:#f8f9fa}.zoom-controls[data-v-209f0bd3]{position:absolute;top:8px;right:8px;z-index:2;display:inline-flex;align-items:center;gap:4px;background:#fffffff2;border:1px solid #cbd5e1;border-radius:6px;padding:4px 6px}.zoom-btn[data-v-209f0bd3]{width:24px;height:24px;border:1px solid #cbd5e1;border-radius:4px;background:#f8fafc;cursor:pointer;line-height:1}.zoom-text[data-v-209f0bd3]{min-width:44px;text-align:center;font-size:12px;color:#334155}.canvas-svg[data-v-209f0bd3]{width:100%;height:100%}rect.selected[data-v-209f0bd3],polygon.selected[data-v-209f0bd3]{stroke:#2563eb;stroke-width:2}.port-dot[data-v-209f0bd3]{cursor:crosshair}.edge-path[data-v-209f0bd3],.edge-arrow[data-v-209f0bd3]{cursor:pointer}.edge-flowing[data-v-209f0bd3]{animation:edge-flow-209f0bd3 .8s linear infinite}@keyframes edge-flow-209f0bd3{0%{stroke-dashoffset:0}to{stroke-dashoffset:-13}}.edge-label[data-v-209f0bd3]{font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none}.node-title-foreign[data-v-209f0bd3]{pointer-events:none}.node-title-dom[data-v-209f0bd3]{width:100%;height:100%;display:flex;align-items:center;justify-content:center;gap:6px;font-size:13px;-webkit-user-select:none;user-select:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-icon-dom[data-v-209f0bd3],.node-icon-fallback[data-v-209f0bd3]{flex:0 0 auto}.node-title-text[data-v-209f0bd3]{overflow:hidden;text-overflow:ellipsis}
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michael_home/workflow-engine-vue",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Vue 3 components for workflow engine canvas",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
7
|
-
"module": "./dist/index.
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
11
12
|
"require": "./dist/index.cjs",
|
|
12
|
-
"import": "./dist/index.mjs",
|
|
13
13
|
"types": "./dist/index.d.ts"
|
|
14
|
-
}
|
|
14
|
+
},
|
|
15
|
+
"./dist/style.css": "./dist/style.css"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"dist"
|
|
@@ -28,18 +29,19 @@
|
|
|
28
29
|
"vue": "^3.5.0"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@michael_home/workflow-engine-core": "1.0.
|
|
32
|
-
"@michael_home/workflow-engine-svg-renderer": "1.0.
|
|
32
|
+
"@michael_home/workflow-engine-core": "^1.0.3",
|
|
33
|
+
"@michael_home/workflow-engine-svg-renderer": "^1.0.3"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@vitejs/plugin-vue": "^5.0.0",
|
|
36
37
|
"typescript": "^5.3.0",
|
|
37
38
|
"vite": "^5.0.0",
|
|
38
|
-
"vue": "^3.5.0"
|
|
39
|
+
"vue": "^3.5.0",
|
|
40
|
+
"vue-tsc": "^3.2.0"
|
|
39
41
|
},
|
|
40
42
|
"scripts": {
|
|
41
|
-
"build": "vite build",
|
|
42
|
-
"check": "echo 'Vue package type checking
|
|
43
|
+
"build": "vite build && vue-tsc --emitDeclarationOnly --outDir dist",
|
|
44
|
+
"check": "echo 'Vue package type checking'",
|
|
43
45
|
"clean": "rm -rf dist"
|
|
44
46
|
}
|
|
45
47
|
}
|
package/dist/index.mjs
DELETED
|
@@ -1,457 +0,0 @@
|
|
|
1
|
-
import { defineComponent as ke, ref as R, watch as me, computed as w, reactive as x, onMounted as Ce, onUnmounted as xe, openBlock as d, createElementBlock as l, createElementVNode as c, toDisplayString as P, withModifiers as p, Fragment as k, renderList as T, normalizeClass as _, createCommentVNode as $, normalizeStyle as Pe, withDirectives as _e, vShow as ze } from "vue";
|
|
2
|
-
import { resolveLinkSource as Q, buildPreviewRoute as Ne, PortDirection as z, getPortPoint as be, shouldActivateLinkDrag as Me, resolveNodeDragPosition as Xe, resolveLinkCompletion as Ee } from "@michael_home/workflow-engine-core";
|
|
3
|
-
import { renderSvgEdge as ee } from "@michael_home/workflow-engine-svg-renderer";
|
|
4
|
-
const Ye = { class: "zoom-controls" }, De = { class: "zoom-text" }, Se = ["viewBox"], Le = ["transform"], Re = { class: "edge-layer" }, Te = ["d", "onMousedown"], $e = ["d", "stroke", "stroke-dasharray", "onMousedown"], Be = ["points", "fill", "stroke", "onMousedown"], Fe = ["x", "y", "fill"], Oe = ["d"], Ae = ["points"], He = { class: "node-layer" }, We = ["transform"], Ve = ["x", "y", "width", "height", "fill", "onMousedown"], je = ["x", "y", "width", "height", "rx", "ry", "fill", "onMousedown"], Ge = ["points", "fill", "onMousedown"], Ue = ["x", "y", "width", "height"], qe = {
|
|
5
|
-
key: 0,
|
|
6
|
-
width: "14",
|
|
7
|
-
height: "14",
|
|
8
|
-
class: "node-icon-dom",
|
|
9
|
-
"aria-hidden": "true"
|
|
10
|
-
}, Ke = ["href", "fill"], Ze = {
|
|
11
|
-
key: 1,
|
|
12
|
-
class: "node-icon-fallback"
|
|
13
|
-
}, Je = { class: "node-title-text" }, Qe = ["cx", "cy", "onMousedown"], et = /* @__PURE__ */ ke({
|
|
14
|
-
__name: "CanvasView",
|
|
15
|
-
props: {
|
|
16
|
-
nodes: {},
|
|
17
|
-
edges: {},
|
|
18
|
-
selectedNodeId: {},
|
|
19
|
-
selectedEdgeId: {},
|
|
20
|
-
width: {},
|
|
21
|
-
height: {},
|
|
22
|
-
panX: { default: 0 },
|
|
23
|
-
panY: { default: 0 },
|
|
24
|
-
zoom: { default: 1 },
|
|
25
|
-
snapToGrid: { type: Boolean, default: !0 },
|
|
26
|
-
gridSize: { default: 10 },
|
|
27
|
-
alignThreshold: { default: 10 },
|
|
28
|
-
portHitRadius: { default: 14 },
|
|
29
|
-
portDragThreshold: { default: 4 }
|
|
30
|
-
},
|
|
31
|
-
emits: ["selectionChange", "nodePositionChange", "edgeCreate", "edgeDelete", "nodeDelete"],
|
|
32
|
-
setup(h, { emit: N }) {
|
|
33
|
-
const s = h, f = N, u = R(s.zoom), b = (t) => Math.min(2, Math.max(0.4, Number(t.toFixed(2)))), te = () => {
|
|
34
|
-
u.value = b(u.value + 0.1);
|
|
35
|
-
}, oe = () => {
|
|
36
|
-
u.value = b(u.value - 0.1);
|
|
37
|
-
};
|
|
38
|
-
me(
|
|
39
|
-
() => s.zoom,
|
|
40
|
-
(t) => {
|
|
41
|
-
u.value = b(t);
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
const ne = w(
|
|
45
|
-
() => `translate(${s.panX} ${s.panY}) scale(${u.value})`
|
|
46
|
-
), m = R(), B = R(), C = x({ width: 700, height: 240 });
|
|
47
|
-
let y;
|
|
48
|
-
const F = w(() => s.width ?? C.width), O = w(() => s.height ?? C.height), i = x({
|
|
49
|
-
active: !1,
|
|
50
|
-
nodeId: "",
|
|
51
|
-
offsetX: 0,
|
|
52
|
-
offsetY: 0,
|
|
53
|
-
latestClientX: 0,
|
|
54
|
-
latestClientY: 0
|
|
55
|
-
}), n = x({
|
|
56
|
-
active: !1,
|
|
57
|
-
sourceNodeId: "",
|
|
58
|
-
sourcePortId: "",
|
|
59
|
-
pendingClick: !1,
|
|
60
|
-
pressedClientX: 0,
|
|
61
|
-
pressedClientY: 0,
|
|
62
|
-
currentX: 0,
|
|
63
|
-
currentY: 0
|
|
64
|
-
}), g = x({ rafId: 0, scheduled: !1 }), se = (t) => {
|
|
65
|
-
const o = t.data;
|
|
66
|
-
return (o == null ? void 0 : o.text) ?? "";
|
|
67
|
-
}, re = (t) => {
|
|
68
|
-
const o = t.data;
|
|
69
|
-
return (o == null ? void 0 : o.lineColor) ?? "#1c7ed6";
|
|
70
|
-
}, ie = (t) => {
|
|
71
|
-
const o = t.data;
|
|
72
|
-
return (o == null ? void 0 : o.fontColor) ?? "#0f172a";
|
|
73
|
-
}, de = (t) => {
|
|
74
|
-
const o = t.data;
|
|
75
|
-
return (o == null ? void 0 : o.lineStyle) === "dashed" ? "6 4" : void 0;
|
|
76
|
-
}, le = (t) => {
|
|
77
|
-
const o = t.data;
|
|
78
|
-
return (o == null ? void 0 : o.runtimeStatus) ?? "idle";
|
|
79
|
-
}, ce = (t) => le(t) === "pending", ae = (t) => {
|
|
80
|
-
if (t.length < 2) return;
|
|
81
|
-
const o = [];
|
|
82
|
-
let e = 0;
|
|
83
|
-
for (let a = 1; a < t.length; a += 1) {
|
|
84
|
-
const v = t[a - 1], S = t[a], L = Math.hypot(S.x - v.x, S.y - v.y);
|
|
85
|
-
L !== 0 && (o.push({ start: v, end: S, length: L }), e += L);
|
|
86
|
-
}
|
|
87
|
-
if (o.length === 0 || e === 0) return;
|
|
88
|
-
const r = e / 2;
|
|
89
|
-
let I = 0;
|
|
90
|
-
for (const a of o) {
|
|
91
|
-
if (I + a.length >= r) {
|
|
92
|
-
const v = (r - I) / a.length;
|
|
93
|
-
return {
|
|
94
|
-
x: a.start.x + (a.end.x - a.start.x) * v,
|
|
95
|
-
y: a.start.y + (a.end.y - a.start.y) * v
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
I += a.length;
|
|
99
|
-
}
|
|
100
|
-
const J = o[o.length - 1];
|
|
101
|
-
return { x: J.end.x, y: J.end.y };
|
|
102
|
-
}, ue = w(
|
|
103
|
-
() => s.edges.map((t) => {
|
|
104
|
-
const o = t.points ?? [], e = ee(o, { pixelSnap: !0 });
|
|
105
|
-
return {
|
|
106
|
-
edge: t,
|
|
107
|
-
edgeId: t.id,
|
|
108
|
-
path: e.path,
|
|
109
|
-
arrow: e.arrow,
|
|
110
|
-
label: se(t),
|
|
111
|
-
lineColor: re(t),
|
|
112
|
-
lineDasharray: de(t),
|
|
113
|
-
labelColor: ie(t),
|
|
114
|
-
labelPoint: ae(o),
|
|
115
|
-
flowing: ce(t)
|
|
116
|
-
};
|
|
117
|
-
})
|
|
118
|
-
), he = (t) => {
|
|
119
|
-
const o = t.data;
|
|
120
|
-
return (o == null ? void 0 : o.title) ?? t.id;
|
|
121
|
-
}, M = (t) => {
|
|
122
|
-
const o = t.data;
|
|
123
|
-
return (o == null ? void 0 : o.icon) ?? "";
|
|
124
|
-
}, A = (t) => {
|
|
125
|
-
const o = M(t);
|
|
126
|
-
return !o || !o.startsWith("icon-") ? "" : `#${o}`;
|
|
127
|
-
}, X = (t) => {
|
|
128
|
-
const o = t.data;
|
|
129
|
-
return (o == null ? void 0 : o.runtimeStatus) === "completed" ? o.completedFillColor ?? "#bbf7d0" : (o == null ? void 0 : o.runtimeStatus) === "active" ? "#dcfce7" : (o == null ? void 0 : o.nodeColor) ?? "#ffffff";
|
|
130
|
-
}, H = (t) => {
|
|
131
|
-
const o = t.data;
|
|
132
|
-
return (o == null ? void 0 : o.fontColor) ?? "#0f172a";
|
|
133
|
-
}, W = (t) => {
|
|
134
|
-
const o = t.data;
|
|
135
|
-
return (o == null ? void 0 : o.nodeShape) ?? "rect";
|
|
136
|
-
}, fe = (t) => {
|
|
137
|
-
const o = t.size.width / 2, e = t.size.height / 2;
|
|
138
|
-
return `0,${-e} ${o},0 0,${e} ${-o},0`;
|
|
139
|
-
}, ge = (t) => {
|
|
140
|
-
const o = new Map(t.ports.map((e) => [e.direction, e]));
|
|
141
|
-
return [
|
|
142
|
-
{ direction: z.Top, dx: 0, dy: -t.size.height / 2 },
|
|
143
|
-
{ direction: z.Right, dx: t.size.width / 2, dy: 0 },
|
|
144
|
-
{ direction: z.Bottom, dx: 0, dy: t.size.height / 2 },
|
|
145
|
-
{ direction: z.Left, dx: -t.size.width / 2, dy: 0 }
|
|
146
|
-
].map((e) => ({
|
|
147
|
-
...e,
|
|
148
|
-
port: o.get(e.direction)
|
|
149
|
-
})).filter((e) => !!e.port);
|
|
150
|
-
}, V = (t) => {
|
|
151
|
-
const o = B.value;
|
|
152
|
-
if (!o)
|
|
153
|
-
return { x: t.clientX, y: t.clientY };
|
|
154
|
-
const e = o.getBoundingClientRect();
|
|
155
|
-
return {
|
|
156
|
-
x: t.clientX - e.left,
|
|
157
|
-
y: t.clientY - e.top
|
|
158
|
-
};
|
|
159
|
-
}, E = (t) => ({
|
|
160
|
-
x: (t.x - s.panX) / u.value,
|
|
161
|
-
y: (t.y - s.panY) / u.value
|
|
162
|
-
}), pe = () => {
|
|
163
|
-
if (g.scheduled = !1, !i.active) return;
|
|
164
|
-
const t = s.nodes.find((e) => e.id === i.nodeId);
|
|
165
|
-
if (!t) return;
|
|
166
|
-
const o = Xe({
|
|
167
|
-
node: t,
|
|
168
|
-
nodes: s.nodes,
|
|
169
|
-
alignThreshold: s.alignThreshold,
|
|
170
|
-
clientX: i.latestClientX,
|
|
171
|
-
clientY: i.latestClientY,
|
|
172
|
-
offsetX: i.offsetX,
|
|
173
|
-
offsetY: i.offsetY,
|
|
174
|
-
canvasWidth: F.value / u.value,
|
|
175
|
-
canvasHeight: O.value / u.value,
|
|
176
|
-
gridSize: s.gridSize,
|
|
177
|
-
snapToGrid: s.snapToGrid
|
|
178
|
-
});
|
|
179
|
-
f("nodePositionChange", { nodeId: i.nodeId, position: o });
|
|
180
|
-
}, ve = () => {
|
|
181
|
-
n.active = !1, n.pendingClick = !1, n.sourceNodeId = "", n.sourcePortId = "";
|
|
182
|
-
}, j = () => {
|
|
183
|
-
i.active = !1, i.nodeId = "", g.rafId && (window.cancelAnimationFrame(g.rafId), g.rafId = 0), g.scheduled = !1;
|
|
184
|
-
}, we = () => {
|
|
185
|
-
if (!n.active && !n.pendingClick) return;
|
|
186
|
-
const t = Q({
|
|
187
|
-
sourceNodeId: n.sourceNodeId,
|
|
188
|
-
sourcePortId: n.sourcePortId,
|
|
189
|
-
nodes: s.nodes
|
|
190
|
-
});
|
|
191
|
-
if (t) {
|
|
192
|
-
const o = Ee({
|
|
193
|
-
sourceNodeId: t.sourceNode.id,
|
|
194
|
-
sourcePortId: t.sourcePort.id,
|
|
195
|
-
sourceNode: t.sourceNode,
|
|
196
|
-
sourcePort: t.sourcePort,
|
|
197
|
-
nodes: s.nodes,
|
|
198
|
-
mode: n.pendingClick ? "click" : "drag",
|
|
199
|
-
currentPoint: { x: n.currentX, y: n.currentY },
|
|
200
|
-
hitRadius: s.portHitRadius
|
|
201
|
-
});
|
|
202
|
-
o.targetNodeId && o.targetPortId && f("edgeCreate", {
|
|
203
|
-
sourceNodeId: o.sourceNodeId,
|
|
204
|
-
sourcePortId: o.sourcePortId,
|
|
205
|
-
targetNodeId: o.targetNodeId,
|
|
206
|
-
targetPortId: o.targetPortId
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
ve();
|
|
210
|
-
}, G = w(() => {
|
|
211
|
-
if (!n.active) return [];
|
|
212
|
-
const t = Q({
|
|
213
|
-
sourceNodeId: n.sourceNodeId,
|
|
214
|
-
sourcePortId: n.sourcePortId,
|
|
215
|
-
nodes: s.nodes
|
|
216
|
-
});
|
|
217
|
-
return t ? Ne({
|
|
218
|
-
sourceNode: t.sourceNode,
|
|
219
|
-
sourcePort: t.sourcePort,
|
|
220
|
-
nodes: s.nodes,
|
|
221
|
-
currentPoint: { x: n.currentX, y: n.currentY },
|
|
222
|
-
hitRadius: s.portHitRadius
|
|
223
|
-
}).points : [];
|
|
224
|
-
}), U = w(() => ee(G.value, { pixelSnap: !0 })), Y = (t, o) => {
|
|
225
|
-
if (n.active) return;
|
|
226
|
-
o.preventDefault(), f("selectionChange", { nodeId: t.id }), i.active = !0, i.nodeId = t.id;
|
|
227
|
-
const e = E(V(o));
|
|
228
|
-
i.offsetX = e.x - t.position.x, i.offsetY = e.y - t.position.y, i.latestClientX = e.x, i.latestClientY = e.y;
|
|
229
|
-
}, ye = (t, o, e) => {
|
|
230
|
-
e.preventDefault(), f("selectionChange", { nodeId: t.id });
|
|
231
|
-
const r = be(t, o);
|
|
232
|
-
n.active = !1, n.pendingClick = !0, n.pressedClientX = e.clientX, n.pressedClientY = e.clientY, n.sourceNodeId = t.id, n.sourcePortId = o.id, n.currentX = r.x, n.currentY = r.y;
|
|
233
|
-
}, D = (t, o) => {
|
|
234
|
-
o.preventDefault(), o.stopPropagation(), f("selectionChange", { edgeId: t.id });
|
|
235
|
-
}, Ie = () => {
|
|
236
|
-
n.active || i.active || f("selectionChange", {});
|
|
237
|
-
}, q = (t) => {
|
|
238
|
-
const o = V(t);
|
|
239
|
-
if (n.pendingClick && !n.active && Me({
|
|
240
|
-
pressedClientX: n.pressedClientX,
|
|
241
|
-
pressedClientY: n.pressedClientY,
|
|
242
|
-
currentClientX: t.clientX,
|
|
243
|
-
currentClientY: t.clientY,
|
|
244
|
-
threshold: s.portDragThreshold
|
|
245
|
-
}) && (n.active = !0, n.pendingClick = !1), n.active) {
|
|
246
|
-
const r = E(o);
|
|
247
|
-
n.currentX = r.x, n.currentY = r.y;
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
if (!i.active) return;
|
|
251
|
-
const e = E(o);
|
|
252
|
-
i.latestClientX = e.x, i.latestClientY = e.y, !g.scheduled && (g.scheduled = !0, g.rafId = window.requestAnimationFrame(pe));
|
|
253
|
-
}, K = () => {
|
|
254
|
-
j(), we();
|
|
255
|
-
}, Z = (t) => {
|
|
256
|
-
if (t.key !== "Delete" && t.key !== "Backspace") return;
|
|
257
|
-
const o = t.target;
|
|
258
|
-
if (o) {
|
|
259
|
-
const e = o.tagName;
|
|
260
|
-
if (e === "INPUT" || e === "TEXTAREA" || o.isContentEditable)
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
if (s.selectedEdgeId) {
|
|
264
|
-
t.preventDefault(), f("edgeDelete", { edgeId: s.selectedEdgeId });
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
s.selectedNodeId && (t.preventDefault(), f("nodeDelete", { nodeId: s.selectedNodeId }));
|
|
268
|
-
};
|
|
269
|
-
return Ce(() => {
|
|
270
|
-
const t = () => {
|
|
271
|
-
const o = m.value;
|
|
272
|
-
if (!o) return;
|
|
273
|
-
const e = o.getBoundingClientRect();
|
|
274
|
-
e.width > 0 && (C.width = e.width), e.height > 0 && (C.height = e.height);
|
|
275
|
-
};
|
|
276
|
-
t(), y = new ResizeObserver(t), m.value && y.observe(m.value), window.addEventListener("mousemove", q), window.addEventListener("mouseup", K), window.addEventListener("keydown", Z);
|
|
277
|
-
}), xe(() => {
|
|
278
|
-
j(), y == null || y.disconnect(), window.removeEventListener("mousemove", q), window.removeEventListener("mouseup", K), window.removeEventListener("keydown", Z);
|
|
279
|
-
}), (t, o) => (d(), l("section", {
|
|
280
|
-
ref_key: "containerRef",
|
|
281
|
-
ref: m,
|
|
282
|
-
class: "canvas-view",
|
|
283
|
-
style: { width: "100%", height: "100%" }
|
|
284
|
-
}, [
|
|
285
|
-
c("div", Ye, [
|
|
286
|
-
c("button", {
|
|
287
|
-
type: "button",
|
|
288
|
-
class: "zoom-btn",
|
|
289
|
-
onClick: oe
|
|
290
|
-
}, "-"),
|
|
291
|
-
c("span", De, P(Math.round(u.value * 100)) + "%", 1),
|
|
292
|
-
c("button", {
|
|
293
|
-
type: "button",
|
|
294
|
-
class: "zoom-btn",
|
|
295
|
-
onClick: te
|
|
296
|
-
}, "+")
|
|
297
|
-
]),
|
|
298
|
-
(d(), l("svg", {
|
|
299
|
-
ref_key: "svgRef",
|
|
300
|
-
ref: B,
|
|
301
|
-
class: "canvas-svg",
|
|
302
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
303
|
-
viewBox: `0 0 ${F.value} ${O.value}`,
|
|
304
|
-
onMousedown: p(Ie, ["self"])
|
|
305
|
-
}, [
|
|
306
|
-
c("g", { transform: ne.value }, [
|
|
307
|
-
c("g", Re, [
|
|
308
|
-
(d(!0), l(k, null, T(ue.value, (e) => (d(), l(k, {
|
|
309
|
-
key: e.edgeId
|
|
310
|
-
}, [
|
|
311
|
-
c("path", {
|
|
312
|
-
d: e.path,
|
|
313
|
-
fill: "none",
|
|
314
|
-
stroke: "transparent",
|
|
315
|
-
"stroke-width": "15",
|
|
316
|
-
"vector-effect": "non-scaling-stroke",
|
|
317
|
-
class: "edge-hit",
|
|
318
|
-
onMousedown: p((r) => D(e.edge, r), ["stop"])
|
|
319
|
-
}, null, 40, Te),
|
|
320
|
-
c("path", {
|
|
321
|
-
d: e.path,
|
|
322
|
-
stroke: h.selectedEdgeId === e.edgeId ? "#2563eb" : e.lineColor,
|
|
323
|
-
"stroke-width": "1",
|
|
324
|
-
fill: "none",
|
|
325
|
-
"stroke-linecap": "round",
|
|
326
|
-
"stroke-linejoin": "round",
|
|
327
|
-
"vector-effect": "non-scaling-stroke",
|
|
328
|
-
"shape-rendering": "geometricPrecision",
|
|
329
|
-
class: _(["edge-path", { "edge-flowing": e.flowing }]),
|
|
330
|
-
"stroke-dasharray": e.lineDasharray ?? (e.flowing ? "7 6" : void 0),
|
|
331
|
-
onMousedown: p((r) => D(e.edge, r), ["stop"])
|
|
332
|
-
}, null, 42, $e),
|
|
333
|
-
c("polygon", {
|
|
334
|
-
points: e.arrow,
|
|
335
|
-
fill: h.selectedEdgeId === e.edgeId ? "#2563eb" : e.lineColor,
|
|
336
|
-
stroke: h.selectedEdgeId === e.edgeId ? "#2563eb" : e.lineColor,
|
|
337
|
-
"vector-effect": "non-scaling-stroke",
|
|
338
|
-
"shape-rendering": "geometricPrecision",
|
|
339
|
-
class: "edge-arrow",
|
|
340
|
-
onMousedown: p((r) => D(e.edge, r), ["stop"])
|
|
341
|
-
}, null, 40, Be),
|
|
342
|
-
e.label && e.labelPoint ? (d(), l("text", {
|
|
343
|
-
key: 0,
|
|
344
|
-
x: e.labelPoint.x,
|
|
345
|
-
y: e.labelPoint.y,
|
|
346
|
-
class: "edge-label",
|
|
347
|
-
fill: e.labelColor,
|
|
348
|
-
"text-anchor": "middle",
|
|
349
|
-
"dominant-baseline": "central"
|
|
350
|
-
}, P(e.label), 9, Fe)) : $("", !0)
|
|
351
|
-
], 64))), 128)),
|
|
352
|
-
G.value.length > 1 ? (d(), l(k, { key: 0 }, [
|
|
353
|
-
c("path", {
|
|
354
|
-
d: U.value.path,
|
|
355
|
-
stroke: "#94a3b8",
|
|
356
|
-
"stroke-width": "2",
|
|
357
|
-
fill: "none",
|
|
358
|
-
"stroke-linecap": "round",
|
|
359
|
-
"stroke-linejoin": "round",
|
|
360
|
-
"vector-effect": "non-scaling-stroke",
|
|
361
|
-
"shape-rendering": "geometricPrecision"
|
|
362
|
-
}, null, 8, Oe),
|
|
363
|
-
c("polygon", {
|
|
364
|
-
points: U.value.arrow,
|
|
365
|
-
fill: "#94a3b8",
|
|
366
|
-
stroke: "#94a3b8",
|
|
367
|
-
"vector-effect": "non-scaling-stroke",
|
|
368
|
-
"shape-rendering": "geometricPrecision"
|
|
369
|
-
}, null, 8, Ae)
|
|
370
|
-
], 64)) : $("", !0)
|
|
371
|
-
]),
|
|
372
|
-
c("g", He, [
|
|
373
|
-
(d(!0), l(k, null, T(h.nodes, (e) => (d(), l("g", {
|
|
374
|
-
key: e.id,
|
|
375
|
-
class: "node-group",
|
|
376
|
-
transform: `translate(${e.position.x + e.size.width / 2} ${e.position.y + e.size.height / 2})`
|
|
377
|
-
}, [
|
|
378
|
-
W(e) === "rect" ? (d(), l("rect", {
|
|
379
|
-
key: 0,
|
|
380
|
-
x: -e.size.width / 2,
|
|
381
|
-
y: -e.size.height / 2,
|
|
382
|
-
width: e.size.width,
|
|
383
|
-
height: e.size.height,
|
|
384
|
-
rx: "4",
|
|
385
|
-
ry: "4",
|
|
386
|
-
fill: X(e),
|
|
387
|
-
stroke: "#0f172a",
|
|
388
|
-
class: _({ selected: h.selectedNodeId === e.id }),
|
|
389
|
-
onMousedown: p((r) => Y(e, r), ["stop"])
|
|
390
|
-
}, null, 42, Ve)) : W(e) === "ellipse" ? (d(), l("rect", {
|
|
391
|
-
key: 1,
|
|
392
|
-
x: -e.size.width / 2,
|
|
393
|
-
y: -e.size.height / 2,
|
|
394
|
-
width: e.size.width,
|
|
395
|
-
height: e.size.height,
|
|
396
|
-
rx: e.size.height / 2,
|
|
397
|
-
ry: e.size.height / 2,
|
|
398
|
-
fill: X(e),
|
|
399
|
-
stroke: "#0f172a",
|
|
400
|
-
class: _({ selected: h.selectedNodeId === e.id }),
|
|
401
|
-
onMousedown: p((r) => Y(e, r), ["stop"])
|
|
402
|
-
}, null, 42, je)) : (d(), l("polygon", {
|
|
403
|
-
key: 2,
|
|
404
|
-
points: fe(e),
|
|
405
|
-
fill: X(e),
|
|
406
|
-
stroke: "#0f172a",
|
|
407
|
-
class: _({ selected: h.selectedNodeId === e.id }),
|
|
408
|
-
onMousedown: p((r) => Y(e, r), ["stop"])
|
|
409
|
-
}, null, 42, Ge)),
|
|
410
|
-
(d(), l("foreignObject", {
|
|
411
|
-
x: -e.size.width / 2,
|
|
412
|
-
y: -e.size.height / 2,
|
|
413
|
-
width: e.size.width,
|
|
414
|
-
height: e.size.height,
|
|
415
|
-
class: "node-title-foreign"
|
|
416
|
-
}, [
|
|
417
|
-
c("div", {
|
|
418
|
-
xmlns: "http://www.w3.org/1999/xhtml",
|
|
419
|
-
class: "node-title-dom",
|
|
420
|
-
style: Pe({ color: H(e) })
|
|
421
|
-
}, [
|
|
422
|
-
A(e) ? (d(), l("svg", qe, [
|
|
423
|
-
c("use", {
|
|
424
|
-
href: A(e),
|
|
425
|
-
fill: H(e)
|
|
426
|
-
}, null, 8, Ke)
|
|
427
|
-
])) : M(e) ? (d(), l("span", Ze, P(M(e)), 1)) : $("", !0),
|
|
428
|
-
c("span", Je, P(he(e)), 1)
|
|
429
|
-
], 4)
|
|
430
|
-
], 8, Ue)),
|
|
431
|
-
(d(!0), l(k, null, T(ge(e), (r) => _e((d(), l("circle", {
|
|
432
|
-
key: r.port.id,
|
|
433
|
-
cx: r.dx,
|
|
434
|
-
cy: r.dy,
|
|
435
|
-
r: "5",
|
|
436
|
-
fill: "#ffffff",
|
|
437
|
-
stroke: "#1d4ed8",
|
|
438
|
-
class: "port-dot",
|
|
439
|
-
onMousedown: p((I) => ye(e, r.port, I), ["stop"])
|
|
440
|
-
}, null, 40, Qe)), [
|
|
441
|
-
[ze, h.selectedNodeId === e.id]
|
|
442
|
-
])), 128))
|
|
443
|
-
], 8, We))), 128))
|
|
444
|
-
])
|
|
445
|
-
], 8, Le)
|
|
446
|
-
], 40, Se))
|
|
447
|
-
], 512));
|
|
448
|
-
}
|
|
449
|
-
}), tt = (h, N) => {
|
|
450
|
-
const s = h.__vccOpts || h;
|
|
451
|
-
for (const [f, u] of N)
|
|
452
|
-
s[f] = u;
|
|
453
|
-
return s;
|
|
454
|
-
}, rt = /* @__PURE__ */ tt(et, [["__scopeId", "data-v-72a1e4d3"]]);
|
|
455
|
-
export {
|
|
456
|
-
rt as CanvasView
|
|
457
|
-
};
|