mind-elixir 5.0.1 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +380 -368
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +102 -100
- package/dist/style.css +1 -1
- package/dist/types/i18n.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/utils/pubsub.d.ts +0 -1
- package/package.json +3 -2
- package/readme.md +14 -5
package/dist/MindElixir.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var at = (e, t, n) => t in e ?
|
|
1
|
+
var ct = Object.defineProperty;
|
|
2
|
+
var at = (e, t, n) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var q = (e, t, n) => (at(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
-
const
|
|
4
|
+
const pe = {
|
|
5
5
|
name: "Latte",
|
|
6
6
|
type: "light",
|
|
7
7
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -26,7 +26,7 @@ const fe = {
|
|
|
26
26
|
"--panel-border-color": "#eaeaea",
|
|
27
27
|
"--map-padding": "50px"
|
|
28
28
|
}
|
|
29
|
-
},
|
|
29
|
+
}, ge = {
|
|
30
30
|
name: "Dark",
|
|
31
31
|
type: "dark",
|
|
32
32
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -72,10 +72,10 @@ const ne = function(e, t) {
|
|
|
72
72
|
for (let n = 0; n < e.children.length; n++)
|
|
73
73
|
$(e.children[n], e);
|
|
74
74
|
};
|
|
75
|
-
function
|
|
75
|
+
function me(e) {
|
|
76
76
|
if (e.id = V(), e.children)
|
|
77
77
|
for (let t = 0; t < e.children.length; t++)
|
|
78
|
-
|
|
78
|
+
me(e.children[t]);
|
|
79
79
|
}
|
|
80
80
|
function oe(e, t, n, o) {
|
|
81
81
|
const i = o - t, s = e - n;
|
|
@@ -83,12 +83,12 @@ function oe(e, t, n, o) {
|
|
|
83
83
|
if (isNaN(r))
|
|
84
84
|
return;
|
|
85
85
|
s < 0 && i > 0 && (r = 180 - r), s < 0 && i < 0 && (r = 180 + r), s > 0 && i < 0 && (r = 360 - r);
|
|
86
|
-
const
|
|
86
|
+
const l = 12, u = 30, a = r + u, f = r - u;
|
|
87
87
|
return {
|
|
88
|
-
x1: n + Math.cos(Math.PI * a / 180) *
|
|
89
|
-
y1: o - Math.sin(Math.PI * a / 180) *
|
|
90
|
-
x2: n + Math.cos(Math.PI * f / 180) *
|
|
91
|
-
y2: o - Math.sin(Math.PI * f / 180) *
|
|
88
|
+
x1: n + Math.cos(Math.PI * a / 180) * l,
|
|
89
|
+
y1: o - Math.sin(Math.PI * a / 180) * l,
|
|
90
|
+
x2: n + Math.cos(Math.PI * f / 180) * l,
|
|
91
|
+
y2: o - Math.sin(Math.PI * f / 180) * l
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
function V() {
|
|
@@ -101,7 +101,7 @@ const dt = function() {
|
|
|
101
101
|
id: e
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
|
-
function
|
|
104
|
+
function ve(e) {
|
|
105
105
|
return JSON.parse(
|
|
106
106
|
JSON.stringify(e, (n, o) => {
|
|
107
107
|
if (n !== "parent")
|
|
@@ -117,7 +117,7 @@ const H = (e, t) => {
|
|
|
117
117
|
}, S = (e, t) => {
|
|
118
118
|
for (const n in t)
|
|
119
119
|
e.setAttribute(n, t[n]);
|
|
120
|
-
},
|
|
120
|
+
}, de = (e) => e ? e.tagName === "ME-TPC" : !1, le = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
121
121
|
for (let i = 0; i < o.length; i++) {
|
|
122
122
|
if (t === o[i])
|
|
123
123
|
continue;
|
|
@@ -129,7 +129,7 @@ const H = (e, t) => {
|
|
|
129
129
|
}), Ye = (e) => {
|
|
130
130
|
const t = /translate\(([^,]+),\s*([^)]+)\)/, n = e.match(t);
|
|
131
131
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
132
|
-
},
|
|
132
|
+
}, be = function(e) {
|
|
133
133
|
for (let t = 0; t < e.length; t++) {
|
|
134
134
|
const { dom: n, evt: o, func: i } = e[t];
|
|
135
135
|
n.addEventListener(o, i);
|
|
@@ -162,14 +162,14 @@ const ht = (e) => {
|
|
|
162
162
|
const o = n.firstChild.firstChild.firstChild;
|
|
163
163
|
e.selectNode(o);
|
|
164
164
|
}
|
|
165
|
-
},
|
|
165
|
+
}, ke = function(e, t) {
|
|
166
166
|
var s, r;
|
|
167
167
|
const n = e.currentNode || ((s = e.currentNodes) == null ? void 0 : s[0]);
|
|
168
168
|
if (!n)
|
|
169
169
|
return;
|
|
170
170
|
const o = n.nodeObj, i = n.offsetParent.offsetParent.parentElement;
|
|
171
171
|
o.parent ? i.className === t ? gt(e, n) : (r = o.parent) != null && r.parent ? pt(e, n) : ft(e) : t === M.LHS ? ht(e) : ut(e);
|
|
172
|
-
},
|
|
172
|
+
}, _e = function(e, t) {
|
|
173
173
|
const n = e.currentNode;
|
|
174
174
|
if (!n || !n.nodeObj.parent)
|
|
175
175
|
return;
|
|
@@ -212,21 +212,21 @@ function mt(e, t) {
|
|
|
212
212
|
else {
|
|
213
213
|
if (i.metaKey || i.ctrlKey)
|
|
214
214
|
return e.initSide();
|
|
215
|
-
|
|
215
|
+
_e(e, "previous");
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
218
|
ArrowDown: (i) => {
|
|
219
|
-
i.altKey ? e.moveDownNode() :
|
|
219
|
+
i.altKey ? e.moveDownNode() : _e(e, "next");
|
|
220
220
|
},
|
|
221
221
|
ArrowLeft: (i) => {
|
|
222
222
|
if (i.metaKey || i.ctrlKey)
|
|
223
223
|
return e.initLeft();
|
|
224
|
-
|
|
224
|
+
ke(e, M.LHS);
|
|
225
225
|
},
|
|
226
226
|
ArrowRight: (i) => {
|
|
227
227
|
if (i.metaKey || i.ctrlKey)
|
|
228
228
|
return e.initRight();
|
|
229
|
-
|
|
229
|
+
ke(e, M.RHS);
|
|
230
230
|
},
|
|
231
231
|
PageUp: () => e.moveUpNode(),
|
|
232
232
|
PageDown: () => {
|
|
@@ -255,7 +255,7 @@ function mt(e, t) {
|
|
|
255
255
|
...t
|
|
256
256
|
};
|
|
257
257
|
e.container.onkeydown = (i) => {
|
|
258
|
-
if (i.preventDefault(), !e.editable
|
|
258
|
+
if (i.preventDefault(), !e.editable)
|
|
259
259
|
return;
|
|
260
260
|
const s = o[i.key];
|
|
261
261
|
s && s(i);
|
|
@@ -278,69 +278,69 @@ function vt(e) {
|
|
|
278
278
|
t.clear();
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
283
|
-
d.ctrlKey || d.metaKey ? e.expandNodeAll(
|
|
284
|
-
else if (
|
|
285
|
-
e.selectNode(
|
|
281
|
+
const c = d.target;
|
|
282
|
+
if (c.tagName === "ME-EPD")
|
|
283
|
+
d.ctrlKey || d.metaKey ? e.expandNodeAll(c.previousSibling) : e.expandNode(c.previousSibling);
|
|
284
|
+
else if (c.tagName === "ME-TPC" && e.currentNodes.length > 1)
|
|
285
|
+
e.selectNode(c);
|
|
286
286
|
else if (!e.editable)
|
|
287
287
|
return;
|
|
288
|
-
const p = (b =
|
|
289
|
-
p.getAttribute("class") === "topiclinks" ? e.selectArrow(
|
|
288
|
+
const p = (b = c.parentElement) == null ? void 0 : b.parentElement;
|
|
289
|
+
p.getAttribute("class") === "topiclinks" ? e.selectArrow(c.parentElement) : p.getAttribute("class") === "summary" && e.selectSummary(c.parentElement);
|
|
290
290
|
}, o = (d) => {
|
|
291
291
|
var m;
|
|
292
292
|
if (!e.editable)
|
|
293
293
|
return;
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
const p = (m =
|
|
297
|
-
p.getAttribute("class") === "topiclinks" ? e.editArrowLabel(
|
|
294
|
+
const c = d.target;
|
|
295
|
+
de(c) && e.beginEdit(c);
|
|
296
|
+
const p = (m = c.parentElement) == null ? void 0 : m.parentElement;
|
|
297
|
+
p.getAttribute("class") === "topiclinks" ? e.editArrowLabel(c.parentElement) : p.getAttribute("class") === "summary" && e.editSummary(c.parentElement);
|
|
298
298
|
};
|
|
299
299
|
let i = 0;
|
|
300
300
|
const s = (d) => {
|
|
301
301
|
if (d.pointerType === "mouse")
|
|
302
302
|
return;
|
|
303
|
-
const
|
|
304
|
-
p < 300 && p > 0 && o(d), i =
|
|
303
|
+
const c = (/* @__PURE__ */ new Date()).getTime(), p = c - i;
|
|
304
|
+
p < 300 && p > 0 && o(d), i = c;
|
|
305
305
|
}, r = (d) => {
|
|
306
306
|
t.moved = !1;
|
|
307
|
-
const
|
|
308
|
-
if (d.button !==
|
|
307
|
+
const c = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
308
|
+
if (d.button !== c && d.pointerType === "mouse")
|
|
309
309
|
return;
|
|
310
310
|
t.x = d.clientX, t.y = d.clientY;
|
|
311
311
|
const p = d.target;
|
|
312
312
|
p.className !== "circle" && p.contentEditable !== "plaintext-only" && (t.mousedown = !0, e.map.style.transition = "none", p.setPointerCapture(d.pointerId));
|
|
313
|
-
},
|
|
313
|
+
}, l = (d) => {
|
|
314
314
|
if (d.target.contentEditable !== "plaintext-only") {
|
|
315
|
-
const
|
|
316
|
-
t.onMove(
|
|
315
|
+
const c = d.clientX - t.x, p = d.clientY - t.y;
|
|
316
|
+
t.onMove(c, p);
|
|
317
317
|
}
|
|
318
318
|
t.x = d.clientX, t.y = d.clientY;
|
|
319
319
|
}, u = (d) => {
|
|
320
|
-
const
|
|
321
|
-
if (d.button !==
|
|
320
|
+
const c = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
321
|
+
if (d.button !== c && d.pointerType === "mouse")
|
|
322
322
|
return;
|
|
323
323
|
const p = d.target;
|
|
324
324
|
p.hasPointerCapture && p.hasPointerCapture(d.pointerId) && p.releasePointerCapture(d.pointerId), t.clear();
|
|
325
325
|
}, a = (d) => {
|
|
326
326
|
if (d.preventDefault(), d.button !== 2 || !e.editable)
|
|
327
327
|
return;
|
|
328
|
-
const
|
|
329
|
-
|
|
328
|
+
const c = d.target;
|
|
329
|
+
de(c) && !c.classList.contains("selected") && e.selectNode(c), setTimeout(() => {
|
|
330
330
|
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", d);
|
|
331
331
|
}, 200);
|
|
332
332
|
}, f = (d) => {
|
|
333
333
|
d.stopPropagation(), d.preventDefault(), d.ctrlKey || d.metaKey ? d.deltaY < 0 ? ie(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && ie(e, "out", e.dragMoveHelper) : d.shiftKey ? e.move(-d.deltaY, 0) : (e.map.style.transition = "none", e.move(-d.deltaX, -d.deltaY), e.map.style.transition = "transform 0.3s");
|
|
334
334
|
}, { container: h } = e;
|
|
335
|
-
return
|
|
335
|
+
return be([
|
|
336
336
|
{ dom: h, evt: "pointerdown", func: r },
|
|
337
|
-
{ dom: h, evt: "pointermove", func:
|
|
337
|
+
{ dom: h, evt: "pointermove", func: l },
|
|
338
338
|
{ dom: h, evt: "pointerup", func: u },
|
|
339
339
|
{ dom: h, evt: "pointerup", func: s },
|
|
340
340
|
{ dom: h, evt: "click", func: n },
|
|
341
341
|
{ dom: h, evt: "dblclick", func: o },
|
|
342
342
|
{ dom: h, evt: "contextmenu", func: a },
|
|
343
|
-
{ dom: h, evt: "wheel", func: f }
|
|
343
|
+
{ dom: h, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : f }
|
|
344
344
|
]);
|
|
345
345
|
}
|
|
346
346
|
function bt() {
|
|
@@ -371,7 +371,7 @@ function bt() {
|
|
|
371
371
|
const se = document, yt = function() {
|
|
372
372
|
this.nodes.innerHTML = "";
|
|
373
373
|
const e = this.createTopic(this.nodeData);
|
|
374
|
-
|
|
374
|
+
ye(e, this.nodeData), e.draggable = !1;
|
|
375
375
|
const t = se.createElement("me-root");
|
|
376
376
|
t.appendChild(e);
|
|
377
377
|
const n = this.nodeData.children || [];
|
|
@@ -388,8 +388,8 @@ const se = document, yt = function() {
|
|
|
388
388
|
const i = se.createElement("me-main");
|
|
389
389
|
i.className = M.RHS;
|
|
390
390
|
for (let s = 0; s < t.length; s++) {
|
|
391
|
-
const r = t[s], { grp:
|
|
392
|
-
e.direction === 2 ? r.direction === 0 ? o.appendChild(
|
|
391
|
+
const r = t[s], { grp: l } = e.createWrapper(r);
|
|
392
|
+
e.direction === 2 ? r.direction === 0 ? o.appendChild(l) : i.appendChild(l) : e.direction === 0 ? o.appendChild(l) : i.appendChild(l);
|
|
393
393
|
}
|
|
394
394
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(i), e.nodes.appendChild(e.lines);
|
|
395
395
|
}, xt = function(e, t) {
|
|
@@ -399,12 +399,12 @@ const se = document, yt = function() {
|
|
|
399
399
|
n.appendChild(s);
|
|
400
400
|
}
|
|
401
401
|
return n;
|
|
402
|
-
},
|
|
403
|
-
const o = (this != null && this.el ? this.el : t || document).querySelector(`[data-nodeid=me${e}]`);
|
|
402
|
+
}, L = document, Ge = function(e, t) {
|
|
403
|
+
const o = (this != null && this.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
404
404
|
if (!o)
|
|
405
405
|
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
406
406
|
return o;
|
|
407
|
-
},
|
|
407
|
+
}, ye = function(e, t) {
|
|
408
408
|
if (e.innerHTML = "", t.style) {
|
|
409
409
|
const n = t.style;
|
|
410
410
|
for (const o in n)
|
|
@@ -417,34 +417,34 @@ const se = document, yt = function() {
|
|
|
417
417
|
if (t.image) {
|
|
418
418
|
const n = t.image;
|
|
419
419
|
if (n.url && n.width && n.height) {
|
|
420
|
-
const o =
|
|
420
|
+
const o = L.createElement("img");
|
|
421
421
|
o.src = n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
|
|
422
422
|
}
|
|
423
423
|
} else
|
|
424
424
|
e.image && (e.image = void 0);
|
|
425
425
|
{
|
|
426
|
-
const n =
|
|
426
|
+
const n = L.createElement("span");
|
|
427
427
|
n.className = "text", n.textContent = t.topic, e.appendChild(n), e.text = n;
|
|
428
428
|
}
|
|
429
429
|
if (t.hyperLink) {
|
|
430
|
-
const n =
|
|
430
|
+
const n = L.createElement("a");
|
|
431
431
|
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
|
|
432
432
|
} else
|
|
433
433
|
e.link && (e.link = void 0);
|
|
434
434
|
if (t.icons && t.icons.length) {
|
|
435
|
-
const n =
|
|
435
|
+
const n = L.createElement("span");
|
|
436
436
|
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
437
437
|
} else
|
|
438
438
|
e.icons && (e.icons = void 0);
|
|
439
439
|
if (t.tags && t.tags.length) {
|
|
440
|
-
const n =
|
|
440
|
+
const n = L.createElement("div");
|
|
441
441
|
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
|
|
442
442
|
} else
|
|
443
443
|
e.tags && (e.tags = void 0);
|
|
444
444
|
}, Et = function(e, t) {
|
|
445
|
-
const n =
|
|
445
|
+
const n = L.createElement("me-wrapper"), { p: o, tpc: i } = this.createParent(e);
|
|
446
446
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
447
|
-
const s =
|
|
447
|
+
const s = we(e.expanded);
|
|
448
448
|
if (o.appendChild(s), e.expanded !== !1) {
|
|
449
449
|
const r = xt(this, e.children);
|
|
450
450
|
n.appendChild(r);
|
|
@@ -452,25 +452,25 @@ const se = document, yt = function() {
|
|
|
452
452
|
}
|
|
453
453
|
return { grp: n, top: o, tpc: i };
|
|
454
454
|
}, Ct = function(e) {
|
|
455
|
-
const t =
|
|
456
|
-
return
|
|
455
|
+
const t = L.createElement("me-parent"), n = this.createTopic(e);
|
|
456
|
+
return ye(n, e), t.appendChild(n), { p: t, tpc: n };
|
|
457
457
|
}, St = function(e) {
|
|
458
|
-
const t =
|
|
458
|
+
const t = L.createElement("me-children");
|
|
459
459
|
return t.append(...e), t;
|
|
460
460
|
}, Nt = function(e) {
|
|
461
|
-
const t =
|
|
461
|
+
const t = L.createElement("me-tpc");
|
|
462
462
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
463
463
|
};
|
|
464
464
|
function Ke(e) {
|
|
465
|
-
const t =
|
|
465
|
+
const t = L.createRange();
|
|
466
466
|
t.selectNodeContents(e);
|
|
467
467
|
const n = window.getSelection();
|
|
468
468
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
469
469
|
}
|
|
470
|
-
const
|
|
470
|
+
const kt = function(e) {
|
|
471
471
|
if (!e)
|
|
472
472
|
return;
|
|
473
|
-
const t =
|
|
473
|
+
const t = L.createElement("div"), n = e.text.textContent;
|
|
474
474
|
e.appendChild(t), t.id = "input-box", t.textContent = n, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
475
475
|
const o = getComputedStyle(e);
|
|
476
476
|
t.style.cssText = `min-width:${e.offsetWidth - 8}px;
|
|
@@ -501,11 +501,11 @@ const _t = function(e) {
|
|
|
501
501
|
origin: n
|
|
502
502
|
}));
|
|
503
503
|
});
|
|
504
|
-
},
|
|
505
|
-
const t =
|
|
504
|
+
}, we = function(e) {
|
|
505
|
+
const t = L.createElement("me-epd");
|
|
506
506
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
507
|
-
}, W = document,
|
|
508
|
-
const o = W.createElementNS(
|
|
507
|
+
}, W = document, _ = "http://www.w3.org/2000/svg", qe = function(e, t, n) {
|
|
508
|
+
const o = W.createElementNS(_, "path");
|
|
509
509
|
return S(o, {
|
|
510
510
|
d: e,
|
|
511
511
|
stroke: t || "#666",
|
|
@@ -513,13 +513,13 @@ const _t = function(e) {
|
|
|
513
513
|
"stroke-width": n
|
|
514
514
|
}), o;
|
|
515
515
|
}, U = function(e) {
|
|
516
|
-
const t = W.createElementNS(
|
|
516
|
+
const t = W.createElementNS(_, "svg");
|
|
517
517
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
518
518
|
}, Te = function() {
|
|
519
|
-
const e = W.createElementNS(
|
|
519
|
+
const e = W.createElementNS(_, "line");
|
|
520
520
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
521
|
-
},
|
|
522
|
-
const i = W.createElementNS(
|
|
521
|
+
}, _t = function(e, t, n, o) {
|
|
522
|
+
const i = W.createElementNS(_, "g");
|
|
523
523
|
return [
|
|
524
524
|
{
|
|
525
525
|
name: "line",
|
|
@@ -533,16 +533,16 @@ const _t = function(e) {
|
|
|
533
533
|
name: "arrow2",
|
|
534
534
|
d: n
|
|
535
535
|
}
|
|
536
|
-
].forEach((r,
|
|
537
|
-
const u = r.d, a = W.createElementNS(
|
|
536
|
+
].forEach((r, l) => {
|
|
537
|
+
const u = r.d, a = W.createElementNS(_, "path"), f = {
|
|
538
538
|
d: u,
|
|
539
539
|
stroke: (o == null ? void 0 : o.stroke) || "rgb(235, 95, 82)",
|
|
540
540
|
fill: "none",
|
|
541
541
|
"stroke-linecap": (o == null ? void 0 : o.strokeLinecap) || "cap",
|
|
542
542
|
"stroke-width": String((o == null ? void 0 : o.strokeWidth) || "2")
|
|
543
543
|
};
|
|
544
|
-
(o == null ? void 0 : o.opacity) !== void 0 && (f.opacity = String(o.opacity)), S(a, f),
|
|
545
|
-
const h = W.createElementNS(
|
|
544
|
+
(o == null ? void 0 : o.opacity) !== void 0 && (f.opacity = String(o.opacity)), S(a, f), l === 0 && a.setAttribute("stroke-dasharray", (o == null ? void 0 : o.strokeDasharray) || "8,2");
|
|
545
|
+
const h = W.createElementNS(_, "path");
|
|
546
546
|
S(h, {
|
|
547
547
|
d: u,
|
|
548
548
|
stroke: "transparent",
|
|
@@ -567,17 +567,17 @@ const _t = function(e) {
|
|
|
567
567
|
margin: -2px -4px;
|
|
568
568
|
`, Ke(o), e.scrollIntoView(o), o.addEventListener("keydown", (r) => {
|
|
569
569
|
r.stopPropagation();
|
|
570
|
-
const
|
|
571
|
-
if (
|
|
570
|
+
const l = r.key;
|
|
571
|
+
if (l === "Enter" || l === "Tab") {
|
|
572
572
|
if (r.shiftKey)
|
|
573
573
|
return;
|
|
574
574
|
r.preventDefault(), o.blur(), e.container.focus();
|
|
575
575
|
}
|
|
576
576
|
}), o.addEventListener("blur", () => {
|
|
577
|
-
var
|
|
577
|
+
var l;
|
|
578
578
|
if (!o)
|
|
579
579
|
return;
|
|
580
|
-
const r = ((
|
|
580
|
+
const r = ((l = o.textContent) == null ? void 0 : l.trim()) || "";
|
|
581
581
|
r === "" ? n.label = i : n.label = r, o.remove(), r !== i && (t.innerHTML = n.label, e.linkDiv(), "parent" in n ? e.bus.fire("operation", {
|
|
582
582
|
name: "finishEditSummary",
|
|
583
583
|
obj: n
|
|
@@ -589,31 +589,31 @@ const _t = function(e) {
|
|
|
589
589
|
}, Tt = function(e) {
|
|
590
590
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, i = t.offsetWidth, s = t.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
591
591
|
this.lines.innerHTML = "";
|
|
592
|
-
for (let
|
|
593
|
-
const u = r[
|
|
592
|
+
for (let l = 0; l < r.length; l++) {
|
|
593
|
+
const u = r[l], a = u.querySelector("me-tpc"), { offsetLeft: f, offsetTop: h } = H(this.nodes, a), g = a.offsetWidth, d = a.offsetHeight, c = u.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: i, pH: s, cT: h, cL: f, cW: g, cH: d, direction: c, containerHeight: this.nodes.offsetHeight }), m = this.theme.palette, v = a.nodeObj.branchColor || m[l % m.length];
|
|
594
594
|
if (a.style.borderColor = v, this.lines.appendChild(qe(p, v, "3")), e && e !== u)
|
|
595
595
|
continue;
|
|
596
|
-
const b = U("subLines"),
|
|
597
|
-
|
|
596
|
+
const b = U("subLines"), w = u.lastChild;
|
|
597
|
+
w.tagName === "svg" && w.remove(), u.appendChild(b), Ue(this, b, v, u, c, !0);
|
|
598
598
|
}
|
|
599
599
|
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
600
600
|
}, Ue = function(e, t, n, o, i, s) {
|
|
601
|
-
const r = o.firstChild,
|
|
602
|
-
if (
|
|
601
|
+
const r = o.firstChild, l = o.children[1].children;
|
|
602
|
+
if (l.length === 0)
|
|
603
603
|
return;
|
|
604
604
|
const u = r.offsetTop, a = r.offsetLeft, f = r.offsetWidth, h = r.offsetHeight;
|
|
605
|
-
for (let g = 0; g <
|
|
606
|
-
const d =
|
|
607
|
-
t.appendChild(qe(E,
|
|
608
|
-
const N =
|
|
605
|
+
for (let g = 0; g < l.length; g++) {
|
|
606
|
+
const d = l[g], c = d.firstChild, p = c.offsetTop, m = c.offsetLeft, v = c.offsetWidth, b = c.offsetHeight, w = c.firstChild.nodeObj.branchColor || n, E = e.generateSubBranch({ pT: u, pL: a, pW: f, pH: h, cT: p, cL: m, cW: v, cH: b, direction: i, isFirst: s });
|
|
607
|
+
t.appendChild(qe(E, w, "2"));
|
|
608
|
+
const N = c.children[1];
|
|
609
609
|
if (N) {
|
|
610
610
|
if (!N.expanded)
|
|
611
611
|
continue;
|
|
612
612
|
} else
|
|
613
613
|
continue;
|
|
614
|
-
Ue(e, t,
|
|
614
|
+
Ue(e, t, w, d, i);
|
|
615
615
|
}
|
|
616
|
-
},
|
|
616
|
+
}, Le = {
|
|
617
617
|
addChild: "插入子节点",
|
|
618
618
|
addParent: "插入父节点",
|
|
619
619
|
addSibling: "插入同级节点",
|
|
@@ -623,11 +623,12 @@ const _t = function(e) {
|
|
|
623
623
|
moveUp: "上移",
|
|
624
624
|
moveDown: "下移",
|
|
625
625
|
link: "连接",
|
|
626
|
+
linkBidirectional: "双向连接",
|
|
626
627
|
clickTips: "请点击目标节点",
|
|
627
628
|
summary: "摘要"
|
|
628
|
-
},
|
|
629
|
-
cn:
|
|
630
|
-
zh_CN:
|
|
629
|
+
}, Ae = {
|
|
630
|
+
cn: Le,
|
|
631
|
+
zh_CN: Le,
|
|
631
632
|
zh_TW: {
|
|
632
633
|
addChild: "插入子節點",
|
|
633
634
|
addParent: "插入父節點",
|
|
@@ -638,6 +639,7 @@ const _t = function(e) {
|
|
|
638
639
|
moveUp: "上移",
|
|
639
640
|
moveDown: "下移",
|
|
640
641
|
link: "連接",
|
|
642
|
+
linkBidirectional: "雙向連接",
|
|
641
643
|
clickTips: "請點擊目標節點",
|
|
642
644
|
summary: "摘要"
|
|
643
645
|
},
|
|
@@ -651,6 +653,7 @@ const _t = function(e) {
|
|
|
651
653
|
moveUp: "Move up",
|
|
652
654
|
moveDown: "Move down",
|
|
653
655
|
link: "Link",
|
|
656
|
+
linkBidirectional: "Bidirectional Link",
|
|
654
657
|
clickTips: "Please click the target node",
|
|
655
658
|
summary: "Summary"
|
|
656
659
|
},
|
|
@@ -664,6 +667,7 @@ const _t = function(e) {
|
|
|
664
667
|
moveUp: "Поднять выше",
|
|
665
668
|
moveDown: "Опустить ниже",
|
|
666
669
|
link: "Ссылка",
|
|
670
|
+
linkBidirectional: "Двунаправленная ссылка",
|
|
667
671
|
clickTips: "Пожалуйста, нажмите на целевой узел",
|
|
668
672
|
summary: "Описание"
|
|
669
673
|
},
|
|
@@ -677,6 +681,7 @@ const _t = function(e) {
|
|
|
677
681
|
moveUp: "上へ移動",
|
|
678
682
|
moveDown: "下へ移動",
|
|
679
683
|
link: "コネクト",
|
|
684
|
+
linkBidirectional: "双方向リンク",
|
|
680
685
|
clickTips: "ターゲットノードをクリックしてください",
|
|
681
686
|
summary: "概要"
|
|
682
687
|
},
|
|
@@ -690,6 +695,7 @@ const _t = function(e) {
|
|
|
690
695
|
moveUp: "Mover para cima",
|
|
691
696
|
moveDown: "Mover para baixo",
|
|
692
697
|
link: "Link",
|
|
698
|
+
linkBidirectional: "Link bidirecional",
|
|
693
699
|
clickTips: "Favor clicar no item alvo",
|
|
694
700
|
summary: "Resumo"
|
|
695
701
|
},
|
|
@@ -703,6 +709,7 @@ const _t = function(e) {
|
|
|
703
709
|
moveUp: "Sposta su",
|
|
704
710
|
moveDown: "Sposta giù",
|
|
705
711
|
link: "Collega",
|
|
712
|
+
linkBidirectional: "Collegamento bidirezionale",
|
|
706
713
|
clickTips: "Si prega di fare clic sul nodo di destinazione",
|
|
707
714
|
summary: "Unisci nodi"
|
|
708
715
|
},
|
|
@@ -716,6 +723,7 @@ const _t = function(e) {
|
|
|
716
723
|
moveUp: "Mover hacia arriba",
|
|
717
724
|
moveDown: "Mover hacia abajo",
|
|
718
725
|
link: "Enlace",
|
|
726
|
+
linkBidirectional: "Enlace bidireccional",
|
|
719
727
|
clickTips: "Por favor haga clic en el nodo de destino",
|
|
720
728
|
summary: "Resumen"
|
|
721
729
|
},
|
|
@@ -729,6 +737,7 @@ const _t = function(e) {
|
|
|
729
737
|
moveUp: "Monter",
|
|
730
738
|
moveDown: "Descendre",
|
|
731
739
|
link: "Lier",
|
|
740
|
+
linkBidirectional: "Lien bidirectionnel",
|
|
732
741
|
clickTips: "Cliquer sur le noeud cible",
|
|
733
742
|
summary: "Annoter"
|
|
734
743
|
},
|
|
@@ -742,87 +751,88 @@ const _t = function(e) {
|
|
|
742
751
|
moveUp: "위로 이동",
|
|
743
752
|
moveDown: "아래로 이동",
|
|
744
753
|
link: "연결",
|
|
754
|
+
linkBidirectional: "양방향 연결",
|
|
745
755
|
clickTips: "대상 노드를 클릭하십시오",
|
|
746
756
|
summary: "요약"
|
|
747
757
|
}
|
|
748
758
|
};
|
|
749
|
-
function
|
|
759
|
+
function Lt(e, t) {
|
|
750
760
|
t = t === !0 ? {
|
|
751
761
|
focus: !0,
|
|
752
762
|
link: !0
|
|
753
763
|
} : t;
|
|
754
|
-
const n = (
|
|
755
|
-
const
|
|
756
|
-
return
|
|
757
|
-
}, o = (
|
|
758
|
-
const
|
|
759
|
-
return
|
|
760
|
-
}, i =
|
|
761
|
-
if (v.className = "menu-list", v.appendChild(r), v.appendChild(
|
|
762
|
-
for (let
|
|
763
|
-
const
|
|
764
|
-
v.appendChild(C), C.onclick = (
|
|
765
|
-
|
|
764
|
+
const n = (x) => {
|
|
765
|
+
const y = document.createElement("div");
|
|
766
|
+
return y.innerText = x, y.className = "tips", y;
|
|
767
|
+
}, o = (x, y, C) => {
|
|
768
|
+
const k = document.createElement("li");
|
|
769
|
+
return k.id = x, k.innerHTML = `<span>${te(y)}</span><span ${C ? 'class="key"' : ""}>${te(C)}</span>`, k;
|
|
770
|
+
}, i = Ae[e.locale] ? e.locale : "en", s = Ae[i], r = o("cm-add_child", s.addChild, "Tab"), l = o("cm-add_parent", s.addParent, "Ctrl + Enter"), u = o("cm-add_sibling", s.addSibling, "Enter"), a = o("cm-remove_child", s.removeNode, "Delete"), f = o("cm-fucus", s.focus, ""), h = o("cm-unfucus", s.cancelFocus, ""), g = o("cm-up", s.moveUp, "PgUp"), d = o("cm-down", s.moveDown, "Pgdn"), c = o("cm-link", s.link, ""), p = o("cm-link-bidirectional", s.linkBidirectional, ""), m = o("cm-summary", s.summary, ""), v = document.createElement("ul");
|
|
771
|
+
if (v.className = "menu-list", v.appendChild(r), v.appendChild(l), v.appendChild(u), v.appendChild(a), t.focus && (v.appendChild(f), v.appendChild(h)), v.appendChild(g), v.appendChild(d), v.appendChild(m), t.link && (v.appendChild(c), v.appendChild(p)), t && t.extend)
|
|
772
|
+
for (let x = 0; x < t.extend.length; x++) {
|
|
773
|
+
const y = t.extend[x], C = o(y.name, y.name, y.key || "");
|
|
774
|
+
v.appendChild(C), C.onclick = (k) => {
|
|
775
|
+
y.onclick(k);
|
|
766
776
|
};
|
|
767
777
|
}
|
|
768
778
|
const b = document.createElement("div");
|
|
769
779
|
b.className = "context-menu", b.appendChild(v), b.hidden = !0, e.container.append(b);
|
|
770
|
-
let
|
|
771
|
-
const E = (
|
|
772
|
-
const
|
|
773
|
-
if (
|
|
774
|
-
|
|
775
|
-
const C = v.getBoundingClientRect(),
|
|
776
|
-
|
|
780
|
+
let w = !0;
|
|
781
|
+
const E = (x) => {
|
|
782
|
+
const y = x.target;
|
|
783
|
+
if (de(y)) {
|
|
784
|
+
y.parentElement.tagName === "ME-ROOT" ? w = !0 : w = !1, w ? (f.className = "disabled", g.className = "disabled", d.className = "disabled", l.className = "disabled", u.className = "disabled", a.className = "disabled") : (f.className = "", g.className = "", d.className = "", l.className = "", u.className = "", a.className = ""), b.hidden = !1, v.style.top = "", v.style.bottom = "", v.style.left = "", v.style.right = "";
|
|
785
|
+
const C = v.getBoundingClientRect(), k = v.offsetHeight, O = v.offsetWidth, B = x.clientY - C.top, R = x.clientX - C.left;
|
|
786
|
+
k + B > window.innerHeight ? (v.style.top = "", v.style.bottom = "0px") : (v.style.bottom = "", v.style.top = B + 15 + "px"), O + R > window.innerWidth ? (v.style.left = "", v.style.right = "0px") : (v.style.right = "", v.style.left = R + 10 + "px");
|
|
777
787
|
}
|
|
778
788
|
};
|
|
779
|
-
e.bus.addListener("showContextMenu", E), b.onclick = (
|
|
780
|
-
|
|
789
|
+
e.bus.addListener("showContextMenu", E), b.onclick = (x) => {
|
|
790
|
+
x.target === b && (b.hidden = !0);
|
|
781
791
|
}, r.onclick = () => {
|
|
782
792
|
e.addChild(), b.hidden = !0;
|
|
783
|
-
},
|
|
793
|
+
}, l.onclick = () => {
|
|
784
794
|
e.insertParent(), b.hidden = !0;
|
|
785
795
|
}, u.onclick = () => {
|
|
786
|
-
|
|
796
|
+
w || (e.insertSibling("after"), b.hidden = !0);
|
|
787
797
|
}, a.onclick = () => {
|
|
788
|
-
|
|
798
|
+
w || (e.removeNodes(e.currentNodes || []), b.hidden = !0);
|
|
789
799
|
}, f.onclick = () => {
|
|
790
|
-
|
|
800
|
+
w || (e.focusNode(e.currentNode), b.hidden = !0);
|
|
791
801
|
}, h.onclick = () => {
|
|
792
802
|
e.cancelFocus(), b.hidden = !0;
|
|
793
803
|
}, g.onclick = () => {
|
|
794
|
-
|
|
804
|
+
w || (e.moveUpNode(), b.hidden = !0);
|
|
795
805
|
}, d.onclick = () => {
|
|
796
|
-
|
|
806
|
+
w || (e.moveDownNode(), b.hidden = !0);
|
|
797
807
|
};
|
|
798
|
-
const N = (
|
|
808
|
+
const N = (x) => {
|
|
799
809
|
b.hidden = !0;
|
|
800
|
-
const
|
|
810
|
+
const y = e.currentNode, C = n(s.clickTips);
|
|
801
811
|
e.container.appendChild(C), e.map.addEventListener(
|
|
802
812
|
"click",
|
|
803
|
-
(
|
|
804
|
-
|
|
805
|
-
const O =
|
|
806
|
-
(O.parentElement.tagName === "ME-PARENT" || O.parentElement.tagName === "ME-ROOT") && e.createArrow(
|
|
813
|
+
(k) => {
|
|
814
|
+
k.preventDefault(), C.remove();
|
|
815
|
+
const O = k.target;
|
|
816
|
+
(O.parentElement.tagName === "ME-PARENT" || O.parentElement.tagName === "ME-ROOT") && e.createArrow(y, O, x);
|
|
807
817
|
},
|
|
808
818
|
{
|
|
809
819
|
once: !0
|
|
810
820
|
}
|
|
811
821
|
);
|
|
812
822
|
};
|
|
813
|
-
return
|
|
823
|
+
return c.onclick = () => N(), p.onclick = () => N({ bidirectional: !0 }), m.onclick = () => {
|
|
814
824
|
b.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
815
825
|
}, () => {
|
|
816
|
-
r.onclick = null,
|
|
826
|
+
r.onclick = null, l.onclick = null, u.onclick = null, a.onclick = null, f.onclick = null, h.onclick = null, g.onclick = null, d.onclick = null, c.onclick = null, m.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
|
|
817
827
|
};
|
|
818
828
|
}
|
|
819
|
-
const
|
|
829
|
+
const he = document, At = function(e, t) {
|
|
820
830
|
if (!t)
|
|
821
|
-
return
|
|
831
|
+
return ue(e), e;
|
|
822
832
|
let n = e.querySelector(".insert-preview");
|
|
823
833
|
const o = `insert-preview ${t} show`;
|
|
824
|
-
return n || (n =
|
|
825
|
-
},
|
|
834
|
+
return n || (n = he.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
835
|
+
}, ue = function(e) {
|
|
826
836
|
if (!e)
|
|
827
837
|
return;
|
|
828
838
|
const t = e.querySelectorAll(".insert-preview");
|
|
@@ -878,34 +888,34 @@ function Ot(e) {
|
|
|
878
888
|
for (const g of f)
|
|
879
889
|
g.parentElement.parentElement.style.opacity = "1";
|
|
880
890
|
const h = a.target;
|
|
881
|
-
h.style.opacity = "", n && (
|
|
882
|
-
},
|
|
891
|
+
h.style.opacity = "", n && (ue(n), t === "before" ? e.moveNodeBefore(f, n) : t === "after" ? e.moveNodeAfter(f, n) : t === "in" && e.moveNodeIn(f, n), e.dragged = null);
|
|
892
|
+
}, l = (a) => {
|
|
883
893
|
a.preventDefault();
|
|
884
894
|
const f = 12 * e.scaleVal, { dragged: h } = e;
|
|
885
895
|
if (!h)
|
|
886
896
|
return;
|
|
887
897
|
const g = e.container.getBoundingClientRect();
|
|
888
|
-
a.clientX < g.x + 50 ? i.move(1, 0) : a.clientX > g.x + g.width - 50 ? i.move(-1, 0) : a.clientY < g.y + 50 ? i.move(0, 1) : a.clientY > g.y + g.height - 50 ? i.move(0, -1) : i.stop(),
|
|
889
|
-
const d =
|
|
898
|
+
a.clientX < g.x + 50 ? i.move(1, 0) : a.clientX > g.x + g.width - 50 ? i.move(-1, 0) : a.clientY < g.y + 50 ? i.move(0, 1) : a.clientY > g.y + g.height - 50 ? i.move(0, -1) : i.stop(), ue(n);
|
|
899
|
+
const d = he.elementFromPoint(a.clientX, a.clientY - f);
|
|
890
900
|
if (Me(d, h)) {
|
|
891
901
|
n = d;
|
|
892
|
-
const
|
|
893
|
-
a.clientY > p +
|
|
902
|
+
const c = d.getBoundingClientRect(), p = c.y;
|
|
903
|
+
a.clientY > p + c.height ? t = "after" : t = "in";
|
|
894
904
|
} else {
|
|
895
|
-
const
|
|
896
|
-
if (Me(
|
|
897
|
-
n =
|
|
905
|
+
const c = he.elementFromPoint(a.clientX, a.clientY + f), p = c.getBoundingClientRect();
|
|
906
|
+
if (Me(c, h)) {
|
|
907
|
+
n = c;
|
|
898
908
|
const m = p.y;
|
|
899
909
|
a.clientY < m ? t = "before" : t = "in";
|
|
900
910
|
} else
|
|
901
911
|
t = n = null;
|
|
902
912
|
}
|
|
903
|
-
n &&
|
|
913
|
+
n && At(n, t);
|
|
904
914
|
};
|
|
905
|
-
return
|
|
915
|
+
return be([
|
|
906
916
|
{ dom: e.map, evt: "dragstart", func: s },
|
|
907
917
|
{ dom: e.map, evt: "dragend", func: r },
|
|
908
|
-
{ dom: e.map, evt: "dragover", func:
|
|
918
|
+
{ dom: e.map, evt: "dragover", func: l }
|
|
909
919
|
]);
|
|
910
920
|
}
|
|
911
921
|
const jt = function(e) {
|
|
@@ -930,7 +940,7 @@ function Pt(e) {
|
|
|
930
940
|
const r = t[n];
|
|
931
941
|
o = r.prev, e.refresh(r.prev);
|
|
932
942
|
try {
|
|
933
|
-
r.currentObject.type === "node" ? e.selectNode(this.findEle(r.currentObject.value)) : r.currentObject.type === "nodes" && e.selectNodes(r.currentObject.value.map((
|
|
943
|
+
r.currentObject.type === "node" ? e.selectNode(this.findEle(r.currentObject.value)) : r.currentObject.type === "nodes" && e.selectNodes(r.currentObject.value.map((l) => this.findEle(l)));
|
|
934
944
|
} catch {
|
|
935
945
|
} finally {
|
|
936
946
|
n--;
|
|
@@ -940,15 +950,15 @@ function Pt(e) {
|
|
|
940
950
|
if (n < t.length - 1) {
|
|
941
951
|
n++;
|
|
942
952
|
const r = t[n];
|
|
943
|
-
o = r.next, e.refresh(r.next), r.currentObject.type === "node" ? e.selectNode(this.findEle(r.currentObject.value)) : r.currentObject.type === "nodes" && (e.unselectNodes(this.currentNodes), e.selectNodes(r.currentObject.value.map((
|
|
953
|
+
o = r.next, e.refresh(r.next), r.currentObject.type === "node" ? e.selectNode(this.findEle(r.currentObject.value)) : r.currentObject.type === "nodes" && (e.unselectNodes(this.currentNodes), e.selectNodes(r.currentObject.value.map((l) => this.findEle(l))));
|
|
944
954
|
}
|
|
945
955
|
};
|
|
946
956
|
const i = function(r) {
|
|
947
957
|
if (r.name === "beginEdit")
|
|
948
958
|
return;
|
|
949
959
|
t = t.slice(0, n + 1);
|
|
950
|
-
const
|
|
951
|
-
t.push({ prev: o, currentObject: jt(r), next:
|
|
960
|
+
const l = e.getData();
|
|
961
|
+
t.push({ prev: o, currentObject: jt(r), next: l }), o = l, n = t.length - 1;
|
|
952
962
|
}, s = function(r) {
|
|
953
963
|
(r.metaKey || r.ctrlKey) && (r.shiftKey && r.key === "Z" || r.key === "y") ? e.redo() : (r.metaKey || r.ctrlKey) && r.key === "z" && e.undo();
|
|
954
964
|
};
|
|
@@ -1049,17 +1059,17 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1049
1059
|
case "touch":
|
|
1050
1060
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1051
1061
|
}
|
|
1052
|
-
}, Ut = () => matchMedia("(hover: none), (pointer: coarse)").matches, Xt = () => "safari" in window,
|
|
1053
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1062
|
+
}, Ut = () => matchMedia("(hover: none), (pointer: coarse)").matches, Xt = () => "safari" in window, fe = (e) => Array.isArray(e) ? e : [e], Xe = (e) => (t, n, o, i = {}) => {
|
|
1063
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = fe(n), t = fe(t);
|
|
1054
1064
|
for (const s of t)
|
|
1055
1065
|
if (s)
|
|
1056
1066
|
for (const r of n)
|
|
1057
1067
|
s[e](r, o, { capture: !1, ...i });
|
|
1058
|
-
}, P = Xe("addEventListener"),
|
|
1068
|
+
}, P = Xe("addEventListener"), A = Xe("removeEventListener"), J = (e) => {
|
|
1059
1069
|
var t;
|
|
1060
1070
|
const { clientX: n, clientY: o, target: i } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
|
|
1061
1071
|
return { x: n, y: o, target: i };
|
|
1062
|
-
}, Y = (e, t = document) =>
|
|
1072
|
+
}, Y = (e, t = document) => fe(e).map(
|
|
1063
1073
|
(n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null
|
|
1064
1074
|
).flat().filter(Boolean), Jt = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1065
1075
|
switch (o) {
|
|
@@ -1118,8 +1128,8 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1118
1128
|
};
|
|
1119
1129
|
for (const f of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1120
1130
|
typeof this[f] == "function" && (this[f] = this[f].bind(this));
|
|
1121
|
-
const { document:
|
|
1122
|
-
this._area =
|
|
1131
|
+
const { document: l, selectionAreaClass: u, selectionContainerClass: a } = this._options;
|
|
1132
|
+
this._area = l.createElement("div"), this._clippingElement = l.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(u), a && this._clippingElement.classList.add(a), j(this._area, {
|
|
1123
1133
|
willChange: "top, left, bottom, right, width, height",
|
|
1124
1134
|
top: 0,
|
|
1125
1135
|
left: 0,
|
|
@@ -1136,19 +1146,19 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1136
1146
|
}), this.enable();
|
|
1137
1147
|
}
|
|
1138
1148
|
_toggleStartEvents(t = !0) {
|
|
1139
|
-
const { document: n, features: o } = this._options, i = t ? P :
|
|
1149
|
+
const { document: n, features: o } = this._options, i = t ? P : A;
|
|
1140
1150
|
i(n, "mousedown", this._onTapStart), o.touch && i(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1141
1151
|
}
|
|
1142
1152
|
_onTapStart(t, n = !1) {
|
|
1143
|
-
const { x: o, y: i, target: s } = J(t), { document: r, startAreas:
|
|
1153
|
+
const { x: o, y: i, target: s } = J(t), { document: r, startAreas: l, boundaries: u, features: a, behaviour: f } = this._options, h = s.getBoundingClientRect();
|
|
1144
1154
|
if (t instanceof MouseEvent && !Jt(t, f.triggers))
|
|
1145
1155
|
return;
|
|
1146
|
-
const g = Y(
|
|
1156
|
+
const g = Y(l, r), d = Y(u, r);
|
|
1147
1157
|
this._targetElement = d.find(
|
|
1148
1158
|
(v) => je(v.getBoundingClientRect(), h)
|
|
1149
1159
|
);
|
|
1150
|
-
const
|
|
1151
|
-
if (this._targetBoundary = d.find((v) =>
|
|
1160
|
+
const c = t.composedPath(), p = g.find((v) => c.includes(v));
|
|
1161
|
+
if (this._targetBoundary = d.find((v) => c.includes(v)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1152
1162
|
return;
|
|
1153
1163
|
this._areaLocation = { x1: o, y1: i, x2: 0, y2: 0 };
|
|
1154
1164
|
const m = r.scrollingElement ?? r.body;
|
|
@@ -1161,10 +1171,10 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1161
1171
|
s = i.target;
|
|
1162
1172
|
else if (n === "touch") {
|
|
1163
1173
|
this.resolveSelectables();
|
|
1164
|
-
const { x:
|
|
1174
|
+
const { x: l, y: u } = i;
|
|
1165
1175
|
s = this._selectables.find((a) => {
|
|
1166
1176
|
const { right: f, left: h, top: g, bottom: d } = a.getBoundingClientRect();
|
|
1167
|
-
return
|
|
1177
|
+
return l < f && l > h && u < d && u > g;
|
|
1168
1178
|
});
|
|
1169
1179
|
}
|
|
1170
1180
|
if (!s)
|
|
@@ -1178,22 +1188,22 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1178
1188
|
}
|
|
1179
1189
|
const { stored: r } = this._selection;
|
|
1180
1190
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1181
|
-
const
|
|
1191
|
+
const l = this._latestElement, [u, a] = l.compareDocumentPosition(s) & 4 ? [s, l] : [l, s], f = [...this._selectables.filter(
|
|
1182
1192
|
(h) => h.compareDocumentPosition(u) & 4 && h.compareDocumentPosition(a) & 2
|
|
1183
1193
|
), u, a];
|
|
1184
|
-
this.select(f), this._latestElement =
|
|
1194
|
+
this.select(f), this._latestElement = l;
|
|
1185
1195
|
} else
|
|
1186
|
-
r.includes(s) && (r.length === 1 || t.ctrlKey || r.every((
|
|
1196
|
+
r.includes(s) && (r.length === 1 || t.ctrlKey || r.every((l) => this._selection.stored.includes(l))) ? this.deselect(s) : (this.select(s), this._latestElement = s);
|
|
1187
1197
|
}
|
|
1188
1198
|
_delayedTapMove(t) {
|
|
1189
|
-
const { container: n, document: o, behaviour: { startThreshold: i } } = this._options, { x1: s, y1: r } = this._areaLocation, { x:
|
|
1199
|
+
const { container: n, document: o, behaviour: { startThreshold: i } } = this._options, { x1: s, y1: r } = this._areaLocation, { x: l, y: u } = J(t);
|
|
1190
1200
|
if (
|
|
1191
1201
|
// Single number for both coordinates
|
|
1192
|
-
typeof i == "number" && F(
|
|
1193
|
-
typeof i == "object" && F(
|
|
1202
|
+
typeof i == "number" && F(l + u - (s + r)) >= i || // Different x and y threshold
|
|
1203
|
+
typeof i == "object" && F(l - s) >= i.x || F(u - r) >= i.y
|
|
1194
1204
|
) {
|
|
1195
|
-
if (
|
|
1196
|
-
|
|
1205
|
+
if (A(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1206
|
+
A(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1197
1207
|
return;
|
|
1198
1208
|
}
|
|
1199
1209
|
P(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), j(this._area, "display", "block"), Y(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 && (P(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), P(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);
|
|
@@ -1221,7 +1231,7 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1221
1231
|
}));
|
|
1222
1232
|
}
|
|
1223
1233
|
_onTapMove(t) {
|
|
1224
|
-
const { _scrollSpeed: n, _areaLocation: o, _options: i, _frame: s } = this, { speedDivider: r } = i.behaviour.scrolling,
|
|
1234
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: i, _frame: s } = this, { speedDivider: r } = i.behaviour.scrolling, l = this._targetElement, { x: u, y: a } = J(t);
|
|
1225
1235
|
if (o.x2 = u, o.y2 = a, this._lastMousePosition.x = u, this._lastMousePosition.y = a, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1226
1236
|
this._scrollingActive = !0;
|
|
1227
1237
|
const f = () => {
|
|
@@ -1229,8 +1239,8 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1229
1239
|
this._scrollingActive = !1;
|
|
1230
1240
|
return;
|
|
1231
1241
|
}
|
|
1232
|
-
const { scrollTop: h, scrollLeft: g } =
|
|
1233
|
-
n.y && (
|
|
1242
|
+
const { scrollTop: h, scrollLeft: g } = l;
|
|
1243
|
+
n.y && (l.scrollTop += He(n.y / r), o.y1 -= l.scrollTop - h), n.x && (l.scrollLeft += He(n.x / r), o.x1 -= l.scrollLeft - g), s.next(t), requestAnimationFrame(f);
|
|
1234
1244
|
};
|
|
1235
1245
|
requestAnimationFrame(f);
|
|
1236
1246
|
} else
|
|
@@ -1246,7 +1256,7 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1246
1256
|
this._areaLocation.x1 += t.x - i, this._areaLocation.y1 += t.y - o, t.x = i, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1247
1257
|
}
|
|
1248
1258
|
_onStartAreaScroll() {
|
|
1249
|
-
this._targetBoundaryScrolled = !0,
|
|
1259
|
+
this._targetBoundaryScrolled = !0, A(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1250
1260
|
}
|
|
1251
1261
|
_wheelScroll(t) {
|
|
1252
1262
|
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0, i = t.deltaX ? t.deltaX > 0 ? 1 : -1 : 0;
|
|
@@ -1262,12 +1272,12 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1262
1272
|
});
|
|
1263
1273
|
}
|
|
1264
1274
|
_recalculateSelectionAreaRect() {
|
|
1265
|
-
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: i } = this, { scrollTop: s, scrollHeight: r, clientHeight:
|
|
1266
|
-
let { x2:
|
|
1275
|
+
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: i } = this, { scrollTop: s, scrollHeight: r, clientHeight: l, scrollLeft: u, scrollWidth: a, clientWidth: f } = o, h = this._targetRect, { x1: g, y1: d } = n;
|
|
1276
|
+
let { x2: c, y2: p } = n;
|
|
1267
1277
|
const { behaviour: { scrolling: { startScrollMargins: m } } } = i;
|
|
1268
|
-
|
|
1269
|
-
const v = $e(g,
|
|
1270
|
-
this._areaRect = Oe(v, b,
|
|
1278
|
+
c < h.left + m.x ? (t.x = u ? -F(h.left - c + m.x) : 0, c = c < h.left ? h.left : c) : c > h.right - m.x ? (t.x = a - u - f ? F(h.left + h.width - c - m.x) : 0, c = c > h.right ? h.right : c) : t.x = 0, p < h.top + m.y ? (t.y = s ? -F(h.top - p + m.y) : 0, p = p < h.top ? h.top : p) : p > h.bottom - m.y ? (t.y = r - s - l ? F(h.top + h.height - p - m.y) : 0, p = p > h.bottom ? h.bottom : p) : t.y = 0;
|
|
1279
|
+
const v = $e(g, c), b = $e(d, p), w = Pe(g, c), E = Pe(d, p);
|
|
1280
|
+
this._areaRect = Oe(v, b, w - v, E - b);
|
|
1271
1281
|
}
|
|
1272
1282
|
_redrawSelectionArea() {
|
|
1273
1283
|
const { x: t, y: n, width: o, height: i } = this._areaRect, { style: s } = this._area;
|
|
@@ -1276,15 +1286,15 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1276
1286
|
_onTapStop(t, n) {
|
|
1277
1287
|
var o;
|
|
1278
1288
|
const { document: i, features: s } = this._options, { _singleClick: r } = this;
|
|
1279
|
-
|
|
1289
|
+
A(this._targetElement, "scroll", this._onStartAreaScroll), A(i, ["mousemove", "touchmove"], this._delayedTapMove), A(i, ["touchmove", "mousemove"], this._onTapMove), A(i, ["mouseup", "touchcancel", "touchend"], this._onTapStop), A(i, "scroll", this._onScroll), this._keepSelection(), t && r && s.singleTap.allow ? this._onSingleTap(t) : !r && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, A(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), A(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), j(this._area, "display", "none");
|
|
1280
1290
|
}
|
|
1281
1291
|
_updateElementSelection() {
|
|
1282
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: i } = this, { stored: s, selected: r, touched:
|
|
1292
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: i } = this, { stored: s, selected: r, touched: l } = o, { intersect: u, overlap: a } = n.behaviour, f = a === "invert", h = [], g = [], d = [];
|
|
1283
1293
|
for (let p = 0; p < t.length; p++) {
|
|
1284
1294
|
const m = t[p];
|
|
1285
1295
|
if (je(i, m.getBoundingClientRect(), u)) {
|
|
1286
1296
|
if (r.includes(m))
|
|
1287
|
-
s.includes(m) && !
|
|
1297
|
+
s.includes(m) && !l.includes(m) && l.push(m);
|
|
1288
1298
|
else if (f && s.includes(m)) {
|
|
1289
1299
|
d.push(m);
|
|
1290
1300
|
continue;
|
|
@@ -1294,12 +1304,12 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1294
1304
|
}
|
|
1295
1305
|
}
|
|
1296
1306
|
f && g.push(...s.filter((p) => !r.includes(p)));
|
|
1297
|
-
const
|
|
1307
|
+
const c = a === "keep";
|
|
1298
1308
|
for (let p = 0; p < r.length; p++) {
|
|
1299
1309
|
const m = r[p];
|
|
1300
1310
|
!h.includes(m) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1301
1311
|
// not make them part of the current selection as soon as they're touched.
|
|
1302
|
-
(
|
|
1312
|
+
(c && s.includes(m)) && d.push(m);
|
|
1303
1313
|
}
|
|
1304
1314
|
o.selected = h, o.changed = { added: g, removed: d }, this._latestElement = void 0;
|
|
1305
1315
|
}
|
|
@@ -1311,11 +1321,11 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1311
1321
|
});
|
|
1312
1322
|
}
|
|
1313
1323
|
_keepSelection() {
|
|
1314
|
-
const { _options: t, _selection: n } = this, { selected: o, changed: i, touched: s, stored: r } = n,
|
|
1324
|
+
const { _options: t, _selection: n } = this, { selected: o, changed: i, touched: s, stored: r } = n, l = o.filter((u) => !r.includes(u));
|
|
1315
1325
|
switch (t.behaviour.overlap) {
|
|
1316
1326
|
case "drop": {
|
|
1317
1327
|
n.stored = [
|
|
1318
|
-
...
|
|
1328
|
+
...l,
|
|
1319
1329
|
...r.filter((u) => !s.includes(u))
|
|
1320
1330
|
// Elements not touched
|
|
1321
1331
|
];
|
|
@@ -1323,7 +1333,7 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1323
1333
|
}
|
|
1324
1334
|
case "invert": {
|
|
1325
1335
|
n.stored = [
|
|
1326
|
-
...
|
|
1336
|
+
...l,
|
|
1327
1337
|
...r.filter((u) => !i.removed.includes(u))
|
|
1328
1338
|
// Elements not removed from selection
|
|
1329
1339
|
];
|
|
@@ -1417,7 +1427,7 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1417
1427
|
*/
|
|
1418
1428
|
select(t, n = !1) {
|
|
1419
1429
|
const { changed: o, selected: i, stored: s } = this._selection, r = Y(t, this._options.document).filter(
|
|
1420
|
-
(
|
|
1430
|
+
(l) => !i.includes(l) && !s.includes(l)
|
|
1421
1431
|
);
|
|
1422
1432
|
return s.push(...r), i.push(...r), o.added.push(...r), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), r;
|
|
1423
1433
|
}
|
|
@@ -1428,10 +1438,10 @@ const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1428
1438
|
*/
|
|
1429
1439
|
deselect(t, n = !1) {
|
|
1430
1440
|
const { selected: o, stored: i, changed: s } = this._selection, r = Y(t, this._options.document).filter(
|
|
1431
|
-
(
|
|
1441
|
+
(l) => o.includes(l) || i.includes(l)
|
|
1432
1442
|
);
|
|
1433
|
-
this._selection.stored = i.filter((
|
|
1434
|
-
...r.filter((
|
|
1443
|
+
this._selection.stored = i.filter((l) => !r.includes(l)), this._selection.selected = o.filter((l) => !r.includes(l)), this._selection.changed.added = [], this._selection.changed.removed.push(
|
|
1444
|
+
...r.filter((l) => !s.removed.includes(l))
|
|
1435
1445
|
), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
1436
1446
|
}
|
|
1437
1447
|
};
|
|
@@ -1504,7 +1514,7 @@ function Qt(e) {
|
|
|
1504
1514
|
const en = function(e, t = !0) {
|
|
1505
1515
|
this.theme = e;
|
|
1506
1516
|
const o = {
|
|
1507
|
-
...(e.type === "dark" ?
|
|
1517
|
+
...(e.type === "dark" ? ge : pe).cssVar,
|
|
1508
1518
|
...e.cssVar
|
|
1509
1519
|
}, i = Object.keys(o);
|
|
1510
1520
|
for (let s = 0; s < i.length; s++) {
|
|
@@ -1572,13 +1582,13 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1572
1582
|
if (X(o), i.children[1])
|
|
1573
1583
|
i.nextSibling.appendChild(n);
|
|
1574
1584
|
else {
|
|
1575
|
-
const
|
|
1576
|
-
i.appendChild(
|
|
1585
|
+
const l = e.createChildren([n]);
|
|
1586
|
+
i.appendChild(we(!0)), i.insertAdjacentElement("afterend", l);
|
|
1577
1587
|
}
|
|
1578
1588
|
e.linkDiv(n.offsetParent);
|
|
1579
1589
|
} else
|
|
1580
1590
|
i.tagName === "ME-ROOT" && (rn(e, o.nodeObj) === 0 ? (s = e.container.querySelector(".lhs")) == null || s.appendChild(n) : (r = e.container.querySelector(".rhs")) == null || r.appendChild(n), e.linkDiv());
|
|
1581
|
-
},
|
|
1591
|
+
}, ln = function(e, t) {
|
|
1582
1592
|
const n = e.parentNode;
|
|
1583
1593
|
if (t === 0) {
|
|
1584
1594
|
const o = n.parentNode.parentNode;
|
|
@@ -1591,16 +1601,16 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1591
1601
|
}, X = function(e) {
|
|
1592
1602
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
1593
1603
|
(n == null ? void 0 : n.tagName) === "svg" && (n == null || n.remove());
|
|
1594
|
-
},
|
|
1595
|
-
const n = e.nodeObj, o =
|
|
1604
|
+
}, cn = function(e, t) {
|
|
1605
|
+
const n = e.nodeObj, o = ve(n);
|
|
1596
1606
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
1597
1607
|
const i = Object.assign(n, t);
|
|
1598
|
-
|
|
1608
|
+
ye(e, i), this.linkDiv(), this.bus.fire("operation", {
|
|
1599
1609
|
name: "reshapeNode",
|
|
1600
1610
|
obj: i,
|
|
1601
1611
|
origin: o
|
|
1602
1612
|
});
|
|
1603
|
-
},
|
|
1613
|
+
}, xe = function(e, t, n) {
|
|
1604
1614
|
if (!t)
|
|
1605
1615
|
return null;
|
|
1606
1616
|
const o = t.nodeObj;
|
|
@@ -1630,8 +1640,8 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1630
1640
|
s.direction = d;
|
|
1631
1641
|
}
|
|
1632
1642
|
on(s, e, i), $(this.nodeData);
|
|
1633
|
-
const r = o.parentElement, { grp:
|
|
1634
|
-
r.parentElement.insertAdjacentElement(tt[e],
|
|
1643
|
+
const r = o.parentElement, { grp: l, top: u } = this.createWrapper(s);
|
|
1644
|
+
r.parentElement.insertAdjacentElement(tt[e], l), this.linkDiv(l.offsetParent), n || this.editTopic(u.firstChild), this.selectNode(u.firstChild, !0), this.bus.fire("operation", {
|
|
1635
1645
|
name: "insertSibling",
|
|
1636
1646
|
type: e,
|
|
1637
1647
|
obj: s
|
|
@@ -1646,10 +1656,10 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1646
1656
|
return;
|
|
1647
1657
|
const i = t || this.generateNewObj();
|
|
1648
1658
|
sn(o, i), $(this.nodeData);
|
|
1649
|
-
const s = n.parentElement.parentElement, { grp: r, top:
|
|
1650
|
-
|
|
1659
|
+
const s = n.parentElement.parentElement, { grp: r, top: l } = this.createWrapper(i, !0);
|
|
1660
|
+
l.appendChild(we(!0)), s.insertAdjacentElement("afterend", r);
|
|
1651
1661
|
const u = this.createChildren([s]);
|
|
1652
|
-
|
|
1662
|
+
l.insertAdjacentElement("afterend", u), this.linkDiv(), t || this.editTopic(l.firstChild), this.selectNode(l.firstChild, !0), this.bus.fire("operation", {
|
|
1653
1663
|
name: "insertParent",
|
|
1654
1664
|
obj: i
|
|
1655
1665
|
});
|
|
@@ -1657,7 +1667,7 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1657
1667
|
const n = e || this.currentNode;
|
|
1658
1668
|
if (!n)
|
|
1659
1669
|
return;
|
|
1660
|
-
const o =
|
|
1670
|
+
const o = xe(this, n, t);
|
|
1661
1671
|
if (!o)
|
|
1662
1672
|
return;
|
|
1663
1673
|
const { newTop: i, newNodeObj: s } = o;
|
|
@@ -1666,9 +1676,9 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1666
1676
|
obj: s
|
|
1667
1677
|
}), t || this.editTopic(i.firstChild), this.selectNode(i.firstChild, !0);
|
|
1668
1678
|
}, un = function(e, t) {
|
|
1669
|
-
const n =
|
|
1670
|
-
|
|
1671
|
-
const o =
|
|
1679
|
+
const n = ve(e.nodeObj);
|
|
1680
|
+
me(n);
|
|
1681
|
+
const o = xe(this, t, n);
|
|
1672
1682
|
if (!o)
|
|
1673
1683
|
return;
|
|
1674
1684
|
const { newNodeObj: i } = o;
|
|
@@ -1677,16 +1687,16 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1677
1687
|
obj: i
|
|
1678
1688
|
});
|
|
1679
1689
|
}, fn = function(e, t) {
|
|
1680
|
-
e =
|
|
1690
|
+
e = le(e);
|
|
1681
1691
|
const n = [];
|
|
1682
1692
|
for (let o = 0; o < e.length; o++) {
|
|
1683
|
-
const i = e[o], s =
|
|
1684
|
-
|
|
1685
|
-
const r =
|
|
1693
|
+
const i = e[o], s = ve(i.nodeObj);
|
|
1694
|
+
me(s);
|
|
1695
|
+
const r = xe(this, t, s);
|
|
1686
1696
|
if (!r)
|
|
1687
1697
|
return;
|
|
1688
|
-
const { newNodeObj:
|
|
1689
|
-
n.push(
|
|
1698
|
+
const { newNodeObj: l } = r;
|
|
1699
|
+
n.push(l);
|
|
1690
1700
|
}
|
|
1691
1701
|
this.unselectNodes(this.currentNodes), this.selectNodes(n.map((o) => this.findEle(o.id))), this.bus.fire("operation", {
|
|
1692
1702
|
name: "copyNodes",
|
|
@@ -1717,10 +1727,10 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1717
1727
|
}, mn = function(e) {
|
|
1718
1728
|
if (e.length === 0)
|
|
1719
1729
|
return;
|
|
1720
|
-
e =
|
|
1730
|
+
e = le(e);
|
|
1721
1731
|
for (const n of e) {
|
|
1722
1732
|
const o = n.nodeObj, i = Ze(o);
|
|
1723
|
-
|
|
1733
|
+
ln(n, i);
|
|
1724
1734
|
}
|
|
1725
1735
|
const t = e[e.length - 1];
|
|
1726
1736
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
@@ -1728,7 +1738,7 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1728
1738
|
objs: e.map((n) => n.nodeObj)
|
|
1729
1739
|
});
|
|
1730
1740
|
}, vn = function(e, t) {
|
|
1731
|
-
e =
|
|
1741
|
+
e = le(e);
|
|
1732
1742
|
const n = t.nodeObj;
|
|
1733
1743
|
n.expanded === !1 && (this.expandNode(t, !0), t = this.findEle(n.id));
|
|
1734
1744
|
for (const o of e) {
|
|
@@ -1743,11 +1753,11 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1743
1753
|
toObj: n
|
|
1744
1754
|
});
|
|
1745
1755
|
}, nt = (e, t, n, o) => {
|
|
1746
|
-
e =
|
|
1756
|
+
e = le(e), t === "after" && (e = e.reverse());
|
|
1747
1757
|
const i = n.nodeObj, s = [];
|
|
1748
1758
|
for (const r of e) {
|
|
1749
|
-
const
|
|
1750
|
-
Qe(t,
|
|
1759
|
+
const l = r.nodeObj;
|
|
1760
|
+
Qe(t, l, i), $(o.nodeData), X(r);
|
|
1751
1761
|
const u = r.parentElement.parentNode;
|
|
1752
1762
|
s.includes(u.parentElement) || s.push(u.parentElement), n.parentElement.parentNode.insertAdjacentElement(tt[t], u);
|
|
1753
1763
|
}
|
|
@@ -1781,7 +1791,7 @@ const rn = function({ map: e, direction: t }, n) {
|
|
|
1781
1791
|
moveNodeIn: vn,
|
|
1782
1792
|
moveUpNode: pn,
|
|
1783
1793
|
removeNodes: mn,
|
|
1784
|
-
reshapeNode:
|
|
1794
|
+
reshapeNode: cn,
|
|
1785
1795
|
rmSubline: X,
|
|
1786
1796
|
setNodeTopic: xn
|
|
1787
1797
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -1797,16 +1807,16 @@ function En(e) {
|
|
|
1797
1807
|
const Cn = function(e) {
|
|
1798
1808
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
1799
1809
|
if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
|
|
1800
|
-
const s = n.left + n.width / 2, r = n.top + n.height / 2,
|
|
1810
|
+
const s = n.left + n.width / 2, r = n.top + n.height / 2, l = o.left + o.width / 2, u = o.top + o.height / 2, a = s - l, f = r - u;
|
|
1801
1811
|
this.move(-a, -f);
|
|
1802
1812
|
}
|
|
1803
1813
|
}, Sn = function(e, t, n) {
|
|
1804
1814
|
this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
1805
1815
|
}, Nn = function(e) {
|
|
1806
1816
|
this.selection.select(e);
|
|
1807
|
-
},
|
|
1817
|
+
}, kn = function(e) {
|
|
1808
1818
|
this.selection.deselect(e);
|
|
1809
|
-
},
|
|
1819
|
+
}, _n = function() {
|
|
1810
1820
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
1811
1821
|
}, Tn = function() {
|
|
1812
1822
|
const e = En(this);
|
|
@@ -1814,26 +1824,26 @@ const Cn = function(e) {
|
|
|
1814
1824
|
if (!(t === "parent" && typeof n != "string"))
|
|
1815
1825
|
return n;
|
|
1816
1826
|
});
|
|
1817
|
-
}, An = function() {
|
|
1818
|
-
return JSON.parse(this.getDataString());
|
|
1819
1827
|
}, Ln = function() {
|
|
1828
|
+
return JSON.parse(this.getDataString());
|
|
1829
|
+
}, An = function() {
|
|
1820
1830
|
this.editable = !0;
|
|
1821
1831
|
}, Mn = function() {
|
|
1822
1832
|
this.editable = !1;
|
|
1823
1833
|
}, Dn = function(e, t = { x: 0, y: 0 }) {
|
|
1824
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, i = t.y ? t.y - n.top - n.height / 2 : 0, { dx: s, dy: r } = it(this),
|
|
1825
|
-
this.map.style.transform = `translate(${u - d}px, ${a -
|
|
1834
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, i = t.y ? t.y - n.top - n.height / 2 : 0, { dx: s, dy: r } = it(this), l = this.map.style.transform, { x: u, y: a } = Ye(l), f = u - s, h = a - r, g = this.scaleVal, d = (-o + f) * (1 - e / g), c = (-i + h) * (1 - e / g);
|
|
1835
|
+
this.map.style.transform = `translate(${u - d}px, ${a - c}px) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
1826
1836
|
}, On = function() {
|
|
1827
1837
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
1828
1838
|
this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
|
|
1829
1839
|
}, jn = function(e, t) {
|
|
1830
1840
|
const { map: n, scaleVal: o, bus: i } = this, s = n.style.transform;
|
|
1831
|
-
let { x: r, y:
|
|
1832
|
-
r += e,
|
|
1841
|
+
let { x: r, y: l } = Ye(s);
|
|
1842
|
+
r += e, l += t, n.style.transform = `translate(${r}px, ${l}px) scale(${o})`, i.fire("move", { dx: e, dy: t });
|
|
1833
1843
|
}, it = (e) => {
|
|
1834
|
-
const { container: t, map: n, nodes: o } = e, i = n.querySelector("me-root"), s = i.offsetTop, r = i.offsetLeft,
|
|
1844
|
+
const { container: t, map: n, nodes: o } = e, i = n.querySelector("me-root"), s = i.offsetTop, r = i.offsetLeft, l = i.offsetWidth, u = i.offsetHeight;
|
|
1835
1845
|
let a, f;
|
|
1836
|
-
return e.alignment === "root" ? (a = t.offsetWidth / 2 - r -
|
|
1846
|
+
return e.alignment === "root" ? (a = t.offsetWidth / 2 - r - l / 2, f = t.offsetHeight / 2 - s - u / 2, n.style.transformOrigin = `${r + l / 2}px 50%`) : (a = (t.offsetWidth - o.offsetWidth) / 2, f = (t.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: a, dy: f };
|
|
1837
1847
|
}, Pn = function() {
|
|
1838
1848
|
const { map: e } = this, { dx: t, dy: n } = it(this);
|
|
1839
1849
|
e.style.transform = `translate(${t}px, ${n}px) scale(${this.scaleVal})`;
|
|
@@ -1873,17 +1883,17 @@ const Cn = function(e) {
|
|
|
1873
1883
|
};
|
|
1874
1884
|
typeof t == "boolean" ? o(n, t) : n.expanded !== !1 ? o(n, !1) : o(n, !0), this.refresh();
|
|
1875
1885
|
}, Gn = function(e) {
|
|
1876
|
-
e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), $(this.nodeData), this.layout(), this.linkDiv();
|
|
1886
|
+
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)), $(this.nodeData), this.layout(), this.linkDiv();
|
|
1877
1887
|
}, Kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1878
1888
|
__proto__: null,
|
|
1879
1889
|
cancelFocus: Bn,
|
|
1880
|
-
clearSelection:
|
|
1890
|
+
clearSelection: _n,
|
|
1881
1891
|
disableEdit: Mn,
|
|
1882
|
-
enableEdit:
|
|
1892
|
+
enableEdit: An,
|
|
1883
1893
|
expandNode: Vn,
|
|
1884
1894
|
expandNodeAll: Yn,
|
|
1885
1895
|
focusNode: Hn,
|
|
1886
|
-
getData:
|
|
1896
|
+
getData: Ln,
|
|
1887
1897
|
getDataString: Tn,
|
|
1888
1898
|
initLeft: Rn,
|
|
1889
1899
|
initRight: Fn,
|
|
@@ -1898,7 +1908,7 @@ const Cn = function(e) {
|
|
|
1898
1908
|
selectNodes: Nn,
|
|
1899
1909
|
setLocale: Wn,
|
|
1900
1910
|
toCenter: Pn,
|
|
1901
|
-
unselectNodes:
|
|
1911
|
+
unselectNodes: kn
|
|
1902
1912
|
}, Symbol.toStringTag, { value: "Module" })), qn = function(e) {
|
|
1903
1913
|
return {
|
|
1904
1914
|
dom: e,
|
|
@@ -1922,7 +1932,7 @@ const Cn = function(e) {
|
|
|
1922
1932
|
},
|
|
1923
1933
|
cb: null,
|
|
1924
1934
|
init(t, n) {
|
|
1925
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
1935
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = be([
|
|
1926
1936
|
{ dom: t, evt: "pointermove", func: this.handlePointerMove },
|
|
1927
1937
|
{ dom: t, evt: "pointerleave", func: this.handleClear },
|
|
1928
1938
|
{ dom: t, evt: "pointerup", func: this.handleClear },
|
|
@@ -1937,10 +1947,10 @@ const Cn = function(e) {
|
|
|
1937
1947
|
}, Re = {
|
|
1938
1948
|
create: qn
|
|
1939
1949
|
}, zn = "#4dc4ff";
|
|
1940
|
-
function st(e, t, n, o, i, s, r,
|
|
1950
|
+
function st(e, t, n, o, i, s, r, l) {
|
|
1941
1951
|
return {
|
|
1942
1952
|
x: e / 8 + n * 3 / 8 + i * 3 / 8 + r / 8,
|
|
1943
|
-
y: t / 8 + o * 3 / 8 + s * 3 / 8 +
|
|
1953
|
+
y: t / 8 + o * 3 / 8 + s * 3 / 8 + l / 8
|
|
1944
1954
|
};
|
|
1945
1955
|
}
|
|
1946
1956
|
function Un(e, t, n) {
|
|
@@ -1957,33 +1967,33 @@ function Z(e, t, n, o, i) {
|
|
|
1957
1967
|
y2: i + ""
|
|
1958
1968
|
});
|
|
1959
1969
|
}
|
|
1960
|
-
function Fe(e, t, n, o, i, s, r,
|
|
1970
|
+
function Fe(e, t, n, o, i, s, r, l, u, a) {
|
|
1961
1971
|
var d;
|
|
1962
|
-
if (e.line.setAttribute("d", `M ${t} ${n} C ${o} ${i} ${s} ${r} ${
|
|
1963
|
-
const
|
|
1964
|
-
|
|
1972
|
+
if (e.line.setAttribute("d", `M ${t} ${n} C ${o} ${i} ${s} ${r} ${l} ${u}`), a.style) {
|
|
1973
|
+
const c = a.style;
|
|
1974
|
+
c.stroke && e.line.setAttribute("stroke", c.stroke), c.strokeWidth && e.line.setAttribute("stroke-width", String(c.strokeWidth)), c.strokeDasharray && e.line.setAttribute("stroke-dasharray", c.strokeDasharray), c.strokeLinecap && e.line.setAttribute("stroke-linecap", c.strokeLinecap), c.opacity !== void 0 && e.line.setAttribute("opacity", String(c.opacity));
|
|
1965
1975
|
}
|
|
1966
|
-
const f = oe(s, r,
|
|
1967
|
-
if (f && (e.arrow1.setAttribute("d", `M ${f.x1} ${f.y1} L ${
|
|
1968
|
-
const
|
|
1969
|
-
|
|
1976
|
+
const f = oe(s, r, l, u);
|
|
1977
|
+
if (f && (e.arrow1.setAttribute("d", `M ${f.x1} ${f.y1} L ${l} ${u} L ${f.x2} ${f.y2}`), a.style)) {
|
|
1978
|
+
const c = a.style;
|
|
1979
|
+
c.stroke && e.arrow1.setAttribute("stroke", c.stroke), c.strokeWidth && e.arrow1.setAttribute("stroke-width", String(c.strokeWidth)), c.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", c.strokeLinecap), c.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(c.opacity));
|
|
1970
1980
|
}
|
|
1971
1981
|
if (a.bidirectional) {
|
|
1972
|
-
const
|
|
1973
|
-
if (
|
|
1982
|
+
const c = oe(o, i, t, n);
|
|
1983
|
+
if (c && (e.arrow2.setAttribute("d", `M ${c.x1} ${c.y1} L ${t} ${n} L ${c.x2} ${c.y2}`), a.style)) {
|
|
1974
1984
|
const p = a.style;
|
|
1975
1985
|
p.stroke && e.arrow2.setAttribute("stroke", p.stroke), p.strokeWidth && e.arrow2.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(p.opacity));
|
|
1976
1986
|
}
|
|
1977
1987
|
}
|
|
1978
|
-
const { x: h, y: g } = st(t, n, o, i, s, r,
|
|
1988
|
+
const { x: h, y: g } = st(t, n, o, i, s, r, l, u);
|
|
1979
1989
|
Un(e.label, h, g), (d = a.style) != null && d.labelColor && e.label.setAttribute("fill", a.style.labelColor), io(e);
|
|
1980
1990
|
}
|
|
1981
1991
|
function re(e, t, n) {
|
|
1982
|
-
const { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = t.offsetWidth, r = t.offsetHeight,
|
|
1992
|
+
const { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = t.offsetWidth, r = t.offsetHeight, l = o + s / 2, u = i + r / 2, a = l + n.x, f = u + n.y;
|
|
1983
1993
|
return {
|
|
1984
1994
|
w: s,
|
|
1985
1995
|
h: r,
|
|
1986
|
-
cx:
|
|
1996
|
+
cx: l,
|
|
1987
1997
|
cy: u,
|
|
1988
1998
|
ctrlX: a,
|
|
1989
1999
|
ctrlY: f
|
|
@@ -1998,30 +2008,30 @@ function G(e) {
|
|
|
1998
2008
|
};
|
|
1999
2009
|
}
|
|
2000
2010
|
const Xn = function(e, t, n, o) {
|
|
2001
|
-
const i = document.createElementNS(
|
|
2011
|
+
const i = document.createElementNS(_, "text");
|
|
2002
2012
|
return S(i, {
|
|
2003
2013
|
"text-anchor": "middle",
|
|
2004
2014
|
x: t + "",
|
|
2005
2015
|
y: n + "",
|
|
2006
2016
|
fill: o || "rgb(235, 95, 82)"
|
|
2007
2017
|
}), i.dataset.type = "custom-link", i.innerHTML = e, i;
|
|
2008
|
-
},
|
|
2009
|
-
var
|
|
2018
|
+
}, Ee = function(e, t, n, o, i) {
|
|
2019
|
+
var y;
|
|
2010
2020
|
if (!t || !n)
|
|
2011
2021
|
return;
|
|
2012
|
-
const s = re(e, t, o.delta1), r = re(e, n, o.delta2), { x:
|
|
2022
|
+
const s = re(e, t, o.delta1), r = re(e, n, o.delta2), { x: l, y: u } = G(s), { ctrlX: a, ctrlY: f } = s, { ctrlX: h, ctrlY: g } = r, { x: d, y: c } = G(r), p = oe(h, g, d, c);
|
|
2013
2023
|
if (!p)
|
|
2014
2024
|
return;
|
|
2015
|
-
const m = `M ${p.x1} ${p.y1} L ${d} ${
|
|
2025
|
+
const m = `M ${p.x1} ${p.y1} L ${d} ${c} L ${p.x2} ${p.y2}`;
|
|
2016
2026
|
let v = "";
|
|
2017
2027
|
if (o.bidirectional) {
|
|
2018
|
-
const C = oe(a, f,
|
|
2028
|
+
const C = oe(a, f, l, u);
|
|
2019
2029
|
if (!C)
|
|
2020
2030
|
return;
|
|
2021
|
-
v = `M ${C.x1} ${C.y1} L ${
|
|
2031
|
+
v = `M ${C.x1} ${C.y1} L ${l} ${u} L ${C.x2} ${C.y2}`;
|
|
2022
2032
|
}
|
|
2023
|
-
const b =
|
|
2024
|
-
b.appendChild(
|
|
2033
|
+
const b = _t(`M ${l} ${u} C ${a} ${f} ${h} ${g} ${d} ${c}`, m, v, o.style), { x: w, y: E } = st(l, u, a, f, h, g, d, c), N = (y = o.style) == null ? void 0 : y.labelColor, x = Xn(o.label, w, E, N);
|
|
2034
|
+
b.appendChild(x), b.label = x, b.arrowObj = o, b.dataset.linkid = o.id, e.linkSvgGroup.appendChild(b), i || (e.arrows.push(o), e.currentArrow = b, rt(e, o, s, r));
|
|
2025
2035
|
}, Jn = function(e, t, n = {}) {
|
|
2026
2036
|
const o = {
|
|
2027
2037
|
id: V(),
|
|
@@ -2038,13 +2048,14 @@ const Xn = function(e, t, n, o) {
|
|
|
2038
2048
|
},
|
|
2039
2049
|
...n
|
|
2040
2050
|
};
|
|
2041
|
-
|
|
2051
|
+
Ee(this, e, t, o), this.bus.fire("operation", {
|
|
2042
2052
|
name: "createArrow",
|
|
2043
2053
|
obj: o
|
|
2044
2054
|
});
|
|
2045
2055
|
}, Zn = function(e) {
|
|
2056
|
+
ce(this);
|
|
2046
2057
|
const t = { ...e, id: V() };
|
|
2047
|
-
|
|
2058
|
+
Ee(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2048
2059
|
name: "createArrow",
|
|
2049
2060
|
obj: t
|
|
2050
2061
|
});
|
|
@@ -2052,7 +2063,7 @@ const Xn = function(e, t, n, o) {
|
|
|
2052
2063
|
let t;
|
|
2053
2064
|
if (e ? t = e : t = this.currentArrow, !t)
|
|
2054
2065
|
return;
|
|
2055
|
-
|
|
2066
|
+
ce(this);
|
|
2056
2067
|
const n = t.arrowObj.id;
|
|
2057
2068
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.remove(), this.bus.fire("operation", {
|
|
2058
2069
|
name: "removeArrow",
|
|
@@ -2065,9 +2076,9 @@ const Xn = function(e, t, n, o) {
|
|
|
2065
2076
|
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), i = re(this, n, t.delta1), s = re(this, o, t.delta2);
|
|
2066
2077
|
rt(this, t, i, s);
|
|
2067
2078
|
}, to = function() {
|
|
2068
|
-
|
|
2069
|
-
},
|
|
2070
|
-
const n = document.createElementNS(
|
|
2079
|
+
ce(this), this.currentArrow = null;
|
|
2080
|
+
}, ae = function(e, t) {
|
|
2081
|
+
const n = document.createElementNS(_, "path");
|
|
2071
2082
|
return S(n, {
|
|
2072
2083
|
d: e,
|
|
2073
2084
|
stroke: t,
|
|
@@ -2077,13 +2088,13 @@ const Xn = function(e, t, n, o) {
|
|
|
2077
2088
|
"stroke-linejoin": "round"
|
|
2078
2089
|
}), n;
|
|
2079
2090
|
}, no = function(e, t) {
|
|
2080
|
-
const n = document.createElementNS(
|
|
2091
|
+
const n = document.createElementNS(_, "g");
|
|
2081
2092
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2082
|
-
const o =
|
|
2093
|
+
const o = ae(e.line.getAttribute("d"), t);
|
|
2083
2094
|
n.appendChild(o);
|
|
2084
|
-
const i =
|
|
2095
|
+
const i = ae(e.arrow1.getAttribute("d"), t);
|
|
2085
2096
|
if (n.appendChild(i), e.arrow2.getAttribute("d")) {
|
|
2086
|
-
const s =
|
|
2097
|
+
const s = ae(e.arrow2.getAttribute("d"), t);
|
|
2087
2098
|
n.appendChild(s);
|
|
2088
2099
|
}
|
|
2089
2100
|
e.insertBefore(n, e.firstChild);
|
|
@@ -2096,23 +2107,23 @@ const Xn = function(e, t, n, o) {
|
|
|
2096
2107
|
return;
|
|
2097
2108
|
const n = t.querySelectorAll("path");
|
|
2098
2109
|
n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
|
|
2099
|
-
},
|
|
2110
|
+
}, ce = function(e) {
|
|
2100
2111
|
var t, n;
|
|
2101
2112
|
(t = e.helper1) == null || t.destroy(), (n = e.helper2) == null || n.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && oo(e.currentArrow);
|
|
2102
2113
|
}, rt = function(e, t, n, o) {
|
|
2103
|
-
const { linkController: i, P2: s, P3: r, line1:
|
|
2114
|
+
const { linkController: i, P2: s, P3: r, line1: l, line2: u, nodes: a, map: f, currentArrow: h, bus: g } = e;
|
|
2104
2115
|
if (!h)
|
|
2105
2116
|
return;
|
|
2106
2117
|
i.style.display = "initial", s.style.display = "initial", r.style.display = "initial", a.appendChild(i), a.appendChild(s), a.appendChild(r), no(h, zn);
|
|
2107
|
-
let { x: d, y:
|
|
2108
|
-
s.style.cssText = `top:${m}px;left:${p}px;`, r.style.cssText = `top:${b}px;left:${v}px;`, Z(
|
|
2109
|
-
p = p + N / e.scaleVal, m = m +
|
|
2110
|
-
const
|
|
2111
|
-
d =
|
|
2112
|
-
}), e.helper2.init(f, (N,
|
|
2113
|
-
v = v + N / e.scaleVal, b = b +
|
|
2114
|
-
const
|
|
2115
|
-
|
|
2118
|
+
let { x: d, y: c } = G(n), { ctrlX: p, ctrlY: m } = n, { ctrlX: v, ctrlY: b } = o, { x: w, y: E } = G(o);
|
|
2119
|
+
s.style.cssText = `top:${m}px;left:${p}px;`, r.style.cssText = `top:${b}px;left:${v}px;`, Z(l, d, c, p, m), Z(u, v, b, w, E), e.helper1 = Re.create(s), e.helper2 = Re.create(r), e.helper1.init(f, (N, x) => {
|
|
2120
|
+
p = p + N / e.scaleVal, m = m + x / e.scaleVal;
|
|
2121
|
+
const y = G({ ...n, ctrlX: p, ctrlY: m });
|
|
2122
|
+
d = y.x, c = y.y, s.style.top = m + "px", s.style.left = p + "px", Fe(h, d, c, p, m, v, b, w, E, t), Z(l, d, c, p, m), t.delta1.x = p - n.cx, t.delta1.y = m - n.cy, g.fire("updateArrowDelta", t);
|
|
2123
|
+
}), e.helper2.init(f, (N, x) => {
|
|
2124
|
+
v = v + N / e.scaleVal, b = b + x / e.scaleVal;
|
|
2125
|
+
const y = G({ ...o, ctrlX: v, ctrlY: b });
|
|
2126
|
+
w = y.x, E = y.y, r.style.top = b + "px", r.style.left = v + "px", Fe(h, d, c, p, m, v, b, w, E, t), Z(u, v, b, w, E), t.delta2.x = v - o.cx, t.delta2.y = b - o.cy, g.fire("updateArrowDelta", t);
|
|
2116
2127
|
});
|
|
2117
2128
|
};
|
|
2118
2129
|
function so() {
|
|
@@ -2120,22 +2131,22 @@ function so() {
|
|
|
2120
2131
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
2121
2132
|
const t = this.arrows[e];
|
|
2122
2133
|
try {
|
|
2123
|
-
|
|
2134
|
+
Ee(this, this.findEle(t.from), this.findEle(t.to), t, !0);
|
|
2124
2135
|
} catch {
|
|
2125
2136
|
}
|
|
2126
2137
|
}
|
|
2127
2138
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
2128
2139
|
}
|
|
2129
2140
|
function ro(e) {
|
|
2130
|
-
if (
|
|
2141
|
+
if (ce(this), !e)
|
|
2131
2142
|
return;
|
|
2132
2143
|
const t = e.label;
|
|
2133
2144
|
ze(this, t, e.arrowObj);
|
|
2134
2145
|
}
|
|
2135
|
-
function
|
|
2146
|
+
function lo() {
|
|
2136
2147
|
this.arrows = this.arrows.filter((e) => ne(e.from, this.nodeData) && ne(e.to, this.nodeData));
|
|
2137
2148
|
}
|
|
2138
|
-
const
|
|
2149
|
+
const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2139
2150
|
__proto__: null,
|
|
2140
2151
|
createArrow: Jn,
|
|
2141
2152
|
createArrowFrom: Zn,
|
|
@@ -2143,7 +2154,7 @@ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2143
2154
|
removeArrow: Qn,
|
|
2144
2155
|
renderArrow: so,
|
|
2145
2156
|
selectArrow: eo,
|
|
2146
|
-
tidyArrow:
|
|
2157
|
+
tidyArrow: lo,
|
|
2147
2158
|
unselectArrow: to
|
|
2148
2159
|
}, Symbol.toStringTag, { value: "Module" })), ao = function(e) {
|
|
2149
2160
|
var u, a;
|
|
@@ -2165,7 +2176,7 @@ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2165
2176
|
let h = f.nodeObj;
|
|
2166
2177
|
const g = [];
|
|
2167
2178
|
for (; h.parent; ) {
|
|
2168
|
-
const d = h.parent,
|
|
2179
|
+
const d = h.parent, c = d.children, p = c == null ? void 0 : c.indexOf(h);
|
|
2169
2180
|
h = d, g.unshift({ node: h, index: p });
|
|
2170
2181
|
}
|
|
2171
2182
|
return g.length > t && (t = g.length), g;
|
|
@@ -2180,19 +2191,19 @@ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2180
2191
|
}
|
|
2181
2192
|
if (!o)
|
|
2182
2193
|
throw new Error("Can not select root node.");
|
|
2183
|
-
const i = n.map((f) => f[o - 1].index).sort(), s = i[0] || 0, r = i[i.length - 1] || 0,
|
|
2184
|
-
if (!
|
|
2194
|
+
const i = n.map((f) => f[o - 1].index).sort(), s = i[0] || 0, r = i[i.length - 1] || 0, l = n[0][o - 1].node;
|
|
2195
|
+
if (!l.parent)
|
|
2185
2196
|
throw new Error("Please select nodes in the same main topic.");
|
|
2186
2197
|
return {
|
|
2187
|
-
parent:
|
|
2198
|
+
parent: l.id,
|
|
2188
2199
|
start: s,
|
|
2189
2200
|
end: r
|
|
2190
2201
|
};
|
|
2191
2202
|
}, ho = function(e) {
|
|
2192
|
-
const t = document.createElementNS(
|
|
2203
|
+
const t = document.createElementNS(_, "g");
|
|
2193
2204
|
return t.setAttribute("id", e), t;
|
|
2194
2205
|
}, Ie = function(e, t) {
|
|
2195
|
-
const n = document.createElementNS(
|
|
2206
|
+
const n = document.createElementNS(_, "path");
|
|
2196
2207
|
return S(n, {
|
|
2197
2208
|
d: e,
|
|
2198
2209
|
stroke: t || "#666",
|
|
@@ -2201,7 +2212,7 @@ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2201
2212
|
"stroke-width": "2"
|
|
2202
2213
|
}), n;
|
|
2203
2214
|
}, We = function(e, t, n, o, i) {
|
|
2204
|
-
const s = document.createElementNS(
|
|
2215
|
+
const s = document.createElementNS(_, "text");
|
|
2205
2216
|
return S(s, {
|
|
2206
2217
|
"text-anchor": o,
|
|
2207
2218
|
x: t + "",
|
|
@@ -2214,25 +2225,25 @@ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2214
2225
|
return i.parent ? s = o.closest("me-main").className : s = e.findEle(i.children[n].id).closest("me-main").className, s;
|
|
2215
2226
|
}, Ce = function(e, t) {
|
|
2216
2227
|
var C;
|
|
2217
|
-
const { id: n, label: o, parent: i, start: s, end: r } = t, { nodes:
|
|
2218
|
-
let d = 1 / 0,
|
|
2219
|
-
for (let
|
|
2220
|
-
const O = (C = h.children) == null ? void 0 : C[
|
|
2228
|
+
const { id: n, label: o, parent: i, start: s, end: r } = t, { nodes: l, theme: u, summarySvg: a } = e, h = e.findEle(i).nodeObj, g = fo(e, t);
|
|
2229
|
+
let d = 1 / 0, c = 0, p = 0, m = 0;
|
|
2230
|
+
for (let k = s; k <= r; k++) {
|
|
2231
|
+
const O = (C = h.children) == null ? void 0 : C[k];
|
|
2221
2232
|
if (!O)
|
|
2222
2233
|
return e.removeSummary(n), null;
|
|
2223
|
-
const B = uo(e.findEle(O.id)), { offsetLeft: R, offsetTop: Se } = H(
|
|
2224
|
-
|
|
2234
|
+
const B = uo(e.findEle(O.id)), { offsetLeft: R, offsetTop: Se } = H(l, B), Ne = s === r ? 10 : 20;
|
|
2235
|
+
k === s && (p = Se + Ne), k === r && (m = Se + B.offsetHeight - Ne), R < d && (d = R), B.offsetWidth + R > c && (c = B.offsetWidth + R);
|
|
2225
2236
|
}
|
|
2226
2237
|
let v, b;
|
|
2227
|
-
const
|
|
2228
|
-
g === M.LHS ? (v = Ie(`M ${d + 10} ${
|
|
2229
|
-
const
|
|
2230
|
-
return
|
|
2238
|
+
const w = p + 10, E = m + 10, N = (w + E) / 2, x = u.cssVar["--color"];
|
|
2239
|
+
g === M.LHS ? (v = Ie(`M ${d + 10} ${w} c -5 0 -10 5 -10 10 L ${d} ${E - 10} c 0 5 5 10 10 10 M ${d} ${N} h -10`, x), b = We(o, d - 20, N + 6, "end", x)) : (v = Ie(`M ${c - 10} ${w} c 5 0 10 5 10 10 L ${c} ${E - 10} c 0 5 -5 10 -10 10 M ${c} ${N} h 10`, x), b = We(o, c + 20, N + 6, "start", x));
|
|
2240
|
+
const y = ho("s-" + n);
|
|
2241
|
+
return y.appendChild(v), y.appendChild(b), y.summaryObj = t, a.appendChild(y), y;
|
|
2231
2242
|
}, po = function() {
|
|
2232
2243
|
if (!this.currentNodes)
|
|
2233
2244
|
return;
|
|
2234
|
-
const { currentNodes: e, summaries: t, bus: n } = this, { parent: o, start: i, end: s } = ao(e), r = { id: V(), parent: o, start: i, end: s, label: "summary" },
|
|
2235
|
-
t.push(r), this.editSummary(
|
|
2245
|
+
const { currentNodes: e, summaries: t, bus: n } = this, { parent: o, start: i, end: s } = ao(e), r = { id: V(), parent: o, start: i, end: s, label: "summary" }, l = Ce(this, r);
|
|
2246
|
+
t.push(r), this.editSummary(l), n.fire("operation", {
|
|
2236
2247
|
name: "createSummary",
|
|
2237
2248
|
obj: r
|
|
2238
2249
|
});
|
|
@@ -2250,7 +2261,7 @@ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2250
2261
|
obj: { id: e }
|
|
2251
2262
|
});
|
|
2252
2263
|
}, vo = function(e) {
|
|
2253
|
-
const t = e.children[1].getBBox(), n = 6, o = 3, i = document.createElementNS(
|
|
2264
|
+
const t = e.children[1].getBBox(), n = 6, o = 3, i = document.createElementNS(_, "rect");
|
|
2254
2265
|
S(i, {
|
|
2255
2266
|
x: t.x - n + "",
|
|
2256
2267
|
y: t.y - n + "",
|
|
@@ -2302,7 +2313,7 @@ function So(e, t, n, o) {
|
|
|
2302
2313
|
const i = document.createElementNS(T, "g");
|
|
2303
2314
|
let s = "";
|
|
2304
2315
|
return e.text ? s = e.text.textContent : s = e.childNodes[0].textContent, s.split(`
|
|
2305
|
-
`).forEach((
|
|
2316
|
+
`).forEach((l, u) => {
|
|
2306
2317
|
const a = document.createElementNS(T, "text");
|
|
2307
2318
|
S(a, {
|
|
2308
2319
|
x: n + parseInt(t.paddingLeft) + "",
|
|
@@ -2312,13 +2323,13 @@ function So(e, t, n, o) {
|
|
|
2312
2323
|
"font-size": `${t.fontSize}`,
|
|
2313
2324
|
"font-weight": `${t.fontWeight}`,
|
|
2314
2325
|
fill: `${t.color}`
|
|
2315
|
-
}), a.innerHTML =
|
|
2326
|
+
}), a.innerHTML = l, i.appendChild(a);
|
|
2316
2327
|
}), i;
|
|
2317
2328
|
}
|
|
2318
2329
|
function No(e, t, n, o) {
|
|
2319
|
-
var
|
|
2330
|
+
var l;
|
|
2320
2331
|
let i = "";
|
|
2321
|
-
(
|
|
2332
|
+
(l = e.nodeObj) != null && l.dangerouslySetInnerHTML ? i = e.nodeObj.dangerouslySetInnerHTML : e.text ? i = e.text.textContent : i = e.childNodes[0].textContent;
|
|
2322
2333
|
const s = document.createElementNS(T, "foreignObject");
|
|
2323
2334
|
S(s, {
|
|
2324
2335
|
x: n + parseInt(t.paddingLeft) + "",
|
|
@@ -2332,7 +2343,7 @@ function No(e, t, n, o) {
|
|
|
2332
2343
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2333
2344
|
}), r.innerHTML = i, s.appendChild(r), s;
|
|
2334
2345
|
}
|
|
2335
|
-
function
|
|
2346
|
+
function ko(e, t) {
|
|
2336
2347
|
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(T, "rect");
|
|
2337
2348
|
return S(s, {
|
|
2338
2349
|
x: o + "",
|
|
@@ -2359,12 +2370,12 @@ function Q(e, t, n = !1) {
|
|
|
2359
2370
|
stroke: o.borderColor,
|
|
2360
2371
|
"stroke-width": o.borderWidth
|
|
2361
2372
|
});
|
|
2362
|
-
const
|
|
2363
|
-
|
|
2373
|
+
const l = document.createElementNS(T, "g");
|
|
2374
|
+
l.appendChild(r);
|
|
2364
2375
|
let u;
|
|
2365
|
-
return n ? u = No(t, o, i, s) : u = So(t, o, i, s),
|
|
2376
|
+
return n ? u = No(t, o, i, s) : u = So(t, o, i, s), l.appendChild(u), l;
|
|
2366
2377
|
}
|
|
2367
|
-
function
|
|
2378
|
+
function _o(e, t) {
|
|
2368
2379
|
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(T, "a"), r = document.createElementNS(T, "text");
|
|
2369
2380
|
return S(r, {
|
|
2370
2381
|
x: o + "",
|
|
@@ -2386,17 +2397,17 @@ function To(e, t) {
|
|
|
2386
2397
|
href: t.src
|
|
2387
2398
|
}), s;
|
|
2388
2399
|
}
|
|
2389
|
-
const ee = 100,
|
|
2400
|
+
const ee = 100, Lo = '<?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">', Ao = (e, t = !1) => {
|
|
2390
2401
|
var h, g, d;
|
|
2391
|
-
const n = e.nodes, o = n.offsetHeight + ee * 2, i = n.offsetWidth + ee * 2, s = Eo(o + "px", i + "px"), r = document.createElementNS(T, "svg"),
|
|
2392
|
-
S(
|
|
2402
|
+
const n = e.nodes, o = n.offsetHeight + ee * 2, i = n.offsetWidth + ee * 2, s = Eo(o + "px", i + "px"), r = document.createElementNS(T, "svg"), l = document.createElementNS(T, "rect");
|
|
2403
|
+
S(l, {
|
|
2393
2404
|
x: "0",
|
|
2394
2405
|
y: "0",
|
|
2395
2406
|
width: `${i}`,
|
|
2396
2407
|
height: `${o}`,
|
|
2397
2408
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2398
|
-
}), s.appendChild(
|
|
2399
|
-
const p =
|
|
2409
|
+
}), s.appendChild(l), n.querySelectorAll(".subLines").forEach((c) => {
|
|
2410
|
+
const p = c.cloneNode(!0), { offsetLeft: m, offsetTop: v } = H(n, c.parentElement);
|
|
2400
2411
|
p.setAttribute("x", `${m}`), p.setAttribute("y", `${v}`), r.appendChild(p);
|
|
2401
2412
|
});
|
|
2402
2413
|
const u = (h = n.querySelector(".lines")) == null ? void 0 : h.cloneNode(!0);
|
|
@@ -2404,22 +2415,22 @@ const ee = 100, Ao = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2404
2415
|
const a = (g = n.querySelector(".topiclinks")) == null ? void 0 : g.cloneNode(!0);
|
|
2405
2416
|
a && r.appendChild(a);
|
|
2406
2417
|
const f = (d = n.querySelector(".summary")) == null ? void 0 : d.cloneNode(!0);
|
|
2407
|
-
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((
|
|
2408
|
-
|
|
2409
|
-
}), n.querySelectorAll(".tags > span").forEach((
|
|
2410
|
-
r.appendChild(Q(e,
|
|
2411
|
-
}), n.querySelectorAll(".icons > span").forEach((
|
|
2412
|
-
r.appendChild(Q(e,
|
|
2413
|
-
}), n.querySelectorAll(".hyper-link").forEach((
|
|
2414
|
-
r.appendChild(
|
|
2415
|
-
}), n.querySelectorAll("img").forEach((
|
|
2416
|
-
r.appendChild(To(e,
|
|
2418
|
+
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((c) => {
|
|
2419
|
+
c.nodeObj.dangerouslySetInnerHTML ? r.appendChild(Q(e, c, !t)) : (r.appendChild(ko(e, c)), r.appendChild(Q(e, c.text, !t)));
|
|
2420
|
+
}), n.querySelectorAll(".tags > span").forEach((c) => {
|
|
2421
|
+
r.appendChild(Q(e, c));
|
|
2422
|
+
}), n.querySelectorAll(".icons > span").forEach((c) => {
|
|
2423
|
+
r.appendChild(Q(e, c));
|
|
2424
|
+
}), n.querySelectorAll(".hyper-link").forEach((c) => {
|
|
2425
|
+
r.appendChild(_o(e, c));
|
|
2426
|
+
}), n.querySelectorAll("img").forEach((c) => {
|
|
2427
|
+
r.appendChild(To(e, c));
|
|
2417
2428
|
}), S(r, {
|
|
2418
2429
|
x: ee + "",
|
|
2419
2430
|
y: ee + "",
|
|
2420
2431
|
overflow: "visible"
|
|
2421
2432
|
}), s.appendChild(r), s;
|
|
2422
|
-
}, Mo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"),
|
|
2433
|
+
}, Mo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Lo + e.outerHTML);
|
|
2423
2434
|
function Do(e) {
|
|
2424
2435
|
return new Promise((t, n) => {
|
|
2425
2436
|
const o = new FileReader();
|
|
@@ -2431,15 +2442,15 @@ function Do(e) {
|
|
|
2431
2442
|
});
|
|
2432
2443
|
}
|
|
2433
2444
|
const Oo = function(e = !1, t) {
|
|
2434
|
-
const n =
|
|
2445
|
+
const n = Ao(this, e), o = Mo(n, t);
|
|
2435
2446
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2436
2447
|
}, jo = async function(e = !1, t) {
|
|
2437
2448
|
const n = this.exportSvg(e, t), o = await Do(n);
|
|
2438
2449
|
return new Promise((i, s) => {
|
|
2439
2450
|
const r = new Image();
|
|
2440
2451
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
2441
|
-
const
|
|
2442
|
-
|
|
2452
|
+
const l = document.createElement("canvas");
|
|
2453
|
+
l.width = r.width, l.height = r.height, l.getContext("2d").drawImage(r, 0, 0), l.toBlob(i, "image/png", 1);
|
|
2443
2454
|
}, r.src = o, r.onerror = s;
|
|
2444
2455
|
});
|
|
2445
2456
|
}, Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -2453,17 +2464,17 @@ function $o(e, t) {
|
|
|
2453
2464
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2454
2465
|
};
|
|
2455
2466
|
}
|
|
2456
|
-
const Ve = Object.keys(ot),
|
|
2467
|
+
const Ve = Object.keys(ot), lt = {};
|
|
2457
2468
|
for (let e = 0; e < Ve.length; e++) {
|
|
2458
2469
|
const t = Ve[e];
|
|
2459
|
-
|
|
2470
|
+
lt[t] = $o(ot[t], t);
|
|
2460
2471
|
}
|
|
2461
2472
|
const Ho = {
|
|
2462
2473
|
getObjById: ne,
|
|
2463
2474
|
generateNewObj: dt,
|
|
2464
2475
|
layout: yt,
|
|
2465
2476
|
linkDiv: Tt,
|
|
2466
|
-
editTopic:
|
|
2477
|
+
editTopic: kt,
|
|
2467
2478
|
createWrapper: Et,
|
|
2468
2479
|
createParent: Ct,
|
|
2469
2480
|
createChildren: St,
|
|
@@ -2471,38 +2482,38 @@ const Ho = {
|
|
|
2471
2482
|
findEle: Ge,
|
|
2472
2483
|
changeTheme: en,
|
|
2473
2484
|
...Kn,
|
|
2474
|
-
...
|
|
2475
|
-
...
|
|
2485
|
+
...lt,
|
|
2486
|
+
...co,
|
|
2476
2487
|
...xo,
|
|
2477
2488
|
...Po,
|
|
2478
2489
|
init(e) {
|
|
2479
2490
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData)
|
|
2480
2491
|
return new Error("MindElixir: `data` is required");
|
|
2481
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, $(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Kt(this), this.keypress && mt(this, this.keypress), this.editable && Qt(this), this.contextMenu && this.disposable.push(
|
|
2492
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, $(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Kt(this), this.keypress && mt(this, this.keypress), this.editable && Qt(this), this.contextMenu && this.disposable.push(Lt(this, this.contextMenu)), this.draggable && this.disposable.push(Ot(this)), this.allowUndo && this.disposable.push(Pt(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2482
2493
|
},
|
|
2483
2494
|
destroy() {
|
|
2484
2495
|
var e;
|
|
2485
2496
|
this.disposable.forEach((t) => t()), 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, (e = this.selection) == null || e.destroy(), this.selection = void 0;
|
|
2486
2497
|
}
|
|
2487
2498
|
};
|
|
2488
|
-
function Bo({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: r, cH:
|
|
2499
|
+
function Bo({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: r, cH: l, direction: u, containerHeight: a }) {
|
|
2489
2500
|
let f = t + n / 2;
|
|
2490
2501
|
const h = e + o / 2;
|
|
2491
2502
|
let g;
|
|
2492
2503
|
u === M.LHS ? g = s + r : g = s;
|
|
2493
|
-
const d = i +
|
|
2504
|
+
const d = i + l / 2, p = (1 - Math.abs(d - h) / a) * 0.25 * (n / 2);
|
|
2494
2505
|
return u === M.LHS ? f = f - n / 10 - p : f = f + n / 10 + p, `M ${f} ${h} Q ${f} ${d} ${g} ${d}`;
|
|
2495
2506
|
}
|
|
2496
|
-
function Ro({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: r, cH:
|
|
2507
|
+
function Ro({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: r, cH: l, direction: u, isFirst: a }) {
|
|
2497
2508
|
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2498
2509
|
let h = 0, g = 0;
|
|
2499
2510
|
a ? h = e + o / 2 : h = e + o;
|
|
2500
|
-
const d = i +
|
|
2501
|
-
let
|
|
2511
|
+
const d = i + l;
|
|
2512
|
+
let c = 0, p = 0, m = 0;
|
|
2502
2513
|
const v = Math.abs(h - d) / 300 * f;
|
|
2503
|
-
return u === M.LHS ? (m = t,
|
|
2514
|
+
return u === M.LHS ? (m = t, c = m + f, p = m - f, g = s + f, `M ${c} ${h} C ${m} ${h} ${m + v} ${d} ${p} ${d} H ${g}`) : (m = t + n, c = m - f, p = m + f, g = s + r - f, `M ${c} ${h} C ${m} ${h} ${m - v} ${d} ${p} ${d} H ${g}`);
|
|
2504
2515
|
}
|
|
2505
|
-
const Fo = "5.0.
|
|
2516
|
+
const Fo = "5.0.3";
|
|
2506
2517
|
function Io(e) {
|
|
2507
2518
|
return {
|
|
2508
2519
|
x: 0,
|
|
@@ -2527,30 +2538,31 @@ function D({
|
|
|
2527
2538
|
editable: i,
|
|
2528
2539
|
contextMenu: s,
|
|
2529
2540
|
toolBar: r,
|
|
2530
|
-
keypress:
|
|
2541
|
+
keypress: l,
|
|
2531
2542
|
mouseSelectionButton: u,
|
|
2532
2543
|
selectionContainer: a,
|
|
2533
2544
|
before: f,
|
|
2534
2545
|
newTopicName: h,
|
|
2535
2546
|
allowUndo: g,
|
|
2536
2547
|
generateMainBranch: d,
|
|
2537
|
-
generateSubBranch:
|
|
2548
|
+
generateSubBranch: c,
|
|
2538
2549
|
overflowHidden: p,
|
|
2539
2550
|
theme: m,
|
|
2540
2551
|
alignment: v,
|
|
2541
|
-
scaleSensitivity: b
|
|
2552
|
+
scaleSensitivity: b,
|
|
2553
|
+
handleWheel: w
|
|
2542
2554
|
}) {
|
|
2543
|
-
let
|
|
2544
|
-
const
|
|
2545
|
-
if (
|
|
2555
|
+
let E = null;
|
|
2556
|
+
const N = Object.prototype.toString.call(e);
|
|
2557
|
+
if (N === "[object HTMLDivElement]" ? E = e : N === "[object String]" && (E = document.querySelector(e)), !E)
|
|
2546
2558
|
throw new Error("MindElixir: el is not a valid element");
|
|
2547
|
-
|
|
2548
|
-
const
|
|
2549
|
-
this.theme = m || (
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
}, 300), this.map =
|
|
2559
|
+
E.style.position = "relative", E.innerHTML = "", this.el = E, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.newTopicName = h || "new node", this.contextMenu = s ?? !0, this.toolBar = r ?? !0, this.keypress = l ?? !0, this.mouseSelectionButton = u ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = i ?? !0, this.allowUndo = g ?? !1, this.scaleSensitivity = b ?? 0.2, this.generateMainBranch = d || Bo, this.generateSubBranch = c || Ro, this.overflowHidden = p ?? !1, this.alignment = v ?? "root", this.handleWheel = w ?? !0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Io(this), this.bus = bt(), this.container = z.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
|
|
2560
|
+
const x = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2561
|
+
this.theme = m || (x.matches ? ge : pe);
|
|
2562
|
+
const y = z.createElement("div");
|
|
2563
|
+
y.className = "map-canvas", setTimeout(() => {
|
|
2564
|
+
y.style.transition = "all 0.3s";
|
|
2565
|
+
}, 300), this.map = y, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = z.createElement("me-nodes"), this.lines = U("lines"), this.summarySvg = U("summary"), this.linkController = U("linkcontroller"), this.P2 = z.createElement("div"), this.P3 = z.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Te(), this.line2 = Te(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = U("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(vt(this));
|
|
2554
2566
|
}
|
|
2555
2567
|
D.prototype = Ho;
|
|
2556
2568
|
Object.defineProperty(D.prototype, "currentNode", {
|
|
@@ -2562,8 +2574,8 @@ Object.defineProperty(D.prototype, "currentNode", {
|
|
|
2562
2574
|
D.LEFT = 0;
|
|
2563
2575
|
D.RIGHT = 1;
|
|
2564
2576
|
D.SIDE = 2;
|
|
2565
|
-
D.THEME =
|
|
2566
|
-
D.DARK_THEME =
|
|
2577
|
+
D.THEME = pe;
|
|
2578
|
+
D.DARK_THEME = ge;
|
|
2567
2579
|
D.version = Fo;
|
|
2568
2580
|
D.E = Ge;
|
|
2569
2581
|
D.new = (e) => ({
|