mind-elixir 5.11.1-beta.0 → 5.11.1-beta.2
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.css +1 -1
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +698 -663
- package/dist/MindElixirLite.css +1 -1
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +547 -508
- package/dist/PlaintextConverter.js +99 -96
- package/dist/types/arrow.d.ts +4 -4
- package/dist/types/docs.d.ts +2 -2
- package/dist/types/index.d.ts +19 -18
- package/dist/types/methods.d.ts +22 -17
- package/dist/types/summary.d.ts +3 -8
- package/dist/types/types/dom.d.ts +6 -3
- package/dist/types/types/index.d.ts +12 -5
- package/dist/types/utils/panHelper.d.ts +3 -1
- package/dist/types/utils/svg.d.ts +2 -2
- package/dist/types/viselect/src/index.d.ts +9 -9
- package/dist/types/viselect/src/types.d.ts +1 -1
- package/dist/types/viselect/src/utils/events.d.ts +1 -1
- package/dist/types/viselect/src/utils/matchesTrigger.d.ts +5 -5
- package/package.json +18 -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/MindElixir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const Qo = 0, es = 1, ts = 2,
|
|
1
|
+
const Qo = 0, es = 1, ts = 2, fe = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -25,7 +25,7 @@ const Qo = 0, es = 1, ts = 2, pe = {
|
|
|
25
25
|
"--panel-border-color": "#eaeaea",
|
|
26
26
|
"--map-padding": "50px 80px"
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, ue = {
|
|
29
29
|
name: "Dark",
|
|
30
30
|
type: "dark",
|
|
31
31
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -53,61 +53,61 @@ const Qo = 0, es = 1, ts = 2, pe = {
|
|
|
53
53
|
"--map-padding": "50px 80px"
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
function
|
|
56
|
+
function ae(e) {
|
|
57
57
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const ne = function(e, t) {
|
|
60
60
|
if (t.id === e)
|
|
61
61
|
return t;
|
|
62
62
|
if (t.children && t.children.length) {
|
|
63
63
|
for (let n = 0; n < t.children.length; n++) {
|
|
64
|
-
const o =
|
|
64
|
+
const o = ne(e, t.children[n]);
|
|
65
65
|
if (o) return o;
|
|
66
66
|
}
|
|
67
67
|
return null;
|
|
68
68
|
} else
|
|
69
69
|
return null;
|
|
70
|
-
},
|
|
70
|
+
}, R = (e, t) => {
|
|
71
71
|
if (e.parent = t, e.children)
|
|
72
72
|
for (let n = 0; n < e.children.length; n++)
|
|
73
|
-
|
|
74
|
-
},
|
|
73
|
+
R(e.children[n], e);
|
|
74
|
+
}, F = (e, t, n) => {
|
|
75
75
|
if (e.expanded = t, e.children)
|
|
76
76
|
if (n === void 0 || n > 0) {
|
|
77
77
|
const o = n !== void 0 ? n - 1 : void 0;
|
|
78
78
|
e.children.forEach((s) => {
|
|
79
|
-
|
|
79
|
+
F(s, t, o);
|
|
80
80
|
});
|
|
81
81
|
} else
|
|
82
82
|
e.children.forEach((o) => {
|
|
83
|
-
|
|
83
|
+
F(o, !1);
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
function
|
|
87
|
-
if (e.id =
|
|
86
|
+
function pe(e) {
|
|
87
|
+
if (e.id = B(), e.children)
|
|
88
88
|
for (let t = 0; t < e.children.length; t++)
|
|
89
|
-
|
|
89
|
+
pe(e.children[t]);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const s = n - e, i = o - t, c = Math.atan2(i, s) * 180 / Math.PI, r = 12, a = 30,
|
|
91
|
+
function oe(e, t, n, o) {
|
|
92
|
+
const s = n - e, i = o - t, c = Math.atan2(i, s) * 180 / Math.PI, r = 12, a = 30, d = (c + 180 - a) * Math.PI / 180, h = (c + 180 + a) * Math.PI / 180;
|
|
93
93
|
return {
|
|
94
|
-
x1: n + Math.cos(
|
|
95
|
-
y1: o + Math.sin(
|
|
96
|
-
x2: n + Math.cos(
|
|
97
|
-
y2: o + Math.sin(
|
|
94
|
+
x1: n + Math.cos(d) * r,
|
|
95
|
+
y1: o + Math.sin(d) * r,
|
|
96
|
+
x2: n + Math.cos(h) * r,
|
|
97
|
+
y2: o + Math.sin(h) * r
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function B() {
|
|
101
101
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
102
102
|
}
|
|
103
103
|
const ft = function() {
|
|
104
|
-
const e =
|
|
104
|
+
const e = B();
|
|
105
105
|
return {
|
|
106
106
|
topic: this.newTopicName,
|
|
107
107
|
id: e
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
function
|
|
110
|
+
function ge(e) {
|
|
111
111
|
return JSON.parse(
|
|
112
112
|
JSON.stringify(e, (n, o) => {
|
|
113
113
|
if (n !== "parent")
|
|
@@ -115,15 +115,15 @@ function ye(e) {
|
|
|
115
115
|
})
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const L = (e, t) => {
|
|
119
119
|
let n = 0, o = 0;
|
|
120
120
|
for (; t && t !== e; )
|
|
121
121
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
122
122
|
return { offsetLeft: n, offsetTop: o };
|
|
123
|
-
},
|
|
123
|
+
}, k = (e, t) => {
|
|
124
124
|
for (const n in t)
|
|
125
125
|
e.setAttribute(n, t[n]);
|
|
126
|
-
},
|
|
126
|
+
}, te = (e) => e ? e.tagName === "ME-TPC" : !1, me = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
127
127
|
for (let s = 0; s < o.length; s++) {
|
|
128
128
|
if (t === o[s]) continue;
|
|
129
129
|
const { parent: i } = t.nodeObj;
|
|
@@ -131,7 +131,7 @@ const A = (e, t) => {
|
|
|
131
131
|
return !1;
|
|
132
132
|
}
|
|
133
133
|
return !0;
|
|
134
|
-
}),
|
|
134
|
+
}), ye = (e) => {
|
|
135
135
|
const t = /translate3d\(([^,]+),\s*([^,]+)/, n = e.match(t);
|
|
136
136
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
137
137
|
}, qe = function(e) {
|
|
@@ -150,16 +150,16 @@ const A = (e, t) => {
|
|
|
150
150
|
return Math.sqrt(n * n + o * o);
|
|
151
151
|
}, ut = function(e, t) {
|
|
152
152
|
if (!t)
|
|
153
|
-
return
|
|
153
|
+
return ie(e), e;
|
|
154
154
|
let n = e.querySelector(".insert-preview");
|
|
155
155
|
const o = `insert-preview ${t} show`;
|
|
156
156
|
return n || (n = document.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
157
|
-
},
|
|
157
|
+
}, ie = function(e) {
|
|
158
158
|
if (!e) return;
|
|
159
159
|
const t = e.querySelectorAll(".insert-preview");
|
|
160
160
|
for (const n of t || [])
|
|
161
161
|
n.remove();
|
|
162
|
-
},
|
|
162
|
+
}, Le = function(e, t) {
|
|
163
163
|
for (const n of t) {
|
|
164
164
|
const o = n.parentElement.parentElement.contains(e);
|
|
165
165
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
@@ -202,7 +202,13 @@ const yt = 5;
|
|
|
202
202
|
function Me(e, t, n, o = !1) {
|
|
203
203
|
if (e.spacePressed) return !1;
|
|
204
204
|
const s = n.target;
|
|
205
|
-
|
|
205
|
+
if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
|
|
206
|
+
if (t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.dragged = e.currentNodes, o) {
|
|
207
|
+
Je(e, t);
|
|
208
|
+
const i = e.container.getBoundingClientRect();
|
|
209
|
+
Ue(t.ghost, n.clientX - i.x, n.clientY - i.y);
|
|
210
|
+
}
|
|
211
|
+
return !0;
|
|
206
212
|
}
|
|
207
213
|
function Ue(e, t, n) {
|
|
208
214
|
e.style.transform = `translate(${t - 10}px, ${n - 10}px)`, e.style.display = "block";
|
|
@@ -222,17 +228,17 @@ function bt(e, t, n) {
|
|
|
222
228
|
const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i);
|
|
223
229
|
if (!t.isDragging && l > yt && Je(e, t), !t.isDragging) return;
|
|
224
230
|
const c = e.container.getBoundingClientRect();
|
|
225
|
-
Ue(t.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(),
|
|
231
|
+
Ue(t.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(), ie(t.meet);
|
|
226
232
|
const r = 12 * e.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - r);
|
|
227
|
-
if (
|
|
233
|
+
if (Le(a, o)) {
|
|
228
234
|
t.meet = a;
|
|
229
|
-
const
|
|
230
|
-
n.clientY >
|
|
235
|
+
const d = a.getBoundingClientRect(), h = d.y;
|
|
236
|
+
n.clientY > h + d.height ? t.insertType = "after" : t.insertType = "in";
|
|
231
237
|
} else {
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
234
|
-
t.meet =
|
|
235
|
-
const u =
|
|
238
|
+
const d = document.elementFromPoint(n.clientX, n.clientY + r);
|
|
239
|
+
if (Le(d, o)) {
|
|
240
|
+
t.meet = d;
|
|
241
|
+
const u = d.getBoundingClientRect().y;
|
|
236
242
|
n.clientY < u ? t.insertType = "before" : t.insertType = "in";
|
|
237
243
|
} else
|
|
238
244
|
t.insertType = null, t.meet = null;
|
|
@@ -245,29 +251,29 @@ function vt(e, t, n) {
|
|
|
245
251
|
t.edgeMoveController.stop();
|
|
246
252
|
for (const s of o)
|
|
247
253
|
s.parentElement.parentElement.style.opacity = "1";
|
|
248
|
-
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (
|
|
254
|
+
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (ie(t.meet), t.insertType === "before" ? e.moveNodeBefore(o, t.meet) : t.insertType === "after" ? e.moveNodeAfter(o, t.meet) : t.insertType === "in" && e.moveNodeIn(o, t.meet)), e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null;
|
|
249
255
|
}
|
|
250
256
|
}
|
|
251
|
-
function
|
|
257
|
+
function Ae(e, t) {
|
|
252
258
|
const { dragged: n } = e;
|
|
253
259
|
if (n) {
|
|
254
260
|
t.edgeMoveController.stop();
|
|
255
261
|
for (const o of n)
|
|
256
262
|
o.parentElement.parentElement.style.opacity = "1";
|
|
257
|
-
t.meet &&
|
|
263
|
+
t.meet && ie(t.meet), t.ghost.style.display = "none", t.ghost.innerHTML = "", e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null;
|
|
258
264
|
}
|
|
259
265
|
}
|
|
260
|
-
function
|
|
266
|
+
function wt(e) {
|
|
261
267
|
return () => {
|
|
262
268
|
};
|
|
263
269
|
}
|
|
264
|
-
const
|
|
270
|
+
const O = {
|
|
265
271
|
LHS: "lhs",
|
|
266
272
|
RHS: "rhs"
|
|
267
|
-
},
|
|
273
|
+
}, xt = function() {
|
|
268
274
|
this.nodes.innerHTML = "";
|
|
269
275
|
const e = this.createTopic(this.nodeData);
|
|
270
|
-
|
|
276
|
+
be.call(this, e, this.nodeData), e.draggable = !1;
|
|
271
277
|
const t = document.createElement("me-root");
|
|
272
278
|
t.appendChild(e);
|
|
273
279
|
const n = this.nodeData.children || [];
|
|
@@ -280,9 +286,9 @@ const H = {
|
|
|
280
286
|
Et(this, n, t);
|
|
281
287
|
}, Et = function(e, t, n) {
|
|
282
288
|
const o = document.createElement("me-main");
|
|
283
|
-
o.className =
|
|
289
|
+
o.className = O.LHS;
|
|
284
290
|
const s = document.createElement("me-main");
|
|
285
|
-
s.className =
|
|
291
|
+
s.className = O.RHS;
|
|
286
292
|
for (let i = 0; i < t.length; i++) {
|
|
287
293
|
const l = t[i], { grp: c } = e.createWrapper(l);
|
|
288
294
|
e.direction === 2 ? l.direction === 0 ? o.appendChild(c) : s.appendChild(c) : e.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
@@ -299,7 +305,7 @@ const H = {
|
|
|
299
305
|
const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
300
306
|
if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
301
307
|
return o;
|
|
302
|
-
},
|
|
308
|
+
}, be = function(e, t) {
|
|
303
309
|
if (e.innerHTML = "", t.style) {
|
|
304
310
|
const n = t.style;
|
|
305
311
|
for (const o in n)
|
|
@@ -326,7 +332,7 @@ const H = {
|
|
|
326
332
|
} else e.link && (e.link = void 0);
|
|
327
333
|
if (t.icons && t.icons.length) {
|
|
328
334
|
const n = document.createElement("span");
|
|
329
|
-
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${
|
|
335
|
+
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${ae(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
330
336
|
} else e.icons && (e.icons = void 0);
|
|
331
337
|
if (t.tags && t.tags.length) {
|
|
332
338
|
const n = document.createElement("div");
|
|
@@ -338,7 +344,7 @@ const H = {
|
|
|
338
344
|
}, St = function(e, t) {
|
|
339
345
|
const n = document.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
340
346
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
341
|
-
const i =
|
|
347
|
+
const i = ve(e.expanded);
|
|
342
348
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
343
349
|
const l = Ct(this, e.children);
|
|
344
350
|
n.appendChild(l);
|
|
@@ -347,7 +353,7 @@ const H = {
|
|
|
347
353
|
return { grp: n, top: o, tpc: s };
|
|
348
354
|
}, Nt = function(e) {
|
|
349
355
|
const t = document.createElement("me-parent"), n = this.createTopic(e);
|
|
350
|
-
return
|
|
356
|
+
return be.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
351
357
|
}, Tt = function(e) {
|
|
352
358
|
const t = document.createElement("me-children");
|
|
353
359
|
return t.append(...e), t;
|
|
@@ -363,7 +369,7 @@ function Qe(e) {
|
|
|
363
369
|
}
|
|
364
370
|
const _t = function(e) {
|
|
365
371
|
if (!e) return;
|
|
366
|
-
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } =
|
|
372
|
+
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = L(this.nodes, e);
|
|
367
373
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
368
374
|
const l = getComputedStyle(e);
|
|
369
375
|
t.style.cssText = `
|
|
@@ -376,7 +382,7 @@ const _t = function(e) {
|
|
|
376
382
|
margin:${l.margin};
|
|
377
383
|
background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor};
|
|
378
384
|
border: ${l.border};
|
|
379
|
-
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), Qe(t), this.bus.fire("operation", {
|
|
385
|
+
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), e.style.opacity = "0", Qe(t), this.bus.fire("operation", {
|
|
380
386
|
name: "beginEdit",
|
|
381
387
|
obj: e.nodeObj
|
|
382
388
|
}), t.addEventListener("keydown", (c) => {
|
|
@@ -388,7 +394,7 @@ const _t = function(e) {
|
|
|
388
394
|
} else r === "Escape" && (c.preventDefault(), t.textContent = o, t.blur(), this.container.focus());
|
|
389
395
|
}), t.addEventListener("blur", () => {
|
|
390
396
|
if (!t) return;
|
|
391
|
-
t.remove();
|
|
397
|
+
e.style.opacity = "1", t.remove();
|
|
392
398
|
const c = t.innerText?.trim() || "";
|
|
393
399
|
c === o || c === "" || (n.topic = c, this.markdown ? e.text.innerHTML = this.markdown(n.topic, n) : e.text.textContent = c, this.linkDiv(), this.bus.fire("operation", {
|
|
394
400
|
name: "finishEdit",
|
|
@@ -396,20 +402,20 @@ const _t = function(e) {
|
|
|
396
402
|
origin: o
|
|
397
403
|
}));
|
|
398
404
|
});
|
|
399
|
-
},
|
|
405
|
+
}, ve = function(e) {
|
|
400
406
|
const t = document.createElement("me-epd");
|
|
401
407
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
402
408
|
}, K = (e) => {
|
|
403
409
|
const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
|
|
404
410
|
return { siblings: t, index: n };
|
|
405
411
|
};
|
|
406
|
-
function
|
|
412
|
+
function Dt(e) {
|
|
407
413
|
const { siblings: t, index: n } = K(e);
|
|
408
414
|
if (t === void 0) return;
|
|
409
415
|
const o = t[n];
|
|
410
416
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
411
417
|
}
|
|
412
|
-
function
|
|
418
|
+
function Lt(e) {
|
|
413
419
|
const { siblings: t, index: n } = K(e);
|
|
414
420
|
if (t === void 0) return;
|
|
415
421
|
const o = t[n];
|
|
@@ -419,15 +425,15 @@ function et(e) {
|
|
|
419
425
|
const { siblings: t, index: n } = K(e);
|
|
420
426
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
421
427
|
}
|
|
422
|
-
function
|
|
428
|
+
function Mt(e, t, n) {
|
|
423
429
|
const { siblings: o, index: s } = K(n);
|
|
424
430
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
425
431
|
}
|
|
426
|
-
function
|
|
432
|
+
function At(e, t) {
|
|
427
433
|
const { siblings: n, index: o } = K(e);
|
|
428
434
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
429
435
|
}
|
|
430
|
-
function
|
|
436
|
+
function Pt(e, t, n) {
|
|
431
437
|
if (et(t), n.parent?.parent || (t.direction = n.direction), e === "in")
|
|
432
438
|
n.children ? n.children.push(t) : n.children = [t];
|
|
433
439
|
else {
|
|
@@ -437,7 +443,7 @@ function Ot(e, t, n) {
|
|
|
437
443
|
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
438
444
|
}
|
|
439
445
|
}
|
|
440
|
-
const
|
|
446
|
+
const Ot = function({ map: e, direction: t }, n) {
|
|
441
447
|
if (t === 0)
|
|
442
448
|
return 0;
|
|
443
449
|
if (t === 1)
|
|
@@ -449,15 +455,15 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
449
455
|
}, tt = function(e, t, n) {
|
|
450
456
|
const o = n.children[0].children[0], s = t.parentElement;
|
|
451
457
|
if (s.tagName === "ME-PARENT") {
|
|
452
|
-
if (
|
|
458
|
+
if (G(o), s.children[1])
|
|
453
459
|
s.nextSibling.appendChild(n);
|
|
454
460
|
else {
|
|
455
461
|
const i = e.createChildren([n]);
|
|
456
|
-
s.appendChild(
|
|
462
|
+
s.appendChild(ve(!0)), s.insertAdjacentElement("afterend", i);
|
|
457
463
|
}
|
|
458
464
|
e.linkDiv(n.offsetParent);
|
|
459
|
-
} else s.tagName === "ME-ROOT" && (
|
|
460
|
-
},
|
|
465
|
+
} else s.tagName === "ME-ROOT" && (Ot(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
|
|
466
|
+
}, Ht = function(e, t) {
|
|
461
467
|
const n = e.parentNode;
|
|
462
468
|
if (t === 0) {
|
|
463
469
|
const o = n.parentNode.parentNode;
|
|
@@ -467,24 +473,24 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
467
473
|
}, nt = {
|
|
468
474
|
before: "beforebegin",
|
|
469
475
|
after: "afterend"
|
|
470
|
-
},
|
|
476
|
+
}, G = function(e) {
|
|
471
477
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
472
478
|
n?.tagName === "svg" && n?.remove();
|
|
473
|
-
},
|
|
474
|
-
const n = e.nodeObj, o =
|
|
479
|
+
}, $t = function(e, t) {
|
|
480
|
+
const n = e.nodeObj, o = ge(n);
|
|
475
481
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
476
482
|
const s = Object.assign(n, t);
|
|
477
|
-
|
|
483
|
+
be.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
478
484
|
name: "reshapeNode",
|
|
479
485
|
obj: s,
|
|
480
486
|
origin: o
|
|
481
487
|
});
|
|
482
|
-
},
|
|
488
|
+
}, we = function(e, t, n) {
|
|
483
489
|
if (!t) return null;
|
|
484
490
|
const o = t.nodeObj;
|
|
485
491
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
486
492
|
const s = n || e.generateNewObj();
|
|
487
|
-
o.children ? o.children.push(s) : o.children = [s],
|
|
493
|
+
o.children ? o.children.push(s) : o.children = [s], R(e.nodeData);
|
|
488
494
|
const { grp: i, top: l } = e.createWrapper(s);
|
|
489
495
|
return tt(e, t, i), { newTop: l, newNodeObj: s };
|
|
490
496
|
}, jt = function(e, t, n) {
|
|
@@ -493,8 +499,8 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
493
499
|
const s = o.nodeObj;
|
|
494
500
|
if (s.parent) {
|
|
495
501
|
if (!s.parent?.parent && this.direction === 2) {
|
|
496
|
-
const a = this.map.querySelector(".lhs")?.childElementCount || 0,
|
|
497
|
-
if (!a || !
|
|
502
|
+
const a = this.map.querySelector(".lhs")?.childElementCount || 0, d = this.map.querySelector(".rhs")?.childElementCount || 0;
|
|
503
|
+
if (!a || !d) {
|
|
498
504
|
this.addChild(this.findEle(s.parent.id), n);
|
|
499
505
|
return;
|
|
500
506
|
}
|
|
@@ -505,10 +511,10 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
505
511
|
}
|
|
506
512
|
const i = n || this.generateNewObj();
|
|
507
513
|
if (!s.parent?.parent) {
|
|
508
|
-
const a = o.closest("me-main").className ===
|
|
514
|
+
const a = o.closest("me-main").className === O.LHS ? 0 : 1;
|
|
509
515
|
i.direction = a;
|
|
510
516
|
}
|
|
511
|
-
|
|
517
|
+
Mt(i, e, s), R(this.nodeData);
|
|
512
518
|
const l = o.parentElement, { grp: c, top: r } = this.createWrapper(i);
|
|
513
519
|
l.parentElement.insertAdjacentElement(nt[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(r.firstChild), this.bus.fire("operation", {
|
|
514
520
|
name: "insertSibling",
|
|
@@ -518,14 +524,14 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
518
524
|
}, It = function(e, t) {
|
|
519
525
|
const n = e || this.currentNode;
|
|
520
526
|
if (!n) return;
|
|
521
|
-
|
|
527
|
+
G(n);
|
|
522
528
|
const o = n.nodeObj;
|
|
523
529
|
if (!o.parent)
|
|
524
530
|
return;
|
|
525
531
|
const s = t || this.generateNewObj();
|
|
526
|
-
|
|
532
|
+
At(o, s), R(this.nodeData);
|
|
527
533
|
const i = n.parentElement.parentElement, { grp: l, top: c } = this.createWrapper(s, !0);
|
|
528
|
-
c.appendChild(
|
|
534
|
+
c.appendChild(ve(!0)), i.insertAdjacentElement("afterend", l);
|
|
529
535
|
const r = this.createChildren([i]);
|
|
530
536
|
c.insertAdjacentElement("afterend", r), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
|
|
531
537
|
name: "insertParent",
|
|
@@ -534,7 +540,7 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
534
540
|
}, Rt = function(e, t) {
|
|
535
541
|
const n = e || this.currentNode;
|
|
536
542
|
if (!n) return;
|
|
537
|
-
const o =
|
|
543
|
+
const o = we(this, n, t);
|
|
538
544
|
if (!o) return;
|
|
539
545
|
const { newTop: s, newNodeObj: i } = o;
|
|
540
546
|
this.bus.fire("operation", {
|
|
@@ -542,9 +548,9 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
542
548
|
obj: i
|
|
543
549
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
544
550
|
}, Bt = function(e, t) {
|
|
545
|
-
const n =
|
|
546
|
-
|
|
547
|
-
const o =
|
|
551
|
+
const n = ge(e.nodeObj);
|
|
552
|
+
pe(n);
|
|
553
|
+
const o = we(this, t, n);
|
|
548
554
|
if (!o) return;
|
|
549
555
|
const { newNodeObj: s } = o;
|
|
550
556
|
this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
|
|
@@ -554,9 +560,9 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
554
560
|
}, Wt = function(e, t) {
|
|
555
561
|
const n = [];
|
|
556
562
|
for (let o = 0; o < e.length; o++) {
|
|
557
|
-
const s = e[o], i =
|
|
558
|
-
|
|
559
|
-
const l =
|
|
563
|
+
const s = e[o], i = ge(s.nodeObj);
|
|
564
|
+
pe(i);
|
|
565
|
+
const l = we(this, t, i);
|
|
560
566
|
if (!l) return;
|
|
561
567
|
const { newNodeObj: c } = l;
|
|
562
568
|
n.push(c);
|
|
@@ -569,7 +575,7 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
569
575
|
const t = e || this.currentNode;
|
|
570
576
|
if (!t) return;
|
|
571
577
|
const n = t.nodeObj;
|
|
572
|
-
|
|
578
|
+
Dt(n);
|
|
573
579
|
const o = t.parentNode.parentNode;
|
|
574
580
|
o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
|
|
575
581
|
name: "moveUpNode",
|
|
@@ -579,35 +585,35 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
579
585
|
const t = e || this.currentNode;
|
|
580
586
|
if (!t) return;
|
|
581
587
|
const n = t.nodeObj;
|
|
582
|
-
|
|
588
|
+
Lt(n);
|
|
583
589
|
const o = t.parentNode.parentNode;
|
|
584
590
|
o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
|
|
585
591
|
name: "moveDownNode",
|
|
586
592
|
obj: n
|
|
587
593
|
});
|
|
588
594
|
}, Ft = function(e) {
|
|
589
|
-
if (e =
|
|
595
|
+
if (e = me(e), e.length === 0) return;
|
|
590
596
|
for (const n of e) {
|
|
591
597
|
const o = n.nodeObj, s = et(o);
|
|
592
|
-
|
|
598
|
+
Ht(n, s);
|
|
593
599
|
}
|
|
594
600
|
const t = e[e.length - 1];
|
|
595
601
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
596
602
|
name: "removeNodes",
|
|
597
603
|
objs: e.map((n) => n.nodeObj)
|
|
598
604
|
});
|
|
599
|
-
},
|
|
600
|
-
e =
|
|
605
|
+
}, xe = (e, t, n, o) => {
|
|
606
|
+
e = me(e);
|
|
601
607
|
let s = n.nodeObj;
|
|
602
608
|
t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
|
|
603
609
|
const i = [];
|
|
604
610
|
for (const c of e) {
|
|
605
611
|
const r = c.nodeObj;
|
|
606
|
-
if (
|
|
612
|
+
if (Pt(t, r, s), R(o.nodeData), t === "in") {
|
|
607
613
|
const a = c.parentElement;
|
|
608
614
|
tt(o, n, a.parentElement);
|
|
609
615
|
} else {
|
|
610
|
-
|
|
616
|
+
G(c);
|
|
611
617
|
const a = c.parentElement.parentNode;
|
|
612
618
|
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(nt[t], a);
|
|
613
619
|
}
|
|
@@ -621,13 +627,13 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
621
627
|
objs: e.map((c) => c.nodeObj),
|
|
622
628
|
toObj: s
|
|
623
629
|
});
|
|
624
|
-
}, Gt = function(e, t) {
|
|
625
|
-
Ce(e, "in", t, this);
|
|
626
|
-
}, zt = function(e, t) {
|
|
627
|
-
Ce(e, "before", t, this);
|
|
628
630
|
}, Kt = function(e, t) {
|
|
629
|
-
|
|
630
|
-
}, Vt = function(e) {
|
|
631
|
+
xe(e, "in", t, this);
|
|
632
|
+
}, Vt = function(e, t) {
|
|
633
|
+
xe(e, "before", t, this);
|
|
634
|
+
}, zt = function(e, t) {
|
|
635
|
+
xe(e, "after", t, this);
|
|
636
|
+
}, Gt = function(e) {
|
|
631
637
|
const t = e || this.currentNode;
|
|
632
638
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
633
639
|
}, qt = function(e, t) {
|
|
@@ -635,19 +641,19 @@ const Pt = function({ map: e, direction: t }, n) {
|
|
|
635
641
|
}, ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
636
642
|
__proto__: null,
|
|
637
643
|
addChild: Rt,
|
|
638
|
-
beginEdit:
|
|
644
|
+
beginEdit: Gt,
|
|
639
645
|
copyNode: Bt,
|
|
640
646
|
copyNodes: Wt,
|
|
641
647
|
insertParent: It,
|
|
642
648
|
insertSibling: jt,
|
|
643
649
|
moveDownNode: Xt,
|
|
644
|
-
moveNodeAfter:
|
|
645
|
-
moveNodeBefore:
|
|
646
|
-
moveNodeIn:
|
|
650
|
+
moveNodeAfter: zt,
|
|
651
|
+
moveNodeBefore: Vt,
|
|
652
|
+
moveNodeIn: Kt,
|
|
647
653
|
moveUpNode: Yt,
|
|
648
654
|
removeNodes: Ft,
|
|
649
|
-
reshapeNode:
|
|
650
|
-
rmSubline:
|
|
655
|
+
reshapeNode: $t,
|
|
656
|
+
rmSubline: G,
|
|
651
657
|
setNodeTopic: qt
|
|
652
658
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
653
659
|
function Ut(e) {
|
|
@@ -662,8 +668,8 @@ function Ut(e) {
|
|
|
662
668
|
const Jt = function(e) {
|
|
663
669
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
664
670
|
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
665
|
-
const i = n.left + n.width / 2, l = n.top + n.height / 2, c = o.left + o.width / 2, r = o.top + o.height / 2, a = i - c,
|
|
666
|
-
this.move(-a, -
|
|
671
|
+
const i = n.left + n.width / 2, l = n.top + n.height / 2, c = o.left + o.width / 2, r = o.top + o.height / 2, a = i - c, d = l - r;
|
|
672
|
+
this.move(-a, -d, !0);
|
|
667
673
|
}
|
|
668
674
|
}, Zt = function(e, t, n) {
|
|
669
675
|
this.clearSelection(), this.scrollIntoView(e), this.selection?.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
@@ -673,14 +679,14 @@ const Jt = function(e) {
|
|
|
673
679
|
this.selection?.deselect(e);
|
|
674
680
|
}, tn = function() {
|
|
675
681
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
676
|
-
},
|
|
682
|
+
}, Ee = function(e) {
|
|
677
683
|
return JSON.stringify(e, (t, n) => {
|
|
678
684
|
if (!(t === "parent" && typeof n != "string"))
|
|
679
685
|
return n;
|
|
680
686
|
});
|
|
681
687
|
}, nn = function() {
|
|
682
688
|
const e = Ut(this);
|
|
683
|
-
return
|
|
689
|
+
return Ee(e);
|
|
684
690
|
}, on = function() {
|
|
685
691
|
return JSON.parse(this.getDataString());
|
|
686
692
|
}, sn = function() {
|
|
@@ -689,43 +695,43 @@ const Jt = function(e) {
|
|
|
689
695
|
this.editable = !1;
|
|
690
696
|
}, ln = function(e, t = { x: 0, y: 0 }) {
|
|
691
697
|
if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
|
|
692
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } =
|
|
698
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = Ce(this), c = this.map.style.transform, { x: r, y: a } = ye(c), d = r - i, h = a - l, u = this.scaleVal, b = (-o + d) * (1 - e / u), v = (-s + h) * (1 - e / u);
|
|
693
699
|
this.map.style.transform = `translate3d(${r - b}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
694
700
|
}, cn = function() {
|
|
695
701
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
696
702
|
this.scaleVal = n;
|
|
697
|
-
const { dx: o, dy: s } =
|
|
703
|
+
const { dx: o, dy: s } = Ce(this, !0);
|
|
698
704
|
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
699
705
|
}, an = function(e, t, n = !1) {
|
|
700
706
|
const { map: o, scaleVal: s, bus: i, container: l, nodes: c } = this;
|
|
701
707
|
if (n && o.style.transition === "transform 0.3s")
|
|
702
708
|
return;
|
|
703
709
|
const r = o.style.transform;
|
|
704
|
-
let { x: a, y:
|
|
705
|
-
const
|
|
710
|
+
let { x: a, y: d } = ye(r);
|
|
711
|
+
const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(), b = u.left < h.right && u.right > h.left, v = u.top < h.bottom && u.bottom > h.top;
|
|
706
712
|
if (b) {
|
|
707
713
|
const p = u.left + e, g = u.right + e;
|
|
708
|
-
(p >=
|
|
714
|
+
(p >= h.right || g <= h.left) && (e = 0);
|
|
709
715
|
}
|
|
710
716
|
if (v) {
|
|
711
717
|
const p = u.top + t, g = u.bottom + t;
|
|
712
|
-
(p >=
|
|
718
|
+
(p >= h.bottom || g <= h.top) && (t = 0);
|
|
713
719
|
}
|
|
714
|
-
a += e,
|
|
720
|
+
a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
715
721
|
o.style.transition = "none";
|
|
716
|
-
}, 300)), o.style.transform = `translate3d(${a}px, ${
|
|
717
|
-
},
|
|
722
|
+
}, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
723
|
+
}, Ce = (e, t = !1) => {
|
|
718
724
|
const { container: n, map: o, nodes: s } = e;
|
|
719
725
|
let i, l;
|
|
720
726
|
if (e.alignment === "nodes" || t)
|
|
721
727
|
i = (n.offsetWidth - s.offsetWidth) / 2, l = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
|
|
722
728
|
else {
|
|
723
|
-
const c = o.querySelector("me-root"), r = c.offsetTop, a = c.offsetLeft,
|
|
724
|
-
i = n.offsetWidth / 2 - a -
|
|
729
|
+
const c = o.querySelector("me-root"), r = c.offsetTop, a = c.offsetLeft, d = c.offsetWidth, h = c.offsetHeight;
|
|
730
|
+
i = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - r - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
|
|
725
731
|
}
|
|
726
732
|
return { dx: i, dy: l };
|
|
727
733
|
}, dn = function() {
|
|
728
|
-
const { map: e, container: t } = this, { dx: n, dy: o } =
|
|
734
|
+
const { map: e, container: t } = this, { dx: n, dy: o } = Ce(this);
|
|
729
735
|
t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
730
736
|
}, hn = function(e) {
|
|
731
737
|
e(this);
|
|
@@ -746,33 +752,33 @@ const Jt = function(e) {
|
|
|
746
752
|
x: o.left,
|
|
747
753
|
y: o.top
|
|
748
754
|
}, i = e.parentNode, l = i.children[1];
|
|
749
|
-
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "",
|
|
750
|
-
const
|
|
755
|
+
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", G(e), n.expanded) {
|
|
756
|
+
const h = this.createChildren(
|
|
751
757
|
n.children.map((u) => this.createWrapper(u).grp)
|
|
752
758
|
);
|
|
753
|
-
i.parentNode.appendChild(
|
|
759
|
+
i.parentNode.appendChild(h);
|
|
754
760
|
} else
|
|
755
761
|
i.parentNode.children[1].remove();
|
|
756
762
|
this.linkDiv(e.closest("me-main > me-wrapper"));
|
|
757
763
|
const c = e.getBoundingClientRect(), r = {
|
|
758
764
|
x: c.left,
|
|
759
765
|
y: c.top
|
|
760
|
-
}, a = s.x - r.x,
|
|
761
|
-
this.move(a,
|
|
766
|
+
}, a = s.x - r.x, d = s.y - r.y;
|
|
767
|
+
this.move(a, d), this.bus.fire("expandNode", n);
|
|
762
768
|
}, bn = function(e, t) {
|
|
763
769
|
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
764
770
|
x: o.left,
|
|
765
771
|
y: o.top
|
|
766
772
|
};
|
|
767
|
-
|
|
773
|
+
F(n, t ?? !n.expanded), this.refresh();
|
|
768
774
|
const i = this.findEle(n.id).getBoundingClientRect(), l = {
|
|
769
775
|
x: i.left,
|
|
770
776
|
y: i.top
|
|
771
777
|
}, c = s.x - l.x, r = s.y - l.y;
|
|
772
778
|
this.move(c, r);
|
|
773
779
|
}, vn = function(e) {
|
|
774
|
-
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)),
|
|
775
|
-
},
|
|
780
|
+
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), R(this.nodeData), this.layout(), this.linkDiv();
|
|
781
|
+
}, wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
776
782
|
__proto__: null,
|
|
777
783
|
cancelFocus: un,
|
|
778
784
|
clearSelection: tn,
|
|
@@ -794,10 +800,10 @@ const Jt = function(e) {
|
|
|
794
800
|
scrollIntoView: Jt,
|
|
795
801
|
selectNode: Zt,
|
|
796
802
|
selectNodes: Qt,
|
|
797
|
-
stringifyData:
|
|
803
|
+
stringifyData: Ee,
|
|
798
804
|
toCenter: dn,
|
|
799
805
|
unselectNodes: en
|
|
800
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
806
|
+
}, Symbol.toStringTag, { value: "Module" })), Pe = "MIND-ELIXIR-WAIT-COPY", xn = 40, En = 10, Cn = ({ deltaMode: e, deltaY: t, viewportHeight: n }) => e === WheelEvent.DOM_DELTA_LINE ? t * xn : e === WheelEvent.DOM_DELTA_PAGE ? t * n : t, Sn = ({ deltaMode: e, deltaY: t, scaleSensitivity: n, viewportHeight: o }) => {
|
|
801
807
|
const i = -Cn({ deltaMode: e, deltaY: t, viewportHeight: o }) / En * n;
|
|
802
808
|
return Math.max(-n, Math.min(n, i));
|
|
803
809
|
}, st = (e, t, n) => {
|
|
@@ -819,20 +825,20 @@ const Jt = function(e) {
|
|
|
819
825
|
const o = n.firstChild.firstChild.firstChild;
|
|
820
826
|
e.selectNode(o);
|
|
821
827
|
}
|
|
822
|
-
},
|
|
828
|
+
}, Oe = function(e, t) {
|
|
823
829
|
const n = e.currentNode || e.currentNodes?.[0];
|
|
824
830
|
if (!n) return;
|
|
825
831
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
826
832
|
o.parent ? s.className === t ? _n(e, n) : o.parent?.parent ? kn(e, n) : Tn(e) : Nn(e, t);
|
|
827
|
-
},
|
|
833
|
+
}, He = function(e, t) {
|
|
828
834
|
const n = e.currentNode;
|
|
829
835
|
if (!n || !n.nodeObj.parent) return;
|
|
830
836
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
831
837
|
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
832
|
-
},
|
|
838
|
+
}, $e = function(e, t, n) {
|
|
833
839
|
const o = t === "in" ? e.scaleSensitivity : -e.scaleSensitivity;
|
|
834
840
|
st(e, o, n);
|
|
835
|
-
},
|
|
841
|
+
}, Dn = (e, t) => {
|
|
836
842
|
const n = Sn({
|
|
837
843
|
deltaMode: t.deltaMode,
|
|
838
844
|
deltaY: t.deltaY,
|
|
@@ -841,7 +847,7 @@ const Jt = function(e) {
|
|
|
841
847
|
});
|
|
842
848
|
st(e, n, { x: t.clientX, y: t.clientY });
|
|
843
849
|
};
|
|
844
|
-
function
|
|
850
|
+
function Ln(e, t) {
|
|
845
851
|
t = t === !0 ? {} : t;
|
|
846
852
|
const n = () => {
|
|
847
853
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
@@ -850,14 +856,14 @@ function Dn(e, t) {
|
|
|
850
856
|
const i = (r) => {
|
|
851
857
|
const a = e.nodeData;
|
|
852
858
|
if (r.key === "0")
|
|
853
|
-
for (const
|
|
854
|
-
|
|
859
|
+
for (const d of a.children)
|
|
860
|
+
F(d, !1);
|
|
855
861
|
if (r.key === "=")
|
|
856
|
-
for (const
|
|
857
|
-
|
|
862
|
+
for (const d of a.children)
|
|
863
|
+
F(d, !0);
|
|
858
864
|
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
|
|
859
|
-
for (const
|
|
860
|
-
|
|
865
|
+
for (const d of a.children)
|
|
866
|
+
F(d, !0, Number(r.key) - 1);
|
|
861
867
|
e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
|
|
862
868
|
}, l = {
|
|
863
869
|
Enter: (r) => {
|
|
@@ -878,31 +884,31 @@ function Dn(e, t) {
|
|
|
878
884
|
else {
|
|
879
885
|
if (r.metaKey || r.ctrlKey)
|
|
880
886
|
return e.initSide();
|
|
881
|
-
|
|
887
|
+
He(e, "previous");
|
|
882
888
|
}
|
|
883
889
|
},
|
|
884
890
|
ArrowDown: (r) => {
|
|
885
|
-
r.altKey ? e.moveDownNode() :
|
|
891
|
+
r.altKey ? e.moveDownNode() : He(e, "next");
|
|
886
892
|
},
|
|
887
893
|
ArrowLeft: (r) => {
|
|
888
894
|
if (r.metaKey || r.ctrlKey)
|
|
889
895
|
return e.initLeft();
|
|
890
|
-
|
|
896
|
+
Oe(e, O.LHS);
|
|
891
897
|
},
|
|
892
898
|
ArrowRight: (r) => {
|
|
893
899
|
if (r.metaKey || r.ctrlKey)
|
|
894
900
|
return e.initRight();
|
|
895
|
-
|
|
901
|
+
Oe(e, O.RHS);
|
|
896
902
|
},
|
|
897
903
|
PageUp: () => e.moveUpNode(),
|
|
898
904
|
PageDown: () => {
|
|
899
905
|
e.moveDownNode();
|
|
900
906
|
},
|
|
901
907
|
"=": (r) => {
|
|
902
|
-
(r.metaKey || r.ctrlKey) &&
|
|
908
|
+
(r.metaKey || r.ctrlKey) && $e(e, "in");
|
|
903
909
|
},
|
|
904
910
|
"-": (r) => {
|
|
905
|
-
(r.metaKey || r.ctrlKey) &&
|
|
911
|
+
(r.metaKey || r.ctrlKey) && $e(e, "out");
|
|
906
912
|
},
|
|
907
913
|
0: (r) => {
|
|
908
914
|
if (r.metaKey || r.ctrlKey) {
|
|
@@ -922,17 +928,17 @@ function Dn(e, t) {
|
|
|
922
928
|
};
|
|
923
929
|
e.container.onkeydown = (r) => {
|
|
924
930
|
if ((r.ctrlKey || r.metaKey) && ["c", "v", "x"].includes(r.key) || r.preventDefault(), !e.editable) return;
|
|
925
|
-
const
|
|
926
|
-
|
|
931
|
+
const d = l[r.key];
|
|
932
|
+
d && d(r);
|
|
927
933
|
};
|
|
928
934
|
const c = (r) => {
|
|
929
935
|
if (r.target instanceof HTMLElement && r.target.id === "input-box" || e.currentNodes.length === 0) return !1;
|
|
930
936
|
if (r.clipboardData) {
|
|
931
|
-
const a =
|
|
932
|
-
magic:
|
|
937
|
+
const a = me(e.currentNodes).map((h) => h.nodeObj), d = Ee({
|
|
938
|
+
magic: Pe,
|
|
933
939
|
data: a
|
|
934
940
|
});
|
|
935
|
-
return r.clipboardData.setData("text/plain",
|
|
941
|
+
return r.clipboardData.setData("text/plain", d), r.preventDefault(), !0;
|
|
936
942
|
}
|
|
937
943
|
return !1;
|
|
938
944
|
};
|
|
@@ -942,10 +948,10 @@ function Dn(e, t) {
|
|
|
942
948
|
const a = r.clipboardData?.getData("text/plain");
|
|
943
949
|
if (a)
|
|
944
950
|
try {
|
|
945
|
-
const
|
|
946
|
-
if (
|
|
947
|
-
const
|
|
948
|
-
|
|
951
|
+
const d = JSON.parse(a);
|
|
952
|
+
if (d && d.magic === Pe && Array.isArray(d.data)) {
|
|
953
|
+
const h = d.data, u = h.map((b) => ({ nodeObj: b }));
|
|
954
|
+
h.length > 0 && e.currentNode && (e.copyNodes(u, e.currentNode), r.preventDefault());
|
|
949
955
|
return;
|
|
950
956
|
}
|
|
951
957
|
} catch {
|
|
@@ -953,59 +959,90 @@ function Dn(e, t) {
|
|
|
953
959
|
e.pasteHandler && e.pasteHandler(r);
|
|
954
960
|
});
|
|
955
961
|
}
|
|
956
|
-
function
|
|
962
|
+
function Mn(e) {
|
|
957
963
|
const { panHelper: t, container: n } = e;
|
|
958
|
-
let o =
|
|
964
|
+
let o = null;
|
|
959
965
|
e.spacePressed = !1;
|
|
960
|
-
|
|
961
|
-
|
|
966
|
+
const s = {
|
|
967
|
+
lastTap: 0,
|
|
968
|
+
lastTapTarget: null,
|
|
969
|
+
DOUBLE_CLICK_THRESHOLD: 300,
|
|
970
|
+
detect(f, y) {
|
|
971
|
+
const x = (/* @__PURE__ */ new Date()).getTime(), E = x - this.lastTap, S = E < this.DOUBLE_CLICK_THRESHOLD && E > 0 && this.lastTapTarget === f.target;
|
|
972
|
+
this.lastTap = x, this.lastTapTarget = f.target, S && y(f);
|
|
973
|
+
},
|
|
974
|
+
clear() {
|
|
975
|
+
this.lastTap = 0, this.lastTapTarget = null;
|
|
976
|
+
}
|
|
977
|
+
}, i = {
|
|
978
|
+
Idle: 0,
|
|
979
|
+
Pinch: 1,
|
|
980
|
+
DragWait: 2,
|
|
981
|
+
Drag: 3,
|
|
982
|
+
Pan: 4,
|
|
983
|
+
BoxSelect: 5
|
|
984
|
+
};
|
|
985
|
+
e.ptState = i.Idle;
|
|
986
|
+
const l = {
|
|
987
|
+
lastDistance: null,
|
|
988
|
+
activePointers: /* @__PURE__ */ new Map(),
|
|
989
|
+
handlePointerDown(f) {
|
|
990
|
+
if (f.pointerType !== "touch") return !1;
|
|
991
|
+
if (this.activePointers.set(f.pointerId, { x: f.clientX, y: f.clientY }), this.activePointers.size >= 2) {
|
|
992
|
+
const [y, x] = Array.from(this.activePointers.values());
|
|
993
|
+
return this.lastDistance = De(y, x), !0;
|
|
994
|
+
}
|
|
995
|
+
return !1;
|
|
996
|
+
},
|
|
997
|
+
handlePointerMove(f) {
|
|
998
|
+
if (f.pointerType !== "touch" || !this.activePointers.has(f.pointerId)) return !1;
|
|
999
|
+
if (this.activePointers.set(f.pointerId, { x: f.clientX, y: f.clientY }), this.activePointers.size >= 2) {
|
|
1000
|
+
const [y, x] = Array.from(this.activePointers.values()), E = De(y, x);
|
|
1001
|
+
if (this.lastDistance !== null && this.lastDistance > 0) {
|
|
1002
|
+
const S = E / this.lastDistance;
|
|
1003
|
+
e.scale(e.scaleVal * S, {
|
|
1004
|
+
x: (y.x + x.x) / 2,
|
|
1005
|
+
y: (y.y + x.y) / 2
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
return this.lastDistance = E, !0;
|
|
1009
|
+
}
|
|
1010
|
+
return !1;
|
|
1011
|
+
},
|
|
1012
|
+
handlePointerUp(f) {
|
|
1013
|
+
f.pointerType === "touch" && (this.activePointers.delete(f.pointerId), this.activePointers.size < 2 && (this.lastDistance = null));
|
|
1014
|
+
},
|
|
1015
|
+
clear() {
|
|
1016
|
+
this.activePointers.clear(), this.lastDistance = null;
|
|
1017
|
+
}
|
|
1018
|
+
}, c = mt(e), r = {
|
|
962
1019
|
timer: null,
|
|
963
1020
|
startPos: null,
|
|
964
|
-
target: null,
|
|
965
1021
|
pointerId: null,
|
|
966
1022
|
DURATION: 500,
|
|
967
1023
|
MOVE_THRESHOLD: 10,
|
|
968
1024
|
clear() {
|
|
969
|
-
this.timer !== null && (clearTimeout(this.timer), this.timer = null, this.startPos = null, this.
|
|
1025
|
+
this.timer !== null && (clearTimeout(this.timer), this.timer = null, this.startPos = null, this.pointerId = null);
|
|
970
1026
|
},
|
|
971
|
-
start(
|
|
1027
|
+
start(f, y) {
|
|
972
1028
|
this.timer = window.setTimeout(() => {
|
|
973
|
-
y(
|
|
974
|
-
}, this.DURATION), this.startPos = { x:
|
|
1029
|
+
y(f), this.timer = null, this.startPos = null, this.pointerId = null;
|
|
1030
|
+
}, this.DURATION), this.startPos = { x: f.clientX, y: f.clientY }, this.pointerId = f.pointerId;
|
|
975
1031
|
},
|
|
976
|
-
handleMove(
|
|
977
|
-
if (this.timer !== null && this.startPos !== null &&
|
|
978
|
-
const y =
|
|
979
|
-
Math.sqrt(y * y +
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
}, a = (d, y) => {
|
|
983
|
-
d.hasPointerCapture && d.hasPointerCapture(y) && d.releasePointerCapture(y);
|
|
984
|
-
}, h = (d, y) => {
|
|
985
|
-
if (d.id === "input-box" || d.closest("#input-box")) return !1;
|
|
986
|
-
const w = d.closest(".svg-label");
|
|
987
|
-
if (w) {
|
|
988
|
-
const S = w.dataset.svgId, D = w.dataset.type, j = document.getElementById(S);
|
|
989
|
-
if (j) {
|
|
990
|
-
if (D === "arrow")
|
|
991
|
-
return y ? e.editArrowLabel(j) : e.selectArrow(j), !0;
|
|
992
|
-
if (D === "summary")
|
|
993
|
-
return y ? e.editSummary(j) : e.selectSummary(j), !0;
|
|
1032
|
+
handleMove(f) {
|
|
1033
|
+
if (this.timer !== null && this.startPos !== null && f.pointerId === this.pointerId) {
|
|
1034
|
+
const y = f.clientX - this.startPos.x, x = f.clientY - this.startPos.y;
|
|
1035
|
+
Math.sqrt(y * y + x * x) > this.MOVE_THRESHOLD && this.clear();
|
|
994
1036
|
}
|
|
995
1037
|
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
return y ? e.editSummary(S) : e.selectSummary(S), !0;
|
|
1005
|
-
}
|
|
1006
|
-
return !1;
|
|
1007
|
-
}, f = (d) => {
|
|
1008
|
-
if (d.pointerType === "mouse" && d.button !== 0) return;
|
|
1038
|
+
}, a = (f, y) => {
|
|
1039
|
+
if (f.closest("#input-box")) return !1;
|
|
1040
|
+
const x = f.closest(".svg-label"), E = f.closest(".topiclinks, .summary"), S = x ? { type: x.dataset.type, element: document.getElementById(x.dataset.svgId) } : E ? { type: E.classList.contains("topiclinks") ? "arrow" : "summary", element: f.closest("g") } : null;
|
|
1041
|
+
if (!S?.type || !S?.element) return !1;
|
|
1042
|
+
const { type: T, element: _ } = S;
|
|
1043
|
+
return e.clearSelection(), T === "arrow" ? y ? e.editArrowLabel(_) : e.selectArrow(_) : y ? e.editSummary(_) : e.selectSummary(_), !0;
|
|
1044
|
+
}, d = (f) => {
|
|
1045
|
+
if (f.pointerType === "mouse" && f.button !== 0) return;
|
|
1009
1046
|
if (e.helper1?.moved) {
|
|
1010
1047
|
e.helper1.clear();
|
|
1011
1048
|
return;
|
|
@@ -1020,117 +1057,97 @@ function An(e) {
|
|
|
1020
1057
|
}
|
|
1021
1058
|
if (c?.isDragging)
|
|
1022
1059
|
return;
|
|
1023
|
-
const y =
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
else if (!e.editable)
|
|
1027
|
-
return;
|
|
1028
|
-
h(y, !1);
|
|
1029
|
-
}, u = (d) => {
|
|
1060
|
+
const y = f.target;
|
|
1061
|
+
y.tagName === "ME-EPD" && (f.ctrlKey || f.metaKey ? e.expandNodeAll(y.previousSibling) : e.expandNode(y.previousSibling));
|
|
1062
|
+
}, h = (f) => {
|
|
1030
1063
|
if (!e.editable) return;
|
|
1031
|
-
const y =
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
const [S, D] = Array.from(l.values());
|
|
1036
|
-
i = De(S, D), r.clear();
|
|
1037
|
-
}
|
|
1038
|
-
t.moved = !1;
|
|
1039
|
-
const y = d.target, w = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
1040
|
-
if (e.editable && (d.button === 0 || d.pointerType === "touch") && V(y)) {
|
|
1041
|
-
e.selection?.cancel();
|
|
1042
|
-
const S = e.currentNodes || [];
|
|
1043
|
-
if (d.ctrlKey || d.metaKey)
|
|
1044
|
-
if (S.includes(y)) {
|
|
1045
|
-
e.selection?.deselect(y);
|
|
1046
|
-
return;
|
|
1047
|
-
} else
|
|
1048
|
-
e.selection?.select(y);
|
|
1049
|
-
else S.includes(y) || e.selectNode(y);
|
|
1050
|
-
}
|
|
1051
|
-
if (e.editable && (d.button === 0 || d.pointerType === "touch")) {
|
|
1052
|
-
if (d.pointerType === "touch" && l.size > 1)
|
|
1053
|
-
(c.isDragging || c.pointerId !== null) && ae(e, c);
|
|
1054
|
-
else if (d.pointerType === "touch" && l.size === 1)
|
|
1055
|
-
(V(y) || y.closest("me-tpc")) && r.start(d, (S) => {
|
|
1056
|
-
Me(e, c, S, !0) && (r.target && r.target.setPointerCapture(S.pointerId), Ue(c.ghost, S.clientX, S.clientY));
|
|
1057
|
-
});
|
|
1058
|
-
else if (d.pointerType === "mouse" && Me(e, c, d, !1)) {
|
|
1059
|
-
y.setPointerCapture(d.pointerId);
|
|
1060
|
-
return;
|
|
1061
|
-
}
|
|
1064
|
+
const y = f.target;
|
|
1065
|
+
if (te(y)) {
|
|
1066
|
+
e.selectNode(y), e.beginEdit(y);
|
|
1067
|
+
return;
|
|
1062
1068
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
const [y, w] = Array.from(l.values()), N = De(y, w);
|
|
1068
|
-
if (i == null)
|
|
1069
|
-
i = N;
|
|
1070
|
-
else {
|
|
1071
|
-
if (i > 0) {
|
|
1072
|
-
const M = N / i;
|
|
1073
|
-
e.scale(e.scaleVal * M, {
|
|
1074
|
-
x: (y.x + w.x) / 2,
|
|
1075
|
-
y: (y.y + w.y) / 2
|
|
1076
|
-
});
|
|
1077
|
-
}
|
|
1078
|
-
i = N;
|
|
1079
|
-
}
|
|
1069
|
+
a(y, !0);
|
|
1070
|
+
}, u = (f) => {
|
|
1071
|
+
if (f.pointerType === "touch" && l.handlePointerDown(f)) {
|
|
1072
|
+
e.ptState = i.Pinch, r.clear(), t.clear(), (c.isDragging || c.pointerId !== null) && Ae(e, c);
|
|
1080
1073
|
return;
|
|
1081
1074
|
}
|
|
1082
|
-
if (
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
t.x = d.clientX, t.y = d.clientY;
|
|
1075
|
+
if (e.ptState === i.Pinch) return;
|
|
1076
|
+
const y = f.target;
|
|
1077
|
+
if (y.className === "map-container" && f.button === 0 && f.pointerType === "mouse") {
|
|
1078
|
+
e.ptState = i.BoxSelect;
|
|
1079
|
+
return;
|
|
1088
1080
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1081
|
+
if (t.handlePointerDown(f), t.mousedown && (e.ptState = i.Pan), f.button === 0 || f.pointerType === "touch")
|
|
1082
|
+
if (te(y)) {
|
|
1083
|
+
e.selection?.cancel();
|
|
1084
|
+
const E = e.currentNodes || [];
|
|
1085
|
+
f.ctrlKey || f.metaKey || e.mobileMultiSelect ? E.includes(y) ? o = y : ((e.currentArrow || e.currentSummary) && e.clearSelection(), e.selection?.select(y)) : E.includes(y) || e.selectNode(y), f.pointerType === "touch" ? (e.ptState = i.DragWait, r.start(f, (T) => {
|
|
1086
|
+
Me(e, c, T, !0) && (e.ptState = i.Drag, y.setPointerCapture(T.pointerId));
|
|
1087
|
+
})) : Me(e, c, f, !1) && (e.ptState = i.Drag, y.setPointerCapture(f.pointerId));
|
|
1088
|
+
} else
|
|
1089
|
+
a(y, !1);
|
|
1090
|
+
}, b = (f) => {
|
|
1091
|
+
switch (e.ptState) {
|
|
1092
|
+
case i.Pinch:
|
|
1093
|
+
l.handlePointerMove(f);
|
|
1094
|
+
break;
|
|
1095
|
+
case i.DragWait:
|
|
1096
|
+
r.handleMove(f), r.timer === null && (e.ptState = i.Idle);
|
|
1097
|
+
break;
|
|
1098
|
+
case i.Drag:
|
|
1099
|
+
bt(e, c, f);
|
|
1100
|
+
break;
|
|
1101
|
+
case i.Pan:
|
|
1102
|
+
t.handlePointerMove(f);
|
|
1103
|
+
break;
|
|
1094
1104
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1105
|
+
}, v = (f) => {
|
|
1106
|
+
f.pointerType === "touch" && l.handlePointerUp(f);
|
|
1107
|
+
const y = c.isDragging, x = t.moved;
|
|
1108
|
+
switch (e.ptState) {
|
|
1109
|
+
case i.DragWait:
|
|
1110
|
+
r.clear();
|
|
1111
|
+
break;
|
|
1112
|
+
case i.Drag:
|
|
1113
|
+
vt(e, c, f);
|
|
1114
|
+
break;
|
|
1115
|
+
case i.Pan:
|
|
1116
|
+
t.handlePointerUp(f);
|
|
1117
|
+
break;
|
|
1098
1118
|
}
|
|
1099
|
-
|
|
1100
|
-
},
|
|
1101
|
-
r.clear(), t.
|
|
1102
|
-
},
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
V(y) && !y.classList.contains("selected") && e.selectNode(y), setTimeout(() => {
|
|
1108
|
-
e.panHelper.moved || e.bus.fire("showContextMenu", d);
|
|
1119
|
+
s.detect(f, h), (e.ptState !== i.Pinch || l.activePointers.size < 2) && (e.ptState = i.Idle), o && (!y && !x && e.selection?.deselect(o), o = null);
|
|
1120
|
+
}, p = () => {
|
|
1121
|
+
l.clear(), r.clear(), t.clear(), s.clear(), (c.isDragging || c.pointerId !== null) && Ae(e, c), e.ptState = i.Idle, o = null;
|
|
1122
|
+
}, g = (f) => {
|
|
1123
|
+
f.preventDefault(), f.button === 2 && e.editable && setTimeout(() => {
|
|
1124
|
+
if (e.panHelper.moved) return;
|
|
1125
|
+
const y = f.target;
|
|
1126
|
+
te(y) && !y.classList.contains("selected") && e.selectNode(y), e.bus.fire("showContextMenu", f);
|
|
1109
1127
|
}, 200);
|
|
1110
|
-
},
|
|
1111
|
-
if (
|
|
1112
|
-
if (
|
|
1113
|
-
e.move(-
|
|
1114
|
-
},
|
|
1115
|
-
|
|
1116
|
-
},
|
|
1117
|
-
|
|
1128
|
+
}, m = (f) => {
|
|
1129
|
+
if (f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey) return Dn(e, f);
|
|
1130
|
+
if (f.shiftKey) return e.move(-f.deltaY, 0);
|
|
1131
|
+
e.move(-f.deltaX, -f.deltaY);
|
|
1132
|
+
}, w = (f) => {
|
|
1133
|
+
f.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"));
|
|
1134
|
+
}, C = (f) => {
|
|
1135
|
+
f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
1118
1136
|
};
|
|
1119
1137
|
return qe([
|
|
1120
|
-
{ dom: n, evt: "pointerdown", func:
|
|
1121
|
-
{ dom: n, evt: "pointermove", func:
|
|
1122
|
-
{ dom: n, evt: "pointerup", func:
|
|
1123
|
-
{ dom: n, evt: "pointercancel", func:
|
|
1124
|
-
{ dom: n, evt: "click", func:
|
|
1125
|
-
{ dom: n, evt: "
|
|
1126
|
-
{ dom: n, evt: "
|
|
1127
|
-
{ dom: n, evt: "
|
|
1128
|
-
{ dom: n, evt: "
|
|
1129
|
-
{ dom: n, evt: "
|
|
1130
|
-
{ dom: n, evt: "keyup", func: T }
|
|
1138
|
+
{ dom: n, evt: "pointerdown", func: u },
|
|
1139
|
+
{ dom: n, evt: "pointermove", func: b },
|
|
1140
|
+
{ dom: n, evt: "pointerup", func: v },
|
|
1141
|
+
{ dom: n, evt: "pointercancel", func: p },
|
|
1142
|
+
{ dom: n, evt: "click", func: d },
|
|
1143
|
+
{ dom: n, evt: "contextmenu", func: g },
|
|
1144
|
+
{ dom: n, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : m },
|
|
1145
|
+
{ dom: n, evt: "blur", func: p },
|
|
1146
|
+
{ dom: n, evt: "keydown", func: w },
|
|
1147
|
+
{ dom: n, evt: "keyup", func: C }
|
|
1131
1148
|
]);
|
|
1132
1149
|
}
|
|
1133
|
-
function
|
|
1150
|
+
function An() {
|
|
1134
1151
|
return {
|
|
1135
1152
|
handlers: {},
|
|
1136
1153
|
addListener: function(e, t) {
|
|
@@ -1154,31 +1171,31 @@ function Mn() {
|
|
|
1154
1171
|
}
|
|
1155
1172
|
};
|
|
1156
1173
|
}
|
|
1157
|
-
const
|
|
1174
|
+
const M = "http://www.w3.org/2000/svg", re = function(e) {
|
|
1158
1175
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
1159
1176
|
let c = s;
|
|
1160
1177
|
l === "middle" ? c = s - t / 2 : l === "end" && (c = s - t), e.style.left = `${c}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
|
|
1161
|
-
},
|
|
1178
|
+
}, de = function(e, t, n, o) {
|
|
1162
1179
|
const { anchor: s = "middle", color: i, dataType: l, svgId: c } = o, r = document.createElement("div");
|
|
1163
1180
|
r.className = "svg-label", r.style.color = i || "#666";
|
|
1164
1181
|
const a = "label-" + c;
|
|
1165
1182
|
return r.id = a, r.innerHTML = e, r.dataset.type = l, r.dataset.svgId = c, r.dataset.x = t.toString(), r.dataset.y = n.toString(), r.dataset.anchor = s, r;
|
|
1166
1183
|
}, it = function(e, t, n) {
|
|
1167
|
-
const o = document.createElementNS(
|
|
1168
|
-
return
|
|
1184
|
+
const o = document.createElementNS(M, "path");
|
|
1185
|
+
return k(o, {
|
|
1169
1186
|
d: e,
|
|
1170
1187
|
stroke: t || "#666",
|
|
1171
1188
|
fill: "none",
|
|
1172
1189
|
"stroke-width": n
|
|
1173
1190
|
}), o;
|
|
1174
|
-
},
|
|
1175
|
-
const t = document.createElementNS(
|
|
1191
|
+
}, z = function(e) {
|
|
1192
|
+
const t = document.createElementNS(M, "svg");
|
|
1176
1193
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
1177
1194
|
}, je = function() {
|
|
1178
|
-
const e = document.createElementNS(
|
|
1195
|
+
const e = document.createElementNS(M, "line");
|
|
1179
1196
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
1180
|
-
},
|
|
1181
|
-
const s = document.createElementNS(
|
|
1197
|
+
}, Pn = function(e, t, n, o) {
|
|
1198
|
+
const s = document.createElementNS(M, "g");
|
|
1182
1199
|
return [
|
|
1183
1200
|
{
|
|
1184
1201
|
name: "line",
|
|
@@ -1193,25 +1210,27 @@ const O = "http://www.w3.org/2000/svg", le = function(e) {
|
|
|
1193
1210
|
d: n
|
|
1194
1211
|
}
|
|
1195
1212
|
].forEach((l, c) => {
|
|
1196
|
-
const r = l.d, a = document.createElementNS(
|
|
1213
|
+
const r = l.d, a = document.createElementNS(M, "path"), d = {
|
|
1197
1214
|
d: r,
|
|
1198
1215
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
1199
1216
|
fill: "none",
|
|
1200
1217
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
1201
1218
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
1202
1219
|
};
|
|
1203
|
-
o?.opacity !== void 0 && (
|
|
1204
|
-
const
|
|
1205
|
-
|
|
1220
|
+
o?.opacity !== void 0 && (d.opacity = String(o.opacity)), k(a, d), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
1221
|
+
const h = document.createElementNS(M, "path");
|
|
1222
|
+
k(h, {
|
|
1206
1223
|
d: r,
|
|
1207
1224
|
stroke: "transparent",
|
|
1208
1225
|
fill: "none",
|
|
1209
1226
|
"stroke-width": "15"
|
|
1210
|
-
}), s.appendChild(
|
|
1227
|
+
}), s.appendChild(h), s.appendChild(a), s[l.name] = a;
|
|
1211
1228
|
}), s;
|
|
1212
1229
|
}, rt = function(e, t, n) {
|
|
1213
1230
|
if (!t) return;
|
|
1214
|
-
const o = n.label
|
|
1231
|
+
const o = n.label;
|
|
1232
|
+
t.style.opacity = "0";
|
|
1233
|
+
const s = t.cloneNode(!0);
|
|
1215
1234
|
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
1216
1235
|
left:${t.style.left};
|
|
1217
1236
|
top:${t.style.top};
|
|
@@ -1226,7 +1245,7 @@ const O = "http://www.w3.org/2000/svg", le = function(e) {
|
|
|
1226
1245
|
}), s.addEventListener("blur", () => {
|
|
1227
1246
|
if (!s) return;
|
|
1228
1247
|
const i = s.innerText?.trim() || "";
|
|
1229
|
-
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label,
|
|
1248
|
+
i === "" ? n.label = o : n.label = i, t.style.opacity = "1", s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label, re(t), "parent" in n ? e.bus.fire("operation", {
|
|
1230
1249
|
name: "finishEditSummary",
|
|
1231
1250
|
obj: n
|
|
1232
1251
|
}) : e.bus.fire("operation", {
|
|
@@ -1234,32 +1253,32 @@ const O = "http://www.w3.org/2000/svg", le = function(e) {
|
|
|
1234
1253
|
obj: n
|
|
1235
1254
|
}));
|
|
1236
1255
|
});
|
|
1237
|
-
},
|
|
1256
|
+
}, On = function(e) {
|
|
1238
1257
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
|
|
1239
1258
|
this.lines.innerHTML = "";
|
|
1240
1259
|
for (let c = 0; c < l.length; c++) {
|
|
1241
|
-
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft:
|
|
1260
|
+
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = L(this.nodes, a), u = a.offsetWidth, b = a.offsetHeight, v = r.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: b, direction: v, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[c % g.length];
|
|
1242
1261
|
if (a.style.borderColor = m, this.lines.appendChild(it(p, m, "3")), e && e !== r)
|
|
1243
1262
|
continue;
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1263
|
+
const w = z("subLines"), C = r.lastChild;
|
|
1264
|
+
C.tagName === "svg" && C.remove(), r.appendChild(w), lt(this, w, m, r, v, !0);
|
|
1246
1265
|
}
|
|
1247
1266
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
1248
1267
|
}, lt = function(e, t, n, o, s, i) {
|
|
1249
1268
|
const l = o.firstChild, c = o.children[1].children;
|
|
1250
1269
|
if (c.length === 0) return;
|
|
1251
|
-
const r = l.offsetTop, a = l.offsetLeft,
|
|
1270
|
+
const r = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
|
|
1252
1271
|
for (let u = 0; u < c.length; u++) {
|
|
1253
|
-
const b = c[u], v = b.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth,
|
|
1254
|
-
t.appendChild(it(
|
|
1255
|
-
const
|
|
1256
|
-
if (
|
|
1257
|
-
if (!
|
|
1272
|
+
const b = c[u], v = b.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, w = v.offsetHeight, C = v.firstChild.nodeObj.branchColor || n, N = e.generateSubBranch({ pT: r, pL: a, pW: d, pH: h, cT: p, cL: g, cW: m, cH: w, direction: s, isFirst: i });
|
|
1273
|
+
t.appendChild(it(N, C, "2"));
|
|
1274
|
+
const f = v.children[1];
|
|
1275
|
+
if (f) {
|
|
1276
|
+
if (!f.expanded) continue;
|
|
1258
1277
|
} else
|
|
1259
1278
|
continue;
|
|
1260
|
-
lt(e, t,
|
|
1279
|
+
lt(e, t, C, b, s);
|
|
1261
1280
|
}
|
|
1262
|
-
},
|
|
1281
|
+
}, Hn = {
|
|
1263
1282
|
addChild: "Add child",
|
|
1264
1283
|
addParent: "Add parent",
|
|
1265
1284
|
addSibling: "Add sibling",
|
|
@@ -1273,76 +1292,76 @@ const O = "http://www.w3.org/2000/svg", le = function(e) {
|
|
|
1273
1292
|
clickTips: "Please click the target node",
|
|
1274
1293
|
summary: "Summary"
|
|
1275
1294
|
};
|
|
1276
|
-
function
|
|
1295
|
+
function $n(e, t) {
|
|
1277
1296
|
const n = {
|
|
1278
1297
|
focus: !0,
|
|
1279
1298
|
link: !0,
|
|
1280
|
-
locale:
|
|
1299
|
+
locale: Hn
|
|
1281
1300
|
};
|
|
1282
1301
|
t = t === !0 ? n : Object.assign(n, t);
|
|
1283
|
-
const o = (
|
|
1284
|
-
const
|
|
1285
|
-
return
|
|
1286
|
-
}, s = (
|
|
1287
|
-
const
|
|
1288
|
-
return
|
|
1289
|
-
}, i = t.locale, l = s("cm-add_child", i.addChild, "Tab"), c = s("cm-add_parent", i.addParent, "Ctrl + Enter"), r = s("cm-add_sibling", i.addSibling, "Enter"), a = s("cm-remove_child", i.removeNode, "Delete"),
|
|
1290
|
-
if (m.className = "menu-list", m.appendChild(l), m.appendChild(c), m.appendChild(r), m.appendChild(a), t.focus && (m.appendChild(
|
|
1291
|
-
for (let
|
|
1292
|
-
const
|
|
1293
|
-
m.appendChild(
|
|
1294
|
-
|
|
1302
|
+
const o = (y) => {
|
|
1303
|
+
const x = document.createElement("div");
|
|
1304
|
+
return x.innerText = y, x.className = "tips", x;
|
|
1305
|
+
}, s = (y, x, E) => {
|
|
1306
|
+
const S = document.createElement("li");
|
|
1307
|
+
return S.id = y, S.innerHTML = `<span>${ae(x)}</span><span ${E ? 'class="key"' : ""}>${ae(E)}</span>`, S;
|
|
1308
|
+
}, i = t.locale, l = s("cm-add_child", i.addChild, "Tab"), c = s("cm-add_parent", i.addParent, "Ctrl + Enter"), r = s("cm-add_sibling", i.addSibling, "Enter"), a = s("cm-remove_child", i.removeNode, "Delete"), d = s("cm-fucus", i.focus, ""), h = s("cm-unfucus", i.cancelFocus, ""), u = s("cm-up", i.moveUp, "PgUp"), b = s("cm-down", i.moveDown, "Pgdn"), v = s("cm-link", i.link, ""), p = s("cm-link-bidirectional", i.linkBidirectional, ""), g = s("cm-summary", i.summary, ""), m = document.createElement("ul");
|
|
1309
|
+
if (m.className = "menu-list", m.appendChild(l), m.appendChild(c), m.appendChild(r), m.appendChild(a), t.focus && (m.appendChild(d), m.appendChild(h)), m.appendChild(u), m.appendChild(b), m.appendChild(g), t.link && (m.appendChild(v), m.appendChild(p)), t && t.extend)
|
|
1310
|
+
for (let y = 0; y < t.extend.length; y++) {
|
|
1311
|
+
const x = t.extend[y], E = s(x.name, x.name, x.key || "");
|
|
1312
|
+
m.appendChild(E), E.onclick = (S) => {
|
|
1313
|
+
x.onclick(S);
|
|
1295
1314
|
};
|
|
1296
1315
|
}
|
|
1297
|
-
const
|
|
1298
|
-
|
|
1299
|
-
let
|
|
1300
|
-
const
|
|
1301
|
-
const
|
|
1302
|
-
if (
|
|
1303
|
-
|
|
1304
|
-
const
|
|
1305
|
-
|
|
1316
|
+
const w = document.createElement("div");
|
|
1317
|
+
w.className = "context-menu", w.appendChild(m), w.hidden = !0, e.container.append(w);
|
|
1318
|
+
let C = !0;
|
|
1319
|
+
const N = (y) => {
|
|
1320
|
+
const x = y.target;
|
|
1321
|
+
if (te(x)) {
|
|
1322
|
+
x.parentElement.tagName === "ME-ROOT" ? C = !0 : C = !1, C ? (d.className = "disabled", u.className = "disabled", b.className = "disabled", c.className = "disabled", r.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", b.className = "", c.className = "", r.className = "", a.className = ""), w.hidden = !1, m.style.top = "", m.style.bottom = "", m.style.left = "", m.style.right = "";
|
|
1323
|
+
const E = m.offsetHeight, S = m.offsetWidth, T = m.getBoundingClientRect(), _ = y.clientY - T.top, H = y.clientX - T.left;
|
|
1324
|
+
E + _ > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = _ + 15 + "px"), S + H > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = H + 10 + "px");
|
|
1306
1325
|
}
|
|
1307
1326
|
};
|
|
1308
|
-
e.bus.addListener("showContextMenu",
|
|
1309
|
-
|
|
1327
|
+
e.bus.addListener("showContextMenu", N), w.onclick = (y) => {
|
|
1328
|
+
y.target === w && (w.hidden = !0);
|
|
1310
1329
|
}, l.onclick = () => {
|
|
1311
|
-
e.addChild(),
|
|
1330
|
+
e.addChild(), w.hidden = !0;
|
|
1312
1331
|
}, c.onclick = () => {
|
|
1313
|
-
e.insertParent(),
|
|
1332
|
+
e.insertParent(), w.hidden = !0;
|
|
1314
1333
|
}, r.onclick = () => {
|
|
1315
|
-
|
|
1334
|
+
C || (e.insertSibling("after"), w.hidden = !0);
|
|
1316
1335
|
}, a.onclick = () => {
|
|
1317
|
-
|
|
1336
|
+
C || (e.removeNodes(e.currentNodes || []), w.hidden = !0);
|
|
1337
|
+
}, d.onclick = () => {
|
|
1338
|
+
C || (e.focusNode(e.currentNode), w.hidden = !0);
|
|
1318
1339
|
}, h.onclick = () => {
|
|
1319
|
-
|
|
1320
|
-
}, f.onclick = () => {
|
|
1321
|
-
e.cancelFocus(), x.hidden = !0;
|
|
1340
|
+
e.cancelFocus(), w.hidden = !0;
|
|
1322
1341
|
}, u.onclick = () => {
|
|
1323
|
-
|
|
1342
|
+
C || (e.moveUpNode(), w.hidden = !0);
|
|
1324
1343
|
}, b.onclick = () => {
|
|
1325
|
-
|
|
1344
|
+
C || (e.moveDownNode(), w.hidden = !0);
|
|
1326
1345
|
};
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1329
|
-
const
|
|
1330
|
-
e.container.appendChild(
|
|
1346
|
+
const f = (y) => {
|
|
1347
|
+
w.hidden = !0;
|
|
1348
|
+
const x = e.currentNode, E = o(i.clickTips);
|
|
1349
|
+
e.container.appendChild(E), e.map.addEventListener(
|
|
1331
1350
|
"click",
|
|
1332
|
-
(
|
|
1333
|
-
|
|
1334
|
-
const
|
|
1335
|
-
(
|
|
1351
|
+
(S) => {
|
|
1352
|
+
S.preventDefault(), E.remove();
|
|
1353
|
+
const T = S.target;
|
|
1354
|
+
(T.parentElement.tagName === "ME-PARENT" || T.parentElement.tagName === "ME-ROOT") && e.createArrow(x, T, y);
|
|
1336
1355
|
},
|
|
1337
1356
|
{
|
|
1338
1357
|
once: !0
|
|
1339
1358
|
}
|
|
1340
1359
|
);
|
|
1341
1360
|
};
|
|
1342
|
-
return v.onclick = () =>
|
|
1343
|
-
|
|
1361
|
+
return v.onclick = () => f(), p.onclick = () => f({ bidirectional: !0 }), g.onclick = () => {
|
|
1362
|
+
w.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
1344
1363
|
}, () => {
|
|
1345
|
-
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null,
|
|
1364
|
+
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, b.onclick = null, v.onclick = null, g.onclick = null, w.onclick = null, e.container.oncontextmenu = null;
|
|
1346
1365
|
};
|
|
1347
1366
|
}
|
|
1348
1367
|
const jn = function(e) {
|
|
@@ -1389,14 +1408,14 @@ function In(e) {
|
|
|
1389
1408
|
const i = function(r) {
|
|
1390
1409
|
if (r.name === "beginEdit") return;
|
|
1391
1410
|
t = t.slice(0, n + 1);
|
|
1392
|
-
const a = e.getData(),
|
|
1411
|
+
const a = e.getData(), d = {
|
|
1393
1412
|
prev: o,
|
|
1394
1413
|
operation: r.name,
|
|
1395
|
-
currentSelected: s.map((
|
|
1414
|
+
currentSelected: s.map((h) => h.id),
|
|
1396
1415
|
currentTarget: jn(r),
|
|
1397
1416
|
next: a
|
|
1398
1417
|
};
|
|
1399
|
-
t.push(
|
|
1418
|
+
t.push(d), o = a, n = t.length - 1;
|
|
1400
1419
|
}, l = function(r) {
|
|
1401
1420
|
(r.metaKey || r.ctrlKey) && (r.shiftKey && r.key === "Z" || r.key === "y") ? e.redo() : (r.metaKey || r.ctrlKey) && r.key === "z" && e.undo();
|
|
1402
1421
|
}, c = function() {
|
|
@@ -1406,33 +1425,33 @@ function In(e) {
|
|
|
1406
1425
|
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", c), e.container.removeEventListener("keydown", l);
|
|
1407
1426
|
};
|
|
1408
1427
|
}
|
|
1409
|
-
const Rn = '<?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>', Bn = '<?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>', Wn = '<?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>', Yn = '<?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>', Xn = '<?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>', Fn = '<?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>',
|
|
1428
|
+
const Rn = '<?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>', Bn = '<?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>', Wn = '<?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>', Yn = '<?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>', Xn = '<?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>', Fn = '<?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>', Kn = '<?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>', Vn = {
|
|
1410
1429
|
side: Rn,
|
|
1411
1430
|
left: Bn,
|
|
1412
1431
|
right: Wn,
|
|
1413
1432
|
full: Yn,
|
|
1414
1433
|
living: Xn,
|
|
1415
1434
|
zoomin: Fn,
|
|
1416
|
-
zoomout:
|
|
1417
|
-
},
|
|
1435
|
+
zoomout: Kn
|
|
1436
|
+
}, I = (e, t) => {
|
|
1418
1437
|
const n = document.createElement("span");
|
|
1419
|
-
return n.id = e, n.innerHTML =
|
|
1438
|
+
return n.id = e, n.innerHTML = Vn[t], n;
|
|
1420
1439
|
};
|
|
1421
|
-
function
|
|
1422
|
-
const t = document.createElement("div"), n =
|
|
1440
|
+
function zn(e) {
|
|
1441
|
+
const t = document.createElement("div"), n = I("fullscreen", "full"), o = I("toCenter", "living"), s = I("zoomout", "zoomout"), i = I("zoomin", "zoomin");
|
|
1423
1442
|
t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
|
|
1424
1443
|
let l = null;
|
|
1425
1444
|
const c = () => {
|
|
1426
|
-
const a = e.container.getBoundingClientRect(),
|
|
1445
|
+
const a = e.container.getBoundingClientRect(), d = ye(e.map.style.transform), h = a.width / 2, u = a.height / 2, b = (h - d.x) / e.scaleVal, v = (u - d.y) / e.scaleVal;
|
|
1427
1446
|
l = {
|
|
1428
1447
|
containerRect: a,
|
|
1429
|
-
currentTransform:
|
|
1448
|
+
currentTransform: d,
|
|
1430
1449
|
mapCenterX: b,
|
|
1431
1450
|
mapCenterY: v
|
|
1432
1451
|
};
|
|
1433
1452
|
}, r = () => {
|
|
1434
1453
|
if (l) {
|
|
1435
|
-
const a = e.container.getBoundingClientRect(),
|
|
1454
|
+
const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal, b = h - l.mapCenterY * e.scaleVal, v = u - l.currentTransform.x, p = b - l.currentTransform.y;
|
|
1436
1455
|
e.move(v, p);
|
|
1437
1456
|
}
|
|
1438
1457
|
};
|
|
@@ -1446,8 +1465,8 @@ function Kn(e) {
|
|
|
1446
1465
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1447
1466
|
}, t;
|
|
1448
1467
|
}
|
|
1449
|
-
function
|
|
1450
|
-
const t = document.createElement("div"), n =
|
|
1468
|
+
function Gn(e) {
|
|
1469
|
+
const t = document.createElement("div"), n = I("tbltl", "left"), o = I("tbltr", "right"), s = I("tblts", "side");
|
|
1451
1470
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1452
1471
|
e.initLeft();
|
|
1453
1472
|
}, o.onclick = () => {
|
|
@@ -1457,7 +1476,7 @@ function Vn(e) {
|
|
|
1457
1476
|
}, t;
|
|
1458
1477
|
}
|
|
1459
1478
|
function qn(e) {
|
|
1460
|
-
e.container.append(
|
|
1479
|
+
e.container.append(zn(e)), e.container.append(Gn(e));
|
|
1461
1480
|
}
|
|
1462
1481
|
class Un {
|
|
1463
1482
|
_listeners = /* @__PURE__ */ new Map();
|
|
@@ -1482,7 +1501,7 @@ class Un {
|
|
|
1482
1501
|
off = this.removeEventListener;
|
|
1483
1502
|
emit = this.dispatchEvent;
|
|
1484
1503
|
}
|
|
1485
|
-
const Ie = (e, t = "px") => typeof e == "number" ? e + t : e,
|
|
1504
|
+
const Ie = (e, t = "px") => typeof e == "number" ? e + t : e, $ = ({ style: e }, t, n) => {
|
|
1486
1505
|
if (typeof t == "object")
|
|
1487
1506
|
for (const [o, s] of Object.entries(t))
|
|
1488
1507
|
s !== void 0 && (e[o] = Ie(s));
|
|
@@ -1513,16 +1532,16 @@ const Ie = (e, t = "px") => typeof e == "number" ? e + t : e, I = ({ style: e },
|
|
|
1513
1532
|
case "touch":
|
|
1514
1533
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1515
1534
|
}
|
|
1516
|
-
}, Zn = () => matchMedia("(hover: none), (pointer: coarse)").matches, Qn = () => "safari" in window,
|
|
1517
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1535
|
+
}, Zn = () => matchMedia("(hover: none), (pointer: coarse)").matches, Qn = () => "safari" in window, he = (e) => Array.isArray(e) ? e : [e], ct = (e) => (t, n, o, s = {}) => {
|
|
1536
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = he(n), t = he(t);
|
|
1518
1537
|
for (const i of t)
|
|
1519
1538
|
if (i)
|
|
1520
1539
|
for (const l of n)
|
|
1521
1540
|
i[e](l, o, { capture: !1, ...s });
|
|
1522
|
-
},
|
|
1541
|
+
}, W = ct("addEventListener"), P = ct("removeEventListener"), J = (e) => {
|
|
1523
1542
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1524
1543
|
return { x: t, y: n, target: o };
|
|
1525
|
-
},
|
|
1544
|
+
}, Y = (e, t = document) => he(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), eo = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1526
1545
|
switch (o) {
|
|
1527
1546
|
case "alt":
|
|
1528
1547
|
return e.altKey;
|
|
@@ -1531,7 +1550,7 @@ const Ie = (e, t = "px") => typeof e == "number" ? e + t : e, I = ({ style: e },
|
|
|
1531
1550
|
case "shift":
|
|
1532
1551
|
return e.shiftKey;
|
|
1533
1552
|
}
|
|
1534
|
-
}) : !1), { abs:
|
|
1553
|
+
}) : !1), { abs: j, max: We, min: Ye, ceil: Xe } = Math, Fe = (e = []) => ({
|
|
1535
1554
|
stored: e,
|
|
1536
1555
|
selected: [],
|
|
1537
1556
|
touched: [],
|
|
@@ -1607,12 +1626,12 @@ class to extends Un {
|
|
|
1607
1626
|
for (const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1608
1627
|
typeof this[i] == "function" && (this[i] = this[i].bind(this));
|
|
1609
1628
|
const { document: n, selectionAreaClass: o, selectionContainerClass: s } = this._options;
|
|
1610
|
-
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s),
|
|
1629
|
+
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s), $(this._area, {
|
|
1611
1630
|
willChange: "top, left, bottom, right, width, height",
|
|
1612
1631
|
top: 0,
|
|
1613
1632
|
left: 0,
|
|
1614
1633
|
position: "fixed"
|
|
1615
|
-
}),
|
|
1634
|
+
}), $(this._clippingElement, {
|
|
1616
1635
|
overflow: "hidden",
|
|
1617
1636
|
position: "fixed",
|
|
1618
1637
|
transform: "translate3d(0, 0, 0)",
|
|
@@ -1624,27 +1643,27 @@ class to extends Un {
|
|
|
1624
1643
|
}), this.enable();
|
|
1625
1644
|
}
|
|
1626
1645
|
_toggleStartEvents(t = !0) {
|
|
1627
|
-
const { document: n
|
|
1628
|
-
|
|
1646
|
+
const { document: n } = this._options;
|
|
1647
|
+
(t ? W : P)(n, "pointerdown", this._onTapStart);
|
|
1629
1648
|
}
|
|
1630
1649
|
_onTapStart(t, n = !1) {
|
|
1631
|
-
const { x: o, y: s, target: i } =
|
|
1632
|
-
if (
|
|
1650
|
+
const { x: o, y: s, target: i } = J(t), { document: l, startAreas: c, boundaries: r, behaviour: a, features: d } = this._options, h = i.getBoundingClientRect();
|
|
1651
|
+
if (!eo(t, a.triggers))
|
|
1633
1652
|
return;
|
|
1634
|
-
const u =
|
|
1635
|
-
this._targetElement = b.find((m) => Be(m.getBoundingClientRect(),
|
|
1653
|
+
const u = Y(c, l), b = Y(r, l);
|
|
1654
|
+
this._targetElement = b.find((m) => Be(m.getBoundingClientRect(), h));
|
|
1636
1655
|
const v = t.composedPath(), p = u.find((m) => v.includes(m));
|
|
1637
1656
|
if (this._targetBoundary = b.find((m) => v.includes(m)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1638
1657
|
return;
|
|
1639
1658
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1640
1659
|
const g = l.scrollingElement ?? l.body;
|
|
1641
|
-
this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0),
|
|
1660
|
+
this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), W(l, ["pointermove"], this._delayedTapMove, { passive: !1 }), W(l, ["pointerup", "pointercancel"], this._onTapStop), W(l, "scroll", this._onScroll), d.deselectOnBlur && (this._targetBoundaryScrolled = !1, W(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1642
1661
|
}
|
|
1643
1662
|
_onSingleTap(t) {
|
|
1644
1663
|
const {
|
|
1645
1664
|
singleTap: { intersect: n },
|
|
1646
1665
|
range: o
|
|
1647
|
-
} = this._options.features, s =
|
|
1666
|
+
} = this._options.features, s = J(t);
|
|
1648
1667
|
let i;
|
|
1649
1668
|
if (n === "native")
|
|
1650
1669
|
i = s.target;
|
|
@@ -1652,8 +1671,8 @@ class to extends Un {
|
|
|
1652
1671
|
this.resolveSelectables();
|
|
1653
1672
|
const { x: c, y: r } = s;
|
|
1654
1673
|
i = this._selectables.find((a) => {
|
|
1655
|
-
const { right:
|
|
1656
|
-
return c <
|
|
1674
|
+
const { right: d, left: h, top: u, bottom: b } = a.getBoundingClientRect();
|
|
1675
|
+
return c < d && c > h && r < b && r > u;
|
|
1657
1676
|
});
|
|
1658
1677
|
}
|
|
1659
1678
|
if (!i)
|
|
@@ -1667,12 +1686,12 @@ class to extends Un {
|
|
|
1667
1686
|
}
|
|
1668
1687
|
const { stored: l } = this._selection;
|
|
1669
1688
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1670
|
-
const c = this._latestElement, [r, a] = c.compareDocumentPosition(i) & 4 ? [i, c] : [c, i],
|
|
1671
|
-
...this._selectables.filter((
|
|
1689
|
+
const c = this._latestElement, [r, a] = c.compareDocumentPosition(i) & 4 ? [i, c] : [c, i], d = [
|
|
1690
|
+
...this._selectables.filter((h) => h.compareDocumentPosition(r) & 4 && h.compareDocumentPosition(a) & 2),
|
|
1672
1691
|
r,
|
|
1673
1692
|
a
|
|
1674
1693
|
];
|
|
1675
|
-
this.select(
|
|
1694
|
+
this.select(d), this._latestElement = c;
|
|
1676
1695
|
} else l.includes(i) && (l.length === 1 || t.ctrlKey || l.every((c) => this._selection.stored.includes(c))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
|
|
1677
1696
|
}
|
|
1678
1697
|
_delayedTapMove(t) {
|
|
@@ -1680,42 +1699,42 @@ class to extends Un {
|
|
|
1680
1699
|
container: n,
|
|
1681
1700
|
document: o,
|
|
1682
1701
|
behaviour: { startThreshold: s }
|
|
1683
|
-
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } =
|
|
1702
|
+
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } = J(t);
|
|
1684
1703
|
if (
|
|
1685
1704
|
// Single number for both coordinates
|
|
1686
|
-
typeof s == "number" &&
|
|
1687
|
-
typeof s == "object" &&
|
|
1705
|
+
typeof s == "number" && j(c + r - (i + l)) >= s || // Different x and y threshold
|
|
1706
|
+
typeof s == "object" && j(c - i) >= s.x || j(r - l) >= s.y
|
|
1688
1707
|
) {
|
|
1689
|
-
if (
|
|
1690
|
-
|
|
1708
|
+
if (P(o, ["pointermove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1709
|
+
P(o, ["pointerup", "pointercancel"], this._onTapStop);
|
|
1691
1710
|
return;
|
|
1692
1711
|
}
|
|
1693
|
-
|
|
1712
|
+
W(o, ["pointermove"], this._onTapMove, { passive: !1 }), $(this._area, "display", "block"), Y(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
1694
1713
|
}
|
|
1695
1714
|
this._handleMoveEvent(t);
|
|
1696
1715
|
}
|
|
1697
1716
|
_setupSelectionArea() {
|
|
1698
1717
|
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
1699
|
-
this._scrollAvailable ? (
|
|
1718
|
+
this._scrollAvailable ? ($(t, {
|
|
1700
1719
|
top: s.top,
|
|
1701
1720
|
left: s.left,
|
|
1702
1721
|
width: s.width,
|
|
1703
1722
|
height: s.height
|
|
1704
|
-
}),
|
|
1723
|
+
}), $(o, {
|
|
1705
1724
|
marginTop: -s.top,
|
|
1706
1725
|
marginLeft: -s.left
|
|
1707
|
-
})) : (
|
|
1726
|
+
})) : ($(t, {
|
|
1708
1727
|
top: 0,
|
|
1709
1728
|
left: 0,
|
|
1710
1729
|
width: "100%",
|
|
1711
1730
|
height: "100%"
|
|
1712
|
-
}),
|
|
1731
|
+
}), $(o, {
|
|
1713
1732
|
marginTop: 0,
|
|
1714
1733
|
marginLeft: 0
|
|
1715
1734
|
}));
|
|
1716
1735
|
}
|
|
1717
1736
|
_onTapMove(t) {
|
|
1718
|
-
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling, { x: c, y: r } =
|
|
1737
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling, { x: c, y: r } = J(t);
|
|
1719
1738
|
if (o.x2 = c, o.y2 = r, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1720
1739
|
this._scrollingActive = !0;
|
|
1721
1740
|
const a = () => {
|
|
@@ -1723,10 +1742,10 @@ class to extends Un {
|
|
|
1723
1742
|
this._scrollingActive = !1;
|
|
1724
1743
|
return;
|
|
1725
1744
|
}
|
|
1726
|
-
const
|
|
1727
|
-
if (
|
|
1728
|
-
const
|
|
1729
|
-
(
|
|
1745
|
+
const d = this._options.mindElixirInstance;
|
|
1746
|
+
if (d && d.move) {
|
|
1747
|
+
const h = n.x ? Xe(n.x / l) : 0, u = n.y ? Xe(n.y / l) : 0;
|
|
1748
|
+
(h || u) && (d.move(-h, -u), o.x1 -= h, o.y1 -= u);
|
|
1730
1749
|
}
|
|
1731
1750
|
i.next(t), requestAnimationFrame(a);
|
|
1732
1751
|
};
|
|
@@ -1747,19 +1766,19 @@ class to extends Un {
|
|
|
1747
1766
|
this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1748
1767
|
}
|
|
1749
1768
|
_onStartAreaScroll() {
|
|
1750
|
-
this._targetBoundaryScrolled = !0,
|
|
1769
|
+
this._targetBoundaryScrolled = !0, P(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1751
1770
|
}
|
|
1752
1771
|
_recalculateSelectionAreaRect() {
|
|
1753
1772
|
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, i = this._targetRect, { x1: l, y1: c } = n;
|
|
1754
1773
|
let { x2: r, y2: a } = n;
|
|
1755
1774
|
const {
|
|
1756
1775
|
behaviour: {
|
|
1757
|
-
scrolling: { startScrollMargins:
|
|
1776
|
+
scrolling: { startScrollMargins: d }
|
|
1758
1777
|
}
|
|
1759
1778
|
} = s;
|
|
1760
|
-
r < i.left +
|
|
1761
|
-
const
|
|
1762
|
-
this._areaRect = Re(
|
|
1779
|
+
r < i.left + d.x ? (t.x = -j(i.left - r + d.x), r = r < i.left ? i.left : r) : r > i.right - d.x ? (t.x = j(i.left + i.width - r - d.x), r = r > i.right ? i.right : r) : t.x = 0, a < i.top + d.y ? (t.y = -j(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = j(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
|
|
1780
|
+
const h = Ye(l, r), u = Ye(c, a), b = We(l, r), v = We(c, a);
|
|
1781
|
+
this._areaRect = Re(h, u, b - h, v - u);
|
|
1763
1782
|
}
|
|
1764
1783
|
_redrawSelectionArea() {
|
|
1765
1784
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1767,32 +1786,32 @@ class to extends Un {
|
|
|
1767
1786
|
}
|
|
1768
1787
|
_onTapStop(t, n) {
|
|
1769
1788
|
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1770
|
-
|
|
1789
|
+
P(this._targetElement, "scroll", this._onStartAreaScroll), P(o, ["pointermove"], this._delayedTapMove), P(o, ["pointermove"], this._onTapMove), P(o, ["pointerup", "pointercancel"], this._onTapStop), P(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, this._clippingElement.remove(), this._frame?.cancel(), $(this._area, "display", "none");
|
|
1771
1790
|
}
|
|
1772
1791
|
_updateElementSelection() {
|
|
1773
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: c } = o, { intersect: r, overlap: a } = n.behaviour,
|
|
1792
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: c } = o, { intersect: r, overlap: a } = n.behaviour, d = a === "invert", h = [], u = [], b = [];
|
|
1774
1793
|
for (let p = 0; p < t.length; p++) {
|
|
1775
1794
|
const g = t[p];
|
|
1776
1795
|
if (Be(s, g.getBoundingClientRect(), r)) {
|
|
1777
1796
|
if (l.includes(g))
|
|
1778
1797
|
i.includes(g) && !c.includes(g) && c.push(g);
|
|
1779
|
-
else if (
|
|
1798
|
+
else if (d && i.includes(g)) {
|
|
1780
1799
|
b.push(g);
|
|
1781
1800
|
continue;
|
|
1782
1801
|
} else
|
|
1783
1802
|
u.push(g);
|
|
1784
|
-
|
|
1803
|
+
h.push(g);
|
|
1785
1804
|
}
|
|
1786
1805
|
}
|
|
1787
|
-
|
|
1806
|
+
d && u.push(...i.filter((p) => !l.includes(p)));
|
|
1788
1807
|
const v = a === "keep";
|
|
1789
1808
|
for (let p = 0; p < l.length; p++) {
|
|
1790
1809
|
const g = l[p];
|
|
1791
|
-
!
|
|
1810
|
+
!h.includes(g) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1792
1811
|
// not make them part of the current selection as soon as they're touched.
|
|
1793
1812
|
(v && i.includes(g)) && b.push(g);
|
|
1794
1813
|
}
|
|
1795
|
-
o.selected =
|
|
1814
|
+
o.selected = h, o.changed = { added: u, removed: b }, this._latestElement = void 0;
|
|
1796
1815
|
}
|
|
1797
1816
|
_emitEvent(t, n) {
|
|
1798
1817
|
return this.emit(t, {
|
|
@@ -1832,7 +1851,7 @@ class to extends Un {
|
|
|
1832
1851
|
}
|
|
1833
1852
|
/**
|
|
1834
1853
|
* Manually triggers the start of a selection
|
|
1835
|
-
* @param evt A
|
|
1854
|
+
* @param evt A PointerEvent-like object
|
|
1836
1855
|
* @param silent If beforestart should be fired
|
|
1837
1856
|
*/
|
|
1838
1857
|
trigger(t, n = !0) {
|
|
@@ -1843,7 +1862,7 @@ class to extends Un {
|
|
|
1843
1862
|
* Will update everything that can be selected
|
|
1844
1863
|
*/
|
|
1845
1864
|
resolveSelectables() {
|
|
1846
|
-
this._selectables =
|
|
1865
|
+
this._selectables = Y(this._options.selectables, this._options.document);
|
|
1847
1866
|
}
|
|
1848
1867
|
/**
|
|
1849
1868
|
* Same as deselecting, but for all elements currently selected
|
|
@@ -1912,7 +1931,7 @@ class to extends Un {
|
|
|
1912
1931
|
* @param quiet If this should not trigger the move event
|
|
1913
1932
|
*/
|
|
1914
1933
|
select(t, n = !1) {
|
|
1915
|
-
const { changed: o, selected: s, stored: i } = this._selection, l =
|
|
1934
|
+
const { changed: o, selected: s, stored: i } = this._selection, l = Y(t, this._options.document).filter((c) => !s.includes(c) && !i.includes(c));
|
|
1916
1935
|
return i.push(...l), s.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
|
|
1917
1936
|
}
|
|
1918
1937
|
/**
|
|
@@ -1921,7 +1940,7 @@ class to extends Un {
|
|
|
1921
1940
|
* @param quiet If this should not trigger the move event
|
|
1922
1941
|
*/
|
|
1923
1942
|
deselect(t, n = !1) {
|
|
1924
|
-
const { selected: o, stored: s, changed: i } = this._selection, l =
|
|
1943
|
+
const { selected: o, stored: s, changed: i } = this._selection, l = Y(t, this._options.document).filter((c) => o.includes(c) || s.includes(c));
|
|
1925
1944
|
this._selection.stored = s.filter((c) => !l.includes(c)), this._selection.selected = o.filter((c) => !l.includes(c)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((c) => !i.removed.includes(c))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
1926
1945
|
}
|
|
1927
1946
|
}
|
|
@@ -1949,17 +1968,13 @@ function no(e) {
|
|
|
1949
1968
|
}
|
|
1950
1969
|
}
|
|
1951
1970
|
}).on("beforestart", ({ event: o }) => {
|
|
1952
|
-
if (!e.editable || e.spacePressed) return !1;
|
|
1971
|
+
if (!e.editable || e.spacePressed || e.ptState !== 5) return !1;
|
|
1953
1972
|
const s = o.target;
|
|
1954
|
-
if (s.id === "input-box" || s.className === "circle" ||
|
|
1973
|
+
if (s.id === "input-box" || s.className === "circle" || s.className !== "map-container")
|
|
1955
1974
|
return !1;
|
|
1956
|
-
|
|
1957
|
-
if (s.tagName === "ME-TPC" && s.classList.contains("selected"))
|
|
1958
|
-
return !1;
|
|
1959
|
-
e.clearSelection();
|
|
1960
|
-
}
|
|
1975
|
+
!o.ctrlKey && !o.metaKey && e.clearSelection();
|
|
1961
1976
|
const i = n.getSelectionArea();
|
|
1962
|
-
return i.style.background = "#4f90f22d", i.style.border = "1px solid #4f90f2", i.parentElement && (i.parentElement.style.zIndex = "9999"), !0;
|
|
1977
|
+
return i.style.background = "#4f90f22d", i.style.border = "1px solid #4f90f2", i.style.borderRadius = "3px", i.parentElement && (i.parentElement.style.zIndex = "9999"), !0;
|
|
1963
1978
|
}).on(
|
|
1964
1979
|
"move",
|
|
1965
1980
|
({
|
|
@@ -1996,7 +2011,7 @@ function no(e) {
|
|
|
1996
2011
|
const oo = function(e, t = !0) {
|
|
1997
2012
|
this.theme = e;
|
|
1998
2013
|
const o = {
|
|
1999
|
-
...(e.type === "dark" ?
|
|
2014
|
+
...(e.type === "dark" ? ue : fe).cssVar,
|
|
2000
2015
|
...e.cssVar
|
|
2001
2016
|
}, s = Object.keys(o);
|
|
2002
2017
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -2039,7 +2054,7 @@ const oo = function(e, t = !0) {
|
|
|
2039
2054
|
this.moved = !1, this.pointerdown = !1;
|
|
2040
2055
|
}
|
|
2041
2056
|
};
|
|
2042
|
-
},
|
|
2057
|
+
}, Ke = {
|
|
2043
2058
|
create: so
|
|
2044
2059
|
}, io = "#4dc4ff";
|
|
2045
2060
|
function at(e, t, n, o, s, i, l, c) {
|
|
@@ -2049,37 +2064,37 @@ function at(e, t, n, o, s, i, l, c) {
|
|
|
2049
2064
|
};
|
|
2050
2065
|
}
|
|
2051
2066
|
function ro(e, t, n) {
|
|
2052
|
-
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(),
|
|
2067
|
+
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), re(e));
|
|
2053
2068
|
}
|
|
2054
|
-
function
|
|
2055
|
-
|
|
2069
|
+
function Z(e, t, n, o, s) {
|
|
2070
|
+
k(e, {
|
|
2056
2071
|
x1: t + "",
|
|
2057
2072
|
y1: n + "",
|
|
2058
2073
|
x2: o + "",
|
|
2059
2074
|
y2: s + ""
|
|
2060
2075
|
});
|
|
2061
2076
|
}
|
|
2062
|
-
function
|
|
2063
|
-
const
|
|
2064
|
-
if (e.line.setAttribute("d",
|
|
2077
|
+
function Ve(e, t, n, o, s, i, l, c, r, a) {
|
|
2078
|
+
const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${c} ${r}`;
|
|
2079
|
+
if (e.line.setAttribute("d", d), a.style) {
|
|
2065
2080
|
const p = a.style;
|
|
2066
2081
|
p.stroke && e.line.setAttribute("stroke", p.stroke), p.strokeWidth && e.line.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeDasharray && e.line.setAttribute("stroke-dasharray", p.strokeDasharray), p.strokeLinecap && e.line.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && e.line.setAttribute("opacity", String(p.opacity));
|
|
2067
2082
|
}
|
|
2068
|
-
const
|
|
2069
|
-
|
|
2070
|
-
const u =
|
|
2083
|
+
const h = e.querySelectorAll('path[stroke="transparent"]');
|
|
2084
|
+
h.length > 0 && h[0].setAttribute("d", d);
|
|
2085
|
+
const u = oe(i, l, c, r);
|
|
2071
2086
|
if (u) {
|
|
2072
2087
|
const p = `M ${u.x1} ${u.y1} L ${c} ${r} L ${u.x2} ${u.y2}`;
|
|
2073
|
-
if (e.arrow1.setAttribute("d", p),
|
|
2088
|
+
if (e.arrow1.setAttribute("d", p), h.length > 1 && h[1].setAttribute("d", p), a.style) {
|
|
2074
2089
|
const g = a.style;
|
|
2075
2090
|
g.stroke && e.arrow1.setAttribute("stroke", g.stroke), g.strokeWidth && e.arrow1.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(g.opacity));
|
|
2076
2091
|
}
|
|
2077
2092
|
}
|
|
2078
2093
|
if (a.bidirectional) {
|
|
2079
|
-
const p =
|
|
2094
|
+
const p = oe(o, s, t, n);
|
|
2080
2095
|
if (p) {
|
|
2081
2096
|
const g = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
|
|
2082
|
-
if (e.arrow2.setAttribute("d", g),
|
|
2097
|
+
if (e.arrow2.setAttribute("d", g), h.length > 2 && h[2].setAttribute("d", g), a.style) {
|
|
2083
2098
|
const m = a.style;
|
|
2084
2099
|
m.stroke && e.arrow2.setAttribute("stroke", m.stroke), m.strokeWidth && e.arrow2.setAttribute("stroke-width", String(m.strokeWidth)), m.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", m.strokeLinecap), m.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(m.opacity));
|
|
2085
2100
|
}
|
|
@@ -2092,18 +2107,18 @@ function ze(e, t, n, o, s, i, l, c, r, a) {
|
|
|
2092
2107
|
}
|
|
2093
2108
|
mo(e);
|
|
2094
2109
|
}
|
|
2095
|
-
function
|
|
2096
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
2110
|
+
function se(e, t, n) {
|
|
2111
|
+
const { offsetLeft: o, offsetTop: s } = L(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, c = o + i / 2, r = s + l / 2, a = c + n.x, d = r + n.y;
|
|
2097
2112
|
return {
|
|
2098
2113
|
w: i,
|
|
2099
2114
|
h: l,
|
|
2100
2115
|
cx: c,
|
|
2101
2116
|
cy: r,
|
|
2102
2117
|
ctrlX: a,
|
|
2103
|
-
ctrlY:
|
|
2118
|
+
ctrlY: d
|
|
2104
2119
|
};
|
|
2105
2120
|
}
|
|
2106
|
-
function
|
|
2121
|
+
function X(e) {
|
|
2107
2122
|
let t, n;
|
|
2108
2123
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
2109
2124
|
return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
|
|
@@ -2112,73 +2127,73 @@ function G(e) {
|
|
|
2112
2127
|
};
|
|
2113
2128
|
}
|
|
2114
2129
|
const lo = function(e, t, n) {
|
|
2115
|
-
const o =
|
|
2130
|
+
const o = L(e.nodes, t), s = L(e.nodes, n), i = o.offsetLeft + t.offsetWidth / 2, l = o.offsetTop + t.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, r = s.offsetTop + n.offsetHeight / 2, a = c - i, d = r - l, h = Math.sqrt(a * a + d * d), u = Math.max(50, Math.min(200, h * 0.3)), b = Math.abs(a), v = Math.abs(d);
|
|
2116
2131
|
let p, g;
|
|
2117
|
-
if (
|
|
2118
|
-
const
|
|
2119
|
-
p = { x: 200 *
|
|
2132
|
+
if (h < 150) {
|
|
2133
|
+
const w = t.closest("me-main").className === "lhs" ? -1 : 1;
|
|
2134
|
+
p = { x: 200 * w, y: 0 }, g = { x: 200 * w, y: 0 };
|
|
2120
2135
|
} else if (b > v * 1.5) {
|
|
2121
|
-
const
|
|
2122
|
-
p = { x:
|
|
2136
|
+
const w = a > 0 ? t.offsetWidth / 2 : -t.offsetWidth / 2, C = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
2137
|
+
p = { x: w + (a > 0 ? u : -u), y: 0 }, g = { x: C + (a > 0 ? -u : u), y: 0 };
|
|
2123
2138
|
} else if (v > b * 1.5) {
|
|
2124
|
-
const
|
|
2125
|
-
p = { x: 0, y:
|
|
2139
|
+
const w = d > 0 ? t.offsetHeight / 2 : -t.offsetHeight / 2, C = d > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
2140
|
+
p = { x: 0, y: w + (d > 0 ? u : -u) }, g = { x: 0, y: C + (d > 0 ? -u : u) };
|
|
2126
2141
|
} else {
|
|
2127
|
-
const
|
|
2128
|
-
p = { x:
|
|
2142
|
+
const w = Math.atan2(d, a), C = t.offsetWidth / 2 * Math.cos(w), N = t.offsetHeight / 2 * Math.sin(w), f = -(n.offsetWidth / 2) * Math.cos(w), y = -(n.offsetHeight / 2) * Math.sin(w), x = u * 0.7 * (a > 0 ? 1 : -1), E = u * 0.7 * (d > 0 ? 1 : -1);
|
|
2143
|
+
p = { x: C + x, y: N + E }, g = { x: f - x, y: y - E };
|
|
2129
2144
|
}
|
|
2130
2145
|
return {
|
|
2131
2146
|
delta1: { x: Math.round(p.x), y: Math.round(p.y) },
|
|
2132
2147
|
delta2: { x: Math.round(g.x), y: Math.round(g.y) }
|
|
2133
2148
|
};
|
|
2134
|
-
},
|
|
2149
|
+
}, Se = function(e, t, n, o, s) {
|
|
2135
2150
|
if (!t || !n)
|
|
2136
2151
|
return;
|
|
2137
2152
|
if (!o.delta1 || !o.delta2) {
|
|
2138
|
-
const
|
|
2139
|
-
o.delta1 =
|
|
2153
|
+
const S = lo(e, t, n);
|
|
2154
|
+
o.delta1 = S.delta1, o.delta2 = S.delta2;
|
|
2140
2155
|
}
|
|
2141
|
-
const i =
|
|
2156
|
+
const i = se(e, t, o.delta1), l = se(e, n, o.delta2), { x: c, y: r } = X(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: b, y: v } = X(l), p = oe(h, u, b, v);
|
|
2142
2157
|
if (!p) return;
|
|
2143
2158
|
const g = `M ${p.x1} ${p.y1} L ${b} ${v} L ${p.x2} ${p.y2}`;
|
|
2144
2159
|
let m = "";
|
|
2145
2160
|
if (o.bidirectional) {
|
|
2146
|
-
const
|
|
2147
|
-
if (!
|
|
2148
|
-
m = `M ${
|
|
2161
|
+
const S = oe(a, d, c, r);
|
|
2162
|
+
if (!S) return;
|
|
2163
|
+
m = `M ${S.x1} ${S.y1} L ${c} ${r} L ${S.x2} ${S.y2}`;
|
|
2149
2164
|
}
|
|
2150
|
-
const
|
|
2151
|
-
|
|
2152
|
-
const
|
|
2165
|
+
const w = Pn(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${b} ${v}`, g, m, o.style), { x: C, y: N } = at(c, r, a, d, h, u, b, v), f = o.style?.labelColor || "rgb(235, 95, 82)", y = "a-" + o.id;
|
|
2166
|
+
w.id = y;
|
|
2167
|
+
const x = e.markdown ? e.markdown(o.label, o) : o.label, E = de(x, C, N, {
|
|
2153
2168
|
anchor: "middle",
|
|
2154
|
-
color:
|
|
2169
|
+
color: f,
|
|
2155
2170
|
dataType: "arrow",
|
|
2156
|
-
svgId:
|
|
2171
|
+
svgId: y
|
|
2157
2172
|
});
|
|
2158
|
-
|
|
2173
|
+
w.labelEl = E, w.arrowObj = o, w.dataset.linkid = o.id, e.labelContainer.appendChild(E), e.arrowSvg.appendChild(w), re(E), s || (e.arrows.push(o), e.currentArrow = w, dt(e, o, i, l));
|
|
2159
2174
|
}, co = function(e, t, n = {}) {
|
|
2160
2175
|
const o = {
|
|
2161
|
-
id:
|
|
2176
|
+
id: B(),
|
|
2162
2177
|
label: "Custom Link",
|
|
2163
2178
|
from: e.nodeObj.id,
|
|
2164
2179
|
to: t.nodeObj.id,
|
|
2165
2180
|
...n
|
|
2166
2181
|
};
|
|
2167
|
-
|
|
2182
|
+
Se(this, e, t, o), this.bus.fire("operation", {
|
|
2168
2183
|
name: "createArrow",
|
|
2169
2184
|
obj: o
|
|
2170
2185
|
});
|
|
2171
2186
|
}, ao = function(e) {
|
|
2172
|
-
|
|
2173
|
-
const t = { ...e, id:
|
|
2174
|
-
|
|
2187
|
+
le(this);
|
|
2188
|
+
const t = { ...e, id: B() };
|
|
2189
|
+
Se(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2175
2190
|
name: "createArrow",
|
|
2176
2191
|
obj: t
|
|
2177
2192
|
});
|
|
2178
2193
|
}, ho = function(e) {
|
|
2179
2194
|
let t;
|
|
2180
2195
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2181
|
-
|
|
2196
|
+
le(this);
|
|
2182
2197
|
const n = t.arrowObj.id;
|
|
2183
2198
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.labelEl?.remove(), t.remove(), this.bus.fire("operation", {
|
|
2184
2199
|
name: "removeArrow",
|
|
@@ -2188,13 +2203,13 @@ const lo = function(e, t, n) {
|
|
|
2188
2203
|
});
|
|
2189
2204
|
}, fo = function(e) {
|
|
2190
2205
|
this.currentArrow = e;
|
|
2191
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s =
|
|
2206
|
+
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = se(this, n, t.delta1), i = se(this, o, t.delta2);
|
|
2192
2207
|
dt(this, t, s, i), this.bus.fire("selectArrow", t);
|
|
2193
2208
|
}, uo = function() {
|
|
2194
|
-
|
|
2195
|
-
},
|
|
2196
|
-
const n = document.createElementNS(
|
|
2197
|
-
return
|
|
2209
|
+
le(this), this.currentArrow = null, this.bus.fire("unselectArrow");
|
|
2210
|
+
}, ce = function(e, t) {
|
|
2211
|
+
const n = document.createElementNS(M, "path");
|
|
2212
|
+
return k(n, {
|
|
2198
2213
|
d: e,
|
|
2199
2214
|
stroke: t,
|
|
2200
2215
|
fill: "none",
|
|
@@ -2203,13 +2218,13 @@ const lo = function(e, t, n) {
|
|
|
2203
2218
|
"stroke-linejoin": "round"
|
|
2204
2219
|
}), n;
|
|
2205
2220
|
}, po = function(e, t) {
|
|
2206
|
-
const n = document.createElementNS(
|
|
2221
|
+
const n = document.createElementNS(M, "g");
|
|
2207
2222
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2208
|
-
const o =
|
|
2223
|
+
const o = ce(e.line.getAttribute("d"), t);
|
|
2209
2224
|
n.appendChild(o);
|
|
2210
|
-
const s =
|
|
2225
|
+
const s = ce(e.arrow1.getAttribute("d"), t);
|
|
2211
2226
|
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2212
|
-
const i =
|
|
2227
|
+
const i = ce(e.arrow2.getAttribute("d"), t);
|
|
2213
2228
|
n.appendChild(i);
|
|
2214
2229
|
}
|
|
2215
2230
|
e.insertBefore(n, e.firstChild);
|
|
@@ -2221,41 +2236,41 @@ const lo = function(e, t, n) {
|
|
|
2221
2236
|
if (!t) return;
|
|
2222
2237
|
const n = t.querySelectorAll("path");
|
|
2223
2238
|
n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
|
|
2224
|
-
},
|
|
2239
|
+
}, le = function(e) {
|
|
2225
2240
|
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && go(e.currentArrow);
|
|
2226
2241
|
}, dt = function(e, t, n, o) {
|
|
2227
|
-
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map:
|
|
2228
|
-
if (!
|
|
2229
|
-
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), po(
|
|
2230
|
-
let { x: b, y: v } =
|
|
2231
|
-
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${
|
|
2232
|
-
p = p +
|
|
2233
|
-
const
|
|
2234
|
-
b =
|
|
2235
|
-
}), e.helper2.init(
|
|
2236
|
-
m = m +
|
|
2237
|
-
const
|
|
2238
|
-
|
|
2242
|
+
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: d, currentArrow: h, bus: u } = e;
|
|
2243
|
+
if (!h) return;
|
|
2244
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), po(h, io);
|
|
2245
|
+
let { x: b, y: v } = X(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: w } = o, { x: C, y: N } = X(o);
|
|
2246
|
+
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${w}px;left:${m}px;`, Z(c, b, v, p, g), Z(r, m, w, C, N), e.helper1 = Ke.create(i), e.helper2 = Ke.create(l), e.helper1.init(d, (f, y) => {
|
|
2247
|
+
p = p + f / e.scaleVal, g = g + y / e.scaleVal;
|
|
2248
|
+
const x = X({ ...n, ctrlX: p, ctrlY: g });
|
|
2249
|
+
b = x.x, v = x.y, i.style.top = g + "px", i.style.left = p + "px", Ve(h, b, v, p, g, m, w, C, N, t), Z(c, b, v, p, g), t.delta1.x = Math.round(p - n.cx), t.delta1.y = Math.round(g - n.cy), u.fire("updateArrowDelta", t);
|
|
2250
|
+
}), e.helper2.init(d, (f, y) => {
|
|
2251
|
+
m = m + f / e.scaleVal, w = w + y / e.scaleVal;
|
|
2252
|
+
const x = X({ ...o, ctrlX: m, ctrlY: w });
|
|
2253
|
+
C = x.x, N = x.y, l.style.top = w + "px", l.style.left = m + "px", Ve(h, b, v, p, g, m, w, C, N, t), Z(r, m, w, C, N), t.delta2.x = Math.round(m - o.cx), t.delta2.y = Math.round(w - o.cy), u.fire("updateArrowDelta", t);
|
|
2239
2254
|
});
|
|
2240
2255
|
};
|
|
2241
2256
|
function yo() {
|
|
2242
|
-
this.
|
|
2257
|
+
this.arrowSvg.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((t) => t.remove());
|
|
2243
2258
|
for (let t = 0; t < this.arrows.length; t++) {
|
|
2244
2259
|
const n = this.arrows[t];
|
|
2245
2260
|
try {
|
|
2246
|
-
|
|
2261
|
+
Se(this, this.findEle(n.from), this.findEle(n.to), n, !0);
|
|
2247
2262
|
} catch {
|
|
2248
2263
|
}
|
|
2249
2264
|
}
|
|
2250
|
-
this.nodes.appendChild(this.
|
|
2265
|
+
this.nodes.appendChild(this.arrowSvg);
|
|
2251
2266
|
}
|
|
2252
2267
|
function bo(e) {
|
|
2253
|
-
|
|
2268
|
+
le(this), e && e.labelEl && rt(this, e.labelEl, e.arrowObj);
|
|
2254
2269
|
}
|
|
2255
2270
|
function vo() {
|
|
2256
|
-
this.arrows = this.arrows.filter((e) =>
|
|
2271
|
+
this.arrows = this.arrows.filter((e) => ne(e.from, this.nodeData) && ne(e.to, this.nodeData));
|
|
2257
2272
|
}
|
|
2258
|
-
const
|
|
2273
|
+
const wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2259
2274
|
__proto__: null,
|
|
2260
2275
|
createArrow: co,
|
|
2261
2276
|
createArrowFrom: ao,
|
|
@@ -2265,27 +2280,27 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2265
2280
|
selectArrow: fo,
|
|
2266
2281
|
tidyArrow: vo,
|
|
2267
2282
|
unselectArrow: uo
|
|
2268
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2283
|
+
}, Symbol.toStringTag, { value: "Module" })), xo = function(e) {
|
|
2269
2284
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2270
2285
|
if (e.length === 1) {
|
|
2271
2286
|
const r = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
2272
2287
|
if (!a) throw new Error("Can not select root node.");
|
|
2273
|
-
const
|
|
2288
|
+
const d = a.children.findIndex((h) => r === h);
|
|
2274
2289
|
return {
|
|
2275
2290
|
parent: a.id,
|
|
2276
|
-
start:
|
|
2277
|
-
end:
|
|
2291
|
+
start: d,
|
|
2292
|
+
end: d
|
|
2278
2293
|
};
|
|
2279
2294
|
}
|
|
2280
2295
|
let t = 0;
|
|
2281
2296
|
const n = e.map((r) => {
|
|
2282
2297
|
let a = r.nodeObj;
|
|
2283
|
-
const
|
|
2298
|
+
const d = [];
|
|
2284
2299
|
for (; a.parent; ) {
|
|
2285
|
-
const
|
|
2286
|
-
a =
|
|
2300
|
+
const h = a.parent, b = h.children?.indexOf(a);
|
|
2301
|
+
a = h, d.unshift({ node: a, index: b });
|
|
2287
2302
|
}
|
|
2288
|
-
return
|
|
2303
|
+
return d.length > t && (t = d.length), d;
|
|
2289
2304
|
});
|
|
2290
2305
|
let o = 0;
|
|
2291
2306
|
e: for (; o < t; o++) {
|
|
@@ -2303,11 +2318,11 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2303
2318
|
end: l
|
|
2304
2319
|
};
|
|
2305
2320
|
}, Eo = function(e) {
|
|
2306
|
-
const t = document.createElementNS(
|
|
2321
|
+
const t = document.createElementNS(M, "g");
|
|
2307
2322
|
return t.setAttribute("id", e), t;
|
|
2308
|
-
},
|
|
2309
|
-
const n = document.createElementNS(
|
|
2310
|
-
return
|
|
2323
|
+
}, ze = function(e, t) {
|
|
2324
|
+
const n = document.createElementNS(M, "path");
|
|
2325
|
+
return k(n, {
|
|
2311
2326
|
d: e,
|
|
2312
2327
|
stroke: t || "#666",
|
|
2313
2328
|
fill: "none",
|
|
@@ -2318,31 +2333,31 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2318
2333
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2319
2334
|
let i;
|
|
2320
2335
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2321
|
-
},
|
|
2322
|
-
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg:
|
|
2336
|
+
}, Ne = function(e, t) {
|
|
2337
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, b = So(e, t);
|
|
2323
2338
|
let v = 1 / 0, p = 0, g = 0, m = 0;
|
|
2324
|
-
for (let
|
|
2325
|
-
const
|
|
2326
|
-
if (!
|
|
2339
|
+
for (let V = i; V <= l; V++) {
|
|
2340
|
+
const Te = u.children?.[V];
|
|
2341
|
+
if (!Te)
|
|
2327
2342
|
return e.removeSummary(n), null;
|
|
2328
|
-
const
|
|
2329
|
-
|
|
2330
|
-
}
|
|
2331
|
-
let
|
|
2332
|
-
const
|
|
2333
|
-
b ===
|
|
2334
|
-
const
|
|
2335
|
-
return
|
|
2343
|
+
const q = Co(e.findEle(Te.id)), { offsetLeft: U, offsetTop: ke } = L(r, q), _e = i === l ? 10 : 20;
|
|
2344
|
+
V === i && (g = ke + _e), V === l && (m = ke + q.offsetHeight - _e), U < v && (v = U), q.offsetWidth + U > p && (p = q.offsetWidth + U);
|
|
2345
|
+
}
|
|
2346
|
+
let w, C;
|
|
2347
|
+
const N = u.parent ? 10 : 0, f = g + N, y = m + N, x = (f + y) / 2, E = c?.stroke || a.cssVar["--color"], S = c?.labelColor || a.cssVar["--color"], T = "s-" + n, _ = e.markdown ? e.markdown(o, t) : o;
|
|
2348
|
+
b === O.LHS ? (w = ze(`M ${v + 10} ${f} c -5 0 -10 5 -10 10 L ${v} ${y - 10} c 0 5 5 10 10 10 M ${v} ${x} h -10`, E), C = de(_, v - 20, x, { anchor: "end", color: S, dataType: "summary", svgId: T })) : (w = ze(`M ${p - 10} ${f} c 5 0 10 5 10 10 L ${p} ${y - 10} c 0 5 -5 10 -10 10 M ${p} ${x} h 10`, E), C = de(_, p + 20, x, { anchor: "start", color: S, dataType: "summary", svgId: T }));
|
|
2349
|
+
const H = Eo(T);
|
|
2350
|
+
return H.appendChild(w), e.labelContainer.appendChild(C), re(C), H.summaryObj = t, H.labelEl = C, d.appendChild(H), H;
|
|
2336
2351
|
}, No = function(e = {}) {
|
|
2337
2352
|
if (!this.currentNodes) return;
|
|
2338
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } =
|
|
2353
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = xo(t), c = { id: B(), parent: s, start: i, end: l, label: "summary", style: e.style }, r = Ne(this, c);
|
|
2339
2354
|
n.push(c), this.editSummary(r), o.fire("operation", {
|
|
2340
2355
|
name: "createSummary",
|
|
2341
2356
|
obj: c
|
|
2342
2357
|
});
|
|
2343
2358
|
}, To = function(e) {
|
|
2344
|
-
const t =
|
|
2345
|
-
|
|
2359
|
+
const t = B(), n = { ...e, id: t };
|
|
2360
|
+
Ne(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2346
2361
|
name: "createSummary",
|
|
2347
2362
|
obj: n
|
|
2348
2363
|
});
|
|
@@ -2355,48 +2370,48 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2355
2370
|
}, _o = function(e) {
|
|
2356
2371
|
const t = e.labelEl;
|
|
2357
2372
|
t && t.classList.add("selected"), this.currentSummary = e, this.bus.fire("selectSummary", e.summaryObj);
|
|
2358
|
-
}, Lo = function() {
|
|
2359
|
-
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
2360
2373
|
}, Do = function() {
|
|
2374
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
2375
|
+
}, Lo = function() {
|
|
2361
2376
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2362
2377
|
try {
|
|
2363
|
-
|
|
2378
|
+
Ne(this, e);
|
|
2364
2379
|
} catch {
|
|
2365
2380
|
}
|
|
2366
2381
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2367
|
-
},
|
|
2382
|
+
}, Mo = function(e) {
|
|
2368
2383
|
e && e.labelEl && rt(this, e.labelEl, e.summaryObj);
|
|
2369
|
-
},
|
|
2384
|
+
}, Ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2370
2385
|
__proto__: null,
|
|
2371
2386
|
createSummary: No,
|
|
2372
2387
|
createSummaryFrom: To,
|
|
2373
|
-
editSummary:
|
|
2388
|
+
editSummary: Mo,
|
|
2374
2389
|
removeSummary: ko,
|
|
2375
|
-
renderSummary:
|
|
2390
|
+
renderSummary: Lo,
|
|
2376
2391
|
selectSummary: _o,
|
|
2377
|
-
unselectSummary:
|
|
2378
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2379
|
-
function
|
|
2380
|
-
const n = document.createElementNS(
|
|
2381
|
-
return
|
|
2392
|
+
unselectSummary: Do
|
|
2393
|
+
}, Symbol.toStringTag, { value: "Module" })), D = "http://www.w3.org/2000/svg";
|
|
2394
|
+
function Po(e, t) {
|
|
2395
|
+
const n = document.createElementNS(D, "svg");
|
|
2396
|
+
return k(n, {
|
|
2382
2397
|
version: "1.1",
|
|
2383
|
-
xmlns:
|
|
2398
|
+
xmlns: D,
|
|
2384
2399
|
height: e,
|
|
2385
2400
|
width: t
|
|
2386
2401
|
}), n;
|
|
2387
2402
|
}
|
|
2388
|
-
function
|
|
2403
|
+
function Oo(e, t) {
|
|
2389
2404
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2390
2405
|
}
|
|
2391
|
-
function
|
|
2392
|
-
const s = document.createElementNS(
|
|
2406
|
+
function Ho(e, t, n, o) {
|
|
2407
|
+
const s = document.createElementNS(D, "g");
|
|
2393
2408
|
let i = "";
|
|
2394
2409
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2395
2410
|
`).forEach((c, r) => {
|
|
2396
|
-
const a = document.createElementNS(
|
|
2397
|
-
|
|
2411
|
+
const a = document.createElementNS(D, "text");
|
|
2412
|
+
k(a, {
|
|
2398
2413
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2399
|
-
y: o + parseInt(t.paddingTop) +
|
|
2414
|
+
y: o + parseInt(t.paddingTop) + Oo(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
|
|
2400
2415
|
"text-anchor": "start",
|
|
2401
2416
|
"font-family": t.fontFamily,
|
|
2402
2417
|
"font-size": `${t.fontSize}`,
|
|
@@ -2405,25 +2420,25 @@ function $o(e, t, n, o) {
|
|
|
2405
2420
|
}), a.innerHTML = c, s.appendChild(a);
|
|
2406
2421
|
}), s;
|
|
2407
2422
|
}
|
|
2408
|
-
function
|
|
2423
|
+
function $o(e, t, n, o) {
|
|
2409
2424
|
let s = "";
|
|
2410
2425
|
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2411
|
-
const i = document.createElementNS(
|
|
2412
|
-
|
|
2426
|
+
const i = document.createElementNS(D, "foreignObject");
|
|
2427
|
+
k(i, {
|
|
2413
2428
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2414
2429
|
y: o + parseInt(t.paddingTop) + "",
|
|
2415
2430
|
width: t.width,
|
|
2416
2431
|
height: t.height
|
|
2417
2432
|
});
|
|
2418
2433
|
const l = document.createElement("div");
|
|
2419
|
-
return
|
|
2434
|
+
return k(l, {
|
|
2420
2435
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
2421
2436
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2422
2437
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2423
2438
|
}
|
|
2424
2439
|
function jo(e, t) {
|
|
2425
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2426
|
-
return
|
|
2440
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = L(e.nodes, t), i = document.createElementNS(D, "rect");
|
|
2441
|
+
return k(i, {
|
|
2427
2442
|
x: o + "",
|
|
2428
2443
|
y: s + "",
|
|
2429
2444
|
rx: n.borderRadius,
|
|
@@ -2435,9 +2450,9 @@ function jo(e, t) {
|
|
|
2435
2450
|
"stroke-width": n.borderWidth
|
|
2436
2451
|
}), i;
|
|
2437
2452
|
}
|
|
2438
|
-
function
|
|
2439
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2440
|
-
|
|
2453
|
+
function Q(e, t, n = !1) {
|
|
2454
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = L(e.nodes, t), l = document.createElementNS(D, "rect");
|
|
2455
|
+
k(l, {
|
|
2441
2456
|
x: s + "",
|
|
2442
2457
|
y: i + "",
|
|
2443
2458
|
rx: o.borderRadius,
|
|
@@ -2448,14 +2463,14 @@ function te(e, t, n = !1) {
|
|
|
2448
2463
|
stroke: o.borderColor,
|
|
2449
2464
|
"stroke-width": o.borderWidth
|
|
2450
2465
|
});
|
|
2451
|
-
const c = document.createElementNS(
|
|
2466
|
+
const c = document.createElementNS(D, "g");
|
|
2452
2467
|
c.appendChild(l);
|
|
2453
2468
|
let r;
|
|
2454
|
-
return n ? r =
|
|
2469
|
+
return n ? r = $o(t, o, s, i) : r = Ho(t, o, s, i), c.appendChild(r), c;
|
|
2455
2470
|
}
|
|
2456
2471
|
function Io(e, t) {
|
|
2457
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2458
|
-
return
|
|
2472
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = L(e.nodes, t), i = document.createElementNS(D, "a"), l = document.createElementNS(D, "text");
|
|
2473
|
+
return k(l, {
|
|
2459
2474
|
x: o + "",
|
|
2460
2475
|
y: s + parseInt(n.fontSize) + "",
|
|
2461
2476
|
"text-anchor": "start",
|
|
@@ -2466,8 +2481,8 @@ function Io(e, t) {
|
|
|
2466
2481
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2467
2482
|
}
|
|
2468
2483
|
function Ro(e, t) {
|
|
2469
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2470
|
-
return
|
|
2484
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = L(e.nodes, t), i = document.createElementNS(D, "image");
|
|
2485
|
+
return k(i, {
|
|
2471
2486
|
x: o + "",
|
|
2472
2487
|
y: s + "",
|
|
2473
2488
|
width: n.width + "",
|
|
@@ -2475,36 +2490,36 @@ function Ro(e, t) {
|
|
|
2475
2490
|
href: t.src
|
|
2476
2491
|
}), i;
|
|
2477
2492
|
}
|
|
2478
|
-
const
|
|
2479
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
2480
|
-
|
|
2493
|
+
const ee = 100, Bo = '<?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">', Wo = (e, t = !1) => {
|
|
2494
|
+
const n = e.nodes, o = n.offsetHeight + ee * 2, s = n.offsetWidth + ee * 2, i = Po(o + "px", s + "px"), l = document.createElementNS(D, "svg"), c = document.createElementNS(D, "rect");
|
|
2495
|
+
k(c, {
|
|
2481
2496
|
x: "0",
|
|
2482
2497
|
y: "0",
|
|
2483
2498
|
width: `${s}`,
|
|
2484
2499
|
height: `${o}`,
|
|
2485
2500
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2486
|
-
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((
|
|
2487
|
-
const u =
|
|
2501
|
+
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((h) => {
|
|
2502
|
+
const u = h.cloneNode(!0), { offsetLeft: b, offsetTop: v } = L(n, h.parentElement);
|
|
2488
2503
|
u.setAttribute("x", `${b}`), u.setAttribute("y", `${v}`), l.appendChild(u);
|
|
2489
2504
|
});
|
|
2490
2505
|
const r = n.querySelector(".lines")?.cloneNode(!0);
|
|
2491
2506
|
r && l.appendChild(r);
|
|
2492
2507
|
const a = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
2493
2508
|
a && l.appendChild(a);
|
|
2494
|
-
const
|
|
2495
|
-
return
|
|
2496
|
-
|
|
2497
|
-
}), n.querySelectorAll(".tags > span").forEach((
|
|
2498
|
-
l.appendChild(
|
|
2499
|
-
}), n.querySelectorAll(".icons > span").forEach((
|
|
2500
|
-
l.appendChild(
|
|
2501
|
-
}), n.querySelectorAll(".hyper-link").forEach((
|
|
2502
|
-
l.appendChild(Io(e,
|
|
2503
|
-
}), n.querySelectorAll("img").forEach((
|
|
2504
|
-
l.appendChild(Ro(e,
|
|
2505
|
-
}),
|
|
2506
|
-
x:
|
|
2507
|
-
y:
|
|
2509
|
+
const d = n.querySelector(".summary")?.cloneNode(!0);
|
|
2510
|
+
return d && l.appendChild(d), n.querySelectorAll("me-tpc").forEach((h) => {
|
|
2511
|
+
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(Q(e, h, !t)) : (l.appendChild(jo(e, h)), l.appendChild(Q(e, h.text, !t)));
|
|
2512
|
+
}), n.querySelectorAll(".tags > span").forEach((h) => {
|
|
2513
|
+
l.appendChild(Q(e, h));
|
|
2514
|
+
}), n.querySelectorAll(".icons > span").forEach((h) => {
|
|
2515
|
+
l.appendChild(Q(e, h));
|
|
2516
|
+
}), n.querySelectorAll(".hyper-link").forEach((h) => {
|
|
2517
|
+
l.appendChild(Io(e, h));
|
|
2518
|
+
}), n.querySelectorAll("img").forEach((h) => {
|
|
2519
|
+
l.appendChild(Ro(e, h));
|
|
2520
|
+
}), k(l, {
|
|
2521
|
+
x: ee + "",
|
|
2522
|
+
y: ee + "",
|
|
2508
2523
|
overflow: "visible"
|
|
2509
2524
|
}), i.appendChild(l), i;
|
|
2510
2525
|
}, Yo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Bo + e.outerHTML);
|
|
@@ -2521,7 +2536,7 @@ function Xo(e) {
|
|
|
2521
2536
|
const Fo = function(e = !1, t) {
|
|
2522
2537
|
const n = Wo(this, e), o = Yo(n, t);
|
|
2523
2538
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2524
|
-
},
|
|
2539
|
+
}, Ko = async function(e = !1, t) {
|
|
2525
2540
|
const n = this.exportSvg(e, t), o = await Xo(n);
|
|
2526
2541
|
return new Promise((s, i) => {
|
|
2527
2542
|
const l = new Image();
|
|
@@ -2530,27 +2545,27 @@ const Fo = function(e = !1, t) {
|
|
|
2530
2545
|
c.width = l.width, c.height = l.height, c.getContext("2d").drawImage(l, 0, 0), c.toBlob(s, "image/png", 1);
|
|
2531
2546
|
}, l.src = o, l.onerror = i;
|
|
2532
2547
|
});
|
|
2533
|
-
},
|
|
2548
|
+
}, Vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2534
2549
|
__proto__: null,
|
|
2535
|
-
exportPng:
|
|
2550
|
+
exportPng: Ko,
|
|
2536
2551
|
exportSvg: Fo
|
|
2537
2552
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2538
|
-
function
|
|
2553
|
+
function zo(e, t) {
|
|
2539
2554
|
return async function(...n) {
|
|
2540
2555
|
const o = this.before[t];
|
|
2541
2556
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2542
2557
|
};
|
|
2543
2558
|
}
|
|
2544
|
-
const
|
|
2545
|
-
for (let e = 0; e <
|
|
2546
|
-
const t =
|
|
2547
|
-
ht[t] =
|
|
2559
|
+
const Ge = Object.keys(ot), ht = {};
|
|
2560
|
+
for (let e = 0; e < Ge.length; e++) {
|
|
2561
|
+
const t = Ge[e];
|
|
2562
|
+
ht[t] = zo(ot[t], t);
|
|
2548
2563
|
}
|
|
2549
|
-
const
|
|
2550
|
-
getObjById:
|
|
2564
|
+
const Go = {
|
|
2565
|
+
getObjById: ne,
|
|
2551
2566
|
generateNewObj: ft,
|
|
2552
|
-
layout:
|
|
2553
|
-
linkDiv:
|
|
2567
|
+
layout: xt,
|
|
2568
|
+
linkDiv: On,
|
|
2554
2569
|
editTopic: _t,
|
|
2555
2570
|
createWrapper: St,
|
|
2556
2571
|
createParent: Nt,
|
|
@@ -2558,53 +2573,72 @@ const Vo = {
|
|
|
2558
2573
|
createTopic: kt,
|
|
2559
2574
|
findEle: Ze,
|
|
2560
2575
|
changeTheme: oo,
|
|
2561
|
-
...
|
|
2576
|
+
...wn,
|
|
2562
2577
|
...ht,
|
|
2563
|
-
...
|
|
2564
|
-
...
|
|
2565
|
-
...
|
|
2578
|
+
...wo,
|
|
2579
|
+
...Ao,
|
|
2580
|
+
...Vo,
|
|
2566
2581
|
init(e) {
|
|
2567
2582
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2568
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
2583
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, R(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && qn(this), this.keypress && Ln(this, this.keypress), no(this), this.disposable.push(wt()), this.contextMenu && this.disposable.push($n(this, this.contextMenu)), this.allowUndo && this.disposable.push(In(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2569
2584
|
},
|
|
2570
2585
|
destroy() {
|
|
2571
|
-
this.disposable.forEach((e) => e()), 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.
|
|
2586
|
+
this.disposable.forEach((e) => e()), 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;
|
|
2587
|
+
},
|
|
2588
|
+
/**
|
|
2589
|
+
* @public
|
|
2590
|
+
* @param {boolean} enable
|
|
2591
|
+
*/
|
|
2592
|
+
enableMobileMultiSelect(e) {
|
|
2593
|
+
this.mobileMultiSelect = e;
|
|
2572
2594
|
}
|
|
2573
2595
|
};
|
|
2574
2596
|
function qo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, containerHeight: a }) {
|
|
2575
|
-
let
|
|
2576
|
-
const
|
|
2597
|
+
let d = t + n / 2;
|
|
2598
|
+
const h = e + o / 2;
|
|
2577
2599
|
let u;
|
|
2578
|
-
r ===
|
|
2579
|
-
const b = s + c / 2, p = (1 - Math.abs(b -
|
|
2580
|
-
return r ===
|
|
2600
|
+
r === O.LHS ? u = i + l : u = i;
|
|
2601
|
+
const b = s + c / 2, p = (1 - Math.abs(b - h) / a) * 0.25 * (n / 2);
|
|
2602
|
+
return r === O.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${b} ${u} ${b}`;
|
|
2581
2603
|
}
|
|
2582
2604
|
function Uo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, isFirst: a }) {
|
|
2583
|
-
const
|
|
2584
|
-
let
|
|
2585
|
-
a ?
|
|
2605
|
+
const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2606
|
+
let h = 0, u = 0;
|
|
2607
|
+
a ? h = e + o / 2 : h = e + o;
|
|
2586
2608
|
const b = s + c;
|
|
2587
2609
|
let v = 0, p = 0, g = 0;
|
|
2588
|
-
const m = Math.abs(
|
|
2589
|
-
return r ===
|
|
2610
|
+
const m = Math.abs(h - b) / 300 * d;
|
|
2611
|
+
return r === O.LHS ? (g = t, v = g + d, p = g - d, u = i + d, `M ${v} ${h} C ${g} ${h} ${g + m} ${b} ${p} ${b} H ${u}`) : (g = t + n, v = g - d, p = g + d, u = i + l - d, `M ${v} ${h} C ${g} ${h} ${g - m} ${b} ${p} ${b} H ${u}`);
|
|
2590
2612
|
}
|
|
2591
|
-
const Jo = "5.11.1-beta.
|
|
2613
|
+
const Jo = "5.11.1-beta.2";
|
|
2592
2614
|
function Zo(e) {
|
|
2593
2615
|
return {
|
|
2594
2616
|
x: 0,
|
|
2595
2617
|
y: 0,
|
|
2596
2618
|
moved: !1,
|
|
2597
|
-
//
|
|
2619
|
+
// differentiate click and move
|
|
2598
2620
|
mousedown: !1,
|
|
2599
|
-
|
|
2600
|
-
this.
|
|
2621
|
+
handlePointerDown(t) {
|
|
2622
|
+
this.moved = !1;
|
|
2623
|
+
const n = t.target, o = e.mouseSelectionButton === 0 ? 2 : 0, s = e.spacePressed && t.button === 0 && t.pointerType === "mouse", i = !e.editable || t.button === o && t.pointerType === "mouse" || t.pointerType === "touch";
|
|
2624
|
+
!s && !i || (this.x = t.clientX, this.y = t.clientY, n.className !== "circle" && n.contentEditable !== "plaintext-only" && (this.mousedown = !0, n.setPointerCapture(t.pointerId)));
|
|
2625
|
+
},
|
|
2626
|
+
handlePointerMove(t) {
|
|
2627
|
+
if (!this.mousedown || t.target.contentEditable === "plaintext-only" && !e.spacePressed) return !1;
|
|
2628
|
+
const n = t.clientX - this.x, o = t.clientY - this.y;
|
|
2629
|
+
return this.x = t.clientX, this.y = t.clientY, this.moved = !0, e.move(n, o), !0;
|
|
2630
|
+
},
|
|
2631
|
+
handlePointerUp(t) {
|
|
2632
|
+
if (!this.mousedown) return;
|
|
2633
|
+
const n = t.target;
|
|
2634
|
+
n.hasPointerCapture && n.hasPointerCapture(t.pointerId) && n.releasePointerCapture(t.pointerId), this.mousedown = !1;
|
|
2601
2635
|
},
|
|
2602
2636
|
clear() {
|
|
2603
|
-
this.mousedown = !1;
|
|
2637
|
+
this.mousedown = !1, this.moved = !1;
|
|
2604
2638
|
}
|
|
2605
2639
|
};
|
|
2606
2640
|
}
|
|
2607
|
-
function
|
|
2641
|
+
function A({
|
|
2608
2642
|
el: e,
|
|
2609
2643
|
direction: t,
|
|
2610
2644
|
editable: n,
|
|
@@ -2615,55 +2649,56 @@ function P({
|
|
|
2615
2649
|
selectionContainer: c,
|
|
2616
2650
|
before: r,
|
|
2617
2651
|
newTopicName: a,
|
|
2618
|
-
allowUndo:
|
|
2619
|
-
generateMainBranch:
|
|
2652
|
+
allowUndo: d,
|
|
2653
|
+
generateMainBranch: h,
|
|
2620
2654
|
generateSubBranch: u,
|
|
2621
2655
|
overflowHidden: b,
|
|
2622
2656
|
theme: v,
|
|
2623
2657
|
alignment: p,
|
|
2624
2658
|
scaleSensitivity: g,
|
|
2625
2659
|
scaleMax: m,
|
|
2626
|
-
scaleMin:
|
|
2627
|
-
handleWheel:
|
|
2628
|
-
markdown:
|
|
2629
|
-
imageProxy:
|
|
2630
|
-
pasteHandler:
|
|
2660
|
+
scaleMin: w,
|
|
2661
|
+
handleWheel: C,
|
|
2662
|
+
markdown: N,
|
|
2663
|
+
imageProxy: f,
|
|
2664
|
+
pasteHandler: y,
|
|
2665
|
+
mobileMultiSelect: x
|
|
2631
2666
|
}) {
|
|
2632
|
-
let
|
|
2633
|
-
const
|
|
2634
|
-
if (
|
|
2635
|
-
|
|
2636
|
-
const
|
|
2637
|
-
this.theme = v || (
|
|
2638
|
-
const
|
|
2639
|
-
|
|
2667
|
+
let E = null;
|
|
2668
|
+
const S = Object.prototype.toString.call(e);
|
|
2669
|
+
if (S === "[object HTMLDivElement]" ? E = e : S === "[object String]" && (E = document.querySelector(e)), !E) throw new Error("MindElixir: el is not a valid element");
|
|
2670
|
+
E.style.position = "relative", E.innerHTML = "", this.el = E, this.disposable = [], this.before = r || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = t ?? 1, this.editable = n ?? !0, this.allowUndo = d ?? !0, this.scaleSensitivity = g ?? 0.1, this.scaleMax = m ?? 1.4, this.scaleMin = w ?? 0.2, this.generateMainBranch = h || qo, this.generateSubBranch = u || Uo, this.overflowHidden = b ?? !1, this.alignment = p ?? "root", this.handleWheel = C ?? !0, this.markdown = N || void 0, this.imageProxy = f || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = x ?? !1, this.panHelper = Zo(this), this.bus = An(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
2671
|
+
const T = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2672
|
+
this.theme = v || (T.matches ? ue : fe);
|
|
2673
|
+
const _ = document.createElement("div");
|
|
2674
|
+
_.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 = z("lines"), this.summarySvg = z("summary"), this.linkController = z("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 = je(), this.line2 = je(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = z("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(Mn(this)), y && (this.pasteHandler = y);
|
|
2640
2675
|
}
|
|
2641
|
-
|
|
2642
|
-
Object.defineProperty(
|
|
2676
|
+
A.prototype = Go;
|
|
2677
|
+
Object.defineProperty(A.prototype, "currentNode", {
|
|
2643
2678
|
get() {
|
|
2644
2679
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
2645
2680
|
},
|
|
2646
2681
|
enumerable: !0
|
|
2647
2682
|
});
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2683
|
+
A.LEFT = 0;
|
|
2684
|
+
A.RIGHT = 1;
|
|
2685
|
+
A.SIDE = 2;
|
|
2686
|
+
A.THEME = fe;
|
|
2687
|
+
A.DARK_THEME = ue;
|
|
2688
|
+
A.version = Jo;
|
|
2689
|
+
A.E = Ze;
|
|
2690
|
+
A.new = (e) => ({
|
|
2656
2691
|
nodeData: {
|
|
2657
|
-
id:
|
|
2692
|
+
id: B(),
|
|
2658
2693
|
topic: e || "new topic",
|
|
2659
2694
|
children: []
|
|
2660
2695
|
}
|
|
2661
2696
|
});
|
|
2662
2697
|
export {
|
|
2663
|
-
|
|
2698
|
+
ue as DARK_THEME,
|
|
2664
2699
|
Qo as LEFT,
|
|
2665
2700
|
es as RIGHT,
|
|
2666
2701
|
ts as SIDE,
|
|
2667
|
-
|
|
2668
|
-
|
|
2702
|
+
fe as THEME,
|
|
2703
|
+
A as default
|
|
2669
2704
|
};
|