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