mind-elixir 5.8.3-beta.1 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/MindElixir.css +1 -1
- package/dist/MindElixir.iife.js +3 -3
- package/dist/MindElixir.js +7 -6
- package/dist/MindElixirLite.css +1 -1
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +173 -172
- package/dist/PlaintextConverter.js +160 -110
- package/dist/types/arrow.d.ts +5 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/methods.d.ts +4 -4
- package/dist/types/types/index.d.ts +5 -1
- package/dist/types/utils/mindElixirToPlaintext.d.ts +8 -0
- package/dist/types/utils/plaintextConverter.d.ts +2 -18
- package/dist/types/utils/plaintextToMindElixir.d.ts +30 -0
- package/package.json +111 -111
- package/readme.md +470 -470
package/dist/MindElixirLite.js
CHANGED
|
@@ -77,16 +77,16 @@ const tt = function(t, e) {
|
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
79
|
function et(t, e, n, o) {
|
|
80
|
-
const s = n - t, i = o - e, l = Math.atan2(i, s) * 180 / Math.PI,
|
|
80
|
+
const s = n - t, i = o - e, l = Math.atan2(i, s) * 180 / Math.PI, a = 12, c = 30, h = (l + 180 - c) * Math.PI / 180, f = (l + 180 + c) * Math.PI / 180;
|
|
81
81
|
return {
|
|
82
|
-
x1: n + Math.cos(h) *
|
|
83
|
-
y1: o + Math.sin(h) *
|
|
84
|
-
x2: n + Math.cos(f) *
|
|
85
|
-
y2: o + Math.sin(f) *
|
|
82
|
+
x1: n + Math.cos(h) * a,
|
|
83
|
+
y1: o + Math.sin(h) * a,
|
|
84
|
+
x2: n + Math.cos(f) * a,
|
|
85
|
+
y2: o + Math.sin(f) * a
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
function _() {
|
|
89
|
-
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).
|
|
89
|
+
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
90
90
|
}
|
|
91
91
|
const Wt = function() {
|
|
92
92
|
const t = _();
|
|
@@ -153,7 +153,7 @@ const Wt = function() {
|
|
|
153
153
|
n.appendChild(i);
|
|
154
154
|
}
|
|
155
155
|
return n;
|
|
156
|
-
},
|
|
156
|
+
}, A = document, Mt = function(t, e) {
|
|
157
157
|
const o = (this?.el ? this.el : e || document).querySelector(`[data-nodeid="me${t}"]`);
|
|
158
158
|
if (!o) throw new Error(`FindEle: Node ${t} not found, maybe it's collapsed.`);
|
|
159
159
|
return o;
|
|
@@ -170,31 +170,31 @@ const Wt = function() {
|
|
|
170
170
|
if (e.image) {
|
|
171
171
|
const n = e.image;
|
|
172
172
|
if (n.url && n.width && n.height) {
|
|
173
|
-
const o =
|
|
173
|
+
const o = A.createElement("img");
|
|
174
174
|
o.src = this.imageProxy ? this.imageProxy(n.url) : n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), t.appendChild(o), t.image = o;
|
|
175
175
|
}
|
|
176
176
|
} else t.image && (t.image = void 0);
|
|
177
177
|
{
|
|
178
|
-
const n =
|
|
178
|
+
const n = A.createElement("span");
|
|
179
179
|
n.className = "text", this.markdown ? n.innerHTML = this.markdown(e.topic, e) : n.textContent = e.topic, t.appendChild(n), t.text = n;
|
|
180
180
|
}
|
|
181
181
|
if (e.hyperLink) {
|
|
182
|
-
const n =
|
|
182
|
+
const n = A.createElement("a");
|
|
183
183
|
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = e.hyperLink, t.appendChild(n), t.link = n;
|
|
184
184
|
} else t.link && (t.link = void 0);
|
|
185
185
|
if (e.icons && e.icons.length) {
|
|
186
|
-
const n =
|
|
186
|
+
const n = A.createElement("span");
|
|
187
187
|
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${Rt(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
|
|
188
188
|
} else t.icons && (t.icons = void 0);
|
|
189
189
|
if (e.tags && e.tags.length) {
|
|
190
|
-
const n =
|
|
190
|
+
const n = A.createElement("div");
|
|
191
191
|
n.className = "tags", e.tags.forEach((o) => {
|
|
192
|
-
const s =
|
|
192
|
+
const s = A.createElement("span");
|
|
193
193
|
typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
|
|
194
194
|
}), t.appendChild(n), t.tags = n;
|
|
195
195
|
} else t.tags && (t.tags = void 0);
|
|
196
196
|
}, zt = function(t, e) {
|
|
197
|
-
const n =
|
|
197
|
+
const n = A.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
|
|
198
198
|
if (n.appendChild(o), !e && t.children && t.children.length > 0) {
|
|
199
199
|
const i = Ut(t.expanded);
|
|
200
200
|
if (o.appendChild(i), t.expanded !== !1) {
|
|
@@ -204,24 +204,24 @@ const Wt = function() {
|
|
|
204
204
|
}
|
|
205
205
|
return { grp: n, top: o, tpc: s };
|
|
206
206
|
}, Ft = function(t) {
|
|
207
|
-
const e =
|
|
207
|
+
const e = A.createElement("me-parent"), n = this.createTopic(t);
|
|
208
208
|
return kt.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
|
|
209
209
|
}, qt = function(t) {
|
|
210
|
-
const e =
|
|
210
|
+
const e = A.createElement("me-children");
|
|
211
211
|
return e.append(...t), e;
|
|
212
212
|
}, jt = function(t) {
|
|
213
|
-
const e =
|
|
213
|
+
const e = A.createElement("me-tpc");
|
|
214
214
|
return e.nodeObj = t, e.dataset.nodeid = "me" + t.id, e;
|
|
215
215
|
};
|
|
216
216
|
function $t(t) {
|
|
217
|
-
const e =
|
|
217
|
+
const e = A.createRange();
|
|
218
218
|
e.selectNodeContents(t);
|
|
219
219
|
const n = window.getSelection();
|
|
220
220
|
n && (n.removeAllRanges(), n.addRange(e));
|
|
221
221
|
}
|
|
222
222
|
const _t = function(t) {
|
|
223
223
|
if (!t) return;
|
|
224
|
-
const e =
|
|
224
|
+
const e = A.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = I(this.nodes, t);
|
|
225
225
|
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
226
226
|
const r = getComputedStyle(t);
|
|
227
227
|
e.style.cssText = `
|
|
@@ -239,8 +239,8 @@ const _t = function(t) {
|
|
|
239
239
|
obj: t.nodeObj
|
|
240
240
|
}), e.addEventListener("keydown", (l) => {
|
|
241
241
|
l.stopPropagation();
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
242
|
+
const a = l.key;
|
|
243
|
+
if (a === "Enter" || a === "Tab") {
|
|
244
244
|
if (l.shiftKey) return;
|
|
245
245
|
l.preventDefault(), e.blur(), this.container.focus();
|
|
246
246
|
}
|
|
@@ -255,7 +255,7 @@ const _t = function(t) {
|
|
|
255
255
|
}));
|
|
256
256
|
});
|
|
257
257
|
}, Ut = function(t) {
|
|
258
|
-
const e =
|
|
258
|
+
const e = A.createElement("me-epd");
|
|
259
259
|
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
260
260
|
}, Kt = function(t) {
|
|
261
261
|
const n = t.parentElement.parentElement.lastElementChild;
|
|
@@ -273,7 +273,7 @@ function Jt(t) {
|
|
|
273
273
|
const Qt = function(t) {
|
|
274
274
|
const e = this.container, n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
275
275
|
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
276
|
-
const i = n.left + n.width / 2, r = n.top + n.height / 2, l = o.left + o.width / 2,
|
|
276
|
+
const i = n.left + n.width / 2, r = n.top + n.height / 2, l = o.left + o.width / 2, a = o.top + o.height / 2, c = i - l, h = r - a;
|
|
277
277
|
this.move(-c, -h, !0);
|
|
278
278
|
}
|
|
279
279
|
}, Zt = function(t, e, n) {
|
|
@@ -300,8 +300,8 @@ const Qt = function(t) {
|
|
|
300
300
|
this.editable = !1;
|
|
301
301
|
}, le = function(t, e = { x: 0, y: 0 }) {
|
|
302
302
|
if (t < this.scaleMin && t < this.scaleVal || t > this.scaleMax && t > this.scaleVal) return;
|
|
303
|
-
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = mt(this), l = this.map.style.transform, { x:
|
|
304
|
-
this.map.style.transform = `translate3d(${
|
|
303
|
+
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = mt(this), l = this.map.style.transform, { x: a, y: c } = gt(l), h = a - i, f = c - r, u = this.scaleVal, y = (-o + h) * (1 - t / u), m = (-s + f) * (1 - t / u);
|
|
304
|
+
this.map.style.transform = `translate3d(${a - y}px, ${c - m}px, 0) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
305
305
|
}, ce = function() {
|
|
306
306
|
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
307
307
|
this.scaleVal = n;
|
|
@@ -311,8 +311,8 @@ const Qt = function(t) {
|
|
|
311
311
|
const { map: o, scaleVal: s, bus: i, container: r, nodes: l } = this;
|
|
312
312
|
if (n && o.style.transition === "transform 0.3s")
|
|
313
313
|
return;
|
|
314
|
-
const
|
|
315
|
-
let { x: c, y: h } = gt(
|
|
314
|
+
const a = o.style.transform;
|
|
315
|
+
let { x: c, y: h } = gt(a);
|
|
316
316
|
const f = r.getBoundingClientRect(), u = l.getBoundingClientRect(), y = u.left < f.right && u.right > f.left, m = u.top < f.bottom && u.bottom > f.top;
|
|
317
317
|
if (y) {
|
|
318
318
|
const p = u.left + t, g = u.right + t;
|
|
@@ -331,8 +331,8 @@ const Qt = function(t) {
|
|
|
331
331
|
if (t.alignment === "nodes" || e)
|
|
332
332
|
i = (n.offsetWidth - s.offsetWidth) / 2, r = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
|
|
333
333
|
else {
|
|
334
|
-
const l = o.querySelector("me-root"),
|
|
335
|
-
i = n.offsetWidth / 2 - c - h / 2, r = n.offsetHeight / 2 -
|
|
334
|
+
const l = o.querySelector("me-root"), a = l.offsetTop, c = l.offsetLeft, h = l.offsetWidth, f = l.offsetHeight;
|
|
335
|
+
i = n.offsetWidth / 2 - c - h / 2, r = n.offsetHeight / 2 - a - f / 2, o.style.transformOrigin = `${c + h / 2}px 50%`;
|
|
336
336
|
}
|
|
337
337
|
return { dx: i, dy: r };
|
|
338
338
|
}, de = function() {
|
|
@@ -367,10 +367,10 @@ const Qt = function(t) {
|
|
|
367
367
|
} else
|
|
368
368
|
i.parentNode.children[1].remove();
|
|
369
369
|
this.linkDiv(t.closest("me-main > me-wrapper"));
|
|
370
|
-
const l = t.getBoundingClientRect(),
|
|
370
|
+
const l = t.getBoundingClientRect(), a = {
|
|
371
371
|
x: l.left,
|
|
372
372
|
y: l.top
|
|
373
|
-
}, c = s.x -
|
|
373
|
+
}, c = s.x - a.x, h = s.y - a.y;
|
|
374
374
|
this.move(c, h), this.bus.fire("expandNode", n);
|
|
375
375
|
}, we = function(t, e) {
|
|
376
376
|
const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
|
|
@@ -381,8 +381,8 @@ const Qt = function(t) {
|
|
|
381
381
|
const i = this.findEle(n.id).getBoundingClientRect(), r = {
|
|
382
382
|
x: i.left,
|
|
383
383
|
y: i.top
|
|
384
|
-
}, l = s.x - r.x,
|
|
385
|
-
this.move(l,
|
|
384
|
+
}, l = s.x - r.x, a = s.y - r.y;
|
|
385
|
+
this.move(l, a);
|
|
386
386
|
}, be = function(t) {
|
|
387
387
|
this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)), pt(this.nodeData), this.layout(), this.linkDiv();
|
|
388
388
|
}, xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -477,12 +477,12 @@ function xt(t, e, n, o = !1) {
|
|
|
477
477
|
if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
|
|
478
478
|
e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.selection?.cancel();
|
|
479
479
|
let i = t.currentNodes;
|
|
480
|
-
return i?.includes(s) || (t.selectNode(s), i = t.currentNodes), t.dragged = i, o &&
|
|
480
|
+
return i?.includes(s) || (t.selectNode(s), i = t.currentNodes), t.dragged = i, o && Pt(t, e), !0;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function At(t, e, n) {
|
|
483
483
|
t.style.transform = `translate(${e - 10}px, ${n - 10}px)`, t.style.display = "block";
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function Pt(t, e) {
|
|
486
486
|
const { dragged: n } = t;
|
|
487
487
|
if (!n) return;
|
|
488
488
|
const o = document.activeElement;
|
|
@@ -495,16 +495,16 @@ function De(t, e, n) {
|
|
|
495
495
|
const { dragged: o } = t;
|
|
496
496
|
if (!o || e.pointerId !== n.pointerId) return;
|
|
497
497
|
const s = n.clientX - e.startX, i = n.clientY - e.startY, r = Math.sqrt(s * s + i * i);
|
|
498
|
-
if (!e.isDragging && r > Le &&
|
|
498
|
+
if (!e.isDragging && r > Le && Pt(t, e), !e.isDragging) return;
|
|
499
499
|
const l = t.container.getBoundingClientRect();
|
|
500
|
-
|
|
501
|
-
const
|
|
500
|
+
At(e.ghost, n.clientX - l.x, n.clientY - l.y), n.clientX < l.x + 50 ? e.edgeMoveController.move(1, 0) : n.clientX > l.x + l.width - 50 ? e.edgeMoveController.move(-1, 0) : n.clientY < l.y + 50 ? e.edgeMoveController.move(0, 1) : n.clientY > l.y + l.height - 50 ? e.edgeMoveController.move(0, -1) : e.edgeMoveController.stop(), st(e.meet);
|
|
501
|
+
const a = 12 * t.scaleVal, c = dt.elementFromPoint(n.clientX, n.clientY - a);
|
|
502
502
|
if (bt(c, o)) {
|
|
503
503
|
e.meet = c;
|
|
504
504
|
const h = c.getBoundingClientRect(), f = h.y;
|
|
505
505
|
n.clientY > f + h.height ? e.insertType = "after" : e.insertType = "in";
|
|
506
506
|
} else {
|
|
507
|
-
const h = dt.elementFromPoint(n.clientX, n.clientY +
|
|
507
|
+
const h = dt.elementFromPoint(n.clientX, n.clientY + a);
|
|
508
508
|
if (bt(h, o)) {
|
|
509
509
|
e.meet = h;
|
|
510
510
|
const u = h.getBoundingClientRect().y;
|
|
@@ -538,13 +538,14 @@ function ke(t) {
|
|
|
538
538
|
t.spacePressed = !1;
|
|
539
539
|
let o = null;
|
|
540
540
|
const s = /* @__PURE__ */ new Map(), i = t.editable ? Te(t) : null;
|
|
541
|
-
let r = null, l = null,
|
|
541
|
+
let r = null, l = null, a = null, c = null;
|
|
542
542
|
const h = 500, f = 10, u = () => {
|
|
543
|
-
r !== null && (clearTimeout(r), r = null, l = null,
|
|
544
|
-
}, y = (
|
|
545
|
-
|
|
546
|
-
}, m = (
|
|
547
|
-
|
|
543
|
+
r !== null && (clearTimeout(r), r = null, l = null, a = null, c = null);
|
|
544
|
+
}, y = (d, v) => {
|
|
545
|
+
d.hasPointerCapture && d.hasPointerCapture(v) && d.releasePointerCapture(v);
|
|
546
|
+
}, m = (d, v) => {
|
|
547
|
+
if (d.id === "input-box" || d.closest("#input-box")) return !1;
|
|
548
|
+
const C = d.closest(".svg-label");
|
|
548
549
|
if (C) {
|
|
549
550
|
const N = C.dataset.svgId, U = C.dataset.type, q = document.getElementById(N);
|
|
550
551
|
if (q) {
|
|
@@ -554,19 +555,19 @@ function ke(t) {
|
|
|
554
555
|
return v ? t.editSummary(q) : t.selectSummary(q), !0;
|
|
555
556
|
}
|
|
556
557
|
}
|
|
557
|
-
if (
|
|
558
|
-
const N =
|
|
558
|
+
if (d.closest(".topiclinks")) {
|
|
559
|
+
const N = d.closest("g");
|
|
559
560
|
if (N)
|
|
560
561
|
return v ? t.editArrowLabel(N) : t.selectArrow(N), !0;
|
|
561
562
|
}
|
|
562
|
-
if (
|
|
563
|
-
const N =
|
|
563
|
+
if (d.closest(".summary")) {
|
|
564
|
+
const N = d.closest("g");
|
|
564
565
|
if (N)
|
|
565
566
|
return v ? t.editSummary(N) : t.selectSummary(N), !0;
|
|
566
567
|
}
|
|
567
568
|
return !1;
|
|
568
|
-
}, p = (
|
|
569
|
-
if (
|
|
569
|
+
}, p = (d) => {
|
|
570
|
+
if (d.button !== 0) return;
|
|
570
571
|
if (t.helper1?.moved) {
|
|
571
572
|
t.helper1.clear();
|
|
572
573
|
return;
|
|
@@ -581,51 +582,51 @@ function ke(t) {
|
|
|
581
582
|
}
|
|
582
583
|
if (i?.isDragging)
|
|
583
584
|
return;
|
|
584
|
-
const v =
|
|
585
|
+
const v = d.target;
|
|
585
586
|
if (v.tagName === "ME-EPD")
|
|
586
|
-
|
|
587
|
+
d.ctrlKey || d.metaKey ? t.expandNodeAll(v.previousSibling) : t.expandNode(v.previousSibling);
|
|
587
588
|
else if (v.tagName === "ME-TPC" && t.currentNodes.length > 1)
|
|
588
589
|
t.selectNode(v);
|
|
589
590
|
else if (!t.editable)
|
|
590
591
|
return;
|
|
591
592
|
m(v, !1);
|
|
592
|
-
}, g = (
|
|
593
|
+
}, g = (d) => {
|
|
593
594
|
if (!t.editable) return;
|
|
594
|
-
const v =
|
|
595
|
+
const v = d.target;
|
|
595
596
|
lt(v) && t.beginEdit(v), m(v, !0);
|
|
596
|
-
}, b = (
|
|
597
|
-
if (
|
|
597
|
+
}, b = (d) => {
|
|
598
|
+
if (d.pointerType === "mouse" || s.size > 1) return;
|
|
598
599
|
const v = (/* @__PURE__ */ new Date()).getTime(), C = v - n;
|
|
599
|
-
C < 300 && C > 0 && g(
|
|
600
|
-
}, w = (
|
|
601
|
-
|
|
602
|
-
}, x = (
|
|
603
|
-
|
|
604
|
-
}, S = (
|
|
605
|
-
if (
|
|
600
|
+
C < 300 && C > 0 && g(d), n = v;
|
|
601
|
+
}, w = (d) => {
|
|
602
|
+
d.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
|
|
603
|
+
}, x = (d) => {
|
|
604
|
+
d.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
|
|
605
|
+
}, S = (d) => {
|
|
606
|
+
if (d.pointerType === "touch" && (s.set(d.pointerId, { x: d.clientX, y: d.clientY }), s.size === 2)) {
|
|
606
607
|
const [N, U] = Array.from(s.values());
|
|
607
608
|
o = wt(N, U), u();
|
|
608
609
|
}
|
|
609
610
|
e.moved = !1;
|
|
610
|
-
const v =
|
|
611
|
-
if (i && (
|
|
612
|
-
if (
|
|
611
|
+
const v = d.target, C = t.mouseSelectionButton === 0 ? 2 : 0;
|
|
612
|
+
if (i && (d.button === 0 || d.pointerType === "touch")) {
|
|
613
|
+
if (d.pointerType === "touch" && s.size > 1)
|
|
613
614
|
(i.isDragging || i.pointerId !== null) && ct(t, i);
|
|
614
|
-
else if (
|
|
615
|
-
(lt(v) || v.closest("me-tpc")) && (l = { x:
|
|
616
|
-
xt(t, i,
|
|
615
|
+
else if (d.pointerType === "touch" && s.size === 1)
|
|
616
|
+
(lt(v) || v.closest("me-tpc")) && (l = { x: d.clientX, y: d.clientY }, a = v, c = d.pointerId, r = window.setTimeout(() => {
|
|
617
|
+
xt(t, i, d, !0) && (a && a.setPointerCapture(d.pointerId), At(i.ghost, d.clientX, d.clientY)), r = null, l = null, a = null, c = null;
|
|
617
618
|
}, h));
|
|
618
|
-
else if (
|
|
619
|
-
v.setPointerCapture(
|
|
619
|
+
else if (d.pointerType === "mouse" && xt(t, i, d, !1)) {
|
|
620
|
+
v.setPointerCapture(d.pointerId);
|
|
620
621
|
return;
|
|
621
622
|
}
|
|
622
623
|
}
|
|
623
|
-
const H = t.spacePressed &&
|
|
624
|
-
!H && !B || (e.x =
|
|
625
|
-
}, T = (
|
|
626
|
-
if (
|
|
627
|
-
if (s.set(
|
|
628
|
-
const v =
|
|
624
|
+
const H = t.spacePressed && d.button === 0 && d.pointerType === "mouse", B = !t.editable || d.button === C && d.pointerType === "mouse" || d.pointerType === "touch";
|
|
625
|
+
!H && !B || (e.x = d.clientX, e.y = d.clientY, v.className !== "circle" && v.contentEditable !== "plaintext-only" && (e.mousedown = !0, v.setPointerCapture(d.pointerId)));
|
|
626
|
+
}, T = (d) => {
|
|
627
|
+
if (d.pointerType === "touch" && s.has(d.pointerId)) {
|
|
628
|
+
if (s.set(d.pointerId, { x: d.clientX, y: d.clientY }), r !== null && l !== null && d.pointerId === c) {
|
|
629
|
+
const v = d.clientX - l.x, C = d.clientY - l.y;
|
|
629
630
|
Math.sqrt(v * v + C * C) > f && u();
|
|
630
631
|
}
|
|
631
632
|
if (s.size >= 2) {
|
|
@@ -645,32 +646,32 @@ function ke(t) {
|
|
|
645
646
|
return;
|
|
646
647
|
}
|
|
647
648
|
}
|
|
648
|
-
if (!(i && i.pointerId !== null && (De(t, i,
|
|
649
|
-
if (
|
|
650
|
-
const v =
|
|
649
|
+
if (!(i && i.pointerId !== null && (De(t, i, d), i.isDragging))) {
|
|
650
|
+
if (d.target.contentEditable !== "plaintext-only" || t.spacePressed && e.mousedown) {
|
|
651
|
+
const v = d.clientX - e.x, C = d.clientY - e.y;
|
|
651
652
|
e.onMove(v, C);
|
|
652
653
|
}
|
|
653
|
-
e.x =
|
|
654
|
+
e.x = d.clientX, e.y = d.clientY;
|
|
654
655
|
}
|
|
655
|
-
}, M = (
|
|
656
|
-
if (
|
|
656
|
+
}, M = (d) => {
|
|
657
|
+
if (d.pointerType === "touch" && (s.delete(d.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) {
|
|
657
658
|
const v = i.isDragging;
|
|
658
|
-
if (Me(t, i,
|
|
659
|
+
if (Me(t, i, d), y(d.target, d.pointerId), v)
|
|
659
660
|
return;
|
|
660
661
|
}
|
|
661
|
-
e.mousedown && (y(
|
|
662
|
+
e.mousedown && (y(d.target, d.pointerId), e.clear());
|
|
662
663
|
}, E = () => {
|
|
663
664
|
u(), e.mousedown && e.clear(), i && (i.isDragging || i.pointerId !== null) && ct(t, i);
|
|
664
|
-
}, L = (
|
|
665
|
-
|
|
666
|
-
}, k = (
|
|
667
|
-
if (
|
|
668
|
-
const v =
|
|
665
|
+
}, L = (d) => {
|
|
666
|
+
d.pointerType === "touch" && (s.delete(d.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === d.pointerId && ct(t, i), M(d);
|
|
667
|
+
}, k = (d) => {
|
|
668
|
+
if (d.preventDefault(), d.button !== 2 || !t.editable) return;
|
|
669
|
+
const v = d.target;
|
|
669
670
|
lt(v) && !v.classList.contains("selected") && t.selectNode(v), setTimeout(() => {
|
|
670
|
-
t.dragMoveHelper.moved || t.bus.fire("showContextMenu",
|
|
671
|
+
t.dragMoveHelper.moved || t.bus.fire("showContextMenu", d);
|
|
671
672
|
}, 200);
|
|
672
|
-
}, R = (
|
|
673
|
-
|
|
673
|
+
}, R = (d) => {
|
|
674
|
+
d.stopPropagation(), d.preventDefault(), d.ctrlKey || d.metaKey ? d.deltaY < 0 ? K(t, "in", t.dragMoveHelper) : t.scaleVal - t.scaleSensitivity > 0 && K(t, "out", t.dragMoveHelper) : d.shiftKey ? t.move(-d.deltaY, 0) : t.move(-d.deltaX, -d.deltaY);
|
|
674
675
|
}, { container: D } = t;
|
|
675
676
|
return Dt([
|
|
676
677
|
{ dom: D, evt: "pointerdown", func: S },
|
|
@@ -716,10 +717,10 @@ const z = document, O = "http://www.w3.org/2000/svg", it = function(t) {
|
|
|
716
717
|
let l = s;
|
|
717
718
|
r === "middle" ? l = s - e / 2 : r === "end" && (l = s - e), t.style.left = `${l}px`, t.style.top = `${i - n / 2}px`, t.style.visibility = "visible";
|
|
718
719
|
}, ht = function(t, e, n, o) {
|
|
719
|
-
const { anchor: s = "middle", color: i, dataType: r, svgId: l } = o,
|
|
720
|
-
|
|
720
|
+
const { anchor: s = "middle", color: i, dataType: r, svgId: l } = o, a = document.createElement("div");
|
|
721
|
+
a.className = "svg-label", a.style.color = i || "#666";
|
|
721
722
|
const c = "label-" + l;
|
|
722
|
-
return
|
|
723
|
+
return a.id = c, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = l, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor = s, a;
|
|
723
724
|
}, Ht = function(t, e, n) {
|
|
724
725
|
const o = z.createElementNS(O, "path");
|
|
725
726
|
return $(o, {
|
|
@@ -750,8 +751,8 @@ const z = document, O = "http://www.w3.org/2000/svg", it = function(t) {
|
|
|
750
751
|
d: n
|
|
751
752
|
}
|
|
752
753
|
].forEach((r, l) => {
|
|
753
|
-
const
|
|
754
|
-
d,
|
|
754
|
+
const a = r.d, c = z.createElementNS(O, "path"), h = {
|
|
755
|
+
d: a,
|
|
755
756
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
756
757
|
fill: "none",
|
|
757
758
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
@@ -760,7 +761,7 @@ const z = document, O = "http://www.w3.org/2000/svg", it = function(t) {
|
|
|
760
761
|
o?.opacity !== void 0 && (h.opacity = String(o.opacity)), $(c, h), l === 0 && c.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
761
762
|
const f = z.createElementNS(O, "path");
|
|
762
763
|
$(f, {
|
|
763
|
-
d,
|
|
764
|
+
d: a,
|
|
764
765
|
stroke: "transparent",
|
|
765
766
|
fill: "none",
|
|
766
767
|
"stroke-width": "15"
|
|
@@ -791,23 +792,23 @@ const z = document, O = "http://www.w3.org/2000/svg", it = function(t) {
|
|
|
791
792
|
obj: n
|
|
792
793
|
}));
|
|
793
794
|
});
|
|
794
|
-
},
|
|
795
|
+
}, Ae = function(t) {
|
|
795
796
|
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, i = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
796
797
|
this.lines.innerHTML = "";
|
|
797
798
|
for (let l = 0; l < r.length; l++) {
|
|
798
|
-
const
|
|
799
|
-
if (c.style.borderColor = b, this.lines.appendChild(Ht(p, b, "3")), t && t !==
|
|
799
|
+
const a = r[l], c = a.querySelector("me-tpc"), { offsetLeft: h, offsetTop: f } = I(this.nodes, c), u = c.offsetWidth, y = c.offsetHeight, m = a.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: f, cL: h, cW: u, cH: y, direction: m, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, b = c.nodeObj.branchColor || g[l % g.length];
|
|
800
|
+
if (c.style.borderColor = b, this.lines.appendChild(Ht(p, b, "3")), t && t !== a)
|
|
800
801
|
continue;
|
|
801
|
-
const w = j("subLines"), x =
|
|
802
|
-
x.tagName === "svg" && x.remove(),
|
|
802
|
+
const w = j("subLines"), x = a.lastChild;
|
|
803
|
+
x.tagName === "svg" && x.remove(), a.appendChild(w), Ot(this, w, b, a, m, !0);
|
|
803
804
|
}
|
|
804
805
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
805
806
|
}, Ot = function(t, e, n, o, s, i) {
|
|
806
807
|
const r = o.firstChild, l = o.children[1].children;
|
|
807
808
|
if (l.length === 0) return;
|
|
808
|
-
const
|
|
809
|
+
const a = r.offsetTop, c = r.offsetLeft, h = r.offsetWidth, f = r.offsetHeight;
|
|
809
810
|
for (let u = 0; u < l.length; u++) {
|
|
810
|
-
const y = l[u], m = y.firstChild, p = m.offsetTop, g = m.offsetLeft, b = m.offsetWidth, w = m.offsetHeight, x = m.firstChild.nodeObj.branchColor || n, S = t.generateSubBranch({ pT:
|
|
811
|
+
const y = l[u], m = y.firstChild, p = m.offsetTop, g = m.offsetLeft, b = m.offsetWidth, w = m.offsetHeight, x = m.firstChild.nodeObj.branchColor || n, S = t.generateSubBranch({ pT: a, pL: c, pW: h, pH: f, cT: p, cL: g, cW: b, cH: w, direction: s, isFirst: i });
|
|
811
812
|
e.appendChild(Ht(S, x, "2"));
|
|
812
813
|
const T = m.children[1];
|
|
813
814
|
if (T) {
|
|
@@ -816,8 +817,8 @@ const z = document, O = "http://www.w3.org/2000/svg", it = function(t) {
|
|
|
816
817
|
continue;
|
|
817
818
|
Ot(t, e, x, y, s);
|
|
818
819
|
}
|
|
819
|
-
},
|
|
820
|
-
side:
|
|
820
|
+
}, Pe = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>', He = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>', Ie = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>', Oe = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>', Ye = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>', Be = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>', Re = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>', We = {
|
|
821
|
+
side: Pe,
|
|
821
822
|
left: He,
|
|
822
823
|
right: Ie,
|
|
823
824
|
full: Oe,
|
|
@@ -840,13 +841,13 @@ function Xe(t) {
|
|
|
840
841
|
mapCenterX: y,
|
|
841
842
|
mapCenterY: m
|
|
842
843
|
};
|
|
843
|
-
},
|
|
844
|
+
}, a = () => {
|
|
844
845
|
if (r) {
|
|
845
846
|
const c = t.container.getBoundingClientRect(), h = c.width / 2, f = c.height / 2, u = h - r.mapCenterX * t.scaleVal, y = f - r.mapCenterY * t.scaleVal, m = u - r.currentTransform.x, p = y - r.currentTransform.y;
|
|
846
847
|
t.move(m, p);
|
|
847
848
|
}
|
|
848
849
|
};
|
|
849
|
-
return t.el.addEventListener("fullscreenchange",
|
|
850
|
+
return t.el.addEventListener("fullscreenchange", a), n.onclick = () => {
|
|
850
851
|
l(), document.fullscreenElement !== t.el ? t.el.requestFullscreen() : document.exitFullscreen();
|
|
851
852
|
}, o.onclick = () => {
|
|
852
853
|
t.toCenter();
|
|
@@ -935,17 +936,17 @@ function J(t, e, n, o, s) {
|
|
|
935
936
|
y2: s + ""
|
|
936
937
|
});
|
|
937
938
|
}
|
|
938
|
-
function St(t, e, n, o, s, i, r, l,
|
|
939
|
-
const h = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${l} ${
|
|
939
|
+
function St(t, e, n, o, s, i, r, l, a, c) {
|
|
940
|
+
const h = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${l} ${a}`;
|
|
940
941
|
if (t.line.setAttribute("d", h), c.style) {
|
|
941
942
|
const p = c.style;
|
|
942
943
|
p.stroke && t.line.setAttribute("stroke", p.stroke), p.strokeWidth && t.line.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeDasharray && t.line.setAttribute("stroke-dasharray", p.strokeDasharray), p.strokeLinecap && t.line.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && t.line.setAttribute("opacity", String(p.opacity));
|
|
943
944
|
}
|
|
944
945
|
const f = t.querySelectorAll('path[stroke="transparent"]');
|
|
945
946
|
f.length > 0 && f[0].setAttribute("d", h);
|
|
946
|
-
const u = et(i, r, l,
|
|
947
|
+
const u = et(i, r, l, a);
|
|
947
948
|
if (u) {
|
|
948
|
-
const p = `M ${u.x1} ${u.y1} L ${l} ${
|
|
949
|
+
const p = `M ${u.x1} ${u.y1} L ${l} ${a} L ${u.x2} ${u.y2}`;
|
|
949
950
|
if (t.arrow1.setAttribute("d", p), f.length > 1 && f[1].setAttribute("d", p), c.style) {
|
|
950
951
|
const g = c.style;
|
|
951
952
|
g.stroke && t.arrow1.setAttribute("stroke", g.stroke), g.strokeWidth && t.arrow1.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && t.arrow1.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && t.arrow1.setAttribute("opacity", String(g.opacity));
|
|
@@ -961,7 +962,7 @@ function St(t, e, n, o, s, i, r, l, d, c) {
|
|
|
961
962
|
}
|
|
962
963
|
}
|
|
963
964
|
}
|
|
964
|
-
const { x: y, y: m } = Yt(e, n, o, s, i, r, l,
|
|
965
|
+
const { x: y, y: m } = Yt(e, n, o, s, i, r, l, a);
|
|
965
966
|
if (t.labelEl && je(t.labelEl, y, m), c.style?.labelColor) {
|
|
966
967
|
const p = t.labelEl;
|
|
967
968
|
p && (p.style.color = c.style.labelColor);
|
|
@@ -969,12 +970,12 @@ function St(t, e, n, o, s, i, r, l, d, c) {
|
|
|
969
970
|
nn(t);
|
|
970
971
|
}
|
|
971
972
|
function ot(t, e, n) {
|
|
972
|
-
const { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, l = o + i / 2,
|
|
973
|
+
const { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, l = o + i / 2, a = s + r / 2, c = l + n.x, h = a + n.y;
|
|
973
974
|
return {
|
|
974
975
|
w: i,
|
|
975
976
|
h: r,
|
|
976
977
|
cx: l,
|
|
977
|
-
cy:
|
|
978
|
+
cy: a,
|
|
978
979
|
ctrlX: c,
|
|
979
980
|
ctrlY: h
|
|
980
981
|
};
|
|
@@ -988,7 +989,7 @@ function V(t) {
|
|
|
988
989
|
};
|
|
989
990
|
}
|
|
990
991
|
const _e = function(t, e, n) {
|
|
991
|
-
const o = I(t.nodes, e), s = I(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, l = s.offsetLeft + n.offsetWidth / 2,
|
|
992
|
+
const o = I(t.nodes, e), s = I(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, l = s.offsetLeft + n.offsetWidth / 2, a = s.offsetTop + n.offsetHeight / 2, c = l - i, h = a - r, f = Math.sqrt(c * c + h * h), u = Math.max(50, Math.min(200, f * 0.3)), y = Math.abs(c), m = Math.abs(h);
|
|
992
993
|
let p, g;
|
|
993
994
|
if (f < 150) {
|
|
994
995
|
const w = e.closest("me-main").className === "lhs" ? -1 : 1;
|
|
@@ -1011,16 +1012,16 @@ const _e = function(t, e, n) {
|
|
|
1011
1012
|
const k = _e(t, e, n);
|
|
1012
1013
|
o.delta1 = k.delta1, o.delta2 = k.delta2;
|
|
1013
1014
|
}
|
|
1014
|
-
const i = ot(t, e, o.delta1), r = ot(t, n, o.delta2), { x: l, y:
|
|
1015
|
+
const i = ot(t, e, o.delta1), r = ot(t, n, o.delta2), { x: l, y: a } = V(i), { ctrlX: c, ctrlY: h } = i, { ctrlX: f, ctrlY: u } = r, { x: y, y: m } = V(r), p = et(f, u, y, m);
|
|
1015
1016
|
if (!p) return;
|
|
1016
1017
|
const g = `M ${p.x1} ${p.y1} L ${y} ${m} L ${p.x2} ${p.y2}`;
|
|
1017
1018
|
let b = "";
|
|
1018
1019
|
if (o.bidirectional) {
|
|
1019
|
-
const k = et(c, h, l,
|
|
1020
|
+
const k = et(c, h, l, a);
|
|
1020
1021
|
if (!k) return;
|
|
1021
|
-
b = `M ${k.x1} ${k.y1} L ${l} ${
|
|
1022
|
+
b = `M ${k.x1} ${k.y1} L ${l} ${a} L ${k.x2} ${k.y2}`;
|
|
1022
1023
|
}
|
|
1023
|
-
const w = Ne(`M ${l} ${
|
|
1024
|
+
const w = Ne(`M ${l} ${a} C ${c} ${h} ${f} ${u} ${y} ${m}`, g, b, o.style), { x, y: S } = Yt(l, a, c, h, f, u, y, m), T = o.style?.labelColor || "rgb(235, 95, 82)", M = "arrow-" + o.id;
|
|
1024
1025
|
w.id = M;
|
|
1025
1026
|
const E = t.markdown ? t.markdown(o.label, o) : o.label, L = ht(E, x, S, {
|
|
1026
1027
|
anchor: "middle",
|
|
@@ -1097,18 +1098,18 @@ const _e = function(t, e, n) {
|
|
|
1097
1098
|
}, rt = function(t) {
|
|
1098
1099
|
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && en(t.currentArrow);
|
|
1099
1100
|
}, Bt = function(t, e, n, o) {
|
|
1100
|
-
const { linkController: s, P2: i, P3: r, line1: l, line2:
|
|
1101
|
+
const { linkController: s, P2: i, P3: r, line1: l, line2: a, nodes: c, map: h, currentArrow: f, bus: u } = t;
|
|
1101
1102
|
if (!f) return;
|
|
1102
1103
|
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", c.appendChild(s), c.appendChild(i), c.appendChild(r), tn(f, qe);
|
|
1103
1104
|
let { x: y, y: m } = V(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: b, ctrlY: w } = o, { x, y: S } = V(o);
|
|
1104
|
-
i.style.cssText = `top:${g}px;left:${p}px;`, r.style.cssText = `top:${w}px;left:${b}px;`, J(l, y, m, p, g), J(
|
|
1105
|
+
i.style.cssText = `top:${g}px;left:${p}px;`, r.style.cssText = `top:${w}px;left:${b}px;`, J(l, y, m, p, g), J(a, b, w, x, S), t.helper1 = Et.create(i), t.helper2 = Et.create(r), t.helper1.init(h, (T, M) => {
|
|
1105
1106
|
p = p + T / t.scaleVal, g = g + M / t.scaleVal;
|
|
1106
1107
|
const E = V({ ...n, ctrlX: p, ctrlY: g });
|
|
1107
1108
|
y = E.x, m = E.y, i.style.top = g + "px", i.style.left = p + "px", St(f, y, m, p, g, b, w, x, S, e), J(l, y, m, p, g), e.delta1.x = p - n.cx, e.delta1.y = g - n.cy, u.fire("updateArrowDelta", e);
|
|
1108
1109
|
}), t.helper2.init(h, (T, M) => {
|
|
1109
1110
|
b = b + T / t.scaleVal, w = w + M / t.scaleVal;
|
|
1110
1111
|
const E = V({ ...o, ctrlX: b, ctrlY: w });
|
|
1111
|
-
x = E.x, S = E.y, r.style.top = w + "px", r.style.left = b + "px", St(f, y, m, p, g, b, w, x, S, e), J(
|
|
1112
|
+
x = E.x, S = E.y, r.style.top = w + "px", r.style.left = b + "px", St(f, y, m, p, g, b, w, x, S, e), J(a, b, w, x, S), e.delta2.x = b - o.cx, e.delta2.y = w - o.cy, u.fire("updateArrowDelta", e);
|
|
1112
1113
|
});
|
|
1113
1114
|
};
|
|
1114
1115
|
function on() {
|
|
@@ -1141,9 +1142,9 @@ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1141
1142
|
}, Symbol.toStringTag, { value: "Module" })), cn = function(t) {
|
|
1142
1143
|
if (t.length === 0) throw new Error("No selected node.");
|
|
1143
1144
|
if (t.length === 1) {
|
|
1144
|
-
const
|
|
1145
|
+
const a = t[0].nodeObj, c = t[0].nodeObj.parent;
|
|
1145
1146
|
if (!c) throw new Error("Can not select root node.");
|
|
1146
|
-
const h = c.children.findIndex((f) =>
|
|
1147
|
+
const h = c.children.findIndex((f) => a === f);
|
|
1147
1148
|
return {
|
|
1148
1149
|
parent: c.id,
|
|
1149
1150
|
start: h,
|
|
@@ -1151,8 +1152,8 @@ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1151
1152
|
};
|
|
1152
1153
|
}
|
|
1153
1154
|
let e = 0;
|
|
1154
|
-
const n = t.map((
|
|
1155
|
-
let c =
|
|
1155
|
+
const n = t.map((a) => {
|
|
1156
|
+
let c = a.nodeObj;
|
|
1156
1157
|
const h = [];
|
|
1157
1158
|
for (; c.parent; ) {
|
|
1158
1159
|
const f = c.parent, y = f.children?.indexOf(c);
|
|
@@ -1162,13 +1163,13 @@ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1162
1163
|
});
|
|
1163
1164
|
let o = 0;
|
|
1164
1165
|
t: for (; o < e; o++) {
|
|
1165
|
-
const
|
|
1166
|
+
const a = n[0][o]?.node;
|
|
1166
1167
|
for (let c = 1; c < n.length; c++)
|
|
1167
|
-
if (n[c][o]?.node !==
|
|
1168
|
+
if (n[c][o]?.node !== a)
|
|
1168
1169
|
break t;
|
|
1169
1170
|
}
|
|
1170
1171
|
if (!o) throw new Error("Can not select root node.");
|
|
1171
|
-
const s = n.map((
|
|
1172
|
+
const s = n.map((a) => a[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, l = n[0][o - 1].node;
|
|
1172
1173
|
if (!l.parent) throw new Error("Please select nodes in the same main topic.");
|
|
1173
1174
|
return {
|
|
1174
1175
|
parent: l.id,
|
|
@@ -1192,14 +1193,14 @@ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1192
1193
|
let i;
|
|
1193
1194
|
return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
|
|
1194
1195
|
}, vt = function(t, e) {
|
|
1195
|
-
const { id: n, label: o, parent: s, start: i, end: r, style: l } = e, { nodes:
|
|
1196
|
+
const { id: n, label: o, parent: s, start: i, end: r, style: l } = e, { nodes: a, theme: c, summarySvg: h } = t, u = t.findEle(s).nodeObj, y = hn(t, e);
|
|
1196
1197
|
let m = 1 / 0, p = 0, g = 0, b = 0;
|
|
1197
|
-
for (let
|
|
1198
|
-
const v = u.children?.[
|
|
1198
|
+
for (let d = i; d <= r; d++) {
|
|
1199
|
+
const v = u.children?.[d];
|
|
1199
1200
|
if (!v)
|
|
1200
1201
|
return t.removeSummary(n), null;
|
|
1201
|
-
const C = dn(t.findEle(v.id)), { offsetLeft: H, offsetTop: B } = I(
|
|
1202
|
-
|
|
1202
|
+
const C = dn(t.findEle(v.id)), { offsetLeft: H, offsetTop: B } = I(a, C), N = i === r ? 10 : 20;
|
|
1203
|
+
d === i && (g = B + N), d === r && (b = B + C.offsetHeight - N), H < m && (m = H), C.offsetWidth + H > p && (p = C.offsetWidth + H);
|
|
1203
1204
|
}
|
|
1204
1205
|
let w, x;
|
|
1205
1206
|
const S = u.parent ? 10 : 0, T = g + S, M = b + S, E = (T + M) / 2, L = l?.stroke || c.cssVar["--color"], k = l?.labelColor || c.cssVar["--color"], R = "s-" + n, D = t.markdown ? t.markdown(o, e) : o;
|
|
@@ -1208,8 +1209,8 @@ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1208
1209
|
return X.appendChild(w), t.labelContainer.appendChild(x), it(x), X.summaryObj = e, X.labelEl = x, h.appendChild(X), X;
|
|
1209
1210
|
}, fn = function(t = {}) {
|
|
1210
1211
|
if (!this.currentNodes) return;
|
|
1211
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = cn(e), l = { id: _(), parent: s, start: i, end: r, label: "summary", style: t.style },
|
|
1212
|
-
n.push(l), this.editSummary(
|
|
1212
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = cn(e), l = { id: _(), parent: s, start: i, end: r, label: "summary", style: t.style }, a = vt(this, l);
|
|
1213
|
+
n.push(l), this.editSummary(a), o.fire("operation", {
|
|
1213
1214
|
name: "createSummary",
|
|
1214
1215
|
obj: l
|
|
1215
1216
|
});
|
|
@@ -1248,12 +1249,12 @@ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1248
1249
|
renderSummary: yn,
|
|
1249
1250
|
selectSummary: gn,
|
|
1250
1251
|
unselectSummary: mn
|
|
1251
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1252
|
+
}, Symbol.toStringTag, { value: "Module" })), P = "http://www.w3.org/2000/svg";
|
|
1252
1253
|
function bn(t, e) {
|
|
1253
|
-
const n = document.createElementNS(
|
|
1254
|
+
const n = document.createElementNS(P, "svg");
|
|
1254
1255
|
return $(n, {
|
|
1255
1256
|
version: "1.1",
|
|
1256
|
-
xmlns:
|
|
1257
|
+
xmlns: P,
|
|
1257
1258
|
height: t,
|
|
1258
1259
|
width: e
|
|
1259
1260
|
}), n;
|
|
@@ -1262,14 +1263,14 @@ function xn(t, e) {
|
|
|
1262
1263
|
return (parseInt(t) - parseInt(e)) / 2;
|
|
1263
1264
|
}
|
|
1264
1265
|
function Cn(t, e, n, o) {
|
|
1265
|
-
const s = document.createElementNS(
|
|
1266
|
+
const s = document.createElementNS(P, "g");
|
|
1266
1267
|
let i = "";
|
|
1267
1268
|
return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
|
|
1268
|
-
`).forEach((l,
|
|
1269
|
-
const c = document.createElementNS(
|
|
1269
|
+
`).forEach((l, a) => {
|
|
1270
|
+
const c = document.createElementNS(P, "text");
|
|
1270
1271
|
$(c, {
|
|
1271
1272
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1272
|
-
y: o + parseInt(e.paddingTop) + xn(e.lineHeight, e.fontSize) * (
|
|
1273
|
+
y: o + parseInt(e.paddingTop) + xn(e.lineHeight, e.fontSize) * (a + 1) + parseFloat(e.fontSize) * (a + 1) + "",
|
|
1273
1274
|
"text-anchor": "start",
|
|
1274
1275
|
"font-family": e.fontFamily,
|
|
1275
1276
|
"font-size": `${e.fontSize}`,
|
|
@@ -1281,7 +1282,7 @@ function Cn(t, e, n, o) {
|
|
|
1281
1282
|
function En(t, e, n, o) {
|
|
1282
1283
|
let s = "";
|
|
1283
1284
|
t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
|
|
1284
|
-
const i = document.createElementNS(
|
|
1285
|
+
const i = document.createElementNS(P, "foreignObject");
|
|
1285
1286
|
$(i, {
|
|
1286
1287
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1287
1288
|
y: o + parseInt(e.paddingTop) + "",
|
|
@@ -1295,7 +1296,7 @@ function En(t, e, n, o) {
|
|
|
1295
1296
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1296
1297
|
}
|
|
1297
1298
|
function Sn(t, e) {
|
|
1298
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = document.createElementNS(
|
|
1299
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = document.createElementNS(P, "rect");
|
|
1299
1300
|
return $(i, {
|
|
1300
1301
|
x: o + "",
|
|
1301
1302
|
y: s + "",
|
|
@@ -1309,7 +1310,7 @@ function Sn(t, e) {
|
|
|
1309
1310
|
}), i;
|
|
1310
1311
|
}
|
|
1311
1312
|
function Q(t, e, n = !1) {
|
|
1312
|
-
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = I(t.nodes, e), r = document.createElementNS(
|
|
1313
|
+
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = I(t.nodes, e), r = document.createElementNS(P, "rect");
|
|
1313
1314
|
$(r, {
|
|
1314
1315
|
x: s + "",
|
|
1315
1316
|
y: i + "",
|
|
@@ -1321,13 +1322,13 @@ function Q(t, e, n = !1) {
|
|
|
1321
1322
|
stroke: o.borderColor,
|
|
1322
1323
|
"stroke-width": o.borderWidth
|
|
1323
1324
|
});
|
|
1324
|
-
const l = document.createElementNS(
|
|
1325
|
+
const l = document.createElementNS(P, "g");
|
|
1325
1326
|
l.appendChild(r);
|
|
1326
|
-
let
|
|
1327
|
-
return n ?
|
|
1327
|
+
let a;
|
|
1328
|
+
return n ? a = En(e, o, s, i) : a = Cn(e, o, s, i), l.appendChild(a), l;
|
|
1328
1329
|
}
|
|
1329
1330
|
function Tn(t, e) {
|
|
1330
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = document.createElementNS(
|
|
1331
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = document.createElementNS(P, "a"), r = document.createElementNS(P, "text");
|
|
1331
1332
|
return $(r, {
|
|
1332
1333
|
x: o + "",
|
|
1333
1334
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -1339,7 +1340,7 @@ function Tn(t, e) {
|
|
|
1339
1340
|
}), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
|
|
1340
1341
|
}
|
|
1341
1342
|
function Ln(t, e) {
|
|
1342
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = document.createElementNS(
|
|
1343
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = document.createElementNS(P, "image");
|
|
1343
1344
|
return $(i, {
|
|
1344
1345
|
x: o + "",
|
|
1345
1346
|
y: s + "",
|
|
@@ -1349,7 +1350,7 @@ function Ln(t, e) {
|
|
|
1349
1350
|
}), i;
|
|
1350
1351
|
}
|
|
1351
1352
|
const Z = 100, Dn = '<?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">', Mn = (t, e = !1) => {
|
|
1352
|
-
const n = t.nodes, o = n.offsetHeight + Z * 2, s = n.offsetWidth + Z * 2, i = bn(o + "px", s + "px"), r = document.createElementNS(
|
|
1353
|
+
const n = t.nodes, o = n.offsetHeight + Z * 2, s = n.offsetWidth + Z * 2, i = bn(o + "px", s + "px"), r = document.createElementNS(P, "svg"), l = document.createElementNS(P, "rect");
|
|
1353
1354
|
$(l, {
|
|
1354
1355
|
x: "0",
|
|
1355
1356
|
y: "0",
|
|
@@ -1360,8 +1361,8 @@ const Z = 100, Dn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1360
1361
|
const u = f.cloneNode(!0), { offsetLeft: y, offsetTop: m } = I(n, f.parentElement);
|
|
1361
1362
|
u.setAttribute("x", `${y}`), u.setAttribute("y", `${m}`), r.appendChild(u);
|
|
1362
1363
|
});
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1364
|
+
const a = n.querySelector(".lines")?.cloneNode(!0);
|
|
1365
|
+
a && r.appendChild(a);
|
|
1365
1366
|
const c = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
1366
1367
|
c && r.appendChild(c);
|
|
1367
1368
|
const h = n.querySelector(".summary")?.cloneNode(!0);
|
|
@@ -1394,7 +1395,7 @@ function $n(t) {
|
|
|
1394
1395
|
const Nn = function(t = !1, e) {
|
|
1395
1396
|
const n = Mn(this, t), o = kn(n, e);
|
|
1396
1397
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1397
|
-
},
|
|
1398
|
+
}, An = async function(t = !1, e) {
|
|
1398
1399
|
const n = this.exportSvg(t, e), o = await $n(n);
|
|
1399
1400
|
return new Promise((s, i) => {
|
|
1400
1401
|
const r = new Image();
|
|
@@ -1403,15 +1404,15 @@ const Nn = function(t = !1, e) {
|
|
|
1403
1404
|
l.width = r.width, l.height = r.height, l.getContext("2d").drawImage(r, 0, 0), l.toBlob(s, "image/png", 1);
|
|
1404
1405
|
}, r.src = o, r.onerror = i;
|
|
1405
1406
|
});
|
|
1406
|
-
},
|
|
1407
|
+
}, Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1407
1408
|
__proto__: null,
|
|
1408
|
-
exportPng:
|
|
1409
|
+
exportPng: An,
|
|
1409
1410
|
exportSvg: Nn
|
|
1410
1411
|
}, Symbol.toStringTag, { value: "Module" })), Hn = {}, In = {
|
|
1411
1412
|
getObjById: tt,
|
|
1412
1413
|
generateNewObj: Wt,
|
|
1413
1414
|
layout: Xt,
|
|
1414
|
-
linkDiv:
|
|
1415
|
+
linkDiv: Ae,
|
|
1415
1416
|
editTopic: _t,
|
|
1416
1417
|
createWrapper: zt,
|
|
1417
1418
|
createParent: Ft,
|
|
@@ -1423,7 +1424,7 @@ const Nn = function(t = !1, e) {
|
|
|
1423
1424
|
...Hn,
|
|
1424
1425
|
...ln,
|
|
1425
1426
|
...wn,
|
|
1426
|
-
...
|
|
1427
|
+
...Pn,
|
|
1427
1428
|
init(t) {
|
|
1428
1429
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
|
|
1429
1430
|
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, pt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Ve(this), this.layout(), this.linkDiv(), this.toCenter();
|
|
@@ -1432,24 +1433,24 @@ const Nn = function(t = !1, e) {
|
|
|
1432
1433
|
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.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
|
|
1433
1434
|
}
|
|
1434
1435
|
};
|
|
1435
|
-
function On({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction:
|
|
1436
|
+
function On({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction: a, containerHeight: c }) {
|
|
1436
1437
|
let h = e + n / 2;
|
|
1437
1438
|
const f = t + o / 2;
|
|
1438
1439
|
let u;
|
|
1439
|
-
|
|
1440
|
+
a === F.LHS ? u = i + r : u = i;
|
|
1440
1441
|
const y = s + l / 2, p = (1 - Math.abs(y - f) / c) * 0.25 * (n / 2);
|
|
1441
|
-
return
|
|
1442
|
+
return a === F.LHS ? h = h - n / 10 - p : h = h + n / 10 + p, `M ${h} ${f} Q ${h} ${y} ${u} ${y}`;
|
|
1442
1443
|
}
|
|
1443
|
-
function Yn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction:
|
|
1444
|
+
function Yn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction: a, isFirst: c }) {
|
|
1444
1445
|
const h = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
1445
1446
|
let f = 0, u = 0;
|
|
1446
1447
|
c ? f = t + o / 2 : f = t + o;
|
|
1447
1448
|
const y = s + l;
|
|
1448
1449
|
let m = 0, p = 0, g = 0;
|
|
1449
1450
|
const b = Math.abs(f - y) / 300 * h;
|
|
1450
|
-
return
|
|
1451
|
+
return a === F.LHS ? (g = e, m = g + h, p = g - h, u = i + h, `M ${m} ${f} C ${g} ${f} ${g + b} ${y} ${p} ${y} H ${u}`) : (g = e + n, m = g - h, p = g + h, u = i + r - h, `M ${m} ${f} C ${g} ${f} ${g - b} ${y} ${p} ${y} H ${u}`);
|
|
1451
1452
|
}
|
|
1452
|
-
const Bn = "5.
|
|
1453
|
+
const Bn = "5.9.0";
|
|
1453
1454
|
function Rn(t) {
|
|
1454
1455
|
return {
|
|
1455
1456
|
x: 0,
|
|
@@ -1475,7 +1476,7 @@ function Y({
|
|
|
1475
1476
|
toolBar: i,
|
|
1476
1477
|
keypress: r,
|
|
1477
1478
|
mouseSelectionButton: l,
|
|
1478
|
-
selectionContainer:
|
|
1479
|
+
selectionContainer: a,
|
|
1479
1480
|
before: c,
|
|
1480
1481
|
newTopicName: h,
|
|
1481
1482
|
allowUndo: f,
|
|
@@ -1495,7 +1496,7 @@ function Y({
|
|
|
1495
1496
|
let L = null;
|
|
1496
1497
|
const k = Object.prototype.toString.call(t);
|
|
1497
1498
|
if (k === "[object HTMLDivElement]" ? L = t : k === "[object String]" && (L = document.querySelector(t)), !L) throw new Error("MindElixir: el is not a valid element");
|
|
1498
|
-
L.style.position = "relative", L.innerHTML = "", this.el = L, this.disposable = [], this.before = c || {}, this.locale = n || "en", this.newTopicName = h || "New Node", this.contextMenu = s ?? !0, this.toolBar = i ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = e ?? 1, this.editable = o ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = w ?? 1.4, this.scaleMin = x ?? 0.2, this.generateMainBranch = u || On, this.generateSubBranch = y || Yn, this.overflowHidden = m ?? !1, this.alignment = g ?? "root", this.handleWheel = S ?? !0, this.markdown = T || void 0, this.imageProxy = M || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Rn(this), this.bus = $e(), this.container = G.createElement("div"), this.selectionContainer =
|
|
1499
|
+
L.style.position = "relative", L.innerHTML = "", this.el = L, this.disposable = [], this.before = c || {}, this.locale = n || "en", this.newTopicName = h || "New Node", this.contextMenu = s ?? !0, this.toolBar = i ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = e ?? 1, this.editable = o ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = w ?? 1.4, this.scaleMin = x ?? 0.2, this.generateMainBranch = u || On, this.generateSubBranch = y || Yn, this.overflowHidden = m ?? !1, this.alignment = g ?? "root", this.handleWheel = S ?? !0, this.markdown = T || void 0, this.imageProxy = M || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Rn(this), this.bus = $e(), this.container = G.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
|
|
1499
1500
|
const R = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1500
1501
|
this.theme = p || (R.matches ? ut : ft);
|
|
1501
1502
|
const D = G.createElement("div");
|