mind-elixir 5.13.0 → 5.14.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +643 -625
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +545 -518
- package/dist/types/arrow.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/methods.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/pubsub.d.ts +4 -0
- package/package.json +17 -17
- package/readme/es.md +453 -0
- package/readme/fr.md +437 -0
- package/readme/ja.md +452 -0
- package/readme/ko.md +435 -0
- package/readme/pt.md +436 -0
- package/readme/ru.md +435 -0
- package/readme/zh.md +453 -0
package/dist/MindElixir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ts = 0, ns = 1, os = 2, pe = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -27,7 +27,7 @@ const es = 0, ts = 1, ns = 2, fe = {
|
|
|
27
27
|
"--panel-border-color": "#eaeaea",
|
|
28
28
|
"--map-padding": "50px 80px"
|
|
29
29
|
}
|
|
30
|
-
},
|
|
30
|
+
}, ge = {
|
|
31
31
|
name: "Dark",
|
|
32
32
|
type: "dark",
|
|
33
33
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -56,42 +56,42 @@ const es = 0, ts = 1, ns = 2, fe = {
|
|
|
56
56
|
"--map-padding": "50px 80px"
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
function
|
|
59
|
+
function de(e) {
|
|
60
60
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const oe = function(e, t) {
|
|
63
63
|
if (t.id === e)
|
|
64
64
|
return t;
|
|
65
65
|
if (t.children && t.children.length) {
|
|
66
66
|
for (let n = 0; n < t.children.length; n++) {
|
|
67
|
-
const o =
|
|
67
|
+
const o = oe(e, t.children[n]);
|
|
68
68
|
if (o) return o;
|
|
69
69
|
}
|
|
70
70
|
return null;
|
|
71
71
|
} else
|
|
72
72
|
return null;
|
|
73
|
-
},
|
|
73
|
+
}, B = (e, t) => {
|
|
74
74
|
if (e.parent = t, e.children)
|
|
75
75
|
for (let n = 0; n < e.children.length; n++)
|
|
76
|
-
|
|
77
|
-
},
|
|
76
|
+
B(e.children[n], e);
|
|
77
|
+
}, K = (e, t, n) => {
|
|
78
78
|
if (e.expanded = t, e.children)
|
|
79
79
|
if (n === void 0 || n > 0) {
|
|
80
80
|
const o = n !== void 0 ? n - 1 : void 0;
|
|
81
81
|
e.children.forEach((s) => {
|
|
82
|
-
|
|
82
|
+
K(s, t, o);
|
|
83
83
|
});
|
|
84
84
|
} else
|
|
85
85
|
e.children.forEach((o) => {
|
|
86
|
-
|
|
86
|
+
K(o, !1);
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
function
|
|
90
|
-
if (e.id =
|
|
89
|
+
function me(e) {
|
|
90
|
+
if (e.id = W(), e.children)
|
|
91
91
|
for (let t = 0; t < e.children.length; t++)
|
|
92
|
-
|
|
92
|
+
me(e.children[t]);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function se(e, t, n, o) {
|
|
95
95
|
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;
|
|
96
96
|
return {
|
|
97
97
|
x1: n + Math.cos(d) * r,
|
|
@@ -100,17 +100,17 @@ function oe(e, t, n, o) {
|
|
|
100
100
|
y2: o + Math.sin(h) * r
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function W() {
|
|
104
104
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
const e =
|
|
106
|
+
const yt = function() {
|
|
107
|
+
const e = W();
|
|
108
108
|
return {
|
|
109
109
|
topic: this.newTopicName,
|
|
110
110
|
id: e
|
|
111
111
|
};
|
|
112
112
|
};
|
|
113
|
-
function
|
|
113
|
+
function ie(e) {
|
|
114
114
|
return JSON.parse(
|
|
115
115
|
JSON.stringify(e, (n, o) => {
|
|
116
116
|
if (n !== "parent")
|
|
@@ -118,7 +118,7 @@ function ge(e) {
|
|
|
118
118
|
})
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const A = (e, t) => {
|
|
122
122
|
let n = 0, o = 0;
|
|
123
123
|
for (; t && t !== e; )
|
|
124
124
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
@@ -126,7 +126,7 @@ const M = (e, t) => {
|
|
|
126
126
|
}, k = (e, t) => {
|
|
127
127
|
for (const n in t)
|
|
128
128
|
e.setAttribute(n, t[n]);
|
|
129
|
-
},
|
|
129
|
+
}, ne = (e) => e ? e.tagName === "ME-TPC" : !1, ye = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
130
130
|
for (let s = 0; s < o.length; s++) {
|
|
131
131
|
if (t === o[s]) continue;
|
|
132
132
|
const { parent: i } = t.nodeObj;
|
|
@@ -134,7 +134,7 @@ const M = (e, t) => {
|
|
|
134
134
|
return !1;
|
|
135
135
|
}
|
|
136
136
|
return !0;
|
|
137
|
-
}),
|
|
137
|
+
}), be = (e) => {
|
|
138
138
|
const t = /translate3d\(([^,]+),\s*([^,]+)/, n = e.match(t);
|
|
139
139
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
140
140
|
}, qe = function(e) {
|
|
@@ -148,31 +148,31 @@ const M = (e, t) => {
|
|
|
148
148
|
o.removeEventListener(s, i);
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
|
-
},
|
|
151
|
+
}, Le = (e, t) => {
|
|
152
152
|
const n = e.x - t.x, o = e.y - t.y;
|
|
153
153
|
return Math.sqrt(n * n + o * o);
|
|
154
|
-
},
|
|
154
|
+
}, bt = function(e, t) {
|
|
155
155
|
if (!t)
|
|
156
|
-
return
|
|
156
|
+
return re(e), e;
|
|
157
157
|
let n = e.querySelector(".insert-preview");
|
|
158
158
|
const o = `insert-preview ${t} show`;
|
|
159
159
|
return n || (n = document.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
160
|
-
},
|
|
160
|
+
}, re = function(e) {
|
|
161
161
|
if (!e) return;
|
|
162
162
|
const t = e.querySelectorAll(".insert-preview");
|
|
163
163
|
for (const n of t || [])
|
|
164
164
|
n.remove();
|
|
165
|
-
},
|
|
165
|
+
}, Ae = function(e, t) {
|
|
166
166
|
for (const n of t) {
|
|
167
167
|
const o = n.parentElement.parentElement.contains(e);
|
|
168
168
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
169
169
|
}
|
|
170
170
|
return !0;
|
|
171
|
-
},
|
|
171
|
+
}, vt = function(e) {
|
|
172
172
|
const t = document.createElement("div");
|
|
173
173
|
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
|
|
174
174
|
};
|
|
175
|
-
class
|
|
175
|
+
class xt {
|
|
176
176
|
mind;
|
|
177
177
|
isMoving = !1;
|
|
178
178
|
interval = null;
|
|
@@ -194,14 +194,14 @@ function wt(e) {
|
|
|
194
194
|
isDragging: !1,
|
|
195
195
|
insertType: null,
|
|
196
196
|
meet: null,
|
|
197
|
-
ghost:
|
|
198
|
-
edgeMoveController: new
|
|
197
|
+
ghost: vt(e),
|
|
198
|
+
edgeMoveController: new xt(e),
|
|
199
199
|
startX: 0,
|
|
200
200
|
startY: 0,
|
|
201
201
|
pointerId: null
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
|
-
const
|
|
204
|
+
const Et = 5;
|
|
205
205
|
function Me(e, t, n, o = !1) {
|
|
206
206
|
if (e.spacePressed) return !1;
|
|
207
207
|
const s = n.target;
|
|
@@ -225,58 +225,58 @@ function Je(e, t) {
|
|
|
225
225
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
226
226
|
e.panHelper.clear();
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Ct(e, t, n) {
|
|
229
229
|
const { dragged: o } = e;
|
|
230
230
|
if (!o || t.pointerId !== n.pointerId) return;
|
|
231
231
|
const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i);
|
|
232
|
-
if (!t.isDragging && l >
|
|
232
|
+
if (!t.isDragging && l > Et && Je(e, t), !t.isDragging) return;
|
|
233
233
|
const c = e.container.getBoundingClientRect();
|
|
234
|
-
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(),
|
|
234
|
+
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(), re(t.meet);
|
|
235
235
|
const r = 12 * e.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - r);
|
|
236
|
-
if (
|
|
236
|
+
if (Ae(a, o)) {
|
|
237
237
|
t.meet = a;
|
|
238
238
|
const d = a.getBoundingClientRect(), h = d.y;
|
|
239
239
|
n.clientY > h + d.height ? t.insertType = "after" : t.insertType = "in";
|
|
240
240
|
} else {
|
|
241
241
|
const d = document.elementFromPoint(n.clientX, n.clientY + r);
|
|
242
|
-
if (
|
|
242
|
+
if (Ae(d, o)) {
|
|
243
243
|
t.meet = d;
|
|
244
244
|
const u = d.getBoundingClientRect().y;
|
|
245
245
|
n.clientY < u ? t.insertType = "before" : t.insertType = "in";
|
|
246
246
|
} else
|
|
247
247
|
t.insertType = null, t.meet = null;
|
|
248
248
|
}
|
|
249
|
-
t.meet &&
|
|
249
|
+
t.meet && bt(t.meet, t.insertType);
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function St(e, t, n) {
|
|
252
252
|
const { dragged: o } = e;
|
|
253
253
|
if (!(!o || t.pointerId !== n.pointerId)) {
|
|
254
254
|
t.edgeMoveController.stop();
|
|
255
255
|
for (const s of o)
|
|
256
256
|
s.parentElement.parentElement.style.opacity = "1";
|
|
257
|
-
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (
|
|
257
|
+
t.ghost.style.display = "none", t.ghost.innerHTML = "", t.isDragging && t.meet && (re(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;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Pe(e, t) {
|
|
261
261
|
const { dragged: n } = e;
|
|
262
262
|
if (n) {
|
|
263
263
|
t.edgeMoveController.stop();
|
|
264
264
|
for (const o of n)
|
|
265
265
|
o.parentElement.parentElement.style.opacity = "1";
|
|
266
|
-
t.meet &&
|
|
266
|
+
t.meet && re(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;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function Nt(e) {
|
|
270
270
|
return () => {
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
-
const
|
|
273
|
+
const $ = {
|
|
274
274
|
LHS: "lhs",
|
|
275
275
|
RHS: "rhs"
|
|
276
|
-
},
|
|
276
|
+
}, Tt = function() {
|
|
277
277
|
this.nodes.innerHTML = "";
|
|
278
278
|
const e = this.createTopic(this.nodeData);
|
|
279
|
-
|
|
279
|
+
ve.call(this, e, this.nodeData), e.draggable = !1;
|
|
280
280
|
const t = document.createElement("me-root");
|
|
281
281
|
t.appendChild(e);
|
|
282
282
|
const n = this.nodeData.children || [];
|
|
@@ -286,18 +286,18 @@ const H = {
|
|
|
286
286
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
|
-
|
|
290
|
-
},
|
|
289
|
+
kt(this, n, t);
|
|
290
|
+
}, kt = function(e, t, n) {
|
|
291
291
|
const o = document.createElement("me-main");
|
|
292
|
-
o.className =
|
|
292
|
+
o.className = $.LHS;
|
|
293
293
|
const s = document.createElement("me-main");
|
|
294
|
-
s.className =
|
|
294
|
+
s.className = $.RHS;
|
|
295
295
|
for (let i = 0; i < t.length; i++) {
|
|
296
296
|
const l = t[i], { grp: c } = e.createWrapper(l);
|
|
297
297
|
e.direction === 2 ? l.direction === 0 ? o.appendChild(c) : s.appendChild(c) : e.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
298
298
|
}
|
|
299
299
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
|
|
300
|
-
},
|
|
300
|
+
}, _t = function(e, t) {
|
|
301
301
|
const n = document.createElement("me-children");
|
|
302
302
|
for (let o = 0; o < t.length; o++) {
|
|
303
303
|
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
@@ -308,7 +308,7 @@ const H = {
|
|
|
308
308
|
const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
309
309
|
if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
310
310
|
return o;
|
|
311
|
-
},
|
|
311
|
+
}, ve = function(e, t) {
|
|
312
312
|
if (e.innerHTML = "", t.style) {
|
|
313
313
|
const n = t.style;
|
|
314
314
|
for (const o in n)
|
|
@@ -335,7 +335,7 @@ const H = {
|
|
|
335
335
|
} else e.link && (e.link = void 0);
|
|
336
336
|
if (t.icons && t.icons.length) {
|
|
337
337
|
const n = document.createElement("span");
|
|
338
|
-
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${
|
|
338
|
+
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${de(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
339
339
|
} else e.icons && (e.icons = void 0);
|
|
340
340
|
if (t.tags && t.tags.length) {
|
|
341
341
|
const n = document.createElement("div");
|
|
@@ -344,20 +344,20 @@ const H = {
|
|
|
344
344
|
typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
|
|
345
345
|
}), e.appendChild(n), e.tags = n;
|
|
346
346
|
} else e.tags && (e.tags = void 0);
|
|
347
|
-
},
|
|
347
|
+
}, Dt = function(e, t) {
|
|
348
348
|
const n = document.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
349
349
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
350
|
-
const i =
|
|
350
|
+
const i = xe(e.expanded);
|
|
351
351
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
352
|
-
const l =
|
|
352
|
+
const l = _t(this, e.children);
|
|
353
353
|
n.appendChild(l);
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
return { grp: n, top: o, tpc: s };
|
|
357
|
-
}, Dt = function(e) {
|
|
358
|
-
const t = document.createElement("me-parent"), n = this.createTopic(e);
|
|
359
|
-
return be.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
360
357
|
}, Lt = function(e) {
|
|
358
|
+
const t = document.createElement("me-parent"), n = this.createTopic(e);
|
|
359
|
+
return ve.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
360
|
+
}, At = function(e) {
|
|
361
361
|
const t = document.createElement("me-children");
|
|
362
362
|
return t.append(...e), t;
|
|
363
363
|
}, Mt = function(e) {
|
|
@@ -370,9 +370,9 @@ function Qe(e) {
|
|
|
370
370
|
const n = window.getSelection();
|
|
371
371
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
372
372
|
}
|
|
373
|
-
const
|
|
373
|
+
const Pt = function(e) {
|
|
374
374
|
if (!e) return;
|
|
375
|
-
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } =
|
|
375
|
+
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = A(this.nodes, e);
|
|
376
376
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
377
377
|
const l = getComputedStyle(e);
|
|
378
378
|
t.style.cssText = `
|
|
@@ -405,35 +405,35 @@ const At = function(e) {
|
|
|
405
405
|
origin: o
|
|
406
406
|
}));
|
|
407
407
|
});
|
|
408
|
-
},
|
|
408
|
+
}, xe = function(e) {
|
|
409
409
|
const t = document.createElement("me-epd");
|
|
410
410
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
411
|
-
},
|
|
411
|
+
}, z = (e) => {
|
|
412
412
|
const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
|
|
413
413
|
return { siblings: t, index: n };
|
|
414
414
|
};
|
|
415
|
-
function
|
|
416
|
-
const { siblings: t, index: n } =
|
|
415
|
+
function Ot(e) {
|
|
416
|
+
const { siblings: t, index: n } = z(e);
|
|
417
417
|
if (t === void 0) return;
|
|
418
418
|
const o = t[n];
|
|
419
419
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
420
420
|
}
|
|
421
|
-
function
|
|
422
|
-
const { siblings: t, index: n } =
|
|
421
|
+
function $t(e) {
|
|
422
|
+
const { siblings: t, index: n } = z(e);
|
|
423
423
|
if (t === void 0) return;
|
|
424
424
|
const o = t[n];
|
|
425
425
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
426
426
|
}
|
|
427
427
|
function et(e) {
|
|
428
|
-
const { siblings: t, index: n } =
|
|
428
|
+
const { siblings: t, index: n } = z(e);
|
|
429
429
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
430
430
|
}
|
|
431
431
|
function Ht(e, t, n) {
|
|
432
|
-
const { siblings: o, index: s } =
|
|
432
|
+
const { siblings: o, index: s } = z(n);
|
|
433
433
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
434
434
|
}
|
|
435
|
-
function
|
|
436
|
-
const { siblings: n, index: o } =
|
|
435
|
+
function It(e, t) {
|
|
436
|
+
const { siblings: n, index: o } = z(e);
|
|
437
437
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
438
438
|
}
|
|
439
439
|
function jt(e, t, n) {
|
|
@@ -441,12 +441,12 @@ function jt(e, t, n) {
|
|
|
441
441
|
n.children ? n.children.push(t) : n.children = [t];
|
|
442
442
|
else {
|
|
443
443
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
444
|
-
const { siblings: o, index: s } =
|
|
444
|
+
const { siblings: o, index: s } = z(n);
|
|
445
445
|
if (o === void 0) return;
|
|
446
446
|
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
const
|
|
449
|
+
const Rt = function({ map: e, direction: t }, n) {
|
|
450
450
|
if (t === 0)
|
|
451
451
|
return 0;
|
|
452
452
|
if (t === 1)
|
|
@@ -458,15 +458,15 @@ const It = function({ map: e, direction: t }, n) {
|
|
|
458
458
|
}, tt = function(e, t, n) {
|
|
459
459
|
const o = n.children[0].children[0], s = t.parentElement;
|
|
460
460
|
if (s.tagName === "ME-PARENT") {
|
|
461
|
-
if (
|
|
461
|
+
if (U(o), s.children[1])
|
|
462
462
|
s.nextSibling.appendChild(n);
|
|
463
463
|
else {
|
|
464
464
|
const i = e.createChildren([n]);
|
|
465
|
-
s.appendChild(
|
|
465
|
+
s.appendChild(xe(!0)), s.insertAdjacentElement("afterend", i);
|
|
466
466
|
}
|
|
467
467
|
e.linkDiv(n.offsetParent);
|
|
468
|
-
} else s.tagName === "ME-ROOT" && (
|
|
469
|
-
},
|
|
468
|
+
} else s.tagName === "ME-ROOT" && (Rt(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
|
|
469
|
+
}, Bt = function(e, t) {
|
|
470
470
|
const n = e.parentNode;
|
|
471
471
|
if (t === 0) {
|
|
472
472
|
const o = n.parentNode.parentNode;
|
|
@@ -476,14 +476,14 @@ const It = function({ map: e, direction: t }, n) {
|
|
|
476
476
|
}, nt = {
|
|
477
477
|
before: "beforebegin",
|
|
478
478
|
after: "afterend"
|
|
479
|
-
},
|
|
479
|
+
}, U = function(e) {
|
|
480
480
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
481
481
|
n?.tagName === "svg" && n?.remove();
|
|
482
|
-
},
|
|
483
|
-
const n = e.nodeObj, o =
|
|
482
|
+
}, Wt = function(e, t) {
|
|
483
|
+
const n = e.nodeObj, o = ie(n);
|
|
484
484
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
485
485
|
const s = Object.assign(n, t);
|
|
486
|
-
|
|
486
|
+
ve.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
487
487
|
name: "reshapeNode",
|
|
488
488
|
obj: s,
|
|
489
489
|
origin: o
|
|
@@ -493,10 +493,10 @@ const It = function({ map: e, direction: t }, n) {
|
|
|
493
493
|
const o = t.nodeObj;
|
|
494
494
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
495
495
|
const s = n || e.generateNewObj();
|
|
496
|
-
o.children ? o.children.push(s) : o.children = [s],
|
|
496
|
+
o.children ? o.children.push(s) : o.children = [s], B(e.nodeData);
|
|
497
497
|
const { grp: i, top: l } = e.createWrapper(s);
|
|
498
498
|
return tt(e, t, i), { newTop: l, newNodeObj: s };
|
|
499
|
-
},
|
|
499
|
+
}, Yt = function(e, t, n) {
|
|
500
500
|
const o = t || this.currentNode;
|
|
501
501
|
if (!o) return;
|
|
502
502
|
const s = o.nodeObj;
|
|
@@ -514,33 +514,33 @@ const It = function({ map: e, direction: t }, n) {
|
|
|
514
514
|
}
|
|
515
515
|
const i = n || this.generateNewObj();
|
|
516
516
|
if (!s.parent?.parent) {
|
|
517
|
-
const a = o.closest("me-main").className ===
|
|
517
|
+
const a = o.closest("me-main").className === $.LHS ? 0 : 1;
|
|
518
518
|
i.direction = a;
|
|
519
519
|
}
|
|
520
|
-
Ht(i, e, s),
|
|
520
|
+
Ht(i, e, s), B(this.nodeData);
|
|
521
521
|
const l = o.parentElement, { grp: c, top: r } = this.createWrapper(i);
|
|
522
522
|
l.parentElement.insertAdjacentElement(nt[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(r.firstChild), this.bus.fire("operation", {
|
|
523
523
|
name: "insertSibling",
|
|
524
524
|
type: e,
|
|
525
525
|
obj: i
|
|
526
526
|
}), this.selectNode(r.firstChild, !0);
|
|
527
|
-
},
|
|
527
|
+
}, Xt = function(e, t) {
|
|
528
528
|
const n = e || this.currentNode;
|
|
529
529
|
if (!n) return;
|
|
530
|
-
|
|
530
|
+
U(n);
|
|
531
531
|
const o = n.nodeObj;
|
|
532
532
|
if (!o.parent)
|
|
533
533
|
return;
|
|
534
534
|
const s = t || this.generateNewObj();
|
|
535
|
-
|
|
535
|
+
It(o, s), B(this.nodeData);
|
|
536
536
|
const i = n.parentElement.parentElement, { grp: l, top: c } = this.createWrapper(s, !0);
|
|
537
|
-
c.appendChild(
|
|
537
|
+
c.appendChild(xe(!0)), i.insertAdjacentElement("afterend", l);
|
|
538
538
|
const r = this.createChildren([i]);
|
|
539
539
|
c.insertAdjacentElement("afterend", r), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
|
|
540
540
|
name: "insertParent",
|
|
541
541
|
obj: s
|
|
542
542
|
});
|
|
543
|
-
},
|
|
543
|
+
}, Ft = function(e, t) {
|
|
544
544
|
const n = e || this.currentNode;
|
|
545
545
|
if (!n) return;
|
|
546
546
|
const o = we(this, n, t);
|
|
@@ -550,9 +550,9 @@ const It = function({ map: e, direction: t }, n) {
|
|
|
550
550
|
name: "addChild",
|
|
551
551
|
obj: i
|
|
552
552
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
553
|
-
},
|
|
554
|
-
const n =
|
|
555
|
-
|
|
553
|
+
}, Kt = function(e, t) {
|
|
554
|
+
const n = ie(e.nodeObj);
|
|
555
|
+
me(n);
|
|
556
556
|
const o = we(this, t, n);
|
|
557
557
|
if (!o) return;
|
|
558
558
|
const { newNodeObj: s } = o;
|
|
@@ -560,11 +560,11 @@ const It = function({ map: e, direction: t }, n) {
|
|
|
560
560
|
name: "copyNode",
|
|
561
561
|
obj: s
|
|
562
562
|
});
|
|
563
|
-
},
|
|
563
|
+
}, Vt = function(e, t) {
|
|
564
564
|
const n = [];
|
|
565
565
|
for (let o = 0; o < e.length; o++) {
|
|
566
|
-
const s = e[o], i =
|
|
567
|
-
|
|
566
|
+
const s = e[o], i = ie(s.nodeObj);
|
|
567
|
+
me(i);
|
|
568
568
|
const l = we(this, t, i);
|
|
569
569
|
if (!l) return;
|
|
570
570
|
const { newNodeObj: c } = l;
|
|
@@ -574,49 +574,49 @@ const It = function({ map: e, direction: t }, n) {
|
|
|
574
574
|
name: "copyNodes",
|
|
575
575
|
objs: n
|
|
576
576
|
});
|
|
577
|
-
},
|
|
577
|
+
}, zt = function(e) {
|
|
578
578
|
const t = e || this.currentNode;
|
|
579
579
|
if (!t) return;
|
|
580
580
|
const n = t.nodeObj;
|
|
581
|
-
|
|
581
|
+
Ot(n);
|
|
582
582
|
const o = t.parentNode.parentNode;
|
|
583
583
|
o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
|
|
584
584
|
name: "moveUpNode",
|
|
585
585
|
obj: n
|
|
586
586
|
});
|
|
587
|
-
},
|
|
587
|
+
}, Gt = function(e) {
|
|
588
588
|
const t = e || this.currentNode;
|
|
589
589
|
if (!t) return;
|
|
590
590
|
const n = t.nodeObj;
|
|
591
|
-
|
|
591
|
+
$t(n);
|
|
592
592
|
const o = t.parentNode.parentNode;
|
|
593
593
|
o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
|
|
594
594
|
name: "moveDownNode",
|
|
595
595
|
obj: n
|
|
596
596
|
});
|
|
597
|
-
},
|
|
598
|
-
if (e =
|
|
597
|
+
}, qt = function(e) {
|
|
598
|
+
if (e = ye(e), e.length === 0) return;
|
|
599
599
|
for (const n of e) {
|
|
600
600
|
const o = n.nodeObj, s = et(o);
|
|
601
|
-
|
|
601
|
+
Bt(n, s);
|
|
602
602
|
}
|
|
603
603
|
const t = e[e.length - 1];
|
|
604
604
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
605
605
|
name: "removeNodes",
|
|
606
606
|
objs: e.map((n) => n.nodeObj)
|
|
607
607
|
});
|
|
608
|
-
},
|
|
609
|
-
e =
|
|
608
|
+
}, Ee = (e, t, n, o) => {
|
|
609
|
+
e = ye(e);
|
|
610
610
|
let s = n.nodeObj;
|
|
611
611
|
t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
|
|
612
612
|
const i = [];
|
|
613
613
|
for (const c of e) {
|
|
614
614
|
const r = c.nodeObj;
|
|
615
|
-
if (jt(t, r, s),
|
|
615
|
+
if (jt(t, r, s), B(o.nodeData), t === "in") {
|
|
616
616
|
const a = c.parentElement;
|
|
617
617
|
tt(o, n, a.parentElement);
|
|
618
618
|
} else {
|
|
619
|
-
|
|
619
|
+
U(c);
|
|
620
620
|
const a = c.parentElement.parentNode;
|
|
621
621
|
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(nt[t], a);
|
|
622
622
|
}
|
|
@@ -630,36 +630,36 @@ const It = function({ map: e, direction: t }, n) {
|
|
|
630
630
|
objs: e.map((c) => c.nodeObj),
|
|
631
631
|
toObj: s
|
|
632
632
|
});
|
|
633
|
-
}, qt = function(e, t) {
|
|
634
|
-
xe(e, "in", t, this);
|
|
635
633
|
}, Ut = function(e, t) {
|
|
636
|
-
|
|
634
|
+
Ee(e, "in", t, this);
|
|
637
635
|
}, Jt = function(e, t) {
|
|
638
|
-
|
|
639
|
-
}, Zt = function(e) {
|
|
636
|
+
Ee(e, "before", t, this);
|
|
637
|
+
}, Zt = function(e, t) {
|
|
638
|
+
Ee(e, "after", t, this);
|
|
639
|
+
}, Qt = function(e) {
|
|
640
640
|
const t = e || this.currentNode;
|
|
641
641
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
642
|
-
},
|
|
642
|
+
}, en = function(e, t) {
|
|
643
643
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
644
644
|
}, ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
645
645
|
__proto__: null,
|
|
646
|
-
addChild:
|
|
647
|
-
beginEdit:
|
|
648
|
-
copyNode:
|
|
649
|
-
copyNodes:
|
|
650
|
-
insertParent:
|
|
651
|
-
insertSibling:
|
|
652
|
-
moveDownNode:
|
|
653
|
-
moveNodeAfter:
|
|
654
|
-
moveNodeBefore:
|
|
655
|
-
moveNodeIn:
|
|
656
|
-
moveUpNode:
|
|
657
|
-
removeNodes:
|
|
658
|
-
reshapeNode:
|
|
659
|
-
rmSubline:
|
|
660
|
-
setNodeTopic:
|
|
646
|
+
addChild: Ft,
|
|
647
|
+
beginEdit: Qt,
|
|
648
|
+
copyNode: Kt,
|
|
649
|
+
copyNodes: Vt,
|
|
650
|
+
insertParent: Xt,
|
|
651
|
+
insertSibling: Yt,
|
|
652
|
+
moveDownNode: Gt,
|
|
653
|
+
moveNodeAfter: Zt,
|
|
654
|
+
moveNodeBefore: Jt,
|
|
655
|
+
moveNodeIn: Ut,
|
|
656
|
+
moveUpNode: zt,
|
|
657
|
+
removeNodes: qt,
|
|
658
|
+
reshapeNode: Wt,
|
|
659
|
+
rmSubline: U,
|
|
660
|
+
setNodeTopic: en
|
|
661
661
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
662
|
-
function
|
|
662
|
+
function tn(e) {
|
|
663
663
|
return {
|
|
664
664
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
665
665
|
arrows: e.arrows,
|
|
@@ -670,62 +670,62 @@ function en(e) {
|
|
|
670
670
|
meta: e.meta
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
const
|
|
673
|
+
const nn = function(e, t = !1) {
|
|
674
674
|
const n = this.container, o = e.getBoundingClientRect(), s = n.getBoundingClientRect();
|
|
675
675
|
if (t || o.top > s.bottom - 50 || o.bottom < s.top + 50 || o.left > s.right - 50 || o.right < s.left + 50) {
|
|
676
676
|
const l = o.left + o.width / 2, c = o.top + o.height / 2, r = s.left + s.width / 2, a = s.top + s.height / 2, d = l - r, h = c - a;
|
|
677
677
|
this.move(-d, -h, !0);
|
|
678
678
|
}
|
|
679
|
-
},
|
|
679
|
+
}, on = function(e, t, n) {
|
|
680
680
|
this.clearSelection(), this.scrollIntoView(e), this.selection?.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
681
|
-
}, on = function(e) {
|
|
682
|
-
this.selection?.select(e);
|
|
683
681
|
}, sn = function(e) {
|
|
682
|
+
this.selection?.select(e);
|
|
683
|
+
}, rn = function(e) {
|
|
684
684
|
this.selection?.deselect(e);
|
|
685
|
-
},
|
|
685
|
+
}, ln = function() {
|
|
686
686
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
687
|
-
},
|
|
687
|
+
}, Ce = function(e) {
|
|
688
688
|
return JSON.stringify(e, (t, n) => {
|
|
689
689
|
if (!(t === "parent" && typeof n != "string"))
|
|
690
690
|
return n;
|
|
691
691
|
});
|
|
692
|
-
}, ln = function() {
|
|
693
|
-
const e = en(this);
|
|
694
|
-
return Ee(e);
|
|
695
692
|
}, cn = function() {
|
|
696
|
-
|
|
693
|
+
const e = tn(this);
|
|
694
|
+
return Ce(e);
|
|
697
695
|
}, an = function() {
|
|
698
|
-
this.
|
|
696
|
+
return JSON.parse(this.getDataString());
|
|
699
697
|
}, dn = function() {
|
|
698
|
+
this.editable = !0;
|
|
699
|
+
}, hn = function() {
|
|
700
700
|
this.editable = !1;
|
|
701
|
-
},
|
|
701
|
+
}, fn = function(e, t = { x: 0, y: 0 }) {
|
|
702
702
|
if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
|
|
703
|
-
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 } =
|
|
704
|
-
this.map.style.transform = `translate3d(${r -
|
|
705
|
-
},
|
|
703
|
+
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 } = Se(this), c = this.map.style.transform, { x: r, y: a } = be(c), d = r - i, h = a - l, u = this.scaleVal, p = (-o + d) * (1 - e / u), v = (-s + h) * (1 - e / u);
|
|
704
|
+
this.map.style.transform = `translate3d(${r - p}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
705
|
+
}, un = function() {
|
|
706
706
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
707
707
|
this.scaleVal = n;
|
|
708
|
-
const { dx: o, dy: s } =
|
|
708
|
+
const { dx: o, dy: s } = Se(this, !0);
|
|
709
709
|
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
710
|
-
},
|
|
710
|
+
}, pn = function(e, t, n = !1) {
|
|
711
711
|
const { map: o, scaleVal: s, bus: i, container: l, nodes: c } = this;
|
|
712
712
|
if (n && o.style.transition === "transform 0.3s")
|
|
713
713
|
return;
|
|
714
714
|
const r = o.style.transform;
|
|
715
|
-
let { x: a, y: d } =
|
|
716
|
-
const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(),
|
|
717
|
-
if (
|
|
718
|
-
const
|
|
719
|
-
(
|
|
715
|
+
let { x: a, y: d } = be(r);
|
|
716
|
+
const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(), p = u.left < h.right && u.right > h.left, v = u.top < h.bottom && u.bottom > h.top;
|
|
717
|
+
if (p) {
|
|
718
|
+
const m = u.left + e, y = u.right + e;
|
|
719
|
+
(m >= h.right || y <= h.left) && (e = 0);
|
|
720
720
|
}
|
|
721
721
|
if (v) {
|
|
722
|
-
const
|
|
723
|
-
(
|
|
722
|
+
const m = u.top + t, y = u.bottom + t;
|
|
723
|
+
(m >= h.bottom || y <= h.top) && (t = 0);
|
|
724
724
|
}
|
|
725
725
|
a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
726
726
|
o.style.transition = "none";
|
|
727
727
|
}, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
728
|
-
},
|
|
728
|
+
}, Se = (e, t = !1) => {
|
|
729
729
|
const { container: n, map: o, nodes: s } = e;
|
|
730
730
|
let i, l;
|
|
731
731
|
if (e.alignment === "nodes" || t)
|
|
@@ -735,29 +735,29 @@ const tn = function(e, t = !1) {
|
|
|
735
735
|
i = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - r - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
|
|
736
736
|
}
|
|
737
737
|
return { dx: i, dy: l };
|
|
738
|
-
},
|
|
739
|
-
const { map: e, container: t } = this, { dx: n, dy: o } =
|
|
738
|
+
}, gn = function() {
|
|
739
|
+
const { map: e, container: t } = this, { dx: n, dy: o } = Se(this);
|
|
740
740
|
t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
741
|
-
}, gn = function(e) {
|
|
742
|
-
e(this);
|
|
743
741
|
}, mn = function(e) {
|
|
742
|
+
e(this);
|
|
743
|
+
}, yn = function(e) {
|
|
744
744
|
e.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
|
|
745
|
-
}, yn = function() {
|
|
746
|
-
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
747
745
|
}, bn = function() {
|
|
748
|
-
this.
|
|
746
|
+
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
749
747
|
}, vn = function() {
|
|
748
|
+
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
749
|
+
}, xn = function() {
|
|
750
750
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
751
751
|
}, wn = function() {
|
|
752
752
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
753
|
-
},
|
|
753
|
+
}, En = function(e, t) {
|
|
754
754
|
const n = e.nodeObj;
|
|
755
755
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
756
756
|
const o = e.getBoundingClientRect(), s = {
|
|
757
757
|
x: o.left,
|
|
758
758
|
y: o.top
|
|
759
759
|
}, i = e.parentNode, l = i.children[1];
|
|
760
|
-
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "",
|
|
760
|
+
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", U(e), n.expanded) {
|
|
761
761
|
const h = this.createChildren(
|
|
762
762
|
n.children.map((u) => this.createWrapper(u).grp)
|
|
763
763
|
);
|
|
@@ -770,53 +770,53 @@ const tn = function(e, t = !1) {
|
|
|
770
770
|
y: c.top
|
|
771
771
|
}, a = s.x - r.x, d = s.y - r.y;
|
|
772
772
|
this.move(a, d), this.bus.fire("expandNode", n);
|
|
773
|
-
},
|
|
773
|
+
}, Cn = function(e, t) {
|
|
774
774
|
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
775
775
|
x: o.left,
|
|
776
776
|
y: o.top
|
|
777
777
|
};
|
|
778
|
-
|
|
778
|
+
K(n, t ?? !n.expanded), this.refresh();
|
|
779
779
|
const i = this.findEle(n.id).getBoundingClientRect(), l = {
|
|
780
780
|
x: i.left,
|
|
781
781
|
y: i.top
|
|
782
782
|
}, c = s.x - l.x, r = s.y - l.y;
|
|
783
783
|
this.move(c, r);
|
|
784
|
-
},
|
|
785
|
-
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.meta && (this.meta = e.meta), e.theme && this.changeTheme(e.theme)),
|
|
786
|
-
},
|
|
784
|
+
}, Sn = function(e) {
|
|
785
|
+
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.meta && (this.meta = e.meta), e.theme && this.changeTheme(e.theme)), B(this.nodeData), this.layout(), this.linkDiv();
|
|
786
|
+
}, Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
787
787
|
__proto__: null,
|
|
788
|
-
cancelFocus:
|
|
789
|
-
clearSelection:
|
|
790
|
-
disableEdit:
|
|
791
|
-
enableEdit:
|
|
792
|
-
expandNode:
|
|
793
|
-
expandNodeAll:
|
|
794
|
-
focusNode:
|
|
795
|
-
getData:
|
|
796
|
-
getDataString:
|
|
797
|
-
initLeft:
|
|
798
|
-
initRight:
|
|
788
|
+
cancelFocus: bn,
|
|
789
|
+
clearSelection: ln,
|
|
790
|
+
disableEdit: hn,
|
|
791
|
+
enableEdit: dn,
|
|
792
|
+
expandNode: En,
|
|
793
|
+
expandNodeAll: Cn,
|
|
794
|
+
focusNode: yn,
|
|
795
|
+
getData: an,
|
|
796
|
+
getDataString: cn,
|
|
797
|
+
initLeft: vn,
|
|
798
|
+
initRight: xn,
|
|
799
799
|
initSide: wn,
|
|
800
|
-
install:
|
|
801
|
-
move:
|
|
802
|
-
refresh:
|
|
803
|
-
scale:
|
|
804
|
-
scaleFit:
|
|
805
|
-
scrollIntoView:
|
|
806
|
-
selectNode:
|
|
807
|
-
selectNodes:
|
|
808
|
-
stringifyData:
|
|
809
|
-
toCenter:
|
|
810
|
-
unselectNodes:
|
|
811
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
812
|
-
const i = -
|
|
800
|
+
install: mn,
|
|
801
|
+
move: pn,
|
|
802
|
+
refresh: Sn,
|
|
803
|
+
scale: fn,
|
|
804
|
+
scaleFit: un,
|
|
805
|
+
scrollIntoView: nn,
|
|
806
|
+
selectNode: on,
|
|
807
|
+
selectNodes: sn,
|
|
808
|
+
stringifyData: Ce,
|
|
809
|
+
toCenter: gn,
|
|
810
|
+
unselectNodes: rn
|
|
811
|
+
}, Symbol.toStringTag, { value: "Module" })), Oe = "MIND-ELIXIR-WAIT-COPY", Tn = 40, kn = 10, _n = ({ deltaMode: e, deltaY: t, viewportHeight: n }) => e === WheelEvent.DOM_DELTA_LINE ? t * Tn : e === WheelEvent.DOM_DELTA_PAGE ? t * n : t, Dn = ({ deltaMode: e, deltaY: t, scaleSensitivity: n, viewportHeight: o }) => {
|
|
812
|
+
const i = -_n({ deltaMode: e, deltaY: t, viewportHeight: o }) / kn * n;
|
|
813
813
|
return Math.max(-n, Math.min(n, i));
|
|
814
814
|
}, st = (e, t, n) => {
|
|
815
815
|
t !== 0 && e.scale(e.scaleVal + t, n);
|
|
816
|
-
},
|
|
816
|
+
}, Ln = (e, t) => {
|
|
817
817
|
const n = e.map.querySelectorAll(`.${t}>me-wrapper>me-parent>me-tpc`);
|
|
818
818
|
n.length !== 0 && e.selectNode(n[Math.ceil(n.length / 2) - 1]);
|
|
819
|
-
},
|
|
819
|
+
}, An = (e) => {
|
|
820
820
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
821
821
|
}, Mn = function(e, t) {
|
|
822
822
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
@@ -824,27 +824,27 @@ const tn = function(e, t = !1) {
|
|
|
824
824
|
const o = n.firstChild;
|
|
825
825
|
e.selectNode(o);
|
|
826
826
|
}
|
|
827
|
-
},
|
|
827
|
+
}, Pn = function(e, t) {
|
|
828
828
|
const n = t.parentElement.nextSibling;
|
|
829
829
|
if (n && n.firstChild) {
|
|
830
830
|
const o = n.firstChild.firstChild.firstChild;
|
|
831
831
|
e.selectNode(o);
|
|
832
832
|
}
|
|
833
|
-
},
|
|
833
|
+
}, $e = function(e, t) {
|
|
834
834
|
const n = e.currentNode || e.currentNodes?.[0];
|
|
835
835
|
if (!n) return;
|
|
836
836
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
837
|
-
o.parent ? s.className === t ?
|
|
837
|
+
o.parent ? s.className === t ? Pn(e, n) : o.parent?.parent ? Mn(e, n) : An(e) : Ln(e, t);
|
|
838
838
|
}, He = function(e, t) {
|
|
839
839
|
const n = e.currentNode;
|
|
840
840
|
if (!n || !n.nodeObj.parent) return;
|
|
841
841
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
842
842
|
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
843
|
-
},
|
|
843
|
+
}, Ie = function(e, t, n) {
|
|
844
844
|
const o = t === "in" ? e.scaleSensitivity : -e.scaleSensitivity;
|
|
845
845
|
st(e, o, n);
|
|
846
|
-
},
|
|
847
|
-
const n =
|
|
846
|
+
}, On = (e, t) => {
|
|
847
|
+
const n = Dn({
|
|
848
848
|
deltaMode: t.deltaMode,
|
|
849
849
|
deltaY: t.deltaY,
|
|
850
850
|
scaleSensitivity: e.scaleSensitivity,
|
|
@@ -852,7 +852,7 @@ const tn = function(e, t = !1) {
|
|
|
852
852
|
});
|
|
853
853
|
st(e, n, { x: t.clientX, y: t.clientY });
|
|
854
854
|
};
|
|
855
|
-
function
|
|
855
|
+
function $n(e, t) {
|
|
856
856
|
t = t === !0 ? {} : t;
|
|
857
857
|
const n = () => {
|
|
858
858
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
@@ -862,13 +862,13 @@ function On(e, t) {
|
|
|
862
862
|
const a = e.nodeData;
|
|
863
863
|
if (r.key === "0")
|
|
864
864
|
for (const d of a.children)
|
|
865
|
-
|
|
865
|
+
K(d, !1);
|
|
866
866
|
if (r.key === "=")
|
|
867
867
|
for (const d of a.children)
|
|
868
|
-
|
|
868
|
+
K(d, !0);
|
|
869
869
|
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
|
|
870
870
|
for (const d of a.children)
|
|
871
|
-
|
|
871
|
+
K(d, !0, Number(r.key) - 1);
|
|
872
872
|
e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
|
|
873
873
|
}, l = {
|
|
874
874
|
Enter: (r) => {
|
|
@@ -898,22 +898,22 @@ function On(e, t) {
|
|
|
898
898
|
ArrowLeft: (r) => {
|
|
899
899
|
if (r.metaKey || r.ctrlKey)
|
|
900
900
|
return e.initLeft();
|
|
901
|
-
|
|
901
|
+
$e(e, $.LHS);
|
|
902
902
|
},
|
|
903
903
|
ArrowRight: (r) => {
|
|
904
904
|
if (r.metaKey || r.ctrlKey)
|
|
905
905
|
return e.initRight();
|
|
906
|
-
|
|
906
|
+
$e(e, $.RHS);
|
|
907
907
|
},
|
|
908
908
|
PageUp: () => e.moveUpNode(),
|
|
909
909
|
PageDown: () => {
|
|
910
910
|
e.moveDownNode();
|
|
911
911
|
},
|
|
912
912
|
"=": (r) => {
|
|
913
|
-
(r.metaKey || r.ctrlKey) &&
|
|
913
|
+
(r.metaKey || r.ctrlKey) && Ie(e, "in");
|
|
914
914
|
},
|
|
915
915
|
"-": (r) => {
|
|
916
|
-
(r.metaKey || r.ctrlKey) &&
|
|
916
|
+
(r.metaKey || r.ctrlKey) && Ie(e, "out");
|
|
917
917
|
},
|
|
918
918
|
0: (r) => {
|
|
919
919
|
if (r.metaKey || r.ctrlKey) {
|
|
@@ -939,8 +939,8 @@ function On(e, t) {
|
|
|
939
939
|
const c = (r) => {
|
|
940
940
|
if (r.target instanceof HTMLElement && r.target.id === "input-box" || e.currentNodes.length === 0) return !1;
|
|
941
941
|
if (r.clipboardData) {
|
|
942
|
-
const a =
|
|
943
|
-
magic:
|
|
942
|
+
const a = ye(e.currentNodes).map((h) => h.nodeObj), d = Ce({
|
|
943
|
+
magic: Oe,
|
|
944
944
|
data: a
|
|
945
945
|
});
|
|
946
946
|
return r.clipboardData.setData("text/plain", d), r.preventDefault(), !0;
|
|
@@ -954,8 +954,8 @@ function On(e, t) {
|
|
|
954
954
|
if (a)
|
|
955
955
|
try {
|
|
956
956
|
const d = JSON.parse(a);
|
|
957
|
-
if (d && d.magic ===
|
|
958
|
-
const h = d.data, u = h.map((
|
|
957
|
+
if (d && d.magic === Oe && Array.isArray(d.data)) {
|
|
958
|
+
const h = d.data, u = h.map((p) => ({ nodeObj: p }));
|
|
959
959
|
h.length > 0 && e.currentNode && (e.copyNodes(u, e.currentNode), r.preventDefault());
|
|
960
960
|
return;
|
|
961
961
|
}
|
|
@@ -972,13 +972,13 @@ function Hn(e) {
|
|
|
972
972
|
lastTap: 0,
|
|
973
973
|
lastTapTarget: null,
|
|
974
974
|
DOUBLE_CLICK_THRESHOLD: 300,
|
|
975
|
-
detect(f,
|
|
975
|
+
detect(f, b) {
|
|
976
976
|
if (f.button !== 0) {
|
|
977
977
|
this.clear();
|
|
978
978
|
return;
|
|
979
979
|
}
|
|
980
|
-
const
|
|
981
|
-
this.lastTap =
|
|
980
|
+
const w = (/* @__PURE__ */ new Date()).getTime(), S = w - this.lastTap, C = S < this.DOUBLE_CLICK_THRESHOLD && S > 0 && this.lastTapTarget === f.target;
|
|
981
|
+
this.lastTap = w, this.lastTapTarget = f.target, C && b(f);
|
|
982
982
|
},
|
|
983
983
|
clear() {
|
|
984
984
|
this.lastTap = 0, this.lastTapTarget = null;
|
|
@@ -998,20 +998,20 @@ function Hn(e) {
|
|
|
998
998
|
handlePointerDown(f) {
|
|
999
999
|
if (f.pointerType !== "touch") return !1;
|
|
1000
1000
|
if (this.activePointers.set(f.pointerId, { x: f.clientX, y: f.clientY }), this.activePointers.size >= 2) {
|
|
1001
|
-
const [
|
|
1002
|
-
return this.lastDistance =
|
|
1001
|
+
const [b, w] = Array.from(this.activePointers.values());
|
|
1002
|
+
return this.lastDistance = Le(b, w), !0;
|
|
1003
1003
|
}
|
|
1004
1004
|
return !1;
|
|
1005
1005
|
},
|
|
1006
1006
|
handlePointerMove(f) {
|
|
1007
1007
|
if (f.pointerType !== "touch" || !this.activePointers.has(f.pointerId)) return !1;
|
|
1008
1008
|
if (this.activePointers.set(f.pointerId, { x: f.clientX, y: f.clientY }), this.activePointers.size >= 2) {
|
|
1009
|
-
const [
|
|
1009
|
+
const [b, w] = Array.from(this.activePointers.values()), S = Le(b, w);
|
|
1010
1010
|
if (this.lastDistance !== null && this.lastDistance > 0) {
|
|
1011
1011
|
const C = S / this.lastDistance;
|
|
1012
1012
|
e.scale(e.scaleVal * C, {
|
|
1013
|
-
x: (
|
|
1014
|
-
y: (
|
|
1013
|
+
x: (b.x + w.x) / 2,
|
|
1014
|
+
y: (b.y + w.y) / 2
|
|
1015
1015
|
});
|
|
1016
1016
|
}
|
|
1017
1017
|
return this.lastDistance = S, !0;
|
|
@@ -1033,23 +1033,23 @@ function Hn(e) {
|
|
|
1033
1033
|
clear() {
|
|
1034
1034
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null, this.startPos = null, this.pointerId = null);
|
|
1035
1035
|
},
|
|
1036
|
-
start(f,
|
|
1036
|
+
start(f, b) {
|
|
1037
1037
|
this.timer = window.setTimeout(() => {
|
|
1038
|
-
|
|
1038
|
+
b(f), this.timer = null, this.startPos = null, this.pointerId = null;
|
|
1039
1039
|
}, this.DURATION), this.startPos = { x: f.clientX, y: f.clientY }, this.pointerId = f.pointerId;
|
|
1040
1040
|
},
|
|
1041
1041
|
handleMove(f) {
|
|
1042
1042
|
if (this.timer !== null && this.startPos !== null && f.pointerId === this.pointerId) {
|
|
1043
|
-
const
|
|
1044
|
-
Math.sqrt(
|
|
1043
|
+
const b = f.clientX - this.startPos.x, w = f.clientY - this.startPos.y;
|
|
1044
|
+
Math.sqrt(b * b + w * w) > this.MOVE_THRESHOLD && this.clear();
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
|
-
}, a = (f,
|
|
1047
|
+
}, a = (f, b) => {
|
|
1048
1048
|
if (f.closest("#input-box")) return !1;
|
|
1049
|
-
const
|
|
1049
|
+
const w = f.closest(".svg-label"), S = f.closest(".topiclinks, .summary"), C = w ? { type: w.dataset.type, element: document.getElementById(w.dataset.svgId) } : S ? { type: S.classList.contains("topiclinks") ? "arrow" : "summary", element: f.closest("g") } : null;
|
|
1050
1050
|
if (!C?.type || !C?.element) return !1;
|
|
1051
1051
|
const { type: T, element: D } = C;
|
|
1052
|
-
return e.clearSelection(), T === "arrow" ?
|
|
1052
|
+
return e.clearSelection(), T === "arrow" ? b ? e.editArrowLabel(D) : e.selectArrow(D) : b ? e.editSummary(D) : e.selectSummary(D), !0;
|
|
1053
1053
|
}, d = (f) => {
|
|
1054
1054
|
if (f.pointerType === "mouse" && f.button !== 0) return;
|
|
1055
1055
|
if (e.helper1?.moved) {
|
|
@@ -1066,38 +1066,38 @@ function Hn(e) {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
if (c?.isDragging)
|
|
1068
1068
|
return;
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1069
|
+
const b = f.target;
|
|
1070
|
+
b.tagName === "ME-EPD" && (f.ctrlKey || f.metaKey ? e.expandNodeAll(b.previousSibling) : e.expandNode(b.previousSibling));
|
|
1071
1071
|
}, h = (f) => {
|
|
1072
1072
|
if (!e.editable) return;
|
|
1073
|
-
const
|
|
1074
|
-
if (
|
|
1075
|
-
e.selectNode(
|
|
1073
|
+
const b = f.target;
|
|
1074
|
+
if (ne(b)) {
|
|
1075
|
+
e.selectNode(b), e.beginEdit(b);
|
|
1076
1076
|
return;
|
|
1077
1077
|
}
|
|
1078
|
-
a(
|
|
1078
|
+
a(b, !0);
|
|
1079
1079
|
}, u = (f) => {
|
|
1080
1080
|
if (f.pointerType === "touch" && l.handlePointerDown(f)) {
|
|
1081
|
-
e.ptState = i.Pinch, r.clear(), t.clear(), (c.isDragging || c.pointerId !== null) &&
|
|
1081
|
+
e.ptState = i.Pinch, r.clear(), t.clear(), (c.isDragging || c.pointerId !== null) && Pe(e, c);
|
|
1082
1082
|
return;
|
|
1083
1083
|
}
|
|
1084
1084
|
if (e.ptState === i.Pinch) return;
|
|
1085
|
-
const
|
|
1086
|
-
if (e.editable &&
|
|
1085
|
+
const b = f.target;
|
|
1086
|
+
if (e.editable && b.className === "map-container" && f.button === 0 && f.pointerType === "mouse") {
|
|
1087
1087
|
e.ptState = i.BoxSelect;
|
|
1088
1088
|
return;
|
|
1089
1089
|
}
|
|
1090
1090
|
if (t.handlePointerDown(f), t.mousedown && (e.ptState = i.Pan), f.button === 0 || f.pointerType === "touch")
|
|
1091
|
-
if (
|
|
1091
|
+
if (ne(b)) {
|
|
1092
1092
|
e.selection?.cancel();
|
|
1093
1093
|
const S = e.currentNodes || [];
|
|
1094
|
-
if (f.ctrlKey || f.metaKey || e.mobileMultiSelect ? S.includes(
|
|
1094
|
+
if (f.ctrlKey || f.metaKey || e.mobileMultiSelect ? S.includes(b) ? o = b : ((e.currentArrow || e.currentSummary) && e.clearSelection(), e.selection?.select(b)) : S.includes(b) || e.selectNode(b), !e.editable) return;
|
|
1095
1095
|
f.pointerType === "touch" ? (e.ptState = i.DragWait, r.start(f, (T) => {
|
|
1096
|
-
Me(e, c, T, !0) && (e.ptState = i.Drag,
|
|
1097
|
-
})) : Me(e, c, f, !1) && (e.ptState = i.Drag,
|
|
1096
|
+
Me(e, c, T, !0) && (e.ptState = i.Drag, b.setPointerCapture(T.pointerId));
|
|
1097
|
+
})) : Me(e, c, f, !1) && (e.ptState = i.Drag, b.setPointerCapture(f.pointerId));
|
|
1098
1098
|
} else
|
|
1099
|
-
a(
|
|
1100
|
-
},
|
|
1099
|
+
a(b, !1);
|
|
1100
|
+
}, p = (f) => {
|
|
1101
1101
|
switch (e.ptState) {
|
|
1102
1102
|
case i.Pinch:
|
|
1103
1103
|
l.handlePointerMove(f);
|
|
@@ -1106,7 +1106,7 @@ function Hn(e) {
|
|
|
1106
1106
|
r.handleMove(f), r.timer === null && (e.ptState = i.Idle);
|
|
1107
1107
|
break;
|
|
1108
1108
|
case i.Drag:
|
|
1109
|
-
|
|
1109
|
+
Ct(e, c, f);
|
|
1110
1110
|
break;
|
|
1111
1111
|
case i.Pan:
|
|
1112
1112
|
t.handlePointerMove(f);
|
|
@@ -1114,50 +1114,50 @@ function Hn(e) {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
}, v = (f) => {
|
|
1116
1116
|
f.pointerType === "touch" && l.handlePointerUp(f);
|
|
1117
|
-
const
|
|
1117
|
+
const b = c.isDragging, w = t.moved;
|
|
1118
1118
|
switch (e.ptState) {
|
|
1119
1119
|
case i.DragWait:
|
|
1120
1120
|
r.clear();
|
|
1121
1121
|
break;
|
|
1122
1122
|
case i.Drag:
|
|
1123
|
-
|
|
1123
|
+
St(e, c, f);
|
|
1124
1124
|
break;
|
|
1125
1125
|
case i.Pan:
|
|
1126
1126
|
t.handlePointerUp(f);
|
|
1127
1127
|
break;
|
|
1128
1128
|
}
|
|
1129
|
-
s.detect(f, h), (e.ptState !== i.Pinch || l.activePointers.size < 2) && (e.ptState = i.Idle), o && (!
|
|
1130
|
-
},
|
|
1131
|
-
l.clear(), r.clear(), t.clear(), s.clear(), (c.isDragging || c.pointerId !== null) &&
|
|
1132
|
-
},
|
|
1129
|
+
s.detect(f, h), (e.ptState !== i.Pinch || l.activePointers.size < 2) && (e.ptState = i.Idle), o && (!b && !w && e.selection?.deselect(o), o = null);
|
|
1130
|
+
}, m = () => {
|
|
1131
|
+
l.clear(), r.clear(), t.clear(), s.clear(), (c.isDragging || c.pointerId !== null) && Pe(e, c), e.ptState = i.Idle, o = null;
|
|
1132
|
+
}, y = (f) => {
|
|
1133
1133
|
f.preventDefault(), f.button === 2 && e.editable && setTimeout(() => {
|
|
1134
1134
|
if (e.panHelper.moved || e.ptState !== i.Idle && e.ptState !== i.Pan) return;
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1135
|
+
const b = f.target;
|
|
1136
|
+
ne(b) && !b.classList.contains("selected") && e.selectNode(b), e.bus.fire("showContextMenu", f);
|
|
1137
1137
|
}, 200);
|
|
1138
|
-
},
|
|
1139
|
-
if (f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey) return
|
|
1138
|
+
}, g = (f) => {
|
|
1139
|
+
if (f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey) return On(e, f);
|
|
1140
1140
|
if (f.shiftKey) return e.move(-f.deltaY, 0);
|
|
1141
1141
|
e.move(-f.deltaX, -f.deltaY);
|
|
1142
|
-
},
|
|
1142
|
+
}, x = (f) => {
|
|
1143
1143
|
f.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"));
|
|
1144
1144
|
}, E = (f) => {
|
|
1145
1145
|
f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
1146
1146
|
};
|
|
1147
1147
|
return qe([
|
|
1148
1148
|
{ dom: n, evt: "pointerdown", func: u },
|
|
1149
|
-
{ dom: n, evt: "pointermove", func:
|
|
1149
|
+
{ dom: n, evt: "pointermove", func: p },
|
|
1150
1150
|
{ dom: n, evt: "pointerup", func: v },
|
|
1151
|
-
{ dom: n, evt: "pointercancel", func:
|
|
1151
|
+
{ dom: n, evt: "pointercancel", func: m },
|
|
1152
1152
|
{ dom: n, evt: "click", func: d },
|
|
1153
|
-
{ dom: n, evt: "contextmenu", func:
|
|
1154
|
-
{ dom: n, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel :
|
|
1155
|
-
{ dom: n, evt: "blur", func:
|
|
1156
|
-
{ dom: n, evt: "keydown", func:
|
|
1153
|
+
{ dom: n, evt: "contextmenu", func: y },
|
|
1154
|
+
{ dom: n, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : g },
|
|
1155
|
+
{ dom: n, evt: "blur", func: m },
|
|
1156
|
+
{ dom: n, evt: "keydown", func: x },
|
|
1157
1157
|
{ dom: n, evt: "keyup", func: E }
|
|
1158
1158
|
]);
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1160
|
+
function In() {
|
|
1161
1161
|
return {
|
|
1162
1162
|
handlers: {},
|
|
1163
1163
|
addListener: function(e, t) {
|
|
@@ -1181,31 +1181,31 @@ function $n() {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
};
|
|
1183
1183
|
}
|
|
1184
|
-
const
|
|
1184
|
+
const M = "http://www.w3.org/2000/svg", le = function(e) {
|
|
1185
1185
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
1186
1186
|
let c = s;
|
|
1187
1187
|
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";
|
|
1188
|
-
},
|
|
1188
|
+
}, he = function(e, t, n, o) {
|
|
1189
1189
|
const { anchor: s = "middle", color: i, dataType: l, svgId: c } = o, r = document.createElement("div");
|
|
1190
1190
|
r.className = "svg-label", r.style.color = i || "#666";
|
|
1191
1191
|
const a = "label-" + c;
|
|
1192
1192
|
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;
|
|
1193
1193
|
}, it = function(e, t, n) {
|
|
1194
|
-
const o = document.createElementNS(
|
|
1194
|
+
const o = document.createElementNS(M, "path");
|
|
1195
1195
|
return k(o, {
|
|
1196
1196
|
d: e,
|
|
1197
1197
|
stroke: t || "#666",
|
|
1198
1198
|
fill: "none",
|
|
1199
1199
|
"stroke-width": n
|
|
1200
1200
|
}), o;
|
|
1201
|
-
},
|
|
1202
|
-
const t = document.createElementNS(
|
|
1201
|
+
}, q = function(e) {
|
|
1202
|
+
const t = document.createElementNS(M, "svg");
|
|
1203
1203
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
1204
1204
|
}, je = function() {
|
|
1205
|
-
const e = document.createElementNS(
|
|
1205
|
+
const e = document.createElementNS(M, "line");
|
|
1206
1206
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
1207
1207
|
}, jn = function(e, t, n, o) {
|
|
1208
|
-
const s = document.createElementNS(
|
|
1208
|
+
const s = document.createElementNS(M, "g");
|
|
1209
1209
|
return [
|
|
1210
1210
|
{
|
|
1211
1211
|
name: "line",
|
|
@@ -1220,7 +1220,7 @@ const A = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1220
1220
|
d: n
|
|
1221
1221
|
}
|
|
1222
1222
|
].forEach((l, c) => {
|
|
1223
|
-
const r = l.d, a = document.createElementNS(
|
|
1223
|
+
const r = l.d, a = document.createElementNS(M, "path"), d = {
|
|
1224
1224
|
d: r,
|
|
1225
1225
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
1226
1226
|
fill: "none",
|
|
@@ -1228,7 +1228,7 @@ const A = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1228
1228
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
1229
1229
|
};
|
|
1230
1230
|
o?.opacity !== void 0 && (d.opacity = String(o.opacity)), k(a, d), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
1231
|
-
const h = document.createElementNS(
|
|
1231
|
+
const h = document.createElementNS(M, "path");
|
|
1232
1232
|
k(h, {
|
|
1233
1233
|
d: r,
|
|
1234
1234
|
stroke: "transparent",
|
|
@@ -1255,7 +1255,7 @@ const A = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1255
1255
|
}), s.addEventListener("blur", () => {
|
|
1256
1256
|
if (!s) return;
|
|
1257
1257
|
const i = s.innerText?.trim() || "";
|
|
1258
|
-
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,
|
|
1258
|
+
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, le(t), "parent" in n ? e.bus.fire("operation", {
|
|
1259
1259
|
name: "finishEditSummary",
|
|
1260
1260
|
obj: n
|
|
1261
1261
|
}) : e.bus.fire("operation", {
|
|
@@ -1263,15 +1263,15 @@ const A = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1263
1263
|
obj: n
|
|
1264
1264
|
}));
|
|
1265
1265
|
});
|
|
1266
|
-
},
|
|
1266
|
+
}, Rn = function(e) {
|
|
1267
1267
|
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");
|
|
1268
1268
|
this.lines.innerHTML = "";
|
|
1269
1269
|
for (let c = 0; c < l.length; c++) {
|
|
1270
|
-
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } =
|
|
1271
|
-
if (a.style.borderColor =
|
|
1270
|
+
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = A(this.nodes, a), u = a.offsetWidth, p = a.offsetHeight, v = r.parentNode.className, m = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: p, direction: v, containerHeight: this.nodes.offsetHeight }), y = this.theme.palette, g = a.nodeObj.branchColor || y[c % y.length];
|
|
1271
|
+
if (a.style.borderColor = g, this.lines.appendChild(it(m, g, "3")), e && e !== r)
|
|
1272
1272
|
continue;
|
|
1273
|
-
const
|
|
1274
|
-
E.tagName === "svg" && E.remove(), r.appendChild(
|
|
1273
|
+
const x = q("subLines"), E = r.lastChild;
|
|
1274
|
+
E.tagName === "svg" && E.remove(), r.appendChild(x), lt(this, x, g, r, v, !0);
|
|
1275
1275
|
}
|
|
1276
1276
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
1277
1277
|
}, lt = function(e, t, n, o, s, i) {
|
|
@@ -1279,16 +1279,16 @@ const A = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1279
1279
|
if (c.length === 0) return;
|
|
1280
1280
|
const r = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
|
|
1281
1281
|
for (let u = 0; u < c.length; u++) {
|
|
1282
|
-
const
|
|
1282
|
+
const p = c[u], v = p.firstChild, m = v.offsetTop, y = v.offsetLeft, g = v.offsetWidth, x = v.offsetHeight, E = v.firstChild.nodeObj.branchColor || n, N = e.generateSubBranch({ pT: r, pL: a, pW: d, pH: h, cT: m, cL: y, cW: g, cH: x, direction: s, isFirst: i });
|
|
1283
1283
|
t.appendChild(it(N, E, "2"));
|
|
1284
1284
|
const f = v.children[1];
|
|
1285
1285
|
if (f) {
|
|
1286
1286
|
if (!f.expanded) continue;
|
|
1287
1287
|
} else
|
|
1288
1288
|
continue;
|
|
1289
|
-
lt(e, t, E,
|
|
1289
|
+
lt(e, t, E, p, s);
|
|
1290
1290
|
}
|
|
1291
|
-
},
|
|
1291
|
+
}, Bn = {
|
|
1292
1292
|
addChild: "Add child",
|
|
1293
1293
|
addParent: "Add parent",
|
|
1294
1294
|
addSibling: "Add sibling",
|
|
@@ -1302,79 +1302,79 @@ const A = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1302
1302
|
clickTips: "Please click the target node",
|
|
1303
1303
|
summary: "Summary"
|
|
1304
1304
|
};
|
|
1305
|
-
function
|
|
1305
|
+
function Wn(e, t) {
|
|
1306
1306
|
const n = {
|
|
1307
1307
|
focus: !0,
|
|
1308
1308
|
link: !0,
|
|
1309
|
-
locale:
|
|
1309
|
+
locale: Bn
|
|
1310
1310
|
};
|
|
1311
1311
|
t = t === !0 ? n : Object.assign(n, t);
|
|
1312
|
-
const o = (
|
|
1313
|
-
const
|
|
1314
|
-
return
|
|
1315
|
-
}, s = (
|
|
1312
|
+
const o = (b) => {
|
|
1313
|
+
const w = document.createElement("div");
|
|
1314
|
+
return w.innerText = b, w.className = "tips", w;
|
|
1315
|
+
}, s = (b, w, S) => {
|
|
1316
1316
|
const C = document.createElement("li");
|
|
1317
|
-
return C.id =
|
|
1318
|
-
}, 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"),
|
|
1319
|
-
if (
|
|
1320
|
-
for (let
|
|
1321
|
-
const
|
|
1322
|
-
|
|
1323
|
-
|
|
1317
|
+
return C.id = b, C.innerHTML = `<span>${de(w)}</span><span ${S ? 'class="key"' : ""}>${de(S)}</span>`, C;
|
|
1318
|
+
}, 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"), p = s("cm-down", i.moveDown, "Pgdn"), v = s("cm-link", i.link, ""), m = s("cm-link-bidirectional", i.linkBidirectional, ""), y = s("cm-summary", i.summary, ""), g = document.createElement("ul");
|
|
1319
|
+
if (g.className = "menu-list", g.appendChild(l), g.appendChild(c), g.appendChild(r), g.appendChild(a), t.focus && (g.appendChild(d), g.appendChild(h)), g.appendChild(u), g.appendChild(p), g.appendChild(y), t.link && (g.appendChild(v), g.appendChild(m)), t && t.extend)
|
|
1320
|
+
for (let b = 0; b < t.extend.length; b++) {
|
|
1321
|
+
const w = t.extend[b], S = s(w.name, w.name, w.key || "");
|
|
1322
|
+
g.appendChild(S), S.onclick = (C) => {
|
|
1323
|
+
w.onclick(C);
|
|
1324
1324
|
};
|
|
1325
1325
|
}
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1326
|
+
const x = document.createElement("div");
|
|
1327
|
+
x.className = "context-menu", x.appendChild(g), x.hidden = !0, e.container.append(x);
|
|
1328
1328
|
let E = !0;
|
|
1329
|
-
const N = (
|
|
1330
|
-
const
|
|
1331
|
-
if (
|
|
1332
|
-
|
|
1333
|
-
const S =
|
|
1334
|
-
S + D > window.innerHeight ? (
|
|
1329
|
+
const N = (b) => {
|
|
1330
|
+
const w = b.target;
|
|
1331
|
+
if (ne(w)) {
|
|
1332
|
+
w.parentElement.tagName === "ME-ROOT" ? E = !0 : E = !1, E ? (d.className = "disabled", u.className = "disabled", p.className = "disabled", c.className = "disabled", r.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", p.className = "", c.className = "", r.className = "", a.className = ""), x.hidden = !1, g.style.top = "", g.style.bottom = "", g.style.left = "", g.style.right = "";
|
|
1333
|
+
const S = g.offsetHeight, C = g.offsetWidth, T = g.getBoundingClientRect(), D = b.clientY - T.top, L = b.clientX - T.left;
|
|
1334
|
+
S + D > window.innerHeight ? (g.style.top = "", g.style.bottom = "0px") : (g.style.bottom = "", g.style.top = D + 15 + "px"), C + L > window.innerWidth ? (g.style.left = "", g.style.right = "0px") : (g.style.right = "", g.style.left = L + 10 + "px");
|
|
1335
1335
|
}
|
|
1336
1336
|
};
|
|
1337
|
-
e.bus.addListener("showContextMenu", N),
|
|
1338
|
-
|
|
1337
|
+
e.bus.addListener("showContextMenu", N), x.onclick = (b) => {
|
|
1338
|
+
b.target === x && (x.hidden = !0);
|
|
1339
1339
|
}, l.onclick = () => {
|
|
1340
|
-
e.addChild(),
|
|
1340
|
+
e.addChild(), x.hidden = !0;
|
|
1341
1341
|
}, c.onclick = () => {
|
|
1342
|
-
e.insertParent(),
|
|
1342
|
+
e.insertParent(), x.hidden = !0;
|
|
1343
1343
|
}, r.onclick = () => {
|
|
1344
|
-
E || (e.insertSibling("after"),
|
|
1344
|
+
E || (e.insertSibling("after"), x.hidden = !0);
|
|
1345
1345
|
}, a.onclick = () => {
|
|
1346
|
-
E || (e.removeNodes(e.currentNodes || []),
|
|
1346
|
+
E || (e.removeNodes(e.currentNodes || []), x.hidden = !0);
|
|
1347
1347
|
}, d.onclick = () => {
|
|
1348
|
-
E || (e.focusNode(e.currentNode),
|
|
1348
|
+
E || (e.focusNode(e.currentNode), x.hidden = !0);
|
|
1349
1349
|
}, h.onclick = () => {
|
|
1350
|
-
e.cancelFocus(),
|
|
1350
|
+
e.cancelFocus(), x.hidden = !0;
|
|
1351
1351
|
}, u.onclick = () => {
|
|
1352
|
-
E || (e.moveUpNode(),
|
|
1353
|
-
},
|
|
1354
|
-
E || (e.moveDownNode(),
|
|
1352
|
+
E || (e.moveUpNode(), x.hidden = !0);
|
|
1353
|
+
}, p.onclick = () => {
|
|
1354
|
+
E || (e.moveDownNode(), x.hidden = !0);
|
|
1355
1355
|
};
|
|
1356
|
-
const f = (
|
|
1357
|
-
|
|
1358
|
-
const
|
|
1356
|
+
const f = (b) => {
|
|
1357
|
+
x.hidden = !0;
|
|
1358
|
+
const w = e.currentNode, S = o(i.clickTips);
|
|
1359
1359
|
e.container.appendChild(S), e.map.addEventListener(
|
|
1360
1360
|
"click",
|
|
1361
1361
|
(C) => {
|
|
1362
1362
|
C.preventDefault(), S.remove();
|
|
1363
1363
|
const T = C.target;
|
|
1364
|
-
(T.parentElement.tagName === "ME-PARENT" || T.parentElement.tagName === "ME-ROOT") && e.createArrow(
|
|
1364
|
+
(T.parentElement.tagName === "ME-PARENT" || T.parentElement.tagName === "ME-ROOT") && e.createArrow(w, T, b);
|
|
1365
1365
|
},
|
|
1366
1366
|
{
|
|
1367
1367
|
once: !0
|
|
1368
1368
|
}
|
|
1369
1369
|
);
|
|
1370
1370
|
};
|
|
1371
|
-
return v.onclick = () => f(),
|
|
1372
|
-
|
|
1371
|
+
return v.onclick = () => f(), m.onclick = () => f({ bidirectional: !0 }), y.onclick = () => {
|
|
1372
|
+
x.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
1373
1373
|
}, () => {
|
|
1374
|
-
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null,
|
|
1374
|
+
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, p.onclick = null, v.onclick = null, y.onclick = null, x.onclick = null, e.container.oncontextmenu = null;
|
|
1375
1375
|
};
|
|
1376
1376
|
}
|
|
1377
|
-
const
|
|
1377
|
+
const Yn = function(e) {
|
|
1378
1378
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
1379
1379
|
type: "summary",
|
|
1380
1380
|
value: e.obj.id
|
|
@@ -1389,7 +1389,7 @@ const Wn = function(e) {
|
|
|
1389
1389
|
value: [e.obj.id]
|
|
1390
1390
|
};
|
|
1391
1391
|
};
|
|
1392
|
-
function
|
|
1392
|
+
function Xn(e) {
|
|
1393
1393
|
let t = [], n = -1, o = e.getData(), s = [];
|
|
1394
1394
|
e.undo = function() {
|
|
1395
1395
|
if (n > -1) {
|
|
@@ -1422,7 +1422,7 @@ function Yn(e) {
|
|
|
1422
1422
|
prev: o,
|
|
1423
1423
|
operation: r.name,
|
|
1424
1424
|
currentSelected: s.map((h) => h.id),
|
|
1425
|
-
currentTarget:
|
|
1425
|
+
currentTarget: Yn(r),
|
|
1426
1426
|
next: a
|
|
1427
1427
|
};
|
|
1428
1428
|
t.push(d), o = a, n = t.length - 1;
|
|
@@ -1435,34 +1435,34 @@ function Yn(e) {
|
|
|
1435
1435
|
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", c), e.container.removeEventListener("keydown", l);
|
|
1436
1436
|
};
|
|
1437
1437
|
}
|
|
1438
|
-
const
|
|
1439
|
-
side:
|
|
1440
|
-
left:
|
|
1441
|
-
right:
|
|
1442
|
-
full:
|
|
1443
|
-
living:
|
|
1444
|
-
zoomin:
|
|
1445
|
-
zoomout:
|
|
1446
|
-
},
|
|
1438
|
+
const 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="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>', 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="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>', Vn = '<?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>', zn = '<?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>', Gn = '<?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>', qn = '<?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>', Un = '<?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>', Jn = {
|
|
1439
|
+
side: Fn,
|
|
1440
|
+
left: Kn,
|
|
1441
|
+
right: Vn,
|
|
1442
|
+
full: zn,
|
|
1443
|
+
living: Gn,
|
|
1444
|
+
zoomin: qn,
|
|
1445
|
+
zoomout: Un
|
|
1446
|
+
}, R = (e, t) => {
|
|
1447
1447
|
const n = document.createElement("span");
|
|
1448
|
-
return n.id = e, n.innerHTML =
|
|
1448
|
+
return n.id = e, n.innerHTML = Jn[t], n;
|
|
1449
1449
|
};
|
|
1450
|
-
function
|
|
1451
|
-
const t = document.createElement("div"), n =
|
|
1450
|
+
function Zn(e) {
|
|
1451
|
+
const t = document.createElement("div"), n = R("fullscreen", "full"), o = R("toCenter", "living"), s = R("zoomout", "zoomout"), i = R("zoomin", "zoomin");
|
|
1452
1452
|
t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
|
|
1453
1453
|
let l = null;
|
|
1454
1454
|
const c = () => {
|
|
1455
|
-
const a = e.container.getBoundingClientRect(), d =
|
|
1455
|
+
const a = e.container.getBoundingClientRect(), d = be(e.map.style.transform), h = a.width / 2, u = a.height / 2, p = (h - d.x) / e.scaleVal, v = (u - d.y) / e.scaleVal;
|
|
1456
1456
|
l = {
|
|
1457
1457
|
containerRect: a,
|
|
1458
1458
|
currentTransform: d,
|
|
1459
|
-
mapCenterX:
|
|
1459
|
+
mapCenterX: p,
|
|
1460
1460
|
mapCenterY: v
|
|
1461
1461
|
};
|
|
1462
1462
|
}, r = () => {
|
|
1463
1463
|
if (l) {
|
|
1464
|
-
const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal,
|
|
1465
|
-
e.move(v,
|
|
1464
|
+
const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal, p = h - l.mapCenterY * e.scaleVal, v = u - l.currentTransform.x, m = p - l.currentTransform.y;
|
|
1465
|
+
e.move(v, m);
|
|
1466
1466
|
}
|
|
1467
1467
|
};
|
|
1468
1468
|
return e.el.addEventListener("fullscreenchange", r), n.onclick = () => {
|
|
@@ -1475,8 +1475,8 @@ function Jn(e) {
|
|
|
1475
1475
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1476
1476
|
}, t;
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1479
|
-
const t = document.createElement("div"), n =
|
|
1478
|
+
function Qn(e) {
|
|
1479
|
+
const t = document.createElement("div"), n = R("tbltl", "left"), o = R("tbltr", "right"), s = R("tblts", "side");
|
|
1480
1480
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1481
1481
|
e.initLeft();
|
|
1482
1482
|
}, o.onclick = () => {
|
|
@@ -1485,10 +1485,10 @@ function Zn(e) {
|
|
|
1485
1485
|
e.initSide();
|
|
1486
1486
|
}, t;
|
|
1487
1487
|
}
|
|
1488
|
-
function
|
|
1489
|
-
e.container.append(
|
|
1488
|
+
function eo(e) {
|
|
1489
|
+
e.container.append(Zn(e)), e.container.append(Qn(e));
|
|
1490
1490
|
}
|
|
1491
|
-
class
|
|
1491
|
+
class to {
|
|
1492
1492
|
_listeners = /* @__PURE__ */ new Map();
|
|
1493
1493
|
addEventListener(t, n) {
|
|
1494
1494
|
const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
@@ -1511,15 +1511,15 @@ class eo {
|
|
|
1511
1511
|
off = this.removeEventListener;
|
|
1512
1512
|
emit = this.dispatchEvent;
|
|
1513
1513
|
}
|
|
1514
|
-
const
|
|
1514
|
+
const Re = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e }, t, n) => {
|
|
1515
1515
|
if (typeof t == "object")
|
|
1516
1516
|
for (const [o, s] of Object.entries(t))
|
|
1517
|
-
s !== void 0 && (e[o] =
|
|
1518
|
-
else n !== void 0 && (e[t] =
|
|
1519
|
-
},
|
|
1517
|
+
s !== void 0 && (e[o] = Re(s));
|
|
1518
|
+
else n !== void 0 && (e[t] = Re(n));
|
|
1519
|
+
}, Be = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1520
1520
|
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1521
1521
|
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1522
|
-
},
|
|
1522
|
+
}, no = (e) => {
|
|
1523
1523
|
let t, n = -1, o = !1;
|
|
1524
1524
|
return {
|
|
1525
1525
|
next: (...s) => {
|
|
@@ -1531,7 +1531,7 @@ const Ie = (e, t = "px") => typeof e == "number" ? e + t : e, $ = ({ style: e },
|
|
|
1531
1531
|
cancelAnimationFrame(n), o = !1;
|
|
1532
1532
|
}
|
|
1533
1533
|
};
|
|
1534
|
-
},
|
|
1534
|
+
}, We = (e, t, n = "touch") => {
|
|
1535
1535
|
switch (n) {
|
|
1536
1536
|
case "center": {
|
|
1537
1537
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -1542,16 +1542,16 @@ const Ie = (e, t = "px") => typeof e == "number" ? e + t : e, $ = ({ style: e },
|
|
|
1542
1542
|
case "touch":
|
|
1543
1543
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1544
1544
|
}
|
|
1545
|
-
},
|
|
1546
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1545
|
+
}, oo = () => matchMedia("(hover: none), (pointer: coarse)").matches, so = () => "safari" in window, fe = (e) => Array.isArray(e) ? e : [e], ct = (e) => (t, n, o, s = {}) => {
|
|
1546
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = fe(n), t = fe(t);
|
|
1547
1547
|
for (const i of t)
|
|
1548
1548
|
if (i)
|
|
1549
1549
|
for (const l of n)
|
|
1550
1550
|
i[e](l, o, { capture: !1, ...s });
|
|
1551
|
-
},
|
|
1551
|
+
}, Y = ct("addEventListener"), O = ct("removeEventListener"), Q = (e) => {
|
|
1552
1552
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1553
1553
|
return { x: t, y: n, target: o };
|
|
1554
|
-
},
|
|
1554
|
+
}, X = (e, t = document) => fe(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), io = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1555
1555
|
switch (o) {
|
|
1556
1556
|
case "alt":
|
|
1557
1557
|
return e.altKey;
|
|
@@ -1560,18 +1560,18 @@ const Ie = (e, t = "px") => typeof e == "number" ? e + t : e, $ = ({ style: e },
|
|
|
1560
1560
|
case "shift":
|
|
1561
1561
|
return e.shiftKey;
|
|
1562
1562
|
}
|
|
1563
|
-
}) : !1), { abs: j, max:
|
|
1563
|
+
}) : !1), { abs: j, max: Ye, min: Xe, ceil: Fe } = Math, Ke = (e = []) => ({
|
|
1564
1564
|
stored: e,
|
|
1565
1565
|
selected: [],
|
|
1566
1566
|
touched: [],
|
|
1567
1567
|
changed: { added: [], removed: [] }
|
|
1568
1568
|
});
|
|
1569
|
-
class
|
|
1569
|
+
class ro extends to {
|
|
1570
1570
|
static version = "mind-elixir-fork";
|
|
1571
1571
|
// Options
|
|
1572
1572
|
_options;
|
|
1573
1573
|
// Selection store
|
|
1574
|
-
_selection =
|
|
1574
|
+
_selection = Ke();
|
|
1575
1575
|
// Area element and clipping element
|
|
1576
1576
|
_area;
|
|
1577
1577
|
_clippingElement;
|
|
@@ -1584,7 +1584,7 @@ class io extends eo {
|
|
|
1584
1584
|
_latestElement;
|
|
1585
1585
|
// Dynamically constructed area rect
|
|
1586
1586
|
_areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 };
|
|
1587
|
-
_areaRect =
|
|
1587
|
+
_areaRect = Be();
|
|
1588
1588
|
// If a single click is being performed, it's a single-click until the user dragged the mouse
|
|
1589
1589
|
_singleClick = !0;
|
|
1590
1590
|
_frame;
|
|
@@ -1636,44 +1636,44 @@ class io extends eo {
|
|
|
1636
1636
|
for (const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1637
1637
|
typeof this[i] == "function" && (this[i] = this[i].bind(this));
|
|
1638
1638
|
const { document: n, selectionAreaClass: o, selectionContainerClass: s } = this._options;
|
|
1639
|
-
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),
|
|
1639
|
+
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), H(this._area, {
|
|
1640
1640
|
willChange: "top, left, bottom, right, width, height",
|
|
1641
1641
|
top: 0,
|
|
1642
1642
|
left: 0,
|
|
1643
1643
|
position: "fixed"
|
|
1644
|
-
}),
|
|
1644
|
+
}), H(this._clippingElement, {
|
|
1645
1645
|
overflow: "hidden",
|
|
1646
1646
|
position: "fixed",
|
|
1647
1647
|
transform: "translate3d(0, 0, 0)",
|
|
1648
1648
|
// https://stackoverflow.com/a/38268846
|
|
1649
1649
|
pointerEvents: "none",
|
|
1650
1650
|
zIndex: "1"
|
|
1651
|
-
}), this._frame =
|
|
1651
|
+
}), this._frame = no((i) => {
|
|
1652
1652
|
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
|
|
1653
1653
|
}), this.enable();
|
|
1654
1654
|
}
|
|
1655
1655
|
_toggleStartEvents(t = !0) {
|
|
1656
1656
|
const { document: n } = this._options;
|
|
1657
|
-
(t ?
|
|
1657
|
+
(t ? Y : O)(n, "pointerdown", this._onTapStart);
|
|
1658
1658
|
}
|
|
1659
1659
|
_onTapStart(t, n = !1) {
|
|
1660
|
-
const { x: o, y: s, target: i } =
|
|
1661
|
-
if (!
|
|
1660
|
+
const { x: o, y: s, target: i } = Q(t), { document: l, startAreas: c, boundaries: r, behaviour: a, features: d } = this._options, h = i.getBoundingClientRect();
|
|
1661
|
+
if (!io(t, a.triggers))
|
|
1662
1662
|
return;
|
|
1663
|
-
const u =
|
|
1664
|
-
this._targetElement =
|
|
1665
|
-
const v = t.composedPath(),
|
|
1666
|
-
if (this._targetBoundary =
|
|
1663
|
+
const u = X(c, l), p = X(r, l);
|
|
1664
|
+
this._targetElement = p.find((g) => We(g.getBoundingClientRect(), h));
|
|
1665
|
+
const v = t.composedPath(), m = u.find((g) => v.includes(g));
|
|
1666
|
+
if (this._targetBoundary = p.find((g) => v.includes(g)), !this._targetElement || !m || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1667
1667
|
return;
|
|
1668
1668
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1669
|
-
const
|
|
1670
|
-
this._scrollDelta = { x:
|
|
1669
|
+
const y = l.scrollingElement ?? l.body;
|
|
1670
|
+
this._scrollDelta = { x: y.scrollLeft, y: y.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), Y(l, ["pointermove"], this._delayedTapMove, { passive: !1 }), Y(l, ["pointerup", "pointercancel"], this._onTapStop), Y(l, "scroll", this._onScroll), d.deselectOnBlur && (this._targetBoundaryScrolled = !1, Y(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1671
1671
|
}
|
|
1672
1672
|
_onSingleTap(t) {
|
|
1673
1673
|
const {
|
|
1674
1674
|
singleTap: { intersect: n },
|
|
1675
1675
|
range: o
|
|
1676
|
-
} = this._options.features, s =
|
|
1676
|
+
} = this._options.features, s = Q(t);
|
|
1677
1677
|
let i;
|
|
1678
1678
|
if (n === "native")
|
|
1679
1679
|
i = s.target;
|
|
@@ -1681,8 +1681,8 @@ class io extends eo {
|
|
|
1681
1681
|
this.resolveSelectables();
|
|
1682
1682
|
const { x: c, y: r } = s;
|
|
1683
1683
|
i = this._selectables.find((a) => {
|
|
1684
|
-
const { right: d, left: h, top: u, bottom:
|
|
1685
|
-
return c < d && c > h && r <
|
|
1684
|
+
const { right: d, left: h, top: u, bottom: p } = a.getBoundingClientRect();
|
|
1685
|
+
return c < d && c > h && r < p && r > u;
|
|
1686
1686
|
});
|
|
1687
1687
|
}
|
|
1688
1688
|
if (!i)
|
|
@@ -1709,7 +1709,7 @@ class io extends eo {
|
|
|
1709
1709
|
container: n,
|
|
1710
1710
|
document: o,
|
|
1711
1711
|
behaviour: { startThreshold: s }
|
|
1712
|
-
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } =
|
|
1712
|
+
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } = Q(t);
|
|
1713
1713
|
if (
|
|
1714
1714
|
// Single number for both coordinates
|
|
1715
1715
|
typeof s == "number" && j(c + r - (i + l)) >= s || // Different x and y threshold
|
|
@@ -1719,32 +1719,32 @@ class io extends eo {
|
|
|
1719
1719
|
O(o, ["pointerup", "pointercancel"], this._onTapStop);
|
|
1720
1720
|
return;
|
|
1721
1721
|
}
|
|
1722
|
-
|
|
1722
|
+
Y(o, ["pointermove"], this._onTapMove, { passive: !1 }), H(this._area, "display", "block"), X(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);
|
|
1723
1723
|
}
|
|
1724
1724
|
this._handleMoveEvent(t);
|
|
1725
1725
|
}
|
|
1726
1726
|
_setupSelectionArea() {
|
|
1727
1727
|
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
1728
|
-
this._scrollAvailable ? (
|
|
1728
|
+
this._scrollAvailable ? (H(t, {
|
|
1729
1729
|
top: s.top,
|
|
1730
1730
|
left: s.left,
|
|
1731
1731
|
width: s.width,
|
|
1732
1732
|
height: s.height
|
|
1733
|
-
}),
|
|
1733
|
+
}), H(o, {
|
|
1734
1734
|
marginTop: -s.top,
|
|
1735
1735
|
marginLeft: -s.left
|
|
1736
|
-
})) : (
|
|
1736
|
+
})) : (H(t, {
|
|
1737
1737
|
top: 0,
|
|
1738
1738
|
left: 0,
|
|
1739
1739
|
width: "100%",
|
|
1740
1740
|
height: "100%"
|
|
1741
|
-
}),
|
|
1741
|
+
}), H(o, {
|
|
1742
1742
|
marginTop: 0,
|
|
1743
1743
|
marginLeft: 0
|
|
1744
1744
|
}));
|
|
1745
1745
|
}
|
|
1746
1746
|
_onTapMove(t) {
|
|
1747
|
-
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling, { x: c, y: r } =
|
|
1747
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling, { x: c, y: r } = Q(t);
|
|
1748
1748
|
if (o.x2 = c, o.y2 = r, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1749
1749
|
this._scrollingActive = !0;
|
|
1750
1750
|
const a = () => {
|
|
@@ -1754,7 +1754,7 @@ class io extends eo {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
const d = this._options.mindElixirInstance;
|
|
1756
1756
|
if (d && d.move) {
|
|
1757
|
-
const h = n.x ?
|
|
1757
|
+
const h = n.x ? Fe(n.x / l) : 0, u = n.y ? Fe(n.y / l) : 0;
|
|
1758
1758
|
(h || u) && (d.move(-h, -u), o.x1 -= h, o.y1 -= u);
|
|
1759
1759
|
}
|
|
1760
1760
|
i.next(t), requestAnimationFrame(a);
|
|
@@ -1766,7 +1766,7 @@ class io extends eo {
|
|
|
1766
1766
|
}
|
|
1767
1767
|
_handleMoveEvent(t) {
|
|
1768
1768
|
const { features: n } = this._options;
|
|
1769
|
-
(n.touch &&
|
|
1769
|
+
(n.touch && oo() || this._scrollAvailable && so()) && t.preventDefault();
|
|
1770
1770
|
}
|
|
1771
1771
|
_onScroll() {
|
|
1772
1772
|
const {
|
|
@@ -1787,8 +1787,8 @@ class io extends eo {
|
|
|
1787
1787
|
}
|
|
1788
1788
|
} = s;
|
|
1789
1789
|
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;
|
|
1790
|
-
const h =
|
|
1791
|
-
this._areaRect =
|
|
1790
|
+
const h = Xe(l, r), u = Xe(c, a), p = Ye(l, r), v = Ye(c, a);
|
|
1791
|
+
this._areaRect = Be(h, u, p - h, v - u);
|
|
1792
1792
|
}
|
|
1793
1793
|
_redrawSelectionArea() {
|
|
1794
1794
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1796,32 +1796,32 @@ class io extends eo {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
_onTapStop(t, n) {
|
|
1798
1798
|
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1799
|
-
O(this._targetElement, "scroll", this._onStartAreaScroll), O(o, ["pointermove"], this._delayedTapMove), O(o, ["pointermove"], this._onTapMove), O(o, ["pointerup", "pointercancel"], this._onTapStop), O(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(),
|
|
1799
|
+
O(this._targetElement, "scroll", this._onStartAreaScroll), O(o, ["pointermove"], this._delayedTapMove), O(o, ["pointermove"], this._onTapMove), O(o, ["pointerup", "pointercancel"], this._onTapStop), O(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(), H(this._area, "display", "none");
|
|
1800
1800
|
}
|
|
1801
1801
|
_updateElementSelection() {
|
|
1802
|
-
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 = [],
|
|
1803
|
-
for (let
|
|
1804
|
-
const
|
|
1805
|
-
if (
|
|
1806
|
-
if (l.includes(
|
|
1807
|
-
i.includes(
|
|
1808
|
-
else if (d && i.includes(
|
|
1809
|
-
|
|
1802
|
+
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 = [], p = [];
|
|
1803
|
+
for (let m = 0; m < t.length; m++) {
|
|
1804
|
+
const y = t[m];
|
|
1805
|
+
if (We(s, y.getBoundingClientRect(), r)) {
|
|
1806
|
+
if (l.includes(y))
|
|
1807
|
+
i.includes(y) && !c.includes(y) && c.push(y);
|
|
1808
|
+
else if (d && i.includes(y)) {
|
|
1809
|
+
p.push(y);
|
|
1810
1810
|
continue;
|
|
1811
1811
|
} else
|
|
1812
|
-
u.push(
|
|
1813
|
-
h.push(
|
|
1812
|
+
u.push(y);
|
|
1813
|
+
h.push(y);
|
|
1814
1814
|
}
|
|
1815
1815
|
}
|
|
1816
|
-
d && u.push(...i.filter((
|
|
1816
|
+
d && u.push(...i.filter((m) => !l.includes(m)));
|
|
1817
1817
|
const v = a === "keep";
|
|
1818
|
-
for (let
|
|
1819
|
-
const
|
|
1820
|
-
!h.includes(
|
|
1818
|
+
for (let m = 0; m < l.length; m++) {
|
|
1819
|
+
const y = l[m];
|
|
1820
|
+
!h.includes(y) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1821
1821
|
// not make them part of the current selection as soon as they're touched.
|
|
1822
|
-
(v && i.includes(
|
|
1822
|
+
(v && i.includes(y)) && p.push(y);
|
|
1823
1823
|
}
|
|
1824
|
-
o.selected = h, o.changed = { added: u, removed:
|
|
1824
|
+
o.selected = h, o.changed = { added: u, removed: p }, this._latestElement = void 0;
|
|
1825
1825
|
}
|
|
1826
1826
|
_emitEvent(t, n) {
|
|
1827
1827
|
return this.emit(t, {
|
|
@@ -1872,7 +1872,7 @@ class io extends eo {
|
|
|
1872
1872
|
* Will update everything that can be selected
|
|
1873
1873
|
*/
|
|
1874
1874
|
resolveSelectables() {
|
|
1875
|
-
this._selectables =
|
|
1875
|
+
this._selectables = X(this._options.selectables, this._options.document);
|
|
1876
1876
|
}
|
|
1877
1877
|
/**
|
|
1878
1878
|
* Same as deselecting, but for all elements currently selected
|
|
@@ -1881,7 +1881,7 @@ class io extends eo {
|
|
|
1881
1881
|
*/
|
|
1882
1882
|
clearSelection(t = !0, n = !1) {
|
|
1883
1883
|
const { selected: o, stored: s, changed: i } = this._selection;
|
|
1884
|
-
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection =
|
|
1884
|
+
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Ke(t ? [] : s);
|
|
1885
1885
|
}
|
|
1886
1886
|
/**
|
|
1887
1887
|
* @returns {Array} Selected elements
|
|
@@ -1941,7 +1941,7 @@ class io extends eo {
|
|
|
1941
1941
|
* @param quiet If this should not trigger the move event
|
|
1942
1942
|
*/
|
|
1943
1943
|
select(t, n = !1) {
|
|
1944
|
-
const { changed: o, selected: s, stored: i } = this._selection, l =
|
|
1944
|
+
const { changed: o, selected: s, stored: i } = this._selection, l = X(t, this._options.document).filter((c) => !s.includes(c) && !i.includes(c));
|
|
1945
1945
|
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;
|
|
1946
1946
|
}
|
|
1947
1947
|
/**
|
|
@@ -1950,12 +1950,12 @@ class io extends eo {
|
|
|
1950
1950
|
* @param quiet If this should not trigger the move event
|
|
1951
1951
|
*/
|
|
1952
1952
|
deselect(t, n = !1) {
|
|
1953
|
-
const { selected: o, stored: s, changed: i } = this._selection, l =
|
|
1953
|
+
const { selected: o, stored: s, changed: i } = this._selection, l = X(t, this._options.document).filter((c) => o.includes(c) || s.includes(c));
|
|
1954
1954
|
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));
|
|
1955
1955
|
}
|
|
1956
1956
|
}
|
|
1957
|
-
function
|
|
1958
|
-
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new
|
|
1957
|
+
function lo(e) {
|
|
1958
|
+
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new ro({
|
|
1959
1959
|
selectables: [".map-container me-tpc"],
|
|
1960
1960
|
boundaries: [e.container],
|
|
1961
1961
|
container: e.selectionContainer,
|
|
@@ -2022,23 +2022,23 @@ function at({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction:
|
|
|
2022
2022
|
let d = t + n / 2;
|
|
2023
2023
|
const h = e + o / 2;
|
|
2024
2024
|
let u;
|
|
2025
|
-
r ===
|
|
2026
|
-
const
|
|
2027
|
-
return r ===
|
|
2025
|
+
r === $.LHS ? u = i + l : u = i;
|
|
2026
|
+
const p = s + c / 2, m = (1 - Math.abs(p - h) / a) * 0.25 * (n / 2);
|
|
2027
|
+
return r === $.LHS ? d = d - n / 10 - m : d = d + n / 10 + m, `M ${d} ${h} Q ${d} ${p} ${u} ${p}`;
|
|
2028
2028
|
}
|
|
2029
2029
|
function dt({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, isFirst: a }) {
|
|
2030
2030
|
const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2031
2031
|
let h = 0, u = 0;
|
|
2032
2032
|
a ? h = e + o / 2 : h = e + o;
|
|
2033
|
-
const
|
|
2034
|
-
let v = 0,
|
|
2035
|
-
const
|
|
2036
|
-
return r ===
|
|
2033
|
+
const p = s + c;
|
|
2034
|
+
let v = 0, m = 0, y = 0;
|
|
2035
|
+
const g = Math.abs(h - p) / 300 * d;
|
|
2036
|
+
return r === $.LHS ? (y = t, v = y + d, m = y - d, u = i + d, `M ${v} ${h} C ${y} ${h} ${y + g} ${p} ${m} ${p} H ${u}`) : (y = t + n, v = y - d, m = y + d, u = i + l - d, `M ${v} ${h} C ${y} ${h} ${y - g} ${p} ${m} ${p} H ${u}`);
|
|
2037
2037
|
}
|
|
2038
|
-
const
|
|
2038
|
+
const co = function(e, t = !0) {
|
|
2039
2039
|
this.theme = e, this.generateMainBranch = this.theme.generateMainBranch || at, this.generateSubBranch = this.theme.generateSubBranch || dt;
|
|
2040
2040
|
const o = {
|
|
2041
|
-
...(this.theme.type === "dark" ?
|
|
2041
|
+
...(this.theme.type === "dark" ? ge : pe).cssVar,
|
|
2042
2042
|
...this.theme.cssVar
|
|
2043
2043
|
};
|
|
2044
2044
|
this.compact && (o["--node-gap-x"] = "15px", o["--node-gap-y"] = "2px", o["--main-gap-x"] = "30px", o["--main-gap-y"] = "6px");
|
|
@@ -2048,9 +2048,9 @@ const lo = function(e, t = !0) {
|
|
|
2048
2048
|
this.container.style.setProperty(l, o[l]);
|
|
2049
2049
|
}
|
|
2050
2050
|
t && this.refresh();
|
|
2051
|
-
}, co = function(e) {
|
|
2052
|
-
this.compact = e, this.theme && this.changeTheme(this.theme);
|
|
2053
2051
|
}, ao = function(e) {
|
|
2052
|
+
this.compact = e, this.theme && this.changeTheme(this.theme);
|
|
2053
|
+
}, ho = function(e) {
|
|
2054
2054
|
return {
|
|
2055
2055
|
dom: e,
|
|
2056
2056
|
moved: !1,
|
|
@@ -2085,8 +2085,8 @@ const lo = function(e, t = !0) {
|
|
|
2085
2085
|
this.moved = !1, this.pointerdown = !1;
|
|
2086
2086
|
}
|
|
2087
2087
|
};
|
|
2088
|
-
},
|
|
2089
|
-
create:
|
|
2088
|
+
}, Ve = {
|
|
2089
|
+
create: ho
|
|
2090
2090
|
}, ht = "#4dc4ff";
|
|
2091
2091
|
function ft(e, t, n, o, s, i, l, c) {
|
|
2092
2092
|
return {
|
|
@@ -2094,10 +2094,10 @@ function ft(e, t, n, o, s, i, l, c) {
|
|
|
2094
2094
|
y: t / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
2095
2095
|
};
|
|
2096
2096
|
}
|
|
2097
|
-
function
|
|
2098
|
-
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(),
|
|
2097
|
+
function fo(e, t, n) {
|
|
2098
|
+
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), le(e));
|
|
2099
2099
|
}
|
|
2100
|
-
function
|
|
2100
|
+
function F(e, t, n, o, s) {
|
|
2101
2101
|
k(e, {
|
|
2102
2102
|
x1: t + "",
|
|
2103
2103
|
y1: n + "",
|
|
@@ -2105,41 +2105,34 @@ function Z(e, t, n, o, s) {
|
|
|
2105
2105
|
y2: s + ""
|
|
2106
2106
|
});
|
|
2107
2107
|
}
|
|
2108
|
-
function
|
|
2108
|
+
function ue(e, t, n, o, s, i, l, c, r, a) {
|
|
2109
2109
|
const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${c} ${r}`;
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
if (e.arrow1.setAttribute("d", p), h.length > 1 && h[1].setAttribute("d", p), a.style) {
|
|
2120
|
-
const g = a.style;
|
|
2121
|
-
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));
|
|
2122
|
-
}
|
|
2110
|
+
e.line.setAttribute("d", d);
|
|
2111
|
+
const h = a.style || {};
|
|
2112
|
+
e.line.setAttribute("stroke", h.stroke || "rgb(227, 125, 116)"), e.line.setAttribute("stroke-width", String(h.strokeWidth || "2")), e.line.setAttribute("stroke-dasharray", h.strokeDasharray || "8,2"), e.line.setAttribute("stroke-linecap", h.strokeLinecap || "cap"), h.opacity !== void 0 && h.opacity !== null && h.opacity !== "" ? e.line.setAttribute("opacity", String(h.opacity)) : e.line.removeAttribute("opacity");
|
|
2113
|
+
const u = e.querySelectorAll('path[stroke="transparent"]');
|
|
2114
|
+
u.length > 0 && u[0].setAttribute("d", d);
|
|
2115
|
+
const p = se(i, l, c, r);
|
|
2116
|
+
if (p) {
|
|
2117
|
+
const g = `M ${p.x1} ${p.y1} L ${c} ${r} L ${p.x2} ${p.y2}`;
|
|
2118
|
+
e.arrow1.setAttribute("d", g), u.length > 1 && u[1].setAttribute("d", g), e.arrow1.setAttribute("stroke", h.stroke || "rgb(227, 125, 116)"), e.arrow1.setAttribute("stroke-width", String(h.strokeWidth || "2")), e.arrow1.setAttribute("stroke-linecap", h.strokeLinecap || "cap"), h.opacity !== void 0 && h.opacity !== null && h.opacity !== "" ? e.arrow1.setAttribute("opacity", String(h.opacity)) : e.arrow1.removeAttribute("opacity");
|
|
2123
2119
|
}
|
|
2124
2120
|
if (a.bidirectional) {
|
|
2125
|
-
const
|
|
2126
|
-
if (
|
|
2127
|
-
const
|
|
2128
|
-
|
|
2129
|
-
const m = a.style;
|
|
2130
|
-
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));
|
|
2131
|
-
}
|
|
2121
|
+
const g = se(o, s, t, n);
|
|
2122
|
+
if (g) {
|
|
2123
|
+
const x = `M ${g.x1} ${g.y1} L ${t} ${n} L ${g.x2} ${g.y2}`;
|
|
2124
|
+
e.arrow2.setAttribute("d", x), u.length > 2 && u[2].setAttribute("d", x);
|
|
2132
2125
|
}
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
vo(e);
|
|
2126
|
+
} else
|
|
2127
|
+
e.arrow2.setAttribute("d", ""), u.length > 2 && u[2].setAttribute("d", "");
|
|
2128
|
+
e.arrow2.setAttribute("stroke", h.stroke || "rgb(227, 125, 116)"), e.arrow2.setAttribute("stroke-width", String(h.strokeWidth || "2")), e.arrow2.setAttribute("stroke-linecap", h.strokeLinecap || "cap"), h.opacity !== void 0 && h.opacity !== null && h.opacity !== "" ? e.arrow2.setAttribute("opacity", String(h.opacity)) : e.arrow2.removeAttribute("opacity");
|
|
2129
|
+
const { x: v, y: m } = ft(t, n, o, s, i, l, c, r);
|
|
2130
|
+
e.labelEl && fo(e.labelEl, v, m);
|
|
2131
|
+
const y = e.labelEl;
|
|
2132
|
+
y && (y.style.color = h.labelColor || "rgb(235, 95, 82)"), vo(e);
|
|
2140
2133
|
}
|
|
2141
|
-
function
|
|
2142
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
2134
|
+
function V(e, t, n) {
|
|
2135
|
+
const { offsetLeft: o, offsetTop: s } = A(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;
|
|
2143
2136
|
return {
|
|
2144
2137
|
w: i,
|
|
2145
2138
|
h: l,
|
|
@@ -2149,7 +2142,7 @@ function se(e, t, n) {
|
|
|
2149
2142
|
ctrlY: d
|
|
2150
2143
|
};
|
|
2151
2144
|
}
|
|
2152
|
-
function
|
|
2145
|
+
function I(e) {
|
|
2153
2146
|
let t, n;
|
|
2154
2147
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
2155
2148
|
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), {
|
|
@@ -2157,74 +2150,74 @@ function X(e) {
|
|
|
2157
2150
|
y: n
|
|
2158
2151
|
};
|
|
2159
2152
|
}
|
|
2160
|
-
const
|
|
2161
|
-
const o =
|
|
2162
|
-
let
|
|
2153
|
+
const ut = function(e, t, n) {
|
|
2154
|
+
const o = A(e.nodes, t), s = A(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)), p = Math.abs(a), v = Math.abs(d);
|
|
2155
|
+
let m, y;
|
|
2163
2156
|
if (h < 150) {
|
|
2164
|
-
const
|
|
2165
|
-
|
|
2166
|
-
} else if (
|
|
2167
|
-
const
|
|
2168
|
-
|
|
2169
|
-
} else if (v >
|
|
2170
|
-
const
|
|
2171
|
-
|
|
2157
|
+
const x = t.closest("me-main").className === "lhs" ? -1 : 1;
|
|
2158
|
+
m = { x: 200 * x, y: 0 }, y = { x: 200 * x, y: 0 };
|
|
2159
|
+
} else if (p > v * 1.5) {
|
|
2160
|
+
const x = a > 0 ? t.offsetWidth / 2 : -t.offsetWidth / 2, E = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
2161
|
+
m = { x: x + (a > 0 ? u : -u), y: 0 }, y = { x: E + (a > 0 ? -u : u), y: 0 };
|
|
2162
|
+
} else if (v > p * 1.5) {
|
|
2163
|
+
const x = d > 0 ? t.offsetHeight / 2 : -t.offsetHeight / 2, E = d > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
2164
|
+
m = { x: 0, y: x + (d > 0 ? u : -u) }, y = { x: 0, y: E + (d > 0 ? -u : u) };
|
|
2172
2165
|
} else {
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2166
|
+
const x = Math.atan2(d, a), E = t.offsetWidth / 2 * Math.cos(x), N = t.offsetHeight / 2 * Math.sin(x), f = -(n.offsetWidth / 2) * Math.cos(x), b = -(n.offsetHeight / 2) * Math.sin(x), w = u * 0.7 * (a > 0 ? 1 : -1), S = u * 0.7 * (d > 0 ? 1 : -1);
|
|
2167
|
+
m = { x: E + w, y: N + S }, y = { x: f - w, y: b - S };
|
|
2175
2168
|
}
|
|
2176
2169
|
return {
|
|
2177
|
-
delta1: { x: Math.round(
|
|
2178
|
-
delta2: { x: Math.round(
|
|
2170
|
+
delta1: { x: Math.round(m.x), y: Math.round(m.y) },
|
|
2171
|
+
delta2: { x: Math.round(y.x), y: Math.round(y.y) }
|
|
2179
2172
|
};
|
|
2180
|
-
},
|
|
2173
|
+
}, Ne = function(e, t, n, o, s) {
|
|
2181
2174
|
if (!t || !n)
|
|
2182
2175
|
return;
|
|
2183
2176
|
if (!o.delta1 || !o.delta2) {
|
|
2184
|
-
const C =
|
|
2177
|
+
const C = ut(e, t, n);
|
|
2185
2178
|
o.delta1 = C.delta1, o.delta2 = C.delta2;
|
|
2186
2179
|
}
|
|
2187
|
-
const i =
|
|
2188
|
-
if (!
|
|
2189
|
-
const
|
|
2190
|
-
let
|
|
2180
|
+
const i = V(e, t, o.delta1), l = V(e, n, o.delta2), { x: c, y: r } = I(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: p, y: v } = I(l), m = se(h, u, p, v);
|
|
2181
|
+
if (!m) return;
|
|
2182
|
+
const y = `M ${m.x1} ${m.y1} L ${p} ${v} L ${m.x2} ${m.y2}`;
|
|
2183
|
+
let g = "";
|
|
2191
2184
|
if (o.bidirectional) {
|
|
2192
|
-
const C =
|
|
2185
|
+
const C = se(a, d, c, r);
|
|
2193
2186
|
if (!C) return;
|
|
2194
|
-
|
|
2187
|
+
g = `M ${C.x1} ${C.y1} L ${c} ${r} L ${C.x2} ${C.y2}`;
|
|
2195
2188
|
}
|
|
2196
|
-
const
|
|
2197
|
-
|
|
2198
|
-
const
|
|
2189
|
+
const x = jn(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${p} ${v}`, y, g, o.style), { x: E, y: N } = ft(c, r, a, d, h, u, p, v), f = o.style?.labelColor || "rgb(235, 95, 82)", b = "a-" + o.id;
|
|
2190
|
+
x.id = b;
|
|
2191
|
+
const w = e.markdown ? e.markdown(o.label, o) : o.label, S = he(w, E, N, {
|
|
2199
2192
|
anchor: "middle",
|
|
2200
2193
|
color: f,
|
|
2201
2194
|
dataType: "arrow",
|
|
2202
|
-
svgId:
|
|
2195
|
+
svgId: b
|
|
2203
2196
|
});
|
|
2204
|
-
|
|
2197
|
+
x.labelEl = S, x.arrowObj = o, x.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.arrowSvg.appendChild(x), le(S), s || (e.arrows.push(o), e.currentArrow = x, gt(e, o, i, l));
|
|
2205
2198
|
}, uo = function(e, t, n = {}) {
|
|
2206
2199
|
const o = {
|
|
2207
|
-
id:
|
|
2200
|
+
id: W(),
|
|
2208
2201
|
label: "Custom Link",
|
|
2209
2202
|
from: e.nodeObj.id,
|
|
2210
2203
|
to: t.nodeObj.id,
|
|
2211
2204
|
...n
|
|
2212
2205
|
};
|
|
2213
|
-
|
|
2206
|
+
Ne(this, e, t, o), this.bus.fire("operation", {
|
|
2214
2207
|
name: "createArrow",
|
|
2215
2208
|
obj: o
|
|
2216
2209
|
});
|
|
2217
2210
|
}, po = function(e) {
|
|
2218
|
-
|
|
2219
|
-
const t = { ...e, id:
|
|
2220
|
-
|
|
2211
|
+
ce(this);
|
|
2212
|
+
const t = { ...e, id: W() };
|
|
2213
|
+
Ne(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2221
2214
|
name: "createArrow",
|
|
2222
2215
|
obj: t
|
|
2223
2216
|
});
|
|
2224
2217
|
}, go = function(e) {
|
|
2225
2218
|
let t;
|
|
2226
2219
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2227
|
-
|
|
2220
|
+
ce(this);
|
|
2228
2221
|
const n = t.arrowObj.id;
|
|
2229
2222
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.labelEl?.remove(), t.remove(), this.bus.fire("operation", {
|
|
2230
2223
|
name: "removeArrow",
|
|
@@ -2234,12 +2227,12 @@ const fo = function(e, t, n) {
|
|
|
2234
2227
|
});
|
|
2235
2228
|
}, mo = function(e) {
|
|
2236
2229
|
this.currentArrow = e;
|
|
2237
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s =
|
|
2238
|
-
this.editable ?
|
|
2230
|
+
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = V(this, n, t.delta1), i = V(this, o, t.delta2);
|
|
2231
|
+
this.editable ? gt(this, t, s, i) : pt(e, ht), this.bus.fire("selectArrow", t);
|
|
2239
2232
|
}, yo = function() {
|
|
2240
|
-
|
|
2241
|
-
},
|
|
2242
|
-
const n = document.createElementNS(
|
|
2233
|
+
ce(this), this.currentArrow = null, this.bus.fire("unselectArrow");
|
|
2234
|
+
}, ae = function(e, t) {
|
|
2235
|
+
const n = document.createElementNS(M, "path");
|
|
2243
2236
|
return k(n, {
|
|
2244
2237
|
d: e,
|
|
2245
2238
|
stroke: t,
|
|
@@ -2248,14 +2241,14 @@ const fo = function(e, t, n) {
|
|
|
2248
2241
|
"stroke-linecap": "round",
|
|
2249
2242
|
"stroke-linejoin": "round"
|
|
2250
2243
|
}), n;
|
|
2251
|
-
},
|
|
2252
|
-
const n = document.createElementNS(
|
|
2244
|
+
}, pt = function(e, t) {
|
|
2245
|
+
const n = document.createElementNS(M, "g");
|
|
2253
2246
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2254
|
-
const o =
|
|
2247
|
+
const o = ae(e.line.getAttribute("d"), t);
|
|
2255
2248
|
n.appendChild(o);
|
|
2256
|
-
const s =
|
|
2249
|
+
const s = ae(e.arrow1.getAttribute("d"), t);
|
|
2257
2250
|
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2258
|
-
const i =
|
|
2251
|
+
const i = ae(e.arrow2.getAttribute("d"), t);
|
|
2259
2252
|
n.appendChild(i);
|
|
2260
2253
|
}
|
|
2261
2254
|
e.insertBefore(n, e.firstChild);
|
|
@@ -2267,51 +2260,76 @@ const fo = function(e, t, n) {
|
|
|
2267
2260
|
if (!t) return;
|
|
2268
2261
|
const n = t.querySelectorAll("path");
|
|
2269
2262
|
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"));
|
|
2270
|
-
},
|
|
2263
|
+
}, ce = function(e) {
|
|
2271
2264
|
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && bo(e.currentArrow);
|
|
2272
|
-
},
|
|
2265
|
+
}, gt = function(e, t, n, o) {
|
|
2273
2266
|
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: d, currentArrow: h, bus: u } = e;
|
|
2274
2267
|
if (!h) return;
|
|
2275
|
-
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l),
|
|
2276
|
-
let { x:
|
|
2277
|
-
i.style.cssText = `top:${
|
|
2278
|
-
|
|
2279
|
-
const
|
|
2280
|
-
|
|
2281
|
-
}), e.helper2.init(d, (f,
|
|
2282
|
-
|
|
2283
|
-
const
|
|
2284
|
-
E =
|
|
2268
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), pt(h, ht);
|
|
2269
|
+
let { x: p, y: v } = I(n), { ctrlX: m, ctrlY: y } = n, { ctrlX: g, ctrlY: x } = o, { x: E, y: N } = I(o);
|
|
2270
|
+
i.style.cssText = `top:${y}px;left:${m}px;`, l.style.cssText = `top:${x}px;left:${g}px;`, F(c, p, v, m, y), F(r, g, x, E, N), e.helper1 = Ve.create(i), e.helper2 = Ve.create(l), e.helper1.init(d, (f, b) => {
|
|
2271
|
+
m = m + f / e.scaleVal, y = y + b / e.scaleVal;
|
|
2272
|
+
const w = I({ ...n, ctrlX: m, ctrlY: y });
|
|
2273
|
+
p = w.x, v = w.y, i.style.top = y + "px", i.style.left = m + "px", ue(h, p, v, m, y, g, x, E, N, t), F(c, p, v, m, y), t.delta1.x = Math.round(m - n.cx), t.delta1.y = Math.round(y - n.cy), u.fire("updateArrowDelta", t);
|
|
2274
|
+
}), e.helper2.init(d, (f, b) => {
|
|
2275
|
+
g = g + f / e.scaleVal, x = x + b / e.scaleVal;
|
|
2276
|
+
const w = I({ ...o, ctrlX: g, ctrlY: x });
|
|
2277
|
+
E = w.x, N = w.y, l.style.top = x + "px", l.style.left = g + "px", ue(h, p, v, m, y, g, x, E, N, t), F(r, g, x, E, N), t.delta2.x = Math.round(g - o.cx), t.delta2.y = Math.round(x - o.cy), u.fire("updateArrowDelta", t);
|
|
2285
2278
|
});
|
|
2286
2279
|
};
|
|
2287
|
-
function
|
|
2280
|
+
function xo() {
|
|
2288
2281
|
this.arrowSvg.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((t) => t.remove());
|
|
2289
2282
|
for (let t = 0; t < this.arrows.length; t++) {
|
|
2290
2283
|
const n = this.arrows[t];
|
|
2291
2284
|
try {
|
|
2292
|
-
|
|
2285
|
+
Ne(this, this.findEle(n.from), this.findEle(n.to), n, !0);
|
|
2293
2286
|
} catch {
|
|
2294
2287
|
}
|
|
2295
2288
|
}
|
|
2296
2289
|
this.nodes.appendChild(this.arrowSvg);
|
|
2297
2290
|
}
|
|
2298
|
-
function
|
|
2299
|
-
|
|
2291
|
+
function wo(e) {
|
|
2292
|
+
ce(this), e && e.labelEl && rt(this, e.labelEl, e.arrowObj);
|
|
2300
2293
|
}
|
|
2301
2294
|
function Eo() {
|
|
2302
|
-
this.arrows = this.arrows.filter((e) =>
|
|
2295
|
+
this.arrows = this.arrows.filter((e) => oe(e.from, this.nodeData) && oe(e.to, this.nodeData));
|
|
2303
2296
|
}
|
|
2304
|
-
const Co =
|
|
2297
|
+
const Co = function(e, t) {
|
|
2298
|
+
const n = ie(e);
|
|
2299
|
+
n.style && t.style && (t.style = Object.assign({}, n.style, t.style)), Object.assign(e, t);
|
|
2300
|
+
const o = this.arrowSvg.querySelector(`g[data-linkid="${e.id}"]`);
|
|
2301
|
+
if (o) {
|
|
2302
|
+
if (t.label !== void 0 && o.labelEl) {
|
|
2303
|
+
const l = this.markdown ? this.markdown(e.label, e) : e.label;
|
|
2304
|
+
o.labelEl.innerHTML = l;
|
|
2305
|
+
}
|
|
2306
|
+
const s = this.findEle(e.from), i = this.findEle(e.to);
|
|
2307
|
+
if (s && i) {
|
|
2308
|
+
if (!e.delta1 || !e.delta2) {
|
|
2309
|
+
const y = ut(this, s, i);
|
|
2310
|
+
e.delta1 = e.delta1 || y.delta1, e.delta2 = e.delta2 || y.delta2;
|
|
2311
|
+
}
|
|
2312
|
+
const l = V(this, s, e.delta1), c = V(this, i, e.delta2), { x: r, y: a } = I(l), { ctrlX: d, ctrlY: h } = l, { ctrlX: u, ctrlY: p } = c, { x: v, y: m } = I(c);
|
|
2313
|
+
ue(o, r, a, d, h, u, p, v, m, e), this.currentArrow?.arrowObj?.id === e.id && (this.P2.style.cssText = `top:${h}px;left:${d}px;`, this.P3.style.cssText = `top:${p}px;left:${u}px;`, F(this.line1, r, a, d, h), F(this.line2, u, p, v, m));
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
this.bus.fire("operation", {
|
|
2317
|
+
name: "reshapeArrow",
|
|
2318
|
+
obj: e,
|
|
2319
|
+
origin: n
|
|
2320
|
+
});
|
|
2321
|
+
}, So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2305
2322
|
__proto__: null,
|
|
2306
2323
|
createArrow: uo,
|
|
2307
2324
|
createArrowFrom: po,
|
|
2308
|
-
editArrowLabel:
|
|
2325
|
+
editArrowLabel: wo,
|
|
2309
2326
|
removeArrow: go,
|
|
2310
|
-
renderArrow:
|
|
2327
|
+
renderArrow: xo,
|
|
2328
|
+
reshapeArrow: Co,
|
|
2311
2329
|
selectArrow: mo,
|
|
2312
2330
|
tidyArrow: Eo,
|
|
2313
2331
|
unselectArrow: yo
|
|
2314
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2332
|
+
}, Symbol.toStringTag, { value: "Module" })), No = function(e) {
|
|
2315
2333
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2316
2334
|
if (e.length === 1) {
|
|
2317
2335
|
const r = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
@@ -2328,8 +2346,8 @@ const Co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2328
2346
|
let a = r.nodeObj;
|
|
2329
2347
|
const d = [];
|
|
2330
2348
|
for (; a.parent; ) {
|
|
2331
|
-
const h = a.parent,
|
|
2332
|
-
a = h, d.unshift({ node: a, index:
|
|
2349
|
+
const h = a.parent, p = h.children?.indexOf(a);
|
|
2350
|
+
a = h, d.unshift({ node: a, index: p });
|
|
2333
2351
|
}
|
|
2334
2352
|
return d.length > t && (t = d.length), d;
|
|
2335
2353
|
});
|
|
@@ -2348,11 +2366,11 @@ const Co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2348
2366
|
start: i,
|
|
2349
2367
|
end: l
|
|
2350
2368
|
};
|
|
2351
|
-
},
|
|
2352
|
-
const t = document.createElementNS(
|
|
2369
|
+
}, To = function(e) {
|
|
2370
|
+
const t = document.createElementNS(M, "g");
|
|
2353
2371
|
return t.setAttribute("id", e), t;
|
|
2354
2372
|
}, ze = function(e, t) {
|
|
2355
|
-
const n = document.createElementNS(
|
|
2373
|
+
const n = document.createElementNS(M, "path");
|
|
2356
2374
|
return k(n, {
|
|
2357
2375
|
d: e,
|
|
2358
2376
|
stroke: t || "#666",
|
|
@@ -2360,39 +2378,39 @@ const Co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2360
2378
|
"stroke-linecap": "round",
|
|
2361
2379
|
"stroke-width": "2"
|
|
2362
2380
|
}), n;
|
|
2363
|
-
},
|
|
2381
|
+
}, ko = (e) => e.parentElement.parentElement, _o = function(e, { parent: t, start: n }) {
|
|
2364
2382
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2365
2383
|
let i;
|
|
2366
2384
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2367
|
-
},
|
|
2368
|
-
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,
|
|
2369
|
-
let v = 1 / 0,
|
|
2370
|
-
for (let
|
|
2371
|
-
const
|
|
2372
|
-
if (!
|
|
2385
|
+
}, Te = function(e, t) {
|
|
2386
|
+
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, p = _o(e, t);
|
|
2387
|
+
let v = 1 / 0, m = 0, y = 0, g = 0;
|
|
2388
|
+
for (let G = i; G <= l; G++) {
|
|
2389
|
+
const ke = u.children?.[G];
|
|
2390
|
+
if (!ke)
|
|
2373
2391
|
return e.removeSummary(n), null;
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2376
|
-
}
|
|
2377
|
-
let
|
|
2378
|
-
const N = u.parent ? 10 : 0, f =
|
|
2379
|
-
|
|
2380
|
-
const L =
|
|
2381
|
-
return L.appendChild(
|
|
2382
|
-
},
|
|
2392
|
+
const J = ko(e.findEle(ke.id)), { offsetLeft: Z, offsetTop: _e } = A(r, J), De = i === l ? 10 : 20;
|
|
2393
|
+
G === i && (y = _e + De), G === l && (g = _e + J.offsetHeight - De), Z < v && (v = Z), J.offsetWidth + Z > m && (m = J.offsetWidth + Z);
|
|
2394
|
+
}
|
|
2395
|
+
let x, E;
|
|
2396
|
+
const N = u.parent ? 10 : 0, f = y + N, b = g + N, w = (f + b) / 2, S = c?.stroke || a.cssVar["--color"], C = c?.labelColor || a.cssVar["--color"], T = "s-" + n, D = e.markdown ? e.markdown(o, t) : o;
|
|
2397
|
+
p === $.LHS ? (x = ze(`M ${v + 10} ${f} c -5 0 -10 5 -10 10 L ${v} ${b - 10} c 0 5 5 10 10 10 M ${v} ${w} h -10`, S), E = he(D, v - 20, w, { anchor: "end", color: C, dataType: "summary", svgId: T })) : (x = ze(`M ${m - 10} ${f} c 5 0 10 5 10 10 L ${m} ${b - 10} c 0 5 -5 10 -10 10 M ${m} ${w} h 10`, S), E = he(D, m + 20, w, { anchor: "start", color: C, dataType: "summary", svgId: T }));
|
|
2398
|
+
const L = To(T);
|
|
2399
|
+
return L.appendChild(x), e.labelContainer.appendChild(E), le(E), L.summaryObj = t, L.labelEl = E, d.appendChild(L), L;
|
|
2400
|
+
}, Do = function(e = {}) {
|
|
2383
2401
|
if (!this.currentNodes) return;
|
|
2384
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } =
|
|
2402
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = No(t), c = { id: W(), parent: s, start: i, end: l, label: "summary", style: e.style }, r = Te(this, c);
|
|
2385
2403
|
n.push(c), this.editSummary(r), o.fire("operation", {
|
|
2386
2404
|
name: "createSummary",
|
|
2387
2405
|
obj: c
|
|
2388
2406
|
});
|
|
2389
|
-
},
|
|
2390
|
-
const t =
|
|
2391
|
-
|
|
2407
|
+
}, Lo = function(e) {
|
|
2408
|
+
const t = W(), n = { ...e, id: t };
|
|
2409
|
+
Te(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2392
2410
|
name: "createSummary",
|
|
2393
2411
|
obj: n
|
|
2394
2412
|
});
|
|
2395
|
-
},
|
|
2413
|
+
}, Ao = function(e) {
|
|
2396
2414
|
const t = this.summaries.findIndex((n) => n.id === e);
|
|
2397
2415
|
t > -1 && (this.summaries.splice(t, 1), this.nodes.querySelector("#s-" + e)?.remove(), this.nodes.querySelector("#label-s-" + e)?.remove()), this.bus.fire("operation", {
|
|
2398
2416
|
name: "removeSummary",
|
|
@@ -2401,28 +2419,28 @@ const Co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2401
2419
|
}, Mo = function(e) {
|
|
2402
2420
|
const t = e.labelEl;
|
|
2403
2421
|
t && t.classList.add("selected"), this.currentSummary = e, this.bus.fire("selectSummary", e.summaryObj);
|
|
2404
|
-
}, Ao = function() {
|
|
2405
|
-
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
2406
2422
|
}, Po = function() {
|
|
2423
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
2424
|
+
}, Oo = function() {
|
|
2407
2425
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2408
2426
|
try {
|
|
2409
|
-
|
|
2427
|
+
Te(this, e);
|
|
2410
2428
|
} catch {
|
|
2411
2429
|
}
|
|
2412
2430
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2413
|
-
},
|
|
2431
|
+
}, $o = function(e) {
|
|
2414
2432
|
e && e.labelEl && rt(this, e.labelEl, e.summaryObj);
|
|
2415
2433
|
}, Ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2416
2434
|
__proto__: null,
|
|
2417
|
-
createSummary:
|
|
2418
|
-
createSummaryFrom:
|
|
2419
|
-
editSummary:
|
|
2420
|
-
removeSummary:
|
|
2421
|
-
renderSummary:
|
|
2435
|
+
createSummary: Do,
|
|
2436
|
+
createSummaryFrom: Lo,
|
|
2437
|
+
editSummary: $o,
|
|
2438
|
+
removeSummary: Ao,
|
|
2439
|
+
renderSummary: Oo,
|
|
2422
2440
|
selectSummary: Mo,
|
|
2423
|
-
unselectSummary:
|
|
2441
|
+
unselectSummary: Po
|
|
2424
2442
|
}, Symbol.toStringTag, { value: "Module" })), _ = "http://www.w3.org/2000/svg";
|
|
2425
|
-
function
|
|
2443
|
+
function Io(e, t) {
|
|
2426
2444
|
const n = document.createElementNS(_, "svg");
|
|
2427
2445
|
return k(n, {
|
|
2428
2446
|
version: "1.1",
|
|
@@ -2434,7 +2452,7 @@ function $o(e, t) {
|
|
|
2434
2452
|
function jo(e, t) {
|
|
2435
2453
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2436
2454
|
}
|
|
2437
|
-
function
|
|
2455
|
+
function Ro(e, t, n, o) {
|
|
2438
2456
|
const s = document.createElementNS(_, "g");
|
|
2439
2457
|
let i = "";
|
|
2440
2458
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
@@ -2451,7 +2469,7 @@ function Io(e, t, n, o) {
|
|
|
2451
2469
|
}), a.innerHTML = c, s.appendChild(a);
|
|
2452
2470
|
}), s;
|
|
2453
2471
|
}
|
|
2454
|
-
function
|
|
2472
|
+
function Bo(e, t, n, o) {
|
|
2455
2473
|
let s = "";
|
|
2456
2474
|
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2457
2475
|
const i = document.createElementNS(_, "foreignObject");
|
|
@@ -2467,8 +2485,8 @@ function Ro(e, t, n, o) {
|
|
|
2467
2485
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2468
2486
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2469
2487
|
}
|
|
2470
|
-
function
|
|
2471
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2488
|
+
function Wo(e, t) {
|
|
2489
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(_, "rect");
|
|
2472
2490
|
return k(i, {
|
|
2473
2491
|
x: o + "",
|
|
2474
2492
|
y: s + "",
|
|
@@ -2481,8 +2499,8 @@ function Bo(e, t) {
|
|
|
2481
2499
|
"stroke-width": n.borderWidth
|
|
2482
2500
|
}), i;
|
|
2483
2501
|
}
|
|
2484
|
-
function
|
|
2485
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2502
|
+
function ee(e, t, n = !1) {
|
|
2503
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = A(e.nodes, t), l = document.createElementNS(_, "rect");
|
|
2486
2504
|
k(l, {
|
|
2487
2505
|
x: s + "",
|
|
2488
2506
|
y: i + "",
|
|
@@ -2497,10 +2515,10 @@ function Q(e, t, n = !1) {
|
|
|
2497
2515
|
const c = document.createElementNS(_, "g");
|
|
2498
2516
|
c.appendChild(l);
|
|
2499
2517
|
let r;
|
|
2500
|
-
return n ? r =
|
|
2518
|
+
return n ? r = Bo(t, o, s, i) : r = Ro(t, o, s, i), c.appendChild(r), c;
|
|
2501
2519
|
}
|
|
2502
|
-
function
|
|
2503
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2520
|
+
function Yo(e, t) {
|
|
2521
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(_, "a"), l = document.createElementNS(_, "text");
|
|
2504
2522
|
return k(l, {
|
|
2505
2523
|
x: o + "",
|
|
2506
2524
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2511,8 +2529,8 @@ function Wo(e, t) {
|
|
|
2511
2529
|
fill: `${n.color}`
|
|
2512
2530
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2513
2531
|
}
|
|
2514
|
-
function
|
|
2515
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2532
|
+
function Xo(e, t) {
|
|
2533
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(_, "image");
|
|
2516
2534
|
return k(i, {
|
|
2517
2535
|
x: o + "",
|
|
2518
2536
|
y: s + "",
|
|
@@ -2521,8 +2539,8 @@ function Yo(e, t) {
|
|
|
2521
2539
|
href: t.src
|
|
2522
2540
|
}), i;
|
|
2523
2541
|
}
|
|
2524
|
-
const
|
|
2525
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
2542
|
+
const te = 100, Fo = '<?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">', Ko = (e, t = !1) => {
|
|
2543
|
+
const n = e.nodes, o = n.offsetHeight + te * 2, s = n.offsetWidth + te * 2, i = Io(o + "px", s + "px"), l = document.createElementNS(_, "svg"), c = document.createElementNS(_, "rect");
|
|
2526
2544
|
k(c, {
|
|
2527
2545
|
x: "0",
|
|
2528
2546
|
y: "0",
|
|
@@ -2530,8 +2548,8 @@ const ee = 100, Xo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2530
2548
|
height: `${o}`,
|
|
2531
2549
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2532
2550
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((h) => {
|
|
2533
|
-
const u = h.cloneNode(!0), { offsetLeft:
|
|
2534
|
-
u.setAttribute("x", `${
|
|
2551
|
+
const u = h.cloneNode(!0), { offsetLeft: p, offsetTop: v } = A(n, h.parentElement);
|
|
2552
|
+
u.setAttribute("x", `${p}`), u.setAttribute("y", `${v}`), l.appendChild(u);
|
|
2535
2553
|
});
|
|
2536
2554
|
const r = n.querySelector(".lines")?.cloneNode(!0);
|
|
2537
2555
|
r && l.appendChild(r);
|
|
@@ -2539,22 +2557,22 @@ const ee = 100, Xo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2539
2557
|
a && l.appendChild(a);
|
|
2540
2558
|
const d = n.querySelector(".summary")?.cloneNode(!0);
|
|
2541
2559
|
return d && l.appendChild(d), n.querySelectorAll("me-tpc").forEach((h) => {
|
|
2542
|
-
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(
|
|
2560
|
+
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(ee(e, h, !t)) : (l.appendChild(Wo(e, h)), l.appendChild(ee(e, h.text, !t)));
|
|
2543
2561
|
}), n.querySelectorAll(".tags > span").forEach((h) => {
|
|
2544
|
-
l.appendChild(
|
|
2562
|
+
l.appendChild(ee(e, h));
|
|
2545
2563
|
}), n.querySelectorAll(".icons > span").forEach((h) => {
|
|
2546
|
-
l.appendChild(
|
|
2564
|
+
l.appendChild(ee(e, h));
|
|
2547
2565
|
}), n.querySelectorAll(".hyper-link").forEach((h) => {
|
|
2548
|
-
l.appendChild(Wo(e, h));
|
|
2549
|
-
}), n.querySelectorAll("img").forEach((h) => {
|
|
2550
2566
|
l.appendChild(Yo(e, h));
|
|
2567
|
+
}), n.querySelectorAll("img").forEach((h) => {
|
|
2568
|
+
l.appendChild(Xo(e, h));
|
|
2551
2569
|
}), k(l, {
|
|
2552
|
-
x:
|
|
2553
|
-
y:
|
|
2570
|
+
x: te + "",
|
|
2571
|
+
y: te + "",
|
|
2554
2572
|
overflow: "visible"
|
|
2555
2573
|
}), i.appendChild(l), i;
|
|
2556
|
-
},
|
|
2557
|
-
function
|
|
2574
|
+
}, Vo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Fo + e.outerHTML);
|
|
2575
|
+
function zo(e) {
|
|
2558
2576
|
return new Promise((t, n) => {
|
|
2559
2577
|
const o = new FileReader();
|
|
2560
2578
|
o.onload = (s) => {
|
|
@@ -2564,11 +2582,11 @@ function Vo(e) {
|
|
|
2564
2582
|
}, o.readAsDataURL(e);
|
|
2565
2583
|
});
|
|
2566
2584
|
}
|
|
2567
|
-
const
|
|
2568
|
-
const n =
|
|
2585
|
+
const Go = function(e = !1, t) {
|
|
2586
|
+
const n = Ko(this, e), o = Vo(n, t);
|
|
2569
2587
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2570
|
-
},
|
|
2571
|
-
const n = this.exportSvg(e, t), o = await
|
|
2588
|
+
}, qo = async function(e = !1, t) {
|
|
2589
|
+
const n = this.exportSvg(e, t), o = await zo(n);
|
|
2572
2590
|
return new Promise((s, i) => {
|
|
2573
2591
|
const l = new Image();
|
|
2574
2592
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
@@ -2576,43 +2594,43 @@ const zo = function(e = !1, t) {
|
|
|
2576
2594
|
c.width = l.width, c.height = l.height, c.getContext("2d").drawImage(l, 0, 0), c.toBlob(s, "image/png", 1);
|
|
2577
2595
|
}, l.src = o, l.onerror = i;
|
|
2578
2596
|
});
|
|
2579
|
-
},
|
|
2597
|
+
}, Uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2580
2598
|
__proto__: null,
|
|
2581
|
-
exportPng:
|
|
2582
|
-
exportSvg:
|
|
2599
|
+
exportPng: qo,
|
|
2600
|
+
exportSvg: Go
|
|
2583
2601
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2584
|
-
function
|
|
2602
|
+
function Jo(e, t) {
|
|
2585
2603
|
return async function(...n) {
|
|
2586
2604
|
const o = this.before[t];
|
|
2587
2605
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2588
2606
|
};
|
|
2589
2607
|
}
|
|
2590
|
-
const Ge = Object.keys(ot),
|
|
2608
|
+
const Ge = Object.keys(ot), mt = {};
|
|
2591
2609
|
for (let e = 0; e < Ge.length; e++) {
|
|
2592
2610
|
const t = Ge[e];
|
|
2593
|
-
|
|
2611
|
+
mt[t] = Jo(ot[t], t);
|
|
2594
2612
|
}
|
|
2595
|
-
const
|
|
2596
|
-
getObjById:
|
|
2597
|
-
generateNewObj:
|
|
2598
|
-
layout:
|
|
2599
|
-
linkDiv:
|
|
2600
|
-
editTopic:
|
|
2601
|
-
createWrapper:
|
|
2602
|
-
createParent:
|
|
2603
|
-
createChildren:
|
|
2613
|
+
const Zo = {
|
|
2614
|
+
getObjById: oe,
|
|
2615
|
+
generateNewObj: yt,
|
|
2616
|
+
layout: Tt,
|
|
2617
|
+
linkDiv: Rn,
|
|
2618
|
+
editTopic: Pt,
|
|
2619
|
+
createWrapper: Dt,
|
|
2620
|
+
createParent: Lt,
|
|
2621
|
+
createChildren: At,
|
|
2604
2622
|
createTopic: Mt,
|
|
2605
2623
|
findEle: Ze,
|
|
2606
|
-
changeTheme:
|
|
2607
|
-
changeCompact:
|
|
2608
|
-
...
|
|
2609
|
-
...
|
|
2610
|
-
...
|
|
2624
|
+
changeTheme: co,
|
|
2625
|
+
changeCompact: ao,
|
|
2626
|
+
...Nn,
|
|
2627
|
+
...mt,
|
|
2628
|
+
...So,
|
|
2611
2629
|
...Ho,
|
|
2612
|
-
...
|
|
2630
|
+
...Uo,
|
|
2613
2631
|
init(e) {
|
|
2614
2632
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2615
|
-
e.direction !== void 0 && (this.direction = e.direction), e.compact !== void 0 && (this.compact = e.compact), this.changeTheme(e.theme || this.theme, !1), e.meta && (this.meta = e.meta), this.nodeData = e.nodeData,
|
|
2633
|
+
e.direction !== void 0 && (this.direction = e.direction), e.compact !== void 0 && (this.compact = e.compact), this.changeTheme(e.theme || this.theme, !1), e.meta && (this.meta = e.meta), this.nodeData = e.nodeData, B(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && eo(this), this.keypress && $n(this, this.keypress), lo(this), this.disposable.push(Nt()), this.contextMenu && this.disposable.push(Wn(this, this.contextMenu)), this.allowUndo && this.disposable.push(Xn(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2616
2634
|
},
|
|
2617
2635
|
destroy() {
|
|
2618
2636
|
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;
|
|
@@ -2624,8 +2642,8 @@ const Jo = {
|
|
|
2624
2642
|
enableMobileMultiSelect(e) {
|
|
2625
2643
|
this.mobileMultiSelect = e;
|
|
2626
2644
|
}
|
|
2627
|
-
},
|
|
2628
|
-
function
|
|
2645
|
+
}, Qo = "5.14.0-beta.1";
|
|
2646
|
+
function es(e) {
|
|
2629
2647
|
return {
|
|
2630
2648
|
x: 0,
|
|
2631
2649
|
y: 0,
|
|
@@ -2666,29 +2684,29 @@ function P({
|
|
|
2666
2684
|
allowUndo: d,
|
|
2667
2685
|
generateMainBranch: h,
|
|
2668
2686
|
generateSubBranch: u,
|
|
2669
|
-
overflowHidden:
|
|
2687
|
+
overflowHidden: p,
|
|
2670
2688
|
compact: v,
|
|
2671
|
-
theme:
|
|
2672
|
-
alignment:
|
|
2673
|
-
scaleSensitivity:
|
|
2674
|
-
scaleMax:
|
|
2689
|
+
theme: m,
|
|
2690
|
+
alignment: y,
|
|
2691
|
+
scaleSensitivity: g,
|
|
2692
|
+
scaleMax: x,
|
|
2675
2693
|
scaleMin: E,
|
|
2676
2694
|
handleWheel: N,
|
|
2677
2695
|
markdown: f,
|
|
2678
|
-
imageProxy:
|
|
2679
|
-
pasteHandler:
|
|
2696
|
+
imageProxy: b,
|
|
2697
|
+
pasteHandler: w,
|
|
2680
2698
|
mobileMultiSelect: S
|
|
2681
2699
|
}) {
|
|
2682
2700
|
let C = null;
|
|
2683
2701
|
const T = Object.prototype.toString.call(e);
|
|
2684
2702
|
if (T === "[object HTMLDivElement]" ? C = e : T === "[object String]" && (C = document.querySelector(e)), !C) throw new Error("MindElixir: el is not a valid element");
|
|
2685
|
-
C.style.position = "relative", C.innerHTML = "", this.el = C, 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 =
|
|
2703
|
+
C.style.position = "relative", C.innerHTML = "", this.el = C, 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 = x ?? 1.4, this.scaleMin = E ?? 0.2, this.generateMainBranch = h || at, this.generateSubBranch = u || dt, this.overflowHidden = p ?? !1, this.compact = v ?? !1, this.alignment = y ?? "root", this.handleWheel = N ?? !0, this.markdown = f || void 0, this.imageProxy = b || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = S ?? !1, this.panHelper = es(this), this.bus = In(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
2686
2704
|
const D = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2687
|
-
this.theme =
|
|
2705
|
+
this.theme = m || (D.matches ? ge : pe);
|
|
2688
2706
|
const L = document.createElement("div");
|
|
2689
|
-
L.className = "map-canvas", this.map = L, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines =
|
|
2707
|
+
L.className = "map-canvas", this.map = L, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = q("lines"), this.summarySvg = q("summary"), this.linkController = q("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 = q("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(Hn(this)), w && (this.pasteHandler = w);
|
|
2690
2708
|
}
|
|
2691
|
-
P.prototype =
|
|
2709
|
+
P.prototype = Zo;
|
|
2692
2710
|
Object.defineProperty(P.prototype, "currentNode", {
|
|
2693
2711
|
get() {
|
|
2694
2712
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
@@ -2698,22 +2716,22 @@ Object.defineProperty(P.prototype, "currentNode", {
|
|
|
2698
2716
|
P.LEFT = 0;
|
|
2699
2717
|
P.RIGHT = 1;
|
|
2700
2718
|
P.SIDE = 2;
|
|
2701
|
-
P.THEME =
|
|
2702
|
-
P.DARK_THEME =
|
|
2703
|
-
P.version =
|
|
2719
|
+
P.THEME = pe;
|
|
2720
|
+
P.DARK_THEME = ge;
|
|
2721
|
+
P.version = Qo;
|
|
2704
2722
|
P.E = Ze;
|
|
2705
2723
|
P.new = (e) => ({
|
|
2706
2724
|
nodeData: {
|
|
2707
|
-
id:
|
|
2725
|
+
id: W(),
|
|
2708
2726
|
topic: e || "new topic",
|
|
2709
2727
|
children: []
|
|
2710
2728
|
}
|
|
2711
2729
|
});
|
|
2712
2730
|
export {
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2731
|
+
ge as DARK_THEME,
|
|
2732
|
+
ts as LEFT,
|
|
2733
|
+
ns as RIGHT,
|
|
2734
|
+
os as SIDE,
|
|
2735
|
+
pe as THEME,
|
|
2718
2736
|
P as default
|
|
2719
2737
|
};
|