mind-elixir 5.5.0 → 5.6.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.css +1 -1
- package/dist/MindElixir.iife.js +6 -6
- package/dist/MindElixir.js +737 -717
- package/dist/MindElixirLite.css +1 -1
- package/dist/MindElixirLite.iife.js +6 -6
- package/dist/MindElixirLite.js +593 -573
- package/dist/example.iife.js +1 -1
- package/dist/example.js +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/MindElixir.js
CHANGED
|
@@ -14,6 +14,7 @@ const Se = {
|
|
|
14
14
|
"--root-border-color": "rgba(0, 0, 0, 0)",
|
|
15
15
|
"--main-color": "#444446",
|
|
16
16
|
"--main-bgcolor": "#ffffff",
|
|
17
|
+
"--main-bgcolor-transparent": "rgba(255, 255, 255, 0.8)",
|
|
17
18
|
"--topic-padding": "3px",
|
|
18
19
|
"--color": "#777777",
|
|
19
20
|
"--bgcolor": "#f6f6f6",
|
|
@@ -40,6 +41,7 @@ const Se = {
|
|
|
40
41
|
"--root-border-color": "rgba(255, 255, 255, 0.1)",
|
|
41
42
|
"--main-color": "#ffffff",
|
|
42
43
|
"--main-bgcolor": "#4c4f69",
|
|
44
|
+
"--main-bgcolor-transparent": "rgba(76, 79, 105, 0.8)",
|
|
43
45
|
"--topic-padding": "3px",
|
|
44
46
|
"--color": "#cccccc",
|
|
45
47
|
"--bgcolor": "#252526",
|
|
@@ -65,16 +67,16 @@ const he = function(e, t) {
|
|
|
65
67
|
return null;
|
|
66
68
|
} else
|
|
67
69
|
return null;
|
|
68
|
-
},
|
|
70
|
+
}, K = (e, t) => {
|
|
69
71
|
if (e.parent = t, e.children)
|
|
70
72
|
for (let n = 0; n < e.children.length; n++)
|
|
71
|
-
|
|
73
|
+
K(e.children[n], e);
|
|
72
74
|
}, Q = (e, t, n) => {
|
|
73
75
|
if (e.expanded = t, e.children)
|
|
74
76
|
if (n === void 0 || n > 0) {
|
|
75
77
|
const o = n !== void 0 ? n - 1 : void 0;
|
|
76
|
-
e.children.forEach((
|
|
77
|
-
Q(
|
|
78
|
+
e.children.forEach((s) => {
|
|
79
|
+
Q(s, t, o);
|
|
78
80
|
});
|
|
79
81
|
} else
|
|
80
82
|
e.children.forEach((o) => {
|
|
@@ -86,17 +88,13 @@ function ke(e) {
|
|
|
86
88
|
for (let t = 0; t < e.children.length; t++)
|
|
87
89
|
ke(e.children[t]);
|
|
88
90
|
}
|
|
89
|
-
function
|
|
90
|
-
const i = o - t, s =
|
|
91
|
-
let l = Math.atan(Math.abs(i) / Math.abs(s)) / 3.14 * 180;
|
|
92
|
-
if (isNaN(l)) return;
|
|
93
|
-
s < 0 && i > 0 && (l = 180 - l), s < 0 && i < 0 && (l = 180 + l), s > 0 && i < 0 && (l = 360 - l);
|
|
94
|
-
const r = 12, c = 30, a = l + c, d = l - c;
|
|
91
|
+
function fe(e, t, n, o) {
|
|
92
|
+
const s = n - e, i = o - t, r = Math.atan2(i, s) * 180 / Math.PI, c = 12, a = 30, d = (r + 180 - a) * Math.PI / 180, h = (r + 180 + a) * Math.PI / 180;
|
|
95
93
|
return {
|
|
96
|
-
x1: n + Math.cos(
|
|
97
|
-
y1: o
|
|
98
|
-
x2: n + Math.cos(
|
|
99
|
-
y2: o
|
|
94
|
+
x1: n + Math.cos(d) * c,
|
|
95
|
+
y1: o + Math.sin(d) * c,
|
|
96
|
+
x2: n + Math.cos(h) * c,
|
|
97
|
+
y2: o + Math.sin(h) * c
|
|
100
98
|
};
|
|
101
99
|
}
|
|
102
100
|
function q() {
|
|
@@ -117,7 +115,7 @@ function Te(e) {
|
|
|
117
115
|
})
|
|
118
116
|
);
|
|
119
117
|
}
|
|
120
|
-
const
|
|
118
|
+
const H = (e, t) => {
|
|
121
119
|
let n = 0, o = 0;
|
|
122
120
|
for (; t && t !== e; )
|
|
123
121
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
@@ -126,31 +124,31 @@ const F = (e, t) => {
|
|
|
126
124
|
for (const n in t)
|
|
127
125
|
e.setAttribute(n, t[n]);
|
|
128
126
|
}, de = (e) => e ? e.tagName === "ME-TPC" : !1, _e = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
129
|
-
for (let
|
|
130
|
-
if (t === o[
|
|
131
|
-
const { parent:
|
|
132
|
-
if (
|
|
127
|
+
for (let s = 0; s < o.length; s++) {
|
|
128
|
+
if (t === o[s]) continue;
|
|
129
|
+
const { parent: i } = t.nodeObj;
|
|
130
|
+
if (i === o[s].nodeObj)
|
|
133
131
|
return !1;
|
|
134
132
|
}
|
|
135
133
|
return !0;
|
|
136
|
-
}),
|
|
134
|
+
}), Le = (e) => {
|
|
137
135
|
const t = /translate3d\(([^,]+),\s*([^,]+)/, n = e.match(t);
|
|
138
136
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
139
137
|
}, nt = function(e) {
|
|
140
138
|
for (let t = 0; t < e.length; t++) {
|
|
141
|
-
const { dom: n, evt: o, func:
|
|
142
|
-
n.addEventListener(o,
|
|
139
|
+
const { dom: n, evt: o, func: s } = e[t];
|
|
140
|
+
n.addEventListener(o, s);
|
|
143
141
|
}
|
|
144
142
|
return function() {
|
|
145
143
|
for (let n = 0; n < e.length; n++) {
|
|
146
|
-
const { dom: o, evt:
|
|
147
|
-
o.removeEventListener(
|
|
144
|
+
const { dom: o, evt: s, func: i } = e[n];
|
|
145
|
+
o.removeEventListener(s, i);
|
|
148
146
|
}
|
|
149
147
|
};
|
|
150
|
-
},
|
|
148
|
+
}, He = (e, t) => {
|
|
151
149
|
const n = e.x - t.x, o = e.y - t.y;
|
|
152
150
|
return Math.sqrt(n * n + o * o);
|
|
153
|
-
},
|
|
151
|
+
}, B = {
|
|
154
152
|
LHS: "lhs",
|
|
155
153
|
RHS: "rhs"
|
|
156
154
|
}, bt = (e) => {
|
|
@@ -161,36 +159,36 @@ const F = (e, t) => {
|
|
|
161
159
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
162
160
|
}, xt = (e) => {
|
|
163
161
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
164
|
-
},
|
|
162
|
+
}, Ct = function(e, t) {
|
|
165
163
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
166
164
|
if (n) {
|
|
167
165
|
const o = n.firstChild;
|
|
168
166
|
e.selectNode(o);
|
|
169
167
|
}
|
|
170
|
-
},
|
|
168
|
+
}, Et = function(e, t) {
|
|
171
169
|
const n = t.parentElement.nextSibling;
|
|
172
170
|
if (n && n.firstChild) {
|
|
173
171
|
const o = n.firstChild.firstChild.firstChild;
|
|
174
172
|
e.selectNode(o);
|
|
175
173
|
}
|
|
176
|
-
},
|
|
174
|
+
}, Re = function(e, t) {
|
|
177
175
|
const n = e.currentNode || e.currentNodes?.[0];
|
|
178
176
|
if (!n) return;
|
|
179
|
-
const o = n.nodeObj,
|
|
180
|
-
o.parent ?
|
|
181
|
-
},
|
|
177
|
+
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
178
|
+
o.parent ? s.className === t ? Et(e, n) : o.parent?.parent ? Ct(e, n) : xt(e) : t === B.LHS ? bt(e) : wt(e);
|
|
179
|
+
}, Be = function(e, t) {
|
|
182
180
|
const n = e.currentNode;
|
|
183
181
|
if (!n || !n.nodeObj.parent) return;
|
|
184
|
-
const
|
|
185
|
-
|
|
182
|
+
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
183
|
+
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
186
184
|
}, J = function(e, t, n) {
|
|
187
|
-
const { scaleVal: o, scaleSensitivity:
|
|
185
|
+
const { scaleVal: o, scaleSensitivity: s } = e;
|
|
188
186
|
switch (t) {
|
|
189
187
|
case "in":
|
|
190
|
-
e.scale(o +
|
|
188
|
+
e.scale(o + s, n);
|
|
191
189
|
break;
|
|
192
190
|
case "out":
|
|
193
|
-
e.scale(o -
|
|
191
|
+
e.scale(o - s, n);
|
|
194
192
|
}
|
|
195
193
|
};
|
|
196
194
|
function St(e, t) {
|
|
@@ -198,8 +196,8 @@ function St(e, t) {
|
|
|
198
196
|
const n = () => {
|
|
199
197
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
200
198
|
};
|
|
201
|
-
let o = !1,
|
|
202
|
-
const
|
|
199
|
+
let o = !1, s = null;
|
|
200
|
+
const i = (r) => {
|
|
203
201
|
const c = e.nodeData;
|
|
204
202
|
if (r.key === "0")
|
|
205
203
|
for (const a of c.children)
|
|
@@ -210,7 +208,7 @@ function St(e, t) {
|
|
|
210
208
|
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
|
|
211
209
|
for (const a of c.children)
|
|
212
210
|
Q(a, !0, Number(r.key) - 1);
|
|
213
|
-
e.refresh(), e.toCenter(), o = !1,
|
|
211
|
+
e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
|
|
214
212
|
}, l = {
|
|
215
213
|
Enter: (r) => {
|
|
216
214
|
r.shiftKey ? e.insertSibling("before") : r.ctrlKey || r.metaKey ? e.insertParent() : e.insertSibling("after");
|
|
@@ -230,21 +228,21 @@ function St(e, t) {
|
|
|
230
228
|
else {
|
|
231
229
|
if (r.metaKey || r.ctrlKey)
|
|
232
230
|
return e.initSide();
|
|
233
|
-
|
|
231
|
+
Be(e, "previous");
|
|
234
232
|
}
|
|
235
233
|
},
|
|
236
234
|
ArrowDown: (r) => {
|
|
237
|
-
r.altKey ? e.moveDownNode() :
|
|
235
|
+
r.altKey ? e.moveDownNode() : Be(e, "next");
|
|
238
236
|
},
|
|
239
237
|
ArrowLeft: (r) => {
|
|
240
238
|
if (r.metaKey || r.ctrlKey)
|
|
241
239
|
return e.initLeft();
|
|
242
|
-
|
|
240
|
+
Re(e, B.LHS);
|
|
243
241
|
},
|
|
244
242
|
ArrowRight: (r) => {
|
|
245
243
|
if (r.metaKey || r.ctrlKey)
|
|
246
244
|
return e.initRight();
|
|
247
|
-
|
|
245
|
+
Re(e, B.RHS);
|
|
248
246
|
},
|
|
249
247
|
PageUp: () => e.moveUpNode(),
|
|
250
248
|
PageDown: () => {
|
|
@@ -273,9 +271,9 @@ function St(e, t) {
|
|
|
273
271
|
}
|
|
274
272
|
},
|
|
275
273
|
k: (r) => {
|
|
276
|
-
(r.metaKey || r.ctrlKey) && (o = !0,
|
|
277
|
-
o = !1,
|
|
278
|
-
}, 2e3), e.container.addEventListener("keydown",
|
|
274
|
+
(r.metaKey || r.ctrlKey) && (o = !0, s && (clearTimeout(s), e.container.removeEventListener("keydown", i)), s = window.setTimeout(() => {
|
|
275
|
+
o = !1, s = null;
|
|
276
|
+
}, 2e3), e.container.addEventListener("keydown", i));
|
|
279
277
|
},
|
|
280
278
|
Delete: n,
|
|
281
279
|
Backspace: n,
|
|
@@ -298,7 +296,7 @@ const xe = document, Nt = function(e, t) {
|
|
|
298
296
|
const t = e.querySelectorAll(".insert-preview");
|
|
299
297
|
for (const n of t || [])
|
|
300
298
|
n.remove();
|
|
301
|
-
},
|
|
299
|
+
}, Ie = function(e, t) {
|
|
302
300
|
for (const n of t) {
|
|
303
301
|
const o = n.parentElement.parentElement.contains(e);
|
|
304
302
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
@@ -338,45 +336,45 @@ function _t(e) {
|
|
|
338
336
|
};
|
|
339
337
|
}
|
|
340
338
|
const Lt = 5;
|
|
341
|
-
function
|
|
339
|
+
function Fe(e, t, n, o = !1) {
|
|
342
340
|
if (e.spacePressed) return !1;
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
341
|
+
const s = n.target;
|
|
342
|
+
if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
|
|
345
343
|
t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.selection.cancel();
|
|
346
|
-
let
|
|
347
|
-
return
|
|
344
|
+
let i = e.currentNodes;
|
|
345
|
+
return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o && st(e, t), !0;
|
|
348
346
|
}
|
|
349
347
|
function ot(e, t, n) {
|
|
350
348
|
e.style.transform = `translate(${t + 10}px, ${n + 10}px)`, e.style.display = "block";
|
|
351
349
|
}
|
|
352
|
-
function
|
|
350
|
+
function st(e, t) {
|
|
353
351
|
const { dragged: n } = e;
|
|
354
352
|
if (!n) return;
|
|
355
353
|
const o = document.activeElement;
|
|
356
354
|
o && o.isContentEditable && o.blur(), t.isDragging = !0, n.length > 1 ? t.ghost.innerHTML = n.length + "" : t.ghost.innerHTML = n[0].innerHTML;
|
|
357
|
-
for (const
|
|
358
|
-
|
|
355
|
+
for (const s of n)
|
|
356
|
+
s.parentElement.parentElement.style.opacity = "0.5";
|
|
359
357
|
e.dragMoveHelper.clear();
|
|
360
358
|
}
|
|
361
359
|
function At(e, t, n) {
|
|
362
360
|
const { dragged: o } = e;
|
|
363
361
|
if (!o || t.pointerId !== n.pointerId) return;
|
|
364
|
-
const
|
|
365
|
-
if (!t.isDragging && l > Lt &&
|
|
362
|
+
const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i);
|
|
363
|
+
if (!t.isDragging && l > Lt && st(e, t), !t.isDragging) return;
|
|
366
364
|
ot(t.ghost, n.clientX, n.clientY);
|
|
367
365
|
const r = e.container.getBoundingClientRect();
|
|
368
366
|
n.clientX < r.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > r.x + r.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < r.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > r.y + r.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(), ge(t.meet);
|
|
369
367
|
const c = 12 * e.scaleVal, a = xe.elementFromPoint(n.clientX, n.clientY - c);
|
|
370
|
-
if (
|
|
368
|
+
if (Ie(a, o)) {
|
|
371
369
|
t.meet = a;
|
|
372
370
|
const d = a.getBoundingClientRect(), h = d.y;
|
|
373
371
|
n.clientY > h + d.height ? t.insertType = "after" : t.insertType = "in";
|
|
374
372
|
} else {
|
|
375
373
|
const d = xe.elementFromPoint(n.clientX, n.clientY + c);
|
|
376
|
-
if (
|
|
374
|
+
if (Ie(d, o)) {
|
|
377
375
|
t.meet = d;
|
|
378
|
-
const
|
|
379
|
-
n.clientY <
|
|
376
|
+
const u = d.getBoundingClientRect().y;
|
|
377
|
+
n.clientY < u ? t.insertType = "before" : t.insertType = "in";
|
|
380
378
|
} else
|
|
381
379
|
t.insertType = null, t.meet = null;
|
|
382
380
|
}
|
|
@@ -386,8 +384,8 @@ function Mt(e, t, n) {
|
|
|
386
384
|
const { dragged: o } = e;
|
|
387
385
|
if (!(!o || t.pointerId !== n.pointerId)) {
|
|
388
386
|
t.edgeMoveController.stop();
|
|
389
|
-
for (const
|
|
390
|
-
|
|
387
|
+
for (const s of o)
|
|
388
|
+
s.parentElement.parentElement.style.opacity = "1";
|
|
391
389
|
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (ge(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;
|
|
392
390
|
}
|
|
393
391
|
}
|
|
@@ -409,36 +407,36 @@ function Pt(e) {
|
|
|
409
407
|
let n = 0;
|
|
410
408
|
e.spacePressed = !1;
|
|
411
409
|
let o = null;
|
|
412
|
-
const
|
|
410
|
+
const s = /* @__PURE__ */ new Map(), i = e.draggable ? _t(e) : null;
|
|
413
411
|
let l = null, r = null, c = null, a = null;
|
|
414
|
-
const d = 500, h = 10,
|
|
412
|
+
const d = 500, h = 10, u = () => {
|
|
415
413
|
l !== null && (clearTimeout(l), l = null, r = null, c = null, a = null);
|
|
416
|
-
}, y = (
|
|
417
|
-
|
|
418
|
-
}, v = (
|
|
419
|
-
const k =
|
|
414
|
+
}, y = (f, w) => {
|
|
415
|
+
f.hasPointerCapture && f.hasPointerCapture(w) && f.releasePointerCapture(w);
|
|
416
|
+
}, v = (f, w) => {
|
|
417
|
+
const k = f.closest(".svg-label");
|
|
420
418
|
if (k) {
|
|
421
|
-
const M = k.dataset.svgId,
|
|
419
|
+
const M = k.dataset.svgId, ie = k.dataset.type, ne = document.getElementById(M);
|
|
422
420
|
if (ne) {
|
|
423
|
-
if (
|
|
421
|
+
if (ie === "arrow")
|
|
424
422
|
return w ? e.editArrowLabel(ne) : e.selectArrow(ne), !0;
|
|
425
|
-
if (
|
|
423
|
+
if (ie === "summary")
|
|
426
424
|
return w ? e.editSummary(ne) : e.selectSummary(ne), !0;
|
|
427
425
|
}
|
|
428
426
|
}
|
|
429
|
-
if (
|
|
430
|
-
const M =
|
|
427
|
+
if (f.closest(".topiclinks")) {
|
|
428
|
+
const M = f.closest("g");
|
|
431
429
|
if (M)
|
|
432
430
|
return w ? e.editArrowLabel(M) : e.selectArrow(M), !0;
|
|
433
431
|
}
|
|
434
|
-
if (
|
|
435
|
-
const M =
|
|
432
|
+
if (f.closest(".summary")) {
|
|
433
|
+
const M = f.closest("g");
|
|
436
434
|
if (M)
|
|
437
435
|
return w ? e.editSummary(M) : e.selectSummary(M), !0;
|
|
438
436
|
}
|
|
439
437
|
return !1;
|
|
440
|
-
}, p = (
|
|
441
|
-
if (
|
|
438
|
+
}, p = (f) => {
|
|
439
|
+
if (f.button !== 0) return;
|
|
442
440
|
if (e.helper1?.moved) {
|
|
443
441
|
e.helper1.clear();
|
|
444
442
|
return;
|
|
@@ -451,115 +449,115 @@ function Pt(e) {
|
|
|
451
449
|
t.clear();
|
|
452
450
|
return;
|
|
453
451
|
}
|
|
454
|
-
if (
|
|
452
|
+
if (i?.isDragging)
|
|
455
453
|
return;
|
|
456
|
-
const w =
|
|
454
|
+
const w = f.target;
|
|
457
455
|
if (w.tagName === "ME-EPD")
|
|
458
|
-
|
|
456
|
+
f.ctrlKey || f.metaKey ? e.expandNodeAll(w.previousSibling) : e.expandNode(w.previousSibling);
|
|
459
457
|
else if (w.tagName === "ME-TPC" && e.currentNodes.length > 1)
|
|
460
458
|
e.selectNode(w);
|
|
461
459
|
else if (!e.editable)
|
|
462
460
|
return;
|
|
463
461
|
v(w, !1);
|
|
464
|
-
},
|
|
462
|
+
}, g = (f) => {
|
|
465
463
|
if (!e.editable) return;
|
|
466
|
-
const w =
|
|
464
|
+
const w = f.target;
|
|
467
465
|
de(w) && e.beginEdit(w), v(w, !0);
|
|
468
|
-
},
|
|
469
|
-
if (
|
|
466
|
+
}, m = (f) => {
|
|
467
|
+
if (f.pointerType === "mouse" || s.size > 1) return;
|
|
470
468
|
const w = (/* @__PURE__ */ new Date()).getTime(), k = w - n;
|
|
471
|
-
k < 300 && k > 0 &&
|
|
472
|
-
}, b = (
|
|
473
|
-
|
|
474
|
-
}, x = (
|
|
475
|
-
|
|
476
|
-
}, L = (
|
|
477
|
-
if (
|
|
478
|
-
const [M,
|
|
479
|
-
o =
|
|
469
|
+
k < 300 && k > 0 && g(f), n = w;
|
|
470
|
+
}, b = (f) => {
|
|
471
|
+
f.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"));
|
|
472
|
+
}, x = (f) => {
|
|
473
|
+
f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
474
|
+
}, L = (f) => {
|
|
475
|
+
if (f.pointerType === "touch" && (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), s.size === 2)) {
|
|
476
|
+
const [M, ie] = Array.from(s.values());
|
|
477
|
+
o = He(M, ie), u();
|
|
480
478
|
}
|
|
481
479
|
t.moved = !1;
|
|
482
|
-
const w =
|
|
483
|
-
if (
|
|
484
|
-
if (
|
|
485
|
-
(
|
|
486
|
-
else if (
|
|
487
|
-
(de(w) || w.closest("me-tpc")) && (r = { x:
|
|
488
|
-
|
|
480
|
+
const w = f.target, k = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
481
|
+
if (i && (f.button === 0 || f.pointerType === "touch")) {
|
|
482
|
+
if (f.pointerType === "touch" && s.size > 1)
|
|
483
|
+
(i.isDragging || i.pointerId !== null) && ve(e, i);
|
|
484
|
+
else if (f.pointerType === "touch" && s.size === 1)
|
|
485
|
+
(de(w) || w.closest("me-tpc")) && (r = { x: f.clientX, y: f.clientY }, c = w, a = f.pointerId, l = window.setTimeout(() => {
|
|
486
|
+
Fe(e, i, f, !0) && (c && c.setPointerCapture(f.pointerId), ot(i.ghost, f.clientX, f.clientY)), l = null, r = null, c = null, a = null;
|
|
489
487
|
}, d));
|
|
490
|
-
else if (
|
|
491
|
-
w.setPointerCapture(
|
|
488
|
+
else if (f.pointerType === "mouse" && Fe(e, i, f, !1)) {
|
|
489
|
+
w.setPointerCapture(f.pointerId);
|
|
492
490
|
return;
|
|
493
491
|
}
|
|
494
492
|
}
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
},
|
|
498
|
-
if (
|
|
499
|
-
if (
|
|
500
|
-
const w =
|
|
501
|
-
Math.sqrt(w * w + k * k) > h &&
|
|
493
|
+
const $ = e.spacePressed && f.button === 0 && f.pointerType === "mouse", Y = f.button === k && f.pointerType === "mouse" || f.pointerType === "touch";
|
|
494
|
+
!$ && !Y || (t.x = f.clientX, t.y = f.clientY, w.className !== "circle" && w.contentEditable !== "plaintext-only" && (t.mousedown = !0, w.setPointerCapture(f.pointerId)));
|
|
495
|
+
}, T = (f) => {
|
|
496
|
+
if (f.pointerType === "touch" && s.has(f.pointerId)) {
|
|
497
|
+
if (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), l !== null && r !== null && f.pointerId === a) {
|
|
498
|
+
const w = f.clientX - r.x, k = f.clientY - r.y;
|
|
499
|
+
Math.sqrt(w * w + k * k) > h && u();
|
|
502
500
|
}
|
|
503
|
-
if (
|
|
504
|
-
const [w, k] = Array.from(
|
|
501
|
+
if (s.size >= 2) {
|
|
502
|
+
const [w, k] = Array.from(s.values()), $ = He(w, k);
|
|
505
503
|
if (o == null)
|
|
506
|
-
o =
|
|
504
|
+
o = $;
|
|
507
505
|
else {
|
|
508
|
-
const Y =
|
|
506
|
+
const Y = $ - o;
|
|
509
507
|
Math.abs(Y) > 8 && (Y > 0 ? J(e, "in", {
|
|
510
508
|
x: (w.x + k.x) / 2,
|
|
511
509
|
y: (w.y + k.y) / 2
|
|
512
510
|
}) : J(e, "out", {
|
|
513
511
|
x: (w.x + k.x) / 2,
|
|
514
512
|
y: (w.y + k.y) / 2
|
|
515
|
-
}), o =
|
|
513
|
+
}), o = $);
|
|
516
514
|
}
|
|
517
515
|
return;
|
|
518
516
|
}
|
|
519
517
|
}
|
|
520
|
-
if (!(
|
|
521
|
-
if (
|
|
522
|
-
const w =
|
|
518
|
+
if (!(i && i.pointerId !== null && (At(e, i, f), i.isDragging))) {
|
|
519
|
+
if (f.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
|
|
520
|
+
const w = f.clientX - t.x, k = f.clientY - t.y;
|
|
523
521
|
t.onMove(w, k);
|
|
524
522
|
}
|
|
525
|
-
t.x =
|
|
523
|
+
t.x = f.clientX, t.y = f.clientY;
|
|
526
524
|
}
|
|
527
|
-
},
|
|
528
|
-
if (
|
|
529
|
-
const w =
|
|
530
|
-
if (Mt(e,
|
|
525
|
+
}, E = (f) => {
|
|
526
|
+
if (f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) {
|
|
527
|
+
const w = i.isDragging;
|
|
528
|
+
if (Mt(e, i, f), y(f.target, f.pointerId), w)
|
|
531
529
|
return;
|
|
532
530
|
}
|
|
533
|
-
t.mousedown && (y(
|
|
534
|
-
},
|
|
535
|
-
|
|
536
|
-
}, S = (
|
|
537
|
-
|
|
538
|
-
}, N = (
|
|
539
|
-
if (
|
|
540
|
-
const w =
|
|
531
|
+
t.mousedown && (y(f.target, f.pointerId), t.clear());
|
|
532
|
+
}, C = () => {
|
|
533
|
+
u(), t.mousedown && t.clear(), i && (i.isDragging || i.pointerId !== null) && ve(e, i);
|
|
534
|
+
}, S = (f) => {
|
|
535
|
+
f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === f.pointerId && ve(e, i), E(f);
|
|
536
|
+
}, N = (f) => {
|
|
537
|
+
if (f.preventDefault(), f.button !== 2 || !e.editable) return;
|
|
538
|
+
const w = f.target;
|
|
541
539
|
de(w) && !w.classList.contains("selected") && e.selectNode(w), setTimeout(() => {
|
|
542
|
-
e.dragMoveHelper.moved || e.bus.fire("showContextMenu",
|
|
540
|
+
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", f);
|
|
543
541
|
}, 200);
|
|
544
|
-
}, D = (
|
|
545
|
-
|
|
546
|
-
}, { container:
|
|
542
|
+
}, D = (f) => {
|
|
543
|
+
f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey ? f.deltaY < 0 ? J(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && J(e, "out", e.dragMoveHelper) : f.shiftKey ? e.move(-f.deltaY, 0) : e.move(-f.deltaX, -f.deltaY);
|
|
544
|
+
}, { container: _ } = e;
|
|
547
545
|
return nt([
|
|
548
|
-
{ dom:
|
|
549
|
-
{ dom:
|
|
550
|
-
{ dom:
|
|
551
|
-
{ dom:
|
|
552
|
-
{ dom:
|
|
553
|
-
{ dom:
|
|
554
|
-
{ dom:
|
|
555
|
-
{ dom:
|
|
556
|
-
{ dom:
|
|
557
|
-
{ dom:
|
|
558
|
-
{ dom:
|
|
559
|
-
{ dom:
|
|
546
|
+
{ dom: _, evt: "pointerdown", func: L },
|
|
547
|
+
{ dom: _, evt: "pointermove", func: T },
|
|
548
|
+
{ dom: _, evt: "pointerup", func: E },
|
|
549
|
+
{ dom: _, evt: "pointercancel", func: S },
|
|
550
|
+
{ dom: _, evt: "pointerdown", func: m },
|
|
551
|
+
{ dom: _, evt: "click", func: p },
|
|
552
|
+
{ dom: _, evt: "dblclick", func: g },
|
|
553
|
+
{ dom: _, evt: "contextmenu", func: N },
|
|
554
|
+
{ dom: _, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : D },
|
|
555
|
+
{ dom: _, evt: "blur", func: C },
|
|
556
|
+
{ dom: _, evt: "keydown", func: b },
|
|
557
|
+
{ dom: _, evt: "keyup", func: x }
|
|
560
558
|
]);
|
|
561
559
|
}
|
|
562
|
-
function
|
|
560
|
+
function Ot() {
|
|
563
561
|
return {
|
|
564
562
|
handlers: {},
|
|
565
563
|
addListener: function(e, t) {
|
|
@@ -583,42 +581,42 @@ function $t() {
|
|
|
583
581
|
}
|
|
584
582
|
};
|
|
585
583
|
}
|
|
586
|
-
const
|
|
584
|
+
const ue = document, $t = function() {
|
|
587
585
|
this.nodes.innerHTML = "";
|
|
588
586
|
const e = this.createTopic(this.nodeData);
|
|
589
|
-
|
|
590
|
-
const t =
|
|
587
|
+
Ae.call(this, e, this.nodeData), e.draggable = !1;
|
|
588
|
+
const t = ue.createElement("me-root");
|
|
591
589
|
t.appendChild(e);
|
|
592
590
|
const n = this.nodeData.children || [];
|
|
593
591
|
if (this.direction === 2) {
|
|
594
|
-
let o = 0,
|
|
595
|
-
n.map((
|
|
596
|
-
|
|
592
|
+
let o = 0, s = 0;
|
|
593
|
+
n.map((i) => {
|
|
594
|
+
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
597
595
|
});
|
|
598
596
|
}
|
|
599
597
|
jt(this, n, t);
|
|
600
598
|
}, jt = function(e, t, n) {
|
|
601
|
-
const o =
|
|
602
|
-
o.className =
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
for (let
|
|
606
|
-
const l = t[
|
|
607
|
-
e.direction === 2 ? l.direction === 0 ? o.appendChild(r) :
|
|
608
|
-
}
|
|
609
|
-
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(
|
|
599
|
+
const o = ue.createElement("me-main");
|
|
600
|
+
o.className = B.LHS;
|
|
601
|
+
const s = ue.createElement("me-main");
|
|
602
|
+
s.className = B.RHS;
|
|
603
|
+
for (let i = 0; i < t.length; i++) {
|
|
604
|
+
const l = t[i], { grp: r } = e.createWrapper(l);
|
|
605
|
+
e.direction === 2 ? l.direction === 0 ? o.appendChild(r) : s.appendChild(r) : e.direction === 0 ? o.appendChild(r) : s.appendChild(r);
|
|
606
|
+
}
|
|
607
|
+
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
|
|
610
608
|
}, Ht = function(e, t) {
|
|
611
|
-
const n =
|
|
609
|
+
const n = ue.createElement("me-children");
|
|
612
610
|
for (let o = 0; o < t.length; o++) {
|
|
613
|
-
const
|
|
614
|
-
n.appendChild(
|
|
611
|
+
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
612
|
+
n.appendChild(i);
|
|
615
613
|
}
|
|
616
614
|
return n;
|
|
617
|
-
}, P = document,
|
|
615
|
+
}, P = document, it = function(e, t) {
|
|
618
616
|
const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
619
617
|
if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
620
618
|
return o;
|
|
621
|
-
},
|
|
619
|
+
}, Ae = function(e, t) {
|
|
622
620
|
if (e.innerHTML = "", t.style) {
|
|
623
621
|
const n = t.style;
|
|
624
622
|
for (const o in n)
|
|
@@ -650,24 +648,24 @@ const fe = document, Ot = function() {
|
|
|
650
648
|
if (t.tags && t.tags.length) {
|
|
651
649
|
const n = P.createElement("div");
|
|
652
650
|
n.className = "tags", t.tags.forEach((o) => {
|
|
653
|
-
const
|
|
654
|
-
typeof o == "string" ?
|
|
651
|
+
const s = P.createElement("span");
|
|
652
|
+
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);
|
|
655
653
|
}), e.appendChild(n), e.tags = n;
|
|
656
654
|
} else e.tags && (e.tags = void 0);
|
|
657
|
-
},
|
|
658
|
-
const n = P.createElement("me-wrapper"), { p: o, tpc:
|
|
655
|
+
}, Rt = function(e, t) {
|
|
656
|
+
const n = P.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
659
657
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
660
|
-
const
|
|
661
|
-
if (o.appendChild(
|
|
658
|
+
const i = Me(e.expanded);
|
|
659
|
+
if (o.appendChild(i), e.expanded !== !1) {
|
|
662
660
|
const l = Ht(this, e.children);
|
|
663
661
|
n.appendChild(l);
|
|
664
662
|
}
|
|
665
663
|
}
|
|
666
|
-
return { grp: n, top: o, tpc:
|
|
664
|
+
return { grp: n, top: o, tpc: s };
|
|
667
665
|
}, Bt = function(e) {
|
|
668
666
|
const t = P.createElement("me-parent"), n = this.createTopic(e);
|
|
669
|
-
return
|
|
670
|
-
},
|
|
667
|
+
return Ae.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
668
|
+
}, It = function(e) {
|
|
671
669
|
const t = P.createElement("me-children");
|
|
672
670
|
return t.append(...e), t;
|
|
673
671
|
}, Ft = function(e) {
|
|
@@ -682,12 +680,12 @@ function rt(e) {
|
|
|
682
680
|
}
|
|
683
681
|
const Yt = function(e) {
|
|
684
682
|
if (!e) return;
|
|
685
|
-
const t = P.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft:
|
|
683
|
+
const t = P.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = H(this.nodes, e);
|
|
686
684
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
687
685
|
const l = getComputedStyle(e);
|
|
688
686
|
t.style.cssText = `
|
|
689
|
-
left: ${
|
|
690
|
-
top: ${
|
|
687
|
+
left: ${s}px;
|
|
688
|
+
top: ${i}px;
|
|
691
689
|
min-width:${e.offsetWidth - 8}px;
|
|
692
690
|
color:${l.color};
|
|
693
691
|
font-size:${l.fontSize};
|
|
@@ -715,20 +713,20 @@ const Yt = function(e) {
|
|
|
715
713
|
origin: o
|
|
716
714
|
}));
|
|
717
715
|
});
|
|
718
|
-
},
|
|
716
|
+
}, Me = function(e) {
|
|
719
717
|
const t = P.createElement("me-epd");
|
|
720
718
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
721
|
-
}, ee = document,
|
|
722
|
-
const t = e.clientWidth, n = e.clientHeight, o = e.dataset,
|
|
723
|
-
let r =
|
|
724
|
-
l === "middle" ? r =
|
|
725
|
-
},
|
|
726
|
-
const { anchor:
|
|
727
|
-
c.className = "svg-label", c.style.color =
|
|
719
|
+
}, ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
|
|
720
|
+
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
721
|
+
let r = s;
|
|
722
|
+
l === "middle" ? r = s - t / 2 : l === "end" && (r = s - t), e.style.left = `${r}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
|
|
723
|
+
}, Ce = function(e, t, n, o) {
|
|
724
|
+
const { anchor: s = "middle", color: i, dataType: l, svgId: r } = o, c = document.createElement("div");
|
|
725
|
+
c.className = "svg-label", c.style.color = i || "#666";
|
|
728
726
|
const a = "label-" + r;
|
|
729
|
-
return c.id = a, c.innerHTML = e, c.dataset.type = l, c.dataset.svgId = r, c.dataset.x = t.toString(), c.dataset.y = n.toString(), c.dataset.anchor =
|
|
727
|
+
return c.id = a, c.innerHTML = e, c.dataset.type = l, c.dataset.svgId = r, c.dataset.x = t.toString(), c.dataset.y = n.toString(), c.dataset.anchor = s, c;
|
|
730
728
|
}, lt = function(e, t, n) {
|
|
731
|
-
const o = ee.createElementNS(
|
|
729
|
+
const o = ee.createElementNS(R, "path");
|
|
732
730
|
return A(o, {
|
|
733
731
|
d: e,
|
|
734
732
|
stroke: t || "#666",
|
|
@@ -736,13 +734,13 @@ const Yt = function(e) {
|
|
|
736
734
|
"stroke-width": n
|
|
737
735
|
}), o;
|
|
738
736
|
}, oe = function(e) {
|
|
739
|
-
const t = ee.createElementNS(
|
|
737
|
+
const t = ee.createElementNS(R, "svg");
|
|
740
738
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
741
|
-
},
|
|
742
|
-
const e = ee.createElementNS(
|
|
739
|
+
}, Ye = function() {
|
|
740
|
+
const e = ee.createElementNS(R, "line");
|
|
743
741
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
744
742
|
}, Wt = function(e, t, n, o) {
|
|
745
|
-
const
|
|
743
|
+
const s = ee.createElementNS(R, "g");
|
|
746
744
|
return [
|
|
747
745
|
{
|
|
748
746
|
name: "line",
|
|
@@ -757,7 +755,7 @@ const Yt = function(e) {
|
|
|
757
755
|
d: n
|
|
758
756
|
}
|
|
759
757
|
].forEach((l, r) => {
|
|
760
|
-
const c = l.d, a = ee.createElementNS(
|
|
758
|
+
const c = l.d, a = ee.createElementNS(R, "path"), d = {
|
|
761
759
|
d: c,
|
|
762
760
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
763
761
|
fill: "none",
|
|
@@ -765,32 +763,32 @@ const Yt = function(e) {
|
|
|
765
763
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
766
764
|
};
|
|
767
765
|
o?.opacity !== void 0 && (d.opacity = String(o.opacity)), A(a, d), r === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
768
|
-
const h = ee.createElementNS(
|
|
766
|
+
const h = ee.createElementNS(R, "path");
|
|
769
767
|
A(h, {
|
|
770
768
|
d: c,
|
|
771
769
|
stroke: "transparent",
|
|
772
770
|
fill: "none",
|
|
773
771
|
"stroke-width": "15"
|
|
774
|
-
}),
|
|
775
|
-
}),
|
|
772
|
+
}), s.appendChild(h), s.appendChild(a), s[l.name] = a;
|
|
773
|
+
}), s;
|
|
776
774
|
}, ct = function(e, t, n) {
|
|
777
775
|
if (!t) return;
|
|
778
|
-
const o = n.label,
|
|
779
|
-
e.nodes.appendChild(
|
|
776
|
+
const o = n.label, s = t.cloneNode(!0);
|
|
777
|
+
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
780
778
|
left:${t.style.left};
|
|
781
779
|
top:${t.style.top};
|
|
782
780
|
max-width: 200px;
|
|
783
|
-
`, rt(
|
|
784
|
-
|
|
785
|
-
const l =
|
|
781
|
+
`, rt(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
782
|
+
i.stopPropagation();
|
|
783
|
+
const l = i.key;
|
|
786
784
|
if (l === "Enter" || l === "Tab") {
|
|
787
|
-
if (
|
|
788
|
-
|
|
785
|
+
if (i.shiftKey) return;
|
|
786
|
+
i.preventDefault(), s.blur(), e.container.focus();
|
|
789
787
|
}
|
|
790
|
-
}),
|
|
791
|
-
if (!
|
|
792
|
-
const
|
|
793
|
-
|
|
788
|
+
}), s.addEventListener("blur", () => {
|
|
789
|
+
if (!s) return;
|
|
790
|
+
const i = s.textContent?.trim() || "";
|
|
791
|
+
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label, me(t), "parent" in n ? e.bus.fire("operation", {
|
|
794
792
|
name: "finishEditSummary",
|
|
795
793
|
obj: n
|
|
796
794
|
}) : e.bus.fire("operation", {
|
|
@@ -798,32 +796,32 @@ const Yt = function(e) {
|
|
|
798
796
|
obj: n
|
|
799
797
|
}));
|
|
800
798
|
});
|
|
801
|
-
},
|
|
802
|
-
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft,
|
|
799
|
+
}, Xt = function(e) {
|
|
800
|
+
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");
|
|
803
801
|
this.lines.innerHTML = "";
|
|
804
802
|
for (let r = 0; r < l.length; r++) {
|
|
805
|
-
const c = l[r], a = c.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } =
|
|
806
|
-
if (a.style.borderColor =
|
|
803
|
+
const c = l[r], a = c.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = H(this.nodes, a), u = a.offsetWidth, y = a.offsetHeight, v = c.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: y, direction: v, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[r % g.length];
|
|
804
|
+
if (a.style.borderColor = m, this.lines.appendChild(lt(p, m, "3")), e && e !== c)
|
|
807
805
|
continue;
|
|
808
806
|
const b = oe("subLines"), x = c.lastChild;
|
|
809
|
-
x.tagName === "svg" && x.remove(), c.appendChild(b), at(this, b,
|
|
807
|
+
x.tagName === "svg" && x.remove(), c.appendChild(b), at(this, b, m, c, v, !0);
|
|
810
808
|
}
|
|
811
809
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
812
|
-
}, at = function(e, t, n, o,
|
|
810
|
+
}, at = function(e, t, n, o, s, i) {
|
|
813
811
|
const l = o.firstChild, r = o.children[1].children;
|
|
814
812
|
if (r.length === 0) return;
|
|
815
813
|
const c = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
|
|
816
|
-
for (let
|
|
817
|
-
const y = r[
|
|
814
|
+
for (let u = 0; u < r.length; u++) {
|
|
815
|
+
const y = r[u], v = y.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, b = v.offsetHeight, x = v.firstChild.nodeObj.branchColor || n, L = e.generateSubBranch({ pT: c, pL: a, pW: d, pH: h, cT: p, cL: g, cW: m, cH: b, direction: s, isFirst: i });
|
|
818
816
|
t.appendChild(lt(L, x, "2"));
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
821
|
-
if (!
|
|
817
|
+
const T = v.children[1];
|
|
818
|
+
if (T) {
|
|
819
|
+
if (!T.expanded) continue;
|
|
822
820
|
} else
|
|
823
821
|
continue;
|
|
824
|
-
at(e, t, x, y,
|
|
822
|
+
at(e, t, x, y, s);
|
|
825
823
|
}
|
|
826
|
-
},
|
|
824
|
+
}, We = {
|
|
827
825
|
addChild: "插入子节点",
|
|
828
826
|
addParent: "插入父节点",
|
|
829
827
|
addSibling: "插入同级节点",
|
|
@@ -836,9 +834,9 @@ const Yt = function(e) {
|
|
|
836
834
|
linkBidirectional: "双向连接",
|
|
837
835
|
clickTips: "请点击目标节点",
|
|
838
836
|
summary: "摘要"
|
|
839
|
-
},
|
|
840
|
-
cn:
|
|
841
|
-
zh_CN:
|
|
837
|
+
}, Xe = {
|
|
838
|
+
cn: We,
|
|
839
|
+
zh_CN: We,
|
|
842
840
|
zh_TW: {
|
|
843
841
|
addChild: "插入子節點",
|
|
844
842
|
addParent: "插入父節點",
|
|
@@ -980,38 +978,38 @@ const Yt = function(e) {
|
|
|
980
978
|
summary: "Rezumat"
|
|
981
979
|
}
|
|
982
980
|
};
|
|
983
|
-
function
|
|
981
|
+
function zt(e, t) {
|
|
984
982
|
t = t === !0 ? {
|
|
985
983
|
focus: !0,
|
|
986
984
|
link: !0
|
|
987
985
|
} : t;
|
|
988
|
-
const n = (
|
|
989
|
-
const
|
|
990
|
-
return
|
|
991
|
-
}, o = (
|
|
986
|
+
const n = (E) => {
|
|
987
|
+
const C = document.createElement("div");
|
|
988
|
+
return C.innerText = E, C.className = "tips", C;
|
|
989
|
+
}, o = (E, C, S) => {
|
|
992
990
|
const N = document.createElement("li");
|
|
993
|
-
return N.id =
|
|
994
|
-
},
|
|
995
|
-
if (
|
|
996
|
-
for (let
|
|
997
|
-
const
|
|
998
|
-
|
|
999
|
-
|
|
991
|
+
return N.id = E, N.innerHTML = `<span>${we(C)}</span><span ${S ? 'class="key"' : ""}>${we(S)}</span>`, N;
|
|
992
|
+
}, s = Xe[e.locale] ? e.locale : "en", i = Xe[s], l = o("cm-add_child", i.addChild, "Tab"), r = o("cm-add_parent", i.addParent, "Ctrl + Enter"), c = o("cm-add_sibling", i.addSibling, "Enter"), a = o("cm-remove_child", i.removeNode, "Delete"), d = o("cm-fucus", i.focus, ""), h = o("cm-unfucus", i.cancelFocus, ""), u = o("cm-up", i.moveUp, "PgUp"), y = o("cm-down", i.moveDown, "Pgdn"), v = o("cm-link", i.link, ""), p = o("cm-link-bidirectional", i.linkBidirectional, ""), g = o("cm-summary", i.summary, ""), m = document.createElement("ul");
|
|
993
|
+
if (m.className = "menu-list", m.appendChild(l), m.appendChild(r), m.appendChild(c), m.appendChild(a), t.focus && (m.appendChild(d), m.appendChild(h)), m.appendChild(u), m.appendChild(y), m.appendChild(g), t.link && (m.appendChild(v), m.appendChild(p)), t && t.extend)
|
|
994
|
+
for (let E = 0; E < t.extend.length; E++) {
|
|
995
|
+
const C = t.extend[E], S = o(C.name, C.name, C.key || "");
|
|
996
|
+
m.appendChild(S), S.onclick = (N) => {
|
|
997
|
+
C.onclick(N);
|
|
1000
998
|
};
|
|
1001
999
|
}
|
|
1002
1000
|
const b = document.createElement("div");
|
|
1003
|
-
b.className = "context-menu", b.appendChild(
|
|
1001
|
+
b.className = "context-menu", b.appendChild(m), b.hidden = !0, e.container.append(b);
|
|
1004
1002
|
let x = !0;
|
|
1005
|
-
const L = (
|
|
1006
|
-
const
|
|
1007
|
-
if (de(
|
|
1008
|
-
|
|
1009
|
-
const S =
|
|
1010
|
-
N +
|
|
1003
|
+
const L = (E) => {
|
|
1004
|
+
const C = E.target;
|
|
1005
|
+
if (de(C)) {
|
|
1006
|
+
C.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (d.className = "disabled", u.className = "disabled", y.className = "disabled", r.className = "disabled", c.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", y.className = "", r.className = "", c.className = "", a.className = ""), b.hidden = !1, m.style.top = "", m.style.bottom = "", m.style.left = "", m.style.right = "";
|
|
1007
|
+
const S = m.getBoundingClientRect(), N = m.offsetHeight, D = m.offsetWidth, _ = E.clientY - S.top, F = E.clientX - S.left;
|
|
1008
|
+
N + _ > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = _ + 15 + "px"), D + F > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = F + 10 + "px");
|
|
1011
1009
|
}
|
|
1012
1010
|
};
|
|
1013
|
-
e.bus.addListener("showContextMenu", L), b.onclick = (
|
|
1014
|
-
|
|
1011
|
+
e.bus.addListener("showContextMenu", L), b.onclick = (E) => {
|
|
1012
|
+
E.target === b && (b.hidden = !0);
|
|
1015
1013
|
}, l.onclick = () => {
|
|
1016
1014
|
e.addChild(), b.hidden = !0;
|
|
1017
1015
|
}, r.onclick = () => {
|
|
@@ -1024,33 +1022,33 @@ function Gt(e, t) {
|
|
|
1024
1022
|
x || (e.focusNode(e.currentNode), b.hidden = !0);
|
|
1025
1023
|
}, h.onclick = () => {
|
|
1026
1024
|
e.cancelFocus(), b.hidden = !0;
|
|
1027
|
-
},
|
|
1025
|
+
}, u.onclick = () => {
|
|
1028
1026
|
x || (e.moveUpNode(), b.hidden = !0);
|
|
1029
1027
|
}, y.onclick = () => {
|
|
1030
1028
|
x || (e.moveDownNode(), b.hidden = !0);
|
|
1031
1029
|
};
|
|
1032
|
-
const
|
|
1030
|
+
const T = (E) => {
|
|
1033
1031
|
b.hidden = !0;
|
|
1034
|
-
const
|
|
1032
|
+
const C = e.currentNode, S = n(i.clickTips);
|
|
1035
1033
|
e.container.appendChild(S), e.map.addEventListener(
|
|
1036
1034
|
"click",
|
|
1037
1035
|
(N) => {
|
|
1038
1036
|
N.preventDefault(), S.remove();
|
|
1039
1037
|
const D = N.target;
|
|
1040
|
-
(D.parentElement.tagName === "ME-PARENT" || D.parentElement.tagName === "ME-ROOT") && e.createArrow(
|
|
1038
|
+
(D.parentElement.tagName === "ME-PARENT" || D.parentElement.tagName === "ME-ROOT") && e.createArrow(C, D, E);
|
|
1041
1039
|
},
|
|
1042
1040
|
{
|
|
1043
1041
|
once: !0
|
|
1044
1042
|
}
|
|
1045
1043
|
);
|
|
1046
1044
|
};
|
|
1047
|
-
return v.onclick = () =>
|
|
1045
|
+
return v.onclick = () => T(), p.onclick = () => T({ bidirectional: !0 }), g.onclick = () => {
|
|
1048
1046
|
b.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
1049
1047
|
}, () => {
|
|
1050
|
-
l.onclick = null, r.onclick = null, c.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null,
|
|
1048
|
+
l.onclick = null, r.onclick = null, c.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, y.onclick = null, v.onclick = null, g.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
|
|
1051
1049
|
};
|
|
1052
1050
|
}
|
|
1053
|
-
const
|
|
1051
|
+
const Gt = function(e) {
|
|
1054
1052
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
1055
1053
|
type: "summary",
|
|
1056
1054
|
value: e.obj.id
|
|
@@ -1065,8 +1063,8 @@ const Kt = function(e) {
|
|
|
1065
1063
|
value: [e.obj.id]
|
|
1066
1064
|
};
|
|
1067
1065
|
};
|
|
1068
|
-
function
|
|
1069
|
-
let t = [], n = -1, o = e.getData(),
|
|
1066
|
+
function Kt(e) {
|
|
1067
|
+
let t = [], n = -1, o = e.getData(), s = [];
|
|
1070
1068
|
e.undo = function() {
|
|
1071
1069
|
if (n > -1) {
|
|
1072
1070
|
const c = t[n];
|
|
@@ -1089,24 +1087,24 @@ function Xt(e) {
|
|
|
1089
1087
|
}
|
|
1090
1088
|
}
|
|
1091
1089
|
};
|
|
1092
|
-
const
|
|
1090
|
+
const i = function(c) {
|
|
1093
1091
|
if (c.name === "beginEdit") return;
|
|
1094
1092
|
t = t.slice(0, n + 1);
|
|
1095
1093
|
const a = e.getData(), d = {
|
|
1096
1094
|
prev: o,
|
|
1097
1095
|
operation: c.name,
|
|
1098
|
-
currentSelected:
|
|
1099
|
-
currentTarget:
|
|
1096
|
+
currentSelected: s.map((h) => h.id),
|
|
1097
|
+
currentTarget: Gt(c),
|
|
1100
1098
|
next: a
|
|
1101
1099
|
};
|
|
1102
1100
|
t.push(d), o = a, n = t.length - 1;
|
|
1103
1101
|
}, l = function(c) {
|
|
1104
1102
|
(c.metaKey || c.ctrlKey) && (c.shiftKey && c.key === "Z" || c.key === "y") ? e.redo() : (c.metaKey || c.ctrlKey) && c.key === "z" && e.undo();
|
|
1105
1103
|
}, r = function() {
|
|
1106
|
-
|
|
1104
|
+
s = e.currentNodes.map((c) => c.nodeObj);
|
|
1107
1105
|
};
|
|
1108
|
-
return e.bus.addListener("operation",
|
|
1109
|
-
e.bus.removeListener("operation",
|
|
1106
|
+
return e.bus.addListener("operation", i), e.bus.addListener("selectNodes", r), e.container.addEventListener("keydown", l), () => {
|
|
1107
|
+
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", r), e.container.removeEventListener("keydown", l);
|
|
1110
1108
|
};
|
|
1111
1109
|
}
|
|
1112
1110
|
const qt = '<?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>', Vt = '<?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>', Ut = '<?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>', Jt = '<?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>', Zt = '<?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>', Qt = '<?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>', en = '<?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>', tn = {
|
|
@@ -1117,29 +1115,45 @@ const qt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1117
1115
|
living: Zt,
|
|
1118
1116
|
zoomin: Qt,
|
|
1119
1117
|
zoomout: en
|
|
1120
|
-
},
|
|
1118
|
+
}, G = (e, t) => {
|
|
1121
1119
|
const n = document.createElement("span");
|
|
1122
1120
|
return n.id = e, n.innerHTML = tn[t], n;
|
|
1123
1121
|
};
|
|
1124
1122
|
function nn(e) {
|
|
1125
|
-
const t = document.createElement("div"), n =
|
|
1126
|
-
|
|
1127
|
-
|
|
1123
|
+
const t = document.createElement("div"), n = G("fullscreen", "full"), o = G("toCenter", "living"), s = G("zoomout", "zoomout"), i = G("zoomin", "zoomin");
|
|
1124
|
+
t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
|
|
1125
|
+
let l = null;
|
|
1126
|
+
const r = () => {
|
|
1127
|
+
const a = e.container.getBoundingClientRect(), d = Le(e.map.style.transform), h = a.width / 2, u = a.height / 2, y = (h - d.x) / e.scaleVal, v = (u - d.y) / e.scaleVal;
|
|
1128
|
+
l = {
|
|
1129
|
+
containerRect: a,
|
|
1130
|
+
currentTransform: d,
|
|
1131
|
+
mapCenterX: y,
|
|
1132
|
+
mapCenterY: v
|
|
1133
|
+
};
|
|
1134
|
+
}, c = () => {
|
|
1135
|
+
if (l) {
|
|
1136
|
+
const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal, y = h - l.mapCenterY * e.scaleVal, v = u - l.currentTransform.x, p = y - l.currentTransform.y;
|
|
1137
|
+
e.move(v, p);
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
return e.el.addEventListener("fullscreenchange", c), n.onclick = () => {
|
|
1141
|
+
r(), document.fullscreenElement !== e.el ? e.el.requestFullscreen() : document.exitFullscreen();
|
|
1128
1142
|
}, o.onclick = () => {
|
|
1129
1143
|
e.toCenter();
|
|
1130
|
-
}, i.onclick = () => {
|
|
1131
|
-
e.scale(e.scaleVal - e.scaleSensitivity);
|
|
1132
1144
|
}, s.onclick = () => {
|
|
1145
|
+
e.scale(e.scaleVal - e.scaleSensitivity);
|
|
1146
|
+
}, i.onclick = () => {
|
|
1133
1147
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1134
1148
|
}, t;
|
|
1135
1149
|
}
|
|
1136
1150
|
function on(e) {
|
|
1137
|
-
const t = document.createElement("div"), n =
|
|
1138
|
-
return t.appendChild(n), t.appendChild(o), t.appendChild(
|
|
1151
|
+
const t = document.createElement("div"), n = G("tbltl", "left"), o = G("tbltr", "right"), s = G("tblts", "side");
|
|
1152
|
+
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1139
1153
|
e.initLeft();
|
|
1140
1154
|
}, o.onclick = () => {
|
|
1141
1155
|
e.initRight();
|
|
1142
|
-
},
|
|
1156
|
+
}, s.onclick = () => {
|
|
1143
1157
|
e.initSide();
|
|
1144
1158
|
}, t;
|
|
1145
1159
|
}
|
|
@@ -1157,8 +1171,8 @@ class rn {
|
|
|
1157
1171
|
}
|
|
1158
1172
|
dispatchEvent(t, ...n) {
|
|
1159
1173
|
let o = !0;
|
|
1160
|
-
for (const
|
|
1161
|
-
o =
|
|
1174
|
+
for (const s of this._listeners.get(t) ?? [])
|
|
1175
|
+
o = s(...n) !== !1 && o;
|
|
1162
1176
|
return o;
|
|
1163
1177
|
}
|
|
1164
1178
|
unbindAllListeners() {
|
|
@@ -1171,17 +1185,17 @@ class rn {
|
|
|
1171
1185
|
}
|
|
1172
1186
|
const ze = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e }, t, n) => {
|
|
1173
1187
|
if (typeof t == "object")
|
|
1174
|
-
for (const [o,
|
|
1175
|
-
|
|
1188
|
+
for (const [o, s] of Object.entries(t))
|
|
1189
|
+
s !== void 0 && (e[o] = ze(s));
|
|
1176
1190
|
else n !== void 0 && (e[t] = ze(n));
|
|
1177
1191
|
}, Ge = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1178
|
-
const
|
|
1179
|
-
return { ...
|
|
1192
|
+
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1193
|
+
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1180
1194
|
}, ln = (e) => {
|
|
1181
1195
|
let t, n = -1, o = !1;
|
|
1182
1196
|
return {
|
|
1183
|
-
next: (...
|
|
1184
|
-
t =
|
|
1197
|
+
next: (...s) => {
|
|
1198
|
+
t = s, o || (o = !0, n = requestAnimationFrame(() => {
|
|
1185
1199
|
e(...t), o = !1;
|
|
1186
1200
|
}));
|
|
1187
1201
|
},
|
|
@@ -1192,24 +1206,24 @@ const ze = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1192
1206
|
}, Ke = (e, t, n = "touch") => {
|
|
1193
1207
|
switch (n) {
|
|
1194
1208
|
case "center": {
|
|
1195
|
-
const o = t.left + t.width / 2,
|
|
1196
|
-
return o >= e.left && o <= e.right &&
|
|
1209
|
+
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
1210
|
+
return o >= e.left && o <= e.right && s >= e.top && s <= e.bottom;
|
|
1197
1211
|
}
|
|
1198
1212
|
case "cover":
|
|
1199
1213
|
return t.left >= e.left && t.top >= e.top && t.right <= e.right && t.bottom <= e.bottom;
|
|
1200
1214
|
case "touch":
|
|
1201
1215
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1202
1216
|
}
|
|
1203
|
-
}, cn = () => matchMedia("(hover: none), (pointer: coarse)").matches, an = () => "safari" in window,
|
|
1204
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1205
|
-
for (const
|
|
1206
|
-
if (
|
|
1217
|
+
}, cn = () => matchMedia("(hover: none), (pointer: coarse)").matches, an = () => "safari" in window, Ee = (e) => Array.isArray(e) ? e : [e], dt = (e) => (t, n, o, s = {}) => {
|
|
1218
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = Ee(n), t = Ee(t);
|
|
1219
|
+
for (const i of t)
|
|
1220
|
+
if (i)
|
|
1207
1221
|
for (const l of n)
|
|
1208
|
-
|
|
1209
|
-
},
|
|
1222
|
+
i[e](l, o, { capture: !1, ...s });
|
|
1223
|
+
}, X = dt("addEventListener"), j = dt("removeEventListener"), re = (e) => {
|
|
1210
1224
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1211
1225
|
return { x: t, y: n, target: o };
|
|
1212
|
-
}, V = (e, t = document) =>
|
|
1226
|
+
}, V = (e, t = document) => Ee(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), dn = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1213
1227
|
switch (o) {
|
|
1214
1228
|
case "alt":
|
|
1215
1229
|
return e.altKey;
|
|
@@ -1218,7 +1232,7 @@ const ze = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
|
|
|
1218
1232
|
case "shift":
|
|
1219
1233
|
return e.shiftKey;
|
|
1220
1234
|
}
|
|
1221
|
-
}) : !1), { abs:
|
|
1235
|
+
}) : !1), { abs: z, max: qe, min: Ve, ceil: Ue } = Math, Je = (e = []) => ({
|
|
1222
1236
|
stored: e,
|
|
1223
1237
|
selected: [],
|
|
1224
1238
|
touched: [],
|
|
@@ -1229,7 +1243,7 @@ class hn extends rn {
|
|
|
1229
1243
|
// Options
|
|
1230
1244
|
_options;
|
|
1231
1245
|
// Selection store
|
|
1232
|
-
_selection =
|
|
1246
|
+
_selection = Je();
|
|
1233
1247
|
// Area element and clipping element
|
|
1234
1248
|
_area;
|
|
1235
1249
|
_clippingElement;
|
|
@@ -1294,10 +1308,10 @@ class hn extends rn {
|
|
|
1294
1308
|
}
|
|
1295
1309
|
}
|
|
1296
1310
|
};
|
|
1297
|
-
for (const
|
|
1298
|
-
typeof this[
|
|
1299
|
-
const { document: n, selectionAreaClass: o, selectionContainerClass:
|
|
1300
|
-
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o),
|
|
1311
|
+
for (const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1312
|
+
typeof this[i] == "function" && (this[i] = this[i].bind(this));
|
|
1313
|
+
const { document: n, selectionAreaClass: o, selectionContainerClass: s } = this._options;
|
|
1314
|
+
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), W(this._area, {
|
|
1301
1315
|
willChange: "top, left, bottom, right, width, height",
|
|
1302
1316
|
top: 0,
|
|
1303
1317
|
left: 0,
|
|
@@ -1309,91 +1323,91 @@ class hn extends rn {
|
|
|
1309
1323
|
// https://stackoverflow.com/a/38268846
|
|
1310
1324
|
pointerEvents: "none",
|
|
1311
1325
|
zIndex: "1"
|
|
1312
|
-
}), this._frame = ln((
|
|
1313
|
-
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move",
|
|
1326
|
+
}), this._frame = ln((i) => {
|
|
1327
|
+
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
|
|
1314
1328
|
}), this.enable();
|
|
1315
1329
|
}
|
|
1316
1330
|
_toggleStartEvents(t = !0) {
|
|
1317
|
-
const { document: n, features: o } = this._options,
|
|
1318
|
-
|
|
1331
|
+
const { document: n, features: o } = this._options, s = t ? X : j;
|
|
1332
|
+
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1319
1333
|
}
|
|
1320
1334
|
_onTapStart(t, n = !1) {
|
|
1321
|
-
const { x: o, y:
|
|
1335
|
+
const { x: o, y: s, target: i } = re(t), { document: l, startAreas: r, boundaries: c, features: a, behaviour: d } = this._options, h = i.getBoundingClientRect();
|
|
1322
1336
|
if (t instanceof MouseEvent && !dn(t, d.triggers))
|
|
1323
1337
|
return;
|
|
1324
|
-
const
|
|
1325
|
-
this._targetElement = y.find((
|
|
1326
|
-
const v = t.composedPath(), p =
|
|
1327
|
-
if (this._targetBoundary = y.find((
|
|
1338
|
+
const u = V(r, l), y = V(c, l);
|
|
1339
|
+
this._targetElement = y.find((m) => Ke(m.getBoundingClientRect(), h));
|
|
1340
|
+
const v = t.composedPath(), p = u.find((m) => v.includes(m));
|
|
1341
|
+
if (this._targetBoundary = y.find((m) => v.includes(m)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1328
1342
|
return;
|
|
1329
|
-
this._areaLocation = { x1: o, y1:
|
|
1330
|
-
const
|
|
1331
|
-
this._scrollDelta = { x:
|
|
1343
|
+
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1344
|
+
const g = l.scrollingElement ?? l.body;
|
|
1345
|
+
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));
|
|
1332
1346
|
}
|
|
1333
1347
|
_onSingleTap(t) {
|
|
1334
1348
|
const {
|
|
1335
1349
|
singleTap: { intersect: n },
|
|
1336
1350
|
range: o
|
|
1337
|
-
} = this._options.features,
|
|
1338
|
-
let
|
|
1351
|
+
} = this._options.features, s = re(t);
|
|
1352
|
+
let i;
|
|
1339
1353
|
if (n === "native")
|
|
1340
|
-
|
|
1354
|
+
i = s.target;
|
|
1341
1355
|
else if (n === "touch") {
|
|
1342
1356
|
this.resolveSelectables();
|
|
1343
|
-
const { x: r, y: c } =
|
|
1344
|
-
|
|
1345
|
-
const { right: d, left: h, top:
|
|
1346
|
-
return r < d && r > h && c < y && c >
|
|
1357
|
+
const { x: r, y: c } = s;
|
|
1358
|
+
i = this._selectables.find((a) => {
|
|
1359
|
+
const { right: d, left: h, top: u, bottom: y } = a.getBoundingClientRect();
|
|
1360
|
+
return r < d && r > h && c < y && c > u;
|
|
1347
1361
|
});
|
|
1348
1362
|
}
|
|
1349
|
-
if (!
|
|
1363
|
+
if (!i)
|
|
1350
1364
|
return;
|
|
1351
|
-
for (this.resolveSelectables(); !this._selectables.includes(
|
|
1352
|
-
if (
|
|
1353
|
-
|
|
1365
|
+
for (this.resolveSelectables(); !this._selectables.includes(i); )
|
|
1366
|
+
if (i.parentElement)
|
|
1367
|
+
i = i.parentElement;
|
|
1354
1368
|
else {
|
|
1355
1369
|
this._targetBoundaryScrolled || this.clearSelection();
|
|
1356
1370
|
return;
|
|
1357
1371
|
}
|
|
1358
1372
|
const { stored: l } = this._selection;
|
|
1359
1373
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1360
|
-
const r = this._latestElement, [c, a] = r.compareDocumentPosition(
|
|
1374
|
+
const r = this._latestElement, [c, a] = r.compareDocumentPosition(i) & 4 ? [i, r] : [r, i], d = [
|
|
1361
1375
|
...this._selectables.filter((h) => h.compareDocumentPosition(c) & 4 && h.compareDocumentPosition(a) & 2),
|
|
1362
1376
|
c,
|
|
1363
1377
|
a
|
|
1364
1378
|
];
|
|
1365
1379
|
this.select(d), this._latestElement = r;
|
|
1366
|
-
} else l.includes(
|
|
1380
|
+
} else l.includes(i) && (l.length === 1 || t.ctrlKey || l.every((r) => this._selection.stored.includes(r))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
|
|
1367
1381
|
}
|
|
1368
1382
|
_delayedTapMove(t) {
|
|
1369
1383
|
const {
|
|
1370
1384
|
container: n,
|
|
1371
1385
|
document: o,
|
|
1372
|
-
behaviour: { startThreshold:
|
|
1373
|
-
} = this._options, { x1:
|
|
1386
|
+
behaviour: { startThreshold: s }
|
|
1387
|
+
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: r, y: c } = re(t);
|
|
1374
1388
|
if (
|
|
1375
1389
|
// Single number for both coordinates
|
|
1376
|
-
typeof
|
|
1377
|
-
typeof
|
|
1390
|
+
typeof s == "number" && z(r + c - (i + l)) >= s || // Different x and y threshold
|
|
1391
|
+
typeof s == "object" && z(r - i) >= s.x || z(c - l) >= s.y
|
|
1378
1392
|
) {
|
|
1379
1393
|
if (j(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1380
1394
|
j(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1381
1395
|
return;
|
|
1382
1396
|
}
|
|
1383
|
-
|
|
1397
|
+
X(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), W(this._area, "display", "block"), V(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 && (X(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), X(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
1384
1398
|
}
|
|
1385
1399
|
this._handleMoveEvent(t);
|
|
1386
1400
|
}
|
|
1387
1401
|
_setupSelectionArea() {
|
|
1388
|
-
const { _clippingElement: t, _targetElement: n, _area: o } = this,
|
|
1402
|
+
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
1389
1403
|
this._scrollAvailable ? (W(t, {
|
|
1390
|
-
top:
|
|
1391
|
-
left:
|
|
1392
|
-
width:
|
|
1393
|
-
height:
|
|
1404
|
+
top: s.top,
|
|
1405
|
+
left: s.left,
|
|
1406
|
+
width: s.width,
|
|
1407
|
+
height: s.height
|
|
1394
1408
|
}), W(o, {
|
|
1395
|
-
marginTop: -
|
|
1396
|
-
marginLeft: -
|
|
1409
|
+
marginTop: -s.top,
|
|
1410
|
+
marginLeft: -s.left
|
|
1397
1411
|
})) : (W(t, {
|
|
1398
1412
|
top: 0,
|
|
1399
1413
|
left: 0,
|
|
@@ -1405,7 +1419,7 @@ class hn extends rn {
|
|
|
1405
1419
|
}));
|
|
1406
1420
|
}
|
|
1407
1421
|
_onTapMove(t) {
|
|
1408
|
-
const { _scrollSpeed: n, _areaLocation: o, _options:
|
|
1422
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling;
|
|
1409
1423
|
this._targetElement;
|
|
1410
1424
|
const { x: r, y: c } = re(t);
|
|
1411
1425
|
if (o.x2 = r, o.y2 = c, this._lastMousePosition.x = r, this._lastMousePosition.y = c, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
@@ -1417,14 +1431,14 @@ class hn extends rn {
|
|
|
1417
1431
|
}
|
|
1418
1432
|
const d = this._options.mindElixirInstance;
|
|
1419
1433
|
if (d && d.move) {
|
|
1420
|
-
const h = n.x ?
|
|
1421
|
-
(h ||
|
|
1434
|
+
const h = n.x ? Ue(n.x / l) : 0, u = n.y ? Ue(n.y / l) : 0;
|
|
1435
|
+
(h || u) && (d.move(-h, -u), o.x1 -= h, o.y1 -= u);
|
|
1422
1436
|
}
|
|
1423
|
-
|
|
1437
|
+
i.next(t), requestAnimationFrame(a);
|
|
1424
1438
|
};
|
|
1425
1439
|
requestAnimationFrame(a);
|
|
1426
1440
|
} else
|
|
1427
|
-
|
|
1441
|
+
i.next(t);
|
|
1428
1442
|
this._handleMoveEvent(t);
|
|
1429
1443
|
}
|
|
1430
1444
|
_handleMoveEvent(t) {
|
|
@@ -1435,19 +1449,19 @@ class hn extends rn {
|
|
|
1435
1449
|
const {
|
|
1436
1450
|
_scrollDelta: t,
|
|
1437
1451
|
_options: { document: n }
|
|
1438
|
-
} = this, { scrollTop: o, scrollLeft:
|
|
1439
|
-
this._areaLocation.x1 += t.x -
|
|
1452
|
+
} = this, { scrollTop: o, scrollLeft: s } = n.scrollingElement ?? n.body;
|
|
1453
|
+
this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1440
1454
|
}
|
|
1441
1455
|
_onStartAreaScroll() {
|
|
1442
1456
|
this._targetBoundaryScrolled = !0, j(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1443
1457
|
}
|
|
1444
1458
|
_wheelScroll(t) {
|
|
1445
|
-
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0,
|
|
1446
|
-
this._scrollSpeed.y += o * n, this._scrollSpeed.x +=
|
|
1459
|
+
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0, s = t.deltaX ? t.deltaX > 0 ? 1 : -1 : 0;
|
|
1460
|
+
this._scrollSpeed.y += o * n, this._scrollSpeed.x += s * n, this._onTapMove(t), t.preventDefault();
|
|
1447
1461
|
}
|
|
1448
1462
|
_keyboardScroll(t) {
|
|
1449
|
-
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0,
|
|
1450
|
-
this._scrollSpeed.x += Math.sign(o) * n, this._scrollSpeed.y += Math.sign(
|
|
1463
|
+
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0, s = t.key === "ArrowUp" ? -1 : t.key === "ArrowDown" ? 1 : 0;
|
|
1464
|
+
this._scrollSpeed.x += Math.sign(o) * n, this._scrollSpeed.y += Math.sign(s) * n, t.preventDefault(), this._onTapMove({
|
|
1451
1465
|
clientX: this._lastMousePosition.x,
|
|
1452
1466
|
clientY: this._lastMousePosition.y,
|
|
1453
1467
|
preventDefault: () => {
|
|
@@ -1455,49 +1469,49 @@ class hn extends rn {
|
|
|
1455
1469
|
});
|
|
1456
1470
|
}
|
|
1457
1471
|
_recalculateSelectionAreaRect() {
|
|
1458
|
-
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options:
|
|
1472
|
+
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, i = this._targetRect, { x1: l, y1: r } = n;
|
|
1459
1473
|
let { x2: c, y2: a } = n;
|
|
1460
1474
|
const {
|
|
1461
1475
|
behaviour: {
|
|
1462
1476
|
scrolling: { startScrollMargins: d }
|
|
1463
1477
|
}
|
|
1464
|
-
} =
|
|
1465
|
-
c <
|
|
1466
|
-
const h =
|
|
1467
|
-
this._areaRect = Ge(h,
|
|
1478
|
+
} = s;
|
|
1479
|
+
c < i.left + d.x ? (t.x = -z(i.left - c + d.x), c = c < i.left ? i.left : c) : c > i.right - d.x ? (t.x = z(i.left + i.width - c - d.x), c = c > i.right ? i.right : c) : t.x = 0, a < i.top + d.y ? (t.y = -z(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = z(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
|
|
1480
|
+
const h = Ve(l, c), u = Ve(r, a), y = qe(l, c), v = qe(r, a);
|
|
1481
|
+
this._areaRect = Ge(h, u, y - h, v - u);
|
|
1468
1482
|
}
|
|
1469
1483
|
_redrawSelectionArea() {
|
|
1470
|
-
const { x: t, y: n, width: o, height:
|
|
1471
|
-
|
|
1484
|
+
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
1485
|
+
i.left = `${t}px`, i.top = `${n}px`, i.width = `${o}px`, i.height = `${s}px`;
|
|
1472
1486
|
}
|
|
1473
1487
|
_onTapStop(t, n) {
|
|
1474
|
-
const { document: o, features:
|
|
1475
|
-
j(this._targetElement, "scroll", this._onStartAreaScroll), j(o, ["mousemove", "touchmove"], this._delayedTapMove), j(o, ["touchmove", "mousemove"], this._onTapMove), j(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), j(o, "scroll", this._onScroll), this._keepSelection(), t &&
|
|
1488
|
+
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1489
|
+
j(this._targetElement, "scroll", this._onStartAreaScroll), j(o, ["mousemove", "touchmove"], this._delayedTapMove), j(o, ["touchmove", "mousemove"], this._onTapMove), j(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), j(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, j(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), j(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), this._frame?.cancel(), W(this._area, "display", "none");
|
|
1476
1490
|
}
|
|
1477
1491
|
_updateElementSelection() {
|
|
1478
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect:
|
|
1492
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap: a } = n.behaviour, d = a === "invert", h = [], u = [], y = [];
|
|
1479
1493
|
for (let p = 0; p < t.length; p++) {
|
|
1480
|
-
const
|
|
1481
|
-
if (Ke(
|
|
1482
|
-
if (l.includes(
|
|
1483
|
-
|
|
1484
|
-
else if (d &&
|
|
1485
|
-
y.push(
|
|
1494
|
+
const g = t[p];
|
|
1495
|
+
if (Ke(s, g.getBoundingClientRect(), c)) {
|
|
1496
|
+
if (l.includes(g))
|
|
1497
|
+
i.includes(g) && !r.includes(g) && r.push(g);
|
|
1498
|
+
else if (d && i.includes(g)) {
|
|
1499
|
+
y.push(g);
|
|
1486
1500
|
continue;
|
|
1487
1501
|
} else
|
|
1488
|
-
|
|
1489
|
-
h.push(
|
|
1502
|
+
u.push(g);
|
|
1503
|
+
h.push(g);
|
|
1490
1504
|
}
|
|
1491
1505
|
}
|
|
1492
|
-
d &&
|
|
1506
|
+
d && u.push(...i.filter((p) => !l.includes(p)));
|
|
1493
1507
|
const v = a === "keep";
|
|
1494
1508
|
for (let p = 0; p < l.length; p++) {
|
|
1495
|
-
const
|
|
1496
|
-
!h.includes(
|
|
1509
|
+
const g = l[p];
|
|
1510
|
+
!h.includes(g) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1497
1511
|
// not make them part of the current selection as soon as they're touched.
|
|
1498
|
-
(v &&
|
|
1512
|
+
(v && i.includes(g)) && y.push(g);
|
|
1499
1513
|
}
|
|
1500
|
-
o.selected = h, o.changed = { added:
|
|
1514
|
+
o.selected = h, o.changed = { added: u, removed: y }, this._latestElement = void 0;
|
|
1501
1515
|
}
|
|
1502
1516
|
_emitEvent(t, n) {
|
|
1503
1517
|
return this.emit(t, {
|
|
@@ -1507,12 +1521,12 @@ class hn extends rn {
|
|
|
1507
1521
|
});
|
|
1508
1522
|
}
|
|
1509
1523
|
_keepSelection() {
|
|
1510
|
-
const { _options: t, _selection: n } = this, { selected: o, changed:
|
|
1524
|
+
const { _options: t, _selection: n } = this, { selected: o, changed: s, touched: i, stored: l } = n, r = o.filter((c) => !l.includes(c));
|
|
1511
1525
|
switch (t.behaviour.overlap) {
|
|
1512
1526
|
case "drop": {
|
|
1513
1527
|
n.stored = [
|
|
1514
1528
|
...r,
|
|
1515
|
-
...l.filter((c) => !
|
|
1529
|
+
...l.filter((c) => !i.includes(c))
|
|
1516
1530
|
// Elements not touched
|
|
1517
1531
|
];
|
|
1518
1532
|
break;
|
|
@@ -1520,7 +1534,7 @@ class hn extends rn {
|
|
|
1520
1534
|
case "invert": {
|
|
1521
1535
|
n.stored = [
|
|
1522
1536
|
...r,
|
|
1523
|
-
...l.filter((c) => !
|
|
1537
|
+
...l.filter((c) => !s.removed.includes(c))
|
|
1524
1538
|
// Elements not removed from selection
|
|
1525
1539
|
];
|
|
1526
1540
|
break;
|
|
@@ -1556,8 +1570,8 @@ class hn extends rn {
|
|
|
1556
1570
|
* @param quiet If move / stop events should be fired
|
|
1557
1571
|
*/
|
|
1558
1572
|
clearSelection(t = !0, n = !1) {
|
|
1559
|
-
const { selected: o, stored:
|
|
1560
|
-
|
|
1573
|
+
const { selected: o, stored: s, changed: i } = this._selection;
|
|
1574
|
+
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Je(t ? [] : s);
|
|
1561
1575
|
}
|
|
1562
1576
|
/**
|
|
1563
1577
|
* @returns {Array} Selected elements
|
|
@@ -1617,8 +1631,8 @@ class hn extends rn {
|
|
|
1617
1631
|
* @param quiet If this should not trigger the move event
|
|
1618
1632
|
*/
|
|
1619
1633
|
select(t, n = !1) {
|
|
1620
|
-
const { changed: o, selected:
|
|
1621
|
-
return
|
|
1634
|
+
const { changed: o, selected: s, stored: i } = this._selection, l = V(t, this._options.document).filter((r) => !s.includes(r) && !i.includes(r));
|
|
1635
|
+
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;
|
|
1622
1636
|
}
|
|
1623
1637
|
/**
|
|
1624
1638
|
* Removes a particular element from the selection
|
|
@@ -1626,11 +1640,11 @@ class hn extends rn {
|
|
|
1626
1640
|
* @param quiet If this should not trigger the move event
|
|
1627
1641
|
*/
|
|
1628
1642
|
deselect(t, n = !1) {
|
|
1629
|
-
const { selected: o, stored:
|
|
1630
|
-
this._selection.stored =
|
|
1643
|
+
const { selected: o, stored: s, changed: i } = this._selection, l = V(t, this._options.document).filter((r) => o.includes(r) || s.includes(r));
|
|
1644
|
+
this._selection.stored = s.filter((r) => !l.includes(r)), this._selection.selected = o.filter((r) => !l.includes(r)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((r) => !i.removed.includes(r))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
1631
1645
|
}
|
|
1632
1646
|
}
|
|
1633
|
-
function
|
|
1647
|
+
function fn(e) {
|
|
1634
1648
|
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new hn({
|
|
1635
1649
|
selectables: [".map-container me-tpc"],
|
|
1636
1650
|
boundaries: [e.container],
|
|
@@ -1653,51 +1667,51 @@ function un(e) {
|
|
|
1653
1667
|
}
|
|
1654
1668
|
}).on("beforestart", ({ event: o }) => {
|
|
1655
1669
|
if (e.spacePressed) return !1;
|
|
1656
|
-
const
|
|
1657
|
-
if (
|
|
1670
|
+
const s = o.target;
|
|
1671
|
+
if (s.id === "input-box" || s.className === "circle" || e.container.querySelector(".context-menu")?.contains(s))
|
|
1658
1672
|
return !1;
|
|
1659
1673
|
if (!o.ctrlKey && !o.metaKey) {
|
|
1660
|
-
if (
|
|
1674
|
+
if (s.tagName === "ME-TPC" && s.classList.contains("selected"))
|
|
1661
1675
|
return !1;
|
|
1662
1676
|
e.clearSelection();
|
|
1663
1677
|
}
|
|
1664
|
-
const
|
|
1665
|
-
return
|
|
1678
|
+
const i = n.getSelectionArea();
|
|
1679
|
+
return i.style.background = "#4f90f22d", i.style.border = "1px solid #4f90f2", i.parentElement && (i.parentElement.style.zIndex = "9999"), !0;
|
|
1666
1680
|
}).on(
|
|
1667
1681
|
"move",
|
|
1668
1682
|
({
|
|
1669
1683
|
store: {
|
|
1670
|
-
changed: { added: o, removed:
|
|
1684
|
+
changed: { added: o, removed: s }
|
|
1671
1685
|
}
|
|
1672
1686
|
}) => {
|
|
1673
|
-
if (o.length > 0 ||
|
|
1674
|
-
for (const
|
|
1675
|
-
|
|
1687
|
+
if (o.length > 0 || s.length > 0, o.length > 0) {
|
|
1688
|
+
for (const i of o)
|
|
1689
|
+
i.className = "selected";
|
|
1676
1690
|
e.currentNodes = [...e.currentNodes, ...o], e.bus.fire(
|
|
1677
1691
|
"selectNodes",
|
|
1678
|
-
o.map((
|
|
1692
|
+
o.map((i) => i.nodeObj)
|
|
1679
1693
|
);
|
|
1680
1694
|
}
|
|
1681
|
-
if (
|
|
1682
|
-
for (const
|
|
1683
|
-
|
|
1684
|
-
e.currentNodes = e.currentNodes.filter((
|
|
1695
|
+
if (s.length > 0) {
|
|
1696
|
+
for (const i of s)
|
|
1697
|
+
i.classList.remove("selected");
|
|
1698
|
+
e.currentNodes = e.currentNodes.filter((i) => !s?.includes(i)), e.bus.fire(
|
|
1685
1699
|
"unselectNodes",
|
|
1686
|
-
|
|
1700
|
+
s.map((i) => i.nodeObj)
|
|
1687
1701
|
);
|
|
1688
1702
|
}
|
|
1689
1703
|
}
|
|
1690
1704
|
);
|
|
1691
1705
|
e.selection = n;
|
|
1692
1706
|
}
|
|
1693
|
-
const
|
|
1707
|
+
const un = function(e, t = !0) {
|
|
1694
1708
|
this.theme = e;
|
|
1695
1709
|
const o = {
|
|
1696
1710
|
...(e.type === "dark" ? Ne : Se).cssVar,
|
|
1697
1711
|
...e.cssVar
|
|
1698
|
-
},
|
|
1699
|
-
for (let
|
|
1700
|
-
const l = i
|
|
1712
|
+
}, s = Object.keys(o);
|
|
1713
|
+
for (let i = 0; i < s.length; i++) {
|
|
1714
|
+
const l = s[i];
|
|
1701
1715
|
this.container.style.setProperty(l, o[l]);
|
|
1702
1716
|
}
|
|
1703
1717
|
t && this.refresh();
|
|
@@ -1722,8 +1736,8 @@ function ht(e) {
|
|
|
1722
1736
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
1723
1737
|
}
|
|
1724
1738
|
function mn(e, t, n) {
|
|
1725
|
-
const { siblings: o, index:
|
|
1726
|
-
o !== void 0 && (t === "before" ? o.splice(
|
|
1739
|
+
const { siblings: o, index: s } = te(n);
|
|
1740
|
+
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
1727
1741
|
}
|
|
1728
1742
|
function yn(e, t) {
|
|
1729
1743
|
const { siblings: n, index: o } = te(e);
|
|
@@ -1734,9 +1748,9 @@ function vn(e, t, n) {
|
|
|
1734
1748
|
n.children ? n.children.push(t) : n.children = [t];
|
|
1735
1749
|
else {
|
|
1736
1750
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
1737
|
-
const { siblings: o, index:
|
|
1751
|
+
const { siblings: o, index: s } = te(n);
|
|
1738
1752
|
if (o === void 0) return;
|
|
1739
|
-
e === "before" ? o.splice(
|
|
1753
|
+
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
1740
1754
|
}
|
|
1741
1755
|
}
|
|
1742
1756
|
const bn = function({ map: e, direction: t }, n) {
|
|
@@ -1745,20 +1759,20 @@ const bn = function({ map: e, direction: t }, n) {
|
|
|
1745
1759
|
if (t === 1)
|
|
1746
1760
|
return 1;
|
|
1747
1761
|
if (t === 2) {
|
|
1748
|
-
const o = e.querySelector(".lhs")?.childElementCount || 0,
|
|
1749
|
-
return o <=
|
|
1750
|
-
}
|
|
1751
|
-
},
|
|
1752
|
-
const o = n.children[0].children[0],
|
|
1753
|
-
if (
|
|
1754
|
-
if (
|
|
1755
|
-
|
|
1762
|
+
const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
|
|
1763
|
+
return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
|
|
1764
|
+
}
|
|
1765
|
+
}, ft = function(e, t, n) {
|
|
1766
|
+
const o = n.children[0].children[0], s = t.parentElement;
|
|
1767
|
+
if (s.tagName === "ME-PARENT") {
|
|
1768
|
+
if (se(o), s.children[1])
|
|
1769
|
+
s.nextSibling.appendChild(n);
|
|
1756
1770
|
else {
|
|
1757
|
-
const
|
|
1758
|
-
|
|
1771
|
+
const i = e.createChildren([n]);
|
|
1772
|
+
s.appendChild(Me(!0)), s.insertAdjacentElement("afterend", i);
|
|
1759
1773
|
}
|
|
1760
1774
|
e.linkDiv(n.offsetParent);
|
|
1761
|
-
} else
|
|
1775
|
+
} else s.tagName === "ME-ROOT" && (bn(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
|
|
1762
1776
|
}, wn = function(e, t) {
|
|
1763
1777
|
const n = e.parentNode;
|
|
1764
1778
|
if (t === 0) {
|
|
@@ -1766,38 +1780,38 @@ const bn = function({ map: e, direction: t }, n) {
|
|
|
1766
1780
|
o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
|
|
1767
1781
|
}
|
|
1768
1782
|
n.parentNode.remove();
|
|
1769
|
-
},
|
|
1783
|
+
}, ut = {
|
|
1770
1784
|
before: "beforebegin",
|
|
1771
1785
|
after: "afterend"
|
|
1772
|
-
},
|
|
1786
|
+
}, se = function(e) {
|
|
1773
1787
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
1774
1788
|
n?.tagName === "svg" && n?.remove();
|
|
1775
1789
|
}, xn = function(e, t) {
|
|
1776
1790
|
const n = e.nodeObj, o = Te(n);
|
|
1777
1791
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
1778
|
-
const
|
|
1779
|
-
|
|
1792
|
+
const s = Object.assign(n, t);
|
|
1793
|
+
Ae.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
1780
1794
|
name: "reshapeNode",
|
|
1781
|
-
obj:
|
|
1795
|
+
obj: s,
|
|
1782
1796
|
origin: o
|
|
1783
1797
|
});
|
|
1784
|
-
},
|
|
1798
|
+
}, De = function(e, t, n) {
|
|
1785
1799
|
if (!t) return null;
|
|
1786
1800
|
const o = t.nodeObj;
|
|
1787
1801
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
1788
|
-
const
|
|
1789
|
-
o.children ? o.children.push(
|
|
1790
|
-
const { grp:
|
|
1791
|
-
return
|
|
1792
|
-
},
|
|
1802
|
+
const s = n || e.generateNewObj();
|
|
1803
|
+
o.children ? o.children.push(s) : o.children = [s], K(e.nodeData);
|
|
1804
|
+
const { grp: i, top: l } = e.createWrapper(s);
|
|
1805
|
+
return ft(e, t, i), { newTop: l, newNodeObj: s };
|
|
1806
|
+
}, Cn = function(e, t, n) {
|
|
1793
1807
|
const o = t || this.currentNode;
|
|
1794
1808
|
if (!o) return;
|
|
1795
|
-
const
|
|
1796
|
-
if (
|
|
1797
|
-
if (!
|
|
1809
|
+
const s = o.nodeObj;
|
|
1810
|
+
if (s.parent) {
|
|
1811
|
+
if (!s.parent?.parent && this.direction === 2) {
|
|
1798
1812
|
const a = this.map.querySelector(".lhs")?.childElementCount || 0, d = this.map.querySelector(".rhs")?.childElementCount || 0;
|
|
1799
1813
|
if (!a || !d) {
|
|
1800
|
-
this.addChild(this.findEle(
|
|
1814
|
+
this.addChild(this.findEle(s.parent.id), n);
|
|
1801
1815
|
return;
|
|
1802
1816
|
}
|
|
1803
1817
|
}
|
|
@@ -1805,61 +1819,61 @@ const bn = function({ map: e, direction: t }, n) {
|
|
|
1805
1819
|
this.addChild();
|
|
1806
1820
|
return;
|
|
1807
1821
|
}
|
|
1808
|
-
const
|
|
1809
|
-
if (!
|
|
1810
|
-
const a = o.closest("me-main").className ===
|
|
1811
|
-
|
|
1822
|
+
const i = n || this.generateNewObj();
|
|
1823
|
+
if (!s.parent?.parent) {
|
|
1824
|
+
const a = o.closest("me-main").className === B.LHS ? 0 : 1;
|
|
1825
|
+
i.direction = a;
|
|
1812
1826
|
}
|
|
1813
|
-
mn(
|
|
1814
|
-
const l = o.parentElement, { grp: r, top: c } = this.createWrapper(
|
|
1815
|
-
l.parentElement.insertAdjacentElement(
|
|
1827
|
+
mn(i, e, s), K(this.nodeData);
|
|
1828
|
+
const l = o.parentElement, { grp: r, top: c } = this.createWrapper(i);
|
|
1829
|
+
l.parentElement.insertAdjacentElement(ut[e], r), this.linkDiv(r.offsetParent), n || this.editTopic(c.firstChild), this.bus.fire("operation", {
|
|
1816
1830
|
name: "insertSibling",
|
|
1817
1831
|
type: e,
|
|
1818
|
-
obj:
|
|
1832
|
+
obj: i
|
|
1819
1833
|
}), this.selectNode(c.firstChild, !0);
|
|
1820
|
-
},
|
|
1834
|
+
}, En = function(e, t) {
|
|
1821
1835
|
const n = e || this.currentNode;
|
|
1822
1836
|
if (!n) return;
|
|
1823
|
-
|
|
1837
|
+
se(n);
|
|
1824
1838
|
const o = n.nodeObj;
|
|
1825
1839
|
if (!o.parent)
|
|
1826
1840
|
return;
|
|
1827
|
-
const
|
|
1828
|
-
yn(o,
|
|
1829
|
-
const
|
|
1830
|
-
r.appendChild(
|
|
1831
|
-
const c = this.createChildren([
|
|
1841
|
+
const s = t || this.generateNewObj();
|
|
1842
|
+
yn(o, s), K(this.nodeData);
|
|
1843
|
+
const i = n.parentElement.parentElement, { grp: l, top: r } = this.createWrapper(s, !0);
|
|
1844
|
+
r.appendChild(Me(!0)), i.insertAdjacentElement("afterend", l);
|
|
1845
|
+
const c = this.createChildren([i]);
|
|
1832
1846
|
r.insertAdjacentElement("afterend", c), this.linkDiv(), t || this.editTopic(r.firstChild), this.selectNode(r.firstChild, !0), this.bus.fire("operation", {
|
|
1833
1847
|
name: "insertParent",
|
|
1834
|
-
obj:
|
|
1848
|
+
obj: s
|
|
1835
1849
|
});
|
|
1836
1850
|
}, Sn = function(e, t) {
|
|
1837
1851
|
const n = e || this.currentNode;
|
|
1838
1852
|
if (!n) return;
|
|
1839
|
-
const o =
|
|
1853
|
+
const o = De(this, n, t);
|
|
1840
1854
|
if (!o) return;
|
|
1841
|
-
const { newTop:
|
|
1855
|
+
const { newTop: s, newNodeObj: i } = o;
|
|
1842
1856
|
this.bus.fire("operation", {
|
|
1843
1857
|
name: "addChild",
|
|
1844
|
-
obj:
|
|
1845
|
-
}), t || this.editTopic(
|
|
1858
|
+
obj: i
|
|
1859
|
+
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
1846
1860
|
}, Nn = function(e, t) {
|
|
1847
1861
|
const n = Te(e.nodeObj);
|
|
1848
1862
|
ke(n);
|
|
1849
|
-
const o =
|
|
1863
|
+
const o = De(this, t, n);
|
|
1850
1864
|
if (!o) return;
|
|
1851
|
-
const { newNodeObj:
|
|
1852
|
-
this.selectNode(this.findEle(
|
|
1865
|
+
const { newNodeObj: s } = o;
|
|
1866
|
+
this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
|
|
1853
1867
|
name: "copyNode",
|
|
1854
|
-
obj:
|
|
1868
|
+
obj: s
|
|
1855
1869
|
});
|
|
1856
1870
|
}, kn = function(e, t) {
|
|
1857
1871
|
e = _e(e);
|
|
1858
1872
|
const n = [];
|
|
1859
1873
|
for (let o = 0; o < e.length; o++) {
|
|
1860
|
-
const
|
|
1861
|
-
ke(
|
|
1862
|
-
const l =
|
|
1874
|
+
const s = e[o], i = Te(s.nodeObj);
|
|
1875
|
+
ke(i);
|
|
1876
|
+
const l = De(this, t, i);
|
|
1863
1877
|
if (!l) return;
|
|
1864
1878
|
const { newNodeObj: r } = l;
|
|
1865
1879
|
n.push(r);
|
|
@@ -1892,49 +1906,49 @@ const bn = function({ map: e, direction: t }, n) {
|
|
|
1892
1906
|
if (e.length === 0) return;
|
|
1893
1907
|
e = _e(e);
|
|
1894
1908
|
for (const n of e) {
|
|
1895
|
-
const o = n.nodeObj,
|
|
1896
|
-
wn(n,
|
|
1909
|
+
const o = n.nodeObj, s = ht(o);
|
|
1910
|
+
wn(n, s);
|
|
1897
1911
|
}
|
|
1898
1912
|
const t = e[e.length - 1];
|
|
1899
1913
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
1900
1914
|
name: "removeNodes",
|
|
1901
1915
|
objs: e.map((n) => n.nodeObj)
|
|
1902
1916
|
});
|
|
1903
|
-
},
|
|
1917
|
+
}, Pe = (e, t, n, o) => {
|
|
1904
1918
|
e = _e(e);
|
|
1905
|
-
let
|
|
1906
|
-
t === "in" &&
|
|
1907
|
-
const
|
|
1919
|
+
let s = n.nodeObj;
|
|
1920
|
+
t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
|
|
1921
|
+
const i = [];
|
|
1908
1922
|
for (const r of e) {
|
|
1909
1923
|
const c = r.nodeObj;
|
|
1910
|
-
if (vn(t, c,
|
|
1924
|
+
if (vn(t, c, s), K(o.nodeData), t === "in") {
|
|
1911
1925
|
const a = r.parentElement;
|
|
1912
|
-
|
|
1926
|
+
ft(o, n, a.parentElement);
|
|
1913
1927
|
} else {
|
|
1914
|
-
|
|
1928
|
+
se(r);
|
|
1915
1929
|
const a = r.parentElement.parentNode;
|
|
1916
|
-
|
|
1930
|
+
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(ut[t], a);
|
|
1917
1931
|
}
|
|
1918
1932
|
}
|
|
1919
|
-
for (const r of
|
|
1933
|
+
for (const r of i)
|
|
1920
1934
|
r.childElementCount === 0 && r.tagName !== "ME-MAIN" && (r.previousSibling.children[1].remove(), r.remove());
|
|
1921
1935
|
o.linkDiv(), o.scrollIntoView(e[e.length - 1]);
|
|
1922
1936
|
const l = t === "before" ? "moveNodeBefore" : t === "after" ? "moveNodeAfter" : "moveNodeIn";
|
|
1923
1937
|
o.bus.fire("operation", {
|
|
1924
1938
|
name: l,
|
|
1925
1939
|
objs: e.map((r) => r.nodeObj),
|
|
1926
|
-
toObj:
|
|
1940
|
+
toObj: s
|
|
1927
1941
|
});
|
|
1928
1942
|
}, An = function(e, t) {
|
|
1929
|
-
|
|
1943
|
+
Pe(e, "in", t, this);
|
|
1930
1944
|
}, Mn = function(e, t) {
|
|
1931
|
-
|
|
1945
|
+
Pe(e, "before", t, this);
|
|
1932
1946
|
}, Dn = function(e, t) {
|
|
1933
|
-
|
|
1947
|
+
Pe(e, "after", t, this);
|
|
1934
1948
|
}, Pn = function(e) {
|
|
1935
1949
|
const t = e || this.currentNode;
|
|
1936
1950
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
1937
|
-
},
|
|
1951
|
+
}, On = function(e, t) {
|
|
1938
1952
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
1939
1953
|
}, pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1940
1954
|
__proto__: null,
|
|
@@ -1942,8 +1956,8 @@ const bn = function({ map: e, direction: t }, n) {
|
|
|
1942
1956
|
beginEdit: Pn,
|
|
1943
1957
|
copyNode: Nn,
|
|
1944
1958
|
copyNodes: kn,
|
|
1945
|
-
insertParent:
|
|
1946
|
-
insertSibling:
|
|
1959
|
+
insertParent: En,
|
|
1960
|
+
insertSibling: Cn,
|
|
1947
1961
|
moveDownNode: _n,
|
|
1948
1962
|
moveNodeAfter: Dn,
|
|
1949
1963
|
moveNodeBefore: Mn,
|
|
@@ -1951,10 +1965,10 @@ const bn = function({ map: e, direction: t }, n) {
|
|
|
1951
1965
|
moveUpNode: Tn,
|
|
1952
1966
|
removeNodes: Ln,
|
|
1953
1967
|
reshapeNode: xn,
|
|
1954
|
-
rmSubline:
|
|
1955
|
-
setNodeTopic:
|
|
1968
|
+
rmSubline: se,
|
|
1969
|
+
setNodeTopic: On
|
|
1956
1970
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1957
|
-
function
|
|
1971
|
+
function $n(e) {
|
|
1958
1972
|
return {
|
|
1959
1973
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
1960
1974
|
arrows: e.arrows,
|
|
@@ -1966,19 +1980,19 @@ function On(e) {
|
|
|
1966
1980
|
const jn = function(e) {
|
|
1967
1981
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
1968
1982
|
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
1969
|
-
const
|
|
1983
|
+
const i = n.left + n.width / 2, l = n.top + n.height / 2, r = o.left + o.width / 2, c = o.top + o.height / 2, a = i - r, d = l - c;
|
|
1970
1984
|
this.move(-a, -d, !0);
|
|
1971
1985
|
}
|
|
1972
1986
|
}, Hn = function(e, t, n) {
|
|
1973
1987
|
this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
1974
|
-
},
|
|
1988
|
+
}, Rn = function(e) {
|
|
1975
1989
|
this.selection.select(e);
|
|
1976
1990
|
}, Bn = function(e) {
|
|
1977
1991
|
this.selection?.deselect(e);
|
|
1978
|
-
},
|
|
1992
|
+
}, In = function() {
|
|
1979
1993
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
1980
1994
|
}, Fn = function() {
|
|
1981
|
-
const e =
|
|
1995
|
+
const e = $n(this);
|
|
1982
1996
|
return JSON.stringify(e, (t, n) => {
|
|
1983
1997
|
if (!(t === "parent" && typeof n != "string"))
|
|
1984
1998
|
return n;
|
|
@@ -1987,47 +2001,47 @@ const jn = function(e) {
|
|
|
1987
2001
|
return JSON.parse(this.getDataString());
|
|
1988
2002
|
}, Wn = function() {
|
|
1989
2003
|
this.editable = !0;
|
|
1990
|
-
},
|
|
2004
|
+
}, Xn = function() {
|
|
1991
2005
|
this.editable = !1;
|
|
1992
|
-
},
|
|
1993
|
-
if (e < this.scaleMin || e > this.scaleMax) return;
|
|
1994
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0,
|
|
2006
|
+
}, zn = function(e, t = { x: 0, y: 0 }) {
|
|
2007
|
+
if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
|
|
2008
|
+
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 } = Oe(this), r = this.map.style.transform, { x: c, y: a } = Le(r), d = c - i, h = a - l, u = this.scaleVal, y = (-o + d) * (1 - e / u), v = (-s + h) * (1 - e / u);
|
|
1995
2009
|
this.map.style.transform = `translate3d(${c - y}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
1996
|
-
},
|
|
2010
|
+
}, Gn = function() {
|
|
1997
2011
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
1998
2012
|
this.scaleVal = n;
|
|
1999
|
-
const { dx: o, dy:
|
|
2000
|
-
this.map.style.transform = `translate3d(${o}px, ${
|
|
2001
|
-
},
|
|
2002
|
-
const { map: o, scaleVal:
|
|
2013
|
+
const { dx: o, dy: s } = Oe(this, !0);
|
|
2014
|
+
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
2015
|
+
}, Kn = function(e, t, n = !1) {
|
|
2016
|
+
const { map: o, scaleVal: s, bus: i, container: l, nodes: r } = this;
|
|
2003
2017
|
if (n && o.style.transition === "transform 0.3s")
|
|
2004
2018
|
return;
|
|
2005
2019
|
const c = o.style.transform;
|
|
2006
|
-
let { x: a, y: d } =
|
|
2007
|
-
const h = l.getBoundingClientRect(),
|
|
2020
|
+
let { x: a, y: d } = Le(c);
|
|
2021
|
+
const h = l.getBoundingClientRect(), u = r.getBoundingClientRect(), y = u.left < h.right && u.right > h.left, v = u.top < h.bottom && u.bottom > h.top;
|
|
2008
2022
|
if (y) {
|
|
2009
|
-
const p =
|
|
2010
|
-
(p >= h.right ||
|
|
2023
|
+
const p = u.left + e, g = u.right + e;
|
|
2024
|
+
(p >= h.right || g <= h.left) && (e = 0);
|
|
2011
2025
|
}
|
|
2012
2026
|
if (v) {
|
|
2013
|
-
const p =
|
|
2014
|
-
(p >= h.bottom ||
|
|
2027
|
+
const p = u.top + t, g = u.bottom + t;
|
|
2028
|
+
(p >= h.bottom || g <= h.top) && (t = 0);
|
|
2015
2029
|
}
|
|
2016
2030
|
a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
2017
2031
|
o.style.transition = "none";
|
|
2018
|
-
}, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${
|
|
2019
|
-
},
|
|
2020
|
-
const { container: n, map: o, nodes:
|
|
2021
|
-
let
|
|
2032
|
+
}, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
2033
|
+
}, Oe = (e, t = !1) => {
|
|
2034
|
+
const { container: n, map: o, nodes: s } = e;
|
|
2035
|
+
let i, l;
|
|
2022
2036
|
if (e.alignment === "nodes" || t)
|
|
2023
|
-
|
|
2037
|
+
i = (n.offsetWidth - s.offsetWidth) / 2, l = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
|
|
2024
2038
|
else {
|
|
2025
2039
|
const r = o.querySelector("me-root"), c = r.offsetTop, a = r.offsetLeft, d = r.offsetWidth, h = r.offsetHeight;
|
|
2026
|
-
|
|
2040
|
+
i = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - c - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
|
|
2027
2041
|
}
|
|
2028
|
-
return { dx:
|
|
2042
|
+
return { dx: i, dy: l };
|
|
2029
2043
|
}, qn = function() {
|
|
2030
|
-
const { map: e, container: t } = this, { dx: n, dy: o } =
|
|
2044
|
+
const { map: e, container: t } = this, { dx: n, dy: o } = Oe(this);
|
|
2031
2045
|
t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
2032
2046
|
}, Vn = function(e) {
|
|
2033
2047
|
e(this);
|
|
@@ -2046,41 +2060,41 @@ const jn = function(e) {
|
|
|
2046
2060
|
}, no = function(e, t) {
|
|
2047
2061
|
const n = e.nodeObj;
|
|
2048
2062
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
2049
|
-
const o = e.getBoundingClientRect(),
|
|
2063
|
+
const o = e.getBoundingClientRect(), s = {
|
|
2050
2064
|
x: o.left,
|
|
2051
2065
|
y: o.top
|
|
2052
|
-
},
|
|
2053
|
-
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "",
|
|
2066
|
+
}, i = e.parentNode, l = i.children[1];
|
|
2067
|
+
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", se(e), n.expanded) {
|
|
2054
2068
|
const h = this.createChildren(
|
|
2055
|
-
n.children.map((
|
|
2069
|
+
n.children.map((u) => this.createWrapper(u).grp)
|
|
2056
2070
|
);
|
|
2057
|
-
|
|
2071
|
+
i.parentNode.appendChild(h);
|
|
2058
2072
|
} else
|
|
2059
|
-
|
|
2073
|
+
i.parentNode.children[1].remove();
|
|
2060
2074
|
this.linkDiv(e.closest("me-main > me-wrapper"));
|
|
2061
2075
|
const r = e.getBoundingClientRect(), c = {
|
|
2062
2076
|
x: r.left,
|
|
2063
2077
|
y: r.top
|
|
2064
|
-
}, a =
|
|
2078
|
+
}, a = s.x - c.x, d = s.y - c.y;
|
|
2065
2079
|
this.move(a, d), this.bus.fire("expandNode", n);
|
|
2066
2080
|
}, oo = function(e, t) {
|
|
2067
|
-
const n = e.nodeObj, o = e.getBoundingClientRect(),
|
|
2081
|
+
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
2068
2082
|
x: o.left,
|
|
2069
2083
|
y: o.top
|
|
2070
2084
|
};
|
|
2071
2085
|
Q(n, t ?? !n.expanded), this.refresh();
|
|
2072
|
-
const
|
|
2073
|
-
x:
|
|
2074
|
-
y:
|
|
2075
|
-
}, r =
|
|
2086
|
+
const i = this.findEle(n.id).getBoundingClientRect(), l = {
|
|
2087
|
+
x: i.left,
|
|
2088
|
+
y: i.top
|
|
2089
|
+
}, r = s.x - l.x, c = s.y - l.y;
|
|
2076
2090
|
this.move(r, c);
|
|
2077
|
-
},
|
|
2078
|
-
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)),
|
|
2079
|
-
},
|
|
2091
|
+
}, so = function(e) {
|
|
2092
|
+
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)), K(this.nodeData), this.layout(), this.linkDiv();
|
|
2093
|
+
}, io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2080
2094
|
__proto__: null,
|
|
2081
2095
|
cancelFocus: Jn,
|
|
2082
|
-
clearSelection:
|
|
2083
|
-
disableEdit:
|
|
2096
|
+
clearSelection: In,
|
|
2097
|
+
disableEdit: Xn,
|
|
2084
2098
|
enableEdit: Wn,
|
|
2085
2099
|
expandNode: no,
|
|
2086
2100
|
expandNodeAll: oo,
|
|
@@ -2091,13 +2105,13 @@ const jn = function(e) {
|
|
|
2091
2105
|
initRight: Qn,
|
|
2092
2106
|
initSide: eo,
|
|
2093
2107
|
install: Vn,
|
|
2094
|
-
move:
|
|
2095
|
-
refresh:
|
|
2096
|
-
scale:
|
|
2097
|
-
scaleFit:
|
|
2108
|
+
move: Kn,
|
|
2109
|
+
refresh: so,
|
|
2110
|
+
scale: zn,
|
|
2111
|
+
scaleFit: Gn,
|
|
2098
2112
|
scrollIntoView: jn,
|
|
2099
2113
|
selectNode: Hn,
|
|
2100
|
-
selectNodes:
|
|
2114
|
+
selectNodes: Rn,
|
|
2101
2115
|
setLocale: to,
|
|
2102
2116
|
toCenter: qn,
|
|
2103
2117
|
unselectNodes: Bn
|
|
@@ -2136,53 +2150,53 @@ const jn = function(e) {
|
|
|
2136
2150
|
this.moved = !1, this.pointerdown = !1;
|
|
2137
2151
|
}
|
|
2138
2152
|
};
|
|
2139
|
-
},
|
|
2153
|
+
}, Ze = {
|
|
2140
2154
|
create: ro
|
|
2141
2155
|
}, lo = "#4dc4ff";
|
|
2142
|
-
function gt(e, t, n, o,
|
|
2156
|
+
function gt(e, t, n, o, s, i, l, r) {
|
|
2143
2157
|
return {
|
|
2144
|
-
x: e / 8 + n * 3 / 8 +
|
|
2145
|
-
y: t / 8 + o * 3 / 8 +
|
|
2158
|
+
x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
|
|
2159
|
+
y: t / 8 + o * 3 / 8 + i * 3 / 8 + r / 8
|
|
2146
2160
|
};
|
|
2147
2161
|
}
|
|
2148
2162
|
function co(e, t, n) {
|
|
2149
2163
|
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), me(e));
|
|
2150
2164
|
}
|
|
2151
|
-
function le(e, t, n, o,
|
|
2165
|
+
function le(e, t, n, o, s) {
|
|
2152
2166
|
A(e, {
|
|
2153
2167
|
x1: t + "",
|
|
2154
2168
|
y1: n + "",
|
|
2155
2169
|
x2: o + "",
|
|
2156
|
-
y2:
|
|
2170
|
+
y2: s + ""
|
|
2157
2171
|
});
|
|
2158
2172
|
}
|
|
2159
|
-
function
|
|
2160
|
-
const d = `M ${t} ${n} C ${o} ${
|
|
2173
|
+
function Qe(e, t, n, o, s, i, l, r, c, a) {
|
|
2174
|
+
const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${r} ${c}`;
|
|
2161
2175
|
if (e.line.setAttribute("d", d), a.style) {
|
|
2162
2176
|
const p = a.style;
|
|
2163
2177
|
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));
|
|
2164
2178
|
}
|
|
2165
2179
|
const h = e.querySelectorAll('path[stroke="transparent"]');
|
|
2166
2180
|
h.length > 0 && h[0].setAttribute("d", d);
|
|
2167
|
-
const
|
|
2168
|
-
if (
|
|
2169
|
-
const p = `M ${
|
|
2181
|
+
const u = fe(i, l, r, c);
|
|
2182
|
+
if (u) {
|
|
2183
|
+
const p = `M ${u.x1} ${u.y1} L ${r} ${c} L ${u.x2} ${u.y2}`;
|
|
2170
2184
|
if (e.arrow1.setAttribute("d", p), h.length > 1 && h[1].setAttribute("d", p), a.style) {
|
|
2171
|
-
const
|
|
2172
|
-
|
|
2185
|
+
const g = a.style;
|
|
2186
|
+
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));
|
|
2173
2187
|
}
|
|
2174
2188
|
}
|
|
2175
2189
|
if (a.bidirectional) {
|
|
2176
|
-
const p =
|
|
2190
|
+
const p = fe(o, s, t, n);
|
|
2177
2191
|
if (p) {
|
|
2178
|
-
const
|
|
2179
|
-
if (e.arrow2.setAttribute("d",
|
|
2180
|
-
const
|
|
2181
|
-
|
|
2192
|
+
const g = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
|
|
2193
|
+
if (e.arrow2.setAttribute("d", g), h.length > 2 && h[2].setAttribute("d", g), a.style) {
|
|
2194
|
+
const m = a.style;
|
|
2195
|
+
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));
|
|
2182
2196
|
}
|
|
2183
2197
|
}
|
|
2184
2198
|
}
|
|
2185
|
-
const { x: y, y: v } = gt(t, n, o,
|
|
2199
|
+
const { x: y, y: v } = gt(t, n, o, s, i, l, r, c);
|
|
2186
2200
|
if (e.labelEl && co(e.labelEl, y, v), a.style?.labelColor) {
|
|
2187
2201
|
const p = e.labelEl;
|
|
2188
2202
|
p && (p.style.color = a.style.labelColor);
|
|
@@ -2190,9 +2204,9 @@ function Ze(e, t, n, o, i, s, l, r, c, a) {
|
|
|
2190
2204
|
yo(e);
|
|
2191
2205
|
}
|
|
2192
2206
|
function pe(e, t, n) {
|
|
2193
|
-
const { offsetLeft: o, offsetTop:
|
|
2207
|
+
const { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, r = o + i / 2, c = s + l / 2, a = r + n.x, d = c + n.y;
|
|
2194
2208
|
return {
|
|
2195
|
-
w:
|
|
2209
|
+
w: i,
|
|
2196
2210
|
h: l,
|
|
2197
2211
|
cx: r,
|
|
2198
2212
|
cy: c,
|
|
@@ -2208,46 +2222,52 @@ function Z(e) {
|
|
|
2208
2222
|
y: n
|
|
2209
2223
|
};
|
|
2210
2224
|
}
|
|
2211
|
-
const $e = function(e, t, n, o,
|
|
2225
|
+
const $e = function(e, t, n, o, s) {
|
|
2212
2226
|
if (!t || !n)
|
|
2213
2227
|
return;
|
|
2214
|
-
const
|
|
2228
|
+
const i = pe(e, t, o.delta1), l = pe(e, n, o.delta2), { x: r, y: c } = Z(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: y, y: v } = Z(l), p = fe(h, u, y, v);
|
|
2215
2229
|
if (!p) return;
|
|
2216
|
-
const
|
|
2217
|
-
let
|
|
2230
|
+
const g = `M ${p.x1} ${p.y1} L ${y} ${v} L ${p.x2} ${p.y2}`;
|
|
2231
|
+
let m = "";
|
|
2218
2232
|
if (o.bidirectional) {
|
|
2219
|
-
const N =
|
|
2233
|
+
const N = fe(a, d, r, c);
|
|
2220
2234
|
if (!N) return;
|
|
2221
|
-
|
|
2235
|
+
m = `M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`;
|
|
2222
2236
|
}
|
|
2223
|
-
const b = Wt(`M ${r} ${c} C ${a} ${d} ${h} ${
|
|
2224
|
-
b.id =
|
|
2225
|
-
const
|
|
2237
|
+
const b = Wt(`M ${r} ${c} C ${a} ${d} ${h} ${u} ${y} ${v}`, g, m, o.style), { x, y: L } = gt(r, c, a, d, h, u, y, v), T = o.style?.labelColor || "rgb(235, 95, 82)", E = "arrow-" + o.id;
|
|
2238
|
+
b.id = E;
|
|
2239
|
+
const C = e.markdown ? e.markdown(o.label, o) : o.label, S = Ce(C, x, L, {
|
|
2226
2240
|
anchor: "middle",
|
|
2227
|
-
color:
|
|
2241
|
+
color: T,
|
|
2228
2242
|
dataType: "arrow",
|
|
2229
|
-
svgId:
|
|
2243
|
+
svgId: E
|
|
2230
2244
|
});
|
|
2231
|
-
b.labelEl = S, b.arrowObj = o, b.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.linkSvgGroup.appendChild(b), me(S),
|
|
2245
|
+
b.labelEl = S, b.arrowObj = o, b.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.linkSvgGroup.appendChild(b), me(S), s || (e.arrows.push(o), e.currentArrow = b, mt(e, o, i, l));
|
|
2232
2246
|
}, ao = function(e, t, n = {}) {
|
|
2233
|
-
const o =
|
|
2247
|
+
const o = H(this.nodes, e), s = H(this.nodes, t), i = o.offsetLeft + e.offsetWidth / 2, l = o.offsetTop + e.offsetHeight / 2, r = s.offsetLeft + t.offsetWidth / 2, c = s.offsetTop + t.offsetHeight / 2, a = r - i, d = c - l, h = Math.sqrt(a * a + d * d), u = Math.max(50, Math.min(200, h * 0.3)), y = Math.abs(a), v = Math.abs(d);
|
|
2248
|
+
let p, g;
|
|
2249
|
+
if (y > v * 1.5) {
|
|
2250
|
+
const b = a > 0 ? e.offsetWidth / 2 : -e.offsetWidth / 2, x = a > 0 ? -t.offsetWidth / 2 : t.offsetWidth / 2;
|
|
2251
|
+
p = { x: b + (a > 0 ? u : -u), y: 0 }, g = { x: x + (a > 0 ? -u : u), y: 0 };
|
|
2252
|
+
} else if (v > y * 1.5) {
|
|
2253
|
+
const b = d > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, x = d > 0 ? -t.offsetHeight / 2 : t.offsetHeight / 2;
|
|
2254
|
+
p = { x: 0, y: b + (d > 0 ? u : -u) }, g = { x: 0, y: x + (d > 0 ? -u : u) };
|
|
2255
|
+
} else {
|
|
2256
|
+
const b = Math.atan2(d, a), x = e.offsetWidth / 2 * Math.cos(b), L = e.offsetHeight / 2 * Math.sin(b), T = -(t.offsetWidth / 2) * Math.cos(b), E = -(t.offsetHeight / 2) * Math.sin(b), C = u * 0.7 * (a > 0 ? 1 : -1), S = u * 0.7 * (d > 0 ? 1 : -1);
|
|
2257
|
+
p = { x: x + C, y: L + S }, g = { x: T - C, y: E - S };
|
|
2258
|
+
}
|
|
2259
|
+
const m = {
|
|
2234
2260
|
id: q(),
|
|
2235
2261
|
label: "Custom Link",
|
|
2236
2262
|
from: e.nodeObj.id,
|
|
2237
2263
|
to: t.nodeObj.id,
|
|
2238
|
-
delta1:
|
|
2239
|
-
|
|
2240
|
-
y: 0
|
|
2241
|
-
},
|
|
2242
|
-
delta2: {
|
|
2243
|
-
x: t.offsetWidth / 2 + 100,
|
|
2244
|
-
y: 0
|
|
2245
|
-
},
|
|
2264
|
+
delta1: p,
|
|
2265
|
+
delta2: g,
|
|
2246
2266
|
...n
|
|
2247
2267
|
};
|
|
2248
|
-
$e(this, e, t,
|
|
2268
|
+
$e(this, e, t, m), this.bus.fire("operation", {
|
|
2249
2269
|
name: "createArrow",
|
|
2250
|
-
obj:
|
|
2270
|
+
obj: m
|
|
2251
2271
|
});
|
|
2252
2272
|
}, ho = function(e) {
|
|
2253
2273
|
ye(this);
|
|
@@ -2256,7 +2276,7 @@ const $e = function(e, t, n, o, i) {
|
|
|
2256
2276
|
name: "createArrow",
|
|
2257
2277
|
obj: t
|
|
2258
2278
|
});
|
|
2259
|
-
},
|
|
2279
|
+
}, fo = function(e) {
|
|
2260
2280
|
let t;
|
|
2261
2281
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2262
2282
|
ye(this);
|
|
@@ -2267,14 +2287,14 @@ const $e = function(e, t, n, o, i) {
|
|
|
2267
2287
|
id: n
|
|
2268
2288
|
}
|
|
2269
2289
|
});
|
|
2270
|
-
},
|
|
2290
|
+
}, uo = function(e) {
|
|
2271
2291
|
this.currentArrow = e;
|
|
2272
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to),
|
|
2273
|
-
mt(this, t,
|
|
2292
|
+
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = pe(this, n, t.delta1), i = pe(this, o, t.delta2);
|
|
2293
|
+
mt(this, t, s, i);
|
|
2274
2294
|
}, po = function() {
|
|
2275
2295
|
ye(this), this.currentArrow = null;
|
|
2276
2296
|
}, be = function(e, t) {
|
|
2277
|
-
const n = document.createElementNS(
|
|
2297
|
+
const n = document.createElementNS(R, "path");
|
|
2278
2298
|
return A(n, {
|
|
2279
2299
|
d: e,
|
|
2280
2300
|
stroke: t,
|
|
@@ -2284,14 +2304,14 @@ const $e = function(e, t, n, o, i) {
|
|
|
2284
2304
|
"stroke-linejoin": "round"
|
|
2285
2305
|
}), n;
|
|
2286
2306
|
}, go = function(e, t) {
|
|
2287
|
-
const n = document.createElementNS(
|
|
2307
|
+
const n = document.createElementNS(R, "g");
|
|
2288
2308
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2289
2309
|
const o = be(e.line.getAttribute("d"), t);
|
|
2290
2310
|
n.appendChild(o);
|
|
2291
|
-
const
|
|
2292
|
-
if (n.appendChild(
|
|
2293
|
-
const
|
|
2294
|
-
n.appendChild(
|
|
2311
|
+
const s = be(e.arrow1.getAttribute("d"), t);
|
|
2312
|
+
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2313
|
+
const i = be(e.arrow2.getAttribute("d"), t);
|
|
2314
|
+
n.appendChild(i);
|
|
2295
2315
|
}
|
|
2296
2316
|
e.insertBefore(n, e.firstChild);
|
|
2297
2317
|
}, mo = function(e) {
|
|
@@ -2305,18 +2325,18 @@ const $e = function(e, t, n, o, i) {
|
|
|
2305
2325
|
}, ye = function(e) {
|
|
2306
2326
|
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && mo(e.currentArrow);
|
|
2307
2327
|
}, mt = function(e, t, n, o) {
|
|
2308
|
-
const { linkController:
|
|
2328
|
+
const { linkController: s, P2: i, P3: l, line1: r, line2: c, nodes: a, map: d, currentArrow: h, bus: u } = e;
|
|
2309
2329
|
if (!h) return;
|
|
2310
|
-
|
|
2311
|
-
let { x: y, y: v } = Z(n), { ctrlX: p, ctrlY:
|
|
2312
|
-
|
|
2313
|
-
p = p +
|
|
2314
|
-
const
|
|
2315
|
-
y =
|
|
2316
|
-
}), e.helper2.init(d, (
|
|
2317
|
-
|
|
2318
|
-
const
|
|
2319
|
-
x =
|
|
2330
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), go(h, lo);
|
|
2331
|
+
let { x: y, y: v } = Z(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: b } = o, { x, y: L } = Z(o);
|
|
2332
|
+
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${b}px;left:${m}px;`, le(r, y, v, p, g), le(c, m, b, x, L), e.helper1 = Ze.create(i), e.helper2 = Ze.create(l), e.helper1.init(d, (T, E) => {
|
|
2333
|
+
p = p + T / e.scaleVal, g = g + E / e.scaleVal;
|
|
2334
|
+
const C = Z({ ...n, ctrlX: p, ctrlY: g });
|
|
2335
|
+
y = C.x, v = C.y, i.style.top = g + "px", i.style.left = p + "px", Qe(h, y, v, p, g, m, b, x, L, t), le(r, y, v, p, g), t.delta1.x = p - n.cx, t.delta1.y = g - n.cy, u.fire("updateArrowDelta", t);
|
|
2336
|
+
}), e.helper2.init(d, (T, E) => {
|
|
2337
|
+
m = m + T / e.scaleVal, b = b + E / e.scaleVal;
|
|
2338
|
+
const C = Z({ ...o, ctrlX: m, ctrlY: b });
|
|
2339
|
+
x = C.x, L = C.y, l.style.top = b + "px", l.style.left = m + "px", Qe(h, y, v, p, g, m, b, x, L, t), le(c, m, b, x, L), t.delta2.x = m - o.cx, t.delta2.y = b - o.cy, u.fire("updateArrowDelta", t);
|
|
2320
2340
|
});
|
|
2321
2341
|
};
|
|
2322
2342
|
function vo() {
|
|
@@ -2341,12 +2361,12 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2341
2361
|
createArrow: ao,
|
|
2342
2362
|
createArrowFrom: ho,
|
|
2343
2363
|
editArrowLabel: bo,
|
|
2344
|
-
removeArrow:
|
|
2364
|
+
removeArrow: fo,
|
|
2345
2365
|
renderArrow: vo,
|
|
2346
|
-
selectArrow:
|
|
2366
|
+
selectArrow: uo,
|
|
2347
2367
|
tidyArrow: wo,
|
|
2348
2368
|
unselectArrow: po
|
|
2349
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2369
|
+
}, Symbol.toStringTag, { value: "Module" })), Co = function(e) {
|
|
2350
2370
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2351
2371
|
if (e.length === 1) {
|
|
2352
2372
|
const c = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
@@ -2376,18 +2396,18 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2376
2396
|
break e;
|
|
2377
2397
|
}
|
|
2378
2398
|
if (!o) throw new Error("Can not select root node.");
|
|
2379
|
-
const
|
|
2399
|
+
const s = n.map((c) => c[o - 1].index).sort(), i = s[0] || 0, l = s[s.length - 1] || 0, r = n[0][o - 1].node;
|
|
2380
2400
|
if (!r.parent) throw new Error("Please select nodes in the same main topic.");
|
|
2381
2401
|
return {
|
|
2382
2402
|
parent: r.id,
|
|
2383
|
-
start:
|
|
2403
|
+
start: i,
|
|
2384
2404
|
end: l
|
|
2385
2405
|
};
|
|
2386
|
-
},
|
|
2387
|
-
const t = document.createElementNS(
|
|
2406
|
+
}, Eo = function(e) {
|
|
2407
|
+
const t = document.createElementNS(R, "g");
|
|
2388
2408
|
return t.setAttribute("id", e), t;
|
|
2389
|
-
},
|
|
2390
|
-
const n = document.createElementNS(
|
|
2409
|
+
}, et = function(e, t) {
|
|
2410
|
+
const n = document.createElementNS(R, "path");
|
|
2391
2411
|
return A(n, {
|
|
2392
2412
|
d: e,
|
|
2393
2413
|
stroke: t || "#666",
|
|
@@ -2396,34 +2416,34 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2396
2416
|
"stroke-width": "2"
|
|
2397
2417
|
}), n;
|
|
2398
2418
|
}, So = (e) => e.parentElement.parentElement, No = function(e, { parent: t, start: n }) {
|
|
2399
|
-
const o = e.findEle(t),
|
|
2400
|
-
let
|
|
2401
|
-
return
|
|
2402
|
-
},
|
|
2403
|
-
const { id: n, label: o, parent:
|
|
2404
|
-
let v = 1 / 0, p = 0,
|
|
2405
|
-
for (let
|
|
2406
|
-
const w =
|
|
2419
|
+
const o = e.findEle(t), s = o.nodeObj;
|
|
2420
|
+
let i;
|
|
2421
|
+
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2422
|
+
}, je = function(e, t) {
|
|
2423
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, y = No(e, t);
|
|
2424
|
+
let v = 1 / 0, p = 0, g = 0, m = 0;
|
|
2425
|
+
for (let f = i; f <= l; f++) {
|
|
2426
|
+
const w = u.children?.[f];
|
|
2407
2427
|
if (!w)
|
|
2408
2428
|
return e.removeSummary(n), null;
|
|
2409
|
-
const k = So(e.findEle(w.id)), { offsetLeft:
|
|
2410
|
-
|
|
2429
|
+
const k = So(e.findEle(w.id)), { offsetLeft: $, offsetTop: Y } = H(c, k), M = i === l ? 10 : 20;
|
|
2430
|
+
f === i && (g = Y + M), f === l && (m = Y + k.offsetHeight - M), $ < v && (v = $), k.offsetWidth + $ > p && (p = k.offsetWidth + $);
|
|
2411
2431
|
}
|
|
2412
2432
|
let b, x;
|
|
2413
|
-
const L =
|
|
2414
|
-
y ===
|
|
2415
|
-
const
|
|
2416
|
-
return
|
|
2433
|
+
const L = u.parent ? 10 : 0, T = g + L, E = m + L, C = (T + E) / 2, S = r?.stroke || a.cssVar["--color"], N = r?.labelColor || a.cssVar["--color"], D = "s-" + n, _ = e.markdown ? e.markdown(o, t) : o;
|
|
2434
|
+
y === B.LHS ? (b = et(`M ${v + 10} ${T} c -5 0 -10 5 -10 10 L ${v} ${E - 10} c 0 5 5 10 10 10 M ${v} ${C} h -10`, S), x = Ce(_, v - 20, C, { anchor: "end", color: N, dataType: "summary", svgId: D })) : (b = et(`M ${p - 10} ${T} c 5 0 10 5 10 10 L ${p} ${E - 10} c 0 5 -5 10 -10 10 M ${p} ${C} h 10`, S), x = Ce(_, p + 20, C, { anchor: "start", color: N, dataType: "summary", svgId: D }));
|
|
2435
|
+
const F = Eo(D);
|
|
2436
|
+
return F.appendChild(b), e.labelContainer.appendChild(x), me(x), F.summaryObj = t, F.labelEl = x, d.appendChild(F), F;
|
|
2417
2437
|
}, ko = function(e = {}) {
|
|
2418
2438
|
if (!this.currentNodes) return;
|
|
2419
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent:
|
|
2439
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = Co(t), r = { id: q(), parent: s, start: i, end: l, label: "summary", style: e.style }, c = je(this, r);
|
|
2420
2440
|
n.push(r), this.editSummary(c), o.fire("operation", {
|
|
2421
2441
|
name: "createSummary",
|
|
2422
2442
|
obj: r
|
|
2423
2443
|
});
|
|
2424
2444
|
}, To = function(e) {
|
|
2425
2445
|
const t = q(), n = { ...e, id: t };
|
|
2426
|
-
|
|
2446
|
+
je(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2427
2447
|
name: "createSummary",
|
|
2428
2448
|
obj: n
|
|
2429
2449
|
});
|
|
@@ -2441,7 +2461,7 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2441
2461
|
}, Mo = function() {
|
|
2442
2462
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2443
2463
|
try {
|
|
2444
|
-
|
|
2464
|
+
je(this, e);
|
|
2445
2465
|
} catch {
|
|
2446
2466
|
}
|
|
2447
2467
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
@@ -2456,41 +2476,41 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2456
2476
|
renderSummary: Mo,
|
|
2457
2477
|
selectSummary: Lo,
|
|
2458
2478
|
unselectSummary: Ao
|
|
2459
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2460
|
-
function
|
|
2461
|
-
const n = document.createElementNS(
|
|
2479
|
+
}, Symbol.toStringTag, { value: "Module" })), O = "http://www.w3.org/2000/svg";
|
|
2480
|
+
function Oo(e, t) {
|
|
2481
|
+
const n = document.createElementNS(O, "svg");
|
|
2462
2482
|
return A(n, {
|
|
2463
2483
|
version: "1.1",
|
|
2464
|
-
xmlns:
|
|
2484
|
+
xmlns: O,
|
|
2465
2485
|
height: e,
|
|
2466
2486
|
width: t
|
|
2467
2487
|
}), n;
|
|
2468
2488
|
}
|
|
2469
|
-
function
|
|
2489
|
+
function $o(e, t) {
|
|
2470
2490
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2471
2491
|
}
|
|
2472
2492
|
function jo(e, t, n, o) {
|
|
2473
|
-
const
|
|
2474
|
-
let
|
|
2475
|
-
return e.text ?
|
|
2493
|
+
const s = document.createElementNS(O, "g");
|
|
2494
|
+
let i = "";
|
|
2495
|
+
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2476
2496
|
`).forEach((r, c) => {
|
|
2477
|
-
const a = document.createElementNS(
|
|
2497
|
+
const a = document.createElementNS(O, "text");
|
|
2478
2498
|
A(a, {
|
|
2479
2499
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2480
|
-
y: o + parseInt(t.paddingTop) +
|
|
2500
|
+
y: o + parseInt(t.paddingTop) + $o(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
|
|
2481
2501
|
"text-anchor": "start",
|
|
2482
2502
|
"font-family": t.fontFamily,
|
|
2483
2503
|
"font-size": `${t.fontSize}`,
|
|
2484
2504
|
"font-weight": `${t.fontWeight}`,
|
|
2485
2505
|
fill: `${t.color}`
|
|
2486
|
-
}), a.innerHTML = r,
|
|
2487
|
-
}),
|
|
2506
|
+
}), a.innerHTML = r, s.appendChild(a);
|
|
2507
|
+
}), s;
|
|
2488
2508
|
}
|
|
2489
2509
|
function Ho(e, t, n, o) {
|
|
2490
|
-
let
|
|
2491
|
-
e.nodeObj?.dangerouslySetInnerHTML ?
|
|
2492
|
-
const
|
|
2493
|
-
A(
|
|
2510
|
+
let s = "";
|
|
2511
|
+
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2512
|
+
const i = document.createElementNS(O, "foreignObject");
|
|
2513
|
+
A(i, {
|
|
2494
2514
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2495
2515
|
y: o + parseInt(t.paddingTop) + "",
|
|
2496
2516
|
width: t.width,
|
|
@@ -2500,13 +2520,13 @@ function Ho(e, t, n, o) {
|
|
|
2500
2520
|
return A(l, {
|
|
2501
2521
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
2502
2522
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2503
|
-
}), l.innerHTML =
|
|
2523
|
+
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2504
2524
|
}
|
|
2505
|
-
function
|
|
2506
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop:
|
|
2507
|
-
return A(
|
|
2525
|
+
function Ro(e, t) {
|
|
2526
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(O, "rect");
|
|
2527
|
+
return A(i, {
|
|
2508
2528
|
x: o + "",
|
|
2509
|
-
y:
|
|
2529
|
+
y: s + "",
|
|
2510
2530
|
rx: n.borderRadius,
|
|
2511
2531
|
ry: n.borderRadius,
|
|
2512
2532
|
width: n.width,
|
|
@@ -2514,13 +2534,13 @@ function Io(e, t) {
|
|
|
2514
2534
|
fill: n.backgroundColor,
|
|
2515
2535
|
stroke: n.borderColor,
|
|
2516
2536
|
"stroke-width": n.borderWidth
|
|
2517
|
-
}),
|
|
2537
|
+
}), i;
|
|
2518
2538
|
}
|
|
2519
2539
|
function ce(e, t, n = !1) {
|
|
2520
|
-
const o = getComputedStyle(t), { offsetLeft:
|
|
2540
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = H(e.nodes, t), l = document.createElementNS(O, "rect");
|
|
2521
2541
|
A(l, {
|
|
2522
|
-
x:
|
|
2523
|
-
y:
|
|
2542
|
+
x: s + "",
|
|
2543
|
+
y: i + "",
|
|
2524
2544
|
rx: o.borderRadius,
|
|
2525
2545
|
ry: o.borderRadius,
|
|
2526
2546
|
width: o.width,
|
|
@@ -2529,44 +2549,44 @@ function ce(e, t, n = !1) {
|
|
|
2529
2549
|
stroke: o.borderColor,
|
|
2530
2550
|
"stroke-width": o.borderWidth
|
|
2531
2551
|
});
|
|
2532
|
-
const r = document.createElementNS(
|
|
2552
|
+
const r = document.createElementNS(O, "g");
|
|
2533
2553
|
r.appendChild(l);
|
|
2534
2554
|
let c;
|
|
2535
|
-
return n ? c = Ho(t, o,
|
|
2555
|
+
return n ? c = Ho(t, o, s, i) : c = jo(t, o, s, i), r.appendChild(c), r;
|
|
2536
2556
|
}
|
|
2537
2557
|
function Bo(e, t) {
|
|
2538
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop:
|
|
2558
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(O, "a"), l = document.createElementNS(O, "text");
|
|
2539
2559
|
return A(l, {
|
|
2540
2560
|
x: o + "",
|
|
2541
|
-
y:
|
|
2561
|
+
y: s + parseInt(n.fontSize) + "",
|
|
2542
2562
|
"text-anchor": "start",
|
|
2543
2563
|
"font-family": n.fontFamily,
|
|
2544
2564
|
"font-size": `${n.fontSize}`,
|
|
2545
2565
|
"font-weight": `${n.fontWeight}`,
|
|
2546
2566
|
fill: `${n.color}`
|
|
2547
|
-
}), l.innerHTML = t.textContent,
|
|
2567
|
+
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2548
2568
|
}
|
|
2549
|
-
function
|
|
2550
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop:
|
|
2551
|
-
return A(
|
|
2569
|
+
function Io(e, t) {
|
|
2570
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(O, "image");
|
|
2571
|
+
return A(i, {
|
|
2552
2572
|
x: o + "",
|
|
2553
|
-
y:
|
|
2573
|
+
y: s + "",
|
|
2554
2574
|
width: n.width + "",
|
|
2555
2575
|
height: n.height + "",
|
|
2556
2576
|
href: t.src
|
|
2557
|
-
}),
|
|
2577
|
+
}), i;
|
|
2558
2578
|
}
|
|
2559
2579
|
const ae = 100, Fo = '<?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">', Yo = (e, t = !1) => {
|
|
2560
|
-
const n = e.nodes, o = n.offsetHeight + ae * 2,
|
|
2580
|
+
const n = e.nodes, o = n.offsetHeight + ae * 2, s = n.offsetWidth + ae * 2, i = Oo(o + "px", s + "px"), l = document.createElementNS(O, "svg"), r = document.createElementNS(O, "rect");
|
|
2561
2581
|
A(r, {
|
|
2562
2582
|
x: "0",
|
|
2563
2583
|
y: "0",
|
|
2564
|
-
width: `${
|
|
2584
|
+
width: `${s}`,
|
|
2565
2585
|
height: `${o}`,
|
|
2566
2586
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2567
|
-
}),
|
|
2568
|
-
const
|
|
2569
|
-
|
|
2587
|
+
}), i.appendChild(r), n.querySelectorAll(".subLines").forEach((h) => {
|
|
2588
|
+
const u = h.cloneNode(!0), { offsetLeft: y, offsetTop: v } = H(n, h.parentElement);
|
|
2589
|
+
u.setAttribute("x", `${y}`), u.setAttribute("y", `${v}`), l.appendChild(u);
|
|
2570
2590
|
});
|
|
2571
2591
|
const c = n.querySelector(".lines")?.cloneNode(!0);
|
|
2572
2592
|
c && l.appendChild(c);
|
|
@@ -2574,7 +2594,7 @@ const ae = 100, Fo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2574
2594
|
a && l.appendChild(a);
|
|
2575
2595
|
const d = n.querySelector(".summary")?.cloneNode(!0);
|
|
2576
2596
|
return d && l.appendChild(d), n.querySelectorAll("me-tpc").forEach((h) => {
|
|
2577
|
-
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(ce(e, h, !t)) : (l.appendChild(
|
|
2597
|
+
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(ce(e, h, !t)) : (l.appendChild(Ro(e, h)), l.appendChild(ce(e, h.text, !t)));
|
|
2578
2598
|
}), n.querySelectorAll(".tags > span").forEach((h) => {
|
|
2579
2599
|
l.appendChild(ce(e, h));
|
|
2580
2600
|
}), n.querySelectorAll(".icons > span").forEach((h) => {
|
|
@@ -2582,39 +2602,39 @@ const ae = 100, Fo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2582
2602
|
}), n.querySelectorAll(".hyper-link").forEach((h) => {
|
|
2583
2603
|
l.appendChild(Bo(e, h));
|
|
2584
2604
|
}), n.querySelectorAll("img").forEach((h) => {
|
|
2585
|
-
l.appendChild(
|
|
2605
|
+
l.appendChild(Io(e, h));
|
|
2586
2606
|
}), A(l, {
|
|
2587
2607
|
x: ae + "",
|
|
2588
2608
|
y: ae + "",
|
|
2589
2609
|
overflow: "visible"
|
|
2590
|
-
}),
|
|
2610
|
+
}), i.appendChild(l), i;
|
|
2591
2611
|
}, Wo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Fo + e.outerHTML);
|
|
2592
|
-
function
|
|
2612
|
+
function Xo(e) {
|
|
2593
2613
|
return new Promise((t, n) => {
|
|
2594
2614
|
const o = new FileReader();
|
|
2595
|
-
o.onload = (
|
|
2596
|
-
t(
|
|
2597
|
-
}, o.onerror = (
|
|
2598
|
-
n(
|
|
2615
|
+
o.onload = (s) => {
|
|
2616
|
+
t(s.target.result);
|
|
2617
|
+
}, o.onerror = (s) => {
|
|
2618
|
+
n(s);
|
|
2599
2619
|
}, o.readAsDataURL(e);
|
|
2600
2620
|
});
|
|
2601
2621
|
}
|
|
2602
|
-
const
|
|
2622
|
+
const zo = function(e = !1, t) {
|
|
2603
2623
|
const n = Yo(this, e), o = Wo(n, t);
|
|
2604
2624
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2605
|
-
},
|
|
2606
|
-
const n = this.exportSvg(e, t), o = await
|
|
2607
|
-
return new Promise((
|
|
2625
|
+
}, Go = async function(e = !1, t) {
|
|
2626
|
+
const n = this.exportSvg(e, t), o = await Xo(n);
|
|
2627
|
+
return new Promise((s, i) => {
|
|
2608
2628
|
const l = new Image();
|
|
2609
2629
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
2610
2630
|
const r = document.createElement("canvas");
|
|
2611
|
-
r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(
|
|
2612
|
-
}, l.src = o, l.onerror =
|
|
2631
|
+
r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(s, "image/png", 1);
|
|
2632
|
+
}, l.src = o, l.onerror = i;
|
|
2613
2633
|
});
|
|
2614
|
-
},
|
|
2634
|
+
}, Ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2615
2635
|
__proto__: null,
|
|
2616
|
-
exportPng:
|
|
2617
|
-
exportSvg:
|
|
2636
|
+
exportPng: Go,
|
|
2637
|
+
exportSvg: zo
|
|
2618
2638
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2619
2639
|
function qo(e, t) {
|
|
2620
2640
|
return async function(...n) {
|
|
@@ -2622,54 +2642,54 @@ function qo(e, t) {
|
|
|
2622
2642
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2623
2643
|
};
|
|
2624
2644
|
}
|
|
2625
|
-
const
|
|
2626
|
-
for (let e = 0; e <
|
|
2627
|
-
const t =
|
|
2645
|
+
const tt = Object.keys(pt), yt = {};
|
|
2646
|
+
for (let e = 0; e < tt.length; e++) {
|
|
2647
|
+
const t = tt[e];
|
|
2628
2648
|
yt[t] = qo(pt[t], t);
|
|
2629
2649
|
}
|
|
2630
2650
|
const Vo = {
|
|
2631
2651
|
getObjById: he,
|
|
2632
2652
|
generateNewObj: vt,
|
|
2633
|
-
layout:
|
|
2634
|
-
linkDiv:
|
|
2653
|
+
layout: $t,
|
|
2654
|
+
linkDiv: Xt,
|
|
2635
2655
|
editTopic: Yt,
|
|
2636
|
-
createWrapper:
|
|
2656
|
+
createWrapper: Rt,
|
|
2637
2657
|
createParent: Bt,
|
|
2638
|
-
createChildren:
|
|
2658
|
+
createChildren: It,
|
|
2639
2659
|
createTopic: Ft,
|
|
2640
|
-
findEle:
|
|
2641
|
-
changeTheme:
|
|
2642
|
-
...
|
|
2660
|
+
findEle: it,
|
|
2661
|
+
changeTheme: un,
|
|
2662
|
+
...io,
|
|
2643
2663
|
...yt,
|
|
2644
2664
|
...xo,
|
|
2645
2665
|
...Po,
|
|
2646
|
-
...
|
|
2666
|
+
...Ko,
|
|
2647
2667
|
init(e) {
|
|
2648
2668
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2649
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
2669
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, K(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && sn(this), this.keypress && St(this, this.keypress), this.editable && fn(this), this.contextMenu && this.disposable.push(zt(this, this.contextMenu)), this.draggable && this.disposable.push(Dt()), this.allowUndo && this.disposable.push(Kt(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2650
2670
|
},
|
|
2651
2671
|
destroy() {
|
|
2652
2672
|
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.waitCopy = 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;
|
|
2653
2673
|
}
|
|
2654
2674
|
};
|
|
2655
|
-
function Uo({ pT: e, pL: t, pW: n, pH: o, cT:
|
|
2675
|
+
function Uo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, containerHeight: a }) {
|
|
2656
2676
|
let d = t + n / 2;
|
|
2657
2677
|
const h = e + o / 2;
|
|
2658
|
-
let
|
|
2659
|
-
c ===
|
|
2660
|
-
const y =
|
|
2661
|
-
return c ===
|
|
2678
|
+
let u;
|
|
2679
|
+
c === B.LHS ? u = i + l : u = i;
|
|
2680
|
+
const y = s + r / 2, p = (1 - Math.abs(y - h) / a) * 0.25 * (n / 2);
|
|
2681
|
+
return c === B.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${y} ${u} ${y}`;
|
|
2662
2682
|
}
|
|
2663
|
-
function Jo({ pT: e, pL: t, pW: n, pH: o, cT:
|
|
2683
|
+
function Jo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, isFirst: a }) {
|
|
2664
2684
|
const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2665
|
-
let h = 0,
|
|
2685
|
+
let h = 0, u = 0;
|
|
2666
2686
|
a ? h = e + o / 2 : h = e + o;
|
|
2667
|
-
const y =
|
|
2668
|
-
let v = 0, p = 0,
|
|
2669
|
-
const
|
|
2670
|
-
return c ===
|
|
2687
|
+
const y = s + r;
|
|
2688
|
+
let v = 0, p = 0, g = 0;
|
|
2689
|
+
const m = Math.abs(h - y) / 300 * d;
|
|
2690
|
+
return c === B.LHS ? (g = t, v = g + d, p = g - d, u = i + d, `M ${v} ${h} C ${g} ${h} ${g + m} ${y} ${p} ${y} H ${u}`) : (g = t + n, v = g - d, p = g + d, u = i + l - d, `M ${v} ${h} C ${g} ${h} ${g - m} ${y} ${p} ${y} H ${u}`);
|
|
2671
2691
|
}
|
|
2672
|
-
const Zo = "5.
|
|
2692
|
+
const Zo = "5.6.0";
|
|
2673
2693
|
function Qo(e) {
|
|
2674
2694
|
return {
|
|
2675
2695
|
x: 0,
|
|
@@ -2686,56 +2706,56 @@ function Qo(e) {
|
|
|
2686
2706
|
};
|
|
2687
2707
|
}
|
|
2688
2708
|
const U = document;
|
|
2689
|
-
function
|
|
2709
|
+
function I({
|
|
2690
2710
|
el: e,
|
|
2691
2711
|
direction: t,
|
|
2692
2712
|
locale: n,
|
|
2693
2713
|
draggable: o,
|
|
2694
|
-
editable:
|
|
2695
|
-
contextMenu:
|
|
2714
|
+
editable: s,
|
|
2715
|
+
contextMenu: i,
|
|
2696
2716
|
toolBar: l,
|
|
2697
2717
|
keypress: r,
|
|
2698
2718
|
mouseSelectionButton: c,
|
|
2699
2719
|
selectionContainer: a,
|
|
2700
2720
|
before: d,
|
|
2701
2721
|
newTopicName: h,
|
|
2702
|
-
allowUndo:
|
|
2722
|
+
allowUndo: u,
|
|
2703
2723
|
generateMainBranch: y,
|
|
2704
2724
|
generateSubBranch: v,
|
|
2705
2725
|
overflowHidden: p,
|
|
2706
|
-
theme:
|
|
2707
|
-
alignment:
|
|
2726
|
+
theme: g,
|
|
2727
|
+
alignment: m,
|
|
2708
2728
|
scaleSensitivity: b,
|
|
2709
2729
|
scaleMax: x,
|
|
2710
2730
|
scaleMin: L,
|
|
2711
|
-
handleWheel:
|
|
2712
|
-
markdown:
|
|
2713
|
-
imageProxy:
|
|
2731
|
+
handleWheel: T,
|
|
2732
|
+
markdown: E,
|
|
2733
|
+
imageProxy: C
|
|
2714
2734
|
}) {
|
|
2715
2735
|
let S = null;
|
|
2716
2736
|
const N = Object.prototype.toString.call(e);
|
|
2717
2737
|
if (N === "[object HTMLDivElement]" ? S = e : N === "[object String]" && (S = document.querySelector(e)), !S) throw new Error("MindElixir: el is not a valid element");
|
|
2718
|
-
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = d || {}, this.locale = n || "en", this.newTopicName = h || "New Node", this.contextMenu =
|
|
2738
|
+
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = d || {}, this.locale = n || "en", this.newTopicName = h || "New Node", this.contextMenu = i ?? !0, this.toolBar = l ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = u ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = x ?? 1.4, this.scaleMin = L ?? 0.2, this.generateMainBranch = y || Uo, this.generateSubBranch = v || Jo, this.overflowHidden = p ?? !1, this.alignment = m ?? "root", this.handleWheel = T ?? !0, this.markdown = E || void 0, this.imageProxy = C || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Qo(this), this.bus = Ot(), this.container = U.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
|
|
2719
2739
|
const D = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2720
|
-
this.theme =
|
|
2721
|
-
const
|
|
2722
|
-
|
|
2740
|
+
this.theme = g || (D.matches ? Ne : Se);
|
|
2741
|
+
const _ = U.createElement("div");
|
|
2742
|
+
_.className = "map-canvas", this.map = _, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = U.createElement("me-nodes"), this.lines = oe("lines"), this.summarySvg = oe("summary"), this.linkController = oe("linkcontroller"), this.P2 = U.createElement("div"), this.P3 = U.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Ye(), this.line2 = Ye(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = oe("topiclinks"), this.labelContainer = U.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Pt(this));
|
|
2723
2743
|
}
|
|
2724
|
-
|
|
2725
|
-
Object.defineProperty(
|
|
2744
|
+
I.prototype = Vo;
|
|
2745
|
+
Object.defineProperty(I.prototype, "currentNode", {
|
|
2726
2746
|
get() {
|
|
2727
2747
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
2728
2748
|
},
|
|
2729
2749
|
enumerable: !0
|
|
2730
2750
|
});
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2751
|
+
I.LEFT = 0;
|
|
2752
|
+
I.RIGHT = 1;
|
|
2753
|
+
I.SIDE = 2;
|
|
2754
|
+
I.THEME = Se;
|
|
2755
|
+
I.DARK_THEME = Ne;
|
|
2756
|
+
I.version = Zo;
|
|
2757
|
+
I.E = it;
|
|
2758
|
+
I.new = (e) => ({
|
|
2739
2759
|
nodeData: {
|
|
2740
2760
|
id: q(),
|
|
2741
2761
|
topic: e || "new topic",
|
|
@@ -2743,5 +2763,5 @@ B.new = (e) => ({
|
|
|
2743
2763
|
}
|
|
2744
2764
|
});
|
|
2745
2765
|
export {
|
|
2746
|
-
|
|
2766
|
+
I as default
|
|
2747
2767
|
};
|