mind-elixir 4.3.5 → 4.3.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 +6 -6
- package/dist/MindElixir.js +572 -568
- package/dist/MindElixirLite.iife.js +6 -6
- package/dist/MindElixirLite.js +342 -338
- package/dist/types/linkDiv.d.ts +1 -1
- package/dist/types/nodeOperation.d.ts +1 -1
- package/dist/types/plugin/contextMenu.d.ts +2 -3
- package/dist/types/types/index.d.ts +8 -3
- package/dist/types/utils/generateBranch.d.ts +7 -6
- package/dist/types/utils/layout.d.ts +1 -1
- package/package.json +1 -1
- package/readme.md +21 -4
- package/readme.cn.md +0 -207
package/dist/MindElixirLite.js
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
} catch {
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function h() {
|
|
14
14
|
i || (i = !0, o());
|
|
15
15
|
}
|
|
16
16
|
t = function() {
|
|
17
|
-
var
|
|
18
|
-
(p = document.createElement("div")).innerHTML = c, c = null, (
|
|
17
|
+
var a, d, f, p;
|
|
18
|
+
(p = document.createElement("div")).innerHTML = c, c = null, (f = p.getElementsByTagName("svg")[0]) && (f.setAttribute("aria-hidden", "true"), f.style.position = "absolute", f.style.width = 0, f.style.height = 0, f.style.overflow = "hidden", a = f, (d = document.body).firstChild ? (p = a, (f = d.firstChild).parentNode.insertBefore(p, f)) : d.appendChild(a));
|
|
19
19
|
}, document.addEventListener ? ~["complete", "loaded", "interactive"].indexOf(document.readyState) ? setTimeout(t, 0) : (n = function() {
|
|
20
20
|
document.removeEventListener("DOMContentLoaded", n, !1), t();
|
|
21
21
|
}, document.addEventListener("DOMContentLoaded", n, !1)) : document.attachEvent && (o = t, s = e.document, i = !1, (r = function() {
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
} catch {
|
|
25
25
|
return void setTimeout(r, 50);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
h();
|
|
28
28
|
})(), s.onreadystatechange = function() {
|
|
29
|
-
s.readyState == "complete" && (s.onreadystatechange = null,
|
|
29
|
+
s.readyState == "complete" && (s.onreadystatechange = null, h());
|
|
30
30
|
});
|
|
31
31
|
})(window);
|
|
32
|
-
const D = 0, W = 1,
|
|
32
|
+
const D = 0, W = 1, G = 2, ie = {
|
|
33
33
|
name: "Latte",
|
|
34
34
|
type: "light",
|
|
35
35
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -43,7 +43,7 @@ const D = 0, W = 1, R = 2, se = {
|
|
|
43
43
|
"--panel-bgcolor": "#ffffff",
|
|
44
44
|
"--panel-border-color": "#eaeaea"
|
|
45
45
|
}
|
|
46
|
-
},
|
|
46
|
+
}, re = {
|
|
47
47
|
name: "Dark",
|
|
48
48
|
type: "dark",
|
|
49
49
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -57,48 +57,48 @@ const D = 0, W = 1, R = 2, se = {
|
|
|
57
57
|
"--panel-border-color": "#696969"
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
function
|
|
60
|
+
function Z(e) {
|
|
61
61
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const I = function(e, t) {
|
|
64
64
|
if (t.id === e)
|
|
65
65
|
return t;
|
|
66
66
|
if (t.children && t.children.length) {
|
|
67
67
|
for (let n = 0; n < t.children.length; n++) {
|
|
68
|
-
const o =
|
|
68
|
+
const o = I(e, t.children[n]);
|
|
69
69
|
if (o)
|
|
70
70
|
return o;
|
|
71
71
|
}
|
|
72
72
|
return null;
|
|
73
73
|
} else
|
|
74
74
|
return null;
|
|
75
|
-
},
|
|
75
|
+
}, Y = (e, t) => {
|
|
76
76
|
if (e.parent = t, e.children)
|
|
77
77
|
for (let n = 0; n < e.children.length; n++)
|
|
78
|
-
|
|
78
|
+
Y(e.children[n], e);
|
|
79
79
|
};
|
|
80
|
-
function
|
|
80
|
+
function ce(e, t, n, o) {
|
|
81
81
|
const s = o - t, i = e - n;
|
|
82
82
|
let r = Math.atan(Math.abs(s) / Math.abs(i)) / 3.14 * 180;
|
|
83
83
|
i < 0 && s > 0 && (r = 180 - r), i < 0 && s < 0 && (r = 180 + r), i > 0 && s < 0 && (r = 360 - r);
|
|
84
|
-
const c = 15, l = 30,
|
|
84
|
+
const c = 15, l = 30, h = r + l, a = r - l;
|
|
85
85
|
return {
|
|
86
|
-
x1: n + Math.cos(Math.PI *
|
|
87
|
-
y1: o - Math.sin(Math.PI *
|
|
88
|
-
x2: n + Math.cos(Math.PI *
|
|
89
|
-
y2: o - Math.sin(Math.PI *
|
|
86
|
+
x1: n + Math.cos(Math.PI * h / 180) * c,
|
|
87
|
+
y1: o - Math.sin(Math.PI * h / 180) * c,
|
|
88
|
+
x2: n + Math.cos(Math.PI * a / 180) * c,
|
|
89
|
+
y2: o - Math.sin(Math.PI * a / 180) * c
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function X() {
|
|
93
93
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
94
94
|
}
|
|
95
|
-
const
|
|
96
|
-
const e =
|
|
95
|
+
const ve = function() {
|
|
96
|
+
const e = X();
|
|
97
97
|
return {
|
|
98
98
|
topic: this.newTopicName,
|
|
99
99
|
id: e
|
|
100
100
|
};
|
|
101
|
-
},
|
|
101
|
+
}, T = (e, t) => {
|
|
102
102
|
let n = 0, o = 0;
|
|
103
103
|
for (; t && t !== e; )
|
|
104
104
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
@@ -106,7 +106,7 @@ const ye = function() {
|
|
|
106
106
|
}, v = (e, t) => {
|
|
107
107
|
for (const n in t)
|
|
108
108
|
e.setAttribute(n, t[n]);
|
|
109
|
-
},
|
|
109
|
+
}, ee = (e) => e ? e.tagName === "ME-TPC" : !1, N = {
|
|
110
110
|
moved: !1,
|
|
111
111
|
// diffrentiate click and move
|
|
112
112
|
mousedown: !1,
|
|
@@ -123,7 +123,7 @@ const ye = function() {
|
|
|
123
123
|
}, 0);
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
|
-
function
|
|
126
|
+
function xe(e) {
|
|
127
127
|
e.map.addEventListener("click", (t) => {
|
|
128
128
|
var o, s;
|
|
129
129
|
if (t.button !== 0)
|
|
@@ -136,15 +136,15 @@ function ve(e) {
|
|
|
136
136
|
e.helper2.clear();
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
if (
|
|
140
|
-
|
|
139
|
+
if (N.moved) {
|
|
140
|
+
N.clear();
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
e.clearSelection();
|
|
144
144
|
const n = t.target;
|
|
145
145
|
if (n.tagName === "ME-EPD")
|
|
146
146
|
e.expandNode(n.previousSibling);
|
|
147
|
-
else if (
|
|
147
|
+
else if (ee(n))
|
|
148
148
|
e.selectNode(n, !1, t);
|
|
149
149
|
else if (e.editable)
|
|
150
150
|
n.tagName === "text" ? n.dataset.type === "custom-link" ? e.selectArrow(n.parentElement) : e.selectSummary(n.parentElement) : n.className;
|
|
@@ -154,21 +154,21 @@ function ve(e) {
|
|
|
154
154
|
if (!e.editable)
|
|
155
155
|
return;
|
|
156
156
|
const n = t.target;
|
|
157
|
-
|
|
157
|
+
ee(n) ? e.beginEdit(n) : n.tagName === "text" && (n.dataset.type === "custom-link" ? e.editArrowLabel(n.parentElement) : e.editSummary(n.parentElement));
|
|
158
158
|
}), e.map.addEventListener("mousemove", (t) => {
|
|
159
|
-
t.target.contentEditable !== "true" &&
|
|
159
|
+
t.target.contentEditable !== "true" && N.onMove(t, e.container);
|
|
160
160
|
}), e.map.addEventListener("mousedown", (t) => {
|
|
161
161
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
162
|
-
t.button === n && t.target.contentEditable !== "true" && (
|
|
162
|
+
t.button === n && t.target.contentEditable !== "true" && (N.moved = !1, N.mousedown = !0);
|
|
163
163
|
}), e.map.addEventListener("mouseleave", (t) => {
|
|
164
164
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
165
|
-
t.button === n &&
|
|
165
|
+
t.button === n && N.clear();
|
|
166
166
|
}), e.map.addEventListener("mouseup", (t) => {
|
|
167
167
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
168
|
-
t.button === n &&
|
|
168
|
+
t.button === n && N.clear();
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
-
const
|
|
171
|
+
const be = {
|
|
172
172
|
create() {
|
|
173
173
|
return {
|
|
174
174
|
handlers: {},
|
|
@@ -196,43 +196,45 @@ const xe = {
|
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
}
|
|
199
|
+
};
|
|
200
|
+
var M = /* @__PURE__ */ ((e) => (e.LHS = "lhs", e.RHS = "rhs", e))(M || {});
|
|
201
|
+
const R = document, we = function() {
|
|
200
202
|
this.nodes.innerHTML = "";
|
|
201
203
|
const e = this.createTopic(this.nodeData);
|
|
202
|
-
|
|
203
|
-
const t =
|
|
204
|
+
le(e, this.nodeData), e.draggable = !1;
|
|
205
|
+
const t = R.createElement("me-root");
|
|
204
206
|
t.appendChild(e);
|
|
205
207
|
const n = this.nodeData.children || [];
|
|
206
|
-
if (this.direction ===
|
|
208
|
+
if (this.direction === G) {
|
|
207
209
|
let o = 0, s = 0;
|
|
208
210
|
n.map((i) => {
|
|
209
211
|
i.direction === D ? o += 1 : i.direction === W ? s += 1 : o <= s ? (i.direction = D, o += 1) : (i.direction = W, s += 1);
|
|
210
212
|
});
|
|
211
213
|
}
|
|
212
|
-
|
|
213
|
-
},
|
|
214
|
-
const o =
|
|
215
|
-
o.className =
|
|
216
|
-
const s =
|
|
217
|
-
s.className =
|
|
214
|
+
Ce(this, n, t);
|
|
215
|
+
}, Ce = function(e, t, n) {
|
|
216
|
+
const o = R.createElement("me-main");
|
|
217
|
+
o.className = M.LHS;
|
|
218
|
+
const s = R.createElement("me-main");
|
|
219
|
+
s.className = M.RHS;
|
|
218
220
|
for (let i = 0; i < t.length; i++) {
|
|
219
221
|
const r = t[i], { grp: c } = e.createWrapper(r);
|
|
220
|
-
e.direction ===
|
|
222
|
+
e.direction === G ? r.direction === D ? o.appendChild(c) : s.appendChild(c) : e.direction === D ? o.appendChild(c) : s.appendChild(c);
|
|
221
223
|
}
|
|
222
224
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines);
|
|
223
|
-
},
|
|
224
|
-
const n =
|
|
225
|
+
}, Ee = function(e, t) {
|
|
226
|
+
const n = R.createElement("me-children");
|
|
225
227
|
for (let o = 0; o < t.length; o++) {
|
|
226
228
|
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
227
229
|
n.appendChild(i);
|
|
228
230
|
}
|
|
229
231
|
return n;
|
|
230
|
-
}, E = document,
|
|
232
|
+
}, E = document, L = (e, t) => {
|
|
231
233
|
const o = (t ? t.mindElixirBox : E).querySelector(`[data-nodeid=me${e}]`);
|
|
232
234
|
if (!o)
|
|
233
235
|
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
234
236
|
return o;
|
|
235
|
-
},
|
|
237
|
+
}, le = function(e, t) {
|
|
236
238
|
if (e.innerHTML = "", t.style && (e.style.color = t.style.color || "", e.style.background = t.style.background || "", e.style.fontSize = t.style.fontSize + "px", e.style.fontWeight = t.style.fontWeight || "normal"), t.dangerouslySetInnerHTML) {
|
|
237
239
|
e.innerHTML = t.dangerouslySetInnerHTML;
|
|
238
240
|
return;
|
|
@@ -256,41 +258,41 @@ const xe = {
|
|
|
256
258
|
e.link && (e.link = void 0);
|
|
257
259
|
if (t.icons && t.icons.length) {
|
|
258
260
|
const n = E.createElement("span");
|
|
259
|
-
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${
|
|
261
|
+
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${Z(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
260
262
|
} else
|
|
261
263
|
e.icons && (e.icons = void 0);
|
|
262
264
|
if (t.tags && t.tags.length) {
|
|
263
265
|
const n = E.createElement("div");
|
|
264
|
-
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${
|
|
266
|
+
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${Z(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
|
|
265
267
|
} else
|
|
266
268
|
e.tags && (e.tags = void 0);
|
|
267
|
-
},
|
|
269
|
+
}, Se = function(e, t) {
|
|
268
270
|
const n = E.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
269
271
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
270
|
-
const i =
|
|
272
|
+
const i = Te(e.expanded);
|
|
271
273
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
272
|
-
const r =
|
|
274
|
+
const r = Ee(this, e.children);
|
|
273
275
|
n.appendChild(r);
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
return { grp: n, top: o, tpc: s };
|
|
277
279
|
}, Le = function(e) {
|
|
278
280
|
const t = E.createElement("me-parent"), n = this.createTopic(e);
|
|
279
|
-
return
|
|
280
|
-
},
|
|
281
|
+
return le(n, e), t.appendChild(n), { p: t, tpc: n };
|
|
282
|
+
}, Me = function(e) {
|
|
281
283
|
const t = E.createElement("me-children");
|
|
282
284
|
return t.append(...e), t;
|
|
283
|
-
},
|
|
285
|
+
}, $e = function(e) {
|
|
284
286
|
const t = E.createElement("me-tpc");
|
|
285
287
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
286
288
|
};
|
|
287
|
-
function
|
|
289
|
+
function ae(e) {
|
|
288
290
|
const t = E.createRange();
|
|
289
291
|
t.selectNodeContents(e);
|
|
290
292
|
const n = window.getSelection();
|
|
291
293
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
292
294
|
}
|
|
293
|
-
const
|
|
295
|
+
const Ne = function(e) {
|
|
294
296
|
if (!e)
|
|
295
297
|
return;
|
|
296
298
|
const t = E.createElement("div"), n = e.text.textContent;
|
|
@@ -302,7 +304,7 @@ const $e = function(e) {
|
|
|
302
304
|
margin:${o.margin};
|
|
303
305
|
font:${o.font};
|
|
304
306
|
background-color:${o.backgroundColor !== "rgba(0, 0, 0, 0)" && o.backgroundColor};
|
|
305
|
-
border-radius:${o.borderRadius};`, this.direction === D && (t.style.right = "0"), t.focus(),
|
|
307
|
+
border-radius:${o.borderRadius};`, this.direction === D && (t.style.right = "0"), t.focus(), ae(t), this.bus.fire("operation", {
|
|
306
308
|
name: "beginEdit",
|
|
307
309
|
obj: e.nodeObj
|
|
308
310
|
}), t.addEventListener("keydown", (s) => {
|
|
@@ -324,30 +326,30 @@ const $e = function(e) {
|
|
|
324
326
|
origin: n
|
|
325
327
|
}));
|
|
326
328
|
});
|
|
327
|
-
},
|
|
329
|
+
}, Te = function(e) {
|
|
328
330
|
const t = E.createElement("me-epd");
|
|
329
331
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
330
|
-
},
|
|
331
|
-
const o =
|
|
332
|
+
}, A = document, B = "http://www.w3.org/2000/svg", de = function(e, t, n) {
|
|
333
|
+
const o = A.createElementNS(B, "path");
|
|
332
334
|
return v(o, {
|
|
333
335
|
d: e,
|
|
334
336
|
stroke: t || "#666",
|
|
335
337
|
fill: "none",
|
|
336
338
|
"stroke-width": n
|
|
337
339
|
}), o;
|
|
338
|
-
},
|
|
339
|
-
const t =
|
|
340
|
+
}, O = function(e) {
|
|
341
|
+
const t = A.createElementNS(B, "svg");
|
|
340
342
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
341
|
-
},
|
|
342
|
-
const e =
|
|
343
|
+
}, te = function() {
|
|
344
|
+
const e = A.createElementNS(B, "line");
|
|
343
345
|
return e.setAttribute("stroke", "#bbb"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e;
|
|
344
|
-
},
|
|
346
|
+
}, ke = function(e, t) {
|
|
345
347
|
const n = {
|
|
346
348
|
stroke: "rgb(235, 95, 82)",
|
|
347
349
|
fill: "none",
|
|
348
350
|
"stroke-linecap": "cap",
|
|
349
351
|
"stroke-width": "2"
|
|
350
|
-
}, o =
|
|
352
|
+
}, o = A.createElementNS(B, "g"), s = A.createElementNS(B, "path"), i = A.createElementNS(B, "path");
|
|
351
353
|
return v(i, {
|
|
352
354
|
d: t,
|
|
353
355
|
...n
|
|
@@ -371,7 +373,7 @@ const $e = function(e) {
|
|
|
371
373
|
top:${i.y}px;
|
|
372
374
|
padding: 2px 4px;
|
|
373
375
|
margin: -2px -4px;
|
|
374
|
-
`, o.focus(),
|
|
376
|
+
`, o.focus(), ae(o), o.addEventListener("keydown", (r) => {
|
|
375
377
|
r.stopPropagation();
|
|
376
378
|
const c = r.key;
|
|
377
379
|
if (c === "Enter" || c === "Tab") {
|
|
@@ -382,46 +384,46 @@ const $e = function(e) {
|
|
|
382
384
|
}), o.addEventListener("blur", () => {
|
|
383
385
|
o && n(o);
|
|
384
386
|
});
|
|
385
|
-
},
|
|
387
|
+
}, He = function(e) {
|
|
386
388
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight;
|
|
387
389
|
this.nodes.style.top = `${1e4 - this.nodes.offsetHeight / 2}px`, this.nodes.style.left = `${1e4 - o - s / 2}px`;
|
|
388
390
|
const r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
389
391
|
this.lines.innerHTML = "";
|
|
390
392
|
for (let c = 0; c < r.length; c++) {
|
|
391
|
-
const l = r[c],
|
|
392
|
-
|
|
393
|
+
const l = r[c], h = l.querySelector("me-tpc"), { offsetLeft: a, offsetTop: d } = T(this.nodes, h), f = h.offsetWidth, p = h.offsetHeight, u = l.parentNode.className, m = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: d, cL: a, cW: f, cH: p, direction: u, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, x = h.nodeObj.branchColor || g[c % g.length];
|
|
394
|
+
h.style.borderColor = x, this.lines.appendChild(de(m, x, "3"));
|
|
393
395
|
const y = l.children[0].children[1];
|
|
394
|
-
if (y && (y.style.top = (y.parentNode.offsetHeight - y.offsetHeight) / 2 + "px", u ===
|
|
396
|
+
if (y && (y.style.top = (y.parentNode.offsetHeight - y.offsetHeight) / 2 + "px", u === M.LHS ? y.style.left = "-10px" : y.style.right = "-10px"), e && e !== l)
|
|
395
397
|
continue;
|
|
396
|
-
const b =
|
|
397
|
-
C.tagName === "svg" && C.remove(), l.appendChild(b),
|
|
398
|
+
const b = O("subLines"), C = l.lastChild;
|
|
399
|
+
C.tagName === "svg" && C.remove(), l.appendChild(b), fe(this, b, x, l, u, !0);
|
|
398
400
|
}
|
|
399
401
|
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
400
|
-
},
|
|
402
|
+
}, fe = function(e, t, n, o, s, i) {
|
|
401
403
|
const r = o.firstChild, c = o.children[1].children;
|
|
402
404
|
if (c.length === 0)
|
|
403
405
|
return;
|
|
404
|
-
const l = r.offsetTop,
|
|
405
|
-
for (let
|
|
406
|
-
const p = c[
|
|
407
|
-
t.appendChild(
|
|
406
|
+
const l = r.offsetTop, h = r.offsetLeft, a = r.offsetWidth, d = r.offsetHeight;
|
|
407
|
+
for (let f = 0; f < c.length; f++) {
|
|
408
|
+
const p = c[f], u = p.firstChild, m = u.offsetTop, g = u.offsetLeft, x = u.offsetWidth, y = u.offsetHeight, b = u.firstChild.nodeObj.branchColor || n, C = e.generateSubBranch({ pT: l, pL: h, pW: a, pH: d, cT: m, cL: g, cW: x, cH: y, direction: s, isFirst: i });
|
|
409
|
+
t.appendChild(de(C, b, "2"));
|
|
408
410
|
const w = u.children[1];
|
|
409
411
|
if (w) {
|
|
410
|
-
if (w.style.bottom = -(w.offsetHeight / 2) + "px", s ===
|
|
412
|
+
if (w.style.bottom = -(w.offsetHeight / 2) + "px", s === M.LHS ? w.style.left = "10px" : s === M.RHS && (w.style.right = "10px"), !w.expanded)
|
|
411
413
|
continue;
|
|
412
414
|
} else
|
|
413
415
|
continue;
|
|
414
|
-
|
|
416
|
+
fe(e, t, b, p, s);
|
|
415
417
|
}
|
|
416
418
|
};
|
|
417
|
-
const
|
|
419
|
+
const k = (e, t) => {
|
|
418
420
|
const n = document.createElement("span");
|
|
419
421
|
return n.id = e, n.innerHTML = `<svg class="icon" aria-hidden="true">
|
|
420
422
|
<use xlink:href="#icon-${t}"></use>
|
|
421
423
|
</svg>`, n;
|
|
422
424
|
};
|
|
423
|
-
function
|
|
424
|
-
const t = document.createElement("div"), n =
|
|
425
|
+
function Ae(e) {
|
|
426
|
+
const t = document.createElement("div"), n = k("fullscreen", "full"), o = k("toCenter", "living"), s = k("zoomout", "move"), i = k("zoomin", "add"), r = document.createElement("span");
|
|
425
427
|
return r.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
426
428
|
e.mindElixirBox.requestFullscreen();
|
|
427
429
|
}, o.onclick = () => {
|
|
@@ -432,8 +434,8 @@ function He(e) {
|
|
|
432
434
|
e.scaleVal > 1.6 || e.scale(e.scaleVal + 0.2);
|
|
433
435
|
}, t;
|
|
434
436
|
}
|
|
435
|
-
function
|
|
436
|
-
const t = document.createElement("div"), n =
|
|
437
|
+
function Be(e) {
|
|
438
|
+
const t = document.createElement("div"), n = k("tbltl", "left"), o = k("tbltr", "right"), s = k("tblts", "side");
|
|
437
439
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
438
440
|
e.initLeft();
|
|
439
441
|
}, o.onclick = () => {
|
|
@@ -443,9 +445,9 @@ function Ae(e) {
|
|
|
443
445
|
}, t;
|
|
444
446
|
}
|
|
445
447
|
function De(e) {
|
|
446
|
-
e.container.append(
|
|
448
|
+
e.container.append(Ae(e)), e.container.append(Be(e));
|
|
447
449
|
}
|
|
448
|
-
const
|
|
450
|
+
const Pe = function(e, t = !0) {
|
|
449
451
|
this.theme = e;
|
|
450
452
|
const n = this.theme.cssVar, o = Object.keys(n);
|
|
451
453
|
this.mindElixirBox.style.cssText = "";
|
|
@@ -454,11 +456,11 @@ const Be = function(e, t = !0) {
|
|
|
454
456
|
this.mindElixirBox.style.setProperty(i, n[i]);
|
|
455
457
|
}
|
|
456
458
|
e.cssVar["--gap"] || this.mindElixirBox.style.setProperty("--gap", "30px"), t && this.refresh();
|
|
457
|
-
},
|
|
459
|
+
}, ze = function(e) {
|
|
458
460
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
459
461
|
(n == null ? void 0 : n.tagName) === "svg" && (n == null || n.remove());
|
|
460
462
|
};
|
|
461
|
-
function
|
|
463
|
+
function ue(e) {
|
|
462
464
|
return {
|
|
463
465
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
464
466
|
arrows: e.arrows,
|
|
@@ -467,17 +469,17 @@ function fe(e) {
|
|
|
467
469
|
theme: e.theme
|
|
468
470
|
};
|
|
469
471
|
}
|
|
470
|
-
const
|
|
472
|
+
const Oe = function(e, t, n) {
|
|
471
473
|
if (e) {
|
|
472
474
|
if (this.clearSelection(), typeof e == "string") {
|
|
473
|
-
const o =
|
|
475
|
+
const o = L(e);
|
|
474
476
|
return o ? this.selectNode(o) : void 0;
|
|
475
477
|
}
|
|
476
478
|
e.className = "selected", e.scrollIntoView({ block: "nearest", inline: "nearest" }), this.currentNode = e, t ? this.bus.fire("selectNewNode", e.nodeObj) : this.bus.fire("selectNode", e.nodeObj, n);
|
|
477
479
|
}
|
|
478
480
|
}, je = function() {
|
|
479
481
|
this.currentNode && (this.currentNode.className = ""), this.currentNode = null, this.bus.fire("unselectNode");
|
|
480
|
-
},
|
|
482
|
+
}, Ve = function(e) {
|
|
481
483
|
this.clearSelection();
|
|
482
484
|
for (const t of e)
|
|
483
485
|
t.className = "selected";
|
|
@@ -485,23 +487,23 @@ const ze = function(e, t, n) {
|
|
|
485
487
|
"selectNodes",
|
|
486
488
|
e.map((t) => t.nodeObj)
|
|
487
489
|
);
|
|
488
|
-
},
|
|
490
|
+
}, _e = function() {
|
|
489
491
|
if (this.currentNodes)
|
|
490
492
|
for (const e of this.currentNodes)
|
|
491
493
|
e.classList.remove("selected");
|
|
492
494
|
this.currentNodes = null, this.bus.fire("unselectNodes");
|
|
493
|
-
}, _e = function() {
|
|
494
|
-
this.unselectNode(), this.unselectNodes(), this.unselectSummary(), this.unselectArrow();
|
|
495
495
|
}, qe = function() {
|
|
496
|
-
|
|
496
|
+
this.unselectNode(), this.unselectNodes(), this.unselectSummary(), this.unselectArrow();
|
|
497
|
+
}, Ie = function() {
|
|
498
|
+
const e = ue(this);
|
|
497
499
|
return JSON.stringify(e, (t, n) => {
|
|
498
500
|
if (!(t === "parent" && typeof n != "string"))
|
|
499
501
|
return n;
|
|
500
502
|
});
|
|
501
|
-
},
|
|
503
|
+
}, Re = function() {
|
|
502
504
|
return JSON.parse(this.getDataString());
|
|
503
505
|
}, Fe = function() {
|
|
504
|
-
const e =
|
|
506
|
+
const e = ue(this).nodeData;
|
|
505
507
|
let t = "# " + e.topic + `
|
|
506
508
|
|
|
507
509
|
`;
|
|
@@ -515,64 +517,66 @@ const ze = function(e, t, n) {
|
|
|
515
517
|
return n(e.children || [], 2), t;
|
|
516
518
|
}, We = function() {
|
|
517
519
|
this.editable = !0;
|
|
518
|
-
},
|
|
520
|
+
}, Ge = function() {
|
|
519
521
|
this.editable = !1;
|
|
520
|
-
},
|
|
522
|
+
}, Ye = function(e) {
|
|
521
523
|
this.scaleVal = e, this.map.style.transform = "scale(" + e + ")", this.bus.fire("scale", e);
|
|
522
|
-
},
|
|
524
|
+
}, Xe = function() {
|
|
523
525
|
this.container.scrollTo(1e4 - this.container.offsetWidth / 2, 1e4 - this.container.offsetHeight / 2);
|
|
524
|
-
}, Xe = function(e) {
|
|
525
|
-
e(this);
|
|
526
526
|
}, Ue = function(e) {
|
|
527
|
+
e(this);
|
|
528
|
+
}, Je = function(e) {
|
|
527
529
|
e.nodeObj.parent && (this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
|
|
528
|
-
}, Je = function() {
|
|
529
|
-
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
530
530
|
}, Ke = function() {
|
|
531
|
-
this.direction =
|
|
531
|
+
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
532
532
|
}, Qe = function() {
|
|
533
|
-
this.direction =
|
|
533
|
+
this.direction = 0, this.refresh();
|
|
534
534
|
}, Ze = function() {
|
|
535
|
+
this.direction = 1, this.refresh();
|
|
536
|
+
}, et = function() {
|
|
535
537
|
this.direction = 2, this.refresh();
|
|
536
|
-
},
|
|
538
|
+
}, tt = function(e) {
|
|
537
539
|
this.locale = e, this.refresh();
|
|
538
|
-
},
|
|
540
|
+
}, nt = function(e, t) {
|
|
539
541
|
const n = e.nodeObj;
|
|
540
542
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
541
543
|
const o = e.parentNode, s = o.children[1];
|
|
542
|
-
if (s.expanded = n.expanded, s.className = n.expanded ? "minus" : "",
|
|
543
|
-
const
|
|
544
|
-
n.children.map((
|
|
544
|
+
if (s.expanded = n.expanded, s.className = n.expanded ? "minus" : "", ze(e), n.expanded) {
|
|
545
|
+
const l = this.createChildren(
|
|
546
|
+
n.children.map((h) => this.createWrapper(h).grp)
|
|
545
547
|
);
|
|
546
|
-
o.parentNode.appendChild(
|
|
548
|
+
o.parentNode.appendChild(l);
|
|
547
549
|
} else
|
|
548
550
|
o.parentNode.children[1].remove();
|
|
549
|
-
this.linkDiv(
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}, ot =
|
|
551
|
+
this.linkDiv(e.closest("me-main > me-wrapper"));
|
|
552
|
+
const i = e.getBoundingClientRect(), r = this.container.getBoundingClientRect();
|
|
553
|
+
(i.bottom > r.bottom || i.top < r.top || i.right > r.right || i.left < r.left) && e.scrollIntoView({ block: "center", inline: "center" }), this.bus.fire("expandNode", n);
|
|
554
|
+
}, ot = function(e) {
|
|
555
|
+
e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), Y(this.nodeData), this.layout(), this.linkDiv();
|
|
556
|
+
}, st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
553
557
|
__proto__: null,
|
|
554
|
-
cancelFocus:
|
|
555
|
-
clearSelection:
|
|
556
|
-
disableEdit:
|
|
558
|
+
cancelFocus: Ke,
|
|
559
|
+
clearSelection: qe,
|
|
560
|
+
disableEdit: Ge,
|
|
557
561
|
enableEdit: We,
|
|
558
|
-
expandNode:
|
|
559
|
-
focusNode:
|
|
560
|
-
getData:
|
|
562
|
+
expandNode: nt,
|
|
563
|
+
focusNode: Je,
|
|
564
|
+
getData: Re,
|
|
561
565
|
getDataMd: Fe,
|
|
562
|
-
getDataString:
|
|
563
|
-
initLeft:
|
|
564
|
-
initRight:
|
|
565
|
-
initSide:
|
|
566
|
-
install:
|
|
567
|
-
refresh:
|
|
568
|
-
scale:
|
|
569
|
-
selectNode:
|
|
570
|
-
selectNodes:
|
|
571
|
-
setLocale:
|
|
572
|
-
toCenter:
|
|
566
|
+
getDataString: Ie,
|
|
567
|
+
initLeft: Qe,
|
|
568
|
+
initRight: Ze,
|
|
569
|
+
initSide: et,
|
|
570
|
+
install: Ue,
|
|
571
|
+
refresh: ot,
|
|
572
|
+
scale: Ye,
|
|
573
|
+
selectNode: Oe,
|
|
574
|
+
selectNodes: Ve,
|
|
575
|
+
setLocale: tt,
|
|
576
|
+
toCenter: Xe,
|
|
573
577
|
unselectNode: je,
|
|
574
|
-
unselectNodes:
|
|
575
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
578
|
+
unselectNodes: _e
|
|
579
|
+
}, Symbol.toStringTag, { value: "Module" })), it = function(e) {
|
|
576
580
|
return {
|
|
577
581
|
dom: e,
|
|
578
582
|
moved: !1,
|
|
@@ -598,21 +602,21 @@ const ze = function(e, t, n) {
|
|
|
598
602
|
this.moved = !1, this.mousedown = !1;
|
|
599
603
|
}
|
|
600
604
|
};
|
|
601
|
-
},
|
|
602
|
-
create:
|
|
605
|
+
}, ne = {
|
|
606
|
+
create: it
|
|
603
607
|
};
|
|
604
608
|
function F(e, t, n) {
|
|
605
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
609
|
+
const { offsetLeft: o, offsetTop: s } = T(e.nodes, t), i = t.offsetWidth, r = t.offsetHeight, c = o + i / 2, l = s + r / 2, h = c + n.x, a = l + n.y;
|
|
606
610
|
return {
|
|
607
611
|
w: i,
|
|
608
612
|
h: r,
|
|
609
613
|
cx: c,
|
|
610
614
|
cy: l,
|
|
611
|
-
ctrlX:
|
|
612
|
-
ctrlY:
|
|
615
|
+
ctrlX: h,
|
|
616
|
+
ctrlY: a
|
|
613
617
|
};
|
|
614
618
|
}
|
|
615
|
-
function
|
|
619
|
+
function H(e) {
|
|
616
620
|
let t, n;
|
|
617
621
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
618
622
|
return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
|
|
@@ -620,7 +624,7 @@ function k(e) {
|
|
|
620
624
|
y: n
|
|
621
625
|
};
|
|
622
626
|
}
|
|
623
|
-
const
|
|
627
|
+
const rt = function(e, t, n, o) {
|
|
624
628
|
const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
625
629
|
return v(s, {
|
|
626
630
|
"text-anchor": "middle",
|
|
@@ -628,18 +632,18 @@ const it = function(e, t, n, o) {
|
|
|
628
632
|
y: n + "",
|
|
629
633
|
fill: o || "#666"
|
|
630
634
|
}), s.dataset.type = "custom-link", s.innerHTML = e, s;
|
|
631
|
-
},
|
|
635
|
+
}, pe = function(e, t, n, o, s) {
|
|
632
636
|
if (!t || !n)
|
|
633
637
|
return;
|
|
634
638
|
performance.now();
|
|
635
|
-
const i = F(e, t, o.delta1), r = F(e, n, o.delta2), { x: c, y: l } =
|
|
636
|
-
`M ${c} ${l} C ${
|
|
639
|
+
const i = F(e, t, o.delta1), r = F(e, n, o.delta2), { x: c, y: l } = H(i), { ctrlX: h, ctrlY: a } = i, { ctrlX: d, ctrlY: f } = r, { x: p, y: u } = H(r), m = ce(d, f, p, u), g = ke(
|
|
640
|
+
`M ${c} ${l} C ${h} ${a} ${d} ${f} ${p} ${u}`,
|
|
637
641
|
`M ${m.x1} ${m.y1} L ${p} ${u} L ${m.x2} ${m.y2}`
|
|
638
|
-
), x = c / 8 +
|
|
639
|
-
g.appendChild(b), g.arrowObj = o, g.dataset.linkid = o.id, e.linkSvgGroup.appendChild(g), s || (e.arrows.push(o), e.currentArrow = g,
|
|
640
|
-
},
|
|
642
|
+
), x = c / 8 + h * 3 / 8 + d * 3 / 8 + p / 8, y = l / 8 + a * 3 / 8 + f * 3 / 8 + u / 8, b = rt(o.label, x, y, e.theme.cssVar["--color"]);
|
|
643
|
+
g.appendChild(b), g.arrowObj = o, g.dataset.linkid = o.id, e.linkSvgGroup.appendChild(g), s || (e.arrows.push(o), e.currentArrow = g, ge(e, o, i, r)), performance.now();
|
|
644
|
+
}, ct = function(e, t) {
|
|
641
645
|
const n = {
|
|
642
|
-
id:
|
|
646
|
+
id: X(),
|
|
643
647
|
label: "Custom Link",
|
|
644
648
|
from: e.nodeObj.id,
|
|
645
649
|
to: t.nodeObj.id,
|
|
@@ -652,15 +656,15 @@ const it = function(e, t, n, o) {
|
|
|
652
656
|
y: -200
|
|
653
657
|
}
|
|
654
658
|
};
|
|
655
|
-
|
|
659
|
+
pe(this, e, t, n), this.bus.fire("operation", {
|
|
656
660
|
name: "createArrow",
|
|
657
661
|
obj: n
|
|
658
662
|
});
|
|
659
|
-
},
|
|
663
|
+
}, lt = function(e) {
|
|
660
664
|
let t;
|
|
661
665
|
if (e ? t = e : t = this.currentArrow, !t)
|
|
662
666
|
return;
|
|
663
|
-
|
|
667
|
+
me(this);
|
|
664
668
|
const n = t.arrowObj.id;
|
|
665
669
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.remove(), this.bus.fire("operation", {
|
|
666
670
|
name: "removeArrow",
|
|
@@ -668,35 +672,35 @@ const it = function(e, t, n, o) {
|
|
|
668
672
|
id: n
|
|
669
673
|
}
|
|
670
674
|
});
|
|
671
|
-
},
|
|
675
|
+
}, at = function(e) {
|
|
672
676
|
this.currentArrow = e;
|
|
673
|
-
const t = e.arrowObj, n =
|
|
674
|
-
|
|
675
|
-
},
|
|
676
|
-
this.currentArrow = null,
|
|
677
|
-
},
|
|
677
|
+
const t = e.arrowObj, n = L(t.from), o = L(t.to), s = F(this, n, t.delta1), i = F(this, o, t.delta2);
|
|
678
|
+
ge(this, t, s, i);
|
|
679
|
+
}, dt = function() {
|
|
680
|
+
this.currentArrow = null, me(this);
|
|
681
|
+
}, me = function(e) {
|
|
678
682
|
e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none";
|
|
679
|
-
},
|
|
680
|
-
var
|
|
683
|
+
}, ge = function(e, t, n, o) {
|
|
684
|
+
var f;
|
|
681
685
|
e.linkController.style.display = "initial", e.P2.style.display = "initial", e.P3.style.display = "initial", e.nodes.appendChild(e.linkController), e.nodes.appendChild(e.P2), e.nodes.appendChild(e.P3);
|
|
682
|
-
let { x: s, y: i } =
|
|
683
|
-
e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${
|
|
686
|
+
let { x: s, y: i } = H(n), { ctrlX: r, ctrlY: c } = n, { ctrlX: l, ctrlY: h } = o, { x: a, y: d } = H(o);
|
|
687
|
+
e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${h}px;left:${l}px;`, v(e.line1, {
|
|
684
688
|
x1: s + "",
|
|
685
689
|
y1: i + "",
|
|
686
690
|
x2: r + "",
|
|
687
691
|
y2: c + ""
|
|
688
692
|
}), v(e.line2, {
|
|
689
693
|
x1: l + "",
|
|
690
|
-
y1:
|
|
691
|
-
x2:
|
|
692
|
-
y2:
|
|
693
|
-
}), e.helper1 && (e.helper1.destory(e.map), (
|
|
694
|
+
y1: h + "",
|
|
695
|
+
x2: a + "",
|
|
696
|
+
y2: d + ""
|
|
697
|
+
}), e.helper1 && (e.helper1.destory(e.map), (f = e.helper2) == null || f.destory(e.map)), e.helper1 = ne.create(e.P2), e.helper2 = ne.create(e.P3), e.helper1.init(e.map, (p, u) => {
|
|
694
698
|
var y;
|
|
695
699
|
r = r + p / e.scaleVal, c = c + u / e.scaleVal;
|
|
696
|
-
const m =
|
|
700
|
+
const m = H({ ...n, ctrlX: r, ctrlY: c });
|
|
697
701
|
s = m.x, i = m.y;
|
|
698
|
-
const g = s / 8 + r * 3 / 8 + l * 3 / 8 +
|
|
699
|
-
e.P2.style.top = c + "px", e.P2.style.left = r + "px", (y = e.currentArrow) == null || y.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${
|
|
702
|
+
const g = s / 8 + r * 3 / 8 + l * 3 / 8 + a / 8, x = i / 8 + c * 3 / 8 + h * 3 / 8 + d / 8;
|
|
703
|
+
e.P2.style.top = c + "px", e.P2.style.left = r + "px", (y = e.currentArrow) == null || y.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${h} ${a} ${d}`), v(e.currentArrow.children[2], {
|
|
700
704
|
x: g + "",
|
|
701
705
|
y: x + ""
|
|
702
706
|
}), v(e.line1, {
|
|
@@ -707,19 +711,19 @@ const it = function(e, t, n, o) {
|
|
|
707
711
|
}), t.delta1.x = r - n.cx, t.delta1.y = c - n.cy;
|
|
708
712
|
}), e.helper2.init(e.map, (p, u) => {
|
|
709
713
|
var b, C;
|
|
710
|
-
l = l + p / e.scaleVal,
|
|
711
|
-
const m =
|
|
712
|
-
|
|
713
|
-
const g = s / 8 + r * 3 / 8 + l * 3 / 8 +
|
|
714
|
-
e.P3.style.top =
|
|
714
|
+
l = l + p / e.scaleVal, h = h + u / e.scaleVal;
|
|
715
|
+
const m = H({ ...o, ctrlX: l, ctrlY: h });
|
|
716
|
+
a = m.x, d = m.y;
|
|
717
|
+
const g = s / 8 + r * 3 / 8 + l * 3 / 8 + a / 8, x = i / 8 + c * 3 / 8 + h * 3 / 8 + d / 8, y = ce(l, h, a, d);
|
|
718
|
+
e.P3.style.top = h + "px", e.P3.style.left = l + "px", (b = e.currentArrow) == null || b.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${h} ${a} ${d}`), (C = e.currentArrow) == null || C.children[1].setAttribute("d", `M ${y.x1} ${y.y1} L ${a} ${d} L ${y.x2} ${y.y2}`), v(e.currentArrow.children[2], {
|
|
715
719
|
x: g + "",
|
|
716
720
|
y: x + ""
|
|
717
721
|
}), v(e.line2, {
|
|
718
722
|
x1: l + "",
|
|
719
|
-
y1:
|
|
720
|
-
x2:
|
|
721
|
-
y2:
|
|
722
|
-
}), t.delta2.x = l - o.cx, t.delta2.y =
|
|
723
|
+
y1: h + "",
|
|
724
|
+
x2: a + "",
|
|
725
|
+
y2: d + ""
|
|
726
|
+
}), t.delta2.x = l - o.cx, t.delta2.y = h - o.cy;
|
|
723
727
|
});
|
|
724
728
|
};
|
|
725
729
|
function ht() {
|
|
@@ -727,13 +731,13 @@ function ht() {
|
|
|
727
731
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
728
732
|
const t = this.arrows[e];
|
|
729
733
|
try {
|
|
730
|
-
|
|
734
|
+
pe(this, L(t.from), L(t.to), t, !0);
|
|
731
735
|
} catch {
|
|
732
736
|
}
|
|
733
737
|
}
|
|
734
738
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
735
739
|
}
|
|
736
|
-
function
|
|
740
|
+
function ft(e) {
|
|
737
741
|
if (!e)
|
|
738
742
|
return;
|
|
739
743
|
const t = e.children[2];
|
|
@@ -746,54 +750,54 @@ function dt(e) {
|
|
|
746
750
|
}));
|
|
747
751
|
});
|
|
748
752
|
}
|
|
749
|
-
function
|
|
750
|
-
this.arrows = this.arrows.filter((e) =>
|
|
753
|
+
function ut() {
|
|
754
|
+
this.arrows = this.arrows.filter((e) => I(e.from, this.nodeData) && I(e.to, this.nodeData));
|
|
751
755
|
}
|
|
752
|
-
const
|
|
756
|
+
const pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
753
757
|
__proto__: null,
|
|
754
|
-
createArrow:
|
|
755
|
-
editArrowLabel:
|
|
756
|
-
removeArrow:
|
|
758
|
+
createArrow: ct,
|
|
759
|
+
editArrowLabel: ft,
|
|
760
|
+
removeArrow: lt,
|
|
757
761
|
renderArrow: ht,
|
|
758
|
-
selectArrow:
|
|
759
|
-
tidyArrow:
|
|
760
|
-
unselectArrow:
|
|
761
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
762
|
-
var l,
|
|
762
|
+
selectArrow: at,
|
|
763
|
+
tidyArrow: ut,
|
|
764
|
+
unselectArrow: dt
|
|
765
|
+
}, Symbol.toStringTag, { value: "Module" })), mt = function(e) {
|
|
766
|
+
var l, h;
|
|
763
767
|
if (e.length === 0)
|
|
764
768
|
throw new Error("No selected node.");
|
|
765
769
|
if (e.length === 1) {
|
|
766
|
-
const
|
|
767
|
-
if (!
|
|
770
|
+
const a = e[0].nodeObj, d = e[0].nodeObj.parent;
|
|
771
|
+
if (!d)
|
|
768
772
|
throw new Error("Can not select root node.");
|
|
769
|
-
const
|
|
773
|
+
const f = d.children.findIndex((p) => a === p);
|
|
770
774
|
return {
|
|
771
|
-
parent:
|
|
772
|
-
start:
|
|
773
|
-
end:
|
|
775
|
+
parent: d.id,
|
|
776
|
+
start: f,
|
|
777
|
+
end: f
|
|
774
778
|
};
|
|
775
779
|
}
|
|
776
780
|
let t = 0;
|
|
777
|
-
const n = e.map((
|
|
778
|
-
let
|
|
779
|
-
const
|
|
780
|
-
for (;
|
|
781
|
-
const p =
|
|
782
|
-
|
|
781
|
+
const n = e.map((a) => {
|
|
782
|
+
let d = a.nodeObj;
|
|
783
|
+
const f = [];
|
|
784
|
+
for (; d.parent; ) {
|
|
785
|
+
const p = d.parent, u = p.children, m = u == null ? void 0 : u.indexOf(d);
|
|
786
|
+
d = p, f.unshift({ node: d, index: m });
|
|
783
787
|
}
|
|
784
|
-
return
|
|
788
|
+
return f.length > t && (t = f.length), f;
|
|
785
789
|
});
|
|
786
790
|
let o = 0;
|
|
787
791
|
e:
|
|
788
792
|
for (; o < t; o++) {
|
|
789
|
-
const
|
|
790
|
-
for (let
|
|
791
|
-
if (((
|
|
793
|
+
const a = (l = n[0][o]) == null ? void 0 : l.node;
|
|
794
|
+
for (let d = 1; d < n.length; d++)
|
|
795
|
+
if (((h = n[d][o]) == null ? void 0 : h.node) !== a)
|
|
792
796
|
break e;
|
|
793
797
|
}
|
|
794
798
|
if (!o)
|
|
795
799
|
throw new Error("Can not select root node.");
|
|
796
|
-
const s = n.map((
|
|
800
|
+
const s = n.map((a) => a[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, c = n[0][o - 1].node;
|
|
797
801
|
if (!c.parent)
|
|
798
802
|
throw new Error("Please select nodes in the same main topic.");
|
|
799
803
|
return {
|
|
@@ -801,10 +805,10 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
801
805
|
start: i,
|
|
802
806
|
end: r
|
|
803
807
|
};
|
|
804
|
-
},
|
|
808
|
+
}, gt = function(e) {
|
|
805
809
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
806
810
|
return t.setAttribute("id", e), t;
|
|
807
|
-
},
|
|
811
|
+
}, oe = function(e, t) {
|
|
808
812
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
809
813
|
return v(n, {
|
|
810
814
|
d: e,
|
|
@@ -813,7 +817,7 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
813
817
|
"stroke-linecap": "round",
|
|
814
818
|
"stroke-width": "2"
|
|
815
819
|
}), n;
|
|
816
|
-
},
|
|
820
|
+
}, se = function(e, t, n, o, s) {
|
|
817
821
|
const i = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
818
822
|
return v(i, {
|
|
819
823
|
"text-anchor": o,
|
|
@@ -821,43 +825,42 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
821
825
|
y: n + "",
|
|
822
826
|
fill: s || "#666"
|
|
823
827
|
}), i.innerHTML = e, i;
|
|
824
|
-
},
|
|
825
|
-
|
|
826
|
-
const n = S(e), o = n.nodeObj;
|
|
828
|
+
}, yt = (e) => L(e).parentElement.parentElement, vt = function({ parent: e, start: t }) {
|
|
829
|
+
const n = L(e), o = n.nodeObj;
|
|
827
830
|
let s;
|
|
828
|
-
return o.parent ? s =
|
|
829
|
-
},
|
|
830
|
-
var
|
|
831
|
-
const { id: n, text: o, parent: s, start: i, end: r } = t, c = e.nodes,
|
|
832
|
-
let
|
|
833
|
-
for (let
|
|
834
|
-
const
|
|
835
|
-
if (!
|
|
831
|
+
return o.parent ? s = n.closest("me-main").className : s = L(o.children[t].id).closest("me-main").className, s;
|
|
832
|
+
}, ye = function(e, t) {
|
|
833
|
+
var U;
|
|
834
|
+
const { id: n, text: o, parent: s, start: i, end: r } = t, c = e.nodes, h = L(s).nodeObj, a = vt(t);
|
|
835
|
+
let d = 1 / 0, f = 0, p = 0, u = 0;
|
|
836
|
+
for (let P = i; P <= r; P++) {
|
|
837
|
+
const J = (U = h.children) == null ? void 0 : U[P];
|
|
838
|
+
if (!J)
|
|
836
839
|
return e.removeSummary(n), null;
|
|
837
|
-
const j =
|
|
838
|
-
|
|
840
|
+
const j = yt(J.id), { offsetLeft: V, offsetTop: K } = T(c, j), Q = i === r ? 10 : 20;
|
|
841
|
+
P === i && (p = K + Q), P === r && (u = K + j.offsetHeight - Q), V < d && (d = V), j.offsetWidth + V > f && (f = j.offsetWidth + V);
|
|
839
842
|
}
|
|
840
843
|
let m, g;
|
|
841
844
|
const x = p + 10, y = u + 10, b = (x + y) / 2, C = e.theme.cssVar["--color"];
|
|
842
|
-
|
|
843
|
-
const w =
|
|
845
|
+
a === M.LHS ? (m = oe(`M ${d + 10} ${x} c -5 0 -10 5 -10 10 L ${d} ${y - 10} c 0 5 5 10 10 10 M ${d} ${b} h -10`, C), g = se(o, d - 20, b + 6, "end", C)) : (m = oe(`M ${f - 10} ${x} c 5 0 10 5 10 10 L ${f} ${y - 10} c 0 5 -5 10 -10 10 M ${f} ${b} h 10`, C), g = se(o, f + 20, b + 6, "start", C));
|
|
846
|
+
const w = gt("s-" + n);
|
|
844
847
|
return w.appendChild(m), w.appendChild(g), w.summaryObj = t, e.summarySvg.appendChild(w), w;
|
|
845
|
-
},
|
|
848
|
+
}, xt = function() {
|
|
846
849
|
let e = [];
|
|
847
850
|
this.currentNode ? e = [this.currentNode] : this.currentNodes && (e = this.currentNodes);
|
|
848
|
-
const { parent: t, start: n, end: o } =
|
|
851
|
+
const { parent: t, start: n, end: o } = mt(e), s = { id: X(), parent: t, start: n, end: o, text: "summary" }, i = ye(this, s);
|
|
849
852
|
this.summaries.push(s), this.editSummary(i), this.bus.fire("operation", {
|
|
850
853
|
name: "createSummary",
|
|
851
854
|
obj: s
|
|
852
855
|
});
|
|
853
|
-
},
|
|
856
|
+
}, bt = function(e) {
|
|
854
857
|
var n;
|
|
855
858
|
const t = this.summaries.findIndex((o) => o.id === e);
|
|
856
859
|
t > -1 && (this.summaries.splice(t, 1), (n = document.querySelector("#s-" + e)) == null || n.remove()), this.bus.fire("operation", {
|
|
857
860
|
name: "removeSummary",
|
|
858
861
|
obj: { id: e }
|
|
859
862
|
});
|
|
860
|
-
},
|
|
863
|
+
}, wt = function(e) {
|
|
861
864
|
const t = e.children[1].getBBox(), n = 6, o = 3, s = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
862
865
|
v(s, {
|
|
863
866
|
x: t.x - n + "",
|
|
@@ -869,17 +872,17 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
869
872
|
"stroke-width": "2",
|
|
870
873
|
fill: "none"
|
|
871
874
|
}), e.appendChild(s), this.currentSummary = e;
|
|
872
|
-
},
|
|
875
|
+
}, Ct = function() {
|
|
873
876
|
var e, t;
|
|
874
877
|
(t = (e = this.currentSummary) == null ? void 0 : e.querySelector("rect")) == null || t.remove(), this.currentSummary = null;
|
|
875
|
-
},
|
|
878
|
+
}, Et = function() {
|
|
876
879
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
877
880
|
try {
|
|
878
|
-
|
|
881
|
+
ye(this, e);
|
|
879
882
|
} catch {
|
|
880
883
|
}
|
|
881
884
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
882
|
-
},
|
|
885
|
+
}, St = function(e) {
|
|
883
886
|
if (!e)
|
|
884
887
|
return;
|
|
885
888
|
const t = e.childNodes[1];
|
|
@@ -893,47 +896,47 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
893
896
|
});
|
|
894
897
|
}, Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
895
898
|
__proto__: null,
|
|
896
|
-
createSummary:
|
|
897
|
-
editSummary:
|
|
898
|
-
removeSummary:
|
|
899
|
-
renderSummary:
|
|
900
|
-
selectSummary:
|
|
901
|
-
unselectSummary:
|
|
902
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
903
|
-
function
|
|
904
|
-
const n = document.createElementNS(
|
|
899
|
+
createSummary: xt,
|
|
900
|
+
editSummary: St,
|
|
901
|
+
removeSummary: bt,
|
|
902
|
+
renderSummary: Et,
|
|
903
|
+
selectSummary: wt,
|
|
904
|
+
unselectSummary: Ct
|
|
905
|
+
}, Symbol.toStringTag, { value: "Module" })), S = "http://www.w3.org/2000/svg";
|
|
906
|
+
function Mt(e, t) {
|
|
907
|
+
const n = document.createElementNS(S, "svg");
|
|
905
908
|
return v(n, {
|
|
906
909
|
version: "1.1",
|
|
907
|
-
xmlns:
|
|
910
|
+
xmlns: S,
|
|
908
911
|
height: e,
|
|
909
912
|
width: t
|
|
910
913
|
}), n;
|
|
911
914
|
}
|
|
912
|
-
function
|
|
915
|
+
function $t(e, t) {
|
|
913
916
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
914
917
|
}
|
|
915
|
-
function
|
|
916
|
-
const s = document.createElementNS(
|
|
918
|
+
function Nt(e, t, n, o) {
|
|
919
|
+
const s = document.createElementNS(S, "g");
|
|
917
920
|
let i = "";
|
|
918
921
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
919
922
|
`).forEach((c, l) => {
|
|
920
|
-
const
|
|
921
|
-
v(
|
|
923
|
+
const h = document.createElementNS(S, "text");
|
|
924
|
+
v(h, {
|
|
922
925
|
x: n + parseInt(t.paddingLeft) + "",
|
|
923
|
-
y: o + parseInt(t.paddingTop) +
|
|
926
|
+
y: o + parseInt(t.paddingTop) + $t(t.lineHeight, t.fontSize) * (l + 1) + parseFloat(t.fontSize) * (l + 1) + "",
|
|
924
927
|
"text-anchor": "start",
|
|
925
928
|
"font-family": t.fontFamily,
|
|
926
929
|
"font-size": `${t.fontSize}`,
|
|
927
930
|
"font-weight": `${t.fontWeight}`,
|
|
928
931
|
fill: `${t.color}`
|
|
929
|
-
}),
|
|
932
|
+
}), h.innerHTML = c, s.appendChild(h);
|
|
930
933
|
}), s;
|
|
931
934
|
}
|
|
932
|
-
function
|
|
935
|
+
function Tt(e, t, n, o) {
|
|
933
936
|
var c;
|
|
934
937
|
let s = "";
|
|
935
938
|
(c = e.nodeObj) != null && c.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
936
|
-
const i = document.createElementNS(
|
|
939
|
+
const i = document.createElementNS(S, "foreignObject");
|
|
937
940
|
v(i, {
|
|
938
941
|
x: n + parseInt(t.paddingLeft) + "",
|
|
939
942
|
y: o + parseInt(t.paddingTop) + "",
|
|
@@ -946,8 +949,8 @@ function Nt(e, t, n, o) {
|
|
|
946
949
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
947
950
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
948
951
|
}
|
|
949
|
-
function
|
|
950
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
952
|
+
function kt(e, t) {
|
|
953
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = T(e.nodes, t), i = document.createElementNS(S, "rect");
|
|
951
954
|
return v(i, {
|
|
952
955
|
x: o + "",
|
|
953
956
|
y: s + "",
|
|
@@ -960,8 +963,8 @@ function Tt(e, t) {
|
|
|
960
963
|
"stroke-width": n.borderWidth
|
|
961
964
|
}), i;
|
|
962
965
|
}
|
|
963
|
-
function
|
|
964
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
966
|
+
function _(e, t, n = !1) {
|
|
967
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = T(e.nodes, t), r = document.createElementNS(S, "rect");
|
|
965
968
|
v(r, {
|
|
966
969
|
x: s + "",
|
|
967
970
|
y: i + "",
|
|
@@ -973,13 +976,13 @@ function V(e, t, n = !1) {
|
|
|
973
976
|
stroke: o.borderColor,
|
|
974
977
|
"stroke-width": o.borderWidth
|
|
975
978
|
});
|
|
976
|
-
const c = document.createElementNS(
|
|
979
|
+
const c = document.createElementNS(S, "g");
|
|
977
980
|
c.appendChild(r);
|
|
978
981
|
let l;
|
|
979
|
-
return n ? l =
|
|
982
|
+
return n ? l = Tt(t, o, s, i) : l = Nt(t, o, s, i), c.appendChild(l), c;
|
|
980
983
|
}
|
|
981
|
-
function
|
|
982
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
984
|
+
function Ht(e, t) {
|
|
985
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = T(e.nodes, t), i = document.createElementNS(S, "a"), r = document.createElementNS(S, "text");
|
|
983
986
|
return v(r, {
|
|
984
987
|
x: o + "",
|
|
985
988
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -990,8 +993,8 @@ function kt(e, t) {
|
|
|
990
993
|
fill: `${n.color}`
|
|
991
994
|
}), r.innerHTML = t.textContent, i.appendChild(r), i.setAttribute("href", t.href), i;
|
|
992
995
|
}
|
|
993
|
-
function
|
|
994
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
996
|
+
function At(e, t) {
|
|
997
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = T(e.nodes, t), i = document.createElementNS(S, "image");
|
|
995
998
|
return v(i, {
|
|
996
999
|
x: o + "",
|
|
997
1000
|
y: s + "",
|
|
@@ -1000,9 +1003,9 @@ function Ht(e, t) {
|
|
|
1000
1003
|
href: t.src
|
|
1001
1004
|
}), i;
|
|
1002
1005
|
}
|
|
1003
|
-
const
|
|
1004
|
-
var
|
|
1005
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
1006
|
+
const q = 100, Bt = '<?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">', Dt = (e, t = !1) => {
|
|
1007
|
+
var d, f, p;
|
|
1008
|
+
const n = e.nodes, o = n.offsetHeight + q * 2, s = n.offsetWidth + q * 2, i = Mt(o + "px", s + "px"), r = document.createElementNS(S, "svg"), c = document.createElementNS(S, "rect");
|
|
1006
1009
|
v(c, {
|
|
1007
1010
|
x: "0",
|
|
1008
1011
|
y: "0",
|
|
@@ -1010,31 +1013,31 @@ const _ = 100, At = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1010
1013
|
height: `${o}`,
|
|
1011
1014
|
fill: e.theme.cssVar["--bgcolor"]
|
|
1012
1015
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((u) => {
|
|
1013
|
-
const m = u.cloneNode(!0), { offsetLeft: g, offsetTop: x } =
|
|
1016
|
+
const m = u.cloneNode(!0), { offsetLeft: g, offsetTop: x } = T(n, u.parentElement);
|
|
1014
1017
|
m.setAttribute("x", `${g}`), m.setAttribute("y", `${x}`), r.appendChild(m);
|
|
1015
1018
|
});
|
|
1016
|
-
const l = (
|
|
1019
|
+
const l = (d = n.querySelector(".lines")) == null ? void 0 : d.cloneNode(!0);
|
|
1017
1020
|
l && r.appendChild(l);
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1020
|
-
const
|
|
1021
|
-
return
|
|
1022
|
-
u.nodeObj.dangerouslySetInnerHTML ? r.appendChild(
|
|
1021
|
+
const h = (f = n.querySelector(".topiclinks")) == null ? void 0 : f.cloneNode(!0);
|
|
1022
|
+
h && r.appendChild(h);
|
|
1023
|
+
const a = (p = n.querySelector(".summary")) == null ? void 0 : p.cloneNode(!0);
|
|
1024
|
+
return a && r.appendChild(a), n.querySelectorAll("me-tpc").forEach((u) => {
|
|
1025
|
+
u.nodeObj.dangerouslySetInnerHTML ? r.appendChild(_(e, u, !t)) : (r.appendChild(kt(e, u)), r.appendChild(_(e, u.text, !t)));
|
|
1023
1026
|
}), n.querySelectorAll(".tags > span").forEach((u) => {
|
|
1024
|
-
r.appendChild(
|
|
1027
|
+
r.appendChild(_(e, u));
|
|
1025
1028
|
}), n.querySelectorAll(".icons > span").forEach((u) => {
|
|
1026
|
-
r.appendChild(
|
|
1029
|
+
r.appendChild(_(e, u));
|
|
1027
1030
|
}), n.querySelectorAll(".hyper-link").forEach((u) => {
|
|
1028
|
-
r.appendChild(kt(e, u));
|
|
1029
|
-
}), n.querySelectorAll("img").forEach((u) => {
|
|
1030
1031
|
r.appendChild(Ht(e, u));
|
|
1032
|
+
}), n.querySelectorAll("img").forEach((u) => {
|
|
1033
|
+
r.appendChild(At(e, u));
|
|
1031
1034
|
}), v(r, {
|
|
1032
|
-
x:
|
|
1033
|
-
y:
|
|
1035
|
+
x: q + "",
|
|
1036
|
+
y: q + "",
|
|
1034
1037
|
overflow: "visible"
|
|
1035
1038
|
}), i.appendChild(r), i;
|
|
1036
|
-
},
|
|
1037
|
-
function
|
|
1039
|
+
}, Pt = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Bt + e.outerHTML);
|
|
1040
|
+
function zt(e) {
|
|
1038
1041
|
return new Promise((t, n) => {
|
|
1039
1042
|
const o = new FileReader();
|
|
1040
1043
|
o.onload = (s) => {
|
|
@@ -1044,11 +1047,11 @@ function Pt(e) {
|
|
|
1044
1047
|
}, o.readAsDataURL(e);
|
|
1045
1048
|
});
|
|
1046
1049
|
}
|
|
1047
|
-
const
|
|
1048
|
-
const n = Dt(this, e), o =
|
|
1050
|
+
const Ot = function(e = !1, t) {
|
|
1051
|
+
const n = Dt(this, e), o = Pt(n, t);
|
|
1049
1052
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1050
1053
|
}, jt = async function(e = !1, t) {
|
|
1051
|
-
const n = this.exportSvg(e, t), o = await
|
|
1054
|
+
const n = this.exportSvg(e, t), o = await zt(n);
|
|
1052
1055
|
return new Promise((s, i) => {
|
|
1053
1056
|
const r = new Image();
|
|
1054
1057
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -1056,56 +1059,56 @@ const zt = function(e = !1, t) {
|
|
|
1056
1059
|
c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(s, "image/png", 1);
|
|
1057
1060
|
}, r.src = o, r.onerror = i;
|
|
1058
1061
|
});
|
|
1059
|
-
},
|
|
1062
|
+
}, Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1060
1063
|
__proto__: null,
|
|
1061
1064
|
exportPng: jt,
|
|
1062
|
-
exportSvg:
|
|
1063
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1064
|
-
getObjById:
|
|
1065
|
-
generateNewObj:
|
|
1066
|
-
layout:
|
|
1067
|
-
linkDiv:
|
|
1068
|
-
editTopic:
|
|
1069
|
-
createWrapper:
|
|
1065
|
+
exportSvg: Ot
|
|
1066
|
+
}, Symbol.toStringTag, { value: "Module" })), _t = {}, qt = {
|
|
1067
|
+
getObjById: I,
|
|
1068
|
+
generateNewObj: ve,
|
|
1069
|
+
layout: we,
|
|
1070
|
+
linkDiv: He,
|
|
1071
|
+
editTopic: Ne,
|
|
1072
|
+
createWrapper: Se,
|
|
1070
1073
|
createParent: Le,
|
|
1071
|
-
createChildren:
|
|
1072
|
-
createTopic:
|
|
1073
|
-
findEle:
|
|
1074
|
-
changeTheme:
|
|
1075
|
-
...
|
|
1076
|
-
...
|
|
1077
|
-
...
|
|
1074
|
+
createChildren: Me,
|
|
1075
|
+
createTopic: $e,
|
|
1076
|
+
findEle: L,
|
|
1077
|
+
changeTheme: Pe,
|
|
1078
|
+
...st,
|
|
1079
|
+
..._t,
|
|
1080
|
+
...pt,
|
|
1078
1081
|
...Lt,
|
|
1079
|
-
...
|
|
1082
|
+
...Vt,
|
|
1080
1083
|
init(e) {
|
|
1081
1084
|
if (!e || !e.nodeData)
|
|
1082
1085
|
return new Error("MindElixir: `data` is required");
|
|
1083
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
1086
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, Y(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && De(this), this.toCenter(), this.layout(), this.linkDiv();
|
|
1084
1087
|
},
|
|
1085
1088
|
destroy() {
|
|
1086
1089
|
var e;
|
|
1087
1090
|
this.disposable.forEach((t) => t()), this.mindElixirBox && (this.mindElixirBox.innerHTML = ""), this.mindElixirBox = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNode = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, (e = this.selection) == null || e.destroy(), this.selection = void 0;
|
|
1088
1091
|
}
|
|
1089
1092
|
};
|
|
1090
|
-
function
|
|
1091
|
-
let
|
|
1092
|
-
const
|
|
1093
|
-
let
|
|
1094
|
-
l ===
|
|
1095
|
-
const p = s + c / 2, m = (1 - Math.abs(p -
|
|
1096
|
-
return l ===
|
|
1093
|
+
function It({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, containerHeight: h }) {
|
|
1094
|
+
let a = t + n / 2;
|
|
1095
|
+
const d = e + o / 2;
|
|
1096
|
+
let f;
|
|
1097
|
+
l === M.LHS ? f = i + r : f = i;
|
|
1098
|
+
const p = s + c / 2, m = (1 - Math.abs(p - d) / h) * 0.25 * (n / 2);
|
|
1099
|
+
return l === M.LHS ? a = a - n / 10 - m : a = a + n / 10 + m, `M ${a} ${d} Q ${a} ${p} ${f} ${p}`;
|
|
1097
1100
|
}
|
|
1098
|
-
function
|
|
1099
|
-
const
|
|
1100
|
-
let
|
|
1101
|
-
|
|
1101
|
+
function Rt({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, isFirst: h }) {
|
|
1102
|
+
const a = parseInt(this.mindElixirBox.style.getPropertyValue("--gap"));
|
|
1103
|
+
let d = 0, f = 0;
|
|
1104
|
+
h ? d = e + o / 2 : d = e + o;
|
|
1102
1105
|
const p = s + c;
|
|
1103
1106
|
let u = 0, m = 0, g = 0;
|
|
1104
|
-
const x = Math.abs(
|
|
1105
|
-
return l ===
|
|
1107
|
+
const x = Math.abs(d - p) / 300 * a;
|
|
1108
|
+
return l === M.LHS ? (g = t, u = g + a, m = g - a, f = i + a, `M ${u} ${d} C ${g} ${d} ${g + x} ${p} ${m} ${p} H ${f}`) : (g = t + n, u = g - a, m = g + a, f = i + r - a, `M ${u} ${d} C ${g} ${d} ${g - x} ${p} ${m} ${p} H ${f}`);
|
|
1106
1109
|
}
|
|
1107
|
-
const Ft = "4.3.
|
|
1108
|
-
function
|
|
1110
|
+
const Ft = "4.3.6", z = document;
|
|
1111
|
+
function $({
|
|
1109
1112
|
el: e,
|
|
1110
1113
|
direction: t,
|
|
1111
1114
|
locale: n,
|
|
@@ -1115,10 +1118,10 @@ function M({
|
|
|
1115
1118
|
contextMenuOption: r,
|
|
1116
1119
|
toolBar: c,
|
|
1117
1120
|
keypress: l,
|
|
1118
|
-
mouseSelectionButton:
|
|
1119
|
-
selectionContainer:
|
|
1120
|
-
before:
|
|
1121
|
-
newTopicName:
|
|
1121
|
+
mouseSelectionButton: h,
|
|
1122
|
+
selectionContainer: a,
|
|
1123
|
+
before: d,
|
|
1124
|
+
newTopicName: f,
|
|
1122
1125
|
allowUndo: p,
|
|
1123
1126
|
generateMainBranch: u,
|
|
1124
1127
|
generateSubBranch: m,
|
|
@@ -1129,21 +1132,22 @@ function M({
|
|
|
1129
1132
|
const b = Object.prototype.toString.call(e);
|
|
1130
1133
|
if (b === "[object HTMLDivElement]" ? y = e : b === "[object String]" && (y = document.querySelector(e)), !y)
|
|
1131
1134
|
throw new Error("MindElixir: el is not a valid element");
|
|
1132
|
-
y.className += " mind-elixir", y.innerHTML = "", this.mindElixirBox = y, this.disposable = [], this.before =
|
|
1135
|
+
y.className += " mind-elixir", y.innerHTML = "", this.mindElixirBox = y, this.disposable = [], this.before = d || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = c === void 0 ? !0 : c, this.keypress = l === void 0 ? !0 : l, this.mouseSelectionButton = h || 0, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = f || "new node", this.editable = s === void 0 ? !0 : s, this.allowUndo = p === void 0 ? !1 : p, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = u || It, this.generateSubBranch = m || Rt, this.overflowHidden = g || !1, this.bus = be.create(), this.container = z.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
|
|
1133
1136
|
const C = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1134
|
-
this.theme = x || (C.matches ?
|
|
1135
|
-
const w =
|
|
1136
|
-
w.className = "map-canvas", this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes =
|
|
1137
|
+
this.theme = x || (C.matches ? re : ie);
|
|
1138
|
+
const w = z.createElement("div");
|
|
1139
|
+
w.className = "map-canvas", this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = z.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = O("lines"), this.summarySvg = O("summary"), this.linkController = O("linkcontroller"), this.P2 = z.createElement("div"), this.P3 = z.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = te(), this.line2 = te(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = O("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : xe(this);
|
|
1137
1140
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1141
|
+
$.prototype = qt;
|
|
1142
|
+
$.LEFT = D;
|
|
1143
|
+
$.RIGHT = W;
|
|
1144
|
+
$.SIDE = G;
|
|
1145
|
+
$.THEME = ie;
|
|
1146
|
+
$.DARK_THEME = re;
|
|
1147
|
+
$.version = Ft;
|
|
1148
|
+
$.E = L;
|
|
1149
|
+
$.dragMoveHelper = N;
|
|
1147
1150
|
export {
|
|
1148
|
-
M as
|
|
1151
|
+
M as DirectionClass,
|
|
1152
|
+
$ as default
|
|
1149
1153
|
};
|