@infotrust/ui 0.30.1 → 0.30.2
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/dag.js +508 -496
- package/package.json +2 -2
package/dist/dag.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as Xe, inject as dt, computed as E, openBlock as b, createElementBlock as _, normalizeClass as Ie, createElementVNode as U, Fragment as
|
|
1
|
+
import { defineComponent as Xe, inject as dt, computed as E, openBlock as b, createElementBlock as _, normalizeClass as Ie, createElementVNode as U, Fragment as K, renderList as ge, normalizeStyle as rt, createCommentVNode as C, createBlock as O, resolveDynamicComponent as fe, normalizeProps as pn, mergeProps as Te, withDirectives as ye, createTextVNode as be, toDisplayString as G, unref as k, renderSlot as Re, ref as V, watch as te, nextTick as ee, withCtx as X, createVNode as D, markRaw as co, useId as fo, onMounted as go, watchEffect as vo, shallowRef as Ot, onBeforeUnmount as ot, provide as mo, Teleport as po, createSlots as it, toRaw as ho } from "vue";
|
|
2
2
|
import ce from "primevue/button";
|
|
3
3
|
import yo from "primevue/inputtext";
|
|
4
|
-
import { Plus as
|
|
5
|
-
import { NodeIdInjection as Po, Position as Z, Handle as No, getBezierPath as Co, getSmoothStepPath as Mo, useVueFlow as _n, EdgeLabelRenderer as To, getRectOfNodes as
|
|
4
|
+
import { Plus as Yt, Info as bo, Trash2 as En, Minus as wo, Scan as ko, Minimize2 as $o, Maximize2 as xo, Network as Eo, Undo2 as _o, Redo2 as So } from "lucide-vue-next";
|
|
5
|
+
import { NodeIdInjection as Po, Position as Z, Handle as No, getBezierPath as Co, getSmoothStepPath as Mo, useVueFlow as _n, EdgeLabelRenderer as To, getRectOfNodes as hn, VueFlow as Do, ConnectionLineType as yn, ConnectionMode as Ro, Panel as Ft } from "@vue-flow/core";
|
|
6
6
|
import { a as Sn, v as we, _ as ne, p as Io } from "./text-nGkJYA88.js";
|
|
7
|
-
import { s as
|
|
8
|
-
const
|
|
7
|
+
import { s as Bt, _ as Pn, a as zo, b as At, c as Lo, i as Oo, d as Fo, e as Bo, f as Ao, g as Uo, h as Yo } from "./dev-D7A7MIn_.js";
|
|
8
|
+
const Ht = { one: "step", other: "steps" };
|
|
9
9
|
function He(i) {
|
|
10
10
|
return `${i.article ?? (/^[aeiou]/i.test(i.one) ? "an" : "a")} ${i.one}`;
|
|
11
11
|
}
|
|
@@ -20,11 +20,11 @@ function xe(i) {
|
|
|
20
20
|
return i.outputs ?? Vo;
|
|
21
21
|
}
|
|
22
22
|
function ke(i, l) {
|
|
23
|
-
var
|
|
24
|
-
const r = (
|
|
23
|
+
var h, g;
|
|
24
|
+
const r = (v) => "get" in l ? l.get(v) : l.find((c) => c.id === v), n = r(i.source), d = r(i.target);
|
|
25
25
|
return {
|
|
26
|
-
sourcePort: i.sourcePort ?? (n ? (
|
|
27
|
-
targetPort: i.targetPort ?? (d ? (
|
|
26
|
+
sourcePort: i.sourcePort ?? (n ? (h = xe(n)[0]) == null ? void 0 : h.id : void 0),
|
|
27
|
+
targetPort: i.targetPort ?? (d ? (g = $e(d)[0]) == null ? void 0 : g.id : void 0)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
function at(i) {
|
|
@@ -32,33 +32,33 @@ function at(i) {
|
|
|
32
32
|
}
|
|
33
33
|
function Wo(i, l, r) {
|
|
34
34
|
const n = /* @__PURE__ */ new Map();
|
|
35
|
-
for (const
|
|
36
|
-
const d = /* @__PURE__ */ new Set(),
|
|
37
|
-
for (;
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
d.has(
|
|
35
|
+
for (const g of i) n.set(g.source, [...n.get(g.source) ?? [], g.target]);
|
|
36
|
+
const d = /* @__PURE__ */ new Set(), h = [l];
|
|
37
|
+
for (; h.length; ) {
|
|
38
|
+
const g = h.pop();
|
|
39
|
+
if (g === r) return !0;
|
|
40
|
+
d.has(g) || (d.add(g), h.push(...n.get(g) ?? []));
|
|
41
41
|
}
|
|
42
42
|
return !1;
|
|
43
43
|
}
|
|
44
44
|
function jo(i) {
|
|
45
45
|
return i.length < 2 ? i[0] ?? "" : `${i.slice(0, -1).join(", ")} or ${i[i.length - 1]}`;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
var
|
|
49
|
-
const d = n.noun ??
|
|
50
|
-
if (!
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
54
|
-
const
|
|
55
|
-
return
|
|
47
|
+
function bn(i, l, r, n = {}) {
|
|
48
|
+
var p;
|
|
49
|
+
const d = n.noun ?? Ht, h = i.find((y) => y.id === r.source), g = i.find((y) => y.id === r.target);
|
|
50
|
+
if (!h || !g) return `That ${d.one} is no longer on the canvas.`;
|
|
51
|
+
if (h.id === g.id) return `${Ho(He(d))} cannot connect to itself.`;
|
|
52
|
+
const v = xe(h).find((y) => y.id === r.sourcePort), c = $e(g).find((y) => y.id === r.targetPort);
|
|
53
|
+
if (!v || !c) return "Connect an output (right side) to an input (left side).";
|
|
54
|
+
const f = l.filter((y) => y.target === g.id && ke(y, i).targetPort === c.id);
|
|
55
|
+
return f.some((y) => y.source === h.id && ke(y, i).sourcePort === v.id) ? `These ${d.other} are already connected.` : (p = c.accepts) != null && p.length && !(v.type && c.accepts.includes(v.type)) ? `${g.label} takes ${jo(c.accepts)}${v.type ? `, not ${v.type}` : ""}.` : c.max !== void 0 && f.length >= c.max ? `${c.label ?? g.label} takes ${c.max === 1 ? "one connection" : `${c.max} connections`}.` : !n.allowCycles && Wo(l, g.id, h.id) ? "That connection would make a loop." : null;
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const ct = Symbol("ItDagCanvas"), Zo = {
|
|
58
58
|
key: 0,
|
|
59
59
|
class: "it-dag-node__ring",
|
|
60
60
|
"aria-hidden": "true"
|
|
61
|
-
},
|
|
61
|
+
}, qo = { class: "it-dag-node__head" }, Ko = { class: "it-dag-node__titles" }, Go = {
|
|
62
62
|
key: 0,
|
|
63
63
|
class: "it-dag-node__kind"
|
|
64
64
|
}, Qo = { class: "it-dag-node__label" }, Jo = {
|
|
@@ -87,13 +87,13 @@ const ut = Symbol("ItDagCanvas"), Zo = {
|
|
|
87
87
|
selected: { type: Boolean, default: !1 }
|
|
88
88
|
},
|
|
89
89
|
setup(i) {
|
|
90
|
-
const l = i, r = dt(Po, null) !== null, n = dt(
|
|
91
|
-
() => Array.from({ length: Math.max(j.value.length,
|
|
90
|
+
const l = i, r = dt(Po, null) !== null, n = dt(ct, null), d = E(() => (n == null ? void 0 : n.direction()) === "down"), h = E(() => !!l.node.status && !!Bt(l.node.status).live), g = E(() => !h.value && !!l.node.status && !!Bt(l.node.status).waiting), v = [100, 88, 76, 64, 52, 40, 28, 16], c = E(() => r && !!(n != null && n.editable())), f = E(() => !!l.node.kind && l.node.kind.trim().toLowerCase() !== l.node.label.trim().toLowerCase()), p = E(() => $e(l.node)), y = E(() => xe(l.node)), m = (z) => z.length === 1 && !z[0].label, R = E(() => !d.value && m(p.value)), Y = E(() => !d.value && m(y.value)), j = E(() => d.value || R.value ? [] : p.value), q = E(() => d.value || Y.value ? [] : y.value), N = E(
|
|
91
|
+
() => Array.from({ length: Math.max(j.value.length, q.value.length) }, (z, T) => ({ in: j.value[T], out: q.value[T] }))
|
|
92
92
|
);
|
|
93
|
-
function S(z, T, M = 0,
|
|
93
|
+
function S(z, T, M = 0, B = 1) {
|
|
94
94
|
const ie = d.value ? z === "in" ? Z.Top : Z.Bottom : z === "in" ? Z.Left : Z.Right, Q = {
|
|
95
95
|
class: ["it-dag-node__port", `it-dag-node__port--${ie}`],
|
|
96
|
-
style: d.value ? { left: `${(M + 1) / (
|
|
96
|
+
style: d.value ? { left: `${(M + 1) / (B + 1) * 100}%` } : void 0
|
|
97
97
|
};
|
|
98
98
|
return r ? {
|
|
99
99
|
is: No,
|
|
@@ -101,22 +101,22 @@ const ut = Symbol("ItDagCanvas"), Zo = {
|
|
|
101
101
|
} : { is: "span", attrs: { ...Q, "aria-hidden": "true" } };
|
|
102
102
|
}
|
|
103
103
|
return (z, T) => (b(), _("div", {
|
|
104
|
-
class: Ie(["it-dag-node", { "it-dag-node--call": i.node.call || i.node.badge, "it-dag-node--selected": i.selected, "it-dag-node--muted": i.node.muted, "it-dag-node--down": d.value, "it-dag-node--working":
|
|
104
|
+
class: Ie(["it-dag-node", { "it-dag-node--call": i.node.call || i.node.badge, "it-dag-node--selected": i.selected, "it-dag-node--muted": i.node.muted, "it-dag-node--down": d.value, "it-dag-node--working": h.value, "it-dag-node--waiting": g.value }])
|
|
105
105
|
}, [
|
|
106
|
-
|
|
106
|
+
h.value || g.value ? (b(), _("svg", Zo, [
|
|
107
107
|
T[0] || (T[0] = U("rect", {
|
|
108
108
|
class: "it-dag-node__ring-base",
|
|
109
109
|
pathLength: "100"
|
|
110
110
|
}, null, -1)),
|
|
111
|
-
(b(), _(
|
|
111
|
+
(b(), _(K, null, ge(v, (M) => U("rect", {
|
|
112
112
|
key: M,
|
|
113
113
|
class: "it-dag-node__ring-light",
|
|
114
114
|
pathLength: "100",
|
|
115
115
|
style: rt({ "--it-dag-ring-dash": M })
|
|
116
116
|
}, null, 4)), 64))
|
|
117
117
|
])) : C("", !0),
|
|
118
|
-
U("div",
|
|
119
|
-
R.value ? (b(), O(fe(S("in",
|
|
118
|
+
U("div", qo, [
|
|
119
|
+
R.value ? (b(), O(fe(S("in", p.value[0]).is), pn(Te({ key: 0 }, S("in", p.value[0]).attrs)), null, 16)) : C("", !0),
|
|
120
120
|
i.node.platform ? (b(), O(Sn, {
|
|
121
121
|
key: 1,
|
|
122
122
|
class: "it-dag-node__platform",
|
|
@@ -128,8 +128,8 @@ const ut = Symbol("ItDagCanvas"), Zo = {
|
|
|
128
128
|
size: 16,
|
|
129
129
|
"aria-hidden": "true"
|
|
130
130
|
})) : C("", !0),
|
|
131
|
-
U("span",
|
|
132
|
-
|
|
131
|
+
U("span", Ko, [
|
|
132
|
+
f.value ? ye((b(), _("span", Go, [
|
|
133
133
|
be(G(i.node.kind), 1)
|
|
134
134
|
])), [
|
|
135
135
|
[k(we)]
|
|
@@ -140,7 +140,7 @@ const ut = Symbol("ItDagCanvas"), Zo = {
|
|
|
140
140
|
[k(we)]
|
|
141
141
|
])
|
|
142
142
|
]),
|
|
143
|
-
Y.value ? (b(), O(fe(S("out",
|
|
143
|
+
Y.value ? (b(), O(fe(S("out", y.value[0]).is), pn(Te({ key: 3 }, S("out", y.value[0]).attrs)), null, 16)) : C("", !0)
|
|
144
144
|
]),
|
|
145
145
|
i.node.meta || i.node.status ? (b(), _("div", Jo, [
|
|
146
146
|
i.node.meta ? ye((b(), _("span", ei, [
|
|
@@ -171,12 +171,12 @@ const ut = Symbol("ItDagCanvas"), Zo = {
|
|
|
171
171
|
Re(z.$slots, "default")
|
|
172
172
|
])) : C("", !0),
|
|
173
173
|
N.value.length ? (b(), _("ul", ii, [
|
|
174
|
-
(b(!0), _(
|
|
175
|
-
key:
|
|
174
|
+
(b(!0), _(K, null, ge(N.value, (M, B) => (b(), _("li", {
|
|
175
|
+
key: B,
|
|
176
176
|
class: "it-dag-node__port-row"
|
|
177
177
|
}, [
|
|
178
178
|
U("span", ai, [
|
|
179
|
-
M.in ? (b(), _(
|
|
179
|
+
M.in ? (b(), _(K, { key: 0 }, [
|
|
180
180
|
(b(), O(fe(S("in", M.in).is), Te({ ref_for: !0 }, S("in", M.in).attrs), null, 16)),
|
|
181
181
|
T[1] || (T[1] = U("span", { class: "it-sr-only" }, "Input: ", -1)),
|
|
182
182
|
ye((b(), _("span", null, [
|
|
@@ -187,7 +187,7 @@ const ut = Symbol("ItDagCanvas"), Zo = {
|
|
|
187
187
|
], 64)) : C("", !0)
|
|
188
188
|
]),
|
|
189
189
|
U("span", si, [
|
|
190
|
-
M.out ? (b(), _(
|
|
190
|
+
M.out ? (b(), _(K, { key: 0 }, [
|
|
191
191
|
T[2] || (T[2] = U("span", { class: "it-sr-only" }, "Output: ", -1)),
|
|
192
192
|
ye((b(), _("span", null, [
|
|
193
193
|
be(G(M.out.label ?? M.out.id), 1)
|
|
@@ -199,59 +199,71 @@ const ut = Symbol("ItDagCanvas"), Zo = {
|
|
|
199
199
|
])
|
|
200
200
|
]))), 128))
|
|
201
201
|
])) : C("", !0),
|
|
202
|
-
d.value ? (b(), _(
|
|
203
|
-
(b(!0), _(
|
|
202
|
+
d.value ? (b(), _(K, { key: 5 }, [
|
|
203
|
+
(b(!0), _(K, null, ge(p.value, (M, B) => (b(), O(fe(S("in", M, B, p.value.length).is), Te({
|
|
204
204
|
key: `in-${M.id}`
|
|
205
|
-
}, { ref_for: !0 }, S("in", M,
|
|
206
|
-
(b(!0), _(
|
|
205
|
+
}, { ref_for: !0 }, S("in", M, B, p.value.length).attrs), null, 16))), 128)),
|
|
206
|
+
(b(!0), _(K, null, ge(y.value, (M, B) => (b(), O(fe(S("out", M, B, y.value.length).is), Te({
|
|
207
207
|
key: `out-${M.id}`
|
|
208
|
-
}, { ref_for: !0 }, S("out", M,
|
|
208
|
+
}, { ref_for: !0 }, S("out", M, B, y.value.length).attrs), null, 16))), 128))
|
|
209
209
|
], 64)) : C("", !0)
|
|
210
210
|
], 2));
|
|
211
211
|
}
|
|
212
|
-
}),
|
|
212
|
+
}), ut = 1.5, di = 24;
|
|
213
213
|
function ri(i, l, r, n) {
|
|
214
|
-
const d = n ? "y" : "x",
|
|
215
|
-
if (!i || !
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
218
|
-
const c = (
|
|
219
|
-
const
|
|
220
|
-
for (let R =
|
|
214
|
+
const d = n ? "y" : "x", h = n ? "x" : "y", g = (c, f) => Math.abs(c[h] - f[h]) <= ut && Math.abs(c[d] - f[d]) <= di;
|
|
215
|
+
if (!i || !g(i.from, l) || !g(i.to, r)) return null;
|
|
216
|
+
const v = i.bends.map((c) => ({ ...c }));
|
|
217
|
+
if (v.length) {
|
|
218
|
+
const c = (f, p, y) => {
|
|
219
|
+
const m = v[f][d];
|
|
220
|
+
for (let R = f; R >= 0 && R < v.length && Math.abs(v[R][d] - m) <= ut; R += p) v[R][d] = y;
|
|
221
221
|
};
|
|
222
|
-
c(0, 1, l[d]), c(
|
|
222
|
+
c(0, 1, l[d]), c(v.length - 1, -1, r[d]);
|
|
223
223
|
}
|
|
224
|
-
return [l, ...
|
|
224
|
+
return ui([l, ...v, r], h, d);
|
|
225
|
+
}
|
|
226
|
+
function ui(i, l, r) {
|
|
227
|
+
const n = [i[0]];
|
|
228
|
+
for (let d = 1; d < i.length; d++) {
|
|
229
|
+
const [h, g] = [i[d - 1], i[d]];
|
|
230
|
+
if (Math.abs(h.x - g.x) > ut && Math.abs(h.y - g.y) > ut) {
|
|
231
|
+
const v = (h[l] + g[l]) / 2, c = (f) => l === "x" ? { x: v, y: f } : { x: f, y: v };
|
|
232
|
+
n.push(c(h[r]), c(g[r]));
|
|
233
|
+
}
|
|
234
|
+
n.push(g);
|
|
235
|
+
}
|
|
236
|
+
return n;
|
|
225
237
|
}
|
|
226
238
|
const De = (i, l) => Math.hypot(l.x - i.x, l.y - i.y);
|
|
227
|
-
function
|
|
228
|
-
const r = i.filter((
|
|
239
|
+
function ci(i, l) {
|
|
240
|
+
const r = i.filter((v, c) => c === 0 || De(i[c - 1], v) > 0.01);
|
|
229
241
|
let n = `M ${r[0].x},${r[0].y}`;
|
|
230
|
-
for (let
|
|
231
|
-
const [c,
|
|
232
|
-
const N = De(j,
|
|
233
|
-
return { x:
|
|
234
|
-
}, R =
|
|
235
|
-
n += ` L ${R.x},${R.y} Q ${
|
|
242
|
+
for (let v = 1; v < r.length - 1; v++) {
|
|
243
|
+
const [c, f, p] = [r[v - 1], r[v], r[v + 1]], y = Math.min(l, De(c, f) / 2, De(f, p) / 2), m = (j, q) => {
|
|
244
|
+
const N = De(j, f) || 1;
|
|
245
|
+
return { x: f.x + (j.x - f.x) / N * q, y: f.y + (j.y - f.y) / N * q };
|
|
246
|
+
}, R = m(c, y), Y = m(p, y);
|
|
247
|
+
n += ` L ${R.x},${R.y} Q ${f.x},${f.y} ${Y.x},${Y.y}`;
|
|
236
248
|
}
|
|
237
249
|
const d = r[r.length - 1];
|
|
238
250
|
n += ` L ${d.x},${d.y}`;
|
|
239
|
-
let
|
|
240
|
-
for (let
|
|
241
|
-
const c = De(r[
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
return { path: n, labelX: r[
|
|
245
|
-
}
|
|
246
|
-
|
|
251
|
+
let g = r.slice(1).reduce((v, c, f) => v + De(r[f], c), 0) / 2;
|
|
252
|
+
for (let v = 1; v < r.length; v++) {
|
|
253
|
+
const c = De(r[v - 1], r[v]);
|
|
254
|
+
if (g <= c) {
|
|
255
|
+
const f = c ? g / c : 0;
|
|
256
|
+
return { path: n, labelX: r[v - 1].x + (r[v].x - r[v - 1].x) * f, labelY: r[v - 1].y + (r[v].y - r[v - 1].y) * f };
|
|
257
|
+
}
|
|
258
|
+
g -= c;
|
|
247
259
|
}
|
|
248
260
|
return { path: n, labelX: d.x, labelY: d.y };
|
|
249
261
|
}
|
|
250
|
-
const
|
|
262
|
+
const fi = ["d"], gi = ["d"], vi = {
|
|
251
263
|
key: 1,
|
|
252
264
|
class: "it-dag-edge__pulses",
|
|
253
265
|
"aria-hidden": "true"
|
|
254
|
-
},
|
|
266
|
+
}, mi = ["path", "dur", "begin"], pi = ["dur", "begin"], hi = ["d"], wn = 8, yi = 24, kn = 6, st = 8, bi = /* @__PURE__ */ Xe({
|
|
255
267
|
inheritAttrs: !1,
|
|
256
268
|
__name: "ItDagEdge",
|
|
257
269
|
props: {
|
|
@@ -265,7 +277,7 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
265
277
|
data: {}
|
|
266
278
|
},
|
|
267
279
|
setup(i) {
|
|
268
|
-
const l = i, r = dt(
|
|
280
|
+
const l = i, r = dt(ct, null), n = E(() => !!(r != null && r.editable()) && r.hoveredEdge() === l.id), d = E(() => {
|
|
269
281
|
var ie, Q;
|
|
270
282
|
const N = {
|
|
271
283
|
sourceX: l.sourceX,
|
|
@@ -280,26 +292,26 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
280
292
|
return { path: ae, labelX: Ee, labelY: Ve };
|
|
281
293
|
}
|
|
282
294
|
const S = l.sourcePosition === Z.Right || l.sourcePosition === Z.Left, z = ri((Q = l.data) == null ? void 0 : Q.route, { x: l.sourceX, y: l.sourceY }, { x: l.targetX, y: l.targetY }, S);
|
|
283
|
-
if (z) return
|
|
284
|
-
const [T, M,
|
|
285
|
-
return { path: T, labelX: M, labelY:
|
|
286
|
-
}),
|
|
287
|
-
const N = l.sourcePosition === Z.Right || l.sourcePosition === Z.Left, S = `scale(${1 / (
|
|
295
|
+
if (z) return ci(z, wn);
|
|
296
|
+
const [T, M, B] = Mo({ ...N, borderRadius: wn, offset: yi });
|
|
297
|
+
return { path: T, labelX: M, labelY: B };
|
|
298
|
+
}), h = E(() => ({ transform: `translate(-50%, -50%) translate(${d.value.labelX}px, ${d.value.labelY}px)` })), { viewport: g } = _n(), v = E(() => {
|
|
299
|
+
const N = l.sourcePosition === Z.Right || l.sourcePosition === Z.Left, S = `scale(${1 / (g.value.zoom || 1)})`;
|
|
288
300
|
return N ? { transformOrigin: "0 0", transform: `translate(${d.value.labelX}px, ${Math.min(l.sourceY, l.targetY) - kn}px) ${S} translate(-50%, -100%)` } : { transformOrigin: "0 0", transform: `translate(${Math.max(l.sourceX, l.targetX) + kn}px, ${d.value.labelY}px) ${S} translate(0, -50%)` };
|
|
289
|
-
}), c = { speed: 60, spacing: 56, max: 8 },
|
|
301
|
+
}), c = { speed: 60, spacing: 56, max: 8 }, f = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, p = E(() => {
|
|
290
302
|
var N;
|
|
291
303
|
return ((N = l.data) == null ? void 0 : N.tone) === "active";
|
|
292
|
-
}),
|
|
304
|
+
}), y = E(() => {
|
|
293
305
|
var N;
|
|
294
|
-
return
|
|
295
|
-
}),
|
|
306
|
+
return p.value || ((N = l.data) == null ? void 0 : N.tone) === "success";
|
|
307
|
+
}), m = V(null), R = V(0), Y = V(null);
|
|
296
308
|
te(
|
|
297
|
-
[
|
|
309
|
+
[p, () => d.value.path],
|
|
298
310
|
async () => {
|
|
299
311
|
var S, z;
|
|
300
|
-
if (!
|
|
301
|
-
await ee(), R.value = typeof ((S =
|
|
302
|
-
const N = typeof ((z =
|
|
312
|
+
if (!p.value || f) return;
|
|
313
|
+
await ee(), R.value = typeof ((S = m.value) == null ? void 0 : S.getTotalLength) == "function" ? m.value.getTotalLength() : 0;
|
|
314
|
+
const N = typeof ((z = m.value) == null ? void 0 : z.getBBox) == "function" ? m.value.getBBox() : null;
|
|
303
315
|
Y.value = N ? { x: N.x, y: N.y, width: N.width, height: N.height } : null;
|
|
304
316
|
},
|
|
305
317
|
{ immediate: !0 }
|
|
@@ -307,29 +319,29 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
307
319
|
const j = E(() => {
|
|
308
320
|
const N = r == null ? void 0 : r.view(), S = Y.value;
|
|
309
321
|
return !N || !S ? !0 : S.x - st < N.x + N.width && S.x + S.width + st > N.x && S.y - st < N.y + N.height && S.y + S.height + st > N.y;
|
|
310
|
-
}),
|
|
311
|
-
if (!
|
|
322
|
+
}), q = E(() => {
|
|
323
|
+
if (!p.value || f || !R.value || !j.value) return [];
|
|
312
324
|
const N = R.value / c.speed, S = Math.min(c.max, Math.max(1, Math.round(R.value / c.spacing)));
|
|
313
325
|
return Array.from({ length: S }, (z, T) => ({ dur: `${N.toFixed(3)}s`, begin: `${(-(T * N) / S).toFixed(3)}s` }));
|
|
314
326
|
});
|
|
315
327
|
return (N, S) => {
|
|
316
328
|
var z;
|
|
317
|
-
return b(), _(
|
|
318
|
-
|
|
329
|
+
return b(), _(K, null, [
|
|
330
|
+
y.value ? (b(), _("path", {
|
|
319
331
|
key: 0,
|
|
320
332
|
d: d.value.path,
|
|
321
333
|
class: "it-dag-edge__glow",
|
|
322
334
|
fill: "none"
|
|
323
|
-
}, null, 8,
|
|
335
|
+
}, null, 8, fi)) : C("", !0),
|
|
324
336
|
U("path", {
|
|
325
337
|
ref_key: "line",
|
|
326
|
-
ref:
|
|
338
|
+
ref: m,
|
|
327
339
|
d: d.value.path,
|
|
328
340
|
class: Ie(["vue-flow__edge-path it-dag-edge__path", { "it-dag-edge__path--hot": n.value }]),
|
|
329
341
|
fill: "none"
|
|
330
|
-
}, null, 10,
|
|
331
|
-
|
|
332
|
-
(b(!0), _(
|
|
342
|
+
}, null, 10, gi),
|
|
343
|
+
q.value.length ? (b(), _("g", vi, [
|
|
344
|
+
(b(!0), _(K, null, ge(q.value, (T, M) => (b(), _("circle", {
|
|
333
345
|
key: M,
|
|
334
346
|
class: "it-dag-edge__pulse",
|
|
335
347
|
r: "2.5"
|
|
@@ -339,7 +351,7 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
339
351
|
dur: T.dur,
|
|
340
352
|
begin: T.begin,
|
|
341
353
|
repeatCount: "indefinite"
|
|
342
|
-
}, null, 8,
|
|
354
|
+
}, null, 8, mi),
|
|
343
355
|
U("animate", {
|
|
344
356
|
attributeName: "opacity",
|
|
345
357
|
values: "0;1;1;0",
|
|
@@ -356,20 +368,20 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
356
368
|
fill: "none",
|
|
357
369
|
"stroke-opacity": "0",
|
|
358
370
|
"stroke-width": "16"
|
|
359
|
-
}, null, 8,
|
|
371
|
+
}, null, 8, hi),
|
|
360
372
|
n.value || (z = i.data) != null && z.label ? (b(), O(k(To), { key: 2 }, {
|
|
361
373
|
default: X(() => {
|
|
362
|
-
var T, M,
|
|
374
|
+
var T, M, B, ie;
|
|
363
375
|
return [
|
|
364
376
|
n.value ? (b(), _("div", {
|
|
365
377
|
key: 0,
|
|
366
378
|
class: "it-dag-edge__tools nodrag nopan",
|
|
367
|
-
style: rt(
|
|
379
|
+
style: rt(v.value),
|
|
368
380
|
onPointerenter: S[3] || (S[3] = (Q) => k(r).hoverEdge(i.id, "tools", !0)),
|
|
369
381
|
onPointerleave: S[4] || (S[4] = (Q) => k(r).hoverEdge(i.id, "tools", !1))
|
|
370
382
|
}, [
|
|
371
383
|
D(ne, {
|
|
372
|
-
icon: k(
|
|
384
|
+
icon: k(Yt),
|
|
373
385
|
label: `Add ${k(He)(k(r).noun())} between ${((T = i.data) == null ? void 0 : T.name) ?? `these ${k(r).noun().other}`}`,
|
|
374
386
|
tooltip: `Add ${k(He)(k(r).noun())} here`,
|
|
375
387
|
size: "sm",
|
|
@@ -384,7 +396,7 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
384
396
|
}, null, 8, ["icon", "label"]),
|
|
385
397
|
D(ne, {
|
|
386
398
|
icon: k(En),
|
|
387
|
-
label: `Delete connection ${((
|
|
399
|
+
label: `Delete connection ${((B = i.data) == null ? void 0 : B.name) ?? ""}`.trim(),
|
|
388
400
|
tooltip: "Delete connection",
|
|
389
401
|
size: "sm",
|
|
390
402
|
tone: "danger",
|
|
@@ -393,7 +405,7 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
393
405
|
], 36)) : (ie = i.data) != null && ie.label ? (b(), _("span", {
|
|
394
406
|
key: 1,
|
|
395
407
|
class: Ie(["it-dag-edge__label", `it-dag-edge__label--${i.data.tone ?? "default"}`]),
|
|
396
|
-
style: rt(
|
|
408
|
+
style: rt(h.value)
|
|
397
409
|
}, G(i.data.label), 7)) : C("", !0)
|
|
398
410
|
];
|
|
399
411
|
}),
|
|
@@ -402,32 +414,32 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
402
414
|
], 64);
|
|
403
415
|
};
|
|
404
416
|
}
|
|
405
|
-
}),
|
|
417
|
+
}), wi = {
|
|
406
418
|
class: "it-dag-controls",
|
|
407
419
|
role: "group",
|
|
408
420
|
"aria-label": "Canvas view"
|
|
409
|
-
},
|
|
421
|
+
}, ki = /* @__PURE__ */ Xe({
|
|
410
422
|
__name: "ItDagControls",
|
|
411
423
|
setup(i) {
|
|
412
|
-
const l = dt(
|
|
413
|
-
return (
|
|
424
|
+
const l = dt(ct), r = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent), n = r ? "⌘Z" : "Ctrl+Z", d = r ? "⇧⌘Z" : "Ctrl+Shift+Z";
|
|
425
|
+
return (h, g) => (b(), _("div", wi, [
|
|
414
426
|
D(ne, {
|
|
415
|
-
icon: k(
|
|
427
|
+
icon: k(Yt),
|
|
416
428
|
label: "Zoom in",
|
|
417
429
|
size: "sm",
|
|
418
|
-
onClick:
|
|
430
|
+
onClick: g[0] || (g[0] = (v) => k(l).zoomIn())
|
|
419
431
|
}, null, 8, ["icon"]),
|
|
420
432
|
D(ne, {
|
|
421
433
|
icon: k(wo),
|
|
422
434
|
label: "Zoom out",
|
|
423
435
|
size: "sm",
|
|
424
|
-
onClick:
|
|
436
|
+
onClick: g[1] || (g[1] = (v) => k(l).zoomOut())
|
|
425
437
|
}, null, 8, ["icon"]),
|
|
426
438
|
D(ne, {
|
|
427
439
|
icon: k(ko),
|
|
428
440
|
label: "Fit to view",
|
|
429
441
|
size: "sm",
|
|
430
|
-
onClick:
|
|
442
|
+
onClick: g[2] || (g[2] = (v) => k(l).fit())
|
|
431
443
|
}, null, 8, ["icon"]),
|
|
432
444
|
D(ne, {
|
|
433
445
|
"data-it-dag-expand": "",
|
|
@@ -435,10 +447,10 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
435
447
|
label: k(l).expanded() ? "Exit full view" : "Full view",
|
|
436
448
|
tooltip: k(l).expanded() ? "Exit full view (Esc)" : "Full view",
|
|
437
449
|
size: "sm",
|
|
438
|
-
onClick:
|
|
450
|
+
onClick: g[3] || (g[3] = (v) => k(l).toggleExpanded())
|
|
439
451
|
}, null, 8, ["icon", "label", "tooltip"]),
|
|
440
|
-
k(l).editable() ? (b(), _(
|
|
441
|
-
|
|
452
|
+
k(l).editable() ? (b(), _(K, { key: 0 }, [
|
|
453
|
+
g[7] || (g[7] = U("span", {
|
|
442
454
|
class: "it-dag-controls__separator",
|
|
443
455
|
"aria-hidden": "true"
|
|
444
456
|
}, null, -1)),
|
|
@@ -447,9 +459,9 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
447
459
|
label: "Tidy up",
|
|
448
460
|
tooltip: `Tidy up: arrange every ${k(l).noun().one}`,
|
|
449
461
|
size: "sm",
|
|
450
|
-
onClick:
|
|
462
|
+
onClick: g[4] || (g[4] = (v) => k(l).arrange())
|
|
451
463
|
}, null, 8, ["icon", "tooltip"]),
|
|
452
|
-
k(l).history() ? (b(), _(
|
|
464
|
+
k(l).history() ? (b(), _(K, { key: 0 }, [
|
|
453
465
|
D(ne, {
|
|
454
466
|
"data-it-dag-undo": "",
|
|
455
467
|
icon: k(_o),
|
|
@@ -457,7 +469,7 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
457
469
|
tooltip: `Undo (${k(n)})`,
|
|
458
470
|
size: "sm",
|
|
459
471
|
disabled: !k(l).canUndo(),
|
|
460
|
-
onClick:
|
|
472
|
+
onClick: g[5] || (g[5] = (v) => k(l).undo())
|
|
461
473
|
}, null, 8, ["icon", "tooltip", "disabled"]),
|
|
462
474
|
D(ne, {
|
|
463
475
|
"data-it-dag-redo": "",
|
|
@@ -466,28 +478,28 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
466
478
|
tooltip: `Redo (${k(d)})`,
|
|
467
479
|
size: "sm",
|
|
468
480
|
disabled: !k(l).canRedo(),
|
|
469
|
-
onClick:
|
|
481
|
+
onClick: g[6] || (g[6] = (v) => k(l).redo())
|
|
470
482
|
}, null, 8, ["icon", "tooltip", "disabled"])
|
|
471
483
|
], 64)) : C("", !0)
|
|
472
484
|
], 64)) : C("", !0)
|
|
473
485
|
]));
|
|
474
486
|
}
|
|
475
|
-
}),
|
|
487
|
+
}), $i = { class: "it-dag-library" }, xi = ["aria-label"], Ei = {
|
|
476
488
|
key: 0,
|
|
477
489
|
class: "it-dag-library__heading"
|
|
478
|
-
},
|
|
490
|
+
}, _i = {
|
|
479
491
|
class: "it-dag-library__grid",
|
|
480
492
|
role: "list"
|
|
481
|
-
},
|
|
493
|
+
}, Si = ["onClick"], Pi = { class: "it-dag-library__text" }, Ni = { class: "it-dag-library__label" }, Ci = {
|
|
482
494
|
key: 0,
|
|
483
495
|
class: "it-dag-library__description"
|
|
484
|
-
},
|
|
496
|
+
}, Mi = {
|
|
485
497
|
key: 1,
|
|
486
498
|
class: "it-dag-library__description"
|
|
487
|
-
},
|
|
499
|
+
}, Ti = {
|
|
488
500
|
key: 0,
|
|
489
501
|
class: "it-dag-library__empty"
|
|
490
|
-
},
|
|
502
|
+
}, Di = /* @__PURE__ */ Xe({
|
|
491
503
|
__name: "ItDagLibrary",
|
|
492
504
|
props: {
|
|
493
505
|
visible: { type: Boolean },
|
|
@@ -498,124 +510,124 @@ const ci = ["d"], fi = ["d"], gi = {
|
|
|
498
510
|
},
|
|
499
511
|
emits: ["update:visible", "pick"],
|
|
500
512
|
setup(i, { emit: l }) {
|
|
501
|
-
const r = i, n = l, d = V(""),
|
|
502
|
-
var
|
|
503
|
-
const c = d.value.trim().toLowerCase(),
|
|
504
|
-
for (const
|
|
505
|
-
if (c && !`${
|
|
506
|
-
if ((
|
|
507
|
-
|
|
513
|
+
const r = i, n = l, d = V(""), h = E(() => r.noun ?? Ht), g = E(() => `Not between these ${h.value.other} · added at the end, unconnected`), v = E(() => {
|
|
514
|
+
var y;
|
|
515
|
+
const c = d.value.trim().toLowerCase(), f = /* @__PURE__ */ new Map(), p = [];
|
|
516
|
+
for (const m of r.items) {
|
|
517
|
+
if (c && !`${m.label} ${m.description ?? ""} ${m.group ?? ""}`.toLowerCase().includes(c)) continue;
|
|
518
|
+
if ((y = r.misfits) != null && y[m.key]) {
|
|
519
|
+
p.push(m);
|
|
508
520
|
continue;
|
|
509
521
|
}
|
|
510
|
-
const R =
|
|
511
|
-
|
|
522
|
+
const R = m.group ?? "";
|
|
523
|
+
f.set(R, [...f.get(R) ?? [], m]);
|
|
512
524
|
}
|
|
513
|
-
return
|
|
525
|
+
return p.length && f.set(g.value, p), [...f].map(([m, R]) => ({ title: m, items: R, misfit: m === g.value && p.length > 0 }));
|
|
514
526
|
});
|
|
515
527
|
return te(
|
|
516
528
|
() => r.visible,
|
|
517
529
|
(c) => {
|
|
518
530
|
c && (d.value = "");
|
|
519
531
|
}
|
|
520
|
-
), (c,
|
|
532
|
+
), (c, f) => (b(), O(At, {
|
|
521
533
|
visible: i.visible,
|
|
522
|
-
title: `Add ${k(He)(
|
|
534
|
+
title: `Add ${k(He)(h.value)}`,
|
|
523
535
|
description: i.description,
|
|
524
536
|
size: "lg",
|
|
525
|
-
"onUpdate:visible":
|
|
537
|
+
"onUpdate:visible": f[1] || (f[1] = (p) => n("update:visible", p))
|
|
526
538
|
}, {
|
|
527
539
|
default: X(() => [
|
|
528
|
-
U("div",
|
|
540
|
+
U("div", $i, [
|
|
529
541
|
D(Lo, {
|
|
530
542
|
modelValue: d.value,
|
|
531
|
-
"onUpdate:modelValue":
|
|
532
|
-
label: `Search ${
|
|
533
|
-
placeholder: `Search ${
|
|
543
|
+
"onUpdate:modelValue": f[0] || (f[0] = (p) => d.value = p),
|
|
544
|
+
label: `Search ${h.value.other}`,
|
|
545
|
+
placeholder: `Search ${h.value.other}`
|
|
534
546
|
}, null, 8, ["modelValue", "label", "placeholder"]),
|
|
535
|
-
(b(!0), _(
|
|
536
|
-
key:
|
|
547
|
+
(b(!0), _(K, null, ge(v.value, (p) => (b(), _("section", {
|
|
548
|
+
key: p.title,
|
|
537
549
|
class: "it-dag-library__group",
|
|
538
|
-
"aria-label":
|
|
550
|
+
"aria-label": p.title || void 0
|
|
539
551
|
}, [
|
|
540
|
-
|
|
541
|
-
U("ul",
|
|
542
|
-
(b(!0), _(
|
|
543
|
-
key:
|
|
552
|
+
p.title ? (b(), _("h3", Ei, G(p.title), 1)) : C("", !0),
|
|
553
|
+
U("ul", _i, [
|
|
554
|
+
(b(!0), _(K, null, ge(p.items, (y) => (b(), _("li", {
|
|
555
|
+
key: y.key
|
|
544
556
|
}, [
|
|
545
557
|
U("button", {
|
|
546
558
|
type: "button",
|
|
547
|
-
class: Ie(["it-dag-library__item", { "it-dag-library__item--misfit":
|
|
548
|
-
onClick: (
|
|
559
|
+
class: Ie(["it-dag-library__item", { "it-dag-library__item--misfit": p.misfit }]),
|
|
560
|
+
onClick: (m) => n("pick", y)
|
|
549
561
|
}, [
|
|
550
|
-
|
|
562
|
+
y.platform ? (b(), O(Sn, {
|
|
551
563
|
key: 0,
|
|
552
564
|
class: "it-dag-library__icon",
|
|
553
|
-
platform:
|
|
565
|
+
platform: y.platform,
|
|
554
566
|
size: 20
|
|
555
|
-
}, null, 8, ["platform"])) :
|
|
567
|
+
}, null, 8, ["platform"])) : y.icon ? (b(), O(fe(y.icon), {
|
|
556
568
|
key: 1,
|
|
557
569
|
class: "it-dag-library__icon",
|
|
558
570
|
size: 16,
|
|
559
571
|
"aria-hidden": "true"
|
|
560
572
|
})) : C("", !0),
|
|
561
|
-
U("span",
|
|
562
|
-
ye((b(), _("span",
|
|
563
|
-
be(G(
|
|
573
|
+
U("span", Pi, [
|
|
574
|
+
ye((b(), _("span", Ni, [
|
|
575
|
+
be(G(y.label), 1)
|
|
564
576
|
])), [
|
|
565
577
|
[k(we)]
|
|
566
578
|
]),
|
|
567
|
-
|
|
568
|
-
|
|
579
|
+
p.misfit ? (b(), _("span", Ci, G(i.misfits[y.key]), 1)) : y.description ? (b(), _("span", Mi, G(y.description), 1)) : C("", !0),
|
|
580
|
+
y.status ? (b(), O(Pn, {
|
|
569
581
|
key: 2,
|
|
570
582
|
class: "it-dag-library__status",
|
|
571
|
-
status:
|
|
583
|
+
status: y.status
|
|
572
584
|
}, null, 8, ["status"])) : C("", !0)
|
|
573
585
|
])
|
|
574
|
-
], 10,
|
|
586
|
+
], 10, Si)
|
|
575
587
|
]))), 128))
|
|
576
588
|
])
|
|
577
|
-
], 8,
|
|
578
|
-
|
|
589
|
+
], 8, xi))), 128)),
|
|
590
|
+
v.value.length ? C("", !0) : (b(), _("p", Ti, "No " + G(h.value.other) + " match “" + G(d.value) + "”.", 1))
|
|
579
591
|
])
|
|
580
592
|
]),
|
|
581
593
|
_: 1
|
|
582
594
|
}, 8, ["visible", "title", "description"]));
|
|
583
595
|
}
|
|
584
|
-
}),
|
|
596
|
+
}), Ri = (i, l) => i === l || !!i && !!l && i.x === l.x && i.y === l.y;
|
|
585
597
|
function $n(i, l) {
|
|
586
598
|
const r = new Set(i.map((d) => d.id)), n = new Set(l.map((d) => d.id));
|
|
587
599
|
return {
|
|
588
|
-
added: l.flatMap((d,
|
|
589
|
-
removed: i.flatMap((d,
|
|
600
|
+
added: l.flatMap((d, h) => r.has(d.id) ? [] : [{ item: d, index: h }]),
|
|
601
|
+
removed: i.flatMap((d, h) => n.has(d.id) ? [] : [{ item: d, index: h }])
|
|
590
602
|
};
|
|
591
603
|
}
|
|
592
|
-
function
|
|
593
|
-
const r = $n(i.nodes, l.nodes), n = $n(i.edges, l.edges), d = new Map(i.nodes.map((c) => [c.id, c.position])),
|
|
594
|
-
addedNodes: r.added.map(({ item: c, index:
|
|
595
|
-
removedNodes: r.removed.map(({ item: c, index:
|
|
596
|
-
addedEdges: n.added.map(({ item: c, index:
|
|
597
|
-
removedEdges: n.removed.map(({ item: c, index:
|
|
598
|
-
moved:
|
|
604
|
+
function Ii(i, l) {
|
|
605
|
+
const r = $n(i.nodes, l.nodes), n = $n(i.edges, l.edges), d = new Map(i.nodes.map((c) => [c.id, c.position])), h = l.nodes.flatMap((c) => d.has(c.id) && !Ri(d.get(c.id), c.position) ? [{ id: c.id, from: d.get(c.id), to: c.position }] : []), g = {
|
|
606
|
+
addedNodes: r.added.map(({ item: c, index: f }) => ({ node: c, index: f })),
|
|
607
|
+
removedNodes: r.removed.map(({ item: c, index: f }) => ({ node: c, index: f })),
|
|
608
|
+
addedEdges: n.added.map(({ item: c, index: f }) => ({ edge: c, index: f })),
|
|
609
|
+
removedEdges: n.removed.map(({ item: c, index: f }) => ({ edge: c, index: f })),
|
|
610
|
+
moved: h
|
|
599
611
|
};
|
|
600
|
-
return !
|
|
612
|
+
return !g.addedNodes.length && !g.removedNodes.length && !g.addedEdges.length && !g.removedEdges.length && !h.length ? null : g;
|
|
601
613
|
}
|
|
602
614
|
function Nn(i, l) {
|
|
603
615
|
const r = [...i];
|
|
604
|
-
for (const { item: n, index: d } of [...l].sort((
|
|
605
|
-
r.some((
|
|
616
|
+
for (const { item: n, index: d } of [...l].sort((h, g) => h.index - g.index))
|
|
617
|
+
r.some((h) => h.id === n.id) || r.splice(Math.min(d, r.length), 0, n);
|
|
606
618
|
return r;
|
|
607
619
|
}
|
|
608
|
-
function
|
|
609
|
-
const n = new Set((r === "undo" ? i.addedNodes : i.removedNodes).map(({ node:
|
|
610
|
-
return Nn(
|
|
620
|
+
function zi(i, l, r) {
|
|
621
|
+
const n = new Set((r === "undo" ? i.addedNodes : i.removedNodes).map(({ node: v }) => v.id)), d = (r === "undo" ? i.removedNodes : i.addedNodes).map(({ node: v, index: c }) => ({ item: v, index: c })), h = new Map(i.moved.map((v) => [v.id, r === "undo" ? v.from : v.to])), g = l.filter((v) => !n.has(v.id)).map((v) => h.has(v.id) ? { ...v, position: h.get(v.id) } : v);
|
|
622
|
+
return Nn(g, d);
|
|
611
623
|
}
|
|
612
|
-
function
|
|
613
|
-
const d = new Set(r.map((
|
|
614
|
-
return Nn(c,
|
|
624
|
+
function Li(i, l, r, n) {
|
|
625
|
+
const d = new Set(r.map((f) => f.id)), h = new Set((n === "undo" ? i.addedNodes : i.removedNodes).map(({ node: f }) => f.id)), g = new Set((n === "undo" ? i.addedEdges : i.removedEdges).map(({ edge: f }) => f.id)), v = (n === "undo" ? i.removedEdges : i.addedEdges).filter(({ edge: f }) => d.has(f.source) && d.has(f.target)).map(({ edge: f, index: p }) => ({ item: f, index: p })), c = l.filter((f) => !g.has(f.id) && !h.has(f.source) && !h.has(f.target));
|
|
626
|
+
return Nn(c, v);
|
|
615
627
|
}
|
|
616
628
|
const oe = { node: 32, layer: 96, lead: 24 };
|
|
617
629
|
let lt = null;
|
|
618
|
-
async function
|
|
630
|
+
async function Oi() {
|
|
619
631
|
if (typeof Worker > "u" || typeof Blob > "u" || typeof URL.createObjectURL != "function") throw new Error("No Web Worker here.");
|
|
620
632
|
const [i, l] = await Promise.all([import("elkjs/lib/elk-api.js"), import("./elk-worker.min-O2A22ecl.js")]);
|
|
621
633
|
if (typeof l.default != "string") throw new Error("The ELK worker script did not load as text.");
|
|
@@ -623,8 +635,8 @@ async function Li() {
|
|
|
623
635
|
let n, d;
|
|
624
636
|
try {
|
|
625
637
|
n = new Worker(r);
|
|
626
|
-
const c = new Promise((
|
|
627
|
-
n.addEventListener("message", () =>
|
|
638
|
+
const c = new Promise((f, p) => {
|
|
639
|
+
n.addEventListener("message", () => f(), { once: !0 }), n.addEventListener("error", (y) => p(new Error(y.message || "The ELK worker did not start.")), { once: !0 });
|
|
628
640
|
});
|
|
629
641
|
d = new i.default({ workerFactory: () => n }), await c;
|
|
630
642
|
} catch (c) {
|
|
@@ -632,51 +644,51 @@ async function Li() {
|
|
|
632
644
|
} finally {
|
|
633
645
|
URL.revokeObjectURL(r);
|
|
634
646
|
}
|
|
635
|
-
let
|
|
647
|
+
let h = () => {
|
|
636
648
|
};
|
|
637
|
-
const
|
|
638
|
-
|
|
649
|
+
const g = new Promise((c, f) => h = f);
|
|
650
|
+
g.catch(() => {
|
|
639
651
|
}), n.addEventListener("error", (c) => {
|
|
640
|
-
n.terminate(), lt = null,
|
|
652
|
+
n.terminate(), lt = null, h(new Error(c.message || "The ELK worker stopped."));
|
|
641
653
|
});
|
|
642
|
-
const
|
|
643
|
-
return d.layout = (c,
|
|
654
|
+
const v = d.layout.bind(d);
|
|
655
|
+
return d.layout = (c, f) => Promise.race([v(c, f), g]), d;
|
|
644
656
|
}
|
|
645
|
-
async function
|
|
657
|
+
async function Fi() {
|
|
646
658
|
const i = await import("elkjs/lib/elk.bundled.js");
|
|
647
659
|
return new i.default();
|
|
648
660
|
}
|
|
649
661
|
function Cn() {
|
|
650
|
-
return lt ?? (lt =
|
|
662
|
+
return lt ?? (lt = Oi().catch(() => Fi()).catch((i) => {
|
|
651
663
|
throw lt = null, i;
|
|
652
664
|
})), lt;
|
|
653
665
|
}
|
|
654
|
-
function
|
|
666
|
+
function Bi() {
|
|
655
667
|
Cn().catch(() => {
|
|
656
668
|
});
|
|
657
669
|
}
|
|
658
|
-
const
|
|
670
|
+
const Ut = (i, l, r) => `${i}::${l}::${r}`;
|
|
659
671
|
function Mn(i) {
|
|
660
672
|
const l = i.portOffsets;
|
|
661
673
|
return !!l && l.inputs.length === i.inputs.length && l.outputs.length === i.outputs.length;
|
|
662
674
|
}
|
|
663
675
|
function Ai(i, l) {
|
|
664
|
-
var c,
|
|
665
|
-
const r = l === "down", n = r ? "NORTH" : "WEST", d = r ? "SOUTH" : "EAST",
|
|
676
|
+
var c, f;
|
|
677
|
+
const r = l === "down", n = r ? "NORTH" : "WEST", d = r ? "SOUTH" : "EAST", h = Mn(i), g = (p, y) => r ? { x: y, y: p === "in" ? 0 : i.height } : { x: p === "in" ? 0 : i.width, y }, v = (p, y, m, R, Y) => y.map((j, q) => {
|
|
666
678
|
const N = { "elk.port.side": R };
|
|
667
|
-
return
|
|
679
|
+
return h || (N["elk.port.index"] = String(Y ? y.length - 1 - q : q)), { id: Ut(i.id, p, j), width: 0, height: 0, ...h ? g(p, m[q]) : {}, layoutOptions: N };
|
|
668
680
|
});
|
|
669
681
|
return [
|
|
670
|
-
...
|
|
671
|
-
...
|
|
682
|
+
...v("in", i.inputs, (c = i.portOffsets) == null ? void 0 : c.inputs, n, n === "WEST"),
|
|
683
|
+
...v("out", i.outputs, (f = i.portOffsets) == null ? void 0 : f.outputs, d, d === "SOUTH")
|
|
672
684
|
];
|
|
673
685
|
}
|
|
674
686
|
async function Tn(i, l, r = "right") {
|
|
675
|
-
var
|
|
676
|
-
const n = new Map(i.map((
|
|
677
|
-
var
|
|
678
|
-
return ((
|
|
679
|
-
}).map((
|
|
687
|
+
var f;
|
|
688
|
+
const n = new Map(i.map((p) => [p.id, p])), d = l.filter((p) => {
|
|
689
|
+
var y, m;
|
|
690
|
+
return ((y = n.get(p.source)) == null ? void 0 : y.outputs.includes(p.sourcePort)) && ((m = n.get(p.target)) == null ? void 0 : m.inputs.includes(p.targetPort));
|
|
691
|
+
}).map((p) => ({ id: p.id, sources: [Ut(p.source, "out", p.sourcePort)], targets: [Ut(p.target, "in", p.targetPort)] })), h = {
|
|
680
692
|
id: "root",
|
|
681
693
|
layoutOptions: {
|
|
682
694
|
"elk.algorithm": "layered",
|
|
@@ -691,66 +703,66 @@ async function Tn(i, l, r = "right") {
|
|
|
691
703
|
"elk.layered.nodePlacement.strategy": "BRANDES_KOEPF",
|
|
692
704
|
"elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES"
|
|
693
705
|
},
|
|
694
|
-
children: i.map((
|
|
695
|
-
id:
|
|
696
|
-
width:
|
|
697
|
-
height:
|
|
698
|
-
layoutOptions: { "elk.portConstraints": Mn(
|
|
699
|
-
ports: Ai(
|
|
706
|
+
children: i.map((p) => ({
|
|
707
|
+
id: p.id,
|
|
708
|
+
width: p.width,
|
|
709
|
+
height: p.height,
|
|
710
|
+
layoutOptions: { "elk.portConstraints": Mn(p) ? "FIXED_POS" : "FIXED_ORDER" },
|
|
711
|
+
ports: Ai(p, r)
|
|
700
712
|
})),
|
|
701
713
|
edges: d
|
|
702
|
-
},
|
|
703
|
-
for (const
|
|
704
|
-
const
|
|
705
|
-
|
|
714
|
+
}, g = await (await Cn()).layout(h), v = new Map((g.children ?? []).map((p) => [p.id, { x: Math.round(p.x ?? 0), y: Math.round(p.y ?? 0) }])), c = /* @__PURE__ */ new Map();
|
|
715
|
+
for (const p of g.edges ?? []) {
|
|
716
|
+
const y = ((f = p.sections) == null ? void 0 : f.length) === 1 ? p.sections[0] : void 0;
|
|
717
|
+
y && c.set(p.id, { start: y.startPoint, bends: y.bendPoints ?? [], end: y.endPoint });
|
|
706
718
|
}
|
|
707
|
-
return { positions:
|
|
719
|
+
return { positions: v, routes: c };
|
|
708
720
|
}
|
|
709
|
-
function
|
|
721
|
+
function Ui(i, l, r = "right") {
|
|
710
722
|
var c;
|
|
711
|
-
const n = new Map(i.map((
|
|
712
|
-
for (let
|
|
713
|
-
let
|
|
714
|
-
for (const
|
|
715
|
-
const
|
|
716
|
-
n.has(
|
|
717
|
-
}
|
|
718
|
-
if (!
|
|
723
|
+
const n = new Map(i.map((f) => [f.id, 0]));
|
|
724
|
+
for (let f = 0; f < i.length; f++) {
|
|
725
|
+
let p = !1;
|
|
726
|
+
for (const y of l) {
|
|
727
|
+
const m = (n.get(y.source) ?? 0) + 1;
|
|
728
|
+
n.has(y.target) && m > n.get(y.target) && (n.set(y.target, m), p = !0);
|
|
729
|
+
}
|
|
730
|
+
if (!p) break;
|
|
719
731
|
}
|
|
720
732
|
const d = [];
|
|
721
|
-
for (const
|
|
722
|
-
const
|
|
723
|
-
let
|
|
724
|
-
for (const
|
|
725
|
-
if (!
|
|
726
|
-
let
|
|
727
|
-
for (const
|
|
728
|
-
|
|
729
|
-
|
|
733
|
+
for (const f of i) (d[c = n.get(f.id)] ?? (d[c] = [])).push(f);
|
|
734
|
+
const h = r === "down", g = /* @__PURE__ */ new Map();
|
|
735
|
+
let v = 0;
|
|
736
|
+
for (const f of d) {
|
|
737
|
+
if (!f) continue;
|
|
738
|
+
let p = 0, y = 0;
|
|
739
|
+
for (const m of f)
|
|
740
|
+
g.set(m.id, h ? { x: p, y: v } : { x: v, y: p }), p += (h ? m.width : m.height) + oe.node, y = Math.max(y, h ? m.height : m.width);
|
|
741
|
+
v += y + oe.layer;
|
|
730
742
|
}
|
|
731
|
-
return
|
|
743
|
+
return g;
|
|
732
744
|
}
|
|
733
|
-
async function
|
|
745
|
+
async function oa(i, l, r = "right") {
|
|
734
746
|
return (await Tn(i, l, r)).positions;
|
|
735
747
|
}
|
|
736
|
-
const
|
|
748
|
+
const Yi = ["role", "aria-modal", "aria-label", "tabindex"], Hi = {
|
|
737
749
|
key: 0,
|
|
738
750
|
class: "it-dag__fade it-dag__fade--start",
|
|
739
751
|
"aria-hidden": "true"
|
|
740
|
-
},
|
|
752
|
+
}, Xi = {
|
|
741
753
|
key: 1,
|
|
742
754
|
class: "it-dag__fade it-dag__fade--end",
|
|
743
755
|
"aria-hidden": "true"
|
|
744
|
-
},
|
|
756
|
+
}, Vi = {
|
|
745
757
|
key: 0,
|
|
746
758
|
class: "it-dag__empty"
|
|
747
|
-
},
|
|
759
|
+
}, Wi = {
|
|
748
760
|
key: 0,
|
|
749
761
|
class: "it-dag__editor"
|
|
750
|
-
},
|
|
762
|
+
}, ji = {
|
|
751
763
|
key: 0,
|
|
752
764
|
class: "it-dag__editor"
|
|
753
|
-
},
|
|
765
|
+
}, Zi = 4e3, xn = 1.5, qi = "\0it-dag-preview", ia = /* @__PURE__ */ Xe({
|
|
754
766
|
__name: "ItDagCanvas",
|
|
755
767
|
props: {
|
|
756
768
|
nodes: {},
|
|
@@ -767,7 +779,7 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
767
779
|
editorSize: { default: "md" },
|
|
768
780
|
emptyTitle: { default: void 0 },
|
|
769
781
|
emptyDescription: { default: "" },
|
|
770
|
-
noun: { default: () =>
|
|
782
|
+
noun: { default: () => Ht },
|
|
771
783
|
beforeRemove: { type: Function, default: void 0 },
|
|
772
784
|
editor: { default: "modal" },
|
|
773
785
|
history: { type: [Boolean, Object], default: !1 },
|
|
@@ -777,15 +789,15 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
777
789
|
},
|
|
778
790
|
emits: ["update:nodes", "update:edges", "update:selected", "create", "open"],
|
|
779
791
|
setup(i, { expose: l, emit: r }) {
|
|
780
|
-
const n = i, d = r,
|
|
792
|
+
const n = i, d = r, h = { width: 240, height: 56 }, g = { padding: 32, maxZoom: 1 }, v = E(() => n.fitMinZoom ?? n.minZoom ?? 0.75), c = E(() => Math.min(0.25, v.value));
|
|
781
793
|
te(() => n.minZoom, (e) => {
|
|
782
794
|
e !== void 0 && Oo("ItDagCanvas minZoom is deprecated. Use fitMinZoom for the Fit to view minimum.");
|
|
783
795
|
}, { immediate: !0 });
|
|
784
|
-
const
|
|
785
|
-
typeof window < "u" && (n.nodes.some((e) => !e.position) || n.edgeShape !== "bezier" && n.edges.length) &&
|
|
796
|
+
const f = { it: co(bi) }, p = ["Backspace", "Delete"], y = `it-dag-${fo()}`, m = _n(y), R = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
797
|
+
typeof window < "u" && (n.nodes.some((e) => !e.position) || n.edgeShape !== "bezier" && n.edges.length) && Bi();
|
|
786
798
|
const Y = V({}), j = V({});
|
|
787
|
-
function
|
|
788
|
-
return [[e.kind, e.label].filter(Boolean).join(": "), e.platform ? Io(e.platform).name : "", e.status ?
|
|
799
|
+
function q(e) {
|
|
800
|
+
return [[e.kind, e.label].filter(Boolean).join(": "), e.platform ? Io(e.platform).name : "", e.status ? Bt(e.status).label : ""].filter(Boolean).join(", ");
|
|
789
801
|
}
|
|
790
802
|
const N = { active: "running", success: "taken", danger: "failed", muted: "not taken" }, S = E(
|
|
791
803
|
() => n.nodes.map((e) => ({
|
|
@@ -797,22 +809,22 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
797
809
|
connectable: n.editable,
|
|
798
810
|
deletable: n.editable && e.removable !== !1,
|
|
799
811
|
selectable: !0,
|
|
800
|
-
ariaLabel:
|
|
812
|
+
ariaLabel: q(e)
|
|
801
813
|
}))
|
|
802
814
|
);
|
|
803
815
|
function z() {
|
|
804
|
-
for (const e of
|
|
816
|
+
for (const e of m.getNodes.value) {
|
|
805
817
|
const t = e.id === n.selected;
|
|
806
818
|
e.selected !== t && (e.selected = t);
|
|
807
819
|
}
|
|
808
820
|
}
|
|
809
821
|
te([() => n.selected, S], z, { flush: "post" }), go(z);
|
|
810
|
-
const T = E(() => new Map(n.nodes.map((e) => [e.id, e]))), M = E(() => new Set(n.edges.map((e) => e.id))),
|
|
822
|
+
const T = E(() => new Map(n.nodes.map((e) => [e.id, e]))), M = E(() => new Set(n.edges.map((e) => e.id))), B = (e) => {
|
|
811
823
|
var t;
|
|
812
824
|
return ((t = T.value.get(e)) == null ? void 0 : t.label) ?? e;
|
|
813
825
|
}, ie = E(
|
|
814
826
|
() => n.edges.map((e) => {
|
|
815
|
-
const t = ke(e, T.value), o = `${
|
|
827
|
+
const t = ke(e, T.value), o = `${B(e.source)} to ${B(e.target)}`;
|
|
816
828
|
return {
|
|
817
829
|
ariaLabel: [o, e.label, e.tone && N[e.tone]].filter(Boolean).join(", "),
|
|
818
830
|
id: e.id,
|
|
@@ -840,47 +852,47 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
840
852
|
}
|
|
841
853
|
);
|
|
842
854
|
let Ee = !1;
|
|
843
|
-
const Ve = E(() =>
|
|
855
|
+
const Ve = E(() => m.getNodes.value.length ? hn(m.getNodes.value) : null), Dn = E(() => {
|
|
844
856
|
const e = Ve.value;
|
|
845
|
-
if (!e || !
|
|
846
|
-
const { x: t, zoom: o } =
|
|
857
|
+
if (!e || !m.dimensions.value.width) return !1;
|
|
858
|
+
const { x: t, zoom: o } = m.viewport.value;
|
|
847
859
|
return t + e.x * o < -1;
|
|
848
860
|
}), Rn = E(() => {
|
|
849
|
-
const e = Ve.value, t =
|
|
861
|
+
const e = Ve.value, t = m.dimensions.value.width;
|
|
850
862
|
if (!e || !t) return !1;
|
|
851
|
-
const { x: o, zoom: s } =
|
|
863
|
+
const { x: o, zoom: s } = m.viewport.value;
|
|
852
864
|
return o + (e.x + e.width) * s > t + 1;
|
|
853
865
|
});
|
|
854
866
|
function In(e) {
|
|
855
867
|
var o;
|
|
856
868
|
const t = (o = e.closest(".it-dag")) == null ? void 0 : o.querySelector(".it-dag-controls");
|
|
857
|
-
return t ? Math.max(
|
|
869
|
+
return t ? Math.max(g.padding, t.getBoundingClientRect().right - e.getBoundingClientRect().left + g.padding / 2) : g.padding;
|
|
858
870
|
}
|
|
859
871
|
async function _e() {
|
|
860
|
-
const e =
|
|
872
|
+
const e = m.vueFlowRef.value, t = m.getNodes.value;
|
|
861
873
|
if (!e || !t.length) return;
|
|
862
|
-
const o =
|
|
863
|
-
await
|
|
864
|
-
{ x: $(o.width, a.width, o.x, s), y: $(o.height, a.height, o.y,
|
|
874
|
+
const o = hn(t), s = In(e), a = { width: e.clientWidth - s - g.padding, height: e.clientHeight - 2 * g.padding }, u = Math.min(g.maxZoom, Math.max(v.value, Math.min(a.width / o.width, a.height / o.height))), $ = (w, P, I, L) => (w * u <= P ? L + (P - w * u) / 2 : L) - I * u;
|
|
875
|
+
await m.setViewport(
|
|
876
|
+
{ x: $(o.width, a.width, o.x, s), y: $(o.height, a.height, o.y, g.padding), zoom: u },
|
|
865
877
|
{ duration: Ee && !R && !ae.value ? 200 : 0 }
|
|
866
|
-
), Ee = !0,
|
|
878
|
+
), Ee = !0, gt();
|
|
867
879
|
}
|
|
868
|
-
function
|
|
880
|
+
function ft(e, t) {
|
|
869
881
|
var s;
|
|
870
|
-
const o = (s =
|
|
882
|
+
const o = (s = m.findNode(e)) == null ? void 0 : s.handleBounds;
|
|
871
883
|
return [...(o == null ? void 0 : o.source) ?? [], ...(o == null ? void 0 : o.target) ?? []].find((a) => a.id === t) ?? null;
|
|
872
884
|
}
|
|
873
|
-
function
|
|
885
|
+
function Xt(e) {
|
|
874
886
|
return e.position === Z.Left ? { x: e.x, y: e.y + e.height / 2 } : e.position === Z.Right ? { x: e.x + e.width, y: e.y + e.height / 2 } : e.position === Z.Top ? { x: e.x + e.width / 2, y: e.y } : { x: e.x + e.width / 2, y: e.y + e.height };
|
|
875
887
|
}
|
|
876
888
|
function zn(e, t, o) {
|
|
877
|
-
const s = n.direction === "down", a = s ? [Z.Top, Z.Bottom] : [Z.Left, Z.Right], u = (I, L) => L.map((W) =>
|
|
889
|
+
const s = n.direction === "down", a = s ? [Z.Top, Z.Bottom] : [Z.Left, Z.Right], u = (I, L) => L.map((W) => ft(e.id, `${I}:${W}`)), $ = u("in", t), w = u("out", o);
|
|
878
890
|
if (![...$, ...w].every((I) => I && a.includes(I.position))) return;
|
|
879
891
|
const P = (I) => s ? I.x + I.width / 2 : I.y + I.height / 2;
|
|
880
892
|
return { inputs: $.map(P), outputs: w.map(P) };
|
|
881
893
|
}
|
|
882
894
|
let We = 0;
|
|
883
|
-
const
|
|
895
|
+
const Vt = /* @__PURE__ */ new Set();
|
|
884
896
|
async function ze(e = "all", t = !1) {
|
|
885
897
|
if (!n.nodes.length) return;
|
|
886
898
|
const o = ++We;
|
|
@@ -889,7 +901,7 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
889
901
|
await Ln(e, o, t);
|
|
890
902
|
} catch {
|
|
891
903
|
if (o === We && e !== "routes") {
|
|
892
|
-
const s =
|
|
904
|
+
const s = Ui(...Wt()), a = { ...Y.value };
|
|
893
905
|
for (const u of n.nodes) !u.position && !a[u.id] && s.has(u.id) && (a[u.id] = s.get(u.id));
|
|
894
906
|
Y.value = a, await ee(), await _e();
|
|
895
907
|
}
|
|
@@ -897,14 +909,14 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
897
909
|
o === We && e !== "routes" && ae.value && await je();
|
|
898
910
|
}
|
|
899
911
|
}
|
|
900
|
-
function
|
|
912
|
+
function Wt() {
|
|
901
913
|
const e = n.nodes.map((o) => {
|
|
902
914
|
var $;
|
|
903
|
-
const s = ($ =
|
|
915
|
+
const s = ($ = m.findNode(o.id)) == null ? void 0 : $.dimensions, a = $e(o).map((w) => w.id), u = xe(o).map((w) => w.id);
|
|
904
916
|
return {
|
|
905
917
|
id: o.id,
|
|
906
|
-
width: (s == null ? void 0 : s.width) ||
|
|
907
|
-
height: (s == null ? void 0 : s.height) ||
|
|
918
|
+
width: (s == null ? void 0 : s.width) || h.width,
|
|
919
|
+
height: (s == null ? void 0 : s.height) || h.height,
|
|
908
920
|
inputs: a,
|
|
909
921
|
outputs: u,
|
|
910
922
|
portOffsets: zn(o, a, u)
|
|
@@ -916,111 +928,111 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
916
928
|
return [e, t, n.direction];
|
|
917
929
|
}
|
|
918
930
|
async function Ln(e, t, o) {
|
|
919
|
-
const [s, a, u] =
|
|
931
|
+
const [s, a, u] = Wt(), { positions: $, routes: w } = await Tn(s, a, u);
|
|
920
932
|
if (t !== We) return;
|
|
921
933
|
const P = (x) => (e === "all" || !x.position) && $.has(x.id), I = (x) => {
|
|
922
|
-
const
|
|
923
|
-
if (
|
|
924
|
-
return P(
|
|
934
|
+
const A = T.value.get(x);
|
|
935
|
+
if (A)
|
|
936
|
+
return P(A) ? $.get(x) : A.position ?? Y.value[x];
|
|
925
937
|
}, L = (x) => {
|
|
926
|
-
const
|
|
927
|
-
return !!
|
|
938
|
+
const A = $.get(x), J = I(x);
|
|
939
|
+
return !!A && !!J && Math.abs(A.x - J.x) <= xn && Math.abs(A.y - J.y) <= xn;
|
|
928
940
|
}, W = {};
|
|
929
941
|
for (const x of a) {
|
|
930
|
-
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
const
|
|
934
|
-
W[x.id] = { from: { x:
|
|
942
|
+
Vt.add(x.id);
|
|
943
|
+
const A = w.get(x.id), J = ft(x.source, `out:${x.sourcePort}`), gn = ft(x.target, `in:${x.targetPort}`), zt = $.get(x.source), Lt = $.get(x.target);
|
|
944
|
+
if (A && J && gn && zt && Lt && L(x.source) && L(x.target)) {
|
|
945
|
+
const vn = Xt(J), mn = Xt(gn);
|
|
946
|
+
W[x.id] = { from: { x: zt.x + vn.x, y: zt.y + vn.y }, to: { x: Lt.x + mn.x, y: Lt.y + mn.y }, bends: A.bends };
|
|
935
947
|
} else j.value[x.id] && (W[x.id] = j.value[x.id]);
|
|
936
948
|
}
|
|
937
949
|
if (j.value = W, e === "routes") return;
|
|
938
950
|
const H = { ...Y.value };
|
|
939
951
|
for (const x of n.nodes) P(x) && (H[x.id] = $.get(x.id));
|
|
940
952
|
if (Y.value = H, n.editable) {
|
|
941
|
-
const x = { nodes: n.nodes, edges: n.edges },
|
|
942
|
-
d("update:nodes",
|
|
953
|
+
const x = { nodes: n.nodes, edges: n.edges }, A = n.nodes.map((J) => P(J) ? { ...J, position: $.get(J.id) } : J);
|
|
954
|
+
d("update:nodes", A), o && Ce(x, { nodes: A, edges: n.edges });
|
|
943
955
|
}
|
|
944
956
|
await ee(), await _e(), await je();
|
|
945
957
|
}
|
|
946
958
|
async function je() {
|
|
947
959
|
await new Promise((t) => requestAnimationFrame(t)), ae.value = !1;
|
|
948
|
-
const e =
|
|
949
|
-
|
|
960
|
+
const e = It;
|
|
961
|
+
It = null, e && fn(e);
|
|
950
962
|
}
|
|
951
963
|
function On() {
|
|
952
964
|
if (Q.value) return void ze("unplaced");
|
|
953
|
-
Ee ? ae.value && je() : _e().then(je), n.edgeShape !== "bezier" && n.edges.some((e) => !
|
|
965
|
+
Ee ? ae.value && je() : _e().then(je), n.edgeShape !== "bezier" && n.edges.some((e) => !Vt.has(e.id)) && ze("routes");
|
|
954
966
|
}
|
|
955
967
|
te(
|
|
956
968
|
() => n.direction,
|
|
957
969
|
async () => {
|
|
958
|
-
await ee(),
|
|
970
|
+
await ee(), m.updateNodeInternals(n.nodes.map((e) => e.id)), await ee(), await ze("all");
|
|
959
971
|
}
|
|
960
972
|
), vo(() => {
|
|
961
|
-
const e =
|
|
973
|
+
const e = m.vueFlowRef.value;
|
|
962
974
|
if (!e) return;
|
|
963
|
-
const { x: t, y: o, zoom: s } =
|
|
975
|
+
const { x: t, y: o, zoom: s } = m.viewport.value;
|
|
964
976
|
e.style.backgroundSize = `${16 * s}px ${16 * s}px`, e.style.backgroundPosition = `${t}px ${o}px`;
|
|
965
977
|
});
|
|
966
|
-
const
|
|
978
|
+
const jt = Ot(null);
|
|
967
979
|
let Ze;
|
|
968
|
-
function
|
|
980
|
+
function gt() {
|
|
969
981
|
clearTimeout(Ze);
|
|
970
|
-
const { x: e, y: t, zoom: o } =
|
|
971
|
-
!s || !a || !o || (
|
|
982
|
+
const { x: e, y: t, zoom: o } = m.viewport.value, { width: s, height: a } = m.dimensions.value;
|
|
983
|
+
!s || !a || !o || (jt.value = { x: -e / o, y: -t / o, width: s / o, height: a / o });
|
|
972
984
|
}
|
|
973
|
-
|
|
974
|
-
() => [
|
|
985
|
+
m.onMoveEnd(gt), te(
|
|
986
|
+
() => [m.viewport.value.x, m.viewport.value.y, m.viewport.value.zoom, m.dimensions.value.width, m.dimensions.value.height],
|
|
975
987
|
() => {
|
|
976
|
-
clearTimeout(Ze), Ze = setTimeout(
|
|
988
|
+
clearTimeout(Ze), Ze = setTimeout(gt, 120);
|
|
977
989
|
}
|
|
978
990
|
), ot(() => clearTimeout(Ze));
|
|
979
|
-
const
|
|
980
|
-
let
|
|
991
|
+
const vt = V(!1), qe = V("");
|
|
992
|
+
let mt, pt = !1, Se = null;
|
|
981
993
|
function re(e) {
|
|
982
|
-
|
|
994
|
+
qe.value = e, clearTimeout(mt), mt = setTimeout(() => qe.value = "", Zi);
|
|
983
995
|
}
|
|
984
|
-
ot(() => clearTimeout(
|
|
985
|
-
function
|
|
996
|
+
ot(() => clearTimeout(mt));
|
|
997
|
+
function Zt(e) {
|
|
986
998
|
const { sourceHandle: t, targetHandle: o } = e;
|
|
987
999
|
return !(t != null && t.startsWith("out:")) || !(o != null && o.startsWith("in:")) ? null : { source: e.source, sourcePort: t.slice(4), target: e.target, targetPort: o.slice(3) };
|
|
988
1000
|
}
|
|
989
|
-
function
|
|
1001
|
+
function qt(e) {
|
|
990
1002
|
var o;
|
|
991
|
-
const t =
|
|
992
|
-
return t ?
|
|
1003
|
+
const t = Zt(e);
|
|
1004
|
+
return t ? bn(n.nodes, n.edges, t, { allowCycles: n.allowCycles, noun: n.noun }) ?? ((o = n.connectionRule) == null ? void 0 : o.call(n, t)) ?? null : "Connect an output to an input.";
|
|
993
1005
|
}
|
|
994
1006
|
function Fn(e) {
|
|
995
1007
|
const t = e.id;
|
|
996
|
-
return t && M.value.has(t) ? !0 : (Se =
|
|
1008
|
+
return t && M.value.has(t) ? !0 : (Se = qt(e), !Se);
|
|
997
1009
|
}
|
|
998
|
-
function
|
|
999
|
-
|
|
1010
|
+
function Bn() {
|
|
1011
|
+
vt.value = !0, pt = !1, Se = null;
|
|
1000
1012
|
}
|
|
1001
|
-
function
|
|
1002
|
-
const t =
|
|
1003
|
-
if (!t ||
|
|
1013
|
+
function An(e) {
|
|
1014
|
+
const t = Zt(e);
|
|
1015
|
+
if (!t || qt(e)) return;
|
|
1004
1016
|
pt = !0;
|
|
1005
1017
|
const o = [...n.edges, { id: at(t), ...t }];
|
|
1006
1018
|
d("update:edges", o), Ce({ nodes: n.nodes, edges: n.edges }, { nodes: n.nodes, edges: o });
|
|
1007
1019
|
}
|
|
1008
1020
|
function Un() {
|
|
1009
|
-
|
|
1021
|
+
vt.value = !1, !pt && Se && m.connectionStatus.value === "invalid" && re(Se), Se = null;
|
|
1010
1022
|
}
|
|
1011
|
-
let
|
|
1023
|
+
let Ke = /* @__PURE__ */ new Set(), Ge = /* @__PURE__ */ new Set(), ht = !1;
|
|
1012
1024
|
function Kt() {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
const e =
|
|
1016
|
-
|
|
1025
|
+
ht || (ht = !0, queueMicrotask(() => {
|
|
1026
|
+
ht = !1;
|
|
1027
|
+
const e = Ke, t = Ge;
|
|
1028
|
+
Ke = /* @__PURE__ */ new Set(), Ge = /* @__PURE__ */ new Set(), yt(e, t);
|
|
1017
1029
|
}));
|
|
1018
1030
|
}
|
|
1019
|
-
function
|
|
1031
|
+
function yt(e, t) {
|
|
1020
1032
|
const o = { nodes: n.nodes, edges: n.edges }, s = e.size ? n.nodes.filter((u) => !e.has(u.id)) : n.nodes, a = n.edges.filter((u) => !t.has(u.id) && !e.has(u.source) && !e.has(u.target));
|
|
1021
1033
|
e.size && d("update:nodes", s), d("update:edges", a), n.selected && e.has(n.selected) && d("update:selected", null), Ce(o, { nodes: s, edges: a });
|
|
1022
1034
|
}
|
|
1023
|
-
async function
|
|
1035
|
+
async function bt(e) {
|
|
1024
1036
|
if (!n.beforeRemove) return !0;
|
|
1025
1037
|
try {
|
|
1026
1038
|
return await n.beforeRemove(e) !== !1;
|
|
@@ -1029,20 +1041,20 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1029
1041
|
}
|
|
1030
1042
|
}
|
|
1031
1043
|
async function Yn() {
|
|
1032
|
-
const e = new Set(
|
|
1033
|
-
!o.length && !s.length || await
|
|
1044
|
+
const e = new Set(m.getSelectedNodes.value.filter((a) => a.deletable !== !1).map((a) => a.id)), t = new Set(m.getSelectedEdges.value.filter((a) => a.deletable !== !1).map((a) => a.id)), o = n.nodes.filter((a) => e.has(a.id)), s = n.edges.filter((a) => t.has(a.id) || e.has(a.source) || e.has(a.target));
|
|
1045
|
+
!o.length && !s.length || await bt({ nodes: o, edges: s }) && yt(e, t);
|
|
1034
1046
|
}
|
|
1035
1047
|
function Hn(e) {
|
|
1036
1048
|
var s, a;
|
|
1037
1049
|
const t = /* @__PURE__ */ new Map();
|
|
1038
1050
|
let o;
|
|
1039
1051
|
for (const u of e)
|
|
1040
|
-
if (u.type === "remove" && n.editable)
|
|
1052
|
+
if (u.type === "remove" && n.editable) Ke.add(u.id);
|
|
1041
1053
|
else if (u.type === "position" && !u.dragging && n.editable) {
|
|
1042
|
-
const $ = u.position ?? ((s =
|
|
1054
|
+
const $ = u.position ?? ((s = m.findNode(u.id)) == null ? void 0 : s.position);
|
|
1043
1055
|
$ && t.set(u.id, { x: Math.round($.x), y: Math.round($.y) });
|
|
1044
1056
|
} else u.type === "select" && (u.selected ? o = u.id : u.id === n.selected && o === void 0 && (o = null));
|
|
1045
|
-
|
|
1057
|
+
Ke.size && Kt();
|
|
1046
1058
|
for (const [u, $] of t) {
|
|
1047
1059
|
const w = (a = T.value.get(u)) == null ? void 0 : a.position;
|
|
1048
1060
|
w && w.x === $.x && w.y === $.y && t.delete(u);
|
|
@@ -1060,32 +1072,32 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1060
1072
|
}
|
|
1061
1073
|
}
|
|
1062
1074
|
const Le = V(!1);
|
|
1063
|
-
let
|
|
1075
|
+
let Gt = null;
|
|
1064
1076
|
const Oe = E(() => {
|
|
1065
1077
|
var e;
|
|
1066
1078
|
return n.editable && !!((e = n.library) != null && e.length);
|
|
1067
1079
|
}), Pe = V(null);
|
|
1068
|
-
let
|
|
1069
|
-
function
|
|
1070
|
-
|
|
1080
|
+
let wt = null;
|
|
1081
|
+
function kt(e = null) {
|
|
1082
|
+
Gt = e, Le.value = !0;
|
|
1071
1083
|
}
|
|
1072
|
-
const
|
|
1084
|
+
const Qt = E(() => {
|
|
1073
1085
|
const e = Pe.value;
|
|
1074
1086
|
if (!e || !n.library) return {};
|
|
1075
1087
|
const t = {};
|
|
1076
1088
|
for (const o of n.library) {
|
|
1077
1089
|
if (!o.inputs && !o.outputs) continue;
|
|
1078
|
-
const s =
|
|
1090
|
+
const s = ln(e, { id: qi, label: o.label, inputs: o.inputs, outputs: o.outputs });
|
|
1079
1091
|
(!s.into || !s.out) && (t[o.key] = s.reason ?? "It does not fit here.");
|
|
1080
1092
|
}
|
|
1081
1093
|
return t;
|
|
1082
1094
|
}), Vn = E(() => {
|
|
1083
1095
|
const e = Pe.value;
|
|
1084
|
-
return e ? `Between ${
|
|
1096
|
+
return e ? `Between ${B(e.source)} and ${B(e.target)}.` : void 0;
|
|
1085
1097
|
});
|
|
1086
1098
|
function Wn(e) {
|
|
1087
|
-
const t = Pe.value, o = t ?
|
|
1088
|
-
Le.value = !1, Pe.value = null,
|
|
1099
|
+
const t = Pe.value, o = t ? Qt.value[e.key] : void 0;
|
|
1100
|
+
Le.value = !1, Pe.value = null, wt = { known: new Set(n.nodes.map((s) => s.id)), edge: t && !o ? t : void 0 }, t && !o ? tn(e, Zn(t)) : (t && o && re(`${e.label} is at the end of the chain, not connected: ${o}`), tn(e, Gt ?? void 0));
|
|
1089
1101
|
}
|
|
1090
1102
|
te(Le, (e) => {
|
|
1091
1103
|
e || queueMicrotask(() => Pe.value = null);
|
|
@@ -1093,65 +1105,65 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1093
1105
|
function jn(e) {
|
|
1094
1106
|
const t = e.target instanceof Element ? e.target : null;
|
|
1095
1107
|
if (!Oe.value || !(t != null && t.closest(".vue-flow__pane")) || t.closest(".vue-flow__node, .vue-flow__edge, .vue-flow__panel")) return;
|
|
1096
|
-
const o =
|
|
1097
|
-
|
|
1108
|
+
const o = Jt(e.clientX, e.clientY);
|
|
1109
|
+
kt({ x: o.x - h.width / 2, y: o.y - h.height / 2 });
|
|
1098
1110
|
}
|
|
1099
|
-
function
|
|
1111
|
+
function Jt(e, t) {
|
|
1100
1112
|
var a;
|
|
1101
|
-
const o = (a =
|
|
1113
|
+
const o = (a = m.vueFlowRef.value) == null ? void 0 : a.getBoundingClientRect(), s = m.project({ x: e - ((o == null ? void 0 : o.left) ?? 0), y: t - ((o == null ? void 0 : o.top) ?? 0) });
|
|
1102
1114
|
return { x: Math.round(s.x), y: Math.round(s.y) };
|
|
1103
1115
|
}
|
|
1104
|
-
const
|
|
1105
|
-
function
|
|
1106
|
-
n.editable && d("create", { item: e, position:
|
|
1116
|
+
const en = (e) => ({ x: Math.round(e.x / 8) * 8, y: Math.round(e.y / 8) * 8 }), Fe = E(() => n.direction !== "down"), ve = (e) => ({ width: e.dimensions.width || h.width, height: e.dimensions.height || h.height });
|
|
1117
|
+
function tn(e, t) {
|
|
1118
|
+
n.editable && d("create", { item: e, position: en(t ?? $t()) });
|
|
1107
1119
|
}
|
|
1108
|
-
function
|
|
1120
|
+
function $t() {
|
|
1109
1121
|
var a;
|
|
1110
|
-
const e =
|
|
1122
|
+
const e = m.getNodes.value;
|
|
1111
1123
|
if (!e.length) {
|
|
1112
|
-
const u = (a =
|
|
1113
|
-
return { x: $.x -
|
|
1124
|
+
const u = (a = m.vueFlowRef.value) == null ? void 0 : a.getBoundingClientRect(), $ = u ? Jt(u.left + u.width / 2, u.top + u.height / 2) : { x: 0, y: 0 };
|
|
1125
|
+
return { x: $.x - h.width / 2, y: $.y - h.height / 2 };
|
|
1114
1126
|
}
|
|
1115
1127
|
const t = (u) => Fe.value ? u.position.x + ve(u).width : u.position.y + ve(u).height, o = e.reduce((u, $) => t($) > t(u) ? $ : u), s = Fe.value ? { x: t(o) + oe.layer, y: o.position.y } : { x: o.position.x, y: t(o) + oe.layer };
|
|
1116
1128
|
return Gn(s);
|
|
1117
1129
|
}
|
|
1118
1130
|
function Zn(e) {
|
|
1119
|
-
const t =
|
|
1120
|
-
return !t || !o ?
|
|
1131
|
+
const t = m.findNode(e.source), o = m.findNode(e.target);
|
|
1132
|
+
return !t || !o ? $t() : Fe.value ? { x: t.position.x + ve(t).width + oe.layer, y: o.position.y } : { x: o.position.x, y: t.position.y + ve(t).height + oe.layer };
|
|
1121
1133
|
}
|
|
1122
|
-
async function
|
|
1134
|
+
async function qn(e) {
|
|
1123
1135
|
for (let t = 0; t < 12; t += 1) {
|
|
1124
|
-
const o =
|
|
1136
|
+
const o = m.findNode(e);
|
|
1125
1137
|
if (o != null && o.dimensions.width) return o;
|
|
1126
1138
|
await (typeof requestAnimationFrame == "function" ? new Promise((s) => requestAnimationFrame(s)) : ee());
|
|
1127
1139
|
}
|
|
1128
|
-
return
|
|
1140
|
+
return m.findNode(e);
|
|
1129
1141
|
}
|
|
1130
|
-
function
|
|
1131
|
-
const o =
|
|
1142
|
+
function Kn(e, t) {
|
|
1143
|
+
const o = m.findNode(t.target);
|
|
1132
1144
|
if (!o) return n.nodes;
|
|
1133
1145
|
const s = Fe.value ? "x" : "y", a = e.position[s], u = a + (Fe.value ? ve(e).width : ve(e).height) + oe.layer, $ = Math.ceil(Math.max(0, u - o.position[s]) / 8) * 8;
|
|
1134
1146
|
if (!$) return n.nodes;
|
|
1135
|
-
const w = Math.min(a, o.position[s]) - 1, P = new Set(
|
|
1147
|
+
const w = Math.min(a, o.position[s]) - 1, P = new Set(m.getNodes.value.filter((L) => L.id !== e.id && L.position[s] >= w).map((L) => L.id)), I = n.nodes.map((L) => {
|
|
1136
1148
|
var H;
|
|
1137
|
-
const W = (H =
|
|
1149
|
+
const W = (H = m.findNode(L.id)) == null ? void 0 : H.position;
|
|
1138
1150
|
return P.has(L.id) && W ? { ...L, position: { ...W, [s]: W[s] + $ } } : L;
|
|
1139
1151
|
});
|
|
1140
1152
|
return d("update:nodes", I), I;
|
|
1141
1153
|
}
|
|
1142
|
-
function
|
|
1143
|
-
const t =
|
|
1154
|
+
function nn(e) {
|
|
1155
|
+
const t = m.vueFlowRef.value;
|
|
1144
1156
|
if (!t) return;
|
|
1145
|
-
const { x: o, y: s, zoom: a } =
|
|
1146
|
-
w >= 0 && P >= 0 && w + u * a <= t.clientWidth && P + $ * a <= t.clientHeight ||
|
|
1157
|
+
const { x: o, y: s, zoom: a } = m.viewport.value, { width: u, height: $ } = ve(e), w = e.position.x * a + o, P = e.position.y * a + s;
|
|
1158
|
+
w >= 0 && P >= 0 && w + u * a <= t.clientWidth && P + $ * a <= t.clientHeight || m.setCenter(e.position.x + u / 2, e.position.y + $ / 2, { zoom: a, duration: R ? 0 : 200 });
|
|
1147
1159
|
}
|
|
1148
1160
|
function Gn(e) {
|
|
1149
|
-
const o =
|
|
1161
|
+
const o = m.getNodes.value.map((a) => ({
|
|
1150
1162
|
x: a.position.x - 16,
|
|
1151
1163
|
y: a.position.y - 16,
|
|
1152
|
-
width: (a.dimensions.width ||
|
|
1153
|
-
height: (a.dimensions.height ||
|
|
1154
|
-
})), s = (a) => o.some((u) => a.x < u.x + u.width && a.x +
|
|
1164
|
+
width: (a.dimensions.width || h.width) + 32,
|
|
1165
|
+
height: (a.dimensions.height || h.height) + 32
|
|
1166
|
+
})), s = (a) => o.some((u) => a.x < u.x + u.width && a.x + h.width > u.x && a.y < u.y + u.height && a.y + h.height > u.y);
|
|
1155
1167
|
for (let a = 0; a < 40; a += 1) {
|
|
1156
1168
|
const u = { x: e.x, y: e.y + a * 32 };
|
|
1157
1169
|
if (!s(u)) return u;
|
|
@@ -1160,20 +1172,20 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1160
1172
|
}
|
|
1161
1173
|
const Qe = V(null);
|
|
1162
1174
|
let Je;
|
|
1163
|
-
const
|
|
1164
|
-
function
|
|
1165
|
-
o ?
|
|
1166
|
-
const s =
|
|
1175
|
+
const me = { line: null, tools: null };
|
|
1176
|
+
function xt(e, t, o) {
|
|
1177
|
+
o ? me[t] = e : me[t] === e && (me[t] = null), clearTimeout(Je);
|
|
1178
|
+
const s = me.tools ?? me.line;
|
|
1167
1179
|
s ? Qe.value = s : Je = setTimeout(() => Qe.value = null, 160);
|
|
1168
1180
|
}
|
|
1169
1181
|
ot(() => clearTimeout(Je));
|
|
1170
|
-
const
|
|
1182
|
+
const Be = V(null), Et = E({
|
|
1171
1183
|
get: () => !!F.value,
|
|
1172
1184
|
set: (e) => {
|
|
1173
|
-
e || (
|
|
1185
|
+
e || (Be.value = null);
|
|
1174
1186
|
}
|
|
1175
1187
|
}), F = E(() => {
|
|
1176
|
-
const e = n.edges.find((a) => a.id ===
|
|
1188
|
+
const e = n.edges.find((a) => a.id === Be.value), t = e && n.nodes.find((a) => a.id === e.source), o = e && n.nodes.find((a) => a.id === e.target);
|
|
1177
1189
|
if (!e || !t || !o) return null;
|
|
1178
1190
|
const s = ke(e, n.nodes);
|
|
1179
1191
|
return {
|
|
@@ -1188,7 +1200,7 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1188
1200
|
function et(e, t) {
|
|
1189
1201
|
return (e == null ? void 0 : e.label) ?? (t === "in" ? "Input" : "Output");
|
|
1190
1202
|
}
|
|
1191
|
-
function
|
|
1203
|
+
function on(e) {
|
|
1192
1204
|
const t = n.nodes.find((a) => a.id === e.source), o = n.nodes.find((a) => a.id === e.target), s = ke(e, n.nodes);
|
|
1193
1205
|
return `${et(t && xe(t).find((a) => a.id === s.sourcePort), "out")} → ${et(o && $e(o).find((a) => a.id === s.targetPort), "in")}`;
|
|
1194
1206
|
}
|
|
@@ -1200,69 +1212,69 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1200
1212
|
] : [];
|
|
1201
1213
|
});
|
|
1202
1214
|
function tt() {
|
|
1203
|
-
clearTimeout(Je),
|
|
1215
|
+
clearTimeout(Je), me.line = me.tools = null, Qe.value = null;
|
|
1204
1216
|
}
|
|
1205
|
-
function
|
|
1206
|
-
tt(),
|
|
1217
|
+
function _t(e) {
|
|
1218
|
+
tt(), Be.value = e;
|
|
1207
1219
|
}
|
|
1208
|
-
function
|
|
1220
|
+
function Ae(e) {
|
|
1209
1221
|
if (!n.editable || !e.length) return;
|
|
1210
|
-
if (!n.beforeRemove) return
|
|
1222
|
+
if (!n.beforeRemove) return an(e);
|
|
1211
1223
|
const t = new Set(e);
|
|
1212
|
-
tt(),
|
|
1224
|
+
tt(), bt({ nodes: [], edges: n.edges.filter((o) => t.has(o.id)) }).then((o) => o && an(e));
|
|
1213
1225
|
}
|
|
1214
|
-
function
|
|
1226
|
+
function an(e) {
|
|
1215
1227
|
var a;
|
|
1216
1228
|
const t = new Set(e), o = n.edges.filter((u) => !t.has(u.id)), s = F.value;
|
|
1217
|
-
d("update:edges", o), Ce({ nodes: n.nodes, edges: n.edges }, { nodes: n.nodes, edges: o }), tt(), s && t.has(s.edge.id) && (
|
|
1229
|
+
d("update:edges", o), Ce({ nodes: n.nodes, edges: n.edges }, { nodes: n.nodes, edges: o }), tt(), s && t.has(s.edge.id) && (Be.value = ((a = s.between.find((u) => !t.has(u.id))) == null ? void 0 : a.id) ?? null), re(e.length === 1 ? "Connection deleted." : `${e.length} connections deleted.`);
|
|
1218
1230
|
}
|
|
1219
|
-
function
|
|
1231
|
+
function sn(e) {
|
|
1220
1232
|
const t = n.edges.find((o) => o.id === e);
|
|
1221
|
-
!t || !Oe.value || (
|
|
1233
|
+
!t || !Oe.value || (Be.value = null, tt(), Pe.value = t, kt(null));
|
|
1222
1234
|
}
|
|
1223
|
-
function
|
|
1235
|
+
function ln(e, t) {
|
|
1224
1236
|
const { sourcePort: o, targetPort: s } = ke(e, n.nodes);
|
|
1225
1237
|
if (!o || !s) return { reason: "That connection has no ports." };
|
|
1226
1238
|
const a = n.nodes.some((x) => x.id === t.id) ? n.nodes : [...n.nodes, t], u = n.edges.filter((x) => x.id !== e.id), $ = (x) => {
|
|
1227
|
-
var
|
|
1239
|
+
var A;
|
|
1228
1240
|
try {
|
|
1229
|
-
return ((
|
|
1241
|
+
return ((A = n.connectionRule) == null ? void 0 : A.call(n, x)) ?? null;
|
|
1230
1242
|
} catch {
|
|
1231
1243
|
return null;
|
|
1232
1244
|
}
|
|
1233
|
-
}, w = (x,
|
|
1245
|
+
}, w = (x, A) => bn(a, x, A, { allowCycles: n.allowCycles, noun: n.noun }) ?? $(A), P = $e(t).map((x) => ({ source: e.source, sourcePort: o, target: t.id, targetPort: x.id })), I = P.find((x) => !w(u, x));
|
|
1234
1246
|
if (!I) return { reason: P[0] ? w(u, P[0]) ?? void 0 : `${t.label} has no input.` };
|
|
1235
1247
|
const L = [...u, { id: at(I), ...I }], W = xe(t).map((x) => ({ source: t.id, sourcePort: x.id, target: e.target, targetPort: s })), H = W.find((x) => !w(L, x));
|
|
1236
1248
|
return H ? { into: I, out: H } : { into: I, reason: W[0] ? w(L, W[0]) ?? void 0 : `${t.label} has no output.` };
|
|
1237
1249
|
}
|
|
1238
1250
|
function Jn(e, t, o) {
|
|
1239
|
-
const s =
|
|
1251
|
+
const s = ln(e, t);
|
|
1240
1252
|
if (s.into && s.out) {
|
|
1241
1253
|
const $ = [...n.edges.filter((P) => P.id !== e.id), { id: at(s.into), ...s.into }, { id: at(s.out), ...s.out }];
|
|
1242
1254
|
d("update:edges", $);
|
|
1243
|
-
const w =
|
|
1244
|
-
return re(`${t.label} is now between ${
|
|
1255
|
+
const w = Kn(o, e);
|
|
1256
|
+
return re(`${t.label} is now between ${B(e.source)} and ${B(e.target)}.`), { nodes: w, edges: $ };
|
|
1245
1257
|
}
|
|
1246
|
-
const a =
|
|
1258
|
+
const a = en($t()), u = n.nodes.map(($) => $.id === t.id ? { ...$, position: a } : $);
|
|
1247
1259
|
return d("update:nodes", u), re(`${t.label} is at the end of the chain, not connected: ${s.reason ?? "it does not fit between them."}`), { nodes: u, edges: n.edges };
|
|
1248
1260
|
}
|
|
1249
1261
|
te(
|
|
1250
1262
|
() => n.nodes,
|
|
1251
1263
|
async (e) => {
|
|
1252
|
-
const t =
|
|
1264
|
+
const t = wt, o = t && e.find((P) => !t.known.has(P.id));
|
|
1253
1265
|
if (!t || !o) return;
|
|
1254
|
-
|
|
1255
|
-
const s = { nodes: e.filter((P) => P.id !== o.id), edges: n.edges.filter((P) => P.source !== o.id && P.target !== o.id) }, a = await
|
|
1266
|
+
wt = null;
|
|
1267
|
+
const s = { nodes: e.filter((P) => P.id !== o.id), edges: n.edges.filter((P) => P.source !== o.id && P.target !== o.id) }, a = await qn(o.id), u = n.nodes.find((P) => P.id === o.id), $ = a && u && t.edge ? Jn(t.edge, u, a) : { nodes: n.nodes, edges: n.edges };
|
|
1256
1268
|
if (Ce(s, $), !a || !u) return;
|
|
1257
1269
|
await ee();
|
|
1258
|
-
const w =
|
|
1259
|
-
w &&
|
|
1270
|
+
const w = m.findNode(o.id);
|
|
1271
|
+
w && nn(w);
|
|
1260
1272
|
}
|
|
1261
1273
|
);
|
|
1262
|
-
const de = V(null),
|
|
1274
|
+
const de = V(null), pe = V(null), Ue = E({
|
|
1263
1275
|
get: () => !!de.value,
|
|
1264
1276
|
set: (e) => {
|
|
1265
|
-
e || (de.value =
|
|
1277
|
+
e || (de.value = pe.value = null);
|
|
1266
1278
|
}
|
|
1267
1279
|
});
|
|
1268
1280
|
function eo(e) {
|
|
@@ -1274,10 +1286,10 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1274
1286
|
}
|
|
1275
1287
|
function to(e) {
|
|
1276
1288
|
const t = n.nodes.find((o) => o.id === e);
|
|
1277
|
-
!n.editable || !t || (de.value = t,
|
|
1289
|
+
!n.editable || !t || (de.value = t, pe.value = { ...t, data: eo(t.data) });
|
|
1278
1290
|
}
|
|
1279
1291
|
function no() {
|
|
1280
|
-
const e =
|
|
1292
|
+
const e = pe.value;
|
|
1281
1293
|
e && (d("update:nodes", n.nodes.map((t) => t.id === e.id ? { ...e, label: e.label.trim() || t.label, position: t.position } : t)), Ue.value = !1);
|
|
1282
1294
|
}
|
|
1283
1295
|
function oo() {
|
|
@@ -1285,38 +1297,38 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1285
1297
|
const e = (s = de.value) == null ? void 0 : s.id;
|
|
1286
1298
|
if (!e) return;
|
|
1287
1299
|
const t = () => {
|
|
1288
|
-
|
|
1300
|
+
yt(/* @__PURE__ */ new Set([e]), /* @__PURE__ */ new Set()), Ue.value = !1;
|
|
1289
1301
|
};
|
|
1290
1302
|
if (!n.beforeRemove) return t();
|
|
1291
1303
|
const o = n.nodes.find((a) => a.id === e);
|
|
1292
|
-
|
|
1304
|
+
bt({ nodes: o ? [o] : [], edges: n.edges.filter((a) => a.source === e || a.target === e) }).then((a) => a && t());
|
|
1293
1305
|
}
|
|
1294
|
-
function
|
|
1306
|
+
function St(e) {
|
|
1295
1307
|
if (n.editor === "modal") return to(e);
|
|
1296
1308
|
const t = n.nodes.find((o) => o.id === e);
|
|
1297
1309
|
t && d("open", t);
|
|
1298
1310
|
}
|
|
1299
|
-
function
|
|
1311
|
+
function dn(e) {
|
|
1300
1312
|
return !!(e != null && e.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"])'));
|
|
1301
1313
|
}
|
|
1302
1314
|
function io(e) {
|
|
1303
1315
|
const t = e.target instanceof Element ? e.target : null, o = e.key.toLowerCase();
|
|
1304
|
-
if (he.value && (e.metaKey || e.ctrlKey) && !e.altKey && (o === "z" || o === "y" && e.ctrlKey) && !
|
|
1305
|
-
e.preventDefault(), o === "y" || e.shiftKey ?
|
|
1316
|
+
if (he.value && (e.metaKey || e.ctrlKey) && !e.altKey && (o === "z" || o === "y" && e.ctrlKey) && !dn(t)) {
|
|
1317
|
+
e.preventDefault(), o === "y" || e.shiftKey ? Tt() : Mt();
|
|
1306
1318
|
return;
|
|
1307
1319
|
}
|
|
1308
|
-
e.key === "Enter" && (t != null && t.classList.contains("vue-flow__node")) && t instanceof HTMLElement && t.dataset.id &&
|
|
1320
|
+
e.key === "Enter" && (t != null && t.classList.contains("vue-flow__node")) && t instanceof HTMLElement && t.dataset.id && St(t.dataset.id);
|
|
1309
1321
|
const s = t != null && t.classList.contains("vue-flow__edge") ? t.getAttribute("data-id") : null;
|
|
1310
1322
|
if (!s) {
|
|
1311
|
-
|
|
1323
|
+
p.includes(e.key) && n.editable && n.beforeRemove && !dn(t) && (e.preventDefault(), Yn());
|
|
1312
1324
|
return;
|
|
1313
1325
|
}
|
|
1314
|
-
e.key === "Enter" ? (e.preventDefault(),
|
|
1326
|
+
e.key === "Enter" ? (e.preventDefault(), _t(s)) : (e.key === "Delete" || e.key === "Backspace") && n.editable && (e.preventDefault(), Ae([s]));
|
|
1315
1327
|
}
|
|
1316
|
-
const he = E(() => !!n.history && n.editable), se = E(() => typeof n.history == "object" ? n.history : null), Ne = V(!1), ue =
|
|
1328
|
+
const he = E(() => !!n.history && n.editable), se = E(() => typeof n.history == "object" ? n.history : null), Ne = V(!1), ue = Ot([]), Ye = Ot([]), Pt = E(() => {
|
|
1317
1329
|
var e, t;
|
|
1318
1330
|
return he.value && !Ne.value && !((e = se.value) != null && e.busy) && (((t = se.value) == null ? void 0 : t.canUndo) ?? ue.value.length > 0);
|
|
1319
|
-
}),
|
|
1331
|
+
}), Nt = E(() => {
|
|
1320
1332
|
var e, t;
|
|
1321
1333
|
return he.value && !Ne.value && !((e = se.value) != null && e.busy) && (((t = se.value) == null ? void 0 : t.canRedo) ?? Ye.value.length > 0);
|
|
1322
1334
|
});
|
|
@@ -1335,14 +1347,14 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1335
1347
|
}
|
|
1336
1348
|
function Ce(e, t) {
|
|
1337
1349
|
if (!he.value || se.value) return;
|
|
1338
|
-
const o =
|
|
1350
|
+
const o = Ii(e, t);
|
|
1339
1351
|
if (!o) return;
|
|
1340
1352
|
const s = ao(o), a = ue.value[ue.value.length - 1];
|
|
1341
1353
|
if (a && a.key === s && a.from[0] === e.nodes && a.from[1] === e.edges) return;
|
|
1342
1354
|
const u = { entry: o, key: s, from: [e.nodes, e.edges] };
|
|
1343
1355
|
ue.value = [...ue.value, u].slice(-100), Ye.value = [];
|
|
1344
1356
|
}
|
|
1345
|
-
function
|
|
1357
|
+
function rn() {
|
|
1346
1358
|
var e, t;
|
|
1347
1359
|
ue.value = [], Ye.value = [], (t = (e = se.value) == null ? void 0 : e.clear) == null || t.call(e);
|
|
1348
1360
|
}
|
|
@@ -1351,23 +1363,23 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1351
1363
|
(e, t) => {
|
|
1352
1364
|
if (se.value || !(t != null && t.length) || !e.length) return;
|
|
1353
1365
|
const o = new Set(t.map((s) => s.id));
|
|
1354
|
-
e.some((s) => o.has(s.id)) ||
|
|
1366
|
+
e.some((s) => o.has(s.id)) || rn();
|
|
1355
1367
|
}
|
|
1356
1368
|
);
|
|
1357
1369
|
async function so(e) {
|
|
1358
|
-
for (let t = 0; t < 12 && e.some((o) => !
|
|
1370
|
+
for (let t = 0; t < 12 && e.some((o) => !m.findNode(o)); t += 1)
|
|
1359
1371
|
await (typeof requestAnimationFrame == "function" ? new Promise((o) => requestAnimationFrame(o)) : ee());
|
|
1360
1372
|
}
|
|
1361
|
-
let
|
|
1362
|
-
function
|
|
1363
|
-
return
|
|
1364
|
-
}),
|
|
1373
|
+
let Ct = Promise.resolve();
|
|
1374
|
+
function un(e) {
|
|
1375
|
+
return Ct = Ct.then(() => lo(e)).catch(() => {
|
|
1376
|
+
}), Ct;
|
|
1365
1377
|
}
|
|
1366
1378
|
async function lo(e) {
|
|
1367
1379
|
var L, W;
|
|
1368
1380
|
const t = se.value;
|
|
1369
1381
|
if (t) {
|
|
1370
|
-
if (!(e === "undo" ?
|
|
1382
|
+
if (!(e === "undo" ? Pt.value : Nt.value)) return;
|
|
1371
1383
|
const H = !!((L = Me.value) != null && L.contains(document.activeElement));
|
|
1372
1384
|
Ne.value = !0;
|
|
1373
1385
|
try {
|
|
@@ -1375,38 +1387,38 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1375
1387
|
} catch {
|
|
1376
1388
|
re(e === "undo" ? "Could not undo. Try again." : "Could not redo. Try again.");
|
|
1377
1389
|
} finally {
|
|
1378
|
-
Ne.value = !1, await ee(), H &&
|
|
1390
|
+
Ne.value = !1, await ee(), H && cn();
|
|
1379
1391
|
}
|
|
1380
1392
|
return;
|
|
1381
1393
|
}
|
|
1382
1394
|
const o = e === "undo" ? ue : Ye, s = e === "undo" ? Ye : ue, a = o.value[o.value.length - 1];
|
|
1383
1395
|
if (!he.value || !a) return;
|
|
1384
1396
|
o.value = o.value.slice(0, -1), s.value = [...s.value, a];
|
|
1385
|
-
const u = !!((W = Me.value) != null && W.contains(document.activeElement)), { entry: $ } = a, w =
|
|
1397
|
+
const u = !!((W = Me.value) != null && W.contains(document.activeElement)), { entry: $ } = a, w = zi($, n.nodes, e);
|
|
1386
1398
|
(w.length !== n.nodes.length || w.some((H, x) => H !== n.nodes[x])) && d("update:nodes", w);
|
|
1387
1399
|
const P = (e === "undo" ? $.removedNodes : $.addedNodes).map(({ node: H }) => H.id);
|
|
1388
1400
|
P.length && await so(P);
|
|
1389
|
-
const I =
|
|
1390
|
-
(I.length !== n.edges.length || I.some((H, x) => H !== n.edges[x])) && d("update:edges", I), n.selected && !w.some((H) => H.id === n.selected) && d("update:selected", null), re(e === "undo" ? "Undone." : "Redone."), await ee(), u &&
|
|
1401
|
+
const I = Li($, n.edges, w, e);
|
|
1402
|
+
(I.length !== n.edges.length || I.some((H, x) => H !== n.edges[x])) && d("update:edges", I), n.selected && !w.some((H) => H.id === n.selected) && d("update:selected", null), re(e === "undo" ? "Undone." : "Redone."), await ee(), u && cn();
|
|
1391
1403
|
}
|
|
1392
|
-
function
|
|
1404
|
+
function cn() {
|
|
1393
1405
|
const e = Me.value, t = document.activeElement;
|
|
1394
1406
|
if (!e || t && e.contains(t) && !(t instanceof HTMLButtonElement && t.disabled)) return;
|
|
1395
1407
|
(e.querySelector("[data-it-dag-undo]:not(:disabled), [data-it-dag-redo]:not(:disabled)") ?? e).focus({ preventScroll: !0 });
|
|
1396
1408
|
}
|
|
1397
|
-
function Ct() {
|
|
1398
|
-
return rn("undo");
|
|
1399
|
-
}
|
|
1400
1409
|
function Mt() {
|
|
1401
|
-
return
|
|
1410
|
+
return un("undo");
|
|
1411
|
+
}
|
|
1412
|
+
function Tt() {
|
|
1413
|
+
return un("redo");
|
|
1402
1414
|
}
|
|
1403
1415
|
const le = V(!1), ro = E(() => n.wheel === "pan" || le.value);
|
|
1404
|
-
function
|
|
1416
|
+
function Dt(e) {
|
|
1405
1417
|
e.key === "Escape" && !e.defaultPrevented && !document.querySelector(".p-dialog-mask") && (le.value = !1);
|
|
1406
1418
|
}
|
|
1407
1419
|
const Me = V(null);
|
|
1408
1420
|
let nt = [];
|
|
1409
|
-
function
|
|
1421
|
+
function Rt(e) {
|
|
1410
1422
|
if (e) {
|
|
1411
1423
|
nt = [...document.body.children].filter((t) => t instanceof HTMLElement && t !== Me.value && !t.inert);
|
|
1412
1424
|
for (const t of nt) t.inert = !0;
|
|
@@ -1417,55 +1429,55 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1417
1429
|
}
|
|
1418
1430
|
te(le, async (e) => {
|
|
1419
1431
|
var t, o;
|
|
1420
|
-
e ? window.addEventListener("keydown",
|
|
1432
|
+
e ? window.addEventListener("keydown", Dt) : window.removeEventListener("keydown", Dt), e || Rt(!1), await ee(), e && Rt(!0), (o = (t = Me.value) == null ? void 0 : t.querySelector("[data-it-dag-expand]")) == null || o.focus(), await _e();
|
|
1421
1433
|
}), ot(() => {
|
|
1422
|
-
window.removeEventListener("keydown",
|
|
1423
|
-
}),
|
|
1434
|
+
window.removeEventListener("keydown", Dt), Rt(!1);
|
|
1435
|
+
}), mo(ct, {
|
|
1424
1436
|
editable: () => n.editable,
|
|
1425
1437
|
direction: () => n.direction,
|
|
1426
1438
|
expanded: () => le.value,
|
|
1427
1439
|
toggleExpanded: () => le.value = !le.value,
|
|
1428
|
-
zoomIn: () => void
|
|
1429
|
-
zoomOut: () => void
|
|
1440
|
+
zoomIn: () => void m.zoomIn({ duration: R ? 0 : 150 }),
|
|
1441
|
+
zoomOut: () => void m.zoomOut({ duration: R ? 0 : 150 }),
|
|
1430
1442
|
fit: () => void _e(),
|
|
1431
1443
|
arrange: () => void ze("all", !0),
|
|
1432
1444
|
hoveredEdge: () => Qe.value,
|
|
1433
|
-
hoverEdge:
|
|
1434
|
-
openConnection:
|
|
1435
|
-
insertOnEdge:
|
|
1436
|
-
removeEdge: (e) =>
|
|
1437
|
-
view: () =>
|
|
1445
|
+
hoverEdge: xt,
|
|
1446
|
+
openConnection: _t,
|
|
1447
|
+
insertOnEdge: sn,
|
|
1448
|
+
removeEdge: (e) => Ae([e]),
|
|
1449
|
+
view: () => jt.value,
|
|
1438
1450
|
noun: () => n.noun,
|
|
1439
1451
|
history: () => he.value,
|
|
1440
|
-
canUndo: () =>
|
|
1441
|
-
canRedo: () =>
|
|
1442
|
-
undo: () => void
|
|
1443
|
-
redo: () => void
|
|
1452
|
+
canUndo: () => Pt.value,
|
|
1453
|
+
canRedo: () => Nt.value,
|
|
1454
|
+
undo: () => void Mt(),
|
|
1455
|
+
redo: () => void Tt()
|
|
1444
1456
|
});
|
|
1445
|
-
let
|
|
1446
|
-
function
|
|
1457
|
+
let It = null;
|
|
1458
|
+
function fn(e) {
|
|
1447
1459
|
if (!Ee || ae.value) {
|
|
1448
|
-
|
|
1460
|
+
It = e;
|
|
1449
1461
|
return;
|
|
1450
1462
|
}
|
|
1451
|
-
const t =
|
|
1452
|
-
t &&
|
|
1463
|
+
const t = m.findNode(e);
|
|
1464
|
+
t && nn(t);
|
|
1453
1465
|
}
|
|
1454
1466
|
const uo = E(() => n.emptyTitle ?? `No ${n.noun.other} yet`);
|
|
1455
|
-
return l({ fit: _e, arrange: () => ze("all", !0), revealNode:
|
|
1467
|
+
return l({ fit: _e, arrange: () => ze("all", !0), revealNode: fn, openNode: St, undo: Mt, redo: Tt, canUndo: Pt, canRedo: Nt, clearHistory: rn }), (e, t) => {
|
|
1456
1468
|
var o, s, a, u, $;
|
|
1457
1469
|
return b(), _("div", {
|
|
1458
1470
|
class: "it-dag-host",
|
|
1459
1471
|
style: rt({ height: typeof i.height == "number" ? `${i.height}px` : i.height })
|
|
1460
1472
|
}, [
|
|
1461
|
-
(b(), O(
|
|
1473
|
+
(b(), O(po, {
|
|
1462
1474
|
to: "body",
|
|
1463
1475
|
disabled: !le.value
|
|
1464
1476
|
}, [
|
|
1465
1477
|
U("div", {
|
|
1466
1478
|
ref_key: "frame",
|
|
1467
1479
|
ref: Me,
|
|
1468
|
-
class: Ie(["it-dag", { "it-dag--editable": i.editable, "it-dag--connecting":
|
|
1480
|
+
class: Ie(["it-dag", { "it-dag--editable": i.editable, "it-dag--connecting": vt.value, "it-dag--pending": Q.value || ae.value, "it-dag--expanded": le.value }]),
|
|
1469
1481
|
role: le.value ? "dialog" : "region",
|
|
1470
1482
|
"aria-modal": le.value ? "true" : void 0,
|
|
1471
1483
|
"aria-label": i.label,
|
|
@@ -1474,7 +1486,7 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1474
1486
|
onKeydown: io
|
|
1475
1487
|
}, [
|
|
1476
1488
|
D(k(Do), {
|
|
1477
|
-
id:
|
|
1489
|
+
id: y,
|
|
1478
1490
|
class: "it-dag__flow",
|
|
1479
1491
|
nodes: S.value,
|
|
1480
1492
|
edges: ie.value,
|
|
@@ -1482,10 +1494,10 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1482
1494
|
"nodes-connectable": i.editable,
|
|
1483
1495
|
"elements-selectable": !0,
|
|
1484
1496
|
"edges-updatable": !1,
|
|
1485
|
-
"delete-key-code": i.editable && !i.beforeRemove ?
|
|
1486
|
-
"edge-types":
|
|
1497
|
+
"delete-key-code": i.editable && !i.beforeRemove ? p : null,
|
|
1498
|
+
"edge-types": f,
|
|
1487
1499
|
"connection-mode": k(Ro).Strict,
|
|
1488
|
-
"connection-line-type": i.edgeShape === "bezier" ? k(
|
|
1500
|
+
"connection-line-type": i.edgeShape === "bezier" ? k(yn).Bezier : k(yn).SmoothStep,
|
|
1489
1501
|
"is-valid-connection": Fn,
|
|
1490
1502
|
"min-zoom": c.value,
|
|
1491
1503
|
"max-zoom": 2,
|
|
@@ -1500,13 +1512,13 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1500
1512
|
onNodesChange: Hn,
|
|
1501
1513
|
onEdgesChange: Xn,
|
|
1502
1514
|
onNodesInitialized: On,
|
|
1503
|
-
onConnect:
|
|
1504
|
-
onConnectStart:
|
|
1515
|
+
onConnect: An,
|
|
1516
|
+
onConnectStart: Bn,
|
|
1505
1517
|
onConnectEnd: Un,
|
|
1506
|
-
onNodeClick: t[1] || (t[1] = ({ node: w }) =>
|
|
1507
|
-
onEdgeClick: t[2] || (t[2] = ({ edge: w }) =>
|
|
1508
|
-
onEdgeMouseEnter: t[3] || (t[3] = ({ edge: w }) =>
|
|
1509
|
-
onEdgeMouseLeave: t[4] || (t[4] = ({ edge: w }) =>
|
|
1518
|
+
onNodeClick: t[1] || (t[1] = ({ node: w }) => St(w.id)),
|
|
1519
|
+
onEdgeClick: t[2] || (t[2] = ({ edge: w }) => _t(w.id)),
|
|
1520
|
+
onEdgeMouseEnter: t[3] || (t[3] = ({ edge: w }) => xt(w.id, "line", !0)),
|
|
1521
|
+
onEdgeMouseLeave: t[4] || (t[4] = ({ edge: w }) => xt(w.id, "line", !1))
|
|
1510
1522
|
}, {
|
|
1511
1523
|
"node-it": X(({ data: w, selected: P }) => [
|
|
1512
1524
|
Re(e.$slots, "node", {
|
|
@@ -1520,9 +1532,9 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1520
1532
|
])
|
|
1521
1533
|
]),
|
|
1522
1534
|
default: X(() => [
|
|
1523
|
-
Dn.value ? (b(), _("div",
|
|
1524
|
-
Rn.value ? (b(), _("div",
|
|
1525
|
-
Oe.value ? (b(), O(k(
|
|
1535
|
+
Dn.value ? (b(), _("div", Hi)) : C("", !0),
|
|
1536
|
+
Rn.value ? (b(), _("div", Xi)) : C("", !0),
|
|
1537
|
+
Oe.value ? (b(), O(k(Ft), {
|
|
1526
1538
|
key: 2,
|
|
1527
1539
|
position: "top-left",
|
|
1528
1540
|
class: "it-dag__panel"
|
|
@@ -1531,10 +1543,10 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1531
1543
|
D(k(ce), {
|
|
1532
1544
|
label: `Add ${i.noun.one}`,
|
|
1533
1545
|
size: "small",
|
|
1534
|
-
onClick: t[0] || (t[0] = (w) =>
|
|
1546
|
+
onClick: t[0] || (t[0] = (w) => kt())
|
|
1535
1547
|
}, {
|
|
1536
1548
|
icon: X(() => [
|
|
1537
|
-
D(k(
|
|
1549
|
+
D(k(Yt), {
|
|
1538
1550
|
size: 14,
|
|
1539
1551
|
"aria-hidden": "true"
|
|
1540
1552
|
})
|
|
@@ -1544,7 +1556,7 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1544
1556
|
]),
|
|
1545
1557
|
_: 1
|
|
1546
1558
|
})) : C("", !0),
|
|
1547
|
-
e.$slots.actions ? (b(), O(k(
|
|
1559
|
+
e.$slots.actions ? (b(), O(k(Ft), {
|
|
1548
1560
|
key: 3,
|
|
1549
1561
|
position: "top-right",
|
|
1550
1562
|
class: "it-dag__panel it-dag__actions"
|
|
@@ -1554,19 +1566,19 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1554
1566
|
]),
|
|
1555
1567
|
_: 3
|
|
1556
1568
|
})) : C("", !0),
|
|
1557
|
-
D(k(
|
|
1569
|
+
D(k(Ft), {
|
|
1558
1570
|
position: "bottom-left",
|
|
1559
1571
|
class: "it-dag__panel"
|
|
1560
1572
|
}, {
|
|
1561
1573
|
default: X(() => [
|
|
1562
|
-
D(
|
|
1574
|
+
D(ki)
|
|
1563
1575
|
]),
|
|
1564
1576
|
_: 1
|
|
1565
1577
|
})
|
|
1566
1578
|
]),
|
|
1567
1579
|
_: 3
|
|
1568
1580
|
}, 8, ["nodes", "edges", "nodes-draggable", "nodes-connectable", "delete-key-code", "connection-mode", "connection-line-type", "min-zoom", "pan-on-scroll"]),
|
|
1569
|
-
i.nodes.length ? C("", !0) : (b(), _("div",
|
|
1581
|
+
i.nodes.length ? C("", !0) : (b(), _("div", Vi, [
|
|
1570
1582
|
Re(e.$slots, "empty", {}, () => [
|
|
1571
1583
|
D(Fo, {
|
|
1572
1584
|
title: uo.value,
|
|
@@ -1575,18 +1587,18 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1575
1587
|
])
|
|
1576
1588
|
])),
|
|
1577
1589
|
U("p", {
|
|
1578
|
-
class: Ie(["it-dag__notice", { "it-dag__notice--shown": ((o = se.value) == null ? void 0 : o.busy) || Ne.value ||
|
|
1590
|
+
class: Ie(["it-dag__notice", { "it-dag__notice--shown": ((o = se.value) == null ? void 0 : o.busy) || Ne.value || qe.value }]),
|
|
1579
1591
|
role: "status"
|
|
1580
|
-
}, G((s = se.value) != null && s.busy || Ne.value ? "Saving workflow" :
|
|
1581
|
-
], 42,
|
|
1592
|
+
}, G((s = se.value) != null && s.busy || Ne.value ? "Saving workflow" : qe.value), 3)
|
|
1593
|
+
], 42, Yi)
|
|
1582
1594
|
], 8, ["disabled"])),
|
|
1583
|
-
Oe.value ? (b(), O(
|
|
1595
|
+
Oe.value ? (b(), O(Di, {
|
|
1584
1596
|
key: 0,
|
|
1585
1597
|
visible: Le.value,
|
|
1586
1598
|
"onUpdate:visible": t[5] || (t[5] = (w) => Le.value = w),
|
|
1587
1599
|
items: i.library,
|
|
1588
1600
|
description: Vn.value,
|
|
1589
|
-
misfits:
|
|
1601
|
+
misfits: Qt.value,
|
|
1590
1602
|
noun: i.noun,
|
|
1591
1603
|
onPick: Wn
|
|
1592
1604
|
}, null, 8, ["visible", "items", "description", "misfits", "noun"])) : C("", !0),
|
|
@@ -1612,20 +1624,20 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1612
1624
|
})
|
|
1613
1625
|
]),
|
|
1614
1626
|
default: X(() => [
|
|
1615
|
-
de.value &&
|
|
1616
|
-
D(
|
|
1627
|
+
de.value && pe.value ? (b(), _("div", Wi, [
|
|
1628
|
+
D(Bo, { label: "Name" }, {
|
|
1617
1629
|
default: X(({ id: w }) => [
|
|
1618
1630
|
D(k(yo), {
|
|
1619
1631
|
id: w,
|
|
1620
|
-
modelValue:
|
|
1621
|
-
"onUpdate:modelValue": t[6] || (t[6] = (P) =>
|
|
1632
|
+
modelValue: pe.value.label,
|
|
1633
|
+
"onUpdate:modelValue": t[6] || (t[6] = (P) => pe.value.label = P)
|
|
1622
1634
|
}, null, 8, ["id", "modelValue"])
|
|
1623
1635
|
]),
|
|
1624
1636
|
_: 1
|
|
1625
1637
|
}),
|
|
1626
1638
|
Re(e.$slots, "editor", {
|
|
1627
1639
|
node: de.value,
|
|
1628
|
-
draft:
|
|
1640
|
+
draft: pe.value
|
|
1629
1641
|
})
|
|
1630
1642
|
])) : C("", !0)
|
|
1631
1643
|
]),
|
|
@@ -1645,8 +1657,8 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1645
1657
|
} : void 0
|
|
1646
1658
|
]), 1032, ["visible", "title", "description", "size"])) : C("", !0),
|
|
1647
1659
|
D(At, {
|
|
1648
|
-
visible:
|
|
1649
|
-
"onUpdate:visible": t[13] || (t[13] = (w) =>
|
|
1660
|
+
visible: Et.value,
|
|
1661
|
+
"onUpdate:visible": t[13] || (t[13] = (w) => Et.value = w),
|
|
1650
1662
|
title: "Connection",
|
|
1651
1663
|
description: F.value ? `${F.value.source.label} to ${F.value.target.label}` : void 0
|
|
1652
1664
|
}, it({
|
|
@@ -1656,16 +1668,16 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1656
1668
|
label: `Add ${k(He)(i.noun)} here`,
|
|
1657
1669
|
severity: "secondary",
|
|
1658
1670
|
outlined: "",
|
|
1659
|
-
onClick: t[11] || (t[11] = (w) => F.value &&
|
|
1671
|
+
onClick: t[11] || (t[11] = (w) => F.value && sn(F.value.edge.id))
|
|
1660
1672
|
}, null, 8, ["label"])) : C("", !0),
|
|
1661
1673
|
D(k(ce), {
|
|
1662
1674
|
label: "Done",
|
|
1663
|
-
onClick: t[12] || (t[12] = (w) =>
|
|
1675
|
+
onClick: t[12] || (t[12] = (w) => Et.value = !1)
|
|
1664
1676
|
})
|
|
1665
1677
|
]),
|
|
1666
1678
|
default: X(() => [
|
|
1667
|
-
F.value ? (b(), _("div",
|
|
1668
|
-
D(
|
|
1679
|
+
F.value ? (b(), _("div", ji, [
|
|
1680
|
+
D(Ao, {
|
|
1669
1681
|
items: Qn.value,
|
|
1670
1682
|
layout: "stacked",
|
|
1671
1683
|
columns: 2
|
|
@@ -1683,9 +1695,9 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1683
1695
|
meta: String(F.value.between.length)
|
|
1684
1696
|
}, it({
|
|
1685
1697
|
default: X(() => [
|
|
1686
|
-
(b(!0), _(
|
|
1698
|
+
(b(!0), _(K, null, ge(F.value.between, (w) => (b(), O(Yo, {
|
|
1687
1699
|
key: w.id,
|
|
1688
|
-
title:
|
|
1700
|
+
title: on(w),
|
|
1689
1701
|
meta: w.id === F.value.edge.id ? "This connection" : void 0
|
|
1690
1702
|
}, it({ _: 2 }, [
|
|
1691
1703
|
i.editable ? {
|
|
@@ -1693,10 +1705,10 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1693
1705
|
fn: X(() => [
|
|
1694
1706
|
D(ne, {
|
|
1695
1707
|
icon: k(En),
|
|
1696
|
-
label: `Delete connection ${
|
|
1708
|
+
label: `Delete connection ${on(w)}`,
|
|
1697
1709
|
size: "sm",
|
|
1698
1710
|
tone: "danger",
|
|
1699
|
-
onClick: (P) =>
|
|
1711
|
+
onClick: (P) => Ae([w.id])
|
|
1700
1712
|
}, null, 8, ["icon", "label", "onClick"])
|
|
1701
1713
|
]),
|
|
1702
1714
|
key: "0"
|
|
@@ -1713,7 +1725,7 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1713
1725
|
severity: "danger",
|
|
1714
1726
|
text: "",
|
|
1715
1727
|
size: "small",
|
|
1716
|
-
onClick: t[9] || (t[9] = (w) =>
|
|
1728
|
+
onClick: t[9] || (t[9] = (w) => Ae(F.value.between.map((P) => P.id)))
|
|
1717
1729
|
}, null, 8, ["label"])
|
|
1718
1730
|
]),
|
|
1719
1731
|
key: "0"
|
|
@@ -1730,7 +1742,7 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1730
1742
|
label: "Delete connection",
|
|
1731
1743
|
severity: "danger",
|
|
1732
1744
|
text: "",
|
|
1733
|
-
onClick: t[10] || (t[10] = (w) => F.value &&
|
|
1745
|
+
onClick: t[10] || (t[10] = (w) => F.value && Ae([F.value.edge.id]))
|
|
1734
1746
|
})
|
|
1735
1747
|
]),
|
|
1736
1748
|
key: "0"
|
|
@@ -1742,13 +1754,13 @@ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
|
|
|
1742
1754
|
});
|
|
1743
1755
|
export {
|
|
1744
1756
|
oe as IT_DAG_SPACING,
|
|
1745
|
-
|
|
1757
|
+
ia as ItDagCanvas,
|
|
1746
1758
|
li as ItDagNode,
|
|
1747
1759
|
Tn as itDagArrange,
|
|
1748
|
-
|
|
1760
|
+
bn as itDagConnectionError,
|
|
1749
1761
|
at as itDagEdgeId,
|
|
1750
1762
|
$e as itDagInputs,
|
|
1751
|
-
|
|
1763
|
+
oa as itDagLayout,
|
|
1752
1764
|
xe as itDagOutputs,
|
|
1753
1765
|
Wo as itDagReaches
|
|
1754
1766
|
};
|