vue3-network-graph 0.1.1 → 0.1.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/README.en.md +122 -113
- package/README.md +119 -115
- package/dist/index.d.ts +25 -3
- package/dist/index.mjs +346 -339
- package/dist/index.umd.cjs +3 -3
- package/package.json +3 -16
package/dist/index.mjs
CHANGED
|
@@ -235,7 +235,7 @@ var b = {
|
|
|
235
235
|
"y",
|
|
236
236
|
"width",
|
|
237
237
|
"height"
|
|
238
|
-
], Dt = 6, Ot = 14, kt = 3,
|
|
238
|
+
], Dt = 6, Ot = 14, kt = 3, At = 60, jt = .2, Mt = 5, Nt = 160, Pt = 140, Ft = 12, It = 4e3, Lt = 12, Rt = 4e3, zt = {
|
|
239
239
|
__name: "Topology",
|
|
240
240
|
props: {
|
|
241
241
|
nodes: {
|
|
@@ -293,9 +293,9 @@ var b = {
|
|
|
293
293
|
"node-resize-end"
|
|
294
294
|
],
|
|
295
295
|
setup(_, { expose: te, emit: ne }) {
|
|
296
|
-
let v = _, y = ne,
|
|
297
|
-
|
|
298
|
-
},
|
|
296
|
+
let v = _, y = ne, zt = 0, Bt = () => {
|
|
297
|
+
zt++;
|
|
298
|
+
}, x = (e) => e && typeof e == "object" ? {
|
|
299
299
|
text: e.text,
|
|
300
300
|
rotation: e.rotation || 0,
|
|
301
301
|
fontSize: e.fontSize,
|
|
@@ -305,19 +305,19 @@ var b = {
|
|
|
305
305
|
rotation: 0,
|
|
306
306
|
fontSize: void 0,
|
|
307
307
|
color: void 0
|
|
308
|
-
},
|
|
309
|
-
|
|
308
|
+
}, Vt = (e, t = 11) => e.fontSize || t, Ht = (e) => e.fontColor || "#000000", Ut = (e, t = 500) => e.fontWeight || t, S = (e, t) => e.fontSize || x(t).fontSize || 8, C = (e, t) => e.fontColor || x(t).color || "#000000", w = d(v.nodes.map((e) => ({ ...e }))), Wt = null, T = () => {
|
|
309
|
+
Wt = w.value, y("update:nodes", w.value);
|
|
310
310
|
};
|
|
311
311
|
h(() => v.nodes, (e) => {
|
|
312
312
|
let t = Array.isArray(e) ? e : [];
|
|
313
|
-
if (t ===
|
|
313
|
+
if (t === Wt) return;
|
|
314
314
|
let n = null, r = null;
|
|
315
315
|
try {
|
|
316
|
-
n = JSON.stringify(t), r = JSON.stringify(
|
|
316
|
+
n = JSON.stringify(t), r = JSON.stringify(w.value);
|
|
317
317
|
} catch {
|
|
318
318
|
n = null;
|
|
319
319
|
}
|
|
320
|
-
(n === null || n !== r) && (
|
|
320
|
+
(n === null || n !== r) && (Bt(), w.value = t.map((e) => ({ ...e })));
|
|
321
321
|
}, { deep: !0 });
|
|
322
322
|
let Gt = d(v.lineMode);
|
|
323
323
|
h(() => v.lineMode, (e) => {
|
|
@@ -342,13 +342,13 @@ var b = {
|
|
|
342
342
|
...e,
|
|
343
343
|
...r.get(e.id)
|
|
344
344
|
} : e));
|
|
345
|
-
let i = new Set(
|
|
345
|
+
let i = new Set(w.value.map((e) => e.id)), a = j.value;
|
|
346
346
|
return n.filter((e) => !a.has(e.id) && i.has(e.from) && i.has(e.to));
|
|
347
347
|
}), Zt = t(() => v.config.watchDataChanges === !0), Qt = d({
|
|
348
348
|
nodes: [],
|
|
349
349
|
edges: []
|
|
350
350
|
}), $t = "", N = null, en = () => JSON.parse(JSON.stringify({
|
|
351
|
-
nodes:
|
|
351
|
+
nodes: w.value,
|
|
352
352
|
edges: M.value
|
|
353
353
|
})), tn = (e, t) => {
|
|
354
354
|
let n = new Map(e.map((e) => [e.id, e])), r = new Map(t.map((e) => [e.id, e]));
|
|
@@ -376,7 +376,7 @@ var b = {
|
|
|
376
376
|
N &&= (clearTimeout(N), null), Qt.value = en(), $t = "";
|
|
377
377
|
};
|
|
378
378
|
h([
|
|
379
|
-
|
|
379
|
+
w,
|
|
380
380
|
k,
|
|
381
381
|
j,
|
|
382
382
|
A
|
|
@@ -386,23 +386,23 @@ var b = {
|
|
|
386
386
|
Zt.value && on();
|
|
387
387
|
});
|
|
388
388
|
let sn = () => en(), cn = () => {
|
|
389
|
-
let e = new Set(R.value), t = new Set(z.value), n =
|
|
389
|
+
let e = new Set(R.value), t = new Set(z.value), n = w.value.filter((t) => e.has(t.id)), r = M.value.filter((n) => t.has(n.id) || e.has(n.from) || e.has(n.to));
|
|
390
390
|
return !n.length && !r.length ? {
|
|
391
391
|
nodes: [],
|
|
392
392
|
edges: []
|
|
393
|
-
} : (n.length && (
|
|
393
|
+
} : (n.length && (w.value = w.value.filter((t) => !e.has(t.id)), T()), r.length && (j.value = /* @__PURE__ */ new Set([...j.value, ...r.map((e) => e.id)]), k.value = k.value.filter((e) => !j.value.has(e.id)), y("edge-remove", r.map((e) => JSON.parse(JSON.stringify(e))))), R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B(), JSON.parse(JSON.stringify({
|
|
394
394
|
nodes: n,
|
|
395
395
|
edges: r
|
|
396
396
|
})));
|
|
397
397
|
}, ln = (e) => {
|
|
398
|
-
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(
|
|
398
|
+
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(w.value.map((e) => e.id)), r = [];
|
|
399
399
|
for (let e of t) {
|
|
400
400
|
let t = JSON.parse(JSON.stringify(e));
|
|
401
401
|
if (t.id == null) t.id = re();
|
|
402
402
|
else if (n.has(t.id)) continue;
|
|
403
403
|
n.add(t.id), r.push(t);
|
|
404
404
|
}
|
|
405
|
-
return r.length ? (
|
|
405
|
+
return r.length ? (w.value = [...w.value, ...r], T(), JSON.parse(JSON.stringify(r))) : [];
|
|
406
406
|
}, un = (e) => {
|
|
407
407
|
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(M.value.map((e) => e.id)), r = [];
|
|
408
408
|
for (let e of t) {
|
|
@@ -433,7 +433,7 @@ var b = {
|
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
435
|
let r = [];
|
|
436
|
-
return
|
|
436
|
+
return w.value = w.value.map((e) => {
|
|
437
437
|
let t = n.get(e.id);
|
|
438
438
|
if (!t) return e;
|
|
439
439
|
let i = {
|
|
@@ -441,7 +441,7 @@ var b = {
|
|
|
441
441
|
...t
|
|
442
442
|
};
|
|
443
443
|
return r.push(i), i;
|
|
444
|
-
}), r.length ? (
|
|
444
|
+
}), r.length ? (T(), JSON.parse(JSON.stringify(r))) : [];
|
|
445
445
|
}, fn = (e) => {
|
|
446
446
|
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && e.id != null);
|
|
447
447
|
if (!t.length) return [];
|
|
@@ -465,10 +465,10 @@ var b = {
|
|
|
465
465
|
return i.length ? (A.value = r, y("edge-update", JSON.parse(JSON.stringify(i))), JSON.parse(JSON.stringify(i))) : [];
|
|
466
466
|
}, pn = (e) => {
|
|
467
467
|
let t = e && typeof e == "object" ? e : null;
|
|
468
|
-
return k.value = [], j.value = /* @__PURE__ */ new Set(), A.value = /* @__PURE__ */ new Map(), t && Array.isArray(t.nodes) ? (
|
|
468
|
+
return k.value = [], j.value = /* @__PURE__ */ new Set(), A.value = /* @__PURE__ */ new Map(), t && Array.isArray(t.nodes) ? (w.value = JSON.parse(JSON.stringify(t.nodes)), T()) : (w.value = (Array.isArray(v.nodes) ? v.nodes : []).map((e) => ({ ...e })), Wt = w.value), R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B(), on(), en();
|
|
469
469
|
};
|
|
470
470
|
h(() => v.edges, (e) => {
|
|
471
|
-
|
|
471
|
+
Bt();
|
|
472
472
|
let t = Array.isArray(e) ? e : [], n = new Set(t.map((e) => e.id));
|
|
473
473
|
if (k.value.length) {
|
|
474
474
|
let e = k.value.filter((e) => !n.has(e.id));
|
|
@@ -523,16 +523,16 @@ var b = {
|
|
|
523
523
|
}), t;
|
|
524
524
|
}), hn = t(() => {
|
|
525
525
|
let e = /* @__PURE__ */ new Map();
|
|
526
|
-
for (let t of
|
|
526
|
+
for (let t of w.value) e.set(t.id, t);
|
|
527
527
|
return e;
|
|
528
528
|
}), P = (e) => hn.value.get(e), F = (e) => e.state != "none" && b[e.state] && b[e.state].color || "#00f0ff", gn = (e) => b[e.state] || b.normal, _n = (e) => e.type === "text", vn = (e, t) => {
|
|
529
529
|
let n = Number(e);
|
|
530
530
|
return Number.isFinite(n) && n > 0 ? n : t;
|
|
531
531
|
}, yn = (e) => {
|
|
532
|
-
let t = vn(e.width,
|
|
532
|
+
let t = vn(e.width, At), n = vn(e.height, At);
|
|
533
533
|
return {
|
|
534
|
-
sx: t /
|
|
535
|
-
sy: n /
|
|
534
|
+
sx: t / At,
|
|
535
|
+
sy: n / At
|
|
536
536
|
};
|
|
537
537
|
}, bn = (e) => {
|
|
538
538
|
let { sx: t, sy: n } = yn(e);
|
|
@@ -546,7 +546,7 @@ var b = {
|
|
|
546
546
|
}, Cn = (e) => _n(e) ? 4 : e.labelPosition === "top" ? -30 : e.labelPosition === "center" ? 0 : Sn(e), wn = (e) => {
|
|
547
547
|
let t = L(e);
|
|
548
548
|
if (_n(e) || !e.label) return t;
|
|
549
|
-
let n =
|
|
549
|
+
let n = Vt(e), r = Cn(e);
|
|
550
550
|
if (e.labelPosition === "top") {
|
|
551
551
|
let e = r - n - 4;
|
|
552
552
|
e < t.y && (t.height += t.y - e, t.y = e);
|
|
@@ -558,8 +558,8 @@ var b = {
|
|
|
558
558
|
}, Tn = (e) => e.borderColor !== void 0 || e.borderWidth !== void 0 || e.borderStyle !== void 0, I = (e) => {
|
|
559
559
|
let t = _n(e);
|
|
560
560
|
return {
|
|
561
|
-
w: vn(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) :
|
|
562
|
-
h: vn(e.height, t ? 26 :
|
|
561
|
+
w: vn(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) : At),
|
|
562
|
+
h: vn(e.height, t ? 26 : At)
|
|
563
563
|
};
|
|
564
564
|
}, L = (e) => {
|
|
565
565
|
let { w: t, h: n } = I(e);
|
|
@@ -573,22 +573,33 @@ var b = {
|
|
|
573
573
|
t(() => R.value.length === 1 ? R.value[0] : null), t(() => z.value.length === 1 ? z.value[0] : null);
|
|
574
574
|
let On = (e) => R.value.includes(e.id), kn = (e) => z.value.includes(e.id), B = () => {
|
|
575
575
|
y("selection-change", {
|
|
576
|
-
nodes:
|
|
576
|
+
nodes: w.value.filter((e) => R.value.includes(e.id)),
|
|
577
577
|
edges: M.value.filter((e) => z.value.includes(e.id))
|
|
578
578
|
});
|
|
579
|
-
}, An = t(() => v.config.
|
|
580
|
-
|
|
579
|
+
}, An = (e) => typeof e == "number" ? Number.isFinite(e) && e >= 0 ? Math.floor(e) : Infinity : typeof e == "string" && /^\d+$/.test(e.trim()) ? parseInt(e.trim(), 10) : Infinity, jn = t(() => An(v.config.maxSelectNodes)), Mn = t(() => An(v.config.maxSelectEdges)), V = (e, t, n) => {
|
|
580
|
+
let r = new Set(e), i = [];
|
|
581
|
+
for (let e of t) r.has(e) || (r.add(e), i.push(e));
|
|
582
|
+
if (n === Infinity) return [...e, ...i];
|
|
583
|
+
let a = Math.max(0, n - e.length);
|
|
584
|
+
return [...e, ...i.slice(0, a)];
|
|
585
|
+
};
|
|
586
|
+
h([jn, Mn], ([e, t]) => {
|
|
587
|
+
let n = !1;
|
|
588
|
+
R.value.length > e && (R.value = R.value.slice(0, e), n = !0), z.value.length > t && (z.value = z.value.slice(0, t), n = !0), n && B();
|
|
589
|
+
});
|
|
590
|
+
let Nn = t(() => v.config.selectedBorderColor || "#fbbf24"), Pn = (e, t) => {
|
|
591
|
+
if (!zn()) {
|
|
581
592
|
if (t && (t.ctrlKey || t.metaKey)) {
|
|
582
593
|
let t = R.value.indexOf(e.id);
|
|
583
|
-
t >= 0 ? R.value.splice(t, 1) : R.value.
|
|
594
|
+
t >= 0 ? R.value.splice(t, 1) : R.value = V(R.value, [e.id], jn.value);
|
|
584
595
|
} else {
|
|
585
596
|
let t = R.value.length === 1 && R.value[0] === e.id;
|
|
586
|
-
R.value = t ? [] : [e.id], z.value = [];
|
|
597
|
+
R.value = t ? [] : V([], [e.id], jn.value), z.value = [];
|
|
587
598
|
}
|
|
588
599
|
y("node-click", e), y("node-select", On(e) ? e : null), B();
|
|
589
600
|
}
|
|
590
|
-
},
|
|
591
|
-
if (
|
|
601
|
+
}, Fn = t(() => v.config.selectedLineColor || "#fbbf24"), In = (e, t) => {
|
|
602
|
+
if (zn()) return;
|
|
592
603
|
let n = mn.value[e.id], r = !!(n && n.merged && n.representative), i = r ? M.value.filter((e) => {
|
|
593
604
|
let t = mn.value[e.id];
|
|
594
605
|
return t && t.key === n.key;
|
|
@@ -596,71 +607,71 @@ var b = {
|
|
|
596
607
|
...e,
|
|
597
608
|
bundleEdges: i
|
|
598
609
|
} : e;
|
|
599
|
-
if (t && (t.ctrlKey || t.metaKey)) a.every((e) => z.value.includes(e)) ? z.value = z.value.filter((e) => !a.includes(e)) : z.value =
|
|
610
|
+
if (t && (t.ctrlKey || t.metaKey)) a.every((e) => z.value.includes(e)) ? z.value = z.value.filter((e) => !a.includes(e)) : z.value = V(z.value, a, Mn.value);
|
|
600
611
|
else {
|
|
601
612
|
let e = a.length === z.value.length && a.every((e) => z.value.includes(e));
|
|
602
|
-
z.value = e ? [] : a, R.value = [];
|
|
613
|
+
z.value = e ? [] : V([], a, Mn.value), R.value = [];
|
|
603
614
|
}
|
|
604
615
|
y("edge-select", kn(e) ? o : null), B();
|
|
605
|
-
},
|
|
606
|
-
|
|
607
|
-
},
|
|
616
|
+
}, Ln = 0, Rn = (e = 200) => {
|
|
617
|
+
Ln = performance.now() + e;
|
|
618
|
+
}, zn = () => performance.now() < Ln, Bn = () => {
|
|
608
619
|
R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B();
|
|
609
|
-
},
|
|
610
|
-
if (
|
|
620
|
+
}, Vn = (e) => {
|
|
621
|
+
if (zn()) return;
|
|
611
622
|
let t = e.target;
|
|
612
|
-
t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) ||
|
|
613
|
-
},
|
|
623
|
+
t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || Bn();
|
|
624
|
+
}, Hn = d({
|
|
614
625
|
width: 1e3,
|
|
615
626
|
height: 650
|
|
616
|
-
}),
|
|
627
|
+
}), Un = d(1), Wn = d(0), Gn = d(0), Kn = t(() => -Jn.value / 2 + Wn.value), qn = t(() => -Yn.value / 2 + Gn.value), Jn = t(() => v.width ?? Hn.value.width), Yn = t(() => v.height ?? Hn.value.height), Xn = null;
|
|
617
628
|
l(() => {
|
|
618
629
|
let e = O.value;
|
|
619
630
|
if (e) {
|
|
620
631
|
let t = e.getBoundingClientRect();
|
|
621
|
-
t.width > 0 && t.height > 0 && (
|
|
632
|
+
t.width > 0 && t.height > 0 && (Hn.value = {
|
|
622
633
|
width: t.width,
|
|
623
634
|
height: t.height
|
|
624
635
|
});
|
|
625
636
|
}
|
|
626
|
-
e && typeof ResizeObserver < "u" && (
|
|
637
|
+
e && typeof ResizeObserver < "u" && (Xn = new ResizeObserver(() => {
|
|
627
638
|
let t = e.getBoundingClientRect();
|
|
628
|
-
t.width > 0 && t.height > 0 && (
|
|
639
|
+
t.width > 0 && t.height > 0 && (Hn.value = {
|
|
629
640
|
width: t.width,
|
|
630
641
|
height: t.height
|
|
631
642
|
});
|
|
632
|
-
}),
|
|
643
|
+
}), Xn.observe(e));
|
|
633
644
|
}), c(() => {
|
|
634
|
-
|
|
645
|
+
Xn &&= (Xn.disconnect(), null), Lr &&= (cancelAnimationFrame(Lr), 0), q &&= (cancelAnimationFrame(q), 0), Z &&= (cancelAnimationFrame(Z), 0), si(), hr();
|
|
635
646
|
});
|
|
636
|
-
let
|
|
637
|
-
x0:
|
|
638
|
-
y0:
|
|
639
|
-
x1:
|
|
640
|
-
y1:
|
|
641
|
-
})),
|
|
642
|
-
let e =
|
|
643
|
-
return
|
|
647
|
+
let H = t(() => Jn.value / Un.value), U = t(() => Yn.value / Un.value), Zn = t(() => ({
|
|
648
|
+
x0: Kn.value - Nt,
|
|
649
|
+
y0: qn.value - Nt,
|
|
650
|
+
x1: Kn.value + H.value + Nt,
|
|
651
|
+
y1: qn.value + U.value + Nt
|
|
652
|
+
})), Qn = t(() => {
|
|
653
|
+
let e = Zn.value;
|
|
654
|
+
return w.value.filter((t) => {
|
|
644
655
|
let { w: n, h: r } = I(t);
|
|
645
656
|
return t.x + n / 2 >= e.x0 && t.x - n / 2 <= e.x1 && t.y + r / 2 >= e.y0 && t.y - r / 2 <= e.y1;
|
|
646
657
|
});
|
|
647
|
-
}),
|
|
648
|
-
let e =
|
|
658
|
+
}), W = t(() => {
|
|
659
|
+
let e = Zn.value;
|
|
649
660
|
return M.value.filter((t) => {
|
|
650
|
-
if (!
|
|
661
|
+
if (!Ci(t)) return !1;
|
|
651
662
|
let n = P(t.from), r = P(t.to);
|
|
652
663
|
if (!n || !r) return !1;
|
|
653
664
|
let i = I(n).w / 2, a = I(n).h / 2, o = I(r).w / 2, s = I(r).h / 2;
|
|
654
|
-
return Math.min(n.x - i, r.x - o) -
|
|
665
|
+
return Math.min(n.x - i, r.x - o) - Pt <= e.x1 && Math.max(n.x + i, r.x + o) + Pt >= e.x0 && Math.min(n.y - a, r.y - s) - Pt <= e.y1 && Math.max(n.y + a, r.y + s) + Pt >= e.y0;
|
|
655
666
|
});
|
|
656
|
-
}),
|
|
667
|
+
}), $n = (e) => {
|
|
657
668
|
if (v.config.enableZoom === !1) return;
|
|
658
669
|
e.preventDefault();
|
|
659
|
-
let t = O.value.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = n / t.width, a = r / t.height, o =
|
|
660
|
-
|
|
661
|
-
},
|
|
670
|
+
let t = O.value.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = n / t.width, a = r / t.height, o = H.value, s = U.value, c = e.deltaY > 0 ? .9 : 1.1, l = Math.min(Mt, Math.max(jt, Un.value * c)), u = Jn.value / l, d = Yn.value / l;
|
|
671
|
+
Wn.value += (o - u) * i, Gn.value += (s - d) * a, Un.value = l;
|
|
672
|
+
}, G = d(null), K = d(null), er = (e) => {
|
|
662
673
|
let t = O.value, n = t ? t.getBoundingClientRect() : null;
|
|
663
|
-
|
|
674
|
+
G.value = {
|
|
664
675
|
startX: e.clientX,
|
|
665
676
|
startY: e.clientY,
|
|
666
677
|
lastX: e.clientX,
|
|
@@ -668,9 +679,9 @@ var b = {
|
|
|
668
679
|
moved: !1,
|
|
669
680
|
rectWidth: n && n.width ? n.width : 0,
|
|
670
681
|
rectHeight: n && n.height ? n.height : 0
|
|
671
|
-
},
|
|
672
|
-
},
|
|
673
|
-
let t =
|
|
682
|
+
}, mr();
|
|
683
|
+
}, tr = (e) => {
|
|
684
|
+
let t = G.value, n = O.value;
|
|
674
685
|
if (!t || !n) return;
|
|
675
686
|
let r = t.rectWidth, i = t.rectHeight;
|
|
676
687
|
if (!r || !i) return;
|
|
@@ -680,13 +691,13 @@ var b = {
|
|
|
680
691
|
return;
|
|
681
692
|
}
|
|
682
693
|
let a = e.clientX - t.lastX, o = e.clientY - t.lastY;
|
|
683
|
-
t.lastX = e.clientX, t.lastY = e.clientY,
|
|
684
|
-
},
|
|
685
|
-
let e =
|
|
686
|
-
|
|
687
|
-
},
|
|
694
|
+
t.lastX = e.clientX, t.lastY = e.clientY, Wn.value -= a * (H.value / r), Gn.value -= o * (U.value / i);
|
|
695
|
+
}, nr = () => {
|
|
696
|
+
let e = G.value;
|
|
697
|
+
G.value = null, e && e.moved && Rn(), gr();
|
|
698
|
+
}, rr = (e) => {
|
|
688
699
|
let t = X(e);
|
|
689
|
-
|
|
700
|
+
K.value = {
|
|
690
701
|
start: {
|
|
691
702
|
x: t.x,
|
|
692
703
|
y: t.y
|
|
@@ -698,17 +709,17 @@ var b = {
|
|
|
698
709
|
startClientX: e.clientX,
|
|
699
710
|
startClientY: e.clientY,
|
|
700
711
|
moved: !1
|
|
701
|
-
},
|
|
702
|
-
},
|
|
703
|
-
let t =
|
|
712
|
+
}, mr();
|
|
713
|
+
}, ir = (e) => {
|
|
714
|
+
let t = K.value;
|
|
704
715
|
if (!t) return;
|
|
705
716
|
let n = X(e);
|
|
706
717
|
t.current = {
|
|
707
718
|
x: n.x,
|
|
708
719
|
y: n.y
|
|
709
720
|
}, !t.moved && Math.hypot(e.clientX - t.startClientX, e.clientY - t.startClientY) > 3 && (t.moved = !0);
|
|
710
|
-
},
|
|
711
|
-
let e =
|
|
721
|
+
}, ar = t(() => {
|
|
722
|
+
let e = K.value;
|
|
712
723
|
return e ? {
|
|
713
724
|
x: Math.min(e.start.x, e.current.x),
|
|
714
725
|
y: Math.min(e.start.y, e.current.y),
|
|
@@ -720,66 +731,62 @@ var b = {
|
|
|
720
731
|
width: 0,
|
|
721
732
|
height: 0
|
|
722
733
|
};
|
|
723
|
-
}),
|
|
724
|
-
let e =
|
|
725
|
-
if (
|
|
734
|
+
}), or = () => {
|
|
735
|
+
let e = K.value;
|
|
736
|
+
if (K.value = null, e && e.moved) {
|
|
726
737
|
let t = {
|
|
727
738
|
x: Math.min(e.start.x, e.current.x),
|
|
728
739
|
y: Math.min(e.start.y, e.current.y),
|
|
729
740
|
w: Math.abs(e.current.x - e.start.x),
|
|
730
741
|
h: Math.abs(e.current.y - e.start.y)
|
|
731
|
-
}, n =
|
|
742
|
+
}, n = w.value.filter((e) => {
|
|
732
743
|
let n = L(e), r = e.x + n.x, i = e.y + n.y;
|
|
733
744
|
return !(r + n.width < t.x || r > t.x + t.w || i + n.height < t.y || i > t.y + t.h);
|
|
734
745
|
});
|
|
735
|
-
|
|
736
|
-
let e = new Set(R.value);
|
|
737
|
-
n.forEach((t) => e.add(t.id)), R.value = [...e], B();
|
|
738
|
-
}
|
|
739
|
-
Fn();
|
|
746
|
+
n.length && (R.value = V(R.value, n.map((e) => e.id), jn.value), B()), Rn();
|
|
740
747
|
}
|
|
741
|
-
|
|
742
|
-
},
|
|
748
|
+
gr();
|
|
749
|
+
}, sr = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), cr = (e) => {
|
|
743
750
|
if (O.value) {
|
|
744
751
|
if (e.button === 1) {
|
|
745
752
|
if (v.config.enablePan === !1) return;
|
|
746
|
-
e.preventDefault(),
|
|
753
|
+
e.preventDefault(), er(e);
|
|
747
754
|
return;
|
|
748
755
|
}
|
|
749
|
-
if (e.button === 0 && !
|
|
756
|
+
if (e.button === 0 && !sr(e.target)) {
|
|
750
757
|
if (e.ctrlKey || e.metaKey) {
|
|
751
758
|
if (v.config.enableMarquee === !1) return;
|
|
752
|
-
e.preventDefault(),
|
|
759
|
+
e.preventDefault(), rr(e);
|
|
753
760
|
return;
|
|
754
761
|
}
|
|
755
|
-
v.config.enablePan !== !1 && (e.preventDefault(),
|
|
762
|
+
v.config.enablePan !== !1 && (e.preventDefault(), er(e));
|
|
756
763
|
}
|
|
757
764
|
}
|
|
758
|
-
},
|
|
759
|
-
|
|
760
|
-
let e =
|
|
761
|
-
|
|
762
|
-
},
|
|
763
|
-
|
|
764
|
-
}, ur = () => {
|
|
765
|
-
K && (cancelAnimationFrame(K), cr()), W.value && $n(), G.value && rr();
|
|
766
|
-
}, dr = () => {
|
|
767
|
-
or || (or = !0, window.addEventListener("mousemove", lr, !0), window.addEventListener("mouseup", ur, !0));
|
|
768
|
-
}, fr = () => {
|
|
769
|
-
or && (or = !1, window.removeEventListener("mousemove", lr, !0), window.removeEventListener("mouseup", ur, !0));
|
|
765
|
+
}, lr = !1, q = 0, ur = null, dr = () => {
|
|
766
|
+
q = 0;
|
|
767
|
+
let e = ur;
|
|
768
|
+
ur = null, e && (G.value ? tr(e) : K.value && ir(e));
|
|
769
|
+
}, fr = (e) => {
|
|
770
|
+
ur = e, q ||= requestAnimationFrame(dr);
|
|
770
771
|
}, pr = () => {
|
|
771
|
-
|
|
772
|
-
}, mr =
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
772
|
+
q && (cancelAnimationFrame(q), dr()), G.value && nr(), K.value && or();
|
|
773
|
+
}, mr = () => {
|
|
774
|
+
lr || (lr = !0, window.addEventListener("mousemove", fr, !0), window.addEventListener("mouseup", pr, !0));
|
|
775
|
+
}, hr = () => {
|
|
776
|
+
lr && (lr = !1, window.removeEventListener("mousemove", fr, !0), window.removeEventListener("mouseup", pr, !0));
|
|
777
|
+
}, gr = () => {
|
|
778
|
+
!G.value && !K.value && hr();
|
|
779
|
+
}, _r = t(() => {
|
|
780
|
+
if (J.value && J.value.side) return { cursor: Gr(J.value.side) };
|
|
781
|
+
if (K.value) return { cursor: "crosshair" };
|
|
782
|
+
if (G.value && G.value.moved) return { cursor: "grabbing" };
|
|
783
|
+
}), vr = t(() => v.config.showGrid !== !1), yr = t(() => v.config.gridColor || "#1a2240"), br = t(() => {
|
|
777
784
|
let e = Number(v.config.gridStep);
|
|
778
|
-
return (Number.isFinite(e) && e > 0 ? e : 40) /
|
|
779
|
-
}),
|
|
785
|
+
return (Number.isFinite(e) && e > 0 ? e : 40) / Un.value;
|
|
786
|
+
}), xr = t(() => {
|
|
780
787
|
let e = Number(v.config.gridOpacity);
|
|
781
788
|
return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : .5;
|
|
782
|
-
}),
|
|
789
|
+
}), Sr = t(() => {
|
|
783
790
|
let e = v.config.radialGradient && typeof v.config.radialGradient == "object" ? v.config.radialGradient : {}, t = Array.isArray(e.stops) && e.stops.length ? e.stops.filter((e) => e && e.color).map((e, t) => ({
|
|
784
791
|
offset: e.offset == null ? t === 0 ? "0%" : "100%" : e.offset,
|
|
785
792
|
color: e.color,
|
|
@@ -799,19 +806,19 @@ var b = {
|
|
|
799
806
|
r: e.r || "60%",
|
|
800
807
|
stops: n
|
|
801
808
|
};
|
|
802
|
-
}),
|
|
809
|
+
}), Cr = t(() => v.config.showCenterPoint === !0), wr = t(() => v.config.showEdgeTextBg === !0), Tr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), Er = t(() => v.config.showNodeHandles === !0), Dr = t(() => v.config.showStatusDot !== !1), Or = (e, t) => {
|
|
803
810
|
let n = Number(e);
|
|
804
811
|
return Number.isFinite(n) && n >= 0 ? n : t;
|
|
805
|
-
},
|
|
812
|
+
}, kr = t(() => {
|
|
806
813
|
let e = v.config.motionFx ?? v.config.fx;
|
|
807
|
-
return typeof e == "boolean" ? e : M.value.length <=
|
|
808
|
-
}),
|
|
814
|
+
return typeof e == "boolean" ? e : M.value.length <= Or(v.config.fxMotionMaxEdges, 200);
|
|
815
|
+
}), Ar = t(() => {
|
|
809
816
|
let e = v.config.glowFx ?? v.config.fx;
|
|
810
|
-
return typeof e == "boolean" ? e : M.value.length <=
|
|
811
|
-
}),
|
|
817
|
+
return typeof e == "boolean" ? e : M.value.length <= Or(v.config.fxGlowMaxEdges, 500);
|
|
818
|
+
}), jr = t(() => {
|
|
812
819
|
let e = v.config.breatheFx ?? v.config.fx;
|
|
813
|
-
return typeof e == "boolean" ? e :
|
|
814
|
-
}),
|
|
820
|
+
return typeof e == "boolean" ? e : w.value.length <= Or(v.config.fxBreatheMaxNodes, 300);
|
|
821
|
+
}), Mr = (e) => e.animated !== !1, Nr = (e) => e.borderColor || F(e) || "#94a3b8", Pr = (e) => e.borderWidth || 0, Fr = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, Ir = (e, t) => {
|
|
815
822
|
if (e.button !== 0 || !v.editable || v.config.nodeDraggable === !1) return;
|
|
816
823
|
e.stopPropagation();
|
|
817
824
|
let n = P(t), r = X(e);
|
|
@@ -838,44 +845,44 @@ var b = {
|
|
|
838
845
|
};
|
|
839
846
|
} else qt.value = null;
|
|
840
847
|
D.value = t, y("node-drag-start", n);
|
|
841
|
-
},
|
|
842
|
-
|
|
843
|
-
let e =
|
|
844
|
-
|
|
845
|
-
},
|
|
846
|
-
(J.value || D.value) && (
|
|
848
|
+
}, Lr = 0, Rr = null, zr = () => {
|
|
849
|
+
Lr = 0;
|
|
850
|
+
let e = Rr;
|
|
851
|
+
Rr = null, e && Vr(e);
|
|
852
|
+
}, Br = (e) => {
|
|
853
|
+
(J.value || D.value) && (Rr = {
|
|
847
854
|
clientX: e.clientX,
|
|
848
855
|
clientY: e.clientY
|
|
849
|
-
},
|
|
850
|
-
},
|
|
856
|
+
}, Lr ||= requestAnimationFrame(zr));
|
|
857
|
+
}, Vr = (e) => {
|
|
851
858
|
if (J.value) {
|
|
852
|
-
|
|
859
|
+
qr(e);
|
|
853
860
|
return;
|
|
854
861
|
}
|
|
855
862
|
if (!D.value) return;
|
|
856
863
|
let t = X(e);
|
|
857
|
-
!Yt && Jt && Math.hypot(e.clientX - Jt.x, e.clientY - Jt.y) > kt && (Yt = !0, !Xt && !R.value.includes(D.value) && (R.value = [D.value], z.value = [], y("node-select", P(D.value)), B()));
|
|
864
|
+
!Yt && Jt && Math.hypot(e.clientX - Jt.x, e.clientY - Jt.y) > kt && (Yt = !0, !Xt && !R.value.includes(D.value) && (R.value = V([], [D.value], jn.value), z.value = [], y("node-select", R.value.includes(D.value) ? P(D.value) : null), B()));
|
|
858
865
|
let n = qt.value;
|
|
859
866
|
if (n) {
|
|
860
867
|
let e = t.x - n.start.x, r = t.y - n.start.y;
|
|
861
|
-
|
|
868
|
+
w.value = w.value.map((t) => n.origins[t.id] ? {
|
|
862
869
|
...t,
|
|
863
870
|
x: n.origins[t.id].x + e,
|
|
864
871
|
y: n.origins[t.id].y + r
|
|
865
872
|
} : t);
|
|
866
|
-
} else
|
|
873
|
+
} else w.value = w.value.map((e) => e.id === D.value ? {
|
|
867
874
|
...e,
|
|
868
875
|
x: t.x - Kt.value.x,
|
|
869
876
|
y: t.y - Kt.value.y
|
|
870
877
|
} : e);
|
|
871
|
-
|
|
872
|
-
},
|
|
873
|
-
if (
|
|
874
|
-
|
|
878
|
+
T();
|
|
879
|
+
}, Hr = () => {
|
|
880
|
+
if (Lr && (cancelAnimationFrame(Lr), zr()), J.value) {
|
|
881
|
+
Jr();
|
|
875
882
|
return;
|
|
876
883
|
}
|
|
877
|
-
D.value && (Yt &&
|
|
878
|
-
}, J = d(null),
|
|
884
|
+
D.value && (Yt && Rn(), D.value = null, qt.value = null, Jt = null, Yt = !1, y("node-drag-end"));
|
|
885
|
+
}, J = d(null), Ur = (e, t, n) => Math.min(n, Math.max(t, e)), Wr = (e) => {
|
|
879
886
|
let t = L(e), n = t.x, r = t.y, i = t.x + t.width, a = t.y + t.height;
|
|
880
887
|
return [
|
|
881
888
|
{
|
|
@@ -919,7 +926,7 @@ var b = {
|
|
|
919
926
|
y: 0
|
|
920
927
|
}
|
|
921
928
|
];
|
|
922
|
-
},
|
|
929
|
+
}, Gr = (e) => e === "nw" || e === "se" ? "nwse-resize" : e === "ne" || e === "sw" ? "nesw-resize" : e === "n" || e === "s" ? "ns-resize" : "ew-resize", Kr = (e, t, n) => {
|
|
923
930
|
if (!v.editable || v.config.nodeResizable === !1 || !t) return;
|
|
924
931
|
let { w: r, h: i } = I(t);
|
|
925
932
|
J.value = {
|
|
@@ -930,7 +937,7 @@ var b = {
|
|
|
930
937
|
startW: r,
|
|
931
938
|
startH: i
|
|
932
939
|
}, y("node-resize-start", t);
|
|
933
|
-
},
|
|
940
|
+
}, qr = (e) => {
|
|
934
941
|
let t = J.value;
|
|
935
942
|
if (!t) return;
|
|
936
943
|
let n = P(t.id);
|
|
@@ -938,27 +945,27 @@ var b = {
|
|
|
938
945
|
let r = X(e), i = t.startW, a = t.startH, o = n.x, s = n.y;
|
|
939
946
|
if (t.anchorX !== null) {
|
|
940
947
|
let e = t.side.includes("e");
|
|
941
|
-
i =
|
|
948
|
+
i = Ur(e ? r.x - t.anchorX : t.anchorX - r.x, Ft, It), o = e ? t.anchorX + i / 2 : t.anchorX - i / 2;
|
|
942
949
|
}
|
|
943
950
|
if (t.anchorY !== null) {
|
|
944
951
|
let e = t.side.includes("s");
|
|
945
|
-
a =
|
|
952
|
+
a = Ur(e ? r.y - t.anchorY : t.anchorY - r.y, Lt, Rt), s = e ? t.anchorY + a / 2 : t.anchorY - a / 2;
|
|
946
953
|
}
|
|
947
|
-
|
|
954
|
+
w.value = w.value.map((e) => e.id === t.id ? {
|
|
948
955
|
...e,
|
|
949
956
|
x: o,
|
|
950
957
|
y: s,
|
|
951
958
|
width: i,
|
|
952
959
|
height: a
|
|
953
|
-
} : e),
|
|
954
|
-
},
|
|
960
|
+
} : e), T();
|
|
961
|
+
}, Jr = () => {
|
|
955
962
|
let e = J.value;
|
|
956
|
-
J.value = null, e && (
|
|
957
|
-
},
|
|
958
|
-
if (!
|
|
963
|
+
J.value = null, e && (Rn(), y("node-resize-end", P(e.id) || null));
|
|
964
|
+
}, Yr = t(() => v.editable && v.config.nodeResizable !== !1), Xr = t(() => {
|
|
965
|
+
if (!Yr.value) return null;
|
|
959
966
|
let e = R.value;
|
|
960
967
|
return e.length === 1 && P(e[0]) || null;
|
|
961
|
-
}), Y = d(null),
|
|
968
|
+
}), Y = d(null), Zr = (e) => {
|
|
962
969
|
let t = L(e);
|
|
963
970
|
return [
|
|
964
971
|
{
|
|
@@ -982,7 +989,7 @@ var b = {
|
|
|
982
989
|
y: 0
|
|
983
990
|
}
|
|
984
991
|
];
|
|
985
|
-
},
|
|
992
|
+
}, Qr = (e, t) => {
|
|
986
993
|
let n = O.value;
|
|
987
994
|
if (!n) return null;
|
|
988
995
|
let r = e, i = t;
|
|
@@ -996,7 +1003,7 @@ var b = {
|
|
|
996
1003
|
x: s.x,
|
|
997
1004
|
y: s.y
|
|
998
1005
|
};
|
|
999
|
-
},
|
|
1006
|
+
}, $r = (e, t) => {
|
|
1000
1007
|
let n = O.value;
|
|
1001
1008
|
if (!n) return null;
|
|
1002
1009
|
let r = n.createSVGPoint();
|
|
@@ -1008,10 +1015,10 @@ var b = {
|
|
|
1008
1015
|
x: a.x,
|
|
1009
1016
|
y: a.y
|
|
1010
1017
|
};
|
|
1011
|
-
}, X = (e) =>
|
|
1018
|
+
}, X = (e) => Qr(e) ?? {
|
|
1012
1019
|
x: 0,
|
|
1013
1020
|
y: 0
|
|
1014
|
-
},
|
|
1021
|
+
}, ei = (e, t, n) => {
|
|
1015
1022
|
let r = P(t);
|
|
1016
1023
|
if (!r || !O.value) return;
|
|
1017
1024
|
let i = X(e);
|
|
@@ -1027,24 +1034,24 @@ var b = {
|
|
|
1027
1034
|
try {
|
|
1028
1035
|
e.target.setPointerCapture?.(e.pointerId);
|
|
1029
1036
|
} catch {}
|
|
1030
|
-
|
|
1031
|
-
}, Z = 0,
|
|
1037
|
+
oi();
|
|
1038
|
+
}, Z = 0, ti = null, ni = () => {
|
|
1032
1039
|
Z = 0;
|
|
1033
|
-
let e =
|
|
1034
|
-
|
|
1035
|
-
},
|
|
1036
|
-
Y.value && (
|
|
1040
|
+
let e = ti;
|
|
1041
|
+
ti = null, e && Y.value && li(e);
|
|
1042
|
+
}, ri = (e) => {
|
|
1043
|
+
Y.value && (ti = {
|
|
1037
1044
|
clientX: e.clientX,
|
|
1038
1045
|
clientY: e.clientY
|
|
1039
|
-
}, Z ||= requestAnimationFrame(
|
|
1040
|
-
},
|
|
1041
|
-
Z && (cancelAnimationFrame(Z),
|
|
1042
|
-
},
|
|
1043
|
-
|
|
1044
|
-
},
|
|
1045
|
-
|
|
1046
|
-
},
|
|
1047
|
-
let r =
|
|
1046
|
+
}, Z ||= requestAnimationFrame(ni));
|
|
1047
|
+
}, ii = () => {
|
|
1048
|
+
Z && (cancelAnimationFrame(Z), ni()), Y.value && ui();
|
|
1049
|
+
}, ai = !1, oi = () => {
|
|
1050
|
+
ai || (ai = !0, window.addEventListener("mousemove", ri, !0), window.addEventListener("mouseup", ii, !0));
|
|
1051
|
+
}, si = () => {
|
|
1052
|
+
ai && (ai = !1, window.removeEventListener("mousemove", ri, !0), window.removeEventListener("mouseup", ii, !0));
|
|
1053
|
+
}, ci = (e, t, n) => {
|
|
1054
|
+
let r = w.value;
|
|
1048
1055
|
for (let i = r.length - 1; i >= 0; i--) {
|
|
1049
1056
|
let a = r[i];
|
|
1050
1057
|
if (a.id === n) continue;
|
|
@@ -1052,15 +1059,15 @@ var b = {
|
|
|
1052
1059
|
if (e >= a.x + o.x - 2 && e <= a.x + o.x + o.width + 2 && t >= a.y + o.y - 2 && t <= a.y + o.y + o.height + 2) return a;
|
|
1053
1060
|
}
|
|
1054
1061
|
return null;
|
|
1055
|
-
},
|
|
1062
|
+
}, li = (e) => {
|
|
1056
1063
|
let t = Y.value;
|
|
1057
1064
|
if (!t) return;
|
|
1058
1065
|
let n = X(e);
|
|
1059
1066
|
t.px = n.x, t.py = n.y;
|
|
1060
|
-
let r =
|
|
1067
|
+
let r = ci(n.x, n.y, t.fromId);
|
|
1061
1068
|
t.overId = r ? r.id : null;
|
|
1062
|
-
},
|
|
1063
|
-
|
|
1069
|
+
}, ui = () => {
|
|
1070
|
+
si();
|
|
1064
1071
|
let e = Y.value;
|
|
1065
1072
|
if (Y.value = null, !e || !e.overId || e.overId === e.fromId) return;
|
|
1066
1073
|
let t = {
|
|
@@ -1072,7 +1079,7 @@ var b = {
|
|
|
1072
1079
|
toAnchor: "edge"
|
|
1073
1080
|
};
|
|
1074
1081
|
k.value.push(t), y("edge-create", t);
|
|
1075
|
-
},
|
|
1082
|
+
}, di = (e, t, n) => {
|
|
1076
1083
|
let r = e.x, i = e.y, a = t.x - r, o = t.y - i, { w: s, h: c } = I(e);
|
|
1077
1084
|
if (!n || n === "center" || a === 0 && o === 0) return {
|
|
1078
1085
|
x: r,
|
|
@@ -1083,7 +1090,7 @@ var b = {
|
|
|
1083
1090
|
x: r + a * p,
|
|
1084
1091
|
y: i + o * p
|
|
1085
1092
|
};
|
|
1086
|
-
},
|
|
1093
|
+
}, fi = t(() => {
|
|
1087
1094
|
let e = /* @__PURE__ */ new Map();
|
|
1088
1095
|
M.value.forEach((t) => {
|
|
1089
1096
|
let n = mn.value[t.id];
|
|
@@ -1115,12 +1122,12 @@ var b = {
|
|
|
1115
1122
|
bulge: Math.min(l * .15, 50)
|
|
1116
1123
|
};
|
|
1117
1124
|
}), t;
|
|
1118
|
-
}),
|
|
1119
|
-
let t = mn.value[e.id], n = t &&
|
|
1125
|
+
}), pi = (e) => {
|
|
1126
|
+
let t = mn.value[e.id], n = t && fi.value[t.key];
|
|
1120
1127
|
if (!n) return null;
|
|
1121
1128
|
let r = P(e.from), i = P(e.to);
|
|
1122
1129
|
if (!r || !i) return null;
|
|
1123
|
-
let a = n.slots[e.id] || 0, o = a * n.gap, s =
|
|
1130
|
+
let a = n.slots[e.id] || 0, o = a * n.gap, s = di(r, i, e.fromAnchor), c = di(i, r, e.toAnchor);
|
|
1124
1131
|
return {
|
|
1125
1132
|
frame: n,
|
|
1126
1133
|
slot: a,
|
|
@@ -1133,8 +1140,8 @@ var b = {
|
|
|
1133
1140
|
y: c.y + n.ny * o
|
|
1134
1141
|
}
|
|
1135
1142
|
};
|
|
1136
|
-
},
|
|
1137
|
-
let t =
|
|
1143
|
+
}, mi = (e) => {
|
|
1144
|
+
let t = pi(e);
|
|
1138
1145
|
if (!t) return "";
|
|
1139
1146
|
let { from: n, to: r, frame: i, slot: a } = t, o = a * i.gap;
|
|
1140
1147
|
if (E.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
|
|
@@ -1148,8 +1155,8 @@ var b = {
|
|
|
1148
1155
|
}
|
|
1149
1156
|
let s = (n.x + r.x) / 2 + i.nx * i.bulge, c = (n.y + r.y) / 2 + i.ny * i.bulge;
|
|
1150
1157
|
return `M ${n.x} ${n.y} Q ${s} ${c} ${r.x} ${r.y}`;
|
|
1151
|
-
},
|
|
1152
|
-
let n =
|
|
1158
|
+
}, hi = (e, t) => {
|
|
1159
|
+
let n = pi(e);
|
|
1153
1160
|
if (!n) return {
|
|
1154
1161
|
x: 0,
|
|
1155
1162
|
y: 0
|
|
@@ -1190,19 +1197,19 @@ var b = {
|
|
|
1190
1197
|
x: (1 - t) * (1 - t) * r.x + 2 * (1 - t) * t * c + t * t * i.x,
|
|
1191
1198
|
y: (1 - t) * (1 - t) * r.y + 2 * (1 - t) * t * l + t * t * i.y
|
|
1192
1199
|
};
|
|
1193
|
-
},
|
|
1200
|
+
}, gi = t(() => Y.value ? P(Y.value.fromId) : null), _i = t(() => Y.value && Y.value.overId ? P(Y.value.overId) : null), vi = t(() => gi.value ? F(gi.value) : "#00f0ff"), yi = t(() => {
|
|
1194
1201
|
let e = Y.value;
|
|
1195
1202
|
if (!e) return {
|
|
1196
1203
|
x: 0,
|
|
1197
1204
|
y: 0
|
|
1198
1205
|
};
|
|
1199
|
-
let t =
|
|
1200
|
-
return t &&
|
|
1206
|
+
let t = _i.value;
|
|
1207
|
+
return t && gi.value ? di(t, gi.value, "edge") : {
|
|
1201
1208
|
x: e.px,
|
|
1202
1209
|
y: e.py
|
|
1203
1210
|
};
|
|
1204
|
-
}),
|
|
1205
|
-
let e =
|
|
1211
|
+
}), bi = t(() => {
|
|
1212
|
+
let e = _i.value;
|
|
1206
1213
|
if (!e) return null;
|
|
1207
1214
|
let t = L(e);
|
|
1208
1215
|
return {
|
|
@@ -1211,7 +1218,7 @@ var b = {
|
|
|
1211
1218
|
w: t.width + 8,
|
|
1212
1219
|
h: t.height + 8
|
|
1213
1220
|
};
|
|
1214
|
-
}),
|
|
1221
|
+
}), xi = (e) => {
|
|
1215
1222
|
let t = e.nodeIds.map((e) => P(e)).filter(Boolean);
|
|
1216
1223
|
if (t.length === 0) return null;
|
|
1217
1224
|
let n = e.padding, r = Math.min(...t.map((e) => e.x)) - n, i = Math.min(...t.map((e) => e.y)) - n, a = Math.max(...t.map((e) => e.x)) + n, o = Math.max(...t.map((e) => e.y)) + n;
|
|
@@ -1221,54 +1228,54 @@ var b = {
|
|
|
1221
1228
|
width: a - r,
|
|
1222
1229
|
height: o - i
|
|
1223
1230
|
};
|
|
1224
|
-
},
|
|
1231
|
+
}, Si = t(() => v.groups.map((e) => ({
|
|
1225
1232
|
...e,
|
|
1226
|
-
rect:
|
|
1227
|
-
})).filter((e) => e.rect)), Q = (e) => kn(e) ?
|
|
1233
|
+
rect: xi(e)
|
|
1234
|
+
})).filter((e) => e.rect)), Q = (e) => kn(e) ? Fn.value : (P(e.from), e.centerText && e.centerText.color || "#00f0ff"), Ci = (e) => {
|
|
1228
1235
|
let t = mn.value[e.id];
|
|
1229
1236
|
return !!t && !t.hidden;
|
|
1230
|
-
},
|
|
1237
|
+
}, wi = t(() => [...new Set(M.value.map(Q))].map((e) => ({
|
|
1231
1238
|
key: String(e).replace("#", ""),
|
|
1232
1239
|
color: e
|
|
1233
|
-
}))),
|
|
1240
|
+
}))), Ti = (e) => {
|
|
1234
1241
|
let t = e.endMarker;
|
|
1235
1242
|
if (!t || t === "none") return "";
|
|
1236
1243
|
let n = Q(e) || "#00f0ff", r = String(n).replace("#", "");
|
|
1237
1244
|
return `url(#${t === "dot" ? "edge-dot" : "edge-arrow"}-${r})`;
|
|
1238
|
-
},
|
|
1245
|
+
}, Ei = /* @__PURE__ */ new Map(), Di = {
|
|
1239
1246
|
nodes: null,
|
|
1240
1247
|
edges: null,
|
|
1241
1248
|
mode: null,
|
|
1242
1249
|
epoch: -1
|
|
1243
|
-
},
|
|
1244
|
-
let e =
|
|
1245
|
-
(e.nodes !==
|
|
1246
|
-
nodes:
|
|
1250
|
+
}, Oi = () => {
|
|
1251
|
+
let e = Di;
|
|
1252
|
+
(e.nodes !== w.value || e.edges !== M.value || e.mode !== E.value || e.epoch !== zt) && (Di = {
|
|
1253
|
+
nodes: w.value,
|
|
1247
1254
|
edges: M.value,
|
|
1248
1255
|
mode: E.value,
|
|
1249
|
-
epoch:
|
|
1250
|
-
},
|
|
1256
|
+
epoch: zt
|
|
1257
|
+
}, Ei = /* @__PURE__ */ new Map());
|
|
1251
1258
|
}, $ = (e) => {
|
|
1252
|
-
|
|
1253
|
-
let t =
|
|
1254
|
-
return t === void 0 && (t =
|
|
1255
|
-
},
|
|
1259
|
+
Oi();
|
|
1260
|
+
let t = Ei.get(e.id);
|
|
1261
|
+
return t === void 0 && (t = mi(e), Ei.set(e.id, t)), t;
|
|
1262
|
+
}, ki = (e, t = 1) => `${2 / e.speed * t}s`, Ai = (e) => `${3 / e.speed}s`, ji = (e) => x(e).text, Mi = (e) => !!e && String(x(e).text ?? "").trim() !== "", Ni = (e, t) => {
|
|
1256
1263
|
if (!e) return null;
|
|
1257
|
-
let n =
|
|
1264
|
+
let n = x(e), r = Number(t.fontSize) || Number(n.fontSize) || 8, i = String(n.text ?? ""), a = 0;
|
|
1258
1265
|
for (let e of i) a += e.charCodeAt(0) > 11904 ? 1 : .62;
|
|
1259
1266
|
return {
|
|
1260
1267
|
w: Math.max(14, a * r + 8),
|
|
1261
1268
|
h: Math.max(12, r + 6)
|
|
1262
1269
|
};
|
|
1263
|
-
},
|
|
1264
|
-
let n =
|
|
1270
|
+
}, Pi = (e, t) => {
|
|
1271
|
+
let n = hi(e, Math.max(0, t - .005)), r = hi(e, Math.min(1, t + .005));
|
|
1265
1272
|
return Math.atan2(r.y - n.y, r.x - n.x) * 180 / Math.PI;
|
|
1266
|
-
},
|
|
1273
|
+
}, Fi = (e) => {
|
|
1267
1274
|
let t = e % 180;
|
|
1268
1275
|
return t > 90 && (t -= 180), t < -90 && (t += 180), t;
|
|
1269
|
-
},
|
|
1276
|
+
}, Ii = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(x(e).rotation || 0) + (n || 0)})`, Li = t(() => {
|
|
1270
1277
|
let e = [];
|
|
1271
|
-
for (let t of
|
|
1278
|
+
for (let t of W.value) {
|
|
1272
1279
|
let n = mn.value[t.id];
|
|
1273
1280
|
if (!n) continue;
|
|
1274
1281
|
let r = n.merged && n.representative, i = !n.merged && (t.fromText || t.centerText || t.toText);
|
|
@@ -1279,15 +1286,15 @@ var b = {
|
|
|
1279
1286
|
edge: t,
|
|
1280
1287
|
info: n,
|
|
1281
1288
|
color: a && ie[a.type] || "#00f0ff",
|
|
1282
|
-
start:
|
|
1283
|
-
center:
|
|
1284
|
-
end:
|
|
1285
|
-
startAngle:
|
|
1286
|
-
centerAngle:
|
|
1287
|
-
endAngle:
|
|
1288
|
-
fromBox:
|
|
1289
|
-
centerBox:
|
|
1290
|
-
toBox:
|
|
1289
|
+
start: hi(t, .28),
|
|
1290
|
+
center: hi(t, .5),
|
|
1291
|
+
end: hi(t, .72),
|
|
1292
|
+
startAngle: Fi(Pi(t, .28)),
|
|
1293
|
+
centerAngle: Fi(Pi(t, .5)),
|
|
1294
|
+
endAngle: Fi(Pi(t, .72)),
|
|
1295
|
+
fromBox: Ni(t.fromText, t),
|
|
1296
|
+
centerBox: Ni(t.centerText, t),
|
|
1297
|
+
toBox: Ni(t.toText, t)
|
|
1291
1298
|
});
|
|
1292
1299
|
}
|
|
1293
1300
|
return e;
|
|
@@ -1301,29 +1308,29 @@ var b = {
|
|
|
1301
1308
|
addEdges: un,
|
|
1302
1309
|
updateNodes: dn,
|
|
1303
1310
|
updateEdges: fn,
|
|
1304
|
-
clientToSvg:
|
|
1305
|
-
svgToClient:
|
|
1311
|
+
clientToSvg: Qr,
|
|
1312
|
+
svgToClient: $r
|
|
1306
1313
|
}), (t, c) => (u(), r("svg", {
|
|
1307
1314
|
ref_key: "svgRef",
|
|
1308
1315
|
ref: O,
|
|
1309
1316
|
class: "topology-svg",
|
|
1310
|
-
style: s(
|
|
1311
|
-
viewBox: `${
|
|
1312
|
-
onMousedown:
|
|
1313
|
-
onMousemove:
|
|
1314
|
-
onMouseup:
|
|
1315
|
-
onMouseleave:
|
|
1316
|
-
onClick:
|
|
1317
|
-
onWheel: g(
|
|
1317
|
+
style: s(_r.value),
|
|
1318
|
+
viewBox: `${Kn.value} ${qn.value} ${H.value} ${U.value}`,
|
|
1319
|
+
onMousedown: cr,
|
|
1320
|
+
onMousemove: Br,
|
|
1321
|
+
onMouseup: Hr,
|
|
1322
|
+
onMouseleave: Hr,
|
|
1323
|
+
onClick: Vn,
|
|
1324
|
+
onWheel: g($n, ["prevent"])
|
|
1318
1325
|
}, [
|
|
1319
1326
|
i("defs", null, [
|
|
1320
1327
|
c[3] ||= a("<filter id=\"glow-core\" x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"3\" result=\"blur\"></feGaussianBlur><feMerge><feMergeNode in=\"blur\"></feMergeNode><feMergeNode in=\"SourceGraphic\"></feMergeNode></feMerge></filter><filter id=\"glow-strong\" x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"6\" result=\"blur\"></feGaussianBlur><feMerge><feMergeNode in=\"blur\"></feMergeNode><feMergeNode in=\"blur\"></feMergeNode><feMergeNode in=\"SourceGraphic\"></feMergeNode></feMerge></filter>", 2),
|
|
1321
1328
|
i("radialGradient", {
|
|
1322
1329
|
id: "bg-grid",
|
|
1323
|
-
cx:
|
|
1324
|
-
cy:
|
|
1325
|
-
r:
|
|
1326
|
-
}, [(u(!0), r(e, null, f(
|
|
1330
|
+
cx: Sr.value.cx,
|
|
1331
|
+
cy: Sr.value.cy,
|
|
1332
|
+
r: Sr.value.r
|
|
1333
|
+
}, [(u(!0), r(e, null, f(Sr.value.stops, (e, t) => (u(), r("stop", {
|
|
1327
1334
|
key: `bg-stop-${t}`,
|
|
1328
1335
|
offset: e.offset,
|
|
1329
1336
|
"stop-color": e.color,
|
|
@@ -1350,7 +1357,7 @@ var b = {
|
|
|
1350
1357
|
}, null, 8, de)
|
|
1351
1358
|
], 8, ce))), 128)),
|
|
1352
1359
|
c[4] ||= a("<linearGradient id=\"flow-grad-1\" gradientUnits=\"userSpaceOnUse\"><stop offset=\"0%\" stop-color=\"#00f0ff\" stop-opacity=\"0\"></stop><stop offset=\"40%\" stop-color=\"#00f0ff\" stop-opacity=\"1\"></stop><stop offset=\"60%\" stop-color=\"#00f0ff\" stop-opacity=\"1\"></stop><stop offset=\"100%\" stop-color=\"#00f0ff\" stop-opacity=\"0\"></stop></linearGradient>", 1),
|
|
1353
|
-
(u(!0), r(e, null, f(
|
|
1360
|
+
(u(!0), r(e, null, f(wi.value, (e) => (u(), r("marker", {
|
|
1354
1361
|
key: `m-arrow-${e.key}`,
|
|
1355
1362
|
id: `edge-arrow-${e.key}`,
|
|
1356
1363
|
viewBox: "0 0 10 10",
|
|
@@ -1364,7 +1371,7 @@ var b = {
|
|
|
1364
1371
|
d: "M1,2.5 L9,5 L1,7.5 Z",
|
|
1365
1372
|
fill: e.color
|
|
1366
1373
|
}, null, 8, pe)], 8, fe))), 128)),
|
|
1367
|
-
(u(!0), r(e, null, f(
|
|
1374
|
+
(u(!0), r(e, null, f(wi.value, (e) => (u(), r("marker", {
|
|
1368
1375
|
key: `m-dot-${e.key}`,
|
|
1369
1376
|
id: `edge-dot-${e.key}`,
|
|
1370
1377
|
viewBox: "0 0 10 10",
|
|
@@ -1382,31 +1389,31 @@ var b = {
|
|
|
1382
1389
|
}, null, 8, he)], 8, me))), 128))
|
|
1383
1390
|
]),
|
|
1384
1391
|
i("rect", {
|
|
1385
|
-
width:
|
|
1386
|
-
height:
|
|
1387
|
-
x:
|
|
1388
|
-
y:
|
|
1392
|
+
width: H.value,
|
|
1393
|
+
height: U.value,
|
|
1394
|
+
x: Kn.value,
|
|
1395
|
+
y: qn.value,
|
|
1389
1396
|
fill: "url(#bg-grid)"
|
|
1390
1397
|
}, null, 8, ge),
|
|
1391
|
-
|
|
1398
|
+
vr.value ? (u(), r(e, { key: 0 }, [i("pattern", {
|
|
1392
1399
|
id: "grid",
|
|
1393
|
-
width:
|
|
1394
|
-
height:
|
|
1400
|
+
width: br.value,
|
|
1401
|
+
height: br.value,
|
|
1395
1402
|
patternUnits: "userSpaceOnUse"
|
|
1396
1403
|
}, [i("path", {
|
|
1397
|
-
d: `M ${
|
|
1404
|
+
d: `M ${br.value} 0 L 0 0 0 ${br.value}`,
|
|
1398
1405
|
fill: "none",
|
|
1399
|
-
stroke:
|
|
1406
|
+
stroke: yr.value,
|
|
1400
1407
|
"stroke-width": "0.5"
|
|
1401
1408
|
}, null, 8, ve)], 8, _e), i("rect", {
|
|
1402
|
-
width:
|
|
1403
|
-
height:
|
|
1404
|
-
x:
|
|
1405
|
-
y:
|
|
1409
|
+
width: H.value,
|
|
1410
|
+
height: U.value,
|
|
1411
|
+
x: Kn.value,
|
|
1412
|
+
y: qn.value,
|
|
1406
1413
|
fill: "url(#grid)",
|
|
1407
|
-
opacity:
|
|
1414
|
+
opacity: xr.value
|
|
1408
1415
|
}, null, 8, ye)], 64)) : n("", !0),
|
|
1409
|
-
|
|
1416
|
+
Cr.value ? (u(), r("g", be, [...c[5] ||= [
|
|
1410
1417
|
i("line", {
|
|
1411
1418
|
x1: "-22",
|
|
1412
1419
|
y1: "0",
|
|
@@ -1438,7 +1445,7 @@ var b = {
|
|
|
1438
1445
|
opacity: "0.8"
|
|
1439
1446
|
}, null, -1)
|
|
1440
1447
|
]])) : n("", !0),
|
|
1441
|
-
(u(!0), r(e, null, f(
|
|
1448
|
+
(u(!0), r(e, null, f(Si.value, (e) => (u(), r("g", { key: e.id }, [
|
|
1442
1449
|
i("rect", {
|
|
1443
1450
|
x: e.rect.x,
|
|
1444
1451
|
y: e.rect.y,
|
|
@@ -1500,16 +1507,16 @@ var b = {
|
|
|
1500
1507
|
"letter-spacing": "0.5"
|
|
1501
1508
|
}, m(e.label), 9, De)
|
|
1502
1509
|
]))), 128)),
|
|
1503
|
-
(u(!0), r(e, null, f(
|
|
1510
|
+
(u(!0), r(e, null, f(W.value, (e) => (u(), r("path", {
|
|
1504
1511
|
key: `base-${e.id}`,
|
|
1505
1512
|
d: $(e),
|
|
1506
1513
|
fill: "none",
|
|
1507
1514
|
stroke: "#1a2744",
|
|
1508
1515
|
"stroke-width": "2",
|
|
1509
1516
|
"stroke-linecap": "round",
|
|
1510
|
-
"marker-end":
|
|
1517
|
+
"marker-end": Ti(e)
|
|
1511
1518
|
}, null, 8, Oe))), 128)),
|
|
1512
|
-
(u(!0), r(e, null, f(
|
|
1519
|
+
(u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [Ar.value ? (u(), r("path", {
|
|
1513
1520
|
key: 0,
|
|
1514
1521
|
d: $(t),
|
|
1515
1522
|
fill: "none",
|
|
@@ -1519,16 +1526,16 @@ var b = {
|
|
|
1519
1526
|
opacity: "0.15",
|
|
1520
1527
|
filter: "url(#glow-strong)"
|
|
1521
1528
|
}, null, 8, ke)) : n("", !0)], 64))), 128)),
|
|
1522
|
-
(u(!0), r(e, null, f(
|
|
1529
|
+
(u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [kn(t) ? (u(), r("path", {
|
|
1523
1530
|
key: 0,
|
|
1524
1531
|
d: $(t),
|
|
1525
1532
|
fill: "none",
|
|
1526
|
-
stroke:
|
|
1533
|
+
stroke: Fn.value,
|
|
1527
1534
|
"stroke-width": "4",
|
|
1528
1535
|
opacity: "0.35",
|
|
1529
1536
|
filter: "url(#glow-strong)"
|
|
1530
1537
|
}, null, 8, Ae)) : n("", !0)], 64))), 128)),
|
|
1531
|
-
(u(!0), r(e, null, f(
|
|
1538
|
+
(u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [kr.value && Mr(t) ? (u(), r("g", je, [
|
|
1532
1539
|
i("path", {
|
|
1533
1540
|
d: $(t),
|
|
1534
1541
|
fill: "none",
|
|
@@ -1541,7 +1548,7 @@ var b = {
|
|
|
1541
1548
|
attributeName: "stroke-dashoffset",
|
|
1542
1549
|
from: "0",
|
|
1543
1550
|
to: "-52",
|
|
1544
|
-
dur:
|
|
1551
|
+
dur: ki(t),
|
|
1545
1552
|
repeatCount: "indefinite"
|
|
1546
1553
|
}, null, 8, Ne)], 8, Me),
|
|
1547
1554
|
i("path", {
|
|
@@ -1556,7 +1563,7 @@ var b = {
|
|
|
1556
1563
|
attributeName: "stroke-dashoffset",
|
|
1557
1564
|
from: "-30",
|
|
1558
1565
|
to: "-82",
|
|
1559
|
-
dur:
|
|
1566
|
+
dur: ki(t, 1.3),
|
|
1560
1567
|
repeatCount: "indefinite"
|
|
1561
1568
|
}, null, 8, Fe)], 8, Pe),
|
|
1562
1569
|
i("path", {
|
|
@@ -1572,18 +1579,18 @@ var b = {
|
|
|
1572
1579
|
attributeName: "stroke-dashoffset",
|
|
1573
1580
|
from: "0",
|
|
1574
1581
|
to: "-84",
|
|
1575
|
-
dur:
|
|
1582
|
+
dur: ki(t, .8),
|
|
1576
1583
|
repeatCount: "indefinite"
|
|
1577
1584
|
}, null, 8, Le)], 8, Ie)
|
|
1578
1585
|
])) : n("", !0)], 64))), 128)),
|
|
1579
|
-
(u(!0), r(e, null, f(
|
|
1586
|
+
(u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [kr.value && Mr(t) ? (u(), r("g", Re, [i("circle", {
|
|
1580
1587
|
r: "3",
|
|
1581
1588
|
fill: Q(t),
|
|
1582
1589
|
opacity: "0.9",
|
|
1583
1590
|
filter: "url(#glow-core)"
|
|
1584
1591
|
}, [i("animateMotion", {
|
|
1585
1592
|
path: $(t),
|
|
1586
|
-
dur:
|
|
1593
|
+
dur: Ai(t),
|
|
1587
1594
|
repeatCount: "indefinite"
|
|
1588
1595
|
}, null, 8, Be)], 8, ze), i("circle", {
|
|
1589
1596
|
r: "8",
|
|
@@ -1592,17 +1599,17 @@ var b = {
|
|
|
1592
1599
|
filter: "url(#glow-strong)"
|
|
1593
1600
|
}, [i("animateMotion", {
|
|
1594
1601
|
path: $(t),
|
|
1595
|
-
dur:
|
|
1602
|
+
dur: Ai(t),
|
|
1596
1603
|
repeatCount: "indefinite"
|
|
1597
1604
|
}, null, 8, He)], 8, Ve)])) : n("", !0)], 64))), 128)),
|
|
1598
|
-
(u(!0), r(e, null, f(
|
|
1605
|
+
(u(!0), r(e, null, f(Li.value, (t) => (u(), r(e, { key: `text-${t.id}` }, [t.info.merged && t.info.representative ? (u(), r("g", {
|
|
1599
1606
|
key: 0,
|
|
1600
1607
|
transform: `translate(${t.center.x}, ${t.center.y}) rotate(${t.centerAngle})`
|
|
1601
1608
|
}, [i("rect", {
|
|
1602
1609
|
x: "-7",
|
|
1603
|
-
y: -
|
|
1610
|
+
y: -S(t.edge, null) / 2,
|
|
1604
1611
|
width: 14,
|
|
1605
|
-
height:
|
|
1612
|
+
height: S(t.edge, null),
|
|
1606
1613
|
rx: "2",
|
|
1607
1614
|
fill: "#FFFFFF",
|
|
1608
1615
|
opacity: "0.9",
|
|
@@ -1612,94 +1619,94 @@ var b = {
|
|
|
1612
1619
|
y: "0",
|
|
1613
1620
|
"dominant-baseline": "central",
|
|
1614
1621
|
"text-anchor": "middle",
|
|
1615
|
-
"font-size":
|
|
1616
|
-
fill:
|
|
1622
|
+
"font-size": S(t.edge, null),
|
|
1623
|
+
fill: C(t.edge, null),
|
|
1617
1624
|
"font-family": "'SF Mono', monospace",
|
|
1618
1625
|
opacity: "1"
|
|
1619
1626
|
}, m(t.info.count), 9, Ge)], 8, Ue)) : t.info.merged ? n("", !0) : (u(), r("g", Ke, [
|
|
1620
|
-
|
|
1627
|
+
Mi(t.edge.fromText) ? (u(), r("g", {
|
|
1621
1628
|
key: 0,
|
|
1622
|
-
transform:
|
|
1623
|
-
}, [
|
|
1629
|
+
transform: Ii(t.edge.fromText, t.start, t.startAngle)
|
|
1630
|
+
}, [wr.value ? (u(), r("rect", {
|
|
1624
1631
|
key: 0,
|
|
1625
1632
|
x: -t.fromBox.w / 2,
|
|
1626
1633
|
y: -t.fromBox.h / 2,
|
|
1627
1634
|
width: t.fromBox.w,
|
|
1628
1635
|
height: t.fromBox.h,
|
|
1629
1636
|
rx: "3",
|
|
1630
|
-
fill:
|
|
1637
|
+
fill: Tr.value,
|
|
1631
1638
|
opacity: "0.92",
|
|
1632
|
-
stroke:
|
|
1639
|
+
stroke: C(t.edge, t.edge.fromText),
|
|
1633
1640
|
"stroke-opacity": "0.35",
|
|
1634
1641
|
"stroke-width": "0.6"
|
|
1635
1642
|
}, null, 8, Je)) : n("", !0), i("text", {
|
|
1636
1643
|
y: "0",
|
|
1637
1644
|
"dominant-baseline": "central",
|
|
1638
1645
|
"text-anchor": "middle",
|
|
1639
|
-
"font-size":
|
|
1640
|
-
fill:
|
|
1646
|
+
"font-size": S(t.edge, t.edge.fromText),
|
|
1647
|
+
fill: C(t.edge, t.edge.fromText),
|
|
1641
1648
|
"font-family": "'SF Mono', monospace",
|
|
1642
1649
|
"font-weight": "500",
|
|
1643
1650
|
opacity: "0.9"
|
|
1644
|
-
}, m(
|
|
1645
|
-
|
|
1651
|
+
}, m(ji(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
|
|
1652
|
+
Mi(t.edge.centerText) ? (u(), r("g", {
|
|
1646
1653
|
key: 1,
|
|
1647
|
-
transform:
|
|
1648
|
-
}, [
|
|
1654
|
+
transform: Ii(t.edge.centerText, t.center, t.centerAngle)
|
|
1655
|
+
}, [wr.value ? (u(), r("rect", {
|
|
1649
1656
|
key: 0,
|
|
1650
1657
|
x: -t.centerBox.w / 2,
|
|
1651
1658
|
y: -t.centerBox.h / 2,
|
|
1652
1659
|
width: t.centerBox.w,
|
|
1653
1660
|
height: t.centerBox.h,
|
|
1654
1661
|
rx: "3",
|
|
1655
|
-
fill:
|
|
1662
|
+
fill: Tr.value,
|
|
1656
1663
|
opacity: "0.92",
|
|
1657
|
-
stroke:
|
|
1664
|
+
stroke: C(t.edge, t.edge.centerText),
|
|
1658
1665
|
"stroke-opacity": "0.35",
|
|
1659
1666
|
"stroke-width": "0.6"
|
|
1660
1667
|
}, null, 8, Ze)) : n("", !0), i("text", {
|
|
1661
1668
|
y: "0",
|
|
1662
1669
|
"dominant-baseline": "central",
|
|
1663
1670
|
"text-anchor": "middle",
|
|
1664
|
-
"font-size":
|
|
1665
|
-
fill:
|
|
1671
|
+
"font-size": S(t.edge, t.edge.centerText),
|
|
1672
|
+
fill: C(t.edge, t.edge.centerText),
|
|
1666
1673
|
"font-family": "'SF Mono', monospace",
|
|
1667
1674
|
"font-weight": "600",
|
|
1668
1675
|
opacity: "1"
|
|
1669
|
-
}, m(
|
|
1670
|
-
|
|
1676
|
+
}, m(ji(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
|
|
1677
|
+
Mi(t.edge.toText) ? (u(), r("g", {
|
|
1671
1678
|
key: 2,
|
|
1672
|
-
transform:
|
|
1673
|
-
}, [
|
|
1679
|
+
transform: Ii(t.edge.toText, t.end, t.endAngle)
|
|
1680
|
+
}, [wr.value ? (u(), r("rect", {
|
|
1674
1681
|
key: 0,
|
|
1675
1682
|
x: -t.toBox.w / 2,
|
|
1676
1683
|
y: -t.toBox.h / 2,
|
|
1677
1684
|
width: t.toBox.w,
|
|
1678
1685
|
height: t.toBox.h,
|
|
1679
1686
|
rx: "3",
|
|
1680
|
-
fill:
|
|
1687
|
+
fill: Tr.value,
|
|
1681
1688
|
opacity: "0.92",
|
|
1682
|
-
stroke:
|
|
1689
|
+
stroke: C(t.edge, t.edge.toText),
|
|
1683
1690
|
"stroke-opacity": "0.35",
|
|
1684
1691
|
"stroke-width": "0.6"
|
|
1685
1692
|
}, null, 8, et)) : n("", !0), i("text", {
|
|
1686
1693
|
y: "0",
|
|
1687
1694
|
"dominant-baseline": "central",
|
|
1688
1695
|
"text-anchor": "middle",
|
|
1689
|
-
"font-size":
|
|
1690
|
-
fill:
|
|
1696
|
+
"font-size": S(t.edge, t.edge.toText),
|
|
1697
|
+
fill: C(t.edge, t.edge.toText),
|
|
1691
1698
|
"font-family": "'SF Mono', monospace",
|
|
1692
1699
|
"font-weight": "500",
|
|
1693
1700
|
opacity: "0.9"
|
|
1694
|
-
}, m(
|
|
1701
|
+
}, m(ji(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
|
|
1695
1702
|
]))], 64))), 128)),
|
|
1696
1703
|
Y.value ? (u(), r("g", nt, [
|
|
1697
1704
|
i("line", {
|
|
1698
1705
|
x1: Y.value.ax,
|
|
1699
1706
|
y1: Y.value.ay,
|
|
1700
|
-
x2:
|
|
1701
|
-
y2:
|
|
1702
|
-
stroke:
|
|
1707
|
+
x2: yi.value.x,
|
|
1708
|
+
y2: yi.value.y,
|
|
1709
|
+
stroke: vi.value,
|
|
1703
1710
|
"stroke-width": "2",
|
|
1704
1711
|
"stroke-dasharray": "6 6",
|
|
1705
1712
|
"stroke-linecap": "round",
|
|
@@ -1709,24 +1716,24 @@ var b = {
|
|
|
1709
1716
|
cx: Y.value.px,
|
|
1710
1717
|
cy: Y.value.py,
|
|
1711
1718
|
r: "3.5",
|
|
1712
|
-
fill:
|
|
1719
|
+
fill: vi.value,
|
|
1713
1720
|
opacity: "0.9"
|
|
1714
1721
|
}, null, 8, it),
|
|
1715
|
-
Y.value.overId &&
|
|
1722
|
+
Y.value.overId && bi.value ? (u(), r("rect", {
|
|
1716
1723
|
key: 0,
|
|
1717
|
-
x:
|
|
1718
|
-
y:
|
|
1719
|
-
width:
|
|
1720
|
-
height:
|
|
1724
|
+
x: bi.value.x,
|
|
1725
|
+
y: bi.value.y,
|
|
1726
|
+
width: bi.value.w,
|
|
1727
|
+
height: bi.value.h,
|
|
1721
1728
|
rx: "6",
|
|
1722
1729
|
fill: "none",
|
|
1723
|
-
stroke:
|
|
1730
|
+
stroke: vi.value,
|
|
1724
1731
|
"stroke-width": "1.5",
|
|
1725
1732
|
"stroke-dasharray": "6 4",
|
|
1726
1733
|
opacity: "0.9"
|
|
1727
1734
|
}, null, 8, at)) : n("", !0)
|
|
1728
1735
|
])) : n("", !0),
|
|
1729
|
-
(u(!0), r(e, null, f(
|
|
1736
|
+
(u(!0), r(e, null, f(W.value, (e) => (u(), r("path", {
|
|
1730
1737
|
key: `hit-${e.id}`,
|
|
1731
1738
|
d: $(e),
|
|
1732
1739
|
fill: "none",
|
|
@@ -1736,14 +1743,14 @@ var b = {
|
|
|
1736
1743
|
"pointer-events": "stroke",
|
|
1737
1744
|
cursor: "pointer"
|
|
1738
1745
|
},
|
|
1739
|
-
onClick: g((t) =>
|
|
1746
|
+
onClick: g((t) => In(e, t), ["stop"])
|
|
1740
1747
|
}, null, 8, ot))), 128)),
|
|
1741
|
-
(u(!0), r(e, null, f(
|
|
1748
|
+
(u(!0), r(e, null, f(Qn.value, (a) => (u(), r("g", {
|
|
1742
1749
|
key: a.id,
|
|
1743
1750
|
transform: `translate(${a.x}, ${a.y})`,
|
|
1744
1751
|
class: o(["topology-node", D.value === a.id ? "dragging" : ""]),
|
|
1745
|
-
onMousedown: (e) =>
|
|
1746
|
-
onClick: (e) =>
|
|
1752
|
+
onMousedown: (e) => Ir(e, a.id),
|
|
1753
|
+
onClick: (e) => Pn(a, e),
|
|
1747
1754
|
style: s({
|
|
1748
1755
|
cursor: v.editable && v.config.nodeDraggable !== !1 ? "grab" : "default",
|
|
1749
1756
|
color: F(a)
|
|
@@ -1776,9 +1783,9 @@ var b = {
|
|
|
1776
1783
|
height: En(a).height,
|
|
1777
1784
|
rx: "6",
|
|
1778
1785
|
fill: "none",
|
|
1779
|
-
stroke:
|
|
1780
|
-
"stroke-width":
|
|
1781
|
-
"stroke-dasharray":
|
|
1786
|
+
stroke: Nr(a),
|
|
1787
|
+
"stroke-width": Pr(a),
|
|
1788
|
+
"stroke-dasharray": Fr(a),
|
|
1782
1789
|
opacity: "0.8"
|
|
1783
1790
|
}, null, 8, ut)) : n("", !0),
|
|
1784
1791
|
On(a) && _.viewMode !== "3d" ? (u(), r("rect", {
|
|
@@ -1789,7 +1796,7 @@ var b = {
|
|
|
1789
1796
|
height: L(a).height,
|
|
1790
1797
|
rx: "6",
|
|
1791
1798
|
fill: "none",
|
|
1792
|
-
stroke:
|
|
1799
|
+
stroke: Nn.value,
|
|
1793
1800
|
"stroke-width": "2.5",
|
|
1794
1801
|
transform: "scale(1.1)",
|
|
1795
1802
|
style: { "pointer-events": "none" }
|
|
@@ -1805,12 +1812,12 @@ var b = {
|
|
|
1805
1812
|
y: "4",
|
|
1806
1813
|
transform: `rotate(${a.rotation || 0} 0 4)`,
|
|
1807
1814
|
"text-anchor": "middle",
|
|
1808
|
-
fill:
|
|
1809
|
-
"font-size":
|
|
1815
|
+
fill: Ht(a) || F(a) || gn(a).color,
|
|
1816
|
+
"font-size": Vt(a, 12),
|
|
1810
1817
|
"font-family": "'SF Mono', 'Cascadia Code', 'Consolas', monospace",
|
|
1811
1818
|
"font-weight": "600"
|
|
1812
1819
|
}, m(a.label), 9, pt)], 64)) : (u(), r(e, { key: 4 }, [
|
|
1813
|
-
i("g", { transform: bn(a) }, [a.state !== "none" &&
|
|
1820
|
+
i("g", { transform: bn(a) }, [a.state !== "none" && jr.value ? (u(), r("circle", {
|
|
1814
1821
|
key: 0,
|
|
1815
1822
|
r: "30",
|
|
1816
1823
|
fill: "none",
|
|
@@ -1840,7 +1847,7 @@ var b = {
|
|
|
1840
1847
|
fill: F(a),
|
|
1841
1848
|
opacity: "0.9"
|
|
1842
1849
|
}, null, 8, _t)])])], 8, mt),
|
|
1843
|
-
|
|
1850
|
+
Dr.value ? (u(), r("g", {
|
|
1844
1851
|
key: 0,
|
|
1845
1852
|
transform: xn(a)
|
|
1846
1853
|
}, [i("circle", {
|
|
@@ -1853,9 +1860,9 @@ var b = {
|
|
|
1853
1860
|
y: Cn(a),
|
|
1854
1861
|
transform: `rotate(${a.rotation || 0} 0 ${Cn(a)})`,
|
|
1855
1862
|
"text-anchor": "middle",
|
|
1856
|
-
fill:
|
|
1857
|
-
"font-size":
|
|
1858
|
-
"font-weight":
|
|
1863
|
+
fill: Ht(a),
|
|
1864
|
+
"font-size": Vt(a),
|
|
1865
|
+
"font-weight": Ut(a),
|
|
1859
1866
|
"font-family": "'Segoe UI', system-ui, sans-serif",
|
|
1860
1867
|
opacity: "0.9"
|
|
1861
1868
|
}, [(u(!0), r(e, null, f(String(a.label ?? "").split("\n"), (e, t) => (u(), r("tspan", {
|
|
@@ -1864,7 +1871,7 @@ var b = {
|
|
|
1864
1871
|
dy: t === 0 ? 0 : "1.2em"
|
|
1865
1872
|
}, m(e), 9, xt))), 128))], 8, bt)
|
|
1866
1873
|
], 64)),
|
|
1867
|
-
|
|
1874
|
+
Er.value ? (u(), r("g", St, [(u(!0), r(e, null, f(Zr(a), (e) => (u(), r("circle", {
|
|
1868
1875
|
key: e.side,
|
|
1869
1876
|
cx: e.x,
|
|
1870
1877
|
cy: e.y,
|
|
@@ -1873,40 +1880,40 @@ var b = {
|
|
|
1873
1880
|
fill: "#0a0e1a",
|
|
1874
1881
|
stroke: F(a),
|
|
1875
1882
|
"stroke-width": "1.5",
|
|
1876
|
-
onPointerdown: g((t) =>
|
|
1877
|
-
onPointermove: g(
|
|
1878
|
-
onPointerup: g(
|
|
1879
|
-
onPointercancel: g(
|
|
1880
|
-
onLostpointercapture:
|
|
1883
|
+
onPointerdown: g((t) => ei(t, a.id, e), ["stop", "prevent"]),
|
|
1884
|
+
onPointermove: g(li, ["stop"]),
|
|
1885
|
+
onPointerup: g(ui, ["stop"]),
|
|
1886
|
+
onPointercancel: g(ui, ["stop"]),
|
|
1887
|
+
onLostpointercapture: ui,
|
|
1881
1888
|
onMousedown: c[0] ||= g(() => {}, ["stop", "prevent"]),
|
|
1882
1889
|
onClick: c[1] ||= g(() => {}, ["stop"])
|
|
1883
1890
|
}, null, 40, Ct))), 128))])) : n("", !0)
|
|
1884
1891
|
], 46, st))), 128)),
|
|
1885
|
-
|
|
1892
|
+
Xr.value ? (u(), r("g", wt, [(u(!0), r(e, null, f(Wr(Xr.value), (e) => (u(), r("rect", {
|
|
1886
1893
|
key: e.side,
|
|
1887
|
-
x:
|
|
1888
|
-
y:
|
|
1894
|
+
x: Xr.value.x + e.x - 4.5,
|
|
1895
|
+
y: Xr.value.y + e.y - 4.5,
|
|
1889
1896
|
width: "9",
|
|
1890
1897
|
height: "9",
|
|
1891
1898
|
rx: "2",
|
|
1892
1899
|
class: o(["node-resize-handle", `rt-${e.side}`]),
|
|
1893
|
-
onMousedown: g((t) =>
|
|
1900
|
+
onMousedown: g((t) => Kr(t, Xr.value, e.side), ["stop", "prevent"]),
|
|
1894
1901
|
onClick: c[2] ||= g(() => {}, ["stop"])
|
|
1895
1902
|
}, null, 42, Tt))), 128))])) : n("", !0),
|
|
1896
|
-
|
|
1903
|
+
K.value ? (u(), r("rect", {
|
|
1897
1904
|
key: 4,
|
|
1898
1905
|
class: "marquee-box",
|
|
1899
|
-
x:
|
|
1900
|
-
y:
|
|
1901
|
-
width:
|
|
1902
|
-
height:
|
|
1906
|
+
x: ar.value.x,
|
|
1907
|
+
y: ar.value.y,
|
|
1908
|
+
width: ar.value.width,
|
|
1909
|
+
height: ar.value.height,
|
|
1903
1910
|
rx: "2",
|
|
1904
1911
|
"vector-effect": "non-scaling-stroke"
|
|
1905
1912
|
}, null, 8, Et)) : n("", !0)
|
|
1906
1913
|
], 44, ae));
|
|
1907
1914
|
}
|
|
1908
|
-
},
|
|
1909
|
-
e.component("Topology",
|
|
1915
|
+
}, Bt = { install(e) {
|
|
1916
|
+
e.component("Topology", zt);
|
|
1910
1917
|
} };
|
|
1911
1918
|
//#endregion
|
|
1912
|
-
export {
|
|
1919
|
+
export { zt as Topology, Bt as default, ie as nodeColors, b as nodeStates };
|