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