mind-elixir 5.6.0 → 5.7.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 +4 -4
- package/dist/MindElixir.js +1133 -1101
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +643 -628
- package/dist/types/arrow.d.ts +3 -3
- package/dist/types/exampleData/plaintext.d.ts +2 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/interact.d.ts +1 -0
- package/dist/types/methods.d.ts +1 -0
- package/dist/types/types/index.d.ts +8 -1
- package/dist/types/utils/plaintextConverter.d.ts +17 -0
- package/package.json +2 -2
- package/readme.md +12 -1
package/dist/MindElixirLite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const ft = {
|
|
1
|
+
const Wn = 0, Xn = 1, Gn = 2, ft = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -23,7 +23,7 @@ const ft = {
|
|
|
23
23
|
"--panel-color": "#444446",
|
|
24
24
|
"--panel-bgcolor": "#ffffff",
|
|
25
25
|
"--panel-border-color": "#eaeaea",
|
|
26
|
-
"--map-padding": "50px"
|
|
26
|
+
"--map-padding": "50px 80px"
|
|
27
27
|
}
|
|
28
28
|
}, ut = {
|
|
29
29
|
name: "Dark",
|
|
@@ -53,7 +53,7 @@ const ft = {
|
|
|
53
53
|
"--map-padding": "50px 80px"
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
function
|
|
56
|
+
function Rt(t) {
|
|
57
57
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
58
58
|
}
|
|
59
59
|
const tt = function(t, e) {
|
|
@@ -77,7 +77,7 @@ const tt = function(t, e) {
|
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
79
|
function et(t, e, n, o) {
|
|
80
|
-
const s = n - t, i = o - e,
|
|
80
|
+
const s = n - t, i = o - e, l = Math.atan2(i, s) * 180 / Math.PI, a = 12, c = 30, h = (l + 180 - c) * Math.PI / 180, f = (l + 180 + c) * Math.PI / 180;
|
|
81
81
|
return {
|
|
82
82
|
x1: n + Math.cos(h) * a,
|
|
83
83
|
y1: o + Math.sin(h) * a,
|
|
@@ -88,7 +88,7 @@ function et(t, e, n, o) {
|
|
|
88
88
|
function _() {
|
|
89
89
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
90
90
|
}
|
|
91
|
-
const
|
|
91
|
+
const Wt = function() {
|
|
92
92
|
const t = _();
|
|
93
93
|
return {
|
|
94
94
|
topic: this.newTopicName,
|
|
@@ -99,10 +99,10 @@ const Rt = function() {
|
|
|
99
99
|
for (; e && e !== t; )
|
|
100
100
|
n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
|
|
101
101
|
return { offsetLeft: n, offsetTop: o };
|
|
102
|
-
},
|
|
102
|
+
}, $ = (t, e) => {
|
|
103
103
|
for (const n in e)
|
|
104
104
|
t.setAttribute(n, e[n]);
|
|
105
|
-
},
|
|
105
|
+
}, lt = (t) => t ? t.tagName === "ME-TPC" : !1, gt = (t) => {
|
|
106
106
|
const e = /translate3d\(([^,]+),\s*([^,]+)/, n = t.match(e);
|
|
107
107
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
108
108
|
}, Dt = function(t) {
|
|
@@ -122,7 +122,296 @@ const Rt = function() {
|
|
|
122
122
|
}, F = {
|
|
123
123
|
LHS: "lhs",
|
|
124
124
|
RHS: "rhs"
|
|
125
|
-
},
|
|
125
|
+
}, nt = document, Xt = function() {
|
|
126
|
+
this.nodes.innerHTML = "";
|
|
127
|
+
const t = this.createTopic(this.nodeData);
|
|
128
|
+
kt.call(this, t, this.nodeData), t.draggable = !1;
|
|
129
|
+
const e = nt.createElement("me-root");
|
|
130
|
+
e.appendChild(t);
|
|
131
|
+
const n = this.nodeData.children || [];
|
|
132
|
+
if (this.direction === 2) {
|
|
133
|
+
let o = 0, s = 0;
|
|
134
|
+
n.map((i) => {
|
|
135
|
+
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
Gt(this, n, e);
|
|
139
|
+
}, Gt = function(t, e, n) {
|
|
140
|
+
const o = nt.createElement("me-main");
|
|
141
|
+
o.className = F.LHS;
|
|
142
|
+
const s = nt.createElement("me-main");
|
|
143
|
+
s.className = F.RHS;
|
|
144
|
+
for (let i = 0; i < e.length; i++) {
|
|
145
|
+
const r = e[i], { grp: l } = t.createWrapper(r);
|
|
146
|
+
t.direction === 2 ? r.direction === 0 ? o.appendChild(l) : s.appendChild(l) : t.direction === 0 ? o.appendChild(l) : s.appendChild(l);
|
|
147
|
+
}
|
|
148
|
+
t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(s), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
|
|
149
|
+
}, Vt = function(t, e) {
|
|
150
|
+
const n = nt.createElement("me-children");
|
|
151
|
+
for (let o = 0; o < e.length; o++) {
|
|
152
|
+
const s = e[o], { grp: i } = t.createWrapper(s);
|
|
153
|
+
n.appendChild(i);
|
|
154
|
+
}
|
|
155
|
+
return n;
|
|
156
|
+
}, A = document, Mt = function(t, e) {
|
|
157
|
+
const o = (this?.el ? this.el : e || document).querySelector(`[data-nodeid="me${t}"]`);
|
|
158
|
+
if (!o) throw new Error(`FindEle: Node ${t} not found, maybe it's collapsed.`);
|
|
159
|
+
return o;
|
|
160
|
+
}, kt = function(t, e) {
|
|
161
|
+
if (t.innerHTML = "", e.style) {
|
|
162
|
+
const n = e.style;
|
|
163
|
+
for (const o in n)
|
|
164
|
+
t.style[o] = n[o];
|
|
165
|
+
}
|
|
166
|
+
if (e.dangerouslySetInnerHTML) {
|
|
167
|
+
t.innerHTML = e.dangerouslySetInnerHTML;
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (e.image) {
|
|
171
|
+
const n = e.image;
|
|
172
|
+
if (n.url && n.width && n.height) {
|
|
173
|
+
const o = A.createElement("img");
|
|
174
|
+
o.src = this.imageProxy ? this.imageProxy(n.url) : n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), t.appendChild(o), t.image = o;
|
|
175
|
+
}
|
|
176
|
+
} else t.image && (t.image = void 0);
|
|
177
|
+
{
|
|
178
|
+
const n = A.createElement("span");
|
|
179
|
+
n.className = "text", this.markdown ? n.innerHTML = this.markdown(e.topic, e) : n.textContent = e.topic, t.appendChild(n), t.text = n;
|
|
180
|
+
}
|
|
181
|
+
if (e.hyperLink) {
|
|
182
|
+
const n = A.createElement("a");
|
|
183
|
+
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = e.hyperLink, t.appendChild(n), t.link = n;
|
|
184
|
+
} else t.link && (t.link = void 0);
|
|
185
|
+
if (e.icons && e.icons.length) {
|
|
186
|
+
const n = A.createElement("span");
|
|
187
|
+
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${Rt(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
|
|
188
|
+
} else t.icons && (t.icons = void 0);
|
|
189
|
+
if (e.tags && e.tags.length) {
|
|
190
|
+
const n = A.createElement("div");
|
|
191
|
+
n.className = "tags", e.tags.forEach((o) => {
|
|
192
|
+
const s = A.createElement("span");
|
|
193
|
+
typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
|
|
194
|
+
}), t.appendChild(n), t.tags = n;
|
|
195
|
+
} else t.tags && (t.tags = void 0);
|
|
196
|
+
}, zt = function(t, e) {
|
|
197
|
+
const n = A.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
|
|
198
|
+
if (n.appendChild(o), !e && t.children && t.children.length > 0) {
|
|
199
|
+
const i = Ut(t.expanded);
|
|
200
|
+
if (o.appendChild(i), t.expanded !== !1) {
|
|
201
|
+
const r = Vt(this, t.children);
|
|
202
|
+
n.appendChild(r);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return { grp: n, top: o, tpc: s };
|
|
206
|
+
}, Ft = function(t) {
|
|
207
|
+
const e = A.createElement("me-parent"), n = this.createTopic(t);
|
|
208
|
+
return kt.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
|
|
209
|
+
}, qt = function(t) {
|
|
210
|
+
const e = A.createElement("me-children");
|
|
211
|
+
return e.append(...t), e;
|
|
212
|
+
}, jt = function(t) {
|
|
213
|
+
const e = A.createElement("me-tpc");
|
|
214
|
+
return e.nodeObj = t, e.dataset.nodeid = "me" + t.id, e;
|
|
215
|
+
};
|
|
216
|
+
function $t(t) {
|
|
217
|
+
const e = A.createRange();
|
|
218
|
+
e.selectNodeContents(t);
|
|
219
|
+
const n = window.getSelection();
|
|
220
|
+
n && (n.removeAllRanges(), n.addRange(e));
|
|
221
|
+
}
|
|
222
|
+
const _t = function(t) {
|
|
223
|
+
if (!t) return;
|
|
224
|
+
const e = A.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = I(this.nodes, t);
|
|
225
|
+
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
226
|
+
const r = getComputedStyle(t);
|
|
227
|
+
e.style.cssText = `
|
|
228
|
+
left: ${s}px;
|
|
229
|
+
top: ${i}px;
|
|
230
|
+
min-width:${t.offsetWidth - 8}px;
|
|
231
|
+
color:${r.color};
|
|
232
|
+
font-size:${r.fontSize};
|
|
233
|
+
padding:${r.padding};
|
|
234
|
+
margin:${r.margin};
|
|
235
|
+
background-color:${r.backgroundColor !== "rgba(0, 0, 0, 0)" && r.backgroundColor};
|
|
236
|
+
border: ${r.border};
|
|
237
|
+
border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"), $t(e), this.bus.fire("operation", {
|
|
238
|
+
name: "beginEdit",
|
|
239
|
+
obj: t.nodeObj
|
|
240
|
+
}), e.addEventListener("keydown", (l) => {
|
|
241
|
+
l.stopPropagation();
|
|
242
|
+
const a = l.key;
|
|
243
|
+
if (a === "Enter" || a === "Tab") {
|
|
244
|
+
if (l.shiftKey) return;
|
|
245
|
+
l.preventDefault(), e.blur(), this.container.focus();
|
|
246
|
+
}
|
|
247
|
+
}), e.addEventListener("blur", () => {
|
|
248
|
+
if (!e) return;
|
|
249
|
+
e.remove();
|
|
250
|
+
const l = e.textContent?.trim() || "";
|
|
251
|
+
l === o || l === "" || (n.topic = l, this.markdown ? t.text.innerHTML = this.markdown(n.topic, n) : t.text.textContent = l, this.linkDiv(), this.bus.fire("operation", {
|
|
252
|
+
name: "finishEdit",
|
|
253
|
+
obj: n,
|
|
254
|
+
origin: o
|
|
255
|
+
}));
|
|
256
|
+
});
|
|
257
|
+
}, Ut = function(t) {
|
|
258
|
+
const e = A.createElement("me-epd");
|
|
259
|
+
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
260
|
+
}, Kt = function(t) {
|
|
261
|
+
const n = t.parentElement.parentElement.lastElementChild;
|
|
262
|
+
n?.tagName === "svg" && n?.remove();
|
|
263
|
+
};
|
|
264
|
+
function Jt(t) {
|
|
265
|
+
return {
|
|
266
|
+
nodeData: t.isFocusMode ? t.nodeDataBackup : t.nodeData,
|
|
267
|
+
arrows: t.arrows,
|
|
268
|
+
summaries: t.summaries,
|
|
269
|
+
direction: t.direction,
|
|
270
|
+
theme: t.theme
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
const Qt = function(t) {
|
|
274
|
+
const e = this.container, n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
275
|
+
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
276
|
+
const i = n.left + n.width / 2, r = n.top + n.height / 2, l = o.left + o.width / 2, a = o.top + o.height / 2, c = i - l, h = r - a;
|
|
277
|
+
this.move(-c, -h, !0);
|
|
278
|
+
}
|
|
279
|
+
}, Zt = function(t, e, n) {
|
|
280
|
+
this.clearSelection(), this.scrollIntoView(t), this.selection?.select(t), e && this.bus.fire("selectNewNode", t.nodeObj);
|
|
281
|
+
}, te = function(t) {
|
|
282
|
+
this.selection?.select(t);
|
|
283
|
+
}, ee = function(t) {
|
|
284
|
+
this.selection?.deselect(t);
|
|
285
|
+
}, ne = function() {
|
|
286
|
+
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
287
|
+
}, Nt = function(t) {
|
|
288
|
+
return JSON.stringify(t, (e, n) => {
|
|
289
|
+
if (!(e === "parent" && typeof n != "string"))
|
|
290
|
+
return n;
|
|
291
|
+
});
|
|
292
|
+
}, oe = function() {
|
|
293
|
+
const t = Jt(this);
|
|
294
|
+
return Nt(t);
|
|
295
|
+
}, se = function() {
|
|
296
|
+
return JSON.parse(this.getDataString());
|
|
297
|
+
}, ie = function() {
|
|
298
|
+
this.editable = !0;
|
|
299
|
+
}, re = function() {
|
|
300
|
+
this.editable = !1;
|
|
301
|
+
}, le = function(t, e = { x: 0, y: 0 }) {
|
|
302
|
+
if (t < this.scaleMin && t < this.scaleVal || t > this.scaleMax && t > this.scaleVal) return;
|
|
303
|
+
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = mt(this), l = this.map.style.transform, { x: a, y: c } = gt(l), h = a - i, f = c - r, u = this.scaleVal, y = (-o + h) * (1 - t / u), m = (-s + f) * (1 - t / u);
|
|
304
|
+
this.map.style.transform = `translate3d(${a - y}px, ${c - m}px, 0) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
305
|
+
}, ce = function() {
|
|
306
|
+
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
307
|
+
this.scaleVal = n;
|
|
308
|
+
const { dx: o, dy: s } = mt(this, !0);
|
|
309
|
+
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
310
|
+
}, ae = function(t, e, n = !1) {
|
|
311
|
+
const { map: o, scaleVal: s, bus: i, container: r, nodes: l } = this;
|
|
312
|
+
if (n && o.style.transition === "transform 0.3s")
|
|
313
|
+
return;
|
|
314
|
+
const a = o.style.transform;
|
|
315
|
+
let { x: c, y: h } = gt(a);
|
|
316
|
+
const f = r.getBoundingClientRect(), u = l.getBoundingClientRect(), y = u.left < f.right && u.right > f.left, m = u.top < f.bottom && u.bottom > f.top;
|
|
317
|
+
if (y) {
|
|
318
|
+
const p = u.left + t, g = u.right + t;
|
|
319
|
+
(p >= f.right || g <= f.left) && (t = 0);
|
|
320
|
+
}
|
|
321
|
+
if (m) {
|
|
322
|
+
const p = u.top + e, g = u.bottom + e;
|
|
323
|
+
(p >= f.bottom || g <= f.top) && (e = 0);
|
|
324
|
+
}
|
|
325
|
+
c += t, h += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
326
|
+
o.style.transition = "none";
|
|
327
|
+
}, 300)), o.style.transform = `translate3d(${c}px, ${h}px, 0) scale(${s})`, i.fire("move", { dx: t, dy: e });
|
|
328
|
+
}, mt = (t, e = !1) => {
|
|
329
|
+
const { container: n, map: o, nodes: s } = t;
|
|
330
|
+
let i, r;
|
|
331
|
+
if (t.alignment === "nodes" || e)
|
|
332
|
+
i = (n.offsetWidth - s.offsetWidth) / 2, r = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
|
|
333
|
+
else {
|
|
334
|
+
const l = o.querySelector("me-root"), a = l.offsetTop, c = l.offsetLeft, h = l.offsetWidth, f = l.offsetHeight;
|
|
335
|
+
i = n.offsetWidth / 2 - c - h / 2, r = n.offsetHeight / 2 - a - f / 2, o.style.transformOrigin = `${c + h / 2}px 50%`;
|
|
336
|
+
}
|
|
337
|
+
return { dx: i, dy: r };
|
|
338
|
+
}, de = function() {
|
|
339
|
+
const { map: t, container: e } = this, { dx: n, dy: o } = mt(this);
|
|
340
|
+
e.scrollTop = 0, e.scrollLeft = 0, t.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
341
|
+
}, he = function(t) {
|
|
342
|
+
t(this);
|
|
343
|
+
}, fe = function(t) {
|
|
344
|
+
t.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = t.nodeObj, this.initRight(), this.toCenter());
|
|
345
|
+
}, ue = function() {
|
|
346
|
+
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
347
|
+
}, pe = function() {
|
|
348
|
+
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
349
|
+
}, ge = function() {
|
|
350
|
+
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
351
|
+
}, me = function() {
|
|
352
|
+
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
353
|
+
}, ye = function(t) {
|
|
354
|
+
this.locale = t, this.refresh();
|
|
355
|
+
}, ve = function(t, e) {
|
|
356
|
+
const n = t.nodeObj;
|
|
357
|
+
typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
358
|
+
const o = t.getBoundingClientRect(), s = {
|
|
359
|
+
x: o.left,
|
|
360
|
+
y: o.top
|
|
361
|
+
}, i = t.parentNode, r = i.children[1];
|
|
362
|
+
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", Kt(t), n.expanded) {
|
|
363
|
+
const f = this.createChildren(
|
|
364
|
+
n.children.map((u) => this.createWrapper(u).grp)
|
|
365
|
+
);
|
|
366
|
+
i.parentNode.appendChild(f);
|
|
367
|
+
} else
|
|
368
|
+
i.parentNode.children[1].remove();
|
|
369
|
+
this.linkDiv(t.closest("me-main > me-wrapper"));
|
|
370
|
+
const l = t.getBoundingClientRect(), a = {
|
|
371
|
+
x: l.left,
|
|
372
|
+
y: l.top
|
|
373
|
+
}, c = s.x - a.x, h = s.y - a.y;
|
|
374
|
+
this.move(c, h), this.bus.fire("expandNode", n);
|
|
375
|
+
}, we = function(t, e) {
|
|
376
|
+
const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
|
|
377
|
+
x: o.left,
|
|
378
|
+
y: o.top
|
|
379
|
+
};
|
|
380
|
+
Lt(n, e ?? !n.expanded), this.refresh();
|
|
381
|
+
const i = this.findEle(n.id).getBoundingClientRect(), r = {
|
|
382
|
+
x: i.left,
|
|
383
|
+
y: i.top
|
|
384
|
+
}, l = s.x - r.x, a = s.y - r.y;
|
|
385
|
+
this.move(l, a);
|
|
386
|
+
}, be = function(t) {
|
|
387
|
+
this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)), pt(this.nodeData), this.layout(), this.linkDiv();
|
|
388
|
+
}, xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
389
|
+
__proto__: null,
|
|
390
|
+
cancelFocus: ue,
|
|
391
|
+
clearSelection: ne,
|
|
392
|
+
disableEdit: re,
|
|
393
|
+
enableEdit: ie,
|
|
394
|
+
expandNode: ve,
|
|
395
|
+
expandNodeAll: we,
|
|
396
|
+
focusNode: fe,
|
|
397
|
+
getData: se,
|
|
398
|
+
getDataString: oe,
|
|
399
|
+
initLeft: pe,
|
|
400
|
+
initRight: ge,
|
|
401
|
+
initSide: me,
|
|
402
|
+
install: he,
|
|
403
|
+
move: ae,
|
|
404
|
+
refresh: be,
|
|
405
|
+
scale: le,
|
|
406
|
+
scaleFit: ce,
|
|
407
|
+
scrollIntoView: Qt,
|
|
408
|
+
selectNode: Zt,
|
|
409
|
+
selectNodes: te,
|
|
410
|
+
setLocale: ye,
|
|
411
|
+
stringifyData: Nt,
|
|
412
|
+
toCenter: de,
|
|
413
|
+
unselectNodes: ee
|
|
414
|
+
}, Symbol.toStringTag, { value: "Module" })), K = function(t, e, n) {
|
|
126
415
|
const { scaleVal: o, scaleSensitivity: s } = t;
|
|
127
416
|
switch (e) {
|
|
128
417
|
case "in":
|
|
@@ -131,7 +420,7 @@ const Rt = function() {
|
|
|
131
420
|
case "out":
|
|
132
421
|
t.scale(o - s, n);
|
|
133
422
|
}
|
|
134
|
-
}, dt = document,
|
|
423
|
+
}, dt = document, Ce = function(t, e) {
|
|
135
424
|
if (!e)
|
|
136
425
|
return st(t), t;
|
|
137
426
|
let n = t.querySelector(".insert-preview");
|
|
@@ -148,11 +437,11 @@ const Rt = function() {
|
|
|
148
437
|
if (!(t && t.tagName === "ME-TPC" && t !== n && !o && t.nodeObj.parent)) return !1;
|
|
149
438
|
}
|
|
150
439
|
return !0;
|
|
151
|
-
},
|
|
440
|
+
}, Ee = function(t) {
|
|
152
441
|
const e = document.createElement("div");
|
|
153
442
|
return e.className = "mind-elixir-ghost", t.container.appendChild(e), e;
|
|
154
443
|
};
|
|
155
|
-
class
|
|
444
|
+
class Se {
|
|
156
445
|
mind;
|
|
157
446
|
isMoving = !1;
|
|
158
447
|
interval = null;
|
|
@@ -169,31 +458,31 @@ class Gt {
|
|
|
169
458
|
this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
|
|
170
459
|
}
|
|
171
460
|
}
|
|
172
|
-
function
|
|
461
|
+
function Te(t) {
|
|
173
462
|
return {
|
|
174
463
|
isDragging: !1,
|
|
175
464
|
insertType: null,
|
|
176
465
|
meet: null,
|
|
177
|
-
ghost:
|
|
178
|
-
edgeMoveController: new
|
|
466
|
+
ghost: Ee(t),
|
|
467
|
+
edgeMoveController: new Se(t),
|
|
179
468
|
startX: 0,
|
|
180
469
|
startY: 0,
|
|
181
470
|
pointerId: null
|
|
182
471
|
};
|
|
183
472
|
}
|
|
184
|
-
const
|
|
473
|
+
const Le = 5;
|
|
185
474
|
function xt(t, e, n, o = !1) {
|
|
186
475
|
if (t.spacePressed) return !1;
|
|
187
476
|
const s = n.target;
|
|
188
477
|
if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
|
|
189
|
-
e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.selection
|
|
478
|
+
e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.selection?.cancel();
|
|
190
479
|
let i = t.currentNodes;
|
|
191
|
-
return i?.includes(s) || (t.selectNode(s), i = t.currentNodes), t.dragged = i, o &&
|
|
480
|
+
return i?.includes(s) || (t.selectNode(s), i = t.currentNodes), t.dragged = i, o && Pt(t, e), !0;
|
|
192
481
|
}
|
|
193
|
-
function
|
|
482
|
+
function At(t, e, n) {
|
|
194
483
|
t.style.transform = `translate(${e + 10}px, ${n + 10}px)`, t.style.display = "block";
|
|
195
484
|
}
|
|
196
|
-
function
|
|
485
|
+
function Pt(t, e) {
|
|
197
486
|
const { dragged: n } = t;
|
|
198
487
|
if (!n) return;
|
|
199
488
|
const o = document.activeElement;
|
|
@@ -202,18 +491,18 @@ function kt(t, e) {
|
|
|
202
491
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
203
492
|
t.dragMoveHelper.clear();
|
|
204
493
|
}
|
|
205
|
-
function
|
|
494
|
+
function De(t, e, n) {
|
|
206
495
|
const { dragged: o } = t;
|
|
207
496
|
if (!o || e.pointerId !== n.pointerId) return;
|
|
208
497
|
const s = n.clientX - e.startX, i = n.clientY - e.startY, r = Math.sqrt(s * s + i * i);
|
|
209
|
-
if (!e.isDragging && r >
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
n.clientX <
|
|
213
|
-
const a = 12 * t.scaleVal,
|
|
214
|
-
if (bt(
|
|
215
|
-
e.meet =
|
|
216
|
-
const h =
|
|
498
|
+
if (!e.isDragging && r > Le && Pt(t, e), !e.isDragging) return;
|
|
499
|
+
At(e.ghost, n.clientX, n.clientY);
|
|
500
|
+
const l = t.container.getBoundingClientRect();
|
|
501
|
+
n.clientX < l.x + 50 ? e.edgeMoveController.move(1, 0) : n.clientX > l.x + l.width - 50 ? e.edgeMoveController.move(-1, 0) : n.clientY < l.y + 50 ? e.edgeMoveController.move(0, 1) : n.clientY > l.y + l.height - 50 ? e.edgeMoveController.move(0, -1) : e.edgeMoveController.stop(), st(e.meet);
|
|
502
|
+
const a = 12 * t.scaleVal, c = dt.elementFromPoint(n.clientX, n.clientY - a);
|
|
503
|
+
if (bt(c, o)) {
|
|
504
|
+
e.meet = c;
|
|
505
|
+
const h = c.getBoundingClientRect(), f = h.y;
|
|
217
506
|
n.clientY > f + h.height ? e.insertType = "after" : e.insertType = "in";
|
|
218
507
|
} else {
|
|
219
508
|
const h = dt.elementFromPoint(n.clientX, n.clientY + a);
|
|
@@ -224,9 +513,9 @@ function Ft(t, e, n) {
|
|
|
224
513
|
} else
|
|
225
514
|
e.insertType = null, e.meet = null;
|
|
226
515
|
}
|
|
227
|
-
e.meet &&
|
|
516
|
+
e.meet && Ce(e.meet, e.insertType);
|
|
228
517
|
}
|
|
229
|
-
function
|
|
518
|
+
function Me(t, e, n) {
|
|
230
519
|
const { dragged: o } = t;
|
|
231
520
|
if (!(!o || e.pointerId !== n.pointerId)) {
|
|
232
521
|
e.edgeMoveController.stop();
|
|
@@ -235,7 +524,7 @@ function jt(t, e, n) {
|
|
|
235
524
|
e.ghost.style.display = "none", e.ghost.innerHTML = "", e.isDragging && e.meet && (st(e.meet), e.insertType === "before" ? t.moveNodeBefore(o, e.meet) : e.insertType === "after" ? t.moveNodeAfter(o, e.meet) : e.insertType === "in" && t.moveNodeIn(o, e.meet)), t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
|
|
236
525
|
}
|
|
237
526
|
}
|
|
238
|
-
function
|
|
527
|
+
function ct(t, e) {
|
|
239
528
|
const { dragged: n } = t;
|
|
240
529
|
if (n) {
|
|
241
530
|
e.edgeMoveController.stop();
|
|
@@ -244,37 +533,37 @@ function lt(t, e) {
|
|
|
244
533
|
e.meet && st(e.meet), e.ghost.style.display = "none", e.ghost.innerHTML = "", t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
|
|
245
534
|
}
|
|
246
535
|
}
|
|
247
|
-
function
|
|
536
|
+
function ke(t) {
|
|
248
537
|
const { dragMoveHelper: e } = t;
|
|
249
538
|
let n = 0;
|
|
250
539
|
t.spacePressed = !1;
|
|
251
540
|
let o = null;
|
|
252
|
-
const s = /* @__PURE__ */ new Map(), i = t.
|
|
253
|
-
let r = null,
|
|
541
|
+
const s = /* @__PURE__ */ new Map(), i = t.editable ? Te(t) : null;
|
|
542
|
+
let r = null, l = null, a = null, c = null;
|
|
254
543
|
const h = 500, f = 10, u = () => {
|
|
255
|
-
r !== null && (clearTimeout(r), r = null,
|
|
544
|
+
r !== null && (clearTimeout(r), r = null, l = null, a = null, c = null);
|
|
256
545
|
}, y = (d, v) => {
|
|
257
546
|
d.hasPointerCapture && d.hasPointerCapture(v) && d.releasePointerCapture(v);
|
|
258
547
|
}, m = (d, v) => {
|
|
259
548
|
const C = d.closest(".svg-label");
|
|
260
549
|
if (C) {
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
550
|
+
const N = C.dataset.svgId, U = C.dataset.type, q = document.getElementById(N);
|
|
551
|
+
if (q) {
|
|
263
552
|
if (U === "arrow")
|
|
264
|
-
return v ? t.editArrowLabel(
|
|
553
|
+
return v ? t.editArrowLabel(q) : t.selectArrow(q), !0;
|
|
265
554
|
if (U === "summary")
|
|
266
|
-
return v ? t.editSummary(
|
|
555
|
+
return v ? t.editSummary(q) : t.selectSummary(q), !0;
|
|
267
556
|
}
|
|
268
557
|
}
|
|
269
558
|
if (d.closest(".topiclinks")) {
|
|
270
|
-
const
|
|
271
|
-
if (
|
|
272
|
-
return v ? t.editArrowLabel(
|
|
559
|
+
const N = d.closest("g");
|
|
560
|
+
if (N)
|
|
561
|
+
return v ? t.editArrowLabel(N) : t.selectArrow(N), !0;
|
|
273
562
|
}
|
|
274
563
|
if (d.closest(".summary")) {
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
return v ? t.editSummary(
|
|
564
|
+
const N = d.closest("g");
|
|
565
|
+
if (N)
|
|
566
|
+
return v ? t.editSummary(N) : t.selectSummary(N), !0;
|
|
278
567
|
}
|
|
279
568
|
return !1;
|
|
280
569
|
}, p = (d) => {
|
|
@@ -304,28 +593,28 @@ function qt(t) {
|
|
|
304
593
|
}, g = (d) => {
|
|
305
594
|
if (!t.editable) return;
|
|
306
595
|
const v = d.target;
|
|
307
|
-
|
|
308
|
-
},
|
|
596
|
+
lt(v) && t.beginEdit(v), m(v, !0);
|
|
597
|
+
}, b = (d) => {
|
|
309
598
|
if (d.pointerType === "mouse" || s.size > 1) return;
|
|
310
599
|
const v = (/* @__PURE__ */ new Date()).getTime(), C = v - n;
|
|
311
600
|
C < 300 && C > 0 && g(d), n = v;
|
|
312
|
-
},
|
|
601
|
+
}, w = (d) => {
|
|
313
602
|
d.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
|
|
314
603
|
}, x = (d) => {
|
|
315
604
|
d.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
|
|
316
605
|
}, S = (d) => {
|
|
317
606
|
if (d.pointerType === "touch" && (s.set(d.pointerId, { x: d.clientX, y: d.clientY }), s.size === 2)) {
|
|
318
|
-
const [
|
|
319
|
-
o = wt(
|
|
607
|
+
const [N, U] = Array.from(s.values());
|
|
608
|
+
o = wt(N, U), u();
|
|
320
609
|
}
|
|
321
610
|
e.moved = !1;
|
|
322
611
|
const v = d.target, C = t.mouseSelectionButton === 0 ? 2 : 0;
|
|
323
612
|
if (i && (d.button === 0 || d.pointerType === "touch")) {
|
|
324
613
|
if (d.pointerType === "touch" && s.size > 1)
|
|
325
|
-
(i.isDragging || i.pointerId !== null) &&
|
|
614
|
+
(i.isDragging || i.pointerId !== null) && ct(t, i);
|
|
326
615
|
else if (d.pointerType === "touch" && s.size === 1)
|
|
327
|
-
(
|
|
328
|
-
xt(t, i, d, !0) && (a && a.setPointerCapture(d.pointerId),
|
|
616
|
+
(lt(v) || v.closest("me-tpc")) && (l = { x: d.clientX, y: d.clientY }, a = v, c = d.pointerId, r = window.setTimeout(() => {
|
|
617
|
+
xt(t, i, d, !0) && (a && a.setPointerCapture(d.pointerId), At(i.ghost, d.clientX, d.clientY)), r = null, l = null, a = null, c = null;
|
|
329
618
|
}, h));
|
|
330
619
|
else if (d.pointerType === "mouse" && xt(t, i, d, !1)) {
|
|
331
620
|
v.setPointerCapture(d.pointerId);
|
|
@@ -336,8 +625,8 @@ function qt(t) {
|
|
|
336
625
|
!H && !B || (e.x = d.clientX, e.y = d.clientY, v.className !== "circle" && v.contentEditable !== "plaintext-only" && (e.mousedown = !0, v.setPointerCapture(d.pointerId)));
|
|
337
626
|
}, T = (d) => {
|
|
338
627
|
if (d.pointerType === "touch" && s.has(d.pointerId)) {
|
|
339
|
-
if (s.set(d.pointerId, { x: d.clientX, y: d.clientY }), r !== null &&
|
|
340
|
-
const v = d.clientX -
|
|
628
|
+
if (s.set(d.pointerId, { x: d.clientX, y: d.clientY }), r !== null && l !== null && d.pointerId === c) {
|
|
629
|
+
const v = d.clientX - l.x, C = d.clientY - l.y;
|
|
341
630
|
Math.sqrt(v * v + C * C) > f && u();
|
|
342
631
|
}
|
|
343
632
|
if (s.size >= 2) {
|
|
@@ -357,7 +646,7 @@ function qt(t) {
|
|
|
357
646
|
return;
|
|
358
647
|
}
|
|
359
648
|
}
|
|
360
|
-
if (!(i && i.pointerId !== null && (
|
|
649
|
+
if (!(i && i.pointerId !== null && (De(t, i, d), i.isDragging))) {
|
|
361
650
|
if (d.target.contentEditable !== "plaintext-only" || t.spacePressed && e.mousedown) {
|
|
362
651
|
const v = d.clientX - e.x, C = d.clientY - e.y;
|
|
363
652
|
e.onMove(v, C);
|
|
@@ -367,18 +656,18 @@ function qt(t) {
|
|
|
367
656
|
}, M = (d) => {
|
|
368
657
|
if (d.pointerType === "touch" && (s.delete(d.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) {
|
|
369
658
|
const v = i.isDragging;
|
|
370
|
-
if (
|
|
659
|
+
if (Me(t, i, d), y(d.target, d.pointerId), v)
|
|
371
660
|
return;
|
|
372
661
|
}
|
|
373
662
|
e.mousedown && (y(d.target, d.pointerId), e.clear());
|
|
374
663
|
}, E = () => {
|
|
375
|
-
u(), e.mousedown && e.clear(), i && (i.isDragging || i.pointerId !== null) &&
|
|
664
|
+
u(), e.mousedown && e.clear(), i && (i.isDragging || i.pointerId !== null) && ct(t, i);
|
|
376
665
|
}, L = (d) => {
|
|
377
|
-
d.pointerType === "touch" && (s.delete(d.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === d.pointerId &&
|
|
378
|
-
},
|
|
666
|
+
d.pointerType === "touch" && (s.delete(d.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === d.pointerId && ct(t, i), M(d);
|
|
667
|
+
}, k = (d) => {
|
|
379
668
|
if (d.preventDefault(), d.button !== 2 || !t.editable) return;
|
|
380
669
|
const v = d.target;
|
|
381
|
-
|
|
670
|
+
lt(v) && !v.classList.contains("selected") && t.selectNode(v), setTimeout(() => {
|
|
382
671
|
t.dragMoveHelper.moved || t.bus.fire("showContextMenu", d);
|
|
383
672
|
}, 200);
|
|
384
673
|
}, R = (d) => {
|
|
@@ -389,17 +678,17 @@ function qt(t) {
|
|
|
389
678
|
{ dom: D, evt: "pointermove", func: T },
|
|
390
679
|
{ dom: D, evt: "pointerup", func: M },
|
|
391
680
|
{ dom: D, evt: "pointercancel", func: L },
|
|
392
|
-
{ dom: D, evt: "pointerdown", func:
|
|
681
|
+
{ dom: D, evt: "pointerdown", func: b },
|
|
393
682
|
{ dom: D, evt: "click", func: p },
|
|
394
683
|
{ dom: D, evt: "dblclick", func: g },
|
|
395
|
-
{ dom: D, evt: "contextmenu", func:
|
|
684
|
+
{ dom: D, evt: "contextmenu", func: k },
|
|
396
685
|
{ dom: D, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : R },
|
|
397
686
|
{ dom: D, evt: "blur", func: E },
|
|
398
|
-
{ dom: D, evt: "keydown", func:
|
|
687
|
+
{ dom: D, evt: "keydown", func: w },
|
|
399
688
|
{ dom: D, evt: "keyup", func: x }
|
|
400
689
|
]);
|
|
401
690
|
}
|
|
402
|
-
function
|
|
691
|
+
function $e() {
|
|
403
692
|
return {
|
|
404
693
|
handlers: {},
|
|
405
694
|
addListener: function(t, e) {
|
|
@@ -423,165 +712,30 @@ function _t() {
|
|
|
423
712
|
}
|
|
424
713
|
};
|
|
425
714
|
}
|
|
426
|
-
const
|
|
427
|
-
this.nodes.innerHTML = "";
|
|
428
|
-
const t = this.createTopic(this.nodeData);
|
|
429
|
-
Nt.call(this, t, this.nodeData), t.draggable = !1;
|
|
430
|
-
const e = nt.createElement("me-root");
|
|
431
|
-
e.appendChild(t);
|
|
432
|
-
const n = this.nodeData.children || [];
|
|
433
|
-
if (this.direction === 2) {
|
|
434
|
-
let o = 0, s = 0;
|
|
435
|
-
n.map((i) => {
|
|
436
|
-
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
Kt(this, n, e);
|
|
440
|
-
}, Kt = function(t, e, n) {
|
|
441
|
-
const o = nt.createElement("me-main");
|
|
442
|
-
o.className = F.LHS;
|
|
443
|
-
const s = nt.createElement("me-main");
|
|
444
|
-
s.className = F.RHS;
|
|
445
|
-
for (let i = 0; i < e.length; i++) {
|
|
446
|
-
const r = e[i], { grp: c } = t.createWrapper(r);
|
|
447
|
-
t.direction === 2 ? r.direction === 0 ? o.appendChild(c) : s.appendChild(c) : t.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
448
|
-
}
|
|
449
|
-
t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(s), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
|
|
450
|
-
}, Jt = function(t, e) {
|
|
451
|
-
const n = nt.createElement("me-children");
|
|
452
|
-
for (let o = 0; o < e.length; o++) {
|
|
453
|
-
const s = e[o], { grp: i } = t.createWrapper(s);
|
|
454
|
-
n.appendChild(i);
|
|
455
|
-
}
|
|
456
|
-
return n;
|
|
457
|
-
}, A = document, $t = function(t, e) {
|
|
458
|
-
const o = (this?.el ? this.el : e || document).querySelector(`[data-nodeid="me${t}"]`);
|
|
459
|
-
if (!o) throw new Error(`FindEle: Node ${t} not found, maybe it's collapsed.`);
|
|
460
|
-
return o;
|
|
461
|
-
}, Nt = function(t, e) {
|
|
462
|
-
if (t.innerHTML = "", e.style) {
|
|
463
|
-
const n = e.style;
|
|
464
|
-
for (const o in n)
|
|
465
|
-
t.style[o] = n[o];
|
|
466
|
-
}
|
|
467
|
-
if (e.dangerouslySetInnerHTML) {
|
|
468
|
-
t.innerHTML = e.dangerouslySetInnerHTML;
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
if (e.image) {
|
|
472
|
-
const n = e.image;
|
|
473
|
-
if (n.url && n.width && n.height) {
|
|
474
|
-
const o = A.createElement("img");
|
|
475
|
-
o.src = this.imageProxy ? this.imageProxy(n.url) : n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), t.appendChild(o), t.image = o;
|
|
476
|
-
}
|
|
477
|
-
} else t.image && (t.image = void 0);
|
|
478
|
-
{
|
|
479
|
-
const n = A.createElement("span");
|
|
480
|
-
n.className = "text", this.markdown ? n.innerHTML = this.markdown(e.topic, e) : n.textContent = e.topic, t.appendChild(n), t.text = n;
|
|
481
|
-
}
|
|
482
|
-
if (e.hyperLink) {
|
|
483
|
-
const n = A.createElement("a");
|
|
484
|
-
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = e.hyperLink, t.appendChild(n), t.link = n;
|
|
485
|
-
} else t.link && (t.link = void 0);
|
|
486
|
-
if (e.icons && e.icons.length) {
|
|
487
|
-
const n = A.createElement("span");
|
|
488
|
-
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${Bt(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
|
|
489
|
-
} else t.icons && (t.icons = void 0);
|
|
490
|
-
if (e.tags && e.tags.length) {
|
|
491
|
-
const n = A.createElement("div");
|
|
492
|
-
n.className = "tags", e.tags.forEach((o) => {
|
|
493
|
-
const s = A.createElement("span");
|
|
494
|
-
typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
|
|
495
|
-
}), t.appendChild(n), t.tags = n;
|
|
496
|
-
} else t.tags && (t.tags = void 0);
|
|
497
|
-
}, Qt = function(t, e) {
|
|
498
|
-
const n = A.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
|
|
499
|
-
if (n.appendChild(o), !e && t.children && t.children.length > 0) {
|
|
500
|
-
const i = oe(t.expanded);
|
|
501
|
-
if (o.appendChild(i), t.expanded !== !1) {
|
|
502
|
-
const r = Jt(this, t.children);
|
|
503
|
-
n.appendChild(r);
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return { grp: n, top: o, tpc: s };
|
|
507
|
-
}, Zt = function(t) {
|
|
508
|
-
const e = A.createElement("me-parent"), n = this.createTopic(t);
|
|
509
|
-
return Nt.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
|
|
510
|
-
}, te = function(t) {
|
|
511
|
-
const e = A.createElement("me-children");
|
|
512
|
-
return e.append(...t), e;
|
|
513
|
-
}, ee = function(t) {
|
|
514
|
-
const e = A.createElement("me-tpc");
|
|
515
|
-
return e.nodeObj = t, e.dataset.nodeid = "me" + t.id, e;
|
|
516
|
-
};
|
|
517
|
-
function At(t) {
|
|
518
|
-
const e = A.createRange();
|
|
519
|
-
e.selectNodeContents(t);
|
|
520
|
-
const n = window.getSelection();
|
|
521
|
-
n && (n.removeAllRanges(), n.addRange(e));
|
|
522
|
-
}
|
|
523
|
-
const ne = function(t) {
|
|
524
|
-
if (!t) return;
|
|
525
|
-
const e = A.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = I(this.nodes, t);
|
|
526
|
-
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
527
|
-
const r = getComputedStyle(t);
|
|
528
|
-
e.style.cssText = `
|
|
529
|
-
left: ${s}px;
|
|
530
|
-
top: ${i}px;
|
|
531
|
-
min-width:${t.offsetWidth - 8}px;
|
|
532
|
-
color:${r.color};
|
|
533
|
-
font-size:${r.fontSize};
|
|
534
|
-
padding:${r.padding};
|
|
535
|
-
margin:${r.margin};
|
|
536
|
-
background-color:${r.backgroundColor !== "rgba(0, 0, 0, 0)" && r.backgroundColor};
|
|
537
|
-
border: ${r.border};
|
|
538
|
-
border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"), At(e), this.bus.fire("operation", {
|
|
539
|
-
name: "beginEdit",
|
|
540
|
-
obj: t.nodeObj
|
|
541
|
-
}), e.addEventListener("keydown", (c) => {
|
|
542
|
-
c.stopPropagation();
|
|
543
|
-
const a = c.key;
|
|
544
|
-
if (a === "Enter" || a === "Tab") {
|
|
545
|
-
if (c.shiftKey) return;
|
|
546
|
-
c.preventDefault(), e.blur(), this.container.focus();
|
|
547
|
-
}
|
|
548
|
-
}), e.addEventListener("blur", () => {
|
|
549
|
-
if (!e) return;
|
|
550
|
-
e.remove();
|
|
551
|
-
const c = e.textContent?.trim() || "";
|
|
552
|
-
c === o || c === "" || (n.topic = c, this.markdown ? t.text.innerHTML = this.markdown(n.topic, n) : t.text.textContent = c, this.linkDiv(), this.bus.fire("operation", {
|
|
553
|
-
name: "finishEdit",
|
|
554
|
-
obj: n,
|
|
555
|
-
origin: o
|
|
556
|
-
}));
|
|
557
|
-
});
|
|
558
|
-
}, oe = function(t) {
|
|
559
|
-
const e = A.createElement("me-epd");
|
|
560
|
-
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
561
|
-
}, z = document, O = "http://www.w3.org/2000/svg", it = function(t) {
|
|
715
|
+
const z = document, O = "http://www.w3.org/2000/svg", it = function(t) {
|
|
562
716
|
const e = t.clientWidth, n = t.clientHeight, o = t.dataset, s = Number(o.x), i = Number(o.y), r = o.anchor;
|
|
563
|
-
let
|
|
564
|
-
r === "middle" ?
|
|
717
|
+
let l = s;
|
|
718
|
+
r === "middle" ? l = s - e / 2 : r === "end" && (l = s - e), t.style.left = `${l}px`, t.style.top = `${i - n / 2}px`, t.style.visibility = "visible";
|
|
565
719
|
}, ht = function(t, e, n, o) {
|
|
566
|
-
const { anchor: s = "middle", color: i, dataType: r, svgId:
|
|
720
|
+
const { anchor: s = "middle", color: i, dataType: r, svgId: l } = o, a = document.createElement("div");
|
|
567
721
|
a.className = "svg-label", a.style.color = i || "#666";
|
|
568
|
-
const
|
|
569
|
-
return a.id =
|
|
570
|
-
},
|
|
722
|
+
const c = "label-" + l;
|
|
723
|
+
return a.id = c, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = l, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor = s, a;
|
|
724
|
+
}, Ht = function(t, e, n) {
|
|
571
725
|
const o = z.createElementNS(O, "path");
|
|
572
|
-
return
|
|
726
|
+
return $(o, {
|
|
573
727
|
d: t,
|
|
574
728
|
stroke: e || "#666",
|
|
575
729
|
fill: "none",
|
|
576
730
|
"stroke-width": n
|
|
577
731
|
}), o;
|
|
578
|
-
},
|
|
732
|
+
}, j = function(t) {
|
|
579
733
|
const e = z.createElementNS(O, "svg");
|
|
580
734
|
return e.setAttribute("class", t), e.setAttribute("overflow", "visible"), e;
|
|
581
735
|
}, Ct = function() {
|
|
582
736
|
const t = z.createElementNS(O, "line");
|
|
583
737
|
return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
|
|
584
|
-
},
|
|
738
|
+
}, Ne = function(t, e, n, o) {
|
|
585
739
|
const s = z.createElementNS(O, "g");
|
|
586
740
|
return [
|
|
587
741
|
{
|
|
@@ -596,31 +750,31 @@ const ne = function(t) {
|
|
|
596
750
|
name: "arrow2",
|
|
597
751
|
d: n
|
|
598
752
|
}
|
|
599
|
-
].forEach((r,
|
|
600
|
-
const a = r.d,
|
|
753
|
+
].forEach((r, l) => {
|
|
754
|
+
const a = r.d, c = z.createElementNS(O, "path"), h = {
|
|
601
755
|
d: a,
|
|
602
756
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
603
757
|
fill: "none",
|
|
604
758
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
605
759
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
606
760
|
};
|
|
607
|
-
o?.opacity !== void 0 && (h.opacity = String(o.opacity)),
|
|
761
|
+
o?.opacity !== void 0 && (h.opacity = String(o.opacity)), $(c, h), l === 0 && c.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
608
762
|
const f = z.createElementNS(O, "path");
|
|
609
|
-
|
|
763
|
+
$(f, {
|
|
610
764
|
d: a,
|
|
611
765
|
stroke: "transparent",
|
|
612
766
|
fill: "none",
|
|
613
767
|
"stroke-width": "15"
|
|
614
|
-
}), s.appendChild(f), s.appendChild(
|
|
768
|
+
}), s.appendChild(f), s.appendChild(c), s[r.name] = c;
|
|
615
769
|
}), s;
|
|
616
|
-
},
|
|
770
|
+
}, It = function(t, e, n) {
|
|
617
771
|
if (!e) return;
|
|
618
772
|
const o = n.label, s = e.cloneNode(!0);
|
|
619
773
|
t.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
620
774
|
left:${e.style.left};
|
|
621
775
|
top:${e.style.top};
|
|
622
776
|
max-width: 200px;
|
|
623
|
-
`,
|
|
777
|
+
`, $t(s), t.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
624
778
|
i.stopPropagation();
|
|
625
779
|
const r = i.key;
|
|
626
780
|
if (r === "Enter" || r === "Tab") {
|
|
@@ -638,63 +792,63 @@ const ne = function(t) {
|
|
|
638
792
|
obj: n
|
|
639
793
|
}));
|
|
640
794
|
});
|
|
641
|
-
},
|
|
795
|
+
}, Ae = function(t) {
|
|
642
796
|
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, i = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
643
797
|
this.lines.innerHTML = "";
|
|
644
|
-
for (let
|
|
645
|
-
const a = r[
|
|
646
|
-
if (
|
|
798
|
+
for (let l = 0; l < r.length; l++) {
|
|
799
|
+
const a = r[l], c = a.querySelector("me-tpc"), { offsetLeft: h, offsetTop: f } = I(this.nodes, c), u = c.offsetWidth, y = c.offsetHeight, m = a.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: f, cL: h, cW: u, cH: y, direction: m, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, b = c.nodeObj.branchColor || g[l % g.length];
|
|
800
|
+
if (c.style.borderColor = b, this.lines.appendChild(Ht(p, b, "3")), t && t !== a)
|
|
647
801
|
continue;
|
|
648
|
-
const
|
|
649
|
-
x.tagName === "svg" && x.remove(), a.appendChild(
|
|
802
|
+
const w = j("subLines"), x = a.lastChild;
|
|
803
|
+
x.tagName === "svg" && x.remove(), a.appendChild(w), Ot(this, w, b, a, m, !0);
|
|
650
804
|
}
|
|
651
805
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
652
|
-
},
|
|
653
|
-
const r = o.firstChild,
|
|
654
|
-
if (
|
|
655
|
-
const a = r.offsetTop,
|
|
656
|
-
for (let u = 0; u <
|
|
657
|
-
const y =
|
|
658
|
-
e.appendChild(
|
|
806
|
+
}, Ot = function(t, e, n, o, s, i) {
|
|
807
|
+
const r = o.firstChild, l = o.children[1].children;
|
|
808
|
+
if (l.length === 0) return;
|
|
809
|
+
const a = r.offsetTop, c = r.offsetLeft, h = r.offsetWidth, f = r.offsetHeight;
|
|
810
|
+
for (let u = 0; u < l.length; u++) {
|
|
811
|
+
const y = l[u], m = y.firstChild, p = m.offsetTop, g = m.offsetLeft, b = m.offsetWidth, w = m.offsetHeight, x = m.firstChild.nodeObj.branchColor || n, S = t.generateSubBranch({ pT: a, pL: c, pW: h, pH: f, cT: p, cL: g, cW: b, cH: w, direction: s, isFirst: i });
|
|
812
|
+
e.appendChild(Ht(S, x, "2"));
|
|
659
813
|
const T = m.children[1];
|
|
660
814
|
if (T) {
|
|
661
815
|
if (!T.expanded) continue;
|
|
662
816
|
} else
|
|
663
817
|
continue;
|
|
664
|
-
|
|
818
|
+
Ot(t, e, x, y, s);
|
|
665
819
|
}
|
|
666
|
-
},
|
|
667
|
-
side:
|
|
668
|
-
left:
|
|
669
|
-
right:
|
|
670
|
-
full:
|
|
671
|
-
living:
|
|
672
|
-
zoomin:
|
|
673
|
-
zoomout:
|
|
820
|
+
}, Pe = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>', He = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>', Ie = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>', Oe = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>', Ye = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>', Be = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>', Re = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>', We = {
|
|
821
|
+
side: Pe,
|
|
822
|
+
left: He,
|
|
823
|
+
right: Ie,
|
|
824
|
+
full: Oe,
|
|
825
|
+
living: Ye,
|
|
826
|
+
zoomin: Be,
|
|
827
|
+
zoomout: Re
|
|
674
828
|
}, W = (t, e) => {
|
|
675
829
|
const n = document.createElement("span");
|
|
676
|
-
return n.id = t, n.innerHTML =
|
|
830
|
+
return n.id = t, n.innerHTML = We[e], n;
|
|
677
831
|
};
|
|
678
|
-
function
|
|
832
|
+
function Xe(t) {
|
|
679
833
|
const e = document.createElement("div"), n = W("fullscreen", "full"), o = W("toCenter", "living"), s = W("zoomout", "zoomout"), i = W("zoomin", "zoomin");
|
|
680
834
|
e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(i), e.className = "mind-elixir-toolbar rb";
|
|
681
835
|
let r = null;
|
|
682
|
-
const
|
|
683
|
-
const
|
|
836
|
+
const l = () => {
|
|
837
|
+
const c = t.container.getBoundingClientRect(), h = gt(t.map.style.transform), f = c.width / 2, u = c.height / 2, y = (f - h.x) / t.scaleVal, m = (u - h.y) / t.scaleVal;
|
|
684
838
|
r = {
|
|
685
|
-
containerRect:
|
|
839
|
+
containerRect: c,
|
|
686
840
|
currentTransform: h,
|
|
687
841
|
mapCenterX: y,
|
|
688
842
|
mapCenterY: m
|
|
689
843
|
};
|
|
690
844
|
}, a = () => {
|
|
691
845
|
if (r) {
|
|
692
|
-
const
|
|
846
|
+
const c = t.container.getBoundingClientRect(), h = c.width / 2, f = c.height / 2, u = h - r.mapCenterX * t.scaleVal, y = f - r.mapCenterY * t.scaleVal, m = u - r.currentTransform.x, p = y - r.currentTransform.y;
|
|
693
847
|
t.move(m, p);
|
|
694
848
|
}
|
|
695
849
|
};
|
|
696
850
|
return t.el.addEventListener("fullscreenchange", a), n.onclick = () => {
|
|
697
|
-
|
|
851
|
+
l(), document.fullscreenElement !== t.el ? t.el.requestFullscreen() : document.exitFullscreen();
|
|
698
852
|
}, o.onclick = () => {
|
|
699
853
|
t.toCenter();
|
|
700
854
|
}, s.onclick = () => {
|
|
@@ -703,7 +857,7 @@ function pe(t) {
|
|
|
703
857
|
t.scale(t.scaleVal + t.scaleSensitivity);
|
|
704
858
|
}, e;
|
|
705
859
|
}
|
|
706
|
-
function
|
|
860
|
+
function Ge(t) {
|
|
707
861
|
const e = document.createElement("div"), n = W("tbltl", "left"), o = W("tbltr", "right"), s = W("tblts", "side");
|
|
708
862
|
return e.appendChild(n), e.appendChild(o), e.appendChild(s), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
709
863
|
t.initLeft();
|
|
@@ -713,10 +867,10 @@ function ge(t) {
|
|
|
713
867
|
t.initSide();
|
|
714
868
|
}, e;
|
|
715
869
|
}
|
|
716
|
-
function
|
|
717
|
-
t.container.append(
|
|
870
|
+
function Ve(t) {
|
|
871
|
+
t.container.append(Xe(t)), t.container.append(Ge(t));
|
|
718
872
|
}
|
|
719
|
-
const
|
|
873
|
+
const ze = function(t, e = !0) {
|
|
720
874
|
this.theme = t;
|
|
721
875
|
const o = {
|
|
722
876
|
...(t.type === "dark" ? ut : ft).cssVar,
|
|
@@ -727,158 +881,7 @@ const ye = function(t, e = !0) {
|
|
|
727
881
|
this.container.style.setProperty(r, o[r]);
|
|
728
882
|
}
|
|
729
883
|
e && this.refresh();
|
|
730
|
-
},
|
|
731
|
-
const n = t.parentElement.parentElement.lastElementChild;
|
|
732
|
-
n?.tagName === "svg" && n?.remove();
|
|
733
|
-
};
|
|
734
|
-
function we(t) {
|
|
735
|
-
return {
|
|
736
|
-
nodeData: t.isFocusMode ? t.nodeDataBackup : t.nodeData,
|
|
737
|
-
arrows: t.arrows,
|
|
738
|
-
summaries: t.summaries,
|
|
739
|
-
direction: t.direction,
|
|
740
|
-
theme: t.theme
|
|
741
|
-
};
|
|
742
|
-
}
|
|
743
|
-
const be = function(t) {
|
|
744
|
-
const e = this.container, n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
745
|
-
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
746
|
-
const i = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2, a = o.top + o.height / 2, l = i - c, h = r - a;
|
|
747
|
-
this.move(-l, -h, !0);
|
|
748
|
-
}
|
|
749
|
-
}, xe = function(t, e, n) {
|
|
750
|
-
this.clearSelection(), this.scrollIntoView(t), this.selection.select(t), e && this.bus.fire("selectNewNode", t.nodeObj);
|
|
751
|
-
}, Ce = function(t) {
|
|
752
|
-
this.selection.select(t);
|
|
753
|
-
}, Ee = function(t) {
|
|
754
|
-
this.selection?.deselect(t);
|
|
755
|
-
}, Se = function() {
|
|
756
|
-
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
757
|
-
}, Te = function() {
|
|
758
|
-
const t = we(this);
|
|
759
|
-
return JSON.stringify(t, (e, n) => {
|
|
760
|
-
if (!(e === "parent" && typeof n != "string"))
|
|
761
|
-
return n;
|
|
762
|
-
});
|
|
763
|
-
}, Le = function() {
|
|
764
|
-
return JSON.parse(this.getDataString());
|
|
765
|
-
}, De = function() {
|
|
766
|
-
this.editable = !0;
|
|
767
|
-
}, Me = function() {
|
|
768
|
-
this.editable = !1;
|
|
769
|
-
}, ke = function(t, e = { x: 0, y: 0 }) {
|
|
770
|
-
if (t < this.scaleMin && t < this.scaleVal || t > this.scaleMax && t > this.scaleVal) return;
|
|
771
|
-
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = mt(this), c = this.map.style.transform, { x: a, y: l } = gt(c), h = a - i, f = l - r, u = this.scaleVal, y = (-o + h) * (1 - t / u), m = (-s + f) * (1 - t / u);
|
|
772
|
-
this.map.style.transform = `translate3d(${a - y}px, ${l - m}px, 0) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
773
|
-
}, $e = function() {
|
|
774
|
-
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
775
|
-
this.scaleVal = n;
|
|
776
|
-
const { dx: o, dy: s } = mt(this, !0);
|
|
777
|
-
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
778
|
-
}, Ne = function(t, e, n = !1) {
|
|
779
|
-
const { map: o, scaleVal: s, bus: i, container: r, nodes: c } = this;
|
|
780
|
-
if (n && o.style.transition === "transform 0.3s")
|
|
781
|
-
return;
|
|
782
|
-
const a = o.style.transform;
|
|
783
|
-
let { x: l, y: h } = gt(a);
|
|
784
|
-
const f = r.getBoundingClientRect(), u = c.getBoundingClientRect(), y = u.left < f.right && u.right > f.left, m = u.top < f.bottom && u.bottom > f.top;
|
|
785
|
-
if (y) {
|
|
786
|
-
const p = u.left + t, g = u.right + t;
|
|
787
|
-
(p >= f.right || g <= f.left) && (t = 0);
|
|
788
|
-
}
|
|
789
|
-
if (m) {
|
|
790
|
-
const p = u.top + e, g = u.bottom + e;
|
|
791
|
-
(p >= f.bottom || g <= f.top) && (e = 0);
|
|
792
|
-
}
|
|
793
|
-
l += t, h += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
794
|
-
o.style.transition = "none";
|
|
795
|
-
}, 300)), o.style.transform = `translate3d(${l}px, ${h}px, 0) scale(${s})`, i.fire("move", { dx: t, dy: e });
|
|
796
|
-
}, mt = (t, e = !1) => {
|
|
797
|
-
const { container: n, map: o, nodes: s } = t;
|
|
798
|
-
let i, r;
|
|
799
|
-
if (t.alignment === "nodes" || e)
|
|
800
|
-
i = (n.offsetWidth - s.offsetWidth) / 2, r = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
|
|
801
|
-
else {
|
|
802
|
-
const c = o.querySelector("me-root"), a = c.offsetTop, l = c.offsetLeft, h = c.offsetWidth, f = c.offsetHeight;
|
|
803
|
-
i = n.offsetWidth / 2 - l - h / 2, r = n.offsetHeight / 2 - a - f / 2, o.style.transformOrigin = `${l + h / 2}px 50%`;
|
|
804
|
-
}
|
|
805
|
-
return { dx: i, dy: r };
|
|
806
|
-
}, Ae = function() {
|
|
807
|
-
const { map: t, container: e } = this, { dx: n, dy: o } = mt(this);
|
|
808
|
-
e.scrollTop = 0, e.scrollLeft = 0, t.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
809
|
-
}, Pe = function(t) {
|
|
810
|
-
t(this);
|
|
811
|
-
}, He = function(t) {
|
|
812
|
-
t.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = t.nodeObj, this.initRight(), this.toCenter());
|
|
813
|
-
}, Ie = function() {
|
|
814
|
-
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
815
|
-
}, Oe = function() {
|
|
816
|
-
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
817
|
-
}, Ye = function() {
|
|
818
|
-
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
819
|
-
}, Be = function() {
|
|
820
|
-
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
821
|
-
}, Re = function(t) {
|
|
822
|
-
this.locale = t, this.refresh();
|
|
823
|
-
}, We = function(t, e) {
|
|
824
|
-
const n = t.nodeObj;
|
|
825
|
-
typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
826
|
-
const o = t.getBoundingClientRect(), s = {
|
|
827
|
-
x: o.left,
|
|
828
|
-
y: o.top
|
|
829
|
-
}, i = t.parentNode, r = i.children[1];
|
|
830
|
-
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", ve(t), n.expanded) {
|
|
831
|
-
const f = this.createChildren(
|
|
832
|
-
n.children.map((u) => this.createWrapper(u).grp)
|
|
833
|
-
);
|
|
834
|
-
i.parentNode.appendChild(f);
|
|
835
|
-
} else
|
|
836
|
-
i.parentNode.children[1].remove();
|
|
837
|
-
this.linkDiv(t.closest("me-main > me-wrapper"));
|
|
838
|
-
const c = t.getBoundingClientRect(), a = {
|
|
839
|
-
x: c.left,
|
|
840
|
-
y: c.top
|
|
841
|
-
}, l = s.x - a.x, h = s.y - a.y;
|
|
842
|
-
this.move(l, h), this.bus.fire("expandNode", n);
|
|
843
|
-
}, Xe = function(t, e) {
|
|
844
|
-
const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
|
|
845
|
-
x: o.left,
|
|
846
|
-
y: o.top
|
|
847
|
-
};
|
|
848
|
-
Lt(n, e ?? !n.expanded), this.refresh();
|
|
849
|
-
const i = this.findEle(n.id).getBoundingClientRect(), r = {
|
|
850
|
-
x: i.left,
|
|
851
|
-
y: i.top
|
|
852
|
-
}, c = s.x - r.x, a = s.y - r.y;
|
|
853
|
-
this.move(c, a);
|
|
854
|
-
}, Ge = function(t) {
|
|
855
|
-
this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)), pt(this.nodeData), this.layout(), this.linkDiv();
|
|
856
|
-
}, Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
857
|
-
__proto__: null,
|
|
858
|
-
cancelFocus: Ie,
|
|
859
|
-
clearSelection: Se,
|
|
860
|
-
disableEdit: Me,
|
|
861
|
-
enableEdit: De,
|
|
862
|
-
expandNode: We,
|
|
863
|
-
expandNodeAll: Xe,
|
|
864
|
-
focusNode: He,
|
|
865
|
-
getData: Le,
|
|
866
|
-
getDataString: Te,
|
|
867
|
-
initLeft: Oe,
|
|
868
|
-
initRight: Ye,
|
|
869
|
-
initSide: Be,
|
|
870
|
-
install: Pe,
|
|
871
|
-
move: Ne,
|
|
872
|
-
refresh: Ge,
|
|
873
|
-
scale: ke,
|
|
874
|
-
scaleFit: $e,
|
|
875
|
-
scrollIntoView: be,
|
|
876
|
-
selectNode: xe,
|
|
877
|
-
selectNodes: Ce,
|
|
878
|
-
setLocale: Re,
|
|
879
|
-
toCenter: Ae,
|
|
880
|
-
unselectNodes: Ee
|
|
881
|
-
}, Symbol.toStringTag, { value: "Module" })), ze = function(t) {
|
|
884
|
+
}, Fe = function(t) {
|
|
882
885
|
return {
|
|
883
886
|
dom: t,
|
|
884
887
|
moved: !1,
|
|
@@ -914,66 +917,66 @@ const be = function(t) {
|
|
|
914
917
|
}
|
|
915
918
|
};
|
|
916
919
|
}, Et = {
|
|
917
|
-
create:
|
|
918
|
-
},
|
|
919
|
-
function
|
|
920
|
+
create: Fe
|
|
921
|
+
}, qe = "#4dc4ff";
|
|
922
|
+
function Yt(t, e, n, o, s, i, r, l) {
|
|
920
923
|
return {
|
|
921
924
|
x: t / 8 + n * 3 / 8 + s * 3 / 8 + r / 8,
|
|
922
|
-
y: e / 8 + o * 3 / 8 + i * 3 / 8 +
|
|
925
|
+
y: e / 8 + o * 3 / 8 + i * 3 / 8 + l / 8
|
|
923
926
|
};
|
|
924
927
|
}
|
|
925
928
|
function je(t, e, n) {
|
|
926
929
|
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), it(t));
|
|
927
930
|
}
|
|
928
931
|
function J(t, e, n, o, s) {
|
|
929
|
-
|
|
932
|
+
$(t, {
|
|
930
933
|
x1: e + "",
|
|
931
934
|
y1: n + "",
|
|
932
935
|
x2: o + "",
|
|
933
936
|
y2: s + ""
|
|
934
937
|
});
|
|
935
938
|
}
|
|
936
|
-
function St(t, e, n, o, s, i, r,
|
|
937
|
-
const h = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${
|
|
938
|
-
if (t.line.setAttribute("d", h),
|
|
939
|
-
const p =
|
|
939
|
+
function St(t, e, n, o, s, i, r, l, a, c) {
|
|
940
|
+
const h = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${l} ${a}`;
|
|
941
|
+
if (t.line.setAttribute("d", h), c.style) {
|
|
942
|
+
const p = c.style;
|
|
940
943
|
p.stroke && t.line.setAttribute("stroke", p.stroke), p.strokeWidth && t.line.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeDasharray && t.line.setAttribute("stroke-dasharray", p.strokeDasharray), p.strokeLinecap && t.line.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && t.line.setAttribute("opacity", String(p.opacity));
|
|
941
944
|
}
|
|
942
945
|
const f = t.querySelectorAll('path[stroke="transparent"]');
|
|
943
946
|
f.length > 0 && f[0].setAttribute("d", h);
|
|
944
|
-
const u = et(i, r,
|
|
947
|
+
const u = et(i, r, l, a);
|
|
945
948
|
if (u) {
|
|
946
|
-
const p = `M ${u.x1} ${u.y1} L ${
|
|
947
|
-
if (t.arrow1.setAttribute("d", p), f.length > 1 && f[1].setAttribute("d", p),
|
|
948
|
-
const g =
|
|
949
|
+
const p = `M ${u.x1} ${u.y1} L ${l} ${a} L ${u.x2} ${u.y2}`;
|
|
950
|
+
if (t.arrow1.setAttribute("d", p), f.length > 1 && f[1].setAttribute("d", p), c.style) {
|
|
951
|
+
const g = c.style;
|
|
949
952
|
g.stroke && t.arrow1.setAttribute("stroke", g.stroke), g.strokeWidth && t.arrow1.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && t.arrow1.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && t.arrow1.setAttribute("opacity", String(g.opacity));
|
|
950
953
|
}
|
|
951
954
|
}
|
|
952
|
-
if (
|
|
955
|
+
if (c.bidirectional) {
|
|
953
956
|
const p = et(o, s, e, n);
|
|
954
957
|
if (p) {
|
|
955
958
|
const g = `M ${p.x1} ${p.y1} L ${e} ${n} L ${p.x2} ${p.y2}`;
|
|
956
|
-
if (t.arrow2.setAttribute("d", g), f.length > 2 && f[2].setAttribute("d", g),
|
|
957
|
-
const
|
|
958
|
-
|
|
959
|
+
if (t.arrow2.setAttribute("d", g), f.length > 2 && f[2].setAttribute("d", g), c.style) {
|
|
960
|
+
const b = c.style;
|
|
961
|
+
b.stroke && t.arrow2.setAttribute("stroke", b.stroke), b.strokeWidth && t.arrow2.setAttribute("stroke-width", String(b.strokeWidth)), b.strokeLinecap && t.arrow2.setAttribute("stroke-linecap", b.strokeLinecap), b.opacity !== void 0 && t.arrow2.setAttribute("opacity", String(b.opacity));
|
|
959
962
|
}
|
|
960
963
|
}
|
|
961
964
|
}
|
|
962
|
-
const { x: y, y: m } =
|
|
963
|
-
if (t.labelEl && je(t.labelEl, y, m),
|
|
965
|
+
const { x: y, y: m } = Yt(e, n, o, s, i, r, l, a);
|
|
966
|
+
if (t.labelEl && je(t.labelEl, y, m), c.style?.labelColor) {
|
|
964
967
|
const p = t.labelEl;
|
|
965
|
-
p && (p.style.color =
|
|
968
|
+
p && (p.style.color = c.style.labelColor);
|
|
966
969
|
}
|
|
967
|
-
|
|
970
|
+
nn(t);
|
|
968
971
|
}
|
|
969
972
|
function ot(t, e, n) {
|
|
970
|
-
const { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight,
|
|
973
|
+
const { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, l = o + i / 2, a = s + r / 2, c = l + n.x, h = a + n.y;
|
|
971
974
|
return {
|
|
972
975
|
w: i,
|
|
973
976
|
h: r,
|
|
974
|
-
cx:
|
|
977
|
+
cx: l,
|
|
975
978
|
cy: a,
|
|
976
|
-
ctrlX:
|
|
979
|
+
ctrlX: c,
|
|
977
980
|
ctrlY: h
|
|
978
981
|
};
|
|
979
982
|
}
|
|
@@ -985,61 +988,68 @@ function V(t) {
|
|
|
985
988
|
y: n
|
|
986
989
|
};
|
|
987
990
|
}
|
|
988
|
-
const
|
|
991
|
+
const _e = function(t, e, n) {
|
|
992
|
+
const o = I(t.nodes, e), s = I(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, l = s.offsetLeft + n.offsetWidth / 2, a = s.offsetTop + n.offsetHeight / 2, c = l - i, h = a - r, f = Math.sqrt(c * c + h * h), u = Math.max(50, Math.min(200, f * 0.3)), y = Math.abs(c), m = Math.abs(h);
|
|
993
|
+
let p, g;
|
|
994
|
+
if (f < 150) {
|
|
995
|
+
const w = e.closest("me-main").className === "lhs" ? -1 : 1;
|
|
996
|
+
p = { x: 200 * w, y: 0 }, g = { x: 200 * w, y: 0 };
|
|
997
|
+
} else if (y > m * 1.5) {
|
|
998
|
+
const w = c > 0 ? e.offsetWidth / 2 : -e.offsetWidth / 2, x = c > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
999
|
+
p = { x: w + (c > 0 ? u : -u), y: 0 }, g = { x: x + (c > 0 ? -u : u), y: 0 };
|
|
1000
|
+
} else if (m > y * 1.5) {
|
|
1001
|
+
const w = h > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, x = h > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
1002
|
+
p = { x: 0, y: w + (h > 0 ? u : -u) }, g = { x: 0, y: x + (h > 0 ? -u : u) };
|
|
1003
|
+
} else {
|
|
1004
|
+
const w = Math.atan2(h, c), x = e.offsetWidth / 2 * Math.cos(w), S = e.offsetHeight / 2 * Math.sin(w), T = -(n.offsetWidth / 2) * Math.cos(w), M = -(n.offsetHeight / 2) * Math.sin(w), E = u * 0.7 * (c > 0 ? 1 : -1), L = u * 0.7 * (h > 0 ? 1 : -1);
|
|
1005
|
+
p = { x: x + E, y: S + L }, g = { x: T - E, y: M - L };
|
|
1006
|
+
}
|
|
1007
|
+
return { delta1: p, delta2: g };
|
|
1008
|
+
}, yt = function(t, e, n, o, s) {
|
|
989
1009
|
if (!e || !n)
|
|
990
1010
|
return;
|
|
991
|
-
|
|
1011
|
+
if (!o.delta1 || !o.delta2) {
|
|
1012
|
+
const k = _e(t, e, n);
|
|
1013
|
+
o.delta1 = k.delta1, o.delta2 = k.delta2;
|
|
1014
|
+
}
|
|
1015
|
+
const i = ot(t, e, o.delta1), r = ot(t, n, o.delta2), { x: l, y: a } = V(i), { ctrlX: c, ctrlY: h } = i, { ctrlX: f, ctrlY: u } = r, { x: y, y: m } = V(r), p = et(f, u, y, m);
|
|
992
1016
|
if (!p) return;
|
|
993
1017
|
const g = `M ${p.x1} ${p.y1} L ${y} ${m} L ${p.x2} ${p.y2}`;
|
|
994
|
-
let
|
|
1018
|
+
let b = "";
|
|
995
1019
|
if (o.bidirectional) {
|
|
996
|
-
const
|
|
997
|
-
if (!
|
|
998
|
-
|
|
1020
|
+
const k = et(c, h, l, a);
|
|
1021
|
+
if (!k) return;
|
|
1022
|
+
b = `M ${k.x1} ${k.y1} L ${l} ${a} L ${k.x2} ${k.y2}`;
|
|
999
1023
|
}
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1024
|
+
const w = Ne(`M ${l} ${a} C ${c} ${h} ${f} ${u} ${y} ${m}`, g, b, o.style), { x, y: S } = Yt(l, a, c, h, f, u, y, m), T = o.style?.labelColor || "rgb(235, 95, 82)", M = "arrow-" + o.id;
|
|
1025
|
+
w.id = M;
|
|
1002
1026
|
const E = t.markdown ? t.markdown(o.label, o) : o.label, L = ht(E, x, S, {
|
|
1003
1027
|
anchor: "middle",
|
|
1004
1028
|
color: T,
|
|
1005
1029
|
dataType: "arrow",
|
|
1006
1030
|
svgId: M
|
|
1007
1031
|
});
|
|
1008
|
-
|
|
1009
|
-
},
|
|
1010
|
-
const o =
|
|
1011
|
-
let p, g;
|
|
1012
|
-
if (y > m * 1.5) {
|
|
1013
|
-
const b = l > 0 ? t.offsetWidth / 2 : -t.offsetWidth / 2, x = l > 0 ? -e.offsetWidth / 2 : e.offsetWidth / 2;
|
|
1014
|
-
p = { x: b + (l > 0 ? u : -u), y: 0 }, g = { x: x + (l > 0 ? -u : u), y: 0 };
|
|
1015
|
-
} else if (m > y * 1.5) {
|
|
1016
|
-
const b = h > 0 ? t.offsetHeight / 2 : -t.offsetHeight / 2, x = h > 0 ? -e.offsetHeight / 2 : e.offsetHeight / 2;
|
|
1017
|
-
p = { x: 0, y: b + (h > 0 ? u : -u) }, g = { x: 0, y: x + (h > 0 ? -u : u) };
|
|
1018
|
-
} else {
|
|
1019
|
-
const b = Math.atan2(h, l), x = t.offsetWidth / 2 * Math.cos(b), S = t.offsetHeight / 2 * Math.sin(b), T = -(e.offsetWidth / 2) * Math.cos(b), M = -(e.offsetHeight / 2) * Math.sin(b), E = u * 0.7 * (l > 0 ? 1 : -1), L = u * 0.7 * (h > 0 ? 1 : -1);
|
|
1020
|
-
p = { x: x + E, y: S + L }, g = { x: T - E, y: M - L };
|
|
1021
|
-
}
|
|
1022
|
-
const w = {
|
|
1032
|
+
w.labelEl = L, w.arrowObj = o, w.dataset.linkid = o.id, t.labelContainer.appendChild(L), t.linkSvgGroup.appendChild(w), it(L), s || (t.arrows.push(o), t.currentArrow = w, Bt(t, o, i, r));
|
|
1033
|
+
}, Ue = function(t, e, n = {}) {
|
|
1034
|
+
const o = {
|
|
1023
1035
|
id: _(),
|
|
1024
1036
|
label: "Custom Link",
|
|
1025
1037
|
from: t.nodeObj.id,
|
|
1026
1038
|
to: e.nodeObj.id,
|
|
1027
|
-
delta1: p,
|
|
1028
|
-
delta2: g,
|
|
1029
1039
|
...n
|
|
1030
1040
|
};
|
|
1031
|
-
yt(this, t, e,
|
|
1041
|
+
yt(this, t, e, o), this.bus.fire("operation", {
|
|
1032
1042
|
name: "createArrow",
|
|
1033
|
-
obj:
|
|
1043
|
+
obj: o
|
|
1034
1044
|
});
|
|
1035
|
-
},
|
|
1045
|
+
}, Ke = function(t) {
|
|
1036
1046
|
rt(this);
|
|
1037
1047
|
const e = { ...t, id: _() };
|
|
1038
1048
|
yt(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
|
|
1039
1049
|
name: "createArrow",
|
|
1040
1050
|
obj: e
|
|
1041
1051
|
});
|
|
1042
|
-
},
|
|
1052
|
+
}, Je = function(t) {
|
|
1043
1053
|
let e;
|
|
1044
1054
|
if (t ? e = t : e = this.currentArrow, !e) return;
|
|
1045
1055
|
rt(this);
|
|
@@ -1050,15 +1060,15 @@ const yt = function(t, e, n, o, s) {
|
|
|
1050
1060
|
id: n
|
|
1051
1061
|
}
|
|
1052
1062
|
});
|
|
1053
|
-
},
|
|
1063
|
+
}, Qe = function(t) {
|
|
1054
1064
|
this.currentArrow = t;
|
|
1055
1065
|
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = ot(this, n, e.delta1), i = ot(this, o, e.delta2);
|
|
1056
|
-
|
|
1057
|
-
},
|
|
1066
|
+
Bt(this, e, s, i);
|
|
1067
|
+
}, Ze = function() {
|
|
1058
1068
|
rt(this), this.currentArrow = null;
|
|
1059
1069
|
}, at = function(t, e) {
|
|
1060
1070
|
const n = document.createElementNS(O, "path");
|
|
1061
|
-
return
|
|
1071
|
+
return $(n, {
|
|
1062
1072
|
d: t,
|
|
1063
1073
|
stroke: e,
|
|
1064
1074
|
fill: "none",
|
|
@@ -1066,7 +1076,7 @@ const yt = function(t, e, n, o, s) {
|
|
|
1066
1076
|
"stroke-linecap": "round",
|
|
1067
1077
|
"stroke-linejoin": "round"
|
|
1068
1078
|
}), n;
|
|
1069
|
-
},
|
|
1079
|
+
}, tn = function(t, e) {
|
|
1070
1080
|
const n = document.createElementNS(O, "g");
|
|
1071
1081
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
1072
1082
|
const o = at(t.line.getAttribute("d"), e);
|
|
@@ -1077,32 +1087,32 @@ const yt = function(t, e, n, o, s) {
|
|
|
1077
1087
|
n.appendChild(i);
|
|
1078
1088
|
}
|
|
1079
1089
|
t.insertBefore(n, t.firstChild);
|
|
1080
|
-
},
|
|
1090
|
+
}, en = function(t) {
|
|
1081
1091
|
const e = t.querySelector(".arrow-highlight");
|
|
1082
1092
|
e && e.remove();
|
|
1083
|
-
},
|
|
1093
|
+
}, nn = function(t) {
|
|
1084
1094
|
const e = t.querySelector(".arrow-highlight");
|
|
1085
1095
|
if (!e) return;
|
|
1086
1096
|
const n = e.querySelectorAll("path");
|
|
1087
1097
|
n.length >= 1 && n[0].setAttribute("d", t.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", t.arrow1.getAttribute("d")), n.length >= 3 && t.arrow2.getAttribute("d") && n[2].setAttribute("d", t.arrow2.getAttribute("d"));
|
|
1088
1098
|
}, rt = function(t) {
|
|
1089
|
-
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow &&
|
|
1090
|
-
},
|
|
1091
|
-
const { linkController: s, P2: i, P3: r, line1:
|
|
1099
|
+
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && en(t.currentArrow);
|
|
1100
|
+
}, Bt = function(t, e, n, o) {
|
|
1101
|
+
const { linkController: s, P2: i, P3: r, line1: l, line2: a, nodes: c, map: h, currentArrow: f, bus: u } = t;
|
|
1092
1102
|
if (!f) return;
|
|
1093
|
-
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial",
|
|
1094
|
-
let { x: y, y: m } = V(n), { ctrlX: p, ctrlY: g } = n, { ctrlX:
|
|
1095
|
-
i.style.cssText = `top:${g}px;left:${p}px;`, r.style.cssText = `top:${
|
|
1103
|
+
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", c.appendChild(s), c.appendChild(i), c.appendChild(r), tn(f, qe);
|
|
1104
|
+
let { x: y, y: m } = V(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: b, ctrlY: w } = o, { x, y: S } = V(o);
|
|
1105
|
+
i.style.cssText = `top:${g}px;left:${p}px;`, r.style.cssText = `top:${w}px;left:${b}px;`, J(l, y, m, p, g), J(a, b, w, x, S), t.helper1 = Et.create(i), t.helper2 = Et.create(r), t.helper1.init(h, (T, M) => {
|
|
1096
1106
|
p = p + T / t.scaleVal, g = g + M / t.scaleVal;
|
|
1097
1107
|
const E = V({ ...n, ctrlX: p, ctrlY: g });
|
|
1098
|
-
y = E.x, m = E.y, i.style.top = g + "px", i.style.left = p + "px", St(f, y, m, p, g,
|
|
1108
|
+
y = E.x, m = E.y, i.style.top = g + "px", i.style.left = p + "px", St(f, y, m, p, g, b, w, x, S, e), J(l, y, m, p, g), e.delta1.x = p - n.cx, e.delta1.y = g - n.cy, u.fire("updateArrowDelta", e);
|
|
1099
1109
|
}), t.helper2.init(h, (T, M) => {
|
|
1100
|
-
|
|
1101
|
-
const E = V({ ...o, ctrlX:
|
|
1102
|
-
x = E.x, S = E.y, r.style.top =
|
|
1110
|
+
b = b + T / t.scaleVal, w = w + M / t.scaleVal;
|
|
1111
|
+
const E = V({ ...o, ctrlX: b, ctrlY: w });
|
|
1112
|
+
x = E.x, S = E.y, r.style.top = w + "px", r.style.left = b + "px", St(f, y, m, p, g, b, w, x, S, e), J(a, b, w, x, S), e.delta2.x = b - o.cx, e.delta2.y = w - o.cy, u.fire("updateArrowDelta", e);
|
|
1103
1113
|
});
|
|
1104
1114
|
};
|
|
1105
|
-
function
|
|
1115
|
+
function on() {
|
|
1106
1116
|
this.linkSvgGroup.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((e) => e.remove());
|
|
1107
1117
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
1108
1118
|
const n = this.arrows[e];
|
|
@@ -1113,181 +1123,181 @@ function en() {
|
|
|
1113
1123
|
}
|
|
1114
1124
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
1115
1125
|
}
|
|
1116
|
-
function
|
|
1117
|
-
rt(this), t && t.labelEl &&
|
|
1126
|
+
function sn(t) {
|
|
1127
|
+
rt(this), t && t.labelEl && It(this, t.labelEl, t.arrowObj);
|
|
1118
1128
|
}
|
|
1119
|
-
function
|
|
1129
|
+
function rn() {
|
|
1120
1130
|
this.arrows = this.arrows.filter((t) => tt(t.from, this.nodeData) && tt(t.to, this.nodeData));
|
|
1121
1131
|
}
|
|
1122
|
-
const
|
|
1132
|
+
const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1123
1133
|
__proto__: null,
|
|
1124
|
-
createArrow:
|
|
1125
|
-
createArrowFrom:
|
|
1126
|
-
editArrowLabel:
|
|
1127
|
-
removeArrow:
|
|
1128
|
-
renderArrow:
|
|
1129
|
-
selectArrow:
|
|
1130
|
-
tidyArrow:
|
|
1131
|
-
unselectArrow:
|
|
1132
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1134
|
+
createArrow: Ue,
|
|
1135
|
+
createArrowFrom: Ke,
|
|
1136
|
+
editArrowLabel: sn,
|
|
1137
|
+
removeArrow: Je,
|
|
1138
|
+
renderArrow: on,
|
|
1139
|
+
selectArrow: Qe,
|
|
1140
|
+
tidyArrow: rn,
|
|
1141
|
+
unselectArrow: Ze
|
|
1142
|
+
}, Symbol.toStringTag, { value: "Module" })), cn = function(t) {
|
|
1133
1143
|
if (t.length === 0) throw new Error("No selected node.");
|
|
1134
1144
|
if (t.length === 1) {
|
|
1135
|
-
const a = t[0].nodeObj,
|
|
1136
|
-
if (!
|
|
1137
|
-
const h =
|
|
1145
|
+
const a = t[0].nodeObj, c = t[0].nodeObj.parent;
|
|
1146
|
+
if (!c) throw new Error("Can not select root node.");
|
|
1147
|
+
const h = c.children.findIndex((f) => a === f);
|
|
1138
1148
|
return {
|
|
1139
|
-
parent:
|
|
1149
|
+
parent: c.id,
|
|
1140
1150
|
start: h,
|
|
1141
1151
|
end: h
|
|
1142
1152
|
};
|
|
1143
1153
|
}
|
|
1144
1154
|
let e = 0;
|
|
1145
1155
|
const n = t.map((a) => {
|
|
1146
|
-
let
|
|
1156
|
+
let c = a.nodeObj;
|
|
1147
1157
|
const h = [];
|
|
1148
|
-
for (;
|
|
1149
|
-
const f =
|
|
1150
|
-
|
|
1158
|
+
for (; c.parent; ) {
|
|
1159
|
+
const f = c.parent, y = f.children?.indexOf(c);
|
|
1160
|
+
c = f, h.unshift({ node: c, index: y });
|
|
1151
1161
|
}
|
|
1152
1162
|
return h.length > e && (e = h.length), h;
|
|
1153
1163
|
});
|
|
1154
1164
|
let o = 0;
|
|
1155
1165
|
t: for (; o < e; o++) {
|
|
1156
1166
|
const a = n[0][o]?.node;
|
|
1157
|
-
for (let
|
|
1158
|
-
if (n[
|
|
1167
|
+
for (let c = 1; c < n.length; c++)
|
|
1168
|
+
if (n[c][o]?.node !== a)
|
|
1159
1169
|
break t;
|
|
1160
1170
|
}
|
|
1161
1171
|
if (!o) throw new Error("Can not select root node.");
|
|
1162
|
-
const s = n.map((a) => a[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0,
|
|
1163
|
-
if (!
|
|
1172
|
+
const s = n.map((a) => a[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, l = n[0][o - 1].node;
|
|
1173
|
+
if (!l.parent) throw new Error("Please select nodes in the same main topic.");
|
|
1164
1174
|
return {
|
|
1165
|
-
parent:
|
|
1175
|
+
parent: l.id,
|
|
1166
1176
|
start: i,
|
|
1167
1177
|
end: r
|
|
1168
1178
|
};
|
|
1169
|
-
},
|
|
1179
|
+
}, an = function(t) {
|
|
1170
1180
|
const e = document.createElementNS(O, "g");
|
|
1171
1181
|
return e.setAttribute("id", t), e;
|
|
1172
1182
|
}, Tt = function(t, e) {
|
|
1173
1183
|
const n = document.createElementNS(O, "path");
|
|
1174
|
-
return
|
|
1184
|
+
return $(n, {
|
|
1175
1185
|
d: t,
|
|
1176
1186
|
stroke: e || "#666",
|
|
1177
1187
|
fill: "none",
|
|
1178
1188
|
"stroke-linecap": "round",
|
|
1179
1189
|
"stroke-width": "2"
|
|
1180
1190
|
}), n;
|
|
1181
|
-
},
|
|
1191
|
+
}, dn = (t) => t.parentElement.parentElement, hn = function(t, { parent: e, start: n }) {
|
|
1182
1192
|
const o = t.findEle(e), s = o.nodeObj;
|
|
1183
1193
|
let i;
|
|
1184
1194
|
return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
|
|
1185
1195
|
}, vt = function(t, e) {
|
|
1186
|
-
const { id: n, label: o, parent: s, start: i, end: r, style:
|
|
1187
|
-
let m = 1 / 0, p = 0, g = 0,
|
|
1196
|
+
const { id: n, label: o, parent: s, start: i, end: r, style: l } = e, { nodes: a, theme: c, summarySvg: h } = t, u = t.findEle(s).nodeObj, y = hn(t, e);
|
|
1197
|
+
let m = 1 / 0, p = 0, g = 0, b = 0;
|
|
1188
1198
|
for (let d = i; d <= r; d++) {
|
|
1189
1199
|
const v = u.children?.[d];
|
|
1190
1200
|
if (!v)
|
|
1191
1201
|
return t.removeSummary(n), null;
|
|
1192
|
-
const C =
|
|
1193
|
-
d === i && (g = B +
|
|
1202
|
+
const C = dn(t.findEle(v.id)), { offsetLeft: H, offsetTop: B } = I(a, C), N = i === r ? 10 : 20;
|
|
1203
|
+
d === i && (g = B + N), d === r && (b = B + C.offsetHeight - N), H < m && (m = H), C.offsetWidth + H > p && (p = C.offsetWidth + H);
|
|
1194
1204
|
}
|
|
1195
|
-
let
|
|
1196
|
-
const S = u.parent ? 10 : 0, T = g + S, M =
|
|
1197
|
-
y === F.LHS ? (
|
|
1198
|
-
const X =
|
|
1199
|
-
return X.appendChild(
|
|
1200
|
-
},
|
|
1205
|
+
let w, x;
|
|
1206
|
+
const S = u.parent ? 10 : 0, T = g + S, M = b + S, E = (T + M) / 2, L = l?.stroke || c.cssVar["--color"], k = l?.labelColor || c.cssVar["--color"], R = "s-" + n, D = t.markdown ? t.markdown(o, e) : o;
|
|
1207
|
+
y === F.LHS ? (w = Tt(`M ${m + 10} ${T} c -5 0 -10 5 -10 10 L ${m} ${M - 10} c 0 5 5 10 10 10 M ${m} ${E} h -10`, L), x = ht(D, m - 20, E, { anchor: "end", color: k, dataType: "summary", svgId: R })) : (w = Tt(`M ${p - 10} ${T} c 5 0 10 5 10 10 L ${p} ${M - 10} c 0 5 -5 10 -10 10 M ${p} ${E} h 10`, L), x = ht(D, p + 20, E, { anchor: "start", color: k, dataType: "summary", svgId: R }));
|
|
1208
|
+
const X = an(R);
|
|
1209
|
+
return X.appendChild(w), t.labelContainer.appendChild(x), it(x), X.summaryObj = e, X.labelEl = x, h.appendChild(X), X;
|
|
1210
|
+
}, fn = function(t = {}) {
|
|
1201
1211
|
if (!this.currentNodes) return;
|
|
1202
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } =
|
|
1203
|
-
n.push(
|
|
1212
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = cn(e), l = { id: _(), parent: s, start: i, end: r, label: "summary", style: t.style }, a = vt(this, l);
|
|
1213
|
+
n.push(l), this.editSummary(a), o.fire("operation", {
|
|
1204
1214
|
name: "createSummary",
|
|
1205
|
-
obj:
|
|
1215
|
+
obj: l
|
|
1206
1216
|
});
|
|
1207
|
-
},
|
|
1217
|
+
}, un = function(t) {
|
|
1208
1218
|
const e = _(), n = { ...t, id: e };
|
|
1209
1219
|
vt(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
1210
1220
|
name: "createSummary",
|
|
1211
1221
|
obj: n
|
|
1212
1222
|
});
|
|
1213
|
-
},
|
|
1223
|
+
}, pn = function(t) {
|
|
1214
1224
|
const e = this.summaries.findIndex((n) => n.id === t);
|
|
1215
1225
|
e > -1 && (this.summaries.splice(e, 1), this.nodes.querySelector("#s-" + t)?.remove(), this.nodes.querySelector("#label-s-" + t)?.remove()), this.bus.fire("operation", {
|
|
1216
1226
|
name: "removeSummary",
|
|
1217
1227
|
obj: { id: t }
|
|
1218
1228
|
});
|
|
1219
|
-
},
|
|
1229
|
+
}, gn = function(t) {
|
|
1220
1230
|
const e = t.labelEl;
|
|
1221
1231
|
e && e.classList.add("selected"), this.currentSummary = t;
|
|
1222
|
-
},
|
|
1232
|
+
}, mn = function() {
|
|
1223
1233
|
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
1224
|
-
},
|
|
1234
|
+
}, yn = function() {
|
|
1225
1235
|
this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
|
|
1226
1236
|
try {
|
|
1227
1237
|
vt(this, t);
|
|
1228
1238
|
} catch {
|
|
1229
1239
|
}
|
|
1230
1240
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1231
|
-
},
|
|
1232
|
-
t && t.labelEl &&
|
|
1233
|
-
},
|
|
1241
|
+
}, vn = function(t) {
|
|
1242
|
+
t && t.labelEl && It(this, t.labelEl, t.summaryObj);
|
|
1243
|
+
}, wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1234
1244
|
__proto__: null,
|
|
1235
|
-
createSummary:
|
|
1236
|
-
createSummaryFrom:
|
|
1237
|
-
editSummary:
|
|
1238
|
-
removeSummary:
|
|
1239
|
-
renderSummary:
|
|
1240
|
-
selectSummary:
|
|
1241
|
-
unselectSummary:
|
|
1245
|
+
createSummary: fn,
|
|
1246
|
+
createSummaryFrom: un,
|
|
1247
|
+
editSummary: vn,
|
|
1248
|
+
removeSummary: pn,
|
|
1249
|
+
renderSummary: yn,
|
|
1250
|
+
selectSummary: gn,
|
|
1251
|
+
unselectSummary: mn
|
|
1242
1252
|
}, Symbol.toStringTag, { value: "Module" })), P = "http://www.w3.org/2000/svg";
|
|
1243
|
-
function
|
|
1253
|
+
function bn(t, e) {
|
|
1244
1254
|
const n = document.createElementNS(P, "svg");
|
|
1245
|
-
return
|
|
1255
|
+
return $(n, {
|
|
1246
1256
|
version: "1.1",
|
|
1247
1257
|
xmlns: P,
|
|
1248
1258
|
height: t,
|
|
1249
1259
|
width: e
|
|
1250
1260
|
}), n;
|
|
1251
1261
|
}
|
|
1252
|
-
function
|
|
1262
|
+
function xn(t, e) {
|
|
1253
1263
|
return (parseInt(t) - parseInt(e)) / 2;
|
|
1254
1264
|
}
|
|
1255
|
-
function
|
|
1265
|
+
function Cn(t, e, n, o) {
|
|
1256
1266
|
const s = document.createElementNS(P, "g");
|
|
1257
1267
|
let i = "";
|
|
1258
1268
|
return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
|
|
1259
|
-
`).forEach((
|
|
1260
|
-
const
|
|
1261
|
-
|
|
1269
|
+
`).forEach((l, a) => {
|
|
1270
|
+
const c = document.createElementNS(P, "text");
|
|
1271
|
+
$(c, {
|
|
1262
1272
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1263
|
-
y: o + parseInt(e.paddingTop) +
|
|
1273
|
+
y: o + parseInt(e.paddingTop) + xn(e.lineHeight, e.fontSize) * (a + 1) + parseFloat(e.fontSize) * (a + 1) + "",
|
|
1264
1274
|
"text-anchor": "start",
|
|
1265
1275
|
"font-family": e.fontFamily,
|
|
1266
1276
|
"font-size": `${e.fontSize}`,
|
|
1267
1277
|
"font-weight": `${e.fontWeight}`,
|
|
1268
1278
|
fill: `${e.color}`
|
|
1269
|
-
}),
|
|
1279
|
+
}), c.innerHTML = l, s.appendChild(c);
|
|
1270
1280
|
}), s;
|
|
1271
1281
|
}
|
|
1272
|
-
function
|
|
1282
|
+
function En(t, e, n, o) {
|
|
1273
1283
|
let s = "";
|
|
1274
1284
|
t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
|
|
1275
1285
|
const i = document.createElementNS(P, "foreignObject");
|
|
1276
|
-
|
|
1286
|
+
$(i, {
|
|
1277
1287
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1278
1288
|
y: o + parseInt(e.paddingTop) + "",
|
|
1279
1289
|
width: e.width,
|
|
1280
1290
|
height: e.height
|
|
1281
1291
|
});
|
|
1282
1292
|
const r = document.createElement("div");
|
|
1283
|
-
return
|
|
1293
|
+
return $(r, {
|
|
1284
1294
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
1285
1295
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1286
1296
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1287
1297
|
}
|
|
1288
|
-
function
|
|
1298
|
+
function Sn(t, e) {
|
|
1289
1299
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = document.createElementNS(P, "rect");
|
|
1290
|
-
return
|
|
1300
|
+
return $(i, {
|
|
1291
1301
|
x: o + "",
|
|
1292
1302
|
y: s + "",
|
|
1293
1303
|
rx: n.borderRadius,
|
|
@@ -1301,7 +1311,7 @@ function Cn(t, e) {
|
|
|
1301
1311
|
}
|
|
1302
1312
|
function Q(t, e, n = !1) {
|
|
1303
1313
|
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = I(t.nodes, e), r = document.createElementNS(P, "rect");
|
|
1304
|
-
|
|
1314
|
+
$(r, {
|
|
1305
1315
|
x: s + "",
|
|
1306
1316
|
y: i + "",
|
|
1307
1317
|
rx: o.borderRadius,
|
|
@@ -1312,14 +1322,14 @@ function Q(t, e, n = !1) {
|
|
|
1312
1322
|
stroke: o.borderColor,
|
|
1313
1323
|
"stroke-width": o.borderWidth
|
|
1314
1324
|
});
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1325
|
+
const l = document.createElementNS(P, "g");
|
|
1326
|
+
l.appendChild(r);
|
|
1317
1327
|
let a;
|
|
1318
|
-
return n ? a =
|
|
1328
|
+
return n ? a = En(e, o, s, i) : a = Cn(e, o, s, i), l.appendChild(a), l;
|
|
1319
1329
|
}
|
|
1320
|
-
function
|
|
1330
|
+
function Tn(t, e) {
|
|
1321
1331
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = document.createElementNS(P, "a"), r = document.createElementNS(P, "text");
|
|
1322
|
-
return
|
|
1332
|
+
return $(r, {
|
|
1323
1333
|
x: o + "",
|
|
1324
1334
|
y: s + parseInt(n.fontSize) + "",
|
|
1325
1335
|
"text-anchor": "start",
|
|
@@ -1329,9 +1339,9 @@ function En(t, e) {
|
|
|
1329
1339
|
fill: `${n.color}`
|
|
1330
1340
|
}), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
|
|
1331
1341
|
}
|
|
1332
|
-
function
|
|
1342
|
+
function Ln(t, e) {
|
|
1333
1343
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = I(t.nodes, e), i = document.createElementNS(P, "image");
|
|
1334
|
-
return
|
|
1344
|
+
return $(i, {
|
|
1335
1345
|
x: o + "",
|
|
1336
1346
|
y: s + "",
|
|
1337
1347
|
width: n.width + "",
|
|
@@ -1339,40 +1349,40 @@ function Sn(t, e) {
|
|
|
1339
1349
|
href: e.src
|
|
1340
1350
|
}), i;
|
|
1341
1351
|
}
|
|
1342
|
-
const Z = 100,
|
|
1343
|
-
const n = t.nodes, o = n.offsetHeight + Z * 2, s = n.offsetWidth + Z * 2, i =
|
|
1344
|
-
|
|
1352
|
+
const Z = 100, Dn = '<?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">', Mn = (t, e = !1) => {
|
|
1353
|
+
const n = t.nodes, o = n.offsetHeight + Z * 2, s = n.offsetWidth + Z * 2, i = bn(o + "px", s + "px"), r = document.createElementNS(P, "svg"), l = document.createElementNS(P, "rect");
|
|
1354
|
+
$(l, {
|
|
1345
1355
|
x: "0",
|
|
1346
1356
|
y: "0",
|
|
1347
1357
|
width: `${s}`,
|
|
1348
1358
|
height: `${o}`,
|
|
1349
1359
|
fill: t.theme.cssVar["--bgcolor"]
|
|
1350
|
-
}), i.appendChild(
|
|
1360
|
+
}), i.appendChild(l), n.querySelectorAll(".subLines").forEach((f) => {
|
|
1351
1361
|
const u = f.cloneNode(!0), { offsetLeft: y, offsetTop: m } = I(n, f.parentElement);
|
|
1352
1362
|
u.setAttribute("x", `${y}`), u.setAttribute("y", `${m}`), r.appendChild(u);
|
|
1353
1363
|
});
|
|
1354
1364
|
const a = n.querySelector(".lines")?.cloneNode(!0);
|
|
1355
1365
|
a && r.appendChild(a);
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1366
|
+
const c = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
1367
|
+
c && r.appendChild(c);
|
|
1358
1368
|
const h = n.querySelector(".summary")?.cloneNode(!0);
|
|
1359
1369
|
return h && r.appendChild(h), n.querySelectorAll("me-tpc").forEach((f) => {
|
|
1360
|
-
f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(Q(t, f, !e)) : (r.appendChild(
|
|
1370
|
+
f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(Q(t, f, !e)) : (r.appendChild(Sn(t, f)), r.appendChild(Q(t, f.text, !e)));
|
|
1361
1371
|
}), n.querySelectorAll(".tags > span").forEach((f) => {
|
|
1362
1372
|
r.appendChild(Q(t, f));
|
|
1363
1373
|
}), n.querySelectorAll(".icons > span").forEach((f) => {
|
|
1364
1374
|
r.appendChild(Q(t, f));
|
|
1365
1375
|
}), n.querySelectorAll(".hyper-link").forEach((f) => {
|
|
1366
|
-
r.appendChild(
|
|
1376
|
+
r.appendChild(Tn(t, f));
|
|
1367
1377
|
}), n.querySelectorAll("img").forEach((f) => {
|
|
1368
|
-
r.appendChild(
|
|
1369
|
-
}),
|
|
1378
|
+
r.appendChild(Ln(t, f));
|
|
1379
|
+
}), $(r, {
|
|
1370
1380
|
x: Z + "",
|
|
1371
1381
|
y: Z + "",
|
|
1372
1382
|
overflow: "visible"
|
|
1373
1383
|
}), i.appendChild(r), i;
|
|
1374
|
-
},
|
|
1375
|
-
function
|
|
1384
|
+
}, kn = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), Dn + t.outerHTML);
|
|
1385
|
+
function $n(t) {
|
|
1376
1386
|
return new Promise((e, n) => {
|
|
1377
1387
|
const o = new FileReader();
|
|
1378
1388
|
o.onload = (s) => {
|
|
@@ -1382,66 +1392,66 @@ function Mn(t) {
|
|
|
1382
1392
|
}, o.readAsDataURL(t);
|
|
1383
1393
|
});
|
|
1384
1394
|
}
|
|
1385
|
-
const
|
|
1386
|
-
const n =
|
|
1395
|
+
const Nn = function(t = !1, e) {
|
|
1396
|
+
const n = Mn(this, t), o = kn(n, e);
|
|
1387
1397
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1388
|
-
},
|
|
1389
|
-
const n = this.exportSvg(t, e), o = await
|
|
1398
|
+
}, An = async function(t = !1, e) {
|
|
1399
|
+
const n = this.exportSvg(t, e), o = await $n(n);
|
|
1390
1400
|
return new Promise((s, i) => {
|
|
1391
1401
|
const r = new Image();
|
|
1392
1402
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1403
|
+
const l = document.createElement("canvas");
|
|
1404
|
+
l.width = r.width, l.height = r.height, l.getContext("2d").drawImage(r, 0, 0), l.toBlob(s, "image/png", 1);
|
|
1395
1405
|
}, r.src = o, r.onerror = i;
|
|
1396
1406
|
});
|
|
1397
|
-
},
|
|
1407
|
+
}, Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1398
1408
|
__proto__: null,
|
|
1399
|
-
exportPng:
|
|
1400
|
-
exportSvg:
|
|
1401
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1409
|
+
exportPng: An,
|
|
1410
|
+
exportSvg: Nn
|
|
1411
|
+
}, Symbol.toStringTag, { value: "Module" })), Hn = {}, In = {
|
|
1402
1412
|
getObjById: tt,
|
|
1403
|
-
generateNewObj:
|
|
1404
|
-
layout:
|
|
1405
|
-
linkDiv:
|
|
1406
|
-
editTopic:
|
|
1407
|
-
createWrapper:
|
|
1408
|
-
createParent:
|
|
1409
|
-
createChildren:
|
|
1410
|
-
createTopic:
|
|
1411
|
-
findEle:
|
|
1412
|
-
changeTheme:
|
|
1413
|
-
...
|
|
1414
|
-
...
|
|
1415
|
-
...
|
|
1416
|
-
...
|
|
1417
|
-
...
|
|
1413
|
+
generateNewObj: Wt,
|
|
1414
|
+
layout: Xt,
|
|
1415
|
+
linkDiv: Ae,
|
|
1416
|
+
editTopic: _t,
|
|
1417
|
+
createWrapper: zt,
|
|
1418
|
+
createParent: Ft,
|
|
1419
|
+
createChildren: qt,
|
|
1420
|
+
createTopic: jt,
|
|
1421
|
+
findEle: Mt,
|
|
1422
|
+
changeTheme: ze,
|
|
1423
|
+
...xe,
|
|
1424
|
+
...Hn,
|
|
1425
|
+
...ln,
|
|
1426
|
+
...wn,
|
|
1427
|
+
...Pn,
|
|
1418
1428
|
init(t) {
|
|
1419
1429
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
|
|
1420
|
-
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, pt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar &&
|
|
1430
|
+
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, pt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Ve(this), this.layout(), this.linkDiv(), this.toCenter();
|
|
1421
1431
|
},
|
|
1422
1432
|
destroy() {
|
|
1423
|
-
this.disposable.forEach((t) => t()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.
|
|
1433
|
+
this.disposable.forEach((t) => t()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
|
|
1424
1434
|
}
|
|
1425
1435
|
};
|
|
1426
|
-
function
|
|
1436
|
+
function On({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction: a, containerHeight: c }) {
|
|
1427
1437
|
let h = e + n / 2;
|
|
1428
1438
|
const f = t + o / 2;
|
|
1429
1439
|
let u;
|
|
1430
1440
|
a === F.LHS ? u = i + r : u = i;
|
|
1431
|
-
const y = s +
|
|
1441
|
+
const y = s + l / 2, p = (1 - Math.abs(y - f) / c) * 0.25 * (n / 2);
|
|
1432
1442
|
return a === F.LHS ? h = h - n / 10 - p : h = h + n / 10 + p, `M ${h} ${f} Q ${h} ${y} ${u} ${y}`;
|
|
1433
1443
|
}
|
|
1434
|
-
function
|
|
1444
|
+
function Yn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction: a, isFirst: c }) {
|
|
1435
1445
|
const h = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
1436
1446
|
let f = 0, u = 0;
|
|
1437
|
-
|
|
1438
|
-
const y = s +
|
|
1447
|
+
c ? f = t + o / 2 : f = t + o;
|
|
1448
|
+
const y = s + l;
|
|
1439
1449
|
let m = 0, p = 0, g = 0;
|
|
1440
|
-
const
|
|
1441
|
-
return a === F.LHS ? (g = e, m = g + h, p = g - h, u = i + h, `M ${m} ${f} C ${g} ${f} ${g +
|
|
1450
|
+
const b = Math.abs(f - y) / 300 * h;
|
|
1451
|
+
return a === F.LHS ? (g = e, m = g + h, p = g - h, u = i + h, `M ${m} ${f} C ${g} ${f} ${g + b} ${y} ${p} ${y} H ${u}`) : (g = e + n, m = g - h, p = g + h, u = i + r - h, `M ${m} ${f} C ${g} ${f} ${g - b} ${y} ${p} ${y} H ${u}`);
|
|
1442
1452
|
}
|
|
1443
|
-
const
|
|
1444
|
-
function
|
|
1453
|
+
const Bn = "5.7.0";
|
|
1454
|
+
function Rn(t) {
|
|
1445
1455
|
return {
|
|
1446
1456
|
x: 0,
|
|
1447
1457
|
y: 0,
|
|
@@ -1461,38 +1471,38 @@ function Y({
|
|
|
1461
1471
|
el: t,
|
|
1462
1472
|
direction: e,
|
|
1463
1473
|
locale: n,
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
alignment: w,
|
|
1474
|
+
editable: o,
|
|
1475
|
+
contextMenu: s,
|
|
1476
|
+
toolBar: i,
|
|
1477
|
+
keypress: r,
|
|
1478
|
+
mouseSelectionButton: l,
|
|
1479
|
+
selectionContainer: a,
|
|
1480
|
+
before: c,
|
|
1481
|
+
newTopicName: h,
|
|
1482
|
+
allowUndo: f,
|
|
1483
|
+
generateMainBranch: u,
|
|
1484
|
+
generateSubBranch: y,
|
|
1485
|
+
overflowHidden: m,
|
|
1486
|
+
theme: p,
|
|
1487
|
+
alignment: g,
|
|
1479
1488
|
scaleSensitivity: b,
|
|
1480
|
-
scaleMax:
|
|
1481
|
-
scaleMin:
|
|
1482
|
-
handleWheel:
|
|
1483
|
-
markdown:
|
|
1484
|
-
imageProxy:
|
|
1489
|
+
scaleMax: w,
|
|
1490
|
+
scaleMin: x,
|
|
1491
|
+
handleWheel: S,
|
|
1492
|
+
markdown: T,
|
|
1493
|
+
imageProxy: M,
|
|
1494
|
+
pasteHandler: E
|
|
1485
1495
|
}) {
|
|
1486
1496
|
let L = null;
|
|
1487
|
-
const
|
|
1488
|
-
if (
|
|
1489
|
-
L.style.position = "relative", L.innerHTML = "", this.el = L, this.disposable = [], this.before =
|
|
1497
|
+
const k = Object.prototype.toString.call(t);
|
|
1498
|
+
if (k === "[object HTMLDivElement]" ? L = t : k === "[object String]" && (L = document.querySelector(t)), !L) throw new Error("MindElixir: el is not a valid element");
|
|
1499
|
+
L.style.position = "relative", L.innerHTML = "", this.el = L, this.disposable = [], this.before = c || {}, this.locale = n || "en", this.newTopicName = h || "New Node", this.contextMenu = s ?? !0, this.toolBar = i ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = e ?? 1, this.editable = o ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = w ?? 1.4, this.scaleMin = x ?? 0.2, this.generateMainBranch = u || On, this.generateSubBranch = y || Yn, this.overflowHidden = m ?? !1, this.alignment = g ?? "root", this.handleWheel = S ?? !0, this.markdown = T || void 0, this.imageProxy = M || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Rn(this), this.bus = $e(), this.container = G.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
|
|
1490
1500
|
const R = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1491
|
-
this.theme =
|
|
1501
|
+
this.theme = p || (R.matches ? ut : ft);
|
|
1492
1502
|
const D = G.createElement("div");
|
|
1493
|
-
D.className = "map-canvas", this.map = D, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = G.createElement("me-nodes"), this.lines =
|
|
1503
|
+
D.className = "map-canvas", this.map = D, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = G.createElement("me-nodes"), this.lines = j("lines"), this.summarySvg = j("summary"), this.linkController = j("linkcontroller"), this.P2 = G.createElement("div"), this.P3 = G.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Ct(), this.line2 = Ct(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = j("topiclinks"), this.labelContainer = G.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(ke(this)), E && (this.pasteHandler = E);
|
|
1494
1504
|
}
|
|
1495
|
-
Y.prototype =
|
|
1505
|
+
Y.prototype = In;
|
|
1496
1506
|
Object.defineProperty(Y.prototype, "currentNode", {
|
|
1497
1507
|
get() {
|
|
1498
1508
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
@@ -1504,8 +1514,13 @@ Y.RIGHT = 1;
|
|
|
1504
1514
|
Y.SIDE = 2;
|
|
1505
1515
|
Y.THEME = ft;
|
|
1506
1516
|
Y.DARK_THEME = ut;
|
|
1507
|
-
Y.version =
|
|
1508
|
-
Y.E =
|
|
1517
|
+
Y.version = Bn;
|
|
1518
|
+
Y.E = Mt;
|
|
1509
1519
|
export {
|
|
1520
|
+
ut as DARK_THEME,
|
|
1521
|
+
Wn as LEFT,
|
|
1522
|
+
Xn as RIGHT,
|
|
1523
|
+
Gn as SIDE,
|
|
1524
|
+
ft as THEME,
|
|
1510
1525
|
Y as default
|
|
1511
1526
|
};
|