mind-elixir 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +208 -193
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +366 -351
- package/package.json +2 -2
package/dist/MindElixirLite.js
CHANGED
|
@@ -75,28 +75,28 @@ const tt = function(t, e) {
|
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
function et(t, e, n, o) {
|
|
78
|
-
const
|
|
79
|
-
let r = Math.atan(Math.abs(
|
|
78
|
+
const i = o - e, s = t - n;
|
|
79
|
+
let r = Math.atan(Math.abs(i) / Math.abs(s)) / 3.14 * 180;
|
|
80
80
|
if (isNaN(r)) return;
|
|
81
|
-
|
|
82
|
-
const l = 12, a = 30, d = r + a,
|
|
81
|
+
s < 0 && i > 0 && (r = 180 - r), s < 0 && i < 0 && (r = 180 + r), s > 0 && i < 0 && (r = 360 - r);
|
|
82
|
+
const l = 12, a = 30, d = r + a, f = r - a;
|
|
83
83
|
return {
|
|
84
84
|
x1: n + Math.cos(Math.PI * d / 180) * l,
|
|
85
85
|
y1: o - Math.sin(Math.PI * d / 180) * l,
|
|
86
|
-
x2: n + Math.cos(Math.PI *
|
|
87
|
-
y2: o - Math.sin(Math.PI *
|
|
86
|
+
x2: n + Math.cos(Math.PI * f / 180) * l,
|
|
87
|
+
y2: o - Math.sin(Math.PI * f / 180) * l
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
function _() {
|
|
91
91
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
92
92
|
}
|
|
93
|
-
const
|
|
93
|
+
const Rt = function() {
|
|
94
94
|
const t = _();
|
|
95
95
|
return {
|
|
96
96
|
topic: this.newTopicName,
|
|
97
97
|
id: t
|
|
98
98
|
};
|
|
99
|
-
},
|
|
99
|
+
}, B = (t, e) => {
|
|
100
100
|
let n = 0, o = 0;
|
|
101
101
|
for (; e && e !== t; )
|
|
102
102
|
n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
|
|
@@ -109,13 +109,13 @@ const Wt = function() {
|
|
|
109
109
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
110
110
|
}, kt = function(t) {
|
|
111
111
|
for (let e = 0; e < t.length; e++) {
|
|
112
|
-
const { dom: n, evt: o, func:
|
|
113
|
-
n.addEventListener(o,
|
|
112
|
+
const { dom: n, evt: o, func: i } = t[e];
|
|
113
|
+
n.addEventListener(o, i);
|
|
114
114
|
}
|
|
115
115
|
return function() {
|
|
116
116
|
for (let n = 0; n < t.length; n++) {
|
|
117
|
-
const { dom: o, evt:
|
|
118
|
-
o.removeEventListener(
|
|
117
|
+
const { dom: o, evt: i, func: s } = t[n];
|
|
118
|
+
o.removeEventListener(i, s);
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
}, vt = (t, e) => {
|
|
@@ -125,21 +125,21 @@ const Wt = function() {
|
|
|
125
125
|
LHS: "lhs",
|
|
126
126
|
RHS: "rhs"
|
|
127
127
|
}, K = function(t, e, n) {
|
|
128
|
-
const { scaleVal: o, scaleSensitivity:
|
|
128
|
+
const { scaleVal: o, scaleSensitivity: i } = t;
|
|
129
129
|
switch (e) {
|
|
130
130
|
case "in":
|
|
131
|
-
t.scale(o +
|
|
131
|
+
t.scale(o + i, n);
|
|
132
132
|
break;
|
|
133
133
|
case "out":
|
|
134
|
-
t.scale(o -
|
|
134
|
+
t.scale(o - i, n);
|
|
135
135
|
}
|
|
136
|
-
}, dt = document,
|
|
136
|
+
}, dt = document, Wt = function(t, e) {
|
|
137
137
|
if (!e)
|
|
138
|
-
return
|
|
138
|
+
return it(t), t;
|
|
139
139
|
let n = t.querySelector(".insert-preview");
|
|
140
140
|
const o = `insert-preview ${e} show`;
|
|
141
141
|
return n || (n = dt.createElement("div"), t.appendChild(n)), n.className = o, t;
|
|
142
|
-
},
|
|
142
|
+
}, it = function(t) {
|
|
143
143
|
if (!t) return;
|
|
144
144
|
const e = t.querySelectorAll(".insert-preview");
|
|
145
145
|
for (const n of e || [])
|
|
@@ -150,7 +150,7 @@ const Wt = function() {
|
|
|
150
150
|
if (!(t && t.tagName === "ME-TPC" && t !== n && !o && t.nodeObj.parent)) return !1;
|
|
151
151
|
}
|
|
152
152
|
return !0;
|
|
153
|
-
},
|
|
153
|
+
}, Gt = function(t) {
|
|
154
154
|
const e = document.createElement("div");
|
|
155
155
|
return e.className = "mind-elixir-ghost", t.container.appendChild(e), e;
|
|
156
156
|
};
|
|
@@ -176,7 +176,7 @@ function Vt(t) {
|
|
|
176
176
|
isDragging: !1,
|
|
177
177
|
insertType: null,
|
|
178
178
|
meet: null,
|
|
179
|
-
ghost:
|
|
179
|
+
ghost: Gt(t),
|
|
180
180
|
edgeMoveController: new zt(t),
|
|
181
181
|
startX: 0,
|
|
182
182
|
startY: 0,
|
|
@@ -186,11 +186,11 @@ function Vt(t) {
|
|
|
186
186
|
const Xt = 5;
|
|
187
187
|
function bt(t, e, n, o = !1) {
|
|
188
188
|
if (t.spacePressed) return !1;
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
189
|
+
const i = n.target;
|
|
190
|
+
if (i?.tagName !== "ME-TPC" || !i.nodeObj.parent) return !1;
|
|
191
191
|
e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.selection.cancel();
|
|
192
|
-
let
|
|
193
|
-
return
|
|
192
|
+
let s = t.currentNodes;
|
|
193
|
+
return s?.includes(i) || (t.selectNode(i), s = t.currentNodes), t.dragged = s, o && Mt(t, e), !0;
|
|
194
194
|
}
|
|
195
195
|
function Dt(t, e, n) {
|
|
196
196
|
t.style.transform = `translate(${e + 10}px, ${n + 10}px)`, t.style.display = "block";
|
|
@@ -200,41 +200,41 @@ function Mt(t, e) {
|
|
|
200
200
|
if (!n) return;
|
|
201
201
|
const o = document.activeElement;
|
|
202
202
|
o && o.isContentEditable && o.blur(), e.isDragging = !0, n.length > 1 ? e.ghost.innerHTML = n.length + "" : e.ghost.innerHTML = n[0].innerHTML;
|
|
203
|
-
for (const
|
|
204
|
-
|
|
203
|
+
for (const i of n)
|
|
204
|
+
i.parentElement.parentElement.style.opacity = "0.5";
|
|
205
205
|
t.dragMoveHelper.clear();
|
|
206
206
|
}
|
|
207
207
|
function Ft(t, e, n) {
|
|
208
208
|
const { dragged: o } = t;
|
|
209
209
|
if (!o || e.pointerId !== n.pointerId) return;
|
|
210
|
-
const
|
|
210
|
+
const i = n.clientX - e.startX, s = n.clientY - e.startY, r = Math.sqrt(i * i + s * s);
|
|
211
211
|
if (!e.isDragging && r > Xt && Mt(t, e), !e.isDragging) return;
|
|
212
212
|
Dt(e.ghost, n.clientX, n.clientY);
|
|
213
213
|
const l = t.container.getBoundingClientRect();
|
|
214
|
-
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(),
|
|
214
|
+
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(), it(e.meet);
|
|
215
215
|
const a = 12 * t.scaleVal, d = dt.elementFromPoint(n.clientX, n.clientY - a);
|
|
216
216
|
if (wt(d, o)) {
|
|
217
217
|
e.meet = d;
|
|
218
|
-
const
|
|
219
|
-
n.clientY >
|
|
218
|
+
const f = d.getBoundingClientRect(), h = f.y;
|
|
219
|
+
n.clientY > h + f.height ? e.insertType = "after" : e.insertType = "in";
|
|
220
220
|
} else {
|
|
221
|
-
const
|
|
222
|
-
if (wt(
|
|
223
|
-
e.meet =
|
|
224
|
-
const p =
|
|
221
|
+
const f = dt.elementFromPoint(n.clientX, n.clientY + a);
|
|
222
|
+
if (wt(f, o)) {
|
|
223
|
+
e.meet = f;
|
|
224
|
+
const p = f.getBoundingClientRect().y;
|
|
225
225
|
n.clientY < p ? e.insertType = "before" : e.insertType = "in";
|
|
226
226
|
} else
|
|
227
227
|
e.insertType = null, e.meet = null;
|
|
228
228
|
}
|
|
229
|
-
e.meet &&
|
|
229
|
+
e.meet && Wt(e.meet, e.insertType);
|
|
230
230
|
}
|
|
231
231
|
function jt(t, e, n) {
|
|
232
232
|
const { dragged: o } = t;
|
|
233
233
|
if (!(!o || e.pointerId !== n.pointerId)) {
|
|
234
234
|
e.edgeMoveController.stop();
|
|
235
|
-
for (const
|
|
236
|
-
|
|
237
|
-
e.ghost.style.display = "none", e.ghost.innerHTML = "", e.isDragging && e.meet && (
|
|
235
|
+
for (const i of o)
|
|
236
|
+
i.parentElement.parentElement.style.opacity = "1";
|
|
237
|
+
e.ghost.style.display = "none", e.ghost.innerHTML = "", e.isDragging && e.meet && (it(e.meet), e.insertType === "before" ? t.moveNodeBefore(o, e.meet) : e.insertType === "after" ? t.moveNodeAfter(o, e.meet) : e.insertType === "in" && t.moveNodeIn(o, e.meet)), t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
function ct(t, e) {
|
|
@@ -243,7 +243,7 @@ function ct(t, e) {
|
|
|
243
243
|
e.edgeMoveController.stop();
|
|
244
244
|
for (const o of n)
|
|
245
245
|
o.parentElement.parentElement.style.opacity = "1";
|
|
246
|
-
e.meet &&
|
|
246
|
+
e.meet && it(e.meet), e.ghost.style.display = "none", e.ghost.innerHTML = "", t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
function qt(t) {
|
|
@@ -251,32 +251,32 @@ function qt(t) {
|
|
|
251
251
|
let n = 0;
|
|
252
252
|
t.spacePressed = !1;
|
|
253
253
|
let o = null;
|
|
254
|
-
const
|
|
254
|
+
const i = /* @__PURE__ */ new Map(), s = t.draggable ? Vt(t) : null;
|
|
255
255
|
let r = null, l = null, a = null, d = null;
|
|
256
|
-
const
|
|
256
|
+
const f = 500, h = 10, p = () => {
|
|
257
257
|
r !== null && (clearTimeout(r), r = null, l = null, a = null, d = null);
|
|
258
|
-
}, v = (c,
|
|
259
|
-
c.hasPointerCapture && c.hasPointerCapture(
|
|
260
|
-
}, y = (c,
|
|
258
|
+
}, v = (c, m) => {
|
|
259
|
+
c.hasPointerCapture && c.hasPointerCapture(m) && c.releasePointerCapture(m);
|
|
260
|
+
}, y = (c, m) => {
|
|
261
261
|
const x = c.closest(".svg-label");
|
|
262
262
|
if (x) {
|
|
263
263
|
const $ = x.dataset.svgId, U = x.dataset.type, j = document.getElementById($);
|
|
264
264
|
if (j) {
|
|
265
265
|
if (U === "arrow")
|
|
266
|
-
return
|
|
266
|
+
return m ? t.editArrowLabel(j) : t.selectArrow(j), !0;
|
|
267
267
|
if (U === "summary")
|
|
268
|
-
return
|
|
268
|
+
return m ? t.editSummary(j) : t.selectSummary(j), !0;
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
if (c.closest(".topiclinks")) {
|
|
272
272
|
const $ = c.closest("g");
|
|
273
273
|
if ($)
|
|
274
|
-
return
|
|
274
|
+
return m ? t.editArrowLabel($) : t.selectArrow($), !0;
|
|
275
275
|
}
|
|
276
276
|
if (c.closest(".summary")) {
|
|
277
277
|
const $ = c.closest("g");
|
|
278
278
|
if ($)
|
|
279
|
-
return
|
|
279
|
+
return m ? t.editSummary($) : t.selectSummary($), !0;
|
|
280
280
|
}
|
|
281
281
|
return !1;
|
|
282
282
|
}, u = (c) => {
|
|
@@ -293,97 +293,97 @@ function qt(t) {
|
|
|
293
293
|
e.clear();
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
|
-
if (
|
|
296
|
+
if (s?.isDragging)
|
|
297
297
|
return;
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
300
|
-
c.ctrlKey || c.metaKey ? t.expandNodeAll(
|
|
301
|
-
else if (
|
|
302
|
-
t.selectNode(
|
|
298
|
+
const m = c.target;
|
|
299
|
+
if (m.tagName === "ME-EPD")
|
|
300
|
+
c.ctrlKey || c.metaKey ? t.expandNodeAll(m.previousSibling) : t.expandNode(m.previousSibling);
|
|
301
|
+
else if (m.tagName === "ME-TPC" && t.currentNodes.length > 1)
|
|
302
|
+
t.selectNode(m);
|
|
303
303
|
else if (!t.editable)
|
|
304
304
|
return;
|
|
305
|
-
y(
|
|
306
|
-
},
|
|
305
|
+
y(m, !1);
|
|
306
|
+
}, g = (c) => {
|
|
307
307
|
if (!t.editable) return;
|
|
308
|
-
const
|
|
309
|
-
lt(
|
|
308
|
+
const m = c.target;
|
|
309
|
+
lt(m) && t.beginEdit(m), y(m, !0);
|
|
310
310
|
}, w = (c) => {
|
|
311
|
-
if (c.pointerType === "mouse" ||
|
|
312
|
-
const
|
|
313
|
-
x < 300 && x > 0 &&
|
|
311
|
+
if (c.pointerType === "mouse" || i.size > 1) return;
|
|
312
|
+
const m = (/* @__PURE__ */ new Date()).getTime(), x = m - n;
|
|
313
|
+
x < 300 && x > 0 && g(c), n = m;
|
|
314
314
|
}, b = (c) => {
|
|
315
315
|
c.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
|
|
316
316
|
}, C = (c) => {
|
|
317
317
|
c.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
|
|
318
318
|
}, S = (c) => {
|
|
319
|
-
if (c.pointerType === "touch" && (
|
|
320
|
-
const [$, U] = Array.from(
|
|
319
|
+
if (c.pointerType === "touch" && (i.set(c.pointerId, { x: c.clientX, y: c.clientY }), i.size === 2)) {
|
|
320
|
+
const [$, U] = Array.from(i.values());
|
|
321
321
|
o = vt($, U), p();
|
|
322
322
|
}
|
|
323
323
|
e.moved = !1;
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
326
|
-
if (c.pointerType === "touch" &&
|
|
327
|
-
(
|
|
328
|
-
else if (c.pointerType === "touch" &&
|
|
329
|
-
(lt(
|
|
330
|
-
bt(t,
|
|
331
|
-
},
|
|
332
|
-
else if (c.pointerType === "mouse" && bt(t,
|
|
333
|
-
|
|
324
|
+
const m = c.target, x = t.mouseSelectionButton === 0 ? 2 : 0;
|
|
325
|
+
if (s && (c.button === 0 || c.pointerType === "touch")) {
|
|
326
|
+
if (c.pointerType === "touch" && i.size > 1)
|
|
327
|
+
(s.isDragging || s.pointerId !== null) && ct(t, s);
|
|
328
|
+
else if (c.pointerType === "touch" && i.size === 1)
|
|
329
|
+
(lt(m) || m.closest("me-tpc")) && (l = { x: c.clientX, y: c.clientY }, a = m, d = c.pointerId, r = window.setTimeout(() => {
|
|
330
|
+
bt(t, s, c, !0) && (a && a.setPointerCapture(c.pointerId), Dt(s.ghost, c.clientX, c.clientY)), r = null, l = null, a = null, d = null;
|
|
331
|
+
}, f));
|
|
332
|
+
else if (c.pointerType === "mouse" && bt(t, s, c, !1)) {
|
|
333
|
+
m.setPointerCapture(c.pointerId);
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
const H = t.spacePressed && c.button === 0 && c.pointerType === "mouse", Y = c.button === x && c.pointerType === "mouse" || c.pointerType === "touch";
|
|
338
|
-
!H && !Y || (e.x = c.clientX, e.y = c.clientY,
|
|
338
|
+
!H && !Y || (e.x = c.clientX, e.y = c.clientY, m.className !== "circle" && m.contentEditable !== "plaintext-only" && (e.mousedown = !0, m.setPointerCapture(c.pointerId)));
|
|
339
339
|
}, T = (c) => {
|
|
340
|
-
if (c.pointerType === "touch" &&
|
|
341
|
-
if (
|
|
342
|
-
const
|
|
343
|
-
Math.sqrt(
|
|
340
|
+
if (c.pointerType === "touch" && i.has(c.pointerId)) {
|
|
341
|
+
if (i.set(c.pointerId, { x: c.clientX, y: c.clientY }), r !== null && l !== null && c.pointerId === d) {
|
|
342
|
+
const m = c.clientX - l.x, x = c.clientY - l.y;
|
|
343
|
+
Math.sqrt(m * m + x * x) > h && p();
|
|
344
344
|
}
|
|
345
|
-
if (
|
|
346
|
-
const [
|
|
345
|
+
if (i.size >= 2) {
|
|
346
|
+
const [m, x] = Array.from(i.values()), H = vt(m, x);
|
|
347
347
|
if (o == null)
|
|
348
348
|
o = H;
|
|
349
349
|
else {
|
|
350
350
|
const Y = H - o;
|
|
351
351
|
Math.abs(Y) > 8 && (Y > 0 ? K(t, "in", {
|
|
352
|
-
x: (
|
|
353
|
-
y: (
|
|
352
|
+
x: (m.x + x.x) / 2,
|
|
353
|
+
y: (m.y + x.y) / 2
|
|
354
354
|
}) : K(t, "out", {
|
|
355
|
-
x: (
|
|
356
|
-
y: (
|
|
355
|
+
x: (m.x + x.x) / 2,
|
|
356
|
+
y: (m.y + x.y) / 2
|
|
357
357
|
}), o = H);
|
|
358
358
|
}
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
if (!(
|
|
362
|
+
if (!(s && s.pointerId !== null && (Ft(t, s, c), s.isDragging))) {
|
|
363
363
|
if (c.target.contentEditable !== "plaintext-only" || t.spacePressed && e.mousedown) {
|
|
364
|
-
const
|
|
365
|
-
e.onMove(
|
|
364
|
+
const m = c.clientX - e.x, x = c.clientY - e.y;
|
|
365
|
+
e.onMove(m, x);
|
|
366
366
|
}
|
|
367
367
|
e.x = c.clientX, e.y = c.clientY;
|
|
368
368
|
}
|
|
369
369
|
}, D = (c) => {
|
|
370
|
-
if (c.pointerType === "touch" && (
|
|
371
|
-
const
|
|
372
|
-
if (jt(t,
|
|
370
|
+
if (c.pointerType === "touch" && (i.delete(c.pointerId), i.size < 2 && (o = null), p()), s && s.pointerId !== null) {
|
|
371
|
+
const m = s.isDragging;
|
|
372
|
+
if (jt(t, s, c), v(c.target, c.pointerId), m)
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
375
|
e.mousedown && (v(c.target, c.pointerId), e.clear());
|
|
376
376
|
}, L = () => {
|
|
377
|
-
p(), e.mousedown && e.clear(),
|
|
377
|
+
p(), e.mousedown && e.clear(), s && (s.isDragging || s.pointerId !== null) && ct(t, s);
|
|
378
378
|
}, M = (c) => {
|
|
379
|
-
c.pointerType === "touch" && (
|
|
379
|
+
c.pointerType === "touch" && (i.delete(c.pointerId), i.size < 2 && (o = null), p()), s && s.pointerId === c.pointerId && ct(t, s), D(c);
|
|
380
380
|
}, N = (c) => {
|
|
381
381
|
if (c.preventDefault(), c.button !== 2 || !t.editable) return;
|
|
382
|
-
const
|
|
383
|
-
lt(
|
|
382
|
+
const m = c.target;
|
|
383
|
+
lt(m) && !m.classList.contains("selected") && t.selectNode(m), setTimeout(() => {
|
|
384
384
|
t.dragMoveHelper.moved || t.bus.fire("showContextMenu", c);
|
|
385
385
|
}, 200);
|
|
386
|
-
},
|
|
386
|
+
}, R = (c) => {
|
|
387
387
|
c.stopPropagation(), c.preventDefault(), c.ctrlKey || c.metaKey ? c.deltaY < 0 ? K(t, "in", t.dragMoveHelper) : t.scaleVal - t.scaleSensitivity > 0 && K(t, "out", t.dragMoveHelper) : c.shiftKey ? t.move(-c.deltaY, 0) : t.move(-c.deltaX, -c.deltaY);
|
|
388
388
|
}, { container: E } = t;
|
|
389
389
|
return kt([
|
|
@@ -393,9 +393,9 @@ function qt(t) {
|
|
|
393
393
|
{ dom: E, evt: "pointercancel", func: M },
|
|
394
394
|
{ dom: E, evt: "pointerdown", func: w },
|
|
395
395
|
{ dom: E, evt: "click", func: u },
|
|
396
|
-
{ dom: E, evt: "dblclick", func:
|
|
396
|
+
{ dom: E, evt: "dblclick", func: g },
|
|
397
397
|
{ dom: E, evt: "contextmenu", func: N },
|
|
398
|
-
{ dom: E, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel :
|
|
398
|
+
{ dom: E, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : R },
|
|
399
399
|
{ dom: E, evt: "blur", func: L },
|
|
400
400
|
{ dom: E, evt: "keydown", func: b },
|
|
401
401
|
{ dom: E, evt: "keyup", func: C }
|
|
@@ -433,27 +433,27 @@ const nt = document, Ut = function() {
|
|
|
433
433
|
e.appendChild(t);
|
|
434
434
|
const n = this.nodeData.children || [];
|
|
435
435
|
if (this.direction === 2) {
|
|
436
|
-
let o = 0,
|
|
437
|
-
n.map((
|
|
438
|
-
|
|
436
|
+
let o = 0, i = 0;
|
|
437
|
+
n.map((s) => {
|
|
438
|
+
s.direction === 0 ? o += 1 : s.direction === 1 ? i += 1 : o <= i ? (s.direction = 0, o += 1) : (s.direction = 1, i += 1);
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
Kt(this, n, e);
|
|
442
442
|
}, Kt = function(t, e, n) {
|
|
443
443
|
const o = nt.createElement("me-main");
|
|
444
444
|
o.className = F.LHS;
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
for (let
|
|
448
|
-
const r = e[
|
|
449
|
-
t.direction === 2 ? r.direction === 0 ? o.appendChild(l) :
|
|
445
|
+
const i = nt.createElement("me-main");
|
|
446
|
+
i.className = F.RHS;
|
|
447
|
+
for (let s = 0; s < e.length; s++) {
|
|
448
|
+
const r = e[s], { grp: l } = t.createWrapper(r);
|
|
449
|
+
t.direction === 2 ? r.direction === 0 ? o.appendChild(l) : i.appendChild(l) : t.direction === 0 ? o.appendChild(l) : i.appendChild(l);
|
|
450
450
|
}
|
|
451
|
-
t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(
|
|
451
|
+
t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(i), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
|
|
452
452
|
}, Jt = function(t, e) {
|
|
453
453
|
const n = nt.createElement("me-children");
|
|
454
454
|
for (let o = 0; o < e.length; o++) {
|
|
455
|
-
const
|
|
456
|
-
n.appendChild(
|
|
455
|
+
const i = e[o], { grp: s } = t.createWrapper(i);
|
|
456
|
+
n.appendChild(s);
|
|
457
457
|
}
|
|
458
458
|
return n;
|
|
459
459
|
}, P = document, $t = function(t, e) {
|
|
@@ -492,20 +492,20 @@ const nt = document, Ut = function() {
|
|
|
492
492
|
if (e.tags && e.tags.length) {
|
|
493
493
|
const n = P.createElement("div");
|
|
494
494
|
n.className = "tags", e.tags.forEach((o) => {
|
|
495
|
-
const
|
|
496
|
-
typeof o == "string" ?
|
|
495
|
+
const i = P.createElement("span");
|
|
496
|
+
typeof o == "string" ? i.textContent = o : (i.textContent = o.text, o.className && (i.className = o.className), o.style && Object.assign(i.style, o.style)), n.appendChild(i);
|
|
497
497
|
}), t.appendChild(n), t.tags = n;
|
|
498
498
|
} else t.tags && (t.tags = void 0);
|
|
499
499
|
}, Qt = function(t, e) {
|
|
500
|
-
const n = P.createElement("me-wrapper"), { p: o, tpc:
|
|
500
|
+
const n = P.createElement("me-wrapper"), { p: o, tpc: i } = this.createParent(t);
|
|
501
501
|
if (n.appendChild(o), !e && t.children && t.children.length > 0) {
|
|
502
|
-
const
|
|
503
|
-
if (o.appendChild(
|
|
502
|
+
const s = oe(t.expanded);
|
|
503
|
+
if (o.appendChild(s), t.expanded !== !1) {
|
|
504
504
|
const r = Jt(this, t.children);
|
|
505
505
|
n.appendChild(r);
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
return { grp: n, top: o, tpc:
|
|
508
|
+
return { grp: n, top: o, tpc: i };
|
|
509
509
|
}, Zt = function(t) {
|
|
510
510
|
const e = P.createElement("me-parent"), n = this.createTopic(t);
|
|
511
511
|
return Nt.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
|
|
@@ -524,12 +524,12 @@ function Pt(t) {
|
|
|
524
524
|
}
|
|
525
525
|
const ne = function(t) {
|
|
526
526
|
if (!t) return;
|
|
527
|
-
const e = P.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft:
|
|
527
|
+
const e = P.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: i, offsetTop: s } = B(this.nodes, t);
|
|
528
528
|
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
529
529
|
const r = getComputedStyle(t);
|
|
530
530
|
e.style.cssText = `
|
|
531
|
-
left: ${
|
|
532
|
-
top: ${
|
|
531
|
+
left: ${i}px;
|
|
532
|
+
top: ${s}px;
|
|
533
533
|
min-width:${t.offsetWidth - 8}px;
|
|
534
534
|
color:${r.color};
|
|
535
535
|
font-size:${r.fontSize};
|
|
@@ -560,15 +560,15 @@ const ne = function(t) {
|
|
|
560
560
|
}, oe = function(t) {
|
|
561
561
|
const e = P.createElement("me-epd");
|
|
562
562
|
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
563
|
-
}, X = document, I = "http://www.w3.org/2000/svg",
|
|
564
|
-
const e = t.clientWidth, n = t.clientHeight, o = t.dataset,
|
|
565
|
-
let l =
|
|
566
|
-
r === "middle" ? l =
|
|
563
|
+
}, X = document, I = "http://www.w3.org/2000/svg", st = function(t) {
|
|
564
|
+
const e = t.clientWidth, n = t.clientHeight, o = t.dataset, i = Number(o.x), s = Number(o.y), r = o.anchor;
|
|
565
|
+
let l = i;
|
|
566
|
+
r === "middle" ? l = i - e / 2 : r === "end" && (l = i - e), t.style.left = `${l}px`, t.style.top = `${s - n / 2}px`, t.style.visibility = "visible";
|
|
567
567
|
}, ht = function(t, e, n, o) {
|
|
568
|
-
const { anchor:
|
|
569
|
-
a.className = "svg-label", a.style.color =
|
|
568
|
+
const { anchor: i = "middle", color: s, dataType: r, svgId: l } = o, a = document.createElement("div");
|
|
569
|
+
a.className = "svg-label", a.style.color = s || "#666";
|
|
570
570
|
const d = "label-" + l;
|
|
571
|
-
return a.id = d, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = l, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor =
|
|
571
|
+
return a.id = d, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = l, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor = i, a;
|
|
572
572
|
}, At = function(t, e, n) {
|
|
573
573
|
const o = X.createElementNS(I, "path");
|
|
574
574
|
return k(o, {
|
|
@@ -583,8 +583,8 @@ const ne = function(t) {
|
|
|
583
583
|
}, xt = function() {
|
|
584
584
|
const t = X.createElementNS(I, "line");
|
|
585
585
|
return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
|
|
586
|
-
},
|
|
587
|
-
const
|
|
586
|
+
}, ie = function(t, e, n, o) {
|
|
587
|
+
const i = X.createElementNS(I, "g");
|
|
588
588
|
return [
|
|
589
589
|
{
|
|
590
590
|
name: "line",
|
|
@@ -599,40 +599,40 @@ const ne = function(t) {
|
|
|
599
599
|
d: n
|
|
600
600
|
}
|
|
601
601
|
].forEach((r, l) => {
|
|
602
|
-
const a = r.d, d = X.createElementNS(I, "path"),
|
|
602
|
+
const a = r.d, d = X.createElementNS(I, "path"), f = {
|
|
603
603
|
d: a,
|
|
604
604
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
605
605
|
fill: "none",
|
|
606
606
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
607
607
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
608
608
|
};
|
|
609
|
-
o?.opacity !== void 0 && (
|
|
610
|
-
const
|
|
611
|
-
k(
|
|
609
|
+
o?.opacity !== void 0 && (f.opacity = String(o.opacity)), k(d, f), l === 0 && d.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
610
|
+
const h = X.createElementNS(I, "path");
|
|
611
|
+
k(h, {
|
|
612
612
|
d: a,
|
|
613
613
|
stroke: "transparent",
|
|
614
614
|
fill: "none",
|
|
615
615
|
"stroke-width": "15"
|
|
616
|
-
}),
|
|
617
|
-
}),
|
|
616
|
+
}), i.appendChild(h), i.appendChild(d), i[r.name] = d;
|
|
617
|
+
}), i;
|
|
618
618
|
}, Ht = function(t, e, n) {
|
|
619
619
|
if (!e) return;
|
|
620
|
-
const o = n.label,
|
|
621
|
-
t.nodes.appendChild(
|
|
620
|
+
const o = n.label, i = e.cloneNode(!0);
|
|
621
|
+
t.nodes.appendChild(i), i.id = "input-box", i.textContent = o, i.contentEditable = "plaintext-only", i.spellcheck = !1, i.style.cssText = `
|
|
622
622
|
left:${e.style.left};
|
|
623
623
|
top:${e.style.top};
|
|
624
624
|
max-width: 200px;
|
|
625
|
-
`, Pt(
|
|
626
|
-
|
|
627
|
-
const r =
|
|
625
|
+
`, Pt(i), t.scrollIntoView(i), i.addEventListener("keydown", (s) => {
|
|
626
|
+
s.stopPropagation();
|
|
627
|
+
const r = s.key;
|
|
628
628
|
if (r === "Enter" || r === "Tab") {
|
|
629
|
-
if (
|
|
630
|
-
|
|
629
|
+
if (s.shiftKey) return;
|
|
630
|
+
s.preventDefault(), i.blur(), t.container.focus();
|
|
631
631
|
}
|
|
632
|
-
}),
|
|
633
|
-
if (!
|
|
634
|
-
const
|
|
635
|
-
|
|
632
|
+
}), i.addEventListener("blur", () => {
|
|
633
|
+
if (!i) return;
|
|
634
|
+
const s = i.textContent?.trim() || "";
|
|
635
|
+
s === "" ? n.label = o : n.label = s, i.remove(), s !== o && (t.markdown ? e.innerHTML = t.markdown(n.label, n) : e.textContent = n.label, st(e), "parent" in n ? t.bus.fire("operation", {
|
|
636
636
|
name: "finishEditSummary",
|
|
637
637
|
obj: n
|
|
638
638
|
}) : t.bus.fire("operation", {
|
|
@@ -640,30 +640,30 @@ const ne = function(t) {
|
|
|
640
640
|
obj: n
|
|
641
641
|
}));
|
|
642
642
|
});
|
|
643
|
-
},
|
|
644
|
-
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft,
|
|
643
|
+
}, se = function(t) {
|
|
644
|
+
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, i = e.offsetWidth, s = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
645
645
|
this.lines.innerHTML = "";
|
|
646
646
|
for (let l = 0; l < r.length; l++) {
|
|
647
|
-
const a = r[l], d = a.querySelector("me-tpc"), { offsetLeft:
|
|
647
|
+
const a = r[l], d = a.querySelector("me-tpc"), { offsetLeft: f, offsetTop: h } = B(this.nodes, d), p = d.offsetWidth, v = d.offsetHeight, y = a.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: i, pH: s, cT: h, cL: f, cW: p, cH: v, direction: y, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, w = d.nodeObj.branchColor || g[l % g.length];
|
|
648
648
|
if (d.style.borderColor = w, this.lines.appendChild(At(u, w, "3")), t && t !== a)
|
|
649
649
|
continue;
|
|
650
650
|
const b = q("subLines"), C = a.lastChild;
|
|
651
651
|
C.tagName === "svg" && C.remove(), a.appendChild(b), It(this, b, w, a, y, !0);
|
|
652
652
|
}
|
|
653
653
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
654
|
-
}, It = function(t, e, n, o,
|
|
654
|
+
}, It = function(t, e, n, o, i, s) {
|
|
655
655
|
const r = o.firstChild, l = o.children[1].children;
|
|
656
656
|
if (l.length === 0) return;
|
|
657
|
-
const a = r.offsetTop, d = r.offsetLeft,
|
|
657
|
+
const a = r.offsetTop, d = r.offsetLeft, f = r.offsetWidth, h = r.offsetHeight;
|
|
658
658
|
for (let p = 0; p < l.length; p++) {
|
|
659
|
-
const v = l[p], y = v.firstChild, u = y.offsetTop,
|
|
659
|
+
const v = l[p], y = v.firstChild, u = y.offsetTop, g = y.offsetLeft, w = y.offsetWidth, b = y.offsetHeight, C = y.firstChild.nodeObj.branchColor || n, S = t.generateSubBranch({ pT: a, pL: d, pW: f, pH: h, cT: u, cL: g, cW: w, cH: b, direction: i, isFirst: s });
|
|
660
660
|
e.appendChild(At(S, C, "2"));
|
|
661
661
|
const T = y.children[1];
|
|
662
662
|
if (T) {
|
|
663
663
|
if (!T.expanded) continue;
|
|
664
664
|
} else
|
|
665
665
|
continue;
|
|
666
|
-
It(t, e, C, v,
|
|
666
|
+
It(t, e, C, v, i);
|
|
667
667
|
}
|
|
668
668
|
}, 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="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>', le = '<?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>', ce = '<?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>', ae = '<?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>', de = '<?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>', 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="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>', fe = '<?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>', ue = {
|
|
669
669
|
side: re,
|
|
@@ -673,29 +673,29 @@ const ne = function(t) {
|
|
|
673
673
|
living: de,
|
|
674
674
|
zoomin: he,
|
|
675
675
|
zoomout: fe
|
|
676
|
-
},
|
|
676
|
+
}, W = (t, e) => {
|
|
677
677
|
const n = document.createElement("span");
|
|
678
678
|
return n.id = t, n.innerHTML = ue[e], n;
|
|
679
679
|
};
|
|
680
680
|
function pe(t) {
|
|
681
|
-
const e = document.createElement("div"), n =
|
|
682
|
-
return r.innerText = "100%", e.appendChild(n), e.appendChild(o), e.appendChild(
|
|
681
|
+
const e = document.createElement("div"), n = W("fullscreen", "full"), o = W("toCenter", "living"), i = W("zoomout", "zoomout"), s = W("zoomin", "zoomin"), r = document.createElement("span");
|
|
682
|
+
return r.innerText = "100%", e.appendChild(n), e.appendChild(o), e.appendChild(i), e.appendChild(s), e.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
683
683
|
document.fullscreenElement === t.el ? document.exitFullscreen() : t.el.requestFullscreen();
|
|
684
684
|
}, o.onclick = () => {
|
|
685
685
|
t.toCenter();
|
|
686
|
-
}, s.onclick = () => {
|
|
687
|
-
t.scale(t.scaleVal - t.scaleSensitivity);
|
|
688
686
|
}, i.onclick = () => {
|
|
687
|
+
t.scale(t.scaleVal - t.scaleSensitivity);
|
|
688
|
+
}, s.onclick = () => {
|
|
689
689
|
t.scale(t.scaleVal + t.scaleSensitivity);
|
|
690
690
|
}, e;
|
|
691
691
|
}
|
|
692
692
|
function ge(t) {
|
|
693
|
-
const e = document.createElement("div"), n =
|
|
694
|
-
return e.appendChild(n), e.appendChild(o), e.appendChild(
|
|
693
|
+
const e = document.createElement("div"), n = W("tbltl", "left"), o = W("tbltr", "right"), i = W("tblts", "side");
|
|
694
|
+
return e.appendChild(n), e.appendChild(o), e.appendChild(i), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
695
695
|
t.initLeft();
|
|
696
696
|
}, o.onclick = () => {
|
|
697
697
|
t.initRight();
|
|
698
|
-
},
|
|
698
|
+
}, i.onclick = () => {
|
|
699
699
|
t.initSide();
|
|
700
700
|
}, e;
|
|
701
701
|
}
|
|
@@ -707,9 +707,9 @@ const ye = function(t, e = !0) {
|
|
|
707
707
|
const o = {
|
|
708
708
|
...(t.type === "dark" ? ut : ft).cssVar,
|
|
709
709
|
...t.cssVar
|
|
710
|
-
},
|
|
711
|
-
for (let
|
|
712
|
-
const r = s
|
|
710
|
+
}, i = Object.keys(o);
|
|
711
|
+
for (let s = 0; s < i.length; s++) {
|
|
712
|
+
const r = i[s];
|
|
713
713
|
this.container.style.setProperty(r, o[r]);
|
|
714
714
|
}
|
|
715
715
|
e && this.refresh();
|
|
@@ -729,8 +729,8 @@ function we(t) {
|
|
|
729
729
|
const be = function(t) {
|
|
730
730
|
const e = this.container, n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
731
731
|
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
732
|
-
const
|
|
733
|
-
this.move(-d, -
|
|
732
|
+
const s = n.left + n.width / 2, r = n.top + n.height / 2, l = o.left + o.width / 2, a = o.top + o.height / 2, d = s - l, f = r - a;
|
|
733
|
+
this.move(-d, -f, !0);
|
|
734
734
|
}
|
|
735
735
|
}, xe = function(t, e, n) {
|
|
736
736
|
this.clearSelection(), this.scrollIntoView(t), this.selection.select(t), e && this.bus.fire("selectNewNode", t.nodeObj);
|
|
@@ -754,26 +754,41 @@ const be = function(t) {
|
|
|
754
754
|
this.editable = !1;
|
|
755
755
|
}, Me = function(t, e = { x: 0, y: 0 }) {
|
|
756
756
|
if (t < this.scaleMin || t > this.scaleMax) return;
|
|
757
|
-
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0,
|
|
757
|
+
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, i = e.y ? e.y - n.top - n.height / 2 : 0, { dx: s, dy: r } = gt(this), l = this.map.style.transform, { x: a, y: d } = Lt(l), f = a - s, h = d - r, p = this.scaleVal, v = (-o + f) * (1 - t / p), y = (-i + h) * (1 - t / p);
|
|
758
758
|
this.map.style.transform = `translate3d(${a - v}px, ${d - y}px, 0) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
759
759
|
}, $e = function() {
|
|
760
760
|
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
761
761
|
this.scaleVal = n;
|
|
762
|
-
const { dx: o, dy:
|
|
763
|
-
this.map.style.transform = `translate3d(${o}px, ${
|
|
762
|
+
const { dx: o, dy: i } = gt(this, !0);
|
|
763
|
+
this.map.style.transform = `translate3d(${o}px, ${i}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
764
764
|
}, Ne = function(t, e, n = !1) {
|
|
765
|
-
const { map: o, scaleVal:
|
|
765
|
+
const { map: o, scaleVal: i, bus: s, container: r, nodes: l } = this;
|
|
766
766
|
if (n && o.style.transition === "transform 0.3s")
|
|
767
767
|
return;
|
|
768
|
-
const
|
|
769
|
-
let { x:
|
|
770
|
-
|
|
768
|
+
const a = o.style.transform;
|
|
769
|
+
let { x: d, y: f } = Lt(a);
|
|
770
|
+
const h = r.getBoundingClientRect(), p = l.getBoundingClientRect(), v = p.left < h.right && p.right > h.left, y = p.top < h.bottom && p.bottom > h.top;
|
|
771
|
+
if (v) {
|
|
772
|
+
const u = p.left + t, g = p.right + t;
|
|
773
|
+
(u >= h.right || g <= h.left) && (t = 0);
|
|
774
|
+
}
|
|
775
|
+
if (y) {
|
|
776
|
+
const u = p.top + e, g = p.bottom + e;
|
|
777
|
+
(u >= h.bottom || g <= h.top) && (e = 0);
|
|
778
|
+
}
|
|
779
|
+
d += t, f += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
771
780
|
o.style.transition = "none";
|
|
772
|
-
}, 300)), o.style.transform = `translate3d(${
|
|
773
|
-
}, gt = (t) => {
|
|
774
|
-
const { container:
|
|
775
|
-
let
|
|
776
|
-
|
|
781
|
+
}, 300)), o.style.transform = `translate3d(${d}px, ${f}px, 0) scale(${i})`, s.fire("move", { dx: t, dy: e });
|
|
782
|
+
}, gt = (t, e = !1) => {
|
|
783
|
+
const { container: n, map: o, nodes: i } = t;
|
|
784
|
+
let s, r;
|
|
785
|
+
if (t.alignment === "nodes" || e)
|
|
786
|
+
s = (n.offsetWidth - i.offsetWidth) / 2, r = (n.offsetHeight - i.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
|
|
787
|
+
else {
|
|
788
|
+
const l = o.querySelector("me-root"), a = l.offsetTop, d = l.offsetLeft, f = l.offsetWidth, h = l.offsetHeight;
|
|
789
|
+
s = n.offsetWidth / 2 - d - f / 2, r = n.offsetHeight / 2 - a - h / 2, o.style.transformOrigin = `${d + f / 2}px 50%`;
|
|
790
|
+
}
|
|
791
|
+
return { dx: s, dy: r };
|
|
777
792
|
}, Pe = function() {
|
|
778
793
|
const { map: t, container: e } = this, { dx: n, dy: o } = gt(this);
|
|
779
794
|
e.scrollTop = 0, e.scrollLeft = 0, t.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
@@ -783,44 +798,44 @@ const be = function(t) {
|
|
|
783
798
|
t.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = t.nodeObj, this.initRight(), this.toCenter());
|
|
784
799
|
}, Ie = function() {
|
|
785
800
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
786
|
-
}, Oe = function() {
|
|
787
|
-
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
788
801
|
}, Be = function() {
|
|
802
|
+
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
803
|
+
}, Oe = function() {
|
|
789
804
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
790
805
|
}, Ye = function() {
|
|
791
806
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
792
|
-
},
|
|
807
|
+
}, Re = function(t) {
|
|
793
808
|
this.locale = t, this.refresh();
|
|
794
|
-
},
|
|
809
|
+
}, We = function(t, e) {
|
|
795
810
|
const n = t.nodeObj;
|
|
796
811
|
typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
797
|
-
const o = t.getBoundingClientRect(),
|
|
812
|
+
const o = t.getBoundingClientRect(), i = {
|
|
798
813
|
x: o.left,
|
|
799
814
|
y: o.top
|
|
800
|
-
},
|
|
815
|
+
}, s = t.parentNode, r = s.children[1];
|
|
801
816
|
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", ve(t), n.expanded) {
|
|
802
|
-
const
|
|
817
|
+
const h = this.createChildren(
|
|
803
818
|
n.children.map((p) => this.createWrapper(p).grp)
|
|
804
819
|
);
|
|
805
|
-
|
|
820
|
+
s.parentNode.appendChild(h);
|
|
806
821
|
} else
|
|
807
|
-
|
|
822
|
+
s.parentNode.children[1].remove();
|
|
808
823
|
this.linkDiv(t.closest("me-main > me-wrapper"));
|
|
809
824
|
const l = t.getBoundingClientRect(), a = {
|
|
810
825
|
x: l.left,
|
|
811
826
|
y: l.top
|
|
812
|
-
}, d =
|
|
813
|
-
this.move(d,
|
|
814
|
-
},
|
|
815
|
-
const n = t.nodeObj, o = t.getBoundingClientRect(),
|
|
827
|
+
}, d = i.x - a.x, f = i.y - a.y;
|
|
828
|
+
this.move(d, f), this.bus.fire("expandNode", n);
|
|
829
|
+
}, Ge = function(t, e) {
|
|
830
|
+
const n = t.nodeObj, o = t.getBoundingClientRect(), i = {
|
|
816
831
|
x: o.left,
|
|
817
832
|
y: o.top
|
|
818
833
|
};
|
|
819
834
|
Tt(n, e ?? !n.expanded), this.refresh();
|
|
820
|
-
const
|
|
821
|
-
x:
|
|
822
|
-
y:
|
|
823
|
-
}, l =
|
|
835
|
+
const s = this.findEle(n.id).getBoundingClientRect(), r = {
|
|
836
|
+
x: s.left,
|
|
837
|
+
y: s.top
|
|
838
|
+
}, l = i.x - r.x, a = i.y - r.y;
|
|
824
839
|
this.move(l, a);
|
|
825
840
|
}, ze = function(t) {
|
|
826
841
|
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();
|
|
@@ -830,13 +845,13 @@ const be = function(t) {
|
|
|
830
845
|
clearSelection: Se,
|
|
831
846
|
disableEdit: De,
|
|
832
847
|
enableEdit: ke,
|
|
833
|
-
expandNode:
|
|
834
|
-
expandNodeAll:
|
|
848
|
+
expandNode: We,
|
|
849
|
+
expandNodeAll: Ge,
|
|
835
850
|
focusNode: He,
|
|
836
851
|
getData: Le,
|
|
837
852
|
getDataString: Te,
|
|
838
|
-
initLeft:
|
|
839
|
-
initRight:
|
|
853
|
+
initLeft: Be,
|
|
854
|
+
initRight: Oe,
|
|
840
855
|
initSide: Ye,
|
|
841
856
|
install: Ae,
|
|
842
857
|
move: Ne,
|
|
@@ -846,7 +861,7 @@ const be = function(t) {
|
|
|
846
861
|
scrollIntoView: be,
|
|
847
862
|
selectNode: xe,
|
|
848
863
|
selectNodes: Ce,
|
|
849
|
-
setLocale:
|
|
864
|
+
setLocale: Re,
|
|
850
865
|
toCenter: Pe,
|
|
851
866
|
unselectNodes: Ee
|
|
852
867
|
}, Symbol.toStringTag, { value: "Module" })), Xe = function(t) {
|
|
@@ -887,50 +902,50 @@ const be = function(t) {
|
|
|
887
902
|
}, Ct = {
|
|
888
903
|
create: Xe
|
|
889
904
|
}, Fe = "#4dc4ff";
|
|
890
|
-
function
|
|
905
|
+
function Bt(t, e, n, o, i, s, r, l) {
|
|
891
906
|
return {
|
|
892
|
-
x: t / 8 + n * 3 / 8 +
|
|
893
|
-
y: e / 8 + o * 3 / 8 +
|
|
907
|
+
x: t / 8 + n * 3 / 8 + i * 3 / 8 + r / 8,
|
|
908
|
+
y: e / 8 + o * 3 / 8 + s * 3 / 8 + l / 8
|
|
894
909
|
};
|
|
895
910
|
}
|
|
896
911
|
function je(t, e, n) {
|
|
897
|
-
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(),
|
|
912
|
+
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), st(t));
|
|
898
913
|
}
|
|
899
|
-
function J(t, e, n, o,
|
|
914
|
+
function J(t, e, n, o, i) {
|
|
900
915
|
k(t, {
|
|
901
916
|
x1: e + "",
|
|
902
917
|
y1: n + "",
|
|
903
918
|
x2: o + "",
|
|
904
|
-
y2:
|
|
919
|
+
y2: i + ""
|
|
905
920
|
});
|
|
906
921
|
}
|
|
907
|
-
function Et(t, e, n, o,
|
|
908
|
-
const
|
|
909
|
-
if (t.line.setAttribute("d",
|
|
922
|
+
function Et(t, e, n, o, i, s, r, l, a, d) {
|
|
923
|
+
const f = `M ${e} ${n} C ${o} ${i} ${s} ${r} ${l} ${a}`;
|
|
924
|
+
if (t.line.setAttribute("d", f), d.style) {
|
|
910
925
|
const u = d.style;
|
|
911
926
|
u.stroke && t.line.setAttribute("stroke", u.stroke), u.strokeWidth && t.line.setAttribute("stroke-width", String(u.strokeWidth)), u.strokeDasharray && t.line.setAttribute("stroke-dasharray", u.strokeDasharray), u.strokeLinecap && t.line.setAttribute("stroke-linecap", u.strokeLinecap), u.opacity !== void 0 && t.line.setAttribute("opacity", String(u.opacity));
|
|
912
927
|
}
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
const p = et(
|
|
928
|
+
const h = t.querySelectorAll('path[stroke="transparent"]');
|
|
929
|
+
h.length > 0 && h[0].setAttribute("d", f);
|
|
930
|
+
const p = et(s, r, l, a);
|
|
916
931
|
if (p) {
|
|
917
932
|
const u = `M ${p.x1} ${p.y1} L ${l} ${a} L ${p.x2} ${p.y2}`;
|
|
918
|
-
if (t.arrow1.setAttribute("d", u),
|
|
919
|
-
const
|
|
920
|
-
|
|
933
|
+
if (t.arrow1.setAttribute("d", u), h.length > 1 && h[1].setAttribute("d", u), d.style) {
|
|
934
|
+
const g = d.style;
|
|
935
|
+
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));
|
|
921
936
|
}
|
|
922
937
|
}
|
|
923
938
|
if (d.bidirectional) {
|
|
924
|
-
const u = et(o,
|
|
939
|
+
const u = et(o, i, e, n);
|
|
925
940
|
if (u) {
|
|
926
|
-
const
|
|
927
|
-
if (t.arrow2.setAttribute("d",
|
|
941
|
+
const g = `M ${u.x1} ${u.y1} L ${e} ${n} L ${u.x2} ${u.y2}`;
|
|
942
|
+
if (t.arrow2.setAttribute("d", g), h.length > 2 && h[2].setAttribute("d", g), d.style) {
|
|
928
943
|
const w = d.style;
|
|
929
944
|
w.stroke && t.arrow2.setAttribute("stroke", w.stroke), w.strokeWidth && t.arrow2.setAttribute("stroke-width", String(w.strokeWidth)), w.strokeLinecap && t.arrow2.setAttribute("stroke-linecap", w.strokeLinecap), w.opacity !== void 0 && t.arrow2.setAttribute("opacity", String(w.opacity));
|
|
930
945
|
}
|
|
931
946
|
}
|
|
932
947
|
}
|
|
933
|
-
const { x: v, y } =
|
|
948
|
+
const { x: v, y } = Bt(e, n, o, i, s, r, l, a);
|
|
934
949
|
if (t.labelEl && je(t.labelEl, v, y), d.style?.labelColor) {
|
|
935
950
|
const u = t.labelEl;
|
|
936
951
|
u && (u.style.color = d.style.labelColor);
|
|
@@ -938,14 +953,14 @@ function Et(t, e, n, o, s, i, r, l, a, d) {
|
|
|
938
953
|
tn(t);
|
|
939
954
|
}
|
|
940
955
|
function ot(t, e, n) {
|
|
941
|
-
const { offsetLeft: o, offsetTop:
|
|
956
|
+
const { offsetLeft: o, offsetTop: i } = B(t.nodes, e), s = e.offsetWidth, r = e.offsetHeight, l = o + s / 2, a = i + r / 2, d = l + n.x, f = a + n.y;
|
|
942
957
|
return {
|
|
943
|
-
w:
|
|
958
|
+
w: s,
|
|
944
959
|
h: r,
|
|
945
960
|
cx: l,
|
|
946
961
|
cy: a,
|
|
947
962
|
ctrlX: d,
|
|
948
|
-
ctrlY:
|
|
963
|
+
ctrlY: f
|
|
949
964
|
};
|
|
950
965
|
}
|
|
951
966
|
function V(t) {
|
|
@@ -956,19 +971,19 @@ function V(t) {
|
|
|
956
971
|
y: n
|
|
957
972
|
};
|
|
958
973
|
}
|
|
959
|
-
const mt = function(t, e, n, o,
|
|
974
|
+
const mt = function(t, e, n, o, i) {
|
|
960
975
|
if (!e || !n)
|
|
961
976
|
return;
|
|
962
|
-
const
|
|
977
|
+
const s = ot(t, e, o.delta1), r = ot(t, n, o.delta2), { x: l, y: a } = V(s), { ctrlX: d, ctrlY: f } = s, { ctrlX: h, ctrlY: p } = r, { x: v, y } = V(r), u = et(h, p, v, y);
|
|
963
978
|
if (!u) return;
|
|
964
|
-
const
|
|
979
|
+
const g = `M ${u.x1} ${u.y1} L ${v} ${y} L ${u.x2} ${u.y2}`;
|
|
965
980
|
let w = "";
|
|
966
981
|
if (o.bidirectional) {
|
|
967
|
-
const N = et(d,
|
|
982
|
+
const N = et(d, f, l, a);
|
|
968
983
|
if (!N) return;
|
|
969
984
|
w = `M ${N.x1} ${N.y1} L ${l} ${a} L ${N.x2} ${N.y2}`;
|
|
970
985
|
}
|
|
971
|
-
const b =
|
|
986
|
+
const b = ie(`M ${l} ${a} C ${d} ${f} ${h} ${p} ${v} ${y}`, g, w, o.style), { x: C, y: S } = Bt(l, a, d, f, h, p, v, y), T = o.style?.labelColor || "rgb(235, 95, 82)", D = "arrow-" + o.id;
|
|
972
987
|
b.id = D;
|
|
973
988
|
const L = t.markdown ? t.markdown(o.label, o) : o.label, M = ht(L, C, S, {
|
|
974
989
|
anchor: "middle",
|
|
@@ -976,7 +991,7 @@ const mt = function(t, e, n, o, s) {
|
|
|
976
991
|
dataType: "arrow",
|
|
977
992
|
svgId: D
|
|
978
993
|
});
|
|
979
|
-
b.labelEl = M, b.arrowObj = o, b.dataset.linkid = o.id, t.labelContainer.appendChild(M), t.linkSvgGroup.appendChild(b),
|
|
994
|
+
b.labelEl = M, b.arrowObj = o, b.dataset.linkid = o.id, t.labelContainer.appendChild(M), t.linkSvgGroup.appendChild(b), st(M), i || (t.arrows.push(o), t.currentArrow = b, Ot(t, o, s, r));
|
|
980
995
|
}, qe = function(t, e, n = {}) {
|
|
981
996
|
const o = {
|
|
982
997
|
id: _(),
|
|
@@ -1017,8 +1032,8 @@ const mt = function(t, e, n, o, s) {
|
|
|
1017
1032
|
});
|
|
1018
1033
|
}, Ke = function(t) {
|
|
1019
1034
|
this.currentArrow = t;
|
|
1020
|
-
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to),
|
|
1021
|
-
|
|
1035
|
+
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), i = ot(this, n, e.delta1), s = ot(this, o, e.delta2);
|
|
1036
|
+
Ot(this, e, i, s);
|
|
1022
1037
|
}, Je = function() {
|
|
1023
1038
|
rt(this), this.currentArrow = null;
|
|
1024
1039
|
}, at = function(t, e) {
|
|
@@ -1036,10 +1051,10 @@ const mt = function(t, e, n, o, s) {
|
|
|
1036
1051
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
1037
1052
|
const o = at(t.line.getAttribute("d"), e);
|
|
1038
1053
|
n.appendChild(o);
|
|
1039
|
-
const
|
|
1040
|
-
if (n.appendChild(
|
|
1041
|
-
const
|
|
1042
|
-
n.appendChild(
|
|
1054
|
+
const i = at(t.arrow1.getAttribute("d"), e);
|
|
1055
|
+
if (n.appendChild(i), t.arrow2.getAttribute("d")) {
|
|
1056
|
+
const s = at(t.arrow2.getAttribute("d"), e);
|
|
1057
|
+
n.appendChild(s);
|
|
1043
1058
|
}
|
|
1044
1059
|
t.insertBefore(n, t.firstChild);
|
|
1045
1060
|
}, Ze = function(t) {
|
|
@@ -1052,19 +1067,19 @@ const mt = function(t, e, n, o, s) {
|
|
|
1052
1067
|
n.length >= 1 && n[0].setAttribute("d", t.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", t.arrow1.getAttribute("d")), n.length >= 3 && t.arrow2.getAttribute("d") && n[2].setAttribute("d", t.arrow2.getAttribute("d"));
|
|
1053
1068
|
}, rt = function(t) {
|
|
1054
1069
|
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && Ze(t.currentArrow);
|
|
1055
|
-
},
|
|
1056
|
-
const { linkController:
|
|
1057
|
-
if (!
|
|
1058
|
-
|
|
1059
|
-
let { x: v, y } = V(n), { ctrlX: u, ctrlY:
|
|
1060
|
-
|
|
1061
|
-
u = u + T / t.scaleVal,
|
|
1062
|
-
const L = V({ ...n, ctrlX: u, ctrlY:
|
|
1063
|
-
v = L.x, y = L.y,
|
|
1064
|
-
}), t.helper2.init(
|
|
1070
|
+
}, Ot = function(t, e, n, o) {
|
|
1071
|
+
const { linkController: i, P2: s, P3: r, line1: l, line2: a, nodes: d, map: f, currentArrow: h, bus: p } = t;
|
|
1072
|
+
if (!h) return;
|
|
1073
|
+
i.style.display = "initial", s.style.display = "initial", r.style.display = "initial", d.appendChild(i), d.appendChild(s), d.appendChild(r), Qe(h, Fe);
|
|
1074
|
+
let { x: v, y } = V(n), { ctrlX: u, ctrlY: g } = n, { ctrlX: w, ctrlY: b } = o, { x: C, y: S } = V(o);
|
|
1075
|
+
s.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${b}px;left:${w}px;`, J(l, v, y, u, g), J(a, w, b, C, S), t.helper1 = Ct.create(s), t.helper2 = Ct.create(r), t.helper1.init(f, (T, D) => {
|
|
1076
|
+
u = u + T / t.scaleVal, g = g + D / t.scaleVal;
|
|
1077
|
+
const L = V({ ...n, ctrlX: u, ctrlY: g });
|
|
1078
|
+
v = L.x, y = L.y, s.style.top = g + "px", s.style.left = u + "px", Et(h, v, y, u, g, w, b, C, S, e), J(l, v, y, u, g), e.delta1.x = u - n.cx, e.delta1.y = g - n.cy, p.fire("updateArrowDelta", e);
|
|
1079
|
+
}), t.helper2.init(f, (T, D) => {
|
|
1065
1080
|
w = w + T / t.scaleVal, b = b + D / t.scaleVal;
|
|
1066
1081
|
const L = V({ ...o, ctrlX: w, ctrlY: b });
|
|
1067
|
-
C = L.x, S = L.y, r.style.top = b + "px", r.style.left = w + "px", Et(
|
|
1082
|
+
C = L.x, S = L.y, r.style.top = b + "px", r.style.left = w + "px", Et(h, v, y, u, g, w, b, C, S, e), J(a, w, b, C, S), e.delta2.x = w - o.cx, e.delta2.y = b - o.cy, p.fire("updateArrowDelta", e);
|
|
1068
1083
|
});
|
|
1069
1084
|
};
|
|
1070
1085
|
function en() {
|
|
@@ -1099,22 +1114,22 @@ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1099
1114
|
if (t.length === 1) {
|
|
1100
1115
|
const a = t[0].nodeObj, d = t[0].nodeObj.parent;
|
|
1101
1116
|
if (!d) throw new Error("Can not select root node.");
|
|
1102
|
-
const
|
|
1117
|
+
const f = d.children.findIndex((h) => a === h);
|
|
1103
1118
|
return {
|
|
1104
1119
|
parent: d.id,
|
|
1105
|
-
start:
|
|
1106
|
-
end:
|
|
1120
|
+
start: f,
|
|
1121
|
+
end: f
|
|
1107
1122
|
};
|
|
1108
1123
|
}
|
|
1109
1124
|
let e = 0;
|
|
1110
1125
|
const n = t.map((a) => {
|
|
1111
1126
|
let d = a.nodeObj;
|
|
1112
|
-
const
|
|
1127
|
+
const f = [];
|
|
1113
1128
|
for (; d.parent; ) {
|
|
1114
|
-
const
|
|
1115
|
-
d =
|
|
1129
|
+
const h = d.parent, v = h.children?.indexOf(d);
|
|
1130
|
+
d = h, f.unshift({ node: d, index: v });
|
|
1116
1131
|
}
|
|
1117
|
-
return
|
|
1132
|
+
return f.length > e && (e = f.length), f;
|
|
1118
1133
|
});
|
|
1119
1134
|
let o = 0;
|
|
1120
1135
|
t: for (; o < e; o++) {
|
|
@@ -1124,11 +1139,11 @@ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1124
1139
|
break t;
|
|
1125
1140
|
}
|
|
1126
1141
|
if (!o) throw new Error("Can not select root node.");
|
|
1127
|
-
const
|
|
1142
|
+
const i = n.map((a) => a[o - 1].index).sort(), s = i[0] || 0, r = i[i.length - 1] || 0, l = n[0][o - 1].node;
|
|
1128
1143
|
if (!l.parent) throw new Error("Please select nodes in the same main topic.");
|
|
1129
1144
|
return {
|
|
1130
1145
|
parent: l.id,
|
|
1131
|
-
start:
|
|
1146
|
+
start: s,
|
|
1132
1147
|
end: r
|
|
1133
1148
|
};
|
|
1134
1149
|
}, ln = function(t) {
|
|
@@ -1144,27 +1159,27 @@ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1144
1159
|
"stroke-width": "2"
|
|
1145
1160
|
}), n;
|
|
1146
1161
|
}, cn = (t) => t.parentElement.parentElement, an = function(t, { parent: e, start: n }) {
|
|
1147
|
-
const o = t.findEle(e),
|
|
1148
|
-
let
|
|
1149
|
-
return
|
|
1162
|
+
const o = t.findEle(e), i = o.nodeObj;
|
|
1163
|
+
let s;
|
|
1164
|
+
return i.parent ? s = o.closest("me-main").className : s = t.findEle(i.children[n].id).closest("me-main").className, s;
|
|
1150
1165
|
}, yt = function(t, e) {
|
|
1151
|
-
const { id: n, label: o, parent:
|
|
1152
|
-
let y = 1 / 0, u = 0,
|
|
1153
|
-
for (let c =
|
|
1154
|
-
const
|
|
1155
|
-
if (!
|
|
1166
|
+
const { id: n, label: o, parent: i, start: s, end: r, style: l } = e, { nodes: a, theme: d, summarySvg: f } = t, p = t.findEle(i).nodeObj, v = an(t, e);
|
|
1167
|
+
let y = 1 / 0, u = 0, g = 0, w = 0;
|
|
1168
|
+
for (let c = s; c <= r; c++) {
|
|
1169
|
+
const m = p.children?.[c];
|
|
1170
|
+
if (!m)
|
|
1156
1171
|
return t.removeSummary(n), null;
|
|
1157
|
-
const x = cn(t.findEle(
|
|
1158
|
-
c ===
|
|
1172
|
+
const x = cn(t.findEle(m.id)), { offsetLeft: H, offsetTop: Y } = B(a, x), $ = s === r ? 10 : 20;
|
|
1173
|
+
c === s && (g = Y + $), c === r && (w = Y + x.offsetHeight - $), H < y && (y = H), x.offsetWidth + H > u && (u = x.offsetWidth + H);
|
|
1159
1174
|
}
|
|
1160
1175
|
let b, C;
|
|
1161
|
-
const S = p.parent ? 10 : 0, T =
|
|
1162
|
-
v === F.LHS ? (b = St(`M ${y + 10} ${T} c -5 0 -10 5 -10 10 L ${y} ${D - 10} c 0 5 5 10 10 10 M ${y} ${L} h -10`, M), C = ht(E, y - 20, L, { anchor: "end", color: N, dataType: "summary", svgId:
|
|
1163
|
-
const
|
|
1164
|
-
return
|
|
1176
|
+
const S = p.parent ? 10 : 0, T = g + S, D = w + S, L = (T + D) / 2, M = l?.stroke || d.cssVar["--color"], N = l?.labelColor || d.cssVar["--color"], R = "s-" + n, E = t.markdown ? t.markdown(o, e) : o;
|
|
1177
|
+
v === F.LHS ? (b = St(`M ${y + 10} ${T} c -5 0 -10 5 -10 10 L ${y} ${D - 10} c 0 5 5 10 10 10 M ${y} ${L} h -10`, M), C = ht(E, y - 20, L, { anchor: "end", color: N, dataType: "summary", svgId: R })) : (b = St(`M ${u - 10} ${T} c 5 0 10 5 10 10 L ${u} ${D - 10} c 0 5 -5 10 -10 10 M ${u} ${L} h 10`, M), C = ht(E, u + 20, L, { anchor: "start", color: N, dataType: "summary", svgId: R }));
|
|
1178
|
+
const G = ln(R);
|
|
1179
|
+
return G.appendChild(b), t.labelContainer.appendChild(C), st(C), G.summaryObj = e, G.labelEl = C, f.appendChild(G), G;
|
|
1165
1180
|
}, dn = function(t = {}) {
|
|
1166
1181
|
if (!this.currentNodes) return;
|
|
1167
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent:
|
|
1182
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: i, start: s, end: r } = rn(e), l = { id: _(), parent: i, start: s, end: r, label: "summary", style: t.style }, a = yt(this, l);
|
|
1168
1183
|
n.push(l), this.editSummary(a), o.fire("operation", {
|
|
1169
1184
|
name: "createSummary",
|
|
1170
1185
|
obj: l
|
|
@@ -1218,9 +1233,9 @@ function wn(t, e) {
|
|
|
1218
1233
|
return (parseInt(t) - parseInt(e)) / 2;
|
|
1219
1234
|
}
|
|
1220
1235
|
function bn(t, e, n, o) {
|
|
1221
|
-
const
|
|
1222
|
-
let
|
|
1223
|
-
return t.text ?
|
|
1236
|
+
const i = document.createElementNS(A, "g");
|
|
1237
|
+
let s = "";
|
|
1238
|
+
return t.text ? s = t.text.textContent : s = t.childNodes[0].textContent, s.split(`
|
|
1224
1239
|
`).forEach((l, a) => {
|
|
1225
1240
|
const d = document.createElementNS(A, "text");
|
|
1226
1241
|
k(d, {
|
|
@@ -1231,14 +1246,14 @@ function bn(t, e, n, o) {
|
|
|
1231
1246
|
"font-size": `${e.fontSize}`,
|
|
1232
1247
|
"font-weight": `${e.fontWeight}`,
|
|
1233
1248
|
fill: `${e.color}`
|
|
1234
|
-
}), d.innerHTML = l,
|
|
1235
|
-
}),
|
|
1249
|
+
}), d.innerHTML = l, i.appendChild(d);
|
|
1250
|
+
}), i;
|
|
1236
1251
|
}
|
|
1237
1252
|
function xn(t, e, n, o) {
|
|
1238
|
-
let
|
|
1239
|
-
t.nodeObj?.dangerouslySetInnerHTML ?
|
|
1240
|
-
const
|
|
1241
|
-
k(
|
|
1253
|
+
let i = "";
|
|
1254
|
+
t.nodeObj?.dangerouslySetInnerHTML ? i = t.nodeObj.dangerouslySetInnerHTML : t.text ? i = t.text.textContent : i = t.childNodes[0].textContent;
|
|
1255
|
+
const s = document.createElementNS(A, "foreignObject");
|
|
1256
|
+
k(s, {
|
|
1242
1257
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1243
1258
|
y: o + parseInt(e.paddingTop) + "",
|
|
1244
1259
|
width: e.width,
|
|
@@ -1248,13 +1263,13 @@ function xn(t, e, n, o) {
|
|
|
1248
1263
|
return k(r, {
|
|
1249
1264
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
1250
1265
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1251
|
-
}), r.innerHTML =
|
|
1266
|
+
}), r.innerHTML = i, s.appendChild(r), s;
|
|
1252
1267
|
}
|
|
1253
1268
|
function Cn(t, e) {
|
|
1254
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop:
|
|
1255
|
-
return k(
|
|
1269
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: i } = B(t.nodes, e), s = document.createElementNS(A, "rect");
|
|
1270
|
+
return k(s, {
|
|
1256
1271
|
x: o + "",
|
|
1257
|
-
y:
|
|
1272
|
+
y: i + "",
|
|
1258
1273
|
rx: n.borderRadius,
|
|
1259
1274
|
ry: n.borderRadius,
|
|
1260
1275
|
width: n.width,
|
|
@@ -1262,13 +1277,13 @@ function Cn(t, e) {
|
|
|
1262
1277
|
fill: n.backgroundColor,
|
|
1263
1278
|
stroke: n.borderColor,
|
|
1264
1279
|
"stroke-width": n.borderWidth
|
|
1265
|
-
}),
|
|
1280
|
+
}), s;
|
|
1266
1281
|
}
|
|
1267
1282
|
function Q(t, e, n = !1) {
|
|
1268
|
-
const o = getComputedStyle(e), { offsetLeft:
|
|
1283
|
+
const o = getComputedStyle(e), { offsetLeft: i, offsetTop: s } = B(t.nodes, e), r = document.createElementNS(A, "rect");
|
|
1269
1284
|
k(r, {
|
|
1270
|
-
x:
|
|
1271
|
-
y:
|
|
1285
|
+
x: i + "",
|
|
1286
|
+
y: s + "",
|
|
1272
1287
|
rx: o.borderRadius,
|
|
1273
1288
|
ry: o.borderRadius,
|
|
1274
1289
|
width: o.width,
|
|
@@ -1280,70 +1295,70 @@ function Q(t, e, n = !1) {
|
|
|
1280
1295
|
const l = document.createElementNS(A, "g");
|
|
1281
1296
|
l.appendChild(r);
|
|
1282
1297
|
let a;
|
|
1283
|
-
return n ? a = xn(e, o,
|
|
1298
|
+
return n ? a = xn(e, o, i, s) : a = bn(e, o, i, s), l.appendChild(a), l;
|
|
1284
1299
|
}
|
|
1285
1300
|
function En(t, e) {
|
|
1286
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop:
|
|
1301
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: i } = B(t.nodes, e), s = document.createElementNS(A, "a"), r = document.createElementNS(A, "text");
|
|
1287
1302
|
return k(r, {
|
|
1288
1303
|
x: o + "",
|
|
1289
|
-
y:
|
|
1304
|
+
y: i + parseInt(n.fontSize) + "",
|
|
1290
1305
|
"text-anchor": "start",
|
|
1291
1306
|
"font-family": n.fontFamily,
|
|
1292
1307
|
"font-size": `${n.fontSize}`,
|
|
1293
1308
|
"font-weight": `${n.fontWeight}`,
|
|
1294
1309
|
fill: `${n.color}`
|
|
1295
|
-
}), r.innerHTML = e.textContent,
|
|
1310
|
+
}), r.innerHTML = e.textContent, s.appendChild(r), s.setAttribute("href", e.href), s;
|
|
1296
1311
|
}
|
|
1297
1312
|
function Sn(t, e) {
|
|
1298
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop:
|
|
1299
|
-
return k(
|
|
1313
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: i } = B(t.nodes, e), s = document.createElementNS(A, "image");
|
|
1314
|
+
return k(s, {
|
|
1300
1315
|
x: o + "",
|
|
1301
|
-
y:
|
|
1316
|
+
y: i + "",
|
|
1302
1317
|
width: n.width + "",
|
|
1303
1318
|
height: n.height + "",
|
|
1304
1319
|
href: e.src
|
|
1305
|
-
}),
|
|
1320
|
+
}), s;
|
|
1306
1321
|
}
|
|
1307
1322
|
const Z = 100, Tn = '<?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">', Ln = (t, e = !1) => {
|
|
1308
|
-
const n = t.nodes, o = n.offsetHeight + Z * 2,
|
|
1323
|
+
const n = t.nodes, o = n.offsetHeight + Z * 2, i = n.offsetWidth + Z * 2, s = vn(o + "px", i + "px"), r = document.createElementNS(A, "svg"), l = document.createElementNS(A, "rect");
|
|
1309
1324
|
k(l, {
|
|
1310
1325
|
x: "0",
|
|
1311
1326
|
y: "0",
|
|
1312
|
-
width: `${
|
|
1327
|
+
width: `${i}`,
|
|
1313
1328
|
height: `${o}`,
|
|
1314
1329
|
fill: t.theme.cssVar["--bgcolor"]
|
|
1315
|
-
}),
|
|
1316
|
-
const p =
|
|
1330
|
+
}), s.appendChild(l), n.querySelectorAll(".subLines").forEach((h) => {
|
|
1331
|
+
const p = h.cloneNode(!0), { offsetLeft: v, offsetTop: y } = B(n, h.parentElement);
|
|
1317
1332
|
p.setAttribute("x", `${v}`), p.setAttribute("y", `${y}`), r.appendChild(p);
|
|
1318
1333
|
});
|
|
1319
1334
|
const a = n.querySelector(".lines")?.cloneNode(!0);
|
|
1320
1335
|
a && r.appendChild(a);
|
|
1321
1336
|
const d = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
1322
1337
|
d && r.appendChild(d);
|
|
1323
|
-
const
|
|
1324
|
-
return
|
|
1325
|
-
|
|
1326
|
-
}), n.querySelectorAll(".tags > span").forEach((
|
|
1327
|
-
r.appendChild(Q(t,
|
|
1328
|
-
}), n.querySelectorAll(".icons > span").forEach((
|
|
1329
|
-
r.appendChild(Q(t,
|
|
1330
|
-
}), n.querySelectorAll(".hyper-link").forEach((
|
|
1331
|
-
r.appendChild(En(t,
|
|
1332
|
-
}), n.querySelectorAll("img").forEach((
|
|
1333
|
-
r.appendChild(Sn(t,
|
|
1338
|
+
const f = n.querySelector(".summary")?.cloneNode(!0);
|
|
1339
|
+
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((h) => {
|
|
1340
|
+
h.nodeObj.dangerouslySetInnerHTML ? r.appendChild(Q(t, h, !e)) : (r.appendChild(Cn(t, h)), r.appendChild(Q(t, h.text, !e)));
|
|
1341
|
+
}), n.querySelectorAll(".tags > span").forEach((h) => {
|
|
1342
|
+
r.appendChild(Q(t, h));
|
|
1343
|
+
}), n.querySelectorAll(".icons > span").forEach((h) => {
|
|
1344
|
+
r.appendChild(Q(t, h));
|
|
1345
|
+
}), n.querySelectorAll(".hyper-link").forEach((h) => {
|
|
1346
|
+
r.appendChild(En(t, h));
|
|
1347
|
+
}), n.querySelectorAll("img").forEach((h) => {
|
|
1348
|
+
r.appendChild(Sn(t, h));
|
|
1334
1349
|
}), k(r, {
|
|
1335
1350
|
x: Z + "",
|
|
1336
1351
|
y: Z + "",
|
|
1337
1352
|
overflow: "visible"
|
|
1338
|
-
}),
|
|
1353
|
+
}), s.appendChild(r), s;
|
|
1339
1354
|
}, kn = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), Tn + t.outerHTML);
|
|
1340
1355
|
function Dn(t) {
|
|
1341
1356
|
return new Promise((e, n) => {
|
|
1342
1357
|
const o = new FileReader();
|
|
1343
|
-
o.onload = (
|
|
1344
|
-
e(
|
|
1345
|
-
}, o.onerror = (
|
|
1346
|
-
n(
|
|
1358
|
+
o.onload = (i) => {
|
|
1359
|
+
e(i.target.result);
|
|
1360
|
+
}, o.onerror = (i) => {
|
|
1361
|
+
n(i);
|
|
1347
1362
|
}, o.readAsDataURL(t);
|
|
1348
1363
|
});
|
|
1349
1364
|
}
|
|
@@ -1352,12 +1367,12 @@ const Mn = function(t = !1, e) {
|
|
|
1352
1367
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1353
1368
|
}, $n = async function(t = !1, e) {
|
|
1354
1369
|
const n = this.exportSvg(t, e), o = await Dn(n);
|
|
1355
|
-
return new Promise((
|
|
1370
|
+
return new Promise((i, s) => {
|
|
1356
1371
|
const r = new Image();
|
|
1357
1372
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
1358
1373
|
const l = document.createElement("canvas");
|
|
1359
|
-
l.width = r.width, l.height = r.height, l.getContext("2d").drawImage(r, 0, 0), l.toBlob(
|
|
1360
|
-
}, r.src = o, r.onerror =
|
|
1374
|
+
l.width = r.width, l.height = r.height, l.getContext("2d").drawImage(r, 0, 0), l.toBlob(i, "image/png", 1);
|
|
1375
|
+
}, r.src = o, r.onerror = s;
|
|
1361
1376
|
});
|
|
1362
1377
|
}, Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1363
1378
|
__proto__: null,
|
|
@@ -1365,9 +1380,9 @@ const Mn = function(t = !1, e) {
|
|
|
1365
1380
|
exportSvg: Mn
|
|
1366
1381
|
}, Symbol.toStringTag, { value: "Module" })), Pn = {}, An = {
|
|
1367
1382
|
getObjById: tt,
|
|
1368
|
-
generateNewObj:
|
|
1383
|
+
generateNewObj: Rt,
|
|
1369
1384
|
layout: Ut,
|
|
1370
|
-
linkDiv:
|
|
1385
|
+
linkDiv: se,
|
|
1371
1386
|
editTopic: ne,
|
|
1372
1387
|
createWrapper: Qt,
|
|
1373
1388
|
createParent: Zt,
|
|
@@ -1388,25 +1403,25 @@ const Mn = function(t = !1, e) {
|
|
|
1388
1403
|
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, this.selection?.destroy(), this.selection = void 0;
|
|
1389
1404
|
}
|
|
1390
1405
|
};
|
|
1391
|
-
function Hn({ pT: t, pL: e, pW: n, pH: o, cT:
|
|
1392
|
-
let
|
|
1393
|
-
const
|
|
1406
|
+
function Hn({ pT: t, pL: e, pW: n, pH: o, cT: i, cL: s, cW: r, cH: l, direction: a, containerHeight: d }) {
|
|
1407
|
+
let f = e + n / 2;
|
|
1408
|
+
const h = t + o / 2;
|
|
1394
1409
|
let p;
|
|
1395
|
-
a === F.LHS ? p =
|
|
1396
|
-
const v =
|
|
1397
|
-
return a === F.LHS ?
|
|
1410
|
+
a === F.LHS ? p = s + r : p = s;
|
|
1411
|
+
const v = i + l / 2, u = (1 - Math.abs(v - h) / d) * 0.25 * (n / 2);
|
|
1412
|
+
return a === F.LHS ? f = f - n / 10 - u : f = f + n / 10 + u, `M ${f} ${h} Q ${f} ${v} ${p} ${v}`;
|
|
1398
1413
|
}
|
|
1399
|
-
function In({ pT: t, pL: e, pW: n, pH: o, cT:
|
|
1400
|
-
const
|
|
1401
|
-
let
|
|
1402
|
-
d ?
|
|
1403
|
-
const v =
|
|
1404
|
-
let y = 0, u = 0,
|
|
1405
|
-
const w = Math.abs(
|
|
1406
|
-
return a === F.LHS ? (
|
|
1414
|
+
function In({ pT: t, pL: e, pW: n, pH: o, cT: i, cL: s, cW: r, cH: l, direction: a, isFirst: d }) {
|
|
1415
|
+
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
1416
|
+
let h = 0, p = 0;
|
|
1417
|
+
d ? h = t + o / 2 : h = t + o;
|
|
1418
|
+
const v = i + l;
|
|
1419
|
+
let y = 0, u = 0, g = 0;
|
|
1420
|
+
const w = Math.abs(h - v) / 300 * f;
|
|
1421
|
+
return a === F.LHS ? (g = e, y = g + f, u = g - f, p = s + f, `M ${y} ${h} C ${g} ${h} ${g + w} ${v} ${u} ${v} H ${p}`) : (g = e + n, y = g - f, u = g + f, p = s + r - f, `M ${y} ${h} C ${g} ${h} ${g - w} ${v} ${u} ${v} H ${p}`);
|
|
1407
1422
|
}
|
|
1408
|
-
const
|
|
1409
|
-
function
|
|
1423
|
+
const Bn = "5.5.0";
|
|
1424
|
+
function On(t) {
|
|
1410
1425
|
return {
|
|
1411
1426
|
x: 0,
|
|
1412
1427
|
y: 0,
|
|
@@ -1422,24 +1437,24 @@ function Bn(t) {
|
|
|
1422
1437
|
};
|
|
1423
1438
|
}
|
|
1424
1439
|
const z = document;
|
|
1425
|
-
function
|
|
1440
|
+
function O({
|
|
1426
1441
|
el: t,
|
|
1427
1442
|
direction: e,
|
|
1428
1443
|
locale: n,
|
|
1429
1444
|
draggable: o,
|
|
1430
|
-
editable:
|
|
1431
|
-
contextMenu:
|
|
1445
|
+
editable: i,
|
|
1446
|
+
contextMenu: s,
|
|
1432
1447
|
toolBar: r,
|
|
1433
1448
|
keypress: l,
|
|
1434
1449
|
mouseSelectionButton: a,
|
|
1435
1450
|
selectionContainer: d,
|
|
1436
|
-
before:
|
|
1437
|
-
newTopicName:
|
|
1451
|
+
before: f,
|
|
1452
|
+
newTopicName: h,
|
|
1438
1453
|
allowUndo: p,
|
|
1439
1454
|
generateMainBranch: v,
|
|
1440
1455
|
generateSubBranch: y,
|
|
1441
1456
|
overflowHidden: u,
|
|
1442
|
-
theme:
|
|
1457
|
+
theme: g,
|
|
1443
1458
|
alignment: w,
|
|
1444
1459
|
scaleSensitivity: b,
|
|
1445
1460
|
scaleMax: C,
|
|
@@ -1451,26 +1466,26 @@ function B({
|
|
|
1451
1466
|
let M = null;
|
|
1452
1467
|
const N = Object.prototype.toString.call(t);
|
|
1453
1468
|
if (N === "[object HTMLDivElement]" ? M = t : N === "[object String]" && (M = document.querySelector(t)), !M) throw new Error("MindElixir: el is not a valid element");
|
|
1454
|
-
M.style.position = "relative", M.innerHTML = "", this.el = M, this.disposable = [], this.before =
|
|
1455
|
-
const
|
|
1456
|
-
this.theme =
|
|
1469
|
+
M.style.position = "relative", M.innerHTML = "", this.el = M, 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 = a ?? 0, this.direction = e ?? 1, this.draggable = o ?? !0, this.editable = i ?? !0, this.allowUndo = p ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = C ?? 1.4, this.scaleMin = S ?? 0.2, this.generateMainBranch = v || Hn, this.generateSubBranch = y || In, this.overflowHidden = u ?? !1, this.alignment = w ?? "root", this.handleWheel = T ?? !0, this.markdown = D || void 0, this.imageProxy = L || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = On(this), this.bus = _t(), this.container = z.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
|
|
1470
|
+
const R = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1471
|
+
this.theme = g || (R.matches ? ut : ft);
|
|
1457
1472
|
const E = z.createElement("div");
|
|
1458
1473
|
E.className = "map-canvas", this.map = E, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = z.createElement("me-nodes"), this.lines = q("lines"), this.summarySvg = q("summary"), this.linkController = q("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 = xt(), this.line2 = xt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = q("topiclinks"), this.labelContainer = z.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(qt(this));
|
|
1459
1474
|
}
|
|
1460
|
-
|
|
1461
|
-
Object.defineProperty(
|
|
1475
|
+
O.prototype = An;
|
|
1476
|
+
Object.defineProperty(O.prototype, "currentNode", {
|
|
1462
1477
|
get() {
|
|
1463
1478
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
1464
1479
|
},
|
|
1465
1480
|
enumerable: !0
|
|
1466
1481
|
});
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1482
|
+
O.LEFT = 0;
|
|
1483
|
+
O.RIGHT = 1;
|
|
1484
|
+
O.SIDE = 2;
|
|
1485
|
+
O.THEME = ft;
|
|
1486
|
+
O.DARK_THEME = ut;
|
|
1487
|
+
O.version = Bn;
|
|
1488
|
+
O.E = $t;
|
|
1474
1489
|
export {
|
|
1475
|
-
|
|
1490
|
+
O as default
|
|
1476
1491
|
};
|