mind-elixir 4.2.4 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +5 -5
- package/dist/MindElixir.js +552 -549
- package/dist/MindElixirLite.iife.js +5 -5
- package/dist/MindElixirLite.js +354 -351
- package/dist/types/const.d.ts +0 -1
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/readme.md +1 -1
package/dist/MindElixirLite.js
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
i || (i = !0, o());
|
|
15
15
|
}
|
|
16
16
|
t = function() {
|
|
17
|
-
var h, a, f,
|
|
18
|
-
(
|
|
17
|
+
var h, a, f, g;
|
|
18
|
+
(g = document.createElement("div")).innerHTML = l, l = null, (f = g.getElementsByTagName("svg")[0]) && (f.setAttribute("aria-hidden", "true"), f.style.position = "absolute", f.style.width = 0, f.style.height = 0, f.style.overflow = "hidden", h = f, (a = document.body).firstChild ? (g = h, (f = a.firstChild).parentNode.insertBefore(g, f)) : a.appendChild(h));
|
|
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() {
|
|
@@ -29,10 +29,11 @@
|
|
|
29
29
|
s.readyState == "complete" && (s.onreadystatechange = null, d());
|
|
30
30
|
});
|
|
31
31
|
})(window);
|
|
32
|
-
const
|
|
32
|
+
const j = 0, J = 1, Q = 2, ge = {
|
|
33
33
|
name: "Latte",
|
|
34
34
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
35
35
|
cssVar: {
|
|
36
|
+
"--gap": "30px",
|
|
36
37
|
"--main-color": "#444446",
|
|
37
38
|
"--main-bgcolor": "#ffffff",
|
|
38
39
|
"--color": "#777777",
|
|
@@ -41,7 +42,7 @@ const q = 0, Q = 1, Z = 2, $ = 30, ve = {
|
|
|
41
42
|
"--panel-bgcolor": "#ffffff",
|
|
42
43
|
"--panel-border-color": "#eaeaea"
|
|
43
44
|
}
|
|
44
|
-
},
|
|
45
|
+
}, ve = {
|
|
45
46
|
name: "Dark",
|
|
46
47
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
47
48
|
cssVar: {
|
|
@@ -54,27 +55,27 @@ const q = 0, Q = 1, Z = 2, $ = 30, ve = {
|
|
|
54
55
|
"--panel-border-color": "#696969"
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
|
-
function
|
|
58
|
+
function se(e) {
|
|
58
59
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
59
60
|
}
|
|
60
|
-
const
|
|
61
|
+
const G = function(e, t) {
|
|
61
62
|
if (t.id === e)
|
|
62
63
|
return t;
|
|
63
64
|
if (t.children && t.children.length) {
|
|
64
65
|
for (let n = 0; n < t.children.length; n++) {
|
|
65
|
-
const o =
|
|
66
|
+
const o = G(e, t.children[n]);
|
|
66
67
|
if (o)
|
|
67
68
|
return o;
|
|
68
69
|
}
|
|
69
70
|
return null;
|
|
70
71
|
} else
|
|
71
72
|
return null;
|
|
72
|
-
},
|
|
73
|
+
}, Z = (e, t) => {
|
|
73
74
|
if (e.parent = t, e.children)
|
|
74
75
|
for (let n = 0; n < e.children.length; n++)
|
|
75
|
-
|
|
76
|
+
Z(e.children[n], e);
|
|
76
77
|
};
|
|
77
|
-
function
|
|
78
|
+
function ye(e, t, n, o) {
|
|
78
79
|
const s = o - t, i = e - n;
|
|
79
80
|
let r = Math.atan(Math.abs(s) / Math.abs(i)) / 3.14 * 180;
|
|
80
81
|
i < 0 && s > 0 && (r = 180 - r), i < 0 && s < 0 && (r = 180 + r), i > 0 && s < 0 && (r = 360 - r);
|
|
@@ -86,16 +87,16 @@ function be(e, t, n, o) {
|
|
|
86
87
|
y2: o - Math.sin(Math.PI * h / 180) * l
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function ee() {
|
|
90
91
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
91
92
|
}
|
|
92
|
-
const
|
|
93
|
-
const e =
|
|
93
|
+
const Ne = function() {
|
|
94
|
+
const e = ee();
|
|
94
95
|
return {
|
|
95
96
|
topic: this.newTopicName,
|
|
96
97
|
id: e
|
|
97
98
|
};
|
|
98
|
-
},
|
|
99
|
+
}, $ = (e, t) => {
|
|
99
100
|
let n = 0, o = 0;
|
|
100
101
|
for (; t && t !== e; )
|
|
101
102
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
@@ -103,7 +104,7 @@ const Ae = function() {
|
|
|
103
104
|
}, x = (e, t) => {
|
|
104
105
|
for (const n in t)
|
|
105
106
|
e.setAttribute(n, t[n]);
|
|
106
|
-
},
|
|
107
|
+
}, ie = (e) => e ? e.tagName === "ME-TPC" : !1, A = {
|
|
107
108
|
moved: !1,
|
|
108
109
|
// diffrentiate click and move
|
|
109
110
|
mousedown: !1,
|
|
@@ -118,7 +119,7 @@ const Ae = function() {
|
|
|
118
119
|
this.moved = !1, this.mousedown = !1;
|
|
119
120
|
}
|
|
120
121
|
};
|
|
121
|
-
function
|
|
122
|
+
function Ae(e) {
|
|
122
123
|
e.map.addEventListener("click", (t) => {
|
|
123
124
|
var o, s;
|
|
124
125
|
if (t.button !== 0)
|
|
@@ -131,15 +132,15 @@ function ke(e) {
|
|
|
131
132
|
e.helper2.clear();
|
|
132
133
|
return;
|
|
133
134
|
}
|
|
134
|
-
if (
|
|
135
|
-
|
|
135
|
+
if (A.moved) {
|
|
136
|
+
A.clear();
|
|
136
137
|
return;
|
|
137
138
|
}
|
|
138
139
|
e.clearSelection();
|
|
139
140
|
const n = t.target;
|
|
140
141
|
if (n.tagName === "ME-EPD")
|
|
141
142
|
e.expandNode(n.previousSibling);
|
|
142
|
-
else if (
|
|
143
|
+
else if (ie(n))
|
|
143
144
|
e.selectNode(n, !1, t);
|
|
144
145
|
else if (e.editable)
|
|
145
146
|
n.tagName === "text" ? n.dataset.type === "custom-link" ? e.selectArrow(n.parentElement) : e.selectSummary(n.parentElement) : n.className;
|
|
@@ -149,21 +150,21 @@ function ke(e) {
|
|
|
149
150
|
if (!e.editable)
|
|
150
151
|
return;
|
|
151
152
|
const n = t.target;
|
|
152
|
-
|
|
153
|
+
ie(n) ? e.beginEdit(n) : n.tagName === "text" && (n.dataset.type === "custom-link" ? e.editArrowLabel(n.parentElement) : e.editSummary(n.parentElement));
|
|
153
154
|
}), e.map.addEventListener("mousemove", (t) => {
|
|
154
|
-
t.target.contentEditable !== "true" &&
|
|
155
|
+
t.target.contentEditable !== "true" && A.onMove(t, e.container);
|
|
155
156
|
}), e.map.addEventListener("mousedown", (t) => {
|
|
156
157
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
157
|
-
t.button === n && t.target.contentEditable !== "true" && (
|
|
158
|
+
t.button === n && t.target.contentEditable !== "true" && (A.moved = !1, A.mousedown = !0);
|
|
158
159
|
}), e.map.addEventListener("mouseleave", (t) => {
|
|
159
160
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
160
|
-
t.button === n &&
|
|
161
|
+
t.button === n && A.clear();
|
|
161
162
|
}), e.map.addEventListener("mouseup", (t) => {
|
|
162
163
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
163
|
-
t.button === n &&
|
|
164
|
+
t.button === n && A.clear();
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
|
-
const
|
|
167
|
+
const ke = {
|
|
167
168
|
create() {
|
|
168
169
|
return {
|
|
169
170
|
handlers: {},
|
|
@@ -191,32 +192,32 @@ const De = {
|
|
|
191
192
|
}
|
|
192
193
|
};
|
|
193
194
|
}
|
|
194
|
-
},
|
|
195
|
+
}, K = document, Be = function() {
|
|
195
196
|
this.nodes.innerHTML = "";
|
|
196
197
|
const e = this.createTopic(this.nodeData);
|
|
197
|
-
|
|
198
|
-
const t =
|
|
198
|
+
be(e, this.nodeData), e.draggable = !1;
|
|
199
|
+
const t = K.createElement("me-root");
|
|
199
200
|
t.appendChild(e);
|
|
200
201
|
const n = this.nodeData.children || [];
|
|
201
|
-
if (this.direction ===
|
|
202
|
+
if (this.direction === Q) {
|
|
202
203
|
let o = 0, s = 0;
|
|
203
204
|
n.map((i) => {
|
|
204
|
-
i.direction ===
|
|
205
|
+
i.direction === j ? o += 1 : i.direction === J ? s += 1 : o <= s ? (i.direction = j, o += 1) : (i.direction = J, s += 1);
|
|
205
206
|
});
|
|
206
207
|
}
|
|
207
|
-
|
|
208
|
-
},
|
|
209
|
-
const o =
|
|
208
|
+
De(this, n, t);
|
|
209
|
+
}, De = function(e, t, n) {
|
|
210
|
+
const o = K.createElement("me-main");
|
|
210
211
|
o.className = "lhs";
|
|
211
|
-
const s =
|
|
212
|
+
const s = K.createElement("me-main");
|
|
212
213
|
s.className = "rhs";
|
|
213
214
|
for (let i = 0; i < t.length; i++) {
|
|
214
215
|
const r = t[i], { grp: l } = e.createWrapper(r);
|
|
215
|
-
e.direction ===
|
|
216
|
+
e.direction === Q ? r.direction === j ? o.appendChild(l) : s.appendChild(l) : e.direction === j ? o.appendChild(l) : s.appendChild(l);
|
|
216
217
|
}
|
|
217
218
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines);
|
|
218
|
-
},
|
|
219
|
-
const n =
|
|
219
|
+
}, He = function(e, t) {
|
|
220
|
+
const n = K.createElement("me-children");
|
|
220
221
|
for (let o = 0; o < t.length; o++) {
|
|
221
222
|
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
222
223
|
n.appendChild(i);
|
|
@@ -227,7 +228,7 @@ const De = {
|
|
|
227
228
|
if (!o)
|
|
228
229
|
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
229
230
|
return o;
|
|
230
|
-
},
|
|
231
|
+
}, be = function(e, t) {
|
|
231
232
|
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) {
|
|
232
233
|
e.innerHTML = t.dangerouslySetInnerHTML;
|
|
233
234
|
return;
|
|
@@ -251,41 +252,41 @@ const De = {
|
|
|
251
252
|
e.linkContainer && (e.linkContainer = void 0);
|
|
252
253
|
if (t.icons && t.icons.length) {
|
|
253
254
|
const n = S.createElement("span");
|
|
254
|
-
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${
|
|
255
|
+
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${se(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
255
256
|
} else
|
|
256
257
|
e.icons && (e.icons = void 0);
|
|
257
258
|
if (t.tags && t.tags.length) {
|
|
258
259
|
const n = S.createElement("div");
|
|
259
|
-
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${
|
|
260
|
+
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${se(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
|
|
260
261
|
} else
|
|
261
262
|
e.tags && (e.tags = void 0);
|
|
262
|
-
},
|
|
263
|
+
}, Pe = function(e, t) {
|
|
263
264
|
const n = S.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
264
265
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
265
|
-
const i =
|
|
266
|
+
const i = Re(e.expanded);
|
|
266
267
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
267
|
-
const r =
|
|
268
|
+
const r = He(this, e.children);
|
|
268
269
|
n.appendChild(r);
|
|
269
270
|
}
|
|
270
271
|
}
|
|
271
272
|
return { grp: n, top: o, tpc: s };
|
|
272
|
-
},
|
|
273
|
+
}, ze = function(e) {
|
|
273
274
|
const t = S.createElement("me-parent"), n = this.createTopic(e);
|
|
274
|
-
return
|
|
275
|
-
},
|
|
275
|
+
return be(n, e), t.appendChild(n), { p: t, tpc: n };
|
|
276
|
+
}, Oe = function(e) {
|
|
276
277
|
const t = S.createElement("me-children");
|
|
277
278
|
return t.append(...e), t;
|
|
278
|
-
},
|
|
279
|
+
}, je = function(e) {
|
|
279
280
|
const t = S.createElement("me-tpc");
|
|
280
281
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
281
282
|
};
|
|
282
|
-
function
|
|
283
|
+
function xe(e) {
|
|
283
284
|
const t = S.createRange();
|
|
284
285
|
t.selectNodeContents(e);
|
|
285
286
|
const n = window.getSelection();
|
|
286
287
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
287
288
|
}
|
|
288
|
-
const
|
|
289
|
+
const qe = function(e) {
|
|
289
290
|
if (!e)
|
|
290
291
|
return;
|
|
291
292
|
const t = S.createElement("div"), n = e.text.textContent;
|
|
@@ -297,7 +298,7 @@ const Re = function(e) {
|
|
|
297
298
|
margin:${o.margin};
|
|
298
299
|
font:${o.font};
|
|
299
300
|
background-color:${o.backgroundColor !== "rgba(0, 0, 0, 0)" && o.backgroundColor};
|
|
300
|
-
border-radius:${o.borderRadius};`, this.direction ===
|
|
301
|
+
border-radius:${o.borderRadius};`, this.direction === j && (t.style.right = "0"), t.focus(), xe(t), this.bus.fire("operation", {
|
|
301
302
|
name: "beginEdit",
|
|
302
303
|
obj: e.nodeObj
|
|
303
304
|
}), t.addEventListener("keydown", (s) => {
|
|
@@ -319,30 +320,30 @@ const Re = function(e) {
|
|
|
319
320
|
origin: n
|
|
320
321
|
}));
|
|
321
322
|
});
|
|
322
|
-
},
|
|
323
|
+
}, Re = function(e) {
|
|
323
324
|
const t = S.createElement("me-epd");
|
|
324
325
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
325
|
-
},
|
|
326
|
-
const o =
|
|
326
|
+
}, z = document, O = "http://www.w3.org/2000/svg", we = function(e, t, n) {
|
|
327
|
+
const o = z.createElementNS(O, "path");
|
|
327
328
|
return x(o, {
|
|
328
329
|
d: e,
|
|
329
330
|
stroke: t || "#666",
|
|
330
331
|
fill: "none",
|
|
331
332
|
"stroke-width": n
|
|
332
333
|
}), o;
|
|
333
|
-
},
|
|
334
|
-
const t =
|
|
334
|
+
}, V = function(e) {
|
|
335
|
+
const t = z.createElementNS(O, "svg");
|
|
335
336
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
336
|
-
},
|
|
337
|
-
const e =
|
|
337
|
+
}, re = function() {
|
|
338
|
+
const e = z.createElementNS(O, "line");
|
|
338
339
|
return e.setAttribute("stroke", "#bbb"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e;
|
|
339
|
-
},
|
|
340
|
+
}, Ve = function(e, t) {
|
|
340
341
|
const n = {
|
|
341
342
|
stroke: "rgb(235, 95, 82)",
|
|
342
343
|
fill: "none",
|
|
343
344
|
"stroke-linecap": "cap",
|
|
344
345
|
"stroke-width": "2"
|
|
345
|
-
}, o =
|
|
346
|
+
}, o = z.createElementNS(O, "g"), s = z.createElementNS(O, "path"), i = z.createElementNS(O, "path");
|
|
346
347
|
return x(i, {
|
|
347
348
|
d: t,
|
|
348
349
|
...n
|
|
@@ -351,7 +352,7 @@ const Re = function(e) {
|
|
|
351
352
|
...n,
|
|
352
353
|
"stroke-dasharray": "8,2"
|
|
353
354
|
}), o.appendChild(s), o.appendChild(i), o;
|
|
354
|
-
},
|
|
355
|
+
}, _e = function(e, t, n) {
|
|
355
356
|
if (!t)
|
|
356
357
|
return;
|
|
357
358
|
const o = document.createElement("div");
|
|
@@ -361,7 +362,7 @@ const Re = function(e) {
|
|
|
361
362
|
const i = t.getAttribute("x"), r = t.getAttribute("y");
|
|
362
363
|
o.style.cssText = `min-width:88px;position:absolute;left:${i}px;top:${r}px;`;
|
|
363
364
|
const l = t.getAttribute("text-anchor");
|
|
364
|
-
l === "end" ? o.style.cssText += "transform: translate(-100%, -100%);" : l === "middle" ? o.style.cssText += "transform: translate(-50%, -100%);" : o.style.cssText += "transform: translate(0, -100%);", o.focus(),
|
|
365
|
+
l === "end" ? o.style.cssText += "transform: translate(-100%, -100%);" : l === "middle" ? o.style.cssText += "transform: translate(-50%, -100%);" : o.style.cssText += "transform: translate(0, -100%);", o.focus(), xe(o), o.addEventListener("keydown", (c) => {
|
|
365
366
|
c.stopPropagation();
|
|
366
367
|
const d = c.key;
|
|
367
368
|
if (d === "Enter" || d === "Tab") {
|
|
@@ -372,46 +373,46 @@ const Re = function(e) {
|
|
|
372
373
|
}), o.addEventListener("blur", () => {
|
|
373
374
|
o && n(o);
|
|
374
375
|
});
|
|
375
|
-
},
|
|
376
|
+
}, Ie = function(e) {
|
|
376
377
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight;
|
|
377
378
|
this.nodes.style.top = `${1e4 - this.nodes.offsetHeight / 2}px`, this.nodes.style.left = `${1e4 - o - s / 2}px`;
|
|
378
379
|
const r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
379
380
|
this.lines.innerHTML = "";
|
|
380
381
|
for (let l = 0; l < r.length; l++) {
|
|
381
|
-
const c = r[l], d = c.querySelector("me-tpc"), { offsetLeft: h, offsetTop: a } =
|
|
382
|
-
d.style.borderColor = y, this.lines.appendChild(
|
|
382
|
+
const c = r[l], d = c.querySelector("me-tpc"), { offsetLeft: h, offsetTop: a } = $(this.nodes, d), f = d.offsetWidth, g = d.offsetHeight, u = c.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: a, cL: h, cW: f, cH: g, direction: u, containerHeight: this.nodes.offsetHeight }), m = this.theme.palette, y = d.nodeObj.branchColor || m[l % m.length];
|
|
383
|
+
d.style.borderColor = y, this.lines.appendChild(we(p, y, "3"));
|
|
383
384
|
const v = c.children[0].children[1];
|
|
384
385
|
if (v && (v.style.top = (v.parentNode.offsetHeight - v.offsetHeight) / 2 + "px", u === "lhs" ? v.style.left = "-10px" : v.style.right = "-10px"), e && e !== c)
|
|
385
386
|
continue;
|
|
386
|
-
const w =
|
|
387
|
-
_.tagName === "svg" && _.remove(), c.appendChild(w),
|
|
387
|
+
const w = V("subLines"), _ = c.lastChild;
|
|
388
|
+
_.tagName === "svg" && _.remove(), c.appendChild(w), Ee(this, w, y, c, u, !0);
|
|
388
389
|
}
|
|
389
390
|
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
390
|
-
},
|
|
391
|
+
}, Ee = function(e, t, n, o, s, i) {
|
|
391
392
|
const r = o.firstChild, l = o.children[1].children;
|
|
392
393
|
if (l.length === 0)
|
|
393
394
|
return;
|
|
394
395
|
const c = r.offsetTop, d = r.offsetLeft, h = r.offsetWidth, a = r.offsetHeight;
|
|
395
396
|
for (let f = 0; f < l.length; f++) {
|
|
396
|
-
const
|
|
397
|
-
t.appendChild(
|
|
397
|
+
const g = l[f], u = g.firstChild, p = u.offsetTop, m = u.offsetLeft, y = u.offsetWidth, v = u.offsetHeight, w = u.firstChild.nodeObj.branchColor || n, _ = e.generateSubBranch({ pT: c, pL: d, pW: h, pH: a, cT: p, cL: m, cW: y, cH: v, direction: s, isFirst: i });
|
|
398
|
+
t.appendChild(we(_, w, "2"));
|
|
398
399
|
const E = u.children[1];
|
|
399
400
|
if (E) {
|
|
400
401
|
if (E.style.bottom = -(E.offsetHeight / 2) + "px", s === "lhs" ? E.style.left = "10px" : s === "rhs" && (E.style.right = "10px"), !E.expanded)
|
|
401
402
|
continue;
|
|
402
403
|
} else
|
|
403
404
|
continue;
|
|
404
|
-
|
|
405
|
+
Ee(e, t, w, g, s);
|
|
405
406
|
}
|
|
406
407
|
};
|
|
407
|
-
const
|
|
408
|
+
const D = (e, t) => {
|
|
408
409
|
const n = document.createElement("span");
|
|
409
410
|
return n.id = e, n.innerHTML = `<svg class="icon" aria-hidden="true">
|
|
410
411
|
<use xlink:href="#icon-${t}"></use>
|
|
411
412
|
</svg>`, n;
|
|
412
413
|
};
|
|
413
|
-
function
|
|
414
|
-
const t = document.createElement("div"), n =
|
|
414
|
+
function Fe(e) {
|
|
415
|
+
const t = document.createElement("div"), n = D("fullscreen", "full"), o = D("toCenter", "living"), s = D("zoomout", "move"), i = D("zoomin", "add"), r = document.createElement("span");
|
|
415
416
|
return r.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
416
417
|
e.mindElixirBox.requestFullscreen();
|
|
417
418
|
}, o.onclick = () => {
|
|
@@ -422,8 +423,8 @@ function We(e) {
|
|
|
422
423
|
e.scaleVal > 1.6 || e.scale(e.scaleVal + 0.2);
|
|
423
424
|
}, t;
|
|
424
425
|
}
|
|
425
|
-
function
|
|
426
|
-
const t = document.createElement("div"), n =
|
|
426
|
+
function We(e) {
|
|
427
|
+
const t = document.createElement("div"), n = D("tbltl", "left"), o = D("tbltr", "right"), s = D("tblts", "side");
|
|
427
428
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
428
429
|
e.initLeft();
|
|
429
430
|
}, o.onclick = () => {
|
|
@@ -432,12 +433,12 @@ function Xe(e) {
|
|
|
432
433
|
e.initSide();
|
|
433
434
|
}, t;
|
|
434
435
|
}
|
|
435
|
-
function
|
|
436
|
-
e.container.append(
|
|
436
|
+
function Xe(e) {
|
|
437
|
+
e.container.append(Fe(e)), e.container.append(We(e));
|
|
437
438
|
}
|
|
438
439
|
/*! @viselect/vanilla v3.6.0 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
|
|
439
|
-
var
|
|
440
|
-
class
|
|
440
|
+
var Ye = Object.defineProperty, Ge = (e, t, n) => t in e ? Ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, b = (e, t, n) => Ge(e, typeof t != "symbol" ? t + "" : t, n);
|
|
441
|
+
class Ke {
|
|
441
442
|
constructor() {
|
|
442
443
|
b(this, "_listeners", /* @__PURE__ */ new Map()), b(this, "on", this.addEventListener), b(this, "off", this.removeEventListener), b(this, "emit", this.dispatchEvent);
|
|
443
444
|
}
|
|
@@ -459,27 +460,27 @@ class Ue {
|
|
|
459
460
|
this._listeners.clear();
|
|
460
461
|
}
|
|
461
462
|
}
|
|
462
|
-
const
|
|
463
|
+
const le = (e, t = "px") => typeof e == "number" ? e + t : e;
|
|
463
464
|
function T({ style: e }, t, n) {
|
|
464
465
|
if (typeof t == "object")
|
|
465
466
|
for (const [o, s] of Object.entries(t))
|
|
466
|
-
s !== void 0 && (e[o] =
|
|
467
|
+
s !== void 0 && (e[o] = le(s));
|
|
467
468
|
else
|
|
468
|
-
n !== void 0 && (e[t] =
|
|
469
|
+
n !== void 0 && (e[t] = le(n));
|
|
469
470
|
}
|
|
470
|
-
const
|
|
471
|
+
const Se = (e) => (t, n, o, s = {}) => {
|
|
471
472
|
t instanceof HTMLCollection || t instanceof NodeList ? t = Array.from(t) : Array.isArray(t) || (t = [t]), Array.isArray(n) || (n = [n]);
|
|
472
473
|
for (const i of t)
|
|
473
474
|
if (i)
|
|
474
475
|
for (const r of n)
|
|
475
476
|
i[e](r, o, { capture: !1, ...s });
|
|
476
477
|
return [t, n, o, s];
|
|
477
|
-
},
|
|
478
|
+
}, k = Se("addEventListener"), M = Se("removeEventListener"), W = (e) => {
|
|
478
479
|
var t;
|
|
479
480
|
const { clientX: n, clientY: o, target: s } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
|
|
480
481
|
return { x: n, y: o, target: s };
|
|
481
482
|
};
|
|
482
|
-
function
|
|
483
|
+
function ce(e, t, n = "touch") {
|
|
483
484
|
switch (n) {
|
|
484
485
|
case "center": {
|
|
485
486
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -491,7 +492,7 @@ function ae(e, t, n = "touch") {
|
|
|
491
492
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
492
493
|
}
|
|
493
494
|
}
|
|
494
|
-
function
|
|
495
|
+
function H(e, t = document) {
|
|
495
496
|
const n = Array.isArray(e) ? e : [e];
|
|
496
497
|
let o = [];
|
|
497
498
|
for (let s = 0, i = n.length; s < i; s++) {
|
|
@@ -500,7 +501,7 @@ function P(e, t = document) {
|
|
|
500
501
|
}
|
|
501
502
|
return o;
|
|
502
503
|
}
|
|
503
|
-
const
|
|
504
|
+
const Ue = () => matchMedia("(hover: none), (pointer: coarse)").matches, Je = () => "safari" in window, Qe = (e) => {
|
|
504
505
|
let t, n = -1, o = !1;
|
|
505
506
|
return {
|
|
506
507
|
next(...s) {
|
|
@@ -513,7 +514,7 @@ const Je = () => matchMedia("(hover: none), (pointer: coarse)").matches, Qe = ()
|
|
|
513
514
|
}
|
|
514
515
|
};
|
|
515
516
|
};
|
|
516
|
-
function
|
|
517
|
+
function Ze(e, t) {
|
|
517
518
|
for (const n of t) {
|
|
518
519
|
if (typeof n == "number")
|
|
519
520
|
return e.button === n;
|
|
@@ -533,16 +534,16 @@ function et(e, t) {
|
|
|
533
534
|
}
|
|
534
535
|
return !1;
|
|
535
536
|
}
|
|
536
|
-
const { abs:
|
|
537
|
+
const { abs: B, max: ae, min: he, ceil: de } = Math, ue = (e = []) => ({
|
|
537
538
|
stored: e,
|
|
538
539
|
selected: [],
|
|
539
540
|
touched: [],
|
|
540
541
|
changed: { added: [], removed: [] }
|
|
541
542
|
});
|
|
542
|
-
class
|
|
543
|
+
class et extends Ke {
|
|
543
544
|
constructor(t) {
|
|
544
545
|
var n, o, s, i, r;
|
|
545
|
-
super(), b(this, "_options"), b(this, "_selection",
|
|
546
|
+
super(), b(this, "_options"), b(this, "_selection", ue()), b(this, "_area"), b(this, "_clippingElement"), b(this, "_targetElement"), b(this, "_targetBoundary"), b(this, "_targetBoundaryScrolled", !0), b(this, "_targetRect"), b(this, "_selectables", []), b(this, "_latestElement"), b(this, "_areaLocation", { y1: 0, x2: 0, y2: 0, x1: 0 }), b(this, "_areaRect", new DOMRect()), b(this, "_singleClick", !0), b(this, "_frame"), b(this, "_scrollAvailable", !0), b(this, "_scrollingActive", !1), b(this, "_scrollSpeed", { x: 0, y: 0 }), b(this, "_scrollDelta", { x: 0, y: 0 }), b(this, "disable", this._toggleStartEvents.bind(this, !1)), b(this, "enable", this._toggleStartEvents), this._options = {
|
|
546
547
|
selectionAreaClass: "selection-area",
|
|
547
548
|
selectionContainerClass: void 0,
|
|
548
549
|
selectables: [],
|
|
@@ -595,31 +596,31 @@ class tt extends Ue {
|
|
|
595
596
|
// https://stackoverflow.com/a/38268846
|
|
596
597
|
pointerEvents: "none",
|
|
597
598
|
zIndex: "1"
|
|
598
|
-
}), this._frame =
|
|
599
|
+
}), this._frame = Qe((h) => {
|
|
599
600
|
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", h), this._redrawSelectionArea();
|
|
600
601
|
}), this.enable();
|
|
601
602
|
}
|
|
602
603
|
_toggleStartEvents(t = !0) {
|
|
603
|
-
const { document: n, features: o } = this._options, s = t ?
|
|
604
|
+
const { document: n, features: o } = this._options, s = t ? k : M;
|
|
604
605
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
605
606
|
}
|
|
606
607
|
_onTapStart(t, n = !1) {
|
|
607
|
-
const { x: o, y: s, target: i } =
|
|
608
|
-
if (t instanceof MouseEvent && !
|
|
608
|
+
const { x: o, y: s, target: i } = W(t), { document: r, startAreas: l, boundaries: c, features: d, behaviour: h } = this._options, a = i.getBoundingClientRect();
|
|
609
|
+
if (t instanceof MouseEvent && !Ze(t, h.triggers))
|
|
609
610
|
return;
|
|
610
|
-
const f =
|
|
611
|
-
this._targetElement =
|
|
612
|
-
(y) =>
|
|
611
|
+
const f = H(l, r), g = H(c, r);
|
|
612
|
+
this._targetElement = g.find(
|
|
613
|
+
(y) => ce(y.getBoundingClientRect(), a)
|
|
613
614
|
);
|
|
614
615
|
const u = t.composedPath(), p = f.find((y) => u.includes(y));
|
|
615
|
-
if (this._targetBoundary =
|
|
616
|
+
if (this._targetBoundary = g.find((y) => u.includes(y)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
616
617
|
return;
|
|
617
618
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
618
|
-
const
|
|
619
|
-
this._scrollDelta = { x:
|
|
619
|
+
const m = r.scrollingElement ?? r.body;
|
|
620
|
+
this._scrollDelta = { x: m.scrollLeft, y: m.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), k(r, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), k(r, ["mouseup", "touchcancel", "touchend"], this._onTapStop), k(r, "scroll", this._onScroll), d.deselectOnBlur && (this._targetBoundaryScrolled = !1, k(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
620
621
|
}
|
|
621
622
|
_onSingleTap(t) {
|
|
622
|
-
const { singleTap: { intersect: n }, range: o } = this._options.features, s =
|
|
623
|
+
const { singleTap: { intersect: n }, range: o } = this._options.features, s = W(t);
|
|
623
624
|
let i;
|
|
624
625
|
if (n === "native")
|
|
625
626
|
i = s.target;
|
|
@@ -627,8 +628,8 @@ class tt extends Ue {
|
|
|
627
628
|
this.resolveSelectables();
|
|
628
629
|
const { x: l, y: c } = s;
|
|
629
630
|
i = this._selectables.find((d) => {
|
|
630
|
-
const { right: h, left: a, top: f, bottom:
|
|
631
|
-
return l < h && l > a && c <
|
|
631
|
+
const { right: h, left: a, top: f, bottom: g } = d.getBoundingClientRect();
|
|
632
|
+
return l < h && l > a && c < g && c > f;
|
|
632
633
|
});
|
|
633
634
|
}
|
|
634
635
|
if (!i)
|
|
@@ -650,17 +651,17 @@ class tt extends Ue {
|
|
|
650
651
|
r.includes(i) && (r.length === 1 || t.ctrlKey || r.every((l) => this._selection.stored.includes(l))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
|
|
651
652
|
}
|
|
652
653
|
_delayedTapMove(t) {
|
|
653
|
-
const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: l, y: c } =
|
|
654
|
+
const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: l, y: c } = W(t);
|
|
654
655
|
if (
|
|
655
656
|
// Single number for both coordinates
|
|
656
|
-
typeof s == "number" &&
|
|
657
|
-
typeof s == "object" &&
|
|
657
|
+
typeof s == "number" && B(l + c - (i + r)) >= s || // Different x and y threshold
|
|
658
|
+
typeof s == "object" && B(l - i) >= s.x || B(c - r) >= s.y
|
|
658
659
|
) {
|
|
659
660
|
if (M(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
660
661
|
M(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
661
662
|
return;
|
|
662
663
|
}
|
|
663
|
-
|
|
664
|
+
k(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), T(this._area, "display", "block"), H(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (k(this._targetElement, "wheel", this._manualScroll, { passive: !1 }), this._selectables = this._selectables.filter((d) => this._targetElement.contains(d))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
664
665
|
}
|
|
665
666
|
this._handleMoveEvent(t);
|
|
666
667
|
}
|
|
@@ -685,7 +686,7 @@ class tt extends Ue {
|
|
|
685
686
|
}));
|
|
686
687
|
}
|
|
687
688
|
_onTapMove(t) {
|
|
688
|
-
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: r } = s.behaviour.scrolling, l = this._targetElement, { x: c, y: d } =
|
|
689
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: r } = s.behaviour.scrolling, l = this._targetElement, { x: c, y: d } = W(t);
|
|
689
690
|
if (o.x2 = c, o.y2 = d, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
690
691
|
this._scrollingActive = !0;
|
|
691
692
|
const h = () => {
|
|
@@ -694,7 +695,7 @@ class tt extends Ue {
|
|
|
694
695
|
return;
|
|
695
696
|
}
|
|
696
697
|
const { scrollTop: a, scrollLeft: f } = l;
|
|
697
|
-
n.y && (l.scrollTop +=
|
|
698
|
+
n.y && (l.scrollTop += de(n.y / r), o.y1 -= l.scrollTop - a), n.x && (l.scrollLeft += de(n.x / r), o.x1 -= l.scrollLeft - f), i.next(t), requestAnimationFrame(h);
|
|
698
699
|
};
|
|
699
700
|
requestAnimationFrame(h);
|
|
700
701
|
} else
|
|
@@ -703,7 +704,7 @@ class tt extends Ue {
|
|
|
703
704
|
}
|
|
704
705
|
_handleMoveEvent(t) {
|
|
705
706
|
const { features: n } = this._options;
|
|
706
|
-
(n.touch &&
|
|
707
|
+
(n.touch && Ue() || this._scrollAvailable && Je()) && t.preventDefault();
|
|
707
708
|
}
|
|
708
709
|
_onScroll() {
|
|
709
710
|
const { _scrollDelta: t, _options: { document: n } } = this, { scrollTop: o, scrollLeft: s } = n.scrollingElement ?? n.body;
|
|
@@ -717,11 +718,11 @@ class tt extends Ue {
|
|
|
717
718
|
this._scrollSpeed.y += o * n, this._scrollSpeed.x += s * n, this._onTapMove(t), t.preventDefault();
|
|
718
719
|
}
|
|
719
720
|
_recalculateSelectionAreaRect() {
|
|
720
|
-
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, { scrollTop: i, scrollHeight: r, clientHeight: l, scrollLeft: c, scrollWidth: d, clientWidth: h } = o, a = this._targetRect, { x1: f, y1:
|
|
721
|
+
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, { scrollTop: i, scrollHeight: r, clientHeight: l, scrollLeft: c, scrollWidth: d, clientWidth: h } = o, a = this._targetRect, { x1: f, y1: g } = n;
|
|
721
722
|
let { x2: u, y2: p } = n;
|
|
722
|
-
const { behaviour: { scrolling: { startScrollMargins:
|
|
723
|
-
u < a.left +
|
|
724
|
-
const y =
|
|
723
|
+
const { behaviour: { scrolling: { startScrollMargins: m } } } = s;
|
|
724
|
+
u < a.left + m.x ? (t.x = c ? -B(a.left - u + m.x) : 0, u = u < a.left ? a.left : u) : u > a.right - m.x ? (t.x = d - c - h ? B(a.left + a.width - u - m.x) : 0, u = u > a.right ? a.right : u) : t.x = 0, p < a.top + m.y ? (t.y = i ? -B(a.top - p + m.y) : 0, p = p < a.top ? a.top : p) : p > a.bottom - m.y ? (t.y = r - i - l ? B(a.top + a.height - p - m.y) : 0, p = p > a.bottom ? a.bottom : p) : t.y = 0;
|
|
725
|
+
const y = he(f, u), v = he(g, p), w = ae(f, u), _ = ae(g, p);
|
|
725
726
|
this._areaRect = new DOMRect(y, v, w - y, _ - v);
|
|
726
727
|
}
|
|
727
728
|
_redrawSelectionArea() {
|
|
@@ -734,29 +735,29 @@ class tt extends Ue {
|
|
|
734
735
|
M(this._targetElement, "scroll", this._onStartAreaScroll), M(s, ["mousemove", "touchmove"], this._delayedTapMove), M(s, ["touchmove", "mousemove"], this._onTapMove), M(s, ["mouseup", "touchcancel", "touchend"], this._onTapStop), M(s, "scroll", this._onScroll), this._keepSelection(), t && r && i.singleTap.allow ? this._onSingleTap(t) : !r && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, M(this._targetElement, "wheel", this._manualScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), T(this._area, "display", "none");
|
|
735
736
|
}
|
|
736
737
|
_updateElementSelection() {
|
|
737
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: r, touched: l } = o, { intersect: c, overlap: d } = n.behaviour, h = d === "invert", a = [], f = [],
|
|
738
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: r, touched: l } = o, { intersect: c, overlap: d } = n.behaviour, h = d === "invert", a = [], f = [], g = [];
|
|
738
739
|
for (let p = 0; p < t.length; p++) {
|
|
739
|
-
const
|
|
740
|
-
if (
|
|
741
|
-
if (r.includes(
|
|
742
|
-
i.includes(
|
|
743
|
-
else if (h && i.includes(
|
|
744
|
-
|
|
740
|
+
const m = t[p];
|
|
741
|
+
if (ce(s, m.getBoundingClientRect(), c)) {
|
|
742
|
+
if (r.includes(m))
|
|
743
|
+
i.includes(m) && !l.includes(m) && l.push(m);
|
|
744
|
+
else if (h && i.includes(m)) {
|
|
745
|
+
g.push(m);
|
|
745
746
|
continue;
|
|
746
747
|
} else
|
|
747
|
-
f.push(
|
|
748
|
-
a.push(
|
|
748
|
+
f.push(m);
|
|
749
|
+
a.push(m);
|
|
749
750
|
}
|
|
750
751
|
}
|
|
751
752
|
h && f.push(...i.filter((p) => !r.includes(p)));
|
|
752
753
|
const u = d === "keep";
|
|
753
754
|
for (let p = 0; p < r.length; p++) {
|
|
754
|
-
const
|
|
755
|
-
!a.includes(
|
|
755
|
+
const m = r[p];
|
|
756
|
+
!a.includes(m) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
756
757
|
// not make them part of the current selection as soon as they're touched.
|
|
757
|
-
(u && i.includes(
|
|
758
|
+
(u && i.includes(m)) && g.push(m);
|
|
758
759
|
}
|
|
759
|
-
o.selected = a, o.changed = { added: f, removed:
|
|
760
|
+
o.selected = a, o.changed = { added: f, removed: g }, this._latestElement = void 0;
|
|
760
761
|
}
|
|
761
762
|
_emitEvent(t, n) {
|
|
762
763
|
return this.emit(t, {
|
|
@@ -807,7 +808,7 @@ class tt extends Ue {
|
|
|
807
808
|
* Will update everything that can be selected.
|
|
808
809
|
*/
|
|
809
810
|
resolveSelectables() {
|
|
810
|
-
this._selectables =
|
|
811
|
+
this._selectables = H(this._options.selectables, this._options.document);
|
|
811
812
|
}
|
|
812
813
|
/**
|
|
813
814
|
* Same as deselecting, but for all elements currently selected.
|
|
@@ -819,7 +820,7 @@ class tt extends Ue {
|
|
|
819
820
|
i.added = [], i.removed.push(
|
|
820
821
|
...o,
|
|
821
822
|
...t ? s : []
|
|
822
|
-
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection =
|
|
823
|
+
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = ue(t ? [] : s);
|
|
823
824
|
}
|
|
824
825
|
/**
|
|
825
826
|
* @returns {Array} Selected elements
|
|
@@ -851,7 +852,7 @@ class tt extends Ue {
|
|
|
851
852
|
* @param quiet - If this should not trigger the move event
|
|
852
853
|
*/
|
|
853
854
|
select(t, n = !1) {
|
|
854
|
-
const { changed: o, selected: s, stored: i } = this._selection, r =
|
|
855
|
+
const { changed: o, selected: s, stored: i } = this._selection, r = H(t, this._options.document).filter(
|
|
855
856
|
(l) => !s.includes(l) && !i.includes(l)
|
|
856
857
|
);
|
|
857
858
|
return i.push(...r), s.push(...r), o.added.push(...r), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), r;
|
|
@@ -862,7 +863,7 @@ class tt extends Ue {
|
|
|
862
863
|
* @param quiet - If this should not trigger the move event
|
|
863
864
|
*/
|
|
864
865
|
deselect(t, n = !1) {
|
|
865
|
-
const { selected: o, stored: s, changed: i } = this._selection, r =
|
|
866
|
+
const { selected: o, stored: s, changed: i } = this._selection, r = H(t, this._options.document).filter(
|
|
866
867
|
(l) => o.includes(l) || s.includes(l)
|
|
867
868
|
);
|
|
868
869
|
r.length && (this._selection.stored = s.filter((l) => !r.includes(l)), this._selection.selected = o.filter((l) => !r.includes(l)), this._selection.changed.added = [], this._selection.changed.removed.push(
|
|
@@ -870,20 +871,21 @@ class tt extends Ue {
|
|
|
870
871
|
), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)));
|
|
871
872
|
}
|
|
872
873
|
}
|
|
873
|
-
b(
|
|
874
|
-
const
|
|
874
|
+
b(et, "version", "3.6.0");
|
|
875
|
+
const tt = function(e, t = !0) {
|
|
875
876
|
this.theme = e;
|
|
876
877
|
const n = this.theme.cssVar, o = Object.keys(n);
|
|
878
|
+
this.mindElixirBox.style.cssText = "";
|
|
877
879
|
for (let s = 0; s < o.length; s++) {
|
|
878
880
|
const i = o[s];
|
|
879
881
|
this.mindElixirBox.style.setProperty(i, n[i]);
|
|
880
882
|
}
|
|
881
|
-
t && this.refresh();
|
|
882
|
-
},
|
|
883
|
+
e.cssVar["--gap"] || this.mindElixirBox.style.setProperty("--gap", "30px"), t && this.refresh();
|
|
884
|
+
}, nt = function(e) {
|
|
883
885
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
884
886
|
(n == null ? void 0 : n.tagName) === "svg" && (n == null || n.remove());
|
|
885
887
|
};
|
|
886
|
-
function
|
|
888
|
+
function Ce(e) {
|
|
887
889
|
return {
|
|
888
890
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
889
891
|
arrows: e.arrows,
|
|
@@ -892,7 +894,7 @@ function Le(e) {
|
|
|
892
894
|
theme: e.theme
|
|
893
895
|
};
|
|
894
896
|
}
|
|
895
|
-
const
|
|
897
|
+
const ot = function(e, t, n) {
|
|
896
898
|
if (e) {
|
|
897
899
|
if (this.clearSelection(), typeof e == "string") {
|
|
898
900
|
const o = L(e);
|
|
@@ -900,9 +902,9 @@ const st = function(e, t, n) {
|
|
|
900
902
|
}
|
|
901
903
|
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);
|
|
902
904
|
}
|
|
903
|
-
},
|
|
905
|
+
}, st = function() {
|
|
904
906
|
this.currentNode && (this.currentNode.className = ""), this.currentNode = null, this.bus.fire("unselectNode");
|
|
905
|
-
},
|
|
907
|
+
}, it = function(e) {
|
|
906
908
|
this.clearSelection();
|
|
907
909
|
for (const t of e)
|
|
908
910
|
t.className = "selected";
|
|
@@ -910,23 +912,23 @@ const st = function(e, t, n) {
|
|
|
910
912
|
"selectNodes",
|
|
911
913
|
e.map((t) => t.nodeObj)
|
|
912
914
|
);
|
|
913
|
-
},
|
|
915
|
+
}, rt = function() {
|
|
914
916
|
if (this.currentNodes)
|
|
915
917
|
for (const e of this.currentNodes)
|
|
916
918
|
e.classList.remove("selected");
|
|
917
919
|
this.currentNodes = null, this.bus.fire("unselectNodes");
|
|
918
|
-
},
|
|
920
|
+
}, lt = function() {
|
|
919
921
|
this.unselectNode(), this.unselectNodes(), this.unselectSummary(), this.unselectArrow();
|
|
920
|
-
},
|
|
921
|
-
const e =
|
|
922
|
+
}, ct = function() {
|
|
923
|
+
const e = Ce(this);
|
|
922
924
|
return JSON.stringify(e, (t, n) => {
|
|
923
925
|
if (!(t === "parent" && typeof n != "string"))
|
|
924
926
|
return n;
|
|
925
927
|
});
|
|
926
|
-
},
|
|
928
|
+
}, at = function() {
|
|
927
929
|
return JSON.parse(this.getDataString());
|
|
928
|
-
},
|
|
929
|
-
const e =
|
|
930
|
+
}, ht = function() {
|
|
931
|
+
const e = Ce(this).nodeData;
|
|
930
932
|
let t = "# " + e.topic + `
|
|
931
933
|
|
|
932
934
|
`;
|
|
@@ -938,33 +940,33 @@ const st = function(e, t, n) {
|
|
|
938
940
|
`, o[i].children && n(o[i].children || [], s + 1);
|
|
939
941
|
}
|
|
940
942
|
return n(e.children || [], 2), t;
|
|
941
|
-
},
|
|
943
|
+
}, dt = function() {
|
|
942
944
|
this.editable = !0;
|
|
943
|
-
},
|
|
945
|
+
}, ut = function() {
|
|
944
946
|
this.editable = !1;
|
|
945
|
-
},
|
|
947
|
+
}, ft = function(e) {
|
|
946
948
|
this.scaleVal = e, this.map.style.transform = "scale(" + e + ")", this.bus.fire("scale", e);
|
|
947
|
-
},
|
|
949
|
+
}, pt = function() {
|
|
948
950
|
this.container.scrollTo(1e4 - this.container.offsetWidth / 2, 1e4 - this.container.offsetHeight / 2);
|
|
949
|
-
},
|
|
951
|
+
}, mt = function(e) {
|
|
950
952
|
e(this);
|
|
951
|
-
},
|
|
953
|
+
}, gt = function(e) {
|
|
952
954
|
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());
|
|
953
|
-
},
|
|
955
|
+
}, vt = function() {
|
|
954
956
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
955
|
-
},
|
|
957
|
+
}, yt = function() {
|
|
956
958
|
this.direction = 0, this.refresh();
|
|
957
|
-
},
|
|
959
|
+
}, bt = function() {
|
|
958
960
|
this.direction = 1, this.refresh();
|
|
959
|
-
},
|
|
961
|
+
}, xt = function() {
|
|
960
962
|
this.direction = 2, this.refresh();
|
|
961
|
-
},
|
|
963
|
+
}, wt = function(e) {
|
|
962
964
|
this.locale = e, this.refresh();
|
|
963
|
-
},
|
|
965
|
+
}, _t = function(e, t) {
|
|
964
966
|
const n = e.nodeObj;
|
|
965
967
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
966
968
|
const o = e.parentNode, s = o.children[1];
|
|
967
|
-
if (s.expanded = n.expanded, s.className = n.expanded ? "minus" : "",
|
|
969
|
+
if (s.expanded = n.expanded, s.className = n.expanded ? "minus" : "", nt(e), n.expanded) {
|
|
968
970
|
const i = this.createChildren(
|
|
969
971
|
n.children.map((r) => this.createWrapper(r).grp)
|
|
970
972
|
);
|
|
@@ -972,32 +974,32 @@ const st = function(e, t, n) {
|
|
|
972
974
|
} else
|
|
973
975
|
o.parentNode.children[1].remove();
|
|
974
976
|
this.linkDiv(), this.bus.fire("expandNode", n);
|
|
975
|
-
},
|
|
976
|
-
e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []),
|
|
977
|
-
},
|
|
977
|
+
}, Et = function(e) {
|
|
978
|
+
e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), Z(this.nodeData), this.layout(), this.linkDiv();
|
|
979
|
+
}, St = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
978
980
|
__proto__: null,
|
|
979
|
-
cancelFocus:
|
|
980
|
-
clearSelection:
|
|
981
|
-
disableEdit:
|
|
982
|
-
enableEdit:
|
|
983
|
-
expandNode:
|
|
984
|
-
focusNode:
|
|
985
|
-
getData:
|
|
986
|
-
getDataMd:
|
|
987
|
-
getDataString:
|
|
988
|
-
initLeft:
|
|
989
|
-
initRight:
|
|
990
|
-
initSide:
|
|
991
|
-
install:
|
|
992
|
-
refresh:
|
|
993
|
-
scale:
|
|
994
|
-
selectNode:
|
|
995
|
-
selectNodes:
|
|
996
|
-
setLocale:
|
|
997
|
-
toCenter:
|
|
998
|
-
unselectNode:
|
|
999
|
-
unselectNodes:
|
|
1000
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
981
|
+
cancelFocus: vt,
|
|
982
|
+
clearSelection: lt,
|
|
983
|
+
disableEdit: ut,
|
|
984
|
+
enableEdit: dt,
|
|
985
|
+
expandNode: _t,
|
|
986
|
+
focusNode: gt,
|
|
987
|
+
getData: at,
|
|
988
|
+
getDataMd: ht,
|
|
989
|
+
getDataString: ct,
|
|
990
|
+
initLeft: yt,
|
|
991
|
+
initRight: bt,
|
|
992
|
+
initSide: xt,
|
|
993
|
+
install: mt,
|
|
994
|
+
refresh: Et,
|
|
995
|
+
scale: ft,
|
|
996
|
+
selectNode: ot,
|
|
997
|
+
selectNodes: it,
|
|
998
|
+
setLocale: wt,
|
|
999
|
+
toCenter: pt,
|
|
1000
|
+
unselectNode: st,
|
|
1001
|
+
unselectNodes: rt
|
|
1002
|
+
}, Symbol.toStringTag, { value: "Module" })), Ct = function(e) {
|
|
1001
1003
|
return {
|
|
1002
1004
|
dom: e,
|
|
1003
1005
|
moved: !1,
|
|
@@ -1023,11 +1025,11 @@ const st = function(e, t, n) {
|
|
|
1023
1025
|
this.moved = !1, this.mousedown = !1;
|
|
1024
1026
|
}
|
|
1025
1027
|
};
|
|
1026
|
-
},
|
|
1027
|
-
create:
|
|
1028
|
+
}, fe = {
|
|
1029
|
+
create: Ct
|
|
1028
1030
|
};
|
|
1029
|
-
function
|
|
1030
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
1031
|
+
function U(e, t, n) {
|
|
1032
|
+
const { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = t.offsetWidth, r = t.offsetHeight, l = o + i / 2, c = s + r / 2, d = l + n.x, h = c + n.y;
|
|
1031
1033
|
return {
|
|
1032
1034
|
w: i,
|
|
1033
1035
|
h: r,
|
|
@@ -1037,7 +1039,7 @@ function J(e, t, n) {
|
|
|
1037
1039
|
ctrlY: h
|
|
1038
1040
|
};
|
|
1039
1041
|
}
|
|
1040
|
-
function
|
|
1042
|
+
function P(e) {
|
|
1041
1043
|
let t, n;
|
|
1042
1044
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
1043
1045
|
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), {
|
|
@@ -1045,7 +1047,7 @@ function z(e) {
|
|
|
1045
1047
|
y: n
|
|
1046
1048
|
};
|
|
1047
1049
|
}
|
|
1048
|
-
const
|
|
1050
|
+
const Lt = function(e, t, n, o) {
|
|
1049
1051
|
const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
1050
1052
|
return x(s, {
|
|
1051
1053
|
"text-anchor": "middle",
|
|
@@ -1053,18 +1055,18 @@ const Mt = function(e, t, n, o) {
|
|
|
1053
1055
|
y: n + "",
|
|
1054
1056
|
fill: o || "#666"
|
|
1055
1057
|
}), s.dataset.type = "custom-link", s.innerHTML = e, s;
|
|
1056
|
-
},
|
|
1058
|
+
}, Le = function(e, t, n, o, s) {
|
|
1057
1059
|
if (!t || !n)
|
|
1058
1060
|
return;
|
|
1059
1061
|
performance.now();
|
|
1060
|
-
const i =
|
|
1061
|
-
`M ${l} ${c} C ${d} ${h} ${a} ${f} ${
|
|
1062
|
-
`M ${p.x1} ${p.y1} L ${
|
|
1063
|
-
), y = l / 8 + d * 3 / 8 + a * 3 / 8 +
|
|
1064
|
-
|
|
1065
|
-
},
|
|
1062
|
+
const i = U(e, t, o.delta1), r = U(e, n, o.delta2), { x: l, y: c } = P(i), { ctrlX: d, ctrlY: h } = i, { ctrlX: a, ctrlY: f } = r, { x: g, y: u } = P(r), p = ye(a, f, g, u), m = Ve(
|
|
1063
|
+
`M ${l} ${c} C ${d} ${h} ${a} ${f} ${g} ${u}`,
|
|
1064
|
+
`M ${p.x1} ${p.y1} L ${g} ${u} L ${p.x2} ${p.y2}`
|
|
1065
|
+
), y = l / 8 + d * 3 / 8 + a * 3 / 8 + g / 8, v = c / 8 + h * 3 / 8 + f * 3 / 8 + u / 8, w = Lt(o.label, y, v, e.theme.cssVar["--color"]);
|
|
1066
|
+
m.appendChild(w), m.arrowObj = o, m.dataset.linkid = o.id, e.linkSvgGroup.appendChild(m), s || (e.arrows.push(o), e.currentArrow = m, Te(e, o, i, r)), performance.now();
|
|
1067
|
+
}, Mt = function(e, t) {
|
|
1066
1068
|
const n = {
|
|
1067
|
-
id:
|
|
1069
|
+
id: ee(),
|
|
1068
1070
|
label: "Custom Link",
|
|
1069
1071
|
from: e.nodeObj.id,
|
|
1070
1072
|
to: t.nodeObj.id,
|
|
@@ -1077,15 +1079,15 @@ const Mt = function(e, t, n, o) {
|
|
|
1077
1079
|
y: -200
|
|
1078
1080
|
}
|
|
1079
1081
|
};
|
|
1080
|
-
|
|
1082
|
+
Le(this, e, t, n), this.bus.fire("operation", {
|
|
1081
1083
|
name: "createArrow",
|
|
1082
1084
|
obj: n
|
|
1083
1085
|
});
|
|
1084
|
-
},
|
|
1086
|
+
}, Tt = function(e) {
|
|
1085
1087
|
let t;
|
|
1086
1088
|
if (e ? t = e : t = this.currentArrow, !t)
|
|
1087
1089
|
return;
|
|
1088
|
-
|
|
1090
|
+
Me(this);
|
|
1089
1091
|
const n = t.arrowObj.id;
|
|
1090
1092
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.remove(), this.bus.fire("operation", {
|
|
1091
1093
|
name: "removeArrow",
|
|
@@ -1093,18 +1095,18 @@ const Mt = function(e, t, n, o) {
|
|
|
1093
1095
|
id: n
|
|
1094
1096
|
}
|
|
1095
1097
|
});
|
|
1096
|
-
},
|
|
1098
|
+
}, $t = function(e) {
|
|
1097
1099
|
this.currentArrow = e;
|
|
1098
|
-
const t = e.arrowObj, n = L(t.from), o = L(t.to), s =
|
|
1099
|
-
|
|
1100
|
-
},
|
|
1101
|
-
this.currentArrow = null,
|
|
1102
|
-
},
|
|
1100
|
+
const t = e.arrowObj, n = L(t.from), o = L(t.to), s = U(this, n, t.delta1), i = U(this, o, t.delta2);
|
|
1101
|
+
Te(this, t, s, i);
|
|
1102
|
+
}, Nt = function() {
|
|
1103
|
+
this.currentArrow = null, Me(this);
|
|
1104
|
+
}, Me = function(e) {
|
|
1103
1105
|
e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none";
|
|
1104
|
-
},
|
|
1106
|
+
}, Te = function(e, t, n, o) {
|
|
1105
1107
|
var f;
|
|
1106
1108
|
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);
|
|
1107
|
-
let { x: s, y: i } =
|
|
1109
|
+
let { x: s, y: i } = P(n), { ctrlX: r, ctrlY: l } = n, { ctrlX: c, ctrlY: d } = o, { x: h, y: a } = P(o);
|
|
1108
1110
|
e.P2.style.cssText = `top:${l}px;left:${r}px;`, e.P3.style.cssText = `top:${d}px;left:${c}px;`, x(e.line1, {
|
|
1109
1111
|
x1: s + "",
|
|
1110
1112
|
y1: i + "",
|
|
@@ -1115,14 +1117,14 @@ const Mt = function(e, t, n, o) {
|
|
|
1115
1117
|
y1: d + "",
|
|
1116
1118
|
x2: h + "",
|
|
1117
1119
|
y2: a + ""
|
|
1118
|
-
}), e.helper1 && (e.helper1.destory(e.map), (f = e.helper2) == null || f.destory(e.map)), e.helper1 =
|
|
1120
|
+
}), e.helper1 && (e.helper1.destory(e.map), (f = e.helper2) == null || f.destory(e.map)), e.helper1 = fe.create(e.P2), e.helper2 = fe.create(e.P3), e.helper1.init(e.map, (g, u) => {
|
|
1119
1121
|
var v;
|
|
1120
|
-
r = r +
|
|
1121
|
-
const p =
|
|
1122
|
+
r = r + g / e.scaleVal, l = l + u / e.scaleVal;
|
|
1123
|
+
const p = P({ ...n, ctrlX: r, ctrlY: l });
|
|
1122
1124
|
s = p.x, i = p.y;
|
|
1123
|
-
const
|
|
1125
|
+
const m = s / 8 + r * 3 / 8 + c * 3 / 8 + h / 8, y = i / 8 + l * 3 / 8 + d * 3 / 8 + a / 8;
|
|
1124
1126
|
e.P2.style.top = l + "px", e.P2.style.left = r + "px", (v = e.currentArrow) == null || v.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${l} ${c} ${d} ${h} ${a}`), x(e.currentArrow.children[2], {
|
|
1125
|
-
x:
|
|
1127
|
+
x: m + "",
|
|
1126
1128
|
y: y + ""
|
|
1127
1129
|
}), x(e.line1, {
|
|
1128
1130
|
x1: s + "",
|
|
@@ -1130,14 +1132,14 @@ const Mt = function(e, t, n, o) {
|
|
|
1130
1132
|
x2: r + "",
|
|
1131
1133
|
y2: l + ""
|
|
1132
1134
|
}), t.delta1.x = r - n.cx, t.delta1.y = l - n.cy;
|
|
1133
|
-
}), e.helper2.init(e.map, (
|
|
1135
|
+
}), e.helper2.init(e.map, (g, u) => {
|
|
1134
1136
|
var w, _;
|
|
1135
|
-
c = c +
|
|
1136
|
-
const p =
|
|
1137
|
+
c = c + g / e.scaleVal, d = d + u / e.scaleVal;
|
|
1138
|
+
const p = P({ ...o, ctrlX: c, ctrlY: d });
|
|
1137
1139
|
h = p.x, a = p.y;
|
|
1138
|
-
const
|
|
1140
|
+
const m = s / 8 + r * 3 / 8 + c * 3 / 8 + h / 8, y = i / 8 + l * 3 / 8 + d * 3 / 8 + a / 8, v = ye(c, d, h, a);
|
|
1139
1141
|
e.P3.style.top = d + "px", e.P3.style.left = c + "px", (w = e.currentArrow) == null || w.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${l} ${c} ${d} ${h} ${a}`), (_ = e.currentArrow) == null || _.children[1].setAttribute("d", `M ${v.x1} ${v.y1} L ${h} ${a} L ${v.x2} ${v.y2}`), x(e.currentArrow.children[2], {
|
|
1140
|
-
x:
|
|
1142
|
+
x: m + "",
|
|
1141
1143
|
y: y + ""
|
|
1142
1144
|
}), x(e.line2, {
|
|
1143
1145
|
x1: c + "",
|
|
@@ -1147,22 +1149,22 @@ const Mt = function(e, t, n, o) {
|
|
|
1147
1149
|
}), t.delta2.x = c - o.cx, t.delta2.y = d - o.cy;
|
|
1148
1150
|
});
|
|
1149
1151
|
};
|
|
1150
|
-
function
|
|
1152
|
+
function At() {
|
|
1151
1153
|
this.linkSvgGroup.innerHTML = "";
|
|
1152
1154
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
1153
1155
|
const t = this.arrows[e];
|
|
1154
1156
|
try {
|
|
1155
|
-
|
|
1157
|
+
Le(this, L(t.from), L(t.to), t, !0);
|
|
1156
1158
|
} catch {
|
|
1157
1159
|
}
|
|
1158
1160
|
}
|
|
1159
1161
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
1160
1162
|
}
|
|
1161
|
-
function
|
|
1163
|
+
function kt(e) {
|
|
1162
1164
|
if (!e)
|
|
1163
1165
|
return;
|
|
1164
1166
|
const t = e.children[2];
|
|
1165
|
-
|
|
1167
|
+
_e(this, t, (n) => {
|
|
1166
1168
|
var i;
|
|
1167
1169
|
const o = e.arrowObj, s = ((i = n.textContent) == null ? void 0 : i.trim()) || "";
|
|
1168
1170
|
s === "" ? o.label = origin : o.label = s, n.remove(), s !== origin && (t.innerHTML = o.label, this.linkDiv(), this.bus.fire("operation", {
|
|
@@ -1171,19 +1173,19 @@ function Dt(e) {
|
|
|
1171
1173
|
}));
|
|
1172
1174
|
});
|
|
1173
1175
|
}
|
|
1174
|
-
function
|
|
1175
|
-
this.arrows = this.arrows.filter((e) =>
|
|
1176
|
+
function Bt() {
|
|
1177
|
+
this.arrows = this.arrows.filter((e) => G(e.from, this.nodeData) && G(e.to, this.nodeData));
|
|
1176
1178
|
}
|
|
1177
|
-
const
|
|
1179
|
+
const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1178
1180
|
__proto__: null,
|
|
1179
|
-
createArrow:
|
|
1180
|
-
editArrowLabel:
|
|
1181
|
-
removeArrow:
|
|
1182
|
-
renderArrow:
|
|
1183
|
-
selectArrow:
|
|
1184
|
-
tidyArrow:
|
|
1185
|
-
unselectArrow:
|
|
1186
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1181
|
+
createArrow: Mt,
|
|
1182
|
+
editArrowLabel: kt,
|
|
1183
|
+
removeArrow: Tt,
|
|
1184
|
+
renderArrow: At,
|
|
1185
|
+
selectArrow: $t,
|
|
1186
|
+
tidyArrow: Bt,
|
|
1187
|
+
unselectArrow: Nt
|
|
1188
|
+
}, Symbol.toStringTag, { value: "Module" })), Ht = function(e) {
|
|
1187
1189
|
var c, d;
|
|
1188
1190
|
if (e.length === 0)
|
|
1189
1191
|
throw new Error("No selected node.");
|
|
@@ -1191,7 +1193,7 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1191
1193
|
const h = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
1192
1194
|
if (!a)
|
|
1193
1195
|
throw new Error("Can not select root node.");
|
|
1194
|
-
const f = a.children.findIndex((
|
|
1196
|
+
const f = a.children.findIndex((g) => h === g);
|
|
1195
1197
|
return {
|
|
1196
1198
|
parent: a.id,
|
|
1197
1199
|
start: f,
|
|
@@ -1203,8 +1205,8 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1203
1205
|
let a = h.nodeObj;
|
|
1204
1206
|
const f = [];
|
|
1205
1207
|
for (; a.parent; ) {
|
|
1206
|
-
const
|
|
1207
|
-
a =
|
|
1208
|
+
const g = a.parent, u = g.children, p = u == null ? void 0 : u.indexOf(a);
|
|
1209
|
+
a = g, f.unshift({ node: a, index: p });
|
|
1208
1210
|
}
|
|
1209
1211
|
return f.length > t && (t = f.length), f;
|
|
1210
1212
|
});
|
|
@@ -1226,10 +1228,10 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1226
1228
|
start: i,
|
|
1227
1229
|
end: r
|
|
1228
1230
|
};
|
|
1229
|
-
},
|
|
1231
|
+
}, Pt = function(e) {
|
|
1230
1232
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1231
1233
|
return t.setAttribute("id", e), t;
|
|
1232
|
-
},
|
|
1234
|
+
}, pe = function(e, t) {
|
|
1233
1235
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1234
1236
|
return x(n, {
|
|
1235
1237
|
d: e,
|
|
@@ -1238,7 +1240,7 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1238
1240
|
"stroke-linecap": "round",
|
|
1239
1241
|
"stroke-width": "2"
|
|
1240
1242
|
}), n;
|
|
1241
|
-
},
|
|
1243
|
+
}, me = function(e, t, n, o, s) {
|
|
1242
1244
|
const i = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
1243
1245
|
return x(i, {
|
|
1244
1246
|
"text-anchor": o,
|
|
@@ -1246,43 +1248,43 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1246
1248
|
y: n + "",
|
|
1247
1249
|
fill: s || "#666"
|
|
1248
1250
|
}), i.innerHTML = e, i;
|
|
1249
|
-
},
|
|
1251
|
+
}, zt = (e) => L(e).parentElement.parentElement, Ot = function({ parent: e, start: t }) {
|
|
1250
1252
|
var i, r;
|
|
1251
1253
|
const n = L(e), o = n.nodeObj;
|
|
1252
1254
|
let s;
|
|
1253
1255
|
return o.parent ? s = (i = n.closest("me-main")) == null ? void 0 : i.className : s = (r = L(o.children[t].id).closest("me-main")) == null ? void 0 : r.className, s;
|
|
1254
|
-
},
|
|
1255
|
-
var
|
|
1256
|
-
const { id: n, text: o, parent: s, start: i, end: r } = t, l = e.nodes, d = L(s).nodeObj, h =
|
|
1257
|
-
let a = 1 / 0, f = 0,
|
|
1258
|
-
for (let
|
|
1259
|
-
const
|
|
1260
|
-
if (!
|
|
1256
|
+
}, $e = function(e, t) {
|
|
1257
|
+
var te;
|
|
1258
|
+
const { id: n, text: o, parent: s, start: i, end: r } = t, l = e.nodes, d = L(s).nodeObj, h = Ot(t);
|
|
1259
|
+
let a = 1 / 0, f = 0, g = 0, u = 0;
|
|
1260
|
+
for (let q = i; q <= r; q++) {
|
|
1261
|
+
const ne = (te = d.children) == null ? void 0 : te[q];
|
|
1262
|
+
if (!ne)
|
|
1261
1263
|
return e.removeSummary(n), null;
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
+
const I = zt(ne.id), { offsetLeft: F, offsetTop: oe } = $(l, I);
|
|
1265
|
+
q === i && (g = oe + 20), q === r && (u = oe + I.offsetHeight - 20), F < a && (a = F), I.offsetWidth + F > f && (f = I.offsetWidth + F);
|
|
1264
1266
|
}
|
|
1265
|
-
let p,
|
|
1266
|
-
const y =
|
|
1267
|
-
h === "lhs" ? (p =
|
|
1268
|
-
const E =
|
|
1269
|
-
return E.appendChild(p), E.appendChild(
|
|
1270
|
-
},
|
|
1267
|
+
let p, m;
|
|
1268
|
+
const y = g + 10, v = u + 10, w = (y + v) / 2, _ = e.theme.cssVar["--color"];
|
|
1269
|
+
h === "lhs" ? (p = pe(`M ${a + 10} ${y} c -5 0 -10 5 -10 10 L ${a} ${v - 10} c 0 5 5 10 10 10 M ${a} ${w} h -10`, _), m = me(o, a - 20, w + 6, "end", _)) : (p = pe(`M ${f - 10} ${y} c 5 0 10 5 10 10 L ${f} ${v - 10} c 0 5 -5 10 -10 10 M ${f} ${w} h 10`, _), m = me(o, f + 20, w + 6, "start", _));
|
|
1270
|
+
const E = Pt("s-" + n);
|
|
1271
|
+
return E.appendChild(p), E.appendChild(m), E.summaryObj = t, e.summarySvg.appendChild(E), E;
|
|
1272
|
+
}, jt = function() {
|
|
1271
1273
|
let e = [];
|
|
1272
1274
|
this.currentNode ? e = [this.currentNode] : this.currentNodes && (e = this.currentNodes);
|
|
1273
|
-
const { parent: t, start: n, end: o } =
|
|
1275
|
+
const { parent: t, start: n, end: o } = Ht(e), s = { id: ee(), parent: t, start: n, end: o, text: "summary" }, i = $e(this, s);
|
|
1274
1276
|
this.summaries.push(s), this.editSummary(i), this.bus.fire("operation", {
|
|
1275
1277
|
name: "createSummary",
|
|
1276
1278
|
obj: s
|
|
1277
1279
|
});
|
|
1278
|
-
},
|
|
1280
|
+
}, qt = function(e) {
|
|
1279
1281
|
var n;
|
|
1280
1282
|
const t = this.summaries.findIndex((o) => o.id === e);
|
|
1281
1283
|
t > -1 && (this.summaries.splice(t, 1), (n = document.querySelector("#s-" + e)) == null || n.remove()), this.bus.fire("operation", {
|
|
1282
1284
|
name: "removeSummary",
|
|
1283
1285
|
obj: { id: e }
|
|
1284
1286
|
});
|
|
1285
|
-
},
|
|
1287
|
+
}, Rt = function(e) {
|
|
1286
1288
|
const t = e.children[1].getBBox(), n = 6, o = 3, s = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
1287
1289
|
x(s, {
|
|
1288
1290
|
x: t.x - n + "",
|
|
@@ -1294,21 +1296,21 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1294
1296
|
"stroke-width": "2",
|
|
1295
1297
|
fill: "none"
|
|
1296
1298
|
}), s.classList.add("selected"), e.appendChild(s), this.currentSummary = e;
|
|
1297
|
-
},
|
|
1299
|
+
}, Vt = function() {
|
|
1298
1300
|
var e, t;
|
|
1299
1301
|
(t = (e = this.currentSummary) == null ? void 0 : e.querySelector("rect")) == null || t.remove(), this.currentSummary = null;
|
|
1300
|
-
},
|
|
1302
|
+
}, It = function() {
|
|
1301
1303
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
1302
1304
|
try {
|
|
1303
|
-
|
|
1305
|
+
$e(this, e);
|
|
1304
1306
|
} catch {
|
|
1305
1307
|
}
|
|
1306
1308
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1307
|
-
},
|
|
1309
|
+
}, Ft = function(e) {
|
|
1308
1310
|
if (!e)
|
|
1309
1311
|
return;
|
|
1310
1312
|
const t = e.childNodes[1];
|
|
1311
|
-
|
|
1313
|
+
_e(this, t, (n) => {
|
|
1312
1314
|
var i;
|
|
1313
1315
|
const o = e.summaryObj, s = ((i = n.textContent) == null ? void 0 : i.trim()) || "";
|
|
1314
1316
|
s === "" ? o.text = origin : o.text = s, n.remove(), s !== origin && (t.innerHTML = o.text, this.linkDiv(), this.bus.fire("operation", {
|
|
@@ -1316,16 +1318,16 @@ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1316
1318
|
obj: o
|
|
1317
1319
|
}));
|
|
1318
1320
|
});
|
|
1319
|
-
},
|
|
1321
|
+
}, Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1320
1322
|
__proto__: null,
|
|
1321
|
-
createSummary:
|
|
1322
|
-
editSummary:
|
|
1323
|
-
removeSummary:
|
|
1324
|
-
renderSummary:
|
|
1325
|
-
selectSummary:
|
|
1326
|
-
unselectSummary:
|
|
1323
|
+
createSummary: jt,
|
|
1324
|
+
editSummary: Ft,
|
|
1325
|
+
removeSummary: qt,
|
|
1326
|
+
renderSummary: It,
|
|
1327
|
+
selectSummary: Rt,
|
|
1328
|
+
unselectSummary: Vt
|
|
1327
1329
|
}, Symbol.toStringTag, { value: "Module" })), C = "http://www.w3.org/2000/svg";
|
|
1328
|
-
function
|
|
1330
|
+
function Xt(e, t) {
|
|
1329
1331
|
const n = document.createElementNS(C, "svg");
|
|
1330
1332
|
return x(n, {
|
|
1331
1333
|
version: "1.1",
|
|
@@ -1334,10 +1336,10 @@ function Yt(e, t) {
|
|
|
1334
1336
|
width: t
|
|
1335
1337
|
}), n;
|
|
1336
1338
|
}
|
|
1337
|
-
function
|
|
1339
|
+
function Yt(e, t) {
|
|
1338
1340
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
1339
1341
|
}
|
|
1340
|
-
function
|
|
1342
|
+
function Gt(e, t, n, o) {
|
|
1341
1343
|
const s = document.createElementNS(C, "g");
|
|
1342
1344
|
let i = "";
|
|
1343
1345
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
@@ -1345,7 +1347,7 @@ function Kt(e, t, n, o) {
|
|
|
1345
1347
|
const d = document.createElementNS(C, "text");
|
|
1346
1348
|
x(d, {
|
|
1347
1349
|
x: n + parseInt(t.paddingLeft) + "",
|
|
1348
|
-
y: o + parseInt(t.paddingTop) +
|
|
1350
|
+
y: o + parseInt(t.paddingTop) + Yt(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
|
|
1349
1351
|
"text-anchor": "start",
|
|
1350
1352
|
"font-family": t.fontFamily,
|
|
1351
1353
|
"font-size": `${t.fontSize}`,
|
|
@@ -1354,7 +1356,7 @@ function Kt(e, t, n, o) {
|
|
|
1354
1356
|
}), d.innerHTML = l, s.appendChild(d);
|
|
1355
1357
|
}), s;
|
|
1356
1358
|
}
|
|
1357
|
-
function
|
|
1359
|
+
function Kt(e, t, n, o) {
|
|
1358
1360
|
var l;
|
|
1359
1361
|
let s = "";
|
|
1360
1362
|
(l = e.nodeObj) != null && l.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
@@ -1371,8 +1373,8 @@ function Ut(e, t, n, o) {
|
|
|
1371
1373
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
1372
1374
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1373
1375
|
}
|
|
1374
|
-
function
|
|
1375
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
1376
|
+
function Ut(e, t) {
|
|
1377
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = document.createElementNS(C, "rect");
|
|
1376
1378
|
return x(i, {
|
|
1377
1379
|
x: o + "",
|
|
1378
1380
|
y: s + "",
|
|
@@ -1385,8 +1387,8 @@ function Jt(e, t) {
|
|
|
1385
1387
|
"stroke-width": n.borderWidth
|
|
1386
1388
|
}), i;
|
|
1387
1389
|
}
|
|
1388
|
-
function
|
|
1389
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
1390
|
+
function X(e, t, n = !1) {
|
|
1391
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = $(e.nodes, t), r = document.createElementNS(C, "rect");
|
|
1390
1392
|
x(r, {
|
|
1391
1393
|
x: s + "",
|
|
1392
1394
|
y: i + "",
|
|
@@ -1401,10 +1403,10 @@ function Y(e, t, n = !1) {
|
|
|
1401
1403
|
const l = document.createElementNS(C, "g");
|
|
1402
1404
|
l.appendChild(r);
|
|
1403
1405
|
let c;
|
|
1404
|
-
return n ? c =
|
|
1406
|
+
return n ? c = Kt(t, o, s, i) : c = Gt(t, o, s, i), l.appendChild(c), l;
|
|
1405
1407
|
}
|
|
1406
|
-
function
|
|
1407
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
1408
|
+
function Jt(e, t) {
|
|
1409
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = document.createElementNS(C, "a"), r = document.createElementNS(C, "text");
|
|
1408
1410
|
return x(r, {
|
|
1409
1411
|
x: o + "",
|
|
1410
1412
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -1415,8 +1417,8 @@ function Qt(e, t) {
|
|
|
1415
1417
|
fill: `${n.color}`
|
|
1416
1418
|
}), r.innerHTML = t.textContent, i.appendChild(r), i.setAttribute("href", t.href), i;
|
|
1417
1419
|
}
|
|
1418
|
-
function
|
|
1419
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
1420
|
+
function Qt(e, t) {
|
|
1421
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = document.createElementNS(C, "image");
|
|
1420
1422
|
return x(i, {
|
|
1421
1423
|
x: o + "",
|
|
1422
1424
|
y: s + "",
|
|
@@ -1425,9 +1427,9 @@ function Zt(e, t) {
|
|
|
1425
1427
|
href: t.src
|
|
1426
1428
|
}), i;
|
|
1427
1429
|
}
|
|
1428
|
-
const
|
|
1429
|
-
var a, f,
|
|
1430
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
1430
|
+
const Y = 100, Zt = '<?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">', en = (e, t = !1) => {
|
|
1431
|
+
var a, f, g;
|
|
1432
|
+
const n = e.nodes, o = n.offsetHeight + Y * 2, s = n.offsetWidth + Y * 2, i = Xt(o + "px", s + "px"), r = document.createElementNS(C, "svg"), l = document.createElementNS(C, "rect");
|
|
1431
1433
|
x(l, {
|
|
1432
1434
|
x: "0",
|
|
1433
1435
|
y: "0",
|
|
@@ -1435,31 +1437,31 @@ const G = 100, en = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1435
1437
|
height: `${o}`,
|
|
1436
1438
|
fill: e.theme.cssVar["--bgcolor"]
|
|
1437
1439
|
}), i.appendChild(l), n.querySelectorAll(".subLines").forEach((u) => {
|
|
1438
|
-
const p = u.cloneNode(!0), { offsetLeft:
|
|
1439
|
-
p.setAttribute("x", `${
|
|
1440
|
+
const p = u.cloneNode(!0), { offsetLeft: m, offsetTop: y } = $(n, u.parentElement);
|
|
1441
|
+
p.setAttribute("x", `${m}`), p.setAttribute("y", `${y}`), r.appendChild(p);
|
|
1440
1442
|
});
|
|
1441
1443
|
const c = (a = n.querySelector(".lines")) == null ? void 0 : a.cloneNode(!0);
|
|
1442
1444
|
c && r.appendChild(c);
|
|
1443
1445
|
const d = (f = n.querySelector(".topiclinks")) == null ? void 0 : f.cloneNode(!0);
|
|
1444
1446
|
d && r.appendChild(d);
|
|
1445
|
-
const h = (
|
|
1447
|
+
const h = (g = n.querySelector(".summary")) == null ? void 0 : g.cloneNode(!0);
|
|
1446
1448
|
return h && r.appendChild(h), n.querySelectorAll("me-tpc").forEach((u) => {
|
|
1447
|
-
u.nodeObj.dangerouslySetInnerHTML ? r.appendChild(
|
|
1449
|
+
u.nodeObj.dangerouslySetInnerHTML ? r.appendChild(X(e, u, !t)) : (r.appendChild(Ut(e, u)), r.appendChild(X(e, u.text, !t)));
|
|
1448
1450
|
}), n.querySelectorAll(".tags > span").forEach((u) => {
|
|
1449
|
-
r.appendChild(
|
|
1451
|
+
r.appendChild(X(e, u));
|
|
1450
1452
|
}), n.querySelectorAll(".icons > span").forEach((u) => {
|
|
1451
|
-
r.appendChild(
|
|
1453
|
+
r.appendChild(X(e, u));
|
|
1452
1454
|
}), n.querySelectorAll(".hyper-link").forEach((u) => {
|
|
1453
|
-
r.appendChild(
|
|
1455
|
+
r.appendChild(Jt(e, u));
|
|
1454
1456
|
}), n.querySelectorAll("img").forEach((u) => {
|
|
1455
|
-
r.appendChild(
|
|
1457
|
+
r.appendChild(Qt(e, u));
|
|
1456
1458
|
}), x(r, {
|
|
1457
|
-
x:
|
|
1458
|
-
y:
|
|
1459
|
+
x: Y + "",
|
|
1460
|
+
y: Y + "",
|
|
1459
1461
|
overflow: "visible"
|
|
1460
1462
|
}), i.appendChild(r), i;
|
|
1461
|
-
},
|
|
1462
|
-
function
|
|
1463
|
+
}, tn = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Zt + e.outerHTML);
|
|
1464
|
+
function nn(e) {
|
|
1463
1465
|
return new Promise((t, n) => {
|
|
1464
1466
|
const o = new FileReader();
|
|
1465
1467
|
o.onload = (s) => {
|
|
@@ -1469,11 +1471,11 @@ function on(e) {
|
|
|
1469
1471
|
}, o.readAsDataURL(e);
|
|
1470
1472
|
});
|
|
1471
1473
|
}
|
|
1472
|
-
const
|
|
1473
|
-
const n =
|
|
1474
|
+
const on = function(e = !1, t) {
|
|
1475
|
+
const n = en(this, e), o = tn(n, t);
|
|
1474
1476
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1475
|
-
},
|
|
1476
|
-
const n = this.exportSvg(e, t), o = await
|
|
1477
|
+
}, sn = async function(e = !1, t) {
|
|
1478
|
+
const n = this.exportSvg(e, t), o = await nn(n);
|
|
1477
1479
|
return new Promise((s, i) => {
|
|
1478
1480
|
const r = new Image();
|
|
1479
1481
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -1481,55 +1483,56 @@ const sn = function(e = !1, t) {
|
|
|
1481
1483
|
l.width = r.width, l.height = r.height, l.getContext("2d").drawImage(r, 0, 0), l.toBlob(s, "image/png", 1);
|
|
1482
1484
|
}, r.src = o, r.onerror = i;
|
|
1483
1485
|
});
|
|
1484
|
-
},
|
|
1486
|
+
}, rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1485
1487
|
__proto__: null,
|
|
1486
|
-
exportPng:
|
|
1487
|
-
exportSvg:
|
|
1488
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1489
|
-
getObjById:
|
|
1490
|
-
generateNewObj:
|
|
1491
|
-
layout:
|
|
1492
|
-
linkDiv:
|
|
1493
|
-
editTopic:
|
|
1494
|
-
createWrapper:
|
|
1495
|
-
createParent:
|
|
1496
|
-
createChildren:
|
|
1497
|
-
createTopic:
|
|
1488
|
+
exportPng: sn,
|
|
1489
|
+
exportSvg: on
|
|
1490
|
+
}, Symbol.toStringTag, { value: "Module" })), ln = {}, cn = {
|
|
1491
|
+
getObjById: G,
|
|
1492
|
+
generateNewObj: Ne,
|
|
1493
|
+
layout: Be,
|
|
1494
|
+
linkDiv: Ie,
|
|
1495
|
+
editTopic: qe,
|
|
1496
|
+
createWrapper: Pe,
|
|
1497
|
+
createParent: ze,
|
|
1498
|
+
createChildren: Oe,
|
|
1499
|
+
createTopic: je,
|
|
1498
1500
|
findEle: L,
|
|
1499
|
-
changeTheme:
|
|
1500
|
-
...
|
|
1501
|
-
...cn,
|
|
1502
|
-
...Bt,
|
|
1503
|
-
...Xt,
|
|
1501
|
+
changeTheme: tt,
|
|
1502
|
+
...St,
|
|
1504
1503
|
...ln,
|
|
1504
|
+
...Dt,
|
|
1505
|
+
...Wt,
|
|
1506
|
+
...rn,
|
|
1505
1507
|
init(e) {
|
|
1506
1508
|
if (!e || !e.nodeData)
|
|
1507
1509
|
return new Error("MindElixir: `data` is required");
|
|
1508
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
1510
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, Z(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Xe(this), this.toCenter(), this.layout(), this.linkDiv();
|
|
1509
1511
|
},
|
|
1510
1512
|
destroy() {
|
|
1511
1513
|
var e, t;
|
|
1512
1514
|
this.disposable.forEach((n) => n()), (e = this.mindElixirBox) == null || e.remove(), 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, (t = this.selection) == null || t.destroy(), this.selection = void 0;
|
|
1513
1515
|
}
|
|
1514
1516
|
};
|
|
1515
|
-
function
|
|
1517
|
+
function an({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction: c, containerHeight: d }) {
|
|
1516
1518
|
let h = t + n / 2;
|
|
1517
1519
|
const a = e + o / 2;
|
|
1518
1520
|
let f;
|
|
1519
1521
|
c === "lhs" ? f = i + r : f = i;
|
|
1520
|
-
const
|
|
1521
|
-
return c === "lhs" ? h = h - n / 10 - p : h = h + n / 10 + p, `M ${h} ${a} Q ${h} ${
|
|
1522
|
+
const g = s + l / 2, p = (1 - Math.abs(g - a) / d) * 0.25 * (n / 2);
|
|
1523
|
+
return c === "lhs" ? h = h - n / 10 - p : h = h + n / 10 + p, `M ${h} ${a} Q ${h} ${g} ${f} ${g}`;
|
|
1522
1524
|
}
|
|
1523
|
-
function
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1525
|
+
function hn({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction: c, isFirst: d }) {
|
|
1526
|
+
const h = parseInt(this.mindElixirBox.style.getPropertyValue("--gap"));
|
|
1527
|
+
let a = 0, f = 0;
|
|
1528
|
+
d ? a = e + o / 2 : a = e + o;
|
|
1529
|
+
const g = s + l;
|
|
1530
|
+
let u = 0, p = 0, m = 0;
|
|
1531
|
+
const y = Math.abs(a - g) / 300 * h;
|
|
1532
|
+
return c === "lhs" ? (m = t, u = m + h, p = m - h, f = i + h, `M ${u} ${a} C ${m} ${a} ${m + y} ${g} ${p} ${g} H ${f}`) : (m = t + n, u = m - h, p = m + h, f = i + r - h, `M ${u} ${a} C ${m} ${a} ${m - y} ${g} ${p} ${g} H ${f}`);
|
|
1530
1533
|
}
|
|
1531
|
-
const
|
|
1532
|
-
function
|
|
1534
|
+
const dn = "4.3.0", R = document;
|
|
1535
|
+
function N({
|
|
1533
1536
|
el: e,
|
|
1534
1537
|
direction: t,
|
|
1535
1538
|
locale: n,
|
|
@@ -1543,30 +1546,30 @@ function A({
|
|
|
1543
1546
|
selectionContainer: h,
|
|
1544
1547
|
before: a,
|
|
1545
1548
|
newTopicName: f,
|
|
1546
|
-
allowUndo:
|
|
1549
|
+
allowUndo: g,
|
|
1547
1550
|
generateMainBranch: u,
|
|
1548
1551
|
generateSubBranch: p,
|
|
1549
|
-
overflowHidden:
|
|
1552
|
+
overflowHidden: m,
|
|
1550
1553
|
theme: y
|
|
1551
1554
|
}) {
|
|
1552
1555
|
let v = null;
|
|
1553
1556
|
const w = Object.prototype.toString.call(e);
|
|
1554
1557
|
if (w === "[object HTMLDivElement]" ? v = e : w === "[object String]" && (v = document.querySelector(e)), !v)
|
|
1555
1558
|
throw new Error("MindElixir: el is not a valid element");
|
|
1556
|
-
v.className += " mind-elixir", v.innerHTML = "",
|
|
1559
|
+
v.className += " mind-elixir", v.innerHTML = "", this.mindElixirBox = v, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = l === void 0 ? !0 : l, this.keypress = c === void 0 ? !0 : c, this.mouseSelectionButton = d || 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 = g === void 0 ? !1 : g, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = u || an, this.generateSubBranch = p || hn, this.overflowHidden = m || !1, this.bus = ke.create(), this.container = R.createElement("div"), this.selectionContainer = h || this.container, this.container.className = "map-container";
|
|
1557
1560
|
const _ = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1558
|
-
this.theme = y || (_.matches ?
|
|
1559
|
-
const E =
|
|
1560
|
-
E.className = "map-canvas", this.map = E, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes =
|
|
1561
|
+
this.theme = y || (_.matches ? ve : ge);
|
|
1562
|
+
const E = R.createElement("div");
|
|
1563
|
+
E.className = "map-canvas", this.map = E, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = R.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = V("lines"), this.summarySvg = V("summary"), this.linkController = V("linkcontroller"), this.P2 = R.createElement("div"), this.P3 = R.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = re(), this.line2 = re(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = V("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : Ae(this);
|
|
1561
1564
|
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1565
|
+
N.prototype = cn;
|
|
1566
|
+
N.LEFT = j;
|
|
1567
|
+
N.RIGHT = J;
|
|
1568
|
+
N.SIDE = Q;
|
|
1569
|
+
N.THEME = ge;
|
|
1570
|
+
N.DARK_THEME = ve;
|
|
1571
|
+
N.version = dn;
|
|
1572
|
+
N.E = L;
|
|
1570
1573
|
export {
|
|
1571
|
-
|
|
1574
|
+
N as default
|
|
1572
1575
|
};
|