mind-elixir 5.11.0 → 5.11.1-beta.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/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +874 -863
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +598 -587
- package/dist/types/utils/pubsub.d.ts +4 -0
- package/package.json +1 -1
package/dist/MindElixir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Qo = 0, es = 1, ts = 2, pe = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -25,7 +25,7 @@ const ts = 0, ns = 1, os = 2, be = {
|
|
|
25
25
|
"--panel-border-color": "#eaeaea",
|
|
26
26
|
"--map-padding": "50px 80px"
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, ge = {
|
|
29
29
|
name: "Dark",
|
|
30
30
|
type: "dark",
|
|
31
31
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -53,61 +53,61 @@ const ts = 0, ns = 1, os = 2, be = {
|
|
|
53
53
|
"--map-padding": "50px 80px"
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
function
|
|
56
|
+
function he(e) {
|
|
57
57
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const oe = function(e, t) {
|
|
60
60
|
if (t.id === e)
|
|
61
61
|
return t;
|
|
62
62
|
if (t.children && t.children.length) {
|
|
63
63
|
for (let n = 0; n < t.children.length; n++) {
|
|
64
|
-
const o =
|
|
64
|
+
const o = oe(e, t.children[n]);
|
|
65
65
|
if (o) return o;
|
|
66
66
|
}
|
|
67
67
|
return null;
|
|
68
68
|
} else
|
|
69
69
|
return null;
|
|
70
|
-
},
|
|
70
|
+
}, W = (e, t) => {
|
|
71
71
|
if (e.parent = t, e.children)
|
|
72
72
|
for (let n = 0; n < e.children.length; n++)
|
|
73
|
-
|
|
74
|
-
},
|
|
73
|
+
W(e.children[n], e);
|
|
74
|
+
}, z = (e, t, n) => {
|
|
75
75
|
if (e.expanded = t, e.children)
|
|
76
76
|
if (n === void 0 || n > 0) {
|
|
77
77
|
const o = n !== void 0 ? n - 1 : void 0;
|
|
78
78
|
e.children.forEach((s) => {
|
|
79
|
-
|
|
79
|
+
z(s, t, o);
|
|
80
80
|
});
|
|
81
81
|
} else
|
|
82
82
|
e.children.forEach((o) => {
|
|
83
|
-
|
|
83
|
+
z(o, !1);
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
function
|
|
87
|
-
if (e.id =
|
|
86
|
+
function me(e) {
|
|
87
|
+
if (e.id = Y(), e.children)
|
|
88
88
|
for (let t = 0; t < e.children.length; t++)
|
|
89
|
-
|
|
89
|
+
me(e.children[t]);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const s = n - e, i = o - t, c = Math.atan2(i, s) * 180 / Math.PI, r = 12, a = 30,
|
|
91
|
+
function se(e, t, n, o) {
|
|
92
|
+
const s = n - e, i = o - t, c = Math.atan2(i, s) * 180 / Math.PI, r = 12, a = 30, h = (c + 180 - a) * Math.PI / 180, f = (c + 180 + a) * Math.PI / 180;
|
|
93
93
|
return {
|
|
94
|
-
x1: n + Math.cos(
|
|
95
|
-
y1: o + Math.sin(
|
|
96
|
-
x2: n + Math.cos(
|
|
97
|
-
y2: o + Math.sin(
|
|
94
|
+
x1: n + Math.cos(h) * r,
|
|
95
|
+
y1: o + Math.sin(h) * r,
|
|
96
|
+
x2: n + Math.cos(f) * r,
|
|
97
|
+
y2: o + Math.sin(f) * r
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function Y() {
|
|
101
101
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
102
102
|
}
|
|
103
|
-
const
|
|
104
|
-
const e =
|
|
103
|
+
const ft = function() {
|
|
104
|
+
const e = Y();
|
|
105
105
|
return {
|
|
106
106
|
topic: this.newTopicName,
|
|
107
107
|
id: e
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
function
|
|
110
|
+
function ye(e) {
|
|
111
111
|
return JSON.parse(
|
|
112
112
|
JSON.stringify(e, (n, o) => {
|
|
113
113
|
if (n !== "parent")
|
|
@@ -115,15 +115,15 @@ function we(e) {
|
|
|
115
115
|
})
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const A = (e, t) => {
|
|
119
119
|
let n = 0, o = 0;
|
|
120
120
|
for (; t && t !== e; )
|
|
121
121
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
122
122
|
return { offsetLeft: n, offsetTop: o };
|
|
123
|
-
},
|
|
123
|
+
}, _ = (e, t) => {
|
|
124
124
|
for (const n in t)
|
|
125
125
|
e.setAttribute(n, t[n]);
|
|
126
|
-
},
|
|
126
|
+
}, V = (e) => e ? e.tagName === "ME-TPC" : !1, be = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
127
127
|
for (let s = 0; s < o.length; s++) {
|
|
128
128
|
if (t === o[s]) continue;
|
|
129
129
|
const { parent: i } = t.nodeObj;
|
|
@@ -131,10 +131,10 @@ const $ = (e, t) => {
|
|
|
131
131
|
return !1;
|
|
132
132
|
}
|
|
133
133
|
return !0;
|
|
134
|
-
}),
|
|
134
|
+
}), ve = (e) => {
|
|
135
135
|
const t = /translate3d\(([^,]+),\s*([^,]+)/, n = e.match(t);
|
|
136
136
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
137
|
-
},
|
|
137
|
+
}, qe = function(e) {
|
|
138
138
|
for (let t = 0; t < e.length; t++) {
|
|
139
139
|
const { dom: n, evt: o, func: s } = e[t];
|
|
140
140
|
n.addEventListener(o, s);
|
|
@@ -145,31 +145,31 @@ const $ = (e, t) => {
|
|
|
145
145
|
o.removeEventListener(s, i);
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
},
|
|
148
|
+
}, De = (e, t) => {
|
|
149
149
|
const n = e.x - t.x, o = e.y - t.y;
|
|
150
150
|
return Math.sqrt(n * n + o * o);
|
|
151
|
-
},
|
|
151
|
+
}, ut = function(e, t) {
|
|
152
152
|
if (!t)
|
|
153
|
-
return
|
|
153
|
+
return re(e), e;
|
|
154
154
|
let n = e.querySelector(".insert-preview");
|
|
155
155
|
const o = `insert-preview ${t} show`;
|
|
156
156
|
return n || (n = document.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
157
|
-
},
|
|
157
|
+
}, re = function(e) {
|
|
158
158
|
if (!e) return;
|
|
159
159
|
const t = e.querySelectorAll(".insert-preview");
|
|
160
160
|
for (const n of t || [])
|
|
161
161
|
n.remove();
|
|
162
|
-
},
|
|
162
|
+
}, Ae = function(e, t) {
|
|
163
163
|
for (const n of t) {
|
|
164
164
|
const o = n.parentElement.parentElement.contains(e);
|
|
165
165
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
166
166
|
}
|
|
167
167
|
return !0;
|
|
168
|
-
},
|
|
168
|
+
}, pt = function(e) {
|
|
169
169
|
const t = document.createElement("div");
|
|
170
170
|
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
|
|
171
171
|
};
|
|
172
|
-
class
|
|
172
|
+
class gt {
|
|
173
173
|
mind;
|
|
174
174
|
isMoving = !1;
|
|
175
175
|
interval = null;
|
|
@@ -186,28 +186,28 @@ class yt {
|
|
|
186
186
|
this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function mt(e) {
|
|
190
190
|
return {
|
|
191
191
|
isDragging: !1,
|
|
192
192
|
insertType: null,
|
|
193
193
|
meet: null,
|
|
194
|
-
ghost:
|
|
195
|
-
edgeMoveController: new
|
|
194
|
+
ghost: pt(e),
|
|
195
|
+
edgeMoveController: new gt(e),
|
|
196
196
|
startX: 0,
|
|
197
197
|
startY: 0,
|
|
198
198
|
pointerId: null
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
-
const
|
|
202
|
-
function
|
|
201
|
+
const yt = 5;
|
|
202
|
+
function Me(e, t, n, o = !1) {
|
|
203
203
|
if (e.spacePressed) return !1;
|
|
204
204
|
const s = n.target;
|
|
205
|
-
return s?.tagName !== "ME-TPC" || !s.nodeObj.parent ? !1 : (t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.dragged = e.currentNodes, o &&
|
|
205
|
+
return s?.tagName !== "ME-TPC" || !s.nodeObj.parent ? !1 : (t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.dragged = e.currentNodes, o && Je(e, t), !0);
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Ue(e, t, n) {
|
|
208
208
|
e.style.transform = `translate(${t - 10}px, ${n - 10}px)`, e.style.display = "block";
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function Je(e, t) {
|
|
211
211
|
const { dragged: n } = e;
|
|
212
212
|
if (!n) return;
|
|
213
213
|
const o = document.activeElement;
|
|
@@ -216,58 +216,58 @@ function Qe(e, t) {
|
|
|
216
216
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
217
217
|
e.panHelper.clear();
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function bt(e, t, n) {
|
|
220
220
|
const { dragged: o } = e;
|
|
221
221
|
if (!o || t.pointerId !== n.pointerId) return;
|
|
222
222
|
const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i);
|
|
223
|
-
if (!t.isDragging && l >
|
|
223
|
+
if (!t.isDragging && l > yt && Je(e, t), !t.isDragging) return;
|
|
224
224
|
const c = e.container.getBoundingClientRect();
|
|
225
|
-
|
|
225
|
+
Ue(t.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(), re(t.meet);
|
|
226
226
|
const r = 12 * e.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - r);
|
|
227
|
-
if (
|
|
227
|
+
if (Ae(a, o)) {
|
|
228
228
|
t.meet = a;
|
|
229
|
-
const
|
|
230
|
-
n.clientY >
|
|
229
|
+
const h = a.getBoundingClientRect(), f = h.y;
|
|
230
|
+
n.clientY > f + h.height ? t.insertType = "after" : t.insertType = "in";
|
|
231
231
|
} else {
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
234
|
-
t.meet =
|
|
235
|
-
const u =
|
|
232
|
+
const h = document.elementFromPoint(n.clientX, n.clientY + r);
|
|
233
|
+
if (Ae(h, o)) {
|
|
234
|
+
t.meet = h;
|
|
235
|
+
const u = h.getBoundingClientRect().y;
|
|
236
236
|
n.clientY < u ? t.insertType = "before" : t.insertType = "in";
|
|
237
237
|
} else
|
|
238
238
|
t.insertType = null, t.meet = null;
|
|
239
239
|
}
|
|
240
|
-
t.meet &&
|
|
240
|
+
t.meet && ut(t.meet, t.insertType);
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function vt(e, t, n) {
|
|
243
243
|
const { dragged: o } = e;
|
|
244
244
|
if (!(!o || t.pointerId !== n.pointerId)) {
|
|
245
245
|
t.edgeMoveController.stop();
|
|
246
246
|
for (const s of o)
|
|
247
247
|
s.parentElement.parentElement.style.opacity = "1";
|
|
248
|
-
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (
|
|
248
|
+
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (re(t.meet), t.insertType === "before" ? e.moveNodeBefore(o, t.meet) : t.insertType === "after" ? e.moveNodeAfter(o, t.meet) : t.insertType === "in" && e.moveNodeIn(o, t.meet)), e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function ae(e, t) {
|
|
252
252
|
const { dragged: n } = e;
|
|
253
253
|
if (n) {
|
|
254
254
|
t.edgeMoveController.stop();
|
|
255
255
|
for (const o of n)
|
|
256
256
|
o.parentElement.parentElement.style.opacity = "1";
|
|
257
|
-
t.meet &&
|
|
257
|
+
t.meet && re(t.meet), t.ghost.style.display = "none", t.ghost.innerHTML = "", e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function xt(e) {
|
|
261
261
|
return () => {
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
-
const
|
|
264
|
+
const H = {
|
|
265
265
|
LHS: "lhs",
|
|
266
266
|
RHS: "rhs"
|
|
267
|
-
},
|
|
267
|
+
}, wt = function() {
|
|
268
268
|
this.nodes.innerHTML = "";
|
|
269
269
|
const e = this.createTopic(this.nodeData);
|
|
270
|
-
|
|
270
|
+
xe.call(this, e, this.nodeData), e.draggable = !1;
|
|
271
271
|
const t = document.createElement("me-root");
|
|
272
272
|
t.appendChild(e);
|
|
273
273
|
const n = this.nodeData.children || [];
|
|
@@ -277,29 +277,29 @@ const B = {
|
|
|
277
277
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
-
|
|
281
|
-
},
|
|
280
|
+
Et(this, n, t);
|
|
281
|
+
}, Et = function(e, t, n) {
|
|
282
282
|
const o = document.createElement("me-main");
|
|
283
|
-
o.className =
|
|
283
|
+
o.className = H.LHS;
|
|
284
284
|
const s = document.createElement("me-main");
|
|
285
|
-
s.className =
|
|
285
|
+
s.className = H.RHS;
|
|
286
286
|
for (let i = 0; i < t.length; i++) {
|
|
287
287
|
const l = t[i], { grp: c } = e.createWrapper(l);
|
|
288
288
|
e.direction === 2 ? l.direction === 0 ? o.appendChild(c) : s.appendChild(c) : e.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
289
289
|
}
|
|
290
290
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
|
|
291
|
-
},
|
|
291
|
+
}, Ct = function(e, t) {
|
|
292
292
|
const n = document.createElement("me-children");
|
|
293
293
|
for (let o = 0; o < t.length; o++) {
|
|
294
294
|
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
295
295
|
n.appendChild(i);
|
|
296
296
|
}
|
|
297
297
|
return n;
|
|
298
|
-
},
|
|
298
|
+
}, Ze = function(e, t) {
|
|
299
299
|
const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
300
300
|
if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
301
301
|
return o;
|
|
302
|
-
},
|
|
302
|
+
}, xe = function(e, t) {
|
|
303
303
|
if (e.innerHTML = "", t.style) {
|
|
304
304
|
const n = t.style;
|
|
305
305
|
for (const o in n)
|
|
@@ -326,7 +326,7 @@ const B = {
|
|
|
326
326
|
} else e.link && (e.link = void 0);
|
|
327
327
|
if (t.icons && t.icons.length) {
|
|
328
328
|
const n = document.createElement("span");
|
|
329
|
-
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${
|
|
329
|
+
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${he(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
330
330
|
} else e.icons && (e.icons = void 0);
|
|
331
331
|
if (t.tags && t.tags.length) {
|
|
332
332
|
const n = document.createElement("div");
|
|
@@ -335,35 +335,35 @@ const B = {
|
|
|
335
335
|
typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
|
|
336
336
|
}), e.appendChild(n), e.tags = n;
|
|
337
337
|
} else e.tags && (e.tags = void 0);
|
|
338
|
-
},
|
|
338
|
+
}, St = function(e, t) {
|
|
339
339
|
const n = document.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
340
340
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
341
|
-
const i =
|
|
341
|
+
const i = we(e.expanded);
|
|
342
342
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
343
|
-
const l =
|
|
343
|
+
const l = Ct(this, e.children);
|
|
344
344
|
n.appendChild(l);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
return { grp: n, top: o, tpc: s };
|
|
348
|
-
},
|
|
348
|
+
}, Nt = function(e) {
|
|
349
349
|
const t = document.createElement("me-parent"), n = this.createTopic(e);
|
|
350
|
-
return
|
|
351
|
-
},
|
|
350
|
+
return xe.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
351
|
+
}, Tt = function(e) {
|
|
352
352
|
const t = document.createElement("me-children");
|
|
353
353
|
return t.append(...e), t;
|
|
354
|
-
},
|
|
354
|
+
}, kt = function(e) {
|
|
355
355
|
const t = document.createElement("me-tpc");
|
|
356
356
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t;
|
|
357
357
|
};
|
|
358
|
-
function
|
|
358
|
+
function Qe(e) {
|
|
359
359
|
const t = document.createRange();
|
|
360
360
|
t.selectNodeContents(e);
|
|
361
361
|
const n = window.getSelection();
|
|
362
362
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
363
363
|
}
|
|
364
|
-
const
|
|
364
|
+
const _t = function(e) {
|
|
365
365
|
if (!e) return;
|
|
366
|
-
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } =
|
|
366
|
+
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = A(this.nodes, e);
|
|
367
367
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
368
368
|
const l = getComputedStyle(e);
|
|
369
369
|
t.style.cssText = `
|
|
@@ -376,7 +376,7 @@ const Dt = function(e) {
|
|
|
376
376
|
margin:${l.margin};
|
|
377
377
|
background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor};
|
|
378
378
|
border: ${l.border};
|
|
379
|
-
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"),
|
|
379
|
+
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), Qe(t), this.bus.fire("operation", {
|
|
380
380
|
name: "beginEdit",
|
|
381
381
|
obj: e.nodeObj
|
|
382
382
|
}), t.addEventListener("keydown", (c) => {
|
|
@@ -396,48 +396,48 @@ const Dt = function(e) {
|
|
|
396
396
|
origin: o
|
|
397
397
|
}));
|
|
398
398
|
});
|
|
399
|
-
},
|
|
399
|
+
}, we = function(e) {
|
|
400
400
|
const t = document.createElement("me-epd");
|
|
401
401
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
402
|
-
},
|
|
402
|
+
}, K = (e) => {
|
|
403
403
|
const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
|
|
404
404
|
return { siblings: t, index: n };
|
|
405
405
|
};
|
|
406
|
-
function
|
|
407
|
-
const { siblings: t, index: n } =
|
|
406
|
+
function Lt(e) {
|
|
407
|
+
const { siblings: t, index: n } = K(e);
|
|
408
408
|
if (t === void 0) return;
|
|
409
409
|
const o = t[n];
|
|
410
410
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
411
411
|
}
|
|
412
|
-
function
|
|
413
|
-
const { siblings: t, index: n } =
|
|
412
|
+
function Dt(e) {
|
|
413
|
+
const { siblings: t, index: n } = K(e);
|
|
414
414
|
if (t === void 0) return;
|
|
415
415
|
const o = t[n];
|
|
416
416
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
417
417
|
}
|
|
418
|
-
function
|
|
419
|
-
const { siblings: t, index: n } =
|
|
418
|
+
function et(e) {
|
|
419
|
+
const { siblings: t, index: n } = K(e);
|
|
420
420
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
421
421
|
}
|
|
422
|
-
function
|
|
423
|
-
const { siblings: o, index: s } =
|
|
422
|
+
function At(e, t, n) {
|
|
423
|
+
const { siblings: o, index: s } = K(n);
|
|
424
424
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
425
425
|
}
|
|
426
|
-
function
|
|
427
|
-
const { siblings: n, index: o } =
|
|
426
|
+
function Mt(e, t) {
|
|
427
|
+
const { siblings: n, index: o } = K(e);
|
|
428
428
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
429
429
|
}
|
|
430
|
-
function
|
|
431
|
-
if (
|
|
430
|
+
function Ot(e, t, n) {
|
|
431
|
+
if (et(t), n.parent?.parent || (t.direction = n.direction), e === "in")
|
|
432
432
|
n.children ? n.children.push(t) : n.children = [t];
|
|
433
433
|
else {
|
|
434
434
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
435
|
-
const { siblings: o, index: s } =
|
|
435
|
+
const { siblings: o, index: s } = K(n);
|
|
436
436
|
if (o === void 0) return;
|
|
437
437
|
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
const
|
|
440
|
+
const Pt = function({ map: e, direction: t }, n) {
|
|
441
441
|
if (t === 0)
|
|
442
442
|
return 0;
|
|
443
443
|
if (t === 1)
|
|
@@ -446,55 +446,55 @@ const Ht = function({ map: e, direction: t }, n) {
|
|
|
446
446
|
const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
|
|
447
447
|
return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
|
|
448
448
|
}
|
|
449
|
-
},
|
|
449
|
+
}, tt = function(e, t, n) {
|
|
450
450
|
const o = n.children[0].children[0], s = t.parentElement;
|
|
451
451
|
if (s.tagName === "ME-PARENT") {
|
|
452
|
-
if (
|
|
452
|
+
if (U(o), s.children[1])
|
|
453
453
|
s.nextSibling.appendChild(n);
|
|
454
454
|
else {
|
|
455
455
|
const i = e.createChildren([n]);
|
|
456
|
-
s.appendChild(
|
|
456
|
+
s.appendChild(we(!0)), s.insertAdjacentElement("afterend", i);
|
|
457
457
|
}
|
|
458
458
|
e.linkDiv(n.offsetParent);
|
|
459
|
-
} else s.tagName === "ME-ROOT" && (
|
|
460
|
-
},
|
|
459
|
+
} else s.tagName === "ME-ROOT" && (Pt(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
|
|
460
|
+
}, $t = function(e, t) {
|
|
461
461
|
const n = e.parentNode;
|
|
462
462
|
if (t === 0) {
|
|
463
463
|
const o = n.parentNode.parentNode;
|
|
464
464
|
o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
|
|
465
465
|
}
|
|
466
466
|
n.parentNode.remove();
|
|
467
|
-
},
|
|
467
|
+
}, nt = {
|
|
468
468
|
before: "beforebegin",
|
|
469
469
|
after: "afterend"
|
|
470
|
-
},
|
|
470
|
+
}, U = function(e) {
|
|
471
471
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
472
472
|
n?.tagName === "svg" && n?.remove();
|
|
473
|
-
},
|
|
474
|
-
const n = e.nodeObj, o =
|
|
473
|
+
}, Ht = function(e, t) {
|
|
474
|
+
const n = e.nodeObj, o = ye(n);
|
|
475
475
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
476
476
|
const s = Object.assign(n, t);
|
|
477
|
-
|
|
477
|
+
xe.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
478
478
|
name: "reshapeNode",
|
|
479
479
|
obj: s,
|
|
480
480
|
origin: o
|
|
481
481
|
});
|
|
482
|
-
},
|
|
482
|
+
}, Ee = function(e, t, n) {
|
|
483
483
|
if (!t) return null;
|
|
484
484
|
const o = t.nodeObj;
|
|
485
485
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
486
486
|
const s = n || e.generateNewObj();
|
|
487
|
-
o.children ? o.children.push(s) : o.children = [s],
|
|
487
|
+
o.children ? o.children.push(s) : o.children = [s], W(e.nodeData);
|
|
488
488
|
const { grp: i, top: l } = e.createWrapper(s);
|
|
489
|
-
return
|
|
490
|
-
},
|
|
489
|
+
return tt(e, t, i), { newTop: l, newNodeObj: s };
|
|
490
|
+
}, jt = function(e, t, n) {
|
|
491
491
|
const o = t || this.currentNode;
|
|
492
492
|
if (!o) return;
|
|
493
493
|
const s = o.nodeObj;
|
|
494
494
|
if (s.parent) {
|
|
495
495
|
if (!s.parent?.parent && this.direction === 2) {
|
|
496
|
-
const a = this.map.querySelector(".lhs")?.childElementCount || 0,
|
|
497
|
-
if (!a || !
|
|
496
|
+
const a = this.map.querySelector(".lhs")?.childElementCount || 0, h = this.map.querySelector(".rhs")?.childElementCount || 0;
|
|
497
|
+
if (!a || !h) {
|
|
498
498
|
this.addChild(this.findEle(s.parent.id), n);
|
|
499
499
|
return;
|
|
500
500
|
}
|
|
@@ -505,58 +505,58 @@ const Ht = function({ map: e, direction: t }, n) {
|
|
|
505
505
|
}
|
|
506
506
|
const i = n || this.generateNewObj();
|
|
507
507
|
if (!s.parent?.parent) {
|
|
508
|
-
const a = o.closest("me-main").className ===
|
|
508
|
+
const a = o.closest("me-main").className === H.LHS ? 0 : 1;
|
|
509
509
|
i.direction = a;
|
|
510
510
|
}
|
|
511
|
-
|
|
511
|
+
At(i, e, s), W(this.nodeData);
|
|
512
512
|
const l = o.parentElement, { grp: c, top: r } = this.createWrapper(i);
|
|
513
|
-
l.parentElement.insertAdjacentElement(
|
|
513
|
+
l.parentElement.insertAdjacentElement(nt[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(r.firstChild), this.bus.fire("operation", {
|
|
514
514
|
name: "insertSibling",
|
|
515
515
|
type: e,
|
|
516
516
|
obj: i
|
|
517
517
|
}), this.selectNode(r.firstChild, !0);
|
|
518
|
-
},
|
|
518
|
+
}, It = function(e, t) {
|
|
519
519
|
const n = e || this.currentNode;
|
|
520
520
|
if (!n) return;
|
|
521
|
-
|
|
521
|
+
U(n);
|
|
522
522
|
const o = n.nodeObj;
|
|
523
523
|
if (!o.parent)
|
|
524
524
|
return;
|
|
525
525
|
const s = t || this.generateNewObj();
|
|
526
|
-
|
|
526
|
+
Mt(o, s), W(this.nodeData);
|
|
527
527
|
const i = n.parentElement.parentElement, { grp: l, top: c } = this.createWrapper(s, !0);
|
|
528
|
-
c.appendChild(
|
|
528
|
+
c.appendChild(we(!0)), i.insertAdjacentElement("afterend", l);
|
|
529
529
|
const r = this.createChildren([i]);
|
|
530
530
|
c.insertAdjacentElement("afterend", r), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
|
|
531
531
|
name: "insertParent",
|
|
532
532
|
obj: s
|
|
533
533
|
});
|
|
534
|
-
},
|
|
534
|
+
}, Rt = function(e, t) {
|
|
535
535
|
const n = e || this.currentNode;
|
|
536
536
|
if (!n) return;
|
|
537
|
-
const o =
|
|
537
|
+
const o = Ee(this, n, t);
|
|
538
538
|
if (!o) return;
|
|
539
539
|
const { newTop: s, newNodeObj: i } = o;
|
|
540
540
|
this.bus.fire("operation", {
|
|
541
541
|
name: "addChild",
|
|
542
542
|
obj: i
|
|
543
543
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
544
|
-
},
|
|
545
|
-
const n =
|
|
546
|
-
|
|
547
|
-
const o =
|
|
544
|
+
}, Bt = function(e, t) {
|
|
545
|
+
const n = ye(e.nodeObj);
|
|
546
|
+
me(n);
|
|
547
|
+
const o = Ee(this, t, n);
|
|
548
548
|
if (!o) return;
|
|
549
549
|
const { newNodeObj: s } = o;
|
|
550
550
|
this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
|
|
551
551
|
name: "copyNode",
|
|
552
552
|
obj: s
|
|
553
553
|
});
|
|
554
|
-
},
|
|
554
|
+
}, Wt = function(e, t) {
|
|
555
555
|
const n = [];
|
|
556
556
|
for (let o = 0; o < e.length; o++) {
|
|
557
|
-
const s = e[o], i =
|
|
558
|
-
|
|
559
|
-
const l =
|
|
557
|
+
const s = e[o], i = ye(s.nodeObj);
|
|
558
|
+
me(i);
|
|
559
|
+
const l = Ee(this, t, i);
|
|
560
560
|
if (!l) return;
|
|
561
561
|
const { newNodeObj: c } = l;
|
|
562
562
|
n.push(c);
|
|
@@ -565,51 +565,51 @@ const Ht = function({ map: e, direction: t }, n) {
|
|
|
565
565
|
name: "copyNodes",
|
|
566
566
|
objs: n
|
|
567
567
|
});
|
|
568
|
-
},
|
|
568
|
+
}, Yt = function(e) {
|
|
569
569
|
const t = e || this.currentNode;
|
|
570
570
|
if (!t) return;
|
|
571
571
|
const n = t.nodeObj;
|
|
572
|
-
|
|
572
|
+
Lt(n);
|
|
573
573
|
const o = t.parentNode.parentNode;
|
|
574
574
|
o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
|
|
575
575
|
name: "moveUpNode",
|
|
576
576
|
obj: n
|
|
577
577
|
});
|
|
578
|
-
},
|
|
578
|
+
}, Xt = function(e) {
|
|
579
579
|
const t = e || this.currentNode;
|
|
580
580
|
if (!t) return;
|
|
581
581
|
const n = t.nodeObj;
|
|
582
|
-
|
|
582
|
+
Dt(n);
|
|
583
583
|
const o = t.parentNode.parentNode;
|
|
584
584
|
o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
|
|
585
585
|
name: "moveDownNode",
|
|
586
586
|
obj: n
|
|
587
587
|
});
|
|
588
|
-
},
|
|
589
|
-
if (e =
|
|
588
|
+
}, Ft = function(e) {
|
|
589
|
+
if (e = be(e), e.length === 0) return;
|
|
590
590
|
for (const n of e) {
|
|
591
|
-
const o = n.nodeObj, s =
|
|
592
|
-
|
|
591
|
+
const o = n.nodeObj, s = et(o);
|
|
592
|
+
$t(n, s);
|
|
593
593
|
}
|
|
594
594
|
const t = e[e.length - 1];
|
|
595
595
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
596
596
|
name: "removeNodes",
|
|
597
597
|
objs: e.map((n) => n.nodeObj)
|
|
598
598
|
});
|
|
599
|
-
},
|
|
600
|
-
e =
|
|
599
|
+
}, Ce = (e, t, n, o) => {
|
|
600
|
+
e = be(e);
|
|
601
601
|
let s = n.nodeObj;
|
|
602
602
|
t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
|
|
603
603
|
const i = [];
|
|
604
604
|
for (const c of e) {
|
|
605
605
|
const r = c.nodeObj;
|
|
606
|
-
if (
|
|
606
|
+
if (Ot(t, r, s), W(o.nodeData), t === "in") {
|
|
607
607
|
const a = c.parentElement;
|
|
608
|
-
|
|
608
|
+
tt(o, n, a.parentElement);
|
|
609
609
|
} else {
|
|
610
|
-
|
|
610
|
+
U(c);
|
|
611
611
|
const a = c.parentElement.parentNode;
|
|
612
|
-
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(
|
|
612
|
+
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(nt[t], a);
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
for (const c of i)
|
|
@@ -621,36 +621,36 @@ const Ht = function({ map: e, direction: t }, n) {
|
|
|
621
621
|
objs: e.map((c) => c.nodeObj),
|
|
622
622
|
toObj: s
|
|
623
623
|
});
|
|
624
|
+
}, Gt = function(e, t) {
|
|
625
|
+
Ce(e, "in", t, this);
|
|
626
|
+
}, zt = function(e, t) {
|
|
627
|
+
Ce(e, "before", t, this);
|
|
624
628
|
}, Kt = function(e, t) {
|
|
625
|
-
|
|
626
|
-
}, Vt = function(e
|
|
627
|
-
_e(e, "before", t, this);
|
|
628
|
-
}, qt = function(e, t) {
|
|
629
|
-
_e(e, "after", t, this);
|
|
630
|
-
}, Ut = function(e) {
|
|
629
|
+
Ce(e, "after", t, this);
|
|
630
|
+
}, Vt = function(e) {
|
|
631
631
|
const t = e || this.currentNode;
|
|
632
632
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
633
|
-
},
|
|
633
|
+
}, qt = function(e, t) {
|
|
634
634
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
635
|
-
},
|
|
635
|
+
}, ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
636
636
|
__proto__: null,
|
|
637
|
-
addChild:
|
|
638
|
-
beginEdit:
|
|
639
|
-
copyNode:
|
|
640
|
-
copyNodes:
|
|
641
|
-
insertParent:
|
|
642
|
-
insertSibling:
|
|
643
|
-
moveDownNode:
|
|
644
|
-
moveNodeAfter:
|
|
645
|
-
moveNodeBefore:
|
|
646
|
-
moveNodeIn:
|
|
647
|
-
moveUpNode:
|
|
648
|
-
removeNodes:
|
|
649
|
-
reshapeNode:
|
|
650
|
-
rmSubline:
|
|
651
|
-
setNodeTopic:
|
|
637
|
+
addChild: Rt,
|
|
638
|
+
beginEdit: Vt,
|
|
639
|
+
copyNode: Bt,
|
|
640
|
+
copyNodes: Wt,
|
|
641
|
+
insertParent: It,
|
|
642
|
+
insertSibling: jt,
|
|
643
|
+
moveDownNode: Xt,
|
|
644
|
+
moveNodeAfter: Kt,
|
|
645
|
+
moveNodeBefore: zt,
|
|
646
|
+
moveNodeIn: Gt,
|
|
647
|
+
moveUpNode: Yt,
|
|
648
|
+
removeNodes: Ft,
|
|
649
|
+
reshapeNode: Ht,
|
|
650
|
+
rmSubline: U,
|
|
651
|
+
setNodeTopic: qt
|
|
652
652
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
653
|
-
function
|
|
653
|
+
function Ut(e) {
|
|
654
654
|
return {
|
|
655
655
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
656
656
|
arrows: e.arrows,
|
|
@@ -659,189 +659,189 @@ function Zt(e) {
|
|
|
659
659
|
theme: e.theme
|
|
660
660
|
};
|
|
661
661
|
}
|
|
662
|
-
const
|
|
662
|
+
const Jt = function(e) {
|
|
663
663
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
664
664
|
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
665
|
-
const i = n.left + n.width / 2, l = n.top + n.height / 2, c = o.left + o.width / 2, r = o.top + o.height / 2, a = i - c,
|
|
666
|
-
this.move(-a, -
|
|
665
|
+
const i = n.left + n.width / 2, l = n.top + n.height / 2, c = o.left + o.width / 2, r = o.top + o.height / 2, a = i - c, h = l - r;
|
|
666
|
+
this.move(-a, -h, !0);
|
|
667
667
|
}
|
|
668
|
-
},
|
|
668
|
+
}, Zt = function(e, t, n) {
|
|
669
669
|
this.clearSelection(), this.scrollIntoView(e), this.selection?.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
670
|
-
},
|
|
670
|
+
}, Qt = function(e) {
|
|
671
671
|
this.selection?.select(e);
|
|
672
|
-
},
|
|
672
|
+
}, en = function(e) {
|
|
673
673
|
this.selection?.deselect(e);
|
|
674
|
-
},
|
|
674
|
+
}, tn = function() {
|
|
675
675
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
676
|
-
},
|
|
676
|
+
}, Se = function(e) {
|
|
677
677
|
return JSON.stringify(e, (t, n) => {
|
|
678
678
|
if (!(t === "parent" && typeof n != "string"))
|
|
679
679
|
return n;
|
|
680
680
|
});
|
|
681
|
-
},
|
|
682
|
-
const e =
|
|
683
|
-
return
|
|
684
|
-
},
|
|
681
|
+
}, nn = function() {
|
|
682
|
+
const e = Ut(this);
|
|
683
|
+
return Se(e);
|
|
684
|
+
}, on = function() {
|
|
685
685
|
return JSON.parse(this.getDataString());
|
|
686
|
-
},
|
|
686
|
+
}, sn = function() {
|
|
687
687
|
this.editable = !0;
|
|
688
|
-
},
|
|
688
|
+
}, rn = function() {
|
|
689
689
|
this.editable = !1;
|
|
690
|
-
},
|
|
690
|
+
}, ln = function(e, t = { x: 0, y: 0 }) {
|
|
691
691
|
if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
|
|
692
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } =
|
|
693
|
-
this.map.style.transform = `translate3d(${r -
|
|
694
|
-
},
|
|
692
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = Ne(this), c = this.map.style.transform, { x: r, y: a } = ve(c), h = r - i, f = a - l, u = this.scaleVal, b = (-o + h) * (1 - e / u), v = (-s + f) * (1 - e / u);
|
|
693
|
+
this.map.style.transform = `translate3d(${r - b}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
694
|
+
}, cn = function() {
|
|
695
695
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
696
696
|
this.scaleVal = n;
|
|
697
|
-
const { dx: o, dy: s } =
|
|
697
|
+
const { dx: o, dy: s } = Ne(this, !0);
|
|
698
698
|
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
699
|
-
},
|
|
699
|
+
}, an = function(e, t, n = !1) {
|
|
700
700
|
const { map: o, scaleVal: s, bus: i, container: l, nodes: c } = this;
|
|
701
701
|
if (n && o.style.transition === "transform 0.3s")
|
|
702
702
|
return;
|
|
703
703
|
const r = o.style.transform;
|
|
704
|
-
let { x: a, y:
|
|
705
|
-
const
|
|
706
|
-
if (
|
|
704
|
+
let { x: a, y: h } = ve(r);
|
|
705
|
+
const f = l.getBoundingClientRect(), u = c.getBoundingClientRect(), b = u.left < f.right && u.right > f.left, v = u.top < f.bottom && u.bottom > f.top;
|
|
706
|
+
if (b) {
|
|
707
707
|
const p = u.left + e, g = u.right + e;
|
|
708
|
-
(p >=
|
|
708
|
+
(p >= f.right || g <= f.left) && (e = 0);
|
|
709
709
|
}
|
|
710
|
-
if (
|
|
710
|
+
if (v) {
|
|
711
711
|
const p = u.top + t, g = u.bottom + t;
|
|
712
|
-
(p >=
|
|
712
|
+
(p >= f.bottom || g <= f.top) && (t = 0);
|
|
713
713
|
}
|
|
714
|
-
a += e,
|
|
714
|
+
a += e, h += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
715
715
|
o.style.transition = "none";
|
|
716
|
-
}, 300)), o.style.transform = `translate3d(${a}px, ${
|
|
717
|
-
},
|
|
716
|
+
}, 300)), o.style.transform = `translate3d(${a}px, ${h}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
717
|
+
}, Ne = (e, t = !1) => {
|
|
718
718
|
const { container: n, map: o, nodes: s } = e;
|
|
719
719
|
let i, l;
|
|
720
720
|
if (e.alignment === "nodes" || t)
|
|
721
721
|
i = (n.offsetWidth - s.offsetWidth) / 2, l = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
|
|
722
722
|
else {
|
|
723
|
-
const c = o.querySelector("me-root"), r = c.offsetTop, a = c.offsetLeft,
|
|
724
|
-
i = n.offsetWidth / 2 - a -
|
|
723
|
+
const c = o.querySelector("me-root"), r = c.offsetTop, a = c.offsetLeft, h = c.offsetWidth, f = c.offsetHeight;
|
|
724
|
+
i = n.offsetWidth / 2 - a - h / 2, l = n.offsetHeight / 2 - r - f / 2, o.style.transformOrigin = `${a + h / 2}px 50%`;
|
|
725
725
|
}
|
|
726
726
|
return { dx: i, dy: l };
|
|
727
|
-
},
|
|
728
|
-
const { map: e, container: t } = this, { dx: n, dy: o } =
|
|
727
|
+
}, dn = function() {
|
|
728
|
+
const { map: e, container: t } = this, { dx: n, dy: o } = Ne(this);
|
|
729
729
|
t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
730
|
-
},
|
|
730
|
+
}, hn = function(e) {
|
|
731
731
|
e(this);
|
|
732
|
-
},
|
|
732
|
+
}, fn = function(e) {
|
|
733
733
|
e.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
|
|
734
|
-
},
|
|
734
|
+
}, un = function() {
|
|
735
735
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
736
|
-
},
|
|
736
|
+
}, pn = function() {
|
|
737
737
|
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
738
|
-
},
|
|
738
|
+
}, gn = function() {
|
|
739
739
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
740
|
-
},
|
|
740
|
+
}, mn = function() {
|
|
741
741
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
742
|
-
},
|
|
742
|
+
}, yn = function(e, t) {
|
|
743
743
|
const n = e.nodeObj;
|
|
744
744
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
745
745
|
const o = e.getBoundingClientRect(), s = {
|
|
746
746
|
x: o.left,
|
|
747
747
|
y: o.top
|
|
748
748
|
}, i = e.parentNode, l = i.children[1];
|
|
749
|
-
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "",
|
|
750
|
-
const
|
|
749
|
+
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", U(e), n.expanded) {
|
|
750
|
+
const f = this.createChildren(
|
|
751
751
|
n.children.map((u) => this.createWrapper(u).grp)
|
|
752
752
|
);
|
|
753
|
-
i.parentNode.appendChild(
|
|
753
|
+
i.parentNode.appendChild(f);
|
|
754
754
|
} else
|
|
755
755
|
i.parentNode.children[1].remove();
|
|
756
756
|
this.linkDiv(e.closest("me-main > me-wrapper"));
|
|
757
757
|
const c = e.getBoundingClientRect(), r = {
|
|
758
758
|
x: c.left,
|
|
759
759
|
y: c.top
|
|
760
|
-
}, a = s.x - r.x,
|
|
761
|
-
this.move(a,
|
|
762
|
-
},
|
|
760
|
+
}, a = s.x - r.x, h = s.y - r.y;
|
|
761
|
+
this.move(a, h), this.bus.fire("expandNode", n);
|
|
762
|
+
}, bn = function(e, t) {
|
|
763
763
|
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
764
764
|
x: o.left,
|
|
765
765
|
y: o.top
|
|
766
766
|
};
|
|
767
|
-
|
|
767
|
+
z(n, t ?? !n.expanded), this.refresh();
|
|
768
768
|
const i = this.findEle(n.id).getBoundingClientRect(), l = {
|
|
769
769
|
x: i.left,
|
|
770
770
|
y: i.top
|
|
771
771
|
}, c = s.x - l.x, r = s.y - l.y;
|
|
772
772
|
this.move(c, r);
|
|
773
|
-
},
|
|
774
|
-
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)),
|
|
775
|
-
},
|
|
773
|
+
}, vn = function(e) {
|
|
774
|
+
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), W(this.nodeData), this.layout(), this.linkDiv();
|
|
775
|
+
}, xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
776
776
|
__proto__: null,
|
|
777
|
-
cancelFocus:
|
|
778
|
-
clearSelection:
|
|
779
|
-
disableEdit:
|
|
780
|
-
enableEdit:
|
|
781
|
-
expandNode:
|
|
782
|
-
expandNodeAll:
|
|
783
|
-
focusNode:
|
|
784
|
-
getData:
|
|
785
|
-
getDataString:
|
|
786
|
-
initLeft:
|
|
787
|
-
initRight:
|
|
788
|
-
initSide:
|
|
789
|
-
install:
|
|
790
|
-
move:
|
|
791
|
-
refresh:
|
|
792
|
-
scale:
|
|
793
|
-
scaleFit:
|
|
794
|
-
scrollIntoView:
|
|
795
|
-
selectNode:
|
|
796
|
-
selectNodes:
|
|
797
|
-
stringifyData:
|
|
798
|
-
toCenter:
|
|
799
|
-
unselectNodes:
|
|
800
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
801
|
-
const i = -
|
|
777
|
+
cancelFocus: un,
|
|
778
|
+
clearSelection: tn,
|
|
779
|
+
disableEdit: rn,
|
|
780
|
+
enableEdit: sn,
|
|
781
|
+
expandNode: yn,
|
|
782
|
+
expandNodeAll: bn,
|
|
783
|
+
focusNode: fn,
|
|
784
|
+
getData: on,
|
|
785
|
+
getDataString: nn,
|
|
786
|
+
initLeft: pn,
|
|
787
|
+
initRight: gn,
|
|
788
|
+
initSide: mn,
|
|
789
|
+
install: hn,
|
|
790
|
+
move: an,
|
|
791
|
+
refresh: vn,
|
|
792
|
+
scale: ln,
|
|
793
|
+
scaleFit: cn,
|
|
794
|
+
scrollIntoView: Jt,
|
|
795
|
+
selectNode: Zt,
|
|
796
|
+
selectNodes: Qt,
|
|
797
|
+
stringifyData: Se,
|
|
798
|
+
toCenter: dn,
|
|
799
|
+
unselectNodes: en
|
|
800
|
+
}, Symbol.toStringTag, { value: "Module" })), Oe = "MIND-ELIXIR-WAIT-COPY", wn = 40, En = 10, Cn = ({ deltaMode: e, deltaY: t, viewportHeight: n }) => e === WheelEvent.DOM_DELTA_LINE ? t * wn : e === WheelEvent.DOM_DELTA_PAGE ? t * n : t, Sn = ({ deltaMode: e, deltaY: t, scaleSensitivity: n, viewportHeight: o }) => {
|
|
801
|
+
const i = -Cn({ deltaMode: e, deltaY: t, viewportHeight: o }) / En * n;
|
|
802
802
|
return Math.max(-n, Math.min(n, i));
|
|
803
|
-
},
|
|
803
|
+
}, st = (e, t, n) => {
|
|
804
804
|
t !== 0 && e.scale(e.scaleVal + t, n);
|
|
805
|
-
},
|
|
805
|
+
}, Nn = (e, t) => {
|
|
806
806
|
const n = e.map.querySelectorAll(`.${t}>me-wrapper>me-parent>me-tpc`);
|
|
807
807
|
n.length !== 0 && e.selectNode(n[Math.ceil(n.length / 2) - 1]);
|
|
808
|
-
},
|
|
808
|
+
}, Tn = (e) => {
|
|
809
809
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
810
|
-
},
|
|
810
|
+
}, kn = function(e, t) {
|
|
811
811
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
812
812
|
if (n) {
|
|
813
813
|
const o = n.firstChild;
|
|
814
814
|
e.selectNode(o);
|
|
815
815
|
}
|
|
816
|
-
},
|
|
816
|
+
}, _n = function(e, t) {
|
|
817
817
|
const n = t.parentElement.nextSibling;
|
|
818
818
|
if (n && n.firstChild) {
|
|
819
819
|
const o = n.firstChild.firstChild.firstChild;
|
|
820
820
|
e.selectNode(o);
|
|
821
821
|
}
|
|
822
|
-
},
|
|
822
|
+
}, Pe = function(e, t) {
|
|
823
823
|
const n = e.currentNode || e.currentNodes?.[0];
|
|
824
824
|
if (!n) return;
|
|
825
825
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
826
|
-
o.parent ? s.className === t ?
|
|
827
|
-
},
|
|
826
|
+
o.parent ? s.className === t ? _n(e, n) : o.parent?.parent ? kn(e, n) : Tn(e) : Nn(e, t);
|
|
827
|
+
}, $e = function(e, t) {
|
|
828
828
|
const n = e.currentNode;
|
|
829
829
|
if (!n || !n.nodeObj.parent) return;
|
|
830
830
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
831
831
|
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
832
|
-
},
|
|
832
|
+
}, He = function(e, t, n) {
|
|
833
833
|
const o = t === "in" ? e.scaleSensitivity : -e.scaleSensitivity;
|
|
834
|
-
|
|
835
|
-
},
|
|
836
|
-
const n =
|
|
834
|
+
st(e, o, n);
|
|
835
|
+
}, Ln = (e, t) => {
|
|
836
|
+
const n = Sn({
|
|
837
837
|
deltaMode: t.deltaMode,
|
|
838
838
|
deltaY: t.deltaY,
|
|
839
839
|
scaleSensitivity: e.scaleSensitivity,
|
|
840
840
|
viewportHeight: e.container.clientHeight || window.innerHeight
|
|
841
841
|
});
|
|
842
|
-
|
|
842
|
+
st(e, n, { x: t.clientX, y: t.clientY });
|
|
843
843
|
};
|
|
844
|
-
function
|
|
844
|
+
function Dn(e, t) {
|
|
845
845
|
t = t === !0 ? {} : t;
|
|
846
846
|
const n = () => {
|
|
847
847
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
@@ -850,14 +850,14 @@ function Mn(e, t) {
|
|
|
850
850
|
const i = (r) => {
|
|
851
851
|
const a = e.nodeData;
|
|
852
852
|
if (r.key === "0")
|
|
853
|
-
for (const
|
|
854
|
-
|
|
853
|
+
for (const h of a.children)
|
|
854
|
+
z(h, !1);
|
|
855
855
|
if (r.key === "=")
|
|
856
|
-
for (const
|
|
857
|
-
|
|
856
|
+
for (const h of a.children)
|
|
857
|
+
z(h, !0);
|
|
858
858
|
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
|
|
859
|
-
for (const
|
|
860
|
-
|
|
859
|
+
for (const h of a.children)
|
|
860
|
+
z(h, !0, Number(r.key) - 1);
|
|
861
861
|
e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
|
|
862
862
|
}, l = {
|
|
863
863
|
Enter: (r) => {
|
|
@@ -878,31 +878,31 @@ function Mn(e, t) {
|
|
|
878
878
|
else {
|
|
879
879
|
if (r.metaKey || r.ctrlKey)
|
|
880
880
|
return e.initSide();
|
|
881
|
-
|
|
881
|
+
$e(e, "previous");
|
|
882
882
|
}
|
|
883
883
|
},
|
|
884
884
|
ArrowDown: (r) => {
|
|
885
|
-
r.altKey ? e.moveDownNode() :
|
|
885
|
+
r.altKey ? e.moveDownNode() : $e(e, "next");
|
|
886
886
|
},
|
|
887
887
|
ArrowLeft: (r) => {
|
|
888
888
|
if (r.metaKey || r.ctrlKey)
|
|
889
889
|
return e.initLeft();
|
|
890
|
-
|
|
890
|
+
Pe(e, H.LHS);
|
|
891
891
|
},
|
|
892
892
|
ArrowRight: (r) => {
|
|
893
893
|
if (r.metaKey || r.ctrlKey)
|
|
894
894
|
return e.initRight();
|
|
895
|
-
|
|
895
|
+
Pe(e, H.RHS);
|
|
896
896
|
},
|
|
897
897
|
PageUp: () => e.moveUpNode(),
|
|
898
898
|
PageDown: () => {
|
|
899
899
|
e.moveDownNode();
|
|
900
900
|
},
|
|
901
901
|
"=": (r) => {
|
|
902
|
-
(r.metaKey || r.ctrlKey) &&
|
|
902
|
+
(r.metaKey || r.ctrlKey) && He(e, "in");
|
|
903
903
|
},
|
|
904
904
|
"-": (r) => {
|
|
905
|
-
(r.metaKey || r.ctrlKey) &&
|
|
905
|
+
(r.metaKey || r.ctrlKey) && He(e, "out");
|
|
906
906
|
},
|
|
907
907
|
0: (r) => {
|
|
908
908
|
if (r.metaKey || r.ctrlKey) {
|
|
@@ -922,17 +922,17 @@ function Mn(e, t) {
|
|
|
922
922
|
};
|
|
923
923
|
e.container.onkeydown = (r) => {
|
|
924
924
|
if ((r.ctrlKey || r.metaKey) && ["c", "v", "x"].includes(r.key) || r.preventDefault(), !e.editable) return;
|
|
925
|
-
const
|
|
926
|
-
|
|
925
|
+
const h = l[r.key];
|
|
926
|
+
h && h(r);
|
|
927
927
|
};
|
|
928
928
|
const c = (r) => {
|
|
929
929
|
if (r.target instanceof HTMLElement && r.target.id === "input-box" || e.currentNodes.length === 0) return !1;
|
|
930
930
|
if (r.clipboardData) {
|
|
931
|
-
const a =
|
|
932
|
-
magic:
|
|
931
|
+
const a = be(e.currentNodes).map((f) => f.nodeObj), h = Se({
|
|
932
|
+
magic: Oe,
|
|
933
933
|
data: a
|
|
934
934
|
});
|
|
935
|
-
return r.clipboardData.setData("text/plain",
|
|
935
|
+
return r.clipboardData.setData("text/plain", h), r.preventDefault(), !0;
|
|
936
936
|
}
|
|
937
937
|
return !1;
|
|
938
938
|
};
|
|
@@ -942,10 +942,10 @@ function Mn(e, t) {
|
|
|
942
942
|
const a = r.clipboardData?.getData("text/plain");
|
|
943
943
|
if (a)
|
|
944
944
|
try {
|
|
945
|
-
const
|
|
946
|
-
if (
|
|
947
|
-
const
|
|
948
|
-
|
|
945
|
+
const h = JSON.parse(a);
|
|
946
|
+
if (h && h.magic === Oe && Array.isArray(h.data)) {
|
|
947
|
+
const f = h.data, u = f.map((b) => ({ nodeObj: b }));
|
|
948
|
+
f.length > 0 && e.currentNode && (e.copyNodes(u, e.currentNode), r.preventDefault());
|
|
949
949
|
return;
|
|
950
950
|
}
|
|
951
951
|
} catch {
|
|
@@ -953,42 +953,59 @@ function Mn(e, t) {
|
|
|
953
953
|
e.pasteHandler && e.pasteHandler(r);
|
|
954
954
|
});
|
|
955
955
|
}
|
|
956
|
-
function
|
|
957
|
-
const { panHelper: t } = e;
|
|
958
|
-
let
|
|
956
|
+
function An(e) {
|
|
957
|
+
const { panHelper: t, container: n } = e;
|
|
958
|
+
let o = 0, s = null;
|
|
959
959
|
e.spacePressed = !1;
|
|
960
|
-
let
|
|
961
|
-
const
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
960
|
+
let i = null;
|
|
961
|
+
const l = /* @__PURE__ */ new Map(), c = mt(e), r = {
|
|
962
|
+
timer: null,
|
|
963
|
+
startPos: null,
|
|
964
|
+
target: null,
|
|
965
|
+
pointerId: null,
|
|
966
|
+
DURATION: 500,
|
|
967
|
+
MOVE_THRESHOLD: 10,
|
|
968
|
+
clear() {
|
|
969
|
+
this.timer !== null && (clearTimeout(this.timer), this.timer = null, this.startPos = null, this.target = null, this.pointerId = null);
|
|
970
|
+
},
|
|
971
|
+
start(d, y) {
|
|
972
|
+
this.timer = window.setTimeout(() => {
|
|
973
|
+
y(d), this.timer = null, this.startPos = null, this.target = null, this.pointerId = null;
|
|
974
|
+
}, this.DURATION), this.startPos = { x: d.clientX, y: d.clientY }, this.target = d.target, this.pointerId = d.pointerId;
|
|
975
|
+
},
|
|
976
|
+
handleMove(d) {
|
|
977
|
+
if (this.timer !== null && this.startPos !== null && d.pointerId === this.pointerId) {
|
|
978
|
+
const y = d.clientX - this.startPos.x, w = d.clientY - this.startPos.y;
|
|
979
|
+
Math.sqrt(y * y + w * w) > this.MOVE_THRESHOLD && this.clear();
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}, a = (d, y) => {
|
|
983
|
+
d.hasPointerCapture && d.hasPointerCapture(y) && d.releasePointerCapture(y);
|
|
984
|
+
}, h = (d, y) => {
|
|
985
|
+
if (d.id === "input-box" || d.closest("#input-box")) return !1;
|
|
986
|
+
const w = d.closest(".svg-label");
|
|
987
|
+
if (w) {
|
|
988
|
+
const S = w.dataset.svgId, D = w.dataset.type, j = document.getElementById(S);
|
|
989
|
+
if (j) {
|
|
990
|
+
if (D === "arrow")
|
|
991
|
+
return y ? e.editArrowLabel(j) : e.selectArrow(j), !0;
|
|
992
|
+
if (D === "summary")
|
|
993
|
+
return y ? e.editSummary(j) : e.selectSummary(j), !0;
|
|
977
994
|
}
|
|
978
995
|
}
|
|
979
|
-
if (
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
982
|
-
return
|
|
996
|
+
if (d.closest(".topiclinks")) {
|
|
997
|
+
const S = d.closest("g");
|
|
998
|
+
if (S)
|
|
999
|
+
return y ? e.editArrowLabel(S) : e.selectArrow(S), !0;
|
|
983
1000
|
}
|
|
984
|
-
if (
|
|
985
|
-
const
|
|
986
|
-
if (
|
|
987
|
-
return
|
|
1001
|
+
if (d.closest(".summary")) {
|
|
1002
|
+
const S = d.closest("g");
|
|
1003
|
+
if (S)
|
|
1004
|
+
return y ? e.editSummary(S) : e.selectSummary(S), !0;
|
|
988
1005
|
}
|
|
989
1006
|
return !1;
|
|
990
|
-
},
|
|
991
|
-
if (
|
|
1007
|
+
}, f = (d) => {
|
|
1008
|
+
if (d.pointerType === "mouse" && d.button !== 0) return;
|
|
992
1009
|
if (e.helper1?.moved) {
|
|
993
1010
|
e.helper1.clear();
|
|
994
1011
|
return;
|
|
@@ -1001,125 +1018,119 @@ function Pn(e) {
|
|
|
1001
1018
|
t.clear();
|
|
1002
1019
|
return;
|
|
1003
1020
|
}
|
|
1004
|
-
if (
|
|
1021
|
+
if (c?.isDragging)
|
|
1005
1022
|
return;
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1008
|
-
|
|
1023
|
+
const y = d.target;
|
|
1024
|
+
if (y.tagName === "ME-EPD")
|
|
1025
|
+
d.ctrlKey || d.metaKey ? e.expandNodeAll(y.previousSibling) : e.expandNode(y.previousSibling);
|
|
1009
1026
|
else if (!e.editable)
|
|
1010
1027
|
return;
|
|
1011
|
-
|
|
1012
|
-
},
|
|
1028
|
+
h(y, !1);
|
|
1029
|
+
}, u = (d) => {
|
|
1013
1030
|
if (!e.editable) return;
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
},
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
}, k = (f) => {
|
|
1021
|
-
if (f.pointerType === "touch" && (i.set(f.pointerId, { x: f.clientX, y: f.clientY }), i.size === 2)) {
|
|
1022
|
-
const [D, Z] = Array.from(i.values());
|
|
1023
|
-
s = Me(D, Z), y();
|
|
1031
|
+
const y = d.target;
|
|
1032
|
+
V(y) && e.beginEdit(y), h(y, !0);
|
|
1033
|
+
}, b = (d) => {
|
|
1034
|
+
if (d.pointerType === "touch" && (l.set(d.pointerId, { x: d.clientX, y: d.clientY }), l.size === 2)) {
|
|
1035
|
+
const [S, D] = Array.from(l.values());
|
|
1036
|
+
i = De(S, D), r.clear();
|
|
1024
1037
|
}
|
|
1025
1038
|
t.moved = !1;
|
|
1026
|
-
const
|
|
1027
|
-
if (e.editable && (
|
|
1039
|
+
const y = d.target, w = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
1040
|
+
if (e.editable && (d.button === 0 || d.pointerType === "touch") && V(y)) {
|
|
1028
1041
|
e.selection?.cancel();
|
|
1029
|
-
const
|
|
1030
|
-
if (
|
|
1031
|
-
if (
|
|
1032
|
-
e.selection?.deselect(
|
|
1042
|
+
const S = e.currentNodes || [];
|
|
1043
|
+
if (d.ctrlKey || d.metaKey)
|
|
1044
|
+
if (S.includes(y)) {
|
|
1045
|
+
e.selection?.deselect(y);
|
|
1033
1046
|
return;
|
|
1034
1047
|
} else
|
|
1035
|
-
e.selection?.select(
|
|
1036
|
-
else
|
|
1048
|
+
e.selection?.select(y);
|
|
1049
|
+
else S.includes(y) || e.selectNode(y);
|
|
1037
1050
|
}
|
|
1038
|
-
if (e.editable && (
|
|
1039
|
-
if (
|
|
1040
|
-
(
|
|
1041
|
-
else if (
|
|
1042
|
-
(
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1045
|
-
else if (
|
|
1046
|
-
|
|
1051
|
+
if (e.editable && (d.button === 0 || d.pointerType === "touch")) {
|
|
1052
|
+
if (d.pointerType === "touch" && l.size > 1)
|
|
1053
|
+
(c.isDragging || c.pointerId !== null) && ae(e, c);
|
|
1054
|
+
else if (d.pointerType === "touch" && l.size === 1)
|
|
1055
|
+
(V(y) || y.closest("me-tpc")) && r.start(d, (S) => {
|
|
1056
|
+
Me(e, c, S, !0) && (r.target && r.target.setPointerCapture(S.pointerId), Ue(c.ghost, S.clientX, S.clientY));
|
|
1057
|
+
});
|
|
1058
|
+
else if (d.pointerType === "mouse" && Me(e, c, d, !1)) {
|
|
1059
|
+
y.setPointerCapture(d.pointerId);
|
|
1047
1060
|
return;
|
|
1048
1061
|
}
|
|
1049
1062
|
}
|
|
1050
|
-
const
|
|
1051
|
-
!
|
|
1052
|
-
},
|
|
1053
|
-
if (
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
const Y = P / s;
|
|
1065
|
-
e.scale(e.scaleVal * Y, {
|
|
1066
|
-
x: (x.x + T.x) / 2,
|
|
1067
|
-
y: (x.y + T.y) / 2
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
s = P;
|
|
1063
|
+
const N = e.spacePressed && d.button === 0 && d.pointerType === "mouse", M = !e.editable || d.button === w && d.pointerType === "mouse" || d.pointerType === "touch";
|
|
1064
|
+
!N && !M || (t.x = d.clientX, t.y = d.clientY, y.className !== "circle" && y.contentEditable !== "plaintext-only" && (t.mousedown = !0, y.setPointerCapture(d.pointerId)));
|
|
1065
|
+
}, v = (d) => {
|
|
1066
|
+
if (d.pointerType === "touch" && l.has(d.pointerId) && (l.set(d.pointerId, { x: d.clientX, y: d.clientY }), r.handleMove(d), l.size >= 2)) {
|
|
1067
|
+
const [y, w] = Array.from(l.values()), N = De(y, w);
|
|
1068
|
+
if (i == null)
|
|
1069
|
+
i = N;
|
|
1070
|
+
else {
|
|
1071
|
+
if (i > 0) {
|
|
1072
|
+
const M = N / i;
|
|
1073
|
+
e.scale(e.scaleVal * M, {
|
|
1074
|
+
x: (y.x + w.x) / 2,
|
|
1075
|
+
y: (y.y + w.y) / 2
|
|
1076
|
+
});
|
|
1071
1077
|
}
|
|
1072
|
-
|
|
1078
|
+
i = N;
|
|
1073
1079
|
}
|
|
1080
|
+
return;
|
|
1074
1081
|
}
|
|
1075
|
-
if (!(
|
|
1076
|
-
if (
|
|
1077
|
-
const
|
|
1078
|
-
t.onMove(
|
|
1082
|
+
if (!(c && c.pointerId !== null && (bt(e, c, d), c.isDragging))) {
|
|
1083
|
+
if (d.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
|
|
1084
|
+
const y = d.clientX - t.x, w = d.clientY - t.y;
|
|
1085
|
+
t.onMove(y, w);
|
|
1079
1086
|
}
|
|
1080
|
-
t.x =
|
|
1087
|
+
t.x = d.clientX, t.y = d.clientY;
|
|
1081
1088
|
}
|
|
1082
|
-
},
|
|
1083
|
-
if (
|
|
1084
|
-
const
|
|
1085
|
-
if (
|
|
1089
|
+
}, p = (d) => {
|
|
1090
|
+
if (d.pointerType === "touch" && (l.delete(d.pointerId), l.size < 2 && (i = null), r.clear()), c && c.pointerId !== null) {
|
|
1091
|
+
const w = c.isDragging;
|
|
1092
|
+
if (vt(e, c, d), a(d.target, d.pointerId), w)
|
|
1086
1093
|
return;
|
|
1087
1094
|
}
|
|
1088
|
-
if (
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1095
|
+
if (d.pointerType === "touch" && l.size === 0 && !t.moved) {
|
|
1096
|
+
const w = (/* @__PURE__ */ new Date()).getTime(), N = w - o;
|
|
1097
|
+
N < 300 && N > 0 && s === d.target && u(d), o = w, s = d.target;
|
|
1091
1098
|
}
|
|
1092
|
-
t.mousedown && (
|
|
1093
|
-
},
|
|
1094
|
-
|
|
1095
|
-
},
|
|
1096
|
-
|
|
1097
|
-
},
|
|
1098
|
-
if (
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1101
|
-
e.panHelper.moved || e.bus.fire("showContextMenu",
|
|
1099
|
+
t.mousedown && (a(d.target, d.pointerId), t.clear());
|
|
1100
|
+
}, g = () => {
|
|
1101
|
+
r.clear(), t.mousedown && t.clear(), (c.isDragging || c.pointerId !== null) && ae(e, c);
|
|
1102
|
+
}, m = (d) => {
|
|
1103
|
+
d.pointerType === "touch" && (l.delete(d.pointerId), l.size < 2 && (i = null), r.clear()), c.pointerId === d.pointerId && ae(e, c), p(d);
|
|
1104
|
+
}, x = (d) => {
|
|
1105
|
+
if (d.preventDefault(), d.button !== 2 || !e.editable) return;
|
|
1106
|
+
const y = d.target;
|
|
1107
|
+
V(y) && !y.classList.contains("selected") && e.selectNode(y), setTimeout(() => {
|
|
1108
|
+
e.panHelper.moved || e.bus.fire("showContextMenu", d);
|
|
1102
1109
|
}, 200);
|
|
1103
|
-
},
|
|
1104
|
-
if (
|
|
1105
|
-
if (
|
|
1106
|
-
e.move(-
|
|
1107
|
-
},
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
{ dom:
|
|
1114
|
-
{ dom:
|
|
1115
|
-
{ dom:
|
|
1116
|
-
{ dom:
|
|
1117
|
-
{ dom:
|
|
1118
|
-
{ dom:
|
|
1119
|
-
{ dom:
|
|
1110
|
+
}, E = (d) => {
|
|
1111
|
+
if (d.stopPropagation(), d.preventDefault(), d.ctrlKey || d.metaKey) return Ln(e, d);
|
|
1112
|
+
if (d.shiftKey) return e.move(-d.deltaY, 0);
|
|
1113
|
+
e.move(-d.deltaX, -d.deltaY);
|
|
1114
|
+
}, k = (d) => {
|
|
1115
|
+
d.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"));
|
|
1116
|
+
}, T = (d) => {
|
|
1117
|
+
d.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
1118
|
+
};
|
|
1119
|
+
return qe([
|
|
1120
|
+
{ dom: n, evt: "pointerdown", func: b },
|
|
1121
|
+
{ dom: n, evt: "pointermove", func: v },
|
|
1122
|
+
{ dom: n, evt: "pointerup", func: p },
|
|
1123
|
+
{ dom: n, evt: "pointercancel", func: m },
|
|
1124
|
+
{ dom: n, evt: "click", func: f },
|
|
1125
|
+
{ dom: n, evt: "dblclick", func: u },
|
|
1126
|
+
{ dom: n, evt: "contextmenu", func: x },
|
|
1127
|
+
{ dom: n, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : E },
|
|
1128
|
+
{ dom: n, evt: "blur", func: g },
|
|
1129
|
+
{ dom: n, evt: "keydown", func: k },
|
|
1130
|
+
{ dom: n, evt: "keyup", func: T }
|
|
1120
1131
|
]);
|
|
1121
1132
|
}
|
|
1122
|
-
function
|
|
1133
|
+
function Mn() {
|
|
1123
1134
|
return {
|
|
1124
1135
|
handlers: {},
|
|
1125
1136
|
addListener: function(e, t) {
|
|
@@ -1143,31 +1154,31 @@ function On() {
|
|
|
1143
1154
|
}
|
|
1144
1155
|
};
|
|
1145
1156
|
}
|
|
1146
|
-
const
|
|
1157
|
+
const O = "http://www.w3.org/2000/svg", le = function(e) {
|
|
1147
1158
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
1148
1159
|
let c = s;
|
|
1149
1160
|
l === "middle" ? c = s - t / 2 : l === "end" && (c = s - t), e.style.left = `${c}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
|
|
1150
|
-
},
|
|
1161
|
+
}, fe = function(e, t, n, o) {
|
|
1151
1162
|
const { anchor: s = "middle", color: i, dataType: l, svgId: c } = o, r = document.createElement("div");
|
|
1152
1163
|
r.className = "svg-label", r.style.color = i || "#666";
|
|
1153
1164
|
const a = "label-" + c;
|
|
1154
1165
|
return r.id = a, r.innerHTML = e, r.dataset.type = l, r.dataset.svgId = c, r.dataset.x = t.toString(), r.dataset.y = n.toString(), r.dataset.anchor = s, r;
|
|
1155
|
-
},
|
|
1156
|
-
const o = document.createElementNS(
|
|
1157
|
-
return
|
|
1166
|
+
}, it = function(e, t, n) {
|
|
1167
|
+
const o = document.createElementNS(O, "path");
|
|
1168
|
+
return _(o, {
|
|
1158
1169
|
d: e,
|
|
1159
1170
|
stroke: t || "#666",
|
|
1160
1171
|
fill: "none",
|
|
1161
1172
|
"stroke-width": n
|
|
1162
1173
|
}), o;
|
|
1163
|
-
},
|
|
1164
|
-
const t = document.createElementNS(
|
|
1174
|
+
}, q = function(e) {
|
|
1175
|
+
const t = document.createElementNS(O, "svg");
|
|
1165
1176
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
1166
|
-
},
|
|
1167
|
-
const e = document.createElementNS(
|
|
1177
|
+
}, je = function() {
|
|
1178
|
+
const e = document.createElementNS(O, "line");
|
|
1168
1179
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
1169
|
-
},
|
|
1170
|
-
const s = document.createElementNS(
|
|
1180
|
+
}, On = function(e, t, n, o) {
|
|
1181
|
+
const s = document.createElementNS(O, "g");
|
|
1171
1182
|
return [
|
|
1172
1183
|
{
|
|
1173
1184
|
name: "line",
|
|
@@ -1182,30 +1193,30 @@ const H = "http://www.w3.org/2000/svg", he = function(e) {
|
|
|
1182
1193
|
d: n
|
|
1183
1194
|
}
|
|
1184
1195
|
].forEach((l, c) => {
|
|
1185
|
-
const r = l.d, a = document.createElementNS(
|
|
1196
|
+
const r = l.d, a = document.createElementNS(O, "path"), h = {
|
|
1186
1197
|
d: r,
|
|
1187
1198
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
1188
1199
|
fill: "none",
|
|
1189
1200
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
1190
1201
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
1191
1202
|
};
|
|
1192
|
-
o?.opacity !== void 0 && (
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1203
|
+
o?.opacity !== void 0 && (h.opacity = String(o.opacity)), _(a, h), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
1204
|
+
const f = document.createElementNS(O, "path");
|
|
1205
|
+
_(f, {
|
|
1195
1206
|
d: r,
|
|
1196
1207
|
stroke: "transparent",
|
|
1197
1208
|
fill: "none",
|
|
1198
1209
|
"stroke-width": "15"
|
|
1199
|
-
}), s.appendChild(
|
|
1210
|
+
}), s.appendChild(f), s.appendChild(a), s[l.name] = a;
|
|
1200
1211
|
}), s;
|
|
1201
|
-
},
|
|
1212
|
+
}, rt = function(e, t, n) {
|
|
1202
1213
|
if (!t) return;
|
|
1203
1214
|
const o = n.label, s = t.cloneNode(!0);
|
|
1204
1215
|
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
1205
1216
|
left:${t.style.left};
|
|
1206
1217
|
top:${t.style.top};
|
|
1207
1218
|
max-width: 200px;
|
|
1208
|
-
`,
|
|
1219
|
+
`, Qe(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
1209
1220
|
i.stopPropagation();
|
|
1210
1221
|
const l = i.key;
|
|
1211
1222
|
if (l === "Enter" || l === "Tab") {
|
|
@@ -1215,7 +1226,7 @@ const H = "http://www.w3.org/2000/svg", he = function(e) {
|
|
|
1215
1226
|
}), s.addEventListener("blur", () => {
|
|
1216
1227
|
if (!s) return;
|
|
1217
1228
|
const i = s.innerText?.trim() || "";
|
|
1218
|
-
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label,
|
|
1229
|
+
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label, le(t), "parent" in n ? e.bus.fire("operation", {
|
|
1219
1230
|
name: "finishEditSummary",
|
|
1220
1231
|
obj: n
|
|
1221
1232
|
}) : e.bus.fire("operation", {
|
|
@@ -1223,32 +1234,32 @@ const H = "http://www.w3.org/2000/svg", he = function(e) {
|
|
|
1223
1234
|
obj: n
|
|
1224
1235
|
}));
|
|
1225
1236
|
});
|
|
1226
|
-
},
|
|
1237
|
+
}, Pn = function(e) {
|
|
1227
1238
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
|
|
1228
1239
|
this.lines.innerHTML = "";
|
|
1229
1240
|
for (let c = 0; c < l.length; c++) {
|
|
1230
|
-
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft:
|
|
1231
|
-
if (a.style.borderColor = m, this.lines.appendChild(
|
|
1241
|
+
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: h, offsetTop: f } = A(this.nodes, a), u = a.offsetWidth, b = a.offsetHeight, v = r.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: f, cL: h, cW: u, cH: b, direction: v, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[c % g.length];
|
|
1242
|
+
if (a.style.borderColor = m, this.lines.appendChild(it(p, m, "3")), e && e !== r)
|
|
1232
1243
|
continue;
|
|
1233
|
-
const
|
|
1234
|
-
E.tagName === "svg" && E.remove(), r.appendChild(
|
|
1244
|
+
const x = q("subLines"), E = r.lastChild;
|
|
1245
|
+
E.tagName === "svg" && E.remove(), r.appendChild(x), lt(this, x, m, r, v, !0);
|
|
1235
1246
|
}
|
|
1236
1247
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
1237
|
-
},
|
|
1248
|
+
}, lt = function(e, t, n, o, s, i) {
|
|
1238
1249
|
const l = o.firstChild, c = o.children[1].children;
|
|
1239
1250
|
if (c.length === 0) return;
|
|
1240
|
-
const r = l.offsetTop, a = l.offsetLeft,
|
|
1251
|
+
const r = l.offsetTop, a = l.offsetLeft, h = l.offsetWidth, f = l.offsetHeight;
|
|
1241
1252
|
for (let u = 0; u < c.length; u++) {
|
|
1242
|
-
const
|
|
1243
|
-
t.appendChild(
|
|
1244
|
-
const
|
|
1245
|
-
if (
|
|
1246
|
-
if (!
|
|
1253
|
+
const b = c[u], v = b.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, x = v.offsetHeight, E = v.firstChild.nodeObj.branchColor || n, k = e.generateSubBranch({ pT: r, pL: a, pW: h, pH: f, cT: p, cL: g, cW: m, cH: x, direction: s, isFirst: i });
|
|
1254
|
+
t.appendChild(it(k, E, "2"));
|
|
1255
|
+
const T = v.children[1];
|
|
1256
|
+
if (T) {
|
|
1257
|
+
if (!T.expanded) continue;
|
|
1247
1258
|
} else
|
|
1248
1259
|
continue;
|
|
1249
|
-
|
|
1260
|
+
lt(e, t, E, b, s);
|
|
1250
1261
|
}
|
|
1251
|
-
},
|
|
1262
|
+
}, $n = {
|
|
1252
1263
|
addChild: "Add child",
|
|
1253
1264
|
addParent: "Add parent",
|
|
1254
1265
|
addSibling: "Add sibling",
|
|
@@ -1262,79 +1273,79 @@ const H = "http://www.w3.org/2000/svg", he = function(e) {
|
|
|
1262
1273
|
clickTips: "Please click the target node",
|
|
1263
1274
|
summary: "Summary"
|
|
1264
1275
|
};
|
|
1265
|
-
function
|
|
1276
|
+
function Hn(e, t) {
|
|
1266
1277
|
const n = {
|
|
1267
1278
|
focus: !0,
|
|
1268
1279
|
link: !0,
|
|
1269
|
-
locale:
|
|
1280
|
+
locale: $n
|
|
1270
1281
|
};
|
|
1271
1282
|
t = t === !0 ? n : Object.assign(n, t);
|
|
1272
1283
|
const o = (C) => {
|
|
1273
|
-
const
|
|
1274
|
-
return
|
|
1275
|
-
}, s = (C,
|
|
1276
|
-
const
|
|
1277
|
-
return
|
|
1278
|
-
}, i = t.locale, l = s("cm-add_child", i.addChild, "Tab"), c = s("cm-add_parent", i.addParent, "Ctrl + Enter"), r = s("cm-add_sibling", i.addSibling, "Enter"), a = s("cm-remove_child", i.removeNode, "Delete"),
|
|
1279
|
-
if (m.className = "menu-list", m.appendChild(l), m.appendChild(c), m.appendChild(r), m.appendChild(a), t.focus && (m.appendChild(
|
|
1284
|
+
const d = document.createElement("div");
|
|
1285
|
+
return d.innerText = C, d.className = "tips", d;
|
|
1286
|
+
}, s = (C, d, y) => {
|
|
1287
|
+
const w = document.createElement("li");
|
|
1288
|
+
return w.id = C, w.innerHTML = `<span>${he(d)}</span><span ${y ? 'class="key"' : ""}>${he(y)}</span>`, w;
|
|
1289
|
+
}, i = t.locale, l = s("cm-add_child", i.addChild, "Tab"), c = s("cm-add_parent", i.addParent, "Ctrl + Enter"), r = s("cm-add_sibling", i.addSibling, "Enter"), a = s("cm-remove_child", i.removeNode, "Delete"), h = s("cm-fucus", i.focus, ""), f = s("cm-unfucus", i.cancelFocus, ""), u = s("cm-up", i.moveUp, "PgUp"), b = s("cm-down", i.moveDown, "Pgdn"), v = s("cm-link", i.link, ""), p = s("cm-link-bidirectional", i.linkBidirectional, ""), g = s("cm-summary", i.summary, ""), m = document.createElement("ul");
|
|
1290
|
+
if (m.className = "menu-list", m.appendChild(l), m.appendChild(c), m.appendChild(r), m.appendChild(a), t.focus && (m.appendChild(h), m.appendChild(f)), m.appendChild(u), m.appendChild(b), m.appendChild(g), t.link && (m.appendChild(v), m.appendChild(p)), t && t.extend)
|
|
1280
1291
|
for (let C = 0; C < t.extend.length; C++) {
|
|
1281
|
-
const
|
|
1282
|
-
m.appendChild(
|
|
1283
|
-
|
|
1292
|
+
const d = t.extend[C], y = s(d.name, d.name, d.key || "");
|
|
1293
|
+
m.appendChild(y), y.onclick = (w) => {
|
|
1294
|
+
d.onclick(w);
|
|
1284
1295
|
};
|
|
1285
1296
|
}
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1297
|
+
const x = document.createElement("div");
|
|
1298
|
+
x.className = "context-menu", x.appendChild(m), x.hidden = !0, e.container.append(x);
|
|
1288
1299
|
let E = !0;
|
|
1289
1300
|
const k = (C) => {
|
|
1290
|
-
const
|
|
1291
|
-
if (
|
|
1292
|
-
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1301
|
+
const d = C.target;
|
|
1302
|
+
if (V(d)) {
|
|
1303
|
+
d.parentElement.tagName === "ME-ROOT" ? E = !0 : E = !1, E ? (h.className = "disabled", u.className = "disabled", b.className = "disabled", c.className = "disabled", r.className = "disabled", a.className = "disabled") : (h.className = "", u.className = "", b.className = "", c.className = "", r.className = "", a.className = ""), x.hidden = !1, m.style.top = "", m.style.bottom = "", m.style.left = "", m.style.right = "";
|
|
1304
|
+
const y = m.offsetHeight, w = m.offsetWidth, N = m.getBoundingClientRect(), M = C.clientY - N.top, S = C.clientX - N.left;
|
|
1305
|
+
y + M > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = M + 15 + "px"), w + S > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = S + 10 + "px");
|
|
1295
1306
|
}
|
|
1296
1307
|
};
|
|
1297
|
-
e.bus.addListener("showContextMenu", k),
|
|
1298
|
-
C.target ===
|
|
1308
|
+
e.bus.addListener("showContextMenu", k), x.onclick = (C) => {
|
|
1309
|
+
C.target === x && (x.hidden = !0);
|
|
1299
1310
|
}, l.onclick = () => {
|
|
1300
|
-
e.addChild(),
|
|
1311
|
+
e.addChild(), x.hidden = !0;
|
|
1301
1312
|
}, c.onclick = () => {
|
|
1302
|
-
e.insertParent(),
|
|
1313
|
+
e.insertParent(), x.hidden = !0;
|
|
1303
1314
|
}, r.onclick = () => {
|
|
1304
|
-
E || (e.insertSibling("after"),
|
|
1315
|
+
E || (e.insertSibling("after"), x.hidden = !0);
|
|
1305
1316
|
}, a.onclick = () => {
|
|
1306
|
-
E || (e.removeNodes(e.currentNodes || []),
|
|
1307
|
-
}, d.onclick = () => {
|
|
1308
|
-
E || (e.focusNode(e.currentNode), v.hidden = !0);
|
|
1317
|
+
E || (e.removeNodes(e.currentNodes || []), x.hidden = !0);
|
|
1309
1318
|
}, h.onclick = () => {
|
|
1310
|
-
e.
|
|
1319
|
+
E || (e.focusNode(e.currentNode), x.hidden = !0);
|
|
1320
|
+
}, f.onclick = () => {
|
|
1321
|
+
e.cancelFocus(), x.hidden = !0;
|
|
1311
1322
|
}, u.onclick = () => {
|
|
1312
|
-
E || (e.moveUpNode(),
|
|
1313
|
-
},
|
|
1314
|
-
E || (e.moveDownNode(),
|
|
1323
|
+
E || (e.moveUpNode(), x.hidden = !0);
|
|
1324
|
+
}, b.onclick = () => {
|
|
1325
|
+
E || (e.moveDownNode(), x.hidden = !0);
|
|
1315
1326
|
};
|
|
1316
|
-
const
|
|
1317
|
-
|
|
1318
|
-
const
|
|
1319
|
-
e.container.appendChild(
|
|
1327
|
+
const T = (C) => {
|
|
1328
|
+
x.hidden = !0;
|
|
1329
|
+
const d = e.currentNode, y = o(i.clickTips);
|
|
1330
|
+
e.container.appendChild(y), e.map.addEventListener(
|
|
1320
1331
|
"click",
|
|
1321
|
-
(
|
|
1322
|
-
|
|
1323
|
-
const
|
|
1324
|
-
(
|
|
1332
|
+
(w) => {
|
|
1333
|
+
w.preventDefault(), y.remove();
|
|
1334
|
+
const N = w.target;
|
|
1335
|
+
(N.parentElement.tagName === "ME-PARENT" || N.parentElement.tagName === "ME-ROOT") && e.createArrow(d, N, C);
|
|
1325
1336
|
},
|
|
1326
1337
|
{
|
|
1327
1338
|
once: !0
|
|
1328
1339
|
}
|
|
1329
1340
|
);
|
|
1330
1341
|
};
|
|
1331
|
-
return
|
|
1332
|
-
|
|
1342
|
+
return v.onclick = () => T(), p.onclick = () => T({ bidirectional: !0 }), g.onclick = () => {
|
|
1343
|
+
x.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
1333
1344
|
}, () => {
|
|
1334
|
-
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null,
|
|
1345
|
+
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, h.onclick = null, f.onclick = null, u.onclick = null, b.onclick = null, v.onclick = null, g.onclick = null, x.onclick = null, e.container.oncontextmenu = null;
|
|
1335
1346
|
};
|
|
1336
1347
|
}
|
|
1337
|
-
const
|
|
1348
|
+
const jn = function(e) {
|
|
1338
1349
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
1339
1350
|
type: "summary",
|
|
1340
1351
|
value: e.obj.id
|
|
@@ -1349,7 +1360,7 @@ const Rn = function(e) {
|
|
|
1349
1360
|
value: [e.obj.id]
|
|
1350
1361
|
};
|
|
1351
1362
|
};
|
|
1352
|
-
function
|
|
1363
|
+
function In(e) {
|
|
1353
1364
|
let t = [], n = -1, o = e.getData(), s = [];
|
|
1354
1365
|
e.undo = function() {
|
|
1355
1366
|
if (n > -1) {
|
|
@@ -1378,14 +1389,14 @@ function Bn(e) {
|
|
|
1378
1389
|
const i = function(r) {
|
|
1379
1390
|
if (r.name === "beginEdit") return;
|
|
1380
1391
|
t = t.slice(0, n + 1);
|
|
1381
|
-
const a = e.getData(),
|
|
1392
|
+
const a = e.getData(), h = {
|
|
1382
1393
|
prev: o,
|
|
1383
1394
|
operation: r.name,
|
|
1384
|
-
currentSelected: s.map((
|
|
1385
|
-
currentTarget:
|
|
1395
|
+
currentSelected: s.map((f) => f.id),
|
|
1396
|
+
currentTarget: jn(r),
|
|
1386
1397
|
next: a
|
|
1387
1398
|
};
|
|
1388
|
-
t.push(
|
|
1399
|
+
t.push(h), o = a, n = t.length - 1;
|
|
1389
1400
|
}, l = function(r) {
|
|
1390
1401
|
(r.metaKey || r.ctrlKey) && (r.shiftKey && r.key === "Z" || r.key === "y") ? e.redo() : (r.metaKey || r.ctrlKey) && r.key === "z" && e.undo();
|
|
1391
1402
|
}, c = function() {
|
|
@@ -1395,34 +1406,34 @@ function Bn(e) {
|
|
|
1395
1406
|
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", c), e.container.removeEventListener("keydown", l);
|
|
1396
1407
|
};
|
|
1397
1408
|
}
|
|
1398
|
-
const
|
|
1399
|
-
side:
|
|
1400
|
-
left:
|
|
1401
|
-
right:
|
|
1402
|
-
full:
|
|
1403
|
-
living:
|
|
1404
|
-
zoomin:
|
|
1405
|
-
zoomout:
|
|
1406
|
-
},
|
|
1409
|
+
const Rn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>', Bn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>', Wn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>', Yn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>', Xn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>', Fn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>', Gn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>', zn = {
|
|
1410
|
+
side: Rn,
|
|
1411
|
+
left: Bn,
|
|
1412
|
+
right: Wn,
|
|
1413
|
+
full: Yn,
|
|
1414
|
+
living: Xn,
|
|
1415
|
+
zoomin: Fn,
|
|
1416
|
+
zoomout: Gn
|
|
1417
|
+
}, B = (e, t) => {
|
|
1407
1418
|
const n = document.createElement("span");
|
|
1408
|
-
return n.id = e, n.innerHTML =
|
|
1419
|
+
return n.id = e, n.innerHTML = zn[t], n;
|
|
1409
1420
|
};
|
|
1410
|
-
function
|
|
1411
|
-
const t = document.createElement("div"), n =
|
|
1421
|
+
function Kn(e) {
|
|
1422
|
+
const t = document.createElement("div"), n = B("fullscreen", "full"), o = B("toCenter", "living"), s = B("zoomout", "zoomout"), i = B("zoomin", "zoomin");
|
|
1412
1423
|
t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
|
|
1413
1424
|
let l = null;
|
|
1414
1425
|
const c = () => {
|
|
1415
|
-
const a = e.container.getBoundingClientRect(),
|
|
1426
|
+
const a = e.container.getBoundingClientRect(), h = ve(e.map.style.transform), f = a.width / 2, u = a.height / 2, b = (f - h.x) / e.scaleVal, v = (u - h.y) / e.scaleVal;
|
|
1416
1427
|
l = {
|
|
1417
1428
|
containerRect: a,
|
|
1418
|
-
currentTransform:
|
|
1419
|
-
mapCenterX:
|
|
1420
|
-
mapCenterY:
|
|
1429
|
+
currentTransform: h,
|
|
1430
|
+
mapCenterX: b,
|
|
1431
|
+
mapCenterY: v
|
|
1421
1432
|
};
|
|
1422
1433
|
}, r = () => {
|
|
1423
1434
|
if (l) {
|
|
1424
|
-
const a = e.container.getBoundingClientRect(),
|
|
1425
|
-
e.move(
|
|
1435
|
+
const a = e.container.getBoundingClientRect(), h = a.width / 2, f = a.height / 2, u = h - l.mapCenterX * e.scaleVal, b = f - l.mapCenterY * e.scaleVal, v = u - l.currentTransform.x, p = b - l.currentTransform.y;
|
|
1436
|
+
e.move(v, p);
|
|
1426
1437
|
}
|
|
1427
1438
|
};
|
|
1428
1439
|
return e.el.addEventListener("fullscreenchange", r), n.onclick = () => {
|
|
@@ -1435,8 +1446,8 @@ function qn(e) {
|
|
|
1435
1446
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1436
1447
|
}, t;
|
|
1437
1448
|
}
|
|
1438
|
-
function
|
|
1439
|
-
const t = document.createElement("div"), n =
|
|
1449
|
+
function Vn(e) {
|
|
1450
|
+
const t = document.createElement("div"), n = B("tbltl", "left"), o = B("tbltr", "right"), s = B("tblts", "side");
|
|
1440
1451
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1441
1452
|
e.initLeft();
|
|
1442
1453
|
}, o.onclick = () => {
|
|
@@ -1445,10 +1456,10 @@ function Un(e) {
|
|
|
1445
1456
|
e.initSide();
|
|
1446
1457
|
}, t;
|
|
1447
1458
|
}
|
|
1448
|
-
function
|
|
1449
|
-
e.container.append(
|
|
1459
|
+
function qn(e) {
|
|
1460
|
+
e.container.append(Kn(e)), e.container.append(Vn(e));
|
|
1450
1461
|
}
|
|
1451
|
-
class
|
|
1462
|
+
class Un {
|
|
1452
1463
|
_listeners = /* @__PURE__ */ new Map();
|
|
1453
1464
|
addEventListener(t, n) {
|
|
1454
1465
|
const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
@@ -1471,15 +1482,15 @@ class Zn {
|
|
|
1471
1482
|
off = this.removeEventListener;
|
|
1472
1483
|
emit = this.dispatchEvent;
|
|
1473
1484
|
}
|
|
1474
|
-
const
|
|
1485
|
+
const Ie = (e, t = "px") => typeof e == "number" ? e + t : e, I = ({ style: e }, t, n) => {
|
|
1475
1486
|
if (typeof t == "object")
|
|
1476
1487
|
for (const [o, s] of Object.entries(t))
|
|
1477
|
-
s !== void 0 && (e[o] =
|
|
1478
|
-
else n !== void 0 && (e[t] =
|
|
1479
|
-
},
|
|
1488
|
+
s !== void 0 && (e[o] = Ie(s));
|
|
1489
|
+
else n !== void 0 && (e[t] = Ie(n));
|
|
1490
|
+
}, Re = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1480
1491
|
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1481
1492
|
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1482
|
-
},
|
|
1493
|
+
}, Jn = (e) => {
|
|
1483
1494
|
let t, n = -1, o = !1;
|
|
1484
1495
|
return {
|
|
1485
1496
|
next: (...s) => {
|
|
@@ -1491,7 +1502,7 @@ const Be = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1491
1502
|
cancelAnimationFrame(n), o = !1;
|
|
1492
1503
|
}
|
|
1493
1504
|
};
|
|
1494
|
-
},
|
|
1505
|
+
}, Be = (e, t, n = "touch") => {
|
|
1495
1506
|
switch (n) {
|
|
1496
1507
|
case "center": {
|
|
1497
1508
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -1502,16 +1513,16 @@ const Be = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1502
1513
|
case "touch":
|
|
1503
1514
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1504
1515
|
}
|
|
1505
|
-
},
|
|
1506
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1516
|
+
}, Zn = () => matchMedia("(hover: none), (pointer: coarse)").matches, Qn = () => "safari" in window, ue = (e) => Array.isArray(e) ? e : [e], ct = (e) => (t, n, o, s = {}) => {
|
|
1517
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = ue(n), t = ue(t);
|
|
1507
1518
|
for (const i of t)
|
|
1508
1519
|
if (i)
|
|
1509
1520
|
for (const l of n)
|
|
1510
1521
|
i[e](l, o, { capture: !1, ...s });
|
|
1511
|
-
},
|
|
1522
|
+
}, X = ct("addEventListener"), $ = ct("removeEventListener"), Q = (e) => {
|
|
1512
1523
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1513
1524
|
return { x: t, y: n, target: o };
|
|
1514
|
-
},
|
|
1525
|
+
}, F = (e, t = document) => ue(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), eo = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1515
1526
|
switch (o) {
|
|
1516
1527
|
case "alt":
|
|
1517
1528
|
return e.altKey;
|
|
@@ -1520,18 +1531,18 @@ const Be = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1520
1531
|
case "shift":
|
|
1521
1532
|
return e.shiftKey;
|
|
1522
1533
|
}
|
|
1523
|
-
}) : !1), { abs:
|
|
1534
|
+
}) : !1), { abs: R, max: We, min: Ye, ceil: Xe } = Math, Fe = (e = []) => ({
|
|
1524
1535
|
stored: e,
|
|
1525
1536
|
selected: [],
|
|
1526
1537
|
touched: [],
|
|
1527
1538
|
changed: { added: [], removed: [] }
|
|
1528
1539
|
});
|
|
1529
|
-
class
|
|
1540
|
+
class to extends Un {
|
|
1530
1541
|
static version = "mind-elixir-fork";
|
|
1531
1542
|
// Options
|
|
1532
1543
|
_options;
|
|
1533
1544
|
// Selection store
|
|
1534
|
-
_selection =
|
|
1545
|
+
_selection = Fe();
|
|
1535
1546
|
// Area element and clipping element
|
|
1536
1547
|
_area;
|
|
1537
1548
|
_clippingElement;
|
|
@@ -1544,7 +1555,7 @@ class oo extends Zn {
|
|
|
1544
1555
|
_latestElement;
|
|
1545
1556
|
// Dynamically constructed area rect
|
|
1546
1557
|
_areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 };
|
|
1547
|
-
_areaRect =
|
|
1558
|
+
_areaRect = Re();
|
|
1548
1559
|
// If a single click is being performed, it's a single-click until the user dragged the mouse
|
|
1549
1560
|
_singleClick = !0;
|
|
1550
1561
|
_frame;
|
|
@@ -1596,44 +1607,44 @@ class oo extends Zn {
|
|
|
1596
1607
|
for (const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1597
1608
|
typeof this[i] == "function" && (this[i] = this[i].bind(this));
|
|
1598
1609
|
const { document: n, selectionAreaClass: o, selectionContainerClass: s } = this._options;
|
|
1599
|
-
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s),
|
|
1610
|
+
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s), I(this._area, {
|
|
1600
1611
|
willChange: "top, left, bottom, right, width, height",
|
|
1601
1612
|
top: 0,
|
|
1602
1613
|
left: 0,
|
|
1603
1614
|
position: "fixed"
|
|
1604
|
-
}),
|
|
1615
|
+
}), I(this._clippingElement, {
|
|
1605
1616
|
overflow: "hidden",
|
|
1606
1617
|
position: "fixed",
|
|
1607
1618
|
transform: "translate3d(0, 0, 0)",
|
|
1608
1619
|
// https://stackoverflow.com/a/38268846
|
|
1609
1620
|
pointerEvents: "none",
|
|
1610
1621
|
zIndex: "1"
|
|
1611
|
-
}), this._frame =
|
|
1622
|
+
}), this._frame = Jn((i) => {
|
|
1612
1623
|
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
|
|
1613
1624
|
}), this.enable();
|
|
1614
1625
|
}
|
|
1615
1626
|
_toggleStartEvents(t = !0) {
|
|
1616
|
-
const { document: n, features: o } = this._options, s = t ?
|
|
1627
|
+
const { document: n, features: o } = this._options, s = t ? X : $;
|
|
1617
1628
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1618
1629
|
}
|
|
1619
1630
|
_onTapStart(t, n = !1) {
|
|
1620
|
-
const { x: o, y: s, target: i } =
|
|
1621
|
-
if (t instanceof MouseEvent && !
|
|
1631
|
+
const { x: o, y: s, target: i } = Q(t), { document: l, startAreas: c, boundaries: r, features: a, behaviour: h } = this._options, f = i.getBoundingClientRect();
|
|
1632
|
+
if (t instanceof MouseEvent && !eo(t, h.triggers))
|
|
1622
1633
|
return;
|
|
1623
|
-
const u =
|
|
1624
|
-
this._targetElement =
|
|
1625
|
-
const
|
|
1626
|
-
if (this._targetBoundary =
|
|
1634
|
+
const u = F(c, l), b = F(r, l);
|
|
1635
|
+
this._targetElement = b.find((m) => Be(m.getBoundingClientRect(), f));
|
|
1636
|
+
const v = t.composedPath(), p = u.find((m) => v.includes(m));
|
|
1637
|
+
if (this._targetBoundary = b.find((m) => v.includes(m)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1627
1638
|
return;
|
|
1628
1639
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1629
1640
|
const g = l.scrollingElement ?? l.body;
|
|
1630
|
-
this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0),
|
|
1641
|
+
this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), X(l, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), X(l, ["mouseup", "touchcancel", "touchend"], this._onTapStop), X(l, "scroll", this._onScroll), a.deselectOnBlur && (this._targetBoundaryScrolled = !1, X(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1631
1642
|
}
|
|
1632
1643
|
_onSingleTap(t) {
|
|
1633
1644
|
const {
|
|
1634
1645
|
singleTap: { intersect: n },
|
|
1635
1646
|
range: o
|
|
1636
|
-
} = this._options.features, s =
|
|
1647
|
+
} = this._options.features, s = Q(t);
|
|
1637
1648
|
let i;
|
|
1638
1649
|
if (n === "native")
|
|
1639
1650
|
i = s.target;
|
|
@@ -1641,8 +1652,8 @@ class oo extends Zn {
|
|
|
1641
1652
|
this.resolveSelectables();
|
|
1642
1653
|
const { x: c, y: r } = s;
|
|
1643
1654
|
i = this._selectables.find((a) => {
|
|
1644
|
-
const { right:
|
|
1645
|
-
return c <
|
|
1655
|
+
const { right: h, left: f, top: u, bottom: b } = a.getBoundingClientRect();
|
|
1656
|
+
return c < h && c > f && r < b && r > u;
|
|
1646
1657
|
});
|
|
1647
1658
|
}
|
|
1648
1659
|
if (!i)
|
|
@@ -1656,12 +1667,12 @@ class oo extends Zn {
|
|
|
1656
1667
|
}
|
|
1657
1668
|
const { stored: l } = this._selection;
|
|
1658
1669
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1659
|
-
const c = this._latestElement, [r, a] = c.compareDocumentPosition(i) & 4 ? [i, c] : [c, i],
|
|
1660
|
-
...this._selectables.filter((
|
|
1670
|
+
const c = this._latestElement, [r, a] = c.compareDocumentPosition(i) & 4 ? [i, c] : [c, i], h = [
|
|
1671
|
+
...this._selectables.filter((f) => f.compareDocumentPosition(r) & 4 && f.compareDocumentPosition(a) & 2),
|
|
1661
1672
|
r,
|
|
1662
1673
|
a
|
|
1663
1674
|
];
|
|
1664
|
-
this.select(
|
|
1675
|
+
this.select(h), this._latestElement = c;
|
|
1665
1676
|
} else l.includes(i) && (l.length === 1 || t.ctrlKey || l.every((c) => this._selection.stored.includes(c))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
|
|
1666
1677
|
}
|
|
1667
1678
|
_delayedTapMove(t) {
|
|
@@ -1669,42 +1680,42 @@ class oo extends Zn {
|
|
|
1669
1680
|
container: n,
|
|
1670
1681
|
document: o,
|
|
1671
1682
|
behaviour: { startThreshold: s }
|
|
1672
|
-
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } =
|
|
1683
|
+
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } = Q(t);
|
|
1673
1684
|
if (
|
|
1674
1685
|
// Single number for both coordinates
|
|
1675
|
-
typeof s == "number" &&
|
|
1676
|
-
typeof s == "object" &&
|
|
1686
|
+
typeof s == "number" && R(c + r - (i + l)) >= s || // Different x and y threshold
|
|
1687
|
+
typeof s == "object" && R(c - i) >= s.x || R(r - l) >= s.y
|
|
1677
1688
|
) {
|
|
1678
|
-
if (
|
|
1679
|
-
|
|
1689
|
+
if ($(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1690
|
+
$(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1680
1691
|
return;
|
|
1681
1692
|
}
|
|
1682
|
-
|
|
1693
|
+
X(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), I(this._area, "display", "block"), F(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
1683
1694
|
}
|
|
1684
1695
|
this._handleMoveEvent(t);
|
|
1685
1696
|
}
|
|
1686
1697
|
_setupSelectionArea() {
|
|
1687
1698
|
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
1688
|
-
this._scrollAvailable ? (
|
|
1699
|
+
this._scrollAvailable ? (I(t, {
|
|
1689
1700
|
top: s.top,
|
|
1690
1701
|
left: s.left,
|
|
1691
1702
|
width: s.width,
|
|
1692
1703
|
height: s.height
|
|
1693
|
-
}),
|
|
1704
|
+
}), I(o, {
|
|
1694
1705
|
marginTop: -s.top,
|
|
1695
1706
|
marginLeft: -s.left
|
|
1696
|
-
})) : (
|
|
1707
|
+
})) : (I(t, {
|
|
1697
1708
|
top: 0,
|
|
1698
1709
|
left: 0,
|
|
1699
1710
|
width: "100%",
|
|
1700
1711
|
height: "100%"
|
|
1701
|
-
}),
|
|
1712
|
+
}), I(o, {
|
|
1702
1713
|
marginTop: 0,
|
|
1703
1714
|
marginLeft: 0
|
|
1704
1715
|
}));
|
|
1705
1716
|
}
|
|
1706
1717
|
_onTapMove(t) {
|
|
1707
|
-
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling, { x: c, y: r } =
|
|
1718
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling, { x: c, y: r } = Q(t);
|
|
1708
1719
|
if (o.x2 = c, o.y2 = r, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1709
1720
|
this._scrollingActive = !0;
|
|
1710
1721
|
const a = () => {
|
|
@@ -1712,10 +1723,10 @@ class oo extends Zn {
|
|
|
1712
1723
|
this._scrollingActive = !1;
|
|
1713
1724
|
return;
|
|
1714
1725
|
}
|
|
1715
|
-
const
|
|
1716
|
-
if (
|
|
1717
|
-
const
|
|
1718
|
-
(
|
|
1726
|
+
const h = this._options.mindElixirInstance;
|
|
1727
|
+
if (h && h.move) {
|
|
1728
|
+
const f = n.x ? Xe(n.x / l) : 0, u = n.y ? Xe(n.y / l) : 0;
|
|
1729
|
+
(f || u) && (h.move(-f, -u), o.x1 -= f, o.y1 -= u);
|
|
1719
1730
|
}
|
|
1720
1731
|
i.next(t), requestAnimationFrame(a);
|
|
1721
1732
|
};
|
|
@@ -1726,7 +1737,7 @@ class oo extends Zn {
|
|
|
1726
1737
|
}
|
|
1727
1738
|
_handleMoveEvent(t) {
|
|
1728
1739
|
const { features: n } = this._options;
|
|
1729
|
-
(n.touch &&
|
|
1740
|
+
(n.touch && Zn() || this._scrollAvailable && Qn()) && t.preventDefault();
|
|
1730
1741
|
}
|
|
1731
1742
|
_onScroll() {
|
|
1732
1743
|
const {
|
|
@@ -1736,19 +1747,19 @@ class oo extends Zn {
|
|
|
1736
1747
|
this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1737
1748
|
}
|
|
1738
1749
|
_onStartAreaScroll() {
|
|
1739
|
-
this._targetBoundaryScrolled = !0,
|
|
1750
|
+
this._targetBoundaryScrolled = !0, $(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1740
1751
|
}
|
|
1741
1752
|
_recalculateSelectionAreaRect() {
|
|
1742
1753
|
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, i = this._targetRect, { x1: l, y1: c } = n;
|
|
1743
1754
|
let { x2: r, y2: a } = n;
|
|
1744
1755
|
const {
|
|
1745
1756
|
behaviour: {
|
|
1746
|
-
scrolling: { startScrollMargins:
|
|
1757
|
+
scrolling: { startScrollMargins: h }
|
|
1747
1758
|
}
|
|
1748
1759
|
} = s;
|
|
1749
|
-
r < i.left +
|
|
1750
|
-
const
|
|
1751
|
-
this._areaRect =
|
|
1760
|
+
r < i.left + h.x ? (t.x = -R(i.left - r + h.x), r = r < i.left ? i.left : r) : r > i.right - h.x ? (t.x = R(i.left + i.width - r - h.x), r = r > i.right ? i.right : r) : t.x = 0, a < i.top + h.y ? (t.y = -R(i.top - a + h.y), a = a < i.top ? i.top : a) : a > i.bottom - h.y ? (t.y = R(i.top + i.height - a - h.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
|
|
1761
|
+
const f = Ye(l, r), u = Ye(c, a), b = We(l, r), v = We(c, a);
|
|
1762
|
+
this._areaRect = Re(f, u, b - f, v - u);
|
|
1752
1763
|
}
|
|
1753
1764
|
_redrawSelectionArea() {
|
|
1754
1765
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1756,32 +1767,32 @@ class oo extends Zn {
|
|
|
1756
1767
|
}
|
|
1757
1768
|
_onTapStop(t, n) {
|
|
1758
1769
|
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1759
|
-
|
|
1770
|
+
$(this._targetElement, "scroll", this._onStartAreaScroll), $(o, ["mousemove", "touchmove"], this._delayedTapMove), $(o, ["touchmove", "mousemove"], this._onTapMove), $(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), $(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, this._clippingElement.remove(), this._frame?.cancel(), I(this._area, "display", "none");
|
|
1760
1771
|
}
|
|
1761
1772
|
_updateElementSelection() {
|
|
1762
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: c } = o, { intersect: r, overlap: a } = n.behaviour,
|
|
1773
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: c } = o, { intersect: r, overlap: a } = n.behaviour, h = a === "invert", f = [], u = [], b = [];
|
|
1763
1774
|
for (let p = 0; p < t.length; p++) {
|
|
1764
1775
|
const g = t[p];
|
|
1765
|
-
if (
|
|
1776
|
+
if (Be(s, g.getBoundingClientRect(), r)) {
|
|
1766
1777
|
if (l.includes(g))
|
|
1767
1778
|
i.includes(g) && !c.includes(g) && c.push(g);
|
|
1768
|
-
else if (
|
|
1769
|
-
|
|
1779
|
+
else if (h && i.includes(g)) {
|
|
1780
|
+
b.push(g);
|
|
1770
1781
|
continue;
|
|
1771
1782
|
} else
|
|
1772
1783
|
u.push(g);
|
|
1773
|
-
|
|
1784
|
+
f.push(g);
|
|
1774
1785
|
}
|
|
1775
1786
|
}
|
|
1776
|
-
|
|
1777
|
-
const
|
|
1787
|
+
h && u.push(...i.filter((p) => !l.includes(p)));
|
|
1788
|
+
const v = a === "keep";
|
|
1778
1789
|
for (let p = 0; p < l.length; p++) {
|
|
1779
1790
|
const g = l[p];
|
|
1780
|
-
!
|
|
1791
|
+
!f.includes(g) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1781
1792
|
// not make them part of the current selection as soon as they're touched.
|
|
1782
|
-
(
|
|
1793
|
+
(v && i.includes(g)) && b.push(g);
|
|
1783
1794
|
}
|
|
1784
|
-
o.selected =
|
|
1795
|
+
o.selected = f, o.changed = { added: u, removed: b }, this._latestElement = void 0;
|
|
1785
1796
|
}
|
|
1786
1797
|
_emitEvent(t, n) {
|
|
1787
1798
|
return this.emit(t, {
|
|
@@ -1832,7 +1843,7 @@ class oo extends Zn {
|
|
|
1832
1843
|
* Will update everything that can be selected
|
|
1833
1844
|
*/
|
|
1834
1845
|
resolveSelectables() {
|
|
1835
|
-
this._selectables =
|
|
1846
|
+
this._selectables = F(this._options.selectables, this._options.document);
|
|
1836
1847
|
}
|
|
1837
1848
|
/**
|
|
1838
1849
|
* Same as deselecting, but for all elements currently selected
|
|
@@ -1841,7 +1852,7 @@ class oo extends Zn {
|
|
|
1841
1852
|
*/
|
|
1842
1853
|
clearSelection(t = !0, n = !1) {
|
|
1843
1854
|
const { selected: o, stored: s, changed: i } = this._selection;
|
|
1844
|
-
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection =
|
|
1855
|
+
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Fe(t ? [] : s);
|
|
1845
1856
|
}
|
|
1846
1857
|
/**
|
|
1847
1858
|
* @returns {Array} Selected elements
|
|
@@ -1901,7 +1912,7 @@ class oo extends Zn {
|
|
|
1901
1912
|
* @param quiet If this should not trigger the move event
|
|
1902
1913
|
*/
|
|
1903
1914
|
select(t, n = !1) {
|
|
1904
|
-
const { changed: o, selected: s, stored: i } = this._selection, l =
|
|
1915
|
+
const { changed: o, selected: s, stored: i } = this._selection, l = F(t, this._options.document).filter((c) => !s.includes(c) && !i.includes(c));
|
|
1905
1916
|
return i.push(...l), s.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
|
|
1906
1917
|
}
|
|
1907
1918
|
/**
|
|
@@ -1910,12 +1921,12 @@ class oo extends Zn {
|
|
|
1910
1921
|
* @param quiet If this should not trigger the move event
|
|
1911
1922
|
*/
|
|
1912
1923
|
deselect(t, n = !1) {
|
|
1913
|
-
const { selected: o, stored: s, changed: i } = this._selection, l =
|
|
1924
|
+
const { selected: o, stored: s, changed: i } = this._selection, l = F(t, this._options.document).filter((c) => o.includes(c) || s.includes(c));
|
|
1914
1925
|
this._selection.stored = s.filter((c) => !l.includes(c)), this._selection.selected = o.filter((c) => !l.includes(c)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((c) => !i.removed.includes(c))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
1915
1926
|
}
|
|
1916
1927
|
}
|
|
1917
|
-
function
|
|
1918
|
-
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new
|
|
1928
|
+
function no(e) {
|
|
1929
|
+
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new to({
|
|
1919
1930
|
selectables: [".map-container me-tpc"],
|
|
1920
1931
|
boundaries: [e.container],
|
|
1921
1932
|
container: e.selectionContainer,
|
|
@@ -1982,10 +1993,10 @@ function so(e) {
|
|
|
1982
1993
|
);
|
|
1983
1994
|
e.selection = n;
|
|
1984
1995
|
}
|
|
1985
|
-
const
|
|
1996
|
+
const oo = function(e, t = !0) {
|
|
1986
1997
|
this.theme = e;
|
|
1987
1998
|
const o = {
|
|
1988
|
-
...(e.type === "dark" ?
|
|
1999
|
+
...(e.type === "dark" ? ge : pe).cssVar,
|
|
1989
2000
|
...e.cssVar
|
|
1990
2001
|
}, s = Object.keys(o);
|
|
1991
2002
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -1993,7 +2004,7 @@ const io = function(e, t = !0) {
|
|
|
1993
2004
|
this.container.style.setProperty(l, o[l]);
|
|
1994
2005
|
}
|
|
1995
2006
|
t && this.refresh();
|
|
1996
|
-
},
|
|
2007
|
+
}, so = function(e) {
|
|
1997
2008
|
return {
|
|
1998
2009
|
dom: e,
|
|
1999
2010
|
moved: !1,
|
|
@@ -2016,7 +2027,7 @@ const io = function(e, t = !0) {
|
|
|
2016
2027
|
},
|
|
2017
2028
|
cb: null,
|
|
2018
2029
|
init(t, n) {
|
|
2019
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
2030
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = qe([
|
|
2020
2031
|
{ dom: t, evt: "pointermove", func: this.handlePointerMove },
|
|
2021
2032
|
{ dom: t, evt: "pointerleave", func: this.handleClear },
|
|
2022
2033
|
{ dom: t, evt: "pointerup", func: this.handleClear },
|
|
@@ -2028,71 +2039,71 @@ const io = function(e, t = !0) {
|
|
|
2028
2039
|
this.moved = !1, this.pointerdown = !1;
|
|
2029
2040
|
}
|
|
2030
2041
|
};
|
|
2031
|
-
},
|
|
2032
|
-
create:
|
|
2033
|
-
},
|
|
2034
|
-
function
|
|
2042
|
+
}, Ge = {
|
|
2043
|
+
create: so
|
|
2044
|
+
}, io = "#4dc4ff";
|
|
2045
|
+
function at(e, t, n, o, s, i, l, c) {
|
|
2035
2046
|
return {
|
|
2036
2047
|
x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
|
|
2037
2048
|
y: t / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
2038
2049
|
};
|
|
2039
2050
|
}
|
|
2040
|
-
function
|
|
2041
|
-
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(),
|
|
2051
|
+
function ro(e, t, n) {
|
|
2052
|
+
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), le(e));
|
|
2042
2053
|
}
|
|
2043
|
-
function
|
|
2044
|
-
|
|
2054
|
+
function ee(e, t, n, o, s) {
|
|
2055
|
+
_(e, {
|
|
2045
2056
|
x1: t + "",
|
|
2046
2057
|
y1: n + "",
|
|
2047
2058
|
x2: o + "",
|
|
2048
2059
|
y2: s + ""
|
|
2049
2060
|
});
|
|
2050
2061
|
}
|
|
2051
|
-
function
|
|
2052
|
-
const
|
|
2053
|
-
if (e.line.setAttribute("d",
|
|
2062
|
+
function ze(e, t, n, o, s, i, l, c, r, a) {
|
|
2063
|
+
const h = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${c} ${r}`;
|
|
2064
|
+
if (e.line.setAttribute("d", h), a.style) {
|
|
2054
2065
|
const p = a.style;
|
|
2055
2066
|
p.stroke && e.line.setAttribute("stroke", p.stroke), p.strokeWidth && e.line.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeDasharray && e.line.setAttribute("stroke-dasharray", p.strokeDasharray), p.strokeLinecap && e.line.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && e.line.setAttribute("opacity", String(p.opacity));
|
|
2056
2067
|
}
|
|
2057
|
-
const
|
|
2058
|
-
|
|
2059
|
-
const u =
|
|
2068
|
+
const f = e.querySelectorAll('path[stroke="transparent"]');
|
|
2069
|
+
f.length > 0 && f[0].setAttribute("d", h);
|
|
2070
|
+
const u = se(i, l, c, r);
|
|
2060
2071
|
if (u) {
|
|
2061
2072
|
const p = `M ${u.x1} ${u.y1} L ${c} ${r} L ${u.x2} ${u.y2}`;
|
|
2062
|
-
if (e.arrow1.setAttribute("d", p),
|
|
2073
|
+
if (e.arrow1.setAttribute("d", p), f.length > 1 && f[1].setAttribute("d", p), a.style) {
|
|
2063
2074
|
const g = a.style;
|
|
2064
2075
|
g.stroke && e.arrow1.setAttribute("stroke", g.stroke), g.strokeWidth && e.arrow1.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(g.opacity));
|
|
2065
2076
|
}
|
|
2066
2077
|
}
|
|
2067
2078
|
if (a.bidirectional) {
|
|
2068
|
-
const p =
|
|
2079
|
+
const p = se(o, s, t, n);
|
|
2069
2080
|
if (p) {
|
|
2070
2081
|
const g = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
|
|
2071
|
-
if (e.arrow2.setAttribute("d", g),
|
|
2082
|
+
if (e.arrow2.setAttribute("d", g), f.length > 2 && f[2].setAttribute("d", g), a.style) {
|
|
2072
2083
|
const m = a.style;
|
|
2073
2084
|
m.stroke && e.arrow2.setAttribute("stroke", m.stroke), m.strokeWidth && e.arrow2.setAttribute("stroke-width", String(m.strokeWidth)), m.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", m.strokeLinecap), m.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(m.opacity));
|
|
2074
2085
|
}
|
|
2075
2086
|
}
|
|
2076
2087
|
}
|
|
2077
|
-
const { x:
|
|
2078
|
-
if (e.labelEl &&
|
|
2088
|
+
const { x: b, y: v } = at(t, n, o, s, i, l, c, r);
|
|
2089
|
+
if (e.labelEl && ro(e.labelEl, b, v), a.style?.labelColor) {
|
|
2079
2090
|
const p = e.labelEl;
|
|
2080
2091
|
p && (p.style.color = a.style.labelColor);
|
|
2081
2092
|
}
|
|
2082
|
-
|
|
2093
|
+
mo(e);
|
|
2083
2094
|
}
|
|
2084
|
-
function
|
|
2085
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
2095
|
+
function ie(e, t, n) {
|
|
2096
|
+
const { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, c = o + i / 2, r = s + l / 2, a = c + n.x, h = r + n.y;
|
|
2086
2097
|
return {
|
|
2087
2098
|
w: i,
|
|
2088
2099
|
h: l,
|
|
2089
2100
|
cx: c,
|
|
2090
2101
|
cy: r,
|
|
2091
2102
|
ctrlX: a,
|
|
2092
|
-
ctrlY:
|
|
2103
|
+
ctrlY: h
|
|
2093
2104
|
};
|
|
2094
2105
|
}
|
|
2095
|
-
function
|
|
2106
|
+
function G(e) {
|
|
2096
2107
|
let t, n;
|
|
2097
2108
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
2098
2109
|
return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
|
|
@@ -2100,74 +2111,74 @@ function q(e) {
|
|
|
2100
2111
|
y: n
|
|
2101
2112
|
};
|
|
2102
2113
|
}
|
|
2103
|
-
const
|
|
2104
|
-
const o =
|
|
2114
|
+
const lo = function(e, t, n) {
|
|
2115
|
+
const o = A(e.nodes, t), s = A(e.nodes, n), i = o.offsetLeft + t.offsetWidth / 2, l = o.offsetTop + t.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, r = s.offsetTop + n.offsetHeight / 2, a = c - i, h = r - l, f = Math.sqrt(a * a + h * h), u = Math.max(50, Math.min(200, f * 0.3)), b = Math.abs(a), v = Math.abs(h);
|
|
2105
2116
|
let p, g;
|
|
2106
|
-
if (
|
|
2107
|
-
const
|
|
2108
|
-
p = { x: 200 *
|
|
2109
|
-
} else if (
|
|
2110
|
-
const
|
|
2111
|
-
p = { x:
|
|
2112
|
-
} else if (
|
|
2113
|
-
const
|
|
2114
|
-
p = { x: 0, y:
|
|
2117
|
+
if (f < 150) {
|
|
2118
|
+
const x = t.closest("me-main").className === "lhs" ? -1 : 1;
|
|
2119
|
+
p = { x: 200 * x, y: 0 }, g = { x: 200 * x, y: 0 };
|
|
2120
|
+
} else if (b > v * 1.5) {
|
|
2121
|
+
const x = a > 0 ? t.offsetWidth / 2 : -t.offsetWidth / 2, E = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
2122
|
+
p = { x: x + (a > 0 ? u : -u), y: 0 }, g = { x: E + (a > 0 ? -u : u), y: 0 };
|
|
2123
|
+
} else if (v > b * 1.5) {
|
|
2124
|
+
const x = h > 0 ? t.offsetHeight / 2 : -t.offsetHeight / 2, E = h > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
2125
|
+
p = { x: 0, y: x + (h > 0 ? u : -u) }, g = { x: 0, y: E + (h > 0 ? -u : u) };
|
|
2115
2126
|
} else {
|
|
2116
|
-
const
|
|
2117
|
-
p = { x: E +
|
|
2127
|
+
const x = Math.atan2(h, a), E = t.offsetWidth / 2 * Math.cos(x), k = t.offsetHeight / 2 * Math.sin(x), T = -(n.offsetWidth / 2) * Math.cos(x), C = -(n.offsetHeight / 2) * Math.sin(x), d = u * 0.7 * (a > 0 ? 1 : -1), y = u * 0.7 * (h > 0 ? 1 : -1);
|
|
2128
|
+
p = { x: E + d, y: k + y }, g = { x: T - d, y: C - y };
|
|
2118
2129
|
}
|
|
2119
2130
|
return {
|
|
2120
2131
|
delta1: { x: Math.round(p.x), y: Math.round(p.y) },
|
|
2121
2132
|
delta2: { x: Math.round(g.x), y: Math.round(g.y) }
|
|
2122
2133
|
};
|
|
2123
|
-
},
|
|
2134
|
+
}, Te = function(e, t, n, o, s) {
|
|
2124
2135
|
if (!t || !n)
|
|
2125
2136
|
return;
|
|
2126
2137
|
if (!o.delta1 || !o.delta2) {
|
|
2127
|
-
const
|
|
2128
|
-
o.delta1 =
|
|
2138
|
+
const w = lo(e, t, n);
|
|
2139
|
+
o.delta1 = w.delta1, o.delta2 = w.delta2;
|
|
2129
2140
|
}
|
|
2130
|
-
const i =
|
|
2141
|
+
const i = ie(e, t, o.delta1), l = ie(e, n, o.delta2), { x: c, y: r } = G(i), { ctrlX: a, ctrlY: h } = i, { ctrlX: f, ctrlY: u } = l, { x: b, y: v } = G(l), p = se(f, u, b, v);
|
|
2131
2142
|
if (!p) return;
|
|
2132
|
-
const g = `M ${p.x1} ${p.y1} L ${
|
|
2143
|
+
const g = `M ${p.x1} ${p.y1} L ${b} ${v} L ${p.x2} ${p.y2}`;
|
|
2133
2144
|
let m = "";
|
|
2134
2145
|
if (o.bidirectional) {
|
|
2135
|
-
const
|
|
2136
|
-
if (!
|
|
2137
|
-
m = `M ${
|
|
2146
|
+
const w = se(a, h, c, r);
|
|
2147
|
+
if (!w) return;
|
|
2148
|
+
m = `M ${w.x1} ${w.y1} L ${c} ${r} L ${w.x2} ${w.y2}`;
|
|
2138
2149
|
}
|
|
2139
|
-
const
|
|
2140
|
-
|
|
2141
|
-
const
|
|
2150
|
+
const x = On(`M ${c} ${r} C ${a} ${h} ${f} ${u} ${b} ${v}`, g, m, o.style), { x: E, y: k } = at(c, r, a, h, f, u, b, v), T = o.style?.labelColor || "rgb(235, 95, 82)", C = "arrow-" + o.id;
|
|
2151
|
+
x.id = C;
|
|
2152
|
+
const d = e.markdown ? e.markdown(o.label, o) : o.label, y = fe(d, E, k, {
|
|
2142
2153
|
anchor: "middle",
|
|
2143
|
-
color:
|
|
2154
|
+
color: T,
|
|
2144
2155
|
dataType: "arrow",
|
|
2145
2156
|
svgId: C
|
|
2146
2157
|
});
|
|
2147
|
-
|
|
2148
|
-
},
|
|
2158
|
+
x.labelEl = y, x.arrowObj = o, x.dataset.linkid = o.id, e.labelContainer.appendChild(y), e.linkSvgGroup.appendChild(x), le(y), s || (e.arrows.push(o), e.currentArrow = x, dt(e, o, i, l));
|
|
2159
|
+
}, co = function(e, t, n = {}) {
|
|
2149
2160
|
const o = {
|
|
2150
|
-
id:
|
|
2161
|
+
id: Y(),
|
|
2151
2162
|
label: "Custom Link",
|
|
2152
2163
|
from: e.nodeObj.id,
|
|
2153
2164
|
to: t.nodeObj.id,
|
|
2154
2165
|
...n
|
|
2155
2166
|
};
|
|
2156
|
-
|
|
2167
|
+
Te(this, e, t, o), this.bus.fire("operation", {
|
|
2157
2168
|
name: "createArrow",
|
|
2158
2169
|
obj: o
|
|
2159
2170
|
});
|
|
2160
|
-
},
|
|
2161
|
-
|
|
2162
|
-
const t = { ...e, id:
|
|
2163
|
-
|
|
2171
|
+
}, ao = function(e) {
|
|
2172
|
+
ce(this);
|
|
2173
|
+
const t = { ...e, id: Y() };
|
|
2174
|
+
Te(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2164
2175
|
name: "createArrow",
|
|
2165
2176
|
obj: t
|
|
2166
2177
|
});
|
|
2167
|
-
},
|
|
2178
|
+
}, ho = function(e) {
|
|
2168
2179
|
let t;
|
|
2169
2180
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2170
|
-
|
|
2181
|
+
ce(this);
|
|
2171
2182
|
const n = t.arrowObj.id;
|
|
2172
2183
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.labelEl?.remove(), t.remove(), this.bus.fire("operation", {
|
|
2173
2184
|
name: "removeArrow",
|
|
@@ -2175,15 +2186,15 @@ const ao = function(e, t, n) {
|
|
|
2175
2186
|
id: n
|
|
2176
2187
|
}
|
|
2177
2188
|
});
|
|
2178
|
-
},
|
|
2189
|
+
}, fo = function(e) {
|
|
2179
2190
|
this.currentArrow = e;
|
|
2180
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s =
|
|
2181
|
-
|
|
2182
|
-
},
|
|
2183
|
-
|
|
2184
|
-
},
|
|
2185
|
-
const n = document.createElementNS(
|
|
2186
|
-
return
|
|
2191
|
+
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = ie(this, n, t.delta1), i = ie(this, o, t.delta2);
|
|
2192
|
+
dt(this, t, s, i), this.bus.fire("selectArrow", t);
|
|
2193
|
+
}, uo = function() {
|
|
2194
|
+
ce(this), this.currentArrow = null, this.bus.fire("unselectArrow");
|
|
2195
|
+
}, de = function(e, t) {
|
|
2196
|
+
const n = document.createElementNS(O, "path");
|
|
2197
|
+
return _(n, {
|
|
2187
2198
|
d: e,
|
|
2188
2199
|
stroke: t,
|
|
2189
2200
|
fill: "none",
|
|
@@ -2191,90 +2202,90 @@ const ao = function(e, t, n) {
|
|
|
2191
2202
|
"stroke-linecap": "round",
|
|
2192
2203
|
"stroke-linejoin": "round"
|
|
2193
2204
|
}), n;
|
|
2194
|
-
},
|
|
2195
|
-
const n = document.createElementNS(
|
|
2205
|
+
}, po = function(e, t) {
|
|
2206
|
+
const n = document.createElementNS(O, "g");
|
|
2196
2207
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2197
|
-
const o =
|
|
2208
|
+
const o = de(e.line.getAttribute("d"), t);
|
|
2198
2209
|
n.appendChild(o);
|
|
2199
|
-
const s =
|
|
2210
|
+
const s = de(e.arrow1.getAttribute("d"), t);
|
|
2200
2211
|
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2201
|
-
const i =
|
|
2212
|
+
const i = de(e.arrow2.getAttribute("d"), t);
|
|
2202
2213
|
n.appendChild(i);
|
|
2203
2214
|
}
|
|
2204
2215
|
e.insertBefore(n, e.firstChild);
|
|
2205
|
-
},
|
|
2216
|
+
}, go = function(e) {
|
|
2206
2217
|
const t = e.querySelector(".arrow-highlight");
|
|
2207
2218
|
t && t.remove();
|
|
2208
|
-
},
|
|
2219
|
+
}, mo = function(e) {
|
|
2209
2220
|
const t = e.querySelector(".arrow-highlight");
|
|
2210
2221
|
if (!t) return;
|
|
2211
2222
|
const n = t.querySelectorAll("path");
|
|
2212
2223
|
n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
|
|
2213
|
-
},
|
|
2214
|
-
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow &&
|
|
2215
|
-
},
|
|
2216
|
-
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map:
|
|
2217
|
-
if (!
|
|
2218
|
-
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l),
|
|
2219
|
-
let { x:
|
|
2220
|
-
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${
|
|
2221
|
-
p = p +
|
|
2222
|
-
const
|
|
2223
|
-
|
|
2224
|
-
}), e.helper2.init(
|
|
2225
|
-
m = m +
|
|
2226
|
-
const
|
|
2227
|
-
E =
|
|
2224
|
+
}, ce = function(e) {
|
|
2225
|
+
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && go(e.currentArrow);
|
|
2226
|
+
}, dt = function(e, t, n, o) {
|
|
2227
|
+
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: h, currentArrow: f, bus: u } = e;
|
|
2228
|
+
if (!f) return;
|
|
2229
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), po(f, io);
|
|
2230
|
+
let { x: b, y: v } = G(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: x } = o, { x: E, y: k } = G(o);
|
|
2231
|
+
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${x}px;left:${m}px;`, ee(c, b, v, p, g), ee(r, m, x, E, k), e.helper1 = Ge.create(i), e.helper2 = Ge.create(l), e.helper1.init(h, (T, C) => {
|
|
2232
|
+
p = p + T / e.scaleVal, g = g + C / e.scaleVal;
|
|
2233
|
+
const d = G({ ...n, ctrlX: p, ctrlY: g });
|
|
2234
|
+
b = d.x, v = d.y, i.style.top = g + "px", i.style.left = p + "px", ze(f, b, v, p, g, m, x, E, k, t), ee(c, b, v, p, g), t.delta1.x = Math.round(p - n.cx), t.delta1.y = Math.round(g - n.cy), u.fire("updateArrowDelta", t);
|
|
2235
|
+
}), e.helper2.init(h, (T, C) => {
|
|
2236
|
+
m = m + T / e.scaleVal, x = x + C / e.scaleVal;
|
|
2237
|
+
const d = G({ ...o, ctrlX: m, ctrlY: x });
|
|
2238
|
+
E = d.x, k = d.y, l.style.top = x + "px", l.style.left = m + "px", ze(f, b, v, p, g, m, x, E, k, t), ee(r, m, x, E, k), t.delta2.x = Math.round(m - o.cx), t.delta2.y = Math.round(x - o.cy), u.fire("updateArrowDelta", t);
|
|
2228
2239
|
});
|
|
2229
2240
|
};
|
|
2230
|
-
function
|
|
2241
|
+
function yo() {
|
|
2231
2242
|
this.linkSvgGroup.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((t) => t.remove());
|
|
2232
2243
|
for (let t = 0; t < this.arrows.length; t++) {
|
|
2233
2244
|
const n = this.arrows[t];
|
|
2234
2245
|
try {
|
|
2235
|
-
|
|
2246
|
+
Te(this, this.findEle(n.from), this.findEle(n.to), n, !0);
|
|
2236
2247
|
} catch {
|
|
2237
2248
|
}
|
|
2238
2249
|
}
|
|
2239
2250
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
2240
2251
|
}
|
|
2241
|
-
function
|
|
2242
|
-
|
|
2252
|
+
function bo(e) {
|
|
2253
|
+
ce(this), e && e.labelEl && rt(this, e.labelEl, e.arrowObj);
|
|
2243
2254
|
}
|
|
2244
|
-
function
|
|
2245
|
-
this.arrows = this.arrows.filter((e) =>
|
|
2255
|
+
function vo() {
|
|
2256
|
+
this.arrows = this.arrows.filter((e) => oe(e.from, this.nodeData) && oe(e.to, this.nodeData));
|
|
2246
2257
|
}
|
|
2247
|
-
const
|
|
2258
|
+
const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2248
2259
|
__proto__: null,
|
|
2249
|
-
createArrow:
|
|
2250
|
-
createArrowFrom:
|
|
2251
|
-
editArrowLabel:
|
|
2252
|
-
removeArrow:
|
|
2253
|
-
renderArrow:
|
|
2254
|
-
selectArrow:
|
|
2255
|
-
tidyArrow:
|
|
2256
|
-
unselectArrow:
|
|
2257
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2260
|
+
createArrow: co,
|
|
2261
|
+
createArrowFrom: ao,
|
|
2262
|
+
editArrowLabel: bo,
|
|
2263
|
+
removeArrow: ho,
|
|
2264
|
+
renderArrow: yo,
|
|
2265
|
+
selectArrow: fo,
|
|
2266
|
+
tidyArrow: vo,
|
|
2267
|
+
unselectArrow: uo
|
|
2268
|
+
}, Symbol.toStringTag, { value: "Module" })), wo = function(e) {
|
|
2258
2269
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2259
2270
|
if (e.length === 1) {
|
|
2260
2271
|
const r = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
2261
2272
|
if (!a) throw new Error("Can not select root node.");
|
|
2262
|
-
const
|
|
2273
|
+
const h = a.children.findIndex((f) => r === f);
|
|
2263
2274
|
return {
|
|
2264
2275
|
parent: a.id,
|
|
2265
|
-
start:
|
|
2266
|
-
end:
|
|
2276
|
+
start: h,
|
|
2277
|
+
end: h
|
|
2267
2278
|
};
|
|
2268
2279
|
}
|
|
2269
2280
|
let t = 0;
|
|
2270
2281
|
const n = e.map((r) => {
|
|
2271
2282
|
let a = r.nodeObj;
|
|
2272
|
-
const
|
|
2283
|
+
const h = [];
|
|
2273
2284
|
for (; a.parent; ) {
|
|
2274
|
-
const
|
|
2275
|
-
a =
|
|
2285
|
+
const f = a.parent, b = f.children?.indexOf(a);
|
|
2286
|
+
a = f, h.unshift({ node: a, index: b });
|
|
2276
2287
|
}
|
|
2277
|
-
return
|
|
2288
|
+
return h.length > t && (t = h.length), h;
|
|
2278
2289
|
});
|
|
2279
2290
|
let o = 0;
|
|
2280
2291
|
e: for (; o < t; o++) {
|
|
@@ -2291,101 +2302,101 @@ const Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2291
2302
|
start: i,
|
|
2292
2303
|
end: l
|
|
2293
2304
|
};
|
|
2294
|
-
},
|
|
2295
|
-
const t = document.createElementNS(
|
|
2305
|
+
}, Eo = function(e) {
|
|
2306
|
+
const t = document.createElementNS(O, "g");
|
|
2296
2307
|
return t.setAttribute("id", e), t;
|
|
2297
|
-
},
|
|
2298
|
-
const n = document.createElementNS(
|
|
2299
|
-
return
|
|
2308
|
+
}, Ke = function(e, t) {
|
|
2309
|
+
const n = document.createElementNS(O, "path");
|
|
2310
|
+
return _(n, {
|
|
2300
2311
|
d: e,
|
|
2301
2312
|
stroke: t || "#666",
|
|
2302
2313
|
fill: "none",
|
|
2303
2314
|
"stroke-linecap": "round",
|
|
2304
2315
|
"stroke-width": "2"
|
|
2305
2316
|
}), n;
|
|
2306
|
-
},
|
|
2317
|
+
}, Co = (e) => e.parentElement.parentElement, So = function(e, { parent: t, start: n }) {
|
|
2307
2318
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2308
2319
|
let i;
|
|
2309
2320
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2310
|
-
},
|
|
2311
|
-
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg:
|
|
2312
|
-
let
|
|
2313
|
-
for (let
|
|
2314
|
-
const
|
|
2315
|
-
if (!
|
|
2321
|
+
}, ke = function(e, t) {
|
|
2322
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg: h } = e, u = e.findEle(s).nodeObj, b = So(e, t);
|
|
2323
|
+
let v = 1 / 0, p = 0, g = 0, m = 0;
|
|
2324
|
+
for (let D = i; D <= l; D++) {
|
|
2325
|
+
const j = u.children?.[D];
|
|
2326
|
+
if (!j)
|
|
2316
2327
|
return e.removeSummary(n), null;
|
|
2317
|
-
const
|
|
2318
|
-
|
|
2319
|
-
}
|
|
2320
|
-
let
|
|
2321
|
-
const k = u.parent ? 10 : 0,
|
|
2322
|
-
|
|
2323
|
-
const
|
|
2324
|
-
return
|
|
2325
|
-
},
|
|
2328
|
+
const J = Co(e.findEle(j.id)), { offsetLeft: Z, offsetTop: _e } = A(r, J), Le = i === l ? 10 : 20;
|
|
2329
|
+
D === i && (g = _e + Le), D === l && (m = _e + J.offsetHeight - Le), Z < v && (v = Z), J.offsetWidth + Z > p && (p = J.offsetWidth + Z);
|
|
2330
|
+
}
|
|
2331
|
+
let x, E;
|
|
2332
|
+
const k = u.parent ? 10 : 0, T = g + k, C = m + k, d = (T + C) / 2, y = c?.stroke || a.cssVar["--color"], w = c?.labelColor || a.cssVar["--color"], N = "s-" + n, M = e.markdown ? e.markdown(o, t) : o;
|
|
2333
|
+
b === H.LHS ? (x = Ke(`M ${v + 10} ${T} c -5 0 -10 5 -10 10 L ${v} ${C - 10} c 0 5 5 10 10 10 M ${v} ${d} h -10`, y), E = fe(M, v - 20, d, { anchor: "end", color: w, dataType: "summary", svgId: N })) : (x = Ke(`M ${p - 10} ${T} c 5 0 10 5 10 10 L ${p} ${C - 10} c 0 5 -5 10 -10 10 M ${p} ${d} h 10`, y), E = fe(M, p + 20, d, { anchor: "start", color: w, dataType: "summary", svgId: N }));
|
|
2334
|
+
const S = Eo(N);
|
|
2335
|
+
return S.appendChild(x), e.labelContainer.appendChild(E), le(E), S.summaryObj = t, S.labelEl = E, h.appendChild(S), S;
|
|
2336
|
+
}, No = function(e = {}) {
|
|
2326
2337
|
if (!this.currentNodes) return;
|
|
2327
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } =
|
|
2338
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = wo(t), c = { id: Y(), parent: s, start: i, end: l, label: "summary", style: e.style }, r = ke(this, c);
|
|
2328
2339
|
n.push(c), this.editSummary(r), o.fire("operation", {
|
|
2329
2340
|
name: "createSummary",
|
|
2330
2341
|
obj: c
|
|
2331
2342
|
});
|
|
2332
|
-
},
|
|
2333
|
-
const t =
|
|
2334
|
-
|
|
2343
|
+
}, To = function(e) {
|
|
2344
|
+
const t = Y(), n = { ...e, id: t };
|
|
2345
|
+
ke(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2335
2346
|
name: "createSummary",
|
|
2336
2347
|
obj: n
|
|
2337
2348
|
});
|
|
2338
|
-
},
|
|
2349
|
+
}, ko = function(e) {
|
|
2339
2350
|
const t = this.summaries.findIndex((n) => n.id === e);
|
|
2340
2351
|
t > -1 && (this.summaries.splice(t, 1), this.nodes.querySelector("#s-" + e)?.remove(), this.nodes.querySelector("#label-s-" + e)?.remove()), this.bus.fire("operation", {
|
|
2341
2352
|
name: "removeSummary",
|
|
2342
2353
|
obj: { id: e }
|
|
2343
2354
|
});
|
|
2344
|
-
},
|
|
2355
|
+
}, _o = function(e) {
|
|
2345
2356
|
const t = e.labelEl;
|
|
2346
|
-
t && t.classList.add("selected"), this.currentSummary = e;
|
|
2347
|
-
},
|
|
2348
|
-
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
2349
|
-
},
|
|
2357
|
+
t && t.classList.add("selected"), this.currentSummary = e, this.bus.fire("selectSummary", e.summaryObj);
|
|
2358
|
+
}, Lo = function() {
|
|
2359
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
2360
|
+
}, Do = function() {
|
|
2350
2361
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2351
2362
|
try {
|
|
2352
|
-
|
|
2363
|
+
ke(this, e);
|
|
2353
2364
|
} catch {
|
|
2354
2365
|
}
|
|
2355
2366
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2356
|
-
},
|
|
2357
|
-
e && e.labelEl &&
|
|
2358
|
-
},
|
|
2367
|
+
}, Ao = function(e) {
|
|
2368
|
+
e && e.labelEl && rt(this, e.labelEl, e.summaryObj);
|
|
2369
|
+
}, Mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2359
2370
|
__proto__: null,
|
|
2360
|
-
createSummary:
|
|
2361
|
-
createSummaryFrom:
|
|
2362
|
-
editSummary:
|
|
2363
|
-
removeSummary:
|
|
2364
|
-
renderSummary:
|
|
2365
|
-
selectSummary:
|
|
2366
|
-
unselectSummary:
|
|
2367
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2368
|
-
function
|
|
2369
|
-
const n = document.createElementNS(
|
|
2370
|
-
return
|
|
2371
|
+
createSummary: No,
|
|
2372
|
+
createSummaryFrom: To,
|
|
2373
|
+
editSummary: Ao,
|
|
2374
|
+
removeSummary: ko,
|
|
2375
|
+
renderSummary: Do,
|
|
2376
|
+
selectSummary: _o,
|
|
2377
|
+
unselectSummary: Lo
|
|
2378
|
+
}, Symbol.toStringTag, { value: "Module" })), L = "http://www.w3.org/2000/svg";
|
|
2379
|
+
function Oo(e, t) {
|
|
2380
|
+
const n = document.createElementNS(L, "svg");
|
|
2381
|
+
return _(n, {
|
|
2371
2382
|
version: "1.1",
|
|
2372
|
-
xmlns:
|
|
2383
|
+
xmlns: L,
|
|
2373
2384
|
height: e,
|
|
2374
2385
|
width: t
|
|
2375
2386
|
}), n;
|
|
2376
2387
|
}
|
|
2377
|
-
function
|
|
2388
|
+
function Po(e, t) {
|
|
2378
2389
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2379
2390
|
}
|
|
2380
|
-
function
|
|
2381
|
-
const s = document.createElementNS(
|
|
2391
|
+
function $o(e, t, n, o) {
|
|
2392
|
+
const s = document.createElementNS(L, "g");
|
|
2382
2393
|
let i = "";
|
|
2383
2394
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2384
2395
|
`).forEach((c, r) => {
|
|
2385
|
-
const a = document.createElementNS(
|
|
2386
|
-
|
|
2396
|
+
const a = document.createElementNS(L, "text");
|
|
2397
|
+
_(a, {
|
|
2387
2398
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2388
|
-
y: o + parseInt(t.paddingTop) +
|
|
2399
|
+
y: o + parseInt(t.paddingTop) + Po(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
|
|
2389
2400
|
"text-anchor": "start",
|
|
2390
2401
|
"font-family": t.fontFamily,
|
|
2391
2402
|
"font-size": `${t.fontSize}`,
|
|
@@ -2394,25 +2405,25 @@ function jo(e, t, n, o) {
|
|
|
2394
2405
|
}), a.innerHTML = c, s.appendChild(a);
|
|
2395
2406
|
}), s;
|
|
2396
2407
|
}
|
|
2397
|
-
function
|
|
2408
|
+
function Ho(e, t, n, o) {
|
|
2398
2409
|
let s = "";
|
|
2399
2410
|
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2400
|
-
const i = document.createElementNS(
|
|
2401
|
-
|
|
2411
|
+
const i = document.createElementNS(L, "foreignObject");
|
|
2412
|
+
_(i, {
|
|
2402
2413
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2403
2414
|
y: o + parseInt(t.paddingTop) + "",
|
|
2404
2415
|
width: t.width,
|
|
2405
2416
|
height: t.height
|
|
2406
2417
|
});
|
|
2407
2418
|
const l = document.createElement("div");
|
|
2408
|
-
return
|
|
2419
|
+
return _(l, {
|
|
2409
2420
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
2410
2421
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2411
2422
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2412
2423
|
}
|
|
2413
|
-
function
|
|
2414
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2415
|
-
return
|
|
2424
|
+
function jo(e, t) {
|
|
2425
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(L, "rect");
|
|
2426
|
+
return _(i, {
|
|
2416
2427
|
x: o + "",
|
|
2417
2428
|
y: s + "",
|
|
2418
2429
|
rx: n.borderRadius,
|
|
@@ -2424,9 +2435,9 @@ function Ro(e, t) {
|
|
|
2424
2435
|
"stroke-width": n.borderWidth
|
|
2425
2436
|
}), i;
|
|
2426
2437
|
}
|
|
2427
|
-
function
|
|
2428
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2429
|
-
|
|
2438
|
+
function te(e, t, n = !1) {
|
|
2439
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = A(e.nodes, t), l = document.createElementNS(L, "rect");
|
|
2440
|
+
_(l, {
|
|
2430
2441
|
x: s + "",
|
|
2431
2442
|
y: i + "",
|
|
2432
2443
|
rx: o.borderRadius,
|
|
@@ -2437,14 +2448,14 @@ function ie(e, t, n = !1) {
|
|
|
2437
2448
|
stroke: o.borderColor,
|
|
2438
2449
|
"stroke-width": o.borderWidth
|
|
2439
2450
|
});
|
|
2440
|
-
const c = document.createElementNS(
|
|
2451
|
+
const c = document.createElementNS(L, "g");
|
|
2441
2452
|
c.appendChild(l);
|
|
2442
2453
|
let r;
|
|
2443
|
-
return n ? r =
|
|
2454
|
+
return n ? r = Ho(t, o, s, i) : r = $o(t, o, s, i), c.appendChild(r), c;
|
|
2444
2455
|
}
|
|
2445
|
-
function
|
|
2446
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2447
|
-
return
|
|
2456
|
+
function Io(e, t) {
|
|
2457
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(L, "a"), l = document.createElementNS(L, "text");
|
|
2458
|
+
return _(l, {
|
|
2448
2459
|
x: o + "",
|
|
2449
2460
|
y: s + parseInt(n.fontSize) + "",
|
|
2450
2461
|
"text-anchor": "start",
|
|
@@ -2454,9 +2465,9 @@ function Bo(e, t) {
|
|
|
2454
2465
|
fill: `${n.color}`
|
|
2455
2466
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2456
2467
|
}
|
|
2457
|
-
function
|
|
2458
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2459
|
-
return
|
|
2468
|
+
function Ro(e, t) {
|
|
2469
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(L, "image");
|
|
2470
|
+
return _(i, {
|
|
2460
2471
|
x: o + "",
|
|
2461
2472
|
y: s + "",
|
|
2462
2473
|
width: n.width + "",
|
|
@@ -2464,40 +2475,40 @@ function Wo(e, t) {
|
|
|
2464
2475
|
href: t.src
|
|
2465
2476
|
}), i;
|
|
2466
2477
|
}
|
|
2467
|
-
const
|
|
2468
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
2469
|
-
|
|
2478
|
+
const ne = 100, Bo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">', Wo = (e, t = !1) => {
|
|
2479
|
+
const n = e.nodes, o = n.offsetHeight + ne * 2, s = n.offsetWidth + ne * 2, i = Oo(o + "px", s + "px"), l = document.createElementNS(L, "svg"), c = document.createElementNS(L, "rect");
|
|
2480
|
+
_(c, {
|
|
2470
2481
|
x: "0",
|
|
2471
2482
|
y: "0",
|
|
2472
2483
|
width: `${s}`,
|
|
2473
2484
|
height: `${o}`,
|
|
2474
2485
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2475
|
-
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((
|
|
2476
|
-
const u =
|
|
2477
|
-
u.setAttribute("x", `${
|
|
2486
|
+
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((f) => {
|
|
2487
|
+
const u = f.cloneNode(!0), { offsetLeft: b, offsetTop: v } = A(n, f.parentElement);
|
|
2488
|
+
u.setAttribute("x", `${b}`), u.setAttribute("y", `${v}`), l.appendChild(u);
|
|
2478
2489
|
});
|
|
2479
2490
|
const r = n.querySelector(".lines")?.cloneNode(!0);
|
|
2480
2491
|
r && l.appendChild(r);
|
|
2481
2492
|
const a = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
2482
2493
|
a && l.appendChild(a);
|
|
2483
|
-
const
|
|
2484
|
-
return
|
|
2485
|
-
|
|
2486
|
-
}), n.querySelectorAll(".tags > span").forEach((
|
|
2487
|
-
l.appendChild(
|
|
2488
|
-
}), n.querySelectorAll(".icons > span").forEach((
|
|
2489
|
-
l.appendChild(
|
|
2490
|
-
}), n.querySelectorAll(".hyper-link").forEach((
|
|
2491
|
-
l.appendChild(
|
|
2492
|
-
}), n.querySelectorAll("img").forEach((
|
|
2493
|
-
l.appendChild(
|
|
2494
|
-
}),
|
|
2495
|
-
x:
|
|
2496
|
-
y:
|
|
2494
|
+
const h = n.querySelector(".summary")?.cloneNode(!0);
|
|
2495
|
+
return h && l.appendChild(h), n.querySelectorAll("me-tpc").forEach((f) => {
|
|
2496
|
+
f.nodeObj.dangerouslySetInnerHTML ? l.appendChild(te(e, f, !t)) : (l.appendChild(jo(e, f)), l.appendChild(te(e, f.text, !t)));
|
|
2497
|
+
}), n.querySelectorAll(".tags > span").forEach((f) => {
|
|
2498
|
+
l.appendChild(te(e, f));
|
|
2499
|
+
}), n.querySelectorAll(".icons > span").forEach((f) => {
|
|
2500
|
+
l.appendChild(te(e, f));
|
|
2501
|
+
}), n.querySelectorAll(".hyper-link").forEach((f) => {
|
|
2502
|
+
l.appendChild(Io(e, f));
|
|
2503
|
+
}), n.querySelectorAll("img").forEach((f) => {
|
|
2504
|
+
l.appendChild(Ro(e, f));
|
|
2505
|
+
}), _(l, {
|
|
2506
|
+
x: ne + "",
|
|
2507
|
+
y: ne + "",
|
|
2497
2508
|
overflow: "visible"
|
|
2498
2509
|
}), i.appendChild(l), i;
|
|
2499
|
-
},
|
|
2500
|
-
function
|
|
2510
|
+
}, Yo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Bo + e.outerHTML);
|
|
2511
|
+
function Xo(e) {
|
|
2501
2512
|
return new Promise((t, n) => {
|
|
2502
2513
|
const o = new FileReader();
|
|
2503
2514
|
o.onload = (s) => {
|
|
@@ -2507,11 +2518,11 @@ function Go(e) {
|
|
|
2507
2518
|
}, o.readAsDataURL(e);
|
|
2508
2519
|
});
|
|
2509
2520
|
}
|
|
2510
|
-
const
|
|
2511
|
-
const n =
|
|
2521
|
+
const Fo = function(e = !1, t) {
|
|
2522
|
+
const n = Wo(this, e), o = Yo(n, t);
|
|
2512
2523
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2513
|
-
},
|
|
2514
|
-
const n = this.exportSvg(e, t), o = await
|
|
2524
|
+
}, Go = async function(e = !1, t) {
|
|
2525
|
+
const n = this.exportSvg(e, t), o = await Xo(n);
|
|
2515
2526
|
return new Promise((s, i) => {
|
|
2516
2527
|
const l = new Image();
|
|
2517
2528
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
@@ -2519,66 +2530,66 @@ const zo = function(e = !1, t) {
|
|
|
2519
2530
|
c.width = l.width, c.height = l.height, c.getContext("2d").drawImage(l, 0, 0), c.toBlob(s, "image/png", 1);
|
|
2520
2531
|
}, l.src = o, l.onerror = i;
|
|
2521
2532
|
});
|
|
2522
|
-
},
|
|
2533
|
+
}, zo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2523
2534
|
__proto__: null,
|
|
2524
|
-
exportPng:
|
|
2525
|
-
exportSvg:
|
|
2535
|
+
exportPng: Go,
|
|
2536
|
+
exportSvg: Fo
|
|
2526
2537
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2527
|
-
function
|
|
2538
|
+
function Ko(e, t) {
|
|
2528
2539
|
return async function(...n) {
|
|
2529
2540
|
const o = this.before[t];
|
|
2530
2541
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2531
2542
|
};
|
|
2532
2543
|
}
|
|
2533
|
-
const
|
|
2534
|
-
for (let e = 0; e <
|
|
2535
|
-
const t =
|
|
2536
|
-
|
|
2544
|
+
const Ve = Object.keys(ot), ht = {};
|
|
2545
|
+
for (let e = 0; e < Ve.length; e++) {
|
|
2546
|
+
const t = Ve[e];
|
|
2547
|
+
ht[t] = Ko(ot[t], t);
|
|
2537
2548
|
}
|
|
2538
|
-
const
|
|
2539
|
-
getObjById:
|
|
2540
|
-
generateNewObj:
|
|
2541
|
-
layout:
|
|
2542
|
-
linkDiv:
|
|
2543
|
-
editTopic:
|
|
2544
|
-
createWrapper:
|
|
2545
|
-
createParent:
|
|
2546
|
-
createChildren:
|
|
2547
|
-
createTopic:
|
|
2548
|
-
findEle:
|
|
2549
|
-
changeTheme:
|
|
2550
|
-
...
|
|
2551
|
-
...
|
|
2552
|
-
...
|
|
2553
|
-
...
|
|
2554
|
-
...
|
|
2549
|
+
const Vo = {
|
|
2550
|
+
getObjById: oe,
|
|
2551
|
+
generateNewObj: ft,
|
|
2552
|
+
layout: wt,
|
|
2553
|
+
linkDiv: Pn,
|
|
2554
|
+
editTopic: _t,
|
|
2555
|
+
createWrapper: St,
|
|
2556
|
+
createParent: Nt,
|
|
2557
|
+
createChildren: Tt,
|
|
2558
|
+
createTopic: kt,
|
|
2559
|
+
findEle: Ze,
|
|
2560
|
+
changeTheme: oo,
|
|
2561
|
+
...xn,
|
|
2562
|
+
...ht,
|
|
2563
|
+
...xo,
|
|
2564
|
+
...Mo,
|
|
2565
|
+
...zo,
|
|
2555
2566
|
init(e) {
|
|
2556
2567
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2557
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
2568
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, W(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && qn(this), this.keypress && Dn(this, this.keypress), no(this), this.disposable.push(xt()), this.contextMenu && this.disposable.push(Hn(this, this.contextMenu)), this.allowUndo && this.disposable.push(In(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2558
2569
|
},
|
|
2559
2570
|
destroy() {
|
|
2560
2571
|
this.disposable.forEach((e) => e()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
|
|
2561
2572
|
}
|
|
2562
2573
|
};
|
|
2563
|
-
function
|
|
2564
|
-
let
|
|
2565
|
-
const
|
|
2574
|
+
function qo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, containerHeight: a }) {
|
|
2575
|
+
let h = t + n / 2;
|
|
2576
|
+
const f = e + o / 2;
|
|
2566
2577
|
let u;
|
|
2567
|
-
r ===
|
|
2568
|
-
const
|
|
2569
|
-
return r ===
|
|
2578
|
+
r === H.LHS ? u = i + l : u = i;
|
|
2579
|
+
const b = s + c / 2, p = (1 - Math.abs(b - f) / a) * 0.25 * (n / 2);
|
|
2580
|
+
return r === H.LHS ? h = h - n / 10 - p : h = h + n / 10 + p, `M ${h} ${f} Q ${h} ${b} ${u} ${b}`;
|
|
2570
2581
|
}
|
|
2571
|
-
function
|
|
2572
|
-
const
|
|
2573
|
-
let
|
|
2574
|
-
a ?
|
|
2575
|
-
const
|
|
2576
|
-
let
|
|
2577
|
-
const m = Math.abs(
|
|
2578
|
-
return r ===
|
|
2582
|
+
function Uo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, isFirst: a }) {
|
|
2583
|
+
const h = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2584
|
+
let f = 0, u = 0;
|
|
2585
|
+
a ? f = e + o / 2 : f = e + o;
|
|
2586
|
+
const b = s + c;
|
|
2587
|
+
let v = 0, p = 0, g = 0;
|
|
2588
|
+
const m = Math.abs(f - b) / 300 * h;
|
|
2589
|
+
return r === H.LHS ? (g = t, v = g + h, p = g - h, u = i + h, `M ${v} ${f} C ${g} ${f} ${g + m} ${b} ${p} ${b} H ${u}`) : (g = t + n, v = g - h, p = g + h, u = i + l - h, `M ${v} ${f} C ${g} ${f} ${g - m} ${b} ${p} ${b} H ${u}`);
|
|
2579
2590
|
}
|
|
2580
|
-
const
|
|
2581
|
-
function
|
|
2591
|
+
const Jo = "5.11.1-beta.0";
|
|
2592
|
+
function Zo(e) {
|
|
2582
2593
|
return {
|
|
2583
2594
|
x: 0,
|
|
2584
2595
|
y: 0,
|
|
@@ -2593,7 +2604,7 @@ function es(e) {
|
|
|
2593
2604
|
}
|
|
2594
2605
|
};
|
|
2595
2606
|
}
|
|
2596
|
-
function
|
|
2607
|
+
function P({
|
|
2597
2608
|
el: e,
|
|
2598
2609
|
direction: t,
|
|
2599
2610
|
editable: n,
|
|
@@ -2604,55 +2615,55 @@ function j({
|
|
|
2604
2615
|
selectionContainer: c,
|
|
2605
2616
|
before: r,
|
|
2606
2617
|
newTopicName: a,
|
|
2607
|
-
allowUndo:
|
|
2608
|
-
generateMainBranch:
|
|
2618
|
+
allowUndo: h,
|
|
2619
|
+
generateMainBranch: f,
|
|
2609
2620
|
generateSubBranch: u,
|
|
2610
|
-
overflowHidden:
|
|
2611
|
-
theme:
|
|
2621
|
+
overflowHidden: b,
|
|
2622
|
+
theme: v,
|
|
2612
2623
|
alignment: p,
|
|
2613
2624
|
scaleSensitivity: g,
|
|
2614
2625
|
scaleMax: m,
|
|
2615
|
-
scaleMin:
|
|
2626
|
+
scaleMin: x,
|
|
2616
2627
|
handleWheel: E,
|
|
2617
2628
|
markdown: k,
|
|
2618
|
-
imageProxy:
|
|
2629
|
+
imageProxy: T,
|
|
2619
2630
|
pasteHandler: C
|
|
2620
2631
|
}) {
|
|
2621
|
-
let
|
|
2622
|
-
const
|
|
2623
|
-
if (
|
|
2624
|
-
|
|
2625
|
-
const
|
|
2626
|
-
this.theme =
|
|
2627
|
-
const
|
|
2628
|
-
|
|
2632
|
+
let d = null;
|
|
2633
|
+
const y = Object.prototype.toString.call(e);
|
|
2634
|
+
if (y === "[object HTMLDivElement]" ? d = e : y === "[object String]" && (d = document.querySelector(e)), !d) throw new Error("MindElixir: el is not a valid element");
|
|
2635
|
+
d.style.position = "relative", d.innerHTML = "", this.el = d, this.disposable = [], this.before = r || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = t ?? 1, this.editable = n ?? !0, this.allowUndo = h ?? !0, this.scaleSensitivity = g ?? 0.1, this.scaleMax = m ?? 1.4, this.scaleMin = x ?? 0.2, this.generateMainBranch = f || qo, this.generateSubBranch = u || Uo, this.overflowHidden = b ?? !1, this.alignment = p ?? "root", this.handleWheel = E ?? !0, this.markdown = k || void 0, this.imageProxy = T || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.panHelper = Zo(this), this.bus = Mn(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
2636
|
+
const w = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2637
|
+
this.theme = v || (w.matches ? ge : pe);
|
|
2638
|
+
const N = document.createElement("div");
|
|
2639
|
+
N.className = "map-canvas", this.map = N, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = q("lines"), this.summarySvg = q("summary"), this.linkController = q("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = je(), this.line2 = je(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = q("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(An(this)), C && (this.pasteHandler = C);
|
|
2629
2640
|
}
|
|
2630
|
-
|
|
2631
|
-
Object.defineProperty(
|
|
2641
|
+
P.prototype = Vo;
|
|
2642
|
+
Object.defineProperty(P.prototype, "currentNode", {
|
|
2632
2643
|
get() {
|
|
2633
2644
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
2634
2645
|
},
|
|
2635
2646
|
enumerable: !0
|
|
2636
2647
|
});
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2648
|
+
P.LEFT = 0;
|
|
2649
|
+
P.RIGHT = 1;
|
|
2650
|
+
P.SIDE = 2;
|
|
2651
|
+
P.THEME = pe;
|
|
2652
|
+
P.DARK_THEME = ge;
|
|
2653
|
+
P.version = Jo;
|
|
2654
|
+
P.E = Ze;
|
|
2655
|
+
P.new = (e) => ({
|
|
2645
2656
|
nodeData: {
|
|
2646
|
-
id:
|
|
2657
|
+
id: Y(),
|
|
2647
2658
|
topic: e || "new topic",
|
|
2648
2659
|
children: []
|
|
2649
2660
|
}
|
|
2650
2661
|
});
|
|
2651
2662
|
export {
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2663
|
+
ge as DARK_THEME,
|
|
2664
|
+
Qo as LEFT,
|
|
2665
|
+
es as RIGHT,
|
|
2666
|
+
ts as SIDE,
|
|
2667
|
+
pe as THEME,
|
|
2668
|
+
P as default
|
|
2658
2669
|
};
|