vue3-network-graph 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +550 -543
- package/dist/index.umd.cjs +4 -4
- package/package.json +14 -3
package/dist/index.mjs
CHANGED
|
@@ -212,7 +212,7 @@ var b = {
|
|
|
212
212
|
"transform",
|
|
213
213
|
"fill",
|
|
214
214
|
"font-size"
|
|
215
|
-
], mt = ["
|
|
215
|
+
], mt = ["r", "stroke"], ht = ["values"], gt = ["transform"], _t = ["fill"], vt = ["transform"], yt = ["fill"], bt = [
|
|
216
216
|
"y",
|
|
217
217
|
"transform",
|
|
218
218
|
"fill",
|
|
@@ -238,7 +238,7 @@ var b = {
|
|
|
238
238
|
"y",
|
|
239
239
|
"width",
|
|
240
240
|
"height"
|
|
241
|
-
], Dt = 6, Ot = 14, kt = 3,
|
|
241
|
+
], Dt = 6, Ot = 14, kt = 3, x = 60, At = .2, jt = 5, Mt = 160, Nt = 140, Pt = 12, Ft = 4e3, It = 12, Lt = 4e3, Rt = {
|
|
242
242
|
__name: "Topology",
|
|
243
243
|
props: {
|
|
244
244
|
nodes: {
|
|
@@ -296,9 +296,9 @@ var b = {
|
|
|
296
296
|
"node-resize-end"
|
|
297
297
|
],
|
|
298
298
|
setup(_, { expose: te, emit: ne }) {
|
|
299
|
-
let v = _, y = ne,
|
|
300
|
-
|
|
301
|
-
},
|
|
299
|
+
let v = _, y = ne, Rt = 0, zt = () => {
|
|
300
|
+
Rt++;
|
|
301
|
+
}, Bt = (e) => e && typeof e == "object" ? {
|
|
302
302
|
text: e.text,
|
|
303
303
|
rotation: e.rotation || 0,
|
|
304
304
|
fontSize: e.fontSize,
|
|
@@ -308,106 +308,106 @@ var b = {
|
|
|
308
308
|
rotation: 0,
|
|
309
309
|
fontSize: void 0,
|
|
310
310
|
color: void 0
|
|
311
|
-
}, Vt = (e, t = 11) => e.fontSize || t, Ht = (e) => e.fontColor || "#000000", Ut = (e, t = 500) => e.fontWeight || t,
|
|
312
|
-
|
|
311
|
+
}, Vt = (e, t = 11) => e.fontSize || t, Ht = (e) => e.fontColor || "#000000", Ut = (e, t = 500) => e.fontWeight || t, Wt = (e, t) => e.fontSize || Bt(t).fontSize || 8, S = (e, t) => e.fontColor || Bt(t).color || "#000000", C = d(v.nodes.map((e) => ({ ...e }))), Gt = null, w = () => {
|
|
312
|
+
Gt = C.value, y("update:nodes", C.value);
|
|
313
313
|
};
|
|
314
314
|
h(() => v.nodes, (e) => {
|
|
315
315
|
let t = Array.isArray(e) ? e : [];
|
|
316
|
-
if (t ===
|
|
316
|
+
if (t === Gt) return;
|
|
317
317
|
let n = null, r = null;
|
|
318
318
|
try {
|
|
319
|
-
n = JSON.stringify(t), r = JSON.stringify(
|
|
319
|
+
n = JSON.stringify(t), r = JSON.stringify(C.value);
|
|
320
320
|
} catch {
|
|
321
321
|
n = null;
|
|
322
322
|
}
|
|
323
|
-
(n === null || n !== r) && (
|
|
323
|
+
(n === null || n !== r) && (zt(), C.value = t.map((e) => ({ ...e })));
|
|
324
324
|
}, { deep: !0 });
|
|
325
|
-
let
|
|
325
|
+
let Kt = d(v.lineMode);
|
|
326
326
|
h(() => v.lineMode, (e) => {
|
|
327
|
-
|
|
327
|
+
Kt.value = e;
|
|
328
328
|
});
|
|
329
|
-
let
|
|
330
|
-
get: () =>
|
|
329
|
+
let T = t({
|
|
330
|
+
get: () => Kt.value,
|
|
331
331
|
set: (e) => {
|
|
332
|
-
|
|
332
|
+
Kt.value = e, y("update:lineMode", e);
|
|
333
333
|
}
|
|
334
|
-
}),
|
|
334
|
+
}), E = d(null), D = d(null), qt = d({
|
|
335
335
|
x: 0,
|
|
336
336
|
y: 0
|
|
337
|
-
}),
|
|
337
|
+
}), Jt = d(null), Yt = null, Xt = !1, Zt = !1, O = d([]), k = d(/* @__PURE__ */ new Map()), A = d(/* @__PURE__ */ new Set()), j = t(() => {
|
|
338
338
|
let e = v.edges, t = [];
|
|
339
|
-
if (
|
|
339
|
+
if (O.value.length) {
|
|
340
340
|
let n = new Set(e.map((e) => e.id));
|
|
341
|
-
t =
|
|
341
|
+
t = O.value.filter((e) => !n.has(e.id));
|
|
342
342
|
}
|
|
343
|
-
let n = t.length ? [...e, ...t] : e, r =
|
|
343
|
+
let n = t.length ? [...e, ...t] : e, r = k.value;
|
|
344
344
|
r.size && (n = n.map((e) => r.has(e.id) ? {
|
|
345
345
|
...e,
|
|
346
346
|
...r.get(e.id)
|
|
347
347
|
} : e));
|
|
348
|
-
let i = new Set(
|
|
348
|
+
let i = new Set(C.value.map((e) => e.id)), a = A.value;
|
|
349
349
|
return n.filter((e) => !a.has(e.id) && i.has(e.from) && i.has(e.to));
|
|
350
|
-
}),
|
|
350
|
+
}), Qt = t(() => v.config.watchDataChanges === !0), $t = d({
|
|
351
351
|
nodes: [],
|
|
352
352
|
edges: []
|
|
353
|
-
}),
|
|
354
|
-
nodes:
|
|
355
|
-
edges:
|
|
356
|
-
})),
|
|
353
|
+
}), en = "", M = null, tn = () => JSON.parse(JSON.stringify({
|
|
354
|
+
nodes: C.value,
|
|
355
|
+
edges: j.value
|
|
356
|
+
})), nn = (e, t) => {
|
|
357
357
|
let n = new Map(e.map((e) => [e.id, e])), r = new Map(t.map((e) => [e.id, e]));
|
|
358
358
|
return {
|
|
359
359
|
added: t.filter((e) => !n.has(e.id)).map((e) => e.id),
|
|
360
360
|
removed: e.filter((e) => !r.has(e.id)).map((e) => e.id),
|
|
361
361
|
updated: t.filter((e) => n.has(e.id) && JSON.stringify(n.get(e.id)) !== JSON.stringify(e)).map((e) => e.id)
|
|
362
362
|
};
|
|
363
|
-
},
|
|
364
|
-
nodes:
|
|
365
|
-
edges:
|
|
366
|
-
}),
|
|
367
|
-
if (
|
|
368
|
-
let e =
|
|
369
|
-
if (t ===
|
|
370
|
-
let n =
|
|
371
|
-
|
|
363
|
+
}, rn = (e) => ({
|
|
364
|
+
nodes: nn($t.value.nodes, e.nodes),
|
|
365
|
+
edges: nn($t.value.edges, e.edges)
|
|
366
|
+
}), an = () => {
|
|
367
|
+
if (M = null, !Qt.value) return;
|
|
368
|
+
let e = tn(), t = JSON.stringify(e);
|
|
369
|
+
if (t === en) return;
|
|
370
|
+
let n = rn(e), r = n.nodes.added.length + n.nodes.removed.length + n.nodes.updated.length + n.edges.added.length + n.edges.removed.length + n.edges.updated.length;
|
|
371
|
+
en = t, r && y("data-change", {
|
|
372
372
|
nodes: e.nodes,
|
|
373
373
|
edges: e.edges,
|
|
374
374
|
summary: n
|
|
375
375
|
});
|
|
376
|
-
}, an = () => {
|
|
377
|
-
Zt.value && (N && clearTimeout(N), N = setTimeout(rn, 300));
|
|
378
376
|
}, on = () => {
|
|
379
|
-
|
|
377
|
+
Qt.value && (M && clearTimeout(M), M = setTimeout(an, 300));
|
|
378
|
+
}, sn = () => {
|
|
379
|
+
M &&= (clearTimeout(M), null), $t.value = tn(), en = "";
|
|
380
380
|
};
|
|
381
381
|
h([
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
], () =>
|
|
387
|
-
e ?
|
|
382
|
+
C,
|
|
383
|
+
O,
|
|
384
|
+
A,
|
|
385
|
+
k
|
|
386
|
+
], () => on(), { deep: !0 }), h(Qt, (e) => {
|
|
387
|
+
e ? sn() : M &&= (clearTimeout(M), null);
|
|
388
388
|
}), l(() => {
|
|
389
|
-
|
|
389
|
+
Qt.value && sn();
|
|
390
390
|
});
|
|
391
|
-
let
|
|
392
|
-
let e = new Set(
|
|
391
|
+
let cn = () => tn(), ln = () => {
|
|
392
|
+
let e = new Set(R.value), t = new Set(z.value), n = C.value.filter((t) => e.has(t.id)), r = j.value.filter((n) => t.has(n.id) || e.has(n.from) || e.has(n.to));
|
|
393
393
|
return !n.length && !r.length ? {
|
|
394
394
|
nodes: [],
|
|
395
395
|
edges: []
|
|
396
|
-
} : (n.length && (
|
|
396
|
+
} : (n.length && (C.value = C.value.filter((t) => !e.has(t.id)), w()), r.length && (A.value = /* @__PURE__ */ new Set([...A.value, ...r.map((e) => e.id)]), O.value = O.value.filter((e) => !A.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({
|
|
397
397
|
nodes: n,
|
|
398
398
|
edges: r
|
|
399
399
|
})));
|
|
400
|
-
},
|
|
401
|
-
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(
|
|
400
|
+
}, un = (e) => {
|
|
401
|
+
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(C.value.map((e) => e.id)), r = [];
|
|
402
402
|
for (let e of t) {
|
|
403
403
|
let t = JSON.parse(JSON.stringify(e));
|
|
404
404
|
if (t.id == null) t.id = re();
|
|
405
405
|
else if (n.has(t.id)) continue;
|
|
406
406
|
n.add(t.id), r.push(t);
|
|
407
407
|
}
|
|
408
|
-
return r.length ? (
|
|
409
|
-
},
|
|
410
|
-
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(
|
|
408
|
+
return r.length ? (C.value = [...C.value, ...r], w(), JSON.parse(JSON.stringify(r))) : [];
|
|
409
|
+
}, dn = (e) => {
|
|
410
|
+
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(j.value.map((e) => e.id)), r = [];
|
|
411
411
|
for (let e of t) {
|
|
412
412
|
let t = JSON.parse(JSON.stringify(e));
|
|
413
413
|
if (t.from != null && t.to != null) {
|
|
@@ -417,13 +417,13 @@ var b = {
|
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
if (!r.length) return [];
|
|
420
|
-
let i = r.filter((e) =>
|
|
420
|
+
let i = r.filter((e) => A.value.has(e.id));
|
|
421
421
|
if (i.length) {
|
|
422
422
|
let e = new Set(i.map((e) => e.id));
|
|
423
|
-
|
|
423
|
+
A.value = new Set([...A.value].filter((t) => !e.has(t)));
|
|
424
424
|
}
|
|
425
|
-
return
|
|
426
|
-
},
|
|
425
|
+
return O.value = [...O.value, ...r], r.forEach((e) => y("edge-create", JSON.parse(JSON.stringify(e)))), JSON.parse(JSON.stringify(r));
|
|
426
|
+
}, fn = (e) => {
|
|
427
427
|
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && e.id != null);
|
|
428
428
|
if (!t.length) return [];
|
|
429
429
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -436,7 +436,7 @@ var b = {
|
|
|
436
436
|
});
|
|
437
437
|
}
|
|
438
438
|
let r = [];
|
|
439
|
-
return
|
|
439
|
+
return C.value = C.value.map((e) => {
|
|
440
440
|
let t = n.get(e.id);
|
|
441
441
|
if (!t) return e;
|
|
442
442
|
let i = {
|
|
@@ -444,11 +444,11 @@ var b = {
|
|
|
444
444
|
...t
|
|
445
445
|
};
|
|
446
446
|
return r.push(i), i;
|
|
447
|
-
}), r.length ? (
|
|
448
|
-
},
|
|
447
|
+
}), r.length ? (w(), JSON.parse(JSON.stringify(r))) : [];
|
|
448
|
+
}, pn = (e) => {
|
|
449
449
|
let t = (Array.isArray(e) ? e : [e]).filter((e) => e && e.id != null);
|
|
450
450
|
if (!t.length) return [];
|
|
451
|
-
let n = new Set(
|
|
451
|
+
let n = new Set(j.value.map((e) => e.id)), r = new Map(k.value), i = [];
|
|
452
452
|
for (let e of t) {
|
|
453
453
|
let { id: t, ...a } = e;
|
|
454
454
|
if (!n.has(t)) continue;
|
|
@@ -459,36 +459,36 @@ var b = {
|
|
|
459
459
|
...o
|
|
460
460
|
};
|
|
461
461
|
r.set(t, s);
|
|
462
|
-
let c =
|
|
462
|
+
let c = j.value.find((e) => e.id === t);
|
|
463
463
|
i.push({
|
|
464
464
|
...c,
|
|
465
465
|
...s
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
|
-
return i.length ? (
|
|
469
|
-
},
|
|
468
|
+
return i.length ? (k.value = r, y("edge-update", JSON.parse(JSON.stringify(i))), JSON.parse(JSON.stringify(i))) : [];
|
|
469
|
+
}, mn = (e) => {
|
|
470
470
|
let t = e && typeof e == "object" ? e : null;
|
|
471
|
-
return
|
|
471
|
+
return O.value = [], A.value = /* @__PURE__ */ new Set(), k.value = /* @__PURE__ */ new Map(), t && Array.isArray(t.nodes) ? (C.value = JSON.parse(JSON.stringify(t.nodes)), w()) : (C.value = (Array.isArray(v.nodes) ? v.nodes : []).map((e) => ({ ...e })), Gt = C.value), R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B(), sn(), tn();
|
|
472
472
|
};
|
|
473
473
|
h(() => v.edges, (e) => {
|
|
474
|
-
|
|
474
|
+
zt();
|
|
475
475
|
let t = Array.isArray(e) ? e : [], n = new Set(t.map((e) => e.id));
|
|
476
|
-
if (
|
|
477
|
-
let e =
|
|
478
|
-
e.length !==
|
|
476
|
+
if (O.value.length) {
|
|
477
|
+
let e = O.value.filter((e) => !n.has(e.id));
|
|
478
|
+
e.length !== O.value.length && (O.value = e);
|
|
479
479
|
}
|
|
480
|
-
if (
|
|
481
|
-
let e = new Map(
|
|
480
|
+
if (k.value.size) {
|
|
481
|
+
let e = new Map(k.value), n = new Set(O.value.map((e) => e.id)), r = !1;
|
|
482
482
|
for (let [i, a] of e) {
|
|
483
483
|
let o = t.find((e) => e.id === i);
|
|
484
484
|
o ? Object.entries(a).every(([e, t]) => JSON.stringify(o[e] ?? null) === JSON.stringify(t ?? null)) && (e.delete(i), r = !0) : n.has(i) || (e.delete(i), r = !0);
|
|
485
485
|
}
|
|
486
|
-
r && (
|
|
486
|
+
r && (k.value = e);
|
|
487
487
|
}
|
|
488
488
|
}, { deep: !0 });
|
|
489
|
-
let
|
|
489
|
+
let N = t(() => {
|
|
490
490
|
let e = {};
|
|
491
|
-
|
|
491
|
+
j.value.forEach((t) => {
|
|
492
492
|
let n = [t.from, t.to].sort().join("__");
|
|
493
493
|
e[n] || (e[n] = []), e[n].push(t);
|
|
494
494
|
});
|
|
@@ -524,36 +524,39 @@ var b = {
|
|
|
524
524
|
};
|
|
525
525
|
});
|
|
526
526
|
}), t;
|
|
527
|
-
}),
|
|
527
|
+
}), hn = t(() => {
|
|
528
528
|
let e = /* @__PURE__ */ new Map();
|
|
529
|
-
for (let t of
|
|
529
|
+
for (let t of C.value) e.set(t.id, t);
|
|
530
530
|
return e;
|
|
531
|
-
}),
|
|
531
|
+
}), 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.nodeType === "text", vn = (e) => e.nodeType === "border-only", yn = (e, t) => {
|
|
532
532
|
let n = Number(e);
|
|
533
533
|
return Number.isFinite(n) && n > 0 ? n : t;
|
|
534
|
-
},
|
|
535
|
-
let t =
|
|
534
|
+
}, bn = (e) => {
|
|
535
|
+
let t = yn(e.width, x), n = yn(e.height, x);
|
|
536
536
|
return {
|
|
537
|
-
sx: t /
|
|
538
|
-
sy: n /
|
|
537
|
+
sx: t / x,
|
|
538
|
+
sy: n / x
|
|
539
539
|
};
|
|
540
|
-
}, bn = (e) => {
|
|
541
|
-
let { sx: t, sy: n } = yn(e);
|
|
542
|
-
return t === 1 && n === 1 ? "" : `scale(${t}, ${n})`;
|
|
543
540
|
}, xn = (e) => {
|
|
544
|
-
let
|
|
541
|
+
let t = Math.max(e.width, e.height);
|
|
542
|
+
return isNaN(t) ? 30 : t / 2;
|
|
543
|
+
}, Sn = (e) => {
|
|
544
|
+
let { sx: t, sy: n } = bn(e);
|
|
545
|
+
return t === 1 && n === 1 ? "" : `scale(${t}, ${n})`;
|
|
546
|
+
}, Cn = (e) => {
|
|
547
|
+
let { w: t, h: n } = I(e), r = Math.min(10, t * .3), i = Math.min(10, n * .3);
|
|
545
548
|
return `translate(${t / 2 - r}, ${-(n / 2 - i)})`;
|
|
546
|
-
},
|
|
549
|
+
}, wn = t(() => {
|
|
547
550
|
let e = Number(v.config.labelGap);
|
|
548
551
|
return Number.isFinite(e) && e >= 0 ? e : 18;
|
|
549
|
-
}),
|
|
550
|
-
if (
|
|
551
|
-
let { h: t } =
|
|
552
|
-
return e.labelPosition === "top" ? -(t / 2 +
|
|
553
|
-
},
|
|
554
|
-
let t =
|
|
555
|
-
if (
|
|
556
|
-
let n = Vt(e), r =
|
|
552
|
+
}), Tn = (e) => {
|
|
553
|
+
if (_n(e)) return 4;
|
|
554
|
+
let { h: t } = I(e);
|
|
555
|
+
return e.labelPosition === "top" ? -(t / 2 + wn.value) : e.labelPosition === "center" ? 0 : t / 2 + wn.value;
|
|
556
|
+
}, En = (e) => {
|
|
557
|
+
let t = L(e);
|
|
558
|
+
if (_n(e) || !e.label) return t;
|
|
559
|
+
let n = Vt(e), r = Tn(e);
|
|
557
560
|
if (e.labelPosition === "top") {
|
|
558
561
|
let e = r - n - 4;
|
|
559
562
|
e < t.y && (t.height += t.y - e, t.y = e);
|
|
@@ -562,147 +565,147 @@ var b = {
|
|
|
562
565
|
i > t.y + t.height && (t.height = i - t.y);
|
|
563
566
|
}
|
|
564
567
|
return t;
|
|
565
|
-
},
|
|
566
|
-
let t =
|
|
568
|
+
}, Dn = (e) => e.borderColor !== void 0 || e.borderWidth !== void 0 || e.borderStyle !== void 0, I = (e) => {
|
|
569
|
+
let t = _n(e), n = vn(e);
|
|
567
570
|
return {
|
|
568
|
-
w:
|
|
569
|
-
h:
|
|
571
|
+
w: yn(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) : n ? Math.max(80, String(e.label).length * 8 + 24) : x),
|
|
572
|
+
h: yn(e.height, t ? 26 : n ? 40 : x)
|
|
570
573
|
};
|
|
571
|
-
},
|
|
572
|
-
let { w: t, h: n } =
|
|
574
|
+
}, L = (e) => {
|
|
575
|
+
let { w: t, h: n } = I(e);
|
|
573
576
|
return {
|
|
574
577
|
x: -t / 2,
|
|
575
578
|
y: -n / 2,
|
|
576
579
|
width: t,
|
|
577
580
|
height: n
|
|
578
581
|
};
|
|
579
|
-
},
|
|
580
|
-
t(() =>
|
|
581
|
-
let
|
|
582
|
+
}, On = (e) => Dn(e) ? L(e) : null, kn = (e) => e.background && e.background !== "none" ? e.background : null, R = d([]), z = d([]);
|
|
583
|
+
t(() => R.value.length === 1 ? R.value[0] : null), t(() => z.value.length === 1 ? z.value[0] : null);
|
|
584
|
+
let An = (e) => R.value.includes(e.id), jn = (e) => z.value.includes(e.id), B = () => {
|
|
582
585
|
y("selection-change", {
|
|
583
|
-
nodes:
|
|
584
|
-
edges:
|
|
586
|
+
nodes: C.value.filter((e) => R.value.includes(e.id)),
|
|
587
|
+
edges: j.value.filter((e) => z.value.includes(e.id))
|
|
585
588
|
});
|
|
586
|
-
},
|
|
589
|
+
}, Mn = (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, Nn = t(() => Mn(v.config.maxSelectNodes)), Pn = t(() => Mn(v.config.maxSelectEdges)), V = (e, t, n) => {
|
|
587
590
|
let r = new Set(e), i = [];
|
|
588
591
|
for (let e of t) r.has(e) || (r.add(e), i.push(e));
|
|
589
592
|
if (n === Infinity) return [...e, ...i];
|
|
590
593
|
let a = Math.max(0, n - e.length);
|
|
591
594
|
return [...e, ...i.slice(0, a)];
|
|
592
595
|
};
|
|
593
|
-
h([
|
|
596
|
+
h([Nn, Pn], ([e, t]) => {
|
|
594
597
|
let n = !1;
|
|
595
|
-
|
|
598
|
+
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();
|
|
596
599
|
});
|
|
597
|
-
let
|
|
598
|
-
if (!
|
|
600
|
+
let Fn = t(() => v.config.selectedBorderColor || "#fbbf24"), In = (e, t) => {
|
|
601
|
+
if (!Kn()) {
|
|
599
602
|
if (t && (t.ctrlKey || t.metaKey)) {
|
|
600
|
-
let t =
|
|
601
|
-
t >= 0 ?
|
|
603
|
+
let t = R.value.indexOf(e.id);
|
|
604
|
+
t >= 0 ? R.value.splice(t, 1) : R.value = V(R.value, [e.id], Nn.value);
|
|
602
605
|
} else {
|
|
603
|
-
let t =
|
|
604
|
-
|
|
606
|
+
let t = R.value.length === 1 && R.value[0] === e.id;
|
|
607
|
+
R.value = t ? [] : V([], [e.id], Nn.value), z.value = [];
|
|
605
608
|
}
|
|
606
|
-
y("node-click", e), y("node-select",
|
|
609
|
+
y("node-click", e), y("node-select", An(e) ? e : null), B();
|
|
607
610
|
}
|
|
608
|
-
},
|
|
609
|
-
let t =
|
|
611
|
+
}, Ln = (e) => {
|
|
612
|
+
let t = C.value.find((t) => t.id === e);
|
|
610
613
|
if (!t || v.config.enableZOrder === !1) return !1;
|
|
611
|
-
let n = t.zIndex ?? 0, r =
|
|
614
|
+
let n = t.zIndex ?? 0, r = C.value.filter((e) => (e.zIndex ?? 0) > n);
|
|
612
615
|
return r.length !== 0 && (t.zIndex = Math.min(...r.map((e) => e.zIndex ?? 0)), !0);
|
|
613
|
-
},
|
|
614
|
-
let t =
|
|
616
|
+
}, Rn = (e) => {
|
|
617
|
+
let t = C.value.find((t) => t.id === e);
|
|
615
618
|
if (!t || v.config.enableZOrder === !1) return !1;
|
|
616
|
-
let n = t.zIndex ?? 0, r =
|
|
619
|
+
let n = t.zIndex ?? 0, r = C.value.filter((e) => (e.zIndex ?? 0) < n);
|
|
617
620
|
return r.length !== 0 && (t.zIndex = Math.max(...r.map((e) => e.zIndex ?? 0)), !0);
|
|
618
|
-
},
|
|
619
|
-
let t =
|
|
620
|
-
return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.max(...
|
|
621
|
-
},
|
|
622
|
-
let t =
|
|
623
|
-
return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.min(...
|
|
624
|
-
},
|
|
625
|
-
if (!
|
|
626
|
-
let e =
|
|
627
|
-
e.querySelectorAll("animate, animateMotion, animateTransform, set").forEach((e) => e.remove()), e.querySelectorAll(".center-crosshair").forEach((e) => e.remove()), e.setAttribute("width",
|
|
621
|
+
}, zn = (e) => {
|
|
622
|
+
let t = C.value.find((t) => t.id === e);
|
|
623
|
+
return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.max(...C.value.map((e) => e.zIndex ?? 0), 0) + 1, !0);
|
|
624
|
+
}, Bn = (e) => {
|
|
625
|
+
let t = C.value.find((t) => t.id === e);
|
|
626
|
+
return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.min(...C.value.map((e) => e.zIndex ?? 0), 0) - 1, !0);
|
|
627
|
+
}, Vn = () => {
|
|
628
|
+
if (!D.value) return;
|
|
629
|
+
let e = D.value.cloneNode(!0);
|
|
630
|
+
e.querySelectorAll("animate, animateMotion, animateTransform, set").forEach((e) => e.remove()), e.querySelectorAll(".center-crosshair").forEach((e) => e.remove()), e.setAttribute("width", H.value || "800"), e.setAttribute("height", U.value || "600");
|
|
628
631
|
let t = new XMLSerializer().serializeToString(e);
|
|
629
632
|
t = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + t;
|
|
630
633
|
let n = new Blob([t], { type: "image/svg+xml;charset=utf-8" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
631
634
|
i.href = r, i.download = `topology-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.svg`, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
|
|
632
|
-
},
|
|
633
|
-
if (
|
|
634
|
-
let n =
|
|
635
|
-
let t =
|
|
635
|
+
}, Hn = t(() => v.config.selectedLineColor || "#fbbf24"), Un = (e, t) => {
|
|
636
|
+
if (Kn()) return;
|
|
637
|
+
let n = N.value[e.id], r = !!(n && n.merged && n.representative), i = r ? j.value.filter((e) => {
|
|
638
|
+
let t = N.value[e.id];
|
|
636
639
|
return t && t.key === n.key;
|
|
637
640
|
}) : null, a = r ? i.map((e) => e.id) : [e.id], o = r ? {
|
|
638
641
|
...e,
|
|
639
642
|
bundleEdges: i
|
|
640
643
|
} : e;
|
|
641
|
-
if (t && (t.ctrlKey || t.metaKey)) a.every((e) =>
|
|
644
|
+
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, Pn.value);
|
|
642
645
|
else {
|
|
643
|
-
let e = a.length ===
|
|
644
|
-
|
|
646
|
+
let e = a.length === z.value.length && a.every((e) => z.value.includes(e));
|
|
647
|
+
z.value = e ? [] : V([], a, Pn.value), R.value = [];
|
|
645
648
|
}
|
|
646
|
-
y("edge-select",
|
|
647
|
-
},
|
|
648
|
-
|
|
649
|
-
},
|
|
650
|
-
|
|
651
|
-
},
|
|
652
|
-
if (
|
|
649
|
+
y("edge-select", jn(e) ? o : null), B();
|
|
650
|
+
}, Wn = 0, Gn = (e = 200) => {
|
|
651
|
+
Wn = performance.now() + e;
|
|
652
|
+
}, Kn = () => performance.now() < Wn, qn = () => {
|
|
653
|
+
R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B();
|
|
654
|
+
}, Jn = (e) => {
|
|
655
|
+
if (Kn()) return;
|
|
653
656
|
let t = e.target;
|
|
654
|
-
t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) ||
|
|
655
|
-
},
|
|
657
|
+
t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || qn();
|
|
658
|
+
}, Yn = d({
|
|
656
659
|
width: 1e3,
|
|
657
660
|
height: 650
|
|
658
|
-
}),
|
|
661
|
+
}), Xn = d(1), Zn = d(0), Qn = d(0), $n = t(() => -tr.value / 2 + Zn.value), er = t(() => -nr.value / 2 + Qn.value), tr = t(() => v.width ?? Yn.value.width), nr = t(() => v.height ?? Yn.value.height), rr = null;
|
|
659
662
|
l(() => {
|
|
660
|
-
let e =
|
|
663
|
+
let e = D.value;
|
|
661
664
|
if (e) {
|
|
662
665
|
let t = e.getBoundingClientRect();
|
|
663
|
-
t.width > 0 && t.height > 0 && (
|
|
666
|
+
t.width > 0 && t.height > 0 && (Yn.value = {
|
|
664
667
|
width: t.width,
|
|
665
668
|
height: t.height
|
|
666
669
|
});
|
|
667
670
|
}
|
|
668
|
-
e && typeof ResizeObserver < "u" && (
|
|
671
|
+
e && typeof ResizeObserver < "u" && (rr = new ResizeObserver(() => {
|
|
669
672
|
let t = e.getBoundingClientRect();
|
|
670
|
-
t.width > 0 && t.height > 0 && (
|
|
673
|
+
t.width > 0 && t.height > 0 && (Yn.value = {
|
|
671
674
|
width: t.width,
|
|
672
675
|
height: t.height
|
|
673
676
|
});
|
|
674
|
-
}),
|
|
677
|
+
}), rr.observe(e));
|
|
675
678
|
}), c(() => {
|
|
676
|
-
|
|
679
|
+
rr &&= (rr.disconnect(), null), J &&= (cancelAnimationFrame(J), 0), q &&= (cancelAnimationFrame(q), 0), ci &&= (cancelAnimationFrame(ci), 0), hi(), Sr();
|
|
677
680
|
});
|
|
678
|
-
let
|
|
679
|
-
x0:
|
|
680
|
-
y0:
|
|
681
|
-
x1:
|
|
682
|
-
y1:
|
|
683
|
-
})),
|
|
684
|
-
let e =
|
|
685
|
-
let { w: n, h: r } =
|
|
681
|
+
let H = t(() => tr.value / Xn.value), U = t(() => nr.value / Xn.value), ir = t(() => ({
|
|
682
|
+
x0: $n.value - Mt,
|
|
683
|
+
y0: er.value - Mt,
|
|
684
|
+
x1: $n.value + H.value + Mt,
|
|
685
|
+
y1: er.value + U.value + Mt
|
|
686
|
+
})), ar = t(() => {
|
|
687
|
+
let e = ir.value, t = C.value.filter((t) => {
|
|
688
|
+
let { w: n, h: r } = I(t);
|
|
686
689
|
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;
|
|
687
690
|
});
|
|
688
691
|
return v.config.enableZOrder !== !1 && t.sort((e, t) => (e.zIndex ?? 0) - (t.zIndex ?? 0)), t;
|
|
689
|
-
}),
|
|
690
|
-
let e =
|
|
691
|
-
return
|
|
692
|
-
if (!
|
|
693
|
-
let n =
|
|
692
|
+
}), W = t(() => {
|
|
693
|
+
let e = ir.value;
|
|
694
|
+
return j.value.filter((t) => {
|
|
695
|
+
if (!ji(t)) return !1;
|
|
696
|
+
let n = P(t.from), r = P(t.to);
|
|
694
697
|
if (!n || !r) return !1;
|
|
695
|
-
let i =
|
|
696
|
-
return Math.min(n.x - i, r.x - o) -
|
|
698
|
+
let i = I(n).w / 2, a = I(n).h / 2, o = I(r).w / 2, s = I(r).h / 2;
|
|
699
|
+
return Math.min(n.x - i, r.x - o) - Nt <= e.x1 && Math.max(n.x + i, r.x + o) + Nt >= e.x0 && Math.min(n.y - a, r.y - s) - Nt <= e.y1 && Math.max(n.y + a, r.y + s) + Nt >= e.y0;
|
|
697
700
|
});
|
|
698
|
-
}),
|
|
701
|
+
}), or = (e) => {
|
|
699
702
|
if (v.config.enableZoom === !1) return;
|
|
700
703
|
e.preventDefault();
|
|
701
|
-
let t =
|
|
702
|
-
|
|
703
|
-
},
|
|
704
|
-
let t =
|
|
705
|
-
|
|
704
|
+
let t = D.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(jt, Math.max(At, Xn.value * c)), u = tr.value / l, d = nr.value / l;
|
|
705
|
+
Zn.value += (o - u) * i, Qn.value += (s - d) * a, Xn.value = l;
|
|
706
|
+
}, G = d(null), K = d(null), sr = (e) => {
|
|
707
|
+
let t = D.value, n = t ? t.getBoundingClientRect() : null;
|
|
708
|
+
G.value = {
|
|
706
709
|
startX: e.clientX,
|
|
707
710
|
startY: e.clientY,
|
|
708
711
|
lastX: e.clientX,
|
|
@@ -710,9 +713,9 @@ var b = {
|
|
|
710
713
|
moved: !1,
|
|
711
714
|
rectWidth: n && n.width ? n.width : 0,
|
|
712
715
|
rectHeight: n && n.height ? n.height : 0
|
|
713
|
-
},
|
|
714
|
-
},
|
|
715
|
-
let t =
|
|
716
|
+
}, xr();
|
|
717
|
+
}, cr = (e) => {
|
|
718
|
+
let t = G.value, n = D.value;
|
|
716
719
|
if (!t || !n) return;
|
|
717
720
|
let r = t.rectWidth, i = t.rectHeight;
|
|
718
721
|
if (!r || !i) return;
|
|
@@ -722,13 +725,13 @@ var b = {
|
|
|
722
725
|
return;
|
|
723
726
|
}
|
|
724
727
|
let a = e.clientX - t.lastX, o = e.clientY - t.lastY;
|
|
725
|
-
t.lastX = e.clientX, t.lastY = e.clientY,
|
|
726
|
-
},
|
|
727
|
-
let e =
|
|
728
|
-
|
|
729
|
-
},
|
|
730
|
-
let t =
|
|
731
|
-
|
|
728
|
+
t.lastX = e.clientX, t.lastY = e.clientY, Zn.value -= a * (H.value / r), Qn.value -= o * (U.value / i);
|
|
729
|
+
}, lr = () => {
|
|
730
|
+
let e = G.value;
|
|
731
|
+
G.value = null, e && e.moved && Gn(), Cr();
|
|
732
|
+
}, ur = (e) => {
|
|
733
|
+
let t = Z(e);
|
|
734
|
+
K.value = {
|
|
732
735
|
start: {
|
|
733
736
|
x: t.x,
|
|
734
737
|
y: t.y
|
|
@@ -740,17 +743,17 @@ var b = {
|
|
|
740
743
|
startClientX: e.clientX,
|
|
741
744
|
startClientY: e.clientY,
|
|
742
745
|
moved: !1
|
|
743
|
-
},
|
|
744
|
-
},
|
|
745
|
-
let t =
|
|
746
|
+
}, xr();
|
|
747
|
+
}, dr = (e) => {
|
|
748
|
+
let t = K.value;
|
|
746
749
|
if (!t) return;
|
|
747
|
-
let n =
|
|
750
|
+
let n = Z(e);
|
|
748
751
|
t.current = {
|
|
749
752
|
x: n.x,
|
|
750
753
|
y: n.y
|
|
751
754
|
}, !t.moved && Math.hypot(e.clientX - t.startClientX, e.clientY - t.startClientY) > 3 && (t.moved = !0);
|
|
752
|
-
},
|
|
753
|
-
let e =
|
|
755
|
+
}, fr = t(() => {
|
|
756
|
+
let e = K.value;
|
|
754
757
|
return e ? {
|
|
755
758
|
x: Math.min(e.start.x, e.current.x),
|
|
756
759
|
y: Math.min(e.start.y, e.current.y),
|
|
@@ -762,62 +765,62 @@ var b = {
|
|
|
762
765
|
width: 0,
|
|
763
766
|
height: 0
|
|
764
767
|
};
|
|
765
|
-
}),
|
|
766
|
-
let e =
|
|
767
|
-
if (
|
|
768
|
+
}), pr = () => {
|
|
769
|
+
let e = K.value;
|
|
770
|
+
if (K.value = null, e && e.moved) {
|
|
768
771
|
let t = {
|
|
769
772
|
x: Math.min(e.start.x, e.current.x),
|
|
770
773
|
y: Math.min(e.start.y, e.current.y),
|
|
771
774
|
w: Math.abs(e.current.x - e.start.x),
|
|
772
775
|
h: Math.abs(e.current.y - e.start.y)
|
|
773
|
-
}, n =
|
|
774
|
-
let n =
|
|
776
|
+
}, n = C.value.filter((e) => {
|
|
777
|
+
let n = L(e), r = e.x + n.x, i = e.y + n.y;
|
|
775
778
|
return !(r + n.width < t.x || r > t.x + t.w || i + n.height < t.y || i > t.y + t.h);
|
|
776
779
|
});
|
|
777
|
-
n.length && (
|
|
780
|
+
n.length && (R.value = V(R.value, n.map((e) => e.id), Nn.value), B()), Gn();
|
|
778
781
|
}
|
|
779
|
-
|
|
780
|
-
},
|
|
781
|
-
if (
|
|
782
|
+
Cr();
|
|
783
|
+
}, mr = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), hr = (e) => {
|
|
784
|
+
if (D.value) {
|
|
782
785
|
if (e.button === 1) {
|
|
783
786
|
if (v.config.enablePan === !1) return;
|
|
784
|
-
e.preventDefault(),
|
|
787
|
+
e.preventDefault(), sr(e);
|
|
785
788
|
return;
|
|
786
789
|
}
|
|
787
|
-
if (e.button === 0 && !
|
|
790
|
+
if (e.button === 0 && !mr(e.target)) {
|
|
788
791
|
if (e.ctrlKey || e.metaKey) {
|
|
789
792
|
if (v.config.enableMarquee === !1) return;
|
|
790
|
-
e.preventDefault(),
|
|
793
|
+
e.preventDefault(), ur(e);
|
|
791
794
|
return;
|
|
792
795
|
}
|
|
793
|
-
v.config.enablePan !== !1 && (e.preventDefault(),
|
|
796
|
+
v.config.enablePan !== !1 && (e.preventDefault(), sr(e));
|
|
794
797
|
}
|
|
795
798
|
}
|
|
796
|
-
},
|
|
797
|
-
|
|
798
|
-
let e =
|
|
799
|
-
|
|
800
|
-
},
|
|
801
|
-
|
|
802
|
-
}, yr = () => {
|
|
803
|
-
hr && (cancelAnimationFrame(hr), _r()), K.value && sr(), q.value && dr();
|
|
799
|
+
}, gr = !1, q = 0, _r = null, vr = () => {
|
|
800
|
+
q = 0;
|
|
801
|
+
let e = _r;
|
|
802
|
+
_r = null, e && (G.value ? cr(e) : K.value && dr(e));
|
|
803
|
+
}, yr = (e) => {
|
|
804
|
+
_r = e, q ||= requestAnimationFrame(vr);
|
|
804
805
|
}, br = () => {
|
|
805
|
-
|
|
806
|
+
q && (cancelAnimationFrame(q), vr()), G.value && lr(), K.value && pr();
|
|
806
807
|
}, xr = () => {
|
|
807
|
-
|
|
808
|
+
gr || (gr = !0, window.addEventListener("mousemove", yr, !0), window.addEventListener("mouseup", br, !0));
|
|
808
809
|
}, Sr = () => {
|
|
809
|
-
!
|
|
810
|
-
}, Cr =
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
if (
|
|
814
|
-
|
|
810
|
+
gr && (gr = !1, window.removeEventListener("mousemove", yr, !0), window.removeEventListener("mouseup", br, !0));
|
|
811
|
+
}, Cr = () => {
|
|
812
|
+
!G.value && !K.value && Sr();
|
|
813
|
+
}, wr = t(() => {
|
|
814
|
+
if (Y.value && Y.value.side) return { cursor: Qr(Y.value.side) };
|
|
815
|
+
if (K.value) return { cursor: "crosshair" };
|
|
816
|
+
if (G.value && G.value.moved) return { cursor: "grabbing" };
|
|
817
|
+
}), Tr = t(() => v.config.showGrid !== !1), Er = t(() => v.config.gridColor || "#1a2240"), Dr = t(() => {
|
|
815
818
|
let e = Number(v.config.gridStep);
|
|
816
|
-
return (Number.isFinite(e) && e > 0 ? e : 40) /
|
|
817
|
-
}),
|
|
819
|
+
return (Number.isFinite(e) && e > 0 ? e : 40) / Xn.value;
|
|
820
|
+
}), Or = t(() => {
|
|
818
821
|
let e = Number(v.config.gridOpacity);
|
|
819
822
|
return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : .5;
|
|
820
|
-
}),
|
|
823
|
+
}), kr = t(() => {
|
|
821
824
|
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) => ({
|
|
822
825
|
offset: e.offset == null ? t === 0 ? "0%" : "100%" : e.offset,
|
|
823
826
|
color: e.color,
|
|
@@ -837,100 +840,100 @@ var b = {
|
|
|
837
840
|
r: e.r || "60%",
|
|
838
841
|
stops: n
|
|
839
842
|
};
|
|
840
|
-
}),
|
|
843
|
+
}), Ar = t(() => v.config.showCenterPoint === !0), jr = t(() => v.config.showEdgeTextBg === !0), Mr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), Nr = t(() => v.config.showNodeHandles === !0), Pr = t(() => v.config.showStatusDot !== !1), Fr = (e, t) => {
|
|
841
844
|
let n = Number(e);
|
|
842
845
|
return Number.isFinite(n) && n >= 0 ? n : t;
|
|
843
|
-
},
|
|
846
|
+
}, Ir = t(() => {
|
|
844
847
|
let e = v.config.motionFx ?? v.config.fx;
|
|
845
848
|
return typeof e == "boolean" ? e ? "all" : "none" : [
|
|
846
849
|
"none",
|
|
847
850
|
"flow",
|
|
848
851
|
"particle",
|
|
849
852
|
"all"
|
|
850
|
-
].includes(e) ? e :
|
|
851
|
-
}), Ir = t(() => {
|
|
852
|
-
let e = v.config.glowFx ?? v.config.fx;
|
|
853
|
-
return typeof e == "boolean" ? e : M.value.length <= Pr(v.config.fxGlowMaxEdges, 500);
|
|
853
|
+
].includes(e) ? e : j.value.length <= Fr(v.config.fxMotionMaxEdges, 200) ? "all" : "none";
|
|
854
854
|
}), Lr = t(() => {
|
|
855
|
+
let e = v.config.glowFx ?? v.config.fx;
|
|
856
|
+
return typeof e == "boolean" ? e : j.value.length <= Fr(v.config.fxGlowMaxEdges, 500);
|
|
857
|
+
}), Rr = t(() => {
|
|
855
858
|
let e = v.config.breatheFx ?? v.config.fx;
|
|
856
|
-
return typeof e == "boolean" ? e :
|
|
857
|
-
}),
|
|
859
|
+
return typeof e == "boolean" ? e : C.value.length <= Fr(v.config.fxBreatheMaxNodes, 300);
|
|
860
|
+
}), zr = (e) => {
|
|
858
861
|
if (e.animatedMode !== void 0) {
|
|
859
862
|
let t = e.animatedMode;
|
|
860
|
-
return !t || t === "all" ?
|
|
863
|
+
return !t || t === "all" ? Ir.value : t === "none" ? "none" : t;
|
|
861
864
|
}
|
|
862
|
-
return e.animated === void 0 || e.animated ?
|
|
863
|
-
},
|
|
865
|
+
return e.animated === void 0 || e.animated ? Ir.value : "none";
|
|
866
|
+
}, Br = (e) => e.borderColor || F(e) || "#94a3b8", Vr = (e) => e.borderWidth || 0, Hr = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, Ur = (e) => {
|
|
864
867
|
let t = e.borderRadius;
|
|
865
868
|
if (t == null || t === "") return 6;
|
|
866
869
|
let n = Number(t);
|
|
867
870
|
return Number.isFinite(n) && n >= 0 ? n : 6;
|
|
868
|
-
},
|
|
871
|
+
}, Wr = (e, t) => {
|
|
869
872
|
if (e.button !== 0 || !v.editable || v.config.nodeDraggable === !1) return;
|
|
870
873
|
e.stopPropagation();
|
|
871
|
-
let n =
|
|
872
|
-
if (
|
|
874
|
+
let n = P(t), r = Z(e);
|
|
875
|
+
if (qt.value = {
|
|
873
876
|
x: r.x - n.x,
|
|
874
877
|
y: r.y - n.y
|
|
875
|
-
},
|
|
878
|
+
}, Yt = {
|
|
876
879
|
x: e.clientX,
|
|
877
880
|
y: e.clientY
|
|
878
|
-
},
|
|
881
|
+
}, Xt = !1, Zt = !!(e.ctrlKey || e.metaKey), R.value.length > 1 && R.value.includes(t)) {
|
|
879
882
|
let e = {};
|
|
880
|
-
|
|
881
|
-
let n =
|
|
883
|
+
R.value.forEach((t) => {
|
|
884
|
+
let n = P(t);
|
|
882
885
|
n && (e[t] = {
|
|
883
886
|
x: n.x,
|
|
884
887
|
y: n.y
|
|
885
888
|
});
|
|
886
|
-
}),
|
|
889
|
+
}), Jt.value = {
|
|
887
890
|
origins: e,
|
|
888
891
|
start: {
|
|
889
892
|
x: r.x,
|
|
890
893
|
y: r.y
|
|
891
894
|
}
|
|
892
895
|
};
|
|
893
|
-
} else
|
|
894
|
-
|
|
895
|
-
},
|
|
896
|
-
|
|
896
|
+
} else Jt.value = null;
|
|
897
|
+
E.value = t, y("node-drag-start", n);
|
|
898
|
+
}, J = 0, Gr = null, Kr = () => {
|
|
899
|
+
J = 0;
|
|
897
900
|
let e = Gr;
|
|
898
901
|
Gr = null, e && Jr(e);
|
|
899
902
|
}, qr = (e) => {
|
|
900
|
-
(
|
|
903
|
+
(Y.value || E.value) && (Gr = {
|
|
901
904
|
clientX: e.clientX,
|
|
902
905
|
clientY: e.clientY
|
|
903
|
-
},
|
|
906
|
+
}, J ||= requestAnimationFrame(Kr));
|
|
904
907
|
}, Jr = (e) => {
|
|
905
|
-
if (
|
|
908
|
+
if (Y.value) {
|
|
906
909
|
ei(e);
|
|
907
910
|
return;
|
|
908
911
|
}
|
|
909
|
-
if (!
|
|
910
|
-
let t =
|
|
911
|
-
!
|
|
912
|
-
let n =
|
|
912
|
+
if (!E.value) return;
|
|
913
|
+
let t = Z(e);
|
|
914
|
+
!Xt && Yt && Math.hypot(e.clientX - Yt.x, e.clientY - Yt.y) > kt && (Xt = !0, !Zt && !R.value.includes(E.value) && (R.value = V([], [E.value], Nn.value), z.value = [], y("node-select", R.value.includes(E.value) ? P(E.value) : null), B()));
|
|
915
|
+
let n = Jt.value;
|
|
913
916
|
if (n) {
|
|
914
917
|
let e = t.x - n.start.x, r = t.y - n.start.y;
|
|
915
|
-
|
|
918
|
+
C.value = C.value.map((t) => n.origins[t.id] ? {
|
|
916
919
|
...t,
|
|
917
920
|
x: n.origins[t.id].x + e,
|
|
918
921
|
y: n.origins[t.id].y + r
|
|
919
922
|
} : t);
|
|
920
|
-
} else
|
|
923
|
+
} else C.value = C.value.map((e) => e.id === E.value ? {
|
|
921
924
|
...e,
|
|
922
|
-
x: t.x -
|
|
923
|
-
y: t.y -
|
|
925
|
+
x: t.x - qt.value.x,
|
|
926
|
+
y: t.y - qt.value.y
|
|
924
927
|
} : e);
|
|
925
|
-
|
|
928
|
+
w();
|
|
926
929
|
}, Yr = () => {
|
|
927
|
-
if (
|
|
930
|
+
if (J && (cancelAnimationFrame(J), Kr()), Y.value) {
|
|
928
931
|
ti();
|
|
929
932
|
return;
|
|
930
933
|
}
|
|
931
|
-
|
|
932
|
-
},
|
|
933
|
-
let t =
|
|
934
|
+
E.value && (Xt && Gn(), E.value = null, Jt.value = null, Yt = null, Xt = !1, y("node-drag-end"));
|
|
935
|
+
}, Y = d(null), Xr = (e, t, n) => Math.min(n, Math.max(t, e)), Zr = (e) => {
|
|
936
|
+
let t = L(e), n = t.x, r = t.y, i = t.x + t.width, a = t.y + t.height;
|
|
934
937
|
return [
|
|
935
938
|
{
|
|
936
939
|
side: "nw",
|
|
@@ -975,8 +978,8 @@ var b = {
|
|
|
975
978
|
];
|
|
976
979
|
}, Qr = (e) => e === "nw" || e === "se" ? "nwse-resize" : e === "ne" || e === "sw" ? "nesw-resize" : e === "n" || e === "s" ? "ns-resize" : "ew-resize", $r = (e, t, n) => {
|
|
977
980
|
if (!v.editable || v.config.nodeResizable === !1 || !t) return;
|
|
978
|
-
let { w: r, h: i } =
|
|
979
|
-
|
|
981
|
+
let { w: r, h: i } = I(t);
|
|
982
|
+
Y.value = {
|
|
980
983
|
id: t.id,
|
|
981
984
|
side: n,
|
|
982
985
|
anchorX: n.includes("e") ? t.x - r / 2 : n.includes("w") ? t.x + r / 2 : null,
|
|
@@ -985,35 +988,35 @@ var b = {
|
|
|
985
988
|
startH: i
|
|
986
989
|
}, y("node-resize-start", t);
|
|
987
990
|
}, ei = (e) => {
|
|
988
|
-
let t =
|
|
991
|
+
let t = Y.value;
|
|
989
992
|
if (!t) return;
|
|
990
|
-
let n =
|
|
993
|
+
let n = P(t.id);
|
|
991
994
|
if (!n) return;
|
|
992
|
-
let r =
|
|
995
|
+
let r = Z(e), i = t.startW, a = t.startH, o = n.x, s = n.y;
|
|
993
996
|
if (t.anchorX !== null) {
|
|
994
997
|
let e = t.side.includes("e");
|
|
995
|
-
i = Xr(e ? r.x - t.anchorX : t.anchorX - r.x,
|
|
998
|
+
i = Xr(e ? r.x - t.anchorX : t.anchorX - r.x, Pt, Ft), o = e ? t.anchorX + i / 2 : t.anchorX - i / 2;
|
|
996
999
|
}
|
|
997
1000
|
if (t.anchorY !== null) {
|
|
998
1001
|
let e = t.side.includes("s");
|
|
999
|
-
a = Xr(e ? r.y - t.anchorY : t.anchorY - r.y,
|
|
1002
|
+
a = Xr(e ? r.y - t.anchorY : t.anchorY - r.y, It, Lt), s = e ? t.anchorY + a / 2 : t.anchorY - a / 2;
|
|
1000
1003
|
}
|
|
1001
|
-
|
|
1004
|
+
C.value = C.value.map((e) => e.id === t.id ? {
|
|
1002
1005
|
...e,
|
|
1003
1006
|
x: o,
|
|
1004
1007
|
y: s,
|
|
1005
1008
|
width: i,
|
|
1006
1009
|
height: a
|
|
1007
|
-
} : e),
|
|
1010
|
+
} : e), w();
|
|
1008
1011
|
}, ti = () => {
|
|
1009
|
-
let e =
|
|
1010
|
-
|
|
1012
|
+
let e = Y.value;
|
|
1013
|
+
Y.value = null, e && (Gn(), y("node-resize-end", P(e.id) || null));
|
|
1011
1014
|
}, ni = t(() => v.editable && v.config.nodeResizable !== !1), ri = t(() => {
|
|
1012
1015
|
if (!ni.value) return null;
|
|
1013
|
-
let e =
|
|
1014
|
-
return e.length === 1 &&
|
|
1015
|
-
}),
|
|
1016
|
-
let t =
|
|
1016
|
+
let e = R.value;
|
|
1017
|
+
return e.length === 1 && P(e[0]) || null;
|
|
1018
|
+
}), X = d(null), ii = (e) => {
|
|
1019
|
+
let t = L(e);
|
|
1017
1020
|
return [
|
|
1018
1021
|
{
|
|
1019
1022
|
side: "top",
|
|
@@ -1037,7 +1040,7 @@ var b = {
|
|
|
1037
1040
|
}
|
|
1038
1041
|
];
|
|
1039
1042
|
}, ai = (e, t) => {
|
|
1040
|
-
let n =
|
|
1043
|
+
let n = D.value;
|
|
1041
1044
|
if (!n) return null;
|
|
1042
1045
|
let r = e, i = t;
|
|
1043
1046
|
if (e && typeof e == "object" && (r = e.clientX, i = e.clientY), r == null || i == null) return null;
|
|
@@ -1051,7 +1054,7 @@ var b = {
|
|
|
1051
1054
|
y: s.y
|
|
1052
1055
|
};
|
|
1053
1056
|
}, oi = (e, t) => {
|
|
1054
|
-
let n =
|
|
1057
|
+
let n = D.value;
|
|
1055
1058
|
if (!n) return null;
|
|
1056
1059
|
let r = n.createSVGPoint();
|
|
1057
1060
|
r.x = Number(e) || 0, r.y = Number(t) || 0;
|
|
@@ -1062,14 +1065,14 @@ var b = {
|
|
|
1062
1065
|
x: a.x,
|
|
1063
1066
|
y: a.y
|
|
1064
1067
|
};
|
|
1065
|
-
},
|
|
1068
|
+
}, Z = (e) => ai(e) ?? {
|
|
1066
1069
|
x: 0,
|
|
1067
1070
|
y: 0
|
|
1068
1071
|
}, si = (e, t, n) => {
|
|
1069
|
-
let r =
|
|
1070
|
-
if (!r || !
|
|
1071
|
-
let i =
|
|
1072
|
-
|
|
1072
|
+
let r = P(t);
|
|
1073
|
+
if (!r || !D.value) return;
|
|
1074
|
+
let i = Z(e);
|
|
1075
|
+
X.value = {
|
|
1073
1076
|
fromId: t,
|
|
1074
1077
|
side: n.side,
|
|
1075
1078
|
ax: r.x + n.x,
|
|
@@ -1081,42 +1084,42 @@ var b = {
|
|
|
1081
1084
|
try {
|
|
1082
1085
|
e.target.setPointerCapture?.(e.pointerId);
|
|
1083
1086
|
} catch {}
|
|
1084
|
-
|
|
1085
|
-
},
|
|
1086
|
-
|
|
1087
|
-
let e =
|
|
1088
|
-
|
|
1089
|
-
},
|
|
1090
|
-
|
|
1087
|
+
mi();
|
|
1088
|
+
}, ci = 0, li = null, ui = () => {
|
|
1089
|
+
ci = 0;
|
|
1090
|
+
let e = li;
|
|
1091
|
+
li = null, e && X.value && _i(e);
|
|
1092
|
+
}, di = (e) => {
|
|
1093
|
+
X.value && (li = {
|
|
1091
1094
|
clientX: e.clientX,
|
|
1092
1095
|
clientY: e.clientY
|
|
1093
|
-
},
|
|
1094
|
-
},
|
|
1095
|
-
|
|
1096
|
-
},
|
|
1097
|
-
|
|
1098
|
-
},
|
|
1099
|
-
|
|
1100
|
-
},
|
|
1101
|
-
let r =
|
|
1096
|
+
}, ci ||= requestAnimationFrame(ui));
|
|
1097
|
+
}, fi = () => {
|
|
1098
|
+
ci && (cancelAnimationFrame(ci), ui()), X.value && vi();
|
|
1099
|
+
}, pi = !1, mi = () => {
|
|
1100
|
+
pi || (pi = !0, window.addEventListener("mousemove", di, !0), window.addEventListener("mouseup", fi, !0));
|
|
1101
|
+
}, hi = () => {
|
|
1102
|
+
pi && (pi = !1, window.removeEventListener("mousemove", di, !0), window.removeEventListener("mouseup", fi, !0));
|
|
1103
|
+
}, gi = (e, t, n) => {
|
|
1104
|
+
let r = C.value;
|
|
1102
1105
|
for (let i = r.length - 1; i >= 0; i--) {
|
|
1103
1106
|
let a = r[i];
|
|
1104
1107
|
if (a.id === n) continue;
|
|
1105
|
-
let o =
|
|
1108
|
+
let o = L(a);
|
|
1106
1109
|
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;
|
|
1107
1110
|
}
|
|
1108
1111
|
return null;
|
|
1109
|
-
},
|
|
1110
|
-
let t =
|
|
1112
|
+
}, _i = (e) => {
|
|
1113
|
+
let t = X.value;
|
|
1111
1114
|
if (!t) return;
|
|
1112
|
-
let n =
|
|
1115
|
+
let n = Z(e);
|
|
1113
1116
|
t.px = n.x, t.py = n.y;
|
|
1114
|
-
let r =
|
|
1117
|
+
let r = gi(n.x, n.y, t.fromId);
|
|
1115
1118
|
t.overId = r ? r.id : null;
|
|
1116
|
-
},
|
|
1117
|
-
|
|
1118
|
-
let e =
|
|
1119
|
-
if (
|
|
1119
|
+
}, vi = () => {
|
|
1120
|
+
hi();
|
|
1121
|
+
let e = X.value;
|
|
1122
|
+
if (X.value = null, !e || !e.overId || e.overId === e.fromId) return;
|
|
1120
1123
|
let t = {
|
|
1121
1124
|
id: `${re()}`,
|
|
1122
1125
|
from: e.fromId,
|
|
@@ -1125,9 +1128,9 @@ var b = {
|
|
|
1125
1128
|
fromAnchor: "edge",
|
|
1126
1129
|
toAnchor: "edge"
|
|
1127
1130
|
};
|
|
1128
|
-
|
|
1129
|
-
},
|
|
1130
|
-
let r = e.x, i = e.y, a = t.x - r, o = t.y - i, { w: s, h: c } =
|
|
1131
|
+
O.value.push(t), y("edge-create", t);
|
|
1132
|
+
}, yi = (e, t, n) => {
|
|
1133
|
+
let r = e.x, i = e.y, a = t.x - r, o = t.y - i, { w: s, h: c } = I(e);
|
|
1131
1134
|
if (!n || n === "center" || a === 0 && o === 0) return {
|
|
1132
1135
|
x: r,
|
|
1133
1136
|
y: i
|
|
@@ -1137,20 +1140,20 @@ var b = {
|
|
|
1137
1140
|
x: r + a * p,
|
|
1138
1141
|
y: i + o * p
|
|
1139
1142
|
};
|
|
1140
|
-
},
|
|
1143
|
+
}, bi = t(() => {
|
|
1141
1144
|
let e = /* @__PURE__ */ new Map();
|
|
1142
|
-
|
|
1143
|
-
let n =
|
|
1145
|
+
j.value.forEach((t) => {
|
|
1146
|
+
let n = N.value[t.id];
|
|
1144
1147
|
n && !n.hidden && (e.has(n.key) || e.set(n.key, []), e.get(n.key).push(t));
|
|
1145
1148
|
});
|
|
1146
1149
|
let t = {};
|
|
1147
1150
|
return e.forEach((e, n) => {
|
|
1148
|
-
let [r, i] = n.split("__"), a =
|
|
1151
|
+
let [r, i] = n.split("__"), a = P(r), o = P(i);
|
|
1149
1152
|
if (!a || !o) return;
|
|
1150
1153
|
let s = o.x - a.x, c = o.y - a.y, l = Math.sqrt(s * s + c * c) || 1, u = s / l, d = c / l, f = -d, p = u, m = e.length, ee = Ot;
|
|
1151
1154
|
if (m > 1) {
|
|
1152
1155
|
let e = (m - 1) / 2 * Ot, t = (e) => {
|
|
1153
|
-
let { w: t, h: n } =
|
|
1156
|
+
let { w: t, h: n } = I(e);
|
|
1154
1157
|
return Math.max(4, (Math.abs(f) * t + Math.abs(p) * n) / 2 - 6);
|
|
1155
1158
|
}, n = Math.min(1, t(a) / e, t(o) / e);
|
|
1156
1159
|
ee = Ot * Math.max(.35, n);
|
|
@@ -1169,12 +1172,12 @@ var b = {
|
|
|
1169
1172
|
bulge: Math.min(l * .15, 50)
|
|
1170
1173
|
};
|
|
1171
1174
|
}), t;
|
|
1172
|
-
}),
|
|
1173
|
-
let t =
|
|
1175
|
+
}), xi = (e) => {
|
|
1176
|
+
let t = N.value[e.id], n = t && bi.value[t.key];
|
|
1174
1177
|
if (!n) return null;
|
|
1175
|
-
let r =
|
|
1178
|
+
let r = P(e.from), i = P(e.to);
|
|
1176
1179
|
if (!r || !i) return null;
|
|
1177
|
-
let a = n.slots[e.id] || 0, o = a * n.gap, s =
|
|
1180
|
+
let a = n.slots[e.id] || 0, o = a * n.gap, s = yi(r, i, e.fromAnchor), c = yi(i, r, e.toAnchor);
|
|
1178
1181
|
return {
|
|
1179
1182
|
frame: n,
|
|
1180
1183
|
slot: a,
|
|
@@ -1187,12 +1190,12 @@ var b = {
|
|
|
1187
1190
|
y: c.y + n.ny * o
|
|
1188
1191
|
}
|
|
1189
1192
|
};
|
|
1190
|
-
},
|
|
1191
|
-
let t =
|
|
1193
|
+
}, Si = (e) => {
|
|
1194
|
+
let t = xi(e);
|
|
1192
1195
|
if (!t) return "";
|
|
1193
1196
|
let { from: n, to: r, frame: i, slot: a } = t, o = a * i.gap;
|
|
1194
|
-
if (
|
|
1195
|
-
if (
|
|
1197
|
+
if (T.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
|
|
1198
|
+
if (T.value === "polyline") {
|
|
1196
1199
|
if (i.dominant === "v") {
|
|
1197
1200
|
let e = (n.y + r.y) / 2 + o;
|
|
1198
1201
|
return `M ${n.x} ${n.y} L ${n.x} ${e} L ${r.x} ${e} L ${r.x} ${r.y}`;
|
|
@@ -1202,18 +1205,18 @@ var b = {
|
|
|
1202
1205
|
}
|
|
1203
1206
|
let s = (n.x + r.x) / 2 + i.nx * i.bulge, c = (n.y + r.y) / 2 + i.ny * i.bulge;
|
|
1204
1207
|
return `M ${n.x} ${n.y} Q ${s} ${c} ${r.x} ${r.y}`;
|
|
1205
|
-
},
|
|
1206
|
-
let n =
|
|
1208
|
+
}, Ci = (e, t) => {
|
|
1209
|
+
let n = xi(e);
|
|
1207
1210
|
if (!n) return {
|
|
1208
1211
|
x: 0,
|
|
1209
1212
|
y: 0
|
|
1210
1213
|
};
|
|
1211
1214
|
let { from: r, to: i, frame: a, slot: o } = n, s = o * a.gap;
|
|
1212
|
-
if (
|
|
1215
|
+
if (T.value === "straight") return {
|
|
1213
1216
|
x: r.x + (i.x - r.x) * t,
|
|
1214
1217
|
y: r.y + (i.y - r.y) * t
|
|
1215
1218
|
};
|
|
1216
|
-
if (
|
|
1219
|
+
if (T.value === "polyline") {
|
|
1217
1220
|
if (a.dominant === "v") {
|
|
1218
1221
|
let e = (r.y + i.y) / 2 + s, n = Math.abs(e - r.y), a = Math.abs(i.x - r.x), o = Math.abs(i.y - e), c = t * (n + a + o || 1);
|
|
1219
1222
|
return c <= n ? {
|
|
@@ -1244,29 +1247,29 @@ var b = {
|
|
|
1244
1247
|
x: (1 - t) * (1 - t) * r.x + 2 * (1 - t) * t * c + t * t * i.x,
|
|
1245
1248
|
y: (1 - t) * (1 - t) * r.y + 2 * (1 - t) * t * l + t * t * i.y
|
|
1246
1249
|
};
|
|
1247
|
-
},
|
|
1248
|
-
let e =
|
|
1250
|
+
}, wi = t(() => X.value ? P(X.value.fromId) : null), Ti = t(() => X.value && X.value.overId ? P(X.value.overId) : null), Ei = t(() => wi.value ? F(wi.value) : "#00f0ff"), Di = t(() => {
|
|
1251
|
+
let e = X.value;
|
|
1249
1252
|
if (!e) return {
|
|
1250
1253
|
x: 0,
|
|
1251
1254
|
y: 0
|
|
1252
1255
|
};
|
|
1253
|
-
let t =
|
|
1254
|
-
return t &&
|
|
1256
|
+
let t = Ti.value;
|
|
1257
|
+
return t && wi.value ? yi(t, wi.value, "edge") : {
|
|
1255
1258
|
x: e.px,
|
|
1256
1259
|
y: e.py
|
|
1257
1260
|
};
|
|
1258
|
-
}),
|
|
1259
|
-
let e =
|
|
1261
|
+
}), Oi = t(() => {
|
|
1262
|
+
let e = Ti.value;
|
|
1260
1263
|
if (!e) return null;
|
|
1261
|
-
let t =
|
|
1264
|
+
let t = L(e);
|
|
1262
1265
|
return {
|
|
1263
1266
|
x: e.x + t.x - 4,
|
|
1264
1267
|
y: e.y + t.y - 4,
|
|
1265
1268
|
w: t.width + 8,
|
|
1266
1269
|
h: t.height + 8
|
|
1267
1270
|
};
|
|
1268
|
-
}),
|
|
1269
|
-
let t = e.nodeIds.map((e) =>
|
|
1271
|
+
}), ki = (e) => {
|
|
1272
|
+
let t = e.nodeIds.map((e) => P(e)).filter(Boolean);
|
|
1270
1273
|
if (t.length === 0) return null;
|
|
1271
1274
|
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;
|
|
1272
1275
|
return {
|
|
@@ -1275,120 +1278,120 @@ var b = {
|
|
|
1275
1278
|
width: a - r,
|
|
1276
1279
|
height: o - i
|
|
1277
1280
|
};
|
|
1278
|
-
},
|
|
1281
|
+
}, Ai = t(() => v.groups.map((e) => ({
|
|
1279
1282
|
...e,
|
|
1280
|
-
rect:
|
|
1281
|
-
})).filter((e) => e.rect)), Q = (e) =>
|
|
1282
|
-
let t =
|
|
1283
|
+
rect: ki(e)
|
|
1284
|
+
})).filter((e) => e.rect)), Q = (e) => jn(e) ? Hn.value : (P(e.from), e.centerText && e.centerText.color || "#00f0ff"), ji = (e) => {
|
|
1285
|
+
let t = N.value[e.id];
|
|
1283
1286
|
return !!t && !t.hidden;
|
|
1284
|
-
},
|
|
1287
|
+
}, Mi = t(() => [...new Set(j.value.map(Q))].map((e) => ({
|
|
1285
1288
|
key: String(e).replace("#", ""),
|
|
1286
1289
|
color: e
|
|
1287
|
-
}))),
|
|
1290
|
+
}))), Ni = (e) => {
|
|
1288
1291
|
let t = e.endMarker;
|
|
1289
1292
|
if (!t || t === "none") return "";
|
|
1290
1293
|
let n = Q(e) || "#00f0ff", r = String(n).replace("#", "");
|
|
1291
1294
|
return `url(#${t === "dot" ? "edge-dot" : "edge-arrow"}-${r})`;
|
|
1292
|
-
},
|
|
1295
|
+
}, Pi = /* @__PURE__ */ new Map(), Fi = {
|
|
1293
1296
|
nodes: null,
|
|
1294
1297
|
edges: null,
|
|
1295
1298
|
mode: null,
|
|
1296
1299
|
epoch: -1
|
|
1297
|
-
},
|
|
1298
|
-
let e =
|
|
1299
|
-
(e.nodes !==
|
|
1300
|
-
nodes:
|
|
1301
|
-
edges:
|
|
1302
|
-
mode:
|
|
1303
|
-
epoch:
|
|
1304
|
-
},
|
|
1300
|
+
}, Ii = () => {
|
|
1301
|
+
let e = Fi;
|
|
1302
|
+
(e.nodes !== C.value || e.edges !== j.value || e.mode !== T.value || e.epoch !== Rt) && (Fi = {
|
|
1303
|
+
nodes: C.value,
|
|
1304
|
+
edges: j.value,
|
|
1305
|
+
mode: T.value,
|
|
1306
|
+
epoch: Rt
|
|
1307
|
+
}, Pi = /* @__PURE__ */ new Map());
|
|
1305
1308
|
}, $ = (e) => {
|
|
1306
|
-
|
|
1307
|
-
let t =
|
|
1308
|
-
return t === void 0 && (t =
|
|
1309
|
-
},
|
|
1310
|
-
let t =
|
|
1309
|
+
Ii();
|
|
1310
|
+
let t = Pi.get(e.id);
|
|
1311
|
+
return t === void 0 && (t = Si(e), Pi.set(e.id, t)), t;
|
|
1312
|
+
}, Li = (e, t = 1) => `${2 / e.speed * t}s`, Ri = (e) => `${3 / e.speed}s`, zi = (e) => {
|
|
1313
|
+
let t = zr(e);
|
|
1311
1314
|
return t === "flow" || t === "all";
|
|
1312
|
-
},
|
|
1313
|
-
let t =
|
|
1315
|
+
}, Bi = (e) => {
|
|
1316
|
+
let t = zr(e);
|
|
1314
1317
|
return t === "particle" || t === "all";
|
|
1315
|
-
},
|
|
1318
|
+
}, Vi = (e) => Bt(e).text, Hi = (e) => !!e && String(Bt(e).text ?? "").trim() !== "", Ui = (e, t) => {
|
|
1316
1319
|
if (!e) return null;
|
|
1317
|
-
let n =
|
|
1320
|
+
let n = Bt(e), r = Number(t.fontSize) || Number(n.fontSize) || 8, i = String(n.text ?? ""), a = 0;
|
|
1318
1321
|
for (let e of i) a += e.charCodeAt(0) > 11904 ? 1 : .62;
|
|
1319
1322
|
return {
|
|
1320
1323
|
w: Math.max(14, a * r + 8),
|
|
1321
1324
|
h: Math.max(12, r + 6)
|
|
1322
1325
|
};
|
|
1323
|
-
},
|
|
1324
|
-
let n =
|
|
1326
|
+
}, Wi = (e, t) => {
|
|
1327
|
+
let n = Ci(e, Math.max(0, t - .005)), r = Ci(e, Math.min(1, t + .005));
|
|
1325
1328
|
return Math.atan2(r.y - n.y, r.x - n.x) * 180 / Math.PI;
|
|
1326
|
-
},
|
|
1329
|
+
}, Gi = (e) => {
|
|
1327
1330
|
let t = e % 180;
|
|
1328
1331
|
return t > 90 && (t -= 180), t < -90 && (t += 180), t;
|
|
1329
|
-
},
|
|
1332
|
+
}, Ki = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(Bt(e).rotation || 0) + (n || 0)})`, qi = t(() => {
|
|
1330
1333
|
let e = [];
|
|
1331
|
-
for (let t of
|
|
1332
|
-
let n =
|
|
1334
|
+
for (let t of W.value) {
|
|
1335
|
+
let n = N.value[t.id];
|
|
1333
1336
|
if (!n) continue;
|
|
1334
1337
|
let r = n.merged && n.representative, i = !n.merged && (t.fromText || t.centerText || t.toText);
|
|
1335
1338
|
if (!r && !i) continue;
|
|
1336
|
-
let a =
|
|
1339
|
+
let a = P(t.from), o = P(t.to);
|
|
1337
1340
|
a && o && e.push({
|
|
1338
1341
|
id: t.id,
|
|
1339
1342
|
edge: t,
|
|
1340
1343
|
info: n,
|
|
1341
1344
|
color: a && ie[a.nodeType] || "#00f0ff",
|
|
1342
|
-
start:
|
|
1343
|
-
center:
|
|
1344
|
-
end:
|
|
1345
|
-
startAngle: Wi(
|
|
1346
|
-
centerAngle: Wi(
|
|
1347
|
-
endAngle: Wi(
|
|
1348
|
-
fromBox:
|
|
1349
|
-
centerBox:
|
|
1350
|
-
toBox:
|
|
1345
|
+
start: Ci(t, .28),
|
|
1346
|
+
center: Ci(t, .5),
|
|
1347
|
+
end: Ci(t, .72),
|
|
1348
|
+
startAngle: Gi(Wi(t, .28)),
|
|
1349
|
+
centerAngle: Gi(Wi(t, .5)),
|
|
1350
|
+
endAngle: Gi(Wi(t, .72)),
|
|
1351
|
+
fromBox: Ui(t.fromText, t),
|
|
1352
|
+
centerBox: Ui(t.centerText, t),
|
|
1353
|
+
toBox: Ui(t.toText, t)
|
|
1351
1354
|
});
|
|
1352
1355
|
}
|
|
1353
1356
|
return e;
|
|
1354
1357
|
});
|
|
1355
1358
|
return te({
|
|
1356
|
-
resetDataBaseline:
|
|
1357
|
-
getData:
|
|
1358
|
-
setData:
|
|
1359
|
-
removeSelected:
|
|
1360
|
-
addNodes:
|
|
1361
|
-
addEdges:
|
|
1362
|
-
updateNodes:
|
|
1363
|
-
updateEdges:
|
|
1359
|
+
resetDataBaseline: sn,
|
|
1360
|
+
getData: cn,
|
|
1361
|
+
setData: mn,
|
|
1362
|
+
removeSelected: ln,
|
|
1363
|
+
addNodes: un,
|
|
1364
|
+
addEdges: dn,
|
|
1365
|
+
updateNodes: fn,
|
|
1366
|
+
updateEdges: pn,
|
|
1364
1367
|
clientToSvg: ai,
|
|
1365
1368
|
svgToClient: oi,
|
|
1366
|
-
moveLayerUp:
|
|
1367
|
-
moveLayerDown:
|
|
1368
|
-
moveToFront:
|
|
1369
|
-
moveToBack:
|
|
1370
|
-
downloadSVG:
|
|
1369
|
+
moveLayerUp: Ln,
|
|
1370
|
+
moveLayerDown: Rn,
|
|
1371
|
+
moveToFront: zn,
|
|
1372
|
+
moveToBack: Bn,
|
|
1373
|
+
downloadSVG: Vn
|
|
1371
1374
|
}), (t, c) => (u(), r("svg", {
|
|
1372
1375
|
ref_key: "svgRef",
|
|
1373
|
-
ref:
|
|
1376
|
+
ref: D,
|
|
1374
1377
|
class: "topology-svg",
|
|
1375
|
-
style: s(
|
|
1376
|
-
viewBox: `${
|
|
1377
|
-
onMousedown:
|
|
1378
|
+
style: s(wr.value),
|
|
1379
|
+
viewBox: `${$n.value} ${er.value} ${H.value} ${U.value}`,
|
|
1380
|
+
onMousedown: hr,
|
|
1378
1381
|
onMousemove: qr,
|
|
1379
1382
|
onMouseup: Yr,
|
|
1380
1383
|
onMouseleave: Yr,
|
|
1381
|
-
onClick:
|
|
1382
|
-
onWheel: g(
|
|
1384
|
+
onClick: Jn,
|
|
1385
|
+
onWheel: g(or, ["prevent"])
|
|
1383
1386
|
}, [
|
|
1384
1387
|
i("defs", null, [
|
|
1385
1388
|
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),
|
|
1386
1389
|
i("radialGradient", {
|
|
1387
1390
|
id: "bg-grid",
|
|
1388
|
-
cx:
|
|
1389
|
-
cy:
|
|
1390
|
-
r:
|
|
1391
|
-
}, [(u(!0), r(e, null, f(
|
|
1391
|
+
cx: kr.value.cx,
|
|
1392
|
+
cy: kr.value.cy,
|
|
1393
|
+
r: kr.value.r
|
|
1394
|
+
}, [(u(!0), r(e, null, f(kr.value.stops, (e, t) => (u(), r("stop", {
|
|
1392
1395
|
key: `bg-stop-${t}`,
|
|
1393
1396
|
offset: e.offset,
|
|
1394
1397
|
"stop-color": e.color,
|
|
@@ -1415,7 +1418,7 @@ var b = {
|
|
|
1415
1418
|
}, null, 8, de)
|
|
1416
1419
|
], 8, ce))), 128)),
|
|
1417
1420
|
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),
|
|
1418
|
-
(u(!0), r(e, null, f(
|
|
1421
|
+
(u(!0), r(e, null, f(Mi.value, (e) => (u(), r("marker", {
|
|
1419
1422
|
key: `m-arrow-${e.key}`,
|
|
1420
1423
|
id: `edge-arrow-${e.key}`,
|
|
1421
1424
|
viewBox: "0 0 10 10",
|
|
@@ -1429,7 +1432,7 @@ var b = {
|
|
|
1429
1432
|
d: "M1,2.5 L9,5 L1,7.5 Z",
|
|
1430
1433
|
fill: e.color
|
|
1431
1434
|
}, null, 8, pe)], 8, fe))), 128)),
|
|
1432
|
-
(u(!0), r(e, null, f(
|
|
1435
|
+
(u(!0), r(e, null, f(Mi.value, (e) => (u(), r("marker", {
|
|
1433
1436
|
key: `m-dot-${e.key}`,
|
|
1434
1437
|
id: `edge-dot-${e.key}`,
|
|
1435
1438
|
viewBox: "0 0 10 10",
|
|
@@ -1447,31 +1450,31 @@ var b = {
|
|
|
1447
1450
|
}, null, 8, he)], 8, me))), 128))
|
|
1448
1451
|
]),
|
|
1449
1452
|
i("rect", {
|
|
1450
|
-
width:
|
|
1451
|
-
height:
|
|
1452
|
-
x:
|
|
1453
|
-
y:
|
|
1453
|
+
width: H.value,
|
|
1454
|
+
height: U.value,
|
|
1455
|
+
x: $n.value,
|
|
1456
|
+
y: er.value,
|
|
1454
1457
|
fill: "url(#bg-grid)"
|
|
1455
1458
|
}, null, 8, ge),
|
|
1456
|
-
|
|
1459
|
+
Tr.value ? (u(), r(e, { key: 0 }, [i("pattern", {
|
|
1457
1460
|
id: "grid",
|
|
1458
|
-
width:
|
|
1459
|
-
height:
|
|
1461
|
+
width: Dr.value,
|
|
1462
|
+
height: Dr.value,
|
|
1460
1463
|
patternUnits: "userSpaceOnUse"
|
|
1461
1464
|
}, [i("path", {
|
|
1462
|
-
d: `M ${
|
|
1465
|
+
d: `M ${Dr.value} 0 L 0 0 0 ${Dr.value}`,
|
|
1463
1466
|
fill: "none",
|
|
1464
|
-
stroke:
|
|
1467
|
+
stroke: Er.value,
|
|
1465
1468
|
"stroke-width": "0.5"
|
|
1466
1469
|
}, null, 8, ve)], 8, _e), i("rect", {
|
|
1467
|
-
width:
|
|
1468
|
-
height:
|
|
1469
|
-
x:
|
|
1470
|
-
y:
|
|
1470
|
+
width: H.value,
|
|
1471
|
+
height: U.value,
|
|
1472
|
+
x: $n.value,
|
|
1473
|
+
y: er.value,
|
|
1471
1474
|
fill: "url(#grid)",
|
|
1472
|
-
opacity:
|
|
1475
|
+
opacity: Or.value
|
|
1473
1476
|
}, null, 8, ye)], 64)) : n("", !0),
|
|
1474
|
-
|
|
1477
|
+
Ar.value ? (u(), r("g", be, [...c[5] ||= [
|
|
1475
1478
|
i("line", {
|
|
1476
1479
|
x1: "-22",
|
|
1477
1480
|
y1: "0",
|
|
@@ -1503,7 +1506,7 @@ var b = {
|
|
|
1503
1506
|
opacity: "0.8"
|
|
1504
1507
|
}, null, -1)
|
|
1505
1508
|
]])) : n("", !0),
|
|
1506
|
-
(u(!0), r(e, null, f(
|
|
1509
|
+
(u(!0), r(e, null, f(Ai.value, (e) => (u(), r("g", { key: e.id }, [
|
|
1507
1510
|
i("rect", {
|
|
1508
1511
|
x: e.rect.x,
|
|
1509
1512
|
y: e.rect.y,
|
|
@@ -1565,16 +1568,16 @@ var b = {
|
|
|
1565
1568
|
"letter-spacing": "0.5"
|
|
1566
1569
|
}, m(e.label), 9, De)
|
|
1567
1570
|
]))), 128)),
|
|
1568
|
-
(u(!0), r(e, null, f(
|
|
1571
|
+
(u(!0), r(e, null, f(W.value, (e) => (u(), r("path", {
|
|
1569
1572
|
key: `base-${e.id}`,
|
|
1570
1573
|
d: $(e),
|
|
1571
1574
|
fill: "none",
|
|
1572
1575
|
stroke: "#1a2744",
|
|
1573
1576
|
"stroke-width": "2",
|
|
1574
1577
|
"stroke-linecap": "round",
|
|
1575
|
-
"marker-end":
|
|
1578
|
+
"marker-end": Ni(e)
|
|
1576
1579
|
}, null, 8, Oe))), 128)),
|
|
1577
|
-
(u(!0), r(e, null, f(
|
|
1580
|
+
(u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [Lr.value ? (u(), r("path", {
|
|
1578
1581
|
key: 0,
|
|
1579
1582
|
d: $(t),
|
|
1580
1583
|
fill: "none",
|
|
@@ -1584,16 +1587,16 @@ var b = {
|
|
|
1584
1587
|
opacity: "0.15",
|
|
1585
1588
|
filter: "url(#glow-strong)"
|
|
1586
1589
|
}, null, 8, ke)) : n("", !0)], 64))), 128)),
|
|
1587
|
-
(u(!0), r(e, null, f(
|
|
1590
|
+
(u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [jn(t) ? (u(), r("path", {
|
|
1588
1591
|
key: 0,
|
|
1589
1592
|
d: $(t),
|
|
1590
1593
|
fill: "none",
|
|
1591
|
-
stroke:
|
|
1594
|
+
stroke: Hn.value,
|
|
1592
1595
|
"stroke-width": "4",
|
|
1593
1596
|
opacity: "0.35",
|
|
1594
1597
|
filter: "url(#glow-strong)"
|
|
1595
1598
|
}, null, 8, Ae)) : n("", !0)], 64))), 128)),
|
|
1596
|
-
(u(!0), r(e, null, f(
|
|
1599
|
+
(u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [zi(t) ? (u(), r("g", je, [
|
|
1597
1600
|
i("path", {
|
|
1598
1601
|
d: $(t),
|
|
1599
1602
|
fill: "none",
|
|
@@ -1606,7 +1609,7 @@ var b = {
|
|
|
1606
1609
|
attributeName: "stroke-dashoffset",
|
|
1607
1610
|
from: "0",
|
|
1608
1611
|
to: "-52",
|
|
1609
|
-
dur:
|
|
1612
|
+
dur: Li(t),
|
|
1610
1613
|
repeatCount: "indefinite"
|
|
1611
1614
|
}, null, 8, Ne)], 8, Me),
|
|
1612
1615
|
i("path", {
|
|
@@ -1621,7 +1624,7 @@ var b = {
|
|
|
1621
1624
|
attributeName: "stroke-dashoffset",
|
|
1622
1625
|
from: "-30",
|
|
1623
1626
|
to: "-82",
|
|
1624
|
-
dur:
|
|
1627
|
+
dur: Li(t, 1.3),
|
|
1625
1628
|
repeatCount: "indefinite"
|
|
1626
1629
|
}, null, 8, Fe)], 8, Pe),
|
|
1627
1630
|
i("path", {
|
|
@@ -1637,18 +1640,18 @@ var b = {
|
|
|
1637
1640
|
attributeName: "stroke-dashoffset",
|
|
1638
1641
|
from: "0",
|
|
1639
1642
|
to: "-84",
|
|
1640
|
-
dur:
|
|
1643
|
+
dur: Li(t, .8),
|
|
1641
1644
|
repeatCount: "indefinite"
|
|
1642
1645
|
}, null, 8, Le)], 8, Ie)
|
|
1643
1646
|
])) : n("", !0)], 64))), 128)),
|
|
1644
|
-
(u(!0), r(e, null, f(
|
|
1647
|
+
(u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [Bi(t) ? (u(), r("g", Re, [i("circle", {
|
|
1645
1648
|
r: "3",
|
|
1646
1649
|
fill: Q(t),
|
|
1647
1650
|
opacity: "0.9",
|
|
1648
1651
|
filter: "url(#glow-core)"
|
|
1649
1652
|
}, [i("animateMotion", {
|
|
1650
1653
|
path: $(t),
|
|
1651
|
-
dur:
|
|
1654
|
+
dur: Ri(t),
|
|
1652
1655
|
repeatCount: "indefinite"
|
|
1653
1656
|
}, null, 8, Be)], 8, ze), i("circle", {
|
|
1654
1657
|
r: "8",
|
|
@@ -1657,17 +1660,17 @@ var b = {
|
|
|
1657
1660
|
filter: "url(#glow-strong)"
|
|
1658
1661
|
}, [i("animateMotion", {
|
|
1659
1662
|
path: $(t),
|
|
1660
|
-
dur:
|
|
1663
|
+
dur: Ri(t),
|
|
1661
1664
|
repeatCount: "indefinite"
|
|
1662
1665
|
}, null, 8, He)], 8, Ve)])) : n("", !0)], 64))), 128)),
|
|
1663
|
-
(u(!0), r(e, null, f(
|
|
1666
|
+
(u(!0), r(e, null, f(qi.value, (t) => (u(), r(e, { key: `text-${t.id}` }, [t.info.merged && t.info.representative ? (u(), r("g", {
|
|
1664
1667
|
key: 0,
|
|
1665
1668
|
transform: `translate(${t.center.x}, ${t.center.y}) rotate(${t.centerAngle})`
|
|
1666
1669
|
}, [i("rect", {
|
|
1667
1670
|
x: "-7",
|
|
1668
|
-
y: -
|
|
1671
|
+
y: -Wt(t.edge, null) / 2,
|
|
1669
1672
|
width: 14,
|
|
1670
|
-
height:
|
|
1673
|
+
height: Wt(t.edge, null),
|
|
1671
1674
|
rx: "2",
|
|
1672
1675
|
fill: "#FFFFFF",
|
|
1673
1676
|
opacity: "0.9",
|
|
@@ -1677,121 +1680,121 @@ var b = {
|
|
|
1677
1680
|
y: "0",
|
|
1678
1681
|
"dominant-baseline": "central",
|
|
1679
1682
|
"text-anchor": "middle",
|
|
1680
|
-
"font-size":
|
|
1681
|
-
fill:
|
|
1683
|
+
"font-size": Wt(t.edge, null),
|
|
1684
|
+
fill: S(t.edge, null),
|
|
1682
1685
|
"font-family": "'SF Mono', monospace",
|
|
1683
1686
|
opacity: "1"
|
|
1684
1687
|
}, m(t.info.count), 9, Ge)], 8, Ue)) : t.info.merged ? n("", !0) : (u(), r("g", Ke, [
|
|
1685
|
-
|
|
1688
|
+
Hi(t.edge.fromText) ? (u(), r("g", {
|
|
1686
1689
|
key: 0,
|
|
1687
|
-
transform:
|
|
1688
|
-
}, [
|
|
1690
|
+
transform: Ki(t.edge.fromText, t.start, t.startAngle)
|
|
1691
|
+
}, [jr.value ? (u(), r("rect", {
|
|
1689
1692
|
key: 0,
|
|
1690
1693
|
x: -t.fromBox.w / 2,
|
|
1691
1694
|
y: -t.fromBox.h / 2,
|
|
1692
1695
|
width: t.fromBox.w,
|
|
1693
1696
|
height: t.fromBox.h,
|
|
1694
1697
|
rx: "3",
|
|
1695
|
-
fill:
|
|
1698
|
+
fill: Mr.value,
|
|
1696
1699
|
opacity: "0.92",
|
|
1697
|
-
stroke:
|
|
1700
|
+
stroke: S(t.edge, t.edge.fromText),
|
|
1698
1701
|
"stroke-opacity": "0.35",
|
|
1699
1702
|
"stroke-width": "0.6"
|
|
1700
1703
|
}, null, 8, Je)) : n("", !0), i("text", {
|
|
1701
1704
|
y: "0",
|
|
1702
1705
|
"dominant-baseline": "central",
|
|
1703
1706
|
"text-anchor": "middle",
|
|
1704
|
-
"font-size":
|
|
1705
|
-
fill:
|
|
1707
|
+
"font-size": Wt(t.edge, t.edge.fromText),
|
|
1708
|
+
fill: S(t.edge, t.edge.fromText),
|
|
1706
1709
|
"font-family": "'SF Mono', monospace",
|
|
1707
1710
|
"font-weight": "500",
|
|
1708
1711
|
opacity: "0.9"
|
|
1709
|
-
}, m(
|
|
1710
|
-
|
|
1712
|
+
}, m(Vi(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
|
|
1713
|
+
Hi(t.edge.centerText) ? (u(), r("g", {
|
|
1711
1714
|
key: 1,
|
|
1712
|
-
transform:
|
|
1713
|
-
}, [
|
|
1715
|
+
transform: Ki(t.edge.centerText, t.center, t.centerAngle)
|
|
1716
|
+
}, [jr.value ? (u(), r("rect", {
|
|
1714
1717
|
key: 0,
|
|
1715
1718
|
x: -t.centerBox.w / 2,
|
|
1716
1719
|
y: -t.centerBox.h / 2,
|
|
1717
1720
|
width: t.centerBox.w,
|
|
1718
1721
|
height: t.centerBox.h,
|
|
1719
1722
|
rx: "3",
|
|
1720
|
-
fill:
|
|
1723
|
+
fill: Mr.value,
|
|
1721
1724
|
opacity: "0.92",
|
|
1722
|
-
stroke:
|
|
1725
|
+
stroke: S(t.edge, t.edge.centerText),
|
|
1723
1726
|
"stroke-opacity": "0.35",
|
|
1724
1727
|
"stroke-width": "0.6"
|
|
1725
1728
|
}, null, 8, Ze)) : n("", !0), i("text", {
|
|
1726
1729
|
y: "0",
|
|
1727
1730
|
"dominant-baseline": "central",
|
|
1728
1731
|
"text-anchor": "middle",
|
|
1729
|
-
"font-size":
|
|
1730
|
-
fill:
|
|
1732
|
+
"font-size": Wt(t.edge, t.edge.centerText),
|
|
1733
|
+
fill: S(t.edge, t.edge.centerText),
|
|
1731
1734
|
"font-family": "'SF Mono', monospace",
|
|
1732
1735
|
"font-weight": "600",
|
|
1733
1736
|
opacity: "1"
|
|
1734
|
-
}, m(
|
|
1735
|
-
|
|
1737
|
+
}, m(Vi(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
|
|
1738
|
+
Hi(t.edge.toText) ? (u(), r("g", {
|
|
1736
1739
|
key: 2,
|
|
1737
|
-
transform:
|
|
1738
|
-
}, [
|
|
1740
|
+
transform: Ki(t.edge.toText, t.end, t.endAngle)
|
|
1741
|
+
}, [jr.value ? (u(), r("rect", {
|
|
1739
1742
|
key: 0,
|
|
1740
1743
|
x: -t.toBox.w / 2,
|
|
1741
1744
|
y: -t.toBox.h / 2,
|
|
1742
1745
|
width: t.toBox.w,
|
|
1743
1746
|
height: t.toBox.h,
|
|
1744
1747
|
rx: "3",
|
|
1745
|
-
fill:
|
|
1748
|
+
fill: Mr.value,
|
|
1746
1749
|
opacity: "0.92",
|
|
1747
|
-
stroke:
|
|
1750
|
+
stroke: S(t.edge, t.edge.toText),
|
|
1748
1751
|
"stroke-opacity": "0.35",
|
|
1749
1752
|
"stroke-width": "0.6"
|
|
1750
1753
|
}, null, 8, et)) : n("", !0), i("text", {
|
|
1751
1754
|
y: "0",
|
|
1752
1755
|
"dominant-baseline": "central",
|
|
1753
1756
|
"text-anchor": "middle",
|
|
1754
|
-
"font-size":
|
|
1755
|
-
fill:
|
|
1757
|
+
"font-size": Wt(t.edge, t.edge.toText),
|
|
1758
|
+
fill: S(t.edge, t.edge.toText),
|
|
1756
1759
|
"font-family": "'SF Mono', monospace",
|
|
1757
1760
|
"font-weight": "500",
|
|
1758
1761
|
opacity: "0.9"
|
|
1759
|
-
}, m(
|
|
1762
|
+
}, m(Vi(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
|
|
1760
1763
|
]))], 64))), 128)),
|
|
1761
|
-
|
|
1764
|
+
X.value ? (u(), r("g", nt, [
|
|
1762
1765
|
i("line", {
|
|
1763
|
-
x1:
|
|
1764
|
-
y1:
|
|
1765
|
-
x2:
|
|
1766
|
-
y2:
|
|
1767
|
-
stroke:
|
|
1766
|
+
x1: X.value.ax,
|
|
1767
|
+
y1: X.value.ay,
|
|
1768
|
+
x2: Di.value.x,
|
|
1769
|
+
y2: Di.value.y,
|
|
1770
|
+
stroke: Ei.value,
|
|
1768
1771
|
"stroke-width": "2",
|
|
1769
1772
|
"stroke-dasharray": "6 6",
|
|
1770
1773
|
"stroke-linecap": "round",
|
|
1771
1774
|
opacity: "0.9"
|
|
1772
1775
|
}, null, 8, rt),
|
|
1773
1776
|
i("circle", {
|
|
1774
|
-
cx:
|
|
1775
|
-
cy:
|
|
1777
|
+
cx: X.value.px,
|
|
1778
|
+
cy: X.value.py,
|
|
1776
1779
|
r: "3.5",
|
|
1777
|
-
fill:
|
|
1780
|
+
fill: Ei.value,
|
|
1778
1781
|
opacity: "0.9"
|
|
1779
1782
|
}, null, 8, it),
|
|
1780
|
-
|
|
1783
|
+
X.value.overId && Oi.value ? (u(), r("rect", {
|
|
1781
1784
|
key: 0,
|
|
1782
|
-
x:
|
|
1783
|
-
y:
|
|
1784
|
-
width:
|
|
1785
|
-
height:
|
|
1785
|
+
x: Oi.value.x,
|
|
1786
|
+
y: Oi.value.y,
|
|
1787
|
+
width: Oi.value.w,
|
|
1788
|
+
height: Oi.value.h,
|
|
1786
1789
|
rx: "6",
|
|
1787
1790
|
fill: "none",
|
|
1788
|
-
stroke:
|
|
1791
|
+
stroke: Ei.value,
|
|
1789
1792
|
"stroke-width": "1.5",
|
|
1790
1793
|
"stroke-dasharray": "6 4",
|
|
1791
1794
|
opacity: "0.9"
|
|
1792
1795
|
}, null, 8, at)) : n("", !0)
|
|
1793
1796
|
])) : n("", !0),
|
|
1794
|
-
(u(!0), r(e, null, f(
|
|
1797
|
+
(u(!0), r(e, null, f(W.value, (e) => (u(), r("path", {
|
|
1795
1798
|
key: `hit-${e.id}`,
|
|
1796
1799
|
d: $(e),
|
|
1797
1800
|
fill: "none",
|
|
@@ -1801,100 +1804,104 @@ var b = {
|
|
|
1801
1804
|
"pointer-events": "stroke",
|
|
1802
1805
|
cursor: "pointer"
|
|
1803
1806
|
},
|
|
1804
|
-
onClick: g((t) =>
|
|
1807
|
+
onClick: g((t) => Un(e, t), ["stop"])
|
|
1805
1808
|
}, null, 8, ot))), 128)),
|
|
1806
|
-
(u(!0), r(e, null, f(
|
|
1809
|
+
(u(!0), r(e, null, f(ar.value, (a) => (u(), r("g", {
|
|
1807
1810
|
key: a.id,
|
|
1808
1811
|
transform: `translate(${a.x}, ${a.y})`,
|
|
1809
|
-
class: o(["topology-node",
|
|
1810
|
-
onMousedown: (e) =>
|
|
1811
|
-
onClick: (e) =>
|
|
1812
|
+
class: o(["topology-node", E.value === a.id ? "dragging" : ""]),
|
|
1813
|
+
onMousedown: (e) => Wr(e, a.id),
|
|
1814
|
+
onClick: (e) => In(a, e),
|
|
1812
1815
|
style: s({
|
|
1813
1816
|
cursor: v.editable && v.config.nodeDraggable !== !1 ? "grab" : "default",
|
|
1814
|
-
color:
|
|
1817
|
+
color: F(a)
|
|
1815
1818
|
})
|
|
1816
1819
|
}, [
|
|
1817
1820
|
i("rect", {
|
|
1818
1821
|
class: "node-hit-area",
|
|
1819
|
-
x:
|
|
1820
|
-
y:
|
|
1821
|
-
width:
|
|
1822
|
-
height:
|
|
1822
|
+
x: En(a).x,
|
|
1823
|
+
y: En(a).y,
|
|
1824
|
+
width: En(a).width,
|
|
1825
|
+
height: En(a).height,
|
|
1823
1826
|
fill: "transparent",
|
|
1824
1827
|
"pointer-events": "all"
|
|
1825
1828
|
}, null, 8, ct),
|
|
1826
|
-
|
|
1829
|
+
kn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
|
|
1827
1830
|
key: 0,
|
|
1828
|
-
x:
|
|
1829
|
-
y:
|
|
1830
|
-
width:
|
|
1831
|
-
height:
|
|
1832
|
-
rx:
|
|
1833
|
-
fill:
|
|
1831
|
+
x: L(a).x,
|
|
1832
|
+
y: L(a).y,
|
|
1833
|
+
width: L(a).width,
|
|
1834
|
+
height: L(a).height,
|
|
1835
|
+
rx: Ur(a),
|
|
1836
|
+
fill: kn(a),
|
|
1834
1837
|
opacity: "0.15"
|
|
1835
1838
|
}, null, 8, lt)) : n("", !0),
|
|
1836
|
-
|
|
1839
|
+
On(a) && _.viewMode !== "3d" ? (u(), r("rect", {
|
|
1837
1840
|
key: 1,
|
|
1838
|
-
x:
|
|
1839
|
-
y:
|
|
1840
|
-
width:
|
|
1841
|
-
height:
|
|
1842
|
-
rx:
|
|
1841
|
+
x: On(a).x,
|
|
1842
|
+
y: On(a).y,
|
|
1843
|
+
width: On(a).width,
|
|
1844
|
+
height: On(a).height,
|
|
1845
|
+
rx: Ur(a),
|
|
1843
1846
|
fill: "none",
|
|
1844
|
-
stroke:
|
|
1845
|
-
"stroke-width":
|
|
1846
|
-
"stroke-dasharray":
|
|
1847
|
+
stroke: Br(a),
|
|
1848
|
+
"stroke-width": Vr(a),
|
|
1849
|
+
"stroke-dasharray": Hr(a),
|
|
1847
1850
|
opacity: "0.8"
|
|
1848
1851
|
}, null, 8, ut)) : n("", !0),
|
|
1849
|
-
|
|
1852
|
+
An(a) && _.viewMode !== "3d" ? (u(), r("rect", {
|
|
1850
1853
|
key: 2,
|
|
1851
|
-
x:
|
|
1852
|
-
y:
|
|
1853
|
-
width:
|
|
1854
|
-
height:
|
|
1855
|
-
rx:
|
|
1854
|
+
x: L(a).x,
|
|
1855
|
+
y: L(a).y,
|
|
1856
|
+
width: L(a).width,
|
|
1857
|
+
height: L(a).height,
|
|
1858
|
+
rx: Ur(a),
|
|
1856
1859
|
fill: "none",
|
|
1857
|
-
stroke:
|
|
1860
|
+
stroke: Fn.value,
|
|
1858
1861
|
"stroke-width": "2.5",
|
|
1859
1862
|
transform: "scale(1.1)",
|
|
1860
1863
|
style: { "pointer-events": "none" }
|
|
1861
1864
|
}, null, 8, dt)) : n("", !0),
|
|
1862
|
-
|
|
1865
|
+
_n(a) ? (u(), r(e, { key: 3 }, [i("rect", {
|
|
1863
1866
|
x: "-4",
|
|
1864
1867
|
y: "-10",
|
|
1865
1868
|
width: "8",
|
|
1866
1869
|
height: "20",
|
|
1867
|
-
fill:
|
|
1870
|
+
fill: gn(a).color,
|
|
1868
1871
|
opacity: "0.06"
|
|
1869
1872
|
}, null, 8, ft), i("text", {
|
|
1870
1873
|
y: "4",
|
|
1871
1874
|
transform: `rotate(${a.rotation || 0} 0 4)`,
|
|
1872
1875
|
"text-anchor": "middle",
|
|
1873
|
-
fill: Ht(a) ||
|
|
1876
|
+
fill: Ht(a) || F(a) || gn(a).color,
|
|
1874
1877
|
"font-size": Vt(a, 12),
|
|
1875
1878
|
"font-family": "'SF Mono', 'Cascadia Code', 'Consolas', monospace",
|
|
1876
1879
|
"font-weight": "600"
|
|
1877
|
-
}, m(a.label), 9, pt)], 64)) :
|
|
1878
|
-
|
|
1880
|
+
}, m(a.label), 9, pt)], 64)) : vn(a) ? (u(), r(e, { key: 4 }, [], 64)) : (u(), r(e, { key: 5 }, [
|
|
1881
|
+
a.state !== "none" && Rr.value ? (u(), r("circle", {
|
|
1879
1882
|
key: 0,
|
|
1880
|
-
r:
|
|
1883
|
+
r: xn(a),
|
|
1881
1884
|
fill: "none",
|
|
1882
|
-
stroke:
|
|
1885
|
+
stroke: gn(a).color,
|
|
1883
1886
|
"stroke-width": "2.5",
|
|
1884
1887
|
opacity: "0"
|
|
1885
|
-
}, [
|
|
1888
|
+
}, [i("animate", {
|
|
1886
1889
|
attributeName: "r",
|
|
1887
|
-
values:
|
|
1890
|
+
values: `${xn(a)};${xn(a) * 1.6};${xn(a)}`,
|
|
1888
1891
|
dur: "2s",
|
|
1889
1892
|
repeatCount: "indefinite"
|
|
1890
|
-
}, null,
|
|
1893
|
+
}, null, 8, ht), c[6] ||= i("animate", {
|
|
1891
1894
|
attributeName: "opacity",
|
|
1892
1895
|
values: "0.4;0.05;0.4",
|
|
1893
1896
|
dur: "2s",
|
|
1894
1897
|
repeatCount: "indefinite"
|
|
1895
|
-
}, null, -1)]
|
|
1898
|
+
}, null, -1)], 8, mt)) : n("", !0),
|
|
1899
|
+
i("g", {
|
|
1900
|
+
class: "node-icon",
|
|
1901
|
+
transform: Sn(a)
|
|
1902
|
+
}, [p(t.$slots, "node-icon", {
|
|
1896
1903
|
node: a,
|
|
1897
|
-
color:
|
|
1904
|
+
color: F(a),
|
|
1898
1905
|
viewMode: _.viewMode
|
|
1899
1906
|
}, () => [i("rect", {
|
|
1900
1907
|
x: "-18",
|
|
@@ -1902,21 +1909,21 @@ var b = {
|
|
|
1902
1909
|
width: "36",
|
|
1903
1910
|
height: "36",
|
|
1904
1911
|
rx: "6",
|
|
1905
|
-
fill:
|
|
1912
|
+
fill: F(a),
|
|
1906
1913
|
opacity: "0.9"
|
|
1907
|
-
}, null, 8, _t)])]
|
|
1908
|
-
|
|
1909
|
-
key:
|
|
1910
|
-
transform:
|
|
1914
|
+
}, null, 8, _t)])], 8, gt),
|
|
1915
|
+
Pr.value ? (u(), r("g", {
|
|
1916
|
+
key: 1,
|
|
1917
|
+
transform: Cn(a)
|
|
1911
1918
|
}, [i("circle", {
|
|
1912
1919
|
r: "4",
|
|
1913
|
-
fill:
|
|
1920
|
+
fill: gn(a).color,
|
|
1914
1921
|
stroke: "#0a0e1a",
|
|
1915
1922
|
"stroke-width": "2"
|
|
1916
1923
|
}, null, 8, yt)], 8, vt)) : n("", !0),
|
|
1917
1924
|
i("text", {
|
|
1918
|
-
y:
|
|
1919
|
-
transform: `rotate(${a.rotation || 0} 0 ${
|
|
1925
|
+
y: Tn(a),
|
|
1926
|
+
transform: `rotate(${a.rotation || 0} 0 ${Tn(a)})`,
|
|
1920
1927
|
"text-anchor": "middle",
|
|
1921
1928
|
fill: Ht(a),
|
|
1922
1929
|
"font-size": Vt(a),
|
|
@@ -1929,20 +1936,20 @@ var b = {
|
|
|
1929
1936
|
dy: t === 0 ? 0 : "1.2em"
|
|
1930
1937
|
}, m(e), 9, xt))), 128))], 8, bt)
|
|
1931
1938
|
], 64)),
|
|
1932
|
-
|
|
1939
|
+
Nr.value ? (u(), r("g", St, [(u(!0), r(e, null, f(ii(a), (e) => (u(), r("circle", {
|
|
1933
1940
|
key: e.side,
|
|
1934
1941
|
cx: e.x,
|
|
1935
1942
|
cy: e.y,
|
|
1936
1943
|
r: "4.5",
|
|
1937
1944
|
class: "node-handle",
|
|
1938
1945
|
fill: "#0a0e1a",
|
|
1939
|
-
stroke:
|
|
1946
|
+
stroke: F(a),
|
|
1940
1947
|
"stroke-width": "1.5",
|
|
1941
1948
|
onPointerdown: g((t) => si(t, a.id, e), ["stop", "prevent"]),
|
|
1942
|
-
onPointermove: g(
|
|
1943
|
-
onPointerup: g(
|
|
1944
|
-
onPointercancel: g(
|
|
1945
|
-
onLostpointercapture:
|
|
1949
|
+
onPointermove: g(_i, ["stop"]),
|
|
1950
|
+
onPointerup: g(vi, ["stop"]),
|
|
1951
|
+
onPointercancel: g(vi, ["stop"]),
|
|
1952
|
+
onLostpointercapture: vi,
|
|
1946
1953
|
onMousedown: c[0] ||= g(() => {}, ["stop", "prevent"]),
|
|
1947
1954
|
onClick: c[1] ||= g(() => {}, ["stop"])
|
|
1948
1955
|
}, null, 40, Ct))), 128))])) : n("", !0)
|
|
@@ -1958,20 +1965,20 @@ var b = {
|
|
|
1958
1965
|
onMousedown: g((t) => $r(t, ri.value, e.side), ["stop", "prevent"]),
|
|
1959
1966
|
onClick: c[2] ||= g(() => {}, ["stop"])
|
|
1960
1967
|
}, null, 42, Tt))), 128))])) : n("", !0),
|
|
1961
|
-
|
|
1968
|
+
K.value ? (u(), r("rect", {
|
|
1962
1969
|
key: 4,
|
|
1963
1970
|
class: "marquee-box",
|
|
1964
|
-
x:
|
|
1965
|
-
y:
|
|
1966
|
-
width:
|
|
1967
|
-
height:
|
|
1971
|
+
x: fr.value.x,
|
|
1972
|
+
y: fr.value.y,
|
|
1973
|
+
width: fr.value.width,
|
|
1974
|
+
height: fr.value.height,
|
|
1968
1975
|
rx: "2",
|
|
1969
1976
|
"vector-effect": "non-scaling-stroke"
|
|
1970
1977
|
}, null, 8, Et)) : n("", !0)
|
|
1971
1978
|
], 44, ae));
|
|
1972
1979
|
}
|
|
1973
|
-
},
|
|
1974
|
-
e.component("Topology",
|
|
1980
|
+
}, zt = { install(e) {
|
|
1981
|
+
e.component("Topology", Rt);
|
|
1975
1982
|
} };
|
|
1976
1983
|
//#endregion
|
|
1977
|
-
export {
|
|
1984
|
+
export { Rt as Topology, zt as default, ie as nodeColors, b as nodeStates };
|