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