mind-elixir 5.3.2 → 5.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.css +1 -1
- package/dist/MindElixir.iife.js +5 -4
- package/dist/MindElixir.js +663 -659
- package/dist/MindElixirLite.css +1 -1
- package/dist/MindElixirLite.iife.js +5 -4
- package/dist/MindElixirLite.js +384 -380
- package/dist/types/types/index.d.ts +2 -2
- package/package.json +1 -1
- package/readme.md +5 -0
package/dist/MindElixirLite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const nt = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -24,7 +24,7 @@ const et = {
|
|
|
24
24
|
"--panel-border-color": "#eaeaea",
|
|
25
25
|
"--map-padding": "50px"
|
|
26
26
|
}
|
|
27
|
-
},
|
|
27
|
+
}, ot = {
|
|
28
28
|
name: "Dark",
|
|
29
29
|
type: "dark",
|
|
30
30
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -51,30 +51,30 @@ const et = {
|
|
|
51
51
|
"--map-padding": "50px 80px"
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
function
|
|
54
|
+
function $t(t) {
|
|
55
55
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const _ = function(t, e) {
|
|
58
58
|
if (e.id === t)
|
|
59
59
|
return e;
|
|
60
60
|
if (e.children && e.children.length) {
|
|
61
61
|
for (let n = 0; n < e.children.length; n++) {
|
|
62
|
-
const o =
|
|
62
|
+
const o = _(t, e.children[n]);
|
|
63
63
|
if (o) return o;
|
|
64
64
|
}
|
|
65
65
|
return null;
|
|
66
66
|
} else
|
|
67
67
|
return null;
|
|
68
|
-
},
|
|
68
|
+
}, st = (t, e) => {
|
|
69
69
|
if (t.parent = e, t.children)
|
|
70
70
|
for (let n = 0; n < t.children.length; n++)
|
|
71
|
-
|
|
72
|
-
},
|
|
71
|
+
st(t.children[n], t);
|
|
72
|
+
}, mt = (t, e, n) => {
|
|
73
73
|
t.expanded = e, t.children && t.children.forEach((o) => {
|
|
74
|
-
|
|
74
|
+
mt(o, e);
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
|
-
function
|
|
77
|
+
function U(t, e, n, o) {
|
|
78
78
|
const s = o - e, i = t - n;
|
|
79
79
|
let r = Math.atan(Math.abs(s) / Math.abs(i)) / 3.14 * 180;
|
|
80
80
|
if (isNaN(r)) return;
|
|
@@ -87,16 +87,16 @@ function _(t, e, n, o) {
|
|
|
87
87
|
y2: o - Math.sin(Math.PI * f / 180) * c
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function z() {
|
|
91
91
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
const t =
|
|
93
|
+
const Dt = function() {
|
|
94
|
+
const t = z();
|
|
95
95
|
return {
|
|
96
96
|
topic: this.newTopicName,
|
|
97
97
|
id: t
|
|
98
98
|
};
|
|
99
|
-
},
|
|
99
|
+
}, A = (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;
|
|
@@ -104,10 +104,10 @@ const $t = function() {
|
|
|
104
104
|
}, E = (t, e) => {
|
|
105
105
|
for (const n in e)
|
|
106
106
|
t.setAttribute(n, e[n]);
|
|
107
|
-
},
|
|
107
|
+
}, ht = (t) => t ? t.tagName === "ME-TPC" : !1, yt = (t) => {
|
|
108
108
|
const e = /translate\(([^,]+),\s*([^)]+)\)/, n = t.match(e);
|
|
109
109
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
110
|
-
},
|
|
110
|
+
}, wt = function(t) {
|
|
111
111
|
for (let e = 0; e < t.length; e++) {
|
|
112
112
|
const { dom: n, evt: o, func: s } = t[e];
|
|
113
113
|
n.addEventListener(o, s);
|
|
@@ -121,7 +121,7 @@ const $t = function() {
|
|
|
121
121
|
}, I = {
|
|
122
122
|
LHS: "lhs",
|
|
123
123
|
RHS: "rhs"
|
|
124
|
-
},
|
|
124
|
+
}, dt = function(t, e, n) {
|
|
125
125
|
const { scaleVal: o, scaleSensitivity: s } = t;
|
|
126
126
|
switch (e) {
|
|
127
127
|
case "in":
|
|
@@ -131,7 +131,7 @@ const $t = function() {
|
|
|
131
131
|
t.scale(o - s, n);
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
|
-
function
|
|
134
|
+
function At(t) {
|
|
135
135
|
const { dragMoveHelper: e } = t;
|
|
136
136
|
let n = 0;
|
|
137
137
|
t.spacePressed = !1;
|
|
@@ -156,14 +156,15 @@ function Dt(t) {
|
|
|
156
156
|
t.selectNode(d);
|
|
157
157
|
else if (!t.editable)
|
|
158
158
|
return;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
const y = d.closest(".svg-label");
|
|
160
|
+
if (y) {
|
|
161
|
+
const b = y.dataset.svgId, S = y.dataset.type, x = document.getElementById(b);
|
|
162
|
+
if (x) {
|
|
163
|
+
if (S === "arrow") {
|
|
164
|
+
t.selectArrow(x);
|
|
164
165
|
return;
|
|
165
|
-
} else if (
|
|
166
|
-
t.selectSummary(
|
|
166
|
+
} else if (S === "summary") {
|
|
167
|
+
t.selectSummary(x);
|
|
167
168
|
return;
|
|
168
169
|
}
|
|
169
170
|
}
|
|
@@ -185,14 +186,16 @@ function Dt(t) {
|
|
|
185
186
|
}, s = (l) => {
|
|
186
187
|
if (!t.editable) return;
|
|
187
188
|
const d = l.target;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
ht(d) && t.beginEdit(d);
|
|
190
|
+
const y = d.closest(".svg-label");
|
|
191
|
+
if (y) {
|
|
192
|
+
const b = y.dataset.svgId, S = y.dataset.type, x = document.getElementById(b);
|
|
193
|
+
if (x) {
|
|
194
|
+
if (S === "arrow") {
|
|
195
|
+
t.editArrowLabel(x);
|
|
193
196
|
return;
|
|
194
|
-
} else if (
|
|
195
|
-
t.editSummary(
|
|
197
|
+
} else if (S === "summary") {
|
|
198
|
+
t.editSummary(x);
|
|
196
199
|
return;
|
|
197
200
|
}
|
|
198
201
|
}
|
|
@@ -213,23 +216,23 @@ function Dt(t) {
|
|
|
213
216
|
}
|
|
214
217
|
}, i = (l) => {
|
|
215
218
|
if (l.pointerType === "mouse") return;
|
|
216
|
-
const d = (/* @__PURE__ */ new Date()).getTime(),
|
|
217
|
-
|
|
219
|
+
const d = (/* @__PURE__ */ new Date()).getTime(), y = d - n;
|
|
220
|
+
y < 300 && y > 0 && s(l), n = d;
|
|
218
221
|
}, r = (l) => {
|
|
219
222
|
l.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
|
|
220
223
|
}, c = (l) => {
|
|
221
224
|
l.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
|
|
222
225
|
}, a = (l) => {
|
|
223
226
|
e.moved = !1;
|
|
224
|
-
const d = t.spacePressed && l.button === 0 && l.pointerType === "mouse",
|
|
227
|
+
const d = t.spacePressed && l.button === 0 && l.pointerType === "mouse", y = t.mouseSelectionButton === 0 ? 2 : 0, v = l.button === y && l.pointerType === "mouse";
|
|
225
228
|
if (!d && !v) return;
|
|
226
229
|
e.x = l.clientX, e.y = l.clientY;
|
|
227
|
-
const
|
|
228
|
-
(d ||
|
|
230
|
+
const C = l.target;
|
|
231
|
+
(d || C.className !== "circle" && C.contentEditable !== "plaintext-only") && (e.mousedown = !0, C.setPointerCapture(l.pointerId));
|
|
229
232
|
}, h = (l) => {
|
|
230
233
|
if (l.target.contentEditable !== "plaintext-only" || t.spacePressed && e.mousedown) {
|
|
231
|
-
const d = l.clientX - e.x,
|
|
232
|
-
e.onMove(d,
|
|
234
|
+
const d = l.clientX - e.x, y = l.clientY - e.y;
|
|
235
|
+
e.onMove(d, y);
|
|
233
236
|
}
|
|
234
237
|
e.x = l.clientX, e.y = l.clientY;
|
|
235
238
|
}, f = (l) => {
|
|
@@ -241,13 +244,13 @@ function Dt(t) {
|
|
|
241
244
|
}, m = (l) => {
|
|
242
245
|
if (l.preventDefault(), l.button !== 2 || !t.editable) return;
|
|
243
246
|
const d = l.target;
|
|
244
|
-
|
|
247
|
+
ht(d) && !d.classList.contains("selected") && t.selectNode(d), setTimeout(() => {
|
|
245
248
|
t.dragMoveHelper.moved || t.bus.fire("showContextMenu", l);
|
|
246
249
|
}, 200);
|
|
247
|
-
},
|
|
248
|
-
l.stopPropagation(), l.preventDefault(), l.ctrlKey || l.metaKey ? l.deltaY < 0 ?
|
|
250
|
+
}, w = (l) => {
|
|
251
|
+
l.stopPropagation(), l.preventDefault(), l.ctrlKey || l.metaKey ? l.deltaY < 0 ? dt(t, "in", t.dragMoveHelper) : t.scaleVal - t.scaleSensitivity > 0 && dt(t, "out", t.dragMoveHelper) : l.shiftKey ? t.move(-l.deltaY, 0) : t.move(-l.deltaX, -l.deltaY);
|
|
249
252
|
}, { container: g } = t;
|
|
250
|
-
return
|
|
253
|
+
return wt([
|
|
251
254
|
{ dom: g, evt: "pointerdown", func: a },
|
|
252
255
|
{ dom: g, evt: "pointermove", func: h },
|
|
253
256
|
{ dom: g, evt: "pointerup", func: f },
|
|
@@ -255,13 +258,13 @@ function Dt(t) {
|
|
|
255
258
|
{ dom: g, evt: "click", func: o },
|
|
256
259
|
{ dom: g, evt: "dblclick", func: s },
|
|
257
260
|
{ dom: g, evt: "contextmenu", func: m },
|
|
258
|
-
{ dom: g, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel :
|
|
261
|
+
{ dom: g, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : w },
|
|
259
262
|
{ dom: g, evt: "blur", func: p },
|
|
260
263
|
{ dom: g, evt: "keydown", func: r },
|
|
261
264
|
{ dom: g, evt: "keyup", func: c }
|
|
262
265
|
]);
|
|
263
266
|
}
|
|
264
|
-
function
|
|
267
|
+
function Nt() {
|
|
265
268
|
return {
|
|
266
269
|
handlers: {},
|
|
267
270
|
addListener: function(t, e) {
|
|
@@ -285,11 +288,11 @@ function At() {
|
|
|
285
288
|
}
|
|
286
289
|
};
|
|
287
290
|
}
|
|
288
|
-
const
|
|
291
|
+
const K = document, Mt = function() {
|
|
289
292
|
this.nodes.innerHTML = "";
|
|
290
293
|
const t = this.createTopic(this.nodeData);
|
|
291
|
-
|
|
292
|
-
const e =
|
|
294
|
+
vt.call(this, t, this.nodeData), t.draggable = !1;
|
|
295
|
+
const e = K.createElement("me-root");
|
|
293
296
|
e.appendChild(t);
|
|
294
297
|
const n = this.nodeData.children || [];
|
|
295
298
|
if (this.direction === 2) {
|
|
@@ -298,29 +301,29 @@ const U = document, Nt = function() {
|
|
|
298
301
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
299
302
|
});
|
|
300
303
|
}
|
|
301
|
-
|
|
302
|
-
},
|
|
303
|
-
const o =
|
|
304
|
+
Pt(this, n, e);
|
|
305
|
+
}, Pt = function(t, e, n) {
|
|
306
|
+
const o = K.createElement("me-main");
|
|
304
307
|
o.className = I.LHS;
|
|
305
|
-
const s =
|
|
308
|
+
const s = K.createElement("me-main");
|
|
306
309
|
s.className = I.RHS;
|
|
307
310
|
for (let i = 0; i < e.length; i++) {
|
|
308
311
|
const r = e[i], { grp: c } = t.createWrapper(r);
|
|
309
312
|
t.direction === 2 ? r.direction === 0 ? o.appendChild(c) : s.appendChild(c) : t.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
310
313
|
}
|
|
311
314
|
t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(s), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
|
|
312
|
-
},
|
|
313
|
-
const n =
|
|
315
|
+
}, Ht = function(t, e) {
|
|
316
|
+
const n = K.createElement("me-children");
|
|
314
317
|
for (let o = 0; o < e.length; o++) {
|
|
315
318
|
const s = e[o], { grp: i } = t.createWrapper(s);
|
|
316
319
|
n.appendChild(i);
|
|
317
320
|
}
|
|
318
321
|
return n;
|
|
319
|
-
},
|
|
322
|
+
}, L = document, bt = function(t, e) {
|
|
320
323
|
const o = (this?.el ? this.el : e || document).querySelector(`[data-nodeid="me${t}"]`);
|
|
321
324
|
if (!o) throw new Error(`FindEle: Node ${t} not found, maybe it's collapsed.`);
|
|
322
325
|
return o;
|
|
323
|
-
},
|
|
326
|
+
}, vt = function(t, e) {
|
|
324
327
|
if (t.innerHTML = "", e.style) {
|
|
325
328
|
const n = e.style;
|
|
326
329
|
for (const o in n)
|
|
@@ -333,58 +336,58 @@ const U = document, Nt = function() {
|
|
|
333
336
|
if (e.image) {
|
|
334
337
|
const n = e.image;
|
|
335
338
|
if (n.url && n.width && n.height) {
|
|
336
|
-
const o =
|
|
339
|
+
const o = L.createElement("img");
|
|
337
340
|
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;
|
|
338
341
|
}
|
|
339
342
|
} else t.image && (t.image = void 0);
|
|
340
343
|
{
|
|
341
|
-
const n =
|
|
344
|
+
const n = L.createElement("span");
|
|
342
345
|
n.className = "text", this.markdown ? n.innerHTML = this.markdown(e.topic, e) : n.textContent = e.topic, t.appendChild(n), t.text = n;
|
|
343
346
|
}
|
|
344
347
|
if (e.hyperLink) {
|
|
345
|
-
const n =
|
|
348
|
+
const n = L.createElement("a");
|
|
346
349
|
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = e.hyperLink, t.appendChild(n), t.link = n;
|
|
347
350
|
} else t.link && (t.link = void 0);
|
|
348
351
|
if (e.icons && e.icons.length) {
|
|
349
|
-
const n =
|
|
350
|
-
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${
|
|
352
|
+
const n = L.createElement("span");
|
|
353
|
+
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${$t(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
|
|
351
354
|
} else t.icons && (t.icons = void 0);
|
|
352
355
|
if (e.tags && e.tags.length) {
|
|
353
|
-
const n =
|
|
356
|
+
const n = L.createElement("div");
|
|
354
357
|
n.className = "tags", e.tags.forEach((o) => {
|
|
355
|
-
const s =
|
|
358
|
+
const s = L.createElement("span");
|
|
356
359
|
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);
|
|
357
360
|
}), t.appendChild(n), t.tags = n;
|
|
358
361
|
} else t.tags && (t.tags = void 0);
|
|
359
|
-
},
|
|
360
|
-
const n =
|
|
362
|
+
}, Bt = function(t, e) {
|
|
363
|
+
const n = L.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
|
|
361
364
|
if (n.appendChild(o), !e && t.children && t.children.length > 0) {
|
|
362
|
-
const i =
|
|
365
|
+
const i = Ft(t.expanded);
|
|
363
366
|
if (o.appendChild(i), t.expanded !== !1) {
|
|
364
|
-
const r =
|
|
367
|
+
const r = Ht(this, t.children);
|
|
365
368
|
n.appendChild(r);
|
|
366
369
|
}
|
|
367
370
|
}
|
|
368
371
|
return { grp: n, top: o, tpc: s };
|
|
369
|
-
}, Bt = function(t) {
|
|
370
|
-
const e = k.createElement("me-parent"), n = this.createTopic(t);
|
|
371
|
-
return bt.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
|
|
372
372
|
}, It = function(t) {
|
|
373
|
-
const e =
|
|
374
|
-
return
|
|
373
|
+
const e = L.createElement("me-parent"), n = this.createTopic(t);
|
|
374
|
+
return vt.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
|
|
375
375
|
}, Wt = function(t) {
|
|
376
|
-
const e =
|
|
376
|
+
const e = L.createElement("me-children");
|
|
377
|
+
return e.append(...t), e;
|
|
378
|
+
}, Ot = function(t) {
|
|
379
|
+
const e = L.createElement("me-tpc");
|
|
377
380
|
return e.nodeObj = t, e.dataset.nodeid = "me" + t.id, e.draggable = this.draggable, e;
|
|
378
381
|
};
|
|
379
|
-
function
|
|
380
|
-
const e =
|
|
382
|
+
function xt(t) {
|
|
383
|
+
const e = L.createRange();
|
|
381
384
|
e.selectNodeContents(t);
|
|
382
385
|
const n = window.getSelection();
|
|
383
386
|
n && (n.removeAllRanges(), n.addRange(e));
|
|
384
387
|
}
|
|
385
|
-
const
|
|
388
|
+
const Gt = function(t) {
|
|
386
389
|
if (!t) return;
|
|
387
|
-
const e =
|
|
390
|
+
const e = L.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = A(this.nodes, t);
|
|
388
391
|
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
389
392
|
const r = getComputedStyle(t);
|
|
390
393
|
e.style.cssText = `
|
|
@@ -392,11 +395,12 @@ const Ot = function(t) {
|
|
|
392
395
|
top: ${i}px;
|
|
393
396
|
min-width:${t.offsetWidth - 8}px;
|
|
394
397
|
color:${r.color};
|
|
398
|
+
font-size:${r.fontSize};
|
|
395
399
|
padding:${r.padding};
|
|
396
400
|
margin:${r.margin};
|
|
397
401
|
background-color:${r.backgroundColor !== "rgba(0, 0, 0, 0)" && r.backgroundColor};
|
|
398
402
|
border: ${r.border};
|
|
399
|
-
border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"),
|
|
403
|
+
border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"), xt(e), this.bus.fire("operation", {
|
|
400
404
|
name: "beginEdit",
|
|
401
405
|
obj: t.nodeObj
|
|
402
406
|
}), e.addEventListener("keydown", (c) => {
|
|
@@ -416,34 +420,34 @@ const Ot = function(t) {
|
|
|
416
420
|
origin: o
|
|
417
421
|
}));
|
|
418
422
|
});
|
|
419
|
-
},
|
|
420
|
-
const e =
|
|
423
|
+
}, Ft = function(t) {
|
|
424
|
+
const e = L.createElement("me-epd");
|
|
421
425
|
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
422
|
-
}, B = document,
|
|
426
|
+
}, B = document, D = "http://www.w3.org/2000/svg", Q = function(t) {
|
|
423
427
|
const e = t.clientWidth, n = t.clientHeight, o = t.dataset, s = Number(o.x), i = Number(o.y), r = o.anchor;
|
|
424
428
|
let c = s;
|
|
425
429
|
r === "middle" ? c = s - e / 2 : r === "end" && (c = s - e), t.style.left = `${c}px`, t.style.top = `${i - n / 2}px`, t.style.visibility = "visible";
|
|
426
|
-
},
|
|
430
|
+
}, et = function(t, e, n, o) {
|
|
427
431
|
const { anchor: s = "middle", color: i, dataType: r, svgId: c } = o, a = document.createElement("div");
|
|
428
432
|
a.className = "svg-label", a.style.color = i || "#666";
|
|
429
433
|
const h = "label-" + c;
|
|
430
434
|
return a.id = h, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = c, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor = s, a;
|
|
431
|
-
},
|
|
432
|
-
const o = B.createElementNS(
|
|
435
|
+
}, Ct = function(t, e, n) {
|
|
436
|
+
const o = B.createElementNS(D, "path");
|
|
433
437
|
return E(o, {
|
|
434
438
|
d: t,
|
|
435
439
|
stroke: e || "#666",
|
|
436
440
|
fill: "none",
|
|
437
441
|
"stroke-width": n
|
|
438
442
|
}), o;
|
|
439
|
-
},
|
|
440
|
-
const e = B.createElementNS(
|
|
443
|
+
}, V = function(t) {
|
|
444
|
+
const e = B.createElementNS(D, "svg");
|
|
441
445
|
return e.setAttribute("class", t), e.setAttribute("overflow", "visible"), e;
|
|
442
|
-
},
|
|
443
|
-
const t = B.createElementNS(
|
|
446
|
+
}, ft = function() {
|
|
447
|
+
const t = B.createElementNS(D, "line");
|
|
444
448
|
return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
|
|
445
|
-
},
|
|
446
|
-
const s = B.createElementNS(
|
|
449
|
+
}, Vt = function(t, e, n, o) {
|
|
450
|
+
const s = B.createElementNS(D, "g");
|
|
447
451
|
return [
|
|
448
452
|
{
|
|
449
453
|
name: "line",
|
|
@@ -458,7 +462,7 @@ const Ot = function(t) {
|
|
|
458
462
|
d: n
|
|
459
463
|
}
|
|
460
464
|
].forEach((r, c) => {
|
|
461
|
-
const a = r.d, h = B.createElementNS(
|
|
465
|
+
const a = r.d, h = B.createElementNS(D, "path"), f = {
|
|
462
466
|
d: a,
|
|
463
467
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
464
468
|
fill: "none",
|
|
@@ -466,7 +470,7 @@ const Ot = function(t) {
|
|
|
466
470
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
467
471
|
};
|
|
468
472
|
o?.opacity !== void 0 && (f.opacity = String(o.opacity)), E(h, f), c === 0 && h.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
469
|
-
const p = B.createElementNS(
|
|
473
|
+
const p = B.createElementNS(D, "path");
|
|
470
474
|
E(p, {
|
|
471
475
|
d: a,
|
|
472
476
|
stroke: "transparent",
|
|
@@ -474,14 +478,14 @@ const Ot = function(t) {
|
|
|
474
478
|
"stroke-width": "15"
|
|
475
479
|
}), s.appendChild(p), s.appendChild(h), s[r.name] = h;
|
|
476
480
|
}), s;
|
|
477
|
-
},
|
|
481
|
+
}, St = function(t, e, n) {
|
|
478
482
|
if (!e) return;
|
|
479
483
|
const o = n.label, s = e.cloneNode(!0);
|
|
480
484
|
t.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
481
485
|
left:${e.style.left};
|
|
482
486
|
top:${e.style.top};
|
|
483
487
|
max-width: 200px;
|
|
484
|
-
`,
|
|
488
|
+
`, xt(s), t.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
485
489
|
i.stopPropagation();
|
|
486
490
|
const r = i.key;
|
|
487
491
|
if (r === "Enter" || r === "Tab") {
|
|
@@ -491,7 +495,7 @@ const Ot = function(t) {
|
|
|
491
495
|
}), s.addEventListener("blur", () => {
|
|
492
496
|
if (!s) return;
|
|
493
497
|
const i = s.textContent?.trim() || "";
|
|
494
|
-
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.textContent = n.label,
|
|
498
|
+
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (t.markdown ? e.innerHTML = t.markdown(n.label, n) : e.textContent = n.label, Q(e), "parent" in n ? t.bus.fire("operation", {
|
|
495
499
|
name: "finishEditSummary",
|
|
496
500
|
obj: n
|
|
497
501
|
}) : t.bus.fire("operation", {
|
|
@@ -499,44 +503,44 @@ const Ot = function(t) {
|
|
|
499
503
|
obj: n
|
|
500
504
|
}));
|
|
501
505
|
});
|
|
502
|
-
},
|
|
506
|
+
}, zt = function(t) {
|
|
503
507
|
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");
|
|
504
508
|
this.lines.innerHTML = "";
|
|
505
509
|
for (let c = 0; c < r.length; c++) {
|
|
506
|
-
const a = r[c], h = a.querySelector("me-tpc"), { offsetLeft: f, offsetTop: p } =
|
|
507
|
-
if (h.style.borderColor = d, this.lines.appendChild(
|
|
510
|
+
const a = r[c], h = a.querySelector("me-tpc"), { offsetLeft: f, offsetTop: p } = A(this.nodes, h), m = h.offsetWidth, w = h.offsetHeight, g = a.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: p, cL: f, cW: m, cH: w, direction: g, containerHeight: this.nodes.offsetHeight }), l = this.theme.palette, d = h.nodeObj.branchColor || l[c % l.length];
|
|
511
|
+
if (h.style.borderColor = d, this.lines.appendChild(Ct(u, d, "3")), t && t !== a)
|
|
508
512
|
continue;
|
|
509
|
-
const
|
|
510
|
-
v.tagName === "svg" && v.remove(), a.appendChild(
|
|
513
|
+
const y = V("subLines"), v = a.lastChild;
|
|
514
|
+
v.tagName === "svg" && v.remove(), a.appendChild(y), Et(this, y, d, a, g, !0);
|
|
511
515
|
}
|
|
512
516
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
513
|
-
},
|
|
517
|
+
}, Et = function(t, e, n, o, s, i) {
|
|
514
518
|
const r = o.firstChild, c = o.children[1].children;
|
|
515
519
|
if (c.length === 0) return;
|
|
516
520
|
const a = r.offsetTop, h = r.offsetLeft, f = r.offsetWidth, p = r.offsetHeight;
|
|
517
521
|
for (let m = 0; m < c.length; m++) {
|
|
518
|
-
const
|
|
519
|
-
e.appendChild(
|
|
520
|
-
const
|
|
521
|
-
if (
|
|
522
|
-
if (!
|
|
522
|
+
const w = c[m], g = w.firstChild, u = g.offsetTop, l = g.offsetLeft, d = g.offsetWidth, y = g.offsetHeight, v = g.firstChild.nodeObj.branchColor || n, C = t.generateSubBranch({ pT: a, pL: h, pW: f, pH: p, cT: u, cL: l, cW: d, cH: y, direction: s, isFirst: i });
|
|
523
|
+
e.appendChild(Ct(C, v, "2"));
|
|
524
|
+
const b = g.children[1];
|
|
525
|
+
if (b) {
|
|
526
|
+
if (!b.expanded) continue;
|
|
523
527
|
} else
|
|
524
528
|
continue;
|
|
525
|
-
|
|
529
|
+
Et(t, e, v, w, s);
|
|
526
530
|
}
|
|
527
|
-
}, Rt = '<?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>', Yt = '<?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>',
|
|
531
|
+
}, Rt = '<?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>', Yt = '<?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>', jt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Xt = '<?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>', qt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', _t = '<?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>', Ut = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Kt = {
|
|
528
532
|
side: Rt,
|
|
529
533
|
left: Yt,
|
|
530
|
-
right:
|
|
531
|
-
full:
|
|
532
|
-
living:
|
|
533
|
-
zoomin:
|
|
534
|
-
zoomout:
|
|
534
|
+
right: jt,
|
|
535
|
+
full: Xt,
|
|
536
|
+
living: qt,
|
|
537
|
+
zoomin: _t,
|
|
538
|
+
zoomout: Ut
|
|
535
539
|
}, M = (t, e) => {
|
|
536
540
|
const n = document.createElement("span");
|
|
537
|
-
return n.id = t, n.innerHTML =
|
|
541
|
+
return n.id = t, n.innerHTML = Kt[e], n;
|
|
538
542
|
};
|
|
539
|
-
function
|
|
543
|
+
function Jt(t) {
|
|
540
544
|
const e = document.createElement("div"), n = M("fullscreen", "full"), o = M("toCenter", "living"), s = M("zoomout", "zoomout"), i = M("zoomin", "zoomin"), r = document.createElement("span");
|
|
541
545
|
return r.innerText = "100%", e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(i), e.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
542
546
|
document.fullscreenElement === t.el ? document.exitFullscreen() : t.el.requestFullscreen();
|
|
@@ -548,7 +552,7 @@ function Kt(t) {
|
|
|
548
552
|
t.scale(t.scaleVal + t.scaleSensitivity);
|
|
549
553
|
}, e;
|
|
550
554
|
}
|
|
551
|
-
function
|
|
555
|
+
function Qt(t) {
|
|
552
556
|
const e = document.createElement("div"), n = M("tbltl", "left"), o = M("tbltr", "right"), s = M("tblts", "side");
|
|
553
557
|
return e.appendChild(n), e.appendChild(o), e.appendChild(s), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
554
558
|
t.initLeft();
|
|
@@ -558,13 +562,13 @@ function Jt(t) {
|
|
|
558
562
|
t.initSide();
|
|
559
563
|
}, e;
|
|
560
564
|
}
|
|
561
|
-
function
|
|
562
|
-
t.container.append(
|
|
565
|
+
function Zt(t) {
|
|
566
|
+
t.container.append(Jt(t)), t.container.append(Qt(t));
|
|
563
567
|
}
|
|
564
|
-
const
|
|
568
|
+
const te = function(t, e = !0) {
|
|
565
569
|
this.theme = t;
|
|
566
570
|
const o = {
|
|
567
|
-
...(t.type === "dark" ?
|
|
571
|
+
...(t.type === "dark" ? ot : nt).cssVar,
|
|
568
572
|
...t.cssVar
|
|
569
573
|
}, s = Object.keys(o);
|
|
570
574
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -572,11 +576,11 @@ const Zt = function(t, e = !0) {
|
|
|
572
576
|
this.container.style.setProperty(r, o[r]);
|
|
573
577
|
}
|
|
574
578
|
e && this.refresh();
|
|
575
|
-
},
|
|
579
|
+
}, ee = function(t) {
|
|
576
580
|
const n = t.parentElement.parentElement.lastElementChild;
|
|
577
581
|
n?.tagName === "svg" && n?.remove();
|
|
578
582
|
};
|
|
579
|
-
function
|
|
583
|
+
function ne(t) {
|
|
580
584
|
return {
|
|
581
585
|
nodeData: t.isFocusMode ? t.nodeDataBackup : t.nodeData,
|
|
582
586
|
arrows: t.arrows,
|
|
@@ -585,74 +589,74 @@ function ee(t) {
|
|
|
585
589
|
theme: t.theme
|
|
586
590
|
};
|
|
587
591
|
}
|
|
588
|
-
const
|
|
592
|
+
const oe = function(t) {
|
|
589
593
|
const e = this.container, n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
590
594
|
if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
|
|
591
595
|
const i = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2, a = o.top + o.height / 2, h = i - c, f = r - a;
|
|
592
596
|
this.move(-h, -f, !0);
|
|
593
597
|
}
|
|
594
|
-
},
|
|
598
|
+
}, se = function(t, e, n) {
|
|
595
599
|
this.clearSelection(), this.scrollIntoView(t), this.selection.select(t), e && this.bus.fire("selectNewNode", t.nodeObj);
|
|
596
|
-
}, se = function(t) {
|
|
597
|
-
this.selection.select(t);
|
|
598
600
|
}, ie = function(t) {
|
|
601
|
+
this.selection.select(t);
|
|
602
|
+
}, re = function(t) {
|
|
599
603
|
this.selection.deselect(t);
|
|
600
|
-
}, re = function() {
|
|
601
|
-
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
602
604
|
}, ce = function() {
|
|
603
|
-
|
|
605
|
+
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
606
|
+
}, le = function() {
|
|
607
|
+
const t = ne(this);
|
|
604
608
|
return JSON.stringify(t, (e, n) => {
|
|
605
609
|
if (!(e === "parent" && typeof n != "string"))
|
|
606
610
|
return n;
|
|
607
611
|
});
|
|
608
|
-
}, le = function() {
|
|
609
|
-
return JSON.parse(this.getDataString());
|
|
610
612
|
}, ae = function() {
|
|
611
|
-
this.
|
|
613
|
+
return JSON.parse(this.getDataString());
|
|
612
614
|
}, he = function() {
|
|
615
|
+
this.editable = !0;
|
|
616
|
+
}, de = function() {
|
|
613
617
|
this.editable = !1;
|
|
614
|
-
},
|
|
618
|
+
}, fe = function(t, e = { x: 0, y: 0 }) {
|
|
615
619
|
if (t < this.scaleMin || t > this.scaleMax) return;
|
|
616
|
-
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 } =
|
|
617
|
-
this.map.style.transform = `translate(${a -
|
|
618
|
-
},
|
|
620
|
+
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 } = kt(this), c = this.map.style.transform, { x: a, y: h } = yt(c), f = a - i, p = h - r, m = this.scaleVal, w = (-o + f) * (1 - t / m), g = (-s + p) * (1 - t / m);
|
|
621
|
+
this.map.style.transform = `translate(${a - w}px, ${h - g}px) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
622
|
+
}, pe = function() {
|
|
619
623
|
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
620
624
|
this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
|
|
621
|
-
},
|
|
625
|
+
}, ue = function(t, e, n = !1) {
|
|
622
626
|
const { map: o, scaleVal: s, bus: i } = this, r = o.style.transform;
|
|
623
|
-
let { x: c, y: a } =
|
|
627
|
+
let { x: c, y: a } = yt(r);
|
|
624
628
|
c += t, a += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
625
629
|
o.style.transition = "none";
|
|
626
630
|
}, 300)), o.style.transform = `translate(${c}px, ${a}px) scale(${s})`, i.fire("move", { dx: t, dy: e });
|
|
627
|
-
},
|
|
631
|
+
}, kt = (t) => {
|
|
628
632
|
const { container: e, map: n, nodes: o } = t, s = n.querySelector("me-root"), i = s.offsetTop, r = s.offsetLeft, c = s.offsetWidth, a = s.offsetHeight;
|
|
629
633
|
let h, f;
|
|
630
634
|
return t.alignment === "root" ? (h = e.offsetWidth / 2 - r - c / 2, f = e.offsetHeight / 2 - i - a / 2, n.style.transformOrigin = `${r + c / 2}px 50%`) : (h = (e.offsetWidth - o.offsetWidth) / 2, f = (e.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: h, dy: f };
|
|
631
|
-
},
|
|
632
|
-
const { map: t } = this, { dx:
|
|
633
|
-
t.style.transform = `translate(${
|
|
634
|
-
}, ge = function(t) {
|
|
635
|
-
t(this);
|
|
635
|
+
}, ge = function() {
|
|
636
|
+
const { map: t, container: e } = this, { dx: n, dy: o } = kt(this);
|
|
637
|
+
e.scrollTop = 0, e.scrollLeft = 0, t.style.transform = `translate(${n}px, ${o}px) scale(${this.scaleVal})`;
|
|
636
638
|
}, me = function(t) {
|
|
639
|
+
t(this);
|
|
640
|
+
}, ye = function(t) {
|
|
637
641
|
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());
|
|
638
|
-
}, ye = function() {
|
|
639
|
-
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
640
642
|
}, we = function() {
|
|
641
|
-
this.
|
|
643
|
+
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
642
644
|
}, be = function() {
|
|
643
|
-
this.direction =
|
|
645
|
+
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
644
646
|
}, ve = function() {
|
|
647
|
+
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
648
|
+
}, xe = function() {
|
|
645
649
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
646
|
-
},
|
|
650
|
+
}, Ce = function(t) {
|
|
647
651
|
this.locale = t, this.refresh();
|
|
648
|
-
},
|
|
652
|
+
}, Se = function(t, e) {
|
|
649
653
|
const n = t.nodeObj;
|
|
650
654
|
typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
651
655
|
const o = t.getBoundingClientRect(), s = {
|
|
652
656
|
x: o.left,
|
|
653
657
|
y: o.top
|
|
654
658
|
}, i = t.parentNode, r = i.children[1];
|
|
655
|
-
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "",
|
|
659
|
+
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", ee(t), n.expanded) {
|
|
656
660
|
const p = this.createChildren(
|
|
657
661
|
n.children.map((m) => this.createWrapper(m).grp)
|
|
658
662
|
);
|
|
@@ -665,45 +669,45 @@ const ne = function(t) {
|
|
|
665
669
|
y: c.top
|
|
666
670
|
}, h = s.x - a.x, f = s.y - a.y;
|
|
667
671
|
this.move(h, f), this.bus.fire("expandNode", n);
|
|
668
|
-
},
|
|
672
|
+
}, Ee = function(t, e) {
|
|
669
673
|
const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
|
|
670
674
|
x: o.left,
|
|
671
675
|
y: o.top
|
|
672
676
|
};
|
|
673
|
-
|
|
677
|
+
mt(n, e ?? !n.expanded), this.refresh();
|
|
674
678
|
const i = this.findEle(n.id).getBoundingClientRect(), r = {
|
|
675
679
|
x: i.left,
|
|
676
680
|
y: i.top
|
|
677
681
|
}, c = s.x - r.x, a = s.y - r.y;
|
|
678
682
|
this.move(c, a);
|
|
679
|
-
},
|
|
680
|
-
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)),
|
|
683
|
+
}, ke = function(t) {
|
|
684
|
+
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)), st(this.nodeData), this.layout(), this.linkDiv();
|
|
681
685
|
}, Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
682
686
|
__proto__: null,
|
|
683
|
-
cancelFocus:
|
|
684
|
-
clearSelection:
|
|
685
|
-
disableEdit:
|
|
686
|
-
enableEdit:
|
|
687
|
-
expandNode:
|
|
688
|
-
expandNodeAll:
|
|
689
|
-
focusNode:
|
|
690
|
-
getData:
|
|
691
|
-
getDataString:
|
|
692
|
-
initLeft:
|
|
693
|
-
initRight:
|
|
694
|
-
initSide:
|
|
695
|
-
install:
|
|
696
|
-
move:
|
|
697
|
-
refresh:
|
|
698
|
-
scale:
|
|
699
|
-
scaleFit:
|
|
700
|
-
scrollIntoView:
|
|
701
|
-
selectNode:
|
|
702
|
-
selectNodes:
|
|
703
|
-
setLocale:
|
|
704
|
-
toCenter:
|
|
705
|
-
unselectNodes:
|
|
706
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
687
|
+
cancelFocus: we,
|
|
688
|
+
clearSelection: ce,
|
|
689
|
+
disableEdit: de,
|
|
690
|
+
enableEdit: he,
|
|
691
|
+
expandNode: Se,
|
|
692
|
+
expandNodeAll: Ee,
|
|
693
|
+
focusNode: ye,
|
|
694
|
+
getData: ae,
|
|
695
|
+
getDataString: le,
|
|
696
|
+
initLeft: be,
|
|
697
|
+
initRight: ve,
|
|
698
|
+
initSide: xe,
|
|
699
|
+
install: me,
|
|
700
|
+
move: ue,
|
|
701
|
+
refresh: ke,
|
|
702
|
+
scale: fe,
|
|
703
|
+
scaleFit: pe,
|
|
704
|
+
scrollIntoView: oe,
|
|
705
|
+
selectNode: se,
|
|
706
|
+
selectNodes: ie,
|
|
707
|
+
setLocale: Ce,
|
|
708
|
+
toCenter: ge,
|
|
709
|
+
unselectNodes: re
|
|
710
|
+
}, Symbol.toStringTag, { value: "Module" })), Te = function(t) {
|
|
707
711
|
return {
|
|
708
712
|
dom: t,
|
|
709
713
|
moved: !1,
|
|
@@ -726,7 +730,7 @@ const ne = function(t) {
|
|
|
726
730
|
},
|
|
727
731
|
cb: null,
|
|
728
732
|
init(e, n) {
|
|
729
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
733
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = wt([
|
|
730
734
|
{ dom: e, evt: "pointermove", func: this.handlePointerMove },
|
|
731
735
|
{ dom: e, evt: "pointerleave", func: this.handleClear },
|
|
732
736
|
{ dom: e, evt: "pointerup", func: this.handleClear },
|
|
@@ -738,19 +742,19 @@ const ne = function(t) {
|
|
|
738
742
|
this.moved = !1, this.pointerdown = !1;
|
|
739
743
|
}
|
|
740
744
|
};
|
|
741
|
-
},
|
|
742
|
-
create:
|
|
743
|
-
},
|
|
745
|
+
}, pt = {
|
|
746
|
+
create: Te
|
|
747
|
+
}, $e = "#4dc4ff";
|
|
744
748
|
function Lt(t, e, n, o, s, i, r, c) {
|
|
745
749
|
return {
|
|
746
750
|
x: t / 8 + n * 3 / 8 + s * 3 / 8 + r / 8,
|
|
747
751
|
y: e / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
748
752
|
};
|
|
749
753
|
}
|
|
750
|
-
function
|
|
751
|
-
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(),
|
|
754
|
+
function De(t, e, n) {
|
|
755
|
+
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), Q(t));
|
|
752
756
|
}
|
|
753
|
-
function
|
|
757
|
+
function j(t, e, n, o, s) {
|
|
754
758
|
E(t, {
|
|
755
759
|
x1: e + "",
|
|
756
760
|
y1: n + "",
|
|
@@ -758,7 +762,7 @@ function z(t, e, n, o, s) {
|
|
|
758
762
|
y2: s + ""
|
|
759
763
|
});
|
|
760
764
|
}
|
|
761
|
-
function
|
|
765
|
+
function ut(t, e, n, o, s, i, r, c, a, h) {
|
|
762
766
|
const f = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${c} ${a}`;
|
|
763
767
|
if (t.line.setAttribute("d", f), h.style) {
|
|
764
768
|
const u = h.style;
|
|
@@ -766,7 +770,7 @@ function pt(t, e, n, o, s, i, r, c, a, h) {
|
|
|
766
770
|
}
|
|
767
771
|
const p = t.querySelectorAll('path[stroke="transparent"]');
|
|
768
772
|
p.length > 0 && p[0].setAttribute("d", f);
|
|
769
|
-
const m =
|
|
773
|
+
const m = U(i, r, c, a);
|
|
770
774
|
if (m) {
|
|
771
775
|
const u = `M ${m.x1} ${m.y1} L ${c} ${a} L ${m.x2} ${m.y2}`;
|
|
772
776
|
if (t.arrow1.setAttribute("d", u), p.length > 1 && p[1].setAttribute("d", u), h.style) {
|
|
@@ -775,7 +779,7 @@ function pt(t, e, n, o, s, i, r, c, a, h) {
|
|
|
775
779
|
}
|
|
776
780
|
}
|
|
777
781
|
if (h.bidirectional) {
|
|
778
|
-
const u =
|
|
782
|
+
const u = U(o, s, e, n);
|
|
779
783
|
if (u) {
|
|
780
784
|
const l = `M ${u.x1} ${u.y1} L ${e} ${n} L ${u.x2} ${u.y2}`;
|
|
781
785
|
if (t.arrow2.setAttribute("d", l), p.length > 2 && p[2].setAttribute("d", l), h.style) {
|
|
@@ -784,15 +788,15 @@ function pt(t, e, n, o, s, i, r, c, a, h) {
|
|
|
784
788
|
}
|
|
785
789
|
}
|
|
786
790
|
}
|
|
787
|
-
const { x:
|
|
788
|
-
if (t.labelEl &&
|
|
791
|
+
const { x: w, y: g } = Lt(e, n, o, s, i, r, c, a);
|
|
792
|
+
if (t.labelEl && De(t.labelEl, w, g), h.style?.labelColor) {
|
|
789
793
|
const u = t.labelEl;
|
|
790
794
|
u && (u.style.color = h.style.labelColor);
|
|
791
795
|
}
|
|
792
|
-
|
|
796
|
+
We(t);
|
|
793
797
|
}
|
|
794
|
-
function
|
|
795
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
798
|
+
function J(t, e, n) {
|
|
799
|
+
const { offsetLeft: o, offsetTop: s } = A(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, a = s + r / 2, h = c + n.x, f = a + n.y;
|
|
796
800
|
return {
|
|
797
801
|
w: i,
|
|
798
802
|
h: r,
|
|
@@ -810,30 +814,30 @@ function H(t) {
|
|
|
810
814
|
y: n
|
|
811
815
|
};
|
|
812
816
|
}
|
|
813
|
-
const
|
|
817
|
+
const it = function(t, e, n, o, s) {
|
|
814
818
|
if (!e || !n)
|
|
815
819
|
return;
|
|
816
|
-
const i =
|
|
820
|
+
const i = J(t, e, o.delta1), r = J(t, n, o.delta2), { x: c, y: a } = H(i), { ctrlX: h, ctrlY: f } = i, { ctrlX: p, ctrlY: m } = r, { x: w, y: g } = H(r), u = U(p, m, w, g);
|
|
817
821
|
if (!u) return;
|
|
818
|
-
const l = `M ${u.x1} ${u.y1} L ${
|
|
822
|
+
const l = `M ${u.x1} ${u.y1} L ${w} ${g} L ${u.x2} ${u.y2}`;
|
|
819
823
|
let d = "";
|
|
820
824
|
if (o.bidirectional) {
|
|
821
|
-
const
|
|
822
|
-
if (
|
|
823
|
-
d = `M ${
|
|
825
|
+
const $ = U(h, f, c, a);
|
|
826
|
+
if (!$) return;
|
|
827
|
+
d = `M ${$.x1} ${$.y1} L ${c} ${a} L ${$.x2} ${$.y2}`;
|
|
824
828
|
}
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
const
|
|
829
|
+
const y = Vt(`M ${c} ${a} C ${h} ${f} ${p} ${m} ${w} ${g}`, l, d, o.style), { x: v, y: C } = Lt(c, a, h, f, p, m, w, g), b = o.style?.labelColor || "rgb(235, 95, 82)", S = "arrow-" + o.id;
|
|
830
|
+
y.id = S;
|
|
831
|
+
const x = t.markdown ? t.markdown(o.label, o) : o.label, k = et(x, v, C, {
|
|
828
832
|
anchor: "middle",
|
|
829
|
-
color:
|
|
833
|
+
color: b,
|
|
830
834
|
dataType: "arrow",
|
|
831
|
-
svgId:
|
|
835
|
+
svgId: S
|
|
832
836
|
});
|
|
833
|
-
|
|
834
|
-
},
|
|
837
|
+
y.labelEl = k, y.arrowObj = o, y.dataset.linkid = o.id, t.labelContainer.appendChild(k), t.linkSvgGroup.appendChild(y), Q(k), s || (t.arrows.push(o), t.currentArrow = y, Tt(t, o, i, r));
|
|
838
|
+
}, Ae = function(t, e, n = {}) {
|
|
835
839
|
const o = {
|
|
836
|
-
id:
|
|
840
|
+
id: z(),
|
|
837
841
|
label: "Custom Link",
|
|
838
842
|
from: t.nodeObj.id,
|
|
839
843
|
to: e.nodeObj.id,
|
|
@@ -847,21 +851,21 @@ const st = function(t, e, n, o, s) {
|
|
|
847
851
|
},
|
|
848
852
|
...n
|
|
849
853
|
};
|
|
850
|
-
|
|
854
|
+
it(this, t, e, o), this.bus.fire("operation", {
|
|
851
855
|
name: "createArrow",
|
|
852
856
|
obj: o
|
|
853
857
|
});
|
|
854
|
-
},
|
|
855
|
-
|
|
856
|
-
const e = { ...t, id:
|
|
857
|
-
|
|
858
|
+
}, Ne = function(t) {
|
|
859
|
+
Z(this);
|
|
860
|
+
const e = { ...t, id: z() };
|
|
861
|
+
it(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
|
|
858
862
|
name: "createArrow",
|
|
859
863
|
obj: e
|
|
860
864
|
});
|
|
861
|
-
},
|
|
865
|
+
}, Me = function(t) {
|
|
862
866
|
let e;
|
|
863
867
|
if (t ? e = t : e = this.currentArrow, !e) return;
|
|
864
|
-
|
|
868
|
+
Z(this);
|
|
865
869
|
const n = e.arrowObj.id;
|
|
866
870
|
this.arrows = this.arrows.filter((o) => o.id !== n), e.remove(), this.bus.fire("operation", {
|
|
867
871
|
name: "removeArrow",
|
|
@@ -869,14 +873,14 @@ const st = function(t, e, n, o, s) {
|
|
|
869
873
|
id: n
|
|
870
874
|
}
|
|
871
875
|
});
|
|
872
|
-
},
|
|
876
|
+
}, Pe = function(t) {
|
|
873
877
|
this.currentArrow = t;
|
|
874
|
-
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s =
|
|
875
|
-
|
|
876
|
-
},
|
|
877
|
-
|
|
878
|
-
},
|
|
879
|
-
const n = document.createElementNS(
|
|
878
|
+
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = J(this, n, e.delta1), i = J(this, o, e.delta2);
|
|
879
|
+
Tt(this, e, s, i);
|
|
880
|
+
}, He = function() {
|
|
881
|
+
Z(this), this.currentArrow = null;
|
|
882
|
+
}, tt = function(t, e) {
|
|
883
|
+
const n = document.createElementNS(D, "path");
|
|
880
884
|
return E(n, {
|
|
881
885
|
d: t,
|
|
882
886
|
stroke: e,
|
|
@@ -885,70 +889,70 @@ const st = function(t, e, n, o, s) {
|
|
|
885
889
|
"stroke-linecap": "round",
|
|
886
890
|
"stroke-linejoin": "round"
|
|
887
891
|
}), n;
|
|
888
|
-
},
|
|
889
|
-
const n = document.createElementNS(
|
|
892
|
+
}, Be = function(t, e) {
|
|
893
|
+
const n = document.createElementNS(D, "g");
|
|
890
894
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
891
|
-
const o =
|
|
895
|
+
const o = tt(t.line.getAttribute("d"), e);
|
|
892
896
|
n.appendChild(o);
|
|
893
|
-
const s =
|
|
897
|
+
const s = tt(t.arrow1.getAttribute("d"), e);
|
|
894
898
|
if (n.appendChild(s), t.arrow2.getAttribute("d")) {
|
|
895
|
-
const i =
|
|
899
|
+
const i = tt(t.arrow2.getAttribute("d"), e);
|
|
896
900
|
n.appendChild(i);
|
|
897
901
|
}
|
|
898
902
|
t.insertBefore(n, t.firstChild);
|
|
899
|
-
},
|
|
903
|
+
}, Ie = function(t) {
|
|
900
904
|
const e = t.querySelector(".arrow-highlight");
|
|
901
905
|
e && e.remove();
|
|
902
|
-
},
|
|
906
|
+
}, We = function(t) {
|
|
903
907
|
const e = t.querySelector(".arrow-highlight");
|
|
904
908
|
if (!e) return;
|
|
905
909
|
const n = e.querySelectorAll("path");
|
|
906
910
|
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"));
|
|
907
|
-
},
|
|
908
|
-
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow &&
|
|
909
|
-
},
|
|
911
|
+
}, Z = function(t) {
|
|
912
|
+
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && Ie(t.currentArrow);
|
|
913
|
+
}, Tt = function(t, e, n, o) {
|
|
910
914
|
const { linkController: s, P2: i, P3: r, line1: c, line2: a, nodes: h, map: f, currentArrow: p, bus: m } = t;
|
|
911
915
|
if (!p) return;
|
|
912
|
-
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", h.appendChild(s), h.appendChild(i), h.appendChild(r),
|
|
913
|
-
let { x:
|
|
914
|
-
i.style.cssText = `top:${l}px;left:${u}px;`, r.style.cssText = `top:${
|
|
915
|
-
u = u +
|
|
916
|
-
const
|
|
917
|
-
|
|
918
|
-
}), t.helper2.init(f, (
|
|
919
|
-
d = d +
|
|
920
|
-
const
|
|
921
|
-
v =
|
|
916
|
+
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", h.appendChild(s), h.appendChild(i), h.appendChild(r), Be(p, $e);
|
|
917
|
+
let { x: w, y: g } = H(n), { ctrlX: u, ctrlY: l } = n, { ctrlX: d, ctrlY: y } = o, { x: v, y: C } = H(o);
|
|
918
|
+
i.style.cssText = `top:${l}px;left:${u}px;`, r.style.cssText = `top:${y}px;left:${d}px;`, j(c, w, g, u, l), j(a, d, y, v, C), t.helper1 = pt.create(i), t.helper2 = pt.create(r), t.helper1.init(f, (b, S) => {
|
|
919
|
+
u = u + b / t.scaleVal, l = l + S / t.scaleVal;
|
|
920
|
+
const x = H({ ...n, ctrlX: u, ctrlY: l });
|
|
921
|
+
w = x.x, g = x.y, i.style.top = l + "px", i.style.left = u + "px", ut(p, w, g, u, l, d, y, v, C, e), j(c, w, g, u, l), e.delta1.x = u - n.cx, e.delta1.y = l - n.cy, m.fire("updateArrowDelta", e);
|
|
922
|
+
}), t.helper2.init(f, (b, S) => {
|
|
923
|
+
d = d + b / t.scaleVal, y = y + S / t.scaleVal;
|
|
924
|
+
const x = H({ ...o, ctrlX: d, ctrlY: y });
|
|
925
|
+
v = x.x, C = x.y, r.style.top = y + "px", r.style.left = d + "px", ut(p, w, g, u, l, d, y, v, C, e), j(a, d, y, v, C), e.delta2.x = d - o.cx, e.delta2.y = y - o.cy, m.fire("updateArrowDelta", e);
|
|
922
926
|
});
|
|
923
927
|
};
|
|
924
|
-
function
|
|
928
|
+
function Oe() {
|
|
925
929
|
this.linkSvgGroup.innerHTML = "";
|
|
926
930
|
for (let t = 0; t < this.arrows.length; t++) {
|
|
927
931
|
const e = this.arrows[t];
|
|
928
932
|
try {
|
|
929
|
-
|
|
933
|
+
it(this, this.findEle(e.from), this.findEle(e.to), e, !0);
|
|
930
934
|
} catch {
|
|
931
935
|
}
|
|
932
936
|
}
|
|
933
937
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
934
938
|
}
|
|
935
|
-
function
|
|
936
|
-
|
|
939
|
+
function Ge(t) {
|
|
940
|
+
Z(this), t && t.labelEl && St(this, t.labelEl, t.arrowObj);
|
|
937
941
|
}
|
|
938
|
-
function
|
|
939
|
-
this.arrows = this.arrows.filter((t) =>
|
|
942
|
+
function Fe() {
|
|
943
|
+
this.arrows = this.arrows.filter((t) => _(t.from, this.nodeData) && _(t.to, this.nodeData));
|
|
940
944
|
}
|
|
941
|
-
const
|
|
945
|
+
const Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
942
946
|
__proto__: null,
|
|
943
|
-
createArrow:
|
|
944
|
-
createArrowFrom:
|
|
945
|
-
editArrowLabel:
|
|
946
|
-
removeArrow:
|
|
947
|
-
renderArrow:
|
|
948
|
-
selectArrow:
|
|
949
|
-
tidyArrow:
|
|
950
|
-
unselectArrow:
|
|
951
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
947
|
+
createArrow: Ae,
|
|
948
|
+
createArrowFrom: Ne,
|
|
949
|
+
editArrowLabel: Ge,
|
|
950
|
+
removeArrow: Me,
|
|
951
|
+
renderArrow: Oe,
|
|
952
|
+
selectArrow: Pe,
|
|
953
|
+
tidyArrow: Fe,
|
|
954
|
+
unselectArrow: He
|
|
955
|
+
}, Symbol.toStringTag, { value: "Module" })), ze = function(t) {
|
|
952
956
|
if (t.length === 0) throw new Error("No selected node.");
|
|
953
957
|
if (t.length === 1) {
|
|
954
958
|
const a = t[0].nodeObj, h = t[0].nodeObj.parent;
|
|
@@ -965,8 +969,8 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
965
969
|
let h = a.nodeObj;
|
|
966
970
|
const f = [];
|
|
967
971
|
for (; h.parent; ) {
|
|
968
|
-
const p = h.parent,
|
|
969
|
-
h = p, f.unshift({ node: h, index:
|
|
972
|
+
const p = h.parent, w = p.children?.indexOf(h);
|
|
973
|
+
h = p, f.unshift({ node: h, index: w });
|
|
970
974
|
}
|
|
971
975
|
return f.length > e && (e = f.length), f;
|
|
972
976
|
});
|
|
@@ -986,10 +990,10 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
986
990
|
end: r
|
|
987
991
|
};
|
|
988
992
|
}, Re = function(t) {
|
|
989
|
-
const e = document.createElementNS(
|
|
993
|
+
const e = document.createElementNS(D, "g");
|
|
990
994
|
return e.setAttribute("id", t), e;
|
|
991
|
-
},
|
|
992
|
-
const n = document.createElementNS(
|
|
995
|
+
}, gt = function(t, e) {
|
|
996
|
+
const n = document.createElementNS(D, "path");
|
|
993
997
|
return E(n, {
|
|
994
998
|
d: t,
|
|
995
999
|
stroke: e || "#666",
|
|
@@ -997,69 +1001,69 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
997
1001
|
"stroke-linecap": "round",
|
|
998
1002
|
"stroke-width": "2"
|
|
999
1003
|
}), n;
|
|
1000
|
-
}, Ye = (t) => t.parentElement.parentElement,
|
|
1004
|
+
}, Ye = (t) => t.parentElement.parentElement, je = function(t, { parent: e, start: n }) {
|
|
1001
1005
|
const o = t.findEle(e), s = o.nodeObj;
|
|
1002
1006
|
let i;
|
|
1003
1007
|
return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
|
|
1004
|
-
},
|
|
1005
|
-
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: a, theme: h, summarySvg: f } = t, m = t.findEle(s).nodeObj,
|
|
1008
|
+
}, rt = function(t, e) {
|
|
1009
|
+
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: a, theme: h, summarySvg: f } = t, m = t.findEle(s).nodeObj, w = je(t, e);
|
|
1006
1010
|
let g = 1 / 0, u = 0, l = 0, d = 0;
|
|
1007
|
-
for (let
|
|
1008
|
-
const
|
|
1009
|
-
if (!
|
|
1011
|
+
for (let F = i; F <= r; F++) {
|
|
1012
|
+
const ct = m.children?.[F];
|
|
1013
|
+
if (!ct)
|
|
1010
1014
|
return t.removeSummary(n), null;
|
|
1011
|
-
const R = Ye(t.findEle(
|
|
1012
|
-
|
|
1015
|
+
const R = Ye(t.findEle(ct.id)), { offsetLeft: Y, offsetTop: lt } = A(a, R), at = i === r ? 10 : 20;
|
|
1016
|
+
F === i && (l = lt + at), F === r && (d = lt + R.offsetHeight - at), Y < g && (g = Y), R.offsetWidth + Y > u && (u = R.offsetWidth + Y);
|
|
1013
1017
|
}
|
|
1014
|
-
let
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1017
|
-
const
|
|
1018
|
-
return
|
|
1019
|
-
},
|
|
1018
|
+
let y, v;
|
|
1019
|
+
const C = m.parent ? 10 : 0, b = l + C, S = d + C, x = (b + S) / 2, k = c?.stroke || h.cssVar["--color"], $ = c?.labelColor || h.cssVar["--color"], W = "s-" + n, O = t.markdown ? t.markdown(o, e) : o;
|
|
1020
|
+
w === I.LHS ? (y = gt(`M ${g + 10} ${b} c -5 0 -10 5 -10 10 L ${g} ${S - 10} c 0 5 5 10 10 10 M ${g} ${x} h -10`, k), v = et(O, g - 20, x, { anchor: "end", color: $, dataType: "summary", svgId: W })) : (y = gt(`M ${u - 10} ${b} c 5 0 10 5 10 10 L ${u} ${S - 10} c 0 5 -5 10 -10 10 M ${u} ${x} h 10`, k), v = et(O, u + 20, x, { anchor: "start", color: $, dataType: "summary", svgId: W }));
|
|
1021
|
+
const G = Re(W);
|
|
1022
|
+
return G.appendChild(y), t.labelContainer.appendChild(v), Q(v), G.summaryObj = e, G.labelEl = v, f.appendChild(G), G;
|
|
1023
|
+
}, Xe = function(t = {}) {
|
|
1020
1024
|
if (!this.currentNodes) return;
|
|
1021
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } =
|
|
1025
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = ze(e), c = { id: z(), parent: s, start: i, end: r, label: "summary", style: t.style }, a = rt(this, c);
|
|
1022
1026
|
n.push(c), this.editSummary(a), o.fire("operation", {
|
|
1023
1027
|
name: "createSummary",
|
|
1024
1028
|
obj: c
|
|
1025
1029
|
});
|
|
1026
|
-
},
|
|
1027
|
-
const e =
|
|
1028
|
-
|
|
1030
|
+
}, qe = function(t) {
|
|
1031
|
+
const e = z(), n = { ...t, id: e };
|
|
1032
|
+
rt(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
1029
1033
|
name: "createSummary",
|
|
1030
1034
|
obj: n
|
|
1031
1035
|
});
|
|
1032
|
-
},
|
|
1036
|
+
}, _e = function(t) {
|
|
1033
1037
|
const e = this.summaries.findIndex((n) => n.id === t);
|
|
1034
1038
|
e > -1 && (this.summaries.splice(e, 1), this.nodes.querySelector("#s-" + t)?.remove(), this.nodes.querySelector("#label-s-" + t)?.remove()), this.bus.fire("operation", {
|
|
1035
1039
|
name: "removeSummary",
|
|
1036
1040
|
obj: { id: t }
|
|
1037
1041
|
});
|
|
1038
|
-
},
|
|
1042
|
+
}, Ue = function(t) {
|
|
1039
1043
|
const e = t.labelEl;
|
|
1040
1044
|
e && e.classList.add("selected"), this.currentSummary = t;
|
|
1041
|
-
}, Ue = function() {
|
|
1042
|
-
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
1043
1045
|
}, Ke = function() {
|
|
1046
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
1047
|
+
}, Je = function() {
|
|
1044
1048
|
this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
|
|
1045
1049
|
try {
|
|
1046
|
-
|
|
1050
|
+
rt(this, t);
|
|
1047
1051
|
} catch {
|
|
1048
1052
|
}
|
|
1049
1053
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1050
|
-
},
|
|
1051
|
-
t && t.labelEl &&
|
|
1052
|
-
},
|
|
1054
|
+
}, Qe = function(t) {
|
|
1055
|
+
t && t.labelEl && St(this, t.labelEl, t.summaryObj);
|
|
1056
|
+
}, Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1053
1057
|
__proto__: null,
|
|
1054
|
-
createSummary:
|
|
1055
|
-
createSummaryFrom:
|
|
1056
|
-
editSummary:
|
|
1057
|
-
removeSummary:
|
|
1058
|
-
renderSummary:
|
|
1059
|
-
selectSummary:
|
|
1060
|
-
unselectSummary:
|
|
1058
|
+
createSummary: Xe,
|
|
1059
|
+
createSummaryFrom: qe,
|
|
1060
|
+
editSummary: Qe,
|
|
1061
|
+
removeSummary: _e,
|
|
1062
|
+
renderSummary: Je,
|
|
1063
|
+
selectSummary: Ue,
|
|
1064
|
+
unselectSummary: Ke
|
|
1061
1065
|
}, Symbol.toStringTag, { value: "Module" })), T = "http://www.w3.org/2000/svg";
|
|
1062
|
-
function
|
|
1066
|
+
function tn(t, e) {
|
|
1063
1067
|
const n = document.createElementNS(T, "svg");
|
|
1064
1068
|
return E(n, {
|
|
1065
1069
|
version: "1.1",
|
|
@@ -1068,10 +1072,10 @@ function Ze(t, e) {
|
|
|
1068
1072
|
width: e
|
|
1069
1073
|
}), n;
|
|
1070
1074
|
}
|
|
1071
|
-
function
|
|
1075
|
+
function en(t, e) {
|
|
1072
1076
|
return (parseInt(t) - parseInt(e)) / 2;
|
|
1073
1077
|
}
|
|
1074
|
-
function
|
|
1078
|
+
function nn(t, e, n, o) {
|
|
1075
1079
|
const s = document.createElementNS(T, "g");
|
|
1076
1080
|
let i = "";
|
|
1077
1081
|
return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
|
|
@@ -1079,7 +1083,7 @@ function en(t, e, n, o) {
|
|
|
1079
1083
|
const h = document.createElementNS(T, "text");
|
|
1080
1084
|
E(h, {
|
|
1081
1085
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1082
|
-
y: o + parseInt(e.paddingTop) +
|
|
1086
|
+
y: o + parseInt(e.paddingTop) + en(e.lineHeight, e.fontSize) * (a + 1) + parseFloat(e.fontSize) * (a + 1) + "",
|
|
1083
1087
|
"text-anchor": "start",
|
|
1084
1088
|
"font-family": e.fontFamily,
|
|
1085
1089
|
"font-size": `${e.fontSize}`,
|
|
@@ -1088,7 +1092,7 @@ function en(t, e, n, o) {
|
|
|
1088
1092
|
}), h.innerHTML = c, s.appendChild(h);
|
|
1089
1093
|
}), s;
|
|
1090
1094
|
}
|
|
1091
|
-
function
|
|
1095
|
+
function on(t, e, n, o) {
|
|
1092
1096
|
let s = "";
|
|
1093
1097
|
t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
|
|
1094
1098
|
const i = document.createElementNS(T, "foreignObject");
|
|
@@ -1104,8 +1108,8 @@ function nn(t, e, n, o) {
|
|
|
1104
1108
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1105
1109
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1106
1110
|
}
|
|
1107
|
-
function
|
|
1108
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1111
|
+
function sn(t, e) {
|
|
1112
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = A(t.nodes, e), i = document.createElementNS(T, "rect");
|
|
1109
1113
|
return E(i, {
|
|
1110
1114
|
x: o + "",
|
|
1111
1115
|
y: s + "",
|
|
@@ -1118,8 +1122,8 @@ function on(t, e) {
|
|
|
1118
1122
|
"stroke-width": n.borderWidth
|
|
1119
1123
|
}), i;
|
|
1120
1124
|
}
|
|
1121
|
-
function
|
|
1122
|
-
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } =
|
|
1125
|
+
function X(t, e, n = !1) {
|
|
1126
|
+
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = A(t.nodes, e), r = document.createElementNS(T, "rect");
|
|
1123
1127
|
E(r, {
|
|
1124
1128
|
x: s + "",
|
|
1125
1129
|
y: i + "",
|
|
@@ -1134,10 +1138,10 @@ function j(t, e, n = !1) {
|
|
|
1134
1138
|
const c = document.createElementNS(T, "g");
|
|
1135
1139
|
c.appendChild(r);
|
|
1136
1140
|
let a;
|
|
1137
|
-
return n ? a =
|
|
1141
|
+
return n ? a = on(e, o, s, i) : a = nn(e, o, s, i), c.appendChild(a), c;
|
|
1138
1142
|
}
|
|
1139
|
-
function
|
|
1140
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1143
|
+
function rn(t, e) {
|
|
1144
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = A(t.nodes, e), i = document.createElementNS(T, "a"), r = document.createElementNS(T, "text");
|
|
1141
1145
|
return E(r, {
|
|
1142
1146
|
x: o + "",
|
|
1143
1147
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -1148,8 +1152,8 @@ function sn(t, e) {
|
|
|
1148
1152
|
fill: `${n.color}`
|
|
1149
1153
|
}), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
|
|
1150
1154
|
}
|
|
1151
|
-
function
|
|
1152
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1155
|
+
function cn(t, e) {
|
|
1156
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = A(t.nodes, e), i = document.createElementNS(T, "image");
|
|
1153
1157
|
return E(i, {
|
|
1154
1158
|
x: o + "",
|
|
1155
1159
|
y: s + "",
|
|
@@ -1158,8 +1162,8 @@ function rn(t, e) {
|
|
|
1158
1162
|
href: e.src
|
|
1159
1163
|
}), i;
|
|
1160
1164
|
}
|
|
1161
|
-
const
|
|
1162
|
-
const n = t.nodes, o = n.offsetHeight +
|
|
1165
|
+
const q = 100, ln = '<?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">', an = (t, e = !1) => {
|
|
1166
|
+
const n = t.nodes, o = n.offsetHeight + q * 2, s = n.offsetWidth + q * 2, i = tn(o + "px", s + "px"), r = document.createElementNS(T, "svg"), c = document.createElementNS(T, "rect");
|
|
1163
1167
|
E(c, {
|
|
1164
1168
|
x: "0",
|
|
1165
1169
|
y: "0",
|
|
@@ -1167,8 +1171,8 @@ const X = 100, cn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1167
1171
|
height: `${o}`,
|
|
1168
1172
|
fill: t.theme.cssVar["--bgcolor"]
|
|
1169
1173
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((p) => {
|
|
1170
|
-
const m = p.cloneNode(!0), { offsetLeft:
|
|
1171
|
-
m.setAttribute("x", `${
|
|
1174
|
+
const m = p.cloneNode(!0), { offsetLeft: w, offsetTop: g } = A(n, p.parentElement);
|
|
1175
|
+
m.setAttribute("x", `${w}`), m.setAttribute("y", `${g}`), r.appendChild(m);
|
|
1172
1176
|
});
|
|
1173
1177
|
const a = n.querySelector(".lines")?.cloneNode(!0);
|
|
1174
1178
|
a && r.appendChild(a);
|
|
@@ -1176,22 +1180,22 @@ const X = 100, cn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1176
1180
|
h && r.appendChild(h);
|
|
1177
1181
|
const f = n.querySelector(".summary")?.cloneNode(!0);
|
|
1178
1182
|
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((p) => {
|
|
1179
|
-
p.nodeObj.dangerouslySetInnerHTML ? r.appendChild(
|
|
1183
|
+
p.nodeObj.dangerouslySetInnerHTML ? r.appendChild(X(t, p, !e)) : (r.appendChild(sn(t, p)), r.appendChild(X(t, p.text, !e)));
|
|
1180
1184
|
}), n.querySelectorAll(".tags > span").forEach((p) => {
|
|
1181
|
-
r.appendChild(
|
|
1185
|
+
r.appendChild(X(t, p));
|
|
1182
1186
|
}), n.querySelectorAll(".icons > span").forEach((p) => {
|
|
1183
|
-
r.appendChild(
|
|
1187
|
+
r.appendChild(X(t, p));
|
|
1184
1188
|
}), n.querySelectorAll(".hyper-link").forEach((p) => {
|
|
1185
|
-
r.appendChild(sn(t, p));
|
|
1186
|
-
}), n.querySelectorAll("img").forEach((p) => {
|
|
1187
1189
|
r.appendChild(rn(t, p));
|
|
1190
|
+
}), n.querySelectorAll("img").forEach((p) => {
|
|
1191
|
+
r.appendChild(cn(t, p));
|
|
1188
1192
|
}), E(r, {
|
|
1189
|
-
x:
|
|
1190
|
-
y:
|
|
1193
|
+
x: q + "",
|
|
1194
|
+
y: q + "",
|
|
1191
1195
|
overflow: "visible"
|
|
1192
1196
|
}), i.appendChild(r), i;
|
|
1193
|
-
},
|
|
1194
|
-
function
|
|
1197
|
+
}, hn = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), ln + t.outerHTML);
|
|
1198
|
+
function dn(t) {
|
|
1195
1199
|
return new Promise((e, n) => {
|
|
1196
1200
|
const o = new FileReader();
|
|
1197
1201
|
o.onload = (s) => {
|
|
@@ -1201,11 +1205,11 @@ function hn(t) {
|
|
|
1201
1205
|
}, o.readAsDataURL(t);
|
|
1202
1206
|
});
|
|
1203
1207
|
}
|
|
1204
|
-
const
|
|
1205
|
-
const n =
|
|
1208
|
+
const fn = function(t = !1, e) {
|
|
1209
|
+
const n = an(this, t), o = hn(n, e);
|
|
1206
1210
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1207
|
-
},
|
|
1208
|
-
const n = this.exportSvg(t, e), o = await
|
|
1211
|
+
}, pn = async function(t = !1, e) {
|
|
1212
|
+
const n = this.exportSvg(t, e), o = await dn(n);
|
|
1209
1213
|
return new Promise((s, i) => {
|
|
1210
1214
|
const r = new Image();
|
|
1211
1215
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -1213,54 +1217,54 @@ const dn = function(t = !1, e) {
|
|
|
1213
1217
|
c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(s, "image/png", 1);
|
|
1214
1218
|
}, r.src = o, r.onerror = i;
|
|
1215
1219
|
});
|
|
1216
|
-
},
|
|
1220
|
+
}, un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1217
1221
|
__proto__: null,
|
|
1218
|
-
exportPng:
|
|
1219
|
-
exportSvg:
|
|
1220
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1221
|
-
getObjById:
|
|
1222
|
-
generateNewObj:
|
|
1223
|
-
layout:
|
|
1224
|
-
linkDiv:
|
|
1225
|
-
editTopic:
|
|
1226
|
-
createWrapper:
|
|
1227
|
-
createParent:
|
|
1228
|
-
createChildren:
|
|
1229
|
-
createTopic:
|
|
1230
|
-
findEle:
|
|
1231
|
-
changeTheme:
|
|
1222
|
+
exportPng: pn,
|
|
1223
|
+
exportSvg: fn
|
|
1224
|
+
}, Symbol.toStringTag, { value: "Module" })), gn = {}, mn = {
|
|
1225
|
+
getObjById: _,
|
|
1226
|
+
generateNewObj: Dt,
|
|
1227
|
+
layout: Mt,
|
|
1228
|
+
linkDiv: zt,
|
|
1229
|
+
editTopic: Gt,
|
|
1230
|
+
createWrapper: Bt,
|
|
1231
|
+
createParent: It,
|
|
1232
|
+
createChildren: Wt,
|
|
1233
|
+
createTopic: Ot,
|
|
1234
|
+
findEle: bt,
|
|
1235
|
+
changeTheme: te,
|
|
1232
1236
|
...Le,
|
|
1237
|
+
...gn,
|
|
1238
|
+
...Ve,
|
|
1239
|
+
...Ze,
|
|
1233
1240
|
...un,
|
|
1234
|
-
...Fe,
|
|
1235
|
-
...Qe,
|
|
1236
|
-
...pn,
|
|
1237
1241
|
init(t) {
|
|
1238
1242
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
|
|
1239
|
-
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData,
|
|
1243
|
+
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, st(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Zt(this), this.layout(), this.linkDiv(), this.toCenter();
|
|
1240
1244
|
},
|
|
1241
1245
|
destroy() {
|
|
1242
1246
|
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;
|
|
1243
1247
|
}
|
|
1244
1248
|
};
|
|
1245
|
-
function
|
|
1249
|
+
function yn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, containerHeight: h }) {
|
|
1246
1250
|
let f = e + n / 2;
|
|
1247
1251
|
const p = t + o / 2;
|
|
1248
1252
|
let m;
|
|
1249
1253
|
a === I.LHS ? m = i + r : m = i;
|
|
1250
|
-
const
|
|
1251
|
-
return a === I.LHS ? f = f - n / 10 - u : f = f + n / 10 + u, `M ${f} ${p} Q ${f} ${
|
|
1254
|
+
const w = s + c / 2, u = (1 - Math.abs(w - p) / h) * 0.25 * (n / 2);
|
|
1255
|
+
return a === I.LHS ? f = f - n / 10 - u : f = f + n / 10 + u, `M ${f} ${p} Q ${f} ${w} ${m} ${w}`;
|
|
1252
1256
|
}
|
|
1253
|
-
function
|
|
1257
|
+
function wn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, isFirst: h }) {
|
|
1254
1258
|
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
1255
1259
|
let p = 0, m = 0;
|
|
1256
1260
|
h ? p = t + o / 2 : p = t + o;
|
|
1257
|
-
const
|
|
1261
|
+
const w = s + c;
|
|
1258
1262
|
let g = 0, u = 0, l = 0;
|
|
1259
|
-
const d = Math.abs(p -
|
|
1260
|
-
return a === I.LHS ? (l = e, g = l + f, u = l - f, m = i + f, `M ${g} ${p} C ${l} ${p} ${l + d} ${
|
|
1263
|
+
const d = Math.abs(p - w) / 300 * f;
|
|
1264
|
+
return a === I.LHS ? (l = e, g = l + f, u = l - f, m = i + f, `M ${g} ${p} C ${l} ${p} ${l + d} ${w} ${u} ${w} H ${m}`) : (l = e + n, g = l - f, u = l + f, m = i + r - f, `M ${g} ${p} C ${l} ${p} ${l - d} ${w} ${u} ${w} H ${m}`);
|
|
1261
1265
|
}
|
|
1262
|
-
const
|
|
1263
|
-
function
|
|
1266
|
+
const bn = "5.3.4";
|
|
1267
|
+
function vn(t) {
|
|
1264
1268
|
return {
|
|
1265
1269
|
x: 0,
|
|
1266
1270
|
y: 0,
|
|
@@ -1276,7 +1280,7 @@ function bn(t) {
|
|
|
1276
1280
|
};
|
|
1277
1281
|
}
|
|
1278
1282
|
const P = document;
|
|
1279
|
-
function
|
|
1283
|
+
function N({
|
|
1280
1284
|
el: t,
|
|
1281
1285
|
direction: e,
|
|
1282
1286
|
locale: n,
|
|
@@ -1290,41 +1294,41 @@ function A({
|
|
|
1290
1294
|
before: f,
|
|
1291
1295
|
newTopicName: p,
|
|
1292
1296
|
allowUndo: m,
|
|
1293
|
-
generateMainBranch:
|
|
1297
|
+
generateMainBranch: w,
|
|
1294
1298
|
generateSubBranch: g,
|
|
1295
1299
|
overflowHidden: u,
|
|
1296
1300
|
theme: l,
|
|
1297
1301
|
alignment: d,
|
|
1298
|
-
scaleSensitivity:
|
|
1302
|
+
scaleSensitivity: y,
|
|
1299
1303
|
scaleMax: v,
|
|
1300
|
-
scaleMin:
|
|
1301
|
-
handleWheel:
|
|
1302
|
-
markdown:
|
|
1303
|
-
imageProxy:
|
|
1304
|
+
scaleMin: C,
|
|
1305
|
+
handleWheel: b,
|
|
1306
|
+
markdown: S,
|
|
1307
|
+
imageProxy: x
|
|
1304
1308
|
}) {
|
|
1305
|
-
let
|
|
1306
|
-
const
|
|
1307
|
-
if (
|
|
1308
|
-
|
|
1309
|
-
const
|
|
1310
|
-
this.theme = l || (
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1309
|
+
let k = null;
|
|
1310
|
+
const $ = Object.prototype.toString.call(t);
|
|
1311
|
+
if ($ === "[object HTMLDivElement]" ? k = t : $ === "[object String]" && (k = document.querySelector(t)), !k) throw new Error("MindElixir: el is not a valid element");
|
|
1312
|
+
k.style.position = "relative", k.innerHTML = "", this.el = k, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.newTopicName = p || "New Node", this.contextMenu = i ?? !0, this.toolBar = r ?? !0, this.keypress = c ?? !0, this.mouseSelectionButton = a ?? 0, this.direction = e ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = m ?? !0, this.scaleSensitivity = y ?? 0.1, this.scaleMax = v ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = w || yn, this.generateSubBranch = g || wn, this.overflowHidden = u ?? !1, this.alignment = d ?? "root", this.handleWheel = b ?? !0, this.markdown = S || void 0, this.imageProxy = x || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = vn(this), this.bus = Nt(), this.container = P.createElement("div"), this.selectionContainer = h || this.container, this.container.className = "map-container";
|
|
1313
|
+
const W = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1314
|
+
this.theme = l || (W.matches ? ot : nt);
|
|
1315
|
+
const O = P.createElement("div");
|
|
1316
|
+
O.className = "map-canvas", this.map = O, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = P.createElement("me-nodes"), this.lines = V("lines"), this.summarySvg = V("summary"), this.linkController = V("linkcontroller"), this.P2 = P.createElement("div"), this.P3 = P.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = ft(), this.line2 = ft(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = V("topiclinks"), this.labelContainer = P.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(At(this));
|
|
1313
1317
|
}
|
|
1314
|
-
|
|
1315
|
-
Object.defineProperty(
|
|
1318
|
+
N.prototype = mn;
|
|
1319
|
+
Object.defineProperty(N.prototype, "currentNode", {
|
|
1316
1320
|
get() {
|
|
1317
1321
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
1318
1322
|
},
|
|
1319
1323
|
enumerable: !0
|
|
1320
1324
|
});
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1325
|
+
N.LEFT = 0;
|
|
1326
|
+
N.RIGHT = 1;
|
|
1327
|
+
N.SIDE = 2;
|
|
1328
|
+
N.THEME = nt;
|
|
1329
|
+
N.DARK_THEME = ot;
|
|
1330
|
+
N.version = bn;
|
|
1331
|
+
N.E = bt;
|
|
1328
1332
|
export {
|
|
1329
|
-
|
|
1333
|
+
N as default
|
|
1330
1334
|
};
|