@ankhzet/graph 0.3.0 → 0.3.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/CHANGELOG.md +14 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +250 -250
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/graph/Viewport.tsx +9 -9
package/dist/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { DisposableEventSource as e } from "@ankhzet/gcl";
|
|
2
2
|
import { debounce as t, isLike as n, matchId as r } from "@ankhzet/utils";
|
|
3
|
-
import {
|
|
4
|
-
import { Styles as
|
|
5
|
-
import { observer as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { reaction as
|
|
3
|
+
import { useEffect as i, useImperativeHandle as a, useLayoutEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
4
|
+
import { Styles as u, handleAsNoop as d, useDrag as f, useIsomorphicLayoutEffect as p, useLastCallback as m, useMeasure as h, usePrevious as g, useSyncStore as _ } from "@ankhzet/ui";
|
|
5
|
+
import { observer as v } from "mobx-react-lite";
|
|
6
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
7
|
+
import { reaction as x } from "mobx";
|
|
8
8
|
//#region \0rolldown/runtime.js
|
|
9
|
-
var
|
|
9
|
+
var S = Object.defineProperty, C = Object.getOwnPropertyDescriptor, w = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, E = (e, t) => {
|
|
10
10
|
let n = {};
|
|
11
|
-
for (var r in e)
|
|
11
|
+
for (var r in e) S(n, r, {
|
|
12
12
|
get: e[r],
|
|
13
13
|
enumerable: !0
|
|
14
14
|
});
|
|
15
|
-
return t ||
|
|
16
|
-
},
|
|
17
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i =
|
|
15
|
+
return t || S(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
16
|
+
}, D = (e, t, n, r) => {
|
|
17
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = w(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !T.call(e, s) && s !== n && S(e, s, {
|
|
18
18
|
get: ((e) => t[e]).bind(null, s),
|
|
19
|
-
enumerable: !(r =
|
|
19
|
+
enumerable: !(r = C(t, s)) || r.enumerable
|
|
20
20
|
});
|
|
21
21
|
return e;
|
|
22
|
-
},
|
|
22
|
+
}, O = (e, t, n) => (D(e, t, "default"), n && D(n, t, "default")), k = (e, t, n = 1) => ({
|
|
23
23
|
x: ~~(e.x + t.x * n),
|
|
24
24
|
y: ~~(e.y + t.y * n)
|
|
25
|
-
}),
|
|
25
|
+
}), A = (e, t) => (n) => n.node === e && n.port === t, ee = (e) => (t) => t.node === e, j = (e, t, n) => {
|
|
26
26
|
if (n) for (let r of n) {
|
|
27
|
-
let n = t.nodes.findIndex(
|
|
27
|
+
let n = t.nodes.findIndex(A(r.node, r.port));
|
|
28
28
|
n >= 0 !== e && (e ? t.nodes.push(r) : t.nodes.splice(n, 1));
|
|
29
29
|
}
|
|
30
30
|
else e || (t.nodes = []);
|
|
31
|
-
},
|
|
31
|
+
}, te = (e, t, n, r, i, a, o, s) => {
|
|
32
32
|
if (e === n && t === r || i === o && a === s) return !1;
|
|
33
33
|
let c = (s - a) * (n - e) - (o - i) * (r - t);
|
|
34
34
|
if (c === 0) return !1;
|
|
@@ -37,7 +37,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
37
37
|
x: e + l * (n - e),
|
|
38
38
|
y: t + l * (r - t)
|
|
39
39
|
};
|
|
40
|
-
},
|
|
40
|
+
}, M = class {
|
|
41
41
|
joints = /* @__PURE__ */ new Map();
|
|
42
42
|
parentId;
|
|
43
43
|
constructor(e, t) {
|
|
@@ -64,16 +64,16 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
64
64
|
return !!this.getPort(e, t);
|
|
65
65
|
}
|
|
66
66
|
hasAtPort(e, t, n) {
|
|
67
|
-
return !!this.joints.get(e)?.nodes.some(
|
|
67
|
+
return !!this.joints.get(e)?.nodes.some(A(t, n));
|
|
68
68
|
}
|
|
69
69
|
getPort(e, t) {
|
|
70
|
-
let n = this.find(t === void 0 ? (t) => t.nodes.some(
|
|
70
|
+
let n = this.find(t === void 0 ? (t) => t.nodes.some(ee(e)) : (n) => n.nodes.some(A(e, t)));
|
|
71
71
|
if (n) return n.port;
|
|
72
72
|
}
|
|
73
73
|
connect({ port: e, target: t, connect: n }) {
|
|
74
74
|
let r = this.joints.get(e);
|
|
75
75
|
if (!r) throw Error(`Node ${this.parentId} does not have joint "${e}"`);
|
|
76
|
-
return
|
|
76
|
+
return j(n, r, t), r;
|
|
77
77
|
}
|
|
78
78
|
getNodes(e) {
|
|
79
79
|
return this.joints.get(e)?.nodes;
|
|
@@ -86,7 +86,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
86
86
|
get count() {
|
|
87
87
|
return this.joints.size;
|
|
88
88
|
}
|
|
89
|
-
},
|
|
89
|
+
}, N = Symbol("E_CONNECT"), ne = Symbol("E_MOVE"), re = class extends e {
|
|
90
90
|
id;
|
|
91
91
|
description;
|
|
92
92
|
inputs;
|
|
@@ -97,7 +97,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
97
97
|
y: 0
|
|
98
98
|
};
|
|
99
99
|
constructor({ id: e, coordinator: t, inputs: n = [], outputs: r = [], ...i }) {
|
|
100
|
-
super(), this.id = e, this.coordinator = t, this.description = i, this.inputs = new
|
|
100
|
+
super(), this.id = e, this.coordinator = t, this.description = i, this.inputs = new M(e, n), this.outputs = new M(e, r);
|
|
101
101
|
}
|
|
102
102
|
get title() {
|
|
103
103
|
return this.description.title;
|
|
@@ -112,7 +112,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
112
112
|
return this.#e;
|
|
113
113
|
}
|
|
114
114
|
set position({ x: e, y: t }) {
|
|
115
|
-
e = this.coordinator.snap(e), t = this.coordinator.snap(t), !(this.#e.x === e && this.#e.y === t) && (this.#e.x = e, this.#e.y = t, this.dispatchEvent(
|
|
115
|
+
e = this.coordinator.snap(e), t = this.coordinator.snap(t), !(this.#e.x === e && this.#e.y === t) && (this.#e.x = e, this.#e.y = t, this.dispatchEvent(ne, this.#e));
|
|
116
116
|
}
|
|
117
117
|
isInput(e, t, n) {
|
|
118
118
|
return this.inputs.hasAtPort(e, t, n);
|
|
@@ -154,7 +154,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
154
154
|
nodes: a
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
this.dispatchEvent(
|
|
157
|
+
this.dispatchEvent(N, {
|
|
158
158
|
connect: t,
|
|
159
159
|
input: e,
|
|
160
160
|
source: i,
|
|
@@ -165,12 +165,12 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
165
165
|
return this.position = e, this.position;
|
|
166
166
|
}
|
|
167
167
|
onConnect(e) {
|
|
168
|
-
return this.handleEvent(
|
|
168
|
+
return this.handleEvent(N, e);
|
|
169
169
|
}
|
|
170
170
|
onMove(e) {
|
|
171
|
-
return this.handleEvent(
|
|
171
|
+
return this.handleEvent(ne, e);
|
|
172
172
|
}
|
|
173
|
-
},
|
|
173
|
+
}, P = class {
|
|
174
174
|
_barriers = {};
|
|
175
175
|
_isBarrier;
|
|
176
176
|
map;
|
|
@@ -231,7 +231,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
231
231
|
y: (i.y - r.y) / 2
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
-
},
|
|
234
|
+
}, ie = class extends P {
|
|
235
235
|
layers = [];
|
|
236
236
|
hash = null;
|
|
237
237
|
get center() {
|
|
@@ -304,7 +304,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
304
304
|
if (n && !1 === t(n)) break;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
},
|
|
307
|
+
}, ae = class extends P {
|
|
308
308
|
cache = {};
|
|
309
309
|
hash = null;
|
|
310
310
|
get center() {
|
|
@@ -337,7 +337,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
337
337
|
}
|
|
338
338
|
return this.hash = null, a;
|
|
339
339
|
}
|
|
340
|
-
},
|
|
340
|
+
}, oe = class {
|
|
341
341
|
sort(e) {
|
|
342
342
|
let t = {}, n = {}, r = [];
|
|
343
343
|
for (let i of e) {
|
|
@@ -389,7 +389,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
389
389
|
leafs: r
|
|
390
390
|
};
|
|
391
391
|
}
|
|
392
|
-
},
|
|
392
|
+
}, se = class {
|
|
393
393
|
sort(e, t, n) {
|
|
394
394
|
let r = n.pop();
|
|
395
395
|
for (let e of r);
|
|
@@ -402,7 +402,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
402
402
|
}
|
|
403
403
|
return n;
|
|
404
404
|
}
|
|
405
|
-
},
|
|
405
|
+
}, ce = class {
|
|
406
406
|
isBarrier;
|
|
407
407
|
klass;
|
|
408
408
|
constructor(e, t) {
|
|
@@ -414,7 +414,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
414
414
|
getSubGraphs(e) {
|
|
415
415
|
return new this.klass(e, this.isBarrier).getSubGraphs();
|
|
416
416
|
}
|
|
417
|
-
},
|
|
417
|
+
}, F = Symbol("changed"), I = class extends e {
|
|
418
418
|
all;
|
|
419
419
|
map = {};
|
|
420
420
|
constructor(e = []) {
|
|
@@ -422,7 +422,7 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
422
422
|
}
|
|
423
423
|
clear() {
|
|
424
424
|
let e = this.all;
|
|
425
|
-
this.all = [], this.map = {}, this.dispatchEvent(
|
|
425
|
+
this.all = [], this.map = {}, this.dispatchEvent(F, {
|
|
426
426
|
diff: e,
|
|
427
427
|
added: !1
|
|
428
428
|
});
|
|
@@ -439,43 +439,43 @@ var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, ee = Object.
|
|
|
439
439
|
add(e) {
|
|
440
440
|
let t = Array.isArray(e) ? e : [e], n = [];
|
|
441
441
|
for (let e of t) this.all.includes(e) || (n.push(e), this.map[e.id] = e);
|
|
442
|
-
return n.length && (this.all = this.all.concat(n), this.dispatchEvent(
|
|
442
|
+
return n.length && (this.all = this.all.concat(n), this.dispatchEvent(F)), e;
|
|
443
443
|
}
|
|
444
444
|
remove(e) {
|
|
445
445
|
Array.isArray(e) || (e = [e]);
|
|
446
446
|
let t = this.all.filter((t) => !e.includes(t.id));
|
|
447
447
|
if (t.length !== this.all.length) {
|
|
448
448
|
for (let t of e) delete this.map[t];
|
|
449
|
-
this.all = t, this.dispatchEvent(
|
|
449
|
+
this.all = t, this.dispatchEvent(F);
|
|
450
450
|
}
|
|
451
451
|
return this;
|
|
452
452
|
}
|
|
453
453
|
onChange(e) {
|
|
454
|
-
return this.handleEvent(
|
|
454
|
+
return this.handleEvent(F, e);
|
|
455
455
|
}
|
|
456
|
-
},
|
|
457
|
-
function
|
|
458
|
-
let [[t, n]] =
|
|
456
|
+
}, L = (e, t) => e === t ? !0 : e.length === t.length ? e.every((e, n) => e.id === t[n]?.id) : !1;
|
|
457
|
+
function R(e) {
|
|
458
|
+
let [[t, n]] = l(() => {
|
|
459
459
|
let t = e();
|
|
460
460
|
return [t, [
|
|
461
461
|
(e) => t.onChange(e),
|
|
462
462
|
() => t.all,
|
|
463
463
|
() => t.all,
|
|
464
464
|
(e) => e,
|
|
465
|
-
|
|
465
|
+
L
|
|
466
466
|
]];
|
|
467
467
|
});
|
|
468
|
-
return
|
|
468
|
+
return o(() => () => {
|
|
469
469
|
for (let e of t.all) e.dispose();
|
|
470
|
-
}, []), [t,
|
|
470
|
+
}, []), [t, _(...n)];
|
|
471
471
|
}
|
|
472
472
|
//#endregion
|
|
473
473
|
//#region src/graph/useDraggable.tsx
|
|
474
|
-
var
|
|
475
|
-
let t = e.position, [n, r] =
|
|
474
|
+
var le = (e) => {
|
|
475
|
+
let t = e.position, [n, r] = l(() => ({
|
|
476
476
|
x: t.x,
|
|
477
477
|
y: t.y
|
|
478
|
-
})), { isDragging: i, bind: a } =
|
|
478
|
+
})), { isDragging: i, bind: a } = f(({ isDragging: t, offset: i, pos: a, move: o, up: s, down: c, context: l, e: u }) => {
|
|
479
479
|
let { x: d, y: f } = e.position;
|
|
480
480
|
s ? (r({
|
|
481
481
|
x: d,
|
|
@@ -501,28 +501,28 @@ var P = (e) => {
|
|
|
501
501
|
isDragging: i,
|
|
502
502
|
bind: a,
|
|
503
503
|
anchor: n,
|
|
504
|
-
reset:
|
|
504
|
+
reset: m((t) => {
|
|
505
505
|
e.onDrag(t), r(t);
|
|
506
506
|
})
|
|
507
507
|
};
|
|
508
|
-
},
|
|
509
|
-
import * as
|
|
510
|
-
|
|
511
|
-
import * as
|
|
512
|
-
|
|
513
|
-
import * as
|
|
514
|
-
|
|
515
|
-
import * as
|
|
516
|
-
|
|
517
|
-
import * as
|
|
518
|
-
|
|
519
|
-
import * as
|
|
520
|
-
|
|
521
|
-
import * as
|
|
522
|
-
|
|
508
|
+
}, z = /* @__PURE__ */ E({});
|
|
509
|
+
import * as ue from "@pixi/core";
|
|
510
|
+
O(z, ue);
|
|
511
|
+
import * as de from "@pixi/display";
|
|
512
|
+
O(z, de);
|
|
513
|
+
import * as fe from "@pixi/sprite";
|
|
514
|
+
O(z, fe);
|
|
515
|
+
import * as pe from "@pixi/graphics";
|
|
516
|
+
O(z, pe);
|
|
517
|
+
import * as me from "@pixi/text";
|
|
518
|
+
O(z, me);
|
|
519
|
+
import * as he from "@pixi/text-bitmap";
|
|
520
|
+
O(z, he);
|
|
521
|
+
import * as ge from "@pixi/events";
|
|
522
|
+
O(z, ge);
|
|
523
523
|
//#endregion
|
|
524
524
|
//#region src/graph/render/Batch.ts
|
|
525
|
-
var
|
|
525
|
+
var _e = class extends e {
|
|
526
526
|
counter;
|
|
527
527
|
constructor() {
|
|
528
528
|
super(), this.counter = 0;
|
|
@@ -543,12 +543,12 @@ var I = class extends e {
|
|
|
543
543
|
and(e) {
|
|
544
544
|
return this.handleEvent(".", e);
|
|
545
545
|
}
|
|
546
|
-
},
|
|
546
|
+
}, ve = [
|
|
547
547
|
[0, -1],
|
|
548
548
|
[-1, 0],
|
|
549
549
|
[0, 1],
|
|
550
550
|
[1, 0]
|
|
551
|
-
],
|
|
551
|
+
], ye = Math.PI * 2, be = Math.PI / 2, xe = class extends z.Graphics {
|
|
552
552
|
sizeX;
|
|
553
553
|
sizeY;
|
|
554
554
|
lineSize;
|
|
@@ -560,10 +560,10 @@ var I = class extends e {
|
|
|
560
560
|
#n;
|
|
561
561
|
#r;
|
|
562
562
|
constructor(e, { lineSize: t, sizeX: n, sizeY: r, radius: i, color: a }) {
|
|
563
|
-
super(), this.lineSize = t, this.color = a, this.sizeX = n, this.sizeY = r, this.#t = new
|
|
563
|
+
super(), this.lineSize = t, this.color = a, this.sizeX = n, this.sizeY = r, this.#t = new z.Graphics().lineStyle({
|
|
564
564
|
width: t,
|
|
565
565
|
color: a
|
|
566
|
-
}).drawRoundedRect(0, 0, n, r, i), this.#e = new
|
|
566
|
+
}).drawRoundedRect(0, 0, n, r, i), this.#e = new z.Graphics(), this.#e.position.set(n / 2, r / 2), this.#t.mask = this.#e, this.addChild(e), this.addChild(this.#t), this.addChild(this.#e), this.progress = 0;
|
|
567
567
|
let o = this.sizeX / 2, s = this.sizeY / 2, c = -o + this.lineSize, l = -s + this.lineSize, u = +o - this.lineSize, d = +s - this.lineSize, f = [
|
|
568
568
|
[
|
|
569
569
|
c,
|
|
@@ -615,11 +615,11 @@ var I = class extends e {
|
|
|
615
615
|
}
|
|
616
616
|
update(e) {
|
|
617
617
|
this.progress = e;
|
|
618
|
-
let t = e *
|
|
618
|
+
let t = e * ye % ye, n = Math.cos(t - be) * this.sizeX * 2, r = Math.sin(t - be) * this.sizeY * 2, i, a = null, o = 0;
|
|
619
619
|
for (let e = 0; e < this.#r.segments.length; e++) {
|
|
620
|
-
let t = this.#r.segments[e], s =
|
|
620
|
+
let t = this.#r.segments[e], s = te(0, 0, n, r, t[0], t[1], t[2], t[3]);
|
|
621
621
|
if (s) {
|
|
622
|
-
a = s, o = e === 0 ? s.x > 0 ? 0 : 4 : 4 - e, i =
|
|
622
|
+
a = s, o = e === 0 ? s.x > 0 ? 0 : 4 : 4 - e, i = ve[e];
|
|
623
623
|
break;
|
|
624
624
|
}
|
|
625
625
|
}
|
|
@@ -629,7 +629,7 @@ var I = class extends e {
|
|
|
629
629
|
this.#e.lineTo(a.x + i[0] * this.lineSize * 2, a.y + i[1] * this.lineSize * 2).lineTo(a.x, a.y).lineTo(0, 0).endFill();
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
|
-
}, B = class extends
|
|
632
|
+
}, B = class extends z.Graphics {
|
|
633
633
|
from;
|
|
634
634
|
to;
|
|
635
635
|
angled = !1;
|
|
@@ -637,7 +637,7 @@ var I = class extends e {
|
|
|
637
637
|
#e;
|
|
638
638
|
#t = 2;
|
|
639
639
|
constructor(e, t, n, r, i = 2) {
|
|
640
|
-
super(), this.#e = i, this.from = new
|
|
640
|
+
super(), this.#e = i, this.from = new z.ObservablePoint(() => this.update(), 0, e, t), this.to = new z.ObservablePoint(() => this.update(), 0, n, r), this.eventMode = "none";
|
|
641
641
|
}
|
|
642
642
|
moveFromPoint(e) {
|
|
643
643
|
let t = this.from.x !== e.x || this.from.y !== e.y;
|
|
@@ -657,11 +657,11 @@ var I = class extends e {
|
|
|
657
657
|
let { x: e, y: t } = this.from, { x: n, y: r } = this.to, i = n - e, a = r - t, o = i / 2, s = a / 2;
|
|
658
658
|
return this.clear(), this.lineStyle(this.#t, this.color, this.alpha), this.x = n - o, this.y = r - s, this.angled ? (this.moveTo(-o, -s), this.lineTo(0, -s), this.lineTo(0, s), this.lineTo(o, s)) : (this.moveTo(-o, -s), this.lineTo(o, s)), this.#e && (this.beginFill(this.color, this.alpha), this.drawCircle(-o, -s, this.#e / 2), this.drawCircle(o, s, this.#e / 2), this.endFill()), this;
|
|
659
659
|
}
|
|
660
|
-
},
|
|
660
|
+
}, Se = class extends z.Graphics {
|
|
661
661
|
from;
|
|
662
662
|
to;
|
|
663
663
|
constructor(e, t) {
|
|
664
|
-
super(), this.from = new
|
|
664
|
+
super(), this.from = new z.Point(e, t), this.to = {};
|
|
665
665
|
for (let e of Object.values(this.to)) this.addChild(e);
|
|
666
666
|
}
|
|
667
667
|
addTarget(e, t) {
|
|
@@ -696,13 +696,13 @@ var I = class extends e {
|
|
|
696
696
|
if (t.hover) {
|
|
697
697
|
let a = r === t.point.parent || i === t.point.input ? 2 : 1;
|
|
698
698
|
if (a && n) {
|
|
699
|
-
let n = e.point.nodes.some(
|
|
699
|
+
let n = e.point.nodes.some(A(t.point.parent, t.point.port)), r = t.point.nodes.some(A(e.point.parent, e.point.port));
|
|
700
700
|
return n && r ? 1 : 0;
|
|
701
701
|
}
|
|
702
702
|
return a;
|
|
703
703
|
}
|
|
704
704
|
return 0;
|
|
705
|
-
}, Ee = (e, t) => e.parent === t.parent && e.port === t.port, De = class extends
|
|
705
|
+
}, Ee = (e, t) => e.parent === t.parent && e.port === t.port, De = class extends z.Graphics {
|
|
706
706
|
line1;
|
|
707
707
|
line2;
|
|
708
708
|
line12;
|
|
@@ -727,7 +727,7 @@ var I = class extends e {
|
|
|
727
727
|
setPosition(e) {
|
|
728
728
|
return this.x = e.x, this.y = e.y, this;
|
|
729
729
|
}
|
|
730
|
-
}, Oe = class extends
|
|
730
|
+
}, Oe = class extends Se {
|
|
731
731
|
start;
|
|
732
732
|
finish;
|
|
733
733
|
viable;
|
|
@@ -768,8 +768,8 @@ var I = class extends e {
|
|
|
768
768
|
}
|
|
769
769
|
return !1;
|
|
770
770
|
}
|
|
771
|
-
},
|
|
772
|
-
static makeFont = (e, t, n) => typeof document < "u" &&
|
|
771
|
+
}, V = class extends z.Container {
|
|
772
|
+
static makeFont = (e, t, n) => typeof document < "u" && z.BitmapFont.from(e, t, {
|
|
773
773
|
chars: [
|
|
774
774
|
["a", "z"],
|
|
775
775
|
["A", "Z"],
|
|
@@ -787,7 +787,7 @@ var I = class extends e {
|
|
|
787
787
|
fontName: e
|
|
788
788
|
}));
|
|
789
789
|
constructor(e, t) {
|
|
790
|
-
super(), this.#e = this.addChild(new
|
|
790
|
+
super(), this.#e = this.addChild(new z.BitmapText(String(e), t));
|
|
791
791
|
}
|
|
792
792
|
set text(e) {
|
|
793
793
|
this.#e.text = String(e);
|
|
@@ -798,10 +798,10 @@ var I = class extends e {
|
|
|
798
798
|
set tint(e) {
|
|
799
799
|
this.#e.tint = e;
|
|
800
800
|
}
|
|
801
|
-
},
|
|
801
|
+
}, H = Symbol.for("E_PORT_CLICK"), U = Symbol.for("E_PORT_HOVER"), ke = class t extends z.Graphics {
|
|
802
802
|
connectorPoint;
|
|
803
803
|
hasBothLanes;
|
|
804
|
-
static port =
|
|
804
|
+
static port = V.factory("nodePort", {
|
|
805
805
|
fontFamily: ["Menlo", "monospace"],
|
|
806
806
|
fontSize: 16,
|
|
807
807
|
lineHeight: 20,
|
|
@@ -813,11 +813,11 @@ var I = class extends e {
|
|
|
813
813
|
super(), this.connectorPoint = e, this.hasBothLanes = n, this.#t = !!e.nodes.length, this.x = e.x, this.y = e.y;
|
|
814
814
|
let r = e.input ? 1 : -1, i = this.addChild(t.port(this.label, { fontSize: 8 }));
|
|
815
815
|
i.y = -4, i.x = r * 12 - (e.input ? 0 : i.width), i.eventMode = "none", this.lineStyle(1, 3355443, 1), this.beginFill(this.#t ? 11184810 : 16777215), this.drawCircle(0, 0, 8 / 2), this.endFill(), this.eventMode = "static", this.cursor = "pointer", this.addEventListener("pointerdown", (e) => {
|
|
816
|
-
e.preventDefault(), e.stopPropagation(), this.#e.dispatchEvent(
|
|
816
|
+
e.preventDefault(), e.stopPropagation(), this.#e.dispatchEvent(H, e);
|
|
817
817
|
}), this.addEventListener("pointerenter", (e) => {
|
|
818
|
-
e.preventDefault(), e.stopPropagation(), this.#e.dispatchEvent(
|
|
818
|
+
e.preventDefault(), e.stopPropagation(), this.#e.dispatchEvent(U, !0);
|
|
819
819
|
}), this.addEventListener("pointerleave", (e) => {
|
|
820
|
-
e.preventDefault(), e.stopPropagation(), this.#e.dispatchEvent(
|
|
820
|
+
e.preventDefault(), e.stopPropagation(), this.#e.dispatchEvent(U, !1);
|
|
821
821
|
});
|
|
822
822
|
}
|
|
823
823
|
get label() {
|
|
@@ -836,23 +836,23 @@ var I = class extends e {
|
|
|
836
836
|
this.beginFill(this.active ? 11184810 : 16777215), this.drawCircle(0, 0, 8 / 2), this.endFill();
|
|
837
837
|
}
|
|
838
838
|
onClick(e) {
|
|
839
|
-
return this.#e.handleEvent(
|
|
839
|
+
return this.#e.handleEvent(H, e);
|
|
840
840
|
}
|
|
841
841
|
onHover(e) {
|
|
842
|
-
return this.#e.handleEvent(
|
|
842
|
+
return this.#e.handleEvent(U, e);
|
|
843
843
|
}
|
|
844
|
-
},
|
|
844
|
+
}, W = Symbol.for("E_MOVE_NODE"), G = Symbol.for("E_CAPTURE_NODE"), K = (e, t) => {
|
|
845
845
|
let n = e.global;
|
|
846
846
|
return t ? (t.x = n.x, t.y = n.y, t) : {
|
|
847
847
|
x: n.x,
|
|
848
848
|
y: n.y
|
|
849
849
|
};
|
|
850
|
-
},
|
|
850
|
+
}, Ae = (e) => e.__drag_root ? e : e.parent && Ae(e.parent);
|
|
851
851
|
function je(e) {
|
|
852
852
|
return function(t) {
|
|
853
853
|
if (e.dispatchEvent(G, !0), t.buttons & 2) return;
|
|
854
854
|
let n = this._drag_meta = {
|
|
855
|
-
root:
|
|
855
|
+
root: Ae(this.parent) || (() => {
|
|
856
856
|
throw Error("Can't find scene root");
|
|
857
857
|
})(),
|
|
858
858
|
emitter: e,
|
|
@@ -878,7 +878,7 @@ function je(e) {
|
|
|
878
878
|
var Me = (e) => (t) => {
|
|
879
879
|
if (!e._drag_meta?.dragging) return;
|
|
880
880
|
let { newPosition: n, lastPosition: r, anchor: i, emitter: a } = e._drag_meta;
|
|
881
|
-
K(t, n), n.x -= r.x, n.y -= r.y, a.dispatchEvent(
|
|
881
|
+
K(t, n), n.x -= r.x, n.y -= r.y, a.dispatchEvent(W, {
|
|
882
882
|
x: i.x + n.x,
|
|
883
883
|
y: i.y + n.y
|
|
884
884
|
});
|
|
@@ -886,8 +886,8 @@ var Me = (e) => (t) => {
|
|
|
886
886
|
if (!e._drag_meta) return;
|
|
887
887
|
let { root: t, emitter: n, onDragEnd: r, onDragMove: i } = e._drag_meta;
|
|
888
888
|
t.removeEventListener("pointerup", r), t.removeEventListener("pointerupoutside", r), t.removeEventListener("pointermove", i), n.dispatchEvent(G, !1), delete e._drag_meta;
|
|
889
|
-
},
|
|
890
|
-
static label =
|
|
889
|
+
}, q = Symbol.for("E_NODE_CONTEXT"), J = Symbol.for("E_CONNECTORS_UPDATE"), Pe = class t extends e {
|
|
890
|
+
static label = V.factory("nodeLabel", {
|
|
891
891
|
fontSize: 24,
|
|
892
892
|
align: "center",
|
|
893
893
|
fill: "#efefef",
|
|
@@ -914,7 +914,7 @@ var Me = (e) => (t) => {
|
|
|
914
914
|
for (let e of this.ports.values()) e.dispose();
|
|
915
915
|
if (this.#n) {
|
|
916
916
|
let e = this.#n.map(({ port: e }) => `${this.id}-${e}`);
|
|
917
|
-
e.length && this.dispatchEvent(
|
|
917
|
+
e.length && this.dispatchEvent(J, { remove: e });
|
|
918
918
|
}
|
|
919
919
|
this.#t &&= (this.#t.removeFromParent(), void 0), super.dispose();
|
|
920
920
|
}
|
|
@@ -934,12 +934,12 @@ var Me = (e) => (t) => {
|
|
|
934
934
|
#i({ connect: e, input: t, source: { port: n }, target: r }) {
|
|
935
935
|
let i = this.connectors.find((e) => e.port === n && e.input === t);
|
|
936
936
|
if (!i) return;
|
|
937
|
-
|
|
937
|
+
j(e, i, r);
|
|
938
938
|
let a = this.ports.get(n);
|
|
939
939
|
a && a.setActive(!!i.nodes.length);
|
|
940
940
|
}
|
|
941
941
|
connectedAt(e, t, n) {
|
|
942
|
-
return this.connectors.find(({ nodes: r, connector: i }) => n !== !i && r.length && r.some(
|
|
942
|
+
return this.connectors.find(({ nodes: r, connector: i }) => n !== !i && r.length && r.some(A(e, t)));
|
|
943
943
|
}
|
|
944
944
|
get connectors() {
|
|
945
945
|
if (this.#n) return this.#n;
|
|
@@ -948,7 +948,7 @@ var Me = (e) => (t) => {
|
|
|
948
948
|
let r = {
|
|
949
949
|
x: 16 / 2,
|
|
950
950
|
y: t * 16 + 16 / 2
|
|
951
|
-
}, i =
|
|
951
|
+
}, i = k(this.data.position, r);
|
|
952
952
|
e.push({
|
|
953
953
|
parent: this.data.id,
|
|
954
954
|
port: n.port,
|
|
@@ -957,7 +957,7 @@ var Me = (e) => (t) => {
|
|
|
957
957
|
input: !0,
|
|
958
958
|
x: r.x,
|
|
959
959
|
y: r.y,
|
|
960
|
-
connector: new
|
|
960
|
+
connector: new Se(i.x, i.y)
|
|
961
961
|
}), t++;
|
|
962
962
|
}
|
|
963
963
|
for (let t of this.data.outputs) e.push({
|
|
@@ -975,17 +975,17 @@ var Me = (e) => (t) => {
|
|
|
975
975
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
976
976
|
for (let r of this.connectors) {
|
|
977
977
|
let { connector: i, nodes: a, port: o } = r, s = `${this.id}-${o}`;
|
|
978
|
-
if (i) if (i.move(
|
|
978
|
+
if (i) if (i.move(k(this.renderable, r)), a.length) {
|
|
979
979
|
let e = 0;
|
|
980
980
|
for (let { node: t, port: n } of a) {
|
|
981
981
|
let r = this.find(t), a = r?.connectedAt(this.id, o);
|
|
982
|
-
r && a ? (i.moveTargetTo(t, n,
|
|
982
|
+
r && a ? (i.moveTargetTo(t, n, k(r.renderable, a)), e++) : i.removeTarget(t, n);
|
|
983
983
|
}
|
|
984
984
|
e && t.set(s, i);
|
|
985
985
|
} else n.push(s);
|
|
986
986
|
else if (e && a.length) for (let { node: e } of a) this.find(e)?.placeConnectors(!1);
|
|
987
987
|
}
|
|
988
|
-
(t.size || n.length) && this.dispatchEvent(
|
|
988
|
+
(t.size || n.length) && this.dispatchEvent(J, {
|
|
989
989
|
add: t.size ? [...t.entries()].map(([e, t]) => ({
|
|
990
990
|
uid: e,
|
|
991
991
|
connector: t
|
|
@@ -1024,7 +1024,7 @@ var Me = (e) => (t) => {
|
|
|
1024
1024
|
return o.eventMode = "static", o.addEventListener("pointerdown", (e) => this.handleClick(e)), o.x = this.data.position.x, o.y = this.data.position.y, this.#t = o;
|
|
1025
1025
|
}
|
|
1026
1026
|
makeRoundRect({ stroke: e, fill: t, x: n = 0, y: r = 0, width: i, height: a, thickness: o = 1, radius: s = 4 }) {
|
|
1027
|
-
let c = new
|
|
1027
|
+
let c = new z.Graphics();
|
|
1028
1028
|
return c.lineStyle(o, e), c.beginFill(t), c.drawRoundedRect(0, 0, i, a, s), c.endFill(), c.x = n, c.y = r, c;
|
|
1029
1029
|
}
|
|
1030
1030
|
makeLane(e) {
|
|
@@ -1038,14 +1038,14 @@ var Me = (e) => (t) => {
|
|
|
1038
1038
|
makePort(e, t) {
|
|
1039
1039
|
let { port: n, x: r, y: i } = e, a = new ke(e, t);
|
|
1040
1040
|
return this.ports.set(n, a), a.onClick((t) => {
|
|
1041
|
-
if (t.buttons & 2) return this.dispatchEvent(
|
|
1041
|
+
if (t.buttons & 2) return this.dispatchEvent(q, {
|
|
1042
1042
|
event: t,
|
|
1043
1043
|
tag: {
|
|
1044
1044
|
type: "port",
|
|
1045
1045
|
id: n
|
|
1046
1046
|
}
|
|
1047
1047
|
});
|
|
1048
|
-
this.dispatchEvent(
|
|
1048
|
+
this.dispatchEvent(H, {
|
|
1049
1049
|
remove: t.ctrlKey || t.metaKey,
|
|
1050
1050
|
point: e,
|
|
1051
1051
|
pos: {
|
|
@@ -1053,7 +1053,7 @@ var Me = (e) => (t) => {
|
|
|
1053
1053
|
y: this.renderable.y + i
|
|
1054
1054
|
}
|
|
1055
1055
|
});
|
|
1056
|
-
}), a.onHover((t) => this.dispatchEvent(
|
|
1056
|
+
}), a.onHover((t) => this.dispatchEvent(U, {
|
|
1057
1057
|
point: e,
|
|
1058
1058
|
hover: t,
|
|
1059
1059
|
pos: {
|
|
@@ -1063,7 +1063,7 @@ var Me = (e) => (t) => {
|
|
|
1063
1063
|
})), a;
|
|
1064
1064
|
}
|
|
1065
1065
|
handleClick(e) {
|
|
1066
|
-
e.buttons & 2 ? (e.stopPropagation(), e.preventDefault(), this.dispatchEvent(
|
|
1066
|
+
e.buttons & 2 ? (e.stopPropagation(), e.preventDefault(), this.dispatchEvent(q, {
|
|
1067
1067
|
event: e,
|
|
1068
1068
|
tag: {
|
|
1069
1069
|
type: "node",
|
|
@@ -1072,22 +1072,22 @@ var Me = (e) => (t) => {
|
|
|
1072
1072
|
})) : this.#r.call(this.renderable, e);
|
|
1073
1073
|
}
|
|
1074
1074
|
onContext(e) {
|
|
1075
|
-
return this.handleEvent(
|
|
1075
|
+
return this.handleEvent(q, e);
|
|
1076
1076
|
}
|
|
1077
1077
|
onPortClick(e) {
|
|
1078
|
-
return this.handleEvent(
|
|
1078
|
+
return this.handleEvent(H, e);
|
|
1079
1079
|
}
|
|
1080
1080
|
onPortHover(e) {
|
|
1081
|
-
return this.handleEvent(
|
|
1081
|
+
return this.handleEvent(U, e);
|
|
1082
1082
|
}
|
|
1083
1083
|
onCapture(e) {
|
|
1084
1084
|
return this.handleEvent(G, e);
|
|
1085
1085
|
}
|
|
1086
1086
|
onMove(e) {
|
|
1087
|
-
return this.handleEvent(
|
|
1087
|
+
return this.handleEvent(W, e);
|
|
1088
1088
|
}
|
|
1089
1089
|
onConnectorsUpdate(e) {
|
|
1090
|
-
return this.handleEvent(
|
|
1090
|
+
return this.handleEvent(J, e);
|
|
1091
1091
|
}
|
|
1092
1092
|
update() {
|
|
1093
1093
|
let e = this.connectors.reduce((e, t) => (e[t.port] = t, e), {});
|
|
@@ -1104,11 +1104,11 @@ var Me = (e) => (t) => {
|
|
|
1104
1104
|
}, Fe = {
|
|
1105
1105
|
x: 0,
|
|
1106
1106
|
y: 0
|
|
1107
|
-
}, Ie = (e, t) => e.cell.x === t.cell.x && e.cell.y === t.cell.y && e.count.x === t.count.x && e.count.y === t.count.y && e.size.width === t.size.width && e.size.height === t.size.height,
|
|
1107
|
+
}, Ie = (e, t) => e.cell.x === t.cell.x && e.cell.y === t.cell.y && e.count.x === t.count.x && e.count.y === t.count.y && e.size.width === t.size.width && e.size.height === t.size.height, Y = (e, t, n) => e > t ? e < n ? e : n : t, X = (e, t, n, r, i) => Y(e - t / 2, n + i, r - t - i), Le = (e) => {
|
|
1108
1108
|
let t = Math.ceil(e);
|
|
1109
1109
|
return t % 2 ? t + 1 : t;
|
|
1110
|
-
}, Re = class e extends
|
|
1111
|
-
static text =
|
|
1110
|
+
}, Re = class e extends z.Graphics {
|
|
1111
|
+
static text = V.factory("GridBoundary", {
|
|
1112
1112
|
fontSize: 24,
|
|
1113
1113
|
fill: 16777215,
|
|
1114
1114
|
stroke: 0,
|
|
@@ -1122,7 +1122,7 @@ var Me = (e) => (t) => {
|
|
|
1122
1122
|
#n;
|
|
1123
1123
|
#r;
|
|
1124
1124
|
#i;
|
|
1125
|
-
#a = new
|
|
1125
|
+
#a = new z.Rectangle(0, 0, 0, 0);
|
|
1126
1126
|
#o = {
|
|
1127
1127
|
cell: Fe,
|
|
1128
1128
|
count: Fe,
|
|
@@ -1134,7 +1134,7 @@ var Me = (e) => (t) => {
|
|
|
1134
1134
|
#s;
|
|
1135
1135
|
#c;
|
|
1136
1136
|
constructor(t, n, r = 5) {
|
|
1137
|
-
super(), this.cellSize = t, this.colors = n, this.#e = r, this.#s = this.addChild(new
|
|
1137
|
+
super(), this.cellSize = t, this.colors = n, this.#e = r, this.#s = this.addChild(new z.Container()), this.#c = this.addChild(new z.Container()), this.#n = e.text("", { fontSize: 12 }), this.#t = e.text("", { fontSize: 12 }), this.#i = e.text("", { fontSize: 12 }), this.#r = e.text("", { fontSize: 12 });
|
|
1138
1138
|
}
|
|
1139
1139
|
get lods() {
|
|
1140
1140
|
return this.colors.length;
|
|
@@ -1166,20 +1166,20 @@ var Me = (e) => (t) => {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
makeRullers(e) {
|
|
1168
1168
|
this.#c.removeChildren();
|
|
1169
|
-
let t = this.#c.addChild(new
|
|
1169
|
+
let t = this.#c.addChild(new z.Graphics()), { left: n, top: r, width: i, height: a } = e, o = n + i, s = r + a, c = Y(o, 1, i - 1), l = Y(s, 1, a - 1);
|
|
1170
1170
|
t.lineStyle(2, 16711680, 1), t.moveTo(0, l), t.lineTo(i, l), t.moveTo(c, 0), t.lineTo(c, a), this.#c.addChild(this.#n, this.#t, this.#i, this.#r), this.#n.text = ~~(-(i + n) / this.cellSize.x), this.#i.text = ~~(-(a + r) / this.cellSize.y), this.#t.text = ~~(-n / this.cellSize.x), this.#r.text = ~~(-r / this.cellSize.y);
|
|
1171
|
-
let u = this.#n.height, d = this.#n.width, f = this.#t.width, p = this.#i.width, m = this.#r.width, h =
|
|
1171
|
+
let u = this.#n.height, d = this.#n.width, f = this.#t.width, p = this.#i.width, m = this.#r.width, h = X(l, u, 0, a, 2), g = X(c, p, d + 5, i - f - 5, 2), _ = X(c, m, d + 5, i - f - 5, 2);
|
|
1172
1172
|
this.#n.x = 2, this.#n.y = h, this.#t.x = i - f - 2, this.#t.y = h, this.#i.x = g, this.#i.y = 2, this.#r.x = _, this.#r.y = a - u - 2;
|
|
1173
1173
|
}
|
|
1174
1174
|
makeLOD(e) {
|
|
1175
|
-
let t = this.colors[e], { cell: { x: n, y: r }, count: { x: i, y: a }, size: { width: o, height: s } } = this.snapSize(this.#o.size, e), c = new
|
|
1175
|
+
let t = this.colors[e], { cell: { x: n, y: r }, count: { x: i, y: a }, size: { width: o, height: s } } = this.snapSize(this.#o.size, e), c = new z.Graphics();
|
|
1176
1176
|
c.lineStyle(.25 * (e + 1), t, 1);
|
|
1177
1177
|
for (let e = 0; e < i; e++) c.moveTo(n * e, 0), c.lineTo(n * e, s);
|
|
1178
1178
|
for (let e = 0; e < a; e++) c.moveTo(0, r * e), c.lineTo(o, r * e);
|
|
1179
1179
|
return c;
|
|
1180
1180
|
}
|
|
1181
1181
|
makeGrid() {
|
|
1182
|
-
let e = new
|
|
1182
|
+
let e = new z.Container();
|
|
1183
1183
|
for (let t of this.colors.keys()) e.addChild(this.makeLOD(t));
|
|
1184
1184
|
return e;
|
|
1185
1185
|
}
|
|
@@ -1191,8 +1191,8 @@ var Me = (e) => (t) => {
|
|
|
1191
1191
|
i.x = n * e, i.y = r * t, this.#s.addChild(i);
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
|
-
}, ze = 24,
|
|
1195
|
-
static label =
|
|
1194
|
+
}, ze = 24, Z = 12, Be = class e extends z.Container {
|
|
1195
|
+
static label = V.factory("menuItem", {
|
|
1196
1196
|
fontSize: 24,
|
|
1197
1197
|
align: "center",
|
|
1198
1198
|
fill: 16777215
|
|
@@ -1208,7 +1208,7 @@ var Me = (e) => (t) => {
|
|
|
1208
1208
|
#c = !1;
|
|
1209
1209
|
index;
|
|
1210
1210
|
constructor(t, n, r) {
|
|
1211
|
-
super(), this.index = t, this.#n = n, this.#s = !!n.separator, this.#r = !!n.group, this.#c = !!n.disabled || this.#r, this.#e = this.addChild(new
|
|
1211
|
+
super(), this.index = t, this.#n = n, this.#s = !!n.separator, this.#r = !!n.group, this.#c = !!n.disabled || this.#r, this.#e = this.addChild(new z.Graphics()), this.#t = this.addChild(e.label(this.label, { fontSize: 12 })), this.eventMode = "static", this.addEventListener("pointerdown", (e) => {
|
|
1212
1212
|
this.#c || (e.stopPropagation(), e.preventDefault(), r());
|
|
1213
1213
|
});
|
|
1214
1214
|
}
|
|
@@ -1231,7 +1231,7 @@ var Me = (e) => (t) => {
|
|
|
1231
1231
|
return this.#n.label;
|
|
1232
1232
|
}
|
|
1233
1233
|
get labelWidth() {
|
|
1234
|
-
return this.#t.width +
|
|
1234
|
+
return this.#t.width + Z * 2;
|
|
1235
1235
|
}
|
|
1236
1236
|
get width() {
|
|
1237
1237
|
return this.#i;
|
|
@@ -1247,9 +1247,9 @@ var Me = (e) => (t) => {
|
|
|
1247
1247
|
}
|
|
1248
1248
|
update() {
|
|
1249
1249
|
let e = this.width, t = this.height, n = this.#e;
|
|
1250
|
-
this.separator ? (n.lineStyle(1, 1638, 1), n.moveTo(
|
|
1250
|
+
this.separator ? (n.lineStyle(1, 1638, 1), n.moveTo(Z, 1), n.lineTo(e - Z, 1)) : this.#r ? (n.lineStyle(0, 0, 1), n.beginFill(3355443), n.drawRect(-1, 1, e + 2, t - 2), n.endFill()) : this.hover ? (n.lineStyle(0, 0, 1), n.beginFill(4473924), n.drawRoundedRect(0, 0, e, t, 4), n.endFill()) : n.clear(), this.#t.text = this.#n.label, this.#t.x = Z, this.#t.y = (t - this.#t.height) / 2, this.#t.alpha = this.#c && !this.#r ? .3 : 1, this.#t.tint = this.#r || this.hover ? 16777215 : 0;
|
|
1251
1251
|
}
|
|
1252
|
-
}, Ve = Symbol.for("E_ITEM_SELECT"), He = Symbol.for("E_CLOSE_MENU"), Ue = new
|
|
1252
|
+
}, Ve = Symbol.for("E_ITEM_SELECT"), He = Symbol.for("E_CLOSE_MENU"), Ue = new z.Point(), We = class extends z.Container {
|
|
1253
1253
|
#e;
|
|
1254
1254
|
#t;
|
|
1255
1255
|
#n;
|
|
@@ -1257,7 +1257,7 @@ var Me = (e) => (t) => {
|
|
|
1257
1257
|
#i;
|
|
1258
1258
|
#a = -1;
|
|
1259
1259
|
constructor(t) {
|
|
1260
|
-
super(), this.#i = new e(), this.#n = this.addChild(new
|
|
1260
|
+
super(), this.#i = new e(), this.#n = this.addChild(new z.Graphics()), this.#e = this.addChild(new z.Graphics()), this.#t = this.addChild(new z.Container()), this.#r = t.items.map((e, t) => this.#t.addChild(new Be(t, e, () => this.handleSelect(e)))), this.#t.mask = this.#n, this.eventMode = "static", this.addEventListener("pointermove", (e) => {
|
|
1261
1261
|
this.hoverIndex = this.getItemAtY(e.getLocalPosition(this, Ue).y);
|
|
1262
1262
|
}), this.addEventListener("pointerleave", () => {
|
|
1263
1263
|
this.hoverIndex = -1;
|
|
@@ -1329,7 +1329,7 @@ var Me = (e) => (t) => {
|
|
|
1329
1329
|
#e = t(() => this.ticker.speed = .05, 1e3);
|
|
1330
1330
|
#t = (e) => this.nodes.get(e);
|
|
1331
1331
|
constructor({ maxFPS: e, grid: t, gui: n = [] }) {
|
|
1332
|
-
this.ticker = new
|
|
1332
|
+
this.ticker = new z.Ticker(), this.world = new z.Container(), this.root = new z.Container(), this.overlay = new z.Container(), this.grid = new Re(t.cellSize, t.colors), this.world.sortableChildren = !0, this.ticker.maxFPS = e, this.world.__drag_root = !0, this.gui = n, this.root.addChild(this.grid), this.root.addChild(this.world), this.root.addChild(this.overlay), this.root.addChild(...n), this.ticker.add(this.render.bind(this)), this.world.eventMode = "static", this.world.hitArea = { contains: () => !0 }, this.world.addEventListener("pointermove", (e) => {
|
|
1333
1333
|
this.handlePointerMove(this.fromGlobal(e.global));
|
|
1334
1334
|
}), this.world.addEventListener("pointerdown", (e) => {
|
|
1335
1335
|
this.handlePointerDown(this.fromGlobal(e.global), e);
|
|
@@ -1341,7 +1341,7 @@ var Me = (e) => (t) => {
|
|
|
1341
1341
|
get renderer() {
|
|
1342
1342
|
if (!this._renderer) {
|
|
1343
1343
|
let { viewport: e } = this.options;
|
|
1344
|
-
this._renderer = (0,
|
|
1344
|
+
this._renderer = (0, z.autoDetectRenderer)({
|
|
1345
1345
|
width: e.width,
|
|
1346
1346
|
height: e.height,
|
|
1347
1347
|
antialias: e.antialias,
|
|
@@ -1377,13 +1377,13 @@ var Me = (e) => (t) => {
|
|
|
1377
1377
|
};
|
|
1378
1378
|
}
|
|
1379
1379
|
fromGlobal(e) {
|
|
1380
|
-
return
|
|
1380
|
+
return k(e, this.world.transform.position, -1);
|
|
1381
1381
|
}
|
|
1382
1382
|
fromLocal(e) {
|
|
1383
|
-
return
|
|
1383
|
+
return k(k(e, this.world.transform.position, -2), this.center);
|
|
1384
1384
|
}
|
|
1385
1385
|
offsetPos(e, t = 1) {
|
|
1386
|
-
return
|
|
1386
|
+
return k(e, this.center, t);
|
|
1387
1387
|
}
|
|
1388
1388
|
translate(e) {
|
|
1389
1389
|
this.world.transform.position.copyFrom(this.offsetPos(e)), this.overlay.transform.position.copyFrom(this.offsetPos(e)), this.updateViewport();
|
|
@@ -1524,7 +1524,7 @@ var Me = (e) => (t) => {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
updateViewport() {
|
|
1526
1526
|
let { width: e, height: t, translation: { x: n, y: r } } = this;
|
|
1527
|
-
e && t && this.grid.viewport(new
|
|
1527
|
+
e && t && this.grid.viewport(new z.Rectangle(n - e / 2, r - t / 2, e, t));
|
|
1528
1528
|
}
|
|
1529
1529
|
render() {
|
|
1530
1530
|
this.renderer?.render(this.root);
|
|
@@ -1532,8 +1532,8 @@ var Me = (e) => (t) => {
|
|
|
1532
1532
|
update() {
|
|
1533
1533
|
this.ticker.update();
|
|
1534
1534
|
}
|
|
1535
|
-
}, Ke = "\nPort:\n LMB - start connecting\n LMB + (Meta | Ctrl) - start disconnecting\nCanvas:\n LMB + Shift - drag while connecting/disconnecting",
|
|
1536
|
-
static text =
|
|
1535
|
+
}, Ke = "\nPort:\n LMB - start connecting\n LMB + (Meta | Ctrl) - start disconnecting\nCanvas:\n LMB + Shift - drag while connecting/disconnecting", Q = class e extends z.Container {
|
|
1536
|
+
static text = V.factory("GUIText", {
|
|
1537
1537
|
fontSize: 16,
|
|
1538
1538
|
align: "left",
|
|
1539
1539
|
fill: "#efefef",
|
|
@@ -1547,7 +1547,7 @@ var Me = (e) => (t) => {
|
|
|
1547
1547
|
] });
|
|
1548
1548
|
static makeText = (e) => this.text(e, { fontSize: 8 });
|
|
1549
1549
|
#e;
|
|
1550
|
-
#t = new
|
|
1550
|
+
#t = new z.Text("ℹ️", {
|
|
1551
1551
|
fontSize: 8,
|
|
1552
1552
|
lineHeight: 14
|
|
1553
1553
|
});
|
|
@@ -1579,7 +1579,7 @@ var Me = (e) => (t) => {
|
|
|
1579
1579
|
set legend(e) {
|
|
1580
1580
|
this.#r = e, this.#n.text = this.#i + (this.#r ? this.#a : "");
|
|
1581
1581
|
}
|
|
1582
|
-
}, qe = class extends
|
|
1582
|
+
}, qe = class extends z.Container {
|
|
1583
1583
|
first;
|
|
1584
1584
|
constructor(e, ...t) {
|
|
1585
1585
|
super(), this.first = e, this.addChild(e, ...t);
|
|
@@ -1587,7 +1587,7 @@ var Me = (e) => (t) => {
|
|
|
1587
1587
|
hotSwap(...e) {
|
|
1588
1588
|
this.removeChildren(), this.addChild(this.first, ...e);
|
|
1589
1589
|
}
|
|
1590
|
-
}, Je = class extends
|
|
1590
|
+
}, Je = class extends z.Graphics {
|
|
1591
1591
|
#e;
|
|
1592
1592
|
#t;
|
|
1593
1593
|
constructor(e) {
|
|
@@ -1606,24 +1606,24 @@ var Me = (e) => (t) => {
|
|
|
1606
1606
|
}
|
|
1607
1607
|
}
|
|
1608
1608
|
};
|
|
1609
|
-
|
|
1610
|
-
Batch: () =>
|
|
1611
|
-
E_CONNECTORS_UPDATE: () =>
|
|
1612
|
-
E_NODE_CONTEXT: () =>
|
|
1609
|
+
O(/* @__PURE__ */ E({
|
|
1610
|
+
Batch: () => _e,
|
|
1611
|
+
E_CONNECTORS_UPDATE: () => J,
|
|
1612
|
+
E_NODE_CONTEXT: () => q,
|
|
1613
1613
|
LANE_HEIGHT: () => 16,
|
|
1614
1614
|
LANE_WIDTH: () => 16,
|
|
1615
1615
|
NODE_WIDTH: () => 64,
|
|
1616
|
-
PIXIGUI: () =>
|
|
1616
|
+
PIXIGUI: () => Q,
|
|
1617
1617
|
PIXINode: () => Pe,
|
|
1618
1618
|
PIXIOutlined: () => Je,
|
|
1619
1619
|
PIXIRenderer: () => Ge,
|
|
1620
1620
|
PIXIStacked: () => qe,
|
|
1621
1621
|
PORT_SIZE: () => 8,
|
|
1622
|
-
RectSpinner: () =>
|
|
1623
|
-
}),
|
|
1622
|
+
RectSpinner: () => xe
|
|
1623
|
+
}), z);
|
|
1624
1624
|
//#endregion
|
|
1625
1625
|
//#region src/graph/GraphAdapter.ts
|
|
1626
|
-
var Ye = class extends
|
|
1626
|
+
var Ye = class extends _e {
|
|
1627
1627
|
renderer;
|
|
1628
1628
|
nodes = [];
|
|
1629
1629
|
constructor(e) {
|
|
@@ -1710,59 +1710,59 @@ var Ze = (e, t) => {
|
|
|
1710
1710
|
}, Qe = (e) => {
|
|
1711
1711
|
let t = String(e);
|
|
1712
1712
|
return (e) => String(e.value) === t;
|
|
1713
|
-
}, $e =
|
|
1714
|
-
let
|
|
1715
|
-
let t =
|
|
1713
|
+
}, $e = v(function({ items: e, resolver: t, onSelect: n, children: r, ...a }) {
|
|
1714
|
+
let c = s(() => Xe(e, t), [e, t]), [u, d] = l(c.find(({ value: e }) => e === "all")), f = String(u.value), p = m(({ target: { value: e } }) => {
|
|
1715
|
+
let t = c.find(Qe(e));
|
|
1716
1716
|
t && d(t);
|
|
1717
1717
|
});
|
|
1718
|
-
return
|
|
1719
|
-
let e =
|
|
1718
|
+
return i(() => void n(u), [u, n]), o(() => {
|
|
1719
|
+
let e = c.find(Qe(u.value));
|
|
1720
1720
|
if (e) {
|
|
1721
|
-
if (e ===
|
|
1722
|
-
(e.label !==
|
|
1723
|
-
} else d(
|
|
1724
|
-
}, [
|
|
1721
|
+
if (e === u) return;
|
|
1722
|
+
(e.label !== u.label || !Ze(e.ids, u.ids)) && d(e);
|
|
1723
|
+
} else d(c[0]);
|
|
1724
|
+
}, [c, u]), /* @__PURE__ */ b("select", {
|
|
1725
1725
|
multiple: !0,
|
|
1726
|
-
size:
|
|
1726
|
+
size: c.length,
|
|
1727
1727
|
onChange: p,
|
|
1728
|
-
...
|
|
1729
|
-
children: [r,
|
|
1728
|
+
...a,
|
|
1729
|
+
children: [r, c.map(({ value: e, label: t }) => /* @__PURE__ */ y("option", {
|
|
1730
1730
|
value: String(e),
|
|
1731
1731
|
selected: String(e) === f,
|
|
1732
1732
|
children: t
|
|
1733
1733
|
}, String(e)))]
|
|
1734
1734
|
});
|
|
1735
|
-
}), et =
|
|
1736
|
-
let [
|
|
1737
|
-
return
|
|
1735
|
+
}), et = v(({ ref: e, handlers: t, onResize: n, ...r }) => {
|
|
1736
|
+
let [o, s] = h(), { bind: c, reset: l } = le(t);
|
|
1737
|
+
return a(e, () => ({
|
|
1738
1738
|
reset: l,
|
|
1739
1739
|
get element() {
|
|
1740
1740
|
return c.ref.current;
|
|
1741
1741
|
}
|
|
1742
|
-
})),
|
|
1743
|
-
|
|
1744
|
-
width: ~~
|
|
1745
|
-
height: ~~
|
|
1742
|
+
})), i(() => {
|
|
1743
|
+
o && n({
|
|
1744
|
+
width: ~~o.width,
|
|
1745
|
+
height: ~~o.height
|
|
1746
1746
|
});
|
|
1747
|
-
}, [
|
|
1747
|
+
}, [o, n]), /* @__PURE__ */ y("div", {
|
|
1748
1748
|
ref: s,
|
|
1749
|
-
style:
|
|
1750
|
-
children: /* @__PURE__ */
|
|
1751
|
-
style:
|
|
1749
|
+
style: $.root,
|
|
1750
|
+
children: /* @__PURE__ */ y("div", {
|
|
1751
|
+
style: $.root,
|
|
1752
1752
|
...c,
|
|
1753
|
-
...
|
|
1753
|
+
...r
|
|
1754
1754
|
})
|
|
1755
1755
|
});
|
|
1756
|
-
})
|
|
1756
|
+
}), $ = u.of({ root: {
|
|
1757
1757
|
flex: 1,
|
|
1758
1758
|
display: "flex",
|
|
1759
1759
|
minWidth: 0,
|
|
1760
1760
|
minHeight: 0
|
|
1761
|
-
} }),
|
|
1762
|
-
resolver:
|
|
1763
|
-
onSelect:
|
|
1761
|
+
} }), tt = v(({ onSelect: e, ...t }) => /* @__PURE__ */ y($e, {
|
|
1762
|
+
resolver: nt,
|
|
1763
|
+
onSelect: m((t) => e(t.ids)),
|
|
1764
1764
|
...t
|
|
1765
|
-
})),
|
|
1765
|
+
})), nt = (e) => {
|
|
1766
1766
|
if (!e.item.isolator) return;
|
|
1767
1767
|
let t = [e.id];
|
|
1768
1768
|
return {
|
|
@@ -1770,7 +1770,7 @@ var Ze = (e, t) => {
|
|
|
1770
1770
|
label: e.title,
|
|
1771
1771
|
ids: t
|
|
1772
1772
|
};
|
|
1773
|
-
},
|
|
1773
|
+
}, rt = (e, t, { onEdit: n, onConnect: r, onMove: i, onAddPort: a, onDisconnectPort: o, onDeletePort: s, onDelete: c, onSelect: l, onContextMenu: u } = {}) => ({
|
|
1774
1774
|
canvas: {
|
|
1775
1775
|
onSelectNode: (t, n) => l?.(t?.item || null, e.toData(n)),
|
|
1776
1776
|
onContextMenu: (t, n) => u?.(t?.item || null, e.toData(n))
|
|
@@ -1800,11 +1800,11 @@ var Ze = (e, t) => {
|
|
|
1800
1800
|
onDeletePort: async (e, t) => s?.(e.item, t),
|
|
1801
1801
|
onDelete: async (e) => c?.(e.item)
|
|
1802
1802
|
}
|
|
1803
|
-
}),
|
|
1803
|
+
}), it = {
|
|
1804
1804
|
x: 0,
|
|
1805
1805
|
y: 0
|
|
1806
|
-
},
|
|
1807
|
-
let p =
|
|
1806
|
+
}, at = v(function({ innerRef: e, nodes: t, subset: n, coordinator: r, menu: l, onSelectNode: u, onContextMenu: d, ...f }) {
|
|
1807
|
+
let p = c(it), h = c(null), g = s(() => new Q(l), [l]), _ = s(() => new Ye({
|
|
1808
1808
|
maxFPS: 120,
|
|
1809
1809
|
grid: {
|
|
1810
1810
|
cellSize: r.gridSize,
|
|
@@ -1817,27 +1817,27 @@ var Ze = (e, t) => {
|
|
|
1817
1817
|
},
|
|
1818
1818
|
gui: [g]
|
|
1819
1819
|
}), [r]);
|
|
1820
|
-
|
|
1820
|
+
a(e, () => ({
|
|
1821
1821
|
graph: _,
|
|
1822
1822
|
get element() {
|
|
1823
|
-
return
|
|
1823
|
+
return h.current?.element;
|
|
1824
1824
|
}
|
|
1825
1825
|
}));
|
|
1826
|
-
let v =
|
|
1826
|
+
let v = m(({ width: e, height: t }) => _.resize(e, t)), b = m(() => {
|
|
1827
1827
|
let { x: e, y: t } = r.toData(_.translation), { x: n, y: i } = r.toData(p.current);
|
|
1828
1828
|
g.text = `Pos: ${-(e - 1)} x ${-(t - 1)}\nCursor: ${~~(n - 1)} x ${~~(i - 1)}`;
|
|
1829
|
-
}), x =
|
|
1830
|
-
p.current = _.fromLocal(e),
|
|
1831
|
-
}), S =
|
|
1832
|
-
p.current = _.fromLocal(e), _.releaseNode(),
|
|
1833
|
-
}), C =
|
|
1829
|
+
}), x = m((e) => {
|
|
1830
|
+
p.current = _.fromLocal(e), b();
|
|
1831
|
+
}), S = m((e) => {
|
|
1832
|
+
p.current = _.fromLocal(e), _.releaseNode(), b();
|
|
1833
|
+
}), C = m((e, t) => {
|
|
1834
1834
|
if (x(e), _.capturing && !t?.shiftKey && u(null, r.toData(p.current)), !1 === u(_.capturing || null, r.toData(p.current))) return _.releaseNode(), !1;
|
|
1835
|
-
}), w =
|
|
1836
|
-
_.capturing || (_.translate(e),
|
|
1837
|
-
}),
|
|
1835
|
+
}), w = m((e) => {
|
|
1836
|
+
_.capturing || (_.translate(e), b());
|
|
1837
|
+
}), T = m((e) => {
|
|
1838
1838
|
if (!1 === C(e)) return !1;
|
|
1839
1839
|
if (!1 === d(_.capturing || null, r.toData(p.current))) return _.releaseNode(), !1;
|
|
1840
|
-
}),
|
|
1840
|
+
}), E = s(() => ({
|
|
1841
1841
|
get position() {
|
|
1842
1842
|
return _.translation;
|
|
1843
1843
|
},
|
|
@@ -1845,18 +1845,18 @@ var Ze = (e, t) => {
|
|
|
1845
1845
|
onPointer: x,
|
|
1846
1846
|
onClick: C,
|
|
1847
1847
|
onUp: S,
|
|
1848
|
-
onContext:
|
|
1848
|
+
onContext: T
|
|
1849
1849
|
}), [_]);
|
|
1850
|
-
return
|
|
1851
|
-
if (!
|
|
1850
|
+
return i(() => {
|
|
1851
|
+
if (!h.current) return;
|
|
1852
1852
|
let e = n || t.map(({ id: e }) => e);
|
|
1853
1853
|
_.batch(() => {
|
|
1854
1854
|
for (let t of _) e.includes(t.id) || _.removeNode(t);
|
|
1855
1855
|
for (let n of t) e.includes(n.id) && (_.addNode(n), _.moveNodeTo(n, n.position));
|
|
1856
1856
|
_.layout();
|
|
1857
1857
|
});
|
|
1858
|
-
}, [n, t]),
|
|
1859
|
-
let e =
|
|
1858
|
+
}, [n, t]), o(() => {
|
|
1859
|
+
let e = h.current?.element;
|
|
1860
1860
|
if (e) return _.mount(e, { viewport: {
|
|
1861
1861
|
width: e.clientWidth,
|
|
1862
1862
|
height: e.clientHeight,
|
|
@@ -1865,15 +1865,15 @@ var Ze = (e, t) => {
|
|
|
1865
1865
|
antialias: !0,
|
|
1866
1866
|
transparent: !1
|
|
1867
1867
|
} });
|
|
1868
|
-
}, [_]), /* @__PURE__ */
|
|
1869
|
-
ref:
|
|
1870
|
-
handlers:
|
|
1868
|
+
}, [_]), /* @__PURE__ */ y(et, {
|
|
1869
|
+
ref: h,
|
|
1870
|
+
handlers: E,
|
|
1871
1871
|
onResize: v,
|
|
1872
1872
|
...f
|
|
1873
1873
|
});
|
|
1874
|
-
}),
|
|
1874
|
+
}), ot = (e, { onEdit: t, onMove: n, onConnect: r, onDelete: i, onAddPort: a, onDisconnectPort: o, onDeletePort: s }) => {
|
|
1875
1875
|
e.onConnect(r), e.onMove((t) => n(e, t)), e.onEditAction(() => t(e)), e.onDeleteAction(() => i(e)), e.onAddPortAction((t) => a(e, t)), e.onDisconnectPortAction(({ port: t }) => o(e, t)), e.onDeletePortAction(({ port: t }) => s(e, t));
|
|
1876
|
-
},
|
|
1876
|
+
}, st = (e, t, { added: n, removed: r }) => {
|
|
1877
1877
|
if (n.length) {
|
|
1878
1878
|
let r = n.reduce((e, t) => (e[t.id] = t, e), {}), i = (t) => r[t] || e.find((e) => e.id === t);
|
|
1879
1879
|
for (let e of n) {
|
|
@@ -1897,11 +1897,11 @@ var Ze = (e, t) => {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
1899
|
}
|
|
1900
|
-
if (t) for (let e of n)
|
|
1900
|
+
if (t) for (let e of n) ot(e, t);
|
|
1901
1901
|
e.add(n);
|
|
1902
1902
|
}
|
|
1903
1903
|
if (r.length) for (let t of r) e.remove(t);
|
|
1904
|
-
},
|
|
1904
|
+
}, ct = () => [{
|
|
1905
1905
|
label: "Add node",
|
|
1906
1906
|
items: [{
|
|
1907
1907
|
label: "+ Call",
|
|
@@ -1956,13 +1956,13 @@ var Ze = (e, t) => {
|
|
|
1956
1956
|
}
|
|
1957
1957
|
}
|
|
1958
1958
|
]
|
|
1959
|
-
}],
|
|
1959
|
+
}], lt = (e, t) => ({
|
|
1960
1960
|
getMenu(t, n) {
|
|
1961
1961
|
let r = {
|
|
1962
1962
|
action: "add",
|
|
1963
1963
|
...e.toData(n)
|
|
1964
1964
|
};
|
|
1965
|
-
return { items:
|
|
1965
|
+
return { items: ct().map(({ label: e, items: t }) => [{
|
|
1966
1966
|
label: e,
|
|
1967
1967
|
group: !0
|
|
1968
1968
|
}, ...t.map(({ label: e, data: t, ...n }) => ({
|
|
@@ -1981,16 +1981,16 @@ var Ze = (e, t) => {
|
|
|
1981
1981
|
return;
|
|
1982
1982
|
}
|
|
1983
1983
|
}
|
|
1984
|
-
}),
|
|
1985
|
-
let n =
|
|
1986
|
-
|
|
1984
|
+
}), ut = (e, t) => {
|
|
1985
|
+
let n = c([]);
|
|
1986
|
+
p(() => {
|
|
1987
1987
|
let i = t?.filter((e) => !n.current.some(r(e.id))), a = n.current.filter((e) => !t?.some(r(e.id)));
|
|
1988
1988
|
if (a) for (let { id: t } of a) e.find(r(t))?.setSelected(!1);
|
|
1989
1989
|
if (i) for (let { id: t } of i) e.find(r(t))?.setSelected(!0);
|
|
1990
1990
|
n.current = t || [];
|
|
1991
1991
|
}, [t, e]);
|
|
1992
|
-
},
|
|
1993
|
-
let o =
|
|
1992
|
+
}, dt = (e) => e.startsWith("channel_"), ft = (e) => dt(e) ? e.slice(8) : "", pt = (e) => ({ id: t, name: n, input: r, to: i, port: a }) => {
|
|
1993
|
+
let o = ft(n);
|
|
1994
1994
|
o && (n = `${r ? "> " : ""}@${o}${r ? "" : " >"}`);
|
|
1995
1995
|
let s = [];
|
|
1996
1996
|
if (i) {
|
|
@@ -2005,11 +2005,11 @@ var Ze = (e, t) => {
|
|
|
2005
2005
|
name: n,
|
|
2006
2006
|
nodes: s
|
|
2007
2007
|
};
|
|
2008
|
-
},
|
|
2008
|
+
}, mt = /* @__PURE__ */ function(e) {
|
|
2009
2009
|
return e[e.Idle = 1] = "Idle", e[e.Processing = 2] = "Processing", e[e.Done = 4] = "Done", e[e.Error = 8] = "Error", e[e.Selected = 16] = "Selected", e;
|
|
2010
|
-
}({}),
|
|
2010
|
+
}({}), ht = /* @__PURE__ */ function(e) {
|
|
2011
2011
|
return e[e.EDIT_NODE = 1] = "EDIT_NODE", e[e.ADD_PORT = 2] = "ADD_PORT", e[e.DISCONNECT_PORT = 3] = "DISCONNECT_PORT", e[e.DELETE_PORT = 4] = "DELETE_PORT", e[e.DELETE_NODE = 5] = "DELETE_NODE", e;
|
|
2012
|
-
}({}),
|
|
2012
|
+
}({}), gt = class extends re {
|
|
2013
2013
|
#e;
|
|
2014
2014
|
#t;
|
|
2015
2015
|
constructor({ finder: e, item: t, coordinator: n, toTitle: r }) {
|
|
@@ -2020,8 +2020,8 @@ var Ze = (e, t) => {
|
|
|
2020
2020
|
progress: 0,
|
|
2021
2021
|
id: t.id,
|
|
2022
2022
|
title: r(t),
|
|
2023
|
-
inputs: t.ports.filter(({ input: e }) => !!e).map(
|
|
2024
|
-
outputs: t.ports.filter(({ input: e }) => !e).map(
|
|
2023
|
+
inputs: t.ports.filter(({ input: e }) => !!e).map(pt(e)),
|
|
2024
|
+
outputs: t.ports.filter(({ input: e }) => !e).map(pt(e))
|
|
2025
2025
|
}), this.position = this.coordinator.toGraph(t);
|
|
2026
2026
|
}
|
|
2027
2027
|
dispose() {
|
|
@@ -2148,7 +2148,7 @@ var Ze = (e, t) => {
|
|
|
2148
2148
|
color: 3407871,
|
|
2149
2149
|
lineSize: 1,
|
|
2150
2150
|
radius: 4
|
|
2151
|
-
}), e), this.#t.first.active = this.isSelected, this.#e ? this.#e.hotSwap(this.#t) : this.#e = new
|
|
2151
|
+
}), e), this.#t.first.active = this.isSelected, this.#e ? this.#e.hotSwap(this.#t) : this.#e = new xe(this.#t, {
|
|
2152
2152
|
sizeX: t,
|
|
2153
2153
|
sizeY: n,
|
|
2154
2154
|
color: 3355647,
|
|
@@ -2156,32 +2156,32 @@ var Ze = (e, t) => {
|
|
|
2156
2156
|
radius: 4
|
|
2157
2157
|
}), this.#e.setActive(this.isInProgress), this.#e;
|
|
2158
2158
|
}
|
|
2159
|
-
},
|
|
2160
|
-
let a =
|
|
2159
|
+
}, _t = ({ coordinator: e, sync: t, onUpdate: n, store: r, toTitle: i }) => {
|
|
2160
|
+
let a = c(t), o = s(() => ({
|
|
2161
2161
|
subscribe: (e) => r.onChange(e),
|
|
2162
2162
|
getSnapshot: () => r.get(),
|
|
2163
2163
|
selector: (e) => e.sort((e, t) => e.id.localeCompare(t.id)),
|
|
2164
|
-
is:
|
|
2165
|
-
}), [r]),
|
|
2166
|
-
a.current = t,
|
|
2167
|
-
let t = (t) => new
|
|
2164
|
+
is: L
|
|
2165
|
+
}), [r]), l = _(o.subscribe, o.getSnapshot, o.getSnapshot, o.selector, o.is), u = g(l), d = m((e) => l.find((t) => t.id === e));
|
|
2166
|
+
a.current = t, p(() => {
|
|
2167
|
+
let t = (t) => new gt({
|
|
2168
2168
|
finder: d,
|
|
2169
2169
|
item: t,
|
|
2170
2170
|
coordinator: e,
|
|
2171
2171
|
toTitle: i
|
|
2172
2172
|
});
|
|
2173
2173
|
if (u) {
|
|
2174
|
-
let e = u.reduce((e, { id: t }) => (e[t] = !0, e), {}), n =
|
|
2174
|
+
let e = u.reduce((e, { id: t }) => (e[t] = !0, e), {}), n = l.filter((t) => !e[t.id]).map(t), r = Object.keys(e).filter((e) => !d(e));
|
|
2175
2175
|
(n.length || r.length) && a.current({
|
|
2176
2176
|
added: n,
|
|
2177
2177
|
removed: r
|
|
2178
2178
|
});
|
|
2179
2179
|
} else a.current({
|
|
2180
|
-
added:
|
|
2180
|
+
added: l.map(t),
|
|
2181
2181
|
removed: []
|
|
2182
2182
|
});
|
|
2183
|
-
}, [
|
|
2184
|
-
},
|
|
2183
|
+
}, [l, i]), p(() => x(() => l, n), []);
|
|
2184
|
+
}, vt = class {
|
|
2185
2185
|
grid;
|
|
2186
2186
|
gridSize;
|
|
2187
2187
|
sizes;
|
|
@@ -2212,18 +2212,18 @@ var Ze = (e, t) => {
|
|
|
2212
2212
|
y: ~~(this.snap(t) / this.grid + .5)
|
|
2213
2213
|
};
|
|
2214
2214
|
}
|
|
2215
|
-
},
|
|
2216
|
-
let
|
|
2217
|
-
return
|
|
2215
|
+
}, yt = v(({ innerRef: e, graph: t, selected: n, handlers: r, children: i, onExport: o, ...u }) => {
|
|
2216
|
+
let f = c(null), p = s(() => new vt(16), []), h = lt(p, r?.onCreate), [g, _] = R(() => new I()), [v, x] = l(), { canvas: S, loader: C } = rt(p, g, r), w = m(() => o?.(t));
|
|
2217
|
+
return a(e, () => ({
|
|
2218
2218
|
get graph() {
|
|
2219
|
-
return
|
|
2219
|
+
return f.current?.graph;
|
|
2220
2220
|
},
|
|
2221
2221
|
get element() {
|
|
2222
|
-
return
|
|
2222
|
+
return f.current?.element;
|
|
2223
2223
|
}
|
|
2224
|
-
})),
|
|
2225
|
-
store:
|
|
2226
|
-
let e = new
|
|
2224
|
+
})), _t({
|
|
2225
|
+
store: s(() => {
|
|
2226
|
+
let e = new I(t.items);
|
|
2227
2227
|
return {
|
|
2228
2228
|
items: e,
|
|
2229
2229
|
get: () => e.all,
|
|
@@ -2232,39 +2232,39 @@ var Ze = (e, t) => {
|
|
|
2232
2232
|
}, [t.items]),
|
|
2233
2233
|
coordinator: p,
|
|
2234
2234
|
toTitle: (e) => e.title,
|
|
2235
|
-
sync: (e) =>
|
|
2235
|
+
sync: (e) => st(g, C, e),
|
|
2236
2236
|
onUpdate: () => e?.current?.graph.layout()
|
|
2237
|
-
}),
|
|
2238
|
-
onContextMenu:
|
|
2239
|
-
style:
|
|
2240
|
-
...
|
|
2241
|
-
children: [/* @__PURE__ */
|
|
2242
|
-
style:
|
|
2237
|
+
}), ut(_, n), /* @__PURE__ */ b("div", {
|
|
2238
|
+
onContextMenu: d,
|
|
2239
|
+
style: bt.root,
|
|
2240
|
+
...u,
|
|
2241
|
+
children: [/* @__PURE__ */ b("div", {
|
|
2242
|
+
style: bt.selector,
|
|
2243
2243
|
children: [
|
|
2244
2244
|
i,
|
|
2245
|
-
/* @__PURE__ */
|
|
2245
|
+
/* @__PURE__ */ y(tt, {
|
|
2246
2246
|
items: _,
|
|
2247
|
-
onSelect:
|
|
2247
|
+
onSelect: x
|
|
2248
2248
|
}),
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
onClick: () =>
|
|
2249
|
+
/* @__PURE__ */ y("button", {
|
|
2250
|
+
onClick: () => x(void 0),
|
|
2251
2251
|
children: "Update"
|
|
2252
2252
|
}),
|
|
2253
|
-
|
|
2253
|
+
o && /* @__PURE__ */ y("button", {
|
|
2254
2254
|
onClick: w,
|
|
2255
2255
|
children: "Export"
|
|
2256
2256
|
})
|
|
2257
2257
|
]
|
|
2258
|
-
}), /* @__PURE__ */
|
|
2259
|
-
innerRef:
|
|
2258
|
+
}), /* @__PURE__ */ y(at, {
|
|
2259
|
+
innerRef: f,
|
|
2260
2260
|
coordinator: p,
|
|
2261
2261
|
nodes: _,
|
|
2262
2262
|
subset: v,
|
|
2263
|
-
menu:
|
|
2263
|
+
menu: h,
|
|
2264
2264
|
...S
|
|
2265
2265
|
})]
|
|
2266
2266
|
});
|
|
2267
|
-
}),
|
|
2267
|
+
}), bt = u.of({
|
|
2268
2268
|
root: {
|
|
2269
2269
|
flex: 1,
|
|
2270
2270
|
display: "flex",
|
|
@@ -2278,6 +2278,6 @@ var Ze = (e, t) => {
|
|
|
2278
2278
|
}
|
|
2279
2279
|
});
|
|
2280
2280
|
//#endregion
|
|
2281
|
-
export {
|
|
2281
|
+
export { ae as ClusteredLayout, se as EdgesSort, Ye as GraphAdapter, at as GraphCanvas, re as GraphNode, M as GraphNodeJoints, ie as LayeredLayout, ce as Layouter, yt as ManagedGraph, gt as ManagedGraphNode, ht as MenuActions, $e as NodeGroups, mt as NodeStatus, P as NodesGraph, oe as NodesSort, Q as PIXIGUI, I as Store, et as Viewport, ft as getChannelName, dt as isChannelName, L as isEqualIdentifiables, le as useDraggable, R as useStore };
|
|
2282
2282
|
|
|
2283
2283
|
//# sourceMappingURL=index.js.map
|