mind-elixir 5.0.4 → 5.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +691 -669
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +392 -382
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interact.d.ts +1 -1
- package/dist/types/methods.d.ts +1 -1
- package/dist/types/utils/svg.d.ts +9 -0
- package/package.json +8 -2
- package/readme.md +12 -40
package/dist/MindElixir.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var at = Object.defineProperty;
|
|
2
2
|
var dt = (e, t, n) => t in e ? at(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
4
|
-
const
|
|
3
|
+
var V = (e, t, n) => (dt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
+
const me = {
|
|
5
5
|
name: "Latte",
|
|
6
6
|
type: "light",
|
|
7
7
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -26,7 +26,7 @@ const ge = {
|
|
|
26
26
|
"--panel-border-color": "#eaeaea",
|
|
27
27
|
"--map-padding": "50px"
|
|
28
28
|
}
|
|
29
|
-
},
|
|
29
|
+
}, ve = {
|
|
30
30
|
name: "Dark",
|
|
31
31
|
type: "dark",
|
|
32
32
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -67,26 +67,26 @@ const oe = function(e, t) {
|
|
|
67
67
|
return null;
|
|
68
68
|
} else
|
|
69
69
|
return null;
|
|
70
|
-
},
|
|
70
|
+
}, j = (e, t) => {
|
|
71
71
|
if (e.parent = t, e.children)
|
|
72
72
|
for (let n = 0; n < e.children.length; n++)
|
|
73
|
-
|
|
74
|
-
},
|
|
73
|
+
j(e.children[n], e);
|
|
74
|
+
}, q = (e, t, n) => {
|
|
75
75
|
if (e.expanded = t, e.children)
|
|
76
76
|
if (n === void 0 || n > 0) {
|
|
77
77
|
const o = n !== void 0 ? n - 1 : void 0;
|
|
78
78
|
e.children.forEach((i) => {
|
|
79
|
-
|
|
79
|
+
q(i, t, o);
|
|
80
80
|
});
|
|
81
81
|
} else
|
|
82
82
|
e.children.forEach((o) => {
|
|
83
|
-
|
|
83
|
+
q(o, !1);
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
function
|
|
86
|
+
function be(e) {
|
|
87
87
|
if (e.id = K(), e.children)
|
|
88
88
|
for (let t = 0; t < e.children.length; t++)
|
|
89
|
-
|
|
89
|
+
be(e.children[t]);
|
|
90
90
|
}
|
|
91
91
|
function ie(e, t, n, o) {
|
|
92
92
|
const i = o - t, s = e - n;
|
|
@@ -94,12 +94,12 @@ function ie(e, t, n, o) {
|
|
|
94
94
|
if (isNaN(r))
|
|
95
95
|
return;
|
|
96
96
|
s < 0 && i > 0 && (r = 180 - r), s < 0 && i < 0 && (r = 180 + r), s > 0 && i < 0 && (r = 360 - r);
|
|
97
|
-
const
|
|
97
|
+
const c = 12, l = 30, d = r + l, f = r - l;
|
|
98
98
|
return {
|
|
99
|
-
x1: n + Math.cos(Math.PI *
|
|
100
|
-
y1: o - Math.sin(Math.PI *
|
|
101
|
-
x2: n + Math.cos(Math.PI * f / 180) *
|
|
102
|
-
y2: o - Math.sin(Math.PI * f / 180) *
|
|
99
|
+
x1: n + Math.cos(Math.PI * d / 180) * c,
|
|
100
|
+
y1: o - Math.sin(Math.PI * d / 180) * c,
|
|
101
|
+
x2: n + Math.cos(Math.PI * f / 180) * c,
|
|
102
|
+
y2: o - Math.sin(Math.PI * f / 180) * c
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
function K() {
|
|
@@ -112,7 +112,7 @@ const ht = function() {
|
|
|
112
112
|
id: e
|
|
113
113
|
};
|
|
114
114
|
};
|
|
115
|
-
function
|
|
115
|
+
function ye(e) {
|
|
116
116
|
return JSON.parse(
|
|
117
117
|
JSON.stringify(e, (n, o) => {
|
|
118
118
|
if (n !== "parent")
|
|
@@ -125,10 +125,10 @@ const H = (e, t) => {
|
|
|
125
125
|
for (; t && t !== e; )
|
|
126
126
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
127
127
|
return { offsetLeft: n, offsetTop: o };
|
|
128
|
-
},
|
|
128
|
+
}, N = (e, t) => {
|
|
129
129
|
for (const n in t)
|
|
130
130
|
e.setAttribute(n, t[n]);
|
|
131
|
-
}, he = (e) => e ? e.tagName === "ME-TPC" : !1,
|
|
131
|
+
}, he = (e) => e ? e.tagName === "ME-TPC" : !1, le = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
132
132
|
for (let i = 0; i < o.length; i++) {
|
|
133
133
|
if (t === o[i])
|
|
134
134
|
continue;
|
|
@@ -140,7 +140,7 @@ const H = (e, t) => {
|
|
|
140
140
|
}), Ge = (e) => {
|
|
141
141
|
const t = /translate\(([^,]+),\s*([^)]+)\)/, n = e.match(t);
|
|
142
142
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
143
|
-
},
|
|
143
|
+
}, we = function(e) {
|
|
144
144
|
for (let t = 0; t < e.length; t++) {
|
|
145
145
|
const { dom: n, evt: o, func: i } = e[t];
|
|
146
146
|
n.addEventListener(o, i);
|
|
@@ -173,14 +173,14 @@ const ut = (e) => {
|
|
|
173
173
|
const o = n.firstChild.firstChild.firstChild;
|
|
174
174
|
e.selectNode(o);
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, Te = function(e, t) {
|
|
177
177
|
var s, r;
|
|
178
178
|
const n = e.currentNode || ((s = e.currentNodes) == null ? void 0 : s[0]);
|
|
179
179
|
if (!n)
|
|
180
180
|
return;
|
|
181
181
|
const o = n.nodeObj, i = n.offsetParent.offsetParent.parentElement;
|
|
182
182
|
o.parent ? i.className === t ? mt(e, n) : (r = o.parent) != null && r.parent ? gt(e, n) : pt(e) : t === M.LHS ? ut(e) : ft(e);
|
|
183
|
-
},
|
|
183
|
+
}, Le = function(e, t) {
|
|
184
184
|
const n = e.currentNode;
|
|
185
185
|
if (!n || !n.nodeObj.parent)
|
|
186
186
|
return;
|
|
@@ -202,21 +202,21 @@ function vt(e, t) {
|
|
|
202
202
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
203
203
|
};
|
|
204
204
|
let o = !1, i = null;
|
|
205
|
-
const s = (
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
for (const
|
|
209
|
-
|
|
210
|
-
if (
|
|
211
|
-
for (const
|
|
212
|
-
|
|
213
|
-
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(
|
|
214
|
-
for (const
|
|
215
|
-
|
|
205
|
+
const s = (c) => {
|
|
206
|
+
const l = e.nodeData;
|
|
207
|
+
if (c.key === "0")
|
|
208
|
+
for (const d of l.children)
|
|
209
|
+
q(d, !1);
|
|
210
|
+
if (c.key === "=")
|
|
211
|
+
for (const d of l.children)
|
|
212
|
+
q(d, !0);
|
|
213
|
+
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(c.key))
|
|
214
|
+
for (const d of l.children)
|
|
215
|
+
q(d, !0, Number(c.key) - 1);
|
|
216
216
|
e.refresh(), e.toCenter(), o = !1, i && (clearTimeout(i), i = null, e.container.removeEventListener("keydown", s));
|
|
217
217
|
}, r = {
|
|
218
|
-
Enter: (
|
|
219
|
-
|
|
218
|
+
Enter: (c) => {
|
|
219
|
+
c.shiftKey ? e.insertSibling("before") : c.ctrlKey || c.metaKey ? e.insertParent() : e.insertSibling("after");
|
|
220
220
|
},
|
|
221
221
|
Tab: () => {
|
|
222
222
|
e.addChild();
|
|
@@ -227,56 +227,56 @@ function vt(e, t) {
|
|
|
227
227
|
F2: () => {
|
|
228
228
|
e.beginEdit();
|
|
229
229
|
},
|
|
230
|
-
ArrowUp: (
|
|
231
|
-
if (
|
|
230
|
+
ArrowUp: (c) => {
|
|
231
|
+
if (c.altKey)
|
|
232
232
|
e.moveUpNode();
|
|
233
233
|
else {
|
|
234
|
-
if (
|
|
234
|
+
if (c.metaKey || c.ctrlKey)
|
|
235
235
|
return e.initSide();
|
|
236
|
-
|
|
236
|
+
Le(e, "previous");
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
|
-
ArrowDown: (
|
|
240
|
-
|
|
239
|
+
ArrowDown: (c) => {
|
|
240
|
+
c.altKey ? e.moveDownNode() : Le(e, "next");
|
|
241
241
|
},
|
|
242
|
-
ArrowLeft: (
|
|
243
|
-
if (
|
|
242
|
+
ArrowLeft: (c) => {
|
|
243
|
+
if (c.metaKey || c.ctrlKey)
|
|
244
244
|
return e.initLeft();
|
|
245
|
-
|
|
245
|
+
Te(e, M.LHS);
|
|
246
246
|
},
|
|
247
|
-
ArrowRight: (
|
|
248
|
-
if (
|
|
247
|
+
ArrowRight: (c) => {
|
|
248
|
+
if (c.metaKey || c.ctrlKey)
|
|
249
249
|
return e.initRight();
|
|
250
|
-
|
|
250
|
+
Te(e, M.RHS);
|
|
251
251
|
},
|
|
252
252
|
PageUp: () => e.moveUpNode(),
|
|
253
253
|
PageDown: () => {
|
|
254
254
|
e.moveDownNode();
|
|
255
255
|
},
|
|
256
|
-
c: (
|
|
257
|
-
(
|
|
256
|
+
c: (c) => {
|
|
257
|
+
(c.metaKey || c.ctrlKey) && (e.waitCopy = e.currentNodes);
|
|
258
258
|
},
|
|
259
|
-
x: (
|
|
260
|
-
(
|
|
259
|
+
x: (c) => {
|
|
260
|
+
(c.metaKey || c.ctrlKey) && (e.waitCopy = e.currentNodes, n());
|
|
261
261
|
},
|
|
262
|
-
v: (
|
|
263
|
-
!e.waitCopy || !e.currentNode || (
|
|
262
|
+
v: (c) => {
|
|
263
|
+
!e.waitCopy || !e.currentNode || (c.metaKey || c.ctrlKey) && (e.waitCopy.length === 1 ? e.copyNode(e.waitCopy[0], e.currentNode) : e.copyNodes(e.waitCopy, e.currentNode));
|
|
264
264
|
},
|
|
265
|
-
"=": (
|
|
266
|
-
(
|
|
265
|
+
"=": (c) => {
|
|
266
|
+
(c.metaKey || c.ctrlKey) && se(e, "in");
|
|
267
267
|
},
|
|
268
|
-
"-": (
|
|
269
|
-
(
|
|
268
|
+
"-": (c) => {
|
|
269
|
+
(c.metaKey || c.ctrlKey) && se(e, "out");
|
|
270
270
|
},
|
|
271
|
-
0: (
|
|
272
|
-
if (
|
|
271
|
+
0: (c) => {
|
|
272
|
+
if (c.metaKey || c.ctrlKey) {
|
|
273
273
|
if (o)
|
|
274
274
|
return;
|
|
275
275
|
e.scale(1);
|
|
276
276
|
}
|
|
277
277
|
},
|
|
278
|
-
k: (
|
|
279
|
-
(
|
|
278
|
+
k: (c) => {
|
|
279
|
+
(c.metaKey || c.ctrlKey) && (o = !0, i && (clearTimeout(i), e.container.removeEventListener("keydown", s)), i = window.setTimeout(() => {
|
|
280
280
|
o = !1, i = null;
|
|
281
281
|
}, 2e3), e.container.addEventListener("keydown", s));
|
|
282
282
|
},
|
|
@@ -284,17 +284,17 @@ function vt(e, t) {
|
|
|
284
284
|
Backspace: n,
|
|
285
285
|
...t
|
|
286
286
|
};
|
|
287
|
-
e.container.onkeydown = (
|
|
288
|
-
if (
|
|
287
|
+
e.container.onkeydown = (c) => {
|
|
288
|
+
if (c.preventDefault(), !e.editable)
|
|
289
289
|
return;
|
|
290
|
-
const
|
|
291
|
-
|
|
290
|
+
const l = r[c.key];
|
|
291
|
+
l && l(c);
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
function bt(e) {
|
|
295
|
-
const { dragMoveHelper: t } = e, n = (
|
|
295
|
+
const { dragMoveHelper: t } = e, n = (u) => {
|
|
296
296
|
var m, v, b;
|
|
297
|
-
if (
|
|
297
|
+
if (u.button !== 0)
|
|
298
298
|
return;
|
|
299
299
|
if ((m = e.helper1) != null && m.moved) {
|
|
300
300
|
e.helper1.clear();
|
|
@@ -308,69 +308,69 @@ function bt(e) {
|
|
|
308
308
|
t.clear();
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
const
|
|
312
|
-
if (
|
|
313
|
-
|
|
314
|
-
else if (
|
|
315
|
-
e.selectNode(
|
|
311
|
+
const a = u.target;
|
|
312
|
+
if (a.tagName === "ME-EPD")
|
|
313
|
+
u.ctrlKey || u.metaKey ? e.expandNodeAll(a.previousSibling) : e.expandNode(a.previousSibling);
|
|
314
|
+
else if (a.tagName === "ME-TPC" && e.currentNodes.length > 1)
|
|
315
|
+
e.selectNode(a);
|
|
316
316
|
else if (!e.editable)
|
|
317
317
|
return;
|
|
318
|
-
const p = (b =
|
|
319
|
-
p.getAttribute("class") === "topiclinks" ? e.selectArrow(
|
|
320
|
-
}, o = (
|
|
318
|
+
const p = (b = a.parentElement) == null ? void 0 : b.parentElement;
|
|
319
|
+
p.getAttribute("class") === "topiclinks" ? e.selectArrow(a.parentElement) : p.getAttribute("class") === "summary" && e.selectSummary(a.parentElement);
|
|
320
|
+
}, o = (u) => {
|
|
321
321
|
var m;
|
|
322
322
|
if (!e.editable)
|
|
323
323
|
return;
|
|
324
|
-
const
|
|
325
|
-
he(
|
|
326
|
-
const p = (m =
|
|
327
|
-
p.getAttribute("class") === "topiclinks" ? e.editArrowLabel(
|
|
324
|
+
const a = u.target;
|
|
325
|
+
he(a) && e.beginEdit(a);
|
|
326
|
+
const p = (m = a.parentElement) == null ? void 0 : m.parentElement;
|
|
327
|
+
p.getAttribute("class") === "topiclinks" ? e.editArrowLabel(a.parentElement) : p.getAttribute("class") === "summary" && e.editSummary(a.parentElement);
|
|
328
328
|
};
|
|
329
329
|
let i = 0;
|
|
330
|
-
const s = (
|
|
331
|
-
if (
|
|
330
|
+
const s = (u) => {
|
|
331
|
+
if (u.pointerType === "mouse")
|
|
332
332
|
return;
|
|
333
|
-
const
|
|
334
|
-
p < 300 && p > 0 && o(
|
|
335
|
-
}, r = (
|
|
333
|
+
const a = (/* @__PURE__ */ new Date()).getTime(), p = a - i;
|
|
334
|
+
p < 300 && p > 0 && o(u), i = a;
|
|
335
|
+
}, r = (u) => {
|
|
336
336
|
t.moved = !1;
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
337
|
+
const a = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
338
|
+
if (u.button !== a && u.pointerType === "mouse")
|
|
339
339
|
return;
|
|
340
|
-
t.x =
|
|
341
|
-
const p =
|
|
342
|
-
p.className !== "circle" && p.contentEditable !== "plaintext-only" && (t.mousedown = !0,
|
|
343
|
-
},
|
|
344
|
-
if (
|
|
345
|
-
const
|
|
346
|
-
t.onMove(
|
|
340
|
+
t.x = u.clientX, t.y = u.clientY;
|
|
341
|
+
const p = u.target;
|
|
342
|
+
p.className !== "circle" && p.contentEditable !== "plaintext-only" && (t.mousedown = !0, p.setPointerCapture(u.pointerId));
|
|
343
|
+
}, c = (u) => {
|
|
344
|
+
if (u.target.contentEditable !== "plaintext-only") {
|
|
345
|
+
const a = u.clientX - t.x, p = u.clientY - t.y;
|
|
346
|
+
t.onMove(a, p);
|
|
347
347
|
}
|
|
348
|
-
t.x =
|
|
349
|
-
},
|
|
350
|
-
const
|
|
351
|
-
if (
|
|
348
|
+
t.x = u.clientX, t.y = u.clientY;
|
|
349
|
+
}, l = (u) => {
|
|
350
|
+
const a = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
351
|
+
if (u.button !== a && u.pointerType === "mouse")
|
|
352
352
|
return;
|
|
353
|
-
const p =
|
|
354
|
-
p.hasPointerCapture && p.hasPointerCapture(
|
|
355
|
-
},
|
|
356
|
-
if (
|
|
353
|
+
const p = u.target;
|
|
354
|
+
p.hasPointerCapture && p.hasPointerCapture(u.pointerId) && p.releasePointerCapture(u.pointerId), t.clear();
|
|
355
|
+
}, d = (u) => {
|
|
356
|
+
if (u.preventDefault(), u.button !== 2 || !e.editable)
|
|
357
357
|
return;
|
|
358
|
-
const
|
|
359
|
-
he(
|
|
360
|
-
e.dragMoveHelper.moved || e.bus.fire("showContextMenu",
|
|
358
|
+
const a = u.target;
|
|
359
|
+
he(a) && !a.classList.contains("selected") && e.selectNode(a), setTimeout(() => {
|
|
360
|
+
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", u);
|
|
361
361
|
}, 200);
|
|
362
|
-
}, f = (
|
|
363
|
-
|
|
364
|
-
}, { container:
|
|
365
|
-
return
|
|
366
|
-
{ dom:
|
|
367
|
-
{ dom:
|
|
368
|
-
{ dom:
|
|
369
|
-
{ dom:
|
|
370
|
-
{ dom:
|
|
371
|
-
{ dom:
|
|
372
|
-
{ dom:
|
|
373
|
-
{ dom:
|
|
362
|
+
}, f = (u) => {
|
|
363
|
+
u.stopPropagation(), u.preventDefault(), u.ctrlKey || u.metaKey ? u.deltaY < 0 ? se(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && se(e, "out", e.dragMoveHelper) : u.shiftKey ? e.move(-u.deltaY, 0) : e.move(-u.deltaX, -u.deltaY);
|
|
364
|
+
}, { container: h } = e;
|
|
365
|
+
return we([
|
|
366
|
+
{ dom: h, evt: "pointerdown", func: r },
|
|
367
|
+
{ dom: h, evt: "pointermove", func: c },
|
|
368
|
+
{ dom: h, evt: "pointerup", func: l },
|
|
369
|
+
{ dom: h, evt: "pointerup", func: s },
|
|
370
|
+
{ dom: h, evt: "click", func: n },
|
|
371
|
+
{ dom: h, evt: "dblclick", func: o },
|
|
372
|
+
{ dom: h, evt: "contextmenu", func: d },
|
|
373
|
+
{ dom: h, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : f }
|
|
374
374
|
]);
|
|
375
375
|
}
|
|
376
376
|
function yt() {
|
|
@@ -401,7 +401,7 @@ function yt() {
|
|
|
401
401
|
const re = document, wt = function() {
|
|
402
402
|
this.nodes.innerHTML = "";
|
|
403
403
|
const e = this.createTopic(this.nodeData);
|
|
404
|
-
|
|
404
|
+
xe(e, this.nodeData), e.draggable = !1;
|
|
405
405
|
const t = re.createElement("me-root");
|
|
406
406
|
t.appendChild(e);
|
|
407
407
|
const n = this.nodeData.children || [];
|
|
@@ -418,8 +418,8 @@ const re = document, wt = function() {
|
|
|
418
418
|
const i = re.createElement("me-main");
|
|
419
419
|
i.className = M.RHS;
|
|
420
420
|
for (let s = 0; s < t.length; s++) {
|
|
421
|
-
const r = t[s], { grp:
|
|
422
|
-
e.direction === 2 ? r.direction === 0 ? o.appendChild(
|
|
421
|
+
const r = t[s], { grp: c } = e.createWrapper(r);
|
|
422
|
+
e.direction === 2 ? r.direction === 0 ? o.appendChild(c) : i.appendChild(c) : e.direction === 0 ? o.appendChild(c) : i.appendChild(c);
|
|
423
423
|
}
|
|
424
424
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(i), e.nodes.appendChild(e.lines);
|
|
425
425
|
}, Et = function(e, t) {
|
|
@@ -429,12 +429,12 @@ const re = document, wt = function() {
|
|
|
429
429
|
n.appendChild(s);
|
|
430
430
|
}
|
|
431
431
|
return n;
|
|
432
|
-
},
|
|
432
|
+
}, T = document, qe = function(e, t) {
|
|
433
433
|
const o = (this != null && this.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
434
434
|
if (!o)
|
|
435
435
|
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
436
436
|
return o;
|
|
437
|
-
},
|
|
437
|
+
}, xe = function(e, t) {
|
|
438
438
|
if (e.innerHTML = "", t.style) {
|
|
439
439
|
const n = t.style;
|
|
440
440
|
for (const o in n)
|
|
@@ -447,34 +447,34 @@ const re = document, wt = function() {
|
|
|
447
447
|
if (t.image) {
|
|
448
448
|
const n = t.image;
|
|
449
449
|
if (n.url && n.width && n.height) {
|
|
450
|
-
const o =
|
|
450
|
+
const o = T.createElement("img");
|
|
451
451
|
o.src = n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
|
|
452
452
|
}
|
|
453
453
|
} else
|
|
454
454
|
e.image && (e.image = void 0);
|
|
455
455
|
{
|
|
456
|
-
const n =
|
|
456
|
+
const n = T.createElement("span");
|
|
457
457
|
n.className = "text", n.textContent = t.topic, e.appendChild(n), e.text = n;
|
|
458
458
|
}
|
|
459
459
|
if (t.hyperLink) {
|
|
460
|
-
const n =
|
|
460
|
+
const n = T.createElement("a");
|
|
461
461
|
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
|
|
462
462
|
} else
|
|
463
463
|
e.link && (e.link = void 0);
|
|
464
464
|
if (t.icons && t.icons.length) {
|
|
465
|
-
const n =
|
|
465
|
+
const n = T.createElement("span");
|
|
466
466
|
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${ne(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
467
467
|
} else
|
|
468
468
|
e.icons && (e.icons = void 0);
|
|
469
469
|
if (t.tags && t.tags.length) {
|
|
470
|
-
const n =
|
|
470
|
+
const n = T.createElement("div");
|
|
471
471
|
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${ne(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
|
|
472
472
|
} else
|
|
473
473
|
e.tags && (e.tags = void 0);
|
|
474
474
|
}, Ct = function(e, t) {
|
|
475
|
-
const n =
|
|
475
|
+
const n = T.createElement("me-wrapper"), { p: o, tpc: i } = this.createParent(e);
|
|
476
476
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
477
|
-
const s =
|
|
477
|
+
const s = Ee(e.expanded);
|
|
478
478
|
if (o.appendChild(s), e.expanded !== !1) {
|
|
479
479
|
const r = Et(this, e.children);
|
|
480
480
|
n.appendChild(r);
|
|
@@ -482,17 +482,17 @@ const re = document, wt = function() {
|
|
|
482
482
|
}
|
|
483
483
|
return { grp: n, top: o, tpc: i };
|
|
484
484
|
}, St = function(e) {
|
|
485
|
-
const t =
|
|
486
|
-
return
|
|
485
|
+
const t = T.createElement("me-parent"), n = this.createTopic(e);
|
|
486
|
+
return xe(n, e), t.appendChild(n), { p: t, tpc: n };
|
|
487
487
|
}, Nt = function(e) {
|
|
488
|
-
const t =
|
|
488
|
+
const t = T.createElement("me-children");
|
|
489
489
|
return t.append(...e), t;
|
|
490
490
|
}, kt = function(e) {
|
|
491
|
-
const t =
|
|
491
|
+
const t = T.createElement("me-tpc");
|
|
492
492
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
493
493
|
};
|
|
494
|
-
function
|
|
495
|
-
const t =
|
|
494
|
+
function ze(e) {
|
|
495
|
+
const t = T.createRange();
|
|
496
496
|
t.selectNodeContents(e);
|
|
497
497
|
const n = window.getSelection();
|
|
498
498
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
@@ -500,7 +500,7 @@ function qe(e) {
|
|
|
500
500
|
const _t = function(e) {
|
|
501
501
|
if (!e)
|
|
502
502
|
return;
|
|
503
|
-
const t =
|
|
503
|
+
const t = T.createElement("div"), n = e.text.textContent;
|
|
504
504
|
e.appendChild(t), t.id = "input-box", t.textContent = n, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
505
505
|
const o = getComputedStyle(e);
|
|
506
506
|
t.style.cssText = `min-width:${e.offsetWidth - 8}px;
|
|
@@ -509,7 +509,7 @@ const _t = function(e) {
|
|
|
509
509
|
margin:${o.margin};
|
|
510
510
|
font:${o.font};
|
|
511
511
|
background-color:${o.backgroundColor !== "rgba(0, 0, 0, 0)" && o.backgroundColor};
|
|
512
|
-
border-radius:${o.borderRadius};`, this.direction === 0 && (t.style.right = "0"),
|
|
512
|
+
border-radius:${o.borderRadius};`, this.direction === 0 && (t.style.right = "0"), ze(t), this.bus.fire("operation", {
|
|
513
513
|
name: "beginEdit",
|
|
514
514
|
obj: e.nodeObj
|
|
515
515
|
}), t.addEventListener("keydown", (i) => {
|
|
@@ -531,25 +531,33 @@ const _t = function(e) {
|
|
|
531
531
|
origin: n
|
|
532
532
|
}));
|
|
533
533
|
});
|
|
534
|
-
},
|
|
535
|
-
const t =
|
|
534
|
+
}, Ee = function(e) {
|
|
535
|
+
const t = T.createElement("me-epd");
|
|
536
536
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
537
|
-
},
|
|
538
|
-
const o =
|
|
539
|
-
return
|
|
537
|
+
}, I = document, L = "http://www.w3.org/2000/svg", ue = function(e, t, n, o = {}) {
|
|
538
|
+
const { anchor: i = "middle", color: s, dataType: r } = o, c = document.createElementNS(L, "text");
|
|
539
|
+
return N(c, {
|
|
540
|
+
"text-anchor": i,
|
|
541
|
+
x: t + "",
|
|
542
|
+
y: n + "",
|
|
543
|
+
fill: s || (i === "middle" ? "rgb(235, 95, 82)" : "#666")
|
|
544
|
+
}), r && (c.dataset.type = r), c.innerHTML = e, c;
|
|
545
|
+
}, Ve = function(e, t, n) {
|
|
546
|
+
const o = I.createElementNS(L, "path");
|
|
547
|
+
return N(o, {
|
|
540
548
|
d: e,
|
|
541
549
|
stroke: t || "#666",
|
|
542
550
|
fill: "none",
|
|
543
551
|
"stroke-width": n
|
|
544
552
|
}), o;
|
|
545
553
|
}, X = function(e) {
|
|
546
|
-
const t =
|
|
554
|
+
const t = I.createElementNS(L, "svg");
|
|
547
555
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
548
|
-
},
|
|
549
|
-
const e =
|
|
556
|
+
}, Ae = function() {
|
|
557
|
+
const e = I.createElementNS(L, "line");
|
|
550
558
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
551
559
|
}, Tt = function(e, t, n, o) {
|
|
552
|
-
const i =
|
|
560
|
+
const i = I.createElementNS(L, "g");
|
|
553
561
|
return [
|
|
554
562
|
{
|
|
555
563
|
name: "line",
|
|
@@ -563,27 +571,27 @@ const _t = function(e) {
|
|
|
563
571
|
name: "arrow2",
|
|
564
572
|
d: n
|
|
565
573
|
}
|
|
566
|
-
].forEach((r,
|
|
567
|
-
const
|
|
568
|
-
d,
|
|
574
|
+
].forEach((r, c) => {
|
|
575
|
+
const l = r.d, d = I.createElementNS(L, "path"), f = {
|
|
576
|
+
d: l,
|
|
569
577
|
stroke: (o == null ? void 0 : o.stroke) || "rgb(235, 95, 82)",
|
|
570
578
|
fill: "none",
|
|
571
579
|
"stroke-linecap": (o == null ? void 0 : o.strokeLinecap) || "cap",
|
|
572
580
|
"stroke-width": String((o == null ? void 0 : o.strokeWidth) || "2")
|
|
573
581
|
};
|
|
574
|
-
(o == null ? void 0 : o.opacity) !== void 0 && (f.opacity = String(o.opacity)),
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
d,
|
|
582
|
+
(o == null ? void 0 : o.opacity) !== void 0 && (f.opacity = String(o.opacity)), N(d, f), c === 0 && d.setAttribute("stroke-dasharray", (o == null ? void 0 : o.strokeDasharray) || "8,2");
|
|
583
|
+
const h = I.createElementNS(L, "path");
|
|
584
|
+
N(h, {
|
|
585
|
+
d: l,
|
|
578
586
|
stroke: "transparent",
|
|
579
587
|
fill: "none",
|
|
580
588
|
"stroke-width": "15"
|
|
581
|
-
}), i.appendChild(
|
|
589
|
+
}), i.appendChild(h), i.appendChild(d), i[r.name] = d;
|
|
582
590
|
}), i;
|
|
583
591
|
}, Ue = function(e, t, n) {
|
|
584
592
|
if (!t)
|
|
585
593
|
return;
|
|
586
|
-
const o =
|
|
594
|
+
const o = I.createElement("div");
|
|
587
595
|
e.nodes.appendChild(o);
|
|
588
596
|
const i = t.innerHTML;
|
|
589
597
|
o.id = "input-box", o.textContent = i, o.contentEditable = "plaintext-only", o.spellcheck = !1;
|
|
@@ -595,19 +603,19 @@ const _t = function(e) {
|
|
|
595
603
|
top:${s.y}px;
|
|
596
604
|
padding: 2px 4px;
|
|
597
605
|
margin: -2px -4px;
|
|
598
|
-
`,
|
|
606
|
+
`, ze(o), e.scrollIntoView(o), o.addEventListener("keydown", (r) => {
|
|
599
607
|
r.stopPropagation();
|
|
600
|
-
const
|
|
601
|
-
if (
|
|
608
|
+
const c = r.key;
|
|
609
|
+
if (c === "Enter" || c === "Tab") {
|
|
602
610
|
if (r.shiftKey)
|
|
603
611
|
return;
|
|
604
612
|
r.preventDefault(), o.blur(), e.container.focus();
|
|
605
613
|
}
|
|
606
614
|
}), o.addEventListener("blur", () => {
|
|
607
|
-
var
|
|
615
|
+
var c;
|
|
608
616
|
if (!o)
|
|
609
617
|
return;
|
|
610
|
-
const r = ((
|
|
618
|
+
const r = ((c = o.textContent) == null ? void 0 : c.trim()) || "";
|
|
611
619
|
r === "" ? n.label = i : n.label = r, o.remove(), r !== i && (t.innerHTML = n.label, e.linkDiv(), "parent" in n ? e.bus.fire("operation", {
|
|
612
620
|
name: "finishEditSummary",
|
|
613
621
|
obj: n
|
|
@@ -619,31 +627,31 @@ const _t = function(e) {
|
|
|
619
627
|
}, Lt = function(e) {
|
|
620
628
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, i = t.offsetWidth, s = t.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
621
629
|
this.lines.innerHTML = "";
|
|
622
|
-
for (let
|
|
623
|
-
const
|
|
624
|
-
if (
|
|
630
|
+
for (let c = 0; c < r.length; c++) {
|
|
631
|
+
const l = r[c], d = l.querySelector("me-tpc"), { offsetLeft: f, offsetTop: h } = H(this.nodes, d), g = d.offsetWidth, u = d.offsetHeight, a = l.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: i, pH: s, cT: h, cL: f, cW: g, cH: u, direction: a, containerHeight: this.nodes.offsetHeight }), m = this.theme.palette, v = d.nodeObj.branchColor || m[c % m.length];
|
|
632
|
+
if (d.style.borderColor = v, this.lines.appendChild(Ve(p, v, "3")), e && e !== l)
|
|
625
633
|
continue;
|
|
626
|
-
const b = X("subLines"), x =
|
|
627
|
-
x.tagName === "svg" && x.remove(),
|
|
634
|
+
const b = X("subLines"), x = l.lastChild;
|
|
635
|
+
x.tagName === "svg" && x.remove(), l.appendChild(b), Xe(this, b, v, l, a, !0);
|
|
628
636
|
}
|
|
629
637
|
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
630
638
|
}, Xe = function(e, t, n, o, i, s) {
|
|
631
|
-
const r = o.firstChild,
|
|
632
|
-
if (
|
|
639
|
+
const r = o.firstChild, c = o.children[1].children;
|
|
640
|
+
if (c.length === 0)
|
|
633
641
|
return;
|
|
634
|
-
const
|
|
635
|
-
for (let g = 0; g <
|
|
636
|
-
const
|
|
637
|
-
t.appendChild(
|
|
638
|
-
const k =
|
|
642
|
+
const l = r.offsetTop, d = r.offsetLeft, f = r.offsetWidth, h = r.offsetHeight;
|
|
643
|
+
for (let g = 0; g < c.length; g++) {
|
|
644
|
+
const u = c[g], a = u.firstChild, p = a.offsetTop, m = a.offsetLeft, v = a.offsetWidth, b = a.offsetHeight, x = a.firstChild.nodeObj.branchColor || n, C = e.generateSubBranch({ pT: l, pL: d, pW: f, pH: h, cT: p, cL: m, cW: v, cH: b, direction: i, isFirst: s });
|
|
645
|
+
t.appendChild(Ve(C, x, "2"));
|
|
646
|
+
const k = a.children[1];
|
|
639
647
|
if (k) {
|
|
640
648
|
if (!k.expanded)
|
|
641
649
|
continue;
|
|
642
650
|
} else
|
|
643
651
|
continue;
|
|
644
|
-
Xe(e, t, x,
|
|
652
|
+
Xe(e, t, x, u, i);
|
|
645
653
|
}
|
|
646
|
-
},
|
|
654
|
+
}, Me = {
|
|
647
655
|
addChild: "插入子节点",
|
|
648
656
|
addParent: "插入父节点",
|
|
649
657
|
addSibling: "插入同级节点",
|
|
@@ -656,9 +664,9 @@ const _t = function(e) {
|
|
|
656
664
|
linkBidirectional: "双向连接",
|
|
657
665
|
clickTips: "请点击目标节点",
|
|
658
666
|
summary: "摘要"
|
|
659
|
-
},
|
|
660
|
-
cn:
|
|
661
|
-
zh_CN:
|
|
667
|
+
}, De = {
|
|
668
|
+
cn: Me,
|
|
669
|
+
zh_CN: Me,
|
|
662
670
|
zh_TW: {
|
|
663
671
|
addChild: "插入子節點",
|
|
664
672
|
addParent: "插入父節點",
|
|
@@ -795,44 +803,44 @@ function At(e, t) {
|
|
|
795
803
|
const w = document.createElement("div");
|
|
796
804
|
return w.innerText = y, w.className = "tips", w;
|
|
797
805
|
}, o = (y, w, E) => {
|
|
798
|
-
const
|
|
799
|
-
return
|
|
800
|
-
}, i =
|
|
801
|
-
if (v.className = "menu-list", v.appendChild(r), v.appendChild(
|
|
806
|
+
const S = document.createElement("li");
|
|
807
|
+
return S.id = y, S.innerHTML = `<span>${ne(w)}</span><span ${E ? 'class="key"' : ""}>${ne(E)}</span>`, S;
|
|
808
|
+
}, i = De[e.locale] ? e.locale : "en", s = De[i], r = o("cm-add_child", s.addChild, "Tab"), c = o("cm-add_parent", s.addParent, "Ctrl + Enter"), l = o("cm-add_sibling", s.addSibling, "Enter"), d = o("cm-remove_child", s.removeNode, "Delete"), f = o("cm-fucus", s.focus, ""), h = o("cm-unfucus", s.cancelFocus, ""), g = o("cm-up", s.moveUp, "PgUp"), u = o("cm-down", s.moveDown, "Pgdn"), a = o("cm-link", s.link, ""), p = o("cm-link-bidirectional", s.linkBidirectional, ""), m = o("cm-summary", s.summary, ""), v = document.createElement("ul");
|
|
809
|
+
if (v.className = "menu-list", v.appendChild(r), v.appendChild(c), v.appendChild(l), v.appendChild(d), t.focus && (v.appendChild(f), v.appendChild(h)), v.appendChild(g), v.appendChild(u), v.appendChild(m), t.link && (v.appendChild(a), v.appendChild(p)), t && t.extend)
|
|
802
810
|
for (let y = 0; y < t.extend.length; y++) {
|
|
803
811
|
const w = t.extend[y], E = o(w.name, w.name, w.key || "");
|
|
804
|
-
v.appendChild(E), E.onclick = (
|
|
805
|
-
w.onclick(
|
|
812
|
+
v.appendChild(E), E.onclick = (S) => {
|
|
813
|
+
w.onclick(S);
|
|
806
814
|
};
|
|
807
815
|
}
|
|
808
816
|
const b = document.createElement("div");
|
|
809
817
|
b.className = "context-menu", b.appendChild(v), b.hidden = !0, e.container.append(b);
|
|
810
818
|
let x = !0;
|
|
811
|
-
const
|
|
819
|
+
const C = (y) => {
|
|
812
820
|
const w = y.target;
|
|
813
821
|
if (he(w)) {
|
|
814
|
-
w.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (f.className = "disabled", g.className = "disabled",
|
|
815
|
-
const E = v.getBoundingClientRect(),
|
|
816
|
-
|
|
822
|
+
w.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (f.className = "disabled", g.className = "disabled", u.className = "disabled", c.className = "disabled", l.className = "disabled", d.className = "disabled") : (f.className = "", g.className = "", u.className = "", c.className = "", l.className = "", d.className = ""), b.hidden = !1, v.style.top = "", v.style.bottom = "", v.style.left = "", v.style.right = "";
|
|
823
|
+
const E = v.getBoundingClientRect(), S = v.offsetHeight, P = v.offsetWidth, B = y.clientY - E.top, R = y.clientX - E.left;
|
|
824
|
+
S + B > window.innerHeight ? (v.style.top = "", v.style.bottom = "0px") : (v.style.bottom = "", v.style.top = B + 15 + "px"), P + R > window.innerWidth ? (v.style.left = "", v.style.right = "0px") : (v.style.right = "", v.style.left = R + 10 + "px");
|
|
817
825
|
}
|
|
818
826
|
};
|
|
819
|
-
e.bus.addListener("showContextMenu",
|
|
827
|
+
e.bus.addListener("showContextMenu", C), b.onclick = (y) => {
|
|
820
828
|
y.target === b && (b.hidden = !0);
|
|
821
829
|
}, r.onclick = () => {
|
|
822
830
|
e.addChild(), b.hidden = !0;
|
|
823
|
-
},
|
|
831
|
+
}, c.onclick = () => {
|
|
824
832
|
e.insertParent(), b.hidden = !0;
|
|
825
|
-
},
|
|
833
|
+
}, l.onclick = () => {
|
|
826
834
|
x || (e.insertSibling("after"), b.hidden = !0);
|
|
827
|
-
},
|
|
835
|
+
}, d.onclick = () => {
|
|
828
836
|
x || (e.removeNodes(e.currentNodes || []), b.hidden = !0);
|
|
829
837
|
}, f.onclick = () => {
|
|
830
838
|
x || (e.focusNode(e.currentNode), b.hidden = !0);
|
|
831
|
-
},
|
|
839
|
+
}, h.onclick = () => {
|
|
832
840
|
e.cancelFocus(), b.hidden = !0;
|
|
833
841
|
}, g.onclick = () => {
|
|
834
842
|
x || (e.moveUpNode(), b.hidden = !0);
|
|
835
|
-
},
|
|
843
|
+
}, u.onclick = () => {
|
|
836
844
|
x || (e.moveDownNode(), b.hidden = !0);
|
|
837
845
|
};
|
|
838
846
|
const k = (y) => {
|
|
@@ -840,35 +848,35 @@ function At(e, t) {
|
|
|
840
848
|
const w = e.currentNode, E = n(s.clickTips);
|
|
841
849
|
e.container.appendChild(E), e.map.addEventListener(
|
|
842
850
|
"click",
|
|
843
|
-
(
|
|
844
|
-
|
|
845
|
-
const
|
|
846
|
-
(
|
|
851
|
+
(S) => {
|
|
852
|
+
S.preventDefault(), E.remove();
|
|
853
|
+
const P = S.target;
|
|
854
|
+
(P.parentElement.tagName === "ME-PARENT" || P.parentElement.tagName === "ME-ROOT") && e.createArrow(w, P, y);
|
|
847
855
|
},
|
|
848
856
|
{
|
|
849
857
|
once: !0
|
|
850
858
|
}
|
|
851
859
|
);
|
|
852
860
|
};
|
|
853
|
-
return
|
|
861
|
+
return a.onclick = () => k(), p.onclick = () => k({ bidirectional: !0 }), m.onclick = () => {
|
|
854
862
|
b.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
855
863
|
}, () => {
|
|
856
|
-
r.onclick = null,
|
|
864
|
+
r.onclick = null, c.onclick = null, l.onclick = null, d.onclick = null, f.onclick = null, h.onclick = null, g.onclick = null, u.onclick = null, a.onclick = null, m.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
|
|
857
865
|
};
|
|
858
866
|
}
|
|
859
|
-
const
|
|
867
|
+
const fe = document, Mt = function(e, t) {
|
|
860
868
|
if (!t)
|
|
861
|
-
return
|
|
869
|
+
return pe(e), e;
|
|
862
870
|
let n = e.querySelector(".insert-preview");
|
|
863
871
|
const o = `insert-preview ${t} show`;
|
|
864
|
-
return n || (n =
|
|
865
|
-
},
|
|
872
|
+
return n || (n = fe.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
873
|
+
}, pe = function(e) {
|
|
866
874
|
if (!e)
|
|
867
875
|
return;
|
|
868
876
|
const t = e.querySelectorAll(".insert-preview");
|
|
869
877
|
for (const n of t || [])
|
|
870
878
|
n.remove();
|
|
871
|
-
},
|
|
879
|
+
}, Pe = function(e, t) {
|
|
872
880
|
for (const n of t) {
|
|
873
881
|
const o = n.parentElement.parentElement.contains(e);
|
|
874
882
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent))
|
|
@@ -879,12 +887,12 @@ const ue = document, Mt = function(e, t) {
|
|
|
879
887
|
const t = document.createElement("div");
|
|
880
888
|
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
|
|
881
889
|
};
|
|
882
|
-
class
|
|
890
|
+
class Pt {
|
|
883
891
|
constructor(t) {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
892
|
+
V(this, "mind");
|
|
893
|
+
V(this, "isMoving", !1);
|
|
894
|
+
V(this, "interval", null);
|
|
895
|
+
V(this, "speed", 20);
|
|
888
896
|
this.mind = t;
|
|
889
897
|
}
|
|
890
898
|
move(t, n) {
|
|
@@ -896,59 +904,59 @@ class Ot {
|
|
|
896
904
|
this.isMoving = !1, clearInterval(this.interval);
|
|
897
905
|
}
|
|
898
906
|
}
|
|
899
|
-
function
|
|
907
|
+
function $t(e) {
|
|
900
908
|
let t = null, n = null;
|
|
901
|
-
const o = Dt(e), i = new
|
|
909
|
+
const o = Dt(e), i = new Pt(e), s = (d) => {
|
|
902
910
|
e.selection.cancel();
|
|
903
|
-
const f =
|
|
911
|
+
const f = d.target;
|
|
904
912
|
if ((f == null ? void 0 : f.tagName) !== "ME-TPC") {
|
|
905
|
-
|
|
913
|
+
d.preventDefault();
|
|
906
914
|
return;
|
|
907
915
|
}
|
|
908
|
-
let
|
|
909
|
-
|
|
910
|
-
for (const g of
|
|
916
|
+
let h = e.currentNodes;
|
|
917
|
+
h != null && h.includes(f) || (e.selectNode(f), h = e.currentNodes), e.dragged = h, h.length > 1 ? o.innerHTML = h.length + "" : o.innerHTML = f.innerHTML;
|
|
918
|
+
for (const g of h)
|
|
911
919
|
g.parentElement.parentElement.style.opacity = "0.5";
|
|
912
|
-
|
|
913
|
-
}, r = (
|
|
920
|
+
d.dataTransfer.setDragImage(o, 0, 0), d.dataTransfer.dropEffect = "move", e.dragMoveHelper.clear();
|
|
921
|
+
}, r = (d) => {
|
|
914
922
|
const { dragged: f } = e;
|
|
915
923
|
if (!f)
|
|
916
924
|
return;
|
|
917
925
|
i.stop();
|
|
918
926
|
for (const g of f)
|
|
919
927
|
g.parentElement.parentElement.style.opacity = "1";
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
},
|
|
923
|
-
|
|
924
|
-
const f = 12 * e.scaleVal, { dragged:
|
|
925
|
-
if (!
|
|
928
|
+
const h = d.target;
|
|
929
|
+
h.style.opacity = "", n && (pe(n), t === "before" ? e.moveNodeBefore(f, n) : t === "after" ? e.moveNodeAfter(f, n) : t === "in" && e.moveNodeIn(f, n), e.dragged = null, o.innerHTML = "");
|
|
930
|
+
}, c = (d) => {
|
|
931
|
+
d.preventDefault();
|
|
932
|
+
const f = 12 * e.scaleVal, { dragged: h } = e;
|
|
933
|
+
if (!h)
|
|
926
934
|
return;
|
|
927
935
|
const g = e.container.getBoundingClientRect();
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
if (
|
|
931
|
-
n =
|
|
932
|
-
const
|
|
933
|
-
|
|
936
|
+
d.clientX < g.x + 50 ? i.move(1, 0) : d.clientX > g.x + g.width - 50 ? i.move(-1, 0) : d.clientY < g.y + 50 ? i.move(0, 1) : d.clientY > g.y + g.height - 50 ? i.move(0, -1) : i.stop(), pe(n);
|
|
937
|
+
const u = fe.elementFromPoint(d.clientX, d.clientY - f);
|
|
938
|
+
if (Pe(u, h)) {
|
|
939
|
+
n = u;
|
|
940
|
+
const a = u.getBoundingClientRect(), p = a.y;
|
|
941
|
+
d.clientY > p + a.height ? t = "after" : t = "in";
|
|
934
942
|
} else {
|
|
935
|
-
const
|
|
936
|
-
if (
|
|
937
|
-
n =
|
|
943
|
+
const a = fe.elementFromPoint(d.clientX, d.clientY + f), p = a.getBoundingClientRect();
|
|
944
|
+
if (Pe(a, h)) {
|
|
945
|
+
n = a;
|
|
938
946
|
const m = p.y;
|
|
939
|
-
|
|
947
|
+
d.clientY < m ? t = "before" : t = "in";
|
|
940
948
|
} else
|
|
941
949
|
t = n = null;
|
|
942
950
|
}
|
|
943
951
|
n && Mt(n, t);
|
|
944
952
|
};
|
|
945
|
-
return
|
|
953
|
+
return we([
|
|
946
954
|
{ dom: e.map, evt: "dragstart", func: s },
|
|
947
955
|
{ dom: e.map, evt: "dragend", func: r },
|
|
948
|
-
{ dom: e.map, evt: "dragover", func:
|
|
956
|
+
{ dom: e.map, evt: "dragover", func: c }
|
|
949
957
|
]);
|
|
950
958
|
}
|
|
951
|
-
const
|
|
959
|
+
const Ot = function(e) {
|
|
952
960
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
953
961
|
type: "summary",
|
|
954
962
|
value: e.obj.id
|
|
@@ -959,18 +967,18 @@ const Pt = function(e) {
|
|
|
959
967
|
type: "nodes",
|
|
960
968
|
value: e.objs.map((t) => t.id)
|
|
961
969
|
} : {
|
|
962
|
-
type: "
|
|
963
|
-
value: e.obj.id
|
|
970
|
+
type: "nodes",
|
|
971
|
+
value: [e.obj.id]
|
|
964
972
|
};
|
|
965
973
|
};
|
|
966
|
-
function
|
|
967
|
-
let t = [], n = -1, o = e.getData();
|
|
974
|
+
function jt(e) {
|
|
975
|
+
let t = [], n = -1, o = e.getData(), i = [];
|
|
968
976
|
e.undo = function() {
|
|
969
977
|
if (n > -1) {
|
|
970
|
-
const
|
|
971
|
-
o =
|
|
978
|
+
const l = t[n];
|
|
979
|
+
o = l.prev, e.refresh(l.prev);
|
|
972
980
|
try {
|
|
973
|
-
|
|
981
|
+
l.currentTarget.type === "nodes" && (l.operation === "removeNodes" ? e.selectNodes(l.currentTarget.value.map((d) => this.findEle(d))) : e.selectNodes(l.currentSelected.map((d) => this.findEle(d))));
|
|
974
982
|
} catch {
|
|
975
983
|
} finally {
|
|
976
984
|
n--;
|
|
@@ -979,38 +987,50 @@ function $t(e) {
|
|
|
979
987
|
}, e.redo = function() {
|
|
980
988
|
if (n < t.length - 1) {
|
|
981
989
|
n++;
|
|
982
|
-
const
|
|
983
|
-
o =
|
|
990
|
+
const l = t[n];
|
|
991
|
+
o = l.next, e.refresh(l.next);
|
|
992
|
+
try {
|
|
993
|
+
l.currentTarget.type === "nodes" && (l.operation === "removeNodes" ? e.selectNodes(l.currentSelected.map((d) => this.findEle(d))) : e.selectNodes(l.currentTarget.value.map((d) => this.findEle(d))));
|
|
994
|
+
} catch {
|
|
995
|
+
}
|
|
984
996
|
}
|
|
985
997
|
};
|
|
986
|
-
const
|
|
987
|
-
if (
|
|
998
|
+
const s = function(l) {
|
|
999
|
+
if (l.name === "beginEdit")
|
|
988
1000
|
return;
|
|
989
1001
|
t = t.slice(0, n + 1);
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1002
|
+
const d = e.getData(), f = {
|
|
1003
|
+
prev: o,
|
|
1004
|
+
operation: l.name,
|
|
1005
|
+
currentSelected: i.map((h) => h.id),
|
|
1006
|
+
currentTarget: Ot(l),
|
|
1007
|
+
next: d
|
|
1008
|
+
};
|
|
1009
|
+
t.push(f), o = d, n = t.length - 1;
|
|
1010
|
+
}, r = function(l) {
|
|
1011
|
+
(l.metaKey || l.ctrlKey) && (l.shiftKey && l.key === "Z" || l.key === "y") ? e.redo() : (l.metaKey || l.ctrlKey) && l.key === "z" && e.undo();
|
|
1012
|
+
}, c = function(l) {
|
|
1013
|
+
i = e.currentNodes.map((d) => d.nodeObj);
|
|
994
1014
|
};
|
|
995
|
-
return e.bus.addListener("operation",
|
|
996
|
-
e.bus.removeListener("operation",
|
|
1015
|
+
return e.bus.addListener("operation", s), e.bus.addListener("selectNodes", c), e.container.addEventListener("keydown", r), () => {
|
|
1016
|
+
e.bus.removeListener("operation", s), e.bus.removeListener("selectNodes", c), e.container.removeEventListener("keydown", r);
|
|
997
1017
|
};
|
|
998
1018
|
}
|
|
999
|
-
const Ht = '<?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>', Bt = '<?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>', Rt = '<?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>', Ft = '<?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>',
|
|
1019
|
+
const Ht = '<?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>', Bt = '<?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>', Rt = '<?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>', Ft = '<?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>', Wt = '<?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>', It = '<?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>', Kt = '<?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>';
|
|
1000
1020
|
const Yt = {
|
|
1001
1021
|
side: Ht,
|
|
1002
1022
|
left: Bt,
|
|
1003
1023
|
right: Rt,
|
|
1004
1024
|
full: Ft,
|
|
1005
|
-
living:
|
|
1006
|
-
zoomin:
|
|
1025
|
+
living: Wt,
|
|
1026
|
+
zoomin: It,
|
|
1007
1027
|
zoomout: Kt
|
|
1008
|
-
},
|
|
1028
|
+
}, W = (e, t) => {
|
|
1009
1029
|
const n = document.createElement("span");
|
|
1010
1030
|
return n.id = e, n.innerHTML = Yt[t], n;
|
|
1011
1031
|
};
|
|
1012
1032
|
function Gt(e) {
|
|
1013
|
-
const t = document.createElement("div"), n =
|
|
1033
|
+
const t = document.createElement("div"), n = W("fullscreen", "full"), o = W("toCenter", "living"), i = W("zoomout", "zoomout"), s = W("zoomin", "zoomin"), r = document.createElement("span");
|
|
1014
1034
|
return r.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(i), t.appendChild(s), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
1015
1035
|
document.fullscreenElement === e.el ? document.exitFullscreen() : e.el.requestFullscreen();
|
|
1016
1036
|
}, o.onclick = () => {
|
|
@@ -1021,8 +1041,8 @@ function Gt(e) {
|
|
|
1021
1041
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1022
1042
|
}, t;
|
|
1023
1043
|
}
|
|
1024
|
-
function
|
|
1025
|
-
const t = document.createElement("div"), n =
|
|
1044
|
+
function qt(e) {
|
|
1045
|
+
const t = document.createElement("div"), n = W("tbltl", "left"), o = W("tbltr", "right"), i = W("tblts", "side");
|
|
1026
1046
|
return t.appendChild(n), t.appendChild(o), t.appendChild(i), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1027
1047
|
e.initLeft();
|
|
1028
1048
|
}, o.onclick = () => {
|
|
@@ -1031,11 +1051,11 @@ function Vt(e) {
|
|
|
1031
1051
|
e.initSide();
|
|
1032
1052
|
}, t;
|
|
1033
1053
|
}
|
|
1034
|
-
function
|
|
1035
|
-
e.container.append(Gt(e)), e.container.append(
|
|
1054
|
+
function zt(e) {
|
|
1055
|
+
e.container.append(Gt(e)), e.container.append(qt(e));
|
|
1036
1056
|
}
|
|
1037
1057
|
/*! @viselect/vanilla v3.9.0 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
|
|
1038
|
-
class
|
|
1058
|
+
class Vt {
|
|
1039
1059
|
constructor() {
|
|
1040
1060
|
this._listeners = /* @__PURE__ */ new Map(), this.on = this.addEventListener, this.off = this.removeEventListener, this.emit = this.dispatchEvent;
|
|
1041
1061
|
}
|
|
@@ -1057,13 +1077,13 @@ class zt {
|
|
|
1057
1077
|
this._listeners.clear();
|
|
1058
1078
|
}
|
|
1059
1079
|
}
|
|
1060
|
-
const
|
|
1080
|
+
const $e = (e, t = "px") => typeof e == "number" ? e + t : e, $ = ({ style: e }, t, n) => {
|
|
1061
1081
|
if (typeof t == "object")
|
|
1062
1082
|
for (const [o, i] of Object.entries(t))
|
|
1063
|
-
i !== void 0 && (e[o] =
|
|
1083
|
+
i !== void 0 && (e[o] = $e(i));
|
|
1064
1084
|
else
|
|
1065
|
-
n !== void 0 && (e[t] =
|
|
1066
|
-
},
|
|
1085
|
+
n !== void 0 && (e[t] = $e(n));
|
|
1086
|
+
}, Oe = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1067
1087
|
const i = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1068
1088
|
return { ...i, toJSON: () => JSON.stringify(i) };
|
|
1069
1089
|
}, Ut = (e) => {
|
|
@@ -1078,7 +1098,7 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1078
1098
|
cancelAnimationFrame(n), o = !1;
|
|
1079
1099
|
}
|
|
1080
1100
|
};
|
|
1081
|
-
},
|
|
1101
|
+
}, je = (e, t, n = "touch") => {
|
|
1082
1102
|
switch (n) {
|
|
1083
1103
|
case "center": {
|
|
1084
1104
|
const o = t.left + t.width / 2, i = t.top + t.height / 2;
|
|
@@ -1089,17 +1109,17 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1089
1109
|
case "touch":
|
|
1090
1110
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1091
1111
|
}
|
|
1092
|
-
}, Xt = () => matchMedia("(hover: none), (pointer: coarse)").matches, Jt = () => "safari" in window,
|
|
1093
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1112
|
+
}, Xt = () => matchMedia("(hover: none), (pointer: coarse)").matches, Jt = () => "safari" in window, ge = (e) => Array.isArray(e) ? e : [e], Je = (e) => (t, n, o, i = {}) => {
|
|
1113
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = ge(n), t = ge(t);
|
|
1094
1114
|
for (const s of t)
|
|
1095
1115
|
if (s)
|
|
1096
1116
|
for (const r of n)
|
|
1097
1117
|
s[e](r, o, { capture: !1, ...i });
|
|
1098
|
-
},
|
|
1118
|
+
}, O = Je("addEventListener"), A = Je("removeEventListener"), Z = (e) => {
|
|
1099
1119
|
var t;
|
|
1100
1120
|
const { clientX: n, clientY: o, target: i } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
|
|
1101
1121
|
return { x: n, y: o, target: i };
|
|
1102
|
-
}, Y = (e, t = document) =>
|
|
1122
|
+
}, Y = (e, t = document) => ge(e).map(
|
|
1103
1123
|
(n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null
|
|
1104
1124
|
).flat().filter(Boolean), Zt = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1105
1125
|
switch (o) {
|
|
@@ -1110,15 +1130,15 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1110
1130
|
case "shift":
|
|
1111
1131
|
return e.shiftKey;
|
|
1112
1132
|
}
|
|
1113
|
-
}) : !1), { abs: F, max:
|
|
1133
|
+
}) : !1), { abs: F, max: He, min: Be, ceil: Re } = Math, Fe = (e = []) => ({
|
|
1114
1134
|
stored: e,
|
|
1115
1135
|
selected: [],
|
|
1116
1136
|
touched: [],
|
|
1117
1137
|
changed: { added: [], removed: [] }
|
|
1118
|
-
}), Ze = class extends
|
|
1138
|
+
}), Ze = class extends Vt {
|
|
1119
1139
|
constructor(t) {
|
|
1120
1140
|
var n, o, i, s, r;
|
|
1121
|
-
super(), this._selection =
|
|
1141
|
+
super(), this._selection = Fe(), this._targetBoundaryScrolled = !0, this._selectables = [], this._areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 }, this._areaRect = Oe(), this._singleClick = !0, this._scrollAvailable = !0, this._scrollingActive = !1, this._scrollSpeed = { x: 0, y: 0 }, this._scrollDelta = { x: 0, y: 0 }, this._lastMousePosition = { x: 0, y: 0 }, this.enable = this._toggleStartEvents, this.disable = this._toggleStartEvents.bind(this, !1), this._options = {
|
|
1122
1142
|
selectionAreaClass: "selection-area",
|
|
1123
1143
|
selectionContainerClass: void 0,
|
|
1124
1144
|
selectables: [],
|
|
@@ -1158,13 +1178,13 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1158
1178
|
};
|
|
1159
1179
|
for (const f of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1160
1180
|
typeof this[f] == "function" && (this[f] = this[f].bind(this));
|
|
1161
|
-
const { document:
|
|
1162
|
-
this._area =
|
|
1181
|
+
const { document: c, selectionAreaClass: l, selectionContainerClass: d } = this._options;
|
|
1182
|
+
this._area = c.createElement("div"), this._clippingElement = c.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(l), d && this._clippingElement.classList.add(d), $(this._area, {
|
|
1163
1183
|
willChange: "top, left, bottom, right, width, height",
|
|
1164
1184
|
top: 0,
|
|
1165
1185
|
left: 0,
|
|
1166
1186
|
position: "fixed"
|
|
1167
|
-
}),
|
|
1187
|
+
}), $(this._clippingElement, {
|
|
1168
1188
|
overflow: "hidden",
|
|
1169
1189
|
position: "fixed",
|
|
1170
1190
|
transform: "translate3d(0, 0, 0)",
|
|
@@ -1176,23 +1196,23 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1176
1196
|
}), this.enable();
|
|
1177
1197
|
}
|
|
1178
1198
|
_toggleStartEvents(t = !0) {
|
|
1179
|
-
const { document: n, features: o } = this._options, i = t ?
|
|
1199
|
+
const { document: n, features: o } = this._options, i = t ? O : A;
|
|
1180
1200
|
i(n, "mousedown", this._onTapStart), o.touch && i(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1181
1201
|
}
|
|
1182
1202
|
_onTapStart(t, n = !1) {
|
|
1183
|
-
const { x: o, y: i, target: s } = Z(t), { document: r, startAreas:
|
|
1203
|
+
const { x: o, y: i, target: s } = Z(t), { document: r, startAreas: c, boundaries: l, features: d, behaviour: f } = this._options, h = s.getBoundingClientRect();
|
|
1184
1204
|
if (t instanceof MouseEvent && !Zt(t, f.triggers))
|
|
1185
1205
|
return;
|
|
1186
|
-
const g = Y(
|
|
1187
|
-
this._targetElement =
|
|
1188
|
-
(v) =>
|
|
1206
|
+
const g = Y(c, r), u = Y(l, r);
|
|
1207
|
+
this._targetElement = u.find(
|
|
1208
|
+
(v) => je(v.getBoundingClientRect(), h)
|
|
1189
1209
|
);
|
|
1190
|
-
const
|
|
1191
|
-
if (this._targetBoundary =
|
|
1210
|
+
const a = t.composedPath(), p = g.find((v) => a.includes(v));
|
|
1211
|
+
if (this._targetBoundary = u.find((v) => a.includes(v)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1192
1212
|
return;
|
|
1193
1213
|
this._areaLocation = { x1: o, y1: i, x2: 0, y2: 0 };
|
|
1194
1214
|
const m = r.scrollingElement ?? r.body;
|
|
1195
|
-
this._scrollDelta = { x: m.scrollLeft, y: m.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0),
|
|
1215
|
+
this._scrollDelta = { x: m.scrollLeft, y: m.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), O(r, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), O(r, ["mouseup", "touchcancel", "touchend"], this._onTapStop), O(r, "scroll", this._onScroll), d.deselectOnBlur && (this._targetBoundaryScrolled = !1, O(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1196
1216
|
}
|
|
1197
1217
|
_onSingleTap(t) {
|
|
1198
1218
|
const { singleTap: { intersect: n }, range: o } = this._options.features, i = Z(t);
|
|
@@ -1201,10 +1221,10 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1201
1221
|
s = i.target;
|
|
1202
1222
|
else if (n === "touch") {
|
|
1203
1223
|
this.resolveSelectables();
|
|
1204
|
-
const { x:
|
|
1205
|
-
s = this._selectables.find((
|
|
1206
|
-
const { right: f, left:
|
|
1207
|
-
return
|
|
1224
|
+
const { x: c, y: l } = i;
|
|
1225
|
+
s = this._selectables.find((d) => {
|
|
1226
|
+
const { right: f, left: h, top: g, bottom: u } = d.getBoundingClientRect();
|
|
1227
|
+
return c < f && c > h && l < u && l > g;
|
|
1208
1228
|
});
|
|
1209
1229
|
}
|
|
1210
1230
|
if (!s)
|
|
@@ -1218,59 +1238,59 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1218
1238
|
}
|
|
1219
1239
|
const { stored: r } = this._selection;
|
|
1220
1240
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1221
|
-
const
|
|
1222
|
-
(
|
|
1223
|
-
),
|
|
1224
|
-
this.select(f), this._latestElement =
|
|
1241
|
+
const c = this._latestElement, [l, d] = c.compareDocumentPosition(s) & 4 ? [s, c] : [c, s], f = [...this._selectables.filter(
|
|
1242
|
+
(h) => h.compareDocumentPosition(l) & 4 && h.compareDocumentPosition(d) & 2
|
|
1243
|
+
), l, d];
|
|
1244
|
+
this.select(f), this._latestElement = c;
|
|
1225
1245
|
} else
|
|
1226
|
-
r.includes(s) && (r.length === 1 || t.ctrlKey || r.every((
|
|
1246
|
+
r.includes(s) && (r.length === 1 || t.ctrlKey || r.every((c) => this._selection.stored.includes(c))) ? this.deselect(s) : (this.select(s), this._latestElement = s);
|
|
1227
1247
|
}
|
|
1228
1248
|
_delayedTapMove(t) {
|
|
1229
|
-
const { container: n, document: o, behaviour: { startThreshold: i } } = this._options, { x1: s, y1: r } = this._areaLocation, { x:
|
|
1249
|
+
const { container: n, document: o, behaviour: { startThreshold: i } } = this._options, { x1: s, y1: r } = this._areaLocation, { x: c, y: l } = Z(t);
|
|
1230
1250
|
if (
|
|
1231
1251
|
// Single number for both coordinates
|
|
1232
|
-
typeof i == "number" && F(
|
|
1233
|
-
typeof i == "object" && F(
|
|
1252
|
+
typeof i == "number" && F(c + l - (s + r)) >= i || // Different x and y threshold
|
|
1253
|
+
typeof i == "object" && F(c - s) >= i.x || F(l - r) >= i.y
|
|
1234
1254
|
) {
|
|
1235
1255
|
if (A(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1236
1256
|
A(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1237
1257
|
return;
|
|
1238
1258
|
}
|
|
1239
|
-
|
|
1259
|
+
O(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), $(this._area, "display", "block"), Y(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (O(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), O(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((d) => this._targetElement.contains(d))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
1240
1260
|
}
|
|
1241
1261
|
this._handleMoveEvent(t);
|
|
1242
1262
|
}
|
|
1243
1263
|
_setupSelectionArea() {
|
|
1244
1264
|
const { _clippingElement: t, _targetElement: n, _area: o } = this, i = this._targetRect = n.getBoundingClientRect();
|
|
1245
|
-
this._scrollAvailable ? (
|
|
1265
|
+
this._scrollAvailable ? ($(t, {
|
|
1246
1266
|
top: i.top,
|
|
1247
1267
|
left: i.left,
|
|
1248
1268
|
width: i.width,
|
|
1249
1269
|
height: i.height
|
|
1250
|
-
}),
|
|
1270
|
+
}), $(o, {
|
|
1251
1271
|
marginTop: -i.top,
|
|
1252
1272
|
marginLeft: -i.left
|
|
1253
|
-
})) : (
|
|
1273
|
+
})) : ($(t, {
|
|
1254
1274
|
top: 0,
|
|
1255
1275
|
left: 0,
|
|
1256
1276
|
width: "100%",
|
|
1257
1277
|
height: "100%"
|
|
1258
|
-
}),
|
|
1278
|
+
}), $(o, {
|
|
1259
1279
|
marginTop: 0,
|
|
1260
1280
|
marginLeft: 0
|
|
1261
1281
|
}));
|
|
1262
1282
|
}
|
|
1263
1283
|
_onTapMove(t) {
|
|
1264
|
-
const { _scrollSpeed: n, _areaLocation: o, _options: i, _frame: s } = this, { speedDivider: r } = i.behaviour.scrolling,
|
|
1265
|
-
if (o.x2 =
|
|
1284
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: i, _frame: s } = this, { speedDivider: r } = i.behaviour.scrolling, c = this._targetElement, { x: l, y: d } = Z(t);
|
|
1285
|
+
if (o.x2 = l, o.y2 = d, this._lastMousePosition.x = l, this._lastMousePosition.y = d, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1266
1286
|
this._scrollingActive = !0;
|
|
1267
1287
|
const f = () => {
|
|
1268
1288
|
if (!n.x && !n.y) {
|
|
1269
1289
|
this._scrollingActive = !1;
|
|
1270
1290
|
return;
|
|
1271
1291
|
}
|
|
1272
|
-
const { scrollTop:
|
|
1273
|
-
n.y && (
|
|
1292
|
+
const { scrollTop: h, scrollLeft: g } = c;
|
|
1293
|
+
n.y && (c.scrollTop += Re(n.y / r), o.y1 -= c.scrollTop - h), n.x && (c.scrollLeft += Re(n.x / r), o.x1 -= c.scrollLeft - g), s.next(t), requestAnimationFrame(f);
|
|
1274
1294
|
};
|
|
1275
1295
|
requestAnimationFrame(f);
|
|
1276
1296
|
} else
|
|
@@ -1302,12 +1322,12 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1302
1322
|
});
|
|
1303
1323
|
}
|
|
1304
1324
|
_recalculateSelectionAreaRect() {
|
|
1305
|
-
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: i } = this, { scrollTop: s, scrollHeight: r, clientHeight:
|
|
1306
|
-
let { x2:
|
|
1325
|
+
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: i } = this, { scrollTop: s, scrollHeight: r, clientHeight: c, scrollLeft: l, scrollWidth: d, clientWidth: f } = o, h = this._targetRect, { x1: g, y1: u } = n;
|
|
1326
|
+
let { x2: a, y2: p } = n;
|
|
1307
1327
|
const { behaviour: { scrolling: { startScrollMargins: m } } } = i;
|
|
1308
|
-
|
|
1309
|
-
const v =
|
|
1310
|
-
this._areaRect =
|
|
1328
|
+
a < h.left + m.x ? (t.x = l ? -F(h.left - a + m.x) : 0, a = a < h.left ? h.left : a) : a > h.right - m.x ? (t.x = d - l - f ? F(h.left + h.width - a - m.x) : 0, a = a > h.right ? h.right : a) : t.x = 0, p < h.top + m.y ? (t.y = s ? -F(h.top - p + m.y) : 0, p = p < h.top ? h.top : p) : p > h.bottom - m.y ? (t.y = r - s - c ? F(h.top + h.height - p - m.y) : 0, p = p > h.bottom ? h.bottom : p) : t.y = 0;
|
|
1329
|
+
const v = Be(g, a), b = Be(u, p), x = He(g, a), C = He(u, p);
|
|
1330
|
+
this._areaRect = Oe(v, b, x - v, C - b);
|
|
1311
1331
|
}
|
|
1312
1332
|
_redrawSelectionArea() {
|
|
1313
1333
|
const { x: t, y: n, width: o, height: i } = this._areaRect, { style: s } = this._area;
|
|
@@ -1316,32 +1336,32 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1316
1336
|
_onTapStop(t, n) {
|
|
1317
1337
|
var o;
|
|
1318
1338
|
const { document: i, features: s } = this._options, { _singleClick: r } = this;
|
|
1319
|
-
A(this._targetElement, "scroll", this._onStartAreaScroll), A(i, ["mousemove", "touchmove"], this._delayedTapMove), A(i, ["touchmove", "mousemove"], this._onTapMove), A(i, ["mouseup", "touchcancel", "touchend"], this._onTapStop), A(i, "scroll", this._onScroll), this._keepSelection(), t && r && s.singleTap.allow ? this._onSingleTap(t) : !r && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, A(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), A(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(),
|
|
1339
|
+
A(this._targetElement, "scroll", this._onStartAreaScroll), A(i, ["mousemove", "touchmove"], this._delayedTapMove), A(i, ["touchmove", "mousemove"], this._onTapMove), A(i, ["mouseup", "touchcancel", "touchend"], this._onTapStop), A(i, "scroll", this._onScroll), this._keepSelection(), t && r && s.singleTap.allow ? this._onSingleTap(t) : !r && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, A(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), A(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), $(this._area, "display", "none");
|
|
1320
1340
|
}
|
|
1321
1341
|
_updateElementSelection() {
|
|
1322
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: i } = this, { stored: s, selected: r, touched:
|
|
1342
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: i } = this, { stored: s, selected: r, touched: c } = o, { intersect: l, overlap: d } = n.behaviour, f = d === "invert", h = [], g = [], u = [];
|
|
1323
1343
|
for (let p = 0; p < t.length; p++) {
|
|
1324
1344
|
const m = t[p];
|
|
1325
|
-
if (
|
|
1345
|
+
if (je(i, m.getBoundingClientRect(), l)) {
|
|
1326
1346
|
if (r.includes(m))
|
|
1327
|
-
s.includes(m) && !
|
|
1347
|
+
s.includes(m) && !c.includes(m) && c.push(m);
|
|
1328
1348
|
else if (f && s.includes(m)) {
|
|
1329
|
-
|
|
1349
|
+
u.push(m);
|
|
1330
1350
|
continue;
|
|
1331
1351
|
} else
|
|
1332
1352
|
g.push(m);
|
|
1333
|
-
|
|
1353
|
+
h.push(m);
|
|
1334
1354
|
}
|
|
1335
1355
|
}
|
|
1336
1356
|
f && g.push(...s.filter((p) => !r.includes(p)));
|
|
1337
|
-
const
|
|
1357
|
+
const a = d === "keep";
|
|
1338
1358
|
for (let p = 0; p < r.length; p++) {
|
|
1339
1359
|
const m = r[p];
|
|
1340
|
-
!
|
|
1360
|
+
!h.includes(m) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1341
1361
|
// not make them part of the current selection as soon as they're touched.
|
|
1342
|
-
(
|
|
1362
|
+
(a && s.includes(m)) && u.push(m);
|
|
1343
1363
|
}
|
|
1344
|
-
o.selected =
|
|
1364
|
+
o.selected = h, o.changed = { added: g, removed: u }, this._latestElement = void 0;
|
|
1345
1365
|
}
|
|
1346
1366
|
_emitEvent(t, n) {
|
|
1347
1367
|
return this.emit(t, {
|
|
@@ -1351,20 +1371,20 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1351
1371
|
});
|
|
1352
1372
|
}
|
|
1353
1373
|
_keepSelection() {
|
|
1354
|
-
const { _options: t, _selection: n } = this, { selected: o, changed: i, touched: s, stored: r } = n,
|
|
1374
|
+
const { _options: t, _selection: n } = this, { selected: o, changed: i, touched: s, stored: r } = n, c = o.filter((l) => !r.includes(l));
|
|
1355
1375
|
switch (t.behaviour.overlap) {
|
|
1356
1376
|
case "drop": {
|
|
1357
1377
|
n.stored = [
|
|
1358
|
-
...
|
|
1359
|
-
...r.filter((
|
|
1378
|
+
...c,
|
|
1379
|
+
...r.filter((l) => !s.includes(l))
|
|
1360
1380
|
// Elements not touched
|
|
1361
1381
|
];
|
|
1362
1382
|
break;
|
|
1363
1383
|
}
|
|
1364
1384
|
case "invert": {
|
|
1365
1385
|
n.stored = [
|
|
1366
|
-
...
|
|
1367
|
-
...r.filter((
|
|
1386
|
+
...c,
|
|
1387
|
+
...r.filter((l) => !i.removed.includes(l))
|
|
1368
1388
|
// Elements not removed from selection
|
|
1369
1389
|
];
|
|
1370
1390
|
break;
|
|
@@ -1372,7 +1392,7 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1372
1392
|
case "keep": {
|
|
1373
1393
|
n.stored = [
|
|
1374
1394
|
...r,
|
|
1375
|
-
...o.filter((
|
|
1395
|
+
...o.filter((l) => !r.includes(l))
|
|
1376
1396
|
// Newly added
|
|
1377
1397
|
];
|
|
1378
1398
|
break;
|
|
@@ -1404,7 +1424,7 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1404
1424
|
s.added = [], s.removed.push(
|
|
1405
1425
|
...o,
|
|
1406
1426
|
...t ? i : []
|
|
1407
|
-
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection =
|
|
1427
|
+
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Fe(t ? [] : i);
|
|
1408
1428
|
}
|
|
1409
1429
|
/**
|
|
1410
1430
|
* @returns {Array} Selected elements
|
|
@@ -1457,7 +1477,7 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1457
1477
|
*/
|
|
1458
1478
|
select(t, n = !1) {
|
|
1459
1479
|
const { changed: o, selected: i, stored: s } = this._selection, r = Y(t, this._options.document).filter(
|
|
1460
|
-
(
|
|
1480
|
+
(c) => !i.includes(c) && !s.includes(c)
|
|
1461
1481
|
);
|
|
1462
1482
|
return s.push(...r), i.push(...r), o.added.push(...r), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), r;
|
|
1463
1483
|
}
|
|
@@ -1468,10 +1488,10 @@ const Oe = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1468
1488
|
*/
|
|
1469
1489
|
deselect(t, n = !1) {
|
|
1470
1490
|
const { selected: o, stored: i, changed: s } = this._selection, r = Y(t, this._options.document).filter(
|
|
1471
|
-
(
|
|
1491
|
+
(c) => o.includes(c) || i.includes(c)
|
|
1472
1492
|
);
|
|
1473
|
-
this._selection.stored = i.filter((
|
|
1474
|
-
...r.filter((
|
|
1493
|
+
this._selection.stored = i.filter((c) => !r.includes(c)), this._selection.selected = o.filter((c) => !r.includes(c)), this._selection.changed.added = [], this._selection.changed.removed.push(
|
|
1494
|
+
...r.filter((c) => !s.removed.includes(c))
|
|
1475
1495
|
), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
1476
1496
|
}
|
|
1477
1497
|
};
|
|
@@ -1544,7 +1564,7 @@ function en(e) {
|
|
|
1544
1564
|
const tn = function(e, t = !0) {
|
|
1545
1565
|
this.theme = e;
|
|
1546
1566
|
const o = {
|
|
1547
|
-
...(e.type === "dark" ?
|
|
1567
|
+
...(e.type === "dark" ? ve : me).cssVar,
|
|
1548
1568
|
...e.cssVar
|
|
1549
1569
|
}, i = Object.keys(o);
|
|
1550
1570
|
for (let s = 0; s < i.length; s++) {
|
|
@@ -1552,35 +1572,35 @@ const tn = function(e, t = !0) {
|
|
|
1552
1572
|
this.container.style.setProperty(r, o[r]);
|
|
1553
1573
|
}
|
|
1554
1574
|
t && this.refresh();
|
|
1555
|
-
},
|
|
1575
|
+
}, z = (e) => {
|
|
1556
1576
|
var o;
|
|
1557
1577
|
const t = (o = e.parent) == null ? void 0 : o.children, n = (t == null ? void 0 : t.indexOf(e)) ?? 0;
|
|
1558
1578
|
return { siblings: t, index: n };
|
|
1559
1579
|
};
|
|
1560
1580
|
function nn(e) {
|
|
1561
|
-
const { siblings: t, index: n } =
|
|
1581
|
+
const { siblings: t, index: n } = z(e);
|
|
1562
1582
|
if (t === void 0)
|
|
1563
1583
|
return;
|
|
1564
1584
|
const o = t[n];
|
|
1565
1585
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
1566
1586
|
}
|
|
1567
1587
|
function on(e) {
|
|
1568
|
-
const { siblings: t, index: n } =
|
|
1588
|
+
const { siblings: t, index: n } = z(e);
|
|
1569
1589
|
if (t === void 0)
|
|
1570
1590
|
return;
|
|
1571
1591
|
const o = t[n];
|
|
1572
1592
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
1573
1593
|
}
|
|
1574
1594
|
function Qe(e) {
|
|
1575
|
-
const { siblings: t, index: n } =
|
|
1595
|
+
const { siblings: t, index: n } = z(e);
|
|
1576
1596
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
1577
1597
|
}
|
|
1578
1598
|
function sn(e, t, n) {
|
|
1579
|
-
const { siblings: o, index: i } =
|
|
1599
|
+
const { siblings: o, index: i } = z(n);
|
|
1580
1600
|
o !== void 0 && (t === "before" ? o.splice(i, 0, e) : o.splice(i + 1, 0, e));
|
|
1581
1601
|
}
|
|
1582
1602
|
function rn(e, t) {
|
|
1583
|
-
const { siblings: n, index: o } =
|
|
1603
|
+
const { siblings: n, index: o } = z(e);
|
|
1584
1604
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
1585
1605
|
}
|
|
1586
1606
|
function et(e, t, n) {
|
|
@@ -1589,13 +1609,13 @@ function et(e, t, n) {
|
|
|
1589
1609
|
n.children ? n.children.push(t) : n.children = [t];
|
|
1590
1610
|
else {
|
|
1591
1611
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
1592
|
-
const { siblings: i, index: s } =
|
|
1612
|
+
const { siblings: i, index: s } = z(n);
|
|
1593
1613
|
if (i === void 0)
|
|
1594
1614
|
return;
|
|
1595
1615
|
e === "before" ? i.splice(s, 0, t) : i.splice(s + 1, 0, t);
|
|
1596
1616
|
}
|
|
1597
1617
|
}
|
|
1598
|
-
const
|
|
1618
|
+
const cn = function({ map: e, direction: t }, n) {
|
|
1599
1619
|
var o, i;
|
|
1600
1620
|
if (t === 0)
|
|
1601
1621
|
return 0;
|
|
@@ -1612,13 +1632,13 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1612
1632
|
if (J(o), i.children[1])
|
|
1613
1633
|
i.nextSibling.appendChild(n);
|
|
1614
1634
|
else {
|
|
1615
|
-
const
|
|
1616
|
-
i.appendChild(
|
|
1635
|
+
const c = e.createChildren([n]);
|
|
1636
|
+
i.appendChild(Ee(!0)), i.insertAdjacentElement("afterend", c);
|
|
1617
1637
|
}
|
|
1618
1638
|
e.linkDiv(n.offsetParent);
|
|
1619
1639
|
} else
|
|
1620
|
-
i.tagName === "ME-ROOT" && (
|
|
1621
|
-
},
|
|
1640
|
+
i.tagName === "ME-ROOT" && (cn(e, o.nodeObj) === 0 ? (s = e.container.querySelector(".lhs")) == null || s.appendChild(n) : (r = e.container.querySelector(".rhs")) == null || r.appendChild(n), e.linkDiv());
|
|
1641
|
+
}, ln = function(e, t) {
|
|
1622
1642
|
const n = e.parentNode;
|
|
1623
1643
|
if (t === 0) {
|
|
1624
1644
|
const o = n.parentNode.parentNode;
|
|
@@ -1632,31 +1652,31 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1632
1652
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
1633
1653
|
(n == null ? void 0 : n.tagName) === "svg" && (n == null || n.remove());
|
|
1634
1654
|
}, an = function(e, t) {
|
|
1635
|
-
const n = e.nodeObj, o =
|
|
1655
|
+
const n = e.nodeObj, o = ye(n);
|
|
1636
1656
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
1637
1657
|
const i = Object.assign(n, t);
|
|
1638
|
-
|
|
1658
|
+
xe(e, i), this.linkDiv(), this.bus.fire("operation", {
|
|
1639
1659
|
name: "reshapeNode",
|
|
1640
1660
|
obj: i,
|
|
1641
1661
|
origin: o
|
|
1642
1662
|
});
|
|
1643
|
-
},
|
|
1663
|
+
}, Ce = function(e, t, n) {
|
|
1644
1664
|
if (!t)
|
|
1645
1665
|
return null;
|
|
1646
1666
|
const o = t.nodeObj;
|
|
1647
1667
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
1648
1668
|
const i = n || e.generateNewObj();
|
|
1649
|
-
o.children ? o.children.push(i) : o.children = [i],
|
|
1669
|
+
o.children ? o.children.push(i) : o.children = [i], j(e.nodeData);
|
|
1650
1670
|
const { grp: s, top: r } = e.createWrapper(i);
|
|
1651
1671
|
return tt(e, t, s), { newTop: r, newNodeObj: i };
|
|
1652
1672
|
}, dn = function(e, t, n) {
|
|
1653
|
-
var
|
|
1673
|
+
var d, f, h, g;
|
|
1654
1674
|
const o = t || this.currentNode;
|
|
1655
1675
|
if (!o)
|
|
1656
1676
|
return;
|
|
1657
1677
|
const i = o.nodeObj;
|
|
1658
1678
|
if (i.parent) {
|
|
1659
|
-
if (!((
|
|
1679
|
+
if (!((d = i.parent) != null && d.parent) && ((h = (f = i.parent) == null ? void 0 : f.children) == null ? void 0 : h.length) === 1 && this.direction === 2) {
|
|
1660
1680
|
this.addChild(this.findEle(i.parent.id), n);
|
|
1661
1681
|
return;
|
|
1662
1682
|
}
|
|
@@ -1666,16 +1686,16 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1666
1686
|
}
|
|
1667
1687
|
const s = n || this.generateNewObj();
|
|
1668
1688
|
if (!((g = i.parent) != null && g.parent)) {
|
|
1669
|
-
const
|
|
1670
|
-
s.direction =
|
|
1689
|
+
const u = o.closest("me-main").className === M.LHS ? 0 : 1;
|
|
1690
|
+
s.direction = u;
|
|
1671
1691
|
}
|
|
1672
|
-
sn(s, e, i),
|
|
1673
|
-
const r = o.parentElement, { grp:
|
|
1674
|
-
r.parentElement.insertAdjacentElement(nt[e],
|
|
1692
|
+
sn(s, e, i), j(this.nodeData);
|
|
1693
|
+
const r = o.parentElement, { grp: c, top: l } = this.createWrapper(s);
|
|
1694
|
+
r.parentElement.insertAdjacentElement(nt[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(l.firstChild), this.bus.fire("operation", {
|
|
1675
1695
|
name: "insertSibling",
|
|
1676
1696
|
type: e,
|
|
1677
1697
|
obj: s
|
|
1678
|
-
});
|
|
1698
|
+
}), this.selectNode(l.firstChild, !0);
|
|
1679
1699
|
}, hn = function(e, t) {
|
|
1680
1700
|
const n = e || this.currentNode;
|
|
1681
1701
|
if (!n)
|
|
@@ -1685,11 +1705,11 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1685
1705
|
if (!o.parent)
|
|
1686
1706
|
return;
|
|
1687
1707
|
const i = t || this.generateNewObj();
|
|
1688
|
-
rn(o, i),
|
|
1689
|
-
const s = n.parentElement.parentElement, { grp: r, top:
|
|
1690
|
-
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1708
|
+
rn(o, i), j(this.nodeData);
|
|
1709
|
+
const s = n.parentElement.parentElement, { grp: r, top: c } = this.createWrapper(i, !0);
|
|
1710
|
+
c.appendChild(Ee(!0)), s.insertAdjacentElement("afterend", r);
|
|
1711
|
+
const l = this.createChildren([s]);
|
|
1712
|
+
c.insertAdjacentElement("afterend", l), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
|
|
1693
1713
|
name: "insertParent",
|
|
1694
1714
|
obj: i
|
|
1695
1715
|
});
|
|
@@ -1697,7 +1717,7 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1697
1717
|
const n = e || this.currentNode;
|
|
1698
1718
|
if (!n)
|
|
1699
1719
|
return;
|
|
1700
|
-
const o =
|
|
1720
|
+
const o = Ce(this, n, t);
|
|
1701
1721
|
if (!o)
|
|
1702
1722
|
return;
|
|
1703
1723
|
const { newTop: i, newNodeObj: s } = o;
|
|
@@ -1706,9 +1726,9 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1706
1726
|
obj: s
|
|
1707
1727
|
}), t || this.editTopic(i.firstChild), this.selectNode(i.firstChild, !0);
|
|
1708
1728
|
}, fn = function(e, t) {
|
|
1709
|
-
const n =
|
|
1710
|
-
|
|
1711
|
-
const o =
|
|
1729
|
+
const n = ye(e.nodeObj);
|
|
1730
|
+
be(n);
|
|
1731
|
+
const o = Ce(this, t, n);
|
|
1712
1732
|
if (!o)
|
|
1713
1733
|
return;
|
|
1714
1734
|
const { newNodeObj: i } = o;
|
|
@@ -1717,16 +1737,16 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1717
1737
|
obj: i
|
|
1718
1738
|
});
|
|
1719
1739
|
}, pn = function(e, t) {
|
|
1720
|
-
e =
|
|
1740
|
+
e = le(e);
|
|
1721
1741
|
const n = [];
|
|
1722
1742
|
for (let o = 0; o < e.length; o++) {
|
|
1723
|
-
const i = e[o], s =
|
|
1724
|
-
|
|
1725
|
-
const r =
|
|
1743
|
+
const i = e[o], s = ye(i.nodeObj);
|
|
1744
|
+
be(s);
|
|
1745
|
+
const r = Ce(this, t, s);
|
|
1726
1746
|
if (!r)
|
|
1727
1747
|
return;
|
|
1728
|
-
const { newNodeObj:
|
|
1729
|
-
n.push(
|
|
1748
|
+
const { newNodeObj: c } = r;
|
|
1749
|
+
n.push(c);
|
|
1730
1750
|
}
|
|
1731
1751
|
this.unselectNodes(this.currentNodes), this.selectNodes(n.map((o) => this.findEle(o.id))), this.bus.fire("operation", {
|
|
1732
1752
|
name: "copyNodes",
|
|
@@ -1757,10 +1777,10 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1757
1777
|
}, vn = function(e) {
|
|
1758
1778
|
if (e.length === 0)
|
|
1759
1779
|
return;
|
|
1760
|
-
e =
|
|
1780
|
+
e = le(e);
|
|
1761
1781
|
for (const n of e) {
|
|
1762
1782
|
const o = n.nodeObj, i = Qe(o);
|
|
1763
|
-
|
|
1783
|
+
ln(n, i);
|
|
1764
1784
|
}
|
|
1765
1785
|
const t = e[e.length - 1];
|
|
1766
1786
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
@@ -1768,12 +1788,12 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1768
1788
|
objs: e.map((n) => n.nodeObj)
|
|
1769
1789
|
});
|
|
1770
1790
|
}, bn = function(e, t) {
|
|
1771
|
-
e =
|
|
1791
|
+
e = le(e);
|
|
1772
1792
|
const n = t.nodeObj;
|
|
1773
1793
|
n.expanded === !1 && (this.expandNode(t, !0), t = this.findEle(n.id));
|
|
1774
1794
|
for (const o of e) {
|
|
1775
1795
|
const i = o.nodeObj;
|
|
1776
|
-
et("in", i, n),
|
|
1796
|
+
et("in", i, n), j(this.nodeData);
|
|
1777
1797
|
const s = o.parentElement;
|
|
1778
1798
|
tt(this, t, s.parentElement);
|
|
1779
1799
|
}
|
|
@@ -1783,13 +1803,13 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1783
1803
|
toObj: n
|
|
1784
1804
|
});
|
|
1785
1805
|
}, ot = (e, t, n, o) => {
|
|
1786
|
-
e =
|
|
1806
|
+
e = le(e), t === "after" && (e = e.reverse());
|
|
1787
1807
|
const i = n.nodeObj, s = [];
|
|
1788
1808
|
for (const r of e) {
|
|
1789
|
-
const
|
|
1790
|
-
et(t,
|
|
1791
|
-
const
|
|
1792
|
-
s.includes(
|
|
1809
|
+
const c = r.nodeObj;
|
|
1810
|
+
et(t, c, i), j(o.nodeData), J(r);
|
|
1811
|
+
const l = r.parentElement.parentNode;
|
|
1812
|
+
s.includes(l.parentElement) || s.push(l.parentElement), n.parentElement.parentNode.insertAdjacentElement(nt[t], l);
|
|
1793
1813
|
}
|
|
1794
1814
|
for (const r of s)
|
|
1795
1815
|
r.childElementCount === 0 && r.tagName !== "ME-MAIN" && (r.previousSibling.children[1].remove(), r.remove());
|
|
@@ -1837,8 +1857,8 @@ function Cn(e) {
|
|
|
1837
1857
|
const Sn = function(e) {
|
|
1838
1858
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
1839
1859
|
if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
|
|
1840
|
-
const s = n.left + n.width / 2, r = n.top + n.height / 2,
|
|
1841
|
-
this.move(-
|
|
1860
|
+
const s = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2, l = o.top + o.height / 2, d = s - c, f = r - l;
|
|
1861
|
+
this.move(-d, -f, !0);
|
|
1842
1862
|
}
|
|
1843
1863
|
}, Nn = function(e, t, n) {
|
|
1844
1864
|
this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
@@ -1860,23 +1880,25 @@ const Sn = function(e) {
|
|
|
1860
1880
|
this.editable = !0;
|
|
1861
1881
|
}, Dn = function() {
|
|
1862
1882
|
this.editable = !1;
|
|
1863
|
-
},
|
|
1883
|
+
}, Pn = function(e, t = { x: 0, y: 0 }) {
|
|
1864
1884
|
if (e < this.scaleMin || e > this.scaleMax)
|
|
1865
1885
|
return;
|
|
1866
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, i = t.y ? t.y - n.top - n.height / 2 : 0, { dx: s, dy: r } = st(this),
|
|
1867
|
-
this.map.style.transform = `translate(${
|
|
1868
|
-
},
|
|
1886
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, i = t.y ? t.y - n.top - n.height / 2 : 0, { dx: s, dy: r } = st(this), c = this.map.style.transform, { x: l, y: d } = Ge(c), f = l - s, h = d - r, g = this.scaleVal, u = (-o + f) * (1 - e / g), a = (-i + h) * (1 - e / g);
|
|
1887
|
+
this.map.style.transform = `translate(${l - u}px, ${d - a}px) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
1888
|
+
}, $n = function() {
|
|
1869
1889
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
1870
1890
|
this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
|
|
1871
|
-
},
|
|
1872
|
-
const { map:
|
|
1873
|
-
let { x:
|
|
1874
|
-
|
|
1891
|
+
}, On = function(e, t, n = !1) {
|
|
1892
|
+
const { map: o, scaleVal: i, bus: s } = this, r = o.style.transform;
|
|
1893
|
+
let { x: c, y: l } = Ge(r);
|
|
1894
|
+
c += e, l += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
1895
|
+
o.style.transition = "none";
|
|
1896
|
+
}, 300)), o.style.transform = `translate(${c}px, ${l}px) scale(${i})`, s.fire("move", { dx: e, dy: t });
|
|
1875
1897
|
}, st = (e) => {
|
|
1876
|
-
const { container: t, map: n, nodes: o } = e, i = n.querySelector("me-root"), s = i.offsetTop, r = i.offsetLeft,
|
|
1877
|
-
let
|
|
1878
|
-
return e.alignment === "root" ? (
|
|
1879
|
-
},
|
|
1898
|
+
const { container: t, map: n, nodes: o } = e, i = n.querySelector("me-root"), s = i.offsetTop, r = i.offsetLeft, c = i.offsetWidth, l = i.offsetHeight;
|
|
1899
|
+
let d, f;
|
|
1900
|
+
return e.alignment === "root" ? (d = t.offsetWidth / 2 - r - c / 2, f = t.offsetHeight / 2 - s - l / 2, n.style.transformOrigin = `${r + c / 2}px 50%`) : (d = (t.offsetWidth - o.offsetWidth) / 2, f = (t.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: d, dy: f };
|
|
1901
|
+
}, jn = function() {
|
|
1880
1902
|
const { map: e } = this, { dx: t, dy: n } = st(this);
|
|
1881
1903
|
e.style.transform = `translate(${t}px, ${n}px) scale(${this.scaleVal})`;
|
|
1882
1904
|
}, Hn = function(e) {
|
|
@@ -1887,32 +1909,46 @@ const Sn = function(e) {
|
|
|
1887
1909
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
1888
1910
|
}, Fn = function() {
|
|
1889
1911
|
this.direction = 0, this.refresh(), this.toCenter();
|
|
1890
|
-
}, In = function() {
|
|
1891
|
-
this.direction = 1, this.refresh(), this.toCenter();
|
|
1892
1912
|
}, Wn = function() {
|
|
1913
|
+
this.direction = 1, this.refresh(), this.toCenter();
|
|
1914
|
+
}, In = function() {
|
|
1893
1915
|
this.direction = 2, this.refresh(), this.toCenter();
|
|
1894
1916
|
}, Kn = function(e) {
|
|
1895
1917
|
this.locale = e, this.refresh();
|
|
1896
1918
|
}, Yn = function(e, t) {
|
|
1897
1919
|
const n = e.nodeObj;
|
|
1898
1920
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
1899
|
-
const o = e.
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1921
|
+
const o = e.getBoundingClientRect(), i = {
|
|
1922
|
+
x: o.left,
|
|
1923
|
+
y: o.top
|
|
1924
|
+
}, s = e.parentNode, r = s.children[1];
|
|
1925
|
+
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", J(e), n.expanded) {
|
|
1926
|
+
const h = this.createChildren(
|
|
1927
|
+
n.children.map((g) => this.createWrapper(g).grp)
|
|
1903
1928
|
);
|
|
1904
|
-
|
|
1929
|
+
s.parentNode.appendChild(h);
|
|
1905
1930
|
} else
|
|
1906
|
-
|
|
1931
|
+
s.parentNode.children[1].remove();
|
|
1907
1932
|
this.linkDiv(e.closest("me-main > me-wrapper"));
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1933
|
+
const c = e.getBoundingClientRect(), l = {
|
|
1934
|
+
x: c.left,
|
|
1935
|
+
y: c.top
|
|
1936
|
+
}, d = i.x - l.x, f = i.y - l.y;
|
|
1937
|
+
this.move(d, f), this.bus.fire("expandNode", n);
|
|
1910
1938
|
}, Gn = function(e, t) {
|
|
1911
|
-
const n = e.nodeObj
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1939
|
+
const n = e.nodeObj, o = e.getBoundingClientRect(), i = {
|
|
1940
|
+
x: o.left,
|
|
1941
|
+
y: o.top
|
|
1942
|
+
};
|
|
1943
|
+
q(n, t ?? !n.expanded), this.refresh();
|
|
1944
|
+
const s = this.findEle(n.id).getBoundingClientRect(), r = {
|
|
1945
|
+
x: s.left,
|
|
1946
|
+
y: s.top
|
|
1947
|
+
}, c = i.x - r.x, l = i.y - r.y;
|
|
1948
|
+
this.move(c, l);
|
|
1949
|
+
}, qn = function(e) {
|
|
1950
|
+
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), j(this.nodeData), this.layout(), this.linkDiv();
|
|
1951
|
+
}, zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1916
1952
|
__proto__: null,
|
|
1917
1953
|
cancelFocus: Rn,
|
|
1918
1954
|
clearSelection: Tn,
|
|
@@ -1924,20 +1960,20 @@ const Sn = function(e) {
|
|
|
1924
1960
|
getData: An,
|
|
1925
1961
|
getDataString: Ln,
|
|
1926
1962
|
initLeft: Fn,
|
|
1927
|
-
initRight:
|
|
1928
|
-
initSide:
|
|
1963
|
+
initRight: Wn,
|
|
1964
|
+
initSide: In,
|
|
1929
1965
|
install: Hn,
|
|
1930
|
-
move:
|
|
1931
|
-
refresh:
|
|
1932
|
-
scale:
|
|
1933
|
-
scaleFit:
|
|
1966
|
+
move: On,
|
|
1967
|
+
refresh: qn,
|
|
1968
|
+
scale: Pn,
|
|
1969
|
+
scaleFit: $n,
|
|
1934
1970
|
scrollIntoView: Sn,
|
|
1935
1971
|
selectNode: Nn,
|
|
1936
1972
|
selectNodes: kn,
|
|
1937
1973
|
setLocale: Kn,
|
|
1938
|
-
toCenter:
|
|
1974
|
+
toCenter: jn,
|
|
1939
1975
|
unselectNodes: _n
|
|
1940
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1976
|
+
}, Symbol.toStringTag, { value: "Module" })), Vn = function(e) {
|
|
1941
1977
|
return {
|
|
1942
1978
|
dom: e,
|
|
1943
1979
|
moved: !1,
|
|
@@ -1960,7 +1996,7 @@ const Sn = function(e) {
|
|
|
1960
1996
|
},
|
|
1961
1997
|
cb: null,
|
|
1962
1998
|
init(t, n) {
|
|
1963
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
1999
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = we([
|
|
1964
2000
|
{ dom: t, evt: "pointermove", func: this.handlePointerMove },
|
|
1965
2001
|
{ dom: t, evt: "pointerleave", func: this.handleClear },
|
|
1966
2002
|
{ dom: t, evt: "pointerup", func: this.handleClear },
|
|
@@ -1972,58 +2008,58 @@ const Sn = function(e) {
|
|
|
1972
2008
|
this.moved = !1, this.pointerdown = !1;
|
|
1973
2009
|
}
|
|
1974
2010
|
};
|
|
1975
|
-
},
|
|
1976
|
-
create:
|
|
2011
|
+
}, We = {
|
|
2012
|
+
create: Vn
|
|
1977
2013
|
}, Un = "#4dc4ff";
|
|
1978
|
-
function rt(e, t, n, o, i, s, r,
|
|
2014
|
+
function rt(e, t, n, o, i, s, r, c) {
|
|
1979
2015
|
return {
|
|
1980
2016
|
x: e / 8 + n * 3 / 8 + i * 3 / 8 + r / 8,
|
|
1981
|
-
y: t / 8 + o * 3 / 8 + s * 3 / 8 +
|
|
2017
|
+
y: t / 8 + o * 3 / 8 + s * 3 / 8 + c / 8
|
|
1982
2018
|
};
|
|
1983
2019
|
}
|
|
1984
2020
|
function Xn(e, t, n) {
|
|
1985
|
-
|
|
2021
|
+
N(e, {
|
|
1986
2022
|
x: t + "",
|
|
1987
2023
|
y: n + ""
|
|
1988
2024
|
});
|
|
1989
2025
|
}
|
|
1990
2026
|
function Q(e, t, n, o, i) {
|
|
1991
|
-
|
|
2027
|
+
N(e, {
|
|
1992
2028
|
x1: t + "",
|
|
1993
2029
|
y1: n + "",
|
|
1994
2030
|
x2: o + "",
|
|
1995
2031
|
y2: i + ""
|
|
1996
2032
|
});
|
|
1997
2033
|
}
|
|
1998
|
-
function Ie(e, t, n, o, i, s, r, l, d
|
|
1999
|
-
var
|
|
2000
|
-
if (e.line.setAttribute("d", `M ${t} ${n} C ${o} ${i} ${s} ${r} ${
|
|
2001
|
-
const
|
|
2002
|
-
|
|
2003
|
-
}
|
|
2004
|
-
const f = ie(s, r,
|
|
2005
|
-
if (f && (e.arrow1.setAttribute("d", `M ${f.x1} ${f.y1} L ${
|
|
2006
|
-
const
|
|
2007
|
-
|
|
2008
|
-
}
|
|
2009
|
-
if (
|
|
2010
|
-
const
|
|
2011
|
-
if (
|
|
2012
|
-
const p =
|
|
2034
|
+
function Ie(e, t, n, o, i, s, r, c, l, d) {
|
|
2035
|
+
var u;
|
|
2036
|
+
if (e.line.setAttribute("d", `M ${t} ${n} C ${o} ${i} ${s} ${r} ${c} ${l}`), d.style) {
|
|
2037
|
+
const a = d.style;
|
|
2038
|
+
a.stroke && e.line.setAttribute("stroke", a.stroke), a.strokeWidth && e.line.setAttribute("stroke-width", String(a.strokeWidth)), a.strokeDasharray && e.line.setAttribute("stroke-dasharray", a.strokeDasharray), a.strokeLinecap && e.line.setAttribute("stroke-linecap", a.strokeLinecap), a.opacity !== void 0 && e.line.setAttribute("opacity", String(a.opacity));
|
|
2039
|
+
}
|
|
2040
|
+
const f = ie(s, r, c, l);
|
|
2041
|
+
if (f && (e.arrow1.setAttribute("d", `M ${f.x1} ${f.y1} L ${c} ${l} L ${f.x2} ${f.y2}`), d.style)) {
|
|
2042
|
+
const a = d.style;
|
|
2043
|
+
a.stroke && e.arrow1.setAttribute("stroke", a.stroke), a.strokeWidth && e.arrow1.setAttribute("stroke-width", String(a.strokeWidth)), a.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", a.strokeLinecap), a.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(a.opacity));
|
|
2044
|
+
}
|
|
2045
|
+
if (d.bidirectional) {
|
|
2046
|
+
const a = ie(o, i, t, n);
|
|
2047
|
+
if (a && (e.arrow2.setAttribute("d", `M ${a.x1} ${a.y1} L ${t} ${n} L ${a.x2} ${a.y2}`), d.style)) {
|
|
2048
|
+
const p = d.style;
|
|
2013
2049
|
p.stroke && e.arrow2.setAttribute("stroke", p.stroke), p.strokeWidth && e.arrow2.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(p.opacity));
|
|
2014
2050
|
}
|
|
2015
2051
|
}
|
|
2016
|
-
const { x:
|
|
2017
|
-
Xn(e.label,
|
|
2052
|
+
const { x: h, y: g } = rt(t, n, o, i, s, r, c, l);
|
|
2053
|
+
Xn(e.label, h, g), (u = d.style) != null && u.labelColor && e.label.setAttribute("fill", d.style.labelColor), io(e);
|
|
2018
2054
|
}
|
|
2019
|
-
function
|
|
2020
|
-
const { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = t.offsetWidth, r = t.offsetHeight,
|
|
2055
|
+
function ce(e, t, n) {
|
|
2056
|
+
const { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = t.offsetWidth, r = t.offsetHeight, c = o + s / 2, l = i + r / 2, d = c + n.x, f = l + n.y;
|
|
2021
2057
|
return {
|
|
2022
2058
|
w: s,
|
|
2023
2059
|
h: r,
|
|
2024
|
-
cx:
|
|
2025
|
-
cy:
|
|
2026
|
-
ctrlX:
|
|
2060
|
+
cx: c,
|
|
2061
|
+
cy: l,
|
|
2062
|
+
ctrlX: d,
|
|
2027
2063
|
ctrlY: f
|
|
2028
2064
|
};
|
|
2029
2065
|
}
|
|
@@ -2035,32 +2071,28 @@ function G(e) {
|
|
|
2035
2071
|
y: n
|
|
2036
2072
|
};
|
|
2037
2073
|
}
|
|
2038
|
-
const
|
|
2039
|
-
const i = document.createElementNS(_, "text");
|
|
2040
|
-
return S(i, {
|
|
2041
|
-
"text-anchor": "middle",
|
|
2042
|
-
x: t + "",
|
|
2043
|
-
y: n + "",
|
|
2044
|
-
fill: o || "rgb(235, 95, 82)"
|
|
2045
|
-
}), i.dataset.type = "custom-link", i.innerHTML = e, i;
|
|
2046
|
-
}, Ce = function(e, t, n, o, i) {
|
|
2074
|
+
const Se = function(e, t, n, o, i) {
|
|
2047
2075
|
var w;
|
|
2048
2076
|
if (!t || !n)
|
|
2049
2077
|
return;
|
|
2050
|
-
const s =
|
|
2078
|
+
const s = ce(e, t, o.delta1), r = ce(e, n, o.delta2), { x: c, y: l } = G(s), { ctrlX: d, ctrlY: f } = s, { ctrlX: h, ctrlY: g } = r, { x: u, y: a } = G(r), p = ie(h, g, u, a);
|
|
2051
2079
|
if (!p)
|
|
2052
2080
|
return;
|
|
2053
|
-
const m = `M ${p.x1} ${p.y1} L ${
|
|
2081
|
+
const m = `M ${p.x1} ${p.y1} L ${u} ${a} L ${p.x2} ${p.y2}`;
|
|
2054
2082
|
let v = "";
|
|
2055
2083
|
if (o.bidirectional) {
|
|
2056
|
-
const E = ie(
|
|
2084
|
+
const E = ie(d, f, c, l);
|
|
2057
2085
|
if (!E)
|
|
2058
2086
|
return;
|
|
2059
|
-
v = `M ${E.x1} ${E.y1} L ${
|
|
2087
|
+
v = `M ${E.x1} ${E.y1} L ${c} ${l} L ${E.x2} ${E.y2}`;
|
|
2060
2088
|
}
|
|
2061
|
-
const b = Tt(`M ${
|
|
2062
|
-
|
|
2063
|
-
|
|
2089
|
+
const b = Tt(`M ${c} ${l} C ${d} ${f} ${h} ${g} ${u} ${a}`, m, v, o.style), { x, y: C } = rt(c, l, d, f, h, g, u, a), k = (w = o.style) == null ? void 0 : w.labelColor, y = ue(o.label, x, C, {
|
|
2090
|
+
anchor: "middle",
|
|
2091
|
+
color: k,
|
|
2092
|
+
dataType: "custom-link"
|
|
2093
|
+
});
|
|
2094
|
+
b.appendChild(y), b.label = y, b.arrowObj = o, b.dataset.linkid = o.id, e.linkSvgGroup.appendChild(b), i || (e.arrows.push(o), e.currentArrow = b, ct(e, o, s, r));
|
|
2095
|
+
}, Jn = function(e, t, n = {}) {
|
|
2064
2096
|
const o = {
|
|
2065
2097
|
id: K(),
|
|
2066
2098
|
label: "Custom Link",
|
|
@@ -2076,18 +2108,18 @@ const Jn = function(e, t, n, o) {
|
|
|
2076
2108
|
},
|
|
2077
2109
|
...n
|
|
2078
2110
|
};
|
|
2079
|
-
|
|
2111
|
+
Se(this, e, t, o), this.bus.fire("operation", {
|
|
2080
2112
|
name: "createArrow",
|
|
2081
2113
|
obj: o
|
|
2082
2114
|
});
|
|
2083
|
-
},
|
|
2115
|
+
}, Zn = function(e) {
|
|
2084
2116
|
ae(this);
|
|
2085
2117
|
const t = { ...e, id: K() };
|
|
2086
|
-
|
|
2118
|
+
Se(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2087
2119
|
name: "createArrow",
|
|
2088
2120
|
obj: t
|
|
2089
2121
|
});
|
|
2090
|
-
},
|
|
2122
|
+
}, Qn = function(e) {
|
|
2091
2123
|
let t;
|
|
2092
2124
|
if (e ? t = e : t = this.currentArrow, !t)
|
|
2093
2125
|
return;
|
|
@@ -2099,15 +2131,15 @@ const Jn = function(e, t, n, o) {
|
|
|
2099
2131
|
id: n
|
|
2100
2132
|
}
|
|
2101
2133
|
});
|
|
2102
|
-
},
|
|
2134
|
+
}, eo = function(e) {
|
|
2103
2135
|
this.currentArrow = e;
|
|
2104
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), i =
|
|
2105
|
-
|
|
2106
|
-
},
|
|
2136
|
+
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), i = ce(this, n, t.delta1), s = ce(this, o, t.delta2);
|
|
2137
|
+
ct(this, t, i, s);
|
|
2138
|
+
}, to = function() {
|
|
2107
2139
|
ae(this), this.currentArrow = null;
|
|
2108
2140
|
}, de = function(e, t) {
|
|
2109
|
-
const n = document.createElementNS(
|
|
2110
|
-
return
|
|
2141
|
+
const n = document.createElementNS(L, "path");
|
|
2142
|
+
return N(n, {
|
|
2111
2143
|
d: e,
|
|
2112
2144
|
stroke: t,
|
|
2113
2145
|
fill: "none",
|
|
@@ -2115,8 +2147,8 @@ const Jn = function(e, t, n, o) {
|
|
|
2115
2147
|
"stroke-linecap": "round",
|
|
2116
2148
|
"stroke-linejoin": "round"
|
|
2117
2149
|
}), n;
|
|
2118
|
-
},
|
|
2119
|
-
const n = document.createElementNS(
|
|
2150
|
+
}, no = function(e, t) {
|
|
2151
|
+
const n = document.createElementNS(L, "g");
|
|
2120
2152
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2121
2153
|
const o = de(e.line.getAttribute("d"), t);
|
|
2122
2154
|
n.appendChild(o);
|
|
@@ -2126,10 +2158,10 @@ const Jn = function(e, t, n, o) {
|
|
|
2126
2158
|
n.appendChild(s);
|
|
2127
2159
|
}
|
|
2128
2160
|
e.insertBefore(n, e.firstChild);
|
|
2129
|
-
},
|
|
2161
|
+
}, oo = function(e) {
|
|
2130
2162
|
const t = e.querySelector(".arrow-highlight");
|
|
2131
2163
|
t && t.remove();
|
|
2132
|
-
},
|
|
2164
|
+
}, io = function(e) {
|
|
2133
2165
|
const t = e.querySelector(".arrow-highlight");
|
|
2134
2166
|
if (!t)
|
|
2135
2167
|
return;
|
|
@@ -2137,35 +2169,35 @@ const Jn = function(e, t, n, o) {
|
|
|
2137
2169
|
n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
|
|
2138
2170
|
}, ae = function(e) {
|
|
2139
2171
|
var t, n;
|
|
2140
|
-
(t = e.helper1) == null || t.destroy(), (n = e.helper2) == null || n.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow &&
|
|
2141
|
-
},
|
|
2142
|
-
const { linkController: i, P2: s, P3: r, line1:
|
|
2143
|
-
if (!
|
|
2172
|
+
(t = e.helper1) == null || t.destroy(), (n = e.helper2) == null || n.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && oo(e.currentArrow);
|
|
2173
|
+
}, ct = function(e, t, n, o) {
|
|
2174
|
+
const { linkController: i, P2: s, P3: r, line1: c, line2: l, nodes: d, map: f, currentArrow: h, bus: g } = e;
|
|
2175
|
+
if (!h)
|
|
2144
2176
|
return;
|
|
2145
|
-
i.style.display = "initial", s.style.display = "initial", r.style.display = "initial",
|
|
2146
|
-
let { x:
|
|
2147
|
-
s.style.cssText = `top:${m}px;left:${p}px;`, r.style.cssText = `top:${b}px;left:${v}px;`, Q(
|
|
2177
|
+
i.style.display = "initial", s.style.display = "initial", r.style.display = "initial", d.appendChild(i), d.appendChild(s), d.appendChild(r), no(h, Un);
|
|
2178
|
+
let { x: u, y: a } = G(n), { ctrlX: p, ctrlY: m } = n, { ctrlX: v, ctrlY: b } = o, { x, y: C } = G(o);
|
|
2179
|
+
s.style.cssText = `top:${m}px;left:${p}px;`, r.style.cssText = `top:${b}px;left:${v}px;`, Q(c, u, a, p, m), Q(l, v, b, x, C), e.helper1 = We.create(s), e.helper2 = We.create(r), e.helper1.init(f, (k, y) => {
|
|
2148
2180
|
p = p + k / e.scaleVal, m = m + y / e.scaleVal;
|
|
2149
2181
|
const w = G({ ...n, ctrlX: p, ctrlY: m });
|
|
2150
|
-
|
|
2182
|
+
u = w.x, a = w.y, s.style.top = m + "px", s.style.left = p + "px", Ie(h, u, a, p, m, v, b, x, C, t), Q(c, u, a, p, m), t.delta1.x = p - n.cx, t.delta1.y = m - n.cy, g.fire("updateArrowDelta", t);
|
|
2151
2183
|
}), e.helper2.init(f, (k, y) => {
|
|
2152
2184
|
v = v + k / e.scaleVal, b = b + y / e.scaleVal;
|
|
2153
2185
|
const w = G({ ...o, ctrlX: v, ctrlY: b });
|
|
2154
|
-
x = w.x,
|
|
2186
|
+
x = w.x, C = w.y, r.style.top = b + "px", r.style.left = v + "px", Ie(h, u, a, p, m, v, b, x, C, t), Q(l, v, b, x, C), t.delta2.x = v - o.cx, t.delta2.y = b - o.cy, g.fire("updateArrowDelta", t);
|
|
2155
2187
|
});
|
|
2156
2188
|
};
|
|
2157
|
-
function
|
|
2189
|
+
function so() {
|
|
2158
2190
|
this.linkSvgGroup.innerHTML = "";
|
|
2159
2191
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
2160
2192
|
const t = this.arrows[e];
|
|
2161
2193
|
try {
|
|
2162
|
-
|
|
2194
|
+
Se(this, this.findEle(t.from), this.findEle(t.to), t, !0);
|
|
2163
2195
|
} catch {
|
|
2164
2196
|
}
|
|
2165
2197
|
}
|
|
2166
2198
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
2167
2199
|
}
|
|
2168
|
-
function
|
|
2200
|
+
function ro(e) {
|
|
2169
2201
|
if (ae(this), !e)
|
|
2170
2202
|
return;
|
|
2171
2203
|
const t = e.label;
|
|
@@ -2174,123 +2206,115 @@ function lo(e) {
|
|
|
2174
2206
|
function co() {
|
|
2175
2207
|
this.arrows = this.arrows.filter((e) => oe(e.from, this.nodeData) && oe(e.to, this.nodeData));
|
|
2176
2208
|
}
|
|
2177
|
-
const
|
|
2209
|
+
const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2178
2210
|
__proto__: null,
|
|
2179
|
-
createArrow:
|
|
2180
|
-
createArrowFrom:
|
|
2181
|
-
editArrowLabel:
|
|
2182
|
-
removeArrow:
|
|
2183
|
-
renderArrow:
|
|
2184
|
-
selectArrow:
|
|
2211
|
+
createArrow: Jn,
|
|
2212
|
+
createArrowFrom: Zn,
|
|
2213
|
+
editArrowLabel: ro,
|
|
2214
|
+
removeArrow: Qn,
|
|
2215
|
+
renderArrow: so,
|
|
2216
|
+
selectArrow: eo,
|
|
2185
2217
|
tidyArrow: co,
|
|
2186
|
-
unselectArrow:
|
|
2187
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2188
|
-
var
|
|
2218
|
+
unselectArrow: to
|
|
2219
|
+
}, Symbol.toStringTag, { value: "Module" })), ao = function(e) {
|
|
2220
|
+
var l, d;
|
|
2189
2221
|
if (e.length === 0)
|
|
2190
2222
|
throw new Error("No selected node.");
|
|
2191
2223
|
if (e.length === 1) {
|
|
2192
|
-
const f = e[0].nodeObj,
|
|
2193
|
-
if (!
|
|
2224
|
+
const f = e[0].nodeObj, h = e[0].nodeObj.parent;
|
|
2225
|
+
if (!h)
|
|
2194
2226
|
throw new Error("Can not select root node.");
|
|
2195
|
-
const g =
|
|
2227
|
+
const g = h.children.findIndex((u) => f === u);
|
|
2196
2228
|
return {
|
|
2197
|
-
parent:
|
|
2229
|
+
parent: h.id,
|
|
2198
2230
|
start: g,
|
|
2199
2231
|
end: g
|
|
2200
2232
|
};
|
|
2201
2233
|
}
|
|
2202
2234
|
let t = 0;
|
|
2203
2235
|
const n = e.map((f) => {
|
|
2204
|
-
let
|
|
2236
|
+
let h = f.nodeObj;
|
|
2205
2237
|
const g = [];
|
|
2206
|
-
for (;
|
|
2207
|
-
const
|
|
2208
|
-
|
|
2238
|
+
for (; h.parent; ) {
|
|
2239
|
+
const u = h.parent, a = u.children, p = a == null ? void 0 : a.indexOf(h);
|
|
2240
|
+
h = u, g.unshift({ node: h, index: p });
|
|
2209
2241
|
}
|
|
2210
2242
|
return g.length > t && (t = g.length), g;
|
|
2211
2243
|
});
|
|
2212
2244
|
let o = 0;
|
|
2213
2245
|
e:
|
|
2214
2246
|
for (; o < t; o++) {
|
|
2215
|
-
const f = (
|
|
2216
|
-
for (let
|
|
2217
|
-
if (((
|
|
2247
|
+
const f = (l = n[0][o]) == null ? void 0 : l.node;
|
|
2248
|
+
for (let h = 1; h < n.length; h++)
|
|
2249
|
+
if (((d = n[h][o]) == null ? void 0 : d.node) !== f)
|
|
2218
2250
|
break e;
|
|
2219
2251
|
}
|
|
2220
2252
|
if (!o)
|
|
2221
2253
|
throw new Error("Can not select root node.");
|
|
2222
|
-
const i = n.map((f) => f[o - 1].index).sort(), s = i[0] || 0, r = i[i.length - 1] || 0,
|
|
2223
|
-
if (!
|
|
2254
|
+
const i = n.map((f) => f[o - 1].index).sort(), s = i[0] || 0, r = i[i.length - 1] || 0, c = n[0][o - 1].node;
|
|
2255
|
+
if (!c.parent)
|
|
2224
2256
|
throw new Error("Please select nodes in the same main topic.");
|
|
2225
2257
|
return {
|
|
2226
|
-
parent:
|
|
2258
|
+
parent: c.id,
|
|
2227
2259
|
start: s,
|
|
2228
2260
|
end: r
|
|
2229
2261
|
};
|
|
2230
|
-
},
|
|
2231
|
-
const t = document.createElementNS(
|
|
2262
|
+
}, ho = function(e) {
|
|
2263
|
+
const t = document.createElementNS(L, "g");
|
|
2232
2264
|
return t.setAttribute("id", e), t;
|
|
2233
|
-
},
|
|
2234
|
-
const n = document.createElementNS(
|
|
2235
|
-
return
|
|
2265
|
+
}, Ke = function(e, t) {
|
|
2266
|
+
const n = document.createElementNS(L, "path");
|
|
2267
|
+
return N(n, {
|
|
2236
2268
|
d: e,
|
|
2237
2269
|
stroke: t || "#666",
|
|
2238
2270
|
fill: "none",
|
|
2239
2271
|
"stroke-linecap": "round",
|
|
2240
2272
|
"stroke-width": "2"
|
|
2241
2273
|
}), n;
|
|
2242
|
-
},
|
|
2243
|
-
const s = document.createElementNS(_, "text");
|
|
2244
|
-
return S(s, {
|
|
2245
|
-
"text-anchor": o,
|
|
2246
|
-
x: t + "",
|
|
2247
|
-
y: n + "",
|
|
2248
|
-
fill: i || "#666"
|
|
2249
|
-
}), s.innerHTML = e, s;
|
|
2250
|
-
}, fo = (e) => e.parentElement.parentElement, po = function(e, { parent: t, start: n }) {
|
|
2274
|
+
}, uo = (e) => e.parentElement.parentElement, fo = function(e, { parent: t, start: n }) {
|
|
2251
2275
|
const o = e.findEle(t), i = o.nodeObj;
|
|
2252
2276
|
let s;
|
|
2253
2277
|
return i.parent ? s = o.closest("me-main").className : s = e.findEle(i.children[n].id).closest("me-main").className, s;
|
|
2254
|
-
},
|
|
2278
|
+
}, Ne = function(e, t) {
|
|
2255
2279
|
var E;
|
|
2256
|
-
const { id: n, label: o, parent: i, start: s, end: r } = t, { nodes:
|
|
2257
|
-
let
|
|
2258
|
-
for (let
|
|
2259
|
-
const
|
|
2260
|
-
if (!
|
|
2280
|
+
const { id: n, label: o, parent: i, start: s, end: r } = t, { nodes: c, theme: l, summarySvg: d } = e, h = e.findEle(i).nodeObj, g = fo(e, t);
|
|
2281
|
+
let u = 1 / 0, a = 0, p = 0, m = 0;
|
|
2282
|
+
for (let S = s; S <= r; S++) {
|
|
2283
|
+
const P = (E = h.children) == null ? void 0 : E[S];
|
|
2284
|
+
if (!P)
|
|
2261
2285
|
return e.removeSummary(n), null;
|
|
2262
|
-
const B =
|
|
2263
|
-
|
|
2286
|
+
const B = uo(e.findEle(P.id)), { offsetLeft: R, offsetTop: ke } = H(c, B), _e = s === r ? 10 : 20;
|
|
2287
|
+
S === s && (p = ke + _e), S === r && (m = ke + B.offsetHeight - _e), R < u && (u = R), B.offsetWidth + R > a && (a = B.offsetWidth + R);
|
|
2264
2288
|
}
|
|
2265
2289
|
let v, b;
|
|
2266
|
-
const x = p + 10,
|
|
2267
|
-
g === M.LHS ? (v =
|
|
2268
|
-
const w =
|
|
2269
|
-
return w.appendChild(v), w.appendChild(b), w.summaryObj = t,
|
|
2270
|
-
},
|
|
2290
|
+
const x = p + 10, C = m + 10, k = (x + C) / 2, y = l.cssVar["--color"];
|
|
2291
|
+
g === M.LHS ? (v = Ke(`M ${u + 10} ${x} c -5 0 -10 5 -10 10 L ${u} ${C - 10} c 0 5 5 10 10 10 M ${u} ${k} h -10`, y), b = ue(o, u - 20, k + 6, { anchor: "end", color: y })) : (v = Ke(`M ${a - 10} ${x} c 5 0 10 5 10 10 L ${a} ${C - 10} c 0 5 -5 10 -10 10 M ${a} ${k} h 10`, y), b = ue(o, a + 20, k + 6, { anchor: "start", color: y }));
|
|
2292
|
+
const w = ho("s-" + n);
|
|
2293
|
+
return w.appendChild(v), w.appendChild(b), w.summaryObj = t, d.appendChild(w), w;
|
|
2294
|
+
}, po = function() {
|
|
2271
2295
|
if (!this.currentNodes)
|
|
2272
2296
|
return;
|
|
2273
|
-
const { currentNodes: e, summaries: t, bus: n } = this, { parent: o, start: i, end: s } =
|
|
2274
|
-
t.push(r), this.editSummary(
|
|
2297
|
+
const { currentNodes: e, summaries: t, bus: n } = this, { parent: o, start: i, end: s } = ao(e), r = { id: K(), parent: o, start: i, end: s, label: "summary" }, c = Ne(this, r);
|
|
2298
|
+
t.push(r), this.editSummary(c), n.fire("operation", {
|
|
2275
2299
|
name: "createSummary",
|
|
2276
2300
|
obj: r
|
|
2277
2301
|
});
|
|
2278
|
-
},
|
|
2302
|
+
}, go = function(e) {
|
|
2279
2303
|
const t = K(), n = { ...e, id: t };
|
|
2280
|
-
|
|
2304
|
+
Ne(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2281
2305
|
name: "createSummary",
|
|
2282
2306
|
obj: n
|
|
2283
2307
|
});
|
|
2284
|
-
},
|
|
2308
|
+
}, mo = function(e) {
|
|
2285
2309
|
var n;
|
|
2286
2310
|
const t = this.summaries.findIndex((o) => o.id === e);
|
|
2287
2311
|
t > -1 && (this.summaries.splice(t, 1), (n = document.querySelector("#s-" + e)) == null || n.remove()), this.bus.fire("operation", {
|
|
2288
2312
|
name: "removeSummary",
|
|
2289
2313
|
obj: { id: e }
|
|
2290
2314
|
});
|
|
2291
|
-
},
|
|
2292
|
-
const t = e.children[1].getBBox(), n = 6, o = 3, i = document.createElementNS(
|
|
2293
|
-
|
|
2315
|
+
}, vo = function(e) {
|
|
2316
|
+
const t = e.children[1].getBBox(), n = 6, o = 3, i = document.createElementNS(L, "rect");
|
|
2317
|
+
N(i, {
|
|
2294
2318
|
x: t.x - n + "",
|
|
2295
2319
|
y: t.y - n + "",
|
|
2296
2320
|
width: t.width + n * 2 + "",
|
|
@@ -2300,80 +2324,80 @@ const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2300
2324
|
"stroke-width": "2",
|
|
2301
2325
|
fill: "none"
|
|
2302
2326
|
}), e.appendChild(i), this.currentSummary = e;
|
|
2303
|
-
},
|
|
2327
|
+
}, bo = function() {
|
|
2304
2328
|
var e, t;
|
|
2305
2329
|
(t = (e = this.currentSummary) == null ? void 0 : e.querySelector("rect")) == null || t.remove(), this.currentSummary = null;
|
|
2306
|
-
},
|
|
2330
|
+
}, yo = function() {
|
|
2307
2331
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2308
2332
|
try {
|
|
2309
|
-
|
|
2333
|
+
Ne(this, e);
|
|
2310
2334
|
} catch {
|
|
2311
2335
|
}
|
|
2312
2336
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2313
|
-
},
|
|
2337
|
+
}, wo = function(e) {
|
|
2314
2338
|
if (!e)
|
|
2315
2339
|
return;
|
|
2316
2340
|
const t = e.childNodes[1];
|
|
2317
2341
|
Ue(this, t, e.summaryObj);
|
|
2318
|
-
},
|
|
2342
|
+
}, xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2319
2343
|
__proto__: null,
|
|
2320
|
-
createSummary:
|
|
2321
|
-
createSummaryFrom:
|
|
2322
|
-
editSummary:
|
|
2323
|
-
removeSummary:
|
|
2324
|
-
renderSummary:
|
|
2325
|
-
selectSummary:
|
|
2326
|
-
unselectSummary:
|
|
2327
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2328
|
-
function
|
|
2329
|
-
const n = document.createElementNS(
|
|
2330
|
-
return
|
|
2344
|
+
createSummary: po,
|
|
2345
|
+
createSummaryFrom: go,
|
|
2346
|
+
editSummary: wo,
|
|
2347
|
+
removeSummary: mo,
|
|
2348
|
+
renderSummary: yo,
|
|
2349
|
+
selectSummary: vo,
|
|
2350
|
+
unselectSummary: bo
|
|
2351
|
+
}, Symbol.toStringTag, { value: "Module" })), _ = "http://www.w3.org/2000/svg";
|
|
2352
|
+
function Eo(e, t) {
|
|
2353
|
+
const n = document.createElementNS(_, "svg");
|
|
2354
|
+
return N(n, {
|
|
2331
2355
|
version: "1.1",
|
|
2332
|
-
xmlns:
|
|
2356
|
+
xmlns: _,
|
|
2333
2357
|
height: e,
|
|
2334
2358
|
width: t
|
|
2335
2359
|
}), n;
|
|
2336
2360
|
}
|
|
2337
|
-
function
|
|
2361
|
+
function Co(e, t) {
|
|
2338
2362
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2339
2363
|
}
|
|
2340
|
-
function
|
|
2341
|
-
const i = document.createElementNS(
|
|
2364
|
+
function So(e, t, n, o) {
|
|
2365
|
+
const i = document.createElementNS(_, "g");
|
|
2342
2366
|
let s = "";
|
|
2343
2367
|
return e.text ? s = e.text.textContent : s = e.childNodes[0].textContent, s.split(`
|
|
2344
|
-
`).forEach((
|
|
2345
|
-
const
|
|
2346
|
-
|
|
2368
|
+
`).forEach((c, l) => {
|
|
2369
|
+
const d = document.createElementNS(_, "text");
|
|
2370
|
+
N(d, {
|
|
2347
2371
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2348
|
-
y: o + parseInt(t.paddingTop) +
|
|
2372
|
+
y: o + parseInt(t.paddingTop) + Co(t.lineHeight, t.fontSize) * (l + 1) + parseFloat(t.fontSize) * (l + 1) + "",
|
|
2349
2373
|
"text-anchor": "start",
|
|
2350
2374
|
"font-family": t.fontFamily,
|
|
2351
2375
|
"font-size": `${t.fontSize}`,
|
|
2352
2376
|
"font-weight": `${t.fontWeight}`,
|
|
2353
2377
|
fill: `${t.color}`
|
|
2354
|
-
}),
|
|
2378
|
+
}), d.innerHTML = c, i.appendChild(d);
|
|
2355
2379
|
}), i;
|
|
2356
2380
|
}
|
|
2357
|
-
function
|
|
2358
|
-
var
|
|
2381
|
+
function No(e, t, n, o) {
|
|
2382
|
+
var c;
|
|
2359
2383
|
let i = "";
|
|
2360
|
-
(
|
|
2361
|
-
const s = document.createElementNS(
|
|
2362
|
-
|
|
2384
|
+
(c = e.nodeObj) != null && c.dangerouslySetInnerHTML ? i = e.nodeObj.dangerouslySetInnerHTML : e.text ? i = e.text.textContent : i = e.childNodes[0].textContent;
|
|
2385
|
+
const s = document.createElementNS(_, "foreignObject");
|
|
2386
|
+
N(s, {
|
|
2363
2387
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2364
2388
|
y: o + parseInt(t.paddingTop) + "",
|
|
2365
2389
|
width: t.width,
|
|
2366
2390
|
height: t.height
|
|
2367
2391
|
});
|
|
2368
2392
|
const r = document.createElement("div");
|
|
2369
|
-
return
|
|
2393
|
+
return N(r, {
|
|
2370
2394
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
2371
2395
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2372
2396
|
}), r.innerHTML = i, s.appendChild(r), s;
|
|
2373
2397
|
}
|
|
2374
|
-
function
|
|
2375
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(
|
|
2376
|
-
return
|
|
2398
|
+
function ko(e, t) {
|
|
2399
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(_, "rect");
|
|
2400
|
+
return N(s, {
|
|
2377
2401
|
x: o + "",
|
|
2378
2402
|
y: i + "",
|
|
2379
2403
|
rx: n.borderRadius,
|
|
@@ -2386,8 +2410,8 @@ function _o(e, t) {
|
|
|
2386
2410
|
}), s;
|
|
2387
2411
|
}
|
|
2388
2412
|
function ee(e, t, n = !1) {
|
|
2389
|
-
const o = getComputedStyle(t), { offsetLeft: i, offsetTop: s } = H(e.nodes, t), r = document.createElementNS(
|
|
2390
|
-
|
|
2413
|
+
const o = getComputedStyle(t), { offsetLeft: i, offsetTop: s } = H(e.nodes, t), r = document.createElementNS(_, "rect");
|
|
2414
|
+
N(r, {
|
|
2391
2415
|
x: i + "",
|
|
2392
2416
|
y: s + "",
|
|
2393
2417
|
rx: o.borderRadius,
|
|
@@ -2398,14 +2422,14 @@ function ee(e, t, n = !1) {
|
|
|
2398
2422
|
stroke: o.borderColor,
|
|
2399
2423
|
"stroke-width": o.borderWidth
|
|
2400
2424
|
});
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2403
|
-
let
|
|
2404
|
-
return n ?
|
|
2425
|
+
const c = document.createElementNS(_, "g");
|
|
2426
|
+
c.appendChild(r);
|
|
2427
|
+
let l;
|
|
2428
|
+
return n ? l = No(t, o, i, s) : l = So(t, o, i, s), c.appendChild(l), c;
|
|
2405
2429
|
}
|
|
2406
|
-
function
|
|
2407
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(
|
|
2408
|
-
return
|
|
2430
|
+
function _o(e, t) {
|
|
2431
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(_, "a"), r = document.createElementNS(_, "text");
|
|
2432
|
+
return N(r, {
|
|
2409
2433
|
x: o + "",
|
|
2410
2434
|
y: i + parseInt(n.fontSize) + "",
|
|
2411
2435
|
"text-anchor": "start",
|
|
@@ -2415,9 +2439,9 @@ function To(e, t) {
|
|
|
2415
2439
|
fill: `${n.color}`
|
|
2416
2440
|
}), r.innerHTML = t.textContent, s.appendChild(r), s.setAttribute("href", t.href), s;
|
|
2417
2441
|
}
|
|
2418
|
-
function
|
|
2419
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(
|
|
2420
|
-
return
|
|
2442
|
+
function To(e, t) {
|
|
2443
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: i } = H(e.nodes, t), s = document.createElementNS(_, "image");
|
|
2444
|
+
return N(s, {
|
|
2421
2445
|
x: o + "",
|
|
2422
2446
|
y: i + "",
|
|
2423
2447
|
width: n.width + "",
|
|
@@ -2425,41 +2449,41 @@ function Lo(e, t) {
|
|
|
2425
2449
|
href: t.src
|
|
2426
2450
|
}), s;
|
|
2427
2451
|
}
|
|
2428
|
-
const te = 100,
|
|
2429
|
-
var
|
|
2430
|
-
const n = e.nodes, o = n.offsetHeight + te * 2, i = n.offsetWidth + te * 2, s =
|
|
2431
|
-
|
|
2452
|
+
const te = 100, Lo = '<?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">', Ao = (e, t = !1) => {
|
|
2453
|
+
var h, g, u;
|
|
2454
|
+
const n = e.nodes, o = n.offsetHeight + te * 2, i = n.offsetWidth + te * 2, s = Eo(o + "px", i + "px"), r = document.createElementNS(_, "svg"), c = document.createElementNS(_, "rect");
|
|
2455
|
+
N(c, {
|
|
2432
2456
|
x: "0",
|
|
2433
2457
|
y: "0",
|
|
2434
2458
|
width: `${i}`,
|
|
2435
2459
|
height: `${o}`,
|
|
2436
2460
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2437
|
-
}), s.appendChild(
|
|
2438
|
-
const p =
|
|
2461
|
+
}), s.appendChild(c), n.querySelectorAll(".subLines").forEach((a) => {
|
|
2462
|
+
const p = a.cloneNode(!0), { offsetLeft: m, offsetTop: v } = H(n, a.parentElement);
|
|
2439
2463
|
p.setAttribute("x", `${m}`), p.setAttribute("y", `${v}`), r.appendChild(p);
|
|
2440
2464
|
});
|
|
2441
|
-
const
|
|
2465
|
+
const l = (h = n.querySelector(".lines")) == null ? void 0 : h.cloneNode(!0);
|
|
2466
|
+
l && r.appendChild(l);
|
|
2467
|
+
const d = (g = n.querySelector(".topiclinks")) == null ? void 0 : g.cloneNode(!0);
|
|
2442
2468
|
d && r.appendChild(d);
|
|
2443
|
-
const
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
}), n.querySelectorAll(".
|
|
2449
|
-
r.appendChild(ee(e,
|
|
2450
|
-
}), n.querySelectorAll(".
|
|
2451
|
-
r.appendChild(
|
|
2452
|
-
}), n.querySelectorAll("
|
|
2453
|
-
r.appendChild(To(e,
|
|
2454
|
-
}),
|
|
2455
|
-
r.appendChild(Lo(e, c));
|
|
2456
|
-
}), S(r, {
|
|
2469
|
+
const f = (u = n.querySelector(".summary")) == null ? void 0 : u.cloneNode(!0);
|
|
2470
|
+
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((a) => {
|
|
2471
|
+
a.nodeObj.dangerouslySetInnerHTML ? r.appendChild(ee(e, a, !t)) : (r.appendChild(ko(e, a)), r.appendChild(ee(e, a.text, !t)));
|
|
2472
|
+
}), n.querySelectorAll(".tags > span").forEach((a) => {
|
|
2473
|
+
r.appendChild(ee(e, a));
|
|
2474
|
+
}), n.querySelectorAll(".icons > span").forEach((a) => {
|
|
2475
|
+
r.appendChild(ee(e, a));
|
|
2476
|
+
}), n.querySelectorAll(".hyper-link").forEach((a) => {
|
|
2477
|
+
r.appendChild(_o(e, a));
|
|
2478
|
+
}), n.querySelectorAll("img").forEach((a) => {
|
|
2479
|
+
r.appendChild(To(e, a));
|
|
2480
|
+
}), N(r, {
|
|
2457
2481
|
x: te + "",
|
|
2458
2482
|
y: te + "",
|
|
2459
2483
|
overflow: "visible"
|
|
2460
2484
|
}), s.appendChild(r), s;
|
|
2461
|
-
},
|
|
2462
|
-
function
|
|
2485
|
+
}, Mo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Lo + e.outerHTML);
|
|
2486
|
+
function Do(e) {
|
|
2463
2487
|
return new Promise((t, n) => {
|
|
2464
2488
|
const o = new FileReader();
|
|
2465
2489
|
o.onload = (i) => {
|
|
@@ -2469,35 +2493,35 @@ function Oo(e) {
|
|
|
2469
2493
|
}, o.readAsDataURL(e);
|
|
2470
2494
|
});
|
|
2471
2495
|
}
|
|
2472
|
-
const
|
|
2473
|
-
const n =
|
|
2496
|
+
const Po = function(e = !1, t) {
|
|
2497
|
+
const n = Ao(this, e), o = Mo(n, t);
|
|
2474
2498
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2475
|
-
},
|
|
2476
|
-
const n = this.exportSvg(e, t), o = await
|
|
2499
|
+
}, $o = async function(e = !1, t) {
|
|
2500
|
+
const n = this.exportSvg(e, t), o = await Do(n);
|
|
2477
2501
|
return new Promise((i, s) => {
|
|
2478
2502
|
const r = new Image();
|
|
2479
2503
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
2480
|
-
const
|
|
2481
|
-
|
|
2504
|
+
const c = document.createElement("canvas");
|
|
2505
|
+
c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(i, "image/png", 1);
|
|
2482
2506
|
}, r.src = o, r.onerror = s;
|
|
2483
2507
|
});
|
|
2484
|
-
},
|
|
2508
|
+
}, Oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2485
2509
|
__proto__: null,
|
|
2486
|
-
exportPng:
|
|
2487
|
-
exportSvg:
|
|
2510
|
+
exportPng: $o,
|
|
2511
|
+
exportSvg: Po
|
|
2488
2512
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2489
|
-
function
|
|
2513
|
+
function jo(e, t) {
|
|
2490
2514
|
return async function(...n) {
|
|
2491
2515
|
const o = this.before[t];
|
|
2492
2516
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2493
2517
|
};
|
|
2494
2518
|
}
|
|
2495
|
-
const Ye = Object.keys(it),
|
|
2519
|
+
const Ye = Object.keys(it), lt = {};
|
|
2496
2520
|
for (let e = 0; e < Ye.length; e++) {
|
|
2497
2521
|
const t = Ye[e];
|
|
2498
|
-
|
|
2522
|
+
lt[t] = jo(it[t], t);
|
|
2499
2523
|
}
|
|
2500
|
-
const
|
|
2524
|
+
const Ho = {
|
|
2501
2525
|
getObjById: oe,
|
|
2502
2526
|
generateNewObj: ht,
|
|
2503
2527
|
layout: wt,
|
|
@@ -2507,41 +2531,41 @@ const Bo = {
|
|
|
2507
2531
|
createParent: St,
|
|
2508
2532
|
createChildren: Nt,
|
|
2509
2533
|
createTopic: kt,
|
|
2510
|
-
findEle:
|
|
2534
|
+
findEle: qe,
|
|
2511
2535
|
changeTheme: tn,
|
|
2512
|
-
...
|
|
2513
|
-
...
|
|
2514
|
-
...
|
|
2515
|
-
...
|
|
2516
|
-
|
|
2536
|
+
...zn,
|
|
2537
|
+
...lt,
|
|
2538
|
+
...lo,
|
|
2539
|
+
...xo,
|
|
2540
|
+
...Oo,
|
|
2517
2541
|
init(e) {
|
|
2518
2542
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData)
|
|
2519
2543
|
return new Error("MindElixir: `data` is required");
|
|
2520
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
2544
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, j(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && zt(this), this.keypress && vt(this, this.keypress), this.editable && en(this), this.contextMenu && this.disposable.push(At(this, this.contextMenu)), this.draggable && this.disposable.push($t(this)), this.allowUndo && this.disposable.push(jt(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2521
2545
|
},
|
|
2522
2546
|
destroy() {
|
|
2523
2547
|
var e;
|
|
2524
2548
|
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, (e = this.selection) == null || e.destroy(), this.selection = void 0;
|
|
2525
2549
|
}
|
|
2526
2550
|
};
|
|
2527
|
-
function
|
|
2551
|
+
function Bo({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: r, cH: c, direction: l, containerHeight: d }) {
|
|
2528
2552
|
let f = t + n / 2;
|
|
2529
|
-
const
|
|
2553
|
+
const h = e + o / 2;
|
|
2530
2554
|
let g;
|
|
2531
|
-
|
|
2532
|
-
const
|
|
2533
|
-
return
|
|
2555
|
+
l === M.LHS ? g = s + r : g = s;
|
|
2556
|
+
const u = i + c / 2, p = (1 - Math.abs(u - h) / d) * 0.25 * (n / 2);
|
|
2557
|
+
return l === M.LHS ? f = f - n / 10 - p : f = f + n / 10 + p, `M ${f} ${h} Q ${f} ${u} ${g} ${u}`;
|
|
2534
2558
|
}
|
|
2535
|
-
function
|
|
2559
|
+
function Ro({ pT: e, pL: t, pW: n, pH: o, cT: i, cL: s, cW: r, cH: c, direction: l, isFirst: d }) {
|
|
2536
2560
|
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2537
|
-
let
|
|
2538
|
-
|
|
2539
|
-
const
|
|
2540
|
-
let
|
|
2541
|
-
const v = Math.abs(
|
|
2542
|
-
return
|
|
2561
|
+
let h = 0, g = 0;
|
|
2562
|
+
d ? h = e + o / 2 : h = e + o;
|
|
2563
|
+
const u = i + c;
|
|
2564
|
+
let a = 0, p = 0, m = 0;
|
|
2565
|
+
const v = Math.abs(h - u) / 300 * f;
|
|
2566
|
+
return l === M.LHS ? (m = t, a = m + f, p = m - f, g = s + f, `M ${a} ${h} C ${m} ${h} ${m + v} ${u} ${p} ${u} H ${g}`) : (m = t + n, a = m - f, p = m + f, g = s + r - f, `M ${a} ${h} C ${m} ${h} ${m - v} ${u} ${p} ${u} H ${g}`);
|
|
2543
2567
|
}
|
|
2544
|
-
const
|
|
2568
|
+
const Fo = "5.0.6";
|
|
2545
2569
|
function Wo(e) {
|
|
2546
2570
|
return {
|
|
2547
2571
|
x: 0,
|
|
@@ -2553,7 +2577,7 @@ function Wo(e) {
|
|
|
2553
2577
|
this.mousedown && (this.moved = !0, e.move(t, n));
|
|
2554
2578
|
},
|
|
2555
2579
|
clear() {
|
|
2556
|
-
this.mousedown = !1
|
|
2580
|
+
this.mousedown = !1;
|
|
2557
2581
|
}
|
|
2558
2582
|
};
|
|
2559
2583
|
}
|
|
@@ -2566,35 +2590,33 @@ function D({
|
|
|
2566
2590
|
editable: i,
|
|
2567
2591
|
contextMenu: s,
|
|
2568
2592
|
toolBar: r,
|
|
2569
|
-
keypress:
|
|
2570
|
-
mouseSelectionButton:
|
|
2571
|
-
selectionContainer:
|
|
2593
|
+
keypress: c,
|
|
2594
|
+
mouseSelectionButton: l,
|
|
2595
|
+
selectionContainer: d,
|
|
2572
2596
|
before: f,
|
|
2573
|
-
newTopicName:
|
|
2597
|
+
newTopicName: h,
|
|
2574
2598
|
allowUndo: g,
|
|
2575
|
-
generateMainBranch:
|
|
2576
|
-
generateSubBranch:
|
|
2599
|
+
generateMainBranch: u,
|
|
2600
|
+
generateSubBranch: a,
|
|
2577
2601
|
overflowHidden: p,
|
|
2578
2602
|
theme: m,
|
|
2579
2603
|
alignment: v,
|
|
2580
2604
|
scaleSensitivity: b,
|
|
2581
2605
|
scaleMax: x,
|
|
2582
|
-
scaleMin:
|
|
2606
|
+
scaleMin: C,
|
|
2583
2607
|
handleWheel: k
|
|
2584
2608
|
}) {
|
|
2585
2609
|
let y = null;
|
|
2586
2610
|
const w = Object.prototype.toString.call(e);
|
|
2587
2611
|
if (w === "[object HTMLDivElement]" ? y = e : w === "[object String]" && (y = document.querySelector(e)), !y)
|
|
2588
2612
|
throw new Error("MindElixir: el is not a valid element");
|
|
2589
|
-
y.style.position = "relative", y.innerHTML = "", this.el = y, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.newTopicName =
|
|
2613
|
+
y.style.position = "relative", y.innerHTML = "", this.el = y, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.newTopicName = h || "New Node", this.contextMenu = s ?? !0, this.toolBar = r ?? !0, this.keypress = c ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = i ?? !0, this.allowUndo = g ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = x ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = u || Bo, this.generateSubBranch = a || Ro, this.overflowHidden = p ?? !1, this.alignment = v ?? "root", this.handleWheel = k ?? !0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Wo(this), this.bus = yt(), this.container = U.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
|
|
2590
2614
|
const E = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2591
|
-
this.theme = m || (E.matches ?
|
|
2592
|
-
const
|
|
2593
|
-
|
|
2594
|
-
C.style.transition = "all 0.3s";
|
|
2595
|
-
}, 300), this.map = C, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = U.createElement("me-nodes"), this.lines = X("lines"), this.summarySvg = X("summary"), this.linkController = X("linkcontroller"), this.P2 = U.createElement("div"), this.P3 = U.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Le(), this.line2 = Le(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = X("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(bt(this));
|
|
2615
|
+
this.theme = m || (E.matches ? ve : me);
|
|
2616
|
+
const S = U.createElement("div");
|
|
2617
|
+
S.className = "map-canvas", this.map = S, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = U.createElement("me-nodes"), this.lines = X("lines"), this.summarySvg = X("summary"), this.linkController = X("linkcontroller"), this.P2 = U.createElement("div"), this.P3 = U.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Ae(), this.line2 = Ae(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = X("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(bt(this));
|
|
2596
2618
|
}
|
|
2597
|
-
D.prototype =
|
|
2619
|
+
D.prototype = Ho;
|
|
2598
2620
|
Object.defineProperty(D.prototype, "currentNode", {
|
|
2599
2621
|
get() {
|
|
2600
2622
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
@@ -2604,10 +2626,10 @@ Object.defineProperty(D.prototype, "currentNode", {
|
|
|
2604
2626
|
D.LEFT = 0;
|
|
2605
2627
|
D.RIGHT = 1;
|
|
2606
2628
|
D.SIDE = 2;
|
|
2607
|
-
D.THEME =
|
|
2608
|
-
D.DARK_THEME =
|
|
2609
|
-
D.version =
|
|
2610
|
-
D.E =
|
|
2629
|
+
D.THEME = me;
|
|
2630
|
+
D.DARK_THEME = ve;
|
|
2631
|
+
D.version = Fo;
|
|
2632
|
+
D.E = qe;
|
|
2611
2633
|
D.new = (e) => ({
|
|
2612
2634
|
nodeData: {
|
|
2613
2635
|
id: K(),
|