mind-elixir 5.2.0-beta.5 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +6 -6
- package/dist/MindElixir.js +747 -743
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +276 -278
- package/dist/example.iife.js +3 -4
- package/dist/example.js +3 -24
- package/dist/style.css +1 -1
- package/dist/types/summary.d.ts +1 -1
- package/dist/types/types/dom.d.ts +0 -1
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +106 -107
- package/readme/es.md +430 -0
- package/readme/fr.md +430 -0
- package/readme/ja.md +429 -0
- package/readme/ko.md +430 -0
- package/readme/pt.md +430 -0
- package/readme/ru.md +430 -0
- package/readme/zh.md +430 -0
package/dist/MindElixir.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var pt = Object.defineProperty;
|
|
2
2
|
var gt = (e, t, n) => t in e ? pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
3
|
+
var X = (e, t, n) => (gt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
4
|
const we = {
|
|
5
5
|
name: "Latte",
|
|
6
6
|
type: "light",
|
|
@@ -57,12 +57,12 @@ const we = {
|
|
|
57
57
|
function pe(e) {
|
|
58
58
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const ie = function(e, t) {
|
|
61
61
|
if (t.id === e)
|
|
62
62
|
return t;
|
|
63
63
|
if (t.children && t.children.length) {
|
|
64
64
|
for (let n = 0; n < t.children.length; n++) {
|
|
65
|
-
const o =
|
|
65
|
+
const o = ie(e, t.children[n]);
|
|
66
66
|
if (o)
|
|
67
67
|
return o;
|
|
68
68
|
}
|
|
@@ -77,8 +77,8 @@ const se = function(e, t) {
|
|
|
77
77
|
if (e.expanded = t, e.children)
|
|
78
78
|
if (n === void 0 || n > 0) {
|
|
79
79
|
const o = n !== void 0 ? n - 1 : void 0;
|
|
80
|
-
e.children.forEach((
|
|
81
|
-
Y(
|
|
80
|
+
e.children.forEach((s) => {
|
|
81
|
+
Y(s, t, o);
|
|
82
82
|
});
|
|
83
83
|
} else
|
|
84
84
|
e.children.forEach((o) => {
|
|
@@ -91,17 +91,17 @@ function Ce(e) {
|
|
|
91
91
|
Ce(e.children[t]);
|
|
92
92
|
}
|
|
93
93
|
function re(e, t, n, o) {
|
|
94
|
-
const
|
|
95
|
-
let l = Math.atan(Math.abs(
|
|
94
|
+
const s = o - t, i = e - n;
|
|
95
|
+
let l = Math.atan(Math.abs(s) / Math.abs(i)) / 3.14 * 180;
|
|
96
96
|
if (isNaN(l))
|
|
97
97
|
return;
|
|
98
|
-
|
|
99
|
-
const r = 12, c = 30,
|
|
98
|
+
i < 0 && s > 0 && (l = 180 - l), i < 0 && s < 0 && (l = 180 + l), i > 0 && s < 0 && (l = 360 - l);
|
|
99
|
+
const r = 12, c = 30, d = l + c, f = l - c;
|
|
100
100
|
return {
|
|
101
|
-
x1: n + Math.cos(Math.PI *
|
|
102
|
-
y1: o - Math.sin(Math.PI *
|
|
103
|
-
x2: n + Math.cos(Math.PI *
|
|
104
|
-
y2: o - Math.sin(Math.PI *
|
|
101
|
+
x1: n + Math.cos(Math.PI * d / 180) * r,
|
|
102
|
+
y1: o - Math.sin(Math.PI * d / 180) * r,
|
|
103
|
+
x2: n + Math.cos(Math.PI * f / 180) * r,
|
|
104
|
+
y2: o - Math.sin(Math.PI * f / 180) * r
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
function I() {
|
|
@@ -131,26 +131,26 @@ const O = (e, t) => {
|
|
|
131
131
|
for (const n in t)
|
|
132
132
|
e.setAttribute(n, t[n]);
|
|
133
133
|
}, ge = (e) => e ? e.tagName === "ME-TPC" : !1, de = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
134
|
-
for (let
|
|
135
|
-
if (t === o[
|
|
134
|
+
for (let s = 0; s < o.length; s++) {
|
|
135
|
+
if (t === o[s])
|
|
136
136
|
continue;
|
|
137
|
-
const { parent:
|
|
138
|
-
if (
|
|
137
|
+
const { parent: i } = t.nodeObj;
|
|
138
|
+
if (i === o[s].nodeObj)
|
|
139
139
|
return !1;
|
|
140
140
|
}
|
|
141
141
|
return !0;
|
|
142
|
-
}),
|
|
142
|
+
}), Xe = (e) => {
|
|
143
143
|
const t = /translate\(([^,]+),\s*([^)]+)\)/, n = e.match(t);
|
|
144
144
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
145
145
|
}, Se = function(e) {
|
|
146
146
|
for (let t = 0; t < e.length; t++) {
|
|
147
|
-
const { dom: n, evt: o, func:
|
|
148
|
-
n.addEventListener(o,
|
|
147
|
+
const { dom: n, evt: o, func: s } = e[t];
|
|
148
|
+
n.addEventListener(o, s);
|
|
149
149
|
}
|
|
150
150
|
return function() {
|
|
151
151
|
for (let n = 0; n < e.length; n++) {
|
|
152
|
-
const { dom: o, evt:
|
|
153
|
-
o.removeEventListener(
|
|
152
|
+
const { dom: o, evt: s, func: i } = e[n];
|
|
153
|
+
o.removeEventListener(s, i);
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
};
|
|
@@ -158,10 +158,10 @@ var D = /* @__PURE__ */ ((e) => (e.LHS = "lhs", e.RHS = "rhs", e))(D || {});
|
|
|
158
158
|
const vt = (e) => {
|
|
159
159
|
const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
|
|
160
160
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
161
|
-
},
|
|
161
|
+
}, yt = (e) => {
|
|
162
162
|
const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
|
|
163
163
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
164
|
-
},
|
|
164
|
+
}, bt = (e) => {
|
|
165
165
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
166
166
|
}, wt = function(e, t) {
|
|
167
167
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
@@ -176,26 +176,26 @@ const vt = (e) => {
|
|
|
176
176
|
e.selectNode(o);
|
|
177
177
|
}
|
|
178
178
|
}, Pe = function(e, t) {
|
|
179
|
-
var
|
|
180
|
-
const n = e.currentNode || ((
|
|
179
|
+
var i, l;
|
|
180
|
+
const n = e.currentNode || ((i = e.currentNodes) == null ? void 0 : i[0]);
|
|
181
181
|
if (!n)
|
|
182
182
|
return;
|
|
183
|
-
const o = n.nodeObj,
|
|
184
|
-
o.parent ?
|
|
183
|
+
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
184
|
+
o.parent ? s.className === t ? xt(e, n) : (l = o.parent) != null && l.parent ? wt(e, n) : bt(e) : t === D.LHS ? vt(e) : yt(e);
|
|
185
185
|
}, $e = function(e, t) {
|
|
186
186
|
const n = e.currentNode;
|
|
187
187
|
if (!n || !n.nodeObj.parent)
|
|
188
188
|
return;
|
|
189
|
-
const
|
|
190
|
-
|
|
189
|
+
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
190
|
+
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
191
191
|
}, le = function(e, t, n) {
|
|
192
|
-
const { scaleVal: o, scaleSensitivity:
|
|
192
|
+
const { scaleVal: o, scaleSensitivity: s } = e;
|
|
193
193
|
switch (t) {
|
|
194
194
|
case "in":
|
|
195
|
-
e.scale(o +
|
|
195
|
+
e.scale(o + s, n);
|
|
196
196
|
break;
|
|
197
197
|
case "out":
|
|
198
|
-
e.scale(o -
|
|
198
|
+
e.scale(o - s, n);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
function Ct(e, t) {
|
|
@@ -203,19 +203,19 @@ function Ct(e, t) {
|
|
|
203
203
|
const n = () => {
|
|
204
204
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
205
205
|
};
|
|
206
|
-
let o = !1,
|
|
207
|
-
const
|
|
206
|
+
let o = !1, s = null;
|
|
207
|
+
const i = (r) => {
|
|
208
208
|
const c = e.nodeData;
|
|
209
209
|
if (r.key === "0")
|
|
210
|
-
for (const
|
|
211
|
-
Y(
|
|
210
|
+
for (const d of c.children)
|
|
211
|
+
Y(d, !1);
|
|
212
212
|
if (r.key === "=")
|
|
213
|
-
for (const
|
|
214
|
-
Y(
|
|
213
|
+
for (const d of c.children)
|
|
214
|
+
Y(d, !0);
|
|
215
215
|
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
|
|
216
|
-
for (const
|
|
217
|
-
Y(
|
|
218
|
-
e.refresh(), e.toCenter(), o = !1,
|
|
216
|
+
for (const d of c.children)
|
|
217
|
+
Y(d, !0, Number(r.key) - 1);
|
|
218
|
+
e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
|
|
219
219
|
}, l = {
|
|
220
220
|
Enter: (r) => {
|
|
221
221
|
r.shiftKey ? e.insertSibling("before") : r.ctrlKey || r.metaKey ? e.insertParent() : e.insertSibling("after");
|
|
@@ -278,9 +278,9 @@ function Ct(e, t) {
|
|
|
278
278
|
}
|
|
279
279
|
},
|
|
280
280
|
k: (r) => {
|
|
281
|
-
(r.metaKey || r.ctrlKey) && (o = !0,
|
|
282
|
-
o = !1,
|
|
283
|
-
}, 2e3), e.container.addEventListener("keydown",
|
|
281
|
+
(r.metaKey || r.ctrlKey) && (o = !0, s && (clearTimeout(s), e.container.removeEventListener("keydown", i)), s = window.setTimeout(() => {
|
|
282
|
+
o = !1, s = null;
|
|
283
|
+
}, 2e3), e.container.addEventListener("keydown", i));
|
|
284
284
|
},
|
|
285
285
|
Delete: n,
|
|
286
286
|
Backspace: n,
|
|
@@ -296,15 +296,16 @@ function Ct(e, t) {
|
|
|
296
296
|
function Et(e) {
|
|
297
297
|
const { dragMoveHelper: t } = e;
|
|
298
298
|
let n = 0;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
e.spacePressed = !1;
|
|
300
|
+
const o = (a) => {
|
|
301
|
+
var C, S;
|
|
302
|
+
if (a.button !== 0)
|
|
302
303
|
return;
|
|
303
|
-
if ((
|
|
304
|
+
if ((C = e.helper1) != null && C.moved) {
|
|
304
305
|
e.helper1.clear();
|
|
305
306
|
return;
|
|
306
307
|
}
|
|
307
|
-
if ((
|
|
308
|
+
if ((S = e.helper2) != null && S.moved) {
|
|
308
309
|
e.helper2.clear();
|
|
309
310
|
return;
|
|
310
311
|
}
|
|
@@ -312,124 +313,121 @@ function Et(e) {
|
|
|
312
313
|
t.clear();
|
|
313
314
|
return;
|
|
314
315
|
}
|
|
315
|
-
const h =
|
|
316
|
+
const h = a.target;
|
|
316
317
|
if (h.tagName === "ME-EPD")
|
|
317
|
-
|
|
318
|
+
a.ctrlKey || a.metaKey ? e.expandNodeAll(h.previousSibling) : e.expandNode(h.previousSibling);
|
|
318
319
|
else if (h.tagName === "ME-TPC" && e.currentNodes.length > 1)
|
|
319
320
|
e.selectNode(h);
|
|
320
321
|
else if (!e.editable)
|
|
321
322
|
return;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
return;
|
|
332
|
-
} else if (w) {
|
|
333
|
-
e.selectSummary(E);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
323
|
+
if (h.classList.contains("svg-label")) {
|
|
324
|
+
const b = h.dataset.svgId, x = h.dataset.type, E = document.getElementById(b);
|
|
325
|
+
if (E) {
|
|
326
|
+
if (x === "arrow") {
|
|
327
|
+
e.selectArrow(E);
|
|
328
|
+
return;
|
|
329
|
+
} else if (x === "summary") {
|
|
330
|
+
e.selectSummary(E);
|
|
331
|
+
return;
|
|
336
332
|
}
|
|
337
333
|
}
|
|
338
334
|
}
|
|
339
335
|
if (h.closest(".topiclinks")) {
|
|
340
|
-
const
|
|
341
|
-
if (
|
|
342
|
-
e.selectArrow(
|
|
336
|
+
const b = h.closest("g");
|
|
337
|
+
if (b) {
|
|
338
|
+
e.selectArrow(b);
|
|
343
339
|
return;
|
|
344
340
|
}
|
|
345
341
|
}
|
|
346
342
|
if (h.closest(".summary")) {
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
349
|
-
e.selectSummary(
|
|
343
|
+
const b = h.closest("g");
|
|
344
|
+
if (b) {
|
|
345
|
+
e.selectSummary(b);
|
|
350
346
|
return;
|
|
351
347
|
}
|
|
352
348
|
}
|
|
353
|
-
},
|
|
349
|
+
}, s = (a) => {
|
|
354
350
|
if (!e.editable)
|
|
355
351
|
return;
|
|
356
|
-
const h =
|
|
357
|
-
ge(h) && e.beginEdit(h)
|
|
358
|
-
|
|
359
|
-
if (p && p.dataset.svgId) {
|
|
360
|
-
const b = document.getElementById(p.dataset.svgId);
|
|
352
|
+
const h = a.target;
|
|
353
|
+
if (ge(h) && e.beginEdit(h), h.classList.contains("svg-label")) {
|
|
354
|
+
const C = h.dataset.svgId, S = h.dataset.type, b = document.getElementById(C);
|
|
361
355
|
if (b) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
} else if (E) {
|
|
369
|
-
e.editSummary(y);
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
356
|
+
if (S === "arrow") {
|
|
357
|
+
e.editArrowLabel(b);
|
|
358
|
+
return;
|
|
359
|
+
} else if (S === "summary") {
|
|
360
|
+
e.editSummary(b);
|
|
361
|
+
return;
|
|
372
362
|
}
|
|
373
363
|
}
|
|
374
364
|
}
|
|
375
365
|
if (h.closest(".topiclinks")) {
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
e.editArrowLabel(
|
|
366
|
+
const C = h.closest("g");
|
|
367
|
+
if (C) {
|
|
368
|
+
e.editArrowLabel(C);
|
|
379
369
|
return;
|
|
380
370
|
}
|
|
381
371
|
}
|
|
382
372
|
if (h.closest(".summary")) {
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
e.editSummary(
|
|
373
|
+
const C = h.closest("g");
|
|
374
|
+
if (C) {
|
|
375
|
+
e.editSummary(C);
|
|
386
376
|
return;
|
|
387
377
|
}
|
|
388
378
|
}
|
|
389
|
-
},
|
|
390
|
-
if (
|
|
379
|
+
}, i = (a) => {
|
|
380
|
+
if (a.pointerType === "mouse")
|
|
391
381
|
return;
|
|
392
|
-
const h = (/* @__PURE__ */ new Date()).getTime(),
|
|
393
|
-
|
|
394
|
-
}, l = (
|
|
382
|
+
const h = (/* @__PURE__ */ new Date()).getTime(), v = h - n;
|
|
383
|
+
v < 300 && v > 0 && s(a), n = h;
|
|
384
|
+
}, l = (a) => {
|
|
385
|
+
a.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"), a.preventDefault());
|
|
386
|
+
}, r = (a) => {
|
|
387
|
+
a.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
388
|
+
}, c = (a) => {
|
|
395
389
|
t.moved = !1;
|
|
396
|
-
const h = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
397
|
-
if (
|
|
390
|
+
const h = e.spacePressed && a.button === 0 && a.pointerType === "mouse", v = e.mouseSelectionButton === 0 ? 2 : 0, w = a.button === v && a.pointerType === "mouse";
|
|
391
|
+
if (!h && !w)
|
|
398
392
|
return;
|
|
399
|
-
t.x =
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
},
|
|
403
|
-
if (
|
|
404
|
-
const h =
|
|
405
|
-
t.onMove(h,
|
|
393
|
+
t.x = a.clientX, t.y = a.clientY;
|
|
394
|
+
const C = a.target;
|
|
395
|
+
(h || C.className !== "circle" && C.contentEditable !== "plaintext-only") && (t.mousedown = !0, C.setPointerCapture(a.pointerId));
|
|
396
|
+
}, d = (a) => {
|
|
397
|
+
if (a.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
|
|
398
|
+
const h = a.clientX - t.x, v = a.clientY - t.y;
|
|
399
|
+
t.onMove(h, v);
|
|
406
400
|
}
|
|
407
|
-
t.x =
|
|
408
|
-
},
|
|
409
|
-
|
|
410
|
-
if (f.button !== h && f.pointerType === "mouse")
|
|
401
|
+
t.x = a.clientX, t.y = a.clientY;
|
|
402
|
+
}, f = (a) => {
|
|
403
|
+
if (!t.mousedown)
|
|
411
404
|
return;
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
},
|
|
415
|
-
|
|
405
|
+
const h = a.target;
|
|
406
|
+
h.hasPointerCapture && h.hasPointerCapture(a.pointerId) && h.releasePointerCapture(a.pointerId), t.clear();
|
|
407
|
+
}, u = () => {
|
|
408
|
+
t.mousedown && t.clear();
|
|
409
|
+
}, g = (a) => {
|
|
410
|
+
if (a.preventDefault(), a.button !== 2 || !e.editable)
|
|
416
411
|
return;
|
|
417
|
-
const h =
|
|
412
|
+
const h = a.target;
|
|
418
413
|
ge(h) && !h.classList.contains("selected") && e.selectNode(h), setTimeout(() => {
|
|
419
|
-
e.dragMoveHelper.moved || e.bus.fire("showContextMenu",
|
|
414
|
+
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", a);
|
|
420
415
|
}, 200);
|
|
421
|
-
},
|
|
422
|
-
|
|
423
|
-
}, { container:
|
|
416
|
+
}, y = (a) => {
|
|
417
|
+
a.stopPropagation(), a.preventDefault(), a.ctrlKey || a.metaKey ? a.deltaY < 0 ? le(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && le(e, "out", e.dragMoveHelper) : a.shiftKey ? e.move(-a.deltaY, 0) : e.move(-a.deltaX, -a.deltaY);
|
|
418
|
+
}, { container: p } = e;
|
|
424
419
|
return Se([
|
|
425
|
-
{ dom:
|
|
426
|
-
{ dom:
|
|
427
|
-
{ dom:
|
|
428
|
-
{ dom:
|
|
429
|
-
{ dom:
|
|
430
|
-
{ dom:
|
|
431
|
-
{ dom:
|
|
432
|
-
{ dom:
|
|
420
|
+
{ dom: p, evt: "pointerdown", func: c },
|
|
421
|
+
{ dom: p, evt: "pointermove", func: d },
|
|
422
|
+
{ dom: p, evt: "pointerup", func: f },
|
|
423
|
+
{ dom: p, evt: "pointerup", func: i },
|
|
424
|
+
{ dom: p, evt: "click", func: o },
|
|
425
|
+
{ dom: p, evt: "dblclick", func: s },
|
|
426
|
+
{ dom: p, evt: "contextmenu", func: g },
|
|
427
|
+
{ dom: p, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : y },
|
|
428
|
+
{ dom: p, evt: "blur", func: u },
|
|
429
|
+
{ dom: document, evt: "keydown", func: l },
|
|
430
|
+
{ dom: document, evt: "keyup", func: r }
|
|
433
431
|
]);
|
|
434
432
|
}
|
|
435
433
|
function St() {
|
|
@@ -465,27 +463,27 @@ const ce = document, Nt = function() {
|
|
|
465
463
|
t.appendChild(e);
|
|
466
464
|
const n = this.nodeData.children || [];
|
|
467
465
|
if (this.direction === 2) {
|
|
468
|
-
let o = 0,
|
|
469
|
-
n.map((
|
|
470
|
-
|
|
466
|
+
let o = 0, s = 0;
|
|
467
|
+
n.map((i) => {
|
|
468
|
+
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
471
469
|
});
|
|
472
470
|
}
|
|
473
471
|
kt(this, n, t);
|
|
474
472
|
}, kt = function(e, t, n) {
|
|
475
473
|
const o = ce.createElement("me-main");
|
|
476
474
|
o.className = D.LHS;
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
for (let
|
|
480
|
-
const l = t[
|
|
481
|
-
e.direction === 2 ? l.direction === 0 ? o.appendChild(r) :
|
|
475
|
+
const s = ce.createElement("me-main");
|
|
476
|
+
s.className = D.RHS;
|
|
477
|
+
for (let i = 0; i < t.length; i++) {
|
|
478
|
+
const l = t[i], { grp: r } = e.createWrapper(l);
|
|
479
|
+
e.direction === 2 ? l.direction === 0 ? o.appendChild(r) : s.appendChild(r) : e.direction === 0 ? o.appendChild(r) : s.appendChild(r);
|
|
482
480
|
}
|
|
483
|
-
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(
|
|
481
|
+
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
|
|
484
482
|
}, _t = function(e, t) {
|
|
485
483
|
const n = ce.createElement("me-children");
|
|
486
484
|
for (let o = 0; o < t.length; o++) {
|
|
487
|
-
const
|
|
488
|
-
n.appendChild(
|
|
485
|
+
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
486
|
+
n.appendChild(i);
|
|
489
487
|
}
|
|
490
488
|
return n;
|
|
491
489
|
}, _ = document, Je = function(e, t) {
|
|
@@ -528,21 +526,21 @@ const ce = document, Nt = function() {
|
|
|
528
526
|
if (t.tags && t.tags.length) {
|
|
529
527
|
const n = _.createElement("div");
|
|
530
528
|
n.className = "tags", t.tags.forEach((o) => {
|
|
531
|
-
const
|
|
532
|
-
typeof o == "string" ?
|
|
529
|
+
const s = _.createElement("span");
|
|
530
|
+
typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
|
|
533
531
|
}), e.appendChild(n), e.tags = n;
|
|
534
532
|
} else
|
|
535
533
|
e.tags && (e.tags = void 0);
|
|
536
534
|
}, Tt = function(e, t) {
|
|
537
|
-
const n = _.createElement("me-wrapper"), { p: o, tpc:
|
|
535
|
+
const n = _.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
538
536
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
539
|
-
const
|
|
540
|
-
if (o.appendChild(
|
|
537
|
+
const i = ke(e.expanded);
|
|
538
|
+
if (o.appendChild(i), e.expanded !== !1) {
|
|
541
539
|
const l = _t(this, e.children);
|
|
542
540
|
n.appendChild(l);
|
|
543
541
|
}
|
|
544
542
|
}
|
|
545
|
-
return { grp: n, top: o, tpc:
|
|
543
|
+
return { grp: n, top: o, tpc: s };
|
|
546
544
|
}, Lt = function(e) {
|
|
547
545
|
const t = _.createElement("me-parent"), n = this.createTopic(e);
|
|
548
546
|
return Ne.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
@@ -562,12 +560,12 @@ function Ze(e) {
|
|
|
562
560
|
const Dt = function(e) {
|
|
563
561
|
if (!e)
|
|
564
562
|
return;
|
|
565
|
-
const t = _.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft:
|
|
563
|
+
const t = _.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = O(this.nodes, e);
|
|
566
564
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
567
565
|
const l = getComputedStyle(e);
|
|
568
566
|
t.style.cssText = `
|
|
569
|
-
left: ${
|
|
570
|
-
top: ${
|
|
567
|
+
left: ${s}px;
|
|
568
|
+
top: ${i}px;
|
|
571
569
|
min-width:${e.offsetWidth - 8}px;
|
|
572
570
|
color:${l.color};
|
|
573
571
|
padding:${l.padding};
|
|
@@ -601,14 +599,14 @@ const Dt = function(e) {
|
|
|
601
599
|
const t = _.createElement("me-epd");
|
|
602
600
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
603
601
|
}, q = document, P = "http://www.w3.org/2000/svg", he = function(e) {
|
|
604
|
-
const t = e.clientWidth, n = e.clientHeight, o = e.dataset,
|
|
605
|
-
let r =
|
|
606
|
-
l === "middle" ? r =
|
|
602
|
+
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
603
|
+
let r = s;
|
|
604
|
+
l === "middle" ? r = s - t / 2 : l === "end" && (r = s - t), e.style.left = `${r}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
|
|
607
605
|
}, me = function(e, t, n, o) {
|
|
608
|
-
const { anchor:
|
|
609
|
-
c.className = "svg-label", c.style.color =
|
|
610
|
-
const
|
|
611
|
-
return c.id =
|
|
606
|
+
const { anchor: s = "middle", color: i, dataType: l, svgId: r } = o, c = document.createElement("div");
|
|
607
|
+
c.className = "svg-label", c.style.color = i || "#666";
|
|
608
|
+
const d = "label-" + r;
|
|
609
|
+
return c.id = d, c.innerHTML = e, c.dataset.type = l, c.dataset.svgId = r, c.dataset.x = t.toString(), c.dataset.y = n.toString(), c.dataset.anchor = s, c;
|
|
612
610
|
}, Qe = function(e, t, n) {
|
|
613
611
|
const o = q.createElementNS(P, "path");
|
|
614
612
|
return k(o, {
|
|
@@ -624,7 +622,7 @@ const Dt = function(e) {
|
|
|
624
622
|
const e = q.createElementNS(P, "line");
|
|
625
623
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
626
624
|
}, Pt = function(e, t, n, o) {
|
|
627
|
-
const
|
|
625
|
+
const s = q.createElementNS(P, "g");
|
|
628
626
|
return [
|
|
629
627
|
{
|
|
630
628
|
name: "line",
|
|
@@ -639,44 +637,44 @@ const Dt = function(e) {
|
|
|
639
637
|
d: n
|
|
640
638
|
}
|
|
641
639
|
].forEach((l, r) => {
|
|
642
|
-
const c = l.d,
|
|
640
|
+
const c = l.d, d = q.createElementNS(P, "path"), f = {
|
|
643
641
|
d: c,
|
|
644
642
|
stroke: (o == null ? void 0 : o.stroke) || "rgb(227, 125, 116)",
|
|
645
643
|
fill: "none",
|
|
646
644
|
"stroke-linecap": (o == null ? void 0 : o.strokeLinecap) || "cap",
|
|
647
645
|
"stroke-width": String((o == null ? void 0 : o.strokeWidth) || "2")
|
|
648
646
|
};
|
|
649
|
-
(o == null ? void 0 : o.opacity) !== void 0 && (
|
|
650
|
-
const
|
|
651
|
-
k(
|
|
647
|
+
(o == null ? void 0 : o.opacity) !== void 0 && (f.opacity = String(o.opacity)), k(d, f), r === 0 && d.setAttribute("stroke-dasharray", (o == null ? void 0 : o.strokeDasharray) || "8,2");
|
|
648
|
+
const u = q.createElementNS(P, "path");
|
|
649
|
+
k(u, {
|
|
652
650
|
d: c,
|
|
653
651
|
stroke: "transparent",
|
|
654
652
|
fill: "none",
|
|
655
653
|
"stroke-width": "15"
|
|
656
|
-
}),
|
|
657
|
-
}),
|
|
654
|
+
}), s.appendChild(u), s.appendChild(d), s[l.name] = d;
|
|
655
|
+
}), s;
|
|
658
656
|
}, et = function(e, t, n) {
|
|
659
657
|
if (!t)
|
|
660
658
|
return;
|
|
661
|
-
const o = n.label,
|
|
662
|
-
e.nodes.appendChild(
|
|
659
|
+
const o = n.label, s = t.cloneNode(!0);
|
|
660
|
+
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
663
661
|
left:${t.style.left};
|
|
664
662
|
top:${t.style.top};
|
|
665
663
|
max-width: 200px;
|
|
666
|
-
`, Ze(
|
|
667
|
-
|
|
668
|
-
const l =
|
|
664
|
+
`, Ze(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
665
|
+
i.stopPropagation();
|
|
666
|
+
const l = i.key;
|
|
669
667
|
if (l === "Enter" || l === "Tab") {
|
|
670
|
-
if (
|
|
668
|
+
if (i.shiftKey)
|
|
671
669
|
return;
|
|
672
|
-
|
|
670
|
+
i.preventDefault(), s.blur(), e.container.focus();
|
|
673
671
|
}
|
|
674
|
-
}),
|
|
672
|
+
}), s.addEventListener("blur", () => {
|
|
675
673
|
var l;
|
|
676
|
-
if (!
|
|
674
|
+
if (!s)
|
|
677
675
|
return;
|
|
678
|
-
const
|
|
679
|
-
|
|
676
|
+
const i = ((l = s.textContent) == null ? void 0 : l.trim()) || "";
|
|
677
|
+
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (t.textContent = n.label, he(t), "parent" in n ? e.bus.fire("operation", {
|
|
680
678
|
name: "finishEditSummary",
|
|
681
679
|
obj: n
|
|
682
680
|
}) : e.bus.fire("operation", {
|
|
@@ -685,31 +683,31 @@ const Dt = function(e) {
|
|
|
685
683
|
}));
|
|
686
684
|
});
|
|
687
685
|
}, $t = function(e) {
|
|
688
|
-
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft,
|
|
686
|
+
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
|
|
689
687
|
this.lines.innerHTML = "";
|
|
690
688
|
for (let r = 0; r < l.length; r++) {
|
|
691
|
-
const c = l[r],
|
|
692
|
-
if (
|
|
689
|
+
const c = l[r], d = c.querySelector("me-tpc"), { offsetLeft: f, offsetTop: u } = O(this.nodes, d), g = d.offsetWidth, y = d.offsetHeight, p = c.parentNode.className, m = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: u, cL: f, cW: g, cH: y, direction: p, containerHeight: this.nodes.offsetHeight }), a = this.theme.palette, h = d.nodeObj.branchColor || a[r % a.length];
|
|
690
|
+
if (d.style.borderColor = h, this.lines.appendChild(Qe(m, h, "3")), e && e !== c)
|
|
693
691
|
continue;
|
|
694
|
-
const
|
|
695
|
-
|
|
692
|
+
const v = J("subLines"), w = c.lastChild;
|
|
693
|
+
w.tagName === "svg" && w.remove(), c.appendChild(v), tt(this, v, h, c, p, !0);
|
|
696
694
|
}
|
|
697
695
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
698
|
-
}, tt = function(e, t, n, o,
|
|
696
|
+
}, tt = function(e, t, n, o, s, i) {
|
|
699
697
|
const l = o.firstChild, r = o.children[1].children;
|
|
700
698
|
if (r.length === 0)
|
|
701
699
|
return;
|
|
702
|
-
const c = l.offsetTop,
|
|
703
|
-
for (let
|
|
704
|
-
const
|
|
705
|
-
t.appendChild(Qe(C,
|
|
706
|
-
const
|
|
707
|
-
if (
|
|
708
|
-
if (!
|
|
700
|
+
const c = l.offsetTop, d = l.offsetLeft, f = l.offsetWidth, u = l.offsetHeight;
|
|
701
|
+
for (let g = 0; g < r.length; g++) {
|
|
702
|
+
const y = r[g], p = y.firstChild, m = p.offsetTop, a = p.offsetLeft, h = p.offsetWidth, v = p.offsetHeight, w = p.firstChild.nodeObj.branchColor || n, C = e.generateSubBranch({ pT: c, pL: d, pW: f, pH: u, cT: m, cL: a, cW: h, cH: v, direction: s, isFirst: i });
|
|
703
|
+
t.appendChild(Qe(C, w, "2"));
|
|
704
|
+
const S = p.children[1];
|
|
705
|
+
if (S) {
|
|
706
|
+
if (!S.expanded)
|
|
709
707
|
continue;
|
|
710
708
|
} else
|
|
711
709
|
continue;
|
|
712
|
-
tt(e, t,
|
|
710
|
+
tt(e, t, w, y, s);
|
|
713
711
|
}
|
|
714
712
|
}, je = {
|
|
715
713
|
addChild: "插入子节点",
|
|
@@ -859,78 +857,78 @@ function Ot(e, t) {
|
|
|
859
857
|
focus: !0,
|
|
860
858
|
link: !0
|
|
861
859
|
} : t;
|
|
862
|
-
const n = (
|
|
863
|
-
const
|
|
864
|
-
return
|
|
865
|
-
}, o = (
|
|
860
|
+
const n = (b) => {
|
|
861
|
+
const x = document.createElement("div");
|
|
862
|
+
return x.innerText = b, x.className = "tips", x;
|
|
863
|
+
}, o = (b, x, E) => {
|
|
866
864
|
const N = document.createElement("li");
|
|
867
|
-
return N.id =
|
|
868
|
-
},
|
|
869
|
-
if (
|
|
870
|
-
for (let
|
|
871
|
-
const
|
|
872
|
-
|
|
873
|
-
|
|
865
|
+
return N.id = b, N.innerHTML = `<span>${pe(x)}</span><span ${E ? 'class="key"' : ""}>${pe(E)}</span>`, N;
|
|
866
|
+
}, s = He[e.locale] ? e.locale : "en", i = He[s], l = o("cm-add_child", i.addChild, "Tab"), r = o("cm-add_parent", i.addParent, "Ctrl + Enter"), c = o("cm-add_sibling", i.addSibling, "Enter"), d = o("cm-remove_child", i.removeNode, "Delete"), f = o("cm-fucus", i.focus, ""), u = o("cm-unfucus", i.cancelFocus, ""), g = o("cm-up", i.moveUp, "PgUp"), y = o("cm-down", i.moveDown, "Pgdn"), p = o("cm-link", i.link, ""), m = o("cm-link-bidirectional", i.linkBidirectional, ""), a = o("cm-summary", i.summary, ""), h = document.createElement("ul");
|
|
867
|
+
if (h.className = "menu-list", h.appendChild(l), h.appendChild(r), h.appendChild(c), h.appendChild(d), t.focus && (h.appendChild(f), h.appendChild(u)), h.appendChild(g), h.appendChild(y), h.appendChild(a), t.link && (h.appendChild(p), h.appendChild(m)), t && t.extend)
|
|
868
|
+
for (let b = 0; b < t.extend.length; b++) {
|
|
869
|
+
const x = t.extend[b], E = o(x.name, x.name, x.key || "");
|
|
870
|
+
h.appendChild(E), E.onclick = (N) => {
|
|
871
|
+
x.onclick(N);
|
|
874
872
|
};
|
|
875
873
|
}
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
let
|
|
879
|
-
const C = (
|
|
880
|
-
const
|
|
881
|
-
if (ge(
|
|
882
|
-
|
|
883
|
-
const
|
|
884
|
-
N + A > window.innerHeight ? (
|
|
874
|
+
const v = document.createElement("div");
|
|
875
|
+
v.className = "context-menu", v.appendChild(h), v.hidden = !0, e.container.append(v);
|
|
876
|
+
let w = !0;
|
|
877
|
+
const C = (b) => {
|
|
878
|
+
const x = b.target;
|
|
879
|
+
if (ge(x)) {
|
|
880
|
+
x.parentElement.tagName === "ME-ROOT" ? w = !0 : w = !1, w ? (f.className = "disabled", g.className = "disabled", y.className = "disabled", r.className = "disabled", c.className = "disabled", d.className = "disabled") : (f.className = "", g.className = "", y.className = "", r.className = "", c.className = "", d.className = ""), v.hidden = !1, h.style.top = "", h.style.bottom = "", h.style.left = "", h.style.right = "";
|
|
881
|
+
const E = h.getBoundingClientRect(), N = h.offsetHeight, L = h.offsetWidth, A = b.clientY - E.top, V = b.clientX - E.left;
|
|
882
|
+
N + A > window.innerHeight ? (h.style.top = "", h.style.bottom = "0px") : (h.style.bottom = "", h.style.top = A + 15 + "px"), L + V > window.innerWidth ? (h.style.left = "", h.style.right = "0px") : (h.style.right = "", h.style.left = V + 10 + "px");
|
|
885
883
|
}
|
|
886
884
|
};
|
|
887
|
-
e.bus.addListener("showContextMenu", C),
|
|
888
|
-
|
|
885
|
+
e.bus.addListener("showContextMenu", C), v.onclick = (b) => {
|
|
886
|
+
b.target === v && (v.hidden = !0);
|
|
889
887
|
}, l.onclick = () => {
|
|
890
|
-
e.addChild(),
|
|
888
|
+
e.addChild(), v.hidden = !0;
|
|
891
889
|
}, r.onclick = () => {
|
|
892
|
-
e.insertParent(),
|
|
890
|
+
e.insertParent(), v.hidden = !0;
|
|
893
891
|
}, c.onclick = () => {
|
|
894
|
-
|
|
895
|
-
}, a.onclick = () => {
|
|
896
|
-
y || (e.removeNodes(e.currentNodes || []), b.hidden = !0);
|
|
897
|
-
}, u.onclick = () => {
|
|
898
|
-
y || (e.focusNode(e.currentNode), b.hidden = !0);
|
|
892
|
+
w || (e.insertSibling("after"), v.hidden = !0);
|
|
899
893
|
}, d.onclick = () => {
|
|
900
|
-
e.
|
|
901
|
-
}, m.onclick = () => {
|
|
902
|
-
y || (e.moveUpNode(), b.hidden = !0);
|
|
894
|
+
w || (e.removeNodes(e.currentNodes || []), v.hidden = !0);
|
|
903
895
|
}, f.onclick = () => {
|
|
904
|
-
|
|
896
|
+
w || (e.focusNode(e.currentNode), v.hidden = !0);
|
|
897
|
+
}, u.onclick = () => {
|
|
898
|
+
e.cancelFocus(), v.hidden = !0;
|
|
899
|
+
}, g.onclick = () => {
|
|
900
|
+
w || (e.moveUpNode(), v.hidden = !0);
|
|
901
|
+
}, y.onclick = () => {
|
|
902
|
+
w || (e.moveDownNode(), v.hidden = !0);
|
|
905
903
|
};
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
const
|
|
909
|
-
e.container.appendChild(
|
|
904
|
+
const S = (b) => {
|
|
905
|
+
v.hidden = !0;
|
|
906
|
+
const x = e.currentNode, E = n(i.clickTips);
|
|
907
|
+
e.container.appendChild(E), e.map.addEventListener(
|
|
910
908
|
"click",
|
|
911
909
|
(N) => {
|
|
912
|
-
N.preventDefault(),
|
|
910
|
+
N.preventDefault(), E.remove();
|
|
913
911
|
const L = N.target;
|
|
914
|
-
(L.parentElement.tagName === "ME-PARENT" || L.parentElement.tagName === "ME-ROOT") && e.createArrow(
|
|
912
|
+
(L.parentElement.tagName === "ME-PARENT" || L.parentElement.tagName === "ME-ROOT") && e.createArrow(x, L, b);
|
|
915
913
|
},
|
|
916
914
|
{
|
|
917
915
|
once: !0
|
|
918
916
|
}
|
|
919
917
|
);
|
|
920
918
|
};
|
|
921
|
-
return
|
|
922
|
-
|
|
919
|
+
return p.onclick = () => S(), m.onclick = () => S({ bidirectional: !0 }), a.onclick = () => {
|
|
920
|
+
v.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
923
921
|
}, () => {
|
|
924
|
-
l.onclick = null, r.onclick = null, c.onclick = null,
|
|
922
|
+
l.onclick = null, r.onclick = null, c.onclick = null, d.onclick = null, f.onclick = null, u.onclick = null, g.onclick = null, y.onclick = null, p.onclick = null, a.onclick = null, v.onclick = null, e.container.oncontextmenu = null;
|
|
925
923
|
};
|
|
926
924
|
}
|
|
927
925
|
const ve = document, jt = function(e, t) {
|
|
928
926
|
if (!t)
|
|
929
|
-
return
|
|
927
|
+
return ye(e), e;
|
|
930
928
|
let n = e.querySelector(".insert-preview");
|
|
931
929
|
const o = `insert-preview ${t} show`;
|
|
932
930
|
return n || (n = ve.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
933
|
-
},
|
|
931
|
+
}, ye = function(e) {
|
|
934
932
|
if (!e)
|
|
935
933
|
return;
|
|
936
934
|
const t = e.querySelectorAll(".insert-preview");
|
|
@@ -949,10 +947,10 @@ const ve = document, jt = function(e, t) {
|
|
|
949
947
|
};
|
|
950
948
|
class Bt {
|
|
951
949
|
constructor(t) {
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
950
|
+
X(this, "mind");
|
|
951
|
+
X(this, "isMoving", !1);
|
|
952
|
+
X(this, "interval", null);
|
|
953
|
+
X(this, "speed", 20);
|
|
956
954
|
this.mind = t;
|
|
957
955
|
}
|
|
958
956
|
move(t, n) {
|
|
@@ -966,52 +964,56 @@ class Bt {
|
|
|
966
964
|
}
|
|
967
965
|
function Rt(e) {
|
|
968
966
|
let t = null, n = null;
|
|
969
|
-
const o = Ht(e),
|
|
967
|
+
const o = Ht(e), s = new Bt(e), i = (d) => {
|
|
968
|
+
if (e.spacePressed) {
|
|
969
|
+
d.preventDefault();
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
970
972
|
e.selection.cancel();
|
|
971
|
-
const
|
|
972
|
-
if ((
|
|
973
|
-
|
|
973
|
+
const f = d.target;
|
|
974
|
+
if ((f == null ? void 0 : f.tagName) !== "ME-TPC") {
|
|
975
|
+
d.preventDefault();
|
|
974
976
|
return;
|
|
975
977
|
}
|
|
976
|
-
let
|
|
977
|
-
|
|
978
|
-
for (const
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
}, l = (
|
|
982
|
-
const { dragged:
|
|
983
|
-
if (!
|
|
978
|
+
let u = e.currentNodes;
|
|
979
|
+
u != null && u.includes(f) || (e.selectNode(f), u = e.currentNodes), e.dragged = u, u.length > 1 ? o.innerHTML = u.length + "" : o.innerHTML = f.innerHTML;
|
|
980
|
+
for (const g of u)
|
|
981
|
+
g.parentElement.parentElement.style.opacity = "0.5";
|
|
982
|
+
d.dataTransfer.setDragImage(o, 0, 0), d.dataTransfer.dropEffect = "move", e.dragMoveHelper.clear();
|
|
983
|
+
}, l = (d) => {
|
|
984
|
+
const { dragged: f } = e;
|
|
985
|
+
if (!f)
|
|
984
986
|
return;
|
|
985
|
-
|
|
986
|
-
for (const
|
|
987
|
-
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
}, r = (
|
|
991
|
-
|
|
992
|
-
const
|
|
993
|
-
if (!
|
|
987
|
+
s.stop();
|
|
988
|
+
for (const g of f)
|
|
989
|
+
g.parentElement.parentElement.style.opacity = "1";
|
|
990
|
+
const u = d.target;
|
|
991
|
+
u.style.opacity = "", n && (ye(n), t === "before" ? e.moveNodeBefore(f, n) : t === "after" ? e.moveNodeAfter(f, n) : t === "in" && e.moveNodeIn(f, n), e.dragged = null, o.innerHTML = "");
|
|
992
|
+
}, r = (d) => {
|
|
993
|
+
d.preventDefault();
|
|
994
|
+
const f = 12 * e.scaleVal, { dragged: u } = e;
|
|
995
|
+
if (!u)
|
|
994
996
|
return;
|
|
995
|
-
const
|
|
996
|
-
|
|
997
|
-
const
|
|
998
|
-
if (Be(
|
|
999
|
-
n =
|
|
1000
|
-
const
|
|
1001
|
-
|
|
997
|
+
const g = e.container.getBoundingClientRect();
|
|
998
|
+
d.clientX < g.x + 50 ? s.move(1, 0) : d.clientX > g.x + g.width - 50 ? s.move(-1, 0) : d.clientY < g.y + 50 ? s.move(0, 1) : d.clientY > g.y + g.height - 50 ? s.move(0, -1) : s.stop(), ye(n);
|
|
999
|
+
const y = ve.elementFromPoint(d.clientX, d.clientY - f);
|
|
1000
|
+
if (Be(y, u)) {
|
|
1001
|
+
n = y;
|
|
1002
|
+
const p = y.getBoundingClientRect(), m = p.y;
|
|
1003
|
+
d.clientY > m + p.height ? t = "after" : t = "in";
|
|
1002
1004
|
} else {
|
|
1003
|
-
const
|
|
1004
|
-
if (Be(
|
|
1005
|
-
n =
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1005
|
+
const p = ve.elementFromPoint(d.clientX, d.clientY + f), m = p.getBoundingClientRect();
|
|
1006
|
+
if (Be(p, u)) {
|
|
1007
|
+
n = p;
|
|
1008
|
+
const a = m.y;
|
|
1009
|
+
d.clientY < a ? t = "before" : t = "in";
|
|
1008
1010
|
} else
|
|
1009
1011
|
t = n = null;
|
|
1010
1012
|
}
|
|
1011
1013
|
n && jt(n, t);
|
|
1012
1014
|
};
|
|
1013
1015
|
return Se([
|
|
1014
|
-
{ dom: e.map, evt: "dragstart", func:
|
|
1016
|
+
{ dom: e.map, evt: "dragstart", func: i },
|
|
1015
1017
|
{ dom: e.map, evt: "dragend", func: l },
|
|
1016
1018
|
{ dom: e.map, evt: "dragover", func: r }
|
|
1017
1019
|
]);
|
|
@@ -1032,13 +1034,13 @@ const Ft = function(e) {
|
|
|
1032
1034
|
};
|
|
1033
1035
|
};
|
|
1034
1036
|
function It(e) {
|
|
1035
|
-
let t = [], n = -1, o = e.getData(),
|
|
1037
|
+
let t = [], n = -1, o = e.getData(), s = [];
|
|
1036
1038
|
e.undo = function() {
|
|
1037
1039
|
if (n > -1) {
|
|
1038
1040
|
const c = t[n];
|
|
1039
1041
|
o = c.prev, e.refresh(c.prev);
|
|
1040
1042
|
try {
|
|
1041
|
-
c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentTarget.value.map((
|
|
1043
|
+
c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentTarget.value.map((d) => this.findEle(d))) : e.selectNodes(c.currentSelected.map((d) => this.findEle(d))));
|
|
1042
1044
|
} catch {
|
|
1043
1045
|
} finally {
|
|
1044
1046
|
n--;
|
|
@@ -1050,69 +1052,69 @@ function It(e) {
|
|
|
1050
1052
|
const c = t[n];
|
|
1051
1053
|
o = c.next, e.refresh(c.next);
|
|
1052
1054
|
try {
|
|
1053
|
-
c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentSelected.map((
|
|
1055
|
+
c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentSelected.map((d) => this.findEle(d))) : e.selectNodes(c.currentTarget.value.map((d) => this.findEle(d))));
|
|
1054
1056
|
} catch {
|
|
1055
1057
|
}
|
|
1056
1058
|
}
|
|
1057
1059
|
};
|
|
1058
|
-
const
|
|
1060
|
+
const i = function(c) {
|
|
1059
1061
|
if (c.name === "beginEdit")
|
|
1060
1062
|
return;
|
|
1061
1063
|
t = t.slice(0, n + 1);
|
|
1062
|
-
const
|
|
1064
|
+
const d = e.getData(), f = {
|
|
1063
1065
|
prev: o,
|
|
1064
1066
|
operation: c.name,
|
|
1065
|
-
currentSelected:
|
|
1067
|
+
currentSelected: s.map((u) => u.id),
|
|
1066
1068
|
currentTarget: Ft(c),
|
|
1067
|
-
next:
|
|
1069
|
+
next: d
|
|
1068
1070
|
};
|
|
1069
|
-
t.push(
|
|
1071
|
+
t.push(f), o = d, n = t.length - 1;
|
|
1070
1072
|
}, l = function(c) {
|
|
1071
1073
|
(c.metaKey || c.ctrlKey) && (c.shiftKey && c.key === "Z" || c.key === "y") ? e.redo() : (c.metaKey || c.ctrlKey) && c.key === "z" && e.undo();
|
|
1072
1074
|
}, r = function() {
|
|
1073
|
-
|
|
1075
|
+
s = e.currentNodes.map((c) => c.nodeObj);
|
|
1074
1076
|
};
|
|
1075
|
-
return e.bus.addListener("operation",
|
|
1076
|
-
e.bus.removeListener("operation",
|
|
1077
|
+
return e.bus.addListener("operation", i), e.bus.addListener("selectNodes", r), e.container.addEventListener("keydown", l), () => {
|
|
1078
|
+
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", r), e.container.removeEventListener("keydown", l);
|
|
1077
1079
|
};
|
|
1078
1080
|
}
|
|
1079
|
-
const 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="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>',
|
|
1080
|
-
const
|
|
1081
|
+
const 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="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>', 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="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>', Gt = '<?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>', Yt = '<?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>', qt = '<?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>', zt = '<?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>', Vt = '<?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>';
|
|
1082
|
+
const Ut = {
|
|
1081
1083
|
side: Wt,
|
|
1082
|
-
left:
|
|
1083
|
-
right:
|
|
1084
|
+
left: Kt,
|
|
1085
|
+
right: Gt,
|
|
1084
1086
|
full: Yt,
|
|
1085
1087
|
living: qt,
|
|
1086
1088
|
zoomin: zt,
|
|
1087
1089
|
zoomout: Vt
|
|
1088
1090
|
}, F = (e, t) => {
|
|
1089
1091
|
const n = document.createElement("span");
|
|
1090
|
-
return n.id = e, n.innerHTML =
|
|
1092
|
+
return n.id = e, n.innerHTML = Ut[t], n;
|
|
1091
1093
|
};
|
|
1092
|
-
function
|
|
1093
|
-
const t = document.createElement("div"), n = F("fullscreen", "full"), o = F("toCenter", "living"),
|
|
1094
|
-
return l.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(
|
|
1094
|
+
function Xt(e) {
|
|
1095
|
+
const t = document.createElement("div"), n = F("fullscreen", "full"), o = F("toCenter", "living"), s = F("zoomout", "zoomout"), i = F("zoomin", "zoomin"), l = document.createElement("span");
|
|
1096
|
+
return l.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
1095
1097
|
document.fullscreenElement === e.el ? document.exitFullscreen() : e.el.requestFullscreen();
|
|
1096
1098
|
}, o.onclick = () => {
|
|
1097
1099
|
e.toCenter();
|
|
1098
|
-
}, i.onclick = () => {
|
|
1099
|
-
e.scale(e.scaleVal - e.scaleSensitivity);
|
|
1100
1100
|
}, s.onclick = () => {
|
|
1101
|
+
e.scale(e.scaleVal - e.scaleSensitivity);
|
|
1102
|
+
}, i.onclick = () => {
|
|
1101
1103
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1102
1104
|
}, t;
|
|
1103
1105
|
}
|
|
1104
1106
|
function Jt(e) {
|
|
1105
|
-
const t = document.createElement("div"), n = F("tbltl", "left"), o = F("tbltr", "right"),
|
|
1106
|
-
return t.appendChild(n), t.appendChild(o), t.appendChild(
|
|
1107
|
+
const t = document.createElement("div"), n = F("tbltl", "left"), o = F("tbltr", "right"), s = F("tblts", "side");
|
|
1108
|
+
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1107
1109
|
e.initLeft();
|
|
1108
1110
|
}, o.onclick = () => {
|
|
1109
1111
|
e.initRight();
|
|
1110
|
-
},
|
|
1112
|
+
}, s.onclick = () => {
|
|
1111
1113
|
e.initSide();
|
|
1112
1114
|
}, t;
|
|
1113
1115
|
}
|
|
1114
1116
|
function Zt(e) {
|
|
1115
|
-
e.container.append(
|
|
1117
|
+
e.container.append(Xt(e)), e.container.append(Jt(e));
|
|
1116
1118
|
}
|
|
1117
1119
|
/*! @viselect/vanilla v3.9.0 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
|
|
1118
1120
|
class Qt {
|
|
@@ -1129,8 +1131,8 @@ class Qt {
|
|
|
1129
1131
|
}
|
|
1130
1132
|
dispatchEvent(t, ...n) {
|
|
1131
1133
|
let o = !0;
|
|
1132
|
-
for (const
|
|
1133
|
-
o =
|
|
1134
|
+
for (const s of this._listeners.get(t) ?? [])
|
|
1135
|
+
o = s(...n) !== !1 && o;
|
|
1134
1136
|
return o;
|
|
1135
1137
|
}
|
|
1136
1138
|
unbindAllListeners() {
|
|
@@ -1139,18 +1141,18 @@ class Qt {
|
|
|
1139
1141
|
}
|
|
1140
1142
|
const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e }, t, n) => {
|
|
1141
1143
|
if (typeof t == "object")
|
|
1142
|
-
for (const [o,
|
|
1143
|
-
|
|
1144
|
+
for (const [o, s] of Object.entries(t))
|
|
1145
|
+
s !== void 0 && (e[o] = Re(s));
|
|
1144
1146
|
else
|
|
1145
1147
|
n !== void 0 && (e[t] = Re(n));
|
|
1146
1148
|
}, Fe = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1147
|
-
const
|
|
1148
|
-
return { ...
|
|
1149
|
+
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1150
|
+
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1149
1151
|
}, en = (e) => {
|
|
1150
1152
|
let t, n = -1, o = !1;
|
|
1151
1153
|
return {
|
|
1152
|
-
next: (...
|
|
1153
|
-
t =
|
|
1154
|
+
next: (...s) => {
|
|
1155
|
+
t = s, o || (o = !0, n = requestAnimationFrame(() => {
|
|
1154
1156
|
e(...t), o = !1;
|
|
1155
1157
|
}));
|
|
1156
1158
|
},
|
|
@@ -1161,25 +1163,25 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1161
1163
|
}, Ie = (e, t, n = "touch") => {
|
|
1162
1164
|
switch (n) {
|
|
1163
1165
|
case "center": {
|
|
1164
|
-
const o = t.left + t.width / 2,
|
|
1165
|
-
return o >= e.left && o <= e.right &&
|
|
1166
|
+
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
1167
|
+
return o >= e.left && o <= e.right && s >= e.top && s <= e.bottom;
|
|
1166
1168
|
}
|
|
1167
1169
|
case "cover":
|
|
1168
1170
|
return t.left >= e.left && t.top >= e.top && t.right <= e.right && t.bottom <= e.bottom;
|
|
1169
1171
|
case "touch":
|
|
1170
1172
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1171
1173
|
}
|
|
1172
|
-
}, tn = () => matchMedia("(hover: none), (pointer: coarse)").matches, nn = () => "safari" in window,
|
|
1173
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1174
|
-
for (const
|
|
1175
|
-
if (
|
|
1174
|
+
}, tn = () => matchMedia("(hover: none), (pointer: coarse)").matches, nn = () => "safari" in window, be = (e) => Array.isArray(e) ? e : [e], nt = (e) => (t, n, o, s = {}) => {
|
|
1175
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = be(n), t = be(t);
|
|
1176
|
+
for (const i of t)
|
|
1177
|
+
if (i)
|
|
1176
1178
|
for (const l of n)
|
|
1177
|
-
|
|
1179
|
+
i[e](l, o, { capture: !1, ...s });
|
|
1178
1180
|
}, H = nt("addEventListener"), M = nt("removeEventListener"), te = (e) => {
|
|
1179
1181
|
var t;
|
|
1180
|
-
const { clientX: n, clientY: o, target:
|
|
1181
|
-
return { x: n, y: o, target:
|
|
1182
|
-
}, W = (e, t = document) =>
|
|
1182
|
+
const { clientX: n, clientY: o, target: s } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
|
|
1183
|
+
return { x: n, y: o, target: s };
|
|
1184
|
+
}, W = (e, t = document) => be(e).map(
|
|
1183
1185
|
(n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null
|
|
1184
1186
|
).flat().filter(Boolean), on = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1185
1187
|
switch (o) {
|
|
@@ -1190,14 +1192,14 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1190
1192
|
case "shift":
|
|
1191
1193
|
return e.shiftKey;
|
|
1192
1194
|
}
|
|
1193
|
-
}) : !1), { abs: R, max: We, min:
|
|
1195
|
+
}) : !1), { abs: R, max: We, min: Ke, ceil: Ge } = Math, Ye = (e = []) => ({
|
|
1194
1196
|
stored: e,
|
|
1195
1197
|
selected: [],
|
|
1196
1198
|
touched: [],
|
|
1197
1199
|
changed: { added: [], removed: [] }
|
|
1198
1200
|
}), ot = class extends Qt {
|
|
1199
1201
|
constructor(t) {
|
|
1200
|
-
var n, o,
|
|
1202
|
+
var n, o, s, i, l;
|
|
1201
1203
|
super(), this._selection = Ye(), this._targetBoundaryScrolled = !0, this._selectables = [], this._areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 }, this._areaRect = Fe(), 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 = {
|
|
1202
1204
|
selectionAreaClass: "selection-area",
|
|
1203
1205
|
selectionContainerClass: void 0,
|
|
@@ -1220,7 +1222,7 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1220
1222
|
startScrollMargins: {
|
|
1221
1223
|
x: 0,
|
|
1222
1224
|
y: 0,
|
|
1223
|
-
...(
|
|
1225
|
+
...(i = (s = t.behaviour) == null ? void 0 : s.scrolling) == null ? void 0 : i.startScrollMargins
|
|
1224
1226
|
}
|
|
1225
1227
|
}
|
|
1226
1228
|
},
|
|
@@ -1236,10 +1238,10 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1236
1238
|
}
|
|
1237
1239
|
}
|
|
1238
1240
|
};
|
|
1239
|
-
for (const
|
|
1240
|
-
typeof this[
|
|
1241
|
-
const { document: r, selectionAreaClass: c, selectionContainerClass:
|
|
1242
|
-
this._area = r.createElement("div"), this._clippingElement = r.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(c),
|
|
1241
|
+
for (const f of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1242
|
+
typeof this[f] == "function" && (this[f] = this[f].bind(this));
|
|
1243
|
+
const { document: r, selectionAreaClass: c, selectionContainerClass: d } = this._options;
|
|
1244
|
+
this._area = r.createElement("div"), this._clippingElement = r.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(c), d && this._clippingElement.classList.add(d), j(this._area, {
|
|
1243
1245
|
willChange: "top, left, bottom, right, width, height",
|
|
1244
1246
|
top: 0,
|
|
1245
1247
|
left: 0,
|
|
@@ -1251,85 +1253,85 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1251
1253
|
// https://stackoverflow.com/a/38268846
|
|
1252
1254
|
pointerEvents: "none",
|
|
1253
1255
|
zIndex: "1"
|
|
1254
|
-
}), this._frame = en((
|
|
1255
|
-
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move",
|
|
1256
|
+
}), this._frame = en((f) => {
|
|
1257
|
+
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", f), this._redrawSelectionArea();
|
|
1256
1258
|
}), this.enable();
|
|
1257
1259
|
}
|
|
1258
1260
|
_toggleStartEvents(t = !0) {
|
|
1259
|
-
const { document: n, features: o } = this._options,
|
|
1260
|
-
|
|
1261
|
+
const { document: n, features: o } = this._options, s = t ? H : M;
|
|
1262
|
+
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1261
1263
|
}
|
|
1262
1264
|
_onTapStart(t, n = !1) {
|
|
1263
|
-
const { x: o, y:
|
|
1264
|
-
if (t instanceof MouseEvent && !on(t,
|
|
1265
|
+
const { x: o, y: s, target: i } = te(t), { document: l, startAreas: r, boundaries: c, features: d, behaviour: f } = this._options, u = i.getBoundingClientRect();
|
|
1266
|
+
if (t instanceof MouseEvent && !on(t, f.triggers))
|
|
1265
1267
|
return;
|
|
1266
|
-
const
|
|
1267
|
-
this._targetElement =
|
|
1268
|
-
(
|
|
1268
|
+
const g = W(r, l), y = W(c, l);
|
|
1269
|
+
this._targetElement = y.find(
|
|
1270
|
+
(h) => Ie(h.getBoundingClientRect(), u)
|
|
1269
1271
|
);
|
|
1270
|
-
const
|
|
1271
|
-
if (this._targetBoundary =
|
|
1272
|
+
const p = t.composedPath(), m = g.find((h) => p.includes(h));
|
|
1273
|
+
if (this._targetBoundary = y.find((h) => p.includes(h)), !this._targetElement || !m || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1272
1274
|
return;
|
|
1273
|
-
this._areaLocation = { x1: o, y1:
|
|
1274
|
-
const
|
|
1275
|
-
this._scrollDelta = { x:
|
|
1275
|
+
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1276
|
+
const a = l.scrollingElement ?? l.body;
|
|
1277
|
+
this._scrollDelta = { x: a.scrollLeft, y: a.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), H(l, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), H(l, ["mouseup", "touchcancel", "touchend"], this._onTapStop), H(l, "scroll", this._onScroll), d.deselectOnBlur && (this._targetBoundaryScrolled = !1, H(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1276
1278
|
}
|
|
1277
1279
|
_onSingleTap(t) {
|
|
1278
|
-
const { singleTap: { intersect: n }, range: o } = this._options.features,
|
|
1279
|
-
let
|
|
1280
|
+
const { singleTap: { intersect: n }, range: o } = this._options.features, s = te(t);
|
|
1281
|
+
let i;
|
|
1280
1282
|
if (n === "native")
|
|
1281
|
-
|
|
1283
|
+
i = s.target;
|
|
1282
1284
|
else if (n === "touch") {
|
|
1283
1285
|
this.resolveSelectables();
|
|
1284
|
-
const { x: r, y: c } =
|
|
1285
|
-
|
|
1286
|
-
const { right:
|
|
1287
|
-
return r <
|
|
1286
|
+
const { x: r, y: c } = s;
|
|
1287
|
+
i = this._selectables.find((d) => {
|
|
1288
|
+
const { right: f, left: u, top: g, bottom: y } = d.getBoundingClientRect();
|
|
1289
|
+
return r < f && r > u && c < y && c > g;
|
|
1288
1290
|
});
|
|
1289
1291
|
}
|
|
1290
|
-
if (!
|
|
1292
|
+
if (!i)
|
|
1291
1293
|
return;
|
|
1292
|
-
for (this.resolveSelectables(); !this._selectables.includes(
|
|
1293
|
-
if (
|
|
1294
|
-
|
|
1294
|
+
for (this.resolveSelectables(); !this._selectables.includes(i); )
|
|
1295
|
+
if (i.parentElement)
|
|
1296
|
+
i = i.parentElement;
|
|
1295
1297
|
else {
|
|
1296
1298
|
this._targetBoundaryScrolled || this.clearSelection();
|
|
1297
1299
|
return;
|
|
1298
1300
|
}
|
|
1299
1301
|
const { stored: l } = this._selection;
|
|
1300
1302
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1301
|
-
const r = this._latestElement, [c,
|
|
1302
|
-
(
|
|
1303
|
-
), c,
|
|
1304
|
-
this.select(
|
|
1303
|
+
const r = this._latestElement, [c, d] = r.compareDocumentPosition(i) & 4 ? [i, r] : [r, i], f = [...this._selectables.filter(
|
|
1304
|
+
(u) => u.compareDocumentPosition(c) & 4 && u.compareDocumentPosition(d) & 2
|
|
1305
|
+
), c, d];
|
|
1306
|
+
this.select(f), this._latestElement = r;
|
|
1305
1307
|
} else
|
|
1306
|
-
l.includes(
|
|
1308
|
+
l.includes(i) && (l.length === 1 || t.ctrlKey || l.every((r) => this._selection.stored.includes(r))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
|
|
1307
1309
|
}
|
|
1308
1310
|
_delayedTapMove(t) {
|
|
1309
|
-
const { container: n, document: o, behaviour: { startThreshold:
|
|
1311
|
+
const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: l } = this._areaLocation, { x: r, y: c } = te(t);
|
|
1310
1312
|
if (
|
|
1311
1313
|
// Single number for both coordinates
|
|
1312
|
-
typeof
|
|
1313
|
-
typeof
|
|
1314
|
+
typeof s == "number" && R(r + c - (i + l)) >= s || // Different x and y threshold
|
|
1315
|
+
typeof s == "object" && R(r - i) >= s.x || R(c - l) >= s.y
|
|
1314
1316
|
) {
|
|
1315
1317
|
if (M(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1316
1318
|
M(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1317
1319
|
return;
|
|
1318
1320
|
}
|
|
1319
|
-
H(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), j(this._area, "display", "block"), W(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 && (H(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), H(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((
|
|
1321
|
+
H(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), j(this._area, "display", "block"), W(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 && (H(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), H(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);
|
|
1320
1322
|
}
|
|
1321
1323
|
this._handleMoveEvent(t);
|
|
1322
1324
|
}
|
|
1323
1325
|
_setupSelectionArea() {
|
|
1324
|
-
const { _clippingElement: t, _targetElement: n, _area: o } = this,
|
|
1326
|
+
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
1325
1327
|
this._scrollAvailable ? (j(t, {
|
|
1326
|
-
top:
|
|
1327
|
-
left:
|
|
1328
|
-
width:
|
|
1329
|
-
height:
|
|
1328
|
+
top: s.top,
|
|
1329
|
+
left: s.left,
|
|
1330
|
+
width: s.width,
|
|
1331
|
+
height: s.height
|
|
1330
1332
|
}), j(o, {
|
|
1331
|
-
marginTop: -
|
|
1332
|
-
marginLeft: -
|
|
1333
|
+
marginTop: -s.top,
|
|
1334
|
+
marginLeft: -s.left
|
|
1333
1335
|
})) : (j(t, {
|
|
1334
1336
|
top: 0,
|
|
1335
1337
|
left: 0,
|
|
@@ -1341,20 +1343,20 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1341
1343
|
}));
|
|
1342
1344
|
}
|
|
1343
1345
|
_onTapMove(t) {
|
|
1344
|
-
const { _scrollSpeed: n, _areaLocation: o, _options:
|
|
1345
|
-
if (o.x2 = c, o.y2 =
|
|
1346
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling, r = this._targetElement, { x: c, y: d } = te(t);
|
|
1347
|
+
if (o.x2 = c, o.y2 = d, this._lastMousePosition.x = c, this._lastMousePosition.y = d, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1346
1348
|
this._scrollingActive = !0;
|
|
1347
|
-
const
|
|
1349
|
+
const f = () => {
|
|
1348
1350
|
if (!n.x && !n.y) {
|
|
1349
1351
|
this._scrollingActive = !1;
|
|
1350
1352
|
return;
|
|
1351
1353
|
}
|
|
1352
|
-
const { scrollTop:
|
|
1353
|
-
n.y && (r.scrollTop +=
|
|
1354
|
+
const { scrollTop: u, scrollLeft: g } = r;
|
|
1355
|
+
n.y && (r.scrollTop += Ge(n.y / l), o.y1 -= r.scrollTop - u), n.x && (r.scrollLeft += Ge(n.x / l), o.x1 -= r.scrollLeft - g), i.next(t), requestAnimationFrame(f);
|
|
1354
1356
|
};
|
|
1355
|
-
requestAnimationFrame(
|
|
1357
|
+
requestAnimationFrame(f);
|
|
1356
1358
|
} else
|
|
1357
|
-
|
|
1359
|
+
i.next(t);
|
|
1358
1360
|
this._handleMoveEvent(t);
|
|
1359
1361
|
}
|
|
1360
1362
|
_handleMoveEvent(t) {
|
|
@@ -1362,19 +1364,19 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1362
1364
|
(n.touch && tn() || this._scrollAvailable && nn()) && t.preventDefault();
|
|
1363
1365
|
}
|
|
1364
1366
|
_onScroll() {
|
|
1365
|
-
const { _scrollDelta: t, _options: { document: n } } = this, { scrollTop: o, scrollLeft:
|
|
1366
|
-
this._areaLocation.x1 += t.x -
|
|
1367
|
+
const { _scrollDelta: t, _options: { document: n } } = this, { scrollTop: o, scrollLeft: s } = n.scrollingElement ?? n.body;
|
|
1368
|
+
this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1367
1369
|
}
|
|
1368
1370
|
_onStartAreaScroll() {
|
|
1369
1371
|
this._targetBoundaryScrolled = !0, M(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1370
1372
|
}
|
|
1371
1373
|
_wheelScroll(t) {
|
|
1372
|
-
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0,
|
|
1373
|
-
this._scrollSpeed.y += o * n, this._scrollSpeed.x +=
|
|
1374
|
+
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0, s = t.deltaX ? t.deltaX > 0 ? 1 : -1 : 0;
|
|
1375
|
+
this._scrollSpeed.y += o * n, this._scrollSpeed.x += s * n, this._onTapMove(t), t.preventDefault();
|
|
1374
1376
|
}
|
|
1375
1377
|
_keyboardScroll(t) {
|
|
1376
|
-
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0,
|
|
1377
|
-
this._scrollSpeed.x += Math.sign(o) * n, this._scrollSpeed.y += Math.sign(
|
|
1378
|
+
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.key === "ArrowLeft" ? -1 : t.key === "ArrowRight" ? 1 : 0, s = t.key === "ArrowUp" ? -1 : t.key === "ArrowDown" ? 1 : 0;
|
|
1379
|
+
this._scrollSpeed.x += Math.sign(o) * n, this._scrollSpeed.y += Math.sign(s) * n, t.preventDefault(), this._onTapMove({
|
|
1378
1380
|
clientX: this._lastMousePosition.x,
|
|
1379
1381
|
clientY: this._lastMousePosition.y,
|
|
1380
1382
|
preventDefault: () => {
|
|
@@ -1382,46 +1384,46 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1382
1384
|
});
|
|
1383
1385
|
}
|
|
1384
1386
|
_recalculateSelectionAreaRect() {
|
|
1385
|
-
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options:
|
|
1386
|
-
let { x2:
|
|
1387
|
-
const { behaviour: { scrolling: { startScrollMargins:
|
|
1388
|
-
|
|
1389
|
-
const
|
|
1390
|
-
this._areaRect = Fe(
|
|
1387
|
+
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, { scrollTop: i, scrollHeight: l, clientHeight: r, scrollLeft: c, scrollWidth: d, clientWidth: f } = o, u = this._targetRect, { x1: g, y1: y } = n;
|
|
1388
|
+
let { x2: p, y2: m } = n;
|
|
1389
|
+
const { behaviour: { scrolling: { startScrollMargins: a } } } = s;
|
|
1390
|
+
p < u.left + a.x ? (t.x = c ? -R(u.left - p + a.x) : 0, p = p < u.left ? u.left : p) : p > u.right - a.x ? (t.x = d - c - f ? R(u.left + u.width - p - a.x) : 0, p = p > u.right ? u.right : p) : t.x = 0, m < u.top + a.y ? (t.y = i ? -R(u.top - m + a.y) : 0, m = m < u.top ? u.top : m) : m > u.bottom - a.y ? (t.y = l - i - r ? R(u.top + u.height - m - a.y) : 0, m = m > u.bottom ? u.bottom : m) : t.y = 0;
|
|
1391
|
+
const h = Ke(g, p), v = Ke(y, m), w = We(g, p), C = We(y, m);
|
|
1392
|
+
this._areaRect = Fe(h, v, w - h, C - v);
|
|
1391
1393
|
}
|
|
1392
1394
|
_redrawSelectionArea() {
|
|
1393
|
-
const { x: t, y: n, width: o, height:
|
|
1394
|
-
|
|
1395
|
+
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
1396
|
+
i.left = `${t}px`, i.top = `${n}px`, i.width = `${o}px`, i.height = `${s}px`;
|
|
1395
1397
|
}
|
|
1396
1398
|
_onTapStop(t, n) {
|
|
1397
1399
|
var o;
|
|
1398
|
-
const { document:
|
|
1399
|
-
M(this._targetElement, "scroll", this._onStartAreaScroll), M(
|
|
1400
|
+
const { document: s, features: i } = this._options, { _singleClick: l } = this;
|
|
1401
|
+
M(this._targetElement, "scroll", this._onStartAreaScroll), M(s, ["mousemove", "touchmove"], this._delayedTapMove), M(s, ["touchmove", "mousemove"], this._onTapMove), M(s, ["mouseup", "touchcancel", "touchend"], this._onTapStop), M(s, "scroll", this._onScroll), this._keepSelection(), t && l && i.singleTap.allow ? this._onSingleTap(t) : !l && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, M(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), M(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), j(this._area, "display", "none");
|
|
1400
1402
|
}
|
|
1401
1403
|
_updateElementSelection() {
|
|
1402
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect:
|
|
1403
|
-
for (let
|
|
1404
|
-
const
|
|
1405
|
-
if (Ie(
|
|
1406
|
-
if (l.includes(
|
|
1407
|
-
|
|
1408
|
-
else if (
|
|
1409
|
-
|
|
1404
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap: d } = n.behaviour, f = d === "invert", u = [], g = [], y = [];
|
|
1405
|
+
for (let m = 0; m < t.length; m++) {
|
|
1406
|
+
const a = t[m];
|
|
1407
|
+
if (Ie(s, a.getBoundingClientRect(), c)) {
|
|
1408
|
+
if (l.includes(a))
|
|
1409
|
+
i.includes(a) && !r.includes(a) && r.push(a);
|
|
1410
|
+
else if (f && i.includes(a)) {
|
|
1411
|
+
y.push(a);
|
|
1410
1412
|
continue;
|
|
1411
1413
|
} else
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
+
g.push(a);
|
|
1415
|
+
u.push(a);
|
|
1414
1416
|
}
|
|
1415
1417
|
}
|
|
1416
|
-
|
|
1417
|
-
const
|
|
1418
|
-
for (let
|
|
1419
|
-
const
|
|
1420
|
-
!
|
|
1418
|
+
f && g.push(...i.filter((m) => !l.includes(m)));
|
|
1419
|
+
const p = d === "keep";
|
|
1420
|
+
for (let m = 0; m < l.length; m++) {
|
|
1421
|
+
const a = l[m];
|
|
1422
|
+
!u.includes(a) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1421
1423
|
// not make them part of the current selection as soon as they're touched.
|
|
1422
|
-
(
|
|
1424
|
+
(p && i.includes(a)) && y.push(a);
|
|
1423
1425
|
}
|
|
1424
|
-
o.selected =
|
|
1426
|
+
o.selected = u, o.changed = { added: g, removed: y }, this._latestElement = void 0;
|
|
1425
1427
|
}
|
|
1426
1428
|
_emitEvent(t, n) {
|
|
1427
1429
|
return this.emit(t, {
|
|
@@ -1431,12 +1433,12 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1431
1433
|
});
|
|
1432
1434
|
}
|
|
1433
1435
|
_keepSelection() {
|
|
1434
|
-
const { _options: t, _selection: n } = this, { selected: o, changed:
|
|
1436
|
+
const { _options: t, _selection: n } = this, { selected: o, changed: s, touched: i, stored: l } = n, r = o.filter((c) => !l.includes(c));
|
|
1435
1437
|
switch (t.behaviour.overlap) {
|
|
1436
1438
|
case "drop": {
|
|
1437
1439
|
n.stored = [
|
|
1438
1440
|
...r,
|
|
1439
|
-
...l.filter((c) => !
|
|
1441
|
+
...l.filter((c) => !i.includes(c))
|
|
1440
1442
|
// Elements not touched
|
|
1441
1443
|
];
|
|
1442
1444
|
break;
|
|
@@ -1444,7 +1446,7 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1444
1446
|
case "invert": {
|
|
1445
1447
|
n.stored = [
|
|
1446
1448
|
...r,
|
|
1447
|
-
...l.filter((c) => !
|
|
1449
|
+
...l.filter((c) => !s.removed.includes(c))
|
|
1448
1450
|
// Elements not removed from selection
|
|
1449
1451
|
];
|
|
1450
1452
|
break;
|
|
@@ -1480,11 +1482,11 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1480
1482
|
* @param quiet If move / stop events should be fired
|
|
1481
1483
|
*/
|
|
1482
1484
|
clearSelection(t = !0, n = !1) {
|
|
1483
|
-
const { selected: o, stored:
|
|
1484
|
-
|
|
1485
|
+
const { selected: o, stored: s, changed: i } = this._selection;
|
|
1486
|
+
i.added = [], i.removed.push(
|
|
1485
1487
|
...o,
|
|
1486
|
-
...t ?
|
|
1487
|
-
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Ye(t ? [] :
|
|
1488
|
+
...t ? s : []
|
|
1489
|
+
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Ye(t ? [] : s);
|
|
1488
1490
|
}
|
|
1489
1491
|
/**
|
|
1490
1492
|
* @returns {Array} Selected elements
|
|
@@ -1536,10 +1538,10 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1536
1538
|
* @param quiet If this should not trigger the move event
|
|
1537
1539
|
*/
|
|
1538
1540
|
select(t, n = !1) {
|
|
1539
|
-
const { changed: o, selected:
|
|
1540
|
-
(r) => !
|
|
1541
|
+
const { changed: o, selected: s, stored: i } = this._selection, l = W(t, this._options.document).filter(
|
|
1542
|
+
(r) => !s.includes(r) && !i.includes(r)
|
|
1541
1543
|
);
|
|
1542
|
-
return
|
|
1544
|
+
return i.push(...l), s.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
|
|
1543
1545
|
}
|
|
1544
1546
|
/**
|
|
1545
1547
|
* Removes a particular element from the selection
|
|
@@ -1547,11 +1549,11 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1547
1549
|
* @param quiet If this should not trigger the move event
|
|
1548
1550
|
*/
|
|
1549
1551
|
deselect(t, n = !1) {
|
|
1550
|
-
const { selected: o, stored:
|
|
1551
|
-
(r) => o.includes(r) ||
|
|
1552
|
+
const { selected: o, stored: s, changed: i } = this._selection, l = W(t, this._options.document).filter(
|
|
1553
|
+
(r) => o.includes(r) || s.includes(r)
|
|
1552
1554
|
);
|
|
1553
|
-
this._selection.stored =
|
|
1554
|
-
...l.filter((r) => !
|
|
1555
|
+
this._selection.stored = s.filter((r) => !l.includes(r)), this._selection.selected = o.filter((r) => !l.includes(r)), this._selection.changed.added = [], this._selection.changed.removed.push(
|
|
1556
|
+
...l.filter((r) => !i.removed.includes(r))
|
|
1555
1557
|
), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
1556
1558
|
}
|
|
1557
1559
|
};
|
|
@@ -1584,37 +1586,39 @@ function rn(e) {
|
|
|
1584
1586
|
}
|
|
1585
1587
|
}).on("beforestart", ({ event: o }) => {
|
|
1586
1588
|
var l;
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
+
if (e.spacePressed)
|
|
1590
|
+
return !1;
|
|
1591
|
+
const s = o.target;
|
|
1592
|
+
if (s.id === "input-box" || s.className === "circle" || (l = e.container.querySelector(".context-menu")) != null && l.contains(s))
|
|
1589
1593
|
return !1;
|
|
1590
1594
|
if (!o.ctrlKey && !o.metaKey) {
|
|
1591
|
-
if (
|
|
1595
|
+
if (s.tagName === "ME-TPC" && s.classList.contains("selected"))
|
|
1592
1596
|
return !1;
|
|
1593
1597
|
e.clearSelection();
|
|
1594
1598
|
}
|
|
1595
|
-
const
|
|
1596
|
-
return
|
|
1599
|
+
const i = n.getSelectionArea();
|
|
1600
|
+
return i.style.background = "#4f90f22d", i.style.border = "1px solid #4f90f2", i.parentElement && (i.parentElement.style.zIndex = "9999"), !0;
|
|
1597
1601
|
}).on(
|
|
1598
1602
|
"move",
|
|
1599
1603
|
({
|
|
1600
1604
|
store: {
|
|
1601
|
-
changed: { added: o, removed:
|
|
1605
|
+
changed: { added: o, removed: s }
|
|
1602
1606
|
}
|
|
1603
1607
|
}) => {
|
|
1604
|
-
if (o.length > 0 ||
|
|
1605
|
-
for (const
|
|
1606
|
-
|
|
1608
|
+
if (o.length > 0 || s.length > 0, o.length > 0) {
|
|
1609
|
+
for (const i of o)
|
|
1610
|
+
i.className = "selected";
|
|
1607
1611
|
e.currentNodes = [...e.currentNodes, ...o], e.bus.fire(
|
|
1608
1612
|
"selectNodes",
|
|
1609
|
-
o.map((
|
|
1613
|
+
o.map((i) => i.nodeObj)
|
|
1610
1614
|
);
|
|
1611
1615
|
}
|
|
1612
|
-
if (
|
|
1613
|
-
for (const
|
|
1614
|
-
|
|
1615
|
-
e.currentNodes = e.currentNodes.filter((
|
|
1616
|
+
if (s.length > 0) {
|
|
1617
|
+
for (const i of s)
|
|
1618
|
+
i.classList.remove("selected");
|
|
1619
|
+
e.currentNodes = e.currentNodes.filter((i) => !(s != null && s.includes(i))), e.bus.fire(
|
|
1616
1620
|
"unselectNodes",
|
|
1617
|
-
|
|
1621
|
+
s.map((i) => i.nodeObj)
|
|
1618
1622
|
);
|
|
1619
1623
|
}
|
|
1620
1624
|
}
|
|
@@ -1626,9 +1630,9 @@ const ln = function(e, t = !0) {
|
|
|
1626
1630
|
const o = {
|
|
1627
1631
|
...(e.type === "dark" ? xe : we).cssVar,
|
|
1628
1632
|
...e.cssVar
|
|
1629
|
-
},
|
|
1630
|
-
for (let
|
|
1631
|
-
const l = i
|
|
1633
|
+
}, s = Object.keys(o);
|
|
1634
|
+
for (let i = 0; i < s.length; i++) {
|
|
1635
|
+
const l = s[i];
|
|
1632
1636
|
this.container.style.setProperty(l, o[l]);
|
|
1633
1637
|
}
|
|
1634
1638
|
t && this.refresh();
|
|
@@ -1651,53 +1655,53 @@ function an(e) {
|
|
|
1651
1655
|
const o = t[n];
|
|
1652
1656
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
1653
1657
|
}
|
|
1654
|
-
function
|
|
1658
|
+
function st(e) {
|
|
1655
1659
|
const { siblings: t, index: n } = z(e);
|
|
1656
1660
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
1657
1661
|
}
|
|
1658
1662
|
function dn(e, t, n) {
|
|
1659
|
-
const { siblings: o, index:
|
|
1660
|
-
o !== void 0 && (t === "before" ? o.splice(
|
|
1663
|
+
const { siblings: o, index: s } = z(n);
|
|
1664
|
+
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
1661
1665
|
}
|
|
1662
1666
|
function hn(e, t) {
|
|
1663
1667
|
const { siblings: n, index: o } = z(e);
|
|
1664
1668
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
1665
1669
|
}
|
|
1666
|
-
function
|
|
1670
|
+
function it(e, t, n) {
|
|
1667
1671
|
var o;
|
|
1668
|
-
if (
|
|
1672
|
+
if (st(t), (o = n.parent) != null && o.parent || (t.direction = n.direction), e === "in")
|
|
1669
1673
|
n.children ? n.children.push(t) : n.children = [t];
|
|
1670
1674
|
else {
|
|
1671
1675
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
1672
|
-
const { siblings:
|
|
1673
|
-
if (
|
|
1676
|
+
const { siblings: s, index: i } = z(n);
|
|
1677
|
+
if (s === void 0)
|
|
1674
1678
|
return;
|
|
1675
|
-
e === "before" ?
|
|
1679
|
+
e === "before" ? s.splice(i, 0, t) : s.splice(i + 1, 0, t);
|
|
1676
1680
|
}
|
|
1677
1681
|
}
|
|
1678
1682
|
const un = function({ map: e, direction: t }, n) {
|
|
1679
|
-
var o,
|
|
1683
|
+
var o, s;
|
|
1680
1684
|
if (t === 0)
|
|
1681
1685
|
return 0;
|
|
1682
1686
|
if (t === 1)
|
|
1683
1687
|
return 1;
|
|
1684
1688
|
if (t === 2) {
|
|
1685
|
-
const
|
|
1686
|
-
return
|
|
1689
|
+
const i = ((o = e.querySelector(".lhs")) == null ? void 0 : o.childElementCount) || 0, l = ((s = e.querySelector(".rhs")) == null ? void 0 : s.childElementCount) || 0;
|
|
1690
|
+
return i <= l ? (n.direction = 0, 0) : (n.direction = 1, 1);
|
|
1687
1691
|
}
|
|
1688
1692
|
}, rt = function(e, t, n) {
|
|
1689
|
-
var
|
|
1690
|
-
const o = n.children[0].children[0],
|
|
1691
|
-
if (
|
|
1692
|
-
if (Z(o),
|
|
1693
|
-
|
|
1693
|
+
var i, l;
|
|
1694
|
+
const o = n.children[0].children[0], s = t.parentElement;
|
|
1695
|
+
if (s.tagName === "ME-PARENT") {
|
|
1696
|
+
if (Z(o), s.children[1])
|
|
1697
|
+
s.nextSibling.appendChild(n);
|
|
1694
1698
|
else {
|
|
1695
1699
|
const r = e.createChildren([n]);
|
|
1696
|
-
|
|
1700
|
+
s.appendChild(ke(!0)), s.insertAdjacentElement("afterend", r);
|
|
1697
1701
|
}
|
|
1698
1702
|
e.linkDiv(n.offsetParent);
|
|
1699
1703
|
} else
|
|
1700
|
-
|
|
1704
|
+
s.tagName === "ME-ROOT" && (un(e, o.nodeObj) === 0 ? (i = e.container.querySelector(".lhs")) == null || i.appendChild(n) : (l = e.container.querySelector(".rhs")) == null || l.appendChild(n), e.linkDiv());
|
|
1701
1705
|
}, fn = function(e, t) {
|
|
1702
1706
|
const n = e.parentNode;
|
|
1703
1707
|
if (t === 0) {
|
|
@@ -1714,10 +1718,10 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1714
1718
|
}, pn = function(e, t) {
|
|
1715
1719
|
const n = e.nodeObj, o = Ee(n);
|
|
1716
1720
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
1717
|
-
const
|
|
1718
|
-
Ne.call(this, e,
|
|
1721
|
+
const s = Object.assign(n, t);
|
|
1722
|
+
Ne.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
1719
1723
|
name: "reshapeNode",
|
|
1720
|
-
obj:
|
|
1724
|
+
obj: s,
|
|
1721
1725
|
origin: o
|
|
1722
1726
|
});
|
|
1723
1727
|
}, _e = function(e, t, n) {
|
|
@@ -1725,36 +1729,36 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1725
1729
|
return null;
|
|
1726
1730
|
const o = t.nodeObj;
|
|
1727
1731
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
1728
|
-
const
|
|
1729
|
-
o.children ? o.children.push(
|
|
1730
|
-
const { grp:
|
|
1731
|
-
return rt(e, t,
|
|
1732
|
+
const s = n || e.generateNewObj();
|
|
1733
|
+
o.children ? o.children.push(s) : o.children = [s], B(e.nodeData);
|
|
1734
|
+
const { grp: i, top: l } = e.createWrapper(s);
|
|
1735
|
+
return rt(e, t, i), { newTop: l, newNodeObj: s };
|
|
1732
1736
|
}, gn = function(e, t, n) {
|
|
1733
|
-
var
|
|
1737
|
+
var d, f, u, g;
|
|
1734
1738
|
const o = t || this.currentNode;
|
|
1735
1739
|
if (!o)
|
|
1736
1740
|
return;
|
|
1737
|
-
const
|
|
1738
|
-
if (
|
|
1739
|
-
if (!((
|
|
1740
|
-
this.addChild(this.findEle(
|
|
1741
|
+
const s = o.nodeObj;
|
|
1742
|
+
if (s.parent) {
|
|
1743
|
+
if (!((d = s.parent) != null && d.parent) && ((u = (f = s.parent) == null ? void 0 : f.children) == null ? void 0 : u.length) === 1 && this.direction === 2) {
|
|
1744
|
+
this.addChild(this.findEle(s.parent.id), n);
|
|
1741
1745
|
return;
|
|
1742
1746
|
}
|
|
1743
1747
|
} else {
|
|
1744
1748
|
this.addChild();
|
|
1745
1749
|
return;
|
|
1746
1750
|
}
|
|
1747
|
-
const
|
|
1748
|
-
if (!((
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1751
|
+
const i = n || this.generateNewObj();
|
|
1752
|
+
if (!((g = s.parent) != null && g.parent)) {
|
|
1753
|
+
const y = o.closest("me-main").className === D.LHS ? 0 : 1;
|
|
1754
|
+
i.direction = y;
|
|
1751
1755
|
}
|
|
1752
|
-
dn(
|
|
1753
|
-
const l = o.parentElement, { grp: r, top: c } = this.createWrapper(
|
|
1756
|
+
dn(i, e, s), B(this.nodeData);
|
|
1757
|
+
const l = o.parentElement, { grp: r, top: c } = this.createWrapper(i);
|
|
1754
1758
|
l.parentElement.insertAdjacentElement(lt[e], r), this.linkDiv(r.offsetParent), n || this.editTopic(c.firstChild), this.bus.fire("operation", {
|
|
1755
1759
|
name: "insertSibling",
|
|
1756
1760
|
type: e,
|
|
1757
|
-
obj:
|
|
1761
|
+
obj: i
|
|
1758
1762
|
}), this.selectNode(c.firstChild, !0);
|
|
1759
1763
|
}, mn = function(e, t) {
|
|
1760
1764
|
const n = e || this.currentNode;
|
|
@@ -1764,14 +1768,14 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1764
1768
|
const o = n.nodeObj;
|
|
1765
1769
|
if (!o.parent)
|
|
1766
1770
|
return;
|
|
1767
|
-
const
|
|
1768
|
-
hn(o,
|
|
1769
|
-
const
|
|
1770
|
-
r.appendChild(ke(!0)),
|
|
1771
|
-
const c = this.createChildren([
|
|
1771
|
+
const s = t || this.generateNewObj();
|
|
1772
|
+
hn(o, s), B(this.nodeData);
|
|
1773
|
+
const i = n.parentElement.parentElement, { grp: l, top: r } = this.createWrapper(s, !0);
|
|
1774
|
+
r.appendChild(ke(!0)), i.insertAdjacentElement("afterend", l);
|
|
1775
|
+
const c = this.createChildren([i]);
|
|
1772
1776
|
r.insertAdjacentElement("afterend", c), this.linkDiv(), t || this.editTopic(r.firstChild), this.selectNode(r.firstChild, !0), this.bus.fire("operation", {
|
|
1773
1777
|
name: "insertParent",
|
|
1774
|
-
obj:
|
|
1778
|
+
obj: s
|
|
1775
1779
|
});
|
|
1776
1780
|
}, vn = function(e, t) {
|
|
1777
1781
|
const n = e || this.currentNode;
|
|
@@ -1780,29 +1784,29 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1780
1784
|
const o = _e(this, n, t);
|
|
1781
1785
|
if (!o)
|
|
1782
1786
|
return;
|
|
1783
|
-
const { newTop:
|
|
1787
|
+
const { newTop: s, newNodeObj: i } = o;
|
|
1784
1788
|
this.bus.fire("operation", {
|
|
1785
1789
|
name: "addChild",
|
|
1786
|
-
obj:
|
|
1787
|
-
}), t || this.editTopic(
|
|
1788
|
-
},
|
|
1790
|
+
obj: i
|
|
1791
|
+
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
1792
|
+
}, yn = function(e, t) {
|
|
1789
1793
|
const n = Ee(e.nodeObj);
|
|
1790
1794
|
Ce(n);
|
|
1791
1795
|
const o = _e(this, t, n);
|
|
1792
1796
|
if (!o)
|
|
1793
1797
|
return;
|
|
1794
|
-
const { newNodeObj:
|
|
1795
|
-
this.selectNode(this.findEle(
|
|
1798
|
+
const { newNodeObj: s } = o;
|
|
1799
|
+
this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
|
|
1796
1800
|
name: "copyNode",
|
|
1797
|
-
obj:
|
|
1801
|
+
obj: s
|
|
1798
1802
|
});
|
|
1799
|
-
},
|
|
1803
|
+
}, bn = function(e, t) {
|
|
1800
1804
|
e = de(e);
|
|
1801
1805
|
const n = [];
|
|
1802
1806
|
for (let o = 0; o < e.length; o++) {
|
|
1803
|
-
const
|
|
1804
|
-
Ce(
|
|
1805
|
-
const l = _e(this, t,
|
|
1807
|
+
const s = e[o], i = Ee(s.nodeObj);
|
|
1808
|
+
Ce(i);
|
|
1809
|
+
const l = _e(this, t, i);
|
|
1806
1810
|
if (!l)
|
|
1807
1811
|
return;
|
|
1808
1812
|
const { newNodeObj: r } = l;
|
|
@@ -1839,8 +1843,8 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1839
1843
|
return;
|
|
1840
1844
|
e = de(e);
|
|
1841
1845
|
for (const n of e) {
|
|
1842
|
-
const o = n.nodeObj,
|
|
1843
|
-
fn(n,
|
|
1846
|
+
const o = n.nodeObj, s = st(o);
|
|
1847
|
+
fn(n, s);
|
|
1844
1848
|
}
|
|
1845
1849
|
const t = e[e.length - 1];
|
|
1846
1850
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
@@ -1852,10 +1856,10 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1852
1856
|
const n = t.nodeObj;
|
|
1853
1857
|
n.expanded === !1 && (this.expandNode(t, !0), t = this.findEle(n.id));
|
|
1854
1858
|
for (const o of e) {
|
|
1855
|
-
const
|
|
1856
|
-
|
|
1857
|
-
const
|
|
1858
|
-
rt(this, t,
|
|
1859
|
+
const s = o.nodeObj;
|
|
1860
|
+
it("in", s, n), B(this.nodeData);
|
|
1861
|
+
const i = o.parentElement;
|
|
1862
|
+
rt(this, t, i.parentElement);
|
|
1859
1863
|
}
|
|
1860
1864
|
this.linkDiv(), this.bus.fire("operation", {
|
|
1861
1865
|
name: "moveNodeIn",
|
|
@@ -1864,19 +1868,19 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1864
1868
|
});
|
|
1865
1869
|
}, ct = (e, t, n, o) => {
|
|
1866
1870
|
e = de(e), t === "after" && (e = e.reverse());
|
|
1867
|
-
const
|
|
1871
|
+
const s = n.nodeObj, i = [];
|
|
1868
1872
|
for (const l of e) {
|
|
1869
1873
|
const r = l.nodeObj;
|
|
1870
|
-
|
|
1874
|
+
it(t, r, s), B(o.nodeData), Z(l);
|
|
1871
1875
|
const c = l.parentElement.parentNode;
|
|
1872
|
-
|
|
1876
|
+
i.includes(c.parentElement) || i.push(c.parentElement), n.parentElement.parentNode.insertAdjacentElement(lt[t], c);
|
|
1873
1877
|
}
|
|
1874
|
-
for (const l of
|
|
1878
|
+
for (const l of i)
|
|
1875
1879
|
l.childElementCount === 0 && l.tagName !== "ME-MAIN" && (l.previousSibling.children[1].remove(), l.remove());
|
|
1876
1880
|
o.linkDiv(), o.bus.fire("operation", {
|
|
1877
1881
|
name: t === "before" ? "moveNodeBefore" : "moveNodeAfter",
|
|
1878
1882
|
objs: e.map((l) => l.nodeObj),
|
|
1879
|
-
toObj:
|
|
1883
|
+
toObj: s
|
|
1880
1884
|
});
|
|
1881
1885
|
}, Sn = function(e, t) {
|
|
1882
1886
|
ct(e, "before", t, this);
|
|
@@ -1891,8 +1895,8 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1891
1895
|
__proto__: null,
|
|
1892
1896
|
addChild: vn,
|
|
1893
1897
|
beginEdit: kn,
|
|
1894
|
-
copyNode:
|
|
1895
|
-
copyNodes:
|
|
1898
|
+
copyNode: yn,
|
|
1899
|
+
copyNodes: bn,
|
|
1896
1900
|
insertParent: mn,
|
|
1897
1901
|
insertSibling: gn,
|
|
1898
1902
|
moveDownNode: xn,
|
|
@@ -1917,8 +1921,8 @@ function Tn(e) {
|
|
|
1917
1921
|
const Ln = function(e) {
|
|
1918
1922
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
1919
1923
|
if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
|
|
1920
|
-
const
|
|
1921
|
-
this.move(-
|
|
1924
|
+
const i = n.left + n.width / 2, l = n.top + n.height / 2, r = o.left + o.width / 2, c = o.top + o.height / 2, d = i - r, f = l - c;
|
|
1925
|
+
this.move(-d, -f, !0);
|
|
1922
1926
|
}
|
|
1923
1927
|
}, An = function(e, t, n) {
|
|
1924
1928
|
this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
@@ -1943,29 +1947,29 @@ const Ln = function(e) {
|
|
|
1943
1947
|
}, Bn = function(e, t = { x: 0, y: 0 }) {
|
|
1944
1948
|
if (e < this.scaleMin || e > this.scaleMax)
|
|
1945
1949
|
return;
|
|
1946
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0,
|
|
1947
|
-
this.map.style.transform = `translate(${c -
|
|
1950
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = dt(this), r = this.map.style.transform, { x: c, y: d } = Xe(r), f = c - i, u = d - l, g = this.scaleVal, y = (-o + f) * (1 - e / g), p = (-s + u) * (1 - e / g);
|
|
1951
|
+
this.map.style.transform = `translate(${c - y}px, ${d - p}px) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
1948
1952
|
}, Rn = function() {
|
|
1949
1953
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
1950
1954
|
this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
|
|
1951
1955
|
}, Fn = function(e, t, n = !1) {
|
|
1952
|
-
const { map: o, scaleVal:
|
|
1953
|
-
let { x: r, y: c } =
|
|
1956
|
+
const { map: o, scaleVal: s, bus: i } = this, l = o.style.transform;
|
|
1957
|
+
let { x: r, y: c } = Xe(l);
|
|
1954
1958
|
r += e, c += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
1955
1959
|
o.style.transition = "none";
|
|
1956
|
-
}, 300)), o.style.transform = `translate(${r}px, ${c}px) scale(${
|
|
1960
|
+
}, 300)), o.style.transform = `translate(${r}px, ${c}px) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
1957
1961
|
}, dt = (e) => {
|
|
1958
|
-
const { container: t, map: n, nodes: o } = e,
|
|
1959
|
-
let
|
|
1960
|
-
return e.alignment === "root" ? (
|
|
1962
|
+
const { container: t, map: n, nodes: o } = e, s = n.querySelector("me-root"), i = s.offsetTop, l = s.offsetLeft, r = s.offsetWidth, c = s.offsetHeight;
|
|
1963
|
+
let d, f;
|
|
1964
|
+
return e.alignment === "root" ? (d = t.offsetWidth / 2 - l - r / 2, f = t.offsetHeight / 2 - i - c / 2, n.style.transformOrigin = `${l + r / 2}px 50%`) : (d = (t.offsetWidth - o.offsetWidth) / 2, f = (t.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: d, dy: f };
|
|
1961
1965
|
}, In = function() {
|
|
1962
1966
|
const { map: e } = this, { dx: t, dy: n } = dt(this);
|
|
1963
1967
|
e.style.transform = `translate(${t}px, ${n}px) scale(${this.scaleVal})`;
|
|
1964
1968
|
}, Wn = function(e) {
|
|
1965
1969
|
e(this);
|
|
1966
|
-
},
|
|
1970
|
+
}, Kn = function(e) {
|
|
1967
1971
|
e.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
|
|
1968
|
-
},
|
|
1972
|
+
}, Gn = function() {
|
|
1969
1973
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
1970
1974
|
}, Yn = function() {
|
|
1971
1975
|
this.direction = 0, this.refresh(), this.toCenter();
|
|
@@ -1975,48 +1979,48 @@ const Ln = function(e) {
|
|
|
1975
1979
|
this.direction = 2, this.refresh(), this.toCenter();
|
|
1976
1980
|
}, Vn = function(e) {
|
|
1977
1981
|
this.locale = e, this.refresh();
|
|
1978
|
-
},
|
|
1982
|
+
}, Un = function(e, t) {
|
|
1979
1983
|
const n = e.nodeObj;
|
|
1980
1984
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
1981
|
-
const o = e.getBoundingClientRect(),
|
|
1985
|
+
const o = e.getBoundingClientRect(), s = {
|
|
1982
1986
|
x: o.left,
|
|
1983
1987
|
y: o.top
|
|
1984
|
-
},
|
|
1988
|
+
}, i = e.parentNode, l = i.children[1];
|
|
1985
1989
|
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", Z(e), n.expanded) {
|
|
1986
|
-
const
|
|
1987
|
-
n.children.map((
|
|
1990
|
+
const u = this.createChildren(
|
|
1991
|
+
n.children.map((g) => this.createWrapper(g).grp)
|
|
1988
1992
|
);
|
|
1989
|
-
|
|
1993
|
+
i.parentNode.appendChild(u);
|
|
1990
1994
|
} else
|
|
1991
|
-
|
|
1995
|
+
i.parentNode.children[1].remove();
|
|
1992
1996
|
this.linkDiv(e.closest("me-main > me-wrapper"));
|
|
1993
1997
|
const r = e.getBoundingClientRect(), c = {
|
|
1994
1998
|
x: r.left,
|
|
1995
1999
|
y: r.top
|
|
1996
|
-
},
|
|
1997
|
-
this.move(
|
|
1998
|
-
},
|
|
1999
|
-
const n = e.nodeObj, o = e.getBoundingClientRect(),
|
|
2000
|
+
}, d = s.x - c.x, f = s.y - c.y;
|
|
2001
|
+
this.move(d, f), this.bus.fire("expandNode", n);
|
|
2002
|
+
}, Xn = function(e, t) {
|
|
2003
|
+
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
2000
2004
|
x: o.left,
|
|
2001
2005
|
y: o.top
|
|
2002
2006
|
};
|
|
2003
2007
|
Y(n, t ?? !n.expanded), this.refresh();
|
|
2004
|
-
const
|
|
2005
|
-
x:
|
|
2006
|
-
y:
|
|
2007
|
-
}, r =
|
|
2008
|
+
const i = this.findEle(n.id).getBoundingClientRect(), l = {
|
|
2009
|
+
x: i.left,
|
|
2010
|
+
y: i.top
|
|
2011
|
+
}, r = s.x - l.x, c = s.y - l.y;
|
|
2008
2012
|
this.move(r, c);
|
|
2009
2013
|
}, Jn = function(e) {
|
|
2010
2014
|
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)), B(this.nodeData), this.layout(), this.linkDiv();
|
|
2011
2015
|
}, Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2012
2016
|
__proto__: null,
|
|
2013
|
-
cancelFocus:
|
|
2017
|
+
cancelFocus: Gn,
|
|
2014
2018
|
clearSelection: Pn,
|
|
2015
2019
|
disableEdit: Hn,
|
|
2016
2020
|
enableEdit: jn,
|
|
2017
|
-
expandNode:
|
|
2018
|
-
expandNodeAll:
|
|
2019
|
-
focusNode:
|
|
2021
|
+
expandNode: Un,
|
|
2022
|
+
expandNodeAll: Xn,
|
|
2023
|
+
focusNode: Kn,
|
|
2020
2024
|
getData: On,
|
|
2021
2025
|
getDataString: $n,
|
|
2022
2026
|
initLeft: Yn,
|
|
@@ -2071,69 +2075,69 @@ const Ln = function(e) {
|
|
|
2071
2075
|
}, qe = {
|
|
2072
2076
|
create: Qn
|
|
2073
2077
|
}, eo = "#4dc4ff";
|
|
2074
|
-
function ht(e, t, n, o,
|
|
2078
|
+
function ht(e, t, n, o, s, i, l, r) {
|
|
2075
2079
|
return {
|
|
2076
|
-
x: e / 8 + n * 3 / 8 +
|
|
2077
|
-
y: t / 8 + o * 3 / 8 +
|
|
2080
|
+
x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
|
|
2081
|
+
y: t / 8 + o * 3 / 8 + i * 3 / 8 + r / 8
|
|
2078
2082
|
};
|
|
2079
2083
|
}
|
|
2080
2084
|
function to(e, t, n) {
|
|
2081
2085
|
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), he(e));
|
|
2082
2086
|
}
|
|
2083
|
-
function ne(e, t, n, o,
|
|
2087
|
+
function ne(e, t, n, o, s) {
|
|
2084
2088
|
k(e, {
|
|
2085
2089
|
x1: t + "",
|
|
2086
2090
|
y1: n + "",
|
|
2087
2091
|
x2: o + "",
|
|
2088
|
-
y2:
|
|
2092
|
+
y2: s + ""
|
|
2089
2093
|
});
|
|
2090
2094
|
}
|
|
2091
|
-
function ze(e, t, n, o,
|
|
2092
|
-
var
|
|
2093
|
-
const
|
|
2094
|
-
if (e.line.setAttribute("d",
|
|
2095
|
-
const
|
|
2096
|
-
|
|
2097
|
-
}
|
|
2098
|
-
const
|
|
2099
|
-
|
|
2100
|
-
const
|
|
2101
|
-
if (
|
|
2102
|
-
const
|
|
2103
|
-
if (e.arrow1.setAttribute("d",
|
|
2104
|
-
const
|
|
2105
|
-
|
|
2095
|
+
function ze(e, t, n, o, s, i, l, r, c, d) {
|
|
2096
|
+
var m;
|
|
2097
|
+
const f = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${r} ${c}`;
|
|
2098
|
+
if (e.line.setAttribute("d", f), d.style) {
|
|
2099
|
+
const a = d.style;
|
|
2100
|
+
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));
|
|
2101
|
+
}
|
|
2102
|
+
const u = e.querySelectorAll('path[stroke="transparent"]');
|
|
2103
|
+
u.length > 0 && u[0].setAttribute("d", f);
|
|
2104
|
+
const g = re(i, l, r, c);
|
|
2105
|
+
if (g) {
|
|
2106
|
+
const a = `M ${g.x1} ${g.y1} L ${r} ${c} L ${g.x2} ${g.y2}`;
|
|
2107
|
+
if (e.arrow1.setAttribute("d", a), u.length > 1 && u[1].setAttribute("d", a), d.style) {
|
|
2108
|
+
const h = d.style;
|
|
2109
|
+
h.stroke && e.arrow1.setAttribute("stroke", h.stroke), h.strokeWidth && e.arrow1.setAttribute("stroke-width", String(h.strokeWidth)), h.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", h.strokeLinecap), h.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(h.opacity));
|
|
2106
2110
|
}
|
|
2107
2111
|
}
|
|
2108
|
-
if (
|
|
2109
|
-
const
|
|
2110
|
-
if (
|
|
2111
|
-
const
|
|
2112
|
-
if (e.arrow2.setAttribute("d",
|
|
2113
|
-
const
|
|
2114
|
-
|
|
2112
|
+
if (d.bidirectional) {
|
|
2113
|
+
const a = re(o, s, t, n);
|
|
2114
|
+
if (a) {
|
|
2115
|
+
const h = `M ${a.x1} ${a.y1} L ${t} ${n} L ${a.x2} ${a.y2}`;
|
|
2116
|
+
if (e.arrow2.setAttribute("d", h), u.length > 2 && u[2].setAttribute("d", h), d.style) {
|
|
2117
|
+
const v = d.style;
|
|
2118
|
+
v.stroke && e.arrow2.setAttribute("stroke", v.stroke), v.strokeWidth && e.arrow2.setAttribute("stroke-width", String(v.strokeWidth)), v.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", v.strokeLinecap), v.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(v.opacity));
|
|
2115
2119
|
}
|
|
2116
2120
|
}
|
|
2117
2121
|
}
|
|
2118
|
-
const { x:
|
|
2119
|
-
if (e.labelEl && to(e.labelEl,
|
|
2120
|
-
const
|
|
2121
|
-
|
|
2122
|
+
const { x: y, y: p } = ht(t, n, o, s, i, l, r, c);
|
|
2123
|
+
if (e.labelEl && to(e.labelEl, y, p), (m = d.style) != null && m.labelColor) {
|
|
2124
|
+
const a = e.labelEl;
|
|
2125
|
+
a && (a.style.color = d.style.labelColor);
|
|
2122
2126
|
}
|
|
2123
2127
|
ao(e);
|
|
2124
2128
|
}
|
|
2125
2129
|
function ae(e, t, n) {
|
|
2126
|
-
const { offsetLeft: o, offsetTop:
|
|
2130
|
+
const { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, r = o + i / 2, c = s + l / 2, d = r + n.x, f = c + n.y;
|
|
2127
2131
|
return {
|
|
2128
|
-
w:
|
|
2132
|
+
w: i,
|
|
2129
2133
|
h: l,
|
|
2130
2134
|
cx: r,
|
|
2131
2135
|
cy: c,
|
|
2132
|
-
ctrlX:
|
|
2133
|
-
ctrlY:
|
|
2136
|
+
ctrlX: d,
|
|
2137
|
+
ctrlY: f
|
|
2134
2138
|
};
|
|
2135
2139
|
}
|
|
2136
|
-
function
|
|
2140
|
+
function G(e) {
|
|
2137
2141
|
let t, n;
|
|
2138
2142
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
2139
2143
|
return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
|
|
@@ -2141,30 +2145,30 @@ function K(e) {
|
|
|
2141
2145
|
y: n
|
|
2142
2146
|
};
|
|
2143
2147
|
}
|
|
2144
|
-
const Te = function(e, t, n, o,
|
|
2145
|
-
var
|
|
2148
|
+
const Te = function(e, t, n, o, s) {
|
|
2149
|
+
var E;
|
|
2146
2150
|
if (!t || !n)
|
|
2147
2151
|
return;
|
|
2148
|
-
const
|
|
2149
|
-
if (!
|
|
2152
|
+
const i = ae(e, t, o.delta1), l = ae(e, n, o.delta2), { x: r, y: c } = G(i), { ctrlX: d, ctrlY: f } = i, { ctrlX: u, ctrlY: g } = l, { x: y, y: p } = G(l), m = re(u, g, y, p);
|
|
2153
|
+
if (!m)
|
|
2150
2154
|
return;
|
|
2151
|
-
const
|
|
2152
|
-
let
|
|
2155
|
+
const a = `M ${m.x1} ${m.y1} L ${y} ${p} L ${m.x2} ${m.y2}`;
|
|
2156
|
+
let h = "";
|
|
2153
2157
|
if (o.bidirectional) {
|
|
2154
|
-
const N = re(
|
|
2158
|
+
const N = re(d, f, r, c);
|
|
2155
2159
|
if (!N)
|
|
2156
2160
|
return;
|
|
2157
|
-
|
|
2161
|
+
h = `M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`;
|
|
2158
2162
|
}
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2161
|
-
const
|
|
2163
|
+
const v = Pt(`M ${r} ${c} C ${d} ${f} ${u} ${g} ${y} ${p}`, a, h, o.style), { x: w, y: C } = ht(r, c, d, f, u, g, y, p), S = ((E = o.style) == null ? void 0 : E.labelColor) || "rgb(235, 95, 82)", b = "arrow-" + o.id;
|
|
2164
|
+
v.id = b;
|
|
2165
|
+
const x = me(o.label, w, C, {
|
|
2162
2166
|
anchor: "middle",
|
|
2163
|
-
color:
|
|
2164
|
-
dataType: "
|
|
2165
|
-
svgId:
|
|
2167
|
+
color: S,
|
|
2168
|
+
dataType: "arrow",
|
|
2169
|
+
svgId: b
|
|
2166
2170
|
});
|
|
2167
|
-
|
|
2171
|
+
v.labelEl = x, v.arrowObj = o, v.dataset.linkid = o.id, e.labelContainer.appendChild(x), e.linkSvgGroup.appendChild(v), he(x), s || (e.arrows.push(o), e.currentArrow = v, ut(e, o, i, l));
|
|
2168
2172
|
}, no = function(e, t, n = {}) {
|
|
2169
2173
|
const o = {
|
|
2170
2174
|
id: I(),
|
|
@@ -2192,7 +2196,7 @@ const Te = function(e, t, n, o, i) {
|
|
|
2192
2196
|
name: "createArrow",
|
|
2193
2197
|
obj: t
|
|
2194
2198
|
});
|
|
2195
|
-
},
|
|
2199
|
+
}, so = function(e) {
|
|
2196
2200
|
let t;
|
|
2197
2201
|
if (e ? t = e : t = this.currentArrow, !t)
|
|
2198
2202
|
return;
|
|
@@ -2204,10 +2208,10 @@ const Te = function(e, t, n, o, i) {
|
|
|
2204
2208
|
id: n
|
|
2205
2209
|
}
|
|
2206
2210
|
});
|
|
2207
|
-
},
|
|
2211
|
+
}, io = function(e) {
|
|
2208
2212
|
this.currentArrow = e;
|
|
2209
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to),
|
|
2210
|
-
ut(this, t,
|
|
2213
|
+
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = ae(this, n, t.delta1), i = ae(this, o, t.delta2);
|
|
2214
|
+
ut(this, t, s, i);
|
|
2211
2215
|
}, ro = function() {
|
|
2212
2216
|
ue(this), this.currentArrow = null;
|
|
2213
2217
|
}, fe = function(e, t) {
|
|
@@ -2225,10 +2229,10 @@ const Te = function(e, t, n, o, i) {
|
|
|
2225
2229
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2226
2230
|
const o = fe(e.line.getAttribute("d"), t);
|
|
2227
2231
|
n.appendChild(o);
|
|
2228
|
-
const
|
|
2229
|
-
if (n.appendChild(
|
|
2230
|
-
const
|
|
2231
|
-
n.appendChild(
|
|
2232
|
+
const s = fe(e.arrow1.getAttribute("d"), t);
|
|
2233
|
+
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2234
|
+
const i = fe(e.arrow2.getAttribute("d"), t);
|
|
2235
|
+
n.appendChild(i);
|
|
2232
2236
|
}
|
|
2233
2237
|
e.insertBefore(n, e.firstChild);
|
|
2234
2238
|
}, co = function(e) {
|
|
@@ -2244,19 +2248,19 @@ const Te = function(e, t, n, o, i) {
|
|
|
2244
2248
|
var t, n;
|
|
2245
2249
|
(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 && co(e.currentArrow);
|
|
2246
2250
|
}, ut = function(e, t, n, o) {
|
|
2247
|
-
const { linkController:
|
|
2248
|
-
if (!
|
|
2251
|
+
const { linkController: s, P2: i, P3: l, line1: r, line2: c, nodes: d, map: f, currentArrow: u, bus: g } = e;
|
|
2252
|
+
if (!u)
|
|
2249
2253
|
return;
|
|
2250
|
-
|
|
2251
|
-
let { x:
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
const
|
|
2255
|
-
|
|
2256
|
-
}), e.helper2.init(
|
|
2257
|
-
|
|
2258
|
-
const
|
|
2259
|
-
|
|
2254
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", d.appendChild(s), d.appendChild(i), d.appendChild(l), lo(u, eo);
|
|
2255
|
+
let { x: y, y: p } = G(n), { ctrlX: m, ctrlY: a } = n, { ctrlX: h, ctrlY: v } = o, { x: w, y: C } = G(o);
|
|
2256
|
+
i.style.cssText = `top:${a}px;left:${m}px;`, l.style.cssText = `top:${v}px;left:${h}px;`, ne(r, y, p, m, a), ne(c, h, v, w, C), e.helper1 = qe.create(i), e.helper2 = qe.create(l), e.helper1.init(f, (S, b) => {
|
|
2257
|
+
m = m + S / e.scaleVal, a = a + b / e.scaleVal;
|
|
2258
|
+
const x = G({ ...n, ctrlX: m, ctrlY: a });
|
|
2259
|
+
y = x.x, p = x.y, i.style.top = a + "px", i.style.left = m + "px", ze(u, y, p, m, a, h, v, w, C, t), ne(r, y, p, m, a), t.delta1.x = m - n.cx, t.delta1.y = a - n.cy, g.fire("updateArrowDelta", t);
|
|
2260
|
+
}), e.helper2.init(f, (S, b) => {
|
|
2261
|
+
h = h + S / e.scaleVal, v = v + b / e.scaleVal;
|
|
2262
|
+
const x = G({ ...o, ctrlX: h, ctrlY: v });
|
|
2263
|
+
w = x.x, C = x.y, l.style.top = v + "px", l.style.left = h + "px", ze(u, y, p, m, a, h, v, w, C, t), ne(c, h, v, w, C), t.delta2.x = h - o.cx, t.delta2.y = v - o.cy, g.fire("updateArrowDelta", t);
|
|
2260
2264
|
});
|
|
2261
2265
|
};
|
|
2262
2266
|
function ho() {
|
|
@@ -2274,59 +2278,59 @@ function uo(e) {
|
|
|
2274
2278
|
ue(this), e && e.labelEl && et(this, e.labelEl, e.arrowObj);
|
|
2275
2279
|
}
|
|
2276
2280
|
function fo() {
|
|
2277
|
-
this.arrows = this.arrows.filter((e) =>
|
|
2281
|
+
this.arrows = this.arrows.filter((e) => ie(e.from, this.nodeData) && ie(e.to, this.nodeData));
|
|
2278
2282
|
}
|
|
2279
2283
|
const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2280
2284
|
__proto__: null,
|
|
2281
2285
|
createArrow: no,
|
|
2282
2286
|
createArrowFrom: oo,
|
|
2283
2287
|
editArrowLabel: uo,
|
|
2284
|
-
removeArrow:
|
|
2288
|
+
removeArrow: so,
|
|
2285
2289
|
renderArrow: ho,
|
|
2286
|
-
selectArrow:
|
|
2290
|
+
selectArrow: io,
|
|
2287
2291
|
tidyArrow: fo,
|
|
2288
2292
|
unselectArrow: ro
|
|
2289
2293
|
}, Symbol.toStringTag, { value: "Module" })), go = function(e) {
|
|
2290
|
-
var c,
|
|
2294
|
+
var c, d;
|
|
2291
2295
|
if (e.length === 0)
|
|
2292
2296
|
throw new Error("No selected node.");
|
|
2293
2297
|
if (e.length === 1) {
|
|
2294
|
-
const
|
|
2295
|
-
if (!
|
|
2298
|
+
const f = e[0].nodeObj, u = e[0].nodeObj.parent;
|
|
2299
|
+
if (!u)
|
|
2296
2300
|
throw new Error("Can not select root node.");
|
|
2297
|
-
const
|
|
2301
|
+
const g = u.children.findIndex((y) => f === y);
|
|
2298
2302
|
return {
|
|
2299
|
-
parent:
|
|
2300
|
-
start:
|
|
2301
|
-
end:
|
|
2303
|
+
parent: u.id,
|
|
2304
|
+
start: g,
|
|
2305
|
+
end: g
|
|
2302
2306
|
};
|
|
2303
2307
|
}
|
|
2304
2308
|
let t = 0;
|
|
2305
|
-
const n = e.map((
|
|
2306
|
-
let
|
|
2307
|
-
const
|
|
2308
|
-
for (;
|
|
2309
|
-
const
|
|
2310
|
-
|
|
2309
|
+
const n = e.map((f) => {
|
|
2310
|
+
let u = f.nodeObj;
|
|
2311
|
+
const g = [];
|
|
2312
|
+
for (; u.parent; ) {
|
|
2313
|
+
const y = u.parent, p = y.children, m = p == null ? void 0 : p.indexOf(u);
|
|
2314
|
+
u = y, g.unshift({ node: u, index: m });
|
|
2311
2315
|
}
|
|
2312
|
-
return
|
|
2316
|
+
return g.length > t && (t = g.length), g;
|
|
2313
2317
|
});
|
|
2314
2318
|
let o = 0;
|
|
2315
2319
|
e:
|
|
2316
2320
|
for (; o < t; o++) {
|
|
2317
|
-
const
|
|
2318
|
-
for (let
|
|
2319
|
-
if (((
|
|
2321
|
+
const f = (c = n[0][o]) == null ? void 0 : c.node;
|
|
2322
|
+
for (let u = 1; u < n.length; u++)
|
|
2323
|
+
if (((d = n[u][o]) == null ? void 0 : d.node) !== f)
|
|
2320
2324
|
break e;
|
|
2321
2325
|
}
|
|
2322
2326
|
if (!o)
|
|
2323
2327
|
throw new Error("Can not select root node.");
|
|
2324
|
-
const
|
|
2328
|
+
const s = n.map((f) => f[o - 1].index).sort(), i = s[0] || 0, l = s[s.length - 1] || 0, r = n[0][o - 1].node;
|
|
2325
2329
|
if (!r.parent)
|
|
2326
2330
|
throw new Error("Please select nodes in the same main topic.");
|
|
2327
2331
|
return {
|
|
2328
2332
|
parent: r.id,
|
|
2329
|
-
start:
|
|
2333
|
+
start: i,
|
|
2330
2334
|
end: l
|
|
2331
2335
|
};
|
|
2332
2336
|
}, mo = function(e) {
|
|
@@ -2341,30 +2345,30 @@ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2341
2345
|
"stroke-linecap": "round",
|
|
2342
2346
|
"stroke-width": "2"
|
|
2343
2347
|
}), n;
|
|
2344
|
-
}, vo = (e) => e.parentElement.parentElement,
|
|
2345
|
-
const o = e.findEle(t),
|
|
2346
|
-
let
|
|
2347
|
-
return
|
|
2348
|
+
}, vo = (e) => e.parentElement.parentElement, yo = function(e, { parent: t, start: n }) {
|
|
2349
|
+
const o = e.findEle(t), s = o.nodeObj;
|
|
2350
|
+
let i;
|
|
2351
|
+
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2348
2352
|
}, Le = function(e, t) {
|
|
2349
2353
|
var V;
|
|
2350
|
-
const { id: n, label: o, parent:
|
|
2351
|
-
let
|
|
2352
|
-
for (let
|
|
2353
|
-
const Ae = (V =
|
|
2354
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: d, summarySvg: f } = e, g = e.findEle(s).nodeObj, y = yo(e, t);
|
|
2355
|
+
let p = 1 / 0, m = 0, a = 0, h = 0;
|
|
2356
|
+
for (let U = i; U <= l; U++) {
|
|
2357
|
+
const Ae = (V = g.children) == null ? void 0 : V[U];
|
|
2354
2358
|
if (!Ae)
|
|
2355
2359
|
return e.removeSummary(n), null;
|
|
2356
|
-
const Q = vo(e.findEle(Ae.id)), { offsetLeft: ee, offsetTop: Me } = O(c, Q), De =
|
|
2357
|
-
|
|
2360
|
+
const Q = vo(e.findEle(Ae.id)), { offsetLeft: ee, offsetTop: Me } = O(c, Q), De = i === l ? 10 : 20;
|
|
2361
|
+
U === i && (a = Me + De), U === l && (h = Me + Q.offsetHeight - De), ee < p && (p = ee), Q.offsetWidth + ee > m && (m = Q.offsetWidth + ee);
|
|
2358
2362
|
}
|
|
2359
|
-
let
|
|
2360
|
-
const C =
|
|
2361
|
-
|
|
2363
|
+
let v, w;
|
|
2364
|
+
const C = g.parent ? 10 : 0, S = a + C, b = h + C, x = (S + b) / 2, E = (r == null ? void 0 : r.stroke) || d.cssVar["--color"], N = (r == null ? void 0 : r.labelColor) || d.cssVar["--color"], L = "s-" + n;
|
|
2365
|
+
y === D.LHS ? (v = Ve(`M ${p + 10} ${S} c -5 0 -10 5 -10 10 L ${p} ${b - 10} c 0 5 5 10 10 10 M ${p} ${x} h -10`, E), w = me(o, p - 20, x, { anchor: "end", color: N, dataType: "summary", svgId: L })) : (v = Ve(`M ${m - 10} ${S} c 5 0 10 5 10 10 L ${m} ${b - 10} c 0 5 -5 10 -10 10 M ${m} ${x} h 10`, E), w = me(o, m + 20, x, { anchor: "start", color: N, dataType: "summary", svgId: L }));
|
|
2362
2366
|
const A = mo(L);
|
|
2363
|
-
return A.appendChild(
|
|
2364
|
-
},
|
|
2367
|
+
return A.appendChild(v), e.labelContainer.appendChild(w), he(w), A.summaryObj = t, A.labelEl = w, f.appendChild(A), A;
|
|
2368
|
+
}, bo = function(e = {}) {
|
|
2365
2369
|
if (!this.currentNodes)
|
|
2366
2370
|
return;
|
|
2367
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent:
|
|
2371
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = go(t), r = { id: I(), parent: s, start: i, end: l, label: "summary", style: e.style }, c = Le(this, r);
|
|
2368
2372
|
n.push(r), this.editSummary(c), o.fire("operation", {
|
|
2369
2373
|
name: "createSummary",
|
|
2370
2374
|
obj: r
|
|
@@ -2377,7 +2381,7 @@ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2377
2381
|
});
|
|
2378
2382
|
}, xo = function(e) {
|
|
2379
2383
|
var n, o;
|
|
2380
|
-
const t = this.summaries.findIndex((
|
|
2384
|
+
const t = this.summaries.findIndex((s) => s.id === e);
|
|
2381
2385
|
t > -1 && (this.summaries.splice(t, 1), (n = this.nodes.querySelector("#s-" + e)) == null || n.remove(), (o = this.nodes.querySelector("#label-s-" + e)) == null || o.remove()), this.bus.fire("operation", {
|
|
2382
2386
|
name: "removeSummary",
|
|
2383
2387
|
obj: { id: e }
|
|
@@ -2399,7 +2403,7 @@ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2399
2403
|
e && e.labelEl && et(this, e.labelEl, e.summaryObj);
|
|
2400
2404
|
}, ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2401
2405
|
__proto__: null,
|
|
2402
|
-
createSummary:
|
|
2406
|
+
createSummary: bo,
|
|
2403
2407
|
createSummaryFrom: wo,
|
|
2404
2408
|
editSummary: No,
|
|
2405
2409
|
removeSummary: xo,
|
|
@@ -2420,12 +2424,12 @@ function To(e, t) {
|
|
|
2420
2424
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2421
2425
|
}
|
|
2422
2426
|
function Lo(e, t, n, o) {
|
|
2423
|
-
const
|
|
2424
|
-
let
|
|
2425
|
-
return e.text ?
|
|
2427
|
+
const s = document.createElementNS(T, "g");
|
|
2428
|
+
let i = "";
|
|
2429
|
+
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2426
2430
|
`).forEach((r, c) => {
|
|
2427
|
-
const
|
|
2428
|
-
k(
|
|
2431
|
+
const d = document.createElementNS(T, "text");
|
|
2432
|
+
k(d, {
|
|
2429
2433
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2430
2434
|
y: o + parseInt(t.paddingTop) + To(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
|
|
2431
2435
|
"text-anchor": "start",
|
|
@@ -2433,15 +2437,15 @@ function Lo(e, t, n, o) {
|
|
|
2433
2437
|
"font-size": `${t.fontSize}`,
|
|
2434
2438
|
"font-weight": `${t.fontWeight}`,
|
|
2435
2439
|
fill: `${t.color}`
|
|
2436
|
-
}),
|
|
2437
|
-
}),
|
|
2440
|
+
}), d.innerHTML = r, s.appendChild(d);
|
|
2441
|
+
}), s;
|
|
2438
2442
|
}
|
|
2439
2443
|
function Ao(e, t, n, o) {
|
|
2440
2444
|
var r;
|
|
2441
|
-
let
|
|
2442
|
-
(r = e.nodeObj) != null && r.dangerouslySetInnerHTML ?
|
|
2443
|
-
const
|
|
2444
|
-
k(
|
|
2445
|
+
let s = "";
|
|
2446
|
+
(r = e.nodeObj) != null && r.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2447
|
+
const i = document.createElementNS(T, "foreignObject");
|
|
2448
|
+
k(i, {
|
|
2445
2449
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2446
2450
|
y: o + parseInt(t.paddingTop) + "",
|
|
2447
2451
|
width: t.width,
|
|
@@ -2451,13 +2455,13 @@ function Ao(e, t, n, o) {
|
|
|
2451
2455
|
return k(l, {
|
|
2452
2456
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
2453
2457
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2454
|
-
}), l.innerHTML =
|
|
2458
|
+
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2455
2459
|
}
|
|
2456
2460
|
function Mo(e, t) {
|
|
2457
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop:
|
|
2458
|
-
return k(
|
|
2461
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(T, "rect");
|
|
2462
|
+
return k(i, {
|
|
2459
2463
|
x: o + "",
|
|
2460
|
-
y:
|
|
2464
|
+
y: s + "",
|
|
2461
2465
|
rx: n.borderRadius,
|
|
2462
2466
|
ry: n.borderRadius,
|
|
2463
2467
|
width: n.width,
|
|
@@ -2465,13 +2469,13 @@ function Mo(e, t) {
|
|
|
2465
2469
|
fill: n.backgroundColor,
|
|
2466
2470
|
stroke: n.borderColor,
|
|
2467
2471
|
"stroke-width": n.borderWidth
|
|
2468
|
-
}),
|
|
2472
|
+
}), i;
|
|
2469
2473
|
}
|
|
2470
2474
|
function oe(e, t, n = !1) {
|
|
2471
|
-
const o = getComputedStyle(t), { offsetLeft:
|
|
2475
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = O(e.nodes, t), l = document.createElementNS(T, "rect");
|
|
2472
2476
|
k(l, {
|
|
2473
|
-
x:
|
|
2474
|
-
y:
|
|
2477
|
+
x: s + "",
|
|
2478
|
+
y: i + "",
|
|
2475
2479
|
rx: o.borderRadius,
|
|
2476
2480
|
ry: o.borderRadius,
|
|
2477
2481
|
width: o.width,
|
|
@@ -2483,71 +2487,71 @@ function oe(e, t, n = !1) {
|
|
|
2483
2487
|
const r = document.createElementNS(T, "g");
|
|
2484
2488
|
r.appendChild(l);
|
|
2485
2489
|
let c;
|
|
2486
|
-
return n ? c = Ao(t, o,
|
|
2490
|
+
return n ? c = Ao(t, o, s, i) : c = Lo(t, o, s, i), r.appendChild(c), r;
|
|
2487
2491
|
}
|
|
2488
2492
|
function Do(e, t) {
|
|
2489
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop:
|
|
2493
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(T, "a"), l = document.createElementNS(T, "text");
|
|
2490
2494
|
return k(l, {
|
|
2491
2495
|
x: o + "",
|
|
2492
|
-
y:
|
|
2496
|
+
y: s + parseInt(n.fontSize) + "",
|
|
2493
2497
|
"text-anchor": "start",
|
|
2494
2498
|
"font-family": n.fontFamily,
|
|
2495
2499
|
"font-size": `${n.fontSize}`,
|
|
2496
2500
|
"font-weight": `${n.fontWeight}`,
|
|
2497
2501
|
fill: `${n.color}`
|
|
2498
|
-
}), l.innerHTML = t.textContent,
|
|
2502
|
+
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2499
2503
|
}
|
|
2500
2504
|
function Po(e, t) {
|
|
2501
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop:
|
|
2502
|
-
return k(
|
|
2505
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(T, "image");
|
|
2506
|
+
return k(i, {
|
|
2503
2507
|
x: o + "",
|
|
2504
|
-
y:
|
|
2508
|
+
y: s + "",
|
|
2505
2509
|
width: n.width + "",
|
|
2506
2510
|
height: n.height + "",
|
|
2507
2511
|
href: t.src
|
|
2508
|
-
}),
|
|
2512
|
+
}), i;
|
|
2509
2513
|
}
|
|
2510
|
-
const
|
|
2511
|
-
var
|
|
2512
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
2514
|
+
const se = 100, $o = '<?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">', Oo = (e, t = !1) => {
|
|
2515
|
+
var u, g, y;
|
|
2516
|
+
const n = e.nodes, o = n.offsetHeight + se * 2, s = n.offsetWidth + se * 2, i = _o(o + "px", s + "px"), l = document.createElementNS(T, "svg"), r = document.createElementNS(T, "rect");
|
|
2513
2517
|
k(r, {
|
|
2514
2518
|
x: "0",
|
|
2515
2519
|
y: "0",
|
|
2516
|
-
width: `${
|
|
2520
|
+
width: `${s}`,
|
|
2517
2521
|
height: `${o}`,
|
|
2518
2522
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2519
|
-
}),
|
|
2520
|
-
const
|
|
2521
|
-
|
|
2523
|
+
}), i.appendChild(r), n.querySelectorAll(".subLines").forEach((p) => {
|
|
2524
|
+
const m = p.cloneNode(!0), { offsetLeft: a, offsetTop: h } = O(n, p.parentElement);
|
|
2525
|
+
m.setAttribute("x", `${a}`), m.setAttribute("y", `${h}`), l.appendChild(m);
|
|
2522
2526
|
});
|
|
2523
|
-
const c = (
|
|
2527
|
+
const c = (u = n.querySelector(".lines")) == null ? void 0 : u.cloneNode(!0);
|
|
2524
2528
|
c && l.appendChild(c);
|
|
2525
|
-
const
|
|
2526
|
-
|
|
2527
|
-
const
|
|
2528
|
-
return
|
|
2529
|
-
|
|
2530
|
-
}), n.querySelectorAll(".tags > span").forEach((
|
|
2531
|
-
l.appendChild(oe(e,
|
|
2532
|
-
}), n.querySelectorAll(".icons > span").forEach((
|
|
2533
|
-
l.appendChild(oe(e,
|
|
2534
|
-
}), n.querySelectorAll(".hyper-link").forEach((
|
|
2535
|
-
l.appendChild(Do(e,
|
|
2536
|
-
}), n.querySelectorAll("img").forEach((
|
|
2537
|
-
l.appendChild(Po(e,
|
|
2529
|
+
const d = (g = n.querySelector(".topiclinks")) == null ? void 0 : g.cloneNode(!0);
|
|
2530
|
+
d && l.appendChild(d);
|
|
2531
|
+
const f = (y = n.querySelector(".summary")) == null ? void 0 : y.cloneNode(!0);
|
|
2532
|
+
return f && l.appendChild(f), n.querySelectorAll("me-tpc").forEach((p) => {
|
|
2533
|
+
p.nodeObj.dangerouslySetInnerHTML ? l.appendChild(oe(e, p, !t)) : (l.appendChild(Mo(e, p)), l.appendChild(oe(e, p.text, !t)));
|
|
2534
|
+
}), n.querySelectorAll(".tags > span").forEach((p) => {
|
|
2535
|
+
l.appendChild(oe(e, p));
|
|
2536
|
+
}), n.querySelectorAll(".icons > span").forEach((p) => {
|
|
2537
|
+
l.appendChild(oe(e, p));
|
|
2538
|
+
}), n.querySelectorAll(".hyper-link").forEach((p) => {
|
|
2539
|
+
l.appendChild(Do(e, p));
|
|
2540
|
+
}), n.querySelectorAll("img").forEach((p) => {
|
|
2541
|
+
l.appendChild(Po(e, p));
|
|
2538
2542
|
}), k(l, {
|
|
2539
|
-
x:
|
|
2540
|
-
y:
|
|
2543
|
+
x: se + "",
|
|
2544
|
+
y: se + "",
|
|
2541
2545
|
overflow: "visible"
|
|
2542
|
-
}),
|
|
2546
|
+
}), i.appendChild(l), i;
|
|
2543
2547
|
}, jo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), $o + e.outerHTML);
|
|
2544
2548
|
function Ho(e) {
|
|
2545
2549
|
return new Promise((t, n) => {
|
|
2546
2550
|
const o = new FileReader();
|
|
2547
|
-
o.onload = (
|
|
2548
|
-
t(
|
|
2549
|
-
}, o.onerror = (
|
|
2550
|
-
n(
|
|
2551
|
+
o.onload = (s) => {
|
|
2552
|
+
t(s.target.result);
|
|
2553
|
+
}, o.onerror = (s) => {
|
|
2554
|
+
n(s);
|
|
2551
2555
|
}, o.readAsDataURL(e);
|
|
2552
2556
|
});
|
|
2553
2557
|
}
|
|
@@ -2556,12 +2560,12 @@ const Bo = function(e = !1, t) {
|
|
|
2556
2560
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2557
2561
|
}, Ro = async function(e = !1, t) {
|
|
2558
2562
|
const n = this.exportSvg(e, t), o = await Ho(n);
|
|
2559
|
-
return new Promise((
|
|
2563
|
+
return new Promise((s, i) => {
|
|
2560
2564
|
const l = new Image();
|
|
2561
2565
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
2562
2566
|
const r = document.createElement("canvas");
|
|
2563
|
-
r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(
|
|
2564
|
-
}, l.src = o, l.onerror =
|
|
2567
|
+
r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(s, "image/png", 1);
|
|
2568
|
+
}, l.src = o, l.onerror = i;
|
|
2565
2569
|
});
|
|
2566
2570
|
}, Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2567
2571
|
__proto__: null,
|
|
@@ -2574,13 +2578,13 @@ function Io(e, t) {
|
|
|
2574
2578
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2575
2579
|
};
|
|
2576
2580
|
}
|
|
2577
|
-
const
|
|
2578
|
-
for (let e = 0; e <
|
|
2579
|
-
const t =
|
|
2581
|
+
const Ue = Object.keys(at), ft = {};
|
|
2582
|
+
for (let e = 0; e < Ue.length; e++) {
|
|
2583
|
+
const t = Ue[e];
|
|
2580
2584
|
ft[t] = Io(at[t], t);
|
|
2581
2585
|
}
|
|
2582
2586
|
const Wo = {
|
|
2583
|
-
getObjById:
|
|
2587
|
+
getObjById: ie,
|
|
2584
2588
|
generateNewObj: mt,
|
|
2585
2589
|
layout: Nt,
|
|
2586
2590
|
linkDiv: $t,
|
|
@@ -2606,24 +2610,24 @@ const Wo = {
|
|
|
2606
2610
|
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;
|
|
2607
2611
|
}
|
|
2608
2612
|
};
|
|
2609
|
-
function
|
|
2610
|
-
let
|
|
2611
|
-
const
|
|
2612
|
-
let
|
|
2613
|
-
c === D.LHS ?
|
|
2614
|
-
const
|
|
2615
|
-
return c === D.LHS ?
|
|
2613
|
+
function Ko({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, containerHeight: d }) {
|
|
2614
|
+
let f = t + n / 2;
|
|
2615
|
+
const u = e + o / 2;
|
|
2616
|
+
let g;
|
|
2617
|
+
c === D.LHS ? g = i + l : g = i;
|
|
2618
|
+
const y = s + r / 2, m = (1 - Math.abs(y - u) / d) * 0.25 * (n / 2);
|
|
2619
|
+
return c === D.LHS ? f = f - n / 10 - m : f = f + n / 10 + m, `M ${f} ${u} Q ${f} ${y} ${g} ${y}`;
|
|
2616
2620
|
}
|
|
2617
|
-
function
|
|
2618
|
-
const
|
|
2619
|
-
let
|
|
2620
|
-
|
|
2621
|
-
const
|
|
2622
|
-
let
|
|
2623
|
-
const
|
|
2624
|
-
return c === D.LHS ? (
|
|
2621
|
+
function Go({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, isFirst: d }) {
|
|
2622
|
+
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2623
|
+
let u = 0, g = 0;
|
|
2624
|
+
d ? u = e + o / 2 : u = e + o;
|
|
2625
|
+
const y = s + r;
|
|
2626
|
+
let p = 0, m = 0, a = 0;
|
|
2627
|
+
const h = Math.abs(u - y) / 300 * f;
|
|
2628
|
+
return c === D.LHS ? (a = t, p = a + f, m = a - f, g = i + f, `M ${p} ${u} C ${a} ${u} ${a + h} ${y} ${m} ${y} H ${g}`) : (a = t + n, p = a - f, m = a + f, g = i + l - f, `M ${p} ${u} C ${a} ${u} ${a - h} ${y} ${m} ${y} H ${g}`);
|
|
2625
2629
|
}
|
|
2626
|
-
const Yo = "5.2.0
|
|
2630
|
+
const Yo = "5.2.0";
|
|
2627
2631
|
function qo(e) {
|
|
2628
2632
|
return {
|
|
2629
2633
|
x: 0,
|
|
@@ -2639,42 +2643,42 @@ function qo(e) {
|
|
|
2639
2643
|
}
|
|
2640
2644
|
};
|
|
2641
2645
|
}
|
|
2642
|
-
const
|
|
2646
|
+
const K = document;
|
|
2643
2647
|
function $({
|
|
2644
2648
|
el: e,
|
|
2645
2649
|
direction: t,
|
|
2646
2650
|
locale: n,
|
|
2647
2651
|
draggable: o,
|
|
2648
|
-
editable:
|
|
2649
|
-
contextMenu:
|
|
2652
|
+
editable: s,
|
|
2653
|
+
contextMenu: i,
|
|
2650
2654
|
toolBar: l,
|
|
2651
2655
|
keypress: r,
|
|
2652
2656
|
mouseSelectionButton: c,
|
|
2653
|
-
selectionContainer:
|
|
2654
|
-
before:
|
|
2655
|
-
newTopicName:
|
|
2656
|
-
allowUndo:
|
|
2657
|
-
generateMainBranch:
|
|
2658
|
-
generateSubBranch:
|
|
2659
|
-
overflowHidden:
|
|
2660
|
-
theme:
|
|
2661
|
-
alignment:
|
|
2662
|
-
scaleSensitivity:
|
|
2663
|
-
scaleMax:
|
|
2657
|
+
selectionContainer: d,
|
|
2658
|
+
before: f,
|
|
2659
|
+
newTopicName: u,
|
|
2660
|
+
allowUndo: g,
|
|
2661
|
+
generateMainBranch: y,
|
|
2662
|
+
generateSubBranch: p,
|
|
2663
|
+
overflowHidden: m,
|
|
2664
|
+
theme: a,
|
|
2665
|
+
alignment: h,
|
|
2666
|
+
scaleSensitivity: v,
|
|
2667
|
+
scaleMax: w,
|
|
2664
2668
|
scaleMin: C,
|
|
2665
|
-
handleWheel:
|
|
2666
|
-
markdown:
|
|
2667
|
-
imageProxy:
|
|
2669
|
+
handleWheel: S,
|
|
2670
|
+
markdown: b,
|
|
2671
|
+
imageProxy: x
|
|
2668
2672
|
}) {
|
|
2669
|
-
let
|
|
2673
|
+
let E = null;
|
|
2670
2674
|
const N = Object.prototype.toString.call(e);
|
|
2671
|
-
if (N === "[object HTMLDivElement]" ?
|
|
2675
|
+
if (N === "[object HTMLDivElement]" ? E = e : N === "[object String]" && (E = document.querySelector(e)), !E)
|
|
2672
2676
|
throw new Error("MindElixir: el is not a valid element");
|
|
2673
|
-
|
|
2677
|
+
E.style.position = "relative", E.innerHTML = "", this.el = E, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.newTopicName = u || "New Node", this.contextMenu = i ?? !0, this.toolBar = l ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = g ?? !0, this.scaleSensitivity = v ?? 0.1, this.scaleMax = w ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = y || Ko, this.generateSubBranch = p || Go, this.overflowHidden = m ?? !1, this.alignment = h ?? "root", this.handleWheel = S ?? !0, this.markdown = b || void 0, this.imageProxy = x || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = qo(this), this.bus = St(), this.container = K.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
|
|
2674
2678
|
const L = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2675
|
-
this.theme =
|
|
2676
|
-
const A =
|
|
2677
|
-
A.className = "map-canvas", this.map = A, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes =
|
|
2679
|
+
this.theme = a || (L.matches ? xe : we);
|
|
2680
|
+
const A = K.createElement("div");
|
|
2681
|
+
A.className = "map-canvas", this.map = A, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = K.createElement("me-nodes"), this.lines = J("lines"), this.summarySvg = J("summary"), this.linkController = J("linkcontroller"), this.P2 = K.createElement("div"), this.P3 = K.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Oe(), this.line2 = Oe(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = J("topiclinks"), this.labelContainer = K.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Et(this));
|
|
2678
2682
|
}
|
|
2679
2683
|
$.prototype = Wo;
|
|
2680
2684
|
Object.defineProperty($.prototype, "currentNode", {
|