mind-elixir 5.13.0 → 5.14.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +643 -625
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +545 -518
- package/dist/types/arrow.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/methods.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/pubsub.d.ts +4 -0
- package/package.json +17 -17
- package/readme/es.md +453 -0
- package/readme/fr.md +437 -0
- package/readme/ja.md +452 -0
- package/readme/ko.md +435 -0
- package/readme/pt.md +436 -0
- package/readme/ru.md +435 -0
- package/readme/zh.md +453 -0
package/dist/MindElixirLite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Rn = 0, Xn = 1, Vn = 2, et = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -27,7 +27,7 @@ const Wn = 0, Yn = 1, Rn = 2, tt = {
|
|
|
27
27
|
"--panel-border-color": "#eaeaea",
|
|
28
28
|
"--map-padding": "50px 80px"
|
|
29
29
|
}
|
|
30
|
-
},
|
|
30
|
+
}, nt = {
|
|
31
31
|
name: "Dark",
|
|
32
32
|
type: "dark",
|
|
33
33
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -56,48 +56,57 @@ const Wn = 0, Yn = 1, Rn = 2, tt = {
|
|
|
56
56
|
"--map-padding": "50px 80px"
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
function
|
|
59
|
+
function Ot(t) {
|
|
60
60
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const j = function(t, e) {
|
|
63
63
|
if (e.id === t)
|
|
64
64
|
return e;
|
|
65
65
|
if (e.children && e.children.length) {
|
|
66
66
|
for (let n = 0; n < e.children.length; n++) {
|
|
67
|
-
const o =
|
|
67
|
+
const o = j(t, e.children[n]);
|
|
68
68
|
if (o) return o;
|
|
69
69
|
}
|
|
70
70
|
return null;
|
|
71
71
|
} else
|
|
72
72
|
return null;
|
|
73
|
-
},
|
|
73
|
+
}, ot = (t, e) => {
|
|
74
74
|
if (t.parent = e, t.children)
|
|
75
75
|
for (let n = 0; n < t.children.length; n++)
|
|
76
|
-
|
|
77
|
-
},
|
|
76
|
+
ot(t.children[n], t);
|
|
77
|
+
}, bt = (t, e, n) => {
|
|
78
78
|
t.expanded = e, t.children && t.children.forEach((o) => {
|
|
79
|
-
|
|
79
|
+
bt(o, e);
|
|
80
80
|
});
|
|
81
81
|
};
|
|
82
82
|
function _(t, e, n, o) {
|
|
83
|
-
const s = n - t, i = o - e, c = Math.atan2(i, s) * 180 / Math.PI,
|
|
83
|
+
const s = n - t, i = o - e, c = Math.atan2(i, s) * 180 / Math.PI, a = 12, d = 30, f = (c + 180 - d) * Math.PI / 180, l = (c + 180 + d) * Math.PI / 180;
|
|
84
84
|
return {
|
|
85
|
-
x1: n + Math.cos(f) *
|
|
86
|
-
y1: o + Math.sin(f) *
|
|
87
|
-
x2: n + Math.cos(
|
|
88
|
-
y2: o + Math.sin(
|
|
85
|
+
x1: n + Math.cos(f) * a,
|
|
86
|
+
y1: o + Math.sin(f) * a,
|
|
87
|
+
x2: n + Math.cos(l) * a,
|
|
88
|
+
y2: o + Math.sin(l) * a
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function X() {
|
|
92
92
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
const t =
|
|
94
|
+
const Bt = function() {
|
|
95
|
+
const t = X();
|
|
96
96
|
return {
|
|
97
97
|
topic: this.newTopicName,
|
|
98
98
|
id: t
|
|
99
99
|
};
|
|
100
|
-
}
|
|
100
|
+
};
|
|
101
|
+
function Yt(t) {
|
|
102
|
+
return JSON.parse(
|
|
103
|
+
JSON.stringify(t, (n, o) => {
|
|
104
|
+
if (n !== "parent")
|
|
105
|
+
return o;
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
const P = (t, e) => {
|
|
101
110
|
let n = 0, o = 0;
|
|
102
111
|
for (; e && e !== t; )
|
|
103
112
|
n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
|
|
@@ -105,10 +114,10 @@ const Ot = function() {
|
|
|
105
114
|
}, D = (t, e) => {
|
|
106
115
|
for (const n in e)
|
|
107
116
|
t.setAttribute(n, e[n]);
|
|
108
|
-
}, J = (t) => t ? t.tagName === "ME-TPC" : !1,
|
|
117
|
+
}, J = (t) => t ? t.tagName === "ME-TPC" : !1, st = (t) => {
|
|
109
118
|
const e = /translate3d\(([^,]+),\s*([^,]+)/, n = t.match(e);
|
|
110
119
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
111
|
-
},
|
|
120
|
+
}, vt = function(t) {
|
|
112
121
|
for (let e = 0; e < t.length; e++) {
|
|
113
122
|
const { dom: n, evt: o, func: s } = t[e];
|
|
114
123
|
n.addEventListener(o, s);
|
|
@@ -119,31 +128,31 @@ const Ot = function() {
|
|
|
119
128
|
o.removeEventListener(s, i);
|
|
120
129
|
}
|
|
121
130
|
};
|
|
122
|
-
},
|
|
131
|
+
}, dt = (t, e) => {
|
|
123
132
|
const n = t.x - e.x, o = t.y - e.y;
|
|
124
133
|
return Math.sqrt(n * n + o * o);
|
|
125
|
-
},
|
|
134
|
+
}, Wt = function(t, e) {
|
|
126
135
|
if (!e)
|
|
127
|
-
return
|
|
136
|
+
return q(t), t;
|
|
128
137
|
let n = t.querySelector(".insert-preview");
|
|
129
138
|
const o = `insert-preview ${e} show`;
|
|
130
139
|
return n || (n = document.createElement("div"), t.appendChild(n)), n.className = o, t;
|
|
131
|
-
},
|
|
140
|
+
}, q = function(t) {
|
|
132
141
|
if (!t) return;
|
|
133
142
|
const e = t.querySelectorAll(".insert-preview");
|
|
134
143
|
for (const n of e || [])
|
|
135
144
|
n.remove();
|
|
136
|
-
},
|
|
145
|
+
}, ft = function(t, e) {
|
|
137
146
|
for (const n of e) {
|
|
138
147
|
const o = n.parentElement.parentElement.contains(t);
|
|
139
148
|
if (!(t && t.tagName === "ME-TPC" && t !== n && !o && t.nodeObj.parent)) return !1;
|
|
140
149
|
}
|
|
141
150
|
return !0;
|
|
142
|
-
},
|
|
151
|
+
}, Rt = function(t) {
|
|
143
152
|
const e = document.createElement("div");
|
|
144
153
|
return e.className = "mind-elixir-ghost", t.container.appendChild(e), e;
|
|
145
154
|
};
|
|
146
|
-
class
|
|
155
|
+
class Xt {
|
|
147
156
|
mind;
|
|
148
157
|
isMoving = !1;
|
|
149
158
|
interval = null;
|
|
@@ -160,34 +169,34 @@ class Yt {
|
|
|
160
169
|
this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
|
|
161
170
|
}
|
|
162
171
|
}
|
|
163
|
-
function
|
|
172
|
+
function Vt(t) {
|
|
164
173
|
return {
|
|
165
174
|
isDragging: !1,
|
|
166
175
|
insertType: null,
|
|
167
176
|
meet: null,
|
|
168
|
-
ghost:
|
|
169
|
-
edgeMoveController: new
|
|
177
|
+
ghost: Rt(t),
|
|
178
|
+
edgeMoveController: new Xt(t),
|
|
170
179
|
startX: 0,
|
|
171
180
|
startY: 0,
|
|
172
181
|
pointerId: null
|
|
173
182
|
};
|
|
174
183
|
}
|
|
175
|
-
const
|
|
176
|
-
function
|
|
184
|
+
const zt = 5;
|
|
185
|
+
function ut(t, e, n, o = !1) {
|
|
177
186
|
if (t.spacePressed) return !1;
|
|
178
187
|
const s = n.target;
|
|
179
188
|
if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
|
|
180
189
|
if (e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.dragged = t.currentNodes, o) {
|
|
181
|
-
|
|
190
|
+
wt(t, e);
|
|
182
191
|
const i = t.container.getBoundingClientRect();
|
|
183
|
-
|
|
192
|
+
xt(e.ghost, n.clientX - i.x, n.clientY - i.y);
|
|
184
193
|
}
|
|
185
194
|
return !0;
|
|
186
195
|
}
|
|
187
|
-
function
|
|
196
|
+
function xt(t, e, n) {
|
|
188
197
|
t.style.transform = `translate(${e - 10}px, ${n - 10}px)`, t.style.display = "block";
|
|
189
198
|
}
|
|
190
|
-
function
|
|
199
|
+
function wt(t, e) {
|
|
191
200
|
const { dragged: n } = t;
|
|
192
201
|
if (!n) return;
|
|
193
202
|
const o = document.activeElement;
|
|
@@ -196,51 +205,51 @@ function xt(t, e) {
|
|
|
196
205
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
197
206
|
t.panHelper.clear();
|
|
198
207
|
}
|
|
199
|
-
function
|
|
208
|
+
function Ft(t, e, n) {
|
|
200
209
|
const { dragged: o } = t;
|
|
201
210
|
if (!o || e.pointerId !== n.pointerId) return;
|
|
202
211
|
const s = n.clientX - e.startX, i = n.clientY - e.startY, r = Math.sqrt(s * s + i * i);
|
|
203
|
-
if (!e.isDragging && r >
|
|
212
|
+
if (!e.isDragging && r > zt && wt(t, e), !e.isDragging) return;
|
|
204
213
|
const c = t.container.getBoundingClientRect();
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
e.meet =
|
|
209
|
-
const f =
|
|
210
|
-
n.clientY >
|
|
214
|
+
xt(e.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? e.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? e.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? e.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? e.edgeMoveController.move(0, -1) : e.edgeMoveController.stop(), q(e.meet);
|
|
215
|
+
const a = 12 * t.scaleVal, d = document.elementFromPoint(n.clientX, n.clientY - a);
|
|
216
|
+
if (ft(d, o)) {
|
|
217
|
+
e.meet = d;
|
|
218
|
+
const f = d.getBoundingClientRect(), l = f.y;
|
|
219
|
+
n.clientY > l + f.height ? e.insertType = "after" : e.insertType = "in";
|
|
211
220
|
} else {
|
|
212
|
-
const f = document.elementFromPoint(n.clientX, n.clientY +
|
|
213
|
-
if (
|
|
221
|
+
const f = document.elementFromPoint(n.clientX, n.clientY + a);
|
|
222
|
+
if (ft(f, o)) {
|
|
214
223
|
e.meet = f;
|
|
215
|
-
const
|
|
216
|
-
n.clientY <
|
|
224
|
+
const u = f.getBoundingClientRect().y;
|
|
225
|
+
n.clientY < u ? e.insertType = "before" : e.insertType = "in";
|
|
217
226
|
} else
|
|
218
227
|
e.insertType = null, e.meet = null;
|
|
219
228
|
}
|
|
220
|
-
e.meet &&
|
|
229
|
+
e.meet && Wt(e.meet, e.insertType);
|
|
221
230
|
}
|
|
222
|
-
function
|
|
231
|
+
function Gt(t, e, n) {
|
|
223
232
|
const { dragged: o } = t;
|
|
224
233
|
if (!(!o || e.pointerId !== n.pointerId)) {
|
|
225
234
|
e.edgeMoveController.stop();
|
|
226
235
|
for (const s of o)
|
|
227
236
|
s.parentElement.parentElement.style.opacity = "1";
|
|
228
|
-
e.ghost.style.display = "none", e.ghost.innerHTML = "", e.isDragging && e.meet && (
|
|
237
|
+
e.ghost.style.display = "none", e.ghost.innerHTML = "", e.isDragging && e.meet && (q(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;
|
|
229
238
|
}
|
|
230
239
|
}
|
|
231
|
-
function
|
|
240
|
+
function pt(t, e) {
|
|
232
241
|
const { dragged: n } = t;
|
|
233
242
|
if (n) {
|
|
234
243
|
e.edgeMoveController.stop();
|
|
235
244
|
for (const o of n)
|
|
236
245
|
o.parentElement.parentElement.style.opacity = "1";
|
|
237
|
-
e.meet &&
|
|
246
|
+
e.meet && q(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;
|
|
238
247
|
}
|
|
239
248
|
}
|
|
240
|
-
const
|
|
249
|
+
const B = {
|
|
241
250
|
LHS: "lhs",
|
|
242
251
|
RHS: "rhs"
|
|
243
|
-
},
|
|
252
|
+
}, jt = function() {
|
|
244
253
|
this.nodes.innerHTML = "";
|
|
245
254
|
const t = this.createTopic(this.nodeData);
|
|
246
255
|
St.call(this, t, this.nodeData), t.draggable = !1;
|
|
@@ -253,18 +262,18 @@ const O = {
|
|
|
253
262
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
254
263
|
});
|
|
255
264
|
}
|
|
256
|
-
|
|
257
|
-
},
|
|
265
|
+
_t(this, n, e);
|
|
266
|
+
}, _t = function(t, e, n) {
|
|
258
267
|
const o = document.createElement("me-main");
|
|
259
|
-
o.className =
|
|
268
|
+
o.className = B.LHS;
|
|
260
269
|
const s = document.createElement("me-main");
|
|
261
|
-
s.className =
|
|
270
|
+
s.className = B.RHS;
|
|
262
271
|
for (let i = 0; i < e.length; i++) {
|
|
263
272
|
const r = e[i], { grp: c } = t.createWrapper(r);
|
|
264
273
|
t.direction === 2 ? r.direction === 0 ? o.appendChild(c) : s.appendChild(c) : t.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
265
274
|
}
|
|
266
275
|
t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(s), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
|
|
267
|
-
},
|
|
276
|
+
}, qt = function(t, e) {
|
|
268
277
|
const n = document.createElement("me-children");
|
|
269
278
|
for (let o = 0; o < e.length; o++) {
|
|
270
279
|
const s = e[o], { grp: i } = t.createWrapper(s);
|
|
@@ -302,7 +311,7 @@ const O = {
|
|
|
302
311
|
} else t.link && (t.link = void 0);
|
|
303
312
|
if (e.icons && e.icons.length) {
|
|
304
313
|
const n = document.createElement("span");
|
|
305
|
-
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${
|
|
314
|
+
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${Ot(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
|
|
306
315
|
} else t.icons && (t.icons = void 0);
|
|
307
316
|
if (e.tags && e.tags.length) {
|
|
308
317
|
const n = document.createElement("div");
|
|
@@ -311,23 +320,23 @@ const O = {
|
|
|
311
320
|
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);
|
|
312
321
|
}), t.appendChild(n), t.tags = n;
|
|
313
322
|
} else t.tags && (t.tags = void 0);
|
|
314
|
-
},
|
|
323
|
+
}, Ut = function(t, e) {
|
|
315
324
|
const n = document.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
|
|
316
325
|
if (n.appendChild(o), !e && t.children && t.children.length > 0) {
|
|
317
|
-
const i =
|
|
326
|
+
const i = te(t.expanded);
|
|
318
327
|
if (o.appendChild(i), t.expanded !== !1) {
|
|
319
|
-
const r =
|
|
328
|
+
const r = qt(this, t.children);
|
|
320
329
|
n.appendChild(r);
|
|
321
330
|
}
|
|
322
331
|
}
|
|
323
332
|
return { grp: n, top: o, tpc: s };
|
|
324
|
-
},
|
|
333
|
+
}, Kt = function(t) {
|
|
325
334
|
const e = document.createElement("me-parent"), n = this.createTopic(t);
|
|
326
335
|
return St.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
|
|
327
|
-
},
|
|
336
|
+
}, Jt = function(t) {
|
|
328
337
|
const e = document.createElement("me-children");
|
|
329
338
|
return e.append(...t), e;
|
|
330
|
-
},
|
|
339
|
+
}, Zt = function(t) {
|
|
331
340
|
const e = document.createElement("me-tpc");
|
|
332
341
|
return e.nodeObj = t, e.dataset.nodeid = "me" + t.id, e;
|
|
333
342
|
};
|
|
@@ -337,7 +346,7 @@ function Et(t) {
|
|
|
337
346
|
const n = window.getSelection();
|
|
338
347
|
n && (n.removeAllRanges(), n.addRange(e));
|
|
339
348
|
}
|
|
340
|
-
const
|
|
349
|
+
const Qt = function(t) {
|
|
341
350
|
if (!t) return;
|
|
342
351
|
const e = document.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = P(this.nodes, t);
|
|
343
352
|
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
@@ -357,11 +366,11 @@ const Jt = function(t) {
|
|
|
357
366
|
obj: t.nodeObj
|
|
358
367
|
}), e.addEventListener("keydown", (c) => {
|
|
359
368
|
if (c.stopPropagation(), c.isComposing) return;
|
|
360
|
-
const
|
|
361
|
-
if (
|
|
369
|
+
const a = c.key;
|
|
370
|
+
if (a === "Enter" || a === "Tab") {
|
|
362
371
|
if (c.shiftKey) return;
|
|
363
372
|
c.preventDefault(), e.blur(), this.container.focus();
|
|
364
|
-
} else
|
|
373
|
+
} else a === "Escape" && (c.preventDefault(), e.textContent = o, e.blur(), this.container.focus());
|
|
365
374
|
}), e.addEventListener("blur", () => {
|
|
366
375
|
if (!e) return;
|
|
367
376
|
t.style.opacity = "1", e.remove();
|
|
@@ -372,14 +381,14 @@ const Jt = function(t) {
|
|
|
372
381
|
origin: o
|
|
373
382
|
}));
|
|
374
383
|
});
|
|
375
|
-
},
|
|
384
|
+
}, te = function(t) {
|
|
376
385
|
const e = document.createElement("me-epd");
|
|
377
386
|
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
378
|
-
},
|
|
387
|
+
}, ee = function(t) {
|
|
379
388
|
const n = t.parentElement.parentElement.lastElementChild;
|
|
380
389
|
n?.tagName === "svg" && n?.remove();
|
|
381
390
|
};
|
|
382
|
-
function
|
|
391
|
+
function ne(t) {
|
|
383
392
|
return {
|
|
384
393
|
nodeData: t.isFocusMode ? t.nodeDataBackup : t.nodeData,
|
|
385
394
|
arrows: t.arrows,
|
|
@@ -390,159 +399,159 @@ function te(t) {
|
|
|
390
399
|
meta: t.meta
|
|
391
400
|
};
|
|
392
401
|
}
|
|
393
|
-
const
|
|
402
|
+
const oe = function(t, e = !1) {
|
|
394
403
|
const n = this.container, o = t.getBoundingClientRect(), s = n.getBoundingClientRect();
|
|
395
404
|
if (e || o.top > s.bottom - 50 || o.bottom < s.top + 50 || o.left > s.right - 50 || o.right < s.left + 50) {
|
|
396
|
-
const r = o.left + o.width / 2, c = o.top + o.height / 2,
|
|
397
|
-
this.move(-f, -
|
|
405
|
+
const r = o.left + o.width / 2, c = o.top + o.height / 2, a = s.left + s.width / 2, d = s.top + s.height / 2, f = r - a, l = c - d;
|
|
406
|
+
this.move(-f, -l, !0);
|
|
398
407
|
}
|
|
399
|
-
},
|
|
408
|
+
}, se = function(t, e, n) {
|
|
400
409
|
this.clearSelection(), this.scrollIntoView(t), this.selection?.select(t), e && this.bus.fire("selectNewNode", t.nodeObj);
|
|
401
|
-
},
|
|
410
|
+
}, ie = function(t) {
|
|
402
411
|
this.selection?.select(t);
|
|
403
|
-
},
|
|
412
|
+
}, re = function(t) {
|
|
404
413
|
this.selection?.deselect(t);
|
|
405
|
-
},
|
|
414
|
+
}, ce = function() {
|
|
406
415
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
407
416
|
}, Tt = function(t) {
|
|
408
417
|
return JSON.stringify(t, (e, n) => {
|
|
409
418
|
if (!(e === "parent" && typeof n != "string"))
|
|
410
419
|
return n;
|
|
411
420
|
});
|
|
412
|
-
},
|
|
413
|
-
const t =
|
|
421
|
+
}, le = function() {
|
|
422
|
+
const t = ne(this);
|
|
414
423
|
return Tt(t);
|
|
415
|
-
},
|
|
424
|
+
}, ae = function() {
|
|
416
425
|
return JSON.parse(this.getDataString());
|
|
417
|
-
},
|
|
426
|
+
}, he = function() {
|
|
418
427
|
this.editable = !0;
|
|
419
|
-
},
|
|
428
|
+
}, de = function() {
|
|
420
429
|
this.editable = !1;
|
|
421
|
-
},
|
|
430
|
+
}, fe = function(t, e = { x: 0, y: 0 }) {
|
|
422
431
|
if (t < this.scaleMin && t < this.scaleVal || t > this.scaleMax && t > this.scaleVal) return;
|
|
423
|
-
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 } =
|
|
424
|
-
this.map.style.transform = `translate3d(${
|
|
425
|
-
},
|
|
432
|
+
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 } = it(this), c = this.map.style.transform, { x: a, y: d } = st(c), f = a - i, l = d - r, u = this.scaleVal, g = (-o + f) * (1 - t / u), y = (-s + l) * (1 - t / u);
|
|
433
|
+
this.map.style.transform = `translate3d(${a - g}px, ${d - y}px, 0) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
434
|
+
}, ue = function() {
|
|
426
435
|
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
427
436
|
this.scaleVal = n;
|
|
428
|
-
const { dx: o, dy: s } =
|
|
437
|
+
const { dx: o, dy: s } = it(this, !0);
|
|
429
438
|
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
430
|
-
},
|
|
439
|
+
}, pe = function(t, e, n = !1) {
|
|
431
440
|
const { map: o, scaleVal: s, bus: i, container: r, nodes: c } = this;
|
|
432
441
|
if (n && o.style.transition === "transform 0.3s")
|
|
433
442
|
return;
|
|
434
|
-
const
|
|
435
|
-
let { x:
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
438
|
-
const
|
|
439
|
-
(
|
|
443
|
+
const a = o.style.transform;
|
|
444
|
+
let { x: d, y: f } = st(a);
|
|
445
|
+
const l = r.getBoundingClientRect(), u = c.getBoundingClientRect(), g = u.left < l.right && u.right > l.left, y = u.top < l.bottom && u.bottom > l.top;
|
|
446
|
+
if (g) {
|
|
447
|
+
const p = u.left + t, b = u.right + t;
|
|
448
|
+
(p >= l.right || b <= l.left) && (t = 0);
|
|
440
449
|
}
|
|
441
450
|
if (y) {
|
|
442
|
-
const
|
|
443
|
-
(
|
|
451
|
+
const p = u.top + e, b = u.bottom + e;
|
|
452
|
+
(p >= l.bottom || b <= l.top) && (e = 0);
|
|
444
453
|
}
|
|
445
|
-
|
|
454
|
+
d += t, f += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
446
455
|
o.style.transition = "none";
|
|
447
|
-
}, 300)), o.style.transform = `translate3d(${
|
|
448
|
-
},
|
|
456
|
+
}, 300)), o.style.transform = `translate3d(${d}px, ${f}px, 0) scale(${s})`, i.fire("move", { dx: t, dy: e });
|
|
457
|
+
}, it = (t, e = !1) => {
|
|
449
458
|
const { container: n, map: o, nodes: s } = t;
|
|
450
459
|
let i, r;
|
|
451
460
|
if (t.alignment === "nodes" || e)
|
|
452
461
|
i = (n.offsetWidth - s.offsetWidth) / 2, r = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
|
|
453
462
|
else {
|
|
454
|
-
const c = o.querySelector("me-root"),
|
|
455
|
-
i = n.offsetWidth / 2 -
|
|
463
|
+
const c = o.querySelector("me-root"), a = c.offsetTop, d = c.offsetLeft, f = c.offsetWidth, l = c.offsetHeight;
|
|
464
|
+
i = n.offsetWidth / 2 - d - f / 2, r = n.offsetHeight / 2 - a - l / 2, o.style.transformOrigin = `${d + f / 2}px 50%`;
|
|
456
465
|
}
|
|
457
466
|
return { dx: i, dy: r };
|
|
458
|
-
},
|
|
459
|
-
const { map: t, container: e } = this, { dx: n, dy: o } =
|
|
467
|
+
}, ge = function() {
|
|
468
|
+
const { map: t, container: e } = this, { dx: n, dy: o } = it(this);
|
|
460
469
|
e.scrollTop = 0, e.scrollLeft = 0, t.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
461
|
-
},
|
|
470
|
+
}, me = function(t) {
|
|
462
471
|
t(this);
|
|
463
|
-
},
|
|
472
|
+
}, ye = function(t) {
|
|
464
473
|
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());
|
|
465
|
-
},
|
|
474
|
+
}, be = function() {
|
|
466
475
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
467
|
-
},
|
|
476
|
+
}, ve = function() {
|
|
468
477
|
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
469
|
-
},
|
|
478
|
+
}, xe = function() {
|
|
470
479
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
471
|
-
},
|
|
480
|
+
}, we = function() {
|
|
472
481
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
473
|
-
},
|
|
482
|
+
}, Ce = function(t, e) {
|
|
474
483
|
const n = t.nodeObj;
|
|
475
484
|
typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
476
485
|
const o = t.getBoundingClientRect(), s = {
|
|
477
486
|
x: o.left,
|
|
478
487
|
y: o.top
|
|
479
488
|
}, i = t.parentNode, r = i.children[1];
|
|
480
|
-
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "",
|
|
481
|
-
const
|
|
482
|
-
n.children.map((
|
|
489
|
+
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", ee(t), n.expanded) {
|
|
490
|
+
const l = this.createChildren(
|
|
491
|
+
n.children.map((u) => this.createWrapper(u).grp)
|
|
483
492
|
);
|
|
484
|
-
i.parentNode.appendChild(
|
|
493
|
+
i.parentNode.appendChild(l);
|
|
485
494
|
} else
|
|
486
495
|
i.parentNode.children[1].remove();
|
|
487
496
|
this.linkDiv(t.closest("me-main > me-wrapper"));
|
|
488
|
-
const c = t.getBoundingClientRect(),
|
|
497
|
+
const c = t.getBoundingClientRect(), a = {
|
|
489
498
|
x: c.left,
|
|
490
499
|
y: c.top
|
|
491
|
-
},
|
|
492
|
-
this.move(
|
|
493
|
-
},
|
|
500
|
+
}, d = s.x - a.x, f = s.y - a.y;
|
|
501
|
+
this.move(d, f), this.bus.fire("expandNode", n);
|
|
502
|
+
}, Se = function(t, e) {
|
|
494
503
|
const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
|
|
495
504
|
x: o.left,
|
|
496
505
|
y: o.top
|
|
497
506
|
};
|
|
498
|
-
|
|
507
|
+
bt(n, e ?? !n.expanded), this.refresh();
|
|
499
508
|
const i = this.findEle(n.id).getBoundingClientRect(), r = {
|
|
500
509
|
x: i.left,
|
|
501
510
|
y: i.top
|
|
502
|
-
}, c = s.x - r.x,
|
|
503
|
-
this.move(c,
|
|
504
|
-
},
|
|
505
|
-
this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.meta && (this.meta = t.meta), t.theme && this.changeTheme(t.theme)),
|
|
506
|
-
},
|
|
511
|
+
}, c = s.x - r.x, a = s.y - r.y;
|
|
512
|
+
this.move(c, a);
|
|
513
|
+
}, Ee = function(t) {
|
|
514
|
+
this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.meta && (this.meta = t.meta), t.theme && this.changeTheme(t.theme)), ot(this.nodeData), this.layout(), this.linkDiv();
|
|
515
|
+
}, Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
507
516
|
__proto__: null,
|
|
508
|
-
cancelFocus:
|
|
509
|
-
clearSelection:
|
|
510
|
-
disableEdit:
|
|
511
|
-
enableEdit:
|
|
512
|
-
expandNode:
|
|
513
|
-
expandNodeAll:
|
|
514
|
-
focusNode:
|
|
515
|
-
getData:
|
|
516
|
-
getDataString:
|
|
517
|
-
initLeft:
|
|
518
|
-
initRight:
|
|
519
|
-
initSide:
|
|
520
|
-
install:
|
|
521
|
-
move:
|
|
522
|
-
refresh:
|
|
523
|
-
scale:
|
|
524
|
-
scaleFit:
|
|
525
|
-
scrollIntoView:
|
|
526
|
-
selectNode:
|
|
527
|
-
selectNodes:
|
|
517
|
+
cancelFocus: be,
|
|
518
|
+
clearSelection: ce,
|
|
519
|
+
disableEdit: de,
|
|
520
|
+
enableEdit: he,
|
|
521
|
+
expandNode: Ce,
|
|
522
|
+
expandNodeAll: Se,
|
|
523
|
+
focusNode: ye,
|
|
524
|
+
getData: ae,
|
|
525
|
+
getDataString: le,
|
|
526
|
+
initLeft: ve,
|
|
527
|
+
initRight: xe,
|
|
528
|
+
initSide: we,
|
|
529
|
+
install: me,
|
|
530
|
+
move: pe,
|
|
531
|
+
refresh: Ee,
|
|
532
|
+
scale: fe,
|
|
533
|
+
scaleFit: ue,
|
|
534
|
+
scrollIntoView: oe,
|
|
535
|
+
selectNode: se,
|
|
536
|
+
selectNodes: ie,
|
|
528
537
|
stringifyData: Tt,
|
|
529
|
-
toCenter:
|
|
530
|
-
unselectNodes:
|
|
531
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
532
|
-
const i = -
|
|
538
|
+
toCenter: ge,
|
|
539
|
+
unselectNodes: re
|
|
540
|
+
}, Symbol.toStringTag, { value: "Module" })), De = 40, Le = 10, Me = ({ deltaMode: t, deltaY: e, viewportHeight: n }) => t === WheelEvent.DOM_DELTA_LINE ? e * De : t === WheelEvent.DOM_DELTA_PAGE ? e * n : e, Pe = ({ deltaMode: t, deltaY: e, scaleSensitivity: n, viewportHeight: o }) => {
|
|
541
|
+
const i = -Me({ deltaMode: t, deltaY: e, viewportHeight: o }) / Le * n;
|
|
533
542
|
return Math.max(-n, Math.min(n, i));
|
|
534
|
-
},
|
|
543
|
+
}, ke = (t, e, n) => {
|
|
535
544
|
e !== 0 && t.scale(t.scaleVal + e, n);
|
|
536
|
-
},
|
|
537
|
-
const n =
|
|
545
|
+
}, Ae = (t, e) => {
|
|
546
|
+
const n = Pe({
|
|
538
547
|
deltaMode: e.deltaMode,
|
|
539
548
|
deltaY: e.deltaY,
|
|
540
549
|
scaleSensitivity: t.scaleSensitivity,
|
|
541
550
|
viewportHeight: t.container.clientHeight || window.innerHeight
|
|
542
551
|
});
|
|
543
|
-
|
|
552
|
+
ke(t, n, { x: e.clientX, y: e.clientY });
|
|
544
553
|
};
|
|
545
|
-
function
|
|
554
|
+
function Ne(t) {
|
|
546
555
|
const { panHelper: e, container: n } = t;
|
|
547
556
|
let o = null;
|
|
548
557
|
t.spacePressed = !1;
|
|
@@ -555,8 +564,8 @@ function ke(t) {
|
|
|
555
564
|
this.clear();
|
|
556
565
|
return;
|
|
557
566
|
}
|
|
558
|
-
const
|
|
559
|
-
this.lastTap =
|
|
567
|
+
const w = (/* @__PURE__ */ new Date()).getTime(), E = w - this.lastTap, S = E < this.DOUBLE_CLICK_THRESHOLD && E > 0 && this.lastTapTarget === h.target;
|
|
568
|
+
this.lastTap = w, this.lastTapTarget = h.target, S && m(h);
|
|
560
569
|
},
|
|
561
570
|
clear() {
|
|
562
571
|
this.lastTap = 0, this.lastTapTarget = null;
|
|
@@ -576,20 +585,20 @@ function ke(t) {
|
|
|
576
585
|
handlePointerDown(h) {
|
|
577
586
|
if (h.pointerType !== "touch") return !1;
|
|
578
587
|
if (this.activePointers.set(h.pointerId, { x: h.clientX, y: h.clientY }), this.activePointers.size >= 2) {
|
|
579
|
-
const [m,
|
|
580
|
-
return this.lastDistance =
|
|
588
|
+
const [m, w] = Array.from(this.activePointers.values());
|
|
589
|
+
return this.lastDistance = dt(m, w), !0;
|
|
581
590
|
}
|
|
582
591
|
return !1;
|
|
583
592
|
},
|
|
584
593
|
handlePointerMove(h) {
|
|
585
594
|
if (h.pointerType !== "touch" || !this.activePointers.has(h.pointerId)) return !1;
|
|
586
595
|
if (this.activePointers.set(h.pointerId, { x: h.clientX, y: h.clientY }), this.activePointers.size >= 2) {
|
|
587
|
-
const [m,
|
|
596
|
+
const [m, w] = Array.from(this.activePointers.values()), E = dt(m, w);
|
|
588
597
|
if (this.lastDistance !== null && this.lastDistance > 0) {
|
|
589
598
|
const S = E / this.lastDistance;
|
|
590
599
|
t.scale(t.scaleVal * S, {
|
|
591
|
-
x: (m.x +
|
|
592
|
-
y: (m.y +
|
|
600
|
+
x: (m.x + w.x) / 2,
|
|
601
|
+
y: (m.y + w.y) / 2
|
|
593
602
|
});
|
|
594
603
|
}
|
|
595
604
|
return this.lastDistance = E, !0;
|
|
@@ -602,7 +611,7 @@ function ke(t) {
|
|
|
602
611
|
clear() {
|
|
603
612
|
this.activePointers.clear(), this.lastDistance = null;
|
|
604
613
|
}
|
|
605
|
-
}, c =
|
|
614
|
+
}, c = Vt(t), a = {
|
|
606
615
|
timer: null,
|
|
607
616
|
startPos: null,
|
|
608
617
|
pointerId: null,
|
|
@@ -618,16 +627,16 @@ function ke(t) {
|
|
|
618
627
|
},
|
|
619
628
|
handleMove(h) {
|
|
620
629
|
if (this.timer !== null && this.startPos !== null && h.pointerId === this.pointerId) {
|
|
621
|
-
const m = h.clientX - this.startPos.x,
|
|
622
|
-
Math.sqrt(m * m +
|
|
630
|
+
const m = h.clientX - this.startPos.x, w = h.clientY - this.startPos.y;
|
|
631
|
+
Math.sqrt(m * m + w * w) > this.MOVE_THRESHOLD && this.clear();
|
|
623
632
|
}
|
|
624
633
|
}
|
|
625
|
-
},
|
|
634
|
+
}, d = (h, m) => {
|
|
626
635
|
if (h.closest("#input-box")) return !1;
|
|
627
|
-
const
|
|
636
|
+
const w = h.closest(".svg-label"), E = h.closest(".topiclinks, .summary"), S = w ? { type: w.dataset.type, element: document.getElementById(w.dataset.svgId) } : E ? { type: E.classList.contains("topiclinks") ? "arrow" : "summary", element: h.closest("g") } : null;
|
|
628
637
|
if (!S?.type || !S?.element) return !1;
|
|
629
|
-
const { type: M, element:
|
|
630
|
-
return t.clearSelection(), M === "arrow" ? m ? t.editArrowLabel(
|
|
638
|
+
const { type: M, element: A } = S;
|
|
639
|
+
return t.clearSelection(), M === "arrow" ? m ? t.editArrowLabel(A) : t.selectArrow(A) : m ? t.editSummary(A) : t.selectSummary(A), !0;
|
|
631
640
|
}, f = (h) => {
|
|
632
641
|
if (h.pointerType === "mouse" && h.button !== 0) return;
|
|
633
642
|
if (t.helper1?.moved) {
|
|
@@ -646,17 +655,17 @@ function ke(t) {
|
|
|
646
655
|
return;
|
|
647
656
|
const m = h.target;
|
|
648
657
|
m.tagName === "ME-EPD" && (h.ctrlKey || h.metaKey ? t.expandNodeAll(m.previousSibling) : t.expandNode(m.previousSibling));
|
|
649
|
-
},
|
|
658
|
+
}, l = (h) => {
|
|
650
659
|
if (!t.editable) return;
|
|
651
660
|
const m = h.target;
|
|
652
661
|
if (J(m)) {
|
|
653
662
|
t.selectNode(m), t.beginEdit(m);
|
|
654
663
|
return;
|
|
655
664
|
}
|
|
656
|
-
|
|
657
|
-
},
|
|
665
|
+
d(m, !0);
|
|
666
|
+
}, u = (h) => {
|
|
658
667
|
if (h.pointerType === "touch" && r.handlePointerDown(h)) {
|
|
659
|
-
t.ptState = i.Pinch,
|
|
668
|
+
t.ptState = i.Pinch, a.clear(), e.clear(), (c.isDragging || c.pointerId !== null) && pt(t, c);
|
|
660
669
|
return;
|
|
661
670
|
}
|
|
662
671
|
if (t.ptState === i.Pinch) return;
|
|
@@ -670,21 +679,21 @@ function ke(t) {
|
|
|
670
679
|
t.selection?.cancel();
|
|
671
680
|
const E = t.currentNodes || [];
|
|
672
681
|
if (h.ctrlKey || h.metaKey || t.mobileMultiSelect ? E.includes(m) ? o = m : ((t.currentArrow || t.currentSummary) && t.clearSelection(), t.selection?.select(m)) : E.includes(m) || t.selectNode(m), !t.editable) return;
|
|
673
|
-
h.pointerType === "touch" ? (t.ptState = i.DragWait,
|
|
674
|
-
|
|
675
|
-
})) :
|
|
682
|
+
h.pointerType === "touch" ? (t.ptState = i.DragWait, a.start(h, (M) => {
|
|
683
|
+
ut(t, c, M, !0) && (t.ptState = i.Drag, m.setPointerCapture(M.pointerId));
|
|
684
|
+
})) : ut(t, c, h, !1) && (t.ptState = i.Drag, m.setPointerCapture(h.pointerId));
|
|
676
685
|
} else
|
|
677
|
-
|
|
678
|
-
},
|
|
686
|
+
d(m, !1);
|
|
687
|
+
}, g = (h) => {
|
|
679
688
|
switch (t.ptState) {
|
|
680
689
|
case i.Pinch:
|
|
681
690
|
r.handlePointerMove(h);
|
|
682
691
|
break;
|
|
683
692
|
case i.DragWait:
|
|
684
|
-
|
|
693
|
+
a.handleMove(h), a.timer === null && (t.ptState = i.Idle);
|
|
685
694
|
break;
|
|
686
695
|
case i.Drag:
|
|
687
|
-
|
|
696
|
+
Ft(t, c, h);
|
|
688
697
|
break;
|
|
689
698
|
case i.Pan:
|
|
690
699
|
e.handlePointerMove(h);
|
|
@@ -692,50 +701,50 @@ function ke(t) {
|
|
|
692
701
|
}
|
|
693
702
|
}, y = (h) => {
|
|
694
703
|
h.pointerType === "touch" && r.handlePointerUp(h);
|
|
695
|
-
const m = c.isDragging,
|
|
704
|
+
const m = c.isDragging, w = e.moved;
|
|
696
705
|
switch (t.ptState) {
|
|
697
706
|
case i.DragWait:
|
|
698
|
-
|
|
707
|
+
a.clear();
|
|
699
708
|
break;
|
|
700
709
|
case i.Drag:
|
|
701
|
-
|
|
710
|
+
Gt(t, c, h);
|
|
702
711
|
break;
|
|
703
712
|
case i.Pan:
|
|
704
713
|
e.handlePointerUp(h);
|
|
705
714
|
break;
|
|
706
715
|
}
|
|
707
|
-
s.detect(h,
|
|
708
|
-
},
|
|
709
|
-
r.clear(),
|
|
710
|
-
},
|
|
716
|
+
s.detect(h, l), (t.ptState !== i.Pinch || r.activePointers.size < 2) && (t.ptState = i.Idle), o && (!m && !w && t.selection?.deselect(o), o = null);
|
|
717
|
+
}, p = () => {
|
|
718
|
+
r.clear(), a.clear(), e.clear(), s.clear(), (c.isDragging || c.pointerId !== null) && pt(t, c), t.ptState = i.Idle, o = null;
|
|
719
|
+
}, b = (h) => {
|
|
711
720
|
h.preventDefault(), h.button === 2 && t.editable && setTimeout(() => {
|
|
712
721
|
if (t.panHelper.moved || t.ptState !== i.Idle && t.ptState !== i.Pan) return;
|
|
713
722
|
const m = h.target;
|
|
714
723
|
J(m) && !m.classList.contains("selected") && t.selectNode(m), t.bus.fire("showContextMenu", h);
|
|
715
724
|
}, 200);
|
|
716
|
-
},
|
|
717
|
-
if (h.stopPropagation(), h.preventDefault(), h.ctrlKey || h.metaKey) return
|
|
725
|
+
}, x = (h) => {
|
|
726
|
+
if (h.stopPropagation(), h.preventDefault(), h.ctrlKey || h.metaKey) return Ae(t, h);
|
|
718
727
|
if (h.shiftKey) return t.move(-h.deltaY, 0);
|
|
719
728
|
t.move(-h.deltaX, -h.deltaY);
|
|
720
|
-
},
|
|
729
|
+
}, v = (h) => {
|
|
721
730
|
h.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
|
|
722
731
|
}, C = (h) => {
|
|
723
732
|
h.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
|
|
724
733
|
};
|
|
725
|
-
return
|
|
726
|
-
{ dom: n, evt: "pointerdown", func:
|
|
727
|
-
{ dom: n, evt: "pointermove", func:
|
|
734
|
+
return vt([
|
|
735
|
+
{ dom: n, evt: "pointerdown", func: u },
|
|
736
|
+
{ dom: n, evt: "pointermove", func: g },
|
|
728
737
|
{ dom: n, evt: "pointerup", func: y },
|
|
729
|
-
{ dom: n, evt: "pointercancel", func:
|
|
738
|
+
{ dom: n, evt: "pointercancel", func: p },
|
|
730
739
|
{ dom: n, evt: "click", func: f },
|
|
731
|
-
{ dom: n, evt: "contextmenu", func:
|
|
732
|
-
{ dom: n, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel :
|
|
733
|
-
{ dom: n, evt: "blur", func:
|
|
734
|
-
{ dom: n, evt: "keydown", func:
|
|
740
|
+
{ dom: n, evt: "contextmenu", func: b },
|
|
741
|
+
{ dom: n, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : x },
|
|
742
|
+
{ dom: n, evt: "blur", func: p },
|
|
743
|
+
{ dom: n, evt: "keydown", func: v },
|
|
735
744
|
{ dom: n, evt: "keyup", func: C }
|
|
736
745
|
]);
|
|
737
746
|
}
|
|
738
|
-
function
|
|
747
|
+
function $e() {
|
|
739
748
|
return {
|
|
740
749
|
handlers: {},
|
|
741
750
|
addListener: function(t, e) {
|
|
@@ -764,10 +773,10 @@ const k = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
764
773
|
let c = s;
|
|
765
774
|
r === "middle" ? c = s - e / 2 : r === "end" && (c = s - e), t.style.left = `${c}px`, t.style.top = `${i - n / 2}px`, t.style.visibility = "visible";
|
|
766
775
|
}, Q = function(t, e, n, o) {
|
|
767
|
-
const { anchor: s = "middle", color: i, dataType: r, svgId: c } = o,
|
|
768
|
-
|
|
769
|
-
const
|
|
770
|
-
return
|
|
776
|
+
const { anchor: s = "middle", color: i, dataType: r, svgId: c } = o, a = document.createElement("div");
|
|
777
|
+
a.className = "svg-label", a.style.color = i || "#666";
|
|
778
|
+
const d = "label-" + c;
|
|
779
|
+
return a.id = d, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = c, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor = s, a;
|
|
771
780
|
}, Dt = function(t, e, n) {
|
|
772
781
|
const o = document.createElementNS(k, "path");
|
|
773
782
|
return D(o, {
|
|
@@ -776,13 +785,13 @@ const k = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
776
785
|
fill: "none",
|
|
777
786
|
"stroke-width": n
|
|
778
787
|
}), o;
|
|
779
|
-
},
|
|
788
|
+
}, R = function(t) {
|
|
780
789
|
const e = document.createElementNS(k, "svg");
|
|
781
790
|
return e.setAttribute("class", t), e.setAttribute("overflow", "visible"), e;
|
|
782
|
-
},
|
|
791
|
+
}, gt = function() {
|
|
783
792
|
const t = document.createElementNS(k, "line");
|
|
784
793
|
return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
|
|
785
|
-
},
|
|
794
|
+
}, He = function(t, e, n, o) {
|
|
786
795
|
const s = document.createElementNS(k, "g");
|
|
787
796
|
return [
|
|
788
797
|
{
|
|
@@ -798,21 +807,21 @@ const k = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
798
807
|
d: n
|
|
799
808
|
}
|
|
800
809
|
].forEach((r, c) => {
|
|
801
|
-
const
|
|
802
|
-
d:
|
|
810
|
+
const a = r.d, d = document.createElementNS(k, "path"), f = {
|
|
811
|
+
d: a,
|
|
803
812
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
804
813
|
fill: "none",
|
|
805
814
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
806
815
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
807
816
|
};
|
|
808
|
-
o?.opacity !== void 0 && (f.opacity = String(o.opacity)), D(
|
|
809
|
-
const
|
|
810
|
-
D(
|
|
811
|
-
d:
|
|
817
|
+
o?.opacity !== void 0 && (f.opacity = String(o.opacity)), D(d, f), c === 0 && d.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
818
|
+
const l = document.createElementNS(k, "path");
|
|
819
|
+
D(l, {
|
|
820
|
+
d: a,
|
|
812
821
|
stroke: "transparent",
|
|
813
822
|
fill: "none",
|
|
814
823
|
"stroke-width": "15"
|
|
815
|
-
}), s.appendChild(
|
|
824
|
+
}), s.appendChild(l), s.appendChild(d), s[r.name] = d;
|
|
816
825
|
}), s;
|
|
817
826
|
}, Lt = function(t, e, n) {
|
|
818
827
|
if (!e) return;
|
|
@@ -841,62 +850,62 @@ const k = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
841
850
|
obj: n
|
|
842
851
|
}));
|
|
843
852
|
});
|
|
844
|
-
},
|
|
853
|
+
}, Ie = function(t) {
|
|
845
854
|
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");
|
|
846
855
|
this.lines.innerHTML = "";
|
|
847
856
|
for (let c = 0; c < r.length; c++) {
|
|
848
|
-
const
|
|
849
|
-
if (
|
|
857
|
+
const a = r[c], d = a.querySelector("me-tpc"), { offsetLeft: f, offsetTop: l } = P(this.nodes, d), u = d.offsetWidth, g = d.offsetHeight, y = a.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: l, cL: f, cW: u, cH: g, direction: y, containerHeight: this.nodes.offsetHeight }), b = this.theme.palette, x = d.nodeObj.branchColor || b[c % b.length];
|
|
858
|
+
if (d.style.borderColor = x, this.lines.appendChild(Dt(p, x, "3")), t && t !== a)
|
|
850
859
|
continue;
|
|
851
|
-
const
|
|
852
|
-
C.tagName === "svg" && C.remove(),
|
|
860
|
+
const v = R("subLines"), C = a.lastChild;
|
|
861
|
+
C.tagName === "svg" && C.remove(), a.appendChild(v), Mt(this, v, x, a, y, !0);
|
|
853
862
|
}
|
|
854
863
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
855
864
|
}, Mt = function(t, e, n, o, s, i) {
|
|
856
865
|
const r = o.firstChild, c = o.children[1].children;
|
|
857
866
|
if (c.length === 0) return;
|
|
858
|
-
const
|
|
859
|
-
for (let
|
|
860
|
-
const
|
|
867
|
+
const a = r.offsetTop, d = r.offsetLeft, f = r.offsetWidth, l = r.offsetHeight;
|
|
868
|
+
for (let u = 0; u < c.length; u++) {
|
|
869
|
+
const g = c[u], y = g.firstChild, p = y.offsetTop, b = y.offsetLeft, x = y.offsetWidth, v = y.offsetHeight, C = y.firstChild.nodeObj.branchColor || n, T = t.generateSubBranch({ pT: a, pL: d, pW: f, pH: l, cT: p, cL: b, cW: x, cH: v, direction: s, isFirst: i });
|
|
861
870
|
e.appendChild(Dt(T, C, "2"));
|
|
862
871
|
const h = y.children[1];
|
|
863
872
|
if (h) {
|
|
864
873
|
if (!h.expanded) continue;
|
|
865
874
|
} else
|
|
866
875
|
continue;
|
|
867
|
-
Mt(t, e, C,
|
|
876
|
+
Mt(t, e, C, g, s);
|
|
868
877
|
}
|
|
869
|
-
},
|
|
870
|
-
side:
|
|
871
|
-
left:
|
|
872
|
-
right:
|
|
873
|
-
full:
|
|
874
|
-
living:
|
|
875
|
-
zoomin:
|
|
876
|
-
zoomout:
|
|
877
|
-
},
|
|
878
|
+
}, 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="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>', 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="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>', 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="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>', We = '<?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>', 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="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>', Xe = '<?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>', Ve = '<?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>', ze = {
|
|
879
|
+
side: Oe,
|
|
880
|
+
left: Be,
|
|
881
|
+
right: Ye,
|
|
882
|
+
full: We,
|
|
883
|
+
living: Re,
|
|
884
|
+
zoomin: Xe,
|
|
885
|
+
zoomout: Ve
|
|
886
|
+
}, I = (t, e) => {
|
|
878
887
|
const n = document.createElement("span");
|
|
879
|
-
return n.id = t, n.innerHTML =
|
|
888
|
+
return n.id = t, n.innerHTML = ze[e], n;
|
|
880
889
|
};
|
|
881
|
-
function
|
|
882
|
-
const e = document.createElement("div"), n =
|
|
890
|
+
function Fe(t) {
|
|
891
|
+
const e = document.createElement("div"), n = I("fullscreen", "full"), o = I("toCenter", "living"), s = I("zoomout", "zoomout"), i = I("zoomin", "zoomin");
|
|
883
892
|
e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(i), e.className = "mind-elixir-toolbar rb";
|
|
884
893
|
let r = null;
|
|
885
894
|
const c = () => {
|
|
886
|
-
const
|
|
895
|
+
const d = t.container.getBoundingClientRect(), f = st(t.map.style.transform), l = d.width / 2, u = d.height / 2, g = (l - f.x) / t.scaleVal, y = (u - f.y) / t.scaleVal;
|
|
887
896
|
r = {
|
|
888
|
-
containerRect:
|
|
897
|
+
containerRect: d,
|
|
889
898
|
currentTransform: f,
|
|
890
|
-
mapCenterX:
|
|
899
|
+
mapCenterX: g,
|
|
891
900
|
mapCenterY: y
|
|
892
901
|
};
|
|
893
|
-
},
|
|
902
|
+
}, a = () => {
|
|
894
903
|
if (r) {
|
|
895
|
-
const
|
|
896
|
-
t.move(y,
|
|
904
|
+
const d = t.container.getBoundingClientRect(), f = d.width / 2, l = d.height / 2, u = f - r.mapCenterX * t.scaleVal, g = l - r.mapCenterY * t.scaleVal, y = u - r.currentTransform.x, p = g - r.currentTransform.y;
|
|
905
|
+
t.move(y, p);
|
|
897
906
|
}
|
|
898
907
|
};
|
|
899
|
-
return t.el.addEventListener("fullscreenchange",
|
|
908
|
+
return t.el.addEventListener("fullscreenchange", a), n.onclick = () => {
|
|
900
909
|
c(), document.fullscreenElement !== t.el ? t.el.requestFullscreen() : document.exitFullscreen();
|
|
901
910
|
}, o.onclick = () => {
|
|
902
911
|
t.toCenter();
|
|
@@ -906,8 +915,8 @@ function Ve(t) {
|
|
|
906
915
|
t.scale(t.scaleVal + t.scaleSensitivity);
|
|
907
916
|
}, e;
|
|
908
917
|
}
|
|
909
|
-
function
|
|
910
|
-
const e = document.createElement("div"), n =
|
|
918
|
+
function Ge(t) {
|
|
919
|
+
const e = document.createElement("div"), n = I("tbltl", "left"), o = I("tbltr", "right"), s = I("tblts", "side");
|
|
911
920
|
return e.appendChild(n), e.appendChild(o), e.appendChild(s), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
912
921
|
t.initLeft();
|
|
913
922
|
}, o.onclick = () => {
|
|
@@ -916,30 +925,30 @@ function ze(t) {
|
|
|
916
925
|
t.initSide();
|
|
917
926
|
}, e;
|
|
918
927
|
}
|
|
919
|
-
function
|
|
920
|
-
t.container.append(
|
|
928
|
+
function je(t) {
|
|
929
|
+
t.container.append(Fe(t)), t.container.append(Ge(t));
|
|
921
930
|
}
|
|
922
|
-
function Pt({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction:
|
|
931
|
+
function Pt({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, containerHeight: d }) {
|
|
923
932
|
let f = e + n / 2;
|
|
924
|
-
const
|
|
925
|
-
let
|
|
926
|
-
|
|
927
|
-
const
|
|
928
|
-
return
|
|
933
|
+
const l = t + o / 2;
|
|
934
|
+
let u;
|
|
935
|
+
a === B.LHS ? u = i + r : u = i;
|
|
936
|
+
const g = s + c / 2, p = (1 - Math.abs(g - l) / d) * 0.25 * (n / 2);
|
|
937
|
+
return a === B.LHS ? f = f - n / 10 - p : f = f + n / 10 + p, `M ${f} ${l} Q ${f} ${g} ${u} ${g}`;
|
|
929
938
|
}
|
|
930
|
-
function kt({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction:
|
|
939
|
+
function kt({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, isFirst: d }) {
|
|
931
940
|
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
932
|
-
let
|
|
933
|
-
|
|
934
|
-
const
|
|
935
|
-
let y = 0,
|
|
936
|
-
const
|
|
937
|
-
return
|
|
941
|
+
let l = 0, u = 0;
|
|
942
|
+
d ? l = t + o / 2 : l = t + o;
|
|
943
|
+
const g = s + c;
|
|
944
|
+
let y = 0, p = 0, b = 0;
|
|
945
|
+
const x = Math.abs(l - g) / 300 * f;
|
|
946
|
+
return a === B.LHS ? (b = e, y = b + f, p = b - f, u = i + f, `M ${y} ${l} C ${b} ${l} ${b + x} ${g} ${p} ${g} H ${u}`) : (b = e + n, y = b - f, p = b + f, u = i + r - f, `M ${y} ${l} C ${b} ${l} ${b - x} ${g} ${p} ${g} H ${u}`);
|
|
938
947
|
}
|
|
939
|
-
const
|
|
948
|
+
const _e = function(t, e = !0) {
|
|
940
949
|
this.theme = t, this.generateMainBranch = this.theme.generateMainBranch || Pt, this.generateSubBranch = this.theme.generateSubBranch || kt;
|
|
941
950
|
const o = {
|
|
942
|
-
...(this.theme.type === "dark" ?
|
|
951
|
+
...(this.theme.type === "dark" ? nt : et).cssVar,
|
|
943
952
|
...this.theme.cssVar
|
|
944
953
|
};
|
|
945
954
|
this.compact && (o["--node-gap-x"] = "15px", o["--node-gap-y"] = "2px", o["--main-gap-x"] = "30px", o["--main-gap-y"] = "6px");
|
|
@@ -949,9 +958,9 @@ const Ge = function(t, e = !0) {
|
|
|
949
958
|
this.container.style.setProperty(r, o[r]);
|
|
950
959
|
}
|
|
951
960
|
e && this.refresh();
|
|
952
|
-
}, _e = function(t) {
|
|
953
|
-
this.compact = t, this.theme && this.changeTheme(this.theme);
|
|
954
961
|
}, qe = function(t) {
|
|
962
|
+
this.compact = t, this.theme && this.changeTheme(this.theme);
|
|
963
|
+
}, Ue = function(t) {
|
|
955
964
|
return {
|
|
956
965
|
dom: t,
|
|
957
966
|
moved: !1,
|
|
@@ -974,7 +983,7 @@ const Ge = function(t, e = !0) {
|
|
|
974
983
|
},
|
|
975
984
|
cb: null,
|
|
976
985
|
init(e, n) {
|
|
977
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
986
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = vt([
|
|
978
987
|
{ dom: e, evt: "pointermove", func: this.handlePointerMove },
|
|
979
988
|
{ dom: e, evt: "pointerleave", func: this.handleClear },
|
|
980
989
|
{ dom: e, evt: "pointerup", func: this.handleClear },
|
|
@@ -986,19 +995,19 @@ const Ge = function(t, e = !0) {
|
|
|
986
995
|
this.moved = !1, this.pointerdown = !1;
|
|
987
996
|
}
|
|
988
997
|
};
|
|
989
|
-
},
|
|
990
|
-
create:
|
|
991
|
-
},
|
|
992
|
-
function
|
|
998
|
+
}, mt = {
|
|
999
|
+
create: Ue
|
|
1000
|
+
}, At = "#4dc4ff";
|
|
1001
|
+
function Nt(t, e, n, o, s, i, r, c) {
|
|
993
1002
|
return {
|
|
994
1003
|
x: t / 8 + n * 3 / 8 + s * 3 / 8 + r / 8,
|
|
995
1004
|
y: e / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
996
1005
|
};
|
|
997
1006
|
}
|
|
998
|
-
function
|
|
1007
|
+
function Ke(t, e, n) {
|
|
999
1008
|
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), U(t));
|
|
1000
1009
|
}
|
|
1001
|
-
function
|
|
1010
|
+
function O(t, e, n, o, s) {
|
|
1002
1011
|
D(t, {
|
|
1003
1012
|
x1: e + "",
|
|
1004
1013
|
y1: n + "",
|
|
@@ -1006,51 +1015,44 @@ function V(t, e, n, o, s) {
|
|
|
1006
1015
|
y2: s + ""
|
|
1007
1016
|
});
|
|
1008
1017
|
}
|
|
1009
|
-
function
|
|
1010
|
-
const f = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${c} ${
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
if (t.arrow1.setAttribute("d", u), d.length > 1 && d[1].setAttribute("d", u), a.style) {
|
|
1021
|
-
const g = a.style;
|
|
1022
|
-
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));
|
|
1023
|
-
}
|
|
1018
|
+
function tt(t, e, n, o, s, i, r, c, a, d) {
|
|
1019
|
+
const f = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${c} ${a}`;
|
|
1020
|
+
t.line.setAttribute("d", f);
|
|
1021
|
+
const l = d.style || {};
|
|
1022
|
+
t.line.setAttribute("stroke", l.stroke || "rgb(227, 125, 116)"), t.line.setAttribute("stroke-width", String(l.strokeWidth || "2")), t.line.setAttribute("stroke-dasharray", l.strokeDasharray || "8,2"), t.line.setAttribute("stroke-linecap", l.strokeLinecap || "cap"), l.opacity !== void 0 && l.opacity !== null && l.opacity !== "" ? t.line.setAttribute("opacity", String(l.opacity)) : t.line.removeAttribute("opacity");
|
|
1023
|
+
const u = t.querySelectorAll('path[stroke="transparent"]');
|
|
1024
|
+
u.length > 0 && u[0].setAttribute("d", f);
|
|
1025
|
+
const g = _(i, r, c, a);
|
|
1026
|
+
if (g) {
|
|
1027
|
+
const x = `M ${g.x1} ${g.y1} L ${c} ${a} L ${g.x2} ${g.y2}`;
|
|
1028
|
+
t.arrow1.setAttribute("d", x), u.length > 1 && u[1].setAttribute("d", x), t.arrow1.setAttribute("stroke", l.stroke || "rgb(227, 125, 116)"), t.arrow1.setAttribute("stroke-width", String(l.strokeWidth || "2")), t.arrow1.setAttribute("stroke-linecap", l.strokeLinecap || "cap"), l.opacity !== void 0 && l.opacity !== null && l.opacity !== "" ? t.arrow1.setAttribute("opacity", String(l.opacity)) : t.arrow1.removeAttribute("opacity");
|
|
1024
1029
|
}
|
|
1025
|
-
if (
|
|
1026
|
-
const
|
|
1027
|
-
if (
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1030
|
-
const v = a.style;
|
|
1031
|
-
v.stroke && t.arrow2.setAttribute("stroke", v.stroke), v.strokeWidth && t.arrow2.setAttribute("stroke-width", String(v.strokeWidth)), v.strokeLinecap && t.arrow2.setAttribute("stroke-linecap", v.strokeLinecap), v.opacity !== void 0 && t.arrow2.setAttribute("opacity", String(v.opacity));
|
|
1032
|
-
}
|
|
1030
|
+
if (d.bidirectional) {
|
|
1031
|
+
const x = _(o, s, e, n);
|
|
1032
|
+
if (x) {
|
|
1033
|
+
const v = `M ${x.x1} ${x.y1} L ${e} ${n} L ${x.x2} ${x.y2}`;
|
|
1034
|
+
t.arrow2.setAttribute("d", v), u.length > 2 && u[2].setAttribute("d", v);
|
|
1033
1035
|
}
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1036
|
+
} else
|
|
1037
|
+
t.arrow2.setAttribute("d", ""), u.length > 2 && u[2].setAttribute("d", "");
|
|
1038
|
+
t.arrow2.setAttribute("stroke", l.stroke || "rgb(227, 125, 116)"), t.arrow2.setAttribute("stroke-width", String(l.strokeWidth || "2")), t.arrow2.setAttribute("stroke-linecap", l.strokeLinecap || "cap"), l.opacity !== void 0 && l.opacity !== null && l.opacity !== "" ? t.arrow2.setAttribute("opacity", String(l.opacity)) : t.arrow2.removeAttribute("opacity");
|
|
1039
|
+
const { x: y, y: p } = Nt(e, n, o, s, i, r, c, a);
|
|
1040
|
+
t.labelEl && Ke(t.labelEl, y, p);
|
|
1041
|
+
const b = t.labelEl;
|
|
1042
|
+
b && (b.style.color = l.labelColor || "rgb(235, 95, 82)"), on(t);
|
|
1041
1043
|
}
|
|
1042
|
-
function
|
|
1043
|
-
const { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2,
|
|
1044
|
+
function Y(t, e, n) {
|
|
1045
|
+
const { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, a = s + r / 2, d = c + n.x, f = a + n.y;
|
|
1044
1046
|
return {
|
|
1045
1047
|
w: i,
|
|
1046
1048
|
h: r,
|
|
1047
1049
|
cx: c,
|
|
1048
|
-
cy:
|
|
1049
|
-
ctrlX:
|
|
1050
|
+
cy: a,
|
|
1051
|
+
ctrlX: d,
|
|
1050
1052
|
ctrlY: f
|
|
1051
1053
|
};
|
|
1052
1054
|
}
|
|
1053
|
-
function
|
|
1055
|
+
function H(t) {
|
|
1054
1056
|
let e, n;
|
|
1055
1057
|
const o = (t.cy - t.ctrlY) / (t.ctrlX - t.cx);
|
|
1056
1058
|
return o > t.h / t.w || o < -t.h / t.w ? t.cy - t.ctrlY < 0 ? (e = t.cx - t.h / 2 / o, n = t.cy + t.h / 2) : (e = t.cx + t.h / 2 / o, n = t.cy - t.h / 2) : t.cx - t.ctrlX < 0 ? (e = t.cx + t.w / 2, n = t.cy - t.w * o / 2) : (e = t.cx - t.w / 2, n = t.cy + t.w * o / 2), {
|
|
@@ -1058,71 +1060,71 @@ function I(t) {
|
|
|
1058
1060
|
y: n
|
|
1059
1061
|
};
|
|
1060
1062
|
}
|
|
1061
|
-
const
|
|
1062
|
-
const o = P(t.nodes, e), s = P(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2,
|
|
1063
|
-
let
|
|
1064
|
-
if (
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1067
|
-
} else if (
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1070
|
-
} else if (y >
|
|
1071
|
-
const
|
|
1072
|
-
|
|
1063
|
+
const $t = function(t, e, n) {
|
|
1064
|
+
const o = P(t.nodes, e), s = P(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, a = s.offsetTop + n.offsetHeight / 2, d = c - i, f = a - r, l = Math.sqrt(d * d + f * f), u = Math.max(50, Math.min(200, l * 0.3)), g = Math.abs(d), y = Math.abs(f);
|
|
1065
|
+
let p, b;
|
|
1066
|
+
if (l < 150) {
|
|
1067
|
+
const v = e.closest("me-main").className === "lhs" ? -1 : 1;
|
|
1068
|
+
p = { x: 200 * v, y: 0 }, b = { x: 200 * v, y: 0 };
|
|
1069
|
+
} else if (g > y * 1.5) {
|
|
1070
|
+
const v = d > 0 ? e.offsetWidth / 2 : -e.offsetWidth / 2, C = d > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
1071
|
+
p = { x: v + (d > 0 ? u : -u), y: 0 }, b = { x: C + (d > 0 ? -u : u), y: 0 };
|
|
1072
|
+
} else if (y > g * 1.5) {
|
|
1073
|
+
const v = f > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, C = f > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
1074
|
+
p = { x: 0, y: v + (f > 0 ? u : -u) }, b = { x: 0, y: C + (f > 0 ? -u : u) };
|
|
1073
1075
|
} else {
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1076
|
+
const v = Math.atan2(f, d), C = e.offsetWidth / 2 * Math.cos(v), T = e.offsetHeight / 2 * Math.sin(v), h = -(n.offsetWidth / 2) * Math.cos(v), m = -(n.offsetHeight / 2) * Math.sin(v), w = u * 0.7 * (d > 0 ? 1 : -1), E = u * 0.7 * (f > 0 ? 1 : -1);
|
|
1077
|
+
p = { x: C + w, y: T + E }, b = { x: h - w, y: m - E };
|
|
1076
1078
|
}
|
|
1077
1079
|
return {
|
|
1078
|
-
delta1: { x: Math.round(
|
|
1079
|
-
delta2: { x: Math.round(
|
|
1080
|
+
delta1: { x: Math.round(p.x), y: Math.round(p.y) },
|
|
1081
|
+
delta2: { x: Math.round(b.x), y: Math.round(b.y) }
|
|
1080
1082
|
};
|
|
1081
|
-
},
|
|
1083
|
+
}, rt = function(t, e, n, o, s) {
|
|
1082
1084
|
if (!e || !n)
|
|
1083
1085
|
return;
|
|
1084
1086
|
if (!o.delta1 || !o.delta2) {
|
|
1085
|
-
const S =
|
|
1087
|
+
const S = $t(t, e, n);
|
|
1086
1088
|
o.delta1 = S.delta1, o.delta2 = S.delta2;
|
|
1087
1089
|
}
|
|
1088
|
-
const i =
|
|
1089
|
-
if (!
|
|
1090
|
-
const
|
|
1091
|
-
let
|
|
1090
|
+
const i = Y(t, e, o.delta1), r = Y(t, n, o.delta2), { x: c, y: a } = H(i), { ctrlX: d, ctrlY: f } = i, { ctrlX: l, ctrlY: u } = r, { x: g, y } = H(r), p = _(l, u, g, y);
|
|
1091
|
+
if (!p) return;
|
|
1092
|
+
const b = `M ${p.x1} ${p.y1} L ${g} ${y} L ${p.x2} ${p.y2}`;
|
|
1093
|
+
let x = "";
|
|
1092
1094
|
if (o.bidirectional) {
|
|
1093
|
-
const S = _(
|
|
1095
|
+
const S = _(d, f, c, a);
|
|
1094
1096
|
if (!S) return;
|
|
1095
|
-
|
|
1097
|
+
x = `M ${S.x1} ${S.y1} L ${c} ${a} L ${S.x2} ${S.y2}`;
|
|
1096
1098
|
}
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
const
|
|
1099
|
+
const v = He(`M ${c} ${a} C ${d} ${f} ${l} ${u} ${g} ${y}`, b, x, o.style), { x: C, y: T } = Nt(c, a, d, f, l, u, g, y), h = o.style?.labelColor || "rgb(235, 95, 82)", m = "a-" + o.id;
|
|
1100
|
+
v.id = m;
|
|
1101
|
+
const w = t.markdown ? t.markdown(o.label, o) : o.label, E = Q(w, C, T, {
|
|
1100
1102
|
anchor: "middle",
|
|
1101
1103
|
color: h,
|
|
1102
1104
|
dataType: "arrow",
|
|
1103
1105
|
svgId: m
|
|
1104
1106
|
});
|
|
1105
|
-
|
|
1106
|
-
},
|
|
1107
|
+
v.labelEl = E, v.arrowObj = o, v.dataset.linkid = o.id, t.labelContainer.appendChild(E), t.arrowSvg.appendChild(v), U(E), s || (t.arrows.push(o), t.currentArrow = v, It(t, o, i, r));
|
|
1108
|
+
}, Je = function(t, e, n = {}) {
|
|
1107
1109
|
const o = {
|
|
1108
|
-
id:
|
|
1110
|
+
id: X(),
|
|
1109
1111
|
label: "Custom Link",
|
|
1110
1112
|
from: t.nodeObj.id,
|
|
1111
1113
|
to: e.nodeObj.id,
|
|
1112
1114
|
...n
|
|
1113
1115
|
};
|
|
1114
|
-
|
|
1116
|
+
rt(this, t, e, o), this.bus.fire("operation", {
|
|
1115
1117
|
name: "createArrow",
|
|
1116
1118
|
obj: o
|
|
1117
1119
|
});
|
|
1118
|
-
},
|
|
1120
|
+
}, Ze = function(t) {
|
|
1119
1121
|
K(this);
|
|
1120
|
-
const e = { ...t, id:
|
|
1121
|
-
|
|
1122
|
+
const e = { ...t, id: X() };
|
|
1123
|
+
rt(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
|
|
1122
1124
|
name: "createArrow",
|
|
1123
1125
|
obj: e
|
|
1124
1126
|
});
|
|
1125
|
-
},
|
|
1127
|
+
}, Qe = function(t) {
|
|
1126
1128
|
let e;
|
|
1127
1129
|
if (t ? e = t : e = this.currentArrow, !e) return;
|
|
1128
1130
|
K(this);
|
|
@@ -1133,11 +1135,11 @@ const Ue = function(t, e, n) {
|
|
|
1133
1135
|
id: n
|
|
1134
1136
|
}
|
|
1135
1137
|
});
|
|
1136
|
-
},
|
|
1138
|
+
}, tn = function(t) {
|
|
1137
1139
|
this.currentArrow = t;
|
|
1138
|
-
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s =
|
|
1139
|
-
this.editable ?
|
|
1140
|
-
},
|
|
1140
|
+
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = Y(this, n, e.delta1), i = Y(this, o, e.delta2);
|
|
1141
|
+
this.editable ? It(this, e, s, i) : Ht(t, At), this.bus.fire("selectArrow", e);
|
|
1142
|
+
}, en = function() {
|
|
1141
1143
|
K(this), this.currentArrow = null, this.bus.fire("unselectArrow");
|
|
1142
1144
|
}, Z = function(t, e) {
|
|
1143
1145
|
const n = document.createElementNS(k, "path");
|
|
@@ -1149,7 +1151,7 @@ const Ue = function(t, e, n) {
|
|
|
1149
1151
|
"stroke-linecap": "round",
|
|
1150
1152
|
"stroke-linejoin": "round"
|
|
1151
1153
|
}), n;
|
|
1152
|
-
},
|
|
1154
|
+
}, Ht = function(t, e) {
|
|
1153
1155
|
const n = document.createElementNS(k, "g");
|
|
1154
1156
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
1155
1157
|
const o = Z(t.line.getAttribute("d"), e);
|
|
@@ -1160,96 +1162,121 @@ const Ue = function(t, e, n) {
|
|
|
1160
1162
|
n.appendChild(i);
|
|
1161
1163
|
}
|
|
1162
1164
|
t.insertBefore(n, t.firstChild);
|
|
1163
|
-
},
|
|
1165
|
+
}, nn = function(t) {
|
|
1164
1166
|
const e = t.querySelector(".arrow-highlight");
|
|
1165
1167
|
e && e.remove();
|
|
1166
|
-
},
|
|
1168
|
+
}, on = function(t) {
|
|
1167
1169
|
const e = t.querySelector(".arrow-highlight");
|
|
1168
1170
|
if (!e) return;
|
|
1169
1171
|
const n = e.querySelectorAll("path");
|
|
1170
1172
|
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"));
|
|
1171
1173
|
}, K = function(t) {
|
|
1172
|
-
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow &&
|
|
1173
|
-
},
|
|
1174
|
-
const { linkController: s, P2: i, P3: r, line1: c, line2:
|
|
1175
|
-
if (!
|
|
1176
|
-
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial",
|
|
1177
|
-
let { x:
|
|
1178
|
-
i.style.cssText = `top:${
|
|
1179
|
-
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1174
|
+
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && nn(t.currentArrow);
|
|
1175
|
+
}, It = function(t, e, n, o) {
|
|
1176
|
+
const { linkController: s, P2: i, P3: r, line1: c, line2: a, nodes: d, map: f, currentArrow: l, bus: u } = t;
|
|
1177
|
+
if (!l) return;
|
|
1178
|
+
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", d.appendChild(s), d.appendChild(i), d.appendChild(r), Ht(l, At);
|
|
1179
|
+
let { x: g, y } = H(n), { ctrlX: p, ctrlY: b } = n, { ctrlX: x, ctrlY: v } = o, { x: C, y: T } = H(o);
|
|
1180
|
+
i.style.cssText = `top:${b}px;left:${p}px;`, r.style.cssText = `top:${v}px;left:${x}px;`, O(c, g, y, p, b), O(a, x, v, C, T), t.helper1 = mt.create(i), t.helper2 = mt.create(r), t.helper1.init(f, (h, m) => {
|
|
1181
|
+
p = p + h / t.scaleVal, b = b + m / t.scaleVal;
|
|
1182
|
+
const w = H({ ...n, ctrlX: p, ctrlY: b });
|
|
1183
|
+
g = w.x, y = w.y, i.style.top = b + "px", i.style.left = p + "px", tt(l, g, y, p, b, x, v, C, T, e), O(c, g, y, p, b), e.delta1.x = Math.round(p - n.cx), e.delta1.y = Math.round(b - n.cy), u.fire("updateArrowDelta", e);
|
|
1182
1184
|
}), t.helper2.init(f, (h, m) => {
|
|
1183
|
-
|
|
1184
|
-
const
|
|
1185
|
-
C =
|
|
1185
|
+
x = x + h / t.scaleVal, v = v + m / t.scaleVal;
|
|
1186
|
+
const w = H({ ...o, ctrlX: x, ctrlY: v });
|
|
1187
|
+
C = w.x, T = w.y, r.style.top = v + "px", r.style.left = x + "px", tt(l, g, y, p, b, x, v, C, T, e), O(a, x, v, C, T), e.delta2.x = Math.round(x - o.cx), e.delta2.y = Math.round(v - o.cy), u.fire("updateArrowDelta", e);
|
|
1186
1188
|
});
|
|
1187
1189
|
};
|
|
1188
|
-
function
|
|
1190
|
+
function sn() {
|
|
1189
1191
|
this.arrowSvg.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((e) => e.remove());
|
|
1190
1192
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
1191
1193
|
const n = this.arrows[e];
|
|
1192
1194
|
try {
|
|
1193
|
-
|
|
1195
|
+
rt(this, this.findEle(n.from), this.findEle(n.to), n, !0);
|
|
1194
1196
|
} catch {
|
|
1195
1197
|
}
|
|
1196
1198
|
}
|
|
1197
1199
|
this.nodes.appendChild(this.arrowSvg);
|
|
1198
1200
|
}
|
|
1199
|
-
function
|
|
1201
|
+
function rn(t) {
|
|
1200
1202
|
K(this), t && t.labelEl && Lt(this, t.labelEl, t.arrowObj);
|
|
1201
1203
|
}
|
|
1202
|
-
function
|
|
1203
|
-
this.arrows = this.arrows.filter((t) =>
|
|
1204
|
+
function cn() {
|
|
1205
|
+
this.arrows = this.arrows.filter((t) => j(t.from, this.nodeData) && j(t.to, this.nodeData));
|
|
1204
1206
|
}
|
|
1205
|
-
const
|
|
1207
|
+
const ln = function(t, e) {
|
|
1208
|
+
const n = Yt(t);
|
|
1209
|
+
n.style && e.style && (e.style = Object.assign({}, n.style, e.style)), Object.assign(t, e);
|
|
1210
|
+
const o = this.arrowSvg.querySelector(`g[data-linkid="${t.id}"]`);
|
|
1211
|
+
if (o) {
|
|
1212
|
+
if (e.label !== void 0 && o.labelEl) {
|
|
1213
|
+
const r = this.markdown ? this.markdown(t.label, t) : t.label;
|
|
1214
|
+
o.labelEl.innerHTML = r;
|
|
1215
|
+
}
|
|
1216
|
+
const s = this.findEle(t.from), i = this.findEle(t.to);
|
|
1217
|
+
if (s && i) {
|
|
1218
|
+
if (!t.delta1 || !t.delta2) {
|
|
1219
|
+
const b = $t(this, s, i);
|
|
1220
|
+
t.delta1 = t.delta1 || b.delta1, t.delta2 = t.delta2 || b.delta2;
|
|
1221
|
+
}
|
|
1222
|
+
const r = Y(this, s, t.delta1), c = Y(this, i, t.delta2), { x: a, y: d } = H(r), { ctrlX: f, ctrlY: l } = r, { ctrlX: u, ctrlY: g } = c, { x: y, y: p } = H(c);
|
|
1223
|
+
tt(o, a, d, f, l, u, g, y, p, t), this.currentArrow?.arrowObj?.id === t.id && (this.P2.style.cssText = `top:${l}px;left:${f}px;`, this.P3.style.cssText = `top:${g}px;left:${u}px;`, O(this.line1, a, d, f, l), O(this.line2, u, g, y, p));
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
this.bus.fire("operation", {
|
|
1227
|
+
name: "reshapeArrow",
|
|
1228
|
+
obj: t,
|
|
1229
|
+
origin: n
|
|
1230
|
+
});
|
|
1231
|
+
}, an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1206
1232
|
__proto__: null,
|
|
1207
|
-
createArrow:
|
|
1208
|
-
createArrowFrom:
|
|
1209
|
-
editArrowLabel:
|
|
1210
|
-
removeArrow:
|
|
1211
|
-
renderArrow:
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1233
|
+
createArrow: Je,
|
|
1234
|
+
createArrowFrom: Ze,
|
|
1235
|
+
editArrowLabel: rn,
|
|
1236
|
+
removeArrow: Qe,
|
|
1237
|
+
renderArrow: sn,
|
|
1238
|
+
reshapeArrow: ln,
|
|
1239
|
+
selectArrow: tn,
|
|
1240
|
+
tidyArrow: cn,
|
|
1241
|
+
unselectArrow: en
|
|
1242
|
+
}, Symbol.toStringTag, { value: "Module" })), hn = function(t) {
|
|
1216
1243
|
if (t.length === 0) throw new Error("No selected node.");
|
|
1217
1244
|
if (t.length === 1) {
|
|
1218
|
-
const
|
|
1219
|
-
if (!
|
|
1220
|
-
const f =
|
|
1245
|
+
const a = t[0].nodeObj, d = t[0].nodeObj.parent;
|
|
1246
|
+
if (!d) throw new Error("Can not select root node.");
|
|
1247
|
+
const f = d.children.findIndex((l) => a === l);
|
|
1221
1248
|
return {
|
|
1222
|
-
parent:
|
|
1249
|
+
parent: d.id,
|
|
1223
1250
|
start: f,
|
|
1224
1251
|
end: f
|
|
1225
1252
|
};
|
|
1226
1253
|
}
|
|
1227
1254
|
let e = 0;
|
|
1228
|
-
const n = t.map((
|
|
1229
|
-
let
|
|
1255
|
+
const n = t.map((a) => {
|
|
1256
|
+
let d = a.nodeObj;
|
|
1230
1257
|
const f = [];
|
|
1231
|
-
for (;
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1258
|
+
for (; d.parent; ) {
|
|
1259
|
+
const l = d.parent, g = l.children?.indexOf(d);
|
|
1260
|
+
d = l, f.unshift({ node: d, index: g });
|
|
1234
1261
|
}
|
|
1235
1262
|
return f.length > e && (e = f.length), f;
|
|
1236
1263
|
});
|
|
1237
1264
|
let o = 0;
|
|
1238
1265
|
t: for (; o < e; o++) {
|
|
1239
|
-
const
|
|
1240
|
-
for (let
|
|
1241
|
-
if (n[
|
|
1266
|
+
const a = n[0][o]?.node;
|
|
1267
|
+
for (let d = 1; d < n.length; d++)
|
|
1268
|
+
if (n[d][o]?.node !== a)
|
|
1242
1269
|
break t;
|
|
1243
1270
|
}
|
|
1244
1271
|
if (!o) throw new Error("Can not select root node.");
|
|
1245
|
-
const s = n.map((
|
|
1272
|
+
const s = n.map((a) => a[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, c = n[0][o - 1].node;
|
|
1246
1273
|
if (!c.parent) throw new Error("Please select nodes in the same main topic.");
|
|
1247
1274
|
return {
|
|
1248
1275
|
parent: c.id,
|
|
1249
1276
|
start: i,
|
|
1250
1277
|
end: r
|
|
1251
1278
|
};
|
|
1252
|
-
},
|
|
1279
|
+
}, dn = function(t) {
|
|
1253
1280
|
const e = document.createElementNS(k, "g");
|
|
1254
1281
|
return e.setAttribute("id", t), e;
|
|
1255
1282
|
}, yt = function(t, e) {
|
|
@@ -1261,69 +1288,69 @@ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1261
1288
|
"stroke-linecap": "round",
|
|
1262
1289
|
"stroke-width": "2"
|
|
1263
1290
|
}), n;
|
|
1264
|
-
},
|
|
1291
|
+
}, fn = (t) => t.parentElement.parentElement, un = function(t, { parent: e, start: n }) {
|
|
1265
1292
|
const o = t.findEle(e), s = o.nodeObj;
|
|
1266
1293
|
let i;
|
|
1267
1294
|
return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
|
|
1268
|
-
},
|
|
1269
|
-
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes:
|
|
1270
|
-
let y = 1 / 0,
|
|
1271
|
-
for (let
|
|
1272
|
-
const
|
|
1273
|
-
if (!
|
|
1295
|
+
}, ct = function(t, e) {
|
|
1296
|
+
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: a, theme: d, summarySvg: f } = t, u = t.findEle(s).nodeObj, g = un(t, e);
|
|
1297
|
+
let y = 1 / 0, p = 0, b = 0, x = 0;
|
|
1298
|
+
for (let W = i; W <= r; W++) {
|
|
1299
|
+
const lt = u.children?.[W];
|
|
1300
|
+
if (!lt)
|
|
1274
1301
|
return t.removeSummary(n), null;
|
|
1275
|
-
const
|
|
1276
|
-
|
|
1302
|
+
const V = fn(t.findEle(lt.id)), { offsetLeft: z, offsetTop: at } = P(a, V), ht = i === r ? 10 : 20;
|
|
1303
|
+
W === i && (b = at + ht), W === r && (x = at + V.offsetHeight - ht), z < y && (y = z), V.offsetWidth + z > p && (p = V.offsetWidth + z);
|
|
1277
1304
|
}
|
|
1278
|
-
let
|
|
1279
|
-
const T =
|
|
1280
|
-
|
|
1281
|
-
const $ =
|
|
1282
|
-
return $.appendChild(
|
|
1283
|
-
},
|
|
1305
|
+
let v, C;
|
|
1306
|
+
const T = u.parent ? 10 : 0, h = b + T, m = x + T, w = (h + m) / 2, E = c?.stroke || d.cssVar["--color"], S = c?.labelColor || d.cssVar["--color"], M = "s-" + n, A = t.markdown ? t.markdown(o, e) : o;
|
|
1307
|
+
g === B.LHS ? (v = yt(`M ${y + 10} ${h} c -5 0 -10 5 -10 10 L ${y} ${m - 10} c 0 5 5 10 10 10 M ${y} ${w} h -10`, E), C = Q(A, y - 20, w, { anchor: "end", color: S, dataType: "summary", svgId: M })) : (v = yt(`M ${p - 10} ${h} c 5 0 10 5 10 10 L ${p} ${m - 10} c 0 5 -5 10 -10 10 M ${p} ${w} h 10`, E), C = Q(A, p + 20, w, { anchor: "start", color: S, dataType: "summary", svgId: M }));
|
|
1308
|
+
const $ = dn(M);
|
|
1309
|
+
return $.appendChild(v), t.labelContainer.appendChild(C), U(C), $.summaryObj = e, $.labelEl = C, f.appendChild($), $;
|
|
1310
|
+
}, pn = function(t = {}) {
|
|
1284
1311
|
if (!this.currentNodes) return;
|
|
1285
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } =
|
|
1286
|
-
n.push(c), this.editSummary(
|
|
1312
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = hn(e), c = { id: X(), parent: s, start: i, end: r, label: "summary", style: t.style }, a = ct(this, c);
|
|
1313
|
+
n.push(c), this.editSummary(a), o.fire("operation", {
|
|
1287
1314
|
name: "createSummary",
|
|
1288
1315
|
obj: c
|
|
1289
1316
|
});
|
|
1290
|
-
},
|
|
1291
|
-
const e =
|
|
1292
|
-
|
|
1317
|
+
}, gn = function(t) {
|
|
1318
|
+
const e = X(), n = { ...t, id: e };
|
|
1319
|
+
ct(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
1293
1320
|
name: "createSummary",
|
|
1294
1321
|
obj: n
|
|
1295
1322
|
});
|
|
1296
|
-
},
|
|
1323
|
+
}, mn = function(t) {
|
|
1297
1324
|
const e = this.summaries.findIndex((n) => n.id === t);
|
|
1298
1325
|
e > -1 && (this.summaries.splice(e, 1), this.nodes.querySelector("#s-" + t)?.remove(), this.nodes.querySelector("#label-s-" + t)?.remove()), this.bus.fire("operation", {
|
|
1299
1326
|
name: "removeSummary",
|
|
1300
1327
|
obj: { id: t }
|
|
1301
1328
|
});
|
|
1302
|
-
},
|
|
1329
|
+
}, yn = function(t) {
|
|
1303
1330
|
const e = t.labelEl;
|
|
1304
1331
|
e && e.classList.add("selected"), this.currentSummary = t, this.bus.fire("selectSummary", t.summaryObj);
|
|
1305
|
-
},
|
|
1332
|
+
}, bn = function() {
|
|
1306
1333
|
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
1307
|
-
},
|
|
1334
|
+
}, vn = function() {
|
|
1308
1335
|
this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
|
|
1309
1336
|
try {
|
|
1310
|
-
|
|
1337
|
+
ct(this, t);
|
|
1311
1338
|
} catch {
|
|
1312
1339
|
}
|
|
1313
1340
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1314
|
-
},
|
|
1341
|
+
}, xn = function(t) {
|
|
1315
1342
|
t && t.labelEl && Lt(this, t.labelEl, t.summaryObj);
|
|
1316
|
-
},
|
|
1343
|
+
}, wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1317
1344
|
__proto__: null,
|
|
1318
|
-
createSummary:
|
|
1319
|
-
createSummaryFrom:
|
|
1320
|
-
editSummary:
|
|
1321
|
-
removeSummary:
|
|
1322
|
-
renderSummary:
|
|
1323
|
-
selectSummary:
|
|
1324
|
-
unselectSummary:
|
|
1345
|
+
createSummary: pn,
|
|
1346
|
+
createSummaryFrom: gn,
|
|
1347
|
+
editSummary: xn,
|
|
1348
|
+
removeSummary: mn,
|
|
1349
|
+
renderSummary: vn,
|
|
1350
|
+
selectSummary: yn,
|
|
1351
|
+
unselectSummary: bn
|
|
1325
1352
|
}, Symbol.toStringTag, { value: "Module" })), L = "http://www.w3.org/2000/svg";
|
|
1326
|
-
function
|
|
1353
|
+
function Cn(t, e) {
|
|
1327
1354
|
const n = document.createElementNS(L, "svg");
|
|
1328
1355
|
return D(n, {
|
|
1329
1356
|
version: "1.1",
|
|
@@ -1332,27 +1359,27 @@ function vn(t, e) {
|
|
|
1332
1359
|
width: e
|
|
1333
1360
|
}), n;
|
|
1334
1361
|
}
|
|
1335
|
-
function
|
|
1362
|
+
function Sn(t, e) {
|
|
1336
1363
|
return (parseInt(t) - parseInt(e)) / 2;
|
|
1337
1364
|
}
|
|
1338
|
-
function
|
|
1365
|
+
function En(t, e, n, o) {
|
|
1339
1366
|
const s = document.createElementNS(L, "g");
|
|
1340
1367
|
let i = "";
|
|
1341
1368
|
return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
|
|
1342
|
-
`).forEach((c,
|
|
1343
|
-
const
|
|
1344
|
-
D(
|
|
1369
|
+
`).forEach((c, a) => {
|
|
1370
|
+
const d = document.createElementNS(L, "text");
|
|
1371
|
+
D(d, {
|
|
1345
1372
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1346
|
-
y: o + parseInt(e.paddingTop) +
|
|
1373
|
+
y: o + parseInt(e.paddingTop) + Sn(e.lineHeight, e.fontSize) * (a + 1) + parseFloat(e.fontSize) * (a + 1) + "",
|
|
1347
1374
|
"text-anchor": "start",
|
|
1348
1375
|
"font-family": e.fontFamily,
|
|
1349
1376
|
"font-size": `${e.fontSize}`,
|
|
1350
1377
|
"font-weight": `${e.fontWeight}`,
|
|
1351
1378
|
fill: `${e.color}`
|
|
1352
|
-
}),
|
|
1379
|
+
}), d.innerHTML = c, s.appendChild(d);
|
|
1353
1380
|
}), s;
|
|
1354
1381
|
}
|
|
1355
|
-
function
|
|
1382
|
+
function Tn(t, e, n, o) {
|
|
1356
1383
|
let s = "";
|
|
1357
1384
|
t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
|
|
1358
1385
|
const i = document.createElementNS(L, "foreignObject");
|
|
@@ -1368,7 +1395,7 @@ function Sn(t, e, n, o) {
|
|
|
1368
1395
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1369
1396
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1370
1397
|
}
|
|
1371
|
-
function
|
|
1398
|
+
function Dn(t, e) {
|
|
1372
1399
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = document.createElementNS(L, "rect");
|
|
1373
1400
|
return D(i, {
|
|
1374
1401
|
x: o + "",
|
|
@@ -1382,7 +1409,7 @@ function En(t, e) {
|
|
|
1382
1409
|
"stroke-width": n.borderWidth
|
|
1383
1410
|
}), i;
|
|
1384
1411
|
}
|
|
1385
|
-
function
|
|
1412
|
+
function F(t, e, n = !1) {
|
|
1386
1413
|
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = P(t.nodes, e), r = document.createElementNS(L, "rect");
|
|
1387
1414
|
D(r, {
|
|
1388
1415
|
x: s + "",
|
|
@@ -1397,10 +1424,10 @@ function z(t, e, n = !1) {
|
|
|
1397
1424
|
});
|
|
1398
1425
|
const c = document.createElementNS(L, "g");
|
|
1399
1426
|
c.appendChild(r);
|
|
1400
|
-
let
|
|
1401
|
-
return n ?
|
|
1427
|
+
let a;
|
|
1428
|
+
return n ? a = Tn(e, o, s, i) : a = En(e, o, s, i), c.appendChild(a), c;
|
|
1402
1429
|
}
|
|
1403
|
-
function
|
|
1430
|
+
function Ln(t, e) {
|
|
1404
1431
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = document.createElementNS(L, "a"), r = document.createElementNS(L, "text");
|
|
1405
1432
|
return D(r, {
|
|
1406
1433
|
x: o + "",
|
|
@@ -1412,7 +1439,7 @@ function Tn(t, e) {
|
|
|
1412
1439
|
fill: `${n.color}`
|
|
1413
1440
|
}), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
|
|
1414
1441
|
}
|
|
1415
|
-
function
|
|
1442
|
+
function Mn(t, e) {
|
|
1416
1443
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = document.createElementNS(L, "image");
|
|
1417
1444
|
return D(i, {
|
|
1418
1445
|
x: o + "",
|
|
@@ -1422,40 +1449,40 @@ function Dn(t, e) {
|
|
|
1422
1449
|
href: e.src
|
|
1423
1450
|
}), i;
|
|
1424
1451
|
}
|
|
1425
|
-
const
|
|
1426
|
-
const n = t.nodes, o = n.offsetHeight +
|
|
1452
|
+
const G = 100, Pn = '<?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">', kn = (t, e = !1) => {
|
|
1453
|
+
const n = t.nodes, o = n.offsetHeight + G * 2, s = n.offsetWidth + G * 2, i = Cn(o + "px", s + "px"), r = document.createElementNS(L, "svg"), c = document.createElementNS(L, "rect");
|
|
1427
1454
|
D(c, {
|
|
1428
1455
|
x: "0",
|
|
1429
1456
|
y: "0",
|
|
1430
1457
|
width: `${s}`,
|
|
1431
1458
|
height: `${o}`,
|
|
1432
1459
|
fill: t.theme.cssVar["--bgcolor"]
|
|
1433
|
-
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1460
|
+
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((l) => {
|
|
1461
|
+
const u = l.cloneNode(!0), { offsetLeft: g, offsetTop: y } = P(n, l.parentElement);
|
|
1462
|
+
u.setAttribute("x", `${g}`), u.setAttribute("y", `${y}`), r.appendChild(u);
|
|
1436
1463
|
});
|
|
1437
|
-
const
|
|
1438
|
-
l && r.appendChild(l);
|
|
1439
|
-
const a = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
1464
|
+
const a = n.querySelector(".lines")?.cloneNode(!0);
|
|
1440
1465
|
a && r.appendChild(a);
|
|
1466
|
+
const d = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
1467
|
+
d && r.appendChild(d);
|
|
1441
1468
|
const f = n.querySelector(".summary")?.cloneNode(!0);
|
|
1442
|
-
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((
|
|
1443
|
-
|
|
1444
|
-
}), n.querySelectorAll(".tags > span").forEach((
|
|
1445
|
-
r.appendChild(
|
|
1446
|
-
}), n.querySelectorAll(".icons > span").forEach((
|
|
1447
|
-
r.appendChild(
|
|
1448
|
-
}), n.querySelectorAll(".hyper-link").forEach((
|
|
1449
|
-
r.appendChild(
|
|
1450
|
-
}), n.querySelectorAll("img").forEach((
|
|
1451
|
-
r.appendChild(
|
|
1469
|
+
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((l) => {
|
|
1470
|
+
l.nodeObj.dangerouslySetInnerHTML ? r.appendChild(F(t, l, !e)) : (r.appendChild(Dn(t, l)), r.appendChild(F(t, l.text, !e)));
|
|
1471
|
+
}), n.querySelectorAll(".tags > span").forEach((l) => {
|
|
1472
|
+
r.appendChild(F(t, l));
|
|
1473
|
+
}), n.querySelectorAll(".icons > span").forEach((l) => {
|
|
1474
|
+
r.appendChild(F(t, l));
|
|
1475
|
+
}), n.querySelectorAll(".hyper-link").forEach((l) => {
|
|
1476
|
+
r.appendChild(Ln(t, l));
|
|
1477
|
+
}), n.querySelectorAll("img").forEach((l) => {
|
|
1478
|
+
r.appendChild(Mn(t, l));
|
|
1452
1479
|
}), D(r, {
|
|
1453
|
-
x:
|
|
1454
|
-
y:
|
|
1480
|
+
x: G + "",
|
|
1481
|
+
y: G + "",
|
|
1455
1482
|
overflow: "visible"
|
|
1456
1483
|
}), i.appendChild(r), i;
|
|
1457
|
-
},
|
|
1458
|
-
function
|
|
1484
|
+
}, An = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), Pn + t.outerHTML);
|
|
1485
|
+
function Nn(t) {
|
|
1459
1486
|
return new Promise((e, n) => {
|
|
1460
1487
|
const o = new FileReader();
|
|
1461
1488
|
o.onload = (s) => {
|
|
@@ -1465,11 +1492,11 @@ function kn(t) {
|
|
|
1465
1492
|
}, o.readAsDataURL(t);
|
|
1466
1493
|
});
|
|
1467
1494
|
}
|
|
1468
|
-
const
|
|
1469
|
-
const n =
|
|
1495
|
+
const $n = function(t = !1, e) {
|
|
1496
|
+
const n = kn(this, t), o = An(n, e);
|
|
1470
1497
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1471
|
-
},
|
|
1472
|
-
const n = this.exportSvg(t, e), o = await
|
|
1498
|
+
}, Hn = async function(t = !1, e) {
|
|
1499
|
+
const n = this.exportSvg(t, e), o = await Nn(n);
|
|
1473
1500
|
return new Promise((s, i) => {
|
|
1474
1501
|
const r = new Image();
|
|
1475
1502
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -1477,31 +1504,31 @@ const Nn = function(t = !1, e) {
|
|
|
1477
1504
|
c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(s, "image/png", 1);
|
|
1478
1505
|
}, r.src = o, r.onerror = i;
|
|
1479
1506
|
});
|
|
1480
|
-
},
|
|
1507
|
+
}, In = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1481
1508
|
__proto__: null,
|
|
1482
|
-
exportPng:
|
|
1483
|
-
exportSvg:
|
|
1484
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1485
|
-
getObjById:
|
|
1486
|
-
generateNewObj:
|
|
1487
|
-
layout:
|
|
1488
|
-
linkDiv:
|
|
1489
|
-
editTopic:
|
|
1490
|
-
createWrapper:
|
|
1491
|
-
createParent:
|
|
1492
|
-
createChildren:
|
|
1493
|
-
createTopic:
|
|
1509
|
+
exportPng: Hn,
|
|
1510
|
+
exportSvg: $n
|
|
1511
|
+
}, Symbol.toStringTag, { value: "Module" })), On = {}, Bn = {
|
|
1512
|
+
getObjById: j,
|
|
1513
|
+
generateNewObj: Bt,
|
|
1514
|
+
layout: jt,
|
|
1515
|
+
linkDiv: Ie,
|
|
1516
|
+
editTopic: Qt,
|
|
1517
|
+
createWrapper: Ut,
|
|
1518
|
+
createParent: Kt,
|
|
1519
|
+
createChildren: Jt,
|
|
1520
|
+
createTopic: Zt,
|
|
1494
1521
|
findEle: Ct,
|
|
1495
|
-
changeTheme:
|
|
1496
|
-
changeCompact:
|
|
1497
|
-
...
|
|
1498
|
-
...
|
|
1499
|
-
...
|
|
1500
|
-
...
|
|
1501
|
-
|
|
1522
|
+
changeTheme: _e,
|
|
1523
|
+
changeCompact: qe,
|
|
1524
|
+
...Te,
|
|
1525
|
+
...On,
|
|
1526
|
+
...an,
|
|
1527
|
+
...wn,
|
|
1528
|
+
...In,
|
|
1502
1529
|
init(t) {
|
|
1503
1530
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
|
|
1504
|
-
t.direction !== void 0 && (this.direction = t.direction), t.compact !== void 0 && (this.compact = t.compact), this.changeTheme(t.theme || this.theme, !1), t.meta && (this.meta = t.meta), this.nodeData = t.nodeData,
|
|
1531
|
+
t.direction !== void 0 && (this.direction = t.direction), t.compact !== void 0 && (this.compact = t.compact), this.changeTheme(t.theme || this.theme, !1), t.meta && (this.meta = t.meta), this.nodeData = t.nodeData, ot(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && je(this), this.layout(), this.linkDiv(), this.toCenter();
|
|
1505
1532
|
},
|
|
1506
1533
|
destroy() {
|
|
1507
1534
|
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.arrowSvg = 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;
|
|
@@ -1513,8 +1540,8 @@ const Nn = function(t = !1, e) {
|
|
|
1513
1540
|
enableMobileMultiSelect(t) {
|
|
1514
1541
|
this.mobileMultiSelect = t;
|
|
1515
1542
|
}
|
|
1516
|
-
},
|
|
1517
|
-
function
|
|
1543
|
+
}, Yn = "5.14.0-beta.1";
|
|
1544
|
+
function Wn(t) {
|
|
1518
1545
|
return {
|
|
1519
1546
|
x: 0,
|
|
1520
1547
|
y: 0,
|
|
@@ -1541,7 +1568,7 @@ function Bn(t) {
|
|
|
1541
1568
|
}
|
|
1542
1569
|
};
|
|
1543
1570
|
}
|
|
1544
|
-
function
|
|
1571
|
+
function N({
|
|
1545
1572
|
el: t,
|
|
1546
1573
|
direction: e,
|
|
1547
1574
|
editable: n,
|
|
@@ -1550,52 +1577,52 @@ function A({
|
|
|
1550
1577
|
keypress: i,
|
|
1551
1578
|
mouseSelectionButton: r,
|
|
1552
1579
|
selectionContainer: c,
|
|
1553
|
-
before:
|
|
1554
|
-
newTopicName:
|
|
1580
|
+
before: a,
|
|
1581
|
+
newTopicName: d,
|
|
1555
1582
|
allowUndo: f,
|
|
1556
|
-
generateMainBranch:
|
|
1557
|
-
generateSubBranch:
|
|
1558
|
-
overflowHidden:
|
|
1583
|
+
generateMainBranch: l,
|
|
1584
|
+
generateSubBranch: u,
|
|
1585
|
+
overflowHidden: g,
|
|
1559
1586
|
compact: y,
|
|
1560
|
-
theme:
|
|
1561
|
-
alignment:
|
|
1562
|
-
scaleSensitivity:
|
|
1563
|
-
scaleMax:
|
|
1587
|
+
theme: p,
|
|
1588
|
+
alignment: b,
|
|
1589
|
+
scaleSensitivity: x,
|
|
1590
|
+
scaleMax: v,
|
|
1564
1591
|
scaleMin: C,
|
|
1565
1592
|
handleWheel: T,
|
|
1566
1593
|
markdown: h,
|
|
1567
1594
|
imageProxy: m,
|
|
1568
|
-
pasteHandler:
|
|
1595
|
+
pasteHandler: w,
|
|
1569
1596
|
mobileMultiSelect: E
|
|
1570
1597
|
}) {
|
|
1571
1598
|
let S = null;
|
|
1572
1599
|
const M = Object.prototype.toString.call(t);
|
|
1573
1600
|
if (M === "[object HTMLDivElement]" ? S = t : M === "[object String]" && (S = document.querySelector(t)), !S) throw new Error("MindElixir: el is not a valid element");
|
|
1574
|
-
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before =
|
|
1575
|
-
const
|
|
1576
|
-
this.theme =
|
|
1601
|
+
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = a || {}, this.newTopicName = d || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity = x ?? 0.1, this.scaleMax = v ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = l || Pt, this.generateSubBranch = u || kt, this.overflowHidden = g ?? !1, this.compact = y ?? !1, this.alignment = b ?? "root", this.handleWheel = T ?? !0, this.markdown = h || void 0, this.imageProxy = m || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = E ?? !1, this.panHelper = Wn(this), this.bus = $e(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
1602
|
+
const A = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1603
|
+
this.theme = p || (A.matches ? nt : et);
|
|
1577
1604
|
const $ = document.createElement("div");
|
|
1578
|
-
$.className = "map-canvas", this.map = $, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines =
|
|
1605
|
+
$.className = "map-canvas", this.map = $, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = R("lines"), this.summarySvg = R("summary"), this.linkController = R("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = gt(), this.line2 = gt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = R("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Ne(this)), w && (this.pasteHandler = w);
|
|
1579
1606
|
}
|
|
1580
|
-
|
|
1581
|
-
Object.defineProperty(
|
|
1607
|
+
N.prototype = Bn;
|
|
1608
|
+
Object.defineProperty(N.prototype, "currentNode", {
|
|
1582
1609
|
get() {
|
|
1583
1610
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
1584
1611
|
},
|
|
1585
1612
|
enumerable: !0
|
|
1586
1613
|
});
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1614
|
+
N.LEFT = 0;
|
|
1615
|
+
N.RIGHT = 1;
|
|
1616
|
+
N.SIDE = 2;
|
|
1617
|
+
N.THEME = et;
|
|
1618
|
+
N.DARK_THEME = nt;
|
|
1619
|
+
N.version = Yn;
|
|
1620
|
+
N.E = Ct;
|
|
1594
1621
|
export {
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1622
|
+
nt as DARK_THEME,
|
|
1623
|
+
Rn as LEFT,
|
|
1624
|
+
Xn as RIGHT,
|
|
1625
|
+
Vn as SIDE,
|
|
1626
|
+
et as THEME,
|
|
1627
|
+
N as default
|
|
1601
1628
|
};
|