@html-graph/html-graph 3.20.0 → 4.0.0
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/html-graph.d.ts +26 -164
- package/dist/html-graph.js +1062 -1158
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,182 +1,178 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (r,
|
|
4
|
-
const
|
|
5
|
-
x: r.scale *
|
|
6
|
-
y: r.scale *
|
|
1
|
+
var Nt = Object.defineProperty;
|
|
2
|
+
var Mt = (r, t, e) => t in r ? Nt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var o = (r, t, e) => Mt(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
const T = (r, t) => ({
|
|
5
|
+
x: r.scale * t.x + r.x,
|
|
6
|
+
y: r.scale * t.y + r.y
|
|
7
7
|
});
|
|
8
|
-
var
|
|
9
|
-
const
|
|
8
|
+
var C = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(C || {});
|
|
9
|
+
const Lt = () => {
|
|
10
10
|
const r = document.createElement("div");
|
|
11
11
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
12
|
-
},
|
|
12
|
+
}, Ct = () => {
|
|
13
13
|
const r = document.createElement("div");
|
|
14
14
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
15
|
-
},
|
|
15
|
+
}, Rt = (r) => {
|
|
16
16
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
17
17
|
};
|
|
18
|
-
class
|
|
19
|
-
constructor(
|
|
20
|
-
o(this, "host",
|
|
21
|
-
o(this, "container",
|
|
18
|
+
class pt {
|
|
19
|
+
constructor(t, e, s) {
|
|
20
|
+
o(this, "host", Lt());
|
|
21
|
+
o(this, "container", Ct());
|
|
22
22
|
o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
23
23
|
o(this, "applyTransform", () => {
|
|
24
|
-
const
|
|
25
|
-
this.container.style.transform = `matrix(${
|
|
24
|
+
const t = this.viewportStore.getContentMatrix();
|
|
25
|
+
this.container.style.transform = `matrix(${t.scale}, 0, 0, ${t.scale}, ${t.x}, ${t.y})`;
|
|
26
26
|
});
|
|
27
|
-
this.graphStore =
|
|
27
|
+
this.graphStore = t, this.viewportStore = e, this.element = s, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
|
|
28
28
|
}
|
|
29
|
-
attachNode(
|
|
30
|
-
const
|
|
31
|
-
|
|
29
|
+
attachNode(t) {
|
|
30
|
+
const e = this.graphStore.getNode(t);
|
|
31
|
+
Rt(e.element), this.container.appendChild(e.element), this.updateNodePosition(t), this.updateNodePriority(t), e.element.style.visibility = "visible";
|
|
32
32
|
}
|
|
33
|
-
detachNode(
|
|
34
|
-
const
|
|
35
|
-
this.container.removeChild(
|
|
33
|
+
detachNode(t) {
|
|
34
|
+
const e = this.graphStore.getNode(t);
|
|
35
|
+
this.container.removeChild(e.element);
|
|
36
36
|
}
|
|
37
|
-
attachEdge(
|
|
38
|
-
const
|
|
39
|
-
this.edgeIdToElementMap.set(
|
|
37
|
+
attachEdge(t) {
|
|
38
|
+
const e = this.graphStore.getEdge(t).shape.svg;
|
|
39
|
+
this.edgeIdToElementMap.set(t, e), this.container.appendChild(e), this.renderEdge(t), this.updateEdgePriority(t);
|
|
40
40
|
}
|
|
41
|
-
detachEdge(
|
|
42
|
-
const
|
|
43
|
-
this.container.removeChild(
|
|
41
|
+
detachEdge(t) {
|
|
42
|
+
const e = this.edgeIdToElementMap.get(t);
|
|
43
|
+
this.container.removeChild(e), this.edgeIdToElementMap.delete(t);
|
|
44
44
|
}
|
|
45
45
|
clear() {
|
|
46
|
-
this.edgeIdToElementMap.forEach((
|
|
47
|
-
this.detachEdge(
|
|
48
|
-
}), this.graphStore.getAllNodeIds().forEach((
|
|
49
|
-
this.detachNode(
|
|
46
|
+
this.edgeIdToElementMap.forEach((t, e) => {
|
|
47
|
+
this.detachEdge(e);
|
|
48
|
+
}), this.graphStore.getAllNodeIds().forEach((t) => {
|
|
49
|
+
this.detachNode(t);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
destroy() {
|
|
53
53
|
this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.clear(), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
54
54
|
}
|
|
55
|
-
updateNodePosition(
|
|
56
|
-
const
|
|
57
|
-
|
|
55
|
+
updateNodePosition(t) {
|
|
56
|
+
const e = this.graphStore.getNode(t), { width: s, height: i } = e.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, a = e.centerFn(s, i), h = e.x - n * a.x, d = e.y - n * a.y;
|
|
57
|
+
e.element.style.transform = `translate(${h}px, ${d}px)`;
|
|
58
58
|
}
|
|
59
|
-
updateNodePriority(
|
|
60
|
-
const
|
|
61
|
-
|
|
59
|
+
updateNodePriority(t) {
|
|
60
|
+
const e = this.graphStore.getNode(t);
|
|
61
|
+
e.element.style.zIndex = `${e.priority}`;
|
|
62
62
|
}
|
|
63
|
-
updateEdgeShape(
|
|
64
|
-
const
|
|
65
|
-
this.container.removeChild(
|
|
66
|
-
const s = this.graphStore.getEdge(
|
|
67
|
-
this.edgeIdToElementMap.set(
|
|
63
|
+
updateEdgeShape(t) {
|
|
64
|
+
const e = this.edgeIdToElementMap.get(t);
|
|
65
|
+
this.container.removeChild(e);
|
|
66
|
+
const s = this.graphStore.getEdge(t);
|
|
67
|
+
this.edgeIdToElementMap.set(t, s.shape.svg), this.container.appendChild(s.shape.svg);
|
|
68
68
|
}
|
|
69
|
-
renderEdge(
|
|
70
|
-
const
|
|
71
|
-
t.from,
|
|
69
|
+
renderEdge(t) {
|
|
70
|
+
const e = this.graphStore.getEdge(t), s = this.graphStore.getPort(e.from), i = this.graphStore.getPort(e.to), n = s.element.getBoundingClientRect(), a = i.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
|
|
72
71
|
s,
|
|
73
72
|
n,
|
|
74
73
|
h,
|
|
75
74
|
d
|
|
76
75
|
), l = this.createEdgeRenderPort(
|
|
77
|
-
t.to,
|
|
78
76
|
i,
|
|
79
77
|
a,
|
|
80
78
|
h,
|
|
81
79
|
d
|
|
82
80
|
);
|
|
83
|
-
let g =
|
|
84
|
-
s.element === i.element ? g =
|
|
85
|
-
}
|
|
86
|
-
updateEdgePriority(
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
createEdgeRenderPort(
|
|
91
|
-
const
|
|
92
|
-
x:
|
|
93
|
-
y:
|
|
94
|
-
},
|
|
81
|
+
let g = C.Line;
|
|
82
|
+
s.element === i.element ? g = C.PortCycle : s.nodeId === i.nodeId && (g = C.NodeCycle), e.shape.render({ from: c, to: l, category: g });
|
|
83
|
+
}
|
|
84
|
+
updateEdgePriority(t) {
|
|
85
|
+
const e = this.graphStore.getEdge(t);
|
|
86
|
+
e.shape.svg.style.zIndex = `${e.priority}`;
|
|
87
|
+
}
|
|
88
|
+
createEdgeRenderPort(t, e, s, i) {
|
|
89
|
+
const n = {
|
|
90
|
+
x: e.left - s.left,
|
|
91
|
+
y: e.top - s.top
|
|
92
|
+
}, a = T(i, n);
|
|
95
93
|
return {
|
|
96
|
-
x:
|
|
97
|
-
y:
|
|
98
|
-
width:
|
|
99
|
-
height:
|
|
100
|
-
direction: t.direction
|
|
101
|
-
portId: e,
|
|
102
|
-
nodeId: t.nodeId
|
|
94
|
+
x: a.x,
|
|
95
|
+
y: a.y,
|
|
96
|
+
width: e.width * i.scale,
|
|
97
|
+
height: e.height * i.scale,
|
|
98
|
+
direction: t.direction
|
|
103
99
|
};
|
|
104
100
|
}
|
|
105
101
|
}
|
|
106
|
-
class
|
|
107
|
-
constructor(
|
|
102
|
+
class Vt {
|
|
103
|
+
constructor(t) {
|
|
108
104
|
o(this, "xFrom", 1 / 0);
|
|
109
105
|
o(this, "yFrom", 1 / 0);
|
|
110
106
|
o(this, "xTo", 1 / 0);
|
|
111
107
|
o(this, "yTo", 1 / 0);
|
|
112
|
-
this.graphStore =
|
|
108
|
+
this.graphStore = t;
|
|
113
109
|
}
|
|
114
|
-
setRenderingBox(
|
|
115
|
-
this.xFrom =
|
|
110
|
+
setRenderingBox(t) {
|
|
111
|
+
this.xFrom = t.x, this.xTo = t.x + t.width, this.yFrom = t.y, this.yTo = t.y + t.height;
|
|
116
112
|
}
|
|
117
|
-
hasNode(
|
|
118
|
-
const
|
|
119
|
-
return
|
|
113
|
+
hasNode(t) {
|
|
114
|
+
const e = this.graphStore.getNode(t);
|
|
115
|
+
return e.x >= this.xFrom && e.x <= this.xTo && e.y >= this.yFrom && e.y <= this.yTo;
|
|
120
116
|
}
|
|
121
|
-
hasEdge(
|
|
122
|
-
const
|
|
117
|
+
hasEdge(t) {
|
|
118
|
+
const e = this.graphStore.getEdge(t), s = this.graphStore.getPort(e.from).nodeId, i = this.graphStore.getPort(e.to).nodeId, n = this.graphStore.getNode(s), a = this.graphStore.getNode(i), h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), l = Math.max(n.y, a.y);
|
|
123
119
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && l >= this.yFrom;
|
|
124
120
|
}
|
|
125
121
|
}
|
|
126
|
-
class
|
|
127
|
-
constructor(
|
|
122
|
+
class It {
|
|
123
|
+
constructor(t, e, s, i) {
|
|
128
124
|
o(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
129
125
|
o(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
130
126
|
o(this, "renderingBox");
|
|
131
|
-
o(this, "updateViewport", (
|
|
132
|
-
this.renderingBox.setRenderingBox(
|
|
133
|
-
const
|
|
127
|
+
o(this, "updateViewport", (t) => {
|
|
128
|
+
this.renderingBox.setRenderingBox(t);
|
|
129
|
+
const e = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
134
130
|
this.graphStore.getAllNodeIds().forEach((a) => {
|
|
135
131
|
const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
|
|
136
|
-
h && !d ?
|
|
132
|
+
h && !d ? e.add(a) : !h && d && s.add(a);
|
|
137
133
|
}), this.graphStore.getAllEdgeIds().forEach((a) => {
|
|
138
134
|
const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), l = this.graphStore.getPort(c.from).nodeId, g = this.graphStore.getPort(c.to).nodeId;
|
|
139
|
-
h && (this.renderingBox.hasNode(l) || (
|
|
135
|
+
h && (this.renderingBox.hasNode(l) || (e.add(l), s.delete(l)), this.renderingBox.hasNode(g) || (e.add(g), s.delete(g))), h && !d ? i.add(a) : !h && d && n.add(a);
|
|
140
136
|
}), n.forEach((a) => {
|
|
141
137
|
this.handleDetachEdge(a);
|
|
142
138
|
}), s.forEach((a) => {
|
|
143
139
|
this.handleDetachNode(a);
|
|
144
|
-
}),
|
|
140
|
+
}), e.forEach((a) => {
|
|
145
141
|
this.attachedNodes.has(a) || this.handleAttachNode(a);
|
|
146
142
|
}), i.forEach((a) => {
|
|
147
143
|
this.handleAttachEdge(a);
|
|
148
144
|
});
|
|
149
145
|
});
|
|
150
|
-
this.htmlView =
|
|
146
|
+
this.htmlView = t, this.graphStore = e, this.trigger = s, this.params = i, this.renderingBox = new Vt(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
151
147
|
}
|
|
152
|
-
attachNode(
|
|
153
|
-
this.renderingBox.hasNode(
|
|
148
|
+
attachNode(t) {
|
|
149
|
+
this.renderingBox.hasNode(t) && this.handleAttachNode(t);
|
|
154
150
|
}
|
|
155
|
-
detachNode(
|
|
156
|
-
this.attachedNodes.has(
|
|
151
|
+
detachNode(t) {
|
|
152
|
+
this.attachedNodes.has(t) && this.handleDetachNode(t);
|
|
157
153
|
}
|
|
158
|
-
attachEdge(
|
|
159
|
-
this.renderingBox.hasEdge(
|
|
154
|
+
attachEdge(t) {
|
|
155
|
+
this.renderingBox.hasEdge(t) && this.attachEdgeEntities(t);
|
|
160
156
|
}
|
|
161
|
-
detachEdge(
|
|
162
|
-
this.attachedEdges.has(
|
|
157
|
+
detachEdge(t) {
|
|
158
|
+
this.attachedEdges.has(t) && this.handleDetachEdge(t);
|
|
163
159
|
}
|
|
164
|
-
updateNodePosition(
|
|
165
|
-
this.attachedNodes.has(
|
|
166
|
-
this.attachEdgeEntities(
|
|
160
|
+
updateNodePosition(t) {
|
|
161
|
+
this.attachedNodes.has(t) ? this.htmlView.updateNodePosition(t) : this.renderingBox.hasNode(t) && (this.handleAttachNode(t), this.graphStore.getNodeAdjacentEdgeIds(t).forEach((e) => {
|
|
162
|
+
this.attachEdgeEntities(e);
|
|
167
163
|
}));
|
|
168
164
|
}
|
|
169
|
-
updateNodePriority(
|
|
170
|
-
this.attachedNodes.has(
|
|
165
|
+
updateNodePriority(t) {
|
|
166
|
+
this.attachedNodes.has(t) && this.htmlView.updateNodePriority(t);
|
|
171
167
|
}
|
|
172
|
-
updateEdgeShape(
|
|
173
|
-
this.attachedEdges.has(
|
|
168
|
+
updateEdgeShape(t) {
|
|
169
|
+
this.attachedEdges.has(t) && this.htmlView.updateEdgeShape(t);
|
|
174
170
|
}
|
|
175
|
-
renderEdge(
|
|
176
|
-
this.attachedEdges.has(
|
|
171
|
+
renderEdge(t) {
|
|
172
|
+
this.attachedEdges.has(t) && this.htmlView.renderEdge(t);
|
|
177
173
|
}
|
|
178
|
-
updateEdgePriority(
|
|
179
|
-
this.attachedEdges.has(
|
|
174
|
+
updateEdgePriority(t) {
|
|
175
|
+
this.attachedEdges.has(t) && this.htmlView.updateEdgePriority(t);
|
|
180
176
|
}
|
|
181
177
|
clear() {
|
|
182
178
|
this.htmlView.clear(), this.attachedNodes.clear(), this.attachedEdges.clear();
|
|
@@ -184,52 +180,47 @@ class Ie {
|
|
|
184
180
|
destroy() {
|
|
185
181
|
this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
|
|
186
182
|
}
|
|
187
|
-
attachEdgeEntities(
|
|
188
|
-
const
|
|
189
|
-
this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(
|
|
183
|
+
attachEdgeEntities(t) {
|
|
184
|
+
const e = this.graphStore.getEdge(t), s = this.graphStore.getPort(e.from).nodeId, i = this.graphStore.getPort(e.to).nodeId;
|
|
185
|
+
this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(t);
|
|
190
186
|
}
|
|
191
|
-
handleAttachNode(
|
|
192
|
-
this.params.onBeforeNodeAttached(
|
|
187
|
+
handleAttachNode(t) {
|
|
188
|
+
this.params.onBeforeNodeAttached(t), this.attachedNodes.add(t), this.htmlView.attachNode(t);
|
|
193
189
|
}
|
|
194
|
-
handleDetachNode(
|
|
195
|
-
this.htmlView.detachNode(
|
|
190
|
+
handleDetachNode(t) {
|
|
191
|
+
this.htmlView.detachNode(t), this.attachedNodes.delete(t), this.params.onAfterNodeDetached(t);
|
|
196
192
|
}
|
|
197
|
-
handleAttachEdge(
|
|
198
|
-
this.attachedEdges.add(
|
|
193
|
+
handleAttachEdge(t) {
|
|
194
|
+
this.attachedEdges.add(t), this.htmlView.attachEdge(t);
|
|
199
195
|
}
|
|
200
|
-
handleDetachEdge(
|
|
201
|
-
this.htmlView.detachEdge(
|
|
196
|
+
handleDetachEdge(t) {
|
|
197
|
+
this.htmlView.detachEdge(t), this.attachedEdges.delete(t);
|
|
202
198
|
}
|
|
203
199
|
}
|
|
204
|
-
class
|
|
200
|
+
class wt {
|
|
205
201
|
constructor() {
|
|
206
202
|
o(this, "callbacks", /* @__PURE__ */ new Set());
|
|
207
203
|
}
|
|
208
|
-
subscribe(
|
|
209
|
-
this.callbacks.add(
|
|
204
|
+
subscribe(t) {
|
|
205
|
+
this.callbacks.add(t);
|
|
210
206
|
}
|
|
211
|
-
unsubscribe(
|
|
212
|
-
this.callbacks.delete(
|
|
207
|
+
unsubscribe(t) {
|
|
208
|
+
this.callbacks.delete(t);
|
|
213
209
|
}
|
|
214
|
-
emit(
|
|
215
|
-
this.callbacks.forEach((
|
|
216
|
-
t
|
|
210
|
+
emit(t) {
|
|
211
|
+
this.callbacks.forEach((e) => {
|
|
212
|
+
e(t);
|
|
217
213
|
});
|
|
218
214
|
}
|
|
219
215
|
}
|
|
220
216
|
const A = () => {
|
|
221
|
-
const r = new
|
|
217
|
+
const r = new wt();
|
|
222
218
|
return [r, r];
|
|
223
219
|
};
|
|
224
|
-
class
|
|
225
|
-
constructor(
|
|
226
|
-
/**
|
|
227
|
-
* @deprecated
|
|
228
|
-
* do not use
|
|
229
|
-
*/
|
|
230
|
-
o(this, "onBeforeUpdated");
|
|
220
|
+
class Ut {
|
|
221
|
+
constructor(t) {
|
|
231
222
|
o(this, "onAfterUpdated");
|
|
232
|
-
this.viewportStore =
|
|
223
|
+
this.viewportStore = t, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
|
|
233
224
|
}
|
|
234
225
|
getViewportMatrix() {
|
|
235
226
|
return { ...this.viewportStore.getViewportMatrix() };
|
|
@@ -238,8 +229,8 @@ class Ue {
|
|
|
238
229
|
return { ...this.viewportStore.getContentMatrix() };
|
|
239
230
|
}
|
|
240
231
|
}
|
|
241
|
-
class
|
|
242
|
-
constructor(
|
|
232
|
+
class Wt {
|
|
233
|
+
constructor(t) {
|
|
243
234
|
o(this, "onAfterNodeAdded");
|
|
244
235
|
o(this, "onAfterNodeUpdated");
|
|
245
236
|
o(this, "onAfterNodePriorityUpdated");
|
|
@@ -253,107 +244,86 @@ class We {
|
|
|
253
244
|
o(this, "onAfterEdgePriorityUpdated");
|
|
254
245
|
o(this, "onBeforeEdgeRemoved");
|
|
255
246
|
o(this, "onBeforeClear");
|
|
256
|
-
this.graphStore =
|
|
247
|
+
this.graphStore = t, this.onAfterNodeAdded = this.graphStore.onAfterNodeAdded, this.onAfterNodeUpdated = this.graphStore.onAfterNodeUpdated, this.onAfterNodePriorityUpdated = this.graphStore.onAfterNodePriorityUpdated, this.onBeforeNodeRemoved = this.graphStore.onBeforeNodeRemoved, this.onAfterPortMarked = this.graphStore.onAfterPortAdded, this.onAfterPortUpdated = this.graphStore.onAfterPortUpdated, this.onBeforePortUnmarked = this.graphStore.onBeforePortRemoved, this.onAfterEdgeAdded = this.graphStore.onAfterEdgeAdded, this.onAfterEdgeShapeUpdated = this.graphStore.onAfterEdgeShapeUpdated, this.onAfterEdgeUpdated = this.graphStore.onAfterEdgeUpdated, this.onAfterEdgePriorityUpdated = this.graphStore.onAfterEdgePriorityUpdated, this.onBeforeEdgeRemoved = this.graphStore.onBeforeEdgeRemoved, this.onBeforeClear = this.graphStore.onBeforeClear;
|
|
257
248
|
}
|
|
258
|
-
getNode(
|
|
259
|
-
const
|
|
260
|
-
return
|
|
261
|
-
element:
|
|
262
|
-
x:
|
|
263
|
-
y:
|
|
264
|
-
centerFn:
|
|
265
|
-
priority:
|
|
249
|
+
getNode(t) {
|
|
250
|
+
const e = this.graphStore.getNode(t);
|
|
251
|
+
return e === void 0 ? null : {
|
|
252
|
+
element: e.element,
|
|
253
|
+
x: e.x,
|
|
254
|
+
y: e.y,
|
|
255
|
+
centerFn: e.centerFn,
|
|
256
|
+
priority: e.priority
|
|
266
257
|
};
|
|
267
258
|
}
|
|
268
|
-
getElementNodeId(
|
|
269
|
-
return this.graphStore.getElementNodeId(
|
|
259
|
+
getElementNodeId(t) {
|
|
260
|
+
return this.graphStore.getElementNodeId(t) ?? null;
|
|
270
261
|
}
|
|
271
262
|
getAllNodeIds() {
|
|
272
263
|
return this.graphStore.getAllNodeIds();
|
|
273
264
|
}
|
|
274
|
-
getPort(
|
|
275
|
-
const
|
|
276
|
-
return
|
|
277
|
-
element:
|
|
278
|
-
direction:
|
|
279
|
-
nodeId:
|
|
265
|
+
getPort(t) {
|
|
266
|
+
const e = this.graphStore.getPort(t);
|
|
267
|
+
return e === void 0 ? null : {
|
|
268
|
+
element: e.element,
|
|
269
|
+
direction: e.direction,
|
|
270
|
+
nodeId: e.nodeId
|
|
280
271
|
};
|
|
281
272
|
}
|
|
282
273
|
getAllPortIds() {
|
|
283
274
|
return this.graphStore.getAllPortIds();
|
|
284
275
|
}
|
|
285
|
-
getNodePortIds(
|
|
286
|
-
return this.graphStore.getNodePortIds(
|
|
287
|
-
}
|
|
288
|
-
getElementPortIds(e) {
|
|
289
|
-
return [...this.graphStore.getElementPortIds(e)];
|
|
276
|
+
getNodePortIds(t) {
|
|
277
|
+
return this.graphStore.getNodePortIds(t) ?? null;
|
|
290
278
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
* use getElementPortIds instead
|
|
294
|
-
*/
|
|
295
|
-
getElementPortsIds(e) {
|
|
296
|
-
return this.getElementPortIds(e);
|
|
279
|
+
getElementPortIds(t) {
|
|
280
|
+
return [...this.graphStore.getElementPortIds(t)];
|
|
297
281
|
}
|
|
298
282
|
getAllEdgeIds() {
|
|
299
283
|
return this.graphStore.getAllEdgeIds();
|
|
300
284
|
}
|
|
301
|
-
getEdge(
|
|
302
|
-
const
|
|
303
|
-
return
|
|
304
|
-
from:
|
|
305
|
-
to:
|
|
306
|
-
priority:
|
|
307
|
-
shape:
|
|
285
|
+
getEdge(t) {
|
|
286
|
+
const e = this.graphStore.getEdge(t);
|
|
287
|
+
return e === void 0 ? null : {
|
|
288
|
+
from: e.from,
|
|
289
|
+
to: e.to,
|
|
290
|
+
priority: e.priority,
|
|
291
|
+
shape: e.shape
|
|
308
292
|
};
|
|
309
293
|
}
|
|
310
|
-
getPortIncomingEdgeIds(
|
|
311
|
-
return this.graphStore.getPort(
|
|
312
|
-
}
|
|
313
|
-
getPortOutgoingEdgeIds(e) {
|
|
314
|
-
return this.graphStore.getPort(e) === void 0 ? null : this.graphStore.getPortOutgoingEdgeIds(e);
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* @deprecated
|
|
318
|
-
* use getPortOutgoingEdgeIds instead
|
|
319
|
-
*/
|
|
320
|
-
getPortOutcomingEdgeIds(e) {
|
|
321
|
-
return this.getPortOutgoingEdgeIds(e);
|
|
294
|
+
getPortIncomingEdgeIds(t) {
|
|
295
|
+
return this.graphStore.getPort(t) === void 0 ? null : this.graphStore.getPortIncomingEdgeIds(t);
|
|
322
296
|
}
|
|
323
|
-
|
|
324
|
-
return this.graphStore.getPort(
|
|
297
|
+
getPortOutgoingEdgeIds(t) {
|
|
298
|
+
return this.graphStore.getPort(t) === void 0 ? null : this.graphStore.getPortOutgoingEdgeIds(t);
|
|
325
299
|
}
|
|
326
|
-
|
|
327
|
-
return this.graphStore.getPort(
|
|
300
|
+
getPortCycleEdgeIds(t) {
|
|
301
|
+
return this.graphStore.getPort(t) === void 0 ? null : this.graphStore.getPortCycleEdgeIds(t);
|
|
328
302
|
}
|
|
329
|
-
|
|
330
|
-
return this.graphStore.
|
|
303
|
+
getPortAdjacentEdgeIds(t) {
|
|
304
|
+
return this.graphStore.getPort(t) === void 0 ? null : this.graphStore.getPortAdjacentEdgeIds(t);
|
|
331
305
|
}
|
|
332
|
-
|
|
333
|
-
return this.graphStore.getNode(
|
|
306
|
+
getNodeIncomingEdgeIds(t) {
|
|
307
|
+
return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodeIncomingEdgeIds(t);
|
|
334
308
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
* use getNodeOutgoingEdgeIds instead
|
|
338
|
-
*/
|
|
339
|
-
getNodeOutcomingEdgeIds(e) {
|
|
340
|
-
return this.getNodeOutgoingEdgeIds(e);
|
|
309
|
+
getNodeOutgoingEdgeIds(t) {
|
|
310
|
+
return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodeOutgoingEdgeIds(t);
|
|
341
311
|
}
|
|
342
|
-
getNodeCycleEdgeIds(
|
|
343
|
-
return this.graphStore.getNode(
|
|
312
|
+
getNodeCycleEdgeIds(t) {
|
|
313
|
+
return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodeCycleEdgeIds(t);
|
|
344
314
|
}
|
|
345
|
-
getNodeAdjacentEdgeIds(
|
|
346
|
-
return this.graphStore.getNode(
|
|
315
|
+
getNodeAdjacentEdgeIds(t) {
|
|
316
|
+
return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(t);
|
|
347
317
|
}
|
|
348
318
|
}
|
|
349
319
|
class z {
|
|
350
|
-
constructor(
|
|
320
|
+
constructor(t) {
|
|
351
321
|
o(this, "counter", 0);
|
|
352
|
-
this.checkExists =
|
|
322
|
+
this.checkExists = t;
|
|
353
323
|
}
|
|
354
|
-
create(
|
|
355
|
-
if (
|
|
356
|
-
return
|
|
324
|
+
create(t) {
|
|
325
|
+
if (t !== void 0)
|
|
326
|
+
return t;
|
|
357
327
|
for (; this.checkExists(this.counter); )
|
|
358
328
|
this.counter++;
|
|
359
329
|
return this.counter;
|
|
@@ -365,11 +335,11 @@ class z {
|
|
|
365
335
|
class S extends Error {
|
|
366
336
|
constructor() {
|
|
367
337
|
super(...arguments);
|
|
368
|
-
o(this, "name", "
|
|
338
|
+
o(this, "name", "CanvasError");
|
|
369
339
|
}
|
|
370
340
|
}
|
|
371
|
-
class
|
|
372
|
-
constructor(
|
|
341
|
+
class ft {
|
|
342
|
+
constructor(t, e, s, i) {
|
|
373
343
|
/**
|
|
374
344
|
* provides api for accessing model of rendered graph
|
|
375
345
|
*/
|
|
@@ -379,54 +349,54 @@ class fe {
|
|
|
379
349
|
*/
|
|
380
350
|
o(this, "viewport");
|
|
381
351
|
o(this, "nodeIdGenerator", new z(
|
|
382
|
-
(
|
|
352
|
+
(t) => this.graph.getNode(t) !== null
|
|
383
353
|
));
|
|
384
354
|
o(this, "portIdGenerator", new z(
|
|
385
|
-
(
|
|
355
|
+
(t) => this.graph.getPort(t) !== null
|
|
386
356
|
));
|
|
387
357
|
o(this, "edgeIdGenerator", new z(
|
|
388
|
-
(
|
|
358
|
+
(t) => this.graph.getEdge(t) !== null
|
|
389
359
|
));
|
|
390
|
-
o(this, "onAfterNodeAdded", (
|
|
391
|
-
this.htmlView.attachNode(
|
|
360
|
+
o(this, "onAfterNodeAdded", (t) => {
|
|
361
|
+
this.htmlView.attachNode(t);
|
|
392
362
|
});
|
|
393
|
-
o(this, "onAfterNodeUpdated", (
|
|
394
|
-
this.htmlView.updateNodePosition(
|
|
363
|
+
o(this, "onAfterNodeUpdated", (t) => {
|
|
364
|
+
this.htmlView.updateNodePosition(t), this.graphStore.getNodeAdjacentEdgeIds(t).forEach((s) => {
|
|
395
365
|
this.htmlView.renderEdge(s);
|
|
396
366
|
});
|
|
397
367
|
});
|
|
398
|
-
o(this, "onAfterNodePriorityUpdated", (
|
|
399
|
-
this.htmlView.updateNodePriority(
|
|
368
|
+
o(this, "onAfterNodePriorityUpdated", (t) => {
|
|
369
|
+
this.htmlView.updateNodePriority(t);
|
|
400
370
|
});
|
|
401
|
-
o(this, "onBeforeNodeRemoved", (
|
|
402
|
-
this.graphStore.getNodePortIds(
|
|
403
|
-
this.unmarkPort(
|
|
404
|
-
}), this.htmlView.detachNode(
|
|
371
|
+
o(this, "onBeforeNodeRemoved", (t) => {
|
|
372
|
+
this.graphStore.getNodePortIds(t).forEach((e) => {
|
|
373
|
+
this.unmarkPort(e);
|
|
374
|
+
}), this.htmlView.detachNode(t);
|
|
405
375
|
});
|
|
406
|
-
o(this, "onAfterPortUpdated", (
|
|
407
|
-
this.graphStore.getPortAdjacentEdgeIds(
|
|
376
|
+
o(this, "onAfterPortUpdated", (t) => {
|
|
377
|
+
this.graphStore.getPortAdjacentEdgeIds(t).forEach((s) => {
|
|
408
378
|
this.htmlView.renderEdge(s);
|
|
409
379
|
});
|
|
410
380
|
});
|
|
411
|
-
o(this, "onBeforePortUnmarked", (
|
|
412
|
-
this.graphStore.getPortAdjacentEdgeIds(
|
|
413
|
-
this.removeEdge(
|
|
381
|
+
o(this, "onBeforePortUnmarked", (t) => {
|
|
382
|
+
this.graphStore.getPortAdjacentEdgeIds(t).forEach((e) => {
|
|
383
|
+
this.removeEdge(e);
|
|
414
384
|
});
|
|
415
385
|
});
|
|
416
|
-
o(this, "onAfterEdgeAdded", (
|
|
417
|
-
this.htmlView.attachEdge(
|
|
386
|
+
o(this, "onAfterEdgeAdded", (t) => {
|
|
387
|
+
this.htmlView.attachEdge(t);
|
|
418
388
|
});
|
|
419
|
-
o(this, "onAfterEdgeShapeUpdated", (
|
|
420
|
-
this.htmlView.updateEdgeShape(
|
|
389
|
+
o(this, "onAfterEdgeShapeUpdated", (t) => {
|
|
390
|
+
this.htmlView.updateEdgeShape(t);
|
|
421
391
|
});
|
|
422
|
-
o(this, "onAfterEdgeUpdated", (
|
|
423
|
-
this.htmlView.renderEdge(
|
|
392
|
+
o(this, "onAfterEdgeUpdated", (t) => {
|
|
393
|
+
this.htmlView.renderEdge(t);
|
|
424
394
|
});
|
|
425
|
-
o(this, "onAfterEdgePriorityUpdated", (
|
|
426
|
-
this.htmlView.updateEdgePriority(
|
|
395
|
+
o(this, "onAfterEdgePriorityUpdated", (t) => {
|
|
396
|
+
this.htmlView.updateEdgePriority(t);
|
|
427
397
|
});
|
|
428
|
-
o(this, "onBeforeEdgeRemoved", (
|
|
429
|
-
this.htmlView.detachEdge(
|
|
398
|
+
o(this, "onBeforeEdgeRemoved", (t) => {
|
|
399
|
+
this.htmlView.detachEdge(t);
|
|
430
400
|
});
|
|
431
401
|
o(this, "onBeforeClear", () => {
|
|
432
402
|
this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
|
|
@@ -437,7 +407,7 @@ class fe {
|
|
|
437
407
|
* emits event just before destruction of canvas
|
|
438
408
|
*/
|
|
439
409
|
o(this, "onBeforeDestroy");
|
|
440
|
-
this.
|
|
410
|
+
this.graphStore = t, this.viewportStore = e, this.htmlView = s, this.params = i, this.graph = new Wt(this.graphStore), this.viewport = new Ut(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
|
|
441
411
|
this.onAfterNodePriorityUpdated
|
|
442
412
|
), this.graphStore.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.subscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.subscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.subscribe(
|
|
443
413
|
this.onAfterEdgeShapeUpdated
|
|
@@ -448,27 +418,27 @@ class fe {
|
|
|
448
418
|
/**
|
|
449
419
|
* adds new node
|
|
450
420
|
*/
|
|
451
|
-
addNode(
|
|
452
|
-
const
|
|
453
|
-
if (this.graph.getNode(
|
|
421
|
+
addNode(t) {
|
|
422
|
+
const e = this.nodeIdGenerator.create(t.id);
|
|
423
|
+
if (this.graph.getNode(e) !== null)
|
|
454
424
|
throw new S("failed to add node with existing id");
|
|
455
|
-
if (this.graphStore.getElementNodeId(
|
|
425
|
+
if (this.graphStore.getElementNodeId(t.element) !== void 0)
|
|
456
426
|
throw new S(
|
|
457
427
|
"failed to add node with html element already in use by another node"
|
|
458
428
|
);
|
|
459
429
|
if (this.graphStore.addNode({
|
|
460
|
-
id:
|
|
461
|
-
element:
|
|
462
|
-
x:
|
|
463
|
-
y:
|
|
464
|
-
centerFn:
|
|
465
|
-
priority:
|
|
466
|
-
}),
|
|
467
|
-
for (const s of
|
|
430
|
+
id: e,
|
|
431
|
+
element: t.element,
|
|
432
|
+
x: t.x,
|
|
433
|
+
y: t.y,
|
|
434
|
+
centerFn: t.centerFn ?? this.params.nodes.centerFn,
|
|
435
|
+
priority: t.priority ?? this.params.nodes.priorityFn()
|
|
436
|
+
}), t.ports !== void 0)
|
|
437
|
+
for (const s of t.ports)
|
|
468
438
|
this.markPort({
|
|
469
439
|
id: s.id,
|
|
470
440
|
element: s.element,
|
|
471
|
-
nodeId:
|
|
441
|
+
nodeId: e,
|
|
472
442
|
direction: s.direction
|
|
473
443
|
});
|
|
474
444
|
return this;
|
|
@@ -476,100 +446,100 @@ class fe {
|
|
|
476
446
|
/**
|
|
477
447
|
* updates node parameters
|
|
478
448
|
*/
|
|
479
|
-
updateNode(
|
|
480
|
-
if (this.graph.getNode(
|
|
449
|
+
updateNode(t, e) {
|
|
450
|
+
if (this.graph.getNode(t) === null)
|
|
481
451
|
throw new S("failed to update non existing node");
|
|
482
|
-
return this.graphStore.updateNode(
|
|
452
|
+
return this.graphStore.updateNode(t, e ?? {}), this;
|
|
483
453
|
}
|
|
484
454
|
/**
|
|
485
455
|
* removes specified node
|
|
486
456
|
* all the ports of node get unmarked
|
|
487
457
|
* all the edges adjacent to node get removed
|
|
488
458
|
*/
|
|
489
|
-
removeNode(
|
|
490
|
-
if (this.graph.getNode(
|
|
459
|
+
removeNode(t) {
|
|
460
|
+
if (this.graph.getNode(t) === null)
|
|
491
461
|
throw new S("failed to remove non existing node");
|
|
492
|
-
return this.graphStore.removeNode(
|
|
462
|
+
return this.graphStore.removeNode(t), this;
|
|
493
463
|
}
|
|
494
464
|
/**
|
|
495
465
|
* marks specified element as a port for specified node
|
|
496
466
|
*/
|
|
497
|
-
markPort(
|
|
498
|
-
const
|
|
499
|
-
if (this.graph.getPort(
|
|
467
|
+
markPort(t) {
|
|
468
|
+
const e = this.portIdGenerator.create(t.id);
|
|
469
|
+
if (this.graph.getPort(e) !== null)
|
|
500
470
|
throw new S("failed to add port with existing id");
|
|
501
|
-
if (this.graph.getNode(
|
|
471
|
+
if (this.graph.getNode(t.nodeId) === null)
|
|
502
472
|
throw new S("failed to mark port for nonexistent node");
|
|
503
473
|
return this.graphStore.addPort({
|
|
504
|
-
id:
|
|
505
|
-
element:
|
|
506
|
-
nodeId:
|
|
507
|
-
direction:
|
|
474
|
+
id: e,
|
|
475
|
+
element: t.element,
|
|
476
|
+
nodeId: t.nodeId,
|
|
477
|
+
direction: t.direction ?? this.params.ports.direction
|
|
508
478
|
}), this;
|
|
509
479
|
}
|
|
510
480
|
/**
|
|
511
481
|
* updates port and edges attached to it
|
|
512
482
|
*/
|
|
513
|
-
updatePort(
|
|
514
|
-
if (this.graph.getPort(
|
|
483
|
+
updatePort(t, e) {
|
|
484
|
+
if (this.graph.getPort(t) === null)
|
|
515
485
|
throw new S("failed to update nonexistent port");
|
|
516
|
-
return this.graphStore.updatePort(
|
|
486
|
+
return this.graphStore.updatePort(t, e ?? {}), this;
|
|
517
487
|
}
|
|
518
488
|
/**
|
|
519
489
|
* unmarks specified port
|
|
520
490
|
* all the edges adjacent to the port get removed
|
|
521
491
|
*/
|
|
522
|
-
unmarkPort(
|
|
523
|
-
if (this.graph.getPort(
|
|
492
|
+
unmarkPort(t) {
|
|
493
|
+
if (this.graph.getPort(t) === null)
|
|
524
494
|
throw new S("failed to unmark non existing port");
|
|
525
|
-
return this.graphStore.removePort(
|
|
495
|
+
return this.graphStore.removePort(t), this;
|
|
526
496
|
}
|
|
527
497
|
/**
|
|
528
498
|
* adds new edge
|
|
529
499
|
*/
|
|
530
|
-
addEdge(
|
|
531
|
-
const
|
|
532
|
-
if (this.graph.getEdge(
|
|
500
|
+
addEdge(t) {
|
|
501
|
+
const e = this.edgeIdGenerator.create(t.id);
|
|
502
|
+
if (this.graph.getEdge(e) !== null)
|
|
533
503
|
throw new S("failed to add edge with existing id");
|
|
534
|
-
if (this.graph.getPort(
|
|
504
|
+
if (this.graph.getPort(t.from) === null)
|
|
535
505
|
throw new S("failed to add edge from nonexistent port");
|
|
536
|
-
if (this.graph.getPort(
|
|
506
|
+
if (this.graph.getPort(t.to) === null)
|
|
537
507
|
throw new S("failed to add edge to nonexistent port");
|
|
538
508
|
return this.graphStore.addEdge({
|
|
539
|
-
id:
|
|
540
|
-
from:
|
|
541
|
-
to:
|
|
542
|
-
shape:
|
|
543
|
-
priority:
|
|
509
|
+
id: e,
|
|
510
|
+
from: t.from,
|
|
511
|
+
to: t.to,
|
|
512
|
+
shape: t.shape ?? this.params.edges.shapeFactory(e),
|
|
513
|
+
priority: t.priority ?? this.params.edges.priorityFn()
|
|
544
514
|
}), this;
|
|
545
515
|
}
|
|
546
516
|
/**
|
|
547
517
|
* updates specified edge
|
|
548
518
|
*/
|
|
549
|
-
updateEdge(
|
|
550
|
-
if (this.graph.getEdge(
|
|
519
|
+
updateEdge(t, e) {
|
|
520
|
+
if (this.graph.getEdge(t) === null)
|
|
551
521
|
throw new S("failed to update nonexistent edge");
|
|
552
|
-
return this.graphStore.updateEdge(
|
|
522
|
+
return this.graphStore.updateEdge(t, e ?? {}), this;
|
|
553
523
|
}
|
|
554
524
|
/**
|
|
555
525
|
* removes specified edge
|
|
556
526
|
*/
|
|
557
|
-
removeEdge(
|
|
558
|
-
if (this.graph.getEdge(
|
|
527
|
+
removeEdge(t) {
|
|
528
|
+
if (this.graph.getEdge(t) === null)
|
|
559
529
|
throw new S("failed to remove nonexistent edge");
|
|
560
|
-
return this.graphStore.removeEdge(
|
|
530
|
+
return this.graphStore.removeEdge(t), this;
|
|
561
531
|
}
|
|
562
532
|
/**
|
|
563
533
|
* applies transformation for viewport matrix
|
|
564
534
|
*/
|
|
565
|
-
patchViewportMatrix(
|
|
566
|
-
return this.viewportStore.patchViewportMatrix(
|
|
535
|
+
patchViewportMatrix(t) {
|
|
536
|
+
return this.viewportStore.patchViewportMatrix(t), this;
|
|
567
537
|
}
|
|
568
538
|
/**
|
|
569
539
|
* applies transformation for content matrix
|
|
570
540
|
*/
|
|
571
|
-
patchContentMatrix(
|
|
572
|
-
return this.viewportStore.patchContentMatrix(
|
|
541
|
+
patchContentMatrix(t) {
|
|
542
|
+
return this.viewportStore.patchContentMatrix(t), this;
|
|
573
543
|
}
|
|
574
544
|
/**
|
|
575
545
|
* clears canvas from nodes and edges
|
|
@@ -592,47 +562,47 @@ class fe {
|
|
|
592
562
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.destroyed = !0);
|
|
593
563
|
}
|
|
594
564
|
}
|
|
595
|
-
class
|
|
565
|
+
class $t {
|
|
596
566
|
constructor() {
|
|
597
567
|
o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
598
568
|
o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
599
569
|
}
|
|
600
|
-
addRecord(
|
|
601
|
-
const s = this.singleToMultiMap.get(
|
|
602
|
-
s === void 0 ? this.singleToMultiMap.set(
|
|
570
|
+
addRecord(t, e) {
|
|
571
|
+
const s = this.singleToMultiMap.get(t);
|
|
572
|
+
s === void 0 ? this.singleToMultiMap.set(t, /* @__PURE__ */ new Set([e])) : s.add(e), this.multiToSingleMap.set(e, t);
|
|
603
573
|
}
|
|
604
|
-
getMultiBySingle(
|
|
605
|
-
const
|
|
606
|
-
return Array.from(
|
|
574
|
+
getMultiBySingle(t) {
|
|
575
|
+
const e = this.singleToMultiMap.get(t) ?? /* @__PURE__ */ new Set();
|
|
576
|
+
return Array.from(e.values());
|
|
607
577
|
}
|
|
608
|
-
removeByMulti(
|
|
609
|
-
const
|
|
610
|
-
s.delete(
|
|
578
|
+
removeByMulti(t) {
|
|
579
|
+
const e = this.multiToSingleMap.get(t), s = this.singleToMultiMap.get(e);
|
|
580
|
+
s.delete(t), s.size === 0 && this.singleToMultiMap.delete(e), this.multiToSingleMap.delete(t);
|
|
611
581
|
}
|
|
612
|
-
getByMulti(
|
|
613
|
-
return this.multiToSingleMap.get(
|
|
582
|
+
getByMulti(t) {
|
|
583
|
+
return this.multiToSingleMap.get(t);
|
|
614
584
|
}
|
|
615
|
-
removeBySingle(
|
|
616
|
-
this.singleToMultiMap.get(
|
|
585
|
+
removeBySingle(t) {
|
|
586
|
+
this.singleToMultiMap.get(t).forEach((s) => {
|
|
617
587
|
this.multiToSingleMap.delete(s);
|
|
618
|
-
}), this.singleToMultiMap.delete(
|
|
588
|
+
}), this.singleToMultiMap.delete(t);
|
|
619
589
|
}
|
|
620
590
|
clear() {
|
|
621
591
|
this.singleToMultiMap.clear(), this.multiToSingleMap.clear();
|
|
622
592
|
}
|
|
623
|
-
forEachSingle(
|
|
624
|
-
this.singleToMultiMap.forEach((
|
|
625
|
-
|
|
593
|
+
forEachSingle(t) {
|
|
594
|
+
this.singleToMultiMap.forEach((e, s) => {
|
|
595
|
+
t(s);
|
|
626
596
|
});
|
|
627
597
|
}
|
|
628
|
-
hasSingle(
|
|
629
|
-
return this.singleToMultiMap.get(
|
|
598
|
+
hasSingle(t) {
|
|
599
|
+
return this.singleToMultiMap.get(t) !== void 0;
|
|
630
600
|
}
|
|
631
|
-
hasMulti(
|
|
632
|
-
return this.multiToSingleMap.get(
|
|
601
|
+
hasMulti(t) {
|
|
602
|
+
return this.multiToSingleMap.get(t) !== void 0;
|
|
633
603
|
}
|
|
634
604
|
}
|
|
635
|
-
class
|
|
605
|
+
class mt {
|
|
636
606
|
constructor() {
|
|
637
607
|
o(this, "nodes", /* @__PURE__ */ new Map());
|
|
638
608
|
o(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -641,7 +611,7 @@ class me {
|
|
|
641
611
|
o(this, "incomingEdges", /* @__PURE__ */ new Map());
|
|
642
612
|
o(this, "outcomingEdges", /* @__PURE__ */ new Map());
|
|
643
613
|
o(this, "cycleEdges", /* @__PURE__ */ new Map());
|
|
644
|
-
o(this, "elementPorts", new
|
|
614
|
+
o(this, "elementPorts", new $t());
|
|
645
615
|
o(this, "afterNodeAddedEmitter");
|
|
646
616
|
o(this, "onAfterNodeAdded");
|
|
647
617
|
o(this, "afterNodeUpdatedEmitter");
|
|
@@ -670,172 +640,166 @@ class me {
|
|
|
670
640
|
o(this, "onBeforeClear");
|
|
671
641
|
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] = A(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = A(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = A(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = A(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = A(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = A(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = A(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = A(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = A(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = A(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = A(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = A(), [this.beforeClearEmitter, this.onBeforeClear] = A();
|
|
672
642
|
}
|
|
673
|
-
addNode(
|
|
674
|
-
const
|
|
675
|
-
element:
|
|
676
|
-
x:
|
|
677
|
-
y:
|
|
678
|
-
centerFn:
|
|
679
|
-
priority:
|
|
680
|
-
ports:
|
|
643
|
+
addNode(t) {
|
|
644
|
+
const e = /* @__PURE__ */ new Map(), s = {
|
|
645
|
+
element: t.element,
|
|
646
|
+
x: t.x,
|
|
647
|
+
y: t.y,
|
|
648
|
+
centerFn: t.centerFn,
|
|
649
|
+
priority: t.priority,
|
|
650
|
+
ports: e
|
|
681
651
|
};
|
|
682
|
-
this.nodes.set(
|
|
652
|
+
this.nodes.set(t.id, s), this.nodesElementsMap.set(t.element, t.id), this.afterNodeAddedEmitter.emit(t.id);
|
|
683
653
|
}
|
|
684
654
|
getAllNodeIds() {
|
|
685
655
|
return Array.from(this.nodes.keys());
|
|
686
656
|
}
|
|
687
|
-
getNode(
|
|
688
|
-
return this.nodes.get(
|
|
657
|
+
getNode(t) {
|
|
658
|
+
return this.nodes.get(t);
|
|
689
659
|
}
|
|
690
|
-
getElementNodeId(
|
|
691
|
-
return this.nodesElementsMap.get(
|
|
660
|
+
getElementNodeId(t) {
|
|
661
|
+
return this.nodesElementsMap.get(t);
|
|
692
662
|
}
|
|
693
|
-
updateNode(
|
|
694
|
-
const s = this.nodes.get(
|
|
695
|
-
s.x =
|
|
663
|
+
updateNode(t, e) {
|
|
664
|
+
const s = this.nodes.get(t);
|
|
665
|
+
s.x = e.x ?? s.x, s.y = e.y ?? s.y, s.centerFn = e.centerFn ?? s.centerFn, e.priority !== void 0 && (s.priority = e.priority, this.afterNodePriorityUpdatedEmitter.emit(t)), this.afterNodeUpdatedEmitter.emit(t);
|
|
696
666
|
}
|
|
697
|
-
removeNode(
|
|
698
|
-
this.beforeNodeRemovedEmitter.emit(
|
|
699
|
-
const
|
|
700
|
-
this.nodesElementsMap.delete(
|
|
667
|
+
removeNode(t) {
|
|
668
|
+
this.beforeNodeRemovedEmitter.emit(t);
|
|
669
|
+
const e = this.nodes.get(t);
|
|
670
|
+
this.nodesElementsMap.delete(e.element), this.nodes.delete(t);
|
|
701
671
|
}
|
|
702
|
-
addPort(
|
|
703
|
-
this.ports.set(
|
|
704
|
-
element:
|
|
705
|
-
direction:
|
|
706
|
-
nodeId:
|
|
707
|
-
}), this.elementPorts.addRecord(
|
|
672
|
+
addPort(t) {
|
|
673
|
+
this.ports.set(t.id, {
|
|
674
|
+
element: t.element,
|
|
675
|
+
direction: t.direction,
|
|
676
|
+
nodeId: t.nodeId
|
|
677
|
+
}), this.elementPorts.addRecord(t.element, t.id), this.cycleEdges.set(t.id, /* @__PURE__ */ new Set()), this.incomingEdges.set(t.id, /* @__PURE__ */ new Set()), this.outcomingEdges.set(t.id, /* @__PURE__ */ new Set()), this.nodes.get(t.nodeId).ports.set(t.id, t.element), this.afterPortAddedEmitter.emit(t.id);
|
|
708
678
|
}
|
|
709
|
-
getPort(
|
|
710
|
-
return this.ports.get(
|
|
679
|
+
getPort(t) {
|
|
680
|
+
return this.ports.get(t);
|
|
711
681
|
}
|
|
712
|
-
updatePort(
|
|
713
|
-
const s = this.ports.get(
|
|
714
|
-
s.direction =
|
|
682
|
+
updatePort(t, e) {
|
|
683
|
+
const s = this.ports.get(t);
|
|
684
|
+
s.direction = e.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(t);
|
|
715
685
|
}
|
|
716
686
|
getAllPortIds() {
|
|
717
687
|
return Array.from(this.ports.keys());
|
|
718
688
|
}
|
|
719
|
-
getElementPortIds(
|
|
720
|
-
return this.elementPorts.getMultiBySingle(
|
|
689
|
+
getElementPortIds(t) {
|
|
690
|
+
return this.elementPorts.getMultiBySingle(t);
|
|
721
691
|
}
|
|
722
|
-
getNodePortIds(
|
|
723
|
-
const
|
|
724
|
-
if (
|
|
725
|
-
return Array.from(
|
|
726
|
-
}
|
|
727
|
-
removePort(
|
|
728
|
-
const
|
|
729
|
-
this.beforePortRemovedEmitter.emit(
|
|
730
|
-
}
|
|
731
|
-
addEdge(
|
|
732
|
-
this.addEdgeInternal(
|
|
733
|
-
}
|
|
734
|
-
updateEdge(
|
|
735
|
-
if (
|
|
736
|
-
const i = this.edges.get(
|
|
737
|
-
this.removeEdgeInternal(
|
|
738
|
-
id:
|
|
739
|
-
from:
|
|
740
|
-
to:
|
|
692
|
+
getNodePortIds(t) {
|
|
693
|
+
const e = this.nodes.get(t);
|
|
694
|
+
if (e !== void 0)
|
|
695
|
+
return Array.from(e.ports.keys());
|
|
696
|
+
}
|
|
697
|
+
removePort(t) {
|
|
698
|
+
const e = this.ports.get(t).nodeId;
|
|
699
|
+
this.beforePortRemovedEmitter.emit(t), this.nodes.get(e).ports.delete(t), this.ports.delete(t), this.elementPorts.removeByMulti(t);
|
|
700
|
+
}
|
|
701
|
+
addEdge(t) {
|
|
702
|
+
this.addEdgeInternal(t), this.afterEdgeAddedEmitter.emit(t.id);
|
|
703
|
+
}
|
|
704
|
+
updateEdge(t, e) {
|
|
705
|
+
if (e.from !== void 0 || e.to !== void 0) {
|
|
706
|
+
const i = this.edges.get(t);
|
|
707
|
+
this.removeEdgeInternal(t), this.addEdgeInternal({
|
|
708
|
+
id: t,
|
|
709
|
+
from: e.from ?? i.from,
|
|
710
|
+
to: e.to ?? i.to,
|
|
741
711
|
shape: i.shape,
|
|
742
712
|
priority: i.priority
|
|
743
713
|
});
|
|
744
714
|
}
|
|
745
|
-
const s = this.edges.get(
|
|
746
|
-
|
|
715
|
+
const s = this.edges.get(t);
|
|
716
|
+
e.shape !== void 0 && (s.shape = e.shape, this.afterEdgeShapeUpdatedEmitter.emit(t)), e.priority !== void 0 && (s.priority = e.priority, this.afterEdgePriorityUpdatedEmitter.emit(t)), this.afterEdgeUpdatedEmitter.emit(t);
|
|
747
717
|
}
|
|
748
718
|
getAllEdgeIds() {
|
|
749
719
|
return Array.from(this.edges.keys());
|
|
750
720
|
}
|
|
751
|
-
getEdge(
|
|
752
|
-
return this.edges.get(
|
|
721
|
+
getEdge(t) {
|
|
722
|
+
return this.edges.get(t);
|
|
753
723
|
}
|
|
754
|
-
removeEdge(
|
|
755
|
-
this.beforeEdgeRemovedEmitter.emit(
|
|
724
|
+
removeEdge(t) {
|
|
725
|
+
this.beforeEdgeRemovedEmitter.emit(t), this.removeEdgeInternal(t);
|
|
756
726
|
}
|
|
757
727
|
clear() {
|
|
758
728
|
this.beforeClearEmitter.emit(), this.incomingEdges.clear(), this.outcomingEdges.clear(), this.cycleEdges.clear(), this.elementPorts.clear(), this.nodesElementsMap.clear(), this.edges.clear(), this.ports.clear(), this.nodes.clear();
|
|
759
729
|
}
|
|
760
|
-
getPortIncomingEdgeIds(
|
|
761
|
-
return Array.from(this.incomingEdges.get(
|
|
730
|
+
getPortIncomingEdgeIds(t) {
|
|
731
|
+
return Array.from(this.incomingEdges.get(t));
|
|
762
732
|
}
|
|
763
|
-
getPortOutgoingEdgeIds(
|
|
764
|
-
return Array.from(this.outcomingEdges.get(
|
|
733
|
+
getPortOutgoingEdgeIds(t) {
|
|
734
|
+
return Array.from(this.outcomingEdges.get(t));
|
|
765
735
|
}
|
|
766
|
-
getPortCycleEdgeIds(
|
|
767
|
-
return Array.from(this.cycleEdges.get(
|
|
736
|
+
getPortCycleEdgeIds(t) {
|
|
737
|
+
return Array.from(this.cycleEdges.get(t));
|
|
768
738
|
}
|
|
769
|
-
getPortAdjacentEdgeIds(
|
|
739
|
+
getPortAdjacentEdgeIds(t) {
|
|
770
740
|
return [
|
|
771
|
-
...this.getPortIncomingEdgeIds(
|
|
772
|
-
...this.getPortOutgoingEdgeIds(
|
|
773
|
-
...this.getPortCycleEdgeIds(
|
|
741
|
+
...this.getPortIncomingEdgeIds(t),
|
|
742
|
+
...this.getPortOutgoingEdgeIds(t),
|
|
743
|
+
...this.getPortCycleEdgeIds(t)
|
|
774
744
|
];
|
|
775
745
|
}
|
|
776
|
-
getNodeIncomingEdgeIds(
|
|
777
|
-
const
|
|
746
|
+
getNodeIncomingEdgeIds(t) {
|
|
747
|
+
const e = Array.from(this.nodes.get(t).ports.keys());
|
|
778
748
|
let s = [];
|
|
779
|
-
return
|
|
749
|
+
return e.forEach((i) => {
|
|
780
750
|
s = [...s, ...this.getPortIncomingEdgeIds(i)];
|
|
781
751
|
}), s;
|
|
782
752
|
}
|
|
783
|
-
getNodeOutgoingEdgeIds(
|
|
784
|
-
const
|
|
753
|
+
getNodeOutgoingEdgeIds(t) {
|
|
754
|
+
const e = Array.from(this.nodes.get(t).ports.keys());
|
|
785
755
|
let s = [];
|
|
786
|
-
return
|
|
756
|
+
return e.forEach((i) => {
|
|
787
757
|
s = [...s, ...this.getPortOutgoingEdgeIds(i)];
|
|
788
758
|
}), s;
|
|
789
759
|
}
|
|
790
|
-
getNodeCycleEdgeIds(
|
|
791
|
-
const
|
|
760
|
+
getNodeCycleEdgeIds(t) {
|
|
761
|
+
const e = Array.from(this.nodes.get(t).ports.keys());
|
|
792
762
|
let s = [];
|
|
793
|
-
return
|
|
763
|
+
return e.forEach((i) => {
|
|
794
764
|
s = [...s, ...this.getPortCycleEdgeIds(i)];
|
|
795
765
|
}), s;
|
|
796
766
|
}
|
|
797
|
-
getNodeAdjacentEdgeIds(
|
|
767
|
+
getNodeAdjacentEdgeIds(t) {
|
|
798
768
|
return [
|
|
799
|
-
...this.getNodeIncomingEdgeIds(
|
|
800
|
-
...this.getNodeOutgoingEdgeIds(
|
|
801
|
-
...this.getNodeCycleEdgeIds(
|
|
769
|
+
...this.getNodeIncomingEdgeIds(t),
|
|
770
|
+
...this.getNodeOutgoingEdgeIds(t),
|
|
771
|
+
...this.getNodeCycleEdgeIds(t)
|
|
802
772
|
];
|
|
803
773
|
}
|
|
804
|
-
addEdgeInternal(
|
|
805
|
-
this.edges.set(
|
|
806
|
-
from:
|
|
807
|
-
to:
|
|
808
|
-
shape:
|
|
809
|
-
priority:
|
|
810
|
-
}),
|
|
774
|
+
addEdgeInternal(t) {
|
|
775
|
+
this.edges.set(t.id, {
|
|
776
|
+
from: t.from,
|
|
777
|
+
to: t.to,
|
|
778
|
+
shape: t.shape,
|
|
779
|
+
priority: t.priority
|
|
780
|
+
}), t.from !== t.to ? (this.outcomingEdges.get(t.from).add(t.id), this.incomingEdges.get(t.to).add(t.id)) : this.cycleEdges.get(t.from).add(t.id);
|
|
811
781
|
}
|
|
812
|
-
removeEdgeInternal(
|
|
813
|
-
const
|
|
814
|
-
this.cycleEdges.get(s).delete(
|
|
782
|
+
removeEdgeInternal(t) {
|
|
783
|
+
const e = this.edges.get(t), s = e.from, i = e.to;
|
|
784
|
+
this.cycleEdges.get(s).delete(t), this.cycleEdges.get(i).delete(t), this.incomingEdges.get(s).delete(t), this.incomingEdges.get(i).delete(t), this.outcomingEdges.get(s).delete(t), this.outcomingEdges.get(i).delete(t), this.edges.delete(t);
|
|
815
785
|
}
|
|
816
786
|
}
|
|
817
|
-
const
|
|
787
|
+
const it = (r) => ({
|
|
818
788
|
scale: 1 / r.scale,
|
|
819
789
|
x: -r.x / r.scale,
|
|
820
790
|
y: -r.y / r.scale
|
|
821
|
-
}),
|
|
791
|
+
}), nt = {
|
|
822
792
|
scale: 1,
|
|
823
793
|
x: 0,
|
|
824
794
|
y: 0
|
|
825
795
|
};
|
|
826
|
-
class
|
|
796
|
+
class Bt {
|
|
827
797
|
constructor() {
|
|
828
|
-
o(this, "viewportMatrix",
|
|
829
|
-
o(this, "contentMatrix",
|
|
798
|
+
o(this, "viewportMatrix", nt);
|
|
799
|
+
o(this, "contentMatrix", nt);
|
|
830
800
|
o(this, "afterUpdateEmitter");
|
|
831
801
|
o(this, "onAfterUpdated");
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* @deprecated
|
|
835
|
-
* do not use
|
|
836
|
-
*/
|
|
837
|
-
o(this, "onBeforeUpdated");
|
|
838
|
-
[this.afterUpdateEmitter, this.onAfterUpdated] = A(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = A();
|
|
802
|
+
[this.afterUpdateEmitter, this.onAfterUpdated] = A();
|
|
839
803
|
}
|
|
840
804
|
getViewportMatrix() {
|
|
841
805
|
return this.viewportMatrix;
|
|
@@ -843,103 +807,103 @@ class $e {
|
|
|
843
807
|
getContentMatrix() {
|
|
844
808
|
return this.contentMatrix;
|
|
845
809
|
}
|
|
846
|
-
patchViewportMatrix(
|
|
847
|
-
this.
|
|
848
|
-
scale:
|
|
849
|
-
x:
|
|
850
|
-
y:
|
|
851
|
-
}, this.contentMatrix =
|
|
810
|
+
patchViewportMatrix(t) {
|
|
811
|
+
this.viewportMatrix = {
|
|
812
|
+
scale: t.scale ?? this.viewportMatrix.scale,
|
|
813
|
+
x: t.x ?? this.viewportMatrix.x,
|
|
814
|
+
y: t.y ?? this.viewportMatrix.y
|
|
815
|
+
}, this.contentMatrix = it(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
852
816
|
}
|
|
853
|
-
patchContentMatrix(
|
|
854
|
-
this.
|
|
855
|
-
scale:
|
|
856
|
-
x:
|
|
857
|
-
y:
|
|
858
|
-
}, this.viewportMatrix =
|
|
817
|
+
patchContentMatrix(t) {
|
|
818
|
+
this.contentMatrix = {
|
|
819
|
+
scale: t.scale ?? this.contentMatrix.scale,
|
|
820
|
+
x: t.x ?? this.contentMatrix.x,
|
|
821
|
+
y: t.y ?? this.contentMatrix.y
|
|
822
|
+
}, this.viewportMatrix = it(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
859
823
|
}
|
|
860
824
|
}
|
|
861
825
|
class j {
|
|
862
|
-
constructor(
|
|
826
|
+
constructor(t) {
|
|
863
827
|
o(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
864
828
|
o(this, "nodesResizeObserver");
|
|
865
|
-
o(this, "onAfterNodeAdded", (
|
|
866
|
-
const
|
|
867
|
-
this.elementToNodeId.set(
|
|
829
|
+
o(this, "onAfterNodeAdded", (t) => {
|
|
830
|
+
const e = this.canvas.graph.getNode(t);
|
|
831
|
+
this.elementToNodeId.set(e.element, t), this.nodesResizeObserver.observe(e.element);
|
|
868
832
|
});
|
|
869
|
-
o(this, "onBeforeNodeRemoved", (
|
|
870
|
-
const
|
|
871
|
-
this.elementToNodeId.delete(
|
|
833
|
+
o(this, "onBeforeNodeRemoved", (t) => {
|
|
834
|
+
const e = this.canvas.graph.getNode(t);
|
|
835
|
+
this.elementToNodeId.delete(e.element), this.nodesResizeObserver.unobserve(e.element);
|
|
872
836
|
});
|
|
873
837
|
o(this, "onBeforeClear", () => {
|
|
874
838
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
875
839
|
});
|
|
876
|
-
this.canvas =
|
|
877
|
-
|
|
840
|
+
this.canvas = t, this.nodesResizeObserver = new ResizeObserver((e) => {
|
|
841
|
+
e.forEach((s) => {
|
|
878
842
|
const i = s.target;
|
|
879
843
|
this.handleNodeResize(i);
|
|
880
844
|
});
|
|
881
845
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
882
846
|
}
|
|
883
|
-
static configure(
|
|
884
|
-
new j(
|
|
847
|
+
static configure(t) {
|
|
848
|
+
new j(t);
|
|
885
849
|
}
|
|
886
|
-
handleNodeResize(
|
|
887
|
-
const
|
|
888
|
-
this.canvas.updateNode(
|
|
850
|
+
handleNodeResize(t) {
|
|
851
|
+
const e = this.elementToNodeId.get(t);
|
|
852
|
+
this.canvas.updateNode(e);
|
|
889
853
|
}
|
|
890
854
|
}
|
|
891
|
-
const
|
|
855
|
+
const Ft = (r, t, e) => {
|
|
892
856
|
const { x: s, y: i, width: n, height: a } = r.getBoundingClientRect();
|
|
893
|
-
return
|
|
894
|
-
},
|
|
895
|
-
|
|
857
|
+
return t >= s && t <= s + n && e >= i && e <= i + a;
|
|
858
|
+
}, Ot = (r, t, e) => t >= 0 && t <= r.innerWidth && e >= 0 && e <= r.innerHeight, R = (r, t, e, s) => Ft(t, e, s) && Ot(r, e, s), U = (r, t) => {
|
|
859
|
+
t !== null ? r.style.cursor = t : r.style.removeProperty("cursor");
|
|
896
860
|
}, W = (r) => {
|
|
897
|
-
const
|
|
861
|
+
const t = document.createElement("div");
|
|
898
862
|
return {
|
|
899
863
|
id: r.overlayId,
|
|
900
|
-
element:
|
|
864
|
+
element: t,
|
|
901
865
|
x: r.portCoords.x,
|
|
902
866
|
y: r.portCoords.y,
|
|
903
867
|
ports: [
|
|
904
868
|
{
|
|
905
869
|
id: r.overlayId,
|
|
906
|
-
element:
|
|
870
|
+
element: t,
|
|
907
871
|
direction: r.portDirection
|
|
908
872
|
}
|
|
909
873
|
]
|
|
910
874
|
};
|
|
911
|
-
},
|
|
912
|
-
let
|
|
913
|
-
for (;
|
|
914
|
-
|
|
875
|
+
}, kt = (r, t) => {
|
|
876
|
+
let e = t, s = null;
|
|
877
|
+
for (; e !== null && (s = r.getElementPortIds(e)[0] ?? null, s === null); )
|
|
878
|
+
e = e.parentElement;
|
|
915
879
|
return s;
|
|
916
|
-
},
|
|
917
|
-
const
|
|
918
|
-
for (const s of
|
|
919
|
-
const i =
|
|
880
|
+
}, yt = (r, t) => {
|
|
881
|
+
const e = document.elementsFromPoint(t.x, t.y);
|
|
882
|
+
for (const s of e) {
|
|
883
|
+
const i = kt(r, s);
|
|
920
884
|
if (i !== null)
|
|
921
885
|
return i;
|
|
922
886
|
}
|
|
923
887
|
return null;
|
|
924
888
|
};
|
|
925
889
|
var P = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(P || {});
|
|
926
|
-
const
|
|
890
|
+
const vt = (r, t) => ({
|
|
927
891
|
x: r / 2,
|
|
928
|
-
y:
|
|
929
|
-
}), m = (r,
|
|
930
|
-
x:
|
|
931
|
-
y:
|
|
892
|
+
y: t / 2
|
|
893
|
+
}), m = (r, t, e) => ({
|
|
894
|
+
x: t.x * r.x - t.y * r.y + ((1 - t.x) * e.x + t.y * e.y),
|
|
895
|
+
y: t.y * r.x + t.x * r.y + ((1 - t.x) * e.y - t.y * e.x)
|
|
932
896
|
}), u = {
|
|
933
897
|
x: 0,
|
|
934
898
|
y: 0
|
|
935
899
|
};
|
|
936
|
-
class
|
|
937
|
-
constructor(
|
|
900
|
+
class zt {
|
|
901
|
+
constructor(t) {
|
|
938
902
|
o(this, "path");
|
|
939
903
|
o(this, "midpoint");
|
|
940
|
-
this.params =
|
|
941
|
-
const
|
|
942
|
-
this.midpoint = { x:
|
|
904
|
+
this.params = t;
|
|
905
|
+
const e = this.params.to;
|
|
906
|
+
this.midpoint = { x: e.x / 2, y: e.y / 2 };
|
|
943
907
|
const s = m(
|
|
944
908
|
{ x: this.params.arrowLength, y: u.y },
|
|
945
909
|
this.params.sourceDirection,
|
|
@@ -958,16 +922,16 @@ class ze {
|
|
|
958
922
|
this.path = `${d}${h}${c}`;
|
|
959
923
|
}
|
|
960
924
|
}
|
|
961
|
-
const
|
|
962
|
-
x:
|
|
963
|
-
y:
|
|
925
|
+
const B = (r, t, e, s) => ({
|
|
926
|
+
x: t * r.x + (1 - t) / 2 * s.x,
|
|
927
|
+
y: e * r.y + (1 - e) / 2 * s.y
|
|
964
928
|
});
|
|
965
|
-
class
|
|
966
|
-
constructor(
|
|
929
|
+
class Xt {
|
|
930
|
+
constructor(t) {
|
|
967
931
|
o(this, "path");
|
|
968
932
|
o(this, "midpoint");
|
|
969
|
-
this.params =
|
|
970
|
-
const
|
|
933
|
+
this.params = t;
|
|
934
|
+
const e = this.params.hasSourceArrow ? m(
|
|
971
935
|
{ x: this.params.arrowLength, y: u.y },
|
|
972
936
|
this.params.sourceDirection,
|
|
973
937
|
u
|
|
@@ -1009,17 +973,17 @@ class Xe {
|
|
|
1009
973
|
y: g.y + d
|
|
1010
974
|
};
|
|
1011
975
|
this.path = [
|
|
1012
|
-
`M ${
|
|
976
|
+
`M ${e.x} ${e.y}`,
|
|
1013
977
|
`L ${c.x} ${c.y}`,
|
|
1014
978
|
`C ${y.x} ${y.y} ${E.x} ${E.y} ${f.x} ${f.y}`,
|
|
1015
979
|
`C ${x.x} ${x.y} ${v.x} ${v.y} ${g.x} ${g.y}`,
|
|
1016
980
|
`L ${s.x} ${s.y}`
|
|
1017
|
-
].join(" "), this.midpoint =
|
|
981
|
+
].join(" "), this.midpoint = B(f, t.flipX, t.flipY, t.to);
|
|
1018
982
|
}
|
|
1019
983
|
}
|
|
1020
|
-
const
|
|
1021
|
-
const
|
|
1022
|
-
if (r.length > 0 &&
|
|
984
|
+
const M = (r, t) => {
|
|
985
|
+
const e = [];
|
|
986
|
+
if (r.length > 0 && e.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && e.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
|
|
1023
987
|
const s = r.length - 1;
|
|
1024
988
|
let i = 0, n = 0, a = 0;
|
|
1025
989
|
r.forEach((h, d) => {
|
|
@@ -1029,21 +993,21 @@ const L = (r, e) => {
|
|
|
1029
993
|
const V = r[d + 1];
|
|
1030
994
|
i = V.x - h.x, n = V.y - h.y, a = Math.sqrt(i * i + n * n);
|
|
1031
995
|
}
|
|
1032
|
-
const E = a !== 0 ? Math.min((y ?
|
|
1033
|
-
d > 0 &&
|
|
996
|
+
const E = a !== 0 ? Math.min((y ? t : 0) / a, d < s - 1 ? 0.5 : 1) : 0, x = y ? { x: h.x + i * E, y: h.y + n * E } : h, b = g !== 0 ? Math.min((y ? t : 0) / g, d > 1 ? 0.5 : 1) : 0, D = y ? { x: h.x + c * b, y: h.y + l * b } : h;
|
|
997
|
+
d > 0 && e.push(`L ${D.x} ${D.y}`), y && e.push(
|
|
1034
998
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${x.x} ${x.y}`
|
|
1035
999
|
);
|
|
1036
1000
|
});
|
|
1037
1001
|
}
|
|
1038
|
-
return
|
|
1002
|
+
return e.join(" ");
|
|
1039
1003
|
};
|
|
1040
|
-
class
|
|
1041
|
-
constructor(
|
|
1004
|
+
class Yt {
|
|
1005
|
+
constructor(t) {
|
|
1042
1006
|
o(this, "path");
|
|
1043
1007
|
o(this, "midpoint");
|
|
1044
|
-
this.params =
|
|
1045
|
-
const
|
|
1046
|
-
this.midpoint = { x:
|
|
1008
|
+
this.params = t;
|
|
1009
|
+
const e = this.params.to;
|
|
1010
|
+
this.midpoint = { x: e.x / 2, y: e.y / 2 };
|
|
1047
1011
|
const s = this.params.hasSourceArrow ? m(
|
|
1048
1012
|
{ x: this.params.arrowLength, y: u.y },
|
|
1049
1013
|
this.params.sourceDirection,
|
|
@@ -1070,18 +1034,18 @@ class Ye {
|
|
|
1070
1034
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1071
1035
|
y: d.y
|
|
1072
1036
|
}, y = { x: f.x, y: l };
|
|
1073
|
-
this.path =
|
|
1037
|
+
this.path = M(
|
|
1074
1038
|
[s, h, g, w, y, f, d, i],
|
|
1075
1039
|
this.params.roundness
|
|
1076
1040
|
);
|
|
1077
1041
|
}
|
|
1078
1042
|
}
|
|
1079
|
-
class
|
|
1080
|
-
constructor(
|
|
1043
|
+
class Ht {
|
|
1044
|
+
constructor(t) {
|
|
1081
1045
|
o(this, "path");
|
|
1082
1046
|
o(this, "midpoint");
|
|
1083
|
-
this.params =
|
|
1084
|
-
const
|
|
1047
|
+
this.params = t;
|
|
1048
|
+
const e = this.params.hasSourceArrow ? m(
|
|
1085
1049
|
{ x: this.params.arrowLength, y: u.y },
|
|
1086
1050
|
this.params.sourceDirection,
|
|
1087
1051
|
u
|
|
@@ -1101,19 +1065,19 @@ class He {
|
|
|
1101
1065
|
this.params.targetDirection,
|
|
1102
1066
|
this.params.to
|
|
1103
1067
|
), w = { x: g.x + d, y: g.y + c }, f = { x: (l.x + w.x) / 2, y: (l.y + w.y) / 2 };
|
|
1104
|
-
this.midpoint =
|
|
1105
|
-
[
|
|
1068
|
+
this.midpoint = B(f, t.flipX, t.flipY, t.to), this.path = M(
|
|
1069
|
+
[e, n, l, w, g, s],
|
|
1106
1070
|
this.params.roundness
|
|
1107
1071
|
);
|
|
1108
1072
|
}
|
|
1109
1073
|
}
|
|
1110
|
-
class
|
|
1111
|
-
constructor(
|
|
1074
|
+
class jt {
|
|
1075
|
+
constructor(t) {
|
|
1112
1076
|
o(this, "path");
|
|
1113
1077
|
o(this, "midpoint");
|
|
1114
|
-
this.params =
|
|
1115
|
-
const
|
|
1116
|
-
this.midpoint = { x:
|
|
1078
|
+
this.params = t;
|
|
1079
|
+
const e = this.params.to;
|
|
1080
|
+
this.midpoint = { x: e.x / 2, y: e.y / 2 };
|
|
1117
1081
|
const s = this.params.hasSourceArrow ? m(
|
|
1118
1082
|
{ x: this.params.arrowLength, y: u.y },
|
|
1119
1083
|
this.params.sourceDirection,
|
|
@@ -1134,16 +1098,16 @@ class je {
|
|
|
1134
1098
|
this.params.targetDirection,
|
|
1135
1099
|
this.params.to
|
|
1136
1100
|
);
|
|
1137
|
-
this.path =
|
|
1101
|
+
this.path = M([s, a, h, i], this.params.roundness);
|
|
1138
1102
|
}
|
|
1139
1103
|
}
|
|
1140
|
-
class
|
|
1141
|
-
constructor(
|
|
1104
|
+
class Gt {
|
|
1105
|
+
constructor(t) {
|
|
1142
1106
|
o(this, "path");
|
|
1143
1107
|
o(this, "midpoint");
|
|
1144
|
-
this.params =
|
|
1145
|
-
const
|
|
1146
|
-
this.midpoint = { x:
|
|
1108
|
+
this.params = t;
|
|
1109
|
+
const e = this.params.to;
|
|
1110
|
+
this.midpoint = { x: e.x / 2, y: e.y / 2 };
|
|
1147
1111
|
const s = this.params.hasSourceArrow ? m(
|
|
1148
1112
|
{ x: this.params.arrowLength, y: u.y },
|
|
1149
1113
|
this.params.sourceDirection,
|
|
@@ -1170,18 +1134,18 @@ class Ge {
|
|
|
1170
1134
|
x: d.x,
|
|
1171
1135
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1172
1136
|
}, y = { x: l, y: f.y };
|
|
1173
|
-
this.path =
|
|
1137
|
+
this.path = M(
|
|
1174
1138
|
[s, h, g, w, y, f, d, i],
|
|
1175
1139
|
this.params.roundness
|
|
1176
1140
|
);
|
|
1177
1141
|
}
|
|
1178
1142
|
}
|
|
1179
1143
|
class G {
|
|
1180
|
-
constructor(
|
|
1144
|
+
constructor(t) {
|
|
1181
1145
|
o(this, "path");
|
|
1182
1146
|
o(this, "midpoint");
|
|
1183
|
-
this.params =
|
|
1184
|
-
const
|
|
1147
|
+
this.params = t;
|
|
1148
|
+
const e = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + e, n = i + 2 * s, h = [
|
|
1185
1149
|
{ x: this.params.arrowLength, y: u.y },
|
|
1186
1150
|
{ x: i, y: u.y },
|
|
1187
1151
|
{ x: i, y: this.params.side },
|
|
@@ -1193,15 +1157,15 @@ class G {
|
|
|
1193
1157
|
].map(
|
|
1194
1158
|
(c) => m(c, this.params.sourceDirection, u)
|
|
1195
1159
|
), d = `M ${u.x} ${u.y} L ${h[0].x} ${h[0].y} `;
|
|
1196
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${
|
|
1160
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${M(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1197
1161
|
}
|
|
1198
1162
|
}
|
|
1199
|
-
class
|
|
1200
|
-
constructor(
|
|
1163
|
+
class Kt {
|
|
1164
|
+
constructor(t) {
|
|
1201
1165
|
o(this, "path");
|
|
1202
1166
|
o(this, "midpoint");
|
|
1203
|
-
this.params =
|
|
1204
|
-
const
|
|
1167
|
+
this.params = t;
|
|
1168
|
+
const e = this.params.smallRadius, s = this.params.radius, i = e + s, n = e * s / i, a = Math.sqrt(i * i - e * e), h = a * e / i, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, g = [
|
|
1205
1169
|
{ x: this.params.arrowLength, y: u.y },
|
|
1206
1170
|
{ x: c, y: n },
|
|
1207
1171
|
{ x: c, y: -n },
|
|
@@ -1210,21 +1174,21 @@ class Ke {
|
|
|
1210
1174
|
(y) => m(y, this.params.sourceDirection, u)
|
|
1211
1175
|
), w = [
|
|
1212
1176
|
`M ${g[0].x} ${g[0].y}`,
|
|
1213
|
-
`A ${
|
|
1177
|
+
`A ${e} ${e} 0 0 1 ${g[1].x} ${g[1].y}`,
|
|
1214
1178
|
`A ${s} ${s} 0 1 0 ${g[2].x} ${g[2].y}`,
|
|
1215
|
-
`A ${
|
|
1179
|
+
`A ${e} ${e} 0 0 1 ${g[0].x} ${g[0].y}`
|
|
1216
1180
|
].join(" "), f = `M 0 0 L ${g[0].x} ${g[0].y} `;
|
|
1217
1181
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : f}${w}`, this.midpoint = g[3];
|
|
1218
1182
|
}
|
|
1219
1183
|
}
|
|
1220
|
-
class
|
|
1221
|
-
constructor(
|
|
1184
|
+
class Zt {
|
|
1185
|
+
constructor(t) {
|
|
1222
1186
|
o(this, "path");
|
|
1223
1187
|
o(this, "midpoint");
|
|
1224
1188
|
o(this, "diagonalDistance");
|
|
1225
|
-
this.params =
|
|
1226
|
-
const
|
|
1227
|
-
if (this.midpoint = { x:
|
|
1189
|
+
this.params = t;
|
|
1190
|
+
const e = this.params.to;
|
|
1191
|
+
if (this.midpoint = { x: e.x / 2, y: e.y / 2 }, this.diagonalDistance = Math.sqrt(
|
|
1228
1192
|
this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
|
|
1229
1193
|
), Math.sqrt(
|
|
1230
1194
|
this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
|
|
@@ -1245,20 +1209,20 @@ class Ze {
|
|
|
1245
1209
|
});
|
|
1246
1210
|
this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
|
|
1247
1211
|
}
|
|
1248
|
-
createDirectLinePoint(
|
|
1249
|
-
const
|
|
1212
|
+
createDirectLinePoint(t) {
|
|
1213
|
+
const e = t.hasArrow ? this.params.arrowLength : 0, s = t.offset + e, i = t.flip * s / this.diagonalDistance;
|
|
1250
1214
|
return {
|
|
1251
|
-
x: this.params.to.x * i +
|
|
1252
|
-
y: this.params.to.y * i +
|
|
1215
|
+
x: this.params.to.x * i + t.shift.x,
|
|
1216
|
+
y: this.params.to.y * i + t.shift.y
|
|
1253
1217
|
};
|
|
1254
1218
|
}
|
|
1255
1219
|
}
|
|
1256
|
-
class
|
|
1257
|
-
constructor(
|
|
1220
|
+
class Jt {
|
|
1221
|
+
constructor(t) {
|
|
1258
1222
|
o(this, "path");
|
|
1259
1223
|
o(this, "midpoint");
|
|
1260
|
-
this.params =
|
|
1261
|
-
const
|
|
1224
|
+
this.params = t;
|
|
1225
|
+
const e = this.params.hasSourceArrow ? m(
|
|
1262
1226
|
{ x: this.params.arrowLength, y: u.y },
|
|
1263
1227
|
this.params.sourceDirection,
|
|
1264
1228
|
u
|
|
@@ -1281,9 +1245,9 @@ class Je {
|
|
|
1281
1245
|
x: (n.x + a.x) / 2,
|
|
1282
1246
|
y: l
|
|
1283
1247
|
};
|
|
1284
|
-
this.midpoint =
|
|
1248
|
+
this.midpoint = B(g, t.flipX, t.flipY, t.to), this.path = M(
|
|
1285
1249
|
[
|
|
1286
|
-
|
|
1250
|
+
e,
|
|
1287
1251
|
n,
|
|
1288
1252
|
{ x: n.x, y: l },
|
|
1289
1253
|
{ x: a.x, y: l },
|
|
@@ -1294,12 +1258,12 @@ class Je {
|
|
|
1294
1258
|
);
|
|
1295
1259
|
}
|
|
1296
1260
|
}
|
|
1297
|
-
class
|
|
1298
|
-
constructor(
|
|
1261
|
+
class Qt {
|
|
1262
|
+
constructor(t) {
|
|
1299
1263
|
o(this, "path");
|
|
1300
1264
|
o(this, "midpoint");
|
|
1301
|
-
this.params =
|
|
1302
|
-
const
|
|
1265
|
+
this.params = t;
|
|
1266
|
+
const e = this.params.hasSourceArrow ? m(
|
|
1303
1267
|
{ x: this.params.arrowLength, y: u.y },
|
|
1304
1268
|
this.params.sourceDirection,
|
|
1305
1269
|
u
|
|
@@ -1322,9 +1286,9 @@ class Qe {
|
|
|
1322
1286
|
x: l,
|
|
1323
1287
|
y: (n.y + a.y) / 2
|
|
1324
1288
|
};
|
|
1325
|
-
this.midpoint =
|
|
1289
|
+
this.midpoint = B(g, t.flipX, t.flipY, t.to), this.path = M(
|
|
1326
1290
|
[
|
|
1327
|
-
|
|
1291
|
+
e,
|
|
1328
1292
|
n,
|
|
1329
1293
|
{ x: l, y: n.y },
|
|
1330
1294
|
{ x: l, y: a.y },
|
|
@@ -1335,30 +1299,30 @@ class Qe {
|
|
|
1335
1299
|
);
|
|
1336
1300
|
}
|
|
1337
1301
|
}
|
|
1338
|
-
const
|
|
1339
|
-
r.style.transform = `translate(${
|
|
1302
|
+
const Et = (r, t) => {
|
|
1303
|
+
r.style.transform = `translate(${t.x}px, ${t.y}px)`, r.style.width = `${Math.max(t.width, 1)}px`, r.style.height = `${Math.max(t.height, 1)}px`;
|
|
1340
1304
|
}, K = Object.freeze({
|
|
1341
1305
|
edgeColor: "--edge-color"
|
|
1342
|
-
}),
|
|
1343
|
-
const
|
|
1344
|
-
return
|
|
1345
|
-
},
|
|
1306
|
+
}), At = (r) => {
|
|
1307
|
+
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1308
|
+
return t.style.pointerEvents = "none", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.overflow = "visible", t.style.setProperty(K.edgeColor, r), t;
|
|
1309
|
+
}, $ = () => {
|
|
1346
1310
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1347
1311
|
return r.setAttribute("fill", `var(${K.edgeColor})`), r;
|
|
1348
|
-
},
|
|
1312
|
+
}, xt = () => {
|
|
1349
1313
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1350
1314
|
return r.style.transformOrigin = "50% 50%", r;
|
|
1351
|
-
},
|
|
1352
|
-
const
|
|
1353
|
-
return
|
|
1354
|
-
},
|
|
1355
|
-
const
|
|
1315
|
+
}, St = (r) => {
|
|
1316
|
+
const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1317
|
+
return t.setAttribute("stroke", `var(${K.edgeColor})`), t.setAttribute("stroke-width", `${r}`), t.setAttribute("fill", "none"), t;
|
|
1318
|
+
}, Pt = (r, t) => {
|
|
1319
|
+
const e = {
|
|
1356
1320
|
x: r.x + r.width / 2,
|
|
1357
1321
|
y: r.y + r.height / 2
|
|
1358
1322
|
}, s = {
|
|
1359
|
-
x:
|
|
1360
|
-
y:
|
|
1361
|
-
}, i = Math.min(
|
|
1323
|
+
x: t.x + t.width / 2,
|
|
1324
|
+
y: t.y + t.height / 2
|
|
1325
|
+
}, i = Math.min(e.x, s.x), n = Math.min(e.y, s.y), a = Math.abs(s.x - e.x), h = Math.abs(s.y - e.y), d = e.x <= s.x ? 1 : -1, c = e.y <= s.y ? 1 : -1;
|
|
1362
1326
|
return {
|
|
1363
1327
|
x: i,
|
|
1364
1328
|
y: n,
|
|
@@ -1367,12 +1331,12 @@ const Ee = (r, e) => {
|
|
|
1367
1331
|
flipX: d,
|
|
1368
1332
|
flipY: c
|
|
1369
1333
|
};
|
|
1370
|
-
}, X = (r,
|
|
1334
|
+
}, X = (r, t, e, s) => {
|
|
1371
1335
|
const n = [
|
|
1372
1336
|
u,
|
|
1373
|
-
{ x:
|
|
1374
|
-
{ x:
|
|
1375
|
-
].map((c) => m(c, r, u)).map((c) => ({ x: c.x +
|
|
1337
|
+
{ x: e, y: s },
|
|
1338
|
+
{ x: e, y: -s }
|
|
1339
|
+
].map((c) => m(c, r, u)).map((c) => ({ x: c.x + t.x, y: c.y + t.y })), a = `M ${n[0].x} ${n[0].y}`, h = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
|
|
1376
1340
|
return `${a} ${h} ${d} Z`;
|
|
1377
1341
|
}, p = Object.freeze({
|
|
1378
1342
|
color: "#777777",
|
|
@@ -1392,30 +1356,30 @@ const Ee = (r, e) => {
|
|
|
1392
1356
|
curvature: 90,
|
|
1393
1357
|
interactiveWidth: 10,
|
|
1394
1358
|
preOffset: 0
|
|
1395
|
-
}),
|
|
1359
|
+
}), at = (r, t, e) => ({ x: t * Math.cos(r), y: e * Math.sin(r) });
|
|
1396
1360
|
class F {
|
|
1397
|
-
constructor(
|
|
1361
|
+
constructor(t) {
|
|
1398
1362
|
o(this, "svg");
|
|
1399
|
-
o(this, "group",
|
|
1363
|
+
o(this, "group", xt());
|
|
1400
1364
|
o(this, "line");
|
|
1401
1365
|
o(this, "sourceArrow", null);
|
|
1402
1366
|
o(this, "targetArrow", null);
|
|
1403
1367
|
o(this, "onAfterRender");
|
|
1404
1368
|
o(this, "afterRenderEmitter");
|
|
1405
|
-
this.params =
|
|
1369
|
+
this.params = t, [this.afterRenderEmitter, this.onAfterRender] = A(), this.svg = At(t.color), this.svg.appendChild(this.group), this.line = St(t.width), this.group.appendChild(this.line), t.hasSourceArrow && (this.sourceArrow = $(), this.group.appendChild(this.sourceArrow)), t.hasTargetArrow && (this.targetArrow = $(), this.group.appendChild(this.targetArrow));
|
|
1406
1370
|
}
|
|
1407
|
-
render(
|
|
1408
|
-
const { x:
|
|
1409
|
-
|
|
1410
|
-
|
|
1371
|
+
render(t) {
|
|
1372
|
+
const { x: e, y: s, width: i, height: n, flipX: a, flipY: h } = Pt(
|
|
1373
|
+
t.from,
|
|
1374
|
+
t.to
|
|
1411
1375
|
);
|
|
1412
|
-
|
|
1413
|
-
const d =
|
|
1414
|
-
|
|
1376
|
+
Et(this.svg, { x: e, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1377
|
+
const d = at(
|
|
1378
|
+
t.from.direction,
|
|
1415
1379
|
a,
|
|
1416
1380
|
h
|
|
1417
|
-
), c =
|
|
1418
|
-
|
|
1381
|
+
), c = at(
|
|
1382
|
+
t.to.direction,
|
|
1419
1383
|
a,
|
|
1420
1384
|
h
|
|
1421
1385
|
), l = {
|
|
@@ -1423,7 +1387,7 @@ class F {
|
|
|
1423
1387
|
y: n
|
|
1424
1388
|
};
|
|
1425
1389
|
let g = c, w = -this.params.arrowLength, f;
|
|
1426
|
-
|
|
1390
|
+
t.category === C.PortCycle ? (f = this.params.createCyclePath, g = d, w = this.params.arrowLength) : t.category === C.NodeCycle ? f = this.params.createDetourPath : f = this.params.createLinePath;
|
|
1427
1391
|
const y = f(
|
|
1428
1392
|
d,
|
|
1429
1393
|
c,
|
|
@@ -1452,8 +1416,8 @@ class F {
|
|
|
1452
1416
|
});
|
|
1453
1417
|
}
|
|
1454
1418
|
}
|
|
1455
|
-
class
|
|
1456
|
-
constructor(
|
|
1419
|
+
class _t {
|
|
1420
|
+
constructor(t) {
|
|
1457
1421
|
o(this, "svg");
|
|
1458
1422
|
o(this, "group");
|
|
1459
1423
|
o(this, "line");
|
|
@@ -1470,18 +1434,18 @@ class _e {
|
|
|
1470
1434
|
o(this, "hasSourceArrow");
|
|
1471
1435
|
o(this, "hasTargetArrow");
|
|
1472
1436
|
o(this, "pathShape");
|
|
1473
|
-
o(this, "createCyclePath", (
|
|
1474
|
-
sourceDirection:
|
|
1437
|
+
o(this, "createCyclePath", (t) => new Kt({
|
|
1438
|
+
sourceDirection: t,
|
|
1475
1439
|
radius: this.portCycleRadius,
|
|
1476
1440
|
smallRadius: this.portCycleSmallRadius,
|
|
1477
1441
|
arrowLength: this.arrowLength,
|
|
1478
1442
|
hasSourceArrow: this.hasSourceArrow,
|
|
1479
1443
|
hasTargetArrow: this.hasTargetArrow
|
|
1480
1444
|
}));
|
|
1481
|
-
o(this, "createDetourPath", (
|
|
1445
|
+
o(this, "createDetourPath", (t, e, s, i, n) => new Xt({
|
|
1482
1446
|
to: s,
|
|
1483
|
-
sourceDirection:
|
|
1484
|
-
targetDirection:
|
|
1447
|
+
sourceDirection: t,
|
|
1448
|
+
targetDirection: e,
|
|
1485
1449
|
flipX: i,
|
|
1486
1450
|
flipY: n,
|
|
1487
1451
|
arrowLength: this.arrowLength,
|
|
@@ -1491,18 +1455,18 @@ class _e {
|
|
|
1491
1455
|
hasSourceArrow: this.hasSourceArrow,
|
|
1492
1456
|
hasTargetArrow: this.hasTargetArrow
|
|
1493
1457
|
}));
|
|
1494
|
-
o(this, "createLinePath", (
|
|
1458
|
+
o(this, "createLinePath", (t, e, s) => new zt({
|
|
1495
1459
|
to: s,
|
|
1496
|
-
sourceDirection:
|
|
1497
|
-
targetDirection:
|
|
1460
|
+
sourceDirection: t,
|
|
1461
|
+
targetDirection: e,
|
|
1498
1462
|
arrowLength: this.arrowLength,
|
|
1499
1463
|
curvature: this.curvature,
|
|
1500
1464
|
hasSourceArrow: this.hasSourceArrow,
|
|
1501
1465
|
hasTargetArrow: this.hasTargetArrow
|
|
1502
1466
|
}));
|
|
1503
|
-
this.arrowLength = (
|
|
1504
|
-
color: (
|
|
1505
|
-
width: (
|
|
1467
|
+
this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.curvature = (t == null ? void 0 : t.curvature) ?? p.curvature, this.portCycleRadius = (t == null ? void 0 : t.cycleRadius) ?? p.cycleRadius, this.portCycleSmallRadius = (t == null ? void 0 : t.smallCycleRadius) ?? p.smallCycleRadius, this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? p.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
|
|
1468
|
+
color: (t == null ? void 0 : t.color) ?? p.color,
|
|
1469
|
+
width: (t == null ? void 0 : t.width) ?? p.width,
|
|
1506
1470
|
arrowLength: this.arrowLength,
|
|
1507
1471
|
arrowWidth: this.arrowWidth,
|
|
1508
1472
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1512,12 +1476,12 @@ class _e {
|
|
|
1512
1476
|
createLinePath: this.createLinePath
|
|
1513
1477
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1514
1478
|
}
|
|
1515
|
-
render(
|
|
1516
|
-
this.pathShape.render(
|
|
1479
|
+
render(t) {
|
|
1480
|
+
this.pathShape.render(t);
|
|
1517
1481
|
}
|
|
1518
1482
|
}
|
|
1519
|
-
class
|
|
1520
|
-
constructor(
|
|
1483
|
+
class qt {
|
|
1484
|
+
constructor(t) {
|
|
1521
1485
|
o(this, "svg");
|
|
1522
1486
|
o(this, "group");
|
|
1523
1487
|
o(this, "line");
|
|
@@ -1533,8 +1497,8 @@ class qe {
|
|
|
1533
1497
|
o(this, "hasSourceArrow");
|
|
1534
1498
|
o(this, "hasTargetArrow");
|
|
1535
1499
|
o(this, "pathShape");
|
|
1536
|
-
o(this, "createCyclePath", (
|
|
1537
|
-
sourceDirection:
|
|
1500
|
+
o(this, "createCyclePath", (t) => new G({
|
|
1501
|
+
sourceDirection: t,
|
|
1538
1502
|
arrowLength: this.arrowLength,
|
|
1539
1503
|
side: this.cycleSquareSide,
|
|
1540
1504
|
arrowOffset: this.arrowOffset,
|
|
@@ -1542,10 +1506,10 @@ class qe {
|
|
|
1542
1506
|
hasSourceArrow: this.hasSourceArrow,
|
|
1543
1507
|
hasTargetArrow: this.hasTargetArrow
|
|
1544
1508
|
}));
|
|
1545
|
-
o(this, "createDetourPath", (
|
|
1509
|
+
o(this, "createDetourPath", (t, e, s, i, n) => new Jt({
|
|
1546
1510
|
to: s,
|
|
1547
|
-
sourceDirection:
|
|
1548
|
-
targetDirection:
|
|
1511
|
+
sourceDirection: t,
|
|
1512
|
+
targetDirection: e,
|
|
1549
1513
|
flipX: i,
|
|
1550
1514
|
flipY: n,
|
|
1551
1515
|
arrowLength: this.arrowLength,
|
|
@@ -1555,10 +1519,10 @@ class qe {
|
|
|
1555
1519
|
hasSourceArrow: this.hasSourceArrow,
|
|
1556
1520
|
hasTargetArrow: this.hasTargetArrow
|
|
1557
1521
|
}));
|
|
1558
|
-
o(this, "createLinePath", (
|
|
1522
|
+
o(this, "createLinePath", (t, e, s, i) => new Yt({
|
|
1559
1523
|
to: s,
|
|
1560
|
-
sourceDirection:
|
|
1561
|
-
targetDirection:
|
|
1524
|
+
sourceDirection: t,
|
|
1525
|
+
targetDirection: e,
|
|
1562
1526
|
flipX: i,
|
|
1563
1527
|
arrowLength: this.arrowLength,
|
|
1564
1528
|
arrowOffset: this.arrowOffset,
|
|
@@ -1566,15 +1530,15 @@ class qe {
|
|
|
1566
1530
|
hasSourceArrow: this.hasSourceArrow,
|
|
1567
1531
|
hasTargetArrow: this.hasTargetArrow
|
|
1568
1532
|
}));
|
|
1569
|
-
this.arrowLength = (
|
|
1570
|
-
const
|
|
1533
|
+
this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? p.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? p.cycleSquareSide;
|
|
1534
|
+
const e = (t == null ? void 0 : t.roundness) ?? p.roundness;
|
|
1571
1535
|
this.roundness = Math.min(
|
|
1572
|
-
|
|
1536
|
+
e,
|
|
1573
1537
|
this.arrowOffset,
|
|
1574
1538
|
this.cycleSquareSide / 2
|
|
1575
|
-
), this.detourDistance = (
|
|
1576
|
-
color: (
|
|
1577
|
-
width: (
|
|
1539
|
+
), this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
|
|
1540
|
+
color: (t == null ? void 0 : t.color) ?? p.color,
|
|
1541
|
+
width: (t == null ? void 0 : t.width) ?? p.width,
|
|
1578
1542
|
arrowLength: this.arrowLength,
|
|
1579
1543
|
arrowWidth: this.arrowWidth,
|
|
1580
1544
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1584,12 +1548,12 @@ class qe {
|
|
|
1584
1548
|
createLinePath: this.createLinePath
|
|
1585
1549
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1586
1550
|
}
|
|
1587
|
-
render(
|
|
1588
|
-
this.pathShape.render(
|
|
1551
|
+
render(t) {
|
|
1552
|
+
this.pathShape.render(t);
|
|
1589
1553
|
}
|
|
1590
1554
|
}
|
|
1591
|
-
class
|
|
1592
|
-
constructor(
|
|
1555
|
+
class te {
|
|
1556
|
+
constructor(t) {
|
|
1593
1557
|
o(this, "svg");
|
|
1594
1558
|
o(this, "group");
|
|
1595
1559
|
o(this, "line");
|
|
@@ -1606,8 +1570,8 @@ class et {
|
|
|
1606
1570
|
o(this, "hasSourceArrow");
|
|
1607
1571
|
o(this, "hasTargetArrow");
|
|
1608
1572
|
o(this, "pathShape");
|
|
1609
|
-
o(this, "createCyclePath", (
|
|
1610
|
-
sourceDirection:
|
|
1573
|
+
o(this, "createCyclePath", (t) => new G({
|
|
1574
|
+
sourceDirection: t,
|
|
1611
1575
|
arrowLength: this.arrowLength,
|
|
1612
1576
|
side: this.cycleSquareSide,
|
|
1613
1577
|
arrowOffset: this.arrowOffset,
|
|
@@ -1615,10 +1579,10 @@ class et {
|
|
|
1615
1579
|
hasSourceArrow: this.hasSourceArrow,
|
|
1616
1580
|
hasTargetArrow: this.hasTargetArrow
|
|
1617
1581
|
}));
|
|
1618
|
-
o(this, "createDetourPath", (
|
|
1582
|
+
o(this, "createDetourPath", (t, e, s, i, n) => new Ht({
|
|
1619
1583
|
to: s,
|
|
1620
|
-
sourceDirection:
|
|
1621
|
-
targetDirection:
|
|
1584
|
+
sourceDirection: t,
|
|
1585
|
+
targetDirection: e,
|
|
1622
1586
|
flipX: i,
|
|
1623
1587
|
flipY: n,
|
|
1624
1588
|
arrowLength: this.arrowLength,
|
|
@@ -1629,25 +1593,25 @@ class et {
|
|
|
1629
1593
|
hasSourceArrow: this.hasSourceArrow,
|
|
1630
1594
|
hasTargetArrow: this.hasTargetArrow
|
|
1631
1595
|
}));
|
|
1632
|
-
o(this, "createLinePath", (
|
|
1596
|
+
o(this, "createLinePath", (t, e, s) => new jt({
|
|
1633
1597
|
to: s,
|
|
1634
|
-
sourceDirection:
|
|
1635
|
-
targetDirection:
|
|
1598
|
+
sourceDirection: t,
|
|
1599
|
+
targetDirection: e,
|
|
1636
1600
|
arrowLength: this.arrowLength,
|
|
1637
1601
|
arrowOffset: this.arrowOffset,
|
|
1638
1602
|
roundness: this.roundness,
|
|
1639
1603
|
hasSourceArrow: this.hasSourceArrow,
|
|
1640
1604
|
hasTargetArrow: this.hasTargetArrow
|
|
1641
1605
|
}));
|
|
1642
|
-
this.arrowLength = (
|
|
1643
|
-
const
|
|
1606
|
+
this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? p.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? p.cycleSquareSide;
|
|
1607
|
+
const e = (t == null ? void 0 : t.roundness) ?? p.roundness;
|
|
1644
1608
|
this.roundness = Math.min(
|
|
1645
|
-
|
|
1609
|
+
e,
|
|
1646
1610
|
this.arrowOffset,
|
|
1647
1611
|
this.cycleSquareSide / 2
|
|
1648
|
-
), this.detourDirection = (
|
|
1649
|
-
color: (
|
|
1650
|
-
width: (
|
|
1612
|
+
), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? p.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
|
|
1613
|
+
color: (t == null ? void 0 : t.color) ?? p.color,
|
|
1614
|
+
width: (t == null ? void 0 : t.width) ?? p.width,
|
|
1651
1615
|
arrowLength: this.arrowLength,
|
|
1652
1616
|
arrowWidth: this.arrowWidth,
|
|
1653
1617
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1657,12 +1621,12 @@ class et {
|
|
|
1657
1621
|
createLinePath: this.createLinePath
|
|
1658
1622
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1659
1623
|
}
|
|
1660
|
-
render(
|
|
1661
|
-
this.pathShape.render(
|
|
1624
|
+
render(t) {
|
|
1625
|
+
this.pathShape.render(t);
|
|
1662
1626
|
}
|
|
1663
1627
|
}
|
|
1664
|
-
class
|
|
1665
|
-
constructor(
|
|
1628
|
+
class ee {
|
|
1629
|
+
constructor(t) {
|
|
1666
1630
|
o(this, "svg");
|
|
1667
1631
|
o(this, "group");
|
|
1668
1632
|
o(this, "line");
|
|
@@ -1678,8 +1642,8 @@ class tt {
|
|
|
1678
1642
|
o(this, "hasSourceArrow");
|
|
1679
1643
|
o(this, "hasTargetArrow");
|
|
1680
1644
|
o(this, "pathShape");
|
|
1681
|
-
o(this, "createCyclePath", (
|
|
1682
|
-
sourceDirection:
|
|
1645
|
+
o(this, "createCyclePath", (t) => new G({
|
|
1646
|
+
sourceDirection: t,
|
|
1683
1647
|
arrowLength: this.arrowLength,
|
|
1684
1648
|
side: this.cycleSquareSide,
|
|
1685
1649
|
arrowOffset: this.arrowOffset,
|
|
@@ -1687,10 +1651,10 @@ class tt {
|
|
|
1687
1651
|
hasSourceArrow: this.hasSourceArrow,
|
|
1688
1652
|
hasTargetArrow: this.hasTargetArrow
|
|
1689
1653
|
}));
|
|
1690
|
-
o(this, "createDetourPath", (
|
|
1654
|
+
o(this, "createDetourPath", (t, e, s, i, n) => new Qt({
|
|
1691
1655
|
to: s,
|
|
1692
|
-
sourceDirection:
|
|
1693
|
-
targetDirection:
|
|
1656
|
+
sourceDirection: t,
|
|
1657
|
+
targetDirection: e,
|
|
1694
1658
|
flipX: i,
|
|
1695
1659
|
flipY: n,
|
|
1696
1660
|
arrowLength: this.arrowLength,
|
|
@@ -1700,10 +1664,10 @@ class tt {
|
|
|
1700
1664
|
hasSourceArrow: this.hasSourceArrow,
|
|
1701
1665
|
hasTargetArrow: this.hasTargetArrow
|
|
1702
1666
|
}));
|
|
1703
|
-
o(this, "createLinePath", (
|
|
1667
|
+
o(this, "createLinePath", (t, e, s, i, n) => new Gt({
|
|
1704
1668
|
to: s,
|
|
1705
|
-
sourceDirection:
|
|
1706
|
-
targetDirection:
|
|
1669
|
+
sourceDirection: t,
|
|
1670
|
+
targetDirection: e,
|
|
1707
1671
|
flipY: n,
|
|
1708
1672
|
arrowLength: this.arrowLength,
|
|
1709
1673
|
arrowOffset: this.arrowOffset,
|
|
@@ -1711,15 +1675,15 @@ class tt {
|
|
|
1711
1675
|
hasSourceArrow: this.hasSourceArrow,
|
|
1712
1676
|
hasTargetArrow: this.hasTargetArrow
|
|
1713
1677
|
}));
|
|
1714
|
-
this.arrowLength = (
|
|
1715
|
-
const
|
|
1678
|
+
this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? p.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? p.cycleSquareSide;
|
|
1679
|
+
const e = (t == null ? void 0 : t.roundness) ?? p.roundness;
|
|
1716
1680
|
this.roundness = Math.min(
|
|
1717
|
-
|
|
1681
|
+
e,
|
|
1718
1682
|
this.arrowOffset,
|
|
1719
1683
|
this.cycleSquareSide / 2
|
|
1720
|
-
), this.detourDistance = (
|
|
1721
|
-
color: (
|
|
1722
|
-
width: (
|
|
1684
|
+
), this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
|
|
1685
|
+
color: (t == null ? void 0 : t.color) ?? p.color,
|
|
1686
|
+
width: (t == null ? void 0 : t.width) ?? p.width,
|
|
1723
1687
|
arrowLength: this.arrowLength,
|
|
1724
1688
|
arrowWidth: this.arrowWidth,
|
|
1725
1689
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1729,18 +1693,18 @@ class tt {
|
|
|
1729
1693
|
createLinePath: this.createLinePath
|
|
1730
1694
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1731
1695
|
}
|
|
1732
|
-
render(
|
|
1733
|
-
this.pathShape.render(
|
|
1696
|
+
render(t) {
|
|
1697
|
+
this.pathShape.render(t);
|
|
1734
1698
|
}
|
|
1735
1699
|
}
|
|
1736
|
-
const
|
|
1700
|
+
const ht = (r) => {
|
|
1737
1701
|
if (r.diagonalDistance === 0)
|
|
1738
1702
|
return "";
|
|
1739
|
-
const
|
|
1740
|
-
x:
|
|
1741
|
-
y: s *
|
|
1703
|
+
const t = r.offset / r.diagonalDistance, e = r.flip * r.to.x, s = r.flip * r.to.y, i = {
|
|
1704
|
+
x: e * t + r.shift.x,
|
|
1705
|
+
y: s * t + r.shift.y
|
|
1742
1706
|
}, n = {
|
|
1743
|
-
x:
|
|
1707
|
+
x: e / r.diagonalDistance,
|
|
1744
1708
|
y: s / r.diagonalDistance
|
|
1745
1709
|
};
|
|
1746
1710
|
return X(
|
|
@@ -1750,10 +1714,10 @@ const he = (r) => {
|
|
|
1750
1714
|
r.arrowWidth
|
|
1751
1715
|
);
|
|
1752
1716
|
};
|
|
1753
|
-
class
|
|
1754
|
-
constructor(
|
|
1717
|
+
class bt {
|
|
1718
|
+
constructor(t) {
|
|
1755
1719
|
o(this, "svg");
|
|
1756
|
-
o(this, "group",
|
|
1720
|
+
o(this, "group", xt());
|
|
1757
1721
|
o(this, "line");
|
|
1758
1722
|
o(this, "sourceArrow", null);
|
|
1759
1723
|
o(this, "targetArrow", null);
|
|
@@ -1765,15 +1729,15 @@ class be {
|
|
|
1765
1729
|
o(this, "targetOffset");
|
|
1766
1730
|
o(this, "onAfterRender");
|
|
1767
1731
|
o(this, "afterRenderEmitter");
|
|
1768
|
-
[this.afterRenderEmitter, this.onAfterRender] = A(), this.color = (
|
|
1732
|
+
[this.afterRenderEmitter, this.onAfterRender] = A(), this.color = (t == null ? void 0 : t.color) ?? p.color, this.width = (t == null ? void 0 : t.width) ?? p.width, this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.sourceOffset = (t == null ? void 0 : t.sourceOffset) ?? p.preOffset, this.targetOffset = (t == null ? void 0 : t.targetOffset) ?? p.preOffset, this.svg = At(this.color), this.svg.appendChild(this.group), this.line = St(this.width), this.group.appendChild(this.line), t != null && t.hasSourceArrow && (this.sourceArrow = $(), this.group.appendChild(this.sourceArrow)), t != null && t.hasTargetArrow && (this.targetArrow = $(), this.group.appendChild(this.targetArrow));
|
|
1769
1733
|
}
|
|
1770
|
-
render(
|
|
1771
|
-
const { x:
|
|
1772
|
-
|
|
1773
|
-
|
|
1734
|
+
render(t) {
|
|
1735
|
+
const { x: e, y: s, width: i, height: n, flipX: a, flipY: h } = Pt(
|
|
1736
|
+
t.from,
|
|
1737
|
+
t.to
|
|
1774
1738
|
);
|
|
1775
|
-
|
|
1776
|
-
const d = { x: i, y: n }, c = new
|
|
1739
|
+
Et(this.svg, { x: e, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1740
|
+
const d = { x: i, y: n }, c = new Zt({
|
|
1777
1741
|
to: d,
|
|
1778
1742
|
sourceOffset: this.sourceOffset,
|
|
1779
1743
|
targetOffset: this.targetOffset,
|
|
@@ -1783,7 +1747,7 @@ class be {
|
|
|
1783
1747
|
});
|
|
1784
1748
|
this.line.setAttribute("d", c.path);
|
|
1785
1749
|
let l = null;
|
|
1786
|
-
this.sourceArrow && (l =
|
|
1750
|
+
this.sourceArrow && (l = ht({
|
|
1787
1751
|
diagonalDistance: c.diagonalDistance,
|
|
1788
1752
|
to: d,
|
|
1789
1753
|
offset: this.sourceOffset,
|
|
@@ -1793,7 +1757,7 @@ class be {
|
|
|
1793
1757
|
arrowLength: this.arrowLength
|
|
1794
1758
|
}), this.sourceArrow.setAttribute("d", l));
|
|
1795
1759
|
let g = null;
|
|
1796
|
-
this.targetArrow && (g =
|
|
1760
|
+
this.targetArrow && (g = ht({
|
|
1797
1761
|
diagonalDistance: c.diagonalDistance,
|
|
1798
1762
|
to: d,
|
|
1799
1763
|
offset: this.targetOffset,
|
|
@@ -1808,137 +1772,126 @@ class be {
|
|
|
1808
1772
|
});
|
|
1809
1773
|
}
|
|
1810
1774
|
}
|
|
1811
|
-
const
|
|
1775
|
+
const re = () => {
|
|
1812
1776
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1813
1777
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1814
|
-
},
|
|
1815
|
-
const
|
|
1816
|
-
return
|
|
1817
|
-
},
|
|
1818
|
-
const
|
|
1819
|
-
return
|
|
1778
|
+
}, oe = (r) => {
|
|
1779
|
+
const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1780
|
+
return t.setAttribute("stroke", "transparent"), t.setAttribute("stroke-width", `${r}`), t.setAttribute("fill", "none"), t.setAttribute("stroke-linecap", "round"), t;
|
|
1781
|
+
}, dt = (r) => {
|
|
1782
|
+
const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1783
|
+
return t.setAttribute("stroke-linejoin", "round"), t.setAttribute("stroke-width", `${r}`), t.setAttribute("fill", "transparent"), t.setAttribute("stroke", "transparent"), t;
|
|
1820
1784
|
};
|
|
1821
|
-
class
|
|
1822
|
-
constructor(
|
|
1823
|
-
super(
|
|
1785
|
+
class se extends Error {
|
|
1786
|
+
constructor(t) {
|
|
1787
|
+
super(t), this.name = "InteractiveEdgeError";
|
|
1824
1788
|
}
|
|
1825
1789
|
}
|
|
1826
|
-
class
|
|
1827
|
-
constructor(
|
|
1790
|
+
class Tt {
|
|
1791
|
+
constructor(t, e) {
|
|
1828
1792
|
o(this, "svg");
|
|
1829
1793
|
o(this, "group");
|
|
1830
1794
|
o(this, "line");
|
|
1831
1795
|
o(this, "sourceArrow");
|
|
1832
1796
|
o(this, "targetArrow");
|
|
1833
|
-
o(this, "handle",
|
|
1797
|
+
o(this, "handle", re());
|
|
1834
1798
|
o(this, "onAfterRender");
|
|
1835
1799
|
o(this, "interactiveLine");
|
|
1836
1800
|
o(this, "interactiveSourceArrow", null);
|
|
1837
1801
|
o(this, "interactiveTargetArrow", null);
|
|
1838
|
-
if (this.baseEdge =
|
|
1839
|
-
throw new
|
|
1802
|
+
if (this.baseEdge = t, t instanceof Tt)
|
|
1803
|
+
throw new se(
|
|
1840
1804
|
"interactive edge can be configured only once"
|
|
1841
1805
|
);
|
|
1842
1806
|
this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
|
|
1843
|
-
const s = (
|
|
1844
|
-
this.interactiveLine =
|
|
1807
|
+
const s = (e == null ? void 0 : e.distance) ?? p.interactiveWidth;
|
|
1808
|
+
this.interactiveLine = oe(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = dt(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = dt(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
|
|
1845
1809
|
this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
|
|
1846
1810
|
});
|
|
1847
1811
|
}
|
|
1848
|
-
render(
|
|
1849
|
-
this.baseEdge.render(
|
|
1812
|
+
render(t) {
|
|
1813
|
+
this.baseEdge.render(t);
|
|
1850
1814
|
}
|
|
1851
1815
|
}
|
|
1852
|
-
class
|
|
1853
|
-
constructor(
|
|
1816
|
+
class Ne {
|
|
1817
|
+
constructor(t, e) {
|
|
1854
1818
|
o(this, "group");
|
|
1855
1819
|
o(this, "line");
|
|
1856
1820
|
o(this, "sourceArrow");
|
|
1857
1821
|
o(this, "targetArrow");
|
|
1858
1822
|
o(this, "onAfterRender");
|
|
1859
1823
|
o(this, "svg");
|
|
1860
|
-
|
|
1861
|
-
* @deprecated
|
|
1862
|
-
* use midpointElement instead
|
|
1863
|
-
*/
|
|
1864
|
-
o(this, "medianElement");
|
|
1865
|
-
this.baseShape = e, this.midpointElement = t, this.medianElement = this.midpointElement, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((s) => {
|
|
1824
|
+
this.baseShape = t, this.midpointElement = e, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((s) => {
|
|
1866
1825
|
const i = s.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
|
|
1867
1826
|
this.midpointElement.style.setProperty("transform", n);
|
|
1868
1827
|
});
|
|
1869
1828
|
}
|
|
1870
|
-
render(
|
|
1871
|
-
this.baseShape.render(
|
|
1829
|
+
render(t) {
|
|
1830
|
+
this.baseShape.render(t);
|
|
1872
1831
|
}
|
|
1873
1832
|
}
|
|
1874
|
-
const
|
|
1875
|
-
const
|
|
1833
|
+
const Dt = (r, t) => {
|
|
1834
|
+
const e = new mt(), s = new pt(e, t, r), i = {
|
|
1876
1835
|
nodes: {
|
|
1877
|
-
centerFn:
|
|
1836
|
+
centerFn: vt,
|
|
1878
1837
|
priorityFn: () => 0
|
|
1879
1838
|
},
|
|
1880
1839
|
edges: {
|
|
1881
|
-
shapeFactory: () => new
|
|
1840
|
+
shapeFactory: () => new bt(),
|
|
1882
1841
|
priorityFn: () => 0
|
|
1883
1842
|
},
|
|
1884
1843
|
ports: {
|
|
1885
1844
|
direction: 0
|
|
1886
1845
|
}
|
|
1887
1846
|
};
|
|
1888
|
-
return new
|
|
1889
|
-
r,
|
|
1890
|
-
t,
|
|
1891
|
-
e,
|
|
1892
|
-
s,
|
|
1893
|
-
i
|
|
1894
|
-
);
|
|
1847
|
+
return new ft(e, t, s, i);
|
|
1895
1848
|
};
|
|
1896
1849
|
class O {
|
|
1897
|
-
constructor(
|
|
1898
|
-
o(this, "onAfterPortMarked", (
|
|
1899
|
-
const
|
|
1900
|
-
this.canvas.graph.getElementPortIds(
|
|
1850
|
+
constructor(t, e, s, i) {
|
|
1851
|
+
o(this, "onAfterPortMarked", (t) => {
|
|
1852
|
+
const e = this.canvas.graph.getPort(t);
|
|
1853
|
+
this.canvas.graph.getElementPortIds(e.element).length === 1 && this.hookPortEvents(e.element);
|
|
1901
1854
|
});
|
|
1902
|
-
o(this, "onBeforePortUnmarked", (
|
|
1903
|
-
const
|
|
1904
|
-
this.canvas.graph.getElementPortIds(
|
|
1855
|
+
o(this, "onBeforePortUnmarked", (t) => {
|
|
1856
|
+
const e = this.canvas.graph.getPort(t);
|
|
1857
|
+
this.canvas.graph.getElementPortIds(e.element).length === 1 && this.unhookPortEvents(e.element);
|
|
1905
1858
|
});
|
|
1906
|
-
o(this, "onPortMouseDown", (
|
|
1907
|
-
if (!this.params.mouseDownEventVerifier(
|
|
1859
|
+
o(this, "onPortMouseDown", (t) => {
|
|
1860
|
+
if (!this.params.mouseDownEventVerifier(t))
|
|
1908
1861
|
return;
|
|
1909
|
-
const
|
|
1862
|
+
const e = t.currentTarget, s = this.canvas.graph.getElementPortIds(e)[0];
|
|
1910
1863
|
this.params.onPortPointerDown(s, {
|
|
1911
|
-
x:
|
|
1912
|
-
y:
|
|
1913
|
-
}) && (
|
|
1864
|
+
x: t.clientX,
|
|
1865
|
+
y: t.clientY
|
|
1866
|
+
}) && (t.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
1914
1867
|
passive: !0
|
|
1915
1868
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
1916
1869
|
passive: !0
|
|
1917
1870
|
}));
|
|
1918
1871
|
});
|
|
1919
|
-
o(this, "onWindowMouseMove", (
|
|
1920
|
-
if (!
|
|
1872
|
+
o(this, "onWindowMouseMove", (t) => {
|
|
1873
|
+
if (!R(
|
|
1921
1874
|
this.window,
|
|
1922
1875
|
this.element,
|
|
1923
|
-
|
|
1924
|
-
|
|
1876
|
+
t.clientX,
|
|
1877
|
+
t.clientY
|
|
1925
1878
|
)) {
|
|
1926
1879
|
this.stopMouseDrag();
|
|
1927
1880
|
return;
|
|
1928
1881
|
}
|
|
1929
|
-
this.params.onPointerMove({ x:
|
|
1882
|
+
this.params.onPointerMove({ x: t.clientX, y: t.clientY });
|
|
1930
1883
|
});
|
|
1931
|
-
o(this, "onWindowMouseUp", (
|
|
1932
|
-
this.params.mouseUpEventVerifier(
|
|
1884
|
+
o(this, "onWindowMouseUp", (t) => {
|
|
1885
|
+
this.params.mouseUpEventVerifier(t) && (this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopMouseDrag());
|
|
1933
1886
|
});
|
|
1934
|
-
o(this, "onPortTouchStart", (
|
|
1935
|
-
if (
|
|
1887
|
+
o(this, "onPortTouchStart", (t) => {
|
|
1888
|
+
if (t.touches.length !== 1)
|
|
1936
1889
|
return;
|
|
1937
|
-
const
|
|
1890
|
+
const e = t.touches[0], s = t.currentTarget, i = this.canvas.graph.getElementPortIds(s)[0];
|
|
1938
1891
|
this.params.onPortPointerDown(i, {
|
|
1939
|
-
x:
|
|
1940
|
-
y:
|
|
1941
|
-
}) && (
|
|
1892
|
+
x: e.clientX,
|
|
1893
|
+
y: e.clientY
|
|
1894
|
+
}) && (t.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
1942
1895
|
passive: !0
|
|
1943
1896
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
1944
1897
|
passive: !0
|
|
@@ -1946,46 +1899,46 @@ class O {
|
|
|
1946
1899
|
passive: !0
|
|
1947
1900
|
}));
|
|
1948
1901
|
});
|
|
1949
|
-
o(this, "onWindowTouchMove", (
|
|
1950
|
-
const
|
|
1951
|
-
if (!
|
|
1902
|
+
o(this, "onWindowTouchMove", (t) => {
|
|
1903
|
+
const e = t.touches[0];
|
|
1904
|
+
if (!R(
|
|
1952
1905
|
this.window,
|
|
1953
1906
|
this.element,
|
|
1954
|
-
|
|
1955
|
-
|
|
1907
|
+
e.clientX,
|
|
1908
|
+
e.clientY
|
|
1956
1909
|
)) {
|
|
1957
1910
|
this.stopTouchDrag();
|
|
1958
1911
|
return;
|
|
1959
1912
|
}
|
|
1960
|
-
this.params.onPointerMove({ x:
|
|
1913
|
+
this.params.onPointerMove({ x: e.clientX, y: e.clientY });
|
|
1961
1914
|
});
|
|
1962
|
-
o(this, "onWindowTouchFinish", (
|
|
1963
|
-
const
|
|
1964
|
-
this.params.onPointerUp({ x:
|
|
1915
|
+
o(this, "onWindowTouchFinish", (t) => {
|
|
1916
|
+
const e = t.changedTouches[0];
|
|
1917
|
+
this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopTouchDrag();
|
|
1965
1918
|
});
|
|
1966
1919
|
o(this, "onBeforeClear", () => {
|
|
1967
|
-
this.canvas.graph.getAllPortIds().forEach((
|
|
1968
|
-
const
|
|
1969
|
-
this.unhookPortEvents(
|
|
1920
|
+
this.canvas.graph.getAllPortIds().forEach((t) => {
|
|
1921
|
+
const e = this.canvas.graph.getPort(t);
|
|
1922
|
+
this.unhookPortEvents(e.element);
|
|
1970
1923
|
});
|
|
1971
1924
|
});
|
|
1972
1925
|
o(this, "onBeforeDestroy", () => {
|
|
1973
1926
|
this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
1974
1927
|
});
|
|
1975
|
-
this.canvas =
|
|
1928
|
+
this.canvas = t, this.element = e, this.window = s, this.params = i, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1976
1929
|
}
|
|
1977
|
-
static configure(
|
|
1978
|
-
new O(
|
|
1930
|
+
static configure(t, e, s, i) {
|
|
1931
|
+
new O(t, e, s, i);
|
|
1979
1932
|
}
|
|
1980
|
-
hookPortEvents(
|
|
1981
|
-
|
|
1933
|
+
hookPortEvents(t) {
|
|
1934
|
+
t.addEventListener("mousedown", this.onPortMouseDown, {
|
|
1982
1935
|
passive: !0
|
|
1983
|
-
}),
|
|
1936
|
+
}), t.addEventListener("touchstart", this.onPortTouchStart, {
|
|
1984
1937
|
passive: !0
|
|
1985
1938
|
});
|
|
1986
1939
|
}
|
|
1987
|
-
unhookPortEvents(
|
|
1988
|
-
|
|
1940
|
+
unhookPortEvents(t) {
|
|
1941
|
+
t.removeEventListener("mousedown", this.onPortMouseDown), t.removeEventListener("touchstart", this.onPortTouchStart);
|
|
1989
1942
|
}
|
|
1990
1943
|
stopMouseDrag() {
|
|
1991
1944
|
this.params.onStopDrag(), this.removeWindowMouseListeners();
|
|
@@ -2001,50 +1954,45 @@ class O {
|
|
|
2001
1954
|
}
|
|
2002
1955
|
}
|
|
2003
1956
|
class Z {
|
|
2004
|
-
constructor(
|
|
1957
|
+
constructor(t, e, s, i) {
|
|
2005
1958
|
o(this, "grabbedNode", null);
|
|
2006
1959
|
o(this, "maxNodePriority", 0);
|
|
2007
1960
|
o(this, "graph");
|
|
2008
|
-
o(this, "onAfterNodeAdded", (
|
|
2009
|
-
this.updateMaxNodePriority(
|
|
2010
|
-
const
|
|
2011
|
-
|
|
1961
|
+
o(this, "onAfterNodeAdded", (t) => {
|
|
1962
|
+
this.updateMaxNodePriority(t);
|
|
1963
|
+
const e = this.graph.getNode(t);
|
|
1964
|
+
e.element.addEventListener("mousedown", this.onMouseDown, {
|
|
2012
1965
|
passive: !0
|
|
2013
|
-
}),
|
|
1966
|
+
}), e.element.addEventListener("touchstart", this.onTouchStart, {
|
|
2014
1967
|
passive: !0
|
|
2015
1968
|
});
|
|
2016
1969
|
});
|
|
2017
|
-
o(this, "onAfterNodeUpdated", (
|
|
2018
|
-
this.updateMaxNodePriority(
|
|
1970
|
+
o(this, "onAfterNodeUpdated", (t) => {
|
|
1971
|
+
this.updateMaxNodePriority(t);
|
|
2019
1972
|
});
|
|
2020
|
-
o(this, "onBeforeNodeRemoved", (
|
|
2021
|
-
const
|
|
2022
|
-
|
|
1973
|
+
o(this, "onBeforeNodeRemoved", (t) => {
|
|
1974
|
+
const e = this.graph.getNode(t);
|
|
1975
|
+
e.element.removeEventListener("mousedown", this.onMouseDown), e.element.removeEventListener("touchstart", this.onTouchStart);
|
|
2023
1976
|
});
|
|
2024
1977
|
o(this, "onBeforeDestroy", () => {
|
|
2025
1978
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2026
1979
|
});
|
|
2027
1980
|
o(this, "onBeforeClear", () => {
|
|
2028
|
-
this.canvas.graph.getAllNodeIds().forEach((
|
|
2029
|
-
const
|
|
2030
|
-
|
|
1981
|
+
this.canvas.graph.getAllNodeIds().forEach((t) => {
|
|
1982
|
+
const e = this.canvas.graph.getNode(t);
|
|
1983
|
+
e.element.removeEventListener("mousedown", this.onMouseDown), e.element.removeEventListener("touchstart", this.onTouchStart);
|
|
2031
1984
|
}), this.maxNodePriority = 0;
|
|
2032
1985
|
});
|
|
2033
|
-
o(this, "onMouseDown", (
|
|
2034
|
-
if (!this.params.mouseDownEventVerifier(
|
|
1986
|
+
o(this, "onMouseDown", (t) => {
|
|
1987
|
+
if (!this.params.mouseDownEventVerifier(t))
|
|
2035
1988
|
return;
|
|
2036
|
-
const
|
|
2037
|
-
if (!this.params.
|
|
2038
|
-
nodeId: s,
|
|
2039
|
-
element: i.element,
|
|
2040
|
-
x: i.x,
|
|
2041
|
-
y: i.y
|
|
2042
|
-
}))
|
|
1989
|
+
const e = t.currentTarget, s = this.graph.getElementNodeId(e), i = this.graph.getNode(s);
|
|
1990
|
+
if (!this.params.nodeDragVerifier(s))
|
|
2043
1991
|
return;
|
|
2044
|
-
|
|
1992
|
+
t.stopPropagation();
|
|
2045
1993
|
const a = this.calculateContentPoint({
|
|
2046
|
-
x:
|
|
2047
|
-
y:
|
|
1994
|
+
x: t.clientX,
|
|
1995
|
+
y: t.clientY
|
|
2048
1996
|
});
|
|
2049
1997
|
this.grabbedNode = {
|
|
2050
1998
|
nodeId: s,
|
|
@@ -2056,12 +2004,12 @@ class Z {
|
|
|
2056
2004
|
passive: !0
|
|
2057
2005
|
});
|
|
2058
2006
|
});
|
|
2059
|
-
o(this, "onTouchStart", (
|
|
2060
|
-
if (
|
|
2007
|
+
o(this, "onTouchStart", (t) => {
|
|
2008
|
+
if (t.touches.length !== 1)
|
|
2061
2009
|
return;
|
|
2062
|
-
|
|
2063
|
-
const
|
|
2064
|
-
if (!this.params.
|
|
2010
|
+
t.stopPropagation();
|
|
2011
|
+
const e = t.touches[0], s = t.currentTarget, i = this.canvas.graph.getElementNodeId(s), n = this.graph.getNode(i);
|
|
2012
|
+
if (!this.params.nodeDragVerifier({
|
|
2065
2013
|
nodeId: i,
|
|
2066
2014
|
element: n.element,
|
|
2067
2015
|
x: n.x,
|
|
@@ -2069,8 +2017,8 @@ class Z {
|
|
|
2069
2017
|
}))
|
|
2070
2018
|
return;
|
|
2071
2019
|
const h = this.calculateContentPoint({
|
|
2072
|
-
x:
|
|
2073
|
-
y:
|
|
2020
|
+
x: e.clientX,
|
|
2021
|
+
y: e.clientY
|
|
2074
2022
|
});
|
|
2075
2023
|
this.grabbedNode = {
|
|
2076
2024
|
nodeId: i,
|
|
@@ -2084,102 +2032,87 @@ class Z {
|
|
|
2084
2032
|
passive: !0
|
|
2085
2033
|
});
|
|
2086
2034
|
});
|
|
2087
|
-
o(this, "onWindowMouseMove", (
|
|
2088
|
-
if (!
|
|
2035
|
+
o(this, "onWindowMouseMove", (t) => {
|
|
2036
|
+
if (!R(
|
|
2089
2037
|
this.window,
|
|
2090
2038
|
this.element,
|
|
2091
|
-
|
|
2092
|
-
|
|
2039
|
+
t.clientX,
|
|
2040
|
+
t.clientY
|
|
2093
2041
|
)) {
|
|
2094
2042
|
this.cancelMouseDrag();
|
|
2095
2043
|
return;
|
|
2096
2044
|
}
|
|
2097
2045
|
this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
|
|
2098
|
-
x:
|
|
2099
|
-
y:
|
|
2046
|
+
x: t.clientX,
|
|
2047
|
+
y: t.clientY
|
|
2100
2048
|
});
|
|
2101
2049
|
});
|
|
2102
|
-
o(this, "onWindowMouseUp", (
|
|
2103
|
-
this.params.mouseUpEventVerifier(
|
|
2050
|
+
o(this, "onWindowMouseUp", (t) => {
|
|
2051
|
+
this.params.mouseUpEventVerifier(t) && this.cancelMouseDrag();
|
|
2104
2052
|
});
|
|
2105
|
-
o(this, "onWindowTouchMove", (
|
|
2106
|
-
if (
|
|
2053
|
+
o(this, "onWindowTouchMove", (t) => {
|
|
2054
|
+
if (t.touches.length !== 1)
|
|
2107
2055
|
return;
|
|
2108
|
-
const
|
|
2109
|
-
if (!
|
|
2056
|
+
const e = t.touches[0];
|
|
2057
|
+
if (!R(
|
|
2110
2058
|
this.window,
|
|
2111
2059
|
this.element,
|
|
2112
|
-
|
|
2113
|
-
|
|
2060
|
+
e.clientX,
|
|
2061
|
+
e.clientY
|
|
2114
2062
|
)) {
|
|
2115
2063
|
this.cancelTouchDrag();
|
|
2116
2064
|
return;
|
|
2117
2065
|
}
|
|
2118
2066
|
this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
|
|
2119
|
-
x:
|
|
2120
|
-
y:
|
|
2067
|
+
x: e.clientX,
|
|
2068
|
+
y: e.clientY
|
|
2121
2069
|
});
|
|
2122
2070
|
});
|
|
2123
2071
|
o(this, "onWindowTouchFinish", () => {
|
|
2124
2072
|
this.cancelTouchDrag();
|
|
2125
2073
|
});
|
|
2126
|
-
this.canvas =
|
|
2074
|
+
this.canvas = t, this.element = e, this.window = s, this.params = i, this.graph = t.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2127
2075
|
}
|
|
2128
|
-
static configure(
|
|
2129
|
-
new Z(
|
|
2076
|
+
static configure(t, e, s, i) {
|
|
2077
|
+
new Z(t, e, s, i);
|
|
2130
2078
|
}
|
|
2131
|
-
moveNode(
|
|
2132
|
-
|
|
2133
|
-
if (s === null)
|
|
2079
|
+
moveNode(t, e) {
|
|
2080
|
+
if (this.graph.getNode(t.nodeId) === null)
|
|
2134
2081
|
return;
|
|
2135
|
-
const i = this.calculateContentPoint(
|
|
2136
|
-
x: i.x -
|
|
2137
|
-
y: i.y -
|
|
2082
|
+
const i = this.calculateContentPoint(e), n = {
|
|
2083
|
+
x: i.x - t.dx,
|
|
2084
|
+
y: i.y - t.dy
|
|
2138
2085
|
}, a = this.adjustNodeCoords(n);
|
|
2139
|
-
this.canvas.updateNode(
|
|
2140
|
-
x: a.x,
|
|
2141
|
-
y: a.y
|
|
2142
|
-
}), this.params.onNodeDrag({
|
|
2143
|
-
nodeId: e.nodeId,
|
|
2144
|
-
element: s.element,
|
|
2086
|
+
this.canvas.updateNode(t.nodeId, {
|
|
2145
2087
|
x: a.x,
|
|
2146
2088
|
y: a.y
|
|
2147
|
-
});
|
|
2089
|
+
}), this.params.onNodeDrag(t.nodeId);
|
|
2148
2090
|
}
|
|
2149
|
-
moveNodeOnTop(
|
|
2091
|
+
moveNodeOnTop(t) {
|
|
2150
2092
|
if (this.params.moveOnTop) {
|
|
2151
2093
|
if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
|
|
2152
|
-
const
|
|
2153
|
-
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(
|
|
2154
|
-
this.canvas.updateEdge(i, { priority:
|
|
2094
|
+
const e = this.maxNodePriority;
|
|
2095
|
+
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(t).forEach((i) => {
|
|
2096
|
+
this.canvas.updateEdge(i, { priority: e });
|
|
2155
2097
|
});
|
|
2156
2098
|
}
|
|
2157
|
-
this.canvas.updateNode(
|
|
2099
|
+
this.canvas.updateNode(t, { priority: this.maxNodePriority });
|
|
2158
2100
|
}
|
|
2159
2101
|
}
|
|
2160
2102
|
cancelMouseDrag() {
|
|
2161
|
-
|
|
2162
|
-
const e = this.graph.getNode(this.grabbedNode.nodeId);
|
|
2163
|
-
e !== null && this.params.onNodeDragFinished({
|
|
2164
|
-
nodeId: this.grabbedNode.nodeId,
|
|
2165
|
-
element: e.element,
|
|
2166
|
-
x: e.x,
|
|
2167
|
-
y: e.y
|
|
2168
|
-
});
|
|
2169
|
-
}
|
|
2170
|
-
this.grabbedNode = null, U(this.element, null), this.removeMouseDragListeners();
|
|
2103
|
+
this.grabbedNode !== null && this.graph.getNode(this.grabbedNode.nodeId) !== null && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, U(this.element, null), this.removeMouseDragListeners();
|
|
2171
2104
|
}
|
|
2172
2105
|
removeMouseDragListeners() {
|
|
2173
2106
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
2174
2107
|
}
|
|
2175
2108
|
cancelTouchDrag() {
|
|
2176
2109
|
if (this.grabbedNode !== null) {
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2110
|
+
const t = this.graph.getNode(this.grabbedNode.nodeId);
|
|
2111
|
+
t !== null && this.params.onNodeDragFinished({
|
|
2179
2112
|
nodeId: this.grabbedNode.nodeId,
|
|
2180
|
-
element:
|
|
2181
|
-
x:
|
|
2182
|
-
y:
|
|
2113
|
+
element: t.element,
|
|
2114
|
+
x: t.x,
|
|
2115
|
+
y: t.y
|
|
2183
2116
|
});
|
|
2184
2117
|
}
|
|
2185
2118
|
this.grabbedNode = null, this.removeTouchDragListeners();
|
|
@@ -2187,58 +2120,58 @@ class Z {
|
|
|
2187
2120
|
removeTouchDragListeners() {
|
|
2188
2121
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2189
2122
|
}
|
|
2190
|
-
updateMaxNodePriority(
|
|
2191
|
-
const
|
|
2192
|
-
this.maxNodePriority = Math.max(this.maxNodePriority,
|
|
2123
|
+
updateMaxNodePriority(t) {
|
|
2124
|
+
const e = this.graph.getNode(t).priority;
|
|
2125
|
+
this.maxNodePriority = Math.max(this.maxNodePriority, e);
|
|
2193
2126
|
}
|
|
2194
|
-
calculateContentPoint(
|
|
2195
|
-
const
|
|
2196
|
-
x:
|
|
2197
|
-
y:
|
|
2127
|
+
calculateContentPoint(t) {
|
|
2128
|
+
const e = this.element.getBoundingClientRect(), s = {
|
|
2129
|
+
x: t.x - e.x,
|
|
2130
|
+
y: t.y - e.y
|
|
2198
2131
|
}, i = this.canvas.viewport.getViewportMatrix();
|
|
2199
|
-
return
|
|
2132
|
+
return T(i, s);
|
|
2200
2133
|
}
|
|
2201
|
-
adjustNodeCoords(
|
|
2202
|
-
const
|
|
2203
|
-
if (
|
|
2204
|
-
const s =
|
|
2134
|
+
adjustNodeCoords(t) {
|
|
2135
|
+
const e = this.params.gridSize;
|
|
2136
|
+
if (e !== null) {
|
|
2137
|
+
const s = e / 2;
|
|
2205
2138
|
return {
|
|
2206
|
-
x: Math.floor((
|
|
2207
|
-
y: Math.floor((
|
|
2139
|
+
x: Math.floor((t.x + s) / e) * e,
|
|
2140
|
+
y: Math.floor((t.y + s) / e) * e
|
|
2208
2141
|
};
|
|
2209
2142
|
}
|
|
2210
|
-
return
|
|
2143
|
+
return t;
|
|
2211
2144
|
}
|
|
2212
2145
|
}
|
|
2213
|
-
const
|
|
2146
|
+
const ie = (r, t, e) => ({
|
|
2214
2147
|
scale: r.scale,
|
|
2215
|
-
x: r.x + r.scale *
|
|
2216
|
-
y: r.y + r.scale *
|
|
2217
|
-
}),
|
|
2218
|
-
scale: r.scale *
|
|
2219
|
-
x: r.scale * (1 -
|
|
2220
|
-
y: r.scale * (1 -
|
|
2148
|
+
x: r.x + r.scale * t,
|
|
2149
|
+
y: r.y + r.scale * e
|
|
2150
|
+
}), ne = (r, t, e, s) => ({
|
|
2151
|
+
scale: r.scale * t,
|
|
2152
|
+
x: r.scale * (1 - t) * e + r.x,
|
|
2153
|
+
y: r.scale * (1 - t) * s + r.y
|
|
2221
2154
|
}), I = (r) => {
|
|
2222
|
-
const
|
|
2223
|
-
for (let h = 0; h <
|
|
2224
|
-
|
|
2225
|
-
const s =
|
|
2155
|
+
const t = [], e = r.touches.length;
|
|
2156
|
+
for (let h = 0; h < e; h++)
|
|
2157
|
+
t.push([r.touches[h].clientX, r.touches[h].clientY]);
|
|
2158
|
+
const s = t.reduce(
|
|
2226
2159
|
(h, d) => [h[0] + d[0], h[1] + d[1]],
|
|
2227
2160
|
[0, 0]
|
|
2228
|
-
), i = [s[0] /
|
|
2161
|
+
), i = [s[0] / e, s[1] / e], a = t.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
|
|
2229
2162
|
(h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
|
|
2230
2163
|
0
|
|
2231
2164
|
);
|
|
2232
2165
|
return {
|
|
2233
2166
|
x: i[0],
|
|
2234
2167
|
y: i[1],
|
|
2235
|
-
scale: a /
|
|
2236
|
-
touchesCnt:
|
|
2237
|
-
touches:
|
|
2168
|
+
scale: a / e,
|
|
2169
|
+
touchesCnt: e,
|
|
2170
|
+
touches: t
|
|
2238
2171
|
};
|
|
2239
2172
|
};
|
|
2240
2173
|
class k {
|
|
2241
|
-
constructor(
|
|
2174
|
+
constructor(t, e, s, i) {
|
|
2242
2175
|
o(this, "viewport");
|
|
2243
2176
|
o(this, "prevTouches", null);
|
|
2244
2177
|
o(this, "wheelFinishTimer", null);
|
|
@@ -2246,44 +2179,44 @@ class k {
|
|
|
2246
2179
|
o(this, "onBeforeDestroy", () => {
|
|
2247
2180
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2248
2181
|
});
|
|
2249
|
-
o(this, "onMouseDown", (
|
|
2250
|
-
this.element === null || !this.params.mouseDownEventVerifier(
|
|
2182
|
+
o(this, "onMouseDown", (t) => {
|
|
2183
|
+
this.element === null || !this.params.mouseDownEventVerifier(t) || (U(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2251
2184
|
passive: !0
|
|
2252
2185
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2253
2186
|
passive: !0
|
|
2254
2187
|
}), this.startRegisteredTransform());
|
|
2255
2188
|
});
|
|
2256
|
-
o(this, "onWindowMouseMove", (
|
|
2257
|
-
const
|
|
2189
|
+
o(this, "onWindowMouseMove", (t) => {
|
|
2190
|
+
const e = R(
|
|
2258
2191
|
this.window,
|
|
2259
2192
|
this.element,
|
|
2260
|
-
|
|
2261
|
-
|
|
2193
|
+
t.clientX,
|
|
2194
|
+
t.clientY
|
|
2262
2195
|
);
|
|
2263
|
-
if (this.element === null || !
|
|
2196
|
+
if (this.element === null || !e) {
|
|
2264
2197
|
this.stopMouseDrag();
|
|
2265
2198
|
return;
|
|
2266
2199
|
}
|
|
2267
|
-
const s = -
|
|
2200
|
+
const s = -t.movementX, i = -t.movementY;
|
|
2268
2201
|
this.moveViewport(s, i);
|
|
2269
2202
|
});
|
|
2270
|
-
o(this, "onWindowMouseUp", (
|
|
2271
|
-
this.element === null || !this.params.mouseUpEventVerifier(
|
|
2203
|
+
o(this, "onWindowMouseUp", (t) => {
|
|
2204
|
+
this.element === null || !this.params.mouseUpEventVerifier(t) || this.stopMouseDrag();
|
|
2272
2205
|
});
|
|
2273
|
-
o(this, "onWheelScroll", (
|
|
2274
|
-
if (!this.params.mouseWheelEventVerifier(
|
|
2206
|
+
o(this, "onWheelScroll", (t) => {
|
|
2207
|
+
if (!this.params.mouseWheelEventVerifier(t))
|
|
2275
2208
|
return;
|
|
2276
|
-
const { left:
|
|
2209
|
+
const { left: e, top: s } = this.element.getBoundingClientRect(), i = t.clientX - e, n = t.clientY - s, h = 1 / (t.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
|
|
2277
2210
|
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
|
|
2278
2211
|
this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
|
|
2279
2212
|
}, this.params.scaleWheelFinishTimeout);
|
|
2280
2213
|
});
|
|
2281
|
-
o(this, "onTouchStart", (
|
|
2214
|
+
o(this, "onTouchStart", (t) => {
|
|
2282
2215
|
if (this.prevTouches !== null) {
|
|
2283
|
-
this.prevTouches = I(
|
|
2216
|
+
this.prevTouches = I(t);
|
|
2284
2217
|
return;
|
|
2285
2218
|
}
|
|
2286
|
-
this.prevTouches = I(
|
|
2219
|
+
this.prevTouches = I(t), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2287
2220
|
passive: !0
|
|
2288
2221
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
2289
2222
|
passive: !0
|
|
@@ -2291,53 +2224,53 @@ class k {
|
|
|
2291
2224
|
passive: !0
|
|
2292
2225
|
}), this.startRegisteredTransform();
|
|
2293
2226
|
});
|
|
2294
|
-
o(this, "onWindowTouchMove", (
|
|
2295
|
-
const
|
|
2296
|
-
if (!
|
|
2297
|
-
(i) =>
|
|
2227
|
+
o(this, "onWindowTouchMove", (t) => {
|
|
2228
|
+
const e = I(t);
|
|
2229
|
+
if (!e.touches.every(
|
|
2230
|
+
(i) => R(this.window, this.element, i[0], i[1])
|
|
2298
2231
|
)) {
|
|
2299
2232
|
this.stopTouchDrag();
|
|
2300
2233
|
return;
|
|
2301
2234
|
}
|
|
2302
|
-
if ((
|
|
2303
|
-
-(
|
|
2304
|
-
-(
|
|
2305
|
-
),
|
|
2306
|
-
const { left: i, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - i, h = this.prevTouches.y - n, c = 1 / (
|
|
2235
|
+
if ((e.touchesCnt === 1 || e.touchesCnt === 2) && this.moveViewport(
|
|
2236
|
+
-(e.x - this.prevTouches.x),
|
|
2237
|
+
-(e.y - this.prevTouches.y)
|
|
2238
|
+
), e.touchesCnt === 2) {
|
|
2239
|
+
const { left: i, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - i, h = this.prevTouches.y - n, c = 1 / (e.scale / this.prevTouches.scale);
|
|
2307
2240
|
this.scaleViewport(c, a, h);
|
|
2308
2241
|
}
|
|
2309
|
-
this.prevTouches =
|
|
2242
|
+
this.prevTouches = e;
|
|
2310
2243
|
});
|
|
2311
|
-
o(this, "onWindowTouchFinish", (
|
|
2312
|
-
|
|
2244
|
+
o(this, "onWindowTouchFinish", (t) => {
|
|
2245
|
+
t.touches.length > 0 ? this.prevTouches = I(t) : this.stopTouchDrag();
|
|
2313
2246
|
});
|
|
2314
2247
|
o(this, "observer", new ResizeObserver(() => {
|
|
2315
|
-
const
|
|
2316
|
-
prevTransform:
|
|
2317
|
-
nextTransform:
|
|
2318
|
-
canvasWidth:
|
|
2248
|
+
const t = this.viewport.getViewportMatrix(), { width: e, height: s } = this.element.getBoundingClientRect(), i = this.params.transformPreprocessor({
|
|
2249
|
+
prevTransform: t,
|
|
2250
|
+
nextTransform: t,
|
|
2251
|
+
canvasWidth: e,
|
|
2319
2252
|
canvasHeight: s
|
|
2320
2253
|
});
|
|
2321
2254
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
|
|
2322
2255
|
}));
|
|
2323
|
-
o(this, "preventWheelScaleListener", (
|
|
2324
|
-
|
|
2256
|
+
o(this, "preventWheelScaleListener", (t) => {
|
|
2257
|
+
t.preventDefault();
|
|
2325
2258
|
});
|
|
2326
|
-
this.canvas =
|
|
2259
|
+
this.canvas = t, this.element = e, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
|
|
2327
2260
|
passive: !1
|
|
2328
|
-
}), this.viewport =
|
|
2261
|
+
}), this.viewport = t.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
|
|
2329
2262
|
passive: !0
|
|
2330
2263
|
}), this.element.addEventListener("wheel", this.onWheelScroll, {
|
|
2331
2264
|
passive: !0
|
|
2332
2265
|
}), this.element.addEventListener("touchstart", this.onTouchStart, {
|
|
2333
2266
|
passive: !0
|
|
2334
|
-
}),
|
|
2267
|
+
}), t.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2335
2268
|
}
|
|
2336
|
-
static configure(
|
|
2337
|
-
new k(
|
|
2269
|
+
static configure(t, e, s, i) {
|
|
2270
|
+
new k(t, e, s, i);
|
|
2338
2271
|
}
|
|
2339
|
-
moveViewport(
|
|
2340
|
-
const s = this.viewport.getViewportMatrix(), i =
|
|
2272
|
+
moveViewport(t, e) {
|
|
2273
|
+
const s = this.viewport.getViewportMatrix(), i = ie(s, t, e), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
|
|
2341
2274
|
prevTransform: s,
|
|
2342
2275
|
nextTransform: i,
|
|
2343
2276
|
canvasWidth: n,
|
|
@@ -2345,8 +2278,8 @@ class k {
|
|
|
2345
2278
|
});
|
|
2346
2279
|
this.performTransform(h);
|
|
2347
2280
|
}
|
|
2348
|
-
scaleViewport(
|
|
2349
|
-
const i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2281
|
+
scaleViewport(t, e, s) {
|
|
2282
|
+
const i = this.canvas.viewport.getViewportMatrix(), n = ne(i, t, e, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
|
|
2350
2283
|
prevTransform: i,
|
|
2351
2284
|
nextTransform: n,
|
|
2352
2285
|
canvasWidth: a,
|
|
@@ -2366,8 +2299,8 @@ class k {
|
|
|
2366
2299
|
removeTouchDragListeners() {
|
|
2367
2300
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2368
2301
|
}
|
|
2369
|
-
performTransform(
|
|
2370
|
-
this.params.onBeforeTransformChange(), this.canvas.patchViewportMatrix(
|
|
2302
|
+
performTransform(t) {
|
|
2303
|
+
this.params.onBeforeTransformChange(), this.canvas.patchViewportMatrix(t), this.params.onTransformChange();
|
|
2371
2304
|
}
|
|
2372
2305
|
startRegisteredTransform() {
|
|
2373
2306
|
this.transformInProgress = !0, this.params.onTransformStarted();
|
|
@@ -2377,7 +2310,7 @@ class k {
|
|
|
2377
2310
|
}
|
|
2378
2311
|
}
|
|
2379
2312
|
class J {
|
|
2380
|
-
constructor(
|
|
2313
|
+
constructor(t, e, s, i, n, a) {
|
|
2381
2314
|
o(this, "canvasResizeObserver");
|
|
2382
2315
|
o(this, "nodeHorizontal");
|
|
2383
2316
|
o(this, "nodeVertical");
|
|
@@ -2391,22 +2324,22 @@ class J {
|
|
|
2391
2324
|
yFrom: 1 / 0,
|
|
2392
2325
|
yTo: 1 / 0
|
|
2393
2326
|
});
|
|
2394
|
-
o(this, "updateLoadedArea", (
|
|
2327
|
+
o(this, "updateLoadedArea", (t) => {
|
|
2395
2328
|
this.loadedArea = {
|
|
2396
|
-
xFrom:
|
|
2397
|
-
xTo:
|
|
2398
|
-
yFrom:
|
|
2399
|
-
yTo:
|
|
2329
|
+
xFrom: t.x,
|
|
2330
|
+
xTo: t.x + t.width,
|
|
2331
|
+
yFrom: t.y,
|
|
2332
|
+
yTo: t.y + t.height
|
|
2400
2333
|
};
|
|
2401
2334
|
});
|
|
2402
2335
|
o(this, "onAfterViewportUpdated", () => {
|
|
2403
2336
|
this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
|
|
2404
2337
|
});
|
|
2405
2338
|
o(this, "userTransformInProgress", !1);
|
|
2406
|
-
this.canvas =
|
|
2339
|
+
this.canvas = t, this.element = e, this.window = s, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.canvasResizeObserver = new ResizeObserver((d) => {
|
|
2407
2340
|
const c = d[0];
|
|
2408
2341
|
this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
|
|
2409
|
-
}), this.viewport =
|
|
2342
|
+
}), this.viewport = t.viewport;
|
|
2410
2343
|
const h = {
|
|
2411
2344
|
...i,
|
|
2412
2345
|
onResizeTransformStarted: () => {
|
|
@@ -2428,16 +2361,16 @@ class J {
|
|
|
2428
2361
|
}
|
|
2429
2362
|
};
|
|
2430
2363
|
k.configure(
|
|
2431
|
-
|
|
2364
|
+
t,
|
|
2432
2365
|
this.element,
|
|
2433
2366
|
this.window,
|
|
2434
2367
|
h
|
|
2435
2368
|
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2436
2369
|
}
|
|
2437
|
-
static configure(
|
|
2370
|
+
static configure(t, e, s, i, n, a) {
|
|
2438
2371
|
new J(
|
|
2439
|
-
e,
|
|
2440
2372
|
t,
|
|
2373
|
+
e,
|
|
2441
2374
|
s,
|
|
2442
2375
|
i,
|
|
2443
2376
|
n,
|
|
@@ -2450,21 +2383,21 @@ class J {
|
|
|
2450
2383
|
});
|
|
2451
2384
|
}
|
|
2452
2385
|
scheduleEnsureViewportAreaLoaded() {
|
|
2453
|
-
const
|
|
2386
|
+
const t = this.viewportWidth * this.viewportMatrix.scale, e = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal, i = this.viewportMatrix.y - this.nodeVertical, n = this.viewportMatrix.x + t + this.nodeHorizontal, a = this.viewportMatrix.y + e + this.nodeVertical;
|
|
2454
2387
|
this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < i && this.loadedArea.yTo > a || this.scheduleLoadAreaAroundViewport();
|
|
2455
2388
|
}
|
|
2456
2389
|
loadAreaAroundViewport() {
|
|
2457
|
-
const
|
|
2390
|
+
const t = this.viewportWidth * this.viewportMatrix.scale, e = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - t - this.nodeHorizontal, i = this.viewportMatrix.y - e - this.nodeVertical, n = 3 * t + 2 * this.nodeHorizontal, a = 3 * e + 2 * this.nodeVertical;
|
|
2458
2391
|
this.trigger.emit({ x: s, y: i, width: n, height: a });
|
|
2459
2392
|
}
|
|
2460
2393
|
}
|
|
2461
|
-
const
|
|
2394
|
+
const ae = () => {
|
|
2462
2395
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2463
2396
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2464
|
-
},
|
|
2397
|
+
}, he = () => {
|
|
2465
2398
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2466
2399
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2467
|
-
},
|
|
2400
|
+
}, de = () => {
|
|
2468
2401
|
const r = document.createElementNS(
|
|
2469
2402
|
"http://www.w3.org/2000/svg",
|
|
2470
2403
|
"pattern"
|
|
@@ -2472,10 +2405,10 @@ const at = () => {
|
|
|
2472
2405
|
return r.setAttribute("id", "pattern"), r;
|
|
2473
2406
|
};
|
|
2474
2407
|
class Q {
|
|
2475
|
-
constructor(
|
|
2476
|
-
o(this, "svg",
|
|
2477
|
-
o(this, "patternRenderingRectangle",
|
|
2478
|
-
o(this, "pattern",
|
|
2408
|
+
constructor(t, e, s) {
|
|
2409
|
+
o(this, "svg", ae());
|
|
2410
|
+
o(this, "patternRenderingRectangle", he());
|
|
2411
|
+
o(this, "pattern", de());
|
|
2479
2412
|
o(this, "patternContent");
|
|
2480
2413
|
o(this, "tileWidth");
|
|
2481
2414
|
o(this, "tileHeight");
|
|
@@ -2483,39 +2416,39 @@ class Q {
|
|
|
2483
2416
|
o(this, "halfTileHeight");
|
|
2484
2417
|
o(this, "maxViewportScale");
|
|
2485
2418
|
o(this, "visible", !1);
|
|
2486
|
-
o(this, "resizeObserver", new ResizeObserver((
|
|
2487
|
-
const
|
|
2419
|
+
o(this, "resizeObserver", new ResizeObserver((t) => {
|
|
2420
|
+
const e = t[0], { width: s, height: i } = e.contentRect;
|
|
2488
2421
|
this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
|
|
2489
2422
|
const n = this.tileWidth / s, a = this.tileHeight / i;
|
|
2490
2423
|
this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${a}`);
|
|
2491
2424
|
}));
|
|
2492
2425
|
o(this, "onAfterTransformUpdated", () => {
|
|
2493
|
-
const
|
|
2426
|
+
const t = this.canvas.viewport.getContentMatrix(), e = t.x - this.halfTileWidth * t.scale, s = t.y - this.halfTileHeight * t.scale, i = `matrix(${t.scale}, 0, 0, ${t.scale}, ${e}, ${s})`;
|
|
2494
2427
|
this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
|
|
2495
2428
|
});
|
|
2496
|
-
this.canvas =
|
|
2429
|
+
this.canvas = t, this.backgroundHost = s, this.tileWidth = e.tileWidth, this.tileHeight = e.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = e.renderer, this.maxViewportScale = e.maxViewportScale;
|
|
2497
2430
|
const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
2498
2431
|
this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
|
|
2499
2432
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
2500
2433
|
n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.backgroundHost), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2501
2434
|
}
|
|
2502
|
-
static configure(
|
|
2503
|
-
new Q(
|
|
2435
|
+
static configure(t, e, s) {
|
|
2436
|
+
new Q(t, e, s);
|
|
2504
2437
|
}
|
|
2505
2438
|
updateVisibility() {
|
|
2506
|
-
const
|
|
2507
|
-
|
|
2439
|
+
const e = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
|
|
2440
|
+
e && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !e && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
|
|
2508
2441
|
}
|
|
2509
2442
|
}
|
|
2510
2443
|
class _ {
|
|
2511
|
-
constructor(
|
|
2444
|
+
constructor(t, e, s, i, n) {
|
|
2512
2445
|
o(this, "overlayCanvas");
|
|
2513
2446
|
o(this, "staticPortId", null);
|
|
2514
2447
|
o(this, "isTargetDragging", !0);
|
|
2515
|
-
o(this, "onEdgeCreated", (
|
|
2516
|
-
this.params.onAfterEdgeCreated(
|
|
2448
|
+
o(this, "onEdgeCreated", (t) => {
|
|
2449
|
+
this.params.onAfterEdgeCreated(t);
|
|
2517
2450
|
});
|
|
2518
|
-
this.canvas =
|
|
2451
|
+
this.canvas = t, this.overlayLayer = e, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Dt(
|
|
2519
2452
|
this.overlayLayer,
|
|
2520
2453
|
this.viewportStore
|
|
2521
2454
|
), O.configure(
|
|
@@ -2541,24 +2474,24 @@ class _ {
|
|
|
2541
2474
|
}
|
|
2542
2475
|
);
|
|
2543
2476
|
}
|
|
2544
|
-
static configure(
|
|
2477
|
+
static configure(t, e, s, i, n) {
|
|
2545
2478
|
new _(
|
|
2546
|
-
e,
|
|
2547
2479
|
t,
|
|
2480
|
+
e,
|
|
2548
2481
|
s,
|
|
2549
2482
|
i,
|
|
2550
2483
|
n
|
|
2551
2484
|
);
|
|
2552
2485
|
}
|
|
2553
|
-
grabPort(
|
|
2554
|
-
const i = this.canvas.graph.getPort(
|
|
2555
|
-
this.staticPortId =
|
|
2556
|
-
const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), l =
|
|
2486
|
+
grabPort(t, e, s) {
|
|
2487
|
+
const i = this.canvas.graph.getPort(t);
|
|
2488
|
+
this.staticPortId = t;
|
|
2489
|
+
const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), l = T(c, {
|
|
2557
2490
|
x: a - d.x,
|
|
2558
2491
|
y: h - d.y
|
|
2559
|
-
}), g =
|
|
2560
|
-
x:
|
|
2561
|
-
y:
|
|
2492
|
+
}), g = T(c, {
|
|
2493
|
+
x: e.x - d.x,
|
|
2494
|
+
y: e.y - d.y
|
|
2562
2495
|
}), w = {
|
|
2563
2496
|
overlayId: P.Static,
|
|
2564
2497
|
portCoords: l,
|
|
@@ -2579,23 +2512,23 @@ class _ {
|
|
|
2579
2512
|
resetDragState() {
|
|
2580
2513
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2581
2514
|
}
|
|
2582
|
-
tryCreateConnection(
|
|
2583
|
-
const
|
|
2584
|
-
if (
|
|
2585
|
-
this.params.onEdgeCreationInterrupted(
|
|
2586
|
-
this.staticPortId,
|
|
2587
|
-
this.isTargetDragging
|
|
2588
|
-
);
|
|
2515
|
+
tryCreateConnection(t) {
|
|
2516
|
+
const e = yt(this.canvas.graph, t);
|
|
2517
|
+
if (e === null) {
|
|
2518
|
+
this.params.onEdgeCreationInterrupted({
|
|
2519
|
+
staticPortId: this.staticPortId,
|
|
2520
|
+
isDirect: this.isTargetDragging
|
|
2521
|
+
});
|
|
2589
2522
|
return;
|
|
2590
2523
|
}
|
|
2591
|
-
const s = this.isTargetDragging ? this.staticPortId :
|
|
2524
|
+
const s = this.isTargetDragging ? this.staticPortId : e, i = this.isTargetDragging ? e : this.staticPortId, n = { from: s, to: i }, a = this.params.connectionPreprocessor(n);
|
|
2592
2525
|
a !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(a), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(n);
|
|
2593
2526
|
}
|
|
2594
|
-
moveDraggingPort(
|
|
2595
|
-
const
|
|
2596
|
-
x:
|
|
2597
|
-
y:
|
|
2598
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2527
|
+
moveDraggingPort(t) {
|
|
2528
|
+
const e = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2529
|
+
x: t.x - e.x,
|
|
2530
|
+
y: t.y - e.y
|
|
2531
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = T(i, s);
|
|
2599
2532
|
this.overlayCanvas.updateNode(P.Dragging, {
|
|
2600
2533
|
x: n.x,
|
|
2601
2534
|
y: n.y
|
|
@@ -2603,15 +2536,15 @@ class _ {
|
|
|
2603
2536
|
}
|
|
2604
2537
|
}
|
|
2605
2538
|
class q {
|
|
2606
|
-
constructor(
|
|
2539
|
+
constructor(t, e, s, i, n) {
|
|
2607
2540
|
o(this, "overlayCanvas");
|
|
2608
2541
|
o(this, "staticPortId", null);
|
|
2609
2542
|
o(this, "isTargetDragging", !0);
|
|
2610
2543
|
o(this, "draggingEdgePayload", null);
|
|
2611
|
-
o(this, "onEdgeReattached", (
|
|
2612
|
-
this.params.onAfterEdgeReattached(
|
|
2544
|
+
o(this, "onEdgeReattached", (t) => {
|
|
2545
|
+
this.params.onAfterEdgeReattached(t);
|
|
2613
2546
|
});
|
|
2614
|
-
this.canvas =
|
|
2547
|
+
this.canvas = t, this.overlayLayer = e, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Dt(
|
|
2615
2548
|
this.overlayLayer,
|
|
2616
2549
|
this.viewportStore
|
|
2617
2550
|
), O.configure(
|
|
@@ -2634,33 +2567,33 @@ class q {
|
|
|
2634
2567
|
}
|
|
2635
2568
|
);
|
|
2636
2569
|
}
|
|
2637
|
-
static configure(
|
|
2570
|
+
static configure(t, e, s, i, n) {
|
|
2638
2571
|
new q(
|
|
2639
|
-
e,
|
|
2640
2572
|
t,
|
|
2573
|
+
e,
|
|
2641
2574
|
s,
|
|
2642
2575
|
i,
|
|
2643
2576
|
n
|
|
2644
2577
|
);
|
|
2645
2578
|
}
|
|
2646
|
-
tryStartEdgeDragging(
|
|
2647
|
-
const s = this.params.draggingEdgeResolver(
|
|
2579
|
+
tryStartEdgeDragging(t, e) {
|
|
2580
|
+
const s = this.params.draggingEdgeResolver(t);
|
|
2648
2581
|
if (s === null)
|
|
2649
2582
|
return !1;
|
|
2650
2583
|
const i = this.canvas.graph.getEdge(s);
|
|
2651
2584
|
if (i === null)
|
|
2652
2585
|
return !1;
|
|
2653
|
-
const n =
|
|
2586
|
+
const n = t === i.from, a = t === i.to, h = n ? i.to : i.from;
|
|
2654
2587
|
this.staticPortId = h, this.isTargetDragging = a;
|
|
2655
|
-
const d = this.canvas.graph.getPort(
|
|
2588
|
+
const d = this.canvas.graph.getPort(t), c = this.canvas.graph.getPort(h), l = c.element.getBoundingClientRect(), g = {
|
|
2656
2589
|
x: l.x + l.width / 2,
|
|
2657
2590
|
y: l.y + l.height / 2
|
|
2658
|
-
}, w = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(), y =
|
|
2591
|
+
}, w = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(), y = T(w, {
|
|
2659
2592
|
x: g.x - f.x,
|
|
2660
2593
|
y: g.y - f.y
|
|
2661
|
-
}), v =
|
|
2662
|
-
x:
|
|
2663
|
-
y:
|
|
2594
|
+
}), v = T(w, {
|
|
2595
|
+
x: e.x - f.x,
|
|
2596
|
+
y: e.y - f.y
|
|
2664
2597
|
});
|
|
2665
2598
|
this.draggingEdgePayload = {
|
|
2666
2599
|
id: s,
|
|
@@ -2677,32 +2610,32 @@ class q {
|
|
|
2677
2610
|
overlayId: P.Dragging,
|
|
2678
2611
|
portCoords: v,
|
|
2679
2612
|
portDirection: d.direction
|
|
2680
|
-
}, [
|
|
2681
|
-
this.overlayCanvas.addNode(W(
|
|
2682
|
-
const
|
|
2613
|
+
}, [L, b] = this.isTargetDragging ? [E, x] : [x, E];
|
|
2614
|
+
this.overlayCanvas.addNode(W(L)), this.overlayCanvas.addNode(W(b));
|
|
2615
|
+
const D = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(P.Edge) : i.shape;
|
|
2683
2616
|
return this.overlayCanvas.addEdge({
|
|
2684
2617
|
id: P.Edge,
|
|
2685
|
-
from:
|
|
2686
|
-
to:
|
|
2687
|
-
shape:
|
|
2618
|
+
from: L.overlayId,
|
|
2619
|
+
to: b.overlayId,
|
|
2620
|
+
shape: D
|
|
2688
2621
|
}), !0;
|
|
2689
2622
|
}
|
|
2690
2623
|
resetDragState() {
|
|
2691
2624
|
this.draggingEdgePayload = null, this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2692
2625
|
}
|
|
2693
|
-
moveDraggingPort(
|
|
2694
|
-
const
|
|
2695
|
-
x:
|
|
2696
|
-
y:
|
|
2697
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2626
|
+
moveDraggingPort(t) {
|
|
2627
|
+
const e = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2628
|
+
x: t.x - e.x,
|
|
2629
|
+
y: t.y - e.y
|
|
2630
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = T(i, s);
|
|
2698
2631
|
this.overlayCanvas.updateNode(P.Dragging, {
|
|
2699
2632
|
x: n.x,
|
|
2700
2633
|
y: n.y
|
|
2701
2634
|
});
|
|
2702
2635
|
}
|
|
2703
|
-
tryCreateConnection(
|
|
2704
|
-
const
|
|
2705
|
-
if (this.overlayCanvas.removeEdge(P.Edge),
|
|
2636
|
+
tryCreateConnection(t) {
|
|
2637
|
+
const e = yt(this.canvas.graph, t);
|
|
2638
|
+
if (this.overlayCanvas.removeEdge(P.Edge), e === null) {
|
|
2706
2639
|
const d = this.draggingEdgePayload;
|
|
2707
2640
|
this.params.onEdgeReattachInterrupted({
|
|
2708
2641
|
id: d.id,
|
|
@@ -2713,7 +2646,7 @@ class q {
|
|
|
2713
2646
|
});
|
|
2714
2647
|
return;
|
|
2715
2648
|
}
|
|
2716
|
-
const [s, i] = this.isTargetDragging ? [this.staticPortId,
|
|
2649
|
+
const [s, i] = this.isTargetDragging ? [this.staticPortId, e] : [e, this.staticPortId], n = this.draggingEdgePayload, a = {
|
|
2717
2650
|
id: n.id,
|
|
2718
2651
|
from: s,
|
|
2719
2652
|
to: i,
|
|
@@ -2734,45 +2667,45 @@ class q {
|
|
|
2734
2667
|
}
|
|
2735
2668
|
}
|
|
2736
2669
|
}
|
|
2737
|
-
const
|
|
2670
|
+
const ce = () => {
|
|
2738
2671
|
const r = document.createElement("div");
|
|
2739
2672
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
2740
2673
|
}, Y = () => {
|
|
2741
2674
|
const r = document.createElement("div");
|
|
2742
2675
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2743
|
-
},
|
|
2676
|
+
}, ct = () => {
|
|
2744
2677
|
const r = Y();
|
|
2745
2678
|
return r.style.pointerEvents = "none", r;
|
|
2746
2679
|
};
|
|
2747
|
-
class
|
|
2748
|
-
constructor(
|
|
2680
|
+
class ge {
|
|
2681
|
+
constructor(t) {
|
|
2749
2682
|
o(this, "background", Y());
|
|
2750
2683
|
o(this, "main", Y());
|
|
2751
|
-
o(this, "overlayConnectablePorts",
|
|
2752
|
-
o(this, "overlayDraggableEdges",
|
|
2753
|
-
o(this, "host",
|
|
2754
|
-
this.element =
|
|
2684
|
+
o(this, "overlayConnectablePorts", ct());
|
|
2685
|
+
o(this, "overlayDraggableEdges", ct());
|
|
2686
|
+
o(this, "host", ce());
|
|
2687
|
+
this.element = t, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
|
|
2755
2688
|
}
|
|
2756
2689
|
destroy() {
|
|
2757
2690
|
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
|
|
2758
2691
|
}
|
|
2759
2692
|
}
|
|
2760
|
-
const H = (r) => () => r,
|
|
2693
|
+
const H = (r) => () => r, gt = H(0), le = () => {
|
|
2761
2694
|
let r = 0;
|
|
2762
2695
|
return () => r++;
|
|
2763
|
-
},
|
|
2764
|
-
let
|
|
2765
|
-
const i =
|
|
2766
|
-
return r === "incremental" && (
|
|
2767
|
-
nodesPriorityFn:
|
|
2696
|
+
}, ue = (r, t) => {
|
|
2697
|
+
let e = gt, s = gt;
|
|
2698
|
+
const i = le();
|
|
2699
|
+
return r === "incremental" && (e = i), t === "incremental" && (s = i), typeof r == "number" && (e = H(r)), typeof t == "number" && (s = H(t)), typeof r == "function" && (e = r), typeof t == "function" && (s = t), {
|
|
2700
|
+
nodesPriorityFn: e,
|
|
2768
2701
|
edgesPriorityFn: s
|
|
2769
2702
|
};
|
|
2770
|
-
},
|
|
2703
|
+
}, tt = (r) => {
|
|
2771
2704
|
if (typeof r == "function")
|
|
2772
2705
|
return r;
|
|
2773
2706
|
switch (r == null ? void 0 : r.type) {
|
|
2774
2707
|
case "straight":
|
|
2775
|
-
return () => new
|
|
2708
|
+
return () => new te({
|
|
2776
2709
|
color: r.color,
|
|
2777
2710
|
width: r.width,
|
|
2778
2711
|
arrowLength: r.arrowLength,
|
|
@@ -2786,7 +2719,7 @@ const H = (r) => () => r, ge = H(0), lt = () => {
|
|
|
2786
2719
|
detourDirection: r.detourDirection
|
|
2787
2720
|
});
|
|
2788
2721
|
case "horizontal":
|
|
2789
|
-
return () => new
|
|
2722
|
+
return () => new qt({
|
|
2790
2723
|
color: r.color,
|
|
2791
2724
|
width: r.width,
|
|
2792
2725
|
arrowLength: r.arrowLength,
|
|
@@ -2796,11 +2729,10 @@ const H = (r) => () => r, ge = H(0), lt = () => {
|
|
|
2796
2729
|
hasTargetArrow: r.hasTargetArrow,
|
|
2797
2730
|
cycleSquareSide: r.cycleSquareSide,
|
|
2798
2731
|
roundness: r.roundness,
|
|
2799
|
-
detourDistance: r.detourDistance
|
|
2800
|
-
detourDirection: r.detourDirection
|
|
2732
|
+
detourDistance: r.detourDistance
|
|
2801
2733
|
});
|
|
2802
2734
|
case "vertical":
|
|
2803
|
-
return () => new
|
|
2735
|
+
return () => new ee({
|
|
2804
2736
|
color: r.color,
|
|
2805
2737
|
width: r.width,
|
|
2806
2738
|
arrowLength: r.arrowLength,
|
|
@@ -2810,11 +2742,10 @@ const H = (r) => () => r, ge = H(0), lt = () => {
|
|
|
2810
2742
|
hasTargetArrow: r.hasTargetArrow,
|
|
2811
2743
|
cycleSquareSide: r.cycleSquareSide,
|
|
2812
2744
|
roundness: r.roundness,
|
|
2813
|
-
detourDistance: r.detourDistance
|
|
2814
|
-
detourDirection: r.detourDirection
|
|
2745
|
+
detourDistance: r.detourDistance
|
|
2815
2746
|
});
|
|
2816
2747
|
case "direct":
|
|
2817
|
-
return () => new
|
|
2748
|
+
return () => new bt({
|
|
2818
2749
|
color: r.color,
|
|
2819
2750
|
width: r.width,
|
|
2820
2751
|
arrowLength: r.arrowLength,
|
|
@@ -2825,7 +2756,7 @@ const H = (r) => () => r, ge = H(0), lt = () => {
|
|
|
2825
2756
|
targetOffset: r.targetOffset
|
|
2826
2757
|
});
|
|
2827
2758
|
default:
|
|
2828
|
-
return () => new
|
|
2759
|
+
return () => new _t({
|
|
2829
2760
|
color: r.color,
|
|
2830
2761
|
width: r.width,
|
|
2831
2762
|
arrowLength: r.arrowLength,
|
|
@@ -2839,30 +2770,30 @@ const H = (r) => () => r, ge = H(0), lt = () => {
|
|
|
2839
2770
|
detourDirection: r.detourDirection
|
|
2840
2771
|
});
|
|
2841
2772
|
}
|
|
2842
|
-
},
|
|
2843
|
-
var
|
|
2844
|
-
const
|
|
2845
|
-
(
|
|
2773
|
+
}, pe = (r) => {
|
|
2774
|
+
var e, s, i, n, a;
|
|
2775
|
+
const t = ue(
|
|
2776
|
+
(e = r.nodes) == null ? void 0 : e.priority,
|
|
2846
2777
|
(s = r.edges) == null ? void 0 : s.priority
|
|
2847
2778
|
);
|
|
2848
2779
|
return {
|
|
2849
2780
|
nodes: {
|
|
2850
|
-
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ??
|
|
2851
|
-
priorityFn:
|
|
2781
|
+
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? vt,
|
|
2782
|
+
priorityFn: t.nodesPriorityFn
|
|
2852
2783
|
},
|
|
2853
2784
|
ports: {
|
|
2854
2785
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
2855
2786
|
},
|
|
2856
2787
|
edges: {
|
|
2857
|
-
shapeFactory:
|
|
2858
|
-
priorityFn:
|
|
2788
|
+
shapeFactory: tt(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
2789
|
+
priorityFn: t.edgesPriorityFn
|
|
2859
2790
|
}
|
|
2860
2791
|
};
|
|
2861
|
-
},
|
|
2862
|
-
var w, f, y, v, E
|
|
2863
|
-
const
|
|
2864
|
-
}),
|
|
2865
|
-
}), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (
|
|
2792
|
+
}, we = (r) => {
|
|
2793
|
+
var w, f, y, v, E;
|
|
2794
|
+
const t = ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? (() => {
|
|
2795
|
+
}), e = r.nodeDragVerifier ?? (() => !0), s = ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? (() => {
|
|
2796
|
+
}), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (y = r.mouse) == null ? void 0 : y.dragCursor, h = a !== void 0 ? a : "grab", d = (v = r.mouse) == null ? void 0 : v.mouseDownEventVerifier, c = d !== void 0 ? d : (x) => x.button === 0, l = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, g = l !== void 0 ? l : (x) => x.button === 0;
|
|
2866
2797
|
return {
|
|
2867
2798
|
moveOnTop: i,
|
|
2868
2799
|
moveEdgesOnTop: n,
|
|
@@ -2870,22 +2801,22 @@ const H = (r) => () => r, ge = H(0), lt = () => {
|
|
|
2870
2801
|
gridSize: r.gridSize ?? null,
|
|
2871
2802
|
mouseDownEventVerifier: c,
|
|
2872
2803
|
mouseUpEventVerifier: g,
|
|
2873
|
-
onNodeDrag:
|
|
2874
|
-
|
|
2804
|
+
onNodeDrag: t,
|
|
2805
|
+
nodeDragVerifier: e,
|
|
2875
2806
|
onNodeDragFinished: s
|
|
2876
2807
|
};
|
|
2877
|
-
},
|
|
2878
|
-
const
|
|
2808
|
+
}, fe = (r) => {
|
|
2809
|
+
const t = r.minX !== null ? r.minX : -1 / 0, e = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
|
|
2879
2810
|
return (n) => {
|
|
2880
2811
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
2881
|
-
a <
|
|
2882
|
-
const d = n.canvasWidth * n.prevTransform.scale, c =
|
|
2812
|
+
a < t && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, t));
|
|
2813
|
+
const d = n.canvasWidth * n.prevTransform.scale, c = e - d;
|
|
2883
2814
|
a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < s && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, s));
|
|
2884
2815
|
const l = n.canvasHeight * n.prevTransform.scale, g = i - l;
|
|
2885
2816
|
return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
2886
2817
|
};
|
|
2887
|
-
},
|
|
2888
|
-
const
|
|
2818
|
+
}, me = (r) => {
|
|
2819
|
+
const t = r.maxContentScale, e = r.minContentScale, s = t !== null ? 1 / t : 0, i = e !== null ? 1 / e : 1 / 0;
|
|
2889
2820
|
return (n) => {
|
|
2890
2821
|
const a = n.prevTransform, h = n.nextTransform;
|
|
2891
2822
|
let d = h.scale, c = h.x, l = h.y;
|
|
@@ -2905,48 +2836,48 @@ const H = (r) => () => r, ge = H(0), lt = () => {
|
|
|
2905
2836
|
y: l
|
|
2906
2837
|
};
|
|
2907
2838
|
};
|
|
2908
|
-
},
|
|
2909
|
-
(
|
|
2910
|
-
prevTransform:
|
|
2911
|
-
nextTransform:
|
|
2912
|
-
canvasWidth:
|
|
2913
|
-
canvasHeight:
|
|
2839
|
+
}, ye = (r) => (t) => r.reduce(
|
|
2840
|
+
(e, s) => s({
|
|
2841
|
+
prevTransform: t.prevTransform,
|
|
2842
|
+
nextTransform: e,
|
|
2843
|
+
canvasWidth: t.canvasWidth,
|
|
2844
|
+
canvasHeight: t.canvasHeight
|
|
2914
2845
|
}),
|
|
2915
|
-
|
|
2916
|
-
),
|
|
2846
|
+
t.nextTransform
|
|
2847
|
+
), lt = (r) => {
|
|
2917
2848
|
if (typeof r == "function")
|
|
2918
2849
|
return r;
|
|
2919
2850
|
switch (r.type) {
|
|
2920
2851
|
case "scale-limit":
|
|
2921
|
-
return
|
|
2852
|
+
return me({
|
|
2922
2853
|
minContentScale: r.minContentScale ?? 0,
|
|
2923
2854
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
2924
2855
|
});
|
|
2925
2856
|
case "shift-limit":
|
|
2926
|
-
return
|
|
2857
|
+
return fe({
|
|
2927
2858
|
minX: r.minX ?? -1 / 0,
|
|
2928
2859
|
maxX: r.maxX ?? 1 / 0,
|
|
2929
2860
|
minY: r.minY ?? -1 / 0,
|
|
2930
2861
|
maxY: r.maxY ?? 1 / 0
|
|
2931
2862
|
});
|
|
2932
2863
|
}
|
|
2933
|
-
},
|
|
2934
|
-
var y, v, E, x,
|
|
2935
|
-
const
|
|
2864
|
+
}, ut = (r) => {
|
|
2865
|
+
var y, v, E, x, L, b, D, V, et, rt, ot, st;
|
|
2866
|
+
const t = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, e = t !== void 0 ? t : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
2936
2867
|
let i;
|
|
2937
|
-
s !== void 0 ? Array.isArray(s) ? i =
|
|
2868
|
+
s !== void 0 ? Array.isArray(s) ? i = ye(
|
|
2938
2869
|
s.map(
|
|
2939
|
-
(
|
|
2870
|
+
(N) => lt(N)
|
|
2940
2871
|
)
|
|
2941
|
-
) : i =
|
|
2872
|
+
) : i = lt(s) : i = (N) => N.nextTransform;
|
|
2942
2873
|
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
|
|
2943
2874
|
}), h = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
|
|
2944
|
-
}), d = (
|
|
2875
|
+
}), d = (L = r == null ? void 0 : r.shift) == null ? void 0 : L.mouseDownEventVerifier, c = d !== void 0 ? d : (N) => N.button === 0, l = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, g = l !== void 0 ? l : (N) => N.button === 0, w = (D = r == null ? void 0 : r.scale) == null ? void 0 : D.mouseWheelEventVerifier, f = w !== void 0 ? w : () => !0;
|
|
2945
2876
|
return {
|
|
2946
|
-
wheelSensitivity:
|
|
2877
|
+
wheelSensitivity: e,
|
|
2947
2878
|
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
2948
2879
|
}),
|
|
2949
|
-
onTransformFinished: ((
|
|
2880
|
+
onTransformFinished: ((et = r == null ? void 0 : r.events) == null ? void 0 : et.onTransformFinished) ?? (() => {
|
|
2950
2881
|
}),
|
|
2951
2882
|
onBeforeTransformChange: a,
|
|
2952
2883
|
onTransformChange: h,
|
|
@@ -2955,30 +2886,30 @@ const H = (r) => () => r, ge = H(0), lt = () => {
|
|
|
2955
2886
|
mouseDownEventVerifier: c,
|
|
2956
2887
|
mouseUpEventVerifier: g,
|
|
2957
2888
|
mouseWheelEventVerifier: f,
|
|
2958
|
-
scaleWheelFinishTimeout: ((
|
|
2959
|
-
onResizeTransformStarted: ((
|
|
2889
|
+
scaleWheelFinishTimeout: ((rt = r == null ? void 0 : r.scale) == null ? void 0 : rt.wheelFinishTimeout) ?? 500,
|
|
2890
|
+
onResizeTransformStarted: ((ot = r == null ? void 0 : r.events) == null ? void 0 : ot.onResizeTransformStarted) ?? (() => {
|
|
2960
2891
|
}),
|
|
2961
|
-
onResizeTransformFinished: ((
|
|
2892
|
+
onResizeTransformFinished: ((st = r == null ? void 0 : r.events) == null ? void 0 : st.onResizeTransformFinished) ?? (() => {
|
|
2962
2893
|
})
|
|
2963
2894
|
};
|
|
2964
|
-
},
|
|
2965
|
-
const
|
|
2895
|
+
}, ve = (r, t) => {
|
|
2896
|
+
const e = document.createElementNS(
|
|
2966
2897
|
"http://www.w3.org/2000/svg",
|
|
2967
2898
|
"circle"
|
|
2968
2899
|
);
|
|
2969
|
-
return
|
|
2970
|
-
},
|
|
2900
|
+
return e.setAttribute("cx", "0"), e.setAttribute("cy", "0"), e.setAttribute("r", `${r}`), e.setAttribute("fill", `${t}`), e;
|
|
2901
|
+
}, Ee = (r) => r instanceof SVGElement ? r : ve(
|
|
2971
2902
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
2972
2903
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
2973
|
-
),
|
|
2974
|
-
const
|
|
2904
|
+
), Ae = (r) => {
|
|
2905
|
+
const t = r.tileDimensions, e = (t == null ? void 0 : t.width) ?? 25, s = (t == null ? void 0 : t.height) ?? 25, i = Ee(r.renderer ?? {});
|
|
2975
2906
|
return {
|
|
2976
|
-
tileWidth:
|
|
2907
|
+
tileWidth: e,
|
|
2977
2908
|
tileHeight: s,
|
|
2978
2909
|
renderer: i,
|
|
2979
2910
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
2980
2911
|
};
|
|
2981
|
-
},
|
|
2912
|
+
}, xe = (r, t, e) => {
|
|
2982
2913
|
var c, l, g;
|
|
2983
2914
|
const s = () => "direct", i = (w) => w, n = (w) => w.button === 0, a = () => {
|
|
2984
2915
|
}, h = () => {
|
|
@@ -2992,43 +2923,49 @@ const H = (r) => () => r, ge = H(0), lt = () => {
|
|
|
2992
2923
|
onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
|
|
2993
2924
|
onEdgeCreationInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeCreationInterrupted) ?? d,
|
|
2994
2925
|
onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
|
|
2995
|
-
dragPortDirection: r.dragPortDirection ??
|
|
2996
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
2926
|
+
dragPortDirection: r.dragPortDirection ?? e,
|
|
2927
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? tt(r.edgeShape) : t
|
|
2997
2928
|
};
|
|
2998
|
-
},
|
|
2929
|
+
}, Se = (r, t) => {
|
|
2999
2930
|
var c, l, g;
|
|
3000
|
-
const
|
|
3001
|
-
const f =
|
|
2931
|
+
const e = (w) => w, s = (w) => w.button === 0 && w.ctrlKey, i = (w) => w.button === 0, n = (w) => {
|
|
2932
|
+
const f = t.getPortAdjacentEdgeIds(w);
|
|
3002
2933
|
return f.length > 0 ? f[f.length - 1] : null;
|
|
3003
2934
|
}, a = () => {
|
|
3004
2935
|
}, h = () => {
|
|
3005
2936
|
}, d = () => {
|
|
3006
2937
|
};
|
|
3007
2938
|
return {
|
|
3008
|
-
connectionPreprocessor: r.connectionPreprocessor ??
|
|
2939
|
+
connectionPreprocessor: r.connectionPreprocessor ?? e,
|
|
3009
2940
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
3010
2941
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
|
|
3011
2942
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3012
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
2943
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? tt(r.draggingEdgeShape) : null,
|
|
3013
2944
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3014
2945
|
onEdgeReattachInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeReattachInterrupted) ?? d,
|
|
3015
2946
|
onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
|
|
3016
2947
|
};
|
|
3017
|
-
},
|
|
2948
|
+
}, Pe = (r) => ({
|
|
3018
2949
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3019
2950
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3020
|
-
}),
|
|
3021
|
-
var
|
|
2951
|
+
}), be = (r) => {
|
|
2952
|
+
var t, e;
|
|
3022
2953
|
return {
|
|
3023
|
-
onAfterNodeDetached: ((
|
|
2954
|
+
onAfterNodeDetached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onAfterNodeDetached) ?? (() => {
|
|
3024
2955
|
}),
|
|
3025
|
-
onBeforeNodeAttached: ((
|
|
2956
|
+
onBeforeNodeAttached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onBeforeNodeAttached) ?? (() => {
|
|
3026
2957
|
})
|
|
3027
2958
|
};
|
|
3028
2959
|
};
|
|
3029
|
-
class
|
|
3030
|
-
constructor(
|
|
3031
|
-
|
|
2960
|
+
class Te extends Error {
|
|
2961
|
+
constructor() {
|
|
2962
|
+
super(...arguments);
|
|
2963
|
+
o(this, "name", "CanvasBuilderError");
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
class Me {
|
|
2967
|
+
constructor(t) {
|
|
2968
|
+
o(this, "used", !1);
|
|
3032
2969
|
o(this, "canvasDefaults", {});
|
|
3033
2970
|
o(this, "dragConfig", {});
|
|
3034
2971
|
o(this, "transformConfig", {});
|
|
@@ -3044,39 +2981,25 @@ class Nt {
|
|
|
3044
2981
|
o(this, "hasUserDraggableEdges", !1);
|
|
3045
2982
|
o(this, "boxRenderingTrigger");
|
|
3046
2983
|
o(this, "window", window);
|
|
3047
|
-
|
|
3048
|
-
}
|
|
3049
|
-
/**
|
|
3050
|
-
* @deprecated
|
|
3051
|
-
* use `new CanvasBuilder(element);` instead
|
|
3052
|
-
*/
|
|
3053
|
-
setElement(e) {
|
|
3054
|
-
return this.element = e, this;
|
|
2984
|
+
this.element = t, t !== void 0 && (this.element = t);
|
|
3055
2985
|
}
|
|
3056
2986
|
/**
|
|
3057
2987
|
* specifies default values for graph entities
|
|
3058
2988
|
*/
|
|
3059
|
-
setDefaults(
|
|
3060
|
-
return this.canvasDefaults =
|
|
2989
|
+
setDefaults(t) {
|
|
2990
|
+
return this.canvasDefaults = t, this;
|
|
3061
2991
|
}
|
|
3062
2992
|
/**
|
|
3063
2993
|
* enables nodes draggable by user
|
|
3064
2994
|
*/
|
|
3065
|
-
enableUserDraggableNodes(
|
|
3066
|
-
return this.hasDraggableNode = !0, this.dragConfig =
|
|
2995
|
+
enableUserDraggableNodes(t) {
|
|
2996
|
+
return this.hasDraggableNode = !0, this.dragConfig = t ?? {}, this;
|
|
3067
2997
|
}
|
|
3068
2998
|
/**
|
|
3069
2999
|
* enables viewport transformable by user
|
|
3070
3000
|
*/
|
|
3071
|
-
enableUserTransformableViewport(
|
|
3072
|
-
return this.hasTransformableViewport = !0, this.transformConfig =
|
|
3073
|
-
}
|
|
3074
|
-
/**
|
|
3075
|
-
* @deprecated
|
|
3076
|
-
* use enableNodeResizeReactiveEdges instead
|
|
3077
|
-
*/
|
|
3078
|
-
enableResizeReactiveNodes() {
|
|
3079
|
-
return this.hasNodeResizeReactiveEdges = !0, this;
|
|
3001
|
+
enableUserTransformableViewport(t) {
|
|
3002
|
+
return this.hasTransformableViewport = !0, this.transformConfig = t ?? {}, this;
|
|
3080
3003
|
}
|
|
3081
3004
|
/**
|
|
3082
3005
|
* enables automatic edges update on node resize
|
|
@@ -3084,76 +3007,66 @@ class Nt {
|
|
|
3084
3007
|
enableNodeResizeReactiveEdges() {
|
|
3085
3008
|
return this.hasNodeResizeReactiveEdges = !0, this;
|
|
3086
3009
|
}
|
|
3087
|
-
/**
|
|
3088
|
-
* @deprecated
|
|
3089
|
-
* do not use
|
|
3090
|
-
* sets emitter for rendering graph inside bounded area
|
|
3091
|
-
*/
|
|
3092
|
-
enableBoxAreaRendering(e) {
|
|
3093
|
-
return this.boxRenderingTrigger = e, this;
|
|
3094
|
-
}
|
|
3095
3010
|
/**
|
|
3096
3011
|
* enables built-in virtual scroll behavior, when only nodes and edges close
|
|
3097
3012
|
* to viewport are rendered
|
|
3098
3013
|
*/
|
|
3099
|
-
enableVirtualScroll(
|
|
3100
|
-
return this.virtualScrollConfig =
|
|
3014
|
+
enableVirtualScroll(t) {
|
|
3015
|
+
return this.virtualScrollConfig = t, this;
|
|
3101
3016
|
}
|
|
3102
3017
|
/**
|
|
3103
3018
|
* enables built-in background rendering
|
|
3104
3019
|
*/
|
|
3105
|
-
enableBackground(
|
|
3106
|
-
return this.hasBackground = !0, this.backgroundConfig =
|
|
3020
|
+
enableBackground(t) {
|
|
3021
|
+
return this.hasBackground = !0, this.backgroundConfig = t ?? {}, this;
|
|
3107
3022
|
}
|
|
3108
3023
|
/**
|
|
3109
3024
|
* enables edge creation by dragging one port to another
|
|
3110
3025
|
*/
|
|
3111
|
-
enableUserConnectablePorts(
|
|
3112
|
-
return this.connectablePortsConfig =
|
|
3026
|
+
enableUserConnectablePorts(t) {
|
|
3027
|
+
return this.connectablePortsConfig = t ?? {}, this.hasUserConnectablePorts = !0, this;
|
|
3113
3028
|
}
|
|
3114
|
-
enableUserDraggableEdges(
|
|
3115
|
-
return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig =
|
|
3029
|
+
enableUserDraggableEdges(t) {
|
|
3030
|
+
return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = t ?? {}, this;
|
|
3116
3031
|
}
|
|
3117
3032
|
/**
|
|
3118
3033
|
* builds final canvas
|
|
3119
3034
|
*/
|
|
3120
3035
|
build() {
|
|
3121
|
-
if (this.
|
|
3122
|
-
throw new
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
t,
|
|
3036
|
+
if (this.used)
|
|
3037
|
+
throw new Te("CanvasBuilder is a single use object");
|
|
3038
|
+
this.used = !0;
|
|
3039
|
+
let t = this.boxRenderingTrigger;
|
|
3040
|
+
this.virtualScrollConfig !== void 0 && t === void 0 && (t = new wt());
|
|
3041
|
+
const e = new mt(), s = new Bt(), i = new ge(this.element);
|
|
3042
|
+
let n = new pt(
|
|
3043
|
+
e,
|
|
3130
3044
|
s,
|
|
3131
3045
|
i.main
|
|
3132
3046
|
);
|
|
3133
|
-
|
|
3047
|
+
t !== void 0 && (n = new It(
|
|
3134
3048
|
n,
|
|
3135
|
-
t,
|
|
3136
3049
|
e,
|
|
3137
|
-
bt(this.virtualScrollConfig)
|
|
3138
|
-
));
|
|
3139
|
-
const a = pt(this.canvasDefaults), h = new fe(
|
|
3140
|
-
this.element,
|
|
3141
3050
|
t,
|
|
3051
|
+
be(this.virtualScrollConfig)
|
|
3052
|
+
));
|
|
3053
|
+
const a = pe(this.canvasDefaults), h = new ft(
|
|
3054
|
+
e,
|
|
3142
3055
|
s,
|
|
3143
3056
|
n,
|
|
3144
3057
|
a
|
|
3145
3058
|
);
|
|
3146
3059
|
if (this.hasBackground && Q.configure(
|
|
3147
3060
|
h,
|
|
3148
|
-
|
|
3061
|
+
Ae(this.backgroundConfig),
|
|
3149
3062
|
i.background
|
|
3150
3063
|
), this.hasNodeResizeReactiveEdges && j.configure(h), this.hasDraggableNode && Z.configure(
|
|
3151
3064
|
h,
|
|
3152
3065
|
i.main,
|
|
3153
3066
|
this.window,
|
|
3154
|
-
|
|
3067
|
+
we(this.dragConfig)
|
|
3155
3068
|
), this.hasUserConnectablePorts) {
|
|
3156
|
-
const c =
|
|
3069
|
+
const c = xe(
|
|
3157
3070
|
this.connectablePortsConfig,
|
|
3158
3071
|
a.edges.shapeFactory,
|
|
3159
3072
|
a.ports.direction
|
|
@@ -3167,7 +3080,7 @@ class Nt {
|
|
|
3167
3080
|
);
|
|
3168
3081
|
}
|
|
3169
3082
|
if (this.hasUserDraggableEdges) {
|
|
3170
|
-
const c =
|
|
3083
|
+
const c = Se(
|
|
3171
3084
|
this.draggableEdgesConfig,
|
|
3172
3085
|
h.graph
|
|
3173
3086
|
);
|
|
@@ -3183,40 +3096,31 @@ class Nt {
|
|
|
3183
3096
|
h,
|
|
3184
3097
|
i.main,
|
|
3185
3098
|
this.window,
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3099
|
+
ut(this.transformConfig),
|
|
3100
|
+
t,
|
|
3101
|
+
Pe(this.virtualScrollConfig)
|
|
3189
3102
|
) : this.hasTransformableViewport && k.configure(
|
|
3190
3103
|
h,
|
|
3191
3104
|
i.main,
|
|
3192
3105
|
this.window,
|
|
3193
|
-
|
|
3194
|
-
)
|
|
3106
|
+
ut(this.transformConfig)
|
|
3107
|
+
);
|
|
3195
3108
|
const d = () => {
|
|
3196
3109
|
i.destroy(), h.onBeforeDestroy.unsubscribe(d);
|
|
3197
3110
|
};
|
|
3198
3111
|
return h.onBeforeDestroy.subscribe(d), h;
|
|
3199
3112
|
}
|
|
3200
|
-
/**
|
|
3201
|
-
* @deprecated
|
|
3202
|
-
* CanvasBuilder should be single use object
|
|
3203
|
-
*/
|
|
3204
|
-
reset() {
|
|
3205
|
-
this.element = null, this.canvasDefaults = {}, this.dragConfig = {}, this.transformConfig = {}, this.backgroundConfig = {}, this.virtualScrollConfig = void 0, this.hasDraggableNode = !1, this.hasTransformableViewport = !1, this.hasNodeResizeReactiveEdges = !1, this.hasBackground = !1, this.boxRenderingTrigger = void 0, this.hasUserConnectablePorts = !1;
|
|
3206
|
-
}
|
|
3207
3113
|
}
|
|
3208
3114
|
export {
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
et as StraightEdgeShape,
|
|
3221
|
-
tt as VerticalEdgeShape
|
|
3115
|
+
_t as BezierEdgeShape,
|
|
3116
|
+
Me as CanvasBuilder,
|
|
3117
|
+
Te as CanvasBuilderError,
|
|
3118
|
+
S as CanvasError,
|
|
3119
|
+
bt as DirectEdgeShape,
|
|
3120
|
+
qt as HorizontalEdgeShape,
|
|
3121
|
+
se as InteractiveEdgeError,
|
|
3122
|
+
Tt as InteractiveEdgeShape,
|
|
3123
|
+
Ne as MidpointEdgeShape,
|
|
3124
|
+
te as StraightEdgeShape,
|
|
3125
|
+
ee as VerticalEdgeShape
|
|
3222
3126
|
};
|